blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 390 | content_id stringlengths 40 40 | detected_licenses listlengths 0 35 | license_type stringclasses 2 values | repo_name stringlengths 6 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 539 values | visit_date timestamp[us]date 2016-08-02 21:09:20 2023-09-06 10:10:07 | revision_date timestamp[us]date 1990-01-30 01:55:47 2023-09-05 21:45:37 | committer_date timestamp[us]date 2003-07-12 18:48:29 2023-09-05 21:45:37 | github_id int64 7.28k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 13 values | gha_event_created_at timestamp[us]date 2012-06-11 04:05:37 2023-09-14 21:59:18 ⌀ | gha_created_at timestamp[us]date 2008-05-22 07:58:19 2023-08-28 02:39:21 ⌀ | gha_language stringclasses 62 values | src_encoding stringclasses 26 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 128 12.8k | extension stringclasses 11 values | content stringlengths 128 8.19k | authors listlengths 1 1 | author_id stringlengths 1 79 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b42e5a68a8993945f5ef0beb6ab50d909b1ec420 | 5e2e7d1eeea189b2b42708b4c82756f4757ae95b | /sjxgshop/app/src/main/java/com/zjhj/sjxgshop/util/LocationUtil.java | 16531b0c6db05ce897458c3e463c542468c7a376 | [] | no_license | xiaoxiongmeipigu/sjxgshop | 3ff4ad587ed4c4bc2309681e4986b13ea57f2c55 | 51645fb4057d519b588863c80452aafa64ccac0b | refs/heads/master | 2021-01-15T21:25:24.997861 | 2017-08-10T03:14:40 | 2017-08-10T03:14:40 | 99,867,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,959 | java | package com.zjhj.sjxgshop.util;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.location.LocationManager;
import android.net.Uri;
/**
* Created by brain on 2017/7/15.
*/
public class LocationUtil {
private Context context;
public LocationUtil(Context context) {
super();
this.context = context;
}
/**
* 判断GPS是否开启,GPS或者AGPS开启一个就认为是开启的
* @param context
* @return true 表示开启
*/
public static boolean isOPen(final Context context) {
LocationManager locationManager
= (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
// 通过GPS卫星定位,定位级别可以精确到街(通过24颗卫星定位,在室外和空旷的地方定位准确、速度快)
boolean gps = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
// 通过WLAN或移动网络(3G/2G)确定的位置(也称作AGPS,辅助GPS定位。主要用于在室内或遮盖物(建筑群或茂密的深林等)密集的地方定位)
boolean network = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
if (gps || network) {
return true;
}
return false;
}
/**
* 强制帮用户打开GPS 行不通
* @param context
*/
public static void openGPS(Context context) {
Intent GPSIntent = new Intent();
GPSIntent.setClassName("com.android.settings",
"com.android.settings.widget.SettingsAppWidgetProvider");
GPSIntent.addCategory("android.intent.category.ALTERNATIVE");
GPSIntent.setData(Uri.parse("custom:3"));
try {
PendingIntent.getBroadcast(context, 0, GPSIntent, 0).send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
}
| [
"zouwei_13146216093@163.com"
] | zouwei_13146216093@163.com |
0856f03cba117478f0a3e8879aa10807e369e887 | 0e06e096a9f95ab094b8078ea2cd310759af008b | /classes35-dex2jar/com/google/android/gms/internal/drive/zzfy.java | da1b1730273715b2a84beea913c57f402e5262a6 | [] | no_license | Manifold0/adcom_decompile | 4bc2907a057c73703cf141dc0749ed4c014ebe55 | fce3d59b59480abe91f90ba05b0df4eaadd849f7 | refs/heads/master | 2020-05-21T02:01:59.787840 | 2019-05-10T00:36:27 | 2019-05-10T00:36:27 | 185,856,424 | 1 | 2 | null | 2019-05-10T00:36:28 | 2019-05-09T19:04:28 | Java | UTF-8 | Java | false | false | 317 | java | //
// Decompiled by Procyon v0.5.34
//
package com.google.android.gms.internal.drive;
import java.util.List;
import com.google.android.gms.common.internal.safeparcel.SafeParcelReader;
import android.os.Parcel;
import android.os.Parcelable$Creator;
public final class zzfy implements Parcelable$Creator<zzfx>
{
}
| [
"querky1231@gmail.com"
] | querky1231@gmail.com |
11f92bac4bba0a3fe411e02c5bf0cce4e8a2c628 | 8a98577c5995449677ede2cbe1cc408c324efacc | /Big_Clone_Bench_files_used/bcb_reduced/3/selected/708789.java | 7b064fad7298a2e9d33a407cafe837bc8a07291c | [
"MIT"
] | permissive | pombredanne/lsh-for-source-code | 9363cc0c9a8ddf16550ae4764859fa60186351dd | fac9adfbd98a4d73122a8fc1a0e0cc4f45e9dcd4 | refs/heads/master | 2020-08-05T02:28:55.370949 | 2017-10-18T23:57:08 | 2017-10-18T23:57:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,308 | java | package jonelo.jacksum.adapt.gnu.crypto.hash;
import jonelo.jacksum.adapt.gnu.crypto.Registry;
import jonelo.jacksum.adapt.gnu.crypto.util.Util;
/**
* <p>RIPEMD-160 is a 160-bit message digest.</p>
*
* <p>References:</p>
*
* <ol>
* <li><a href="http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html">
* RIPEMD160</a>: A Strengthened Version of RIPEMD.<br>
* Hans Dobbertin, Antoon Bosselaers and Bart Preneel.</li>
* </ol>
*
* @version $Revision: 1.7 $
*/
public class RipeMD160 extends BaseHash {
private static final int BLOCK_SIZE = 64;
private static final String DIGEST0 = "9C1185A5C5E9FC54612808977EE8F548B2258D31";
private static final int[] R = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 };
private static final int[] Rp = { 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 };
private static final int[] S = { 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 };
private static final int[] Sp = { 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 };
/** caches the result of the correctness test, once executed. */
private static Boolean valid;
/** 160-bit h0, h1, h2, h3, h4 (interim result) */
private int h0, h1, h2, h3, h4;
/** 512 bits work buffer = 16 x 32-bit words */
private int[] X = new int[16];
/** Trivial 0-arguments constructor. */
public RipeMD160() {
super(Registry.RIPEMD160_HASH, 20, BLOCK_SIZE);
}
/**
* <p>Private constructor for cloning purposes.</p>
*
* @param md the instance to clone.
*/
private RipeMD160(RipeMD160 md) {
this();
this.h0 = md.h0;
this.h1 = md.h1;
this.h2 = md.h2;
this.h3 = md.h3;
this.h4 = md.h4;
this.count = md.count;
this.buffer = (byte[]) md.buffer.clone();
}
public Object clone() {
return (new RipeMD160(this));
}
protected void transform(byte[] in, int offset) {
int A, B, C, D, E, Ap, Bp, Cp, Dp, Ep, T, s, i;
for (i = 0; i < 16; i++) {
X[i] = (in[offset++] & 0xFF) | (in[offset++] & 0xFF) << 8 | (in[offset++] & 0xFF) << 16 | in[offset++] << 24;
}
A = Ap = h0;
B = Bp = h1;
C = Cp = h2;
D = Dp = h3;
E = Ep = h4;
for (i = 0; i < 16; i++) {
s = S[i];
T = A + (B ^ C ^ D) + X[i];
A = E;
E = D;
D = C << 10 | C >>> 22;
C = B;
B = (T << s | T >>> (32 - s)) + A;
s = Sp[i];
T = Ap + (Bp ^ (Cp | ~Dp)) + X[Rp[i]] + 0x50A28BE6;
Ap = Ep;
Ep = Dp;
Dp = Cp << 10 | Cp >>> 22;
Cp = Bp;
Bp = (T << s | T >>> (32 - s)) + Ap;
}
for (; i < 32; i++) {
s = S[i];
T = A + ((B & C) | (~B & D)) + X[R[i]] + 0x5A827999;
A = E;
E = D;
D = C << 10 | C >>> 22;
C = B;
B = (T << s | T >>> (32 - s)) + A;
s = Sp[i];
T = Ap + ((Bp & Dp) | (Cp & ~Dp)) + X[Rp[i]] + 0x5C4DD124;
Ap = Ep;
Ep = Dp;
Dp = Cp << 10 | Cp >>> 22;
Cp = Bp;
Bp = (T << s | T >>> (32 - s)) + Ap;
}
for (; i < 48; i++) {
s = S[i];
T = A + ((B | ~C) ^ D) + X[R[i]] + 0x6ED9EBA1;
A = E;
E = D;
D = C << 10 | C >>> 22;
C = B;
B = (T << s | T >>> (32 - s)) + A;
s = Sp[i];
T = Ap + ((Bp | ~Cp) ^ Dp) + X[Rp[i]] + 0x6D703EF3;
Ap = Ep;
Ep = Dp;
Dp = Cp << 10 | Cp >>> 22;
Cp = Bp;
Bp = (T << s | T >>> (32 - s)) + Ap;
}
for (; i < 64; i++) {
s = S[i];
T = A + ((B & D) | (C & ~D)) + X[R[i]] + 0x8F1BBCDC;
A = E;
E = D;
D = C << 10 | C >>> 22;
C = B;
B = (T << s | T >>> (32 - s)) + A;
s = Sp[i];
T = Ap + ((Bp & Cp) | (~Bp & Dp)) + X[Rp[i]] + 0x7A6D76E9;
Ap = Ep;
Ep = Dp;
Dp = Cp << 10 | Cp >>> 22;
Cp = Bp;
Bp = (T << s | T >>> (32 - s)) + Ap;
}
for (; i < 80; i++) {
s = S[i];
T = A + (B ^ (C | ~D)) + X[R[i]] + 0xA953FD4E;
A = E;
E = D;
D = C << 10 | C >>> 22;
C = B;
B = (T << s | T >>> (32 - s)) + A;
s = Sp[i];
T = Ap + (Bp ^ Cp ^ Dp) + X[Rp[i]];
Ap = Ep;
Ep = Dp;
Dp = Cp << 10 | Cp >>> 22;
Cp = Bp;
Bp = (T << s | T >>> (32 - s)) + Ap;
}
T = h1 + C + Dp;
h1 = h2 + D + Ep;
h2 = h3 + E + Ap;
h3 = h4 + A + Bp;
h4 = h0 + B + Cp;
h0 = T;
}
protected byte[] padBuffer() {
int n = (int) (count % BLOCK_SIZE);
int padding = (n < 56) ? (56 - n) : (120 - n);
byte[] result = new byte[padding + 8];
result[0] = (byte) 0x80;
long bits = count << 3;
result[padding++] = (byte) bits;
result[padding++] = (byte) (bits >>> 8);
result[padding++] = (byte) (bits >>> 16);
result[padding++] = (byte) (bits >>> 24);
result[padding++] = (byte) (bits >>> 32);
result[padding++] = (byte) (bits >>> 40);
result[padding++] = (byte) (bits >>> 48);
result[padding] = (byte) (bits >>> 56);
return result;
}
protected byte[] getResult() {
byte[] result = new byte[] { (byte) h0, (byte) (h0 >>> 8), (byte) (h0 >>> 16), (byte) (h0 >>> 24), (byte) h1, (byte) (h1 >>> 8), (byte) (h1 >>> 16), (byte) (h1 >>> 24), (byte) h2, (byte) (h2 >>> 8), (byte) (h2 >>> 16), (byte) (h2 >>> 24), (byte) h3, (byte) (h3 >>> 8), (byte) (h3 >>> 16), (byte) (h3 >>> 24), (byte) h4, (byte) (h4 >>> 8), (byte) (h4 >>> 16), (byte) (h4 >>> 24) };
return result;
}
protected void resetContext() {
h0 = 0x67452301;
h1 = 0xEFCDAB89;
h2 = 0x98BADCFE;
h3 = 0x10325476;
h4 = 0xC3D2E1F0;
}
public boolean selfTest() {
if (valid == null) {
valid = new Boolean(DIGEST0.equals(Util.toString(new RipeMD160().digest())));
}
return valid.booleanValue();
}
}
| [
"nishima@mymail.vcu.edu"
] | nishima@mymail.vcu.edu |
90fd33265efcebdc5055ba3451f51932f4cf650f | 7085f39201ba756b3b3dbe3ee90f6e369d498f78 | /quickstart-hutool/src/test/java/org/quickstart/hutool/HutoolTest.java | ebdc2b0e671b698a585624359c5d047410ecebf7 | [
"Apache-2.0"
] | permissive | chenglinjava68/quickstart-framework | a11a297d86bc7f7b19c29aaed5e7c6019f2f2a55 | d8aa246c8704ed03b44cc4c09a72972d9f437471 | refs/heads/master | 2022-12-08T07:06:08.285226 | 2020-09-02T01:43:12 | 2020-09-02T01:43:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,015 | java | package org.quickstart.hutool;
import cn.hutool.cron.CronUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.HtmlUtil;
import org.junit.Test;
/**
* @author youngzil@163.com
* @description TODO
* @createTime 2020/5/1 17:42
*/
public class HutoolTest {
@Test
public void testSecureUtil(){
System.out.println(SecureUtil.md5("loginPwd"));
}
@Test
public void testHtmlUtil(){
/*HtmlUtil.restoreEscaped 还原被转义的HTML特殊字符
HtmlUtil.encode 转义文本中的HTML字符为安全的字符
HtmlUtil.cleanHtmlTag 清除所有HTML标签
HtmlUtil.removeHtmlTag 清除指定HTML标签和被标签包围的内容
HtmlUtil.unwrapHtmlTag 清除指定HTML标签,不包括内容
HtmlUtil.removeHtmlAttr 去除HTML标签中的属性
HtmlUtil.removeAllHtmlAttr 去除指定标签的所有属性
HtmlUtil.filter 过滤HTML文本,防止XSS攻击
CronUtil(定时任务)*/
}
}
| [
"youngzil@163.com"
] | youngzil@163.com |
4376f50651e816a68101dceac5cb9c264d3d64b2 | a8535ca60ae5f0766f54c70cd15b3e0ce4a80b89 | /copy_from_isstac/jpf-security/src/main/edu/cmu/sv/isstac/sampling/structure/NodeFactory.java | 095d5053ff9dcf996d8aedcfe29a621c00e83b02 | [] | no_license | MateusAraujoBorges/bvcount | aa8eb91c806448a931a2d89f0aea6dd267bd640c | 386e10b50016452992bb9745eb1d0c715856aab2 | refs/heads/master | 2022-01-18T00:50:16.346952 | 2021-12-26T23:44:40 | 2021-12-26T23:44:40 | 60,693,589 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | package edu.cmu.sv.isstac.sampling.structure;
import java.util.logging.Logger;
import gov.nasa.jpf.symbc.numeric.PCChoiceGenerator;
import gov.nasa.jpf.util.JPFLogger;
import gov.nasa.jpf.vm.ChoiceGenerator;
import gov.nasa.jpf.vm.choice.ThreadChoiceFromSet;
/**
* @author Kasper Luckow
*
*/
public interface NodeFactory {
public Node create(Node parent, ChoiceGenerator<?> currentCG, int choice);
public boolean isSupportedChoiceGenerator(ChoiceGenerator<?> cg);
}
| [
"corina.s.pasareanu@nasa.gov"
] | corina.s.pasareanu@nasa.gov |
5401f42876ba320398f50742289f3530ec7828b7 | b39d7e1122ebe92759e86421bbcd0ad009eed1db | /sources/android/os/TestLooperManager.java | 28c270e6deff6abf8fbafaed6b762591596a314e | [] | no_license | AndSource/miuiframework | ac7185dedbabd5f619a4f8fc39bfe634d101dcef | cd456214274c046663aefce4d282bea0151f1f89 | refs/heads/master | 2022-03-31T11:09:50.399520 | 2020-01-02T09:49:07 | 2020-01-02T09:49:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,350 | java | package android.os;
import android.util.ArraySet;
import java.util.concurrent.LinkedBlockingQueue;
public class TestLooperManager {
private static final ArraySet<Looper> sHeldLoopers = new ArraySet();
private final LinkedBlockingQueue<MessageExecution> mExecuteQueue = new LinkedBlockingQueue();
private final Looper mLooper;
private boolean mLooperBlocked;
private final MessageQueue mQueue;
private boolean mReleased;
private class LooperHolder implements Runnable {
private LooperHolder() {
}
public void run() {
synchronized (TestLooperManager.this) {
TestLooperManager.this.mLooperBlocked = true;
TestLooperManager.this.notify();
}
while (!TestLooperManager.this.mReleased) {
try {
MessageExecution take = (MessageExecution) TestLooperManager.this.mExecuteQueue.take();
if (take.m != null) {
processMessage(take);
}
} catch (InterruptedException e) {
}
}
synchronized (TestLooperManager.this) {
TestLooperManager.this.mLooperBlocked = false;
}
}
private void processMessage(MessageExecution mex) {
synchronized (mex) {
try {
mex.m.target.dispatchMessage(mex.m);
mex.response = null;
} catch (Throwable t) {
mex.response = t;
}
mex.notifyAll();
}
}
}
private static class MessageExecution {
private Message m;
private Throwable response;
private MessageExecution() {
}
}
public TestLooperManager(Looper looper) {
synchronized (sHeldLoopers) {
if (sHeldLoopers.contains(looper)) {
throw new RuntimeException("TestLooperManager already held for this looper");
}
sHeldLoopers.add(looper);
}
this.mLooper = looper;
this.mQueue = this.mLooper.getQueue();
new Handler(looper).post(new LooperHolder());
}
public MessageQueue getMessageQueue() {
checkReleased();
return this.mQueue;
}
@Deprecated
public MessageQueue getQueue() {
return getMessageQueue();
}
public Message next() {
while (!this.mLooperBlocked) {
synchronized (this) {
try {
wait();
} catch (InterruptedException e) {
}
}
}
checkReleased();
return this.mQueue.next();
}
public void release() {
synchronized (sHeldLoopers) {
sHeldLoopers.remove(this.mLooper);
}
checkReleased();
this.mReleased = true;
this.mExecuteQueue.add(new MessageExecution());
}
public void execute(Message message) {
checkReleased();
if (Looper.myLooper() == this.mLooper) {
message.target.dispatchMessage(message);
return;
}
MessageExecution execution = new MessageExecution();
execution.m = message;
synchronized (execution) {
this.mExecuteQueue.add(execution);
try {
execution.wait();
} catch (InterruptedException e) {
}
if (execution.response == null) {
} else {
throw new RuntimeException(execution.response);
}
}
}
public void recycle(Message msg) {
checkReleased();
msg.recycleUnchecked();
}
public boolean hasMessages(Handler h, Object object, int what) {
checkReleased();
return this.mQueue.hasMessages(h, what, object);
}
public boolean hasMessages(Handler h, Object object, Runnable r) {
checkReleased();
return this.mQueue.hasMessages(h, r, object);
}
private void checkReleased() {
if (this.mReleased) {
throw new RuntimeException("release() has already be called");
}
}
}
| [
"shivatejapeddi@gmail.com"
] | shivatejapeddi@gmail.com |
028dfa9ad9803789e78a9f240fe6cf5578223abb | f84c8f032925bc70ed9f50dd99c22e82e9edb19a | /Week_4/Demo_SOLID/src/com/codegym/productsmanager/MyApp.java | 4a22899a6f6c0e2e638b487f0b13f238a41e746f | [] | no_license | maulong305/Module_2 | 36a063137037453b79f480d127ae7afb7233ca20 | 21f856ca99da2d80e85688cb4d4200a07afdde90 | refs/heads/master | 2022-11-19T01:17:07.885824 | 2020-07-15T13:26:34 | 2020-07-15T13:26:34 | 270,557,940 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package com.codegym.productsmanager;
public class MyApp {
public static void main(String[] args) {
TextFileExporter textFileExporter = new TextFileExporter();
ExcelFileExporter excelFileExporter = new ExcelFileExporter();
ProductManager productManager = new ProductManager();
productManager.saveFile(excelFileExporter, "data.txt");
}
}
| [
"maulong305@gmail.com"
] | maulong305@gmail.com |
ab3952b4c25fafccdaf160a02252edc773cef495 | b15dc9ee1ec86edef1cacfdcb5e8563de7772db9 | /app/src/main/java/com/hj/casps/util/MathUtil.java | 129ecbc4f89114801d6cd4ae2c44bcb167699b15 | [] | no_license | zdd0604/HjCpas | db65c769d37a7ca4feee87bc78f4096b5c111f12 | ad6e5ed38b70007dd5e9b0446c6bf307389c935f | refs/heads/master | 2021-05-15T13:26:53.749496 | 2017-07-17T08:20:52 | 2017-07-17T08:20:52 | 107,100,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,492 | java | package com.hj.casps.util;
import java.math.BigDecimal;
/**
* Created by zzq on 2016/9/7.
*/
public class MathUtil {
public static double add(double d1, double d2) { // 进行加法运算
BigDecimal b1 = new BigDecimal(d1);
BigDecimal b2 = new BigDecimal(d2);
return b1.add(b2).doubleValue();
}
public static double sub(double d1, double d2) { // 进行减法运算
BigDecimal b1 = new BigDecimal(d1);
BigDecimal b2 = new BigDecimal(d2);
return b1.subtract(b2).doubleValue();
}
public static double mul(double d1, double d2) { // 进行乘法运算
BigDecimal b1 = new BigDecimal(d1);
BigDecimal b2 = new BigDecimal(d2);
return b1.multiply(b2).doubleValue();
}
public static double div(double d1, double d2, int len) {// 进行除法运算
BigDecimal b1 = new BigDecimal(d1);
BigDecimal b2 = new BigDecimal(d2);
return b1.divide(b2, len, BigDecimal.
ROUND_HALF_UP).doubleValue();
}
public static double round(double d, int len) { // 进行四舍五入操作
BigDecimal b1 = new BigDecimal(d);
BigDecimal b2 = new BigDecimal(1);
// 任何一个数字除以1都是原数字
// ROUND_HALF_UP是BigDecimal的一个常量,表示进行四舍五入的操作
return b1.divide(b2, len, BigDecimal.ROUND_HALF_UP).doubleValue();
}
}
| [
"mr_zdd@163.com"
] | mr_zdd@163.com |
0b677b40b457ac65970dc591044ee62d5b555523 | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/plugin/hardcoder/PluginHardcoder$2$1.java | f79a4e614844a05d2ddd37163bb148a7b1e03e04 | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 589 | java | package com.tencent.mm.plugin.hardcoder;
import com.tencent.matrix.trace.core.AppMethodBeat;
final class PluginHardcoder$2$1
implements Runnable
{
PluginHardcoder$2$1(PluginHardcoder.2 param2)
{
}
public final void run()
{
AppMethodBeat.i(60250);
PluginHardcoder.access$000(this.nqn.nql);
AppMethodBeat.o(60250);
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes5-dex2jar.jar
* Qualified Name: com.tencent.mm.plugin.hardcoder.PluginHardcoder.2.1
* JD-Core Version: 0.6.2
*/ | [
"172601673@qq.com"
] | 172601673@qq.com |
ff6d522b1085fc0875a45b85e5d6314a2b446164 | 3328c43e0fc892cde9ff574c9af269fc61e86704 | /Aquilino/Practica3/src/figures/rectangle/Rectangle.java | 83446f17e8ad9ad1b2f090585438d732d7356e8d | [] | no_license | mistermboy/DS | 7ebcb8ce91e7d4ce292e3f24f1e233f28e9001ce | d1855cb2697373b0bd833d2db0e66edbc3e74404 | refs/heads/master | 2021-07-24T18:47:24.902711 | 2019-01-16T10:38:52 | 2019-01-16T10:38:52 | 103,942,125 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 887 | java | package figures.rectangle;
import java.awt.Point;
import editor.Figure;
public class Rectangle implements Figure {
private Point point;
private int ancho;
private int alto;
public Rectangle(Point point, int ancho, int alto) {
super();
this.point = point;
this.ancho = ancho;
this.alto = alto;
}
@Override
public void draw() {
if (point != null && ancho != 0 && alto != 0)
System.out.println(toString());
else
System.out.println("Cuadrado");
}
public String toString() {
return "Cuadrado: x = " + point.getX() + ", y = " + point.getY() + ", ancho = " + ancho + ", alto = " + alto;
}
@Override
public void move(int x, int y) {
point.translate(x, y);
}
@Override
public boolean isContent(int x, int y) {
return (point.x <= x && x <= point.x + ancho) && (point.y <= y && y <= point.y + alto);
}
}
| [
"pabloyo97@hotmail.com"
] | pabloyo97@hotmail.com |
ed13ac3c3fc312e65cded626902a914930eaa38f | 5b82e2f7c720c49dff236970aacd610e7c41a077 | /QueryReformulation-master 2/data/processed/AutoCompleteField.java | 093361d1a2ae1b4bc796080700043a7a91cc51c5 | [] | no_license | shy942/EGITrepoOnlineVersion | 4b157da0f76dc5bbf179437242d2224d782dd267 | f88fb20497dcc30ff1add5fe359cbca772142b09 | refs/heads/master | 2021-01-20T16:04:23.509863 | 2016-07-21T20:43:22 | 2016-07-21T20:43:22 | 63,737,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,789 | java | /***/
package org.eclipse.jface.fieldassist;
import org.eclipse.swt.widgets.Control;
/**
* AutoCompleteField is a class which attempts to auto-complete a user's
* keystrokes by activating a popup that filters a list of proposals according
* to the content typed by the user.
*
* @see ContentProposalAdapter
* @see SimpleContentProposalProvider
*
* @since 3.3
*/
public class AutoCompleteField {
private SimpleContentProposalProvider proposalProvider;
private ContentProposalAdapter adapter;
/**
* Construct an AutoComplete field on the specified control, whose
* completions are characterized by the specified array of Strings.
*
* @param control
* the control for which autocomplete is desired. May not be
* <code>null</code>.
* @param controlContentAdapter
* the <code>IControlContentAdapter</code> used to obtain and
* update the control's contents. May not be <code>null</code>.
* @param proposals
* the array of Strings representing valid content proposals for
* the field.
*/
public AutoCompleteField(Control control, IControlContentAdapter controlContentAdapter, String[] proposals) {
proposalProvider = new SimpleContentProposalProvider(proposals);
proposalProvider.setFiltering(true);
adapter = new ContentProposalAdapter(control, controlContentAdapter, proposalProvider, null, null);
adapter.setPropagateKeys(true);
adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
}
/**
* Set the Strings to be used as content proposals.
*
* @param proposals
* the array of Strings to be used as proposals.
*/
public void setProposals(String[] proposals) {
proposalProvider.setProposals(proposals);
}
}
| [
"muktacseku@gmail.com"
] | muktacseku@gmail.com |
c182a560f51c7ec2a3eb4f5de083800f66522615 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/27/27_8f2c24eda483a6a598940a13c60367adb927810f/Device/27_8f2c24eda483a6a598940a13c60367adb927810f_Device_t.java | 22adf1b32c8e273c86cd6b009a323c66d57ca8bd | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 7,239 | java | /*
* Copyright (c) 2012, Groupon, Inc.
* 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 GROUPON nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</div>
*/
package com.groupon.roboremote.roboremoteclient;
import com.google.common.io.Files;
import com.groupon.roboremote.roboremoteclient.logging.TestLogger;
import java.io.*;
/**
* This class defines general device/emulator commands
*/
public class Device {
static String app_package = null;
static String test_class = null;
static String test_runner = null;
static boolean emulator = false;
static String current_log_dir = null;
static AppThread ap = null;
public static boolean isEmulator() throws Exception {
return DebugBridge.get().isEmulator();
}
public static void setAppEnvironmentVariables(String appPackage, String testClass, String testRunner) {
app_package = appPackage;
test_class = testClass;
test_runner = testRunner;
}
public static void setAppEnvironmentVariables() throws Exception {
// get environment variables
app_package = Utils.getEnv("ROBO_APP_PACKAGE", app_package);
if (app_package == null) {
throw new Exception("ROBO_APP_PACKAGE is not set");
}
test_class = Utils.getEnv("ROBO_TEST_CLASS", test_class);
if (test_class == null) {
throw new Exception("ROBO_TEST_CLASS is not set");
}
test_runner = Utils.getEnv("ROBO_TEST_RUNNER", test_runner);
if (test_runner == null) {
throw new Exception("ROBO_TEST_RUNNER is not set");
}
}
public static void clearAppData() throws Exception {
// clear app data
DebugBridge.get().runShellCommand("pm clear " + app_package);
}
public static String getAppPackage() {
return app_package;
}
public static String getTestClass() {
return test_class;
}
public static String getTestRunner() {
return test_runner;
}
static void delete(File f) throws IOException {
if (f.isDirectory()) {
for (File c : f.listFiles())
delete(c);
}
if (!f.delete())
throw new FileNotFoundException("Failed to delete file: " + f);
}
public static void storeLogs() throws Exception {
// assumes eventmanager is running
// store logs
File tmpLogFile = new File(System.getProperty("java.io.tmpdir") + File.separator + "adb_robo.log");
File destFile = new File(current_log_dir + File.separator + "test.log");
Files.copy(tmpLogFile, destFile);
}
public static void storeFailurePng() throws Exception {
File failureFile = new File("FAILURE.png");
File destFile = new File(current_log_dir + File.separator + "FAILURE.png");
Files.copy(failureFile, destFile);
}
public static void setupLogDirectories() throws Exception {
String currentDir = new File("").getAbsolutePath();
// clear the final log directory
File log_dir = new File(currentDir + File.separator + "logs"
+ File.separator + Utils.getTestName() + File.separator + "test.log");
TestLogger.get().info("Log directory: {}", log_dir.getParent());
Files.createParentDirs(log_dir);
// clear existing files from this location
if (log_dir.exists()) {
delete(log_dir);
}
current_log_dir = log_dir.getParent();
}
public static void startApp() throws Exception {
ap = new AppThread();
ap.start();
for (int x = 0; x < 10; x++) {
// try to make a query.. if it doesnt work then sleep
TestLogger.get().info("Trying to ping test server..");
if (Client.isListening())
break;
if (x == 9)
throw new Exception("Could not contact test server");
Thread.sleep(5000);
}
}
public static void killApp() throws Exception {
// try to kill just by calling exit
try {
Client.map("java.lang.System", "exit", 0);
} catch (Exception e) {
// this will actually throw an exception since it doesnt get a response from this command
}
// shut down the thread
if (ap != null) {
ap.close();
ap.interrupt();
ap = null;
}
// wait for the server to be dead
for (int x = 0; x < 10; x++) {
// try to make a query.. if it doesnt work then sleep
TestLogger.get().info("Trying to see if server is still available..");
if (! Client.isListening())
break;
if (x == 9)
throw new Exception("Server is still available, but should not be");
Thread.sleep(2000);
}
}
/**
* This thread contains the running RC test
* DebugBridge does not return until the instrumentation finishes so we have to run it in its own thread
*/
private static class AppThread extends Thread {
DebugBridge.MultiReceiver _receiver = null;
public void run() {
_receiver = new DebugBridge.MultiReceiver();
try {
DebugBridge.get().runShellCommand("am instrument -e class " + Device.getTestClass() + " -w " + Device.getTestRunner(), _receiver, 0);
} catch (Exception e) {
}
}
public void close() {
// close the receiver to kill the thread
_receiver.close();
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
d1ade0a7c1eae7d5ca2db2dcaaf00f22a142c94c | e12442dded669c4c6ac7feedc92fab9e11608ee8 | /src/java/com/hzih/sslvpn/web/action/sslvpn/client/strategy/StrategyXMLUtils.java | e41d94c89c474ea306091f31b88c3a1c5d90c432 | [] | no_license | gholdzhang/sslvpn_check | e101a1e5bcc6b063d48228aa675bccf8472ed843 | 3ca0656920c9418d74e51814b3fb038389405f1f | refs/heads/master | 2023-03-16T21:28:29.267823 | 2016-04-16T03:15:14 | 2016-04-16T03:15:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,665 | java | package com.hzih.sslvpn.web.action.sslvpn.client.strategy;
import com.hzih.sslvpn.utils.StringContext;
import org.apache.log4j.Logger;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
import java.io.*;
public class StrategyXMLUtils {
private static Logger logger = Logger.getLogger(StrategyXMLUtils.class);
public static final String root = "strategy";
public static final String gprs = "gprs";
public static final String wifi = "wifi";
public static final String bluetooth = "bluetooth";
public static final String gps = "gps";
public static final String gps_interval = "gps_interval";
public static final String view = "view";
public static final String view_interval = "view_interval";
public static final String terminal = "terminal";
public static final String terminal_interval = "terminal_interval";
public static final String strategy_interval = "strategy_interval";
public static final String threeyards = "threeyards";
public static final String charset = "utf-8";
/**
* @param name
* @return
*/
public static String getValue(String name) {
SAXReader saxReader = new SAXReader();
Document doc = null;
String result = null;
try {
doc = saxReader.read(new File(StringContext.strategy_xml));
} catch (DocumentException e) {
logger.error(e.getMessage(),e);
}
if(doc!=null){
Element ldap = doc.getRootElement();
Element el = ldap.element(name);
result = el.getText();
}
return result;
}
/**
*
* @param gps
* @param gps_interval
* @param view
* @param view_interval
* @return
*/
public static boolean save(String gps, String gps_interval,
String view, String view_interval,
String terminal,String terminal_interval,String threeyards,String strategy_interval,
String gprs,String wifi,String bluetooth) {
boolean flag = false;
Document doc = DocumentHelper.createDocument();
Element root = doc.addElement(StrategyXMLUtils.root);
Element gps_el = root.addElement(StrategyXMLUtils.gps);
gps_el.addText(gps);
Element gprs_el = root.addElement(StrategyXMLUtils.gprs);
gprs_el.addText(gprs);
Element wifi_el = root.addElement(StrategyXMLUtils.wifi);
wifi_el.addText(wifi);
Element bluetooth_el = root.addElement(StrategyXMLUtils.bluetooth);
bluetooth_el.addText(bluetooth);
Element gps_interval_el = root.addElement(StrategyXMLUtils.gps_interval);
gps_interval_el.addText(gps_interval);
Element view_el = root.addElement(StrategyXMLUtils.view);
view_el.addText(view);
Element view_interval_el = root.addElement(StrategyXMLUtils.view_interval);
view_interval_el.addText(view_interval);
Element terminal_el = root.addElement(StrategyXMLUtils.terminal);
terminal_el.addText(terminal);
Element terminal_interval_el = root.addElement(StrategyXMLUtils.terminal_interval);
terminal_interval_el.addText(terminal_interval);
Element threeyards_el = root.addElement(StrategyXMLUtils.threeyards);
threeyards_el.addText(threeyards);
Element strategy_interval_el = root.addElement(StrategyXMLUtils.strategy_interval);
strategy_interval_el.addText(strategy_interval);
OutputFormat format = OutputFormat.createPrettyPrint();
format.setEncoding(charset);
format.setIndent(true);
try {
XMLWriter xmlWriter = new XMLWriter(new FileOutputStream(new File(StringContext.strategy_xml)), format);
try {
xmlWriter.write(doc);
flag = true;
} catch (IOException e) {
logger.error(e.getMessage(), e);
} finally {
try {
xmlWriter.flush();
xmlWriter.close();
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
} catch (UnsupportedEncodingException e) {
logger.error(e.getMessage(), e);
} catch (FileNotFoundException e) {
logger.error(e.getMessage(),e);
}
return flag;
}
}
| [
"465805947@QQ.com"
] | 465805947@QQ.com |
1b28f246a9433f7f6e925d877ce5d4baddb9c39a | 379356a240c2ae93018c40807f770f1b8f0aa339 | /JavaEE/listenerProject/src/cn/yiran/web/listener/Listener.java | 2cb7bbca0827441f856bd636d32878972aa60935 | [] | no_license | luqufei456/java | e2260810119cf2d416c4ecc4d4a0104c7ad26f2c | dc62f66a606339252f804138d53b1c1b02c2971d | refs/heads/master | 2022-12-21T10:59:01.305681 | 2019-07-10T13:51:59 | 2019-07-10T13:51:59 | 129,725,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,304 | java | package cn.yiran.web.listener;
import javax.servlet.*;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.*;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
@WebListener()
public class Listener implements ServletContextListener,
HttpSessionListener, HttpSessionAttributeListener,ServletRequestListener {
// Public constructor is required by servlet spec
public Listener() {
}
// -------------------------------------------------------
// ServletContextListener implementation
// -------------------------------------------------------
public void contextInitialized(ServletContextEvent sce) {
System.out.println("context监听器启动了");
ServletContext context = sce.getServletContext();
// 第一题和第二题
/*context.setAttribute("callNum",new AtomicInteger(0));
context.setAttribute("onlineNum",new AtomicInteger(0));*/
context.setAttribute("touristNum", new ArrayList<HttpSession>());
context.setAttribute("userNum", new ArrayList<HttpSession>());
}
public void contextDestroyed(ServletContextEvent sce) {
/* This method is invoked when the Servlet Context
(the Web application) is undeployed or
Application Server shuts down.
*/
}
// -------------------------------------------------------
// HttpSessionListener implementation
// -------------------------------------------------------
public void sessionCreated(HttpSessionEvent se) {
/* Session is created. */
System.out.println("session创建");
// 第二题
/*ServletContext context = se.getSession().getServletContext();
AtomicInteger count = (AtomicInteger)context.getAttribute("onlineNum");
// 相当于count++;
count.getAndIncrement();
// AtomicInteger 线程安全的Integer
context.setAttribute("onlineNum",count);*/
ServletContext context = se.getSession().getServletContext();
HttpSession session = se.getSession();
List list = (List) context.getAttribute("touristNum");
list.add(session);
context.setAttribute("touristNum",list);
}
public void sessionDestroyed(HttpSessionEvent se) {
System.out.println("session销毁");
// 第二题
/*ServletContext context = se.getSession().getServletContext();
AtomicInteger count = (AtomicInteger)context.getAttribute("onlineNum");
// 相当于count--;
count.getAndDecrement();
// AtomicInteger 线程安全的Integer
context.setAttribute("onlineNum",count);*/
ServletContext context = se.getSession().getServletContext();
HttpSession session = se.getSession();
List tList = (List) context.getAttribute("touristNum");
List oList = (List) context.getAttribute("userNum");
if (tList.indexOf(session) == -1){
oList.remove(session);
}
else{
tList.remove(session);
}
}
// -------------------------------------------------------
// HttpSessionAttributeListener implementation
// -------------------------------------------------------
public void attributeAdded(HttpSessionBindingEvent sbe) {
/* This method is called when an attribute
is added to a session.
*/
}
public void attributeRemoved(HttpSessionBindingEvent sbe) {
/* This method is called when an attribute
is removed from a session.
*/
}
public void attributeReplaced(HttpSessionBindingEvent sbe) {
/* This method is invoked when an attibute
is replaced in a session.
*/
}
@Override
public void requestDestroyed(ServletRequestEvent sre) {
System.out.println("request关闭");
}
@Override
public void requestInitialized(ServletRequestEvent sre) {
System.out.println("request开启");
// 第一题
/*ServletContext context = sre.getServletContext();
AtomicInteger count = (AtomicInteger)context.getAttribute("callNum");
count.getAndIncrement();
// AtomicInteger 线程安全的Integer
context.setAttribute("callNum",count);*/
}
}
| [
"1976967579@qq.com"
] | 1976967579@qq.com |
41a3f04a70b4b78e08912272288851afdda43141 | 1687523f51857d4f79883761519fe64c966fe23f | /Foundation/org.egovframe.rte.fdl.cmmn/src/test/java/org/egovframe/rte/bsl/exception/OhterServiceImpl.java | d93cb8ce3a93f58e23cdecd92dbc7c6486a36f01 | [
"Apache-2.0"
] | permissive | eGovFramework/egovframe-runtime | 46c3910a060f0dccd79c71f2fcc977998a9f6c84 | 3d012cdd0227e686c8cdcecf998d383f14b966e2 | refs/heads/contribution | 2023-07-06T07:54:26.496423 | 2023-06-29T06:41:08 | 2023-06-29T06:41:08 | 240,443,569 | 31 | 62 | Apache-2.0 | 2023-09-11T05:31:43 | 2020-02-14T06:32:50 | Java | UTF-8 | Java | false | false | 663 | java | package org.egovframe.rte.bsl.exception;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
public class OhterServiceImpl extends EgovAbstractServiceImpl implements HelloService {
public String sayHello(String name) throws Exception {
String helloStr = "Hello " + name;
try {
int i = 1 / 0;
System.out.println(i);
} catch (Exception e) {
leaveaTrace("message.exception.test");
}
return helloStr;
}
public void deleteMethod() throws Exception {
}
public String insertMethod() throws Exception {
return null;
}
public void updateMethod() throws Exception {
if (true)
throw processException("info.nodata.msg");
}
}
| [
"egovframesupport@gmail.com"
] | egovframesupport@gmail.com |
c31953ad38c5f2ea9c90bf0d0a95421ab2d0e0de | 78bf514b661c1bce5d72e20affc9238a766f838f | /onlineleasing-init/src/main/java/com/sbm/module/onlineleasing/init/authorization/biz/IAuthorizationService.java | a02f6339d166cff1260dba4e8934f6cb03f6cb74 | [] | no_license | superbrandmall/microservice | 5938e6661b4edd6fd6f08d52c11059690a4f2ed4 | de932bd84b07295b186fb8d3e92d44523b391891 | refs/heads/master | 2021-07-01T23:36:21.102536 | 2019-03-27T05:30:07 | 2019-03-27T05:30:07 | 115,712,051 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package com.sbm.module.onlineleasing.init.authorization.biz;
public interface IAuthorizationService {
/**
* 初始化角色
*/
void initRole();
/**
* 初始化角色资源关系
*/
void initRoleMethod();
/**
* 初始化用户
*/
void initUser();
/**
* 初始化用户角色关系
*/
void initUserRole();
}
| [
"295322187@qq.com"
] | 295322187@qq.com |
c3e2592d50839bc29b0fd715dc8c8f144d98b0cd | fa93c9be2923e697fb8a2066f8fb65c7718cdec7 | /sources/com/avito/android/rating/details/adapter/action/ActionItemView.java | 38e37fa181f15442235c37bca1c0a63ccbcc16ed | [] | no_license | Auch-Auch/avito_source | b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b | 76fdcc5b7e036c57ecc193e790b0582481768cdc | refs/heads/master | 2023-05-06T01:32:43.014668 | 2021-05-25T10:19:22 | 2021-05-25T10:19:22 | 370,650,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 984 | java | package com.avito.android.rating.details.adapter.action;
import com.avito.android.component.clickable_element.ClickableElement;
import com.avito.konveyor.blueprint.ItemView;
import kotlin.Metadata;
import org.jetbrains.annotations.NotNull;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\bf\u0018\u00002\u00020\u00012\u00020\u0002¨\u0006\u0003"}, d2 = {"Lcom/avito/android/rating/details/adapter/action/ActionItemView;", "Lcom/avito/konveyor/blueprint/ItemView;", "Lcom/avito/android/component/clickable_element/ClickableElement;", "rating_release"}, k = 1, mv = {1, 4, 2})
public interface ActionItemView extends ItemView, ClickableElement {
@Metadata(bv = {1, 0, 3}, d1 = {}, d2 = {}, k = 3, mv = {1, 4, 2})
public static final class DefaultImpls {
public static void onUnbind(@NotNull ActionItemView actionItemView) {
ItemView.DefaultImpls.onUnbind(actionItemView);
}
}
}
| [
"auchhunter@gmail.com"
] | auchhunter@gmail.com |
791e1aaeb009dde814d7a26a8716ee0139890f9f | cfc60fc1148916c0a1c9b421543e02f8cdf31549 | /src/testcases/CWE209_Information_Leak_Error/CWE209_Information_Leak_Error__fromDB_53d.java | e95fe8d035a5c380e60e40f89b51d2e0e2584548 | [
"LicenseRef-scancode-public-domain"
] | permissive | zhujinhua/GitFun | c77c8c08e89e61006f7bdbc5dd175e5d8bce8bd2 | 987f72fdccf871ece67f2240eea90e8c1971d183 | refs/heads/master | 2021-01-18T05:46:03.351267 | 2012-09-11T16:43:44 | 2012-09-11T16:43:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,803 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE209_Information_Leak_Error__fromDB_53d.java
Label Definition File: CWE209_Information_Leak_Error.label.xml
Template File: sources-sinks-53d.tmpl.java
*/
/*
* @description
* CWE: 209 Information exposure through error message
* BadSource: fromDB Read a string from a database connection
* GoodSource: A hardcoded string
* Sinks: stackDump
* GoodSink: Generic error message
* BadSink : Error causes stack dump
* Flow Variant: 53 Data flow: data passed as an argument from one method through two others to a fourth; all four functions are in different classes in the same package
*
* */
package testcases.CWE209_Information_Leak_Error;
import testcasesupport.*;
import javax.servlet.http.*;
public class CWE209_Information_Leak_Error__fromDB_53d
{
public void bad_sink(String data ) throws Throwable
{
try
{
int iConversion = Integer.valueOf(data);
}
catch( Exception e )
{
e.printStackTrace(); /* POTENTIAL FLAW: Print stack trace on error */
}
}
/* goodG2B() - use goodsource and badsink */
public void goodG2B_sink(String data ) throws Throwable
{
try
{
int iConversion = Integer.valueOf(data);
}
catch( Exception e )
{
e.printStackTrace(); /* POTENTIAL FLAW: Print stack trace on error */
}
}
/* goodB2G() - use badsource and goodsink */
public void goodB2G_sink(String data ) throws Throwable
{
try
{
int iConversion = Integer.valueOf(data);
}
catch( Exception e )
{
IO.writeLine("There was an error parsing the string"); /* FIX: print a generic message */
}
}
}
| [
"amitf@chackmarx.com"
] | amitf@chackmarx.com |
1d3aacbdcde77cb58fbbd04c0d254aaa552bb115 | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /src/irvine/oeis/a167/A167695.java | 1c0714649ebd19ed3e6f946a670463b57d55c3c8 | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 443 | java | package irvine.oeis.a167;
// Generated by gen_pattern.pl - DO NOT EDIT here!
import irvine.oeis.CoxeterSequence;
/**
* A167695 Number of reduced words of length n in Coxeter group on 24 generators <code>S_i</code> with relations <code>(S_i)^2 = (S_i S_j)^15 =</code> I.
* @author Georg Fischer
*/
public class A167695 extends CoxeterSequence {
/** Construct the sequence. */
public A167695() {
super(
15,
24);
}
}
| [
"sean.irvine@realtimegenomics.com"
] | sean.irvine@realtimegenomics.com |
62fa642df5ca13977a5d9e5a14324a53c1efb4cc | 24bc4990e9d0bef6a42a6f86dc783785b10dbd42 | /chrome/browser/back_press/android/java/src/org/chromium/chrome/browser/back_press/BackPressManagerTest.java | 07acb5b65db6f70170cbd48b72035419644db86a | [
"BSD-3-Clause"
] | permissive | nwjs/chromium.src | 7736ce86a9a0b810449a3b80a4af15de9ef9115d | 454f26d09b2f6204c096b47f778705eab1e3ba46 | refs/heads/nw75 | 2023-08-31T08:01:39.796085 | 2023-04-19T17:25:53 | 2023-04-19T17:25:53 | 50,512,158 | 161 | 201 | BSD-3-Clause | 2023-05-08T03:19:09 | 2016-01-27T14:17:03 | null | UTF-8 | Java | false | false | 7,741 | java | // Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.back_press;
import androidx.test.filters.SmallTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.supplier.ObservableSupplierImpl;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.CallbackHelper;
import org.chromium.base.test.util.HistogramWatcher;
import org.chromium.components.browser_ui.widget.gesture.BackPressHandler;
import org.chromium.content_public.browser.test.util.TestThreadUtils;
import java.util.concurrent.TimeoutException;
/**
* Tests for {@link BackPressManager}.
*/
@RunWith(BaseJUnit4ClassRunner.class)
@Batch(Batch.UNIT_TESTS)
public class BackPressManagerTest {
private class EmptyBackPressHandler implements BackPressHandler {
private ObservableSupplierImpl<Boolean> mSupplier = new ObservableSupplierImpl<>();
@Override
public @BackPressResult int handleBackPress() {
return BackPressResult.UNKNOWN;
}
@Override
public ObservableSupplierImpl<Boolean> getHandleBackPressChangedSupplier() {
return mSupplier;
}
}
private class FailedBackPressHandler extends EmptyBackPressHandler {
@Override
public @BackPressResult int handleBackPress() {
return BackPressResult.FAILURE;
}
}
@BeforeClass
public static void setUpClass() {
ObservableSupplierImpl.setIgnoreThreadChecksForTesting(true);
}
@AfterClass
public static void afterClass() {
ObservableSupplierImpl.setIgnoreThreadChecksForTesting(false);
}
@Test
@SmallTest
public void testBasic() {
var histogramWatcher =
HistogramWatcher.newBuilder().expectNoRecords(BackPressManager.HISTOGRAM).build();
BackPressManager manager = new BackPressManager();
EmptyBackPressHandler h1 =
TestThreadUtils.runOnUiThreadBlockingNoException(EmptyBackPressHandler::new);
TestThreadUtils.runOnUiThreadBlocking(
() -> { manager.addHandler(h1, BackPressHandler.Type.FIND_TOOLBAR); });
try {
manager.getCallback().handleOnBackPressed();
} catch (AssertionError ignored) {
}
histogramWatcher.assertExpected(
"Handler's histogram should be not recorded if it is not executed");
histogramWatcher = HistogramWatcher.newSingleRecordWatcher(
BackPressManager.HISTOGRAM, 16); // 16 is FIND_TOOLBAR
TestThreadUtils.runOnUiThreadBlocking(
() -> { h1.getHandleBackPressChangedSupplier().set(true); });
manager.getCallback().handleOnBackPressed();
histogramWatcher.assertExpected("Handler's histogram should be recorded if it is executed");
histogramWatcher =
HistogramWatcher.newBuilder().expectNoRecords(BackPressManager.HISTOGRAM).build();
TestThreadUtils.runOnUiThreadBlocking(
() -> { h1.getHandleBackPressChangedSupplier().set(false); });
try {
manager.getCallback().handleOnBackPressed();
} catch (AssertionError ignored) {
}
histogramWatcher.assertExpected(
"Handler's histogram should be not recorded if it is not executed");
}
@Test
@SmallTest
public void testMultipleHandlers() {
var histogramWatcher = HistogramWatcher.newSingleRecordWatcher(
BackPressManager.HISTOGRAM, 2); // 2 is AR_DELEGATE
BackPressManager manager = new BackPressManager();
EmptyBackPressHandler h1 =
TestThreadUtils.runOnUiThreadBlockingNoException(EmptyBackPressHandler::new);
EmptyBackPressHandler h2 =
TestThreadUtils.runOnUiThreadBlockingNoException(EmptyBackPressHandler::new);
TestThreadUtils.runOnUiThreadBlocking(() -> {
manager.addHandler(h1, BackPressHandler.Type.VR_DELEGATE);
manager.addHandler(h2, BackPressHandler.Type.AR_DELEGATE);
h1.getHandleBackPressChangedSupplier().set(false);
h2.getHandleBackPressChangedSupplier().set(true);
});
manager.getCallback().handleOnBackPressed();
histogramWatcher.assertExpected(
"Only record to handler's histogram should have value 2 (AR_DELEGATE).");
histogramWatcher = HistogramWatcher.newSingleRecordWatcher(
BackPressManager.HISTOGRAM, 1); // 1 is VR_DELEGATE
TestThreadUtils.runOnUiThreadBlocking(
() -> { h1.getHandleBackPressChangedSupplier().set(true); });
manager.getCallback().handleOnBackPressed();
histogramWatcher.assertExpected(
"Only record to handler's histogram should have value 1 (VR_DELEGATE).");
}
@Test
@SmallTest
public void testFailedHandlers() {
BackPressManager manager = new BackPressManager();
var vrFailedHandler =
TestThreadUtils.runOnUiThreadBlockingNoException(FailedBackPressHandler::new);
var arSuccessHandler =
TestThreadUtils.runOnUiThreadBlockingNoException(EmptyBackPressHandler::new);
TestThreadUtils.runOnUiThreadBlocking(() -> {
manager.addHandler(vrFailedHandler, BackPressHandler.Type.VR_DELEGATE);
manager.addHandler(arSuccessHandler, BackPressHandler.Type.AR_DELEGATE);
vrFailedHandler.getHandleBackPressChangedSupplier().set(true);
arSuccessHandler.getHandleBackPressChangedSupplier().set(true);
});
var watcher = HistogramWatcher.newBuilder()
.expectIntRecord(BackPressManager.FAILURE_HISTOGRAM,
BackPressManager.getHistogramValueForTesting(
BackPressHandler.Type.VR_DELEGATE))
.expectIntRecord(BackPressManager.HISTOGRAM,
BackPressManager.getHistogramValueForTesting(
BackPressHandler.Type.AR_DELEGATE))
.build();
try {
manager.getCallback().handleOnBackPressed();
} catch (AssertionError ignored) {
}
watcher.assertExpected();
}
@Test
@SmallTest
public void testFallbackCallback() throws TimeoutException {
CallbackHelper callbackHelper = new CallbackHelper();
BackPressManager manager = new BackPressManager(callbackHelper::notifyCalled);
var vrFailedHandler =
TestThreadUtils.runOnUiThreadBlockingNoException(FailedBackPressHandler::new);
TestThreadUtils.runOnUiThreadBlocking(() -> {
manager.addHandler(vrFailedHandler, BackPressHandler.Type.VR_DELEGATE);
vrFailedHandler.getHandleBackPressChangedSupplier().set(true);
});
var watcher = HistogramWatcher.newBuilder()
.expectIntRecord(BackPressManager.FAILURE_HISTOGRAM,
BackPressManager.getHistogramValueForTesting(
BackPressHandler.Type.VR_DELEGATE))
.build();
try {
manager.getCallback().handleOnBackPressed();
} catch (AssertionError ignored) {
}
callbackHelper.waitForFirst("Fallback should be triggered if all handlers failed.");
watcher.assertExpected();
}
}
| [
"roger@nwjs.io"
] | roger@nwjs.io |
219449936a9cb06a606204025143b79258b9e2b7 | 090c6984159eb340e31818420bad17f48e1a19c4 | /arraytest/src/com/kitri/array/PlayerTeam.java | f0f5517b211082ef2c185f17fc054250bb2a0fef | [] | no_license | TaeHeeHyeung/KitriJava_Project1Library | d702e0cf056090307850671050180decfa613ada | 2ff485d2e1ffc0343a239690ab75fe7fd45f52bd | refs/heads/master | 2020-06-18T11:40:00.311379 | 2019-07-22T17:17:24 | 2019-07-22T17:17:24 | 196,291,120 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,041 | java | package com.kitri.array;
public class PlayerTeam {
public static void main(String[] args) {
//1번 투수, 2 포수, 1루수, 2루수, 3루수, 유격수 , 외야수(좌익수, 중견수, 우익수)
//1~9
//지명타자 0
//총 10명
//타율, 방어율
//린드블럼은 방어율 (투수니까)
PlayerDto[] player = new PlayerDto[5];
player [0] = new PlayerDto(24, "오재원", 4, 0.321);
player [1] = new PlayerDto(13, "허경민",5 , 0.351);
player [2] = new PlayerDto(34, "린드블럼", 1, 0.001);
player [3] = new PlayerDto(9, "페르난데스", 3, 0.421);
player [4] = new PlayerDto(38, "김대한", 7, 0.384);
int len = player.length;
for(int i=0; i<len ; i++) {
}
//메모리 참조횟수가 length만큼 실행된다.
for(int i=0; i<player.length; i++) {
}
//myfor ctrl + space 자동완성 만들기
//설정 window preference java editor template for 의 내용 저장 새로 만들기 myfor
for (int i = 0; i < len; i++) {
System.out.println(player[i]);
}
}
}
| [
"hth0893@naver.com"
] | hth0893@naver.com |
a4b4d42a33c61659339eec64d1673d82caab52c1 | 50c407c3dfdaf4e40319352472a487614f167f7a | /JMPatrol/app/src/main/java/com/ecity/cswatersupply/utils/PatrolReportPositionBeanBuilder.java | 8b72e30c4732f5ee769a85a1b7aec19509aa6f31 | [] | no_license | TonyTong1993/JiangMenPatrol | e8e966da912e993c3b6c99998968b79385f7b534 | cae541cde1e5254efe6ecc3a7647912893d4d2c5 | refs/heads/master | 2020-03-27T17:42:19.462460 | 2018-09-07T10:16:12 | 2018-09-07T10:16:12 | 146,868,143 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,931 | java | package com.ecity.cswatersupply.utils;
import android.location.Location;
import com.ecity.android.log.LogUtil;
import com.ecity.cswatersupply.HostApplication;
import com.ecity.cswatersupply.SessionManager;
import com.ecity.cswatersupply.model.planningTask.Z3PlanTask;
import com.esri.core.geometry.Point;
import com.z3app.android.util.DateUtil;
import com.z3app.android.util.StringUtil;
import com.zzz.ecity.android.applibrary.MyApplication;
import com.zzz.ecity.android.applibrary.model.GPSPositionBean;
import com.zzz.ecity.android.applibrary.service.AReportPositionBeanBuilder;
import com.zzz.ecity.android.applibrary.utils.DateUtilExt;
import com.zzz.ecity.android.applibrary.utils.ListUtil;
public class PatrolReportPositionBeanBuilder extends AReportPositionBeanBuilder {
@Override
public GPSPositionBean buildCustomGPSPositionBean(Location location) {
if (location == null || HostApplication.getApplication() == null || HostApplication.getApplication().getCurrentUser() == null) {
return null;
}
GPSPositionBean bean = convertLocation2PositionBean(location);
if (!ListUtil.isEmpty(SessionManager.CurrentPlanTasks)) {
boolean inDetourArea = false;
boolean isOverspeed = false;
boolean isOutOfRange = false;
boolean isNightTask = false;
int planTaskId = -1;
for (Z3PlanTask planTask : SessionManager.CurrentPlanTasks) {
ArriveDetecter arriveDetecter = new ArriveDetecter(planTask);
Point point = new Point(bean.getx(), bean.gety());
inDetourArea = arriveDetecter.judgeInDetourArea(point);
isOutOfRange = arriveDetecter.judgeOutOfRange(point);
isOverspeed = arriveDetecter.judgeOverSpeed(bean.getSpeed(), isOutOfRange, inDetourArea);
if (!isOutOfRange) {
planTaskId = planTask.getPlanid();
isNightTask = planTask.isNightTask();
break;
}
}
bean.setPlanTaskId(String.valueOf(planTaskId));
bean.setInDetourArea(inDetourArea ? 1 : 0);
bean.setOverspeed(isOverspeed ? 1 : 0);
bean.setNightWatch(isNightTask ? 1 : 0);
bean.setTag("0");
}
return bean;
}
private GPSPositionBean convertLocation2PositionBean(Location location) {
GPSPositionBean bean = new GPSPositionBean();
bean.setUserid(Integer.valueOf(HostApplication.getApplication().getCurrentUser().getId()));
double[] mercatorxy = null;
try {
mercatorxy = CoordTransfer.transToLocal(location.getLatitude(), location.getLongitude());
if (null != mercatorxy && 2 == mercatorxy.length) {
bean.setx(mercatorxy[0]);
bean.sety(mercatorxy[1]);
} else {
bean.setx(0.0);
bean.sety(0.0);
}
} catch (Exception e) {
LogUtil.e(this, e);
}
bean.setlat(location.getLatitude());
bean.setlon(location.getLongitude());
bean.setacu(location.getAccuracy());
bean.setbattery(MyApplication.getApplication().getBatteryLevelPercent());
bean.setSpeed(location.getSpeed());
String time = DateUtil.changeLongToString(location.getTime());
if (StringUtil.isEmpty(time) || time.contains("1970"))
time = DateUtilExt.getOffsetToServiceTime();
if (StringUtil.isEmpty(time)) {
time = DateUtil.getDateEN();
}
if (time.contains(".")) {
String strs[] = time.split("\\.");
time = strs[0];
}
bean.setTime(time);
bean.setRepay(0);
bean.setStatus(0);
return bean;
}
}
| [
"zzht@ZZHTdeiMac.lan"
] | zzht@ZZHTdeiMac.lan |
704a34e330665b916a3dbb862f72eee34375e238 | 5ac5f43848b36154198172172e3867d41e6692b2 | /src/leetcode/BulbSwitcherII.java | 56e2cdb43d2b183b1f42c21c4c4313e33d5e7e57 | [] | no_license | kingraser/leetcode | 619aba7e5afe2c1655f1430f23d9c9de8a3ff34b | c1a47d6f83a3f3f6bd1395ed32f0ba42f2885e77 | refs/heads/master | 2023-08-18T01:35:28.032279 | 2023-08-09T07:39:59 | 2023-08-09T07:39:59 | 41,731,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,700 | java | package leetcode;
import leetcode.util.TestUtil;
import org.junit.Test;
/**
* @author Wit
*/
public class BulbSwitcherII {
/*
There is a room with n bulbs labeled from 1 to n that all are turned on initially, and four buttons on the wall. Each of the four buttons has a different functionality where:
Button 1: Flips the status of all the bulbs.
Button 2: Flips the status of all the bulbs with even labels (i.e., 2, 4, ...).
Button 3: Flips the status of all the bulbs with odd labels (i.e., 1, 3, ...).
Button 4: Flips the status of all the bulbs with a label j = 3k + 1 where k = 0, 1, 2, ... (i.e., 1, 4, 7, 10, ...).
You must make exactly presses button presses in total. For each press, you may pick any of the four buttons to press.
Given the two integers n and presses, return the number of different possible statuses after performing all presses button presses.
Example 1:
Input: n = 1, presses = 1
Output: 2
Explanation: Status can be:
- [off] by pressing button 1
- [on] by pressing button 2
Example 2:
Input: n = 2, presses = 1
Output: 3
Explanation: Status can be:
- [off, off] by pressing button 1
- [on, off] by pressing button 2
- [off, on] by pressing button 3
Example 3:
Input: n = 3, presses = 1
Output: 4
Explanation: Status can be:
- [off, off, off] by pressing button 1
- [off, on, off] by pressing button 2
- [on, off, on] by pressing button 3
- [off, on, on] by pressing button 4
Example 4:
Input: n = 1, presses = 0
Output: 1
Explanation: Status can only be [on] since you cannot press any of the buttons.
Example 5:
Input: n = 1, presses = 2
Output: 2
Explanation: Status can be:
- [off] by pressing button 1 then button 1 again
- [on] by pressing button 1 then button 2
Constraints:
1 <= n <= 1000
0 <= presses <= 1000
*/
/*
Easy to find
1 You can change the order of the operation of pressing the first button without changing the result.
For example press 1+2 == press 2+1
2 1+2 == 3
2+3 == 3+2 == 1
1+3 == 2
3 So there are only 8 states: original, 1, 2, 3, 4, 1+4, 2+4, 3+4
*/
@Test
public void test() {
TestUtil.testEquals(new Object[][]{
{2, 1, 1}, {3, 2, 1}, {4, 3, 1}, {1, 1, 0}, {2, 1, 2}
});
}
public int flipLights(int n, int presses) {
if (presses == 0) return 1;
if (n == 1) return 2;
if (n == 2) return presses == 1 ? 3 : 4;
if (presses == 1) return 4;
return presses == 2 ? 7 : 8; // when presses are 2, state 4 is missing
}
}
| [
"kingraser@gmail.com"
] | kingraser@gmail.com |
f8cf3130a858d0be7d6a61ff0eaa9097b07273d2 | e1e5bd6b116e71a60040ec1e1642289217d527b0 | /H5/L2jMaster_org/L2jMaster_org_2019_07_02/L2JMaster_DataPack/dist/game/data/scripts/quests/Q00283_TheFewTheProudTheBrave/Q00283_TheFewTheProudTheBrave.java | dbccdad6a7a51b80f8486ab924c2ede89bcbd2a4 | [] | no_license | serk123/L2jOpenSource | 6d6e1988a421763a9467bba0e4ac1fe3796b34b3 | 603e784e5f58f7fd07b01f6282218e8492f7090b | refs/heads/master | 2023-03-18T01:51:23.867273 | 2020-04-23T10:44:41 | 2020-04-23T10:44:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,687 | java | /*
* Copyright (C) 2004-2019 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J DataPack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package quests.Q00283_TheFewTheProudTheBrave;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.quest.State;
import quests.Q00261_CollectorsDream.Q00261_CollectorsDream;
/**
* The Few, The Proud, The Brave (283)
* @author xban1x
*/
public final class Q00283_TheFewTheProudTheBrave extends Quest
{
// NPC
private static final int PERWAN = 32133;
// Item
private static final int CRIMSON_SPIDER_CLAW = 9747;
// Monster
private static final int CRIMSON_SPIDER = 22244;
// Misc
private static final int CLAW_PRICE = 45;
private static final int BONUS = 2187;
private static final int MIN_LVL = 15;
public Q00283_TheFewTheProudTheBrave()
{
super(283, Q00283_TheFewTheProudTheBrave.class.getSimpleName(), "The Few, The Proud, The Brave");
addKillId(CRIMSON_SPIDER);
addStartNpc(PERWAN);
addTalkId(PERWAN);
registerQuestItems(CRIMSON_SPIDER_CLAW);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
final QuestState st = getQuestState(player, false);
String htmltext = null;
if (st == null)
{
return htmltext;
}
switch (event)
{
case "32133-03.htm":
{
st.startQuest();
htmltext = event;
break;
}
case "32133-06.html":
{
htmltext = event;
break;
}
case "32133-08.html":
{
if (st.hasQuestItems(CRIMSON_SPIDER_CLAW))
{
final long claws = st.getQuestItemsCount(CRIMSON_SPIDER_CLAW);
st.giveAdena((claws * CLAW_PRICE) + ((claws >= 10) ? BONUS : 0), true);
st.takeItems(CRIMSON_SPIDER_CLAW, -1);
Q00261_CollectorsDream.giveNewbieReward(player);
htmltext = event;
}
else
{
htmltext = "32133-07.html";
}
break;
}
case "32133-09.html":
{
st.exitQuest(true, true);
htmltext = event;
break;
}
}
return htmltext;
}
@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
final QuestState st = getRandomPartyMemberState(killer, -1, 3, npc);
if (st != null)
{
st.giveItemRandomly(npc, CRIMSON_SPIDER_CLAW, 1, 0, 0.6, true);
}
return super.onKill(npc, killer, isSummon);
}
@Override
public String onTalk(L2Npc npc, L2PcInstance talker)
{
final QuestState st = getQuestState(talker, true);
String htmltext = getNoQuestMsg(talker);
switch (st.getState())
{
case State.CREATED:
{
htmltext = (talker.getLevel() >= MIN_LVL) ? "32133-01.htm" : "32133-02.htm";
break;
}
case State.STARTED:
{
htmltext = st.hasQuestItems(CRIMSON_SPIDER_CLAW) ? "32133-04.html" : "32133-05.html";
break;
}
}
return htmltext;
}
}
| [
"64197706+L2jOpenSource@users.noreply.github.com"
] | 64197706+L2jOpenSource@users.noreply.github.com |
254642dddc6d6b515fd387f65354c17a525c7eba | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/10/10_0427ac59475ab73306954efd8aa5e4fb5bf41dbf/ClassPaths/10_0427ac59475ab73306954efd8aa5e4fb5bf41dbf_ClassPaths_t.java | 9c36007d6c65d47d09acf9cefd162d3c9a888cbb | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 4,157 | java | /**
* Copyright (C) 2013 all@code-story.net
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package net.codestory.http.io;
import static java.nio.charset.StandardCharsets.*;
import static java.nio.file.Files.*;
import static net.codestory.http.io.FileVisitors.*;
import static net.codestory.http.io.Resources.*;
import java.io.*;
import java.net.*;
import java.nio.file.*;
import java.util.*;
import java.util.jar.*;
import java.util.zip.*;
class ClassPaths {
static List<String> fromURL(URL url) {
String protocol = url.getProtocol();
String name = url.toExternalForm();
if ("file".equals(protocol)) {
try {
File file = getFile(url);
return name.contains(".jar") ? forJarFile(new JarFile(file)) : forSystemDir(file);
} catch (Throwable e) {
// Ignore
}
}
try {
if ("jar".equals(protocol)) {
List<String> relativePaths = forJarUrl(url);
if (relativePaths != null) {
return relativePaths;
}
}
} catch (Throwable e) {
// Ignore
}
return Collections.emptyList();
}
private static File getFile(URL url) {
try {
String path = url.toURI().getSchemeSpecificPart();
if (new File(path).exists()) {
return new File(path);
}
} catch (URISyntaxException e) {
// Ignore
}
try {
String path = URLDecoder.decode(url.getPath(), UTF_8.displayName());
if (path.contains(".jar!")) {
path = path.substring(0, path.lastIndexOf(".jar!") + ".jar".length());
}
if (new File(path).exists()) {
return new File(path);
}
} catch (UnsupportedEncodingException e) {
// Ignore
}
try {
String path = url.toExternalForm();
if (path.startsWith("jar:")) {
path = path.substring("jar:".length());
} else if (path.startsWith("file:")) {
path = path.substring("file:".length());
}
if (path.contains(".jar!")) {
path = path.substring(0, path.indexOf(".jar!") + ".jar".length());
}
if (new File(path).exists()) {
return new File(path);
}
path = path.replace("%20", " ");
if (new File(path).exists()) {
return new File(path);
}
} catch (Exception e) {
// Ignore
}
return null;
}
private static List<String> forJarUrl(URL url) throws IOException {
try {
URLConnection urlConnection = url.openConnection();
if (urlConnection instanceof JarURLConnection) {
return forJarFile(((JarURLConnection) urlConnection).getJarFile());
}
} catch (Throwable e) {
// Ignore
}
File file = getFile(url);
if (file == null) {
return null;
}
return forJarFile(new JarFile(file));
}
private static List<String> forJarFile(JarFile jarFile) {
List<String> files = new ArrayList<>();
Enumeration<? extends ZipEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
if (!entry.isDirectory()) {
files.add(entry.getName());
}
}
return files;
}
private static List<String> forSystemDir(File file) throws IOException {
if (file == null || !file.exists()) {
return Collections.emptyList();
}
final Path parent = file.toPath();
final List<String> files = new ArrayList<>();
walkFileTree(parent, onFile(path -> files.add(relativePath(parent, path))));
return files;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
529225ad2047c34f5d23cc0a6231ca162ab1071c | 403aca6b4e2a60e773820fafa2a79ffe2ee4805b | /src/src/net/idtoki/serteca/model/PrestamoPeer.java | 5aa8ee31db3e18bb6b82dff1bf5cd39ac6bd4cca | [] | no_license | esle-elkartea/lankidetza00004 | e57a32c2d00416f86da45458db030558ef4e7f5a | a02a4ddf45050fbe85dbf41af146ae86f0b0cf22 | refs/heads/master | 2020-12-24T11:53:20.234029 | 2016-06-24T09:38:34 | 2016-06-24T09:38:34 | 61,873,745 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | java | package net.idtoki.serteca.model;
/**
* The skeleton for this class was autogenerated by Torque on:
*
* [Wed Feb 01 12:46:43 CET 2006]
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*/
public class PrestamoPeer
extends net.idtoki.serteca.model.BasePrestamoPeer
{
}
| [
"noreply@esle.eu"
] | noreply@esle.eu |
7c7ab795fd7e02b6c6de2ca0c5bbc8d3def695a8 | 8410644e1fc643f913820ecb40a335ef4e179b92 | /lion-common/src/main/java/com/alacoder/lion/common/utils/InternalMetricsFactory.java | aedf3ecb21cb806e13f891ce57063417463c0919 | [] | no_license | zogwei/lion | c1044382710450f52b74d9572b8cc7ab83e7c89e | 3d8bf532b13a8b48e0076fa5d208195b28ba6d88 | refs/heads/master | 2020-04-12T03:55:35.615082 | 2017-12-23T09:08:40 | 2017-12-23T09:08:40 | 64,929,861 | 0 | 0 | null | 2017-05-25T01:41:35 | 2016-08-04T11:40:28 | JavaScript | UTF-8 | Java | false | false | 3,541 | java | /*
* Copyright 2009-2016 Weibo, 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 com.alacoder.lion.common.utils;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import com.codahale.metrics.MetricRegistry;
/**
* 生成 {@link MetricRegistry} 的工厂类。
*
* @author Aiden S. Zouliu
*
*/
public class InternalMetricsFactory {
private static final ConcurrentMap<String, MetricRegistry> getRegistryCache;
private static final MetricRegistry defaultMetricsRegistry;
static {
getRegistryCache = new ConcurrentHashMap<String, MetricRegistry>();
getRegistryCache.put("default", defaultMetricsRegistry = new MetricRegistry());
}
/**
* 指定名字获取所属的实例。
*
* @param name {@link MetricRegistry} 实例的名字。
* @return {@link MetricRegistry} 实例。
*/
public static MetricRegistry getRegistryInstance(String name) {
MetricRegistry instance = getRegistryCache.get(name);
if (instance == null) {
getRegistryCache.putIfAbsent(name, new MetricRegistry());
instance = getRegistryCache.get(name);
}
return instance;
}
/**
* 指定几个名字的关键词,依据 {@link MetricRegistry} 的名字生成规则获取所属的实例。
*
* @param name 关键字。
* @param names 剩余的关键字。
* @return {@link MetricRegistry} 实例。
*/
public static MetricRegistry getRegistryInstance(String name, String... names) {
final String key = MetricRegistry.name(name, names);
MetricRegistry instance = getRegistryCache.get(key);
if (instance == null) {
getRegistryCache.putIfAbsent(key, new MetricRegistry());
instance = getRegistryCache.get(key);
}
return instance;
}
/**
* 指定类类型和几个名字的关键词,依据 {@link MetricRegistry} 的名字生成规则获取所属的实例。
*
* @param clazz 类的类型。
* @param names 关键字。
* @return {@link MetricRegistry} 实例。
*/
public static MetricRegistry getRegistryInstance(Class<?> clazz, String... names) {
final String key = MetricRegistry.name(clazz, names);
MetricRegistry instance = getRegistryCache.get(key);
if (instance == null) {
getRegistryCache.putIfAbsent(key, new MetricRegistry());
instance = getRegistryCache.get(key);
}
return instance;
}
/**
* 返回默认的 {@link MetricRegistry}。
*/
public static MetricRegistry getDefaultMetricsRegistry() {
return defaultMetricsRegistry;
}
/**
* 返回当前注册的全部 {@link MetricRegistry}s。
*/
public static Map<String, MetricRegistry> allRegistries() {
return Collections.unmodifiableMap(getRegistryCache);
}
}
| [
"zogwei@gmail.com"
] | zogwei@gmail.com |
fc65fc6a0a2b46cf5feb0adf115cfe5f2fee153e | eb9f655206c43c12b497c667ba56a0d358b6bc3a | /java/java-tests/testData/refactoring/anonymousToInner/localClassCaptureInCtorOnly_after.java | acf7fd44ae574ac5a1bb85ef9565fef975db6559 | [
"Apache-2.0"
] | permissive | JetBrains/intellij-community | 2ed226e200ecc17c037dcddd4a006de56cd43941 | 05dbd4575d01a213f3f4d69aa4968473f2536142 | refs/heads/master | 2023-09-03T17:06:37.560889 | 2023-09-03T11:51:00 | 2023-09-03T12:12:27 | 2,489,216 | 16,288 | 6,635 | Apache-2.0 | 2023-09-12T07:41:58 | 2011-09-30T13:33:05 | null | UTF-8 | Java | false | false | 411 | java | import java.util.function.IntFunction;
public class LocalClass {
void test(int x, int y) {
new InnerClass(x, y);
new InnerClass(new int[]{1, 2, 3}, x, y);
}
private static class InnerClass {
InnerClass(int x, int y) {
System.out.println(x);
}
InnerClass(int[] data, int x, int y) {
System.out.println(y);
}
}
}
| [
"intellij-monorepo-bot-no-reply@jetbrains.com"
] | intellij-monorepo-bot-no-reply@jetbrains.com |
4618f0e7ea18ad6e4e38393a9560905da57cbc84 | c4b706b2c3a5f49f78351c701004d026a8c47b3a | /compiler/src/main/java/org/jaxsb/compiler/processor/document/SchemaDocument.java | f2a3dc9451e311cc4dbe93e2318802d332eaff95 | [
"MIT"
] | permissive | jaxsb/jaxsb | 19447a028aa2a57ebb8fdf8bce0e3364c4a070a0 | 01713bdf722b10e5bf5ab073cb106845234d19cc | refs/heads/master | 2023-08-21T12:30:38.219514 | 2023-08-19T10:40:47 | 2023-08-19T10:40:47 | 148,918,510 | 2 | 0 | MIT | 2023-06-16T10:33:11 | 2018-09-15T16:17:53 | Java | UTF-8 | Java | false | false | 2,098 | java | /* Copyright (c) 2008 JAX-SB
*
* 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.
*
* You should have received a copy of The MIT License (MIT) along with this
* program. If not, see <http://opensource.org/licenses/MIT/>.
*/
package org.jaxsb.compiler.processor.document;
import java.net.URL;
import java.util.Collection;
import java.util.Objects;
import org.jaxsb.compiler.pipeline.PipelineEntity;
import org.jaxsb.compiler.processor.reference.SchemaReference;
import org.w3c.dom.Document;
public final class SchemaDocument implements PipelineEntity {
private final SchemaReference schemaReference;
private final Document document;
private Collection<URL> includes;
public SchemaDocument(final SchemaReference schemaReference, final Document document) {
this.schemaReference = schemaReference;
this.document = document;
}
public SchemaReference getSchemaReference() {
return schemaReference;
}
public Document getDocument() {
return document;
}
public Collection<URL> getIncludes() {
return includes;
}
public void setIncludes(final Collection<URL> includes) {
this.includes = includes;
}
@Override
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (!(obj instanceof SchemaDocument))
return false;
final SchemaDocument that = (SchemaDocument)obj;
return Objects.equals(schemaReference, that.schemaReference);
}
@Override
public int hashCode() {
return 31 + Objects.hashCode(schemaReference) * (document != null ? 1 : -1);
}
} | [
"seva@safris.org"
] | seva@safris.org |
fc081d81e8a0c7b8e76903b4d1b4fcda34c37ec6 | f525deacb5c97e139ae2d73a4c1304affb7ea197 | /gitv/src/main/java/com/gala/sdk/plugin/server/core/EmptyPluginProvider.java | b1140346b5a1b151908476871fd729562479d6e0 | [] | no_license | AgnitumuS/gitv | 93b2359e1bf9f2b6c945298c61c5c6dbfeea49b3 | 242c9a10a0aeb41b9589de9f254e6ce9f57bd77a | refs/heads/master | 2021-08-08T00:50:10.630301 | 2017-11-09T08:10:33 | 2017-11-09T08:10:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 957 | java | package com.gala.sdk.plugin.server.core;
import com.gala.sdk.plugin.AbsPluginProvider;
import com.gala.sdk.plugin.IFeature;
import com.gala.sdk.plugin.Log;
import com.gala.sdk.plugin.server.storage.PluginInfo;
import java.util.List;
public class EmptyPluginProvider extends AbsPluginProvider {
private static final String TAG = "EmptyPluginProvider";
private final PluginInfo mPluginInfo;
public EmptyPluginProvider(PluginInfo info) {
if (Log.VERBOSE) {
Log.v(TAG, "EmptyPluginProvider(info=" + info + ")");
}
this.mPluginInfo = info;
}
public String getId() {
return this.mPluginInfo.getId();
}
public String getName() {
return null;
}
public String getDescription() {
return null;
}
public String getVersionName() {
return this.mPluginInfo.getVersionName();
}
public List<IFeature> getFeatures() {
return null;
}
}
| [
"liuwencai@le.com"
] | liuwencai@le.com |
ffdb358775644df45682949b6e94eae479a1b822 | 8b9190a8c5855d5753eb8ba7003e1db875f5d28f | /sources/com/facebook/widget/text/span/BetterImageSpan.java | 102560c5aa917cea83c06328fc5f9aaca7e1754d | [] | no_license | stevehav/iowa-caucus-app | 6aeb7de7487bd800f69cb0b51cc901f79bd4666b | e3c7eb39de0be6bbfa8b6b063aaa85dcbcee9044 | refs/heads/master | 2020-12-29T10:25:28.354117 | 2020-02-05T23:15:52 | 2020-02-05T23:15:52 | 238,565,283 | 21 | 3 | null | null | null | null | UTF-8 | Java | false | false | 3,124 | java | package com.facebook.widget.text.span;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.style.ReplacementSpan;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
public class BetterImageSpan extends ReplacementSpan {
public static final int ALIGN_BASELINE = 1;
public static final int ALIGN_BOTTOM = 0;
public static final int ALIGN_CENTER = 2;
private final int mAlignment;
private Rect mBounds;
private final Drawable mDrawable;
private final Paint.FontMetricsInt mFontMetricsInt;
private int mHeight;
private int mWidth;
@Retention(RetentionPolicy.SOURCE)
public @interface BetterImageSpanAlignment {
}
public static final int normalizeAlignment(int i) {
if (i != 0) {
return i != 2 ? 1 : 2;
}
return 0;
}
public BetterImageSpan(Drawable drawable) {
this(drawable, 1);
}
public BetterImageSpan(Drawable drawable, int i) {
this.mFontMetricsInt = new Paint.FontMetricsInt();
this.mDrawable = drawable;
this.mAlignment = i;
updateBounds();
}
public Drawable getDrawable() {
return this.mDrawable;
}
public int getSize(Paint paint, CharSequence charSequence, int i, int i2, Paint.FontMetricsInt fontMetricsInt) {
updateBounds();
if (fontMetricsInt == null) {
return this.mWidth;
}
int offsetAboveBaseline = getOffsetAboveBaseline(fontMetricsInt);
int i3 = this.mHeight + offsetAboveBaseline;
if (offsetAboveBaseline < fontMetricsInt.ascent) {
fontMetricsInt.ascent = offsetAboveBaseline;
}
if (offsetAboveBaseline < fontMetricsInt.top) {
fontMetricsInt.top = offsetAboveBaseline;
}
if (i3 > fontMetricsInt.descent) {
fontMetricsInt.descent = i3;
}
if (i3 > fontMetricsInt.bottom) {
fontMetricsInt.bottom = i3;
}
return this.mWidth;
}
public void draw(Canvas canvas, CharSequence charSequence, int i, int i2, float f, int i3, int i4, int i5, Paint paint) {
paint.getFontMetricsInt(this.mFontMetricsInt);
int offsetAboveBaseline = i4 + getOffsetAboveBaseline(this.mFontMetricsInt);
canvas.translate(f, (float) offsetAboveBaseline);
this.mDrawable.draw(canvas);
canvas.translate(-f, (float) (-offsetAboveBaseline));
}
public void updateBounds() {
this.mBounds = this.mDrawable.getBounds();
this.mWidth = this.mBounds.width();
this.mHeight = this.mBounds.height();
}
private int getOffsetAboveBaseline(Paint.FontMetricsInt fontMetricsInt) {
int i = this.mAlignment;
if (i == 0) {
return fontMetricsInt.descent - this.mHeight;
}
if (i != 2) {
return -this.mHeight;
}
return fontMetricsInt.ascent + (((fontMetricsInt.descent - fontMetricsInt.ascent) - this.mHeight) / 2);
}
}
| [
"steve@havelka.co"
] | steve@havelka.co |
46a7ee459e825939900a71a8754523ac2044780b | d33574802593c6bb49d44c69fc51391f7dc054af | /ShipLinx/docs/ws/ShiplinxWSClient/src/main/java/com/meritconinc/shiplinx/ws/proxy/ratingresponse/ObjectFactory.java | e5941ac6f7fd6de318849226adbb73e3ee14d9b3 | [] | no_license | mouadaarab/solushipalertmanagement | 96734a0ff238452531be7f4d12abac84b88de214 | eb4cf67a7fbf54760edd99dc51efa12d74fa058e | refs/heads/master | 2021-12-06T06:09:15.559467 | 2015-10-06T09:00:54 | 2015-10-06T09:00:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,892 | java |
package com.meritconinc.shiplinx.ws.proxy.ratingresponse;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the com.meritconinc.shiplinx.ws.proxy.ratingresponse package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _RatingResponse_QNAME = new QName("http://www.proxy.ws.shiplinx.meritconinc.com/RatingResponse", "RatingResponse");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.meritconinc.shiplinx.ws.proxy.ratingresponse
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link RatingResponseWSType }
*
*/
public RatingResponseWSType createRatingResponseWSType() {
return new RatingResponseWSType();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link RatingResponseWSType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.proxy.ws.shiplinx.meritconinc.com/RatingResponse", name = "RatingResponse")
public JAXBElement<RatingResponseWSType> createRatingResponse(RatingResponseWSType value) {
return new JAXBElement<RatingResponseWSType>(_RatingResponse_QNAME, RatingResponseWSType.class, null, value);
}
}
| [
"harikrishnan.r@mitosistech.com"
] | harikrishnan.r@mitosistech.com |
30a0025b9890274f99bf68dac7852f37f59fb6eb | 0d4f05c9909695a166e97b8958680945ea5c1266 | /src/minecraft/optifine/HttpRequest.java | 54b963b02283ac57df16f6e7b42888d555a5055d | [] | no_license | MertDundar1/ETB-0.6 | 31f3f42f51064ffd7facaa95cf9b50d0c2d71995 | 145d008fed353545157cd0e73daae8bc8d7f50b9 | refs/heads/master | 2022-01-15T08:42:12.762634 | 2019-05-15T23:37:33 | 2019-05-15T23:37:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,736 | java | package optifine;
import java.net.Proxy;
import java.util.LinkedHashMap;
import java.util.Map;
public class HttpRequest
{
private String host = null;
private int port = 0;
private Proxy proxy;
private String method;
private String file;
private String http;
private Map<String, String> headers;
private byte[] body;
private int redirects;
public static final String METHOD_GET = "GET";
public static final String METHOD_HEAD = "HEAD";
public static final String METHOD_POST = "POST";
public static final String HTTP_1_0 = "HTTP/1.0";
public static final String HTTP_1_1 = "HTTP/1.1";
public HttpRequest(String host, int port, Proxy proxy, String method, String file, String http, Map<String, String> headers, byte[] body)
{
this.proxy = Proxy.NO_PROXY;
this.method = null;
this.file = null;
this.http = null;
this.headers = new LinkedHashMap();
this.body = null;
redirects = 0;
this.host = host;
this.port = port;
this.proxy = proxy;
this.method = method;
this.file = file;
this.http = http;
this.headers = headers;
this.body = body;
}
public String getHost()
{
return host;
}
public int getPort()
{
return port;
}
public String getMethod()
{
return method;
}
public String getFile()
{
return file;
}
public String getHttp()
{
return http;
}
public Map<String, String> getHeaders()
{
return headers;
}
public byte[] getBody()
{
return body;
}
public int getRedirects()
{
return redirects;
}
public void setRedirects(int redirects)
{
this.redirects = redirects;
}
public Proxy getProxy()
{
return proxy;
}
}
| [
"realhcfus@gmail.com"
] | realhcfus@gmail.com |
432b99035b6f4fa2da673f25bcd52d804fe9d669 | 6133688185107fdf695a586622737183a09a5736 | /src/Origin/Voting/Commands/topVoter.java | db957b2be0d5cae2b4b027a71e23d27e2327a654 | [] | no_license | joeyoung658/Vote-Store | 6ed6d376e23fa41fcd166399f63187881fa7ed2c | ca3793b2dc8bef90c50c7d7f12f8fda97ff650f6 | refs/heads/master | 2023-02-17T15:39:32.029227 | 2021-01-11T21:08:24 | 2021-01-11T21:08:24 | 315,460,471 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,347 | java | package Origin.Voting.Commands;
import Origin.Voting.Main;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.*;
public class topVoter implements CommandExecutor {
ArrayList<String> votet = new ArrayList<String>(); //Array list to store sorted top voters
//int votesc;
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
if (cmd.getName().equalsIgnoreCase("topvoters")) {
if (!(sender instanceof Player)) {
sender.sendMessage("This command can only be run by a player!");
} else {
Map<Integer, String> map = sortByValues(Main.instance.votec);
//After Sorting
Set set2 = map.entrySet();
Iterator iterator2 = set2.iterator();
int votecs;
votecs = Main.instance.votec.size();
if (!(votecs < 10)) {
while (iterator2.hasNext()) {
Map.Entry me2 = (Map.Entry) iterator2.next();
votet.add(me2.getKey() + ": " + me2.getValue());
}
sender.sendMessage(ChatColor.AQUA + "Exhibit MineCraft Top Voters!");
sender.sendMessage("1) " + ChatColor.GREEN + votet.get(votecs-1));
sender.sendMessage("2) " + ChatColor.GREEN + votet.get(votecs-2));
sender.sendMessage("3) " + ChatColor.GREEN + votet.get(votecs-3));
sender.sendMessage("4) " + ChatColor.GREEN + votet.get(votecs-4));
sender.sendMessage("5) " + ChatColor.GREEN + votet.get(votecs-5));
sender.sendMessage("6) " + ChatColor.GREEN + votet.get(votecs-6));
sender.sendMessage("7) " + ChatColor.GREEN + votet.get(votecs-7));
sender.sendMessage("8) " + ChatColor.GREEN + votet.get(votecs-8));
sender.sendMessage("9) " + ChatColor.GREEN + votet.get(votecs-9));
sender.sendMessage("10) " + ChatColor.GREEN + votet.get(votecs-10));
votet.clear();
} else {
player.sendMessage(ChatColor.DARK_RED + "Ten Players need to vote for the server before this list is active.");
player.sendMessage(ChatColor.DARK_RED + "Currently " + votecs + " players have voted.");
}
}
}
return false;
}
private static HashMap sortByValues(HashMap map) { //all the sorting crap
List list = new LinkedList(map.entrySet());
Collections.sort(list, new Comparator() {
public int compare(Object o1, Object o2) {
return ((Comparable) ((Map.Entry) (o1)).getValue())
.compareTo(((Map.Entry) (o2)).getValue());
}
});
HashMap sortedHashMap = new LinkedHashMap();
for (Iterator it = list.iterator(); it.hasNext(); ) {
Map.Entry entry = (Map.Entry) it.next();
sortedHashMap.put(entry.getKey(), entry.getValue());
}
return sortedHashMap;
}
}
| [
"unconfigured@null.spigotmc.org"
] | unconfigured@null.spigotmc.org |
981c95f92d3b909bed79656d71c11a25c2a9357d | 5dac413219e639d8ab6429a1eff11d78992d9c74 | /server/src/jpaModelgen/java/com/hengyi/japp/cargo/domain/sap/T001l_.java | 4b526e539fa5099c923144864972708bf41f8e59 | [] | no_license | HengYi-JAPP/japp-cargo | 71f800178158dc4948c5f5fa4611165bee404733 | cd3ae0146d1e82790589b8c3755ca217edcea53e | refs/heads/master | 2021-10-20T05:04:40.934915 | 2019-02-26T02:02:36 | 2019-02-26T02:02:36 | 113,652,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 519 | java | package com.hengyi.japp.cargo.domain.sap;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(T001l.class)
public abstract class T001l_ {
public static volatile SingularAttribute<T001l, String> werks;
public static volatile SingularAttribute<T001l, String> lgort;
public static volatile SingularAttribute<T001l, String> lgobe;
}
| [
"ixtf1984@gmail.com"
] | ixtf1984@gmail.com |
7bcbc54599506ed95b346353fb87d86f653531ae | 9f907527f44fdfc33b5add9f8d313bbeb96d1192 | /src/codeforces/contests501_600/problemset583/AsphaltingRoads.java | d357e7438da8d34d6d08547e5cddc461858dda2f | [] | no_license | kocko/algorithms | 7af7052b13a080992dcfbff57171a2cac7c50c67 | 382b6b50538220a26e1af1644e72a4e1796374b6 | refs/heads/master | 2023-08-03T21:15:27.070471 | 2023-08-03T14:39:45 | 2023-08-03T14:39:45 | 45,342,667 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 494 | java | package codeforces.contests501_600.problemset583;
import java.util.Scanner;
public class AsphaltingRoads {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
boolean[] h = new boolean[n + 1];
boolean[] w = new boolean[n + 1];
for (int i = 1; i <= n * n; i++) {
int x = sc.nextInt();
int y = sc.nextInt();
if (!h[x] && !w[y]) {
h[x] = true;
w[y] = true;
System.out.print(i + " ");
}
}
sc.close();
}
}
| [
"konstantin.yovkov@gmail.com"
] | konstantin.yovkov@gmail.com |
1a27f86b442d168e044fc1674f25c827eb33007d | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/main/java/org/gradle/test/performancenull_73/Productionnull_7220.java | 42c76502ac38867dce0ec88f71424b7badd2ebdd | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 585 | java | package org.gradle.test.performancenull_73;
public class Productionnull_7220 {
private final String property;
public Productionnull_7220(String param) {
this.property = param;
}
public String getProperty() {
return property;
}
private String prop0;
public String getProp0() {
return prop0;
}
public void setProp0(String value) {
prop0 = value;
}
private String prop1;
public String getProp1() {
return prop1;
}
public void setProp1(String value) {
prop1 = value;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
8c18f3c515f484522659b0e5ef9decd46b627c84 | 5881bc75e603867fb722a1f1fe722dcbf2a7c128 | /app/src/main/java/com/mgrmobi/brandbeat/profile/ImageItem.java | 1defe7ce3dc02dba3338333002e0fcd5b3379b84 | [] | no_license | knight388/Brandbeat | b52def7d66394b5d21dfab68cb89a51e5f1d4a2c | 7628aeda4994e9bba51f4ac53f9e673753a7a833 | refs/heads/master | 2020-03-11T02:40:28.672292 | 2018-04-16T10:27:34 | 2018-04-16T10:27:34 | 129,725,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 555 | java | package com.mgrmobi.brandbeat.profile;
import android.graphics.Bitmap;
public class ImageItem {
private Bitmap image;
private String title;
public ImageItem(Bitmap image, String title) {
super();
this.image = image;
this.title = title;
}
public Bitmap getImage() {
return image;
}
public void setImage(Bitmap image) {
this.image = image;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
| [
"greatroyalone@outlook.com"
] | greatroyalone@outlook.com |
fc96992b62e1033e0ced0d173116a200f7985686 | a55a53111959bd2c76f6536025a0ca2dcecacafb | /src/test/java/com/theironyard/CalendarSpringApplicationTests.java | 015f360aa8d71573029009aa0cb12cacb7833fcb | [] | no_license | TIY-Charleston-Back-End-May2016/CalendarSpring | e3a61d54fe9d11404b75c17a773b0e7ebedc99d4 | b0261674daca000f18354204e5ea92f4a16e3c12 | refs/heads/master | 2021-01-20T19:58:05.616990 | 2016-06-27T14:25:08 | 2016-06-27T14:25:08 | 61,815,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,829 | java | package com.theironyard;
import com.theironyard.services.EventRepository;
import com.theironyard.services.UserRepository;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MockMvcBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import java.time.LocalDateTime;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = CalendarSpringApplication.class)
@WebAppConfiguration
public class CalendarSpringApplicationTests {
@Autowired
WebApplicationContext wac;
MockMvc mockMvc;
@Before
public void before() {
mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
}
@Autowired
UserRepository users;
@Autowired
EventRepository events;
@Test
public void testLogin() throws Exception {
mockMvc.perform(
MockMvcRequestBuilders.post("/login")
.param("username", "Alice")
.param("password", "mypass")
);
Assert.assertTrue(users.count() == 1);
}
@Test
public void testCreateEvent() throws Exception {
testLogin();
mockMvc.perform(
MockMvcRequestBuilders.post("/create-event")
.param("description", "This is my event")
.param("time", LocalDateTime.now().toString())
.sessionAttr("username", "Alice")
);
Assert.assertTrue(events.count() == 1);
}
}
| [
"zsoakes@gmail.com"
] | zsoakes@gmail.com |
5baa05120f4ad7617aa854a3f553df4746efcd41 | 824b2c5ad186da3e930bd98e940f48bbd4246c7e | /core/src/main/java/cucumber/runtime/arquillian/reporter/CucumberReporter.java | b3120c7991e148bce275f272be93bdebb0c7e16d | [] | no_license | lfryc/cukespace | 8ffefe2950b33326bc38f58b4498c845a16fe5ac | f30462bcaf4960e2376b967c0cf72f75ef0eba61 | refs/heads/master | 2020-12-11T03:58:16.294013 | 2013-10-23T09:21:08 | 2013-10-23T09:21:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,925 | java | package cucumber.runtime.arquillian.reporter;
import cucumber.runtime.arquillian.config.CucumberConfiguration;
import net.masterthought.cucumber.ReportBuilder;
import org.jboss.arquillian.container.spi.event.KillContainer;
import org.jboss.arquillian.container.spi.event.StartContainer;
import org.jboss.arquillian.container.spi.event.StopContainer;
import org.jboss.arquillian.core.api.Instance;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.core.api.annotation.Observes;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Logger;
public class CucumberReporter {
private static final Logger LOGGER = Logger.getLogger(CucumberReporter.class.getName());
private static Set<String> jsonReports;
@Inject
private Instance<CucumberConfiguration> configuration;
public void initOnStart(final @Observes StartContainer startContainer) {
jsonReports = new HashSet<String>();
}
public void reportOnStop(final @Observes StopContainer stopContainer) {
doReport();
}
public void reportOnKill(final @Observes KillContainer stopContainer) {
doReport();
}
public static void addReport(final File path) {
if (jsonReports != null) {
jsonReports.add(path.getAbsolutePath());
}
}
private void doReport() {
if (jsonReports == null || jsonReports.isEmpty()) {
return;
}
{ // remove not existing files
final Iterator<String> files = jsonReports.iterator();
while (files.hasNext()) {
if (!new File(files.next()).exists()) {
files.remove();
}
}
}
{ // generate the report
final File outputDir = new File(configuration.get().getReportDirectory());
try {
new ReportBuilder(new ArrayList<String>(jsonReports),
outputDir, "/", "#", findProjectName(),
false, false, true, false)
.generateReports();
LOGGER.info("Cucumber report available at "
+ new File(outputDir, "feature-overview.html").getAbsolutePath());
} catch (final Exception e) {
throw new IllegalArgumentException(e);
}
}
jsonReports.clear();
CucumberConfiguration.reset();
}
private static String findProjectName() {
File file = new File(".");
while (file != null) {
if (Arrays.asList("target", "classes").contains(file.getName())) {
file = file.getParentFile();
} else {
return file.getName();
}
}
return "Cucumber Report";
}
}
| [
"rmannibucau@apache.org"
] | rmannibucau@apache.org |
32293427e6d47b84c14b9eadb781eb92c6a32abb | 82360764d9160cbb46bd8dcce427f4c26b3cca15 | /ui/src/main/java/org/adoptopenjdk/jitwatch/ui/main/CompilationTableRow.java | e00f7bf98c7d91a13b74dd2dab992a806728309d | [
"BSD-2-Clause-Views"
] | permissive | AdoptOpenJDK/jitwatch | 90d4b39f1e92071a6d5a25a7813b524baf682af6 | afd1dc9717df101f78e9240cab77d6c4e93490cd | refs/heads/master | 2023-08-20T08:56:43.387411 | 2023-07-11T18:59:35 | 2023-07-11T19:15:36 | 13,217,369 | 2,666 | 436 | NOASSERTION | 2023-07-07T07:38:06 | 2013-09-30T14:18:17 | Java | UTF-8 | Java | false | false | 2,485 | java | /*
* Copyright (c) 2013-2016 Chris Newland.
* Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD
* Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki
*/
package org.adoptopenjdk.jitwatch.ui.main;
import org.adoptopenjdk.jitwatch.compilation.CompilationUtil;
import org.adoptopenjdk.jitwatch.model.Compilation;
import org.adoptopenjdk.jitwatch.model.Task;
import org.adoptopenjdk.jitwatch.util.StringUtil;
import static org.adoptopenjdk.jitwatch.core.JITWatchConstants.ZING;
import static org.adoptopenjdk.jitwatch.core.JITWatchConstants.FALCON;
public class CompilationTableRow
{
private final Compilation compilation;
public CompilationTableRow(Compilation compilation)
{
this.compilation = compilation;
}
public int getIndex()
{
return compilation.getIndex();
}
public String getStampQueued()
{
return getTimestampOrNA(compilation.getStampTaskQueued());
}
public String getStampCompilationStart()
{
return getTimestampOrNA(compilation.getStampTaskCompilationStart());
}
public String getStampNMethodEmitted()
{
return getTimestampOrNA(compilation.getStampNMethodEmitted());
}
private String getTimestampOrNA(long stamp)
{
String result;
if (stamp == 0)
{
result = "NA";
}
else
{
result = StringUtil.formatTimestamp(stamp, true);
}
return result;
}
public String getNative()
{
int nativeSize = compilation.getNativeSize();
String result;
if (nativeSize == 0)
{
result = "NA";
}
else
{
result = Integer.toString(nativeSize);
}
return result;
}
public String getCompiler()
{
String result = compilation.getCompiler();
if (result == null)
{
result = "NA";
Task task = compilation.getTagTask();
if (task != null && CompilationUtil.isStaleTask(task))
{
result = "Stale task";
}
}
return result;
}
public String getLevel()
{
String result = null;
int level = compilation.getLevel();
if (level == -1)
{
result = "NA";
}
else
{
result = "Level " + level;
}
return result;
}
public String getLevelDescription(String level)
{
switch (level)
{
case "0":
return "Interpreter";
case "1":
return "C1 full optimization (no profiling)";
case "2":
return "C1 invocation and backedge counters";
case "3":
return "C1 full profiling (invocation and backedge counters + MDO)";
case "4":
return "Server compiler";
default:
return "Unknown compiler level";
}
}
} | [
"chris@chrisnewland.com"
] | chris@chrisnewland.com |
75a8f84e19288cfc51cae2e02a4afa7db2634b56 | d60e287543a95a20350c2caeabafbec517cabe75 | /LACCPlus/Cloudstack/346_2.java | 791e2b4a75df5cb43190b2e30dec3ad9ee5a24db | [
"MIT"
] | permissive | sgholamian/log-aware-clone-detection | 242067df2db6fd056f8d917cfbc143615c558b2c | 9993cb081c420413c231d1807bfff342c39aa69a | refs/heads/main | 2023-07-20T09:32:19.757643 | 2021-08-27T15:02:50 | 2021-08-27T15:02:50 | 337,837,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,682 | java | //,temp,NetscalerResource.java,2786,2812,temp,NetscalerResource.java,2764,2784
//,3
public class xxx {
private void bindServiceToMonitor(final String nsServiceName, final String nsMonitorName) throws ExecutionException {
try {
com.citrix.netscaler.nitro.resource.config.basic.service serviceObject = new com.citrix.netscaler.nitro.resource.config.basic.service();
serviceObject = com.citrix.netscaler.nitro.resource.config.basic.service.get(_netscalerService, nsServiceName);
if (serviceObject != null) {
final com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding serviceMonitor =
new com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding();
serviceMonitor.set_monitor_name(nsMonitorName);
serviceMonitor.set_name(nsServiceName);
serviceMonitor.set_monstate("ENABLED");
s_logger.debug("Trying to bind the monitor :" + nsMonitorName + " to the service :" + nsServiceName);
com.citrix.netscaler.nitro.resource.config.basic.service_lbmonitor_binding.add(_netscalerService, serviceMonitor);
s_logger.debug("Successfully binded the monitor :" + nsMonitorName + " to the service :" + nsServiceName);
}
} catch (final nitro_exception e) {
throw new ExecutionException("Failed to create new monitor :" + nsMonitorName + " due to " + e.getMessage());
} catch (final Exception e) {
throw new ExecutionException("Failed to create new monitor :" + nsMonitorName + " due to " + e.getMessage());
}
}
}; | [
"sgholami@uwaterloo.ca"
] | sgholami@uwaterloo.ca |
7722f6ad5db7d5035ddffb4086ea10cea9a348dc | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/protocal/protobuf/bim.java | 0b97d5813706afc07f127a7c022c5f0384a58da4 | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 3,419 | java | package com.tencent.mm.protocal.protobuf;
import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.LinkedList;
public final class bim extends com.tencent.mm.bt.a
{
public int wLR;
public SKBuiltinBuffer_t wLS;
public int wLT;
public final int op(int paramInt, Object[] paramArrayOfObject)
{
AppMethodBeat.i(123510);
if (paramInt == 0)
{
paramArrayOfObject = (e.a.a.c.a)paramArrayOfObject[0];
paramArrayOfObject.iz(1, this.wLR);
if (this.wLS != null)
{
paramArrayOfObject.iy(2, this.wLS.computeSize());
this.wLS.writeFields(paramArrayOfObject);
}
paramArrayOfObject.iz(3, this.wLT);
AppMethodBeat.o(123510);
paramInt = 0;
}
while (true)
{
return paramInt;
int i;
if (paramInt == 1)
{
i = e.a.a.b.b.a.bs(1, this.wLR) + 0;
paramInt = i;
if (this.wLS != null)
paramInt = i + e.a.a.a.ix(2, this.wLS.computeSize());
paramInt += e.a.a.b.b.a.bs(3, this.wLT);
AppMethodBeat.o(123510);
}
else if (paramInt == 2)
{
paramArrayOfObject = new e.a.a.a.a((byte[])paramArrayOfObject[0], unknownTagHandler);
for (paramInt = com.tencent.mm.bt.a.getNextFieldNumber(paramArrayOfObject); paramInt > 0; paramInt = com.tencent.mm.bt.a.getNextFieldNumber(paramArrayOfObject))
if (!super.populateBuilderWithField(paramArrayOfObject, this, paramInt))
paramArrayOfObject.ems();
AppMethodBeat.o(123510);
paramInt = 0;
}
else if (paramInt == 3)
{
Object localObject1 = (e.a.a.a.a)paramArrayOfObject[0];
bim localbim = (bim)paramArrayOfObject[1];
paramInt = ((Integer)paramArrayOfObject[2]).intValue();
switch (paramInt)
{
default:
paramInt = -1;
AppMethodBeat.o(123510);
break;
case 1:
localbim.wLR = ((e.a.a.a.a)localObject1).BTU.vd();
AppMethodBeat.o(123510);
paramInt = 0;
break;
case 2:
paramArrayOfObject = ((e.a.a.a.a)localObject1).Vh(paramInt);
i = paramArrayOfObject.size();
for (paramInt = 0; paramInt < i; paramInt++)
{
Object localObject2 = (byte[])paramArrayOfObject.get(paramInt);
localObject1 = new SKBuiltinBuffer_t();
localObject2 = new e.a.a.a.a((byte[])localObject2, unknownTagHandler);
for (boolean bool = true; bool; bool = ((SKBuiltinBuffer_t)localObject1).populateBuilderWithField((e.a.a.a.a)localObject2, (com.tencent.mm.bt.a)localObject1, com.tencent.mm.bt.a.getNextFieldNumber((e.a.a.a.a)localObject2)));
localbim.wLS = ((SKBuiltinBuffer_t)localObject1);
}
AppMethodBeat.o(123510);
paramInt = 0;
break;
case 3:
localbim.wLT = ((e.a.a.a.a)localObject1).BTU.vd();
AppMethodBeat.o(123510);
paramInt = 0;
break;
}
}
else
{
paramInt = -1;
AppMethodBeat.o(123510);
}
}
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes8-dex2jar.jar
* Qualified Name: com.tencent.mm.protocal.protobuf.bim
* JD-Core Version: 0.6.2
*/ | [
"172601673@qq.com"
] | 172601673@qq.com |
4b0f17373d6e1246cce1afe0e40991bbeb2b4365 | acab0aa88cb0a6b1cb54e4d1a31d7be748a1b30b | /src/main/java/com/ynz/springdemo/customdatabinder/exceptions/ExceptionHandlers.java | f26c3c88b46f1f9ed4b5bac2022504b3134e2490 | [] | no_license | yichunzhao/custom-data-binder | dab56cc1f3e24fda30921b3d8d8eb61100f344b3 | 8853212f4a988d6fcce16dca100963a036a20a02 | refs/heads/master | 2022-11-23T23:53:13.022263 | 2020-08-06T06:27:05 | 2020-08-06T06:27:05 | 283,377,096 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,557 | java | package com.ynz.springdemo.customdatabinder.exceptions;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.MissingPathVariableException;
import org.springframework.web.bind.MissingRequestHeaderException;
import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
@RestControllerAdvice
public class ExceptionHandlers {
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
public ResponseEntity<String> handleBadRequestInput(MethodArgumentTypeMismatchException mismatchException) {
return ResponseEntity.badRequest().body(mismatchException.getMessage());
}
@ExceptionHandler(ServletRequestBindingException.class)
public ResponseEntity<String> handleMissingRequestHeaderException(ServletRequestBindingException e) {
return ResponseEntity.badRequest().body(e.getMessage());
}
@ExceptionHandler(MissingRequestHeaderException.class)
public ResponseEntity<String> handleMissingRequestHeaderException(MissingRequestHeaderException e) {
return ResponseEntity.badRequest().body(e.getMessage());
}
@ExceptionHandler(MissingPathVariableException.class)
public ResponseEntity<String> handleMissingPathVariableException(MissingPathVariableException e){
return ResponseEntity.badRequest().body(e.getMessage());
}
}
| [
"zhaoyichun@hotmail.com"
] | zhaoyichun@hotmail.com |
95a25138ad3eb1dfe16d5741ef9543af6093f745 | b163dcbd452f507fdd6c07095c6e24d050cc99fd | /src/test/java/com/interviews/dropbox/Id_generator/HeapBitsetGenerator2Test.java | 975aa3ce5c5c3f205218b56ac5e1fb011155e163 | [] | no_license | Shawn0630/Leetcode-Java | 4d98170aceeffcf8a162f0b9d7c91c45b12ea992 | 652acdf08f8818236748992c18eebb6eac135c5c | refs/heads/master | 2022-07-09T17:48:30.084413 | 2022-07-03T23:10:45 | 2022-07-03T23:10:45 | 152,835,428 | 0 | 0 | null | 2022-05-20T22:15:15 | 2018-10-13T04:35:57 | Java | UTF-8 | Java | false | false | 356 | java | package com.interviews.dropbox.Id_generator;
import com.interviews.dropbox.ID_generator.HeapBitSetIDGenerator2;
import com.interviews.dropbox.ID_generator.IDGenerator;
public class HeapBitsetGenerator2Test extends IDGeneratorTest {
@Override
IDGenerator getIDGenerator(int maxRange) {
return new HeapBitSetIDGenerator2(maxRange);
}
}
| [
"sf.jiang.ca@gmail.com"
] | sf.jiang.ca@gmail.com |
1b351a1fb1d6183dae8da038289681a3553f520c | 6a61e393dfad6a6cefdf4f06798917c3a7aee971 | /tests/48_interfaces/interface_36_multi_i_overload.java | 61121146dc1fb6e40b606173414d795b0cf3661a | [] | no_license | kframework/java-semantics | 388bead15b594f3b2478441a5d95c02d7a0ccbf6 | f27067ee7a38d236499992eed1b48064e70680fa | refs/heads/master | 2021-09-22T20:42:43.662165 | 2021-09-15T19:53:33 | 2021-09-15T19:53:33 | 11,711,471 | 14 | 7 | null | 2016-03-16T22:03:02 | 2013-07-27T21:42:38 | Java | UTF-8 | Java | false | false | 1,691 | java | /*
Method Overloading through multiple interface inheritance.
A < (I3, I4). I3 < (I1, I2). I4 < I1.
Each class and interface have a specific version of f(). Test all cases.
*/
public class interface_36_multi_i_overload {
public static void main(String[] args) {
System.out.println("Target var I1:");
I1 i1 = new A();
i1.f((byte)0);
i1.f((short)0);
i1.f((int)0);
i1.f((long)0);
i1.f((char)0);
System.out.println("\nTarget var I2:");
I2 i2 = (I2)i1;
i2.f((byte)0);
i2.f((short)0);
i2.f((int)0);
i2.f((char)0);
System.out.println("\nTarget var I3:");
I3 i3 = (I3)i1;
i3.f((byte)0);
i3.f((short)0);
i3.f((int)0);
i3.f((long)0);
i3.f((char)0);
System.out.println("\nTarget var I4:");
I4 i4 = (I4)i1;
i4.f((byte)0);
i4.f((short)0);
i4.f((int)0);
i4.f((long)0);
i4.f((char)0);
System.out.println("\nTarget var A:");
A a = (A)i1;
a.f((byte)0);
a.f((short)0);
a.f((int)0);
a.f((long)0);
a.f((char)0);
System.out.println("Done!");
}
}
interface I1 {
void q();
void f(long a);
}
interface I2 {
void f(int a);
}
interface I3 extends I1, I2 {
void f(byte a);
}
interface I4 extends I1 {
void f(short a);
}
class A implements I3, I4 {
public void q() {
System.out.println("A.q()");
}
public void f(long a) {
System.out.println("A.f(long)");
}
public void f(int a) {
System.out.println("A.f(int)");
}
public void f(short a) {
System.out.println("A.f(short)");
}
public void f(byte a) {
System.out.println("A.f(byte)");
}
public void f(char a) {
System.out.println("A.f(char)");
}
}
| [
"denis.bogdanas@gmail.com"
] | denis.bogdanas@gmail.com |
925bcb6ab35f7be31ef58dde67a25082a9acdf5e | 536600d7852ee095d48821314561aabf7207ba38 | /app/src/main/java/com/zuoyu/business/zxing/utils/BeepManager.java | 13525eba917f0f0620b26fc9c661041d051be7ec | [] | no_license | Sunnyfor/Business | a85e9705af01092aa4c5d23853f4091c28cee1c8 | 6358f5d1bde37275c8f3f2fd92e1c5602e675c2e | refs/heads/master | 2020-09-30T10:27:32.990519 | 2019-12-11T03:35:58 | 2019-12-11T03:35:58 | 227,269,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,041 | java | /*
* Copyright (C) 2010 ZXing 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 com.zuoyu.business.zxing.utils;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Vibrator;
import android.preference.PreferenceManager;
import android.util.Log;
import com.zuoyu.business.R;
import java.io.Closeable;
import java.io.IOException;
/**
*/
public class BeepManager implements MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener, Closeable {
static final String TAG = BeepManager.class.getSimpleName();
static final float BEEP_VOLUME = 0.10f;
static final long VIBRATE_DURATION = 200L;
final Activity activity;
MediaPlayer mediaPlayer;
boolean playBeep;
boolean vibrate;
public BeepManager(Activity activity) {
this.activity = activity;
this.mediaPlayer = null;
updatePrefs();
}
synchronized void updatePrefs() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
playBeep = shouldBeep(prefs, activity);
vibrate = true;
if (playBeep && mediaPlayer == null) {
// The volume on STREAM_SYSTEM is not adjustable, and users found it
// too loud,
// so we now play on the music stream.
activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = buildMediaPlayer(activity);
}
}
public synchronized void playBeepSoundAndVibrate() {
if (playBeep && mediaPlayer != null) {
mediaPlayer.start();
}
if (vibrate) {
Vibrator vibrator = (Vibrator) activity.getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(VIBRATE_DURATION);
}
}
static boolean shouldBeep(SharedPreferences prefs, Context activity) {
boolean shouldPlayBeep = true;
if (shouldPlayBeep) {
// See if sound settings overrides this
AudioManager audioService = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
shouldPlayBeep = false;
}
}
return shouldPlayBeep;
}
MediaPlayer buildMediaPlayer(Context activity) {
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setOnCompletionListener(this);
mediaPlayer.setOnErrorListener(this);
try {
AssetFileDescriptor file = activity.getResources().openRawResourceFd(R.raw.beep);
try {
mediaPlayer.setDataSource(file.getFileDescriptor(), file.getStartOffset(), file.getLength());
} finally {
file.close();
}
mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
mediaPlayer.prepare();
return mediaPlayer;
} catch (IOException ioe) {
Log.w(TAG, ioe);
mediaPlayer.release();
return null;
}
}
@Override
public void onCompletion(MediaPlayer mp) {
// When the beep has finished playing, rewind to queue up another one.
mp.seekTo(0);
}
@Override
public synchronized boolean onError(MediaPlayer mp, int what, int extra) {
if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
// we are finished, so put up an appropriate error toast if required
// and finish
activity.finish();
} else {
// possibly media player error, so release and recreate
mp.release();
mediaPlayer = null;
updatePrefs();
}
return true;
}
@Override
public synchronized void close() {
if (mediaPlayer != null) {
mediaPlayer.release();
mediaPlayer = null;
}
}
}
| [
"yongzuo.chen@foxmail.com"
] | yongzuo.chen@foxmail.com |
351d3ff6d1463a2ba24edeccda7f101463191f20 | d6cadbd258af1813e43a948c0798b36135852ebc | /src/test/java/AppiumDay1/POM/PF_calc.java | 40d56a8554bdeda7cafb0ac50d5d0a4cd1fb04cd | [] | no_license | Raajalaxmi/MobileAutomation | 0bc3033832526a37157850c31faf695eb3bc9b28 | e4f5ff56646a491c6f96ac0de13255f7c075b237 | refs/heads/master | 2023-05-11T10:55:40.026674 | 2020-02-29T09:49:29 | 2020-02-29T09:49:29 | 243,940,835 | 0 | 0 | null | 2023-05-09T18:45:44 | 2020-02-29T09:33:29 | Java | UTF-8 | Java | false | false | 1,094 | java | package AppiumDay1.POM;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.pagefactory.AndroidBy;
import io.appium.java_client.pagefactory.AndroidFindBy;
import io.appium.java_client.pagefactory.AppiumFieldDecorator;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.support.PageFactory;
import org.w3c.dom.html.HTMLInputElement;
import java.time.Duration;
public class PF_calc {
private static final String packageName="com.android.calculator2:id/";
AndroidDriver driver;
public PF_calc(AndroidDriver driver)
{
this.driver=driver;
PageFactory.initElements(new AppiumFieldDecorator(driver, Duration.ofSeconds(5)),this);
}
@AndroidFindBy(id=packageName+"digit_5")
private MobileElement thisIs5;
@AndroidFindBy(id=packageName+"op_add")
private MobileElement thisIsAdd;
@AndroidFindBy(id=packageName+"eq")
private MobileElement thisIsEqual;
@AndroidFindBy(id=packageName+"result")
private MobileElement thisIsResult;
}
| [
"apple@Apples-MacBook-Pro.local"
] | apple@Apples-MacBook-Pro.local |
caa9bfc3575af85bb0501dee0c87c43edd177d1a | 58b9413658d9ebe9d54949010c02213298395ed1 | /wade-gateway/src/main/java/com/wade/gateway/ftp/server/op/impl/UploadFile.java | 397a4fa78150a3b9d0dc6e3dec55128332f3bd77 | [] | no_license | kkoo301/wade-root | d5fce9e5fe0b86ed4d0bbd9291b4f34bc7d2335a | 067aee1d6ad2cb1fa8027adf821e1e733a971d4a | refs/heads/master | 2020-04-26T08:30:41.191338 | 2018-05-08T02:32:34 | 2018-05-08T02:32:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,896 | java | package com.wade.gateway.ftp.server.op.impl;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.log4j.Logger;
import com.wade.container.server.Request;
import com.ailk.org.apache.commons.io.IOUtils;
import com.wade.gateway.ftp.client.FTPClient;
import com.wade.gateway.ftp.server.op.AbstractOperation;
import com.wade.gateway.ftp.server.FtpSite;
import com.wade.gateway.ftp.server.FtpSiteFactory;
import com.wade.gateway.ftp.util.FTPClientFactory;
import com.wade.gateway.ftp.util.IFTPClient;
/**
* Copyright: Copyright (c) 2014 Asiainfo
*
* @className: UploadFile
* @description: 文件上传
*
* @version: v1.0.0
* @author: zhoulin2
* @date: 2014-11-24
*/
public final class UploadFile extends AbstractOperation {
private static final Logger log = Logger.getLogger(UploadFile.class);
/**
* 模拟上传请求: curl -F upload=@/root/biz.log http://192.168.245.1:8080
*/
@Override
public void execute(String siteId, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException {
if (!ServletFileUpload.isMultipartContent(request)) {
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().print("is not multipart content!");
baseRequest.setHandled(true);
return;
}
Map<String, String> params = new HashMap<String, String>();
// 构造一个文件上传处理对象
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
File uploaderFile = null;
InputStream is = null;
ServletOutputStream sos = null;
try {
// 解析表单中提交的所有文件内容
Iterator<FileItem> iter = upload.parseRequest(request).iterator();
while (iter.hasNext()) {
FileItem item = iter.next();
if (item.isFormField()) {
String paramName = item.getFieldName();
String paramValue = item.getString();
params.put(paramName, paramValue);
} else {
String name = item.getName();
String fileName = name.substring(name.lastIndexOf('\\') + 1, name.length());
String path = FTPClient.FTP_GATEWAY_TEMPDIR + File.separatorChar + fileName;
uploaderFile = new File(path);
item.write(uploaderFile);
}
}
String fileName = params.get("FILE_NAME");
is = new FileInputStream(uploaderFile);
FtpSite ftpSite = FtpSiteFactory.getInstance(siteId);
String filePath = super.buildAbsolutePath(ftpSite, fileName);
IFTPClient client = FTPClientFactory.getInstance(ftpSite);
if (!client.uploadFile(is, filePath)) {
throw new Exception(UploadFile.class.getName() + " 执行失败!");
}
} catch (Exception e) {
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
baseRequest.setHandled(true);
String exceptionInfo = super.formatException(e);
sos = response.getOutputStream();
sos.write(exceptionInfo.getBytes());
log.error(exceptionInfo);
} finally {
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(sos);
if (null != uploaderFile) {
uploaderFile.delete();
}
}
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
baseRequest.setHandled(true);
}
}
| [
"21550566@qq.com"
] | 21550566@qq.com |
8163e423baa472816503c9ffc2356f8f16f448ad | 402f03e1b61b7827f4716cd5529ed1774768ea1d | /app/src/main/java/ameircom/keymedia/Activity/StartyAnimActivity.java | 61fbfaa9c3dd2917e9585804fa4c5797856a12d3 | [
"Apache-2.0"
] | permissive | Sotra970/KeyMedia-master | 25141fc3c22ae656de957b4a87380ae7ff9da315 | 17c2735db8aae5f8149a30ecfbb5a871edfb5e0e | refs/heads/master | 2021-01-21T11:03:48.738791 | 2017-03-01T06:49:14 | 2017-03-01T06:49:14 | 83,521,970 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,087 | java | package ameircom.keymedia.Activity;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AnimationUtils;
import ameircom.keymedia.AppManger.AppController;
import ameircom.keymedia.R;
public class StartyAnimActivity extends AppCompatActivity {
View logoplay , logoKey , scaledView , logoname , inplay , logoshadow;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_starty_anim);
logoKey = findViewById(R.id.logoKey);
logoplay = findViewById(R.id.logoplay);
logoname = findViewById(R.id.logoName);
scaledView = findViewById(R.id.scaledView);
inplay = findViewById(R.id.inplay);
logoshadow = findViewById(R.id.logoshadow);
overridePendingTransition(0,0);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// your code to start second activity. Will wait for 3.5 seconds before calling this method
// AppController.getInstance().getPrefManager().clear();
if (AppController.getInstance().getPrefManager().getUser()==null)
startActivity(new Intent(getApplicationContext(),LoginActivity.class));
else
startActivity(new Intent(getApplicationContext(),HomeActivity.class));
finish();
}
}, 3500);
scaledView.animate()
.scaleX(1)
.scaleY(1)
.setDuration(1500)
.setInterpolator(new FastOutSlowInInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
inplay.animate().alpha(0).setDuration(500).setStartDelay(200).setInterpolator(new FastOutSlowInInterpolator()).start();
logoKey.animate().alpha(1).setDuration(500).setStartDelay(1200).setInterpolator(new FastOutSlowInInterpolator()).start();
}
@Override
public void onAnimationEnd(Animator animation) {
// scaledView.animate().translationY(0).setDuration(200).setInterpolator(new AccelerateInterpolator());
logoshadow.animate().alpha(1).setStartDelay(50).setDuration(500).setInterpolator(new AccelerateInterpolator()).start();
logoname.animate().translationY(25f).alpha(1).setStartDelay(200).setDuration(500).setInterpolator(new FastOutSlowInInterpolator()).start();
}
}).setStartDelay(1000).start();
;
}
}
| [
"abdelstar.ahmed97@gmail.com"
] | abdelstar.ahmed97@gmail.com |
4131d58dbc2d7c7be25243dd4bdf95b19fdb6791 | 5bfcdd2005650356bdb8d3e62f429a9a151569dd | /src/main/java/com/tulane/week/LeetCode_20.java | 97ff06c21031fbc98c5a85e155e1c273460fe468 | [] | no_license | Tureen/arith | 59baa7fb6872a64ee117b30aa44c475aca7bd371 | 628807c0fa72657c3872e642edbbae8f76f758a5 | refs/heads/master | 2022-06-24T02:33:33.912982 | 2021-03-10T06:28:37 | 2021-03-10T06:28:37 | 218,268,026 | 0 | 0 | null | 2021-04-26T19:38:01 | 2019-10-29T11:09:06 | Java | UTF-8 | Java | false | false | 1,387 | java | package com.tulane.week;
/**
* 有效的括号
* <p>
* 给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效。
* <p>
* 有效字符串需满足:
* <p>
* 左括号必须用相同类型的右括号闭合。
* 左括号必须以正确的顺序闭合。
* 注意空字符串可被认为是有效字符串。
* <p>
* 示例 1:
* <p>
* 输入: "()"
* 输出: true
* 示例 2:
* <p>
* 输入: "()[]{}"
* 输出: true
* 示例 3:
* <p>
* 输入: "(]"
* 输出: false
* 示例 4:
* <p>
* 输入: "([)]"
* 输出: false
* 示例 5:
* <p>
* 输入: "{[]}"
* 输出: true
*/
import java.util.Stack;
/**
* 栈 抵消法
*/
public class LeetCode_20 {
public boolean isValid(String s) {
Stack stack = new Stack();
char[] chars = s.toCharArray();
for (char aChar : chars) {
if (aChar == '(') stack.push(')');
if (aChar == '[') stack.push(']');
if (aChar == '{') stack.push('}');
if (aChar == ')' && (stack.isEmpty() || (char) stack.pop() != aChar)) return false;
if (aChar == ']' && (stack.isEmpty() || (char) stack.pop() != aChar)) return false;
if (aChar == '}' && (stack.isEmpty() || (char) stack.pop() != aChar)) return false;
}
if(!stack.isEmpty()) return false;
return true;
}
}
| [
"dpzhuming@szeastroc.com"
] | dpzhuming@szeastroc.com |
319ff4b69b96e4e9fca1da606ffdb5ef4f45b4ab | 59a1c9a75f6d82a8872499bee3f4c0e62e4cbb99 | /src/com/javarush/test/level10/lesson11/home10/Solution.java | 6fe7a1c5591e753a5f5cb8682f736071827bbcf9 | [] | no_license | Mistes/MyRep | 9dbfcfc391510be739dca19ced3eafcc52a43444 | 1700a6f1c04f31a40a9dc1312f7a9125f61e7119 | refs/heads/master | 2020-04-06T04:12:20.857417 | 2016-10-11T08:01:16 | 2016-10-11T08:01:16 | 57,094,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,596 | java | package com.javarush.test.level10.lesson11.home10;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
/* Безопасное извлечение из списка
Создать список целых чисел. Ввести с клавиатуры 20 целых чисел. Создать метод по безопасному извлечению чисел из списка:
int safeGetElement(ArrayList<Integer> list, int index, int defaultValue)
Метод должен возвращать элемент списка (list) по его индексу (index). Если в процессе получения элемента возникло исключение, его нужно перехватить, и метод должен вернуть defaultValue.
*/
public class Solution
{
public static void main(String[] args) throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> list = new ArrayList<Integer>();
for (int i = 0; i < 20; i++)
{
int x = Integer.parseInt(reader.readLine());
list.add(x);
}
System.out.println(safeGetElement(list, 5, 1));
System.out.println(safeGetElement(list, 20, 7));
System.out.println(safeGetElement(list, -5, 9));
}
public static int safeGetElement(ArrayList<Integer> list, int index, int defaultValue)
{
try{
return list.get(index);
}
catch (Exception e){
return defaultValue;
}
}
}
| [
"kurilenko.dm@gmail.com"
] | kurilenko.dm@gmail.com |
d6ca327a7d27bdf2e406ccbe24567aa86f28702d | 0915dc2f6d625571fe9fef5ca851b43a951992a0 | /src/main/data-access/jetbrick/dao/log/JdbcLogPreparedStatement.java | e7c63befebdd0ee5917470d80c1ab17cf815c058 | [] | no_license | subchen/jetbrick-legacy | 3936d6ffb1a5f4a83cf942c6b62c568f0f0e57ca | ac6470cee724190aace0008ee0d99d67b33cc4c1 | refs/heads/master | 2023-06-15T20:25:04.666990 | 2014-05-11T12:58:56 | 2014-05-11T12:58:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,511 | java | package jetbrick.dao.log;
import java.lang.reflect.*;
import java.sql.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* PreparedStatement Wrapper to add logging
*/
public class JdbcLogPreparedStatement extends JdbcLogSupport implements InvocationHandler {
private static final Logger log = LoggerFactory.getLogger(JdbcLogPreparedStatement.class);
private PreparedStatement statement;
private String sql;
private JdbcLogPreparedStatement(PreparedStatement stmt, String sql) {
this.statement = stmt;
this.sql = sql;
}
@Override
public Object invoke(Object proxy, Method method, Object[] params) throws Throwable {
try {
Object value = method.invoke(statement, params);
if (EXECUTE_METHODS.contains(method.getName())) {
if (log.isDebugEnabled()) {
log.debug("#{} PreparedStatement.{}(): {}", id, method.getName(), formatSQL(sql));
log.debug("#{} Parameters: {}", id, getParamValueList());
log.debug("#{} Types: {}", id, getParamTypeList());
}
resetParamsInfo();
}
if (RESULTSET_METHODS.contains(method.getName())) {
if (value != null && value instanceof ResultSet) {
value = JdbcLogResultSet.getInstance((ResultSet) value);
}
} else if (SET_METHODS.contains(method.getName())) {
if ("setNull".equals(method.getName())) {
addParam(params[0], null);
} else {
addParam(params[0], params[1]);
}
}
return value;
} catch (Throwable t) {
throw unwrapThrowable(t);
}
}
/**
* Creates a logging version of a PreparedStatement
*
* @param stmt
* - the statement
* @param sql
* - the sql statement
* @return - the proxy
*/
public static PreparedStatement getInstance(PreparedStatement stmt, String sql) {
if (stmt instanceof JdbcLogPreparedStatement) {
return stmt;
} else {
InvocationHandler handler = new JdbcLogPreparedStatement(stmt, sql);
ClassLoader cl = PreparedStatement.class.getClassLoader();
return (PreparedStatement) Proxy.newProxyInstance(cl, new Class[] { PreparedStatement.class, CallableStatement.class }, handler);
}
}
}
| [
"subchen@gmail.com"
] | subchen@gmail.com |
252beb14d95ca8eb60609c83c8450ca269a18d17 | 9069632dc33680c536de44e891ff110a3bb554fb | /gmall-manage-service/src/main/java/com/jihu/gmall/manage/service/impl/SkuServiceImpl.java | 33d390ca3a87d483fa7f97d4018ff5520363b992 | [] | no_license | Springhuge/gmall1031 | 825a2f6e5eef343a8630422475be2c9e553717f6 | a518be2516655246f55c13c61b05edd9ac22e536 | refs/heads/master | 2022-09-30T18:48:42.883786 | 2020-01-07T13:04:17 | 2020-01-07T13:04:17 | 218,785,624 | 5 | 0 | null | 2022-09-01T23:15:05 | 2019-10-31T14:30:27 | Java | UTF-8 | Java | false | false | 6,008 | java | package com.jihu.gmall.manage.service.impl;
import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.fastjson.JSON;
import com.jihu.gmall.bean.PmsSkuAttrValue;
import com.jihu.gmall.bean.PmsSkuImage;
import com.jihu.gmall.bean.PmsSkuInfo;
import com.jihu.gmall.bean.PmsSkuSaleAttrValue;
import com.jihu.gmall.manage.mapper.PmsSkuImageMapper;
import com.jihu.gmall.manage.mapper.PmsSkuSaleAttrValueMapper;
import com.jihu.gmall.manage.mapper.PmsskuAttrValueMapper;
import com.jihu.gmall.manage.mapper.PmsskuInfoMapper;
import com.jihu.gmall.service.SkuService;
import com.jihu.gmall.util.RedisUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import redis.clients.jedis.Jedis;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@Service
public class SkuServiceImpl implements SkuService {
@Autowired
private PmsskuInfoMapper pmsskuInfoMapper;
@Autowired
private PmsskuAttrValueMapper pmsskuAttrValueMapper;
@Autowired
private PmsSkuSaleAttrValueMapper pmsSkuSaleAttrValueMapper;
@Autowired
private PmsSkuImageMapper pmsSkuImageMapper;
@Autowired
private RedisUtil redisUtil;
@Override
public void saveSkuInfo(PmsSkuInfo pmsSkuInfo) {
//插入skuInfo
int i = pmsskuInfoMapper.insert(pmsSkuInfo);
//插入平台属性关联
List<PmsSkuAttrValue> pmsSkuAttrValues = pmsSkuInfo.getSkuAttrValueList();
for (PmsSkuAttrValue pmsSkuAttrValue : pmsSkuAttrValues) {
pmsSkuAttrValue.setSkuId(pmsSkuInfo.getId());
pmsskuAttrValueMapper.insertSelective(pmsSkuAttrValue);
}
//插入销售属性关联
List<PmsSkuSaleAttrValue> pmsSkuSaleAttrValues = pmsSkuInfo.getSkuSaleAttrValueList();
for (PmsSkuSaleAttrValue pmsSkuSaleAttrValue : pmsSkuSaleAttrValues) {
pmsSkuSaleAttrValue.setSkuId(pmsSkuInfo.getId());
pmsSkuSaleAttrValueMapper.insertSelective(pmsSkuSaleAttrValue);
}
//插入图片信息
List<PmsSkuImage> pmsSkuImages = pmsSkuInfo.getSkuImageList();
for (PmsSkuImage pmsSkuImage : pmsSkuImages) {
pmsSkuImage.setSkuId(pmsSkuInfo.getId());
pmsSkuImageMapper.insertSelective(pmsSkuImage);
}
}
public PmsSkuInfo getSkuByIdFromDb(String skuId){
//商品对象
PmsSkuInfo pmsSkuInfo = new PmsSkuInfo();
pmsSkuInfo.setId(skuId);
PmsSkuInfo skuInfo = pmsskuInfoMapper.selectOne(pmsSkuInfo);
//sku商品集合
PmsSkuImage pmsSkuImage = new PmsSkuImage();
pmsSkuImage.setSkuId(skuId);
List<PmsSkuImage> pmsSkuImages = pmsSkuImageMapper.select(pmsSkuImage);
skuInfo.setSkuImageList(pmsSkuImages);
return skuInfo;
}
@Override
public PmsSkuInfo getSkuById(String skuId,String ip) {
PmsSkuInfo skuInfo = new PmsSkuInfo();
//连接缓存
Jedis jedis = redisUtil.getJedis();
try {
//查询缓存
String skuKey = "sku:"+skuId+":info";
String skuJson = jedis.get(skuKey);
if(StringUtils.isNotBlank(skuJson)){
skuInfo = JSON.parseObject(skuJson, PmsSkuInfo.class);
}else{
//如果缓存中没有,查询mysql
//设置分布式锁
String token = UUID.randomUUID().toString();
String OK = jedis.set("sku:"+skuId+":lock",token,"nx","px",10*1000);//拿到锁的线程有10秒的过期时间
if(StringUtils.isNotBlank(OK) && OK.equals("OK")){
//设置成功,有权在10秒的过期时间内访问数据库
skuInfo = getSkuByIdFromDb(skuId);
if(skuInfo != null){
//mysql查询结果存入redis
jedis.set("sku:"+skuId+":info",JSON.toJSONString(skuInfo));
}else{
//数据库不存在该sku
//为了防止缓存穿透,null值设置给redis
//3分钟以内缓存不会达到数据库中
jedis.setex("sku:"+skuId+":info",60*3,JSON.toJSONString(""));
}
//在访问MySQL后,将mysql的分布式锁释放;
String lockToken = jedis.get("sku:"+skuId+":lock");
if(StringUtils.isNotBlank(lockToken)&&lockToken.equals(token)){
//jedis.eval("lua"):可以用lua脚本,在查询到key的同时删除该key,防止高并发下的意外的发生
jedis.del("sku:"+skuId+":lock");//用自己的token确认删除的是自己等待sku的锁
}
}else{
//设置失败,自旋(该线程在睡眠几秒后,重新尝试访问本方法)
return getSkuById(skuId,ip);
}
}
}catch (Exception e){
e.printStackTrace();
}finally {
jedis.close();
}
return skuInfo;
}
@Override
public List<PmsSkuInfo> getSkuSaleAttrValueListBySpu(String productId) {
List<PmsSkuInfo> pmsSkuInfos = pmsskuInfoMapper.selectSkuSaleAttrValueListBySpu(productId);
return pmsSkuInfos;
}
/**
* 获取所有的SkuInfo
* @return
*/
@Override
public List<PmsSkuInfo> getAllSku() {
List<PmsSkuInfo> pmsSkuInfos = pmsskuInfoMapper.selectAll();
for (PmsSkuInfo pmsSkuInfo : pmsSkuInfos) {
String skuId = pmsSkuInfo.getId();
PmsSkuAttrValue pmsSkuAttrValue = new PmsSkuAttrValue();
pmsSkuAttrValue.setSkuId(skuId);
List<PmsSkuAttrValue> pmsSkuAttrValues = pmsskuAttrValueMapper.select(pmsSkuAttrValue);
pmsSkuInfo.setSkuAttrValueList(pmsSkuAttrValues);
}
return pmsSkuInfos;
}
}
| [
"529581062@qq.com"
] | 529581062@qq.com |
4ca5df2c1836f74afd72c3ef6f9a89619393dfe9 | 4af63f589a13bfe66872dc86861ffff231025b9d | /code/iaas/lb-logic/src/main/java/io/cattle/iaas/lb/service/LoadBalancerService.java | 9b64220287a3774dd3cbc4d30b64803ee62aaa4c | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | cglewis/cattle | 0601f3bdb1d6cda97bcecc7d64637437637959b3 | b0eddd38e1a2fb6f7b00174277e7d52488259cff | refs/heads/master | 2023-04-08T02:57:18.805367 | 2015-05-27T22:54:16 | 2015-05-27T22:54:16 | 36,400,338 | 0 | 0 | Apache-2.0 | 2023-04-04T00:23:07 | 2015-05-27T22:45:02 | Java | UTF-8 | Java | false | false | 1,375 | java | package io.cattle.iaas.lb.service;
import io.cattle.platform.core.model.LoadBalancer;
import io.cattle.platform.core.model.LoadBalancerConfig;
import io.cattle.platform.core.model.LoadBalancerHostMap;
import java.util.Map;
public interface LoadBalancerService {
void addListenerToConfig(LoadBalancerConfig config, long listenerId);
void removeListenerFromConfig(LoadBalancerConfig config, long listenerId);
void addTargetToLoadBalancer(LoadBalancer lb, long instanceId);
void addTargetIpToLoadBalancer(LoadBalancer lb, String ipAddress);
void removeTargetFromLoadBalancer(LoadBalancer lb, long instanceId);
void removeTargetIpFromLoadBalancer(LoadBalancer lb, String ipAddress);
/**
* adds a particular host to the load balancer
*
* @param lb
* @param hostId
*/
void addHostToLoadBalancer(LoadBalancer lb, long hostId);
/**
* requests any host to be added to the load balancer - the decision which host is delegated to allocator
*
* @param lb
* @param data TODO
* @return TODO
*/
LoadBalancerHostMap addHostWLaunchConfigToLoadBalancer(LoadBalancer lb, Map<String, Object> data);
/**
* removes a particular host from the load balancer
*
* @param lb
* @param hostId
*/
void removeHostFromLoadBalancer(LoadBalancer lb, long hostId);
}
| [
"alena@rancher.com"
] | alena@rancher.com |
0be9c71c05e341ee91f63ed1be83440c657c9ebc | 1b5987a7e72a58e12ac36a36a60aa6add2661095 | /code/org/processmining/mining/dmcscanning/freqstat/FrequencyStatistics.java | fc057178f54a59664b11eb38ab61f8d0889c2551 | [] | no_license | qianc62/BePT | f4b1da467ee52e714c9a9cc2fb33cd2c75bdb5db | 38fb5cc5521223ba07402c7bb5909b17967cfad8 | refs/heads/master | 2021-07-11T16:25:25.879525 | 2020-09-22T10:50:51 | 2020-09-22T10:50:51 | 201,562,390 | 36 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,550 | java | /*
* Created on Jun 17, 2005
*
* Author: Christian W. Guenther (christian at deckfour dot org)
* (c) 2005 Technische Universiteit Eindhoven, Christian W. Guenther
* all rights reserved
*
* LICENSE WARNING:
* This code has been created within the realm of an STW project.
* The question of under which license to publish this code, or whether
* to have it published openly at all, is still unclear.
* Before this code can be released in any form, be it binary or source
* code, this issue has to be clarified with the STW.
* Please do not add this file to any build or source export transferred
* to anybody outside the TM.IS group.
*/
package org.processmining.mining.dmcscanning.freqstat;
import java.util.Iterator;
import java.util.TreeMap;
/**
* Class for keeping statistics of and performing analysis on the frequency in
* which (low-level) events occur.
*
* @author Christian W. Guenther (christian at deckfour dot org)
*/
public class FrequencyStatistics {
protected TreeMap distances = null;
protected long entryCounter = 0;
protected long valueCounter = 0;
/**
* constructor
*/
public FrequencyStatistics() {
initialize();
}
/**
* resets the object to its initial state
*/
public void initialize() {
distances = new TreeMap();
entryCounter = 0;
valueCounter = 0;
}
/**
* adds a newly discovered value to the set
*
* @param distance
*/
public void addValue(long distance) {
Long distObj = new Long(distance);
Long countObj = null;
if (distances.containsKey(distObj)) {
countObj = (Long) distances.get(distObj);
} else {
countObj = new Long(0);
valueCounter++;
}
countObj = new Long(countObj.longValue() + 1);
distances.put(distObj, countObj);
entryCounter++;
}
/**
* @return the total number of represented values
*/
public long getNumberOfEntries() {
return entryCounter;
}
/**
* @return the number of distinct represented values
*/
public long getNumberOfValues() {
return valueCounter;
}
/**
* @return the smallest value stored
*/
public long getMinValue() {
return ((Long) distances.get(distances.lastKey())).longValue();
}
/**
* @return the largest value stored
*/
public long getMaxValue() {
return ((Long) distances.get(distances.firstKey())).longValue();
}
/**
* Retrieves, for a given value, the number of entries that have been stored
* with that value (e.g., how many times '5' has been stored).
*
* @param value
* @return
*/
public long getNumberOfEntriesForValue(long value) {
Long valObj = new Long(value);
if (distances.containsKey(valObj)) {
return ((Long) distances.get(valObj)).longValue();
} else {
return 0;
}
}
/**
* Retrieves the number of recorded values within a given interval. The
* interval is interpreted as: [minVal, maxVal] (boundary-inlcusive).
*
* @param minVal
* @param maxVal
* @return
*/
public long getNumberOfEntriesBetweenValues(long minVal, long maxVal) {
Long keyObj = null;
long result = 0;
for (Iterator it = distances.keySet().iterator(); it.hasNext();) {
keyObj = (Long) it.next();
if ((keyObj.longValue() >= minVal)
&& (keyObj.longValue() <= maxVal)) {
result += ((Long) distances.get(keyObj)).longValue();
}
}
return result;
}
/**
* Creates an array of distribution values for e.g. displaying results in a
* plotted graph.
*
* @param maxValue
* the value the highest number of occurrences should be mapped
* to (e.g., display graph height)
* @param granularity
* the number of values to normalize to
* @return an integer array of size 'granularity', with values between [0,
* maxValue].
*/
public int[] getNormalizedDistribution(int maxValue, int granularity) {
long values[] = new long[granularity];
long maxOccurred = 0;
int normalized[] = new int[granularity];
long leftBoundary = getMinValue();
long rightBoundary = getMaxValue();
if ((rightBoundary - leftBoundary) <= 0) {
return null;
}
long step = ((rightBoundary - leftBoundary) / granularity);
// build initial array
for (int i = 0; i < granularity; i++) {
values[i] = getNumberOfEntriesBetweenValues((i * step),
((i + 1) * step));
if (values[i] > maxOccurred) {
maxOccurred = values[i];
}
}
// normalize array
double normalizationFactor = (double) maxValue / (double) maxOccurred;
for (int i = 0; i < granularity; i++) {
normalized[i] = (int) (values[i] * normalizationFactor);
}
return normalized;
}
}
| [
"qianc62@gmail.com"
] | qianc62@gmail.com |
af3a0114835c478dfb70e9fdb325d36564b022e0 | 47034e7fcb058b3df4bf5928455951e5f455897e | /winstonejsspserver/src/main/java/me/hatter/tools/jsspserver/auth/CSRFMark.java | 5caa8e8b894793fbe3fcf26d17b98bfba426e3b6 | [] | no_license | KingBowser/hatter-source-code | 2858a651bc557e3aacb4a07133450f62dc7a15c6 | f10d4f0ec5f5adda1baa942e179f76301ebc328a | refs/heads/master | 2021-01-01T06:49:52.889183 | 2015-03-21T17:00:28 | 2015-03-21T17:00:28 | 32,662,581 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package me.hatter.tools.jsspserver.auth;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface CSRFMark {
String csrfToken() default "__csrf";
}
| [
"jht5945@gmail.com@dd6f9e7e-b4fe-0bd6-ab9c-0ed876a8e821"
] | jht5945@gmail.com@dd6f9e7e-b4fe-0bd6-ab9c-0ed876a8e821 |
94e93c9b9e10b3ea562e89eb4972bb30772f3878 | c4638fb5cd103f3727a9f34c48fcce2d781ace4f | /src/main/java/com/wondersgroup/human/bo/ofc/Probation.java | 26d84f8accaf203ee832adb9973503c6ca605145 | [] | no_license | elang3000/human | 78befe2a4ed6b99abba5ba6a6350c98c00182159 | 74a7c764a287c513422edb3d30827c2b1ca6290f | refs/heads/master | 2020-04-04T09:31:40.587628 | 2019-01-10T09:33:17 | 2019-01-10T09:33:17 | 155,821,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,975 | java | /**
* Copyright © 2018 . All rights reserved.万达信息股份有限公司
* 文件名: Post.java
* 工程名: human
* 包名: com.wondersgroup.human.bo.ofc
* 描述:上海 试用信息
* 创建人: jiang
* 创建时间: 2018年6月11日15:07:37
* 版本号: V1.0
* 修改人:jiang
* 修改时间:2018年6月11日15:07:44
* 修改任务号
* 修改内容:
*/
package com.wondersgroup.human.bo.ofc;
import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import com.wondersgroup.human.bo.ofc.base.BaseProbation;
/**
* @ClassName: Probation
* @Description: 上海 试用信息
* @author: jiang
* @date: 2018年6月11日15:29:28
* @version [版本号, YYYY-MM-DD]
* @see [相关类/方法]
* @since [产品/模块版本]
*/
@Entity
@Table(name = "A04")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Probation extends BaseProbation<Probation> {
private static final long serialVersionUID = -7723149048609461891L;
/**
* @fieldName: servant
* @fieldType: com.wondersgroup.human.bo.ofc.Servant
* @Description: 人员信息主表信息。
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "SERVANT_ID")
private Servant servant;
/**
* @fieldName: 试用单位代码
* @fieldType: java.lang.String
* @Description: 试用单位代码。
*/
@Column(name = "SH_B0110")
private String unitCode;
public Servant getServant() {
return servant;
}
public void setServant(Servant servant) {
this.servant = servant;
}
public String getUnitCode() {
return unitCode;
}
public void setUnitCode(String unitCode) {
this.unitCode = unitCode;
}
}
| [
"40287742+elang3000@users.noreply.github.com"
] | 40287742+elang3000@users.noreply.github.com |
1f6becefdf3671454853a349dc67b68acf130e65 | 5194981697a363648cb049b8176e730cb61cccbd | /OCP8StudyGuide/src/ch09/_09/reviewQuestions/Q9.java | 99b1ca683693edf9fb78b1661b797b4d84c125f6 | [] | no_license | demirramazan/OCP8 | 1b91d52c98dbf28946dddb87798be8af7a4db0c6 | ec21bd4c0afba467f1e6084756a090b04a5ffbc8 | refs/heads/master | 2020-03-29T02:08:29.972513 | 2018-06-16T19:19:30 | 2018-06-16T19:19:30 | 149,422,202 | 1 | 0 | null | 2018-09-19T09:01:23 | 2018-09-19T09:01:22 | null | UTF-8 | Java | false | false | 286 | java | package ch09._09.reviewQuestions;
public class Q9 {
}
// What are some advantages of using Files.lines() over Files.readAllLines()?
// (Choose all that apply.)
// B. It can be run on large files with very little memory available.
// C. It can be chained with stream methods directly. | [
"erguder.levent@gmail.com"
] | erguder.levent@gmail.com |
40fd18522f5b8f6cf785136d92f2b670680444aa | 85c8a4b7df9d5bcc2918724e34708a6c28556b14 | /back-service/src/main/java/com/chenyifaer/back/service/impl/ShopOrdersServiceImpl.java | 821e7625c938a0e5cd2a7033564f3e84786adcd5 | [] | no_license | wudonghe1996/chenyifaer-shop | 9b38f59a81bc08a129ad15aa4d838ebea66c0c9b | ca51946af31dec7b154c5b0de685c1408761ccdd | refs/heads/master | 2022-06-24T06:17:07.753068 | 2020-05-09T03:58:27 | 2020-05-09T03:58:27 | 178,018,127 | 1 | 1 | null | 2022-06-17T02:05:40 | 2019-03-27T15:02:41 | Java | UTF-8 | Java | false | false | 5,010 | java | package com.chenyifaer.back.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chenyifaer.back.dao.ShopOrdersDao;
import com.chenyifaer.back.entity.dto.OrdersDTO;
import com.chenyifaer.back.entity.po.ShopOrdersPO;
import com.chenyifaer.back.entity.vo.OrdersVO;
import com.chenyifaer.back.enums.OrdersCouponsStatusEnum;
import com.chenyifaer.back.enums.OrdersIntegralStatusEnum;
import com.chenyifaer.back.enums.OrdersStatusEnum;
import com.chenyifaer.back.service.ShopOrdersService;
import com.chenyifaer.back.util.ExportPOIUtils;
import com.chenyifaer.basic.common.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
/**
* 订单管理 - 订单表 服务实现类
* @author wudh
* @since 2019-04-25
*/
@Slf4j
@Service
public class ShopOrdersServiceImpl extends ServiceImpl<ShopOrdersDao, ShopOrdersPO> implements ShopOrdersService {
@Autowired
private ShopOrdersDao shopOrdersDao;
@Override
public List<OrdersVO> getList(OrdersDTO ordersDTO) {
return this.shopOrdersDao.getList(ordersDTO);
}
@Override
public void export(OrdersDTO ordersDTO, HttpServletResponse response) {
try {
List<OrdersVO> list = this.shopOrdersDao.getList(ordersDTO);
list.stream().map(x -> {
//订单状态
if (x.getStatus().equals(OrdersStatusEnum.STATUS_000.getCode())) {
x.setStatus(OrdersStatusEnum.STATUS_000.getMsg());
}
if (x.getStatus().equals(OrdersStatusEnum.STATUS_001.getCode())) {
x.setStatus(OrdersStatusEnum.STATUS_001.getMsg());
}
if (x.getStatus().equals(OrdersStatusEnum.STATUS_002.getCode())) {
x.setStatus(OrdersStatusEnum.STATUS_002.getMsg());
}
if (x.getStatus().equals(OrdersStatusEnum.STATUS_003.getCode())) {
x.setStatus(OrdersStatusEnum.STATUS_003.getMsg());
}
if (x.getStatus().equals(OrdersStatusEnum.STATUS_004.getCode())) {
x.setStatus(OrdersStatusEnum.STATUS_004.getMsg());
}
if (x.getStatus().equals(OrdersStatusEnum.STATUS_007.getCode())) {
x.setStatus(OrdersStatusEnum.STATUS_007.getMsg());
}
if (x.getStatus().equals(OrdersStatusEnum.STATUS_008.getCode())) {
x.setStatus(OrdersStatusEnum.STATUS_008.getMsg());
}
if (x.getStatus().equals(OrdersStatusEnum.STATUS_009.getCode())) {
x.setStatus(OrdersStatusEnum.STATUS_009.getMsg());
}
if (x.getStatus().equals(OrdersStatusEnum.STATUS_099.getCode())) {
x.setStatus(OrdersStatusEnum.STATUS_099.getMsg());
}
//是否优惠券付款
/** 替换0为否 */
if (x.getCouponsStatus().equals(OrdersCouponsStatusEnum.FALSE.getCode())) {
x.setCouponsStatus(OrdersCouponsStatusEnum.FALSE.getMsg());
}
/** 替换1为是 */
if (x.getCouponsStatus().equals(OrdersCouponsStatusEnum.TRUE.getCode())) {
x.setCouponsStatus(OrdersCouponsStatusEnum.TRUE.getMsg());
}
//是否积分付款
/** 替换0为否 */
if (x.getIntegralStatus().equals(OrdersIntegralStatusEnum.FALSE.getCode())) {
x.setIntegralStatus(OrdersIntegralStatusEnum.FALSE.getMsg());
}
/** 替换1为是 */
if (x.getIntegralStatus().equals(OrdersIntegralStatusEnum.TRUE.getCode())) {
x.setIntegralStatus(OrdersIntegralStatusEnum.TRUE.getMsg());
}
return x;
}).collect(Collectors.toList());
String[] columnNames = {"订单名", "收货人", "订单流水号", "支付流水号", "快递单号" , "商品价格" , "运费", "订单总格", "订单商品总数", "订单状态", "是否为积分付款", "是否为优惠券付款", "创建时间"};
String[] keys = {"ordersName", "consigneeName", "flowNumber", "payFlowNumber", "expressNumber", "goodsPrice", "expressPrice", "ordersPrice", "ordersCount", "status", "integralStatus", "couponsStatus", "createTime"};
ExportPOIUtils.start_download(response, "订单列表" + DateUtil.getTime().toString(), list, columnNames, keys);
} catch (IOException e) {
e.printStackTrace();
log.error("【ERROR】 - function ShopOrdersServiceImpl - export 订单列表导出失败,失败原因是:{}",e);
}
}
}
| [
"1044717927@qq.com"
] | 1044717927@qq.com |
4202b8f618f2e4a9c2d4b64300d702e2919e6c37 | cd6d88376a672159edd9adcff6db60125a2820ce | /src/main/java/org/motechproject/newebodac/exception/NewEbodacException.java | 9af3a94e964f68db139a4d33fba2b7988b86dfc4 | [
"Apache-2.0"
] | permissive | motech-implementations/new-ebodac | f735826f0f1ab976d0f67c6d651b9886da4e8e2b | bba8478a4c3703e7272d52cd286191ecaf5caf0e | refs/heads/dev | 2023-01-12T03:15:36.049978 | 2020-05-31T18:20:27 | 2020-05-31T18:20:27 | 194,908,955 | 1 | 0 | Apache-2.0 | 2023-01-04T04:29:57 | 2019-07-02T17:41:46 | Java | UTF-8 | Java | false | false | 1,172 | java | package org.motechproject.newebodac.exception;
import lombok.Getter;
public class NewEbodacException extends RuntimeException {
private static final long serialVersionUID = 1L;
@Getter
private String displayMessage;
@Getter
private String details;
/**
* Creates new exception with display message.
* @param displayMessage message that will be displayed to the user
*/
public NewEbodacException(String displayMessage) {
super(displayMessage);
this.displayMessage = displayMessage;
}
/**
* Creates new exception with display message and cause.
* @param displayMessage message that will be displayed to the user
* @param cause cause of this exception
*/
public NewEbodacException(String displayMessage, Throwable cause) {
super(getMessage(displayMessage, cause), cause);
this.displayMessage = displayMessage;
this.details = getCauseMessage(cause);
}
private static String getMessage(String displayMessage, Throwable cause) {
return displayMessage + "\n" + getCauseMessage(cause);
}
private static String getCauseMessage(Throwable cause) {
return "Caused by: " + cause.getMessage();
}
}
| [
"pmuchowski@soldevelo.com"
] | pmuchowski@soldevelo.com |
f837853d0925d5d5b135f689f0f0f8f2b4433783 | 139960e2d7d55e71c15e6a63acb6609e142a2ace | /mobile_app1/module1170/src/main/java/module1170packageJava0/Foo136.java | a8344f41955e6d27d6c09ac6aabf924d66820076 | [
"Apache-2.0"
] | permissive | uber-common/android-build-eval | 448bfe141b6911ad8a99268378c75217d431766f | 7723bfd0b9b1056892cef1fef02314b435b086f2 | refs/heads/master | 2023-02-18T22:25:15.121902 | 2023-02-06T19:35:34 | 2023-02-06T19:35:34 | 294,831,672 | 83 | 7 | Apache-2.0 | 2021-09-24T08:55:30 | 2020-09-11T23:27:37 | Java | UTF-8 | Java | false | false | 353 | java | package module1170packageJava0;
import java.lang.Integer;
public class Foo136 {
Integer int0;
Integer int1;
public void foo0() {
new module1170packageJava0.Foo135().foo4();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
}
| [
"oliviern@uber.com"
] | oliviern@uber.com |
7d2186f179404bb7ac09706cea6154de941bb5ce | 8707aea046c09636ca3308a1281975e7a3ae1d32 | /jiuyuInfo-framework/src/main/java/com/jiuyuInfo/framework/config/ResourcesConfig.java | bf96eb09a34441adb4a9a3798adc84da99a33d42 | [
"MIT"
] | permissive | jangocheng/jiuyuInfo | 94aab7c85575276575e0d0e12f7d4d6d39b02c3d | 5dbb3abc7275097f7004e420de30513a4800f353 | refs/heads/master | 2020-08-11T15:25:39.788680 | 2019-09-19T07:16:42 | 2019-09-19T07:16:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,020 | java | package com.jiuyuInfo.framework.config;
import com.jiuyuInfo.framework.interceptor.RepeatSubmitInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.jiuyuInfo.common.config.Global;
import com.jiuyuInfo.common.constant.Constants;
/**
* 通用配置
*
* @author jiuyuInfo
*/
@Configuration
public class ResourcesConfig implements WebMvcConfigurer
{
/**
* 首页地址
*/
@Value("${shiro.user.indexUrl}")
private String indexUrl;
@Autowired
private RepeatSubmitInterceptor repeatSubmitInterceptor;
/**
* 默认首页的设置,当输入域名是可以自动跳转到默认指定的网页
*/
@Override
public void addViewControllers(ViewControllerRegistry registry)
{
registry.addViewController("/").setViewName("forward:" + indexUrl);
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry)
{
/** 本地文件上传路径 */
registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + Global.getProfile() + "/");
/** swagger配置 */
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
/**
* 自定义拦截规则
*/
@Override
public void addInterceptors(InterceptorRegistry registry)
{
registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**");
}
} | [
"617271837@qq.com"
] | 617271837@qq.com |
de194f4bd1b6ca7d41f34854320cc9c7b65c3f39 | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-ws/results/XWIKI-14227-6-2-Single_Objective_GGA-WeightedSum/com/xpn/xwiki/store/migration/AbstractDataMigrationManager_ESTest_scaffolding.java | ce857d2678b6f4e77b8a8e4663dcbc3593592868 | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Fri Jan 17 18:28:35 UTC 2020
*/
package com.xpn.xwiki.store.migration;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class AbstractDataMigrationManager_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
89d59e10150256007f07be1fbb60a3ea7a43f542 | 43c3e196bf5113ed4167284e8dea45c6a0589337 | /lib-gwt-svg/tags/0.3/src/main/java/org/vectomatic/dom/svg/OMSVGMatrix.java | fdb94d6a6f8102ba1716482e8f13c22eb865bfb7 | [] | no_license | toxic88/vectomatic | 1bdec743b7dd4a7c582a792630c5c106db96b418 | aa4138b47cf0d080d7a3a4571798114f719ade30 | refs/heads/master | 2016-09-06T06:16:50.032347 | 2012-02-07T20:54:46 | 2012-02-07T20:54:46 | 33,423,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,520 | java | /**********************************************
* Copyright (C) 2010 Lukas Laag
* This file is part of libgwtsvg.
*
* libgwtsvg 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.
*
* libgwtsvg 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 libgwtsvg. If not, see http://www.gnu.org/licenses/
**********************************************/
package org.vectomatic.dom.svg;
import com.google.gwt.core.client.JavaScriptObject;
public class OMSVGMatrix extends JavaScriptObject {
protected OMSVGMatrix() {
}
// Implementation of the svg::SVGMatrix W3C IDL interface
public final native float getA() /*-{
return this.a;
}-*/;
public final native void setA(float value) /*-{
this.a = value;
}-*/;
public final native float getB() /*-{
return this.b;
}-*/;
public final native void setB(float value) /*-{
this.b = value;
}-*/;
public final native float getC() /*-{
return this.c;
}-*/;
public final native void setC(float value) /*-{
this.c = value;
}-*/;
public final native float getD() /*-{
return this.d;
}-*/;
public final native void setD(float value) /*-{
this.d = value;
}-*/;
public final native float getE() /*-{
return this.e;
}-*/;
public final native void setE(float value) /*-{
this.e = value;
}-*/;
public final native float getF() /*-{
return this.f;
}-*/;
public final native void setF(float value) /*-{
this.f = value;
}-*/;
public final native OMSVGMatrix multiply(OMSVGMatrix secondMatrix) /*-{
return this.multiply(secondMatrix);
}-*/;
public final native OMSVGMatrix inverse() /*-{
return this.inverse();
}-*/;
public final native OMSVGMatrix translate(float x, float y) /*-{
return this.translate(x, y);
}-*/;
public final native OMSVGMatrix scale(float scaleFactor) /*-{
return this.scale(scaleFactor);
}-*/;
public final native OMSVGMatrix scaleNonUniform(float scaleFactorX, float scaleFactorY) /*-{
return this.scaleNonUniform(scaleFactorX, scaleFactorY);
}-*/;
public final native OMSVGMatrix rotate(float angle) /*-{
return this.rotate(angle);
}-*/;
public final native OMSVGMatrix rotateFromVector(float x, float y) /*-{
return this.rotateFromVector(x, y);
}-*/;
public final native OMSVGMatrix flipX() /*-{
return this.flipX();
}-*/;
public final native OMSVGMatrix flipY() /*-{
return this.flipY();
}-*/;
public final native OMSVGMatrix skewX(float angle) /*-{
return this.skewX(angle);
}-*/;
public final native OMSVGMatrix skewY(float angle) /*-{
return this.skewY(angle);
}-*/;
public final String getDescription() {
StringBuilder builder = new StringBuilder("[");
builder.append(getA());
builder.append(" ");
builder.append(getB());
builder.append(" ");
builder.append(getC());
builder.append(" ");
builder.append(getD());
builder.append(" ");
builder.append(getE());
builder.append(" ");
builder.append(getF());
builder.append("]");
return builder.toString();
}
}
| [
"laaglu@4ed4caa0-1436-11df-ad8c-0f209b884837"
] | laaglu@4ed4caa0-1436-11df-ad8c-0f209b884837 |
b69e040fad9595c02982c0ee02c8aad11247cb9c | acd68968b4e659f92f5d32f3948052725b99c11b | /core/src/main/java/io/undertow/util/ByteRange.java | d43b1cb36c31dba8eed9497942521be0c98ba2a3 | [
"Apache-2.0"
] | permissive | portofrotterdam/undertow | ccbf928fde90cf33168f58a7f2779f07a01dbb17 | 62ddd0eedc6c66dba172a790221617846877b476 | refs/heads/master | 2021-10-01T15:51:09.246254 | 2018-11-27T13:35:37 | 2018-11-27T13:35:37 | 97,053,100 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,587 | java | /*
* JBoss, Home of Professional Open Source.
* Copyright 2014 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* 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.undertow.util;
import io.undertow.UndertowLogger;
import java.util.ArrayList;
import java.util.List;
/**
* Represents a byte range for a range request
*
*
* @author Stuart Douglas
*/
public class ByteRange {
private final List<Range> ranges;
public ByteRange(List<Range> ranges) {
this.ranges = ranges;
}
public int getRanges() {
return ranges.size();
}
/**
* Gets the start of the specified range segment, of -1 if this is a suffix range segment
* @param range The range segment to get
* @return The range start
*/
public long getStart(int range) {
return ranges.get(range).getStart();
}
/**
* Gets the end of the specified range segment, or the number of bytes if this is a suffix range segment
* @param range The range segment to get
* @return The range end
*/
public long getEnd(int range) {
return ranges.get(range).getEnd();
}
/**
* Attempts to parse a range request. If the range request is invalid it will just return null so that
* it may be ignored.
*
*
* @param rangeHeader The range spec
* @return A range spec, or null if the range header could not be parsed
*/
public static ByteRange parse(String rangeHeader) {
if(rangeHeader == null || rangeHeader.length() < 7) {
return null;
}
if(!rangeHeader.startsWith("bytes=")) {
return null;
}
List<Range> ranges = new ArrayList<>();
String[] parts = rangeHeader.substring(6).split(",");
for(String part : parts) {
try {
int index = part.indexOf('-');
if (index == 0) {
//suffix range spec
//represents the last N bytes
//internally we represent this using a -1 as the start position
long val = Long.parseLong(part.substring(1));
if(val < 0) {
UndertowLogger.REQUEST_LOGGER.debugf("Invalid range spec %s", rangeHeader);
return null;
}
ranges.add(new Range(-1, val));
} else {
if(index == -1) {
UndertowLogger.REQUEST_LOGGER.debugf("Invalid range spec %s", rangeHeader);
return null;
}
long start = Long.parseLong(part.substring(0, index));
if(start < 0) {
UndertowLogger.REQUEST_LOGGER.debugf("Invalid range spec %s", rangeHeader);
return null;
}
long end;
if (index + 1 < part.length()) {
end = Long.parseLong(part.substring(index + 1));
if(end < start) {
UndertowLogger.REQUEST_LOGGER.debugf("Invalid range spec %s", rangeHeader);
return null;
}
} else {
end = -1;
}
ranges.add(new Range(start, end));
}
} catch (NumberFormatException e) {
UndertowLogger.REQUEST_LOGGER.debugf("Invalid range spec %s", rangeHeader);
return null;
}
}
if(ranges.isEmpty()) {
return null;
}
return new ByteRange(ranges);
}
public static class Range {
private final long start, end;
public Range(long start, long end) {
this.start = start;
this.end = end;
}
public long getStart() {
return start;
}
public long getEnd() {
return end;
}
}
}
| [
"stuart.w.douglas@gmail.com"
] | stuart.w.douglas@gmail.com |
578860f30a2c9b8713629f8854a92541df0f7385 | 583389fd306a587618d4f9710470143f3a905a24 | /src/str/Str.java | 8c96603718142bc72d3b13d64476ea0d05a5b703 | [] | no_license | dream-cool/algorithm | c2fe1797037f4d4ff8c9ebbcb4d470785d0e7463 | ba32e35bbb220e96626e0e7ffed9b913b927e47e | refs/heads/master | 2021-06-24T12:00:30.591864 | 2021-01-05T03:47:15 | 2021-01-05T03:47:15 | 193,831,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,637 | java | package str;
/**
* @ Author :clt.
* @ Date :Created in 12:57 2019/7/14
* 题目描述
* 输入一个字符串,按字典序打印出该字符串中字符的所有排列。
* 例如输入字符串abc,则打印出由字符a,b,c所能排列出来的所有字符串abc,acb,bac,bca,cab和cba。
* 输入描述:
* 输入一个字符串,长度不超过9(可能有字符重复),字符只包括大小写字母
*/
public class Str {
public static void main(String[] args) {
System.out.println(isNumeric("1+23".toCharArray()));
}
public static boolean isNumeric(char[] str) {
StringBuilder sb = new StringBuilder();
if ((str[0] =='+'&& str[1] == '-') || (str[0] == '-' && str[1] == '+')
|| (str[0] =='+'&& str[1] == '+') || (str[0] == '-' && str[1] == '-')){
return false;
}
for(int i = 0; i < str.length; i++){
if((str[i] >= 'a' && str[i] <= 'z' && str[i] != 'e') || (str[i] >= 'A' && str[i] <= 'Z' && str[i] != 'E') ){
return false;
}
if((str[i] == '+' || str[i] == '-') && i > 0 && str[i-1]!='e' && str[i -1] !='E'){
return false;
}
sb.append(str[i]);
}
String[] strs = sb.toString().split("e|E");
if (strs[0].length() != sb.length() && strs.length <= 1){
return false;
}
if(strs.length >= 2 && strs[1].split("\\.").length != 1){
return false;
}
strs = sb.toString().split("\\.");
if (strs.length > 2){
return false;
}
return true;
}
}
| [
"1142170725@qq.com"
] | 1142170725@qq.com |
744a427b16279b92585a71a7a91aa7f486e62b39 | dbabec7e1cf99d641c9ec4fa94a7838daa74d332 | /src/ky/util/ExcelHelper.java | 371d6e8840bf1990b4e944ab1465247ac1491a04 | [] | no_license | whtchl/JavaWebTemplate2 | 3e102259b2b4fae51b2da13f8cace5b848d4ae62 | 8620b32bb2a39ca51b5e8b961900d453fe3513af | refs/heads/master | 2021-09-06T11:50:16.997720 | 2018-02-06T07:24:44 | 2018-02-06T07:24:44 | 115,401,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,880 | java | package ky.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.Map;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.VerticalAlignment;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
/**
* base on jxl.jar
* @author changbo
*
*/
public class ExcelHelper {
public static final int READ = 0;
public static final int WRITE = 1;
private String fileName = null;
private int operateModel;
private int lineIndex;
private Workbook wb = null;
private Sheet sheet = null;
private WritableWorkbook wwb = null;
private WritableSheet ws = null;
//default
WritableCellFormat format = new WritableCellFormat();
private ExcelHelper(String fileName, int operateModel){
this.fileName = fileName;
this.operateModel = operateModel;
}
public static ExcelHelper getExcelHelper(String fileName, int operateModel){
return new ExcelHelper(fileName, operateModel);
}
/**
* start with 0
* @param sheetNum
* @return
*/
public ExcelHelper open(int sheetNum){
try {
File file = new File(fileName);
if(!file.getParentFile().exists()){
file.getParentFile().mkdirs();
}
if(operateModel == READ){
wb = Workbook.getWorkbook(new FileInputStream(fileName));
sheet = wb.getSheet(sheetNum);
}else if(operateModel == WRITE){
wwb = Workbook.createWorkbook(new FileOutputStream(fileName));
if(wwb.getSheets().length == 0){
ws = wwb.createSheet("1", 1);
}else{
ws = wwb.getSheet(sheetNum);
}
//
format.setVerticalAlignment(VerticalAlignment.CENTRE);
format.setAlignment(Alignment.LEFT);
format.setWrap(true);
}
} catch (Exception e) {
e.printStackTrace();
return this;
}
return this;
}
public boolean setColumnView(int[] columWide){
if(columWide == null || columWide.length == 0){
return false;
}
for(int i=0; i<columWide.length; i++){
ws.setColumnView(i, columWide[i] <= 0 ? 1 : columWide[i]);
}
return true;
}
public Map<Integer, String> readLine(){
return readLine(false);
}
public Map<Integer, String> readLine(boolean ignoreBlankRow){
if(lineIndex >= sheet.getRows()){
return null;
}
Map<Integer, String> map = getRows(lineIndex);
lineIndex++;
//if blank, get next row
if(ignoreBlankRow && isEmptyData(map)){
return readLine(ignoreBlankRow);
}
return map;
}
public boolean writeLine(String[] strs){
if(lineIndex > 65535){
System.out.println("[ExcelHelper]lineIndex="+lineIndex);
return false;
}
if(!isEmptyData(strs)){
Label label = null;
for(int i=0;i<strs.length; i++){
if(hasValue(strs[i])){
label = new Label(i, lineIndex, getValue(strs[i]), format);
try {
ws.addCell(label);
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}
}
lineIndex++;
return true;
}
public boolean writeLine(Map<Integer, String> map){
if(!isEmptyData(map)){
Label label = null;
for(Integer i : map.keySet()){
if(hasValue(map.get(i))){
label = new Label(i, lineIndex, getValue(map.get(i)), format);
try {
ws.addCell(label);
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}
}
lineIndex++;
return true;
}
public Map<Integer, String> getRows(int index){
if(index >= 65535){
System.out.println("[ExcelHelper]index="+index);
return null;
}
Map<Integer, String> map = new HashMap<Integer, String>();
Cell cell = null;
for(int j=0; j<sheet.getColumns(); j++){
cell = sheet.getCell(j,index);
map.put(j, getValue(cell.getContents()));
}
return map;
}
private boolean isEmptyData(String[] strs){
boolean isEmpty = true;
if(strs != null && strs.length > 0){
for(String i : strs){
if(hasValue(i)){
isEmpty = false;
}
}
}
return isEmpty;
}
private boolean isEmptyData(Map<Integer, String> map){
boolean isEmpty = true;
if(map != null && map.size() > 0){
for(Integer i : map.keySet()){
if(hasValue(map.get(i))){
isEmpty = false;
}
}
}
return isEmpty;
}
public void close(){
if(wb != null){
wb.close();
}
if(wwb != null){
try {
wwb.write();
wwb.close();
} catch (Exception e) {
}
}
}
public static String getValue(String s){
if(s == null){
return "";
}
return s.trim();
}
public static boolean hasValue(String s){
if(s != null && s.trim().length() > 0){
return true;
}else{
return false;
}
}
}
| [
"whtchl@126.com"
] | whtchl@126.com |
ef69276e9af22bf38b58e617867d614277138aaf | 0ea271177f5c42920ac53cd7f01f053dba5c14e4 | /5.5.0/sources/org/telegram/messenger/exoplayer2/extractor/ogg/OpusReader.java | 9ea2cf14cc29d58ed5a9575ac03b2b8182dfada3 | [] | no_license | alireza-ebrahimi/telegram-talaeii | 367a81a77f9bc447e729b2ca339f9512a4c2860e | 68a67e6f104ab8a0888e63c605e8bbad12c4a20e | refs/heads/master | 2020-03-21T13:44:29.008002 | 2018-12-09T10:30:29 | 2018-12-09T10:30:29 | 138,622,926 | 12 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,199 | java | package org.telegram.messenger.exoplayer2.extractor.ogg;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.telegram.messenger.exoplayer2.C3446C;
import org.telegram.messenger.exoplayer2.Format;
import org.telegram.messenger.exoplayer2.util.MimeTypes;
import org.telegram.messenger.exoplayer2.util.ParsableByteArray;
import org.telegram.messenger.exoplayer2.util.Util;
final class OpusReader extends StreamReader {
private static final int DEFAULT_SEEK_PRE_ROLL_SAMPLES = 3840;
private static final int OPUS_CODE = Util.getIntegerCodeForString("Opus");
private static final byte[] OPUS_SIGNATURE = new byte[]{(byte) 79, (byte) 112, (byte) 117, (byte) 115, (byte) 72, (byte) 101, (byte) 97, (byte) 100};
private static final int SAMPLE_RATE = 48000;
private boolean headerRead;
OpusReader() {
}
private long getPacketDurationUs(byte[] bArr) {
int i;
int i2 = bArr[0] & 255;
switch (i2 & 3) {
case 0:
i = 1;
break;
case 1:
case 2:
i = 2;
break;
default:
i = bArr[1] & 63;
break;
}
int i3 = i2 >> 3;
i2 = i3 & 3;
i3 = i3 >= 16 ? 2500 << i2 : i3 >= 12 ? 10000 << (i2 & 1) : i2 == 3 ? 60000 : 10000 << i2;
return (long) (i3 * i);
}
private void putNativeOrderLong(List<byte[]> list, int i) {
list.add(ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong((((long) i) * C3446C.NANOS_PER_SECOND) / 48000).array());
}
public static boolean verifyBitstreamType(ParsableByteArray parsableByteArray) {
if (parsableByteArray.bytesLeft() < OPUS_SIGNATURE.length) {
return false;
}
byte[] bArr = new byte[OPUS_SIGNATURE.length];
parsableByteArray.readBytes(bArr, 0, OPUS_SIGNATURE.length);
return Arrays.equals(bArr, OPUS_SIGNATURE);
}
protected long preparePayload(ParsableByteArray parsableByteArray) {
return convertTimeToGranule(getPacketDurationUs(parsableByteArray.data));
}
protected boolean readHeaders(ParsableByteArray parsableByteArray, long j, SetupData setupData) {
if (this.headerRead) {
boolean z = parsableByteArray.readInt() == OPUS_CODE;
parsableByteArray.setPosition(0);
return z;
}
Object copyOf = Arrays.copyOf(parsableByteArray.data, parsableByteArray.limit());
int i = copyOf[9] & 255;
int i2 = ((copyOf[11] & 255) << 8) | (copyOf[10] & 255);
List arrayList = new ArrayList(3);
arrayList.add(copyOf);
putNativeOrderLong(arrayList, i2);
putNativeOrderLong(arrayList, DEFAULT_SEEK_PRE_ROLL_SAMPLES);
setupData.format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_OPUS, null, -1, -1, i, SAMPLE_RATE, arrayList, null, 0, null);
this.headerRead = true;
return true;
}
protected void reset(boolean z) {
super.reset(z);
if (z) {
this.headerRead = false;
}
}
}
| [
"alireza.ebrahimi2006@gmail.com"
] | alireza.ebrahimi2006@gmail.com |
b4bce4e86a67bf3fe791a8f20ad7539024b2e513 | 84c3301dd799d1d0e7de58ed50f30719568760e6 | /pu/.svn/pristine/38/38e813edc8569f69ad13b3c63c7c262d315bcd42.svn-base | 1ef7233f46e7e25b56575aeb395e12ae1ce88251 | [] | no_license | hljlgj/YonyouNC | 264d1f38b76fb3c9937603dd48753a9b2666c3ee | fec9955513594a3095be76c4d7f98b0927d721b6 | refs/heads/master | 2020-06-12T08:25:44.710709 | 2018-07-04T09:11:33 | 2018-07-04T09:11:33 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,133 | /**
* $文件说明$
*
* @author GGR
* @version 6.0
* @see
* @since 6.0
* @time 2010-3-4 下午06:40:17
*/
package nc.ui.pu.m20.editor.card.beforeedit.body;
import nc.ui.pu.pub.editor.card.listener.ICardBodyBeforeEditEventListener;
import nc.ui.pubapp.uif2app.event.card.CardBodyBeforeEditEvent;
import nc.ui.scmpub.ref.FilterCustomerRefUtils;
import nc.vo.pu.m20.entity.PraybillItemVO;
/**
* <p>
* <b>本类主要完成以下功能:</b>
* <ul>
* <li>销售客户编辑前事件
* </ul>
* <p>
* <p>
*
* @version 6.0
* @since 6.0
* @author GGR
* @time 2010-3-4 下午06:40:17
*/
public class Customer implements ICardBodyBeforeEditEventListener {
@Override
public void beforeEdit(CardBodyBeforeEditEvent event) {
// 参照的范围为请购单表头库存组织可见的客户
String org = event.getContext().getPk_org();
if (null != org) {
FilterCustomerRefUtils filter =
new FilterCustomerRefUtils(event.getBillCardPanel().getBodyItem(
PraybillItemVO.CASSCUSTID));
filter.filterItemRefByOrg(org);
}
event.setReturnValue(Boolean.TRUE);
}
}
| [
"944482059@qq.com"
] | 944482059@qq.com | |
f7a7407cc3b2606a7841c7d3f94f2f585c6dbaa4 | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /cts/tests/tests/media/src/android/media/cts/CameraProfileTest.java | 62228c6c9f91bebf4a965f2496be4dca1e9eb886 | [
"MIT"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | Java | false | false | 2,127 | java | /*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.cts;
import android.hardware.Camera;
import android.media.CameraProfile;
import android.test.AndroidTestCase;
import android.util.Log;
import java.util.List;
public class CameraProfileTest extends AndroidTestCase {
private static final String TAG = "CameraProfileTest";
private void checkQuality(int low, int mid, int high) {
Log.v(TAG, "low = " + low + ", mid = " + mid + ", high = " + high);
assertTrue(low >= 0 && low <= 100);
assertTrue(mid >= 0 && mid <= 100);
assertTrue(high >= 0 && high <= 100);
assertTrue(low <= mid && mid <= high);
}
public void testGetImageEncodingQualityParameter() {
int low = CameraProfile.getJpegEncodingQualityParameter(CameraProfile.QUALITY_LOW);
int mid = CameraProfile.getJpegEncodingQualityParameter(CameraProfile.QUALITY_MEDIUM);
int high = CameraProfile.getJpegEncodingQualityParameter(CameraProfile.QUALITY_HIGH);
checkQuality(low, mid, high);
}
public void testGetWithId() {
int nCamera = Camera.getNumberOfCameras();
for (int id = 0; id < nCamera; id++) {
int low = CameraProfile.getJpegEncodingQualityParameter(id, CameraProfile.QUALITY_LOW);
int mid = CameraProfile.getJpegEncodingQualityParameter(id, CameraProfile.QUALITY_MEDIUM);
int high = CameraProfile.getJpegEncodingQualityParameter(id, CameraProfile.QUALITY_HIGH);
checkQuality(low, mid, high);
}
}
}
| [
"karun.matharu@gmail.com"
] | karun.matharu@gmail.com |
bb89ff2d5c1d95e9e9ff42af3861eb44d40a9146 | f40c5613a833bc38fca6676bad8f681200cffb25 | /kubernetes-model-generator/openshift-model-hive/src/generated/java/io/fabric8/openshift/api/model/hive/vsphere/v1/Platform.java | 50181874fe436e03e4b74cf520f9d327c48e15f1 | [
"Apache-2.0"
] | permissive | rohanKanojia/kubernetes-client | 2d599e4ed1beedf603c79d28f49203fbce1fc8b2 | 502a14c166dce9ec07cf6adb114e9e36053baece | refs/heads/master | 2023-07-25T18:31:33.982683 | 2022-04-12T13:39:06 | 2022-04-13T05:12:38 | 106,398,990 | 2 | 3 | Apache-2.0 | 2023-04-28T16:21:03 | 2017-10-10T09:50:25 | Java | UTF-8 | Java | false | false | 6,486 | java |
package io.fabric8.openshift.api.model.hive.vsphere.v1;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.fabric8.kubernetes.api.model.Container;
import io.fabric8.kubernetes.api.model.IntOrString;
import io.fabric8.kubernetes.api.model.KubernetesResource;
import io.fabric8.kubernetes.api.model.LabelSelector;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.api.model.ObjectReference;
import io.fabric8.kubernetes.api.model.PersistentVolumeClaim;
import io.fabric8.kubernetes.api.model.PodTemplateSpec;
import io.fabric8.kubernetes.api.model.ResourceRequirements;
import io.sundr.builder.annotations.Buildable;
import io.sundr.builder.annotations.BuildableReference;
import lombok.EqualsAndHashCode;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
@JsonDeserialize(using = com.fasterxml.jackson.databind.JsonDeserializer.None.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"apiVersion",
"kind",
"metadata",
"certificatesSecretRef",
"cluster",
"credentialsSecretRef",
"datacenter",
"defaultDatastore",
"folder",
"network",
"vCenter"
})
@ToString
@EqualsAndHashCode
@Setter
@Accessors(prefix = {
"_",
""
})
@Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder", refs = {
@BuildableReference(ObjectMeta.class),
@BuildableReference(LabelSelector.class),
@BuildableReference(Container.class),
@BuildableReference(PodTemplateSpec.class),
@BuildableReference(ResourceRequirements.class),
@BuildableReference(IntOrString.class),
@BuildableReference(ObjectReference.class),
@BuildableReference(io.fabric8.kubernetes.api.model.LocalObjectReference.class),
@BuildableReference(PersistentVolumeClaim.class)
})
public class Platform implements KubernetesResource
{
@JsonProperty("certificatesSecretRef")
private io.fabric8.kubernetes.api.model.LocalObjectReference certificatesSecretRef;
@JsonProperty("cluster")
private String cluster;
@JsonProperty("credentialsSecretRef")
private io.fabric8.kubernetes.api.model.LocalObjectReference credentialsSecretRef;
@JsonProperty("datacenter")
private String datacenter;
@JsonProperty("defaultDatastore")
private String defaultDatastore;
@JsonProperty("folder")
private String folder;
@JsonProperty("network")
private String network;
@JsonProperty("vCenter")
private String vCenter;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
/**
* No args constructor for use in serialization
*
*/
public Platform() {
}
/**
*
* @param defaultDatastore
* @param cluster
* @param credentialsSecretRef
* @param folder
* @param certificatesSecretRef
* @param datacenter
* @param vCenter
* @param network
*/
public Platform(io.fabric8.kubernetes.api.model.LocalObjectReference certificatesSecretRef, String cluster, io.fabric8.kubernetes.api.model.LocalObjectReference credentialsSecretRef, String datacenter, String defaultDatastore, String folder, String network, String vCenter) {
super();
this.certificatesSecretRef = certificatesSecretRef;
this.cluster = cluster;
this.credentialsSecretRef = credentialsSecretRef;
this.datacenter = datacenter;
this.defaultDatastore = defaultDatastore;
this.folder = folder;
this.network = network;
this.vCenter = vCenter;
}
@JsonProperty("certificatesSecretRef")
public io.fabric8.kubernetes.api.model.LocalObjectReference getCertificatesSecretRef() {
return certificatesSecretRef;
}
@JsonProperty("certificatesSecretRef")
public void setCertificatesSecretRef(io.fabric8.kubernetes.api.model.LocalObjectReference certificatesSecretRef) {
this.certificatesSecretRef = certificatesSecretRef;
}
@JsonProperty("cluster")
public String getCluster() {
return cluster;
}
@JsonProperty("cluster")
public void setCluster(String cluster) {
this.cluster = cluster;
}
@JsonProperty("credentialsSecretRef")
public io.fabric8.kubernetes.api.model.LocalObjectReference getCredentialsSecretRef() {
return credentialsSecretRef;
}
@JsonProperty("credentialsSecretRef")
public void setCredentialsSecretRef(io.fabric8.kubernetes.api.model.LocalObjectReference credentialsSecretRef) {
this.credentialsSecretRef = credentialsSecretRef;
}
@JsonProperty("datacenter")
public String getDatacenter() {
return datacenter;
}
@JsonProperty("datacenter")
public void setDatacenter(String datacenter) {
this.datacenter = datacenter;
}
@JsonProperty("defaultDatastore")
public String getDefaultDatastore() {
return defaultDatastore;
}
@JsonProperty("defaultDatastore")
public void setDefaultDatastore(String defaultDatastore) {
this.defaultDatastore = defaultDatastore;
}
@JsonProperty("folder")
public String getFolder() {
return folder;
}
@JsonProperty("folder")
public void setFolder(String folder) {
this.folder = folder;
}
@JsonProperty("network")
public String getNetwork() {
return network;
}
@JsonProperty("network")
public void setNetwork(String network) {
this.network = network;
}
@JsonProperty("vCenter")
public String getVCenter() {
return vCenter;
}
@JsonProperty("vCenter")
public void setVCenter(String vCenter) {
this.vCenter = vCenter;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
| [
"marc@marcnuri.com"
] | marc@marcnuri.com |
f77ad5f5a15a3bc3dbf98ba8b743a87bfee5cbef | 377e5e05fb9c6c8ed90ad9980565c00605f2542b | /bin/ext-accelerator/acceleratorservices/src/de/hybris/platform/acceleratorservices/email/EmailService.java | 1ae0bcc72ffe30955cab57cfbc91ee8d96f0d6e9 | [] | no_license | automaticinfotech/HybrisProject | c22b13db7863e1e80ccc29774f43e5c32e41e519 | fc12e2890c569e45b97974d2f20a8cbe92b6d97f | refs/heads/master | 2021-07-20T18:41:04.727081 | 2017-10-30T13:24:11 | 2017-10-30T13:24:11 | 108,957,448 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,767 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE or an SAP affiliate company.
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.acceleratorservices.email;
import de.hybris.platform.acceleratorservices.model.email.EmailAddressModel;
import de.hybris.platform.acceleratorservices.model.email.EmailAttachmentModel;
import de.hybris.platform.acceleratorservices.model.email.EmailMessageModel;
import java.io.DataInputStream;
import java.util.List;
/**
* Handles creation and sending of emails.
*/
public interface EmailService
{
/**
*
* Returns a {@link EmailAddressModel}. Instance is found for the given email address and display name criteria. If
* there is no instance for this condition the new {@link EmailAddressModel} instance is returned based on the given
* criteria.
*
* @param emailAddress
* Email id
* @param displayName
* Display name
* @return EmailAddress object
*/
EmailAddressModel getOrCreateEmailAddressForEmail(String emailAddress, String displayName);
/**
* Creates an email attachment from an input stream.
*
* @param masterDataStream
* Input data stream
* @param filename
* File name
* @param mimeType
* Mime type
* @return EmailAttachment object
*/
EmailAttachmentModel createEmailAttachment(DataInputStream masterDataStream, String filename, String mimeType);
/**
* Creates and EmailMessage object.
*
* @param toAddresses
* List of To email addresses
* @param ccAddresses
* List of CC email addresses
* @param bccAddresses
* List of BCC email addresses
* @param fromAddress
* From email address
* @param replyToAddress
* Reply To email address
* @param subject
* Subject of the email
* @param body
* Contents of the email
* @param attachments
* List of email attachments
* @return EmailMessage object
*/
EmailMessageModel createEmailMessage(List<EmailAddressModel> toAddresses, List<EmailAddressModel> ccAddresses, // NOSONAR
List<EmailAddressModel> bccAddresses, EmailAddressModel fromAddress, String replyToAddress, String subject, String body,
List<EmailAttachmentModel> attachments);
/**
* Sends an email
*
* @param message
* EmailMessage
* @return true if successful
*/
boolean send(EmailMessageModel message);
}
| [
"santosh.kshirsagar@automaticinfotech.com"
] | santosh.kshirsagar@automaticinfotech.com |
7029a6a0c1251030b4f5d84fcab1082e1d1e9f72 | a1c18b5e8356ab0f6aaa07ee931ba4bccc88c55a | /Project_186/src/capture_screen/Capture_Screen_When_AlertPresented.java | 36991363bc6c0f165ae41ad2a5b67e40f60675ac | [] | no_license | sunilreddyg/26th_Jan_9-30AM_2021 | 627a14bbfc2b4273b11ec25bc56589848ab8a274 | f606ad43172c39c7c6405c2fc3faee32511607a4 | refs/heads/master | 2023-03-17T07:13:17.488472 | 2021-03-31T06:44:05 | 2021-03-31T06:44:05 | 333,661,143 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,785 | java | package capture_screen;
import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.imageio.ImageIO;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Capture_Screen_When_AlertPresented {
public static void main(String[] args) throws Exception
{
//setting runtime environment variable
System.setProperty("webdriver.chrome.driver", "Drivers\\chromedriver.exe");
WebDriver driver=new ChromeDriver(); //Launching browser method
driver.get("http://demo.automationtesting.in/Alerts.html");
driver.manage().window().maximize();
WebElement Alert_prompt_link=driver.findElement(By.xpath("//button[@class='btn btn-danger']"));
Alert_prompt_link.click();
Thread.sleep(3000);
DateFormat df=new SimpleDateFormat("yyyyMMdd hh mm ss a");
//Get Default Sceen dimension
Dimension Screen_Dimension=Toolkit.getDefaultToolkit().getScreenSize();
//Creating object for class
Robot obj=new Robot();
//Create screen and convert into buffered image
BufferedImage Final_Screen=obj.createScreenCapture(new Rectangle(Screen_Dimension));
Calendar now = Calendar.getInstance();
System.out.println(now.getTime());
//Dump Screen into local system
ImageIO.write(Final_Screen, "PNG", new File("C:\\Users\\Administrator\\Desktop\\sceens\\"+df.format(now.getTime())+"image.png"));
}
}
| [
"Administrator@AA-PC"
] | Administrator@AA-PC |
246bbf3eecaeac41b04b12def922e35e52fc732b | 73458087c9a504dedc5acd84ecd63db5dfcd5ca1 | /src/com/estrongs/android/pop/view/cx.java | 58d93ad52334b581467156b374a59f3d789fad91 | [] | no_license | jtap60/com.estr | 99ff2a6dd07b02b41a9cc3c1d28bb6545e68fb27 | 8b70bf2da8b24c7cef5973744e6054ef972fc745 | refs/heads/master | 2020-04-14T02:12:20.424436 | 2018-12-30T10:56:45 | 2018-12-30T10:56:45 | 163,578,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package com.estrongs.android.pop.view;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import com.estrongs.android.pop.FexApplication;
class cx
implements DialogInterface.OnDismissListener
{
cx(FileExplorerActivity paramFileExplorerActivity) {}
public void onDismiss(DialogInterface paramDialogInterface)
{
if (FexApplication.a().i()) {
a.finish();
}
}
}
/* Location:
* Qualified Name: com.estrongs.android.pop.view.cx
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
65a0c8db24c53808365adb49ad9b90bce53b4361 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/MOCKITO-9b-2-14-NSGA_II-WeightedSum:TestLen:CallDiversity/org/mockito/internal/invocation/InvocationImpl_ESTest_scaffolding.java | 37ff4f18363391899d38465ae582c91635d813d8 | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,636 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Thu Apr 02 07:59:38 UTC 2020
*/
package org.mockito.internal.invocation;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import static org.evosuite.shaded.org.mockito.Mockito.*;
@EvoSuiteClassExclude
public class InvocationImpl_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.mockito.internal.invocation.InvocationImpl";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
try { initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {}
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(InvocationImpl_ESTest_scaffolding.class.getClassLoader() ,
"org.mockito.cglib.proxy.Callback",
"org.mockito.configuration.AnnotationEngine",
"org.mockito.exceptions.misusing.UnfinishedVerificationException",
"org.mockito.invocation.Invocation",
"org.mockito.invocation.Location",
"org.mockito.internal.exceptions.VerificationAwareInvocation",
"org.mockito.exceptions.Reporter",
"org.mockito.exceptions.verification.VerificationInOrderFailure",
"org.mockito.configuration.DefaultMockitoConfiguration",
"org.mockito.exceptions.misusing.NullInsteadOfMockException",
"org.mockito.internal.util.StringJoiner",
"org.mockito.internal.exceptions.stacktrace.StackTraceFilter",
"org.mockito.internal.invocation.realmethod.RealMethod",
"org.mockito.exceptions.misusing.NotAMockException",
"org.mockito.exceptions.misusing.FriendlyReminderException",
"org.mockito.exceptions.misusing.MissingMethodInvocationException",
"org.mockito.exceptions.verification.SmartNullPointerException",
"org.mockito.exceptions.verification.TooLittleActualInvocations",
"org.mockito.internal.invocation.ArgumentsProcessor",
"org.mockito.invocation.StubInfo",
"org.mockito.internal.configuration.GlobalConfiguration",
"org.mockito.internal.invocation.AbstractAwareMethod",
"org.mockito.cglib.proxy.MethodInterceptor",
"org.mockito.plugins.MockMaker",
"org.mockito.exceptions.verification.TooManyActualInvocations",
"org.mockito.exceptions.verification.ArgumentsAreDifferent",
"org.mockito.internal.invocation.InvocationImpl",
"org.mockito.internal.exceptions.stacktrace.DefaultStackTraceCleanerProvider",
"org.mockito.plugins.StackTraceCleanerProvider",
"org.mockito.exceptions.misusing.MockitoConfigurationException",
"org.mockito.internal.invocation.MockitoMethod",
"org.mockito.internal.exceptions.stacktrace.ConditionalStackTraceFilter",
"org.mockito.configuration.MockitoConfiguration",
"org.mockito.exceptions.misusing.InvalidUseOfMatchersException",
"org.mockito.exceptions.misusing.UnfinishedStubbingException",
"org.mockito.exceptions.verification.NoInteractionsWanted",
"org.mockito.exceptions.PrintableInvocation",
"org.mockito.invocation.DescribedInvocation",
"org.mockito.internal.configuration.ClassPathLoader",
"org.mockito.exceptions.base.MockitoException",
"org.mockito.stubbing.Answer",
"org.mockito.invocation.InvocationOnMock",
"org.mockito.exceptions.verification.WantedButNotInvoked",
"org.mockito.internal.creation.cglib.CglibMockMaker",
"org.mockito.configuration.IMockitoConfiguration",
"org.mockito.exceptions.misusing.WrongTypeOfReturnValue",
"org.mockito.internal.exceptions.stacktrace.DefaultStackTraceCleaner",
"org.mockito.exceptions.stacktrace.StackTraceCleaner",
"org.mockito.exceptions.base.MockitoAssertionError",
"org.mockito.internal.debugging.LocationImpl",
"org.mockito.exceptions.verification.NeverWantedButInvoked",
"org.mockito.exceptions.misusing.CannotStubVoidMethodWithReturnValue",
"org.mockito.exceptions.misusing.CannotVerifyStubOnlyMock"
);
}
private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException {
mock(Class.forName("org.mockito.internal.invocation.MockitoMethod", false, InvocationImpl_ESTest_scaffolding.class.getClassLoader()));
mock(Class.forName("org.mockito.internal.invocation.realmethod.RealMethod", false, InvocationImpl_ESTest_scaffolding.class.getClassLoader()));
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
042940bbefe9b4621e8a7e1d6c92dcd3297a2cd6 | 2b2fcb1902206ad0f207305b9268838504c3749b | /WakfuClientSources/srcx/class_8907_dEj.java | a5a5b9e66d9d9c34b1caad1adb910d4482078ff4 | [] | no_license | shelsonjava/Synx | 4fbcee964631f747efc9296477dee5a22826791a | 0cb26d5473ba1f36a3ea1d7163a5b9e6ebcb0b1d | refs/heads/master | 2021-01-15T13:51:41.816571 | 2013-11-17T10:46:22 | 2013-11-17T10:46:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,140 | java | class dEj extends amp
{
private dEj(ddG paramddG)
{
}
public boolean Iv()
{
return false;
}
public Or getContentMinSize(dRq paramdRq) {
return this.ePq.getContentPrefSize();
}
public Or getContentPreferedSize(dRq paramdRq) {
Or localOr1 = ddG.a(this.ePq) != null ? ddG.a(this.ePq).getPrefSize() : new Or();
Or localOr2 = ddG.b(this.ePq) != null ? ddG.b(this.ePq).getPrefSize() : new Or();
localOr1.height = Math.max(localOr1.height, localOr2.height);
localOr1.width += localOr2.width;
return localOr1;
}
public void a(dRq paramdRq) {
int i = 0;
if ((ddG.b(this.ePq) != null) && (ddG.b(this.ePq).getVisible())) {
ddG.b(this.ePq).setSizeToPrefSize();
i = ddG.b(this.ePq).getSize().width;
ddG.b(this.ePq).setPosition(this.ePq.czl.getContentWidth() - i, (this.ePq.czl.getContentHeight() - ddG.b(this.ePq).getHeight()) / 2);
}
if ((ddG.a(this.ePq) != null) && (ddG.a(this.ePq).getVisible())) {
ddG.a(this.ePq).setPosition(0, 0);
ddG.a(this.ePq).setSize(new Or(this.ePq.czl.getContentWidth() - i, this.ePq.czl.getContentHeight()));
}
}
} | [
"music_inme@hotmail.fr"
] | music_inme@hotmail.fr |
645becfe4244ad028f9ffb26ffea37f88b062132 | 9f3d00d19d93df165347acdfd10548f43eb54513 | /4.JavaCollections/src/com/javarush/task/task26/task2613/Operation.java | 428e14d0413c6a32a868c1b15519027add39019b | [] | no_license | reset1301/javarushTasks | eebeb85e9cb35feb8aac2c96b73d7afa7bdaea67 | 29a8e8b08bc73f831ff182e7b04c3eb49a56c740 | refs/heads/master | 2018-09-28T10:01:06.772595 | 2018-07-09T10:33:07 | 2018-07-09T10:33:07 | 116,394,770 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 614 | java | package com.javarush.task.task26.task2613;
public enum Operation {
LOGIN, INFO, DEPOSIT, WITHDRAW, EXIT;
public static Operation getAllowableOperationByOrdinal(Integer i) {
switch (i) {
case 0:
throw new IllegalArgumentException();
case 1:
return Operation.INFO;
case 2:
return Operation.DEPOSIT;
case 3:
return Operation.WITHDRAW;
case 4:
return Operation.EXIT;
default:
throw new IllegalArgumentException();
}
}
}
| [
"reset1301@mail.ru"
] | reset1301@mail.ru |
a0766850d64735444be1753ef55deb431f22a465 | 8d4a69e281915a8a68b0488db0e013b311942cf4 | /spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/WebMvcEndpointHandlerMapping.java | ca1aae006d695f0872bfa4d8a5198f7ecaa29995 | [
"Apache-2.0"
] | permissive | yuanmabiji/spring-boot-2.1.0.RELEASE | 798b4c29d25fdcb22fa3a0baf24a08ddd0dfa27e | 6fe0467c9bc95d3849eb2ad5bae04fd9bdee3a82 | refs/heads/master | 2023-03-10T05:20:52.846557 | 2022-03-25T15:53:13 | 2022-03-25T15:53:13 | 252,902,347 | 320 | 107 | Apache-2.0 | 2023-02-22T07:44:16 | 2020-04-04T03:49:51 | Java | UTF-8 | Java | false | false | 2,816 | java | /*
* Copyright 2012-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 org.springframework.boot.actuate.endpoint.web.servlet;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver;
import org.springframework.boot.actuate.endpoint.web.EndpointMapping;
import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
import org.springframework.boot.actuate.endpoint.web.Link;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.servlet.HandlerMapping;
/**
* A custom {@link HandlerMapping} that makes web endpoints available over HTTP using
* Spring MVC.
*
* @author Andy Wilkinson
* @author Phillip Webb
* @since 2.0.0
*/
public class WebMvcEndpointHandlerMapping extends AbstractWebMvcEndpointHandlerMapping {
private final EndpointLinksResolver linksResolver;
/**
* Creates a new {@code WebMvcEndpointHandlerMapping} instance that provides mappings
* for the given endpoints.
* @param endpointMapping the base mapping for all endpoints
* @param endpoints the web endpoints
* @param endpointMediaTypes media types consumed and produced by the endpoints
* @param corsConfiguration the CORS configuration for the endpoints or {@code null}
* @param linksResolver resolver for determining links to available endpoints
*/
public WebMvcEndpointHandlerMapping(EndpointMapping endpointMapping,
Collection<ExposableWebEndpoint> endpoints,
EndpointMediaTypes endpointMediaTypes, CorsConfiguration corsConfiguration,
EndpointLinksResolver linksResolver) {
super(endpointMapping, endpoints, endpointMediaTypes, corsConfiguration);
this.linksResolver = linksResolver;
setOrder(-100);
}
@Override
@ResponseBody
protected Map<String, Map<String, Link>> links(HttpServletRequest request,
HttpServletResponse response) {
return Collections.singletonMap("_links",
this.linksResolver.resolveLinks(request.getRequestURL().toString()));
}
}
| [
"983656956@qq.com"
] | 983656956@qq.com |
e7ccde98473119a494140556cf3aa941d1a64df4 | e70abc02efbb8a7637eb3655f287b0a409cfa23b | /hyjf-app/src/main/java/com/hyjf/app/htltrade/HtlTradeService.java | ecf694c7231f163ac07461357b9fcca817642a6e | [] | no_license | WangYouzheng1994/hyjf | ecb221560460e30439f6915574251266c1a49042 | 6cbc76c109675bb1f120737f29a786fea69852fc | refs/heads/master | 2023-05-12T03:29:02.563411 | 2020-05-19T13:49:56 | 2020-05-19T13:49:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 973 | java | package com.hyjf.app.htltrade;
import java.util.List;
import com.hyjf.mybatis.model.customize.ProductIntoRecordCustomize;
import com.hyjf.mybatis.model.customize.ProductRedeemCustomize;
public interface HtlTradeService {
/**
* 获得购买列表数
* @param productIntoRecordCustomize
* @return
*/
public Integer countHtlIntoRecord(ProductIntoRecordCustomize productIntoRecordCustomize);
/**
* 获取购买产品列表
*
* @return
*/
public List<ProductIntoRecordCustomize> getIntoRecordList(ProductIntoRecordCustomize productIntoRecordCustomize);
/**
* 获得汇天利转出列表数
* @param productIntoRecordCustomize
* @return
*/
public Integer countProductRedeemRecord(ProductRedeemCustomize productRedeemCustomize);
/**
* 获取汇天利转出记录列表(自定义)
* @param ProductRedeemCustomize
* @return
*/
public List<ProductRedeemCustomize> getRedeemRecordList(ProductRedeemCustomize productRedeemCustomize);
}
| [
"heshuying@hyjf.com"
] | heshuying@hyjf.com |
026d4c07a5e097fd1b54b67c393f85f18a9b68c3 | bbfd3058f560ee3d440a78bfc73763f34371be33 | /src/main/java/com/kunyao/assistant/web/controller/cross/CrossUserController.java | 7a13f1d8c51ae1a4ccdbe01df98b5a6a51e2b3a2 | [] | no_license | xiaoniao/temp | 34ff1a3670699aca679dc3ab1d9f1979c26eb15b | 1bb437c2a2b2b03cbd6b74190bff9b05de57ea29 | refs/heads/master | 2021-04-26T22:27:52.144518 | 2018-03-06T15:15:52 | 2018-03-06T15:15:52 | 124,095,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,904 | java | package com.kunyao.assistant.web.controller.cross;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.kunyao.assistant.core.dto.Result;
import com.kunyao.assistant.core.dto.ResultFactory;
import com.kunyao.assistant.core.exception.ServiceException;
import com.kunyao.assistant.core.model.CrossInfo;
import com.kunyao.assistant.web.service.CrossInfoService;
@Controller
@RequestMapping(value = "/cc/cross")
@ResponseBody
public class CrossUserController {
@Resource
private CrossInfoService crossInfoService;
/**
* 登录接口
*/
@RequestMapping(value = "/login")
public Result login(@RequestParam String username, @RequestParam String password) throws ServiceException {
CrossInfo crossInfo = crossInfoService.login(username, password);
return ResultFactory.createJsonSuccess(crossInfo);
}
/**
* 金鹰用户信息(简版)
*/
@RequestMapping(value = "/simple")
public Result simple(@RequestParam Integer crossInfoId) throws ServiceException {
CrossInfo crossInfo = crossInfoService.querySimpleCrossInfo(crossInfoId);
return ResultFactory.createJsonSuccess(crossInfo);
}
/**
* 修改密码
*/
@RequestMapping(value = "/updPwd")
public Result updPwd(@RequestParam Integer crossUserId, @RequestParam String oldPassword, @RequestParam String newPassword) throws ServiceException {
crossInfoService.updatePassword(crossUserId, oldPassword, newPassword);
return ResultFactory.createSuccess();
}
/**
* 修改联系电话
*/
@RequestMapping(value = "/updPhone")
public Result updPhone(@RequestParam Integer crossUserId, @RequestParam String phone) throws ServiceException {
crossInfoService.updateContactPhone(crossUserId, phone);
return ResultFactory.createSuccess();
}
/**
* 日程安排
*/
@RequestMapping(value = "/schedule")
public Result schedule(@RequestParam Integer crossUserId) throws ServiceException {
return ResultFactory.createJsonSuccess(crossInfoService.queryCrossTimeList(crossUserId));
}
/**
* 上传个推id
*/
@RequestMapping(value = "/uploadGetuiId")
public Result uploadGetuiId(@RequestParam Integer crossUserId, @RequestParam String getuiId) throws ServiceException {
crossInfoService.uploadGetuiId(crossUserId, getuiId);
return ResultFactory.createSuccess();
}
/**
* 上传坐标
*/
@RequestMapping(value = "/uploadLocation")
public Result uploadLocation(@RequestParam Integer crossUserId, @RequestParam String lat, @RequestParam String lng) throws ServiceException {
crossInfoService.uploadLocation(crossUserId, lat, lng);
return ResultFactory.createSuccess();
}
}
| [
"401111207@qq.com"
] | 401111207@qq.com |
7dfc6ce1aebceaf978d884ab9c2cf154585f7f64 | ba97c5b961ed341e4b0a3378753d514296da0106 | /src/core/space-system-model/src/main/java/org/hbird/core/spacesystemmodel/calibration/PolynomialCalibrator.java | 7dfa6d79a0d81472e49b35c95bd6a8906b9d3065 | [
"Apache-2.0"
] | permissive | Ahmed-Refaat/hbird | 98bba8346931de4034932257a91f1eda1ab069c9 | 58d84e59cee36bca70d1c8c4b65237d50b348af4 | refs/heads/master | 2021-06-01T00:50:23.145312 | 2016-06-05T22:59:36 | 2016-06-05T22:59:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,876 | java | package org.hbird.core.spacesystemmodel.calibration;
import java.util.ArrayList;
import java.util.List;
import org.hbird.core.spacesystemmodel.exceptions.CalibrationException;
import org.hbird.core.spacesystemmodel.tmtc.Parameter;
import org.hbird.core.spacesystemmodel.tmtc.provided.CalibratedParameter;
/**
*
* @author Mark Doyle
*
*/
public class PolynomialCalibrator implements Calibrator {
private final List<Term> terms;
public PolynomialCalibrator(Term... terms) {
this.terms = new ArrayList<Term>(terms.length);
for (Term t : terms) {
this.terms.add(t);
}
}
public PolynomialCalibrator(List<Term> terms) {
this.terms = terms;
}
/**
* Calibrates {@link Number} parameters returning a new {@link CalibratedParameter} holding the result.
*/
@Override
public CalibratedParameter calibrate(Parameter<?> parameter) throws CalibrationException {
Object raw = parameter.getValue();
if (raw instanceof Number) {
double calibrated = calibrate(((Number) raw).doubleValue());
return CalibratedParameter.createFromParameterAndValue(parameter, calibrated);
}
// This is a defensive exception, really the space system model factory should not allow a polynomial calibrator
// to be associated to a non-number parameter.
throw new CalibrationException(
this.getClass().getName()
+ " cannot calibrated a non-number parameter! The space system model has probably been defined incorrectly but really the space system model factory you have used should not allow this to happen.");
}
/**
* Performs the calibration calculation based upon this instances list of {@link Term}s.
*
* @param raw
* @return
*/
private final double calibrate(double raw) {
double calibrated = 0;
for (Term term : terms) {
calibrated += term.getCoefficient() * Math.pow(raw, term.getExponent());
}
return calibrated;
}
}
| [
"markjohndoyle@googlemail.com"
] | markjohndoyle@googlemail.com |
a28818ad1831918bf6c2fb42ecd8e2e37fa782cf | 3e18f2f1f8f319cbfb08e968446cf9b3eaa9b41f | /src/main/java/com/covens/api/transformation/IBloodReserve.java | b87bb4b51d81655fd5bcd983ccb392e78dab7bf6 | [
"MIT"
] | permissive | zabi94/Covens-reborn | f35dbb85f78d1b297956907c3b05f0a9cc045be6 | 6fe956025ad47051e14e2e7c45893ddebc5c330a | refs/heads/master | 2020-04-10T16:17:30.713563 | 2020-03-07T13:23:22 | 2020-03-07T13:23:22 | 161,140,468 | 11 | 2 | NOASSERTION | 2019-05-08T19:31:40 | 2018-12-10T08:15:04 | Java | UTF-8 | Java | false | false | 467 | java | package com.covens.api.transformation;
import java.util.UUID;
import javax.annotation.Nullable;
import net.minecraft.world.World;
public interface IBloodReserve {
int getMaxBlood();
int getBlood();
@Nullable
String getLastDrinker(World world);
UUID getDrinkerUUID();
void setBlood(int integer);
void setMaxBlood(int integer);
void setDrinker(UUID uuid);
default float getPercentFilled() {
return (float) getBlood() / (float) getMaxBlood();
}
}
| [
"zabi94@gmail.com"
] | zabi94@gmail.com |
3bb2730e8397bf9a412d66608188f11b1a51f332 | 4a704e6e3830a2928ca8ea8f762f4347c60b7263 | /Code10/camera/dave/Board.java | ca7da2a049a377337cad2d0070dbca6d9b1c0e96 | [] | no_license | AnuragQ/JavaBatch1130June | cb70b46380c1e60f45eaeec8ba8ab492b5cb0b0c | d8d9988c78d4370fa9bff41db066cb3977482c26 | refs/heads/master | 2021-01-02T09:04:55.635929 | 2017-07-27T07:16:08 | 2017-07-27T07:16:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,881 | java | package com.bmpl.dave;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.Timer;
public class Board extends JPanel implements GameConstant{
Image bg;
Player player;
Timer timer;
Camera camera;
Enemy enemies[] = new Enemy[MAX_ENEMY];
public void prepareEnemy(){
Image img;
int gap = 0;
for(int i = 0 ; i<enemies.length; i++){
if(i%2==0){
img = new ImageIcon(Board.class.getResource("dragon.gif")).getImage();
}
else
{
img = new ImageIcon(Board.class.getResource("fly.gif")).getImage();
}
enemies[i] = new Enemy(GAME_WIDTH + gap, img);
gap += 400;
}
}
public Board(){
setSize(GAME_WIDTH,GAME_HEIGHT);
player = new Player();
//bg = new ImageIcon(Board.class.getResource(BG_IMG)).getImage();
camera = new Camera();
setFocusable(true);
bindEvents();
prepareEnemy();
gameLoop();
}
private void drawEnemies(Graphics g){
for(Enemy enemy : enemies){
enemy.drawEnemy(g);
enemy.move();
}
}
private void bindEvents(){
this.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e){
if(e.getKeyCode()==KeyEvent.VK_RIGHT){
camera.right();
//camera.move();
//player.setSpeed(10);
//player.move();
}
if(e.getKeyCode()==KeyEvent.VK_LEFT){
camera.left();
//camera.move();
//player.setSpeed(-10);
//player.move();
}
if(e.getKeyCode()==KeyEvent.VK_UP){
player.jump();
}
}
});
}
private void gameLoop(){
timer= new Timer(GAME_SPEED, (e)->{
repaint();
player.fall();
checkCollision();
score();
});
timer.start();
}
public boolean isCollision(Player player, Enemy enemy){
int xDistance = Math.abs(player.getX()- enemy.getX());
int yDistance = Math.abs(player.getY()- enemy.getY());
return xDistance<=enemy.getW()-40 && yDistance<=enemy.getH()-40;
}
int counter;
private void score(){
counter++;
}
boolean isGameOver = false;
public void checkCollision(){
for(Enemy enemy: enemies){
if(isCollision(player, enemy)){
isGameOver = true;
//repaint();
//timer.stop();
}
}
}
@Override
public void paintComponent(Graphics g){
super.paintComponent(g);
camera.drawBG(g);
//drawBackGround(g);
// if(isGameOver){
// gameOver(g);
// return;
// }
player.drawPlayer(g);
drawEnemies(g);
g.setColor(Color.RED);
g.drawString("Score "+counter, GAME_WIDTH-200, 70);
}
public void gameOver(Graphics g){
g.setColor(Color.RED);
g.setFont(new Font("Arial",Font.BOLD,40));
g.drawString("Game Over", GAME_WIDTH/2, GAME_HEIGHT/2);
}
// public void drawBackGround(Graphics g){
// g.drawImage(bg, 0, 0, GAME_WIDTH, GAME_HEIGHT, null);
// }
}
| [
"amit4alljava@gmail.com"
] | amit4alljava@gmail.com |
7a785ed4dd69db810497ea09c0689716f543d517 | 02533ed4e8c8e15d4b60d9804a57a29c8c82825b | /guan/web/src/main/java/com/hq/guan/web/cfg/WebConfiguration.java | 945b3b1bea366b939e26497cbf541c3c499828e5 | [] | no_license | douglashu/hq-forecast | 804449d11c5e39f0cfa110214b6431d1d7ac8e23 | 7aa8d9c459d4aa1e62ed3827e1f951773ac249a9 | refs/heads/master | 2021-06-15T15:19:14.566905 | 2017-04-12T07:54:17 | 2017-04-12T07:54:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,542 | java | package com.hq.guan.web.cfg;
import com.hq.scrati.common.filter.HQCharacterEncodingFilter;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.FormHttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
/**
* Created by zhaoyang on 12/01/2017.
*/
@Configuration
public class WebConfiguration {
@Bean
public FilterRegistrationBean webFilter() {
FilterRegistrationBean registration = new FilterRegistrationBean();
HQCharacterEncodingFilter characterEncodingFilter = new HQCharacterEncodingFilter();
characterEncodingFilter.setEncoding("UTF-8");
characterEncodingFilter.addUrlPattern("/tfb_trade_orders", "GBK");
registration.setFilter(characterEncodingFilter);
return registration;
}
@Bean
public HttpMessageConverters messageConverters() {
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
// FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
FormHttpMessageConverter httpMessageConverter = new FormHttpMessageConverter();
HttpMessageConverters converters = new HttpMessageConverters(stringHttpMessageConverter, httpMessageConverter);
return converters;
}
}
| [
"46773109@qq.com"
] | 46773109@qq.com |
dad5c19490423d7c2004c24174a3727fbacec7c3 | 65ce6407650f71b7702e81405bb4b6acf3e6d58f | /src/java/jena-core-2.7.0-incubating/src/main/java/com/hp/hpl/jena/rdf/model/impl/ContainerImpl.java | 149f3baa16b99608a6e2c70d89308918d95bf953 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | arjunakula/Visual-Dialogue-System | 00177cb15fb148a8bb4884946f81201926935627 | 7629301ae28acd6618dd54fd73e40e28584f0c56 | refs/heads/master | 2020-05-02T09:14:32.519255 | 2019-03-26T20:56:34 | 2019-03-26T20:56:34 | 177,865,899 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,079 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hp.hpl.jena.rdf.model.impl;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.vocabulary.RDF;
import com.hp.hpl.jena.graph.*;
import com.hp.hpl.jena.enhanced.*;
import com.hp.hpl.jena.shared.*;
import java.util.*;
/** An internal class not normally of interest to application developers.
* A base class on which the other containers are built.
*
* @author bwm, kers
* @version $Id: ContainerImpl.java,v 1.1 2009-06-29 08:55:32 castagna Exp $
*/
public class ContainerImpl extends ResourceImpl
implements Container, ContainerI {
static NodeIteratorFactory iteratorFactory;
static {
iteratorFactory = new ContNodeIteratorFactoryImpl();
}
/** Creates new ContainerImpl */
public ContainerImpl( ModelCom model ) {
super(model);
}
public ContainerImpl( String uri, ModelCom model ){
super(uri, model);
}
public ContainerImpl(Resource r, ModelCom model) {
super(r.asNode(), model);
}
public ContainerImpl(Node n, EnhGraph g) {
super(n,g);
}
protected ContainerImpl( Resource r )
{ this( r, (ModelCom) r.getModel() ); }
private boolean is( Resource r ) {
return hasProperty(RDF.type, r);
}
@Override
public boolean isAlt() {
return is(RDF.Alt);
}
@Override
public boolean isBag() {
return is(RDF.Bag);
}
@Override
public boolean isSeq() {
return is(RDF.Seq);
}
@Override
public Container add(RDFNode n) {
int i = size();
addProperty(RDF.li(i+1), n);
return this;
}
@Override
public Container add(boolean o) {
return add( String.valueOf( o ) );
}
@Override
public Container add(long o) {
return add( String.valueOf( o ) );
}
@Override
public Container add(char o) {
return add( String.valueOf( o ) );
}
@Override
public Container add( float o ) {
return add( String.valueOf( o ) );
}
@Override
public Container add(double o) {
return add( String.valueOf( o ) );
}
@Override
public Container add(Object o) {
return add( String.valueOf( o ) );
}
@Override
public Container add(String o) {
return add( o, "" );
}
@Override
public Container add(String o, String l) {
return add( literal( o, l ) );
}
@Override
public boolean contains(RDFNode n) {
return containerContains( n );
}
@Override
public boolean contains(boolean o) {
return contains( String.valueOf( o ) );
}
@Override
public boolean contains(long o) {
return contains( String.valueOf( o ) );
}
@Override
public boolean contains(char o) {
return contains( String.valueOf( o ) );
}
@Override
public boolean contains(float o) {
return contains( String.valueOf( o ) );
}
@Override
public boolean contains(double o) {
return contains( String.valueOf( o ) );
}
@Override
public boolean contains(Object o) {
return contains( String.valueOf( o ) );
}
@Override
public boolean contains(String o) {
return contains( o, "" );
}
@Override
public boolean contains( String o, String l ) {
return contains( literal( o, l ) );
}
private Literal literal( String s, String lang )
{ return new LiteralImpl( Node.createLiteral( s, lang, false ), getModelCom() ); }
@Override
public NodeIterator iterator()
{ return listContainerMembers( iteratorFactory ); }
@Override
public int size()
{
int result = 0;
StmtIterator iter = listProperties();
while (iter.hasNext())
if (iter.nextStatement().getPredicate().getOrdinal() != 0) result += 1;
iter.close();
return result;
}
@Override
public Container remove(Statement s) {
int size = size();
Statement last = null;
if (s.getPredicate().getOrdinal() == size) { // if last
getModel().remove(s);
} else {
last = getModel().getRequiredProperty(this, RDF.li(size));
s.changeObject(last.getObject());
getModel().remove(last);
}
if (size() != (size -1))
throw new AssertionFailureException( "container size" );
return this;
}
@Override
public Container remove(int index, RDFNode object) {
remove(getModel().createStatement(this, RDF.li(index), object));
return this;
}
/**
Answer an iterator over the members of this container.
@param f the factory for constructing the final iterator
@return the member iterator
*/
public NodeIterator listContainerMembers( NodeIteratorFactory f )
{
StmtIterator iter = listProperties();
Vector<Statement> result = new Vector<Statement>();
int maxOrdinal = 0;
while (iter.hasNext()) {
Statement stmt = iter.nextStatement();
int ordinal = stmt.getPredicate().getOrdinal();
if (ordinal != 0) {
if (ordinal > maxOrdinal) {
maxOrdinal = ordinal;
result.setSize(ordinal);
}
result.setElementAt(stmt, ordinal-1);
}
}
iter.close();
return f.createIterator( result.iterator(), result, this );
}
public int containerIndexOf( RDFNode n ) {
int result = 0;
StmtIterator iter = listProperties();
while (iter.hasNext()) {
Statement stmt = iter.nextStatement();
int ordinal = stmt.getPredicate().getOrdinal();
if (ordinal != 0 && n.equals( stmt.getObject() )) {
result = ordinal;
break;
}
}
iter.close();
return result;
}
public boolean containerContains( RDFNode n)
{ return containerIndexOf( n ) != 0; }
}
| [
"akula.arjun@gmail.com"
] | akula.arjun@gmail.com |
a9e7717fc8818d447ed60404318b608d0a4bc967 | 4317e72e0ec1f80fd4063ccd60af9b754f088a42 | /ph-tree/src/test/java/com/helger/tree/singleton/MockApplicationSingletonTreeWithUniqueID.java | 5f9f287fa8dc918addb8a0d16c9e4eb2760384a2 | [
"Apache-2.0"
] | permissive | AJcodes42/ph-commons | fabe49f68b900b74984a3f85ecd408005af5654c | 6fb35fb3937c155a38c3856196248c0546134c87 | refs/heads/master | 2021-01-15T14:49:56.555882 | 2017-08-08T12:18:09 | 2017-08-08T12:18:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,569 | java | /**
* Copyright (C) 2014-2017 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* 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.helger.tree.singleton;
import javax.annotation.Nonnull;
import com.helger.commons.annotation.UsedViaReflection;
import com.helger.commons.hashcode.HashCodeGenerator;
public final class MockApplicationSingletonTreeWithUniqueID extends
AbstractApplicationSingletonTreeWithUniqueID <String, String>
{
@Deprecated
@UsedViaReflection
public MockApplicationSingletonTreeWithUniqueID ()
{}
@Nonnull
public static MockApplicationSingletonTreeWithUniqueID getInstance ()
{
return getApplicationSingleton (MockApplicationSingletonTreeWithUniqueID.class);
}
@Override
public boolean equals (final Object o)
{
if (o == this)
return true;
return o instanceof MockApplicationSingletonTreeWithUniqueID;
}
@Override
public int hashCode ()
{
return new HashCodeGenerator (this).getHashCode ();
}
}
| [
"philip@helger.com"
] | philip@helger.com |
7570095ad3b887dfc529d6c747b1cc94dbd52739 | ac97058c3a9dceab0e2173aafa6ce0caa69d1c07 | /javaSE/src/main/java/com.silinx/source/swaggerranger/mylib/Fibonacci.java | 7436a192388516ea30fecd17caeed0cf0448f8ca | [
"Apache-2.0"
] | permissive | Swagger-Ranger/JavaSrc | 069d9ff800813df9b1000c2181027b956f6afd7c | 4ea91254e4910f67e322a941c81939196b0ea106 | refs/heads/master | 2023-05-26T18:30:08.714889 | 2022-04-23T15:14:41 | 2022-04-23T15:14:41 | 252,048,639 | 1 | 1 | Apache-2.0 | 2023-05-17T17:02:27 | 2020-04-01T02:14:31 | Java | UTF-8 | Java | false | false | 588 | java | package com.silinx.source.swaggerranger.mylib;
import com.silinx.source.algs4.algs4_lib.StdOut;
public class Fibonacci {
/* private int N ;
public Fibonacci(int n) {
N=n;
}*/
public static long Fib(int N) {
long[] f =new long[N+1];
return Fib(N,f);
}
public static long Fib(int N, long[] f) {
if (f[N] == 0) {
if (N == 1) {
f[N] = 1;
}
else if (N > 1) {
f[N] = Fib(N - 1, f) + Fib(N - 2, f);
}
}
return f[N];
}
public static void main( String[] args) {
for (int N = 0; N < 50; N++)
StdOut.println(N + " " + Fib(N));
}
}
| [
"liufei32@outlook.com"
] | liufei32@outlook.com |
851f712b6f95580beb9ea5c190946994198f468c | 96c12f17f68a0d3f5a5a5e6952fdfb55c2cb6471 | /src/datagen/additions/java/mekanism/additions/common/loot/AdditionsEntityLootTables.java | cebb1e618c2038939a3baaab96e47418dfdf4246 | [
"MIT"
] | permissive | Vaelzan/Mekanism | 123feeb1a230381b22bc29f2a64d3ad27f140802 | b39588aae8073b3c2a70b1ac92108d8c96d82f31 | refs/heads/master | 2022-10-17T03:08:38.614264 | 2020-05-28T17:53:44 | 2020-05-28T17:53:44 | 272,005,020 | 0 | 0 | MIT | 2020-06-13T12:32:22 | 2020-06-13T12:32:21 | null | UTF-8 | Java | false | false | 5,858 | java | package mekanism.additions.common.loot;
import mekanism.additions.common.registries.AdditionsEntityTypes;
import mekanism.common.loot.table.BaseEntityLootTables;
import net.minecraft.advancements.criterion.EntityPredicate;
import net.minecraft.block.Blocks;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tags.EntityTypeTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.storage.loot.ConstantRange;
import net.minecraft.world.storage.loot.ItemLootEntry;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.world.storage.loot.LootPool;
import net.minecraft.world.storage.loot.LootTable;
import net.minecraft.world.storage.loot.RandomValueRange;
import net.minecraft.world.storage.loot.TagLootEntry;
import net.minecraft.world.storage.loot.conditions.EntityHasProperty;
import net.minecraft.world.storage.loot.conditions.KilledByPlayer;
import net.minecraft.world.storage.loot.conditions.RandomChanceWithLooting;
import net.minecraft.world.storage.loot.functions.LootingEnchantBonus;
import net.minecraft.world.storage.loot.functions.SetCount;
import net.minecraft.world.storage.loot.functions.SetNBT;
public class AdditionsEntityLootTables extends BaseEntityLootTables {
@Override
protected void addTables() {
//Copy of vanilla's creeper drops
registerLootTable(AdditionsEntityTypes.BABY_CREEPER, LootTable.builder()
.addLootPool(
LootPool.builder()
.rolls(ConstantRange.of(1))
.addEntry(ItemLootEntry.builder(Items.GUNPOWDER)
.acceptFunction(SetCount.builder(RandomValueRange.of(0.0F, 2.0F)))
.acceptFunction(LootingEnchantBonus.builder(RandomValueRange.of(0.0F, 1.0F)))
)
).addLootPool(LootPool.builder()
.addEntry(TagLootEntry.func_216176_b(ItemTags.MUSIC_DISCS))
.acceptCondition(EntityHasProperty.builder(LootContext.EntityTarget.KILLER, EntityPredicate.Builder.create().type(EntityTypeTags.SKELETONS)))
)
);
//Copy of vanilla's enderman drops
registerLootTable(AdditionsEntityTypes.BABY_ENDERMAN, LootTable.builder()
.addLootPool(LootPool.builder()
.rolls(ConstantRange.of(1))
.addEntry(ItemLootEntry.builder(Items.ENDER_PEARL)
.acceptFunction(SetCount.builder(RandomValueRange.of(0.0F, 1.0F)))
.acceptFunction(LootingEnchantBonus.builder(RandomValueRange.of(0.0F, 1.0F)))
)
)
);
//Copy of vanilla's skeleton drops
registerLootTable(AdditionsEntityTypes.BABY_SKELETON, skeletonDrops());
//Copy of vanilla's stray drops
CompoundNBT slownessPotion = new CompoundNBT();
slownessPotion.putString("Potion", "minecraft:slowness");
registerLootTable(AdditionsEntityTypes.BABY_STRAY, skeletonDrops()
.addLootPool(LootPool.builder()
.rolls(ConstantRange.of(1))
.addEntry(ItemLootEntry.builder(Items.TIPPED_ARROW)
.acceptFunction(SetCount.builder(RandomValueRange.of(0.0F, 1.0F)))
.acceptFunction(LootingEnchantBonus.builder(RandomValueRange.of(0.0F, 1.0F))
.func_216072_a(1)
).acceptFunction(SetNBT.builder(slownessPotion))
).acceptCondition(KilledByPlayer.builder())
)
);
//Copy of vanilla's wither skeleton drops
registerLootTable(AdditionsEntityTypes.BABY_WITHER_SKELETON, LootTable.builder()
.addLootPool(LootPool.builder()
.rolls(ConstantRange.of(1))
.addEntry(ItemLootEntry.builder(Items.COAL)
.acceptFunction(SetCount.builder(RandomValueRange.of(-1.0F, 1.0F)))
.acceptFunction(LootingEnchantBonus.builder(RandomValueRange.of(0.0F, 1.0F))))
).addLootPool(LootPool.builder()
.rolls(ConstantRange.of(1))
.addEntry(ItemLootEntry.builder(Items.BONE)
.acceptFunction(SetCount.builder(RandomValueRange.of(0.0F, 2.0F)))
.acceptFunction(LootingEnchantBonus.builder(RandomValueRange.of(0.0F, 1.0F))))
).addLootPool(LootPool.builder()
.rolls(ConstantRange.of(1))
.addEntry(ItemLootEntry.builder(Blocks.WITHER_SKELETON_SKULL))
.acceptCondition(KilledByPlayer.builder())
//Double vanilla's skull drop chance due to being "younger and less brittle"
.acceptCondition(RandomChanceWithLooting.builder(0.05F, 0.01F))
)
);
}
/**
* Copy of vanilla's skeleton drops
*/
private LootTable.Builder skeletonDrops() {
return LootTable.builder()
.addLootPool(LootPool.builder()
.rolls(ConstantRange.of(1))
.addEntry(ItemLootEntry.builder(Items.ARROW)
.acceptFunction(SetCount.builder(RandomValueRange.of(0.0F, 2.0F)))
.acceptFunction(LootingEnchantBonus.builder(RandomValueRange.of(0.0F, 1.0F))))
).addLootPool(LootPool.builder()
.rolls(ConstantRange.of(1))
.addEntry(ItemLootEntry.builder(Items.BONE)
.acceptFunction(SetCount.builder(RandomValueRange.of(0.0F, 2.0F)))
.acceptFunction(LootingEnchantBonus.builder(RandomValueRange.of(0.0F, 1.0F)))
)
);
}
} | [
"richard@freimer.com"
] | richard@freimer.com |
f4cbd1cb82a81548c33abd05e2219b14d5a62d26 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/23/23_c738727ec1123dbc27fe4bc5bb39e1509c7854ca/QTManager/23_c738727ec1123dbc27fe4bc5bb39e1509c7854ca_QTManager_t.java | bf1ca031f14fc464c27aa51ffc62b44f68701eba | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 1,586 | java | package xml2labbook;
import quicktime.*;
import quicktime.io.*;
import quicktime.qd.*;
import quicktime.std.StdQTConstants;
import quicktime.std.image.*;
import quicktime.std.movies.*;
import quicktime.app.image.*;
import quicktime.app.display.*;
import quicktime.util.*;
import org.concord.LabBook.*;
public class QTManager{
public boolean qtInstalled = false;
public QTManager(){
}
public void openQTSession(){
try{
QTSession.open();
qtInstalled = true;
} catch (quicktime.QTException e) {
System.out.println(e.toString());
}
}
public void closeQTSession(){
if(qtInstalled) QTSession.close();
}
public void exportImage(String str,LObjImage image){
if(!qtInstalled) return;
try{
QTFile inputFile = new QTFile (str);
GraphicsExporter graphicsExporter = new GraphicsExporter(StdQTConstants.kQTFileTypeBMP);
GraphicsImporter grip = null;
// grip = new GraphicsImporter(inputFile);
if(str.endsWith(".gif") || str.endsWith(".GIF")){
grip = new GraphicsImporter(StdQTConstants.kQTFileTypeGIF);
grip.setDataFile(inputFile);
}else{
grip = new GraphicsImporter(inputFile);
}
graphicsExporter.setInputGraphicsImporter(grip);
graphicsExporter.setDepth(8);
QTHandle handle = new QTHandle();
graphicsExporter.setOutputHandle(handle);
int size = graphicsExporter.doExport ();
if(size > 0){
image.loadImage(handle.getBytes());
}
}catch(Exception e){
System.out.println("exportImage exception "+e);
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
301f7d81331c1d2a4e8de36351621060a0ab7896 | 94c46a6399b92ae416a212f9eb388822e379a222 | /basex-core/src/main/java/org/basex/query/value/seq/StrSeq.java | bc1b6e0b1268cb0e28886c3b3884e0113a749286 | [
"BSD-3-Clause"
] | permissive | rosishadura/basex | ddfc44f89c62ddc2cb67b316b86d635079af589b | 5b5b42fe4fb8adc73e6cde8d46a3d40bebfaa5b4 | refs/heads/master | 2021-01-18T13:31:25.577634 | 2014-07-21T17:42:51 | 2014-07-21T17:42:51 | 1,387,757 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,828 | java | package org.basex.query.value.seq;
import java.util.*;
import org.basex.query.*;
import org.basex.query.expr.*;
import org.basex.query.value.*;
import org.basex.query.value.item.*;
import org.basex.query.value.type.*;
import org.basex.util.*;
import org.basex.util.list.*;
/**
* Sequence of items of type {@link Str xs:string}, containing at least two of them.
*
* @author BaseX Team 2005-14, BSD License
* @author Christian Gruen
*/
public final class StrSeq extends NativeSeq {
/** Values. */
private final byte[][] values;
/**
* Constructor.
* @param values values
*/
private StrSeq(final byte[][] values) {
super(values.length, AtomType.STR);
this.values = values;
}
@Override
public Str itemAt(final long pos) {
return Str.get(values[(int) pos]);
}
@Override
public boolean sameAs(final Expr cmp) {
return cmp instanceof StrSeq && Arrays.equals(values, ((StrSeq) cmp).values);
}
@Override
public String[] toJava() {
final String[] tmp = new String[values.length];
for(int v = 0; v < values.length; v++) tmp[v] = Token.string(values[v]);
return tmp;
}
@Override
public Value reverse() {
final int s = values.length;
final byte[][] tmp = new byte[s][];
for(int l = 0, r = s - 1; l < s; l++, r--) tmp[l] = values[r];
return get(tmp);
}
// STATIC METHODS =====================================================================
/**
* Creates a sequence with the specified items.
* @param items items
* @return value
*/
public static Value get(final TokenList items) {
return items.isEmpty() ? Empty.SEQ : items.size() == 1 ?
Str.get(items.get(0)) : new StrSeq(items.toArray());
}
/**
* Creates a sequence with the specified items.
* @param items items
* @return value
*/
public static Value get(final byte[][] items) {
return items.length == 0 ? Empty.SEQ : items.length == 1 ?
Str.get(items[0]) : new StrSeq(items);
}
/**
* Creates a sequence with the items in the specified expressions.
* @param values values
* @param size size of resulting sequence
* @return value
* @throws QueryException query exception
*/
public static Value get(final Value[] values, final int size) throws QueryException {
final byte[][] tmp = new byte[size][];
int t = 0;
for(final Value val : values) {
// speed up construction, depending on input
final int vs = (int) val.size();
if(val instanceof Item) {
tmp[t++] = ((Item) val).string(null);
} else if(val instanceof StrSeq) {
final StrSeq sq = (StrSeq) val;
System.arraycopy(sq.values, 0, tmp, t, vs);
t += vs;
} else {
for(int v = 0; v < vs; v++) tmp[t++] = val.itemAt(v).string(null);
}
}
return get(tmp);
}
}
| [
"christian.gruen@gmail.com"
] | christian.gruen@gmail.com |
074b86341c67bc6dc7cc9a17f272c00a11b43ac3 | c926472c721424248147f6e09932ec4e1b11d824 | /jcart-admin/src/main/java/com/sivalabs/jcart/admin/security/PostAuthorizationFilter.java | d5bf2f246050b8be9dcd43a2f2e14b9108ee2697 | [
"MIT"
] | permissive | Aqil92/jcart | ba9adbd487e4e7921cfc07b0152a7c03b1b383f7 | 45c1000b657507e49c53d04ecfea10f9a58dddee | refs/heads/master | 2020-04-09T05:32:39.606861 | 2017-01-22T03:03:08 | 2017-01-22T03:03:08 | 160,068,717 | 1 | 0 | MIT | 2018-12-02T16:49:22 | 2018-12-02T16:49:22 | null | UTF-8 | Java | false | false | 1,229 | java | /**
*
*/
package com.sivalabs.jcart.admin.security;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import com.sivalabs.jcart.security.SecurityService;
/**
* @author Siva
*
*/
@Component
public class PostAuthorizationFilter extends OncePerRequestFilter
{
@Autowired SecurityService securityService;
protected String[] IGNORE_URIS = {
"/assets/"
};
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws ServletException, IOException
{
String uri = request.getRequestURI();
if(!isIgnorableURI(uri)){
String menu = MenuConfiguration.getMatchingMenu(uri);
request.setAttribute("CURRENT_MENU", menu);
}
chain.doFilter(request, response);
}
private boolean isIgnorableURI(String uri)
{
for (String u : IGNORE_URIS)
{
if(uri.startsWith(u))
{
return true;
}
}
return false;
}
}
| [
"sivaprasadreddy.k@gmail.com"
] | sivaprasadreddy.k@gmail.com |
40aa1cbd078b2043d5f9921db110b93545b15724 | fecca136b2ce70052c0c9b35c3ea3a73a23fb8c2 | /lib/owlapi/src/org/coode/owlapi/rdfxml/parser/TypeSelfRestrictionHandler.java | 110602045622576ce14e78e0fb09820627ec41fc | [] | no_license | ZongleiJiao/OWLAPI2CPP | 8d11bd55eedb6ec78593504e1121bbbf01e5aa8a | 860e63d16418ac3071d2de3e3ac4b06e23397326 | refs/heads/master | 2021-01-22T03:30:12.510289 | 2012-08-06T13:44:21 | 2012-08-06T13:44:21 | 3,264,586 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,622 | java | /*
* This file is part of the OWL API.
*
* The contents of this file are subject to the LGPL License, Version 3.0.
*
* Copyright (C) 2011, The University of Manchester
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*
* Alternatively, the contents of this file may be used under the terms of the Apache License, Version 2.0
* in which case, the provisions of the Apache License Version 2.0 are applicable instead of those above.
*
* Copyright 2011, University of Manchester
*
* 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.coode.owlapi.rdfxml.parser;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.UnloadableImportException;
import org.semanticweb.owlapi.vocab.OWLRDFVocabulary;
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
* Bio-Health Informatics Group<br>
* Date: 13-Feb-2007<br><br>
*/
@SuppressWarnings("deprecation")
public class TypeSelfRestrictionHandler extends BuiltInTypeHandler {
public TypeSelfRestrictionHandler(OWLRDFConsumer consumer) {
super(consumer, OWLRDFVocabulary.OWL_SELF_RESTRICTION.getIRI());
}
@Override
public void handleTriple(IRI subject, IRI predicate, IRI object) throws UnloadableImportException {
consumeTriple(subject, predicate, object);
getConsumer().addOWLRestriction(subject, false);
// Patch to new OWL syntax
getConsumer().addTriple(subject, OWLRDFVocabulary.OWL_HAS_SELF.getIRI(), getDataFactory().getOWLLiteral(true));
}
}
| [
"zljia1@student.monash.edu"
] | zljia1@student.monash.edu |
435075727687bc2353e3654b7f62fa9f73ada899 | 647eef4da03aaaac9872c8b210e4fc24485e49dc | /TestMemory/wandoujia/src/main/java/com/android/volley/toolbox/i.java | 055b50bdb3c94cd93d7de741a87700017bacba35 | [] | no_license | AlbertSnow/git_workspace | f2d3c68a7b6e62f41c1edcd7744f110e2bf7f021 | a0b2cd83cfa6576182f440a44d957a9b9a6bda2e | refs/heads/master | 2021-01-22T17:57:16.169136 | 2016-12-05T15:59:46 | 2016-12-05T15:59:46 | 28,154,580 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 276 | java | package com.android.volley.toolbox;
public abstract interface i
{
public abstract String a(String paramString);
}
/* Location: C:\WorkSpace\WandDouJiaNotificationBar\WanDou1.jar
* Qualified Name: com.android.volley.toolbox.i
* JD-Core Version: 0.6.0
*/ | [
"zhaojialiang@conew.com"
] | zhaojialiang@conew.com |
6bde7d7b4415e90e20e37b3cbd7aa3d97b1d6be5 | dc7e0d68cf290ce63ee7f12eb1d7d347dbf606d0 | /app/src/main/java/com/arialyy/simple/core/download/group/ChildHandleDialog.java | 944df0895ed111b9d6d184b3ff0a28d296ba73a1 | [
"Apache-2.0"
] | permissive | Louiswang86/Aria | 5fa5fd75725ff9672e9413a95aecc6b817f9fc74 | 1a04a6d221ac532fbdbe5b64fd994ad4c5f48355 | refs/heads/master | 2022-11-27T18:12:05.976191 | 2020-08-12T00:52:00 | 2020-08-12T00:52:00 | 286,897,946 | 1 | 0 | Apache-2.0 | 2020-08-12T02:36:46 | 2020-08-12T02:36:45 | null | UTF-8 | Java | false | false | 5,747 | java | /*
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
*
* 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.arialyy.simple.core.download.group;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import com.arialyy.annotations.DownloadGroup;
import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.task.DownloadGroupTask;
import com.arialyy.frame.util.show.L;
import com.arialyy.simple.R;
import com.arialyy.simple.base.BaseDialog;
import com.arialyy.simple.databinding.DialogSubTaskHandlerBinding;
import com.arialyy.simple.widget.HorizontalProgressBarWithNumber;
import java.util.List;
/**
* Created by lyy on 2017/9/5.
*/
@SuppressLint("ValidFragment") public class ChildHandleDialog
extends BaseDialog<DialogSubTaskHandlerBinding> implements View.OnClickListener {
TextView mSub;
TextView mGroup;
HorizontalProgressBarWithNumber mPb;
private String mGroupHash;
private String mChildName;
private List<String> mUrls;
private DownloadEntity mChildEntity;
public ChildHandleDialog(Context context, List<String> urls, DownloadEntity childEntity) {
super(context);
setStyle(STYLE_NO_TITLE, R.style.Theme_Light_Dialog);
mChildEntity = childEntity;
mGroupHash = "任务组测试";
mUrls = urls;
mChildName = childEntity.getFileName();
}
@Override protected void init(Bundle savedInstanceState) {
super.init(savedInstanceState);
Aria.download(getContext()).register();
initWidget();
}
@Override public void onDestroy() {
super.onDestroy();
Aria.download(getContext()).unRegister();
}
private void initWidget() {
mSub = findViewById(R.id.sub_task);
mGroup = findViewById(R.id.task_group);
mPb = findViewById(R.id.pb);
findViewById(R.id.stop).setOnClickListener(this);
findViewById(R.id.start).setOnClickListener(this);
//findViewById(R.id.cancel).setOnClickListener(this);
mGroup.setText("任务组:" + mGroupHash);
mSub.setText("子任务:" + mChildName);
mPb.setProgress((int) (mChildEntity.getCurrentProgress() * 100 / mChildEntity.getFileSize()));
Window window = getDialog().getWindow();
window.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
WindowManager.LayoutParams p = window.getAttributes();
p.width = ViewGroup.LayoutParams.MATCH_PARENT;
window.setAttributes(p);
window.setWindowAnimations(R.style.dialogStyle);
}
@DownloadGroup.onSubTaskRunning void onSubTaskRunning(DownloadGroupTask groupTask,
DownloadEntity subEntity) {
if (!subEntity.getUrl().equals(mChildEntity.getUrl())) return;
mPb.setProgress(subEntity.getPercent());
}
@DownloadGroup.onSubTaskPre void onSubTaskPre(DownloadGroupTask groupTask,
DownloadEntity subEntity) {
if (!subEntity.getUrl().equals(mChildEntity.getUrl())) return;
L.d(TAG, subEntity.getPercent() + "");
}
@DownloadGroup.onSubTaskStop void onSubTaskStop(DownloadGroupTask groupTask,
DownloadEntity subEntity) {
if (!subEntity.getUrl().equals(mChildEntity.getUrl())) return;
mSub.setText("子任务:" + mChildName + ",状态:任务停止");
}
@DownloadGroup.onSubTaskStart void onSubTaskStart(DownloadGroupTask groupTask,
DownloadEntity subEntity) {
if (!subEntity.getUrl().equals(mChildEntity.getUrl())) return;
mSub.setText("子任务:" + mChildName + ",状态:下载中");
}
//@DownloadGroup.onSubTaskCancel void onSubTaskCancel(DownloadGroupTask groupTask,
// DownloadEntity subEntity) {
// Log.d(TAG, "new Size: " + groupTask.getConvertFileSize());
// mSub.setText("子任务:" + mChildName + ",状态:取消下载");
//}
@DownloadGroup.onSubTaskComplete void onSubTaskComplete(DownloadGroupTask groupTask,
DownloadEntity subEntity) {
if (!subEntity.getUrl().equals(mChildEntity.getUrl())) return;
mSub.setText("子任务:" + mChildName + ",状态:任务完成");
mPb.setProgress(100);
}
@DownloadGroup.onSubTaskFail void onSubTaskFail(DownloadGroupTask groupTask,
DownloadEntity subEntity) {
if (!subEntity.getUrl().equals(mChildEntity.getUrl())) return;
L.d(TAG, subEntity.getPercent() + "");
}
@Override protected int setLayoutId() {
return R.layout.dialog_sub_task_handler;
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.start:
Aria.download(getContext())
.loadGroup(mUrls)
.getSubTaskManager()
.startSubTask(mChildEntity.getUrl());
break;
case R.id.stop:
Aria.download(getContext())
.loadGroup(mUrls)
.getSubTaskManager()
.stopSubTask(mChildEntity.getUrl());
break;
//case R.id.cancel:
// Aria.download(this).load(mUrls).getSubTaskManager().cancelSubTask(mChildEntity.getUrl());
// break;
}
}
@Override protected void dataCallback(int result, Object obj) {
}
}
| [
"511455842@qq.com"
] | 511455842@qq.com |
a4336360707dbb658cb53b69d83ebe83235358ef | ed865190ed878874174df0493b4268fccb636a29 | /PuridiomWeb/src/com/tsa/puridiom/handlers/AssetAddClonesHandler.java | 02992b3d99746bb5da8215bee0014290172bdf38 | [] | no_license | zach-hu/srr_java8 | 6841936eda9fdcc2e8185b85b4a524b509ea4b1b | 9b6096ba76e54da3fe7eba70989978edb5a33d8e | refs/heads/master | 2021-01-10T00:57:42.107554 | 2015-11-06T14:12:56 | 2015-11-06T14:12:56 | 45,641,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,065 | java | package com.tsa.puridiom.handlers;
import com.tsagate.foundation.processengine.*;
import java.util.*;
public class AssetAddClonesHandler implements IHandler
{
public Map handleRequest (Map incomingRequest) throws Exception
{
try
{
PuridiomProcessLoader processLoader = new PuridiomProcessLoader();
PuridiomProcess process = processLoader.loadProcess("asset-add-clones.xml");
process.executeProcess(incomingRequest);
if (process.getStatus() == Status.SUCCEEDED)
{
incomingRequest.put("viewPage", (String) incomingRequest.get("successPage"));
}
else
{
incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage"));
}
}
catch (Exception exception)
{
incomingRequest.put("errorMsg", exception.getMessage());
incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage"));
throw exception;
}
finally
{
if (incomingRequest.get("viewPage") == null)
{
incomingRequest.put("viewPage", (String) incomingRequest.get("failurePage"));
}
}
return incomingRequest;
}
} | [
"brickerz@9227675a-84a3-4efe-bc6c-d7b3a3cf6466"
] | brickerz@9227675a-84a3-4efe-bc6c-d7b3a3cf6466 |
d370c1ac1498c8fe4a7980b6a21d89014fe9448a | 42bd79973e3019c02ba259a24ef140e12dd00c55 | /src/main/java/io/FileReaderDemo.java | a4b8110c354c309998541f70aa9bd407633cae2a | [] | no_license | iMustang/l-jdk | 2b9b27ba2cf96297bd303d70cba484137f6fd353 | 1be195ff74f093e77330747489087d4e6d843883 | refs/heads/master | 2022-07-15T21:59:17.553017 | 2020-01-23T05:59:27 | 2020-01-23T05:59:27 | 181,631,822 | 0 | 0 | null | 2021-04-26T19:07:54 | 2019-04-16T06:51:13 | Java | UTF-8 | Java | false | false | 779 | java | package io;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class FileReaderDemo {
public static void main(String[] args) throws IOException {
readTest2();
}
public static void readTest2() throws IOException {
File file = new File("F:/a.txt");
FileReader fileReader = new FileReader(file);
char[] buf = new char[1024];
int length;
while ((length = fileReader.read(buf)) != -1) {
System.out.print(new String(buf, 0, length));
}
fileReader.close();
}
public static void readTest1() throws IOException {
File file = new File("F:/a.txt");
FileReader fileReader = new FileReader(file);
int content;
while ((content = fileReader.read()) != -1) {
System.out.print((char) content);
}
fileReader.close();
}
}
| [
"xMustang@foxmail.com"
] | xMustang@foxmail.com |
4d6f2bf6c0175fbf70f8c3584a85cf0f08e5fd8c | 5636e23ca013f1c6d1b88e1715ec038035013f12 | /org.osgi.util.function/src/org/osgi/util/function/Consumer.java | de119bd081d573a23401845cea9ca266bd48e159 | [
"EPL-1.0",
"Apache-2.0",
"EPL-2.0",
"CPL-1.0"
] | permissive | osgi/osgi | b897163557738fb40d03c368a3259b5e670a7d5a | 0ec08abcda0a75a8efc99b5f4a178497f73f143c | refs/heads/main | 2023-08-31T11:29:00.133907 | 2023-08-02T15:55:38 | 2023-08-02T15:55:38 | 255,701,604 | 76 | 36 | Apache-2.0 | 2023-09-06T23:45:13 | 2020-04-14T19:09:53 | Java | UTF-8 | Java | false | false | 4,016 | java | /*******************************************************************************
* Copyright (c) Contributors to the Eclipse Foundation
*
* 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.
*
* SPDX-License-Identifier: Apache-2.0
*******************************************************************************/
package org.osgi.util.function;
import static java.util.Objects.requireNonNull;
import org.osgi.annotation.versioning.ConsumerType;
/**
* A function that accepts a single argument and produces no result.
* <p>
* This is a functional interface and can be used as the assignment target for a
* lambda expression or method reference.
*
* @param <T> The type of the function input.
* @ThreadSafe
* @since 1.1
* @author $Id$
*/
@ConsumerType
@FunctionalInterface
public interface Consumer<T> {
/**
* Applies this function to the specified argument.
*
* @param t The input to this function.
* @throws Exception An exception thrown by the method.
*/
void accept(T t) throws Exception;
/**
* Compose the specified {@code Consumer} to be called after this
* {@code Consumer}.
*
* @param after The {@code Consumer} to be called after this
* {@code Consumer} is called. Must not be {@code null}.
* @return A {@code Consumer} composed of this {@code Consumer} and the
* specified {@code Consumer}.
*/
default Consumer<T> andThen(Consumer< ? super T> after) {
requireNonNull(after);
return t -> {
accept(t);
after.accept(t);
};
}
/**
* Returns a {@code java.util.function.Consumer} which wraps the specified
* {@code Consumer} and throws any thrown exceptions.
* <p>
* The returned {@code java.util.function.Consumer} will throw any exception
* thrown by the wrapped {@code Consumer}.
*
* @param <T> The type of the function input.
* @param wrapped The {@code Consumer} to wrap. Must not be {@code null}.
* @return A {@code java.util.function.Consumer} which wraps the specified
* {@code Consumer}.
*/
static <T> java.util.function.Consumer<T> asJavaConsumer(
Consumer<T> wrapped) {
requireNonNull(wrapped);
return t -> {
try {
wrapped.accept(t);
} catch (Exception e) {
throw Exceptions.throwUnchecked(e);
}
};
}
/**
* Returns a {@code java.util.function.Consumer} which wraps the specified
* {@code Consumer} and discards any thrown {@code Exception}s.
* <p>
* The returned {@code java.util.function.Consumer} will discard any
* {@code Exception} thrown by the wrapped {@code Consumer}.
*
* @param <T> The type of the function input.
* @param wrapped The {@code Consumer} to wrap. Must not be {@code null}.
* @return A {@code java.util.function.Consumer} which wraps the specified
* {@code Consumer}.
*/
static <T> java.util.function.Consumer<T> asJavaConsumerIgnoreException(
Consumer<T> wrapped) {
requireNonNull(wrapped);
return t -> {
try {
wrapped.accept(t);
} catch (Exception e) {
// discard
}
};
}
/**
* Returns a {@code Consumer} which wraps a
* {@code java.util.function.Consumer}.
*
* @param <T> The type of the function input.
* @param wrapped The {@code java.util.function.Consumer} to wrap. Must not
* be {@code null}.
* @return A {@code Consumer} which wraps the specified
* {@code java.util.function.Consumer}.
*/
static <T> Consumer<T> asConsumer(java.util.function.Consumer<T> wrapped) {
requireNonNull(wrapped);
return wrapped::accept;
}
}
| [
"hargrave@us.ibm.com"
] | hargrave@us.ibm.com |
fa91d52d9921175b156036f37fc8848ae192f007 | b31120cefe3991a960833a21ed54d4e10770bc53 | /modules/org.llvm.ir/src/org/llvm/ir/MemCpyInst.java | 87cfb183041f76d0088d9c1f887f62fdabff3f5a | [] | no_license | JianpingZeng/clank | 94581710bd89caffcdba6ecb502e4fdb0098caaa | bcdf3389cd57185995f9ee9c101a4dfd97145442 | refs/heads/master | 2020-11-30T05:36:06.401287 | 2017-10-26T14:15:27 | 2017-10-26T14:15:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,740 | java | /**
* This file was converted to Java from the original LLVM source file. The original
* source file follows the LLVM Release License, outlined below.
*
* ==============================================================================
* LLVM Release License
* ==============================================================================
* University of Illinois/NCSA
* Open Source License
*
* Copyright (c) 2003-2017 University of Illinois at Urbana-Champaign.
* All rights reserved.
*
* Developed by:
*
* LLVM Team
*
* University of Illinois at Urbana-Champaign
*
* http://llvm.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal with
* 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:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimers.
*
* * Redistributions in binary form must reproduce the above copyright notice
* this list of conditions and the following disclaimers in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the names of the LLVM Team, University of Illinois at
* Urbana-Champaign, nor the names of its contributors may be used to
* endorse or promote products derived from this Software without specific
* prior written permission.
*
* 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
* CONTRIBUTORS 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 WITH THE
* SOFTWARE.
*
* ==============================================================================
* Copyrights and Licenses for Third Party Software Distributed with LLVM:
* ==============================================================================
* The LLVM software contains code written by third parties. Such software will
* have its own individual LICENSE.TXT file in the directory in which it appears.
* This file will describe the copyrights, license, and restrictions which apply
* to that code.
*
* The disclaimer of warranty in the University of Illinois Open Source License
* applies to all code in the LLVM Distribution, and nothing in any of the
* other licenses gives permission to use the names of the LLVM Team or the
* University of Illinois to endorse or promote products derived from this
* Software.
*
* The following pieces of software have additional or alternate copyrights,
* licenses, and/or restrictions:
*
* Program Directory
* ------- ---------
* Autoconf llvm/autoconf
* llvm/projects/ModuleMaker/autoconf
* Google Test llvm/utils/unittest/googletest
* OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
* pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
* ARM contributions llvm/lib/Target/ARM/LICENSE.TXT
* md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
*/
package org.llvm.ir;
import org.clank.java.*;
import org.clank.support.*;
import org.clank.support.aliases.*;
import org.clank.support.JavaDifferentiators.*;
import static org.clank.java.built_in.*;
import static org.clank.support.Casts.*;
import static org.clank.java.io.*;
import static org.clank.java.std.*;
import static org.clank.java.std_pair.*;
import static org.clank.support.NativePointer.*;
import static org.clank.support.NativeType.*;
import static org.clank.support.Native.*;
import static org.clank.support.Unsigned.*;
import org.clank.support.NativeCallback.*;
import static org.llvm.adt.ADTAliases.*;
import static org.llvm.adt.ADTFunctionPointers.*;
import org.llvm.llvmc.*;
import static org.llvm.support.llvm.*;
import org.llvm.support.*;
import org.llvm.adt.*;
import org.llvm.adt.aliases.*;
import org.llvm.ir.*;
import org.llvm.ir.impl.*;
import org.llvm.ir.Metadata.*;
import org.llvm.ir.intrinsic.*;
import static org.llvm.ir.java.IRFunctionPointers.*;
import static org.llvm.ir.java.IrRTTI.*;
import static org.llvm.ir.java.IRJavaDifferentiators.*;
import org.llvm.cl.*;
import org.llvm.ir.java.IRJavaDifferentiators.*;
import org.llvm.ir.java.IRMemberPointers.*;
import org.llvm.ir.java.*;
import org.llvm.pass.*;
import org.llvm.support.dwarf.Tag;
import org.llvm.support.sys.SmartRWMutex;
import org.llvm.ir.java.cst_pred_ty_Predicate;
import org.llvm.ir.legacy.PassManagerBase;
import org.llvm.ir.PassManagerGlobals.*;
import org.llvm.ir.java.MDNodeKeyImpl;
import static org.llvm.adt.HashingGlobals.*;
/// This class wraps the llvm.memcpy intrinsic.
//<editor-fold defaultstate="collapsed" desc="llvm::MemCpyInst">
@Converted(kind = Converted.Kind.AUTO,
source = "${LLVM_SRC}/llvm/include/llvm/IR/IntrinsicInst.h", line = 273,
FQN="llvm::MemCpyInst", NM="_ZN4llvm10MemCpyInstE",
cmd="jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.ir/llvmToClangType ${LLVM_SRC}/llvm/lib/IR/IntrinsicInst.cpp -nm=_ZN4llvm10MemCpyInstE")
//</editor-fold>
public class MemCpyInst extends /*public*/ MemTransferInst implements Destructors.ClassWithDestructor {
/*public:*/
// Methods for support type inquiry through isa, cast, and dyn_cast:
//<editor-fold defaultstate="collapsed" desc="llvm::MemCpyInst::classof">
@Converted(kind = Converted.Kind.MANUAL_COMPILATION,
source = "${LLVM_SRC}/llvm/include/llvm/IR/IntrinsicInst.h", line = 276,
FQN="llvm::MemCpyInst::classof", NM="_ZN4llvm10MemCpyInst7classofEPKNS_13IntrinsicInstE",
cmd="jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.ir/llvmToClangType ${LLVM_SRC}/llvm/lib/IR/IntrinsicInst.cpp -nm=_ZN4llvm10MemCpyInst7classofEPKNS_13IntrinsicInstE")
//</editor-fold>
public static /*inline*/ boolean classof(/*const*/ IntrinsicInst /*P*/ I) {
return I.getIntrinsicID() == ID.memcpy;
}
//<editor-fold defaultstate="collapsed" desc="llvm::MemCpyInst::classof">
@Converted(kind = Converted.Kind.AUTO,
source = "${LLVM_SRC}/llvm/include/llvm/IR/IntrinsicInst.h", line = 279,
FQN="llvm::MemCpyInst::classof", NM="_ZN4llvm10MemCpyInst7classofEPKNS_5ValueE",
cmd="jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.ir/llvmToClangType ${LLVM_SRC}/llvm/lib/IR/IntrinsicInst.cpp -nm=_ZN4llvm10MemCpyInst7classofEPKNS_5ValueE")
//</editor-fold>
public static /*inline*/ boolean classof(/*const*/ Value /*P*/ V) {
return isa_IntrinsicInst(V) && MemCpyInst.classof(cast_IntrinsicInst(V));
}
//<editor-fold defaultstate="collapsed" desc="llvm::MemCpyInst::~MemCpyInst">
@Converted(kind = Converted.Kind.AUTO,
source = "${LLVM_SRC}/llvm/include/llvm/IR/IntrinsicInst.h", line = 273,
FQN="llvm::MemCpyInst::~MemCpyInst", NM="_ZN4llvm10MemCpyInstD0Ev",
cmd="jclank.sh -java-options=${SPUTNIK}/modules/org.llvm.ir/llvmToClangType ${LLVM_SRC}/llvm/lib/IR/IntrinsicInst.cpp -nm=_ZN4llvm10MemCpyInstD0Ev")
//</editor-fold>
@Override public /*inline*/ void $destroy() {
/*<<<default destructor: may be there is another TU where objects are created/destroyed?>>>*/
}
@Override public String toString() {
return "" + super.toString(); // NOI18N
}
}
| [
"voskresensky.vladimir@gmail.com"
] | voskresensky.vladimir@gmail.com |
9c9af3a4c76f4d83b49507f80c7f3778c69d59b4 | 1778094e64f9292c7a9556122e68e65062bfe1e7 | /lib/twist/com.thoughtworks.twist.driver.sahi_3.0.0.9411/sahi/sahi/src/net/sf/sahi/ProxyProcessor.java | 849f44d7550b6f2faa5d4918e9e5b9b075055339 | [] | no_license | sukrupa/school-admin | 478fdbcaf91c1be6dcf5870f16571d1bec99b27c | d3976352ca2509db759d6a05cd17ada5e98ef2e5 | refs/heads/master | 2020-05-25T11:39:41.685853 | 2012-05-25T13:52:52 | 2012-05-25T13:52:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,774 | java | /**
* Sahi - Web Automation and Test Tool
*
* Copyright 2006 V Narayan Raman
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.sf.sahi;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.logging.Logger;
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLSocket;
import net.sf.sahi.command.MockResponder;
import net.sf.sahi.config.Configuration;
import net.sf.sahi.request.HttpRequest;
import net.sf.sahi.response.HttpFileResponse;
import net.sf.sahi.response.HttpResponse;
import net.sf.sahi.response.SimpleHttpResponse;
import net.sf.sahi.ssl.SSLHelper;
import net.sf.sahi.util.ThreadLocalMap;
import net.sf.sahi.util.TrafficLogger;
/**
* User: nraman Date: May 13, 2005 Time: 7:06:11 PM To
*/
public class ProxyProcessor implements Runnable {
private Socket client;
private boolean isSSLSocket = false;
private static Logger logger = Configuration.getLogger("net.sf.sahi.ProxyProcessor");
public RemoteRequestProcessor remoteRequestProcessor = new RemoteRequestProcessor();
private static HashMap<String, String> hostAddresses = new HashMap<String, String>(100);
private static String localhost;
static {
try {
localhost = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
public ProxyProcessor(Socket client) {
this.client = client;
isSSLSocket = (client instanceof SSLSocket);
}
public void run() {
if (client.isClosed()) return;
ThreadLocalMap.clearAll();
HttpRequest requestFromBrowser = null;
try {
requestFromBrowser = getRequestFromBrowser();
TrafficLogger.createLoggerForThread(requestFromBrowser.fileName());
TrafficLogger.getLoggerForThread().storeRequestHeader(requestFromBrowser.rawHeaders());
TrafficLogger.getLoggerForThread().storeRequestBody(requestFromBrowser.data());
String uri = requestFromBrowser.uri();
logger.finest(uri);
if (uri != null) {
int _s_ = uri.indexOf("/_s_/");
int q = uri.indexOf("?");
if (_s_ != -1 && (q == -1 || (q > _s_))) {
processLocally(uri, requestFromBrowser);
} else {
if (isHostTheProxy(requestFromBrowser.host()) && requestFromBrowser.port() == Configuration.getPort()) {
processLocally(uri, requestFromBrowser);
} else if (uri.indexOf("favicon.ico") != -1) {
sendResponseToBrowser(new HttpFileResponse(Configuration.getHtdocsRoot() + "spr/favicon.ico"));
} else {
processAsProxy(requestFromBrowser);
}
}
} else {
sendResponseToBrowser(new SimpleHttpResponse(""));
}
if (isKeepAlive() && !client.isClosed()) {
new Thread(new ProxyProcessor(client)).start();
}
} catch (SSLHandshakeException ssle) {
logger.fine(ssle.getMessage());
} catch (Exception e) {
//e.printStackTrace();
logger.fine(e.getMessage());
try {
// should close only in case of exception. Do not move this to finally. Will cause sockets to not be reused.
client.close();
} catch (IOException e2) {
logger.warning(e2.getMessage());
}
}
}
private boolean isHostTheProxy(final String host) {
try {
if (host.equals("sahi.example.com")) return true;
String hostAddress = getHostAddress(host);
return hostAddress.equals(localhost) || hostAddress.equals("127.0.0.1");
} catch (Exception e) {
return false;
}
}
private String getHostAddress(final String host) throws UnknownHostException {
if (!hostAddresses.containsKey(host)){
hostAddresses.put(host, InetAddress.getByName(host).getHostAddress());
}
return hostAddresses.get(host);
}
private void processAsProxy(HttpRequest requestFromBrowser) throws IOException {
if (requestFromBrowser.isConnect()) {
processConnect(requestFromBrowser);
} else {
if (handleDifferently(requestFromBrowser)) {
return;
}
HttpResponse responseFromHost = null;
try {
responseFromHost = remoteRequestProcessor.processHttp(requestFromBrowser);
} catch (Exception e) {
e.printStackTrace();
responseFromHost = new SimpleHttpResponse("");
}
if (responseFromHost == null) {
responseFromHost = new SimpleHttpResponse("");
}
// System.out.println("Fetching >> :" + new String(requestFromBrowser.url()));
sendResponseToBrowser(responseFromHost);
}
}
private boolean handleDifferently(final HttpRequest request) throws IOException {
final MockResponder mockResponder = request.session().mockResponder();
HttpResponse response = mockResponder.getResponse(request);
if (response == null) {
return false;
}
sendResponseToBrowser(response);
return true;
}
private void processConnect(HttpRequest requestFromBrowser) {
try {
client.getOutputStream().write(("HTTP/1.0 200 OK\r\n\r\n").getBytes());
SSLSocket sslSocket = new SSLHelper().convertToSecureServerSocket(client,
requestFromBrowser.host());
ProxyProcessor delegatedProcessor = new ProxyProcessor(sslSocket);
delegatedProcessor.run();
} catch (IOException e) {
e.printStackTrace();
}
}
private void processLocally(String uri, final HttpRequest requestFromBrowser) throws IOException {
HttpResponse httpResponse = new LocalRequestProcessor().getLocalResponse(uri,
requestFromBrowser);
sendResponseToBrowser(httpResponse);
}
private HttpRequest getRequestFromBrowser() throws IOException {
InputStream in = client.getInputStream();
return new HttpRequest(in, isSSLSocket);
}
protected void sendResponseToBrowser(final HttpResponse responseFromHost) throws IOException {
OutputStream outputStreamToBrowser = client.getOutputStream();
responseFromHost.sendHeaders(outputStreamToBrowser, isKeepAlive());
responseFromHost.sendBody(outputStreamToBrowser);
if (!isKeepAlive()) {
outputStreamToBrowser.close();
client.close();
}
responseFromHost.cleanUp();
}
private boolean isKeepAlive() {
return Configuration.isKeepAliveEnabled() && !isSSLSocket;
}
protected Socket client() {
return client;
}
}
| [
"jim@planet-ix.com"
] | jim@planet-ix.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.