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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
923fbbfd2073137edd2379519de7d5ec69fd1d15
| 812 |
java
|
Java
|
Java-Source/Day0.java
|
rupponi/Hacker-Rank-30-Days-Of-Code
|
ac2208360f29f4b21d524314e9ab1cdf0aa9205a
|
[
"MIT"
] | 1 |
2020-09-20T07:02:05.000Z
|
2020-09-20T07:02:05.000Z
|
Java-Source/Day0.java
|
rupponi/Hacker-Rank-30-Days-Of-Code
|
ac2208360f29f4b21d524314e9ab1cdf0aa9205a
|
[
"MIT"
] | null | null | null |
Java-Source/Day0.java
|
rupponi/Hacker-Rank-30-Days-Of-Code
|
ac2208360f29f4b21d524314e9ab1cdf0aa9205a
|
[
"MIT"
] | null | null | null | 35.304348 | 93 | 0.655172 | 1,001,272 |
//DAY 0 OF HACKERRANK 30 DAY CHALLENGE: HELLO, WORLD (JAVA)
import java.util.Scanner;
public class Day0 {
public static void main(String[] args) {
// Create a Scanner object to read input from stdin.
Scanner scan = new Scanner(System.in);
// Read a full line of input from stdin and save it to our variable, inputString.
String inputString = scan.nextLine();
// Close the scanner object, because we've finished reading
// all of the input from stdin needed for this challenge.
scan.close();
// Print a string literal saying "Hello, World." to stdout.
System.out.println("Hello, World.");
// TODO: Write a line of code here that prints the contents of inputString to stdout.
System.out.println(inputString);
}
}
|
923fbcc9c64e92b6bd19f33d66376ad50408fe2f
| 1,362 |
java
|
Java
|
forum-common/src/main/java/com/qxczh/common/dto/UploadResult.java
|
wukoudada/CampusForum
|
2ea7c754438ada1311d486f54098c9038feb434c
|
[
"Apache-2.0"
] | 50 |
2019-04-16T06:14:19.000Z
|
2022-03-31T11:11:16.000Z
|
forum-common/src/main/java/com/qxczh/common/dto/UploadResult.java
|
penrry/CampusForum
|
9d52a039d58a91fc3604a9d0398220efefacf747
|
[
"Apache-2.0"
] | 2 |
2019-11-30T07:25:25.000Z
|
2020-04-23T12:49:54.000Z
|
forum-common/src/main/java/com/qxczh/common/dto/UploadResult.java
|
penrry/CampusForum
|
9d52a039d58a91fc3604a9d0398220efefacf747
|
[
"Apache-2.0"
] | 14 |
2019-04-19T13:42:52.000Z
|
2022-02-24T06:24:03.000Z
| 15.303371 | 51 | 0.489721 | 1,001,273 |
package com.qxczh.common.dto;
import java.io.Serializable;
public class UploadResult implements Serializable{
/**
* 0表示成功 ,其余失败
*/
private Integer code;
/**
* 错误消息
*/
private String msg;
private Data data;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* 路径
*/
private String src;
/**
* 名称
*/
private String title;
public String getSrc() {
return src;
}
public String getTitle() {
return title;
}
public Data(String src) {
this.src = src;
}
}
/**
* 成功的构造函数
* @param code
* @param data
*/
public UploadResult(Integer code, Data data) {
this.code = code;
this.data = data;
}
/**
* 失败的构造函数
* @param code
* @param msg
*/
public UploadResult(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
}
|
923fbe8ee455c008efd15ab901df7daa741a2759
| 2,721 |
java
|
Java
|
src/main/java/com/alipay/api/domain/ZhimaCreditPayafteruseCreditagreementSignModel.java
|
antopen/alipay-sdk-java-all
|
790dea41169e764e3f2e08330800246b4aba1b29
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/com/alipay/api/domain/ZhimaCreditPayafteruseCreditagreementSignModel.java
|
antopen/alipay-sdk-java-all
|
790dea41169e764e3f2e08330800246b4aba1b29
|
[
"Apache-2.0"
] | 1 |
2018-05-23T08:08:56.000Z
|
2018-08-26T07:16:29.000Z
|
src/main/java/com/alipay/api/domain/ZhimaCreditPayafteruseCreditagreementSignModel.java
|
antopen/alipay-sdk-java-all
|
790dea41169e764e3f2e08330800246b4aba1b29
|
[
"Apache-2.0"
] | null | null | null | 22.487603 | 103 | 0.721793 | 1,001,274 |
package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 先用后付记签约
*
* @author auto create
* @since 1.0, 2022-03-31 16:38:04
*/
public class ZhimaCreditPayafteruseCreditagreementSignModel extends AlipayObject {
private static final long serialVersionUID = 5386596331315311595L;
/**
* 当用户进入芝麻先用后付开通页面后,点击左上角的回退按钮,中断开通流程,跳转回商户的页面地址。支持scheme协议。不传该链接时,默认返回上一级页面,由外部app唤起支付宝的情况,会返回支付宝首页。
*/
@ApiField("cancel_back_link")
private String cancelBackLink;
/**
* 芝麻外部类目
*/
@ApiField("category_id")
private String categoryId;
/**
* 用户在商户网站的登录账号,暂无需传递。
*/
@ApiField("external_logon_id")
private String externalLogonId;
/**
* 业务扩展参数,用于商户的特定业务信息的传递,json格式。无特殊需求时,不需要传递该参数。
*/
@ApiField("extra_param")
private String extraParam;
/**
* 商户外部协议号,不同的支付宝用户需要传递不同的外部单号
*/
@ApiField("out_agreement_no")
private String outAgreementNo;
/**
* 产品码,不填默认为 CREDIT_PAY_AFTER_USE。芝麻先用后付产品为CREDIT_PAY_AFTER_USE,其他产品请根据对应的技术支持文档传入。
*/
@ApiField("product_code")
private String productCode;
/**
* 用户成功完成芝麻先用后付开通流程后,跳转回商户的页面地址。支持scheme协议。不传该链接时,默认返回上一级页面,由外部app 唤起支付宝的情况,会返回支付宝首页。
*/
@ApiField("return_back_link")
private String returnBackLink;
/**
* 芝麻服务ID
*/
@ApiField("zm_service_id")
private String zmServiceId;
public String getCancelBackLink() {
return this.cancelBackLink;
}
public void setCancelBackLink(String cancelBackLink) {
this.cancelBackLink = cancelBackLink;
}
public String getCategoryId() {
return this.categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public String getExternalLogonId() {
return this.externalLogonId;
}
public void setExternalLogonId(String externalLogonId) {
this.externalLogonId = externalLogonId;
}
public String getExtraParam() {
return this.extraParam;
}
public void setExtraParam(String extraParam) {
this.extraParam = extraParam;
}
public String getOutAgreementNo() {
return this.outAgreementNo;
}
public void setOutAgreementNo(String outAgreementNo) {
this.outAgreementNo = outAgreementNo;
}
public String getProductCode() {
return this.productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getReturnBackLink() {
return this.returnBackLink;
}
public void setReturnBackLink(String returnBackLink) {
this.returnBackLink = returnBackLink;
}
public String getZmServiceId() {
return this.zmServiceId;
}
public void setZmServiceId(String zmServiceId) {
this.zmServiceId = zmServiceId;
}
}
|
923fbee3760d6daf3f084499f1c2c62ee892ca41
| 882 |
java
|
Java
|
source/network/sql/transactions/impl/PlayerOnlineCountTransaction.java
|
FavyTeam/Elderscape_server
|
38bf75396e4e13222be67d5f15eb0b9862dca6bb
|
[
"MIT"
] | 3 |
2019-05-09T16:59:13.000Z
|
2019-05-09T18:29:57.000Z
|
source/network/sql/transactions/impl/PlayerOnlineCountTransaction.java
|
FavyTeam/Elderscape_server
|
38bf75396e4e13222be67d5f15eb0b9862dca6bb
|
[
"MIT"
] | null | null | null |
source/network/sql/transactions/impl/PlayerOnlineCountTransaction.java
|
FavyTeam/Elderscape_server
|
38bf75396e4e13222be67d5f15eb0b9862dca6bb
|
[
"MIT"
] | 7 |
2019-07-11T23:04:40.000Z
|
2021-08-02T14:27:13.000Z
| 27.5625 | 149 | 0.704082 | 1,001,275 |
package network.sql.transactions.impl;
import network.sql.transactions.SQLNetworkTransaction;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
/**
* Created by Jason MK on 2018-07-12 at 2:28 PM
*/
public class PlayerOnlineCountTransaction implements SQLNetworkTransaction {
private final String date;
private final int count;
public PlayerOnlineCountTransaction(String date, int count) {
this.date = date;
this.count = count;
}
@Override
public void call(Connection connection) throws SQLException {
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO server.stats_player_online (time, online_count) VALUES(?, ?)")) {
statement.setString(1, date);
statement.setInt(2, count);
statement.executeUpdate();
}
}
}
|
923fbef9baaee570393b3d3ecec1917e71816667
| 2,985 |
java
|
Java
|
src/main/java/tamaized/aov/client/entity/RenderSpellBladeBarrier.java
|
Tamaized/AoV
|
5e1233432dea3f50780f361f628030652ff03653
|
[
"MIT"
] | 18 |
2016-02-04T06:49:23.000Z
|
2021-12-14T22:56:01.000Z
|
src/main/java/tamaized/aov/client/entity/RenderSpellBladeBarrier.java
|
Tamaized/AoV
|
5e1233432dea3f50780f361f628030652ff03653
|
[
"MIT"
] | 151 |
2016-02-05T07:22:50.000Z
|
2021-05-31T21:07:21.000Z
|
src/main/java/tamaized/aov/client/entity/RenderSpellBladeBarrier.java
|
Tamaized/AoV
|
5e1233432dea3f50780f361f628030652ff03653
|
[
"MIT"
] | 13 |
2017-11-10T06:49:59.000Z
|
2021-12-14T22:56:04.000Z
| 31.755319 | 142 | 0.742714 | 1,001,276 |
package tamaized.aov.client.entity;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import tamaized.aov.common.entity.EntitySpellBladeBarrier;
import javax.annotation.Nonnull;
public class RenderSpellBladeBarrier<T extends EntitySpellBladeBarrier> extends EntityRenderer<T> {
private static final ItemStack woodSword = new ItemStack(Items.WOODEN_SWORD);
private static final ItemStack stoneSword = new ItemStack(Items.STONE_SWORD);
private static final ItemStack ironSword = new ItemStack(Items.IRON_SWORD);
private static final ItemStack diamondSword = new ItemStack(Items.DIAMOND_SWORD);
private static final ItemStack goldSword = new ItemStack(Items.GOLDEN_SWORD);
public RenderSpellBladeBarrier(EntityRendererManager renderManager) {
super(renderManager);
}
@Override
public void render(T entity, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) {
/*World world = entity.world; TODO
if (world == null)
return;
bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
RenderSystem.pushMatrix();
{
RenderSystem.translated(x, y + 1, z);
int t = entity.ticksExisted * 10;
RenderSystem.pushMatrix();
{
RenderSystem.translated(0, 0.5, 0);
RenderSystem.rotatef(-(t > 0 ? t % 360 : 0), 0, 1, 0);
drawRing(entity);
}
RenderSystem.popMatrix();
RenderSystem.pushMatrix();
{
RenderSystem.rotatef((t > 0 ? t % 360 : 0), 0, 1, 0);
drawRing(entity);
}
RenderSystem.popMatrix();
}
RenderSystem.popMatrix();*/
}
@Override
public ResourceLocation getEntityTexture(T entity) {
return null;
}
private void drawRing(T entity) {
/*ItemRenderer itemRender = Minecraft.getInstance().getItemRenderer(); TODO
for (int r = 0; r <= entity.getRange() + 1; r++) {
RenderSystem.pushMatrix();
{
RenderSystem.translated(Math.cos(r) * entity.getRange(), 0, Math.sin(r) * entity.getRange());
RenderSystem.rotatef(60, 1, 0, 0);
ItemStack stack = getSword(r == 0 ? 0 : r % 5);
itemRender.renderItem(stack, itemRender.getItemModelWithOverrides(stack, entity.world, null));
}
RenderSystem.popMatrix();
}*/
}
private ItemStack getSword(int index) {
switch (index) {
default:
case 0:
return woodSword;
case 1:
return stoneSword;
case 2:
return ironSword;
case 3:
return diamondSword;
case 4:
return goldSword;
}
}
}
|
923fc11097ecb10d9491648fc95e92e956b72480
| 453 |
java
|
Java
|
d-selenium/src/main/java/d/selenium/models/Location.java
|
demilich1979/d-test-automation-framework
|
4af0a72e7a11d61f73e9f7277ecf62fdb77e3bad
|
[
"Apache-2.0"
] | null | null | null |
d-selenium/src/main/java/d/selenium/models/Location.java
|
demilich1979/d-test-automation-framework
|
4af0a72e7a11d61f73e9f7277ecf62fdb77e3bad
|
[
"Apache-2.0"
] | null | null | null |
d-selenium/src/main/java/d/selenium/models/Location.java
|
demilich1979/d-test-automation-framework
|
4af0a72e7a11d61f73e9f7277ecf62fdb77e3bad
|
[
"Apache-2.0"
] | null | null | null | 28.3125 | 134 | 0.730684 | 1,001,277 |
package diaceutics.selenium.models;
import lombok.Data;
@Data
public class Location extends BaseModel {
private String locationName;
private String addressOne;
private String addressTwo;
private String cityTown;
private String region;
private String country;
private String postalCode;
private String[] fields = new String[]{"locationName", "addressOne", "addressTwo", "cityTown", "region", "country", "postalCode"};
}
|
923fc23886e52c2e541da48e6f6beee70801bf75
| 2,275 |
java
|
Java
|
lib/src/net/sf/jasperreports/olap/mondrian/JRMondrianHierarchy.java
|
juniormesquitadandao/ireport4all
|
a32b54d4e5beb0320d356a1689a39cae8dc16b75
|
[
"MIT"
] | 1 |
2021-10-12T07:17:36.000Z
|
2021-10-12T07:17:36.000Z
|
lib/src/net/sf/jasperreports/olap/mondrian/JRMondrianHierarchy.java
|
juniormesquitadandao/ireport4all
|
a32b54d4e5beb0320d356a1689a39cae8dc16b75
|
[
"MIT"
] | null | null | null |
lib/src/net/sf/jasperreports/olap/mondrian/JRMondrianHierarchy.java
|
juniormesquitadandao/ireport4all
|
a32b54d4e5beb0320d356a1689a39cae8dc16b75
|
[
"MIT"
] | null | null | null | 29.320513 | 92 | 0.740708 | 1,001,278 |
/*
* JasperReports - Free Java Reporting Library.
* Copyright (C) 2001 - 2014 TIBCO Software Inc. All rights reserved.
* http://www.jaspersoft.com
*
* Unless you have purchased a commercial license agreement from Jaspersoft,
* the following license terms apply:
*
* This program is part of JasperReports.
*
* JasperReports is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* JasperReports is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.jasperreports.olap.mondrian;
import mondrian.olap.Hierarchy;
import mondrian.olap.Level;
import net.sf.jasperreports.olap.result.JROlapHierarchy;
import net.sf.jasperreports.olap.result.JROlapHierarchyLevel;
/**
* @author Lucian Chirita ([email protected])
* @version $Id: JRMondrianHierarchy.java 7199 2014-08-27 13:58:10Z teodord $
*/
public class JRMondrianHierarchy implements JROlapHierarchy
{
private final Hierarchy hierarchy;
private final JRMondrianLevel[] levels;
public JRMondrianHierarchy(Hierarchy hierarchy)
{
this.hierarchy = hierarchy;
if (hierarchy == null)
{
levels = new JRMondrianLevel[0];
}
else
{
Level[] hierarchyLevels = hierarchy.getLevels();
levels = new JRMondrianLevel[hierarchyLevels.length];
for (int i = 0; i < hierarchyLevels.length; i++)
{
levels[i] = new JRMondrianLevel(hierarchyLevels[i]);
}
}
}
public String getDimensionName()
{
return hierarchy == null ? null : hierarchy.getDimension().getName();
}
public JROlapHierarchyLevel[] getLevels()
{
return levels;
}
// MPenningroth 21-April-2009 deal with case when dimension is <dimension>.<hierarchy> form
public String getHierarchyUniqueName()
{
return hierarchy == null ? null : hierarchy.getUniqueName();
}
}
|
923fc26453b17bd6915d0a13962fa7c929985dc5
| 1,542 |
java
|
Java
|
DAM2/Desarrollo de interfaces/Practica 1 Armando Calderon/WindowsBuilder/src/TransicionInterfaces/InterfazA.java
|
armandix23/DAM
|
e7a706dfb5fc9954581ed00eb97b7eb3c9769851
|
[
"BSD-3-Clause"
] | null | null | null |
DAM2/Desarrollo de interfaces/Practica 1 Armando Calderon/WindowsBuilder/src/TransicionInterfaces/InterfazA.java
|
armandix23/DAM
|
e7a706dfb5fc9954581ed00eb97b7eb3c9769851
|
[
"BSD-3-Clause"
] | null | null | null |
DAM2/Desarrollo de interfaces/Practica 1 Armando Calderon/WindowsBuilder/src/TransicionInterfaces/InterfazA.java
|
armandix23/DAM
|
e7a706dfb5fc9954581ed00eb97b7eb3c9769851
|
[
"BSD-3-Clause"
] | null | null | null | 20.56 | 62 | 0.690661 | 1,001,279 |
package TransicionInterfaces;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class InterfazA {
private JFrame frmInterfazA;
protected JFrame getFrmInterfazA() {
return frmInterfazA;
}
protected void setFrmInterfazA(JFrame frmInterfazA) {
this.frmInterfazA = frmInterfazA;
}
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
InterfazA window = new InterfazA();
window.frmInterfazA.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public InterfazA() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frmInterfazA = new JFrame();
frmInterfazA.setTitle("INTERFAZ A");
frmInterfazA.setBounds(100, 100, 450, 300);
frmInterfazA.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frmInterfazA.getContentPane().setLayout(null);
JButton btnIrAB = new JButton("IR A B");
btnIrAB.setBounds(72, 69, 276, 87);
frmInterfazA.getContentPane().add(btnIrAB);
// EVENTO BOTON IR A B.
btnIrAB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
//ABRIR INTERFAZ B
InterfazB b = new InterfazB();
//CERRAR interfaz A
frmInterfazA.dispose();
}
});
}
}
|
923fc36603cac54861674fb8a17645b5af3f41df
| 776 |
java
|
Java
|
app/src/main/java/com/jayjaylab/androiddemo/Application.java
|
jayjaykim/JayJayLab-Android-Demo
|
55acc7e07564247d1a97d8de27722541aa76eb30
|
[
"Apache-2.0"
] | 2 |
2016-06-04T23:33:09.000Z
|
2016-07-07T17:10:10.000Z
|
app/src/main/java/com/jayjaylab/androiddemo/Application.java
|
JayJayCEO/JayJayLab-Android-Demo
|
55acc7e07564247d1a97d8de27722541aa76eb30
|
[
"Apache-2.0"
] | null | null | null |
app/src/main/java/com/jayjaylab/androiddemo/Application.java
|
JayJayCEO/JayJayLab-Android-Demo
|
55acc7e07564247d1a97d8de27722541aa76eb30
|
[
"Apache-2.0"
] | null | null | null | 27.928571 | 95 | 0.696931 | 1,001,280 |
package com.jayjaylab.androiddemo;
import org.acra.ACRA;
import org.acra.ReportField;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
/**
* Created by jongjoo on 11/13/14.
*/
@ReportsCrashes(
formKey = "",
mailTo = "[email protected]",
customReportContent = {ReportField.APP_VERSION_CODE, ReportField.ANDROID_VERSION,
ReportField.APP_VERSION_NAME, ReportField.PHONE_MODEL, ReportField.STACK_TRACE,
ReportField.LOGCAT},
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text
)
public class Application extends android.app.Application {
@Override
public void onCreate() {
super.onCreate();
ACRA.init(this);
}
}
|
923fc3bcd8b8d5b252007dbf61b149cebffa8f3a
| 3,387 |
java
|
Java
|
core/src/main/java/org/teavm/cache/VarDataOutput.java
|
imran631/teavm
|
ccbaf0a58f4b57f5f8ff38dc83cffdf86a01a118
|
[
"Apache-2.0"
] | 1,875 |
2015-01-02T09:59:52.000Z
|
2022-03-30T01:37:25.000Z
|
core/src/main/java/org/teavm/cache/VarDataOutput.java
|
imran631/teavm
|
ccbaf0a58f4b57f5f8ff38dc83cffdf86a01a118
|
[
"Apache-2.0"
] | 462 |
2015-01-06T20:05:54.000Z
|
2022-03-25T13:25:15.000Z
|
core/src/main/java/org/teavm/cache/VarDataOutput.java
|
imran631/teavm
|
ccbaf0a58f4b57f5f8ff38dc83cffdf86a01a118
|
[
"Apache-2.0"
] | 246 |
2015-01-20T01:47:02.000Z
|
2022-03-13T13:40:33.000Z
| 30.790909 | 81 | 0.565988 | 1,001,281 |
/*
* Copyright 2019 Alexey Andreev.
*
* 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.teavm.cache;
import java.io.Closeable;
import java.io.IOException;
import java.io.OutputStream;
public class VarDataOutput implements Closeable {
private static final int DATA = 0x7F;
private static final int NEXT = 0x80;
private OutputStream output;
public VarDataOutput(OutputStream output) {
this.output = output;
}
public void writeUnsigned(int value) throws IOException {
while ((value & DATA) != value) {
output.write((value & DATA) | NEXT);
value >>>= 7;
}
output.write(value);
}
public void writeSigned(int value) throws IOException {
writeUnsigned(value < 0 ? ((~value) << 1) | 1 : value << 1);
}
public void writeUnsigned(long value) throws IOException {
while ((value & DATA) != value) {
output.write((int) (value & DATA) | NEXT);
value >>>= 7;
}
output.write((int) value);
}
public void writeSigned(long value) throws IOException {
writeUnsigned(value < 0 ? ((~value) << 1) | 1 : value << 1);
}
public void writeFloat(float value) throws IOException {
if (value == 0) {
writeUnsigned(0);
return;
}
int bits = Float.floatToRawIntBits(value);
boolean sign = (bits & (1 << 31)) != 0;
int exponent = (bits >> 23) & ((1 << 8) - 1);
int mantissa = bits & ((1 << 23) - 1);
if (sign) {
mantissa |= 1 << 23;
}
exponent -= 127;
writeUnsigned(1 + (exponent > 0 ? exponent << 1 : 1 | (-exponent << 1)));
writeUnsigned(Integer.reverse(mantissa << 8));
}
public void writeDouble(double value) throws IOException {
if (value == 0) {
writeUnsigned(0);
return;
}
long bits = Double.doubleToRawLongBits(value);
boolean sign = (bits & (1L << 63)) != 0;
int exponent = (int) (bits >> 52) & ((1 << 11) - 1);
long mantissa = bits & ((1L << 52) - 1);
if (sign) {
mantissa |= 1L << 52;
}
exponent -= 1023;
writeUnsigned(1 + (exponent > 0 ? exponent << 1 : 1 | (-exponent << 1)));
writeUnsigned(Long.reverse(mantissa << 11));
}
public void write(String s) throws IOException {
if (s == null) {
writeUnsigned(0);
return;
}
writeUnsigned(s.length() + 1);
for (int i = 0; i < s.length(); ++i) {
writeUnsigned(s.charAt(i));
}
}
public void writeBytes(byte[] data) throws IOException {
writeUnsigned(data.length);
output.write(data);
}
@Override
public void close() throws IOException {
output.close();
}
}
|
923fc4ef2ee2546f0d3745e1b5c384e7927f2ade
| 821 |
java
|
Java
|
java/demo-io/src/main/java/com/willow/demo/io/FileWatchService.java
|
revolyw/JavaUtils
|
c7425f5a7bf2c4a3c6925825de98a05686b8d109
|
[
"Apache-2.0"
] | null | null | null |
java/demo-io/src/main/java/com/willow/demo/io/FileWatchService.java
|
revolyw/JavaUtils
|
c7425f5a7bf2c4a3c6925825de98a05686b8d109
|
[
"Apache-2.0"
] | 3 |
2022-02-13T20:41:17.000Z
|
2022-02-27T10:31:54.000Z
|
java/demo-io/src/main/java/com/willow/demo/io/FileWatchService.java
|
revolyw/wheel-lib
|
c7425f5a7bf2c4a3c6925825de98a05686b8d109
|
[
"Apache-2.0"
] | 1 |
2016-11-25T07:47:05.000Z
|
2016-11-25T07:47:05.000Z
| 25.65625 | 82 | 0.689403 | 1,001,282 |
package com.willow.demo.io;
import java.io.IOException;
import java.nio.file.*;
/**
* 监听文件变化
*
* @author Willow
* @date 3/10/19
*/
public class FileWatchService {
public static void main(String[] args) throws IOException, InterruptedException {
WatchService service = FileSystems.getDefault().newWatchService();
Paths.get("/var/cache/biomart").register(service,
StandardWatchEventKinds.ENTRY_CREATE,
StandardWatchEventKinds.ENTRY_DELETE,
StandardWatchEventKinds.ENTRY_MODIFY,
StandardWatchEventKinds.OVERFLOW);
while (true) {
WatchKey key = service.take();
for (WatchEvent event : key.pollEvents()) {
WatchKey poll = service.poll();
System.out.println(event.context() + " 文件发生了 " + event.kind() + " 事件!");
}
if (!key.reset() || !key.isValid()) {
break;
}
}
}
}
|
923fc804887bfa607685871971d92bd34329134d
| 2,504 |
java
|
Java
|
Phase-3/HandlingUserAuthentication/src/main/java/com/example/HandlingUserAuthentication/controllers/RegisterController.java
|
ChristopherPierce/HCL_Projects
|
d202f488dd8278de33520cb57e0ce3b7463b264e
|
[
"Apache-2.0"
] | null | null | null |
Phase-3/HandlingUserAuthentication/src/main/java/com/example/HandlingUserAuthentication/controllers/RegisterController.java
|
ChristopherPierce/HCL_Projects
|
d202f488dd8278de33520cb57e0ce3b7463b264e
|
[
"Apache-2.0"
] | null | null | null |
Phase-3/HandlingUserAuthentication/src/main/java/com/example/HandlingUserAuthentication/controllers/RegisterController.java
|
ChristopherPierce/HCL_Projects
|
d202f488dd8278de33520cb57e0ce3b7463b264e
|
[
"Apache-2.0"
] | null | null | null | 41.733333 | 163 | 0.772364 | 1,001,283 |
package com.example.HandlingUserAuthentication.controllers;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.example.HandlingUserAuthentication.entities.User;
import com.example.HandlingUserAuthentication.exceptions.EmptyFormFieldException;
import com.example.HandlingUserAuthentication.exceptions.PasswordMismatchException;
import com.example.HandlingUserAuthentication.exceptions.PasswordRequirementsNotMetException;
import com.example.HandlingUserAuthentication.exceptions.UserAlreadyExistsException;
import com.example.HandlingUserAuthentication.services.UserService;
@Controller
public class RegisterController {
@Autowired
private UserService userService;
Logger logger = LoggerFactory.getLogger(LoginController.class);
@GetMapping("/register")
public String showRegister(ModelMap map) {
return "register";
}
@PostMapping("/register")
public String submitRegister(@RequestParam("email") String email, @RequestParam("password") String password, @RequestParam("confirm_password") String password2) {
if(email.length()==0 || password.length()==0 || password2.length()==0) {
if(email.length()==0) throw new EmptyFormFieldException();
if(password.length()==0) throw new EmptyFormFieldException();
if(password2.length()==0) throw new EmptyFormFieldException();
} else {
if(password.length() < 8) throw new PasswordRequirementsNotMetException();
if(!password.equals(password2)) throw new PasswordMismatchException();
Optional<User> foundUser = userService.GetUserByEmail(email);
if (foundUser.isPresent()) throw new UserAlreadyExistsException();
User user = new User();
user.setEmail(email);
user.setPassword(password);
userService.UpdateUser(user);
}
return "redirect:/register/success";
}
@GetMapping(value = "/register/success")
public ResponseEntity<Object> registerSuccess(ModelMap model) {
String response = "";
response += "<h2>You have successfully registered!</h2>";
response += "<p>Click the link below to return to our home page.</p>";
response += "<a href=\"/\">Return Home</a>";
return new ResponseEntity<>(response, HttpStatus.OK);
}
}
|
923fc850f99c63bc276fd1f0c7a66ee531228051
| 1,004 |
java
|
Java
|
platform/usageView/src/com/intellij/usages/UsageSearcher.java
|
liveqmock/platform-tools-idea
|
1c4b76108add6110898a7e3f8f70b970e352d3d4
|
[
"Apache-2.0"
] | 2 |
2015-05-08T15:07:10.000Z
|
2022-03-09T05:47:53.000Z
|
platform/usageView/src/com/intellij/usages/UsageSearcher.java
|
lshain-android-source/tools-idea
|
b37108d841684bcc2af45a2539b75dd62c4e283c
|
[
"Apache-2.0"
] | null | null | null |
platform/usageView/src/com/intellij/usages/UsageSearcher.java
|
lshain-android-source/tools-idea
|
b37108d841684bcc2af45a2539b75dd62c4e283c
|
[
"Apache-2.0"
] | 2 |
2017-04-24T15:48:40.000Z
|
2022-03-09T05:48:05.000Z
| 33.466667 | 75 | 0.751992 | 1,001,284 |
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* 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.intellij.usages;
import com.intellij.util.Generator;
import com.intellij.util.Processor;
import org.jetbrains.annotations.NotNull;
/**
* @author max
*/
public interface UsageSearcher extends Generator<Usage> {
// hands all found usages to the processor
// not guaranteed to be in read action, not guaranteed in the same thread
void generate(@NotNull Processor<Usage> processor);
}
|
923fc8953ded015c3d07daa86513d8bb44d2aba1
| 421 |
java
|
Java
|
testing/mokito/src/main/java/daggerok/MokitoApplication.java
|
daggerok/spring-examples
|
918817bc9895798c710034b38bfdf97384168d25
|
[
"MIT"
] | null | null | null |
testing/mokito/src/main/java/daggerok/MokitoApplication.java
|
daggerok/spring-examples
|
918817bc9895798c710034b38bfdf97384168d25
|
[
"MIT"
] | null | null | null |
testing/mokito/src/main/java/daggerok/MokitoApplication.java
|
daggerok/spring-examples
|
918817bc9895798c710034b38bfdf97384168d25
|
[
"MIT"
] | null | null | null | 26.3125 | 68 | 0.824228 | 1,001,285 |
package daggerok;
import daggerok.random.RetryConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;
@SpringBootApplication
@Import(RetryConfig.class)
public class MokitoApplication {
public static void main(String[] args) {
SpringApplication.run(MokitoApplication.class, args);
}
}
|
923fca6714cbdd4a1324056233f284a55e8a0c29
| 1,025 |
java
|
Java
|
src/main/java/de/sh00ckbass/minecraft/flytime/config/Config.java
|
Sh00ckBass/FlyTime
|
771384651822b11075ce5d71dbd2bbe3b0274f22
|
[
"MIT"
] | null | null | null |
src/main/java/de/sh00ckbass/minecraft/flytime/config/Config.java
|
Sh00ckBass/FlyTime
|
771384651822b11075ce5d71dbd2bbe3b0274f22
|
[
"MIT"
] | null | null | null |
src/main/java/de/sh00ckbass/minecraft/flytime/config/Config.java
|
Sh00ckBass/FlyTime
|
771384651822b11075ce5d71dbd2bbe3b0274f22
|
[
"MIT"
] | null | null | null | 27.052632 | 67 | 0.724708 | 1,001,286 |
package de.sh00ckbass.minecraft.flytime.config;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/*******************************************************
* Copyright (C) Sh00ckBass [email protected]
*
* This file is part of FlyTime and was created at the 19.12.2021
*
* FlyTime can not be copied and/or distributed without the express
* permission of the owner.
*
*/
@AllArgsConstructor
@Getter
@Setter
public class Config {
private final int price;
private final boolean onlyInAir;
private final String noFlyTime;
private final String flyActivated;
private final String flyDisabled;
private final String removedTimePlayer;
private final String removedTimeTarget;
private final String addedTimePlayer;
private final String addedTimeTarget;
private final String notEnoughMoney;
private final String successfullyBought;
private final String timeLeft;
private final String flyDisabledNoMoreTime;
private final String actionBar;
}
|
923fca9db0b274490a071a77a5d6374eb6bf9bd8
| 622 |
java
|
Java
|
src/com/qind/weather/activity/WeatherInfoFragment.java
|
CodeReverse/SunshineWeather
|
6f71e8ff52591ae5e217058ca9884cd8848ab868
|
[
"Apache-2.0"
] | null | null | null |
src/com/qind/weather/activity/WeatherInfoFragment.java
|
CodeReverse/SunshineWeather
|
6f71e8ff52591ae5e217058ca9884cd8848ab868
|
[
"Apache-2.0"
] | null | null | null |
src/com/qind/weather/activity/WeatherInfoFragment.java
|
CodeReverse/SunshineWeather
|
6f71e8ff52591ae5e217058ca9884cd8848ab868
|
[
"Apache-2.0"
] | null | null | null | 22.214286 | 71 | 0.789389 | 1,001,287 |
package com.qind.weather.activity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.qind.weather.R;
public class WeatherInfoFragment extends Fragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.weather_info, container);
}
@Override
public void onDestroyView() {
super.onDestroyView();
}
}
|
923fcad99ea0cd971b0e6bb9fc59368447018e4d
| 925 |
java
|
Java
|
teavm-core/src/main/java/org/teavm/debugging/javascript/JavaScriptValue.java
|
giko/teavm
|
8a9ea907ed112d1a8e9e397ca3052654cdeaca2f
|
[
"Apache-2.0"
] | 1 |
2021-02-05T10:04:26.000Z
|
2021-02-05T10:04:26.000Z
|
teavm-core/src/main/java/org/teavm/debugging/javascript/JavaScriptValue.java
|
giko/teavm
|
8a9ea907ed112d1a8e9e397ca3052654cdeaca2f
|
[
"Apache-2.0"
] | 1 |
2021-06-17T12:47:32.000Z
|
2021-06-17T12:47:32.000Z
|
teavm-core/src/main/java/org/teavm/debugging/javascript/JavaScriptValue.java
|
giko/teavm
|
8a9ea907ed112d1a8e9e397ca3052654cdeaca2f
|
[
"Apache-2.0"
] | null | null | null | 26.428571 | 76 | 0.72 | 1,001,288 |
/*
* Copyright 2014 Alexey Andreev.
*
* 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.teavm.debugging.javascript;
import java.util.Map;
/**
*
* @author Alexey Andreev
*/
public interface JavaScriptValue {
String getRepresentation();
String getClassName();
Map<String, JavaScriptVariable> getProperties();
boolean hasInnerStructure();
String getInstanceId();
}
|
923fcb3d2b6be6b5e6cb73000e22a289e8402b09
| 2,689 |
java
|
Java
|
gulimall-third-party/src/main/java/com/zhanfan/gulimall/thirdparty/controller/OssController.java
|
zhanfan9812/JavaStudy
|
82a1f035d9e44aefc4ece0a99447a060542e8437
|
[
"Apache-2.0"
] | null | null | null |
gulimall-third-party/src/main/java/com/zhanfan/gulimall/thirdparty/controller/OssController.java
|
zhanfan9812/JavaStudy
|
82a1f035d9e44aefc4ece0a99447a060542e8437
|
[
"Apache-2.0"
] | null | null | null |
gulimall-third-party/src/main/java/com/zhanfan/gulimall/thirdparty/controller/OssController.java
|
zhanfan9812/JavaStudy
|
82a1f035d9e44aefc4ece0a99447a060542e8437
|
[
"Apache-2.0"
] | null | null | null | 35.381579 | 100 | 0.672369 | 1,001,289 |
package com.zhanfan.gulimall.thirdparty.controller;
import com.aliyun.oss.OSS;
import com.aliyun.oss.common.utils.BinaryUtil;
import com.aliyun.oss.model.MatchMode;
import com.aliyun.oss.model.PolicyConditions;
import com.zhanfan.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author :zhanfan
* @date :Created in 2021/1/11 14:54
*/
@RestController
public class OssController {
@Autowired
OSS ossClient;
@Value("${spring.cloud.alicloud.oss.endpoint}")
String endpoint ;
@Value("${spring.cloud.alicloud.oss.bucket}")
String bucket ;
@Value("${spring.cloud.alicloud.access-key}")
String accessId ;
@Value("${spring.cloud.alicloud.secret-key}")
String accessKey ;
//获取OSS签名
@RequestMapping("/oss/policy")
public R policy(){
String host = "https://" + bucket + "." + endpoint; // host的格式为 bucketname.endpoint
String format = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
Map<String, String> respMap=null;
try {
long expireTime = 30;
long expireEndTime = System.currentTimeMillis() + expireTime * 1000;
Date expiration = new Date(expireEndTime);
PolicyConditions policyConds = new PolicyConditions();
policyConds.addConditionItem(PolicyConditions.COND_CONTENT_LENGTH_RANGE, 0, 1048576000);
policyConds.addConditionItem(MatchMode.StartWith, PolicyConditions.COND_KEY, format);
String postPolicy = ossClient.generatePostPolicy(expiration, policyConds);
byte[] binaryData = postPolicy.getBytes("utf-8");
String encodedPolicy = BinaryUtil.toBase64String(binaryData);
String postSignature = ossClient.calculatePostSignature(postPolicy);
respMap= new LinkedHashMap<String, String>();
respMap.put("accessid", accessId);
respMap.put("policy", encodedPolicy);
respMap.put("signature", postSignature);
respMap.put("dir", format);
respMap.put("host", host);
respMap.put("expire", String.valueOf(expireEndTime / 1000));
} catch (Exception e) {
// Assert.fail(e.getMessage());
System.out.println(e.getMessage());
} finally {
ossClient.shutdown();
}
return R.ok().put("data",respMap);
}
}
|
923fcbb4ccf642187bb854038a99236d8408ccf0
| 1,758 |
java
|
Java
|
common/common-generator/src/main/java/com/pg85/otg/gen/resource/SeaPickleResource.java
|
evernife/OpenTerrainGenerator
|
9b6bed00e50b71511b3004e4600ff2a6651ae21c
|
[
"MIT"
] | 175 |
2017-04-17T01:37:52.000Z
|
2022-02-21T17:40:17.000Z
|
common/common-generator/src/main/java/com/pg85/otg/gen/resource/SeaPickleResource.java
|
evernife/OpenTerrainGenerator
|
9b6bed00e50b71511b3004e4600ff2a6651ae21c
|
[
"MIT"
] | 729 |
2017-04-23T15:53:51.000Z
|
2022-03-15T03:54:15.000Z
|
common/common-generator/src/main/java/com/pg85/otg/gen/resource/SeaPickleResource.java
|
evernife/OpenTerrainGenerator
|
9b6bed00e50b71511b3004e4600ff2a6651ae21c
|
[
"MIT"
] | 123 |
2017-04-30T15:53:56.000Z
|
2022-03-15T19:15:07.000Z
| 28.819672 | 148 | 0.720137 | 1,001,290 |
package com.pg85.otg.gen.resource;
import java.util.List;
import java.util.Random;
import com.pg85.otg.exceptions.InvalidConfigException;
import com.pg85.otg.interfaces.IBiomeConfig;
import com.pg85.otg.interfaces.ILogger;
import com.pg85.otg.interfaces.IMaterialReader;
import com.pg85.otg.interfaces.IWorldGenRegion;
import com.pg85.otg.util.materials.LocalMaterialData;
import com.pg85.otg.util.materials.LocalMaterials;
import com.pg85.otg.util.materials.MaterialProperties;
public class SeaPickleResource extends FrequencyResourceBase
{
private final int attempts;
public SeaPickleResource(IBiomeConfig biomeConfig, List<String> args, ILogger logger, IMaterialReader materialReader) throws InvalidConfigException
{
super(biomeConfig, args, logger, materialReader);
this.frequency = readInt(args.get(0), 1, 500);
this.rarity = readRarity(args.get(1));
this.attempts = readInt(args.get(2), 1, 256);
}
@Override
public void spawn(IWorldGenRegion world, Random random, int x, int z)
{
int dx;
int dz;
int y;
LocalMaterialData bottom;
LocalMaterialData here;
for (int i = 0; i < this.attempts; i++)
{
dx = x + random.nextInt(8) - random.nextInt(8);
dz = z + random.nextInt(8) - random.nextInt(8);
y = world.getBlockAboveSolidHeight(dx, dz);
bottom = world.getMaterial(dx, y - 1, dz);
here = world.getMaterial(dx, y, dz);
if (bottom == null || here == null)
{
continue;
}
if (bottom.isSolid() && here.isLiquid())
{
world.setBlock(dx, y, dz, LocalMaterials.SEA_PICKLE.withProperty(MaterialProperties.PICKLES_1_4, random.nextInt(4) + 1));
}
}
}
@Override
public String toString()
{
return "SeaPickle(" + this.frequency + "," + this.rarity + "," + this.attempts + ")";
}
}
|
923fcbe424aeca0fd2ddbc3a39f5aed0e8c13f35
| 342 |
java
|
Java
|
quizzy/app/src/main/java/com/example/quizzy/QuestionsActivity.java
|
stevinho29/Quizzy-android-app
|
d97ca7c9bfbfeddb455cea51fffdec5619017e93
|
[
"Unlicense"
] | null | null | null |
quizzy/app/src/main/java/com/example/quizzy/QuestionsActivity.java
|
stevinho29/Quizzy-android-app
|
d97ca7c9bfbfeddb455cea51fffdec5619017e93
|
[
"Unlicense"
] | null | null | null |
quizzy/app/src/main/java/com/example/quizzy/QuestionsActivity.java
|
stevinho29/Quizzy-android-app
|
d97ca7c9bfbfeddb455cea51fffdec5619017e93
|
[
"Unlicense"
] | null | null | null | 22.8 | 58 | 0.766082 | 1,001,291 |
package com.example.quizzy;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class QuestionsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_questions);
}
}
|
923fcd439a5c2dfb7de2a3c2fd1c5dbc96879fae
| 2,489 |
java
|
Java
|
basex-core/src/main/java/org/basex/query/expr/gflwor/Count.java
|
jbrazda/basex
|
ca6ea437bbee1b239fabbc4c280da978f8494e4e
|
[
"BSD-3-Clause"
] | 441 |
2015-01-05T09:33:58.000Z
|
2022-03-24T12:57:45.000Z
|
basex-core/src/main/java/org/basex/query/expr/gflwor/Count.java
|
jbrazda/basex
|
ca6ea437bbee1b239fabbc4c280da978f8494e4e
|
[
"BSD-3-Clause"
] | 977 |
2015-01-06T11:18:14.000Z
|
2022-03-31T11:13:15.000Z
|
basex-core/src/main/java/org/basex/query/expr/gflwor/Count.java
|
jbrazda/basex
|
ca6ea437bbee1b239fabbc4c280da978f8494e4e
|
[
"BSD-3-Clause"
] | 276 |
2015-01-21T07:03:59.000Z
|
2022-03-11T21:35:17.000Z
| 20.570248 | 80 | 0.652069 | 1,001,292 |
package org.basex.query.expr.gflwor;
import static org.basex.query.QueryText.*;
import org.basex.query.*;
import org.basex.query.util.*;
import org.basex.query.value.item.*;
import org.basex.query.value.type.*;
import org.basex.query.var.*;
import org.basex.util.hash.*;
/**
* GFLWOR {@code count} clause.
*
* @author BaseX Team 2005-21, BSD License
* @author Leo Woerteler
*/
public final class Count extends Clause {
/** Count variable. */
final Var var;
/**
* Constructor.
* @param var variable
*/
public Count(final Var var) {
super(var.info, SeqType.INTEGER_O, var);
this.var = var;
}
@Override
Eval eval(final Eval sub) {
return new Eval() {
private long i = 1;
@Override
public boolean next(final QueryContext qc) throws QueryException {
if(!sub.next(qc)) return false;
qc.set(var, Int.get(i++));
return true;
}
};
}
@Override
boolean skippable(final Clause cl) {
if(!super.skippable(cl)) return false;
// the clause should not change tuple counts
final long[] minMax = { 1, 1 };
cl.calcSize(minMax);
return minMax[0] == 1 && minMax[1] == 1;
}
@Override
public boolean has(final Flag... flags) {
return false;
}
@Override
public Count compile(final CompileContext cc) throws QueryException {
return optimize(cc);
}
@Override
public Count optimize(final CompileContext cc) throws QueryException {
var.refineType(seqType(), cc);
return this;
}
@Override
public boolean inlineable(final InlineContext v) {
return true;
}
@Override
public VarUsage count(final Var v) {
return VarUsage.NEVER;
}
@Override
public Clause inline(final InlineContext ic) {
return null;
}
@Override
public Count copy(final CompileContext cc, final IntObjMap<Var> vm) {
return copyType(new Count(cc.copy(var, vm)));
}
@Override
public boolean accept(final ASTVisitor visitor) {
return visitor.declared(var);
}
@Override
public void checkUp() {
// never
}
@Override
public int exprSize() {
return 0;
}
@Override
public boolean equals(final Object obj) {
return this == obj || obj instanceof Count && var.equals(((Count) obj).var);
}
@Override
public void toXml(final QueryPlan plan) {
plan.add(plan.attachVariable(plan.create(this), var, false));
}
@Override
public void toString(final QueryString qs) {
qs.token(COUNT).token(var);
}
}
|
923fcd96c8791eaea384a4a4451f026dc4f433a3
| 6,655 |
java
|
Java
|
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionEvictionDuringReadThroughSelfTest.java
|
brat-kuzma/ignite
|
d7148828f947728a5b46f4f39f36eca8b0e6e521
|
[
"CC0-1.0"
] | 4,339 |
2015-08-21T21:13:25.000Z
|
2022-03-30T09:56:44.000Z
|
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionEvictionDuringReadThroughSelfTest.java
|
brat-kuzma/ignite
|
d7148828f947728a5b46f4f39f36eca8b0e6e521
|
[
"CC0-1.0"
] | 1,933 |
2015-08-24T11:37:40.000Z
|
2022-03-31T08:37:08.000Z
|
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionEvictionDuringReadThroughSelfTest.java
|
brat-kuzma/ignite
|
d7148828f947728a5b46f4f39f36eca8b0e6e521
|
[
"CC0-1.0"
] | 2,140 |
2015-08-21T22:09:00.000Z
|
2022-03-25T07:57:34.000Z
| 35.026316 | 125 | 0.639519 | 1,001,293 |
/*
* 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.ignite.internal.processors.cache.distributed;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.cache.Cache;
import javax.cache.configuration.Factory;
import javax.cache.expiry.CreatedExpiryPolicy;
import javax.cache.expiry.Duration;
import javax.cache.integration.CacheLoaderException;
import javax.cache.integration.CacheWriterException;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
/**
*
*/
public class GridCachePartitionEvictionDuringReadThroughSelfTest extends GridCommonAbstractTest {
/** Failing key. */
private static final int FAILING_KEY = 3;
/** Data read grid index. */
private static final int DATA_READ_GRID_IDX = 0;
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
CacheConfiguration<Integer, Integer> ccfg =
new CacheConfiguration<Integer, Integer>()
.setName("config")
.setAtomicityMode(CacheAtomicityMode.ATOMIC)
.setBackups(0) // No need for backup, just load from the store if needed
.setCacheStoreFactory(new CacheStoreFactory())
.setOnheapCacheEnabled(true)
.setEvictionPolicy(new LruEvictionPolicy(100))
.setNearConfiguration(new NearCacheConfiguration<Integer, Integer>()
.setNearEvictionPolicy(new LruEvictionPolicy<Integer, Integer>()));
ccfg.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.MINUTES, 1)))
.setReadThrough(true)
.setWriteThrough(false);
cfg.setCacheConfiguration(ccfg);
return cfg;
}
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
stopAllGrids();
}
/**
* @throws Exception if failed.
*/
@Test
public void testPartitionRent() throws Exception {
startGrid(DATA_READ_GRID_IDX);
final AtomicBoolean done = new AtomicBoolean();
IgniteInternalFuture<Long> gridAndCacheAccessFut = GridTestUtils.runMultiThreadedAsync(new Callable<Integer>() {
@Override public Integer call() throws Exception {
final Set<Integer> keysSet = new LinkedHashSet<>();
keysSet.add(1);
keysSet.add(2);
keysSet.add(FAILING_KEY);
keysSet.add(4);
keysSet.add(5);
while (!done.get()) {
try {
grid(DATA_READ_GRID_IDX).<Integer, Integer>cache("config").getAll(keysSet);
}
catch (Throwable ignore) {
// No-op.
}
if (Thread.currentThread().isInterrupted()) {
throw new IgniteInterruptedCheckedException(
"Execution of [" + Thread.currentThread().getName() + "] Interrupted. Test is probably timed out"
);
}
}
return null;
}
}, 4, "loader");
IgniteInternalFuture<Void> startFut = GridTestUtils.runAsync(new Callable<Void>() {
@Override public Void call() throws Exception {
for (int i = 1; i < 5; i++) {
startGrid(i);
awaitPartitionMapExchange();
}
return null;
}
});
try {
startFut.get();
}
catch (Exception e) {
gridAndCacheAccessFut.cancel();
U.error(log, e);
throw e;
}
done.set(true);
gridAndCacheAccessFut.get();
}
/**
*
*/
private static class CacheStoreFactory implements Factory<CacheStore<Integer, Integer>> {
/** {@inheritDoc} */
@Override public CacheStore<Integer, Integer> create() {
return new HangingCacheStore();
}
}
/**
*
*/
private static class HangingCacheStore extends CacheStoreAdapter<Integer, Integer> {
/** {@inheritDoc} */
@Override public Integer load(Integer key) throws CacheLoaderException {
if (key == FAILING_KEY)
throw new TestCacheLoaderExpectedException();
return key;
}
/** {@inheritDoc} */
@Override public void write(Cache.Entry<? extends Integer, ? extends Integer> entry) throws CacheWriterException {
}
/** {@inheritDoc} */
@Override public void delete(Object key) throws CacheWriterException {
}
}
/**
*
*/
private static class TestCacheLoaderExpectedException extends CacheLoaderException {
/** {@inheritDoc} to reduce amount of logging, trace is not filled */
@Override public synchronized Throwable fillInStackTrace() {
return this;
}
}
}
|
923fcd9f2ff50a57e0ea99b1d7e527398bcfbb99
| 1,215 |
java
|
Java
|
smoothness-weblib/src/main/java/org/jlab/smoothness/presentation/filter/AuditContext.java
|
JeffersonLab/smoothness
|
9f9738848a03448285932ab1b741029c64aabc49
|
[
"MIT"
] | null | null | null |
smoothness-weblib/src/main/java/org/jlab/smoothness/presentation/filter/AuditContext.java
|
JeffersonLab/smoothness
|
9f9738848a03448285932ab1b741029c64aabc49
|
[
"MIT"
] | null | null | null |
smoothness-weblib/src/main/java/org/jlab/smoothness/presentation/filter/AuditContext.java
|
JeffersonLab/smoothness
|
9f9738848a03448285932ab1b741029c64aabc49
|
[
"MIT"
] | null | null | null | 20.59322 | 89 | 0.604115 | 1,001,294 |
package org.jlab.smoothness.presentation.filter;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author ryans
*/
public class AuditContext {
private Map<String, Object> extra = new HashMap<>();
private String username;
private String ip;
public String getIp() {
return ip;
}
protected void setIp(String ip) {
this.ip = ip;
}
public String getUsername() {
return username;
}
public Object getExtra(String key) {
return extra.get(key);
}
public Object putExtra(String key, Object value) {
return extra.put(key, value);
}
protected void setUsername(String username) {
this.username = username;
}
private static ThreadLocal<AuditContext> instance = new ThreadLocal<AuditContext>() {
@Override
protected AuditContext initialValue() {
return null;
}
};
public static AuditContext getCurrentInstance() {
return instance.get();
}
protected static void setCurrentInstance(AuditContext context) {
if (context == null) {
instance.remove();
} else {
instance.set(context);
}
}
}
|
923fcdca621f5d500fadd2940fb7b8c7f20b7dad
| 2,926 |
java
|
Java
|
app/src/main/java/de/uni_stuttgart/informatik/sopra/sopraapp/ui/adminui/riddle/editRiddle/puzzleAnswer/answerElements/LocationFragment.java
|
GeoCodingApp/geocoding
|
7022421b7890fae1014d8055949c06c3b3246d39
|
[
"MIT"
] | null | null | null |
app/src/main/java/de/uni_stuttgart/informatik/sopra/sopraapp/ui/adminui/riddle/editRiddle/puzzleAnswer/answerElements/LocationFragment.java
|
GeoCodingApp/geocoding
|
7022421b7890fae1014d8055949c06c3b3246d39
|
[
"MIT"
] | null | null | null |
app/src/main/java/de/uni_stuttgart/informatik/sopra/sopraapp/ui/adminui/riddle/editRiddle/puzzleAnswer/answerElements/LocationFragment.java
|
GeoCodingApp/geocoding
|
7022421b7890fae1014d8055949c06c3b3246d39
|
[
"MIT"
] | null | null | null | 30.8 | 135 | 0.668489 | 1,001,295 |
package de.uni_stuttgart.informatik.sopra.sopraapp.ui.adminui.riddle.editRiddle.puzzleAnswer.answerElements;
import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.EditText;
import android.widget.Toast;
import de.uni_stuttgart.informatik.sopra.sopraapp.R;
import de.uni_stuttgart.informatik.sopra.sopraapp.ui.adminui.riddle.editRiddle.puzzleAnswer.AnswerActivity;
/**
* @author MikeAshi
*/
public class LocationFragment extends DialogFragment {
private static final String TAG = "LocationFragment";
private String lon, lat;
private EditText mLatitude;
private EditText mLongitude;
private boolean update = false;
private int pos;
private View rootView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_answer_location, container, false);
(rootView.findViewById(R.id.button_close)).setOnClickListener(v -> dismiss());
(rootView.findViewById(R.id.button_save)).setOnClickListener(v -> {
save();
});
mLatitude = rootView.findViewById(R.id.answer_latitude);
mLongitude = rootView.findViewById(R.id.answer_longitude);
mLatitude.requestFocus();
//
if (lon != null) {
mLatitude.setText(lat);
mLongitude.setText(lon);
}
//
return rootView;
}
@Override
public void onDestroyView() {
super.onDestroyView();
rootView.clearFocus();
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
return dialog;
}
private void save() {
if (mLatitude.getText().toString().equals("") || mLongitude.getText().toString().equals("")) {
Toast.makeText(getContext(), getString(R.string.answer_location_error), Toast.LENGTH_LONG).show();
return;
}
if (update) {
// update
((AnswerActivity) getActivity()).updateLocation(mLatitude.getText().toString(), mLongitude.getText().toString(), this.pos);
} else {
((AnswerActivity) getActivity()).addLocation(mLatitude.getText().toString(), mLongitude.getText().toString());
}
dismiss();
}
public void setUpdate(boolean update) {
this.update = update;
}
public void setPos(int pos) {
this.pos = pos;
}
public void setLon(String lon) {
this.lon = lon;
}
public void setLat(String lat) {
this.lat = lat;
}
}
|
923fcfcf56b25f7893528b6ed26593c2095c6ce7
| 2,037 |
java
|
Java
|
xchange-enigma/src/main/java/org/knowm/xchange/enigma/service/EnigmaMarketDataServiceRaw.java
|
martinkyov/XChange
|
46b08e5ed74dd58ab472740fc4e75ee5194b56df
|
[
"MIT"
] | 1,909 |
2015-01-01T16:52:44.000Z
|
2018-04-05T17:08:44.000Z
|
xchange-enigma/src/main/java/org/knowm/xchange/enigma/service/EnigmaMarketDataServiceRaw.java
|
hsmirnoff/XChange
|
652f33ea4156a1391122f4b289d61b2c1dbe8aca
|
[
"MIT"
] | 1,021 |
2015-01-05T08:04:27.000Z
|
2018-04-05T20:28:50.000Z
|
xchange-enigma/src/main/java/org/knowm/xchange/enigma/service/EnigmaMarketDataServiceRaw.java
|
hsmirnoff/XChange
|
652f33ea4156a1391122f4b289d61b2c1dbe8aca
|
[
"MIT"
] | 957 |
2015-01-02T21:20:27.000Z
|
2018-04-05T12:10:04.000Z
| 36.375 | 95 | 0.743741 | 1,001,296 |
package org.knowm.xchange.enigma.service;
import java.io.IOException;
import java.util.List;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.currency.CurrencyPair;
import org.knowm.xchange.enigma.dto.marketdata.EnigmaOrderBook;
import org.knowm.xchange.enigma.dto.marketdata.EnigmaProduct;
import org.knowm.xchange.enigma.dto.marketdata.EnigmaProductMarketData;
import org.knowm.xchange.enigma.dto.marketdata.EnigmaTicker;
import org.knowm.xchange.enigma.dto.marketdata.EnigmaTransaction;
import org.knowm.xchange.enigma.model.EnigmaException;
public class EnigmaMarketDataServiceRaw extends EnigmaBaseService {
public EnigmaMarketDataServiceRaw(Exchange exchange) {
super(exchange);
}
public EnigmaProductMarketData getProductMarketData(int productId) throws IOException {
return this.enigmaAuthenticated.getProductMarketData(accessToken(), productId);
}
public List<EnigmaProduct> getProducts() throws IOException {
return this.enigmaAuthenticated.getProducts(accessToken());
}
public EnigmaTicker getEnigmaTicker(CurrencyPair currencyPair) throws IOException {
List<EnigmaProduct> products = getProducts();
Integer productId =
products.stream()
.filter(
product ->
product.getProductName().equals(currencyPair.toString().replace("/", "-")))
.map(EnigmaProduct::getProductId)
.findFirst()
.orElseThrow(() -> new EnigmaException("Currency pair not found"));
return this.enigmaAuthenticated.getTicker(accessToken(), productId);
}
public EnigmaOrderBook getEnigmaOrderBook(String pair) throws IOException {
return this.enigmaAuthenticated.getOrderBook(accessToken(), pair);
}
public EnigmaTransaction[] getEnigmaTransactions() throws IOException {
return this.enigmaAuthenticated.getTransactions(
accessToken(),
this.exchange
.getExchangeSpecification()
.getExchangeSpecificParametersItem("infra")
.toString());
}
}
|
923fd0024c85752c3fc0fb7e8e23cd296cc7268a
| 1,493 |
java
|
Java
|
demo-api/src/main/java/com/demo/Result.java
|
yuhong151885/fescar-demo
|
21d26fd0e6a4be46f2a3809e853f5103b9a0dba9
|
[
"Apache-2.0"
] | null | null | null |
demo-api/src/main/java/com/demo/Result.java
|
yuhong151885/fescar-demo
|
21d26fd0e6a4be46f2a3809e853f5103b9a0dba9
|
[
"Apache-2.0"
] | null | null | null |
demo-api/src/main/java/com/demo/Result.java
|
yuhong151885/fescar-demo
|
21d26fd0e6a4be46f2a3809e853f5103b9a0dba9
|
[
"Apache-2.0"
] | null | null | null | 27.145455 | 77 | 0.681849 | 1,001,297 |
/*
* Copyright 2019 JDSchool 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 com.demo;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.apache.http.HttpStatus;
import java.io.Serializable;
/**
* Title: Result
* Description: TODO(这里用一句话描述这个类的作用)
*
* @author yuhong
* @Company com.jdschool
* @date 2019/2/1 17:17
*/
@Data
@AllArgsConstructor
public class Result implements Serializable {
private static final long serialVersionUID = 3530785027340191948L;
private Integer code;
private String msg;
private Object data;
public static Result bulid(Integer code, String msg, Object data) {
return new Result(code, msg, data);
}
public static Result ok(String msg, Object data) {
return new Result(HttpStatus.SC_OK, msg, data);
}
public static Result ok() {
return new Result(HttpStatus.SC_OK, "ok", null);
}
}
|
923fd0f1b2535bbdef40a090051dad9014f74ee7
| 322 |
java
|
Java
|
src/strategy/MallardDuck.java
|
RayKr/DesignModeler
|
b349545fb31cf040389aafe1b4110ed3a58e9341
|
[
"MIT"
] | null | null | null |
src/strategy/MallardDuck.java
|
RayKr/DesignModeler
|
b349545fb31cf040389aafe1b4110ed3a58e9341
|
[
"MIT"
] | null | null | null |
src/strategy/MallardDuck.java
|
RayKr/DesignModeler
|
b349545fb31cf040389aafe1b4110ed3a58e9341
|
[
"MIT"
] | null | null | null | 16.947368 | 41 | 0.596273 | 1,001,298 |
package strategy;
/**
* Created by Ray on 2016/2/14.
*/
public class MallardDuck extends Duck {
public MallardDuck() {
// 在构造函数初始化的时候,指定本类采用哪种策略
qucakBehavior = new Quack();
flyBehavior = new FlyWithWings();
}
public void display() {
System.out.println("我是绿头鸭!");
}
}
|
923fd2600f94c011f6aaef7e39fbde116c916a7d
| 1,994 |
java
|
Java
|
src/tunit/support/sdk/tunit/src/com/rincon/tunit/link/TUnitProcessing_Events.java
|
tinyos-io/tinyos-tunit
|
8557cb72b0afe722b5b69e8759555f740c82a7cc
|
[
"MIT"
] | 1 |
2020-02-28T20:35:09.000Z
|
2020-02-28T20:35:09.000Z
|
src/tunit/support/sdk/tunit/src/com/rincon/tunit/link/TUnitProcessing_Events.java
|
tinyos-io/tinyos-tunit
|
8557cb72b0afe722b5b69e8759555f740c82a7cc
|
[
"MIT"
] | null | null | null |
src/tunit/support/sdk/tunit/src/com/rincon/tunit/link/TUnitProcessing_Events.java
|
tinyos-io/tinyos-tunit
|
8557cb72b0afe722b5b69e8759555f740c82a7cc
|
[
"MIT"
] | null | null | null | 38.346154 | 90 | 0.765296 | 1,001,299 |
package com.rincon.tunit.link;
/*
* Copyright (c) 2005-2006 Rincon Research Corporation
* All rights reserved.
*
* 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 the Rincon Research 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
* RINCON RESEARCH OR ITS 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
*/
/**
* Automatically Generated
*/
public interface TUnitProcessing_Events {
public void tUnitProcessing_pong();
public void tUnitProcessing_testSuccess(short testId, short assertionId);
public void tUnitProcessing_testFailed(short testId, short assertionId, String failMsg);
public void tUnitProcessing_allDone();
}
|
923fd263bcd4e809957e54d95d6b885b038bb2a7
| 1,049 |
java
|
Java
|
aws-blog-kinesis-producer-library/src/main/java/com/amazonaws/services/kinesis/producer/demo/AbstractClickEventsToKinesis.java
|
angeltux/aws-big-data-blog
|
6f4f9af564872dc0caf80a5c0be6276acee02d3b
|
[
"Apache-2.0"
] | 305 |
2018-03-29T10:45:51.000Z
|
2022-03-15T16:01:19.000Z
|
aws-blog-kinesis-producer-library/src/main/java/com/amazonaws/services/kinesis/producer/demo/AbstractClickEventsToKinesis.java
|
angeltux/aws-big-data-blog
|
6f4f9af564872dc0caf80a5c0be6276acee02d3b
|
[
"Apache-2.0"
] | 14 |
2018-04-26T19:06:35.000Z
|
2022-02-26T10:50:19.000Z
|
aws-blog-kinesis-producer-library/src/main/java/com/amazonaws/services/kinesis/producer/demo/AbstractClickEventsToKinesis.java
|
angeltux/aws-big-data-blog
|
6f4f9af564872dc0caf80a5c0be6276acee02d3b
|
[
"Apache-2.0"
] | 204 |
2018-03-26T23:43:30.000Z
|
2022-03-20T17:04:41.000Z
| 26.225 | 72 | 0.64919 | 1,001,300 |
package com.amazonaws.services.kinesis.producer.demo;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.atomic.AtomicLong;
public abstract class AbstractClickEventsToKinesis implements Runnable {
protected final static String STREAM_NAME = "myStream";
protected final static String REGION = "us-east-1";
protected final BlockingQueue<ClickEvent> inputQueue;
protected volatile boolean shutdown = false;
protected final AtomicLong recordsPut = new AtomicLong(0);
protected AbstractClickEventsToKinesis(
BlockingQueue<ClickEvent> inputQueue) {
this.inputQueue = inputQueue;
}
@Override
public void run() {
while (!shutdown) {
try {
runOnce();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public long recordsPut() {
return recordsPut.get();
}
public void stop() {
shutdown = true;
}
protected abstract void runOnce() throws Exception;
}
|
923fd3fada1aa1ec2778c985e07d7a65ce61ebb0
| 1,944 |
java
|
Java
|
hello-mockito/src/test/java/shuaicj/hello/mockito/PowerMockTest.java
|
shuaicj/hello-java
|
4cbba8f6779ad257626671a822c993ca35b22fea
|
[
"MIT"
] | 1 |
2019-12-29T23:10:07.000Z
|
2019-12-29T23:10:07.000Z
|
hello-mockito/src/test/java/shuaicj/hello/mockito/PowerMockTest.java
|
shuaicj/hello-java
|
4cbba8f6779ad257626671a822c993ca35b22fea
|
[
"MIT"
] | 1 |
2021-03-31T19:16:40.000Z
|
2021-03-31T19:16:40.000Z
|
hello-mockito/src/test/java/shuaicj/hello/mockito/PowerMockTest.java
|
shuaicj/hello-java
|
4cbba8f6779ad257626671a822c993ca35b22fea
|
[
"MIT"
] | null | null | null | 31.354839 | 69 | 0.690329 | 1,001,301 |
package shuaicj.hello.mockito;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.anyString;
import static org.powermock.api.mockito.PowerMockito.mock;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
import static org.powermock.api.mockito.PowerMockito.spy;
import static org.powermock.api.mockito.PowerMockito.when;
import static org.powermock.api.mockito.PowerMockito.whenNew;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
/**
* Test the library powermock.
*
* @author shuaicj 2018/10/30
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest(User.class)
public class PowerMockTest {
@Test
public void testCtorWithNoArgs() throws Exception {
User u = mock(User.class);
when(u.getName()).thenReturn("aa");
whenNew(User.class).withNoArguments().thenReturn(u);
assertThat(new User().getName()).isEqualTo("aa");
}
@Test
public void testCtorWithArgs() throws Exception {
User u = mock(User.class);
when(u.getName()).thenReturn("bb");
whenNew(User.class).withArguments(anyString()).thenReturn(u);
assertThat(new User("cc").getName()).isEqualTo("bb");
}
@Test
public void testFinalMethod() {
User u = mock(User.class);
when(u.getName()).thenReturn("dd");
assertThat(u.getName()).isEqualTo("dd");
}
@Test
public void testStaticMethod() {
mockStatic(User.class);
when(User.getNameStatic(anyString())).thenReturn("ee");
assertThat(User.getNameStatic("ff")).isEqualTo("ee");
}
@Test
public void testPrivateMethod() throws Exception {
User u = spy(new User());
when(u, "getNamePrivate").thenReturn("ii");
assertThat(u.getNamePrivateProxy()).isEqualTo("ii");
}
}
|
923fd4f909954e19c7fdc1effdc5295636ed58b5
| 864 |
java
|
Java
|
api/src/main/java/com/percolate/sdk/api/request/media/release/MediaReleaseRequest.java
|
PanneerSelvamK/cg-percolate-sdk
|
25528220412f08f389a8a2e2e97e19c4a1ebab36
|
[
"BSD-3-Clause"
] | null | null | null |
api/src/main/java/com/percolate/sdk/api/request/media/release/MediaReleaseRequest.java
|
PanneerSelvamK/cg-percolate-sdk
|
25528220412f08f389a8a2e2e97e19c4a1ebab36
|
[
"BSD-3-Clause"
] | null | null | null |
api/src/main/java/com/percolate/sdk/api/request/media/release/MediaReleaseRequest.java
|
PanneerSelvamK/cg-percolate-sdk
|
25528220412f08f389a8a2e2e97e19c4a1ebab36
|
[
"BSD-3-Clause"
] | null | null | null | 27.870968 | 93 | 0.739583 | 1,001,302 |
package com.percolate.sdk.api.request.media.release;
import com.percolate.sdk.api.PercolateApi;
import com.percolate.sdk.api.utils.RetrofitApiFactory;
import com.percolate.sdk.dto.MediaReleaseResponse;
import org.jetbrains.annotations.NotNull;
import retrofit2.Call;
/**
* MediaRelease request proxy.
*/
@SuppressWarnings("unused")
public class MediaReleaseRequest {
private MediaReleaseService service;
public MediaReleaseRequest(@NotNull PercolateApi context) {
this.service = new RetrofitApiFactory(context).getService(MediaReleaseService.class);
}
/**
* Create media release.
*
* @param params API params.
* @return {@link MediaReleaseResponse} object.
*/
public Call<MediaReleaseResponse> create(@NotNull final MediaReleaseParams params) {
return service.create(params.getParams());
}
}
|
923fd556e07e500374f1588e1f4e4a5503fdbe34
| 155 |
java
|
Java
|
src/nl/hanze/gameserver/util/ILogOutput.java
|
IcyPalm/Hanze-TwoPlayerGameServer
|
1534dc8888a73d8b5861387f2ccbad79a6698bf2
|
[
"MIT"
] | 5 |
2016-03-23T09:27:28.000Z
|
2016-04-15T09:33:59.000Z
|
src/nl/hanze/gameserver/util/ILogOutput.java
|
IcyPalm/Hanze-TwoPlayerGameServer
|
1534dc8888a73d8b5861387f2ccbad79a6698bf2
|
[
"MIT"
] | 39 |
2016-03-24T11:06:52.000Z
|
2016-04-14T15:52:29.000Z
|
src/nl/hanze/gameserver/util/ILogOutput.java
|
IcyPalm/Hanze-TwoPlayerGameServer
|
1534dc8888a73d8b5861387f2ccbad79a6698bf2
|
[
"MIT"
] | 23 |
2016-03-22T10:30:18.000Z
|
2018-04-03T09:19:11.000Z
| 19.375 | 51 | 0.754839 | 1,001,303 |
package nl.hanze.gameserver.util;
public interface ILogOutput {
public void println(String msg);
public void printf(String format, Object... args);
}
|
923fd721e0ffef7f5120fde3c47c97af61d04eac
| 26,905 |
java
|
Java
|
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
|
DirectXceriD/apache-ignite
|
7972da93f7ca851642fe1fb52723b661e3c3933b
|
[
"Apache-2.0"
] | 36 |
2015-11-05T04:46:27.000Z
|
2021-12-29T08:26:02.000Z
|
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
|
gridgain/incubator-ignite
|
7972da93f7ca851642fe1fb52723b661e3c3933b
|
[
"Apache-2.0"
] | 13 |
2016-08-29T11:54:08.000Z
|
2020-12-08T08:47:04.000Z
|
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
|
gridgain/incubator-ignite
|
7972da93f7ca851642fe1fb52723b661e3c3933b
|
[
"Apache-2.0"
] | 15 |
2016-03-18T09:25:39.000Z
|
2021-10-01T05:49:39.000Z
| 30.027902 | 124 | 0.465378 | 1,001,304 |
/*
* 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.ignite.internal.processors.cache.distributed;
import org.apache.ignite.*;
import org.apache.ignite.cache.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.spi.discovery.tcp.*;
import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
import org.apache.ignite.testframework.junits.common.*;
import org.apache.ignite.transactions.*;
import javax.cache.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import static org.apache.ignite.configuration.CacheConfiguration.*;
import static org.apache.ignite.cache.CacheRebalanceMode.*;
import static org.apache.ignite.transactions.TransactionConcurrency.*;
import static org.apache.ignite.transactions.TransactionIsolation.*;
/**
* Test node restart.
*/
@SuppressWarnings({"PointlessArithmeticExpression"})
public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbstractTest {
/** Cache name. */
protected static final String CACHE_NAME = "TEST_CACHE";
/** */
private static final long TEST_TIMEOUT = 5 * 60 * 1000;
/** Default backups. */
private static final int DFLT_BACKUPS = 1;
/** Partitions. */
private static final int DFLT_PARTITIONS = 521;
/** Preload batch size. */
private static final int DFLT_BATCH_SIZE = DFLT_REBALANCE_BATCH_SIZE;
/** Number of key backups. Each test method can set this value as required. */
protected int backups = DFLT_BACKUPS;
/** */
private static final int DFLT_NODE_CNT = 4;
/** */
private static final int DFLT_KEY_CNT = 100;
/** */
private static final int DFLT_RETRIES = 10;
/** */
private static final Random RAND = new Random();
/** */
private static volatile int idx = -1;
/** Preload mode. */
protected CacheRebalanceMode preloadMode = ASYNC;
/** */
protected int preloadBatchSize = DFLT_BATCH_SIZE;
/** Number of partitions. */
protected int partitions = DFLT_PARTITIONS;
/** Node count. */
protected int nodeCnt = DFLT_NODE_CNT;
/** Key count. */
protected int keyCnt = DFLT_KEY_CNT;
/** Retries. */
private int retries = DFLT_RETRIES;
/** */
private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration c = super.getConfiguration(gridName);
// Discovery.
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
c.setDiscoverySpi(disco);
return c;
}
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
}
/** {@inheritDoc} */
@Override protected void afterTestsStopped() throws Exception {
stopAllGrids();
}
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
backups = DFLT_BACKUPS;
partitions = DFLT_PARTITIONS;
preloadMode = ASYNC;
preloadBatchSize = DFLT_BATCH_SIZE;
nodeCnt = DFLT_NODE_CNT;
keyCnt = DFLT_KEY_CNT;
retries = DFLT_RETRIES;
idx = -1;
}
/** {@inheritDoc} */
@Override protected long getTestTimeout() {
return TEST_TIMEOUT;
}
/**
* @throws Exception If failed.
*/
private void startGrids() throws Exception {
for (int i = 0; i < nodeCnt; i++) {
startGrid(i);
if (idx < 0)
idx = i;
}
}
/**
* @throws Exception If failed.
*/
public void testRestart() throws Exception {
preloadMode = SYNC;
partitions = 3;
nodeCnt = 2;
keyCnt = 10;
retries = 3;
info("*** STARTING TEST ***");
startGrids();
try {
IgniteCache<Integer, String> c = grid(idx).jcache(CACHE_NAME);
for (int j = 0; j < retries; j++) {
for (int i = 0; i < keyCnt; i++)
c.put(i, Integer.toString(i));
info("Stored items.");
checkGet(c, j);
info("Stopping node: " + idx);
stopGrid(idx);
info("Starting node: " + idx);
Ignite ignite = startGrid(idx);
c = ignite.jcache(CACHE_NAME);
checkGet(c, j);
}
}
finally {
stopAllGrids(true);
}
}
/**
* @param c Cache.
* @param attempt Attempt.
* @throws Exception If failed.
*/
private void checkGet(IgniteCache<Integer, String> c, int attempt) throws Exception {
for (int i = 0; i < keyCnt; i++) {
String v = c.get(i);
if (v == null) {
printFailureDetails(c, i, attempt);
fail("Value is null [key=" + i + ", attempt=" + attempt + "]");
}
if (!Integer.toString(i).equals(v)) {
printFailureDetails(c, i, attempt);
fail("Wrong value for key [key=" +
i + ", actual value=" + v + ", expected value=" + Integer.toString(i) + "]");
}
}
info("Read items.");
}
/**
* @return Transaction concurrency to use in tests.
*/
protected TransactionConcurrency txConcurrency() {
return PESSIMISTIC;
}
/**
* @throws Exception If failed.
*/
public void testRestartWithPutTwoNodesNoBackups() throws Throwable {
backups = 0;
nodeCnt = 2;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 30000;
checkRestartWithPut(duration, 1, 1);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithTxTwoNodesNoBackups() throws Throwable {
backups = 0;
nodeCnt = 2;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 30000;
checkRestartWithTx(duration, 1, 1);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithPutTwoNodesOneBackup() throws Throwable {
backups = 1;
nodeCnt = 2;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 30000;
checkRestartWithPut(duration, 1, 1);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithTxTwoNodesOneBackup() throws Throwable {
backups = 1;
nodeCnt = 2;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 30000;
checkRestartWithTx(duration, 1, 1);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithPutFourNodesNoBackups() throws Throwable {
backups = 0;
nodeCnt = 4;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 60000;
checkRestartWithPut(duration, 2, 2);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithTxFourNodesNoBackups() throws Throwable {
backups = 0;
nodeCnt = 4;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 60000;
checkRestartWithTx(duration, 2, 2);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithPutFourNodesOneBackups() throws Throwable {
backups = 1;
nodeCnt = 4;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 60000;
checkRestartWithPut(duration, 2, 2);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithTxFourNodesOneBackups() throws Throwable {
backups = 1;
nodeCnt = 4;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 60000;
checkRestartWithTx(duration, 2, 2);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithPutSixNodesTwoBackups() throws Throwable {
backups = 2;
nodeCnt = 6;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 90000;
checkRestartWithPut(duration, 3, 3);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithTxSixNodesTwoBackups() throws Throwable {
backups = 2;
nodeCnt = 6;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 90000;
checkRestartWithTx(duration, 3, 3);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithPutEightNodesTwoBackups() throws Throwable {
backups = 2;
nodeCnt = 8;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 90000;
checkRestartWithPut(duration, 4, 4);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithTxEightNodesTwoBackups() throws Throwable {
backups = 2;
nodeCnt = 8;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 90000;
checkRestartWithTx(duration, 4, 4);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithPutTenNodesTwoBackups() throws Throwable {
backups = 2;
nodeCnt = 10;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 90000;
checkRestartWithPut(duration, 5, 5);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithTxTenNodesTwoBackups() throws Throwable {
backups = 2;
nodeCnt = 10;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 90000;
checkRestartWithTx(duration, 5, 5);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithTxPutAllTenNodesTwoBackups() throws Throwable {
backups = 2;
nodeCnt = 10;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 90000;
checkRestartWithTxPutAll(duration, 5, 5);
}
/**
* @throws Exception If failed.
*/
public void testRestartWithTxPutAllFourNodesTwoBackups() throws Throwable {
backups = 2;
nodeCnt = 4;
keyCnt = 10;
partitions = 29;
preloadMode = ASYNC;
long duration = 90000;
checkRestartWithTxPutAll(duration, 2, 2);
}
/**
* @param duration Test duration.
* @param putThreads Put threads count.
* @param restartThreads Restart threads count.
* @throws Exception If failed.
*/
public void checkRestartWithPut(long duration, int putThreads, int restartThreads) throws Throwable {
final long endTime = System.currentTimeMillis() + duration;
final AtomicReference<Throwable> err = new AtomicReference<>();
startGrids();
Collection<Thread> threads = new LinkedList<>();
try {
final int logFreq = 20;
final AtomicInteger putCntr = new AtomicInteger();
final CyclicBarrier barrier = new CyclicBarrier(putThreads + restartThreads);
for (int i = 0; i < putThreads; i++) {
final int gridIdx = i;
Thread t = new Thread(new Runnable() {
@Override public void run() {
try {
barrier.await();
info("Starting put thread...");
IgniteCache<Integer, String> cache = grid(gridIdx).jcache(CACHE_NAME);
while (System.currentTimeMillis() < endTime && err.get() == null) {
int key = RAND.nextInt(keyCnt);
try {
cache.put(key, Integer.toString(key));
}
catch (TransactionRollbackException | ClusterTopologyException |CacheException ignored) {
// It is ok if primary node leaves grid.
}
int c = putCntr.incrementAndGet();
if (c % logFreq == 0)
info(">>> Put iteration [cnt=" + c + ", key=" + key + ']');
}
}
catch (Exception e) {
err.compareAndSet(null, e);
error("Failed to put value in cache.", e);
}
}
}, "put-worker-" + i);
t.start();
threads.add(t);
}
for (int i = 0; i < restartThreads; i++) {
final int gridIdx = i + putThreads;
Thread t = new Thread(new Runnable() {
@Override public void run() {
try {
barrier.await();
info("Starting restart thread...");
int cnt = 0;
while (System.currentTimeMillis() < endTime && err.get() == null) {
log.info(">>>>>>> Stopping grid " + gridIdx);
stopGrid(gridIdx);
log.info(">>>>>>> Starting grid " + gridIdx);
startGrid(gridIdx);
int c = ++cnt;
if (c % logFreq == 0)
info(">>> Restart iteration: " + c);
}
}
catch (Exception e) {
err.compareAndSet(null, e);
error("Failed to restart grid node.", e);
}
}
}, "restart-worker-" + i);
t.start();
threads.add(t);
}
for (Thread t : threads)
t.join();
if (err.get() != null)
throw err.get();
}
finally {
stopAllGrids();
}
}
/**
* @param duration Test duration.
* @param putThreads Put threads count.
* @param restartThreads Restart threads count.
* @throws Exception If failed.
*/
public void checkRestartWithTx(long duration, int putThreads, int restartThreads) throws Throwable {
final long endTime = System.currentTimeMillis() + duration;
final AtomicReference<Throwable> err = new AtomicReference<>();
startGrids();
Collection<Thread> threads = new LinkedList<>();
try {
final int logFreq = 20;
final AtomicInteger txCntr = new AtomicInteger();
final CyclicBarrier barrier = new CyclicBarrier(putThreads + restartThreads);
final int txKeys = 3;
for (int i = 0; i < putThreads; i++) {
final int gridIdx = i;
Thread t = new Thread(new Runnable() {
@Override public void run() {
try {
barrier.await();
info("Starting put thread...");
Ignite ignite = grid(gridIdx);
UUID locNodeId = ignite.cluster().localNode().id();
IgniteCache<Integer, String> cache = ignite.jcache(CACHE_NAME);
List<Integer> keys = new ArrayList<>(txKeys);
while (System.currentTimeMillis() < endTime && err.get() == null) {
keys.clear();
for (int i = 0; i < txKeys; i++)
keys.add(RAND.nextInt(keyCnt));
// Ensure lock order.
Collections.sort(keys);
int c = 0;
try {
try (Transaction tx = ignite.transactions().txStart(txConcurrency(), REPEATABLE_READ)) {
c = txCntr.incrementAndGet();
if (c % logFreq == 0)
info(">>> Tx iteration started [cnt=" + c + ", keys=" + keys + ", " +
"locNodeId=" + locNodeId + ']');
for (int key : keys) {
int op = cacheOp();
if (op == 1)
cache.put(key, Integer.toString(key));
else if (op == 2)
cache.remove(key);
else
cache.get(key);
}
tx.commit();
}
catch (ClusterTopologyException | CacheException e) {
if (e instanceof CacheException
&& !(e.getCause() instanceof ClusterTopologyException))
throw e;
// It is ok if primary node leaves grid.
}
}
catch (ClusterTopologyException | CacheException e) {
if (e instanceof CacheException
&& !(e.getCause() instanceof ClusterTopologyException))
throw e;
// It is ok if primary node leaves grid.
}
if (c % logFreq == 0)
info(">>> Tx iteration finished [cnt=" + c + ", keys=" + keys + ", " +
"locNodeId=" + locNodeId + ']');
}
info(">>> " + Thread.currentThread().getName() + " finished.");
}
catch (Exception e) {
err.compareAndSet(null, e);
error("Failed to put value in cache.", e);
}
}
}, "put-worker-" + i);
t.start();
threads.add(t);
}
for (int i = 0; i < restartThreads; i++) {
final int gridIdx = i + putThreads;
Thread t = new Thread(new Runnable() {
@Override public void run() {
try {
barrier.await();
info("Starting restart thread...");
int cnt = 0;
while (System.currentTimeMillis() < endTime && err.get() == null) {
stopGrid(gridIdx);
startGrid(gridIdx);
int c = ++cnt;
if (c % logFreq == 0)
info(">>> Restart iteration: " + c);
}
info(">>> " + Thread.currentThread().getName() + " finished.");
}
catch (Exception e) {
err.compareAndSet(null, e);
error("Failed to restart grid node.", e);
}
}
}, "restart-worker-" + i);
t.start();
threads.add(t);
}
for (Thread t : threads)
t.join();
if (err.get() != null)
throw err.get();
}
finally {
stopAllGrids();
}
}
/**
* @param duration Test duration.
* @param putThreads Put threads count.
* @param restartThreads Restart threads count.
* @throws Exception If failed.
*/
public void checkRestartWithTxPutAll(long duration, int putThreads, int restartThreads) throws Throwable {
final long endTime = System.currentTimeMillis() + duration;
final AtomicReference<Throwable> err = new AtomicReference<>();
startGrids();
Collection<Thread> threads = new LinkedList<>();
try {
final int logFreq = 20;
final AtomicInteger txCntr = new AtomicInteger();
final CyclicBarrier barrier = new CyclicBarrier(putThreads + restartThreads);
final int txKeys = 3;
for (int i = 0; i < putThreads; i++) {
final int gridIdx = i;
Thread t = new Thread(new Runnable() {
@Override public void run() {
try {
barrier.await();
info("Starting put thread...");
Ignite ignite = grid(gridIdx);
UUID locNodeId = ignite.cluster().localNode().id();
IgniteCache<Integer, String> cache = ignite.jcache(CACHE_NAME);
List<Integer> keys = new ArrayList<>(txKeys);
while (System.currentTimeMillis() < endTime && err.get() == null) {
keys.clear();
for (int i = 0; i < txKeys; i++)
keys.add(RAND.nextInt(keyCnt));
// Ensure lock order.
Collections.sort(keys);
int c = 0;
try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
c = txCntr.incrementAndGet();
if (c % logFreq == 0)
info(">>> Tx iteration started [cnt=" + c + ", keys=" + keys + ", " +
"locNodeId=" + locNodeId + ']');
Map<Integer, String> batch = new LinkedHashMap<>();
for (int key : keys)
batch.put(key, String.valueOf(key));
cache.putAll(batch);
tx.commit();
}
catch (ClusterTopologyException ignored) {
// It is ok if primary node leaves grid.
}
if (c % logFreq == 0)
info(">>> Tx iteration finished [cnt=" + c + ", keys=" + keys + ", " +
"locNodeId=" + locNodeId + ']');
}
}
catch (Exception e) {
err.compareAndSet(null, e);
error("Failed to put value in cache.", e);
}
}
}, "put-worker-" + i);
t.start();
threads.add(t);
}
for (int i = 0; i < restartThreads; i++) {
final int gridIdx = i + putThreads;
Thread t = new Thread(new Runnable() {
@Override public void run() {
try {
barrier.await();
info("Starting restart thread...");
int cnt = 0;
while (System.currentTimeMillis() < endTime && err.get() == null) {
stopGrid(gridIdx);
startGrid(gridIdx);
int c = ++cnt;
if (c % logFreq == 0)
info(">>> Restart iteration: " + c);
}
}
catch (Exception e) {
err.compareAndSet(null, e);
error("Failed to restart grid node.", e);
}
}
}, "restart-worker-" + i);
t.start();
threads.add(t);
}
for (Thread t : threads)
t.join();
if (err.get() != null)
throw err.get();
}
finally {
stopAllGrids();
}
}
/**
* @return Cache operation.
*/
private int cacheOp() {
return RAND.nextInt(3) + 1;
}
/**
* @param c Cache projection.
* @param key Key.
* @param attempt Attempt.
*/
private void printFailureDetails(IgniteCache<Integer, String> c, int key, int attempt) {
error("*** Failure details ***");
error("Key: " + key);
error("Partition: " + c.getConfiguration(CacheConfiguration.class).getAffinity().partition(key));
error("Attempt: " + attempt);
error("Node: " + c.unwrap(Ignite.class).cluster().localNode().id());
}
}
|
923fd777874ea5938ebb986172ef1abb5afdff2a
| 8,978 |
java
|
Java
|
doc/libjitisi/sources/net/sf/fmj/media/rtp/RTCPTransmitter.java
|
lhzheng880828/VOIPCall
|
a7ba25debd4bd2086bae2a48306d28c614ce0d4a
|
[
"Apache-2.0"
] | null | null | null |
doc/libjitisi/sources/net/sf/fmj/media/rtp/RTCPTransmitter.java
|
lhzheng880828/VOIPCall
|
a7ba25debd4bd2086bae2a48306d28c614ce0d4a
|
[
"Apache-2.0"
] | null | null | null |
doc/libjitisi/sources/net/sf/fmj/media/rtp/RTCPTransmitter.java
|
lhzheng880828/VOIPCall
|
a7ba25debd4bd2086bae2a48306d28c614ce0d4a
|
[
"Apache-2.0"
] | null | null | null | 40.26009 | 136 | 0.577523 | 1,001,305 |
package net.sf.fmj.media.rtp;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.Enumeration;
import java.util.Vector;
import net.sf.fmj.media.rtp.util.UDPPacketSender;
import org.jitsi.impl.neomedia.portaudio.Pa;
public class RTCPTransmitter {
SSRCCache cache;
int sdescounter;
RTCPRawSender sender;
SSRCInfo ssrcInfo;
OverallStats stats;
public RTCPTransmitter(SSRCCache cache) {
this.stats = null;
this.sdescounter = 0;
this.ssrcInfo = null;
this.cache = cache;
this.stats = cache.sm.defaultstats;
}
public RTCPTransmitter(SSRCCache cache, int port, String address) throws UnknownHostException, IOException {
this(cache, new RTCPRawSender(port, address));
}
public RTCPTransmitter(SSRCCache cache, int port, String address, UDPPacketSender sender) throws UnknownHostException, IOException {
this(cache, new RTCPRawSender(port, address, sender));
}
public RTCPTransmitter(SSRCCache cache, RTCPRawSender sender) {
this(cache);
setSender(sender);
this.stats = cache.sm.defaultstats;
}
public void bye(int ssrc, byte[] reason) {
if (this.cache.rtcpsent) {
double delay;
this.cache.byestate = true;
Vector repvec = makereports();
RTCPPacket[] packets = new RTCPPacket[(repvec.size() + 1)];
repvec.copyInto(packets);
RTCPBYEPacket byep = new RTCPBYEPacket(new int[]{ssrc}, reason);
packets[packets.length - 1] = byep;
RTCPCompoundPacket cp = new RTCPCompoundPacket(packets);
if (this.cache.aliveCount() > 50) {
this.cache.reset(byep.length);
delay = this.cache.calcReportInterval(this.ssrcInfo.sender, false);
} else {
delay = Pa.LATENCY_UNSPECIFIED;
}
try {
Thread.sleep((long) delay);
} catch (InterruptedException e) {
e.printStackTrace();
}
transmit(cp);
this.sdescounter = 0;
}
}
public void bye(String reason) {
if (reason != null) {
bye(this.ssrcInfo.ssrc, reason.getBytes());
} else {
bye(this.ssrcInfo.ssrc, null);
}
}
public void close() {
if (this.sender != null) {
this.sender.closeConsumer();
}
}
public RTCPRawSender getSender() {
return this.sender;
}
/* access modifiers changed from: protected */
public RTCPReportBlock[] makerecreports(long time) {
Vector reports = new Vector();
Enumeration elements = this.cache.cache.elements();
while (elements.hasMoreElements()) {
SSRCInfo info = (SSRCInfo) elements.nextElement();
if (!info.ours && info.sender) {
RTCPReportBlock rep = new RTCPReportBlock();
rep.ssrc = info.ssrc;
rep.lastseq = (long) (info.maxseq + info.cycles);
rep.jitter = (int) info.jitter;
rep.lsr = (long) ((int) ((info.lastSRntptimestamp & 281474976645120L) >> 16));
rep.dlsr = (long) ((int) (((double) (time - info.lastSRreceiptTime)) * 65.536d));
rep.packetslost = (int) (((rep.lastseq - ((long) info.baseseq)) + 1) - ((long) info.received));
if (rep.packetslost < 0) {
rep.packetslost = 0;
}
double frac = ((double) (rep.packetslost - info.prevlost)) / ((double) (rep.lastseq - ((long) info.prevmaxseq)));
if (frac < Pa.LATENCY_UNSPECIFIED) {
frac = Pa.LATENCY_UNSPECIFIED;
}
rep.fractionlost = (int) (256.0d * frac);
info.prevmaxseq = (int) rep.lastseq;
info.prevlost = rep.packetslost;
reports.addElement(rep);
}
}
RTCPReportBlock[] reportsarr = new RTCPReportBlock[reports.size()];
reports.copyInto(reportsarr);
return reportsarr;
}
/* access modifiers changed from: protected */
public Vector makereports() {
Vector packets = new Vector();
SSRCInfo ourinfo = this.ssrcInfo;
boolean senderreport = false;
if (ourinfo.sender) {
senderreport = true;
}
RTCPReportBlock[] reports = makerecreports(System.currentTimeMillis());
RTCPReportBlock[] firstrep = reports;
if (reports.length > 31) {
firstrep = new RTCPReportBlock[31];
System.arraycopy(reports, 0, firstrep, 0, 31);
}
if (senderreport) {
RTCPSRPacket rTCPSRPacket = new RTCPSRPacket(ourinfo.ssrc, firstrep);
packets.addElement(rTCPSRPacket);
long systime = ourinfo.systime == 0 ? System.currentTimeMillis() : ourinfo.systime;
long secs = systime / 1000;
rTCPSRPacket.ntptimestamplsw = (long) ((int) (4.294967296E9d * (((double) (systime - (1000 * secs))) / 1000.0d)));
rTCPSRPacket.ntptimestampmsw = secs;
rTCPSRPacket.rtptimestamp = (long) ((int) ourinfo.rtptime);
rTCPSRPacket.packetcount = (long) (ourinfo.maxseq - ourinfo.baseseq);
rTCPSRPacket.octetcount = (long) ourinfo.bytesreceived;
} else {
packets.addElement(new RTCPRRPacket(ourinfo.ssrc, firstrep));
}
if (firstrep != reports) {
for (int offset = 31; offset < reports.length; offset += 31) {
if (reports.length - offset < 31) {
firstrep = new RTCPReportBlock[(reports.length - offset)];
}
System.arraycopy(reports, offset, firstrep, 0, firstrep.length);
packets.addElement(new RTCPRRPacket(ourinfo.ssrc, firstrep));
}
}
RTCPSDESPacket rTCPSDESPacket = new RTCPSDESPacket(new RTCPSDES[1]);
rTCPSDESPacket.sdes[0] = new RTCPSDES();
rTCPSDESPacket.sdes[0].ssrc = this.ssrcInfo.ssrc;
Vector<RTCPSDESItem> itemvec = new Vector();
itemvec.addElement(new RTCPSDESItem(1, ourinfo.sourceInfo.getCNAME()));
if (this.sdescounter % 3 == 0) {
if (!(ourinfo.name == null || ourinfo.name.getDescription() == null)) {
itemvec.addElement(new RTCPSDESItem(2, ourinfo.name.getDescription()));
}
if (!(ourinfo.email == null || ourinfo.email.getDescription() == null)) {
itemvec.addElement(new RTCPSDESItem(3, ourinfo.email.getDescription()));
}
if (!(ourinfo.phone == null || ourinfo.phone.getDescription() == null)) {
itemvec.addElement(new RTCPSDESItem(4, ourinfo.phone.getDescription()));
}
if (!(ourinfo.loc == null || ourinfo.loc.getDescription() == null)) {
itemvec.addElement(new RTCPSDESItem(5, ourinfo.loc.getDescription()));
}
if (!(ourinfo.tool == null || ourinfo.tool.getDescription() == null)) {
itemvec.addElement(new RTCPSDESItem(6, ourinfo.tool.getDescription()));
}
if (!(ourinfo.note == null || ourinfo.note.getDescription() == null)) {
itemvec.addElement(new RTCPSDESItem(7, ourinfo.note.getDescription()));
}
}
this.sdescounter++;
rTCPSDESPacket.sdes[0].items = new RTCPSDESItem[itemvec.size()];
itemvec.copyInto(rTCPSDESPacket.sdes[0].items);
packets.addElement(rTCPSDESPacket);
return packets;
}
public void report() {
Vector repvec = makereports();
RTCPPacket[] packets = new RTCPPacket[repvec.size()];
repvec.copyInto(packets);
transmit(new RTCPCompoundPacket(packets));
}
public void setSender(RTCPRawSender s) {
this.sender = s;
}
public void setSSRCInfo(SSRCInfo info) {
this.ssrcInfo = info;
}
/* access modifiers changed from: protected */
public void transmit(RTCPCompoundPacket p) {
OverallTransStats overallTransStats;
try {
this.sender.sendTo(p);
if (this.ssrcInfo instanceof SendSSRCInfo) {
RTPTransStats rTPTransStats = ((SendSSRCInfo) this.ssrcInfo).stats;
rTPTransStats.total_rtcp++;
overallTransStats = this.cache.sm.transstats;
overallTransStats.rtcp_sent++;
}
this.cache.updateavgrtcpsize(p.length);
if (this.cache.initial) {
this.cache.initial = false;
}
if (!this.cache.rtcpsent) {
this.cache.rtcpsent = true;
}
} catch (IOException e) {
this.stats.update(6, 1);
overallTransStats = this.cache.sm.transstats;
overallTransStats.transmit_failed++;
}
}
}
|
923fd78e205a8361262a309d182e6cc00834818e
| 3,312 |
java
|
Java
|
app/src/main/java/com/martin/knowledgebase/Snackbar.java
|
martindisch/KnowledgeBase
|
bc87aa97da70c3e87d48389c97a403f6c903d293
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/martin/knowledgebase/Snackbar.java
|
martindisch/KnowledgeBase
|
bc87aa97da70c3e87d48389c97a403f6c903d293
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/martin/knowledgebase/Snackbar.java
|
martindisch/KnowledgeBase
|
bc87aa97da70c3e87d48389c97a403f6c903d293
|
[
"MIT"
] | null | null | null | 33.454545 | 132 | 0.647645 | 1,001,306 |
package com.martin.knowledgebase;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Path;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class Snackbar {
private RelativeLayout mSnackbar;
private TextView mSnackButton, mSnackText;
private Context mContext;
private boolean mVisible;
public Snackbar(RelativeLayout snackbar, String text, Context context) {
mSnackbar = snackbar;
mSnackButton = (TextView) mSnackbar.findViewById(R.id.snackbar_button);
mSnackText = (TextView) mSnackbar.findViewById(R.id.snackbar_text);
mSnackText.setText(text);
mContext = context;
mSnackButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
hideSnackbar();
}
});
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 56, mContext.getResources().getDisplayMetrics());
mSnackbar.setY(mSnackbar.getY() + px);
mSnackbar.setVisibility(View.VISIBLE);
mVisible = false;
}
public Snackbar(RelativeLayout snackbar, Context context) {
mSnackbar = snackbar;
mSnackButton = (TextView) mSnackbar.findViewById(R.id.snackbar_button);
mSnackText = (TextView) mSnackbar.findViewById(R.id.snackbar_text);
mContext = context;
mSnackButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
hideSnackbar();
}
});
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 56, mContext.getResources().getDisplayMetrics());
mSnackbar.setY(mSnackbar.getY() + px);
mSnackbar.setVisibility(View.VISIBLE);
mVisible = false;
}
public void show() {
if (mContext != null) {
if (!mVisible) {
float px = -TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 56, mContext.getResources().getDisplayMetrics());
moveSnackbar(px);
mVisible = true;
}
} else {
Log.e("Snackbar", "Reference to old Context - reinstantiate Snackbar with current Context");
}
}
public void setText(String text) {
mSnackText.setText(text);
}
public void hideSnackbar() {
if (mContext != null) {
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 56, mContext.getResources().getDisplayMetrics());
moveSnackbar(px);
mVisible = false;
} else {
Log.e("Snackbar", "Reference to old Context - reinstantiate Snackbar with current Context");
}
}
private void moveSnackbar(float px) {
Path p = new Path();
ObjectAnimator sbAnimator;
p.moveTo(mSnackbar.getX(), mSnackbar.getY());
p.rLineTo(0, px);
sbAnimator = ObjectAnimator.ofFloat(mSnackbar, View.X, View.Y, p);
sbAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
sbAnimator.start();
}
}
|
923fd85d18aafbfa4defba24077e34b2795d461b
| 330 |
java
|
Java
|
src/main/java/at/dru/wicketblog/service/EntityService.java
|
dru1/escnenzing
|
3edfb17e21fca04b740935ad6eebdd3b6aa0e9f5
|
[
"MIT"
] | 1 |
2015-04-21T02:04:21.000Z
|
2015-04-21T02:04:21.000Z
|
src/main/java/at/dru/wicketblog/service/EntityService.java
|
dru1/escnenzing
|
3edfb17e21fca04b740935ad6eebdd3b6aa0e9f5
|
[
"MIT"
] | 1 |
2019-07-01T20:32:43.000Z
|
2019-07-01T20:32:43.000Z
|
src/main/java/at/dru/wicketblog/service/EntityService.java
|
dru1/escnenzing
|
3edfb17e21fca04b740935ad6eebdd3b6aa0e9f5
|
[
"MIT"
] | null | null | null | 16.5 | 45 | 0.709091 | 1,001,307 |
package at.dru.wicketblog.service;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public interface EntityService<T> {
@Nonnull
Class<T> getEntityType();
void saveEntity(@Nonnull T entity);
@Nullable
T findByEntityId(@Nonnull Long entityId);
@Nonnull
Iterable<T> findAll();
}
|
923fd8f6076c2a8b154e5970f30a5ffb7db4f900
| 3,000 |
java
|
Java
|
SplashScreenWithLogin/app/src/main/java/com/splash/screen/with/login/SplashActivity2.java
|
Yassine-Lafryhi/MobileDevelopmentTPs
|
09effd1ab3d69be38b5db90556b725cfde7d2a28
|
[
"MIT"
] | null | null | null |
SplashScreenWithLogin/app/src/main/java/com/splash/screen/with/login/SplashActivity2.java
|
Yassine-Lafryhi/MobileDevelopmentTPs
|
09effd1ab3d69be38b5db90556b725cfde7d2a28
|
[
"MIT"
] | null | null | null |
SplashScreenWithLogin/app/src/main/java/com/splash/screen/with/login/SplashActivity2.java
|
Yassine-Lafryhi/MobileDevelopmentTPs
|
09effd1ab3d69be38b5db90556b725cfde7d2a28
|
[
"MIT"
] | null | null | null | 33.707865 | 103 | 0.647333 | 1,001,308 |
package com.splash.screen.with.login;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.splashscreen.SplashScreen;
public class SplashActivity2 extends AppCompatActivity {
EditText username, password;
private String TAG = "GLSID2";
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.installSplashScreen(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.first_activity);
Log.d(TAG, "onCreate vient d'être appelée !");
Toast.makeText(this,"onCreate vient d'être appelée !", Toast.LENGTH_SHORT).show();
username = findViewById(R.id.usernameTextView);
password = findViewById(R.id.passwordTextView);
}
public void envoyer(View view) {
Intent intent = new Intent(this, SecondActivity.class);
String usernameString = username.getText().toString().trim();
String passwordString = password.getText().toString().trim();
if (usernameString.isEmpty() || passwordString.isEmpty()) {
Toast.makeText(this, getResources().getString(R.string.fill_in), Toast.LENGTH_LONG).show();
} else {
Bundle bundle = new Bundle();
bundle.putString("username", username.getText().toString().trim());
bundle.putString("password", password.getText().toString().trim());
intent.putExtras(bundle);
startActivity(intent);
finish();
}
}
@Override
protected void onStart() {
super.onStart();
Log.d(TAG, "onStart vient d'être appelée !");
Toast.makeText(this,"onStart vient d'être appelée !", Toast.LENGTH_SHORT).show();
}
@Override
protected void onRestart() {
super.onRestart();
Log.d(TAG, "onRestart vient d'être appelée !");
Toast.makeText(this,"onRestart vient d'être appelée !", Toast.LENGTH_SHORT).show();
}
@Override
protected void onResume() {
super.onResume();
Log.d(TAG, "onResume vient d'être appelée !");
Toast.makeText(this,"onResume vient d'être appelée !", Toast.LENGTH_SHORT).show();
}
@Override
protected void onPause() {
super.onPause();
Log.d(TAG, "onPause vient d'être appelée !");
Toast.makeText(this,"onPause vient d'être appelée !", Toast.LENGTH_SHORT).show();
}
@Override
protected void onStop() {
super.onStop();
Log.d(TAG, "onStop vient d'être appelée !");
Toast.makeText(this,"onStop vient d'être appelée !", Toast.LENGTH_SHORT).show();
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.d(TAG, "onDestroy vient d'être appelée !");
Toast.makeText(this,"onDestroy vient d'être appelée !", Toast.LENGTH_SHORT).show();
}
}
|
923fda1526ce7ca69d9c076636606206d769e286
| 4,001 |
java
|
Java
|
src/mappers/owl/OWLNotRecursiveMapper.java
|
jrbn/webpie
|
843807ef875b056b875cb250134730facc9c7cf1
|
[
"Apache-2.0"
] | 2 |
2015-12-01T18:34:43.000Z
|
2021-07-05T07:45:12.000Z
|
src/mappers/owl/OWLNotRecursiveMapper.java
|
jrbn/webpie
|
843807ef875b056b875cb250134730facc9c7cf1
|
[
"Apache-2.0"
] | null | null | null |
src/mappers/owl/OWLNotRecursiveMapper.java
|
jrbn/webpie
|
843807ef875b056b875cb250134730facc9c7cf1
|
[
"Apache-2.0"
] | null | null | null | 32.266129 | 73 | 0.746313 | 1,001,309 |
package mappers.owl;
import java.io.IOException;
import java.util.Map;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.mapreduce.Mapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import readers.FilesTriplesReader;
import utils.NumberUtils;
import data.Triple;
import data.TripleSource;
public class OWLNotRecursiveMapper extends
Mapper<TripleSource, Triple, BytesWritable, LongWritable> {
protected static Logger log = LoggerFactory
.getLogger(OWLNotRecursiveMapper.class);
protected Map<Long, Integer> schemaFunctionalProperties = null;
protected Map<Long, Integer> schemaInverseFunctionalProperties = null;
protected Map<Long, Integer> schemaSymmetricProperties = null;
protected Map<Long, Integer> schemaInverseOfProperties = null;
private byte[] bKeys = new byte[17];
private BytesWritable key = new BytesWritable(bKeys);
private int previousDerivation = -1;
public void map(TripleSource key, Triple value, Context context)
throws IOException, InterruptedException {
/*
* Check if the triple has the functional property. If yes output a key
* value so it can be matched in the reducer.
*/
if (schemaFunctionalProperties.containsKey(value.getPredicate())
&& !value.isObjectLiteral()) {
int schemaStep = schemaFunctionalProperties.get(value
.getPredicate());
if (Math.max(schemaStep, key.getStep()) < previousDerivation)
return;
// Set as key a particular flag plus the predicate
bKeys[0] = 0;
NumberUtils.encodeLong(bKeys, 1, value.getSubject());
NumberUtils.encodeLong(bKeys, 9, value.getPredicate());
context.write(this.key, new LongWritable(value.getObject()));
}
if (schemaInverseFunctionalProperties.containsKey(value.getPredicate())
&& !value.isObjectLiteral()) {
int schemaStep = schemaInverseFunctionalProperties.get(value
.getPredicate());
if (Math.max(schemaStep, key.getStep()) < previousDerivation)
return;
// Set as key a particular flag plus the predicate
bKeys[0] = 0;
NumberUtils.encodeLong(bKeys, 1, value.getObject());
NumberUtils.encodeLong(bKeys, 9, value.getPredicate());
context.write(this.key, new LongWritable(value.getSubject()));
}
if (schemaSymmetricProperties.containsKey(value.getPredicate())) {
int schemaStep = schemaSymmetricProperties
.get(value.getPredicate());
if (Math.max(schemaStep, key.getStep()) < previousDerivation)
return;
bKeys[0] = 2;
NumberUtils.encodeLong(bKeys, 1, value.getSubject());
NumberUtils.encodeLong(bKeys, 9, value.getObject());
context.write(this.key, new LongWritable(value.getPredicate()));
}
if (schemaInverseOfProperties.containsKey(value.getPredicate())) {
int schemaStep = schemaInverseOfProperties
.get(value.getPredicate());
if (Math.max(schemaStep, key.getStep()) < previousDerivation)
return;
bKeys[0] = 3;
NumberUtils.encodeLong(bKeys, 1, value.getSubject());
NumberUtils.encodeLong(bKeys, 9, value.getObject());
context.write(this.key, new LongWritable(value.getPredicate()));
}
}
protected void setup(Context context) throws IOException {
previousDerivation = context.getConfiguration().getInt(
"reasoner.previousStep", -1);
if (schemaFunctionalProperties == null) {
schemaFunctionalProperties = FilesTriplesReader
.loadTriplesWithStep("FILTER_ONLY_OWL_FUNCTIONAL_SCHEMA",
context);
}
if (schemaInverseFunctionalProperties == null) {
schemaInverseFunctionalProperties = FilesTriplesReader
.loadTriplesWithStep(
"FILTER_ONLY_OWL_INVERSE_FUNCTIONAL_SCHEMA",
context);
}
if (schemaSymmetricProperties == null) {
schemaSymmetricProperties = FilesTriplesReader.loadTriplesWithStep(
"FILTER_ONLY_OWL_SYMMETRIC_SCHEMA", context);
}
if (schemaInverseOfProperties == null) {
schemaInverseOfProperties = FilesTriplesReader.loadTriplesWithStep(
"FILTER_ONLY_OWL_INVERSE_OF", context);
}
}
}
|
923fda4927f5417f89f26995059bde91b1de25a5
| 1,445 |
java
|
Java
|
java/algorithm-dataStructure/src/main/java/com/wsmhz/dataStructure/set/BinarySearchTreeSetTest.java
|
wsmhz/wsmhz-design-pattern
|
d35bef7158ffd350ce2d3b175380924a64ecb42d
|
[
"MIT"
] | 3 |
2019-06-13T01:38:36.000Z
|
2019-07-03T07:37:14.000Z
|
java/algorithm-dataStructure/src/main/java/com/wsmhz/dataStructure/set/BinarySearchTreeSetTest.java
|
wsmhz/wsmhz-design-pattern
|
d35bef7158ffd350ce2d3b175380924a64ecb42d
|
[
"MIT"
] | null | null | null |
java/algorithm-dataStructure/src/main/java/com/wsmhz/dataStructure/set/BinarySearchTreeSetTest.java
|
wsmhz/wsmhz-design-pattern
|
d35bef7158ffd350ce2d3b175380924a64ecb42d
|
[
"MIT"
] | null | null | null | 32.111111 | 79 | 0.620761 | 1,001,310 |
package com.wsmhz.dataStructure.set;
import com.wsmhz.dataStructure.set.impl.BinarySearchTreeSet;
import com.wsmhz.resources.FileOperation;
import java.util.ArrayList;
/**
* create by tangbj on 2018/11/10
*/
public class BinarySearchTreeSetTest {
public static void main(String[] args) {
System.out.println("*********BinarySearchTreeSet********");
System.out.println("Pride and Prejudice");
ArrayList<String> words1 = new ArrayList<>();
if(FileOperation.readFile(FileOperation.pride_and_prejudice, words1)) {
System.out.println("Total words: " + words1.size());
BinarySearchTreeSet<String> set1 = new BinarySearchTreeSet<>();
for (String word : words1)
set1.add(word);
System.out.println("Total different words: " + set1.getSize());
}
System.out.println();
System.out.println("A Tale of Two Cities");
ArrayList<String> words2 = new ArrayList<>();
if(FileOperation.readFile(FileOperation.a_tale_of_two_cities, words2)){
System.out.println("Total words: " + words2.size());
BinarySearchTreeSet<String> set2 = new BinarySearchTreeSet<>();
for(String word: words2)
set2.add(word);
System.out.println("Total different words: " + set2.getSize());
}
System.out.println("*********BinarySearchTreeSet********");
}
}
|
923fda81b8da3d4b302b544afca9c9300dc09f73
| 35,376 |
java
|
Java
|
guvnor-webapp-core/src/main/java/org/drools/guvnor/server/files/WebDAVImpl.java
|
psiroky/guvnor
|
3a1510cdd8325bff57a4d11a20376e3d6bd85b61
|
[
"Apache-2.0"
] | null | null | null |
guvnor-webapp-core/src/main/java/org/drools/guvnor/server/files/WebDAVImpl.java
|
psiroky/guvnor
|
3a1510cdd8325bff57a4d11a20376e3d6bd85b61
|
[
"Apache-2.0"
] | null | null | null |
guvnor-webapp-core/src/main/java/org/drools/guvnor/server/files/WebDAVImpl.java
|
psiroky/guvnor
|
3a1510cdd8325bff57a4d11a20376e3d6bd85b61
|
[
"Apache-2.0"
] | null | null | null | 38.368764 | 128 | 0.482841 | 1,001,311 |
/*
* Copyright 2010 JBoss 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.drools.guvnor.server.files;
import net.sf.webdav.ITransaction;
import net.sf.webdav.IWebdavStore;
import net.sf.webdav.StoredObject;
import org.apache.commons.io.IOUtils;
import org.drools.guvnor.server.repository.Preferred;
import org.drools.repository.AssetItem;
import org.drools.repository.ModuleItem;
import org.drools.repository.RulesRepository;
import org.drools.repository.VersionableItem;
import org.drools.repository.utils.AssetValidator;
import java.io.*;
import java.security.Principal;
import java.util.*;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
@ApplicationScoped
public class WebDAVImpl
implements
IWebdavStore {
private static final String SNAPSHOTS = "snapshots";
private static final String PACKAGES = "packages";
private static final String GLOBALAREA = "globalarea";
/**
* for the rubbish OSX double data (the ._ rubbish)
*/
private static final Map<String, byte[]> osxDoubleData = Collections.synchronizedMap( new WeakHashMap<String, byte[]>() );
// Note that a RulesRepository is @RequestScoped, so there's no need to put it into a thread local
@Inject @Preferred
protected RulesRepository rulesRepository;
@Inject
protected AssetValidator assetValidator;
public ITransaction begin(final Principal principal) {
return new ITransaction() {
public Principal getPrincipal() {
return principal;
}
};
}
public void checkAuthentication(ITransaction arg0) {
//already done
}
public void commit(ITransaction iTransaction) {
rulesRepository.save();
}
public void createFolder(ITransaction iTransaction,
String uri) {
String[] path = getPath( uri );
if ( isPackages( path ) ) {
if ( path.length > 2 ) {
throw new UnsupportedOperationException( "Can't nest packages." );
}
if ( rulesRepository.containsModule( path[1] ) ) {
ModuleItem pkg = loadPackageFromRepository( path[1] );
pkg.archiveItem( false );
pkg.checkin( "restored by webdav" );
} else {
rulesRepository.createModule( path[1],
"from webdav" );
}
} else {
throw new UnsupportedOperationException( "Not able to create folders here..." );
}
}
public void createResource(ITransaction iTransaction,
String uri) {
//for mac OSX, ignore these annoying things
if ( uri.endsWith( ".DS_Store" ) ) return;
String[] path = getPath( uri );
if ( isPackages( path ) ) {
if ( path.length > 3 ) {
throw new UnsupportedOperationException( "Can't do nested packages." );
}
String[] resource = AssetItem.getAssetNameFromFileName( path[2] );
ModuleItem packageItem = loadPackageFromRepository( path[1] );
//for mac OSX, ignore these resource fork files
if ( path[2].startsWith( "._" ) ) {
WebDAVImpl.osxDoubleData.put( uri,
null );
return;
}
if ( packageItem.containsAsset( resource[0] ) ) {
AssetItem lazarus = packageItem.loadAsset( resource[0] );
lazarus.archiveItem( false );
lazarus.checkin( "restored by webdav" );
} else {
AssetItem asset = packageItem.addAsset( resource[0],
"" );
asset.updateFormat( resource[1] );
asset.updateValid(assetValidator.validate(asset));
asset.checkin( "from webdav" );
}
} else if ( isGlobalAreas( path ) ) {
String[] resource = AssetItem.getAssetNameFromFileName( path[1] );
ModuleItem packageItem = loadGlobalAreaFromRepository();
//for mac OSX, ignore these resource fork files
if ( path[1].startsWith( "._" ) ) {
WebDAVImpl.osxDoubleData.put( uri,
null );
return;
}
if ( packageItem.containsAsset( resource[0] ) ) {
AssetItem lazarus = packageItem.loadAsset( resource[0] );
lazarus.archiveItem( false );
lazarus.checkin( "restored by webdav" );
} else {
AssetItem asset = packageItem.addAsset( resource[0],
"" );
asset.updateFormat( resource[1] );
asset.updateValid(assetValidator.validate(asset));
asset.checkin( "from webdav" );
}
} else {
throw new UnsupportedOperationException( "Can't add assets here." );
}
}
public String[] getChildrenNames(ITransaction iTransaction,
String uri) {
String[] path = getPath( uri );
List<String> result = new ArrayList<String>();
if ( path.length == 0 ) {
return new String[]{PACKAGES, SNAPSHOTS, GLOBALAREA};
}
if ( isPackages( path ) ) {
if ( path.length > 2 ) {
return null;
}
if ( path.length == 1 ) {
listPackages( rulesRepository,
result );
} else {
handleReadOnlyPackages( rulesRepository,
path,
result );
}
} else if ( isSnaphosts( path ) ) {
if ( path.length > 3 ) {
return null;
}
if ( path.length == 1 ) {
listPackages( rulesRepository,
result );
} else if ( isPermission( path,
2 ) ) {
return rulesRepository.listModuleSnapshots( path[1] );
} else if ( isPermission( path,
3 ) ) {
handleReadOnlySnapshotPackages( rulesRepository,
path,
result );
} else {
throw new IllegalArgumentException();
}
} else if ( isGlobalAreas( path ) ) {
if ( path.length > 2 ) {
return null;
}
if ( path.length == 1 ) {
// no packages under global area. show contents
handleReadOnlyGlobalAreaPackages( rulesRepository,
path,
result );
}
} else {
throw new UnsupportedOperationException( "Not a valid path : " + path[0] );
}
return result.toArray( new String[result.size()] );
}
private void handleReadOnlySnapshotPackages(RulesRepository repository,
String[] path,
List<String> result) {
Iterator<AssetItem> it = loadPackageSnapshotFromRepository( path ).getAssets();
while ( it.hasNext() ) {
AssetItem asset = it.next();
if ( !asset.isArchived() ) {
addNameAndFormat( result,
asset );
}
}
}
private void handleReadOnlyGlobalAreaPackages(RulesRepository repository,
String[] path,
List<String> result) {
Iterator<AssetItem> it = loadGlobalAreaFromRepository().getAssets();
while ( it.hasNext() ) {
AssetItem asset = it.next();
if ( !asset.isArchived() ) {
addNameAndFormat( result,
asset );
}
}
}
private void handleReadOnlyPackages(RulesRepository repository,
String[] path,
List<String> result) {
ModuleItem pkg = loadPackageFromRepository(
path[1] );
Iterator<AssetItem> it = pkg.getAssets();
while ( it.hasNext() ) {
AssetItem asset = it.next();
if ( !asset.isArchived() ) {
addNameAndFormat( result,
asset );
}
}
}
private void addNameAndFormat(List<String> result,
AssetItem asset) {
result.add( asset.getName() + "." + asset.getFormat() );
}
private void listPackages(RulesRepository repository,
List<String> result) {
Iterator<ModuleItem> it = repository.listModules();
while ( it.hasNext() ) {
ModuleItem pkg = it.next();
String packageName = pkg.getName();
if ( !pkg.isArchived() ) {
result.add( packageName );
}
}
}
public Date getCreationDate(String uri) {
String[] path = getPath( uri );
if ( path.length < 2 ) {
return new Date();
}
if ( isPackages( path ) ) {
return getCreationDateForPackage( rulesRepository,
path );
}
if ( isSnaphosts( path ) ) {
return getCreationTimeForSnapshotPackage( rulesRepository,
path );
}
if ( isGlobalAreas( path ) ) {
return getCreationTimeForGlobalAreaPackage( rulesRepository,
path );
}
throw new UnsupportedOperationException();
}
private Date getCreationTimeForSnapshotPackage(RulesRepository repository,
String[] path) {
if ( path.length == 2 ) {
return new Date();
} else if ( path.length == 3 ) {
return loadPackageSnapshotFromRepository( path ).getCreatedDate().getTime();
} else if ( path.length == 4 ) {
return loadAssetItemFromPackageItem( loadPackageSnapshotFromRepository(
path ),
path[3] ).getCreatedDate().getTime();
}
throw new UnsupportedOperationException();
}
private Date getCreationDateForPackage(RulesRepository repository,
String[] path) {
ModuleItem packageItem = loadPackageFromRepository( path[1] );
if ( path.length == 2 ) {
return packageItem.getCreatedDate().getTime();
}
return loadAssetItemFromPackageItem( packageItem,
path[2] ).getCreatedDate().getTime();
}
private Date getCreationTimeForGlobalAreaPackage(RulesRepository repository,
String[] path) {
ModuleItem packageItem = loadGlobalAreaFromRepository();
if ( path.length == 2 ) {
return packageItem.getCreatedDate().getTime();
}
return loadAssetItemFromPackageItem( packageItem,
path[2] ).getCreatedDate().getTime();
}
public Date getLastModified(String uri) {
String[] path = getPath( uri );
if ( path.length < 2 ) {
return new Date();
}
if ( isPackages( path ) ) {
return getLastModifiedForPackage( rulesRepository,
path );
}
if ( isSnaphosts( path ) ) {
return getLastModifiedForSnaphotPackage( rulesRepository,
path );
}
if ( isGlobalAreas( path ) ) {
return getLastModifiedForGlobalAreaPackage( rulesRepository,
path );
}
throw new UnsupportedOperationException();
}
private Date getLastModifiedForSnaphotPackage(RulesRepository repository,
String[] path) {
if ( path.length == 2 ) {
return new Date();
} else if ( path.length == 3 ) {
return loadPackageSnapshotFromRepository( path ).getLastModified().getTime();
} else if ( path.length == 4 ) {
ModuleItem pkg = loadPackageSnapshotFromRepository( path );
return getLastModifiedFromPackageAssetItem( pkg,
path[3] );
}
throw new UnsupportedOperationException();
}
private Date getLastModifiedForPackage(RulesRepository repository,
String[] path) {
ModuleItem pkg = loadPackageFromRepository( path[1] );
if ( path.length == 2 ) {
return pkg.getLastModified().getTime();
}
return getLastModifiedFromPackageAssetItem( pkg,
path[2] );
}
private Date getLastModifiedForGlobalAreaPackage(RulesRepository repository,
String[] path) {
ModuleItem pkg = loadGlobalAreaFromRepository();
if ( path.length == 2 ) {
return pkg.getLastModified().getTime();
}
return getLastModifiedFromPackageAssetItem( pkg,
path[2] );
}
private Date getLastModifiedFromPackageAssetItem(ModuleItem packageItem,
String path) {
return loadAssetItemFromPackageItem( packageItem,
path ).getLastModified().getTime();
}
public InputStream getResourceContent(ITransaction iTransaction,
String uri) {
return getContent( uri );
}
public StoredObject getStoredObject(ITransaction iTransaction,
String uri) {
String[] path = getPath( uri );
if ( path.length < 2 ) {
return createStoredObject( uri );
}
if ( isPackages( path ) ) {
return getStoredObjectForReadOnlyPackages( uri,
rulesRepository,
path );
}
if ( isSnaphosts( path ) ) {
return getStoredObjectForReadOnlySnapshots( uri,
rulesRepository,
path );
}
if ( isGlobalAreas( path ) ) {
return getStoredObjectForReadOnlyGlobalArea( uri,
rulesRepository,
path );
}
throw new UnsupportedOperationException();
}
private StoredObject createStoredObject(String uri) {
StoredObject so = new StoredObject();
so.setCreationDate( new Date() );
so.setFolder( isFolder( uri ) );
so.setLastModified( new Date() );
so.setResourceLength( 0 );
return so;
}
private StoredObject getStoredObjectForReadOnlySnapshots(String uri,
RulesRepository repository,
String[] path) {
if ( path.length == 2 ) {
StoredObject so = createStoredObject( uri,
loadPackageFromRepository(
path[1] ),
0 );
so.setFolder( isFolder( uri ) );
return so;
} else if ( path.length == 3 ) {
return createStoredObject( uri,
loadPackageSnapshotFromRepository(
path ),
0 );
} else if ( path.length == 4 ) {
ModuleItem pkg = loadPackageSnapshotFromRepository( path );
AssetItem asset;
try {
asset = loadAssetItemFromPackageItem( pkg,
path[3] );
} catch ( Exception e ) {
return null;
}
return createStoredObject( uri,
asset,
asset.getContentLength() );
}
throw new UnsupportedOperationException();
}
private StoredObject getStoredObjectForReadOnlyPackages(String uri,
RulesRepository repository,
String[] path) {
ModuleItem packageItem = loadPackageFromRepository( path[1] );
if ( path.length == 2 ) {
return createStoredObject( uri,
packageItem,
0 );
}
AssetItem asset;
try {
asset = loadAssetItemFromPackageItem( packageItem,
path[2] );
} catch ( Exception e ) {
return null;
}
return createStoredObject( uri,
asset,
asset.getContentLength() );
}
private StoredObject getStoredObjectForReadOnlyGlobalArea(String uri,
RulesRepository repository,
String[] path) {
if ( path.length == 1 ) {
StoredObject so = createStoredObject( uri,
loadGlobalAreaFromRepository(),
0 );
so.setFolder( isFolder( uri ) );
return so;
} else if ( path.length == 2 ) {
AssetItem asset;
try {
asset = loadAssetItemFromGlobalArea( path );
} catch ( Exception e ) {
return null;
}
return createStoredObject( uri,
asset,
asset.getContentLength() );
} else if ( path.length == 3 ) {
AssetItem asset;
try {
asset = loadAssetItemFromGlobalArea( path );
} catch ( Exception e ) {
return null;
}
return createStoredObject( uri,
asset,
asset.getContentLength() );
}
throw new UnsupportedOperationException();
}
private StoredObject createStoredObject(String uri,
VersionableItem versionableItem,
long resourceLength) {
StoredObject so = new StoredObject();
so.setCreationDate( versionableItem.getCreatedDate().getTime() );
so.setFolder( isFolder( uri ) );
so.setLastModified( versionableItem.getLastModified().getTime() );
so.setResourceLength( resourceLength );
return so;
}
private InputStream getContent(String uri) {
String[] path = getPath( uri );
if ( isPackages( path ) ) {
return getAssetData( loadAssetItemFromPackage( path ) );
}
if ( isSnaphosts( path ) ) {
return getAssetData( loadAssetItemFromPackageSnaphot( path ) );
}
if ( isGlobalAreas( path ) ) {
return getAssetData( loadAssetItemFromGlobalArea( path ) );
}
throw new UnsupportedOperationException();
}
private InputStream getAssetData(AssetItem assetItem) {
if ( assetItem.isBinary() ) {
return assetItem.getBinaryContentAttachment();
}
return new ByteArrayInputStream( assetItem.getContent().getBytes() );
}
public long getResourceLength(ITransaction iTransaction,
String uri) {
String[] path = getPath( uri );
try {
if ( path.length == 3 && isPackages( path ) ) {
return loadAssetItemFromPackage( path ).getContentLength();
}
if ( path.length == 3 && isGlobalAreas( path ) ) {
return loadAssetItemFromPackage( path ).getContentLength();
}
if ( path.length == 4 && isSnaphosts( path ) ) {
return loadAssetItemFromPackageSnaphot( path ).getContentLength();
}
return 0;
} catch ( Exception e ) {
System.err.println( "Not able to get content length" );
return 0;
}
}
boolean isFolder(String uri) {
String[] path = getPath( uri );
if ( path.length == 0 ) {
return true;
}
if ( path.length == 1 && (isPackages( path ) || isSnaphosts( path ) || isGlobalAreas( path )) ) {
return true;
}
if ( path.length == 2 ) {
return rulesRepository.containsModule( path[1] );
}
if ( path.length == 3 && isSnaphosts( path ) ) {
return rulesRepository.containsModule( path[1] );
}
return false;
}
boolean isResource(String uri) {
String[] path = getPath( uri );
if ( path.length < 3 ) {
return false;
}
if ( !(isPackages( path ) || isSnaphosts( path ) || isGlobalAreas( path )) ) {
return false;
}
if ( rulesRepository.containsModule( path[1] ) ) {
if ( isPackages( path ) ) {
ModuleItem pkg = loadPackageFromRepository( path[1] );
if ( path[2].startsWith( "._" ) ) {
return osxDoubleData.containsKey( uri );
}
return pkg.containsAsset( AssetItem.getAssetNameFromFileName( path[2] )[0] );
}
if ( path.length == 4 ) {
return isAssetItemInPackage( rulesRepository,
path );
}
return false;
}
return false;
}
boolean objectExists(String uri) {
if ( uri.indexOf( " copy " ) > 0 ) {
throw new IllegalArgumentException( "OSX is not capable of copy and pasting without breaking the file extension." );
}
return internalObjectExists( uri );
}
private boolean internalObjectExists(String uri) {
if ( uri.endsWith( ".DS_Store" ) ) {
return false;
}
String[] path = getPath( uri );
if ( path.length == 0 || (path.length == 1 && (isPackages( path ) || isSnaphosts( path ) || isGlobalAreas( path ))) ) {
return true;
}
if ( path.length == 1 || !rulesRepository.containsModule( path[1] ) ) {
return false;
}
if ( isPackages( path ) ) {
return handlePackagesInternalObjectExists( uri,
rulesRepository,
path );
}
if ( isSnaphosts( path ) ) {
return handleSnapshotsInternalObjectExists( rulesRepository,
path );
}
if ( isGlobalAreas( path ) ) {
return handlePackagesInternalObjectExists( uri,
rulesRepository,
path );
}
throw new IllegalStateException();
}
private boolean handleSnapshotsInternalObjectExists(RulesRepository repository,
String[] path) {
if ( path.length == 2 ) {
return repository.containsModule( path[1] );
}
if ( path.length == 3 ) {
return repository.containsSnapshot( path[1],
path[2] );
}
if ( path.length == 4 ) {
return isAssetItemInPackage( repository,
path );
}
return false;
}
private boolean handlePackagesInternalObjectExists(String uri,
RulesRepository repository,
String[] path) {
if ( path.length == 2 ) {
ModuleItem pkg = loadPackageFromRepository( path[1] );
return !pkg.isArchived();
}
ModuleItem pkg = loadPackageFromRepository( path[1] );
if ( path[2].startsWith( "._" ) ) {
return WebDAVImpl.osxDoubleData.containsKey( uri );
}
String assetName = AssetItem.getAssetNameFromFileName( path[2] )[0];
return pkg.containsAsset( assetName ) && !pkg.loadAsset( assetName ).isArchived();
}
public void removeObject(ITransaction iTransaction,
String uri) {
String[] path = getPath( uri );
if ( path.length == 0 || path.length == 1 ) {
throw new IllegalArgumentException();
}
if ( isPackages( path ) ) {
ModuleItem packageItem = loadPackageFromRepository( path[1] );
if ( path.length == 3 ) {
//delete asset
if ( path[2].startsWith( "._" ) ) {
WebDAVImpl.osxDoubleData.remove( uri );
return;
}
AssetItem item = loadAssetItemFromPackageItem( packageItem,
path[2] );
item.archiveItem( true );
item.checkin( "" );
} else {
//delete package
packageItem.archiveItem( true );
packageItem.checkin( "" );
}
} else if ( isGlobalAreas( path ) ) {
if ( path.length == 2 ) {
//delete asset
if ( path[1].startsWith( "._" ) ) {
WebDAVImpl.osxDoubleData.remove( uri );
return;
}
AssetItem item = loadAssetItemFromGlobalArea( path );
item.archiveItem( true );
item.checkin( "" );
}
} else {
throw new IllegalArgumentException( "Not allowed to remove this file." );
}
}
public void rollback(ITransaction iTransaction) {
rulesRepository.getSession().logout();
}
public long setResourceContent(ITransaction iTransaction,
String uri,
InputStream content,
String contentType,
String characterEncoding) {
if ( uri.endsWith( ".DS_Store" ) ) {
return 0;
}
String[] path = getPath( uri );
if ( isPackages( path ) ) {
if ( path.length != 3 ) {
throw new IllegalArgumentException( "Not a valid resource path " + uri );
}
if ( path[2].startsWith( "._" ) ) {
try {
WebDAVImpl.osxDoubleData.put( uri,
IOUtils.toByteArray( content ) );
} catch ( IOException e ) {
throw new RuntimeException( e );
}
return 0;
}
AssetItem asset = loadAssetItemFromPackage( path );
if ( asset.getFormat().equals( "drl" ) ) {
try {
BufferedReader reader = new BufferedReader( new InputStreamReader( content ) );
StringBuilder sb = new StringBuilder();
String line = null;
while ( (line = reader.readLine()) != null ) {
if ( !line.startsWith( "package " ) ) {
sb.append( line ).append( "\n" );
}
}
asset.updateBinaryContentAttachment( new ByteArrayInputStream( sb.toString().getBytes( "UTF-8" ) ) );
} catch ( Exception e ) {
//default
asset.updateBinaryContentAttachment( content );
}
} else {
asset.updateBinaryContentAttachment( content );
}
//here we could save, or check in, depending on if enough time has passed to justify
//a new version. Otherwise we will pollute the version history with lots of trivial versions.
//if (shouldCreateNewVersion(asset.getLastModified())) {
asset.updateValid(assetValidator.validate(asset));
asset.checkin( "content from webdav" );
//}
} else if ( isGlobalAreas( path ) ) {
if ( path[1].startsWith( "._" ) ) {
try {
WebDAVImpl.osxDoubleData.put( uri,
IOUtils.toByteArray( content ) );
} catch ( IOException e ) {
throw new RuntimeException( e );
}
return 0;
}
AssetItem asset = loadAssetItemFromGlobalArea( path );
if ( asset.getFormat().equals( "drl" ) ) {
try {
BufferedReader reader = new BufferedReader( new InputStreamReader( content ) );
StringBuilder sb = new StringBuilder();
String line = null;
while ( (line = reader.readLine()) != null ) {
if ( !line.startsWith( "package " ) ) {
sb.append( line ).append( "\n" );
}
}
asset.updateBinaryContentAttachment( new ByteArrayInputStream( sb.toString().getBytes( "UTF-8" ) ) );
} catch ( Exception e ) {
//default
asset.updateBinaryContentAttachment( content );
}
} else {
asset.updateBinaryContentAttachment( content );
}
//here we could save, or check in, depending on if enough time has passed to justify
//a new version. Otherwise we will pollute the version history with lots of trivial versions.
//if (shouldCreateNewVersion(asset.getLastModified())) {
asset.updateValid(assetValidator.validate(asset));
asset.checkin( "content from webdav" );
//}
} else {
throw new UnsupportedOperationException( "Unable to save content to this location." );
}
return 0;
}
//REVISIT: We should never reach this code which is using webdav as regex,
//i.e., input uri is sth like /webdav/packages/mypackage
String[] getPath(String uri) {
// if (beanManagerLocator.isBeanManagerAvailable()) {
return getPath( uri,
false );
// } else {
// return getPath(uri,
// true);
// }
}
String[] getPath(String uri,
boolean usingWebdavAsRegex) {
if ( uri.equals( "/" ) ) {
return new String[0];
}
if ( usingWebdavAsRegex ) {
if ( uri.endsWith( "webdav" ) || uri.endsWith( "webdav/" ) ) {
return new String[0];
}
if ( uri.contains( "webdav/" ) ) {
return uri.split( "webdav/",
2 )[1].split( "/" );
}
}
return uri.substring( 1 ).split( "/" );
}
private AssetItem loadAssetItemFromPackage(String[] path) {
return loadAssetItemFromPackageItem( loadPackageFromRepository(
path[1] ),
path[2] );
}
private AssetItem loadAssetItemFromPackageSnaphot(String[] path) {
return loadAssetItemFromPackageItem( loadPackageSnapshotFromRepository(
path ),
path[3] );
}
private AssetItem loadAssetItemFromGlobalArea(String[] path) {
return loadAssetItemFromPackageItem( loadGlobalAreaFromRepository(),
path[1] );
}
private AssetItem loadAssetItemFromPackageItem(ModuleItem pkg,
String path) {
return pkg.loadAsset( AssetItem.getAssetNameFromFileName( path )[0] );
}
private boolean isAssetItemInPackage(RulesRepository repository,
String[] path) {
return loadPackageSnapshotFromRepository( path ).containsAsset( AssetItem.getAssetNameFromFileName( path[3] )[0] );
}
private ModuleItem loadPackageFromRepository(String path) {
return rulesRepository.loadModule( path );
}
private ModuleItem loadPackageSnapshotFromRepository(String[] path) {
return rulesRepository.loadModuleSnapshot( path[1],
path[2] );
}
private ModuleItem loadGlobalAreaFromRepository() {
return rulesRepository.loadGlobalArea();
}
private boolean isPermission(String[] path,
int pathIndex) {
return path.length == pathIndex;
}
private boolean isPackages(String[] path) {
return path[0].equals( PACKAGES );
}
private boolean isSnaphosts(String[] path) {
return path[0].equals( SNAPSHOTS );
}
private boolean isGlobalAreas(String[] path) {
return path[0].equals( GLOBALAREA );
}
}
|
923fdbc6a87e72ffaf2122aebd3e8a69cb261164
| 494 |
java
|
Java
|
springboot-mybatis-batch/src/main/java/com/leo/mapper/UserMapper.java
|
leowy/springboot
|
a2a96311a93d1db2bec5effdbc01c0d441d5bdbd
|
[
"Apache-2.0"
] | null | null | null |
springboot-mybatis-batch/src/main/java/com/leo/mapper/UserMapper.java
|
leowy/springboot
|
a2a96311a93d1db2bec5effdbc01c0d441d5bdbd
|
[
"Apache-2.0"
] | null | null | null |
springboot-mybatis-batch/src/main/java/com/leo/mapper/UserMapper.java
|
leowy/springboot
|
a2a96311a93d1db2bec5effdbc01c0d441d5bdbd
|
[
"Apache-2.0"
] | null | null | null | 20.583333 | 111 | 0.722672 | 1,001,312 |
package com.leo.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.leo.entity.User;
/**
*
* @author Leowy Zhuang
*/
public interface UserMapper {
@Select("SELECT * FROM users")
List<User> getAll();
@Insert("INSERT INTO users(userName,password,email) VALUES (#{user.userName},#{user.password},#{user.email})")
int addUser(@Param("user")User user);
}
|
923fdbd25fc34889cbb9d4c84121baa6baa6e386
| 569 |
java
|
Java
|
src/main/java/com/alipay/api/domain/RecruitMiniApp.java
|
alipay/alipay-sdk-java-all
|
e87bc8e7f6750e168a5f9d37221124c085d1e3c1
|
[
"Apache-2.0"
] | 333 |
2018-08-28T09:26:55.000Z
|
2022-03-31T07:26:42.000Z
|
src/main/java/com/alipay/api/domain/RecruitMiniApp.java
|
alipay/alipay-sdk-java-all
|
e87bc8e7f6750e168a5f9d37221124c085d1e3c1
|
[
"Apache-2.0"
] | 46 |
2018-09-27T03:52:42.000Z
|
2021-08-10T07:54:57.000Z
|
src/main/java/com/alipay/api/domain/RecruitMiniApp.java
|
alipay/alipay-sdk-java-all
|
e87bc8e7f6750e168a5f9d37221124c085d1e3c1
|
[
"Apache-2.0"
] | 158 |
2018-12-07T17:03:43.000Z
|
2022-03-17T09:32:43.000Z
| 18.966667 | 68 | 0.6942 | 1,001,313 |
package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 招商报名提交的小程序信息
*
* @author auto create
* @since 1.0, 2021-06-30 23:43:36
*/
public class RecruitMiniApp extends AlipayObject {
private static final long serialVersionUID = 7215178213775846563L;
/**
* 小程序ID
*/
@ApiField("mini_app_id")
private String miniAppId;
public String getMiniAppId() {
return this.miniAppId;
}
public void setMiniAppId(String miniAppId) {
this.miniAppId = miniAppId;
}
}
|
923fdc3d4ba5ac64495faf71b19f6f5841dc3a27
| 1,584 |
java
|
Java
|
src/main/java/com/synopsys/integration/rest/component/IntRestComponent.java
|
JonathanKershaw/integration-rest
|
b8b92154466be1242b028ea0e24ebfc8bb77d764
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/com/synopsys/integration/rest/component/IntRestComponent.java
|
JonathanKershaw/integration-rest
|
b8b92154466be1242b028ea0e24ebfc8bb77d764
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/com/synopsys/integration/rest/component/IntRestComponent.java
|
JonathanKershaw/integration-rest
|
b8b92154466be1242b028ea0e24ebfc8bb77d764
|
[
"Apache-2.0"
] | null | null | null | 29.333333 | 65 | 0.725379 | 1,001,314 |
/**
* integration-rest
*
* Copyright (c) 2020 Synopsys, Inc.
*
* 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.synopsys.integration.rest.component;
import com.google.gson.JsonElement;
import com.synopsys.integration.util.Stringable;
/**
* A base class for any object that can interact with a REST API.
*/
public class IntRestComponent extends Stringable {
public static final String FIELD_NAME_JSON = "json";
private String json;
private transient JsonElement jsonElement;
public String getJson() {
return json;
}
public void setJson(final String json) {
this.json = json;
}
public JsonElement getJsonElement() {
return jsonElement;
}
public void setJsonElement(final JsonElement jsonElement) {
this.jsonElement = jsonElement;
}
}
|
923fdc76cb98443edcae01d74ec115f6f9bb7183
| 1,310 |
java
|
Java
|
src/main/java/org/greports/engine/ValueType.java
|
IhorPatychenko/report-engine
|
4e67b2dcb61cedba824aaf7b9a062a1d064a394f
|
[
"MIT"
] | null | null | null |
src/main/java/org/greports/engine/ValueType.java
|
IhorPatychenko/report-engine
|
4e67b2dcb61cedba824aaf7b9a062a1d064a394f
|
[
"MIT"
] | 1 |
2021-03-14T14:25:59.000Z
|
2021-03-14T14:25:59.000Z
|
src/main/java/org/greports/engine/ValueType.java
|
IhorPatychenko/report-engine
|
4e67b2dcb61cedba824aaf7b9a062a1d064a394f
|
[
"MIT"
] | null | null | null | 30.465116 | 85 | 0.643511 | 1,001,315 |
package org.greports.engine;
import org.greports.interfaces.collectedvalues.CollectedFormulaValues;
import org.greports.interfaces.collectedvalues.CollectedValues;
public enum ValueType {
/**
* Cell plain value.
*/
PLAIN_VALUE,
/**
* Cell formula value.
*/
FORMULA,
/**
* Cell formula value. Used to indicate to the engine that this type of cell
* needs to be ignored during data inject, but this one needs to reindex
* cell references used in the formula.
*/
TEMPLATED_FORMULA,
/**
* Indicates that the reference to some method will be used to obtain the value.
* When used an exact method name should be provided.
* Examples: "getId", "getTotal", "toString"
*/
METHOD,
/**
* Used in {@link CollectedValues} interface to collect all values from
* all collection entries.
*/
COLLECTED_VALUE,
/**
* Used in {@link CollectedFormulaValues} interface to collect all values from
* all entries and put them as entries of the formula provided.
*/
COLLECTED_FORMULA_VALUE,
/**
* Completely ignores the column content and it's title if set,
* but conserves it's physical position in excel file.
*/
IGNORED_VALUE
}
|
923fdeb2397767d5f50f70173906517ae8007038
| 6,996 |
java
|
Java
|
src/main/java/com/supervisor/generated/jooq/tables/ActivityTemplateLike.java
|
my-supervisor/my-supervisor
|
ba6ecc4a3373cd439586a72a8e9fc035b09a3f2b
|
[
"CC-BY-3.0"
] | 3 |
2022-01-31T20:40:22.000Z
|
2022-02-11T04:15:44.000Z
|
src/main/java/com/supervisor/generated/jooq/tables/ActivityTemplateLike.java
|
my-supervisor/my-supervisor
|
ba6ecc4a3373cd439586a72a8e9fc035b09a3f2b
|
[
"CC-BY-3.0"
] | 33 |
2022-01-31T20:40:16.000Z
|
2022-02-21T01:57:51.000Z
|
src/main/java/com/supervisor/generated/jooq/tables/ActivityTemplateLike.java
|
my-supervisor/my-supervisor
|
ba6ecc4a3373cd439586a72a8e9fc035b09a3f2b
|
[
"CC-BY-3.0"
] | null | null | null | 33.797101 | 200 | 0.691967 | 1,001,316 |
/*
* This file is generated by jOOQ.
*/
package com.supervisor.generated.jooq.tables;
import com.supervisor.generated.jooq.Keys;
import com.supervisor.generated.jooq.Public;
import com.supervisor.generated.jooq.tables.records.ActivityTemplateLikeRecord;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Row9;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;
/**
* This class is generated by jOOQ.
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class ActivityTemplateLike extends TableImpl<ActivityTemplateLikeRecord> {
private static final long serialVersionUID = 1L;
/**
* The reference instance of <code>public.activity_template_like</code>
*/
public static final ActivityTemplateLike ACTIVITY_TEMPLATE_LIKE = new ActivityTemplateLike();
/**
* The class holding records for this type
*/
@Override
public Class<ActivityTemplateLikeRecord> getRecordType() {
return ActivityTemplateLikeRecord.class;
}
/**
* The column <code>public.activity_template_like.creation_date</code>.
*/
public final TableField<ActivityTemplateLikeRecord, LocalDateTime> CREATION_DATE = createField(DSL.name("creation_date"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "");
/**
* The column <code>public.activity_template_like.creator_id</code>.
*/
public final TableField<ActivityTemplateLikeRecord, UUID> CREATOR_ID = createField(DSL.name("creator_id"), SQLDataType.UUID.nullable(false), this, "");
/**
* The column
* <code>public.activity_template_like.last_modification_date</code>.
*/
public final TableField<ActivityTemplateLikeRecord, LocalDateTime> LAST_MODIFICATION_DATE = createField(DSL.name("last_modification_date"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "");
/**
* The column <code>public.activity_template_like.last_modifier_id</code>.
*/
public final TableField<ActivityTemplateLikeRecord, UUID> LAST_MODIFIER_ID = createField(DSL.name("last_modifier_id"), SQLDataType.UUID.nullable(false), this, "");
/**
* The column <code>public.activity_template_like.owner_id</code>.
*/
public final TableField<ActivityTemplateLikeRecord, UUID> OWNER_ID = createField(DSL.name("owner_id"), SQLDataType.UUID.nullable(false), this, "");
/**
* The column <code>public.activity_template_like.tag</code>.
*/
public final TableField<ActivityTemplateLikeRecord, String> TAG = createField(DSL.name("tag"), SQLDataType.VARCHAR, this, "");
/**
* The column <code>public.activity_template_like.id</code>.
*/
public final TableField<ActivityTemplateLikeRecord, UUID> ID = createField(DSL.name("id"), SQLDataType.UUID.nullable(false), this, "");
/**
* The column <code>public.activity_template_like.template_id</code>.
*/
public final TableField<ActivityTemplateLikeRecord, UUID> TEMPLATE_ID = createField(DSL.name("template_id"), SQLDataType.UUID.nullable(false), this, "");
/**
* The column <code>public.activity_template_like.user_id</code>.
*/
public final TableField<ActivityTemplateLikeRecord, UUID> USER_ID = createField(DSL.name("user_id"), SQLDataType.UUID.nullable(false), this, "");
private ActivityTemplateLike(Name alias, Table<ActivityTemplateLikeRecord> aliased) {
this(alias, aliased, null);
}
private ActivityTemplateLike(Name alias, Table<ActivityTemplateLikeRecord> aliased, Field<?>[] parameters) {
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
}
/**
* Create an aliased <code>public.activity_template_like</code> table
* reference
*/
public ActivityTemplateLike(String alias) {
this(DSL.name(alias), ACTIVITY_TEMPLATE_LIKE);
}
/**
* Create an aliased <code>public.activity_template_like</code> table
* reference
*/
public ActivityTemplateLike(Name alias) {
this(alias, ACTIVITY_TEMPLATE_LIKE);
}
/**
* Create a <code>public.activity_template_like</code> table reference
*/
public ActivityTemplateLike() {
this(DSL.name("activity_template_like"), null);
}
public <O extends Record> ActivityTemplateLike(Table<O> child, ForeignKey<O, ActivityTemplateLikeRecord> key) {
super(child, key, ACTIVITY_TEMPLATE_LIKE);
}
@Override
public Schema getSchema() {
return aliased() ? null : Public.PUBLIC;
}
@Override
public UniqueKey<ActivityTemplateLikeRecord> getPrimaryKey() {
return Keys.ACTIVITY_TEMPLATE_LIKE_PKEY;
}
@Override
public List<ForeignKey<ActivityTemplateLikeRecord, ?>> getReferences() {
return Arrays.asList(Keys.ACTIVITY_TEMPLATE_LIKE__ACTIVITY_TEMPLATE_LIKE_TEMPLATE_ID_FKEY, Keys.ACTIVITY_TEMPLATE_LIKE__ACTIVITY_TEMPLATE_LIKE_USER_ID_FKEY);
}
private transient ActivityTemplatePublished _activityTemplatePublished;
private transient User _user;
/**
* Get the implicit join path to the
* <code>public.activity_template_published</code> table.
*/
public ActivityTemplatePublished activityTemplatePublished() {
if (_activityTemplatePublished == null)
_activityTemplatePublished = new ActivityTemplatePublished(this, Keys.ACTIVITY_TEMPLATE_LIKE__ACTIVITY_TEMPLATE_LIKE_TEMPLATE_ID_FKEY);
return _activityTemplatePublished;
}
/**
* Get the implicit join path to the <code>public.user</code> table.
*/
public User user() {
if (_user == null)
_user = new User(this, Keys.ACTIVITY_TEMPLATE_LIKE__ACTIVITY_TEMPLATE_LIKE_USER_ID_FKEY);
return _user;
}
@Override
public ActivityTemplateLike as(String alias) {
return new ActivityTemplateLike(DSL.name(alias), this);
}
@Override
public ActivityTemplateLike as(Name alias) {
return new ActivityTemplateLike(alias, this);
}
/**
* Rename this table
*/
@Override
public ActivityTemplateLike rename(String name) {
return new ActivityTemplateLike(DSL.name(name), null);
}
/**
* Rename this table
*/
@Override
public ActivityTemplateLike rename(Name name) {
return new ActivityTemplateLike(name, null);
}
// -------------------------------------------------------------------------
// Row9 type methods
// -------------------------------------------------------------------------
@Override
public Row9<LocalDateTime, UUID, LocalDateTime, UUID, UUID, String, UUID, UUID, UUID> fieldsRow() {
return (Row9) super.fieldsRow();
}
}
|
923fe04641a0dde054f73a10378a3badb8f1c7fc
| 1,621 |
java
|
Java
|
mantis-tests/src/test/java/ru/stqa/pft/mantis/tests/ChangePasswordTests.java
|
AlexVprofit/java_pft_39
|
83432387454063629b79ce8b77c58a324618749a
|
[
"Apache-2.0"
] | null | null | null |
mantis-tests/src/test/java/ru/stqa/pft/mantis/tests/ChangePasswordTests.java
|
AlexVprofit/java_pft_39
|
83432387454063629b79ce8b77c58a324618749a
|
[
"Apache-2.0"
] | null | null | null |
mantis-tests/src/test/java/ru/stqa/pft/mantis/tests/ChangePasswordTests.java
|
AlexVprofit/java_pft_39
|
83432387454063629b79ce8b77c58a324618749a
|
[
"Apache-2.0"
] | null | null | null | 34.489362 | 127 | 0.739667 | 1,001,317 |
package ru.stqa.pft.mantis.tests;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import ru.stqa.pft.mantis.model.UserData;
import javax.mail.MessagingException;
import javax.xml.rpc.ServiceException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.rmi.RemoteException;
import java.sql.SQLException;
import static org.testng.Assert.assertTrue;
public class ChangePasswordTests extends TestBase {
@BeforeMethod
public void startMailSrver() throws RemoteException, ServiceException, MalformedURLException {
app.mail().start();
// получение из багтрекера (mantis) информации о баг-репорте( исправленный - trueб нет - false)с заданным идентификатором
// и если баг-репорт не исправен выполнение теста пропускается
skipIfNotFixed(Integer.valueOf(app.getProperty("web.bugIdNotFiuxed").toString()));
}
@Test
public void testChangePassword() throws IOException, SQLException, MessagingException, InterruptedException {
UserData user;
String newPassword = app.getProperty("web.adminPassword");
app.change().goManagePage();
user = app.change().findUser();
app.change().resetPassword();
app.change().changePassword(newPassword);
// проверка что пользователь с новым (измененным) паролем зашел на сайт
// HttpSession session = app.newSession();
assertTrue(app.newSession().login(user.getLogin(), newPassword));
}
@AfterMethod(alwaysRun = true)
public void stopMailServer() {
app.mail().stop();
}
}
|
923fe0c2a5a0b69e7e25b8e758a34b6dd5020f6c
| 646 |
java
|
Java
|
backstage-manage-api/src/main/java/com/ak47007/model/addr/AdInfo.java
|
ChinaDragonNB/blog-open
|
8b630280fa1b209da89110f1cc2387878cdb992f
|
[
"MIT"
] | 4 |
2021-07-13T12:05:30.000Z
|
2022-01-08T09:30:56.000Z
|
backstage-manage-api/src/main/java/com/ak47007/model/addr/AdInfo.java
|
ChinaDragonNB/blog-open
|
8b630280fa1b209da89110f1cc2387878cdb992f
|
[
"MIT"
] | null | null | null |
backstage-manage-api/src/main/java/com/ak47007/model/addr/AdInfo.java
|
ChinaDragonNB/blog-open
|
8b630280fa1b209da89110f1cc2387878cdb992f
|
[
"MIT"
] | null | null | null | 14.681818 | 47 | 0.560372 | 1,001,318 |
package com.ak47007.model.addr;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author AK47007
* @date 2020/6/20
* Describe:
*/
@Data
public class AdInfo {
/**
* 国家
*/
@ApiModelProperty(value = "国家")
private String nation;
/**
* 省
*/
@ApiModelProperty(value = "省")
private String province;
/**
* 市
*/
@ApiModelProperty(value = "市")
private String city;
/**
* 区
*/
@ApiModelProperty(value = "区")
private String district;
/**
* 行政区划代码
*/
@ApiModelProperty(value = "行政区划代码")
private Integer adCode;
}
|
923fe0c2b9ccbafea96b78134eb1474ea6e70ae7
| 1,501 |
java
|
Java
|
java_solutions/700.search-in-a-binary-search-tree.240164803.ac.java
|
stavanmehta/leetcode
|
1224e43ce29430c840e65daae3b343182e24709c
|
[
"Apache-2.0"
] | null | null | null |
java_solutions/700.search-in-a-binary-search-tree.240164803.ac.java
|
stavanmehta/leetcode
|
1224e43ce29430c840e65daae3b343182e24709c
|
[
"Apache-2.0"
] | null | null | null |
java_solutions/700.search-in-a-binary-search-tree.240164803.ac.java
|
stavanmehta/leetcode
|
1224e43ce29430c840e65daae3b343182e24709c
|
[
"Apache-2.0"
] | null | null | null | 23.092308 | 78 | 0.58561 | 1,001,319 |
/*
* @lc app=leetcode id=700 lang=java
*
* [700] Search in a Binary Search Tree
*
* https://leetcode.com/problems/search-in-a-binary-search-tree/description/
*
* algorithms
* Easy (68.95%)
* Total Accepted: 71.7K
* Total Submissions: 104K
* Testcase Example: '[4,2,7,1,3]\n2'
*
* Given the root node of a binary search tree (BST) and a value. You need to
* find the node in the BST that the node's value equals the given value.
* Return the subtree rooted with that node. If such node doesn't exist, you
* should return NULL.
*
* For example,
*
*
* Given the tree:
* 4
* / \
* 2 7
* / \
* 1 3
*
* And the value to search: 2
*
*
* You should return this subtree:
*
*
* 2
* / \
* 1 3
*
*
* In the example above, if we want to search the value 5, since there is no
* node with value 5, we should return NULL.
*
* Note that an empty tree is represented by NULL, therefore you would see the
* expected output (serialized tree format) as [], not null.
*
*/
/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
class Solution {
public TreeNode searchBST(TreeNode root, int val) {
if (root == null)
return root;
if (root.val == val)
return root;
return searchBST(root.val < val ?root.right:root.left,val);
}
}
|
923fe14456b2832fc36d15e3566a3d88725b164e
| 3,701 |
java
|
Java
|
querydsl-sql-codegen/src/main/java/com/querydsl/sql/codegen/NamingStrategy.java
|
kevinleturc/querydsl
|
c2365dabb4592e61978d81d99980238c0eb61723
|
[
"Apache-2.0"
] | null | null | null |
querydsl-sql-codegen/src/main/java/com/querydsl/sql/codegen/NamingStrategy.java
|
kevinleturc/querydsl
|
c2365dabb4592e61978d81d99980238c0eb61723
|
[
"Apache-2.0"
] | null | null | null |
querydsl-sql-codegen/src/main/java/com/querydsl/sql/codegen/NamingStrategy.java
|
kevinleturc/querydsl
|
c2365dabb4592e61978d81d99980238c0eb61723
|
[
"Apache-2.0"
] | null | null | null | 25.176871 | 90 | 0.651986 | 1,001,320 |
/*
* Copyright 2015, The Querydsl Team (http://www.querydsl.com/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 com.querydsl.sql.codegen;
import com.querydsl.codegen.EntityType;
/**
* {@code NamingStrategy} defines a conversion strategy from table to class and column
* to property names
*
* @author tiwe
*/
public interface NamingStrategy {
/**
* Normalizes and appends the given schema name to the package name
*
* @param packageName
* @param schema
* @return
*/
String appendSchema(String packageName, String schema);
/**
* Convert the given tableName to a simple class name
* @return
*/
String getClassName(String tableName);
/**
* Get the default alias for the given EntityType
*
* @param entityType
* @return
*/
String getDefaultAlias(EntityType entityType);
/**
* Get the default variable name for the given EntityType
*
* @param entityType
* @return
*/
String getDefaultVariableName(EntityType entityType);
/**
* Get the class name for the foreign keys inner class
*
* @return
*/
String getForeignKeysClassName();
/**
* Get the field name for the foreign keys class instance
*
* @return
*/
String getForeignKeysVariable(EntityType entityType);
/**
* Get the class name for the primary keys inner class
*
* @return
*/
String getPrimaryKeysClassName();
/**
* Get the field name for the primary keys class instance
*
* @return
*/
String getPrimaryKeysVariable(EntityType entityType);
/**
* Convert the given column name to a property name
*
* @param columnName
* @param entityType
* @return
*/
String getPropertyName(String columnName, EntityType entityType);
/**
* Convert the given foreign key name to a foreign key property name
*
* @param foreignKeyName
* @param entityType
* @return
*/
String getPropertyNameForForeignKey(String foreignKeyName, EntityType entityType);
/**
* Convert the given foreign key name to a foreign key property name
*
* @param name
* @param model
* @return
*/
String getPropertyNameForInverseForeignKey(String name, EntityType model);
/**
* Convert the given primary key name to a primary key property name
*
* @param name
* @param model
* @return
*/
String getPropertyNameForPrimaryKey(String name, EntityType model);
/**
* Convert the given column name and provide the opportunity to add quoted identifiers
*
* @param columnName
* @return
*/
String normalizeColumnName(String columnName);
/**
* Convert the given table name and provide the opportunity to add quoted identifiers
*
* @param tableName
* @return
*/
String normalizeTableName(String tableName);
/**
* Convert the given schema name and provide the opportunity to add quoted identifiers
*
* @param schemaName
* @return
*/
String normalizeSchemaName(String schemaName);
}
|
923fe2ed7e2c5d2ed3d4cce92ce0282577f77e0e
| 1,138 |
java
|
Java
|
base.core/src/main/java/eapli/base/colaboratormanagement/domain/Classificacao.java
|
rafael-ribeiro1/lapr4-isep
|
80ed93bcf377b70e23a0c41ee332dd6666244611
|
[
"MIT"
] | null | null | null |
base.core/src/main/java/eapli/base/colaboratormanagement/domain/Classificacao.java
|
rafael-ribeiro1/lapr4-isep
|
80ed93bcf377b70e23a0c41ee332dd6666244611
|
[
"MIT"
] | null | null | null |
base.core/src/main/java/eapli/base/colaboratormanagement/domain/Classificacao.java
|
rafael-ribeiro1/lapr4-isep
|
80ed93bcf377b70e23a0c41ee332dd6666244611
|
[
"MIT"
] | null | null | null | 22.76 | 80 | 0.662566 | 1,001,321 |
package eapli.base.colaboratormanagement.domain;
import javax.persistence.Embeddable;
import java.util.Objects;
@Embeddable
public class Classificacao {
private static final long serialVersionUID = 1L;
final private double classificacao;
private final static int LOWEST_CLASSIFICACAO=0;
public Classificacao (final double classi){
if(classi<LOWEST_CLASSIFICACAO)
throw new IllegalArgumentException("Valor invalido de classificao");
this.classificacao=classi;
}
protected Classificacao (){
classificacao=0;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Classificacao that = (Classificacao) o;
return this.classificacao==that.classificacao;
}
public double valorClassificacao() {
return classificacao;
}
@Override
public int hashCode() {
return Objects.hash(this.classificacao);
}
@Override
public String toString() {
return ((Double) this.classificacao).toString();
}
}
|
923fe34cf9aa8f8663a1c1c9835b07c2e5643e2c
| 2,742 |
java
|
Java
|
Veterinary/DemoTest-ejb/src/java/model/StaffFacade.java
|
nix0x00/JavaEE
|
7e1dd9cafc7af2760485cfe63871f3315d7db6a4
|
[
"MIT"
] | null | null | null |
Veterinary/DemoTest-ejb/src/java/model/StaffFacade.java
|
nix0x00/JavaEE
|
7e1dd9cafc7af2760485cfe63871f3315d7db6a4
|
[
"MIT"
] | null | null | null |
Veterinary/DemoTest-ejb/src/java/model/StaffFacade.java
|
nix0x00/JavaEE
|
7e1dd9cafc7af2760485cfe63871f3315d7db6a4
|
[
"MIT"
] | null | null | null | 30.131868 | 114 | 0.625456 | 1,001,322 |
/*
* 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 model;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.Base64;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
/**
*
* @author abspk
*/
@Stateless
public class StaffFacade extends AbstractFacade<Staff> {
@PersistenceContext(unitName = "DemoTest-ejbPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public StaffFacade() {
super(Staff.class);
}
public boolean getLogin(String user, String pwd, SecretKeySpec key) {
Staff m = null;
Query q = em.createNamedQuery("Staff.findByEmail");
//Query q = em.createQuery("SELECT e FROM Manager e WHERE e.email = :email");
q.setParameter("email", user);
try {
m = (Staff) q.getSingleResult();
if(m == null) {
return false;
}
} catch(NoResultException x) {
return false;
}
try {
if(decrypt(m.getPwd(), key).equals(pwd)) {
return true;
}
} catch(Exception x) {
return false;
}
return false;
}
public Staff getStaff(String email) {
Staff m = null;
Query q = em.createNamedQuery("Staff.findByEmail");
//Query q = em.createQuery("SELECT e FROM Manager e WHERE e.email = :email");
q.setParameter("email", email);
try {
m = (Staff) q.getSingleResult();
return m;
} catch(NoResultException x) {
x.printStackTrace();
return null;
}
}
private static String decrypt(String string, SecretKeySpec key) throws GeneralSecurityException, IOException {
String iv = string.split(":")[0];
String property = string.split(":")[1];
Cipher pbeCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
pbeCipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(base64Decode(iv)));
return new String(pbeCipher.doFinal(base64Decode(property)), "UTF-8");
}
private static byte[] base64Decode(String property) throws IOException {
return Base64.getDecoder().decode(property);
}
}
|
923fe396a7d95b8adc4148139f520339b80b8937
| 1,464 |
java
|
Java
|
fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/exception/OrganizationalCurrencyNotFoundException.java
|
ezolnbl/fineract
|
015034c37def4d40986f1f5faa5c0212dea2f8ff
|
[
"ECL-2.0",
"Apache-2.0"
] | 668 |
2017-05-17T15:41:24.000Z
|
2022-03-24T15:00:37.000Z
|
fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/exception/OrganizationalCurrencyNotFoundException.java
|
ezolnbl/fineract
|
015034c37def4d40986f1f5faa5c0212dea2f8ff
|
[
"ECL-2.0",
"Apache-2.0"
] | 1,114 |
2017-05-22T13:48:25.000Z
|
2022-03-31T09:49:53.000Z
|
fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/exception/OrganizationalCurrencyNotFoundException.java
|
galovics/fineract
|
665bd0f6fbdbbb772087f11c5b599e51df5c2b64
|
[
"ECL-2.0",
"Apache-2.0"
] | 918 |
2017-05-17T13:28:06.000Z
|
2022-03-31T20:09:01.000Z
| 44.363636 | 134 | 0.771858 | 1,001,323 |
/**
* 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.fineract.organisation.monetary.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
/**
* A {@link RuntimeException} thrown when urrency is not supported by an Organization.
*/
public class OrganizationalCurrencyNotFoundException extends AbstractPlatformResourceNotFoundException {
public OrganizationalCurrencyNotFoundException(final String currencyCode) {
super("error.msg.currency.currencyCode.invalid.or.not.supported",
"Currency with identifier " + currencyCode + " does not exist or is not supported by the Organization", currencyCode);
}
}
|
923fe3a6875d10f3bf6e18460d1c2001d917bdce
| 2,205 |
java
|
Java
|
java-advent-of-code/src/main/java/advent/twenty_sixteen/Day23SafeCracking.java
|
AKiwiCoder/advent-of-code
|
ebf309f03b96cf209abe8b08f1d39b003cb6b88a
|
[
"MIT"
] | 1 |
2019-11-26T13:20:23.000Z
|
2019-11-26T13:20:23.000Z
|
java-advent-of-code/src/main/java/advent/twenty_sixteen/Day23SafeCracking.java
|
AKiwiCoder/advent-of-code
|
ebf309f03b96cf209abe8b08f1d39b003cb6b88a
|
[
"MIT"
] | 1 |
2019-11-11T07:37:21.000Z
|
2019-11-11T07:37:21.000Z
|
java-advent-of-code/src/main/java/advent/twenty_sixteen/Day23SafeCracking.java
|
AKiwiCoder/advent-of-code
|
ebf309f03b96cf209abe8b08f1d39b003cb6b88a
|
[
"MIT"
] | 1 |
2019-12-03T20:59:37.000Z
|
2019-12-03T20:59:37.000Z
| 31.056338 | 104 | 0.595918 | 1,001,324 |
package advent.twenty_sixteen;
import advent.common.DailyProblem;
import advent.twenty_sixteen.support.ILeonardoOperation;
import advent.twenty_sixteen.support.LeonardoToggleOperation;
import advent.utilities.FileUtilities;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Day23SafeCracking implements DailyProblem<Integer, Integer> {
private final int part1Answer;
private final int part2Answer;
public Day23SafeCracking(String filename) {
List<ILeonardoOperation> program = FileUtilities.readLines(filename, ILeonardoOperation::PARSE);
Map<String, Integer> registers = new HashMap<>();
registers.put("a", 7);
registers.put("b", 0);
registers.put("c", 0);
registers.put("d", 0);
executeProgram(new ArrayList<>(program), registers);
this.part1Answer = registers.get("a");
registers.put("a", 12);
registers.put("b", 0);
registers.put("c", 0);
registers.put("d", 0);
executeProgram(new ArrayList<>(program), registers);
this.part2Answer = registers.get("a");
}
private void executeProgram(List<ILeonardoOperation> program, Map<String, Integer> registers) {
int ip = 0;
while (ip < program.size()) {
ILeonardoOperation operation = program.get(ip);
if (operation instanceof LeonardoToggleOperation) {
ip = ((LeonardoToggleOperation) operation).modify(ip, registers, program);
} else {
if ((ip == 5)) {
registers.put("a", registers.get("a") + registers.get("c") * registers.get("d"));
ip = ip + 5;
} else if (ip == 21) {
registers.put("a", registers.get("a") + registers.get("c") * registers.get("d"));
ip = ip + 5;
} else{
ip = operation.execute(ip, registers);
}
}
}
}
@Override
public Integer getPart1Answer() {
return part1Answer;
}
@Override
public Integer getPart2Answer() {
return part2Answer;
}
}
|
923fe3b5b6db02bc8c3978e2da64121d51aab45c
| 1,418 |
java
|
Java
|
ym-EHR/ym-ehr-core/src/main/java/cn/itsource/excel/RewardPunishExcel.java
|
281698821/yunketang
|
945eb653efcc6740195398537b0e045a91c37412
|
[
"MIT"
] | null | null | null |
ym-EHR/ym-ehr-core/src/main/java/cn/itsource/excel/RewardPunishExcel.java
|
281698821/yunketang
|
945eb653efcc6740195398537b0e045a91c37412
|
[
"MIT"
] | 6 |
2020-04-23T18:30:14.000Z
|
2021-12-09T21:22:44.000Z
|
ym-EHR/ym-ehr-core/src/main/java/cn/itsource/excel/RewardPunishExcel.java
|
281698821/yunketang
|
945eb653efcc6740195398537b0e045a91c37412
|
[
"MIT"
] | null | null | null | 18.415584 | 56 | 0.598025 | 1,001,325 |
package cn.itsource.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;
public class RewardPunishExcel implements Serializable {
@Excel(name = "编号")
private Integer id;
@Excel(name = "情况说明")
private String situation;
@Excel(name = "金额")
private Integer money;
@Excel(name = "判断",replace = { "是_1", "否_0" })
private Integer judge;
@Excel(name = "奖罚时间",width = 30,format = "yy-MM-dd")
private Date time;
@Excel(name = "对应员工")
private Integer empId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getSituation() {
return situation;
}
public void setSituation(String situation) {
this.situation = situation;
}
public Integer getMoney() {
return money;
}
public void setMoney(Integer money) {
this.money = money;
}
public Integer getJudge() {
return judge;
}
public void setJudge(Integer judge) {
this.judge = judge;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public Integer getEmpId() {
return empId;
}
public void setEmpId(Integer empId) {
this.empId = empId;
}
}
|
923fe3fc4c65622a89f9a442dedfef9d24f5d199
| 1,667 |
java
|
Java
|
src/main/java/com/astrazeneca/vardict/data/SamView.java
|
mihin/VarDictJava
|
db17547f6e507c729fdffc17e5e4b4ce937899b3
|
[
"MIT"
] | 122 |
2015-05-15T18:56:35.000Z
|
2022-02-25T09:29:32.000Z
|
src/main/java/com/astrazeneca/vardict/data/SamView.java
|
mihin/VarDictJava
|
db17547f6e507c729fdffc17e5e4b4ce937899b3
|
[
"MIT"
] | 282 |
2015-04-13T19:31:57.000Z
|
2022-03-31T15:54:52.000Z
|
src/main/java/com/astrazeneca/vardict/data/SamView.java
|
mihin/VarDictJava
|
db17547f6e507c729fdffc17e5e4b4ce937899b3
|
[
"MIT"
] | 55 |
2015-04-14T09:06:12.000Z
|
2021-08-29T17:31:53.000Z
| 31.45283 | 117 | 0.662268 | 1,001,326 |
package com.astrazeneca.vardict.data;
import htsjdk.samtools.*;
import java.util.HashMap;
import java.util.Map;
import static com.astrazeneca.vardict.data.scopedata.GlobalReadOnlyScope.instance;
/**
* To avoid performance issues only one SamView object on the same file can be opened per thread
*/
public class SamView implements AutoCloseable {
private static ThreadLocal<Map<String, SamReader>> threadLocalSAMReaders = ThreadLocal.withInitial(HashMap::new);
private SAMRecordIterator iterator;
private int filter;
public SamView(String file, String samfilter, Region region, ValidationStringency stringency) {
iterator = fetchReader(file, stringency)
.queryOverlapping(region.chr, region.start, region.end);
filter = Integer.decode(samfilter);
}
/**
* Read record from SAM/BAM file. Skip the record that are filtered with -F filter option.
* @return SAMRecord created from each string in SAM/BAM file.
*/
public SAMRecord read() {
while(iterator.hasNext()) {
SAMRecord record = iterator.next();
if (filter != 0 && (record.getFlags() & filter) != 0) {
continue;
}
return record;
}
return null;
}
@Override
public void close() {
iterator.close();
}
synchronized private static SamReader fetchReader(String file, ValidationStringency stringency) {
return threadLocalSAMReaders.get().computeIfAbsent(
file,
(f) -> SamReaderFactory.makeDefault().validationStringency(stringency).open(SamInputResource.of(f))
);
}
}
|
923fe447b61105a279dd938aaa7f2afde4d99d44
| 1,698 |
java
|
Java
|
ZimbraTagLib/src/java/com/zimbra/cs/taglib/tag/signature/CreateSignatureTag.java
|
fciubotaru/z-pec
|
82335600341c6fb1bb8a471fd751243a90bc4d57
|
[
"MIT"
] | 5 |
2019-03-26T07:51:56.000Z
|
2021-08-30T07:26:05.000Z
|
ZimbraTagLib/src/java/com/zimbra/cs/taglib/tag/signature/CreateSignatureTag.java
|
fciubotaru/z-pec
|
82335600341c6fb1bb8a471fd751243a90bc4d57
|
[
"MIT"
] | 1 |
2015-08-18T19:03:32.000Z
|
2015-08-18T19:03:32.000Z
|
ZimbraTagLib/src/java/com/zimbra/cs/taglib/tag/signature/CreateSignatureTag.java
|
fciubotaru/z-pec
|
82335600341c6fb1bb8a471fd751243a90bc4d57
|
[
"MIT"
] | 13 |
2015-03-11T00:26:35.000Z
|
2020-07-26T16:25:18.000Z
| 33.294118 | 75 | 0.683746 | 1,001,327 |
/*
* ***** BEGIN LICENSE BLOCK *****
* Zimbra Collaboration Suite Server
* Copyright (C) 2007, 2009, 2010 Zimbra, Inc.
*
* The contents of this file are subject to the Zimbra Public License
* Version 1.3 ("License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.zimbra.com/license.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
* ***** END LICENSE BLOCK *****
*/
package com.zimbra.cs.taglib.tag.signature;
import com.zimbra.common.service.ServiceException;
import com.zimbra.cs.taglib.tag.ZimbraSimpleTag;
import com.zimbra.client.ZSignature;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.PageContext;
import java.io.IOException;
public class CreateSignatureTag extends ZimbraSimpleTag {
private String mName;
private String mVar;
private String mValue;
private String mType = "text/plain";
public void setName(String name) { mName = name; }
public void setValue(String value) { mValue = value; }
public void setVar(String var) { mVar = var; }
public void setType(String type) { mType = type; }
public void doTag() throws JspException, IOException {
try {
ZSignature sig = new ZSignature(mName, mValue);
sig.setType(mType);
String id = getMailbox().createSignature(sig);
getJspContext().setAttribute(mVar, id, PageContext.PAGE_SCOPE);
} catch (ServiceException e) {
throw new JspTagException(e);
}
}
}
|
923fe51724781c05936a552e03a8cab23392c0cc
| 8,865 |
java
|
Java
|
src/main/java/io/lettuce/core/pubsub/PubSubEndpoint.java
|
Jessay/lettuce-core
|
46e67f645dd0315e95fe54f6e399e275cdaf3f84
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/io/lettuce/core/pubsub/PubSubEndpoint.java
|
Jessay/lettuce-core
|
46e67f645dd0315e95fe54f6e399e275cdaf3f84
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/io/lettuce/core/pubsub/PubSubEndpoint.java
|
Jessay/lettuce-core
|
46e67f645dd0315e95fe54f6e399e275cdaf3f84
|
[
"Apache-2.0"
] | null | null | null | 31.660714 | 127 | 0.599098 | 1,001,328 |
/*
* Copyright 2011-2018 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 io.lettuce.core.pubsub;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import io.lettuce.core.ClientOptions;
import io.lettuce.core.RedisException;
import io.lettuce.core.protocol.CommandType;
import io.lettuce.core.protocol.DefaultEndpoint;
import io.lettuce.core.protocol.RedisCommand;
import io.lettuce.core.resource.ClientResources;
import io.netty.channel.Channel;
import io.netty.util.internal.ConcurrentSet;
/**
* @author Mark Paluch
*/
public class PubSubEndpoint<K, V> extends DefaultEndpoint {
private static final Set<String> ALLOWED_COMMANDS_SUBSCRIBED;
private static final Set<String> SUBSCRIBE_COMMANDS;
private final List<RedisPubSubListener<K, V>> listeners = new CopyOnWriteArrayList<>();
private final Set<Wrapper<K>> channels;
private final Set<Wrapper<K>> patterns;
private volatile boolean subscribeWritten = false;
static {
ALLOWED_COMMANDS_SUBSCRIBED = new HashSet<>(5, 1);
ALLOWED_COMMANDS_SUBSCRIBED.add(CommandType.SUBSCRIBE.name());
ALLOWED_COMMANDS_SUBSCRIBED.add(CommandType.PSUBSCRIBE.name());
ALLOWED_COMMANDS_SUBSCRIBED.add(CommandType.UNSUBSCRIBE.name());
ALLOWED_COMMANDS_SUBSCRIBED.add(CommandType.PUNSUBSCRIBE.name());
ALLOWED_COMMANDS_SUBSCRIBED.add(CommandType.QUIT.name());
SUBSCRIBE_COMMANDS = new HashSet<>(2, 1);
SUBSCRIBE_COMMANDS.add(CommandType.SUBSCRIBE.name());
SUBSCRIBE_COMMANDS.add(CommandType.PSUBSCRIBE.name());
}
/**
* Initialize a new instance that handles commands from the supplied queue.
*
* @param clientOptions client options for this connection, must not be {@literal null}
* @param clientResources client resources for this connection, must not be {@literal null}.
*/
public PubSubEndpoint(ClientOptions clientOptions, ClientResources clientResources) {
super(clientOptions, clientResources);
this.channels = new ConcurrentSet<>();
this.patterns = new ConcurrentSet<>();
}
/**
* Add a new {@link RedisPubSubListener listener}.
*
* @param listener the listener, must not be {@literal null}.
*/
public void addListener(RedisPubSubListener<K, V> listener) {
listeners.add(listener);
}
/**
* Remove an existing {@link RedisPubSubListener listener}..
*
* @param listener the listener, must not be {@literal null}.
*/
public void removeListener(RedisPubSubListener<K, V> listener) {
listeners.remove(listener);
}
protected List<RedisPubSubListener<K, V>> getListeners() {
return listeners;
}
public boolean hasChannelSubscriptions() {
return !channels.isEmpty();
}
public Set<K> getChannels() {
return unwrap(this.channels);
}
public boolean hasPatternSubscriptions() {
return !patterns.isEmpty();
}
public Set<K> getPatterns() {
return unwrap(this.patterns);
}
@Override
public void notifyChannelActive(Channel channel) {
subscribeWritten = false;
super.notifyChannelActive(channel);
}
@Override
public <K1, V1, T> RedisCommand<K1, V1, T> write(RedisCommand<K1, V1, T> command) {
if (isSubscribed()) {
validateCommandAllowed(command);
}
if (!subscribeWritten && SUBSCRIBE_COMMANDS.contains(command.getType().name())) {
subscribeWritten = true;
}
return super.write(command);
}
@Override
public <K1, V1> Collection<RedisCommand<K1, V1, ?>> write(Collection<? extends RedisCommand<K1, V1, ?>> redisCommands) {
if (isSubscribed()) {
redisCommands.forEach(PubSubEndpoint::validateCommandAllowed);
}
if (!subscribeWritten) {
for (RedisCommand<K1, V1, ?> redisCommand : redisCommands) {
if (SUBSCRIBE_COMMANDS.contains(redisCommand.getType().name())) {
subscribeWritten = true;
break;
}
}
}
return super.write(redisCommands);
}
private static void validateCommandAllowed(RedisCommand<?, ?, ?> command) {
if (!ALLOWED_COMMANDS_SUBSCRIBED.contains(command.getType().name())) {
throw new RedisException(String.format("Command %s not allowed while subscribed. Allowed commands are: %s", command
.getType().name(), ALLOWED_COMMANDS_SUBSCRIBED));
}
}
private boolean isSubscribed() {
return subscribeWritten && (hasChannelSubscriptions() || hasPatternSubscriptions());
}
public void notifyMessage(PubSubOutput<K, V, V> output) {
// drop empty messages
if (output.type() == null || (output.pattern() == null && output.channel() == null && output.get() == null)) {
return;
}
updateInternalState(output);
notifyListeners(output);
}
protected void notifyListeners(PubSubOutput<K, V, V> output) {
// update listeners
for (RedisPubSubListener<K, V> listener : listeners) {
switch (output.type()) {
case message:
listener.message(output.channel(), output.get());
break;
case pmessage:
listener.message(output.pattern(), output.channel(), output.get());
break;
case psubscribe:
listener.psubscribed(output.pattern(), output.count());
break;
case punsubscribe:
listener.punsubscribed(output.pattern(), output.count());
break;
case subscribe:
listener.subscribed(output.channel(), output.count());
break;
case unsubscribe:
listener.unsubscribed(output.channel(), output.count());
break;
default:
throw new UnsupportedOperationException("Operation " + output.type() + " not supported");
}
}
}
private void updateInternalState(PubSubOutput<K, V, V> output) {
// update internal state
switch (output.type()) {
case psubscribe:
patterns.add(new Wrapper<>(output.pattern()));
break;
case punsubscribe:
patterns.remove(new Wrapper<>(output.pattern()));
break;
case subscribe:
channels.add(new Wrapper<>(output.channel()));
break;
case unsubscribe:
channels.remove(new Wrapper<>(output.channel()));
break;
default:
break;
}
}
private Set<K> unwrap(Set<Wrapper<K>> wrapped) {
Set<K> result = new LinkedHashSet<>(wrapped.size());
for (Wrapper<K> channel : wrapped) {
result.add(channel.name);
}
return result;
}
/**
* Comparison/equality wrapper with specific {@code byte[]} equals and hashCode implementations.
*
* @param <K>
*/
static class Wrapper<K> {
protected final K name;
public Wrapper(K name) {
this.name = name;
}
@Override
public int hashCode() {
if (name instanceof byte[]) {
return Arrays.hashCode((byte[]) name);
}
return name.hashCode();
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Wrapper)) {
return false;
}
Wrapper<K> that = (Wrapper<K>) obj;
if (name instanceof byte[] && that.name instanceof byte[]) {
return Arrays.equals((byte[]) name, (byte[]) that.name);
}
return name.equals(that.name);
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append(getClass().getSimpleName());
sb.append(" [name=").append(name);
sb.append(']');
return sb.toString();
}
}
}
|
923fe5c89d57464057b53796501e502502de8d3b
| 919 |
java
|
Java
|
imagepicker/src/main/java/com/lzy/imagepicker/view/SuperCheckBox.java
|
yangxl006/ImagePicker
|
60b6036ff2329398bd1b1fc7ed7a34b51dd354e7
|
[
"Apache-2.0"
] | 348 |
2019-03-01T08:33:58.000Z
|
2021-09-29T05:54:31.000Z
|
imagepicker/src/main/java/com/lzy/imagepicker/view/SuperCheckBox.java
|
yangxl006/ImagePicker
|
60b6036ff2329398bd1b1fc7ed7a34b51dd354e7
|
[
"Apache-2.0"
] | 79 |
2019-04-15T07:41:56.000Z
|
2022-02-08T02:31:50.000Z
|
imagepicker/src/main/java/com/lzy/imagepicker/view/SuperCheckBox.java
|
yangxl006/ImagePicker
|
60b6036ff2329398bd1b1fc7ed7a34b51dd354e7
|
[
"Apache-2.0"
] | 80 |
2019-03-06T03:34:41.000Z
|
2022-03-28T05:18:34.000Z
| 27.029412 | 77 | 0.683351 | 1,001,329 |
package com.lzy.imagepicker.view;
import android.content.Context;
import androidx.appcompat.widget.AppCompatCheckBox;
import android.util.AttributeSet;
import android.view.SoundEffectConstants;
public class SuperCheckBox extends AppCompatCheckBox {
public SuperCheckBox(Context context) {
super(context);
}
public SuperCheckBox(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SuperCheckBox(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public boolean performClick() {
final boolean handled = super.performClick();
if (!handled) {
// View only makes a sound effect if the onClickListener was
// called, so we'll need to make one here instead.
playSoundEffect(SoundEffectConstants.CLICK);
}
return handled;
}
}
|
923fe70954f62a63012bbf7cc4b91ab5cc6f1083
| 585 |
java
|
Java
|
fmall-coupon/src/main/java/com/suse/fmall/coupon/service/SeckillSessionService.java
|
FlyingAnt8080/Fmall
|
f8da2149d2cf5279b62cfa477c8bcd865231e322
|
[
"Apache-2.0"
] | null | null | null |
fmall-coupon/src/main/java/com/suse/fmall/coupon/service/SeckillSessionService.java
|
FlyingAnt8080/Fmall
|
f8da2149d2cf5279b62cfa477c8bcd865231e322
|
[
"Apache-2.0"
] | null | null | null |
fmall-coupon/src/main/java/com/suse/fmall/coupon/service/SeckillSessionService.java
|
FlyingAnt8080/Fmall
|
f8da2149d2cf5279b62cfa477c8bcd865231e322
|
[
"Apache-2.0"
] | 1 |
2022-01-03T07:54:51.000Z
|
2022-01-03T07:54:51.000Z
| 20.964286 | 79 | 0.735945 | 1,001,330 |
package com.suse.fmall.coupon.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.suse.common.utils.PageUtils;
import com.suse.fmall.coupon.entity.SeckillSessionEntity;
import java.util.List;
import java.util.Map;
/**
* 秒杀活动场次
*
* @author liujing
* @email [email protected]
* @date 2021-02-17 22:56:58
*/
public interface SeckillSessionService extends IService<SeckillSessionEntity> {
PageUtils queryPage(Map<String, Object> params);
/**
* 获取最近三天的秒杀活动
* @return
*/
List<SeckillSessionEntity> getLatest3DaySession();
}
|
923fe730b63c743669e9d79c3d8ec262410f34ec
| 734 |
java
|
Java
|
MyTravelingDiary/XingKa/app/src/main/java/com/ruihai/xingka/api/model/CommentRepo.java
|
LegendKe/MyTravelingDiary
|
0bcb2a558fc5eacdae35573b43b03fbb2d46b341
|
[
"Apache-2.0"
] | 2 |
2017-03-06T13:39:30.000Z
|
2017-11-09T12:12:16.000Z
|
MyTravelingDiary/XingKa/app/src/main/java/com/ruihai/xingka/api/model/CommentRepo.java
|
LegendKe/MyTravelingDiary
|
0bcb2a558fc5eacdae35573b43b03fbb2d46b341
|
[
"Apache-2.0"
] | null | null | null |
MyTravelingDiary/XingKa/app/src/main/java/com/ruihai/xingka/api/model/CommentRepo.java
|
LegendKe/MyTravelingDiary
|
0bcb2a558fc5eacdae35573b43b03fbb2d46b341
|
[
"Apache-2.0"
] | null | null | null | 21.588235 | 71 | 0.702997 | 1,001,331 |
package com.ruihai.xingka.api.model;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Created by zecker on 15/9/23.
*/
public class CommentRepo extends XKRepo {
@SerializedName("recordCount")
private int recordCount;
@SerializedName("commentMessage")
private List<CommentItem> commentItemList;
public int getRecordCount() {
return recordCount;
}
public void setRecordCount(int recordCount) {
this.recordCount = recordCount;
}
public List<CommentItem> getCommentItemList() {
return commentItemList;
}
public void setCommentItemList(List<CommentItem> commentItemList) {
this.commentItemList = commentItemList;
}
}
|
923fea8740cbf3915a259dd88d934be0c9548656
| 2,041 |
java
|
Java
|
build/swig/VixenJava/Sources/SharedTree.java
|
Caprica666/vixen
|
b71e9415bbfa5f080aee30a831e3b0c8f70fcc7d
|
[
"BSD-2-Clause"
] | 1 |
2019-02-13T15:39:56.000Z
|
2019-02-13T15:39:56.000Z
|
build/swig/VixenJava/Sources/SharedTree.java
|
Caprica666/vixen
|
b71e9415bbfa5f080aee30a831e3b0c8f70fcc7d
|
[
"BSD-2-Clause"
] | null | null | null |
build/swig/VixenJava/Sources/SharedTree.java
|
Caprica666/vixen
|
b71e9415bbfa5f080aee30a831e3b0c8f70fcc7d
|
[
"BSD-2-Clause"
] | 2 |
2017-11-09T12:06:41.000Z
|
2019-02-13T15:40:02.000Z
| 27.213333 | 94 | 0.649192 | 1,001,332 |
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.1
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package Vixen;
public class SharedTree extends CoreTree {
private long swigCPtr;
public SharedTree(long cPtr, boolean cMemoryOwn) {
super(VixenLibJNI.SharedTree_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
public static long getCPtr(SharedTree obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
VixenLibJNI.delete_SharedTree(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public SharedTree() {
this(VixenLibJNI.new_SharedTree(), true);
}
public void Empty() {
VixenLibJNI.SharedTree_Empty(swigCPtr, this);
}
public boolean PutFirst(CoreTree child) {
return VixenLibJNI.SharedTree_PutFirst(swigCPtr, this, CoreTree.getCPtr(child), child);
}
public boolean Append(CoreTree child) {
return VixenLibJNI.SharedTree_Append(swigCPtr, this, CoreTree.getCPtr(child), child);
}
public boolean PutAfter(CoreTree after) {
return VixenLibJNI.SharedTree_PutAfter(swigCPtr, this, CoreTree.getCPtr(after), after);
}
public boolean PutBefore(CoreTree before) {
return VixenLibJNI.SharedTree_PutBefore(swigCPtr, this, CoreTree.getCPtr(before), before);
}
public boolean Remove(boolean free) {
return VixenLibJNI.SharedTree_Remove__SWIG_0(swigCPtr, this, free);
}
public boolean Remove() {
return VixenLibJNI.SharedTree_Remove__SWIG_1(swigCPtr, this);
}
public boolean Replace(CoreTree src) {
return VixenLibJNI.SharedTree_Replace(swigCPtr, this, CoreTree.getCPtr(src), src);
}
}
|
923feafe31b66826982a1d3be93fdf3445941d33
| 9,239 |
java
|
Java
|
core/src/main/java/com/kumuluz/ee/EeApplication.java
|
Slaters/FAS02-Ex08
|
79535c4a5803ad188f4eceba63b298ee5bb68f38
|
[
"MIT"
] | null | null | null |
core/src/main/java/com/kumuluz/ee/EeApplication.java
|
Slaters/FAS02-Ex08
|
79535c4a5803ad188f4eceba63b298ee5bb68f38
|
[
"MIT"
] | null | null | null |
core/src/main/java/com/kumuluz/ee/EeApplication.java
|
Slaters/FAS02-Ex08
|
79535c4a5803ad188f4eceba63b298ee5bb68f38
|
[
"MIT"
] | null | null | null | 37.864754 | 129 | 0.602771 | 1,001,333 |
package com.kumuluz.ee;
import com.kumuluz.ee.common.Component;
import com.kumuluz.ee.common.KumuluzServer;
import com.kumuluz.ee.common.ServletServer;
import com.kumuluz.ee.common.config.EeConfig;
import com.kumuluz.ee.common.dependencies.*;
import com.kumuluz.ee.common.exceptions.KumuluzServerException;
import com.kumuluz.ee.common.utils.ResourceUtils;
import com.kumuluz.ee.common.wrapper.ComponentWrapper;
import com.kumuluz.ee.common.wrapper.EeComponentWrapper;
import com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;
import com.kumuluz.ee.loaders.ComponentLoader;
import com.kumuluz.ee.loaders.ServerLoader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import java.util.stream.Collectors;
/**
* @author Tilen Faganel
* @since 1.0.0
*/
public class EeApplication {
private Logger log = Logger.getLogger(EeApplication.class.getSimpleName());
private EeConfig eeConfig;
private KumuluzServerWrapper server;
private List<EeComponentWrapper> eeComponents;
public EeApplication() {
this.eeConfig = new EeConfig();
initialize();
}
public EeApplication(EeConfig eeConfig) {
this.eeConfig = eeConfig;
initialize();
}
public static void main(String args[]) {
EeApplication app = new EeApplication();
}
public void initialize() {
log.info("Initializing KumuluzEE");
log.info("Checking for requirements");
checkRequirements();
log.info("Checks passed");
log.info("Initializing components");
// Loading the kumuluz server and extracting its metadata
KumuluzServer kumuluzServer = ServerLoader.loadServletServer();
processKumuluzServer(kumuluzServer);
// Loading all the present components, extracting their metadata and process dependencies
List<Component> components = ComponentLoader.loadComponents();
processEeComponents(components);
// Initiate the server
server.getServer().setServerConfig(eeConfig.getServerConfig());
server.getServer().initServer();
// Depending on the server type, initiate server specific functionality
if (server.getServer() instanceof ServletServer) {
ServletServer servletServer = (ServletServer) server.getServer();
servletServer.initWebContext();
}
// Initiate every found component in the order specified by the components dependencies
for (EeComponentWrapper cw : eeComponents) {
log.info("Found EE component " + cw.getType().getName() + " implemented by " + cw.getName());
cw.getComponent().init(server, eeConfig);
cw.getComponent().load();
}
log.info("Components initialized");
server.getServer().startServer();
log.info("KumuluzEE started successfully");
}
private void processKumuluzServer(KumuluzServer kumuluzServer) {
ServerDef serverDef = kumuluzServer.getClass().getDeclaredAnnotation(ServerDef.class);
server = new KumuluzServerWrapper(kumuluzServer, serverDef.value(), serverDef.provides());
}
private void processEeComponents(List<Component> components) {
Map<EeComponentType, EeComponentWrapper> eeComp = new HashMap<>();
// Wrap components with their metadata and check for duplicates
for (Component c : components) {
EeComponentDef def = c.getClass().getDeclaredAnnotation(EeComponentDef.class);
if (def != null) {
if (eeComp.containsKey(def.type()) ||
Arrays.asList(server.getProvidedEeComponents()).contains(def.type())) {
String msg = "Found multiple implementations (" +
(eeComp.get(def.type()) != null ? eeComp.get(def.type()).getName() : server.getName()) +
", " + def.name() + ") of the same EE component (" + def.type().getName() + "). " +
"Please check to make sure you only include a single implementation of a specific " +
"EE component.";
log.severe(msg);
throw new KumuluzServerException(msg);
}
EeComponentDependency[] dependencies = c.getClass().getDeclaredAnnotationsByType(EeComponentDependency.class);
EeComponentOptional[] optionals = c.getClass().getDeclaredAnnotationsByType(EeComponentOptional.class);
eeComp.put(def.type(), new EeComponentWrapper(c, def.name(), def.type(), dependencies, optionals));
}
}
log.info("Processing EE component dependencies");
// Check if all dependencies are fulfilled
for (EeComponentWrapper cmp : eeComp.values()) {
for (EeComponentDependency dep : cmp.getDependencies()) {
String depCompName = null;
ComponentWrapper depComp = eeComp.get(dep.value());
// Check all posible locations for the dependency (Components and Server)
if (depComp != null) {
depCompName = depComp.getName();
} else if (Arrays.asList(server.getProvidedEeComponents()).contains(dep.value())) {
depCompName = server.getName();
}
if (depCompName == null) {
String msg = "EE component dependency unfulfilled. The EE component " + cmp.getType().getName() +
" implemented by " + cmp.getName() + " requires " + dep.value().getName() + ", which was not " +
"found. Please make sure to include the required component.";
log.severe(msg);
throw new KumuluzServerException(msg);
}
if (dep.implementations().length > 0 &&
!Arrays.asList(dep.implementations()).contains(depCompName)) {
String msg = "EE component implementation dependency unfulfilled. The EE component " +
cmp.getType().getName() + " implemented by " + cmp.getName() + " requires " + dep.value().getName() +
" implemented by one of the following implementations: " +
Arrays.toString(dep.implementations()) + ". Please make sure you use one of the " +
"implementations required by this component.";
log.severe(msg);
throw new KumuluzServerException(msg);
}
}
// Check if all optional dependencies and their implementations are fulfilled
for (EeComponentOptional dep : cmp.getOptionalDependencies()) {
String depCompName = null;
ComponentWrapper depComp = eeComp.get(dep.value());
// Check all posible locations for the dependency (Components and Server)
if (depComp != null) {
depCompName = depComp.getName();
} else if (!Arrays.asList(server.getProvidedEeComponents()).contains(dep.value())) {
depCompName = server.getName();
}
if (depCompName != null && dep.implementations().length > 0 &&
!Arrays.asList(dep.implementations()).contains(depCompName)) {
String msg = "EE component implementation dependency unfulfilled. The EE component " +
cmp.getType().getName() + "implemented by " + cmp.getName() + " requires " + dep.value().getName() +
" implemented by one of the following implementations: " +
Arrays.toString(dep.implementations()) + ". Please make sure you use one of the " +
"implementations required by this component.";
log.severe(msg);
throw new KumuluzServerException(msg);
}
}
}
eeComponents = eeComp.values().stream().collect(Collectors.toList());
}
private void checkRequirements() {
if (ResourceUtils.getProjectWebResources() == null) {
throw new IllegalStateException("No 'webapp' directory found in the projects " +
"resources folder. Please add it to your resources even if it will be empty " +
"so that the servlet server can bind to it. If you have added it and still " +
"see this error please make sure you have at least one file/class in your " +
"projects as some IDEs don't build the project if its empty");
}
if (ResourceUtils.isRunningInJar()) {
throw new RuntimeException("Running in a jar is currently not supported yet. Please " +
"build the application with the 'maven-dependency' plugin to explode your app" +
" with dependencies. Then run it with 'java -cp " +
"target/classes:target/dependency/* yourmainclass'.");
}
}
}
|
923feb3b090d249d9eb29d4cc3fdd25aaa403e88
| 1,408 |
java
|
Java
|
game-engine/src/main/java/engine/graphics/block/BlockDisplay.java
|
UnknownStudio/KnownDomain
|
e5fa7dca74f1252ee1563db8e962502bdafbf068
|
[
"Apache-2.0"
] | 59 |
2020-08-05T02:22:39.000Z
|
2022-03-13T12:45:42.000Z
|
game-engine/src/main/java/engine/graphics/block/BlockDisplay.java
|
UnknownStudio/KnownDomain
|
e5fa7dca74f1252ee1563db8e962502bdafbf068
|
[
"Apache-2.0"
] | 37 |
2019-05-14T04:42:50.000Z
|
2020-01-07T12:48:56.000Z
|
game-engine/src/main/java/engine/graphics/block/BlockDisplay.java
|
UnknownStudio/KnownDomain
|
e5fa7dca74f1252ee1563db8e962502bdafbf068
|
[
"Apache-2.0"
] | 16 |
2019-05-26T07:22:35.000Z
|
2019-12-16T05:00:23.000Z
| 25.142857 | 108 | 0.674716 | 1,001,334 |
package engine.graphics.block;
import engine.block.state.BlockState;
import engine.client.asset.AssetURL;
import engine.component.Component;
import engine.graphics.queue.RenderType;
import java.util.HashMap;
import java.util.Map;
public class BlockDisplay implements Component {
private AssetURL modelUrl;
private Map<BlockState, AssetURL> variantModelUrls = new HashMap<>();
private RenderType renderType = RenderType.OPAQUE;
private boolean visible = true;
public AssetURL getModelUrl() {
return modelUrl;
}
public Map<BlockState, AssetURL> getVariantModelUrls() {
return variantModelUrls;
}
public BlockDisplay model(String url) {
modelUrl = AssetURL.fromString(url);
return this;
}
public BlockDisplay variant(BlockState state, String url) {
variantModelUrls.put(state, AssetURL.fromString(url));
return this;
}
public RenderType getRenderType() {
return renderType;
}
public BlockDisplay renderType(RenderType type) {
if (type == RenderType.OPAQUE || type == RenderType.TRANSPARENT || type == RenderType.TRANSLUCENT) {
this.renderType = type;
}
return this;
}
public boolean isVisible() {
return visible;
}
public BlockDisplay visible(boolean visible) {
this.visible = visible;
return this;
}
}
|
923feb6c18057f5fcb30ad4ec0921a93ee2462b8
| 1,128 |
java
|
Java
|
webapp/src/main/java/com/ibm/example/cryptoclient/KeyPair.java
|
IBM/signingserver
|
a1db6559b307413d66f9413d499158581107fee4
|
[
"Apache-2.0"
] | 2 |
2021-11-16T22:24:14.000Z
|
2021-12-09T10:25:54.000Z
|
webapp/src/main/java/com/ibm/example/cryptoclient/KeyPair.java
|
IBM/signingserver
|
a1db6559b307413d66f9413d499158581107fee4
|
[
"Apache-2.0"
] | null | null | null |
webapp/src/main/java/com/ibm/example/cryptoclient/KeyPair.java
|
IBM/signingserver
|
a1db6559b307413d66f9413d499158581107fee4
|
[
"Apache-2.0"
] | null | null | null | 27.512195 | 76 | 0.75 | 1,001,335 |
// Copyright 2021 IBM Corp. 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.ibm.example.cryptoclient;
import com.google.protobuf.ByteString;
public class KeyPair {
private final ByteString pubKey;
private final ByteString privKey;
public KeyPair(final ByteString byteString, final ByteString byteString2) {
this.pubKey = byteString;
this.privKey = byteString2;
}
public KeyPair(final KeyPair base) {
this.pubKey = base.pubKey;
this.privKey = base.privKey;
}
public ByteString getPubKey() {
return pubKey;
}
public ByteString getPrivKey() {
return privKey;
}
}
|
923fec940f02f91efc0de6ef293306bc8032ceab
| 4,036 |
java
|
Java
|
src/main/java/com/cjburkey/claimchunk/placeholder/ClaimChunkPlaceholders.java
|
Geolykt/ClaimChunk
|
ea4ade28f4b7623d4bbca54064ce3c903711120c
|
[
"MIT"
] | null | null | null |
src/main/java/com/cjburkey/claimchunk/placeholder/ClaimChunkPlaceholders.java
|
Geolykt/ClaimChunk
|
ea4ade28f4b7623d4bbca54064ce3c903711120c
|
[
"MIT"
] | null | null | null |
src/main/java/com/cjburkey/claimchunk/placeholder/ClaimChunkPlaceholders.java
|
Geolykt/ClaimChunk
|
ea4ade28f4b7623d4bbca54064ce3c903711120c
|
[
"MIT"
] | null | null | null | 34.495726 | 100 | 0.580278 | 1,001,336 |
package com.cjburkey.claimchunk.placeholder;
import com.cjburkey.claimchunk.ClaimChunk;
import com.cjburkey.claimchunk.Utils;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.UUID;
public class ClaimChunkPlaceholders extends PlaceholderExpansion {
private final ClaimChunk claimChunk;
public ClaimChunkPlaceholders(ClaimChunk claimChunk) {
this.claimChunk = claimChunk;
}
@Override
public String getIdentifier() {
return "claimchunk";
}
@Override
public boolean canRegister() {
return true;
}
@Override
public boolean persist() {
return true;
}
@Override
public String getAuthor() {
return Arrays.toString(claimChunk.getDescription()
.getAuthors()
.toArray(new String[0]));
}
@Override
public String getVersion() {
return claimChunk.getDescription()
.getVersion();
}
@Override
public String onRequest(@Nonnull OfflinePlayer player, @Nonnull String identifier) {
// This player's chunk name
if (identifier.equals("my_name")) {
return claimChunk.getPlayerHandler()
.getChunkName(player.getUniqueId());
}
// This player's total number of claimed chunks
if (identifier.equals("my_claims")) {
return "" + claimChunk.getChunkHandler()
.getClaimed(player.getUniqueId());
}
// If the player is online, try some other placeholders
if (player instanceof Player) {
return onPlaceholderRequest((Player) player, identifier);
}
// No placeholder found
return null;
}
@Override
public String onPlaceholderRequest(@Nonnull Player onlinePlayer, @Nonnull String identifier) {
// This player's maximum number of claims as calculated by the rank
// handler
if (identifier.equals("my_max_claims")) {
return "" + claimChunk.getRankHandler()
.getMaxClaimsForPlayer(onlinePlayer);
}
// Otherwise, we'll need to get the owner of the chunk in which `onlinePlayer` is standing
UUID chunkOwner = claimChunk.getChunkHandler()
.getOwner(onlinePlayer.getLocation()
.getChunk());
// Both of the placeholders are the name of the player that owns this
// chunk, there isn't an owner so no name is necessary
if (chunkOwner == null) {
return claimChunk.getMessages().placeholderApiUnclaimedChunkOwner;
}
if (identifier.equals("am_trusted")) {
return claimChunk.getPlayerHandler()
.hasAccess(chunkOwner, onlinePlayer.getUniqueId())
? claimChunk.getMessages().placeholderApiTrusted
: claimChunk.getMessages().placeholderApiNotTrusted;
}
// Get the owner's username of the chunk the player is currently standing on
if (identifier.equals("current_owner")) {
return claimChunk.getPlayerHandler()
.getUsername(chunkOwner);
}
// Get the owner's chunk display name based on the chunk the player is currently standing on
if (identifier.equals("current_name")) {
return claimChunk.getPlayerHandler()
.getChunkName(claimChunk.getChunkHandler()
.getOwner(onlinePlayer.getLocation()
.getChunk()));
}
// Not a valid placeholder for ClaimChunk
return null;
}
}
|
923fed8bb2168cbbadc40c4e5eb5a2f0d22b185b
| 1,680 |
java
|
Java
|
contract-budgeting/test/uk/dangrew/cb/graphics/wizard/pages/WorkPackagePageTest.java
|
DanGrew/contract-budgeting
|
21b8d54417d3684286e41d1aa49aa9aaffe8f983
|
[
"Apache-2.0"
] | null | null | null |
contract-budgeting/test/uk/dangrew/cb/graphics/wizard/pages/WorkPackagePageTest.java
|
DanGrew/contract-budgeting
|
21b8d54417d3684286e41d1aa49aa9aaffe8f983
|
[
"Apache-2.0"
] | null | null | null |
contract-budgeting/test/uk/dangrew/cb/graphics/wizard/pages/WorkPackagePageTest.java
|
DanGrew/contract-budgeting
|
21b8d54417d3684286e41d1aa49aa9aaffe8f983
|
[
"Apache-2.0"
] | null | null | null | 35 | 115 | 0.717262 | 1,001,337 |
package uk.dangrew.cb.graphics.wizard.pages;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import org.junit.Before;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
import uk.dangrew.cb.model.project.Project;
import uk.dangrew.cb.progress.project.ProjectTestData;
import uk.dangrew.cb.toolkit.Database;
import uk.dangrew.kode.launch.TestApplication;
public class WorkPackagePageTest {
private Project project;
private WorkPackagePage systemUnderTest;
@Before public void initialiseSystemUnderTest() {
TestApplication.startPlatform();
MockitoAnnotations.initMocks( this );
project = ProjectTestData.sampleProject( new Database() );
systemUnderTest = new WorkPackagePage( project );
}//End Method
@Test public void shouldUpdateTableWhenProjectUpdate() {
assertRowsMatch( 2 );
systemUnderTest.controller().createConcept();
assertRowsMatch( 3 );
systemUnderTest.table().getSelectionModel().select( 1 );
systemUnderTest.controller().removeSelectedConcept();
assertRowsMatch( 2 );
systemUnderTest.controller().copySelectedConcept();
assertRowsMatch( 3 );
}//End Method
private void assertRowsMatch( int expectedRows ){
assertThat( systemUnderTest.table().getRows().size(), is( expectedRows ) );
assertThat( project.workPackages().size(), is( expectedRows ) );
for( int i = 0; i < project.workPackages().size(); i++ ) {
assertThat( systemUnderTest.table().getRows().get( i ).concept(), is( project.workPackages().get( i ) ) );
}
}//End Method
}//End Class
|
923fee486e6d3f352a86e2cd266424fafb104b12
| 10,040 |
java
|
Java
|
tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/behaviours/pageobjects/PitPreferenceSelector.java
|
LorenzoBettini/pitclipse
|
fd824b3193e3efb55ec81a9ce7ea10ea4b49150d
|
[
"Apache-2.0"
] | null | null | null |
tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/behaviours/pageobjects/PitPreferenceSelector.java
|
LorenzoBettini/pitclipse
|
fd824b3193e3efb55ec81a9ce7ea10ea4b49150d
|
[
"Apache-2.0"
] | null | null | null |
tests/org.pitest.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/behaviours/pageobjects/PitPreferenceSelector.java
|
LorenzoBettini/pitclipse
|
fd824b3193e3efb55ec81a9ce7ea10ea4b49150d
|
[
"Apache-2.0"
] | null | null | null | 33.691275 | 104 | 0.630876 | 1,001,338 |
/*******************************************************************************
* Copyright 2012-2019 Phil Glover and contributors
*
* 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.pitest.pitclipse.ui.behaviours.pageobjects;
import com.google.common.base.Optional;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.pitest.pitclipse.core.PitMutators;
import org.pitest.pitclipse.runner.config.PitExecutionMode;
import java.io.Closeable;
import java.math.BigDecimal;
import static java.math.BigDecimal.ZERO;
import static org.pitest.pitclipse.ui.behaviours.pageobjects.SwtBotTreeHelper.selectAndExpand;
public class PitPreferenceSelector implements Closeable {
private static final String USE_INCREMENTAL_ANALYSIS_LABEL = "Use incremental analysis";
private static final String MUTATION_TESTS_RUN_IN_PARALLEL_LABEL = "Mutation tests run in parallel";
private static final String EXCLUDED_CLASSES_LABEL = "Excluded classes (e.g.*IntTest)";
private static final String EXCLUDED_METHODS_LABEL = "Excluded methods (e.g.*toString*)";
private static final String AVOID_CALLS_TO_LABEL = "Avoid calls to";
private static final String MUTATORS_LABEL = "Mutators";
private static final String EXECUTION_MODE_LABEL = "Pit Execution Scope";
private static final String PIT_TIMEOUT_LABEL = "Pit Timeout";
private static final String PIT_TIMEOUT_FACTOR_LABEL = "Timeout Factor";
private final SWTWorkbenchBot bot;
public PitPreferenceSelector(SWTWorkbenchBot bot) {
this.bot = bot;
}
public void setPitExecutionMode(PitExecutionMode mode) {
activatePreferenceShell();
expandPitPreferences();
selectExecutionMode(mode);
}
private void selectExecutionMode(PitExecutionMode mode) {
bot.radio(mode.getLabel()).click();
}
@Override
public void close() {
bot.button("Apply and Close").click();
}
private SWTBotTreeItem expandPitPreferences() {
return selectAndExpand(bot.tree().getTreeItem("Pitest"));
}
private void activatePreferenceShell() {
SWTBotShell shell = bot.shell("Preferences");
shell.activate();
}
public PitExecutionMode getPitExecutionMode() {
return getSelectedExecutionMode().from(EXECUTION_MODE_LABEL);
}
private PitExecutionMode getActiveExecutionMode() {
for (PitExecutionMode mode : PitExecutionMode.values()) {
if (bot.radio(mode.getLabel()).isSelected()) {
return mode;
}
}
return null;
}
public boolean isPitRunInParallel() {
return getBoolean().from(MUTATION_TESTS_RUN_IN_PARALLEL_LABEL);
}
public boolean isIncrementalAnalysisEnabled() {
return getBoolean().from(USE_INCREMENTAL_ANALYSIS_LABEL);
}
public void setPitRunInParallel(boolean inParallel) {
setSelectionFor(MUTATION_TESTS_RUN_IN_PARALLEL_LABEL).to(inParallel);
}
public void setPitIncrementalAnalysisEnabled(boolean incremental) {
setSelectionFor(USE_INCREMENTAL_ANALYSIS_LABEL).to(incremental);
}
public String getExcludedClasses() {
return getText().from(EXCLUDED_CLASSES_LABEL);
}
public void setExcludedClasses(String excludedClasses) {
setTextFor(EXCLUDED_CLASSES_LABEL).to(excludedClasses);
}
public String getExcludedMethods() {
return getText().from(EXCLUDED_METHODS_LABEL);
}
public void setExcludedMethods(String excludedMethods) {
setTextFor(EXCLUDED_METHODS_LABEL).to(excludedMethods);
}
public String getAvoidCallsTo() {
return getText().from(AVOID_CALLS_TO_LABEL);
}
public void setAvoidCallsTo(String avoidCallsTo) {
setTextFor(AVOID_CALLS_TO_LABEL).to(avoidCallsTo);
}
public PitMutators getMutators() {
return getSelectedMutators().from(MUTATORS_LABEL);
}
private Optional<SWTBotTreeItem> expandPitMutatorPreferences() {
SWTBotTreeItem pitPrefs = expandPitPreferences();
for (SWTBotTreeItem t : pitPrefs.getItems()) {
if (t.getText().equals("Mutators")) {
return Optional.fromNullable(selectAndExpand(t));
}
}
return Optional.absent();
}
public void setPitTimeoutConst(int timeout) {
setTextFor(PIT_TIMEOUT_LABEL).to(timeout);
}
public void setPitTimeoutFactor(int factor) {
setTextFor(PIT_TIMEOUT_FACTOR_LABEL).to(factor);
}
private static interface PreferenceGetter<T> {
T getPreference(String label);
}
private class PreferenceGetterBuilder<T> {
private final PreferenceGetter<T> getter;
public PreferenceGetterBuilder(PreferenceGetter<T> getter) {
this.getter = getter;
}
public T from(String label) {
activatePreferenceShell();
expandPitPreferences();
return getter.getPreference(label);
}
}
private class PreferenceSetterBuilder {
private final String label;
public PreferenceSetterBuilder(String label) {
this.label = label;
}
public void to(final String value) {
updatePreference(new PreferenceSetter<String>() {
@Override
public void setPreference() {
bot.textWithLabel(label).setText(value);
}
});
}
public void to(final boolean value) {
updatePreference(new PreferenceSetter<Boolean>() {
@Override
public void setPreference() {
if (value) {
bot.checkBox(label).select();
}
else {
bot.checkBox(label).deselect();
}
}
});
}
public void to(final int value) {
to(Integer.toString(value));
}
private <T> void updatePreference(PreferenceSetter<T> s) {
activatePreferenceShell();
expandPitPreferences();
s.setPreference();
}
}
private static interface PreferenceSetter<T> {
void setPreference();
}
private PreferenceSetterBuilder setTextFor(final String label) {
return new PreferenceSetterBuilder(label);
}
private PreferenceSetterBuilder setSelectionFor(final String label) {
return new PreferenceSetterBuilder(label);
}
private PreferenceGetterBuilder<String> getText() {
return new PreferenceGetterBuilder<String>(new PreferenceGetter<String>() {
@Override
public String getPreference(String label) {
return bot.textWithLabel(label).getText();
}
});
}
private PreferenceGetterBuilder<Integer> getInteger() {
return new PreferenceGetterBuilder<Integer>(new PreferenceGetter<Integer>() {
@Override
public Integer getPreference(String label) {
String value = bot.textWithLabel(label).getText();
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
return 0;
}
}
});
}
private PreferenceGetterBuilder<BigDecimal> getBigDecimal() {
return new PreferenceGetterBuilder<BigDecimal>(new PreferenceGetter<BigDecimal>() {
@Override
public BigDecimal getPreference(String label) {
String value = bot.textWithLabel(label).getText();
try {
return new BigDecimal(value);
} catch (NumberFormatException e) {
return ZERO;
}
}
});
}
private PreferenceGetterBuilder<Boolean> getBoolean() {
return new PreferenceGetterBuilder<Boolean>(new PreferenceGetter<Boolean>() {
@Override
public Boolean getPreference(String label) {
return bot.checkBox(label).isChecked();
}
});
}
private PreferenceGetterBuilder<PitMutators> getSelectedMutators() {
return new PreferenceGetterBuilder<PitMutators>(new PreferenceGetter<PitMutators>() {
@Override
public PitMutators getPreference(String label) {
expandPitMutatorPreferences();
for (PitMutators mutator : PitMutators.values()) {
if (bot.radio(mutator.getLabel()).isSelected()) {
return mutator;
}
}
return PitMutators.DEFAULTS;
}
});
}
private PreferenceGetterBuilder<PitExecutionMode> getSelectedExecutionMode() {
return new PreferenceGetterBuilder<PitExecutionMode>(new PreferenceGetter<PitExecutionMode>() {
@Override
public PitExecutionMode getPreference(String label) {
return getActiveExecutionMode();
}
});
}
public int getTimeout() {
return getInteger().from(PIT_TIMEOUT_LABEL);
}
public BigDecimal getPitTimeoutFactor() {
return getBigDecimal().from(PIT_TIMEOUT_FACTOR_LABEL);
}
}
|
923ff01e52c9b4b3a308224d5cdf262af92e1f49
| 2,435 |
java
|
Java
|
client/com/medicapital/client/login/ForgotPasswordPresenter.java
|
m-wrona/gwt-medicapital
|
c1c281fac9ea6b03ecfe9c879394e4c33f550f76
|
[
"MIT"
] | null | null | null |
client/com/medicapital/client/login/ForgotPasswordPresenter.java
|
m-wrona/gwt-medicapital
|
c1c281fac9ea6b03ecfe9c879394e4c33f550f76
|
[
"MIT"
] | null | null | null |
client/com/medicapital/client/login/ForgotPasswordPresenter.java
|
m-wrona/gwt-medicapital
|
c1c281fac9ea6b03ecfe9c879394e4c33f550f76
|
[
"MIT"
] | null | null | null | 33.819444 | 99 | 0.744969 | 1,001,339 |
package com.medicapital.client.login;
import static com.medicapital.client.log.Tracer.tracer;
import com.medicapital.common.commands.CommandResp;
import com.medicapital.common.commands.login.ForgotPasswordCommand;
import com.medicapital.common.commands.login.ForgotPasswordCommandResp;
import com.medicapital.common.dao.ResponseHandler;
import com.medicapital.common.dao.ServiceAccess;
import com.medicapital.common.entities.LoginData;
import com.medicapital.common.validation.ValidationUtils;
/**
* Presenter for sending forgotten password
*
* @author mwronski
*
*/
final public class ForgotPasswordPresenter {
private final ForgotPasswordView display;
private final ServiceAccess loginService;
ForgotPasswordPresenter(final ForgotPasswordView display, final ServiceAccess userService) {
this.display = display;
loginService = userService;
}
/**
* Send e-mail about forgotten password
*
*/
final public void sendForgotPasswordEmail() {
final String login = display.getLogin();
final String eMail = display.getEmail();
tracer(this).debug("Sending forgotten password - e-mail: " + eMail + ", login: " + login);
display.setServerErrorMsgVisible(false);
display.setEMailSentMsgVisible(false);
display.setLoginEmailNotFoundMsgVisible(false);
display.setLoginOrEmailNotValidMsgVisible(false);
if (ValidationUtils.isEmpty(login) || !ValidationUtils.isEmailValid(eMail)) {
// validation error
tracer(this).debug("E-Mail or login is not valid - canceling operation");
display.setLoginOrEmailNotValidMsgVisible(true);
return;
}
display.setSendPasswordHandlerEnabled(false);
loginService.execute(new ForgotPasswordCommand(login, eMail), new ResponseHandler<LoginData>() {
@Override
public void handle(final CommandResp<LoginData> response) {
if (response instanceof ForgotPasswordCommandResp) {
display.setSendPasswordHandlerEnabled(true);
final ForgotPasswordCommandResp passResp = (ForgotPasswordCommandResp) response;
tracer(this).debug("Password sent: " + passResp.isEmailSent());
if (passResp.isEmailSent()) {
display.setEMailSentMsgVisible(true);
} else {
display.setLoginEmailNotFoundMsgVisible(true);
}
}
}
@Override
public void handleException(final Throwable throwable) {
display.setServerErrorMsgVisible(true);
}
});
}
}
|
923ff09f69eda6aabea95c4774eceaf809b61ee9
| 317 |
java
|
Java
|
spring-boot-cache/src/main/java/zhibi/learn/cache/domain/User.java
|
zhibi/spring-boot-study
|
4c1718c7af0dec16ee7a7aaf172d3c54d9bb1326
|
[
"Apache-2.0"
] | null | null | null |
spring-boot-cache/src/main/java/zhibi/learn/cache/domain/User.java
|
zhibi/spring-boot-study
|
4c1718c7af0dec16ee7a7aaf172d3c54d9bb1326
|
[
"Apache-2.0"
] | 4 |
2020-04-23T18:38:10.000Z
|
2021-12-09T21:23:20.000Z
|
spring-boot-cache/src/main/java/zhibi/learn/cache/domain/User.java
|
zhibi/learn-spring-boot
|
4c1718c7af0dec16ee7a7aaf172d3c54d9bb1326
|
[
"Apache-2.0"
] | null | null | null | 13.208333 | 43 | 0.656151 | 1,001,340 |
package zhibi.learn.cache.domain;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @author 执笔
* @date 2019/7/11 16:56
*/
@Data
public class User implements Serializable {
/**
* 名字
*/
private String name;
private Date addTime;
private Address address;
}
|
923ff1ebd42e42cb723644727bdbe9faa91de59f
| 6,163 |
java
|
Java
|
app/src/main/java/com/irvan/evoa/Daftar.java
|
IrvanMaulana99/autentikasi-firebase-android
|
72e64e796952074bd3fe433c65754fcbd170a285
|
[
"MIT"
] | 1 |
2021-06-18T11:39:22.000Z
|
2021-06-18T11:39:22.000Z
|
app/src/main/java/com/irvan/evoa/Daftar.java
|
IrvanMaulana99/autentikasi-firebase-android
|
72e64e796952074bd3fe433c65754fcbd170a285
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/irvan/evoa/Daftar.java
|
IrvanMaulana99/autentikasi-firebase-android
|
72e64e796952074bd3fe433c65754fcbd170a285
|
[
"MIT"
] | null | null | null | 44.65942 | 130 | 0.545838 | 1,001,341 |
package com.irvan.evoa;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.FirebaseFirestore;
import java.util.HashMap;
import java.util.Map;
public class Daftar extends AppCompatActivity {
public static final String TAG = "TAG";
EditText mPTxt1, mPTxt2, mPTxt3, mPTxt4;
Button mBtnDaftar;
TextView mTxtLogin, SyaratK;
private FirebaseAuth mAuth;
FirebaseFirestore mStore;
String userID;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_daftar);
//Variabel
mPTxt1 = findViewById(R.id.PTxt1);
mPTxt2 = findViewById(R.id.PTxt2);
mPTxt3 = findViewById(R.id.PTxt3);
mPTxt4 = findViewById(R.id.PTxt4);
mBtnDaftar = findViewById(R.id.BtnLogin2);
mTxtLogin = findViewById(R.id.TxtLogin2);
SyaratK = findViewById(R.id.SyaratK);
// Method Firebase
mAuth = FirebaseAuth.getInstance();
mStore = FirebaseFirestore.getInstance();
if (mAuth.getCurrentUser() != null) {
startActivity(new Intent(getApplicationContext(), MainActivity.class));
finish();
}
// Action Untuk Button Daftar
mBtnDaftar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String email = mPTxt2.getText().toString().trim();
String password = mPTxt3.getText().toString().trim();
final String namalengkap = mPTxt1.getText().toString();
final String hp = mPTxt4.getText().toString();
if (TextUtils.isEmpty(email)) {
mPTxt2.setError("Masukkan Email");
return;
}
if (TextUtils.isEmpty(password)) {
mPTxt3.setError("Masukkan Password");
return;
}
if (password.length() <= 4) {
mPTxt3.setError("Password harus memiliki lebih dari 4 huruf");
return;
}
// Proses Daftar akun di Firebase
mAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Kirim email verifikasi
FirebaseUser pemakai = mAuth.getCurrentUser();
pemakai.sendEmailVerification().addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(Daftar.this, "Email untuk Verifikasi Telah Dikirim", Toast.LENGTH_SHORT).show();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.d(TAG, "onFailure: Email tidak Terkirim"+ e.getMessage());
}
});
Toast.makeText(Daftar.this, "Akun telah dibuat", Toast.LENGTH_SHORT).show();
userID = mAuth.getCurrentUser().getUid();
DocumentReference documentReference = mStore.collection("users").document(userID);
Map<String,Object> user = new HashMap<>();
user.put("NamaL",namalengkap);
user.put("email", email);
user.put("Hp",hp);
documentReference.set(user).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d(TAG, "onSuccess: Profil akun telah terbuat untuk " + userID);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.d(TAG, "onFailure: "+e.toString());
}
});
startActivity(new Intent(getApplicationContext(), MainActivity.class));
} else {
Toast.makeText(Daftar.this, "Error !" + task.getException().getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
});
SyaratK.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(), SyaratKetentuan.class));
}
});
mTxtLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(), Login.class));
}
});
}
}
|
923ff245a5254395155c568ac04c4a13e3ba3b4f
| 4,446 |
java
|
Java
|
Download/RxDownload-master/app/src/main/java/zlc/season/rxdownloadproject/activity/DownloadManagerActivity.java
|
weiwenqiang/GitHub
|
a22f3ed254a005a8c8007f677968655620ccd3b1
|
[
"Apache-2.0"
] | 10 |
2017-11-27T03:18:15.000Z
|
2021-08-10T07:21:44.000Z
|
app/src/main/java/zlc/season/rxdownloadproject/activity/DownloadManagerActivity.java
|
zzjscm/RxDownload
|
ccd2d9612e10222255df05f403fccee60a7c031d
|
[
"Apache-2.0"
] | null | null | null |
app/src/main/java/zlc/season/rxdownloadproject/activity/DownloadManagerActivity.java
|
zzjscm/RxDownload
|
ccd2d9612e10222255df05f403fccee60a7c031d
|
[
"Apache-2.0"
] | 10 |
2018-04-20T08:43:59.000Z
|
2022-03-16T02:52:53.000Z
| 37.05 | 108 | 0.546559 | 1,001,342 |
package zlc.season.rxdownloadproject.activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.Toolbar;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import zlc.season.practicalrecyclerview.PracticalRecyclerView;
import zlc.season.rxdownload2.RxDownload;
import zlc.season.rxdownload2.entity.DownloadRecord;
import zlc.season.rxdownload2.function.Utils;
import zlc.season.rxdownloadproject.R;
import zlc.season.rxdownloadproject.adapter.DownloadAdapter;
import zlc.season.rxdownloadproject.model.DownloadItem;
public class DownloadManagerActivity extends AppCompatActivity {
@BindView(R.id.toolbar)
Toolbar mToolbar;
@BindView(R.id.recycler)
PracticalRecyclerView mRecycler;
private DownloadAdapter mAdapter;
private RxDownload rxDownload;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_download_manager);
ButterKnife.bind(this);
setSupportActionBar(mToolbar);
rxDownload = RxDownload.getInstance(this);
mAdapter = new DownloadAdapter();
mRecycler.setLayoutManager(new LinearLayoutManager(this));
mRecycler.setAdapterWithLoading(mAdapter);
loadData();
}
@OnClick({R.id.start, R.id.pause})
public void onClick(View view) {
List<DownloadItem> list = mAdapter.getData();
switch (view.getId()) {
case R.id.start:
for (DownloadItem each : list) {
rxDownload.serviceDownload(each.record.getUrl())
.subscribe(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
Utils.log(throwable);
}
});
}
break;
case R.id.pause:
for (DownloadItem each : list) {
rxDownload.pauseServiceDownload(each.record.getUrl())
.subscribe(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
Utils.log(throwable);
}
});
}
break;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
List<DownloadItem> list = mAdapter.getData();
for (DownloadItem each : list) {
Utils.dispose(each.disposable);
}
}
private void loadData() {
RxDownload.getInstance(this).getTotalDownloadRecords()
.map(new Function<List<DownloadRecord>, List<DownloadItem>>() {
@Override
public List<DownloadItem> apply(List<DownloadRecord> downloadRecords) throws Exception {
List<DownloadItem> result = new ArrayList<>();
for (DownloadRecord each : downloadRecords) {
DownloadItem bean = new DownloadItem();
bean.record = each;
result.add(bean);
}
return result;
}
})
.subscribe(new Consumer<List<DownloadItem>>() {
@Override
public void accept(List<DownloadItem> downloadBeen) throws Exception {
mAdapter.addAll(downloadBeen);
}
});
}
}
|
923ff30f3ef1aa5ab0eaf3dbd1e17f163bf9fdfa
| 2,712 |
java
|
Java
|
codebase/projects/localsdkquery/src/java/gov/nih/nci/cagrid/data/cql/cacore/HibernateUtil.java
|
NCIP/catrip
|
1615ab2598cf5ce060e98d69052ae0e52eaf9148
|
[
"BSD-3-Clause"
] | null | null | null |
codebase/projects/localsdkquery/src/java/gov/nih/nci/cagrid/data/cql/cacore/HibernateUtil.java
|
NCIP/catrip
|
1615ab2598cf5ce060e98d69052ae0e52eaf9148
|
[
"BSD-3-Clause"
] | 1 |
2019-04-30T06:37:01.000Z
|
2019-04-30T06:37:01.000Z
|
codebase/projects/localsdkquery/src/java/gov/nih/nci/cagrid/data/cql/cacore/HibernateUtil.java
|
NCIP/catrip
|
1615ab2598cf5ce060e98d69052ae0e52eaf9148
|
[
"BSD-3-Clause"
] | null | null | null | 36.16 | 132 | 0.652655 | 1,001,343 |
/*L
* Copyright Duke Comprehensive Cancer Center
*
* Distributed under the OSI-approved BSD 3-Clause License.
* See http://ncip.github.com/catrip/LICENSE.txt for details.
*/
package gov.nih.nci.cagrid.data.cql.cacore;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class HibernateUtil {
public static final ThreadLocal session = new ThreadLocal();
public static Hashtable sessionFactoryMap = new Hashtable();
public static SessionFactory getSessionFactory(String hibernateConfig,String dataBaseURL, String schemaOrUser) {
SessionFactory sessionFactory;
try {
//Configuration configuration = new Configuration().configure(hibernateConfig);
//String dataBaseURL = configuration.getProperty("hibernate.connection.url");
//String schema = configuration.getProperty("hibernate.connection.username");
String sessionFactoryId = dataBaseURL+"_"+schemaOrUser;
if (sessionFactoryMap.get(sessionFactoryId) == null ){
System.out.println("Building New SessionFactory ..." + sessionFactoryId);
sessionFactory = new Configuration().configure(hibernateConfig).buildSessionFactory();
sessionFactoryMap.put(sessionFactoryId,sessionFactory);
} else {
System.out.println("Getting Existing SessionFactory ..." + sessionFactoryId);
sessionFactory = (SessionFactory)sessionFactoryMap.get(sessionFactoryId);
}
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
return sessionFactory;
}
public static Session currentSession(String hibernateConfig,String dataBaseURL, String schemaOrUser) throws HibernateException {
Session s = (Session) session.get();
// Open a new Session, if this Thread has none yet
if (s == null) {
s = getSessionFactory(hibernateConfig,dataBaseURL,schemaOrUser).openSession();
session.set(s);
}
return s;
}
public static void closeSession() throws HibernateException {
Session s = (Session) session.get();
session.set(null);
if (s != null) {
s.close();
System.out.println("Closing session");
}
}
}
|
923ff4ca9f80d9d6ea31f48ab793568b5ee03bfe
| 225 |
java
|
Java
|
biz/src/main/java/com/abbcc/dao/impl/SeoDaoImpl.java
|
baowp/platform
|
74e99bba08b88c6287ad2a79f1075909acec2c38
|
[
"Apache-2.0"
] | null | null | null |
biz/src/main/java/com/abbcc/dao/impl/SeoDaoImpl.java
|
baowp/platform
|
74e99bba08b88c6287ad2a79f1075909acec2c38
|
[
"Apache-2.0"
] | null | null | null |
biz/src/main/java/com/abbcc/dao/impl/SeoDaoImpl.java
|
baowp/platform
|
74e99bba08b88c6287ad2a79f1075909acec2c38
|
[
"Apache-2.0"
] | 1 |
2018-03-19T03:12:37.000Z
|
2018-03-19T03:12:37.000Z
| 18.75 | 67 | 0.808889 | 1,001,344 |
package com.abbcc.dao.impl;
import org.springframework.stereotype.Repository;
import com.abbcc.dao.SeoDao;
import com.abbcc.models.AbcSeo;
@Repository
public class SeoDaoImpl extends DaoImpl<AbcSeo> implements SeoDao {
}
|
923ff4e80df6924af163137c4810dbcda65b0e5b
| 572 |
java
|
Java
|
src/persistencia/CausaDB.java
|
odmendoza/sma-emotions
|
6de3c0e8f7cb92c8074d5dfb623170d5ec0ff282
|
[
"MIT"
] | null | null | null |
src/persistencia/CausaDB.java
|
odmendoza/sma-emotions
|
6de3c0e8f7cb92c8074d5dfb623170d5ec0ff282
|
[
"MIT"
] | null | null | null |
src/persistencia/CausaDB.java
|
odmendoza/sma-emotions
|
6de3c0e8f7cb92c8074d5dfb623170d5ec0ff282
|
[
"MIT"
] | null | null | null | 28.6 | 93 | 0.687063 | 1,001,345 |
package persistencia;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class CausaDB {
ConexionDB conecction = new ConexionDB();
public ResultSet getCauses(String idEmotion) throws ClassNotFoundException, SQLException{
Statement statement = conecction.openConnection().createStatement();
String query = String.format("SELECT idCause, descriptionCause FROM Cause \n" +
"WHERE idEmotion = '%s'", idEmotion);
return statement.executeQuery(query);
}
}
|
923ff5ba354a9186b350a00eadbb1d0ef49bbdbf
| 2,630 |
java
|
Java
|
java/src/main/java/com/ywh/problem/leetcode/medium/LeetCode94.java
|
yipwinghong/Algorithm
|
e594df043c9d965dbfbd958554e88c533c844a45
|
[
"MIT"
] | 9 |
2019-10-31T16:58:31.000Z
|
2022-02-08T08:42:30.000Z
|
java/src/main/java/com/ywh/problem/leetcode/medium/LeetCode94.java
|
yipwinghong/Algorithm
|
e594df043c9d965dbfbd958554e88c533c844a45
|
[
"MIT"
] | null | null | null |
java/src/main/java/com/ywh/problem/leetcode/medium/LeetCode94.java
|
yipwinghong/Algorithm
|
e594df043c9d965dbfbd958554e88c533c844a45
|
[
"MIT"
] | null | null | null | 22.10084 | 68 | 0.478707 | 1,001,346 |
package com.ywh.problem.leetcode.medium;
import com.ywh.ds.tree.TreeNode;
import java.util.ArrayList;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
/**
* 二叉树的中序遍历
* [栈] [树]
*
* 给定一个二叉树的根节点 root ,返回它的 中序 遍历。
* 示例 1:
* 输入:root = [1,null,2,3]
* 输出:[1,3,2]
* 示例 2:
* 输入:root = []
* 输出:[]
* 示例 3:
* 输入:root = [1]
* 输出:[1]
* 示例 4:
* 输入:root = [1,2]
* 输出:[2,1]
* 示例 5:
* 输入:root = [1,null,2]
* 输出:[1,2]
* 提示:
* 树中节点数目在范围 [0, 100] 内
* -100 <= Node.val <= 100
* 进阶: 递归算法很简单,你可以通过迭代算法完成吗?
*
* @author ywh
* @since 2/20/2019
*/
public class LeetCode94 {
/**
*
* @param root
* @param ret
*/
public void inorderTraversal(TreeNode root, List<Integer> ret) {
if (root == null) {
return;
}
inorderTraversal(root.left, ret);
ret.add(root.val);
inorderTraversal(root.right, ret);
}
/**
*
* @param root
* @return
*/
public List<Integer> inorderTraversalRecursive2(TreeNode root) {
List<Integer> ret = new ArrayList<>();
inorderTraversal(root, ret);
return ret;
}
/**
* Time: O(n), Space: O(n)
*
* @param root
* @return
*/
public List<Integer> inorderTraversalRecursive(TreeNode root) {
if (root == null) {
return new ArrayList<>();
}
// 取左子树的节点列表。
List<Integer> left = inorderTraversalRecursive(root.left);
// 取右子树的节点列表
List<Integer> right = inorderTraversalRecursive(root.right);
// 在左子树的节点后面添加根节点、再依次添加所有右子树的节点。
left.add(root.val);
left.addAll(right);
return left;
}
/**
* Time: O(n). Space: O(n)
*
* @param root
* @return
*/
public List<Integer> inorderTraversalIterative(TreeNode root) {
Deque<TreeNode> stack = new LinkedList<>();
List<Integer> ret = new ArrayList<>();
// 遍历路径:
// 1. 首先从 [3] 向左出发,一直到 [1] 的左节点为空,沿途把经过的节点入栈:[3, 1];
// 2. 直到遇到空节点,从栈中弹出 [1],取出 [1] 的值后向右走到达 [2];
// 3. 由于是递归结构,[2] 也可以视作根,此时处理与 1 相同。
//
// [3]
// / \
// [1] [4]
// \
// [2]
while (root != null || !stack.isEmpty()) {
if (root != null) {
stack.push(root);
root = root.left;
} else {
root = stack.pop();
ret.add(root.val);
root = root.right;
}
}
return ret;
}
}
|
923ff5dfddce12fc7e846c078b77d8270f00341b
| 8,334 |
java
|
Java
|
src/com/sun/security/auth/callback/TextCallbackHandler.java
|
terminux/jdk1.7.0_80
|
c2869af7cc5791f7e58894f4c9f5bceea3ed040e
|
[
"MIT"
] | null | null | null |
src/com/sun/security/auth/callback/TextCallbackHandler.java
|
terminux/jdk1.7.0_80
|
c2869af7cc5791f7e58894f4c9f5bceea3ed040e
|
[
"MIT"
] | null | null | null |
src/com/sun/security/auth/callback/TextCallbackHandler.java
|
terminux/jdk1.7.0_80
|
c2869af7cc5791f7e58894f4c9f5bceea3ed040e
|
[
"MIT"
] | 2 |
2020-07-12T00:31:07.000Z
|
2021-05-26T07:38:37.000Z
| 31.80916 | 80 | 0.553636 | 1,001,347 |
/*
* Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.security.auth.callback;
/* JAAS imports */
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.ConfirmationCallback;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.TextOutputCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
/* Java imports */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PushbackInputStream;
import java.util.Arrays;
import sun.security.util.Password;
/**
* <p>
* Prompts and reads from the command line for answers to authentication
* questions.
* This can be used by a JAAS application to instantiate a
* CallbackHandler
* @see javax.security.auth.callback
*/
public class TextCallbackHandler implements CallbackHandler {
/**
* <p>Creates a callback handler that prompts and reads from the
* command line for answers to authentication questions.
* This can be used by JAAS applications to instantiate a
* CallbackHandler.
*/
public TextCallbackHandler() { }
/**
* Handles the specified set of callbacks.
*
* @param callbacks the callbacks to handle
* @throws IOException if an input or output error occurs.
* @throws UnsupportedCallbackException if the callback is not an
* instance of NameCallback or PasswordCallback
*/
public void handle(Callback[] callbacks)
throws IOException, UnsupportedCallbackException
{
ConfirmationCallback confirmation = null;
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof TextOutputCallback) {
TextOutputCallback tc = (TextOutputCallback) callbacks[i];
String text;
switch (tc.getMessageType()) {
case TextOutputCallback.INFORMATION:
text = "";
break;
case TextOutputCallback.WARNING:
text = "Warning: ";
break;
case TextOutputCallback.ERROR:
text = "Error: ";
break;
default:
throw new UnsupportedCallbackException(
callbacks[i], "Unrecognized message type");
}
String message = tc.getMessage();
if (message != null) {
text += message;
}
if (text != null) {
System.err.println(text);
}
} else if (callbacks[i] instanceof NameCallback) {
NameCallback nc = (NameCallback) callbacks[i];
if (nc.getDefaultName() == null) {
System.err.print(nc.getPrompt());
} else {
System.err.print(nc.getPrompt() +
" [" + nc.getDefaultName() + "] ");
}
System.err.flush();
String result = readLine();
if (result.equals("")) {
result = nc.getDefaultName();
}
nc.setName(result);
} else if (callbacks[i] instanceof PasswordCallback) {
PasswordCallback pc = (PasswordCallback) callbacks[i];
System.err.print(pc.getPrompt());
System.err.flush();
pc.setPassword(Password.readPassword(System.in, pc.isEchoOn()));
} else if (callbacks[i] instanceof ConfirmationCallback) {
confirmation = (ConfirmationCallback) callbacks[i];
} else {
throw new UnsupportedCallbackException(
callbacks[i], "Unrecognized Callback");
}
}
/* Do the confirmation callback last. */
if (confirmation != null) {
doConfirmation(confirmation);
}
}
/* Reads a line of input */
private String readLine() throws IOException {
String result = new BufferedReader
(new InputStreamReader(System.in)).readLine();
if (result == null) {
throw new IOException("Cannot read from System.in");
}
return result;
}
private void doConfirmation(ConfirmationCallback confirmation)
throws IOException, UnsupportedCallbackException
{
String prefix;
int messageType = confirmation.getMessageType();
switch (messageType) {
case ConfirmationCallback.WARNING:
prefix = "Warning: ";
break;
case ConfirmationCallback.ERROR:
prefix = "Error: ";
break;
case ConfirmationCallback.INFORMATION:
prefix = "";
break;
default:
throw new UnsupportedCallbackException(
confirmation, "Unrecognized message type: " + messageType);
}
class OptionInfo {
String name;
int value;
OptionInfo(String name, int value) {
this.name = name;
this.value = value;
}
}
OptionInfo[] options;
int optionType = confirmation.getOptionType();
switch (optionType) {
case ConfirmationCallback.YES_NO_OPTION:
options = new OptionInfo[] {
new OptionInfo("Yes", ConfirmationCallback.YES),
new OptionInfo("No", ConfirmationCallback.NO)
};
break;
case ConfirmationCallback.YES_NO_CANCEL_OPTION:
options = new OptionInfo[] {
new OptionInfo("Yes", ConfirmationCallback.YES),
new OptionInfo("No", ConfirmationCallback.NO),
new OptionInfo("Cancel", ConfirmationCallback.CANCEL)
};
break;
case ConfirmationCallback.OK_CANCEL_OPTION:
options = new OptionInfo[] {
new OptionInfo("OK", ConfirmationCallback.OK),
new OptionInfo("Cancel", ConfirmationCallback.CANCEL)
};
break;
case ConfirmationCallback.UNSPECIFIED_OPTION:
String[] optionStrings = confirmation.getOptions();
options = new OptionInfo[optionStrings.length];
for (int i = 0; i < options.length; i++) {
options[i] = new OptionInfo(optionStrings[i], i);
}
break;
default:
throw new UnsupportedCallbackException(
confirmation, "Unrecognized option type: " + optionType);
}
int defaultOption = confirmation.getDefaultOption();
String prompt = confirmation.getPrompt();
if (prompt == null) {
prompt = "";
}
prompt = prefix + prompt;
if (!prompt.equals("")) {
System.err.println(prompt);
}
for (int i = 0; i < options.length; i++) {
if (optionType == ConfirmationCallback.UNSPECIFIED_OPTION) {
// defaultOption is an index into the options array
System.err.println(
i + ". " + options[i].name +
(i == defaultOption ? " [default]" : ""));
} else {
// defaultOption is an option value
System.err.println(
i + ". " + options[i].name +
(options[i].value == defaultOption ? " [default]" : ""));
}
}
System.err.print("Enter a number: ");
System.err.flush();
int result;
try {
result = Integer.parseInt(readLine());
if (result < 0 || result > (options.length - 1)) {
result = defaultOption;
}
result = options[result].value;
} catch (NumberFormatException e) {
result = defaultOption;
}
confirmation.setSelectedIndex(result);
}
}
|
923ff75c64b31d7f1ceeae57e33d70d824cc5388
| 905 |
java
|
Java
|
gmall-oms-interface/src/main/java/com/atguigu/gmall/oms/entity/OrderSettingEntity.java
|
zzf666666/gmall
|
ad23994f685b6950b996b513a60378644f61386b
|
[
"Apache-2.0"
] | 1 |
2020-06-18T02:33:50.000Z
|
2020-06-18T02:33:50.000Z
|
gmall-oms-interface/src/main/java/com/atguigu/gmall/oms/entity/OrderSettingEntity.java
|
zzf666666/gmall
|
ad23994f685b6950b996b513a60378644f61386b
|
[
"Apache-2.0"
] | 3 |
2021-03-19T20:23:52.000Z
|
2021-09-20T20:58:46.000Z
|
gmall-oms-interface/src/main/java/com/atguigu/gmall/oms/entity/OrderSettingEntity.java
|
zzf666666/gmall
|
ad23994f685b6950b996b513a60378644f61386b
|
[
"Apache-2.0"
] | 1 |
2020-05-18T16:01:02.000Z
|
2020-05-18T16:01:02.000Z
| 16.943396 | 57 | 0.701559 | 1,001,348 |
package com.atguigu.gmall.oms.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 订单配置信息
*
* @author mj
* @email [email protected]
* @date 2020-05-17 16:48:08
*/
@Data
@TableName("oms_order_setting")
public class OrderSettingEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId
private Long id;
/**
* 秒杀订单超时关闭时间(分)
*/
private Integer flashOrderOvertime;
/**
* 正常订单超时时间(分)
*/
private Integer normalOrderOvertime;
/**
* 发货后自动确认收货时间(天)
*/
private Integer confirmOvertime;
/**
* 自动完成交易时间,不能申请退货(天)
*/
private Integer finishOvertime;
/**
* 订单完成后自动好评时间(天)
*/
private Integer commentOvertime;
/**
* 会员等级【0-不限会员等级,全部通用;其他-对应的其他会员等级】
*/
private Integer memberLevel;
}
|
923ff78f2eb276f751464082747aba23e6b866c9
| 5,991 |
java
|
Java
|
src/main/java/cn/dalgen/mybatis/gen/model/dbtable/Table.java
|
jeffrey-fu/dalgen
|
5e5b0ca0245bea5ae2fb027c0eb7840a73d94813
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/cn/dalgen/mybatis/gen/model/dbtable/Table.java
|
jeffrey-fu/dalgen
|
5e5b0ca0245bea5ae2fb027c0eb7840a73d94813
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/cn/dalgen/mybatis/gen/model/dbtable/Table.java
|
jeffrey-fu/dalgen
|
5e5b0ca0245bea5ae2fb027c0eb7840a73d94813
|
[
"Apache-2.0"
] | null | null | null | 21.169611 | 87 | 0.545986 | 1,001,349 |
package cn.dalgen.mybatis.gen.model.dbtable;
import com.google.common.collect.Lists;
import com.google.common.collect.Ordering;
import com.google.common.primitives.Ints;
import org.apache.commons.lang.StringUtils;
import java.util.List;
/**
* 表信息 Created by bangis.wangdf on 15/12/4. Desc
*/
public class Table {
/**
* The Db type.
*/
private String dbType;
/**
* The Sql name.
*/
private String sqlName;
/**
* The Java name.
*/
private String javaName;
/**
* The Remark.
*/
private String remark;
/**
* The Column list.
*/
private List<Column> columnList = Lists.newArrayList();
/**
* The Primary keys.
*/
private PrimaryKeys primaryKeys;
/**
* The Unique indexes.
*/
private List<UniqueIndex> uniqueIndexs = Lists.newArrayList();
/**
* The Normal indexes.
*/
private List<NormalIndex> normalIndexs = Lists.newArrayList();
/**
* The Physical name.
*/
private String physicalName;
/**
* 需要软删除
*/
private boolean neadSoftDelete = false;
/**
* Gets primary keys.
*
* @return the primary keys
*/
public PrimaryKeys getPrimaryKeys() {
return primaryKeys;
}
/**
* Sets primary keys.
*
* @param primaryKeys the primary keys
*/
public void setPrimaryKeys(PrimaryKeys primaryKeys) {
this.primaryKeys = primaryKeys;
}
/**
* Gets sql name.
*
* @return the sql name
*/
public String getSqlName() {
return sqlName;
}
/**
* Sets sql name.
*
* @param sqlName the sql name
*/
public void setSqlName(String sqlName) {
this.sqlName = sqlName;
}
/**
* Gets java name.
*
* @return the java name
*/
public String getJavaName() {
return javaName;
}
/**
* Sets java name.
*
* @param javaName the java name
*/
public void setJavaName(String javaName) {
this.javaName = javaName;
}
/**
* Gets remark.
*
* @return the remark
*/
public String getRemark() {
return remark;
}
/**
* Sets remark.
*
* @param remark the remark
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* Gets column list.
*
* @return the column list
*/
public List<Column> getColumnList() {
//对params进行排序
Ordering<Column> typeOrdering = new Ordering<Column>() {
@Override
public int compare(Column left, Column right) {
if (StringUtils.equalsIgnoreCase(left.getSqlName(), "ID")) {
return -1;
}
if (StringUtils.equalsIgnoreCase(right.getSqlName(), "ID")) {
return 1;
}
int cr = compare(left.getJavaType(), right.getJavaType());
return cr == 0 ? compare(left.getJavaName(), right.getJavaName()) : cr;
}
private int compare(String left, String right) {
int cr = Ints.compare(left.length(), right.length());
return cr == 0 ? left.compareTo(right) : cr;
}
};
return typeOrdering.sortedCopy(columnList);
}
/**
* 根据字段名获取Column
*
* @param name the name
* @return column by name
*/
public Column getColumnByName(String name) {
for (Column column : columnList) {
if (StringUtils.equalsIgnoreCase(name, column.getSqlName())) {
return column;
}
}
return null;
}
/**
* Add column.
*
* @param column the column
*/
public void addColumn(Column column) {
this.columnList.add(column);
}
/**
* Sets column list.
*
* @param columnList the column list
*/
public void setColumnList(List<Column> columnList) {
this.columnList = columnList;
}
/**
* Gets physical name.
*
* @return the physical name
*/
public String getPhysicalName() {
return physicalName;
}
/**
* Sets physical name.
*
* @param physicalName the physical name
*/
public void setPhysicalName(String physicalName) {
this.physicalName = physicalName;
}
/**
* Gets unique indexs.
*
* @return the unique indexs
*/
public List<UniqueIndex> getUniqueIndexs() {
return uniqueIndexs;
}
/**
* Sets unique indexs.
*
* @param uniqueIndexs the unique indexs
*/
public void setUniqueIndexs(List<UniqueIndex> uniqueIndexs) {
this.uniqueIndexs = uniqueIndexs;
}
/**
* Add unique index.
*
* @param uniqueIndex the unique index
*/
public void addUniqueIndex(UniqueIndex uniqueIndex) {
uniqueIndexs.add(uniqueIndex);
}
/**
* Gets normal indexes.
*
* @return the normal indexes
*/
public List<NormalIndex> getNormalIndexs() {
return normalIndexs;
}
/**
* Sets normal indexes.
*
* @param normalIndexs the normal indexes
*/
public void setNormalIndexs(List<NormalIndex> normalIndexs) {
this.normalIndexs = normalIndexs;
}
/**
* Add normal index.
*
* @param normalIndex the normal index
*/
public void addNormalIndex(NormalIndex normalIndex) {
normalIndexs.add(normalIndex);
}
public boolean isNeadSoftDelete() {
return neadSoftDelete;
}
public void setNeadSoftDelete(boolean neadSoftDelete) {
this.neadSoftDelete = neadSoftDelete;
}
public String getDbType() {
return dbType;
}
public void setDbType(String dbType) {
this.dbType = dbType;
}
}
|
923ff84ace67c38aba57ea0f579d57d2f93e9873
| 2,875 |
java
|
Java
|
src/main/java/org/apache/hadoop/chukwa/datacollection/agent/AdaptorManager.java
|
shreyass123/chukwa
|
326f05987cab95d3d58c5ead461c2c9360ba73d6
|
[
"Apache-2.0",
"CC0-1.0"
] | 73 |
2015-01-21T10:01:09.000Z
|
2022-02-09T04:54:27.000Z
|
src/main/java/org/apache/hadoop/chukwa/datacollection/agent/AdaptorManager.java
|
shreyass123/chukwa
|
326f05987cab95d3d58c5ead461c2c9360ba73d6
|
[
"Apache-2.0",
"CC0-1.0"
] | 4 |
2015-02-27T18:47:32.000Z
|
2018-07-16T23:12:38.000Z
|
core/src/main/java/org/apache/hadoop/chukwa/datacollection/agent/AdaptorManager.java
|
isabella232/chukwa
|
38742d250275529d07c1ff4f912a29b73a5985fb
|
[
"Apache-2.0",
"CC0-1.0"
] | 53 |
2015-02-10T20:36:01.000Z
|
2021-11-10T16:31:19.000Z
| 28.75 | 87 | 0.713043 | 1,001,350 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.chukwa.datacollection.agent;
import java.util.Collections;
import java.util.Map;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.chukwa.datacollection.adaptor.Adaptor;
import org.apache.hadoop.chukwa.datacollection.adaptor.AdaptorShutdownPolicy;
/**
* The interface to the agent that is exposed to adaptors.
*
*/
public interface AdaptorManager {
Configuration getConfiguration();
int adaptorCount();
@Deprecated
long stopAdaptor(String id, boolean gracefully);
long stopAdaptor(String id, AdaptorShutdownPolicy mode);
Adaptor getAdaptor(String id);
String processAddCommand(String cmd);
Map<String, String> getAdaptorList();
/**
* Called to update the Agent status table.
*
* Most adaptors should not call this. It is designed for adaptors that do
* some sort of local operation that needs checkpointing, but that doesn't
* emit chunks. For instance, DirTailingAdaptor uses it to track sweeps.
*
* @param src the adaptor in question
* @param uuid the number to record as checkpoint. Must be monotonically increasing.
* @return the adaptor ID of the associated adaptor, or null if not running.
*/
public String reportCommit(Adaptor src, long uuid);
static AdaptorManager NULL = new AdaptorManager() {
@Override
public int adaptorCount() {
return 0;
}
@Override
public Adaptor getAdaptor(String id) {
return null;
}
@Override
public Map<String, String> getAdaptorList() {
return Collections.emptyMap();
}
@Override
public Configuration getConfiguration() {
return new Configuration();
}
@Override
public String processAddCommand(String cmd) {
return "";
}
public long stopAdaptor(String id, boolean gracefully) {
return 0;
}
@Override
public long stopAdaptor(String id, AdaptorShutdownPolicy mode) {
return 0;
}
@Override
public String reportCommit(Adaptor a, long l) {
return null;
}
};
}
|
923ff8ab67ac614438ff52dc2c6e89d031860c2b
| 1,293 |
java
|
Java
|
src/com/sciome/bmdexpress2/serviceInterface/IPrefilterService.java
|
tosaddler/BMDExpress-2.0
|
109b78d092695e8f03eaa8fd3289836e59bffb82
|
[
"Unlicense"
] | null | null | null |
src/com/sciome/bmdexpress2/serviceInterface/IPrefilterService.java
|
tosaddler/BMDExpress-2.0
|
109b78d092695e8f03eaa8fd3289836e59bffb82
|
[
"Unlicense"
] | null | null | null |
src/com/sciome/bmdexpress2/serviceInterface/IPrefilterService.java
|
tosaddler/BMDExpress-2.0
|
109b78d092695e8f03eaa8fd3289836e59bffb82
|
[
"Unlicense"
] | null | null | null | 51.72 | 106 | 0.843001 | 1,001,351 |
package com.sciome.bmdexpress2.serviceInterface;
import com.sciome.bmdexpress2.mvp.model.IStatModelProcessable;
import com.sciome.bmdexpress2.mvp.model.prefilter.OneWayANOVAResults;
import com.sciome.bmdexpress2.mvp.model.prefilter.OriogenResults;
import com.sciome.bmdexpress2.mvp.model.prefilter.WilliamsTrendResults;
import com.sciome.commons.interfaces.SimpleProgressUpdater;
public interface IPrefilterService {
public WilliamsTrendResults williamsTrendAnalysis(IStatModelProcessable processableData, double pCutOff,
boolean multipleTestingCorrection, boolean filterOutControlGenes, boolean useFoldFilter,
String foldFilterValue, String numberOfPermutations, SimpleProgressUpdater updater);
public OriogenResults oriogenAnalysis(IStatModelProcessable processableData, double pCutOff,
boolean multipleTestingCorrection, int initialBootstraps, int maxBootstraps,
float s0Adjustment, boolean filterOutControlGenes, boolean useFoldFilter,
String foldFilterValue, SimpleProgressUpdater updater);
public OneWayANOVAResults oneWayANOVAAnalysis(IStatModelProcessable processableData, double pCutOff,
boolean multipleTestingCorrection, boolean filterOutControlGenes, boolean useFoldFilter,
String foldFilterValue);
public void cancel();
}
|
923ff8eb4db5e8363fc379af3e48862ebffd6a69
| 2,797 |
java
|
Java
|
src/main/java/org/bian/dto/BQInitiativeExchangeInputModel.java
|
bianapis/sd-segment-direction-v2
|
a98c41149b58b8adb2c072ba07c0d34b40c2e910
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/org/bian/dto/BQInitiativeExchangeInputModel.java
|
bianapis/sd-segment-direction-v2
|
a98c41149b58b8adb2c072ba07c0d34b40c2e910
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/org/bian/dto/BQInitiativeExchangeInputModel.java
|
bianapis/sd-segment-direction-v2
|
a98c41149b58b8adb2c072ba07c0d34b40c2e910
|
[
"Apache-2.0"
] | null | null | null | 34.109756 | 189 | 0.82088 | 1,001,352 |
package org.bian.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.bian.dto.CRSegmentStrategyExchangeInputModelSegmentStrategyExchangeActionRequest;
import javax.validation.Valid;
/**
* BQInitiativeExchangeInputModel
*/
public class BQInitiativeExchangeInputModel {
private String segmentStrategyInstanceReference = null;
private String initiativeInstanceReference = null;
private Object initiativeExchangeActionTaskRecord = null;
private CRSegmentStrategyExchangeInputModelSegmentStrategyExchangeActionRequest initiativeExchangeActionRequest = null;
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::ISO20022andUNCEFACT::Identifier general-info: Reference to the parent Segment Strategy instance
* @return segmentStrategyInstanceReference
**/
public String getSegmentStrategyInstanceReference() {
return segmentStrategyInstanceReference;
}
public void setSegmentStrategyInstanceReference(String segmentStrategyInstanceReference) {
this.segmentStrategyInstanceReference = segmentStrategyInstanceReference;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::ISO20022andUNCEFACT::Identifier general-info: Reference to the Initiative instance
* @return initiativeInstanceReference
**/
public String getInitiativeInstanceReference() {
return initiativeInstanceReference;
}
public void setInitiativeInstanceReference(String initiativeInstanceReference) {
this.initiativeInstanceReference = initiativeInstanceReference;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Binary general-info: The exchange service call consolidated processing record
* @return initiativeExchangeActionTaskRecord
**/
public Object getInitiativeExchangeActionTaskRecord() {
return initiativeExchangeActionTaskRecord;
}
public void setInitiativeExchangeActionTaskRecord(Object initiativeExchangeActionTaskRecord) {
this.initiativeExchangeActionTaskRecord = initiativeExchangeActionTaskRecord;
}
/**
* Get initiativeExchangeActionRequest
* @return initiativeExchangeActionRequest
**/
public CRSegmentStrategyExchangeInputModelSegmentStrategyExchangeActionRequest getInitiativeExchangeActionRequest() {
return initiativeExchangeActionRequest;
}
public void setInitiativeExchangeActionRequest(CRSegmentStrategyExchangeInputModelSegmentStrategyExchangeActionRequest initiativeExchangeActionRequest) {
this.initiativeExchangeActionRequest = initiativeExchangeActionRequest;
}
}
|
923ff938ae5465e541d032e1614de25a18089b1f
| 908 |
java
|
Java
|
document-storm-cpu/src/main/java/top/docstorm/documentstormcpu/consumer/FileMessageConsumer.java
|
icankeep/Document-Storm-2.0
|
ea785789e977b4987949e1ef57a01593702364ff
|
[
"MIT"
] | 2 |
2019-09-09T13:26:27.000Z
|
2019-10-06T03:57:37.000Z
|
document-storm-cpu/src/main/java/top/docstorm/documentstormcpu/consumer/FileMessageConsumer.java
|
icankeep/Document-Storm-2.0
|
ea785789e977b4987949e1ef57a01593702364ff
|
[
"MIT"
] | null | null | null |
document-storm-cpu/src/main/java/top/docstorm/documentstormcpu/consumer/FileMessageConsumer.java
|
icankeep/Document-Storm-2.0
|
ea785789e977b4987949e1ef57a01593702364ff
|
[
"MIT"
] | null | null | null | 31.310345 | 93 | 0.778634 | 1,001,353 |
package top.docstorm.documentstormcpu.consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Service;
import top.docstorm.documentstormcommon.constant.MessageConstants;
import top.docstorm.documentstormcommon.service.MessageService;
/**
* 消息消费者
*/
@Service
public class FileMessageConsumer {
private static final Logger LOGGER = LoggerFactory.getLogger(FileMessageConsumer.class);
@Autowired
private MessageService messageService;
@JmsListener(destination = MessageConstants.TRANS_FILE_MESSAGE_TOPIC_NAME)
public void receiveTransFileTopicMessage(String message) {
LOGGER.info("receive message: " + message);
messageService.dealTransFileTopicMessage(message);
}
}
|
923ffa56a589b4988115c5232229c4e205198d42
| 443 |
java
|
Java
|
AlgorithmSamples/src/prgs/MatriceSamples/Prg089.java
|
yalihan/IntroductionToProgramming_CSystem-AliVefaSerce-
|
ccdf25ce69042493d6b94736696141f6c5afc55f
|
[
"MIT"
] | 1 |
2020-08-13T20:50:25.000Z
|
2020-08-13T20:50:25.000Z
|
AlgorithmSamples/src/prgs/MatriceSamples/Prg089.java
|
yalihan/IntroductionProgramming_CSystem-AliVefaSerce-
|
ccdf25ce69042493d6b94736696141f6c5afc55f
|
[
"MIT"
] | null | null | null |
AlgorithmSamples/src/prgs/MatriceSamples/Prg089.java
|
yalihan/IntroductionProgramming_CSystem-AliVefaSerce-
|
ccdf25ce69042493d6b94736696141f6c5afc55f
|
[
"MIT"
] | null | null | null | 26.058824 | 55 | 0.559819 | 1,001,354 |
package prgs.MatriceSamples;
import prgs.Prg;
public class Prg089 extends Prg{
public void cozum() {
int[][] m = {{5,7,3},{15,6,10},{22,9,1},{11,14,18}};
int[][] transposeM = new int[m[0].length][m.length];
for(int i=0 ; i<transposeM.length ; i++) {
for(int j=0 ; j<transposeM[0].length ; j++) {
transposeM[i][j] = m[j][i];
System.out.print(transposeM[i][j]+"\t");
}
System.out.println("\n");
}
}
}
|
923ffaadd30125654b5fedbd8301706c67178159
| 566 |
java
|
Java
|
src/api/java/mekanism/api/recipes/inputs/IInputHandler.java
|
sctprog/Mekanism
|
af6038d5e8a7d7451cf26145ca4f71f13339dfea
|
[
"MIT"
] | 4 |
2020-09-02T01:27:30.000Z
|
2021-05-29T22:58:12.000Z
|
src/api/java/mekanism/api/recipes/inputs/IInputHandler.java
|
sctprog/Mekanism
|
af6038d5e8a7d7451cf26145ca4f71f13339dfea
|
[
"MIT"
] | 1 |
2016-11-01T07:51:35.000Z
|
2016-11-01T07:53:42.000Z
|
src/api/java/mekanism/api/recipes/inputs/IInputHandler.java
|
sctprog/Mekanism
|
af6038d5e8a7d7451cf26145ca4f71f13339dfea
|
[
"MIT"
] | 1 |
2021-09-24T19:27:07.000Z
|
2021-09-24T19:27:07.000Z
| 33.294118 | 107 | 0.772085 | 1,001,355 |
package mekanism.api.recipes.inputs;
public interface IInputHandler<INPUT> {
//TODO: Note that the returned value should not be modified
INPUT getInput();
INPUT getRecipeInput(InputIngredient<INPUT> recipeIngredient);
void use(INPUT recipeInput, int operations);
default int operationsCanSupport(InputIngredient<INPUT> recipeIngredient, int currentMax) {
return operationsCanSupport(recipeIngredient, currentMax, 1);
}
int operationsCanSupport(InputIngredient<INPUT> recipeIngredient, int currentMax, int usageMultiplier);
}
|
923ffc52639c847d03a668cffa35485cef3109e2
| 1,138 |
java
|
Java
|
src/test/java/com/covisint/cf/servicebroker/dynatrace/model/PlanTest.java
|
alokhm/dynatrace-service-broker
|
591f4909efcc4089b8053711abec6d75eda5de0c
|
[
"Apache-2.0"
] | null | null | null |
src/test/java/com/covisint/cf/servicebroker/dynatrace/model/PlanTest.java
|
alokhm/dynatrace-service-broker
|
591f4909efcc4089b8053711abec6d75eda5de0c
|
[
"Apache-2.0"
] | null | null | null |
src/test/java/com/covisint/cf/servicebroker/dynatrace/model/PlanTest.java
|
alokhm/dynatrace-service-broker
|
591f4909efcc4089b8053711abec6d75eda5de0c
|
[
"Apache-2.0"
] | null | null | null | 24.73913 | 69 | 0.643234 | 1,001,356 |
package com.covisint.cf.servicebroker.dynatrace.model;
import java.io.IOException;
import java.util.Map;
import java.util.UUID;
import com.covisint.cf.servicebroker.dynatrace.model.Plan;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
/**
*
* Test class for PlanTest.
*
* @version 1.0, 2015-06-01
* @author Lingeshm
*
*/
public final class PlanTest extends AbstractSerializationTest<Plan> {
@Override
protected void assertContents(Map m) throws IOException {
assertEquals(getId().toString(), m.get("id"));
assertEquals("test-name", m.get("name"));
assertEquals("test-description", m.get("description"));
assertNull(m.get("metadata"));
assertTrue((Boolean) m.get("free"));
}
@Override
protected Plan getInstance() {
return new Plan(null)
.id(getId())
.name("test-name")
.description("test-description")
.free(true);
}
public UUID getId() {
return UUID.nameUUIDFromBytes(new byte[0]);
}
}
|
923ffd5eef401569d2926d40e154b55169490abd
| 1,989 |
java
|
Java
|
app/src/main/java/com/enzorobaina/synclocalandremotedb/database/CharacterDAO.java
|
EnzoRobaina/Android-SyncLocalAndRemoteDB
|
a820af67ec496767d13794605f4afaabef497ad8
|
[
"Apache-2.0"
] | null | null | null |
app/src/main/java/com/enzorobaina/synclocalandremotedb/database/CharacterDAO.java
|
EnzoRobaina/Android-SyncLocalAndRemoteDB
|
a820af67ec496767d13794605f4afaabef497ad8
|
[
"Apache-2.0"
] | null | null | null |
app/src/main/java/com/enzorobaina/synclocalandremotedb/database/CharacterDAO.java
|
EnzoRobaina/Android-SyncLocalAndRemoteDB
|
a820af67ec496767d13794605f4afaabef497ad8
|
[
"Apache-2.0"
] | null | null | null | 42.319149 | 278 | 0.737054 | 1,001,357 |
package com.enzorobaina.synclocalandremotedb.database;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;
import com.enzorobaina.synclocalandremotedb.model.Character;
import java.util.List;
@Dao
public interface CharacterDAO {
@Insert(onConflict = OnConflictStrategy.IGNORE)
long insert(Character character);
@Insert(onConflict = OnConflictStrategy.REPLACE)
List<Long> insertMultiple(List<Character> characters);
@Update
int update(Character character);
@Query("UPDATE " + Character.tableName + " SET isSynced = :syncStatus WHERE id = :id")
int updateSync(long id, int syncStatus);
@Query("UPDATE " + Character.tableName + " SET isSynced = 1, name = :name, lastModifiedAt = :lastModifiedAt, strength = :strength, dexterity = :dexterity, constitution = :constitution, intelligence = :intelligence, wisdom = :wisdom, charisma = :charisma WHERE uuid = :uuid")
int updateByUUID(String uuid, String name, String lastModifiedAt, int strength, int dexterity, int constitution, int intelligence, int wisdom, int charisma);
@Update
int batchSetUUIDs(List<Character> characters);
@Query("SELECT * FROM " + Character.tableName + " ORDER BY id ASC")
public List<Character> getAllCharacters();
@Query("SELECT * FROM " + Character.tableName + " WHERE isSynced = :syncStatus ORDER BY id ASC")
public List<Character> getAllCharactersWithSync(int syncStatus);
@Query("SELECT * FROM " + Character.tableName + " ORDER BY id ASC")
public LiveData<List<Character>> getAllCharactersLiveData();
@Query("SELECT * FROM " + Character.tableName + " WHERE isSynced = :syncStatus ORDER BY id ASC")
public LiveData<List<Character>> getAllCharactersLiveDataWithSync(int syncStatus);
@Query("SELECT * FROM " + Character.tableName + " WHERE id = :id")
public Character get(int id);
}
|
923ffeaeb2af778b36a32e7d6a969d07b98d3895
| 1,589 |
java
|
Java
|
app/src/main/java/kr/iamport/sdk/PaymentScheme.java
|
iamport/iamport-nice-android-graddle
|
9279c89631055d16d054cbd5f27ec0a9345f8434
|
[
"MIT"
] | 2 |
2019-02-15T08:50:45.000Z
|
2019-03-24T13:54:30.000Z
|
app/src/main/java/kr/iamport/sdk/PaymentScheme.java
|
iamport/iamport-nice-android-graddle
|
9279c89631055d16d054cbd5f27ec0a9345f8434
|
[
"MIT"
] | null | null | null |
app/src/main/java/kr/iamport/sdk/PaymentScheme.java
|
iamport/iamport-nice-android-graddle
|
9279c89631055d16d054cbd5f27ec0a9345f8434
|
[
"MIT"
] | null | null | null | 69.086957 | 221 | 0.761485 | 1,001,358 |
package kr.iamport.sdk;
/**
* Created by jang on 2017. 9. 9..
*/
public class PaymentScheme {
public final static String ISP = "ispmobile"; // ISP모바일 : ispmobile://TID=nictest00m01011606281506341724
public final static String BANKPAY = "kftc-bankpay";
public final static String LOTTE_APPCARD = "lotteappcard"; // 롯데앱카드 : intent://lottecard/data?acctid=120160628150229605882165497397&apptid=964241&IOS_RETURN_APP=#Intent;scheme=lotteappcard;package=com.lcacApp;end
public final static String HYUNDAI_APPCARD = "hdcardappcardansimclick"; // 현대앱카드 : intent:hdcardappcardansimclick://appcard?acctid=201606281503270019917080296121#Intent;package=com.hyundaicard.appcard;end;
public final static String SAMSUNG_APPCARD = "mpocket.online.ansimclick"; // 삼성앱카드 : intent://xid=4752902#Intent;scheme=mpocket.online.ansimclick;package=kr.co.samsungcard.mpocket;end;
public final static String NH_APPCARD = "nhappcardansimclick"; // NH 앱카드 : intent://appcard?ACCTID=201606281507175365309074630161&P1=1532151#Intent;scheme=nhappcardansimclick;package=nh.smart.mobilecard;end;
public final static String KB_APPCARD = "kb-acp"; // KB 앱카드 : intent://pay?srCode=0613325&kb-acp://#Intent;scheme=kb-acp;package=com.kbcard.cxh.appcard;end;
public final static String MOBIPAY = "cloudpay"; // 하나(모비페이) : intent://?tid=2238606309025172#Intent;scheme=cloudpay;package=com.hanaskcard.paycla;end;
public final static String PACKAGE_ISP = "kvp.jjy.MispAndroid320";
public final static String PACKAGE_BANKPAY = "com.kftc.bankpay.android";
}
|
923ffff8e955bd59fd11179804c00841bc3b4877
| 614 |
java
|
Java
|
modules/dashboard-commons/src/test/java/org/jboss/dashboard/pojo/CellPhone.java
|
etirelli/dashboard-builder
|
6049ec9bd6274189d90567dca5869f29bb0a24e4
|
[
"Apache-2.0"
] | null | null | null |
modules/dashboard-commons/src/test/java/org/jboss/dashboard/pojo/CellPhone.java
|
etirelli/dashboard-builder
|
6049ec9bd6274189d90567dca5869f29bb0a24e4
|
[
"Apache-2.0"
] | null | null | null |
modules/dashboard-commons/src/test/java/org/jboss/dashboard/pojo/CellPhone.java
|
etirelli/dashboard-builder
|
6049ec9bd6274189d90567dca5869f29bb0a24e4
|
[
"Apache-2.0"
] | null | null | null | 30.7 | 75 | 0.739414 | 1,001,359 |
/*
* Copyright 2015 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* 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.jboss.dashboard.pojo;
public class CellPhone {
}
|
9240002f8b3d8e93239b0da6cafed37e365b6b37
| 900 |
java
|
Java
|
core/src/main/java/org/infinispan/factories/PartitionHandlingManagerFactory.java
|
an1310/infinispan
|
85a1e6cc53fe3b68040fa44de28aee9f36f44bbc
|
[
"Apache-2.0"
] | null | null | null |
core/src/main/java/org/infinispan/factories/PartitionHandlingManagerFactory.java
|
an1310/infinispan
|
85a1e6cc53fe3b68040fa44de28aee9f36f44bbc
|
[
"Apache-2.0"
] | 41 |
2019-06-11T11:25:03.000Z
|
2021-08-02T16:57:31.000Z
|
core/src/main/java/org/infinispan/factories/PartitionHandlingManagerFactory.java
|
an1310/infinispan
|
85a1e6cc53fe3b68040fa44de28aee9f36f44bbc
|
[
"Apache-2.0"
] | null | null | null | 33.333333 | 98 | 0.741111 | 1,001,360 |
package org.infinispan.factories;
import org.infinispan.factories.annotations.DefaultFactoryFor;
import org.infinispan.partitionhandling.impl.PartitionHandlingManager;
import org.infinispan.partitionhandling.impl.PartitionHandlingManagerImpl;
/**
* @author Dan Berindei
* @since 7.0
*/
@DefaultFactoryFor(classes = PartitionHandlingManager.class)
public class PartitionHandlingManagerFactory extends AbstractNamedCacheComponentFactory implements
AutoInstantiableFactory {
@Override
@SuppressWarnings("unchecked")
public <T> T construct(Class<T> componentType) {
if (configuration.clustering().partitionHandling().enabled()) {
if (configuration.clustering().cacheMode().isDistributed() ||
configuration.clustering().cacheMode().isReplicated()) {
return (T) new PartitionHandlingManagerImpl();
}
}
return null;
}
}
|
924000462faa28195b65c923ea5636565d2ffba5
| 372 |
java
|
Java
|
mobile_app1/module51/src/main/java/module51packageJava0/Foo126.java
|
HiWong/android-build-eval
|
d909ab37bc8d5d3a188ba9c9f0855f846f6f3af6
|
[
"Apache-2.0"
] | 70 |
2021-01-22T16:48:06.000Z
|
2022-02-16T10:37:33.000Z
|
mobile_app1/module51/src/main/java/module51packageJava0/Foo126.java
|
HiWong/android-build-eval
|
d909ab37bc8d5d3a188ba9c9f0855f846f6f3af6
|
[
"Apache-2.0"
] | 16 |
2021-01-22T20:52:52.000Z
|
2021-08-09T17:51:24.000Z
|
mobile_app1/module51/src/main/java/module51packageJava0/Foo126.java
|
HiWong/android-build-eval
|
d909ab37bc8d5d3a188ba9c9f0855f846f6f3af6
|
[
"Apache-2.0"
] | 5 |
2021-01-26T13:53:49.000Z
|
2021-08-11T20:10:57.000Z
| 11.625 | 45 | 0.572581 | 1,001,361 |
package module51packageJava0;
import java.lang.Integer;
public class Foo126 {
Integer int0;
public void foo0() {
new module51packageJava0.Foo125().foo5();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
}
|
9240005aeb7a8e23c9eca3ff14715ee8a0069af5
| 12,972 |
java
|
Java
|
services/namespace/src/main/java/com/dremio/service/namespace/PartitionChunkId.java
|
geetek/dremio-oss
|
812c7f32f9437df52b1d7bd8d5c45f9a79b6e9d2
|
[
"Apache-2.0"
] | 1,085 |
2017-07-19T15:08:38.000Z
|
2022-03-29T13:35:07.000Z
|
services/namespace/src/main/java/com/dremio/service/namespace/PartitionChunkId.java
|
geetek/dremio-oss
|
812c7f32f9437df52b1d7bd8d5c45f9a79b6e9d2
|
[
"Apache-2.0"
] | 20 |
2017-07-19T20:16:27.000Z
|
2021-12-02T10:56:25.000Z
|
services/namespace/src/main/java/com/dremio/service/namespace/PartitionChunkId.java
|
geetek/dremio-oss
|
812c7f32f9437df52b1d7bd8d5c45f9a79b6e9d2
|
[
"Apache-2.0"
] | 398 |
2017-07-19T18:12:58.000Z
|
2022-03-30T09:37:40.000Z
| 37.062857 | 140 | 0.74021 | 1,001,362 |
/*
* Copyright (C) 2017-2019 Dremio Corporation
*
* 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.dremio.service.namespace;
import static com.dremio.service.namespace.DatasetSplitIndexKeys.DATASET_ID;
import static com.dremio.service.namespace.DatasetSplitIndexKeys.SPLIT_VERSION;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.Comparator;
import java.util.Optional;
import javax.annotation.Nullable;
import com.dremio.datastore.SearchQueryUtils;
import com.dremio.datastore.SearchTypes.SearchQuery;
import com.dremio.datastore.api.LegacyKVStore.LegacyFindByRange;
import com.dremio.service.namespace.dataset.proto.DatasetConfig;
import com.dremio.service.namespace.dataset.proto.PartitionProtobuf.PartitionChunk;
import com.dremio.service.namespace.proto.EntityId;
import com.dremio.service.namespace.source.proto.MetadataPolicy;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonValue;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.CharMatcher;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.Range;
/**
* Dataset Split key
*/
public final class PartitionChunkId implements Comparable<PartitionChunkId> {
// Private comparator
private static final Comparator<PartitionChunkId> COMPARATOR = Comparator
.comparing(PartitionChunkId::getDatasetId)
.thenComparing(PartitionChunkId::getSplitVersion)
.thenComparing(PartitionChunkId::getSplitIdentifier);
// DO NOT USE DIRECTLY unless you understand exactly how PartitionChunkId is encoded
// The encoding is <encoded dataset id>_<version>_<key>
// - dataset id should be encoded so that underscores do not appear
// - version should be a number only
// - key has no special restriction
private static final String DELIMITER = "_";
private static final Joiner SPLIT_ID_JOINER = Joiner.on(DELIMITER);
private static final CharMatcher RESERVED_DATASET_ID_CHARACTERS = CharMatcher.anyOf("_%");
private final String datasetId;
private final long splitVersion;
private final String splitKey;
private final String compoundSplitId;
@JsonCreator
public static PartitionChunkId of(String partitionChunkId) {
final String[] ids = partitionChunkId.split(DELIMITER, 3);
Preconditions.checkArgument(ids.length == 3 && !ids[0].isEmpty() && !ids[1].isEmpty() && !ids[2].isEmpty(),
"Invalid dataset split id %s", partitionChunkId);
// Some dataset split before upgrade might not have a valid version
// but the compound key would still allow for the entry to be removed from the kvstore
// so allowing it temporarily.
//
// See DX-13336 for details
long version;
try {
version = Long.parseLong(ids[1]);
} catch (NumberFormatException e) {
version = Long.MIN_VALUE;
}
return new PartitionChunkId(partitionChunkId, unescape(ids[0]), version, ids[2]);
}
public static PartitionChunkId of(DatasetConfig config, PartitionChunk split, long splitVersion) {
Preconditions.checkArgument(splitVersion > -1);
EntityId datasetId = config.getId();
String splitKey = split.getSplitKey();
return of(datasetId, splitVersion, splitKey);
}
public static PartitionChunkId of(DatasetConfig config, PartitionChunkMetadata partitionChunkMetadata, long splitVersion) {
Preconditions.checkArgument(splitVersion > -1);
EntityId datasetId = config.getId();
String splitKey = partitionChunkMetadata.getSplitKey();
return of(datasetId, splitVersion, splitKey);
}
private static String escape(String datasetId) {
// Replace % and _ with their URL encoded counter parts
// Order is important (first encode % and then _) as
StringBuilder sb = new StringBuilder(datasetId.length());
for(int i = 0; i < datasetId.length(); i++) {
char c = datasetId.charAt(i);
switch(c) {
case '%':
sb.append("%25");
break;
case '_':
sb.append("%5F");
break;
default:
sb.append(c);
}
}
return sb.toString();
}
private static String unescape(String encoded) {
try {
return URLDecoder.decode(encoded, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
// should never happen as UTF-8 should always be supported
throw new AssertionError(e);
}
}
@VisibleForTesting
static PartitionChunkId of(EntityId datasetId, long splitVersion, String splitKey) {
final String datasetIdAsString = escape(datasetId.getId());
String compoundSplitId = SPLIT_ID_JOINER.join(datasetIdAsString, splitVersion, splitKey);
return new PartitionChunkId(compoundSplitId, datasetIdAsString, splitVersion, splitKey);
}
// To be only used for testing migration of unsafe ids
@VisibleForTesting
static PartitionChunkId ofUnsafe(EntityId datasetId, long splitVersion, String splitKey) {
final String datasetIdAsString = datasetId.getId();
String compoundSplitId = SPLIT_ID_JOINER.join(datasetIdAsString, splitVersion, splitKey);
return new PartitionChunkId(compoundSplitId, datasetIdAsString, splitVersion, splitKey);
}
private PartitionChunkId(String compoundSplitId, String datasetId, long splitVersion, String splitKey) {
this.datasetId = datasetId;
this.splitVersion = splitVersion;
this.splitKey = splitKey;
this.compoundSplitId = compoundSplitId;
}
@JsonValue
public String getSplitId() {
return compoundSplitId;
}
@JsonIgnore
public String getDatasetId() {
return datasetId;
}
@JsonIgnore
public long getSplitVersion() {
return splitVersion;
}
@JsonIgnore
public String getSplitIdentifier() {
return splitKey;
}
@Override
public int hashCode() {
return compoundSplitId.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj != null) {
if (obj instanceof PartitionChunkId) {
final PartitionChunkId other = (PartitionChunkId)obj;
return compoundSplitId.equals(other.compoundSplitId);
}
}
return false;
}
@Override
public int compareTo(PartitionChunkId that) {
return COMPARATOR.compare(this, that);
}
@Override
public String toString() {
return compoundSplitId;
}
public static SearchQuery getSplitsQuery(DatasetConfig datasetConfig) {
Preconditions.checkNotNull(datasetConfig.getReadDefinition());
long splitVersion = Preconditions.checkNotNull(datasetConfig.getReadDefinition().getSplitVersion());
return getSplitsQuery(datasetConfig.getId(), splitVersion);
}
public static SearchQuery getSplitsQuery(EntityId datasetId, long splitVersion) {
return SearchQueryUtils.and(
SearchQueryUtils.newTermQuery(DATASET_ID, datasetId.getId()),
SearchQueryUtils.newTermQuery(SPLIT_VERSION, splitVersion));
}
/**
* Create a range for the current split version of the given dataset
*
* @param datasetConfig the dataset config
* @return a range which would contain all split ids for this dataset and its current split version
*/
public static Range<PartitionChunkId> getCurrentSplitRange(DatasetConfig datasetConfig){
final long splitVersion = datasetConfig.getReadDefinition().getSplitVersion();
return getSplitRange(datasetConfig.getId(), splitVersion);
}
/**
* Create a range for the given split version of the dataset
*
* @param datasetId the dataset id
* @param splitVersion the split version
* @return a range which would contain all split ids for this dataset and the split version
*/
public static Range<PartitionChunkId> getSplitRange(EntityId datasetId, long splitVersion) {
return getSplitRange(datasetId, splitVersion, splitVersion + 1);
}
/**
* Create a range for partition chunk id
*
* Create a range to check if a split id belongs to the provided dataset id and its version is comprised
* into startSplitVersion (included) and endSplitVersion (excluded).
*
* @param datasetId the dataset id
* @param startSplitVersion the minimum split version
* @param endSplitVersion the maximum split version
* @return
*/
public static Range<PartitionChunkId> getSplitRange(EntityId datasetId, long startSplitVersion, long endSplitVersion) {
// create start and end id with empty split identifier
final PartitionChunkId start = getId(datasetId, startSplitVersion);
final PartitionChunkId end = getId(datasetId, endSplitVersion);
return Range.closedOpen(start, end);
}
private static PartitionChunkId getId(EntityId datasetId, long version) {
return PartitionChunkId.of(datasetId, version, "");
}
public static LegacyFindByRange<PartitionChunkId> getSplitsRange(DatasetConfig datasetConfig) {
Range<PartitionChunkId> range = getCurrentSplitRange(datasetConfig);
return new LegacyFindByRange<PartitionChunkId>()
.setStart(range.lowerEndpoint(), true)
.setEnd(range.upperEndpoint(), false);
}
public static LegacyFindByRange<PartitionChunkId> getSplitsRange(EntityId datasetId, long splitVersionId) {
Range<PartitionChunkId> range = getSplitRange(datasetId, splitVersionId);
return new LegacyFindByRange<PartitionChunkId>()
.setStart(range.lowerEndpoint(), true)
.setEnd(range.upperEndpoint(), false);
}
/**
* Check if split id for this dataset may need new split id
*
* See DX-13336 for details
*
* @param config the dataset config
* @return true if this dataset might be using legacy/invalid datasetId.
*/
public static boolean mayRequireNewDatasetId(DatasetConfig config) {
return RESERVED_DATASET_ID_CHARACTERS.matchesAnyOf(config.getId().getId());
}
/**
* UNSAFE! Use {@code PartitionChunkId#getSplitRange(EntityId, long)} instead
*/
public static LegacyFindByRange<PartitionChunkId> unsafeGetSplitsRange(DatasetConfig config) {
final long splitVersion = config.getReadDefinition().getSplitVersion();
final long nextSplitVersion = splitVersion + 1;
final String datasetId = config.getId().getId();
// Unsafe way of constructing dataset split id!!!
final PartitionChunkId start = new PartitionChunkId(SPLIT_ID_JOINER.join(datasetId, splitVersion, ""), datasetId, splitVersion, "");
final PartitionChunkId end = new PartitionChunkId(SPLIT_ID_JOINER.join(datasetId, nextSplitVersion, ""), datasetId, splitVersion, "");
return new LegacyFindByRange<PartitionChunkId>()
.setStart(start, true)
.setEnd(end, false);
}
/**
* Policy to get valid ranges of splits for a given dataset
*/
@FunctionalInterface
public interface SplitOrphansRetentionPolicy {
/**
* Only keep splits for a dataset matching the current dataset's split version
*/
public static final SplitOrphansRetentionPolicy KEEP_CURRENT_VERSION_ONLY = (metadataPolicy, dataset) -> getCurrentSplitRange(dataset);
/**
* Only keep splits whose version is not expired based on the source metadata expiration policy.
*
* Keep current version, even if expired
*/
public static final SplitOrphansRetentionPolicy KEEP_VALID_SPLITS = (metadataPolicy, dataset) -> {
long expirationMs = Optional.ofNullable(metadataPolicy).map(MetadataPolicy::getDatasetDefinitionExpireAfterMs).orElse(Long.MAX_VALUE);
// Anything less than expiredVersion is considered expired
long expiredVersion = Math.max(0, System.currentTimeMillis() - expirationMs);
// Make sure current version (or higher) is still valid. Some sources don't change split version if dataset is refreshed
// (assuming split info do not change)
long minVersion = Math.min(dataset.getReadDefinition().getSplitVersion(), expiredVersion);
return getSplitRange(dataset.getId(), minVersion, Long.MAX_VALUE);
};
/**
* Compute valid range of splits for a given dataset
*
* Compute a range of split ids which would be valid for the provided
* metadata policy and dataset config
*
* @param metadataPolicy the metadata policy for the given dataset
* @param dataset the dataset config
* @return a range of valid split ids
*/
Range<PartitionChunkId> apply(@Nullable MetadataPolicy metadataPolicy, DatasetConfig dataset);
}
}
|
9240006a2d3b0b22da387198b9ccafbe05f9c4e7
| 1,740 |
java
|
Java
|
SampleHibernate/src/main/java/com/imos/hibernate/HibernateCritieriaQueryTest.java
|
aloktech/AllProjects
|
9a7f3318517083b2d0fa5313580bbf725b677989
|
[
"Apache-2.0"
] | 1 |
2020-03-12T12:55:27.000Z
|
2020-03-12T12:55:27.000Z
|
SampleHibernate/src/main/java/com/imos/hibernate/HibernateCritieriaQueryTest.java
|
aloktech/AllProjects
|
9a7f3318517083b2d0fa5313580bbf725b677989
|
[
"Apache-2.0"
] | 9 |
2021-09-20T20:36:53.000Z
|
2022-03-08T21:11:25.000Z
|
SampleHibernate/src/main/java/com/imos/hibernate/HibernateCritieriaQueryTest.java
|
aloktech/AllProjects
|
9a7f3318517083b2d0fa5313580bbf725b677989
|
[
"Apache-2.0"
] | null | null | null | 34.8 | 101 | 0.591954 | 1,001,363 |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.imos.hibernate;
import com.imos.hibernate.dto.PersonDetails;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.criterion.Restrictions;
/**
*
* @author Alok
*/
public class HibernateCritieriaQueryTest {
public static void main(String[] args) {
try (SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory()) {
try (Session session = sessionFactory.openSession()) {
session.beginTransaction();
System.out.println("\nSelect All\n");
Criteria criteria = session.createCriteria(PersonDetails.class);
List<PersonDetails> list = criteria.list();
list.stream().forEach((pd) -> {
System.out.println(pd);
});
System.out.println("\nSelect selected\n");
criteria = session.createCriteria(PersonDetails.class);
criteria.add(Restrictions.eq("userName", "Alok1"));
list = criteria.list();
list.stream().forEach((pd) -> {
System.out.println(pd);
});
} catch (Exception e) {
System.out.println(e.getCause().toString() + " : " + e.getMessage());
}
} catch (Exception e) {
System.out.println(e.getCause().toString() + " : " + e.getMessage());
}
}
}
|
924000bc7bc07d309c52ba5bc697cf562acbf973
| 3,148 |
java
|
Java
|
src/test/java/org/jenkinsci/plugins/cloudstats/TrackedAgent.java
|
jenkinsci/cloud-stats-plugin
|
d623611baf926afede1e39472e0ce7dc99937484
|
[
"MIT"
] | 9 |
2016-08-11T11:03:46.000Z
|
2019-04-17T06:46:37.000Z
|
src/test/java/org/jenkinsci/plugins/cloudstats/TrackedAgent.java
|
jenkinsci/cloud-stats-plugin
|
d623611baf926afede1e39472e0ce7dc99937484
|
[
"MIT"
] | 21 |
2017-01-02T15:26:47.000Z
|
2021-05-13T11:19:15.000Z
|
src/test/java/org/jenkinsci/plugins/cloudstats/TrackedAgent.java
|
jenkinsci/cloud-stats-plugin
|
d623611baf926afede1e39472e0ce7dc99937484
|
[
"MIT"
] | 17 |
2016-05-05T18:59:26.000Z
|
2021-01-14T22:27:38.000Z
| 38.864198 | 256 | 0.74587 | 1,001,364 |
/*
* The MIT License (MIT)
*
* Copyright (c) 2021 Red Hat, Inc.
*
* 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.jenkinsci.plugins.cloudstats;
import hudson.EnvVars;
import hudson.model.Descriptor;
import hudson.model.TaskListener;
import hudson.slaves.AbstractCloudComputer;
import hudson.slaves.AbstractCloudSlave;
import hudson.slaves.ComputerLauncher;
import hudson.slaves.NodeProperty;
import hudson.slaves.RetentionStrategy;
import org.jvnet.hudson.test.JenkinsRule;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
/**
* @author ogondza.
*/
final class TrackedAgent extends AbstractCloudSlave implements TrackedItem {
private final ProvisioningActivity.Id id;
public TrackedAgent(ProvisioningActivity.Id id, JenkinsRule j, String name) throws Exception {
super(name == null ? id.getNodeName(): name, "dummy", j.createTmpDir().getPath(), "1", Mode.NORMAL, "label", j.createComputerLauncher(new EnvVars()), RetentionStrategy.NOOP, Collections.<NodeProperty<?>>emptyList());
this.id = id;
}
public TrackedAgent(
String name, String nodeDescription, String remoteFS, String numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List<? extends NodeProperty<?>> nodeProperties, ProvisioningActivity.Id id
) throws IOException, Descriptor.FormException {
super(name, nodeDescription, remoteFS, numExecutors, mode, labelString, launcher, retentionStrategy, nodeProperties);
this.id = id;
}
@Nonnull
public static TrackedAgent create(ProvisioningActivity.Id id, JenkinsRule j) throws Exception {
TrackedAgent slave = new TrackedAgent(id, j, null);
j.jenkins.addNode(slave);
return slave;
}
@Override
public AbstractCloudComputer createComputer() {
return new TrackedComputer(this, id);
}
@Override
protected void _terminate(TaskListener listener) {
}
@Override
public ProvisioningActivity.Id getId() {
return id;
}
}
|
924000ccde60066bfe54c0c841e4326348d8949d
| 4,182 |
java
|
Java
|
commercetools-models/src/main/java/io/sphere/sdk/products/attributes/AttributeExtraction.java
|
FL-K/commercetools-jvm-sdk
|
6c3ba0d2e29e2f9c1a4054d99ea1e3ba8cf323ac
|
[
"Apache-2.0"
] | null | null | null |
commercetools-models/src/main/java/io/sphere/sdk/products/attributes/AttributeExtraction.java
|
FL-K/commercetools-jvm-sdk
|
6c3ba0d2e29e2f9c1a4054d99ea1e3ba8cf323ac
|
[
"Apache-2.0"
] | null | null | null |
commercetools-models/src/main/java/io/sphere/sdk/products/attributes/AttributeExtraction.java
|
FL-K/commercetools-jvm-sdk
|
6c3ba0d2e29e2f9c1a4054d99ea1e3ba8cf323ac
|
[
"Apache-2.0"
] | null | null | null | 43.113402 | 183 | 0.710187 | 1,001,365 |
package io.sphere.sdk.products.attributes;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.producttypes.AttributeDefinitionContainer;
import javax.annotation.Nullable;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
/**
* Helper class to create mapping from product attribute values to a target type.
*
* <p>This is a functional approach, {@link DefaultProductAttributeFormatter} provides an object oriented way to achieve the same.</p>
*
* <p>A possible use case is documented <a href="{@docRoot}/io/sphere/sdk/meta/ProductAttributeDocumentation.html#attribute-table-creation">here</a>.</p>
*
* @param <T> the type of the target value which should be extracted from the attribute value. Most likely this will be {@link String}.
*
* @see Attribute
*/
public final class AttributeExtraction<T> extends Base {
@Nullable
private final AttributeDefinition attributeDefinition;
private final Attribute attribute;
@Nullable
private final T value;
private AttributeExtraction(@Nullable final AttributeDefinition attributeDefinition, final Attribute attribute, @Nullable final T value) {
this.attributeDefinition = attributeDefinition;
this.attribute = attribute;
this.value = value;
}
public static <T> AttributeExtraction<T> of(final AttributeDefinitionContainer productType, final Attribute attribute) {
final AttributeDefinition attributeDefinition = productType.getAttribute(attribute.getName());
return of(attributeDefinition, attribute, null);
}
public static <T> AttributeExtraction<T> of(final AttributeDefinition attributeDefinition, final Attribute attribute) {
return of(attributeDefinition, attribute, null);
}
private static <T> AttributeExtraction<T> of(final AttributeDefinition attributeDefinition, final Attribute attribute, @Nullable final T value) {
return new AttributeExtraction<>(attributeDefinition, attribute, value);
}
private AttributeExtraction<T> withValue(@Nullable final T value) {
return of(attributeDefinition, attribute, value);
}
public <I> AttributeExtraction<T> ifGuarded(final AttributeAccess<I> extraction, final Function<I, Optional<T>> function) {
return Optional.ofNullable(value).map(x -> this).orElseGet(() -> {
final T transformed = calculateValue(extraction).flatMap(value -> function.apply(value)).orElse(null);
return withValue(transformed);
});
}
public <I> AttributeExtraction<T> ifIs(final AttributeAccess<I> extraction, final Function<? super I, ? extends T> function) {
return ifIs(extraction, function, x -> true);
}
@SuppressWarnings("unchecked")
private <A> Optional<A> calculateValue(final AttributeAccess<A> extraction) {
return Optional.ofNullable(attributeDefinition).flatMap(attributeDefinition -> calculateValue(extraction, attributeDefinition));
}
private <A> Optional<A> calculateValue(final AttributeAccess<A> extraction, final AttributeDefinition attributeDefinition) {
if (extraction.canHandle(attributeDefinition)) {
final A value = attribute.getValue(extraction);
return Optional.of(value);
} else {
return Optional.empty();
}
}
public <A> AttributeExtraction<T> ifIs(final AttributeAccess<A> extraction, final Function<? super A, ? extends T> function, final java.util.function.Predicate<? super A> guard) {
final Supplier<AttributeExtraction<T>> askChain = () -> {
final T newValue = calculateValue(extraction).flatMap(attributeValue -> {
final T nullableValue = guard.test(attributeValue) ? function.apply(attributeValue) : null;
return Optional.ofNullable(nullableValue);
}).orElse(null);
return withValue(newValue);
};
return Optional.ofNullable(this.value).map(x -> this).orElseGet(askChain);
}
public Optional<T> findValue() {
return Optional.ofNullable(getValue());
}
@Nullable
public T getValue() {
return value;
}
}
|
924001441913c8cb721c7052c7185575833b8d47
| 2,504 |
java
|
Java
|
src/main/java/org/broad/igv/feature/Cytoband.java
|
RoelKluin/igv
|
71f8969321b4bcdef16f6a231d270586bde0b284
|
[
"MIT"
] | 406 |
2015-05-10T03:01:00.000Z
|
2022-03-24T23:11:32.000Z
|
src/main/java/org/broad/igv/feature/Cytoband.java
|
kutama/igv
|
1617851778eb4832fcb282e4c8caed78ff5e4d13
|
[
"MIT"
] | 931 |
2015-05-07T14:34:58.000Z
|
2022-03-30T13:38:57.000Z
|
src/main/java/org/broad/igv/feature/Cytoband.java
|
kutama/igv
|
1617851778eb4832fcb282e4c8caed78ff5e4d13
|
[
"MIT"
] | 498 |
2015-06-03T16:14:35.000Z
|
2022-03-15T19:39:39.000Z
| 22.972477 | 80 | 0.63778 | 1,001,366 |
/*
* The MIT License (MIT)
*
* Copyright (c) 2007-2015 Broad Institute
*
* 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.broad.igv.feature;
public class Cytoband implements NamedFeature {
String chromosome;
String name;
String longName;
int end;
int start;
char type; // p, n, or c
short stain;
public Cytoband(String chromosome) {
this.chromosome = chromosome;
this.name = "";
}
public void trim() {
// @todo -- trim arrays
}
@Override
public String getContig() {
return chromosome;
}
public String getChr() {
return chromosome;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public String getLongName() {
if(longName == null) {
longName = chromosome.replace("chr", "") + name;
}
return longName;
}
public void setEnd(int end) {
this.end = end;
}
public int getEnd() {
return end;
}
public void setStart(int start) {
this.start = start;
}
public int getStart() {
return start;
}
public void setType(char type) {
this.type = type;
}
public char getType() {
return type;
}
public void setStain(short stain) {
this.stain = stain;
}
public short getStain() {
return stain;
}
}
|
9240014bcc8ef429e946673b5552ede325477428
| 1,039 |
java
|
Java
|
thread/src/main/java/com/zgy/learn/aqs/mustkowntool/UseSemaphore.java
|
prayjourney/bucket-improvement
|
5b0e3df9b96ecbbade7b2a7736cbaba1074d3148
|
[
"Apache-2.0"
] | null | null | null |
thread/src/main/java/com/zgy/learn/aqs/mustkowntool/UseSemaphore.java
|
prayjourney/bucket-improvement
|
5b0e3df9b96ecbbade7b2a7736cbaba1074d3148
|
[
"Apache-2.0"
] | null | null | null |
thread/src/main/java/com/zgy/learn/aqs/mustkowntool/UseSemaphore.java
|
prayjourney/bucket-improvement
|
5b0e3df9b96ecbbade7b2a7736cbaba1074d3148
|
[
"Apache-2.0"
] | null | null | null | 30.558824 | 105 | 0.481232 | 1,001,367 |
package com.zgy.learn.aqs.mustkowntool;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
/**
* @Author: renjiaxin
* @Despcription:
* @Date: Created in 2020/3/8 4:27
* @Modified by:
*/
public class UseSemaphore {
public static void main(String[] args) {
// 只有三个共享的资源
Semaphore semaphore = new Semaphore(3);
for (int i = 0; i < 6; i++) {
new Thread(() -> {
try {
// 获取许可证
semaphore.acquire();
System.out.println(Thread.currentThread().getName() + ": 获取了车位!");
TimeUnit.SECONDS.sleep(1);
System.out.println(Thread.currentThread().getName() + ": ==================》离开了车位!");
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
// 释放许可证
semaphore.release();
}
}, String.valueOf(i) + "线程:").start();
}
}
}
|
92400209d2d222408b2671efcf4347fe1eb2fdb0
| 1,185 |
java
|
Java
|
clustered/server/service-api/src/main/java/org/ehcache/clustered/server/ServerSideServerStore.java
|
mobasherul/ehcache3
|
cec8c7274050a816494fac2a15a7f7d95ad6de03
|
[
"Apache-2.0"
] | 1,900 |
2015-01-16T13:52:10.000Z
|
2022-03-31T02:30:15.000Z
|
clustered/server/service-api/src/main/java/org/ehcache/clustered/server/ServerSideServerStore.java
|
mobasherul/ehcache3
|
cec8c7274050a816494fac2a15a7f7d95ad6de03
|
[
"Apache-2.0"
] | 1,912 |
2015-01-05T22:27:45.000Z
|
2022-03-18T06:19:35.000Z
|
clustered/server/service-api/src/main/java/org/ehcache/clustered/server/ServerSideServerStore.java
|
mobasherul/ehcache3
|
cec8c7274050a816494fac2a15a7f7d95ad6de03
|
[
"Apache-2.0"
] | 632 |
2015-01-13T04:07:13.000Z
|
2022-02-25T08:57:49.000Z
| 35.909091 | 75 | 0.777215 | 1,001,368 |
/*
* Copyright Terracotta, 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.ehcache.clustered.server;
import org.ehcache.clustered.common.internal.ServerStoreConfiguration;
import org.ehcache.clustered.common.internal.store.Chain;
import org.ehcache.clustered.common.internal.store.ServerStore;
import java.util.List;
import java.util.Set;
public interface ServerSideServerStore extends ServerStore {
void setEventListener(ServerStoreEventListener listener);
void enableEvents(boolean enable);
ServerStoreConfiguration getStoreConfiguration();
List<Set<Long>> getSegmentKeySets();
void put(long key, Chain chain);
void remove(long key);
}
|
9240022ffd20411793693ac1e8d69beab9c4749e
| 882 |
java
|
Java
|
TheFirstModule/src/LeetCode/Solution14_Cplusplus.java
|
xiongEd/TheFirstModule
|
4016ed2ff327e5c51e3ee2434cee5536ebe40ae1
|
[
"Apache-2.0"
] | 1 |
2020-01-09T09:59:23.000Z
|
2020-01-09T09:59:23.000Z
|
TheFirstModule/src/LeetCode/Solution14_Cplusplus.java
|
xiongEd/TheFirstModule
|
4016ed2ff327e5c51e3ee2434cee5536ebe40ae1
|
[
"Apache-2.0"
] | null | null | null |
TheFirstModule/src/LeetCode/Solution14_Cplusplus.java
|
xiongEd/TheFirstModule
|
4016ed2ff327e5c51e3ee2434cee5536ebe40ae1
|
[
"Apache-2.0"
] | null | null | null | 20.511628 | 82 | 0.452381 | 1,001,369 |
package LeetCode;
/*
编写一个函数来查找字符串数组中的最长公共前缀。
如果不存在公共前缀,返回空字符串 ""。
示例 1:
输入: ["flower","flow","flight"]
输出: "fl"
示例 2:
输入: ["dog","racecar","car"]
输出: ""
解释: 输入不存在公共前缀。
*/
public class Solution14_Cplusplus {
/*
public:
string longestCommonPrefix(vector<string>& strs) {
string ans = "";
if(strs.empty()) return ans; //输入为空,输出空ans
int arr = strs.size();
string min = strs[0];
for(int i = 1; i < arr; ++ i) //找到最短字符串
{
if(strs[i].size() < min.size())
min = strs[i];
}
for(int j = 0; j < min.size(); ++ j) //从第一个字符开始对比,若都一样,ans加上该字符,若不一样,返回答案;
{
for(int m = 0; m < arr; ++m)
{
if(min[j] != strs[m][j])
return ans;
}
ans = ans + min[j];
}
return ans;
}
*/
}
|
924002bf78657bb9e3af7972cdd046af69dca195
| 10,399 |
java
|
Java
|
main/plugins/org.talend.metadata.managment/src/main/java/org/talend/metadata/managment/model/IMetadataFiller.java
|
coheigea/tcommon-studio-se
|
681d9a8240b120f5633d751590ac09d31ea8879b
|
[
"Apache-2.0"
] | 75 |
2015-01-29T03:23:32.000Z
|
2022-02-26T07:05:40.000Z
|
main/plugins/org.talend.metadata.managment/src/main/java/org/talend/metadata/managment/model/IMetadataFiller.java
|
coheigea/tcommon-studio-se
|
681d9a8240b120f5633d751590ac09d31ea8879b
|
[
"Apache-2.0"
] | 813 |
2015-01-21T09:36:31.000Z
|
2022-03-30T01:15:29.000Z
|
main/plugins/org.talend.metadata.managment/src/main/java/org/talend/metadata/managment/model/IMetadataFiller.java
|
coheigea/tcommon-studio-se
|
681d9a8240b120f5633d751590ac09d31ea8879b
|
[
"Apache-2.0"
] | 272 |
2015-01-08T06:47:46.000Z
|
2022-02-09T23:22:27.000Z
| 45.609649 | 131 | 0.685066 | 1,001,370 |
// ============================================================================
//
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.metadata.managment.model;
import java.sql.DatabaseMetaData;
import java.util.List;
import java.util.Map;
import org.talend.core.model.metadata.IMetadataConnection;
import org.talend.core.model.metadata.builder.connection.Connection;
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
import org.talend.core.model.metadata.builder.connection.MetadataTable;
import org.talend.cwm.relational.TdColumn;
import org.talend.cwm.relational.TdTable;
import org.talend.cwm.relational.TdView;
import org.talend.utils.sugars.ReturnCode;
import org.talend.utils.sugars.TypedReturnCode;
import orgomg.cwm.objectmodel.core.Package;
import orgomg.cwm.resource.relational.Catalog;
import orgomg.cwm.resource.relational.ColumnSet;
import orgomg.cwm.resource.relational.Schema;
/**
* zshen class global comment. The class help for fill all kinds of metadata elements
*/
public interface IMetadataFiller<T extends Connection> {
/**
*
* zshen Comment method "fillUIParams". convert a Map of UI parameter to IMetadataConnection
*
* @param paramMap
* @return null only if paramMap is null
*/
public IMetadataConnection fillUIParams(Map<String, String> paramMap);
/**
*
* zshen Comment method "fillUIParams". convert a DatabaseConnection object to IMetadataConnection
*
* @deprecated
* @see {@link org.talend.core.model.metadata.builder.ConvertionHelper#fillUIParams(IMetadataConnection, DatabaseConnection)}
* @param conn
* @return null only if conn is null
*/
@Deprecated
public IMetadataConnection fillUIParams(DatabaseConnection conn);
/**
*
* zshen Comment method "fillUIConnParams".
*
* @param metadataBean sotre information of the connection which you will get.
* @param connection which you want to be fill Connection.
* @return connection which have be fill by the information store on the metadataBean.null when the information is
* not right or the parameter of connection is null;
*/
public T fillUIConnParams(IMetadataConnection metadataBean, T connection);
/**
*
* DOC zshen Comment method "fillCatalogs".
*
* @param dbConn the connection which you want schema to be filled.Can't be null if need to fill the catalogs into
* the object of connection. And if Linked is false everything is ok.
* @param dbJDBCMetadata If it is null the method will do nothing and return null too.
* @param catalogFilter The list for filter catalogs which you want get.If it is null all of catalogs which belong
* to the connection will be return.
* @return The list of catalogs after filter.Will return null only if dbJDBCMetadata isn't normal.
*/
public List<Catalog> fillCatalogs(T dbConn, DatabaseMetaData dbJDBCMetadata, List<String> catalogFilter);
public List<Catalog> fillCatalogs(T dbConn, DatabaseMetaData dbJDBCMetadata, IMetadataConnection metaConnection,
List<String> catalogFilter);
/**
*
* zshen Comment method "fillSchemas".
*
* @param dbConn the connection which you want schema to be filled.Can't be null if need to fill the schemas into
* the object of connection.And if Linked is false everything is ok.
* @param dbJDBCMetadata If it is null the method will do nothing and return null too.
* @param Filter The list for filter schemas which you want to get.If it is null all of schenas which belong to the
* connection will be return.
* @return The list of schemas after filter.Will return null only if dbJDBCMetadata isn't normal.
*/
public List<Package> fillSchemas(T dbConn, DatabaseMetaData dbJDBCMetadata, List<String> Filter);
public List<Package> fillSchemas(T dbConn, DatabaseMetaData dbJDBCMetadata, IMetadataConnection metaConnection,
List<String> Filter);
/**
* wzhang Comment method "fillAll".
*
* @param pack the object(catalog or schema) which you want tables to be filled.Can't be null if need to fill the
* tables into the object of package(catalog or schema).And if Linked is false everything is ok.
*
* @param dbJDBCMetadata If it is null the method will do nothing and return null too.
*
* @param tableFilter The list for filter tables which you want to get.If it is null all of tables which belong to
* the package will be return.
*
* @param tablePattern another method to filter the tables.the table will be keep if it's name match to the
* tablePattern.And if you don't want to use it null is ok.
*
* @param tableType the type of Table which you want to fill.It should be the one of TableType enum.
*
* @return The list of tables/views/sysnonyms after filter.Will return null only if dbJDBCMetadata isn't normal.
*/
public List<MetadataTable> fillAll(Package pack, DatabaseMetaData dbJDBCMetadata, List<String> tableFilter,
String tablePattern, String[] tableType);
public List<MetadataTable> fillAll(Package pack, DatabaseMetaData dbJDBCMetadata, IMetadataConnection metaConnection,
List<String> tableFilter, String tablePattern, String[] tableType);
/**
*
/**
*
* zshen Comment method "fillTables".
*
* @param pack the object(catalog or schema) which you want tables to be filled.Can't be null if need to fill the
* tables into the object of package(catalog or schema).And if Linked is false everything is ok.
* @param dbJDBCMetadata If it is null the method will do nothing and return null too.
* @param tableFilter The list for filter tables which you want to get.If it is null all of tables which belong to
* the package will be return.
* @param tablePattern another method to filter the tables.the table will be keep if it's name match to the
* tablePattern.And if you don't want to use it null is ok.
* @param tableType the type of Table which you want to fill.It should be the one of TableType enum.
* @return The list of tables after filter.Will return null only if dbJDBCMetadata isn't normal.
*/
public List<TdTable> fillTables(Package pack, DatabaseMetaData dbJDBCMetadata, List<String> tableFilter, String tablePattern,
String[] tableType);
/**
*
* zshen Comment method "fillViews".
*
* @param pack the object(catalog or schema) which you want views to be filled.Can't be null if need to fill the
* views into the object of package(catalog or schema).And if Linked is false everything is ok.
* @param dbJDBCMetadata If it is null the method will do nothing and return null too.
* @param viewFilter The list for filter views which you want to get.If it is null all of views which belong to the
* package will be return.
* @param another method to filter the views.the table will be keep if it's name match to the viewFilter. And if you
* don't want to use it null is ok.
* @return The list of views after filter.Will return null only if dbJDBCMetadata isn't normal.
*/
public List<TdView> fillViews(Package pack, DatabaseMetaData dbJDBCMetadata, List<String> viewFilter, String viewPattern,
String[] tableType);
/**
*
* zshen Comment method "fillColumns".
*
* @param colSet the object(tdView or tdTable) which you want columns to be filled.Can't be null if need to fill the
* views into the object of package(tdView or tdTable).
* @param dbJDBCMetadata If it is null the method will do nothing and return null too.
* @param columnFilter list for filter columns which you want to get.If it is null all of columns which belong to
* the MetadataTable will be return.
* @param columnPattern another method to filter the columns.the column will be keep if it's name match to the
* columnPattern. And if you don't want to use it null is ok.
* @return The list of column after filter.Will return null only if dbJDBCMetadata isn't normal.
*/
public List<TdColumn> fillColumns(ColumnSet colSet, DatabaseMetaData dbJDBCMetadata, List<String> columnFilter,
String columnPattern);
public List<TdColumn> fillColumns(ColumnSet colSet, IMetadataConnection iMetadataConnection, DatabaseMetaData dbJDBCMetadata,
List<String> columnFilter, String columnPattern);
/**
*
* zshen Comment method "isLinked".
*
* @return get whether the subElements need to be linked to the parent element.
*/
public boolean isLinked();
/**
*
* zshen Comment method "isLinked". set whether the subElements need to be linked to the parent element.
*
* @return
*/
public void setLinked(boolean isLinked);
/**
* this is used to check a Connection and at last the connection will be closed at once.
*
* @param metadataBean
* @return
*/
public ReturnCode checkConnection(IMetadataConnection metadataBean);
/**
* this is used to create a Connection and the connection will be not closed.
*
* @param metadataBean
* @return
*/
public TypedReturnCode<?> createConnection(IMetadataConnection metadataBean);
/**
*
* DOC mzhao Fill catalog with schema children.
*
* @param dbConn
* @param dbJDBCMetadata
* @param catalog
* @param schemaFilter
* @return
* @throws Throwable
*
*/
public List<Schema> fillSchemaToCatalog(T dbConn, DatabaseMetaData dbJDBCMetadata, Catalog catalog, List<String> schemaFilter)
throws Throwable;
}
|
924002c692d9148e11c4458849e0fb912ea5ee18
| 3,927 |
java
|
Java
|
src/main/java/com/ideastormsoftware/cvutils/ui/RenderPane.java
|
ideastorm/CvUtils
|
0f069f7c7ab07bb63c474ee9359009da21700067
|
[
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null |
src/main/java/com/ideastormsoftware/cvutils/ui/RenderPane.java
|
ideastorm/CvUtils
|
0f069f7c7ab07bb63c474ee9359009da21700067
|
[
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null |
src/main/java/com/ideastormsoftware/cvutils/ui/RenderPane.java
|
ideastorm/CvUtils
|
0f069f7c7ab07bb63c474ee9359009da21700067
|
[
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | 37.769231 | 99 | 0.595978 | 1,001,371 |
/*
* Copyright 2015 Phillip Hayward <[email protected]>.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ideastormsoftware.cvutils.ui;
import com.ideastormsoftware.cvutils.sources.ScaledSource;
import com.ideastormsoftware.cvutils.util.ImageUtils;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.HeadlessException;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;
import javax.swing.Timer;
import javax.swing.border.Border;
public class RenderPane extends JPanel {
private final Timer timer;
private final Object imageLock = new Object();
private BufferedImage nextImage;
private static void log(String format, Object... params) {
System.out.printf(format+"\n", params);
}
public RenderPane(ScaledSource source) throws HeadlessException {
setBackground(Color.black);
setSize(320, 240);
setDoubleBuffered(false);
this.timer = new Timer(1000 / 40, (ActionEvent ae) -> {
long runStart = System.nanoTime();
BufferedImage image = source.getCurrentImage(new Dimension(getWidth(), getHeight()));
long getScaledImageTime = System.nanoTime();
Border border = getBorder();
if (border != null) {
int w = getWidth();
int h = getHeight();
// BufferedImage workImage = new BufferedImage(w, h, BufferedImage.TYPE_3BYTE_BGR);
// Graphics2D grphcs = workImage.createGraphics();
Graphics2D grphcs = image.createGraphics();
border.paintBorder(this, grphcs, 0, 0, w, h);
// Insets borderInsets = border.getBorderInsets(this);
// w -= borderInsets.left + borderInsets.right;
// h -= borderInsets.top + borderInsets.bottom;
// grphcs.translate(borderInsets.left, borderInsets.top);
//
// if (w < 1 || h < 1) {
// return;
// }
//
// ImageUtils.drawAspectScaled(grphcs, image, w, h);
// image = workImage;
}
long prepBorderTime = System.nanoTime();
synchronized (imageLock) {
nextImage = image;
}
long setImageTime = System.nanoTime();
repaint(1);
Toolkit.getDefaultToolkit().sync();
long syncTime = System.nanoTime();
if (syncTime - runStart > 30_000_000)
log("image: %01.2f, border: %01.2f, setImage: %01.2f, sync: %01.2f, total: %01.2f",
(getScaledImageTime - runStart)/1_000_000f,
(prepBorderTime - getScaledImageTime)/1_000_000f,
(setImageTime - prepBorderTime)/1_000_000f,
(syncTime - setImageTime)/1_000_000f,
(syncTime - runStart)/1_000_000f);
});
timer.start();
}
@Override
public void paint(Graphics grphcs) {
BufferedImage img;
synchronized (imageLock) {
img = nextImage;
}
if (img != null) {
grphcs.drawImage(img, 0, 0, this);
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.