blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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
689M
⌀ | 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 131
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 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
476b7c0efc2bb4b7a5d4ca64560aac8c29e65c26 | 647508b7af8ef6b10573157841e73ccc7ee90b86 | /Practice_Chap12(제어자와 다형성)/src/example06/Book.java | 78b9de337de396fcf1a1214196925b28c3ea8479 | [] | no_license | kimlsy2444/JAVA-Study | f2fc8cd47879db1c84cd5ca0bf5572b58bebcc70 | 592d0d603f2ba6f953950189eb1c3151474490fd | refs/heads/main | 2023-07-16T19:17:43.457984 | 2021-09-02T09:14:36 | 2021-09-02T09:14:36 | 402,355,464 | 1 | 0 | null | null | null | null | UHC | Java | false | false | 810 | java | package example06;
public class Book extends Product {
private int ISBN;
private String title;
private String author;
public Book(int proudctID, String description, String maker, int price, int iSBN, String title, String author) {
super(proudctID, description, maker, price);
this.ISBN = iSBN;
this.title = title;
this.author = author;
}
public int getISBN() {
return ISBN;
}
public String getTitle() {
return title;
}
public String getAuthor() {
return author;
}
@Override
public void showInfo() {
super.showInfo(); // 조상크래스의 매서드를 명시적 호출
System.out.println("국제표준도서번호 >> " + this.getISBN());
System.out.println("책 제목 >> " + this.getTitle());
System.out.println("저자 >> " + this.getAuthor());
}
}
| [
"[Github"
] | [Github |
89d8176ccec0d3f2181456f8eebd1efd1ca3f139 | 383ca8f0babc70b9f3cf6192ca2feb5b94f74b6d | /src/pddsh/Main3.java | 7e34e91bf18c23cc5284016bc2b30c8d68a71123 | [] | no_license | stianyu/CompanyOnlineJudge2020 | 8a8f810b9ec3a87f2c1030cab0a58113f0b2a479 | 396b3080f9b10307406a4aa63d5e5d751c003932 | refs/heads/master | 2023-08-22T12:42:31.144946 | 2021-10-13T14:27:26 | 2021-10-13T14:27:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 667 | java | package pddsh;
import java.util.Scanner;
public class Main3 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNextInt()) {
int n = in.nextInt();
int m = in.nextInt();
int[] f = new int[m+1];
for( int i = 0; i < n; i++) {
int c = in.nextInt();
int v = in.nextInt();
if (c > 0 && v > 0) {
for(int j = c; j <= m; j++) {
f[j] = Math.max(f[j], f[j-c] + v);
}
}
}
System.out.println(f[m]);
}
}
}
| [
"[email protected]"
] | |
114191eeda0b2bcb8ea881cac08fbc8d117cead1 | 96495de9622faec1cf75517642ad725e93b8cb3c | /src/Aves.java | 137aa3244ac9000889e4b257264cd1e8d4c8ecb0 | [] | no_license | needarb/game-of-life | baade0bf0441b971b53b4544dfd8a760ebb0d4ba | d9d97b79278cddee3490d281d51dff3f4df1841d | refs/heads/master | 2020-05-23T11:19:24.764497 | 2014-04-06T20:52:30 | 2014-04-06T20:52:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 66 | java | /**
* Created by needa_000 on 2/27/14.
*/
public class Aves
{
}
| [
"[email protected]"
] | |
c33f24d37190299232b77d4160dc5c01af5e54d7 | 2b2de55c2fb0f407f59f9b80c3946728c8f5cb33 | /src/edu/ecsu/csc360/JChatModel.java | 302d4ee141a24f7c761b3544cd21f4c35009b4ec | [] | no_license | cuadrosjb/CSC360-Assignment-I---A-Chat-GUI-Application | 17549a088fc6201ffe62e4253696f2b9beb9a8d4 | ae51f5c4cad49aa439d99345120a0857a8189352 | refs/heads/master | 2021-01-19T21:12:12.866376 | 2016-09-25T22:04:56 | 2016-09-25T22:04:56 | 69,120,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,521 | java | package edu.ecsu.csc360;
/*
import java.awt.Button;
import java.awt.Frame;
import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.MenuItem;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
*/
import javax.jms.BytesMessage;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.ObjectMessage;
import javax.jms.StreamMessage;
import javax.jms.TextMessage;
public class JChatModel {
boolean connected = false;
String outgoingMsgTypeString;
int outgoingMsgType;
JChatMessageCreator outgoingMsgCreator;
JChatMessageCreator txtMsgCreator, objMsgCreator, mapMsgCreator, bytesMsgCreator, streamMsgCreator;
public JChatMessageCreator getMessageCreator(int type) {
switch (type) {
case JChatDialog.MSG_TYPE_TEXT:
if (txtMsgCreator == null) {
txtMsgCreator = new JChatTextMessageCreator();
}
return (txtMsgCreator);
case JChatDialog.MSG_TYPE_OBJECT:
if (objMsgCreator == null) {
objMsgCreator = new JChatObjMessageCreator();
}
return (objMsgCreator);
case JChatDialog.MSG_TYPE_MAP:
if (mapMsgCreator == null) {
mapMsgCreator = new JChatMapMessageCreator();
}
return (mapMsgCreator);
case JChatDialog.MSG_TYPE_BYTES:
if (bytesMsgCreator == null) {
bytesMsgCreator = new JChatBytesMessageCreator();
}
return (bytesMsgCreator);
case JChatDialog.MSG_TYPE_STREAM:
if (streamMsgCreator == null) {
streamMsgCreator = new JChatStreamMessageCreator();
}
return (streamMsgCreator);
}
return (null);
}
public JChatMessageCreator getMessageCreator(Message msg) {
if (msg instanceof TextMessage) {
if (txtMsgCreator == null) {
txtMsgCreator = new JChatTextMessageCreator();
}
return (txtMsgCreator);
} else if (msg instanceof ObjectMessage) {
if (objMsgCreator == null) {
objMsgCreator = new JChatObjMessageCreator();
}
return (objMsgCreator);
} else if (msg instanceof MapMessage) {
if (mapMsgCreator == null) {
mapMsgCreator = new JChatMapMessageCreator();
}
return (mapMsgCreator);
} else if (msg instanceof BytesMessage) {
if (bytesMsgCreator == null) {
bytesMsgCreator = new JChatBytesMessageCreator();
}
return (bytesMsgCreator);
} else if (msg instanceof StreamMessage) {
if (streamMsgCreator == null) {
streamMsgCreator = new JChatStreamMessageCreator();
}
return (streamMsgCreator);
}
return (null);
}
}
| [
"[email protected]"
] | |
2062b36e0d6668eb87d6554a2addfd668cb60722 | 38933bae7638a11fef6836475fef0d73e14c89b5 | /magma-func-builder/src/test/java/eu/lunisolar/magma/func/build/function/to/LTieDblFunctionBuilderTest.java | ab5845f44426c6abaecb13af009465530df06da2 | [
"Apache-2.0"
] | permissive | lunisolar/magma | b50ed45ce2f52daa5c598e4760c1e662efbbc0d4 | 41d3db2491db950685fe403c934cfa71f516c7dd | refs/heads/master | 2023-08-03T10:13:20.113127 | 2023-07-24T15:01:49 | 2023-07-24T15:01:49 | 29,874,142 | 5 | 0 | Apache-2.0 | 2023-05-09T18:25:01 | 2015-01-26T18:03:44 | Java | UTF-8 | Java | false | false | 5,617 | java | /*
* This file is part of "lunisolar-magma".
*
* (C) Copyright 2014-2023 Lunisolar (http://lunisolar.eu/).
*
* 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 eu.lunisolar.magma.func.build.function.to;
import eu.lunisolar.magma.asserts.func.FuncAttests;
import eu.lunisolar.magma.func.supp.Be;
import eu.lunisolar.magma.func.supp.check.Checks;
import eu.lunisolar.magma.func.*; // NOSONAR
import eu.lunisolar.magma.asserts.*; // NOSONAR
import javax.annotation.Nonnull; // NOSONAR
import javax.annotation.Nullable; // NOSONAR
import java.util.Objects;// NOSONAR
import eu.lunisolar.magma.basics.meta.*; // NOSONAR
import eu.lunisolar.magma.basics.meta.functional.*; // NOSONAR
import eu.lunisolar.magma.basics.meta.functional.type.*; // NOSONAR
import eu.lunisolar.magma.basics.meta.functional.domain.*; // NOSONAR
import org.testng.Assert;
import eu.lunisolar.magma.func.action.*; // NOSONAR
import eu.lunisolar.magma.func.consumer.*; // NOSONAR
import eu.lunisolar.magma.func.consumer.primitives.*; // NOSONAR
import eu.lunisolar.magma.func.consumer.primitives.bi.*; // NOSONAR
import eu.lunisolar.magma.func.consumer.primitives.obj.*; // NOSONAR
import eu.lunisolar.magma.func.consumer.primitives.tri.*; // NOSONAR
import eu.lunisolar.magma.func.function.*; // NOSONAR
import eu.lunisolar.magma.func.function.conversion.*; // NOSONAR
import eu.lunisolar.magma.func.function.from.*; // NOSONAR
import eu.lunisolar.magma.func.function.to.*; // NOSONAR
import eu.lunisolar.magma.func.operator.binary.*; // NOSONAR
import eu.lunisolar.magma.func.operator.ternary.*; // NOSONAR
import eu.lunisolar.magma.func.operator.unary.*; // NOSONAR
import eu.lunisolar.magma.func.predicate.*; // NOSONAR
import eu.lunisolar.magma.func.supplier.*; // NOSONAR
import org.testng.annotations.*; //NOSONAR
import java.util.regex.Pattern; //NOSONAR
import java.text.ParseException; //NOSONAR
import eu.lunisolar.magma.basics.exceptions.*; //NOSONAR
import java.util.concurrent.atomic.AtomicInteger; //NOSONAR
import java.util.function.*; //NOSONAR
import static eu.lunisolar.magma.func.build.function.to.LTieDblFunctionBuilder.tieDblFunction;
import static eu.lunisolar.magma.func.build.function.to.LTieDblFunctionBuilder.tieDblFunctionFrom;
public class LTieDblFunctionBuilderTest<T>{
@Test
public void testOtherwiseThrow() {
try {
LTieDblFunction<Integer> function = tieDblFunctionFrom(b-> b
.build()
);
function.applyAsInt(100,100,100d);
Assert.fail("No exception was thrown.");
} catch (Throwable e) {
Assert.assertSame(e.getClass(), IllegalStateException.class);
Assert.assertTrue(e.getMessage().contains("There is no case configured for the arguments (if any)."));
}
}
@Test
public void testHandlingCanBeSetOnlyOnce() {
try {
LTieDblFunction<Integer> function = tieDblFunctionFrom(b-> b
.withHandling(h -> h.wrapIf(RuntimeException.class::isInstance, RuntimeException::new))
.build(h -> h.wrapIf(RuntimeException.class::isInstance, RuntimeException::new))
);
Assert.fail("No exception was thrown.");
} catch (Throwable e) {
Assert.assertSame(e.getClass(), UnsupportedOperationException.class);
Assert.assertTrue(e.getMessage().contains("Handling is already set for this builder."));
}
}
@Test
public void testHandling() {
try {
LTieDblFunction<Integer> function = tieDblFunctionFrom(b -> b
.otherwise((a1,a2,a3) -> {
throw new RuntimeException("ORIGINAL");
})
.build(h -> h.wrapIf(RuntimeException.class::isInstance, IllegalStateException::new, "NEW EXCEPTION"))
);
function.applyAsInt(100,100,100d);
Assert.fail("No exception was thrown.");
} catch (Throwable e) {
Assert.assertSame(e.getClass(), IllegalStateException.class);
Assert.assertTrue(e.getMessage().contains("NEW EXCEPTION"));
Assert.assertSame(e.getCause().getClass(), RuntimeException.class);
}
}
@Test
public void testBuild() {
LTieDblFunction<Integer> function = tieDblFunctionFrom( b -> b
.aCase(ce -> ce.of((a1,a2,a3) -> a1 == 0)
.evaluate((a1,a2,a3) -> 0))
.inCase((a1,a2,a3) -> a1 > 0 && a1 < 10).evaluate((a1,a2,a3) -> 1)
.inCase((a1,a2,a3) -> a1 > 10 && a1 < 20).evaluate((a1,a2,a3) -> 2)
.otherwise((a1,a2,a3) -> 99)
.build()
);
FuncAttests.attestTieDblFunc(function)
.doesApplyAsInt(0,0,0d).when(null).to(a -> a.mustEx(Be::equalEx, 0))
.doesApplyAsInt(5,5,5d).when(null).to(a -> a.mustEx(Be::equalEx, 1))
.doesApplyAsInt(15,15,15d).when(null).to(a -> a.mustEx(Be::equalEx, 2))
.doesApplyAsInt(10,10,10d).when(null).to(a -> a.mustEx(Be::equalEx, 99))
;
}
}
| [
"[email protected]"
] | |
0d480a26ca36fb02c672e939464e737279d8c4f5 | 62aaa67a468107022635b566cbcf1109d3e4e648 | /huiyuan/src/private/nc/bs/pub/action/N_HK28_SAVEBASE.java | b015ddeff136eb06fa9a597bc3803c8e8f7bc5c5 | [] | no_license | boblee821226/hongkun | f17a90221683f816f382443f5c223347b41afefc | 46c02ab124924f2c976044c5f31e632f706e61cf | refs/heads/master | 2021-06-25T03:57:28.516510 | 2021-02-22T05:42:07 | 2021-02-22T05:42:07 | 204,677,636 | 1 | 1 | null | null | null | null | GB18030 | Java | false | false | 1,921 | java | package nc.bs.pub.action;
import nc.bs.framework.common.NCLocator;
import nc.bs.pubapp.pf.action.AbstractPfAction;
import nc.impl.pubapp.pattern.rule.IRule;
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
import nc.vo.jcom.lang.StringUtil;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.bs.hkjt.huiyuan.kazuofei.plugin.bpplugin.Hy_kazuofeiPluginPoint;
import nc.vo.hkjt.huiyuan.kazuofei.KazuofeiBillVO;
import nc.itf.hkjt.IHy_kazuofeiMaintain;
public class N_HK28_SAVEBASE extends AbstractPfAction<KazuofeiBillVO> {
@Override
protected CompareAroundProcesser<KazuofeiBillVO> getCompareAroundProcesserWithRules(
Object userObj) {
CompareAroundProcesser<KazuofeiBillVO> processor = null;
KazuofeiBillVO[] clientFullVOs = (KazuofeiBillVO[]) this.getVos();
if (!StringUtil.isEmptyWithTrim(clientFullVOs[0].getParentVO()
.getPrimaryKey())) {
processor = new CompareAroundProcesser<KazuofeiBillVO>(
Hy_kazuofeiPluginPoint.SCRIPT_UPDATE);
} else {
processor = new CompareAroundProcesser<KazuofeiBillVO>(
Hy_kazuofeiPluginPoint.SCRIPT_INSERT);
}
// TODO 在此处添加前后规则
IRule<KazuofeiBillVO> rule = null;
return processor;
}
@Override
protected KazuofeiBillVO[] processBP(Object userObj,
KazuofeiBillVO[] clientFullVOs, KazuofeiBillVO[] originBills) {
KazuofeiBillVO[] bills = null;
try {
IHy_kazuofeiMaintain operator = NCLocator.getInstance()
.lookup(IHy_kazuofeiMaintain.class);
if (!StringUtil.isEmptyWithTrim(clientFullVOs[0].getParentVO()
.getPrimaryKey())) {
bills = operator.update(clientFullVOs, originBills);
} else {
bills = operator.insert(clientFullVOs, originBills);
}
} catch (BusinessException e) {
ExceptionUtils.wrappBusinessException(e.getMessage());
}
return bills;
}
}
| [
"[email protected]"
] | |
45aa464809af834535056024683bd6cea01813c8 | 617155d7092fa9d5459f57632a8d885e64941918 | /app/src/main/java/com/apps/multiboo/Screenshotone.java | c3a811c47d4123978d06df4168a7aeb26aa841c7 | [] | no_license | soumyamads/MultiBoo | 34a43738f35a041e8468f3ef42419ab582a12bf8 | cd2d1c97d5c589ea625fc86add41530d283fa5b2 | refs/heads/master | 2021-01-10T03:42:03.951469 | 2016-02-17T08:31:50 | 2016-02-17T08:31:50 | 50,709,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,541 | java | package com.apps.multiboo;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.AssetManager;
import android.graphics.Typeface;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.apps.multiboo.R;
/**
* Created by soumya on 1/24/2016.
*/
public class Screenshotone extends Fragment {
Typeface custom_font;
TextView skip,next;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.screenshotone, container, false);
skip=(TextView)v.findViewById(R.id.skip);
next=(TextView)v.findViewById(R.id.next);
custom_font = Typeface.createFromAsset(getActivity().getAssets(), "font/gretoon.ttf");
skip.setTypeface(custom_font);
next.setTypeface(custom_font);
skip.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(getActivity(),Menupage.class);
startActivity(intent);
}
});
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Boolean Firstclick;
SharedPreferences app_preferences = PreferenceManager
.getDefaultSharedPreferences(getActivity());
SharedPreferences.Editor editor = app_preferences.edit();
Firstclick = app_preferences.getBoolean("Firstclick", true);
if (Firstclick) {
HowActivity.pageclick(1);
editor.putBoolean("Firstclick", false);
editor.commit();
}else{
//app open directly
// Musiccontinue=true;
HelpActivity.pageclick(1);
}
}
});
return v;
}
public static Screenshotone newInstance(String text) {
Screenshotone f = new Screenshotone();
// Bundle b = new Bundle();
// b.putString("msg", text);
//
// f.setArguments(b);
return f;
}
} | [
"[email protected]"
] | |
4618a74468b37c7c2b036a39d12e7962eb20096e | 0d2079efaeb5d41d6c99c45ab350eb4a501936c1 | /src/main/java/mchorse/mclib/utils/keyframes/KeyframeInterpolation.java | da34204695883b67d05d1023da0737b4c409f1db | [
"MIT"
] | permissive | srgantmoomoo/mclib-rpc | 0b302986a1e02f83ba6edc9cbfc74aee514c332e | 55f4a9e0f2c2621acc49736ef3d77a7d89e5711d | refs/heads/master | 2023-02-13T20:05:10.888590 | 2021-01-10T23:16:29 | 2021-01-10T23:16:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,724 | java | package mchorse.mclib.utils.keyframes;
import mchorse.mclib.utils.Interpolation;
import mchorse.mclib.utils.Interpolations;
import mchorse.mclib.utils.MathUtils;
public enum KeyframeInterpolation
{
CONST("const")
{
@Override
public double interpolate(Keyframe a, Keyframe b, float x)
{
return a.value;
}
},
LINEAR("linear")
{
@Override
public double interpolate(Keyframe a, Keyframe b, float x)
{
return Interpolations.lerp(a.value, b.value, x);
}
},
QUAD("quad")
{
@Override
public double interpolate(Keyframe a, Keyframe b, float x)
{
if (a.easing == KeyframeEasing.IN) return Interpolation.QUAD_IN.interpolate(a.value, b.value, x);
if (a.easing == KeyframeEasing.OUT) return Interpolation.QUAD_OUT.interpolate(a.value, b.value, x);
return Interpolation.QUAD_INOUT.interpolate(a.value, b.value, x);
}
},
CUBIC("cubic")
{
@Override
public double interpolate(Keyframe a, Keyframe b, float x)
{
if (a.easing == KeyframeEasing.IN) return Interpolation.CUBIC_IN.interpolate(a.value, b.value, x);
if (a.easing == KeyframeEasing.OUT) return Interpolation.CUBIC_OUT.interpolate(a.value, b.value, x);
return Interpolation.CUBIC_INOUT.interpolate(a.value, b.value, x);
}
},
HERMITE("hermite")
{
@Override
public double interpolate(Keyframe a, Keyframe b, float x)
{
double v0 = a.prev.value;
double v1 = a.value;
double v2 = b.value;
double v3 = b.next.value;
return Interpolations.cubicHermite(v0, v1, v2, v3, x);
}
},
EXP("exp")
{
@Override
public double interpolate(Keyframe a, Keyframe b, float x)
{
if (a.easing == KeyframeEasing.IN) return Interpolation.EXP_IN.interpolate(a.value, b.value, x);
if (a.easing == KeyframeEasing.OUT) return Interpolation.EXP_OUT.interpolate(a.value, b.value, x);
return Interpolation.EXP_INOUT.interpolate(a.value, b.value, x);
}
},
BEZIER("bezier")
{
@Override
public double interpolate(Keyframe a, Keyframe b, float x)
{
if (x <= 0) return a.value;
if (x >= 1) return b.value;
/* Transform input to 0..1 */
double w = b.tick - a.tick;
double h = b.value - a.value;
/* In case if there is no slope whatsoever */
if (h == 0) h = 0.00001;
double x1 = a.rx / w;
double y1 = a.ry / h;
double x2 = (w - b.lx) / w;
double y2 = (h + b.ly) / h;
double e = 0.0005;
e = h == 0 ? e : Math.max(Math.min(e, 1 / h * e), 0.00001);
x1 = MathUtils.clamp(x1, 0, 1);
x2 = MathUtils.clamp(x2, 0, 1);
return Interpolations.bezier(0, y1, y2, 1, Interpolations.bezierX(x1, x2, x, e)) * h + a.value;
}
},
BACK("back")
{
@Override
public double interpolate(Keyframe a, Keyframe b, float x)
{
if (a.easing == KeyframeEasing.IN) return Interpolation.BACK_IN.interpolate(a.value, b.value, x);
if (a.easing == KeyframeEasing.OUT) return Interpolation.BACK_OUT.interpolate(a.value, b.value, x);
return Interpolation.BACK_INOUT.interpolate(a.value, b.value, x);
}
},
ELASTIC("elastic")
{
@Override
public double interpolate(Keyframe a, Keyframe b, float x)
{
if (a.easing == KeyframeEasing.IN) return Interpolation.ELASTIC_IN.interpolate(a.value, b.value, x);
if (a.easing == KeyframeEasing.OUT) return Interpolation.ELASTIC_OUT.interpolate(a.value, b.value, x);
return Interpolation.ELASTIC_INOUT.interpolate(a.value, b.value, x);
}
},
BOUNCE("bounce")
{
@Override
public double interpolate(Keyframe a, Keyframe b, float x)
{
if (a.easing == KeyframeEasing.IN) return Interpolation.BOUNCE_IN.interpolate(a.value, b.value, x);
if (a.easing == KeyframeEasing.OUT) return Interpolation.BOUNCE_OUT.interpolate(a.value, b.value, x);
return Interpolation.BOUNCE_INOUT.interpolate(a.value, b.value, x);
}
};
public final String key;
private KeyframeInterpolation(String key)
{
this.key = key;
}
public abstract double interpolate(Keyframe a, Keyframe b, float x);
public String getKey()
{
return "mclib.interpolations." + this.key;
}
}
| [
""
] | |
fbe2cdf4c2b8e5f918b43d8ec5f8359266660177 | e70350ed3b2b01cfceeaee8eed4ef311b057a28d | /app/src/main/java/com/example/zhaoting/myapplication/model/comment/CommentModel.java | 4a91457bd60fcfe52e4a83bd5339aced2c09c8a8 | [] | no_license | ting0220/Test | 2e4bb4760cc7343399967dea4e7ac921d27a345c | 0884839c2261e805a7ac5282a7650b6bf43f08c7 | refs/heads/master | 2021-01-19T08:59:17.012309 | 2016-07-05T10:21:58 | 2016-07-05T10:21:58 | 56,648,870 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 308 | java | package com.example.zhaoting.myapplication.model.comment;
import com.example.zhaoting.myapplication.model.OnListener;
/**
* Created by zhaoting on 16/6/2.
*/
public interface CommentModel {
void getShortComments(int id, OnListener listener);
void getLongComments(int id, OnListener listener);
}
| [
"[email protected]"
] | |
8a7b51b7a735813b1637b1588cab8e141a059c02 | caa967361492508c13e51ba4800d38f67adc63b0 | /src/lesson11/TestLeafcutterAnts.java | 40470649ed90eca09691152d2824db194e80c265 | [] | no_license | lofrei/codingexamples | eb1cb7f191ddf574cced9e8ee5c82617df38c49f | e51ecc36f51a87123c811d201d3a92b909253f44 | refs/heads/master | 2020-08-23T05:46:07.246886 | 2019-12-07T18:08:19 | 2019-12-07T18:08:19 | 216,556,506 | 0 | 0 | null | 2019-10-21T12:22:26 | 2019-10-21T11:56:47 | null | UTF-8 | Java | false | false | 1,661 | java | package lesson11;
class LeafcutterAnt {
double headsize;
LeafcutterAnt(double headsize){
this.headsize = headsize;
}
public void work(){};
}
class Minim extends LeafcutterAnt{
Minim(){
super(0.9);
}
public void work(){
System.out.println("Hi, I am Minim #"+ this.hashCode() +
". I am a tiny ant with headsize " + headsize +
". I am caring for our fungus gardens.");
}
}
class Minor extends LeafcutterAnt{
Minor(){
super(1.8);
}
public void work(){
System.out.println("Hi, I am Minor #"+ this.hashCode() +
". I am a small ant with headsize " + headsize +
". I am defending our food searching ants.");
}
}
class Media extends LeafcutterAnt{
Media(){
super(4.5);
}
public void work(){
System.out.println("Hi, I am Media #"+ this.hashCode() +
". I am a midsize ant with headsize " + headsize +
". I am cutting the leaves and carry them home.");
}
}
class Major extends LeafcutterAnt{
Major(){
super(7);
}
public void work(){
System.out.println("Hi, I am Major #"+ this.hashCode() +
". I am a really large ant with headsize " + headsize +
". I am a warrior defending our nest.");
}
}
public class TestLeafcutterAnts {
public static void main(String[] args) {
LeafcutterAnt[] colony = {new Minim(),
new Minor(),
new Media(),
new Major()};
for (LeafcutterAnt ant:colony){
ant.work();
}
}
} | [
"[email protected]"
] | |
e33060a62b8a50ff16a94f2ac34172f133c9ee33 | 94b2566e2ed25d37abd0498b74ef273daf24f6c8 | /app/components/dao/ReadDao.java | deccd5c144323db1f96fe18f32d405de63215c52 | [
"MIT"
] | permissive | uktrade/lite-exporter-dashboard-archive | d0f1837a17b794313bd3b7487666471fa3093071 | e3eab54f39204b3a105b27a06ee6d259e4faf1bf | refs/heads/master | 2022-04-01T15:49:38.398191 | 2019-07-01T13:53:14 | 2019-07-01T13:53:14 | 97,020,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 251 | java | package components.dao;
import java.util.List;
import models.Read;
public interface ReadDao {
List<Read> getReadList(String userId);
void insertRead(Read read);
void deleteAllReadDataByUserId(String userId);
void deleteAllReadData();
}
| [
"[email protected]"
] | |
fd49496a7e2663a048d0bd320cbbb76f2627bb5a | 79a9e525809ac5efe331958d1737d678cbe1a74e | /src/main/java/com/jmatio/types/MLUInt32.java | 5fe4ed8af4d845bfb5d9cc9f23b425eb5b92d37d | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | diffplug/matfilerw | 170b4e8d2194771e39c00df44a9914c9ff766fb7 | 5edb6b223c77fe1dfdc5210f2078f94878d3f721 | refs/heads/master | 2021-01-17T15:18:30.390668 | 2018-12-28T19:45:27 | 2018-12-28T19:45:27 | 43,794,907 | 61 | 22 | NOASSERTION | 2018-12-28T19:30:20 | 2015-10-07T04:23:06 | Java | UTF-8 | Java | false | false | 678 | java | /*
* Code licensed under new-style BSD (see LICENSE).
* All code up to tags/original: Copyright (c) 2006, Wojciech Gradkowski
* All code after tags/original: Copyright (c) 2015, DiffPlug
*/
package com.jmatio.types;
public class MLUInt32 extends MLInt32 {
public MLUInt32(String name, int[] dims, int type, int attributes) {
super(name, dims, type, attributes);
}
public MLUInt32(String name, int[] vals, int m) {
super(name, vals, m);
}
public MLUInt32(String name, int[] dims) {
super(name, dims);
}
public MLUInt32(String name, int[][] vals) {
super(name, vals);
}
public MLUInt32(String name, Integer[] vals, int m) {
super(name, vals, m);
}
}
| [
"[email protected]"
] | |
9f9c21f5f03e7dc60d082f688b4cafe00f491253 | ecfbaced6ba4b11e679c5467dc89d4dbe450b627 | /app/src/main/java/com/shwm/freshmallpos/view/IMainOrderView.java | 65432e335935babaf78bd6f289e495e2b42fcdb5 | [] | no_license | damo2/testPos | 34683947a125bf04d2ceb0a573509811ce10279d | f8292db8b091014eade593957258a757ed5a71e0 | refs/heads/master | 2022-02-27T11:41:18.344409 | 2019-09-30T03:24:24 | 2019-09-30T03:24:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 293 | java | package com.shwm.freshmallpos.view;
import java.util.List;
import com.shwm.freshmallpos.been.OrderEntity;
public interface IMainOrderView extends IBaseView{
int getPageType();
void showListOrder(List<OrderEntity> listOrder);
void setLoadType(int loadType);
void refreshCancel();
}
| [
"[email protected]"
] | |
56a462d430c585e29d4f4eec65d51e85d84547e2 | f52a67afd5727eb8b84eb73704d4035716487cd5 | /Level1/src/main/java/lambda/sample/articles/Person.java | d34820bf95dfb3db5caba1451747982484057812 | [] | no_license | rocksolidbasics/Practice | 0418988aa74472ed7fd4d198d76643ee08291be2 | 9afa12da6f643dd33c3348f60c302a5f21ef7b94 | refs/heads/master | 2021-06-11T18:58:52.928566 | 2019-09-28T08:22:52 | 2019-09-28T08:22:52 | 135,718,638 | 0 | 0 | null | 2021-06-04T02:08:59 | 2018-06-01T13:05:56 | Java | UTF-8 | Java | false | false | 1,492 | java | package lambda.sample.articles;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class Person {
private String _givenName;
private String _surname;
private Gender _gender;
private int _age;
private Map<Integer, ArticleInfo> _selling = new ConcurrentHashMap<>();
private Map<Integer, ArticleInfo> _buying = new ConcurrentHashMap<>();
private int _discount;
public String getGivenName() {
return _givenName;
}
public void setGivenName(String givenName) {
_givenName = givenName;
}
public String getSurname() {
return _surname;
}
public void setSurname(String surname) {
_surname = surname;
}
public Gender getGender() {
return _gender;
}
public void setGender(Gender gender) {
_gender = gender;
}
public boolean isFemale(){
return _gender == Gender.Female;
}
public int getAge() {
return _age;
}
public void setAge(int age) {
_age = age;
}
public boolean isVendor() {
return _selling.size() > 0;
}
public int getDiscount() {
return _discount;
}
public void setDiscount(int discount) {
_discount = discount;
}
public Map<Integer, ArticleInfo> getSelling() {
return _selling;
}
public void setSelling(Map<Integer, ArticleInfo> selling) {
_selling = selling;
}
public Map<Integer, ArticleInfo> getBuying() {
return _buying;
}
public void setBuying(Map<Integer, ArticleInfo> buying) {
_buying = buying;
}
}
| [
"[email protected]"
] | |
c5b58d53fbf4c2e69ccccb71c80da52b0bb9432d | c4280bd2906de50dc93b2c6824b2fe5bb3fcf2d5 | /src/main/java/com/uboxol/cloud/mermaid/middleware/EnvironmentPreparedEventListener.java | 834a0c2caac0352f5efdf227499bf367b4b12c4f | [] | no_license | huyifan1/mermaid | 8f3918e3934644ceedd49398058832e188e45620 | 6d26b1f59673541af627dc17f9c24af8758ec9d8 | refs/heads/master | 2022-06-30T19:00:56.084190 | 2020-03-17T03:47:57 | 2020-03-17T03:47:57 | 247,872,775 | 0 | 0 | null | 2022-06-17T03:00:44 | 2020-03-17T03:42:28 | Java | UTF-8 | Java | false | false | 774 | java | package com.uboxol.cloud.mermaid.middleware;
import com.uboxol.util.ZkUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
/**
* model: mermaid
*
* @author liyunde
* @since 2019/10/25 15:20
*/
@Slf4j
public class EnvironmentPreparedEventListener implements ApplicationListener<ApplicationEnvironmentPreparedEvent> {
@Override
public void onApplicationEvent(@NonNull ApplicationEnvironmentPreparedEvent event) {
String zkList = event.getEnvironment().getProperty("cfg.zk-list");
logger.info("event:{},zk:{}", event, zkList);
ZkUtils.setServerList(zkList);
}
}
| [
"[email protected]"
] | |
407742d20155d9f7e042900164c58510710cfc9e | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/elastic--elasticsearch/2cc97a0d3ed2a9276378e2a6462942deab04a1fb/before/MinTests.java | e045809aa85d7b660c343c85f742a178f912a706 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,580 | java | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.messy.tests;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptService.ScriptType;
import org.elasticsearch.script.groovy.GroovyPlugin;
import org.elasticsearch.search.aggregations.bucket.global.Global;
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
import org.elasticsearch.search.aggregations.metrics.AbstractNumericTestCase;
import org.elasticsearch.search.aggregations.metrics.min.Min;
import org.junit.Test;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
import static org.elasticsearch.search.aggregations.AggregationBuilders.global;
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
import static org.elasticsearch.search.aggregations.AggregationBuilders.min;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
/**
*
*/
public class MinTests extends AbstractNumericTestCase {
@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singleton(GroovyPlugin.class);
}
@Override
@Test
public void testEmptyAggregation() throws Exception {
SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx")
.setQuery(matchAllQuery())
.addAggregation(histogram("histo").field("value").interval(1l).minDocCount(0).subAggregation(min("min")))
.execute().actionGet();
assertThat(searchResponse.getHits().getTotalHits(), equalTo(2l));
Histogram histo = searchResponse.getAggregations().get("histo");
assertThat(histo, notNullValue());
Histogram.Bucket bucket = histo.getBuckets().get(1);
assertThat(bucket, notNullValue());
Min min = bucket.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(Double.POSITIVE_INFINITY));
}
@Override
@Test
public void testUnmapped() throws Exception {
SearchResponse searchResponse = client().prepareSearch("idx_unmapped")
.setQuery(matchAllQuery())
.addAggregation(min("min").field("value"))
.execute().actionGet();
assertThat(searchResponse.getHits().getTotalHits(), equalTo(0l));
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(Double.POSITIVE_INFINITY));
}
@Override
@Test
public void testSingleValuedField() throws Exception {
SearchResponse searchResponse = client().prepareSearch("idx")
.setQuery(matchAllQuery())
.addAggregation(min("min").field("value"))
.execute().actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(1.0));
}
@Test
public void testSingleValuedField_WithFormatter() throws Exception {
SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
.addAggregation(min("min").format("0000.0").field("value")).execute().actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(1.0));
assertThat(min.getValueAsString(), equalTo("0001.0"));
}
@Override
@Test
public void testSingleValuedField_getProperty() throws Exception {
SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
.addAggregation(global("global").subAggregation(min("min").field("value"))).execute().actionGet();
assertHitCount(searchResponse, 10);
Global global = searchResponse.getAggregations().get("global");
assertThat(global, notNullValue());
assertThat(global.getName(), equalTo("global"));
assertThat(global.getDocCount(), equalTo(10l));
assertThat(global.getAggregations(), notNullValue());
assertThat(global.getAggregations().asMap().size(), equalTo(1));
Min min = global.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
double expectedMinValue = 1.0;
assertThat(min.getValue(), equalTo(expectedMinValue));
assertThat((Min) global.getProperty("min"), equalTo(min));
assertThat((double) global.getProperty("min.value"), equalTo(expectedMinValue));
assertThat((double) min.getProperty("value"), equalTo(expectedMinValue));
}
@Override
@Test
public void testSingleValuedField_PartiallyUnmapped() throws Exception {
SearchResponse searchResponse = client().prepareSearch("idx", "idx_unmapped")
.setQuery(matchAllQuery())
.addAggregation(min("min").field("value"))
.execute().actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(1.0));
}
@Override
@Test
public void testSingleValuedField_WithValueScript() throws Exception {
SearchResponse searchResponse = client().prepareSearch("idx")
.setQuery(matchAllQuery())
.addAggregation(min("min").field("value").script(new Script("_value - 1")))
.execute().actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(0.0));
}
@Override
@Test
public void testSingleValuedField_WithValueScript_WithParams() throws Exception {
Map<String, Object> params = new HashMap<>();
params.put("dec", 1);
SearchResponse searchResponse = client().prepareSearch("idx")
.setQuery(matchAllQuery())
.addAggregation(min("min").field("value").script(new Script("_value - dec", ScriptType.INLINE, null, params)))
.execute().actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(0.0));
}
@Override
@Test
public void testMultiValuedField() throws Exception {
SearchResponse searchResponse = client().prepareSearch("idx")
.setQuery(matchAllQuery())
.addAggregation(min("min").field("values"))
.execute().actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(2.0));
}
@Override
@Test
public void testMultiValuedField_WithValueScript() throws Exception {
SearchResponse searchResponse = client().prepareSearch("idx")
.setQuery(matchAllQuery())
.addAggregation(min("min").field("values").script(new Script("_value - 1"))).execute().actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(1.0));
}
@Test
public void testMultiValuedField_WithValueScript_Reverse() throws Exception {
// test what happens when values arrive in reverse order since the min
// aggregator is optimized to work on sorted values
SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
.addAggregation(min("min").field("values").script(new Script("_value * -1"))).execute().actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(-12d));
}
@Override
@Test
public void testMultiValuedField_WithValueScript_WithParams() throws Exception {
Map<String, Object> params = new HashMap<>();
params.put("dec", 1);
SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
.addAggregation(min("min").field("values").script(new Script("_value - dec", ScriptType.INLINE, null, params))).execute()
.actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(1.0));
}
@Override
@Test
public void testScript_SingleValued() throws Exception {
SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
.addAggregation(min("min").script(new Script("doc['value'].value"))).execute().actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(1.0));
}
@Override
@Test
public void testScript_SingleValued_WithParams() throws Exception {
Map<String, Object> params = new HashMap<>();
params.put("dec", 1);
SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
.addAggregation(min("min").script(new Script("doc['value'].value - dec", ScriptType.INLINE, null, params))).execute()
.actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(0.0));
}
@Override
@Test
public void testScript_ExplicitSingleValued_WithParams() throws Exception {
Map<String, Object> params = new HashMap<>();
params.put("dec", 1);
SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
.addAggregation(min("min").script(new Script("doc['value'].value - dec", ScriptType.INLINE, null, params))).execute()
.actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(0.0));
}
@Override
@Test
public void testScript_MultiValued() throws Exception {
SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
.addAggregation(min("min").script(new Script("doc['values'].values"))).execute().actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(2.0));
}
@Override
@Test
public void testScript_ExplicitMultiValued() throws Exception {
SearchResponse searchResponse = client().prepareSearch("idx").setQuery(matchAllQuery())
.addAggregation(min("min").script(new Script("doc['values'].values"))).execute().actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(2.0));
}
@Override
@Test
public void testScript_MultiValued_WithParams() throws Exception {
Map<String, Object> params = new HashMap<>();
params.put("dec", 1);
SearchResponse searchResponse = client()
.prepareSearch("idx")
.setQuery(matchAllQuery())
.addAggregation(
min("min")
.script(new Script(
"List values = doc['values'].values; double[] res = new double[values.size()]; for (int i = 0; i < res.length; i++) { res[i] = values.get(i) - dec; }; return res;",
ScriptType.INLINE, null, params))).execute().actionGet();
assertHitCount(searchResponse, 10);
Min min = searchResponse.getAggregations().get("min");
assertThat(min, notNullValue());
assertThat(min.getName(), equalTo("min"));
assertThat(min.getValue(), equalTo(1.0));
}
} | [
"[email protected]"
] | |
2072a09c28c9a8e5ce482e6e56c7fe8defae8eda | 50da523d820bf991ab9aef375cd6dca4ada07e25 | /src/main/java/com/zdv/shop/common/utils/CellServer.java | 71d6f0f412e95e55ae0b09ac10c8ccdc4a37c3ec | [] | no_license | 729324091/zdv_shop | e46e6c4381cfea3fb737eeab84a7b024b1b5597c | 40c78b1d4f5a024e1e31f1a86d36990862b23475 | refs/heads/master | 2020-07-22T12:21:08.304663 | 2019-09-09T04:09:50 | 2019-09-09T04:09:52 | 207,200,757 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,777 | java | package com.zdv.shop.common.utils;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
public class CellServer {
private static final String[] sms_words ={"李克强","年化收益","习近平","东方闪电","乳房","中国电信","世界末日","公寓","监狱","好声音","装 修","商铺","星光","平方","拘留所","楼宇","代办","人民内情真相","法轮","人民真实报道","人民之声论坛","人权","杀笔","傻逼","煞笔","射精","涉日","神通加持法","时代论坛","时事参考","时事论坛","事实独立","收容所","四川独立","他妈的","台独","台盟","台湾独立","台湾狗","台湾建国运动组织","台湾青年独立联盟","台湾政论区","台湾自由联盟","太子党","套牌","天安门录影带","天安门事件","天安门屠杀","天安门一代","统独","统独论坛","突厥斯坦","屠杀","推翻","吾尔开希","西藏独立","洗脑","下体","小肛","邪恶","新观察论坛","新华举报","新华内情","新华通论坛","新疆独立","新生网","新闻封锁","信用危机","性交","学潮","学联","学运","学自联","央视内部晚会","夜话紫禁城","一中一台","伊斯兰运动","阴道","阴胫","淫秽","淫穴","印尼伊斯兰祈祷团","游行","幼齿","幼女","舆论反制","造反","贼民","镇压","争鸣论坛","正见网","正义党论坛","政变","政治反对派","政治犯","政治风波","支那","指点江山论坛","中国复兴论坛","中国孤儿院","中国社会进步党","中国社会论坛","中国威胁论","中国问题论坛","中国真实内容","中国之春","中国猪","中华人民实话实说","中华人民正邪","中华时事","中华养生益智功","中华真实报道","钟山风雨论坛","猪毛","猪毛1","自已的故事","自由民主论坛","自由运动","走私","屙民","嫖娼","汽油短缺","江泽民","汽油飞涨","罢工","法轮功","胡锦涛","人民真实","独院","别墅","公寓","地产","平方","荡妇","贱B","楼宇","a片","商铺","中国移动通信","中央军委","中共中央","二奶","代办证件","你老母","修炼者","做爱","六和彩","台湾陆委会","善念","国民党","处女膜","妓男女院","彩民","性行为","恶警","抵制日货","拉丹","拉登","杀生","李洪志","李登辉","极品推荐","民进党","江流氓","法轮伦","温家宝","男妓","睾丸","短信中心","砸蛋活动","示威","罪魁","聊天热线","达赖","阴部道","陈水扁","罢课","保钓","暴乱","暴政","北大三角地论坛","北韩","北京当局","北京之春","北美自由论坛","藏独","操你妈逼","赤匪","赤化","传单","春夏自由论坛","打倒","大参考","代办","弹劾","地下教会","地下刊物","电视流氓","钓鱼岛","东北独立","东方红时空","东突","东突厥斯坦","东土耳其斯坦","东西南北论坛","动乱","独裁","独裁政治","独夫","独立台湾会","法伦","法仑","法沦","三陪","色情","法纶","法论","法.轮.功","法十轮十功","法谪","法谪功","法囵","法愣","反封锁技术","反腐败论坛","反革命","反攻","反共","反人类","反日","反社会","分裂","粉饰太平","风雨神州","风雨神州论坛","佛展千手法","肛交","高自联","工自联","功法","功友","共产","共产党","共党","共匪","共狗","共军","狗逼","贯通两极法","国家安全","国家机密","国研新闻邮件","国贼","韩东方","韩联潮","汉奸","黑庄","红灯区","红色恐怖","胡紧掏","胡总书记","护法","花花公子","华通时事论坛","华语世界论坛","华岳时事论坛","回民暴动","悔过书","鸡8","鸡扒","鸡吧","鸡八","鸡巴","鸡鸡","鸡毛信文汇","僵贼民","江core","江ze民","江澤民","江八点","江独裁","江戏子","江则民","江贼民","江猪","江猪媳","江主席","疆独","讲法","教徒","揭批书","靖国神社","九评","老人政治","李宏志","李红痔","联总","联总之声","联总之声传单","连胜德","廉政大论坛","炼功","两岸关系","两岸三地论坛","两个中国","流亡","六合彩","六四","陆委会","抡功","轮大","轮功","轮奸","伦功","麻将机","卖国唐捷","毛厕洞","毛片","法抡","毛贼东","美国参考","美国之音","蒙独","蒙古独立","猛料","密穴","民意论坛","民主墙","民族矛盾","南大自由论坛","闹事","你说我说论坛","泡沫经济","屁眼","青天白日旗","情妇","情趣","热站政论网","人民大众时事参考","没有此城市数据","中国电信","三星装饰","装修","装修","洋房","首付","移民","家教","名校","今日建仓","今天布局","今日布局","黑马","私幕","今天建仓","拉升","获利","年化收益","价格6分到8分","建仓","强力","冲击","涨停","实惠套餐","特招班","乳房","首查","法輪","人民真實報導","人民之聲論壇","人權","殺筆","煞筆","時代論壇","時事參考","時事論壇","事實獨立","四川獨立","他媽的","台獨","臺盟","臺灣獨立","臺灣狗","臺灣青年獨立聯盟","臺灣政論區","臺灣自由聯盟","天安門錄影帶","天安門事件","天安門屠殺","天安門一代","統獨","統獨論壇","屠殺","吾爾開希","西藏獨立","洗腦","下體","邪惡","新觀察論壇","新華舉報","新華內情","新華通論壇","新疆獨立","新生網","新聞封鎖","學潮","學聯","學?學自聯","央視內部晚會","夜話紫禁城","伊斯蘭邉?陰道","陰脛","淫穢","遊行","幼齒","輿論反制","倜?鎮壓","爭鳴論壇","正見網","正義黨論壇","政變","政治反對派","政治風波","指點江山論壇","中國復興論壇","中國孤兒院","中國社會進步黨","中國社會論壇","中國威脅論","中國問題論壇","中國真實內容","中國之春","中國豬","中華人民實話實說","中華人民正邪","中華時事","中華養生益智功","中華真實報導","鐘山風雨論壇","豬毛","豬毛1","自由民主論壇","汽油飛漲","罷工","法輪功","人民真實","蕩婦","中國移動通信","中央軍委","代辦證件","修煉者","做愛","臺灣陸委會","國民黨","處女膜","性行為","惡警","抵制日貨","殺生","李登輝","極品推薦","民進黨","達賴","陰部道","陳水扁","21世紀中國基金會","罷課","保釣","暴亂","北大三角地論壇","北韓","北京當局","北美自由論壇","藏獨","操你媽逼","傳單","春夏自由論壇","大參考","代辦","彈劾","地下教會","釣魚島","東北獨立","東方紅時空","東突","法綸","法論","法十輪十功","法謫","法謫功","法圇","反封鎖技術","反腐敗論壇","反人類","反社會","粉飾太平","風雨神州","風雨神州論壇","高自聯","工自聯","共產","共產黨","共黨","共軍","貫通兩極法","國家安全","國家機密","華通時事論壇","華語世界論壇","華嶽時事論壇","回民暴動","悔過書","雞8","雞扒","雞吧","雞八","雞巴","雞雞","雞毛信文匯","僵倜?江八點","江獨裁","江戲子","江則民","江倜?江豬","江豬媳","疆獨","講法","揭批書","靖國神社","九評","李紅痔","聯總","聯總之聲","聯總之聲傳單","陸委會","掄功","輪大","輪功","輪奸","倫功","麻將機","賣國唐捷","毛廁洞","法掄","毛贃|","美國參考","美國之音","蒙獨","蒙古獨立","民意論壇","民主牆","南大自由論壇","鬧事","你說我說論壇","泡沫經濟","情婦","熱站政論網","人民大眾時事參考","耶穌","聖經","家庭電臺","審判日","薄熙來","耶稣","圣经","基督","家庭电台","审判日","宗共","人民內情真相","薄熙来","信用危機","溫家寶","東突厥斯坦","東土耳其斯坦","東西南北論壇","動亂","獨裁","獨裁政治","獨夫","獨立臺灣會","法倫","法侖","法淪","國研新聞郵件","韓聯潮","漢奸","黑莊","紅燈區","紅色恐怖","胡緊掏","胡總書記","護法","連勝德","廉政大論壇","煉功","兩岸關係","兩岸三地論壇","兩個中國","今日建倉","今天佈局","今日佈局","黑馬","星光大道","21世纪中国基金会","生肖","留学"};
private static final CellServer instance = new CellServer();
private CellServer() {
}
public static CellServer getInstance()
{
return instance;
}
public static String smsPlit(String source){
String str=source,sc = "",sto = "";
for(int i=0;i<sms_words.length;i++){
sc = sms_words[i];
if(str.indexOf(sms_words[i])>0){
sto = "";
StringBuilder sb = new StringBuilder(sc);
int len = sb.length();
for(int ii=0;ii<len;ii++){
char ch = sc.charAt(ii);
if(ii==(len-1))
sto +=ch;
else
sto +=ch+"l";
}
str = str.replaceAll(sms_words[i],sto);
}
}
return str;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
CellServer cs = CellServer.getInstance();
cs.sendMessage("13760351001","收到吗",2);
/*String message = "易买易送提供(08日12点34分)卤五花肉饭中份1份;隆江猪脚饭中份1份;九零后,单号2098,18938860833送餐地址:深圳留 学生创业大厦1206;交易码876559 回复7:已收到订单;回复8:该菜品已售完,另订";
message = smsPlit(message);*/
//System.out.println(cs.sendSmsxin(""));
//System.out.println(cs.ReceiveMessage("").length());18988776708
//cs.confrim("22811549711");
}
public boolean sendMessage(String tel,String message,int i){
//生成调用的URL.如果参数中有中文一定要用 java.net.URLEncoder.encode(<参数>,"UTF-8")
String qurl="";
try {
if("".equalsIgnoreCase(message)||message==null)return false;
message = smsPlit(message);
qurl = "http://gd.ums86.com:8899/sms/Api/Send.do?SpCode=208433&LoginName=send&Password=hjbpyzn@1937&MessageContent=" + java.net.URLEncoder.encode(message,"GBK")+"&UserNumber="+tel+"&SerialNumber=&ScheduleTime=&ExtendAccessNum=&f=1";
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
URL url;
try {
url = new URL(qurl);
URLConnection URLconnection = url.openConnection();
HttpURLConnection httpConnection = (HttpURLConnection)URLconnection;
int responseCode = httpConnection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
InputStream urlStream = httpConnection.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlStream,"GBK"));
String sCurrentLine = "";
String sTotalString = "";
while ((sCurrentLine = bufferedReader.readLine()) != null) {
sTotalString += sCurrentLine;
}
//System.out.println(sTotalString);
//假设该url页面输出为"OK"
if (sTotalString.indexOf("发送短信成功")>0) {
return true;
} else {
return false;
}
}else{
System.err.println("失败");
}
} catch (Exception e) {
// TODO Auto-generated catch blockeb
e.printStackTrace();
}
return false;
}
}
| [
"[email protected]"
] | |
6f8e516670334aab6459cb648b9c2d4afe8bab1f | 54f081bccc85c22cebdc0b5ff27eaffd06c1e4ed | /src/main/java/br/com/sondait/timesheet/config/WebConfig.java | f36e3f070b16ac6738bee9cbf1eebb3100e55c99 | [] | no_license | LeonardoMelloOficial/sonda-timesheet-accelerator | 18dd1644378b818a81a2b72e8e10aa8f7391a585 | 7688dc5f934525e60facee7b646934d61aea090a | refs/heads/master | 2020-06-20T08:30:33.655236 | 2019-07-30T20:23:55 | 2019-07-30T20:23:55 | 197,059,554 | 1 | 1 | null | 2019-08-24T17:47:01 | 2019-07-15T19:28:05 | Java | UTF-8 | Java | false | false | 725 | java | package br.com.sondait.timesheet.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD", "TRACE",
"CONNECT");
}
// public void addResourceHandlers(ResourceHandlerRegistry registry) {
// registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
// }
} | [
"[email protected]"
] | |
2a43335df9ef0b1d8782d3b7c4843f4dc3e0df19 | 5ed9f418963b8853e4a706cc5971af97cd588e5e | /src/main/java/br/com/projetcworkshop/services/exception/DataIntegrityException.java | 60d3ad0f2cdaab999d07bd7c23b2a6a7de1d64d4 | [] | no_license | LeoFernandes193/Project-Workshop-Java | e6c0248beba2508168208b369ecbe10a3d92da54 | ad75bef5a86455343e3d48056d81caee310a4403 | refs/heads/master | 2020-07-29T13:05:57.153752 | 2019-07-04T19:56:53 | 2019-07-04T19:56:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package br.com.projetcworkshop.services.exception;
public class DataIntegrityException extends RuntimeException{
private static final long serialVersionUID = 1L;
public DataIntegrityException(String message) {
super(message);
}
public DataIntegrityException(String message, Throwable cause) {
super(message, cause);
}
}
| [
"[email protected]"
] | |
5b90d928f05160e80c02f4a995eee1a490a6e031 | cd9a2f19fe97dfebdc646becdf7ae7e5ce476123 | /spring-web/src/main/java/org/springframework/web/context/AbstractContextLoaderInitializer.java | d38e739876e3ac66fa48c564804bf3653708c51d | [] | no_license | nicky-chen/spring-framework-3.2.x | d5f0fae80847da4f303f94443ce46cd92352979a | e33e9639d82aa9395509227567aa714d41ac2a2b | refs/heads/master | 2021-08-29T00:54:28.870499 | 2021-08-17T11:28:08 | 2021-08-17T11:28:08 | 125,344,623 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,073 | java | /*
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.context;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.WebApplicationInitializer;
/**
* Convenient base class for {@link WebApplicationInitializer} implementations
* that register a {@link ContextLoaderListener} in the servlet context.
*
* <p>The only method required to be implemented by subclasses is
* {@link #createRootApplicationContext()}, which gets invoked from
* {@link #registerContextLoaderListener(ServletContext)}.
*
* @author Arjen Poutsma
* @author Chris Beams
* @since 3.2
*/
public abstract class AbstractContextLoaderInitializer implements WebApplicationInitializer {
/** Logger available to subclasses */
protected final Log logger = LogFactory.getLog(getClass());
public void onStartup(ServletContext servletContext) throws ServletException {
registerContextLoaderListener(servletContext);
}
/**
* Register a {@link ContextLoaderListener} against the given servlet context. The
* {@code ContextLoaderListener} is initialized with the application context returned
* from the {@link #createRootApplicationContext()} template method.
* @param servletContext the servlet context to register the listener against
*/
protected void registerContextLoaderListener(ServletContext servletContext) {
WebApplicationContext rootAppContext = createRootApplicationContext();
if (rootAppContext != null) {
servletContext.addListener(new ContextLoaderListener(rootAppContext));
}
else {
logger.debug("No ContextLoaderListener registered, as " +
"createRootApplicationContext() did not return an application context");
}
}
/**
* Create the "<strong>root</strong>" application context to be provided to the
* {@code ContextLoaderListener}.
* <p>The returned context is delegated to
* {@link ContextLoaderListener#ContextLoaderListener(WebApplicationContext)} and will
* be established as the parent context for any {@code DispatcherServlet} application
* contexts. As such, it typically contains middle-tier services, data sources, etc.
* @return the root application context, or {@code null} if a root context is not
* desired
* @see org.springframework.web.servlet.support.AbstractDispatcherServletInitializer
*/
protected abstract WebApplicationContext createRootApplicationContext();
}
| [
"[email protected]"
] | |
c9b3697b3174f4a03857b5e1f615a234e6d1ee32 | 1e19ee066d600f1d39131e6eb6ffe76524053a57 | /src/br/com/dfmachado/listadefilmes/views/ComponentsAndRenderers/StatusComboModel.java | ef81f029fbfaa692aeded29cf03796103b3bf7f2 | [] | no_license | diegofelipem/ListaDeFilmes | c90901b35fdef5653b92df062ad54f8f2f432147 | 2064de75f2e61541825a5e80ff9414de2601bb88 | refs/heads/master | 2021-06-26T07:46:39.099275 | 2017-09-10T22:30:58 | 2017-09-10T22:30:58 | 103,065,842 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,101 | java | package br.com.dfmachado.listadefilmes.views.ComponentsAndRenderers;
import br.com.dfmachado.listadefilmes.controllers.StatusController;
import br.com.dfmachado.listadefilmes.models.Status;
import java.util.List;
import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;
/**
*
* @author diego.felipe
*/
public class StatusComboModel extends AbstractListModel implements ComboBoxModel {
private final List<Status> status;
private final StatusController controller = new StatusController();
private Status selecao = null;
public StatusComboModel() {
this.status = this.controller.listAll();
this.status.add(null);
}
@Override
public int getSize() {
return this.status.size();
}
@Override
public Object getElementAt(int index) {
return this.status.get(index);
}
@Override
public void setSelectedItem(Object anItem) {
this.selecao = (Status) anItem;
}
@Override
public Object getSelectedItem() {
return this.selecao;
}
}
| [
"diego@DIEGO-NOTE"
] | diego@DIEGO-NOTE |
5ca601b9d978929ac2f0d923392da9dc87b0f98e | 0a92a5036703276c76660bd13bfbf67e0970ead0 | /app/src/androidTest/java/edu/orangecoastcollege/cs273/ltruong58/tapcounter/ApplicationTest.java | f4b42928bf3763860b2884167cdebdbf507cff07 | [] | no_license | ltruong58/TapCounter2 | dc80861736aea470ac53a2a53d0a11c9f32007f3 | 5cff5dd3281297e17ad9f0fb86545d374b467487 | refs/heads/master | 2020-12-08T12:33:48.602552 | 2016-09-07T00:11:11 | 2016-09-07T00:11:11 | 67,556,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package edu.orangecoastcollege.cs273.ltruong58.tapcounter;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"[email protected]"
] | |
72056d9cb552910dfcb33c30544b66969c8895f7 | 737d06ff92d509def65ec5062b86c7493773e023 | /prd-api/src/main/java/rebue/prd/svc/PrdProductCategorySvc.java | a11aa153bc0c69164e27b66238deb0e10f9672da | [] | no_license | rebue/prd | a23e633b1f973932988638ab7b22fff50b1c9c80 | cdc03ede65518569bcc3b8ef53bae96d85cef1cb | refs/heads/master | 2020-05-20T00:49:20.944467 | 2019-09-23T07:34:11 | 2019-09-23T07:34:11 | 185,295,506 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package rebue.prd.svc;
import java.util.List;
import rebue.prd.jo.PrdProductCategoryJo;
import rebue.prd.mo.PrdProductCategoryMo;
import rebue.prd.ro.PrdProductCategoryTreeRo;
import rebue.robotech.svc.BaseSvc;
/**
* 产品分类
*
* @mbg.generated 自动生成的注释,如需修改本注释,请删除本行
*/
public interface PrdProductCategorySvc extends BaseSvc<java.lang.Long, PrdProductCategoryMo, PrdProductCategoryJo> {
/**
* 获取产品分类树
*
* @return
*/
List<PrdProductCategoryTreeRo> categoryTree();
/**
* 根据分类编码获取产品分类树
*
* @param code
* @return
*/
List<PrdProductCategoryTreeRo> categoryTreeByCode(String code);
}
| [
"[email protected]"
] | |
d842fd4e08c9c7c916235746f8d6dac7d2473cc1 | fd6119771bd19cbad9857c4559595de9688b3440 | /src/classes/Square.java | fff84d721141076fd414cc19983fc48b88cc302a | [] | no_license | nesurr7/prac_4_1 | e454a05cc4cd4c945f9bd2100daeb37342689b56 | d3e116bc68b0fae6c8f2c445152053527e08745a | refs/heads/master | 2022-12-11T06:58:50.506178 | 2020-09-10T07:55:36 | 2020-09-10T07:55:36 | 294,342,153 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,064 | java | package classes;
public class Square extends Rectangle {
double side;
Square() {
}
Square(double side) {
super(side, side);
this.side=side;
}
Square(double side, String color, boolean filled) {
super(side, side, color, filled);
this.side=side;
}
public double getSide() {
return side;
}
public void setSide(double side) {
this.side = side;
this.length=side;
this.width=side;
}
@Override
public void setLength(double length) {
this.side = side;
this.length=side;
this.width=side;
}
@Override
public void setWidth(double width) {
this.side = side;
this.length=side;
this.width=side;
}
@Override
public String toString() {
return "Параметры квадрата:" +
"\nДлина стороны:" + side +
"\nЦвет:" + color +
"\nЗаполнен:" + filled +
"\n________________";}
}
| [
"[email protected]"
] | |
c10093f7727471b8360dfab2b11b6e8f8b370573 | 212146a3c8b7a526f77708453c592970b0d55108 | /app/src/main/java/xaidworkz/selectordemo/MainActivity.java | 3564f21ab5d4ed032856a039ba207557bf04e17f | [] | no_license | zaid-kamil/Android-Camera-Contact-Intent | 6b12607f8d8028755e99188b4ea9158ba53a2625 | d2431ed4d6590c46001c3b741db96a55504cd622 | refs/heads/master | 2021-01-19T14:52:24.077482 | 2017-08-27T09:07:34 | 2017-08-27T09:07:34 | 100,932,526 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 12,134 | java | package xaidworkz.selectordemo;
import android.Manifest;
import android.content.ContentUris;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.ContactsContract;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.widget.CardView;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import xaidworkz.selectordemo.utils.AlbumStorageDirFactory;
import xaidworkz.selectordemo.utils.BaseAlbumDirFactory;
import xaidworkz.selectordemo.utils.FroyoAlbumDirFactory;
import static android.provider.ContactsContract.Contacts;
public class MainActivity extends BaseActivity {
public static final int REQUEST_EXTERNAL_STORAGE = 91;
/*FOR CAMERA INTENT */
private static final int ACTION_TAKE_PHOTO = 1;
private static final String JPEG_FILE_PREFIX = "IMG_";
private static final String JPEG_FILE_SUFFIX = ".jpg";
private static final int REQUEST_SELECT_CONTACT = 23;
private static final String BITMAP_STORAGE_KEY = "viewbitmap";
private static final String IMAGEVIEW_VISIBILITY_STORAGE_KEY = "imageviewvisibility";
private static final String TAG = "hahaha";
Bitmap mImageBitmap;
private String contactID; // contacts unique ID
private AlbumStorageDirFactory mAlbumStorageDirFactory = null;
private String mCurrentPhotoPath;
private TextView tvLauchSelection;
private ImageView ivSelected;
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.navigation_home:
snack(ivSelected, "No magic here");
return true;
case R.id.navigation_phone:
if (handlePermission(Manifest.permission.READ_CONTACTS, REQUEST_SELECT_CONTACT)) {
fetchContact();
}
return true;
case R.id.navigation_notifications:
snack(ivSelected, "not here also");
return true;
}
return false;
}
};
private File imagefile;
/*contact fields*/
private Uri contactUri;
private ImageView ivPic;
private TextView tvName;
private TextView tvMobile;
private CardView cvContact;
/*contact fields ends*/
private void fetchContact() {
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
intent.setType(Contacts.CONTENT_TYPE);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(intent, REQUEST_SELECT_CONTACT);
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tvLauchSelection = (TextView) findViewById(R.id.tvLauchSelection);
ivSelected = (ImageView) findViewById(R.id.ivSelection);
/*contact display view*/
cvContact = (CardView) findViewById(R.id.cvContact);
ivPic = (ImageView) findViewById(R.id.ivPic);
tvName = (TextView) findViewById(R.id.tvName);
tvMobile = (TextView) findViewById(R.id.tvMobile);
/*contact displat view end*/
tvLauchSelection.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
initSelectionSetup();
}
});
mImageBitmap = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
mAlbumStorageDirFactory = new FroyoAlbumDirFactory();
} else {
mAlbumStorageDirFactory = new BaseAlbumDirFactory();
}
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
}
private void initSelectionSetup() {
if (handlePermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, REQUEST_EXTERNAL_STORAGE)) {
dispatchTakePictureIntent(ACTION_TAKE_PHOTO);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == REQUEST_EXTERNAL_STORAGE) {
for (int i = 0; i < permissions.length; i++) {
if (grantResults[i] == PackageManager.PERMISSION_GRANTED) {
snack(ivSelected, "Permission Granted");
initSelectionSetup();
}
}
}
if (requestCode == REQUEST_SELECT_CONTACT) {
for (int i = 0; i < permissions.length; i++) {
if (grantResults[i] == PackageManager.PERMISSION_GRANTED) {
snack(ivSelected, "Permission Granted");
fetchContact();
}
}
}
}
/* Photo album for this application */
private String getAlbumName() {
return getString(R.string.album_name);
}
private File getAlbumDir() {
File storageDir = null;
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
storageDir = mAlbumStorageDirFactory.getAlbumStorageDir(getAlbumName());
if (storageDir != null) {
if (!storageDir.mkdirs()) {
if (!storageDir.exists()) {
snack(ivSelected, " failed to create directory");
return null;
}
}
}
}
return storageDir;
}
private File setUpPhotoFile() throws IOException {
imagefile = createImageFile();
mCurrentPhotoPath = imagefile.getAbsolutePath();
return imagefile;
}
private File createImageFile() throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = JPEG_FILE_PREFIX + timeStamp + "_";
File albumF = getAlbumDir();
File imageF = File.createTempFile(imageFileName, JPEG_FILE_SUFFIX, albumF);
return imageF;
}
private void setPic() {
Picasso.with(context).load(Uri.fromFile(imagefile)).into(ivSelected);
ivSelected.setVisibility(View.VISIBLE);
}
private void galleryAddPic() {
Intent mediaScanIntent = new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE");
File f = new File(mCurrentPhotoPath);
Uri contentUri = Uri.fromFile(f);
mediaScanIntent.setData(contentUri);
this.sendBroadcast(mediaScanIntent);
}
private void dispatchTakePictureIntent(int actionCode) {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File f = null;
try {
f = setUpPhotoFile();
mCurrentPhotoPath = f.getAbsolutePath();
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
} catch (IOException e) {
e.printStackTrace();
f = null;
mCurrentPhotoPath = null;
}
startActivityForResult(takePictureIntent, actionCode);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case ACTION_TAKE_PHOTO:
if (resultCode == RESULT_OK) {
handleBigCameraPhoto();
}
break;
case REQUEST_SELECT_CONTACT:
contactUri = data.getData();
retrieveContactName();
retrieveContactNumber();
retrieveContactPhoto();
cvContact.setVisibility(View.VISIBLE);
break;
} // switch
}
/*phone*/
private void retrieveContactPhoto() {
Bitmap photo = null;
InputStream inpStream = null;
try {
inpStream = Contacts.openContactPhotoInputStream(getContentResolver(),
ContentUris.withAppendedId(Contacts.CONTENT_URI, Long.valueOf(contactID)));
if (inpStream != null) {
photo = BitmapFactory.decodeStream(inpStream);
ivPic.setImageBitmap(photo);
}
} catch (Exception e) {
snack(ivPic, e.getMessage());
}
}
private void retrieveContactNumber() {
String contactNumber = null;
// getting contacts ID
Cursor cursorID = getContentResolver().query(contactUri, new String[]{ContactsContract.Contacts._ID},
null, null, null);
if (cursorID.moveToFirst()) {
contactID = cursorID.getString(cursorID.getColumnIndex(ContactsContract.Contacts._ID));
}
cursorID.close();
// Using the contact ID now we will get contact phone number
Cursor cursorPhone = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
new String[]{ContactsContract.CommonDataKinds.Phone.NUMBER},
ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ? AND " +
ContactsContract.CommonDataKinds.Phone.TYPE + " = " +
ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE,
new String[]{contactID},
null);
if (cursorPhone.moveToFirst()) {
contactNumber = cursorPhone.getString(cursorPhone.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
}
cursorPhone.close();
if (contactNumber != null) {
tvMobile.setText(contactNumber);
}
}
private void retrieveContactName() {
String contactName = null;
// querying contact data store
Cursor cursor = getContentResolver().query(contactUri, null, null, null, null);
if (cursor.moveToFirst()) {
// DISPLAY_NAME = The display name for the contact.
// HAS_PHONE_NUMBER = An indicator of whether this contact has at least one phone number.
contactName = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
}
cursor.close();
if (contactName != null) {
tvName.setText(contactName);
}
}
/*end phone*/
private void handleBigCameraPhoto() {
if (mCurrentPhotoPath != null) {
galleryAddPic();
setPic();
mCurrentPhotoPath = null;
}
}
// Some lifecycle callbacks so that the image can survive orientation change
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putParcelable(BITMAP_STORAGE_KEY, mImageBitmap);
outState.putBoolean(IMAGEVIEW_VISIBILITY_STORAGE_KEY, (mImageBitmap != null));
super.onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
mImageBitmap = savedInstanceState.getParcelable(BITMAP_STORAGE_KEY);
ivSelected.setImageBitmap(mImageBitmap);
ivSelected.setVisibility(savedInstanceState.getBoolean(IMAGEVIEW_VISIBILITY_STORAGE_KEY) ? ImageView.VISIBLE : ImageView.INVISIBLE
);
}
}
| [
"[email protected]"
] | |
51bfba6453576aa71a3b1c6883b8ecc6254d1b85 | eb103eddf6d1e23881c207474db5468b4500f66d | /Ganador.java | e2f0c4b93c16f562431bd6b8f7816a86a695e22c | [] | no_license | objetos15161/Juan-vs-El-Mundo | af55a311944d4e96952f127153ef73f43831fcad | ce19d5ad32bcef972d4deeaa99aa2a539ccdad16 | refs/heads/master | 2021-01-10T05:50:38.121594 | 2015-12-09T18:56:24 | 2015-12-09T18:56:24 | 46,182,564 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | import greenfoot.*;
/**
* Ganador clase que indica el fin del juego mencionando que lo ganaste.
*
* @Ulises Gomez
* @7/12/15
*/
public class Ganador extends World
{
/**
* Constructor para objetos de clase Ganador.
*
*/
public Ganador()
{
// Crea un nuevo mundo de 700x400 celdas con un tamaño de celda de 1x1 pixeles.
super(700, 400, 1);
Back b=new Back();//Crea Boton de regreso
addObject(b,600,300);
}
}
| [
"[email protected]"
] | |
c754af3e6ec29cd921d3ab1869e22c12b15aa23c | e26e5b697473326f1bfa2def3fbd427363f82251 | /src/Modelo/FachadaMundo.java | 1627dd7b31fb4ce6806fa214a14fbd4dc2427432 | [] | no_license | diegorodriguezv/SimEvac | ea59ec10fbb2c24f2f3e98ea116d2d095f4960d1 | 4585a2e9cce9187a563c23aaed0183d171260336 | refs/heads/master | 2021-01-01T15:49:57.297215 | 2010-07-01T06:43:46 | 2010-07-01T06:43:46 | 750,790 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,669 | java | package Modelo;
import Persistencia.Xml;
import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Double;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
public class FachadaMundo {
private static final double GROSOR_PARED = 0.4F;
private ArrayList<ObjetoSimulación> paredes;
private ArrayList<Agente> agentes;
private Point2D.Double orígenVisualización, tamañoVisualización;
public FachadaMundo(File archivo) {
iniciarObjetos(archivo);
}
public ArrayList<ObjetoSimulación> getParedesCercanas(Point2D.Double p, double distancia) {
ArrayList<ObjetoSimulación> objetosCercanos = new ArrayList<ObjetoSimulación>();
for (ObjetoSimulación objetoSimulación : paredes) {
if (objetoSimulación.colisiona(p, distancia)) {
objetosCercanos.add(objetoSimulación);
}
}
return objetosCercanos;
}
public ArrayList<ObjetoSimulación> getObjetosCercanos(Point2D.Double p, double distancia) {
ArrayList<ObjetoSimulación> objetosCercanos = new ArrayList<ObjetoSimulación>();
for (ObjetoSimulación objetoSimulación : paredes) {
if (objetoSimulación.colisiona(p, distancia)) {
objetosCercanos.add(objetoSimulación);
}
}
for (ObjetoSimulación objetoSimulación : agentes) {
if (objetoSimulación.colisiona(p, distancia)) {
objetosCercanos.add(objetoSimulación);
}
}
return objetosCercanos;
}
public ArrayList<Agente> getAgentesCercanos(Point2D.Double p, double distancia) {
ArrayList<Agente> agentesCercanos = new ArrayList<Agente>();
for (Agente agente : agentes) {
if (agente.colisiona(p, distancia)) {
agentesCercanos.add(agente);
}
}
return agentesCercanos;
}
public void actualizarTodos(long tiempo) {
for (int i = 0; i < agentes.size(); i++) {
Agente objeto = agentes.get(i);
objeto.calcularFuerzas();
}
for (int i = 0; i < agentes.size(); i++) {
Agente objeto = agentes.get(i);
objeto.actualizar(tiempo);
}
}
public ArrayList<ObjetoSimulación> getObjetos() {
return paredes;
}
public ArrayList<Agente> getAgentes() {
return agentes;
}
private void iniciarObjetos(File archivo) {
// CargarMundo1();
// CargarMundo2();
// CargarMundo3();
File dir1 = new File(".");
try {
System.out.println("Current dir : " + dir1.getCanonicalPath());
} catch (Exception e) {
e.printStackTrace();
}
if (archivo == null) {
CargarMundo3();
} else {
CargarMundoDesdeArchivo(archivo.getPath());
}
}
public void CargarMundoDesdeArchivo(String rutaArchivo) {
Xml mundo = new Xml(rutaArchivo, "mundo");
System.out.println("cargando archivo: " + rutaArchivo);
System.out.println("versión: " + mundo.child("versión").content());
System.out.println("título: " + mundo.child("título").content());
System.out.println("descripción: " + mundo.child("descripción").content());
paredes = new ArrayList<ObjetoSimulación>();
ObjetoSimulación nuevoObjeto;
agentes = new ArrayList<Agente>();
Xml punto = mundo.child("visualización").children("punto").get(0);
orígenVisualización = new Double(Float.parseFloat(punto.string("x")), Float.parseFloat(punto.string("y")));
punto = mundo.child("visualización").children("punto").get(1);
tamañoVisualización = new Double(Float.parseFloat(punto.string("x")), Float.parseFloat(punto.string("y")));
for (Xml pared : mundo.child("paredes").children("pared")) {
System.out.println("pared: " + pared.string("grosor"));
Point2D.Double p1, p2;
punto = pared.children("punto").get(0);
p1 = new Double(Float.parseFloat(punto.string("x")), Float.parseFloat(punto.string("y")));
punto = pared.children("punto").get(1);
p2 = new Double(Float.parseFloat(punto.string("x")), Float.parseFloat(punto.string("y")));
nuevoObjeto = new Pared(p1, p2, Float.parseFloat(pared.string("grosor")));
paredes.add(nuevoObjeto);
System.out.println("x,y: " + punto.string("x") + "," + punto.string("y"));
}
for (Xml puerta : mundo.child("puertas").children("puerta")) {
System.out.println("pared: " + puerta.string("grosor"));
Point2D.Double p1, p2;
punto = puerta.children("punto").get(0);
p1 = new Double(Float.parseFloat(punto.string("x")), Float.parseFloat(punto.string("y")));
punto = puerta.children("punto").get(1);
p2 = new Double(Float.parseFloat(punto.string("x")), Float.parseFloat(punto.string("y")));
nuevoObjeto = new Puerta(p1, p2, Float.parseFloat(puerta.string("grosor")));
paredes.add(nuevoObjeto);
System.out.println("x,y: " + punto.string("x") + "," + punto.string("y"));
}
Xml movimientos = mundo.child("agentes").child("movimientos");
System.out.println("movimientos: " + movimientos.string("directorio"));
String dir = movimientos.string("directorio");
Map<String, ArrayList<Point2D.Double>> rutasMap = new HashMap<String, ArrayList<Double>>();
Map<String, IMovimiento> movimientosMap = new HashMap<String, IMovimiento>();
for (Xml ruta : movimientos.child("rutas").children("ruta")) {
ArrayList<Point2D.Double> estaRuta = new ArrayList<Double>();
System.out.println("ruta: " + ruta.string("nombre"));
for (Xml puntoRuta : ruta.children("punto")) {
System.out.println("x,y: " + puntoRuta.string("x") + "," + puntoRuta.string("y"));
estaRuta.add(new Double(Float.parseFloat(puntoRuta.string("x")),
Float.parseFloat(puntoRuta.string("y"))));
}
rutasMap.put(ruta.string("nombre"), estaRuta);
}
for (Xml movimiento : movimientos.children("movimiento")) {
System.out.println("movimiento: " + movimiento.string("nombre") +
movimiento.string("archivo"));
movimientosMap.put(movimiento.string("nombre"),
crearMovimiento(rutasMap.get(movimiento.string("ruta")), null));
}
for (Xml multitud : mundo.child("agentes").children("multitud")) {
System.out.println("cantidad: " + multitud.string("cantidad"));
Xml esquinaÁrea1 = multitud.child("área").children("punto").get(0);
Xml esquinaÁrea2 = multitud.child("área").children("punto").get(1);
Xml varAncho = multitud.child("variación_ancho");
System.out.println("[min,max]: [" + varAncho.string("min") + "," + varAncho.string("max") + "]");
Xml varLargoAncho = multitud.child("variación_relacion_largo_ancho");
System.out.println("[min,max]: [" + varLargoAncho.string("min") + "," + varLargoAncho.string("max") + "]");
construirMultitud(rutasMap.get(multitud.string("ruta")),
new Double(Float.parseFloat(esquinaÁrea1.string("x")), Float.parseFloat(esquinaÁrea1.string("y"))),
new Double(Float.parseFloat(esquinaÁrea2.string("x")), Float.parseFloat(esquinaÁrea2.string("y"))),
Integer.parseInt(multitud.string("cantidad")),
Float.parseFloat(varAncho.string("min")), Float.parseFloat(varAncho.string("max")));
}
// agregar la referencia al mundo para todos los objetos
for (ObjetoSimulación objetoSimulación : paredes) {
objetoSimulación.setMundo(this);
}
for (Agente agente : agentes) {
agente.setMundo(this);
}
}
public Double getOrígenVisualización() {
return orígenVisualización;
}
public Double getTamañoVisualización() {
return tamañoVisualización;
}
private void ImprimirMundoDesdeArchivo(String rutaArchivo) {
Xml mundo = new Xml(rutaArchivo, "mundo");
System.out.println("versión: " + mundo.child("versión").content());
System.out.println("título: " + mundo.child("título").content());
System.out.println("descripción: " + mundo.child("descripción").content());
for (Xml punto : mundo.child("visualización").children("punto")) {
System.out.println("x,y: " + punto.string("x") + "," + punto.string("y"));
}
for (Xml pared : mundo.child("paredes").children("pared")) {
System.out.println("pared: " + pared.string("grosor"));
for (Xml punto : pared.children("punto")) {
System.out.println("x,y: " + punto.string("x") + "," + punto.string("y"));
}
}
for (Xml puerta : mundo.child("puertas").children("puerta")) {
System.out.println("pared: " + puerta.string("grosor"));
for (Xml punto : puerta.children("punto")) {
System.out.println("x,y: " + punto.string("x") + "," + punto.string("y"));
}
}
for (Xml movimientos : mundo.child("agentes").children("movimientos")) {
System.out.println("movimientos: " + movimientos.string("directorio"));
for (Xml ruta : movimientos.child("rutas").children("ruta")) {
System.out.println("ruta: " + ruta.string("nombre"));
for (Xml punto : ruta.children("punto")) {
System.out.println("x,y: " + punto.string("x") + "," + punto.string("y"));
}
}
for (Xml movimiento : movimientos.children("movimiento")) {
System.out.println("movimiento: " + movimiento.string("nombre") +
movimiento.string("archivo"));
}
}
for (Xml multitud : mundo.child("agentes").children("multitud")) {
System.out.println("cantidad: " + multitud.string("cantidad"));
for (Xml punto : multitud.child("área").children("punto")) {
System.out.println("x,y: " + punto.string("x") + "," + punto.string("y"));
}
Xml varAncho = multitud.child("variación_ancho");
System.out.println("[min,max]: [" + varAncho.string("min") + "," + varAncho.string("max") + "]");
Xml varLargoAncho = multitud.child("variación_relacion_largo_ancho");
System.out.println("[min,max]: [" + varLargoAncho.string("min") + "," + varLargoAncho.string("max") + "]");
}
}
private void CargarMundo1() {
orígenVisualización = new Double(0, 0);
tamañoVisualización = new Double(500, 500);
paredes = new ArrayList<ObjetoSimulación>();
ObjetoSimulación nuevoObjeto;
agentes = new ArrayList<Agente>();
Point2D.Double p1 = new Point2D.Double(50, 200);
Point2D.Double p2 = new Point2D.Double(400, 200);
Point2D.Double p3 = new Point2D.Double(400, 450);
Point2D.Double p4 = new Point2D.Double(50, 250);
Point2D.Double p5 = new Point2D.Double(350, 250);
Point2D.Double p6 = new Point2D.Double(350, 450);
Point2D.Double p7 = new Point2D.Double(250, 210);
Point2D.Double p8 = new Point2D.Double(375, 225);
Point2D.Double p9 = new Point2D.Double(375, 350);
Point2D.Double p10 = new Point2D.Double(375, 495);
nuevoObjeto = new Pared(p1, p2, 0.2f);
paredes.add(nuevoObjeto);
nuevoObjeto = new Pared(p2, p3, 0.2f);
paredes.add(nuevoObjeto);
nuevoObjeto = new Pared(p4, p5, 0.2f);
paredes.add(nuevoObjeto);
nuevoObjeto = new Pared(p5, p6, 0.2f);
paredes.add(nuevoObjeto);
nuevoObjeto = new Puerta(p1, p4, 0.2f);
paredes.add(nuevoObjeto);
nuevoObjeto = new Puerta(p6, p3, 0.2f);
paredes.add(nuevoObjeto);
ArrayList<Point2D.Double> ruta = new ArrayList<Point2D.Double>();
ruta.add(new Point2D.Double(100, 100));
ruta.add(new Point2D.Double(300, 100));
Agente nuevoAgente = new Agente(p7, 5f, 2.5f);
nuevoAgente.setDestino(p10);
nuevoAgente.setRapidez(2f);
nuevoAgente.setEstrategiaMovimiento(crearMovimiento(ruta, nuevoAgente));
agentes.add(nuevoAgente);
nuevoAgente = new Agente(p8, 5f, 2.5f);
nuevoAgente.setDestino(p10);
nuevoAgente.setRapidez(2f);
nuevoAgente.setEstrategiaMovimiento(crearMovimiento(ruta, nuevoAgente));
agentes.add(nuevoAgente);
nuevoAgente = new Agente(p9, 5f, 2.5f);
nuevoAgente.setDestino(p10);
nuevoAgente.setRapidez(2f);
nuevoAgente.setEstrategiaMovimiento(crearMovimiento(ruta, nuevoAgente));
agentes.add(nuevoAgente);
// agregar la referencia al mundo para todos los objetos
for (ObjetoSimulación objetoSimulación : paredes) {
objetoSimulación.setMundo(this);
}
for (Agente agente : agentes) {
agente.setMundo(this);
}
}
private void CargarMundo2() {
orígenVisualización = new Double(0, 0);
tamañoVisualización = new Double(500, 500);
paredes = new ArrayList<ObjetoSimulación>();
ObjetoSimulación nuevoObjeto;
agentes = new ArrayList<Agente>();
Point2D.Double p1;
Point2D.Double p2;
p1 = new Point2D.Double(250, 400);
p2 = new Point2D.Double(250, 150);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(200, 150);
p2 = new Point2D.Double(400, 150);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(200, 150);
p2 = new Point2D.Double(200, 200);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(100, 200);
p2 = new Point2D.Double(200, 200);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(100, 200);
p2 = new Point2D.Double(100, 50);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(100, 50);
p2 = new Point2D.Double(200, 50);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(200, 50);
p2 = new Point2D.Double(200, 100);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(200, 100);
p2 = new Point2D.Double(450, 100);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(450, 100);
p2 = new Point2D.Double(450, 200);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(450, 200);
p2 = new Point2D.Double(300, 200);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(300, 200);
p2 = new Point2D.Double(300, 400);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(300, 400);
p2 = new Point2D.Double(250, 400);
nuevoObjeto = new Puerta(p1, p2, GROSOR_PARED * 8);
paredes.add(nuevoObjeto);
ArrayList<Point2D.Double> ruta = new ArrayList<Point2D.Double>();
ruta.add(new Point2D.Double(190, 125));
ruta.add(new Point2D.Double(400, 145));
ruta.add(new Point2D.Double(400, 155));
ruta.add(new Point2D.Double(300, 195));
ruta.add(new Point2D.Double(275, 360));
ruta.add(new Point2D.Double(275, 450));
Agente nuevoAgente = new Agente(new Point2D.Double(150, 100), 0.8f, 0.4f);
nuevoAgente.setEstrategiaMovimiento(crearMovimiento(ruta, nuevoAgente));
agentes.add(nuevoAgente);
nuevoAgente = new Agente(new Point2D.Double(150, 125), 0.8f, 0.4f);
nuevoAgente.setEstrategiaMovimiento(crearMovimiento(ruta, nuevoAgente));
agentes.add(nuevoAgente);
nuevoAgente = new Agente(new Point2D.Double(150, 190), 0.8f, 0.4f);
nuevoAgente.setEstrategiaMovimiento(crearMovimiento(ruta, nuevoAgente));
agentes.add(nuevoAgente);
// agregar la referencia al mundo para todos los objetos
for (ObjetoSimulación objetoSimulación : paredes) {
objetoSimulación.setMundo(this);
}
for (Agente agente : agentes) {
agente.setMundo(this);
}
}
private void CargarMundo3() {
orígenVisualización = new Double(0, 0);
tamañoVisualización = new Double(500, 500);
paredes = new ArrayList<ObjetoSimulación>();
ObjetoSimulación nuevoObjeto;
agentes = new ArrayList<Agente>();
Point2D.Double p1;
Point2D.Double p2;
p1 = new Point2D.Double(250, 400);
p2 = new Point2D.Double(250, 150);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(200, 150);
p2 = new Point2D.Double(400, 150);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(200, 130);
p2 = new Point2D.Double(200, 200);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(100, 200);
p2 = new Point2D.Double(200, 200);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(100, 200);
p2 = new Point2D.Double(100, 50);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(100, 50);
p2 = new Point2D.Double(200, 50);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(200, 50);
p2 = new Point2D.Double(200, 120);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(200, 100);
p2 = new Point2D.Double(450, 100);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(450, 100);
p2 = new Point2D.Double(450, 200);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(450, 200);
p2 = new Point2D.Double(300, 200);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(300, 200);
p2 = new Point2D.Double(300, 400);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
// obstáculo
p1 = new Point2D.Double(300, 150);
p2 = new Point2D.Double(330, 130);
nuevoObjeto = new Pared(p2, p1, GROSOR_PARED);
paredes.add(nuevoObjeto);
p1 = new Point2D.Double(330, 130);
p2 = new Point2D.Double(340, 120);
nuevoObjeto = new Pared(p1, p2, GROSOR_PARED);
paredes.add(nuevoObjeto);
// puerta
p1 = new Point2D.Double(300, 400);
p2 = new Point2D.Double(250, 400);
nuevoObjeto = new Puerta(p1, p2, GROSOR_PARED * 8);
paredes.add(nuevoObjeto);
ArrayList<Point2D.Double> ruta = new ArrayList<Point2D.Double>();
ruta.add(new Point2D.Double(210, 125));
// ruta.add(new Point2D.Double(405, 145));
ruta.add(new Point2D.Double(410, 150));
ruta.add(new Point2D.Double(290, 200));
ruta.add(new Point2D.Double(275, 360));
ruta.add(new Point2D.Double(275, 450));
construirMultitud(ruta, new Double(105, 55), new Double(90, 140), 100, 0.5, 0.7);
// agregar la referencia al mundo para todos los objetos
for (ObjetoSimulación objetoSimulación : paredes) {
objetoSimulación.setMundo(this);
}
for (Agente agente : agentes) {
agente.setMundo(this);
}
}
private void construirMultitud(ArrayList<Double> ruta, Point2D.Double orígenVentana,
Point2D.Double tamañoVentana, int cantidad, double minRadio, double maxRadio) {
for (int i = 0; i < cantidad; i++) {
double x, y, ancho, largo;
Point2D.Double orientación = new Double();
Random generador = new Random();
x = númeroAleatorio(orígenVentana.x, orígenVentana.x + tamañoVentana.x, generador);
y = númeroAleatorio(orígenVentana.y, orígenVentana.y + tamañoVentana.y, generador);
orientación.x = númeroAleatorio(0, 1, generador);
orientación.y = númeroAleatorio(0, 1, generador);
ancho = númeroAleatorio(minRadio, maxRadio, generador);
largo = ancho * númeroAleatorio(0.4, 0.7, generador); // gordos y flacos
// ancho = 10;
// largo = 0.1;
Agente nuevoAgente = new Agente(new Point2D.Double(x, y), ancho, largo);
nuevoAgente.setEstrategiaMovimiento(crearMovimiento(ruta, nuevoAgente));
nuevoAgente.setOrientación(orientación);
if (nuevoAgente.colisionaConAgentes(agentes).isEmpty()) {
agentes.add(nuevoAgente);
} else {
i--;
}
}
}
private double númeroAleatorio(double rangoIni, double rangoFin, Random generador) {
double num = generador.nextDouble(); // de 0.0 a 1.0
double resultado;
resultado = num * (rangoFin - rangoIni) + rangoIni;
return resultado;
}
private MovimientoHelbing crearMovimiento(ArrayList<Point2D.Double> ruta, Agente agente) {
MovimientoHelbing nuevoMovimiento = new MovimientoHelbing(this, agente);
nuevoMovimiento.setRuta(ruta);
return nuevoMovimiento;
}
private void CargarMundoCalibración() {
paredes = new ArrayList<ObjetoSimulación>();
ObjetoSimulación nuevoObjeto;
agentes = new ArrayList<Agente>();
Point2D.Double puntoNuevo;
Point2D.Double puntoAnterior;
puntoAnterior = new Point2D.Double(0, 0);
puntoNuevo = new Point2D.Double(0, 500);
nuevoObjeto = new Pared(puntoAnterior, puntoNuevo, GROSOR_PARED);
paredes.add(nuevoObjeto);
puntoAnterior = puntoNuevo;
puntoNuevo = new Point2D.Double(500, 500);
nuevoObjeto = new Pared(puntoAnterior, puntoNuevo, GROSOR_PARED);
paredes.add(nuevoObjeto);
puntoAnterior = puntoNuevo;
puntoNuevo = new Point2D.Double(500, 0);
nuevoObjeto = new Pared(puntoAnterior, puntoNuevo, GROSOR_PARED);
paredes.add(nuevoObjeto);
puntoAnterior = puntoNuevo;
puntoNuevo = new Point2D.Double(0, 0);
nuevoObjeto = new Pared(puntoAnterior, puntoNuevo, GROSOR_PARED);
paredes.add(nuevoObjeto);
puntoAnterior = puntoNuevo;
puntoNuevo = new Point2D.Double(500, 500);
nuevoObjeto = new Pared(puntoAnterior, puntoNuevo, GROSOR_PARED);
paredes.add(nuevoObjeto);
puntoAnterior = new Point2D.Double(500, 0);
puntoNuevo = new Point2D.Double(0, 500);
nuevoObjeto = new Pared(puntoAnterior, puntoNuevo, GROSOR_PARED);
paredes.add(nuevoObjeto);
puntoAnterior = new Point2D.Double(250, 0);
puntoNuevo = new Point2D.Double(250, 500);
nuevoObjeto = new Pared(puntoAnterior, puntoNuevo, GROSOR_PARED);
paredes.add(nuevoObjeto);
puntoAnterior = new Point2D.Double(0, 250);
puntoNuevo = new Point2D.Double(500, 250);
nuevoObjeto = new Pared(puntoAnterior, puntoNuevo, GROSOR_PARED);
paredes.add(nuevoObjeto);
// agregar la referencia al mundo para todos los objetos
for (ObjetoSimulación objetoSimulación : paredes) {
objetoSimulación.setMundo(this);
}
for (Agente agente : agentes) {
agente.setMundo(this);
}
}
}
| [
"[email protected]"
] | |
14a62bf014321c228b7f9abef6adb05ddb1c532d | 2088303ad9939663f5f8180f316b0319a54bc1a6 | /src/main/java/com/lottery/common/schedule/IScheduler.java | 932dfeafd9c5b04782fd7c643db3f996866e5859 | [] | no_license | lichaoliu/lottery | f8afc33ccc70dd5da19c620250d14814df766095 | 7796650e5b851c90fce7fd0a56f994f613078e10 | refs/heads/master | 2022-12-23T05:30:22.666503 | 2019-06-10T13:46:38 | 2019-06-10T13:46:38 | 141,867,129 | 7 | 1 | null | 2022-12-16T10:52:50 | 2018-07-22T04:59:44 | Java | UTF-8 | Java | false | false | 169 | java | package com.lottery.common.schedule;
/**
* 调度接口,所有调度器都必须实现
* @author fengqinyun
*
*/
public interface IScheduler {
public void run();
}
| [
"[email protected]"
] | |
243880cc15adc7d6f20c6b5861fd9ebaa12fba31 | 7ced6c0ed03f2f9345bbc06a09dbbcf5c8687619 | /catering-front/front-wx-api/src/main/java/com/meiyuan/catering/wx/api/index/WxIndexController.java | 887e42d530d13bef6faef33e86d7d1894d8240a8 | [] | no_license | haorq/food-word | c14d5752c6492aed4a6a1410f9e0352479460da0 | 18a71259d77b4d96261dab8ed51ca1f109ab5c2f | refs/heads/master | 2023-01-01T12:19:48.967366 | 2020-10-26T07:32:25 | 2020-10-26T07:32:25 | 307,292,398 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,649 | java | package com.meiyuan.catering.wx.api.index;
import com.meiyuan.catering.core.dto.goods.RecommendDTO;
import com.meiyuan.catering.core.dto.user.Notice;
import com.meiyuan.catering.core.page.PageData;
import com.meiyuan.catering.core.util.Result;
import com.meiyuan.catering.es.dto.merchant.EsMerchantListParamDTO;
import com.meiyuan.catering.es.dto.wx.EsWxMerchantDTO;
import com.meiyuan.catering.marketing.dto.ticket.TicketWxIndexDTO;
import com.meiyuan.catering.wx.annotation.LoginUser;
import com.meiyuan.catering.wx.dto.UserTokenDTO;
import com.meiyuan.catering.wx.dto.goods.WxIndexMarketingGoodsDTO;
import com.meiyuan.catering.wx.dto.index.WxCategoryVO;
import com.meiyuan.catering.wx.dto.index.WxIndexDTO;
import com.meiyuan.catering.wx.dto.index.WxRecommendVO;
import com.meiyuan.catering.wx.service.index.WxIndexService;
import com.meiyuan.catering.wx.vo.WxAdvertisingExtVO;
import com.meiyuan.catering.wx.vo.WxAdvertisingVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author yaoozu
* @description 首页
* @date 2020/3/2111:35
* @since v1.0.0
*/
@RestController
@RequestMapping("/api/index")
@Api(tags = "yaozou-首页")
@Slf4j
public class WxIndexController {
@Autowired
private WxIndexService indexService;
@GetMapping("/intraCityShop/{location}")
@ApiOperation("是否有同城店铺")
public Result<WxIndexDTO> intraCityShop(@LoginUser(required = false) UserTokenDTO token, @PathVariable String location) {
return indexService.intraCityShop(token, location);
}
@GetMapping("/noticeList/{categoryLimit}")
@ApiOperation("公告信息")
public Result<List<Notice>> noticeList(@PathVariable Integer categoryLimit) {
return indexService.noticeList(categoryLimit);
}
@ApiOperation("获取缓存广告 v1.4.0")
@GetMapping("/advertisingList")
public Result<WxAdvertisingVO> advertisingList() {
return indexService.advertisingList();
}
@ApiOperation("获取广告二级页面 v1.4.0")
@GetMapping("/queryAdvertisingExtList/{id}")
public Result<List<WxAdvertisingExtVO>> queryAdvertisingExtList(@PathVariable Long id) {
return indexService.advertisingExtList(id);
}
@GetMapping("/categoryList")
@ApiOperation("小程序类目,好物推荐")
public Result<WxCategoryVO> categoryList() {
return indexService.categoryList();
}
@PostMapping("/recommendList")
@ApiOperation("爆品橱窗")
public Result<PageData<WxRecommendVO>> recommendList(@LoginUser(required = false) UserTokenDTO token, @RequestBody RecommendDTO dto) {
return indexService.recommendList(token, dto);
}
@PostMapping("/merchantList")
@ApiOperation("附近商家")
public Result<PageData<EsWxMerchantDTO>> merchantList(@LoginUser(required = false) UserTokenDTO token, @RequestBody EsMerchantListParamDTO dto) {
return indexService.merchantList(token, dto);
}
@GetMapping("/couponList")
@ApiOperation("优惠卷")
public Result<List<TicketWxIndexDTO>> couponList(@LoginUser(required = false) UserTokenDTO token) {
return indexService.couponList(token);
}
@GetMapping("/killGoodsList/{cityCode}")
@ApiOperation("限时特惠")
public Result<List<WxIndexMarketingGoodsDTO>> killGoodsList(@LoginUser(required = false) UserTokenDTO token, @PathVariable String cityCode) {
return indexService.killGoodsList(token, cityCode);
}
}
| [
"386234736"
] | 386234736 |
c6bb6935ca38596e674ba6558c87f637ce47c3eb | edc721e8ed5cf67d66eefea6afa6fcf785415ee5 | /Java_Advanced_Lab_Part2/Day1/Assignment7/Account.java | 94841aaecede005ae134a1dd94b0774953c34c1a | [] | no_license | rphaiju7/Assignment | f9491747a5ab6b4dd8104110eea835d19cb83651 | 78cbf1bd5f63946d718cdb9ed7811bbcc08ea0d1 | refs/heads/main | 2023-06-03T23:51:16.095575 | 2021-06-26T21:38:39 | 2021-06-26T21:38:39 | 375,831,120 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 868 | java | package Java_Advanced_Lab_Part2.Day1.Assignment7;
public class Account {
private int accountNo;
private Customer customer;
protected double balance;
public Account(int accountNo, Customer customer, double balance){
this.accountNo = accountNo;
this.customer = customer;
this.balance = balance;
}
public Account(){
}
public int getAccountNo() {
return accountNo;
}
public void setAccountNo(int accountNo) {
this.accountNo = accountNo;
}
public Customer getCustomer() {
return customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
} | [
"[email protected]"
] | |
40cb1f04e8afc8e8e49f74815521ba6ea56af111 | 0a6ec9042d8e25fbe93b38cb9612bed1c87aa38c | /Algorithm_Practice/Level Test/src/Re_BJ1011.java | 2c42b372dee27b0dc78ce9006a99c3b813b9d7f0 | [] | no_license | park-seung-hyun/Data_Structure_And_Algorithm | 053c1c5352abc88f83326c180ff5850abf4337dc | ed33a122bea99bc8cd72c7ff52e0a135e59ca378 | refs/heads/master | 2020-04-15T04:32:46.121017 | 2019-05-11T07:22:11 | 2019-05-11T07:22:11 | 164,387,726 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | // 1011번 (복습)
// Fly me to the Alpha Centauri
// 규칙 찾기
import java.util.Scanner;
public class Re_BJ1011 {
static int[] visited;
public static void main(String[] args) {
Scanner stdIn = new Scanner (System.in);
int t = stdIn.nextInt();
for(int i=0;i<t;i++) {
int a = stdIn.nextInt();
int b = stdIn.nextInt();
System.out.println(solve(a,b));
}
}
static int solve(int a, int b) {
int n = b-a;
int k = (int) Math.sqrt(n);
if(!(k*k == n)) {
k+=1;
}
if(k*k-n < k) {
return 2*k-1;
}else {
return 2*(k-1);
}
}
} | [
"[email protected]"
] | |
2d50c9abf97d00435c9397e6947c002420986935 | de3f5c7c3021232cf53e452b938df688929fc345 | /tags/Stable-030608/src/examples/tls/Shootist.java | fc16e9d94d883ad2795f133736d799f4f07d41bd | [
"LicenseRef-scancode-public-domain"
] | permissive | rkday/jain-sip | bd3f728948bdaafd98c17bb4843148edab74cd0d | cf52d49d540f8515b209352f861365dbe3d59d90 | refs/heads/master | 2021-01-22T09:26:50.309500 | 2014-01-25T19:59:06 | 2014-01-25T19:59:06 | 16,236,776 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 12,253 | java | package examples.tls;
import javax.sip.*;
import javax.sip.address.*;
import javax.sip.header.*;
import javax.sip.message.*;
import java.util.*;
/**
* This class is a UAC template. Shootist is the guy that shoots and shootme
* is the guy that gets shot.
*
*@author Daniel Martinez
*@author Ivelin Ivanov
*/
public class Shootist implements SipListener {
private static SipProvider tlsProvider;
private static AddressFactory addressFactory;
private static MessageFactory messageFactory;
private static HeaderFactory headerFactory;
private static SipStack sipStack;
private int reInviteCount;
private ContactHeader contactHeader;
private ListeningPoint tlsListeningPoint;
private int counter;
protected ClientTransaction inviteTid;
protected static final String usageString =
"java "
+ "examples.shootistTLS.Shootist \n"
+ ">>>> is your class path set to the root?";
private static void usage() {
System.out.println(usageString);
System.exit(0);
}
private void shutDown() {
try {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
}
System.out.println("nulling reference");
sipStack.deleteListeningPoint(tlsListeningPoint);
// This will close down the stack and exit all threads
tlsProvider.removeSipListener(this);
while (true) {
try {
sipStack.deleteSipProvider(tlsProvider);
break;
} catch (ObjectInUseException ex) {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
continue;
}
}
}
sipStack = null;
tlsProvider = null;
this.inviteTid = null;
this.contactHeader = null;
addressFactory = null;
headerFactory = null;
messageFactory = null;
this.tlsListeningPoint = null;
this.reInviteCount = 0;
System.gc();
//Redo this from the start.
if (counter < 10 )
this.init();
else counter ++;
} catch (Exception ex) { ex.printStackTrace(); }
}
public void processRequest(RequestEvent requestReceivedEvent) {
Request request = requestReceivedEvent.getRequest();
ServerTransaction serverTransactionId =
requestReceivedEvent.getServerTransaction();
System.out.println(
"\n\nRequest "
+ request.getMethod()
+ " received at "
+ sipStack.getStackName()
+ " with server transaction id "
+ serverTransactionId);
// We are the UAC so the only request we get is the BYE.
if (request.getMethod().equals(Request.BYE))
processBye(request, serverTransactionId);
}
public void processBye(
Request request,
ServerTransaction serverTransactionId) {
try {
System.out.println("shootist: got a bye .");
if (serverTransactionId == null) {
System.out.println("shootist: null TID.");
return;
}
Dialog dialog = serverTransactionId.getDialog();
System.out.println("Dialog State = " + dialog.getState());
Response response = messageFactory.createResponse
(200, request);
serverTransactionId.sendResponse(response);
System.out.println("shootist: Sending OK.");
System.out.println("Dialog State = " + dialog.getState());
this.shutDown();
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
public void processResponse(ResponseEvent responseReceivedEvent) {
System.out.println("Got a response");
Response response = (Response) responseReceivedEvent.getResponse();
Transaction tid = responseReceivedEvent.getClientTransaction();
System.out.println(
"Response received with client transaction id "
+ tid
+ ":\n"
+ response.getStatusCode());
if (tid == null) {
System.out.println("Stray response -- dropping ");
return;
}
System.out.println("transaction state is " + tid.getState());
System.out.println("Dialog = " + tid.getDialog());
System.out.println("Dialog State is " + tid.getDialog().getState());
try {
if (response.getStatusCode() == Response.OK
&& ((CSeqHeader) response.getHeader(CSeqHeader.NAME))
.getMethod()
.equals(
Request.INVITE)) {
// Request cancel = inviteTid.createCancel();
// ClientTransaction ct =
// sipProvider.getNewClientTransaction(cancel);
// ct.sendRequest();
Dialog dialog = tid.getDialog();
Request ackRequest = dialog.createRequest(Request.ACK);
System.out.println("Sending ACK");
dialog.sendAck(ackRequest);
// Send a Re INVITE
if (reInviteCount == 0) {
Request inviteRequest = dialog.createRequest(Request.INVITE);
//((SipURI)inviteRequest.getRequestURI()).removeParameter("transport");
//((ViaHeader)inviteRequest.getHeader(ViaHeader.NAME)).setTransport("tls");
// inviteRequest.addHeader(contactHeader);
try {Thread.sleep(100); } catch (Exception ex) {}
ClientTransaction ct =
tlsProvider.getNewClientTransaction(inviteRequest);
dialog.sendRequest(ct);
reInviteCount ++;
}
}
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
public void processTimeout(javax.sip.TimeoutEvent timeoutEvent) {
System.out.println("Transaction Time out" );
}
public void init() {
SipFactory sipFactory = null;
sipStack = null;
sipFactory = SipFactory.getInstance();
sipFactory.setPathName("gov.nist");
Properties properties = new Properties();
// If you want to try TCP transport change the following to
String transport = "tcp";
String peerHostPort = "127.0.0.1:5071";
properties.setProperty("javax.sip.IP_ADDRESS", "127.0.0.1");
properties.setProperty(
"javax.sip.OUTBOUND_PROXY",
peerHostPort + "/" + transport);
// If you want to use UDP then uncomment this.
//properties.setProperty(
// "javax.sip.ROUTER_PATH",
// "examples.shootistTLS.MyRouter");
properties.setProperty("javax.sip.STACK_NAME", "shootist");
properties.setProperty("javax.sip.RETRANSMISSION_FILTER",
"on");
// The following properties are specific to nist-sip
// and are not necessarily part of any other jain-sip
// implementation.
// You can set a max message size for tcp transport to
// guard against denial of service attack.
properties.setProperty("gov.nist.javax.sip.MAX_MESSAGE_SIZE",
"1048576");
properties.setProperty(
"gov.nist.javax.sip.DEBUG_LOG",
"shootistdebug.txt");
properties.setProperty(
"gov.nist.javax.sip.SERVER_LOG",
"shootistlog.txt");
// Drop the client connection after we are done with the transaction.
properties.setProperty("gov.nist.javax.sip.CACHE_CLIENT_CONNECTIONS", "false");
// Set to 0 in your production code for max speed.
// You need 16 for logging traces. 32 for debug + traces.
// Your code will limp at 32 but it is best for debugging.
properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "16");
try {
// Create SipStack object
sipStack = sipFactory.createSipStack(properties);
System.out.println("createSipStack " + sipStack);
} catch (PeerUnavailableException e) {
// could not find
// gov.nist.jain.protocol.ip.sip.SipStackImpl
// in the classpath
e.printStackTrace();
System.err.println(e.getMessage());
System.exit(0);
}
try {
headerFactory = sipFactory.createHeaderFactory();
addressFactory = sipFactory.createAddressFactory();
messageFactory = sipFactory.createMessageFactory();
Shootist listener = this;
tlsListeningPoint = sipStack.createListeningPoint
(sipStack.getIPAddress(), 5060, "tcp");
tlsProvider = sipStack.createSipProvider(tlsListeningPoint);
tlsProvider.addSipListener(listener);
SipProvider sipProvider = tlsProvider;
String fromName = "BigGuy";
String fromSipAddress = "here.com";
String fromDisplayName = "The Master Blaster";
String toSipAddress = "there.com";
String toUser = "LittleGuy";
String toDisplayName = "The Little Blister";
// create >From Header
SipURI fromAddress =
addressFactory.createSipURI(fromName, fromSipAddress);
//fromAddress.setSecure(true);
Address fromNameAddress = addressFactory.createAddress(fromAddress);
fromNameAddress.setDisplayName(fromDisplayName);
FromHeader fromHeader =
headerFactory.createFromHeader(fromNameAddress, "12345");
// create To Header
SipURI toAddress =
addressFactory.createSipURI(toUser, toSipAddress);
//toAddress.setSecure(true);
Address toNameAddress = addressFactory.createAddress(toAddress);
toNameAddress.setDisplayName(toDisplayName);
ToHeader toHeader =
headerFactory.createToHeader(toNameAddress, null);
// create Request URI
SipURI requestURI =
addressFactory.createSipURI(toUser, peerHostPort);
//requestURI.setSecure( true );
// Create ViaHeaders
ArrayList viaHeaders = new ArrayList();
int port = sipProvider.getListeningPoint(transport).getPort();
ViaHeader viaHeader =
headerFactory.createViaHeader(
sipStack.getIPAddress(),
port,
transport,
null);
// add via headers
viaHeaders.add(viaHeader);
// Create ContentTypeHeader
ContentTypeHeader contentTypeHeader =
headerFactory.createContentTypeHeader("application", "sdp");
// Create a new CallId header
CallIdHeader callIdHeader = sipProvider.getNewCallId();
// Create a new Cseq header
CSeqHeader cSeqHeader =
headerFactory.createCSeqHeader(1L, Request.INVITE);
// Create a new MaxForwardsHeader
MaxForwardsHeader maxForwards =
headerFactory.createMaxForwardsHeader(70);
// Create the request.
Request request =
messageFactory.createRequest(
requestURI,
Request.INVITE,
callIdHeader,
cSeqHeader,
fromHeader,
toHeader,
viaHeaders,
maxForwards);
// Create contact headers
String host = sipStack.getIPAddress();
//SipURI contactUrl = addressFactory.createSipURI(fromName, host);
//contactUrl.setPort(tlsListeningPoint.getPort());
// Create the contact name address.
SipURI contactURI = addressFactory.createSipURI(fromName, host);
//contactURI.setSecure( true );
contactURI.setPort(port);
contactURI.setTransportParam("tcp");
Address contactAddress = addressFactory.createAddress(contactURI);
// Add the contact address.
contactAddress.setDisplayName(fromName);
contactHeader =
headerFactory.createContactHeader(contactAddress);
request.addHeader(contactHeader);
// Add the extension header.
Header extensionHeader =
headerFactory.createHeader("My-Header", "my header value");
request.addHeader(extensionHeader);
String sdpData =
"v=0\r\n"
+ "o=4855 13760799956958020 13760799956958020"
+ " IN IP4 129.6.55.78\r\n"
+ "s=mysession session\r\n"
+ "p=+46 8 52018010\r\n"
+ "c=IN IP4 129.6.55.78\r\n"
+ "t=0 0\r\n"
+ "m=audio 6022 RTP/AVP 0 4 18\r\n"
+ "a=rtpmap:0 PCMU/8000\r\n"
+ "a=rtpmap:4 G723/8000\r\n"
+ "a=rtpmap:18 G729A/8000\r\n"
+ "a=ptime:20\r\n";
byte[] contents = sdpData.getBytes();
//byte[] contents = sdpBuff.toString().getBytes();
request.setContent(contents, contentTypeHeader);
extensionHeader =
headerFactory.createHeader(
"My-Other-Header",
"my new header value ");
request.addHeader(extensionHeader);
Header callInfoHeader =
headerFactory.createHeader(
"Call-Info",
"<http://www.antd.nist.gov>");
request.addHeader(callInfoHeader);
// Create the client transaction.
listener.inviteTid = sipProvider.getNewClientTransaction(request);
// send the request out.
listener.inviteTid.sendRequest();
} catch (Exception ex) {
System.out.println(ex.getMessage());
ex.printStackTrace();
usage();
}
}
public static void main(String args[]) {
new Shootist().init();
}
public void processIOException(IOExceptionEvent exceptionEvent) {
System.out.println("IOException occured while retransmitting requests:" + exceptionEvent);
}
public void processTransactionTerminated(TransactionTerminatedEvent transactionTerminatedEvent) {
System.out.println("Transaction Terminated event: " + transactionTerminatedEvent );
}
public void processDialogTerminated(DialogTerminatedEvent dialogTerminatedEvent) {
System.out.println("Dialog Terminated event: " + dialogTerminatedEvent);
}
}
| [
"(no author)@8e71dc83-d81e-6649-80f2-80b843a9b2be"
] | (no author)@8e71dc83-d81e-6649-80f2-80b843a9b2be |
9cc283789f063ffad94fc45796ecca5cf0851ae1 | 2be836581f85090b43649b8b966d78434e8bf674 | /app/src/main/java/www/winroad/mvp/presenter/HomePresenter.java | d97b54f7a56866db558676e009918193698110a5 | [] | no_license | lvzhuozhao/Project | de3d1328ce2da965fa4cb1a24fb1cda2e08ce95d | 6c6b33910083f8146aaeed941c04fac355ac20d0 | refs/heads/master | 2020-04-11T21:18:20.638079 | 2018-12-14T10:02:54 | 2018-12-14T10:02:54 | 162,101,214 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,252 | java | package www.winroad.mvp.presenter;
import android.util.Log;
import rx.Subscription;
import www.winroad.basemvp.BasePresenter;
import www.winroad.data.callback.LoadTaskCallback;
import www.winroad.entity.UserInfoBean;
import www.winroad.mvp.contract.HomeContract;
import www.winroad.remote.TasksRepositoryProxy;
import static android.content.ContentValues.TAG;
public class HomePresenter extends BasePresenter<HomeContract.homeView> implements HomeContract.homeModel {
@Override
public void homemodel() {
Log.i(TAG, "homemodel: 首页打开成功");
Subscription homein = TasksRepositoryProxy.getInstance().homein(new LoadTaskCallback<UserInfoBean>() {
@Override
public void onTaskLoaded(UserInfoBean data) {
getView().homeSuccess();
}
@Override
public void onDataNotAvailable(String msg) {
getView().homeFailed(msg);
}
@Override
public void onStart() {
getView().showLoading();
}
@Override
public void onCompleted() {
getView().hideLoading();
}
});
addSubscription(homein);
}
}
| [
"[email protected]"
] | |
a5387df0b89bc32c784b7a56d2d097509b4161fc | b1bc6be0d323f93d6eb0507ac8b545401c1fedcc | /basicKnowledge/src/com/xdc/basic/api/apache/commons/chain/comparison/implwithchain/command/GetCustomerInfo.java | fd4c2718af1f4b89c5f690707a1194d9bc3e95c1 | [] | no_license | xdc0209/java-code | 5a331ebcae979fe6b672b527e3b533f2bb42866c | 9dc5c89d9a1f8d880afff34903d315c3ca8ddbb2 | refs/heads/master | 2021-01-17T01:28:31.707484 | 2019-04-16T18:51:47 | 2019-04-16T18:51:47 | 9,099,623 | 7 | 4 | null | null | null | null | UTF-8 | Java | false | false | 457 | java | package com.xdc.basic.api.apache.commons.chain.comparison.implwithchain.command;
import org.apache.commons.chain.Command;
import org.apache.commons.chain.Context;
public class GetCustomerInfo implements Command
{
@SuppressWarnings("unchecked")
@Override
public boolean execute(Context ctx) throws Exception
{
System.out.println("Get customer info");
ctx.put("customerName", "George Burdell");
return false;
}
}
| [
"[email protected]"
] | |
2140bbd0c1f594062cfb1dcc3e5cd07686a0e810 | 4838b0aa27864b87fd110f67c8c86da7e81f8107 | /src/main/java/com/donat/donchess/config/WebConfiguration.java | 50e47c2c4aaf8b598c62c5da5b4a7de0700ac43e | [] | no_license | udvarid/donchess_ver2 | 8a4cc8dd5a5a910890c383adb7f20682786c5fb3 | d0171f34554fd6c4bd3e4455ac7243a995abd24a | refs/heads/master | 2022-10-04T15:56:54.091949 | 2020-04-08T03:42:01 | 2020-04-08T03:42:01 | 189,479,754 | 0 | 0 | null | 2022-09-22T18:56:43 | 2019-05-30T20:41:48 | Java | UTF-8 | Java | false | false | 1,012 | java | package com.donat.donchess.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* A web MVC konfigurációja.
*/
@Configuration
@EnableWebMvc
public class WebConfiguration implements WebMvcConfigurer {
private final Environment environment;
/**
* DI constructor
*
* @param environment DI bean
*/
public WebConfiguration(Environment environment) {
this.environment = environment;
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/swagger-ui.html");
}
}
| [
"[email protected]"
] | |
905a152d9ab512261941fa111b2ae4fcb9b7097e | 9e10883092c7484acf042e6c9ab3f217a56945f3 | /app/src/test/java/newspaperdemo/example/com/newspaper/ExampleUnitTest.java | 926e07ed73079d7e37628d2d3d41b0d9a01d2c87 | [] | no_license | nuruzzamn/newsPaper | eb863352a1147b7df9ed2e0ff12897b3719472bc | bce46cba9be2d25e512a3b4c88356e8fe40e1610 | refs/heads/master | 2020-08-30T13:08:25.802505 | 2019-10-29T21:53:53 | 2019-10-29T21:53:53 | 218,390,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package newspaperdemo.example.com.newspaper;
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);
}
} | [
"[email protected]"
] | |
9f98ff8d451e9e8966f40f8e9d5a00669066a09f | 4800b21c8816a490baa33c15f0bdeca1bb30b841 | /Lab4/server/src/main/java/LabServiceImplBaseImpl.java | 5c629b97aef89db8e907e8085506973edcbf6663 | [] | no_license | pawelurban/Rozprochy | 8296f282f3dc4a5b4a5e6860a6afe864e75cd99b | 316030a0fd7c8c062678be3abeb777417ba20926 | refs/heads/master | 2020-03-20T10:07:37.843249 | 2017-06-06T19:53:40 | 2017-06-06T19:53:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,886 | java | import io.grpc.Status;
import io.grpc.StatusRuntimeException;
import io.grpc.stub.StreamObserver;
import java.time.LocalDateTime;
import java.util.Objects;
public class LabServiceImplBaseImpl extends LabServiceGrpc.LabServiceImplBase {
@Override
public void addResults(Hospital.AddExamRequest request, StreamObserver<Hospital.Response> responseObserver) {
checkPerms(request.getLab());
Hospital.Doctor doctor = Server.doctors.get(request.getDoctor());
Hospital.Patient patient = Server.patients.get(request.getPatient());
if(Objects.isNull(doctor) || Objects.isNull(patient)) {
throw new StatusRuntimeException(Status.NOT_FOUND);
}
Hospital.Lab lab = Server.labs.get(request.getLab());
Hospital.MedicalExam medicalExam = Hospital.MedicalExam.newBuilder()
.setDoctor(doctor)
.setLab(lab)
.setPatient(patient)
.setTime(LocalDateTime.now().toString())
.putAllResults(request.getResultsMap())
.build();
synchronized (Server.exams) {
Server.exams.add(medicalExam);
}
responseObserver.onNext(Hospital.Response.getDefaultInstance());
responseObserver.onCompleted();
}
@Override
public void requestAllResultsForLab(Hospital.Request request, StreamObserver<Hospital.MedicalExam> responseObserver) {
checkPerms(request.getId());
synchronized (Server.exams) {
Server.exams.stream().filter(e -> e.getLab().getPerson().getId() == request.getId())
.forEach(responseObserver::onNext);
}
responseObserver.onCompleted();
}
private void checkPerms(long id) {
if(Objects.isNull(Server.labs.get(id))) {
throw new StatusRuntimeException(Status.PERMISSION_DENIED);
}
}
}
| [
"[email protected]"
] | |
8d2f7cf565c0587537b7b249b61714089a7cae87 | 368c663f8d031f576e3add37dde8e9052dc628d8 | /java/bbop/tags/bbop-1.000/src/org/bbop/expression/parser/ASTEQNode.java | 6ab28d40850d392105fdd87f167c1c92dcc0e3c0 | [] | no_license | mahmoudimus/obo-edit | 494a588830758ddbd7cf43d2e70550ddd542cb1b | 61c146958fd7d0ba7f78cda77f56d45849897b3e | refs/heads/master | 2022-01-31T22:59:21.316185 | 2014-03-20T17:05:47 | 2014-03-20T17:05:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,921 | java | /*
* Copyright 2002-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.bbop.expression.parser;
import org.bbop.expression.JexlContext;
import org.bbop.expression.util.Coercion;
/**
* Represents equality between values.
*
* If the values are of the same class, .equals() is used.
*
* If either value is a {@link Float} or {@link Double} (but both are not the same class),
* the values are coerced to {@link Double}s before comparing.
*
* If either value is a {@link Number} or {@link Character} (but both are not the same class),
* the values are coerced to {@link Long}s before comparing.
*
* If either value is a {@link Boolean} (but both are not the same class),
* the values are coerced to {@link Boolean}s before comparing.
*
* If either value is a {@link String} (but both are not the same class),
* toString() is called on both before comparing.
*
* Otherwise left.equals(right) is returned.
*
* @author <a href="mailto:[email protected]">Geir Magnusson Jr.</a>
* @version $Id: ASTEQNode.java,v 1.2 2007/09/27 01:02:09 jmr39 Exp $
*/
public class ASTEQNode extends SimpleNode {
/**
* Create the node given an id.
*
* @param id node id.
*/
public ASTEQNode(int id) {
super(id);
}
/**
* Create a node with the given parser and id.
*
* @param p a parser.
* @param id node id.
*/
public ASTEQNode(Parser p, int id) {
super(p, id);
}
/** {@inheritDoc} */
public Object jjtAccept(ParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
/** {@inheritDoc} */
public Object value(JexlContext pc) throws Exception {
Object left = ((SimpleNode) jjtGetChild(0)).value(pc);
Object right = ((SimpleNode) jjtGetChild(1)).value(pc);
if (left == null && right == null) {
/*
* if both are null L == R
*/
return Boolean.TRUE;
} else if (left == null || right == null) {
/*
* we know both aren't null, therefore L != R
*/
return Boolean.FALSE;
} else if (left.getClass().equals(right.getClass())) {
return left.equals(right) ? Boolean.TRUE : Boolean.FALSE;
} else if (left instanceof Float || left instanceof Double
|| right instanceof Float || right instanceof Double) {
Double l = Coercion.coerceDouble(left);
Double r = Coercion.coerceDouble(right);
return l.equals(r) ? Boolean.TRUE : Boolean.FALSE;
} else if (left instanceof Number || right instanceof Number
|| left instanceof Character || right instanceof Character) {
return Coercion.coerceLong(left).equals(Coercion.coerceLong(right)) ? Boolean.TRUE
: Boolean.FALSE;
} else if (left instanceof Boolean || right instanceof Boolean) {
return Coercion.coerceBoolean(left).equals(
Coercion.coerceBoolean(right)) ? Boolean.TRUE
: Boolean.FALSE;
} else if (left instanceof java.lang.String || right instanceof String) {
return left.toString().equals(right.toString()) ? Boolean.TRUE
: Boolean.FALSE;
}
return left.equals(right) ? Boolean.TRUE : Boolean.FALSE;
}
}
| [
"jmr39@6f0e8829-b336-0410-acfb-cb9b228023ad"
] | jmr39@6f0e8829-b336-0410-acfb-cb9b228023ad |
a367e3a53b506246ce739dcfafa6d13300710610 | 4b97c615878008844deb7aa687d689a751e6a190 | /megamind-server-app/app/src/main/java/com/megamind/abdul/server/DisclaimerActivity.java | 5b5abae790e9940b7113fdeb8cde396c14e4110b | [] | no_license | ShrutikaSingh/Tex_TE_Project | cfbec88e3e0920ccefbc2690050f3113f14b2d98 | f3d268072cb0a3c03b941f580a6a135deb13a7ee | refs/heads/master | 2020-05-16T03:42:39.459323 | 2019-04-22T15:30:46 | 2019-04-22T15:30:46 | 182,740,931 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 350 | java | package com.megamind.abdul.server;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class DisclaimerActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_disclaimer);
}
}
| [
"[email protected]"
] | |
7fc578623e1494d88ab20d27d0e15c17918ba0fb | eb36ddb1e9c25d2a35d1fc94abaa6ef0f8fa6f7b | /src/main/java/POGOProtos/Rpc/EncounterTutorialCompleteOutProto.java | 6f815ec5b094b42289f577ada51892dce477dbd3 | [
"BSD-3-Clause"
] | permissive | pokemongo-dev-contrib/pogoprotos-java | bbc941b238c051fd1430d364fae108604b13eebd | af129776faf08bfbfc69b32e19e8293bff2e8991 | refs/heads/master | 2021-06-10T15:45:44.441267 | 2021-02-04T21:46:16 | 2021-02-04T21:46:16 | 83,863,204 | 6 | 1 | NOASSERTION | 2020-10-17T20:10:32 | 2017-03-04T03:51:45 | Java | UTF-8 | Java | false | true | 33,867 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: POGOProtos.Rpc.proto
package POGOProtos.Rpc;
/**
* Protobuf type {@code POGOProtos.Rpc.EncounterTutorialCompleteOutProto}
*/
public final class EncounterTutorialCompleteOutProto extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:POGOProtos.Rpc.EncounterTutorialCompleteOutProto)
EncounterTutorialCompleteOutProtoOrBuilder {
private static final long serialVersionUID = 0L;
// Use EncounterTutorialCompleteOutProto.newBuilder() to construct.
private EncounterTutorialCompleteOutProto(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private EncounterTutorialCompleteOutProto() {
result_ = 0;
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new EncounterTutorialCompleteOutProto();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private EncounterTutorialCompleteOutProto(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 8: {
int rawValue = input.readEnum();
result_ = rawValue;
break;
}
case 18: {
POGOProtos.Rpc.PokemonProto.Builder subBuilder = null;
if (pokemon_ != null) {
subBuilder = pokemon_.toBuilder();
}
pokemon_ = input.readMessage(POGOProtos.Rpc.PokemonProto.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(pokemon_);
pokemon_ = subBuilder.buildPartial();
}
break;
}
case 26: {
POGOProtos.Rpc.CaptureScoreProto.Builder subBuilder = null;
if (scores_ != null) {
subBuilder = scores_.toBuilder();
}
scores_ = input.readMessage(POGOProtos.Rpc.CaptureScoreProto.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(scores_);
scores_ = subBuilder.buildPartial();
}
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_EncounterTutorialCompleteOutProto_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_EncounterTutorialCompleteOutProto_fieldAccessorTable
.ensureFieldAccessorsInitialized(
POGOProtos.Rpc.EncounterTutorialCompleteOutProto.class, POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Builder.class);
}
/**
* Protobuf enum {@code POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result}
*/
public enum Result
implements com.google.protobuf.ProtocolMessageEnum {
/**
* <code>UNSET = 0;</code>
*/
UNSET(0),
/**
* <code>SUCCESS = 1;</code>
*/
SUCCESS(1),
/**
* <code>ERROR_INVALID_POKEMON = 2;</code>
*/
ERROR_INVALID_POKEMON(2),
UNRECOGNIZED(-1),
;
/**
* <code>UNSET = 0;</code>
*/
public static final int UNSET_VALUE = 0;
/**
* <code>SUCCESS = 1;</code>
*/
public static final int SUCCESS_VALUE = 1;
/**
* <code>ERROR_INVALID_POKEMON = 2;</code>
*/
public static final int ERROR_INVALID_POKEMON_VALUE = 2;
public final int getNumber() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalArgumentException(
"Can't get the number of an unknown enum value.");
}
return value;
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static Result valueOf(int value) {
return forNumber(value);
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
*/
public static Result forNumber(int value) {
switch (value) {
case 0: return UNSET;
case 1: return SUCCESS;
case 2: return ERROR_INVALID_POKEMON;
default: return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap<Result>
internalGetValueMap() {
return internalValueMap;
}
private static final com.google.protobuf.Internal.EnumLiteMap<
Result> internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<Result>() {
public Result findValueByNumber(int number) {
return Result.forNumber(number);
}
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalStateException(
"Can't get the descriptor of an unrecognized enum value.");
}
return getDescriptor().getValues().get(ordinal());
}
public final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
return POGOProtos.Rpc.EncounterTutorialCompleteOutProto.getDescriptor().getEnumTypes().get(0);
}
private static final Result[] VALUES = values();
public static Result valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new java.lang.IllegalArgumentException(
"EnumValueDescriptor is not for this type.");
}
if (desc.getIndex() == -1) {
return UNRECOGNIZED;
}
return VALUES[desc.getIndex()];
}
private final int value;
private Result(int value) {
this.value = value;
}
// @@protoc_insertion_point(enum_scope:POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result)
}
public static final int RESULT_FIELD_NUMBER = 1;
private int result_;
/**
* <code>.POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result result = 1;</code>
* @return The enum numeric value on the wire for result.
*/
@java.lang.Override public int getResultValue() {
return result_;
}
/**
* <code>.POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result result = 1;</code>
* @return The result.
*/
@java.lang.Override public POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result getResult() {
@SuppressWarnings("deprecation")
POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result result = POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result.valueOf(result_);
return result == null ? POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result.UNRECOGNIZED : result;
}
public static final int POKEMON_FIELD_NUMBER = 2;
private POGOProtos.Rpc.PokemonProto pokemon_;
/**
* <code>.POGOProtos.Rpc.PokemonProto pokemon = 2;</code>
* @return Whether the pokemon field is set.
*/
@java.lang.Override
public boolean hasPokemon() {
return pokemon_ != null;
}
/**
* <code>.POGOProtos.Rpc.PokemonProto pokemon = 2;</code>
* @return The pokemon.
*/
@java.lang.Override
public POGOProtos.Rpc.PokemonProto getPokemon() {
return pokemon_ == null ? POGOProtos.Rpc.PokemonProto.getDefaultInstance() : pokemon_;
}
/**
* <code>.POGOProtos.Rpc.PokemonProto pokemon = 2;</code>
*/
@java.lang.Override
public POGOProtos.Rpc.PokemonProtoOrBuilder getPokemonOrBuilder() {
return getPokemon();
}
public static final int SCORES_FIELD_NUMBER = 3;
private POGOProtos.Rpc.CaptureScoreProto scores_;
/**
* <code>.POGOProtos.Rpc.CaptureScoreProto scores = 3;</code>
* @return Whether the scores field is set.
*/
@java.lang.Override
public boolean hasScores() {
return scores_ != null;
}
/**
* <code>.POGOProtos.Rpc.CaptureScoreProto scores = 3;</code>
* @return The scores.
*/
@java.lang.Override
public POGOProtos.Rpc.CaptureScoreProto getScores() {
return scores_ == null ? POGOProtos.Rpc.CaptureScoreProto.getDefaultInstance() : scores_;
}
/**
* <code>.POGOProtos.Rpc.CaptureScoreProto scores = 3;</code>
*/
@java.lang.Override
public POGOProtos.Rpc.CaptureScoreProtoOrBuilder getScoresOrBuilder() {
return getScores();
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (result_ != POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result.UNSET.getNumber()) {
output.writeEnum(1, result_);
}
if (pokemon_ != null) {
output.writeMessage(2, getPokemon());
}
if (scores_ != null) {
output.writeMessage(3, getScores());
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (result_ != POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result.UNSET.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(1, result_);
}
if (pokemon_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, getPokemon());
}
if (scores_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(3, getScores());
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof POGOProtos.Rpc.EncounterTutorialCompleteOutProto)) {
return super.equals(obj);
}
POGOProtos.Rpc.EncounterTutorialCompleteOutProto other = (POGOProtos.Rpc.EncounterTutorialCompleteOutProto) obj;
if (result_ != other.result_) return false;
if (hasPokemon() != other.hasPokemon()) return false;
if (hasPokemon()) {
if (!getPokemon()
.equals(other.getPokemon())) return false;
}
if (hasScores() != other.hasScores()) return false;
if (hasScores()) {
if (!getScores()
.equals(other.getScores())) return false;
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + RESULT_FIELD_NUMBER;
hash = (53 * hash) + result_;
if (hasPokemon()) {
hash = (37 * hash) + POKEMON_FIELD_NUMBER;
hash = (53 * hash) + getPokemon().hashCode();
}
if (hasScores()) {
hash = (37 * hash) + SCORES_FIELD_NUMBER;
hash = (53 * hash) + getScores().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static POGOProtos.Rpc.EncounterTutorialCompleteOutProto parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static POGOProtos.Rpc.EncounterTutorialCompleteOutProto parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static POGOProtos.Rpc.EncounterTutorialCompleteOutProto parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static POGOProtos.Rpc.EncounterTutorialCompleteOutProto parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static POGOProtos.Rpc.EncounterTutorialCompleteOutProto parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static POGOProtos.Rpc.EncounterTutorialCompleteOutProto parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static POGOProtos.Rpc.EncounterTutorialCompleteOutProto parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static POGOProtos.Rpc.EncounterTutorialCompleteOutProto parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static POGOProtos.Rpc.EncounterTutorialCompleteOutProto parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static POGOProtos.Rpc.EncounterTutorialCompleteOutProto parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static POGOProtos.Rpc.EncounterTutorialCompleteOutProto parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static POGOProtos.Rpc.EncounterTutorialCompleteOutProto parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(POGOProtos.Rpc.EncounterTutorialCompleteOutProto prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code POGOProtos.Rpc.EncounterTutorialCompleteOutProto}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:POGOProtos.Rpc.EncounterTutorialCompleteOutProto)
POGOProtos.Rpc.EncounterTutorialCompleteOutProtoOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_EncounterTutorialCompleteOutProto_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_EncounterTutorialCompleteOutProto_fieldAccessorTable
.ensureFieldAccessorsInitialized(
POGOProtos.Rpc.EncounterTutorialCompleteOutProto.class, POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Builder.class);
}
// Construct using POGOProtos.Rpc.EncounterTutorialCompleteOutProto.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
result_ = 0;
if (pokemonBuilder_ == null) {
pokemon_ = null;
} else {
pokemon_ = null;
pokemonBuilder_ = null;
}
if (scoresBuilder_ == null) {
scores_ = null;
} else {
scores_ = null;
scoresBuilder_ = null;
}
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_EncounterTutorialCompleteOutProto_descriptor;
}
@java.lang.Override
public POGOProtos.Rpc.EncounterTutorialCompleteOutProto getDefaultInstanceForType() {
return POGOProtos.Rpc.EncounterTutorialCompleteOutProto.getDefaultInstance();
}
@java.lang.Override
public POGOProtos.Rpc.EncounterTutorialCompleteOutProto build() {
POGOProtos.Rpc.EncounterTutorialCompleteOutProto result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public POGOProtos.Rpc.EncounterTutorialCompleteOutProto buildPartial() {
POGOProtos.Rpc.EncounterTutorialCompleteOutProto result = new POGOProtos.Rpc.EncounterTutorialCompleteOutProto(this);
result.result_ = result_;
if (pokemonBuilder_ == null) {
result.pokemon_ = pokemon_;
} else {
result.pokemon_ = pokemonBuilder_.build();
}
if (scoresBuilder_ == null) {
result.scores_ = scores_;
} else {
result.scores_ = scoresBuilder_.build();
}
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof POGOProtos.Rpc.EncounterTutorialCompleteOutProto) {
return mergeFrom((POGOProtos.Rpc.EncounterTutorialCompleteOutProto)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(POGOProtos.Rpc.EncounterTutorialCompleteOutProto other) {
if (other == POGOProtos.Rpc.EncounterTutorialCompleteOutProto.getDefaultInstance()) return this;
if (other.result_ != 0) {
setResultValue(other.getResultValue());
}
if (other.hasPokemon()) {
mergePokemon(other.getPokemon());
}
if (other.hasScores()) {
mergeScores(other.getScores());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
POGOProtos.Rpc.EncounterTutorialCompleteOutProto parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (POGOProtos.Rpc.EncounterTutorialCompleteOutProto) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int result_ = 0;
/**
* <code>.POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result result = 1;</code>
* @return The enum numeric value on the wire for result.
*/
@java.lang.Override public int getResultValue() {
return result_;
}
/**
* <code>.POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result result = 1;</code>
* @param value The enum numeric value on the wire for result to set.
* @return This builder for chaining.
*/
public Builder setResultValue(int value) {
result_ = value;
onChanged();
return this;
}
/**
* <code>.POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result result = 1;</code>
* @return The result.
*/
@java.lang.Override
public POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result getResult() {
@SuppressWarnings("deprecation")
POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result result = POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result.valueOf(result_);
return result == null ? POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result.UNRECOGNIZED : result;
}
/**
* <code>.POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result result = 1;</code>
* @param value The result to set.
* @return This builder for chaining.
*/
public Builder setResult(POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result value) {
if (value == null) {
throw new NullPointerException();
}
result_ = value.getNumber();
onChanged();
return this;
}
/**
* <code>.POGOProtos.Rpc.EncounterTutorialCompleteOutProto.Result result = 1;</code>
* @return This builder for chaining.
*/
public Builder clearResult() {
result_ = 0;
onChanged();
return this;
}
private POGOProtos.Rpc.PokemonProto pokemon_;
private com.google.protobuf.SingleFieldBuilderV3<
POGOProtos.Rpc.PokemonProto, POGOProtos.Rpc.PokemonProto.Builder, POGOProtos.Rpc.PokemonProtoOrBuilder> pokemonBuilder_;
/**
* <code>.POGOProtos.Rpc.PokemonProto pokemon = 2;</code>
* @return Whether the pokemon field is set.
*/
public boolean hasPokemon() {
return pokemonBuilder_ != null || pokemon_ != null;
}
/**
* <code>.POGOProtos.Rpc.PokemonProto pokemon = 2;</code>
* @return The pokemon.
*/
public POGOProtos.Rpc.PokemonProto getPokemon() {
if (pokemonBuilder_ == null) {
return pokemon_ == null ? POGOProtos.Rpc.PokemonProto.getDefaultInstance() : pokemon_;
} else {
return pokemonBuilder_.getMessage();
}
}
/**
* <code>.POGOProtos.Rpc.PokemonProto pokemon = 2;</code>
*/
public Builder setPokemon(POGOProtos.Rpc.PokemonProto value) {
if (pokemonBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
pokemon_ = value;
onChanged();
} else {
pokemonBuilder_.setMessage(value);
}
return this;
}
/**
* <code>.POGOProtos.Rpc.PokemonProto pokemon = 2;</code>
*/
public Builder setPokemon(
POGOProtos.Rpc.PokemonProto.Builder builderForValue) {
if (pokemonBuilder_ == null) {
pokemon_ = builderForValue.build();
onChanged();
} else {
pokemonBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <code>.POGOProtos.Rpc.PokemonProto pokemon = 2;</code>
*/
public Builder mergePokemon(POGOProtos.Rpc.PokemonProto value) {
if (pokemonBuilder_ == null) {
if (pokemon_ != null) {
pokemon_ =
POGOProtos.Rpc.PokemonProto.newBuilder(pokemon_).mergeFrom(value).buildPartial();
} else {
pokemon_ = value;
}
onChanged();
} else {
pokemonBuilder_.mergeFrom(value);
}
return this;
}
/**
* <code>.POGOProtos.Rpc.PokemonProto pokemon = 2;</code>
*/
public Builder clearPokemon() {
if (pokemonBuilder_ == null) {
pokemon_ = null;
onChanged();
} else {
pokemon_ = null;
pokemonBuilder_ = null;
}
return this;
}
/**
* <code>.POGOProtos.Rpc.PokemonProto pokemon = 2;</code>
*/
public POGOProtos.Rpc.PokemonProto.Builder getPokemonBuilder() {
onChanged();
return getPokemonFieldBuilder().getBuilder();
}
/**
* <code>.POGOProtos.Rpc.PokemonProto pokemon = 2;</code>
*/
public POGOProtos.Rpc.PokemonProtoOrBuilder getPokemonOrBuilder() {
if (pokemonBuilder_ != null) {
return pokemonBuilder_.getMessageOrBuilder();
} else {
return pokemon_ == null ?
POGOProtos.Rpc.PokemonProto.getDefaultInstance() : pokemon_;
}
}
/**
* <code>.POGOProtos.Rpc.PokemonProto pokemon = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
POGOProtos.Rpc.PokemonProto, POGOProtos.Rpc.PokemonProto.Builder, POGOProtos.Rpc.PokemonProtoOrBuilder>
getPokemonFieldBuilder() {
if (pokemonBuilder_ == null) {
pokemonBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
POGOProtos.Rpc.PokemonProto, POGOProtos.Rpc.PokemonProto.Builder, POGOProtos.Rpc.PokemonProtoOrBuilder>(
getPokemon(),
getParentForChildren(),
isClean());
pokemon_ = null;
}
return pokemonBuilder_;
}
private POGOProtos.Rpc.CaptureScoreProto scores_;
private com.google.protobuf.SingleFieldBuilderV3<
POGOProtos.Rpc.CaptureScoreProto, POGOProtos.Rpc.CaptureScoreProto.Builder, POGOProtos.Rpc.CaptureScoreProtoOrBuilder> scoresBuilder_;
/**
* <code>.POGOProtos.Rpc.CaptureScoreProto scores = 3;</code>
* @return Whether the scores field is set.
*/
public boolean hasScores() {
return scoresBuilder_ != null || scores_ != null;
}
/**
* <code>.POGOProtos.Rpc.CaptureScoreProto scores = 3;</code>
* @return The scores.
*/
public POGOProtos.Rpc.CaptureScoreProto getScores() {
if (scoresBuilder_ == null) {
return scores_ == null ? POGOProtos.Rpc.CaptureScoreProto.getDefaultInstance() : scores_;
} else {
return scoresBuilder_.getMessage();
}
}
/**
* <code>.POGOProtos.Rpc.CaptureScoreProto scores = 3;</code>
*/
public Builder setScores(POGOProtos.Rpc.CaptureScoreProto value) {
if (scoresBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
scores_ = value;
onChanged();
} else {
scoresBuilder_.setMessage(value);
}
return this;
}
/**
* <code>.POGOProtos.Rpc.CaptureScoreProto scores = 3;</code>
*/
public Builder setScores(
POGOProtos.Rpc.CaptureScoreProto.Builder builderForValue) {
if (scoresBuilder_ == null) {
scores_ = builderForValue.build();
onChanged();
} else {
scoresBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <code>.POGOProtos.Rpc.CaptureScoreProto scores = 3;</code>
*/
public Builder mergeScores(POGOProtos.Rpc.CaptureScoreProto value) {
if (scoresBuilder_ == null) {
if (scores_ != null) {
scores_ =
POGOProtos.Rpc.CaptureScoreProto.newBuilder(scores_).mergeFrom(value).buildPartial();
} else {
scores_ = value;
}
onChanged();
} else {
scoresBuilder_.mergeFrom(value);
}
return this;
}
/**
* <code>.POGOProtos.Rpc.CaptureScoreProto scores = 3;</code>
*/
public Builder clearScores() {
if (scoresBuilder_ == null) {
scores_ = null;
onChanged();
} else {
scores_ = null;
scoresBuilder_ = null;
}
return this;
}
/**
* <code>.POGOProtos.Rpc.CaptureScoreProto scores = 3;</code>
*/
public POGOProtos.Rpc.CaptureScoreProto.Builder getScoresBuilder() {
onChanged();
return getScoresFieldBuilder().getBuilder();
}
/**
* <code>.POGOProtos.Rpc.CaptureScoreProto scores = 3;</code>
*/
public POGOProtos.Rpc.CaptureScoreProtoOrBuilder getScoresOrBuilder() {
if (scoresBuilder_ != null) {
return scoresBuilder_.getMessageOrBuilder();
} else {
return scores_ == null ?
POGOProtos.Rpc.CaptureScoreProto.getDefaultInstance() : scores_;
}
}
/**
* <code>.POGOProtos.Rpc.CaptureScoreProto scores = 3;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
POGOProtos.Rpc.CaptureScoreProto, POGOProtos.Rpc.CaptureScoreProto.Builder, POGOProtos.Rpc.CaptureScoreProtoOrBuilder>
getScoresFieldBuilder() {
if (scoresBuilder_ == null) {
scoresBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
POGOProtos.Rpc.CaptureScoreProto, POGOProtos.Rpc.CaptureScoreProto.Builder, POGOProtos.Rpc.CaptureScoreProtoOrBuilder>(
getScores(),
getParentForChildren(),
isClean());
scores_ = null;
}
return scoresBuilder_;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:POGOProtos.Rpc.EncounterTutorialCompleteOutProto)
}
// @@protoc_insertion_point(class_scope:POGOProtos.Rpc.EncounterTutorialCompleteOutProto)
private static final POGOProtos.Rpc.EncounterTutorialCompleteOutProto DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new POGOProtos.Rpc.EncounterTutorialCompleteOutProto();
}
public static POGOProtos.Rpc.EncounterTutorialCompleteOutProto getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<EncounterTutorialCompleteOutProto>
PARSER = new com.google.protobuf.AbstractParser<EncounterTutorialCompleteOutProto>() {
@java.lang.Override
public EncounterTutorialCompleteOutProto parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new EncounterTutorialCompleteOutProto(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<EncounterTutorialCompleteOutProto> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<EncounterTutorialCompleteOutProto> getParserForType() {
return PARSER;
}
@java.lang.Override
public POGOProtos.Rpc.EncounterTutorialCompleteOutProto getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
| [
"[email protected]"
] | |
587e078ed9be5804d09f5c755ee178215b3a74a3 | fe3a061968e26cc0f4462326f89cb7b788c53ad5 | /Forchild000/src/com/forchild/data/imple/AnalysisSendValid.java | 0b16ae8c687d8218b4e590a715abd27833326bbb | [] | no_license | reeki/ReekiTest | ffd7a6b354fa7a14c31fabac283ffde9912528fb | 9bb1a3f440e767c3c1fb016805bdfd43119e08a7 | refs/heads/master | 2021-01-10T05:06:20.930104 | 2015-12-16T08:06:33 | 2015-12-16T08:06:33 | 47,959,404 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 631 | java | package com.forchild.data.imple;
import org.json.JSONObject;
import com.forchild.data.BaseProtocolFrame;
import com.forchild.data.RequestSendSOS;
import com.forchild.data.RequestSendValidCode;
public class AnalysisSendValid implements BaseProtocolFrameProcess {
@Override
public BaseProtocolFrame parse(BaseProtocolFrame protocol, JSONObject json) {
if (protocol != null && protocol instanceof RequestSendValidCode) {
protocol.setReq(json.optInt("req", -1));
protocol.setIsResponse(true);
return protocol;
}
return null;
}
@Override
public int getType() {
return BaseProtocolFrame.SEND_VALID_CODE;
}
}
| [
"[email protected]"
] | |
97943c453e9db6f0ac94df47606c773267e49ac6 | abf491afff7ccf1564c10671d9df9a2d206408b5 | /src/main/java/ch/rweiss/terminal/Key.java | 6b1531711c526251d9f0f89d4a439f5e33ee3aef | [
"Apache-2.0"
] | permissive | weissreto/ansi-terminal | 7f029f4d2e93c9635544b649dc813cb32d615476 | 5c7dc874b0829c100381f25ba79f1f79105fc527 | refs/heads/master | 2021-10-11T12:54:34.696732 | 2019-01-25T21:20:21 | 2019-01-25T21:20:21 | 111,735,791 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,924 | java | package ch.rweiss.terminal;
import ch.rweiss.terminal.internal.EscCodeParser;
public abstract class Key
{
public static final Key UP = new Control(EscCode.csi('A'), "UP");
public static final Key DOWN = new Control(EscCode.csi('B'), "DOWN");
public static final Key RIGHT = new Control(EscCode.csi('C'), "RIGHT");
public static final Key LEFT = new Control(EscCode.csi('D'), "LEFT");
public static final Key HOME = new Control(EscCode.csi('H'), "HOME");
public static final Key END = new Control(EscCode.csi('F'), "END");
public static final Key INSERT = new Control(EscCode.csi('~', 2), "INSERT");
public static final Key DELETE = new Control(EscCode.csi('~', 3), "DELETE");
public static final Key PAGE_UP = new Control(EscCode.csi('~', 5), "PAGE UP");
public static final Key PAGE_DOWN = new Control(EscCode.csi('~', 6), "PAGE DOWN");
public static final Key F1 = new Control(EscCode.esc("OP"), "F1");
public static final Key F2 = new Control(EscCode.esc("OQ"), "F2");
public static final Key F3 = new Control(EscCode.esc("OR"), "F3");
public static final Key F4 = new Control(EscCode.esc("OS"), "F4");
public static final Key F5 = new Control(EscCode.csi('~', 15), "F5");
public static final Key F6 = new Control(EscCode.csi('~', 17), "F6");
public static final Key F7 = new Control(EscCode.csi('~', 18), "F7");
public static final Key F8 = new Control(EscCode.csi('~', 19), "F8");
public static final Key F9 = new Control(EscCode.csi('~', 20), "F9");
public static final Key F10 = new Control(EscCode.csi('~', 21), "F10");
public static final Key F11 = new Control(EscCode.csi('~', 23), "F11");
public static final Key F12 = new Control(EscCode.csi('~', 24), "F12");
public static final Key CTRL_UP = new Control(EscCode.csi('A', 1, 5), "CTRL & UP");
public static final Key CTRL_DOWN = new Control(EscCode.csi('B', 1, 5), "CTRL & DOWN");
public static final Key CTRL_RIGHT = new Control(EscCode.csi('C', 1, 5), "CTRL & RIGHT");
public static final Key CTRL_LEFT = new Control(EscCode.csi('D', 1, 5), "CTRL & LEFT");
public static final Key CTRL_HOME = new Control(EscCode.csi('H', 1, 5), "CTRL & HOME");
public static final Key CTRL_END = new Control(EscCode.csi('F', 1, 5), "CTRL & END");
public static final Key CTRL_INSERT = new Control(EscCode.csi('~', 2, 5), "CTRL & INSERT");
public static final Key CTRL_DELETE = new Control(EscCode.csi('~', 3, 5), "CTRL & DELETE");
public static final Key CTRL_PAGE_UP = new Control(EscCode.csi('~', 5, 5), "CTRL & PAGE UP");
public static final Key CTRL_PAGE_DOWN = new Control(EscCode.csi('~', 6, 5), "CTRL & PAGE DOWN");
public static final Key CTRL_F1 = new Control(EscCode.csi('P', 1, 5), "CTRL & F1");
public static final Key CTRL_F2 = new Control(EscCode.csi('Q', 1, 5), "CTRL & F2");
public static final Key CTRL_F3 = new Control(EscCode.csi('R', 1, 5), "CTRL & F3");
public static final Key CTRL_F4 = new Control(EscCode.csi('S', 1, 5), "CTRL & F4");
public static final Key CTRL_F5 = new Control(EscCode.csi('~', 15, 5), "CTRL & F5");
public static final Key CTRL_F6 = new Control(EscCode.csi('~', 17, 5), "CTRL & F6");
public static final Key CTRL_F7 = new Control(EscCode.csi('~', 18, 5), "CTRL & F7");
public static final Key CTRL_F8 = new Control(EscCode.csi('~', 19, 5), "CTRL & F8");
public static final Key CTRL_F9 = new Control(EscCode.csi('~', 20, 5), "CTRL & F9");
public static final Key CTRL_F10 = new Control(EscCode.csi('~', 21, 5), "CTRL & F10");
public static final Key CTRL_F11 = new Control(EscCode.csi('~', 23, 5), "CTRL & F11");
public static final Key CTRL_F12 = new Control(EscCode.csi('~', 24, 5), "CTRL & F12");
public static final Key ALT_UP = new Control(EscCode.csi('A', 1, 3), "ALT & UP");
public static final Key ALT_DOWN = new Control(EscCode.csi('B', 1, 3), "ALT & DOWN");
public static final Key ALT_RIGHT = new Control(EscCode.csi('C', 1, 3), "ALT & RIGHT");
public static final Key ALT_LEFT = new Control(EscCode.csi('D', 1, 3), "ALT & LEFT");
public static final Key ALT_HOME = new Control(EscCode.csi('H', 1, 3), "ALT & HOME");
public static final Key ALT_END = new Control(EscCode.csi('F', 1, 3), "ALT & END");
public static final Key ALT_INSERT = new Control(EscCode.csi('~', 2, 3), "ALT & INSERT");
public static final Key ALT_DELETE = new Control(EscCode.csi('~', 3, 3), "ALT & DELETE");
public static final Key ALT_PAGE_UP = new Control(EscCode.csi('~', 5, 3), "ALT & PAGE UP");
public static final Key ALT_PAGE_DOWN = new Control(EscCode.csi('~', 6, 3), "ALT & PAGE DOWN");
public static final Key ALT_F1 = new Control(EscCode.csi('P', 1, 3), "ALT & F1");
public static final Key ALT_F2 = new Control(EscCode.csi('Q', 1, 3), "ALT & F2");
public static final Key ALT_F3 = new Control(EscCode.csi('R', 1, 3), "ALT & F3");
public static final Key ALT_F4 = new Control(EscCode.csi('S', 1, 3), "ALT & F4");
public static final Key ALT_F5 = new Control(EscCode.csi('~', 15, 3), "ALT & F5");
public static final Key ALT_F6 = new Control(EscCode.csi('~', 17, 3), "ALT & F6");
public static final Key ALT_F7 = new Control(EscCode.csi('~', 18, 3), "ALT & F7");
public static final Key ALT_F8 = new Control(EscCode.csi('~', 19, 3), "ALT & F8");
public static final Key ALT_F9 = new Control(EscCode.csi('~', 20, 3), "ALT & F9");
public static final Key ALT_F10 = new Control(EscCode.csi('~', 21, 3), "ALT & F10");
public static final Key ALT_F11 = new Control(EscCode.csi('~', 23, 3), "ALT & F11");
public static final Key ALT_F12 = new Control(EscCode.csi('~', 24, 3), "ALT & F12");
public static final Key CTRL_ALT_UP = new Control(EscCode.csi('A', 1, 7), "CTRL & ALT & UP");
public static final Key CTRL_ALT_DOWN = new Control(EscCode.csi('B', 1, 7), "CTRL & ALT & DOWN");
public static final Key CTRL_ALT_RIGHT = new Control(EscCode.csi('C', 1, 7), "CTRL & ALT & RIGHT");
public static final Key CTRL_ALT_LEFT = new Control(EscCode.csi('D', 1, 7), "CTRL & ALT & LEFT");
public static final Key CTRL_ALT_HOME = new Control(EscCode.csi('H', 1, 7), "CTRL & ALT & HOME");
public static final Key CTRL_ALT_END = new Control(EscCode.csi('F', 1, 7), "CTRL & ALT & END");
public static final Key CTRL_ALT_INSERT = new Control(EscCode.csi('~', 2, 7), "CTRL & ALT & INSERT");
public static final Key CTRL_ALT_DELETE = new Control(EscCode.csi('~', 3, 7), "CTRL & ALT & DELETE");
public static final Key CTRL_ALT_PAGE_UP = new Control(EscCode.csi('~', 5, 7), "CTRL & ALT & PAGE UP");
public static final Key CTRL_ALT_PAGE_DOWN = new Control(EscCode.csi('~', 6, 7), "CTRL & ALT & PAGE DOWN");
public static final Key CTRL_ALT_F1 = new Control(EscCode.csi('P', 1, 7), "CTRL & ALT & F1");
public static final Key CTRL_ALT_F2 = new Control(EscCode.csi('Q', 1, 7), "CTRL & ALT & F2");
public static final Key CTRL_ALT_F3 = new Control(EscCode.csi('R', 1, 7), "CTRL & ALT & F3");
public static final Key CTRL_ALT_F4 = new Control(EscCode.csi('S', 1, 7), "CTRL & ALT & F4");
public static final Key CTRL_ALT_F5 = new Control(EscCode.csi('~', 15, 7), "CTRL & ALT & F5");
public static final Key CTRL_ALT_F6 = new Control(EscCode.csi('~', 17, 7), "CTRL & ALT & F6");
public static final Key CTRL_ALT_F7 = new Control(EscCode.csi('~', 18, 7), "CTRL & ALT & F7");
public static final Key CTRL_ALT_F8 = new Control(EscCode.csi('~', 19, 7), "CTRL & ALT & F8");
public static final Key CTRL_ALT_F9 = new Control(EscCode.csi('~', 20, 7), "CTRL & ALT & F9");
public static final Key CTRL_ALT_F10 = new Control(EscCode.csi('~', 21, 7), "CTRL & ALT & F10");
public static final Key CTRL_ALT_F11 = new Control(EscCode.csi('~', 23, 7), "CTRL & ALT & F11");
public static final Key CTRL_ALT_F12 = new Control(EscCode.csi('~', 24, 7), "CTRL & ALT & F12");
private static Key[] WELL_KNOWN = new Key[] {
UP, DOWN, RIGHT, LEFT,
HOME, END, INSERT, DELETE, PAGE_UP, PAGE_DOWN,
F1, F2, F3, F4,
F5, F6, F7, F8,
F9, F10, F11, F12,
CTRL_UP, CTRL_DOWN, CTRL_RIGHT, CTRL_LEFT,
CTRL_HOME, CTRL_END, CTRL_INSERT, CTRL_DELETE, CTRL_PAGE_UP, CTRL_PAGE_DOWN,
CTRL_F1, CTRL_F2, CTRL_F3, CTRL_F4,
CTRL_F5, CTRL_F6, CTRL_F7, CTRL_F8,
CTRL_F9, CTRL_F10, CTRL_F11, CTRL_F12,
ALT_UP, ALT_DOWN, ALT_RIGHT, ALT_LEFT,
ALT_HOME, ALT_END, ALT_INSERT, ALT_DELETE, ALT_PAGE_UP, ALT_PAGE_DOWN,
ALT_F1, ALT_F2, ALT_F3, ALT_F4,
ALT_F5, ALT_F6, ALT_F7, ALT_F8,
ALT_F9, ALT_F10, ALT_F11, ALT_F12,
CTRL_ALT_UP, CTRL_ALT_DOWN, CTRL_ALT_RIGHT, CTRL_ALT_LEFT,
CTRL_ALT_HOME, CTRL_ALT_END, CTRL_ALT_INSERT, CTRL_ALT_DELETE, CTRL_ALT_PAGE_UP, CTRL_ALT_PAGE_DOWN,
CTRL_ALT_F1, CTRL_ALT_F2, CTRL_ALT_F3, CTRL_ALT_F4,
CTRL_ALT_F5, CTRL_ALT_F6, CTRL_ALT_F7, CTRL_ALT_F8,
CTRL_ALT_F9, CTRL_ALT_F10, CTRL_ALT_F11, CTRL_ALT_F12
};
public abstract boolean isPrintable();
public abstract boolean isControl();
/**
* Either the printable character of the pressed key e.g. "a" or the name of the control key >UP<
*/
@Override
public String toString()
{
return "";
}
/**
* Either the printable character of the pressed key e.g. 'a'. '\033' ESCAPE for control keys
*/
public char toChar()
{
return ' ';
}
public static class Printable extends Key
{
private char ch;
public Printable(char ch)
{
this.ch = ch;
}
@Override
public boolean isPrintable()
{
return true;
}
@Override
public boolean isControl()
{
return false;
}
@Override
public String toString()
{
return ""+ch;
}
@Override
public char toChar()
{
return ch;
}
@Override
public boolean equals(Object other)
{
if (this == other)
{
return true;
}
if (other == null)
{
return false;
}
if (other.getClass() != Printable.class)
{
return false;
}
Printable printable = (Printable) other;
return printable.ch == ch;
}
@Override
public int hashCode()
{
return Character.hashCode(ch);
}
}
public static class Control extends Key
{
private EscCode escCode;
private String name;
private Control(EscCode escCode, String name)
{
this.escCode = escCode;
this.name = "<"+name+">";
}
private Control(EscCode escCode)
{
this(escCode, escCode.toString());
}
@Override
public boolean isPrintable()
{
return false;
}
@Override
public boolean isControl()
{
return true;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (obj.getClass() != Control.class)
{
return false;
}
Control other = (Control) obj;
return escCode.equals(other.escCode);
}
@Override
public int hashCode()
{
return escCode.hashCode();
}
@Override
public String toString()
{
return name;
}
@Override
public char toChar()
{
return EscCodeParser.ESCAPE;
}
public static Key forEscCode(EscCode escCode)
{
for (Key control : WELL_KNOWN)
{
if (((Control)control).escCode.equals(escCode))
{
return control;
}
}
return new Control(escCode);
}
}
}
| [
"[email protected]"
] | |
9b6c5fc5ff8d5043af4dd662660c840c664eeeb1 | cfaa4bac442f5036dca1981f74771b23c21eed72 | /src/com/swingsword/ssengine/game/games/rust/listeners/GunListener.java | 11d5ebad839428ea26c1c9ffcae1176be76510e5 | [] | no_license | CashVillan/SSEngine | cfa04b5a19052bea3ca5591648361afce3c7cec4 | 76867e0c57912b8623f2eebffc702ba2ccd34b32 | refs/heads/master | 2021-03-19T10:32:57.385226 | 2016-10-03T21:41:54 | 2016-10-03T21:41:54 | 69,909,441 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,631 | java | package com.swingsword.ssengine.game.games.rust.listeners;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.Main;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Result;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import com.swingsword.ssengine.MasterPlugin;
import com.swingsword.ssengine.game.games.rust.guns.Gun;
import com.swingsword.ssengine.game.games.rust.guns.GunData;
import com.swingsword.ssengine.game.games.rust.guns.Guns;
import com.swingsword.ssengine.game.games.rust.utils.ItemUtils;
public class GunListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) {
if (Gun.isGun(player.getItemInHand())) {
Gun gun = Gun.getGun(player.getItemInHand().getItemMeta().getDisplayName());
if (player != null && gun != null) {
gun.reload(player, gun);
}
}
} else if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (Gun.isGun(player.getItemInHand())) {
Gun gun = Gun.getGun(ChatColor.stripColor(player.getItemInHand().getItemMeta().getDisplayName()));
if (Gun.canShoot(player, gun)) {
gun.shoot(player, gun);
event.setCancelled(true);
event.setUseItemInHand(Result.DENY);
} else if (!GunData.reloading.containsKey(player) && !GunData.delay.containsKey(player)) {
player.playSound(player.getLocation(), Sound.UI_BUTTON_CLICK, 0.5F, 2);
gun.reload(player, gun);
}
}
}
}
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) {
Player player = event.getPlayer();
if(GunData.reloading.containsKey(player)) {
event.setCancelled(true);
}
}
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if(event.getWhoClicked() instanceof Player) {
Player player = (Player) event.getWhoClicked();
if(GunData.reloading.containsKey(player)) {
event.setCancelled(true);
}
}
}
@EventHandler
public void onProjectileHit(final ProjectileHitEvent event) {
if(GunData.bullets.containsKey(event.getEntity())) {
Bukkit.getScheduler().scheduleSyncDelayedTask(MasterPlugin.getMasterPlugin(), new Runnable() {
public void run() {
GunData.bullets.remove(event.getEntity());
GunData.bulletVel.remove(event.getEntity());
event.getEntity().remove();
}
}, 1L);
}
}
@EventHandler
public void onPlayerTeleport(final PlayerTeleportEvent event) {
if(event.getCause().equals(TeleportCause.ENDER_PEARL)) {
event.setCancelled(true);
}
}
@EventHandler
public void onInventoryClose(InventoryCloseEvent event) {
if(event.getPlayer() instanceof Player) {
Player player = (Player) event.getPlayer();
if(Guns.playerEquip.containsKey(player)) {
List<String> lore = ItemUtils.getLore(player.getItemInHand());
if(lore != null) {
if(!ItemUtils.loreContains(lore, "Attachments:")) {
lore.add("");
lore.add(ChatColor.GRAY + "Attachments:");
}
for(ItemStack all : Guns.playerEquip.get(player)) {
if(all != null && all.getItemMeta() != null && all.getItemMeta().getDisplayName() != null) {
if(all.getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.WHITE + "Silencer") && !ItemUtils.loreContains(lore, "Silencer")) {
lore.add(ChatColor.GRAY + "Silencer");
player.sendMessage(ChatColor.GREEN + "Equipped Silencer.");
} else if(all.getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.WHITE + "Flashlight Mod") && !ItemUtils.loreContains(lore, "Flashlight Mod")) {
lore.add(ChatColor.GRAY + "Flashlight Mod");
player.sendMessage(ChatColor.GREEN + "Equipped Flashlight Mod.");
} else if(all.getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.WHITE + "Holo Sight") && !ItemUtils.loreContains(lore, "Holo Sight")) {
lore.add(ChatColor.GRAY + "Holo Sight");
player.sendMessage(ChatColor.GREEN + "Equipped Holo Sight.");
} else {
player.getInventory().addItem(all);
}
}
}
ItemMeta meta = player.getItemInHand().getItemMeta();
meta.setLore(lore);
player.getItemInHand().setItemMeta(meta);
player.updateInventory();
}
Guns.playerEquip.remove(player);
}
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
if(player.getInventory().getHelmet() != null) {
if(player.getInventory().getHelmet().getType() == Material.PUMPKIN) {
if(GunData.playerHelmet.containsKey(player)) {
player.getInventory().setHelmet(GunData.playerHelmet.get(player));
GunData.playerHelmet.remove(player);
}
player.updateInventory();
}
}
}
}
| [
"[email protected]"
] | |
44b146b967d44312eef5072054e4aa05d5ff67c6 | 44493cbda76efc9ae7de7f2e6fc084a988cfbf2d | /java8_7/Test_04.java | c8f60e9897e9dda75648bb4292d480e78f4ebc5b | [] | no_license | ximuyou/javase | 06d9e74fac72a7838e1b5f10fa8159e930842290 | 50ea03e54a350ae4ddadb1c46a1bd570a58d6820 | refs/heads/master | 2020-03-25T10:42:30.623524 | 2018-08-07T03:29:36 | 2018-08-07T03:29:36 | 143,702,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 761 | java | package java8_7;
public class Test_04 {
public static void main(String[] args) {
int[]arr=new int[]{2,3,45,666,0};
turnnum(arr);
System.out.println(seach(arr,0)+1);
}
static int seach(int[]arr,int num){
int max=arr.length-1;
int min=0;
while(min<=max){
int mid=(max+min)/2;
if(arr[mid]>num){
max=mid-1;
}
else if(arr[mid]<num){
min=mid+1;
}
else if(arr[mid]==num)
return mid;
}
return -1;
}
static void turnnum(int[]arr){
for(int i=0;i<arr.length-1;i++){
for(int j=i+1;j>0;j--){
if(arr[j-1]>arr[j])
turn(arr,j-1,j);
else
break;
}
}
}
static void turn(int[]arr,int i,int j){
int num=arr[i];
arr[i]=arr[j];
arr[j]=num;
}
}
| [
"[email protected]"
] | |
46db5c3f4306e8f50475560cf6772f8267c8f0ea | 6635387159b685ab34f9c927b878734bd6040e7e | /src/org/apache/commons/codec/language/bm/Languages$SomeLanguages.java | 02e3bb78489f549ee1a2361df9da62ef3f94cfb3 | [] | no_license | RepoForks/com.snapchat.android | 987dd3d4a72c2f43bc52f5dea9d55bfb190966e2 | 6e28a32ad495cf14f87e512dd0be700f5186b4c6 | refs/heads/master | 2021-05-05T10:36:16.396377 | 2015-07-16T16:46:26 | 2015-07-16T16:46:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,710 | java | package org.apache.commons.codec.language.bm;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public final class Languages$SomeLanguages
extends Languages.LanguageSet
{
private final Set<String> languages;
private Languages$SomeLanguages(Set<String> paramSet)
{
languages = Collections.unmodifiableSet(paramSet);
}
public final boolean contains(String paramString)
{
return languages.contains(paramString);
}
public final String getAny()
{
return (String)languages.iterator().next();
}
public final Set<String> getLanguages()
{
return languages;
}
public final boolean isEmpty()
{
return languages.isEmpty();
}
public final boolean isSingleton()
{
return languages.size() == 1;
}
public final Languages.LanguageSet restrictTo(Languages.LanguageSet paramLanguageSet)
{
if (paramLanguageSet == Languages.NO_LANGUAGES) {
localObject = paramLanguageSet;
}
do
{
do
{
return (Languages.LanguageSet)localObject;
localObject = this;
} while (paramLanguageSet == Languages.ANY_LANGUAGE);
paramLanguageSet = (SomeLanguages)paramLanguageSet;
localObject = this;
} while (languages.containsAll(languages));
Object localObject = new HashSet(languages);
((Set)localObject).retainAll(languages);
return from((Set)localObject);
}
public final String toString()
{
return "Languages(" + languages.toString() + ")";
}
}
/* Location:
* Qualified Name: org.apache.commons.codec.language.bm.Languages.SomeLanguages
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
] | |
72027e4439b7665f727db3452b2657d09918ee19 | 5af9e86fae132a36c4c62dfecbbd368996c385b1 | /app/src/main/java/com/atheeshproperty/ddwed/NoteDAO.java | 68c88733884b9c23cd226af2e64697e43305247b | [] | no_license | AtheeshRathnaweera/An-Android-Project-by-using-Android-Room-View-Model-Live-Data-libraries | 47255b40e0abfa4c6bd36c872d8269d4960c9770 | 4c565840bfe75008bb7f2bfd9d8b368fde9522c5 | refs/heads/master | 2020-05-07T09:54:33.141069 | 2019-04-10T14:38:15 | 2019-04-10T14:38:15 | 180,396,619 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 961 | java | package com.atheeshproperty.ddwed;
import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;
import java.util.List;
@Dao
public interface NoteDAO {//This Dao is for "note" object
// This is an interface( Also can be an abstract class ).
// Because DAO(Data Access Object) only contains methods which doesnt have bodies
@Insert
void insert(Note note);
@Update
void update(Note note);
@Delete
void delete(Note note);
@Query("DELETE FROM note_table")//Delete all data of note_table. We use @Query to define a database operation by ourselves
void deleteAllNotes();
@Query("SELECT * FROM note_table ORDER BY priority DESC")
LiveData<List<Note>> getAllNotes();
}
| [
"[email protected]"
] | |
23835781fe01eb4bb26b15c7493cb0f2290e6b22 | a7067537133bbd788286b6b64fe0e29e07121e28 | /src/com/radiant/cisms/hdfs/seq/HInfoWritable.java | 06b36045f2c7fd693231ae66a1c09632a0ff25e2 | [] | no_license | thomachan/Hadoop | a9c0eedda65897813ede32d5e8dca2257959442b | 2ffc5504ad851d5644daccf1a1e7789d781afc7a | refs/heads/master | 2020-12-25T19:15:43.903298 | 2013-12-05T05:50:18 | 2013-12-05T05:50:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,839 | java | package com.radiant.cisms.hdfs.seq;
import java.io.ByteArrayInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableUtils;
public class HInfoWritable implements WritableComparable<HInfoWritable>,
Cloneable {
String oid;
long objId;
long time;
double value;
ByteBuffer buff;
private static final Log LOG = LogFactory.getLog(" org.apache.hadoop.io");
public HInfoWritable() {
buff = ByteBuffer.allocate(1024 * 64);
}
public HInfoWritable(String oid, long objId, long time, double value) {
this.oid = oid;
this.objId = objId;
this.time = time;
this.value = value;
}
public HInfoWritable(int defaultBufferSize) {
buff = ByteBuffer.allocate(defaultBufferSize);
}
@Override
public void write(DataOutput out) throws IOException {
WritableUtils.writeString(out, oid);
out.writeLong(objId);
out.writeLong(time);
out.writeDouble(value);
}
@Override
public void readFields(DataInput in) throws IOException {
oid = WritableUtils.readString(in);
objId = in.readLong();
time = in.readLong();
value = in.readDouble();
}
@Override
public int compareTo(HInfoWritable passwd) {
return CompareToBuilder.reflectionCompare(this, passwd);
}
public String getOid() {
return oid;
}
public void setOid(String oid) {
this.oid = oid;
}
public long getObjId() {
return objId;
}
public void setObjId(long objId) {
this.objId = objId;
}
public ByteBuffer getBuff() {
return buff;
}
public void setBuff(ByteBuffer buff) {
this.buff = buff;
}
public long getTime() {
return time;
}
public void setTime(long time) {
this.time = time;
}
public double getValue() {
return value;
}
public void setValue(double value) {
this.value = value;
}
public void put(byte buffer[], int startPosn, int appendLength){
System.out.println(new String(buffer));
buff.put(buffer, startPosn, appendLength);
}
public void read(int start,int end) throws IOException{
DataInputStream in = new DataInputStream(new ByteArrayInputStream(this.buff.array(),start,end));
readFields(in);
in.close();
}
public void read() throws IOException {
DataInputStream in = new DataInputStream(new ByteArrayInputStream(this.buff.array(),0,this.buff.position()));
readFields(in);
in.close();
}
@Override
public String toString() {
return objId+"_"+ oid +"_"+time;
}
public void clear() {
if(this.buff != null){
this.buff.clear();
}
}
/*public static void main(String []a){
ByteBuffer buff = null;
buff.put(new byte[]{},0,10);
}*/
} | [
"[email protected]"
] | |
f2cb4ef74dd0c4cf27615f6a8db1ea17606291eb | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-11/u-11-111/u-11-111-1112/u-11-111-1112-11113/u-11-111-1112-11113-f6324.java | db2288c76827016c833ec860672b39b526de6302 | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
8445059038043 | [
"[email protected]"
] | |
687a27e9ce70066dd09b527abd25e2207ab77402 | 38a38588bd7c90304c139eecee1a4e2dbdccb25a | /RouteServer/src/com/soon/core/db/pool/DbPoolMgr.java | 286fee807bb4fcc8438c259acf12d88befbcef09 | [] | no_license | dumbant/gameserver | 9c5322155961255e7474fa6d48f7334b78764fc9 | 1e681155883fd24b4ba7aec3ebe7f5f9cf69c80f | refs/heads/master | 2020-03-20T21:45:47.559372 | 2018-06-18T14:00:09 | 2018-06-18T14:00:09 | 137,758,981 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package com.soon.core.db.pool;
import com.soon.core.config.DbConfigInfo;
import com.soon.util.DESUtil;
public class DbPoolMgr {
public static IDBPool initPool(DbConfigInfo configInfo){
IDBPool pool = null;
try {
pool = new BoneCPDBPool(configInfo);
} catch (Exception e) {
e.printStackTrace();
}
return pool;
}
public static void main(String[] args) {
System.out.println(DESUtil.encrypt("root"));
System.out.println(DESUtil.encrypt("123456"));
}
}
| [
"[email protected]"
] | |
47b6481b8365d0ab3de04ed65c2c8868d855bb6e | 6f69ae89d559bd86643cf610e5540e787728581b | /PLP/src/view/pitagoras.java | 1ecb81efc8de534895f726c3ef032cc4e22c4f53 | [] | no_license | Amancio302/Resolucao-de-Equacoes | d4c8122df1f8bb7e2e9dfd4955f321b29369a91e | 9ee8a81046ea2e7ceaf77301236cdddb074ec0d0 | refs/heads/master | 2020-09-21T17:54:24.747088 | 2019-11-29T15:19:29 | 2019-11-29T15:19:29 | 224,873,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,693 | 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 view;
/**
*
* @author aluno
*/
public class pitagoras extends javax.swing.JFrame {
/**
* Creates new form pitagoras
*/
public pitagoras() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
exit1 = new javax.swing.JButton();
c = new javax.swing.JTextField();
a = new javax.swing.JTextField();
b = new javax.swing.JTextField();
send1 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
resposta = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel3.setText("c:");
jLabel4.setText("a:");
jLabel5.setText("b:");
exit1.setText("Sair");
exit1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exit1ActionPerformed(evt);
}
});
c.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cActionPerformed(evt);
}
});
c.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
cKeyReleased(evt);
}
});
a.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
aActionPerformed(evt);
}
});
a.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
aKeyReleased(evt);
}
});
b.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bActionPerformed(evt);
}
});
b.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
bKeyReleased(evt);
}
});
send1.setText("Enviar");
send1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
send1ActionPerformed(evt);
}
});
jLabel1.setText("Resposta:");
jLabel2.setFont(new java.awt.Font("Meiryo", 3, 18)); // NOI18N
jLabel2.setText("c = a²+b²");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(28, 28, 28)
.addComponent(send1))
.addGroup(layout.createSequentialGroup()
.addGap(137, 137, 137)
.addComponent(jLabel2)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(exit1)
.addGap(90, 90, 90))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel3))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(1, 1, 1)
.addComponent(a, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(c, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(1, 1, 1)
.addComponent(b, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(98, 98, 98))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(resposta, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(25, 25, 25)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel4)
.addGap(88, 88, 88))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(c, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(a, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(resposta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(b, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addGap(40, 40, 40)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(exit1)
.addComponent(send1))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void exit1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exit1ActionPerformed
this.dispose();
}//GEN-LAST:event_exit1ActionPerformed
private void cActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cActionPerformed
private void cKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_cKeyReleased
c.setText(c.getText().replaceAll("[^0-9 | ^.]" , "")); // TODO add your handling code here:
}//GEN-LAST:event_cKeyReleased
private void aActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_aActionPerformed
private void aKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_aKeyReleased
a.setText(a.getText().replaceAll("[^0-9 | ^.]" , "")); // TODO add your handling code here:
}//GEN-LAST:event_aKeyReleased
private void bActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bActionPerformed
b.setText(b.getText().replaceAll("[^0-9 | ^.]" , "")); // TODO add your handling code here:
}//GEN-LAST:event_bActionPerformed
private void bKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_bKeyReleased
b.setText(b.getText().replaceAll("[^0-9 | ^.]" , "")); // TODO add your handling code here:
}//GEN-LAST:event_bKeyReleased
private void send1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_send1ActionPerformed
if(c.getText().isEmpty()){
double _a , _b, res;
String result;
_a = Double.parseDouble(a.getText());
_b = Double.parseDouble(b.getText());
res = Math.sqrt(Math.pow(_a,2) + Math.pow(_b,2));
result = Double.toString(res);
resposta.setText(result);
}
if(a.getText().isEmpty()){
double _c , _b, res;
String result;
_c = Double.parseDouble(c.getText());
_b = Double.parseDouble(b.getText());
res = Math.sqrt(Math.pow(_c,2) - Math.pow(_b,2));
result = Double.toString(res);
resposta.setText(result);
}
if(b.getText().isEmpty()){
double _c , _a, res;
String result;
_c = Double.parseDouble(c.getText());
_a = Double.parseDouble(a.getText());
res = Math.sqrt(Math.pow(_c,2) - Math.pow(_a,2));
result = Double.toString(res);
resposta.setText(result);
}
}//GEN-LAST:event_send1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(pitagoras.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(pitagoras.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(pitagoras.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(pitagoras.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new pitagoras().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField a;
private javax.swing.JTextField b;
private javax.swing.JTextField c;
private javax.swing.JButton exit1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JTextField resposta;
private javax.swing.JButton send1;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
64756749d8e3ebd131531ce49a697f63699b0d79 | ab739b2979a97faf0b28edac7d2995fc86921f39 | /app/src/main/java/weka/classifiers/meta/Vote.java | 4bcab684ba38e3832ffc13dbbe194648fa78bd13 | [] | no_license | yishanhe/GlassGesture | 286f79822217a7f147b88ef27bb05db1db934b7e | 86e1b9718ab1fd61a4d43eb827059cc5879a21a0 | refs/heads/master | 2021-01-19T20:36:33.942863 | 2017-03-03T05:15:08 | 2017-03-03T05:15:08 | 83,759,471 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,253 | java | /*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Vote.java
* Copyright (C) 2000 University of Waikato
* Copyright (C) 2006 Roberto Perdisci
*
*/
package weka.classifiers.meta;
import weka.classifiers.RandomizableMultipleClassifiersCombiner;
import weka.core.Capabilities;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.Option;
import weka.core.RevisionUtils;
import weka.core.SelectedTag;
import weka.core.Tag;
import weka.core.TechnicalInformation;
import weka.core.TechnicalInformationHandler;
import weka.core.Utils;
import weka.core.Capabilities.Capability;
import weka.core.TechnicalInformation.Field;
import weka.core.TechnicalInformation.Type;
import java.util.Enumeration;
import java.util.Random;
import java.util.Vector;
/**
<!-- globalinfo-start -->
* Class for combining classifiers. Different combinations of probability estimates for classification are available.<br/>
* <br/>
* For more information see:<br/>
* <br/>
* Ludmila I. Kuncheva (2004). Combining Pattern Classifiers: Methods and Algorithms. John Wiley and Sons, Inc..<br/>
* <br/>
* J. Kittler, M. Hatef, Robert P.W. Duin, J. Matas (1998). On combining classifiers. IEEE Transactions on Pattern Analysis and Machine Intelligence. 20(3):226-239.
* <p/>
<!-- globalinfo-end -->
*
<!-- options-start -->
* Valid options are: <p/>
*
* <pre> -S <num>
* Random number seed.
* (default 1)</pre>
*
* <pre> -B <classifier specification>
* Full class name of classifier to include, followed
* by scheme options. May be specified multiple times.
* (default: "weka.classifiers.rules.ZeroR")</pre>
*
* <pre> -D
* If set, classifier is run in debug mode and
* may output additional info to the console</pre>
*
* <pre> -R <AVG|PROD|MAJ|MIN|MAX|MED>
* The combination rule to use
* (default: AVG)</pre>
*
<!-- options-end -->
*
<!-- technical-bibtex-start -->
* BibTeX:
* <pre>
* @book{Kuncheva2004,
* author = {Ludmila I. Kuncheva},
* publisher = {John Wiley and Sons, Inc.},
* title = {Combining Pattern Classifiers: Methods and Algorithms},
* year = {2004}
* }
*
* @article{Kittler1998,
* author = {J. Kittler and M. Hatef and Robert P.W. Duin and J. Matas},
* journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence},
* number = {3},
* pages = {226-239},
* title = {On combining classifiers},
* volume = {20},
* year = {1998}
* }
* </pre>
* <p/>
<!-- technical-bibtex-end -->
*
* @author Alexander K. Seewald ([email protected])
* @author Eibe Frank ([email protected])
* @author Roberto Perdisci ([email protected])
* @version $Revision: 5987 $
*/
public class Vote
extends RandomizableMultipleClassifiersCombiner
implements TechnicalInformationHandler {
/** for serialization */
static final long serialVersionUID = -637891196294399624L;
/** combination rule: Average of Probabilities */
public static final int AVERAGE_RULE = 1;
/** combination rule: Product of Probabilities (only nominal classes) */
public static final int PRODUCT_RULE = 2;
/** combination rule: Majority Voting (only nominal classes) */
public static final int MAJORITY_VOTING_RULE = 3;
/** combination rule: Minimum Probability */
public static final int MIN_RULE = 4;
/** combination rule: Maximum Probability */
public static final int MAX_RULE = 5;
/** combination rule: Median Probability (only numeric class) */
public static final int MEDIAN_RULE = 6;
/** combination rules */
public static final Tag[] TAGS_RULES = {
new Tag(AVERAGE_RULE, "AVG", "Average of Probabilities"),
new Tag(PRODUCT_RULE, "PROD", "Product of Probabilities"),
new Tag(MAJORITY_VOTING_RULE, "MAJ", "Majority Voting"),
new Tag(MIN_RULE, "MIN", "Minimum Probability"),
new Tag(MAX_RULE, "MAX", "Maximum Probability"),
new Tag(MEDIAN_RULE, "MED", "Median")
};
/** Combination Rule variable */
protected int m_CombinationRule = AVERAGE_RULE;
/** the random number generator used for breaking ties in majority voting
* @see #distributionForInstanceMajorityVoting(weka.core.Instance) */
protected Random m_Random;
/**
* Returns a string describing classifier
* @return a description suitable for
* displaying in the explorer/experimenter gui
*/
public String globalInfo() {
return
"Class for combining classifiers. Different combinations of "
+ "probability estimates for classification are available.\n\n"
+ "For more information see:\n\n"
+ getTechnicalInformation().toString();
}
/**
* Returns an enumeration describing the available options.
*
* @return an enumeration of all the available options.
*/
public Enumeration listOptions() {
Enumeration enm;
Vector result;
result = new Vector();
enm = super.listOptions();
while (enm.hasMoreElements())
result.addElement(enm.nextElement());
result.addElement(new Option(
"\tThe combination rule to use\n"
+ "\t(default: AVG)",
"R", 1, "-R " + Tag.toOptionList(TAGS_RULES)));
return result.elements();
}
/**
* Gets the current settings of Vote.
*
* @return an array of strings suitable for passing to setOptions()
*/
public String [] getOptions() {
int i;
Vector result;
String[] options;
result = new Vector();
options = super.getOptions();
for (i = 0; i < options.length; i++)
result.add(options[i]);
result.add("-R");
result.add("" + getCombinationRule());
return (String[]) result.toArray(new String[result.size()]);
}
/**
* Parses a given list of options. <p/>
*
<!-- options-start -->
* Valid options are: <p/>
*
* <pre> -S <num>
* Random number seed.
* (default 1)</pre>
*
* <pre> -B <classifier specification>
* Full class name of classifier to include, followed
* by scheme options. May be specified multiple times.
* (default: "weka.classifiers.rules.ZeroR")</pre>
*
* <pre> -D
* If set, classifier is run in debug mode and
* may output additional info to the console</pre>
*
* <pre> -R <AVG|PROD|MAJ|MIN|MAX|MED>
* The combination rule to use
* (default: AVG)</pre>
*
<!-- options-end -->
*
* @param options the list of options as an array of strings
* @throws Exception if an option is not supported
*/
public void setOptions(String[] options) throws Exception {
String tmpStr;
tmpStr = Utils.getOption('R', options);
if (tmpStr.length() != 0)
setCombinationRule(new SelectedTag(tmpStr, TAGS_RULES));
else
setCombinationRule(new SelectedTag(AVERAGE_RULE, TAGS_RULES));
super.setOptions(options);
}
/**
* Returns an instance of a TechnicalInformation object, containing
* detailed information about the technical background of this class,
* e.g., paper reference or book this class is based on.
*
* @return the technical information about this class
*/
public TechnicalInformation getTechnicalInformation() {
TechnicalInformation result;
TechnicalInformation additional;
result = new TechnicalInformation(Type.BOOK);
result.setValue(Field.AUTHOR, "Ludmila I. Kuncheva");
result.setValue(Field.TITLE, "Combining Pattern Classifiers: Methods and Algorithms");
result.setValue(Field.YEAR, "2004");
result.setValue(Field.PUBLISHER, "John Wiley and Sons, Inc.");
additional = result.add(Type.ARTICLE);
additional.setValue(Field.AUTHOR, "J. Kittler and M. Hatef and Robert P.W. Duin and J. Matas");
additional.setValue(Field.YEAR, "1998");
additional.setValue(Field.TITLE, "On combining classifiers");
additional.setValue(Field.JOURNAL, "IEEE Transactions on Pattern Analysis and Machine Intelligence");
additional.setValue(Field.VOLUME, "20");
additional.setValue(Field.NUMBER, "3");
additional.setValue(Field.PAGES, "226-239");
return result;
}
/**
* Returns default capabilities of the classifier.
*
* @return the capabilities of this classifier
*/
public Capabilities getCapabilities() {
Capabilities result = super.getCapabilities();
// class
if ( (m_CombinationRule == PRODUCT_RULE)
|| (m_CombinationRule == MAJORITY_VOTING_RULE) ) {
result.disableAllClasses();
result.disableAllClassDependencies();
result.enable(Capability.NOMINAL_CLASS);
result.enableDependency(Capability.NOMINAL_CLASS);
}
else if (m_CombinationRule == MEDIAN_RULE) {
result.disableAllClasses();
result.disableAllClassDependencies();
result.enable(Capability.NUMERIC_CLASS);
result.enableDependency(Capability.NUMERIC_CLASS);
}
return result;
}
/**
* Buildclassifier selects a classifier from the set of classifiers
* by minimising error on the training data.
*
* @param data the training data to be used for generating the
* boosted classifier.
* @throws Exception if the classifier could not be built successfully
*/
public void buildClassifier(Instances data) throws Exception {
// can classifier handle the data?
getCapabilities().testWithFail(data);
// remove instances with missing class
Instances newData = new Instances(data);
newData.deleteWithMissingClass();
m_Random = new Random(getSeed());
for (int i = 0; i < m_Classifiers.length; i++) {
getClassifier(i).buildClassifier(newData);
}
}
/**
* Classifies the given test instance.
*
* @param instance the instance to be classified
* @return the predicted most likely class for the instance or
* Utils.missingValue() if no prediction is made
* @throws Exception if an error occurred during the prediction
*/
public double classifyInstance(Instance instance) throws Exception {
double result;
double[] dist;
int index;
switch (m_CombinationRule) {
case AVERAGE_RULE:
case PRODUCT_RULE:
case MAJORITY_VOTING_RULE:
case MIN_RULE:
case MAX_RULE:
dist = distributionForInstance(instance);
if (instance.classAttribute().isNominal()) {
index = Utils.maxIndex(dist);
if (dist[index] == 0)
result = Utils.missingValue();
else
result = index;
}
else if (instance.classAttribute().isNumeric()){
result = dist[0];
}
else {
result = Utils.missingValue();
}
break;
case MEDIAN_RULE:
result = classifyInstanceMedian(instance);
break;
default:
throw new IllegalStateException("Unknown combination rule '" + m_CombinationRule + "'!");
}
return result;
}
/**
* Classifies the given test instance, returning the median from all
* classifiers.
*
* @param instance the instance to be classified
* @return the predicted most likely class for the instance or
* Utils.missingValue() if no prediction is made
* @throws Exception if an error occurred during the prediction
*/
protected double classifyInstanceMedian(Instance instance) throws Exception {
double[] results = new double[m_Classifiers.length];
double result;
for (int i = 0; i < results.length; i++)
results[i] = m_Classifiers[i].classifyInstance(instance);
if (results.length == 0)
result = 0;
else if (results.length == 1)
result = results[0];
else
result = Utils.kthSmallestValue(results, results.length / 2);
return result;
}
/**
* Classifies a given instance using the selected combination rule.
*
* @param instance the instance to be classified
* @return the distribution
* @throws Exception if instance could not be classified
* successfully
*/
public double[] distributionForInstance(Instance instance) throws Exception {
double[] result = new double[instance.numClasses()];
switch (m_CombinationRule) {
case AVERAGE_RULE:
result = distributionForInstanceAverage(instance);
break;
case PRODUCT_RULE:
result = distributionForInstanceProduct(instance);
break;
case MAJORITY_VOTING_RULE:
result = distributionForInstanceMajorityVoting(instance);
break;
case MIN_RULE:
result = distributionForInstanceMin(instance);
break;
case MAX_RULE:
result = distributionForInstanceMax(instance);
break;
case MEDIAN_RULE:
result[0] = classifyInstance(instance);
break;
default:
throw new IllegalStateException("Unknown combination rule '" + m_CombinationRule + "'!");
}
if (!instance.classAttribute().isNumeric() && (Utils.sum(result) > 0))
Utils.normalize(result);
return result;
}
/**
* Classifies a given instance using the Average of Probabilities
* combination rule.
*
* @param instance the instance to be classified
* @return the distribution
* @throws Exception if instance could not be classified
* successfully
*/
protected double[] distributionForInstanceAverage(Instance instance) throws Exception {
double[] probs = getClassifier(0).distributionForInstance(instance);
for (int i = 1; i < m_Classifiers.length; i++) {
double[] dist = getClassifier(i).distributionForInstance(instance);
for (int j = 0; j < dist.length; j++) {
probs[j] += dist[j];
}
}
for (int j = 0; j < probs.length; j++) {
probs[j] /= (double)m_Classifiers.length;
}
return probs;
}
/**
* Classifies a given instance using the Product of Probabilities
* combination rule.
*
* @param instance the instance to be classified
* @return the distribution
* @throws Exception if instance could not be classified
* successfully
*/
protected double[] distributionForInstanceProduct(Instance instance) throws Exception {
double[] probs = getClassifier(0).distributionForInstance(instance);
for (int i = 1; i < m_Classifiers.length; i++) {
double[] dist = getClassifier(i).distributionForInstance(instance);
for (int j = 0; j < dist.length; j++) {
probs[j] *= dist[j];
}
}
return probs;
}
/**
* Classifies a given instance using the Majority Voting combination rule.
*
* @param instance the instance to be classified
* @return the distribution
* @throws Exception if instance could not be classified
* successfully
*/
protected double[] distributionForInstanceMajorityVoting(Instance instance) throws Exception {
double[] probs = new double[instance.classAttribute().numValues()];
double[] votes = new double[probs.length];
for (int i = 0; i < m_Classifiers.length; i++) {
probs = getClassifier(i).distributionForInstance(instance);
int maxIndex = 0;
for(int j = 0; j<probs.length; j++) {
if(probs[j] > probs[maxIndex])
maxIndex = j;
}
// Consider the cases when multiple classes happen to have the same probability
for (int j=0; j<probs.length; j++) {
if (probs[j] == probs[maxIndex])
votes[j]++;
}
}
int tmpMajorityIndex = 0;
for (int k = 1; k < votes.length; k++) {
if (votes[k] > votes[tmpMajorityIndex])
tmpMajorityIndex = k;
}
// Consider the cases when multiple classes receive the same amount of votes
Vector<Integer> majorityIndexes = new Vector<Integer>();
for (int k = 0; k < votes.length; k++) {
if (votes[k] == votes[tmpMajorityIndex])
majorityIndexes.add(k);
}
// Resolve the ties according to a uniform random distribution
int majorityIndex = majorityIndexes.get(m_Random.nextInt(majorityIndexes.size()));
//set probs to 0
for (int k = 0; k<probs.length; k++)
probs[k] = 0;
probs[majorityIndex] = 1; //the class that have been voted the most receives 1
return probs;
}
/**
* Classifies a given instance using the Maximum Probability combination rule.
*
* @param instance the instance to be classified
* @return the distribution
* @throws Exception if instance could not be classified
* successfully
*/
protected double[] distributionForInstanceMax(Instance instance) throws Exception {
double[] max = getClassifier(0).distributionForInstance(instance);
for (int i = 1; i < m_Classifiers.length; i++) {
double[] dist = getClassifier(i).distributionForInstance(instance);
for (int j = 0; j < dist.length; j++) {
if(max[j]<dist[j])
max[j]=dist[j];
}
}
return max;
}
/**
* Classifies a given instance using the Minimum Probability combination rule.
*
* @param instance the instance to be classified
* @return the distribution
* @throws Exception if instance could not be classified
* successfully
*/
protected double[] distributionForInstanceMin(Instance instance) throws Exception {
double[] min = getClassifier(0).distributionForInstance(instance);
for (int i = 1; i < m_Classifiers.length; i++) {
double[] dist = getClassifier(i).distributionForInstance(instance);
for (int j = 0; j < dist.length; j++) {
if(dist[j]<min[j])
min[j]=dist[j];
}
}
return min;
}
/**
* Returns the tip text for this property
*
* @return tip text for this property suitable for
* displaying in the explorer/experimenter gui
*/
public String combinationRuleTipText() {
return "The combination rule used.";
}
/**
* Gets the combination rule used
*
* @return the combination rule used
*/
public SelectedTag getCombinationRule() {
return new SelectedTag(m_CombinationRule, TAGS_RULES);
}
/**
* Sets the combination rule to use. Values other than
*
* @param newRule the combination rule method to use
*/
public void setCombinationRule(SelectedTag newRule) {
if (newRule.getTags() == TAGS_RULES)
m_CombinationRule = newRule.getSelectedTag().getID();
}
/**
* Output a representation of this classifier
*
* @return a string representation of the classifier
*/
public String toString() {
if (m_Classifiers == null) {
return "Vote: No model built yet.";
}
String result = "Vote combines";
result += " the probability distributions of these base learners:\n";
for (int i = 0; i < m_Classifiers.length; i++) {
result += '\t' + getClassifierSpec(i) + '\n';
}
result += "using the '";
switch (m_CombinationRule) {
case AVERAGE_RULE:
result += "Average of Probabilities";
break;
case PRODUCT_RULE:
result += "Product of Probabilities";
break;
case MAJORITY_VOTING_RULE:
result += "Majority Voting";
break;
case MIN_RULE:
result += "Minimum Probability";
break;
case MAX_RULE:
result += "Maximum Probability";
break;
case MEDIAN_RULE:
result += "Median Probability";
break;
default:
throw new IllegalStateException("Unknown combination rule '" + m_CombinationRule + "'!");
}
result += "' combination rule \n";
return result;
}
/**
* Returns the revision string.
*
* @return the revision
*/
public String getRevision() {
return RevisionUtils.extract("$Revision: 5987 $");
}
/**
* Main method for testing this class.
*
* @param argv should contain the following arguments:
* -t training file [-T test file] [-c class index]
*/
public static void main(String [] argv) {
runClassifier(new Vote(), argv);
}
}
| [
"[email protected]"
] | |
fd6ddf06df660335ed02b186f7ae399f66eefc4d | 4d7a45066c85c2f1288ad2d7e41cb5cef9aa6c85 | /src/main/java/com/example/demo/config/SecurityConfig.java | 988e07d578e950987793fa307bb96435a6087ccb | [] | no_license | MinhHoangCao/SpringGoogle | 7417e6c0dcb8ccf28ef09f688cffb5f0fa5ff5b2 | e3c8d1dcd57838d2eb954b75f5e0b33b91700d96 | refs/heads/master | 2020-05-29T22:31:05.956130 | 2019-06-06T12:24:19 | 2019-06-06T12:24:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,378 | java | package com.example.demo.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Bean
public BCryptPasswordEncoder passwordEncoder() {
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
return bCryptPasswordEncoder;
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().passwordEncoder(passwordEncoder()).
withUser("hoang").password("$2a$04$Q2Cq0k57zf2Vs/n3JXwzmerql9RzElr.J7aQd3/Sq0fw/BdDFPAj.").roles("ADMIN");
auth.inMemoryAuthentication().passwordEncoder(passwordEncoder()).
withUser("cao").password("$2a$04$Q2Cq0k57zf2Vs/n3JXwzmerql9RzElr.J7aQd3/Sq0fw/BdDFPAj.").roles("USER");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().anyRequest().permitAll();
// http.authorizeRequests().antMatchers("/admin/**").access("hasRole('ROLE_ADMIN')");
// http.authorizeRequests().antMatchers("/user/**").access("hasRole('ROLE_ADMIN') or hasRole('ROLE_USER')");
// http.authorizeRequests().and().exceptionHandling().accessDeniedPage("/403");
http.authorizeRequests().and().formLogin()
.loginProcessingUrl("/j_spring_security_login")
.loginPage("/login")
.defaultSuccessUrl("/user")
.failureUrl("/login?message=error")
.usernameParameter("username")
.passwordParameter("password")
.and().logout().logoutUrl("/j_spring_security_logout").logoutSuccessUrl("/login?message=logout");
}
}
| [
"[email protected]"
] | |
a611c534d76bc8b9aedc0c194972bff2cdfe2b05 | c9aaada8bcef5ed77aea0357b6560ef145e4296d | /tictactoe/src/engine/Board.java | 406e1d77aa9f3ca5060ee4742b2c651c527bbf84 | [] | no_license | STFinancial/operation-cyclone | 799d57158413af1eabf3c39d96c23216775e0d6d | e442b753f05c1e7c2cb110af93d2ab68b4446577 | refs/heads/master | 2023-01-24T02:11:26.672113 | 2020-11-26T06:37:52 | 2020-11-26T06:37:52 | 316,098,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,141 | java | package engine;
class Board {
private MarkType[][] board;
Board() {
board = new MarkType[3][3];
clearBoard();
}
/** Resets engine.Board state, should be called before a new game */
void clearBoard() {
for (int row = 0; row < 3; ++row) {
for (int column = 0; column < 3; ++column) {
board[row][column] = MarkType.EMPTY;
}
}
}
/** Marks the position for the Player, returns true if the position was previously empty, false if not */
boolean markPosition(int row, int column, Player player) {
if (board[row][column] != MarkType.EMPTY) {
return false;
}
if (player == Player.X) {
board[row][column] = MarkType.X;
} else if (player == Player.O){
board[row][column] = MarkType.O;
} else {
throw new IllegalStateException("Invalid engine.Player type attempting to mark position.");
}
return true;
}
/** Returns the Player at the given position, null if it has not been marked */
Player get(int row, int column) {
if (board[row][column] == MarkType.X) {
return Player.X;
} else if (board[row][column] == MarkType.O) {
return Player.O;
} else {
return null;
}
}
@Override
public String toString() {
String output = "-------------\n";
for (int row = 0; row < 3; ++row) {
output += "|";
for (int column = 0; column < 3; ++column) {
output += " ";
output += board[row][column].toString();
output += " |";
}
output += "\n";
output += "-------------\n";
}
return output;
}
private static enum MarkType {
X("X"),
O("O"),
EMPTY(" ");
private final String markString;
private MarkType(String markString) {
this.markString = markString;
}
@Override
public String toString() {
return markString;
}
}
}
| [
"[email protected]"
] | |
ce58dc1c8181afd7de6b165b3f82dbeeac0f51fd | fc112cf66bbd9b791bae936b8a6e1f75d0dc2d41 | /src/observer/Buffer.java | 754c4aa3a3b7ed9f1cf487095c7e585137783159 | [] | no_license | Mojib501/Observer | 190ccf1f8b851276f25b20dfe2effc92b6885a86 | f8bfd8b8e10a353360e20cdf8b092df137b7f3f6 | refs/heads/master | 2021-01-11T23:52:36.465401 | 2017-01-11T13:19:15 | 2017-01-11T13:19:15 | 78,639,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 957 | 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 observer;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author masi
* diese klasse ist der Subject in der Observer Konstelation
*/
public class Buffer {
private int state;
private List<Observer> observerList= new ArrayList<Observer>();
public void attach(Observer observer){
observerList.add(observer);
}
public int getState(){
return state;
}
public void printObserverName(){
notifyAllObservers();
}
public void notifyAllObservers(){
for(Observer observer : observerList){
//jeden observer mit Messadten füttern
//es muss berücksichtigt werden dass nur gesedet wird wenn
//Nachfrage besteht
observer.update();
}
}
}
| [
"[email protected]"
] | |
aabb0c1b7af3430218a86ade4151f8b8d8329fe8 | 073d18ec802fc11be9e979b944faba8ec58dce84 | /src/utils/LinkedListOrderedList.java | 593f78ccc0b7ce8c3355fca01e80867735d5e823 | [] | no_license | putinrock1/Assignment1 | dd4940f59294dd73ed94dd4ae7849d665e10ccb0 | f27588e0ecbda0bd6d1fb8499aeb683862d99647 | refs/heads/master | 2021-01-20T20:15:05.347797 | 2016-08-01T16:51:12 | 2016-08-01T16:51:12 | 64,667,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,640 | java | package utils;
import Exceptions.ElementAlreadyExistsException;
import Exceptions.EmptyListException;
import utils.Interfaces.IOrderedList;
/**
* @param <T>
*/
public class LinkedListOrderedList<T extends Comparable<T>> implements IOrderedList<T> {
private LinkedListNode<T> first = null;
private int length = 0;
private int index = 0;
/**
* adds element in alpha-numeric order
*
* @param t T
* @throws Exception
*/
@Override
public void add(T t) throws Exception {
if (this.contains(t)) {
throw new ElementAlreadyExistsException("Element already exists in the list");
}
LinkedListNode<T> newNode = new LinkedListNode<T>(t, null);
if (this.first == null) {
first = newNode;
} else {
if (this.first.getElement().compareTo(t) < 0) {
LinkedListNode<T> node = this.first;
boolean complete = false;
do {
if (node.getElement().compareTo(t) < 0) {
if (node.getPointer() == null) {
node.setPointer(newNode);
complete = true;
} else if (node.getPointer().getElement().compareTo(t) > 0) {
LinkedListNode<T> afterNode = node.getPointer();
node.setPointer(newNode);
newNode.setPointer(afterNode);
complete = true;
}
}
node = node.getPointer();
} while (!complete);
} else {
newNode.setPointer(this.first);
this.first = newNode;
}
}
this.length++;
this.index = length;
}
/**
* removes element at index
*
* @param i T
* @throws Exception
*/
@Override
public void remove(int i) throws Exception {
if (this.isEmpty()) {
throw new EmptyListException("Cannot remove from an empty list.");
}
if (i > this.length - 1) {
throw new IndexOutOfBoundsException();
}
LinkedListNode<T> removedNode = this.getNthNode(i);
this.getNthNode(i - 1).setPointer(removedNode.getPointer());
this.length--;
}
/**
* returns the index of an element
*
* @param t T
* @return int
*/
public int indexOf(T t) {
if (this.size() == 0) return -1;
int count = 0;
LinkedListNode<T> node = this.first;
//for each node
while (node != null) {
if (node.getElement().equals(t)) {
return count;
} else {
count++;
node = node.getPointer();
}
}
count = -1;
this.index = count;
return count;
}
/**
* returns true if list contains an element
*
* @param t T
* @return boolean
*/
@Override
public boolean contains(T t) {
return this.indexOf(t) >= 0;
}
/**
* returns true if list is empty
*
* @return boolean
*/
@Override
public boolean isEmpty() {
return this.first == null;
}
/**
* returns size
*
* @return int
*/
@Override
public int size() {
return this.length;
}
/**
* returns element at index
*
* @param i int
* @return T
*/
@Override
public T get(int i) {
return this.getNthNode(i).getElement();
}
/**
* resets list
*/
@Override
public void reset() {
this.first = null;
this.length = 0;
}
/**
* gets next element
*
* @return T
*/
@Override
public T getNext() {
this.index++;
return this.get(this.index + 1);
}
/**
* returns element at index i
*
* @param i int
* @return T
*/
private LinkedListNode<T> getNthNode(int i) {
if (i > this.length - 1) {
throw new IndexOutOfBoundsException();
}
int count = 0;
LinkedListNode<T> node = this.first;
while (count < i) {
node = node.getPointer();
count++;
}
this.index = i;
return node;
}
/**
* @return String
*/
@Override
public String toString() {
return "LinkedListIndexedList{" +
"list={" + first + "}" +
", length=" + length +
'}';
}
}
| [
"[email protected]"
] | |
c3c9ae6ea36c9d8b727c364510a99eeec3f8bdc1 | bfab0434c481ce035f1c8da1b16a9fd35a031b31 | /src/main/java/fi/seco/saha3/model/IRepository.java | 723afe7bf5ddba9f28bdf1823f2566ef80e432f5 | [] | no_license | swwasp/saha | edfaeb21de68408fec679ee6fc108fe7c12a75f6 | 171b68da954548c684a41fdb55e8737b17ef8276 | refs/heads/master | 2020-05-18T09:16:08.769824 | 2013-05-17T10:00:18 | 2013-05-17T10:00:18 | 39,357,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 368 | java | package fi.seco.saha3.model;
import java.util.Collection;
import java.util.Locale;
/**
* Common interface for local searches (to the SAHA project model) and
* ONKI searches.
*
*/
public interface IRepository {
public IResults search(String query, Collection<String> parentRestrictions, Collection<String> typeRestrictions, Locale locale, int maxResults);
}
| [
"hhamalai@43518cfe-5713-1dcd-c615-06b53fc7efa9"
] | hhamalai@43518cfe-5713-1dcd-c615-06b53fc7efa9 |
6c1b7f5f83a5572e5b4f87c4a78c5cb90946718d | 976c792afad6f74cffac57ec5e5b58358d8b6cf6 | /server/site-server/src/main/java/com/opencloud/site/service/impl/UserDetailsServiceImpl.java | 40c67bf1ae4d619bdcb98d1945168d55cbaf155a | [
"MIT"
] | permissive | andymiaomiao/openCloud | 3097abef10c2debf72d8c2d412bd8acf0d3d07b6 | 88cc7583415cda69e7a8fbed5afc37081fb8e122 | refs/heads/master | 2022-03-27T04:37:42.321962 | 2020-01-20T04:15:26 | 2020-01-20T04:15:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,357 | java | package com.opencloud.site.service.impl;
import com.opencloud.common.model.ResultBody;
import com.opencloud.common.security.BaseUserDetails;
import com.opencloud.common.security.oauth2.SocialProperties;
import com.opencloud.common.utils.WebUtil;
import com.opencloud.site.service.feign.SystemDeveloperServiceClient;
import com.opencloud.system.client.constants.SystemConstants;
import com.opencloud.system.client.model.UserInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* Security用户信息获取实现类
*
* @author liuyadu
*/
@Slf4j
@Service("userDetailService")
public class UserDetailsServiceImpl implements UserDetailsService {
@Autowired
private SystemDeveloperServiceClient systemDeveloperServiceClient;
@Autowired
private SocialProperties clientProperties;
@Override
public UserDetails loadUserByUsername(String username)
throws UsernameNotFoundException {
HttpServletRequest request = WebUtil.getHttpServletRequest();;
Map<String, String> parameterMap = WebUtil.getParamMap(request);
// 第三方登录标识
String thirdParty = parameterMap.get("thirdParty");
ResultBody<UserInfo> resp = systemDeveloperServiceClient.login(username,thirdParty);
UserInfo account = resp.getData();
if (account == null || account.getAccountId()==null) {
throw new UsernameNotFoundException("系统用户 " + username + " 不存在!");
}
String domain = account.getDomain();
Long accountId = account.getAccountId();
Long userId = account.getUserId();
String password = account.getPassword();
String nickName = account.getNickName();
String avatar = account.getAvatar();
String accountType = account.getAccountType();
boolean accountNonLocked = account.getStatus().intValue() != SystemConstants.ACCOUNT_STATUS_LOCKED;
boolean credentialsNonExpired = true;
boolean enabled = account.getStatus().intValue() == SystemConstants.ACCOUNT_STATUS_NORMAL ? true : false;
boolean accountNonExpired = true;
BaseUserDetails userDetails = new BaseUserDetails();
userDetails.setDomain(domain);
userDetails.setAccountId(accountId);
userDetails.setUserId(userId);
userDetails.setUsername(username);
userDetails.setPassword(password);
userDetails.setNickName(nickName);
userDetails.setAuthorities(account.getAuthorities());
userDetails.setAvatar(avatar);
userDetails.setAccountId(accountId);
userDetails.setAccountNonLocked(accountNonLocked);
userDetails.setAccountNonExpired(accountNonExpired);
userDetails.setAccountType(accountType);
userDetails.setCredentialsNonExpired(credentialsNonExpired);
userDetails.setEnabled(enabled);
userDetails.setClientId(clientProperties.getClient().get("portal").getClientId());
return userDetails;
}
}
| [
"[email protected]"
] | |
bbc89f4f4ad008fb2e8e72c9c53e64bd6b879da7 | 3c6864459c06b5281a249e649dee0be918113953 | /src/main/java/com/adityathebe/bitcoin/wallet/Wallet.java | b2f952d7442e030d34df5d2cb6741bda5b832a36 | [] | no_license | adityathebe/bitcoin-java | c8afd6c38202903196a83bae38d1b3b959ec0091 | 680d7da30ea65f16b708d774f42719d69fe9a51f | refs/heads/master | 2021-05-23T01:04:40.882834 | 2020-04-11T07:33:57 | 2020-04-11T07:33:57 | 253,165,519 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,852 | java | package com.adityathebe.bitcoin.wallet;
import com.adityathebe.bitcoin.core.Address;
import com.adityathebe.bitcoin.core.ECPrivateKey;
import com.adityathebe.bitcoin.core.ECPublicKey;
import com.adityathebe.bitcoin.crypto.ECDSA;
import com.adityathebe.bitcoin.crypto.ECDSASignature;
import com.adityathebe.bitcoin.utils.Base58;
import static com.adityathebe.bitcoin.crypto.Crypto.hash256;
import static com.adityathebe.bitcoin.script.ScriptOpCodes.*;
import static com.adityathebe.bitcoin.utils.Utils.*;
public class Wallet {
private ECPrivateKey privateKey;
private ECPublicKey publicKey;
private Address address;
public Wallet() {
init();
}
public Wallet(String privateKeyHex) {
privateKey = new ECPrivateKey(privateKeyHex);
init();
}
private void init() {
if (this.privateKey == null) {
this.privateKey = new ECPrivateKey();
}
this.publicKey = new ECPublicKey(this.privateKey);
this.address = new Address(this.publicKey);
}
public ECPrivateKey getPrivateKey() {
return privateKey;
}
public Address getAddress() {
return address;
}
public ECPublicKey getPublicKey() {
return publicKey;
}
public static String getHashFromAddress(String address) throws Exception {
String dec = bytesToHex(Base58.decodeChecked(address));
return dec.substring(2);
}
/**
* @param address P2PKH Legacy address
* @param satoshi Amount in Satoshi
* @return The hex encoded transaction
*/
public String createTransaction(String address, int satoshi, String parentTxHash, String inputIdx, String prevScriptPubKey) throws Exception {
String nVersion = "01000000";
String inCount = "01";
// Input
String prevOutHash = bytesToHex(changeEndian(hexToBytes(parentTxHash)));
String prevOutN = inputIdx;
String prevScriptPubKeyLength = Integer.toHexString(prevScriptPubKey.length() / 2);
String sequence = "ffffffff";
// Output
String outCount = "01";
String amount = Integer.toHexString(satoshi);
while (amount.length() < 16) {
amount = "0" + amount;
}
amount = bytesToHex(changeEndian(hexToBytes(amount)));
// Finalize the output
String hashFromAddress = getHashFromAddress(address);
String hashLength = Integer.toHexString((hashFromAddress.length() / 2));
String scriptPubKey = Integer.toHexString(OP_DUP) + Integer.toHexString(OP_HASH160) + hashLength + hashFromAddress + Integer.toHexString(OP_EQUALVERIFY) + Integer.toHexString(OP_CHECKSIG);
String scriptPubKeyLength = Integer.toHexString(scriptPubKey.length() / 2);
String lockField = "00000000";
String hashCodeType = "01000000";
// Craft temp tx data
String preTxData = nVersion + inCount + prevOutHash + prevOutN + prevScriptPubKeyLength + prevScriptPubKey + sequence + outCount + amount + scriptPubKeyLength + scriptPubKey + lockField + hashCodeType;
System.out.println("\nPreTxData: " + preTxData);
byte[] doubleHash = hash256(preTxData);
ECDSASignature signature = ECDSA.sign(privateKey, doubleHash);
String finalSignature = signature.getDerEncoded() + "01";
System.out.println("Sig verified: " + ECDSA.verify(signature, getPublicKey(), doubleHash));
// Create actual scriptSig
String sigLength = Integer.toHexString(finalSignature.length() / 2);
String pubKeyLength = Integer.toHexString((publicKey.getCompressed().length() / 2));
String scriptSig = sigLength + finalSignature + pubKeyLength + publicKey.getCompressed();
String scriptSigLength = Integer.toHexString(scriptSig.length() / 2);
return nVersion + inCount + prevOutHash + prevOutN + scriptSigLength + scriptSig + sequence + outCount + amount + scriptPubKeyLength + scriptPubKey + lockField;
}
public static void main(String[] args) throws Exception {
System.out.println("Wallet");
Wallet w = new Wallet("3E402774803FCBCA1CA7CC841E55A659182CCE5FF3A249275DA7EDC32FDF8BB2");
System.out.println("Private Key (Hex): " + w.getPrivateKey().getHex());
System.out.println("Public Key (Hex): " + w.getPublicKey().getCompressed());
System.out.println("Address: " + w.getAddress().getTestNetAddressHex());
String tx = w.createTransaction(
"2NGZrVvZG92qGYqzTLjCAewvPZ7JE8S8VxE",
9900,
"7e5c93f34b09877abea9b2f1793469e54d196aae8f7a434351bfd3ca4c428410",
"00000000",
"76a914745e794502c6307f10e71c66e066c8d7f714066688ac");
System.out.println("Tx (Raw):" + tx);
System.out.println("Tx Hash: " + bytesToHex(changeEndian(hash256(tx))));
}
} | [
"[email protected]"
] | |
c4d2110e0112b881337b3f938bf4c5c33483631f | a976af8054c09aa3ec573bac156980ad851a0ab7 | /crmchat/vendor/alipaysdk/easysdk/java/src/main/java/com/alipay/easysdk/marketing/openlife/models/AlipayOpenPublicLifeMsgRecallResponse.java | 7e6692d489b088183dc8810b15cb80a7cb1b2feb | [
"MIT"
] | permissive | yabaoer/CRMchat | 1277df300298ea8bf688cb08f75d0de9c2ce4df0 | 5aec898bcbc3b8d94db50ebc8a8be4ecd36b263a | refs/heads/main | 2023-08-28T07:08:09.126019 | 2021-11-09T03:14:06 | 2021-11-09T03:14:06 | 461,561,412 | 1 | 0 | MIT | 2022-02-20T17:24:12 | 2022-02-20T17:24:11 | null | UTF-8 | Java | false | false | 890 | java | // This file is auto-generated, don't edit it. Thanks.
package com.alipay.easysdk.marketing.openlife.models;
import com.aliyun.tea.*;
public class AlipayOpenPublicLifeMsgRecallResponse extends TeaModel {
@NameInMap("http_body")
@Validation(required = true)
public String httpBody;
@NameInMap("code")
@Validation(required = true)
public String code;
@NameInMap("msg")
@Validation(required = true)
public String msg;
@NameInMap("sub_code")
@Validation(required = true)
public String subCode;
@NameInMap("sub_msg")
@Validation(required = true)
public String subMsg;
public static AlipayOpenPublicLifeMsgRecallResponse build(java.util.Map<String, ?> map) throws Exception {
AlipayOpenPublicLifeMsgRecallResponse self = new AlipayOpenPublicLifeMsgRecallResponse();
return TeaModel.build(map, self);
}
}
| [
"[email protected]"
] | |
dd5829d4eca2766c9beafb23d51d912424fee539 | 39af93bb1493c15a20745075ad14d4ee6b3deea6 | /src/main/java/entity/MstKota.java | e9ab3894bade0146bcfb4f8c4a26875126841841 | [] | no_license | ikraam21/ZKProject | 711f7bbff1f1e3354aa0252cc91c34113af62988 | 9b1d06624f43560db9c8ed6a21a1e0e34c7ba871 | refs/heads/master | 2021-05-07T06:22:46.005992 | 2017-11-23T01:31:09 | 2017-11-23T01:31:09 | 111,749,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package entity;
public class MstKota {
private String kodeKota;
private String namaKota;
private MstProvinsi mstProvinsi;
public String getKodeKota() {
return kodeKota;
}
public void setKodeKota(String kodeKota) {
this.kodeKota = kodeKota;
}
public String getNamaKota() {
return namaKota;
}
public void setNamaKota(String namaKota) {
this.namaKota = namaKota;
}
public MstProvinsi getMstProvinsi() {
return mstProvinsi;
}
public void setMstProvinsi(MstProvinsi mstProvinsi) {
this.mstProvinsi = mstProvinsi;
}
}
| [
"[email protected]"
] | |
84cb53efb229979ebf3322d87548f83c8e2514a7 | 95cbc094b2a5ed9c124aa41d1a21dd0cd62029dc | /src/main/java/com/google/identitytoolkit/GitkitClient.java | df527961800c55374a357c9d35332f5625724b22 | [] | no_license | AIMMOTH/gitapp | 95b35edd5baf9221ee47333ca1bfb0d10a93c66a | 2d26f3f453011400912a0766208cbf2ee836867d | refs/heads/master | 2020-12-24T13:35:59.757111 | 2015-02-05T14:26:34 | 2015-02-05T14:26:34 | 30,232,797 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 19,523 | java | /*
* Copyright 2014 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.identitytoolkit;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.gson.JsonObject;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.SignatureException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Logger;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
/**
* Google Identity Toolkit client library. This class is the only interface that third party
* developers needs to know to integrate Gitkit with their backend server. Main features are
* Gitkit token verification and Gitkit remote API wrapper.
*/
public class GitkitClient {
@VisibleForTesting
static final String GITKIT_API_BASE =
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/";
private static final Logger logger = Logger.getLogger(GitkitClient.class.getName());
private final JsonTokenHelper tokenHelper;
private final RpcHelper rpcHelper;
private final String widgetUrl;
private final String cookieName;
/**
* Constructs a Gitkit client.
*
* @param clientId Google oauth2 web application client id. Audience in Gitkit token must match
* this client id.
* @param serviceAccountEmail Google service account email.
* @param keyStream Google service account private p12 key stream.
* @param widgetUrl Url of the Gitkit widget, must starting with /.
* @param cookieName Gitkit cookie name. Used to extract Gitkit token from incoming http request.
* @param httpSender Concrete http sender when Gitkit client needs to call Gitkit remote API.
* @param serverApiKey Server side API key in Google Developer Console.
*/
public GitkitClient(
String clientId,
String serviceAccountEmail,
InputStream keyStream,
String widgetUrl,
String cookieName,
HttpSender httpSender,
String serverApiKey) {
rpcHelper = new RpcHelper(httpSender, GITKIT_API_BASE, serviceAccountEmail, keyStream);
tokenHelper = new JsonTokenHelper(clientId, rpcHelper, serverApiKey);
this.widgetUrl = widgetUrl;
this.cookieName = cookieName;
}
/**
* Constructs a Gitkit client from a JSON config file
*
* @param configPath Path to JSON configuration file
* @return Gitkit client
*/
// public static GitkitClient createFromJson(String configPath) throws JSONException, IOException {
// JSONObject configData =
// new JSONObject(
// StandardCharsets.UTF_8.decode(
// ByteBuffer.wrap(Files.readAllBytes(Paths.get(configPath))))
// .toString());
//
// return new GitkitClient.Builder()
// .setGoogleClientId(configData.getString("clientId"))
// .setServiceAccountEmail(configData.getString("serviceAccountEmail"))
// .setKeyStream(new FileInputStream(configData.getString("serviceAccountPrivateKeyFile")))
// .setWidgetUrl(configData.getString("widgetUrl"))
// .setCookieName(configData.getString("cookieName"))
// .setServerApiKey(configData.optString("serverApiKey", null))
// .build();
// }
/**
* Verifies a Gitkit token.
*
* @param token token string to be verified.
* @return Gitkit user if token is valid.
* @throws GitkitClientException if token has invalid signature
*/
public GitkitUser validateToken(String token) throws GitkitClientException {
if (token == null) {
return null;
}
try {
JsonObject jsonToken = tokenHelper.verifyAndDeserialize(token).getPayloadAsJsonObject();
return new GitkitUser()
.setLocalId(jsonToken.get(JsonTokenHelper.ID_TOKEN_USER_ID).getAsString())
.setEmail(jsonToken.get(JsonTokenHelper.ID_TOKEN_EMAIL).getAsString())
.setCurrentProvider(jsonToken.has(JsonTokenHelper.ID_TOKEN_PROVIDER)
? jsonToken.get(JsonTokenHelper.ID_TOKEN_PROVIDER).getAsString()
: null);
} catch (SignatureException e) {
throw new GitkitClientException(e);
}
}
/**
* Verifies Gitkit token in http request.
*
* @param request http request
* @return Gitkit user if valid token is found in the request.
* @throws GitkitClientException if there is token but signature is invalid
*/
public GitkitUser validateTokenInRequest(HttpServletRequest request)
throws GitkitClientException {
Cookie[] cookies = request.getCookies();
if (cookieName == null || cookies == null) {
return null;
}
for (Cookie cookie : cookies) {
if (cookieName.equals(cookie.getName())) {
return validateToken(cookie.getValue());
}
}
return null;
}
/**
* Gets user info from GITkit service using Gitkit token. Can be used to verify a Gitkit token
* remotely.
*
* @param token the gitkit token.
* @return Gitkit user info if token is valid.
* @throws GitkitClientException if request is invalid
* @throws GitkitServerException for Gitkit server error
*/
public GitkitUser getUserByToken(String token)
throws GitkitClientException, GitkitServerException {
GitkitUser gitkitUser = validateToken(token);
if (gitkitUser == null) {
throw new GitkitClientException("invalid gitkit token");
}
try {
JSONObject result = rpcHelper.getAccountInfo(token);
JSONObject jsonUser = result.getJSONArray("users").getJSONObject(0);
return jsonToUser(jsonUser)
// gitkit server does not return current provider
.setCurrentProvider(gitkitUser.getCurrentProvider());
} catch (JSONException e) {
throw new GitkitServerException(e);
}
}
/**
* Gets user info given an email.
*
* @param email user email.
* @return Gitkit user info.
* @throws GitkitClientException if request is invalid
* @throws GitkitServerException for Gitkit server error
*/
public GitkitUser getUserByEmail(String email)
throws GitkitClientException, GitkitServerException {
Preconditions.checkNotNull(email);
try {
JSONObject result = rpcHelper.getAccountInfoByEmail(email);
return jsonToUser(result.getJSONArray("users").getJSONObject(0));
} catch (JSONException e) {
throw new GitkitServerException(e);
}
}
/**
* Gets user info given a user id.
*
* @param localId user identifier at Gitkit.
* @return Gitkit user info.
* @throws GitkitClientException if request is invalid
* @throws GitkitServerException for Gitkit server error
*/
public GitkitUser getUserByLocalId(String localId)
throws GitkitClientException, GitkitServerException {
Preconditions.checkNotNull(localId);
try {
JSONObject result = rpcHelper.getAccountInfoById(localId);
return jsonToUser(result.getJSONArray("users").getJSONObject(0));
} catch (JSONException e) {
throw new GitkitServerException(e);
}
}
/**
* Gets all user info of this web site. Underlying requests are send with default pagination size.
*
* @return lazy iterator over all user accounts.
*/
public Iterator<GitkitUser> getAllUsers() {
return getAllUsers(null);
}
/**
* Gets all user info of this web site. Underlying requests are paginated and send on demand with
* given size.
*
* @param resultsPerRequest pagination size
* @return lazy iterator over all user accounts.
*/
public Iterator<GitkitUser> getAllUsers(final Integer resultsPerRequest) {
return new DownloadIterator<GitkitUser>() {
private String nextPageToken = null;
@Override
protected Iterator<GitkitUser> getNextResults() {
try {
JSONObject response = rpcHelper.downloadAccount(nextPageToken, resultsPerRequest);
nextPageToken = response.has("nextPageToken")
? response.getString("nextPageToken")
: null;
if (response.has("users")) {
return jsonToList(response.getJSONArray("users")).iterator();
}
} catch (JSONException e) {
logger.warning(e.getMessage());
} catch (GitkitServerException e) {
logger.warning(e.getMessage());
} catch (GitkitClientException e) {
logger.warning(e.getMessage());
}
return ImmutableSet.<GitkitUser>of().iterator();
}
};
}
/**
* Updates a user info at Gitkit server.
*
* @param user user info to be updated.
* @return the updated user info
* @throws GitkitClientException for invalid request
* @throws GitkitServerException for server error
*/
public GitkitUser updateUser(GitkitUser user)
throws GitkitClientException, GitkitServerException {
try {
return jsonToUser(rpcHelper.updateAccount(user));
} catch (JSONException e) {
throw new GitkitServerException(e);
}
}
/**
* Uploads multiple user accounts to Gitkit server.
*
* @param hashAlgorithm hash algorithm. Supported values are HMAC_SHA256, HMAC_SHA1, HMAC_MD5,
* PBKDF_SHA1, MD5 and SCRYPT.
* @param hashKey key of hash algorithm
* @param users list of user accounts to be uploaded
* @throws GitkitClientException for invalid request
* @throws GitkitServerException for server error
*/
public void uploadUsers(String hashAlgorithm, byte[] hashKey, List<GitkitUser> users)
throws GitkitServerException, GitkitClientException {
rpcHelper.uploadAccount(hashAlgorithm, hashKey, users);
}
/**
* Deletes a user account at Gitkit server.
*
* @param user user to be deleted.
* @throws GitkitClientException for invalid request
* @throws GitkitServerException for server error
*/
public void deleteUser(GitkitUser user) throws GitkitServerException, GitkitClientException {
deleteUser(user.getLocalId());
}
/**
* Deletes a user account at Gitkit server.
*
* @param localId user id to be deleted.
* @throws GitkitClientException for invalid request
* @throws GitkitServerException for server error
*/
public void deleteUser(String localId) throws GitkitServerException, GitkitClientException {
rpcHelper.deleteAccount(localId);
}
/**
* Gets out-of-band response. Used by oob endpoint for ResetPassword and ChangeEmail operation.
* The web site needs to send user an email containing the oobUrl in the response. The user needs
* to click the oobUrl to finish the operation.
*
* @param req http request for the oob endpoint
* @return the oob response.
* @throws GitkitServerException
*/
public OobResponse getOobResponse(HttpServletRequest req)
throws GitkitServerException {
String gitkitToken = lookupCookie(req, cookieName);
return getOobResponse(req, gitkitToken);
}
/**
* Gets out-of-band response. Used by oob endpoint for ResetPassword and ChangeEmail operation.
* The web site needs to send user an email containing the oobUrl in the response. The user needs
* to click the oobUrl to finish the operation.
*
* @param req http request for the oob endpoint
* @param gitkitToken Gitkit token of authenticated user, required for ChangeEmail operation
* @return the oob response.
* @throws GitkitServerException
*/
public OobResponse getOobResponse(HttpServletRequest req, String gitkitToken)
throws GitkitServerException {
try {
String action = req.getParameter("action");
if ("resetPassword".equals(action)) {
String oobLink = buildOobLink(req, buildPasswordResetRequest(req), action);
return new OobResponse(
req.getParameter("email"),
null,
oobLink,
OobAction.RESET_PASSWORD);
} else if ("changeEmail".equals(action)) {
if (gitkitToken == null) {
return new OobResponse("login is required");
} else {
String oobLink = buildOobLink(req, buildChangeEmailRequest(req, gitkitToken), action);
return new OobResponse(
req.getParameter("oldEmail"),
req.getParameter("newEmail"),
oobLink,
OobAction.CHANGE_EMAIL);
}
} else {
return new OobResponse("unknown request");
}
} catch (JSONException e) {
throw new GitkitServerException(e);
} catch (GitkitClientException e) {
return new OobResponse(e.getMessage());
}
}
public static Builder newBuilder() {
return new Builder();
}
private String lookupCookie(HttpServletRequest request, String cookieName) {
Cookie[] cookies = request.getCookies();
if (cookies == null) {
return null;
}
for (Cookie cookie : cookies) {
if (cookieName.equals(cookie.getName())) {
return cookie.getValue();
}
}
return null;
}
private String buildOobLink(HttpServletRequest req, JSONObject resetReq, String modeParam)
throws GitkitClientException, GitkitServerException, JSONException {
try {
JSONObject result = rpcHelper.getOobCode(resetReq);
String code = result.getString("oobCode");
return widgetUrl + "?mode=" + modeParam + "&oobCode="
+ URLEncoder.encode(code, "UTF-8");
} catch (UnsupportedEncodingException e) {
// should never happen
throw new GitkitServerException(e);
}
}
private JSONObject buildPasswordResetRequest(HttpServletRequest req) throws JSONException {
return new JSONObject()
.put("email", req.getParameter("email"))
.put("userIp", req.getRemoteAddr())
.put("challenge", req.getParameter("challenge"))
.put("captchaResp", req.getParameter("response"))
.put("requestType", "PASSWORD_RESET");
}
private JSONObject buildChangeEmailRequest(HttpServletRequest req, String gitkitToken)
throws JSONException {
return new JSONObject()
.put("email", req.getParameter("oldEmail"))
.put("userIp", req.getRemoteAddr())
.put("newEmail", req.getParameter("newEmail"))
.put("idToken", gitkitToken)
.put("requestType", "NEW_EMAIL_ACCEPT");
}
/**
* Gitkit out-of-band actions.
*/
public enum OobAction {
RESET_PASSWORD,
CHANGE_EMAIL
}
/**
* Wrapper class containing the out-of-band responses.
*/
public class OobResponse {
private static final String SUCCESS_RESPONSE = "{\"success\": true}";
private static final String ERROR_PREFIX = "{\"error\": ";
private final String email;
private final String newEmail;
private final Optional<String> oobUrl;
private final OobAction oobAction;
private final String responseBody;
private final String recipient;
public OobResponse(String responseBody) {
this(null, null, Optional.<String>absent(), null, ERROR_PREFIX + responseBody + " }");
}
public OobResponse(String email, String newEmail, String oobUrl, OobAction oobAction)
{
this(email, newEmail, Optional.of(oobUrl), oobAction, SUCCESS_RESPONSE);
}
public OobResponse(String email, String newEmail, Optional<String> oobUrl, OobAction oobAction,
String responseBody) {
this.email = email;
this.newEmail = newEmail;
this.oobUrl = oobUrl;
this.oobAction = oobAction;
this.responseBody = responseBody;
this.recipient = newEmail == null ? email : newEmail;
}
public Optional<String> getOobUrl() {
return oobUrl;
}
public OobAction getOobAction() {
return oobAction;
}
public String getResponseBody() {
return responseBody;
}
public String getEmail() {
return email;
}
public String getNewEmail() {
return newEmail;
}
public String getRecipient() {
return recipient;
}
}
/**
* Builder class to construct Gitkit client instance.
*/
public static class Builder {
private String clientId;
private HttpSender httpSender = new HttpSender();
private String widgetUrl;
private String serviceAccountEmail;
private InputStream keyStream;
private String serverApiKey;
private String cookieName = "gtoken";
public Builder setGoogleClientId(String clientId) {
this.clientId = clientId;
return this;
}
public Builder setWidgetUrl(String url) {
this.widgetUrl = url;
return this;
}
public Builder setKeyStream(InputStream keyStream) {
this.keyStream = keyStream;
return this;
}
public Builder setServiceAccountEmail(String serviceAccountEmail) {
this.serviceAccountEmail = serviceAccountEmail;
return this;
}
public Builder setCookieName(String cookieName) {
this.cookieName = cookieName;
return this;
}
public Builder setHttpSender(HttpSender httpSender) {
this.httpSender = httpSender;
return this;
}
public Builder setServerApiKey(String serverApiKey) {
this.serverApiKey = serverApiKey;
return this;
}
public GitkitClient build() {
return new GitkitClient(clientId, serviceAccountEmail, keyStream, widgetUrl, cookieName,
httpSender, serverApiKey);
}
}
private List<GitkitUser> jsonToList(JSONArray accounts) throws JSONException {
List<GitkitUser> list = Lists.newLinkedList();
for (int i = 0; i < accounts.length(); i++) {
list.add(jsonToUser(accounts.getJSONObject(i)));
}
return list;
}
private GitkitUser jsonToUser(JSONObject jsonUser) throws JSONException {
GitkitUser user = new GitkitUser()
.setLocalId(jsonUser.getString("localId"))
.setEmail(jsonUser.getString("email"))
.setName(jsonUser.optString("displayName"))
.setPhotoUrl(jsonUser.optString("photoUrl"))
.setProviders(jsonUser.optJSONArray("providerUserInfo"));
if (jsonUser.has("providerUserInfo")) {
JSONArray fedInfo = jsonUser.getJSONArray("providerUserInfo");
List<GitkitUser.ProviderInfo> providerInfo = new ArrayList<GitkitUser.ProviderInfo>();
for (int idp = 0; idp < fedInfo.length(); idp++) {
JSONObject provider = fedInfo.getJSONObject(idp);
providerInfo.add(new GitkitUser.ProviderInfo(
provider.getString("providerId"),
provider.getString("federatedId"),
provider.optString("displayName"),
provider.optString("photoUrl")));
}
user.setProviders(providerInfo);
}
return user;
}
}
| [
"Carl@Carl-Dator"
] | Carl@Carl-Dator |
1ac31b43a6e71e1bcfe5e8f7b4ac5d682c6afc6e | 36431ebe6909d24719ba55cdbc0c3c000af076d4 | /OneToOneBidirect/src/test/java/com/example/OneToOneBidirectApplicationTests.java | 1930334c40bf8203cf3446b3777fcf7f5a405b1f | [] | no_license | amitqy/SpringDataJpa | a61d6e1b9686571eabf8132988443214834d1c45 | c4c8563bbd70f5502dc66c2de17e13d07bd6648c | refs/heads/main | 2023-03-20T22:48:36.737482 | 2021-03-17T09:59:21 | 2021-03-17T09:59:21 | 348,264,881 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 213 | java | package com.example;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class OneToOneBidirectApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
f475a667ea149fc6e848f663747124bbc9f85fd2 | 967d736eae4c5791ed9c7da80f570cc8efae88c2 | /core/src/main/java/ru/mipt/engocab/data/json/custom/DictionarySerializer.java | 050df6e3dcf9d6fd46ed2df9d879cfbb12ee4b78 | [
"Apache-2.0"
] | permissive | ushakov-av/engocab | b619a0a5293fcff93eabaac70b523bdfd6176de4 | cd011047680cce3d6d4ee3ac1d2950ac6fede987 | refs/heads/master | 2021-01-22T05:51:03.854324 | 2015-02-08T21:13:42 | 2015-02-08T21:13:42 | 27,241,997 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,378 | java | package ru.mipt.engocab.data.json.custom;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import ru.mipt.engocab.core.model.*;
import static ru.mipt.engocab.data.json.custom.Fields.*;
import java.io.IOException;
import java.util.List;
/**
* @author Alexander Ushakov
*/
public class DictionarySerializer extends JsonSerializer<Dictionary> {
@Override
public void serialize(Dictionary dictionary, JsonGenerator jgen, SerializerProvider provider) throws IOException {
jgen.writeStartObject();
jgen.writeFieldName(DICTIONARY);
jgen.writeStartObject();
{
for (WordContainer container : dictionary.getContainers()) {
WordKey wordKey = container.getWordKey();
String key = wordKey.getWord() + "|" + PartOfSpeech.value(wordKey.getPartOfSpeech()) + "|" + wordKey.getNumber();
jgen.writeFieldName(key);
jgen.writeStartObject();
{
serializeWord(wordKey, jgen);
List<WordRecord> records = container.getRecords();
records.sort((WordRecord r1, WordRecord r2) -> Integer.compare(r1.getIndex(), r2.getIndex()));
jgen.writeFieldName(RECORDS);
jgen.writeStartArray();
{
for (WordRecord record : records) {
jgen.writeStartObject();
{
jgen.writeStringField(ID, record.getId());
jgen.writeNumberField(INDEX, record.getIndex());
jgen.writeStringField(TRANSLATION, record.getTranslation());
jgen.writeStringField(TIP, record.getTip());
jgen.writeStringField(DESCRIPTION, record.getDescription());
// Examples
jgen.writeFieldName(EXAMPLES);
jgen.writeStartArray();
{
for (Example example : record.getExamples()) {
serializeExample(example, jgen);
}
}
jgen.writeEndArray();
// Synonyms
jgen.writeFieldName(SYNONYMS);
jgen.writeStartArray();
{
for (Synonym synonym : record.getSynonyms()) {
}
}
jgen.writeEndArray();
// Tags
jgen.writeFieldName(TAGS);
jgen.writeStartArray();
{
for (String tag : record.getTags()) {
jgen.writeString(tag);
}
}
jgen.writeEndArray();
}
jgen.writeEndObject();
}
}
jgen.writeEndArray();
}
jgen.writeEndObject();
}
}
jgen.writeEndObject();
jgen.writeEndObject();
}
private void serializeWord(WordKey wordKey, JsonGenerator jgen) throws IOException {
jgen.writeStringField(WORD, wordKey.getWord());
jgen.writeStringField(POS, wordKey.getPartOfSpeech().toString());
jgen.writeNumberField(NUMBER, wordKey.getNumber());
jgen.writeStringField(TRANSCRIPTION, wordKey.getTranscription());
}
private void serializeExample(Example example, JsonGenerator jgen) throws IOException {
jgen.writeStartObject();
jgen.writeStringField(EX_WORD, example.getWordExample());
jgen.writeStringField(EX_TRANS, example.getTranslationExample());
jgen.writeStringField(EX_PHRASE, example.getPhrase());
jgen.writeEndObject();
}
}
| [
"[email protected]"
] | |
1f6b71d269699fcb1c82e286077c4ce97144f1ad | 818ad79c64329ca6df89d4f8520c7b5a976ce9b3 | /system_admin/src/main/java/com/system/dao/IBaseDao.java | 545e048f9d4ba468549d02152f334d1888740181 | [] | no_license | huangchunjian123/leyou | 531aa1f06be370f6990bb3c79c07ca8558b047a3 | f57b85536ef1919bae8f84001a511a4653284938 | refs/heads/master | 2020-04-08T11:26:41.324387 | 2019-01-30T08:29:50 | 2019-01-30T08:29:50 | 159,306,185 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 805 | java | package com.system.dao;
import com.system.common.util.Page;
import java.io.Serializable;
/**
* @author zzy
*/
public interface IBaseDao<T>{
/**
* 保存
* @param t
* @return
*/
boolean save(T t);
/**
* 删除
* @param t
* @return
*/
boolean delete(T t);
/**
* 根据id批量删除
* @param ids
* @return
*/
boolean delById(Serializable... ids);
/**
* 更新
* @param t
* @return
*/
boolean update(T t);
/**
* 根据id查询
* @param id
* @return
*/
T findById(Serializable id);
/**
* 获取分页
* @param page
* @param pageSize
* @param args
* @return
*/
Page<T> findPage(int page, int pageSize, Object... args);
}
| [
"[email protected]"
] | |
48e3e80d9590a31eb0e76d50af8d9d34a01b07ec | 3f89e736cb6c2f3318c378936ee150479a527ffd | /Game of Thrones/src/Allegiance.java | 650563859b209d2baf0e4f6c52f7a7f1108c7db4 | [] | no_license | zapouria/AspectJ_SOEN6441 | 526b69a346a73f32613e32a4ebcf2d66b7a5e8e8 | 297975cffcf593b9feba016265115fae84726bc4 | refs/heads/master | 2022-04-24T17:17:46.311015 | 2020-04-27T16:25:35 | 2020-04-27T16:25:35 | 259,386,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 66 | java |
public interface Allegiance {
public void declare();
}
| [
"[email protected]"
] | |
9107b6bebe259440391c5d9c303327679b742123 | abcf66282aabf4136196cfc8a595a44b3521cda9 | /java/ORION 11J/Workin3/workin-core/src/main/java/org/workin/utils/reflection/ReflectionUtils.java | f5daaa53ef0023a29497637d31c1bdde370fc942 | [] | no_license | leopallas/vieo | bce613c3f2212191116160e23473a3d89a4df03e | 1bc2944989b82b10d94fda4d7857c5261fbe3175 | refs/heads/master | 2016-09-06T00:43:13.509248 | 2013-11-07T02:04:22 | 2013-11-07T02:04:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,763 | java | /**
* Copyright (c) 2005-2010 springside.org.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
*
* $Id: ReflectionUtils.java 1303 2010-11-19 17:04:05Z calvinxiu $
*/
package org.workin.utils.reflection;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;
/**
*
* @author <a href="mailto:[email protected]">Angellin Yao</a>
*
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public class ReflectionUtils {
public static final String CGLIB_CLASS_SEPARATOR = "$$";
private static Logger logger = LoggerFactory.getLogger(ReflectionUtils.class);
/**
* Invoke getter method from object
*
* @param obj
* @param propertyName
* @return
*/
public static Object invokeGetterMethod(Object obj, String propertyName) {
String getterMethodName = "get" + StringUtils.capitalize(propertyName);
return invokeMethod(obj, getterMethodName, new Class[] {}, new Object[] {});
}
/**
* Invoke setter method. It will find the setter method by class type for value
*
* @param obj
* @param propertyName
* @param value
*/
public static void invokeSetterMethod(Object obj, String propertyName, Object value) {
invokeSetterMethod(obj, propertyName, value, null);
}
/**
* Invoke setter method.
*
* @param obj
* @param propertyName
* @param value
* @param propertyType
* Used for finding the setter method, and it will be replace with class type of the value if value is null.
*/
public static void invokeSetterMethod(Object obj, String propertyName, Object value, Class<?> propertyType) {
Class<?> type = propertyType != null ? propertyType : value.getClass();
String setterMethodName = "set" + StringUtils.capitalize(propertyName);
invokeMethod(obj, setterMethodName, new Class[] { type }, new Object[] { value });
}
/**
* Read the property value of the object without using getter method, no matter the method is private or protected.
*
* @param obj
* @param fieldName
* @return
*/
public static Object getFieldValue(final Object obj, final String fieldName) {
Field field = getAccessibleField(obj, fieldName);
if (field == null) {
throw new IllegalArgumentException("Could not find field [" + fieldName + "] on target [" + obj + "]");
}
Object result = null;
try {
result = field.get(obj);
} catch (IllegalAccessException e) {
logger.error("Impossibly throw errors: {}", e.getMessage());
}
return result;
}
/**
* Set the property value of the object without using getter method, no matter the method is private or protected.
*
* @param obj
* @param fieldName
* @param value
*/
public static void setFieldValue(final Object obj, final String fieldName, final Object value) {
Field field = getAccessibleField(obj, fieldName);
if (field == null) {
throw new IllegalArgumentException("Could not find field [" + fieldName + "] on target [" + obj + "]");
}
try {
field.set(obj, value);
} catch (IllegalAccessException e) {
logger.error("Impossibly throw errors: {}", e.getMessage());
}
}
/**
* Iterator the super class for object, and retrieve the DeclareField, then this method will be forced set to available.
* If DeclareFileld not find when super class is Object.class, then return null.
* This method is used for situation of one time invoking.
* @param obj
* @param fieldName
* @return
*/
public static Field getAccessibleField(final Object obj, final String fieldName) {
Assert.notNull(obj, "object could not be null.");
Assert.hasText(fieldName, "fieldName");
for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) {
try {
Field field = superClass.getDeclaredField(fieldName);
field.setAccessible(true);
return field;
} catch (NoSuchFieldException e) {//NOSONAR
// Field is not defined in this class, continue.
}
}
return null;
}
/**
* Get actual class type for the object AOPed by CGLIB.
*
* @param clazz
* @return
*/
public static Class<?> getUserClass(Class<?> clazz) {
if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) {
Class<?> superClass = clazz.getSuperclass();
if (superClass != null && !Object.class.equals(superClass)) {
return superClass;
}
}
return clazz;
}
/**
* Directly invoke the specific method, no matter the method is private or protected.
*
* @param obj
* @param methodName
* @param parameterTypes
* @param args
* @return
*/
public static Object invokeMethod(final Object obj, final String methodName, final Class<?>[] parameterTypes,
final Object[] args) {
Method method = getAccessibleMethod(obj, methodName, parameterTypes);
if (method == null) {
throw new IllegalArgumentException("Could not find method [" + methodName + "] on target [" + obj + "]");
}
try {
return method.invoke(obj, args);
} catch (Exception e) {
throw convertReflectionExceptionToUnchecked(e);
}
}
/**
* Iterator the super class for object, and retrieve the DeclareField, then this method will be forced set to available.
* If DeclareFileld not find when super class is Object.class, then return null.
* This method is used for situation of multiple invoking. 1) Use this method to get Method; 2) Invoke Method.invoke(Object obj, Object... args)
*
* @param obj
* @param methodName
* @param parameterTypes
* @return
*/
public static Method getAccessibleMethod(final Object obj, final String methodName,
final Class<?>... parameterTypes) {
Assert.notNull(obj, "object could not be null.");
for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) {
try {
Method method = superClass.getDeclaredMethod(methodName, parameterTypes);
method.setAccessible(true);
return method;
} catch (NoSuchMethodException e) {//NOSONAR
// Field is not defined in this class, continue.
}
}
return null;
}
/**
* Get super generic type defined in class. If not found, then return Object.class
* eg.
* public UserDao extends HibernateDao<User>
* @param clazz The class to introspect
* @return the first generic declaration, or Object.class if cannot be determined
*/
public static <T> Class<T> getSuperClassGenericType(final Class clazz) {
return getSuperClassGenericType(clazz, 0);
}
/**
* Get super generic type defined in class. If not found, then return Object.class
* eg.
* public UserDao extends HibernateDao<User,Long>
*
* @param clazz The class to introspect
* @param index the Index of the generic declaration,start from 0.
* @return the index generic declaration, or Object.class if cannot be determined
*/
public static Class getSuperClassGenericType(final Class clazz, final int index) {
Type genType = clazz.getGenericSuperclass();
if (!(genType instanceof ParameterizedType)) {
logger.warn(clazz.getSimpleName() + "'s superclass not ParameterizedType");
return Object.class;
}
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
if (index >= params.length || index < 0) {
logger.warn("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: "
+ params.length);
return Object.class;
}
if (!(params[index] instanceof Class)) {
logger.warn(clazz.getSimpleName() + " not set the actual class on superclass generic parameter");
return Object.class;
}
return (Class) params[index];
}
/**
* Translate checked exception occurred when reflect to unchecked exception.
* @param e
* @return
*/
public static RuntimeException convertReflectionExceptionToUnchecked(Exception e) {
if (e instanceof IllegalAccessException || e instanceof IllegalArgumentException
|| e instanceof NoSuchMethodException) {
return new IllegalArgumentException("Reflection Exception.", e);
} else if (e instanceof InvocationTargetException) {
return new RuntimeException("Reflection Exception.", ((InvocationTargetException) e).getTargetException());
} else if (e instanceof RuntimeException) {
return (RuntimeException) e;
}
return new RuntimeException("Unexpected Checked Exception.", e);
}
}
| [
"[email protected]"
] | |
00ac077f7409925e9974d29b9c0f8197e53f4076 | 23d73792759d0a56ae19609ec08ec6ca354ec81d | /src/main/java/page_202/designpatterns/isp/drone004/DriveControllerManager.java | 6560d7d4310361d9ac2752547952f8beaa946757 | [] | no_license | sout1217/spring_basic | 244b91b71fa0f2b8ac75b35686053dc49f67142a | bccb5dc71a1e78336d6319671c54845820c08d74 | refs/heads/master | 2023-03-26T09:01:09.592309 | 2021-03-25T13:32:17 | 2021-03-25T13:32:17 | 345,038,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 163 | java | package page_202.designpatterns.isp.drone004;
public class DriveControllerManager implements DriveController {
@Override
public void drive() {
}
}
| [
"[email protected]"
] | |
d32d9d16740748887a3341f8ef5365d3989a151d | aa7f74b59db0604a8bdc64ea4a5031f0bc31fd54 | /src/com/suminghui/bycar/util/StringUtil.java | e3fc1693170b65ff0fe9ce19092acdaf0f745908 | [] | no_license | tianxiao-zp/buycar | 53f4f145a6cbd893a521ed2f9d8e10ea695e15dd | 9b5fcf6843ff21b4d8d1fe7ca985ed59bf94fa4b | refs/heads/master | 2021-05-30T19:41:41.150462 | 2016-02-26T09:36:45 | 2016-02-26T09:36:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,866 | java | package com.suminghui.bycar.util;
import java.beans.PropertyDescriptor;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
public class StringUtil {
public static final String EMPTY = "";
public static String intToString(int data) {
return EMPTY + data;
}
public static boolean isEmpty(String data) {
if (data == null || data.equals("")) {
return true;
}
return false;
}
public static String htmlEncode(String txt) {
if (txt != null) {
txt = replace(txt, "&", "&");
txt = replace(txt, "&amp;", "&");
txt = replace(txt, "&quot;", """);
txt = replace(txt, "\"", """);
txt = replace(txt, "&lt;", "<");
txt = replace(txt, "<", "<");
txt = replace(txt, "&gt;", ">");
txt = replace(txt, ">", ">");
txt = replace(txt, "&nbsp;", " ");
}
return txt;
}
public static String[] split(String strSource, String strDiv) {
int arynum = 0, intIdx = 0, intIdex = 0;
int div_length = strDiv.length();
if (strSource.compareTo("") != 0) {
if (strSource.indexOf(strDiv) != -1) {
intIdx = strSource.indexOf(strDiv);
for (int intCount = 1; ; intCount++) {
if (strSource.indexOf(strDiv, intIdx + div_length) != -1) {
intIdx = strSource.indexOf(strDiv, intIdx + div_length);
arynum = intCount;
}
else {
arynum += 2;
break;
}
}
}
else {
arynum = 1;
}
}
else {
arynum = 0;
}
intIdx = 0;
intIdex = 0;
String[] returnStr = new String[arynum];
if (strSource.compareTo("") != 0) {
if (strSource.indexOf(strDiv) != -1) {
intIdx = strSource.indexOf(strDiv);
returnStr[0] = strSource.substring(0, intIdx);
for (int intCount = 1; ; intCount++) {
if (strSource.indexOf(strDiv, intIdx + div_length) != -1) {
intIdex = strSource.indexOf(strDiv, intIdx + div_length);
returnStr[intCount] = strSource.substring(intIdx + div_length,
intIdex);
intIdx = strSource.indexOf(strDiv, intIdx + div_length);
}
else {
returnStr[intCount] = strSource.substring(intIdx + div_length,
strSource.length());
break;
}
}
}
else {
returnStr[0] = strSource.substring(0, strSource.length());
return returnStr;
}
}
else {
return returnStr;
}
return returnStr;
}
public static String doWithNull(Object o) {
if(o == null) {
return "";
} else{
String returnValue = o.toString();
if(returnValue.equalsIgnoreCase("null")) {
return "";
} else {
return returnValue.trim();
}
}
}
public static String replace(String str, String strSub, String strRpl) {
String[] tmp = split(str, strSub);
String returnstr = "";
if (tmp.length != 0) {
returnstr = tmp[0];
for (int i = 0; i < tmp.length - 1; i++) {
returnstr = doWithNull(returnstr) + strRpl + tmp[i + 1];
}
}
return doWithNull(returnstr);
}
// 数字正则
private static final Pattern RE_NUMBER = Pattern.compile("[0-9]+");
// 字符正则
private static final Pattern RE_CHARACTER = Pattern.compile("\\w+");
private static final Pattern Html_TAG = Pattern.compile("<style.*?</style>|<script.*?</script>|<([^>]*)>");
// 千分位显示
private static final DecimalFormat THOUSANDS_TAG = new DecimalFormat("#,###");
/**
* 将一个字符数组中每两个字符中间加入一个字符
*
* @param strs
* 要处理的字符数组
* @param s
* 要加入的字符
* @return
*/
public static String join(String[] strs, String s) {
if (null == strs)
return "";
StringBuilder sb = new StringBuilder();
for (int i = 0; i < strs.length; i++) {
sb.append(strs[i]);
if (i != strs.length - 1)
sb.append(s);
}
return sb.toString();
}
/**
* 将一个字符串分割成一个字符数组
*
* @param str
* 要分割的字符串
* @param separatorChar
* 分隔符
* @return
*/
public static String[] split(String str, char separatorChar) {
return StringUtils.split(str, separatorChar);
}
/**
* 将一个字符串通过指定字符分割后存入list列表
*
* @param str
* 要转换的字符串
* @param separatorChar
* 分隔符
* @return
*/
public static List<String> splitToList(String str, char separatorChar) {//
if (StringUtil.isBlank(str)) {
return null;
}
List<String> list = new ArrayList<String>();
for (String s : StringUtil.split(str, separatorChar)) {
list.add(s);
}
return list;
}
/**
* 判断字符串 是不是为空
*
* @param str
* 要判断的字符串
* @return
*/
public static boolean isBlank(String str) {
if (null == str)
return true;
if ("".equals(str.replaceAll(" ", " ").trim()))
return true;
return false;
}
/**
* 获取随机长度的一个字符串
*
* @param j
* 要获得的字符串长度
* @return
*/
public static String toRandom(int j) {
StringBuilder s = new StringBuilder();
for (int i = 0; i < j; i++) {
Random r = new Random();
int n = r.nextInt(3);
if (n == 0) {
s.append(r.nextInt(9));
} else if (n == 1) {
s.append((char) ('a' + Math.random() * 26));
} else {
s.append((char) ('A' + Math.random() * 26));
}
}
return s.toString();
}
private static char[] numbersAndLetters = ("0123456789abcdefghijklmnopqrstuvwxyz" + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ").toCharArray();
/**
* 获取随机长度的一个字符串
*
* @param length
* 要获得的字符串长度
* @return
*/
public static String randomString(int length) {
if (length < 1) {
return null;
}
// Create a char buffer to put random letters and numbers in.
char[] randBuffer = new char[length];
for (int i = 0; i < randBuffer.length; i++) {
randBuffer[i] = numbersAndLetters[new Random().nextInt(71)];
}
return new String(randBuffer);
}
/**
* 判断字符串是不是符合邮箱格式
*
* @param mailAddr
* 要校验的字符串
* @return 是返回true 否则 false
*/
public static boolean isMailAddr(String mailAddr) {
String check = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$";
Pattern regex = Pattern.compile(check);
Matcher matcher = regex.matcher(mailAddr);
return matcher.matches();
}
/**
* 判断字符串是不是数字
*
* @param str
* 要校验的字符串
* @return
*/
public static boolean isNumber(String str) {
return (str != null) && RE_NUMBER.matcher(str).matches();
}
/**
* 将一个字符串列表转换为字符串并用指定的符号分割
*
* @param list
* 要转换的字符串列表
* @param separatorChar
* 指定的分割符
* @return
*/
public static String getListToString(List<String> list, char separatorChar) {
if (null != list && list.size() > 0) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < list.size(); i++) {
sb.append(list.get(i));
if (i != list.size() - 1) {
sb.append(separatorChar);
}
}
return sb.toString();
}
return null;
}
/**
* 取出html里所有标签和<scritp><style>内容
*
* @param html
* html内容
* @param replace
* 替换内容
* @return
*/
public static String getHtmlToText(String html, String replace) {
Matcher m = Html_TAG.matcher(html);
return m.replaceAll(replace);
}
/**
* 判断是否只包含字符
*
* @param s
* @return
*/
public static boolean regularCharacter(String s) {
return RE_CHARACTER.matcher(s).matches();
}
/**
* 解析bean对象属性
*
* @param p
* @return
*/
public static String getDisplayName(PropertyDescriptor p) {
if (null != p && null != p.getReadMethod()) {
if (p.getPropertyType() == boolean.class) {
return p.getReadMethod().getName().substring(2);
}
return p.getReadMethod().getName().substring(3);
}
return "";
}
/**
* 获取千分位
*
* @param s
* @return ##,###.00
*/
public static String getThousands(String s) {
try {
return THOUSANDS_TAG.format(Double.valueOf(s));
} catch (Exception e) {
return "";
}
}
public static void main(String[] args) {
String s[] = { "a", "b", "c" };
System.out.println(StringUtil.join(s, ","));
}
}
| [
"[email protected]"
] | |
177daf2761e488cf0ea8b770937999e36a1bad90 | a28252ea8a3a684f22bde87e3d242635c93464b7 | /src/test/java/com/project/bookstore/repository/BookRepositoryTest.java | 86fc3a67dad75c65481724d617c4dd4526088216 | [] | no_license | jrt0241/bookstore-back | 55b7c0d4ef3bc6547f6ddff92c99de51bf2af4ca | 4372e0a5aa40e7c8bb65181f2dbcc083eb29e633 | refs/heads/master | 2021-06-27T05:28:14.760632 | 2017-08-27T20:09:22 | 2017-08-27T20:09:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,359 | java | package com.project.bookstore.repository;
import com.project.bookstore.model.Book;
import com.project.bookstore.model.Language;
import com.project.bookstore.util.IsbnGenerator;
import com.project.bookstore.util.NumberGenerator;
import com.project.bookstore.util.TextUtil;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import java.util.Date;
import static org.junit.Assert.*;
// This is a Test on Repository Class to check if all the Database related functionality are working properly
@RunWith(Arquillian.class)
public class BookRepositoryTest {
@Inject
private BookRepository bookRepository;
// Since we are catching the exception here we expect the test to pass. If we don't put
//Expection expected statement we shall get error in out tests.
@Test(expected=Exception.class)
public void findWithInvalidId(){
bookRepository.find(null);
}
@Test(expected=Exception.class)
public void createInvalidBook(){
//Here we pass title as null and test the functionality.
//initially without any changes/bean validations the title takes
// null values and test passes. But it is not desirable.
Book book = new Book("isnb",null,12F,123,Language.ENGLISH,new Date(),"http://image","description");
book=bookRepository.create(book);
Long bookId= book.getId();
}
@org.junit.Test
public void create() throws Exception {
//Test Counting Books
assertEquals(Long.valueOf(0), bookRepository.countAll());
assertEquals(0, bookRepository.findAll().size());
//create a book
Book book = new Book("isnb","a title",12F,123,Language.ENGLISH,new Date(),"http://image","description");
book=bookRepository.create(book);
Long bookId= book.getId();
// Check created book
assertNotNull(bookId);
//Find Created book
Book bookFound= bookRepository.find(bookId);
//check the found book is correct
assertEquals("a title",bookFound.getTitle());
assertTrue(bookFound.getIsbn().startsWith("13"));
//Test Counting Books
assertEquals(Long.valueOf(1), bookRepository.countAll());
assertEquals(1, bookRepository.findAll().size());
//Deleting the Book
bookRepository.delete(bookId);
assertEquals(Long.valueOf(0), bookRepository.countAll());
assertEquals(0, bookRepository.findAll().size());
}
@Deployment
public static JavaArchive createDeployment() {
return ShrinkWrap.create(JavaArchive.class)
.addClass(BookRepository.class)// add all depending classes over here in package or it will throw errors
.addClass(Book.class)
.addClass(Language.class)
.addClass(TextUtil.class)
.addClass(NumberGenerator.class)
.addClass(IsbnGenerator.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource("META-INF/test-persistence.xml", "persistence.xml");
}
}
| [
"[email protected]"
] | |
205679456cb5dcfe0afd3ba9a28d3e4e893d320c | 1236de321654fc48cfd8102d903c3867162785bc | /src/main/java/com/therealdanvega/config/CacheConfiguration.java | 454a18efac8c62251267a322ba41e9eb527d85e9 | [] | no_license | johnwr-response/a4jd-jhipster-tasks | 0c9f65707759501e5fb51675fa1e1420d52fe1f1 | 1ab1497eada04dc30ffddb9c4e818c1059d09719 | refs/heads/master | 2023-07-28T11:22:46.233343 | 2020-04-19T14:00:34 | 2020-04-19T14:00:34 | 257,007,317 | 0 | 0 | null | 2023-07-11T14:00:26 | 2020-04-19T13:33:04 | Java | UTF-8 | Java | false | false | 2,354 | java | package com.therealdanvega.config;
import java.time.Duration;
import org.ehcache.config.builders.*;
import org.ehcache.jsr107.Eh107Configuration;
import org.hibernate.cache.jcache.ConfigSettings;
import io.github.jhipster.config.JHipsterProperties;
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import org.springframework.boot.autoconfigure.orm.jpa.HibernatePropertiesCustomizer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.*;
@Configuration
@EnableCaching
public class CacheConfiguration {
private final javax.cache.configuration.Configuration<Object, Object> jcacheConfiguration;
public CacheConfiguration(JHipsterProperties jHipsterProperties) {
JHipsterProperties.Cache.Ehcache ehcache = jHipsterProperties.getCache().getEhcache();
jcacheConfiguration = Eh107Configuration.fromEhcacheCacheConfiguration(
CacheConfigurationBuilder.newCacheConfigurationBuilder(Object.class, Object.class,
ResourcePoolsBuilder.heap(ehcache.getMaxEntries()))
.withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofSeconds(ehcache.getTimeToLiveSeconds())))
.build());
}
@Bean
public HibernatePropertiesCustomizer hibernatePropertiesCustomizer(javax.cache.CacheManager cacheManager) {
return hibernateProperties -> hibernateProperties.put(ConfigSettings.CACHE_MANAGER, cacheManager);
}
@Bean
public JCacheManagerCustomizer cacheManagerCustomizer() {
return cm -> {
createCache(cm, com.therealdanvega.repository.UserRepository.USERS_BY_LOGIN_CACHE);
createCache(cm, com.therealdanvega.repository.UserRepository.USERS_BY_EMAIL_CACHE);
createCache(cm, com.therealdanvega.domain.User.class.getName());
createCache(cm, com.therealdanvega.domain.Authority.class.getName());
createCache(cm, com.therealdanvega.domain.User.class.getName() + ".authorities");
// jhipster-needle-ehcache-add-entry
};
}
private void createCache(javax.cache.CacheManager cm, String cacheName) {
javax.cache.Cache<Object, Object> cache = cm.getCache(cacheName);
if (cache == null) {
cm.createCache(cacheName, jcacheConfiguration);
}
}
}
| [
"[email protected]"
] | |
9e9efe70daa5b0890f97baf238bc69744837819e | 3ea5419c183aa533aca89854fe931f7b1d084774 | /app/src/main/java/com/zype/android/ui/video_details/fragments/options/Options.java | 0e87e910ec956a9628990485936f473b04e675d5 | [
"MIT"
] | permissive | zype/zype-android | 758740f15befdb46b6fbe1dfeabe046ba2d9e3ab | fb9f446bd397789d279862523af57fa1da23093d | refs/heads/master | 2022-10-25T22:35:13.993193 | 2022-10-14T20:11:27 | 2022-10-14T20:11:27 | 76,283,943 | 5 | 16 | NOASSERTION | 2022-04-18T15:11:54 | 2016-12-12T18:29:39 | Java | UTF-8 | Java | false | false | 787 | java | package com.zype.android.ui.video_details.fragments.options;
/**
* @author vasya
* @version 1
* date 6/26/15
*/
public class Options {
final static String TITLE_VIDEO = "Video";
final static String TITLE_AUDIO = "Audio";
String title;
int id;
int drawableId;
String secondText;
public int progress = -1;
public Options(int id, String title, boolean isVideo) {
this.id = id;
this.title = title;
if (isVideo) {
this.secondText = TITLE_VIDEO;
} else {
this.secondText = TITLE_AUDIO;
}
}
public Options(int id, String title, int drawableId) {
this.id = id;
this.title = title;
this.drawableId = drawableId;
}
private Options() {
}
}
| [
"[email protected]"
] | |
fcc1b1dc7b9315c5c65c09ed591c285422e8cab4 | 5c41bba1b92814583f8dffa2cabc443a1e03d4c8 | /BOEC-ejb/src/java/entity/Bill.java | fc48bf8a12f38d6dda44bffcb54261071a8400a0 | [] | no_license | AnhHNPTIT/ProjectA-D | e59ae03b7417d6c11d133718dc134684406b6725 | 3652e3cd2320cb135988da5e42f65f81b391caa4 | refs/heads/master | 2022-07-07T18:18:23.853000 | 2020-05-13T11:29:19 | 2020-05-13T11:29:19 | 263,607,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,379 | 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 entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author skull
*/
@Entity
@Table(name = "bill")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Bill.findAll", query = "SELECT b FROM Bill b"),
@NamedQuery(name = "Bill.findById", query = "SELECT b FROM Bill b WHERE b.id = :id"),
@NamedQuery(name = "Bill.findByEmployeePersonId", query = "SELECT b FROM Bill b WHERE b.employeePersonId = :employeePersonId"),
@NamedQuery(name = "Bill.findBySumary", query = "SELECT b FROM Bill b WHERE b.sumary = :sumary"),
@NamedQuery(name = "Bill.findByDate", query = "SELECT b FROM Bill b WHERE b.date = :date"),
@NamedQuery(name = "Bill.findByNote", query = "SELECT b FROM Bill b WHERE b.note = :note"),
@NamedQuery(name = "Bill.findByOrderShipCompanyCompanyId", query = "SELECT b FROM Bill b WHERE b.orderShipCompanyCompanyId = :orderShipCompanyCompanyId"),
@NamedQuery(name = "Bill.findByEmployeeId", query = "SELECT b FROM Bill b WHERE b.employeeId = :employeeId")})
public class Bill implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "Id")
private Integer id;
@Basic(optional = false)
@NotNull
@Column(name = "EmployeePersonId")
private int employeePersonId;
@Basic(optional = false)
@NotNull
@Column(name = "Sumary")
private float sumary;
@Column(name = "Date")
@Temporal(TemporalType.DATE)
private Date date;
@Size(max = 255)
@Column(name = "Note")
private String note;
@Column(name = "OrderShipCompanyCompanyId")
private Integer orderShipCompanyCompanyId;
@Basic(optional = false)
@NotNull
@Column(name = "EmployeeId")
private int employeeId;
@JoinColumn(name = "EmployeePersonId2", referencedColumnName = "PersonId")
@ManyToOne(optional = false)
private Employee employeePersonId2;
@JoinColumn(name = "ItemOrderId", referencedColumnName = "Id")
@ManyToOne(optional = false)
private ItemOrder orderId;
public Bill() {
}
public Bill(Integer id) {
this.id = id;
}
public Bill(Integer id, int employeePersonId, float sumary, int employeeId) {
this.id = id;
this.employeePersonId = employeePersonId;
this.sumary = sumary;
this.employeeId = employeeId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getEmployeePersonId() {
return employeePersonId;
}
public void setEmployeePersonId(int employeePersonId) {
this.employeePersonId = employeePersonId;
}
public float getSumary() {
return sumary;
}
public void setSumary(float sumary) {
this.sumary = sumary;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public Integer getOrderShipCompanyCompanyId() {
return orderShipCompanyCompanyId;
}
public void setOrderShipCompanyCompanyId(Integer orderShipCompanyCompanyId) {
this.orderShipCompanyCompanyId = orderShipCompanyCompanyId;
}
public int getEmployeeId() {
return employeeId;
}
public void setEmployeeId(int employeeId) {
this.employeeId = employeeId;
}
public Employee getEmployeePersonId2() {
return employeePersonId2;
}
public void setEmployeePersonId2(Employee employeePersonId2) {
this.employeePersonId2 = employeePersonId2;
}
public ItemOrder getOrderId() {
return orderId;
}
public void setOrderId(ItemOrder orderId) {
this.orderId = orderId;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Bill)) {
return false;
}
Bill other = (Bill) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "entity.Bill[ id=" + id + " ]";
}
}
| [
"[email protected]"
] | |
f040e1be3fb764f7ce02b145a135866917752624 | e2990c8ea03e0f5fbea7ef99337cfe4298977280 | /mq-service-api/src/main/java/com/mq/biz/bean/KafkaMsgRQ.java | 2386746ee50a03ea12f97a74b5d50ed9c6492f08 | [
"Apache-2.0"
] | permissive | HeShengJin/mq-kafka | d5a89350bee21f678cc52cfef4351c99350faed2 | c21d433915b1beea7d5051d16a5d8878e11ff201 | refs/heads/master | 2022-02-15T02:19:57.764551 | 2019-07-27T04:00:26 | 2019-07-27T04:00:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 720 | java | package com.mq.biz.bean;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.mq.entity.BaseObject;
import lombok.Data;
import java.util.Date;
/**
* @version v1.0
* @ClassName KafkaMsgRQ<T>
* T:数据的class类型
* @Description 简单的消息请求结构
*/
@Data
public class KafkaMsgRQ<T> extends BaseObject {
//主题
String topic;
//消息类型
String msgType;
//消息子类型
String msgSubType;
//系统ID
String systemID;
//业务消息主键(eg:订单Id ,商品Id)
Object msgKey;
//消息数据
@JsonInclude(JsonInclude.Include.NON_NULL)
T msgData;
//来源Ip
String srcHost;
//创建时间
private Date createtime;
}
| [
"[email protected]"
] | |
ce2aca7939b85956c9aa00271af927283cf232d3 | 2b20bb6fd2564da56555808623ef6792bbcb5b0b | /src/com/g4mesoft/graphics3d/Vertex3D.java | a0ab89d63c1bc1678c21bbcca9f4d29405414f7b | [
"MIT"
] | permissive | G4me4u/g4mengine | 1ef5323311cc4b769aeccd541bdf8b7903f1060d | ab952d287f3a715d485100a7df562a4b999d2917 | refs/heads/master | 2021-06-02T19:28:44.356170 | 2020-06-30T15:56:18 | 2020-06-30T15:56:18 | 102,396,417 | 10 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,736 | java | package com.g4mesoft.graphics3d;
import com.g4mesoft.math.Vec2f;
import com.g4mesoft.math.Vec3f;
import com.g4mesoft.math.Vec4f;
public class Vertex3D {
public final Vec4f pos;
public final float[] data;
public Vertex3D(int numData) {
this.pos = new Vec4f();
this.data = new float[numData];
}
public Vertex3D(Vec4f pos) {
this(pos, 0);
}
public Vertex3D(Vec4f pos, int numData) {
this.pos = pos;
this.data = new float[numData];
}
public void storeFloat(int location, float input) {
data[location] = input;
}
public float loadFloat(int location) {
return data[location];
}
public void storeVec2f(int location, Vec2f input) {
data[location + 0] = input.x;
data[location + 1] = input.y;
}
public void loadVec2f(int location, Vec2f output) {
output.x = data[location + 0];
output.y = data[location + 1];
}
public void storeVec3f(int location, Vec3f input) {
data[location + 0] = input.x;
data[location + 1] = input.y;
data[location + 2] = input.z;
}
public void loadVec3f(int location, Vec3f output) {
output.x = data[location + 0];
output.y = data[location + 1];
output.z = data[location + 2];
}
public void storeVec4f(int location, Vec4f input) {
data[location + 0] = input.x;
data[location + 1] = input.y;
data[location + 2] = input.z;
data[location + 2] = input.w;
}
public void loadVec4f(int location, Vec4f output) {
output.x = data[location + 0];
output.y = data[location + 1];
output.z = data[location + 2];
output.w = data[location + 2];
}
public void setVertex(Vertex3D other) {
pos.set(other.pos);
for (int i = data.length - 1; i >= 0; i--)
data[i] = other.data[i];
}
public int getNumData() {
return data.length;
}
}
| [
"[email protected]"
] | |
0dd1edd8906dcb7e2674063feacc107719d0e7d7 | f9304c7fb4fe67eafd22c1814afab633977417c6 | /src/main/java/com/ailk/listener/weblistener/MyHttpSessionAttributeListener.java | ecb04191a52d874b0eb28f7d63d5839c8c24b04a | [] | no_license | kisshello/watermelon | cf2b01fd49325be546809efcf2463fb3174e0c21 | 88cc8829d2d66471e8afeb04a0adf646a2deb51f | refs/heads/master | 2021-06-25T20:26:40.555265 | 2020-04-26T02:56:31 | 2020-04-26T02:56:31 | 219,471,596 | 0 | 0 | null | 2020-10-13T17:43:29 | 2019-11-04T10:09:59 | Java | UTF-8 | Java | false | false | 738 | java | package com.ailk.listener.weblistener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
/**
* @description:
* @author: wanghk3
* @time: 2020/4/5 17:38
*/
public class MyHttpSessionAttributeListener implements HttpSessionAttributeListener {
@Override
public void attributeAdded(HttpSessionBindingEvent se) {
System.out.println("向session中添加了属性");
}
@Override
public void attributeRemoved(HttpSessionBindingEvent se) {
System.out.println("从session中移除了属性");
}
@Override
public void attributeReplaced(HttpSessionBindingEvent se) {
System.out.println("session中的属性被替换了");
}
} | [
"[email protected]"
] | |
1066e3f55edb4b43c5f8f31c67b38e3d201d3cb6 | fe1ca817c8b9478c17b6d81a2a1497fc8a637e41 | /src/main/java/org/usfirst/frc/team4028/robot/commands/auton/Auton_PIDTune_spinDown.java | 45875910f45cd0aafa6c145585f4ac9babf4e03a | [] | no_license | Team4028/4028-PreBuild-Season-2019 | d95665a156f72b829bfcda5903768fe8664226ea | 53bc875e37ac11b37490e7de31b9c53237152af5 | refs/heads/master | 2020-04-09T02:46:54.707642 | 2018-12-06T22:21:33 | 2018-12-06T22:21:33 | 159,953,774 | 0 | 0 | null | 2018-12-07T00:52:44 | 2018-12-01T14:41:24 | Java | UTF-8 | Java | false | false | 1,211 | java | package org.usfirst.frc.team4028.robot.commands.auton;
import com.ctre.phoenix.motorcontrol.can.TalonSRX;
import com.ctre.phoenix.motorcontrol.ControlMode;
import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.command.Subsystem;
/**
*
*/
public class Auton_PIDTune_spinDown extends Command {
private TalonSRX _talon;
public Auton_PIDTune_spinDown(Subsystem requiredSubsystem, TalonSRX talon) {
_talon = talon;
requires(requiredSubsystem);
}
// Called just before this Command runs the first time
protected void initialize() {
_talon.configOpenloopRamp(0.0, 10);
_talon.set(ControlMode.PercentOutput, 0.0);
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return _talon.getSelectedSensorVelocity(0) == 0;
}
// Called once after isFinished returns true
protected void end() {
System.out.println("Motor stopped.");
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
_talon.set(ControlMode.PercentOutput, 0);
}
} | [
"[email protected]"
] | |
a5f31956608bff445f352f945b039e162385b13f | 90eb7a131e5b3dc79e2d1e1baeed171684ef6a22 | /sources/p005b/p096l/p097a/p113c/p131e/p136e/C2507tk.java | fef301f8722c4d01761ed053434c49c54eb6a8ab | [] | no_license | shalviraj/greenlens | 1c6608dca75ec204e85fba3171995628d2ee8961 | fe9f9b5a3ef4a18f91e12d3925e09745c51bf081 | refs/heads/main | 2023-04-20T13:50:14.619773 | 2021-04-26T15:45:11 | 2021-04-26T15:45:11 | 361,799,768 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,643 | java | package p005b.p096l.p097a.p113c.p131e.p136e;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import p005b.p006a.p007a.p024o.C0823f;
import p005b.p096l.p097a.p113c.p119b.p122m.p123v.C1948a;
/* renamed from: b.l.a.c.e.e.tk */
public final class C2507tk extends C1948a {
public static final Parcelable.Creator<C2507tk> CREATOR = new C2531uk();
/* renamed from: g */
public String f4322g;
/* renamed from: h */
public String f4323h;
/* renamed from: i */
public String f4324i;
/* renamed from: j */
public String f4325j;
/* renamed from: k */
public String f4326k;
/* renamed from: l */
public String f4327l;
/* renamed from: m */
public String f4328m;
public C2507tk() {
}
public C2507tk(String str, String str2, String str3, String str4, String str5, String str6, String str7) {
this.f4322g = str;
this.f4323h = str2;
this.f4324i = str3;
this.f4325j = str4;
this.f4326k = str5;
this.f4327l = str6;
this.f4328m = str7;
}
public final void writeToParcel(@NonNull Parcel parcel, int i) {
int w0 = C0823f.m403w0(parcel, 20293);
C0823f.m395s0(parcel, 2, this.f4322g, false);
C0823f.m395s0(parcel, 3, this.f4323h, false);
C0823f.m395s0(parcel, 4, this.f4324i, false);
C0823f.m395s0(parcel, 5, this.f4325j, false);
C0823f.m395s0(parcel, 6, this.f4326k, false);
C0823f.m395s0(parcel, 7, this.f4327l, false);
C0823f.m395s0(parcel, 8, this.f4328m, false);
C0823f.m331A0(parcel, w0);
}
}
| [
"[email protected]"
] | |
fc30b092c46d3a54be320cd17bccdb712795c5a1 | 4f1577bfef6ec648d91ccb93298867395704eda7 | /usertype.core/src/main/java/org/jadira/usertype/dateandtime/joda/PersistentLocalDate.java | dc58ab69c1f7b4d85b44a1b0039b6dd9c53dc566 | [
"Apache-2.0"
] | permissive | TorqueITS/jadira-6.0.1.GA | e9b91e6c8ddb4b1f00fcd5b05c28f0e70c28be68 | dc644a2260822cecdc472b3649ce447701907111 | refs/heads/develop | 2021-08-29T21:08:44.503113 | 2017-12-15T00:58:05 | 2017-12-15T00:58:05 | 112,560,991 | 0 | 0 | Apache-2.0 | 2017-12-15T01:15:10 | 2017-11-30T03:41:17 | Java | UTF-8 | Java | false | false | 1,807 | java | /*
* Copyright 2010, 2011 Christopher Pheby
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jadira.usertype.dateandtime.joda;
import java.sql.Date;
import org.hibernate.usertype.ParameterizedType;
import org.jadira.usertype.dateandtime.joda.columnmapper.DateColumnLocalDateMapper;
import org.jadira.usertype.spi.shared.AbstractParameterizedUserType;
import org.jadira.usertype.spi.shared.IntegratorConfiguredType;
import org.joda.time.LocalDate;
/**
* Persist {@link LocalDate} via Hibernate. This type shares database
* representation with org.joda.time.contrib.hibernate.PersistentLocalDate
*
* The type is stored using the JVM timezone by default.
*
* Alternatively provide the 'databaseZone' parameter in the {@link org.joda.time.DateTimeZone#forID(String)} format
* to indicate the zone of the database. Be careful to set this carefully. See https://jadira.atlassian.net/browse/JDF-26
* N.B. To use the zone of the JVM for the database zone you can also supply 'jvm'
*/
public class PersistentLocalDate extends AbstractParameterizedUserType<LocalDate, Date, DateColumnLocalDateMapper> implements ParameterizedType, IntegratorConfiguredType {
private static final long serialVersionUID = 2918856421618299370L;
}
| [
"[email protected]"
] | |
55f1de379e71b2c8734365227d95722c31ce56cf | 93b2475fd35a53b863985a820d78573b4df968d1 | /Práctica 1 - 2019/src/Punto/pMain.java | cff3c24016238756d8f756d884a56c7f1b18eda1 | [] | no_license | josueaquino12/Algoritmos-y-Programaci-n-3 | ef36650008a6d84b935c39a45cdb53456a258d9f | 97d3872c0c4874bb8f2aa54a23ab6688fa589827 | refs/heads/master | 2020-06-25T04:30:09.044474 | 2019-07-29T19:54:12 | 2019-07-29T19:54:12 | 199,201,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package Punto;
public class pMain {
public static void main(String[] args) {
Punto p = new Punto (5,3);
Punto p1 = new Punto (3,2);
Punto p2 = new Punto (7,8);
p.imprimir();
p.desplazar(1,1);
p.imprimir();
System.out.println("Distancia:----->" + Punto.distancia(p1, p2));;
}
}
| [
"JosBen@DESKTOP-9BFHS37"
] | JosBen@DESKTOP-9BFHS37 |
d6027147831bcb66b5db872c668543967ce8db89 | 38c34ff168b64a67e969bd81a60556ad0b17e62c | /cbn-20170912/src/main/java/com/aliyun/cbn20170912/models/CreateCenResponseBody.java | 1e281a3d541a8b519796d2c6b16fbe8fd439798d | [
"Apache-2.0"
] | permissive | bestchendong/alibabacloud-java-sdk | 1474344c006641fbab882af4c277b5cbb343ea80 | 737c2b966c5e46903d5875e269c971cb80dd678f | refs/heads/master | 2023-04-15T05:34:29.011451 | 2021-04-22T09:14:46 | 2021-04-22T09:14:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 875 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.cbn20170912.models;
import com.aliyun.tea.*;
public class CreateCenResponseBody extends TeaModel {
@NameInMap("RequestId")
public String requestId;
@NameInMap("CenId")
public String cenId;
public static CreateCenResponseBody build(java.util.Map<String, ?> map) throws Exception {
CreateCenResponseBody self = new CreateCenResponseBody();
return TeaModel.build(map, self);
}
public CreateCenResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public CreateCenResponseBody setCenId(String cenId) {
this.cenId = cenId;
return this;
}
public String getCenId() {
return this.cenId;
}
}
| [
"[email protected]"
] | |
c2e1a1a0d3a9bab0f06259b8b0df879fa6b1187f | fba8af31d5d36d8a6cf0c341faed98b6cd5ec0cb | /src/main/java/com/alipay/api/response/AlipayMarketingToolFengdieSitesBatchqueryResponse.java | 9f9a5e68f4a1b5539b0a82a90326636fa6ed220f | [
"Apache-2.0"
] | permissive | planesweep/alipay-sdk-java-all | b60ea1437e3377582bd08c61f942018891ce7762 | 637edbcc5ed137c2b55064521f24b675c3080e37 | refs/heads/master | 2020-12-12T09:23:19.133661 | 2020-01-09T11:04:31 | 2020-01-09T11:04:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 780 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.domain.FengdieSitesListRespModel;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.marketing.tool.fengdie.sites.batchquery response.
*
* @author auto create
* @since 1.0, 2019-05-22 14:32:03
*/
public class AlipayMarketingToolFengdieSitesBatchqueryResponse extends AlipayResponse {
private static final long serialVersionUID = 3391769776888761643L;
/**
* 获取云凤蝶站点列表返回值模型
*/
@ApiField("data")
private FengdieSitesListRespModel data;
public void setData(FengdieSitesListRespModel data) {
this.data = data;
}
public FengdieSitesListRespModel getData( ) {
return this.data;
}
}
| [
"[email protected]"
] | |
0d4b921c87b24f3df749f651a2489a90f045d9af | 65ad63c8f9a3798acc2565ed7101f62887c11f79 | /src/main/java/com/guoanshequ/dc/das/dao/master/DsPesCustomerStoreMonthMapper.java | 495a7a224e5f9019d113f4724647965bb8e61b94 | [] | no_license | greatypine/ds | daef5b182769d4f6e23acf8095d7338104bc47f0 | 6c908fa035c3e77d58d3c2bb1f37fd6afaa4d254 | refs/heads/master | 2020-12-03T03:45:50.806074 | 2019-04-15T01:43:06 | 2019-04-15T01:43:06 | 95,770,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 951 | java | package com.guoanshequ.dc.das.dao.master;
import java.util.Map;
import org.springframework.stereotype.Repository;
import com.guoanshequ.dc.das.datasource.DataSource;
/**
*
* @author gbl
*
*/
@Repository
@DataSource("master")
public interface DsPesCustomerStoreMonthMapper {
/**
*
* @Title: deleteDsCustomer
* @Description: TODO 按月删除门店用户
* 2018年4月16日
* @param @param param
* @param @return
* @return Integer
* @throws
* @author gbl
*/
public Integer deleteDsPesCustomer(Map<String,String> param);
/**
*
* @Title: insertDsPesCustomer
* @Description: TODO 按月产生门店用户数据(包括门店编号,城市,超10元拉新用户量,消费用户量,超10元消费用户量)
* 2018年4月16日
* @param @return
* @return int
* @throws
* @author gbl
*/
public Integer addDsPesCustomer(Map<String,String> param);
}
| [
"[email protected]"
] | |
cddc7cbd05826992702c7f2d72b36bdbec420143 | dbba88db0d55aca07a9ad2026fed95e468901d2b | /configclient/src/main/java/com/playground/configclient/controller/TestController.java | b75a4fcbbc264088f87f05ea74824a76f8f003e0 | [] | no_license | amit-mittal/spring-cloud-playground | deb451b3374c52994f6ba0d97f9b830c607047ba | acd96afad16b3b91ba16ba24599e4790bef7260b | refs/heads/master | 2020-03-27T12:52:24.890277 | 2018-09-08T08:19:04 | 2018-09-08T08:19:04 | 146,575,236 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 925 | java | package com.playground.configclient.controller;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController {
@Value("${lucky-word}")
String luckyWord;
@RequestMapping(value = "/", method = RequestMethod.GET)
public String getLuckyWord() {
return "The lucky word is " + luckyWord;
}
@RequestMapping(value = "/fail", method = RequestMethod.GET)
@HystrixCommand(fallbackMethod = "fallbackMethod")
public String doFailedCall() {
throw new RuntimeException("Fail!!!!");
}
public String fallbackMethod() {
return "Don't worry, it's been taken care";
}
}
| [
"[email protected]"
] | |
1934f8ea4ee14a435275b67231b7d7a2eedb32e2 | 62ac9c90814470dde6c30c58c7ad94db18acb77f | /src/main/java/kr/or/ddit/mul/mulCalculation.java | 58515ca72aa0daf0e8d4bf0f7c1396d0c42e9a52 | [] | no_license | DoaOh/lastjsp | ceb4f24efd68fee68a7cecfe62219585d506d554 | ca7a85436fc5d34dd1c4cc301e2bf954307b33d5 | refs/heads/master | 2021-06-14T11:08:15.831074 | 2019-06-18T09:52:59 | 2019-06-18T09:52:59 | 192,501,429 | 0 | 0 | null | 2021-04-22T18:22:51 | 2019-06-18T08:45:15 | JavaScript | UTF-8 | Java | false | false | 1,075 | java | package kr.or.ddit.mul;
import java.io.IOException;
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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Servlet implementation class mulCalculation
*/
@WebServlet("/mulCalculation")
public class mulCalculation extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final Logger logger = LoggerFactory
.getLogger(mulCalculation.class);
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int mul1 = Integer.parseInt(request.getParameter("mul1"));
int mul2 = Integer.parseInt(request.getParameter("mul2"));
int mul = mul1 * mul2;
request.getSession().setAttribute("mulResult", mul);
request.getRequestDispatcher("/mul/mulResult.jsp").forward(request, response);
}
}
| [
"[email protected]"
] | |
dbba5f22821928725f0d9e2c27c04dab8d5f89c1 | 10198516150fe93bc2e00d6e5459c26e160f34ba | /repo/proj3/gitlet/Blob.java | bb66dbbc0c1bfe796af33128670196844f817c2d | [] | no_license | ultraviolex/CS61B | d9669662f989d7d3b26f60c35772f0ccc8b9c615 | aead00d32033b63e92de9e543c83857e532ea97b | refs/heads/master | 2022-09-11T02:19:41.615204 | 2020-06-01T21:32:13 | 2020-06-01T21:32:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package gitlet;
import java.io.File;
import java.io.Serializable;
/** Blob class of gitlet.
* @author Xiuhui Ming*/
public class Blob implements Serializable {
/** Make a blob from a file.
* @param f file. */
public Blob(File f) {
_fileName = f.getName();
_contents = Utils.readContentsAsString(f);
_ID = Utils.sha1("file", _contents);
}
/** Return filename.*/
public String getfileName() {
return _fileName;
}
/** Return contents. */
public String getcontents() {
return _contents;
}
/** Return ID. */
public String getID() {
return _ID;
}
/** File name. */
private String _fileName;
/** Contents of file. */
private String _contents;
/** SHA ID. */
private String _ID;
}
| [
"[email protected]"
] | |
e54694cf532fe9636c1d8872576a383da83bbf17 | 1596a2a033cf994615758f63d1f8ca185187cbb8 | /TP3/LinearSpacePerfectHashing.java | 54f199c3b1d18e8261af0d361b184188b64546f3 | [] | no_license | badrlab/inf2010 | f1706f48334e10d0a3f22370049a5e7711faa2cd | 6ee3a7966146c69a55821f8f10f66d63763bdbaf | refs/heads/master | 2020-03-17T14:23:08.477645 | 2018-05-16T13:42:17 | 2018-05-16T13:42:17 | 133,669,862 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,883 | java | import java.util.Random;
import java.util.ArrayList;
public class LinearSpacePerfectHashing<AnyType>
{
static int p = 46337;
QuadraticSpacePerfectHashing<AnyType>[] data;
int a, b;
LinearSpacePerfectHashing()
{
a=b=0; data = null;
}
LinearSpacePerfectHashing(ArrayList<AnyType> array)
{
AllocateMemory(array);
}
public void SetArray(ArrayList<AnyType> array)
{
AllocateMemory(array);
}
@SuppressWarnings("unchecked")
private void AllocateMemory(ArrayList<AnyType> array)
{
Random generator = new Random( System.nanoTime() );
if(array == null || array.size() == 0) return;
if(array.size() == 1)
{
a = b = 0;
data = (QuadraticSpacePerfectHashing<AnyType>[]) new Object[1];
data[0].items[0] = array.get(0);
return;
}
data = new QuadraticSpacePerfectHashing[array.size()];
a = generator.nextInt(p-1) + 1;
b = generator.nextInt(p);
int m = array.size();
int index;
for (int i = 0; i < array.size(); i++)
{
AnyType x = array.get(i);
index = (a * x.hashCode() + b % p) % m;
if (data[index] == null)
{
ArrayList<AnyType> tmp = new ArrayList<AnyType>();
tmp.add(x);
data[index] = new QuadraticSpacePerfectHashing<AnyType>(tmp);
data[index].items[0] = x;
}
else
{
ArrayList<AnyType> tmp = new ArrayList<AnyType>();
for (int j = 0; j < data[index].items.length; j++) if (data[index].items[j] != null) tmp.add(data[index].items[j]);
tmp.add(x);
data[index] = new QuadraticSpacePerfectHashing<AnyType>(tmp);
}
}
}
public int Size()
{
if( data == null ) return 0;
int size = 0;
for(int i=0; i<data.length; ++i) size += (data[i] == null ? 1 : data[i].Size());
return size;
}
public boolean contains(AnyType x )
{
int position = (a * x.hashCode() + b % p) % data.length;
if (data[position] == null) return false;
return data[position].contains(x);
}
} | [
"[email protected]"
] | |
0de781bd573cb3d05e3d72aacd88b558ee9efc1d | f692fe03c7dc6d7f5f3197276ad36ae799643794 | /recruiting-core/src/test/java/it/f2informatica/test/services/gateway/mongodb/UserRepositoryGatewayMongoDBTest.java | 520b927d04dd040c4e6f5787e46e2a96fcd42cbd | [
"Apache-2.0"
] | permissive | ShreySangal/recruiting-old-style | 52076bad4b82502d0e5e9261484625d1dd0c39a9 | 9de7cf6a60b4b478b65477f8b79b179a0e0eea06 | refs/heads/master | 2021-11-13T10:02:48.774134 | 2016-03-09T09:23:54 | 2016-03-09T09:23:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,655 | java | /*
* =============================================================================
*
* Copyright (c) 2014, Fernando Aspiazu
*
* 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 it.f2informatica.test.services.gateway.mongodb;
import com.google.common.collect.Lists;
import com.mongodb.CommandResult;
import com.mongodb.WriteResult;
import it.f2informatica.core.Authority;
import it.f2informatica.core.gateway.EntityToModelConverter;
import it.f2informatica.core.gateway.UserRepositoryGateway;
import it.f2informatica.core.gateway.mongodb.UserRepositoryGatewayMongoDB;
import it.f2informatica.core.model.RoleModel;
import it.f2informatica.core.model.UserModel;
import it.f2informatica.mongodb.domain.Role;
import it.f2informatica.mongodb.domain.User;
import it.f2informatica.mongodb.repositories.RoleRepository;
import it.f2informatica.mongodb.repositories.UserRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import java.util.List;
import static it.f2informatica.mongodb.domain.builder.RoleBuilder.role;
import static it.f2informatica.mongodb.domain.builder.UserBuilder.user;
import static it.f2informatica.test.services.builder.UserModelDataBuilder.userModel;
import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class UserRepositoryGatewayMongoDBTest {
@Mock
private MongoTemplate mongoTemplate;
@Mock
private UserRepository userRepository;
@Mock
private RoleRepository roleRepository;
@Mock
private EntityToModelConverter<User, UserModel> userToModelConverter;
@InjectMocks
private UserRepositoryGateway userRepositoryGateway = new UserRepositoryGatewayMongoDB();
@Test
public void findUserById() {
when(userRepository.findOne(anyString())).thenReturn(getUser());
when(userToModelConverter.convert(getUser())).thenReturn(userModel().build());
UserModel userResponse = userRepositoryGateway.findUserById("52820f6f34bdf55624303fc1");
assertThat(userResponse.getUsername()).isEqualTo("jhon_kent77");
}
@Test
public void findByUsername() {
when(userRepository.findByUsername(anyString())).thenReturn(getUser());
when(userToModelConverter.convert(getUser())).thenReturn(userModel().build());
UserModel userResponse = userRepositoryGateway.findByUsername("jhon_kent77");
assertThat(userResponse.getUsername()).isEqualTo("jhon_kent77");
}
@Test
public void findByUsernameAndPassword() {
when(userRepository.findByUsernameAndPassword(anyString(), anyString())).thenReturn(getUser());
when(userToModelConverter.convert(getUser())).thenReturn(userModel().build());
UserModel userResponse = userRepositoryGateway.findByUsernameAndPassword("jhon_kent77", "okisteralio");
assertThat(userResponse.getUsername()).isEqualTo("jhon_kent77");
}
@Test
public void saveUser() {
User user = getUser();
when(userRepository.save(any(User.class))).thenReturn(user);
when(userToModelConverter.convert(user)).thenReturn(userModel().build());
UserModel userModelSaved = userRepositoryGateway.saveUser(userModel().build());
assertThat(userModelSaved.getUsername()).isEqualTo("jhon_kent77");
}
private User getUser() {
return user()
.withId("52820f6f34bdf55624303fc1")
.withUsername("jhon_kent77")
.withPassword("okisteralio")
.withRole(role().thatIsAdministrator())
.build();
}
@Test
public void loadRoles() {
String userAuthority = Authority.ROLE_USER.toString();
RoleModel roleModel = new RoleModel();
roleModel.setRoleName(userAuthority);
List<Role> roles = Lists.newArrayList(
role().thatIsAdministrator(),
role().withAuthorization(userAuthority).build()
);
when(roleRepository.findAll()).thenReturn(roles);
assertThat(userRepositoryGateway.loadRoles()).hasSize(2).contains(roleModel);
}
@Test
public void findRoleByName() {
String roleAdmin = Authority.ROLE_ADMIN.toString();
when(roleRepository.findByName(roleAdmin)).thenReturn(role().thatIsAdministrator());
RoleModel response = userRepositoryGateway.findRoleByName(roleAdmin);
assertThat(response.getRoleName()).isEqualTo("ROLE_ADMIN");
}
@Test
public void updateUser() {
stubUpdateSuccess();
userRepositoryGateway.updateUser(userModel().build());
}
private void stubUpdateSuccess() {
WriteResult writeResultMock = mock(WriteResult.class);
CommandResult commandResult = mock(CommandResult.class);
when(writeResultMock.getLastError()).thenReturn(commandResult);
when(commandResult.ok()).thenReturn(true);
when(mongoTemplate.updateFirst(
any(Query.class),
any(Update.class),
any(Class.class))
).thenReturn(writeResultMock);
}
}
| [
"[email protected]"
] | |
924b7baf61592fedb576944e8b58e790beb1adb8 | 6253283b67c01a0d7395e38aeeea65e06f62504b | /decompile/app/Mms/src/main/java/com/android/mms/ui/HwCustAttachmentTypeSelectorAdapter.java | 762c6ec4da14f9506f3caad24e2e41bb17f91941 | [] | no_license | sufadi/decompile-hw | 2e0457a0a7ade103908a6a41757923a791248215 | 4c3efd95f3e997b44dd4ceec506de6164192eca3 | refs/heads/master | 2023-03-15T15:56:03.968086 | 2017-11-08T03:29:10 | 2017-11-08T03:29:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 585 | java | package com.android.mms.ui;
import android.content.Context;
import com.android.mms.ui.IconListAdapter.IconListItem;
import java.util.List;
public class HwCustAttachmentTypeSelectorAdapter {
public void addExtItem(List<IconListItem> list, Context context) {
}
public boolean isCustLocationEnable() {
return false;
}
public boolean isImModeNow() {
return false;
}
public void addSubjectForSimpleUi(Context context, List<IconListItem> list) {
}
public void removeAdapterOptions(Context context, List<IconListItem> list) {
}
}
| [
"[email protected]"
] | |
add7a5a82bab2e0bd2d3817f77bbe53ea1ac70ed | 45de98b5e10d55f7f87062989dbf689a7c55f4d7 | /app/build/generated/source/r/debug/android/support/loader/R.java | 84fb44eacb951bfa3f9e32871350ff06f8ee53bf | [] | no_license | tv9nusantaraIT/nine_store_webview | 32090522a70f4a79c77624a83d3082b637e1031c | fe009dfb230129bf8041831bbedf17d0d9c05fa3 | refs/heads/master | 2023-07-08T14:14:21.333332 | 2021-07-31T19:27:21 | 2021-07-31T19:27:21 | 391,444,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,167 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.loader;
public final class R {
public static final class attr {
public static final int alpha = 0x7f020027;
public static final int font = 0x7f02007a;
public static final int fontProviderAuthority = 0x7f02007c;
public static final int fontProviderCerts = 0x7f02007d;
public static final int fontProviderFetchStrategy = 0x7f02007e;
public static final int fontProviderFetchTimeout = 0x7f02007f;
public static final int fontProviderPackage = 0x7f020080;
public static final int fontProviderQuery = 0x7f020081;
public static final int fontStyle = 0x7f020082;
public static final int fontVariationSettings = 0x7f020083;
public static final int fontWeight = 0x7f020084;
public static final int ttcIndex = 0x7f02013c;
}
public static final class color {
public static final int notification_action_color_filter = 0x7f040040;
public static final int notification_icon_bg_color = 0x7f040041;
public static final int ripple_material_light = 0x7f04004b;
public static final int secondary_text_default_material_light = 0x7f04004d;
}
public static final class dimen {
public static final int compat_button_inset_horizontal_material = 0x7f05004b;
public static final int compat_button_inset_vertical_material = 0x7f05004c;
public static final int compat_button_padding_horizontal_material = 0x7f05004d;
public static final int compat_button_padding_vertical_material = 0x7f05004e;
public static final int compat_control_corner_material = 0x7f05004f;
public static final int compat_notification_large_icon_max_height = 0x7f050050;
public static final int compat_notification_large_icon_max_width = 0x7f050051;
public static final int notification_action_icon_size = 0x7f05005b;
public static final int notification_action_text_size = 0x7f05005c;
public static final int notification_big_circle_margin = 0x7f05005d;
public static final int notification_content_margin_start = 0x7f05005e;
public static final int notification_large_icon_height = 0x7f05005f;
public static final int notification_large_icon_width = 0x7f050060;
public static final int notification_main_column_padding_top = 0x7f050061;
public static final int notification_media_narrow_margin = 0x7f050062;
public static final int notification_right_icon_size = 0x7f050063;
public static final int notification_right_side_padding_top = 0x7f050064;
public static final int notification_small_icon_background_padding = 0x7f050065;
public static final int notification_small_icon_size_as_large = 0x7f050066;
public static final int notification_subtext_size = 0x7f050067;
public static final int notification_top_pad = 0x7f050068;
public static final int notification_top_pad_large_text = 0x7f050069;
}
public static final class drawable {
public static final int notification_action_background = 0x7f060058;
public static final int notification_bg = 0x7f060059;
public static final int notification_bg_low = 0x7f06005a;
public static final int notification_bg_low_normal = 0x7f06005b;
public static final int notification_bg_low_pressed = 0x7f06005c;
public static final int notification_bg_normal = 0x7f06005d;
public static final int notification_bg_normal_pressed = 0x7f06005e;
public static final int notification_icon_background = 0x7f06005f;
public static final int notification_template_icon_bg = 0x7f060060;
public static final int notification_template_icon_low_bg = 0x7f060061;
public static final int notification_tile_bg = 0x7f060062;
public static final int notify_panel_notification_icon_bg = 0x7f060063;
}
public static final class id {
public static final int action_container = 0x7f07000d;
public static final int action_divider = 0x7f07000f;
public static final int action_image = 0x7f070010;
public static final int action_text = 0x7f070016;
public static final int actions = 0x7f070017;
public static final int async = 0x7f07001f;
public static final int blocking = 0x7f070022;
public static final int chronometer = 0x7f07002a;
public static final int forever = 0x7f07003e;
public static final int icon = 0x7f070044;
public static final int icon_group = 0x7f070045;
public static final int info = 0x7f070048;
public static final int italic = 0x7f07004a;
public static final int line1 = 0x7f07004c;
public static final int line3 = 0x7f07004d;
public static final int normal = 0x7f070055;
public static final int notification_background = 0x7f070056;
public static final int notification_main_column = 0x7f070057;
public static final int notification_main_column_container = 0x7f070058;
public static final int right_icon = 0x7f070062;
public static final int right_side = 0x7f070063;
public static final int tag_transition_group = 0x7f070083;
public static final int tag_unhandled_key_event_manager = 0x7f070084;
public static final int tag_unhandled_key_listeners = 0x7f070085;
public static final int text = 0x7f070086;
public static final int text2 = 0x7f070087;
public static final int time = 0x7f07008a;
public static final int title = 0x7f07008b;
}
public static final class integer {
public static final int status_bar_notification_info_maxnum = 0x7f080004;
}
public static final class layout {
public static final int notification_action = 0x7f09001d;
public static final int notification_action_tombstone = 0x7f09001e;
public static final int notification_template_custom_big = 0x7f09001f;
public static final int notification_template_icon_group = 0x7f090020;
public static final int notification_template_part_chronometer = 0x7f090021;
public static final int notification_template_part_time = 0x7f090022;
}
public static final class string {
public static final int status_bar_notification_info_overflow = 0x7f0b0029;
}
public static final class style {
public static final int TextAppearance_Compat_Notification = 0x7f0c00ec;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00ed;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ee;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00ef;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00f0;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0c0158;
public static final int Widget_Compat_NotificationActionText = 0x7f0c0159;
}
public static final class styleable {
public static final int[] ColorStateListItem = { 0x010101a5, 0x0101031f, 0x7f020027 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] FontFamily = { 0x7f02007c, 0x7f02007d, 0x7f02007e, 0x7f02007f, 0x7f020080, 0x7f020081 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x01010532, 0x01010533, 0x0101053f, 0x0101056f, 0x01010570, 0x7f02007a, 0x7f020082, 0x7f020083, 0x7f020084, 0x7f02013c };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x0101019d, 0x0101019e, 0x010101a1, 0x010101a2, 0x010101a3, 0x010101a4, 0x01010201, 0x0101020b, 0x01010510, 0x01010511, 0x01010512, 0x01010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x010101a5, 0x01010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"[email protected]"
] | |
6cf2c78f2e14e633eda979b73cecb4f739084e5e | 3181906569f945626897f4aa700138009b83fd78 | /src/main/java/com/example/demo/DemoApplication.java | d5cff8a2da8030c467a162ee24480f4536c77da9 | [] | no_license | chloer-nico/FullTextRetrieval2.0 | 8d54d27f0d52b9a0918c26d66fce34a3f4107d23 | 494768cad1fe6a25580740fd48cee2ffc38d09a7 | refs/heads/master | 2023-01-30T13:19:41.123047 | 2020-12-15T08:49:30 | 2020-12-15T08:49:30 | 321,604,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,796 | java | package com.example.demo;
import com.example.demo.config.Sysconfig;
import com.example.demo.lucene.LuceneDao;
import org.apache.lucene.document.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import java.util.List;
/**
* @author dhx
*/
@SpringBootApplication
@EnableConfigurationProperties({Sysconfig.class})
public class DemoApplication implements CommandLineRunner {
private final Sysconfig sysconfig;
private final LuceneDao luceneDao;
/**
* DemoApplication的构造函数
* */
public DemoApplication(@Autowired Sysconfig sysconfig,
@Autowired LuceneDao luceneDao){
this.sysconfig = sysconfig;
this.luceneDao = luceneDao;
}
public static void main(String[] args){
SpringApplication app = new SpringApplication(DemoApplication.class);
app.run(args);
}
@Override
public void run(String... args) throws Exception {
//构建索引
// luceneDao.indexDoc();
//搜索
List<Document> documentList=luceneDao.search("学院","学院");
System.out.println("共有数据"+documentList.size());
for(int i=0;i<documentList.size();i++){
System.out.println("第"+i+"条内容标题为————————————\n"+documentList.get(i).get("title"));
System.out.println("第"+i+"条内容内容为——————————\n"+documentList.get(i).get("contents"));
}
//关闭
luceneDao.destroy();
}
}
| [
"[email protected]"
] | |
e67d9ae9ddccc4e09424d57e228ea59869704df7 | a07b5f7029dd945c77069dd2f1b0fc11d84aa4a5 | /src/com/lesson2/calculator/Calculator.java | add04262addaa47e16dd38fbe46b888b32eaf4ec | [] | no_license | titanmet/startjava_test | ef9e7dcf38b90d9beae261d979e18c3b3458dd12 | 40040f914554dc9e4b7a074e3a6ac6a4584ec73c | refs/heads/master | 2023-06-01T11:14:29.448078 | 2021-06-17T18:43:59 | 2021-06-17T18:43:59 | 376,775,943 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,708 | java | package com.startjava.lesson2.calculator;
public class Calculator {
public double sum;
public int num1;
public char ch;
public int num2;
public String answer = "да";
public void setNum1(int num1) {
this.num1 = num1;
}
public void setCh(char ch) {
this.ch = ch;
}
public void setNum2(int num2) {
this.num2 = num2;
}
public String getAnswer() {
return answer;
}
public void setAnswer(String answer) {
this.answer = answer;
}
public void calc(){
switch (ch){
case ('+'):
sum = num1 + num2;
System.out.println(num1 + " + " + num2 + " = " + sum);
break;
case ('-'):
sum = num1 - num2;
System.out.println(num1 + " - " + num2 + " = " + sum);
break;
case ('*'):
sum = num1 * num2;
System.out.println(num1 + " * " + num2 + " = " + sum);
break;
case ('/'):
sum = num1 / num2;
System.out.println(num1 + " / " + num2 + " = " + sum);
break;
case ('^'):
sum = Math.pow(num1, num2);
System.out.println(num1 + " ^ " + num2 + " = " + sum);
break;
case ('%'):
sum = num1 % num2;
System.out.println(num1 + " % " + num2 + " = " + sum);
break;
default:
System.out.println("Not operation");
}
}
}
| [
"[email protected]"
] | |
4cfadee6822b283820e55d660e2f7bee9b7300eb | cbcc40b1acb557d0e025029dbfa85052caef831a | /src/main/java/com/altimetrik/brs/entity/Reservervation.java | ea4c9ebbbbdbd118d0c354fdf11c6b13ce07e293 | [] | no_license | mjkumar-rgda/BusReservationApp | 4f032cc1603e3ad1a2497c9785f3a43a67947669 | ec437990720453e536517d3e9db068a1cbf92b35 | refs/heads/master | 2022-12-05T17:18:24.540847 | 2020-08-29T12:59:34 | 2020-08-29T12:59:34 | 291,271,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,073 | java | package com.altimetrik.brs.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import lombok.Builder;
import lombok.Getter;
import lombok.ToString;
/**
* .
* @author: Manoj Kumar.
* @version: 1.0.
*/
@Getter
@Builder
@ToString
@Entity
public class Reservervation implements Serializable {
private static final long serialVersionUID = 8969328127927352690L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer reservationId;
@ManyToOne
@JoinColumn(nullable = false, name = "passingerId", updatable = true, insertable = true)
@ToString.Exclude
private Passinger passinger;
@ManyToOne
@JoinColumn(nullable = false, name = "busId", updatable = true, insertable = true)
@ToString.Exclude
private Bus bus;
private Date travelDate;
private Date dateOfBooking;
private String[] bookedSeats;
} // end of Bus entity | [
"[email protected]"
] | |
85a1909d64e951878de7ee8deabde82977812e35 | b6b4977560b197e9ff5b80e746581d714d4311bd | /PythonApi/app/src/main/java/com/seesmile/chat/pythonapi/base/BaseActivity.java | d9af996aff992494b0e1f9e3a5c6caab20c834d2 | [] | no_license | SeeSmile/SmileChat | cd9b765e60ac14c3e8122e13ded9fa04f1ab3dcf | 0af7a5c589fe0cf0a99a40554747a6b141bcfa75 | refs/heads/master | 2021-01-20T18:24:17.746161 | 2016-07-20T09:40:12 | 2016-07-20T09:40:12 | 63,326,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,018 | java | package com.seesmile.chat.pythonapi.base;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.AttributeSet;
import android.view.View;
import com.seesmile.chat.pythonapi.R;
import butterknife.ButterKnife;
/**
* Created by FuPei on 2016/7/15.
*/
public class BaseActivity extends AppCompatActivity {
@Override
public void setContentView(@LayoutRes int layoutResID) {
super.setContentView(layoutResID);
ButterKnife.inject(this);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initData();
initView();
}
@Override
protected void onStart() {
super.onStart();
initListener();
}
public void initListener() {
}
public void initData() {
}
public void initView() {
}
}
| [
"[email protected]"
] | |
663092637d33cf0044ad929bec5810e0234d0851 | 3cc0e129d2a3018c8ed21297b296b992f202919b | /src/ListIterator.java | 7b97c681c8dd8e5d44c4dc47c24600896ec0b99a | [] | no_license | shisannafiz/linkedlists | c640abdca5cc4671dcf8894f875176342d11d41d | 322d36a9cf9b57f8ce180395f98ac98b8c17614f | refs/heads/master | 2022-04-19T04:51:49.872883 | 2020-04-10T15:44:30 | 2020-04-10T15:44:30 | 254,671,945 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | public interface ListIterator<AnyType> {
public void add(AnyType newValue);
public void remove();
public boolean hasPrevious();
public boolean hasNext();
public AnyType previous();
public AnyType next();
}
| [
"[email protected]"
] | |
f2858d716e2672cb84475364b229af9325f4a7dd | 2efa8b58a8682aa731a765cd1db0b6b5a80edba2 | /src/main/java/com/thinkgem/jeesite/modules/oa/entity/Leave.java | fae3ec8f6d5ed24eab90deebd9fd9a942fc2efb0 | [
"Apache-2.0"
] | permissive | tangsiyi/jeesite-xf | da62699b59737c38709fa2e1b29a432cb7f567c5 | 3d5bf2c14e05f25c2d150f538aae0e909edd5b11 | refs/heads/master | 2022-12-23T04:02:09.849446 | 2019-10-20T12:50:29 | 2019-10-20T12:50:29 | 215,002,434 | 0 | 0 | Apache-2.0 | 2022-12-16T08:01:02 | 2019-10-14T09:29:50 | JavaScript | UTF-8 | Java | false | false | 3,866 | java | /**
* There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
*/
package com.thinkgem.jeesite.modules.oa.entity;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.validator.constraints.Length;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.thinkgem.jeesite.common.persistence.IdEntity;
import com.thinkgem.jeesite.modules.sys.utils.DictUtils;
/**
* 请假Entity
* @author liuj
* @version 2013-04-05
*/
@Entity
@Table(name = "oa_leave")
@DynamicInsert @DynamicUpdate
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Leave extends IdEntity<Leave> {
private static final long serialVersionUID = 1L;
private String reason; // 请假原因
private String processInstanceId; // 流程实例编号
private Date startTime; // 请假开始日期
private Date endTime; // 请假结束日期
private Date realityStartTime; // 实际开始时间
private Date realityEndTime; // 实际结束时间
private String leaveType; // 假种
private String processStatus; //流程状态
private boolean pass;
private boolean audit;
private String auditRemarks;
public Leave() {
super();
}
public Leave(String id){
this();
this.id = id;
}
public String getLeaveType() {
return leaveType;
}
public void setLeaveType(String leaveType) {
this.leaveType = leaveType;
}
@Transient
public String getLeaveTypeDictLabel() {
return DictUtils.getDictLabel(leaveType, "oa_leave_type", "");
}
@Length(min=1, max=255)
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
@Temporal(TemporalType.TIMESTAMP)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
@Temporal(TemporalType.TIMESTAMP)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
@Temporal(TemporalType.TIMESTAMP)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
public Date getRealityStartTime() {
return realityStartTime;
}
public void setRealityStartTime(Date realityStartTime) {
this.realityStartTime = realityStartTime;
}
@Temporal(TemporalType.TIMESTAMP)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
public Date getRealityEndTime() {
return realityEndTime;
}
public void setRealityEndTime(Date realityEndTime) {
this.realityEndTime = realityEndTime;
}
public String getProcessStatus() {
return processStatus;
}
public void setProcessStatus(String processStatus) {
this.processStatus = processStatus;
}
@Transient
public boolean isPass() {
return pass;
}
@Transient
public void setPass(boolean pass) {
this.pass = pass;
}
@Transient
public String getAuditRemarks() {
return auditRemarks;
}
@Transient
public void setAuditRemarks(String auditRemarks) {
this.auditRemarks = auditRemarks;
}
@Transient
public boolean isAudit() {
return audit;
}
@Transient
public void setAudit(boolean audit) {
this.audit = audit;
}
}
| [
"[email protected]"
] | |
1cdb9cf1e29241be32e08ba636dd918b485433a4 | b3c6241c31f563c06ff1b0881652d1f800e2b332 | /cdm/src/test/java/thredds/catalog2/xml/parser/stax/GeospatialRangeTypeParserTest.java | 6fad8e323e61a0c1194b9fed96d3eb4fc58f1a89 | [
"NetCDF"
] | permissive | feihugis/thredds-target-4.3.23 | f56346a42ab398467761a9f5d5a27a2a1a5854bd | 5d853cac7529dc742208cc23addf78522dbace58 | refs/heads/master | 2021-03-16T10:06:15.407497 | 2017-11-07T06:27:38 | 2017-11-07T06:27:38 | 50,969,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,257 | java | package thredds.catalog2.xml.parser.stax;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLEventReader;
import javax.xml.namespace.QName;
import thredds.catalog2.xml.parser.ThreddsXmlParserException;
import thredds.catalog2.xml.names.ThreddsMetadataElementNames;
import thredds.catalog2.xml.names.CatalogNamespaceUtils;
import thredds.catalog2.builder.ThreddsBuilderFactory;
import thredds.catalog2.builder.ThreddsMetadataBuilder;
import thredds.catalog2.simpleImpl.ThreddsBuilderFactoryImpl;
/**
* Test the thredds.catalog2.xml.parser.stax.GeospatialRangeTypeParser in isolation.
*
* @author edavis
* @since 4.0
*/
public class GeospatialRangeTypeParserTest
{
private ThreddsBuilderFactory fac;
private ThreddsMetadataBuilder.GeospatialCoverageBuilder gspCovBldr;
private String rootDocBaseUri;
private String startElementName;
private String sizeElementName;
private String resolutionElementName;
private String unitsElementName;
@Before
public void createMockObjects()
{
this.fac = new ThreddsBuilderFactoryImpl();
this.gspCovBldr = this.fac.newThreddsMetadataBuilder().getGeospatialCoverageBuilder();
this.rootDocBaseUri = "http://test/thredds/catalog2/xml/parser/stax/GeospatialRangeTypeParserTest/";
this.startElementName = ThreddsMetadataElementNames.SpatialRangeType_Start.getLocalPart();
this.sizeElementName = ThreddsMetadataElementNames.SpatialRangeType_Size.getLocalPart();
this.resolutionElementName = ThreddsMetadataElementNames.SpatialRangeType_Resolution.getLocalPart();
this.unitsElementName = ThreddsMetadataElementNames.SpatialRangeType_Units.getLocalPart();
}
// ToDo Need to implement GeospatialRangeTypeParser before this test will work.
//@Test
public void checkFullySpecifiedGeospatialRangeType() throws XMLStreamException, ThreddsXmlParserException
{
String docBaseUri = this.rootDocBaseUri + "checkFullySpecifiedGeospatialRangeType.test";
String elementName = "someElemOfTypeGeospatialRange";
String start = "-55.5";
String size = "23.0";
String resolution = "0.5";
String units = "degrees_east";
String xml = buildGeospatialRangeTypeElementAsDocRoot( elementName, start, size, resolution, units );
assertGeospatialRangeTypeXmlAsExpected( xml, docBaseUri, elementName, start, size, resolution, units );
}
private String buildGeospatialRangeTypeElementAsDocRoot( String elementName, String start, String size,
String resolution, String units )
{
StringBuilder sb = new StringBuilder();
if ( start != null )
sb.append( buildGeospatialRangeTypeStartElement( start ));
if ( size != null )
sb.append( " <size>" ).append( size ).append( "</size>\n" );
if ( resolution != null )
sb.append( " <resolution>" ).append( resolution ).append( "</resolution>\n" );
if ( units != null )
sb.append( " <units>" ).append( units ).append( "</units>\n" );
return StaxParserTestUtils.wrapContentXmlInXmlDocRootElement( elementName, null, sb.toString() );
}
private String buildGeospatialRangeTypeStartElement( String start )
{
StringBuilder sb = new StringBuilder().append( "<" ).append( this.startElementName).append( ">" )
.append( start ).append( "</").append( this.startElementName).append(">\n" );
return sb.toString();
}
private String buildGeospatialRangeTypeSizeElement( String size )
{
StringBuilder sb = new StringBuilder().append( "<" ).append( this.sizeElementName).append( ">" )
.append( size ).append( "</").append( this.sizeElementName).append(">\n" );
return sb.toString();
}
private String buildGeospatialRangeTypeResolutionElement( String resolution )
{
StringBuilder sb = new StringBuilder().append( "<" ).append( this.resolutionElementName).append( ">" )
.append( resolution ).append( "</").append( this.resolutionElementName).append(">\n" );
return sb.toString();
}
private String buildGeospatialRangeTypeUnitsElement( String units )
{
StringBuilder sb = new StringBuilder().append( "<" ).append( this.unitsElementName).append( ">" )
.append( units ).append( "</").append( this.unitsElementName).append(">\n" );
return sb.toString();
}
private void assertGeospatialRangeTypeXmlAsExpected( String docXml, String docBaseUri,
String expectedRootElementName,
String expectedStart, String expectedSize,
String expectedResolution, String expectedUnits )
throws XMLStreamException, ThreddsXmlParserException
{
XMLEventReader reader = StaxParserTestUtils.createXmlEventReaderOnXmlString( docXml, docBaseUri );
StaxParserTestUtils.advanceReaderToFirstStartElement( reader );
QName rootElemQName = CatalogNamespaceUtils.getThreddsCatalogElementQualifiedName( expectedRootElementName );
GeospatialRangeTypeParser.Factory factory = new GeospatialRangeTypeParser.Factory( rootElemQName );
assertNotNull( factory);
assertTrue( factory.isEventMyStartElement( reader.peek() ));
GeospatialRangeTypeParser parser = factory.getNewParser( reader, this.fac, this.gspCovBldr );
assertNotNull( parser);
ThreddsMetadataBuilder.GeospatialRangeBuilder bldr = (ThreddsMetadataBuilder.GeospatialRangeBuilder) parser.parse();
assertNotNull( bldr );
//
// assertTrue( bldr instanceof ThreddsMetadataBuilder.DateRangeBuilder );
// ThreddsMetadataBuilder.DateRangeBuilder tmBldr = (ThreddsMetadataBuilder.DateRangeBuilder) bldr;
//
// assertEquals( startDate, tmBldr.getStartDate());
// assertNull( tmBldr.getStartDateFormat());
// assertEquals( endDate, tmBldr.getEndDate());
// assertNull( tmBldr.getEndDateFormat() );
// assertEquals( duration, tmBldr.getDuration() );
// assertEquals( resolution, tmBldr.getResolution() );
}
} | [
"[email protected]"
] | |
0d0aa5650a87fc55be50b6f2b7881b1ff0960caa | bca0bf5c2f40d3d92dcb28d8699ebf648d61e8d2 | /games-obstacle/core/src/com/obstacleavoid/screen/game/GameRenderer.java | 36124d973bfc8ebbfb7bf73df6aab29402bd718c | [] | no_license | nvg/android | 8d2ebd462d4950bb35337f3e0524843dcfdb7d63 | ec911402cad361041ae661f6beec8a8463cd40f5 | refs/heads/master | 2022-07-23T17:51:01.219944 | 2020-05-18T20:05:50 | 2020-05-18T20:05:50 | 254,755,654 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,455 | java | package com.obstacleavoid.screen.game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.obstacleavoid.assets.AssetDescriptors;
import com.obstacleavoid.assets.RegionNames;
import com.obstacleavoid.config.GameConfig;
import com.obstacleavoid.entity.Background;
import com.obstacleavoid.entity.Obstacle;
import com.obstacleavoid.entity.Player;
import com.obstacleavoid.util.GdxUtils;
import com.obstacleavoid.util.ViewportUtils;
import com.obstacleavoid.util.debug.DebugCameraController;
public class GameRenderer implements Disposable {
// == attributes ==
private OrthographicCamera camera;
private Viewport viewport;
private ShapeRenderer renderer;
private OrthographicCamera hudCamera;
private Viewport hudViewport;
private BitmapFont font;
private final GlyphLayout layout = new GlyphLayout();
private DebugCameraController debugCameraController;
private final GameController controller;
private final AssetManager assetManager;
private final SpriteBatch batch;
private TextureRegion playerRegion;
private TextureRegion obstacleRegion;
private TextureRegion backgroundRegion;
// == constructors ==
public GameRenderer(SpriteBatch batch, AssetManager assetManager, GameController controller) {
this.batch = batch;
this.assetManager = assetManager;
this.controller = controller;
init();
}
// == init ==
private void init() {
camera = new OrthographicCamera();
viewport = new FitViewport(GameConfig.WORLD_WIDTH, GameConfig.WORLD_HEIGHT, camera);
renderer = new ShapeRenderer();
hudCamera = new OrthographicCamera();
hudViewport = new FitViewport(GameConfig.HUD_WIDTH, GameConfig.HUD_HEIGHT, hudCamera);
font = assetManager.get(AssetDescriptors.FONT);
// create debug camera controller
debugCameraController = new DebugCameraController();
debugCameraController.setStartPosition(GameConfig.WORLD_CENTER_X, GameConfig.WORLD_CENTER_Y);
TextureAtlas gamePlayAtlas = assetManager.get(AssetDescriptors.GAME_PLAY);
playerRegion = gamePlayAtlas.findRegion(RegionNames.PLAYER);
obstacleRegion = gamePlayAtlas.findRegion(RegionNames.OBSTACLE);
backgroundRegion = gamePlayAtlas.findRegion(RegionNames.BACKGROUND);
}
// == public methods ==
public void render(float delta) {
// not wrapping inside alive cuz we want to be able to control camera even when there is game over
debugCameraController.handleDebugInput(delta);
debugCameraController.applyTo(camera);
if(Gdx.input.isTouched() && !controller.isGameOver()) {
Vector2 screenTouch = new Vector2(Gdx.input.getX(), Gdx.input.getY());
Vector2 worldTouch = viewport.unproject(new Vector2(screenTouch));
System.out.println("screenTouch= " + screenTouch);
System.out.println("worldTouch= " + worldTouch);
Player player = controller.getPlayer();
worldTouch.x = MathUtils.clamp(worldTouch.x, 0, GameConfig.WORLD_WIDTH - player.getWidth());
player.setX(worldTouch.x);
}
// clear screen
GdxUtils.clearScreen();
renderGamePlay();
// render ui/hud
renderUi();
// render debug graphics
renderDebug();
}
public void resize(int width, int height) {
viewport.update(width, height, true);
hudViewport.update(width, height, true);
ViewportUtils.debugPixelPerUnit(viewport);
}
@Override
public void dispose() {
renderer.dispose();
}
// == private methods ==
private void renderGamePlay() {
viewport.apply();
batch.setProjectionMatrix(camera.combined);
batch.begin();
// draw background
Background background = controller.getBackground();
batch.draw(backgroundRegion,
background.getX(), background.getY(),
background.getWidth(), background.getHeight()
);
// draw player
Player player = controller.getPlayer();
batch.draw(playerRegion,
player.getX(), player.getY(),
player.getWidth(), player.getHeight()
);
// draw obstacles
for (Obstacle obstacle : controller.getObstacles()) {
batch.draw(obstacleRegion,
obstacle.getX(), obstacle.getY(),
obstacle.getWidth(), obstacle.getHeight()
);
}
batch.end();
}
private void renderUi() {
hudViewport.apply();
batch.setProjectionMatrix(hudCamera.combined);
batch.begin();
String livesText = "LIVES: " + controller.getLives();
layout.setText(font, livesText);
font.draw(batch, livesText,
20,
GameConfig.HUD_HEIGHT - layout.height
);
String scoreText = "SCORE: " + controller.getDisplayScore();
layout.setText(font, scoreText);
font.draw(batch, scoreText,
GameConfig.HUD_WIDTH - layout.width - 20,
GameConfig.HUD_HEIGHT - layout.height
);
batch.end();
}
private void renderDebug() {
viewport.apply();
renderer.setProjectionMatrix(camera.combined);
renderer.begin(ShapeRenderer.ShapeType.Line);
drawDebug();
renderer.end();
ViewportUtils.drawGrid(viewport, renderer);
}
private void drawDebug() {
Player player = controller.getPlayer();
player.drawDebug(renderer);
Array<Obstacle> obstacles = controller.getObstacles();
for (Obstacle obstacle : obstacles) {
obstacle.drawDebug(renderer);
}
}
}
| [
"[email protected]"
] | |
655401c654cc27fb5975248fbfe03115167a37b0 | 1930db0b5515570c0364e3e069661fdc4496fa74 | /Interface/src/Sample.java | 355702761ffe98a665e8bd1d2b438ebd0d12a6d2 | [] | no_license | MANUCHANDRAN94/java_study | 287e7167a2e74fa8ef6758df13e36c5db33f6ea2 | 016575e70b91107254e4981deb5f0c4c9460c63c | refs/heads/master | 2022-07-12T11:02:58.050755 | 2020-05-15T09:25:19 | 2020-05-15T09:25:19 | 264,151,264 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | java |
public class Sample implements Hello
{
public void Ontext(String text)
{
System.out.println("3constructor");
System.out.println(text);
System.out.println("4constructor");
}
Sample()
{
TextScanner t=new TextScanner(this);
System.out.println("Sample constructor");
t.scan();
}
public static void main(String[] args)
{
Sample s=new Sample();
}
}
| [
"[email protected]"
] | |
9e34cb87abcfde8f69fce2c5d991d5e8f9ae9a27 | bfd60fe949807d6a70a07a09b897ad9f0187f671 | /src/main/java/org/jsapar/compose/cell/package-info.java | bf8491c31640afb1daf526693338ccba09d62bc9 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | org-tigris-jsapar/jsapar | ad221d7748bad42c708052e995dde596cd6a67e3 | 0113c8d3dcb821438a4eb065080ab8c506105610 | refs/heads/master | 2023-08-21T21:26:47.813228 | 2023-08-03T08:25:48 | 2023-08-03T08:25:48 | 102,112,317 | 13 | 4 | Apache-2.0 | 2020-10-13T12:41:24 | 2017-09-01T12:51:18 | Java | UTF-8 | Java | false | false | 113 | java | /**
Internal classes for composing {@link org.jsapar.model.Cell} instances.
*/
package org.jsapar.compose.cell; | [
"[email protected]"
] | |
33d57fb776ff2df60a5613fc706e04259710262b | 1e8673f3e5277b63bfc419078f06ae9454fa2f5d | /InterfaceSpringBoot/src/main/java/app/Application.java | 6867998605b3cfadb026cdf6bc69f53519fb9a5e | [] | no_license | reyinever/interfaceAutoTest | 50e775d848e45e3dc7b0c45f58eeae32185d5833 | 47101f2785de3c5d424f18011338b9f0c1bcb139 | refs/heads/master | 2022-07-08T18:37:10.655627 | 2019-07-31T08:18:40 | 2019-07-31T08:18:40 | 139,323,764 | 0 | 0 | null | 2022-06-21T01:32:34 | 2018-07-01T11:32:57 | Java | UTF-8 | Java | false | false | 420 | java | package app;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan("com.tester") //托管的包
public class Application {
//程序的入口
public static void main(String[] args){
SpringApplication.run(Application.class,args);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.