blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
43c820c9215295d9a6653ebc81540f1e6e658284 | a2b7c75bfd0569248247bd8c326823a43fe271e8 | /src/test/java/personal/xml/jaxb/bindingframework/annotation/xmlanyelement/example/from/internet/Demo.java | 2425b7230314ae556f530d83e3e646e836802407 | [] | no_license | explorer1680/xml-hello-world | e82d3fa71c0ebabeb76bf536e3bf3ddfc62aa47e | eb1cb39adabc092fd54ef1d91aa3a5f54d5b76ec | refs/heads/master | 2022-12-02T04:03:48.997646 | 2022-11-21T16:38:24 | 2022-11-21T16:38:24 | 93,083,082 | 0 | 0 | null | 2022-10-05T19:11:34 | 2017-06-01T17:34:29 | XSLT | UTF-8 | Java | false | false | 967 | java | package personal.xml.jaxb.bindingframework.annotation.xmlanyelement.example.from.internet;
import org.springframework.core.io.ClassPathResource;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
public class Demo {
public static void main(String[] args) throws Exception {
JAXBContext jc = JAXBContext.newInstance(Customer.class);
Unmarshaller unmarshaller = jc.createUnmarshaller();
Customer customer = (Customer) unmarshaller.unmarshal(new ClassPathResource("personal/xml/jaxb/bindingframework/annotation/xmlanyelement/example/from/internet/input.xml").getInputStream());
System.out.println("Name: " + customer.getName());
System.out.println("Bio: " + customer.getBio());
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(customer, System.out);
}
} | [
"cjs1234567@hotmail.com"
] | cjs1234567@hotmail.com |
6723f19eb9f227c98ea6ff81c8e5f27acddaae6e | b6934e218440f28511ebe3d4440e458dec880e83 | /target/generated-sources/annotations/com/bin/jmc/samples/stringcontract/generated/StringDemo_stringBuildAdd_jmhTest.java | e1690d128aa55ef757a3498258aef504b779462d | [
"Apache-2.0"
] | permissive | liojian198/jmh-jctools | 1a2a289a5eac863873bf6ca1fc2c7d509a757c29 | 0521601954b91f69a17e083d7c16d24ada014c4d | refs/heads/master | 2022-11-21T00:53:55.765572 | 2020-07-16T15:10:12 | 2020-07-16T15:10:12 | 280,183,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,642 | java | package com.bin.jmc.samples.stringcontract.generated;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.Collection;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.runner.InfraControl;
import org.openjdk.jmh.infra.ThreadParams;
import org.openjdk.jmh.results.BenchmarkTaskResult;
import org.openjdk.jmh.results.Result;
import org.openjdk.jmh.results.ThroughputResult;
import org.openjdk.jmh.results.AverageTimeResult;
import org.openjdk.jmh.results.SampleTimeResult;
import org.openjdk.jmh.results.SingleShotResult;
import org.openjdk.jmh.util.SampleBuffer;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.results.RawResults;
import org.openjdk.jmh.results.ResultRole;
import java.lang.reflect.Field;
import org.openjdk.jmh.infra.BenchmarkParams;
import org.openjdk.jmh.infra.IterationParams;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.infra.Control;
import org.openjdk.jmh.results.ScalarResult;
import org.openjdk.jmh.results.AggregationPolicy;
import org.openjdk.jmh.runner.FailureAssistException;
import com.bin.jmc.samples.stringcontract.generated.StringDemo_jmhType;
public final class StringDemo_stringBuildAdd_jmhTest {
boolean p000, p001, p002, p003, p004, p005, p006, p007, p008, p009, p010, p011, p012, p013, p014, p015;
boolean p016, p017, p018, p019, p020, p021, p022, p023, p024, p025, p026, p027, p028, p029, p030, p031;
boolean p032, p033, p034, p035, p036, p037, p038, p039, p040, p041, p042, p043, p044, p045, p046, p047;
boolean p048, p049, p050, p051, p052, p053, p054, p055, p056, p057, p058, p059, p060, p061, p062, p063;
boolean p064, p065, p066, p067, p068, p069, p070, p071, p072, p073, p074, p075, p076, p077, p078, p079;
boolean p080, p081, p082, p083, p084, p085, p086, p087, p088, p089, p090, p091, p092, p093, p094, p095;
boolean p096, p097, p098, p099, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111;
boolean p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126, p127;
boolean p128, p129, p130, p131, p132, p133, p134, p135, p136, p137, p138, p139, p140, p141, p142, p143;
boolean p144, p145, p146, p147, p148, p149, p150, p151, p152, p153, p154, p155, p156, p157, p158, p159;
boolean p160, p161, p162, p163, p164, p165, p166, p167, p168, p169, p170, p171, p172, p173, p174, p175;
boolean p176, p177, p178, p179, p180, p181, p182, p183, p184, p185, p186, p187, p188, p189, p190, p191;
boolean p192, p193, p194, p195, p196, p197, p198, p199, p200, p201, p202, p203, p204, p205, p206, p207;
boolean p208, p209, p210, p211, p212, p213, p214, p215, p216, p217, p218, p219, p220, p221, p222, p223;
boolean p224, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239;
boolean p240, p241, p242, p243, p244, p245, p246, p247, p248, p249, p250, p251, p252, p253, p254, p255;
int startRndMask;
BenchmarkParams benchmarkParams;
IterationParams iterationParams;
ThreadParams threadParams;
Blackhole blackhole;
Control notifyControl;
public BenchmarkTaskResult stringBuildAdd_Throughput(InfraControl control, ThreadParams threadParams) throws Throwable {
this.benchmarkParams = control.benchmarkParams;
this.iterationParams = control.iterationParams;
this.threadParams = threadParams;
this.notifyControl = control.notifyControl;
if (this.blackhole == null) {
this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
}
if (threadParams.getSubgroupIndex() == 0) {
RawResults res = new RawResults();
StringDemo_jmhType l_stringdemo0_0 = _jmh_tryInit_f_stringdemo0_0(control);
control.preSetup();
control.announceWarmupReady();
while (control.warmupShouldWait) {
l_stringdemo0_0.stringBuildAdd();
res.allOps++;
}
notifyControl.startMeasurement = true;
stringBuildAdd_thrpt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_stringdemo0_0);
notifyControl.stopMeasurement = true;
control.announceWarmdownReady();
try {
while (control.warmdownShouldWait) {
l_stringdemo0_0.stringBuildAdd();
res.allOps++;
}
control.preTearDown();
} catch (InterruptedException ie) {
control.preTearDownForce();
}
if (control.isLastIteration()) {
f_stringdemo0_0 = null;
}
res.allOps += res.measuredOps;
int batchSize = iterationParams.getBatchSize();
int opsPerInv = benchmarkParams.getOpsPerInvocation();
res.allOps *= opsPerInv;
res.allOps /= batchSize;
res.measuredOps *= opsPerInv;
res.measuredOps /= batchSize;
BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps);
results.add(new ThroughputResult(ResultRole.PRIMARY, "stringBuildAdd", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
return results;
} else
throw new IllegalStateException("Harness failed to distribute threads among groups properly");
}
public static void stringBuildAdd_thrpt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, StringDemo_jmhType l_stringdemo0_0) throws Throwable {
long operations = 0;
long realTime = 0;
result.startTime = System.nanoTime();
do {
l_stringdemo0_0.stringBuildAdd();
operations++;
} while(!control.isDone);
result.stopTime = System.nanoTime();
result.realTime = realTime;
result.measuredOps = operations;
}
public BenchmarkTaskResult stringBuildAdd_AverageTime(InfraControl control, ThreadParams threadParams) throws Throwable {
this.benchmarkParams = control.benchmarkParams;
this.iterationParams = control.iterationParams;
this.threadParams = threadParams;
this.notifyControl = control.notifyControl;
if (this.blackhole == null) {
this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
}
if (threadParams.getSubgroupIndex() == 0) {
RawResults res = new RawResults();
StringDemo_jmhType l_stringdemo0_0 = _jmh_tryInit_f_stringdemo0_0(control);
control.preSetup();
control.announceWarmupReady();
while (control.warmupShouldWait) {
l_stringdemo0_0.stringBuildAdd();
res.allOps++;
}
notifyControl.startMeasurement = true;
stringBuildAdd_avgt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_stringdemo0_0);
notifyControl.stopMeasurement = true;
control.announceWarmdownReady();
try {
while (control.warmdownShouldWait) {
l_stringdemo0_0.stringBuildAdd();
res.allOps++;
}
control.preTearDown();
} catch (InterruptedException ie) {
control.preTearDownForce();
}
if (control.isLastIteration()) {
f_stringdemo0_0 = null;
}
res.allOps += res.measuredOps;
int batchSize = iterationParams.getBatchSize();
int opsPerInv = benchmarkParams.getOpsPerInvocation();
res.allOps *= opsPerInv;
res.allOps /= batchSize;
res.measuredOps *= opsPerInv;
res.measuredOps /= batchSize;
BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps);
results.add(new AverageTimeResult(ResultRole.PRIMARY, "stringBuildAdd", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
return results;
} else
throw new IllegalStateException("Harness failed to distribute threads among groups properly");
}
public static void stringBuildAdd_avgt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, StringDemo_jmhType l_stringdemo0_0) throws Throwable {
long operations = 0;
long realTime = 0;
result.startTime = System.nanoTime();
do {
l_stringdemo0_0.stringBuildAdd();
operations++;
} while(!control.isDone);
result.stopTime = System.nanoTime();
result.realTime = realTime;
result.measuredOps = operations;
}
public BenchmarkTaskResult stringBuildAdd_SampleTime(InfraControl control, ThreadParams threadParams) throws Throwable {
this.benchmarkParams = control.benchmarkParams;
this.iterationParams = control.iterationParams;
this.threadParams = threadParams;
this.notifyControl = control.notifyControl;
if (this.blackhole == null) {
this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
}
if (threadParams.getSubgroupIndex() == 0) {
RawResults res = new RawResults();
StringDemo_jmhType l_stringdemo0_0 = _jmh_tryInit_f_stringdemo0_0(control);
control.preSetup();
control.announceWarmupReady();
while (control.warmupShouldWait) {
l_stringdemo0_0.stringBuildAdd();
res.allOps++;
}
notifyControl.startMeasurement = true;
int targetSamples = (int) (control.getDuration(TimeUnit.MILLISECONDS) * 20); // at max, 20 timestamps per millisecond
int batchSize = iterationParams.getBatchSize();
int opsPerInv = benchmarkParams.getOpsPerInvocation();
SampleBuffer buffer = new SampleBuffer();
stringBuildAdd_sample_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, buffer, targetSamples, opsPerInv, batchSize, l_stringdemo0_0);
notifyControl.stopMeasurement = true;
control.announceWarmdownReady();
try {
while (control.warmdownShouldWait) {
l_stringdemo0_0.stringBuildAdd();
res.allOps++;
}
control.preTearDown();
} catch (InterruptedException ie) {
control.preTearDownForce();
}
if (control.isLastIteration()) {
f_stringdemo0_0 = null;
}
res.allOps += res.measuredOps * batchSize;
res.allOps *= opsPerInv;
res.allOps /= batchSize;
res.measuredOps *= opsPerInv;
BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps);
results.add(new SampleTimeResult(ResultRole.PRIMARY, "stringBuildAdd", buffer, benchmarkParams.getTimeUnit()));
this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
return results;
} else
throw new IllegalStateException("Harness failed to distribute threads among groups properly");
}
public static void stringBuildAdd_sample_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, SampleBuffer buffer, int targetSamples, long opsPerInv, int batchSize, StringDemo_jmhType l_stringdemo0_0) throws Throwable {
long realTime = 0;
long operations = 0;
int rnd = (int)System.nanoTime();
int rndMask = startRndMask;
long time = 0;
int currentStride = 0;
do {
rnd = (rnd * 1664525 + 1013904223);
boolean sample = (rnd & rndMask) == 0;
if (sample) {
time = System.nanoTime();
}
for (int b = 0; b < batchSize; b++) {
if (control.volatileSpoiler) return;
l_stringdemo0_0.stringBuildAdd();
}
if (sample) {
buffer.add((System.nanoTime() - time) / opsPerInv);
if (currentStride++ > targetSamples) {
buffer.half();
currentStride = 0;
rndMask = (rndMask << 1) + 1;
}
}
operations++;
} while(!control.isDone);
startRndMask = Math.max(startRndMask, rndMask);
result.realTime = realTime;
result.measuredOps = operations;
}
public BenchmarkTaskResult stringBuildAdd_SingleShotTime(InfraControl control, ThreadParams threadParams) throws Throwable {
this.benchmarkParams = control.benchmarkParams;
this.iterationParams = control.iterationParams;
this.threadParams = threadParams;
this.notifyControl = control.notifyControl;
if (this.blackhole == null) {
this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
}
if (threadParams.getSubgroupIndex() == 0) {
StringDemo_jmhType l_stringdemo0_0 = _jmh_tryInit_f_stringdemo0_0(control);
control.preSetup();
notifyControl.startMeasurement = true;
RawResults res = new RawResults();
int batchSize = iterationParams.getBatchSize();
stringBuildAdd_ss_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, batchSize, l_stringdemo0_0);
control.preTearDown();
if (control.isLastIteration()) {
f_stringdemo0_0 = null;
}
int opsPerInv = control.benchmarkParams.getOpsPerInvocation();
long totalOps = opsPerInv;
BenchmarkTaskResult results = new BenchmarkTaskResult(totalOps, totalOps);
results.add(new SingleShotResult(ResultRole.PRIMARY, "stringBuildAdd", res.getTime(), benchmarkParams.getTimeUnit()));
this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
return results;
} else
throw new IllegalStateException("Harness failed to distribute threads among groups properly");
}
public static void stringBuildAdd_ss_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, int batchSize, StringDemo_jmhType l_stringdemo0_0) throws Throwable {
long realTime = 0;
result.startTime = System.nanoTime();
for (int b = 0; b < batchSize; b++) {
if (control.volatileSpoiler) return;
l_stringdemo0_0.stringBuildAdd();
}
result.stopTime = System.nanoTime();
result.realTime = realTime;
}
StringDemo_jmhType f_stringdemo0_0;
StringDemo_jmhType _jmh_tryInit_f_stringdemo0_0(InfraControl control) throws Throwable {
if (control.isFailing) throw new FailureAssistException();
StringDemo_jmhType val = f_stringdemo0_0;
if (val == null) {
val = new StringDemo_jmhType();
f_stringdemo0_0 = val;
}
return val;
}
}
| [
"1246444371@qq.com"
] | 1246444371@qq.com |
79bf8086afb216cbc105dee387a6818c80317938 | 9158a13243bfee1a38113c9cf54824fc0c88e522 | /app/src/main/java/com/utils/javenruan/tilerecyclerview/model/TestItem.java | e2c4c7a68706bac360440c3ce49d4678a660bf71 | [] | no_license | FlareMars/TileRecyclerView | afffbe8e6b6ef6bd35530d53b0a0aaae0634552a | a3e0caf73a4f05e5f3108f1b6a48b509268d0fab | refs/heads/master | 2021-01-20T18:23:38.264271 | 2016-08-15T03:56:17 | 2016-08-15T03:56:17 | 65,534,468 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,811 | java | package com.utils.javenruan.tilerecyclerview.model;
import com.utils.javenruan.tilerecyclerview.library.AbstractDataItem;
/**
* Created by javenruan on 2016/8/11
*/
public class TestItem implements AbstractDataItem {
private int rowSpan;
private int colSpan;
private int level;
private int index;
private String name;
private String avatarUrl;
public TestItem(String name, String avatarUrl, int level, int index) {
this.name = name;
this.avatarUrl = avatarUrl;
this.level = level;
this.index = index;
calculateSpan();
}
private void calculateSpan() {
switch (level) {
case 0:
rowSpan = 1;
colSpan = 1;
break;
case 1:
rowSpan = 2;
colSpan = 2;
break;
case 2:
rowSpan = 2;
colSpan = 3;
break;
default:
rowSpan = 1;
colSpan = 1;
break;
}
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
calculateSpan();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAvatarUrl() {
return avatarUrl;
}
public void setAvatarUrl(String avatarUrl) {
this.avatarUrl = avatarUrl;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
@Override
public int getColumnSpan() {
return colSpan;
}
@Override
public int getRowSpan() {
return rowSpan;
}
}
| [
"javenruan@tencent.com"
] | javenruan@tencent.com |
d187fff54085aa372242edc389c900dc4d92bad8 | 4c601761cf843fb8136d08909cb307b9e0c17628 | /app/src/main/java/com/example/administrator/httpdemo/CustomView/WordView.java | 064b934912b52d158e78f8c8b94c1c3a4a75d0c4 | [] | no_license | zsx8888/EnjoyMusic | 534d138cda9dfdb4e873818d9b1e97b9abcf907a | 56ce8f8b88b93577abb9bf78f9a11ba31e613984 | refs/heads/master | 2020-08-08T15:40:00.838796 | 2018-04-06T03:02:26 | 2018-04-06T03:02:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,136 | java | package com.example.administrator.httpdemo.CustomView;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathEffect;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
/**
* Created by Administrator on 2017/8/11.
*/
public class WordView extends View {
Typeface typeFace =Typeface.createFromAsset(getContext().getAssets(),"fonts/girl.ttf");
Paint paint = new Paint();
Paint pathPaint = new Paint();
Path path = new Path();
String text = "我是分割线";
String leftText = "<";
String rightText = ">";
PathEffect pathEffect = new DashPathEffect(new float[]{10, 5}, 0);
Rect bounds1 = new Rect();
Rect bounds2 = new Rect();
Rect bounds3 = new Rect();
public WordView(Context context) {
this(context, null);
}
public WordView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int centerX = getWidth()/2;
int centerY = getHeight()/2;
paint.reset();
paint.getTextBounds(text, 0, text.length(), bounds1);
paint.getTextBounds(leftText, 0, leftText.length(), bounds2);
paint.getTextBounds(rightText, 0, rightText.length(), bounds3);
paint.setAntiAlias(true);
paint.setTextSize(50);
paint.setTextSkewX(-0.33f);
paint.setTypeface(typeFace);
paint.setColor(Color.RED);
paint.setLetterSpacing(0.1f);
float h1 = bounds1.bottom - bounds1.top;
float h2 = bounds1.bottom - bounds1.top;
float h3 = bounds1.bottom - bounds1.top;
float w1 = paint.measureText(text);
float w2 = paint.measureText(leftText);
float w3 = paint.measureText(rightText);
float startX = centerX - w1/2;
float startY = centerY + h1/2;
canvas.drawText(text, startX, startY, paint);
float sX2 = getLeft();
float sY2 = centerY + h2/2;
canvas.drawText(leftText, sX2, sY2, paint);
float sX3 = getRight() - w3 - getPaddingEnd() - w3;
float sY3 = centerY + h3/2;
canvas.drawText(rightText, sX3, sY3, paint);
pathPaint.reset();
pathPaint.setStrokeWidth(5);
pathPaint.setAntiAlias(true);
pathPaint.setPathEffect(pathEffect);
pathPaint.setStyle(Paint.Style.STROKE);
pathPaint.setColor(Color.RED);
path.reset();
path.moveTo(getLeft()+w2, sY3-h3);
path.lineTo(startX, sY3-h3);
canvas.drawPath(path, pathPaint);
// canvas.drawLine(getLeft()+w2, sY3-h3/3, startX, sY3-h3/3, paint);
path.reset();
path.moveTo(startX+w1, sY3-h3);
path.lineTo(sX3, sY3-h3);
// canvas.drawLine(startX+w1, sY3-h3/3, sX3, sY3-h3/3, paint);
canvas.drawPath(path, pathPaint);
}
}
| [
"2825350824@qq.com"
] | 2825350824@qq.com |
22ce9f0c1c91d375bc99305b4a138d908040b4af | 47bd92b0ec19cef05398478e93f141e985cc0e05 | /comparer/comparer.synchro/comparer.synchro.reader/comparer.synchro.reader.processbookmaker/src/main/java/com/comparadorad/bet/comparer/synchro/reader/processbookmaker/exception/BetInactiveException.java | ce2aa338ecdca761748bc0319de1aa7b3cd585cb | [] | no_license | chuguet/my-comparer | f43c0c3dbf7f635864bbf346c0c11c455f3cb831 | 471e7d83d1c5c5400f90d901faa4f24f8e755490 | refs/heads/master | 2021-01-15T21:03:21.584668 | 2014-08-07T08:57:20 | 2014-08-07T08:57:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | /**
*
* Copyright (C) FACTORIA ETSIA S.L.
* All Rights Reserved.
* www.factoriaetsia.com
*
*/
package com.comparadorad.bet.comparer.synchro.reader.processbookmaker.exception;
/**
* The Class SportNotFoundException.
*/
@SuppressWarnings("serial")
public class BetInactiveException extends InactiveElementException {
/**
* Instantiates a new sport not found exception.
*
* @param message
* the message
*/
public BetInactiveException(String message) {
super(message);
}
}
| [
"huguet10@gmail.com@7daf7316-15a6-36d4-e5e8-a3ca7c335dfd"
] | huguet10@gmail.com@7daf7316-15a6-36d4-e5e8-a3ca7c335dfd |
49ad24ccf8be0dd753fa513539dace4dd5d7e4db | 81e941866052c898768c23da985e9642bf6cd185 | /sport/src/main/java/network/StephenRequestMyCallback.java | 6c4a72b29224fc5f7556c56a50632da6913d521f | [] | no_license | duboAndroid/PayAlibabaAndWeiXin | 0093e8f2fbbaf7eaa995f20ab9d1bbd0d6905b37 | 6c92c5826b5d3909cc7aad1d019463824ea0dbfb | refs/heads/master | 2020-03-22T11:20:48.219074 | 2018-07-09T07:01:39 | 2018-07-09T07:01:39 | 139,965,097 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package network;
public abstract class StephenRequestMyCallback implements StephenRequestAsyncTask.RequestCallback {
@Override
public void onRequestPrepare() {}
@Override
public void onChangeProgress(int progress, int successFlag) {}
@Override
public void onCompleted(String returnMsg) {}
@Override
public boolean onCancel() {
return false;
}
}
| [
"277627117@qq.com"
] | 277627117@qq.com |
f39bc123de3387284d8b201b8d1cd19cc8605bf8 | f2222b29e35af3da3d08d5fb335ee98fab289f25 | /spring_mvc/src/kr/co/sist/controller/webparam/ExceptionController.java | 892f68710ca7ce14559ef962fe41491f4ed9f669 | [] | no_license | jeongmipark94/JavaStudy_src | 2fe7eefe05581d7d30e7b53610dc89e6f26ddb9a | bbf55e62f738049c9990c25e0ae3cdf91693962c | refs/heads/master | 2020-04-08T19:26:37.468884 | 2019-05-15T07:02:46 | 2019-05-15T07:02:46 | 159,655,640 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 2,176 | java | package kr.co.sist.controller.webparam;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import java.util.Calendar;
import java.util.Random;
@Controller
public class ExceptionController {
@RequestMapping(value="/exception/exception.do",method=GET)
public String exceptionForm() {
return "exception/exception_form";
}//exceptionForm
@RequestMapping(value="/exception/number_format.do",method=GET)
public String numberFormat(int age, Model model) {
model.addAttribute("birth", Calendar.getInstance().get(Calendar.YEAR)-age+1);
return "exception/view_age";
}//numberFormat
@RequestMapping(value="/exception/class_not_found.do",method=GET)
public String classNotFound() throws ClassNotFoundException {
if(new Random().nextBoolean() ) {
throw new ClassNotFoundException("클래스 없는 상황");
}//end if
return "exception/view_class";
}//numberFormat
//현재 Controller 내의 method들중 NumberFormatException이 발생하면
// method가 달라도 아래의 예외처리 method가 호출된다.
@ExceptionHandler(NumberFormatException.class)
//이 폼들의 어떤 메서드라도 numberformatexception이라면 여기로온다
public ModelAndView numberFormatProcess(NumberFormatException nfe) {
ModelAndView mav=new ModelAndView();
mav.setViewName("exception/error");
mav.addObject("msg",nfe.getMessage()); //간단한 에러 메세지
mav.addObject("exception",nfe.toString()); //예외처리 객체와 간단한 에러 메세지
return mav;
}//numberFormatProcess
@ExceptionHandler(ClassNotFoundException.class)
public ModelAndView classNotFoundProcess(ClassNotFoundException cnfe) {
ModelAndView mav= new ModelAndView();
mav.setViewName("exception/error");
mav.addObject("msg", cnfe.getMessage() );
mav.addObject("exception", cnfe.toString() );
return mav;
}//classNotFoundProcess
}//class
| [
"45455409+jeongmipark94@users.noreply.github.com"
] | 45455409+jeongmipark94@users.noreply.github.com |
675ce157b9bbf032d593b5b53175224547ff9616 | d3df25004d54f6ae14a1c140db18d071023ec656 | /src/main/java/rojbot/PhotoBot.java | ba396b3a8624c9db1dea07d1a17d6f5ba50315b5 | [] | no_license | ormeno/R_1 | b3bf41c838f2ccff45a4a212d006f6c132828594 | 49bae31a7dcb1ca29311450a296d2cb28c70338b | refs/heads/master | 2020-04-30T23:18:07.060471 | 2019-03-29T13:27:02 | 2019-03-29T13:27:02 | 177,140,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,300 | java | package rojbot;
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
import org.telegram.telegrambots.meta.api.methods.send.SendPhoto;
import org.telegram.telegrambots.meta.api.objects.PhotoSize;
import org.telegram.telegrambots.meta.api.objects.Update;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboardMarkup;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboardRemove;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.KeyboardRow;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import org.telegram.telegrambots.bots.DefaultBotOptions;
import org.telegram.telegrambots.bots.TelegramLongPollingBot;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
public class PhotoBot extends TelegramLongPollingBot {
protected PhotoBot(DefaultBotOptions botOptions) {
super(botOptions);
}
@Override
public void onUpdateReceived(Update update) {
// We check if the update has a message and the message has text
if (update.hasMessage() && update.getMessage().hasText()) {
// Set variables
String message_text = update.getMessage().getText();
long chat_id = update.getMessage().getChatId();
if (message_text.equals("/start")) {
// User send /start
SendMessage message = new SendMessage() // Create a message object object
.setChatId(chat_id)
.setText(message_text);
try {
execute(message); // Sending our message object to user
} catch (TelegramApiException e) {
e.printStackTrace();
}
} else if (message_text.equals("/consulta")) {
// Se envia contenido de la tabla autors
database db = new database();
Connection con = db.connect();
String resultado = "";
try {
PreparedStatement pst = con.prepareStatement("SELECT * FROM authors");
ResultSet rs = pst.executeQuery();
while (rs.next()) {
resultado = resultado + rs.getInt(1) + " - " + rs.getString(2) ;
//System.out.print(rs.getInt(1));
//System.out.print(": ");
//System.out.println(rs.getString(2));
}
} catch (SQLException ex) {
System.out.println("Error SQL: " + ex);
//Logger lgr = Logger.getLogger(JavaPostgreSqlRetrieve.class.getName());
//lgr.log(Level.SEVERE, ex.getMessage(), ex);
}
SendMessage msgQuery = new SendMessage() // Create a message object object
.setChatId(chat_id)
.setText(resultado);
try {
execute(msgQuery); // Call method to send the photo
} catch (TelegramApiException e) {
e.printStackTrace();
}
} else if (message_text.equals("/pic")) {
// User sent /pic
SendPhoto msg = new SendPhoto()
.setChatId(chat_id)
.setPhoto("AgADBAADmK4xG69RGFGhCZgjXI9K2UwgHxsABJ3upjeuKWV2m94AAgI")
.setCaption("Photo");
try {
execute(msg); // Call method to send the photo
} catch (TelegramApiException e) {
e.printStackTrace();
}
} else if (message_text.equals("/markup")) {
SendMessage message = new SendMessage() // Create a message object object
.setChatId(chat_id)
.setText("Here is your keyboard");
// Create ReplyKeyboardMarkup object
ReplyKeyboardMarkup keyboardMarkup = new ReplyKeyboardMarkup();
// Create the keyboard (list of keyboard rows)
List<KeyboardRow> keyboard = new ArrayList<>();
// Create a keyboard row
KeyboardRow row = new KeyboardRow();
// Set each button, you can also use KeyboardButton objects if you need something else than text
row.add("Row 1 Button 1");
row.add("Row 1 Button 2");
row.add("Row 1 Button 3");
// Add the first row to the keyboard
keyboard.add(row);
// Create another keyboard row
row = new KeyboardRow();
// Set each button for the second line
row.add("Row 2 Button 1");
row.add("Row 2 Button 2");
row.add("Row 2 Button 3");
// Add the second row to the keyboard
keyboard.add(row);
// Set the keyboard to the markup
keyboardMarkup.setKeyboard(keyboard);
// Add it to the message
message.setReplyMarkup(keyboardMarkup);
try {
execute(message); // Sending our message object to user
} catch (TelegramApiException e) {
e.printStackTrace();
}
} else if (message_text.equals("Row 1 Button 1")) {
SendPhoto msg = new SendPhoto()
.setChatId(chat_id)
.setPhoto("AgADBAADmK4xG69RGFGhCZgjXI9K2UwgHxsABJ3upjeuKWV2m94AAgI")
.setCaption("Photo");
SendMessage msg2 = new SendMessage()
.setChatId(chat_id)
.setText("VAMOS");
try {
execute(msg); // Call method to send the photo
execute(msg2);
} catch (TelegramApiException e) {
e.printStackTrace();
}
} else if (message_text.equals("/hide")) {
SendMessage msg = new SendMessage()
.setChatId(chat_id)
.setText("Keyboard hidden");
ReplyKeyboardRemove keyboardMarkup = new ReplyKeyboardRemove();
msg.setReplyMarkup(keyboardMarkup);
try {
execute(msg); // Call method to send the photo
} catch (TelegramApiException e) {
e.printStackTrace();
}
}
else {
// Unknown command
SendMessage message = new SendMessage() // Create a message object object
.setChatId(chat_id)
.setText("Unknown command");
try {
execute(message); // Sending our message object to user
} catch (TelegramApiException e) {
e.printStackTrace();
}
}
} else if (update.hasMessage() && update.getMessage().hasPhoto()) {
// Message contains photo
// Set variables
long chat_id = update.getMessage().getChatId();
// Array with photo objects with different sizes
// We will get the biggest photo from that array
List<PhotoSize> photos = update.getMessage().getPhoto();
// Know file_id
String f_id = photos.stream()
.sorted(Comparator.comparing(PhotoSize::getFileSize).reversed())
.findFirst()
.orElse(null).getFileId();
// Know photo width
int f_width = photos.stream()
.sorted(Comparator.comparing(PhotoSize::getFileSize).reversed())
.findFirst()
.orElse(null).getWidth();
// Know photo height
int f_height = photos.stream()
.sorted(Comparator.comparing(PhotoSize::getFileSize).reversed())
.findFirst()
.orElse(null).getHeight();
// Set photo caption
String caption = "file_id: " + f_id + "\nwidth: " + Integer.toString(f_width) + "\nheight: " + Integer.toString(f_height);
SendPhoto msg = new SendPhoto()
.setChatId(chat_id)
.setPhoto(f_id)
.setCaption(caption);
try {
execute(msg); // Call method to send the photo with caption
} catch (TelegramApiException e) {
e.printStackTrace();
}
}
}
@Override
public String getBotUsername() {
// Return bot username
// If bot username is @MyAmazingBot, it must return 'MyAmazingBot'
return "OrmenoBot";
}
@Override
public String getBotToken() {
// Return bot token from BotFather
return "584953347:AAHVkaPORXeYADLarPmKEOAR2WKyW_sLiUU";
}
}
| [
"roj@PC-ROJ.ttec.es"
] | roj@PC-ROJ.ttec.es |
d1c97d474f694a5c1edbbd1c887f31e883b917d9 | fe49198469b938a320692bd4be82134541e5e8eb | /scenarios/web/large/gradle/ClassLib013/src/main/java/ClassLib013/Class062.java | da2e6e2f129c472a0f5d7da4f02fd81824a8d381 | [] | no_license | mikeharder/dotnet-cli-perf | 6207594ded2d860fe699fd7ef2ca2ae2ac822d55 | 2c0468cb4de9a5124ef958b315eade7e8d533410 | refs/heads/master | 2022-12-10T17:35:02.223404 | 2018-09-18T01:00:26 | 2018-09-18T01:00:26 | 105,824,840 | 2 | 6 | null | 2022-12-07T19:28:44 | 2017-10-04T22:21:19 | C# | UTF-8 | Java | false | false | 122 | java | package ClassLib013;
public class Class062 {
public static String property() {
return "ClassLib013";
}
}
| [
"mharder@microsoft.com"
] | mharder@microsoft.com |
d2754e709a87911fdb731d1cf62fb68b3495ec6a | bcd4be1e1e06ad5e1aa396a76fb956feded52426 | /app/src/main/java/com/w1761940/coursework2/Database.java | 673c6849f5e795472cc69436bf0c9d0bfe1e6e92 | [] | no_license | thirandev/Imdb-Tracker-Mobile-App | fe73e4c6f73859d7e6a331cbf034f357804c8f22 | e809b25a3d054ab973af6d6c60a7cd0b7102855e | refs/heads/main | 2023-04-24T00:56:11.981234 | 2021-05-16T08:52:55 | 2021-05-16T08:52:55 | 367,824,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,924 | java | package com.w1761940.coursework2;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import java.util.ArrayList;
public class Database extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "MoviesDB";
private static final String DATABASE_TABLE = "movies";
private static final int DATABASE_VERSION = 1;
private int id;
private String title;
private int year;
private String director;
private String cast;
private int rating;
private String review;
private int fav;
private Movie movie;
private Context context;
private SQLiteDatabase liteDatabase;
// Database Construct which sets the context
public Database(Context ct) {
super(ct, DATABASE_NAME, null, DATABASE_VERSION);
context = ct;
}
@Override
public void onCreate(SQLiteDatabase db) {
// Creating a SQLite database table
db.execSQL("create table " + DATABASE_TABLE + " (_id integer primary key autoincrement," +
"mov_name text,mov_year integer,mov_dir text,mov_cast text,mov_rating integer," +
"mov_review text,mov_fav integer);");
Log.i("Database", "Table Created");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// Dropping a table when creating if it exists.
db.execSQL("drop table if exists " + DATABASE_TABLE);
onCreate(liteDatabase);
}
public void insertData(Movie movie) {
//Writing to the Database
liteDatabase = getWritableDatabase();
//Inserting data in the movie table using a sql query
liteDatabase.execSQL("insert into " + DATABASE_TABLE + " (mov_name,mov_year,mov_dir," +
"mov_cast,mov_rating,mov_review,mov_fav)" +
" values('" + movie.getTitle() + "','" + movie.getYear() + "','" + movie.getDirector() +
"','" + movie.getCast()
+ "','" + movie.getRating() + "','" + movie.getReview() + "','" + movie.getSelected() + "');");
}
public ArrayList<Movie> getAllData() {
// Making the connection for getting data
liteDatabase = getReadableDatabase();
// Fetching all the data in alphabetical order
Cursor cursor = liteDatabase.rawQuery("SELECT * FROM " + DATABASE_TABLE +
" ORDER BY mov_name ASC", null);
ArrayList<Movie> list = new ArrayList<>();
// Creating a movie object with the fetched variables and adding to a Movie Object List
while (cursor.moveToNext()) {
id = cursor.getInt(0);
title = cursor.getString(1);
year = cursor.getInt(2);
director = cursor.getString(3);
cast = cursor.getString(4);
rating = cursor.getInt(5);
review = cursor.getString(6);
fav = cursor.getInt(7);
movie = new Movie(title, director, cast, review, year, rating);
movie.setId(id);
movie.setSelected(fav);
list.add(movie);
}
return list;
}
public void setFavourite(ArrayList<Movie> selectedList) {
//Writing to the Database
liteDatabase = getWritableDatabase();
for (int i = 0; i < selectedList.size(); i++) {
String idString = String.valueOf(selectedList.get(i).getId());
String value = String.valueOf(selectedList.get(i).getSelected());
liteDatabase.execSQL("UPDATE movies SET mov_fav = " + value + " WHERE _id =" + idString);
}
}
public ArrayList<Movie> getFavourite() {
// Making the connection for getting data
liteDatabase = getReadableDatabase();
// Fetching all stored data from database
Cursor cursor = liteDatabase.rawQuery("SELECT * FROM " + DATABASE_TABLE +
" WHERE mov_fav = 1", null);
ArrayList<Movie> list = new ArrayList<>();
//Getting only the Favorite Movies from the database
while (cursor.moveToNext()) {
id = cursor.getInt(0);
String title = cursor.getString(1);
year = cursor.getInt(2);
director = cursor.getString(3);
cast = cursor.getString(4);
rating = cursor.getInt(5);
review = cursor.getString(6);
fav = cursor.getInt(7);
movie = new Movie(title, director, cast, review, year, rating);
movie.setId(id);
movie.setSelected(fav);
list.add(movie);
}
return list;
}
public Movie getMovieData(int movieId) {
// Making the connection for getting data
liteDatabase = getReadableDatabase();
//Fetching data by id from a data base
Cursor cursor = liteDatabase.rawQuery("SELECT * FROM " + DATABASE_TABLE +
" WHERE _id = " + movieId, null);
Movie movie = null;
//Assigning fetched data to the data which will be just a single movie object
while (cursor.moveToNext()) {
int id = cursor.getInt(0);
String title = cursor.getString(1);
int year = cursor.getInt(2);
String director = cursor.getString(3);
String cast = cursor.getString(4);
int rating = cursor.getInt(5);
String review = cursor.getString(6);
int fav = cursor.getInt(7);
movie = new Movie(title, director, cast, review, year, rating);
movie.setId(id);
movie.setSelected(fav);
}
return movie;
}
public void updateMovie(Movie movie) {
//Writing to the Database
liteDatabase = getWritableDatabase();
id = movie.getId();
title = movie.getTitle();
fav = movie.getSelected();
year = movie.getYear();
director = movie.getDirector();
cast = movie.getCast();
review = movie.getReview();
rating = movie.getRating();
//Updating the database after the user edits the fields from the UI
liteDatabase.execSQL("UPDATE movies SET mov_name = '" + title +
"',mov_fav = " + fav + ",mov_year = " +
year + ",mov_dir = '" + director + "',mov_cast = '" + cast + "',mov_review = '" + review +
"',mov_rating = " + rating + " WHERE _id = " + id);
}
public ArrayList<Movie> getSearchData(String keyword) {
// Making the connection for getting data
liteDatabase = getReadableDatabase();
Cursor cursor = liteDatabase.rawQuery("SELECT * FROM " + DATABASE_TABLE +
" ORDER BY mov_name ASC", null);
ArrayList<Movie> list = new ArrayList<>();
Boolean contains;
// Search for movies within the database to match the keyword the user entered.
while (cursor.moveToNext()) {
contains = cursor.getString(1).toLowerCase().contains(keyword) ||
cursor.getString(3).toLowerCase().contains(keyword) ||
cursor.getString(4).toLowerCase().contains(keyword);
//if only the keyword is contains in the database it is added to the movie object list
if (contains) {
id = cursor.getInt(0);
title = cursor.getString(1);
year = cursor.getInt(2);
director = cursor.getString(3);
cast = cursor.getString(4);
rating = cursor.getInt(5);
review = cursor.getString(6);
fav = cursor.getInt(7);
movie = new Movie(title, director, cast, review, year, rating);
movie.setId(id);
movie.setSelected(fav);
list.add(movie);
}
}
return list;
}
}
| [
"78394671+thirandev@users.noreply.github.com"
] | 78394671+thirandev@users.noreply.github.com |
1e7d22d81ea3aba7559728a51b4836424ba87b52 | 3ddeeb06543267a97bdd15aed5d4bef6d3d8f5e6 | /app/src/main/java/br/com/veteritec/usecase/UseCaseAbstract.java | 77d9e5dce3c2742c023b2251849b593623fbc689 | [] | no_license | cleysondiego/veteritec-mobile | 75dc8a8183d79460de5714e71a53f8ffdbc38d68 | 1af31729e02c57fbd2683af14f1de536b8279c8c | refs/heads/master | 2021-03-02T14:12:56.341386 | 2020-11-14T16:10:43 | 2020-11-14T16:10:43 | 245,873,094 | 2 | 0 | null | 2020-05-08T12:57:09 | 2020-03-08T19:15:37 | Java | UTF-8 | Java | false | false | 297 | java | package br.com.veteritec.usecase;
public abstract class UseCaseAbstract implements UseCase {
private Executor executor;
public UseCaseAbstract(Executor executor) {
this.executor = executor;
}
@Override
public void execute() {
executor.execute(this);
}
}
| [
"cleyson.dasilva@dieboldnixdorf.com"
] | cleyson.dasilva@dieboldnixdorf.com |
b8afa6a18570d700a6083984807a3d3645d13ac4 | d1a6d1e511df6db8d8dd0912526e3875c7e1797d | /genny_JavaWithoutLambdas/applicationModule/src/main/java/applicationModulepackageJava17/Foo835.java | 16b4a5b95a5713b80211960ca7630e63a8e6eeb9 | [] | no_license | NikitaKozlov/generated-project-for-desugaring | 0bc1443ab3ddc84cd289331c726761585766aea7 | 81506b3711004185070ca4bb9a93482b70011d36 | refs/heads/master | 2020-03-20T00:35:06.996525 | 2018-06-12T09:30:37 | 2018-06-12T09:30:37 | 137,049,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 348 | java | package applicationModulepackageJava17;
public class Foo835 {
public void foo0() {
new applicationModulepackageJava17.Foo834().foo5();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
}
| [
"nikita.e.kozlov@gmail.com"
] | nikita.e.kozlov@gmail.com |
fecc56ba987121370b0025d1d39c6412869cc60b | 1a5f5f1a31dedeb40e706ea4d271c21419b7c842 | /services/common/src/main/java/com/epam/dlab/rest/mappers/AuthenticationExceptionMapper.java | 8ba1f2f67a1b596b39265ee7a85e7158989b7467 | [
"Apache-2.0",
"Python-2.0",
"MIT"
] | permissive | stenpiren/DLab | 39ab8ea65a253b5c73d786baaa1c3aa9c33cceac | 99da3c9c585b2db3c32a3a4c6f079a9894d442d8 | refs/heads/master | 2020-03-22T03:15:36.735966 | 2018-05-25T14:53:50 | 2018-05-25T14:53:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 527 | java | package com.epam.dlab.rest.mappers;
import com.epam.dlab.exceptions.DlabAuthenticationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
public class AuthenticationExceptionMapper implements ExceptionMapper<DlabAuthenticationException> {
@Override
public Response toResponse(DlabAuthenticationException exception) {
return Response.status(Response.Status.UNAUTHORIZED).entity(exception.getMessage()).type(MediaType
.TEXT_PLAIN_TYPE).build();
}
}
| [
"bohdan.hliva@datalex.com"
] | bohdan.hliva@datalex.com |
6b96edf8a08641ab93d82c7b125a8a1bd93fcd4c | 6c7c1614087af4375b13f9ff4fd62ae1f847af20 | /JAICore/jaicore-ml/src/jaicore/ml/evaluation/evaluators/weka/MonteCarloCrossValidationEvaluator.java | 7077e7387eebb66f776bcd755383da958746b073 | [] | no_license | alexanderwerning/AILibs | 2fc24335397c23cb9a121306b9ff7953c2cd0249 | 47835caf4964cd31ec2aba3ed94b0875a46edf3f | refs/heads/master | 2020-04-27T08:43:39.498853 | 2019-03-07T09:41:42 | 2019-03-07T09:41:42 | 162,276,055 | 0 | 0 | null | 2018-12-18T11:12:17 | 2018-12-18T11:12:16 | null | UTF-8 | Java | false | false | 2,903 | java | package jaicore.ml.evaluation.evaluators.weka;
import java.util.List;
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jaicore.basic.algorithm.exceptions.ObjectEvaluationFailedException;
import jaicore.ml.WekaUtil;
import weka.classifiers.Classifier;
import weka.core.Instances;
/**
* A classifier evaluator that can perform a (monte-carlo)cross-validation on
* the given dataset. Thereby, it uses the
* {@link AbstractEvaluatorMeasureBridge} to evaluate the classifier on a random
* split of the dataset.
*
* @author joshua
*
*/
public class MonteCarloCrossValidationEvaluator implements IClassifierEvaluator {
static final Logger logger = LoggerFactory.getLogger(MonteCarloCrossValidationEvaluator.class);
private boolean canceled = false;
private final int repeats;
private final Instances data;
private final double trainingPortion;
private final long seed;
/* Can either compute the loss or cache it */
private final AbstractEvaluatorMeasureBridge<Double, Double> bridge;
private final DescriptiveStatistics stats = new DescriptiveStatistics();
public MonteCarloCrossValidationEvaluator(AbstractEvaluatorMeasureBridge<Double, Double> bridge, final int repeats, final Instances data, final double trainingPortion, final long seed) {
super();
this.repeats = repeats;
this.bridge = bridge;
this.data = data;
this.trainingPortion = trainingPortion;
this.seed = seed;
}
public void cancel() {
logger.info("Received cancel");
this.canceled = true;
}
@Override
public Double evaluate(final Classifier pl) throws ObjectEvaluationFailedException, InterruptedException {
if (pl == null) {
throw new IllegalArgumentException("Cannot compute score for null pipeline!");
}
/* perform random stratified split */
logger.info("Starting evaluation of {}", pl);
for (int i = 0; i < this.repeats && !this.canceled && !Thread.currentThread().isInterrupted(); i++) {
logger.debug("Obtaining predictions of {} for split #{}/{}", pl, i + 1, this.repeats);
List<Instances> split = WekaUtil.getStratifiedSplit(data, seed + i, trainingPortion);
try {
double score = bridge.evaluateSplit(pl, split.get(0), split.get(1));
logger.info("Score for evaluation of {} with split #{}/{}: {}", pl, i + 1, this.repeats, score);
stats.addValue(score);
}
catch (Exception e) {
throw new ObjectEvaluationFailedException(e, "Could not evaluate classifier!");
}
}
if (Thread.currentThread().isInterrupted())
throw new InterruptedException("MCCV has been interrupted");
Double score = stats.getMean();
logger.info("Obtained score of {} for classifier {}.", score, pl);
return score;
}
public DescriptiveStatistics getStats() {
return stats;
}
public AbstractEvaluatorMeasureBridge<Double, Double> getBridge() {
return bridge;
}
}
| [
"wever@mail.uni-paderborn.de"
] | wever@mail.uni-paderborn.de |
a0efa9418dd16b34b1b939f0b267d882d725a07f | adaad49512645463be44a148a82026d4cf11aea2 | /modules/andes-core/common/src/main/java/org/wso2/andes/framing/ContentHeaderBodyFactory.java | ad1cd460fc874c60374469734fa8b97329f479c4 | [
"Apache-2.0"
] | permissive | isurulucky/andes | d0ec4a036124060363c25e50f95537271308e842 | 0d23e9507a8e3076cb3789c42d3539cd80c744e9 | refs/heads/master | 2022-06-03T00:37:00.994308 | 2022-05-31T04:26:11 | 2022-05-31T04:26:11 | 66,438,011 | 0 | 0 | Apache-2.0 | 2022-05-31T04:18:05 | 2016-08-24T06:41:47 | Java | UTF-8 | Java | false | false | 1,731 | java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.andes.framing;
import org.apache.mina.common.ByteBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ContentHeaderBodyFactory implements BodyFactory
{
private static final Logger _log = LoggerFactory.getLogger(AMQMethodBodyFactory.class);
private static final ContentHeaderBodyFactory _instance = new ContentHeaderBodyFactory();
public static ContentHeaderBodyFactory getInstance()
{
return _instance;
}
private ContentHeaderBodyFactory()
{
_log.debug("Creating content header body factory");
}
public AMQBody createBody(ByteBuffer in, long bodySize) throws AMQFrameDecodingException
{
// all content headers are the same - it is only the properties that differ.
// the content header body further delegates construction of properties
return new ContentHeaderBody(in, bodySize);
}
}
| [
"shammi@Shammis-MacBook-Pro.local"
] | shammi@Shammis-MacBook-Pro.local |
9bc5a0795a2aeb1a0f0ffad353ada7ec742036e4 | 05851be9bbaec34aac8a773408c1bdd425c6b76e | /presto-main/src/main/java/com/facebook/presto/execution/RevokeRolesTask.java | fbcb462986ad5a56aad41547433b1cfdb3f112e9 | [
"Apache-2.0"
] | permissive | troels/nz-presto | fdc4a53e568694cae08ac4deef04ab817ad5839a | f0e27a676f9c2457cb98eeaee76d1a2aaabe230f | refs/heads/master | 2021-01-16T19:46:54.174765 | 2018-05-01T09:09:25 | 2018-05-01T09:09:25 | 100,186,730 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 3,621 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.execution;
import com.facebook.presto.Session;
import com.facebook.presto.metadata.Metadata;
import com.facebook.presto.metadata.MetadataUtil;
import com.facebook.presto.security.AccessControl;
import com.facebook.presto.spi.security.PrestoPrincipal;
import com.facebook.presto.sql.analyzer.SemanticException;
import com.facebook.presto.sql.tree.Expression;
import com.facebook.presto.sql.tree.RevokeRoles;
import com.facebook.presto.transaction.TransactionManager;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import static com.facebook.presto.metadata.MetadataUtil.createCatalogName;
import static com.facebook.presto.metadata.MetadataUtil.createPrincipal;
import static com.facebook.presto.spi.security.PrincipalType.ROLE;
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.MISSING_ROLE;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static com.google.common.util.concurrent.Futures.immediateFuture;
public class RevokeRolesTask
implements DataDefinitionTask<RevokeRoles>
{
@Override
public String getName()
{
return "GRANT ROLE";
}
@Override
public ListenableFuture<?> execute(RevokeRoles statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters)
{
Session session = stateMachine.getSession();
Set<String> roles = statement.getRoles();
Set<PrestoPrincipal> grantees = statement.getGrantees().stream()
.map(MetadataUtil::createPrincipal)
.collect(toImmutableSet());
boolean adminOptionFor = statement.isAdminOptionFor();
Optional<PrestoPrincipal> grantor = statement.getGrantor().map(specification -> createPrincipal(session, specification));
String catalog = createCatalogName(session, statement, statement.getCatalog());
Set<String> availableRoles = metadata.listRoles(session, catalog);
Set<String> specifiedRoles = new LinkedHashSet<>();
specifiedRoles.addAll(roles);
grantees.stream()
.filter(principal -> principal.getType() == ROLE)
.map(PrestoPrincipal::getName)
.forEach(specifiedRoles::add);
if (grantor.isPresent() && grantor.get().getType() == ROLE) {
specifiedRoles.add(grantor.get().getName());
}
for (String role : specifiedRoles) {
if (!availableRoles.contains(role)) {
throw new SemanticException(MISSING_ROLE, statement, "Role '%s' does not exist", role);
}
}
accessControl.checkCanRevokeRoles(session.getRequiredTransactionId(), session.getIdentity(), roles, grantees, adminOptionFor, grantor, catalog);
metadata.revokeRoles(session, roles, grantees, adminOptionFor, grantor, catalog);
return immediateFuture(null);
}
}
| [
"amruta.gokhale@teradata.com"
] | amruta.gokhale@teradata.com |
470287d0a1bf459e3cb27dc91159a93a3040673b | bd1f79f99474bbb1efbdb65d1cf8c7ec157caa01 | /cineast-api/src/main/java/org/vitrivr/cineast/api/rest/handlers/actions/segment/FindSegmentsByIdGetHandler.java | cf208a7dc904fefe0e169da897b67a122548a67d | [
"MIT"
] | permissive | mpas97/cineast | 83084d7390ea4ae5fd1c40f44aeef01fac1d0129 | 82e3df6663ca5c3538ce0d2fe2a9421651b5eecd | refs/heads/dev | 2022-12-27T21:15:20.781110 | 2020-09-14T11:38:32 | 2020-09-14T11:38:32 | 255,859,359 | 0 | 0 | MIT | 2020-09-22T09:36:19 | 2020-04-15T08:54:35 | Java | UTF-8 | Java | false | false | 2,141 | java | package org.vitrivr.cineast.api.rest.handlers.actions.segment;
import io.javalin.http.Context;
import io.javalin.plugin.openapi.dsl.OpenApiBuilder;
import io.javalin.plugin.openapi.dsl.OpenApiDocumentation;
import org.vitrivr.cineast.api.messages.result.MediaSegmentQueryResult;
import org.vitrivr.cineast.api.rest.handlers.interfaces.GetRestHandler;
import org.vitrivr.cineast.core.data.entities.MediaSegmentDescriptor;
import org.vitrivr.cineast.core.db.dao.reader.MediaSegmentReader;
import org.vitrivr.cineast.standalone.config.Config;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class FindSegmentsByIdGetHandler implements GetRestHandler<MediaSegmentQueryResult> {
public static final String ID_NAME = "id";
public static final String ROUTE = "find/segments/by/id/:" + ID_NAME;
@Override
public MediaSegmentQueryResult doGet(Context ctx) {
final Map<String, String> parameters = ctx.pathParamMap();
final String segmentId = parameters.get(ID_NAME);
final MediaSegmentReader sl = new MediaSegmentReader(Config.sharedConfig().getDatabase().getSelectorSupplier().get());
final List<MediaSegmentDescriptor> list = sl.lookUpSegment(segmentId).map(s -> {
final List<MediaSegmentDescriptor> segments = new ArrayList<>(1);
segments.add(s);
return segments;
}).orElse(new ArrayList<>(0));
sl.close();
return new MediaSegmentQueryResult("", list);
}
@Override
public Class<MediaSegmentQueryResult> outClass() {
return MediaSegmentQueryResult.class;
}
@Override
public String route() {
return ROUTE;
}
@Override
public OpenApiDocumentation docs() {
return OpenApiBuilder.document()
.operation(op -> {
op.summary("Finds segments for specified id");
op.description("Finds segments for specified id");
op.operationId("findSegmentById");
op.addTagsItem("Segment");
})
.pathParam(ID_NAME, String.class, p -> p.description("The id of the segments"))
.json("200", outClass());
}
}
| [
"loris.sauter@unibas.ch"
] | loris.sauter@unibas.ch |
ceba24fb2cb6d63ad7628d413a806b6817815399 | 54ef079676a462a75a321d73fe20eb0ef45c01d1 | /src/servlets/ServletAlumno.java | 11b83da737014ae6d01dfb1bc6c15b3d281247f5 | [] | no_license | JulioLimache/Proyecto_Voluntariado | a00b061b285fc67d81f3c04dd91e34eb9fc6ef3e | 95d2ef0938270ed6c3c80f8465003c8bd8c28347 | refs/heads/master | 2021-07-23T14:42:03.124584 | 2017-10-19T02:58:39 | 2017-10-19T02:58:39 | 107,610,337 | 0 | 0 | null | 2017-10-19T23:46:54 | 2017-10-19T23:46:54 | null | ISO-8859-10 | Java | false | false | 2,667 | java | package servlets;
import java.io.IOException;
import java.text.ParseException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import beans.AlumnoDTO;
import beans.UsuarioDTO;
import service.AlumnoService;
import service.UsuarioService;
/**
* Servlet implementation class ServletAlumno
*/
@WebServlet("/ServletAlumno")
public class ServletAlumno extends HttpServlet {
private static final long serialVersionUID = 1L;
UsuarioService serviceUsuario = new UsuarioService();
AlumnoService service =new AlumnoService();
/**
* @see HttpServlet#HttpServlet()
*/
public ServletAlumno() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
*/
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String xtipo = request.getParameter("tipo");
if(xtipo.equals("registrar"))
registrar(request,response);
}
private void registrar(HttpServletRequest request, HttpServletResponse response) {
String codigo = request.getParameter("codigo");
String nombre = request.getParameter("nombre");
String apellido = request.getParameter("apellido"); //aņadir en interfaz
String carrera = request.getParameter("carrera"); //debe ser el codigo carrera el value del combo
String seccion = request.getParameter("seccion"); //debe ser el codigo seccion el value del combo
String fono = request.getParameter("fono");
String correo = request.getParameter("correo");
UsuarioDTO usuario = new UsuarioDTO();
usuario.setCodigo(codigo);
usuario.setNombre(nombre);
usuario.setApellido(apellido);
usuario.setTelefono(fono);
usuario.setEstado(10); //10 activo, 11 inactivo fijo en bd
usuario.setLogin(codigo);
usuario.setPassword(codigo);
usuario.setCorreo(correo);
AlumnoDTO alumno = new AlumnoDTO();
alumno.setCodigo_usuario(codigo); //igual
alumno.setCodigo(codigo);
alumno.setCarrera(Integer.parseInt(carrera));
alumno.setSeccion(Integer.parseInt(seccion));
//se actualiza luego por una actividad existente
alumno.setCod_actividad(0);
serviceUsuario.insertarUsuario(usuario); //siempre crear usuario primero
service.insertarAlumno(alumno);
//request.setAttribute("msg", "Usuario no existe...");
// request.getRequestDispatcher("login.jsp").forward(request, response);
}
}
| [
"cinthya.barrezueta.reyes@gmail.com"
] | cinthya.barrezueta.reyes@gmail.com |
ce85d465d41762307703a9845d3fe9757fb296df | d4757083d1b938a23d97a1158ed16f510634799f | /алгоритмы и структуры данных + установка Java/src/JavaCore/laba1_2/Part2/WorkWithArray.java | a572681f461784a9fc4ed9410ba69526b8ffcf41 | [] | no_license | DmitryiIvanoff/learn | 8cc0d1542e9ef7ac8d22e989fd16d666cabc5794 | 1280a52e9a841a935f63500c8c7572219dc8b667 | refs/heads/master | 2021-04-29T22:11:34.444634 | 2018-02-17T13:48:46 | 2018-02-17T13:48:46 | 121,631,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,324 | java | package JavaCore.laba1_2.Part2;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class WorkWithArray {
public int[] parseArray(String string){
int[] array;
String[] arrayOfStrings = string.split("\\D+");
int length = 0;
for (int i = 0; i < arrayOfStrings.length; i++) {
if(arrayOfStrings[i].equals("")){
length--;
}
else{
length++;
}
}
array = new int[length + 1];
for (int i = 0 , j = 0; i < arrayOfStrings.length; i++) {
if(!arrayOfStrings[i].equals("")) {
array[j] = Integer.parseInt(arrayOfStrings[i]);
j++;
}
}
return array;
}
public double[] parseArrayDouble(String string){
double[] array;
String[] arrayOfStrings = string.split("[^\\d\\.]+" );
int length = 0;
for (int i = 0; i < arrayOfStrings.length; i++) {
if(arrayOfStrings[i].equals("")){
length--;
}
else{
length++;
}
}
array = new double[length + 1];
for (int i = 0 , j = 0; i < arrayOfStrings.length; i++) {
if(!arrayOfStrings[i].equals("")) {
try {
Pattern p = Pattern.compile("^\\.{1,}$");
Matcher m = p.matcher(arrayOfStrings[i]);
if(m.find()){
throw new ExceptionNotNumber(arrayOfStrings[i]);
}
array[j] = Double.parseDouble(arrayOfStrings[i]);
}
catch (ExceptionNotNumber t){
System.out.println("ne tot format chisla: " + t.getMessage());
System.exit(1);
}
j++;
}
}
return array;
}
public int[] generateArray(int count){
int[] array = new int[count];
for (int i= 0; i < count; i++) {
array[i] = (int)(Math.random()*100);
}
return array;}
public static double getSumSinuses(double[] angles, int type){
double sum = 0;
if(type == 1){
for (double d:angles) {
sum += Math.sin(d);
}
}else {
for (double d:angles) {
sum += (Math.sin(d * 180 / Math.PI));
}
}
return sum;}
public static double getSumCosines(double[] angles, int type){
double sum = 0;
if(type == 1){
for (double d:angles) {
sum += Math.cos(d);
}
}else {
for (double d:angles) {
sum += (Math.cos(d * 180 / Math.PI));
}
}
return sum;}
public static double getSubstractionCosines(double[] angles, int type){
double sub = 0;
if(type == 1){
for (double d:angles) {
sub += Math.cos(d);
}
}else {
for (double d:angles) {
sub -= (Math.cos(d * 180 / Math.PI));
}
}
return sub;}
public static double getSubstractionSines(double[] angles, int type){
double sub = 0;
if(type == 1){
for (double d:angles) {
sub += Math.sin(d);
}
}else {
for (double d:angles) {
sub -= (Math.sin(d * 180 / Math.PI));
}
}
return sub;}
public static double getSumSinuses(double[] angles, int type, int decimals){
double sum = 0;
if(type == 1){
for (double d:angles) {
sum += Math.sin(d);
}
}else {
for (double d:angles) {
sum += (Math.sin(d * 180 / Math.PI));
}
}
double d = new BigDecimal(sum).setScale(decimals,BigDecimal.ROUND_HALF_EVEN).doubleValue();
return d;}
public void print(double[] array){
for (double r: array) {
System.out.print(r + " ");
}
System.out.println();
}
}
| [
"DmtrIvanoff@yandex.ru"
] | DmtrIvanoff@yandex.ru |
163e78a3cd3863b2d38ea31a11dd71c9389622aa | 96f51591d0c0a71a1f67668a844d17c45fc5a3e1 | /src/test/java/com/timshaya/springboot/web/TodoApp/TodoAppApplicationTests.java | 57680640cc9bcbf08ff217a11b1c1ca3a7b52d49 | [] | no_license | timshaya/TodoApp | 201482b767caf73f398bcdb401424e7f960a3f89 | 7dd2a58e26349dca522bf8d063787d74dbfe86a4 | refs/heads/master | 2020-04-08T09:48:11.414501 | 2018-11-28T19:37:40 | 2018-11-28T19:37:40 | 159,240,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package com.timshaya.springboot.web.TodoApp;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class TodoAppApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"TAS1225@172.27.101.74"
] | TAS1225@172.27.101.74 |
29f7671ea4eeeec330749a3fa1f2052c17f177a5 | 05542e2cda404697913c65bef9764454543b0ed5 | /src/day10/inherit/player/Mage.java | a62d2fc79e99547373a12b8119303f53fc17c493 | [] | no_license | pfull-coder/java_study | b75610570826c3d618fac9d9b3a05aeb25167af6 | e95ca6d99f49492df362734a9fcf5d8742b9ee89 | refs/heads/master | 2023-03-12T03:32:38.480219 | 2021-02-26T02:42:38 | 2021-02-26T02:42:38 | 334,021,104 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 277 | java | package day10.inherit.player;
public class Mage extends Player {
int mana;
public Mage() {
super("마법사", 1,50);
}
void meteo() {}
@Override
void info() {
super.info();
System.out.println("# 마력: " + this.mana);
}
} | [
"sevnich@gmail.com"
] | sevnich@gmail.com |
d33a93277fe1a1b8f5a003dcc66f7cd2abecfcff | 18ad8213a95cce1d8c3e10188f9f605f2f2e77d6 | /Core-2/Core-2/CompositionEncapsulationPolymorphism/src/main/java/com/purplewisteria/CompositionEncapsulationPolymorphism/polymorphism/ex01/CrossCountryMountainBike.java | 8899c382e24eda305a0d4b6b89774520996f1353 | [] | no_license | vishucloud/Project_1 | 3a52f507f3f0322286d05bbc9ab0f463cfa5364a | 48cf1d4877ba421a4af3f8215536b9ce05cf5d9e | refs/heads/master | 2023-04-14T06:53:34.913898 | 2021-04-28T20:39:32 | 2021-04-28T20:39:32 | 362,598,377 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 431 | java | package com.purplewisteria.CompositionEncapsulationPolymorphism.polymorphism.ex01;
public class CrossCountryMountainBike extends Bike {
public CrossCountryMountainBike(String bikeType, String model, double price) {
super(bikeType, model, price);
// TODO Auto-generated constructor stub
}
@Override
public String showBikeDetails () {
return "Cross Country Mountain Bike: " + "\n" + super.showBikeDetails();
}
}
| [
"49354802+vishucloud@users.noreply.github.com"
] | 49354802+vishucloud@users.noreply.github.com |
a3757e342f0153fe59a16149a957cbd5c26e5302 | e82c1473b49df5114f0332c14781d677f88f363f | /MED-CLOUD/med-data/src/main/java/nta/med/data/dao/medi/cpl/Cpl0608RepositoryCustom.java | 1a700eaadaffd0b879e470a7608a404f718ff825 | [] | no_license | zhiji6/mih | fa1d2279388976c901dc90762bc0b5c30a2325fc | 2714d15853162a492db7ea8b953d5b863c3a8000 | refs/heads/master | 2023-08-16T18:35:19.836018 | 2017-12-28T09:33:19 | 2017-12-28T09:33:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 112 | java | package nta.med.data.dao.medi.cpl;
/**
* @author dainguyen.
*/
public interface Cpl0608RepositoryCustom {
}
| [
"duc_nt@nittsusystem-vn.com"
] | duc_nt@nittsusystem-vn.com |
b366d5fe65b7163306f455abf9669cbe5cf6daf5 | 8eeca7aa9f558d575e7db306bd708302c61ccc79 | /Midterm/app/src/main/java/hu/cai/ait/midterm/MainActivity.java | add1fbde7dca00e5f0ebe9e68bb0119df788d454 | [] | no_license | Cai-Glencross/AndroidProjects | eff918e364c4fc01a5c28ff7a5226720aaa3a0d8 | 70cd7c6abe133143b6ba2885f295f094d90be918 | refs/heads/master | 2022-03-12T21:33:53.433610 | 2017-04-09T12:57:45 | 2017-04-09T12:57:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,707 | java | package hu.cai.ait.midterm;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Layout;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.ToggleButton;
import org.w3c.dom.Text;
public class MainActivity extends AppCompatActivity {
private EditText etName;
private EditText etAmt;
private Button btnSave;
private ToggleButton btnIncome;
private Button btnClear;
private LinearLayout scrollLayout;
private TextView tvBalance;
private float balance;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etName = (EditText) findViewById(R.id.etName);
etAmt = (EditText) findViewById(R.id.etAmt);
btnSave = (Button) findViewById(R.id.btnSave);
btnIncome = (ToggleButton) findViewById(R.id.btnIncome);
scrollLayout = (LinearLayout) findViewById(R.id.scrollLayout);
btnClear = (Button) findViewById(R.id.btnClear);
tvBalance = (TextView) findViewById(R.id.tvBalance);
balance = 0;
btnSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(!etName.getText().toString().equals("") &&
(!etAmt.getText().toString().equals("") && !etAmt.getText().toString().equals(getString(R.string.amount)))) {
final View item = getLayoutInflater().inflate(R.layout.layout_money, null);
TextView tvName = (TextView) item.findViewById(R.id.tvName);
tvName.setText(etName.getText());
TextView tvAmt = (TextView) item.findViewById(R.id.tvAmt);
tvAmt.setText(getString(R.string.dollaSign) + etAmt.getText());
ImageView imgIcon = (ImageView) item.findViewById(R.id.imgIcon);
if (btnIncome.isChecked()) {
imgIcon.setImageResource(R.drawable.expense_icon);
balance -= Float.parseFloat(etAmt.getText().toString());
tvBalance.setText(getString(R.string.balancePrecursor)+ Float.toString(balance));
} else {
imgIcon.setImageResource(R.drawable.income_icon);
balance += Float.parseFloat(etAmt.getText().toString());
tvBalance.setText(getString(R.string.balancePrecursor)+ Float.toString(balance));
}
scrollLayout.addView(item);
etAmt.setText("");
etName.setText("");
}else{
if (etName.getText().toString().equals("")){
etName.setError(getString(R.string.nameError));
}
if (etAmt.getText().toString().equals("")||etAmt.getText().toString().equals(getString(R.string.amount))){
etAmt.setError(getString(R.string.AmtError));
}
}
}
});
btnClear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
scrollLayout.removeAllViews();
balance = 0;
tvBalance.setText(getString(R.string.balancePrecursor)+ Float.toString(balance));
}
});
}
}
| [
"cai.glencross@pomona.edu"
] | cai.glencross@pomona.edu |
b89985142dae2cbbe905b507aab9b986cbbbb221 | 53bec2582b32ad49ac02e902395b316212ec4a1c | /APersist/src/com/ng/apersist/dao/NoIterableTypeAsToManyRelationException.java | 98ca276b31b353519d0cd4d44610483ca28e07bd | [] | no_license | gundermann/APersist | 42933da7e805436be4ccc3ea015d853edf0411f2 | bef9e055e2b7730cd46b913e549c8698abd96c0e | refs/heads/master | 2021-01-10T20:13:23.407973 | 2019-01-12T12:16:55 | 2019-01-12T12:16:55 | 35,281,056 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 384 | java | package com.ng.apersist.dao;
public class NoIterableTypeAsToManyRelationException extends Exception {
private Class<? extends Object> class1;
public NoIterableTypeAsToManyRelationException(
Class<? extends Object> class1) {
this.class1 = class1;
}
@Override
public String getMessage() {
return class1.getSimpleName() +" is not iterable";
}
}
| [
"gundermann.niels.ng@googlemail.com"
] | gundermann.niels.ng@googlemail.com |
fce6ba77a030d36023052b44d8b310ff0828d633 | 99c14585111f3c73a305242473b6e7a79a5743f8 | /src/main/old/com/workasintended/chromaggus/ai/behavior/FindClosestCity.java | c264ba1418ed8184d1b318e3ac91b1f43fdb7245 | [] | no_license | mazimeng/chromaggus | 3a5fdb68108a6d50c5d8f1636519cd8752a9309e | 912ae7fdf50d46dc7f312b812af4339b327a4c2a | refs/heads/master | 2021-01-16T18:33:02.030430 | 2017-09-17T15:43:41 | 2017-09-17T15:43:41 | 100,087,622 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,115 | java | package com.workasintended.chromaggus.ai.behavior;
import com.badlogic.gdx.ai.btree.LeafTask;
import com.badlogic.gdx.ai.btree.Task;
import com.badlogic.gdx.utils.Predicate;
import com.workasintended.chromaggus.Unit;
import com.workasintended.chromaggus.WorldStage;
/**
* Created by mazimeng on 5/2/16.
*/
public abstract class FindClosestCity extends LeafTask<Blackboard> {
@Override
public Task.Status execute() {
final Blackboard b = getObject();
WorldStage worldStage = b.getWorldStage();
Unit city = b.getTarget();
if(city == null || city.city == null) {
city = b.findNearest(worldStage.getUnits(), new Predicate<Unit>() {
@Override
public boolean evaluate(Unit u) {
return u.city!=null && filter(u);
}
});
}
b.setTarget(city);
return city!=null?
Task.Status.SUCCEEDED : Task.Status.FAILED;
}
protected abstract boolean filter(Unit city);
@Override
protected Task copyTo(Task task) {
return task;
}
}
| [
"mazm@unicc.com.cn"
] | mazm@unicc.com.cn |
d1f64af0830f0a72d871ee9826fbd85261bcaea4 | adaef51ca14f6b60a8d59bc6df2d345c36a7180a | /vgandroid/src/main/java/com/hucanhui/vgandroid/testview/view/GraphView.java | 184e0d87ff6939646316b05e11b69561e3fae6b8 | [] | no_license | HuCanui/drawplant | 0d84d53b4ca0f3272086470389b6fb81f6374ddc | 0ae8729d39dbed7cd265248d3088f577cfd4038f | refs/heads/master | 2020-12-31T00:39:57.371279 | 2017-03-29T10:00:37 | 2017-03-29T10:00:37 | 86,559,265 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,425 | java | //! \file GraphView.java
//! \brief Drawing view class
// Copyright (c) 2012-2015, https://github.com/rhcad/vgandroid-demo, BSD license
package com.hucanhui.vgandroid.testview.view;
import rhcad.touchvg.core.GiCoreView;
import rhcad.touchvg.core.GiGestureState;
import rhcad.touchvg.core.GiGestureType;
import rhcad.touchvg.core.GiView;
import rhcad.touchvg.view.CanvasAdapter;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
//! Drawing view class
public class GraphView extends View {
private CanvasAdapter mCanvasAdapter;
private ViewAdapter mViewAdapter;
private GiCoreView mCoreView;
private DynDrawView mDynDrawView;
private long mDrawnTime;
private long mEndPaintTime;
private long mBeginTime;
public GraphView(Context context) {
super(context);
mCanvasAdapter = new CanvasAdapter(this);
mViewAdapter = new ViewAdapter();
mCoreView = GiCoreView.createView(mViewAdapter, 0);
DisplayMetrics dm = context.getApplicationContext().getResources().getDisplayMetrics();
GiCoreView.setScreenDpi(dm.densityDpi);
this.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
onGesture(GiGestureType.kGiGesturePan, GiGestureState.kGiGestureBegan, event);
} else if (event.getAction() == MotionEvent.ACTION_UP) {
onGesture(GiGestureType.kGiGesturePan, GiGestureState.kGiGestureEnded, event);
showTime();
} else if (mDynDrawView != null
&& event.getEventTime() > mDynDrawView.getEndPaintTime()) {
onGesture(GiGestureType.kGiGesturePan, GiGestureState.kGiGestureMoved, event);
showTime();
} else if (mDynDrawView == null && event.getEventTime() > mEndPaintTime) {
onGesture(GiGestureType.kGiGesturePan, GiGestureState.kGiGestureMoved, event);
showTime();
}
return true;
}
});
}
private void onGesture(GiGestureType type, GiGestureState state, MotionEvent event) {
mCoreView.onGesture(mViewAdapter, type, state, event.getX(), event.getY());
}
public GiCoreView coreView() {
return mCoreView;
}
public void setDynDrawView(DynDrawView view) {
mDynDrawView = view;
if (mDynDrawView != null) {
mDynDrawView.setCoreView(mViewAdapter, mCoreView);
}
}
public long getDrawnTime() {
return mDrawnTime;
}
private void showTime() {
Activity activity = (Activity) this.getContext();
String title = activity.getTitle().toString();
int pos = title.indexOf(" - ");
if (pos >= 0) {
title = title.substring(0, pos);
}
String dyntext = mDynDrawView != null ? mDynDrawView.getDrawnTime() + "/" : "";
activity.setTitle(title + " - " + dyntext + mDrawnTime + " ms");
}
private void doDraw() {
mBeginTime = android.os.SystemClock.uptimeMillis();
invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
mCoreView.onSize(mViewAdapter, this.getWidth(), this.getHeight());
if (mCanvasAdapter.beginPaint(canvas)) {
mCoreView.drawAll(mViewAdapter, mCanvasAdapter);
if (mDynDrawView == null) {
mCoreView.dynDraw(mViewAdapter, mCanvasAdapter);
}
mCanvasAdapter.endPaint();
}
mEndPaintTime = android.os.SystemClock.uptimeMillis();
mDrawnTime = mEndPaintTime - mBeginTime;
}
@Override
protected void onDetachedFromWindow() {
if (mDynDrawView != null) {
mDynDrawView.setCoreView(null, null);
mDynDrawView = null;
}
if (mViewAdapter != null) {
mViewAdapter.delete();
mViewAdapter = null;
}
if (mCoreView != null) {
mCoreView.delete();
mCoreView = null;
}
if (mCanvasAdapter != null) {
mCanvasAdapter.delete();
mCanvasAdapter = null;
}
super.onDetachedFromWindow();
}
private class ViewAdapter extends GiView {
@Override
public void regenAll(boolean changed) {
synchronized (mCoreView) {
if (changed) {
mCoreView.submitBackDoc(mViewAdapter, changed);
mCoreView.submitDynamicShapes(mViewAdapter);
}
}
doDraw();
if (mDynDrawView != null) {
mDynDrawView.doDraw();
}
}
@Override
public void regenAppend(int sid, int playh) {
regenAll(true);
}
@Override
public void redraw(boolean changed) {
synchronized (mCoreView) {
if (changed) {
mCoreView.submitDynamicShapes(mViewAdapter);
}
}
if (mDynDrawView != null) {
mDynDrawView.doDraw();
} else {
doDraw();
}
}
}
}
| [
"shixi_canhui@staff.sina.com.cn"
] | shixi_canhui@staff.sina.com.cn |
50e6ccf011403ebdac865ca30c1a3d1d279d6dd2 | 586874a36ba77d438e386e72792e40255660a841 | /src/main/java/AppForTestConnect/Main.java | 92cb92ba5f7afadf6301b458fd88338de5de3849 | [] | no_license | lapitus/AppForTestConnect | c4b3c28ca2b123a1ef6c14152f4ef671fceebebf | fec67a5ed527a4cae815c4e3c3918d0135d1bded | refs/heads/master | 2023-03-30T07:30:08.067406 | 2021-04-08T10:49:01 | 2021-04-08T10:49:01 | 355,622,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 789 | java | package AppForTestConnect;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
//@EnableJpaAuditing
public class Main {
public static void main(String[] args) {
SpringApplication.run(Main.class,args);
}
}
| [
"lapitusik@gmail.com"
] | lapitusik@gmail.com |
9d6fc4bae0b7aa49c835c5763096455b105f67d6 | d584a67371be79bd392036850515e83eb6eb505c | /src/test/java/com/java/login/LoginApplicationTests.java | f2b468270489742b107750f8d554135a78aa029a | [] | no_license | vishalpaalakurthi/SpringBootLoginExample | 826ff5fc918c7ccb75ebd554582b45b82dc956fd | 58d4e515a581557334e6f5100a28e8af86eca2b6 | refs/heads/master | 2020-05-17T06:01:57.255775 | 2019-04-26T12:44:44 | 2019-04-26T12:44:44 | 183,550,091 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package com.java.login;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class LoginApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"vpaalakurthi@nextsphere.com"
] | vpaalakurthi@nextsphere.com |
7cc579f21b3f3036440b4767e156085b3ed93c82 | 2564e90aad15d50bc3e9101cd8f261aaae654418 | /android/app/src/main/java/com/second/MainApplication.java | 43a2c6749800938e9153b1f3520a62652816328f | [] | no_license | Ipek-GitHub/Trivia_Game_App | bcce0b4a59bd57dfbc01396d47f2c1740f3c7d76 | 357af233df8d7d1f298a33f80713a85166946862 | refs/heads/master | 2023-01-09T07:00:51.466641 | 2020-11-08T15:25:11 | 2020-11-08T15:25:11 | 311,085,373 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,595 | java | package com.second;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.second.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"curgulipek@gmail.com"
] | curgulipek@gmail.com |
66a07f43d5b2fd194324f9e3593e6a8bf71fbb61 | 0f9028514d74feaebfd9b1a8641fc2c5ed82516a | /src/queue/CircleArrayQueue.java | 3a7b7d066e8fd0601a1c6ad1f4c20158012d7150 | [] | no_license | luxx2019/DataStructureAndAlgorithms | 3b5e59efaa0288bc16e60c9ffe518883ddcc1866 | 4094504400f717e97a8a862c45a58fc2f9f4bff3 | refs/heads/master | 2022-12-15T02:49:59.970209 | 2020-09-09T07:39:53 | 2020-09-09T07:39:53 | 294,039,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,129 | java | package queue;
/**
* 关于循环队列的一些想法
* 循环队列与普通队列大致相同,不同点在于,出队列和进队列时, front 和 rear 自增后需要模上数组的长度
* 此时存在一个问题需要解决,队空和队满两种情况无法做出区分,此处以头指针指向队列的头下标,尾指针指向队列尾下标进行说明
* 判空判满的的条件都是 front == (rear + 1) % arr.length
* 此时我们把队列尾部留下一个空格不用,用以区分
* 那么,此时判空条件不变,判满的条件为 front == (rear + 2) % arr.length
*
* 在debug的过程中,发现当 front 初始值为 0,rear 初始值为 -1 时,如果不进行一次出队列操作,那么就永远不会满足判满的条件
* 因为是循环队列,不在乎从数组的什么地方开始存储队列数据,更改初始值为 front = 0 , rear = size - 1
*
* 类型参数无法实例化
*/
public class CircleArrayQueue<E> implements Queue<E> {
private int size = 1000;
private int front;
private int rear;
private Object[] elements;
public CircleArrayQueue() {
elements = new Object[size];
front = 0;
rear = size - 1;
}
public CircleArrayQueue(int size) {
this.size = size;
elements = new Object[size];
front = 0;
rear = size - 1;
}
public boolean isFull() {
return front == (rear + 2) % size;
}
public boolean isEmpty() {
return front == (rear + 1) % size;
}
public boolean push(E e) {
if(isFull()) return false;
rear = (rear + 1) % size;
elements[rear] = e;
return true;
}
public E pop(){
if(isEmpty()) return null;
E e = (E) elements[front];
front = (front + 1) % size;
return e;
}
public E peek() {
if(isEmpty()) return null;
E e = (E) elements[front];
return e;
}
@Override
public int size() {
if (isEmpty()) return 0;
return rear >= front ? rear + 1 - front : rear + size + 1 - front;
}
}
| [
"moocaa@163.com"
] | moocaa@163.com |
cbd4039101dbad4c823d6e6580f779bddd8471bf | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XWIKI-13316-6-3-FEMO-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/internal/template/InternalTemplateManager_ESTest.java | 240448866d6750f86d37fa69cae88109515695cf | [] | 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 | 584 | java | /*
* This file was automatically generated by EvoSuite
* Fri Apr 03 23:51:55 UTC 2020
*/
package com.xpn.xwiki.internal.template;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class InternalTemplateManager_ESTest extends InternalTemplateManager_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
9c085bd4008d3899d691dce7d1ca982b0f30be20 | a2b648c56a521eac4c47161400385944cfa9d4e5 | /api-test/src/main/java/com/gdrive/apitest/controllers/HomeController.java | e79e15e2156165fbdfa114005d7fac00cb283b47 | [] | no_license | pathtolearn/gdrive-api-test | aec0176d914f48b16be3bb09588f51b35ba5350d | 3618a4e28dc20e11957cfcaf0da613e7f075b7f3 | refs/heads/master | 2020-05-15T22:42:42.504025 | 2019-04-21T13:18:30 | 2019-04-21T13:18:30 | 181,952,895 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,446 | java | package com.gdrive.apitest.controllers;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.List;
import java.util.Optional;
import javax.activation.MimetypesFileTypeMap;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gdrive.apitest.models.Folders;
import com.gdrive.apitest.service.GDriveService;
import io.swagger.annotations.ApiParam;
@RestController
public class HomeController {
@Autowired
private GDriveService service;
private ObjectMapper mapper = new ObjectMapper();
@GetMapping("/")
public String welcome() {
return "Welcome";
}
@CrossOrigin
@GetMapping("/folders")
public ResponseEntity<String> getFilesAndFolders(@RequestParam String Authorization, @RequestParam String id,
@ApiParam(required = false) @RequestParam Optional<Boolean> includeTeamDrives,
@ApiParam(required = false) @RequestParam Optional<String> orderBy,
@ApiParam(required = false) @RequestParam Optional<Boolean> fetchTags,
@ApiParam(required = false) @RequestParam Optional<Boolean> calculateFolderPath,
@ApiParam(required = false) @RequestParam Optional<Integer> pageSize,
@ApiParam(required = false) @RequestParam Optional<String> nextPage,
@ApiParam(required = false) @RequestParam Optional<String> fields) throws JsonProcessingException {
ResponseEntity<String> returnEntity = null;
try {
List<Folders> folders = service.getFilesAndFolders(Authorization, id, includeTeamDrives, orderBy, fetchTags,
calculateFolderPath, pageSize, nextPage, fields);
returnEntity = new ResponseEntity<String>(mapper.writeValueAsString(folders), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<String>(mapper.writeValueAsString(e.getLocalizedMessage()), HttpStatus.INTERNAL_SERVER_ERROR);
}
return returnEntity;
}
@CrossOrigin
@RequestMapping(value = "/upload/files", method = RequestMethod.POST, produces = "application/json", consumes = {
"multipart/form-data" })
public ResponseEntity<String> uploadFilesToAFolder(@RequestPart String Authorization,
@RequestPart MultipartFile file, @ApiParam(required = false) @RequestPart MultipartFile thumbnail, @RequestPart String path,
@ApiParam(required = false) @RequestParam Optional<String> folderId,
@ApiParam(required = false) @RequestPart Optional<String> mimeType,
@ApiParam(required = false) @RequestPart Optional<Integer> size,
@ApiParam(required = false) @RequestPart Optional<String[]> tags,
@ApiParam(required = false) @RequestPart Optional<String> description,
@ApiParam(required = false) @RequestPart Optional<Boolean> overwrite,
@ApiParam(required = false) @RequestPart Optional<Boolean> calculateFolderPath) throws JsonProcessingException {
ResponseEntity<String> returnEntity = null;
try {
Folders folder = service.uploadFilesToAFolder(Authorization, file, thumbnail, path, folderId, mimeType, size, tags, description,
overwrite, calculateFolderPath);
returnEntity = new ResponseEntity<String>(mapper.writeValueAsString(folder), HttpStatus.CREATED);
} catch (Exception e) {
return new ResponseEntity<String>(mapper.writeValueAsString(e.getLocalizedMessage()), HttpStatus.INTERNAL_SERVER_ERROR);
}
return returnEntity;
}
@CrossOrigin
@GetMapping("/file/id")
public ResponseEntity<Resource> downloadFile(@RequestParam String Authorization, @RequestParam String id,
@ApiParam(required = false) @RequestParam Optional<Boolean> calculateFolderPath,
@ApiParam(required = false) @RequestParam Optional<Boolean> includeTeamDrives, HttpServletResponse response) {
try {
String downloadedFilePath = service.downloadFile(Authorization, id, calculateFolderPath, includeTeamDrives);
File file = new File(downloadedFilePath);
response.setContentType(new MimetypesFileTypeMap().getContentType(file));
response.setContentLength((int)file.length());
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(file.getName(), "UTF-8"));
InputStream is = new FileInputStream(file);
FileCopyUtils.copy(is, response.getOutputStream());
} catch (Exception e) {
System.out.println(e.getStackTrace());
}
return null;
}
@CrossOrigin
@GetMapping("/folder/contents")
public ResponseEntity<String> getFolderContents(@RequestParam String Authorization, @RequestParam String path,
@ApiParam(required = false) @RequestParam Optional<Boolean> includeTeamDrives,
@ApiParam(required = false) @RequestParam Optional<String> teamDriveId,
@ApiParam(required = false) @RequestParam Optional<String> where,
@ApiParam(required = false) @RequestParam Optional<String> orderBy,
@ApiParam(required = false) @RequestParam Optional<Boolean> fetchTags,
@ApiParam(required = false) @RequestParam Optional<Boolean> calculateFolderPath,
@ApiParam(required = false) @RequestParam Optional<Integer> pageSize,
@ApiParam(required = false) @RequestParam Optional<String> nextPage,
@ApiParam(required = false) @RequestParam Optional<String> fields) throws JsonProcessingException {
ResponseEntity<String> returnEntity = null;
try {
List<Folders> folders = service.getFolderContents(Authorization, path, includeTeamDrives, teamDriveId,
where, orderBy, fetchTags, calculateFolderPath, pageSize, nextPage, fields);
returnEntity = new ResponseEntity<String>(mapper.writeValueAsString(folders), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<String>(mapper.writeValueAsString(e.getLocalizedMessage()), HttpStatus.INTERNAL_SERVER_ERROR);
}
return returnEntity;
}
}
| [
"trinad536@yahoo.com"
] | trinad536@yahoo.com |
b630e1a14e13a924f2f69f619f040d11cb63c599 | 466912406272829982f75854cf0104c6ce8c9814 | /web/site-v2/api/service-company/src/main/java/com/tsb/company/dao/DealScoreVODao.java | be6e8cedeb9bb910cff198c78472e8849d125146 | [] | no_license | logonmy/Codes | 9631fa103fc499663361fa7eeccd7cedb9bb08e4 | 92723efdeccfc193f9ee5d0ab77203c254f34bc2 | refs/heads/master | 2021-09-21T18:07:22.985184 | 2018-08-30T05:53:26 | 2018-08-30T05:53:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 888 | java | package com.tsb.company.dao;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.tsb.company.vo.DealScoreVO;
public interface DealScoreVODao {
int countAssigned(@Param("organizationId") int organizationId, @Param("userId") int userId, @Param("type") int type, @Param("fromDate") Date fromDate, @Param("toDate") Date toDate);
int countTODO(@Param("organizationId") int organizationId, @Param("userId") int userId, @Param("type") int type, @Param("filter") int filter);
List<DealScoreVO> listTODO(@Param("organizationId") int organizationId, @Param("userId") int userId, @Param("type") int type, @Param("filter") int filter, @Param("from") int from, @Param("pageSize") int pageSize);
DealScoreVO getNextScoring(@Param("organizationId") int organizationId, @Param("userId") int userId, @Param("companyId") int exceptCompanyId);
}
| [
"hush_guo@163.com"
] | hush_guo@163.com |
9d97450f53f807ecf87417e54df9d426ad337ecc | 9b01ffa3db998c4bca312fd28aa977f370c212e4 | /app/src/streamD/java/com/loki/singlemoduleapp/stub/SampleClass7281.java | e00a65e1cd6d3b6091d4ba9aceb41670ea249ae5 | [] | no_license | SergiiGrechukha/SingleModuleApp | 932488a197cb0936785caf0e73f592ceaa842f46 | b7fefea9f83fd55dbbb96b506c931cc530a4818a | refs/heads/master | 2022-05-13T17:15:21.445747 | 2017-07-30T09:55:36 | 2017-07-30T09:56:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 281 | java | package com.loki.singlemoduleapp.stub;
public class SampleClass7281 {
private SampleClass7282 sampleClass;
public SampleClass7281(){
sampleClass = new SampleClass7282();
}
public String getClassName() {
return sampleClass.getClassName();
}
} | [
"sergey.grechukha@gmail.com"
] | sergey.grechukha@gmail.com |
9a04c6075cd346523cff099a7b9e1984366f2b20 | e1b44f655f4102eb06b133220a0f6c0ab58b1e20 | /src/main/java/com/loohp/interactivechat/NMS/V1_8_R3.java | cb358fc08dc650cedc02a7fe14d7a5703746953e | [] | no_license | NotYusta/InteractiveChat | 3a37e1f198dd9cf3b73ccfd3b57d0823e4956090 | adf91a5241e360676b19682d0b09c85da7173f99 | refs/heads/master | 2023-03-04T11:10:00.618442 | 2021-02-19T14:14:02 | 2021-02-19T14:14:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,345 | java | package com.loohp.interactivechat.NMS;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.chat.ComponentSerializer;
import net.minecraft.server.v1_8_R3.IChatBaseComponent;
import net.minecraft.server.v1_8_R3.IChatBaseComponent.ChatSerializer;
import net.minecraft.server.v1_8_R3.PacketPlayOutTitle;
import net.minecraft.server.v1_8_R3.PacketPlayOutTitle.EnumTitleAction;
public class V1_8_R3 {
public static void sendTitle(Player player, String title, String subtitle, int time) {
IChatBaseComponent chatTitle = ChatSerializer.a(ComponentSerializer.toString(TextComponent.fromLegacyText(title)));
IChatBaseComponent chatSubtitle = ChatSerializer.a(ComponentSerializer.toString(TextComponent.fromLegacyText(subtitle)));
PacketPlayOutTitle titlepacket = new PacketPlayOutTitle(EnumTitleAction.TITLE, chatTitle);
PacketPlayOutTitle subtitlepacket = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, chatSubtitle);
PacketPlayOutTitle length = new PacketPlayOutTitle(10, time, 20);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(titlepacket);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(subtitlepacket);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(length);
}
}
| [
"jamesloohp@gmail.com"
] | jamesloohp@gmail.com |
961ef1f927aeb10fabbdb21c01cd5df4f2724a5b | 6264d334cc6a2af608d0e57d3eb62bb7811b12f1 | /dabenxiang-security-core/src/main/java/com/dabenxiang/security/core/authorize/GycAuthorizeConfigManager.java | efba13ea64323123e3262f3f31f53afed6bcc1e6 | [] | no_license | dabengxiang/dabenxiang-security | bf4d4fb50546c3a38b7b97fc54b814215d67cf33 | 92211922d1289d5cc762ed10e4c53b97387af671 | refs/heads/master | 2020-03-23T20:18:21.946322 | 2018-10-14T15:02:44 | 2018-10-14T15:02:44 | 142,033,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,164 | java | package com.dabenxiang.security.core.authorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* Date:2018/9/30
* Author: yc.guo the one whom in nengxun
* Desc:
*/
@Component
public class GycAuthorizeConfigManager implements AuthorizeConfigManager {
@Autowired(required = false)
private List<AuthorizeConfigProvider> providersList;
@Override
public void config(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry config) {
if(providersList==null)
return ;
for (AuthorizeConfigProvider authorizeConfigProvider : providersList) {
authorizeConfigProvider.config(config);
}
}
}
| [
"836732982@qq.com"
] | 836732982@qq.com |
781fe295313d4c1c775632ebea2bcb8cd8cd9322 | 5ca3901b424539c2cf0d3dda52d8d7ba2ed91773 | /src_cfr/com/google/security/zynamics/zylib/gui/JStackView/IStackModel.java | 6ea8407da9892b704969283f4b3deafd5a0952dc | [] | no_license | fjh658/bindiff | c98c9c24b0d904be852182ecbf4f81926ce67fb4 | 2a31859b4638404cdc915d7ed6be19937d762743 | refs/heads/master | 2021-01-20T06:43:12.134977 | 2016-06-29T17:09:03 | 2016-06-29T17:09:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 502 | java | /*
* Decompiled with CFR 0_115.
*/
package com.google.security.zynamics.zylib.gui.JStackView;
import com.google.security.zynamics.zylib.gui.JStackView.IStackModelListener;
public interface IStackModel {
public void addListener(IStackModelListener var1);
public String getElement(long var1);
public int getNumberOfEntries();
public long getStackPointer();
public long getStartAddress();
public boolean hasData(long var1, long var3);
public boolean keepTrying();
}
| [
"manouchehri@riseup.net"
] | manouchehri@riseup.net |
84ec47e1f2924a70ac5a385be4ac811493b42096 | 182b7e5ca415043908753d8153c541ee0e34711c | /spring-basics/spring-core/xml/src/main/java/com/vinaylogics/springbasics/core/xml/LifeCycleBean.java | b445ece5c267d8a4dab2849bfe7892080756f492 | [] | no_license | akamatagi/Java9AndAbove | 2b62886441241ef4cd62990243d7b29e895452f7 | ff002a2395edf506091b3571a470c15fa0742550 | refs/heads/master | 2023-02-09T17:38:21.467950 | 2020-12-30T14:47:59 | 2020-12-30T14:47:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 155 | java | package com.vinaylogics.springbasics.core.xml;
public interface LifeCycleBean {
void init() throws Exception;
void destroy() throws Exception;
}
| [
"vinayagam.d.ganesh@gmail.com"
] | vinayagam.d.ganesh@gmail.com |
70b622f14cdfc6280c31ec5d43a6c14874e69bdf | 90c50a85dd77e1dcb1aa71e6bc9997deb1ac5906 | /pyg-mapper/src/main/java/com/dt/pyg/mapper/ContentMapper.java | f118a2e2e595e54a32d9753f445d939a5f312a43 | [] | no_license | github-dt/pyg | 928d59b59273026038b066c07f2aac0d33dfea89 | 6beb3db6ded8636b64ad182c9e0701016348c777 | refs/heads/master | 2020-07-07T09:56:53.842015 | 2019-09-07T14:41:48 | 2019-09-07T14:41:48 | 203,319,202 | 0 | 0 | null | 2019-08-22T06:06:47 | 2019-08-20T07:03:53 | JavaScript | UTF-8 | Java | false | false | 161 | java | package com.dt.pyg.mapper;
import com.dt.pyg.pojo.Content;
import tk.mybatis.mapper.common.Mapper;
public interface ContentMapper extends Mapper<Content>{
} | [
"1224956007@qq.com"
] | 1224956007@qq.com |
352c0d7d65376a51dd546d501e1907a9e9b7070e | 311f1237e7498e7d1d195af5f4bcd49165afa63a | /sourcedata/lucene-solr-releases-lucene-2.2.0/contrib/gdata-server/src/core/src/java/org/apache/lucene/gdata/storage/ResourceNotFoundException.java | f7470fa48ffd545e5772a339f18d4dc2cae597be | [
"Apache-2.0"
] | permissive | DXYyang/SDP | 86ee0e9fb7032a0638b8bd825bcf7585bccc8021 | 6ad0daf242d4062888ceca6d4a1bd4c41fd99b63 | refs/heads/master | 2023-01-11T02:29:36.328694 | 2019-11-02T09:38:34 | 2019-11-02T09:38:34 | 219,128,146 | 10 | 1 | Apache-2.0 | 2023-01-02T21:53:42 | 2019-11-02T08:54:26 | Java | UTF-8 | Java | false | false | 2,233 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.gdata.storage;
/**
* This exception will be thrown if an requested resource of a resource to modify can not be found
* @author Simon Willnauer
*
*/
public class ResourceNotFoundException extends StorageException {
private static final long serialVersionUID = -8549987918130998249L;
/**
* Constructs an empty ResourceNotFoundException
*/
public ResourceNotFoundException() {
super();
// TODO Auto-generated constructor stub
}
/**
* Constructs a new ResourceNotFoundException with an exception message
* @param message - the exception message
*/
public ResourceNotFoundException(String message) {
super(message);
// TODO Auto-generated constructor stub
}
/**
* Constructs a new ResourceNotFoundException with an exception message and a root cause
* @param message - the exception message
* @param cause - the root cause of this exception
*/
public ResourceNotFoundException(String message, Throwable cause) {
super(message, cause);
// TODO Auto-generated constructor stub
}
/**
* Constructs a new ResourceNotFoundException with a root cause
* @param cause - the root cause of this exception
*
*/
public ResourceNotFoundException(Throwable cause) {
super(cause);
// TODO Auto-generated constructor stub
}
}
| [
"512463514@qq.com"
] | 512463514@qq.com |
710735569aa2e883e62c03534ac0c624cecd74ae | bfe61e2f03d91e31a9191f3aa3940c9be9cde949 | /src/main/java/com/one/mongoreactivehumanresources/documents/Job.java | ee450795a00d94250b851b053ff6e2a5c4a09d86 | [] | no_license | TomasOtano25/mongo-reactive-human-resources | 215cf8d6c5a9f7413cf9fec06fbc121abd3bb195 | 6c49f9ffb9a7bda9afec01bc3604fdd0fc70ce3b | refs/heads/master | 2022-12-20T13:04:07.668551 | 2020-10-15T17:06:59 | 2020-10-15T17:06:59 | 300,307,579 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,190 | java | package com.one.mongoreactivehumanresources.documents;
import com.one.mongoreactivehumanresources.documents.enums.Risk;
import com.one.mongoreactivehumanresources.dtos.JobDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@EqualsAndHashCode
@ToString
@Data
@Document
public class Job {
@Id
private String id;
private String name;
private Risk risk;
private double minSalary;
private double maxSalary;
private boolean state;
public Job() {
this.state = true;
}
public Job(String name, Risk risk, double minSalary, double maxSalary) {
this.name = name;
this.risk = risk;
this.minSalary = minSalary;
this.maxSalary = maxSalary;
this.state = true;
}
public Job(JobDto jobDto) {
this.id = jobDto.getId();
this.name = jobDto.getName();
this.risk = jobDto.getRisk();
this.minSalary = jobDto.getMinSalary();
this.maxSalary = jobDto.getMaxSalary();
this.state = true;
}
}
| [
"tomasotano25@gmail.com"
] | tomasotano25@gmail.com |
ec8c4069c6c12cde22ffef505a0f4a403c3ea099 | 4c19b724f95682ed21a82ab09b05556b5beea63c | /XMSYGame/java2/server/zxyy-webhome/src/main/java/com/xmsy/server/zxyy/webhome/modules/manager/webhomepopulargames/entity/WebhomePopularGamesEntity.java | 1098c11d6c5bee0d43eeeb9450ad4a241774c64d | [] | no_license | angel-like/angel | a66f8fda992fba01b81c128dd52b97c67f1ef027 | 3f7d79a61dc44a9c4547a60ab8648bc390c0f01e | refs/heads/master | 2023-03-11T03:14:49.059036 | 2022-11-17T11:35:37 | 2022-11-17T11:35:37 | 222,582,930 | 3 | 5 | null | 2023-02-22T05:29:45 | 2019-11-19T01:41:25 | JavaScript | UTF-8 | Java | false | false | 1,053 | java | package com.xmsy.server.zxyy.webhome.modules.manager.webhomepopulargames.entity;
import com.baomidou.mybatisplus.annotations.TableName;
import com.xmsy.server.zxyy.webhome.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 官网热门游戏
*
* @author xiaoliu
* @email xxxxx
* @date 2019-01-29 16:07:37
*/
@Data
@EqualsAndHashCode(callSuper=false)
@Accessors(chain=true)
@TableName("webhome_popular_games")
public class WebhomePopularGamesEntity extends BaseEntity<WebhomePopularGamesEntity> {
private static final long serialVersionUID = 1L;
/**
* 名称
*/
private String name;
/**
* 附件ID
*/
private Long enclosureId;
/**
* 介绍
*/
private String introduction;
/**
* 类型(menu,game)
*/
private String type;
/**
* 类型Id
*/
private Long typeId;
/**
* 路径
*/
private String url;
/**
* 状态
*/
private Boolean enable;
/**
* 排序号
*/
private Integer orderNum;
}
| [
"163@qq.com"
] | 163@qq.com |
b331db949cd8fd8bcb0229d4f545d1a85dc377aa | e2151b1e55920e180a1a837d50ed4c0a47a3e07c | /src/de/xcom/keshlib/keshlibandroiddemo/KeshApplication.java | cfecb261c8ee1b39a06fa0e6f12182ff28535470 | [
"MIT"
] | permissive | xcom-ag/keshlib-android-demo | 74abcbaeb1d44e700b99ed03ff21dcadba4eebc0 | 9aa20cc9aced8a09b0189af1805dc7ac57858891 | refs/heads/master | 2016-09-10T19:08:01.178783 | 2016-01-13T08:35:37 | 2016-01-13T08:35:37 | 31,542,696 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 268 | java | package de.xcom.keshlib.keshlibandroiddemo;
import android.app.Application;
public class KeshApplication extends Application {
/*
* (non-Javadoc)
*
* @see android.app.Application#onCreate()
*/
@Override
public void onCreate() {
super.onCreate();
}
}
| [
"gerrit.holz@xcom.de"
] | gerrit.holz@xcom.de |
7d584684a309bf0fb46c75cb91951ce6955ffe40 | e75be673baeeddee986ece49ef6e1c718a8e7a5d | /submissions/blizzard/Corpus/eclipse.jdt.ui/1154.java | da704d5bfc94322b63fb982a2c309f0f6a2d59bf | [
"MIT"
] | permissive | zhendong2050/fse18 | edbea132be9122b57e272a20c20fae2bb949e63e | f0f016140489961c9e3c2e837577f698c2d4cf44 | refs/heads/master | 2020-12-21T11:31:53.800358 | 2018-07-23T10:10:57 | 2018-07-23T10:10:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,444 | java | /*******************************************************************************
* Copyright (c) 2007, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.ui.text.spelling;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.quickassist.IQuickAssistInvocationContext;
import org.eclipse.ui.texteditor.spelling.SpellingService;
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jdt.internal.ui.JavaUIMessages;
import org.eclipse.jdt.internal.ui.text.correction.IProposalRelevance;
/**
* Proposal to disable spell checking.
*
* @since 3.3
*/
public class DisableSpellCheckingProposal implements IJavaCompletionProposal {
/** The invocation context */
private IQuickAssistInvocationContext fContext;
/**
* Creates a new proposal.
*
* @param context the invocation context
*/
public DisableSpellCheckingProposal(IQuickAssistInvocationContext context) {
fContext = context;
}
/*
* @see org.eclipse.jface.text.contentassist.ICompletionProposal#apply(org.eclipse.jface.text.IDocument)
*/
@Override
public final void apply(final IDocument document) {
IPreferenceStore store = EditorsUI.getPreferenceStore();
store.setValue(SpellingService.PREFERENCE_SPELLING_ENABLED, false);
}
/*
* @see org.eclipse.jface.text.contentassist.ICompletionProposal#getAdditionalProposalInfo()
*/
@Override
public String getAdditionalProposalInfo() {
return JavaUIMessages.Spelling_disable_info;
}
/*
* @see org.eclipse.jface.text.contentassist.ICompletionProposal#getContextInformation()
*/
@Override
public final IContextInformation getContextInformation() {
return null;
}
/*
* @see org.eclipse.jface.text.contentassist.ICompletionProposal#getDisplayString()
*/
@Override
public String getDisplayString() {
return JavaUIMessages.Spelling_disable_label;
}
/*
* @see org.eclipse.jface.text.contentassist.ICompletionProposal#getImage()
*/
@Override
public Image getImage() {
return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_NLS_NEVER_TRANSLATE);
}
/*
* @see org.eclipse.jdt.ui.text.java.IJavaCompletionProposal#getRelevance()
*/
@Override
public final int getRelevance() {
return IProposalRelevance.DISABLE_SPELL_CHECKING;
}
/*
* @see org.eclipse.jface.text.contentassist.ICompletionProposal#getSelection(org.eclipse.jface.text.IDocument)
*/
@Override
public final Point getSelection(final IDocument document) {
return new Point(fContext.getOffset(), fContext.getLength());
}
}
| [
"tim.menzies@gmail.com"
] | tim.menzies@gmail.com |
ca037b1ee87f893f98d07914e9d6ef6685b467f9 | 7ee709db6967587dcf6a3f75f725fc69b7ed91af | /190628/src/Ex0313_eunbiSsem.java | 623228ecead909e87a587ed3cdeedab20e4d40cc | [] | no_license | kumdori/java_smhrd | 316bcdc5a63dfb0afd69ce993365d36b679791d5 | efe31360751f71b8c895c684216c67d68b7c98df | refs/heads/master | 2020-06-05T02:40:38.192995 | 2019-07-17T04:39:11 | 2019-07-17T04:39:11 | 192,285,266 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,960 | java | import java.util.ArrayList;
import java.util.Scanner;
public class Ex0313_eunbiSsem {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
ArrayList<String> musiclist = new ArrayList<String>();
ArrayList<ArrayList<String>> allPlayList = new ArrayList<ArrayList<String>>();
ArrayList<String> playListName = new ArrayList<String>();
boolean isRunning = true;
while (isRunning) {
System.out.print("[1]노래추가 [2]노래삭제 [3]PlayList추가 [4]PlayList조회 [5]종료");
switch (scan.nextInt()) {
case 1:
musicAdd(musiclist, scan);
break;
case 2:
musicDelete(musiclist, scan);
break;
case 3:
System.out.print("PlayList이름 >> ");
String name = scan.next();
playListName.add(name);
allPlayList.add(musiclist);
break;
case 4:
System.out.println("0. 새로운 트랙");
print(playListName);
System.out.print("index >> ");
int choice = scan.nextInt();
if (choice == 0) {
musiclist = new ArrayList<String>();
}else {
musiclist = allPlayList.get(choice - 1);
}
break;
case 5:
isRunning = false;
System.out.println("종료되었습니다.");
break;
}
}
}
private static void musicDelete(ArrayList<String> current, Scanner scan) {
print(current);
if (current.size() > 0) {
System.out.print("[1]선택삭제 [2]모두삭제");
switch (scan.nextInt()) {
case 1:
System.out.print("index >> ");
int index = scan.nextInt();
current.remove(index - 1);
break;
case 2:
current.clear();
break;
}
}
}
private static void musicAdd(ArrayList<String> current, Scanner scan) {
print(current);
System.out.print("[1]마지막위치에 추가 [2]원하는 위치에 추가");
int choice = scan.nextInt();
System.out.println("노래제목 >> ");
String music = scan.next();
switch (choice) {
case 1:
current.add(music);
break;
case 2:
System.out.print("index : ");
int index = scan.nextInt();
current.add(index - 1, music);
break;
}
}
private static void print(ArrayList<String> current) {
if (current.size() == 0) {
System.out.println("재생목록이 존재하지 않습니다.");
} else {
for (int i = 0; i < current.size(); i++) {
System.out.println(i + 1 + "." + current.get(i));
}
}
}
} | [
"SM14@DESKTOP-G8C6S9Q"
] | SM14@DESKTOP-G8C6S9Q |
95ea25b11a97f30c17462b2615de430506342f32 | f6b23975d200f554b892f6f8ace299092357501d | /wechatDev/src/main/java/com/lex/model/BaseMessage.java | 150c96f03debf1049d36815e2a7ef01ef351ddd5 | [] | no_license | lex19950102/wechatDev | f9bdac5a3f5ecb227de0c3e7e4ba6738d52dd586 | cb637ba9a4eb8e68c74fd6e4f4c5aa6602c351d9 | refs/heads/master | 2020-04-04T18:47:37.555164 | 2018-11-07T06:25:39 | 2018-11-07T06:25:39 | 156,179,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 692 | java | package com.lex.model;
public class BaseMessage {
private String ToUserName;
private String FromUserName;
private Long CreateTime;
private String MsgType;
public String getToUserName() {
return ToUserName;
}
public void setToUserName(String toUserName) {
ToUserName = toUserName;
}
public String getFromUserName() {
return FromUserName;
}
public void setFromUserName(String fromUserName) {
FromUserName = fromUserName;
}
public Long getCreateTime() {
return CreateTime;
}
public void setCreateTime(Long createTime) {
CreateTime = createTime;
}
public String getMsgType() {
return MsgType;
}
public void setMsgType(String msgType) {
MsgType = msgType;
}
}
| [
"274164963@qq.com"
] | 274164963@qq.com |
44c7fae6934d32d94a2ba7215ee9e5773fc92946 | 0e309678d59fa85285d034059e3bd5ca1ffb56cf | /telemetry-netty/src/test/java/me/dmexe/telemetery/netty/channel/TestEnv.java | 74d659b38da860219628b36ab323ba0c3f4cba73 | [
"Apache-2.0"
] | permissive | dmexe/telemetry | 26357ed37cf5f49a050ed0c0e39a8afbd6e8dcf4 | 3a09f1b3cf97a2d46d265dfb1e46c44986cd5246 | refs/heads/master | 2021-09-15T04:14:00.940619 | 2018-03-13T16:47:30 | 2018-05-25T15:56:20 | 105,984,813 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,953 | java | package me.dmexe.telemetery.netty.channel;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;
import io.opentracing.Span;
import io.opentracing.Tracer;
import io.prometheus.client.CollectorRegistry;
import java.io.Closeable;
import java.net.InetSocketAddress;
import java.time.Duration;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import me.dmexe.telemetery.netty.channel.support.ClientChannelInit;
import me.dmexe.telemetery.netty.channel.support.ServerChannelInit;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
abstract class TestEnv {
private static Duration lifecycleDuration = Duration.ofSeconds(3);
private static Logger log = LoggerFactory.getLogger(TestEnv.class);
Client newClient(InetSocketAddress address, CollectorRegistry collectorRegistry, Tracer tracer) throws Exception {
final EventLoopGroup group = new NioEventLoopGroup(2);
final BlockingQueue<HttpResponse> queue = new ArrayBlockingQueue<>(1);
try {
final Bootstrap bootstrap = new Bootstrap()
.group(group)
.channel(NioSocketChannel.class)
.handler(new ClientChannelInit(queue, collectorRegistry, tracer));
final ChannelFuture future = bootstrap.connect(address).sync();
return new Client(group, future, queue);
} catch (Exception err) {
group.shutdownGracefully(0, lifecycleDuration.getSeconds(), TimeUnit.SECONDS);
throw err;
}
}
Server newServer(CollectorRegistry collectorRegistry, Tracer tracer) throws Exception {
final EventLoopGroup group = new NioEventLoopGroup(2);
try {
final ServerBootstrap bootstrap = new ServerBootstrap()
.group(group)
.channel(NioServerSocketChannel.class)
.childHandler(new ServerChannelInit(collectorRegistry, tracer));
final ChannelFuture future = bootstrap.bind(0).sync();
return new Server(group, future);
} catch (Exception err) {
group.shutdownGracefully(0, lifecycleDuration.getSeconds(), TimeUnit.SECONDS);
throw err;
}
}
static List<String> samples(CollectorRegistry collectorRegistry, String filter) {
return samples(collectorRegistry).stream()
.filter(it -> it.startsWith(filter))
.collect(Collectors.toList());
}
private static List<String> samples(CollectorRegistry collectorRegistry) {
return Collections.list(collectorRegistry.metricFamilySamples()).stream()
.flatMap(family ->
family.samples.stream().map(sample ->
sample.name + "{" + String.join(",", sample.labelValues) + "}=" + sample.value
)
)
.sorted()
.collect(Collectors.toList());
}
static class Client implements Closeable {
private final EventLoopGroup group;
private final ChannelFuture future;
private final InetSocketAddress address;
private final BlockingQueue<HttpResponse> queue;
Client(EventLoopGroup group, ChannelFuture future, BlockingQueue<HttpResponse> queue) {
Objects.requireNonNull(group, "group cannot be null");
Objects.requireNonNull(future, "future cannot be null");
Objects.requireNonNull(queue, "queue cannot be null");
this.group = group;
this.future = future;
this.address = (InetSocketAddress) future.channel().localAddress();
this.queue = queue;
log.info("client connected at {}", address());
}
@Override
public void close() {
group.shutdownGracefully(0, lifecycleDuration.getSeconds(), TimeUnit.SECONDS);
try {
future.channel().closeFuture().sync();
log.info("client disconnected at {}", address());
} catch (InterruptedException err) {
throw new RuntimeException(err);
}
}
InetSocketAddress address() {
return address;
}
Channel channel() {
return future.channel();
}
@Nullable
HttpResponse response() {
try {
return queue.poll(lifecycleDuration.getSeconds(), TimeUnit.SECONDS);
} catch (InterruptedException err) {
throw new RuntimeException(err);
}
}
void request(HttpRequest request) {
channel().writeAndFlush(request).awaitUninterruptibly(lifecycleDuration.toMillis());
}
void request(HttpRequest request, Span root) {
NettyHttpTracingContext.addClientParentContext(channel(), root.context());
request(request);
}
}
static class Server implements Closeable {
private final EventLoopGroup group;
private final ChannelFuture future;
private final InetSocketAddress address;
Server(EventLoopGroup group, ChannelFuture future) {
Objects.requireNonNull(group, "group cannot be null");
Objects.requireNonNull(future, "future cannot be null");
this.group = group;
this.future = future;
this.address = (InetSocketAddress) future.channel().localAddress();
log.info("server started at {}", address());
}
@Override
public void close() {
group.shutdownGracefully(0, lifecycleDuration.getSeconds(), TimeUnit.SECONDS);
try {
future.channel().closeFuture().sync();
log.info("server stopped at {}", address());
} catch (InterruptedException err) {
throw new RuntimeException(err);
}
}
InetSocketAddress address() {
return address;
}
}
}
| [
"dima.exe@gmail.com"
] | dima.exe@gmail.com |
1b2b8db777b5865723a33d265b54ae826601934a | 63ca33ae98f64b52c7586e68c639f177d78fe6be | /microservice-provider-pay/src/main/java/com/hzg/tools/SignInUtil.java | f4180041b9f5a7624dacdeb6b6e218011c7d2dab | [
"MIT"
] | permissive | smjie2800/spring-cloud-microservice-redis-activemq-hibernate-mysql | 366b6e5106f3014bc17823a0bea7d6c3d53a868c | 9ef2aa11622cee3d03be9ad5ed5350259d71f239 | refs/heads/master | 2021-01-19T19:08:44.659496 | 2018-05-23T07:01:59 | 2018-05-23T07:01:59 | 86,646,685 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 5,325 | java | package com.hzg.tools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@Component
public class SignInUtil {
@Autowired
public RedisTemplate<String, Object> redisTemplate;
//如果用户失败登录次数 >= waitToSignInCount,则需要等待 2^signInFailCount * waitTimeUnit 毫秒,才可以再次登录
public int waitToSignInCount = 3;
public int waitTimeUnit = 10 * 1000;
/**
* 取到用户等待一段时间
*
* @param username
*/
public long userWait(String username) {
Long signInFailTime = (Long)redisTemplate.opsForValue().get("signInFailTime_" + username);
if (signInFailTime != null) {
long timeDiff = System.currentTimeMillis() - signInFailTime;
long waitTime = getWaitTime(username);
if (timeDiff < waitTime) {
return (waitTime - timeDiff);
}
}
return 0;
}
/**
* 设置登录失败次数。及失败登录次数 >= waitToSignInCount时,该次登录的登录时间
*
* @param username
*/
public void setSignInFailInfo(String username) {
Integer signInFailCount = (Integer) redisTemplate.opsForValue().get("signInFailCount_" + username);
if (signInFailCount == null) {
redisTemplate.opsForValue().set("signInFailCount_" + username, 1);
} else {
signInFailCount = signInFailCount + 1;
redisTemplate.opsForValue().set("signInFailCount_" + username, signInFailCount);
if (signInFailCount >= waitToSignInCount) {
redisTemplate.opsForValue().set("signInFailTime_" + username, System.currentTimeMillis());
}
}
}
public void removeSignInFailInfo(String username) {
if (redisTemplate.opsForValue().get("signInFailCount_" + username) != null) {
redisTemplate.opsForValue().getOperations().delete("signInFailCount_" + username);
}
if (redisTemplate.opsForValue().get("signInFailTime_" + username) != null) {
redisTemplate.opsForValue().getOperations().delete("signInFailTime_" + username);
}
}
public int getSignInFailCount(String username) {
Integer signInFailCount = (Integer) redisTemplate.opsForValue().get("signInFailCount_" + username);
return signInFailCount == null ? 0 : signInFailCount;
}
/**
* 获取等待时间(毫秒)
* @param username
* @return
*/
public long getWaitTime(String username) {
long waitTime = 0;
int signInFailCount = getSignInFailCount(username);
if (signInFailCount >= waitToSignInCount) {
waitTime = (int)Math.pow(2, signInFailCount) * waitTimeUnit;
}
return waitTime;
}
/**
* 获取等待秒数
* @param username
* @return
*/
public long getWaitSeconds(String username) {
return getWaitTime(username)/1000;
}
public int removedSignInFailCount = 10;
/**
* 每隔1个小时,移除登录失败次数 >= 10(等待2^10 * waitTimeUnit毫秒)的用户对应的 map 元素
*/
@Scheduled(cron = "0 0 0/1 * * ?")
public void clearMap(){
Set<String> keys = redisTemplate.keys("signInFailCount_*");
for (String key : keys) {
if ((Integer)redisTemplate.opsForValue().get(key) > removedSignInFailCount) {
removeSignInFailInfo(key.substring(key.indexOf(CommonConstant.underline)+1));
}
}
}
/**
* 用户会话设置
*/
/**
* 判断用户是否存在
* @param username
*/
public boolean isUserExist(String username) {
return redisTemplate.opsForValue().get(CommonConstant.user + CommonConstant.underline + username) != null;
}
/**
* 设置用户
* @param sessionId
* @param username
*/
public void setUser(String sessionId, String username) {
if (!isUserExist(username)) {
redisTemplate.boundValueOps(CommonConstant.sessionId + CommonConstant.underline + sessionId).set(username, 1800, TimeUnit.SECONDS);
redisTemplate.boundValueOps(CommonConstant.user + CommonConstant.underline + username).set(sessionId, 1800, TimeUnit.SECONDS);
}
}
/**
* 移除用户
* @param username
*/
public void removeUser(String username) {
if (isUserExist(username)) {
redisTemplate.opsForValue().getOperations().delete(CommonConstant.sessionId + CommonConstant.underline + (String)redisTemplate.opsForValue().get(CommonConstant.user + CommonConstant.underline + username));
redisTemplate.opsForValue().getOperations().delete(CommonConstant.user + CommonConstant.underline + username);
}
}
/**
* 根据用户名取得 sessionId
* @param username
* @return
*/
public String getSessionIdByUser(String username) {
return (String)redisTemplate.opsForValue().get(CommonConstant.user + CommonConstant.underline + username);
}
} | [
"sunminjie2800@163.com"
] | sunminjie2800@163.com |
be5b99dd7a887b34ab979ae2d6f5a496e95a8c02 | 385e3414ccb7458bbd3cec326320f11819decc7b | /frameworks/base/services/core/java/com/android/server/statusbar/StatusBarManagerService.java | 9d2353c003460e0d1e072e6e9f04108e070766f5 | [
"LicenseRef-scancode-unicode",
"Apache-2.0"
] | permissive | carlos22211/Tango_AL813 | 14de7f2693c3045b9d3c0cb52017ba2bb6e6b28f | b50b1b7491dc9c5e6b92c2d94503635c43e93200 | refs/heads/master | 2020-03-28T08:09:11.127995 | 2017-06-26T05:05:29 | 2017-06-26T05:05:29 | 147,947,860 | 1 | 0 | null | 2018-09-08T15:55:46 | 2018-09-08T15:55:45 | null | UTF-8 | Java | false | false | 28,634 | java | /*
* Copyright (C) 2014 MediaTek Inc.
* Modification based on code covered by the mentioned copyright
* and/or permission notice(s).
*/
/*
* Copyright (C) 2007 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 com.android.server.statusbar;
import android.app.StatusBarManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.util.Slog;
import android.view.KeyEvent;
import com.android.internal.statusbar.IStatusBar;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.statusbar.StatusBarIconList;
import com.android.server.LocalServices;
import com.android.server.notification.NotificationDelegate;
import com.android.server.wm.WindowManagerService;
import com.mediatek.common.dm.DmAgent; /// M: DM Lock Feature.
import com.mediatek.xlog.Xlog;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
/**
* A note on locking: We rely on the fact that calls onto mBar are oneway or
* if they are local, that they just enqueue messages to not deadlock.
*/
public class StatusBarManagerService extends IStatusBarService.Stub {
private static final String TAG = "StatusBarManagerService";
private static final boolean SPEW = false;
private final Context mContext;
private final WindowManagerService mWindowManager;
private Handler mHandler = new Handler();
private NotificationDelegate mNotificationDelegate;
private volatile IStatusBar mBar;
private StatusBarIconList mIcons = new StatusBarIconList();
// for disabling the status bar
private final ArrayList<DisableRecord> mDisableRecords = new ArrayList<DisableRecord>();
private IBinder mSysUiVisToken = new Binder();
private int mDisabled = 0;
private Object mLock = new Object();
// encompasses lights-out mode and other flags defined on View
private int mSystemUiVisibility = 0;
private boolean mMenuVisible = false;
private int mImeWindowVis = 0;
private int mImeBackDisposition;
private boolean mShowImeSwitcher;
private IBinder mImeToken = null;
private int mCurrentUserId;
private class DisableRecord implements IBinder.DeathRecipient {
int userId;
String pkg;
int what;
IBinder token;
public void binderDied() {
Slog.i(TAG, "binder died for pkg=" + pkg);
disableInternal(userId, 0, token, pkg);
token.unlinkToDeath(this, 0);
}
}
/**
* Construct the service, add the status bar view to the window manager
*/
public StatusBarManagerService(Context context, WindowManagerService windowManager) {
mContext = context;
mWindowManager = windowManager;
final Resources res = context.getResources();
mIcons.defineSlots(res.getStringArray(com.android.internal.R.array.config_statusBarIcons));
LocalServices.addService(StatusBarManagerInternal.class, mInternalService);
/// M: DM Lock Feature.
registerDMLock();
}
/**
* Private API used by NotificationManagerService.
*/
private final StatusBarManagerInternal mInternalService = new StatusBarManagerInternal() {
private boolean mNotificationLightOn;
@Override
public void setNotificationDelegate(NotificationDelegate delegate) {
mNotificationDelegate = delegate;
}
@Override
public void buzzBeepBlinked() {
if (mBar != null) {
try {
mBar.buzzBeepBlinked();
} catch (RemoteException ex) {
}
}
}
@Override
public void notificationLightPulse(int argb, int onMillis, int offMillis) {
mNotificationLightOn = true;
if (mBar != null) {
try {
mBar.notificationLightPulse(argb, onMillis, offMillis);
} catch (RemoteException ex) {
}
}
}
@Override
public void notificationLightOff() {
if (mNotificationLightOn) {
mNotificationLightOn = false;
if (mBar != null) {
try {
mBar.notificationLightOff();
} catch (RemoteException ex) {
}
}
}
}
@Override
public void showScreenPinningRequest() {
if (mBar != null) {
try {
mBar.showScreenPinningRequest();
} catch (RemoteException e) {
}
}
}
};
// ================================================================================
// From IStatusBarService
// ================================================================================
@Override
public void expandNotificationsPanel() {
enforceExpandStatusBar();
if (mBar != null) {
try {
mBar.animateExpandNotificationsPanel();
} catch (RemoteException ex) {
}
}
}
@Override
public void collapsePanels() {
enforceExpandStatusBar();
if (mBar != null) {
try {
mBar.animateCollapsePanels();
} catch (RemoteException ex) {
}
}
}
@Override
public void expandSettingsPanel() {
enforceExpandStatusBar();
if (mBar != null) {
try {
mBar.animateExpandSettingsPanel();
} catch (RemoteException ex) {
}
}
}
@Override
public void disable(int what, IBinder token, String pkg) {
disableInternal(mCurrentUserId, what, token, pkg);
}
private void disableInternal(int userId, int what, IBinder token, String pkg) {
enforceStatusBar();
synchronized (mLock) {
disableLocked(userId, what, token, pkg);
}
}
private void disableLocked(int userId, int what, IBinder token, String pkg) {
// It's important that the the callback and the call to mBar get done
// in the same order when multiple threads are calling this function
// so they are paired correctly. The messages on the handler will be
// handled in the order they were enqueued, but will be outside the lock.
manageDisableListLocked(userId, what, token, pkg);
// Ensure state for the current user is applied, even if passed a non-current user.
final int net = gatherDisableActionsLocked(mCurrentUserId);
if (net != mDisabled) {
mDisabled = net;
mHandler.post(new Runnable() {
public void run() {
mNotificationDelegate.onSetDisabled(net);
}
});
if (mBar != null) {
try {
/// M:[ALPS01673960] Fix User cannot drag down the notification bar.
Slog.d(TAG, "disable statusbar calling PID = " + Binder.getCallingPid());
mBar.disable(net);
} catch (RemoteException ex) {
}
}
}
}
@Override
public void setIcon(String slot, String iconPackage, int iconId, int iconLevel,
String contentDescription) {
enforceStatusBar();
synchronized (mIcons) {
int index = mIcons.getSlotIndex(slot);
if (index < 0) {
throw new SecurityException("invalid status bar icon slot: " + slot);
}
StatusBarIcon icon = new StatusBarIcon(iconPackage, UserHandle.OWNER, iconId,
iconLevel, 0,
contentDescription);
//Slog.d(TAG, "setIcon slot=" + slot + " index=" + index + " icon=" + icon);
mIcons.setIcon(index, icon);
if (mBar != null) {
try {
mBar.setIcon(index, icon);
} catch (RemoteException ex) {
}
}
}
}
@Override
public void setIconVisibility(String slot, boolean visible) {
enforceStatusBar();
synchronized (mIcons) {
int index = mIcons.getSlotIndex(slot);
if (index < 0) {
throw new SecurityException("invalid status bar icon slot: " + slot);
}
StatusBarIcon icon = mIcons.getIcon(index);
if (icon == null) {
return;
}
if (icon.visible != visible) {
icon.visible = visible;
if (mBar != null) {
try {
mBar.setIcon(index, icon);
} catch (RemoteException ex) {
}
}
}
}
}
@Override
public void removeIcon(String slot) {
enforceStatusBar();
synchronized (mIcons) {
int index = mIcons.getSlotIndex(slot);
if (index < 0) {
throw new SecurityException("invalid status bar icon slot: " + slot);
}
mIcons.removeIcon(index);
if (mBar != null) {
try {
mBar.removeIcon(index);
} catch (RemoteException ex) {
}
}
}
}
/**
* Hide or show the on-screen Menu key. Only call this from the window manager, typically in
* response to a window with {@link android.view.WindowManager.LayoutParams#needsMenuKey} set
* to {@link android.view.WindowManager.LayoutParams#NEEDS_MENU_SET_TRUE}.
*/
@Override
public void topAppWindowChanged(final boolean menuVisible) {
enforceStatusBar();
if (SPEW) Slog.d(TAG, (menuVisible?"showing":"hiding") + " MENU key");
synchronized(mLock) {
mMenuVisible = menuVisible;
mHandler.post(new Runnable() {
public void run() {
if (mBar != null) {
try {
mBar.topAppWindowChanged(menuVisible);
} catch (RemoteException ex) {
}
}
}
});
}
}
@Override
public void setImeWindowStatus(final IBinder token, final int vis, final int backDisposition,
final boolean showImeSwitcher) {
enforceStatusBar();
if (SPEW) {
Slog.d(TAG, "swetImeWindowStatus vis=" + vis + " backDisposition=" + backDisposition);
}
synchronized(mLock) {
// In case of IME change, we need to call up setImeWindowStatus() regardless of
// mImeWindowVis because mImeWindowVis may not have been set to false when the
// previous IME was destroyed.
mImeWindowVis = vis;
mImeBackDisposition = backDisposition;
mImeToken = token;
mShowImeSwitcher = showImeSwitcher;
mHandler.post(new Runnable() {
public void run() {
if (mBar != null) {
try {
mBar.setImeWindowStatus(token, vis, backDisposition, showImeSwitcher);
} catch (RemoteException ex) {
}
}
}
});
}
}
@Override
public void setSystemUiVisibility(int vis, int mask, String cause) {
// also allows calls from window manager which is in this process.
enforceStatusBarService();
if (SPEW) Slog.d(TAG, "setSystemUiVisibility(0x" + Integer.toHexString(vis) + ")");
synchronized (mLock) {
updateUiVisibilityLocked(vis, mask);
disableLocked(
mCurrentUserId,
vis & StatusBarManager.DISABLE_MASK,
mSysUiVisToken,
cause);
}
}
private void updateUiVisibilityLocked(final int vis, final int mask) {
if (mSystemUiVisibility != vis) {
mSystemUiVisibility = vis;
mHandler.post(new Runnable() {
public void run() {
if (mBar != null) {
try {
mBar.setSystemUiVisibility(vis, mask);
} catch (RemoteException ex) {
}
}
}
});
}
}
@Override
public void toggleRecentApps() {
if (mBar != null) {
try {
mBar.toggleRecentApps();
} catch (RemoteException ex) {}
}
}
@Override
public void preloadRecentApps() {
if (mBar != null) {
try {
mBar.preloadRecentApps();
} catch (RemoteException ex) {}
}
}
@Override
public void cancelPreloadRecentApps() {
if (mBar != null) {
try {
mBar.cancelPreloadRecentApps();
} catch (RemoteException ex) {}
}
}
@Override
public void showRecentApps(boolean triggeredFromAltTab) {
if (mBar != null) {
try {
mBar.showRecentApps(triggeredFromAltTab);
} catch (RemoteException ex) {}
}
}
@Override
public void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
if (mBar != null) {
try {
mBar.hideRecentApps(triggeredFromAltTab, triggeredFromHomeKey);
} catch (RemoteException ex) {}
}
}
@Override
public void setCurrentUser(int newUserId) {
if (SPEW) Slog.d(TAG, "Setting current user to user " + newUserId);
mCurrentUserId = newUserId;
}
@Override
public void setWindowState(int window, int state) {
if (mBar != null) {
try {
mBar.setWindowState(window, state);
} catch (RemoteException ex) {}
}
}
private void enforceStatusBar() {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR,
"StatusBarManagerService");
}
private void enforceExpandStatusBar() {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.EXPAND_STATUS_BAR,
"StatusBarManagerService");
}
private void enforceStatusBarService() {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR_SERVICE,
"StatusBarManagerService");
}
// ================================================================================
// Callbacks from the status bar service.
// ================================================================================
@Override
public void registerStatusBar(IStatusBar bar, StatusBarIconList iconList,
int switches[], List<IBinder> binders) {
enforceStatusBarService();
Slog.i(TAG, "registerStatusBar bar=" + bar);
mBar = bar;
synchronized (mIcons) {
iconList.copyFrom(mIcons);
}
synchronized (mLock) {
switches[0] = gatherDisableActionsLocked(mCurrentUserId);
switches[1] = mSystemUiVisibility;
switches[2] = mMenuVisible ? 1 : 0;
switches[3] = mImeWindowVis;
switches[4] = mImeBackDisposition;
switches[5] = mShowImeSwitcher ? 1 : 0;
binders.add(mImeToken);
}
}
/**
* @param clearNotificationEffects whether to consider notifications as "shown" and stop
* LED, vibration, and ringing
*/
@Override
public void onPanelRevealed(boolean clearNotificationEffects) {
enforceStatusBarService();
long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onPanelRevealed(clearNotificationEffects);
} finally {
Binder.restoreCallingIdentity(identity);
}
}
@Override
public void clearNotificationEffects() throws RemoteException {
enforceStatusBarService();
long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.clearEffects();
} finally {
Binder.restoreCallingIdentity(identity);
}
}
@Override
public void onPanelHidden() throws RemoteException {
enforceStatusBarService();
long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onPanelHidden();
} finally {
Binder.restoreCallingIdentity(identity);
}
}
@Override
public void onNotificationClick(String key) {
enforceStatusBarService();
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationClick(callingUid, callingPid, key);
} finally {
Binder.restoreCallingIdentity(identity);
}
}
@Override
public void onNotificationActionClick(String key, int actionIndex) {
enforceStatusBarService();
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationActionClick(callingUid, callingPid, key,
actionIndex);
} finally {
Binder.restoreCallingIdentity(identity);
}
}
@Override
public void onNotificationError(String pkg, String tag, int id,
int uid, int initialPid, String message, int userId) {
enforceStatusBarService();
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
long identity = Binder.clearCallingIdentity();
try {
// WARNING: this will call back into us to do the remove. Don't hold any locks.
mNotificationDelegate.onNotificationError(callingUid, callingPid,
pkg, tag, id, uid, initialPid, message, userId);
} finally {
Binder.restoreCallingIdentity(identity);
}
}
@Override
public void onNotificationClear(String pkg, String tag, int id, int userId) {
enforceStatusBarService();
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationClear(callingUid, callingPid, pkg, tag, id, userId);
} finally {
Binder.restoreCallingIdentity(identity);
}
}
@Override
public void onNotificationVisibilityChanged(
String[] newlyVisibleKeys, String[] noLongerVisibleKeys) throws RemoteException {
enforceStatusBarService();
long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationVisibilityChanged(
newlyVisibleKeys, noLongerVisibleKeys);
} finally {
Binder.restoreCallingIdentity(identity);
}
}
@Override
public void onNotificationExpansionChanged(String key, boolean userAction,
boolean expanded) throws RemoteException {
enforceStatusBarService();
long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationExpansionChanged(
key, userAction, expanded);
} finally {
Binder.restoreCallingIdentity(identity);
}
}
@Override
public void onClearAllNotifications(int userId) {
enforceStatusBarService();
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onClearAll(callingUid, callingPid, userId);
} finally {
Binder.restoreCallingIdentity(identity);
}
}
// ================================================================================
// Can be called from any thread
// ================================================================================
// lock on mDisableRecords
void manageDisableListLocked(int userId, int what, IBinder token, String pkg) {
if (SPEW) {
Slog.d(TAG, "manageDisableList userId=" + userId
+ " what=0x" + Integer.toHexString(what) + " pkg=" + pkg);
}
// update the list
final int N = mDisableRecords.size();
DisableRecord tok = null;
int i;
for (i=0; i<N; i++) {
DisableRecord t = mDisableRecords.get(i);
if (t.token == token && t.userId == userId) {
tok = t;
break;
}
}
if (what == 0 || !token.isBinderAlive()) {
if (tok != null) {
mDisableRecords.remove(i);
tok.token.unlinkToDeath(tok, 0);
}
} else {
if (tok == null) {
tok = new DisableRecord();
tok.userId = userId;
try {
token.linkToDeath(tok, 0);
}
catch (RemoteException ex) {
return; // give up
}
mDisableRecords.add(tok);
}
tok.what = what;
tok.token = token;
tok.pkg = pkg;
}
}
// lock on mDisableRecords
int gatherDisableActionsLocked(int userId) {
final int N = mDisableRecords.size();
// gather the new net flags
int net = 0;
for (int i=0; i<N; i++) {
final DisableRecord rec = mDisableRecords.get(i);
if (rec.userId == userId) {
net |= rec.what;
}
}
return net;
}
// ================================================================================
// Always called from UI thread
// ================================================================================
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
!= PackageManager.PERMISSION_GRANTED) {
pw.println("Permission Denial: can't dump StatusBar from from pid="
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid());
return;
}
synchronized (mIcons) {
mIcons.dump(pw);
}
synchronized (mLock) {
pw.println(" mDisabled=0x" + Integer.toHexString(mDisabled));
final int N = mDisableRecords.size();
pw.println(" mDisableRecords.size=" + N);
for (int i=0; i<N; i++) {
DisableRecord tok = mDisableRecords.get(i);
pw.println(" [" + i + "] userId=" + tok.userId
+ " what=0x" + Integer.toHexString(tok.what)
+ " pkg=" + tok.pkg
+ " token=" + tok.token);
}
}
}
/** M: Support "SystemUI SIM indicator" feature. @{ */
/**
* @param businessType the type of the default SIM setting. ex. VOICE_CALL
* @param indicatorID the ID of SIM Indicator
*/
public void showSimIndicator(String businessType, long indicatorID) {
/* HQ_xionghaifeng 20150724 for HWSystemUI crash start
if (mBar != null) {
try {
Xlog.d(TAG, "showSimIndicator , businiss is " + businessType +
", indicatorID is " + indicatorID + ".");
mBar.showSimIndicator(businessType, indicatorID);
} catch (RemoteException ex) {
/// M: The exception from system server will throw exception there
Slog.e(TAG, "unable to showSimIndicator: " + businessType + " Exception:", ex);
}
}
HQ_xionghaifeng 20150724 for HWSystemUI crash end */
}
public void hideSimIndicator() {
/* HQ_xionghaifeng 20150724 for HWSystemUI crash start
if (mBar != null) {
try {
mBar.hideSimIndicator();
} catch (RemoteException ex) {
/// M: The exception from system server will throw exception there
Slog.e(TAG, "unable to hideSimIndicator: Exception:", ex);
}
}
HQ_xionghaifeng 20150724 for HWSystemUI crash end */
}
/** }@ */
/// M: [SystemUI] Support Smartbook Feature. @{
public void dispatchStatusBarKeyEvent(KeyEvent event) {
if (mBar != null) {
try {
mBar.dispatchStatusBarKeyEvent(event);
} catch (RemoteException ex) {
/// M: The exception from system server will throw exception there
Slog.e(TAG, "unable to dispatchStatusBarKeyEvent: " + event + " Exception:", ex);
}
}
}
/** }@ */
/// M: DM Lock Feature.
IBinder mDMToken = new Binder();
void registerDMLock() {
try {
IBinder binder = ServiceManager.getService("DmAgent");
if (binder != null) {
DmAgent agent = DmAgent.Stub.asInterface(binder);
boolean locked = agent.isLockFlagSet();
Xlog.i(TAG, "dm state lock is " + locked);
dmEnable(!locked);
} else {
Xlog.e(TAG, "dm binder is null!");
}
} catch (RemoteException e) {
Xlog.e(TAG, "remote error");
}
Xlog.i(TAG, "registerDMLock");
IntentFilter filter = new IntentFilter();
filter.addAction("com.mediatek.ppl.NOTIFY_LOCK");
filter.addAction("com.mediatek.ppl.NOTIFY_UNLOCK");
filter.addAction("com.mediatek.dm.LAWMO_LOCK");
filter.addAction("com.mediatek.dm.LAWMO_UNLOCK");
mContext.registerReceiver(mReceiver, filter);
}
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals("com.mediatek.ppl.NOTIFY_LOCK") ||
action.equals("com.mediatek.dm.LAWMO_LOCK")) {
dmEnable(false);
} else if (action.equals("com.mediatek.ppl.NOTIFY_UNLOCK") ||
action.equals("com.mediatek.dm.LAWMO_UNLOCK")) {
dmEnable(true);
}
}
};
private int dmEnable(boolean enable) {
Xlog.i(TAG, " enable state is " + enable);
int net = 0;
if (!enable) {
net = StatusBarManager.DISABLE_EXPAND | StatusBarManager.DISABLE_NOTIFICATION_ALERTS
| StatusBarManager.DISABLE_NOTIFICATION_ICONS
| StatusBarManager.DISABLE_NOTIFICATION_TICKER;
}
disable(net, mDMToken, mContext.getPackageName());
return 0;
}
/*< DTS2014110604349 zhaifeng/00107904 20141106 begin */
public IStatusBar getStatusBar() {
return mBar;
}
/* DTS2014110604349 zhaifeng/00107904 20141106 end >*/
}
| [
"zhangjinqiang@huaqin.com"
] | zhangjinqiang@huaqin.com |
750c8a21d90547cb6fbfe4efdee47ab36d8bebb5 | 743592757b5229f2dc1386d38146d323e46da967 | /02 Java/Ex04/ConstructorDemo.java | 2e54842c9966c3c90dd33b59248297eda79b9ddf | [] | no_license | Sherlock20200304/fullstackdeveloper | 74db1abbc9f5abecc53513349c711adc867fda9f | 9cc949137a287719744ca106f568924a714d7ec3 | refs/heads/master | 2023-04-13T16:14:35.503222 | 2021-04-20T15:01:35 | 2021-04-20T15:01:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 443 | java | class ConstructorDemo
{
public ConstructorDemo()
{
System.out.println("Inside ConstructorDemo Constructor ");
}
public ConstructorDemo(String name)
{
System.out.println("Inside ConstructorDemo Constructor Name: "+ name);
}
public static void main(String[] args) {
ConstructorDemo obj = new ConstructorDemo();
ConstructorDemo obj1 = new ConstructorDemo("Zack");
System.out.println("Inside ConstructorDemo Main Method");
}
} | [
"zackria@gmail.com"
] | zackria@gmail.com |
cea2eee87153d1279a6eb8dff255aa2e5afe163a | 7f20b1bddf9f48108a43a9922433b141fac66a6d | /coreplugins/tags/Cyto-2.5.0-beta3/RFilters/src/RFilters/cytoscape/CsFilter.java | 46140b867c49a41eeb650331ccbaa777b4bfac05 | [] | no_license | ahdahddl/cytoscape | bf783d44cddda313a5b3563ea746b07f38173022 | a3df8f63dba4ec49942027c91ecac6efa920c195 | refs/heads/master | 2020-06-26T16:48:19.791722 | 2013-08-28T04:08:31 | 2013-08-28T04:08:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,613 | java |
/*
Copyright (c) 2006, 2007, The Cytoscape Consortium (www.cytoscape.org)
The Cytoscape Consortium is:
- Institute for Systems Biology
- University of California San Diego
- Memorial Sloan-Kettering Cancer Center
- Institut Pasteur
- Agilent Technologies
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
documentation provided hereunder is on an "as is" basis, and the
Institute for Systems Biology and the Whitehead Institute
have no obligations to provide maintenance, support,
updates, enhancements or modifications. In no event shall the
Institute for Systems Biology and the Whitehead Institute
be liable to any party for direct, indirect, special,
incidental or consequential damages, including lost profits, arising
out of the use of this software and its documentation, even if the
Institute for Systems Biology and the Whitehead Institute
have been advised of the possibility of such damage. See
the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
package filter.cytoscape;
import cytoscape.*;
import cytoscape.data.*;
import cytoscape.plugin.*;
import cytoscape.util.*;
import cytoscape.view.*;
import filter.model.*;
import filter.view.*;
import java.awt.event.*;
import java.beans.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
/**
*
*/
public class CsFilter extends CytoscapePlugin implements PropertyChangeListener {
protected JFrame frame;
protected FilterUsePanel filterUsePanel;
/**
* Creates a new CsFilter object.
*/
public CsFilter() {
initialize();
}
/**
* DOCUMENT ME!
*
* @param e DOCUMENT ME!
*/
public void propertyChange(PropertyChangeEvent e) {
if (e.getPropertyName() == Cytoscape.CYTOSCAPE_EXIT) {
Iterator i = FilterManager.defaultManager().getFilters();
// StringBuffer buffer = new StringBuffer();
try {
File filter_file = CytoscapeInit.getConfigFile("filter.props");
BufferedWriter writer = new BufferedWriter(new FileWriter(filter_file));
while (i.hasNext()) {
try {
Filter f = (Filter) i.next();
writer.write(FilterManager.defaultManager().getFilterID(f) + "\t"
+ f.getClass() + "\t" + f.output());
writer.newLine();
} catch (Exception ex) {
System.out.println("Error with Filter output");
}
}
writer.close();
} catch (Exception ex) {
System.out.println("Filter Write error");
ex.printStackTrace();
}
}
}
/**
* DOCUMENT ME!
*/
public void initialize() {
Cytoscape.getSwingPropertyChangeSupport().addPropertyChangeListener(this);
try {
File filter_file = CytoscapeInit.getConfigFile("filter.props");
BufferedReader in = new BufferedReader(new FileReader(filter_file));
String oneLine = in.readLine();
while (oneLine != null) {
if (oneLine.startsWith("#")) {
// comment
} else {
FilterManager.defaultManager().createFilterFromString(oneLine);
}
oneLine = in.readLine();
}
in.close();
} catch (Exception ex) {
System.out.println("Filter Read error");
ex.printStackTrace();
}
// create icons
ImageIcon icon = new ImageIcon(getClass().getResource("/stock_filter-data-by-criteria.png"));
ImageIcon icon2 = new ImageIcon(getClass()
.getResource("/stock_filter-data-by-criteria-16.png"));
//
//FilterPlugin action = new FilterPlugin(icon, this);
FilterMenuItem menu_action = new FilterMenuItem(icon2, this);
//Cytoscape.getDesktop().getCyMenus().addCytoscapeAction( ( CytoscapeAction )action );
Cytoscape.getDesktop().getCyMenus().addCytoscapeAction((CytoscapeAction) menu_action);
//CytoscapeDesktop desktop = Cytoscape.getDesktop();
//CyMenus cyMenus = desktop.getCyMenus();
//CytoscapeToolBar toolBar = cyMenus.getToolBar();
//JButton button = new JButton(icon);
//button.addActionListener(action);
//button.setToolTipText("Create and apply filters");
//button.setBorderPainted(false);
//toolBar.add(button);
FilterEditorManager.defaultManager().addEditor(new NumericAttributeFilterEditor());
FilterEditorManager.defaultManager().addEditor(new StringPatternFilterEditor());
FilterEditorManager.defaultManager().addEditor(new NodeTopologyFilterEditor());
FilterEditorManager.defaultManager().addEditor(new BooleanMetaFilterEditor());
FilterEditorManager.defaultManager().addEditor(new NodeInteractionFilterEditor());
FilterEditorManager.defaultManager().addEditor(new EdgeInteractionFilterEditor());
}
/**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
public FilterUsePanel getFilterUsePanel() {
if (filterUsePanel == null) {
filterUsePanel = new FilterUsePanel(frame);
}
return filterUsePanel;
}
/**
* DOCUMENT ME!
*/
public void show() {
if (frame == null) {
frame = new JFrame("Use Filters");
frame.getContentPane().add(getFilterUsePanel());
frame.pack();
//Cytoscape.getDesktop().getCytoPanel( SwingConstants.SOUTH ).add(getFilterUsePanel());
}
frame.setVisible(true);
}
}
| [
"mes@0ecc0d97-ab19-0410-9704-bfe1a75892f5"
] | mes@0ecc0d97-ab19-0410-9704-bfe1a75892f5 |
5dad0eb91c31699ff5a10738de5a3daa4d5658bd | 1f30af7bf56cda8a0f2ac66b03874ce2566cd9ff | /languages/BSML/source_gen/BSML/behavior/RegionLocalDeclaration_Behavior.java | 605fb8974654c2baa5d5886a0998b22aa2785655 | [] | no_license | z9luo/BSML-mbeddr-MPS3.2 | 26cd19f0d524d0932bd9ecc7086e54b89800cf50 | 466cbf0d92c8c5d45b19062a6ba069eab333a48a | refs/heads/master | 2020-07-05T17:58:39.262828 | 2016-10-24T07:33:10 | 2016-10-24T07:33:10 | 67,258,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 203 | java | package BSML.behavior;
/*Generated by MPS */
/**
* Will be removed after 3.3
* Need to support the legacy static direct method calls
*/
@Deprecated
public class RegionLocalDeclaration_Behavior {
}
| [
"zhaoluo@microsoft.com"
] | zhaoluo@microsoft.com |
ea4802fe554a9b1b30320998559606129cd3d627 | db2cd2a4803e546d35d5df2a75b7deb09ffadc01 | /nemo-tfl-batch/src/main/java/com/novacroft/nemo/tfl/batch/action/impl/cubic/ReconcileAutoLoadChangeActionImpl.java | 7200f586a42383934cd2b9494b174ee24b631945 | [] | no_license | balamurugan678/nemo | 66d0d6f7062e340ca8c559346e163565c2628814 | 1319daafa5dc25409ae1a1872b1ba9b14e5a297e | refs/heads/master | 2021-01-19T17:47:22.002884 | 2015-06-18T12:03:43 | 2015-06-18T12:03:43 | 37,656,983 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,281 | java | package com.novacroft.nemo.tfl.batch.action.impl.cubic;
import com.novacroft.nemo.tfl.batch.action.cubic.ImportRecordAction;
import com.novacroft.nemo.tfl.batch.domain.ImportRecord;
import com.novacroft.nemo.tfl.batch.domain.cubic.AutoLoadChangeRecord;
import com.novacroft.nemo.tfl.common.application_service.ReconcileAutoLoadChangeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Action to reconcile all auto load change records from CUBIC
*/
@Component("reconcileAutoLoadChangeAction")
public class ReconcileAutoLoadChangeActionImpl implements ImportRecordAction {
@Autowired
protected ReconcileAutoLoadChangeService reconcileAutoLoadChangeService;
@Override
public void handle(ImportRecord record) {
AutoLoadChangeRecord autoLoadChangeRecord = (AutoLoadChangeRecord) record;
this.reconcileAutoLoadChangeService
.reconcileChange(autoLoadChangeRecord.getRequestSequenceNumber(), autoLoadChangeRecord.getPrestigeId(),
autoLoadChangeRecord.getNewAutoLoadConfiguration(), autoLoadChangeRecord.getStatusOfAttemptedAction(),
autoLoadChangeRecord.getFailureReasonCode());
}
}
| [
"balamurugan678@yahoo.co.in"
] | balamurugan678@yahoo.co.in |
0e501ef676018bc12430b362a8e32e8d29b03a81 | 8d82c3a4fd44c82523f6dc2191d694bd6a3de4e5 | /src/main/java/com/poc/patientportal/web/rest/errors/FieldErrorVM.java | 21dc19cd2bc06aa51a1e4958f2dcc6d9bcffabe5 | [] | no_license | maurofokker/patient-portal | a20a76fd3da6dca34f85df5eba20242e841a0f68 | 3ede18d735aafa2ebb73909f236e2372b477e81a | refs/heads/master | 2020-03-23T08:37:58.254976 | 2018-07-17T22:18:06 | 2018-07-17T22:18:06 | 141,337,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 653 | java | package com.poc.patientportal.web.rest.errors;
import java.io.Serializable;
public class FieldErrorVM implements Serializable {
private static final long serialVersionUID = 1L;
private final String objectName;
private final String field;
private final String message;
public FieldErrorVM(String dto, String field, String message) {
this.objectName = dto;
this.field = field;
this.message = message;
}
public String getObjectName() {
return objectName;
}
public String getField() {
return field;
}
public String getMessage() {
return message;
}
}
| [
"mgaldamesc.azurian@bancochile.cl"
] | mgaldamesc.azurian@bancochile.cl |
0bbbbf7b3e59f3a76a96189321fc074edebbb232 | 6cf6e5c9c63a621fdfb4794c8ae0831ec725970f | /tulingmall-getway-demo/src/main/java/com/tuling/exception/GateWayExceptionHandlerAdvice.java | 8f3a7f13bc580c3d572125b41beba87dd3921824 | [] | no_license | LCcFw/tuling-mall | 469ebc188a2ea581bb67ce79007bf126330757e7 | 77987691111bdf93d71c26023450c7d1cf9414be | refs/heads/master | 2023-04-17T04:55:16.274800 | 2021-04-26T15:46:32 | 2021-04-26T15:46:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,077 | java | package com.tuling.exception;
import com.tuling.tulingmall.common.api.CommonResult;
import com.tuling.tulingmall.common.exception.GateWayException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
@Slf4j
@Component
public class GateWayExceptionHandlerAdvice {
@ExceptionHandler(value = {GateWayException.class})
public CommonResult handle(GateWayException ex) {
log.error("网关异常code:{},msg:{}", ex.getCode(),ex.getMessage());
return CommonResult.failed(ex.getCode(),ex.getMessage());
}
@ExceptionHandler(value = {Throwable.class})
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public CommonResult handle(Throwable throwable) {
if(throwable instanceof GateWayException) {
return handle((GateWayException) throwable);
}else {
return CommonResult.failed();
}
}
}
| [
"wjdcrw@mail.com"
] | wjdcrw@mail.com |
9701c6a90fd4ab8ee32f62ad794932770a7be8f2 | 741d24ba3f1cb9687add839face5511da9bb3256 | /AndroidFree/src/test/java/com/chewielouie/textadventure/LocationExitFactoryTests.java | 576c84effdee7c454413f211939a5eb06bdf43f8 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | SergeyPtica/text-adventure | efd605197dc8424fd3595700df535bf60002dc1b | 2da3f2d289a7d6e62bde353d69628111769f2e59 | refs/heads/master | 2020-04-07T20:21:12.061355 | 2014-11-14T20:04:44 | 2014-11-14T20:04:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 317 | java | package com.chewielouie.textadventure;
import static org.junit.Assert.*;
import org.junit.Test;
public class LocationExitFactoryTests {
@Test
public void produces_LocationExit_objects() {
Exit exit = new LocationExitFactory().create();
assertTrue( exit instanceof LocationExit );
}
}
| [
"chewielouie03@gmail.com"
] | chewielouie03@gmail.com |
261c8fbbd5443ad1d8cec8225d1fdcfe9d4acf96 | 27fdfa63b4d062058440a95ec29a334033fd2f77 | /app/src/test/java/com/kk/solution/dev/chatfirebase/ExampleUnitTest.java | 45d907c7d75484035a699fbfa81dec342a0312fc | [] | no_license | UncagedMist/ChatFireBase | 6dc4c595cba208772f7a75431f0e1427983a8e27 | fea4c67f46b1ca5b93ec038c79caeb45bd2888bf | refs/heads/master | 2021-09-15T04:22:30.358792 | 2018-05-25T19:24:05 | 2018-05-25T19:24:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 410 | java | package com.kk.solution.dev.chatfirebase;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"Kundan_kk52@outlook.com"
] | Kundan_kk52@outlook.com |
d1939dd4da54980729de43e7635697218ee71003 | a4f86ab8dd9a6e73024b6647622eb47562b016da | /src/com/review/AbstractAppDemo.java | 565861879085c16eaee6d8542e451b23c486db96 | [] | no_license | zjs1224522500/JavaSE | 819f637e9b5df3e3f33e7d12c45f712c3826d075 | e4b38541a55dd0dba59a7d3b5d2c04663c8dad97 | refs/heads/master | 2021-01-21T18:21:10.099571 | 2017-05-30T07:14:28 | 2017-05-30T07:14:28 | 92,033,914 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,081 | java | /**
* <p>Project: 网络管理委员会招新网站, NetUnion Recruit WebSite </p>
* <p>File: AbstractAppDemo.java</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2017</p>
* @author 张健顺
* @email: 1224522500@qq.com
* @date 2017年5月14日
*/
package com.review;
import java.util.Random;
/**
* 抽象类的应用
*/
public class AbstractAppDemo {
public static void main(String[] args) {
Palace palace = new Shemale("Lucy");
System.out.println("start !!!");
palace.action();
}
}
abstract class Palace{
public void action(){
if(competition()){
System.out.println("success!!!");
}else{
System.out.println("failure");
}
}
//比赛方法
public abstract boolean competition();//抽象方法
}
class Shemale extends Palace{
private String name;
public Shemale(String name){
this.name = name;
}
@Override
public boolean competition() {
System.out.println("I am "+name);
System.out.println("Competition starts!!!");
Random random = new Random();
//随机产生 boolean 值
return random.nextBoolean();
}
}
| [
"1224522500@qq.com"
] | 1224522500@qq.com |
20517b657455380925e0e5dc5255b1df20b8e970 | 39ab9de5107dc1df998156a8aa4dcdea66730f33 | /ucv-android-master/ucv-android-master/app/src/main/java/com/creatio/imm/Adapters/ADBusiness.java | d061b1c1f94d4cce17f1cc5368b0b5bfeae7cef3 | [] | no_license | JuanPenaloza1987/Unidas_Con_Valor | b4bbd6cc6868088c82afc6640171e92542f1ba12 | e9fb41a86c7f659b0fafcaf08b369c3a8476a05b | refs/heads/master | 2021-02-16T17:12:27.851576 | 2020-03-05T00:03:31 | 2020-03-05T00:03:31 | 245,027,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,842 | java | package com.creatio.imm.Adapters;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.CardView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.Priority;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.creatio.imm.ItemsBusiness;
import com.creatio.imm.Objects.OBusiness;
import com.creatio.imm.R;
import java.util.ArrayList;
/**
* Created by gerardo on 18/06/18.
*/
public class ADBusiness extends BaseAdapter {
private Context context;
private ArrayList<OBusiness> data = new ArrayList<>();
public ADBusiness(Context context, ArrayList<OBusiness> data) {
this.context = context;
this.data = data;
}
@Override
public int getCount() {
return data.size();
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View item = inflater.inflate(R.layout.item_business, parent, false);
ImageView img = item.findViewById(R.id.img);
TextView txtName = item.findViewById(R.id.txtName);
TextView txtCan = item.findViewById(R.id.txtCan);
TextView txtDescription = item.findViewById(R.id.txtDesc);
Button btnCupons = item.findViewById(R.id.btnCupons);
CardView cv = item.findViewById(R.id.cv);
if (data.get(position).getCan_reserve().equalsIgnoreCase("0")){
txtCan.setVisibility(View.INVISIBLE);
}else{
txtCan.setVisibility(View.INVISIBLE);
}
cv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, ItemsBusiness.class);
intent.putExtra("ID_business", data.get(position).getID());
intent.putExtra("image", data.get(position).getImage());
intent.putExtra("name", data.get(position).getName());
intent.putExtra("can_reserve", data.get(position).getCan_reserve());
context.startActivity(intent);
}
});
txtName.setText(data.get(position).getName());
txtDescription.setText(data.get(position).getDescription());
RequestOptions options = new RequestOptions()
.placeholder(R.drawable.no_image)
.error(R.drawable.no_image)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.centerCrop()
.override(1000, 1000)
.priority(Priority.HIGH);
Glide.with(context)
.load(data.get(position).getImage())
.apply(options)
.into(img);
btnCupons.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, ItemsBusiness.class);
intent.putExtra("ID_business", data.get(position).getID());
intent.putExtra("image", data.get(position).getImage());
intent.putExtra("name", data.get(position).getName());
intent.putExtra("can_reserve", data.get(position).getCan_reserve());
context.startActivity(intent);
}
});
return item;
}
}
| [
"juan.penaloza1987@gmail.com"
] | juan.penaloza1987@gmail.com |
35971a43b9d2408600701d5db03a04e066dcaeac | a662a01c51e2514ecfc96c5b01c201b246646417 | /src/main/java/vavi/util/archive/rar/JunrarRarEntry.java | 5f66fd056ba7d0f1acf83473f00a71479a81b5a5 | [] | no_license | umjammer/vavi-util-archive | d19d81a7e9bae6f438212cf73893458fc9ff6121 | fec692501830809d215b088c378c79f6d20b3bec | refs/heads/master | 2022-10-30T04:10:05.365947 | 2022-10-24T04:14:19 | 2022-10-24T04:14:19 | 33,908,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,083 | java | /*
* Copyright (c) 2022 by Naohide Sano, All rights reserved.
*
* Programmed by Naohide Sano
*/
package vavi.util.archive.rar;
import com.github.junrar.rarfile.FileHeader;
import vavi.util.archive.WrappedEntry;
/**
* Represents RAR archived file.
* warring the library 'com.github.junrar:junrar'
*
* @author <a href="mailto:umjammer@gmail.com">Naohide Sano</a> (nsano)
* @version 0.00 220922 nsano initial version <br>
*/
public class JunrarRarEntry implements WrappedEntry<FileHeader> {
/** */
private FileHeader entry;
/** */
public JunrarRarEntry(FileHeader header) {
this.entry = header;
}
@Override
public String getComment() {
return null;
}
@Override
public long getCompressedSize() {
return entry.getFullPackSize();
}
@Override
public long getCrc() {
return entry.getFileCRC();
}
@Override
public Object getExtra() {
return null;
}
@Override
public int getMethod() {
return 0;
}
@Override
public String getName() {
return entry.getFileName();
}
@Override
public long getSize() {
return entry.getDataSize();
}
@Override
public long getTime() {
return entry.getMTime().getTime();
}
@Override
public boolean isDirectory() {
return entry.isDirectory();
}
@Override
public void setComment(String comment) {
// TODO
}
@Override
public void setCompressedSize(long csize) {
}
@Override
public void setCrc(long crc) {
}
@Override
public void setExtra(Object extra) {
// TODO
}
@Override
public void setMethod(int method) {
// TODO
}
@Override
public void setSize(long size) {
}
@Override
public void setTime(long time) {
// TODO
}
@Override
public Object clone() {
throw new UnsupportedOperationException();
}
@Override
public FileHeader getWrappedObject() {
return entry;
}
}
/* */
| [
"namachapanda2005@gmail.com"
] | namachapanda2005@gmail.com |
f3aa7124265078f4f8bfbd87bc48a6a5e1a3a25b | bb0d45a5d60aad37f528227a70e8912d0a39b924 | /src/main/java/net/caseif/flint/steel/lobby/type/SteelStatusLobbySign.java | 8f39cb052a1c5b7da909f0b6270f57cfec30388e | [
"MIT"
] | permissive | caseif/Steel | e56a18a1ae04c48ee40c868986b5403c13b1ad41 | d2608e62d3a3742c4ea4bae3af735e6e56469942 | refs/heads/master | 2022-04-30T13:47:24.708824 | 2019-04-23T21:55:18 | 2019-04-23T21:55:18 | 34,961,217 | 7 | 8 | null | 2016-04-07T13:55:11 | 2015-05-02T19:49:55 | Java | UTF-8 | Java | false | false | 1,678 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2015-2016, Max Roncace <me@caseif.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package net.caseif.flint.steel.lobby.type;
import net.caseif.flint.common.arena.CommonArena;
import net.caseif.flint.lobby.type.StatusLobbySign;
import net.caseif.flint.steel.lobby.SteelLobbySign;
import net.caseif.flint.util.physical.Location3D;
/**
* Implements {@link StatusLobbySign}.
*/
public class SteelStatusLobbySign extends SteelLobbySign implements StatusLobbySign {
public SteelStatusLobbySign(Location3D location, CommonArena arena) {
super(location, arena, Type.STATUS);
}
}
| [
"me@caseif.net"
] | me@caseif.net |
3246ed9ad906fe65d8310b90826e991728d7a432 | e0dd9c46388a928d284f794d4a2428372d5acabc | /app/src/main/java/ru/nsu/bobrofon/easysshfs/log/LogFragment.java | c8cb516f4769114fc3169ac79d350a529c251854 | [] | no_license | cantenna/easysshfs | d54c88e0f1a7f6d92aad81fb29a49b5e8f47c8ae | 329eb46ac562c3c56b8ab42221034efac2cf2ce5 | refs/heads/master | 2020-06-08T23:38:20.948500 | 2015-05-10T14:40:14 | 2015-05-10T14:40:14 | 193,327,765 | 0 | 0 | null | 2019-06-23T09:10:42 | 2019-06-23T09:10:42 | null | UTF-8 | Java | false | false | 2,527 | java | package ru.nsu.bobrofon.easysshfs.log;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import ru.nsu.bobrofon.easysshfs.DrawerStatus;
import ru.nsu.bobrofon.easysshfs.EasySSHFSActivity;
import ru.nsu.bobrofon.easysshfs.R;
public class LogFragment extends Fragment implements LogModel.Observer {
private static final String TAG = "LogFragment";
public static final String TAG_WORKER = "TAG_LOG_WORKER";
private TextView mLogTextView;
private LogModel mLogModel;
private DrawerStatus mDrawerStatus;
public LogFragment() {
// Required empty public constructor
}
public void setDrawerStatus(final DrawerStatus drawerStatus) {
mDrawerStatus = drawerStatus;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.i(TAG, "onCreateView");
super.onCreateView(inflater, container, savedInstanceState);
setHasOptionsMenu(true);
// Inflate the layout for this fragment
View selfView = inflater.inflate(R.layout.fragment_log, container, false);
mLogTextView = (TextView) selfView.findViewById(R.id.log);
mLogModel = LogWorkerFragment.getLogModelByTag(getFragmentManager(), TAG_WORKER);
mLogModel.registerObserver(this);
return selfView;
}
@Override
public void onDestroyView () {
Log.i(TAG, "onDestroyView");
super.onDestroyView();
mLogModel.unregisterObserver(this);
}
@Override
public void onLogChanged(LogModel logModel) {
final String logHeader = getString(R.string.debug_log_header);
final String logBody = logModel.getLog();
mLogTextView.setText(logHeader + logBody);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
((EasySSHFSActivity) activity).onSectionAttached(R.string.debug_log_title);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
if (mDrawerStatus == null || !mDrawerStatus.isDrawerOpen()) {
inflater.inflate(R.menu.log, menu);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_clean) {
mLogModel.clean();
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"bobrofon@gmail.com"
] | bobrofon@gmail.com |
d49bf969739694d2deb75f5f705c7e5ef5cb620b | ccb220316d0e5721e3097293d3dbb77a3452b7b2 | /cadastro_produto.java | a337a5ed233ba9f6930a58dd4c07bf2f1be9c2e0 | [] | no_license | agcanthony/SistemaAFG | bc6077eb8094a97a6f13296c8d0171508c0df221 | 274fcc52520b0d159bad55f0a096cb0d2389c299 | refs/heads/main | 2023-02-27T06:16:18.897856 | 2021-02-01T15:15:29 | 2021-02-01T15:15:29 | 334,990,445 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 9,711 | java | import java.sql.*;
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
import java.text.*;
import javax.swing.JButton;
//----------------------------------------------------//
public class cadastro_produto extends JFrame implements ActionListener{
ResultSet resultSet;
Statement statement;
JLabel P,
rotuloValor,
rotuloCod,
rotuloDes,
rotuloMarca;
//------------------------------------------------------//
static JTextField Cod,
Valor,
Descri,
Marca;
//------------------------------------------------------//
MaskFormatter mascaraCod,
mascaraDes,
mascaraMarca;
//------------------------------------------------------//
JButton btGravar,
btAlterar,
btExcluir,
btlocalizar,
btNovo,
btCancelar;
//------------------------------------------------------//
JScrollPane caixa;
//------------------------------------------------------//
public static void main(String args[]){
JFrame janela = new cadastro_produto();
janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
janela.setVisible(true);
}
cadastro_produto(){
super("Cadastro de Produto");
P=new JLabel("Produtos");
P.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
P.setForeground(new java.awt.Color(100, 10, 0));
Container tela = getContentPane();
setLayout(null);
rotuloCod = new JLabel("Código: ");
rotuloDes = new JLabel("Descrição: ");
rotuloMarca = new JLabel("Marca: ");
rotuloValor = new JLabel("Valor: ");
P.setBounds(290,20,200,20);
rotuloCod.setBounds(100,80,120,40);
rotuloDes.setBounds(100,120,130,40);
rotuloMarca.setBounds(100,160,100,40);
rotuloValor.setBounds(100,200,80,40);
try{
mascaraCod =new MaskFormatter("#####");
mascaraDes =new MaskFormatter("*********************************************");
mascaraMarca = new MaskFormatter("******************************************");
mascaraCod.setPlaceholderCharacter('_');
mascaraDes.setPlaceholderCharacter(' ');
mascaraMarca.setPlaceholderCharacter(' ');
}
catch(ParseException excp){}
Cod = new JTextField(6);
Descri = new JTextField(30);
Marca = new JTextField(15);
Valor = new JTextField(10);
Cod.setBounds(180,90,41,20);
Descri.setBounds(180,130,350,20);
Marca.setBounds(180,170,117,20);
Valor.setBounds(180,210,60,20);
tela.add(rotuloCod);
tela.add(rotuloDes);
tela.add(rotuloMarca);
tela.add(rotuloValor);
tela.add(P);
tela.add(Cod);
tela.add(Descri);
tela.add(Marca);
tela.add(Valor);
btGravar = new JButton();
btGravar.setText("Gravar");
btGravar.setBounds(325,300,100,30);
btGravar.setSize(100,25);
btGravar.setBackground(new Color(27,75,153));
btGravar.setForeground(Color.white);
btGravar.setFont(new Font("Tahoma",Font.BOLD,14));
btGravar.addActionListener(this);
tela.add(btGravar);
btAlterar = new JButton();
btAlterar.setText("Alterar");
btAlterar.setBounds(115,250,100,30);
btAlterar.setSize(100,25);
btAlterar.setBackground(new Color(27,75,153));
btAlterar.setForeground(Color.white);
btAlterar.setFont(new Font("Tahoma",Font.BOLD,14));
btAlterar.addActionListener(this);
tela.add(btAlterar);
btExcluir = new JButton();
btExcluir.setText("Excluir");
btExcluir.setBounds(250,250,100,30);
btExcluir.setSize(100,25);
btExcluir.setBackground(new Color(27,75,153));
btExcluir.setForeground(Color.white);
btExcluir.setFont(new Font("Tahoma",Font.BOLD,14));
btExcluir.addActionListener(this);
tela.add(btExcluir);
btlocalizar = new JButton();
btlocalizar.setText("Localizar");
btlocalizar.setBounds(385,250,100,30);
btlocalizar.setSize(100,25);
btlocalizar.setBackground(new Color(27,75,153));
btlocalizar.setForeground(Color.white);
btlocalizar.setFont(new Font("Tahoma",Font.BOLD,14));
btlocalizar.addActionListener(this);
tela.add(btlocalizar);
btNovo = new JButton();
btNovo.setText("Novo");
btNovo.setBounds(190,300,100,30);
btNovo.setSize(100,25);
btNovo.setBackground(new Color(27,75,153));
btNovo.setForeground(Color.white);
btNovo.setFont(new Font("Tahoma",Font.BOLD,14));
btNovo.addActionListener(this);
tela.add(btNovo);
btCancelar = new JButton();
btCancelar.setText("Cancelar");
btCancelar.setBounds(250,350,100,30);
btCancelar.setSize(100,25);
btCancelar.setBackground(new Color(27,75,153));
btCancelar.setForeground(Color.white);
btCancelar.setFont(new Font("Tahoma",Font.BOLD,14));
btCancelar.addActionListener(this);
tela.add(btCancelar);
setBotoes(true,true,false,false,false,false);
setResizable(false);
carregaResultSet();
setSize(620,500);
setLocationRelativeTo(null);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==btNovo)
{
limpaCampos();
setBotoes(false, false,true, false, false,true );
return;
}
if( e.getSource()==btCancelar)
{
limpaCampos();
setBotoes(true,true, false, false, false, false);
return;
}
if(e.getSource()==btGravar)
//gravar registro novo
{
try
{
String sql="INSERT INTO cadastroprod(Cod,Produto1,Marca,ValorProduto)Values('"+
Cod.getText()+"','"+
Descri.getText()+"','"+
Marca.getText()+"','"+
Valor.getText()+"')";
statement.executeUpdate(sql);
JOptionPane.showMessageDialog(null,"Gravacao realizada com sucesso");
setBotoes(true,true,false,true,true,false);
}
catch(SQLException erro)
{
}
carregaResultSet();
}
// --Final da inclusao
//alterar um registro
if(e.getSource()== btAlterar)
{
try
{
String sql = "UPDATE cadastroprod SET " +
"Cod ='"+ Cod.getText()+"',"+
"Produto1 ='"+ Descri.getText()+"',"+
"Marca ='"+ Descri.getText()+"',"+
"ValorProduto ='"+Marca.getText()+"'"+
"WHERE Cod ='"+ Cod.getText()+"'";
int r = statement.executeUpdate(sql);
if(r==1)
JOptionPane.showMessageDialog(null,"Problemas na alteracao");
else
JOptionPane.showMessageDialog(null,"Alteração realizada com sucesso");
setBotoes(true,true,true,true,true,true);
}
catch(SQLException erro)
{
JOptionPane.showMessageDialog(null,"Atualização nao realizada");
}
carregaResultSet();
}
//-------------Final da alteracao
if(e.getSource()==btExcluir)
//Excluir um registro
{
try
{
String sql="SELECT Cod, Descri FROM cadastroprod Where Cod='" +Cod.getText()+"'";
resultSet=statement.executeQuery(sql);
String nome="";
try
{
resultSet.next(); nome="Deletar o Cadastro: " + resultSet.getString("Descri");
}
catch(SQLException exl)
{
JOptionPane.showMessageDialog(null, "Cadastrado nao efetuado");
carregaResultSet(); return; }
int n = JOptionPane.showConfirmDialog(null,nome,"",JOptionPane.YES_NO_OPTION);
if (n==JOptionPane.YES_OPTION)
{
sql="DELETE FROM cadastroprod Where Cod='"+Cod.getText()+"'";
int r=statement.executeUpdate(sql);
if(r==1)
JOptionPane.showMessageDialog(null, "Exclusao realizada com sucesso");
else
JOptionPane.showMessageDialog(null, "Nao foi possivel excluir o Cadastro");
limpaCampos();
setBotoes(true,true,false,false,false,false);
}
}
catch(SQLException erro) {}
carregaResultSet();
}
//-------------Final da exclusao
if(e.getSource()==btlocalizar || e.getSource()==Cod)
{
try
{
String sql ="SELECT * FROM cadastroprod Where Cod ='" +Cod.getText()+"'";
resultSet=statement.executeQuery(sql);
resultSet.next();
atualizaCampos();
setBotoes(true,true, false,true, true, false);
}
catch(SQLException erro)
{
JOptionPane.showMessageDialog(null,"Cadastro nao encontrado");
carregaResultSet();
return;
}
}
}
//-------------------Final da localizacao
public void carregaResultSet(){
String url="jdbc:mysql://localhost/afsistemadb";
try {
Class.forName("com.mysql.jdbc.Driver");
Connection minhaConexao=DriverManager.getConnection(url,"root","");
statement=minhaConexao.createStatement(resultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);;
resultSet=statement.executeQuery("SELECT * FROM cadastroprod");
}
catch(ClassNotFoundException erro)
{
System.out.println("Driver nao encontrado");
}
catch(SQLException erro)
{
System.out.println("Problemas na conexao com a fonte de dados");
}
}
public static void limpaCampos()
{
Cod.setText("");
Descri.setText("");
Marca.setText("");
Valor.setText("");
}
public void atualizaCampos()
{
try
{
Cod.setText(resultSet.getString("Cod"));
Descri.setText(resultSet.getString("Produto1"));
Marca.setText(resultSet.getString("Marca"));
Valor.setText(resultSet.getString("ValorProduto"));
}
catch(SQLException erro){}
}
public void setBotoes(boolean bNovo, boolean blocalizar, boolean bGravar, boolean bAlterar, boolean bExcluir, boolean bCancelar)
{
btNovo.setEnabled(bNovo);
btlocalizar.setEnabled(blocalizar);
btGravar.setEnabled(bGravar);
btAlterar.setEnabled(bAlterar);
btExcluir.setEnabled(bExcluir);
btCancelar.setEnabled(bCancelar);
}
} | [
"agc22.ag@gmail.com"
] | agc22.ag@gmail.com |
77a2ed4e1bb3f85dee21fcd85f5e049d77ca72b9 | 4c78e2c7e129493ed849033a8333f6b0a4f149e6 | /myenum/PlaceEnum.java | f66bac6460938419d6852ed1b4306e3f32dbaffb | [] | no_license | IshinagiMoeta/LostFind | cbd86153f625f7ffe6a6199fd9cb462f5d8f5cdc | 8506047310a0d321f901f97e2dae5232155c91f6 | refs/heads/master | 2021-01-01T18:38:41.043256 | 2017-07-26T06:26:05 | 2017-07-26T06:26:05 | 98,387,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 124 | java | package com.whitesharkapps.lostfind.myenum;
/**
* Created by ketianxing on 2017/7/13.
*/
public interface PlaceEnum {
}
| [
"jackktx@gmail.com"
] | jackktx@gmail.com |
87855f32d61728a58e4a97714dda61408fff8d34 | 1fc1bc95e0eea6431d826968f9d1c66f19bc3da9 | /disfrutapp/src/com/disfruta/gestion/logistica/GestionPresentacionPrecioVenta.java | 9430d56dc2954eba7b776af77da4eadbebd2f72d | [] | no_license | josejuape/ProjectDisfrutapp | e4f6e1a726754a11c14a1204119a854093e385c7 | 2cf41c2bf470c0cc59ccd85513e84c606f06b69e | refs/heads/master | 2020-12-24T15:31:13.810491 | 2015-04-14T14:17:57 | 2015-04-14T14:17:57 | 29,478,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,751 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.disfruta.gestion.logistica;
import com.disfruta.bean.logistica.PresentacionPrecioVenta;
import com.disfruta.bean.logistica.ProductoCarta;
import com.disfruta.conexion.ObjConexion;
import com.disfruta.logic.logistica.LogicPresentacionPrecioVenta;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Juape
*/
public class GestionPresentacionPrecioVenta {
ObjConexion objCnx = new ObjConexion();
public String registrar(PresentacionPrecioVenta beanPresentacion) {
String mensaje = "Operacion incorrecta";
try {
LogicPresentacionPrecioVenta logicPresentacionVenta = new LogicPresentacionPrecioVenta(objCnx);
if (beanPresentacion.getTipoOperacion().equalsIgnoreCase("i")) {
mensaje = logicPresentacionVenta.mantenimiento(beanPresentacion);
}else{
return mensaje;
}
objCnx.getMysql().confirmar();
return mensaje;
} catch (ClassNotFoundException ex) {
Logger.getLogger(GestionProductoCarta.class.getName()).log(Level.SEVERE, null, ex);
ex.getMessage();
} catch (InstantiationException ex) {
Logger.getLogger(GestionProductoCarta.class.getName()).log(Level.SEVERE, null, ex);
ex.getMessage();
} catch (IllegalAccessException ex) {
Logger.getLogger(GestionProductoCarta.class.getName()).log(Level.SEVERE, null, ex);
ex.getMessage();
} catch (SQLException ex) {
Logger.getLogger(GestionProductoCarta.class.getName()).log(Level.SEVERE, null, ex);
ex.getMessage();
} catch (Exception ex) {
Logger.getLogger(GestionProductoCarta.class.getName()).log(Level.SEVERE, null, ex);
ex.getMessage();
}finally{
try {
objCnx.getMysql().deshacer();
objCnx.getMysql().desconectarBD();
return mensaje;
} catch (SQLException ex) {
Logger.getLogger(GestionProductoCarta.class.getName()).log(Level.SEVERE, null, ex);
return mensaje;
}
}
}
public String eliminarPorProducto(ProductoCarta producto) {
String mensaje = "Operacion incorrecta";
try {
LogicPresentacionPrecioVenta logicPresentacionVenta = new LogicPresentacionPrecioVenta(objCnx);
if (producto.getTipoOperacion().equalsIgnoreCase("e1")) {
mensaje = logicPresentacionVenta.eliminarPorProducto(producto);
}else{
return mensaje;
}
objCnx.getMysql().confirmar();
return mensaje;
} catch (ClassNotFoundException ex) {
Logger.getLogger(GestionProductoCarta.class.getName()).log(Level.SEVERE, null, ex);
ex.getMessage();
} catch (InstantiationException ex) {
Logger.getLogger(GestionProductoCarta.class.getName()).log(Level.SEVERE, null, ex);
ex.getMessage();
} catch (IllegalAccessException ex) {
Logger.getLogger(GestionProductoCarta.class.getName()).log(Level.SEVERE, null, ex);
ex.getMessage();
} catch (SQLException ex) {
Logger.getLogger(GestionProductoCarta.class.getName()).log(Level.SEVERE, null, ex);
ex.getMessage();
} catch (Exception ex) {
Logger.getLogger(GestionProductoCarta.class.getName()).log(Level.SEVERE, null, ex);
ex.getMessage();
}finally{
try {
objCnx.getMysql().deshacer();
objCnx.getMysql().desconectarBD();
return mensaje;
} catch (SQLException ex) {
Logger.getLogger(GestionProductoCarta.class.getName()).log(Level.SEVERE, null, ex);
return mensaje;
}
}
}
public ArrayList<PresentacionPrecioVenta> listarPorProducto(ProductoCarta producto) throws ClassNotFoundException, Exception {
ArrayList array = new ArrayList();
try {
LogicPresentacionPrecioVenta logicPresentacionVenta = new LogicPresentacionPrecioVenta(objCnx);
array=logicPresentacionVenta.listarPorProducto(producto);
return array;
} catch (ClassNotFoundException ex) {
Logger.getLogger(GestionPresentacionVenta.class.getName()).log(Level.SEVERE, null, ex);
throw ex;
} catch (InstantiationException ex) {
Logger.getLogger(GestionPresentacionVenta.class.getName()).log(Level.SEVERE, null, ex);
throw ex;
} catch (IllegalAccessException ex) {
Logger.getLogger(GestionPresentacionVenta.class.getName()).log(Level.SEVERE, null, ex);
throw ex;
} catch (SQLException ex) {
Logger.getLogger(GestionPresentacionVenta.class.getName()).log(Level.SEVERE, null, ex);
throw ex;
} catch (Exception ex) {
Logger.getLogger(GestionPresentacionVenta.class.getName()).log(Level.SEVERE, null, ex);
throw ex;
}finally{
try {
objCnx.getMysql().desconectarBD();
} catch (SQLException ex) {
Logger.getLogger(GestionPresentacionVenta.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
| [
"josejuape@gmail.com"
] | josejuape@gmail.com |
0c597def8c5edd17bbf6738f4fb2af6276bb423f | 44ec741b7dcd961b3d189f25d2c2f3d23280525b | /app/src/main/java/com/slightech/testwficonnectandsave/ObjectSaveUitls.java | e74ddf3029450f3070e335aa7ced7db27fa4aa21 | [] | no_license | zhaozong/TestWfiConnectAndSave | 5b030cac8fe5010da3ee980afeeddcc1044d7c12 | 6c19c490895069cefef7aba3da4c674cf37f675f | refs/heads/master | 2021-01-18T15:42:15.665292 | 2017-03-30T07:42:45 | 2017-03-30T07:42:45 | 86,673,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,518 | java | package com.slightech.testwficonnectandsave;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.util.Log;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Rokey on 2017/3/29.
*/
public class ObjectSaveUitls {
/**
* 存储ObjectList
* @param sp
* @param sKey
* @param <T>
* @return
*/
public static <T> boolean saveArray(SharedPreferences sp, List<T> sKey) {
SharedPreferences.Editor mEdit1 = sp.edit();
mEdit1.putInt("Status_size", sKey.size());
for (int i = 0; i < sKey.size(); i++) {
mEdit1.remove("Status_" + i);
saveObject("Status_" + i,sKey.get(i),mEdit1);
}
return mEdit1.commit();
}
/**
* 获取objectList
* @param sp
* @param <T>
* @return
*/
public static <T> List<T> loadArray(SharedPreferences sp) {
List<T> sKey = new ArrayList<>();
sKey.clear();
int size = sp.getInt("Status_size", 0);
for (int i = 0; i < size; i++) {
T t = (T) readObject("Status_" + i,sp);
sKey.add(t);
}
return sKey;
}
/**
* desc:保存对象
*
* @param key
* @param obj 要保存的对象,只能保存实现了serializable的对象
*/
public static void saveObject(String key, Object obj, SharedPreferences.Editor sharedata) {
try {
// 保存对象
//先将序列化结果写到byte缓存中,其实就分配一个内存空间
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(bos);
//将对象序列化写入byte缓存
os.writeObject(obj);
//将序列化的数据转为16进制保存
String bytesToHexString = bytesToHexString(bos.toByteArray());
//保存该16进制数组
sharedata.putString(key, bytesToHexString);
sharedata.commit();
} catch (IOException e) {
e.printStackTrace();
Log.e("", "保存obj失败");
}
}
/**
* desc:将数组转为16进制
*
* @param bArray
* @return modified:
*/
private static String bytesToHexString(byte[] bArray) {
if (bArray == null) {
return null;
}
if (bArray.length == 0) {
return "";
}
StringBuffer sb = new StringBuffer(bArray.length);
String sTemp;
for (int i = 0; i < bArray.length; i++) {
sTemp = Integer.toHexString(0xFF & bArray[i]);
if (sTemp.length() < 2)
sb.append(0);
sb.append(sTemp.toUpperCase());
}
return sb.toString();
}
/**
* desc:获取保存的Object对象
*
* @param key
* @return modified:
*/
public static Object readObject(String key, SharedPreferences sharedata) {
try {
if (sharedata.contains(key)) {
String string = sharedata.getString(key, "");
if (TextUtils.isEmpty(string)) {
return null;
} else {
//将16进制的数据转为数组,准备反序列化
byte[] stringToBytes = StringToBytes(string);
ByteArrayInputStream bis = new ByteArrayInputStream(stringToBytes);
ObjectInputStream is = new ObjectInputStream(bis);
//返回反序列化得到的对象
return is.readObject();
}
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}catch (IOException e) {
e.printStackTrace();
}
//所有异常返回null
return null;
}
/**
* desc:将16进制的数据转为数组
*
* @param data
* @return modified:
*/
private static byte[] StringToBytes(String data) {
String hexString = data.toUpperCase().trim();
if (hexString.length() % 2 != 0) {
return null;
}
byte[] retData = new byte[hexString.length() / 2];
for (int i = 0; i < hexString.length(); i++) {
int int_ch; // 两位16进制数转化后的10进制数
char hex_char1 = hexString.charAt(i); //两位16进制数中的第一位(高位*16)
int int_ch1;
if (hex_char1 >= '0' && hex_char1 <= '9')
int_ch1 = (hex_char1 - 48) * 16; // 0 的Ascll - 48
else if (hex_char1 >= 'A' && hex_char1 <= 'F')
int_ch1 = (hex_char1 - 55) * 16; // A 的Ascll - 65
else
return null;
i++;
char hex_char2 = hexString.charAt(i); //两位16进制数中的第二位(低位)
int int_ch2;
if (hex_char2 >= '0' && hex_char2 <= '9')
int_ch2 = (hex_char2 - 48); // 0 的Ascll - 48
else if (hex_char2 >= 'A' && hex_char2 <= 'F')
int_ch2 = hex_char2 - 55; // A 的Ascll - 65
else
return null;
int_ch = int_ch1 + int_ch2;
retData[i / 2] = (byte) int_ch;//将转化后的数放入Byte里
}
return retData;
}
}
| [
"rokeyzhao@slightech.com"
] | rokeyzhao@slightech.com |
29ab8e86a05b814df8b69c8ccf43558e17f5cfef | ea43f4cbcd1a1ae58dea0b6fbe51ffd4ec37a017 | /src/me/xiaopan/pullview/PullTouchListener.java | 6c9658256e3113ffd7817f7948929fd367a24117 | [
"Apache-2.0"
] | permissive | wang9090980/Android-PullView | d83dadc65faa7683de0373912be7bda97000d71f | 05088663d30df3b26551110441faeb070f1a0d3e | refs/heads/master | 2021-01-22T10:22:39.029272 | 2014-03-26T09:17:37 | 2014-03-26T09:17:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,890 | java | /*
* Copyright (C) 2013 Peng fei Pan <sky@xiaopan.me>
*
* 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 me.xiaopan.pullview;
import me.xiaopan.pullview.PullGestureDetector.OnTouchListener;
import me.xiaopan.pullview.PullViewBase.PullStatus;
import android.view.MotionEvent;
/**
* 触摸事件处理监听器
*/
@SuppressWarnings("rawtypes")
public class PullTouchListener implements OnTouchListener {
private PullViewBase pullViewBase;
public PullTouchListener(PullViewBase pullViewBase) {
super();
this.pullViewBase = pullViewBase;
}
@Override
public boolean onTouchDown(MotionEvent e) {
if(pullViewBase.getPullScroller().isScrolling()){
pullViewBase.getPullScroller().abortScroll();
}
pullViewBase.setInterceptTouchEvent(false);
return true;
}
@SuppressWarnings("unchecked")
@Override
public boolean onTouchScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
switch(pullViewBase.getPullStatus()){
case PULL_HEADER :
if(pullViewBase.isVerticalPull()){
pullViewBase.scrollBy(0, (int) (distanceY * pullViewBase.getElasticForce()));
if(pullViewBase.getScrollY() >= 0 && Math.abs(distanceY) <= 10){
pullViewBase.setPullStatus(PullStatus.NORMAL);
}
}else{
pullViewBase.scrollBy((int) (distanceX * pullViewBase.getElasticForce()), 0);
if(pullViewBase.getScrollX() >= 0 && Math.abs(distanceX) <= 10){
pullViewBase.setPullStatus(PullStatus.NORMAL);
}
}
if(pullViewBase.getPullHeaderView() != null){
pullViewBase.getPullHeaderView().onScroll(Math.abs(pullViewBase.isVerticalPull()?pullViewBase.getScrollY():pullViewBase.getScrollX()));
}
pullViewBase.scrollPullViewToHeader(pullViewBase.getPullView());
break;
case PULL_FOOTER :
if(pullViewBase.isVerticalPull()){
pullViewBase.scrollBy(0, (int) (distanceY * pullViewBase.getElasticForce()));
if(pullViewBase.getScrollY() <= 0 && Math.abs(distanceY) <= 10){
pullViewBase.setPullStatus(PullStatus.NORMAL);
}
}else{
pullViewBase.scrollBy((int) (distanceX * pullViewBase.getElasticForce()), 0);
if(pullViewBase.getScrollX() <= 0 && Math.abs(distanceX) <= 10){
pullViewBase.setPullStatus(PullStatus.NORMAL);
}
}
if(pullViewBase.getPullFooterView() != null){
pullViewBase.getPullFooterView().onScroll(Math.abs(pullViewBase.isVerticalPull()?pullViewBase.getScrollY():pullViewBase.getScrollX()));
}
pullViewBase.scrollPullViewToFooter(pullViewBase.getPullView());
break;
default :
if(pullViewBase.isVerticalPull()){
if(distanceY < 0){ //如果向下拉
if(pullViewBase.getScrollY() > 0){
//如果Footer正在显示就先通过滚动隐藏Footer
pullViewBase.logD("滚动:手动回滚Footer,ScrollY=" + pullViewBase.getScrollY());
pullViewBase.scrollBy(0, (int) (distanceY));
pullViewBase.scrollPullViewToFooter(pullViewBase.getPullView());
}else{
//如果可以拉伸Header并且
if(pullViewBase.isCanPullHeader(pullViewBase.getPullView())){
if(pullViewBase.getScrollY() <= (pullViewBase.getPullHeaderView() != null?pullViewBase.getPullHeaderView().getMinScrollValue():0)){
pullViewBase.logD("滚动:开始拉伸头部,ScrollY=" + pullViewBase.getScrollY());
pullViewBase.setPullStatus(PullStatus.PULL_HEADER);
}
}
}
}else if(distanceY > 0){ //如果向上拉
if(pullViewBase.getScrollY() < 0){
//如果Header正在显示就先通过滚动隐藏Header
pullViewBase.logD("滚动:手动回滚Header,ScrollY=" + pullViewBase.getScrollY());
pullViewBase.scrollBy(0, (int) (distanceY));
pullViewBase.scrollPullViewToHeader(pullViewBase.getPullView());
}else{
//如果可以拉伸Footer
if(pullViewBase.isCanPullFooter(pullViewBase.getPullView())){
pullViewBase.logD("滚动:开始拉伸尾部,ScrollY=" + pullViewBase.getScrollY());
pullViewBase.setPullStatus(PullStatus.PULL_FOOTER);
}
}
}
}else{
if(distanceX < 0){ //如果向右拉
if(pullViewBase.getScrollX() > 0){
//如果Footer正在显示就先通过滚动隐藏Footer
pullViewBase.logD("滚动:手动回滚Footer,ScrollX=" + pullViewBase.getScrollX());
pullViewBase.scrollBy((int) (distanceX), 0);
pullViewBase.scrollPullViewToFooter(pullViewBase.getPullView());
}else{
//如果可以拉伸Header并且
if(pullViewBase.isCanPullHeader(pullViewBase.getPullView())){
if(pullViewBase.getScrollX() <= (pullViewBase.getPullHeaderView() != null?pullViewBase.getPullHeaderView().getMinScrollValue():0)){
pullViewBase.logD("滚动:开始拉伸头部,ScrollX=" + pullViewBase.getScrollX());
pullViewBase.setPullStatus(PullStatus.PULL_HEADER);
}
}
}
}else if(distanceX > 0){ //如果向左拉
if(pullViewBase.getScrollX() < 0){
//如果Header正在显示就先通过滚动隐藏Header
pullViewBase.logD("滚动:手动回滚Header,ScrollX=" + pullViewBase.getScrollX());
pullViewBase.scrollBy((int) (distanceX), 0);
pullViewBase.scrollPullViewToHeader(pullViewBase.getPullView());
}else{
//如果可以拉伸Footer
if(pullViewBase.isCanPullFooter(pullViewBase.getPullView())){
pullViewBase.logD("滚动:开始拉伸尾部,ScrollX=" + pullViewBase.getScrollX());
pullViewBase.setPullStatus(PullStatus.PULL_FOOTER);
}
}
}
}
break;
}
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
pullViewBase.setInterceptTouchEvent(pullViewBase.getPullStatus() != PullStatus.NORMAL);
return true;
}
@Override
public void onTouchUpOrCancel() {
pullViewBase.getPullScroller().rollback();
}
}
| [
"sky@xiaopan.me"
] | sky@xiaopan.me |
13a89966c7f14e8ae778a125b1ce0953644be937 | 67878c79f8f92bad9f20d4b65419016273a9c392 | /back_end/ChildHood/src/edu/buu/childhood/login/service/LoginServiceImpl.java | 7a07612eefa42cb49988c4f7a03aa51408d6421f | [] | no_license | buutongnian/ChildHood | ef3724968afcbfe249607cf44c7f798348bc5db2 | 3cc129f7238f7ddac2543e5d1fe1ba2a8071de04 | refs/heads/master | 2021-01-19T02:29:51.323050 | 2017-01-23T08:14:20 | 2017-01-23T08:14:20 | 60,964,086 | 0 | 0 | null | 2017-01-07T17:08:26 | 2016-06-12T11:37:30 | Java | UTF-8 | Java | false | false | 4,150 | java | package edu.buu.childhood.login.service;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import edu.buu.childhood.achvmt.service.EventSupport;
import edu.buu.childhood.achvmt.service.TriggerService;
import edu.buu.childhood.common.C;
import edu.buu.childhood.login.dao.LoginDao;
import edu.buu.childhood.login.pojo.UserLogin;
import edu.buu.childhood.util.MD5;
/**
* 2016/6/22
*
* @author joe
* @note 登录模块业务逻辑操作类
*/
public class LoginServiceImpl implements LoginService,EventSupport {
@Override
public String moduleName() {
return "login";
}
private Logger logger = Logger.getLogger(this.getClass());
@Autowired
private LoginDao loginDao;
private TriggerService triggerService;
public LoginServiceImpl() {
super();
}
public LoginServiceImpl(TriggerService triggerService){
super();
this.triggerService = triggerService;
triggerService.registerModule(this);
}
/**
* 2016/6/22 判断登录是否合法,检测用户是否存在、用户名是否正确 密码采用MD5小写32位加密方法
*
* @author joe
* @param userName
* 用户名
* @param password
* 密码
* @param userFromDB
* 通过用户名从数据库中取出的用户登录信息对象
* @return 返回登录状态编码,对应C.java常量文件中定义
*/
@Override
@Transactional
public String loginCheck(String userName, String userPwd) {
UserLogin userFromDB = loginDao.queryByUserName(userName);
if (userFromDB != null) {
if (userFromDB.getUserPwd().trim()
.equals(MD5.enc32Bit(userPwd).trim())) {
// 返回登录成功信息,供Action判断转发信息(Web端或App端分别处理)
return C.LoginStatus.LOGIN_SUCCESS;
} else {
// 返回密码错误信息,供Action判断转发信息(Web端或App端分别处理)
return C.LoginStatus.PASSWORD_INCORRECT;
}
} else {
// 返回用户不存在信息,供Action判断转发信息(Web端或App端分别处理)
return C.LoginStatus.USER_NOT_EXIST;
}
}
/**
* 2016/6/22 更改登录状态(主要供App端使用)
*
* @author joe
* @param userName
* 用户名
* @param loginStatus
* 登录状态编码,传入时使用C.java中定义的常量
* @return 返回是否修改成功(true或false)
*/
@Override
@Transactional
public boolean changeLoginStatus(String userName, String loginStatus) {
try {
UserLogin user = new UserLogin();
user.setUserName(userName);
user.setLoginStatus(loginStatus);
loginDao.update(user);
triggerService.triggerEvent(this, userName);
// 记录登录状态修改日志
logger.info("[" + userName + "]修改登录状态为:" + loginStatus);
return true;
} catch (Exception e) {
logger.error(e, e);
return false;
}
}
/**
* 2016/6/24 更改登录经纬度信息(主要供App端使用)
*
* @author joe
* @param userName
* 用户名
* @param lastLatitude
* 登录纬度
* @param lastLongitude
* 登录经度
* @return 返回是否修改成功(true或false)
*/
@Override
@Transactional
public boolean updateLoginInf(String userName, double lastLatitude,
double lastLongitude) {
try {
loginDao.update(userName, lastLatitude, lastLongitude);
logger.info(userName + "在纬度:[" + lastLatitude + "]经度:["
+ lastLongitude + "]登录");
return true;
} catch (Exception e) {
logger.error(e, e);
return false;
}
}
public String statusCheck(String userName) {
UserLogin userFromDB = loginDao.queryByUserName(userName);
if (userFromDB != null) {
if (C.status.ONLINE.equals(userFromDB.getLoginStatus())) {
// 返回API请求验证合法信息,供Filter判断请求是否合法
return C.security.LEGAL;
} else {
// 返回API请求不合法,请求API用户未登陆
return C.security.USER_NOT_LOGIN;
}
} else {
// 返回API请求不合法,用户不存在
return C.security.USER_NOT_EXIST;
}
};
}
| [
"joe-ji@outlook.com"
] | joe-ji@outlook.com |
5b09c167fe7f5fd3d356a636d68145114f84375c | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/12/12_34939cea663c63f64a18549e15787e3a8de964c6/OpenStackAuthenticationHeaderManager/12_34939cea663c63f64a18549e15787e3a8de964c6_OpenStackAuthenticationHeaderManager_s.java | 515efaf21c671be7c54959f48515ac5a3701f31c | [] | 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,969 | java | package com.rackspace.papi.components.clientauth.openstack.v1_0;
import com.rackspace.auth.AuthGroup;
import com.rackspace.auth.AuthToken;
import com.rackspace.papi.commons.util.StringUtilities;
import com.rackspace.papi.commons.util.http.HttpStatusCode;
import com.rackspace.papi.commons.util.http.IdentityStatus;
import com.rackspace.papi.commons.util.http.OpenStackServiceHeader;
import com.rackspace.papi.commons.util.http.PowerApiHeader;
import com.rackspace.papi.filter.logic.FilterAction;
import com.rackspace.papi.filter.logic.FilterDirector;
import com.rackspace.papi.commons.util.http.header.HeaderValueImpl;
import org.slf4j.Logger;
import java.util.Date;
import com.rackspace.papi.commons.util.http.HttpDate;
import java.util.List;
/**
* Responsible for adding Authentication headers from validating token response
*/
public class OpenStackAuthenticationHeaderManager {
private static final Logger LOG = org.slf4j.LoggerFactory.getLogger(OpenStackAuthenticationHeaderManager.class);
// Proxy is specified in the OpenStack auth blue print:
// http://wiki.openstack.org/openstack-authn
private static final String X_AUTH_PROXY = "Proxy";
private final String authToken;
private final AuthToken cachableToken;
private final Boolean isDelagable;
private final FilterDirector filterDirector;
private final String tenantId;
private final Boolean validToken;
private final List<AuthGroup> groups;
// Hard code QUALITY for now as the auth component will have
// the highest QUALITY in terms of using the user it supplies for rate limiting
private static final String QUALITY = ";q=1.0";
private final String wwwAuthHeaderContents;
private static final String WWW_AUTHENTICATE_HEADER = "WWW-Authenticate";
private final String endpointsBase64;
//add base 64 string in here
public OpenStackAuthenticationHeaderManager(String authToken, AuthToken token, Boolean isDelegatable,
FilterDirector filterDirector, String tenantId, List<AuthGroup> groups, String wwwAuthHeaderContents, String endpointsBase64) {
this.authToken = authToken;
this.cachableToken = token;
this.isDelagable = isDelegatable;
this.filterDirector = filterDirector;
this.tenantId = tenantId;
this.validToken = token != null && token.getTokenId() != null;
this.groups = groups;
this.wwwAuthHeaderContents = wwwAuthHeaderContents;
this.endpointsBase64 = endpointsBase64;
}
//set header with base64 string here
public void setFilterDirectorValues() {
if (validToken) {
filterDirector.setFilterAction(FilterAction.PASS);
setExtendedAuthorization();
setUser();
setRoles();
setGroups();
setTenant();
setImpersonator();
setEndpoints();
setExpirationDate();
setDefaultRegion();
if (isDelagable) {
setIdentityStatus();
}
} else if (isDelagable && nullCredentials() && filterDirector.getResponseStatus() != HttpStatusCode.INTERNAL_SERVER_ERROR) {
filterDirector.setFilterAction(FilterAction.PROCESS_RESPONSE);
setExtendedAuthorization();
setIdentityStatus();
} else if (filterDirector.getResponseStatusCode() == HttpStatusCode.UNAUTHORIZED.intValue()) {
filterDirector.responseHeaderManager().putHeader(WWW_AUTHENTICATE_HEADER, wwwAuthHeaderContents);
}
}
private boolean nullCredentials() {
final boolean nullCreds = StringUtilities.isBlank(authToken) && StringUtilities.isBlank(tenantId);
LOG.debug("Credentials null = " + nullCreds);
return nullCreds;
}
/**
* EXTENDED AUTHORIZATION
*/
private void setExtendedAuthorization() {
filterDirector.requestHeaderManager().putHeader(OpenStackServiceHeader.EXTENDED_AUTHORIZATION.toString(), StringUtilities.isBlank(tenantId) ? X_AUTH_PROXY : X_AUTH_PROXY + " " + tenantId);
}
/**
* IDENTITY STATUS
*/
private void setIdentityStatus() {
IdentityStatus identityStatus = IdentityStatus.Confirmed;
if (!validToken) {
identityStatus = IdentityStatus.Indeterminate;
}
filterDirector.requestHeaderManager().putHeader(OpenStackServiceHeader.IDENTITY_STATUS.toString(), identityStatus.name());
}
private void setImpersonator() {
filterDirector.requestHeaderManager().removeHeader(OpenStackServiceHeader.IMPERSONATOR_NAME.toString());
filterDirector.requestHeaderManager().removeHeader(OpenStackServiceHeader.IMPERSONATOR_ID.toString());
if (StringUtilities.isNotBlank(cachableToken.getImpersonatorTenantId())) {
filterDirector.requestHeaderManager().putHeader(OpenStackServiceHeader.IMPERSONATOR_NAME.toString(), cachableToken.getImpersonatorUsername());
filterDirector.requestHeaderManager().putHeader(OpenStackServiceHeader.IMPERSONATOR_ID.toString(), cachableToken.getImpersonatorTenantId());
}
}
/**
* TENANT
*/
private void setTenant() {
filterDirector.requestHeaderManager().putHeader(OpenStackServiceHeader.TENANT_NAME.toString(), cachableToken.getTenantName());
filterDirector.requestHeaderManager().putHeader(OpenStackServiceHeader.TENANT_ID.toString(), cachableToken.getTenantId());
}
/**
* USER
* The PowerApiHeader is used for Rate Limiting
* The OpenStackServiceHeader is used for an OpenStack service
*/
private void setUser() {
filterDirector.requestHeaderManager().appendHeader(PowerApiHeader.USER.toString(), cachableToken.getUsername() + QUALITY);
filterDirector.requestHeaderManager().putHeader(OpenStackServiceHeader.USER_NAME.toString(), cachableToken.getUsername());
filterDirector.requestHeaderManager().putHeader(OpenStackServiceHeader.USER_ID.toString(), cachableToken.getUserId());
}
/**
* ROLES
* The OpenStackServiceHeader is used for an OpenStack service
*/
private void setRoles() {
String roles = cachableToken.getRoles();
if (StringUtilities.isNotBlank(roles)) {
filterDirector.requestHeaderManager().putHeader(OpenStackServiceHeader.ROLES.toString(), roles);
}
}
/**
* GROUPS
* The PowerApiHeader is used for Rate Limiting
*/
private void setGroups() {
for (AuthGroup group : groups) {
filterDirector.requestHeaderManager().appendHeader(PowerApiHeader.GROUPS.toString(), group.getId() + QUALITY);
}
}
/**
* ENDPOINTS
* The base 64 encoded list of endpoints in an x-catalog header.
*/
private void setEndpoints() {
if (!StringUtilities.isBlank(endpointsBase64)) {
filterDirector.requestHeaderManager().putHeader(PowerApiHeader.X_CATALOG.toString(), endpointsBase64);
}
}
/**
* ExpirationDate
* token expiration date in x-token-expires header that follows http spec rfc1123 GMT time format
*/
private void setExpirationDate() {
if (cachableToken.getExpires()>0) {
HttpDate date = new HttpDate(new Date(cachableToken.getExpires()));
filterDirector.requestHeaderManager().putHeader(OpenStackServiceHeader.X_EXPIRATION.toString(), date.toRFC1123());
}
}
/**
* Default Region
* Default region of user
*/
private void setDefaultRegion(){
String region = cachableToken.getDefaultRegion();
if(!StringUtilities.isBlank(region)){
filterDirector.requestHeaderManager().putHeader(OpenStackServiceHeader.DEFAULT_REGION.toString(), region);
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
bcd84e37fd92ca9d7262ec4ed3f42816e659ba1b | eeba21320e1cabcc03d5d743ae7b819df955c500 | /src/lrsbp7saxparser/XMLLoader.java | a752cf437c0a97bb62cd57749798c7295d538021 | [] | no_license | lydsnyder/Java-Sax-Parser | fb21ffe896a380509cf12e2dcd2a418b0e7773b4 | b2109d6bfb7c02b6a123ef25b6bdef41f822222c | refs/heads/master | 2021-09-07T20:48:21.850495 | 2018-02-28T21:56:02 | 2018-02-28T21:57:03 | 123,346,020 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,132 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package lrsbp7saxparser;
import java.io.File;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/**
*
* @author Lydia
*/
public class XMLLoader {
public static Node load(File xmlFile) throws Exception {
Node rootNode = new Node();
rootNode.setTitle("Root");
try {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
DefaultHandler handler = new DefaultHandler() {
Node parentNode = null;
Node currentNode = rootNode;
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
//System.out.println("Start element:" + qName);
parentNode = currentNode;
currentNode = new Node();
currentNode.setParent(parentNode);
currentNode.setTitle(qName);
//System.out.println(qName);
int attributeNum = attributes.getLength();
int i;
for(i = 0; i < attributeNum; i++ ){
Attribute attribute = new Attribute();
attribute.setTitle(attributes.getQName(i));
attribute.setData(attributes.getValue(i));
//System.out.println("Attribute" + i +": " + attribute.getTitle() + ", " + attribute.getData() + "\n");
currentNode.addAttribute(attribute);
}
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
// at some point add child node to parent
//System.out.println("End element:" + qName);
if(parentNode != null) {
parentNode.addChild(currentNode);
System.out.println("Parent node is not null. Parent node:" + parentNode.getTitle() + "\n");
currentNode = parentNode;
parentNode = currentNode.getParent();
}
}
@Override
public void characters(char ch[], int start, int length) throws SAXException {
currentNode.setData(new String(ch, start, length));
}
};
saxParser.parse(xmlFile.getAbsoluteFile(), handler);
} catch (Exception e) {
throw e;
}
System.out.println("Size here:" + rootNode.getChildren().size());
return rootNode;
}
}
| [
"lrsbp7@mail.missouri.edu"
] | lrsbp7@mail.missouri.edu |
506f8e2ff5f765bb2adc28a88c59d7997dbba5c5 | 7efbda1bff2d304f9f86259ece5127dc9ee69111 | /BIServer/src/main/java/com/tonbeller/wcf/table/TableModelChangeListener.java | abaa176fdb51b7e579b2ea2a894870def4df5b62 | [] | no_license | kalyansvm/biproject | 8f1bafd57b4cb8affa443a394dee2e774b9a9992 | 482b461f3b05b33b9a468526c5a59ed98dd4551c | refs/heads/master | 2021-01-10T09:34:25.669950 | 2009-05-13T01:50:17 | 2009-05-13T01:50:17 | 50,026,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 668 | java | /*
* ====================================================================
* This software is subject to the terms of the Common Public License
* Agreement, available at the following URL:
* http://www.opensource.org/licenses/cpl.html .
* Copyright (C) 2003-2004 TONBELLER AG.
* All Rights Reserved.
* You must accept the terms of that agreement to use this software.
* ====================================================================
*
*
*/
package com.tonbeller.wcf.table;
import java.util.EventListener;
public interface TableModelChangeListener extends EventListener {
void tableModelChanged(TableModelChangeEvent event);
}
| [
"wuyiding@gmail.com"
] | wuyiding@gmail.com |
d35a434aad2038074d9493c20ad4dd5fd8225b94 | 765a421b9911bd1aa855c9802e35faf95be028d3 | /src/proyectoprogra/Componente.java | 2f198c8725999357e46dadc985ce03c0b28314c0 | [] | no_license | brmusic9957/AjedrezHexagonal | fb9c027773c765238fd70f7eae777130903ff60b | d7074c75d3fabea87db7366e6362d2ad371c1dbd | refs/heads/master | 2021-09-02T23:30:23.339599 | 2018-01-04T03:38:14 | 2018-01-04T03:38:14 | 115,671,811 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 472 | java | package proyectoprogra;
import javax.swing.JLabel;
public class Componente extends JLabel {
public static int CELDA = 1;
public static int PIEZA = 2;
private int tipo;
public Componente(int tipo, int size, int posx, int posy) {
this.tipo = tipo;
this.setBorder(null);
this.setSize(size, size);
this.setLocation(posx, posy);
this.setVisible(true);
}
public int getTipo() {
return tipo;
}
}
| [
"bruce dilan lopez velasquez"
] | bruce dilan lopez velasquez |
0ab3e4b394dde248f94dcd1dfd4793ff717458f7 | 51d351448a5ea1fd481a869ec3466e5c505539e1 | /CM5/deployment-tool/src/main/java/ru/intertrust/cm/deployment/tool/task/attachment/temp/AttachmentUnzipTempTask.java | 4838a8637ca0cff49dc555e9180ffdc510d5a47d | [
"Apache-2.0"
] | permissive | mrBertieWooster/ActiveFrame5 | b17fa77156981ad63d147fcd15a18a67e22bd824 | 3a8f0281b4f1fafa23db01027fa2e049f55c06d8 | refs/heads/master | 2020-11-30T03:18:12.028257 | 2019-12-26T15:36:17 | 2019-12-26T15:36:17 | 230,284,850 | 0 | 0 | null | 2019-12-26T15:19:53 | 2019-12-26T15:19:53 | null | UTF-8 | Java | false | false | 764 | java | package ru.intertrust.cm.deployment.tool.task.attachment.temp;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import ru.intertrust.cm.deployment.tool.task.TaskResult;
import ru.intertrust.cm.deployment.tool.task.attachment.AttachmentUnzipTask;
import static ru.intertrust.cm.deployment.tool.property.AttachmentType.TEMP_STORAGE;
/**
* Created by Alexander Bogatyrenko on 08.08.16.
* <p>
* This class represents...
*/
@Component
@Scope("prototype")
public class AttachmentUnzipTempTask extends AttachmentUnzipTask {
@Override
public TaskResult call() throws Exception {
String path = serverProperties.get(TEMP_STORAGE);
return new TaskResult(unzip(TEMP_STORAGE, path));
}
}
| [
"alexander.bogatyr@gmail.com"
] | alexander.bogatyr@gmail.com |
703bc20699795373364d0110d84e4fddfa6e7a26 | c9b8db6ceff0be3420542d0067854dea1a1e7b12 | /web/KoreanAir/src/main/java/com/ke/css/cimp/fwb/fwb13/Rule_SHIPPER_STATE_PROVINCE.java | 82eb1e141df32f7b18f34236d3710ede4486ab2a | [
"Apache-2.0"
] | permissive | ganzijo/portfolio | 12ae1531bd0f4d554c1fcfa7d68953d1c79cdf9a | a31834b23308be7b3a992451ab8140bef5a61728 | refs/heads/master | 2021-04-15T09:25:07.189213 | 2018-03-22T12:11:00 | 2018-03-22T12:11:00 | 126,326,291 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,250 | java | package com.ke.css.cimp.fwb.fwb13;
/* -----------------------------------------------------------------------------
* Rule_SHIPPER_STATE_PROVINCE.java
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Tue Mar 06 10:35:29 KST 2018
*
* -----------------------------------------------------------------------------
*/
import java.util.ArrayList;
final public class Rule_SHIPPER_STATE_PROVINCE extends Rule
{
public Rule_SHIPPER_STATE_PROVINCE(String spelling, ArrayList<Rule> rules)
{
super(spelling, rules);
}
public Object accept(Visitor visitor)
{
return visitor.visit(this);
}
public static Rule_SHIPPER_STATE_PROVINCE parse(ParserContext context)
{
context.push("SHIPPER_STATE_PROVINCE");
boolean parsed = true;
int s0 = context.index;
ParserAlternative a0 = new ParserAlternative(s0);
ArrayList<ParserAlternative> as1 = new ArrayList<ParserAlternative>();
parsed = false;
{
int s1 = context.index;
ParserAlternative a1 = new ParserAlternative(s1);
parsed = true;
if (parsed)
{
boolean f1 = true;
@SuppressWarnings("unused")
int c1 = 0;
for (int i1 = 0; i1 < 9 && f1; i1++)
{
Rule rule = Rule_Typ_Text.parse(context);
if ((f1 = rule != null))
{
a1.add(rule, context.index);
c1++;
}
}
parsed = true;
}
if (parsed)
{
as1.add(a1);
}
context.index = s1;
}
ParserAlternative b = ParserAlternative.getBest(as1);
parsed = b != null;
if (parsed)
{
a0.add(b.rules, b.end);
context.index = b.end;
}
Rule rule = null;
if (parsed)
{
rule = new Rule_SHIPPER_STATE_PROVINCE(context.text.substring(a0.start, a0.end), a0.rules);
}
else
{
context.index = s0;
}
context.pop("SHIPPER_STATE_PROVINCE", parsed);
return (Rule_SHIPPER_STATE_PROVINCE)rule;
}
}
/* -----------------------------------------------------------------------------
* eof
* -----------------------------------------------------------------------------
*/
| [
"whdnfka111@gmail.com"
] | whdnfka111@gmail.com |
a476787dad0df7b4d4c64de2fcb4874d32a77f69 | 6d60a8adbfdc498a28f3e3fef70366581aa0c5fd | /codebase/dataset/t1/2275_frag2.java | 3f0f0380823148b84ed2423e3c8db48b93135772 | [] | no_license | rayhan-ferdous/code2vec | 14268adaf9022d140a47a88129634398cd23cf8f | c8ca68a7a1053d0d09087b14d4c79a189ac0cf00 | refs/heads/master | 2022-03-09T08:40:18.035781 | 2022-02-27T23:57:44 | 2022-02-27T23:57:44 | 140,347,552 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 538 | java | public org.omg.CORBA.portable.OutputStream _invoke(String method, org.omg.CORBA.portable.InputStream _input, org.omg.CORBA.portable.ResponseHandler handler) throws org.omg.CORBA.SystemException {
org.omg.CORBA.portable.OutputStream _out = null;
java.lang.Integer opsIndex = (java.lang.Integer) m_opsHash.get(method);
if (null == opsIndex) throw new org.omg.CORBA.BAD_OPERATION(method + " not found");
switch(opsIndex.intValue()) {
case 0:
{
try {
| [
"aaponcseku@gmail.com"
] | aaponcseku@gmail.com |
2a85fb97436c565c812508141ca1c2de05afc96c | 7360a4690e7aac8f768eacde499fdc09c0195e55 | /Project01/src/main/java/StoreRunner.java | 8569313e0a2d0b9db2187818a68bd88e70d387c5 | [] | no_license | Gumennnik/JavaCourses_TeachMeSkills | e3f40c09cd34530ffbcb2ca3fee500a7c6baa539 | e102da71dd5003a66b702245757ecd5e8a5074a5 | refs/heads/master | 2022-06-24T08:28:48.970420 | 2019-07-04T20:32:34 | 2019-07-04T20:32:34 | 179,712,013 | 0 | 0 | null | 2022-06-21T01:17:48 | 2019-04-05T15:53:21 | Java | UTF-8 | Java | false | false | 29 | java | public class StoreRunner {
}
| [
"Gumennnik@rambler.ru"
] | Gumennnik@rambler.ru |
c25030970b1f5f005b21b91e3f52f8c3ffb176d4 | 60d0b76ed27d8afb01e08c8b8e3e9cfbce085091 | /src/model/entities/Department.java | 2ae2630123b0af2d6aba6fe21873fa73ac00fdbe | [] | no_license | crisaoo/demo-dao-jdbc | d95f3049183fdb06fc42ab1fa347d04d38b0ba3d | 0814144102db89c6bacb734001684cf9660b82f5 | refs/heads/master | 2022-11-10T10:59:05.141074 | 2020-07-01T19:10:34 | 2020-07-01T19:10:34 | 275,465,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,053 | java | package model.entities;
import java.io.Serializable;
public class Department implements Serializable{
private static final long serialVersionUID = 1L;
private Integer id;
private String name;
public Department() {}
public Department(Integer id, String name) {
this.id =id;
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Department other = (Department) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
@Override
public String toString() {
return "Department: " + name + ", ID: " + id;
}
} | [
"Cristianocosta2019@outlook.com"
] | Cristianocosta2019@outlook.com |
c9ac5d146874f393817cda3773f9578a4829cc10 | f2db7ebc9c1b82ee772bf5358dad363799a54557 | /BankOfAmerica/src/main/java/com/revature/driver/Driver.java | 75db555b95c2dbe67ebb47e7bfb627a768ceb795 | [] | no_license | 2010USFJava/HowardM | bd54d1166f84e9cb86f557a59b7aa1433138427d | ff14674b352a5d8c91d615ff41000b371f8201eb | refs/heads/master | 2023-01-18T17:49:12.348310 | 2020-11-18T15:37:26 | 2020-11-18T15:37:26 | 305,754,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package com.revature.driver;
import com.revature.menu.Menu;
import com.revature.users.User;
public class Driver {
public static void main(String[] args) {
User u1 = new User("Beyonce", "Knowles-Carter", "111 Main", "queenbey", "444");
Menu.greeting();
}
}
| [
"jay.m.howard@gmail.com"
] | jay.m.howard@gmail.com |
18587ec2a7eb97971ed367fb3fa2e83666de52c1 | ee56df0d8f4d58a6c3b45ed0d2cfb9e47b2e04e0 | /app/src/androidTest/java/com/example/javierescobar/tallerlistview/ExampleInstrumentedTest.java | e6da37e608f855b93296e449be9cdf984dadac92 | [] | no_license | javieresos12/Taller-de-List-View | 8edc7fb108cfc469fb62cec2a1b13fc094721073 | 80564d8edeb24770647d485268f11bc9307c7c40 | refs/heads/master | 2020-03-28T14:51:12.246266 | 2018-09-14T21:15:42 | 2018-09-14T21:15:42 | 148,529,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | package com.example.javierescobar.tallerlistview;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.javierescobar.tallerlistview", appContext.getPackageName());
}
}
| [
"javieresos12@gmail.com"
] | javieresos12@gmail.com |
f7787c82d8d57cce80818c1c2e289bfd09ef2e08 | 95a54e3f3617bf55883210f0b5753b896ad48549 | /java_src/com/liber8tech/tago/Constants.java | cf3031288ad58bc84e122c99e32a47dd9bb17818 | [] | no_license | aidyk/TagoApp | ffc5a8832fbf9f9819f7f8aa7af29149fbab9ea5 | e31a528c8f931df42075fc8694754be146eddc34 | refs/heads/master | 2022-12-22T02:20:58.486140 | 2021-05-16T07:42:02 | 2021-05-16T07:42:02 | 325,695,453 | 3 | 1 | null | 2022-12-16T00:32:10 | 2020-12-31T02:34:45 | Smali | UTF-8 | Java | false | false | 3,009 | java | package com.liber8tech.tago;
import java.io.File;
import kotlin.Metadata;
import org.jetbrains.annotations.NotNull;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0006\n\u0000\n\u0002\u0010\u000e\n\u0002\b\f\n\u0002\u0010\u0007\n\u0002\b\u0005\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u000e\u0010\u0003\u001a\u00020\u0004XT¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006XT¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0006XT¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0006XT¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0006XT¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u0006XT¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\u0006XT¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u0006XT¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u0006XT¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u0006XT¢\u0006\u0002\n\u0000R\u0011\u0010\u000f\u001a\u00020\u0006¢\u0006\b\n\u0000\u001a\u0004\b\u0010\u0010\u0011R\u001a\u0010\u0012\u001a\u00020\u0013X\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0014\u0010\u0015\"\u0004\b\u0016\u0010\u0017¨\u0006\u0018"}, d2 = {"Lcom/liber8tech/tago/Constants;", "", "()V", "PatternRatio", "", Constants.SignUpActivity, "", "autoUpload", Constants.collectionType, Constants.created, "currentPack", "isLogin", "pattern", "profile", Constants.purchased, "purchasedFolderPath", "getPurchasedFolderPath", "()Ljava/lang/String;", "tagoCameraGapHeightPx", "", "getTagoCameraGapHeightPx", "()F", "setTagoCameraGapHeightPx", "(F)V", "app_release"}, k = 1, mv = {1, 1, 13})
/* compiled from: Constants.kt */
public final class Constants {
public static final Constants INSTANCE = new Constants();
public static final double PatternRatio = 4.387096774193548d;
@NotNull
public static final String SignUpActivity = "SignUpActivity";
@NotNull
public static final String autoUpload = "AutoUpload";
@NotNull
public static final String collectionType = "collectionType";
@NotNull
public static final String created = "created";
@NotNull
public static final String currentPack = "Current_pack";
@NotNull
public static final String isLogin = "previousActivityLogin";
@NotNull
public static final String pattern = "Pattern";
@NotNull
public static final String profile = "profile";
@NotNull
public static final String purchased = "purchased";
@NotNull
private static final String purchasedFolderPath = (purchased + File.separator);
private static float tagoCameraGapHeightPx;
private Constants() {
}
public final float getTagoCameraGapHeightPx() {
return tagoCameraGapHeightPx;
}
public final void setTagoCameraGapHeightPx(float f) {
tagoCameraGapHeightPx = f;
}
@NotNull
public final String getPurchasedFolderPath() {
return purchasedFolderPath;
}
}
| [
"ai@AIs-MacBook-Pro.local"
] | ai@AIs-MacBook-Pro.local |
6588fa2d9acbf47e204f5d4c191ade179ed2dece | b5f6622cc5eaec6bfa146ee32e925c60b79cc787 | /src/Model/Payment.java | 4affb48220d5c5f62cb1f9a501c64bed00110d4a | [] | no_license | yasinduramanayake/itp_java | bb89d643154b62ee082644196314438eaf6b5d02 | 90f177f78f7d8262afe9f7e10b51150b9c1c01bd | refs/heads/master | 2023-03-05T10:50:39.544075 | 2021-02-06T08:27:19 | 2021-02-06T08:27:19 | 336,493,529 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,043 | java | package Model;
public class Payment {
private double Amount;
private String Email;
private int PhoneNo;
private String CrdName ;
private int CrdNo;
private String Ex_Date ;
private int CVV;
private int P_id;
private String name;
private int cus_id;
public int getCus_id() {
return cus_id;
}
public void setCus_id(int cus_id) {
this.cus_id = cus_id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/**
* @return the Amount
*/
public double getAmount() {
return Amount;
}
/**
* @param Amount the Amount to set
*/
public void setAmount(double Amount) {
this.Amount = Amount;
}
/**
* @return the PhoneNo
*/
public int getPhoneNo() {
return PhoneNo;
}
/**
* @param PhoneNo the PhoneNo to set
*/
public void setPhoneNo(int PhoneNo) {
this. PhoneNo = PhoneNo;
}
/**
* @return the Email
*/
public String getEmail() {
return Email;
}
/**
* @param Email the Email to set
*/
public void setEmail(String Email) {
this. Email = Email;
}
/**
* @return the CrdName
*/
public String getCrdName() {
return CrdName;
}
/**
* @param the CrdName to set
*/
public void setCrdName(String CrdName ) {
this. CrdName = CrdName ;
}
/**
* @return the CrdNo
*/
public int getCrdNo() {
return CrdNo;
}
/**
* @param CrdNo the CrdNo to set
*/
public void setCrdNo(int CrdNo) {
this. CrdNo = CrdNo;
}
/**
* @return the CVV
*/
public int getCVV() {
return CVV;
}
/**
* @param CVV the CVV to set
*/
public void setCVV(int CVV) {
this. CVV = CVV;
}
/**
* @return the Ex_Date
*/
public String getEx_Date() {
return Ex_Date;
}
/**
* @param Ex_Date the Ex_Date to set
*/
public void setEx_Date(String Ex_Date) {
this. Ex_Date = Ex_Date;
}
/**
* @return the P_id
*/
public int getP_id() {
return P_id;
}
/**
* @param P_id the P_id to set
*/
public void setP_id(int P_id) {
this. P_id = P_id;
}
}
| [
"yasinduramanayake123@gmail.com"
] | yasinduramanayake123@gmail.com |
261034fe850bb7d8b2bef1daff8d02391d58eaea | 1385f704f09e5d2239773b539229f86e5a3df003 | /dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java | 223236d6b08e34eefe50e1fc88be4d92e02e13f4 | [
"BSD-3-Clause"
] | permissive | hispindia/PLAN-2.22 | 685af400a458d2dd5d79e1a51c2338c6f60d65b8 | e25d2d4eb2164f8f6f84208334e60768a96c7543 | refs/heads/master | 2020-05-25T14:13:00.336780 | 2017-03-14T11:07:57 | 2017-03-14T11:07:57 | 84,938,376 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 46,702 | java | package org.hisp.dhis.common;
/*
* Copyright (c) 2004-2016, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the HISP project nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import static org.hisp.dhis.common.DimensionalObject.CATEGORYOPTIONCOMBO_DIM_ID;
import static org.hisp.dhis.common.DimensionalObject.DATA_COLLAPSED_DIM_ID;
import static org.hisp.dhis.common.DimensionalObject.DATA_X_DIM_ID;
import static org.hisp.dhis.common.DimensionalObject.DIMENSION_SEP;
import static org.hisp.dhis.common.DimensionalObject.ORGUNIT_DIM_ID;
import static org.hisp.dhis.common.DimensionalObject.PERIOD_DIM_ID;
import static org.hisp.dhis.common.DimensionalObject.STATIC_DIMS;
import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_LEVEL;
import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_ORGUNIT_GROUP;
import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_USER_ORGUNIT;
import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_USER_ORGUNIT_CHILDREN;
import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_USER_ORGUNIT_GRANDCHILDREN;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.analytics.AggregationType;
import org.hisp.dhis.common.adapter.JacksonPeriodDeserializer;
import org.hisp.dhis.common.adapter.JacksonPeriodSerializer;
import org.hisp.dhis.common.annotation.Scanned;
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.DimensionalView;
import org.hisp.dhis.common.view.ExportView;
import org.hisp.dhis.dataelement.CategoryOptionGroup;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryDimension;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.period.ConfigurablePeriod;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.RelativePeriodEnum;
import org.hisp.dhis.period.RelativePeriods;
import org.hisp.dhis.period.comparator.AscendingPeriodComparator;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.trackedentity.TrackedEntityAttributeDimension;
import org.hisp.dhis.trackedentity.TrackedEntityDataElementDimension;
import org.hisp.dhis.trackedentity.TrackedEntityProgramIndicatorDimension;
import org.hisp.dhis.user.User;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
/**
* This class contains associations to dimensional meta-data. Should typically
* be sub-classed by analytical objects like tables, maps and charts.
* <p/>
* Implementation note: Objects currently managing this class are AnalyticsService,
* DefaultDimensionService and the getDimensionalObject and getDimensionalObjectList
* methods of this class.
*
* @author Lars Helge Overland
*/
@JacksonXmlRootElement( localName = "analyticalObject", namespace = DxfNamespaces.DXF_2_0 )
public abstract class BaseAnalyticalObject
extends BaseIdentifiableObject
implements AnalyticalObject
{
public static final int ASC = -1;
public static final int DESC = 1;
public static final int NONE = 0;
// -------------------------------------------------------------------------
// Persisted properties
// -------------------------------------------------------------------------
protected List<DataDimensionItem> dataDimensionItems = new ArrayList<>();
@Scanned
protected List<OrganisationUnit> organisationUnits = new ArrayList<>();
@Scanned
protected List<Period> periods = new ArrayList<>();
protected RelativePeriods relatives;
@Scanned
protected List<DataElementGroup> dataElementGroups = new ArrayList<>();
@Scanned
protected List<OrganisationUnitGroup> organisationUnitGroups = new ArrayList<>();
@Scanned
protected List<Integer> organisationUnitLevels = new ArrayList<>();
@Scanned
protected List<DataElementCategoryDimension> categoryDimensions = new ArrayList<>();
@Scanned
protected List<CategoryOptionGroup> categoryOptionGroups = new ArrayList<>();
@Scanned
protected List<TrackedEntityAttributeDimension> attributeDimensions = new ArrayList<>();
@Scanned
protected List<TrackedEntityDataElementDimension> dataElementDimensions = new ArrayList<>();
@Scanned
protected List<TrackedEntityProgramIndicatorDimension> programIndicatorDimensions = new ArrayList<>();
private Program program;
protected boolean userOrganisationUnit;
protected boolean userOrganisationUnitChildren;
protected boolean userOrganisationUnitGrandChildren;
@Scanned
protected List<OrganisationUnitGroup> itemOrganisationUnitGroups = new ArrayList<>();
protected DigitGroupSeparator digitGroupSeparator;
protected int sortOrder;
protected int topLimit;
protected AggregationType aggregationType;
protected boolean completedOnly;
// -------------------------------------------------------------------------
// Analytical properties
// -------------------------------------------------------------------------
protected transient List<DimensionalObject> columns = new ArrayList<>();
protected transient List<DimensionalObject> rows = new ArrayList<>();
protected transient List<DimensionalObject> filters = new ArrayList<>();
protected transient Map<String, String> parentGraphMap = new HashMap<>();
// -------------------------------------------------------------------------
// Transient properties
// -------------------------------------------------------------------------
protected transient List<OrganisationUnit> transientOrganisationUnits = new ArrayList<>();
protected transient List<DataElementCategoryOptionCombo> transientCategoryOptionCombos = new ArrayList<>();
protected transient Date relativePeriodDate;
protected transient OrganisationUnit relativeOrganisationUnit;
// -------------------------------------------------------------------------
// Logic
// -------------------------------------------------------------------------
public abstract void init( User user, Date date, OrganisationUnit organisationUnit,
List<OrganisationUnit> organisationUnitsAtLevel, List<OrganisationUnit> organisationUnitsInGroups, I18nFormat format );
@Override
public abstract void populateAnalyticalProperties();
public boolean hasUserOrgUnit()
{
return userOrganisationUnit || userOrganisationUnitChildren || userOrganisationUnitGrandChildren;
}
public boolean hasRelativePeriods()
{
return relatives != null && !relatives.isEmpty();
}
public boolean hasOrganisationUnitLevels()
{
return organisationUnitLevels != null && !organisationUnitLevels.isEmpty();
}
public boolean hasItemOrganisationUnitGroups()
{
return itemOrganisationUnitGroups != null && !itemOrganisationUnitGroups.isEmpty();
}
public boolean hasSortOrder()
{
return sortOrder != 0;
}
protected void addTransientOrganisationUnits( Collection<OrganisationUnit> organisationUnits )
{
if ( organisationUnits != null )
{
this.transientOrganisationUnits.addAll( organisationUnits );
}
}
protected void addTransientOrganisationUnit( OrganisationUnit organisationUnit )
{
if ( organisationUnit != null )
{
this.transientOrganisationUnits.add( organisationUnit );
}
}
/**
* Returns dimension items for data dimensions.
*/
public List<DimensionalItemObject> getDataDimensionNameableObjects()
{
return dataDimensionItems.stream().map( DataDimensionItem::getDimensionalItemObject ).collect( Collectors.toList() );
}
/**
* Adds a data dimension object.
*
* @return true if a data dimension was added, false if not.
*/
public boolean addDataDimensionItem( DimensionalItemObject object )
{
if ( object != null && DataDimensionItem.DATA_DIMENSION_CLASSES.contains( object.getClass() ) )
{
return dataDimensionItems.add( DataDimensionItem.create( object ) );
}
return false;
}
/**
* Removes a data dimension object.
*
* @return true if a data dimension was removed, false if not.
*/
public boolean removeDataDimensionItem( DimensionalItemObject object )
{
if ( object != null && DataDimensionItem.DATA_DIMENSION_CLASSES.contains( object.getClass() ) )
{
return dataDimensionItems.remove( DataDimensionItem.create( object ) );
}
return false;
}
/**
* Adds all given data dimension objects.
*/
public void addAllDataDimensionItems( Collection<? extends DimensionalItemObject> objects )
{
for ( DimensionalItemObject object : objects )
{
addDataDimensionItem( object );
}
}
/**
* Returns all data elements in the data dimensions. The returned list is
* immutable.
*/
@JsonIgnore
public List<DataElement> getDataElements()
{
return ImmutableList.copyOf( dataDimensionItems.stream().
filter( i -> i.getDataElement() != null ).
map( DataDimensionItem::getDataElement ).collect( Collectors.toList() ) );
}
/**
* Returns all indicators in the data dimensions. The returned list is
* immutable.
*/
@JsonIgnore
public List<Indicator> getIndicators()
{
return ImmutableList.copyOf( dataDimensionItems.stream().
filter( i -> i.getIndicator() != null ).
map( DataDimensionItem::getIndicator ).collect( Collectors.toList() ) );
}
/**
* Assembles a DimensionalObject based on the persisted properties of this
* AnalyticalObject. Collapses indicators, data elements, data element
* operands and data sets into the dx dimension.
* <p/>
* Collapses fixed and relative periods into the pe dimension. Collapses
* fixed and user organisation units into the ou dimension.
*
* @param dimension the dimension identifier.
* @param date the date used for generating relative periods.
* @param user the current user.
* @param dynamicNames whether to use dynamic or static names.
* @param format the I18nFormat.
* @return a DimensionalObject.
*/
protected DimensionalObject getDimensionalObject( String dimension, Date date, User user, boolean dynamicNames,
List<OrganisationUnit> organisationUnitsAtLevel, List<OrganisationUnit> organisationUnitsInGroups, I18nFormat format )
{
List<DimensionalItemObject> items = new ArrayList<>();
DimensionType type = null;
List<String> categoryDims = getCategoryDims();
if ( DATA_X_DIM_ID.equals( dimension ) )
{
items.addAll( getDataDimensionNameableObjects() );
type = DimensionType.DATA_X;
}
else if ( PERIOD_DIM_ID.equals( dimension ) )
{
setPeriodNames( periods, dynamicNames, format );
items.addAll( periods );
if ( hasRelativePeriods() )
{
items.addAll( relatives.getRelativePeriods( date, format, dynamicNames ) );
}
type = DimensionType.PERIOD;
}
else if ( ORGUNIT_DIM_ID.equals( dimension ) )
{
items.addAll( organisationUnits );
items.addAll( transientOrganisationUnits );
if ( userOrganisationUnit && user != null && user.hasOrganisationUnit() )
{
items.add( user.getOrganisationUnit() );
}
if ( userOrganisationUnitChildren && user != null && user.hasOrganisationUnit() )
{
items.addAll( user.getOrganisationUnit().getSortedChildren() );
}
if ( userOrganisationUnitGrandChildren && user != null && user.hasOrganisationUnit() )
{
items.addAll( user.getOrganisationUnit().getSortedGrandChildren() );
}
if ( organisationUnitLevels != null && !organisationUnitLevels.isEmpty() && organisationUnitsAtLevel != null )
{
items.addAll( organisationUnitsAtLevel ); // Must be set externally
}
if ( itemOrganisationUnitGroups != null && !itemOrganisationUnitGroups.isEmpty() && organisationUnitsInGroups != null )
{
items.addAll( organisationUnitsInGroups ); // Must be set externally
}
type = DimensionType.ORGANISATIONUNIT;
}
else if ( CATEGORYOPTIONCOMBO_DIM_ID.equals( dimension ) )
{
items.addAll( transientCategoryOptionCombos );
type = DimensionType.CATEGORY_OPTION_COMBO;
}
else if ( categoryDims.contains( dimension ) )
{
DataElementCategoryDimension categoryDimension = categoryDimensions.get( categoryDims.indexOf( dimension ) );
items.addAll( categoryDimension.getItems() );
type = DimensionType.CATEGORY;
}
else if ( STATIC_DIMS.contains( dimension ) )
{
type = DimensionType.STATIC;
}
else
{
// Data element group set
ListMap<String, DimensionalItemObject> deGroupMap = new ListMap<>();
for ( DataElementGroup group : dataElementGroups )
{
if ( group.getGroupSet() != null )
{
deGroupMap.putValue( group.getGroupSet().getDimension(), group );
}
}
if ( deGroupMap.containsKey( dimension ) )
{
items.addAll( deGroupMap.get( dimension ) );
type = DimensionType.DATAELEMENT_GROUPSET;
}
// Organisation unit group set
ListMap<String, DimensionalItemObject> ouGroupMap = new ListMap<>();
for ( OrganisationUnitGroup group : organisationUnitGroups )
{
if ( group.getGroupSet() != null )
{
ouGroupMap.putValue( group.getGroupSet().getUid(), group );
}
}
if ( ouGroupMap.containsKey( dimension ) )
{
items.addAll( ouGroupMap.get( dimension ) );
type = DimensionType.ORGANISATIONUNIT_GROUPSET;
}
// Category option group set
ListMap<String, DimensionalItemObject> coGroupMap = new ListMap<>();
for ( CategoryOptionGroup group : categoryOptionGroups )
{
if ( group.getGroupSet() != null )
{
coGroupMap.putValue( group.getGroupSet().getUid(), group );
}
}
if ( coGroupMap.containsKey( dimension ) )
{
items.addAll( coGroupMap.get( dimension ) );
type = DimensionType.CATEGORYOPTION_GROUPSET;
}
// Tracked entity attribute
Map<String, TrackedEntityAttributeDimension> attributes = Maps.uniqueIndex( attributeDimensions, TrackedEntityAttributeDimension::getUid );
if ( attributes.containsKey( dimension ) )
{
TrackedEntityAttributeDimension tead = attributes.get( dimension );
return new BaseDimensionalObject( dimension, DimensionType.PROGRAM_ATTRIBUTE, null, tead.getDisplayName(), tead.getLegendSet(), tead.getFilter() );
}
// Tracked entity data element
Map<String, TrackedEntityDataElementDimension> dataElements = Maps.uniqueIndex( dataElementDimensions, TrackedEntityDataElementDimension::getUid );
if ( dataElements.containsKey( dimension ) )
{
TrackedEntityDataElementDimension tedd = dataElements.get( dimension );
return new BaseDimensionalObject( dimension, DimensionType.PROGRAM_DATAELEMENT, null, tedd.getDisplayName(), tedd.getLegendSet(), tedd.getFilter() );
}
// Tracked entity program indicator
Map<String, TrackedEntityProgramIndicatorDimension> programIndicators = Maps.uniqueIndex( programIndicatorDimensions, TrackedEntityProgramIndicatorDimension::getUid );
if ( programIndicators.containsKey( dimension ) )
{
TrackedEntityProgramIndicatorDimension teid = programIndicators.get( dimension );
return new BaseDimensionalObject( dimension, DimensionType.PROGRAM_INDICATOR, null, teid.getDisplayName(), teid.getLegendSet(), teid.getFilter() );
}
}
IdentifiableObjectUtils.removeDuplicates( items );
return new BaseDimensionalObject( dimension, type, items );
}
/**
* Assembles a list of DimensionalObjects based on the concrete objects in
* this BaseAnalyticalObject.
* <p/>
* Merges fixed and relative periods into the pe dimension, where the
* RelativePeriods object is represented by enums (e.g. LAST_MONTH). Merges
* fixed and user organisation units into the ou dimension, where user
* organisation units properties are represented by enums (e.g. USER_ORG_UNIT).
* <p/>
* This method is useful when serializing the AnalyticalObject.
*
* @param dimension the dimension identifier.
* @return a list of DimensionalObjects.
*/
protected DimensionalObject getDimensionalObject( String dimension )
{
List<String> categoryDims = getCategoryDims();
if ( DATA_X_DIM_ID.equals( dimension ) )
{
return new BaseDimensionalObject( dimension, DimensionType.DATA_X, getDataDimensionNameableObjects() );
}
else if ( PERIOD_DIM_ID.equals( dimension ) )
{
List<Period> periodList = new ArrayList<>( periods );
if ( hasRelativePeriods() )
{
List<RelativePeriodEnum> list = relatives.getRelativePeriodEnums();
for ( RelativePeriodEnum periodEnum : list )
{
periodList.add( new ConfigurablePeriod( periodEnum.toString() ) );
}
}
Collections.sort( periodList, new AscendingPeriodComparator() );
return new BaseDimensionalObject( dimension, DimensionType.PERIOD, periodList );
}
else if ( ORGUNIT_DIM_ID.equals( dimension ) )
{
List<DimensionalItemObject> ouList = new ArrayList<>();
ouList.addAll( organisationUnits );
ouList.addAll( transientOrganisationUnits );
if ( userOrganisationUnit )
{
ouList.add( new BaseDimensionalItemObject( KEY_USER_ORGUNIT ) );
}
if ( userOrganisationUnitChildren )
{
ouList.add( new BaseDimensionalItemObject( KEY_USER_ORGUNIT_CHILDREN ) );
}
if ( userOrganisationUnitGrandChildren )
{
ouList.add( new BaseDimensionalItemObject( KEY_USER_ORGUNIT_GRANDCHILDREN ) );
}
if ( organisationUnitLevels != null && !organisationUnitLevels.isEmpty() )
{
for ( Integer level : organisationUnitLevels )
{
String id = KEY_LEVEL + level;
ouList.add( new BaseDimensionalItemObject( id ) );
}
}
if ( itemOrganisationUnitGroups != null && !itemOrganisationUnitGroups.isEmpty() )
{
for ( OrganisationUnitGroup group : itemOrganisationUnitGroups )
{
String id = KEY_ORGUNIT_GROUP + group.getUid();
ouList.add( new BaseDimensionalItemObject( id ) );
}
}
return new BaseDimensionalObject( dimension, DimensionType.ORGANISATIONUNIT, ouList );
}
else if ( CATEGORYOPTIONCOMBO_DIM_ID.equals( dimension ) )
{
return new BaseDimensionalObject( dimension, DimensionType.CATEGORY_OPTION_COMBO, new ArrayList<DimensionalItemObject>() ) ;
}
else if ( categoryDims.contains( dimension ) )
{
DataElementCategoryDimension categoryDimension = categoryDimensions.get( categoryDims.indexOf( dimension ) );
return new BaseDimensionalObject( dimension, DimensionType.CATEGORY, categoryDimension.getItems() );
}
else if ( DATA_COLLAPSED_DIM_ID.contains( dimension ) )
{
return new BaseDimensionalObject( dimension, DimensionType.DATA_COLLAPSED, new ArrayList<>() );
}
else if ( STATIC_DIMS.contains( dimension ) )
{
return new BaseDimensionalObject( dimension, DimensionType.STATIC, new ArrayList<>() );
}
else
{
// Data element group set
ListMap<String, DimensionalItemObject> deGroupMap = new ListMap<>();
for ( DataElementGroup group : dataElementGroups )
{
if ( group.getGroupSet() != null )
{
deGroupMap.putValue( group.getGroupSet().getDimension(), group );
}
}
if ( deGroupMap.containsKey( dimension ) )
{
return new BaseDimensionalObject( dimension, DimensionType.DATAELEMENT_GROUPSET, deGroupMap.get( dimension ) );
}
// Organisation unit group set
ListMap<String, DimensionalItemObject> ouGroupMap = new ListMap<>();
for ( OrganisationUnitGroup group : organisationUnitGroups )
{
if ( group.getGroupSet() != null )
{
ouGroupMap.putValue( group.getGroupSet().getUid(), group );
}
}
if ( ouGroupMap.containsKey( dimension ) )
{
return new BaseDimensionalObject( dimension, DimensionType.ORGANISATIONUNIT_GROUPSET, ouGroupMap.get( dimension ) );
}
// Category option group set
ListMap<String, DimensionalItemObject> coGroupMap = new ListMap<>();
for ( CategoryOptionGroup group : categoryOptionGroups )
{
if ( group.getGroupSet() != null )
{
coGroupMap.putValue( group.getGroupSet().getUid(), group );
}
}
if ( coGroupMap.containsKey( dimension ) )
{
return new BaseDimensionalObject( dimension, DimensionType.CATEGORYOPTION_GROUPSET, coGroupMap.get( dimension ) );
}
// Tracked entity attribute
Map<String, TrackedEntityAttributeDimension> attributes = Maps.uniqueIndex( attributeDimensions, TrackedEntityAttributeDimension::getUid );
if ( attributes.containsKey( dimension ) )
{
TrackedEntityAttributeDimension tead = attributes.get( dimension );
return new BaseDimensionalObject( dimension, DimensionType.PROGRAM_ATTRIBUTE, null, tead.getDisplayName(), tead.getLegendSet(), tead.getFilter() );
}
// Tracked entity data element
Map<String, TrackedEntityDataElementDimension> dataElements = Maps.uniqueIndex( dataElementDimensions, TrackedEntityDataElementDimension::getUid );
if ( dataElements.containsKey( dimension ) )
{
TrackedEntityDataElementDimension tedd = dataElements.get( dimension );
return new BaseDimensionalObject( dimension, DimensionType.PROGRAM_DATAELEMENT, null, tedd.getDisplayName(), tedd.getLegendSet(), tedd.getFilter() );
}
// Tracked entity program indicator
Map<String, TrackedEntityProgramIndicatorDimension> programIndicators = Maps.uniqueIndex( programIndicatorDimensions, TrackedEntityProgramIndicatorDimension::getUid );
if ( programIndicators.containsKey( dimension ) )
{
TrackedEntityProgramIndicatorDimension teid = programIndicators.get( dimension );
return new BaseDimensionalObject( dimension, DimensionType.PROGRAM_INDICATOR, null, teid.getDisplayName(), teid.getLegendSet(), teid.getFilter() );
}
}
throw new IllegalArgumentException( "Not a valid dimension: " + dimension );
}
private List<String> getCategoryDims()
{
List<String> categoryDims = new ArrayList<>();
for ( DataElementCategoryDimension dim : categoryDimensions )
{
categoryDims.add( dim.getDimension().getDimension() );
}
return categoryDims;
}
private void setPeriodNames( List<Period> periods, boolean dynamicNames, I18nFormat format )
{
for ( Period period : periods )
{
RelativePeriods.setName( period, null, dynamicNames, format );
}
}
/**
* Sorts the keys in the given map by splitting on the '-' character and
* sorting the components alphabetically.
*
* @param valueMap the mapping of keys and values.
*/
public static void sortKeys( Map<String, Object> valueMap )
{
Map<String, Object> map = new HashMap<>();
for ( String key : valueMap.keySet() )
{
String sortKey = sortKey( key );
if ( sortKey != null )
{
map.put( sortKey, valueMap.get( key ) );
}
}
valueMap.clear();
valueMap.putAll( map );
}
/**
* Sorts the given key by splitting on the '-' character and sorting the
* components alphabetically.
*
* @param valueMap the mapping of keys and values.
*/
public static String sortKey( String key )
{
if ( key != null )
{
String[] ids = key.split( DIMENSION_SEP );
Collections.sort( Arrays.asList( ids ) );
key = StringUtils.join( ids, DIMENSION_SEP );
}
return key;
}
/**
* Generates an identifier based on the given lists of NameableObjects. Uses
* the UIDs for each NameableObject, sorts them and writes them out as a key.
*/
public static String getIdentifier( List<DimensionalItemObject> column, List<DimensionalItemObject> row )
{
List<String> ids = new ArrayList<>();
List<DimensionalItemObject> dimensions = new ArrayList<>();
dimensions.addAll( column != null ? column : new ArrayList<>() );
dimensions.addAll( row != null ? row : new ArrayList<>() );
for ( DimensionalItemObject item : dimensions )
{
ids.add( item.getDimensionItem() );
}
Collections.sort( ids );
return StringUtils.join( ids, DIMENSION_SEP );
}
/**
* Returns meta-data mapping for this analytical object. Includes a identifier
* to name mapping for dynamic dimensions.
*/
public Map<String, String> getMetaData()
{
Map<String, String> meta = new HashMap<>();
for ( DataElementGroup group : dataElementGroups )
{
meta.put( group.getGroupSet().getUid(), group.getGroupSet().getName() );
}
for ( OrganisationUnitGroup group : organisationUnitGroups )
{
meta.put( group.getGroupSet().getUid(), group.getGroupSet().getName() );
}
for ( DataElementCategoryDimension category : categoryDimensions )
{
meta.put( category.getDimension().getUid(), category.getDimension().getName() );
}
return meta;
}
/**
* Clear or set to false all persistent dimensional (not option) properties for this object.
*/
public void clear()
{
dataDimensionItems.clear();
periods.clear();
relatives = null;
organisationUnits.clear();
dataElementGroups.clear();
organisationUnitGroups.clear();
organisationUnitLevels.clear();
categoryDimensions.clear();
categoryOptionGroups.clear();
attributeDimensions.clear();
dataElementDimensions.clear();
programIndicatorDimensions.clear();
userOrganisationUnit = false;
userOrganisationUnitChildren = false;
userOrganisationUnitGrandChildren = false;
itemOrganisationUnitGroups.clear();
}
@Override
public void mergeWith( IdentifiableObject other, MergeStrategy strategy )
{
super.mergeWith( other, strategy );
if ( other.getClass().isInstance( this ) )
{
BaseAnalyticalObject object = (BaseAnalyticalObject) other;
this.clear();
if ( strategy.isReplace() )
{
relatives = object.getRelatives();
program = object.getProgram();
aggregationType = object.getAggregationType();
}
else if ( strategy.isMerge() )
{
relatives = object.getRelatives() == null ? relatives : object.getRelatives();
program = object.getProgram() == null ? program : object.getProgram();
aggregationType = object.getAggregationType() == null ? aggregationType : object.getAggregationType();
}
dataDimensionItems.addAll( object.getDataDimensionItems() );
periods.addAll( object.getPeriods() );
organisationUnits.addAll( object.getOrganisationUnits() );
dataElementGroups.addAll( object.getDataElementGroups() );
organisationUnitGroups.addAll( object.getOrganisationUnitGroups() );
organisationUnitLevels.addAll( object.getOrganisationUnitLevels() );
categoryDimensions.addAll( object.getCategoryDimensions() );
categoryOptionGroups.addAll( object.getCategoryOptionGroups() );
attributeDimensions.addAll( object.getAttributeDimensions() );
dataElementDimensions.addAll( object.getDataElementDimensions() );
programIndicatorDimensions.addAll( object.getProgramIndicatorDimensions() );
userOrganisationUnitChildren = object.isUserOrganisationUnitChildren();
userOrganisationUnitGrandChildren = object.isUserOrganisationUnitGrandChildren();
itemOrganisationUnitGroups = object.getItemOrganisationUnitGroups();
digitGroupSeparator = object.getDigitGroupSeparator();
userOrganisationUnit = object.isUserOrganisationUnit();
sortOrder = object.getSortOrder();
topLimit = object.getTopLimit();
completedOnly = object.isCompletedOnly();
}
}
// -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "dataDimensionItems", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "dataDimensionItem", namespace = DxfNamespaces.DXF_2_0 )
public List<DataDimensionItem> getDataDimensionItems()
{
return dataDimensionItems;
}
public void setDataDimensionItems( List<DataDimensionItem> dataDimensionItems )
{
this.dataDimensionItems = dataDimensionItems;
}
@JsonProperty
@JsonSerialize( contentAs = BaseNameableObject.class )
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "organisationUnits", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "organisationUnit", namespace = DxfNamespaces.DXF_2_0 )
public List<OrganisationUnit> getOrganisationUnits()
{
return organisationUnits;
}
public void setOrganisationUnits( List<OrganisationUnit> organisationUnits )
{
this.organisationUnits = organisationUnits;
}
@JsonProperty
@JsonSerialize( contentUsing = JacksonPeriodSerializer.class )
@JsonDeserialize( contentUsing = JacksonPeriodDeserializer.class )
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "periods", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "period", namespace = DxfNamespaces.DXF_2_0 )
public List<Period> getPeriods()
{
return periods;
}
public void setPeriods( List<Period> periods )
{
this.periods = periods;
}
@JsonProperty( value = "relativePeriods" )
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public RelativePeriods getRelatives()
{
return relatives;
}
public void setRelatives( RelativePeriods relatives )
{
this.relatives = relatives;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "dataElementGroups", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "dataElementGroup", namespace = DxfNamespaces.DXF_2_0 )
public List<DataElementGroup> getDataElementGroups()
{
return dataElementGroups;
}
public void setDataElementGroups( List<DataElementGroup> dataElementGroups )
{
this.dataElementGroups = dataElementGroups;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "organisationUnitGroups", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "organisationUnitGroup", namespace = DxfNamespaces.DXF_2_0 )
public List<OrganisationUnitGroup> getOrganisationUnitGroups()
{
return organisationUnitGroups;
}
public void setOrganisationUnitGroups( List<OrganisationUnitGroup> organisationUnitGroups )
{
this.organisationUnitGroups = organisationUnitGroups;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "organisationUnitLevels", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "organisationUnitLevel", namespace = DxfNamespaces.DXF_2_0 )
public List<Integer> getOrganisationUnitLevels()
{
return organisationUnitLevels;
}
public void setOrganisationUnitLevels( List<Integer> organisationUnitLevels )
{
this.organisationUnitLevels = organisationUnitLevels;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "categoryDimensions", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "categoryDimension", namespace = DxfNamespaces.DXF_2_0 )
public List<DataElementCategoryDimension> getCategoryDimensions()
{
return categoryDimensions;
}
public void setCategoryDimensions( List<DataElementCategoryDimension> categoryDimensions )
{
this.categoryDimensions = categoryDimensions;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "categoryOptionGroups", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "categoryOptionGroup", namespace = DxfNamespaces.DXF_2_0 )
public List<CategoryOptionGroup> getCategoryOptionGroups()
{
return categoryOptionGroups;
}
public void setCategoryOptionGroups( List<CategoryOptionGroup> categoryOptionGroups )
{
this.categoryOptionGroups = categoryOptionGroups;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "attributeDimensions", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "attributeDimension", namespace = DxfNamespaces.DXF_2_0 )
public List<TrackedEntityAttributeDimension> getAttributeDimensions()
{
return attributeDimensions;
}
public void setAttributeDimensions( List<TrackedEntityAttributeDimension> attributeDimensions )
{
this.attributeDimensions = attributeDimensions;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "dataElementDimensions", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "dataElementDimension", namespace = DxfNamespaces.DXF_2_0 )
public List<TrackedEntityDataElementDimension> getDataElementDimensions()
{
return dataElementDimensions;
}
public void setDataElementDimensions( List<TrackedEntityDataElementDimension> dataElementDimensions )
{
this.dataElementDimensions = dataElementDimensions;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "programIndicatorDimensions", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "programIndicatorDimension", namespace = DxfNamespaces.DXF_2_0 )
public List<TrackedEntityProgramIndicatorDimension> getProgramIndicatorDimensions()
{
return programIndicatorDimensions;
}
public void setProgramIndicatorDimensions( List<TrackedEntityProgramIndicatorDimension> programIndicatorDimensions )
{
this.programIndicatorDimensions = programIndicatorDimensions;
}
@JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public Program getProgram()
{
return program;
}
public void setProgram( Program program )
{
this.program = program;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public boolean isUserOrganisationUnit()
{
return userOrganisationUnit;
}
public void setUserOrganisationUnit( boolean userOrganisationUnit )
{
this.userOrganisationUnit = userOrganisationUnit;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public boolean isUserOrganisationUnitChildren()
{
return userOrganisationUnitChildren;
}
public void setUserOrganisationUnitChildren( boolean userOrganisationUnitChildren )
{
this.userOrganisationUnitChildren = userOrganisationUnitChildren;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public boolean isUserOrganisationUnitGrandChildren()
{
return userOrganisationUnitGrandChildren;
}
public void setUserOrganisationUnitGrandChildren( boolean userOrganisationUnitGrandChildren )
{
this.userOrganisationUnitGrandChildren = userOrganisationUnitGrandChildren;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "itemOrganisationUnitGroups", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "itemOrganisationUnitGroup", namespace = DxfNamespaces.DXF_2_0 )
public List<OrganisationUnitGroup> getItemOrganisationUnitGroups()
{
return itemOrganisationUnitGroups;
}
public void setItemOrganisationUnitGroups( List<OrganisationUnitGroup> itemOrganisationUnitGroups )
{
this.itemOrganisationUnitGroups = itemOrganisationUnitGroups;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public DigitGroupSeparator getDigitGroupSeparator()
{
return digitGroupSeparator;
}
public void setDigitGroupSeparator( DigitGroupSeparator digitGroupSeparator )
{
this.digitGroupSeparator = digitGroupSeparator;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public int getSortOrder()
{
return sortOrder;
}
public void setSortOrder( int sortOrder )
{
this.sortOrder = sortOrder;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public int getTopLimit()
{
return topLimit;
}
public void setTopLimit( int topLimit )
{
this.topLimit = topLimit;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public AggregationType getAggregationType()
{
return aggregationType;
}
public void setAggregationType( AggregationType aggregationType )
{
this.aggregationType = aggregationType;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public boolean isCompletedOnly()
{
return completedOnly;
}
public void setCompletedOnly( boolean completedOnly )
{
this.completedOnly = completedOnly;
}
// -------------------------------------------------------------------------
// Transient properties
// -------------------------------------------------------------------------
@JsonIgnore
public List<OrganisationUnit> getTransientOrganisationUnits()
{
return transientOrganisationUnits;
}
@Override
@JsonIgnore
public Date getRelativePeriodDate()
{
return relativePeriodDate;
}
@Override
@JsonIgnore
public OrganisationUnit getRelativeOrganisationUnit()
{
return relativeOrganisationUnit;
}
// -------------------------------------------------------------------------
// Analytical properties
// -------------------------------------------------------------------------
@Override
@JsonProperty
@JsonDeserialize( contentAs = BaseDimensionalObject.class )
@JsonView( { DimensionalView.class } )
@JacksonXmlElementWrapper( localName = "columns", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "column", namespace = DxfNamespaces.DXF_2_0 )
public List<DimensionalObject> getColumns()
{
return columns;
}
public void setColumns( List<DimensionalObject> columns )
{
this.columns = columns;
}
@Override
@JsonProperty
@JsonDeserialize( contentAs = BaseDimensionalObject.class )
@JsonView( { DimensionalView.class } )
@JacksonXmlElementWrapper( localName = "rows", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "row", namespace = DxfNamespaces.DXF_2_0 )
public List<DimensionalObject> getRows()
{
return rows;
}
public void setRows( List<DimensionalObject> rows )
{
this.rows = rows;
}
@Override
@JsonProperty
@JsonDeserialize( contentAs = BaseDimensionalObject.class )
@JsonView( { DimensionalView.class } )
@JacksonXmlElementWrapper( localName = "filters", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "filter", namespace = DxfNamespaces.DXF_2_0 )
public List<DimensionalObject> getFilters()
{
return filters;
}
public void setFilters( List<DimensionalObject> filters )
{
this.filters = filters;
}
@Override
@JsonProperty
@JsonView( { DimensionalView.class } )
public Map<String, String> getParentGraphMap()
{
return parentGraphMap;
}
public void setParentGraphMap( Map<String, String> parentGraphMap )
{
this.parentGraphMap = parentGraphMap;
}
}
| [
"mithilesh.hisp@gmail.com"
] | mithilesh.hisp@gmail.com |
3d3ad013341382b4d9fc76659b4ef6ec14be426d | b98514eaefbc30b7b573922bd09887162d31aedd | /app/src/main/java/cn/flyrise/feep/collaboration/matter/MatterListFragment.java | 40f70d15ef306667500260729805c311e624b5e0 | [] | no_license | mofangwan23/LimsOA | c7a6c664531fcd8b950aed62d02f8a5fe6ca233c | 37da27081432a719fddd1a7784f9a2f29274a083 | refs/heads/main | 2023-05-29T22:25:44.839145 | 2021-06-18T09:41:17 | 2021-06-18T09:41:17 | 363,003,883 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 7,069 | java | package cn.flyrise.feep.collaboration.matter;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import cn.flyrise.android.protocol.entity.AssociationKnowledgeListRequest;
import cn.flyrise.android.protocol.entity.AssociationListResponse;
import cn.flyrise.android.protocol.entity.MatterListRequest;
import cn.flyrise.feep.R;
import cn.flyrise.feep.collaboration.matter.adpater.MatterListAdapter;
import cn.flyrise.feep.collaboration.matter.model.DirectoryNode;
import cn.flyrise.feep.collaboration.matter.model.Matter;
import cn.flyrise.feep.collaboration.matter.model.MatterPageInfo;
import cn.flyrise.feep.core.base.views.LoadMoreRecyclerView;
import cn.flyrise.feep.core.common.utils.CommonUtil;
import cn.flyrise.feep.core.network.FEHttpClient;
import cn.flyrise.feep.core.network.RepositoryException;
import cn.flyrise.feep.core.network.callback.ResponseCallback;
import java.util.List;
/**
* Created by klc on 2017/5/12.
*/
public class MatterListFragment extends Fragment {
private boolean isLoading;
private static final int PAGE_SIZE = 20;
private LoadMoreRecyclerView mRecyclerView;
private SwipeRefreshLayout mSwipeRefreshLayout;
private Handler mHandler = new Handler(Looper.getMainLooper());
private MatterPageInfo mPageInfo;
private int mMatterType;
private DirectoryNode node;
private List<Matter> mSelectedAssociations;
private MatterListAdapter mAdapter;
public static MatterListFragment newInstance(int matterType) {
Bundle args = new Bundle();
MatterListFragment fragment = new MatterListFragment();
fragment.setMatterType(matterType);
fragment.setArguments(args);
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View contentView = inflater.inflate(R.layout.fragment_matter_list, container, false);
initViewsAndListener(contentView);
return contentView;
}
public void setMatterType(int matterType) {
this.mMatterType = matterType;
}
public void setKnowledgePageInfo(DirectoryNode node, MatterPageInfo pageInfo) {
this.node = node;
this.mPageInfo = pageInfo;
if (pageInfo.currentPage != 0) {
mAdapter.setAssociationList(mPageInfo.dataList);
}
else {
showLoading();
requestList(++pageInfo.currentPage);
}
}
private void initViewsAndListener(View contentView) {
View emptyView = contentView.findViewById(R.id.ivEmptyView);
if (mMatterType == MatterListActivity.MATTER_KNOWLEDGE) {
TextView tvHint = emptyView.findViewById(R.id.empty_hint);
tvHint.setText(R.string.common_empty_file_hint);
}
mSwipeRefreshLayout = (SwipeRefreshLayout) contentView.findViewById(R.id.swipeRefreshLayout);
mSwipeRefreshLayout.setColorSchemeResources(R.color.login_btn_defulit);
mRecyclerView = (LoadMoreRecyclerView) contentView.findViewById(R.id.recyclerView);
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mRecyclerView.setAdapter(mAdapter = new MatterListAdapter());
mAdapter.setSelectedAssociations(mSelectedAssociations);
mAdapter.setEmptyView(emptyView);
mAdapter.setOnItemClickListener(new MatterListAdapter.OnAssociationCheckChangeListener() {
@Override
public void onAssociationAdd(Matter association) {
MatterListActivity activity = (MatterListActivity) getActivity();
activity.addSelectedAssociation(association);
}
@Override
public void onAssociationDelete(Matter deletedAssociation) {
MatterListActivity activity = (MatterListActivity) getActivity();
activity.removeSelectedAssociation(deletedAssociation);
}
});
mRecyclerView.setOnLoadMoreListener(() -> {
if (!isLoading && hasMoreData()) {
isLoading = true;
requestList(++mPageInfo.currentPage);
}
else {
mAdapter.removeFooterView();
}
});
mSwipeRefreshLayout.setOnRefreshListener(() -> {
if (mPageInfo != null) {
requestList(mPageInfo.currentPage = 1);
}
else {
mSwipeRefreshLayout.setRefreshing(false);
}
});
if (mMatterType != MatterListActivity.MATTER_KNOWLEDGE) {
showLoading();
mPageInfo = new MatterPageInfo();
requestList(mPageInfo.currentPage = 1);
}
}
public void showLoading() {
mSwipeRefreshLayout.post(() -> mSwipeRefreshLayout.setRefreshing(true));
}
public boolean hasMoreData() {
return mPageInfo.hasMore;
}
public void deleteAssociation(Matter association) {
mAdapter.deleteSelectedAssociation(association);
}
public void addAssociation(Matter association) {
mAdapter.addSelectedAssociation(association);
}
public void setSelectedAssociations(List<Matter> associations) {
this.mSelectedAssociations = associations;
}
public void notifyDataSetChange() {
this.mAdapter.notifyDataSetChanged();
}
private void requestList(int page) {
if (mMatterType == MatterListActivity.MATTER_KNOWLEDGE) {
AssociationKnowledgeListRequest request = new AssociationKnowledgeListRequest(node.id, node.attr, "",
String.valueOf(mPageInfo.currentPage), PAGE_SIZE + "");
FEHttpClient.getInstance().post(request, responseCallback);
}
else {
MatterListRequest request = new MatterListRequest("", page, PAGE_SIZE, mMatterType);
FEHttpClient.getInstance().post(request, responseCallback);
}
}
public ResponseCallback responseCallback = new ResponseCallback<AssociationListResponse>() {
@Override
public void onCompleted(AssociationListResponse response) {
isLoading = false;
mHandler.postDelayed(() -> mSwipeRefreshLayout.setRefreshing(false), 1000);
AssociationListResponse.Result result = response.getResult();
if (result != null) {
mPageInfo.hasMore = result.getTotalPage() > mPageInfo.currentPage;
List<Matter> associationList = result.getAssociationList();
if (CommonUtil.nonEmptyList(associationList)) {
for (int i = 0, n = associationList.size(); i < n; i++) {
associationList.get(i).matterType = mMatterType;
}
}
if (mPageInfo.currentPage == 1) {
mAdapter.setAssociationList(associationList);
mPageInfo.dataList = associationList;
}
else {
mAdapter.addAssociationList(associationList);
}
if (hasMoreData()) {
mAdapter.setFooterView(cn.flyrise.feep.core.R.layout.core_refresh_bottom_loading);
}
else {
mAdapter.removeFooterView();
}
}
}
@Override
public void onFailure(RepositoryException repositoryException) {
mRecyclerView.scrollLastItem2Bottom(mAdapter);
isLoading = false;
mHandler.postDelayed(() -> mSwipeRefreshLayout.setRefreshing(false), 1000);
}
};
@Override
public void onDestroy() {
super.onDestroy();
if (mHandler != null) {
mHandler.removeCallbacksAndMessages(null);
}
}
} | [
"mofangwan23@gmail.com"
] | mofangwan23@gmail.com |
fa84988d2f6954bc7a39fd2323e37c043a5ca9ad | 75024dc0736e5405045a46e0a123cd7b69d28626 | /src/huellitasjsf/model/entities/Adopcion.java | 0b630f2736c51554f5daf1e600116372f8514a96 | [] | no_license | Gersong11/proyectohuellitas | 745975fa2ed784b9f038c1b46b96f571d5f5d43b | 0caeda26654eb60d7f301462e8a47e4d429065c9 | refs/heads/main | 2023-04-20T18:04:33.612195 | 2021-05-20T20:15:24 | 2021-05-20T20:15:24 | 369,278,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,574 | java | package huellitasjsf.model.entities;
import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
/**
* The persistent class for the adopcion database table.
*
*/
@Entity
@NamedQuery(name="Adopcion.findAll", query="SELECT a FROM Adopcion a")
public class Adopcion implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id_adopcion")
private int idAdopcion;
@Temporal(TemporalType.DATE)
private Date fechaFinAdop;
@Temporal(TemporalType.DATE)
private Date fechaInicioAdop;
//bi-directional many-to-one association to Perro
@ManyToOne
@JoinColumn(name="nombre")
private Perro perro;
//bi-directional many-to-one association to Persona
@ManyToOne
@JoinColumn(name="cedula")
private Persona persona;
public Adopcion() {
}
public int getIdAdopcion() {
return this.idAdopcion;
}
public void setIdAdopcion(int idAdopcion) {
this.idAdopcion = idAdopcion;
}
public Date getFechaFinAdop() {
return this.fechaFinAdop;
}
public void setFechaFinAdop(Date fechaFinAdop) {
this.fechaFinAdop = fechaFinAdop;
}
public Date getFechaInicioAdop() {
return this.fechaInicioAdop;
}
public void setFechaInicioAdop(Date fechaInicioAdop) {
this.fechaInicioAdop = fechaInicioAdop;
}
public Perro getPerro() {
return this.perro;
}
public void setPerro(Perro perro) {
this.perro = perro;
}
public Persona getPersona() {
return this.persona;
}
public void setPersona(Persona persona) {
this.persona = persona;
}
} | [
"49883692+perrito11@users.noreply.github.com"
] | 49883692+perrito11@users.noreply.github.com |
696a59281698315abf51357e13c9eb7851805ef7 | 58105e31d1378db95dc81645bbb196a77162f344 | /src/main/java/com/yanfeitech/application/config/UserIDAuditorBean.java | 13be578216eccd730e84f04f6b4010538c466427 | [] | no_license | Obito-hy/heyang | fae755ed13e6403907df8c2cc78231827210182f | 0ab1938c723e98124bcf64cf042dbbdcd0e97456 | refs/heads/master | 2023-04-09T05:25:00.274644 | 2021-04-26T13:31:24 | 2021-04-26T13:31:24 | 361,764,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,505 | java | package com.yanfeitech.application.config;
import java.util.Optional;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import com.yanfeitech.application.entity.User;
/**
*
* <p>
* Title: UserIDAuditorBean
* </p>
* <p>
* Description:使用上下文中的用户id,提供给JPA,用于数据库表操作人createby与updateby
* </p>
*
* @author zhudelin
* @date 2020年11月24日
*/
@Configuration
public class UserIDAuditorBean implements AuditorAware<String> {
@Override
public Optional<String> getCurrentAuditor() {
SecurityContext ctx = SecurityContextHolder.getContext();
if (ctx == null) {
return null;
}
if (ctx.getAuthentication() == null) {
return null;
}
if (ctx.getAuthentication().getPrincipal() == null) {
return null;
}
if (ctx.getAuthentication() instanceof AnonymousAuthenticationToken) {
return null;
}
if (ctx.getAuthentication() instanceof UsernamePasswordAuthenticationToken) {
Object principal = ctx.getAuthentication().getPrincipal();
User user = (User) principal;
if (user != null) {
return Optional.of(user.getId());
}
}
return null;
}
} | [
"1758673915@qq.com"
] | 1758673915@qq.com |
e509b26c03805d37b30ded26be26e5fafba1e787 | 28e099b5e7306d601dea4f11480de69cad07140e | /Data Structures/src/binary_tree/Node.java | 8ebacb1baf97682e96e75ca8423ed1bddbab7650 | [] | no_license | roalts/Data_Structures | c4fe6126df68583e9f5c84108ce50d8b51e7669c | f57e73789a645009b0b4ce80f74a12a79b5c831f | refs/heads/master | 2020-12-24T15:49:13.485805 | 2015-09-27T05:02:52 | 2015-09-27T05:02:52 | 37,371,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 71 | java | package binary_tree;
public class Node<T> {
T data;
Node<T> next;
}
| [
"raghav.apoorv@gmail.com"
] | raghav.apoorv@gmail.com |
a5aeb57a3b2658e2253afa9748fd33394265e85f | ab88e7de951de23c9c1ebf7c1dde4a54577c1261 | /src/at/dbo/cc/objects/musiker/Schlagzeuger.java | 06574f6840ab4c0b6382c626fc0220d44842b8e0 | [] | no_license | dboljevic/CC_02_Objektorientierung | 9f7b4960be37850c59ab3f31a60b173502ba5a80 | 41b0cf1f5c6634930a042d713a07a19f22559f95 | refs/heads/main | 2023-05-15T07:42:55.628956 | 2021-06-14T18:14:34 | 2021-06-14T18:14:34 | 366,795,976 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 290 | java | package at.dbo.cc.objects.musiker;
public class Schlagzeuger extends Musiker{
public Schlagzeuger(String name, int alter) {
super(name, alter);
}
@Override
public void singenSolo(){
System.out.println("You got mud on your face, you big disgrace");
}
}
| [
"dboljevic84@gmail.com"
] | dboljevic84@gmail.com |
c304771f976bd6ded447c25511df074db7dd3699 | d154422af1f25d821f71d7ca8491139a5b26cefe | /Jsp/src/board/command/CDelete.java | 91ca3fc9b5d789c4d2322570858b4924f291ca21 | [] | no_license | navang/-Studying-java | d6c6f1b932f35ca4b15c3a3907a8481eeeab9e45 | d737ca06acbb268a506f9cd6abdcb5b83f3ffb05 | refs/heads/master | 2020-05-16T03:05:04.211372 | 2019-06-27T16:45:36 | 2019-06-27T16:45:36 | 182,648,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 807 | java | package board.command;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import board.model.BoardDao;
import board.model.BoardException;
public class CDelete implements Comm {
private String next;
public CDelete( String _next ){
next = _next;
}
public String execute(HttpServletRequest request, HttpServletResponse response ) throws CException {
try{
int article_id = Integer.parseInt(request.getParameter("article_id"));
String password = request.getParameter("password");
int resultCnt = BoardDao.getInstance().delete(article_id, password);
request.setAttribute("rs", resultCnt);
}catch( BoardException ex ){
throw new CException("CDelete.java < 삭제시 > " + ex.toString() );
}
return next;
}
}
| [
"2012102367@khu.ac.kr"
] | 2012102367@khu.ac.kr |
d68d2d17a99e078106b4071d4738c759ef159f91 | 37de4516e2da3495cb3e59713be08fa6e2209f19 | /chat/src/chat/Setting.java | fd37f52c7590a890fbffe38dd3790dd26bd73b5a | [] | no_license | Dar9586/workspace | afac3c818513e8cbede58e9374a851bc20babc0f | f7ae503c8313bc9bdeda8a49f79b203cf45bb5db | refs/heads/master | 2020-05-30T12:28:31.132121 | 2017-04-14T20:51:24 | 2017-04-14T20:51:24 | 83,596,392 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 707 | java | package chat;
import java.awt.EventQueue;
import javax.swing.JFrame;
public class Setting {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Setting window = new Setting();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Setting() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
| [
"atoppi2012@gmail.com"
] | atoppi2012@gmail.com |
4260f38b929c29682fe1b8201fe674a1fa86afc1 | d4b0afbdbfe705678a868a016f7e5f1309486d99 | /Comp1451_Assignment_2_Payroll_Framework/src/ca/bcit/comp1451/a2/payroll/test/VolunteerTest2.java | e45bef32af53178048fafea41ed343e00a2fd8bf | [] | no_license | e1212545/COMP-1451-Introduction-to-Java-2 | 17926018ec7ca17b14143cf1655147bd2b6086ce | da747c4ef52115383340d32a2b8c67027f16bbcc | refs/heads/master | 2020-04-18T06:25:20.426611 | 2017-03-01T20:47:45 | 2017-03-01T20:47:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,022 | java | package ca.bcit.comp1451.a2.payroll.test;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import ca.bcit.comp1451.a2.payroll.Volunteer;
/**
* A Test2 Class for Volunteer methods
*
* @author Ronnie Manimtim
* @version 1.0 29 Feb 2016
*/
public class VolunteerTest2 {
private static final double DEFAULT_PAY_RATE = 0.0;
private static Volunteer testVolunteer;
/**
* @throws java.lang.Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
testVolunteer = new Volunteer();
}
/**
* @throws java.lang.Exception
*/
@AfterClass
public static void tearDownAfterClass() throws Exception {
testVolunteer = null;
}
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
testVolunteer = new Volunteer("Kimberly", "1200 West Point Grey Road", "514-8374");
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
testVolunteer = null;
}
/**
* Test method for {@link ca.bcit.comp1451.a2.payroll.Volunteer#pay()}.
*/
@Test
public final void testPay() {
testVolunteer = new Volunteer("Kimberly", "1200 West Point Grey Road", "514-8374");
double testPay = DEFAULT_PAY_RATE;
double actualPay = testVolunteer.pay();
assertTrue(testPay == actualPay);
}
/**
* Test method for {@link ca.bcit.comp1451.a2.payroll.Volunteer#toString()}.
*/
@Test
public final void testToString() {
testVolunteer = new Volunteer("Kimberly", "1200 West Point Grey Road", "514-8374");
String testVolunteer = "Volunteer Staff Member" + "\n";
testVolunteer += "Name: " + "Kimberly" + "\n";
testVolunteer += "Address: " + "1200 West Point Grey Road" + "\n";
testVolunteer += "Phone Number: " + "514-8374";
String actualToString = testVolunteer.toString();
assertEquals(testVolunteer, actualToString);
}
/**
* Test method for {@link ca.bcit.comp1451.a2.payroll.Volunteer#Volunteer()}
* .
*/
@Test
public final void testVolunteer() {
assertTrue(testVolunteer instanceof Volunteer);
}
/**
* Test method for
* {@link ca.bcit.comp1451.a2.payroll.Volunteer#Volunteer(java.lang.String, java.lang.String, java.lang.String)}
* .
*/
@Test
public final void testVolunteerStringStringString() {
assertTrue(testVolunteer instanceof Volunteer);
}
/**
* Test method for
* {@link ca.bcit.comp1451.a2.payroll.Volunteer#Volunteer()(String name)}.
*/
@Test
public final void testDefaultConstructorName() {
Volunteer testDefault = new Volunteer();
String name = "Enter a name";
assertEquals(name, testDefault.getName());
}
/**
* Test method for
* {@link ca.bcit.comp1451.a2.payroll.Volunteer#Volunteer()(String address)}
* .
*/
@Test
public final void testDefaultConstructorAddress() {
Volunteer testDefault = new Volunteer();
String address = "Enter an address";
assertEquals(address, testDefault.getAddress());
}
/**
* Test method for
* {@link ca.bcit.comp1451.a2.payroll.Volunteer#Volunteer()(String
* phoneNumber)}.
*/
@Test
public final void testDefaultConstructorPhoneNumber() {
Volunteer testDefault = new Volunteer();
String phoneNumber = "Enter a phone number";
assertEquals(phoneNumber, testDefault.getPhoneNumber());
}
/**
* Test method for {@link ca.bcit.comp1451.a2.payroll.StaffMember#getName()}
* .
*/
@Test
public void testGetName() {
testVolunteer = new Volunteer("Kimberly", "1200 West Point Grey Road", "514-8374");
assertEquals("Kimberly", testVolunteer.getName());
}
/**
* Test method for
* {@link ca.bcit.comp1451.a2.payroll.StaffMember#setName(java.lang.String)}
* .
*/
@Test
public void testSetName() {
testVolunteer.setName("Ollie");
assertEquals("Ollie", testVolunteer.getName());
}
/**
* Test method for
* {@link ca.bcit.comp1451.a2.payroll.StaffMember#getAddress()}.
*/
@Test
public void testGetAddress() {
testVolunteer = new Volunteer("Kimberly", "1200 West Point Grey Road", "514-8374");
assertEquals("1200 West Point Grey Road", testVolunteer.getAddress());
}
/**
* Test method for
* {@link ca.bcit.comp1451.a2.payroll.StaffMember#setAddress(java.lang.String)}
* .
*/
@Test
public void testSetAddress() {
testVolunteer.setAddress("11121 Horseshoe Way");
assertEquals("11121 Horseshoe Way", testVolunteer.getAddress());
}
/**
* Test method for
* {@link ca.bcit.comp1451.a2.payroll.StaffMember#getPhoneNumber()}.
*/
@Test
public void testGetPhoneNumber() {
testVolunteer = new Volunteer("Kimberly", "1200 West Point Grey Road", "514-8374");
assertEquals("514-8374", testVolunteer.getPhoneNumber());
}
/**
* Test method for
* {@link ca.bcit.comp1451.a2.payroll.StaffMember#setPhoneNumber(java.lang.String)}
* .
*/
@Test
public void testSetPhoneNumber() {
testVolunteer.setPhoneNumber("299-9000");
assertEquals("299-9000", testVolunteer.getPhoneNumber());
}
} | [
"tresivileo@hotmail.com"
] | tresivileo@hotmail.com |
99739a1246a4c70e716dcb7a8fde0a941cede203 | e5116b8d162c761d537f026c3921536398b05d30 | /app/src/main/java/com/example/testing/MainActivity.java | 481e10bf08e3215e28aad6e38875dccd091d5c37 | [] | no_license | keyman500/firstapp | 25a0d28612b4e954b398b8fb7361bd1236789c42 | 26b6ee84821a6e6196da83e6a35a10068b34c036 | refs/heads/master | 2022-12-20T02:53:56.635084 | 2020-10-14T05:34:23 | 2020-10-14T05:34:23 | 303,890,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,839 | java | package com.example.testing;
import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private EditText num1;
private EditText num2;
private Button myButton,addbtn;
private TextView answer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
answer= findViewById(R.id.textView);
addbtn = findViewById(R.id.button4);
num1 = findViewById(R.id.editText);
num2 = findViewById(R.id.editText2);
addbtn.setOnClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onClick(View v) {
if(v==myButton){
Toast.makeText(this,"button2 clicked bro",Toast.LENGTH_LONG).show();
}
if(v==addbtn){
int num1 = Integer.parseInt(this.num1.getText().toString());
int num2 = Integer.parseInt(this.num2.getText().toString());
int answer = num1 + num2;
String an = "" + answer;
this.answer.setText(an);
String t = an + " is the answer";
Toast.makeText(this,t,Toast.LENGTH_LONG).show();
}
}
}
| [
"mar-chy@hotmail.com"
] | mar-chy@hotmail.com |
7f21e8997234cd9214ef279cd082f0494e6ff71b | 1c59e750d2cdf1f6268d7c35303d2f412ed2f597 | /home-modules/home-customer/home-customer-common/src/main/java/com/home/customer/common/vo/CustomerVo.java | fcaf412e54f1d8cec73b410c9c2812ddd165bbe6 | [] | no_license | chocoai/home-platform | 9e03f8cd7243ffd96e689238c7fefd2e4e26c7ba | 05c0f4e0823fe5a7f04839462d12393e20f3f3d2 | refs/heads/master | 2020-04-28T20:12:38.528072 | 2018-08-06T01:17:58 | 2018-08-06T01:17:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,090 | java | package com.home.customer.common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* Customer 视图对象
*
* @author roger
* @email 190642964@qq.com
* @create 2018-06-29 14:32
**/
@Data
@ApiModel(value = "Customer响应")
public class CustomerVo {
/**
* 主键id
*/
@ApiModelProperty(value = "主键id")
private Long id;
/**
* 电话
*/
@ApiModelProperty(value = "电话")
private String mobile;
/**
* 邮箱
*/
@ApiModelProperty(value = "邮箱")
private String email;
/**
* 姓名
*/
@ApiModelProperty(value = "姓名")
private String customerName;
/**
* 头像
*/
@ApiModelProperty(value = "头像")
private String headImage;
/**
* 性别性别(0-男、1-女)
*/
@ApiModelProperty(value = "性别性别(0-男、1-女)")
private Boolean gender;
/**
* 出生日期
*/
@ApiModelProperty(value = "出生日期")
private Date birthday;
}
| [
"190642964@qq.com"
] | 190642964@qq.com |
f56180526ce708c062457aa7bf5e1165716015b3 | 806f62ffbc260f44bdeb88ae8bd1104da6da0b9b | /changgou-parent/changgou-service/changgou-service-seckill/src/main/java/com/changgou/seckill/service/SeckillOrderService.java | 2680a3e128ff326a23e14041f48403e9b2832bee | [] | no_license | zwz001/changgou | ca8ae841521a54547e52e9bec4ffadbdde70a5e7 | 05ad0b688efc6643ccf5849846985853b49001b3 | refs/heads/master | 2022-06-22T05:53:48.736625 | 2020-02-12T01:03:51 | 2020-02-12T01:03:51 | 239,896,972 | 0 | 0 | null | 2022-06-21T02:47:06 | 2020-02-12T00:52:54 | JavaScript | UTF-8 | Java | false | false | 1,643 | java | package com.changgou.seckill.service;
import com.changgou.seckill.pojo.SeckillOrder;
import com.changgou.seckill.pojo.SeckillStatus;
import com.github.pagehelper.PageInfo;
import java.util.List;
/****
* @Author:admin
* @Description:SeckillOrder业务层接口
* @Date 2019/6/14 0:16
*****/
public interface SeckillOrderService {
/***
* SeckillOrder多条件分页查询
* @param seckillOrder
* @param page
* @param size
* @return
*/
PageInfo<SeckillOrder> findPage(SeckillOrder seckillOrder, int page, int size);
/***
* SeckillOrder分页查询
* @param page
* @param size
* @return
*/
PageInfo<SeckillOrder> findPage(int page, int size);
/***
* SeckillOrder多条件搜索方法
* @param seckillOrder
* @return
*/
List<SeckillOrder> findList(SeckillOrder seckillOrder);
/***
* 删除SeckillOrder
* @param id
*/
void delete(Long id);
/***
* 修改SeckillOrder数据
* @param seckillOrder
*/
void update(SeckillOrder seckillOrder);
/***
* 新增SeckillOrder
* @param seckillOrder
*/
void add(SeckillOrder seckillOrder);
/**
* 根据ID查询SeckillOrder
* @param id
* @return
*/
SeckillOrder findById(Long id);
/***
* 查询所有SeckillOrder
* @return
*/
List<SeckillOrder> findAll();
/**
* 添加订单
* @param id
* @param time
* @param username
* @return
*/
Boolean add(Long id, String time, String username);
SeckillStatus getUserSeckillStatus(String username);
}
| [
"793730938@qq.com"
] | 793730938@qq.com |
0d52f671704ad938753f457ffa2be33f0e8bb4cc | 7191cb83b268c7b5f9871699a02106351b3bb0fd | /android/app/src/main/java/com/pianeta/MainApplication.java | 39b552ba354d55f3eecc5b3c95020ede36a3f045 | [] | no_license | naniii17/pianetaApp | c170fe2abd68b563d13f40d38e99d1bc1cb73fed | 806de05c3ab3653545e26f090d3d1ab927a67099 | refs/heads/master | 2023-02-04T13:39:32.657950 | 2020-03-29T14:38:02 | 2020-03-29T14:38:02 | 251,052,206 | 0 | 0 | null | 2023-01-26T18:44:10 | 2020-03-29T14:29:52 | Objective-C | UTF-8 | Java | false | false | 2,274 | java | package com.pianeta;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this); // Remove this line if you don't want Flipper enabled
}
/**
* Loads Flipper in React Native templates.
*
* @param context
*/
private static void initializeFlipper(Context context) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"ugo.nani@efrei.net"
] | ugo.nani@efrei.net |
687fed4c57eb65e2cd997bf0bdd0a9769abc8f32 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/24/24_4eb2fea10ec0985554499c054920d234eb4404f7/MediatedBannerAdViewController/24_4eb2fea10ec0985554499c054920d234eb4404f7_MediatedBannerAdViewController_t.java | 162fee4686794c253cf254562bf5e5e50f30cc5d | [] | 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 | 2,168 | java | /*
* Copyright 2013 APPNEXUS 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.appnexus.opensdk;
import com.appnexus.opensdk.utils.Clog;
import android.app.Activity;
import android.view.View;
public class MediatedBannerAdViewController implements Displayable {
AdView owner;
int width;
int height;
String uid;
String className;
String param;
Class<?> c;
MediatedBannerAdView mAV;
View placeableView;
public MediatedBannerAdViewController(AdView owner, AdResponse response) {
width = response.getWidth();
height = response.getHeight();
uid = response.getMediatedUID();
className = response.getMediatedViewClassName();
param = response.getParameter();
try {
c = Class.forName(className);
} catch (ClassNotFoundException e) {
Clog.e(Clog.mediationLogTag, Clog.getString(R.string.class_not_found_exception));
return;
}
try {
mAV = (MediatedBannerAdView) c.newInstance();
} catch (InstantiationException e) {
Clog.e(Clog.mediationLogTag, Clog.getString(R.string.instantiation_exception));
return;
} catch (IllegalAccessException e) {
Clog.e(Clog.mediationLogTag, Clog.getString(R.string.illegal_access_exception));
return;
}
placeableView = mAV.requestAd((Activity)owner.getContext(), param, uid, width, height, owner);
}
@Override
public View getView() {
return placeableView;
}
@Override
public boolean failed() {
// TODO Auto-generated method stub
// Will spawn an ad request with the fail url and await further instruction
return false;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
ba547172da73b26206e9bacbb62e6f88b691197d | cf5e34bfaa9900df687652f92c9dce3cbfd8266c | /src/main/java/recursion/RecursionBasics.java | 9c3390df78f3588ef107250b1488e9f1d82f45be | [] | no_license | deepanshu7211/DataStructureUdPractice | fa58ffe0fb8f8905c07bb4192c59fb3179303bbe | e3cad594a00a9e4af2f1dab18f568e11fdfaea7c | refs/heads/master | 2023-06-27T16:43:58.436754 | 2021-08-02T16:21:18 | 2021-08-02T16:21:18 | 296,819,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 493 | java | package recursion;
public class RecursionBasics {
public static void main(String[] args) {
headRecursion(3);
tailRecursion(3);
}
public static void headRecursion(int n){
if(n>0){
headRecursion(n-1);
System.out.println("headRecursion N value " +n);
}
}
public static void tailRecursion(int n){
if(n>0){
System.out.println("tailRecursion N value " +n);
tailRecursion(n-1);
}
}
}
| [
"“deepanshu7211@gmail.com”"
] | “deepanshu7211@gmail.com” |
24204775c5d8616f8aefb9e7c7d785493a9237ee | e4178cd5b13e31e35d07667658a7e7cc5e7a884d | /src/lbs/goodplace/com/View/main/MainIHaveView.java | c9b50848e5cb9e80a94ed34c954e3adc06adf5da | [] | no_license | itman83/ShopMall-Android | 7285d14b6215a0f53bdf4fafc57f7e5b20bf0adf | ee52fdab6a24379180bc762ae1fbf6199c7cb897 | refs/heads/master | 2020-12-31T06:22:54.926454 | 2014-01-23T12:09:57 | 2014-01-23T12:10:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,020 | java | package lbs.goodplace.com.View.main;
import java.util.ArrayList;
import java.util.List;
import lbs.goodplace.com.R;
import lbs.goodplace.com.controls.RefreshListView;
import lbs.goodplace.com.controls.RefreshListView.OnRefreshListener;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
public class MainIHaveView extends LinearLayout {
private Context mContext;
private RefreshListView mListview;
public MainIHaveView(final Context context) {
super(context);
this.mContext = context;
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.mainihave_view, this);
mListview = (RefreshListView)findViewById(R.id.ihaveListview);
mListview.setCacheColorHint(Color.WHITE) ;
//一定要SetAdapter先会有“下拉刷新”果个头(set个空的Adapter都得)
mListview.setAdapter(new ArrayAdapter<String>(mContext, android.R.layout.simple_expandable_list_item_1,getData()));
mListview.setonRefreshListener(new OnRefreshListener() {
@Override
public void onRefreshData() {
initData();
}
@Override
public void loadNextPageData() {
// TODO Auto-generated method stub
}
});
// setListviewHead();
}
/**
* 控制列表头
*/
private void setListviewHead(){
//列表头
if (mListview.getCount() > 1) { //1是因为有HEADVIEW
mListview.hideHeadView();
} else {
mListview.setHeadViewVisible();
}
}
/**
* 初始化 按钮数据
*/
private void initData() {
}
private List<String> getData(){
List<String> data = new ArrayList<String>();
data.add("测试数据1");
data.add("测试数据2");
data.add("测试数据3");
data.add("测试数据4");
return data;
}
}
| [
"Kingsleyyau@gmail.com"
] | Kingsleyyau@gmail.com |
8bb200aa2ce56162477f4c1cbe329124a407bb14 | 063baff3c224463d153e8b6006df62b783afe77f | /src/main/java/com/demo/model/Sudo.java | 7081cb3f37ae77cdec8841068441295993969b25 | [] | no_license | sravanthi-konreddy/demoapi | 8341e4178249ebe50a8dbdf1bb14128d84d39010 | 9c5b7181fbd5061dd64993697e48831805499fb2 | refs/heads/master | 2022-12-23T21:54:33.705836 | 2020-02-25T18:27:42 | 2020-02-25T18:27:42 | 237,507,385 | 0 | 0 | null | 2022-12-16T08:36:31 | 2020-01-31T20:06:05 | Java | UTF-8 | Java | false | false | 354 | java | package com.demo.model;
public class Sudo {
int[][] inputArray=new int[9][9];
public int[][] getInputArray() {
return inputArray;
}
public void setInputArray(int[][] inputArray2) {
for(int i=0;i<9;i++)
{
for(int j=0;j<9;j++)
{
this.inputArray[i][j]=inputArray2[i][j];
}
}
// TODO Auto-generated method stub
}
}
| [
"konreddysravanthi07@gmail.com"
] | konreddysravanthi07@gmail.com |
ffa6289742265392d6af3e26d2b77e20cbc355d1 | 8ec981e516cd7254d53bdb225d53aad2c06ee7a2 | /src/main/java/com/t248/lmf/crm/CrmApplication.java | be47192f0c6029b0d5cfd5939d58849f51e2ca10 | [] | no_license | 2767274907/crm | 5d728c4ace6e31d46a62cab5342e4ab04f5505e1 | c5446e76c5d86df6d788ad7987e1cf0db53e76c6 | refs/heads/master | 2023-05-12T20:12:46.996859 | 2020-02-29T03:05:16 | 2020-02-29T03:05:16 | 243,885,521 | 3 | 0 | null | 2023-05-08T04:15:02 | 2020-02-29T01:36:54 | HTML | UTF-8 | Java | false | false | 342 | java | package com.t248.lmf.crm;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
//@EnableAutoConfiguration
public class CrmApplication {
public static void main(String[] args) {
SpringApplication.run(CrmApplication.class, args);
}
}
| [
"2767274907@qq.com"
] | 2767274907@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.