hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
list
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
list
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
list
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
3e0ee4c80dff6758bb675f19422072d4b653d58e
467
java
Java
project-grimoire/src/main/java/luzia/yasmin/ProjectGrimoire/controller/IndexController.java
YasminLuzia/ProjectsWeb
10b0c92062581c56c609c0924b592f6f58a6c9be
[ "MIT" ]
null
null
null
project-grimoire/src/main/java/luzia/yasmin/ProjectGrimoire/controller/IndexController.java
YasminLuzia/ProjectsWeb
10b0c92062581c56c609c0924b592f6f58a6c9be
[ "MIT" ]
null
null
null
project-grimoire/src/main/java/luzia/yasmin/ProjectGrimoire/controller/IndexController.java
YasminLuzia/ProjectsWeb
10b0c92062581c56c609c0924b592f6f58a6c9be
[ "MIT" ]
null
null
null
23.35
114
0.730193
6,328
package luzia.yasmin.ProjectGrimoire.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; /** * @author Yasmin L * @since 04/26/2020 - 3:30pm * @version 1.0 */ @RestController public class IndexController { @GetMapping("/") public String index(){ return "Welcome to the my Grimoire application! Here you'll find some spells for Dungeons and Dragons 5e"; } }
3e0ee5071d021c3f632326ae88ede10eeec92ca1
17,456
java
Java
modules/lwjgl/vulkan/src/generated/java/org/lwjgl/vulkan/VkPipelineRepresentativeFragmentTestStateCreateInfoNV.java
theofficialgman/lwjgl3
efea04818091799aa928f2ff2cd9484d8dfef8eb
[ "BSD-3-Clause" ]
2
2021-11-08T02:57:16.000Z
2021-11-08T09:40:38.000Z
modules/lwjgl/vulkan/src/generated/java/org/lwjgl/vulkan/VkPipelineRepresentativeFragmentTestStateCreateInfoNV.java
theofficialgman/lwjgl3
efea04818091799aa928f2ff2cd9484d8dfef8eb
[ "BSD-3-Clause" ]
null
null
null
modules/lwjgl/vulkan/src/generated/java/org/lwjgl/vulkan/VkPipelineRepresentativeFragmentTestStateCreateInfoNV.java
theofficialgman/lwjgl3
efea04818091799aa928f2ff2cd9484d8dfef8eb
[ "BSD-3-Clause" ]
null
null
null
51.341176
287
0.73247
6,329
/* * Copyright LWJGL. All rights reserved. * License terms: https://www.lwjgl.org/license * MACHINE GENERATED FILE, DO NOT EDIT */ package org.lwjgl.vulkan; import javax.annotation.*; import java.nio.*; import org.lwjgl.*; import org.lwjgl.system.*; import static org.lwjgl.system.MemoryUtil.*; import static org.lwjgl.system.MemoryStack.*; /** * Structure specifying representative fragment test. * * <h5>Description</h5> * * <p>If this structure is not included in the {@code pNext} chain, {@code representativeFragmentTestEnable} is considered to be {@link VK10#VK_FALSE FALSE}, and the representative fragment test is disabled.</p> * * <p>If <a target="_blank" href="https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#shaders-fragment-earlytest">early fragment tests</a> are not enabled in the active fragment shader, the representative fragment shader test has no effect, even if enabled.</p> * * <h5>Valid Usage (Implicit)</h5> * * <ul> * <li>{@code sType} <b>must</b> be {@link NVRepresentativeFragmentTest#VK_STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV}</li> * </ul> * * <h3>Layout</h3> * * <pre><code> * struct VkPipelineRepresentativeFragmentTestStateCreateInfoNV { * VkStructureType {@link #sType}; * void const * {@link #pNext}; * VkBool32 {@link #representativeFragmentTestEnable}; * }</code></pre> */ public class VkPipelineRepresentativeFragmentTestStateCreateInfoNV extends Struct implements NativeResource { /** The struct size in bytes. */ public static final int SIZEOF; /** The struct alignment in bytes. */ public static final int ALIGNOF; /** The struct member offsets. */ public static final int STYPE, PNEXT, REPRESENTATIVEFRAGMENTTESTENABLE; static { Layout layout = __struct( __member(4), __member(POINTER_SIZE), __member(4) ); SIZEOF = layout.getSize(); ALIGNOF = layout.getAlignment(); STYPE = layout.offsetof(0); PNEXT = layout.offsetof(1); REPRESENTATIVEFRAGMENTTESTENABLE = layout.offsetof(2); } /** * Creates a {@code VkPipelineRepresentativeFragmentTestStateCreateInfoNV} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be * visible to the struct instance and vice versa. * * <p>The created instance holds a strong reference to the container object.</p> */ public VkPipelineRepresentativeFragmentTestStateCreateInfoNV(ByteBuffer container) { super(memAddress(container), __checkContainer(container, SIZEOF)); } @Override public int sizeof() { return SIZEOF; } /** the type of this structure. */ @NativeType("VkStructureType") public int sType() { return nsType(address()); } /** {@code NULL} or a pointer to a structure extending this structure. */ @NativeType("void const *") public long pNext() { return npNext(address()); } /** controls whether the representative fragment test is enabled. */ @NativeType("VkBool32") public boolean representativeFragmentTestEnable() { return nrepresentativeFragmentTestEnable(address()) != 0; } /** Sets the specified value to the {@link #sType} field. */ public VkPipelineRepresentativeFragmentTestStateCreateInfoNV sType(@NativeType("VkStructureType") int value) { nsType(address(), value); return this; } /** Sets the specified value to the {@link #pNext} field. */ public VkPipelineRepresentativeFragmentTestStateCreateInfoNV pNext(@NativeType("void const *") long value) { npNext(address(), value); return this; } /** Sets the specified value to the {@link #representativeFragmentTestEnable} field. */ public VkPipelineRepresentativeFragmentTestStateCreateInfoNV representativeFragmentTestEnable(@NativeType("VkBool32") boolean value) { nrepresentativeFragmentTestEnable(address(), value ? 1 : 0); return this; } /** Initializes this struct with the specified values. */ public VkPipelineRepresentativeFragmentTestStateCreateInfoNV set( int sType, long pNext, boolean representativeFragmentTestEnable ) { sType(sType); pNext(pNext); representativeFragmentTestEnable(representativeFragmentTestEnable); return this; } /** * Copies the specified struct data to this struct. * * @param src the source struct * * @return this struct */ public VkPipelineRepresentativeFragmentTestStateCreateInfoNV set(VkPipelineRepresentativeFragmentTestStateCreateInfoNV src) { memCopy(src.address(), address(), SIZEOF); return this; } // ----------------------------------- /** Returns a new {@code VkPipelineRepresentativeFragmentTestStateCreateInfoNV} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV malloc() { return wrap(VkPipelineRepresentativeFragmentTestStateCreateInfoNV.class, nmemAllocChecked(SIZEOF)); } /** Returns a new {@code VkPipelineRepresentativeFragmentTestStateCreateInfoNV} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV calloc() { return wrap(VkPipelineRepresentativeFragmentTestStateCreateInfoNV.class, nmemCallocChecked(1, SIZEOF)); } /** Returns a new {@code VkPipelineRepresentativeFragmentTestStateCreateInfoNV} instance allocated with {@link BufferUtils}. */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV create() { ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF); return wrap(VkPipelineRepresentativeFragmentTestStateCreateInfoNV.class, memAddress(container), container); } /** Returns a new {@code VkPipelineRepresentativeFragmentTestStateCreateInfoNV} instance for the specified memory address. */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV create(long address) { return wrap(VkPipelineRepresentativeFragmentTestStateCreateInfoNV.class, address); } /** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */ @Nullable public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV createSafe(long address) { return address == NULL ? null : wrap(VkPipelineRepresentativeFragmentTestStateCreateInfoNV.class, address); } /** * Returns a new {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. * * @param capacity the buffer capacity */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer malloc(int capacity) { return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity); } /** * Returns a new {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. * * @param capacity the buffer capacity */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer calloc(int capacity) { return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity); } /** * Returns a new {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer} instance allocated with {@link BufferUtils}. * * @param capacity the buffer capacity */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer create(int capacity) { ByteBuffer container = __create(capacity, SIZEOF); return wrap(Buffer.class, memAddress(container), capacity, container); } /** * Create a {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer} instance at the specified memory. * * @param address the memory address * @param capacity the buffer capacity */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer create(long address, int capacity) { return wrap(Buffer.class, address, capacity); } /** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */ @Nullable public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer createSafe(long address, int capacity) { return address == NULL ? null : wrap(Buffer.class, address, capacity); } // ----------------------------------- /** Returns a new {@code VkPipelineRepresentativeFragmentTestStateCreateInfoNV} instance allocated on the thread-local {@link MemoryStack}. */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV mallocStack() { return mallocStack(stackGet()); } /** Returns a new {@code VkPipelineRepresentativeFragmentTestStateCreateInfoNV} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV callocStack() { return callocStack(stackGet()); } /** * Returns a new {@code VkPipelineRepresentativeFragmentTestStateCreateInfoNV} instance allocated on the specified {@link MemoryStack}. * * @param stack the stack from which to allocate */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV mallocStack(MemoryStack stack) { return wrap(VkPipelineRepresentativeFragmentTestStateCreateInfoNV.class, stack.nmalloc(ALIGNOF, SIZEOF)); } /** * Returns a new {@code VkPipelineRepresentativeFragmentTestStateCreateInfoNV} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. * * @param stack the stack from which to allocate */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV callocStack(MemoryStack stack) { return wrap(VkPipelineRepresentativeFragmentTestStateCreateInfoNV.class, stack.ncalloc(ALIGNOF, 1, SIZEOF)); } /** * Returns a new {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer} instance allocated on the thread-local {@link MemoryStack}. * * @param capacity the buffer capacity */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer mallocStack(int capacity) { return mallocStack(capacity, stackGet()); } /** * Returns a new {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. * * @param capacity the buffer capacity */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer callocStack(int capacity) { return callocStack(capacity, stackGet()); } /** * Returns a new {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer} instance allocated on the specified {@link MemoryStack}. * * @param stack the stack from which to allocate * @param capacity the buffer capacity */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer mallocStack(int capacity, MemoryStack stack) { return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity); } /** * Returns a new {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. * * @param stack the stack from which to allocate * @param capacity the buffer capacity */ public static VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer callocStack(int capacity, MemoryStack stack) { return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity); } // ----------------------------------- /** Unsafe version of {@link #sType}. */ public static int nsType(long struct) { return UNSAFE.getInt(null, struct + VkPipelineRepresentativeFragmentTestStateCreateInfoNV.STYPE); } /** Unsafe version of {@link #pNext}. */ public static long npNext(long struct) { return memGetAddress(struct + VkPipelineRepresentativeFragmentTestStateCreateInfoNV.PNEXT); } /** Unsafe version of {@link #representativeFragmentTestEnable}. */ public static int nrepresentativeFragmentTestEnable(long struct) { return UNSAFE.getInt(null, struct + VkPipelineRepresentativeFragmentTestStateCreateInfoNV.REPRESENTATIVEFRAGMENTTESTENABLE); } /** Unsafe version of {@link #sType(int) sType}. */ public static void nsType(long struct, int value) { UNSAFE.putInt(null, struct + VkPipelineRepresentativeFragmentTestStateCreateInfoNV.STYPE, value); } /** Unsafe version of {@link #pNext(long) pNext}. */ public static void npNext(long struct, long value) { memPutAddress(struct + VkPipelineRepresentativeFragmentTestStateCreateInfoNV.PNEXT, value); } /** Unsafe version of {@link #representativeFragmentTestEnable(boolean) representativeFragmentTestEnable}. */ public static void nrepresentativeFragmentTestEnable(long struct, int value) { UNSAFE.putInt(null, struct + VkPipelineRepresentativeFragmentTestStateCreateInfoNV.REPRESENTATIVEFRAGMENTTESTENABLE, value); } // ----------------------------------- /** An array of {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV} structs. */ public static class Buffer extends StructBuffer<VkPipelineRepresentativeFragmentTestStateCreateInfoNV, Buffer> implements NativeResource { private static final VkPipelineRepresentativeFragmentTestStateCreateInfoNV ELEMENT_FACTORY = VkPipelineRepresentativeFragmentTestStateCreateInfoNV.create(-1L); /** * Creates a new {@code VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer} instance backed by the specified container. * * Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values * will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided * by {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV#SIZEOF}, and its mark will be undefined. * * <p>The created buffer instance holds a strong reference to the container object.</p> */ public Buffer(ByteBuffer container) { super(container, container.remaining() / SIZEOF); } public Buffer(long address, int cap) { super(address, null, -1, 0, cap, cap); } Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) { super(address, container, mark, pos, lim, cap); } @Override protected Buffer self() { return this; } @Override protected VkPipelineRepresentativeFragmentTestStateCreateInfoNV getElementFactory() { return ELEMENT_FACTORY; } /** @return the value of the {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV#sType} field. */ @NativeType("VkStructureType") public int sType() { return VkPipelineRepresentativeFragmentTestStateCreateInfoNV.nsType(address()); } /** @return the value of the {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV#pNext} field. */ @NativeType("void const *") public long pNext() { return VkPipelineRepresentativeFragmentTestStateCreateInfoNV.npNext(address()); } /** @return the value of the {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV#representativeFragmentTestEnable} field. */ @NativeType("VkBool32") public boolean representativeFragmentTestEnable() { return VkPipelineRepresentativeFragmentTestStateCreateInfoNV.nrepresentativeFragmentTestEnable(address()) != 0; } /** Sets the specified value to the {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV#sType} field. */ public VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer sType(@NativeType("VkStructureType") int value) { VkPipelineRepresentativeFragmentTestStateCreateInfoNV.nsType(address(), value); return this; } /** Sets the specified value to the {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV#pNext} field. */ public VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer pNext(@NativeType("void const *") long value) { VkPipelineRepresentativeFragmentTestStateCreateInfoNV.npNext(address(), value); return this; } /** Sets the specified value to the {@link VkPipelineRepresentativeFragmentTestStateCreateInfoNV#representativeFragmentTestEnable} field. */ public VkPipelineRepresentativeFragmentTestStateCreateInfoNV.Buffer representativeFragmentTestEnable(@NativeType("VkBool32") boolean value) { VkPipelineRepresentativeFragmentTestStateCreateInfoNV.nrepresentativeFragmentTestEnable(address(), value ? 1 : 0); return this; } } }
3e0ee5af588ce2fa63c873fdee07f5e51e9549b1
2,465
java
Java
gulimall-sms/src/main/java/com/atguigu/gulimall/sms/controller/HomeSubjectController.java
thwjava1/gulimall
1ef8b618ebd777058445d01f5dee845ea748e31a
[ "Apache-2.0" ]
null
null
null
gulimall-sms/src/main/java/com/atguigu/gulimall/sms/controller/HomeSubjectController.java
thwjava1/gulimall
1ef8b618ebd777058445d01f5dee845ea748e31a
[ "Apache-2.0" ]
1
2021-09-20T20:50:58.000Z
2021-09-20T20:50:58.000Z
gulimall-sms/src/main/java/com/atguigu/gulimall/sms/controller/HomeSubjectController.java
thwjava1/gulimall
1ef8b618ebd777058445d01f5dee845ea748e31a
[ "Apache-2.0" ]
null
null
null
25.132653
75
0.697929
6,330
package com.atguigu.gulimall.sms.controller; import java.util.Arrays; import java.util.Map; import com.atguigu.gulimall.commons.bean.PageVo; import com.atguigu.gulimall.commons.bean.QueryCondition; import com.atguigu.gulimall.commons.bean.Resp; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import com.atguigu.gulimall.sms.entity.HomeSubjectEntity; import com.atguigu.gulimall.sms.service.HomeSubjectService; /** * 首页专题表【jd首页下面很多专题,每个专题链接新的页面,展示专题商品信息】 * * @author thw * @email hzdkv@example.com * @date 2019-08-05 11:49:09 */ @Api(tags = "首页专题表【jd首页下面很多专题,每个专题链接新的页面,展示专题商品信息】 管理") @RestController @RequestMapping("sms/homesubject") public class HomeSubjectController { @Autowired private HomeSubjectService homeSubjectService; /** * 列表 */ @ApiOperation("分页查询(排序)") @GetMapping("/list") @PreAuthorize("hasAuthority('sms:homesubject:list')") public Resp<PageVo> list(QueryCondition queryCondition) { PageVo page = homeSubjectService.queryPage(queryCondition); return Resp.ok(page); } /** * 信息 */ @ApiOperation("详情查询") @GetMapping("/info/{id}") @PreAuthorize("hasAuthority('sms:homesubject:info')") public Resp<HomeSubjectEntity> info(@PathVariable("id") Long id){ HomeSubjectEntity homeSubject = homeSubjectService.getById(id); return Resp.ok(homeSubject); } /** * 保存 */ @ApiOperation("保存") @PostMapping("/save") @PreAuthorize("hasAuthority('sms:homesubject:save')") public Resp<Object> save(@RequestBody HomeSubjectEntity homeSubject){ homeSubjectService.save(homeSubject); return Resp.ok(null); } /** * 修改 */ @ApiOperation("修改") @PostMapping("/update") @PreAuthorize("hasAuthority('sms:homesubject:update')") public Resp<Object> update(@RequestBody HomeSubjectEntity homeSubject){ homeSubjectService.updateById(homeSubject); return Resp.ok(null); } /** * 删除 */ @ApiOperation("删除") @PostMapping("/delete") @PreAuthorize("hasAuthority('sms:homesubject:delete')") public Resp<Object> delete(@RequestBody Long[] ids){ homeSubjectService.removeByIds(Arrays.asList(ids)); return Resp.ok(null); } }
3e0ee6349272f2b84ece9e8edb366adcd0c47d47
6,578
java
Java
Comunicador/src/comunicador/ServidorLauncher.java
Prometheus-ETSIIT/locaviewer
44cc07aa167611b2b99c150e0c21251309351e7c
[ "MIT" ]
5
2015-01-13T09:29:20.000Z
2016-12-16T13:00:35.000Z
Comunicador/src/comunicador/ServidorLauncher.java
Prometheus-ETSIIT/locaviewer
44cc07aa167611b2b99c150e0c21251309351e7c
[ "MIT" ]
null
null
null
Comunicador/src/comunicador/ServidorLauncher.java
Prometheus-ETSIIT/locaviewer
44cc07aa167611b2b99c150e0c21251309351e7c
[ "MIT" ]
1
2021-06-17T06:24:37.000Z
2021-06-17T06:24:37.000Z
35.75
97
0.65035
6,331
/* * The MIT License (MIT) * * Copyright (c) 2014 Prometheus * * 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 comunicador; import es.prometheus.dds.DiscoveryChange; import es.prometheus.dds.DiscoveryChangeStatus; import es.prometheus.dds.DiscoveryData; import es.prometheus.dds.DiscoveryListener; import es.prometheus.dds.TopicoControl; import es.prometheus.dds.TopicoControlFactoria; import java.util.SortedSet; import java.util.TreeSet; /** * Ejecuta el servidor si y sólo si este dispositivo es el más prioritario. */ public class ServidorLauncher extends Thread { private static final String CHILD_TOPIC_NAME = "ChildDataTopic"; private final String sala; private final double ancho; private final double largo; private final int prioridad; private final SortedSet<Integer> pubList = new TreeSet<>(); private TopicoControl topico; private Servidor servidor; public ServidorLauncher(String sala, double ancho, double largo, int priority) { this.sala = sala; this.ancho = ancho; this.largo = largo; this.prioridad = priority; } /** * Inicia el programa. * * @param args Uno: el nombre de la sala. * Dos: Ancho de la sala. * Tres: Largo de la sala. * Cuatro: Prioridad. */ public static void main(String[] args) { if (args.length != 4) { System.err.println("[ServidorLauncher] Número de argumentos inválido."); return; } // Creamos el comunicador de sensor double ancho = Double.parseDouble(args[1]); double largo = Double.parseDouble(args[2]); int priority = Integer.parseInt(args[3]); ServidorLauncher l = new ServidorLauncher(args[0], ancho, largo, priority); l.start(); // Creamos una hebra para salidas forzosas (Control+C). Runtime.getRuntime().addShutdownHook(new ShutdownThread(l)); } @Override public void run() { // Iniciamos el servidor para que publique su prioridad. this.servidor = new Servidor(this.sala, this.ancho, this.largo, this.prioridad); this.servidor.start(); this.servidor.suspender(); // Iniciamos DDS y que haga magia :D this.iniciaDds(); } public void dispose() { this.topico.dispose(); this.servidor.dispose(); try { this.servidor.join(5000); } catch (InterruptedException e) { } } private void iniciaDds() { // Inicia el participante en el tópico del niño para monitorizar // los publicadores de la sala. this.topico = TopicoControlFactoria.crearControlDinamico( "MisParticipantes::ParticipanteLauncher", CHILD_TOPIC_NAME); // Añade un listener de descubridor de publicadores, filtradas por sala. // Actualizamos las listas por cada publicador ya existente for (DiscoveryData d : this.topico.getParticipanteControl().getDiscoveryWriterData()) onWriterDiscovered(d, DiscoveryChangeStatus.ANADIDO); if (!this.pubList.isEmpty() && this.pubList.first() < this.prioridad) this.servidor.suspender(); else this.servidor.reanudar(); // Listener para cuando se descubra un publicador nuevo. this.topico.getParticipanteControl().addDiscoveryWriterListener(new DiscoveryListener() { @Override public void onChange(DiscoveryChange[] changes) { for (DiscoveryChange ch : changes) onWriterDiscovered(ch.getData(), ch.getStatus()); if (!pubList.isEmpty() && pubList.first() < prioridad) servidor.suspender(); else servidor.reanudar(); } }); } /** * Actualiza las listas de publicadores descubiertos. * * @param data Datos del publicador descubierto. * @param status Estado del publicador descubierto. */ private void onWriterDiscovered(DiscoveryData data, DiscoveryChangeStatus status) { String userData = new String(data.getUserData().toArrayByte(null)); // Nos centramos en un tópico. if (!data.getTopicName().equals(CHILD_TOPIC_NAME)) return; // En los publicadores de nuestra sala String[] fields = userData.split("#"); System.out.printf("[ServidorLauncher] %s -> %s\n", userData, status.name()); String infoSala = fields[0]; int infoPrio = Integer.parseInt(fields[1]); if (!infoSala.equals(this.sala)) return; // Busca si ya está en la lista boolean exists = this.pubList.contains(infoPrio); // Actualiza la lista if (exists && status == DiscoveryChangeStatus.ELIMINADO) { this.pubList.remove(infoPrio); } else if (!exists && status == DiscoveryChangeStatus.ANADIDO) { this.pubList.add(infoPrio); } } /** * Listener llamado cuando se finaliza la aplicación. */ private static class ShutdownThread extends Thread { private final ServidorLauncher servidor; public ShutdownThread(final ServidorLauncher servidor) { this.servidor = servidor; } @Override public void run() { System.out.println("[ServidorLauncher] Parando. . ."); this.servidor.dispose(); try { this.servidor.join(5000); } catch (InterruptedException e) { } } } }
3e0ee68509418219c153b157e4fe1798b15d581a
6,184
java
Java
fivm/common/src/com/fiji/util/MyStack.java
mihirlibran/cse605
bbc1072e1eb892dc37344ec8aca7b7154630a090
[ "Apache-2.0" ]
null
null
null
fivm/common/src/com/fiji/util/MyStack.java
mihirlibran/cse605
bbc1072e1eb892dc37344ec8aca7b7154630a090
[ "Apache-2.0" ]
null
null
null
fivm/common/src/com/fiji/util/MyStack.java
mihirlibran/cse605
bbc1072e1eb892dc37344ec8aca7b7154630a090
[ "Apache-2.0" ]
null
null
null
24.835341
80
0.62031
6,332
/* * MyStack.java * Copyright 2008, 2009, 2010, 2011, 2012, 2013 Fiji Systems Inc. * This file is part of the FIJI VM Software licensed under the FIJI PUBLIC * LICENSE Version 3 or any later version. A copy of the FIJI PUBLIC LICENSE is * available at fivm/LEGAL and can also be found at * http://www.fiji-systems.com/FPL3.txt * * By installing, reproducing, distributing, and/or using the FIJI VM Software * you agree to the terms of the FIJI PUBLIC LICENSE. You may exercise the * rights granted under the FIJI PUBLIC LICENSE subject to the conditions and * restrictions stated therein. Among other conditions and restrictions, the * FIJI PUBLIC LICENSE states that: * * a. You may only make non-commercial use of the FIJI VM Software. * * b. Any adaptation you make must be licensed under the same terms * of the FIJI PUBLIC LICENSE. * * c. You must include a copy of the FIJI PUBLIC LICENSE in every copy of any * file, adaptation or output code that you distribute and cause the output code * to provide a notice of the FIJI PUBLIC LICENSE. * * d. You must not impose any additional conditions. * * e. You must not assert or imply any connection, sponsorship or endorsement by * the author of the FIJI VM Software * * f. You must take no derogatory action in relation to the FIJI VM Software * which would be prejudicial to the FIJI VM Software author's honor or * reputation. * * * The FIJI VM Software is provided as-is. FIJI SYSTEMS INC does not make any * representation and provides no warranty of any kind concerning the software. * * The FIJI PUBLIC LICENSE and any rights granted therein terminate * automatically upon any breach by you of the terms of the FIJI PUBLIC LICENSE. */ package com.fiji.util; import java.util.*; public class MyStack< T > { private static Object[] EMPTY=new Object[0]; Object[] elements; int height; public MyStack() { elements=EMPTY; height=0; } public void push(T value) { if (height==elements.length) { Object[] newElements=new Object[(elements.length+1)*2]; System.arraycopy(elements,0, newElements,0, height); elements=newElements; } elements[height++]=value; } @SuppressWarnings("unchecked") public T pop() { if (height==0) { throw new NoSuchElementException(); } --height; T result=(T)elements[height]; elements[height]=null; return result; } @SuppressWarnings("unchecked") public T peek() { return (T)elements[height-1]; } public int height() { return height; } @SuppressWarnings("unchecked") public T get(int i) { if (i>=height) { throw new ArrayIndexOutOfBoundsException( ""+i+" is not less than "+height); } return (T)elements[i]; } @SuppressWarnings("unchecked") public T getFromTop(int i) { if (i>=height) { throw new ArrayIndexOutOfBoundsException( ""+i+" is not less than "+height); } return (T)elements[height-i-1]; } public void removeAt(int i) { if (i>=height) { throw new ArrayIndexOutOfBoundsException( ""+i+" is not less than "+height); } for (int j=i;j<height-1;++j) { elements[j]=elements[j+1]; } elements[--height]=null; } public boolean removeFirst(T value) { for (int i=0;i<height;++i) { if (elements[i].equals(value)) { removeAt(i); return true; } } return false; } public boolean contains(T value) { for (int i=0;i<height;++i) { if (elements[i].equals(value)) return true; } return false; } public boolean empty() { return height==0; } public void clear() { for (int i=0;i<height;++i) { elements[i]=null; } height=0; } public void sort(Comparator<? super T> c) { Arrays.sort((T[])elements,0,height,c); } public MyStack< T > copy() { MyStack< T > result=new MyStack< T >(); result.elements=new Object[height]; System.arraycopy(elements,0, result.elements,0, height); result.height=height; return result; } public void set(MyStack< T > other) { if (other.height>elements.length) { elements=new Object[other.height]; } System.arraycopy(other.elements,0, elements,0, other.height); height=other.height; } public void shift(int amount) { for (int i=0;i<height-amount;++i) { elements[i]=elements[i+amount]; } for (int i=height-amount;i<height;++i) { elements[i]=null; } height-=amount; } @SuppressWarnings("unchecked") public boolean equals(Object other_) { if (this==other_) return true; if (!(other_ instanceof MyStack)) return false; MyStack< T > other=(MyStack< T >)other_; if (height!=other.height) return false; for (int i=0;i<height;++i) { if (!elements[i].equals(other.elements[i])) return false; } return true; } public Iterable< T > infiniteView() { return new Iterable< T >() { public Iterator< T > iterator() { return new Iterator< T >() { public boolean hasNext() { return !empty(); } public T next() { return pop(); } public void remove() { throw new UnsupportedOperationException(); } }; } }; } public Iterable< T > finiteView() { return new Iterable< T >() { public Iterator< T > iterator() { return new Iterator< T >() { int i=0; public boolean hasNext() { return i<height; } @SuppressWarnings("unchecked") public T next() { if (i>=height) { throw new NoSuchElementException(); } return (T)elements[i++]; } public void remove() { if (i>=height) { throw new IllegalStateException(); } removeAt(--i); } }; } }; } public String toString() { StringBuilder buf=new StringBuilder(); buf.append("Stack[height = "); buf.append(height); buf.append(": "); for (int i=0;i<height;++i) { if (i!=0) { buf.append(", "); } buf.append(elements[i]); } buf.append("]"); return buf.toString(); } }
3e0ee6ed4c949bb3b1a82fe57811783d66f78f58
1,553
java
Java
modMcf/src/org/aion/mcf/types/AbstractBlockHeaderWrapper.java
ffarsad/aion
c16972b5a128f1a0ba01e426c32ccdcb708dceda
[ "MIT" ]
1
2019-04-05T16:45:24.000Z
2019-04-05T16:45:24.000Z
modMcf/src/org/aion/mcf/types/AbstractBlockHeaderWrapper.java
ffarsad/aion
c16972b5a128f1a0ba01e426c32ccdcb708dceda
[ "MIT" ]
null
null
null
modMcf/src/org/aion/mcf/types/AbstractBlockHeaderWrapper.java
ffarsad/aion
c16972b5a128f1a0ba01e426c32ccdcb708dceda
[ "MIT" ]
2
2019-04-11T18:33:00.000Z
2019-04-11T23:40:52.000Z
22.838235
74
0.607856
6,333
package org.aion.mcf.types; import java.util.Arrays; import org.aion.interfaces.block.BlockHeader; import org.aion.rlp.RLP; import org.aion.util.conversions.Hex; /** AbstractBlockHeaderWrapper */ public abstract class AbstractBlockHeaderWrapper<BH extends BlockHeader> { protected BH header; protected byte[] nodeId; public AbstractBlockHeaderWrapper() {} public AbstractBlockHeaderWrapper(BH header, byte[] nodeId) { this.header = header; this.nodeId = nodeId; } public AbstractBlockHeaderWrapper(byte[] bytes) { parse(bytes); } public byte[] getBytes() { byte[] headerBytes = header.getEncoded(); byte[] nodeIdBytes = RLP.encodeElement(nodeId); return RLP.encodeList(headerBytes, nodeIdBytes); } protected abstract void parse(byte[] bytes); public byte[] getNodeId() { return nodeId; } public byte[] getHash() { return header.getHash(); } public long getNumber() { return header.getNumber(); } public BH getHeader() { return header; } public String getHexStrShort() { return Hex.toHexString(header.getHash()).substring(0, 6); } public boolean sentBy(byte[] nodeId) { return Arrays.equals(this.nodeId, nodeId); } @Override public String toString() { return "BlockHeaderWrapper {" + "header=" + header + ", nodeId=" + Hex.toHexString(nodeId) + '}'; } }
3e0ee764c0657490be041a4a56929b6c843c6211
2,555
java
Java
src/test/java/org/mitre/synthea/world/concepts/CostsTest.java
LeightonDarkins/synthea
85cdc58af2841cdf96668a3b60ba6c6f958047ff
[ "Apache-2.0" ]
2
2020-02-03T22:39:48.000Z
2020-11-29T15:09:46.000Z
src/test/java/org/mitre/synthea/world/concepts/CostsTest.java
LeightonDarkins/synthea
85cdc58af2841cdf96668a3b60ba6c6f958047ff
[ "Apache-2.0" ]
null
null
null
src/test/java/org/mitre/synthea/world/concepts/CostsTest.java
LeightonDarkins/synthea
85cdc58af2841cdf96668a3b60ba6c6f958047ff
[ "Apache-2.0" ]
1
2020-03-05T21:11:20.000Z
2020-03-05T21:11:20.000Z
37.028986
99
0.716634
6,334
package org.mitre.synthea.world.concepts; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; import org.mitre.synthea.helpers.Config; import org.mitre.synthea.world.agents.Person; import org.mitre.synthea.world.concepts.HealthRecord.Code; import org.mitre.synthea.world.concepts.HealthRecord.Entry; public class CostsTest { private Person person; @Before public void setup() { Costs.loadCostData(); person = new Person(System.currentTimeMillis()); } @Test public void testCostByKnownCode() { Code code = new Code("RxNorm","705129","Nitroglycerin 0.4 MG/ACTUAT Mucosal Spray"); // note: cost range = 8.5-400, with mode at 20 double minCost = 8.5; double maxCost = 400; Entry fakeMedication = person.record.medicationStart(0L, code.display); fakeMedication.codes.add(code); double cost = Costs.calculateCost(fakeMedication, person, null, null); // at this point person has no state set, so there won't be a geographic factor applied assertTrue(cost <= maxCost); assertTrue(cost >= minCost); person.attributes.put(Person.STATE, "Massachusetts"); double adjFactor = 1.0333; cost = Costs.calculateCost(fakeMedication, person, null, null); assertTrue(cost <= (maxCost * adjFactor)); assertTrue(cost >= (minCost * adjFactor)); } @Test public void testCostByCodeWithDifferentSystem() { Code code = new Code("SNOMED-CT","705129","Fake SNOMED with the same code as an RxNorm code"); Entry fakeProcedure = person.record.procedure(0L, code.display); fakeProcedure.codes.add(code); // it's the same number as above, but a procedure not a medication, // so we don't expect the same result double cost = Costs.calculateCost(fakeProcedure, person, null, null); double expectedCost = Double.parseDouble(Config.get("generate.costs.default_procedure_cost")); assertEquals(expectedCost, cost, 0.01); // assert the cost is within $0.01 } @Test public void testCostByUnknownCode() { Code code = new Code("RxNorm","111111111111111111","Exaplitol"); Entry fakeMedication = person.record.medicationStart(0L, code.display); fakeMedication.codes.add(code); double cost = Costs.calculateCost(fakeMedication, person, null, null); double expectedCost = Double.parseDouble(Config.get("generate.costs.default_medication_cost")); assertEquals(expectedCost, cost, 0.01); // assert the cost is within $0.01 } }
3e0ee86ea1f60342a82b10f1a66728426cb7e99b
939
java
Java
src/main/java/com/antnest/dto/UserDTO.java
liquid8796/music_player
29601f58f6cbf0c69546019f583b694d64635e42
[ "MIT" ]
null
null
null
src/main/java/com/antnest/dto/UserDTO.java
liquid8796/music_player
29601f58f6cbf0c69546019f583b694d64635e42
[ "MIT" ]
null
null
null
src/main/java/com/antnest/dto/UserDTO.java
liquid8796/music_player
29601f58f6cbf0c69546019f583b694d64635e42
[ "MIT" ]
null
null
null
15.65
48
0.584665
6,335
package com.antnest.dto; import javax.persistence.Column; public class UserDTO { private long id; private String firstName; private String lastName; private int age; private boolean isSinger; public UserDTO() { } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public boolean isSinger() { return isSinger; } public void setSinger(boolean singer) { isSinger = singer; } }
3e0ee884a0d498a45bf5c33691b9b746794554e7
759
java
Java
src/main/java/gd/rf/acro/ace/spells/ConjureFireSpell.java
JSJBDEV/ACE
09ae9add74a386982c0a4cc87ef6fefbe66b47f0
[ "MIT" ]
2
2021-10-30T07:17:48.000Z
2021-10-30T08:17:00.000Z
src/main/java/gd/rf/acro/ace/spells/ConjureFireSpell.java
JSJBDEV/ACE
09ae9add74a386982c0a4cc87ef6fefbe66b47f0
[ "MIT" ]
1
2021-11-12T13:37:25.000Z
2021-12-01T20:43:22.000Z
src/main/java/gd/rf/acro/ace/spells/ConjureFireSpell.java
JSJBDEV/ACE
09ae9add74a386982c0a4cc87ef6fefbe66b47f0
[ "MIT" ]
null
null
null
20.513514
83
0.628458
6,336
package gd.rf.acro.ace.spells; import net.minecraft.block.Blocks; import net.minecraft.entity.LivingEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ConjureFireSpell extends Spell { @Override public String spellType() { return "tap"; } @Override public String element() { return "fire"; } @Override public int tier() { return 0; } @Override public int cost() { return 2; } @Override public void onTapBlock(LivingEntity caster, BlockPos tapped) { if(caster.world.getBlockState(tapped.up()).isAir()) { caster.world.setBlockState(tapped.up(), Blocks.FIRE.getDefaultState()); } } }
3e0ee8cd7d4d4aa1f4106ab0c6e56343c13b036e
2,188
java
Java
jdbi3-utils/src/test/java/cloud/nndi/oss/jdbi/customizers/TestBase64Customizer.java
nndi-oss/jdbi-utils
bc9521be561581db2cd8659ee0091e7886f82fef
[ "MIT" ]
2
2022-01-28T23:03:41.000Z
2022-03-07T16:28:29.000Z
jdbi3-utils/src/test/java/cloud/nndi/oss/jdbi/customizers/TestBase64Customizer.java
nndi-oss/jdbi-utils
bc9521be561581db2cd8659ee0091e7886f82fef
[ "MIT" ]
null
null
null
jdbi3-utils/src/test/java/cloud/nndi/oss/jdbi/customizers/TestBase64Customizer.java
nndi-oss/jdbi-utils
bc9521be561581db2cd8659ee0091e7886f82fef
[ "MIT" ]
null
null
null
32.656716
115
0.64351
6,337
package cloud.nndi.oss.jdbi.customizers; import cloud.nndi.oss.jdbi.HsqldbDatabaseRule; import org.jdbi.v3.core.Handle; import org.jdbi.v3.sqlobject.SqlObjectPlugin; import org.jdbi.v3.sqlobject.customizer.Bind; import org.jdbi.v3.sqlobject.statement.SqlUpdate; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class TestBase64Customizer { public HsqldbDatabaseRule hsql = new HsqldbDatabaseRule(); @BeforeEach public void beforeEach() throws Exception{ hsql.before(); hsql.getJdbi().installPlugin(new SqlObjectPlugin()); Handle h = hsql.getSharedHandle(); h.execute("create table people2(id identity primary key, first_name varchar(50), last_name varchar(50));"); } @AfterEach public void afterEach() { hsql.after(); } @Test public void testShouldEncodeToBase64() { hsql.getSharedHandle() .createUpdate("INSERT INTO people2(first_name, last_name) VALUES (:first_name, :last_name)") .bind("first_name", "John") .bind("last_name", "Banda") .addCustomizer(new Base64Customizer("first_name")) .execute(); String got = hsql.getSharedHandle() .createQuery("SELECT first_name FROM people2 LIMIT 1") .mapTo(String.class) .first(); assertEquals("Sm9obg==", got); } @Test public void testShouldEncodeToBase64OnDAO() { DAO dao = hsql.onDemand(DAO.class); dao.insert( "John", "Banda"); String got = hsql.getSharedHandle() .createQuery("SELECT first_name FROM people2 LIMIT 1") .mapTo(String.class) .first(); assertEquals("Sm9obg==", got); } private static interface DAO { @SqlUpdate("INSERT INTO people2(first_name, last_name) VALUES (:first_name, :last_name)") @BindBase64({"first_name", "last_name"}) void insert(@Bind("first_name") String firstName, @Bind("last_name") String lastName); } }
3e0ee8db4df568012988d79c5a7ad0b4827b3c78
1,797
java
Java
server/src/main/java/org/opensearch/search/profile/query/QueryProfileBreakdown.java
korpx-z/OpenSearch
dd9622fec64805141848537c0cf5265e8650ffb9
[ "Apache-2.0" ]
4,822
2021-04-12T15:03:57.000Z
2022-03-31T23:37:49.000Z
server/src/main/java/org/opensearch/search/profile/query/QueryProfileBreakdown.java
korpx-z/OpenSearch
dd9622fec64805141848537c0cf5265e8650ffb9
[ "Apache-2.0" ]
2,146
2021-04-12T14:10:48.000Z
2022-03-31T23:58:34.000Z
server/src/main/java/org/opensearch/search/profile/query/QueryProfileBreakdown.java
korpx-z/OpenSearch
dd9622fec64805141848537c0cf5265e8650ffb9
[ "Apache-2.0" ]
593
2021-04-12T16:26:05.000Z
2022-03-31T11:33:45.000Z
32.672727
94
0.754035
6,338
/* * SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a * compatible open source license. */ /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch 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. */ /* * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. */ package org.opensearch.search.profile.query; import org.opensearch.search.profile.AbstractProfileBreakdown; import org.opensearch.search.profile.ContextualProfileBreakdown; /** * A record of timings for the various operations that may happen during query execution. * A node's time may be composed of several internal attributes (rewriting, weighting, * scoring, etc). */ public final class QueryProfileBreakdown extends ContextualProfileBreakdown<QueryTimingType> { /** Sole constructor. */ public QueryProfileBreakdown() { super(QueryTimingType.class); } @Override public AbstractProfileBreakdown<QueryTimingType> context(Object context) { return this; } }
3e0ee9c6ace024cbba5ab2e7cca0d6b604e164f3
4,487
java
Java
src/test/java/org/zaproxy/gradle/crowdin/internal/TokenReplacerUnitTest.java
thc202/gradle-plugin-crowdin
56e381364a6a09bab60c70fc04925bb3757d40eb
[ "Apache-2.0" ]
null
null
null
src/test/java/org/zaproxy/gradle/crowdin/internal/TokenReplacerUnitTest.java
thc202/gradle-plugin-crowdin
56e381364a6a09bab60c70fc04925bb3757d40eb
[ "Apache-2.0" ]
1
2021-08-12T15:37:29.000Z
2021-08-12T15:37:29.000Z
src/test/java/org/zaproxy/gradle/crowdin/internal/TokenReplacerUnitTest.java
thc202/gradle-plugin-crowdin
56e381364a6a09bab60c70fc04925bb3757d40eb
[ "Apache-2.0" ]
1
2019-09-27T21:46:11.000Z
2019-09-27T21:46:11.000Z
32.280576
86
0.631825
6,339
/* * Zed Attack Proxy (ZAP) and its related class files. * * ZAP is an HTTP/HTTPS proxy for assessing web application security. * * Copyright 2021 The ZAP Development Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.zaproxy.gradle.crowdin.internal; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.junit.jupiter.api.Test; /** Unit test for {@link TokenReplacer}. */ class TokenReplacerUnitTest { @Test void shouldThrowExceptionIfTokensIsNull() { // Given Map<String, String> tokens = null; // When / Then assertThrows(NullPointerException.class, () -> new TokenReplacer(tokens)); } @Test void shouldThrowExceptionIfTokenValueIsNull() { // Given Map<String, String> tokens = new HashMap<>(); tokens.put("$token1", "A"); tokens.put("$token2", null); // When / Then assertThrows(NullPointerException.class, () -> new TokenReplacer(tokens)); } @Test void shouldThrowExceptionIfTokensIsNullWhenUpdatingTokens() { // Given Map<String, String> tokens = null; TokenReplacer replacer = new TokenReplacer(); // When / Then assertThrows(NullPointerException.class, () -> replacer.updateTokens(tokens)); } @Test void shouldThrowExceptionIfTokenValueIsNullWhenUpdatingTokens() { // Given Map<String, String> tokens = new HashMap<>(); tokens.put("$token1", "A"); tokens.put("$token2", null); TokenReplacer replacer = new TokenReplacer(); // When / Then assertThrows(NullPointerException.class, () -> replacer.updateTokens(tokens)); } @Test void shouldNotReplaceIfNoTokens() { // Given Map<String, String> tokens = Collections.emptyMap(); TokenReplacer replacer = new TokenReplacer(tokens); String value = "no tokens"; // When String result = replacer.replace(value); // Then assertThat(result).isEqualTo(value); } @Test void shouldNotReplaceIfNoTokensSpecified() { // Given TokenReplacer replacer = new TokenReplacer(); String value = "no tokens"; // When String result = replacer.replace(value); // Then assertThat(result).isEqualTo(value); } @Test void shouldNotReplaceIfNullValue() { // Given Map<String, String> tokens = Collections.emptyMap(); TokenReplacer replacer = new TokenReplacer(tokens); String value = null; // When String result = replacer.replace(value); // Then assertThat(result).isNull(); } @Test void shouldReplaceTokens() { // Given Map<String, String> tokens = new HashMap<>(); tokens.put("$token1", "A"); tokens.put("$token2", "B"); TokenReplacer replacer = new TokenReplacer(tokens); String value = "$token1 $token2"; // When String result = replacer.replace(value); // Then assertThat(result).isEqualTo("A B"); } @Test void shouldUpdateAndReplaceTokens() { // Given Map<String, String> oldTokens = new HashMap<>(); oldTokens.put("$oldToken", "1"); TokenReplacer replacer = new TokenReplacer(oldTokens); String value = "$oldToken $newToken1 $newToken2"; Map<String, String> tokens = new HashMap<>(); tokens.put("$newToken1", "A"); tokens.put("$newToken2", "B"); // When String result1 = replacer.replace(value); replacer.updateTokens(tokens); String result2 = replacer.replace(value); // Then assertThat(result1).isEqualTo("1 $newToken1 $newToken2"); assertThat(result2).isEqualTo("$oldToken A B"); } }
3e0eea43c1025f96f0a9fcfa8298e3498d8f5389
949
java
Java
app/src/main/java/id/my/berviantoleo/ecceg_rsa_app/ECCEGActivity.java
berviantoleo/rsa-ecceg-implementation
092d784b483d56031541f888418c63e691098e9b
[ "MIT" ]
null
null
null
app/src/main/java/id/my/berviantoleo/ecceg_rsa_app/ECCEGActivity.java
berviantoleo/rsa-ecceg-implementation
092d784b483d56031541f888418c63e691098e9b
[ "MIT" ]
26
2018-10-26T01:06:55.000Z
2020-10-22T00:56:22.000Z
app/src/main/java/id/my/berviantoleo/ecceg_rsa_app/ECCEGActivity.java
berviantoleo/rsa-ecceg-implementation
092d784b483d56031541f888418c63e691098e9b
[ "MIT" ]
1
2018-10-05T09:33:28.000Z
2018-10-05T09:33:28.000Z
31.633333
101
0.781876
6,340
package id.my.berviantoleo.ecceg_rsa_app; import android.os.Bundle; import id.my.berviantoleo.ecceg_rsa_app.adapter.ECCEGPagerAdapter; import com.google.android.material.tabs.TabLayout; import androidx.appcompat.app.AppCompatActivity; import androidx.viewpager.widget.ViewPager; import butterknife.BindView; import butterknife.ButterKnife; public class ECCEGActivity extends AppCompatActivity { @BindView(R.id.container_ecceg) protected ViewPager mViewPager; @BindView(R.id.tabs_ecceg) protected TabLayout tabLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ecceg); ButterKnife.bind(this); ECCEGPagerAdapter mSectionsPagerAdapter = new ECCEGPagerAdapter(getSupportFragmentManager()); mViewPager.setAdapter(mSectionsPagerAdapter); tabLayout.setupWithViewPager(mViewPager); } }
3e0eece4018fe5dbc28bc2e0503b3897b0035040
1,339
java
Java
core/spoofax.eclipse/src/main/java/mb/spoofax/eclipse/pie/GarbageCollectHandler.java
pmisteliac/spoofax-pie
38eaa6e4a7446c782fa10d863e58bd6430a2c105
[ "Apache-2.0" ]
null
null
null
core/spoofax.eclipse/src/main/java/mb/spoofax/eclipse/pie/GarbageCollectHandler.java
pmisteliac/spoofax-pie
38eaa6e4a7446c782fa10d863e58bd6430a2c105
[ "Apache-2.0" ]
null
null
null
core/spoofax.eclipse/src/main/java/mb/spoofax/eclipse/pie/GarbageCollectHandler.java
pmisteliac/spoofax-pie
38eaa6e4a7446c782fa10d863e58bd6430a2c105
[ "Apache-2.0" ]
null
null
null
38.257143
117
0.743092
6,341
package mb.spoofax.eclipse.pie; import mb.pie.api.MixedSession; import mb.pie.api.Pie; import mb.spoofax.eclipse.SpoofaxEclipseComponent; import mb.spoofax.eclipse.SpoofaxPlugin; import org.checkerframework.checker.nullness.qual.Nullable; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import java.io.IOException; public class GarbageCollectHandler extends AbstractHandler { private final Pie pie; private final PieRunner pieRunner; public GarbageCollectHandler() { final SpoofaxEclipseComponent component = SpoofaxPlugin.getComponent(); this.pie = component.getPie(); this.pieRunner = component.getPieRunner(); } @Override public @Nullable Object execute(ExecutionEvent event) throws ExecutionException { // POTI: creating a generic (not language-specific) session, which has less task definitions, which may cause // problems when running garbage collection. try(final MixedSession session = pie.newSession()) { pieRunner.deleteUnobservedTasks(session, null); } catch(IOException e) { throw new ExecutionException("Deleting unobserved tasks (garbage collection) failed unexpectedly", e); } return null; } }
3e0eed1554dc4c70e4296278f1f9bf96793b77e0
4,697
java
Java
library/src/test/java/com/whiterabbit/postman/ServerInteractionHelperTest.java
fedepaol/PostmanLib--Rings-Twice--Android
b37409c834b7c07c5673f70f13124f9c2f8aa099
[ "Apache-2.0" ]
15
2015-01-04T16:54:03.000Z
2020-02-16T10:16:15.000Z
library/src/test/java/com/whiterabbit/postman/ServerInteractionHelperTest.java
fedepaol/PostmanLib--Rings-Twice--Android
b37409c834b7c07c5673f70f13124f9c2f8aa099
[ "Apache-2.0" ]
null
null
null
library/src/test/java/com/whiterabbit/postman/ServerInteractionHelperTest.java
fedepaol/PostmanLib--Rings-Twice--Android
b37409c834b7c07c5673f70f13124f9c2f8aa099
[ "Apache-2.0" ]
7
2015-03-20T16:54:48.000Z
2021-02-07T21:52:11.000Z
33.55
106
0.703002
6,342
package com.whiterabbit.postman; import android.content.Intent; import com.whiterabbit.postman.exceptions.SendingCommandException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.Robolectric; import org.robolectric.RobolectricTestRunner; import org.robolectric.shadows.ShadowActivity; import org.robolectric.shadows.ShadowIntent; import static org.junit.Assert.*; @RunWith(RobolectricTestRunner.class) public class ServerInteractionHelperTest { private ServerInteractionHelper mHelper; private SimpleClientActivity mActivity; private ShadowActivity mShadowOfActivity; private static final String COMMAND_REQUEST = "MyRequestId"; private static final String RESULT_MESSAGE = "this is a result message"; @Before public void setUp() throws Exception { mActivity = Robolectric.buildActivity(SimpleClientActivity.class).create().start().resume().get(); mShadowOfActivity = Robolectric.shadowOf(mActivity); ServerInteractionHelper.resetInstance(); mHelper = ServerInteractionHelper.getInstance(mActivity); } /** * To be called after a sendCommand to shortcut the startService call * and the handleIntent method of the intent service */ private void shortcutIntentService(){ Intent sentIntent = mShadowOfActivity.getNextStartedService(); ShadowIntent shIntent = Robolectric.shadowOf(sentIntent); assertTrue(InteractionService.class.isAssignableFrom(shIntent.getIntentClass())); InteractionService service = new InteractionService(); service.onHandleIntent(sentIntent); } @Test public void testSendsCommand(){ mHelper.registerEventListener(mActivity, mActivity); SimpleServerCommand command = new SimpleServerCommand(true, RESULT_MESSAGE); try { mHelper.sendCommand(mActivity, command, COMMAND_REQUEST); } catch (SendingCommandException e) { fail("sending command exception"); } assertTrue(mHelper.isRequestAlreadyPending(COMMAND_REQUEST)); shortcutIntentService(); } @Test public void testSendsCommandNoPending(){ mHelper.registerEventListener(mActivity, mActivity); SimpleServerCommand command = new SimpleServerCommand(true, RESULT_MESSAGE); command.setIgnorePending(true); try { mHelper.sendCommand(mActivity, command, COMMAND_REQUEST); } catch (SendingCommandException e) { fail("sending command exception"); } assertFalse(mHelper.isRequestAlreadyPending(COMMAND_REQUEST)); shortcutIntentService(); } @Test public void testCommandSuccess(){ mHelper.registerEventListener(mActivity, mActivity); SimpleServerCommand command = new SimpleServerCommand(true, RESULT_MESSAGE); try { mHelper.sendCommand(mActivity, command, COMMAND_REQUEST); } catch (SendingCommandException e) { fail("sending command exception"); } shortcutIntentService(); assertFalse(mActivity.isIsFailure()); assertEquals(mActivity.getRequestReceived(), COMMAND_REQUEST); assertEquals(mActivity.getServerResult(), RESULT_MESSAGE); assertFalse(mHelper.isRequestAlreadyPending(COMMAND_REQUEST)); } @Test public void testCommandFail(){ mHelper.registerEventListener(mActivity, mActivity); SimpleServerCommand command = new SimpleServerCommand(false, RESULT_MESSAGE); try { mHelper.sendCommand(mActivity, command, COMMAND_REQUEST); } catch (SendingCommandException e) { fail("sending command exception"); } shortcutIntentService(); assertTrue(mActivity.isIsFailure()); assertEquals(mActivity.getRequestReceived(), COMMAND_REQUEST); assertEquals(mActivity.getServerResult(), RESULT_MESSAGE); } @Test public void testTwoSameCommandsAndPending(){ mHelper.registerEventListener(mActivity, mActivity); SimpleServerCommand command = new SimpleServerCommand(false, RESULT_MESSAGE); try { mHelper.sendCommand(mActivity, command, COMMAND_REQUEST); } catch (SendingCommandException e) { fail("sending command exception"); } boolean exceptionThrown = false; try { mHelper.sendCommand(mActivity, command, COMMAND_REQUEST); assertTrue(mHelper.isRequestAlreadyPending(COMMAND_REQUEST)); } catch (SendingCommandException e) { exceptionThrown = true; } assertTrue(exceptionThrown); } }
3e0eed91508d0d3fc9cfbc98fec1535da74317a5
2,286
java
Java
src/com/scalingfiltering/java/controllers/StatisticController.java
HouariZegai/ScalingFiltering
38661555d112c244df6de4bcfadbda5117712bfc
[ "MIT" ]
11
2019-08-03T22:42:18.000Z
2020-01-08T20:38:11.000Z
src/com/scalingfiltering/java/controllers/StatisticController.java
HouariZegai/ScalingFiltering
38661555d112c244df6de4bcfadbda5117712bfc
[ "MIT" ]
null
null
null
src/com/scalingfiltering/java/controllers/StatisticController.java
HouariZegai/ScalingFiltering
38661555d112c244df6de4bcfadbda5117712bfc
[ "MIT" ]
null
null
null
32.197183
85
0.633421
6,343
package com.scalingfiltering.java.controllers; import com.scalingfiltering.java.engine.Filtrage; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.chart.BarChart; import javafx.scene.chart.LineChart; import javafx.scene.chart.XYChart; import java.net.URL; import java.util.ResourceBundle; public class StatisticController implements Initializable { @FXML private LineChart<?, ?> lineChartError; @FXML private BarChart<?, ?> barChartHardComp; @Override public void initialize(URL location, ResourceBundle resources) { loadLineChartError(); loadBarChartHard(); } private void loadLineChartError() { XYChart.Series series1 = new XYChart.Series(); series1.setName("Moyenne d'erreur"); // Populating the series with data for (int i = 0; i < Filtrage.moy_err.length; i++) { series1.getData().add(new XYChart.Data(i + 1 + "", Filtrage.moy_err[i])); System.out.println(Filtrage.moy_err[i]); } // Add the series (lines) to the chart lineChartError.getData().addAll(series1); } private void loadBarChartHard() { XYChart.Series[] series = new XYChart.Series[6]; for(int i = 0; i < series.length; i++) series[i] = new XYChart.Series(); series[0].setName("CPU:i3 RAM:4GB"); series[1].setName("CPU:i3 RAM:8GB"); series[2].setName("CPU:i5 RAM:4GB"); series[3].setName("CPU:i5 RAM:8GB"); series[4].setName("CPU:i7 RAM:8GB"); series[5].setName("CPU:i7 RAM:16GB"); // insert the data to the series (bars) series[0].getData().addAll(new XYChart.Data<>("Time Speed", 70)); series[1].getData().addAll(new XYChart.Data<>("Time Speed", 60)); series[2].getData().addAll(new XYChart.Data<>("Time Speed", 50)); series[3].getData().addAll(new XYChart.Data<>("Time Speed", 48)); series[4].getData().addAll(new XYChart.Data<>("Time Speed", 30)); series[5].getData().addAll(new XYChart.Data<>("Time Speed", 20)); // add the series to the chart barChartHardComp.getData().addAll(series); } @FXML private void onClose() { MainController.dialogStatistic.close(); } }
3e0eede92b0480ff3cc47d6c8660fc3f836ca698
527
java
Java
Java/IsInFibonacci/IsFibonacci.java
sgavil/AlgoCode
6b2ddf534ee02b89869359cf4fcdcf192e37160b
[ "MIT" ]
151
2020-10-01T07:38:26.000Z
2022-03-31T10:07:55.000Z
Java/IsInFibonacci/IsFibonacci.java
sgavil/AlgoCode
6b2ddf534ee02b89869359cf4fcdcf192e37160b
[ "MIT" ]
285
2020-10-01T09:34:29.000Z
2021-08-02T12:13:49.000Z
Java/IsInFibonacci/IsFibonacci.java
sgavil/AlgoCode
6b2ddf534ee02b89869359cf4fcdcf192e37160b
[ "MIT" ]
275
2020-10-01T09:43:51.000Z
2022-03-30T19:30:53.000Z
22.913043
72
0.552182
6,344
import java.util.Scanner; public class IsFibonacci { static boolean isPerfectSquare(int x) { int s = (int) Math.sqrt(x); return (s*s == x); } static boolean isFibonacci(int n) { return isPerfectSquare(5*n*n + 4) || isPerfectSquare(5*n*n - 4); } public static void main(String[] args){ Scanner scan = new Scanner(System.in); int n; while (scan.hasNext()) { n = scan.nextInt(); System.out.println(isFibonacci(n)); } } }
3e0eee47c8911244b866afb471627cda32669d71
3,761
java
Java
src/lo/wolo/pokerccf/RemoteUser.java
mllobet/pokerCCF
2e71b6f52dcdfac4be3cd8b19c9b8bb0d7a1d73a
[ "BSD-3-Clause" ]
1
2019-10-20T17:06:44.000Z
2019-10-20T17:06:44.000Z
src/lo/wolo/pokerccf/RemoteUser.java
mllobet/pokerCCF
2e71b6f52dcdfac4be3cd8b19c9b8bb0d7a1d73a
[ "BSD-3-Clause" ]
null
null
null
src/lo/wolo/pokerccf/RemoteUser.java
mllobet/pokerCCF
2e71b6f52dcdfac4be3cd8b19c9b8bb0d7a1d73a
[ "BSD-3-Clause" ]
2
2017-04-10T10:07:55.000Z
2019-10-20T17:06:47.000Z
31.341667
91
0.764158
6,345
/* Copyright (c) 2011-2013, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package lo.wolo.pokerccf; import com.intel.stc.events.StcException; import com.intel.stc.utility.StcSession; import com.intel.stc.utility.StcSocket; /** * Wrapper class to bind the Connection established Session users. * This class contains the information about socket connection, ReadEngine and WriteEngine. */ public class RemoteUser implements IServiceIOListener{ private StcSession remoteSession = null; private StcSocket socket = null; private ReadEngine reader = null; private WriteEngine writer = null; private CCFManager manager = null; private CCFManager.SessionState sessionState = CCFManager.SessionState.NOTCONNECTED; //Constructor to initialize the reference of RemoteUser. public RemoteUser(StcSession session, CCFManager manager) { remoteSession = session; this.manager = manager; } //To retrieve the StcSession instance. public StcSession getSession(){ return remoteSession; } //To retrieve StcSocket instance. public StcSocket getDataStream() { return socket; } //For setting socket connection. public void setDataStream(StcSocket socket) { this.socket = socket; reader = new ReadEngine(socket.getInputStream(), this); writer = new WriteEngine(socket.getOutputStream(), this); } //To receive the incoming message from remote Session. @Override public void lineReceived(String line) { manager.chatReceived(remoteSession.getUserName(),line); } //To disconnect the connecton. @Override public void remoteDisconnect() { exitConnection(); manager.remoteSessionDisconnected(this); } //To retrieve ReadEngine instance. public ReadEngine getReader(){ return reader; } //To retrieve WriteEngine instance. public WriteEngine getWriter(){ return writer; } //Exit process while terminating the connection. private void exitConnection() { if (reader != null) reader.stop(); if (reader != null) reader.stop(); if (socket != null) { try { socket.close(); } catch (StcException e) {} socket = null; } } //To update Session state. public void setsessionState(CCFManager.SessionState state){ this.sessionState = state; } //To retrieve Session state. public CCFManager.SessionState getsessionState(){ return sessionState; } }
3e0eee513392ea9819d970921137a4e30c532182
698
java
Java
IHMCRoboticsToolkit/test/us/ihmc/robotics/hyperCubeTree/OneDimensionalBoundsTest.java
wxmerkt/ihmc-open-robotics-software
2c47c9a9bd999e7811038e99c3888683f9973a2a
[ "Apache-2.0" ]
null
null
null
IHMCRoboticsToolkit/test/us/ihmc/robotics/hyperCubeTree/OneDimensionalBoundsTest.java
wxmerkt/ihmc-open-robotics-software
2c47c9a9bd999e7811038e99c3888683f9973a2a
[ "Apache-2.0" ]
null
null
null
IHMCRoboticsToolkit/test/us/ihmc/robotics/hyperCubeTree/OneDimensionalBoundsTest.java
wxmerkt/ihmc-open-robotics-software
2c47c9a9bd999e7811038e99c3888683f9973a2a
[ "Apache-2.0" ]
null
null
null
29.083333
102
0.776504
6,346
package us.ihmc.robotics.hyperCubeTree; import org.junit.Test; import us.ihmc.tools.continuousIntegration.ContinuousIntegrationAnnotations.ContinuousIntegrationTest; import static org.junit.Assert.assertEquals; public class OneDimensionalBoundsTest { private static final double eps = 1e-14; @ContinuousIntegrationTest(estimatedDuration = 0.0) @Test(timeout = 30000) public void testIntersection() { OneDimensionalBounds zeroToOne = new OneDimensionalBounds(0.0, 1.0); OneDimensionalBounds zeroToTwenty = new OneDimensionalBounds(0.0, 20.0); OneDimensionalBounds result = zeroToOne.intersectionWith(zeroToTwenty); assertEquals(1.0,result.max(),eps); } }
3e0eef19f1c52443bd1656693bff70eaa058c50e
3,848
java
Java
MoWiDi PC/src/edu/kit/ibds/mowidi/pc/ui/MobileProperties.java
DocGerd/MoWiDi
3fe6011e75bf37eacca8b9d09267f28519df7f97
[ "MIT" ]
null
null
null
MoWiDi PC/src/edu/kit/ibds/mowidi/pc/ui/MobileProperties.java
DocGerd/MoWiDi
3fe6011e75bf37eacca8b9d09267f28519df7f97
[ "MIT" ]
null
null
null
MoWiDi PC/src/edu/kit/ibds/mowidi/pc/ui/MobileProperties.java
DocGerd/MoWiDi
3fe6011e75bf37eacca8b9d09267f28519df7f97
[ "MIT" ]
null
null
null
31.801653
98
0.659044
6,347
/* * @(#)MobileProperties.java * * This file is part of MoWiDi. * * MoWiDi 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. * * MoWiDi 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 MoWiDi. If not, see <http://www.gnu.org/licenses/>. * * Copyright 2010 by PSE23-Team: * * Patrick Kuhn, Michael Auracher, * André Wengert, Kim Spieß, Christopher Schütze */ package edu.kit.ibds.mowidi.pc.ui; import java.awt.Container; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ResourceBundle; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import edu.kit.ibds.mowidi.pc.controller.IController; import edu.kit.ibds.mowidi.pc.data.MobileDevice; /** * This is a properties window of a specific mobile. * * @author Kim Spiess * @author Michael Auracher */ class MobileProperties extends JFrame { /** serialVersionUID. */ private static final long serialVersionUID = -2298235959889261033L; /** The mobile to change properties from. */ private final MobileDevice m; /** The controller. */ private final IController c; /** Text field to change name. */ private final JTextField name; /** Text field to change mount-point. */ private final JTextField mountPoint; /** Button to accept. */ private final JButton accept; /** Button to cancel. */ private final JButton cancel; /** Resource for i18n. */ private final ResourceBundle langResource; /** * constructs a new properties window to a mobile with a reference to the * controller. * * @param m mobile * @param c controller * @param res the language bundle */ public MobileProperties(final MobileDevice m, final IController c, final ResourceBundle res) { super(res.getString("MOBILE_PROPERTIES")); this.langResource = res; this.m = m; this.c = c; this.name = new JTextField(m.getGivenName()); this.mountPoint = new JTextField(m.getMountPoint()); this.accept = new JButton(langResource.getString("ACCEPT")); this.cancel = new JButton(langResource.getString("CANCEL")); this.makeLayout(); this.makeActions(); this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); this.pack(); this.setVisible(true); } private void makeLayout() { final GridLayout gl = new GridLayout(3, 2); this.setLayout(gl); final Container content = this.getContentPane(); content.add(new JLabel(langResource.getString("NAME") + ": ")); content.add(name); content.add(new JLabel(langResource.getString("MOUNTPOINT") + ": ")); content.add(mountPoint); content.add(accept); content.add(cancel); } private void makeActions() { accept.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent arg0) { m.setGivenName(name.getText()); m.setMountPoint(mountPoint.getText()); c.setProperties(m); } }); cancel.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { dispose(); } }); } }
3e0eef503c2384599878392c2a83e0679f8bc645
2,125
java
Java
src/main/java/org/algo/netio/Batch.java
saurabhse/hybo
824055c4aacd20def8454ad5d289d0e129cd6a89
[ "MIT" ]
2
2021-08-06T17:49:15.000Z
2022-01-28T17:50:47.000Z
src/main/java/org/algo/netio/Batch.java
saurabhse/hybo
824055c4aacd20def8454ad5d289d0e129cd6a89
[ "MIT" ]
null
null
null
src/main/java/org/algo/netio/Batch.java
saurabhse/hybo
824055c4aacd20def8454ad5d289d0e129cd6a89
[ "MIT" ]
3
2017-07-11T09:55:09.000Z
2018-09-13T17:44:02.000Z
33.730159
97
0.718118
6,348
/* * Copyright 1997-2017 Optimatika (www.optimatika.se) * * 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 org.algo.netio; import java.util.ArrayList; import java.util.Collection; public class Batch extends ArrayList<Message> { public Batch() { super(); } public Batch(final Collection<? extends Message> collection) { super(collection); } public Batch(final int anInitialCapacity) { super(anInitialCapacity); } public boolean add(final String aCommand) { return super.add(new Message(aCommand)); } public boolean add(final String aCommand, final String anArgument) { return super.add(new Message(aCommand, anArgument)); } public boolean add(final String aCommand, final String anArgument, final String aParameter) { return super.add(new Message(aCommand, anArgument, aParameter)); } public boolean add(final String[] aCommand) { return super.add(new Message(aCommand)); } @Override public String toString() { return Message.toString(this); } }
3e0ef0151cf173e7c8ee7f27cc88ff7eeb768c21
4,384
java
Java
bindings/cli/src/main/java/org/platformlayer/client/cli/commands/PlatformLayerCommandRunnerBase.java
eric-erki/Everything-as-a-service
e7a8cdff2aefa658cb41cffdd8c33d19e3b5bc3c
[ "BSD-3-Clause" ]
6
2015-01-16T04:58:49.000Z
2020-12-30T09:24:56.000Z
bindings/cli/src/main/java/org/platformlayer/client/cli/commands/PlatformLayerCommandRunnerBase.java
platformlayer/platformlayer
e7a8cdff2aefa658cb41cffdd8c33d19e3b5bc3c
[ "BSD-3-Clause" ]
5
2019-11-13T03:01:19.000Z
2021-06-04T00:57:30.000Z
bindings/cli/src/main/java/org/platformlayer/client/cli/commands/PlatformLayerCommandRunnerBase.java
eric-erki/Everything-as-a-service
e7a8cdff2aefa658cb41cffdd8c33d19e3b5bc3c
[ "BSD-3-Clause" ]
1
2020-12-30T09:24:57.000Z
2020-12-30T09:24:57.000Z
27.229814
105
0.753878
6,349
package org.platformlayer.client.cli.commands; import java.io.PrintWriter; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.List; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import org.json.JSONException; import org.json.JSONObject; import org.platformlayer.Format; import org.platformlayer.PlatformLayerClient; import org.platformlayer.PlatformLayerClientException; import org.platformlayer.PrimitiveComparators; import org.platformlayer.UntypedItemJson; import org.platformlayer.UntypedItemXml; import org.platformlayer.client.cli.PlatformLayerCliContext; import org.platformlayer.core.model.PlatformLayerKey; import org.platformlayer.core.model.ServiceInfo; import org.platformlayer.ids.FederationKey; import org.platformlayer.ids.ItemType; import org.platformlayer.ids.ProjectId; import org.platformlayer.ids.ServiceType; import org.platformlayer.jobs.model.JobDataList; import org.platformlayer.jobs.model.JobExecutionData; import org.platformlayer.xml.DomUtils; import com.fathomdb.cli.commands.Ansi; import com.fathomdb.cli.commands.CommandRunnerBase; import com.fathomdb.cli.commands.CommandSpecifier; public abstract class PlatformLayerCommandRunnerBase extends CommandRunnerBase { public static final String NAMESPACE_URI_CORE = "http://platformlayer.org/core/v1.0"; protected PlatformLayerCommandRunnerBase(String verb, String noun) { super(verb, noun); } protected PlatformLayerCommandRunnerBase(CommandSpecifier commandSpecifier) { super(commandSpecifier); } protected PlatformLayerClient getPlatformLayerClient() { return getContext().getPlatformLayerClient(); } @Override protected PlatformLayerCliContext getContext() { return (PlatformLayerCliContext) super.getContext(); } @Override public Object convertToOutputFormat(Object results) { if (results instanceof JobDataList) { return ((JobDataList) results).getJobs(); } return results; } protected ProjectId getProject() { return getContext().getProject(); } protected static String getServiceTypeFromItemType(PlatformLayerClient client, String itemType) throws PlatformLayerClientException { Iterable<ServiceInfo> serviceInfo = client.listServices(true); for (ServiceInfo service : serviceInfo) { for (String type : service.itemTypes) { if (type.equals(itemType)) { return service.serviceType; } } } throw new PlatformLayerClientException("Cannot find service for item: " + itemType); } public static PlatformLayerKey pathToKey(PlatformLayerClient client, String path) throws PlatformLayerClientException { String serviceType; String itemType; if (path.contains("/")) { String[] components = path.split("/"); if (components.length != 2) { throw new IllegalArgumentException("Cannot parse path: " + path); } serviceType = components[0]; itemType = components[1]; } else { itemType = path; serviceType = getServiceTypeFromItemType(client, itemType); } FederationKey host = null; ProjectId project = client.getProject(); return new PlatformLayerKey(host, project, new ServiceType(serviceType), new ItemType(itemType), null); } protected Format getFormat() { switch (getOutputFormat()) { case Json: return Format.JSON; default: return Format.XML; } } @Override public void formatRaw(Object o, PrintWriter writer) { String data; if (o instanceof UntypedItemXml) { UntypedItemXml item = (UntypedItemXml) o; Source src = new DOMSource(item.getRoot()); String xml = DomUtils.toXml(src, 4); data = xml; } else if (o instanceof UntypedItemJson) { UntypedItemJson item = (UntypedItemJson) o; JSONObject root = item.getRoot(); try { data = root.toString(2); } catch (JSONException e) { throw new IllegalStateException("Error formatting JSON", e); } } else { super.formatRaw(o, writer); return; } Ansi ansi = new Ansi(writer); ansi.print(data); ansi.println(); ansi.reset(); } protected void sort(List<JobExecutionData> runs) { if (runs == null) { return; } Collections.sort(runs, new Comparator<JobExecutionData>() { @Override public int compare(JobExecutionData o1, JobExecutionData o2) { Date v1 = o1.startedAt; Date v2 = o2.startedAt; return PrimitiveComparators.compare(v1, v2); } }); } }
3e0ef0a69ea48c9a277142a5e18eb51ffd15e713
6,000
java
Java
myphotos-generator/src/main/java/net/devstudy/myphotos/generator/DataGenerator.java
devstudy-net/myphotos.com
d6c695a158bdb8ac1b6a5240b39b2eea99f2d05f
[ "Apache-2.0" ]
1
2019-05-30T02:40:56.000Z
2019-05-30T02:40:56.000Z
myphotos-generator/src/main/java/net/devstudy/myphotos/generator/DataGenerator.java
devstudy-net/myphotos.com
d6c695a158bdb8ac1b6a5240b39b2eea99f2d05f
[ "Apache-2.0" ]
1
2022-02-16T00:54:42.000Z
2022-02-16T00:54:42.000Z
myphotos-generator/src/main/java/net/devstudy/myphotos/generator/DataGenerator.java
devstudy-net/myphotos.com
d6c695a158bdb8ac1b6a5240b39b2eea99f2d05f
[ "Apache-2.0" ]
7
2018-02-23T10:45:11.000Z
2021-01-27T19:51:12.000Z
36.363636
108
0.692667
6,350
/* * Copyright 2017 </>DevStudy.net. * * 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 net.devstudy.myphotos.generator; import java.io.IOException; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; import java.nio.file.attribute.BasicFileAttributes; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; import javax.ejb.EJB; import javax.inject.Inject; import javax.sql.DataSource; import net.devstudy.myphotos.common.annotation.cdi.Property; import net.devstudy.myphotos.common.config.ImageCategory; import net.devstudy.myphotos.common.model.TempImageResource; import net.devstudy.myphotos.ejb.service.bean.PhotoServiceBean; import net.devstudy.myphotos.ejb.service.bean.ProfileServiceBean; import net.devstudy.myphotos.generator.component.AbstractEnvironmentGenerator; import net.devstudy.myphotos.generator.component.PhotoGenerator; import net.devstudy.myphotos.generator.component.ProfileGenerator; import net.devstudy.myphotos.generator.component.UpdatePhotoService; import net.devstudy.myphotos.model.domain.Photo; import net.devstudy.myphotos.model.domain.Profile; /** * * * @author devstudy * @see http://devstudy.net */ public class DataGenerator extends AbstractEnvironmentGenerator{ @Inject private ProfileGenerator profileGenerator; @Inject private PhotoGenerator photoGenerator; @Inject private UpdatePhotoService updatePhotoService; @EJB private ProfileServiceBean profileServiceBean; @EJB private PhotoServiceBean photoServiceBean; @Resource(mappedName = "MyPhotosDBPool") private DataSource dataSource; @Inject @Property("myphotos.storage.root.dir") private String storageRoot; @Inject @Property("myphotos.media.absolute.root") private String mediaRoot; public static void main(String[] args) throws Exception { new DataGenerator().execute(); } @Override protected void generate() throws Exception { clearExternalResources(); List<Profile> profiles = profileGenerator.generateProfiles(); List<Photo> uploadedPhotos = new ArrayList<>(); for (Profile profile : profiles) { profileServiceBean.signUp(profile, false); profileServiceBean.uploadNewAvatar(profile, new PathImageResource(profile.getAvatarUrl())); List<String> photoPaths = photoGenerator.generatePhotos(profile.getPhotoCount()); for (String path : photoPaths) { Profile dbProfile = profileServiceBean.findById(profile.getId()); uploadedPhotos.add(photoServiceBean.uploadNewPhoto(dbProfile, new PathImageResource(path))); } } updatePhotoService.updatePhotos(uploadedPhotos); updateProfileRating(); System.out.println("Generated " + profiles.size() + " profiles"); System.out.println("Generated " + uploadedPhotos.size() + " photos"); } private void clearExternalResources() throws SQLException, IOException { clearDatabase(); clearDirectory(storageRoot); clearDirectory(mediaRoot + ImageCategory.LARGE_PHOTO.getRelativeRoot()); clearDirectory(mediaRoot + ImageCategory.SMALL_PHOTO.getRelativeRoot()); clearDirectory(mediaRoot + ImageCategory.PROFILE_AVATAR.getRelativeRoot()); } private void clearDatabase() throws SQLException { try (Connection c = dataSource.getConnection(); Statement st = c.createStatement()) { st.executeUpdate("TRUNCATE photo CASCADE"); st.executeUpdate("TRUNCATE access_token CASCADE"); st.executeUpdate("TRUNCATE profile CASCADE"); st.executeQuery("SELECT SETVAL('profile_seq', 1, false)"); st.executeQuery("SELECT SETVAL('photo_seq', 123456, false)"); } System.out.println("Database cleared"); } private void clearDirectory(String directoryPath) throws IOException { Path path = Paths.get(directoryPath); if (Files.exists(path)) { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return super.visitFile(file, attrs); } }); System.out.println("Directory " + directoryPath + " cleared"); } else { Files.createDirectories(path); } } private void updateProfileRating() throws SQLException { try (Connection c = dataSource.getConnection(); PreparedStatement ps = c.prepareStatement("SELECT update_rating()")) { c.setAutoCommit(false); ps.executeQuery(); c.commit(); } } /** * * * @author devstudy * @see http://devstudy.net */ private static class PathImageResource extends TempImageResource { public PathImageResource(String path) throws IOException { Files.copy(Paths.get(path), getTempPath(), REPLACE_EXISTING); } } }
3e0ef0fa9c67ae747a617313f01988f2f993b8ce
5,035
java
Java
module_easeui/src/main/java/com/hyphenate/easeui/EaseConstant.java
RalfNick/PreciousPet
6d3ede20da1fb98545d3e84f96c17a0e63ab667d
[ "Apache-2.0" ]
null
null
null
module_easeui/src/main/java/com/hyphenate/easeui/EaseConstant.java
RalfNick/PreciousPet
6d3ede20da1fb98545d3e84f96c17a0e63ab667d
[ "Apache-2.0" ]
null
null
null
module_easeui/src/main/java/com/hyphenate/easeui/EaseConstant.java
RalfNick/PreciousPet
6d3ede20da1fb98545d3e84f96c17a0e63ab667d
[ "Apache-2.0" ]
null
null
null
57.873563
104
0.768222
6,351
/** * Copyright (C) 2016 Hyphenate Inc. All rights reserved. * * 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.hyphenate.easeui; public class EaseConstant { public static final String MESSAGE_ATTR_IS_VOICE_CALL = "is_voice_call"; public static final String MESSAGE_ATTR_IS_VIDEO_CALL = "is_video_call"; public static final String MESSAGE_TYPE_RECALL = "message_recall"; public static final String MESSAGE_ATTR_IS_BIG_EXPRESSION = "em_is_big_expression"; public static final String MESSAGE_ATTR_EXPRESSION_ID = "em_expression_id"; public static final String MESSAGE_ATTR_AT_MSG = "em_at_list"; public static final String MESSAGE_ATTR_VALUE_AT_MSG_ALL = "ALL"; public static String TO_HX_USERID = ""; public static final int CHATTYPE_SINGLE = 1; public static final int CHATTYPE_GROUP = 2; public static final int CHATTYPE_CHATROOM = 3; public static final String CONVERSATION_TIME_SHOW = "ConversationTimeShow"; public static final String INIT_CONVERSATION_SHOW = "InitConversationShow"; public static final String SEND_MESSAGE_TAG = "sendMessageTag"; public static final String TL_ADMIN_ZAN_ID = "tl_admin_praise"; public static final String TL_ADMIN_ZAN_NAME = "赞"; public static final String TL_ADMIN_ZAN_IMAGE = "file:///android_asset/chat_system_zan.png"; public static final String DEFAULT_ADMIN_ZAN = "您没有新的赞哦"; public static final String TL_ADMIN_TONGZHI_ID = "tl_admin_tongzhi"; public static final String TL_ADMIN_TONGZHI_NAME = "通知"; public static final String TL_ADMIN_TONGZHI_IMAGE = "file:///android_asset/chat_system_tongzhi.png"; public static final String DEFAULT_ADMIN_TONGZHI = "您没有新的通知哦"; public static final String TL_ADMIN_PINGLUN_ID = "tl_admin_pinglun"; public static final String TL_ADMIN_PINGLUN_NAME = "评论"; public static final String TL_ADMIN_PINGLUN_IMAGE = "file:///android_asset/chat_system_pinglun.png"; public static final String DEFAULT_ADMIN_PINGLUN = "您没有新的评论哦"; public static final String TL_ADMIN_GUANZHU_ID = "tl_admin_guanzhu"; public static final String TL_ADMIN_GUANZHU_NAME = "未关注人的消息"; public static final String TL_ADMIN_GUANZHU_IMAGE = "file:///android_asset/chat_system_guanzhu.png"; public static final String DEFAULT_ADMIN_GUANZHU = "您没有新的关注消息哦"; public static final String TL_ADMIN_TIXING_ID = "tl_admin_tixing"; public static final String TL_ADMIN_TIXING_NAME = "提醒"; public static final String TL_ADMIN_TIXING_IMAGE = "file:///android_asset/chat_system_tixing.png"; public static final String DEFAULT_ADMIN_TIXING = "您还没有新的提醒哦"; public static final String EXTRA_CHAT_TYPE = "chatType"; public static final String EXTRA_USER_ID = "userId";// 对方的ID public static final String EXTRA_USER_ID_ID = "userIdId";// 对方的ID public static final String EXTRA_USER_HXID = "userId";// 对方的环信ID public static final String EXTRA_USER_NAME = "userName";// 对方的昵称 public static final String EXTRA_USER_IMAGE = "userImage";// 对方的头像 public static final String EXTRA_OTHER_USER_NAME = "otherUserName";// 对方的昵称 public static final String EXTRA_OTHER_USER_IMAGE = "otherUserImage";// 对方的头像 public static final String EXTRA_OTHER_USER_ID = "otherUserId";// 对方的头像 public static final String EXTRA_CONTENT_USER_HEAD_IMAGE = "contentHeadImage";// 点赞人/评论人/通知人 头像 public static final String EXTRA_CONTENT_USER_NAME = "contentUserName";// 点赞人/评论人/通知人 昵称 public static final String EXTRA_CONTENT_USER_ID = "contentUserId";// 点赞人/评论人/通知人 ID public static final String EXTRA_CONTENT_USER_AGE = "contentUserAge";// 点赞人/评论人/通知人 年龄 public static final String EXTRA_CONTENT_USER_SEX = "contentUserSex";// 点赞人/评论人/通知人 年龄 public static final String EXTRA_CONTENT_USER_PROVINCE = "contentProvince";// 点赞人 省份 public static final String EXTRA_CONTENT_USER_CITY = "contentCity";// 点赞人 城市 public static final String EXTRA_CONTENT_IMAGE = "contentImage";// 点赞/评论/通知 内容图片 public static final String EXTRA_CONTENT_IMAGE_TYPE = "contentImageType";// 点赞/评论/通知 内容图片类型 public static final String EXTRA_CONTENT_ID = "contentId";// 点赞/评论/通知 内容ID public static final String EXTRA_CONTENT_TIME = "contentTime";// 点赞/评论/通知 内容时间戳 public static final String EXTRA_CONTENT_MESSAGE = "contentMessage";// 点赞/评论/通知 内容 public static final String EXTRA_CONTENT_TYPE = "contentType";// 点赞/评论/通知 类型 public static final String EXTRA_CONTENT_BE_MESSAGE = "contentBeMessage";// 点赞/评论/通知 被评论内容 }
3e0ef2bc9c45789205e740bd1ef4dbfa99b0d1d7
1,376
java
Java
src/test/java/de/thro/inf/prg3/a09/model/FighterFactoryTest.java
JulLeuverink/09-adapter-flyweight-jfx
2c738367f398379515aba87b324e88df51055718
[ "MIT" ]
null
null
null
src/test/java/de/thro/inf/prg3/a09/model/FighterFactoryTest.java
JulLeuverink/09-adapter-flyweight-jfx
2c738367f398379515aba87b324e88df51055718
[ "MIT" ]
null
null
null
src/test/java/de/thro/inf/prg3/a09/model/FighterFactoryTest.java
JulLeuverink/09-adapter-flyweight-jfx
2c738367f398379515aba87b324e88df51055718
[ "MIT" ]
1
2018-12-06T10:50:04.000Z
2018-12-06T10:50:04.000Z
25.018182
60
0.741279
6,352
package de.thro.inf.prg3.a09.model; import org.junit.jupiter.api.Test; import java.util.HashSet; import java.util.stream.Collectors; import java.util.stream.IntStream; import static org.junit.jupiter.api.Assertions.*; class FighterFactoryTest { private final FighterFactory fighterFactory; FighterFactoryTest() { fighterFactory = new FighterFactory(); } @Test void createFighterEnsureDifferentNames() { var fighters = new HashSet<>(); for(var i = 0; i < 25; i++){ var fighter = fighterFactory.createFighter(); assertFalse(fighters.contains(fighter.getPilot())); fighters.add(fighter.getPilot()); } } @Test void createFighterEnsureSideOfForce() { var groupedBySideOfForce = IntStream.range(0, 100) .mapToObj(i -> fighterFactory.createFighter()) .collect(Collectors.groupingBy(Fighter::getSideOfForce)); assertEquals(2, groupedBySideOfForce.keySet().size()); } @Test void createFighterEnsureTypesPerSideOfForce() { var groupedBySideOfForce = IntStream.range(0, 100) .mapToObj(i -> fighterFactory.createFighter()) .collect(Collectors.groupingBy(Fighter::getSideOfForce)); for(var sideOfForce : groupedBySideOfForce.keySet()) { var groupedByType = groupedBySideOfForce.get(sideOfForce) .stream() .collect(Collectors.groupingBy(Object::getClass)); assertEquals(3, groupedByType.keySet().size()); } } }
3e0ef381138cdca75245983c96368085ce9f50aa
2,303
java
Java
archunit/src/main/java/com/tngtech/archunit/library/plantuml/PlantUmlComponentDependency.java
bogsi17/ArchUnit
252e363b4429a9ab63a7123e8faa89991e9368c6
[ "Apache-2.0" ]
5
2020-01-10T14:35:15.000Z
2021-03-22T01:56:49.000Z
archunit/src/main/java/com/tngtech/archunit/library/plantuml/PlantUmlComponentDependency.java
bogsi17/ArchUnit
252e363b4429a9ab63a7123e8faa89991e9368c6
[ "Apache-2.0" ]
null
null
null
archunit/src/main/java/com/tngtech/archunit/library/plantuml/PlantUmlComponentDependency.java
bogsi17/ArchUnit
252e363b4429a9ab63a7123e8faa89991e9368c6
[ "Apache-2.0" ]
null
null
null
31.121622
86
0.650022
6,353
/* * Copyright 2019 TNG Technology Consulting GmbH * * 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.tngtech.archunit.library.plantuml; import java.util.Objects; import com.google.common.base.Function; import static com.google.common.base.Preconditions.checkNotNull; class PlantUmlComponentDependency { private final PlantUmlComponent origin; private final PlantUmlComponent target; PlantUmlComponentDependency(PlantUmlComponent origin, PlantUmlComponent target) { this.origin = checkNotNull(origin); this.target = checkNotNull(target); } PlantUmlComponent getOrigin() { return origin; } PlantUmlComponent getTarget() { return target; } @Override public int hashCode() { return Objects.hash(origin, target); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final PlantUmlComponentDependency other = (PlantUmlComponentDependency) obj; return Objects.equals(this.origin, other.origin) && Objects.equals(this.target, other.target); } @Override public String toString() { return getClass().getSimpleName() + "{" + "origin=" + origin + ", target=" + target + '}'; } static final Function<PlantUmlComponentDependency, PlantUmlComponent> GET_TARGET = new Function<PlantUmlComponentDependency, PlantUmlComponent>() { @Override public PlantUmlComponent apply(PlantUmlComponentDependency input) { return input.getTarget(); } }; }
3e0ef3cc45258e8d018a50c36b12f6804872735d
3,772
java
Java
spring-boot-shiro/src/main/java/com/lance/shiro/config/ShiroConfig.java
yangfy5/spring-boot-all
068fac7a9544c2f7dff0ed179455feb9bf382666
[ "Apache-2.0" ]
2,127
2015-01-27T03:32:56.000Z
2022-03-29T08:53:41.000Z
spring-boot-shiro/src/main/java/com/lance/shiro/config/ShiroConfig.java
songwenming/spring-boot-all-1
f2bc423ce7aebbd30d0d6a0af03d69e9a207e2b8
[ "Apache-2.0" ]
25
2016-10-16T11:17:35.000Z
2020-09-04T06:43:03.000Z
spring-boot-shiro/src/main/java/com/lance/shiro/config/ShiroConfig.java
songwenming/spring-boot-all-1
f2bc423ce7aebbd30d0d6a0af03d69e9a207e2b8
[ "Apache-2.0" ]
1,437
2015-02-02T05:36:50.000Z
2022-03-18T21:10:13.000Z
30.666667
80
0.765642
6,354
package com.lance.shiro.config; import java.util.Map; import javax.servlet.DispatcherType; import javax.servlet.Filter; import org.apache.shiro.cache.ehcache.EhCacheManager; import org.apache.shiro.spring.LifecycleBeanPostProcessor; import org.apache.shiro.spring.web.ShiroFilterFactoryBean; import org.apache.shiro.web.filter.authc.AnonymousFilter; import org.apache.shiro.web.mgt.DefaultWebSecurityManager; import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.DependsOn; import org.springframework.web.filter.DelegatingFilterProxy; import com.google.common.collect.Maps; @Configuration public class ShiroConfig { /** * FilterRegistrationBean * @return */ @Bean public FilterRegistrationBean filterRegistrationBean() { FilterRegistrationBean filterRegistration = new FilterRegistrationBean(); filterRegistration.setFilter(new DelegatingFilterProxy("shiroFilter")); filterRegistration.setEnabled(true); filterRegistration.addUrlPatterns("/*"); filterRegistration.setDispatcherTypes(DispatcherType.REQUEST); return filterRegistration; } /** * @see org.apache.shiro.spring.web.ShiroFilterFactoryBean * @return */ @Bean(name = "shiroFilter") public ShiroFilterFactoryBean shiroFilter(){ ShiroFilterFactoryBean bean = new ShiroFilterFactoryBean(); bean.setSecurityManager(securityManager()); bean.setLoginUrl("/login"); bean.setUnauthorizedUrl("/unauthor"); Map<String, Filter>filters = Maps.newHashMap(); filters.put("perms", urlPermissionsFilter()); filters.put("anon", new AnonymousFilter()); bean.setFilters(filters); Map<String, String> chains = Maps.newHashMap(); chains.put("/login", "anon"); chains.put("/unauthor", "anon"); chains.put("/logout", "logout"); chains.put("/base/**", "anon"); chains.put("/css/**", "anon"); chains.put("/layer/**", "anon"); chains.put("/**", "perms"); bean.setFilterChainDefinitionMap(chains); return bean; } /** * @see org.apache.shiro.mgt.SecurityManager * @return */ @Bean(name="securityManager") public DefaultWebSecurityManager securityManager() { DefaultWebSecurityManager manager = new DefaultWebSecurityManager(); manager.setRealm(userRealm()); manager.setCacheManager(cacheManager()); manager.setSessionManager(defaultWebSessionManager()); return manager; } /** * @see DefaultWebSessionManager * @return */ @Bean(name="sessionManager") public DefaultWebSessionManager defaultWebSessionManager() { DefaultWebSessionManager sessionManager = new DefaultWebSessionManager(); sessionManager.setCacheManager(cacheManager()); sessionManager.setGlobalSessionTimeout(1800000); sessionManager.setDeleteInvalidSessions(true); sessionManager.setSessionValidationSchedulerEnabled(true); sessionManager.setDeleteInvalidSessions(true); return sessionManager; } /** * @see UserRealm--->AuthorizingRealm * @return */ @Bean @DependsOn(value="lifecycleBeanPostProcessor") public UserRealm userRealm() { UserRealm userRealm = new UserRealm(); userRealm.setCacheManager(cacheManager()); return userRealm; } @Bean public URLPermissionsFilter urlPermissionsFilter() { return new URLPermissionsFilter(); } @Bean public EhCacheManager cacheManager() { EhCacheManager cacheManager = new EhCacheManager(); cacheManager.setCacheManagerConfigFile("classpath:ehcache.xml"); return cacheManager; } @Bean public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() { return new LifecycleBeanPostProcessor(); } }
3e0ef40f7b8084a3a3f65996e0202d98aa90efcf
8,253
java
Java
integration-cloud/buzzword_sample/webapp/src/main/java/org/wso2/carbon/buzzword/tag/cloud/sample/BuzzwordDAO.java
davizucon/cloud-samples
85068cc45fb181bc70ac02a3e827cbb7a0b36d39
[ "Apache-2.0" ]
1
2022-02-17T14:19:19.000Z
2022-02-17T14:19:19.000Z
integration-cloud/buzzword_sample/webapp/src/main/java/org/wso2/carbon/buzzword/tag/cloud/sample/BuzzwordDAO.java
davizucon/cloud-samples
85068cc45fb181bc70ac02a3e827cbb7a0b36d39
[ "Apache-2.0" ]
null
null
null
integration-cloud/buzzword_sample/webapp/src/main/java/org/wso2/carbon/buzzword/tag/cloud/sample/BuzzwordDAO.java
davizucon/cloud-samples
85068cc45fb181bc70ac02a3e827cbb7a0b36d39
[ "Apache-2.0" ]
5
2017-09-12T06:31:32.000Z
2019-04-08T19:52:06.000Z
42.323077
145
0.666545
6,355
/* * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. 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.wso2.carbon.buzzword.tag.cloud.sample; import org.apache.http.HttpException; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.CookieStore; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.protocol.ClientContext; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.conn.ssl.TrustSelfSignedStrategy; import org.apache.http.impl.client.BasicCookieStore; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; import org.apache.http.ssl.SSLContextBuilder; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import sun.misc.BASE64Encoder; import java.io.*; import java.security.KeyManagementException; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; public class BuzzwordDAO { private static final Logger logger = Logger.getLogger(BuzzwordDAO.class.getName()); public Buzzword[] getBuzzWordList() throws Exception { String apiEndpointUrl = System.getenv("API_ENDPOINT_URL"); logger.info("API_ENDPOINT_URL : " + apiEndpointUrl); try { HttpClient client = getHttpClient(); HttpGet apiMethod = new HttpGet(apiEndpointUrl); apiMethod.addHeader("Authorization", "Bearer " + getAccessToken()); HttpResponse response = client.execute(apiMethod); if (HttpStatus.SC_OK == response.getStatusLine().getStatusCode()) { return formatDataToBuzzWords(getStringFromInputStream(response.getEntity().getContent())); } else { logger.log(Level.SEVERE, "Error occurred invoking the api endpoint. Http Status : " + response.getStatusLine().getStatusCode()); throw new Exception("Failed to get Buzzwords from backend API:" + apiEndpointUrl); } } catch (HttpException e) { logger.log(Level.SEVERE, "Error occurred while invoking API endpoint.", e); throw new Exception("Failed to get Buzzwords from backend API:" + apiEndpointUrl); } catch (IOException e) { logger.log(Level.SEVERE, "Error occurred while invoking API endpoint.", e); throw new Exception("Failed to get Buzzwords from backend API:" + apiEndpointUrl); } } private String getAccessToken() throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException, UnsupportedEncodingException { String apiManagerUrl = System.getenv("API_MANAGER_URL"); String apiEndpointUrl = System.getenv("API_ENDPOINT_URL"); String apiConsumerKey = System.getenv("API_CONSUMER_KEY"); String apiConsumerSecret = System.getenv("API_CONSUMER_SECRET"); logger.info("API_MANAGER_URL: " + apiManagerUrl); logger.info("API_ENDPOINT_URL: " + apiEndpointUrl); logger.info("API_CONSUMER_KEY: " + apiConsumerKey); logger.info("API_CONSUMER_SECRET: " + apiConsumerSecret); String submitUrl = apiManagerUrl.trim() + "/token"; String applicationToken = apiConsumerKey + ":" + apiConsumerSecret; BASE64Encoder base64Encoder = new BASE64Encoder(); applicationToken = "Bearer " + base64Encoder.encode(applicationToken.getBytes()).trim(); logger.info("applicationToken after encoding: " + applicationToken); HttpClient client = getHttpClient(); HttpPost postMethod = new HttpPost(submitUrl); postMethod.addHeader("Authorization", applicationToken); postMethod.addHeader("Content-Type", "application/x-www-form-urlencoded"); List<NameValuePair> params = new ArrayList<NameValuePair>(3); params.add(new BasicNameValuePair("grant_type", "client_credentials")); postMethod.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); String accessToken = null; try { HttpResponse response= client.execute(postMethod); logger.info("Http status code after invoking token endpoint : " + response.getStatusLine().getStatusCode()); if (HttpStatus.SC_OK == response.getStatusLine().getStatusCode()) { String accessTokenJson = getStringFromInputStream(response.getEntity().getContent()); JSONParser parser = new JSONParser(); Object obj = parser.parse(accessTokenJson); JSONObject jsonObject = (JSONObject) obj; accessToken = (String) jsonObject.get("access_token"); } else { logger.log(Level.SEVERE, "Error occurred invoking the token endpoint \n Http status : " + response.getStatusLine().getStatusCode() + " response: " + getStringFromInputStream(response.getEntity().getContent())); } } catch (Exception ex) { logger.log(Level.SEVERE, "Error occurred while invoking token endpoint.", ex); } logger.info("Access Token - " + accessToken); return accessToken; } private Buzzword[] formatDataToBuzzWords(String values) { if (values != null) { values = values.replaceAll("\\{", "").replaceAll("}", ""); } else { return new Buzzword[0]; } List<Buzzword> list = new ArrayList<Buzzword>(); String[] elements = values.split(","); for (String element : elements) { String[] wordRankSplits = element.split("="); String word = wordRankSplits[0].trim(); String rank = wordRankSplits[1].trim(); logger.info("word and rank: " + word + " " + rank); Buzzword buzzword = new Buzzword(word, Integer.parseInt(rank) * 5); list.add(buzzword); } return list.toArray(new Buzzword[list.size()]); } private HttpClient getHttpClient() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException { SSLContextBuilder builder = new SSLContextBuilder(); builder.loadTrustMaterial(null, new TrustSelfSignedStrategy()); SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(builder.build()); // create a post request to addAPI. HttpClient httpclient = HttpClients.custom().setSSLSocketFactory(sslsf).build(); return httpclient; } private static String getStringFromInputStream(InputStream is) { BufferedReader br = null; StringBuilder sb = new StringBuilder(); String line; try { br = new BufferedReader(new InputStreamReader(is)); while ((line = br.readLine()) != null) { sb.append(line); } } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } return sb.toString(); } }
3e0ef4c8a5e5ffc4520dba80f93b90fac9c730ce
5,100
java
Java
client/rest-high-level/src/test/java/org/elasticsearch/client/watcher/ExecuteWatchResponseTests.java
YMhao/elasticsearch
3bb826aa5cf477d3f0cc2397bda517d501c08b9a
[ "Apache-2.0" ]
1,125
2016-09-11T17:27:35.000Z
2022-03-29T13:41:58.000Z
client/rest-high-level/src/test/java/org/elasticsearch/client/watcher/ExecuteWatchResponseTests.java
YMhao/elasticsearch
3bb826aa5cf477d3f0cc2397bda517d501c08b9a
[ "Apache-2.0" ]
346
2016-12-03T18:37:07.000Z
2022-03-29T08:33:04.000Z
client/rest-high-level/src/test/java/org/elasticsearch/client/watcher/ExecuteWatchResponseTests.java
YMhao/elasticsearch
3bb826aa5cf477d3f0cc2397bda517d501c08b9a
[ "Apache-2.0" ]
190
2016-12-15T13:46:19.000Z
2022-03-04T05:17:11.000Z
43.965517
135
0.714902
6,356
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch 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.elasticsearch.client.watcher; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.ObjectPath; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.test.ESTestCase; import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.Map; import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; import static org.hamcrest.Matchers.is; public class ExecuteWatchResponseTests extends ESTestCase { public static final String WATCH_ID_VALUE = "my_watch"; public static final String NODE_VALUE = "my_node"; public static final String TRIGGER_TYPE_VALUE = "manual"; public static final String STATE_VALUE = "executed"; public static final String STATE_KEY = "state"; public static final String TRIGGER_EVENT_KEY = "trigger_event"; public static final String TRIGGER_EVENT_TYPE_KEY = "type"; public static final String MESSAGES_KEY = "messages"; public static final String NODE_KEY = "node"; public static final String WATCH_ID_KEY = "watch_id"; public void testFromXContent() throws IOException { xContentTester(this::createParser, ExecuteWatchResponseTests::createTestInstance, this::toXContent, ExecuteWatchResponse::fromXContent) .supportsUnknownFields(true) .assertEqualsConsumer(this::assertEqualInstances) .assertToXContentEquivalence(false) .test(); } private void assertEqualInstances(ExecuteWatchResponse expected, ExecuteWatchResponse actual) { assertThat(expected.getRecordId(), is(actual.getRecordId())); // This may have extra json, so lets just assume that if all of the original fields from the creation are there, then its equal // This is the same code that is in createTestInstance in this class. Map<String, Object> actualMap = actual.getRecordAsMap(); assertThat(ObjectPath.eval(WATCH_ID_KEY, actualMap), is(WATCH_ID_VALUE)); assertThat(ObjectPath.eval(NODE_KEY, actualMap), is(NODE_VALUE)); List<Object> messages = ObjectPath.eval(MESSAGES_KEY, actualMap); assertThat(messages.size(), is(0)); assertThat(ObjectPath.eval(TRIGGER_EVENT_KEY + "." + TRIGGER_EVENT_TYPE_KEY, actualMap), is(TRIGGER_TYPE_VALUE)); assertThat(ObjectPath.eval(STATE_KEY, actualMap), is(STATE_VALUE)); } private XContentBuilder toXContent(BytesReference bytes, XContentBuilder builder) throws IOException { // EMPTY is safe here because we never use namedObject try (InputStream stream = bytes.streamInput(); XContentParser parser = createParser(JsonXContent.jsonXContent, stream)) { parser.nextToken(); builder.generator().copyCurrentStructure(parser); return builder; } } private XContentBuilder toXContent(ExecuteWatchResponse response, XContentBuilder builder) throws IOException { builder.startObject(); builder.field("_id", response.getRecordId()); builder.field("watch_record"); toXContent(response.getRecord(), builder); return builder.endObject(); } private static ExecuteWatchResponse createTestInstance() { String id = "my_watch_0-2015-06-02T23:17:55.124Z"; try { XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); builder.field(WATCH_ID_KEY, WATCH_ID_VALUE); builder.field(NODE_KEY, NODE_VALUE); builder.startArray(MESSAGES_KEY); builder.endArray(); builder.startObject(TRIGGER_EVENT_KEY); builder.field(TRIGGER_EVENT_TYPE_KEY, TRIGGER_TYPE_VALUE); builder.endObject(); builder.field(STATE_KEY, STATE_VALUE); builder.endObject(); BytesReference bytes = BytesReference.bytes(builder); return new ExecuteWatchResponse(id, bytes); } catch (IOException e) { throw new AssertionError(e); } } }
3e0ef50284a8427259460f212694db7b0f54731f
1,525
java
Java
app/src/main/java/com/example/jingbin/cloudreader/ui/menu/NavHomePageActivity.java
youlookwhat/CloudReader
5290827d2ecefed3590500fe17509ceb4ef9b11b
[ "Apache-2.0" ]
5,081
2016-12-23T11:32:02.000Z
2022-03-31T07:25:25.000Z
app/src/main/java/com/example/jingbin/cloudreader/ui/menu/NavHomePageActivity.java
youlookwhat/CloudReader
5290827d2ecefed3590500fe17509ceb4ef9b11b
[ "Apache-2.0" ]
123
2017-01-03T16:10:21.000Z
2022-03-27T12:20:12.000Z
app/src/main/java/com/example/jingbin/cloudreader/ui/menu/NavHomePageActivity.java
youlookwhat/CloudReader
5290827d2ecefed3590500fe17509ceb4ef9b11b
[ "Apache-2.0" ]
1,528
2016-12-22T01:44:51.000Z
2022-03-31T05:37:41.000Z
36.309524
161
0.775082
6,357
package com.example.jingbin.cloudreader.ui.menu; import android.content.Context; import android.content.Intent; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import androidx.databinding.DataBindingUtil; import com.example.jingbin.cloudreader.R; import com.example.jingbin.cloudreader.databinding.ActivityNavHomePageBinding; import com.example.jingbin.cloudreader.ui.WebViewActivity; import com.example.jingbin.cloudreader.utils.StatusBarUtil; import com.example.jingbin.cloudreader.utils.ToolbarHelper; import me.jingbin.bymvvm.utils.CommonUtils; /** * @author jingbin */ public class NavHomePageActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 4.4 标题透明 StatusBarUtil.setTranslucentStatus(this); ActivityNavHomePageBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_nav_home_page); // 解决7.0以上系统 滑动到顶部 标题裁减一半的问题 // setSupportActionBar(binding.detailToolbar); ToolbarHelper.initFullBar(binding.detailToolbar, this); binding.detailToolbar.setNavigationIcon(null); binding.fabShare.setOnClickListener(v -> WebViewActivity.loadUrl(v.getContext(), CommonUtils.getString(R.string.string_url_cloudreader), "CloudReader")); } public static void startHome(Context mContext) { Intent intent = new Intent(mContext, NavHomePageActivity.class); mContext.startActivity(intent); } }
3e0ef5eefce758fda2d09035b7bbb9eba3a69ee3
507
java
Java
chapter_005/src/test/java/ru/job4j/list/SimpleStackTest.java
Vikkingg13/job4j
c7b6c8d5740b7c7dff777ddd97f4e81c13733fa8
[ "Apache-2.0" ]
1
2020-05-05T20:04:00.000Z
2020-05-05T20:04:00.000Z
chapter_005/src/test/java/ru/job4j/list/SimpleStackTest.java
Vikkingg13/job4j
c7b6c8d5740b7c7dff777ddd97f4e81c13733fa8
[ "Apache-2.0" ]
1
2021-12-14T20:46:48.000Z
2021-12-14T20:46:48.000Z
chapter_005/src/test/java/ru/job4j/list/SimpleStackTest.java
Vikkingg13/job4j
c7b6c8d5740b7c7dff777ddd97f4e81c13733fa8
[ "Apache-2.0" ]
null
null
null
26.684211
72
0.658777
6,358
package ru.job4j.list; import org.junit.Test; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; public class SimpleStackTest { @Test public void whenPushElementsFiveTenFifteenThenPollFifteenTenFive() { SimpleStack<Integer> stack = new SimpleStack<>(); stack.push(5); stack.push(10); stack.push(15); assertThat(stack.poll(), is(15)); assertThat(stack.poll(), is(10)); assertThat(stack.poll(), is(5)); } }
3e0ef696d3d8418620fe4998378b9ecc39309aaf
117
java
Java
services/library/src/main/java/com/google/cloud/pso/bq_pii_classifier/entities/DispatcherType.java
GoogleCloudPlatform/bq-pii-classifier
4fda9080e5f8f5c256effc0dcbea59624b472c7b
[ "Apache-2.0" ]
2
2022-02-18T13:03:23.000Z
2022-02-19T09:47:42.000Z
services/library/src/main/java/com/google/cloud/pso/bq_pii_classifier/entities/DispatcherType.java
GoogleCloudPlatform/bq-pii-classifier
4fda9080e5f8f5c256effc0dcbea59624b472c7b
[ "Apache-2.0" ]
8
2022-02-25T03:27:54.000Z
2022-03-30T03:33:54.000Z
services/library/src/main/java/com/google/cloud/pso/bq_pii_classifier/entities/DispatcherType.java
GoogleCloudPlatform/bq-pii-classifier
4fda9080e5f8f5c256effc0dcbea59624b472c7b
[ "Apache-2.0" ]
null
null
null
16.714286
56
0.769231
6,359
package com.google.cloud.pso.bq_pii_classifier.entities; public enum DispatcherType { INSPECTION, TAGGING }
3e0ef72345fd5a6b0874302909726063d87d23f9
432
java
Java
src/main/java/com/zyc/mrcweb/MrcwebApplication.java
ZYChimne/MRCWeb
3cda7a18a69d817d2c287308e407ceb4d690bc2e
[ "MIT" ]
1
2021-04-06T12:06:32.000Z
2021-04-06T12:06:32.000Z
src/main/java/com/zyc/mrcweb/MrcwebApplication.java
ZYChimne/MRCWeb
3cda7a18a69d817d2c287308e407ceb4d690bc2e
[ "MIT" ]
null
null
null
src/main/java/com/zyc/mrcweb/MrcwebApplication.java
ZYChimne/MRCWeb
3cda7a18a69d817d2c287308e407ceb4d690bc2e
[ "MIT" ]
null
null
null
27
82
0.821759
6,360
package com.zyc.mrcweb; import com.google.gson.Gson; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import java.io.*; import java.util.concurrent.TimeUnit; @SpringBootApplication public class MrcwebApplication { public static void main(String[] args) throws IOException, InterruptedException { SpringApplication.run(MrcwebApplication.class, args); } }
3e0ef731051a7b9378b3abe7b41ad52ebc87151a
4,878
java
Java
src/AFFaceDetect/app/src/main/java/org/ericsk/affacedetect/MainActivity.java
ericsk/takephoto-and-detectit
91f49c7eb20503d077dac395d850f95f4ab4e0ba
[ "MIT" ]
null
null
null
src/AFFaceDetect/app/src/main/java/org/ericsk/affacedetect/MainActivity.java
ericsk/takephoto-and-detectit
91f49c7eb20503d077dac395d850f95f4ab4e0ba
[ "MIT" ]
null
null
null
src/AFFaceDetect/app/src/main/java/org/ericsk/affacedetect/MainActivity.java
ericsk/takephoto-and-detectit
91f49c7eb20503d077dac395d850f95f4ab4e0ba
[ "MIT" ]
null
null
null
36.676692
104
0.640016
6,361
package org.ericsk.affacedetect; import android.app.ProgressDialog; import android.content.Intent; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.support.v4.content.FileProvider; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import com.microsoft.azure.storage.CloudStorageAccount; import com.microsoft.azure.storage.blob.CloudBlobClient; import com.microsoft.azure.storage.blob.CloudBlobContainer; import com.microsoft.azure.storage.blob.CloudBlockBlob; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; // Include the following imports to use blob APIs. public class MainActivity extends AppCompatActivity implements OnClickListener { static final int REQUEST_IMAGE_CAPTURE = 1; // Define the connection-string with your values public static final String storageConnectionString = "PUT_YOUR_STORAGE_CONNECTION_STRING"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btn = (Button) findViewById(R.id.take_photo); btn.setOnClickListener(this); } File photoFile; public void onClick(View view) { Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) != null) { // Create the File where the photo should go photoFile = null; try { photoFile = createImageFile(); } catch (IOException ex) { // Error occurred while creating the File Log.e("MainActivity", ex.getMessage()); } // Continue only if the File was successfully created if (photoFile != null) { Uri photoURI = FileProvider.getUriForFile(this, "org.ericsk.affacedetect", photoFile); takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI); startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE); } } } ProgressDialog dialog; @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) { dialog = ProgressDialog.show(MainActivity.this, "上傳照片", "正在將照片上傳至 Azure Blob Storage...",true); new UploadFilesTask().execute(photoFile); } } String mCurrentPhotoPath; private File createImageFile() throws IOException { // Create an image file name String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String imageFileName = "JPEG_" + timeStamp + "_"; File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES); File image = File.createTempFile( imageFileName, /* prefix */ ".jpg", /* suffix */ storageDir /* directory */ ); // Save a file: path for use with ACTION_VIEW intents mCurrentPhotoPath = image.getAbsolutePath(); return image; } private class UploadFilesTask extends AsyncTask<File, Integer, Void> { protected Void doInBackground(File... photoFiles) { try { // Retrieve storage account from connection-string. CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString); // Create the blob client. CloudBlobClient blobClient = storageAccount.createCloudBlobClient(); // Get a reference to a container. // The container name must be lower case CloudBlobContainer container = blobClient.getContainerReference("input"); // Create the container if it does not exist. container.createIfNotExists(); for (int i = 0; i < photoFiles.length; ++i) { File photoFile = photoFiles[i]; CloudBlockBlob blob = container.getBlockBlobReference(photoFile.getName()); blob.upload(new java.io.FileInputStream(photoFiles[0]), photoFile.length()); } } catch (Exception e) { // Output the stack trace. e.printStackTrace(); } dialog.dismiss(); return null; } protected void onPostExecute() { Log.i("MainActivity", "Completed upload."); } } }
3e0ef91eb0bdb43cc9779930c4433c8f47945578
51,637
java
Java
src/test/java/prototype/infrastructure/DataHistoryTests.java
bugsbunnyshah/braineous_dataplatform
cf20bf929773fee3b005c32a0a1f3115776501ee
[ "Apache-2.0" ]
null
null
null
src/test/java/prototype/infrastructure/DataHistoryTests.java
bugsbunnyshah/braineous_dataplatform
cf20bf929773fee3b005c32a0a1f3115776501ee
[ "Apache-2.0" ]
null
null
null
src/test/java/prototype/infrastructure/DataHistoryTests.java
bugsbunnyshah/braineous_dataplatform
cf20bf929773fee3b005c32a0a1f3115776501ee
[ "Apache-2.0" ]
null
null
null
42.429745
134
0.60842
6,362
package prototype.infrastructure; import com.appgallabs.dataplatform.util.JsonUtil; import com.github.wnameless.json.flattener.JsonFlattener; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import org.apache.commons.io.IOUtils; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import javax.xml.bind.DatatypeConverter; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.time.OffsetDateTime; import java.time.temporal.ChronoUnit; import java.util.*; public class DataHistoryTests { @Test public void createStateByTimelineUnique() throws Exception { Set<DataLakeObject> datalake = new HashSet<>(); List<JsonArray> dataHistory = new ArrayList<>(); //ingestion0 OffsetDateTime ingestion0Time = OffsetDateTime.now(); JsonArray ingestion0 = this.mockIngestion(ingestion0Time,2); this.performIngestion(datalake,dataHistory,ingestion0); //ingestion1 OffsetDateTime ingestion1Time = OffsetDateTime.now(); ingestion1Time = ingestion1Time.plus(5, ChronoUnit.MINUTES); JsonArray ingestion1 = this.mockIngestion(ingestion1Time,3); this.performIngestion(datalake,dataHistory,ingestion1); //ingestion2 OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(10, ChronoUnit.MINUTES); JsonArray ingestion2 = this.mockIngestion(ingestion2Time,2); this.performIngestion(datalake,dataHistory,ingestion2); //ingestion3 OffsetDateTime ingestion3Time = OffsetDateTime.now(); ingestion3Time = ingestion3Time.plus(15, ChronoUnit.MINUTES); JsonArray ingestion3 = this.mockIngestion(ingestion3Time,3); this.performIngestion(datalake,dataHistory,ingestion3); //JsonUtil.print(JsonParser.parseString(datalake.toString())); JsonUtil.print(JsonParser.parseString(dataHistory.toString())); //Create State Set<String> state = this.generateState(datalake,dataHistory,ingestion1Time,ingestion2Time); JsonUtil.print(JsonParser.parseString(state.toString())); assertEquals(7,state.size()); state = this.generateState(datalake,dataHistory,ingestion1Time,ingestion1Time); JsonUtil.print(JsonParser.parseString(state.toString())); assertEquals(5,state.size()); state = this.generateState(datalake,dataHistory,ingestion0Time,ingestion3Time); JsonUtil.print(JsonParser.parseString(state.toString())); assertEquals(10,state.size()); state = this.generateState(datalake,dataHistory,ingestion1Time,ingestion3Time); JsonUtil.print(JsonParser.parseString(state.toString())); assertEquals(10,state.size()); state = this.generateState(datalake,dataHistory,ingestion2Time,ingestion3Time); JsonUtil.print(JsonParser.parseString(state.toString())); assertEquals(10,state.size()); state = this.generateState(datalake,dataHistory,ingestion2Time,ingestion2Time); JsonUtil.print(JsonParser.parseString(state.toString())); assertEquals(7,state.size()); state = this.generateState(datalake,dataHistory,ingestion3Time,ingestion3Time); JsonUtil.print(JsonParser.parseString(state.toString())); assertEquals(10,state.size()); } @Test public void createStateByTimelineReal() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); oids.put(3,UUID.randomUUID().toString()); oids.put(4,UUID.randomUUID().toString()); Set<DataLakeObject> datalake = new HashSet<>(); List<JsonArray> dataHistory = new ArrayList<>(); //ingestion0 OffsetDateTime ingestion0Time = OffsetDateTime.now(); JsonArray ingestion0 = this.mockIngestion(oids, ingestion0Time,1); //1 this.performIngestion(datalake,dataHistory,ingestion0); //ingestion1 OffsetDateTime ingestion1Time = OffsetDateTime.now(); ingestion1Time = ingestion1Time.plus(5, ChronoUnit.MINUTES); JsonArray ingestion1 = this.mockIngestion(oids, ingestion1Time,3); //2 this.performIngestion(datalake,dataHistory,ingestion1); //ingestion2 OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(10, ChronoUnit.MINUTES); JsonArray ingestion2 = this.mockIngestion(oids, ingestion2Time,4); //1 this.performIngestion(datalake,dataHistory,ingestion2); //ingestion3 OffsetDateTime ingestion3Time = OffsetDateTime.now(); ingestion3Time = ingestion3Time.plus(15, ChronoUnit.MINUTES); JsonArray ingestion3 = this.mockIngestion(oids, ingestion3Time,5); //1 this.performIngestion(datalake,dataHistory,ingestion3); JsonUtil.print(JsonParser.parseString(datalake.toString())); JsonUtil.print(JsonParser.parseString(dataHistory.toString())); //Create State Set<String> state = this.generateState(datalake,dataHistory,ingestion1Time,ingestion2Time); JsonUtil.print(JsonParser.parseString(state.toString())); assertEquals(4,state.size()); state = this.generateState(datalake,dataHistory,ingestion1Time,ingestion1Time); JsonUtil.print(JsonParser.parseString(state.toString())); assertEquals(3,state.size()); state = this.generateState(datalake,dataHistory,ingestion0Time,ingestion3Time); JsonUtil.print(JsonParser.parseString(state.toString())); assertEquals(5,state.size()); state = this.generateState(datalake,dataHistory,ingestion1Time,ingestion3Time); JsonUtil.print(JsonParser.parseString(state.toString())); assertEquals(5,state.size()); state = this.generateState(datalake,dataHistory,ingestion2Time,ingestion3Time); JsonUtil.print(JsonParser.parseString(state.toString())); assertEquals(5,state.size()); state = this.generateState(datalake,dataHistory,ingestion2Time,ingestion2Time); JsonUtil.print(JsonParser.parseString(state.toString())); assertEquals(4,state.size()); state = this.generateState(datalake,dataHistory,ingestion3Time,ingestion3Time); JsonUtil.print(JsonParser.parseString(state.toString())); assertEquals(5,state.size()); } //------------------ @Test public void detectUpdatesAll() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion2); System.out.println(this.detectUpdates(ingestion1,ingestion2)); } @Test public void detectUpdatesSubset() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); if(i == 0) { ingestion2.add(ingestion1.get(0)); } else { ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } } JsonUtil.print(ingestion2); System.out.println(this.detectUpdates(ingestion1,ingestion2)); } @Test public void detectUpdatesSubsetShuffle() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); if(i == 0) { ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("2", ingestion1.get(0).getAsJsonObject().get("2").getAsString()); data.addProperty("3",ingestion1.get(0).getAsJsonObject().get("3").getAsString()); data.addProperty("1", ingestion1.get(0).getAsJsonObject().get("1").getAsString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } else { ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } } JsonUtil.print(ingestion2); System.out.println(this.detectUpdates(ingestion1,ingestion2)); } @Test public void detectUpdatesMoreOnTop() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); oids.put(3,UUID.randomUUID().toString()); oids.put(4,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<5; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion2); System.out.println(this.detectUpdates(ingestion1,ingestion2)); } @Test public void detectUpdatesMoreOnTopSubset() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); oids.put(3,UUID.randomUUID().toString()); oids.put(4,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<5; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); if(i == 0) { ingestion2.add(ingestion1.get(0)); } else { ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } } JsonUtil.print(ingestion2); System.out.println(this.detectUpdates(ingestion1,ingestion2)); } @Test public void detectUpdatesMoreOnTopSubsetShuffle() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); oids.put(3,UUID.randomUUID().toString()); oids.put(4,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<5; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); if(i == 0) { ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("2", ingestion1.get(0).getAsJsonObject().get("2").getAsString()); data.addProperty("3",ingestion1.get(0).getAsJsonObject().get("3").getAsString()); data.addProperty("1", ingestion1.get(0).getAsJsonObject().get("1").getAsString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } else { ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } } JsonUtil.print(ingestion2); System.out.println(this.detectUpdates(ingestion1,ingestion2)); } @Test public void detectUpdatesMoreOnNext() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); oids.put(3,UUID.randomUUID().toString()); oids.put(4,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<5; i++){ JsonObject data = new JsonObject(); ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion2); System.out.println(this.detectUpdates(ingestion1,ingestion2)); } @Test public void detectUpdatesMoreOnNextSubset() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); oids.put(3,UUID.randomUUID().toString()); oids.put(4,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<5; i++){ JsonObject data = new JsonObject(); if(i == 0) { ingestion2.add(ingestion1.get(0)); } else { ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } } JsonUtil.print(ingestion2); System.out.println(this.detectUpdates(ingestion1,ingestion2)); } @Test public void detectUpdatesMoreOnNextSubsetShuffle() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); oids.put(3,UUID.randomUUID().toString()); oids.put(4,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<5; i++){ JsonObject data = new JsonObject(); if(i == 0) { ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("2", ingestion1.get(0).getAsJsonObject().get("2").getAsString()); data.addProperty("3",ingestion1.get(0).getAsJsonObject().get("3").getAsString()); data.addProperty("1", ingestion1.get(0).getAsJsonObject().get("1").getAsString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } else { ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } } JsonUtil.print(ingestion2); System.out.println(this.detectUpdates(ingestion1,ingestion2)); } @Test public void detectNewObjects() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion2); System.out.println(this.detectAdds(ingestion1,ingestion2)); } @Test public void detectNewObjectsMoreOnNext() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); oids.put(3,UUID.randomUUID().toString()); oids.put(4,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<5; i++){ JsonObject data = new JsonObject(); ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion2); System.out.println(this.detectAdds(ingestion1,ingestion2)); } @Test public void detectNewObjectsMoreOnTop() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); oids.put(3,UUID.randomUUID().toString()); oids.put(4,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<5; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion2); System.out.println(this.detectAdds(ingestion1,ingestion2)); } @Test public void detectDeletedObjects() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion2); System.out.println(this.detectDeletes(ingestion1,ingestion2)); } @Test public void detectDeletedObjectsMoreOnTop() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); oids.put(3,UUID.randomUUID().toString()); oids.put(4,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<5; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion2); System.out.println(this.detectDeletes(ingestion1,ingestion2)); } @Test public void detectDeletedObjectsMoreOnNext() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); oids.put(3,UUID.randomUUID().toString()); oids.put(4,UUID.randomUUID().toString()); JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<5; i++){ JsonObject data = new JsonObject(); ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion2); System.out.println(this.detectDeletes(ingestion1,ingestion2)); } @Test public void createStateByTimeline() throws Exception { Map<Integer,String> oids = new HashMap<>(); oids.put(0,UUID.randomUUID().toString()); oids.put(1,UUID.randomUUID().toString()); oids.put(2,UUID.randomUUID().toString()); oids.put(3,UUID.randomUUID().toString()); oids.put(4,UUID.randomUUID().toString()); //timeline0 JsonArray ingestion0 = new JsonArray(); OffsetDateTime ingestion1Time = OffsetDateTime.now(); for(int i=0; i<2; i++){ JsonObject data = new JsonObject(); ingestion0.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion1Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion0); //timeline1 JsonArray ingestion1 = new JsonArray(); OffsetDateTime ingestion2Time = OffsetDateTime.now(); ingestion2Time = ingestion2Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<3; i++){ JsonObject data = new JsonObject(); ingestion1.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion2Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion1); //timeline2 JsonArray ingestion2 = new JsonArray(); OffsetDateTime ingestion3Time = OffsetDateTime.now(); ingestion3Time = ingestion3Time.plus(5, ChronoUnit.MINUTES); for(int i=0; i<1; i++){ JsonObject data = new JsonObject(); ingestion2.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestion3Time.toEpochSecond()); data.addProperty("objectHash",objectHash); } JsonUtil.print(ingestion2); Set<String> state = this.calculateState(ingestion1,ingestion2); System.out.println("********************"); System.out.println(state); } private Set<String> generateState(Set<DataLakeObject> datalake,List<JsonArray> dataHistory, OffsetDateTime start, OffsetDateTime end){ Set<String> state = new LinkedHashSet<>(); long startEpoch = start.toEpochSecond(); JsonArray startSnapShot = new JsonArray(); for(DataLakeObject local:datalake){ JsonObject object = local.getJson(); String timestamp = object.get("timestamp").getAsString(); long stamp = Long.parseLong(timestamp); if(stamp < startEpoch){ startSnapShot.add(object); state.add(object.get("oid").getAsString()); } } //JsonUtil.print(startSnapShot); Set<String> extendedState = this.findIngestion(dataHistory,start,end); state.addAll(extendedState); return state; } private Set<String> findIngestion(List<JsonArray> dataHistory,OffsetDateTime start,OffsetDateTime end){ Set<String> ingestion = new LinkedHashSet<>(); long startTime = start.toEpochSecond(); long endTime = end.toEpochSecond(); for(JsonArray local:dataHistory){ JsonObject top = local.get(0).getAsJsonObject(); long timestamp = top.get("timestamp").getAsLong(); if(timestamp < startTime){ continue; } if(timestamp > endTime){ break; } Iterator<JsonElement> iterator = local.iterator(); while(iterator.hasNext()){ JsonObject jsonObject = iterator.next().getAsJsonObject(); ingestion.add(jsonObject.get("oid").getAsString()); } } return ingestion; } private void performIngestion(Set<DataLakeObject> datalake,List<JsonArray> dataHistory,JsonArray ingestion){ dataHistory.add(ingestion); Iterator<JsonElement> iterator = ingestion.iterator(); while(iterator.hasNext()){ DataLakeObject object = new DataLakeObject(iterator.next().getAsJsonObject()); datalake.add(object); } } private JsonArray mockIngestion(Map<Integer,String> oids, OffsetDateTime ingestionTime,int size) throws NoSuchAlgorithmException { JsonArray ingestion = new JsonArray(); for(int i=0; i<size; i++){ JsonObject data = new JsonObject(); ingestion.add(data); data.addProperty("oid",oids.get(i)); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestionTime.toEpochSecond()); data.addProperty("objectHash",objectHash); } return ingestion; } private JsonArray mockIngestion(OffsetDateTime ingestionTime,int size) throws NoSuchAlgorithmException { JsonArray ingestion = new JsonArray(); for(int i=0; i<size; i++){ JsonObject data = new JsonObject(); ingestion.add(data); data.addProperty("oid",UUID.randomUUID().toString()); data.addProperty("1", UUID.randomUUID().toString()); data.addProperty("2",UUID.randomUUID().toString()); data.addProperty("3", UUID.randomUUID().toString()); String objectHash = this.getJsonHash(data); data.addProperty("timestamp",ingestionTime.toEpochSecond()); data.addProperty("objectHash",objectHash); } return ingestion; } private Set<String> calculateState(JsonArray start, JsonArray next){ Set<String> state = new HashSet<>(); Set<String> adds = this.detectAdds(start,next); //List<String> deletes = this.detectDeletes(start,next); //start state Iterator<JsonElement> iterator = start.iterator(); while(iterator.hasNext()){ JsonObject jsonObject = iterator.next().getAsJsonObject(); state.add(jsonObject.get("oid").getAsString()); } //next state.addAll(adds); //state.removeAll(deletes); return state; } private Set<String> detectUpdates(JsonArray top, JsonArray next){ Set<String> results = new HashSet<>(); Map<String, Object> topMap = JsonFlattener.flattenAsMap(top.toString()); Map<String, Object> nextMap = JsonFlattener.flattenAsMap(next.toString()); int topArraySize = top.size(); int nextArraySize = next.size(); for(int i=0; i<topArraySize; i++){ String currentOid = topMap.get("["+i+"].oid").toString(); for(int j=0; j<nextArraySize; j++){ String nextOid = nextMap.get("["+j+"].oid").toString(); if(currentOid.equals(nextOid)){ String topObjectHash = topMap.get("["+i+"].objectHash").toString(); String nextObjectHash = nextMap.get("["+j+"].objectHash").toString(); if(!topObjectHash.equals(nextObjectHash)){ results.add(currentOid); } } } } return results; } private Set<String> detectAdds(JsonArray top, JsonArray next){ Set<String> results = new HashSet<>(); Map<String, Object> topMap = JsonFlattener.flattenAsMap(top.toString()); Map<String, Object> nextMap = JsonFlattener.flattenAsMap(next.toString()); int topArraySize = top.size(); int nextArraySize = next.size(); for(int i=0; i<nextArraySize; i++){ String currentOid = nextMap.get("["+i+"].oid").toString(); boolean objectFound = false; for(int j=0; j<topArraySize; j++){ String nextOid = topMap.get("["+j+"].oid").toString(); if(currentOid.equals(nextOid)){ objectFound = true; break; } } if(!objectFound) { results.add(currentOid); } } return results; } private Set<String> detectDeletes(JsonArray top, JsonArray next){ Set<String> results = new HashSet<>(); Map<String, Object> topMap = JsonFlattener.flattenAsMap(top.toString()); Map<String, Object> nextMap = JsonFlattener.flattenAsMap(next.toString()); int topArraySize = top.size(); int nextArraySize = next.size(); for(int i=0; i<topArraySize; i++){ String currentOid = topMap.get("["+i+"].oid").toString(); boolean objectFound = false; for(int j=0; j<nextArraySize; j++){ String nextOid = nextMap.get("["+j+"].oid").toString(); if(currentOid.equals(nextOid)){ objectFound = true; break; } } if(!objectFound) { results.add(currentOid); } } return results; } private String getJsonHash(JsonObject jsonObject) throws NoSuchAlgorithmException { Map<String, Object> jsonMap = JsonFlattener.flattenAsMap(jsonObject.toString()); Map<String,Object> sortedMap = new TreeMap<>(); Set<Map.Entry<String,Object>> entrySet = jsonMap.entrySet(); for(Map.Entry<String,Object> entry:entrySet){ sortedMap.put(entry.getKey(),entry.getValue()); } String jsonHashString = sortedMap.toString(); return this.hash(jsonHashString); } private String hash(String original) throws NoSuchAlgorithmException { MessageDigest md5 = MessageDigest.getInstance("md5"); md5.update(original.getBytes(StandardCharsets.UTF_8)); byte[] digest = md5.digest(); String myHash = DatatypeConverter .printHexBinary(digest).toUpperCase(); return myHash; } //----------------------------------------------------------------------------------------------- public void jsonHash() throws Exception{ JsonObject top = new JsonObject(); top.addProperty("1", "1"); top.addProperty("2","2"); top.addProperty("3", "3"); Map<String, Object> topMap = JsonFlattener.flattenAsMap(top.toString()); System.out.println(topMap); JsonObject next = new JsonObject(); next.addProperty("2", topMap.get("2").toString()); next.addProperty("3",topMap.get("3").toString()); next.addProperty("1", topMap.get("1").toString()); Map<String, Object> nextMap = JsonFlattener.flattenAsMap(next.toString()); System.out.println(nextMap); Map<String,Object> topSorted = new TreeMap<>(); Map<String,Object> nextSorted = new TreeMap<>(); Set<Map.Entry<String,Object>> entrySet = topMap.entrySet(); for(Map.Entry<String,Object> entry:entrySet){ topSorted.put(entry.getKey(),entry.getValue()); } entrySet = nextMap.entrySet(); for(Map.Entry<String,Object> entry:entrySet){ nextSorted.put(entry.getKey(),entry.getValue()); } System.out.println(topSorted); System.out.println(nextSorted); String topString = topSorted.toString(); String nextString = nextSorted.toString(); System.out.println(this.hash(topString)); System.out.println(this.hash(nextString)); } public void jsonHashReal() throws Exception{ String topJson = IOUtils.toString(Thread.currentThread().getContextClassLoader().getResourceAsStream("prototype/top.json"), StandardCharsets.UTF_8); String nextJson = IOUtils.toString(Thread.currentThread().getContextClassLoader().getResourceAsStream("prototype/next.json"), StandardCharsets.UTF_8); JsonObject top = JsonParser.parseString(topJson).getAsJsonObject(); Map<String, Object> topMap = JsonFlattener.flattenAsMap(top.toString()); System.out.println(topMap); JsonObject next = JsonParser.parseString(nextJson).getAsJsonObject(); Map<String, Object> nextMap = JsonFlattener.flattenAsMap(next.toString()); System.out.println(nextMap); Map<String,Object> topSorted = new TreeMap<>(); Map<String,Object> nextSorted = new TreeMap<>(); Set<Map.Entry<String,Object>> entrySet = topMap.entrySet(); for(Map.Entry<String,Object> entry:entrySet){ topSorted.put(entry.getKey(),entry.getValue()); } entrySet = nextMap.entrySet(); for(Map.Entry<String,Object> entry:entrySet){ nextSorted.put(entry.getKey(),entry.getValue()); } System.out.println(topSorted); System.out.println(nextSorted); String topString = topSorted.toString(); String nextString = nextSorted.toString(); System.out.println(this.hash(topSorted.toString())); System.out.println(this.hash(nextSorted.toString())); } }
3e0efa48a74d9d052a3e5dae48f46ca4fe72cad8
336
java
Java
Actuator/src/main/java/com/spring/microservice/health/Actuator/ActuatorApplication.java
soumyadip007/Actuator-Microservice-Health-Monitoring-using-Spring-Boot-Rest-API
ab6e62db7b83d81ff051a05835b634557c985628
[ "Apache-2.0" ]
1
2021-04-13T14:05:19.000Z
2021-04-13T14:05:19.000Z
Actuator/src/main/java/com/spring/microservice/health/Actuator/ActuatorApplication.java
soumyadip007/Actuator-Microservice-Health-Monitoring-using-Spring-Boot-Rest-API
ab6e62db7b83d81ff051a05835b634557c985628
[ "Apache-2.0" ]
null
null
null
Actuator/src/main/java/com/spring/microservice/health/Actuator/ActuatorApplication.java
soumyadip007/Actuator-Microservice-Health-Monitoring-using-Spring-Boot-Rest-API
ab6e62db7b83d81ff051a05835b634557c985628
[ "Apache-2.0" ]
null
null
null
24
68
0.827381
6,363
package com.spring.microservice.health.Actuator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ActuatorApplication { public static void main(String[] args) { SpringApplication.run(ActuatorApplication.class, args); } }
3e0efabae2b8243f3c819e09c03df30e4ac42a78
313
java
Java
net/loveruby/cflat/ast/StmtNode.java
sonota88/cbc
f339ad28bc826ddcaabfdafa3a84bc539a80f4d1
[ "Unlicense" ]
371
2015-03-20T23:54:37.000Z
2022-03-31T12:19:31.000Z
net/loveruby/cflat/ast/StmtNode.java
sonota88/cbc
f339ad28bc826ddcaabfdafa3a84bc539a80f4d1
[ "Unlicense" ]
4
2016-01-13T16:48:26.000Z
2018-11-16T13:11:30.000Z
net/loveruby/cflat/ast/StmtNode.java
sonota88/cbc
f339ad28bc826ddcaabfdafa3a84bc539a80f4d1
[ "Unlicense" ]
106
2015-03-21T02:41:25.000Z
2022-03-06T02:56:57.000Z
19.5625
60
0.661342
6,364
package net.loveruby.cflat.ast; abstract public class StmtNode extends Node { protected Location location; public StmtNode(Location loc) { this.location = loc; } public Location location() { return location; } abstract public <S,E> S accept(ASTVisitor<S,E> visitor); }
3e0efac300419cb4a4f46248c2624c1009dc849f
1,614
java
Java
konker.registry.services.core/src/main/java/com/konkerlabs/platform/registry/business/services/api/EventRouteService.java
sonecabr/konker-platform
12f6307cb5125ab58788972957e1e6fee29ff0c4
[ "Apache-2.0" ]
34
2017-02-06T12:31:29.000Z
2021-11-03T18:39:50.000Z
konker.registry.services.core/src/main/java/com/konkerlabs/platform/registry/business/services/api/EventRouteService.java
sonecabr/konker-platform
12f6307cb5125ab58788972957e1e6fee29ff0c4
[ "Apache-2.0" ]
15
2017-02-07T12:10:00.000Z
2021-11-10T13:28:45.000Z
konker.registry.services.core/src/main/java/com/konkerlabs/platform/registry/business/services/api/EventRouteService.java
sonecabr/konker-platform
12f6307cb5125ab58788972957e1e6fee29ff0c4
[ "Apache-2.0" ]
11
2017-02-16T08:50:03.000Z
2021-06-22T23:57:45.000Z
41.384615
116
0.738538
6,365
package com.konkerlabs.platform.registry.business.services.api; import java.net.URI; import java.util.List; import com.konkerlabs.platform.registry.business.model.Application; import com.konkerlabs.platform.registry.business.model.EventRoute; import com.konkerlabs.platform.registry.business.model.Tenant; public interface EventRouteService { enum Validations { NAME_IN_USE("service.event_route.name.in_use"), GUID_NULL("service.event_route.guid.not_null"), EVENT_ROUTE_NOT_FOUND("service.event_route.not_found"), EVENT_ROUTE_URI_NULL("service.event_route.uri.not_null"), CROSS_APPLICATION("service.event_route.cross_application"), INCOMING_CHANNEL_INVALID("service.event_route.incoming_channel_invalid"), OUTGOING_CHANNEL_INVALID("service.event_route.outgoing_channel_invalid"); private String code; public String getCode() { return code; } Validations(String code) { this.code = code; } } ServiceResponse<EventRoute> save(Tenant tenant, Application application, EventRoute route); ServiceResponse<EventRoute> update(Tenant tenant, Application application, String guid, EventRoute eventRoute); ServiceResponse<List<EventRoute>> getAll(Tenant tenant, Application application); ServiceResponse<EventRoute> getByGUID(Tenant tenant, Application application, String guid); ServiceResponse<List<EventRoute>> findByIncomingUri(URI uri); ServiceResponse<EventRoute> remove(Tenant tenant, Application application, String guid); }
3e0efb0606ccdf83161050c153bddf975d02e1df
3,086
java
Java
sdk/graph-services/src/main/java/com/microsoft/services/graph/fetchers/DirectoryObjectFetcher.java
isabella232/Microsoft-Graph-SDK-Android
5e1a8da53fe3670385ce9cd32cc44e63538f97e2
[ "MIT" ]
6
2015-11-18T15:35:58.000Z
2022-01-07T01:24:31.000Z
sdk/graph-services/src/main/java/com/microsoft/services/graph/fetchers/DirectoryObjectFetcher.java
OfficeDev/Microsoft-Graph-SDK-Android
5e1a8da53fe3670385ce9cd32cc44e63538f97e2
[ "MIT" ]
3
2015-11-19T18:38:46.000Z
2016-03-23T20:53:10.000Z
sdk/graph-services/src/main/java/com/microsoft/services/graph/fetchers/DirectoryObjectFetcher.java
isabella232/Microsoft-Graph-SDK-Android
5e1a8da53fe3670385ce9cd32cc44e63538f97e2
[ "MIT" ]
5
2015-11-18T15:53:13.000Z
2020-11-14T17:52:53.000Z
33.912088
147
0.647764
6,366
/******************************************************************************* **NOTE** This code was generated by a tool and will occasionally be overwritten. We welcome comments and issues regarding this code; they will be addressed in the generation tool. If you wish to submit pull requests, please do so for the templates in that tool. This code was generated by Vipr (https://github.com/microsoft/vipr) using the T4TemplateWriter (https://github.com/msopentech/vipr-t4templatewriter). Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License 2.0; see LICENSE in the source repository root for authoritative license information. ******************************************************************************/ package com.microsoft.services.graph.fetchers; import com.microsoft.services.graph.*; import com.google.common.util.concurrent.*; import com.microsoft.services.orc.core.*; import com.microsoft.services.orc.core.Readable; /** * The type DirectoryObject * @deprecated This SDK is deprecated. Please review the README for further information (https://github.com/OfficeDev/Microsoft-Graph-SDK-Android). */ @Deprecated public class DirectoryObjectFetcher extends OrcEntityFetcher<DirectoryObject,DirectoryObjectOperations> implements Readable<DirectoryObject> { /** * Instantiates a new DirectoryObjectFetcher. * * @param urlComponent the url component * @param parent the parent */ public DirectoryObjectFetcher(String urlComponent, OrcExecutable parent) { super(urlComponent, parent, DirectoryObject.class, DirectoryObjectOperations.class); } /** * Add parameter. * * @param name the name * @param value the value * @return the fetcher */ public DirectoryObjectFetcher addParameter(String name, Object value) { addCustomParameter(name, value); return this; } /** * Add header. * * @param name the name * @param value the value * @return the fetcher */ public DirectoryObjectFetcher addHeader(String name, String value) { addCustomHeader(name, value); return this; } public DeviceFetcher asDevice(){ return new DeviceFetcher(this.urlComponent, this.parent); } public DirectoryRoleFetcher asDirectoryRole(){ return new DirectoryRoleFetcher(this.urlComponent, this.parent); } public DirectoryRoleTemplateFetcher asDirectoryRoleTemplate(){ return new DirectoryRoleTemplateFetcher(this.urlComponent, this.parent); } public GroupFetcher asGroup(){ return new GroupFetcher(this.urlComponent, this.parent); } public OrganizationFetcher asOrganization(){ return new OrganizationFetcher(this.urlComponent, this.parent); } public UserFetcher asUser(){ return new UserFetcher(this.urlComponent, this.parent); } }
3e0efb0d3a1d0dbda70b673ab136770a7e5b4738
8,208
java
Java
core-http/src/main/java/io/datakernel/http/HttpUtils.java
PetroRavlinko/datakernel
02aad28d89f7a456a873ca0e2ef7807339512ddf
[ "Apache-2.0" ]
null
null
null
core-http/src/main/java/io/datakernel/http/HttpUtils.java
PetroRavlinko/datakernel
02aad28d89f7a456a873ca0e2ef7807339512ddf
[ "Apache-2.0" ]
null
null
null
core-http/src/main/java/io/datakernel/http/HttpUtils.java
PetroRavlinko/datakernel
02aad28d89f7a456a873ca0e2ef7807339512ddf
[ "Apache-2.0" ]
null
null
null
28.206186
121
0.64693
6,367
/* * Copyright (C) 2015-2018 SoftIndex LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.datakernel.http; import io.datakernel.common.parse.ParseException; import io.datakernel.common.parse.UnknownFormatException; import org.jetbrains.annotations.Nullable; import java.io.UnsupportedEncodingException; import java.net.InetAddress; import java.net.URLDecoder; import java.net.URLEncoder; import java.net.UnknownHostException; import java.util.Map; import static io.datakernel.bytebuf.ByteBufStrings.*; import static io.datakernel.http.HttpHeaders.HOST; /** * Util for working with {@link HttpRequest} */ public final class HttpUtils { public static final ParseException INVALID_Q_VALUE = new ParseException("Value of 'q' should start either from 0 or 1"); private static final int URI_DEFAULT_CAPACITY = 1 << 5; public static InetAddress inetAddress(String host) { try { return InetAddress.getByName(host); } catch (UnknownHostException e) { throw new IllegalArgumentException(e); } } // https://url.spec.whatwg.org/ public static boolean isInetAddress(String host) { int colons = 0; int dots = 0; byte[] bytes = encodeAscii(host); // expect ipv6 address if (bytes[0] == '[') { return bytes[bytes.length - 1] == ']' && checkIpv6(bytes, 1, bytes.length - 1); } // assume ipv4 could be as oct, bin, dec; ipv6 - hex for (byte b : bytes) { if (b == '.') { dots++; } else if (b == ':') { if (dots != 0) { return false; } colons++; } else if (Character.digit(b, 16) == -1) { return false; } } if (dots < 4) { if (colons > 0 && colons < 8) { return checkIpv6(bytes, 0, bytes.length); } return checkIpv4(bytes, 0, bytes.length); } return false; } /* * Checks only dot decimal format(192.168.0.208 for example) * more -> https://en.wikipedia.org/wiki/IPv4 */ private static boolean checkIpv4(byte[] bytes, int pos, int length) { int start = pos; for (int i = pos; i < length; i++) { // assume at least one more symbol is present after dot if (i == length - 1 && bytes[i] == '.') { return false; } if (bytes[i] == '.' || i == length - 1) { int v; if (i - start == 0 && i != length - 1) { return false; } try { v = trimAndDecodePositiveInt(bytes, start, i - start); } catch (ParseException e) { return false; } if (v < 0 || v > 255) return false; start = i + 1; } } return true; } /* * http://stackoverflow.com/questions/5963199/ipv6-validation * rfc4291 * * IPV6 addresses are represented as 8, 4 hex digit groups of numbers * 2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d * * leading zeros are not necessary, however at least one digit should be present * * the null group ':0000:0000:0000'(one or more) could be substituted with '::' once per address * * x:x:x:x:x:x:d.d.d.d - 6 ipv6 + 4 ipv4 * ::d.d.d.d * */ private static boolean checkIpv6(byte[] bytes, int pos, int length) { boolean shortHand = false; // denotes usage of :: int numCount = 0; int blocksCount = 0; int start = 0; while (pos < length) { if (bytes[pos] == ':') { start = pos; blocksCount++; numCount = 0; if (pos > 0 && bytes[pos - 1] == ':') { if (shortHand) return false; else { shortHand = true; } } } else if (bytes[pos] == '.') { return checkIpv4(bytes, start + 1, length - start + 1); } else { if (Character.digit(bytes[pos], 16) == -1) { return false; } numCount++; if (numCount > 4) { return false; } } pos++; } return blocksCount > 6 || shortHand; } public static int skipSpaces(byte[] bytes, int pos, int end) { while (pos < end && bytes[pos] == ' ') { pos++; } return pos; } public static int parseQ(byte[] bytes, int pos, int length) throws ParseException { if (bytes[pos] == '1') { return 100; } else if (bytes[pos] == '0') { if (length == 1) return 0; length = length > 4 ? 2 : length - 2; int q = trimAndDecodePositiveInt(bytes, pos + 2, length); if (length == 1) q *= 10; return q; } throw INVALID_Q_VALUE; } /** * Method which creates string with parameters and its value in format URL. Using encoding UTF-8 * * @param q map in which keys if name of parameters, value - value of parameters. * @return string with parameters and its value in format URL */ public static String renderQueryString(Map<String, String> q) { return renderQueryString(q, "UTF-8"); } /** * Method which creates string with parameters and its value in format URL * * @param q map in which keys if name of parameters, value - value of parameters. * @param enc encoding of this string * @return string with parameters and its value in format URL */ public static String renderQueryString(Map<String, String> q, String enc) { StringBuilder sb = new StringBuilder(); for (Map.Entry<String, String> e : q.entrySet()) { String name = urlEncode(e.getKey(), enc); sb.append(name); if (e.getValue() != null) { sb.append('='); sb.append(urlEncode(e.getValue(), enc)); } sb.append('&'); } if (sb.length() > 0) sb.setLength(sb.length() - 1); return sb.toString(); } /** * Translates a string into application/x-www-form-urlencoded format using a specific encoding scheme. * This method uses the supplied encoding scheme to obtain the bytes for unsafe characters * * @param string string for encoding * @param enc new encoding * @return the translated String. */ public static String urlEncode(String string, String enc) { try { return URLEncoder.encode(string, enc); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("Can't encode with supplied encoding: " + enc, e); } } public static String urlDecode(@Nullable String string, String enc) throws ParseException { if (string == null) { throw new ParseException(HttpUtils.class, "No string to decode"); } try { return URLDecoder.decode(string, enc); } catch (UnsupportedEncodingException e) { throw new UnknownFormatException(HttpUtils.class, "Can't encode with supplied encoding: " + enc, e); } } public static int trimAndDecodePositiveInt(byte[] array, int pos, int len) throws ParseException { int left = trimLeft(array, pos, len); pos += left; len -= left; len -= trimRight(array, pos, len); return decodePositiveInt(array, pos, len); } private static int trimLeft(byte[] array, int pos, int len) { for (int i = 0; i < len; i++) { if (array[pos + i] != SP && array[pos + i] != HT) { return i; } } return 0; } private static int trimRight(byte[] array, int pos, int len) { for (int i = len - 1; i >= 0; i--) { if (array[pos + i] != SP && array[pos + i] != HT) { return len - i - 1; } } return 0; } /** * (RFC3986) scheme://authority/path/?query#fragment */ @Nullable public static String getFullUri(HttpRequest request, int builderCapacity) { String host = request.getHeader(HOST); if (host == null) { return null; } String query = request.getQuery(); String fragment = request.getFragment(); StringBuilder fullUriBuilder = new StringBuilder(builderCapacity) .append(request.isHttps() ? "https://" : "http://") .append(host) .append(request.getPath()); if (!query.isEmpty()) { fullUriBuilder.append("?").append(query); } if (!fragment.isEmpty()) { fullUriBuilder.append("#").append(fragment); } return fullUriBuilder.toString(); } @Nullable public static String getFullUri(HttpRequest request) { return getFullUri(request, URI_DEFAULT_CAPACITY); } }
3e0efbbf80feff0c59fc6fb831d98aaeebfe5cf1
418
java
Java
AlgoGraph/src/PriorityObject.java
irmikrys/Shortest-Path-Algorithms
cc26a2eb9d2e00cba6e20826a457b27de69afb46
[ "MIT" ]
null
null
null
AlgoGraph/src/PriorityObject.java
irmikrys/Shortest-Path-Algorithms
cc26a2eb9d2e00cba6e20826a457b27de69afb46
[ "MIT" ]
null
null
null
AlgoGraph/src/PriorityObject.java
irmikrys/Shortest-Path-Algorithms
cc26a2eb9d2e00cba6e20826a457b27de69afb46
[ "MIT" ]
null
null
null
20.9
67
0.58134
6,368
public class PriorityObject implements Comparable<PriorityObject> { public double priority; public int node; public PriorityObject(int node, double priority) { this.node = node; this.priority = priority; } @Override public int compareTo(PriorityObject o) { if (priority > o.priority) { return +1; } else { return -1; } } }
3e0efbdd96066cbcd335ec9eedb2f3ab2f69562a
989
java
Java
src/main/java/frc/robot/commandGroups/TwoBallAuto.java
Oakbotics/2022-Skelly
c05a402305f614b0608bdd0648f765a157aca2ac
[ "BSD-3-Clause" ]
null
null
null
src/main/java/frc/robot/commandGroups/TwoBallAuto.java
Oakbotics/2022-Skelly
c05a402305f614b0608bdd0648f765a157aca2ac
[ "BSD-3-Clause" ]
3
2022-02-20T07:15:06.000Z
2022-03-04T15:01:28.000Z
src/main/java/frc/robot/commandGroups/TwoBallAuto.java
Oakbotics/2022-Skelly
c05a402305f614b0608bdd0648f765a157aca2ac
[ "BSD-3-Clause" ]
null
null
null
29.969697
85
0.707786
6,369
package frc.robot.commandGroups; import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; import frc.robot.commands.TimedDrive; import frc.robot.commands.TimedRunConveyorOut; import frc.robot.commands.TimedRunIntakeAndConveyor; import frc.robot.commands.TimedShoot; import frc.robot.subsystems.DriveTrain; import frc.robot.subsystems.Intake; import frc.robot.subsystems.Shooter; public class TwoBallAuto extends SequentialCommandGroup{ public TwoBallAuto(DriveTrain m_driveTrain, Shooter m_shooter, Intake m_intake) { addCommands( new TimedShoot(m_shooter, 3), new TimedRunConveyorOut(m_shooter, -0.9), new TimedDriveWithIntake(m_driveTrain, m_shooter, m_intake, -0.5), new TimedRunIntakeAndConveyor(m_intake, 0.6, m_shooter, 0.9, 1.5), new TimedDrive(m_driveTrain, 0.5, 2), new TimedShoot(m_shooter, 2), new TimedDrive(m_driveTrain, 0.5, 2) ); } }
3e0efbe0279085185cecf40acc71edd5b88e87dc
368
java
Java
src/main/java/org/joo/virgo/model/TemporaryExecutionResult.java
dungba88/virgo
5ade6e67a99e386235de7a381efed513242913bd
[ "MIT" ]
2
2019-11-27T06:00:07.000Z
2021-02-04T15:41:45.000Z
src/main/java/org/joo/virgo/model/TemporaryExecutionResult.java
dungba88/virgo
5ade6e67a99e386235de7a381efed513242913bd
[ "MIT" ]
null
null
null
src/main/java/org/joo/virgo/model/TemporaryExecutionResult.java
dungba88/virgo
5ade6e67a99e386235de7a381efed513242913bd
[ "MIT" ]
null
null
null
21.647059
69
0.733696
6,370
package org.joo.virgo.model; import java.util.HashMap; import java.util.Map; public class TemporaryExecutionResult implements ExecutionResult { private static final long serialVersionUID = -5838012323794261778L; private Map<String, Object> results = new HashMap<>(); @Override public Map<String, Object> getResults() { return results; } }
3e0efdeb0126ed78feeffaa1388cbc0a7b100843
444
java
Java
02. Algorithms/10. Stack & Queue/09. Crawler Log Folder #1598/Solution_stack.java
amanx123/DSA-EndGame
398e1ae6a1d939a2639f865b3f741d5011af08c3
[ "MIT" ]
115
2021-08-03T13:55:13.000Z
2022-03-18T18:37:49.000Z
02. Algorithms/10. Stack & Queue/09. Crawler Log Folder #1598/Solution_stack.java
amanx123/DSA-EndGame
398e1ae6a1d939a2639f865b3f741d5011af08c3
[ "MIT" ]
null
null
null
02. Algorithms/10. Stack & Queue/09. Crawler Log Folder #1598/Solution_stack.java
amanx123/DSA-EndGame
398e1ae6a1d939a2639f865b3f741d5011af08c3
[ "MIT" ]
55
2021-08-23T14:07:50.000Z
2022-03-12T13:40:08.000Z
24.666667
49
0.398649
6,371
class Solution { public int minOperations(String[] logs) { Stack<Integer> st=new Stack(); for(String log:logs){ if(log.equals("../") && st.isEmpty()) continue; else if(log.equals("../") ) st.pop(); else if(log.equals("./")) continue; else st.push(1); } return st.size(); } }
3e0efe61dc6d6dbbc0af41f4fe6812e0e1530454
2,552
java
Java
storage/src/main/java/com/linkedpipes/etl/storage/unpacker/model/executor/ExecutorPort.java
opendata-mvcr/etl
24f0fbaa3187a3f383b76d53a890b00c3db0c636
[ "MIT" ]
117
2016-02-24T21:40:46.000Z
2022-03-31T09:57:14.000Z
storage/src/main/java/com/linkedpipes/etl/storage/unpacker/model/executor/ExecutorPort.java
opendata-mvcr/etl
24f0fbaa3187a3f383b76d53a890b00c3db0c636
[ "MIT" ]
874
2016-01-18T12:47:05.000Z
2022-03-09T08:43:10.000Z
storage/src/main/java/com/linkedpipes/etl/storage/unpacker/model/executor/ExecutorPort.java
opendata-mvcr/etl
24f0fbaa3187a3f383b76d53a890b00c3db0c636
[ "MIT" ]
35
2016-05-11T13:15:27.000Z
2022-03-30T07:25:28.000Z
25.52
70
0.652038
6,372
package com.linkedpipes.etl.storage.unpacker.model.executor; import com.linkedpipes.etl.executor.api.v1.vocabulary.LP_EXEC; import com.linkedpipes.etl.executor.api.v1.vocabulary.LP_PIPELINE; import com.linkedpipes.etl.rdf.utils.model.BackendTripleWriter; import com.linkedpipes.etl.rdf.utils.vocabulary.RDF; import com.linkedpipes.etl.rdf.utils.vocabulary.XSD; import java.util.LinkedList; import java.util.List; public class ExecutorPort { private String iri; private List<String> types = new LinkedList<>(); private String binding; private List<String> requirements = new LinkedList<>(); private ExecutorDataSource dataSource = null; private boolean saveDebugData = false; private Integer group = null; public ExecutorPort() { } public void setIri(String iri) { this.iri = iri; } public void write(BackendTripleWriter writer) { for (String type : types) { writer.iri(iri, RDF.TYPE, type); } writer.string(iri, LP_PIPELINE.HAS_BINDING, binding, null); for (String requirement : requirements) { writer.iri(iri, LP_PIPELINE.HAS_REQUIREMENT, requirement); } writer.bool(iri, LP_EXEC.HAS_SAVE_DEBUG_DATA, saveDebugData); if (isMapped()) { writeDataSource(writer); } if (group != null) { writer.typed(iri, LP_EXEC.HAS_DATA_UNIT_GROUP, group.toString(), XSD.INTEGER); } } private boolean isMapped() { return dataSource != null; } public void writeDataSource(BackendTripleWriter writer) { String dataSourceIri = iri + "/dataSource"; writer.iri(iri, LP_EXEC.HAS_DATA_SOURCE, dataSourceIri); dataSource.write(dataSourceIri, writer); } public String getIri() { return iri; } public void setTypes(List<String> types) { this.types = types; } public String getBinding() { return binding; } public void setBinding(String binding) { this.binding = binding; } public void setRequirements(List<String> requirements) { this.requirements = requirements; } public void setSaveDebugData(boolean saveDebugData) { this.saveDebugData = saveDebugData; } public void setDataSource(ExecutorDataSource dataSource) { this.dataSource = dataSource; } public Integer getGroup() { return group; } public void setGroup(Integer group) { this.group = group; } }
3e0f00014e6c98689c98a5382542fd0c2f29c8ed
4,164
java
Java
TRTCSDK/Android/TRTCScenesDemo/app/src/main/java/com/tencent/liteav/demo/TRTCUserInfoFragment.java
aliyunvideo/Queen_SDK_Android
e46e32e16f8a6ecf3746a5c397a6a1f36189e93c
[ "Apache-2.0" ]
2
2021-07-06T03:32:25.000Z
2021-12-17T02:24:16.000Z
TRTCSDK/Android/TRTCScenesDemo/app/src/main/java/com/tencent/liteav/demo/TRTCUserInfoFragment.java
aliyunvideo/Queen_SDK_Android
e46e32e16f8a6ecf3746a5c397a6a1f36189e93c
[ "Apache-2.0" ]
null
null
null
TRTCSDK/Android/TRTCScenesDemo/app/src/main/java/com/tencent/liteav/demo/TRTCUserInfoFragment.java
aliyunvideo/Queen_SDK_Android
e46e32e16f8a6ecf3746a5c397a6a1f36189e93c
[ "Apache-2.0" ]
1
2022-03-31T09:07:26.000Z
2022-03-31T09:07:26.000Z
43.831579
142
0.646974
6,373
package com.tencent.liteav.demo; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.squareup.picasso.Picasso; import com.tencent.liteav.demo.common.widget.ShowTipDialogFragment; import com.tencent.liteav.login.ui.view.ModifyUserAvatarDialog; import com.tencent.liteav.demo.common.widget.ModifyUserNameDialog; import com.tencent.liteav.login.model.ProfileManager; import de.hdodenhof.circleimageview.CircleImageView; public class TRTCUserInfoFragment extends Fragment { private CircleImageView mIvAvatar; private TextView mTvNickName; private TextView mTvUserId; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_my_info, container, false); mIvAvatar = (CircleImageView) rootView.findViewById(R.id.iv_avatar); mTvNickName = (TextView) rootView.findViewById(R.id.tv_show_name); mTvUserId = (TextView) rootView.findViewById(R.id.tv_userid); String userId = ProfileManager.getInstance().getUserModel().userId; String userName = ProfileManager.getInstance().getUserModel().userName; String userAvatar = ProfileManager.getInstance().getUserModel().userAvatar; Picasso.get().load(userAvatar).into(mIvAvatar); mTvNickName.setText(userName); mTvUserId.setText(userId); rootView.findViewById(R.id.edit_show_name).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ModifyUserNameDialog dialog = new ModifyUserNameDialog(getActivity(), new ModifyUserNameDialog.ModifySuccessListener() { @Override public void onSuccess() { String userName = ProfileManager.getInstance().getUserModel().userName; mTvNickName.setText(userName); } }); dialog.show(); } }); rootView.findViewById(R.id.iv_avatar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ModifyUserAvatarDialog dialog = new ModifyUserAvatarDialog(getActivity(), new ModifyUserAvatarDialog.ModifySuccessListener() { @Override public void onSuccess() { String userAvatar = ProfileManager.getInstance().getUserModel().userAvatar; Picasso.get().load(userAvatar).into(mIvAvatar); } }); dialog.show(); } }); rootView.findViewById(R.id.tv_about).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), AboutActivity.class); startActivity(intent); } }); rootView.findViewById(R.id.tv_privacy_statement).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("https://privacy.qq.com/yszc-m.htm")); startActivity(intent); } }); rootView.findViewById(R.id.tv_statement).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showStatementDialog(); } }); return rootView; } private void showStatementDialog() { final ShowTipDialogFragment dialog = new ShowTipDialogFragment(); dialog.setMessage(getString(R.string.app_statement_detail)); dialog.show(getActivity().getFragmentManager(), "confirm_fragment"); } }
3e0f00a7838281a7a154fae84e28966e2f81e65d
6,368
java
Java
adpharma/adpharma.modules/adpharma.client.backoffice/src/main/java/org/adorsys/adpharma/client/jpa/procurementorderitem/ProcurementOrderItemController.java
francis-pouatcha/forgelab
fdcbbded852a985f3bd437b639a2284d92703e33
[ "Apache-2.0" ]
null
null
null
adpharma/adpharma.modules/adpharma.client.backoffice/src/main/java/org/adorsys/adpharma/client/jpa/procurementorderitem/ProcurementOrderItemController.java
francis-pouatcha/forgelab
fdcbbded852a985f3bd437b639a2284d92703e33
[ "Apache-2.0" ]
null
null
null
adpharma/adpharma.modules/adpharma.client.backoffice/src/main/java/org/adorsys/adpharma/client/jpa/procurementorderitem/ProcurementOrderItemController.java
francis-pouatcha/forgelab
fdcbbded852a985f3bd437b639a2284d92703e33
[ "Apache-2.0" ]
null
null
null
32.161616
116
0.749529
6,374
package org.adorsys.adpharma.client.jpa.procurementorderitem; import java.util.List; import java.util.Map; import javax.enterprise.event.Event; import javax.enterprise.event.Observes; import javax.inject.Inject; import javax.inject.Singleton; import org.adorsys.javafx.crud.extensions.DomainComponentController; import org.adorsys.javafx.crud.extensions.EntityController; import org.adorsys.javafx.crud.extensions.ViewType; import org.adorsys.javafx.crud.extensions.events.CreateModelEvent; import org.adorsys.javafx.crud.extensions.events.EntityCreateRequestedEvent; import org.adorsys.javafx.crud.extensions.events.EntityEditCanceledEvent; import org.adorsys.javafx.crud.extensions.events.EntityEditDoneEvent; import org.adorsys.javafx.crud.extensions.events.EntityEditRequestedEvent; import org.adorsys.javafx.crud.extensions.events.EntitySearchDoneEvent; import org.adorsys.javafx.crud.extensions.events.EntitySearchRequestedEvent; import org.adorsys.javafx.crud.extensions.events.EntitySelectionEvent; import org.adorsys.javafx.crud.extensions.events.SearchModelEvent; import org.adorsys.javafx.crud.extensions.events.SelectedModelEvent; @Singleton public class ProcurementOrderItemController extends DomainComponentController { @Inject private ProcurementOrderItemSearchController searchController; @Inject private ProcurementOrderItemCreateController createController; @Inject private ProcurementOrderItemEditController editController; @Inject private ProcurementOrderItemListController listController; @Inject private ProcurementOrderItemDisplayController displayController; @Inject private ProcurementOrderItemIntialScreenController intialScreenController; @Inject @CreateModelEvent private Event<ProcurementOrderItem> createModelEvent; @Inject @SearchModelEvent private Event<ProcurementOrderItem> searchModelEvent; @Inject @SelectedModelEvent private Event<ProcurementOrderItem> selectedModelEvent; private ProcurementOrderItem createModel = new ProcurementOrderItem(); private ProcurementOrderItem searchModel = new ProcurementOrderItem(); private ProcurementOrderItem selectedModel = new ProcurementOrderItem(); @Inject private ProcurementOrderItemRegistration registration; @Override protected void initViews(Map<ViewType, EntityController> entityViews) { entityViews.put(searchController.getViewType(), searchController); entityViews.put(listController.getViewType(), listController); entityViews.put(displayController.getViewType(), displayController); entityViews.put(editController.getViewType(), editController); entityViews.put(createController.getViewType(), createController); createModelEvent.fire(createModel); searchModelEvent.fire(searchModel); selectedModelEvent.fire(selectedModel); } /** * Listen to search result and display. * @param entities */ public void handleSearchResult(@Observes @EntitySearchDoneEvent List<ProcurementOrderItem> entities) { if (!registration.canRead()) return; // if result is empty: display no result. if (!getDisplayedViews().contains(listController)) { getDisplayedViews().add(listController); } displayComponent(); } /** * Listens to list selection events and display */ public void handleSelectionEvent(@Observes @EntitySelectionEvent ProcurementOrderItem selectedEntity) { if (!registration.canRead()) return; // if result is empty: display no result. // else display list of procurementOrderItems. List<EntityController> displayedViews = getDisplayedViews(); displayedViews.clear(); displayedViews.add(listController); displayedViews.add(displayController); displayComponent(); } /** * Display the search and list panel * @param selectedEntity */ public void handleSearchRequestedEvent(@Observes @EntitySearchRequestedEvent ProcurementOrderItem selectedEntity) { if (!registration.canRead()) return; List<EntityController> displayedViews = getDisplayedViews(); displayedViews.clear(); displayedViews.add(searchController); displayedViews.add(listController); displayComponent(); } /** * Display search form. * @param selectedProcurementOrderItem */ public void handleCreateRequestedEvent(@Observes @EntityCreateRequestedEvent ProcurementOrderItem templateEntity) { if (!registration.canCreate()) return; List<EntityController> displayedViews = getDisplayedViews(); displayedViews.clear(); displayedViews.add(listController); displayedViews.add(createController); displayComponent(); } public void handleEditRequestedEvent(@Observes @EntityEditRequestedEvent ProcurementOrderItem selectedEntity) { if (!registration.canEdit()) return; List<EntityController> displayedViews = getDisplayedViews(); displayedViews.clear(); displayedViews.add(listController); displayedViews.add(editController); displayComponent(); } public void handleEditCanceledEvent(@Observes @EntityEditCanceledEvent ProcurementOrderItem selectedEntity) { List<EntityController> displayedViews = getDisplayedViews(); displayedViews.clear(); displayedViews.add(listController); displayedViews.add(displayController); displayComponent(); } public void handleEditDoneEvent(@Observes @EntityEditDoneEvent ProcurementOrderItem selectedEntity) { List<EntityController> displayedViews = getDisplayedViews(); displayedViews.clear(); displayedViews.add(listController); displayedViews.add(displayController); displayComponent(); } @Override protected void selectDisplay() { if (searchController != null) { intialScreenController.startWithSeach(); } else if (createController != null) { intialScreenController.startWithCreate(); } else { throw new IllegalStateException("Missing search and display component."); } } @Override public void reset() { displayController.reset(); editController.reset(); searchController.reset(); listController.reset(); } }
3e0f015fc7f0574f38586eb695bca378bf9d8b2c
4,843
java
Java
src/main/java/gyro/aws/apigatewayv2/IntegrationResponseFinder.java
perfectsense/gyro-aws-provider
d7bbb01e4c6c860241436a46e32dd325a18e62bd
[ "Apache-2.0" ]
9
2019-10-07T19:40:46.000Z
2021-08-09T17:58:41.000Z
src/main/java/gyro/aws/apigatewayv2/IntegrationResponseFinder.java
perfectsense/gyro-aws-provider
d7bbb01e4c6c860241436a46e32dd325a18e62bd
[ "Apache-2.0" ]
194
2019-10-09T20:07:25.000Z
2022-03-02T20:59:09.000Z
src/main/java/gyro/aws/apigatewayv2/IntegrationResponseFinder.java
perfectsense/gyro-aws-provider
d7bbb01e4c6c860241436a46e32dd325a18e62bd
[ "Apache-2.0" ]
1
2019-12-08T07:57:03.000Z
2019-12-08T07:57:03.000Z
32.503356
106
0.643403
6,375
/* * Copyright 2020, Brightspot. * * 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 gyro.aws.apigatewayv2; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import com.psddev.dari.util.ObjectUtils; import gyro.core.Type; import software.amazon.awssdk.services.apigatewayv2.ApiGatewayV2Client; import software.amazon.awssdk.services.apigatewayv2.model.GetIntegrationResponsesRequest; import software.amazon.awssdk.services.apigatewayv2.model.GetIntegrationResponsesResponse; import software.amazon.awssdk.services.apigatewayv2.model.Integration; import software.amazon.awssdk.services.apigatewayv2.model.IntegrationResponse; import software.amazon.awssdk.services.apigatewayv2.model.NotFoundException; /** * Query Integration Response. * * Example * ------- * * .. code-block:: gyro * * integration-response: $(external-query aws::api-gateway-integration-response {id: ""}) */ @Type("api-gateway-integration-response") public class IntegrationResponseFinder extends ApiGatewayFinder<ApiGatewayV2Client, IntegrationResponse, IntegrationResponseResource> { private String id; private String apiId; private String integrationId; /** * The ID of the integration response. */ public String getId() { return id; } public void setId(String id) { this.id = id; } /** * The ID of the api. */ public String getApiId() { return apiId; } public void setApiId(String apiId) { this.apiId = apiId; } /** * The ID of the integration */ public String getIntegrationId() { return integrationId; } public void setIntegrationId(String integrationId) { this.integrationId = integrationId; } @Override protected List<IntegrationResponse> findAllAws(ApiGatewayV2Client client) { List<IntegrationResponse> integrationResponses = new ArrayList<>(); String marker = null; GetIntegrationResponsesResponse response; for (String api : getApis(client)) { for (String integration : getIntegrations(client, api)) { do { if (marker == null) { response = client.getIntegrationResponses(GetIntegrationResponsesRequest.builder() .apiId(api).integrationId(integration).build()); } else { response = client.getIntegrationResponses(GetIntegrationResponsesRequest.builder() .nextToken(marker).apiId(api).integrationId(integration).build()); } marker = response.nextToken(); integrationResponses.addAll(response.items()); } while (!ObjectUtils.isBlank(marker)); } } return integrationResponses; } @Override protected List<IntegrationResponse> findAws(ApiGatewayV2Client client, Map<String, String> filters) { List<IntegrationResponse> integrationResponses = new ArrayList<>(); List<String> apis = filters.containsKey("api-id") ? Collections.singletonList(filters.get("api-id")) : getApis(client); apis.forEach(a -> { List<String> integrations = filters.containsKey("integration-id") ? Collections.singletonList(filters.get("integration-id")) : getIntegrations(client, a); try { integrations.forEach(i -> integrationResponses.addAll(client.getIntegrationResponses(r -> r.integrationId(i).apiId(a)).items())); } catch ( NotFoundException ignore) { //ignore } }); if (filters.containsKey("id")) { integrationResponses.removeIf(r -> !r.integrationResponseId() .equals(filters.get("id"))); } return integrationResponses; } private List<String> getIntegrations(ApiGatewayV2Client client, String apiId) { return client.getIntegrations(r -> r.apiId(apiId)) .items() .stream() .map(Integration::integrationId) .collect(Collectors.toList()); } }
3e0f01983dc7b39792e1c52f9ba3cb0d7984380e
181
java
Java
pof_23_design_pattern/iterator/src/com/yzhao/iterator/Iterator1.java
kenzhaoyihui/SSM-SpringMVC-Spring-MyBatis-
a957ff7e2ec2d17825959362e947d2278159e300
[ "MIT" ]
null
null
null
pof_23_design_pattern/iterator/src/com/yzhao/iterator/Iterator1.java
kenzhaoyihui/SSM-SpringMVC-Spring-MyBatis-
a957ff7e2ec2d17825959362e947d2278159e300
[ "MIT" ]
null
null
null
pof_23_design_pattern/iterator/src/com/yzhao/iterator/Iterator1.java
kenzhaoyihui/SSM-SpringMVC-Spring-MyBatis-
a957ff7e2ec2d17825959362e947d2278159e300
[ "MIT" ]
null
null
null
13.923077
35
0.624309
6,376
package com.yzhao.iterator; /** * 提供一种顺序访问聚合对象元素的方法,并且不暴露聚合对象的内部表示 * @param <Item> */ public interface Iterator1<Item> { Item next(); boolean hasNext(); }
3e0f01c629844e05cbf55924e0c4a6d2319caed3
1,314
java
Java
src/qr_itext/Qr_itext.java
ahmadkisswani/QR-code
2ee3d6d97f2495a7fafd8dd136c6d93f815694e7
[ "Apache-2.0" ]
null
null
null
src/qr_itext/Qr_itext.java
ahmadkisswani/QR-code
2ee3d6d97f2495a7fafd8dd136c6d93f815694e7
[ "Apache-2.0" ]
null
null
null
src/qr_itext/Qr_itext.java
ahmadkisswani/QR-code
2ee3d6d97f2495a7fafd8dd136c6d93f815694e7
[ "Apache-2.0" ]
null
null
null
29.863636
118
0.722222
6,377
/* * 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 qr_itext; import com.itextpdf.text.BadElementException; import com.itextpdf.text.Image; import com.itextpdf.text.pdf.BarcodeQRCode; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.nio.Buffer; import javax.imageio.ImageIO; import javax.imageio.ImageReader; /** * * @author User1 */ public class Qr_itext { /** * @param args the command line arguments */ public static void main(String[] args) throws BadElementException, IOException { BarcodeQRCode barcodeQRCode = new BarcodeQRCode("https://www.google.com", 1000, 1000, null); Image codeQrImage = barcodeQRCode.getImage(); codeQrImage.scaleAbsolute(100, 100); java.awt.Image image = barcodeQRCode.createAwtImage(Color.black, Color.white); BufferedImage buffImg = new BufferedImage(image.getWidth(null), image.getWidth(null), BufferedImage.TYPE_4BYTE_ABGR); buffImg.getGraphics().drawImage(image, 0, 0, null); buffImg.getGraphics().dispose(); ImageIO.write(buffImg, "png", new File("image\\image.png")); } }
3e0f028e1f41f4054aeccd525b5251f1b7f69fc4
12,032
java
Java
runners/flink/src/test/java/org/apache/beam/runners/flink/translation/wrappers/streaming/WindowDoFnOperatorTest.java
elink21/beam
ad6e7b753959ebbd7f6f0aa08e851cd682a35ef4
[ "PSF-2.0", "Apache-2.0", "BSD-3-Clause" ]
2
2021-12-29T09:01:21.000Z
2022-02-26T14:32:16.000Z
runners/flink/src/test/java/org/apache/beam/runners/flink/translation/wrappers/streaming/WindowDoFnOperatorTest.java
elink21/beam
ad6e7b753959ebbd7f6f0aa08e851cd682a35ef4
[ "PSF-2.0", "Apache-2.0", "BSD-3-Clause" ]
4
2021-12-21T21:15:41.000Z
2022-02-15T19:21:28.000Z
runners/flink/src/test/java/org/apache/beam/runners/flink/translation/wrappers/streaming/WindowDoFnOperatorTest.java
damccorm/beam
40f83407920d646ffe77dbfe5d6d59a28935c132
[ "PSF-2.0", "Apache-2.0", "BSD-3-Clause" ]
1
2018-01-25T23:26:58.000Z
2018-01-25T23:26:58.000Z
38.688103
131
0.705701
6,378
/* * 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.beam.runners.flink.translation.wrappers.streaming; import static java.util.Collections.emptyList; import static java.util.Collections.emptyMap; import static org.apache.beam.runners.flink.translation.wrappers.streaming.StreamRecordStripper.stripStreamRecordFromWindowedValue; import static org.apache.beam.sdk.transforms.windowing.PaneInfo.NO_FIRING; import static org.apache.beam.sdk.transforms.windowing.PaneInfo.Timing.ON_TIME; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.core.Is.is; import static org.joda.time.Duration.standardMinutes; import static org.junit.Assert.assertEquals; import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; import org.apache.beam.runners.core.KeyedWorkItem; import org.apache.beam.runners.core.SystemReduceFn; import org.apache.beam.runners.core.construction.SerializablePipelineOptions; import org.apache.beam.runners.flink.FlinkPipelineOptions; import org.apache.beam.runners.flink.translation.wrappers.streaming.DoFnOperator.MultiOutputOutputManagerFactory; import org.apache.beam.sdk.coders.Coder; import org.apache.beam.sdk.coders.CoderRegistry; import org.apache.beam.sdk.coders.KvCoder; import org.apache.beam.sdk.coders.VarLongCoder; import org.apache.beam.sdk.transforms.Sum; import org.apache.beam.sdk.transforms.windowing.BoundedWindow; import org.apache.beam.sdk.transforms.windowing.FixedWindows; import org.apache.beam.sdk.transforms.windowing.IntervalWindow; import org.apache.beam.sdk.transforms.windowing.PaneInfo; import org.apache.beam.sdk.util.AppliedCombineFn; import org.apache.beam.sdk.util.WindowedValue; import org.apache.beam.sdk.util.WindowedValue.FullWindowedValueCoder; import org.apache.beam.sdk.values.KV; import org.apache.beam.sdk.values.TupleTag; import org.apache.beam.sdk.values.WindowingStrategy; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Iterables; import org.apache.flink.api.java.functions.KeySelector; import org.apache.flink.api.java.typeutils.GenericTypeInfo; import org.apache.flink.runtime.checkpoint.OperatorSubtaskState; import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; import org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness; import org.joda.time.Duration; import org.joda.time.Instant; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** Tests for {@link WindowDoFnOperator}. */ @RunWith(JUnit4.class) @SuppressWarnings({ "rawtypes", // TODO(https://issues.apache.org/jira/browse/BEAM-10556) }) public class WindowDoFnOperatorTest { @Test public void testRestore() throws Exception { // test harness KeyedOneInputStreamOperatorTestHarness< ByteBuffer, WindowedValue<KeyedWorkItem<Long, Long>>, WindowedValue<KV<Long, Long>>> testHarness = createTestHarness(getWindowDoFnOperator()); testHarness.open(); // process elements IntervalWindow window = new IntervalWindow(new Instant(0), Duration.millis(10_000)); testHarness.processWatermark(0L); testHarness.processElement( Item.builder().key(1L).timestamp(1L).value(100L).window(window).build().toStreamRecord()); testHarness.processElement( Item.builder().key(1L).timestamp(2L).value(20L).window(window).build().toStreamRecord()); testHarness.processElement( Item.builder().key(2L).timestamp(3L).value(77L).window(window).build().toStreamRecord()); // create snapshot OperatorSubtaskState snapshot = testHarness.snapshot(0, 0); testHarness.close(); // restore from the snapshot testHarness = createTestHarness(getWindowDoFnOperator()); testHarness.initializeState(snapshot); testHarness.open(); // close window testHarness.processWatermark(10_000L); Iterable<WindowedValue<KV<Long, Long>>> output = stripStreamRecordFromWindowedValue(testHarness.getOutput()); assertEquals(2, Iterables.size(output)); assertThat( output, containsInAnyOrder( WindowedValue.of( KV.of(1L, 120L), new Instant(9_999), window, PaneInfo.createPane(true, true, ON_TIME)), WindowedValue.of( KV.of(2L, 77L), new Instant(9_999), window, PaneInfo.createPane(true, true, ON_TIME)))); // cleanup testHarness.close(); } @Test public void testTimerCleanupOfPendingTimerList() throws Exception { // test harness WindowDoFnOperator<Long, Long, Long> windowDoFnOperator = getWindowDoFnOperator(); KeyedOneInputStreamOperatorTestHarness< ByteBuffer, WindowedValue<KeyedWorkItem<Long, Long>>, WindowedValue<KV<Long, Long>>> testHarness = createTestHarness(windowDoFnOperator); testHarness.open(); DoFnOperator<KeyedWorkItem<Long, Long>, KV<Long, Long>>.FlinkTimerInternals timerInternals = windowDoFnOperator.timerInternals; // process elements IntervalWindow window = new IntervalWindow(new Instant(0), Duration.millis(100)); IntervalWindow window2 = new IntervalWindow(new Instant(100), Duration.millis(100)); testHarness.processWatermark(0L); // Use two different keys to check for correct watermark hold calculation testHarness.processElement( Item.builder().key(1L).timestamp(1L).value(100L).window(window).build().toStreamRecord()); testHarness.processElement( Item.builder() .key(2L) .timestamp(150L) .value(150L) .window(window2) .build() .toStreamRecord()); testHarness.processWatermark(1); // Note that the following is 1 because the state is key-partitioned assertThat(Iterables.size(timerInternals.pendingTimersById.keys()), is(1)); assertThat(testHarness.numKeyedStateEntries(), is(6)); // close bundle testHarness.setProcessingTime( testHarness.getProcessingTime() + 2 * FlinkPipelineOptions.defaults().getMaxBundleTimeMills()); assertThat(windowDoFnOperator.getCurrentOutputWatermark(), is(1L)); // close window testHarness.processWatermark(100L); // Note that the following is zero because we only the first key is active assertThat(Iterables.size(timerInternals.pendingTimersById.keys()), is(0)); assertThat(testHarness.numKeyedStateEntries(), is(3)); // close bundle testHarness.setProcessingTime( testHarness.getProcessingTime() + 2 * FlinkPipelineOptions.defaults().getMaxBundleTimeMills()); assertThat(windowDoFnOperator.getCurrentOutputWatermark(), is(100L)); testHarness.processWatermark(200L); // All the state has been cleaned up assertThat(testHarness.numKeyedStateEntries(), is(0)); assertThat( stripStreamRecordFromWindowedValue(testHarness.getOutput()), containsInAnyOrder( WindowedValue.of( KV.of(1L, 100L), new Instant(99), window, PaneInfo.createPane(true, true, ON_TIME)), WindowedValue.of( KV.of(2L, 150L), new Instant(199), window2, PaneInfo.createPane(true, true, ON_TIME)))); // cleanup testHarness.close(); } private WindowDoFnOperator<Long, Long, Long> getWindowDoFnOperator() { WindowingStrategy<Object, IntervalWindow> windowingStrategy = WindowingStrategy.of(FixedWindows.of(standardMinutes(1))); TupleTag<KV<Long, Long>> outputTag = new TupleTag<>("main-output"); SystemReduceFn<Long, Long, long[], Long, BoundedWindow> reduceFn = SystemReduceFn.combining( VarLongCoder.of(), AppliedCombineFn.withInputCoder( Sum.ofLongs(), CoderRegistry.createDefault(), KvCoder.of(VarLongCoder.of(), VarLongCoder.of()))); Coder<IntervalWindow> windowCoder = windowingStrategy.getWindowFn().windowCoder(); SingletonKeyedWorkItemCoder<Long, Long> workItemCoder = SingletonKeyedWorkItemCoder.of(VarLongCoder.of(), VarLongCoder.of(), windowCoder); FullWindowedValueCoder<KeyedWorkItem<Long, Long>> inputCoder = WindowedValue.getFullCoder(workItemCoder, windowCoder); FullWindowedValueCoder<KV<Long, Long>> outputCoder = WindowedValue.getFullCoder(KvCoder.of(VarLongCoder.of(), VarLongCoder.of()), windowCoder); return new WindowDoFnOperator<Long, Long, Long>( reduceFn, "stepName", (Coder) inputCoder, outputTag, emptyList(), new MultiOutputOutputManagerFactory<>( outputTag, outputCoder, new SerializablePipelineOptions(FlinkPipelineOptions.defaults())), windowingStrategy, emptyMap(), emptyList(), FlinkPipelineOptions.defaults(), VarLongCoder.of(), new WorkItemKeySelector( VarLongCoder.of(), new SerializablePipelineOptions(FlinkPipelineOptions.defaults()))); } private KeyedOneInputStreamOperatorTestHarness< ByteBuffer, WindowedValue<KeyedWorkItem<Long, Long>>, WindowedValue<KV<Long, Long>>> createTestHarness(WindowDoFnOperator<Long, Long, Long> windowDoFnOperator) throws Exception { return new KeyedOneInputStreamOperatorTestHarness<>( windowDoFnOperator, (KeySelector<WindowedValue<KeyedWorkItem<Long, Long>>, ByteBuffer>) o -> { try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { VarLongCoder.of().encode(o.getValue().key(), baos); return ByteBuffer.wrap(baos.toByteArray()); } }, new GenericTypeInfo<>(ByteBuffer.class)); } private static class Item { static ItemBuilder builder() { return new ItemBuilder(); } private long key; private long value; private long timestamp; private IntervalWindow window; StreamRecord<WindowedValue<KeyedWorkItem<Long, Long>>> toStreamRecord() { WindowedValue<Long> item = WindowedValue.of(value, new Instant(timestamp), window, NO_FIRING); WindowedValue<KeyedWorkItem<Long, Long>> keyedItem = WindowedValue.of( new SingletonKeyedWorkItem<>(key, item), new Instant(timestamp), window, NO_FIRING); return new StreamRecord<>(keyedItem); } private static final class ItemBuilder { private long key; private long value; private long timestamp; private IntervalWindow window; ItemBuilder key(long key) { this.key = key; return this; } ItemBuilder value(long value) { this.value = value; return this; } ItemBuilder timestamp(long timestamp) { this.timestamp = timestamp; return this; } ItemBuilder window(IntervalWindow window) { this.window = window; return this; } Item build() { Item item = new Item(); item.key = this.key; item.value = this.value; item.window = this.window; item.timestamp = this.timestamp; return item; } } } }
3e0f03fd7baa5272e2290f34699eb3034d407a55
1,360
java
Java
analysis/reverse-engineering/decompile-fitts-with-gradle-20191031-2200/src/main/java/kotlin/random/KotlinRandom.java
skkuse-adv/2019Fall_team2
3ea84c6be39855f54634a7f9b1093e80893886eb
[ "Apache-2.0" ]
4
2019-10-07T05:17:21.000Z
2020-11-02T08:29:13.000Z
analysis/reverse-engineering/decompile-fitts-20191031-2200/sources/kotlin/random/KotlinRandom.java
skkuse-adv/2019Fall_team2
3ea84c6be39855f54634a7f9b1093e80893886eb
[ "Apache-2.0" ]
38
2019-10-07T02:40:35.000Z
2019-12-12T09:15:24.000Z
analysis/reverse-engineering/decompile-fitts-20191031-2200/sources/kotlin/random/KotlinRandom.java
skkuse-adv/2019Fall_team2
3ea84c6be39855f54634a7f9b1093e80893886eb
[ "Apache-2.0" ]
5
2019-10-07T02:41:15.000Z
2020-10-30T01:36:08.000Z
23.050847
83
0.605882
6,379
package kotlin.random; import java.util.Random; import kotlin.jvm.internal.Intrinsics; import org.jetbrains.annotations.NotNull; final class KotlinRandom extends Random { @NotNull private final Random impl; public KotlinRandom(@NotNull Random random) { Intrinsics.checkParameterIsNotNull(random, "impl"); this.impl = random; } @NotNull public final Random getImpl() { return this.impl; } /* access modifiers changed from: protected */ public int next(int i) { return this.impl.nextBits(i); } public int nextInt() { return this.impl.nextInt(); } public int nextInt(int i) { return this.impl.nextInt(i); } public boolean nextBoolean() { return this.impl.nextBoolean(); } public long nextLong() { return this.impl.nextLong(); } public float nextFloat() { return this.impl.nextFloat(); } public double nextDouble() { return this.impl.nextDouble(); } public void nextBytes(@NotNull byte[] bArr) { Intrinsics.checkParameterIsNotNull(bArr, "bytes"); this.impl.nextBytes(bArr); } public void setSeed(long j) { throw new UnsupportedOperationException("Setting seed is not supported."); } }
3e0f0457716699081d3fb65077673dd77b11d2cd
1,600
java
Java
ms/ms-authority-service/src/main/java/com/training/web/controller/UserController.java
jiangyanyan/spring-cloud-training
bcde69f5c4d6c179e580cff23ce268c45b392df3
[ "Apache-2.0" ]
null
null
null
ms/ms-authority-service/src/main/java/com/training/web/controller/UserController.java
jiangyanyan/spring-cloud-training
bcde69f5c4d6c179e580cff23ce268c45b392df3
[ "Apache-2.0" ]
null
null
null
ms/ms-authority-service/src/main/java/com/training/web/controller/UserController.java
jiangyanyan/spring-cloud-training
bcde69f5c4d6c179e580cff23ce268c45b392df3
[ "Apache-2.0" ]
null
null
null
33.333333
102
0.774375
6,380
package com.training.web.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.discovery.DiscoveryClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.training.model.User; import com.training.service.UserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; @Api(value = "UserController", description = "用户相关API") @RestController @RequestMapping(value = "/api/user") public class UserController { @Autowired private DiscoveryClient discoveryClient; @Autowired private UserService userService; @ApiOperation(value = "获取用户信息", notes = "根据id获取用户信息") @ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "Long", paramType = "query") @RequestMapping(value = "/detail", method = RequestMethod.GET) public User findById(@RequestParam(value = "id", required = true) Long id) { User user = userService.selectById(id); return user; } /** * 本地服务实例的信息 * @return */ @GetMapping("/instance-info") public ServiceInstance showInfo() { ServiceInstance localServiceInstance = this.discoveryClient.getLocalServiceInstance(); return localServiceInstance; } }
3e0f04910dfea64c9556520a6c3ae13c252ffc93
20,888
java
Java
version3/java/OLDECP.java
CryptoMathician/amcl
e37bb15769a0da7f49bdde20a1ed247914c82b0e
[ "Apache-2.0" ]
72
2016-05-23T17:06:30.000Z
2021-12-17T16:34:32.000Z
version3/java/OLDECP.java
CryptoMathician/amcl
e37bb15769a0da7f49bdde20a1ed247914c82b0e
[ "Apache-2.0" ]
37
2016-11-30T14:53:10.000Z
2021-05-18T16:54:36.000Z
version3/java/OLDECP.java
CryptoMathician/amcl
e37bb15769a0da7f49bdde20a1ed247914c82b0e
[ "Apache-2.0" ]
28
2016-05-24T22:43:47.000Z
2021-11-10T17:52:36.000Z
19.988517
90
0.531932
6,381
/* 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. */ /* Elliptic Curve Point class */ package org.apache.milagro.amcl.XXX; public final class ECP { public static final int WEIERSTRASS=0; public static final int EDWARDS=1; public static final int MONTGOMERY=2; public static final int NOT=0; public static final int BN=1; public static final int BLS=2; public static final int D_TYPE=0; public static final int M_TYPE=1; public static final int POSITIVEX=0; public static final int NEGATIVEX=1; public static final int CURVETYPE=@CT@; public static final int CURVE_PAIRING_TYPE=@PF@; public static final int SEXTIC_TWIST=@ST@; public static final int SIGN_OF_X=@SX@; public static final int SHA256=32; public static final int SHA384=48; public static final int SHA512=64; public static final int HASH_TYPE=@HT@; public static final int AESKEY=@AK@; private FP x; private FP y; private FP z; private boolean INF; /* Constructor - set to O */ public ECP() { INF=true; x=new FP(); y=new FP(1); z=new FP(); } /* test for O point-at-infinity */ public boolean is_infinity() { if (INF) return true; // Edits made if (CURVETYPE==EDWARDS) { return (x.iszilch() && y.equals(z)); } if (CURVETYPE==WEIERSTRASS) { return (x.iszilch() && z.iszilch()); } if (CURVETYPE==MONTGOMERY) { return z.iszilch(); } return true; } /* Conditional swap of P and Q dependant on d */ private void cswap(ECP Q,int d) { x.cswap(Q.x,d); if (CURVETYPE!=MONTGOMERY) y.cswap(Q.y,d); z.cswap(Q.z,d); // if (CURVETYPE!=EDWARDS) // { boolean bd; if (d==0) bd=false; else bd=true; bd=bd&(INF^Q.INF); INF^=bd; Q.INF^=bd; // } } /* Conditional move of Q to P dependant on d */ private void cmove(ECP Q,int d) { x.cmove(Q.x,d); if (CURVETYPE!=MONTGOMERY) y.cmove(Q.y,d); z.cmove(Q.z,d); // if (CURVETYPE!=EDWARDS) // { boolean bd; if (d==0) bd=false; else bd=true; INF^=(INF^Q.INF)&bd; // } } /* return 1 if b==c, no branching */ private static int teq(int b,int c) { int x=b^c; x-=1; // if x=0, x now -1 return ((x>>31)&1); } /* Constant time select from pre-computed table */ private void select(ECP W[],int b) { ECP MP=new ECP(); int m=b>>31; int babs=(b^m)-m; babs=(babs-1)/2; cmove(W[0],teq(babs,0)); // conditional move cmove(W[1],teq(babs,1)); cmove(W[2],teq(babs,2)); cmove(W[3],teq(babs,3)); cmove(W[4],teq(babs,4)); cmove(W[5],teq(babs,5)); cmove(W[6],teq(babs,6)); cmove(W[7],teq(babs,7)); MP.copy(this); MP.neg(); cmove(MP,(int)(m&1)); } /* Test P == Q */ public boolean equals(ECP Q) { if (is_infinity() && Q.is_infinity()) return true; if (is_infinity() || Q.is_infinity()) return false; FP a=new FP(); // Edits made FP b=new FP(); a.copy(x); a.mul(Q.z); b.copy(Q.x); b.mul(z); if (!a.equals(b)) return false; if (CURVETYPE!=MONTGOMERY) { a.copy(y); a.mul(Q.z); b.copy(Q.y); b.mul(z); if (!a.equals(b)) return false; } return true; } /* this=P */ public void copy(ECP P) { x.copy(P.x); if (CURVETYPE!=MONTGOMERY) y.copy(P.y); z.copy(P.z); INF=P.INF; } /* this=-this */ public void neg() { // if (is_infinity()) return; if (CURVETYPE==WEIERSTRASS) { y.neg(); y.norm(); } if (CURVETYPE==EDWARDS) { x.neg(); x.norm(); } return; } /* set this=O */ public void inf() { INF=true; x.zero(); if (CURVETYPE!=MONTGOMERY) y.one(); if (CURVETYPE!=EDWARDS) z.zero(); else z.one(); } /* Calculate RHS of curve equation */ public static FP RHS(FP x) { x.norm(); FP r=new FP(x); r.sqr(); if (CURVETYPE==WEIERSTRASS) { // x^3+Ax+B FP b=new FP(new BIG(ROM.CURVE_B)); r.mul(x); if (ROM.CURVE_A==-3) { FP cx=new FP(x); cx.imul(3); cx.neg(); cx.norm(); r.add(cx); } r.add(b); } if (CURVETYPE==EDWARDS) { // (Ax^2-1)/(Bx^2-1) FP b=new FP(new BIG(ROM.CURVE_B)); FP one=new FP(1); b.mul(r); b.sub(one); b.norm(); if (ROM.CURVE_A==-1) r.neg(); r.sub(one); r.norm(); b.inverse(); r.mul(b); } if (CURVETYPE==MONTGOMERY) { // x^3+Ax^2+x FP x3=new FP(); x3.copy(r); x3.mul(x); r.imul(ROM.CURVE_A); r.add(x3); r.add(x); } r.reduce(); return r; } /* set (x,y) from two BIGs */ public ECP(BIG ix,BIG iy) { x=new FP(ix); y=new FP(iy); z=new FP(1); FP rhs=RHS(x); if (CURVETYPE==MONTGOMERY) { if (rhs.jacobi()==1) INF=false; else inf(); } else { FP y2=new FP(y); y2.sqr(); if (y2.equals(rhs)) INF=false; else inf(); } } /* set (x,y) from BIG and a bit */ public ECP(BIG ix,int s) { x=new FP(ix); FP rhs=RHS(x); y=new FP(); z=new FP(1); if (rhs.jacobi()==1) { FP ny=rhs.sqrt(); if (ny.redc().parity()!=s) ny.neg(); y.copy(ny); INF=false; } else inf(); } /* set from x - calculate y from curve equation */ public ECP(BIG ix) { x=new FP(ix); FP rhs=RHS(x); y=new FP(); z=new FP(1); if (rhs.jacobi()==1) { if (CURVETYPE!=MONTGOMERY) y.copy(rhs.sqrt()); INF=false; } else INF=true; } /* set to affine - from (x,y,z) to (x,y) */ public void affine() { if (is_infinity()) return; FP one=new FP(1); if (z.equals(one)) return; z.inverse(); x.mul(z); x.reduce(); if (CURVETYPE!=MONTGOMERY) // Edits made { y.mul(z); y.reduce(); } z.copy(one); } /* extract x as a BIG */ public BIG getX() { affine(); return x.redc(); } /* extract y as a BIG */ public BIG getY() { affine(); return y.redc(); } /* get sign of Y */ public int getS() { affine(); BIG y=getY(); return y.parity(); } /* extract x as an FP */ public FP getx() { return x; } /* extract y as an FP */ public FP gety() { return y; } /* extract z as an FP */ public FP getz() { return z; } /* convert to byte array */ public void toBytes(byte[] b) { byte[] t=new byte[BIG.MODBYTES]; if (CURVETYPE!=MONTGOMERY) b[0]=0x04; else b[0]=0x02; affine(); x.redc().toBytes(t); for (int i=0;i<BIG.MODBYTES;i++) b[i+1]=t[i]; if (CURVETYPE!=MONTGOMERY) { y.redc().toBytes(t); for (int i=0;i<BIG.MODBYTES;i++) b[i+BIG.MODBYTES+1]=t[i]; } } /* convert from byte array to point */ public static ECP fromBytes(byte[] b) { byte[] t=new byte[BIG.MODBYTES]; BIG p=new BIG(ROM.Modulus); for (int i=0;i<BIG.MODBYTES;i++) t[i]=b[i+1]; BIG px=BIG.fromBytes(t); if (BIG.comp(px,p)>=0) return new ECP(); if (b[0]==0x04) { for (int i=0;i<BIG.MODBYTES;i++) t[i]=b[i+BIG.MODBYTES+1]; BIG py=BIG.fromBytes(t); if (BIG.comp(py,p)>=0) return new ECP(); return new ECP(px,py); } else return new ECP(px); } /* convert to hex string */ public String toString() { if (is_infinity()) return "infinity"; affine(); if (CURVETYPE==MONTGOMERY) return "("+x.redc().toString()+")"; else return "("+x.redc().toString()+","+y.redc().toString()+")"; } /* convert to hex string */ public String toRawString() { //if (is_infinity()) return "infinity"; //affine(); if (CURVETYPE==MONTGOMERY) return "("+x.redc().toString()+","+z.redc().toString()+")"; else return "("+x.redc().toString()+","+y.redc().toString()+","+z.redc().toString()+")"; } /* this*=2 */ public void dbl() { if (INF) return; if (CURVETYPE==WEIERSTRASS) { if (ROM.CURVE_A==0) { //System.out.println("Into dbl"); FP t0=new FP(y); /*** Change ***/ // Edits made t0.sqr(); FP t1=new FP(y); t1.mul(z); FP t2=new FP(z); t2.sqr(); z.copy(t0); z.add(t0); z.norm(); z.add(z); z.add(z); z.norm(); t2.imul(3*ROM.CURVE_B_I); FP x3=new FP(t2); x3.mul(z); FP y3=new FP(t0); y3.add(t2); y3.norm(); z.mul(t1); t1.copy(t2); t1.add(t2); t2.add(t1); t0.sub(t2); t0.norm(); y3.mul(t0); y3.add(x3); t1.copy(x); t1.mul(y); x.copy(t0); x.norm(); x.mul(t1); x.add(x); x.norm(); y.copy(y3); y.norm(); //System.out.println("Out of dbl"); } else { FP t0=new FP(x); FP t1=new FP(y); FP t2=new FP(z); FP t3=new FP(x); FP z3=new FP(z); FP y3=new FP(); FP x3=new FP(); FP b=new FP(); if (ROM.CURVE_B_I==0) b.copy(new FP(new BIG(ROM.CURVE_B))); t0.sqr(); //1 x^2 t1.sqr(); //2 y^2 t2.sqr(); //3 t3.mul(y); //4 t3.add(t3); t3.norm();//5 z3.mul(x); //6 z3.add(z3); z3.norm();//7 y3.copy(t2); if (ROM.CURVE_B_I==0) y3.mul(b); //8 else y3.imul(ROM.CURVE_B_I); y3.sub(z3); //y3.norm(); //9 *** x3.copy(y3); x3.add(y3); x3.norm();//10 y3.add(x3); //y3.norm();//11 x3.copy(t1); x3.sub(y3); x3.norm();//12 y3.add(t1); y3.norm();//13 y3.mul(x3); //14 x3.mul(t3); //15 t3.copy(t2); t3.add(t2); //t3.norm(); //16 t2.add(t3); //t2.norm(); //17 if (ROM.CURVE_B_I==0) z3.mul(b); //18 else z3.imul(ROM.CURVE_B_I); z3.sub(t2); //z3.norm();//19 z3.sub(t0); z3.norm();//20 *** t3.copy(z3); t3.add(z3); //t3.norm();//21 z3.add(t3); z3.norm(); //22 t3.copy(t0); t3.add(t0); //t3.norm(); //23 t0.add(t3); //t0.norm();//24 t0.sub(t2); t0.norm();//25 t0.mul(z3);//26 y3.add(t0); //y3.norm();//27 t0.copy(y); t0.mul(z);//28 t0.add(t0); t0.norm(); //29 z3.mul(t0);//30 x3.sub(z3); //x3.norm();//31 t0.add(t0); t0.norm();//32 t1.add(t1); t1.norm();//33 z3.copy(t0); z3.mul(t1);//34 x.copy(x3); x.norm(); y.copy(y3); y.norm(); z.copy(z3); z.norm(); } } if (CURVETYPE==EDWARDS) { //System.out.println("Into dbl"); FP C=new FP(x); FP D=new FP(y); FP H=new FP(z); FP J=new FP(); x.mul(y); x.add(x); x.norm(); C.sqr(); D.sqr(); if (ROM.CURVE_A==-1) C.neg(); y.copy(C); y.add(D); y.norm(); H.sqr(); H.add(H); z.copy(y); J.copy(y); J.sub(H); J.norm(); x.mul(J); C.sub(D); C.norm(); y.mul(C); z.mul(J); //System.out.println("Out of dbl"); } if (CURVETYPE==MONTGOMERY) { FP A=new FP(x); FP B=new FP(x); FP AA=new FP(); FP BB=new FP(); FP C=new FP(); A.add(z); A.norm(); AA.copy(A); AA.sqr(); B.sub(z); B.norm(); BB.copy(B); BB.sqr(); C.copy(AA); C.sub(BB); C.norm(); x.copy(AA); x.mul(BB); A.copy(C); A.imul((ROM.CURVE_A+2)/4); BB.add(A); BB.norm(); z.copy(BB); z.mul(C); } return; } /* this+=Q */ public void add(ECP Q) { if (INF) { copy(Q); return; } if (Q.INF) return; if (CURVETYPE==WEIERSTRASS) { if (ROM.CURVE_A==0) { // Edits made //System.out.println("Into add"); int b=3*ROM.CURVE_B_I; FP t0=new FP(x); t0.mul(Q.x); FP t1=new FP(y); t1.mul(Q.y); FP t2=new FP(z); t2.mul(Q.z); FP t3=new FP(x); t3.add(y); t3.norm(); FP t4=new FP(Q.x); t4.add(Q.y); t4.norm(); t3.mul(t4); t4.copy(t0); t4.add(t1); t3.sub(t4); t3.norm(); t4.copy(y); t4.add(z); t4.norm(); FP x3=new FP(Q.y); x3.add(Q.z); x3.norm(); t4.mul(x3); x3.copy(t1); x3.add(t2); t4.sub(x3); t4.norm(); x3.copy(x); x3.add(z); x3.norm(); FP y3=new FP(Q.x); y3.add(Q.z); y3.norm(); x3.mul(y3); y3.copy(t0); y3.add(t2); y3.rsub(x3); y3.norm(); x3.copy(t0); x3.add(t0); t0.add(x3); t0.norm(); t2.imul(b); FP z3=new FP(t1); z3.add(t2); z3.norm(); t1.sub(t2); t1.norm(); y3.imul(b); x3.copy(y3); x3.mul(t4); t2.copy(t3); t2.mul(t1); x3.rsub(t2); y3.mul(t0); t1.mul(z3); y3.add(t1); t0.mul(t3); z3.mul(t4); z3.add(t0); x.copy(x3); x.norm(); y.copy(y3); y.norm(); z.copy(z3); z.norm(); //System.out.println("Out of add"); } else { FP t0=new FP(x); FP t1=new FP(y); FP t2=new FP(z); FP t3=new FP(x); FP t4=new FP(Q.x); FP z3=new FP(); FP y3=new FP(Q.x); FP x3=new FP(Q.y); FP b=new FP(); if (ROM.CURVE_B_I==0) b.copy(new FP(new BIG(ROM.CURVE_B))); t0.mul(Q.x); //1 t1.mul(Q.y); //2 t2.mul(Q.z); //3 t3.add(y); t3.norm(); //4 t4.add(Q.y); t4.norm();//5 t3.mul(t4);//6 t4.copy(t0); t4.add(t1); //t4.norm(); //7 t3.sub(t4); t3.norm(); //8 t4.copy(y); t4.add(z); t4.norm();//9 x3.add(Q.z); x3.norm();//10 t4.mul(x3); //11 x3.copy(t1); x3.add(t2); //x3.norm();//12 t4.sub(x3); t4.norm();//13 x3.copy(x); x3.add(z); x3.norm(); //14 y3.add(Q.z); y3.norm();//15 x3.mul(y3); //16 y3.copy(t0); y3.add(t2); //y3.norm();//17 y3.rsub(x3); y3.norm(); //18 z3.copy(t2); if (ROM.CURVE_B_I==0) z3.mul(b); //18 else z3.imul(ROM.CURVE_B_I); x3.copy(y3); x3.sub(z3); x3.norm(); //20 z3.copy(x3); z3.add(x3); //z3.norm(); //21 x3.add(z3); //x3.norm(); //22 z3.copy(t1); z3.sub(x3); z3.norm(); //23 x3.add(t1); x3.norm(); //24 if (ROM.CURVE_B_I==0) y3.mul(b); //18 else y3.imul(ROM.CURVE_B_I); t1.copy(t2); t1.add(t2); //t1.norm();//26 t2.add(t1); //t2.norm();//27 y3.sub(t2); //y3.norm(); //28 y3.sub(t0); y3.norm(); //29 t1.copy(y3); t1.add(y3); //t1.norm();//30 y3.add(t1); y3.norm(); //31 t1.copy(t0); t1.add(t0); //t1.norm(); //32 t0.add(t1); //t0.norm();//33 t0.sub(t2); t0.norm();//34 t1.copy(t4); t1.mul(y3);//35 t2.copy(t0); t2.mul(y3);//36 y3.copy(x3); y3.mul(z3);//37 y3.add(t2); //y3.norm();//38 x3.mul(t3);//39 x3.sub(t1);//40 z3.mul(t4);//41 t1.copy(t3); t1.mul(t0);//42 z3.add(t1); x.copy(x3); x.norm(); y.copy(y3); y.norm(); z.copy(z3); z.norm(); } } if (CURVETYPE==EDWARDS) { //System.out.println("Into add"); FP A=new FP(z); FP B=new FP(); FP C=new FP(x); FP D=new FP(y); FP E=new FP(); FP F=new FP(); FP G=new FP(); A.mul(Q.z); B.copy(A); B.sqr(); C.mul(Q.x); D.mul(Q.y); E.copy(C); E.mul(D); if (ROM.CURVE_B_I==0) { FP b=new FP(new BIG(ROM.CURVE_B)); E.mul(b); } else E.imul(ROM.CURVE_B_I); F.copy(B); F.sub(E); G.copy(B); G.add(E); if (ROM.CURVE_A==1) { E.copy(D); E.sub(C); } C.add(D); B.copy(x); B.add(y); D.copy(Q.x); D.add(Q.y); B.norm(); D.norm(); B.mul(D); B.sub(C); B.norm(); F.norm(); B.mul(F); x.copy(A); x.mul(B); G.norm(); if (ROM.CURVE_A==1) { E.norm(); C.copy(E); C.mul(G); } if (ROM.CURVE_A==-1) { C.norm(); C.mul(G); } y.copy(A); y.mul(C); z.copy(F); z.mul(G); //System.out.println("Out of add"); } return; } /* Differential Add for Montgomery curves. this+=Q where W is this-Q and is affine. */ public void dadd(ECP Q,ECP W) { FP A=new FP(x); FP B=new FP(x); FP C=new FP(Q.x); FP D=new FP(Q.x); FP DA=new FP(); FP CB=new FP(); A.add(z); B.sub(z); C.add(Q.z); D.sub(Q.z); A.norm(); D.norm(); DA.copy(D); DA.mul(A); C.norm(); B.norm(); CB.copy(C); CB.mul(B); A.copy(DA); A.add(CB); A.norm(); A.sqr(); B.copy(DA); B.sub(CB); B.norm(); B.sqr(); x.copy(A); z.copy(W.x); z.mul(B); } /* this-=Q */ public void sub(ECP Q) { Q.neg(); add(Q); Q.neg(); } /* constant time multiply by small integer of length bts - use ladder */ public ECP pinmul(int e,int bts) { if (CURVETYPE==MONTGOMERY) return this.mul(new BIG(e)); else { int nb,i,b; ECP P=new ECP(); ECP R0=new ECP(); ECP R1=new ECP(); R1.copy(this); for (i=bts-1;i>=0;i--) { b=(e>>i)&1; P.copy(R1); P.add(R0); R0.cswap(R1,b); R1.copy(P); R0.dbl(); R0.cswap(R1,b); } P.copy(R0); P.affine(); return P; } } /* return e.this */ public ECP mul(BIG e) { if (e.iszilch() || is_infinity()) return new ECP(); ECP P=new ECP(); if (CURVETYPE==MONTGOMERY) { /* use Ladder */ int nb,i,b; ECP D=new ECP(); ECP R0=new ECP(); R0.copy(this); ECP R1=new ECP(); R1.copy(this); R1.dbl(); D.copy(this); D.affine(); nb=e.nbits(); for (i=nb-2;i>=0;i--) { b=e.bit(i); P.copy(R1); P.dadd(R0,D); R0.cswap(R1,b); R1.copy(P); R0.dbl(); R0.cswap(R1,b); } P.copy(R0); } else { // fixed size windows int i,b,nb,m,s,ns; BIG mt=new BIG(); BIG t=new BIG(); ECP Q=new ECP(); ECP C=new ECP(); ECP[] W=new ECP[8]; byte[] w=new byte[1+(BIG.NLEN*BIG.BASEBITS+3)/4]; affine(); // precompute table Q.copy(this); Q.dbl(); W[0]=new ECP(); W[0].copy(this); for (i=1;i<8;i++) { W[i]=new ECP(); W[i].copy(W[i-1]); W[i].add(Q); } // make exponent odd - add 2P if even, P if odd t.copy(e); s=t.parity(); t.inc(1); t.norm(); ns=t.parity(); mt.copy(t); mt.inc(1); mt.norm(); t.cmove(mt,s); Q.cmove(this,ns); C.copy(Q); nb=1+(t.nbits()+3)/4; // convert exponent to signed 4-bit window for (i=0;i<nb;i++) { w[i]=(byte)(t.lastbits(5)-16); t.dec(w[i]); t.norm(); t.fshr(4); } w[nb]=(byte)t.lastbits(5); P.copy(W[(w[nb]-1)/2]); for (i=nb-1;i>=0;i--) { Q.select(W,w[i]); P.dbl(); P.dbl(); P.dbl(); P.dbl(); P.add(Q); } P.sub(C); /* apply correction */ } P.affine(); return P; } /* Return e.this+f.Q */ public ECP mul2(BIG e,ECP Q,BIG f) { BIG te=new BIG(); BIG tf=new BIG(); BIG mt=new BIG(); ECP S=new ECP(); ECP T=new ECP(); ECP C=new ECP(); ECP[] W=new ECP[8]; byte[] w=new byte[1+(BIG.NLEN*BIG.BASEBITS+1)/2]; int i,s,ns,nb; byte a,b; affine(); Q.affine(); te.copy(e); tf.copy(f); // precompute table W[1]=new ECP(); W[1].copy(this); W[1].sub(Q); W[2]=new ECP(); W[2].copy(this); W[2].add(Q); S.copy(Q); S.dbl(); W[0]=new ECP(); W[0].copy(W[1]); W[0].sub(S); W[3]=new ECP(); W[3].copy(W[2]); W[3].add(S); T.copy(this); T.dbl(); W[5]=new ECP(); W[5].copy(W[1]); W[5].add(T); W[6]=new ECP(); W[6].copy(W[2]); W[6].add(T); W[4]=new ECP(); W[4].copy(W[5]); W[4].sub(S); W[7]=new ECP(); W[7].copy(W[6]); W[7].add(S); // if multiplier is odd, add 2, else add 1 to multiplier, and add 2P or P to correction s=te.parity(); te.inc(1); te.norm(); ns=te.parity(); mt.copy(te); mt.inc(1); mt.norm(); te.cmove(mt,s); T.cmove(this,ns); C.copy(T); s=tf.parity(); tf.inc(1); tf.norm(); ns=tf.parity(); mt.copy(tf); mt.inc(1); mt.norm(); tf.cmove(mt,s); S.cmove(Q,ns); C.add(S); mt.copy(te); mt.add(tf); mt.norm(); nb=1+(mt.nbits()+1)/2; // convert exponent to signed 2-bit window for (i=0;i<nb;i++) { a=(byte)(te.lastbits(3)-4); te.dec(a); te.norm(); te.fshr(2); b=(byte)(tf.lastbits(3)-4); tf.dec(b); tf.norm(); tf.fshr(2); w[i]=(byte)(4*a+b); } w[nb]=(byte)(4*te.lastbits(3)+tf.lastbits(3)); S.copy(W[(w[nb]-1)/2]); for (i=nb-1;i>=0;i--) { T.select(W,w[i]); S.dbl(); S.dbl(); S.add(T); } S.sub(C); /* apply correction */ S.affine(); return S; } /* Hash byte string to curve point */ public static ECP mapit(byte[] h) { BIG q=new BIG(ROM.Modulus); BIG x=BIG.fromBytes(h); x.mod(q); ECP P; while (true) { P=new ECP(x,0); if (!P.is_infinity()) break; x.inc(1); x.norm(); } if (ECP.CURVE_PAIRING_TYPE!=ECP.BN) { BIG c=new BIG(ROM.CURVE_Cof); P=P.mul(c); } return P; } public static ECP generator() { ECP G; BIG gx,gy; gx=new BIG(ROM.CURVE_Gx); if (ECP.CURVETYPE!=ECP.MONTGOMERY) { gy=new BIG(ROM.CURVE_Gy); G=new ECP(gx,gy); } else G=new ECP(gx); return G; } /* public static void main(String[] args) { BIG Gx=new BIG(ROM.CURVE_Gx); BIG Gy; ECP P; if (CURVETYPE!=MONTGOMERY) Gy=new BIG(ROM.CURVE_Gy); BIG r=new BIG(ROM.CURVE_Order); //r.dec(7); System.out.println("Gx= "+Gx.toString()); if (CURVETYPE!=MONTGOMERY) System.out.println("Gy= "+Gy.toString()); if (CURVETYPE!=MONTGOMERY) P=new ECP(Gx,Gy); else P=new ECP(Gx); System.out.println("P= "+P.toString()); ECP R=P.mul(r); //for (int i=0;i<10000;i++) // R=P.mul(r); System.out.println("R= "+R.toString()); } */ }
3e0f0521b0fc4bfb806b42ee4dc614cb90d2c2b9
778
java
Java
gulimall-coupon/src/main/java/com/nai/gulimall/coupon/entity/SecKillPromotionEntity.java
xny838754132/gulimall
09bbc33e0aa8314a38c44506b00caaa9c9ef3d1d
[ "Apache-2.0" ]
1
2022-01-22T15:40:18.000Z
2022-01-22T15:40:18.000Z
gulimall-coupon/src/main/java/com/nai/gulimall/coupon/entity/SecKillPromotionEntity.java
xny838754132/gulimall
09bbc33e0aa8314a38c44506b00caaa9c9ef3d1d
[ "Apache-2.0" ]
null
null
null
gulimall-coupon/src/main/java/com/nai/gulimall/coupon/entity/SecKillPromotionEntity.java
xny838754132/gulimall
09bbc33e0aa8314a38c44506b00caaa9c9ef3d1d
[ "Apache-2.0" ]
null
null
null
14.660377
61
0.676963
6,382
package com.nai.gulimall.coupon.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * 秒杀活动 * * @author TheNai * @email ychag@example.com * @date 2021-02-06 22:30:01 */ @Data @TableName("sms_sec_kill_promotion") public class SecKillPromotionEntity implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @TableId private Long id; /** * 活动标题 */ private String title; /** * 开始日期 */ private Date startTime; /** * 结束日期 */ private Date endTime; /** * 上下线状态 */ private Integer status; /** * 创建时间 */ private Date createTime; /** * 创建人 */ private Long userId; }
3e0f05becffcf9c52dc23e6155613a4f11cff669
96
java
Java
runner/src/main/java/org/ananas/scheduler/Goal.java
Diffblue-benchmarks/Ananas-analytics-ananas-desktop
270fb4ee1c53129c09df964afa630f37509a78a8
[ "Apache-2.0" ]
593
2019-04-30T17:01:06.000Z
2022-03-15T15:15:10.000Z
runner/src/main/java/org/ananas/scheduler/Goal.java
Diffblue-benchmarks/Ananas-analytics-ananas-desktop
270fb4ee1c53129c09df964afa630f37509a78a8
[ "Apache-2.0" ]
86
2019-04-30T17:16:17.000Z
2022-02-26T10:33:04.000Z
runner/src/main/java/org/ananas/scheduler/Goal.java
Diffblue-benchmarks/Ananas-analytics-ananas-desktop
270fb4ee1c53129c09df964afa630f37509a78a8
[ "Apache-2.0" ]
45
2019-06-21T10:28:47.000Z
2021-05-12T13:17:59.000Z
13.714286
29
0.739583
6,383
package org.ananas.scheduler; public class Goal { public String id; public String jobId; }
3e0f05dfa348a6c19e9f4863891c409750f6981d
5,933
java
Java
core/precalcmatches/berkeley/src/test/java/uk/ac/ebi/interpro/scan/precalc/berkeley/TestDPLPersistence.java
santosh653/interproscan
0ec69087aa5d3a1fc21e31500138a077c9f52bde
[ "Apache-2.0" ]
213
2015-07-23T09:11:24.000Z
2022-03-26T16:01:50.000Z
core/precalcmatches/berkeley/src/test/java/uk/ac/ebi/interpro/scan/precalc/berkeley/TestDPLPersistence.java
santosh653/interproscan
0ec69087aa5d3a1fc21e31500138a077c9f52bde
[ "Apache-2.0" ]
240
2015-09-16T19:47:06.000Z
2022-03-23T15:07:46.000Z
core/precalcmatches/berkeley/src/test/java/uk/ac/ebi/interpro/scan/precalc/berkeley/TestDPLPersistence.java
santosh653/interproscan
0ec69087aa5d3a1fc21e31500138a077c9f52bde
[ "Apache-2.0" ]
71
2015-12-01T05:07:55.000Z
2022-03-24T05:58:43.000Z
38.525974
126
0.561605
6,384
package uk.ac.ebi.interpro.scan.precalc.berkeley; import com.sleepycat.je.DatabaseException; import com.sleepycat.je.Environment; import com.sleepycat.je.EnvironmentConfig; import com.sleepycat.persist.*; import org.junit.jupiter.api.Disabled; import uk.ac.ebi.interpro.scan.precalc.berkeley.model.BerkeleyLocation; import uk.ac.ebi.interpro.scan.precalc.berkeley.model.BerkeleyMatch; import java.io.File; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Random; import java.util.UUID; /** * This test (just a main class, not a Junit test) has been developed * to test the scalability of BerkeleyDB for precalculated match lookup. * <p/> * Creates 20 million random matches and allows the speed of lookup to be tested. * * @author Phil Jones * @version $Id$ * @since 1.0-SNAPSHOT */ @Disabled public class TestDPLPersistence { private static final int MATCH_NUMBER = 20 * 1000 * 1000; // The number of matches currently in Onion. // private static final int MATCH_NUMBER = 1000; private static final int SELECT_INTERVAL = 100 * 1000; private static final int MATCHES_PER_PROTEIN = 4; private static final NumberFormat format = DecimalFormat.getInstance(); public static void main(String[] args) { Environment myEnv = null; EntityStore store = null; EntityCursor<BerkeleyMatch> matchCursor = null; try { EnvironmentConfig myEnvConfig = new EnvironmentConfig(); StoreConfig storeConfig = new StoreConfig(); myEnvConfig.setAllowCreate(true); storeConfig.setAllowCreate(true); storeConfig.setTransactional(false); File file = new File("./target/BIG"); file.mkdirs(); // Open the environment and entity store myEnv = new Environment(file, myEnvConfig); store = new EntityStore(myEnv, "EntityStore", storeConfig); PrimaryIndex<Long, BerkeleyMatch> primIDX = store.getPrimaryIndex(Long.class, BerkeleyMatch.class); SecondaryIndex<String, Long, BerkeleyMatch> secIDX = store.getSecondaryIndex(primIDX, String.class, "proteinMD5"); String proteinMD5 = UUID.randomUUID().toString(); // Need to pick a random accession. final Random randomizer = new Random(); int randomValue = randomizer.nextInt(SELECT_INTERVAL); String randomlySelectedProteinMD5 = null; // Create some random Matches for (int i = 0; i < MATCH_NUMBER; i++) { if (i % MATCHES_PER_PROTEIN == 0) { proteinMD5 = UUID.randomUUID().toString(); // System.out.println(proteinMD5); } if (i == randomValue) { randomlySelectedProteinMD5 = proteinMD5; } BerkeleyMatch match = new BerkeleyMatch(); match.setProteinMD5(proteinMD5); match.setSignatureAccession(UUID.randomUUID().toString().substring(0, 6)); match.setSequenceEValue(randomizer.nextDouble()); match.setSequenceScore(randomizer.nextDouble()); for (int j = 0; j < 4; j++) { BerkeleyLocation location = new BerkeleyLocation(); if (i % 50 == 0) { location.setCigarAlignment(UUID.randomUUID().toString()); } if (i % 2 == 0) { location.seteValue(randomizer.nextDouble()); } Random rand = new Random(); location.setStart(rand.nextInt()); location.setEnd(rand.nextInt()); match.addLocation(location); } primIDX.put(match); if (i % SELECT_INTERVAL == 0 && i > 0) { System.out.println("Following storage of " + i + " matches:"); long startTimeMilli = System.currentTimeMillis(); matchCursor = secIDX.entities(randomlySelectedProteinMD5, true, randomlySelectedProteinMD5, true); BerkeleyMatch currentMatch; while ((currentMatch = matchCursor.next()) != null) { System.out.println("currentMatch = " + currentMatch); } long endTimeMilli = System.currentTimeMillis(); System.out.println("Time for complete query & iteration: " + (endTimeMilli - startTimeMilli) + " ms."); matchCursor.close(); // Pick a random protein out of the next lot being inserted. randomValue = randomizer.nextInt(SELECT_INTERVAL) + i; } } // System.out.println(randomlySelectedProteinMD5 + " key found? " + secIDX.contains(randomlySelectedProteinMD5)); // System.out.println("secIDX.count() = " + secIDX.count()); } catch (DatabaseException dbe) { System.err.println("Error opening environment and store: " + dbe.toString()); System.exit(-1); } finally { if (store != null) { try { store.close(); } catch (DatabaseException dbe) { System.err.println("Error closing store: " + dbe.toString()); System.exit(-1); } } if (myEnv != null) { try { // Finally, close environment. myEnv.close(); } catch (DatabaseException dbe) { System.err.println("Error closing MyDbEnv: " + dbe.toString()); System.exit(-1); } } } } }
3e0f07110952e5baef2215ebe59678d7ee998301
13,143
java
Java
main/ejml-dsparse/src/org/ejml/sparse/csc/mult/ImplMultiplication_MT_DSCC.java
Lundez/ejml
f77b055d67eecab5c3fca45c625c891c8aa50acc
[ "Apache-2.0" ]
429
2015-01-08T20:17:15.000Z
2022-03-15T21:37:37.000Z
main/ejml-dsparse/src/org/ejml/sparse/csc/mult/ImplMultiplication_MT_DSCC.java
Lundez/ejml
f77b055d67eecab5c3fca45c625c891c8aa50acc
[ "Apache-2.0" ]
126
2015-01-08T14:42:58.000Z
2022-03-11T16:24:21.000Z
main/ejml-dsparse/src/org/ejml/sparse/csc/mult/ImplMultiplication_MT_DSCC.java
Lundez/ejml
f77b055d67eecab5c3fca45c625c891c8aa50acc
[ "Apache-2.0" ]
114
2015-02-22T05:38:33.000Z
2022-01-22T12:46:26.000Z
39.350299
122
0.503005
6,385
/* * Copyright (c) 2020, Peter Abeles. All Rights Reserved. * * This file is part of Efficient Java Matrix Library (EJML). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.ejml.sparse.csc.mult; import org.ejml.UtilEjml; import org.ejml.concurrency.EjmlConcurrency; import org.ejml.data.DGrowArray; import org.ejml.data.DMatrixRMaj; import org.ejml.data.DMatrixSparseCSC; import pabeles.concurrency.GrowArray; import java.util.Arrays; import static org.ejml.UtilEjml.adjust; import static org.ejml.sparse.csc.mult.ImplMultiplication_DSCC.multAddColA; /** * Concurrent matrix multiplication for DSCC matrices. * * @author Peter Abeles */ public class ImplMultiplication_MT_DSCC { /** * Performs matrix multiplication. C = A*B. The problem is broken up into as many "blocks" as there are threads * available. Each block will process a set of columns independently. After running results from independent * blocks are stitched together in the main thread. Extra storage requirements is about the same size as * 'C'. * * @param A Matrix * @param B Matrix * @param C Storage for results. Data length is increased if increased if insufficient. * @param listWork (Optional) Storage for internal workspace. Can be null. */ public static void mult( DMatrixSparseCSC A, DMatrixSparseCSC B, DMatrixSparseCSC C, GrowArray<Workspace_MT_DSCC> listWork ) { // Break the problem up into blocks of columns and process them independently EjmlConcurrency.loopBlocks(0, B.numCols, listWork, ( workspace, bj0, bj1 ) -> { DMatrixSparseCSC workC = workspace.mat; workC.reshape(A.numRows, bj1 - bj0, bj1 - bj0); workC.col_idx[0] = 0; double[] x = adjust(workspace.gx, A.numRows); int[] w = adjust(workspace.gw, A.numRows, A.numRows); // C(i,j) = sum_k A(i,k) * B(k,j) for (int bj = bj0; bj < bj1; bj++) { int colC = bj - bj0; int idx0 = B.col_idx[bj]; int idx1 = B.col_idx[bj + 1]; workC.col_idx[colC + 1] = workC.nz_length; if (idx0 == idx1) { continue; } // C(:,j) = sum_k A(:,k)*B(k,j) for (int bi = idx0; bi < idx1; bi++) { int rowB = B.nz_rows[bi]; double valB = B.nz_values[bi]; // B(k,j) k=rowB j=colB multAddColA(A, rowB, valB, workC, colC + 1, x, w); } // take the values in the dense vector 'x' and put them into 'C' int idxC0 = workC.col_idx[colC]; int idxC1 = workC.col_idx[colC + 1]; for (int i = idxC0; i < idxC1; i++) { workC.nz_values[i] = x[workC.nz_rows[i]]; } } }); // Stitch the output back together stitchMatrix(C, A.numRows, B.numCols, listWork); } /** * Compines results from independent blocks into a single matrix */ public static void stitchMatrix( DMatrixSparseCSC out, int numRows, int numCols, GrowArray<Workspace_MT_DSCC> listWork ) { out.reshape(numRows, numCols); out.indicesSorted = false; out.nz_length = 0; for (int i = 0; i < listWork.size(); i++) { out.nz_length += listWork.get(i).mat.nz_length; } out.growMaxLength(out.nz_length, false); out.nz_length = 0; out.numCols = 0; out.col_idx[0] = 0; for (int i = 0; i < listWork.size(); i++) { Workspace_MT_DSCC workspace = listWork.get(i); System.arraycopy(workspace.mat.nz_rows, 0, out.nz_rows, out.nz_length, workspace.mat.nz_length); System.arraycopy(workspace.mat.nz_values, 0, out.nz_values, out.nz_length, workspace.mat.nz_length); for (int col = 1; col <= workspace.mat.numCols; col++) { out.col_idx[++out.numCols] = out.nz_length + workspace.mat.col_idx[col]; } out.nz_length += workspace.mat.nz_length; } // Sanity check the stitching UtilEjml.assertEq(out.numCols, numCols); UtilEjml.assertEq(out.col_idx[numCols], out.nz_length); } public static void mult( DMatrixSparseCSC A, DMatrixRMaj B, DMatrixRMaj C, GrowArray<DGrowArray> listWork ) { mult(A, B, C, false, listWork); } public static void multAdd( DMatrixSparseCSC A, DMatrixRMaj B, DMatrixRMaj C, GrowArray<DGrowArray> listWork ) { mult(A, B, C, true, listWork); } public static void mult( DMatrixSparseCSC A, DMatrixRMaj B, DMatrixRMaj C, boolean add, GrowArray<DGrowArray> listWork ) { // Break the problem up into blocks of columns and process them independently EjmlConcurrency.loopBlocks(0, B.numCols, listWork, ( gwork, bj0, bj1 ) -> { // same array to store column in A and B. This is done to reduce cache misses in B and C access double[] work = gwork.reshape(A.numRows + B.numRows).data; // C(i,j) = sum_k A(i,k) * B(k,j) for (int bj = bj0; bj < bj1; bj++) { // initialize column in C to all zeros Arrays.fill(work, 0, A.numRows, 0.0); // copy the column of B for (int k = 0; k < B.numRows; k++) { work[A.numRows + k] = B.data[k*B.numCols + bj]; } // Ideally this would be the outer loops, but there's no good way to only compute a row or column at // a time if that is done for (int k = 0; k < A.numCols; k++) { int idx0 = A.col_idx[k]; int idx1 = A.col_idx[k + 1]; if (idx0 == idx1) continue; for (int i = idx0; i < idx1; i++) { int ai = A.nz_rows[i]; work[ai] += A.nz_values[i]*work[A.numRows + k]; // C.data[ai*C.numCols + bj] += A.nz_values[i]*B.data[k*B.numCols + bj]; } } // Copy results over if (add) { for (int rowC = 0; rowC < C.numRows; rowC++) { C.data[rowC*C.numCols + bj] += work[rowC]; } } else { for (int rowC = 0; rowC < C.numRows; rowC++) { C.data[rowC*C.numCols + bj] = work[rowC]; } } } }); } public static void multTransA( DMatrixSparseCSC A, DMatrixRMaj B, DMatrixRMaj C, GrowArray<DGrowArray> listWork ) { // C(i,j) = sum_k A(k,i) * B(k,j) EjmlConcurrency.loopBlocks(0, B.numCols, listWork, ( gwork, j0, j1 ) -> { // Local copy of column in A to reduce cache misses double[] work = gwork.reshape(B.numRows).data; for (int j = j0; j < j1; j++) { for (int k = 0; k < B.numRows; k++) { work[k] = B.data[k*B.numCols + j]; } for (int i = 0; i < A.numCols; i++) { int idx0 = A.col_idx[i]; int idx1 = A.col_idx[i + 1]; double sum = 0; for (int indexA = idx0; indexA < idx1; indexA++) { int k = A.nz_rows[indexA]; sum += A.nz_values[indexA]*work[k]; // sum += A.nz_values[indexA]*B.data[k*B.numCols + j]; } C.data[i*C.numCols + j] = sum; } } }); } public static void multAddTransA( DMatrixSparseCSC A, DMatrixRMaj B, DMatrixRMaj C, GrowArray<DGrowArray> listWork ) { // C(i,j) = sum_k A(k,i) * B(k,j) EjmlConcurrency.loopBlocks(0, B.numCols, listWork, ( gwork, j0, j1 ) -> { // Local copy of column in A to reduce cache misses double[] work = gwork.reshape(B.numRows).data; for (int j = j0; j < j1; j++) { for (int k = 0; k < B.numRows; k++) { work[k] = B.data[k*B.numCols + j]; } for (int i = 0; i < A.numCols; i++) { int idx0 = A.col_idx[i]; int idx1 = A.col_idx[i + 1]; double sum = 0; for (int indexA = idx0; indexA < idx1; indexA++) { int k = A.nz_rows[indexA]; sum += A.nz_values[indexA]*work[k]; // sum += A.nz_values[indexA]*B.data[k*B.numCols + j]; } C.data[i*C.numCols + j] += sum; } } }); } public static void multTransB( DMatrixSparseCSC A, DMatrixRMaj B, DMatrixRMaj C, GrowArray<DGrowArray> listWork ) { multTransB(A, B, C, false, listWork); } public static void multAddTransB( DMatrixSparseCSC A, DMatrixRMaj B, DMatrixRMaj C, GrowArray<DGrowArray> listWork ) { multTransB(A, B, C, true, listWork); } public static void multTransB( DMatrixSparseCSC A, DMatrixRMaj B, DMatrixRMaj C, boolean add, GrowArray<DGrowArray> listWork ) { // Break the problem up into blocks of columns and process them independently EjmlConcurrency.loopBlocks(0, B.numRows, listWork, ( gwork, bj0, bj1 ) -> { // Local copy of column in A to reduce cache misses double[] work = gwork.reshape(A.numRows).data; // C(i,j) = sum_k A(i,k) * B(k,j) for (int bj = bj0; bj < bj1; bj++) { // initialize column in C to all zeros Arrays.fill(work, 0, A.numRows, 0.0); // Ideally this would be the outer loops, but there's no good way to only compute a row or column at // a time if that is done for (int k = 0; k < A.numCols; k++) { int idx0 = A.col_idx[k]; int idx1 = A.col_idx[k + 1]; if (idx0 == idx1) continue; for (int i = idx0; i < idx1; i++) { int ai = A.nz_rows[i]; work[ai] += A.nz_values[i]*B.data[bj*B.numCols + k]; // C.data[ai*C.numCols + bj] += A.nz_values[i]*B.data[k*B.numCols + bj]; } } // Copy results over if (add) { for (int rowC = 0; rowC < C.numRows; rowC++) { C.data[rowC*C.numCols + bj] += work[rowC]; } } else { for (int rowC = 0; rowC < C.numRows; rowC++) { C.data[rowC*C.numCols + bj] = work[rowC]; } } } }); } public static void multTransAB( DMatrixSparseCSC A, DMatrixRMaj B, DMatrixRMaj C ) { // C(i,j) = sum_k A(k,i) * B(j,k) EjmlConcurrency.loopFor(0, B.numRows, j -> { for (int i = 0; i < A.numCols; i++) { int idx0 = A.col_idx[i]; int idx1 = A.col_idx[i + 1]; final int indexRowB = j*B.numCols; double sum = 0; for (int indexA = idx0; indexA < idx1; indexA++) { int k = A.nz_rows[indexA]; sum += A.nz_values[indexA]*B.data[indexRowB + k]; } C.data[i*C.numCols + j] = sum; } }); } public static void multAddTransAB( DMatrixSparseCSC A, DMatrixRMaj B, DMatrixRMaj C ) { // C(i,j) = sum_k A(k,i) * B(j,k) EjmlConcurrency.loopFor(0, B.numRows, j -> { for (int i = 0; i < A.numCols; i++) { int idx0 = A.col_idx[i]; int idx1 = A.col_idx[i + 1]; final int indexRowB = j*B.numCols; double sum = 0; for (int indexA = idx0; indexA < idx1; indexA++) { int k = A.nz_rows[indexA]; sum += A.nz_values[indexA]*B.data[indexRowB + k]; } C.data[i*C.numCols + j] += sum; } }); } }
3e0f0787d4a2a267f4b36611f00f2fc278061e4a
1,295
java
Java
src/main/java/com/example/botapi/handlers/callbackquery/GetBookmarksCallbackHandler.java
Halreg/findStuffBot
1919862a267551c1992a56e9debce9f1997a3036
[ "MIT" ]
null
null
null
src/main/java/com/example/botapi/handlers/callbackquery/GetBookmarksCallbackHandler.java
Halreg/findStuffBot
1919862a267551c1992a56e9debce9f1997a3036
[ "MIT" ]
null
null
null
src/main/java/com/example/botapi/handlers/callbackquery/GetBookmarksCallbackHandler.java
Halreg/findStuffBot
1919862a267551c1992a56e9debce9f1997a3036
[ "MIT" ]
null
null
null
38.088235
135
0.808494
6,386
package com.example.botapi.handlers.callbackquery; import com.example.botapi.BotState; import com.example.cache.UserDataCache; import com.example.service.postsearching.PostSearchCache; import com.example.service.postsearching.PostSearchCase; import com.example.service.postsearching.SearchPostsService; import org.springframework.stereotype.Component; import org.telegram.telegrambots.meta.api.methods.send.SendMessage; import org.telegram.telegrambots.meta.api.objects.CallbackQuery; @Component public class GetBookmarksCallbackHandler implements CallbackQueryHandler { private UserDataCache userDataCache; private SearchPostsService myPostsService; public GetBookmarksCallbackHandler(UserDataCache userDataCache, SearchPostsService myPostsService) { this.userDataCache = userDataCache; this.myPostsService = myPostsService; } @Override public SendMessage handleCallbackQuery(CallbackQuery callbackQuery) { PostSearchCache postSearchCache = userDataCache.getSearchPostsCache(callbackQuery.getFrom().getId(), PostSearchCase.BOOKMARKS); return myPostsService.handleCallbackQuery(callbackQuery,postSearchCache ,userDataCache); } @Override public BotState getHandlerName() { return BotState.CHECK_BOOKMARKS; } }
3e0f07fe99cda8aa16b9156d4cd24f50f4a6d7c4
1,803
java
Java
java/jdk/jdk_14/jdk_code_view/src/com/company/source/java.xml/com/sun/org/apache/xerces/internal/parsers/XMLGrammarParser.java
jaylinjiehong/-
591834e6d90ec8fbfd6c1d2a0913631f9f723a0a
[ "MIT" ]
null
null
null
java/jdk/jdk_14/jdk_code_view/src/com/company/source/java.xml/com/sun/org/apache/xerces/internal/parsers/XMLGrammarParser.java
jaylinjiehong/-
591834e6d90ec8fbfd6c1d2a0913631f9f723a0a
[ "MIT" ]
null
null
null
java/jdk/jdk_14/jdk_code_view/src/com/company/source/java.xml/com/sun/org/apache/xerces/internal/parsers/XMLGrammarParser.java
jaylinjiehong/-
591834e6d90ec8fbfd6c1d2a0913631f9f723a0a
[ "MIT" ]
null
null
null
32.781818
114
0.73655
6,387
/* * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ /* * 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 com.sun.org.apache.xerces.internal.parsers; import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.impl.dv.DTDDVFactory; import com.sun.org.apache.xerces.internal.util.SymbolTable; /** */ public abstract class XMLGrammarParser extends XMLParser { // // Data // /** fDatatypeValidatorFactory */ protected DTDDVFactory fDatatypeValidatorFactory; // // Constructors // /** * Construct an XMLGrammarParser with the specified symbol table * * @param symbolTable */ protected XMLGrammarParser(SymbolTable symbolTable) { super(new XIncludeAwareParserConfiguration()); fConfiguration.setProperty(Constants.XERCES_PROPERTY_PREFIX+Constants.SYMBOL_TABLE_PROPERTY, symbolTable); } } // class XMLGrammarParser
3e0f093c98cc2ca1c0ac9d1408d0be27ba27b316
1,527
java
Java
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/autoFTCLib.java
bcbro/14663-UltimateGoal_2021
84cbd995284cdaf0fc1ec7772eb5263e827339fe
[ "MIT" ]
null
null
null
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/autoFTCLib.java
bcbro/14663-UltimateGoal_2021
84cbd995284cdaf0fc1ec7772eb5263e827339fe
[ "MIT" ]
null
null
null
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/autoFTCLib.java
bcbro/14663-UltimateGoal_2021
84cbd995284cdaf0fc1ec7772eb5263e827339fe
[ "MIT" ]
null
null
null
40.184211
84
0.747217
6,388
//package org.firstinspires.ftc.teamcode; // //import com.arcrobotics.ftclib.command.MecanumControllerCommand; //import com.arcrobotics.ftclib.drivebase.MecanumDrive; //import com.arcrobotics.ftclib.geometry.Translation2d; //import com.arcrobotics.ftclib.hardware.motors.Motor; //import com.arcrobotics.ftclib.kinematics.wpilibkinematics.MecanumDriveKinematics; //import com.arcrobotics.ftclib.kinematics.wpilibkinematics.MecanumDriveOdometry; //import com.arcrobotics.ftclib.kinematics.wpilibkinematics.MecanumDriveWheelSpeeds; //import com.arcrobotics.ftclib.trajectory.Trajectory; //import com.qualcomm.robotcore.eventloop.opmode.Autonomous; //import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; //import com.qualcomm.robotcore.hardware.DcMotorEx; // //@Autonomous(name="autoFTCLib", group="auto") //public class autoFTCLib extends LinearOpMode{ // // Motor frontLeft; // Motor frontRight; // Motor backLeft; // Motor backRight; // // MecanumControllerCommand mecanumDrive; // Trajectory trajectory; // // @Override // public void runOpMode() throws InterruptedException { // frontLeft = hardwareMap.get(Motor.class,"frontleft"); // frontRight = hardwareMap.get(Motor.class, "frontright"); // backLeft = hardwareMap.get(Motor.class, "backleft"); // backRight = hardwareMap.get(Motor.class, "backright"); //// //// trajectory=new Trajectory() //// mecanumDrive=new MecanumControllerCommand() //// mecanumDrive.driveRobotCentric(); // } //}
3e0f0a2402bfc5b96f6d01390a85c0b67b5261fb
8,734
java
Java
src/main/java/org/exbin/utils/guipopup/WindowUtils.java
hajdam/defaultpopup-netbeans-plugin
4a4c19136b4b9e3df1ca6788b443ace16d246686
[ "Apache-2.0" ]
4
2021-01-08T09:00:21.000Z
2022-03-25T17:31:41.000Z
src/main/java/org/exbin/utils/guipopup/WindowUtils.java
hajdam/defaultpopup-netbeans-plugin
4a4c19136b4b9e3df1ca6788b443ace16d246686
[ "Apache-2.0" ]
1
2021-01-08T09:04:31.000Z
2021-07-15T22:14:20.000Z
src/main/java/org/exbin/utils/guipopup/WindowUtils.java
hajdam/defaultpopup-netbeans-plugin
4a4c19136b4b9e3df1ca6788b443ace16d246686
[ "Apache-2.0" ]
1
2022-03-25T17:32:17.000Z
2022-03-25T17:32:17.000Z
33.083333
171
0.600527
6,389
/* * Copyright (C) ExBin Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.exbin.utils.guipopup; import java.awt.Component; import java.awt.Container; import java.awt.Dialog; import java.awt.Dimension; import java.awt.Frame; import java.awt.Window; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.WindowEvent; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JEditorPane; import javax.swing.JOptionPane; import javax.swing.JRootPane; import javax.swing.JTextArea; import javax.swing.JTextPane; import javax.swing.SwingUtilities; import javax.swing.UnsupportedLookAndFeelException; import org.openide.DialogDescriptor; import org.openide.DialogDisplayer; /** * Utility static methods usable for windows and dialogs. * * @version 0.1.0 2019/07/22 * @author ExBin Project (http://exbin.org) */ public class WindowUtils { private static final int BUTTON_CLICK_TIME = 150; private WindowUtils() { } public static void invokeWindow(final Window window) { java.awt.EventQueue.invokeLater(() -> { if (window instanceof JDialog) { ((JDialog) window).setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); } window.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); window.setVisible(true); }); } public static DialogWrapper createDialog(final JComponent component, Component parent, String dialogTitle, Dialog.ModalityType modalityType) { DialogDescriptor dialogDescriptor = new DialogDescriptor(component, dialogTitle, modalityType != Dialog.ModalityType.MODELESS, new Object[0], null, 0, null, null); final Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor); Dimension size = component.getPreferredSize(); dialog.add(component); dialog.setSize(size.width + 8, size.height + 24); dialog.setTitle(dialogTitle); return new DialogWrapper() { @Override public void show() { dialog.setVisible(true); } @Override public void showCentered(Component component) { center(component); show(); } @Override public void close() { closeWindow(dialog); } @Override public void dispose() { dialog.dispose(); } @Override public Window getWindow() { return dialog; } @Override public Container getParent() { return dialog.getParent(); } @Override public void center(Component component) { if (component == null) { center(); } else { dialog.setLocationRelativeTo(component); } } @Override public void center() { dialog.setLocationByPlatform(true); } }; } public static JDialog createDialog(final JComponent component) { JDialog dialog = new JDialog(); Dimension size = component.getPreferredSize(); dialog.add(component); dialog.setSize(size.width + 8, size.height + 24); return dialog; } public static void invokeDialog(final JComponent component) { JDialog dialog = createDialog(component); invokeWindow(dialog); } public static void closeWindow(Window window) { window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING)); } /** * Find frame component for given component. * * @param component instantiated component * @return frame instance if found */ public static Frame getFrame(Component component) { Window parentComponent = SwingUtilities.getWindowAncestor(component); while (!(parentComponent == null || parentComponent instanceof Frame)) { parentComponent = SwingUtilities.getWindowAncestor(parentComponent); } if (parentComponent == null) { parentComponent = JOptionPane.getRootFrame(); } return (Frame) parentComponent; } public static Window getWindow(Component component) { return SwingUtilities.getWindowAncestor(component); } /** * Assign ESCAPE/ENTER key for all focusable components recursively. * * @param component target component * @param closeButton button which will be used for closing operation */ public static void assignGlobalKeyListener(Component component, final JButton closeButton) { assignGlobalKeyListener(component, closeButton, closeButton); } /** * Assign ESCAPE/ENTER key for all focusable components recursively. * * @param component target component */ public static void assignGlobalKeyListener(Component component, final JButton okButton, final JButton cancelButton) { final KeyListener keyListener = new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == KeyEvent.VK_ENTER) { boolean performOkAction = true; if (evt.getSource() instanceof JButton) { ((JButton) evt.getSource()).doClick(BUTTON_CLICK_TIME); performOkAction = false; } else if (evt.getSource() instanceof JTextArea) { performOkAction = !((JTextArea) evt.getSource()).isEditable(); } else if (evt.getSource() instanceof JTextPane) { performOkAction = !((JTextPane) evt.getSource()).isEditable(); } else if (evt.getSource() instanceof JEditorPane) { performOkAction = !((JEditorPane) evt.getSource()).isEditable(); } if (performOkAction) { doButtonClick(okButton); } } else if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) { boolean performCancelAction = true; if (evt.getSource() instanceof JComboBox) { performCancelAction = !((JComboBox) evt.getSource()).isPopupVisible(); } else if (evt.getSource() instanceof JRootPane) { // Ignore in popup menus performCancelAction = false; } if (performCancelAction) { doButtonClick(cancelButton); } } } @Override public void keyReleased(KeyEvent e) { } }; RecursiveLazyComponentListener componentListener = new RecursiveLazyComponentListener(new LazyComponentListener() { @Override public void componentCreated(Component component) { if (component.isFocusable()) { component.addKeyListener(keyListener); } } }); componentListener.fireListener(component); } /** * Performs visually visible click on the button component. * * @param button button component */ public static void doButtonClick(JButton button) { button.doClick(BUTTON_CLICK_TIME); } public interface DialogWrapper { void show(); void showCentered(Component window); void close(); void dispose(); Window getWindow(); Container getParent(); void center(Component window); void center(); } }
3e0f0a27a512981747f2a81705ae74e58d628310
4,853
java
Java
src/main/java/net/dontdrinkandroot/utils/collections/CollectionUtils.java
dontdrinkandroot/utils.java
01f00c121ac55104aed996b3e1a948c76dd4c007
[ "Apache-2.0" ]
null
null
null
src/main/java/net/dontdrinkandroot/utils/collections/CollectionUtils.java
dontdrinkandroot/utils.java
01f00c121ac55104aed996b3e1a948c76dd4c007
[ "Apache-2.0" ]
null
null
null
src/main/java/net/dontdrinkandroot/utils/collections/CollectionUtils.java
dontdrinkandroot/utils.java
01f00c121ac55104aed996b3e1a948c76dd4c007
[ "Apache-2.0" ]
null
null
null
30.509434
118
0.559472
6,390
/* * Copyright (C) 2012-2017 Philip W. Sorst <ychag@example.com> * and individual contributors as indicated * by the @authors tag. * * 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 net.dontdrinkandroot.utils.collections; import java.util.*; /** * @author Philip Washington Sorst <ychag@example.com> */ public class CollectionUtils extends org.apache.commons.collections15.CollectionUtils { public static <T extends Number> double getMean(final Collection<T> collection) { final int size = collection.size(); final List<T> sorted = new ArrayList<T>(collection); Collections.sort(sorted, new Comparator<T>() { @Override public int compare(final T n1, final T n2) { if (null == n1 || null == n2) { throw new IllegalArgumentException("Must not contain null values"); } return (int) Math.signum(n2.doubleValue() - n1.doubleValue()); } }); if (size % 2 == 0) { return (sorted.get(size / 2).doubleValue() + sorted.get(size / 2 - 1).doubleValue()) / 2; } else { return sorted.get(size / 2).doubleValue(); } } public static <T> T first(Iterable<T> iterable) { Iterator<T> iterator = iterable.iterator(); if (!iterator.hasNext()) { return null; } return iterator.next(); } /** * Nullsafe check if a collection is empty. * * @param obj Null or a subclass of Collection. * @throws IllegalArgumentException Thrown if obj is not null and not an instance of Collection. */ public static boolean isEmpty(Object obj) { if (obj == null) { return true; } if (obj instanceof Collection) { return ((Collection<?>) obj).isEmpty(); } throw new IllegalArgumentException("Given Object was not a collection"); } public static <K, V> void addToMapList(K key, V value, Map<K, List<V>> map) { List<V> list = map.get(key); if (list == null) { list = new ArrayList<V>(); map.put(key, list); } list.add(value); } public static <K, V> void addToMapSet(K key, V value, Map<K, Set<V>> map) { Set<V> set = map.get(key); if (set == null) { set = new HashSet<V>(); map.put(key, set); } set.add(value); } public static <V> V getRandom(Collection<V> collection) { if (collection.isEmpty()) { return null; } int randIdx = (int) Math.round(Math.random() * (collection.size() - 1)); int count = 0; Iterator<V> iterator = collection.iterator(); while (iterator.hasNext()) { V current = iterator.next(); if (count == randIdx) { return current; } count++; } throw new RuntimeException("Shouldn't happen"); } public static <K, V extends Comparable<? super V>> SortedSet<Map.Entry<K, V>> entriesSortedByValues(Map<K, V> map) { SortedSet<Map.Entry<K, V>> sortedEntries = new TreeSet<Map.Entry<K, V>>(new Comparator<Map.Entry<K, V>>() { @Override public int compare(Map.Entry<K, V> e1, Map.Entry<K, V> e2) { int res = e1.getValue().compareTo(e2.getValue()); /* Preserve items with equal values */ return res != 0 ? res : 1; } }); sortedEntries.addAll(map.entrySet()); return sortedEntries; } public static <K, V extends Comparable<? super V>> SortedSet<Map.Entry<K, V>> entriesSortedByValuesInverse( Map<K, V> map ) { SortedSet<Map.Entry<K, V>> sortedEntries = new TreeSet<Map.Entry<K, V>>(new Comparator<Map.Entry<K, V>>() { @Override public int compare(Map.Entry<K, V> e1, Map.Entry<K, V> e2) { int res = e2.getValue().compareTo(e1.getValue()); /* Preserve items with equal values */ return res != 0 ? res : -1; } }); sortedEntries.addAll(map.entrySet()); return sortedEntries; } }
3e0f0b1651371bb8b43bd5b344c467b0d7bdf221
3,932
java
Java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFName.java
ufctester/apache-poi
029758a131d81eb23e34dd336696ffbb665d1f5b
[ "Apache-2.0" ]
null
null
null
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFName.java
ufctester/apache-poi
029758a131d81eb23e34dd336696ffbb665d1f5b
[ "Apache-2.0" ]
null
null
null
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFName.java
ufctester/apache-poi
029758a131d81eb23e34dd336696ffbb665d1f5b
[ "Apache-2.0" ]
null
null
null
38.54902
90
0.662513
6,391
/* ==================================================================== 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.poi.xssf.usermodel; import org.apache.poi.xssf.XSSFTestDataSamples; import org.junit.Test; import org.apache.poi.xssf.XSSFITestDataProvider; import static org.junit.Assert.*; import org.apache.poi.ss.usermodel.BaseTestNamedRange; import org.apache.poi.ss.util.CellRangeAddress; /** * @author Yegor Kozlov */ public final class TestXSSFName extends BaseTestNamedRange { public TestXSSFName() { super(XSSFITestDataProvider.instance); } //TODO combine testRepeatingRowsAndColums() for HSSF and XSSF @Test public void testRepeatingRowsAndColums() throws Exception { // First test that setting RR&C for same sheet more than once only creates a // single Print_Titles built-in record XSSFWorkbook wb = new XSSFWorkbook(); XSSFSheet sheet1 = wb.createSheet("First Sheet"); sheet1.setRepeatingRows(null); sheet1.setRepeatingColumns(null); // set repeating rows and columns twice for the first sheet for (int i = 0; i < 2; i++) { sheet1.setRepeatingRows(CellRangeAddress.valueOf("1:4")); sheet1.setRepeatingColumns(CellRangeAddress.valueOf("A:A")); //sheet.createFreezePane(0, 3); } assertEquals(1, wb.getNumberOfNames()); XSSFName nr1 = wb.getNameAt(0); assertEquals(XSSFName.BUILTIN_PRINT_TITLE, nr1.getNameName()); assertEquals("'First Sheet'!$A:$A,'First Sheet'!$1:$4", nr1.getRefersToFormula()); //remove the columns part sheet1.setRepeatingColumns(null); assertEquals("'First Sheet'!$1:$4", nr1.getRefersToFormula()); //revert sheet1.setRepeatingColumns(CellRangeAddress.valueOf("A:A")); //remove the rows part sheet1.setRepeatingRows(null); assertEquals("'First Sheet'!$A:$A", nr1.getRefersToFormula()); //revert sheet1.setRepeatingRows(CellRangeAddress.valueOf("1:4")); // Save and re-open XSSFWorkbook nwb = XSSFTestDataSamples.writeOutAndReadBack(wb); wb.close(); assertEquals(1, nwb.getNumberOfNames()); nr1 = nwb.getNameAt(0); assertEquals(XSSFName.BUILTIN_PRINT_TITLE, nr1.getNameName()); assertEquals("'First Sheet'!$A:$A,'First Sheet'!$1:$4", nr1.getRefersToFormula()); // check that setting RR&C on a second sheet causes a new Print_Titles built-in // name to be created XSSFSheet sheet2 = nwb.createSheet("SecondSheet"); sheet2.setRepeatingRows(CellRangeAddress.valueOf("1:1")); sheet2.setRepeatingColumns(CellRangeAddress.valueOf("B:C")); assertEquals(2, nwb.getNumberOfNames()); XSSFName nr2 = nwb.getNameAt(1); assertEquals(XSSFName.BUILTIN_PRINT_TITLE, nr2.getNameName()); assertEquals("SecondSheet!$B:$C,SecondSheet!$1:$1", nr2.getRefersToFormula()); sheet2.setRepeatingRows(null); sheet2.setRepeatingColumns(null); nwb.close(); } }
3e0f0ca556d51554a5678a24926286d3925f3bed
2,644
java
Java
Project-Einstein/src/G-Assembler/Assembler/src/test/java/assembler/AssembleTest.java
FelixLuciano/Elements-of-Computing-Systems
bf36e4f4bbaa75aebefd1b864514a146b371495d
[ "MIT" ]
null
null
null
Project-Einstein/src/G-Assembler/Assembler/src/test/java/assembler/AssembleTest.java
FelixLuciano/Elements-of-Computing-Systems
bf36e4f4bbaa75aebefd1b864514a146b371495d
[ "MIT" ]
null
null
null
Project-Einstein/src/G-Assembler/Assembler/src/test/java/assembler/AssembleTest.java
FelixLuciano/Elements-of-Computing-Systems
bf36e4f4bbaa75aebefd1b864514a146b371495d
[ "MIT" ]
1
2022-02-20T21:45:28.000Z
2022-02-20T21:45:28.000Z
40.676923
85
0.657716
6,392
package assembler; import org.junit.Test; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import static org.junit.Assert.*; import static org.junit.Assert.assertTrue; public class AssembleTest { Assemble assembler = null; private String inFile = "src/test/resources/isEven.nasm"; private String outFile = "src/test/resources/isEven.hack"; public AssembleTest() { try { // Cria objeto assembler auxiliar assembler = new Assemble(inFile, outFile, false ); } catch(Exception e) { e.printStackTrace(); } } @Test public void fillSymbolTable() throws IOException { // Cria tabela de símbolos SymbolTable table = assembler.fillSymbolTable(); assertTrue("R1",table.contains("R1")==true); assertTrue("$impar",table.contains("impar")==true); assertTrue("$impar",table.getAddress("impar")==12); assertTrue("$par",table.contains("par")==true); assertTrue("$par",table.getAddress("par")==2); assertTrue("$end",table.contains("end")==true); assertTrue("$end",table.getAddress("end")==14); } @Test public void generateMachineCode() throws IOException { // SymbolTable table = assembler.fillSymbolTable(); SymbolTable table = assembler.fillSymbolTable(); assembler.generateMachineCode(); assembler.close(); BufferedReader fileReader = new BufferedReader(new FileReader(outFile)); assertEquals(fileReader.readLine(),"000000000000000101"); // leaw $5, %A assertEquals(fileReader.readLine(),"100011100000010000"); // movw (%A), %D assertEquals(fileReader.readLine(),"000000000000000001"); // leaw $1, %A assertEquals(fileReader.readLine(),"100000000000010000"); // andw %A, %D, %D assertEquals(fileReader.readLine(),"000000000000001100"); // leaw $impart, %A assertEquals(fileReader.readLine(),"100000011000000001"); // jg fileReader.readLine(); // nop "100000000000000000" assertEquals(fileReader.readLine(),"000000000000000000"); // leaw $0, %A assertEquals(fileReader.readLine(),"100001111110100000"); // movw $1, ($A) assertEquals(fileReader.readLine(),"000000000000001110"); // leaw $impart, %A assertEquals(fileReader.readLine(),"100000011000000111"); // jg fileReader.readLine(); // nop "100000000000000000" assertEquals(fileReader.readLine(),"000000000000000000"); // leaw $0, %A assertEquals(fileReader.readLine(),"100001010100100000"); // movw $1, ($A) } }
3e0f0cb87f02de09a16d3772accbfb9a2a33f895
2,804
java
Java
Hotel-UDEC/dominionegocio/parametricaservice/src/main/java/co/edu/ucundinamarca/negocio/parametricaservice/controller/UsuariosController.java
handresortiz/hotel-UDEC-backend
9e33ab342a6c40cf0ba135cc62786ce0dbc0ae9b
[ "MIT" ]
null
null
null
Hotel-UDEC/dominionegocio/parametricaservice/src/main/java/co/edu/ucundinamarca/negocio/parametricaservice/controller/UsuariosController.java
handresortiz/hotel-UDEC-backend
9e33ab342a6c40cf0ba135cc62786ce0dbc0ae9b
[ "MIT" ]
null
null
null
Hotel-UDEC/dominionegocio/parametricaservice/src/main/java/co/edu/ucundinamarca/negocio/parametricaservice/controller/UsuariosController.java
handresortiz/hotel-UDEC-backend
9e33ab342a6c40cf0ba135cc62786ce0dbc0ae9b
[ "MIT" ]
1
2021-11-12T22:53:38.000Z
2021-11-12T22:53:38.000Z
41.235294
130
0.752853
6,393
package co.edu.ucundinamarca.negocio.parametricaservice.controller; import co.edu.ucundinamarca.negocio.parametricaservice.entities.Personas; import co.edu.ucundinamarca.negocio.parametricaservice.entities.Usuarios; import co.edu.ucundinamarca.negocio.parametricaservice.entities.Perfil; import co.edu.ucundinamarca.negocio.parametricaservice.entities.UsuariosForm; import co.edu.ucundinamarca.negocio.parametricaservice.services.UsuariosService; import co.edu.ucundinamarca.negocio.parametricaservice.services.PersonasService; import co.edu.ucundinamarca.negocio.parametricaservice.services.PerfilesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; @RestController @RequestMapping("api/usuarios") public class UsuariosController { private final UsuariosService usuariosService; private final PersonasService personasService; private final PerfilesService perfilesService; @Autowired public UsuariosController(UsuariosService usuariosService, PersonasService personasService, PerfilesService perfilesService) { this.usuariosService = usuariosService; this.personasService = personasService; this.perfilesService = perfilesService; } @GetMapping public ResponseEntity<List<Usuarios>> getAllUsuarios() { List<Usuarios> usuariosList = usuariosService.findAllUsuarios(); return new ResponseEntity<>( usuariosList, HttpStatus.OK ); } @GetMapping("/{id}") public Usuarios getUsuarios( @PathVariable("id") Integer id ){ return usuariosService.getUsuarioById(id); } @PostMapping("/agregar") public ResponseEntity<Usuarios> addUsuario(@Valid @RequestBody UsuariosForm usuario){ Personas persona = usuario.getPersona(); persona = personasService.addPersona(persona); Usuarios newUsuario = usuariosService.addUsuario( usuario.getId_perfil(), persona.getPri_nombre(), persona.getPri_apellido(), persona.getIdentificacion(), persona); return new ResponseEntity<>(newUsuario, HttpStatus.CREATED); } @PutMapping("/actualizar/{id}") public ResponseEntity<Usuarios> updateUsuario(@PathVariable("id") Integer id,@Valid @RequestBody UsuariosForm usuario){ Usuarios newUsuario = usuariosService.updateUsario(id, usuario); return new ResponseEntity<>(newUsuario, HttpStatus.OK); } @DeleteMapping("/eliminar/{id}") public Usuarios deleteUsuario( @PathVariable("id") Integer id ){ return usuariosService.deleteUsuarioById(id); } }
3e0f0d59ebf955453f122bb0225f0e267fcacd82
1,259
java
Java
redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/util/HickwallMetricInfo.java
fy-travis-projects/x-pipe
4d0a1d63900a25de99c9e244491724440409bdc3
[ "Apache-2.0" ]
null
null
null
redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/util/HickwallMetricInfo.java
fy-travis-projects/x-pipe
4d0a1d63900a25de99c9e244491724440409bdc3
[ "Apache-2.0" ]
null
null
null
redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/util/HickwallMetricInfo.java
fy-travis-projects/x-pipe
4d0a1d63900a25de99c9e244491724440409bdc3
[ "Apache-2.0" ]
null
null
null
21.338983
71
0.687847
6,394
package com.ctrip.xpipe.redis.console.util; /** * @author zhuchen * Apr 2020/4/10 2020 */ public class HickwallMetricInfo { private String domain; private int delayPanelId; private int proxyPingPanelId; private int proxyTrafficPanelId; private int proxyCollectionPanelId; public String getDomain() { return domain; } public void setDomain(String domain) { this.domain = domain; } public int getDelayPanelId() { return delayPanelId; } public void setDelayPanelId(int delayPanelId) { this.delayPanelId = delayPanelId; } public int getProxyPingPanelId() { return proxyPingPanelId; } public void setProxyPingPanelId(int proxyPingPanelId) { this.proxyPingPanelId = proxyPingPanelId; } public int getProxyTrafficPanelId() { return proxyTrafficPanelId; } public void setProxyTrafficPanelId(int proxyTrafficPanelId) { this.proxyTrafficPanelId = proxyTrafficPanelId; } public int getProxyCollectionPanelId() { return proxyCollectionPanelId; } public void setProxyCollectionPanelId(int proxyCollectionPanelId) { this.proxyCollectionPanelId = proxyCollectionPanelId; } }
3e0f0db38eb7b29f2cc7a5ceefb98e69f47bcdea
238
java
Java
quinn-service-mq/src/main/java/com/quinn/framework/util/enums/ExchangeTypeEnum.java
simonzcx/quinn-service-framework
241c4f8b1f42244c558d73a5820109ea1677151d
[ "Apache-2.0" ]
3
2020-11-20T06:35:39.000Z
2020-11-20T07:38:17.000Z
quinn-service-mq/src/main/java/com/quinn/framework/util/enums/ExchangeTypeEnum.java
simonzcx/quinn-service-framework
241c4f8b1f42244c558d73a5820109ea1677151d
[ "Apache-2.0" ]
null
null
null
quinn-service-mq/src/main/java/com/quinn/framework/util/enums/ExchangeTypeEnum.java
simonzcx/quinn-service-framework
241c4f8b1f42244c558d73a5820109ea1677151d
[ "Apache-2.0" ]
1
2020-11-09T01:05:11.000Z
2020-11-09T01:05:11.000Z
11.9
39
0.57563
6,395
package com.quinn.framework.util.enums; /** * 消息发送:交换器类型 * * @author Qunhua.Liao * @since 2020-05-27 */ public enum ExchangeTypeEnum { // 交换器类型:订阅发送 - 有路由 TOPIC, // 直接发送 - 抢签 DIRECT, // 1 - N 无路由 FANOUT }
3e0f0ddbd22b05d3937356f42631359c49c262c6
21,754
java
Java
sources/android-28/java/io/DataInput.java
FTC-10161/FtcRobotController
ee6c7efdff947ccd0abfab64405a91176768e7c0
[ "MIT" ]
4,901
2015-01-02T09:29:18.000Z
2022-03-29T06:51:04.000Z
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/DataInput.java
1Crazymoney/j2objc
444f387445b3f22fd807b7c72eca484ea8823c8e
[ "Apache-2.0" ]
853
2015-01-03T08:13:19.000Z
2022-03-22T18:51:24.000Z
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/DataInput.java
1Crazymoney/j2objc
444f387445b3f22fd807b7c72eca484ea8823c8e
[ "Apache-2.0" ]
964
2015-01-08T08:52:00.000Z
2022-03-23T16:36:47.000Z
36.871186
79
0.600349
6,396
/* * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package java.io; /** * The {@code DataInput} interface provides * for reading bytes from a binary stream and * reconstructing from them data in any of * the Java primitive types. There is also * a * facility for reconstructing a {@code String} * from data in * <a href="#modified-utf-8">modified UTF-8</a> * format. * <p> * It is generally true of all the reading * routines in this interface that if end of * file is reached before the desired number * of bytes has been read, an {@code EOFException} * (which is a kind of {@code IOException}) * is thrown. If any byte cannot be read for * any reason other than end of file, an {@code IOException} * other than {@code EOFException} is * thrown. In particular, an {@code IOException} * may be thrown if the input stream has been * closed. * * <h3><a name="modified-utf-8">Modified UTF-8</a></h3> * <p> * Implementations of the DataInput and DataOutput interfaces represent * Unicode strings in a format that is a slight modification of UTF-8. * (For information regarding the standard UTF-8 format, see section * <i>3.9 Unicode Encoding Forms</i> of <i>The Unicode Standard, Version * 4.0</i>). * Note that in the following table, the most significant bit appears in the * far left-hand column. * * <blockquote> * <table border="1" cellspacing="0" cellpadding="8" * summary="Bit values and bytes"> * <tr> * <th colspan="9"><span style="font-weight:normal"> * All characters in the range {@code '\u005Cu0001'} to * {@code '\u005Cu007F'} are represented by a single byte:</span></th> * </tr> * <tr> * <td></td> * <th colspan="8" id="bit_a">Bit Values</th> * </tr> * <tr> * <th id="byte1_a">Byte 1</th> * <td><center>0</center> * <td colspan="7"><center>bits 6-0</center> * </tr> * <tr> * <th colspan="9"><span style="font-weight:normal"> * The null character {@code '\u005Cu0000'} and characters * in the range {@code '\u005Cu0080'} to {@code '\u005Cu07FF'} are * represented by a pair of bytes:</span></th> * </tr> * <tr> * <td></td> * <th colspan="8" id="bit_b">Bit Values</th> * </tr> * <tr> * <th id="byte1_b">Byte 1</th> * <td><center>1</center> * <td><center>1</center> * <td><center>0</center> * <td colspan="5"><center>bits 10-6</center> * </tr> * <tr> * <th id="byte2_a">Byte 2</th> * <td><center>1</center> * <td><center>0</center> * <td colspan="6"><center>bits 5-0</center> * </tr> * <tr> * <th colspan="9"><span style="font-weight:normal"> * {@code char} values in the range {@code '\u005Cu0800'} * to {@code '\u005CuFFFF'} are represented by three bytes:</span></th> * </tr> * <tr> * <td></td> * <th colspan="8"id="bit_c">Bit Values</th> * </tr> * <tr> * <th id="byte1_c">Byte 1</th> * <td><center>1</center> * <td><center>1</center> * <td><center>1</center> * <td><center>0</center> * <td colspan="4"><center>bits 15-12</center> * </tr> * <tr> * <th id="byte2_b">Byte 2</th> * <td><center>1</center> * <td><center>0</center> * <td colspan="6"><center>bits 11-6</center> * </tr> * <tr> * <th id="byte3">Byte 3</th> * <td><center>1</center> * <td><center>0</center> * <td colspan="6"><center>bits 5-0</center> * </tr> * </table> * </blockquote> * <p> * The differences between this format and the * standard UTF-8 format are the following: * <ul> * <li>The null byte {@code '\u005Cu0000'} is encoded in 2-byte format * rather than 1-byte, so that the encoded strings never have * embedded nulls. * <li>Only the 1-byte, 2-byte, and 3-byte formats are used. * <li><a href="../lang/Character.html#unicode">Supplementary characters</a> * are represented in the form of surrogate pairs. * </ul> * @author Frank Yellin * @see java.io.DataInputStream * @see java.io.DataOutput * @since JDK1.0 */ public interface DataInput { /** * Reads some bytes from an input * stream and stores them into the buffer * array {@code b}. The number of bytes * read is equal * to the length of {@code b}. * <p> * This method blocks until one of the * following conditions occurs: * <ul> * <li>{@code b.length} * bytes of input data are available, in which * case a normal return is made. * * <li>End of * file is detected, in which case an {@code EOFException} * is thrown. * * <li>An I/O error occurs, in * which case an {@code IOException} other * than {@code EOFException} is thrown. * </ul> * <p> * If {@code b} is {@code null}, * a {@code NullPointerException} is thrown. * If {@code b.length} is zero, then * no bytes are read. Otherwise, the first * byte read is stored into element {@code b[0]}, * the next one into {@code b[1]}, and * so on. * If an exception is thrown from * this method, then it may be that some but * not all bytes of {@code b} have been * updated with data from the input stream. * * @param b the buffer into which the data is read. * @exception EOFException if this stream reaches the end before reading * all the bytes. * @exception IOException if an I/O error occurs. */ void readFully(byte b[]) throws IOException; /** * * Reads {@code len} * bytes from * an input stream. * <p> * This method * blocks until one of the following conditions * occurs: * <ul> * <li>{@code len} bytes * of input data are available, in which case * a normal return is made. * * <li>End of file * is detected, in which case an {@code EOFException} * is thrown. * * <li>An I/O error occurs, in * which case an {@code IOException} other * than {@code EOFException} is thrown. * </ul> * <p> * If {@code b} is {@code null}, * a {@code NullPointerException} is thrown. * If {@code off} is negative, or {@code len} * is negative, or {@code off+len} is * greater than the length of the array {@code b}, * then an {@code IndexOutOfBoundsException} * is thrown. * If {@code len} is zero, * then no bytes are read. Otherwise, the first * byte read is stored into element {@code b[off]}, * the next one into {@code b[off+1]}, * and so on. The number of bytes read is, * at most, equal to {@code len}. * * @param b the buffer into which the data is read. * @param off an int specifying the offset into the data. * @param len an int specifying the number of bytes to read. * @exception EOFException if this stream reaches the end before reading * all the bytes. * @exception IOException if an I/O error occurs. */ void readFully(byte b[], int off, int len) throws IOException; /** * Makes an attempt to skip over * {@code n} bytes * of data from the input * stream, discarding the skipped bytes. However, * it may skip * over some smaller number of * bytes, possibly zero. This may result from * any of a * number of conditions; reaching * end of file before {@code n} bytes * have been skipped is * only one possibility. * This method never throws an {@code EOFException}. * The actual * number of bytes skipped is returned. * * @param n the number of bytes to be skipped. * @return the number of bytes actually skipped. * @exception IOException if an I/O error occurs. */ int skipBytes(int n) throws IOException; /** * Reads one input byte and returns * {@code true} if that byte is nonzero, * {@code false} if that byte is zero. * This method is suitable for reading * the byte written by the {@code writeBoolean} * method of interface {@code DataOutput}. * * @return the {@code boolean} value read. * @exception EOFException if this stream reaches the end before reading * all the bytes. * @exception IOException if an I/O error occurs. */ boolean readBoolean() throws IOException; /** * Reads and returns one input byte. * The byte is treated as a signed value in * the range {@code -128} through {@code 127}, * inclusive. * This method is suitable for * reading the byte written by the {@code writeByte} * method of interface {@code DataOutput}. * * @return the 8-bit value read. * @exception EOFException if this stream reaches the end before reading * all the bytes. * @exception IOException if an I/O error occurs. */ byte readByte() throws IOException; /** * Reads one input byte, zero-extends * it to type {@code int}, and returns * the result, which is therefore in the range * {@code 0} * through {@code 255}. * This method is suitable for reading * the byte written by the {@code writeByte} * method of interface {@code DataOutput} * if the argument to {@code writeByte} * was intended to be a value in the range * {@code 0} through {@code 255}. * * @return the unsigned 8-bit value read. * @exception EOFException if this stream reaches the end before reading * all the bytes. * @exception IOException if an I/O error occurs. */ int readUnsignedByte() throws IOException; /** * Reads two input bytes and returns * a {@code short} value. Let {@code a} * be the first byte read and {@code b} * be the second byte. The value * returned * is: * <pre>{@code (short)((a << 8) | (b & 0xff)) * }</pre> * This method * is suitable for reading the bytes written * by the {@code writeShort} method of * interface {@code DataOutput}. * * @return the 16-bit value read. * @exception EOFException if this stream reaches the end before reading * all the bytes. * @exception IOException if an I/O error occurs. */ short readShort() throws IOException; /** * Reads two input bytes and returns * an {@code int} value in the range {@code 0} * through {@code 65535}. Let {@code a} * be the first byte read and * {@code b} * be the second byte. The value returned is: * <pre>{@code (((a & 0xff) << 8) | (b & 0xff)) * }</pre> * This method is suitable for reading the bytes * written by the {@code writeShort} method * of interface {@code DataOutput} if * the argument to {@code writeShort} * was intended to be a value in the range * {@code 0} through {@code 65535}. * * @return the unsigned 16-bit value read. * @exception EOFException if this stream reaches the end before reading * all the bytes. * @exception IOException if an I/O error occurs. */ int readUnsignedShort() throws IOException; /** * Reads two input bytes and returns a {@code char} value. * Let {@code a} * be the first byte read and {@code b} * be the second byte. The value * returned is: * <pre>{@code (char)((a << 8) | (b & 0xff)) * }</pre> * This method * is suitable for reading bytes written by * the {@code writeChar} method of interface * {@code DataOutput}. * * @return the {@code char} value read. * @exception EOFException if this stream reaches the end before reading * all the bytes. * @exception IOException if an I/O error occurs. */ char readChar() throws IOException; /** * Reads four input bytes and returns an * {@code int} value. Let {@code a-d} * be the first through fourth bytes read. The value returned is: * <pre>{@code * (((a & 0xff) << 24) | ((b & 0xff) << 16) | * ((c & 0xff) << 8) | (d & 0xff)) * }</pre> * This method is suitable * for reading bytes written by the {@code writeInt} * method of interface {@code DataOutput}. * * @return the {@code int} value read. * @exception EOFException if this stream reaches the end before reading * all the bytes. * @exception IOException if an I/O error occurs. */ int readInt() throws IOException; /** * Reads eight input bytes and returns * a {@code long} value. Let {@code a-h} * be the first through eighth bytes read. * The value returned is: * <pre>{@code * (((long)(a & 0xff) << 56) | * ((long)(b & 0xff) << 48) | * ((long)(c & 0xff) << 40) | * ((long)(d & 0xff) << 32) | * ((long)(e & 0xff) << 24) | * ((long)(f & 0xff) << 16) | * ((long)(g & 0xff) << 8) | * ((long)(h & 0xff))) * }</pre> * <p> * This method is suitable * for reading bytes written by the {@code writeLong} * method of interface {@code DataOutput}. * * @return the {@code long} value read. * @exception EOFException if this stream reaches the end before reading * all the bytes. * @exception IOException if an I/O error occurs. */ long readLong() throws IOException; /** * Reads four input bytes and returns * a {@code float} value. It does this * by first constructing an {@code int} * value in exactly the manner * of the {@code readInt} * method, then converting this {@code int} * value to a {@code float} in * exactly the manner of the method {@code Float.intBitsToFloat}. * This method is suitable for reading * bytes written by the {@code writeFloat} * method of interface {@code DataOutput}. * * @return the {@code float} value read. * @exception EOFException if this stream reaches the end before reading * all the bytes. * @exception IOException if an I/O error occurs. */ float readFloat() throws IOException; /** * Reads eight input bytes and returns * a {@code double} value. It does this * by first constructing a {@code long} * value in exactly the manner * of the {@code readLong} * method, then converting this {@code long} * value to a {@code double} in exactly * the manner of the method {@code Double.longBitsToDouble}. * This method is suitable for reading * bytes written by the {@code writeDouble} * method of interface {@code DataOutput}. * * @return the {@code double} value read. * @exception EOFException if this stream reaches the end before reading * all the bytes. * @exception IOException if an I/O error occurs. */ double readDouble() throws IOException; /** * Reads the next line of text from the input stream. * It reads successive bytes, converting * each byte separately into a character, * until it encounters a line terminator or * end of * file; the characters read are then * returned as a {@code String}. Note * that because this * method processes bytes, * it does not support input of the full Unicode * character set. * <p> * If end of file is encountered * before even one byte can be read, then {@code null} * is returned. Otherwise, each byte that is * read is converted to type {@code char} * by zero-extension. If the character {@code '\n'} * is encountered, it is discarded and reading * ceases. If the character {@code '\r'} * is encountered, it is discarded and, if * the following byte converts &#32;to the * character {@code '\n'}, then that is * discarded also; reading then ceases. If * end of file is encountered before either * of the characters {@code '\n'} and * {@code '\r'} is encountered, reading * ceases. Once reading has ceased, a {@code String} * is returned that contains all the characters * read and not discarded, taken in order. * Note that every character in this string * will have a value less than {@code \u005Cu0100}, * that is, {@code (char)256}. * * @return the next line of text from the input stream, * or {@code null} if the end of file is * encountered before a byte can be read. * @exception IOException if an I/O error occurs. */ String readLine() throws IOException; /** * Reads in a string that has been encoded using a * <a href="#modified-utf-8">modified UTF-8</a> * format. * The general contract of {@code readUTF} * is that it reads a representation of a Unicode * character string encoded in modified * UTF-8 format; this string of characters * is then returned as a {@code String}. * <p> * First, two bytes are read and used to * construct an unsigned 16-bit integer in * exactly the manner of the {@code readUnsignedShort} * method . This integer value is called the * <i>UTF length</i> and specifies the number * of additional bytes to be read. These bytes * are then converted to characters by considering * them in groups. The length of each group * is computed from the value of the first * byte of the group. The byte following a * group, if any, is the first byte of the * next group. * <p> * If the first byte of a group * matches the bit pattern {@code 0xxxxxxx} * (where {@code x} means "may be {@code 0} * or {@code 1}"), then the group consists * of just that byte. The byte is zero-extended * to form a character. * <p> * If the first byte * of a group matches the bit pattern {@code 110xxxxx}, * then the group consists of that byte {@code a} * and a second byte {@code b}. If there * is no byte {@code b} (because byte * {@code a} was the last of the bytes * to be read), or if byte {@code b} does * not match the bit pattern {@code 10xxxxxx}, * then a {@code UTFDataFormatException} * is thrown. Otherwise, the group is converted * to the character: * <pre>{@code (char)(((a & 0x1F) << 6) | (b & 0x3F)) * }</pre> * If the first byte of a group * matches the bit pattern {@code 1110xxxx}, * then the group consists of that byte {@code a} * and two more bytes {@code b} and {@code c}. * If there is no byte {@code c} (because * byte {@code a} was one of the last * two of the bytes to be read), or either * byte {@code b} or byte {@code c} * does not match the bit pattern {@code 10xxxxxx}, * then a {@code UTFDataFormatException} * is thrown. Otherwise, the group is converted * to the character: * <pre>{@code * (char)(((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F)) * }</pre> * If the first byte of a group matches the * pattern {@code 1111xxxx} or the pattern * {@code 10xxxxxx}, then a {@code UTFDataFormatException} * is thrown. * <p> * If end of file is encountered * at any time during this entire process, * then an {@code EOFException} is thrown. * <p> * After every group has been converted to * a character by this process, the characters * are gathered, in the same order in which * their corresponding groups were read from * the input stream, to form a {@code String}, * which is returned. * <p> * The {@code writeUTF} * method of interface {@code DataOutput} * may be used to write data that is suitable * for reading by this method. * @return a Unicode string. * @exception EOFException if this stream reaches the end * before reading all the bytes. * @exception IOException if an I/O error occurs. * @exception UTFDataFormatException if the bytes do not represent a * valid modified UTF-8 encoding of a string. */ String readUTF() throws IOException; }
3e0f0e97f19aed8b53f61e41be7664cd8025c458
2,037
java
Java
app/src/main/java/gr/plushost/prototypeapp/items/StoreCurrencyItem.java
lioutasb/CSCartApp
6617b9d0d943d3b53232a6372f8b5ac826734797
[ "Apache-2.0" ]
5
2016-03-28T20:09:04.000Z
2022-01-25T14:24:38.000Z
app/src/main/java/gr/plushost/prototypeapp/items/StoreCurrencyItem.java
lioutasb/CSCartApp
6617b9d0d943d3b53232a6372f8b5ac826734797
[ "Apache-2.0" ]
null
null
null
app/src/main/java/gr/plushost/prototypeapp/items/StoreCurrencyItem.java
lioutasb/CSCartApp
6617b9d0d943d3b53232a6372f8b5ac826734797
[ "Apache-2.0" ]
2
2019-04-27T14:56:56.000Z
2020-12-19T19:44:14.000Z
24.841463
74
0.665194
6,397
package gr.plushost.prototypeapp.items; import java.io.Serializable; /** * Created by billiout on 11/3/2015. */ public class StoreCurrencyItem implements Serializable { private String currency_code; private boolean is_default; private String currency_symbol; private String decimal_symbol; private String group_symbol; private int decimal_places; private String description; private boolean currency_symbol_right; public boolean isCurrency_symbol_right() { return currency_symbol_right; } public void setCurrency_symbol_right(boolean currency_symbol_right) { this.currency_symbol_right = currency_symbol_right; } public String getCurrency_symbol() { return currency_symbol; } public void setCurrency_symbol(String currency_symbol) { this.currency_symbol = currency_symbol; } public boolean isIs_default() { return is_default; } public void setIs_default(boolean is_default) { this.is_default = is_default; } public String getCurrency_code() { return currency_code; } public void setCurrency_code(String currency_code) { this.currency_code = currency_code; } public String getDecimal_symbol() { return decimal_symbol; } public void setDecimal_symbol(String decimal_symbol) { this.decimal_symbol = decimal_symbol; } public int getDecimal_places() { return decimal_places; } public void setDecimal_places(int decimal_places) { this.decimal_places = decimal_places; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getGroup_symbol() { return group_symbol; } public void setGroup_symbol(String group_symbol) { this.group_symbol = group_symbol; } }
3e0f0eb506c7eb6e6f0d25b3a1939e06ecb0b234
447
java
Java
src/main/java/dasniko/ozark/react/BookController.java
dasniko/ozark-react
0bac867f2ab98b6afc040804b60256e53ceba15a
[ "MIT" ]
48
2015-11-08T16:55:08.000Z
2020-04-18T03:32:45.000Z
src/main/java/dasniko/ozark/react/BookController.java
puttareddy/ozark-mvc-react
13619bef33cf68c9c1b2107ba85249143173054b
[ "MIT" ]
7
2016-02-10T16:32:24.000Z
2022-02-24T21:29:27.000Z
src/main/java/dasniko/ozark/react/BookController.java
puttareddy/ozark-mvc-react
13619bef33cf68c9c1b2107ba85249143173054b
[ "MIT" ]
13
2016-06-07T10:01:54.000Z
2020-06-26T14:58:29.000Z
17.192308
51
0.639821
6,398
package dasniko.ozark.react; import javax.inject.Inject; import javax.ws.rs.*; import java.util.List; /** * @author Niko Köbler, http://www.n-k.de, @dasniko */ @Path("/books.json") public class BookController { @Inject private BookService service; @GET public List<Book> getBooks() { return service.getBooks(); } @POST public List<Book> addBook(Book book) { return service.addBook(book); } }
3e0f0efd81f5a97dd09a04f260495a69b7ad705f
2,266
java
Java
gradle/wrapper/dists/gradle-2.2.1-all/c64ydeuardnfqctvr1gm30w53/gradle-2.2.1/src/core/org/gradle/api/internal/resources/StringBackedTextResource.java
bit-man/pushfish-android
5f4fcf56adf5a8cdb6f31d91c315bcd3b3dc93bc
[ "BSD-2-Clause" ]
158
2015-04-18T23:39:02.000Z
2021-07-01T18:28:29.000Z
gradle/wrapper/dists/gradle-2.2.1-all/c64ydeuardnfqctvr1gm30w53/gradle-2.2.1/src/core/org/gradle/api/internal/resources/StringBackedTextResource.java
bit-man/pushfish-android
5f4fcf56adf5a8cdb6f31d91c315bcd3b3dc93bc
[ "BSD-2-Clause" ]
31
2015-04-29T18:52:40.000Z
2020-06-29T19:25:24.000Z
gradle/wrapper/dists/gradle-2.2.1-all/c64ydeuardnfqctvr1gm30w53/gradle-2.2.1/src/core/org/gradle/api/internal/resources/StringBackedTextResource.java
bit-man/pushfish-android
5f4fcf56adf5a8cdb6f31d91c315bcd3b3dc93bc
[ "BSD-2-Clause" ]
32
2016-01-05T21:58:24.000Z
2021-06-21T21:56:34.000Z
30.213333
92
0.713592
6,399
/* * Copyright 2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gradle.api.internal.resources; import com.google.common.io.Files; import org.gradle.api.UncheckedIOException; import org.gradle.api.file.FileCollection; import org.gradle.api.internal.file.TemporaryFileProvider; import org.gradle.api.internal.tasks.DefaultTaskDependency; import org.gradle.api.resources.TextResource; import org.gradle.api.tasks.TaskDependency; import java.io.File; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.nio.charset.Charset; public class StringBackedTextResource implements TextResource { private final TemporaryFileProvider tempFileProvider; private final String string; public StringBackedTextResource(TemporaryFileProvider tempFileProvider, String string) { this.tempFileProvider = tempFileProvider; this.string = string; } public String asString() { return string; } public Reader asReader() { return new StringReader(string); } public File asFile(String charset) { File file = tempFileProvider.createTemporaryFile("string", ".txt", "resource"); try { Files.write(string, file, Charset.forName(charset)); } catch (IOException e) { throw new UncheckedIOException(e); } return file; } public File asFile() { return asFile(Charset.defaultCharset().name()); } public TaskDependency getBuildDependencies() { return new DefaultTaskDependency(); } public Object getInputProperties() { return string; } public FileCollection getInputFiles() { return null; } }
3e0f0fe432f681eb809e915b9da69c5fe3d18092
397
java
Java
src/main/java/it/davidenastri/dogs/DogsApplication.java
ltpitt/java-spring-boot-dogs-microservice
f434a7972a12771eb7870ee338c62351bf6ff913
[ "MIT" ]
null
null
null
src/main/java/it/davidenastri/dogs/DogsApplication.java
ltpitt/java-spring-boot-dogs-microservice
f434a7972a12771eb7870ee338c62351bf6ff913
[ "MIT" ]
null
null
null
src/main/java/it/davidenastri/dogs/DogsApplication.java
ltpitt/java-spring-boot-dogs-microservice
f434a7972a12771eb7870ee338c62351bf6ff913
[ "MIT" ]
null
null
null
24.8125
68
0.833753
6,400
package it.davidenastri.dogs; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootApplication @EnableEurekaClient public class DogsApplication { public static void main(String[] args) { SpringApplication.run(DogsApplication.class, args); } }
3e0f0ff85c1acc0cd3ef1e9a16300011f1dcb8cd
281
java
Java
YearI/SemesterII/Java/Assignments/code-week-2/PartTwo/P/Main.java
sudiptog81/ducscode
4a60fb6d9a5769f9c487d0a65e557632af469903
[ "MIT" ]
7
2020-03-18T09:17:03.000Z
2022-01-12T09:36:45.000Z
YearI/SemesterII/Java/Assignments/code-week-2/PartTwo/P/Main.java
gourabdas-88006/ducscode
19f047e02f43af430f904782850a66be32b0ff89
[ "MIT" ]
1
2020-08-27T10:33:00.000Z
2020-08-27T10:33:00.000Z
YearI/SemesterII/Java/Assignments/code-week-2/PartTwo/P/Main.java
gourabdas-88006/ducscode
19f047e02f43af430f904782850a66be32b0ff89
[ "MIT" ]
4
2020-04-23T14:52:03.000Z
2021-10-03T19:55:27.000Z
18.733333
45
0.523132
6,401
package P; import P1.*; import P2.*; public class Main { public static void main(String[] args) { TwoDim ref; ref = new TwoDim(1, 2); System.out.println(ref); ref = new ThreeDim(3, 4, 5); System.out.println(ref); } }
3e0f110d59d03c0f1b15f8bec59a2e5222ca6897
3,517
java
Java
Frontend/JSP/Java Web JSP Servlets Development and Database Design/QA_Pro/src/com/qapro/dao/QuestionDao.java
specter01wj/LAB-Udemy
9a81bbabc9f55e68f6cce68c50a6c3cae8ee426f
[ "MIT" ]
null
null
null
Frontend/JSP/Java Web JSP Servlets Development and Database Design/QA_Pro/src/com/qapro/dao/QuestionDao.java
specter01wj/LAB-Udemy
9a81bbabc9f55e68f6cce68c50a6c3cae8ee426f
[ "MIT" ]
89
2020-03-07T05:51:22.000Z
2022-03-02T15:52:45.000Z
Frontend/JSP/Java Web JSP Servlets Development and Database Design/QA_Pro/src/com/qapro/dao/QuestionDao.java
specter01wj/LAB-Udemy
9a81bbabc9f55e68f6cce68c50a6c3cae8ee426f
[ "MIT" ]
null
null
null
32.869159
130
0.705999
6,402
package com.qapro.dao; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Date; import java.util.List; import com.qapro.entity.EmailValidation; import com.qapro.entity.Question; import com.qapro.enums.VotingEnum; public class QuestionDao extends JavathlonJdbcTemplate<Question>{ private String insertQuestionSql = "INSERT INTO qapro.question (text,insert_date,is_active,asker_id,up_vote,down_vote)" +" VALUES (:text , :insert_date , :is_active , :asker_id , :up_vote , :down_vote )"; private String selectQuestionSql = "select id,text,insert_date,is_active,asker_id,up_vote,down_vote from question"; public Long insertQuestion(Question question) throws Exception{ SqlParameterValues values = new SqlParameterValues(); values.addValue("text", question.getText()); values.addValue("insert_date", new Date()); values.addValue("is_active", true); values.addValue("asker_id", question.getAskerId()); values.addValue("up_vote", 0L); values.addValue("down_vote", 0L); return this.insertItem(insertQuestionSql, values); } public Question getQuestionById(Long id) { String sql = selectQuestionSql + " where id = :question_id"; List<Question> questionList = this.getList(sql, new SqlParameterValues().addValue("question_id", id), new QuestionRowMapper()); if(questionList != null && questionList.size() > 0) return questionList.get(0); else return null; } public Question getQuestionByAskerId(Long id) { String sql = selectQuestionSql + " where asker_id = :asker_id"; List<Question> questionList = this.getList(sql, new SqlParameterValues().addValue("asker_id", id), new QuestionRowMapper()); if(questionList != null && questionList.size() > 0) return questionList.get(0); else return null; } public void voteQuestion(Long questionId, VotingEnum type) throws Exception { String upVoteSql = "UPDATE question SET up_vote = up_vote +1 where id = :question_id"; String downVoteSql = "UPDATE question SET down_vote = down_vote +1 where id = :question_id"; if(VotingEnum.UP == type) this.update(upVoteSql, new SqlParameterValues().addValue("question_id", questionId)); else if(VotingEnum.DOWN == type) this.update(downVoteSql, new SqlParameterValues().addValue("question_id", questionId)); } public static void main(String args[]){ try { QuestionDao questionDao = new QuestionDao(); Question question = new Question(); question.setText("What is the best resource for Java training?"); question.setAskerId(3L); questionDao.insertQuestion(question); // Question question2 = questionDao.getQuestionById(4L); // if(question2 != null) // System.out.println("question is: " + question2.getText()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } private class QuestionRowMapper implements SqlRowMapper<Question>{ public Question mapSqlToObject(ResultSet resultSet) throws SQLException { Question question = new Question(); question.setId(resultSet.getLong(1)); question.setText(resultSet.getString(2)); question.setInsertDate(resultSet.getDate(3)); question.setActive(resultSet.getBoolean(4)); question.setAskerId(resultSet.getLong(5)); question.setUpVote(resultSet.getLong(6)); question.setDownVote(resultSet.getLong(7)); return question; } } }
3e0f122e703d385d0555c10797bd55191dfd5a0e
3,013
java
Java
src/main/java/cz/etnetera/reesmo/controller/project/ProjectGroupsController.java
etnetera/reesmo
c588bd85cfdef32b39b794dd0e2f28c1b505cb1b
[ "Apache-2.0" ]
null
null
null
src/main/java/cz/etnetera/reesmo/controller/project/ProjectGroupsController.java
etnetera/reesmo
c588bd85cfdef32b39b794dd0e2f28c1b505cb1b
[ "Apache-2.0" ]
null
null
null
src/main/java/cz/etnetera/reesmo/controller/project/ProjectGroupsController.java
etnetera/reesmo
c588bd85cfdef32b39b794dd0e2f28c1b505cb1b
[ "Apache-2.0" ]
null
null
null
42.43662
169
0.825091
6,403
package cz.etnetera.reesmo.controller.project; import com.github.dandelion.datatables.core.ajax.DataSet; import com.github.dandelion.datatables.core.ajax.DatatablesCriterias; import com.github.dandelion.datatables.core.ajax.DatatablesResponse; import cz.etnetera.reesmo.controller.MenuActivityController; import cz.etnetera.reesmo.model.datatables.project.ProjectGroupDT; import cz.etnetera.reesmo.model.form.project.ProjectGroupCommand; import cz.etnetera.reesmo.model.mongodb.project.ProjectGroup; import cz.etnetera.reesmo.model.mongodb.user.Permission; import cz.etnetera.reesmo.repository.mongodb.project.ProjectGroupRepository; import cz.etnetera.reesmo.user.UserManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; @Controller public class ProjectGroupsController implements MenuActivityController { @Autowired private UserManager userManager; @Autowired private ProjectGroupRepository projectGroupRepository; @Override public String getActiveMenu() { return "projectGroups"; } @RequestMapping(value = "/project-groups", method = RequestMethod.GET) public String projectGroups() { return "page/projectGroup/projectGroups"; } @RequestMapping(value = "/dt/project-groups") public @ResponseBody DatatablesResponse<ProjectGroupDT> findAllForDataTables(HttpServletRequest request) { DatatablesCriterias criterias = DatatablesCriterias.getFromRequest(request); DataSet<ProjectGroupDT> projectGroups = projectGroupRepository.findWithDatatablesCriterias(criterias, userManager.isSuperadmin() ? null : userManager.requireUserId()); return DatatablesResponse.build(projectGroups, criterias); } @RequestMapping(value = "/project-group/create", method = RequestMethod.GET) public String createProjectGroup(Model model) { ProjectGroupCommand projectGroupCommand = new ProjectGroupCommand(); model.addAttribute("projectGroupCommand", projectGroupCommand); return "page/projectGroup/projectGroupCreate"; } @RequestMapping(value = "/project-group/create", method = RequestMethod.POST) public String createProjectGroup(@Valid ProjectGroupCommand projectGroupCommand, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return "page/projectGroup/projectGroupCreate"; } ProjectGroup projectGroup = new ProjectGroup(); projectGroupCommand.toProject(projectGroup); projectGroup.getUsers().put(userManager.requireUserId(), Permission.OWNER); projectGroupRepository.save(projectGroup); userManager.saveUserProjectsPermissions(userManager.requireUser()); return "redirect:/project-group/detail/" + projectGroup.getId(); } }
3e0f1270c9fd24585bb474e2ca9448004a061798
4,982
java
Java
aura-util/src/test/java/org/auraframework/test/perf/metrics/PerfRunsCollector.java
igor-sfdc/aura
c992320668964553311f6fa54072b59a79321828
[ "Apache-2.0" ]
1
2015-08-11T12:30:09.000Z
2015-08-11T12:30:09.000Z
aura-util/src/test/java/org/auraframework/test/perf/metrics/PerfRunsCollector.java
ShekharGadewar/aura
fb6322fe7cc11d56dbae6cdf08a5bcd9828f6dd5
[ "Apache-2.0" ]
1
2015-01-13T13:46:38.000Z
2015-01-13T13:46:38.000Z
aura-util/src/test/java/org/auraframework/test/perf/metrics/PerfRunsCollector.java
igor-sfdc/aura
c992320668964553311f6fa54072b59a79321828
[ "Apache-2.0" ]
null
null
null
37.179104
119
0.659374
6,404
/* * Copyright (C) 2013 salesforce.com, inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.auraframework.test.perf.metrics; import java.io.PrintStream; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.logging.Logger; import org.json.JSONException; import com.google.common.collect.ImmutableSortedSet; import com.google.common.collect.Lists; import com.google.common.collect.Sets; /** * Collects, analyzes and displays metrics data from multiple runs. */ public final class PerfRunsCollector { private static final Logger LOG = Logger.getLogger(PerfRunsCollector.class.getSimpleName()); private final List<PerfMetrics> allMetricsRuns = Lists.newArrayList(); public void addRun(PerfMetrics metrics) { allMetricsRuns.add(metrics); } /** * @return metrics for the run that more closely represents the median metrics, it returns a new PerfMetrics object * with extra info regarding the other runs in the set this run belongs to */ public PerfMetrics getMedianRun() throws JSONException { PerfMetrics medianMetrics = getMedianMetrics(); // find run with more metrics that match the median ones PerfMetrics bestMatch = null; int numSameBestMatch = -1; int medianRunNumber = -1; for (int i = 0; i < allMetricsRuns.size(); i++) { PerfMetrics metricsRun = allMetricsRuns.get(i); int numSame = metricsRun.numSame(medianMetrics); if (numSameBestMatch < numSame) { numSameBestMatch = numSame; bestMatch = metricsRun; medianRunNumber = i + 1; } } // store runs info by creating MedianPerfMetric for each metric PerfMetrics medianRunMetrics = new PerfMetrics(); for (String metricName : getAllMetricNamesSeen()) { List<PerfMetric> metricRuns = Lists.newArrayList(); for (PerfMetrics run : allMetricsRuns) { metricRuns.add(run.getNonnullMetric(metricName)); } medianRunMetrics.setMetric(new MedianPerfMetric(bestMatch.getNonnullMetric(metricName), metricRuns, medianRunNumber)); } // transfer info to the new metrics object that represents the median run medianRunMetrics.setDevToolsLog(bestMatch.getDevToolsLog()); medianRunMetrics.setJSProfilerData(bestMatch.getJSProfilerData()); medianRunMetrics.setHeapSnapshot(bestMatch.getHeapSnapshot()); LOG.info("median run was run " + medianRunNumber + '/' + allMetricsRuns.size()); return medianRunMetrics; } /** * @return the median metric from the runs */ public PerfMetrics getMedianMetrics() throws JSONException { PerfMetrics medianMetrics = new PerfMetrics(); for (String metricName : getAllMetricNamesSeen()) { List<PerfMetric> metricRuns = Lists.newArrayList(); for (PerfMetrics run : allMetricsRuns) { metricRuns.add(run.getNonnullMetric(metricName)); } medianMetrics.setMetric(getMedian(metricRuns)); } return medianMetrics; } private PerfMetric getMedian(List<PerfMetric> runs) throws JSONException { List<PerfMetric> sortedRuns = Lists.newArrayList(runs); Collections.sort(sortedRuns); PerfMetric medianMetric = sortedRuns.get((runs.size() - 1) / 2); return new MedianPerfMetric(medianMetric, runs, -1); } private Set<String> getAllMetricNamesSeen() { Set<String> metricNames = Sets.newHashSet(); for (PerfMetrics run : allMetricsRuns) { metricNames.addAll(run.getAllMetricNames()); } return ImmutableSortedSet.copyOf(metricNames); } // show: public void show(PrintStream out) { out.println("\nMetrics for " + allMetricsRuns.size() + " runs:"); for (String metricName : getAllMetricNamesSeen()) { show(out, metricName); } } private void show(PrintStream out, String metricName) { StringBuilder sb = new StringBuilder(metricName); sb.append(':'); for (PerfMetrics run : allMetricsRuns) { sb.append(' '); PerfMetric metric = run.getMetric(metricName); sb.append((metric != null) ? metric.getValue() : '-'); } out.println(sb); } }
3e0f12e5a3abaa63310f4d5bc8d54cb59091bde3
194
java
Java
loopme-sdk/src/main/java/com/loopme/xml/CompanionClickThrough.java
isabella232/android-united-sdk
fbc70e6ed937656614617b198d603df0166c9e82
[ "RSA-MD" ]
4
2019-01-15T12:03:57.000Z
2020-04-07T12:39:33.000Z
loopme-sdk/src/main/java/com/loopme/xml/CompanionClickThrough.java
loopme/android-united-sdk
c432b39781e23843ec933bd7b3e5c79d5bc7357c
[ "RSA-MD" ]
3
2018-11-21T10:12:10.000Z
2019-07-26T10:19:19.000Z
loopme-sdk/src/main/java/com/loopme/xml/CompanionClickThrough.java
isabella232/android-united-sdk
fbc70e6ed937656614617b198d603df0166c9e82
[ "RSA-MD" ]
3
2020-06-26T16:55:40.000Z
2022-02-19T10:16:50.000Z
13.857143
36
0.664948
6,405
package com.loopme.xml; import com.loopme.parser.xml.Text; public class CompanionClickThrough { @Text private String text; public String getText() { return text; } }
3e0f13afda868707ac70e180f4491ce4a07b2920
12,849
java
Java
elastic-job-lite-console/src/test/java/org/apache/shardingsphere/elasticjob/lite/console/dao/search/RDBJobEventSearchTest.java
xbkaishui/elastic-job
2862573d7964929be798075542a7018ae4693421
[ "Apache-2.0" ]
1
2020-06-29T14:09:12.000Z
2020-06-29T14:09:12.000Z
elastic-job-lite-console/src/test/java/org/apache/shardingsphere/elasticjob/lite/console/dao/search/RDBJobEventSearchTest.java
Mark-WJQ/shardingsphere-elasticjob-lite
16e376e23d0c3f7b2dac07fac984f9fa871d7a01
[ "Apache-2.0" ]
null
null
null
elastic-job-lite-console/src/test/java/org/apache/shardingsphere/elasticjob/lite/console/dao/search/RDBJobEventSearchTest.java
Mark-WJQ/shardingsphere-elasticjob-lite
16e376e23d0c3f7b2dac07fac984f9fa871d7a01
[ "Apache-2.0" ]
null
null
null
58.940367
174
0.733676
6,406
/* * 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.shardingsphere.elasticjob.lite.console.dao.search; import org.apache.shardingsphere.elasticjob.lite.console.dto.request.FindJobExecutionEventsRequest; import org.apache.shardingsphere.elasticjob.lite.console.dto.request.FindJobStatusTraceEventsRequest; import org.apache.shardingsphere.elasticjob.lite.console.service.EventTraceHistoryService; import org.apache.shardingsphere.elasticjob.lite.tracing.event.JobExecutionEvent; import org.apache.shardingsphere.elasticjob.lite.tracing.event.JobStatusTraceEvent; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Import; import org.springframework.data.domain.Page; import org.springframework.test.context.junit4.SpringRunner; import java.util.Date; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; @RunWith(SpringRunner.class) @SpringBootTest @Import(RDBJobEventSearchTestConfiguration.class) public final class RDBJobEventSearchTest { @Autowired private EventTraceHistoryService eventTraceHistoryService; @Test public void assertFindJobExecutionEventsWithPageSizeAndNumber() { Page<JobExecutionEvent> result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest()); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest(50, 1)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(50)); result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest(100, 5)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(100)); result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest(100, 6)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(0)); } @Test public void assertFindJobExecutionEventsWithErrorPageSizeAndNumber() { Page<JobExecutionEvent> result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest(-1, -1, null, null, null, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); } @Test public void assertFindJobExecutionEventsWithSort() { Page<JobExecutionEvent> result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest(10, 1, "jobName", "ASC", null, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); assertThat(result.getContent().get(0).getJobName(), is("test_job_1")); result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest(10, 1, "jobName", "DESC", null, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); assertThat(result.getContent().get(0).getJobName(), is("test_job_99")); } @Test public void assertFindJobExecutionEventsWithErrorSort() { Page<JobExecutionEvent> result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest(10, 1, "jobName", "ERROR_SORT", null, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); assertThat(result.getContent().get(0).getJobName(), is("test_job_1")); result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest(10, 1, "notExistField", "ASC", null, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); } @Test public void assertFindJobExecutionEventsWithTime() { Date now = new Date(); Date tenMinutesBefore = new Date(now.getTime() - 10 * 60 * 1000); Page<JobExecutionEvent> result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest(10, 1, null, null, tenMinutesBefore, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest(10, 1, null, null, now, null)); assertThat(result.getTotalElements(), is(0L)); assertThat(result.getContent().size(), is(0)); result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest(10, 1, null, null, null, tenMinutesBefore)); assertThat(result.getTotalElements(), is(0L)); assertThat(result.getContent().size(), is(0)); result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest(10, 1, null, null, null, now)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest(10, 1, null, null, tenMinutesBefore, now)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); } @Test public void assertFindJobExecutionEventsWithFields() { FindJobExecutionEventsRequest findJobExecutionEventsRequest = new FindJobExecutionEventsRequest(10, 1, null, null, null, null); findJobExecutionEventsRequest.setIsSuccess(true); Page<JobExecutionEvent> result = eventTraceHistoryService.findJobExecutionEvents(findJobExecutionEventsRequest); assertThat(result.getTotalElements(), is(250L)); assertThat(result.getContent().size(), is(10)); findJobExecutionEventsRequest.setIsSuccess(null); findJobExecutionEventsRequest.setJobName("test_job_1"); result = eventTraceHistoryService.findJobExecutionEvents(findJobExecutionEventsRequest); assertThat(result.getTotalElements(), is(1L)); assertThat(result.getContent().size(), is(1)); } @Test public void assertFindJobExecutionEventsWithErrorFields() { Page<JobExecutionEvent> result = eventTraceHistoryService.findJobExecutionEvents(new FindJobExecutionEventsRequest(10, 1)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); } @Test public void assertFindJobStatusTraceEventsWithPageSizeAndNumber() { Page<JobStatusTraceEvent> result = eventTraceHistoryService.findJobStatusTraceEvents(new FindJobStatusTraceEventsRequest(10, 1, null, null, null, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); result = eventTraceHistoryService.findJobStatusTraceEvents(new FindJobStatusTraceEventsRequest(50, 1, null, null, null, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(50)); result = eventTraceHistoryService.findJobStatusTraceEvents(new FindJobStatusTraceEventsRequest(100, 5, null, null, null, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(100)); result = eventTraceHistoryService.findJobStatusTraceEvents(new FindJobStatusTraceEventsRequest(100, 6, null, null, null, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(0)); } @Test public void assertFindJobStatusTraceEventsWithErrorPageSizeAndNumber() { Page<JobStatusTraceEvent> result = eventTraceHistoryService.findJobStatusTraceEvents(new FindJobStatusTraceEventsRequest(-1, -1)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); } @Test public void assertFindJobStatusTraceEventsWithSort() { Page<JobStatusTraceEvent> result = eventTraceHistoryService.findJobStatusTraceEvents(new FindJobStatusTraceEventsRequest(10, 1, "jobName", "ASC", null, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); assertThat(result.getContent().get(0).getJobName(), is("test_job_1")); result = eventTraceHistoryService.findJobStatusTraceEvents(new FindJobStatusTraceEventsRequest(10, 1, "jobName", "DESC", null, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); assertThat(result.getContent().get(0).getJobName(), is("test_job_99")); } @Test public void assertFindJobStatusTraceEventsWithErrorSort() { Page<JobStatusTraceEvent> result = eventTraceHistoryService.findJobStatusTraceEvents(new FindJobStatusTraceEventsRequest(10, 1, "jobName", "ERROR_SORT", null, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); assertThat(result.getContent().get(0).getJobName(), is("test_job_1")); result = eventTraceHistoryService.findJobStatusTraceEvents(new FindJobStatusTraceEventsRequest(10, 1, "notExistField", "ASC", null, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); } @Test public void assertFindJobStatusTraceEventsWithTime() { Date now = new Date(); Date tenMinutesBefore = new Date(now.getTime() - 10 * 60 * 1000); Page<JobStatusTraceEvent> result = eventTraceHistoryService.findJobStatusTraceEvents(new FindJobStatusTraceEventsRequest(10, 1, null, null, tenMinutesBefore, null)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); result = eventTraceHistoryService.findJobStatusTraceEvents(new FindJobStatusTraceEventsRequest(10, 1, null, null, now, null)); assertThat(result.getTotalElements(), is(0L)); assertThat(result.getContent().size(), is(0)); result = eventTraceHistoryService.findJobStatusTraceEvents(new FindJobStatusTraceEventsRequest(10, 1, null, null, null, tenMinutesBefore)); assertThat(result.getTotalElements(), is(0L)); assertThat(result.getContent().size(), is(0)); result = eventTraceHistoryService.findJobStatusTraceEvents(new FindJobStatusTraceEventsRequest(10, 1, null, null, null, now)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); result = eventTraceHistoryService.findJobStatusTraceEvents(new FindJobStatusTraceEventsRequest(10, 1, null, null, tenMinutesBefore, now)); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); } @Test public void assertFindJobStatusTraceEventsWithFields() { FindJobStatusTraceEventsRequest findJobStatusTraceEventsRequest = new FindJobStatusTraceEventsRequest(10, 1); findJobStatusTraceEventsRequest.setJobName("test_job_1"); Page<JobStatusTraceEvent> result = eventTraceHistoryService.findJobStatusTraceEvents(findJobStatusTraceEventsRequest); assertThat(result.getTotalElements(), is(1L)); assertThat(result.getContent().size(), is(1)); } @Test public void assertFindJobStatusTraceEventsWithErrorFields() { FindJobStatusTraceEventsRequest findJobStatusTraceEventsRequest = new FindJobStatusTraceEventsRequest(10, 1); Page<JobStatusTraceEvent> result = eventTraceHistoryService.findJobStatusTraceEvents(findJobStatusTraceEventsRequest); assertThat(result.getTotalElements(), is(500L)); assertThat(result.getContent().size(), is(10)); } }
3e0f1402b0dae5b211451a9b49574f7c9a1f995a
881
java
Java
user-management/src/main/java/com/splitter/user/UserManagement.java
gunaskr/splitter
0fb15247caf3ae9962133eca7ceb7195ff37cd67
[ "Apache-2.0" ]
null
null
null
user-management/src/main/java/com/splitter/user/UserManagement.java
gunaskr/splitter
0fb15247caf3ae9962133eca7ceb7195ff37cd67
[ "Apache-2.0" ]
1
2022-03-02T08:50:47.000Z
2022-03-02T08:50:47.000Z
user-management/src/main/java/com/splitter/user/UserManagement.java
gunaskr/splitter
0fb15247caf3ae9962133eca7ceb7195ff37cd67
[ "Apache-2.0" ]
null
null
null
27.53125
72
0.786606
6,407
package com.splitter.user; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import com.splitter.security.SecurityCommonsConfiguration; import com.splitter.user.converter.dto.UserDTOToUser; @SpringBootApplication @Import(SecurityCommonsConfiguration.class) @EnableDiscoveryClient public class UserManagement { public static void main(final String[] args) { SpringApplication.run(UserManagement.class, args); } @Bean public UserDTOToUser userConverter() { return new UserDTOToUser(); } @Bean public UserDTOToUser roomMateConverter() { return new UserDTOToUser(true); } }
3e0f16f374b649c2f6a11a739078027c8e00d5ce
7,935
java
Java
src/main/java/com/glaf/core/web/springmvc/SystemDictoryDefinitionController.java
gitee2008/crowd
dde77987c8045a7b819d2917a8f9ff08fcdb5d73
[ "Apache-2.0" ]
2
2017-10-20T12:29:56.000Z
2018-03-04T02:20:38.000Z
src/main/java/com/glaf/core/web/springmvc/SystemDictoryDefinitionController.java
gitee2008/crowd
dde77987c8045a7b819d2917a8f9ff08fcdb5d73
[ "Apache-2.0" ]
14
2019-11-13T03:15:50.000Z
2022-03-31T18:46:48.000Z
src/main/java/com/glaf/core/web/springmvc/SystemDictoryDefinitionController.java
gitee2008/crowd
dde77987c8045a7b819d2917a8f9ff08fcdb5d73
[ "Apache-2.0" ]
4
2018-08-14T04:40:43.000Z
2022-03-27T04:43:01.000Z
35.743243
111
0.705482
6,408
/* * 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 com.glaf.core.web.springmvc; import java.io.IOException; import java.util.*; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.bind.annotation.*; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.glaf.core.config.ViewProperties; import com.glaf.core.domain.DictoryDefinition; import com.glaf.core.service.DictoryDefinitionService; import com.glaf.core.util.*; @Controller("/sys/dictoryDefinition") @RequestMapping("/sys/dictoryDefinition") public class SystemDictoryDefinitionController { protected DictoryDefinitionService dictoryDefinitionService; protected final Logger logger = LoggerFactory.getLogger(getClass()); public SystemDictoryDefinitionController() { } @RequestMapping("/edit") public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) { RequestUtils.setRequestParameterToAttribute(request); Map<String, Object> params = RequestUtils.getParameterMap(request); Long nodeId = ParamUtils.getLong(params, "nodeId"); String target = request.getParameter("target"); if (StringUtils.isNotEmpty(target)) { Map<String, DictoryDefinition> defMap = new HashMap<String, DictoryDefinition>(); List<DictoryDefinition> list = dictoryDefinitionService.getDictoryDefinitions(0L, target); if (nodeId > 0) { List<DictoryDefinition> rows = dictoryDefinitionService.getDictoryDefinitions(nodeId, target); if (rows != null && !rows.isEmpty()) { for (DictoryDefinition d : rows) { defMap.put(d.getName(), d); } } } if (list != null && !list.isEmpty()) { if (list != null && !list.isEmpty()) { for (DictoryDefinition d : list) { if (defMap.get(d.getName()) != null) { DictoryDefinition m = defMap.get(d.getName()); d.setTitle(m.getTitle()); d.setRequired(m.getRequired()); } } } Collections.sort(list); request.setAttribute("list", list); } } String view = request.getParameter("view"); if (StringUtils.isNotEmpty(view)) { return new ModelAndView(view, modelMap); } String x_view = ViewProperties.getString("dictoryDefinition.edit"); if (StringUtils.isNotEmpty(x_view)) { return new ModelAndView(x_view, modelMap); } return new ModelAndView("/sys/dictory_definition/edit", modelMap); } @ResponseBody @RequestMapping("/json") public byte[] json(HttpServletRequest request) throws IOException { Map<String, Object> params = RequestUtils.getParameterMap(request); Long nodeId = ParamUtils.getLong(params, "nodeId"); String target = request.getParameter("target"); if (StringUtils.isNotEmpty(target)) { Map<String, DictoryDefinition> defMap = new HashMap<String, DictoryDefinition>(); List<DictoryDefinition> list = dictoryDefinitionService.getDictoryDefinitions(0L, target); if (nodeId > 0) { List<DictoryDefinition> rows = dictoryDefinitionService.getDictoryDefinitions(nodeId, target); if (rows != null && !rows.isEmpty()) { for (DictoryDefinition d : rows) { defMap.put(d.getName(), d); } } } if (list != null && !list.isEmpty()) { if (list != null && !list.isEmpty()) { for (DictoryDefinition d : list) { if (defMap.get(d.getName()) != null) { DictoryDefinition m = defMap.get(d.getName()); d.setTitle(m.getTitle()); d.setRequired(m.getRequired()); } } } Collections.sort(list); JSONObject result = new JSONObject(); JSONArray array = new JSONArray(); for (DictoryDefinition d : list) { array.add(d.toJsonObject()); } result.put("rows", array); logger.debug(result.toJSONString()); return result.toJSONString().getBytes("UTF-8"); } } return null; } @RequestMapping("/save") public ModelAndView save(HttpServletRequest request, ModelMap modelMap, DictoryDefinition dictoryDefinition) { Map<String, Object> params = RequestUtils.getParameterMap(request); logger.debug("params:" + params); String target = request.getParameter("target"); Long nodeId = ParamUtils.getLong(params, "nodeId"); if (StringUtils.isNotEmpty(target)) { List<DictoryDefinition> list = dictoryDefinitionService.getDictoryDefinitions(0L, target); if (list != null && !list.isEmpty()) { List<DictoryDefinition> rows = new ArrayList<DictoryDefinition>(); for (DictoryDefinition m : list) { String title = request.getParameter(m.getName() + "_title"); String required = request.getParameter(m.getName() + "_required"); if (StringUtils.isNotEmpty(title)) { DictoryDefinition model = new DictoryDefinition(); model.setName(m.getName()); model.setNodeId(nodeId); model.setTarget(target); model.setTitle(title); model.setType(m.getType()); model.setSort(m.getSort()); model.setColumnName(m.getColumnName()); model.setLength(m.getLength()); if (StringUtils.equals(required, "1") || StringUtils.equals(required, "on")) { model.setRequired(1); } rows.add(model); } } dictoryDefinitionService.saveAll(nodeId, target, rows); } } return this.edit(request, modelMap); } @ResponseBody @RequestMapping("/saveDictoryDefinition") public byte[] saveDictoryDefinition(HttpServletRequest request) { try { Map<String, Object> params = RequestUtils.getParameterMap(request); logger.debug("params:" + params); String target = request.getParameter("target"); Long nodeId = ParamUtils.getLong(params, "nodeId"); if (StringUtils.isNotEmpty(target)) { List<DictoryDefinition> list = dictoryDefinitionService.getDictoryDefinitions(0L, target); if (list != null && !list.isEmpty()) { List<DictoryDefinition> rows = new ArrayList<DictoryDefinition>(); for (DictoryDefinition m : list) { String title = request.getParameter(m.getName() + "_title"); String required = request.getParameter(m.getName() + "_required"); if (StringUtils.isNotEmpty(title)) { DictoryDefinition model = new DictoryDefinition(); model.setName(m.getName()); model.setNodeId(nodeId); model.setTarget(target); model.setTitle(title); model.setType(m.getType()); model.setSort(m.getSort()); model.setColumnName(m.getColumnName()); model.setLength(m.getLength()); if (StringUtils.equals(required, "1") || StringUtils.equals(required, "on")) { model.setRequired(1); } rows.add(model); } } dictoryDefinitionService.saveAll(nodeId, target, rows); } } return ResponseUtils.responseJsonResult(true); } catch (Exception ex) { } return ResponseUtils.responseJsonResult(false); } @javax.annotation.Resource public void setDictoryDefinitionService(DictoryDefinitionService dictoryDefinitionService) { this.dictoryDefinitionService = dictoryDefinitionService; } }
3e0f17069b47be40c155ece0716f142a4bf12e09
8,170
java
Java
gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/sql/compile/BaseJoinStrategy.java
xyxiaoyou/snappy-store
013ff282f888878cc99600e260ec1cde60112304
[ "Apache-2.0" ]
38
2016-01-04T01:31:40.000Z
2020-04-07T06:35:36.000Z
gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/sql/compile/BaseJoinStrategy.java
xyxiaoyou/snappy-store
013ff282f888878cc99600e260ec1cde60112304
[ "Apache-2.0" ]
261
2016-01-07T09:14:26.000Z
2019-12-05T10:15:56.000Z
gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/sql/compile/BaseJoinStrategy.java
xyxiaoyou/snappy-store
013ff282f888878cc99600e260ec1cde60112304
[ "Apache-2.0" ]
22
2016-03-09T05:47:09.000Z
2020-04-02T17:55:30.000Z
32.29249
87
0.740024
6,409
/* Derby - Class com.pivotal.gemfirexd.internal.impl.sql.compile.BaseJoinStrategy 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. */ /* * Changes for GemFireXD distributed data platform (some marked by "GemStone changes") * * Portions Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. * * 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. See accompanying * LICENSE file. */ package com.pivotal.gemfirexd.internal.impl.sql.compile; import com.pivotal.gemfirexd.internal.iapi.error.StandardException; import com.pivotal.gemfirexd.internal.iapi.reference.ClassName; import com.pivotal.gemfirexd.internal.iapi.services.compiler.MethodBuilder; import com.pivotal.gemfirexd.internal.iapi.services.loader.GeneratedMethod; import com.pivotal.gemfirexd.internal.iapi.services.sanity.SanityManager; import com.pivotal.gemfirexd.internal.iapi.sql.Activation; import com.pivotal.gemfirexd.internal.iapi.sql.compile.ExpressionClassBuilderInterface; import com.pivotal.gemfirexd.internal.iapi.sql.compile.JoinStrategy; import com.pivotal.gemfirexd.internal.iapi.sql.compile.Optimizable; import com.pivotal.gemfirexd.internal.iapi.sql.compile.OptimizablePredicateList; import com.pivotal.gemfirexd.internal.iapi.sql.dictionary.ConglomerateDescriptor; import com.pivotal.gemfirexd.internal.iapi.sql.dictionary.ConstraintDescriptor; import com.pivotal.gemfirexd.internal.iapi.sql.dictionary.DataDictionary; import com.pivotal.gemfirexd.internal.iapi.sql.dictionary.TableDescriptor; import com.pivotal.gemfirexd.internal.iapi.store.access.Qualifier; import com.pivotal.gemfirexd.internal.iapi.store.access.StaticCompiledOpenConglomInfo; import com.pivotal.gemfirexd.internal.iapi.store.access.TransactionController; import com.pivotal.gemfirexd.internal.iapi.util.PropertyUtil; import com.pivotal.gemfirexd.internal.impl.sql.compile.ExpressionClassBuilder; abstract class BaseJoinStrategy implements JoinStrategy { BaseJoinStrategy() { } /** @see JoinStrategy#bulkFetchOK */ public boolean bulkFetchOK() { return true; } /** @see JoinStrategy#ignoreBulkFetch */ public boolean ignoreBulkFetch() { return false; } /** * Push the first set of common arguments for obtaining a scan ResultSet from * ResultSetFactory. * The first 11 arguments are common for these ResultSet getters * <UL> * <LI> ResultSetFactory.getBulkTableScanResultSet * <LI> ResultSetFactory.getHashScanResultSet * <LI> ResultSetFactory.getTableScanResultSet * <LI> ResultSetFactory.getRaDependentTableScanResultSet * </UL> * @param tc * @param mb * @param innerTable * @param predList * @param acbi * @param resultRowAllocator * @throws StandardException */ void fillInScanArgs1( TransactionController tc, MethodBuilder mb, Optimizable innerTable, OptimizablePredicateList predList, ExpressionClassBuilderInterface acbi, MethodBuilder resultRowAllocator ) throws StandardException { boolean sameStartStopPosition = predList.sameStartStopPosition(); ExpressionClassBuilder acb = (ExpressionClassBuilder) acbi; long conglomNumber = innerTable.getTrulyTheBestAccessPath(). getConglomerateDescriptor(). getConglomerateNumber(); StaticCompiledOpenConglomInfo scoci = tc.getStaticCompiledConglomInfo(conglomNumber); acb.pushThisAsActivation(mb); mb.push(conglomNumber); mb.push(acb.addItem(scoci)); acb.pushMethodReference(mb, resultRowAllocator); mb.push(innerTable.getResultSetNumber()); predList.generateStartKey(acb, mb, innerTable); mb.push(predList.startOperator(innerTable)); if (! sameStartStopPosition) { predList.generateStopKey(acb, mb, innerTable); } else { mb.pushNull(ClassName.GeneratedMethod); } mb.push(predList.stopOperator(innerTable)); mb.push(sameStartStopPosition); predList.generateQualifiers(acb, mb, innerTable, true); mb.upCast(ClassName.Qualifier + "[][]"); } final void fillInScanArgs2(MethodBuilder mb, Optimizable innerTable, int bulkFetch, int colRefItem, int indexColItem, int lockMode, boolean tableLocked, int isolationLevel, //GemStone changes BEGIN boolean delayScanOpening, boolean optimizeForOffHeap, boolean indexAccessesBaseTable //GemStone changes END ) throws StandardException { mb.push(innerTable.getBaseTableName()); //User may have supplied optimizer overrides in the sql //Pass them onto execute phase so it can be shown in //run time statistics. if (innerTable.getProperties() != null) mb.push(PropertyUtil.sortProperties(innerTable.getProperties())); else mb.pushNull("java.lang.String"); ConglomerateDescriptor cd = innerTable.getTrulyTheBestAccessPath().getConglomerateDescriptor(); if (cd.isConstraint()) { DataDictionary dd = innerTable.getDataDictionary(); TableDescriptor td = innerTable.getTableDescriptor(); ConstraintDescriptor constraintDesc = dd.getConstraintDescriptor( td, cd.getUUID()); mb.push(constraintDesc.getConstraintName()); } else if (cd.isIndex()) { mb.push(cd.getConglomerateName()); } else { mb.pushNull("java.lang.String"); } // Whether or not the conglomerate is the backing index for a constraint mb.push(cd.isConstraint()); // tell it whether it's to open for update, which we should do if // it's an update or delete statement, or if it's the target // table of an updatable cursor. mb.push(innerTable.forUpdate()); mb.push(colRefItem); mb.push(indexColItem); mb.push(lockMode); mb.push(tableLocked); mb.push(isolationLevel); if (bulkFetch > 0) { mb.push(bulkFetch); } /* 1 row scans (avoiding 2nd next()) are * only meaningful for some join strategies. * (Only an issue for outer table, which currently * can only be nested loop, as avoidance of 2nd next * on inner table already factored in to join node.) */ if (validForOutermostTable()) { mb.push(innerTable.isOneRowScan()); } mb.push( innerTable.getTrulyTheBestAccessPath(). getCostEstimate().rowCount()); mb.push( innerTable.getTrulyTheBestAccessPath(). getCostEstimate().getEstimatedCost()); //GemStone changes BEGIN mb.push(delayScanOpening); mb.push(optimizeForOffHeap); mb.push(indexAccessesBaseTable); mb.push(innerTable.getTrulyTheBestAccessPath().getFlagSupportsMoveToNextKey()); //GemStone changes END } /** * @see JoinStrategy#isHashJoin */ public boolean isHashJoin() { return false; } /** * Can this join strategy be used on the * outermost table of a join. * * @return Whether or not this join strategy * can be used on the outermose table of a join. */ protected boolean validForOutermostTable() { return false; } }
3e0f185d527a7bb53c1b10637b773ac84786990e
2,570
java
Java
app/src/main/java/pl/maxmati/tobiasz/mmos/shopping/PendingOrder.java
marcmos/shopping
1582feeb4d7390e5a2b4b955fc68c60c13ca7fea
[ "MIT" ]
null
null
null
app/src/main/java/pl/maxmati/tobiasz/mmos/shopping/PendingOrder.java
marcmos/shopping
1582feeb4d7390e5a2b4b955fc68c60c13ca7fea
[ "MIT" ]
null
null
null
app/src/main/java/pl/maxmati/tobiasz/mmos/shopping/PendingOrder.java
marcmos/shopping
1582feeb4d7390e5a2b4b955fc68c60c13ca7fea
[ "MIT" ]
null
null
null
27.052632
132
0.608949
6,410
package pl.maxmati.tobiasz.mmos.shopping; import java.util.Date; /** * Created by mmos on 27.02.16. * * @author mmos */ public class PendingOrder { public static final int PRIORITY_LOW = -1; public static final int PRIORITY_NORMAL = 0; public static final int PRIORITY_HIGH = 1; private final Date creationDate; private final String user; private final String name; private final int priority; private final String description; private final Double price; private final int quantity; public PendingOrder(Date creationDate, String user, String name, int priority, String description, Double price, int quantity) { this.creationDate = creationDate; this.user = user; this.name = name; this.priority = priority; this.description = description; this.price = price; this.quantity = quantity; } public Date getCreationDate() { return creationDate; } public String getUser() { return user; } public String getName() { return name; } public int getPriority() { return priority; } public String getDescription() { return description; } public Double getPrice() { return price; } public int getQuantity() { return quantity; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PendingOrder that = (PendingOrder) o; if (priority != that.priority) return false; if (quantity != that.quantity) return false; if (!creationDate.equals(that.creationDate)) return false; if (!user.equals(that.user)) return false; if (!name.equals(that.name)) return false; if (description != null ? !description.equals(that.description) : that.description != null) return false; return !(price != null ? !price.equals(that.price) : that.price != null); } @Override public int hashCode() { int result = creationDate.hashCode(); result = 31 * result + user.hashCode(); result = 31 * result + name.hashCode(); result = 31 * result + priority; result = 31 * result + (description != null ? description.hashCode() : 0); result = 31 * result + (price != null ? price.hashCode() : 0); result = 31 * result + quantity; return result; } @Override public String toString() { return getName(); } }
3e0f18f0e6c9e896fdf9d38da745b08c04ad89e9
4,014
java
Java
x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/action/GetAutoscalingDecisionAction.java
a137872798/elasticsearch
293ff2f60eb1fce9af59d23692d783ad040e0654
[ "Apache-2.0" ]
3
2020-07-09T19:00:34.000Z
2020-07-09T19:01:20.000Z
x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/action/GetAutoscalingDecisionAction.java
a137872798/elasticsearch
293ff2f60eb1fce9af59d23692d783ad040e0654
[ "Apache-2.0" ]
3
2020-07-29T08:58:34.000Z
2020-07-31T19:03:50.000Z
x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/action/GetAutoscalingDecisionAction.java
a137872798/elasticsearch
293ff2f60eb1fce9af59d23692d783ad040e0654
[ "Apache-2.0" ]
1
2020-09-05T11:00:26.000Z
2020-09-05T11:00:26.000Z
32.901639
114
0.638764
6,411
/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ package org.elasticsearch.xpack.autoscaling.action; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.ActionType; import org.elasticsearch.action.support.master.AcknowledgedRequest; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContentObject; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.xpack.autoscaling.decision.AutoscalingDecisions; import java.io.IOException; import java.util.Map; import java.util.Objects; import java.util.SortedMap; import java.util.TreeMap; public class GetAutoscalingDecisionAction extends ActionType<GetAutoscalingDecisionAction.Response> { public static final GetAutoscalingDecisionAction INSTANCE = new GetAutoscalingDecisionAction(); public static final String NAME = "cluster:admin/autoscaling/get_autoscaling_decision"; private GetAutoscalingDecisionAction() { super(NAME, Response::new); } public static class Request extends AcknowledgedRequest<GetAutoscalingDecisionAction.Request> { public Request() { } public Request(final StreamInput in) throws IOException { super(in); } @Override public void writeTo(final StreamOutput out) throws IOException { super.writeTo(out); } @Override public ActionRequestValidationException validate() { return null; } @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; return true; } @Override public int hashCode() { return 0; } } public static class Response extends ActionResponse implements ToXContentObject { private final SortedMap<String, AutoscalingDecisions> decisions; public Response(final SortedMap<String, AutoscalingDecisions> decisions) { this.decisions = Objects.requireNonNull(decisions); } public Response(final StreamInput in) throws IOException { super(in); decisions = new TreeMap<>(in.readMap(StreamInput::readString, AutoscalingDecisions::new)); } @Override public void writeTo(final StreamOutput out) throws IOException { out.writeMap(decisions, StreamOutput::writeString, (o, decision) -> decision.writeTo(o)); } @Override public XContentBuilder toXContent(final XContentBuilder builder, final Params params) throws IOException { builder.startObject(); { builder.startArray("decisions"); { for (final Map.Entry<String, AutoscalingDecisions> decision : decisions.entrySet()) { builder.startObject(); { builder.field(decision.getKey(), decision.getValue()); } builder.endObject(); } } builder.endArray(); } builder.endObject(); return builder; } @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final Response response = (Response) o; return decisions.equals(response.decisions); } @Override public int hashCode() { return Objects.hash(decisions); } } }
3e0f1938752cc3727a2a3a476ed9a90beeba0f49
1,569
java
Java
src/emarket/ihm/objets/formulaire/ChampFichier.java
utarwyn/EMarket
4c30119faa203144eed31016018946e3e779a0bc
[ "MIT" ]
1
2021-01-13T16:10:32.000Z
2021-01-13T16:10:32.000Z
src/emarket/ihm/objets/formulaire/ChampFichier.java
utarwyn/EMarket
4c30119faa203144eed31016018946e3e779a0bc
[ "MIT" ]
null
null
null
src/emarket/ihm/objets/formulaire/ChampFichier.java
utarwyn/EMarket
4c30119faa203144eed31016018946e3e779a0bc
[ "MIT" ]
null
null
null
27.526316
82
0.751434
6,412
package emarket.ihm.objets.formulaire; import javax.imageio.ImageIO; import javax.swing.*; import javax.xml.bind.DatatypeConverter; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.util.Arrays; public class ChampFichier extends JButton implements ActionListener { private Champ champ; private JFileChooser fileChooser; public ChampFichier(Champ champ) { this.champ = champ; this.fileChooser = new JFileChooser(); this.fileChooser.setAcceptAllFileFilterUsed(false); this.fileChooser.addChoosableFileFilter(new ImageFilter()); this.fileChooser.setCurrentDirectory(new File(System.getProperty("user.home"))); this.setText("Choisissez un fichier"); this.addActionListener(this); } @Override public void actionPerformed(ActionEvent actionEvent) { int result = this.fileChooser.showOpenDialog(this); if (result == JFileChooser.APPROVE_OPTION) { File selectedFile = this.fileChooser.getSelectedFile(); this.setText(selectedFile.getName()); try { BufferedImage image = ImageIO.read(selectedFile); ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write(image, "PNG", out); this.champ.setValeur(DatatypeConverter.printBase64Binary(out.toByteArray())); if (this.champ.getPreviewPanel() != null) this.champ.getPreviewPanel().setImage(image); } catch (IOException e) { e.printStackTrace(); } } } }
3e0f193e5e89fc38b2eb77d704b42a25680fa0ab
1,411
java
Java
library/src/main/java/com/xsp/library/util/java/CharUtil.java
Xushaopeng0303/AndroidStudy
6ea1cf4c23cb9ea39c78e731a1989f05936b9ec7
[ "Apache-2.0" ]
1
2018-06-13T09:14:23.000Z
2018-06-13T09:14:23.000Z
library/src/main/java/com/xsp/library/util/java/CharUtil.java
Xushaopeng0303/AndroidStudy
6ea1cf4c23cb9ea39c78e731a1989f05936b9ec7
[ "Apache-2.0" ]
null
null
null
library/src/main/java/com/xsp/library/util/java/CharUtil.java
Xushaopeng0303/AndroidStudy
6ea1cf4c23cb9ea39c78e731a1989f05936b9ec7
[ "Apache-2.0" ]
null
null
null
30.021277
82
0.615875
6,413
package com.xsp.library.util.java; import android.text.TextUtils; import com.xsp.library.util.BaseUtil; /** * Char util */ public class CharUtil extends BaseUtil { /** * determine whether the character is Chinese,include * @param c character * @return return true if c is a character, else false */ public static boolean isChinese(char c) { Character.UnicodeBlock ub = Character.UnicodeBlock.of(c); return ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A || ub == Character.UnicodeBlock.GENERAL_PUNCTUATION || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS; } /** * calculate the number of Chinese characters in a string * @param strName string name * @return return the number of Chinese characters in a string */ public static int countChinese(String strName) { if (TextUtils.isEmpty(strName)) { return 0; } int count = 0; char[] ch = strName.toCharArray(); for (char c : ch) { if (isChinese(c)) { count++; } } return count; } }
3e0f197b7110ade6c246120e2225fb7d88282219
284
java
Java
controller/core/src/org/ah/gcc/rover/controllers/ControllerInterface.java
GamesCreatorsClub/GCC-Rover
25a69f62a1bb01fc421924ec39f180f50d6a640b
[ "MIT" ]
3
2018-02-13T21:39:55.000Z
2018-04-26T18:17:39.000Z
controller/core/src/org/ah/gcc/rover/controllers/ControllerInterface.java
GamesCreatorsClub/GCC-Rover
25a69f62a1bb01fc421924ec39f180f50d6a640b
[ "MIT" ]
null
null
null
controller/core/src/org/ah/gcc/rover/controllers/ControllerInterface.java
GamesCreatorsClub/GCC-Rover
25a69f62a1bb01fc421924ec39f180f50d6a640b
[ "MIT" ]
null
null
null
17.75
53
0.735915
6,414
/* * Copyright 2016-2017 Games Creators Club * * MIT License * */ package org.ah.gcc.rover.controllers; public interface ControllerInterface { void addListener(ControllerListener listener); void removeListener(ControllerListener listener); //boolean isActive(); }
3e0f1b3207d4119eb0e7f45684a5d94ee37d70d7
843
java
Java
src/main/java/com/senyang/boot/conf/MybatisConf.java
senYUh/JavaWebWork
7b4ec33282a1d8ee124abf8234c0415ed7ce4e6e
[ "Apache-2.0" ]
null
null
null
src/main/java/com/senyang/boot/conf/MybatisConf.java
senYUh/JavaWebWork
7b4ec33282a1d8ee124abf8234c0415ed7ce4e6e
[ "Apache-2.0" ]
null
null
null
src/main/java/com/senyang/boot/conf/MybatisConf.java
senYUh/JavaWebWork
7b4ec33282a1d8ee124abf8234c0415ed7ce4e6e
[ "Apache-2.0" ]
null
null
null
36.652174
90
0.790036
6,415
package com.senyang.boot.conf; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class MybatisConf { @Bean public MybatisPlusInterceptor interceptor(){ MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); //这是分页拦截器 PaginationInnerInterceptor pageInterceptor = new PaginationInnerInterceptor(); //pageInterceptor.setMaxLimit(500L);这是设置最大单页限制数量,默认500条,-1不受限制 //pageInterceptor.setOverflow(false);这是设置请求页面大于最大页后操作,true调回首页,false则继续请求,默认为false interceptor.addInnerInterceptor(pageInterceptor); return interceptor; } }
3e0f1b628746d79eef4ae01a905c0a457aa4b10d
2,344
java
Java
springmvc/src/main/java/cxc/entity/User.java
CuiXueChao/allLearn
f0147b47b610105fea2c5ab7fa597a7143fe1a37
[ "MIT" ]
null
null
null
springmvc/src/main/java/cxc/entity/User.java
CuiXueChao/allLearn
f0147b47b610105fea2c5ab7fa597a7143fe1a37
[ "MIT" ]
null
null
null
springmvc/src/main/java/cxc/entity/User.java
CuiXueChao/allLearn
f0147b47b610105fea2c5ab7fa597a7143fe1a37
[ "MIT" ]
null
null
null
20.928571
109
0.55802
6,416
package cxc.entity; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.stereotype.Component; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Map; /** * @author cxc * @date 2021/5/10 */ @Component public class User { private String name; private Integer age; private List<String> hobby; private Map<String, String> parents; private String[] nickname; private User user; @DateTimeFormat(pattern = "YYYY-MM-dd") private Date birthday; @Override public String toString() { return "User{" + "name='" + name + '\'' + ", age=" + age + ", hobby=" + hobby + ", parents=" + parents + ", nickname=" + Arrays.toString(nickname) + ", user=" + user + ", birthday=" + birthday + '}'; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } public User(String name, Integer age, List<String> hobby, Map<String, String> parents, String[] nickname, User user, Date birthday) { this.name = name; this.age = age; this.hobby = hobby; this.parents = parents; this.nickname = nickname; this.user = user; this.birthday = birthday; } public User() { } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public List<String> getHobby() { return hobby; } public void setHobby(List<String> hobby) { this.hobby = hobby; } public Map<String, String> getParents() { return parents; } public void setParents(Map<String, String> parents) { this.parents = parents; } public String[] getNickname() { return nickname; } public void setNickname(String[] nickname) { this.nickname = nickname; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } }
3e0f1befd93bb6355d868e4265cc9039e89f6f7b
1,949
java
Java
lib/src/main/java/org/rookit/failsafe/string/BaseStringFailsafe.java
JPDSousa/rookit-failsafe
fe6993ee841031f0a124a84f4190bd77fdc1a82a
[ "MIT" ]
null
null
null
lib/src/main/java/org/rookit/failsafe/string/BaseStringFailsafe.java
JPDSousa/rookit-failsafe
fe6993ee841031f0a124a84f4190bd77fdc1a82a
[ "MIT" ]
1
2017-12-29T09:59:55.000Z
2018-01-06T19:08:47.000Z
lib/src/main/java/org/rookit/failsafe/string/BaseStringFailsafe.java
JPDSousa/rookit-failsafe
fe6993ee841031f0a124a84f4190bd77fdc1a82a
[ "MIT" ]
1
2022-03-03T13:33:48.000Z
2022-03-03T13:33:48.000Z
45.325581
92
0.699846
6,417
/******************************************************************************* * Copyright (C) 2018 Joao Sousa * * 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 org.rookit.failsafe.string; import org.apache.commons.lang3.StringUtils; import org.rookit.failsafe.ObjectFailsafe; import org.rookit.failsafe.StringFailsafe; import org.rookit.failsafe.object.DelegateObjectFailsafe; import org.slf4j.Logger; final class BaseStringFailsafe extends DelegateObjectFailsafe implements StringFailsafe { BaseStringFailsafe(final ObjectFailsafe delegate) { super(delegate); } @Override public <T> T isNotBlank(final Logger logger, final String object, final String name) { isNotNull(logger, object, name); return is(logger, StringUtils.isNotBlank(object), "The %s must not be blank", name); } }
3e0f1c3871b8861d388bccbc9429c9fecf6f2e47
916
java
Java
src/main/java/org/springframework/data/tarantool/core/convert/TarantoolMapTypeAliasAccessor.java
selevinia/spring-data-tarantool
edadd70e6b98bb8a4612f7c017c0cdb58be02143
[ "Apache-2.0" ]
null
null
null
src/main/java/org/springframework/data/tarantool/core/convert/TarantoolMapTypeAliasAccessor.java
selevinia/spring-data-tarantool
edadd70e6b98bb8a4612f7c017c0cdb58be02143
[ "Apache-2.0" ]
null
null
null
src/main/java/org/springframework/data/tarantool/core/convert/TarantoolMapTypeAliasAccessor.java
selevinia/spring-data-tarantool
edadd70e6b98bb8a4612f7c017c0cdb58be02143
[ "Apache-2.0" ]
null
null
null
27.757576
94
0.734716
6,418
package org.springframework.data.tarantool.core.convert; import org.springframework.data.convert.TypeAliasAccessor; import org.springframework.data.mapping.Alias; import org.springframework.util.Assert; import java.util.Map; /** * Actually reads and writes type alias into a nested object in tuple * * @author Tatiana Blinova */ public class TarantoolMapTypeAliasAccessor implements TypeAliasAccessor<Map<String, Object>> { private final String typeKey; public TarantoolMapTypeAliasAccessor(final String typeKey) { Assert.notNull(typeKey, "TypeKey for TypeAliasAccessor must not be null"); this.typeKey = typeKey; } @Override public Alias readAliasFrom(Map<String, Object> source) { return Alias.ofNullable(source.get(typeKey)); } @Override public void writeTypeTo(Map<String, Object> sink, Object alias) { sink.put(typeKey, alias); } }
3e0f1ce5f410dfcc973245563cc9da924f536f40
699
java
Java
app/src/main/java/com/llc/android_coolview/paul/control/task/NbaRegularSeasonScheduleResultThread.java
AppleNet/Android_CoolView
afb3667a0d910344b83267f381fa8f01af5915ba
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/llc/android_coolview/paul/control/task/NbaRegularSeasonScheduleResultThread.java
AppleNet/Android_CoolView
afb3667a0d910344b83267f381fa8f01af5915ba
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/llc/android_coolview/paul/control/task/NbaRegularSeasonScheduleResultThread.java
AppleNet/Android_CoolView
afb3667a0d910344b83267f381fa8f01af5915ba
[ "Apache-2.0" ]
null
null
null
24.103448
74
0.806867
6,419
package com.llc.android_coolview.paul.control.task; import com.llc.android_coolview.paul.control.PaulManager; import com.llc.android_coolview.paul.view.activity.NBAGamesSpreadActivity; import android.os.Handler; import android.os.Message; public class NbaRegularSeasonScheduleResultThread extends Thread { private Handler handler; public NbaRegularSeasonScheduleResultThread(Handler handler){ this.handler=handler; } @Override public void run() { super.run(); String result=PaulManager.getNbaRegularSeasonScheduleResult(); Message msg=new Message(); msg.what=NBAGamesSpreadActivity.THE_NBA_REGULAR_SEASON_SCHEDULE_RESULT; msg.obj=result; handler.sendMessage(msg); } }
3e0f1d0033d7e2290f6b08456e0b17a5490bc363
4,514
java
Java
src/integration-test/java/com/rsegeda/moneytransfer/Utils.java
rsegeda/money-transfer
dc6c0ef8c436542223c54b23029e013210f8f263
[ "MIT" ]
null
null
null
src/integration-test/java/com/rsegeda/moneytransfer/Utils.java
rsegeda/money-transfer
dc6c0ef8c436542223c54b23029e013210f8f263
[ "MIT" ]
null
null
null
src/integration-test/java/com/rsegeda/moneytransfer/Utils.java
rsegeda/money-transfer
dc6c0ef8c436542223c54b23029e013210f8f263
[ "MIT" ]
null
null
null
35.825397
118
0.690075
6,420
/* Created by Roman Segeda on 01 September 2019 */ package com.rsegeda.moneytransfer; import com.rsegeda.moneytransfer.controller.dto.AccountDto; import com.rsegeda.moneytransfer.controller.response.BodyResponse; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.lang.reflect.Type; import java.math.BigDecimal; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.UUID; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; class Utils { static String HOST_ADDRESS = "http://localhost:4567"; static String createAccountAndUpdateCleanupList(List<String> listToCleanup) throws IOException { String body = "{\n" + " \"ownerUuid\": \"" + UUID.randomUUID() + "\",\n" + " \"balance\": 100000\n" + "}"; String uuidOfCreatedAccount = createAccount(body); listToCleanup.add(uuidOfCreatedAccount); return uuidOfCreatedAccount; } static String createAccountAndUpdateCleanupList(List<String> listToCleanup, BigDecimal balance) throws IOException { String body = "{\n" + " \"ownerUuid\": \"" + UUID.randomUUID() + "\",\n" + " \"balance\": " + balance + "\n" + "}"; String uuidOfCreatedAccount = createAccount(body); listToCleanup.add(uuidOfCreatedAccount); return uuidOfCreatedAccount; } static String createAccountToDelete() throws IOException { String body = "{\n" + " \"ownerUuid\": \"" + UUID.randomUUID() + "\",\n" + " \"balance\": 100000\n" + "}"; return createAccount(body); } static String createAccountToPut(UUID ownerUUID, BigDecimal balance, List<String> accountsToCleanup) throws IOException { String body = "{\n" + " \"ownerUuid\": \"" + ownerUUID + "\",\n" + " \"balance\": " + balance + "\n" + "}"; String uuid = createAccount(body); accountsToCleanup.add(uuid); return uuid; } private static String createAccount(String body) throws IOException { HttpPost request = new HttpPost(HOST_ADDRESS + "/accounts"); request.setEntity(new StringEntity(body)); request.setHeader("Accept", "application/json"); request.setHeader("Content-type", "application/json"); HttpResponse httpResponse = HttpClientBuilder.create().build().execute(request); return parseBodyResponseToAccountDto( parseHttpResponseToBodyResponse(httpResponse)) .getUuid().toString(); } static BodyResponse parseHttpResponseToBodyResponse(HttpResponse response) throws IOException { String jsonFromResponse = EntityUtils.toString(response.getEntity()); return new Gson().fromJson(jsonFromResponse, BodyResponse.class); } static AccountDto parseBodyResponseToAccountDto(BodyResponse bodyResponse) { return new Gson().fromJson(bodyResponse.getData(), AccountDto.class); } static Set<AccountDto> parseBodyResponseToAccountDtoList(BodyResponse bodyResponse) { Type accountSetType = new TypeToken<HashSet<AccountDto>>() { }.getType(); return new Gson().fromJson(bodyResponse.getData(), accountSetType); } static HttpPost buildTransferRequest(String senderUuid, String receiverUuid, BigDecimal sum) throws UnsupportedEncodingException { String body = "{\n" + " \"sender\": \"" + senderUuid + "\",\n" + " \"receiver\": \"" + receiverUuid + "\",\n" + " \"sum\": " + sum + "\n" + "}"; HttpPost request = new HttpPost(HOST_ADDRESS + "/transfers"); request.setEntity(new StringEntity(body)); request.setHeader("Accept", "application/json"); request.setHeader("Content-type", "application/json"); return request; } static AccountDto fetchAccount(String receiverUuid) throws IOException { HttpUriRequest getRequest = new HttpGet(HOST_ADDRESS + "/accounts/" + receiverUuid); HttpResponse httpResponse = HttpClientBuilder.create().build().execute(getRequest); BodyResponse bodyResponse = parseHttpResponseToBodyResponse(httpResponse); return parseBodyResponseToAccountDto(bodyResponse); } }
3e0f1d24b13844f6d9e9d92896e1a403a3f53440
300
java
Java
HomeWork05-annotations/src/main/java/ru/otus/homework05/testframework/api/Test.java
poljak181/otus_java
abf0ca4adfac30c0a341febc0def921d309c80f2
[ "MIT" ]
null
null
null
HomeWork05-annotations/src/main/java/ru/otus/homework05/testframework/api/Test.java
poljak181/otus_java
abf0ca4adfac30c0a341febc0def921d309c80f2
[ "MIT" ]
null
null
null
HomeWork05-annotations/src/main/java/ru/otus/homework05/testframework/api/Test.java
poljak181/otus_java
abf0ca4adfac30c0a341febc0def921d309c80f2
[ "MIT" ]
null
null
null
25
45
0.83
6,421
package ru.otus.homework05.testframework.api; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface Test { }
3e0f1d3c47d92f9d1967fe19573fc4bfe30aed9d
2,849
java
Java
BusinessCardScan.Mobile/obj/Debug/net6.0-android/android/src/crc64192d9de59b079c6d/SingleLocationListener.java
antoniocorreia/business-card-scan
1f7621aef162cf8893bb33f790c02a3fd0eeaa6e
[ "Apache-2.0" ]
null
null
null
BusinessCardScan.Mobile/obj/Debug/net6.0-android/android/src/crc64192d9de59b079c6d/SingleLocationListener.java
antoniocorreia/business-card-scan
1f7621aef162cf8893bb33f790c02a3fd0eeaa6e
[ "Apache-2.0" ]
null
null
null
BusinessCardScan.Mobile/obj/Debug/net6.0-android/android/src/crc64192d9de59b079c6d/SingleLocationListener.java
antoniocorreia/business-card-scan
1f7621aef162cf8893bb33f790c02a3fd0eeaa6e
[ "Apache-2.0" ]
null
null
null
33.517647
245
0.779572
6,422
package crc64192d9de59b079c6d; public class SingleLocationListener extends java.lang.Object implements mono.android.IGCUserPeer, android.location.LocationListener { /** @hide */ public static final String __md_methods; static { __md_methods = "n_onLocationChanged:(Landroid/location/Location;)V:GetOnLocationChanged_Landroid_location_Location_Handler:Android.Locations.ILocationListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" + "n_onProviderDisabled:(Ljava/lang/String;)V:GetOnProviderDisabled_Ljava_lang_String_Handler:Android.Locations.ILocationListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" + "n_onProviderEnabled:(Ljava/lang/String;)V:GetOnProviderEnabled_Ljava_lang_String_Handler:Android.Locations.ILocationListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" + "n_onStatusChanged:(Ljava/lang/String;ILandroid/os/Bundle;)V:GetOnStatusChanged_Ljava_lang_String_ILandroid_os_Bundle_Handler:Android.Locations.ILocationListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" + "n_onFlushComplete:(I)V:GetOnFlushComplete_IHandler:Android.Locations.ILocationListener, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" + ""; mono.android.Runtime.register ("Microsoft.Maui.Essentials.SingleLocationListener, Microsoft.Maui.Essentials", SingleLocationListener.class, __md_methods); } public SingleLocationListener () { super (); if (getClass () == SingleLocationListener.class) mono.android.TypeManager.Activate ("Microsoft.Maui.Essentials.SingleLocationListener, Microsoft.Maui.Essentials", "", this, new java.lang.Object[] { }); } public void onLocationChanged (android.location.Location p0) { n_onLocationChanged (p0); } private native void n_onLocationChanged (android.location.Location p0); public void onProviderDisabled (java.lang.String p0) { n_onProviderDisabled (p0); } private native void n_onProviderDisabled (java.lang.String p0); public void onProviderEnabled (java.lang.String p0) { n_onProviderEnabled (p0); } private native void n_onProviderEnabled (java.lang.String p0); public void onStatusChanged (java.lang.String p0, int p1, android.os.Bundle p2) { n_onStatusChanged (p0, p1, p2); } private native void n_onStatusChanged (java.lang.String p0, int p1, android.os.Bundle p2); public void onFlushComplete (int p0) { n_onFlushComplete (p0); } private native void n_onFlushComplete (int p0); private java.util.ArrayList refList; public void monodroidAddReference (java.lang.Object obj) { if (refList == null) refList = new java.util.ArrayList (); refList.add (obj); } public void monodroidClearReferences () { if (refList != null) refList.clear (); } }
3e0f1d9f9a84f4c20d361027286de43dec560e91
15,473
java
Java
src/org/jitsi/impl/neomedia/codec/FMJPlugInConfiguration.java
bbaldino/libjitsi
89f38dd634bafedec0b435ea1e3e0cfa8d002518
[ "Apache-2.0" ]
3
2019-03-06T09:34:13.000Z
2020-06-01T16:15:57.000Z
src/org/jitsi/impl/neomedia/codec/FMJPlugInConfiguration.java
matteocampana/libjitsi
60d4c716823d8b39b029f99d0dff80fc68b3a2a4
[ "Apache-2.0" ]
null
null
null
src/org/jitsi/impl/neomedia/codec/FMJPlugInConfiguration.java
matteocampana/libjitsi
60d4c716823d8b39b029f99d0dff80fc68b3a2a4
[ "Apache-2.0" ]
1
2021-04-09T13:39:26.000Z
2021-04-09T13:39:26.000Z
34.849099
80
0.527241
6,423
/* * Copyright @ 2015 Atlassian Pty Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jitsi.impl.neomedia.codec; import java.io.*; import java.util.*; import javax.media.*; import org.jitsi.impl.neomedia.*; import org.jitsi.util.*; /** * Utility class that handles registration of FMJ packages and plugins. * * @author Damian Minkov * @author Lyubomir Marinov * @author Boris Grozev */ public class FMJPlugInConfiguration { /** * Whether the custom codecs have been registered with FMJ. */ private static boolean codecsRegistered = false; /** * Whether the custom multiplexers have been registered with FMJ. */ private static boolean multiplexersRegistered = false; /** * The additional custom JMF codecs. */ private static final String[] CUSTOM_CODECS = { // "org.jitsi.impl.neomedia.codec.AndroidMediaCodec", OSUtils.IS_ANDROID ? "org.jitsi.impl.neomedia.codec.video.AndroidEncoder" : null, OSUtils.IS_ANDROID ? "org.jitsi.impl.neomedia.codec.video.AndroidDecoder" : null, "org.jitsi.impl.neomedia.codec.audio.alaw.DePacketizer", "org.jitsi.impl.neomedia.codec.audio.alaw.JavaEncoder", "org.jitsi.impl.neomedia.codec.audio.alaw.Packetizer", "org.jitsi.impl.neomedia.codec.audio.ulaw.JavaDecoder", "org.jitsi.impl.neomedia.codec.audio.ulaw.JavaEncoder", "org.jitsi.impl.neomedia.codec.audio.ulaw.Packetizer", "org.jitsi.impl.neomedia.codec.audio.opus.JNIDecoder", "org.jitsi.impl.neomedia.codec.audio.opus.JNIEncoder", "org.jitsi.impl.neomedia.codec.audio.speex.JNIDecoder", "org.jitsi.impl.neomedia.codec.audio.speex.JNIEncoder", "org.jitsi.impl.neomedia.codec.audio.speex.SpeexResampler", // MP3 "org.jitsi.impl.neomedia.codec.audio.mp3.JNIEncoder", "org.jitsi.impl.neomedia.codec.audio.ilbc.JavaDecoder", "org.jitsi.impl.neomedia.codec.audio.ilbc.JavaEncoder", EncodingConfigurationImpl.G729 ? "org.jitsi.impl.neomedia.codec.audio.g729.JavaDecoder" : null, EncodingConfigurationImpl.G729 ? "org.jitsi.impl.neomedia.codec.audio.g729.JavaEncoder" : null, "org.jitsi.impl.neomedia.codec.audio.g722.JNIDecoderImpl", "org.jitsi.impl.neomedia.codec.audio.g722.JNIEncoderImpl", "org.jitsi.impl.neomedia.codec.audio.gsm.Decoder", "org.jitsi.impl.neomedia.codec.audio.gsm.Encoder", "org.jitsi.impl.neomedia.codec.audio.gsm.DePacketizer", "org.jitsi.impl.neomedia.codec.audio.gsm.Packetizer", "org.jitsi.impl.neomedia.codec.audio.silk.JavaDecoder", "org.jitsi.impl.neomedia.codec.audio.silk.JavaEncoder", //"org.jitsi.impl.neomedia.codec.video.h263p.DePacketizer", //"org.jitsi.impl.neomedia.codec.video.h263p.JNIDecoder", //"org.jitsi.impl.neomedia.codec.video.h263p.JNIEncoder", //"org.jitsi.impl.neomedia.codec.video.h263p.Packetizer", "org.jitsi.impl.neomedia.codec.video.h264.DePacketizer", "org.jitsi.impl.neomedia.codec.video.h264.JNIDecoder", "org.jitsi.impl.neomedia.codec.video.h264.JNIEncoder", "org.jitsi.impl.neomedia.codec.video.h264.Packetizer", "org.jitsi.impl.neomedia.codec.video.SwScale", // VP8 "org.jitsi.impl.neomedia.codec.video.vp8.DePacketizer", "org.jitsi.impl.neomedia.codec.video.vp8.Packetizer", "org.jitsi.impl.neomedia.codec.video.vp8.VPXDecoder", "org.jitsi.impl.neomedia.codec.video.vp8.VPXEncoder", // Adaptive Multi-Rate Wideband (AMR-WB) // "org.jitsi.impl.neomedia.codec.audio.amrwb.DePacketizer", "org.jitsi.impl.neomedia.codec.audio.amrwb.JNIDecoder", "org.jitsi.impl.neomedia.codec.audio.amrwb.JNIEncoder", // "org.jitsi.impl.neomedia.codec.audio.amrwb.Packetizer", }; /** * The package prefixes of the additional JMF <tt>DataSource</tt>s (e.g. low * latency PortAudio and ALSA <tt>CaptureDevice</tt>s). */ private static final String[] CUSTOM_PACKAGES = { "org.jitsi.impl.neomedia.jmfext", "net.java.sip.communicator.impl.neomedia.jmfext", "net.sf.fmj" }; /** * The list of class names to register as FMJ plugins with type * <tt>PlugInManager.MULTIPLEXER</tt>. */ private static final String[] CUSTOM_MULTIPLEXERS = { "org.jitsi.impl.neomedia.recording.BasicWavMux" }; /** * The <tt>Logger</tt> used by the <tt>FMJPlugInConfiguration</tt> class * for logging output. */ private static final Logger logger = Logger.getLogger(FMJPlugInConfiguration.class); /** * Whether custom packages have been registered with JFM */ private static boolean packagesRegistered = false; /** * Register in JMF the custom codecs we provide */ public static void registerCustomCodecs() { if(codecsRegistered) return; // Register the custom codecs which haven't already been registered. @SuppressWarnings("unchecked") Collection<String> registeredPlugins = new HashSet<String>( PlugInManager.getPlugInList( null, null, PlugInManager.CODEC)); boolean commit = false; // Remove JavaRGBToYUV. PlugInManager.removePlugIn( "com.sun.media.codec.video.colorspace.JavaRGBToYUV", PlugInManager.CODEC); PlugInManager.removePlugIn( "com.sun.media.codec.video.colorspace.JavaRGBConverter", PlugInManager.CODEC); PlugInManager.removePlugIn( "com.sun.media.codec.video.colorspace.RGBScaler", PlugInManager.CODEC); // Remove JMF's H263 codec. PlugInManager.removePlugIn( "com.sun.media.codec.video.vh263.NativeDecoder", PlugInManager.CODEC); PlugInManager.removePlugIn( "com.ibm.media.codec.video.h263.NativeEncoder", PlugInManager.CODEC); // Remove JMF's GSM codec. As working only on some OS. String gsmCodecPackage = "com.ibm.media.codec.audio.gsm."; String[] gsmCodecClasses = new String[] { "JavaDecoder", "JavaDecoder_ms", "JavaEncoder", "JavaEncoder_ms", "NativeDecoder", "NativeDecoder_ms", "NativeEncoder", "NativeEncoder_ms", "Packetizer" }; for(String gsmCodecClass : gsmCodecClasses) { PlugInManager.removePlugIn( gsmCodecPackage + gsmCodecClass, PlugInManager.CODEC); } /* * Remove FMJ's JavaSoundCodec because it seems to slow down the * building of the filter graph and we do not currently seem to need it. */ PlugInManager.removePlugIn( "net.sf.fmj.media.codec.JavaSoundCodec", PlugInManager.CODEC); for (String className : CUSTOM_CODECS) { /* * A codec with a className of null is configured at compile time to * not be registered. */ if (className == null) continue; if (registeredPlugins.contains(className)) { if (logger.isDebugEnabled()) { logger.debug( "Codec " + className + " is already registered"); } } else { commit = true; boolean registered; Throwable exception = null; try { Codec codec = (Codec) Class.forName(className).newInstance(); registered = PlugInManager.addPlugIn( className, codec.getSupportedInputFormats(), codec.getSupportedOutputFormats(null), PlugInManager.CODEC); } catch (Throwable ex) { registered = false; exception = ex; } if (registered) { if (logger.isTraceEnabled()) { logger.trace( "Codec " + className + " is successfully registered"); } } else { logger.warn( "Codec " + className + " is NOT successfully registered", exception); } } } /* * If Jitsi provides a codec which is also provided by FMJ and/or JMF, * use Jitsi's version. */ @SuppressWarnings("unchecked") Vector<String> codecs = PlugInManager.getPlugInList(null, null, PlugInManager.CODEC); if (codecs != null) { boolean setPlugInList = false; for (int i = CUSTOM_CODECS.length - 1; i >= 0; i--) { String className = CUSTOM_CODECS[i]; if (className != null) { int classNameIndex = codecs.indexOf(className); if (classNameIndex != -1) { codecs.remove(classNameIndex); codecs.add(0, className); setPlugInList = true; } } } if (setPlugInList) PlugInManager.setPlugInList(codecs, PlugInManager.CODEC); } if (commit && !MediaServiceImpl.isJmfRegistryDisableLoad()) { try { PlugInManager.commit(); } catch (IOException ex) { logger.error("Cannot commit to PlugInManager", ex); } } codecsRegistered = true; } /** * Register in JMF the custom packages we provide */ public static void registerCustomPackages() { if(packagesRegistered) return; @SuppressWarnings("unchecked") Vector<String> packages = PackageManager.getProtocolPrefixList(); boolean loggerIsDebugEnabled = logger.isDebugEnabled(); // We prefer our custom packages/protocol prefixes over FMJ's. for (int i = CUSTOM_PACKAGES.length - 1; i >= 0; i--) { String customPackage = CUSTOM_PACKAGES[i]; /* * Linear search in a loop but it doesn't have to scale since the * list is always short. */ if (!packages.contains(customPackage)) { packages.add(0, customPackage); if (loggerIsDebugEnabled) logger.debug("Adding package : " + customPackage); } } PackageManager.setProtocolPrefixList(packages); PackageManager.commitProtocolPrefixList(); if (loggerIsDebugEnabled) logger.debug("Registering new protocol prefix list: " + packages); packagesRegistered = true; } /** * Registers custom libjitsi <tt>Multiplexer</tt> implementations. */ @SuppressWarnings("unchecked") public static void registerCustomMultiplexers() { if (multiplexersRegistered) return; // Remove the FMJ WAV multiplexers, as they don't work. PlugInManager.removePlugIn( "com.sun.media.multiplexer.audio.WAVMux", PlugInManager.MULTIPLEXER); PlugInManager.removePlugIn( "net.sf.fmj.media.multiplexer.audio.WAVMux", PlugInManager.MULTIPLEXER); Collection<String> registeredMuxers = new HashSet<String>( PlugInManager.getPlugInList( null, null, PlugInManager.MULTIPLEXER)); boolean commit = false; for (String className : CUSTOM_MULTIPLEXERS) { if (className == null) continue; if (registeredMuxers.contains(className)) { if (logger.isDebugEnabled()) logger.debug("Multiplexer " + className + " is already " + "registered"); continue; } boolean registered; Throwable exception = null; try { Multiplexer multiplexer = (Multiplexer) Class.forName(className).newInstance(); registered = PlugInManager.addPlugIn( className, multiplexer.getSupportedInputFormats(), multiplexer.getSupportedOutputContentDescriptors(null), PlugInManager.MULTIPLEXER); } catch (Throwable ex) { registered = false; exception = ex; } if (registered) { if (logger.isTraceEnabled()) { logger.trace( "Codec " + className + " is successfully registered"); } } else { logger.warn( "Codec " + className + " is NOT successfully registered", exception); } commit |= registered; } if (commit && !MediaServiceImpl.isJmfRegistryDisableLoad()) { try { PlugInManager.commit(); } catch (IOException ex) { logger.error("Cannot commit to PlugInManager", ex); } } multiplexersRegistered = true; } }
3e0f1da640070bb49a735d79e956e1d7ca006c40
2,790
java
Java
src/foam/lib/formatter/AbstractFObjectFormatter.java
LenoreChen/foam3
d9c21bcef1ff61e5e7ced84de21baa55c9867a0f
[ "ECL-2.0", "Apache-2.0" ]
15
2021-04-06T19:37:37.000Z
2022-02-08T16:21:36.000Z
src/foam/lib/formatter/AbstractFObjectFormatter.java
LenoreChen/foam3
d9c21bcef1ff61e5e7ced84de21baa55c9867a0f
[ "ECL-2.0", "Apache-2.0" ]
188
2021-04-09T15:04:37.000Z
2022-03-30T16:54:37.000Z
src/foam/lib/formatter/AbstractFObjectFormatter.java
LenoreChen/foam3
d9c21bcef1ff61e5e7ced84de21baa55c9867a0f
[ "ECL-2.0", "Apache-2.0" ]
21
2021-03-23T17:46:26.000Z
2022-03-07T18:22:36.000Z
26.571429
189
0.698566
6,424
/** * @license * Copyright 2020 The FOAM Authors. All Rights Reserved. * http://www.apache.org/licenses/LICENSE-2.0 */ package foam.lib.formatter; import foam.core.ClassInfo; import foam.core.FObject; import foam.core.PropertyInfo; import foam.core.X; import foam.lib.PropertyPredicate; import foam.lib.StorageOptionalPropertyPredicate; import java.util.*; public abstract class AbstractFObjectFormatter implements FObjectFormatter { protected X x_; protected StringBuilder b_ = new StringBuilder(); // Used to filter properties that are being outputted. protected PropertyPredicate propertyPredicate_; // additional predicate applied to determine if the property is 'storageOptional'. If after processing an object, if only storageOptional properties remain, then the object is not output. protected PropertyPredicate optionalPredicate_ = new StorageOptionalPropertyPredicate(); protected Map<String, List<PropertyInfo>> propertyMap_ = new HashMap<>(); public AbstractFObjectFormatter(X x) { setX(x); } public AbstractFObjectFormatter() { } public void setX(X x) { x_ = x; } public X getX() { return x_; } public StringBuilder builder() { return b_; } // single point of access to b_ to simplify subclassing. public StringBuilder append(Object o) { b_.append(o); return b_; } public void reset() { builder().setLength(0); } public String stringify(FObject obj) { reset(); output(obj); return b_.toString(); } public String stringifyDelta(FObject oldFObject, FObject newFObject) { reset(); maybeOutputDelta(oldFObject, newFObject); return b_.toString(); } public boolean maybeOutputDelta(FObject oldFObject, FObject newFObject) { return maybeOutputDelta(oldFObject, newFObject, null, null); } protected synchronized List getProperties(PropertyInfo parentProp, ClassInfo info) { String of = info.getObjClass().getName(); if ( propertyMap_.containsKey(of) && propertyMap_.get(of).isEmpty() ) { propertyMap_.remove(of); } if ( ! propertyMap_.containsKey(of) ) { List<PropertyInfo> filteredAxioms = new ArrayList<>(); Iterator e = info.getAxiomsByClass(PropertyInfo.class).iterator(); while ( e.hasNext() ) { PropertyInfo prop = (PropertyInfo) e.next(); if ( propertyPredicate_ == null || propertyPredicate_.propertyPredicateCheck(this.x_, of, prop) ) { filteredAxioms.add(prop); } } propertyMap_.put(of, filteredAxioms); return filteredAxioms; } return propertyMap_.get(of); } public void setPropertyPredicate(PropertyPredicate p) { propertyPredicate_ = p; } public String toString() { return b_.toString(); } }
3e0f1dbf7f2b3c8122783549805efe8c95ecb996
4,799
java
Java
src/main/java/com/uwetrottmann/tmdb2/DiscoverTvBuilder.java
mlaggner/tmdb-java
001ea9d4c106f6a8af9b6e90479ae21e6ba4b263
[ "Apache-2.0" ]
127
2015-01-10T12:33:13.000Z
2022-02-09T05:40:19.000Z
src/main/java/com/uwetrottmann/tmdb2/DiscoverTvBuilder.java
chrisbanes/tmdb-java
5fded393c621543ce9c0f6e1ed5a8985db18d4ae
[ "Unlicense" ]
63
2015-01-10T11:35:37.000Z
2022-03-25T07:37:30.000Z
src/main/java/com/uwetrottmann/tmdb2/DiscoverTvBuilder.java
chrisbanes/tmdb-java
5fded393c621543ce9c0f6e1ed5a8985db18d4ae
[ "Unlicense" ]
81
2015-01-08T08:39:51.000Z
2022-01-22T10:45:44.000Z
30.18239
82
0.677641
6,425
package com.uwetrottmann.tmdb2; import com.uwetrottmann.tmdb2.entities.DiscoverFilter; import com.uwetrottmann.tmdb2.entities.TmdbDate; import com.uwetrottmann.tmdb2.entities.TvShowResultsPage; import com.uwetrottmann.tmdb2.enumerations.SortBy; import com.uwetrottmann.tmdb2.services.DiscoverService; import javax.annotation.Nullable; import retrofit2.Call; public class DiscoverTvBuilder { protected final DiscoverService discoverService; @Nullable private String language; @Nullable private SortBy sort_by; @Nullable private TmdbDate air_date_gte; @Nullable private TmdbDate air_date_lte; @Nullable private TmdbDate first_air_date_gte; @Nullable private TmdbDate first_air_date_lte; @Nullable private Integer first_air_date_year; @Nullable private Integer page; @Nullable private String timezone; @Nullable private Float vote_average_gte; @Nullable private Integer vote_count_gte; @Nullable private DiscoverFilter with_genres; @Nullable private DiscoverFilter with_networks; @Nullable private DiscoverFilter without_genres; @Nullable private Integer with_runtime_gte; @Nullable private Integer with_runtime_lte; @Nullable private Boolean include_null_first_air_dates; @Nullable private String with_original_language; @Nullable private DiscoverFilter without_keywords; public DiscoverTvBuilder(DiscoverService discoverService) { this.discoverService = discoverService; } public DiscoverTvBuilder language(@Nullable String value) { this.language = value; return this; } public DiscoverTvBuilder sort_by(@Nullable SortBy value) { this.sort_by = value; return this; } public DiscoverTvBuilder air_date_gte(@Nullable TmdbDate value) { this.air_date_gte = value; return this; } public DiscoverTvBuilder air_date_lte(@Nullable TmdbDate value) { this.air_date_lte = value; return this; } public DiscoverTvBuilder first_air_date_gte(@Nullable TmdbDate value) { this.first_air_date_gte = value; return this; } public DiscoverTvBuilder first_air_date_lte(@Nullable TmdbDate value) { this.first_air_date_lte = value; return this; } public DiscoverTvBuilder first_air_date_year(@Nullable Integer value) { this.first_air_date_year = value; return this; } public DiscoverTvBuilder page(@Nullable Integer value) { this.page = value; return this; } public DiscoverTvBuilder timezone(@Nullable String value) { this.timezone = value; return this; } public DiscoverTvBuilder vote_average_gte(@Nullable Float value) { this.vote_average_gte = value; return this; } public DiscoverTvBuilder vote_count_gte(@Nullable Integer value) { this.vote_count_gte = value; return this; } public DiscoverTvBuilder with_genres(@Nullable DiscoverFilter value) { this.with_genres = value; return this; } public DiscoverTvBuilder with_networks(@Nullable DiscoverFilter value) { this.with_networks = value; return this; } public DiscoverTvBuilder without_genres(@Nullable DiscoverFilter value) { this.without_genres = value; return this; } public DiscoverTvBuilder with_runtime_gte(@Nullable Integer value) { this.with_runtime_gte = value; return this; } public DiscoverTvBuilder with_runtime_lte(@Nullable Integer value) { this.with_runtime_lte = value; return this; } public DiscoverTvBuilder include_null_first_air_dates() { this.include_null_first_air_dates = true; return this; } public DiscoverTvBuilder with_original_language(@Nullable String value) { this.with_original_language = value; return this; } public DiscoverTvBuilder without_keywords(@Nullable DiscoverFilter keywords) { this.without_keywords = keywords; return this; } public Call<TvShowResultsPage> build() { return discoverService.discoverTv( language, sort_by, air_date_gte, air_date_lte, first_air_date_gte, first_air_date_lte, first_air_date_year, page, timezone, vote_average_gte, vote_count_gte, with_genres, with_networks, without_genres, with_runtime_gte, with_runtime_lte, include_null_first_air_dates, with_original_language, without_keywords ); } }
3e0f1ec0660816d16df58b7cc670ab878d3b0fb4
333
java
Java
src/main/java/com/bullhornsdk/data/model/response/single/customobject/JobOrderCustomObjectInstance5Wrapper.java
ianweist/sdk-rest
79301bbb28e8046a00f3bf5821c2a82485650e36
[ "MIT" ]
null
null
null
src/main/java/com/bullhornsdk/data/model/response/single/customobject/JobOrderCustomObjectInstance5Wrapper.java
ianweist/sdk-rest
79301bbb28e8046a00f3bf5821c2a82485650e36
[ "MIT" ]
1
2022-02-24T20:47:17.000Z
2022-02-24T20:47:17.000Z
src/main/java/com/bullhornsdk/data/model/response/single/customobject/JobOrderCustomObjectInstance5Wrapper.java
ianweist/sdk-rest
79301bbb28e8046a00f3bf5821c2a82485650e36
[ "MIT" ]
null
null
null
41.625
106
0.876877
6,426
package com.bullhornsdk.data.model.response.single.customobject; import com.bullhornsdk.data.model.entity.core.customobject.JobOrderCustomObjectInstance5; import com.bullhornsdk.data.model.response.single.StandardWrapper; public class JobOrderCustomObjectInstance5Wrapper extends StandardWrapper<JobOrderCustomObjectInstance5> { }
3e0f201e12f4f41544434087c63599ca2549b96a
401
java
Java
src/main/java/com/moople/gitpals/MainApplication/service/interfaces/AdminInterface.java
danmoop/Gitpals
d36f12477a77750fa7c64839057e0f750091763e
[ "MIT" ]
73
2018-03-18T12:19:56.000Z
2021-09-14T09:19:20.000Z
src/main/java/com/moople/gitpals/MainApplication/service/interfaces/AdminInterface.java
danmoop/Gitpals
d36f12477a77750fa7c64839057e0f750091763e
[ "MIT" ]
3
2018-03-12T13:24:52.000Z
2020-12-18T22:10:57.000Z
src/main/java/com/moople/gitpals/MainApplication/service/interfaces/AdminInterface.java
danmoop/Gitpals
d36f12477a77750fa7c64839057e0f750091763e
[ "MIT" ]
2
2020-09-10T01:06:18.000Z
2021-01-04T13:01:54.000Z
23.588235
62
0.780549
6,427
package com.moople.gitpals.MainApplication.service.interfaces; import java.util.List; public interface AdminInterface { boolean removeAllUserProjects(String username); boolean makeUserAnAdmin(String username); void deleteAllForumPostsByUser(String username); void modifyGlobalAlert(String text); List<String> getActiveDailyUsers(); List<String> getActiveWeeklyUsers(); }