blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
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
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8b4701a5bedc01793e4b5d1e56d589b57b8f0efa | eaeafaf85c157d10dcdfb68f7c299bf4195800de | /org.xtext.example.mydsl/org.xtext.example.mydsl/src-gen/org/xtext/example/mydsl/myDsl/impl/Class_declarationImpl.java | 29d51e71d4076579b1b155092f28770de044dd56 | []
| no_license | luciojp/ProjetoCompila | 77af78eb5adf2475fed93d403f9bb0b605f15fbf | afa99659eacef55bd31b060a6ee2b24c3743f2c7 | refs/heads/master | 2021-01-01T18:57:25.285168 | 2017-07-26T22:18:07 | 2017-07-26T22:18:07 | 98,470,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,903 | java | /**
*/
package org.xtext.example.mydsl.myDsl.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EDataTypeEList;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.xtext.example.mydsl.myDsl.Class_declaration;
import org.xtext.example.mydsl.myDsl.Field_declaration;
import org.xtext.example.mydsl.myDsl.MyDslPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Class declaration</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.xtext.example.mydsl.myDsl.impl.Class_declarationImpl#getModifiers <em>Modifiers</em>}</li>
* <li>{@link org.xtext.example.mydsl.myDsl.impl.Class_declarationImpl#getClassName <em>Class Name</em>}</li>
* <li>{@link org.xtext.example.mydsl.myDsl.impl.Class_declarationImpl#getClassHerdada <em>Class Herdada</em>}</li>
* <li>{@link org.xtext.example.mydsl.myDsl.impl.Class_declarationImpl#getInterfaceImplementada <em>Interface Implementada</em>}</li>
* <li>{@link org.xtext.example.mydsl.myDsl.impl.Class_declarationImpl#getInterfacesImplementadas <em>Interfaces Implementadas</em>}</li>
* <li>{@link org.xtext.example.mydsl.myDsl.impl.Class_declarationImpl#getFieldsDeclaration <em>Fields Declaration</em>}</li>
* </ul>
*
* @generated
*/
public class Class_declarationImpl extends MinimalEObjectImpl.Container implements Class_declaration
{
/**
* The cached value of the '{@link #getModifiers() <em>Modifiers</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getModifiers()
* @generated
* @ordered
*/
protected EList<String> modifiers;
/**
* The default value of the '{@link #getClassName() <em>Class Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getClassName()
* @generated
* @ordered
*/
protected static final String CLASS_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getClassName() <em>Class Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getClassName()
* @generated
* @ordered
*/
protected String className = CLASS_NAME_EDEFAULT;
/**
* The default value of the '{@link #getClassHerdada() <em>Class Herdada</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getClassHerdada()
* @generated
* @ordered
*/
protected static final String CLASS_HERDADA_EDEFAULT = null;
/**
* The cached value of the '{@link #getClassHerdada() <em>Class Herdada</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getClassHerdada()
* @generated
* @ordered
*/
protected String classHerdada = CLASS_HERDADA_EDEFAULT;
/**
* The default value of the '{@link #getInterfaceImplementada() <em>Interface Implementada</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInterfaceImplementada()
* @generated
* @ordered
*/
protected static final String INTERFACE_IMPLEMENTADA_EDEFAULT = null;
/**
* The cached value of the '{@link #getInterfaceImplementada() <em>Interface Implementada</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInterfaceImplementada()
* @generated
* @ordered
*/
protected String interfaceImplementada = INTERFACE_IMPLEMENTADA_EDEFAULT;
/**
* The cached value of the '{@link #getInterfacesImplementadas() <em>Interfaces Implementadas</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInterfacesImplementadas()
* @generated
* @ordered
*/
protected EList<String> interfacesImplementadas;
/**
* The cached value of the '{@link #getFieldsDeclaration() <em>Fields Declaration</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFieldsDeclaration()
* @generated
* @ordered
*/
protected EList<Field_declaration> fieldsDeclaration;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Class_declarationImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return MyDslPackage.Literals.CLASS_DECLARATION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<String> getModifiers()
{
if (modifiers == null)
{
modifiers = new EDataTypeEList<String>(String.class, this, MyDslPackage.CLASS_DECLARATION__MODIFIERS);
}
return modifiers;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getClassName()
{
return className;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setClassName(String newClassName)
{
String oldClassName = className;
className = newClassName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.CLASS_DECLARATION__CLASS_NAME, oldClassName, className));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getClassHerdada()
{
return classHerdada;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setClassHerdada(String newClassHerdada)
{
String oldClassHerdada = classHerdada;
classHerdada = newClassHerdada;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.CLASS_DECLARATION__CLASS_HERDADA, oldClassHerdada, classHerdada));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getInterfaceImplementada()
{
return interfaceImplementada;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setInterfaceImplementada(String newInterfaceImplementada)
{
String oldInterfaceImplementada = interfaceImplementada;
interfaceImplementada = newInterfaceImplementada;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.CLASS_DECLARATION__INTERFACE_IMPLEMENTADA, oldInterfaceImplementada, interfaceImplementada));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<String> getInterfacesImplementadas()
{
if (interfacesImplementadas == null)
{
interfacesImplementadas = new EDataTypeEList<String>(String.class, this, MyDslPackage.CLASS_DECLARATION__INTERFACES_IMPLEMENTADAS);
}
return interfacesImplementadas;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Field_declaration> getFieldsDeclaration()
{
if (fieldsDeclaration == null)
{
fieldsDeclaration = new EObjectContainmentEList<Field_declaration>(Field_declaration.class, this, MyDslPackage.CLASS_DECLARATION__FIELDS_DECLARATION);
}
return fieldsDeclaration;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case MyDslPackage.CLASS_DECLARATION__FIELDS_DECLARATION:
return ((InternalEList<?>)getFieldsDeclaration()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case MyDslPackage.CLASS_DECLARATION__MODIFIERS:
return getModifiers();
case MyDslPackage.CLASS_DECLARATION__CLASS_NAME:
return getClassName();
case MyDslPackage.CLASS_DECLARATION__CLASS_HERDADA:
return getClassHerdada();
case MyDslPackage.CLASS_DECLARATION__INTERFACE_IMPLEMENTADA:
return getInterfaceImplementada();
case MyDslPackage.CLASS_DECLARATION__INTERFACES_IMPLEMENTADAS:
return getInterfacesImplementadas();
case MyDslPackage.CLASS_DECLARATION__FIELDS_DECLARATION:
return getFieldsDeclaration();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case MyDslPackage.CLASS_DECLARATION__MODIFIERS:
getModifiers().clear();
getModifiers().addAll((Collection<? extends String>)newValue);
return;
case MyDslPackage.CLASS_DECLARATION__CLASS_NAME:
setClassName((String)newValue);
return;
case MyDslPackage.CLASS_DECLARATION__CLASS_HERDADA:
setClassHerdada((String)newValue);
return;
case MyDslPackage.CLASS_DECLARATION__INTERFACE_IMPLEMENTADA:
setInterfaceImplementada((String)newValue);
return;
case MyDslPackage.CLASS_DECLARATION__INTERFACES_IMPLEMENTADAS:
getInterfacesImplementadas().clear();
getInterfacesImplementadas().addAll((Collection<? extends String>)newValue);
return;
case MyDslPackage.CLASS_DECLARATION__FIELDS_DECLARATION:
getFieldsDeclaration().clear();
getFieldsDeclaration().addAll((Collection<? extends Field_declaration>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case MyDslPackage.CLASS_DECLARATION__MODIFIERS:
getModifiers().clear();
return;
case MyDslPackage.CLASS_DECLARATION__CLASS_NAME:
setClassName(CLASS_NAME_EDEFAULT);
return;
case MyDslPackage.CLASS_DECLARATION__CLASS_HERDADA:
setClassHerdada(CLASS_HERDADA_EDEFAULT);
return;
case MyDslPackage.CLASS_DECLARATION__INTERFACE_IMPLEMENTADA:
setInterfaceImplementada(INTERFACE_IMPLEMENTADA_EDEFAULT);
return;
case MyDslPackage.CLASS_DECLARATION__INTERFACES_IMPLEMENTADAS:
getInterfacesImplementadas().clear();
return;
case MyDslPackage.CLASS_DECLARATION__FIELDS_DECLARATION:
getFieldsDeclaration().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case MyDslPackage.CLASS_DECLARATION__MODIFIERS:
return modifiers != null && !modifiers.isEmpty();
case MyDslPackage.CLASS_DECLARATION__CLASS_NAME:
return CLASS_NAME_EDEFAULT == null ? className != null : !CLASS_NAME_EDEFAULT.equals(className);
case MyDslPackage.CLASS_DECLARATION__CLASS_HERDADA:
return CLASS_HERDADA_EDEFAULT == null ? classHerdada != null : !CLASS_HERDADA_EDEFAULT.equals(classHerdada);
case MyDslPackage.CLASS_DECLARATION__INTERFACE_IMPLEMENTADA:
return INTERFACE_IMPLEMENTADA_EDEFAULT == null ? interfaceImplementada != null : !INTERFACE_IMPLEMENTADA_EDEFAULT.equals(interfaceImplementada);
case MyDslPackage.CLASS_DECLARATION__INTERFACES_IMPLEMENTADAS:
return interfacesImplementadas != null && !interfacesImplementadas.isEmpty();
case MyDslPackage.CLASS_DECLARATION__FIELDS_DECLARATION:
return fieldsDeclaration != null && !fieldsDeclaration.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (modifiers: ");
result.append(modifiers);
result.append(", className: ");
result.append(className);
result.append(", classHerdada: ");
result.append(classHerdada);
result.append(", interfaceImplementada: ");
result.append(interfaceImplementada);
result.append(", interfacesImplementadas: ");
result.append(interfacesImplementadas);
result.append(')');
return result.toString();
}
} //Class_declarationImpl
| [
"[email protected]"
]
| |
c8d2b37a902094814532b4de502a4edc348cb6a9 | 0b2e83d955a7f192ea4b764762d7203bd58c4c30 | /Bugzilla/src/org/elsys/utilities/Utilities.java | 3eb79b28d9b4dddbb01b48b59adcf46d41602137 | []
| no_license | wang663632304/Bugzilla | c2160a996729cf26ecd6e4ca19c14279501b9074 | fb8033d503ec11768f4b53763a4cf0ae600055a9 | refs/heads/master | 2021-01-18T10:59:14.025526 | 2011-12-14T22:03:31 | 2011-12-14T22:03:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,804 | java | package org.elsys.utilities;
import java.util.ArrayList;
import java.util.HashMap;
import org.elsys.R;
import org.elsys.data.Account;
import android.content.Context;
import android.widget.ListView;
import android.widget.SimpleAdapter;
public class Utilities {
private final static String mySettingsListKey = "accounts_list_key";
private final static String mySettingsListValue = "accounts_list_value";
public final static String CURRENT_ACCOUNT = "currentAccount";
public final static String ACCOUNT_EMAIL = "accountEmail";
public final static String ACCOUNT_PASSWORD = "accountPassword";
public final static String ACCOUNT_DESCRIPTION = "accountDescription";
public final static String ACCOUNT_URL = "accountUrl";
public final static String CURRENT_ACCOUNT_EMAIL = "userEmail";
public final static String CURRENT_ACCOUNT_PASSWORD = "userPassword";
public final static String CURRENT_ACCOUNT_URL = "accountUrl";
public final static String CURRENT_ACCOUNT_DESCRIPTION = "accountDescription";
public final static String CURRENT_ACCOUNT_ID = "accountId";
public static void updateListView(ListView list, Context context,
ArrayList<Account> data) {
ArrayList<HashMap<String, String>> listHash = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map;
for(int i=0;i<data.size();i++) {
map = new HashMap<String, String>();
map.put(mySettingsListKey, data.get(i).getAccountDescription());
map.put(mySettingsListValue, data.get(i).getUserEmail());
listHash.add(map);
}
SimpleAdapter mSchedule = new SimpleAdapter(context, listHash,
R.layout.accounts_list_layout, new String[] {
mySettingsListKey, mySettingsListValue },
new int[] { R.id.accounts_list_key,
R.id.accounts_list_value });
list.setAdapter(mSchedule);
}
}
| [
"[email protected]"
]
| |
97628957fe56a2efaf5c77223765675b82cb7a20 | a4a51084cfb715c7076c810520542af38a854868 | /src/main/java/com/tencent/liteav/audio/impl/Play/d.java | 6a7edda7955c4aa067b5885a8baac11f711af899 | []
| no_license | BharathPalanivelu/repotest | ddaf56a94eb52867408e0e769f35bef2d815da72 | f78ae38738d2ba6c9b9b4049f3092188fabb5b59 | refs/heads/master | 2020-09-30T18:55:04.802341 | 2019-12-02T10:52:08 | 2019-12-02T10:52:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,307 | java | package com.tencent.liteav.audio.impl.Play;
import android.content.Context;
import android.media.AudioTrack;
import com.tencent.liteav.basic.log.TXCLog;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
public class d {
/* renamed from: a reason: collision with root package name */
static d f31142a = new d();
/* access modifiers changed from: private */
/* renamed from: b reason: collision with root package name */
public static final String f31143b = ("AudioCenter:" + d.class.getSimpleName());
/* renamed from: c reason: collision with root package name */
private a f31144c;
/* access modifiers changed from: private */
/* renamed from: d reason: collision with root package name */
public boolean f31145d = false;
/* renamed from: e reason: collision with root package name */
private volatile boolean f31146e = false;
/* access modifiers changed from: private */
/* renamed from: f reason: collision with root package name */
public Context f31147f = null;
/* access modifiers changed from: private */
/* renamed from: g reason: collision with root package name */
public int f31148g = 0;
/* access modifiers changed from: private */
public volatile boolean h = false;
/* access modifiers changed from: private */
public int i = 48000;
/* access modifiers changed from: private */
public int j = 2;
/* access modifiers changed from: private */
public int k = 16;
class a extends Thread {
/* renamed from: b reason: collision with root package name */
volatile boolean f31150b = false;
public a(String str) {
super(str);
}
public void a() {
this.f31150b = true;
}
public void b() {
this.f31150b = false;
}
}
private d() {
}
public static d a() {
return f31142a;
}
public void b() {
TXCLog.w(f31143b, "mult-track-player start!");
if (this.f31146e) {
TXCLog.e(f31143b, "mult-track-player can not start because of has started!");
} else if (this.i == 0 || this.j == 0) {
String str = f31143b;
TXCLog.e(str, "strat mult-track-player failed with invalid audio info , samplerate:" + this.i + ", channels:" + this.j);
} else {
this.f31146e = true;
if (this.f31144c == null) {
this.f31144c = new a("AUDIO_TRACK") {
public void run() {
a();
try {
int i = d.this.j == 1 ? 2 : 3;
int i2 = d.this.k == 8 ? 3 : 2;
AudioTrack audioTrack = new AudioTrack(3, d.this.i, i, i2, AudioTrack.getMinBufferSize(d.this.i, i, i2), 1);
String e2 = d.f31143b;
TXCLog.i(e2, "create audio track, samplerate:" + d.this.i + ", channels:" + d.this.j + ", bits:" + d.this.k);
try {
audioTrack.play();
boolean unused = d.this.h = true;
d dVar = d.this;
dVar.a(dVar.f31147f, d.this.f31148g);
int i3 = 100;
int i4 = 0;
while (this.f31150b) {
byte[] nativeGetMixedTracksData = b.nativeGetMixedTracksData(d.this.j * 2048);
TXCAudioBasePlayController.onCorePlayPcmData(nativeGetMixedTracksData, 0, d.this.i, d.this.j);
if (nativeGetMixedTracksData == null || nativeGetMixedTracksData.length <= 0) {
try {
sleep(5);
} catch (InterruptedException unused2) {
}
} else {
if (d.this.f31145d) {
Arrays.fill(nativeGetMixedTracksData, (byte) 0);
}
if (i3 != 0 && i4 < 800) {
short[] sArr = new short[(nativeGetMixedTracksData.length / 2)];
ByteBuffer.wrap(nativeGetMixedTracksData).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer().get(sArr);
for (int i5 = 0; i5 < sArr.length; i5++) {
sArr[i5] = (short) (sArr[i5] / i3);
}
ByteBuffer.wrap(nativeGetMixedTracksData).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer().put(sArr);
i4 += nativeGetMixedTracksData.length / ((d.this.i * 2) / 1000);
i3 = (i3 * (800 - i4)) / 800;
}
audioTrack.write(nativeGetMixedTracksData, 0, nativeGetMixedTracksData.length);
}
}
try {
audioTrack.pause();
audioTrack.flush();
audioTrack.stop();
audioTrack.release();
} catch (Exception e3) {
e3.printStackTrace();
}
TXCLog.e(d.f31143b, "mult-player thread stop finish!");
} catch (Exception e4) {
e4.printStackTrace();
}
} catch (Exception e5) {
e5.printStackTrace();
}
}
};
this.f31144c.start();
}
TXCLog.w(f31143b, "mult-track-player thread start finish!");
}
}
public void c() {
TXCLog.w(f31143b, "mult-track-player stop!");
if (!this.f31146e) {
TXCLog.w(f31143b, "mult-track-player can not stop because of not started yet!");
return;
}
a aVar = this.f31144c;
if (aVar != null) {
aVar.b();
this.f31144c = null;
}
this.f31148g = 0;
this.f31147f = null;
this.h = false;
this.f31146e = false;
TXCLog.w(f31143b, "mult-track-player stop finish!");
}
public synchronized void a(Context context, int i2) {
this.f31147f = context;
this.f31148g = i2;
if (this.h) {
TXCLog.w(f31143b, "mult-track-player setAudioRoute~");
com.tencent.liteav.audio.impl.a.a().b(i2);
} else {
TXCLog.w(f31143b, "mult-track-player do'not setAudioRoute~");
}
}
public boolean d() {
return this.f31146e;
}
}
| [
"[email protected]"
]
| |
2ebef4047c9b4982c316c3dd723cde64e8ac03d3 | b79ddee0d72bbc4a03bdf48e6015199b10ab5da0 | /cloud-provider-payment8004/src/main/java/com/vi/springcloud/PaymentMain8004.java | 3292be07594af706a03daec4e58937b6f80ed86c | []
| no_license | coVdiing/springcloud_learn | 856db10555ba0cc9eb8e4b000540a50c4f81b78b | 083eff3abd9dc3ec3d9e68c9939c373c5d052e96 | refs/heads/master | 2022-12-21T05:07:05.553144 | 2020-09-28T08:19:10 | 2020-09-28T08:19:10 | 295,611,238 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package com.vi.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@EnableDiscoveryClient
public class PaymentMain8004 {
public static void main(String[] args) {
SpringApplication.run(PaymentMain8004.class, args);
}
}
| [
"[email protected]"
]
| |
82b9c0f774de812b00754fb0e78f5f2d2b9a3642 | ab1307a41c400b0ae580dae33352a3fcb74a5f37 | /Triportal/src/main/java/edu/purdue/cs/util/ui/SystemUiHider.java | eb2cba135dfa2d06214d7e1254d85ec099f90e7e | []
| no_license | Shilpika/triportal | 8d3b75f16f146e3c6e6e972aa21ca493b148939c | e67e4cc3b3b024e3f660b480b6d56a728ce9d0ae | refs/heads/master | 2020-04-11T15:55:28.385918 | 2016-04-29T04:34:45 | 2016-04-29T04:34:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,843 | java | package edu.purdue.cs.util.ui;
import android.app.Activity;
import android.os.Build;
import android.view.View;
/**
* A utility class that helps with showing and hiding system UI such as the
* status bar and navigation/system bar. This class uses backward-compatibility
* techniques described in <a href=
* "http://developer.android.com/training/backward-compatible-ui/index.html">
* Creating Backward-Compatible UIs</a> to ensure that devices running any
* version of Android OS are supported. More specifically, there are separate
* implementations of this abstract class: for newer devices,
* {@link #getInstance} will return a {@link SystemUiHiderHoneycomb} instance,
* while on older devices {@link #getInstance} will return a
* {@link SystemUiHiderBase} instance.
* <p/>
* For more on system bars, see <a href=
* "http://developer.android.com/design/get-started/ui-overview.html#system-bars"
* > System Bars</a>.
*
* @see android.view.View#setSystemUiVisibility(int)
* @see android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN
*/
public abstract class SystemUiHider {
/**
* When this flag is set, the
* {@link android.view.WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN}
* flag will be set on older devices, making the status bar "float" on top
* of the activity layout. This is most useful when there are no controls at
* the top of the activity layout.
* <p/>
* This flag isn't used on newer devices because the <a
* href="http://developer.android.com/design/patterns/actionbar.html">action
* bar</a>, the most important structural element of an Android app, should
* be visible and not obscured by the system UI.
*/
public static final int FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES = 0x1;
/**
* When this flag is set, {@link #show()} and {@link #hide()} will toggle
* the visibility of the status bar. If there is a navigation bar, show and
* hide will toggle low profile mode.
*/
public static final int FLAG_FULLSCREEN = 0x2;
/**
* When this flag is set, {@link #show()} and {@link #hide()} will toggle
* the visibility of the navigation bar, if it's present on the device and
* the device allows hiding it. In cases where the navigation bar is present
* but cannot be hidden, show and hide will toggle low profile mode.
*/
public static final int FLAG_HIDE_NAVIGATION = FLAG_FULLSCREEN | 0x4;
/**
* The activity associated with this UI hider object.
*/
protected Activity mActivity;
/**
* The view on which {@link View#setSystemUiVisibility(int)} will be called.
*/
protected View mAnchorView;
/**
* The current UI hider flags.
*
* @see #FLAG_FULLSCREEN
* @see #FLAG_HIDE_NAVIGATION
* @see #FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES
*/
protected int mFlags;
/**
* The current visibility callback.
*/
protected OnVisibilityChangeListener mOnVisibilityChangeListener = sDummyListener;
/**
* Creates and returns an instance of {@link SystemUiHider} that is
* appropriate for this device. The object will be either a
* {@link SystemUiHiderBase} or {@link SystemUiHiderHoneycomb} depending on
* the device.
*
* @param activity The activity whose window's system UI should be
* controlled by this class.
* @param anchorView The view on which
* {@link View#setSystemUiVisibility(int)} will be called.
* @param flags Either 0 or any combination of {@link #FLAG_FULLSCREEN},
* {@link #FLAG_HIDE_NAVIGATION}, and
* {@link #FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES}.
*/
public static SystemUiHider getInstance(Activity activity, View anchorView, int flags) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
return new SystemUiHiderHoneycomb(activity, anchorView, flags);
} else {
return new SystemUiHiderBase(activity, anchorView, flags);
}
}
protected SystemUiHider(Activity activity, View anchorView, int flags) {
mActivity = activity;
mAnchorView = anchorView;
mFlags = flags;
}
/**
* Sets up the system UI hider. Should be called from
* {@link Activity#onCreate}.
*/
public abstract void setup();
/**
* Returns whether or not the system UI is visible.
*/
public abstract boolean isVisible();
/**
* Hide the system UI.
*/
public abstract void hide();
/**
* Show the system UI.
*/
public abstract void show();
/**
* Toggle the visibility of the system UI.
*/
public void toggle() {
if (isVisible()) {
hide();
} else {
show();
}
}
/**
* Registers a callback, to be triggered when the system UI visibility
* changes.
*/
public void setOnVisibilityChangeListener(OnVisibilityChangeListener listener) {
if (listener == null) {
listener = sDummyListener;
}
mOnVisibilityChangeListener = listener;
}
/**
* A dummy no-op callback for use when there is no other listener set.
*/
private static OnVisibilityChangeListener sDummyListener = new OnVisibilityChangeListener() {
@Override
public void onVisibilityChange(boolean visible) {
}
};
/**
* A callback interface used to listen for system UI visibility changes.
*/
public interface OnVisibilityChangeListener {
/**
* Called when the system UI visibility has changed.
*
* @param visible True if the system UI is visible.
*/
public void onVisibilityChange(boolean visible);
}
}
| [
"[email protected]"
]
| |
06892fc68e9aa6f06248e08770a562ab4fe4f981 | a1966e4b36e1ba8de1c9271684d4f4fb1e6be1c5 | /app/src/main/java/mrgao/com/mrgaoviews/utils/QQBubbleEvaluator.java | acd62c63184f2902ce27f2ad211e9e57154a6d5d | []
| no_license | Sniper-Aim/SelfDefineViews | 888cdf799d64828762878ca0772b260689448460 | d555716cf5ed568e5d039bb312f5d24755da9ddb | refs/heads/master | 2020-09-30T16:39:18.538016 | 2018-03-10T08:22:09 | 2018-03-10T08:22:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 614 | java | package mrgao.com.mrgaoviews.utils;
import android.animation.TypeEvaluator;
import android.graphics.Point;
/**
* Created by mr.gao on 2018/1/8.
* Package: mrgao.com.mrgaoviews.utils
* Create Date:2018/1/8
* Project Name:SelfDefineViews
* Description:
*/
public class QQBubbleEvaluator implements TypeEvaluator<Point> {
@Override
public Point evaluate(float v, Point startPoint, Point endPoint) {
Point p = new Point();
p.x = (int) (startPoint.x + v * (endPoint.x - startPoint.x));
p.y = (int) (startPoint.y + v * (endPoint.y - startPoint.y));
return p;
}
}
| [
"[email protected]"
]
| |
dde69877adda766b4f3accb151fe09bc3204fe55 | 1ce4065fe374c668d1410d9038927b8a6fc93746 | /jfe/src/main/java/com/jfe/resources/MongoConfig.java | 60fb2d9ee0aaa0d97d582ab866df4b1cb6cc0133 | []
| no_license | venkatesh4ever/JobPortal | 26de42af5f30bb0eace1de365ab0f385ed01ac04 | 40064c2b2175c5a6b93ab3941689043003288e76 | refs/heads/master | 2020-06-08T08:19:14.304625 | 2014-12-25T16:05:54 | 2014-12-25T16:05:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,098 | java | /**
*
*/
package com.jfe.resources;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.data.authentication.UserCredentials;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import com.mongodb.Mongo;
/**
* @author Venkatesh
*
*/
@Configuration
@EnableMongoRepositories(basePackages = "com.jfe.repository")
@PropertySource("classpath:server.properties")
public class MongoConfig extends AbstractMongoConfiguration {
@Autowired
private Environment env;
@SuppressWarnings("deprecation")
@Bean(name = "mongoTemplate")
public MongoTemplate mongoTemplate() throws Exception {
String mongoDbHost = env.getProperty("mongo.host");
int mongoDbPort = Integer.parseInt(env.getProperty("mongo.port"));
String username = env.getProperty("mongo.username");
String password = env.getProperty("mongo.password");
Mongo mongo = new Mongo(mongoDbHost, mongoDbPort);
UserCredentials userCredentials = new UserCredentials(username, password);
String databaseName = env.getProperty("mongo.db");
MongoDbFactory mongoDbFactory = new SimpleMongoDbFactory(mongo, databaseName, userCredentials);
MongoTemplate mongoTemplate = new MongoTemplate(mongoDbFactory);
return mongoTemplate;
}
@Override
protected String getDatabaseName() {
return env.getProperty("mongo.db");
}
@SuppressWarnings("deprecation")
@Override
public Mongo mongo() throws Exception {
return new Mongo(env.getProperty("mongo.host"));
}
}
| [
"[email protected]"
]
| |
c5d632e962f1818e2523df656263d805542c7ad8 | f03c4bc02344e4e6418afd9166bc7f7dc9abe498 | /core/src/main/java/com/hartmann/lumen/core/tools/bt/Sequence.java | 851424101f45253b2ebfb17f6858624409cfb167 | [
"Apache-2.0"
]
| permissive | jonashartmann/lumen | 8e5bffff1294615060c883b70bb440aa4c741411 | 36a742171edc17b6c824d017facb9e5891a1aba6 | refs/heads/master | 2020-05-04T15:42:42.248872 | 2018-11-11T16:51:40 | 2018-11-11T16:51:40 | 6,918,718 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,533 | java | package com.hartmann.lumen.core.tools.bt;
import java.util.Iterator;
import playn.core.Asserts;
import com.hartmann.lumen.core.tools.bt.BehaviorObserverDelegate.BehaviorObserver;
public abstract class Sequence extends Composite {
protected final BehaviorTree m_pBehaviorTree;
protected Iterator<Behavior> m_Current;
protected Behavior currentBehavior;
public Sequence(BehaviorTree bt) {
super();
m_Current = null;
currentBehavior = null;
this.m_pBehaviorTree = bt;
}
public void onInitialize() {
m_Current = m_Children.iterator();
BehaviorObserverDelegate observer = BehaviorObserverDelegate
.register(new BehaviorObserver() {
@Override
public void onComplete() {
onChildComplete();
}
});
currentBehavior = m_Current.next();
m_pBehaviorTree.insert(currentBehavior, observer);
}
private final void onChildComplete() {
Behavior child = currentBehavior;
if (child.m_eStatus == Status.BH_FAILURE) {
m_pBehaviorTree.terminate(this, Status.BH_FAILURE);
}
Asserts.check(child.m_eStatus == Status.BH_SUCCESS);
if (!m_Current.hasNext()) {
m_pBehaviorTree.terminate(this, Status.BH_SUCCESS);
} else {
currentBehavior = m_Current.next();
BehaviorObserverDelegate observer = BehaviorObserverDelegate
.register(new BehaviorObserver() {
@Override
public void onComplete() {
onChildComplete();
}
});
m_pBehaviorTree.insert(currentBehavior, observer);
}
}
public Status update() {
return null;
}
}
| [
"[email protected]"
]
| |
9bdd0a028582afd74e6a9b82d8ec9ba8cba7515f | c0baa6a0bf055128a1233f664520ac212f6287a6 | /Sistema_de_sugestao/form/DevolutivaColab.java | 84dc26003643f581ffc43890a5d86403bd7875f2 | []
| no_license | jorgeusjt/SistemaSugestao | f20d49fa4b4fea63bbd6738efcb11fece23f8c7d | 080c05a35eb74f624038da658dd3fdc91aad7335 | refs/heads/master | 2020-03-28T11:57:57.848352 | 2018-09-11T04:24:45 | 2018-09-11T04:24:45 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 10,098 | java | package form;
import java.awt.*;
import javax.swing.*;
import javax.swing.text.*;
import java.text.*;
import java.awt.event.*;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.util.Date;
import java.sql.SQLException;
import java.sql.ResultSet;
import utili.*;
public class DevolutivaColab extends JFrame{
private JButton btnNext, btnVoltar, btnPrincipal;
private JLabel lblTitulo,lblMinhas,lblArea ,lblMinhaData,lblRespondida,lblData,lblAprovacao;
private JLabel logo;
private JTextField txtArea, txtMinhaData , txtData, txtAprovacao;
private JEditorPane editorPergunta,editorResposta;
private int idLogin, pontero;
private DateFormat formatter;
CarregaDevolutivas d = new CarregaDevolutivas();
public DevolutivaColab(int idLogin) {
super("Tela Inicial");
this.idLogin = idLogin;
lblTitulo = new JLabel("Devolutivas");
lblTitulo.setFont(new Font("Monospaced", Font.ITALIC, 20));
lblTitulo.setForeground(Color.BLACK);
lblMinhas = new JLabel ("Minhas sugestões: ");
lblMinhas.setFont(new Font("Monospaced", Font.ITALIC, 15));
lblMinhas.setForeground(Color.BLACK);
lblArea = new JLabel ("Área sugerida:");
lblArea.setFont(new Font("Monospaced", Font.ITALIC, 15));
lblArea.setForeground(Color.BLACK);
txtArea = new JTextField (20);
txtMinhaData = new JTextField (20);
txtData = new JTextField(20);
txtAprovacao = new JTextField(20);
lblMinhaData = new JLabel ("Data: ");
lblMinhaData.setFont(new Font("Monospaced", Font.ITALIC, 15));
lblMinhaData.setForeground(Color.BLACK);
lblRespondida = new JLabel ("Sugestões avaliadas: ");
lblRespondida.setFont(new Font("Monospaced", Font.ITALIC, 15));
lblRespondida.setForeground(Color.BLACK);
lblData = new JLabel ("Data: ");
lblData.setFont(new Font("Monospaced", Font.ITALIC, 15));
lblData.setForeground(Color.BLACK);
lblAprovacao = new JLabel ("Validação: ");
lblAprovacao.setFont(new Font("Monospaced", Font.ITALIC, 15));
lblAprovacao.setForeground(Color.BLACK);
btnNext = new JButton();
btnNext.setIcon(new ImageIcon(getClass().getResource("/img/direita.png")));
Color ir = new Color(154,233,233);
btnNext.setBackground(ir);
btnVoltar = new JButton();
btnVoltar.setIcon(new ImageIcon(getClass().getResource("/img/seta.png")));
Color voltar = new Color(154,233,233);
btnVoltar.setBackground(voltar);
btnPrincipal = new JButton("Voltar para tela principal");
btnPrincipal.setForeground(Color.BLACK);
Color voltaP = new Color(225,119,119);
btnPrincipal.setBackground(voltaP);
editorPergunta = new JEditorPane();
JScrollPane scrollPergunta = new JScrollPane(editorPergunta);
scrollPergunta.setPreferredSize(new Dimension(500,80));
editorResposta = new JEditorPane();
JScrollPane scrollResposta = new JScrollPane(editorResposta);
scrollResposta.setPreferredSize(new Dimension(500,80));
formatter = new SimpleDateFormat("dd/MM/yyyy");
//mascara data de nascimento
/*try {
txtData.setFormatterFactory(new DefaultFormatterFactory(new MaskFormatter("##/##/####")));
}
catch (ParseException ex) {
ex.printStackTrace();
} */
Container caixaDevolutivas = getContentPane();
caixaDevolutivas.setLayout( new GridLayout(7,1));
Color cX= new Color(154,233,233);
caixaDevolutivas.setBackground(cX);
JPanel linha1 = new JPanel (new BorderLayout());
JPanel linha2 = new JPanel (new FlowLayout());
JPanel linha3 = new JPanel (new BorderLayout());
JPanel campo1 = new JPanel (new FlowLayout());
JPanel linha4 = new JPanel (new FlowLayout());
JPanel linha5 = new JPanel (new BorderLayout());
JPanel campo2 = new JPanel (new FlowLayout());
JPanel linha6 = new JPanel (new FlowLayout());
JPanel campo3 = new JPanel (new FlowLayout());
JPanel campoPrincipal = new JPanel (new FlowLayout());
JPanel linha7 = new JPanel (new FlowLayout());
logo = new JLabel();
logo.setIcon(new ImageIcon(getClass().getResource("/img/logo.png")));
linha1.add(logo,BorderLayout.NORTH);
linha2.add(lblTitulo);
Color l2= new Color(154,233,233);
linha2.setBackground(l2);
linha1.add(linha2);
Color l1= new Color(154,233,233);
linha1.setBackground(l1);
linha3.add(lblMinhas,BorderLayout.NORTH);
Color l3= new Color(154,233,233);
linha3.setBackground(l3);
campo1.add(lblArea);
campo1.add(txtArea);
campo1.add(lblMinhaData);
campo1.add(txtMinhaData);
Color c1= new Color(154,233,233);
campo1.setBackground(c1);
linha3.add(campo1);
linha4.add(scrollPergunta);
Color l4= new Color(154,233,233);
linha4.setBackground(l4);
linha5.add(lblRespondida,BorderLayout.NORTH);
Color l5= new Color(154,233,233);
linha5.setBackground(l5);
campo2.add(lblData);
campo2.add(txtData);
campo2.add(lblAprovacao);
campo2.add(txtAprovacao);
Color c2= new Color(154,233,233);
campo2.setBackground(c2);
linha5.add(campo2);
linha6.add(scrollResposta);
Color l6= new Color(154,233,233);
linha6.setBackground(l6);
campo3.add(btnVoltar);
campo3.add(btnNext);
Color c3= new Color(154,233,233);
campo3.setBackground(c3);
linha7.add(campo3);
Color l7= new Color(154,233,233);
linha7.setBackground(l7);
campoPrincipal.add(btnPrincipal);
Color cP= new Color(154,233,233);
campoPrincipal.setBackground(cP);
add(linha1);
add(linha3);
add(linha4);
add(linha5);
add(linha6);
add(linha7);
add(campoPrincipal);
setVisible(true);
setSize(715,513);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
//Eventos *********************
btnNext.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnNextActionPerformed(evt);
}
});
btnVoltar.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnVoltarActionPerformed(evt);
}
});
btnPrincipal.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnPrincipalActionPerformed(evt);
}
});
setResizable(false);
txtArea.setEditable(false);
txtMinhaData.setEditable(false);
txtData.setEditable(false);
txtAprovacao.setEditable(false);
editorPergunta.setEditable(false);
editorResposta.setEditable(false);
}//Fim Construtor
public void carregar(){
d.carregaDados(idLogin);
SimpleDateFormat f = new SimpleDateFormat("dd/MM/yyyy");
//String dataEnvio = f.format(d.getDevolutiva(pontero).getDataEnvio());
//String DataResposta = f.format(d.getDevolutiva(pontero).getDataResposta());
txtArea.setText(d.getDevolutiva(pontero).getArea());
txtMinhaData.setText(f.format(d.getDevolutiva(pontero).getDataEnvio()));
editorPergunta.setText(d.getDevolutiva(pontero).getSugestao());
txtAprovacao.setText(d.getDevolutiva(pontero).getEstado());
txtData.setText(f.format(d.getDevolutiva(pontero).getDataResposta()));
editorResposta.setText(d.getDevolutiva(pontero).getDevolutiva());
}
// Metodos Butons
private void btnNextActionPerformed(ActionEvent evt){
if(pontero < d.getQuantidadeDeDevolutivas() - 1){
pontero++;
}
SimpleDateFormat f = new SimpleDateFormat("dd/MM/yyyy");
//String dataEnvio = f.format(d.getDevolutiva(pontero).getDataEnvio());
String DataResposta = f.format(d.getDevolutiva(pontero).getDataResposta());
txtArea.setText(d.getDevolutiva(pontero).getArea());
txtMinhaData.setText(f.format(d.getDevolutiva(pontero).getDataEnvio()));
editorPergunta.setText(d.getDevolutiva(pontero).getSugestao());
txtAprovacao.setText(d.getDevolutiva(pontero).getEstado());
editorResposta.setText(d.getDevolutiva(pontero).getDevolutiva());
txtData.setText(DataResposta);
}
private void btnVoltarActionPerformed(ActionEvent evt){
if(pontero > 0){
pontero--;
}
SimpleDateFormat f = new SimpleDateFormat("dd/MM/yyyy");
//String dataEnvio = f.format(d.getDevolutiva(pontero).getDataEnvio());
//String DataResposta = f.format(d.getDevolutiva(pontero).getDataResposta());
txtArea.setText(d.getDevolutiva(pontero).getArea());
txtMinhaData.setText(f.format(d.getDevolutiva(pontero).getDataEnvio()));
editorPergunta.setText(d.getDevolutiva(pontero).getSugestao());
txtAprovacao.setText(d.getDevolutiva(pontero).getEstado());
txtData.setText(f.format(d.getDevolutiva(pontero).getDataResposta()));
editorResposta.setText(d.getDevolutiva(pontero).getDevolutiva());
}
private void btnPrincipalActionPerformed(ActionEvent evt){
TelaColaborador colaborador = new TelaColaborador(idLogin);
colaborador.setVisible(true);
colaborador.carregar();
setVisible(false);
}
public static void main (String args [] ){
new DevolutivaColab(1);
}
} | [
"[email protected]"
]
| |
1a511e28d58a754aed7f5c8132fef934d2991727 | 5d49fb536387c991bbc35e0f1aeaf4aca91e5981 | /fastminimq-core/src/main/java/org/nopasserby/fastminimq/MQBroker.java | d6eaf801aa395d6d9e48984eaf16dcb7b41b3e35 | [
"Apache-2.0"
]
| permissive | zip01/FastMiniMQ | 6c227aaafcc294ddb68e9ff2cbe637d09496fa00 | cbf4dfe9faa504bfbbf568524cc2efc786fee52d | refs/heads/master | 2023-02-11T02:21:12.849128 | 2021-01-11T03:45:53 | 2021-01-11T03:45:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,555 | java | /*
* Copyright 2020 Guo Chaosheng
*
* 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.nopasserby.fastminimq;
import static java.lang.Integer.toHexString;
import static org.nopasserby.fastminimq.MQConstants.MQBroker.DATA_DIR;
import static org.nopasserby.fastminimq.MQConstants.MQBroker.RESET_DATA_DIR;
import static org.nopasserby.fastminimq.MQConstants.MQCommand.COMMAND_CODE_OFFSET;
import static org.nopasserby.fastminimq.MQConstants.MQCommand.COMMAND_ID_OFFSET;
import static org.nopasserby.fastminimq.MQConstants.MQCommand.CONSUME;
import static org.nopasserby.fastminimq.MQConstants.MQCommand.KV_PUT;
import static org.nopasserby.fastminimq.MQConstants.MQCommand.KV_GET;
import static org.nopasserby.fastminimq.MQConstants.MQCommand.KV_DEL;
import static org.nopasserby.fastminimq.MQConstants.MQCommand.PRODUCE;
import static org.nopasserby.fastminimq.MQUtil.deleteFile;
import static org.nopasserby.fastminimq.MQUtil.startThread;
import static org.nopasserby.fastminimq.MQUtil.toInetAddress;
import java.net.InetSocketAddress;
import org.nopasserby.fastminimq.MQExecutor.MQDispatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.netty.buffer.ByteBuf;
public class MQBroker extends MQDispatch implements Runnable {
private static Logger logger = LoggerFactory.getLogger(MQBroker.class);
static {
if (RESET_DATA_DIR) deleteFile(DATA_DIR);
}
private MQStorage storage;
private MQServer server;
private MQKVdb kvdb;
private ConsumeQueue consumeQueue;
private ConsumeProcessor consumeProcessor;
private MQBrokerCfg brokerCfg;
public MQBroker(MQBrokerCfg brokerCfg) throws Exception {
this.brokerCfg = brokerCfg;
this.server = new MQServer(brokerCfg.socketAddress(), this);
this.kvdb = new MQKVdb();
this.storage = new MQStorage(kvdb);
this.consumeQueue = new ConsumeQueue(storage);
this.consumeProcessor = new ConsumeProcessor(consumeQueue);
}
@Override
protected void execute(ChannelDelegate channel, ByteBuf commandWrapper) throws Exception {
int commandCode = commandWrapper.getInt(COMMAND_CODE_OFFSET);
long commandId = commandWrapper.getLong(COMMAND_ID_OFFSET);
try {
super.execute(channel, commandWrapper);
} catch (Exception e) {
logger.error(name() + " command " + toHexString(commandCode) + " execute error", e);
channel.writeAndFlush(buildErr(commandCode, commandId, e));
}
}
@Override
protected void exceptionCaught(ChannelDelegate channel, Throwable cause) throws Exception {
logger.error("channel {} error", channel, cause);
}
public String name() {
return brokerCfg.name();
}
@Override
protected void dispatch(ChannelDelegate channel, int commandCode, long commandId, ByteBuf commandData) throws Exception {
switch (commandCode) {
case PRODUCE: {
storage.dispatch(channel, commandCode, commandId, commandData);
break;
}
case CONSUME: {
consumeProcessor.dispatch(channel, commandCode, commandId, commandData);
break;
}
case KV_PUT: {
storage.dispatch(channel, commandCode, commandId, commandData);
break;
}
case KV_GET: {
kvdb.dispatch(channel, commandCode, commandId, commandData);
break;
}
case KV_DEL: {
kvdb.dispatch(channel, commandCode, commandId, commandData);
break;
}
default: throw new IllegalArgumentException("command[code:" + Integer.toHexString(commandCode) + "] not support.");
}
}
@Override
public void run() {
MQUtil.envLog(logger, name());
startThread(storage, "MQ-BROKER-STORAGE");
startThread(consumeQueue, "MQ-BROKER-CONSUMEQUEUE");
startThread(server, "MQ-BROKER-SERVER");
}
public void shutdown() throws Exception {
storage.shutdown();
server.shutdown();
consumeQueue.shutdown();
}
public static class MQBrokerCfg {
private String clusterName;
private String name;
private String address;
public MQBrokerCfg(String name, String address) {
this.name = name;
this.address = address;
}
public MQBrokerCfg(String clusterName, String name, String address) {
this(name, address);
this.clusterName = clusterName;
}
public String clusterName() {
return clusterName;
}
public String name() {
return name;
}
public InetSocketAddress socketAddress() {
return toInetAddress(address);
}
}
}
| [
"[email protected]"
]
| |
e62f717a1962f2346fa3501f3dac960030c4c8fb | 84ec8ecd07c15e132dbcd2d31adee03724f847df | /pertemuan5/modifyattributes-satu/src/com/pbo/MyClass.java | 998aa9d8af396ce7da0f0439ba33232c23684d79 | []
| no_license | riassnti/PBO | 6cce2d95ff80ce04e8c5b396ab4e287a32a072ac | 18fdfe8897e0971f45a2315878e9e1c17a241c58 | refs/heads/main | 2023-02-07T01:53:38.325900 | 2020-12-20T09:38:58 | 2020-12-20T09:38:58 | 301,088,136 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 215 | java | package com.pbo;
public class MyClass {
int x;
public static void main(String[] args) {
MyClass myObj = new MyClass();
myObj.x = 40;
System.out.println(myObj.x);
}
}
| [
"[email protected]"
]
| |
1951f06a57ac8fa71fa053d3431270b9c14f3dd7 | 5568a89761bcda924e14219b25d336455cef8e2e | /Demo/src/demo/J10.java | a1db75a9e00ec9ef5467fab2adedf17dfaebd005 | []
| no_license | NavyaKondakindi/BrillioTraining | ec86622802f4a5dad0bd2a57ea9241fdfaded058 | a6eeb1b1f3426599cb65b8a71943271a9cbc2002 | refs/heads/master | 2023-07-01T08:03:38.956747 | 2021-08-04T12:17:54 | 2021-08-04T12:17:54 | 390,012,299 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | package demo;
public class J10 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int arr[]=new int[] {10,20,36,50,30};
int max=0,i;
for(i=0;i<arr.length;i++)
{
if(arr[i]>max)
{
max=arr[i];
}
}
System.out.println(max);
}
}
| [
"[email protected]"
]
| |
7bc298cfd02db85d3facf05631247ee8445e27e6 | 1d73cc52b5a9592aad9f21099b4b86c4a01503c3 | /src/main/java/org/snakeyaml/engine/v2/tokens/KeyToken.java | 5670b86001b3b91a11e20345a131d68ea1b26742 | [
"Apache-2.0"
]
| permissive | Alanscut/snakeyaml-engine | 80adb1d2c5bba2e6bc66807b38509d0f3e8a7df4 | d27cccc4a4d0221323aa00b8709d7cc8540d3618 | refs/heads/master | 2022-12-06T00:27:32.097068 | 2020-08-22T16:28:26 | 2020-08-22T16:28:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 979 | java | /**
* Copyright (c) 2018, http://www.snakeyaml.org
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.snakeyaml.engine.v2.tokens;
import org.snakeyaml.engine.v2.exceptions.Mark;
import java.util.Optional;
public final class KeyToken extends Token {
public KeyToken(Optional<Mark> startMark, Optional<Mark> endMark) {
super(startMark, endMark);
}
@Override
public Token.ID getTokenId() {
return ID.Key;
}
}
| [
"[email protected]"
]
| |
64137e5821771380bdb1866c1e7dd96231c57936 | fbc552e4fb35e1dd9891dec7e1b17f1d17f1a067 | /JAVA-prac-2020.7.9/src/a2020_7_15/b_抽象/c_举例1/Animal.java | 72eb94e31f57c5368be0f52fd4c008ba27ff65a4 | []
| no_license | nienianni/JAVA-pra | 8d440c33c5bea2155a9454d5d0de36419360a15f | d20e71a1005aeaba19210b8934b48483ca923fc1 | refs/heads/master | 2022-11-23T23:41:15.689807 | 2020-07-27T06:51:28 | 2020-07-27T06:51:28 | 282,813,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 167 | java | package a2020_7_15.b_抽象.c_举例1;
// 最高的抽象父类
public abstract class Animal {
public abstract void eat();
public abstract void sleep();
}
| [
"[email protected]"
]
| |
60ff4eb3ddac3392f40759116554509572ab8d6d | 4973f70bbe7bf95325bcd3f66fc407e84bbb0708 | /network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/PublicIPPrefixesInner.java | 810da0bb83744d3bddf706bd9999a4a7da8923db | [
"MIT"
]
| permissive | kalyanaj/azure-sdk-for-java | 49ce8542ea86e12d47fa5819d5e9cdca72f63554 | 0632cec04ea1158175cc2e53b002ca44dcdbe210 | refs/heads/master | 2020-03-08T05:13:11.869050 | 2019-05-07T22:27:06 | 2019-05-07T22:27:06 | 127,942,805 | 0 | 0 | MIT | 2018-04-03T17:18:09 | 2018-04-03T17:18:09 | null | UTF-8 | Java | false | false | 78,165 | java | /**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.network.v2018_08_01.implementation;
import com.microsoft.azure.arm.collection.InnerSupportsGet;
import com.microsoft.azure.arm.collection.InnerSupportsDelete;
import com.microsoft.azure.arm.collection.InnerSupportsListing;
import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.AzureServiceFuture;
import com.microsoft.azure.CloudException;
import com.microsoft.azure.ListOperationCallback;
import com.microsoft.azure.management.network.v2018_08_01.TagsObject;
import com.microsoft.azure.Page;
import com.microsoft.azure.PagedList;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.Validator;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.HTTP;
import retrofit2.http.PATCH;
import retrofit2.http.Path;
import retrofit2.http.PUT;
import retrofit2.http.Query;
import retrofit2.http.Url;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;
/**
* An instance of this class provides access to all the operations defined
* in PublicIPPrefixes.
*/
public class PublicIPPrefixesInner implements InnerSupportsGet<PublicIPPrefixInner>, InnerSupportsDelete<Void>, InnerSupportsListing<PublicIPPrefixInner> {
/** The Retrofit service to perform REST calls. */
private PublicIPPrefixesService service;
/** The service client containing this operation class. */
private NetworkManagementClientImpl client;
/**
* Initializes an instance of PublicIPPrefixesInner.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public PublicIPPrefixesInner(Retrofit retrofit, NetworkManagementClientImpl client) {
this.service = retrofit.create(PublicIPPrefixesService.class);
this.client = client;
}
/**
* The interface defining all the services for PublicIPPrefixes to be
* used by Retrofit to perform actually REST calls.
*/
interface PublicIPPrefixesService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2018_08_01.PublicIPPrefixes delete" })
@HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}", method = "DELETE", hasBody = true)
Observable<Response<ResponseBody>> delete(@Path("resourceGroupName") String resourceGroupName, @Path("publicIpPrefixName") String publicIpPrefixName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2018_08_01.PublicIPPrefixes beginDelete" })
@HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}", method = "DELETE", hasBody = true)
Observable<Response<ResponseBody>> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("publicIpPrefixName") String publicIpPrefixName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2018_08_01.PublicIPPrefixes getByResourceGroup" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}")
Observable<Response<ResponseBody>> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("publicIpPrefixName") String publicIpPrefixName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2018_08_01.PublicIPPrefixes createOrUpdate" })
@PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}")
Observable<Response<ResponseBody>> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("publicIpPrefixName") String publicIpPrefixName, @Path("subscriptionId") String subscriptionId, @Body PublicIPPrefixInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2018_08_01.PublicIPPrefixes beginCreateOrUpdate" })
@PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}")
Observable<Response<ResponseBody>> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("publicIpPrefixName") String publicIpPrefixName, @Path("subscriptionId") String subscriptionId, @Body PublicIPPrefixInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2018_08_01.PublicIPPrefixes updateTags" })
@PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}")
Observable<Response<ResponseBody>> updateTags(@Path("resourceGroupName") String resourceGroupName, @Path("publicIpPrefixName") String publicIpPrefixName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagsObject parameters, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2018_08_01.PublicIPPrefixes beginUpdateTags" })
@PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}")
Observable<Response<ResponseBody>> beginUpdateTags(@Path("resourceGroupName") String resourceGroupName, @Path("publicIpPrefixName") String publicIpPrefixName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagsObject parameters, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2018_08_01.PublicIPPrefixes list" })
@GET("subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPPrefixes")
Observable<Response<ResponseBody>> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2018_08_01.PublicIPPrefixes listByResourceGroup" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes")
Observable<Response<ResponseBody>> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2018_08_01.PublicIPPrefixes listNext" })
@GET
Observable<Response<ResponseBody>> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2018_08_01.PublicIPPrefixes listByResourceGroupNext" })
@GET
Observable<Response<ResponseBody>> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
}
/**
* Deletes the specified public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIpPrefix.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
*/
public void delete(String resourceGroupName, String publicIpPrefixName) {
deleteWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).toBlocking().last().body();
}
/**
* Deletes the specified public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIpPrefix.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<Void> deleteAsync(String resourceGroupName, String publicIpPrefixName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, publicIpPrefixName), serviceCallback);
}
/**
* Deletes the specified public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIpPrefix.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
public Observable<Void> deleteAsync(String resourceGroupName, String publicIpPrefixName) {
return deleteWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
}
/**
* Deletes the specified public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIpPrefix.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
public Observable<ServiceResponse<Void>> deleteWithServiceResponseAsync(String resourceGroupName, String publicIpPrefixName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (publicIpPrefixName == null) {
throw new IllegalArgumentException("Parameter publicIpPrefixName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2018-08-01";
Observable<Response<ResponseBody>> observable = service.delete(resourceGroupName, publicIpPrefixName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent());
return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() { }.getType());
}
/**
* Deletes the specified public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIpPrefix.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
*/
public void beginDelete(String resourceGroupName, String publicIpPrefixName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).toBlocking().single().body();
}
/**
* Deletes the specified public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIpPrefix.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<Void> beginDeleteAsync(String resourceGroupName, String publicIpPrefixName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, publicIpPrefixName), serviceCallback);
}
/**
* Deletes the specified public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIpPrefix.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<Void> beginDeleteAsync(String resourceGroupName, String publicIpPrefixName) {
return beginDeleteWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
}
/**
* Deletes the specified public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIpPrefix.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<ServiceResponse<Void>> beginDeleteWithServiceResponseAsync(String resourceGroupName, String publicIpPrefixName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (publicIpPrefixName == null) {
throw new IllegalArgumentException("Parameter publicIpPrefixName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2018-08-01";
return service.beginDelete(resourceGroupName, publicIpPrefixName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = beginDeleteDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<Void> beginDeleteDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<Void>() { }.getType())
.register(202, new TypeToken<Void>() { }.getType())
.register(204, new TypeToken<Void>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Gets the specified public IP prefix in a specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIPPrefx.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PublicIPPrefixInner object if successful.
*/
public PublicIPPrefixInner getByResourceGroup(String resourceGroupName, String publicIpPrefixName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).toBlocking().single().body();
}
/**
* Gets the specified public IP prefix in a specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIPPrefx.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<PublicIPPrefixInner> getByResourceGroupAsync(String resourceGroupName, String publicIpPrefixName, final ServiceCallback<PublicIPPrefixInner> serviceCallback) {
return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, publicIpPrefixName), serviceCallback);
}
/**
* Gets the specified public IP prefix in a specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIPPrefx.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PublicIPPrefixInner object
*/
public Observable<PublicIPPrefixInner> getByResourceGroupAsync(String resourceGroupName, String publicIpPrefixName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() {
@Override
public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) {
return response.body();
}
});
}
/**
* Gets the specified public IP prefix in a specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIPPrefx.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PublicIPPrefixInner object
*/
public Observable<ServiceResponse<PublicIPPrefixInner>> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String publicIpPrefixName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (publicIpPrefixName == null) {
throw new IllegalArgumentException("Parameter publicIpPrefixName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2018-08-01";
final String expand = null;
return service.getByResourceGroup(resourceGroupName, publicIpPrefixName, this.client.subscriptionId(), apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<PublicIPPrefixInner>>>() {
@Override
public Observable<ServiceResponse<PublicIPPrefixInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PublicIPPrefixInner> clientResponse = getByResourceGroupDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Gets the specified public IP prefix in a specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIPPrefx.
* @param expand Expands referenced resources.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PublicIPPrefixInner object if successful.
*/
public PublicIPPrefixInner getByResourceGroup(String resourceGroupName, String publicIpPrefixName, String expand) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, expand).toBlocking().single().body();
}
/**
* Gets the specified public IP prefix in a specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIPPrefx.
* @param expand Expands referenced resources.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<PublicIPPrefixInner> getByResourceGroupAsync(String resourceGroupName, String publicIpPrefixName, String expand, final ServiceCallback<PublicIPPrefixInner> serviceCallback) {
return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, expand), serviceCallback);
}
/**
* Gets the specified public IP prefix in a specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIPPrefx.
* @param expand Expands referenced resources.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PublicIPPrefixInner object
*/
public Observable<PublicIPPrefixInner> getByResourceGroupAsync(String resourceGroupName, String publicIpPrefixName, String expand) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, expand).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() {
@Override
public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) {
return response.body();
}
});
}
/**
* Gets the specified public IP prefix in a specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the PublicIPPrefx.
* @param expand Expands referenced resources.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PublicIPPrefixInner object
*/
public Observable<ServiceResponse<PublicIPPrefixInner>> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String publicIpPrefixName, String expand) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (publicIpPrefixName == null) {
throw new IllegalArgumentException("Parameter publicIpPrefixName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2018-08-01";
return service.getByResourceGroup(resourceGroupName, publicIpPrefixName, this.client.subscriptionId(), apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<PublicIPPrefixInner>>>() {
@Override
public Observable<ServiceResponse<PublicIPPrefixInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PublicIPPrefixInner> clientResponse = getByResourceGroupDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<PublicIPPrefixInner> getByResourceGroupDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<PublicIPPrefixInner, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<PublicIPPrefixInner>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Creates or updates a static or dynamic public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param parameters Parameters supplied to the create or update public IP prefix operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PublicIPPrefixInner object if successful.
*/
public PublicIPPrefixInner createOrUpdate(String resourceGroupName, String publicIpPrefixName, PublicIPPrefixInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, parameters).toBlocking().last().body();
}
/**
* Creates or updates a static or dynamic public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param parameters Parameters supplied to the create or update public IP prefix operation.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<PublicIPPrefixInner> createOrUpdateAsync(String resourceGroupName, String publicIpPrefixName, PublicIPPrefixInner parameters, final ServiceCallback<PublicIPPrefixInner> serviceCallback) {
return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, parameters), serviceCallback);
}
/**
* Creates or updates a static or dynamic public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param parameters Parameters supplied to the create or update public IP prefix operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
public Observable<PublicIPPrefixInner> createOrUpdateAsync(String resourceGroupName, String publicIpPrefixName, PublicIPPrefixInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, parameters).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() {
@Override
public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) {
return response.body();
}
});
}
/**
* Creates or updates a static or dynamic public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param parameters Parameters supplied to the create or update public IP prefix operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
public Observable<ServiceResponse<PublicIPPrefixInner>> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String publicIpPrefixName, PublicIPPrefixInner parameters) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (publicIpPrefixName == null) {
throw new IllegalArgumentException("Parameter publicIpPrefixName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
Validator.validate(parameters);
final String apiVersion = "2018-08-01";
Observable<Response<ResponseBody>> observable = service.createOrUpdate(resourceGroupName, publicIpPrefixName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent());
return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<PublicIPPrefixInner>() { }.getType());
}
/**
* Creates or updates a static or dynamic public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param parameters Parameters supplied to the create or update public IP prefix operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PublicIPPrefixInner object if successful.
*/
public PublicIPPrefixInner beginCreateOrUpdate(String resourceGroupName, String publicIpPrefixName, PublicIPPrefixInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, parameters).toBlocking().single().body();
}
/**
* Creates or updates a static or dynamic public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param parameters Parameters supplied to the create or update public IP prefix operation.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<PublicIPPrefixInner> beginCreateOrUpdateAsync(String resourceGroupName, String publicIpPrefixName, PublicIPPrefixInner parameters, final ServiceCallback<PublicIPPrefixInner> serviceCallback) {
return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, parameters), serviceCallback);
}
/**
* Creates or updates a static or dynamic public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param parameters Parameters supplied to the create or update public IP prefix operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PublicIPPrefixInner object
*/
public Observable<PublicIPPrefixInner> beginCreateOrUpdateAsync(String resourceGroupName, String publicIpPrefixName, PublicIPPrefixInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, parameters).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() {
@Override
public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) {
return response.body();
}
});
}
/**
* Creates or updates a static or dynamic public IP prefix.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param parameters Parameters supplied to the create or update public IP prefix operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PublicIPPrefixInner object
*/
public Observable<ServiceResponse<PublicIPPrefixInner>> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String publicIpPrefixName, PublicIPPrefixInner parameters) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (publicIpPrefixName == null) {
throw new IllegalArgumentException("Parameter publicIpPrefixName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
Validator.validate(parameters);
final String apiVersion = "2018-08-01";
return service.beginCreateOrUpdate(resourceGroupName, publicIpPrefixName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<PublicIPPrefixInner>>>() {
@Override
public Observable<ServiceResponse<PublicIPPrefixInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PublicIPPrefixInner> clientResponse = beginCreateOrUpdateDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<PublicIPPrefixInner> beginCreateOrUpdateDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<PublicIPPrefixInner, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<PublicIPPrefixInner>() { }.getType())
.register(201, new TypeToken<PublicIPPrefixInner>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PublicIPPrefixInner object if successful.
*/
public PublicIPPrefixInner updateTags(String resourceGroupName, String publicIpPrefixName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).toBlocking().last().body();
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<PublicIPPrefixInner> updateTagsAsync(String resourceGroupName, String publicIpPrefixName, final ServiceCallback<PublicIPPrefixInner> serviceCallback) {
return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName), serviceCallback);
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
public Observable<PublicIPPrefixInner> updateTagsAsync(String resourceGroupName, String publicIpPrefixName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() {
@Override
public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) {
return response.body();
}
});
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
public Observable<ServiceResponse<PublicIPPrefixInner>> updateTagsWithServiceResponseAsync(String resourceGroupName, String publicIpPrefixName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (publicIpPrefixName == null) {
throw new IllegalArgumentException("Parameter publicIpPrefixName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2018-08-01";
final Map<String, String> tags = null;
TagsObject parameters = new TagsObject();
parameters.withTags(null);
Observable<Response<ResponseBody>> observable = service.updateTags(resourceGroupName, publicIpPrefixName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent());
return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<PublicIPPrefixInner>() { }.getType());
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param tags Resource tags.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PublicIPPrefixInner object if successful.
*/
public PublicIPPrefixInner updateTags(String resourceGroupName, String publicIpPrefixName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, tags).toBlocking().last().body();
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param tags Resource tags.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<PublicIPPrefixInner> updateTagsAsync(String resourceGroupName, String publicIpPrefixName, Map<String, String> tags, final ServiceCallback<PublicIPPrefixInner> serviceCallback) {
return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, tags), serviceCallback);
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param tags Resource tags.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
public Observable<PublicIPPrefixInner> updateTagsAsync(String resourceGroupName, String publicIpPrefixName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, tags).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() {
@Override
public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) {
return response.body();
}
});
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param tags Resource tags.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
public Observable<ServiceResponse<PublicIPPrefixInner>> updateTagsWithServiceResponseAsync(String resourceGroupName, String publicIpPrefixName, Map<String, String> tags) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (publicIpPrefixName == null) {
throw new IllegalArgumentException("Parameter publicIpPrefixName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
Validator.validate(tags);
final String apiVersion = "2018-08-01";
TagsObject parameters = new TagsObject();
parameters.withTags(tags);
Observable<Response<ResponseBody>> observable = service.updateTags(resourceGroupName, publicIpPrefixName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent());
return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<PublicIPPrefixInner>() { }.getType());
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PublicIPPrefixInner object if successful.
*/
public PublicIPPrefixInner beginUpdateTags(String resourceGroupName, String publicIpPrefixName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).toBlocking().single().body();
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<PublicIPPrefixInner> beginUpdateTagsAsync(String resourceGroupName, String publicIpPrefixName, final ServiceCallback<PublicIPPrefixInner> serviceCallback) {
return ServiceFuture.fromResponse(beginUpdateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName), serviceCallback);
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PublicIPPrefixInner object
*/
public Observable<PublicIPPrefixInner> beginUpdateTagsAsync(String resourceGroupName, String publicIpPrefixName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() {
@Override
public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) {
return response.body();
}
});
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PublicIPPrefixInner object
*/
public Observable<ServiceResponse<PublicIPPrefixInner>> beginUpdateTagsWithServiceResponseAsync(String resourceGroupName, String publicIpPrefixName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (publicIpPrefixName == null) {
throw new IllegalArgumentException("Parameter publicIpPrefixName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2018-08-01";
final Map<String, String> tags = null;
TagsObject parameters = new TagsObject();
parameters.withTags(null);
return service.beginUpdateTags(resourceGroupName, publicIpPrefixName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<PublicIPPrefixInner>>>() {
@Override
public Observable<ServiceResponse<PublicIPPrefixInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PublicIPPrefixInner> clientResponse = beginUpdateTagsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param tags Resource tags.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PublicIPPrefixInner object if successful.
*/
public PublicIPPrefixInner beginUpdateTags(String resourceGroupName, String publicIpPrefixName, Map<String, String> tags) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, tags).toBlocking().single().body();
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param tags Resource tags.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<PublicIPPrefixInner> beginUpdateTagsAsync(String resourceGroupName, String publicIpPrefixName, Map<String, String> tags, final ServiceCallback<PublicIPPrefixInner> serviceCallback) {
return ServiceFuture.fromResponse(beginUpdateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, tags), serviceCallback);
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param tags Resource tags.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PublicIPPrefixInner object
*/
public Observable<PublicIPPrefixInner> beginUpdateTagsAsync(String resourceGroupName, String publicIpPrefixName, Map<String, String> tags) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, tags).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() {
@Override
public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) {
return response.body();
}
});
}
/**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param tags Resource tags.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PublicIPPrefixInner object
*/
public Observable<ServiceResponse<PublicIPPrefixInner>> beginUpdateTagsWithServiceResponseAsync(String resourceGroupName, String publicIpPrefixName, Map<String, String> tags) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (publicIpPrefixName == null) {
throw new IllegalArgumentException("Parameter publicIpPrefixName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
Validator.validate(tags);
final String apiVersion = "2018-08-01";
TagsObject parameters = new TagsObject();
parameters.withTags(tags);
return service.beginUpdateTags(resourceGroupName, publicIpPrefixName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<PublicIPPrefixInner>>>() {
@Override
public Observable<ServiceResponse<PublicIPPrefixInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PublicIPPrefixInner> clientResponse = beginUpdateTagsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<PublicIPPrefixInner> beginUpdateTagsDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<PublicIPPrefixInner, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<PublicIPPrefixInner>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Gets all the public IP prefixes in a subscription.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList<PublicIPPrefixInner> object if successful.
*/
public PagedList<PublicIPPrefixInner> list() {
ServiceResponse<Page<PublicIPPrefixInner>> response = listSinglePageAsync().toBlocking().single();
return new PagedList<PublicIPPrefixInner>(response.body()) {
@Override
public Page<PublicIPPrefixInner> nextPage(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
/**
* Gets all the public IP prefixes in a subscription.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<List<PublicIPPrefixInner>> listAsync(final ListOperationCallback<PublicIPPrefixInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listSinglePageAsync(),
new Func1<String, Observable<ServiceResponse<Page<PublicIPPrefixInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> call(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
/**
* Gets all the public IP prefixes in a subscription.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<PublicIPPrefixInner> object
*/
public Observable<Page<PublicIPPrefixInner>> listAsync() {
return listWithServiceResponseAsync()
.map(new Func1<ServiceResponse<Page<PublicIPPrefixInner>>, Page<PublicIPPrefixInner>>() {
@Override
public Page<PublicIPPrefixInner> call(ServiceResponse<Page<PublicIPPrefixInner>> response) {
return response.body();
}
});
}
/**
* Gets all the public IP prefixes in a subscription.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<PublicIPPrefixInner> object
*/
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> listWithServiceResponseAsync() {
return listSinglePageAsync()
.concatMap(new Func1<ServiceResponse<Page<PublicIPPrefixInner>>, Observable<ServiceResponse<Page<PublicIPPrefixInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> call(ServiceResponse<Page<PublicIPPrefixInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink));
}
});
}
/**
* Gets all the public IP prefixes in a subscription.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<PublicIPPrefixInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> listSinglePageAsync() {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2018-08-01";
return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<PublicIPPrefixInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<PublicIPPrefixInner>> result = listDelegate(response);
return Observable.just(new ServiceResponse<Page<PublicIPPrefixInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<PageImpl<PublicIPPrefixInner>> listDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<PageImpl<PublicIPPrefixInner>, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<PageImpl<PublicIPPrefixInner>>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Gets all public IP prefixes in a resource group.
*
* @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList<PublicIPPrefixInner> object if successful.
*/
public PagedList<PublicIPPrefixInner> listByResourceGroup(final String resourceGroupName) {
ServiceResponse<Page<PublicIPPrefixInner>> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single();
return new PagedList<PublicIPPrefixInner>(response.body()) {
@Override
public Page<PublicIPPrefixInner> nextPage(String nextPageLink) {
return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
/**
* Gets all public IP prefixes in a resource group.
*
* @param resourceGroupName The name of the resource group.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<List<PublicIPPrefixInner>> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback<PublicIPPrefixInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listByResourceGroupSinglePageAsync(resourceGroupName),
new Func1<String, Observable<ServiceResponse<Page<PublicIPPrefixInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> call(String nextPageLink) {
return listByResourceGroupNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
/**
* Gets all public IP prefixes in a resource group.
*
* @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<PublicIPPrefixInner> object
*/
public Observable<Page<PublicIPPrefixInner>> listByResourceGroupAsync(final String resourceGroupName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName)
.map(new Func1<ServiceResponse<Page<PublicIPPrefixInner>>, Page<PublicIPPrefixInner>>() {
@Override
public Page<PublicIPPrefixInner> call(ServiceResponse<Page<PublicIPPrefixInner>> response) {
return response.body();
}
});
}
/**
* Gets all public IP prefixes in a resource group.
*
* @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<PublicIPPrefixInner> object
*/
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) {
return listByResourceGroupSinglePageAsync(resourceGroupName)
.concatMap(new Func1<ServiceResponse<Page<PublicIPPrefixInner>>, Observable<ServiceResponse<Page<PublicIPPrefixInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> call(ServiceResponse<Page<PublicIPPrefixInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink));
}
});
}
/**
* Gets all public IP prefixes in a resource group.
*
ServiceResponse<PageImpl<PublicIPPrefixInner>> * @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<PublicIPPrefixInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> listByResourceGroupSinglePageAsync(final String resourceGroupName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2018-08-01";
return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<PublicIPPrefixInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<PublicIPPrefixInner>> result = listByResourceGroupDelegate(response);
return Observable.just(new ServiceResponse<Page<PublicIPPrefixInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<PageImpl<PublicIPPrefixInner>> listByResourceGroupDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<PageImpl<PublicIPPrefixInner>, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<PageImpl<PublicIPPrefixInner>>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Gets all the public IP prefixes in a subscription.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList<PublicIPPrefixInner> object if successful.
*/
public PagedList<PublicIPPrefixInner> listNext(final String nextPageLink) {
ServiceResponse<Page<PublicIPPrefixInner>> response = listNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<PublicIPPrefixInner>(response.body()) {
@Override
public Page<PublicIPPrefixInner> nextPage(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
/**
* Gets all the public IP prefixes in a subscription.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param serviceFuture the ServiceFuture object tracking the Retrofit calls
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<List<PublicIPPrefixInner>> listNextAsync(final String nextPageLink, final ServiceFuture<List<PublicIPPrefixInner>> serviceFuture, final ListOperationCallback<PublicIPPrefixInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listNextSinglePageAsync(nextPageLink),
new Func1<String, Observable<ServiceResponse<Page<PublicIPPrefixInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> call(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
/**
* Gets all the public IP prefixes in a subscription.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<PublicIPPrefixInner> object
*/
public Observable<Page<PublicIPPrefixInner>> listNextAsync(final String nextPageLink) {
return listNextWithServiceResponseAsync(nextPageLink)
.map(new Func1<ServiceResponse<Page<PublicIPPrefixInner>>, Page<PublicIPPrefixInner>>() {
@Override
public Page<PublicIPPrefixInner> call(ServiceResponse<Page<PublicIPPrefixInner>> response) {
return response.body();
}
});
}
/**
* Gets all the public IP prefixes in a subscription.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<PublicIPPrefixInner> object
*/
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> listNextWithServiceResponseAsync(final String nextPageLink) {
return listNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<PublicIPPrefixInner>>, Observable<ServiceResponse<Page<PublicIPPrefixInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> call(ServiceResponse<Page<PublicIPPrefixInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink));
}
});
}
/**
* Gets all the public IP prefixes in a subscription.
*
ServiceResponse<PageImpl<PublicIPPrefixInner>> * @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<PublicIPPrefixInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> listNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<PublicIPPrefixInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<PublicIPPrefixInner>> result = listNextDelegate(response);
return Observable.just(new ServiceResponse<Page<PublicIPPrefixInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<PageImpl<PublicIPPrefixInner>> listNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<PageImpl<PublicIPPrefixInner>, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<PageImpl<PublicIPPrefixInner>>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Gets all public IP prefixes in a resource group.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList<PublicIPPrefixInner> object if successful.
*/
public PagedList<PublicIPPrefixInner> listByResourceGroupNext(final String nextPageLink) {
ServiceResponse<Page<PublicIPPrefixInner>> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<PublicIPPrefixInner>(response.body()) {
@Override
public Page<PublicIPPrefixInner> nextPage(String nextPageLink) {
return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
/**
* Gets all public IP prefixes in a resource group.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param serviceFuture the ServiceFuture object tracking the Retrofit calls
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<List<PublicIPPrefixInner>> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture<List<PublicIPPrefixInner>> serviceFuture, final ListOperationCallback<PublicIPPrefixInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listByResourceGroupNextSinglePageAsync(nextPageLink),
new Func1<String, Observable<ServiceResponse<Page<PublicIPPrefixInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> call(String nextPageLink) {
return listByResourceGroupNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
/**
* Gets all public IP prefixes in a resource group.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<PublicIPPrefixInner> object
*/
public Observable<Page<PublicIPPrefixInner>> listByResourceGroupNextAsync(final String nextPageLink) {
return listByResourceGroupNextWithServiceResponseAsync(nextPageLink)
.map(new Func1<ServiceResponse<Page<PublicIPPrefixInner>>, Page<PublicIPPrefixInner>>() {
@Override
public Page<PublicIPPrefixInner> call(ServiceResponse<Page<PublicIPPrefixInner>> response) {
return response.body();
}
});
}
/**
* Gets all public IP prefixes in a resource group.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<PublicIPPrefixInner> object
*/
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) {
return listByResourceGroupNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<PublicIPPrefixInner>>, Observable<ServiceResponse<Page<PublicIPPrefixInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> call(ServiceResponse<Page<PublicIPPrefixInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink));
}
});
}
/**
* Gets all public IP prefixes in a resource group.
*
ServiceResponse<PageImpl<PublicIPPrefixInner>> * @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<PublicIPPrefixInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<PublicIPPrefixInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<PublicIPPrefixInner>> result = listByResourceGroupNextDelegate(response);
return Observable.just(new ServiceResponse<Page<PublicIPPrefixInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<PageImpl<PublicIPPrefixInner>> listByResourceGroupNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<PageImpl<PublicIPPrefixInner>, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<PageImpl<PublicIPPrefixInner>>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
}
| [
"[email protected]"
]
| |
17669e7079729f4bdc9678150007467702b9bc6a | 555b6b5dec93026ecbb12c9b0646d894e39536d5 | /src/main/java/vtag/vorhangkontrolle/networking/ClientListener.java | f598312a679c1928b35c260d8a3cd783c858fd39 | []
| no_license | moritzhoewer/Vorhang_Android | 9bc12d771b6d9d1fa3d74fdd642e901cc6c3c57e | a42d0a53e3bcfab8d61c32a2472837c7bf16b688 | refs/heads/master | 2021-01-12T10:26:16.006679 | 2017-03-20T21:00:56 | 2017-03-20T21:00:56 | 76,453,362 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 154 | java | package vtag.vorhangkontrolle.networking;
/**
* Created by Moritz on 19.03.2017.
*/
public interface ClientListener {
void handleDisconnect();
}
| [
"[email protected]"
]
| |
f61b173f7f3016c35061f7b2014bdb32c8516a2b | ac2caa598288a07f584aa2ada17d42e2192b6ab8 | /AttributesDemo/src/edu/jspiders/attributesDemo/GetAttributeServlet.java | e344df78b1562c2e1ab7224ffa9711c8fc0ed959 | []
| no_license | dadirakshith/HEJA12-13 | 4d8712e6606b9ca3e568d07d9c0e1a6a45afb421 | 724598bc47df78e662f2556a52e98004ba89c9cd | refs/heads/master | 2020-09-30T12:18:48.040735 | 2019-12-11T05:57:35 | 2019-12-11T05:57:35 | 227,286,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 947 | java | package edu.jspiders.attributesDemo;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/get")
public class GetAttributeServlet extends HttpServlet
{
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
out.print("<h1>Getting the Attributres</h1>");
ServletContext context = getServletContext();
Student s1 = (Student)context.getAttribute("student1");
Student s2 = (Student)req.getAttribute("student2");
out.print("<h2>"+s1+"</h2>");
out.print("<h2>"+s2+"</h2>");
}
}
| [
"[email protected]"
]
| |
1d24a7bfd043e6ec41bc533e0c32d70845ef634d | b9de226dd63c3ed3e60604cb6b1b65184a525470 | /task_7_remote_procedure_call/grpc-hello-world/src/main/java/org/acme/ExampleResource.java | 4d437692ef2964c34b0be20e6c64297612a21c69 | []
| no_license | VladPetryakov/all_network_interfaces | d0dbf621217bfd1bda6e52fecc35ea96727d0ac8 | a08e0e2fc6db5199ee791003cbdf22b936cb164b | refs/heads/master | 2023-04-21T07:56:24.742934 | 2021-05-12T10:48:53 | 2021-05-12T10:48:53 | 348,483,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 751 | java | package org.acme;
import io.quarkus.example.GreeterGrpc;
import io.quarkus.example.HelloRequest;
import io.quarkus.grpc.runtime.annotations.GrpcService;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/hello")
public class ExampleResource {
@Inject
@GrpcService("hello")
GreeterGrpc.GreeterBlockingStub client;
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "hello";
}
@GET
@Path("/{name}")
public String hello(@PathParam("name") String name) {
return client.sayHello(HelloRequest.newBuilder().setName(name).build()).getMessage();
}
} | [
"[email protected]"
]
| |
7d7ddfef6fb95c9c595ab9d29ec3f7e734196e56 | a8e566d0d9af10278e9a0a055b03a7e53c215af6 | /Payroll.java | ea3c95fc62d22ba604a37b7e14c7a4ba2666e2e3 | []
| no_license | practischool/CSE-114-Labs | a4cea3d20e694bdbea7bf3653821be4288269dc1 | 676effa410f4b3cc9678a570ee5728d6711a773e | refs/heads/master | 2022-04-21T23:02:23.777148 | 2017-12-19T01:38:04 | 2017-12-19T01:38:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,337 | java | //Max Chen
//ID: 111316366
import java.util.*;
public class Payroll {
public static void main(String[] args){
String name = null;
Scanner scan = new Scanner(System.in);
double hoursWorked, hourlyPay, fedTax, stateTax;
System.out.print("Enter employee's name: ");
name = scan.nextLine();
System.out.print("Enter the number of hours worked this week: ");
hoursWorked = scan.nextDouble();
System.out.print("Enter the hourly pay rate: ");
hourlyPay = scan.nextDouble();
System.out.print("Enter the federal tax withholding rate: ");
fedTax = scan.nextDouble();
System.out.print("Enter the state tax withholding rate: ");
stateTax = scan.nextDouble();
double gross = hourlyPay*hoursWorked;
System.out.println("Employee Name: " + name);
System.out.println("Hours Worked: " + hoursWorked);
System.out.println("Pay Rate: $" + hourlyPay);
System.out.println("Gross Pay: $" + gross + "\n");
System.out.println("Deductions:\n");
System.out.println("Federal Withholding (" + (fedTax*100.0) + "%): $" + fedTax*gross);
System.out.println("State Withholding (" + (stateTax*100.0) + "%): $" + stateTax*gross + "\n");
System.out.println("Total Deduction: $" + ((fedTax*gross) + (stateTax*gross)) + "\n");
System.out.println("Net Pay: $" + (gross - ((fedTax*gross) + (stateTax*gross))));
}
}
| [
"[email protected]"
]
| |
1db761b4dcafe595f65c8e90cc80caa73efe02bb | 859626b2e5794c01a1c982c27274395ab77aecaa | /Minesweeper_Clone/src/minesweeper/FirstCell.java | dd27397c28bca94b40e0a76c66d26e510d6d9da5 | []
| no_license | refactoryourmind/minesweeper_clone | fbf4db27c8b0dde061d8dc3a3e0656e8196485a6 | 32bb3dda950b1395ab8f300b7b263a611933e17e | refs/heads/master | 2021-01-20T10:09:10.267239 | 2012-08-26T14:40:23 | 2012-08-26T14:40:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,170 | java | package minesweeper;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Image;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.net.URL;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.SwingUtilities;
@Header(
author = "James Ostrander",
date = "5/12/2012",
lastModified = "8/16/2012"
)
@SuppressWarnings("serial")
public class FirstCell extends JButton implements MouseListener {
protected MinePanel myParentGame;
protected int myPosX;
protected int myPosY;
protected boolean myRevealed;
private enum Flags { NONE, FLAGGED, QUESTION }
private Flags myFlag;
private Icon myFlaggedIcon;
private boolean mouseover; //For use with MouseListener events.
public FirstCell(final MinePanel setParentGame, final int setPosX, final int setPosY) {
super();
myParentGame = setParentGame;
myPosX = setPosX;
myPosY = setPosY;
myFlag = Flags.NONE;
myFlaggedIcon = new ImageIcon(createImage("images/i_flag.gif", "Flagged"));
myRevealed = false;
setMinimumSize(new Dimension(12,12));
setPreferredSize(new Dimension(24,24));
setMargin(new java.awt.Insets(1, 1, 1, 1));
setFont(new Font("Helvetica", Font.BOLD, 15));
addMouseListener(this);
}
@Override
public void mouseClicked(MouseEvent e)
{ }
@Override
public void mouseEntered(MouseEvent e) {
mouseover = true;
}
@Override
public void mouseExited(MouseEvent e) {
mouseover = false;
}
@Override
public void mousePressed(MouseEvent e) {
getModel().setArmed(true);
getModel().setPressed(true);
mouseover = true;
}
@Override
public void mouseReleased(MouseEvent e) {
getModel().setArmed(false);
getModel().setPressed(false);
if (mouseover) {
//Right click logic
if (SwingUtilities.isRightMouseButton(e)) {
flag();
}
//Middle click logic
else if (SwingUtilities.isMiddleMouseButton(e)) {
System.out.println(this.getClass().getName() + " x: " + myPosX + " y: " + myPosY + " Revealed? " + myRevealed);
}
//Left click logic
else {
System.out.println(this.myPosX + ", " + this.myPosY + "; Object: " + this.getClass().getName());
if(!myRevealed) reveal();
}
}
mouseover = false;
}
protected void flag() {
if(this.myRevealed) return;
switch(myFlag) {
case NONE:
setIcon(myFlaggedIcon);
myFlag = Flags.FLAGGED;
break;
case FLAGGED:
setIcon(null);
setText("?");
myFlag = Flags.QUESTION;
break;
case QUESTION:
unflag();
break;
}
}
protected void unflag() {
setText("");
setIcon(null);
myFlag = Flags.NONE;
}
public void reveal() {
myParentGame.deepPopulate(myPosX, myPosY);
myParentGame.getCellAt(myPosX, myPosY).reveal();
}
public boolean getIsRevealed() {
return myRevealed;
}
protected static Image createImage(String path, String description) {
URL imageURL = Minesweeper.class.getResource(path);
if (imageURL == null) {
System.err.println("Resource not found: " + path);
return null;
}
else {
return (new ImageIcon(imageURL, description)).getImage();
}
}
}
| [
"[email protected]"
]
| |
04746298e2c89e7c2d4a463a383748e34f411f0e | e5bb4c1c5cb3a385a1a391ca43c9094e746bb171 | /Service/trunk/service/api-product/src/main/java/com/hzfh/api/product/service/PartnerIssuerFollowService.java | 4cafeaf7819709c6da96c4502dac93512c395e3e | []
| no_license | FashtimeDotCom/huazhen | 397143967ebed9d50073bfa4909c52336a883486 | 6484bc9948a29f0611855f84e81b0a0b080e2e02 | refs/heads/master | 2021-01-22T14:25:04.159326 | 2016-01-11T09:52:40 | 2016-01-11T09:52:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 696 | java | package com.hzfh.api.product.service;
import com.hzfh.api.product.model.PartnerIssuerFollow;
import com.hzfh.api.product.model.query.PartnerIssuerFollowCondition;
import com.hzframework.data.service.BaseService;
/*******************************************************************************
*
* Copyright 2015 HZFH. All rights reserved.
* Author: GuoZhenYu
* Create Date: 2015/5/22
* Description:
*
* Revision History:
* Date Author Description
*
******************************************************************************/
public interface PartnerIssuerFollowService extends BaseService<PartnerIssuerFollow, PartnerIssuerFollowCondition> {
} | [
"[email protected]"
]
| |
9795d8eafa831d7e938ab604284139c851a7bb29 | c600782defeaed076c3cee065fccb3923e5de2eb | /TubesAbsensi/src/Model/Aplikasi.java | 532fd2d23e5b68be75ceb5d99dc4c9a51ebe1c5e | []
| no_license | agungnursatria/TubesAbsensi | 4dfe2e7e592c68f0254b0752e045eb7625038ff5 | d086d8200682da514c5eec74bbbc0b1d9682539d | refs/heads/master | 2021-04-28T20:27:25.863677 | 2018-02-18T06:22:19 | 2018-02-18T06:22:19 | 121,924,619 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,191 | 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 Model;
import View.TambahPegawai;
import java.util.ArrayList;
/**
*
* @author Agung Nursatria
*/
public class Aplikasi {
Perusahaan perusahaan;
ArrayList<Pegawai> daftarpegawai;
ArrayList<Tunjangan> daftarTunjangan;
Database db;
public Aplikasi(){
db = new Database();
db.connect();
perusahaan = new Perusahaan();
perusahaan = db.loadPerusahaan();
daftarpegawai = db.loadPegawai();
daftarTunjangan = db.loadTunjangan();
}
public void AddPegawai(Pegawai p,String namadept){
int i = perusahaan.getIndexDepartemen(namadept);
perusahaan.getDepartemen(i).AddPegawai(p);
db.savePegawai(p, namadept);
}
public void AddPegawai(Pegawai p){
daftarpegawai.add(p);
}
public void AddTunjangan(Tunjangan t,String id)
{
daftarTunjangan.add(t);
db.saveTunjangan(t, id);
}
public void CreateDepartemen(String nama){
perusahaan.createDepartemen(nama);
db.saveDepartemen(nama, perusahaan.getNama());
}
public void CreateAbsen(int jam,int menit,String tanggal,String Status, String id_absensi){
int i = daftarpegawai.indexOf(id_absensi);
daftarpegawai.get(i).createAbsen(jam, menit, tanggal, Status);
Absensi a = new Absensi(daftarpegawai.get(i).getIdPegawai(),jam,menit,tanggal,Status);
if(daftarpegawai.get(i) instanceof PegawaiHonorer){
db.saveAbsenp_honorer(a, id_absensi);
}
else
{
db.saveAbsenp_tetap(a, id_absensi);
}
}
public Perusahaan getPerusahaan(){
return perusahaan;
}
public ArrayList<Pegawai> getPegawai(){
return daftarpegawai;
}
public Pegawai getPegawai(int i){
return daftarpegawai.get(i);
}
public Pegawai getPegawaiLogin(String username,String password){ //mencari pegawai di objek arraylist pegawai
for (Pegawai pegawai : daftarpegawai) {
if(pegawai.getUsername().equals(username) && pegawai.getPassword().equals(password)){
return pegawai;
}
}
return null;
}
public int getIndexPegawaiDepartemen(Pegawai p,Departemen d){ //mencari pegawai di objek perusahaan
return d.getIndexPegawai(p.getIdPegawai());
}
public int getIndexPegawaiArray(Pegawai p){
return daftarpegawai.indexOf(p);
}
public void pasangPilihanPegawaiTetap(double gaji,String namadept){
((PegawaiTetap) daftarpegawai.get(daftarpegawai.size()-1)).setGaji(gaji);
AddPegawai(daftarpegawai.get(daftarpegawai.size()-1), namadept);
db.savePegawai(daftarpegawai.get(daftarpegawai.size()-1), namadept);
}
public void pasangPilihanPegawaiHonorer(double gaji_perjam,int lama_kontrak,String namadept){
((PegawaiHonorer) daftarpegawai.get(daftarpegawai.size()-1)).setGaji_perjam(gaji_perjam);
((PegawaiHonorer) daftarpegawai.get(daftarpegawai.size()-1)).setLama_Kontrak(lama_kontrak);
AddPegawai(daftarpegawai.get(daftarpegawai.size()-1), namadept);
db.savePegawai(daftarpegawai.get(daftarpegawai.size()-1), namadept);
}
public void rubahPerusahaan(String nama,String alamat,String kontak){
String namalama = perusahaan.getNama();
perusahaan.setNama(nama);
perusahaan.setAlamat(alamat);
perusahaan.setNomorKontak(kontak);
db.updatePerusahaan(perusahaan, namalama);
}
public boolean verifikasi(String username){
return db.VerifikasiUsername(username);
}
public Pegawai LupaPass(String id,String username){
return db.CariPegawai(id, username);
}
public void refresh(){
db.LoadDepartemen(perusahaan, daftarpegawai);
}
}
| [
"[email protected]"
]
| |
9242538dfdf866fde30683ff5ed1447577f821cf | c42fcebb902296fe434e59913f6619fef45ec671 | /target/tmp/jsp/org/apache/jsp/webpage/jeecg/cgdynamgraph/core/cgDynamGraphConfigHeadList_jsp.java | c07b1bdb851c16f2e625156ad5d71b6a6b9cf9b3 | []
| no_license | WeimingBan/jeecg | 98a0c7aaf2964cf3146839c521e42d3075ebd768 | 862a00c1024beb5317c77dbb22ae895d12fb56ac | refs/heads/master | 2020-04-08T21:47:30.905018 | 2018-11-30T02:46:49 | 2018-11-30T02:46:49 | 159,758,654 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 39,036 | java | package org.apache.jsp.webpage.jeecg.cgdynamgraph.core;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class cgDynamGraphConfigHeadList_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.Vector _jspx_dependants;
static {
_jspx_dependants = new java.util.Vector(1);
_jspx_dependants.add("/context/mytags.jsp");
}
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_c_set_var_value_nobody;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_t_base_type_nobody;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_t_datagrid_title_sortOrder_sortName_queryMode_name_idField_fitColumns_fit_checkbox_actionUrl;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_t_dgCol_width_title_queryMode_hidden_field_nobody;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_t_dgCol_width_title_queryMode_query_field_nobody;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_t_dgCol_width_title_queryMode_query_hidden_field_nobody;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_t_dgCol_title_hidden_field_nobody;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_t_dgCol_width_title_hidden_formatter_field_nobody;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_t_dgCol_title_hidden_formatter_field_nobody;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_t_dgCol_width_title_field_nobody;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_t_dgDelOpt_urlfont_urlclass_url_title_nobody;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_t_dgFunOpt_urlfont_urlclass_title_funname_nobody;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_t_dgToolBar_width_url_title_icon_height_funname_nobody;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_t_dgToolBar_url_title_icon_funname_nobody;
private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_jspx_tagPool_c_set_var_value_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_t_base_type_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_t_datagrid_title_sortOrder_sortName_queryMode_name_idField_fitColumns_fit_checkbox_actionUrl = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_t_dgCol_width_title_queryMode_hidden_field_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_t_dgCol_width_title_queryMode_query_field_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_t_dgCol_width_title_queryMode_query_hidden_field_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_t_dgCol_title_hidden_field_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_t_dgCol_width_title_hidden_formatter_field_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_t_dgCol_title_hidden_formatter_field_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_t_dgCol_width_title_field_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_t_dgDelOpt_urlfont_urlclass_url_title_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_t_dgFunOpt_urlfont_urlclass_title_funname_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_t_dgToolBar_width_url_title_icon_height_funname_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_t_dgToolBar_url_title_icon_funname_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
}
public void _jspDestroy() {
_jspx_tagPool_c_set_var_value_nobody.release();
_jspx_tagPool_t_base_type_nobody.release();
_jspx_tagPool_t_datagrid_title_sortOrder_sortName_queryMode_name_idField_fitColumns_fit_checkbox_actionUrl.release();
_jspx_tagPool_t_dgCol_width_title_queryMode_hidden_field_nobody.release();
_jspx_tagPool_t_dgCol_width_title_queryMode_query_field_nobody.release();
_jspx_tagPool_t_dgCol_width_title_queryMode_query_hidden_field_nobody.release();
_jspx_tagPool_t_dgCol_title_hidden_field_nobody.release();
_jspx_tagPool_t_dgCol_width_title_hidden_formatter_field_nobody.release();
_jspx_tagPool_t_dgCol_title_hidden_formatter_field_nobody.release();
_jspx_tagPool_t_dgCol_width_title_field_nobody.release();
_jspx_tagPool_t_dgDelOpt_urlfont_urlclass_url_title_nobody.release();
_jspx_tagPool_t_dgFunOpt_urlfont_urlclass_title_funname_nobody.release();
_jspx_tagPool_t_dgToolBar_width_url_title_icon_height_funname_nobody.release();
_jspx_tagPool_t_dgToolBar_url_title_icon_funname_nobody.release();
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.write('\n');
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
out.write('\n');
// c:set
org.apache.taglibs.standard.tag.rt.core.SetTag _jspx_th_c_set_0 = (org.apache.taglibs.standard.tag.rt.core.SetTag) _jspx_tagPool_c_set_var_value_nobody.get(org.apache.taglibs.standard.tag.rt.core.SetTag.class);
_jspx_th_c_set_0.setPageContext(_jspx_page_context);
_jspx_th_c_set_0.setParent(null);
_jspx_th_c_set_0.setVar("webRoot");
_jspx_th_c_set_0.setValue(basePath);
int _jspx_eval_c_set_0 = _jspx_th_c_set_0.doStartTag();
if (_jspx_th_c_set_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_c_set_var_value_nobody.reuse(_jspx_th_c_set_0);
return;
}
_jspx_tagPool_c_set_var_value_nobody.reuse(_jspx_th_c_set_0);
out.write('\n');
if (_jspx_meth_t_base_0(_jspx_page_context))
return;
out.write("\n");
out.write("<div class=\"easyui-layout\" fit=\"true\">\n");
out.write("<div region=\"center\" style=\"padding:0px;border:0px\">\n");
if (_jspx_meth_t_datagrid_0(_jspx_page_context))
return;
out.write("</div>\n");
out.write("</div>\n");
out.write("<script src=\"plug-in/clipboard/ZeroClipboard.js\"></script>\n");
out.write("<script type=\"text/javascript\">\n");
out.write(" /**\n");
out.write("\t*\t弹出菜单链接\n");
out.write("\t*/\n");
out.write("\tfunction popMenuLink(tableName,content){\n");
out.write("\t\t$.dialog({\n");
out.write("\t\t\tcontent: \"url:cgDynamGraphConfigHeadController.do?popmenulink&url=cgDynamGraphController.do?design&title=\"+tableName,\n");
out.write(" drag :false,\n");
out.write(" lock : true,\n");
out.write(" title:'菜单链接['+content+']',\n");
out.write(" opacity : 0.3,\n");
out.write(" width:400,\n");
out.write(" height:80,drag:false,min:false,max:false\n");
out.write("\t\t}).zindex();\n");
out.write("\t}\n");
out.write(" \n");
out.write(" \n");
out.write("\tfunction addlisttab(tableName,content){\n");
out.write("\t\t addOneTab(content, \"cgDynamGraphController.do?design&id=\"+tableName);\n");
out.write("\t}\n");
out.write("\t\n");
out.write(" </script>");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_t_base_0(PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:base
org.jeecgframework.tag.core.easyui.BaseTag _jspx_th_t_base_0 = (org.jeecgframework.tag.core.easyui.BaseTag) _jspx_tagPool_t_base_type_nobody.get(org.jeecgframework.tag.core.easyui.BaseTag.class);
_jspx_th_t_base_0.setPageContext(_jspx_page_context);
_jspx_th_t_base_0.setParent(null);
_jspx_th_t_base_0.setType("jquery,easyui,tools");
int _jspx_eval_t_base_0 = _jspx_th_t_base_0.doStartTag();
if (_jspx_th_t_base_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_base_type_nobody.reuse(_jspx_th_t_base_0);
return true;
}
_jspx_tagPool_t_base_type_nobody.reuse(_jspx_th_t_base_0);
return false;
}
private boolean _jspx_meth_t_datagrid_0(PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:datagrid
org.jeecgframework.tag.core.easyui.DataGridTag _jspx_th_t_datagrid_0 = (org.jeecgframework.tag.core.easyui.DataGridTag) _jspx_tagPool_t_datagrid_title_sortOrder_sortName_queryMode_name_idField_fitColumns_fit_checkbox_actionUrl.get(org.jeecgframework.tag.core.easyui.DataGridTag.class);
_jspx_th_t_datagrid_0.setPageContext(_jspx_page_context);
_jspx_th_t_datagrid_0.setParent(null);
_jspx_th_t_datagrid_0.setFitColumns(true);
_jspx_th_t_datagrid_0.setCheckbox(true);
_jspx_th_t_datagrid_0.setName("cgDynamGraphConfigHeadList");
_jspx_th_t_datagrid_0.setTitle("在线移动图表");
_jspx_th_t_datagrid_0.setActionUrl("cgDynamGraphConfigHeadController.do?datagrid");
_jspx_th_t_datagrid_0.setIdField("id");
_jspx_th_t_datagrid_0.setFit(true);
_jspx_th_t_datagrid_0.setQueryMode("group");
_jspx_th_t_datagrid_0.setSortName("createDate");
_jspx_th_t_datagrid_0.setSortOrder("desc");
int _jspx_eval_t_datagrid_0 = _jspx_th_t_datagrid_0.doStartTag();
if (_jspx_eval_t_datagrid_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgCol_0((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgCol_1((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgCol_2((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgCol_3((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
if (_jspx_meth_t_dgCol_4((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgCol_5((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgCol_6((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgCol_7((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgCol_8((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgCol_9((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgCol_10((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgDelOpt_0((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgFunOpt_0((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgFunOpt_1((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgToolBar_0((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgToolBar_1((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgToolBar_2((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
out.write(' ');
if (_jspx_meth_t_dgToolBar_3((javax.servlet.jsp.tagext.JspTag) _jspx_th_t_datagrid_0, _jspx_page_context))
return true;
out.write('\n');
int evalDoAfterBody = _jspx_th_t_datagrid_0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_t_datagrid_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_datagrid_title_sortOrder_sortName_queryMode_name_idField_fitColumns_fit_checkbox_actionUrl.reuse(_jspx_th_t_datagrid_0);
return true;
}
_jspx_tagPool_t_datagrid_title_sortOrder_sortName_queryMode_name_idField_fitColumns_fit_checkbox_actionUrl.reuse(_jspx_th_t_datagrid_0);
return false;
}
private boolean _jspx_meth_t_dgCol_0(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgCol
org.jeecgframework.tag.core.easyui.DataGridColumnTag _jspx_th_t_dgCol_0 = (org.jeecgframework.tag.core.easyui.DataGridColumnTag) _jspx_tagPool_t_dgCol_width_title_queryMode_hidden_field_nobody.get(org.jeecgframework.tag.core.easyui.DataGridColumnTag.class);
_jspx_th_t_dgCol_0.setPageContext(_jspx_page_context);
_jspx_th_t_dgCol_0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgCol_0.setTitle("");
_jspx_th_t_dgCol_0.setField("id");
_jspx_th_t_dgCol_0.setHidden(true);
_jspx_th_t_dgCol_0.setQueryMode("single");
_jspx_th_t_dgCol_0.setWidth(new Integer(120));
int _jspx_eval_t_dgCol_0 = _jspx_th_t_dgCol_0.doStartTag();
if (_jspx_th_t_dgCol_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgCol_width_title_queryMode_hidden_field_nobody.reuse(_jspx_th_t_dgCol_0);
return true;
}
_jspx_tagPool_t_dgCol_width_title_queryMode_hidden_field_nobody.reuse(_jspx_th_t_dgCol_0);
return false;
}
private boolean _jspx_meth_t_dgCol_1(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgCol
org.jeecgframework.tag.core.easyui.DataGridColumnTag _jspx_th_t_dgCol_1 = (org.jeecgframework.tag.core.easyui.DataGridColumnTag) _jspx_tagPool_t_dgCol_width_title_queryMode_query_field_nobody.get(org.jeecgframework.tag.core.easyui.DataGridColumnTag.class);
_jspx_th_t_dgCol_1.setPageContext(_jspx_page_context);
_jspx_th_t_dgCol_1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgCol_1.setTitle("移动图表名称");
_jspx_th_t_dgCol_1.setField("name");
_jspx_th_t_dgCol_1.setQuery(true);
_jspx_th_t_dgCol_1.setQueryMode("single");
_jspx_th_t_dgCol_1.setWidth(new Integer(120));
int _jspx_eval_t_dgCol_1 = _jspx_th_t_dgCol_1.doStartTag();
if (_jspx_th_t_dgCol_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgCol_width_title_queryMode_query_field_nobody.reuse(_jspx_th_t_dgCol_1);
return true;
}
_jspx_tagPool_t_dgCol_width_title_queryMode_query_field_nobody.reuse(_jspx_th_t_dgCol_1);
return false;
}
private boolean _jspx_meth_t_dgCol_2(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgCol
org.jeecgframework.tag.core.easyui.DataGridColumnTag _jspx_th_t_dgCol_2 = (org.jeecgframework.tag.core.easyui.DataGridColumnTag) _jspx_tagPool_t_dgCol_width_title_queryMode_query_field_nobody.get(org.jeecgframework.tag.core.easyui.DataGridColumnTag.class);
_jspx_th_t_dgCol_2.setPageContext(_jspx_page_context);
_jspx_th_t_dgCol_2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgCol_2.setTitle("common.code");
_jspx_th_t_dgCol_2.setField("code");
_jspx_th_t_dgCol_2.setQuery(true);
_jspx_th_t_dgCol_2.setQueryMode("single");
_jspx_th_t_dgCol_2.setWidth(new Integer(120));
int _jspx_eval_t_dgCol_2 = _jspx_th_t_dgCol_2.doStartTag();
if (_jspx_th_t_dgCol_2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgCol_width_title_queryMode_query_field_nobody.reuse(_jspx_th_t_dgCol_2);
return true;
}
_jspx_tagPool_t_dgCol_width_title_queryMode_query_field_nobody.reuse(_jspx_th_t_dgCol_2);
return false;
}
private boolean _jspx_meth_t_dgCol_3(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgCol
org.jeecgframework.tag.core.easyui.DataGridColumnTag _jspx_th_t_dgCol_3 = (org.jeecgframework.tag.core.easyui.DataGridColumnTag) _jspx_tagPool_t_dgCol_width_title_queryMode_query_field_nobody.get(org.jeecgframework.tag.core.easyui.DataGridColumnTag.class);
_jspx_th_t_dgCol_3.setPageContext(_jspx_page_context);
_jspx_th_t_dgCol_3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgCol_3.setTitle("query.sql");
_jspx_th_t_dgCol_3.setField("cgrSql");
_jspx_th_t_dgCol_3.setQuery(true);
_jspx_th_t_dgCol_3.setQueryMode("single");
_jspx_th_t_dgCol_3.setWidth(new Integer(500));
int _jspx_eval_t_dgCol_3 = _jspx_th_t_dgCol_3.doStartTag();
if (_jspx_th_t_dgCol_3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgCol_width_title_queryMode_query_field_nobody.reuse(_jspx_th_t_dgCol_3);
return true;
}
_jspx_tagPool_t_dgCol_width_title_queryMode_query_field_nobody.reuse(_jspx_th_t_dgCol_3);
return false;
}
private boolean _jspx_meth_t_dgCol_4(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgCol
org.jeecgframework.tag.core.easyui.DataGridColumnTag _jspx_th_t_dgCol_4 = (org.jeecgframework.tag.core.easyui.DataGridColumnTag) _jspx_tagPool_t_dgCol_width_title_queryMode_query_hidden_field_nobody.get(org.jeecgframework.tag.core.easyui.DataGridColumnTag.class);
_jspx_th_t_dgCol_4.setPageContext(_jspx_page_context);
_jspx_th_t_dgCol_4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgCol_4.setTitle("common.dynamic.dbsource");
_jspx_th_t_dgCol_4.setField("dbSource");
_jspx_th_t_dgCol_4.setQuery(true);
_jspx_th_t_dgCol_4.setHidden(true);
_jspx_th_t_dgCol_4.setQueryMode("single");
_jspx_th_t_dgCol_4.setWidth(new Integer(120));
int _jspx_eval_t_dgCol_4 = _jspx_th_t_dgCol_4.doStartTag();
if (_jspx_th_t_dgCol_4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgCol_width_title_queryMode_query_hidden_field_nobody.reuse(_jspx_th_t_dgCol_4);
return true;
}
_jspx_tagPool_t_dgCol_width_title_queryMode_query_hidden_field_nobody.reuse(_jspx_th_t_dgCol_4);
return false;
}
private boolean _jspx_meth_t_dgCol_5(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgCol
org.jeecgframework.tag.core.easyui.DataGridColumnTag _jspx_th_t_dgCol_5 = (org.jeecgframework.tag.core.easyui.DataGridColumnTag) _jspx_tagPool_t_dgCol_title_hidden_field_nobody.get(org.jeecgframework.tag.core.easyui.DataGridColumnTag.class);
_jspx_th_t_dgCol_5.setPageContext(_jspx_page_context);
_jspx_th_t_dgCol_5.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgCol_5.setTitle("common.createby");
_jspx_th_t_dgCol_5.setField("createBy");
_jspx_th_t_dgCol_5.setHidden(true);
int _jspx_eval_t_dgCol_5 = _jspx_th_t_dgCol_5.doStartTag();
if (_jspx_th_t_dgCol_5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgCol_title_hidden_field_nobody.reuse(_jspx_th_t_dgCol_5);
return true;
}
_jspx_tagPool_t_dgCol_title_hidden_field_nobody.reuse(_jspx_th_t_dgCol_5);
return false;
}
private boolean _jspx_meth_t_dgCol_6(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgCol
org.jeecgframework.tag.core.easyui.DataGridColumnTag _jspx_th_t_dgCol_6 = (org.jeecgframework.tag.core.easyui.DataGridColumnTag) _jspx_tagPool_t_dgCol_width_title_hidden_formatter_field_nobody.get(org.jeecgframework.tag.core.easyui.DataGridColumnTag.class);
_jspx_th_t_dgCol_6.setPageContext(_jspx_page_context);
_jspx_th_t_dgCol_6.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgCol_6.setTitle("common.createtime");
_jspx_th_t_dgCol_6.setField("createDate");
_jspx_th_t_dgCol_6.setFormatter("yyyy-MM-dd");
_jspx_th_t_dgCol_6.setWidth(new Integer(120));
_jspx_th_t_dgCol_6.setHidden(false);
int _jspx_eval_t_dgCol_6 = _jspx_th_t_dgCol_6.doStartTag();
if (_jspx_th_t_dgCol_6.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgCol_width_title_hidden_formatter_field_nobody.reuse(_jspx_th_t_dgCol_6);
return true;
}
_jspx_tagPool_t_dgCol_width_title_hidden_formatter_field_nobody.reuse(_jspx_th_t_dgCol_6);
return false;
}
private boolean _jspx_meth_t_dgCol_7(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgCol
org.jeecgframework.tag.core.easyui.DataGridColumnTag _jspx_th_t_dgCol_7 = (org.jeecgframework.tag.core.easyui.DataGridColumnTag) _jspx_tagPool_t_dgCol_title_hidden_field_nobody.get(org.jeecgframework.tag.core.easyui.DataGridColumnTag.class);
_jspx_th_t_dgCol_7.setPageContext(_jspx_page_context);
_jspx_th_t_dgCol_7.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgCol_7.setTitle("common.updateby");
_jspx_th_t_dgCol_7.setField("updateBy");
_jspx_th_t_dgCol_7.setHidden(true);
int _jspx_eval_t_dgCol_7 = _jspx_th_t_dgCol_7.doStartTag();
if (_jspx_th_t_dgCol_7.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgCol_title_hidden_field_nobody.reuse(_jspx_th_t_dgCol_7);
return true;
}
_jspx_tagPool_t_dgCol_title_hidden_field_nobody.reuse(_jspx_th_t_dgCol_7);
return false;
}
private boolean _jspx_meth_t_dgCol_8(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgCol
org.jeecgframework.tag.core.easyui.DataGridColumnTag _jspx_th_t_dgCol_8 = (org.jeecgframework.tag.core.easyui.DataGridColumnTag) _jspx_tagPool_t_dgCol_title_hidden_formatter_field_nobody.get(org.jeecgframework.tag.core.easyui.DataGridColumnTag.class);
_jspx_th_t_dgCol_8.setPageContext(_jspx_page_context);
_jspx_th_t_dgCol_8.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgCol_8.setTitle("common.updatetime");
_jspx_th_t_dgCol_8.setField("updateDate");
_jspx_th_t_dgCol_8.setFormatter("yyyy-MM-dd");
_jspx_th_t_dgCol_8.setHidden(true);
int _jspx_eval_t_dgCol_8 = _jspx_th_t_dgCol_8.doStartTag();
if (_jspx_th_t_dgCol_8.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgCol_title_hidden_formatter_field_nobody.reuse(_jspx_th_t_dgCol_8);
return true;
}
_jspx_tagPool_t_dgCol_title_hidden_formatter_field_nobody.reuse(_jspx_th_t_dgCol_8);
return false;
}
private boolean _jspx_meth_t_dgCol_9(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgCol
org.jeecgframework.tag.core.easyui.DataGridColumnTag _jspx_th_t_dgCol_9 = (org.jeecgframework.tag.core.easyui.DataGridColumnTag) _jspx_tagPool_t_dgCol_width_title_queryMode_query_hidden_field_nobody.get(org.jeecgframework.tag.core.easyui.DataGridColumnTag.class);
_jspx_th_t_dgCol_9.setPageContext(_jspx_page_context);
_jspx_th_t_dgCol_9.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgCol_9.setTitle("common.description");
_jspx_th_t_dgCol_9.setField("content");
_jspx_th_t_dgCol_9.setHidden(true);
_jspx_th_t_dgCol_9.setQuery(true);
_jspx_th_t_dgCol_9.setQueryMode("single");
_jspx_th_t_dgCol_9.setWidth(new Integer(120));
int _jspx_eval_t_dgCol_9 = _jspx_th_t_dgCol_9.doStartTag();
if (_jspx_th_t_dgCol_9.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgCol_width_title_queryMode_query_hidden_field_nobody.reuse(_jspx_th_t_dgCol_9);
return true;
}
_jspx_tagPool_t_dgCol_width_title_queryMode_query_hidden_field_nobody.reuse(_jspx_th_t_dgCol_9);
return false;
}
private boolean _jspx_meth_t_dgCol_10(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgCol
org.jeecgframework.tag.core.easyui.DataGridColumnTag _jspx_th_t_dgCol_10 = (org.jeecgframework.tag.core.easyui.DataGridColumnTag) _jspx_tagPool_t_dgCol_width_title_field_nobody.get(org.jeecgframework.tag.core.easyui.DataGridColumnTag.class);
_jspx_th_t_dgCol_10.setPageContext(_jspx_page_context);
_jspx_th_t_dgCol_10.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgCol_10.setTitle("common.operation");
_jspx_th_t_dgCol_10.setField("opt");
_jspx_th_t_dgCol_10.setWidth(new Integer(300));
int _jspx_eval_t_dgCol_10 = _jspx_th_t_dgCol_10.doStartTag();
if (_jspx_th_t_dgCol_10.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgCol_width_title_field_nobody.reuse(_jspx_th_t_dgCol_10);
return true;
}
_jspx_tagPool_t_dgCol_width_title_field_nobody.reuse(_jspx_th_t_dgCol_10);
return false;
}
private boolean _jspx_meth_t_dgDelOpt_0(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgDelOpt
org.jeecgframework.tag.core.easyui.DataGridDelOptTag _jspx_th_t_dgDelOpt_0 = (org.jeecgframework.tag.core.easyui.DataGridDelOptTag) _jspx_tagPool_t_dgDelOpt_urlfont_urlclass_url_title_nobody.get(org.jeecgframework.tag.core.easyui.DataGridDelOptTag.class);
_jspx_th_t_dgDelOpt_0.setPageContext(_jspx_page_context);
_jspx_th_t_dgDelOpt_0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgDelOpt_0.setTitle("common.delete");
_jspx_th_t_dgDelOpt_0.setUrl("cgDynamGraphConfigHeadController.do?doDel&id={id}");
_jspx_th_t_dgDelOpt_0.setUrlclass("ace_button");
_jspx_th_t_dgDelOpt_0.setUrlfont("fa-trash-o");
int _jspx_eval_t_dgDelOpt_0 = _jspx_th_t_dgDelOpt_0.doStartTag();
if (_jspx_th_t_dgDelOpt_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgDelOpt_urlfont_urlclass_url_title_nobody.reuse(_jspx_th_t_dgDelOpt_0);
return true;
}
_jspx_tagPool_t_dgDelOpt_urlfont_urlclass_url_title_nobody.reuse(_jspx_th_t_dgDelOpt_0);
return false;
}
private boolean _jspx_meth_t_dgFunOpt_0(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgFunOpt
org.jeecgframework.tag.core.easyui.DataGridFunOptTag _jspx_th_t_dgFunOpt_0 = (org.jeecgframework.tag.core.easyui.DataGridFunOptTag) _jspx_tagPool_t_dgFunOpt_urlfont_urlclass_title_funname_nobody.get(org.jeecgframework.tag.core.easyui.DataGridFunOptTag.class);
_jspx_th_t_dgFunOpt_0.setPageContext(_jspx_page_context);
_jspx_th_t_dgFunOpt_0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgFunOpt_0.setFunname("popMenuLink(code,name)");
_jspx_th_t_dgFunOpt_0.setTitle("配置地址");
_jspx_th_t_dgFunOpt_0.setUrlclass("ace_button");
_jspx_th_t_dgFunOpt_0.setUrlfont("fa-cog");
int _jspx_eval_t_dgFunOpt_0 = _jspx_th_t_dgFunOpt_0.doStartTag();
if (_jspx_th_t_dgFunOpt_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgFunOpt_urlfont_urlclass_title_funname_nobody.reuse(_jspx_th_t_dgFunOpt_0);
return true;
}
_jspx_tagPool_t_dgFunOpt_urlfont_urlclass_title_funname_nobody.reuse(_jspx_th_t_dgFunOpt_0);
return false;
}
private boolean _jspx_meth_t_dgFunOpt_1(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgFunOpt
org.jeecgframework.tag.core.easyui.DataGridFunOptTag _jspx_th_t_dgFunOpt_1 = (org.jeecgframework.tag.core.easyui.DataGridFunOptTag) _jspx_tagPool_t_dgFunOpt_urlfont_urlclass_title_funname_nobody.get(org.jeecgframework.tag.core.easyui.DataGridFunOptTag.class);
_jspx_th_t_dgFunOpt_1.setPageContext(_jspx_page_context);
_jspx_th_t_dgFunOpt_1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgFunOpt_1.setFunname("addlisttab(code,name)");
_jspx_th_t_dgFunOpt_1.setTitle("功能测试");
_jspx_th_t_dgFunOpt_1.setUrlclass("ace_button");
_jspx_th_t_dgFunOpt_1.setUrlfont("fa-cog");
int _jspx_eval_t_dgFunOpt_1 = _jspx_th_t_dgFunOpt_1.doStartTag();
if (_jspx_th_t_dgFunOpt_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgFunOpt_urlfont_urlclass_title_funname_nobody.reuse(_jspx_th_t_dgFunOpt_1);
return true;
}
_jspx_tagPool_t_dgFunOpt_urlfont_urlclass_title_funname_nobody.reuse(_jspx_th_t_dgFunOpt_1);
return false;
}
private boolean _jspx_meth_t_dgToolBar_0(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgToolBar
org.jeecgframework.tag.core.easyui.DataGridToolBarTag _jspx_th_t_dgToolBar_0 = (org.jeecgframework.tag.core.easyui.DataGridToolBarTag) _jspx_tagPool_t_dgToolBar_width_url_title_icon_height_funname_nobody.get(org.jeecgframework.tag.core.easyui.DataGridToolBarTag.class);
_jspx_th_t_dgToolBar_0.setPageContext(_jspx_page_context);
_jspx_th_t_dgToolBar_0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgToolBar_0.setTitle("common.add");
_jspx_th_t_dgToolBar_0.setIcon("icon-add");
_jspx_th_t_dgToolBar_0.setUrl("cgDynamGraphConfigHeadController.do?goAdd");
_jspx_th_t_dgToolBar_0.setFunname("add");
_jspx_th_t_dgToolBar_0.setHeight("450");
_jspx_th_t_dgToolBar_0.setWidth("1200");
int _jspx_eval_t_dgToolBar_0 = _jspx_th_t_dgToolBar_0.doStartTag();
if (_jspx_th_t_dgToolBar_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgToolBar_width_url_title_icon_height_funname_nobody.reuse(_jspx_th_t_dgToolBar_0);
return true;
}
_jspx_tagPool_t_dgToolBar_width_url_title_icon_height_funname_nobody.reuse(_jspx_th_t_dgToolBar_0);
return false;
}
private boolean _jspx_meth_t_dgToolBar_1(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgToolBar
org.jeecgframework.tag.core.easyui.DataGridToolBarTag _jspx_th_t_dgToolBar_1 = (org.jeecgframework.tag.core.easyui.DataGridToolBarTag) _jspx_tagPool_t_dgToolBar_width_url_title_icon_height_funname_nobody.get(org.jeecgframework.tag.core.easyui.DataGridToolBarTag.class);
_jspx_th_t_dgToolBar_1.setPageContext(_jspx_page_context);
_jspx_th_t_dgToolBar_1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgToolBar_1.setTitle("common.edit");
_jspx_th_t_dgToolBar_1.setIcon("icon-edit");
_jspx_th_t_dgToolBar_1.setUrl("cgDynamGraphConfigHeadController.do?goUpdate");
_jspx_th_t_dgToolBar_1.setFunname("update");
_jspx_th_t_dgToolBar_1.setHeight("450");
_jspx_th_t_dgToolBar_1.setWidth("1200");
int _jspx_eval_t_dgToolBar_1 = _jspx_th_t_dgToolBar_1.doStartTag();
if (_jspx_th_t_dgToolBar_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgToolBar_width_url_title_icon_height_funname_nobody.reuse(_jspx_th_t_dgToolBar_1);
return true;
}
_jspx_tagPool_t_dgToolBar_width_url_title_icon_height_funname_nobody.reuse(_jspx_th_t_dgToolBar_1);
return false;
}
private boolean _jspx_meth_t_dgToolBar_2(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgToolBar
org.jeecgframework.tag.core.easyui.DataGridToolBarTag _jspx_th_t_dgToolBar_2 = (org.jeecgframework.tag.core.easyui.DataGridToolBarTag) _jspx_tagPool_t_dgToolBar_url_title_icon_funname_nobody.get(org.jeecgframework.tag.core.easyui.DataGridToolBarTag.class);
_jspx_th_t_dgToolBar_2.setPageContext(_jspx_page_context);
_jspx_th_t_dgToolBar_2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgToolBar_2.setTitle("common.batch.delete");
_jspx_th_t_dgToolBar_2.setIcon("icon-remove");
_jspx_th_t_dgToolBar_2.setUrl("cgDynamGraphConfigHeadController.do?doBatchDel");
_jspx_th_t_dgToolBar_2.setFunname("deleteALLSelect");
int _jspx_eval_t_dgToolBar_2 = _jspx_th_t_dgToolBar_2.doStartTag();
if (_jspx_th_t_dgToolBar_2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgToolBar_url_title_icon_funname_nobody.reuse(_jspx_th_t_dgToolBar_2);
return true;
}
_jspx_tagPool_t_dgToolBar_url_title_icon_funname_nobody.reuse(_jspx_th_t_dgToolBar_2);
return false;
}
private boolean _jspx_meth_t_dgToolBar_3(javax.servlet.jsp.tagext.JspTag _jspx_th_t_datagrid_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// t:dgToolBar
org.jeecgframework.tag.core.easyui.DataGridToolBarTag _jspx_th_t_dgToolBar_3 = (org.jeecgframework.tag.core.easyui.DataGridToolBarTag) _jspx_tagPool_t_dgToolBar_width_url_title_icon_height_funname_nobody.get(org.jeecgframework.tag.core.easyui.DataGridToolBarTag.class);
_jspx_th_t_dgToolBar_3.setPageContext(_jspx_page_context);
_jspx_th_t_dgToolBar_3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_t_datagrid_0);
_jspx_th_t_dgToolBar_3.setTitle("common.view");
_jspx_th_t_dgToolBar_3.setIcon("icon-search");
_jspx_th_t_dgToolBar_3.setUrl("cgDynamGraphConfigHeadController.do?goUpdate");
_jspx_th_t_dgToolBar_3.setFunname("detail");
_jspx_th_t_dgToolBar_3.setHeight("450");
_jspx_th_t_dgToolBar_3.setWidth("1200");
int _jspx_eval_t_dgToolBar_3 = _jspx_th_t_dgToolBar_3.doStartTag();
if (_jspx_th_t_dgToolBar_3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_t_dgToolBar_width_url_title_icon_height_funname_nobody.reuse(_jspx_th_t_dgToolBar_3);
return true;
}
_jspx_tagPool_t_dgToolBar_width_url_title_icon_height_funname_nobody.reuse(_jspx_th_t_dgToolBar_3);
return false;
}
}
| [
"[email protected]"
]
| |
898267a6b9048d402ae68a94083a796f82931bb9 | 34c1c83d0eff2755babb4a47a8fd97b6a2abd621 | /.svn/pristine/70/70d408b3dbd60a4ad4252bdf7859eef49c2a77cb.svn-base | 5aebd07125a05f4ccc1dc0f78d9bc23678932522 | []
| no_license | marionlxy/tsp | 8bedf3bc5a05bbf1c61104b196eb94862ff19536 | 0417367058574be3e4feb6c941b2ef12fa3e7e49 | refs/heads/master | 2022-04-09T13:57:41.644110 | 2018-05-11T08:47:17 | 2018-05-11T08:47:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,481 | package cn.spacewalker.tsp.bg.tbox.client;
import cn.spacewalker.tsp.bg.pojo.dto.Gbt32960Msg;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* This file is part of lightsaber Project
* Created by bzzz ([email protected]) on 2017/7/11 11:18
* Copyright (c) 2017 www.space-walker.cn
*
*/
public class TBoxEncoder extends MessageToByteEncoder<Gbt32960Msg> {
private Logger log = LogManager.getLogger(this.getClass().getName());
private static int count = 0;
@Override
protected void encode(ChannelHandlerContext channelHandlerContext, Gbt32960Msg gbt32960Msg, ByteBuf byteBuf) throws Exception {
byteBuf.writeBytes(gbt32960Msg.getStartSymbol().getBytes());
byteBuf.writeByte(gbt32960Msg.getCommandSymbol());
byteBuf.writeByte(gbt32960Msg.getResponseSymbol());
byteBuf.writeBytes(gbt32960Msg.getVin().getBytes());
byteBuf.writeByte(gbt32960Msg.getEncryptWay());
byte[] contentBytes = gbt32960Msg.getContent();
byteBuf.writeShort(contentBytes.length);
byteBuf.writeBytes(contentBytes);
byteBuf.writeByte(gbt32960Msg.getCheckPoint());
log.info("{}写数据channelHandlerContext {}, gbt32960Msg {}, byteBuf.writeableBytes {}", count++, channelHandlerContext, gbt32960Msg, byteBuf.writableBytes());
}
}
| [
"[email protected]"
]
| ||
be7a989eecdd4d5eda2b12b283f31dabfd37247d | 31acb85de141c9efe4d658f93482035b4060a697 | /client/src/client/UploadMessage.java | 2b8a6b586509100f9b017f96d8a5c357b504890f | [
"Apache-2.0"
]
| permissive | drewtconyers/Asteria-Art-Auction-House | d2adcb7bfdc3f75dc848f3c0c5419b030faea603 | 223485c89f08cf7a7f38c2a701c5862240446690 | refs/heads/main | 2023-08-26T12:43:57.241448 | 2021-11-04T20:34:12 | 2021-11-04T20:34:12 | 374,731,619 | 0 | 0 | null | 2021-11-04T20:34:13 | 2021-06-07T16:25:59 | Java | UTF-8 | Java | false | false | 2,211 | java | /*
* EE422C Final Project submission by
* Drew Conyers
* dtc888
* 17115
* Spring 2021
*/
package client;
/**
* UploadMessage sent to Client
*/
public class UploadMessage {
String type;
String artworkTitle;
String owner;
String encodedImage;
String details;
String bidderName;
String bidHistory;
String username;
int hour;
int minute;
int piece_number;
double bidUSD;
double startingBid;
double purchasePrice;
double user_funds;
/*
For refresh
*/
public UploadMessage(String type) {
this.type = type;
}
/*
For purchase
*/
public UploadMessage(String type, String username, double purchasePrice, int piece_number, double user_funds, String owner){
this.type = type;
this.username = username;
this.purchasePrice = purchasePrice;
this.piece_number = piece_number;
this.user_funds = user_funds;
this.owner = owner;
System.out.println("client-side message created");
}
/*
For bid
*/
public UploadMessage(String type, String bidderName, String artworkTitle, double bidUSD, int piece_number, String bidHistory) {
this.type = type;
this.bidderName = bidderName;
this.artworkTitle = artworkTitle;
this.bidUSD = bidUSD;
this.piece_number = piece_number;
this.bidHistory = bidHistory;
System.out.println("client-side message created");
}
/*
For artwork upload
*/
public UploadMessage(String artworkTitle, String owner, String encodedImage, String details, double startingBid, double purchasePrice, String bidHistory, int hour, int minute) {
this.type = "upload";
this.artworkTitle = artworkTitle;
this.owner = owner;
this.encodedImage = encodedImage;
this.details = details;
this.startingBid = startingBid;
this.purchasePrice = purchasePrice;
this.bidHistory = bidHistory;
this.hour = hour;
this.minute = minute;
System.out.println("client-side message created");
}
}
| [
"[email protected]"
]
| |
a972af870f7cbd11f922410ba6e4f2987d18ed17 | 43adde60459600c8605ac695c0e63f3ef35f53e7 | /src/main/java/com/store/buysmart/service/JwtUserDetailsService.java | ea9e56a869f14e54711ec57687fa2e8da80d39cd | []
| no_license | sahilagrawal15/Store-application | 96d8f484f7bcb9f62a024affe9cd44551cfd1058 | 6ce574ce668a1e813193252b458c8938b0de6aef | refs/heads/master | 2023-07-12T00:45:05.598409 | 2021-03-27T11:12:00 | 2021-03-27T11:12:00 | 351,781,088 | 0 | 0 | null | 2021-03-27T11:12:01 | 2021-03-26T12:51:32 | Java | UTF-8 | Java | false | false | 885 | java | package com.store.buysmart.service;
import java.util.ArrayList;
import org.springframework.security.core.userdetails.User;
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;
@Service
public class JwtUserDetailsService implements UserDetailsService {
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
if ("root".equals(username)) {
return new User("root", "$2a$10$slYQmyNdGzTn7ZLBXBChFOC9f6kFjAqPhccnP6DxlWXx2lPk1C3G6",
new ArrayList<>());
} else {
throw new UsernameNotFoundException("User not found with username: " + username);
}
}
}
| [
"[email protected]"
]
| |
c5c6581de8ee63d0ff3ce7b6d6c7e2f877e943e3 | ccc2ce7a5135a135b87dd93522f5560ed46e2615 | /aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNode.java | 910a09175438de2eda7664392006754e542c6176 | [
"Apache-2.0"
]
| permissive | isabella232/ws-axiom | 30483d61ed61f5af9158b1c6c634f7ba03bb7131 | 7cc750e739d15e12daf9c7cb999f27567af47c29 | refs/heads/master | 2023-09-03T19:10:43.045991 | 2021-09-30T03:15:25 | 2021-10-02T11:33:25 | 418,875,014 | 0 | 0 | null | 2021-10-19T11:38:36 | 2021-10-19T10:26:36 | null | UTF-8 | Java | false | false | 2,899 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.axiom.core;
import org.apache.axiom.core.stream.StreamException;
import org.apache.axiom.core.stream.XmlHandler;
public interface CoreNode {
/**
* Get the owner document to which this node belongs.
*
* @param create
* indicates whether the owner document should be created if it has not been created
* yet
* @return the owner document or <code>null</code> if the owner document has not been created
* yet and <code>create</code> is <code>false</code>
*/
CoreDocument coreGetOwnerDocument(boolean create);
CoreNode getRootOrOwnerDocument();
boolean coreHasSameOwnerDocument(CoreNode other);
void coreSetOwnerDocument(CoreDocument document);
NodeFactory coreGetNodeFactory();
<T extends CoreNode> T coreCreateNode(Class<T> type);
/**
* Get the node type.
*
* @return the node type
*/
NodeType coreGetNodeType();
Class<? extends CoreNode> coreGetNodeClass();
/**
* Clone this node according to the provided policy.
*
* @param policy
* the policy to use when cloning this node (and its children)
* @return the clone of this node
*/
<T> CoreNode coreClone(ClonePolicy<T> policy, T options) throws CoreModelException;
<T> void init(ClonePolicy<T> policy, T options, CoreNode other) throws CoreModelException;
<T> void cloneChildrenIfNecessary(ClonePolicy<T> policy, T options, CoreNode clone) throws CoreModelException;
void internalSerialize(XmlHandler handler, boolean cache) throws CoreModelException, StreamException;
boolean internalGetFlag(int flag);
void internalSetFlag(int flag, boolean value);
int internalGetFlags(int mask);
void internalSetFlags(int mask, int flags);
void updateFiliation(CoreNode creator);
<T> void initAncillaryData(ClonePolicy<T> policy, T options, CoreNode other);
<T> CoreNode internalClone(ClonePolicy<T> policy, T options, CoreParentNode targetParent) throws CoreModelException;
}
| [
"[email protected]"
]
| |
8cd3c8d2a104f213bd356fb22bd1d236ae87946b | ef08e13a52565c23bbac51678b427785b30d8edf | /src/main/java/io/pivotal/config/Config.java | f786617b37bb73fd19e6b14a8d5510086bd835e0 | []
| no_license | gbcm/cogs | 217d6049628614081400639b55ac99dced9f6334 | 0a83db652b2632c6c8cc053d0031d52902a7ff3a | refs/heads/master | 2021-01-10T11:16:52.756351 | 2016-02-17T23:44:56 | 2016-02-17T23:44:56 | 51,604,145 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 192 | java | package io.pivotal.config;
/**
* Created by pivotal on 2/12/16.
*/
public class Config {
public static String getDiscogsToken(){
return System.getenv("DISCOGS_TOKEN");
}
}
| [
"[email protected]"
]
| |
9f1fa196f8e680cebc6bff105806ed52d8cf5756 | 8d9293642d3c12f81cc5f930e0147a9d65bd6efb | /src/main/java/net/minecraft/server/rcon/thread/RconThread.java | c5a07ba84b45731d68f83084eeed50c9cd5aecfd | []
| no_license | NicholasBlackburn1/Blackburn-1.17 | 7c086591ac77cf433af248435026cf9275223daa | fd960b995b33df75ce61865ba119274d9b0e4704 | refs/heads/main | 2022-07-28T03:27:14.736924 | 2021-09-23T15:55:53 | 2021-09-23T15:55:53 | 399,960,376 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,802 | java | package net.minecraft.server.rcon.thread;
import com.google.common.collect.Lists;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.server.ServerInterface;
import net.minecraft.server.dedicated.DedicatedServerProperties;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class RconThread extends GenericThread {
private static final Logger LOGGER = LogManager.getLogger();
private final ServerSocket socket;
private final String rconPassword;
private final List<RconClient> clients = Lists.newArrayList();
private final ServerInterface serverInterface;
private RconThread(ServerInterface p_11608_, ServerSocket p_11609_, String p_11610_) {
super("RCON Listener");
this.serverInterface = p_11608_;
this.socket = p_11609_;
this.rconPassword = p_11610_;
}
private void clearClients() {
this.clients.removeIf((p_11612_) -> {
return !p_11612_.isRunning();
});
}
public void run() {
try {
while(this.running) {
try {
Socket socket = this.socket.accept();
RconClient rconclient = new RconClient(this.serverInterface, this.rconPassword, socket);
rconclient.start();
this.clients.add(rconclient);
this.clearClients();
} catch (SocketTimeoutException sockettimeoutexception) {
this.clearClients();
} catch (IOException ioexception) {
if (this.running) {
LOGGER.info("IO exception: ", (Throwable)ioexception);
}
}
}
} finally {
this.closeSocket(this.socket);
}
}
@Nullable
public static RconThread create(ServerInterface p_11616_) {
DedicatedServerProperties dedicatedserverproperties = p_11616_.getProperties();
String s = p_11616_.getServerIp();
if (s.isEmpty()) {
s = "0.0.0.0";
}
int i = dedicatedserverproperties.rconPort;
if (0 < i && 65535 >= i) {
String s1 = dedicatedserverproperties.rconPassword;
if (s1.isEmpty()) {
LOGGER.warn("No rcon password set in server.properties, rcon disabled!");
return null;
} else {
try {
ServerSocket serversocket = new ServerSocket(i, 0, InetAddress.getByName(s));
serversocket.setSoTimeout(500);
RconThread rconthread = new RconThread(p_11616_, serversocket, s1);
if (!rconthread.start()) {
return null;
} else {
LOGGER.info("RCON running on {}:{}", s, i);
return rconthread;
}
} catch (IOException ioexception) {
LOGGER.warn("Unable to initialise RCON on {}:{}", s, i, ioexception);
return null;
}
}
} else {
LOGGER.warn("Invalid rcon port {} found in server.properties, rcon disabled!", (int)i);
return null;
}
}
public void stop() {
this.running = false;
this.closeSocket(this.socket);
super.stop();
for(RconClient rconclient : this.clients) {
if (rconclient.isRunning()) {
rconclient.stop();
}
}
this.clients.clear();
}
private void closeSocket(ServerSocket p_11614_) {
LOGGER.debug("closeSocket: {}", (Object)p_11614_);
try {
p_11614_.close();
} catch (IOException ioexception) {
LOGGER.warn("Failed to close socket", (Throwable)ioexception);
}
}
} | [
"[email protected]"
]
| |
fc474ce577c547e199ecce60aa51dc251fefdcd4 | fa57912ba83ff172561e06ba645f2148a82a8125 | /src/com/chess/model/Setting.java | 6d26acc83895988c75e5db79323e1b7ab4743447 | []
| no_license | lpapailiou/chess | f07e59b4099a64a5eb6ab4412e3d10ed4be8d618 | 28beff8a668d4755f69f535a6e282dca6141c31e | refs/heads/master | 2021-07-12T09:13:30.202971 | 2021-07-09T17:27:14 | 2021-07-09T17:27:14 | 243,834,441 | 5 | 3 | null | 2021-07-09T17:27:15 | 2020-02-28T19:01:49 | Java | UTF-8 | Java | false | false | 4,833 | java | package com.chess.model;
import java.io.File;
import java.util.List;
import com.chess.root.FenParser;
import com.chess.root.PgnParser;
import javafx.scene.layout.GridPane;
public class Setting {
private GridPane boardGrid;
private boolean whiteUp;
private Mode mode;
private PieceValues pieceValue;
private Difficulty difficulty;
private boolean touched = true;
private boolean enpassantEnabled = true;
private boolean timeout = true;
private String[][] fenBoard;
private boolean blackPlays;
private String castlingOptions;
private String passingPiece;
private int countdown;
private Double moveCounter = 1.0;
private String[] pgnMeta;
private List<String> pgnMoves;
private boolean hasPgn;
private boolean hasFen;
public Setting(boolean whiteUp, Mode mode, PieceValues pieceValue, Difficulty difficulty) {
this.whiteUp = whiteUp;
this.mode = mode;
this.pieceValue = pieceValue;
this.difficulty = difficulty;
}
// ---------------------------------- PGN HANDLING ----------------------------------
public boolean hasPgn() {
return hasPgn;
}
public void addPgn(File file) {
String s = PgnParser.getFileContent(file);
addPgn(s);
}
public void addPgn(String s) {
hasPgn = true;
setPgnMeta(s);
setPgnMoves();
}
private void setPgnMeta(String s) {
if (s != null) {
pgnMeta = s.split("]");
}
}
public String[] getPgnMeta() {
return pgnMeta;
}
private void setPgnMoves() {
String pgnMoveData = null;
if (pgnMeta != null) {
pgnMoveData = pgnMeta[pgnMeta.length-1];
}
if (pgnMoveData != null) {
pgnMoves = PgnParser.parseMoves(pgnMoveData);
}
}
public String getDifficultyName() {
return difficulty.get();
}
public String getWhite() {
String player = PgnParser.getWhite(this);
if (player == null) {
if (mode == Mode.AI_ONLY || (mode == Mode.MANUAL_VS_AI && !whiteUp)) {
player = "Thought, Deep";
} else {
player = "Doe, Jane";
}
}
return player;
}
public String getBlack() {
String player = PgnParser.getBlack(this);
if (player == null) {
if (mode == Mode.AI_ONLY || (mode == Mode.MANUAL_VS_AI && whiteUp)) {
player = "Blue, Deep";
} else {
player = "Doe, John";
}
}
return player;
}
public List<String> getPgnMoves() {
return pgnMoves;
}
// ---------------------------------- FEN HANDLING ----------------------------------
public String[][] getFenBoard() {
return fenBoard;
}
public void setFenBoard(String[][] f) {
if (f != null) {
hasFen = true;
fenBoard = f;
}
}
public boolean hasFen() {
return hasFen;
}
public void setCompleteFen(String[] completeFen) {
for (int i = 0; i < completeFen.length; i++) {
switch(i) {
case 1:
blackPlays = completeFen[i].contentEquals("b");
break;
case 2:
castlingOptions = completeFen[i];
break;
case 3:
passingPiece = completeFen[i];
break;
case 4:
countdown = FenParser.parseInteger(completeFen[i]);
break;
case 5:
moveCounter = FenParser.parseMoveCounter(completeFen[i]);
break;
default:
break;
}
}
}
public boolean getFenPlayer() {
return blackPlays;
}
public String getFenCastlingOptions() {
return castlingOptions;
}
public String getFenPassingPiece() {
return passingPiece;
}
public int getFenCountdown() {
int c = countdown;
c *= 2;
if (blackPlays) {
c++;
}
return c;
}
public Double getFenMoveCounter() {
if (moveCounter != null) {
return moveCounter;
}
return 1.0;
}
public String getFenMoveCounterString() {
if (moveCounter != null) {
return moveCounter.toString();
}
return "1.0";
}
// ---------------------------------- GENERIC SETTERS AND GETTERS ----------------------------------
public void setGrid(GridPane boardGrid) {
this.boardGrid = boardGrid;
}
public GridPane getGrid() {
return boardGrid;
}
public void setColor(boolean whiteUp) {
this.whiteUp = whiteUp;
}
public boolean getColor() {
return whiteUp;
}
public void setMode(Mode mode) {
this.mode = mode;
}
public Mode getMode() {
return mode;
}
public void setPieceValue(PieceValues pieceValue) {
this.pieceValue = pieceValue;
}
public PieceValues getPieceValue() {
return pieceValue;
}
public void setDifficulty(Difficulty difficulty) {
this.difficulty = difficulty;
}
public Difficulty getDifficulty() {
return this.difficulty;
}
public boolean getPassing() {
return enpassantEnabled;
}
public void setPassing(boolean passing) {
enpassantEnabled = passing;
}
public boolean getTouched() {
return touched;
}
public void setTouched(boolean touched) {
this.touched = touched;
}
public boolean getTimeout() {
return timeout;
}
public void setTimeout(boolean timeout) {
this.timeout = timeout;
}
}
| [
"[email protected]"
]
| |
120283ed95da14db36ab56f703eae02d22f8255d | f913007bdc842b9614adb672a084cec9a7f5c580 | /src/com/addr/dao/AddressDAO.java | 0e30ef1875cf21c9ec8b8ec109f32792e44df8bb | []
| no_license | BBongkook/addr | ad02e1261f6728d42a948397d0f4393a974ba803 | 8ae12e93f20d39d659b1286e2c5f005c701d1ed9 | refs/heads/master | 2020-05-04T14:58:16.901281 | 2019-04-03T08:29:44 | 2019-04-03T08:29:44 | 179,217,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | package com.addr.dao;
import java.util.List;
import java.util.Map;
public interface AddressDAO {
public int insertAddressList(List<Map<String,String>> addrList);
}
| [
"Administrator@USER-PC"
]
| Administrator@USER-PC |
d73be90868d69e776d559dec36ea0ed28b98d1ec | ca8995be0cefe94c3e998e9f879706de81bf9659 | /src/main/java/org/g52/project/Position.java | 03113aed0adc8a96f723bd30d6ad2e8d6fb6b952 | []
| no_license | Trash-Bud/LPOO | 333e695894aea94c372ded42b27ebfa249202b7a | 48bf01e1474f49815e7d108fb243e9d0bdd61e44 | refs/heads/main | 2023-08-20T10:13:21.255522 | 2021-10-05T20:44:42 | 2021-10-05T20:44:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 644 | java | package org.g52.project;
import java.util.Objects;
public class Position {
private int x;
private int y;
public Position(int x, int y){
this.x = x;
this.y = y;
}
public int getX(){
return this.x;
}
public int getY(){
return this.y;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Position position = (Position) o;
return x == position.x && y == position.y;
}
@Override
public int hashCode() {
return Objects.hash(x, y);
}
}
| [
"[email protected]"
]
| |
6629e670e601574b190a1570a07a0c03649b3c44 | 5eaa89266df339afeb13b2176cdc761e12a714d4 | /app/src/androidTest/java/com/example/sindhu/pixabayimagesapp/ExampleInstrumentedTest.java | aa1f0f973918d4285443121f0a6aa1b4c1f5a7c3 | []
| no_license | poornasindhuja/PixabayImagesApp | c3a4cfafc965b92b5d4001afa68250a32c861301 | cad112a6b1c1271b378777f2702ff4978bfc26fe | refs/heads/master | 2020-04-28T10:53:47.406774 | 2019-03-13T06:06:31 | 2019-03-13T06:06:31 | 175,218,103 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 754 | java | package com.example.sindhu.pixabayimagesapp;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.sindhu.pixabayimagesapp", appContext.getPackageName());
}
}
| [
"[email protected]"
]
| |
a678baf609ba3b392e32fa7ebe7bc9730270312f | cc494be3a62c4b2f5db70b19efd1e9c6ab3af002 | /src/main/java/com/group7/edu/entity/SysCourse.java | 48463549fb1b038812349a9aaff9911d470669d8 | []
| no_license | FerYyjs/OnlineEducationProject | 784291e0a3261c235f3e391cb8016f9cc8bc0f12 | 5ee58eb771f18bc6bcdf7a66b04966d72241ae7f | refs/heads/master | 2020-05-05T10:59:40.150600 | 2019-04-07T13:25:53 | 2019-04-07T13:25:53 | 179,969,883 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,442 | java | package com.group7.edu.entity;
import java.math.BigDecimal;
import java.util.Date;
public class SysCourse {
private Integer id;
private String name;
private Integer lecturer;
private String category;
private String coverUrl;
private BigDecimal price;
private BigDecimal origPrice;
private Integer subject;
private Date createdTime;
private Date starttime;
private Date terminalTime;
private String courseText;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Integer getLecturer() {
return lecturer;
}
public void setLecturer(Integer lecturer) {
this.lecturer = lecturer;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category == null ? null : category.trim();
}
public String getCoverUrl() {
return coverUrl;
}
public void setCoverUrl(String coverUrl) {
this.coverUrl = coverUrl == null ? null : coverUrl.trim();
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public BigDecimal getOrigPrice() {
return origPrice;
}
public void setOrigPrice(BigDecimal origPrice) {
this.origPrice = origPrice;
}
public Integer getSubject() {
return subject;
}
public void setSubject(Integer subject) {
this.subject = subject;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Date getStarttime() {
return starttime;
}
public void setStarttime(Date starttime) {
this.starttime = starttime;
}
public Date getTerminalTime() {
return terminalTime;
}
public void setTerminalTime(Date terminalTime) {
this.terminalTime = terminalTime;
}
public String getCourseText() {
return courseText;
}
public void setCourseText(String courseText) {
this.courseText = courseText == null ? null : courseText.trim();
}
} | [
"[email protected]"
]
| |
8c8f24c30b4b5c31d940d17c8bae6b9bcdf5b7f2 | 6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386 | /google/cloud/documentai/v1beta3/google-cloud-documentai-v1beta3-java/proto-google-cloud-documentai-v1beta3-java/src/main/java/com/google/cloud/documentai/v1beta3/EnableProcessorResponseOrBuilder.java | 15816725042718ae1754a9c55b490237757e5167 | [
"Apache-2.0"
]
| permissive | oltoco/googleapis-gen | bf40cfad61b4217aca07068bd4922a86e3bbd2d5 | 00ca50bdde80906d6f62314ef4f7630b8cdb6e15 | refs/heads/master | 2023-07-17T22:11:47.848185 | 2021-08-29T20:39:47 | 2021-08-29T20:39:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 393 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/documentai/v1beta3/document_processor_service.proto
package com.google.cloud.documentai.v1beta3;
public interface EnableProcessorResponseOrBuilder extends
// @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta3.EnableProcessorResponse)
com.google.protobuf.MessageOrBuilder {
}
| [
"bazel-bot-development[bot]@users.noreply.github.com"
]
| bazel-bot-development[bot]@users.noreply.github.com |
d37e152ed8182cfac61e5ec981f2a13ed31a6ecb | 9a2430a661f1fd34cac6499a833649b09ac0712b | /src/main/java/com/javaproje/alisveris/sayfalar/mymainpage/HomeViewModel.java | 09485bad854043e6c4f460dab9d599b018187645 | []
| no_license | aktasdeniz/BLM5218_SemesterProject | 6ae98e6dc48ca7a063e355af3d620ea4a9f5f593 | 681dd9797c1e46544c100f3194114c196da2ec95 | refs/heads/main | 2023-06-06T03:40:43.819330 | 2021-06-26T14:35:38 | 2021-06-26T14:35:38 | 380,518,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | package com.javaproje.alisveris.sayfalar.mymainpage;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class HomeViewModel extends ViewModel {
private MutableLiveData < String > mText;
public HomeViewModel() {
mText = new MutableLiveData < > ();
mText.setValue("This is home fragment");
}
public LiveData < String > getText() {
return mText;
}
} | [
"[email protected]"
]
| |
e4c3779bad171e768469d79ac4be5cd7a8502463 | ab30e18d4bb32d557e8a66001443c88e0d7af8e9 | /app/src/main/java/com/johhns/BaseDatos_Semana_5/Presentador/PresentadorMascotas.java | acdc508848bb3024f766302569cb805dd3554810 | []
| no_license | johhns/Fragmentos_Semana_4 | 91984b8645624a82957add124841326472351100 | 21834c4be4821c3b77bd3cf76c67f256a650c10d | refs/heads/master | 2023-07-25T11:01:58.632819 | 2021-08-31T11:35:06 | 2021-08-31T11:35:06 | 399,443,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,171 | java | package com.johhns.BaseDatos_Semana_5.Presentador;
import android.content.Context;
import com.johhns.BaseDatos_Semana_5.Modelo.Mascota;
import com.johhns.BaseDatos_Semana_5.Vista.Fragmentos.InterfaseFragmentoMascota;
import com.johhns.BaseDatos_Semana_5.Modelo.ConstructorMascotas;
import java.util.ArrayList;
public class PresentadorMascotas implements InterfasePresentadorMascota {
private InterfaseFragmentoMascota iRVFragmento ;
private Context contexto ;
private ConstructorMascotas constructorMascota ;
private ArrayList<Mascota> mascotas ;
public PresentadorMascotas( InterfaseFragmentoMascota iRVFragmento, Context contexto ) {
this.iRVFragmento = iRVFragmento ;
this.contexto = contexto ;
obtenerMascotas();
}
@Override
public void obtenerMascotas() {
constructorMascota = new ConstructorMascotas( contexto ) ;
mascotas = constructorMascota.obtenerDatos() ;
mostrarMascotasRV();
}
@Override
public void mostrarMascotasRV() {
iRVFragmento.inicializarAdaptadorRV(iRVFragmento.crearAdaptador(mascotas));
iRVFragmento.generarLinearLayoutVertical();
}
}
| [
"[email protected]"
]
| |
99937f50325d82d2f3c530f0bce064c72b713026 | d7dd944405fffa7806649146b36333a18764b650 | /src/patterns/InvertedHourGlass.java | 97fa4649a1577aa40696b1a92b9e8321ffaf693d | []
| no_license | srishtivishnoi2102/java-cb | 63809745bb6de0d9641fa9cc07625393a0c130b1 | 68a1c348bdaa5a334ced352c67d4387184d8dcb3 | refs/heads/master | 2022-11-22T12:47:08.575157 | 2020-07-24T09:48:16 | 2020-07-24T09:48:16 | 281,688,890 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,429 | java | package patterns;
/*
*
*
* Take N as input. For a value of N=5, we wish to draw the following pattern :
5 5
5 4 4 5
5 4 3 3 4 5
5 4 3 2 2 3 4 5
5 4 3 2 1 1 2 3 4 5
5 4 3 2 1 0 1 2 3 4 5
5 4 3 2 1 1 2 3 4 5
5 4 3 2 2 3 4 5
5 4 3 3 4 5
5 4 4 5
5 5
*
*/
import java.util.Scanner;
public class InvertedHourGlass {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
for(int r=n;r>=0;r--) {
for(int c=n;c>=0;c--) {
if(c>=r) {
System.out.print(c+" ");
}else {
System.out.print(" ");
}
}
for(int c=1;c<=n;c++) {
if(c>=r) {
System.out.print(c+" ");
}else {
System.out.print(" ");
}
}
System.out.println("");
}
for(int r=1;r<=n;r++) {
for(int c=n;c>=0;c--) {
if(c>=r) {
System.out.print(c+" ");
}else {
System.out.print(" ");
}
}
for(int c=1;c<=n;c++) {
if(c>=r) {
System.out.print(c+" ");
}else {
System.out.print(" ");
}
}
System.out.println("");
}
}
} | [
"[email protected]"
]
| |
b411e06c27ac056eaa6b8ad0c22235797c1bcb48 | f545f5044bb03a4e7aa0e44bbf5c4a96f3ac730c | /net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/wizards/NewProjectWizardPage.java | a3d7fdaf4eb94281f8c48c7f2aa9c54363c8c420 | []
| no_license | ttencate/eclipsefp | 03976890ba9ee1bb2845ff3e018d29aa1b809073 | be58d532f17b39bed48a3e42b99e23b0299ce940 | refs/heads/master | 2021-01-17T23:25:22.126519 | 2009-08-27T19:08:55 | 2009-08-27T19:08:55 | 240,522 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,313 | java | /*******************************************************************************
* Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package net.sf.eclipsefp.haskell.ui.internal.wizards;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.Observable;
import java.util.Observer;
import net.sf.eclipsefp.haskell.ui.HaskellUIPlugin;
import net.sf.eclipsefp.haskell.ui.dialog.Validator;
import net.sf.eclipsefp.haskell.ui.dialog.ValidatorManager;
import net.sf.eclipsefp.haskell.ui.dialog.dialogfields.DialogField;
import net.sf.eclipsefp.haskell.ui.dialog.dialogfields.IDialogFieldListener;
import net.sf.eclipsefp.haskell.ui.dialog.dialogfields.IStringButtonAdapter;
import net.sf.eclipsefp.haskell.ui.dialog.dialogfields.LayoutUtil;
import net.sf.eclipsefp.haskell.ui.dialog.dialogfields.SelectionButtonDialogField;
import net.sf.eclipsefp.haskell.ui.dialog.dialogfields.StringButtonDialogField;
import net.sf.eclipsefp.haskell.ui.dialog.dialogfields.StringDialogField;
import net.sf.eclipsefp.haskell.ui.internal.util.UITexts;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
/**
* Largely a copy of org.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageOne.
*
* It would make sense to extend {@link WizardNewProjectCreationPage}. However,
* that class does not allow setting the project name, so then we couldn't set
* the project name based on the directory name of the existing source.
*
* @author Thomas ten Cate
*/
public class NewProjectWizardPage extends WizardPage {
/**
* Request a project name. Fires an event whenever the text field is
* changed, regardless of its content.
*/
private final class NameGroup extends Observable implements IDialogFieldListener {
protected final StringDialogField fNameField;
public NameGroup() {
// text field for project name
fNameField= new StringDialogField();
fNameField.setLabelText(UITexts.newProjectWizardPage_NameGroup_label_text);
fNameField.setDialogFieldListener(this);
}
public Control createControl(final Composite composite) {
Composite nameComposite= new Composite(composite, SWT.NONE);
nameComposite.setFont(composite.getFont());
nameComposite.setLayout(initGridLayout(new GridLayout(2, false), false));
fNameField.doFillIntoGrid(nameComposite, 2);
LayoutUtil.setHorizontalGrabbing(fNameField.getTextControl(null));
return nameComposite;
}
protected void fireEvent() {
setChanged();
notifyObservers();
}
public String getName() {
return fNameField.getText().trim();
}
public void postSetFocus() {
fNameField.postSetFocusOnDialogField(getShell().getDisplay());
}
public void setName(final String name) {
fNameField.setText(name);
}
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener#dialogFieldChanged(org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField)
*/
public void dialogFieldChanged(final DialogField field) {
fireEvent();
}
}
/**
* Request a location. Fires an event whenever the checkbox or the location
* field is changed, regardless of whether the change originates from the
* user or has been invoked programmatically.
*/
private final class LocationGroup extends Observable implements Observer, IStringButtonAdapter, IDialogFieldListener {
protected final SelectionButtonDialogField fWorkspaceRadio;
protected final SelectionButtonDialogField fExternalRadio;
protected final StringButtonDialogField fLocation;
private String fPreviousExternalLocation;
private final String DIALOGSTORE_LAST_EXTERNAL_LOC= HaskellUIPlugin.getPluginId() + ".last.external.project"; //$NON-NLS-1$
public LocationGroup() {
fWorkspaceRadio= new SelectionButtonDialogField(SWT.RADIO);
fWorkspaceRadio.setDialogFieldListener(this);
fWorkspaceRadio.setLabelText(UITexts.newProjectWizardPage_LocationGroup_workspace_desc);
fExternalRadio= new SelectionButtonDialogField(SWT.RADIO);
fExternalRadio.setLabelText(UITexts.newProjectWizardPage_LocationGroup_external_desc);
fLocation= new StringButtonDialogField(this);
fLocation.setDialogFieldListener(this);
fLocation.setLabelText(UITexts.newProjectWizardPage_LocationGroup_locationLabel_desc);
fLocation.setButtonLabel(UITexts.newProjectWizardPage_LocationGroup_browseButton_desc);
fExternalRadio.attachDialogField(fLocation);
fWorkspaceRadio.setSelection(true);
fExternalRadio.setSelection(false);
fPreviousExternalLocation= ""; //$NON-NLS-1$
}
public Control createControl(final Composite composite) {
final int numColumns= 3;
final Group group= new Group(composite, SWT.NONE);
group.setLayout(initGridLayout(new GridLayout(numColumns, false), true));
group.setText(UITexts.newProjectWizardPage_LocationGroup_title);
fWorkspaceRadio.doFillIntoGrid(group, numColumns);
fExternalRadio.doFillIntoGrid(group, numColumns);
fLocation.doFillIntoGrid(group, numColumns);
LayoutUtil.setHorizontalGrabbing(fLocation.getTextControl(null));
return group;
}
protected void fireEvent() {
setChanged();
notifyObservers();
}
protected String getDefaultPath(final String name) {
final IPath path= Platform.getLocation().append(name);
return path.toOSString();
}
/* (non-Javadoc)
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
*/
public void update(final Observable o, final Object arg) {
if (isWorkspaceRadioSelected()) {
fLocation.setText(getDefaultPath(getProjectName()));
}
fireEvent();
}
public IPath getLocation() {
if (isWorkspaceRadioSelected()) {
return Platform.getLocation();
}
return Path.fromOSString(fLocation.getText().trim());
}
public boolean isWorkspaceRadioSelected() {
return fWorkspaceRadio.isSelected();
}
/**
* Returns <code>true</code> if the location is in the workspace
*
* @return <code>true</code> if the location is in the workspace
*/
public boolean isLocationInWorkspace() {
final String location= fLocationGroup.getLocation().toOSString();
IPath projectPath= Path.fromOSString(location);
return Platform.getLocation().isPrefixOf(projectPath);
}
public void setLocation(final IPath path) {
fWorkspaceRadio.setSelection(path == null);
if (path != null) {
fLocation.setText(path.toOSString());
} else {
fLocation.setText(getDefaultPath(getProjectName()));
}
fireEvent();
}
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IStringButtonAdapter#changeControlPressed(org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField)
*/
public void changeControlPressed(final DialogField field) {
final DirectoryDialog dialog= new DirectoryDialog(getShell());
dialog.setMessage(UITexts.newProjectWizardPage_directory_message);
String directoryName = fLocation.getText().trim();
if (directoryName.length() == 0) {
String prevLocation= HaskellUIPlugin.getDefault().getDialogSettings().get(DIALOGSTORE_LAST_EXTERNAL_LOC);
if (prevLocation != null) {
directoryName= prevLocation;
}
}
if (directoryName.length() > 0) {
final File path = new File(directoryName);
if (path.exists()) {
dialog.setFilterPath(directoryName);
}
}
final String selectedDirectory = dialog.open();
if (selectedDirectory != null) {
String oldDirectory= new Path(fLocation.getText().trim()).lastSegment();
fLocation.setText(selectedDirectory);
String lastSegment= new Path(selectedDirectory).lastSegment();
if (lastSegment != null && (getProjectName().length() == 0 || getProjectName().equals(oldDirectory))) {
setProjectName(lastSegment);
}
HaskellUIPlugin.getDefault().getDialogSettings().put(DIALOGSTORE_LAST_EXTERNAL_LOC, selectedDirectory);
}
}
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener#dialogFieldChanged(org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField)
*/
public void dialogFieldChanged(final DialogField field) {
if (field == fWorkspaceRadio) {
final boolean checked= fWorkspaceRadio.isSelected();
if (checked) {
fPreviousExternalLocation= fLocation.getText();
fLocation.setText(getDefaultPath(fNameGroup.getName()));
} else {
fLocation.setText(fPreviousExternalLocation);
}
}
fireEvent();
}
}
/**
* Validate this page and show appropriate warnings and error NewWizardMessages.
*/
private final class PageValidator extends Validator {
public PageValidator( final ValidatorManager manager ) {
super( manager );
}
@Override
protected void doUpdate() {
final IWorkspace workspace= ResourcesPlugin.getWorkspace();
final String name= fNameGroup.getName();
// check whether the project name field is empty
if (name.length() == 0) {
setErrorMessage(null);
setMessage(UITexts.newProjectWizardPage_Message_enterProjectName);
setPageComplete(false);
return;
}
// check whether the project name is valid
final IStatus nameStatus= workspace.validateName(name, IResource.PROJECT);
if (!nameStatus.isOK()) {
setErrorMessage(nameStatus.getMessage());
setPageComplete(false);
return;
}
// check whether project already exists
final IProject handle= workspace.getRoot().getProject(name);
if (handle.exists()) {
setErrorMessage(UITexts.newProjectWizardPage_Message_projectAlreadyExists);
setPageComplete(false);
return;
}
IPath projectLocation= ResourcesPlugin.getWorkspace().getRoot().getLocation().append(name);
if (projectLocation.toFile().exists()) {
try {
//correct casing
String canonicalPath= projectLocation.toFile().getCanonicalPath();
projectLocation= new Path(canonicalPath);
} catch (IOException e) {
HaskellUIPlugin.log(e);
}
String existingName= projectLocation.lastSegment();
if (!existingName.equals(fNameGroup.getName())) {
setErrorMessage(NLS.bind(UITexts.newProjectWizardPageMessage_invalidProjectNameForWorkspaceRoot, existingName));
setPageComplete(false);
return;
}
}
final String location= fLocationGroup.getLocation().toOSString();
// check whether location is empty
if (location.length() == 0) {
setErrorMessage(null);
setMessage(UITexts.newProjectWizardPage_Message_enterLocation);
setPageComplete(false);
return;
}
// check whether the location is a syntactically correct path
if (!Path.EMPTY.isValidPath(location)) {
setErrorMessage(UITexts.newProjectWizardPage_Message_invalidDirectory);
setPageComplete(false);
return;
}
IPath projectPath= Path.fromOSString(location);
if (fLocationGroup.isWorkspaceRadioSelected()) {
projectPath= projectPath.append(fNameGroup.getName());
}
if (projectPath.toFile().exists()) {//create from existing source
if (Platform.getLocation().isPrefixOf(projectPath)) { //create from existing source in workspace
if (!Platform.getLocation().equals(projectPath.removeLastSegments(1))) {
setErrorMessage(UITexts.newProjectWizardPage_Message_notOnWorkspaceRoot);
setPageComplete(false);
return;
}
if (!projectPath.toFile().exists()) {
setErrorMessage(UITexts.newProjectWizardPage_Message_notExisingProjectOnWorkspaceRoot);
setPageComplete(false);
return;
}
}
} else if (!fLocationGroup.isWorkspaceRadioSelected()) {//create at non existing external location
if (!canCreate(projectPath.toFile())) {
setErrorMessage(UITexts.newProjectWizardPage_Message_cannotCreateAtExternalLocation);
setPageComplete(false);
return;
}
// If we do not place the contents in the workspace validate the
// location.
final IStatus locationStatus= workspace.validateProjectLocation(handle, projectPath);
if (!locationStatus.isOK()) {
setErrorMessage(locationStatus.getMessage());
setPageComplete(false);
return;
}
}
setPageComplete(true);
setErrorMessage(null);
setMessage(null);
}
private boolean canCreate(final File file) {
File parent = file;
while (!parent.exists()) {
parent= parent.getParentFile();
if (parent == null) {
return false;
}
}
return parent.canWrite();
}
}
private static final String PAGE_NAME= "NewProjectWizardPage"; //$NON-NLS-1$
private final ValidatorManager fValidatorManager;
private PageValidator fValidator;
private final NameGroup fNameGroup;
private final LocationGroup fLocationGroup;
public NewProjectWizardPage() {
this(PAGE_NAME);
}
public NewProjectWizardPage( final String pageName ) {
super( pageName );
fNameGroup= new NameGroup();
fLocationGroup= new LocationGroup();
// establish connections
fNameGroup.addObserver(fLocationGroup);
// initialize all elements
fNameGroup.notifyObservers();
// create and connect validator
fValidatorManager= new ValidatorManager(this);
createValidators( fValidatorManager );
fNameGroup.addObserver(fValidator);
fLocationGroup.addObserver(fValidator);
// initialize defaults
setProjectName(""); //$NON-NLS-1$
setProjectLocationURI(null);
}
/**
* Subclasses may override to add additional validators,
* but must call the superclass method.
*/
protected void createValidators(final ValidatorManager manager) {
fValidator = new PageValidator(manager);
}
protected ValidatorManager getValidatorManager() {
return fValidatorManager;
}
/**
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*
* Subclasses should not override; rather, override {@link #createControls}.
*/
public void createControl(final Composite parent) {
initializeDialogUnits(parent);
final Composite composite= new Composite(parent, SWT.NULL);
composite.setFont(parent.getFont());
composite.setLayout(initGridLayout(new GridLayout(1, false), true));
composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
createControls(composite);
setControl(composite);
fValidatorManager.fullUpdate();
}
/**
* Creates the controls within this page.
* Subclasses may override.
*/
protected void createControls(final Composite composite) {
createNameControl(composite);
createLocationControl(composite);
}
/**
* Creates the controls for the name field.
*
* @param composite the parent composite
* @return the created control
*/
protected Control createNameControl(final Composite composite) {
Control nameControl = fNameGroup.createControl(composite);
nameControl.setLayoutData(horizontalFillGridData());
return nameControl;
}
/**
* Creates the controls for the location field.
*
* @param composite the parent composite
* @return the created control
*/
protected Control createLocationControl(final Composite composite) {
Control locationControl = fLocationGroup.createControl(composite);
locationControl.setLayoutData(horizontalFillGridData());
return locationControl;
}
/**
* Gets a project name for the new project.
*
* @return the new project resource handle
*/
public String getProjectName() {
return fNameGroup.getName();
}
/**
* Sets the name of the new project
*
* @param name the new name
*/
public void setProjectName(final String name) {
if (name == null) {
throw new IllegalArgumentException();
}
fNameGroup.setName(name);
}
/**
* Returns the current project location path as entered by the user, or <code>null</code>
* if the project should be created in the workspace.
* @return the project location path or its anticipated initial value.
*/
public URI getProjectLocationURI() {
if (fLocationGroup.isLocationInWorkspace()) {
return null;
}
return URIUtil.toURI(fLocationGroup.getLocation());
}
/**
* Sets the project location of the new project or <code>null</code> if the project
* should be created in the workspace
*
* @param uri the new project location
*/
public void setProjectLocationURI(final URI uri) {
IPath path= uri != null ? URIUtil.toPath(uri) : null;
fLocationGroup.setLocation(path);
}
/**
* Creates a project resource handle for the current project name field
* value. The project handle is created relative to the workspace root.
* <p>
* This method does not create the project resource; this is the
* responsibility of <code>IProject::create</code> invoked by the new
* project resource wizard.
* </p>
*
* @return the new project resource handle
*/
public IProject getProjectHandle() {
return ResourcesPlugin.getWorkspace().getRoot().getProject(
getProjectName());
}
/**
* Returns the current project location path as entered by
* the user, or its anticipated initial value.
* Note that if the default has been returned the path
* in a project description used to create a project
* should not be set.
*
* @return the project location path or its anticipated initial value.
*/
public IPath getProjectLocationPath() {
return fLocationGroup.getLocation();
}
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
*/
@Override
public void setVisible(final boolean visible) {
super.setVisible(visible);
if (visible) {
fNameGroup.postSetFocus();
}
}
protected GridLayout initGridLayout(final GridLayout layout, final boolean margins) {
layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
layout.verticalSpacing= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
if (margins) {
layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
} else {
layout.marginWidth= 0;
layout.marginHeight= 0;
}
return layout;
}
protected GridData horizontalFillGridData() {
return new GridData(GridData.FILL_HORIZONTAL);
}
}
| [
"[email protected]"
]
| |
1484f57bbe650b1ba1bd4e52ae72ac1978f12668 | a0fd3bddef5888879e00bae6127d7933218dd5a4 | /shopOnline/src/utilidades/Datos.java | 93381f5b8c5759f9c12b8f4ca63dff1604a265bb | []
| no_license | CarmenHernan/prueba | f8870a82148a088fdcdebdae6831724ff3e8d0f9 | 22d328114c9f93e1317e11e88666923835208872 | refs/heads/master | 2021-05-02T11:48:42.406660 | 2016-11-09T13:25:30 | 2016-11-09T13:25:30 | 72,747,466 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,308 | java | package utilidades;
/**
*
* @author Antonio Santos
*/
import java.util.Scanner;
import java.util.Date;
public class Datos {
public Datos() {
}
public static String recogeString() throws Exception {
//lanza Exception por si pasa algo pero no sabe qué puede pasar
// en la API por ejemplo pone los tipos de error que pueden saltar, que están recogidos en EXCEPTION
//CON ENTRADA/SALIDA siempre hay error, x ej busco readLine--> pone que sólo hay IOException, podría poner sólo esa
String dato = new Scanner(System.in).nextLine();
return dato;
}
public static String recogeString(String msg) throws Exception {
System.out.println(msg);
return recogeString();
}
public static int recogeInt() throws Exception {
int dato = new Scanner(System.in).nextInt();
return dato;
}
public static int recogeInt(String msg) throws Exception {
System.out.println(msg);
return recogeInt();
}
public static double recogeDouble() throws Exception {
double dato = new Scanner(System.in).nextDouble();
return dato;
}
public static double recogeDouble(String msg) throws Exception {
System.out.println(msg);
return recogeDouble();
}
}
| [
"[email protected]"
]
| |
77be5db206d88987426dca5cd916954e385fbd26 | d80f7430f3d45cb16613e6b900a7c7ec9806f0f3 | /src/main/java/com/educare/open/model/Post.java | 3eb9d6dbf272010a6b0766ddcbbea5e85f74a9c7 | []
| no_license | hoandv2020/open-educare | 1beea284402fac51328b1939c7b359e6c8b2fa64 | c313c9d11229ec9d4dfd9f4c3219ea24d872e401 | refs/heads/master | 2020-06-01T11:38:14.134278 | 2019-06-09T06:21:37 | 2019-06-09T06:21:37 | 190,728,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,484 | java | package com.educare.open.model;
import javax.persistence.*;
import java.sql.Timestamp;
@Entity
@Table(name = "post")
public class Post {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "title")
private String title;
@Column(name = "content")
private String content;
@Column(name = "view_count")
private Integer viewCount;
@Column(name = "create_at")
private Timestamp createAt;
@Column(name = "update_at")
private Timestamp updateAt;
@Column(name = "tags")
private String tags;
@ManyToOne
@JoinColumn(name = "category_id")
private Category category;
@ManyToOne
@JoinColumn(name = "user_id")
private User user;
public Post() {
}
public Post(String title, String content, Category category, Integer viewCount, Timestamp createAt, Timestamp updateAt, String tags, User user) {
this.title = title;
this.content = content;
this.category = category;
this.viewCount = viewCount;
this.createAt = createAt;
this.updateAt = updateAt;
this.tags = tags;
this.user = user;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public Integer getViewCount() {
return viewCount;
}
public void setViewCount(Integer viewCount) {
this.viewCount = viewCount;
}
public Timestamp getCreateAt() {
return createAt;
}
public void setCreateAt(Timestamp createAt) {
this.createAt = createAt;
}
public Timestamp getUpdateAt() {
return updateAt;
}
public void setUpdateAt(Timestamp updateAt) {
this.updateAt = updateAt;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
| [
"[email protected]"
]
| |
32b214a278044e17f805cb6d24ae28b7cff90caa | 912878c8cd63ae51f2e5c3cf2472159f12de983e | /src/com/gz/util/SensitiveWordInit.java | 8795885185d4953ff8d349e92c58bdfdbce98e78 | []
| no_license | huangchenghua/GameCityBase | a8627a980c7a114fd39ff2a3a6951b09bae7f217 | bcde87cf249e7fca92ad44c9c34de0710bb522ad | refs/heads/master | 2020-06-23T12:39:00.096422 | 2017-02-10T09:05:59 | 2017-02-10T09:05:59 | 74,648,782 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,501 | java | package com.gz.util;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/**
* @Description: 初始化敏感词库,将敏感词加入到HashMap中,构建DFA算法模型
* @Project:test
* @Author : chenming
* @Date : 2014年4月20日 下午2:27:06
* @version 1.0
*/
public class SensitiveWordInit {
private String ENCODING = "UTF-8"; //字符编码
@SuppressWarnings("rawtypes")
public HashMap sensitiveWordMap;
public SensitiveWordInit(){
super();
}
/**
* @author chenming
* @date 2014年4月20日 下午2:28:32
* @version 1.0
*/
@SuppressWarnings("rawtypes")
public Map initKeyWord(){
try {
//读取敏感词库
Set<String> keyWordSet = readSensitiveWordFile();
//将敏感词库加入到HashMap中
addSensitiveWordToHashMap(keyWordSet);
//spring获取application,然后application.setAttribute("sensitiveWordMap",sensitiveWordMap);
} catch (Exception e) {
e.printStackTrace();
}
return sensitiveWordMap;
}
/**
* 读取敏感词库,将敏感词放入HashSet中,构建一个DFA算法模型:<br>
* 中 = {
* isEnd = 0
* 国 = {<br>
* isEnd = 1
* 人 = {isEnd = 0
* 民 = {isEnd = 1}
* }
* 男 = {
* isEnd = 0
* 人 = {
* isEnd = 1
* }
* }
* }
* }
* 五 = {
* isEnd = 0
* 星 = {
* isEnd = 0
* 红 = {
* isEnd = 0
* 旗 = {
* isEnd = 1
* }
* }
* }
* }
* @author chenming
* @date 2014年4月20日 下午3:04:20
* @param keyWordSet 敏感词库
* @version 1.0
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private void addSensitiveWordToHashMap(Set<String> keyWordSet) {
sensitiveWordMap = new HashMap(keyWordSet.size()); //初始化敏感词容器,减少扩容操作
String key = null;
Map nowMap = null;
Map<String, String> newWorMap = null;
//迭代keyWordSet
Iterator<String> iterator = keyWordSet.iterator();
while(iterator.hasNext()){
key = iterator.next(); //关键字
nowMap = sensitiveWordMap;
for(int i = 0 ; i < key.length() ; i++){
char keyChar = key.charAt(i); //转换成char型
Object wordMap = nowMap.get(keyChar); //获取
if(wordMap != null){ //如果存在该key,直接赋值
nowMap = (Map) wordMap;
}
else{ //不存在则,则构建一个map,同时将isEnd设置为0,因为他不是最后一个
newWorMap = new HashMap<String,String>();
newWorMap.put("isEnd", "0"); //不是最后一个
nowMap.put(keyChar, newWorMap);
nowMap = newWorMap;
}
if(i == key.length() - 1){
nowMap.put("isEnd", "1"); //最后一个
}
}
}
}
/**
* 读取敏感词库中的内容,将内容添加到set集合中
* @author chenming
* @date 2014年4月20日 下午2:31:18
* @return
* @version 1.0
* @throws Exception
*/
@SuppressWarnings("resource")
private Set<String> readSensitiveWordFile() throws Exception{
Set<String> set = null;
File file = new File("./conf/mgz.txt"); //读取文件
InputStreamReader read = new InputStreamReader(new FileInputStream(file),ENCODING);
try {
if(file.isFile() && file.exists()){ //文件流是否存在
set = new HashSet<String>();
BufferedReader bufferedReader = new BufferedReader(read);
String txt = null;
while((txt = bufferedReader.readLine()) != null){ //读取文件,将文件内容放入到set中
set.add(txt);
}
}
else{ //不存在抛出异常信息
throw new Exception("敏感词库文件不存在");
}
} catch (Exception e) {
throw e;
}finally{
read.close(); //关闭文件流
}
return set;
}
public static void main(String[] args) {
SensitivewordFilter filter = SensitivewordFilter.getInstance();
System.out.println("敏感词的数量:" + filter.sensitiveWordMap.size());
String string = "太多的伤感情怀也许只局限于饲养基地 荧幕中的情节,主人公尝试着去用某种方式渐渐的很潇洒地释自杀指南怀那些自己经历的伤感。"
+ "然后法.轮.功 我们的扮演的角色就是跟随着主人公的喜红客联盟 怒哀乐而过于牵强的把自己的情感也附加于银幕情节中,然后感动就流泪,"
+ "难过就躺在某一个人的怀里尽情的阐述心扉或者手机卡复制器一个人一杯红酒一部电影在夜三级片 深人静的晚上,关上电话静静的发呆着。";
System.out.println("待检测语句字数:" + string.length());
long beginTime = System.currentTimeMillis();
Set<String> set = filter.getSensitiveWord(string, 0);
long endTime = System.currentTimeMillis();
System.out.println("语句中包含敏感词的个数为:" + set.size() + "。包含:" + set);
System.out.println("总共消耗时间为:" + (endTime - beginTime));
String _str = filter.replaceSensitiveWord(string, 0, "*");
System.out.println(_str);
}
}
| [
"[email protected]"
]
| |
63fec4e6f82e17ce044120797477683cfbd384af | d704132e4e9f707d13af194a3f60c79bfbc187d1 | /src/main/java/com/kafka/producer/KafkaProducerService.java | 2bc11a90959acb9a54f10546b3f4fc8904fc4601 | []
| no_license | yefei-lai/kafka-producer | 9ad06450bc889678d47ac3a21a3fd8847606967c | 25d5a2a661615dd4f7580720c28871ee07f384f5 | refs/heads/master | 2023-04-08T00:02:13.668750 | 2021-04-14T08:59:15 | 2021-04-14T08:59:15 | 357,838,271 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,166 | java | package com.kafka.producer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.support.SendResult;
import org.springframework.stereotype.Component;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.util.concurrent.ListenableFutureCallback;
/**
*
*/
@Slf4j
@Component
public class KafkaProducerService {
@Autowired
private KafkaTemplate<String, Object> kafkaTemplate;
public void sendMessage(String topic, Object object){
ListenableFuture<SendResult<String, Object>> future = kafkaTemplate.send(topic, object);
future.addCallback(new ListenableFutureCallback<SendResult<String, Object>>() {
@Override
public void onFailure(Throwable throwable) {
log.error("发送消息失败:" + throwable.getMessage());
}
@Override
public void onSuccess(SendResult<String, Object> result) {
log.info("发送消息成功:" + result.toString());
}
});
}
}
| [
"[email protected]"
]
| |
1ac5d6cf1981898de1884c1eeb0ea046356f74d2 | d725345f78e5ff39576f73020edc40fd1288502d | /ChatServer2/src/chatServer2/ChatServer2.java | c5a9726e9f3e29f362fceaa0723c6750f5cf8ffc | []
| no_license | malvr00/Java-Study | 82401bf85738d4f5d0e9bde514140ee95cf1eee4 | 08527b229141be77215d31ad72fc29ef414d66fd | refs/heads/main | 2023-06-05T23:53:16.996298 | 2021-06-28T11:33:23 | 2021-06-28T11:33:23 | 363,634,553 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 3,795 | java | package chatServer2;
import java.io.*;
import java.net.*;
import java.util.Vector;
public class ChatServer2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
ServerSocket serverSocket = null;
Socket clientSocket = null;
ChatThread chatTrd;
boolean bool = true;
// 접속자를 저장할 Vector 생성
Vector<ChatThread> vClient = new Vector<>();
try {
serverSocket = new ServerSocket(1234);
}catch(IOException e) {
System.out.println("Server Socket 생성오류 발생.");
System.exit(1);
}
System.out.println("Chatting Server가 1234 Port에서 접속을 기다립니다.");
try {
while(bool) {
clientSocket = serverSocket.accept();
chatTrd = new ChatThread(clientSocket, vClient);
chatTrd.start();
vClient.addElement(chatTrd);
}
serverSocket.close();
}catch(IOException e) {
System.err.println("접속 실패입니다.");
System.exit(1);
}
}
}
class ChatThread extends Thread{
Socket clientSocket = null;
PrintWriter socketOut;
BufferedReader socketIn;
String strInput, strName = "NoName";
Vector<ChatThread> vClient;
public ChatThread() {}
public ChatThread(Socket socket, Vector vClient) {
clientSocket = socket;
this.vClient = vClient;
}
// 접속끊은 유저 Vector에서 제거
public void removeClient() throws IOException{
vClient.removeElement(this);
broadcast("[" + strName + "] 님이 퇴장하셨습니다.");
}
// 접속중인 User 목록 전송
public void sendUserList()throws IOException{
socketOut.println("< 현재 접속자 " + vClient.size() + "명 명단 >");
for(int i=0; i<vClient.size(); i++) {
ChatThread trd = ((ChatThread)vClient.elementAt(i));
socketOut.println(trd.strName);
}
}
// Thread 실행
public void run() {
try {
System.out.println("Client:"+clientSocket.toString() + "\n에서 접속하였습니다.");
socketOut = new PrintWriter(clientSocket.getOutputStream(),true);
socketIn = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
socketOut.println("ChatServer"); // Server 확인 Message 전송
strInput = socketIn.readLine(); // Client 확인 Message 전송
if(strInput.equals("EchoClient")) { // 접속한 Client가 맞으면 처리
socketOut.println("<단축키> : /h(도움말), /u(접속자목록), /r 대화명(대화명변경)");
socketOut.println("대화명을 입력하세요!");
strName = socketIn.readLine(); // 대화명 읽기
broadcast("[" + strName + "]님이 입장하였습니다.");
while((strInput = socketIn.readLine())!= null) {
if(strInput.equals("/h"))
socketOut.println("<단축키> : /h(도움말), /u(접속자목록), /r 대화명(대화명변경)");
else if(strInput.equals("/u"))
sendUserList();
else if(strInput.regionMatches(0, "/r", 0, 2)) { // 앞에 두 글자 추출하여 비교
String new_name = strInput.substring(2).trim(); // "/r" 제외한 User Name 대입
// 대화명 변경 알림
broadcast("접속자 " + strName + "님의 대화명이 [" + new_name + "](으)로 변경되었습니다.");
strName = new_name;
}else {
broadcast("[" + strName + "]" + strInput);
}
}
}else {
socketOut.println("잘못된 Client입니다.");
}
}catch(IOException e) {
try {
removeClient();
}catch(IOException e1) {
System.out.println(" " + strName + " 의 접속이 끊겼습니다.");
}
}
}
// Message 전송
public void broadcast(String msg) throws IOException{
for(int i = 0; i<vClient.size(); i++) {
ChatThread trd = ((ChatThread)vClient.elementAt(i));
trd.socketOut.println(msg); // 전달된 msg를 Vector에 등록된 모두에게 전송
}
System.out.println(msg);
}
} | [
"[email protected]"
]
| |
676926ea43f349b1beea246c81f265b10339bf40 | ca57c3651db75069fcbbb7c5190e6a328331660e | /src/com/siwuxie095/forme/algorithm/chapter1st/question7th/answer1st/Main.java | 4e039b410e260db88c8a6f18d8e8e345014d4c74 | []
| no_license | gouyanzhan/HelloWorld | f915ec8eabf8878b0c01fb8ec29b869e6fd68c5f | 8cd9dc117d301d10207690052f2f27de2d9b9e2c | refs/heads/master | 2022-03-25T07:31:52.842092 | 2022-03-11T07:08:30 | 2022-03-11T07:08:30 | 164,224,001 | 1 | 1 | null | 2019-01-07T14:18:44 | 2019-01-05T14:52:23 | Java | UTF-8 | Java | false | false | 2,481 | java | package com.siwuxie095.forme.algorithm.chapter1st.question7th.answer1st;
/**
* 生成窗口最大值数组
*
* 题目:
* 有一个整型数组 arr 和一个大小为 w 的窗口从数组的最左边滑到最右边,
* 窗口每次向右边滑一个位置。如果数组的长度为 n,窗口的大小为 w,则一共
* 会产生 n - w + 1 个窗口的最大值。
* 要求实现一个函数:
* 1、输入:整型数组 arr,窗口大小为 w。
* 2、输出:一个长度为 n - w + 1 的数组 res,res[i] 表示每一种窗口
* 状态下的最大值。
*
* 解答:
* 本题的关键在于利用双端队列来实现窗口最大值的更新。(所谓双端队列,即 队列的
* 队头和队尾都可以做入队和出队的操作)
*
* 首先生成双端队列 qmax, qmax 中存放数组 arr 中的下标。
*
* 假设遍历到 arr[i],qmax 的放入规则为:
* 1、如果 qmax 为空,直接把下标 i 放进 qmax,放入过程结束。
* 2、如果 qmax 不为空,取出当前 qmax 队尾存放的下标 j。
* (1)如果 arr[j] > arr[i],直接把下标 i 放进 qmax 的队尾,放入过程结束。
* (2)如果 arr[j] <= arr[i],把 j 从 qmax 中弹出,继续 qmax 的放入规则。
*【放入规则,实际上就是队尾的入队与出队】
*
* 假设遍历到 arr[i],qmax 的弹出规则为:
* 如果 qmax 队头的下标等于 i - w,说明当前 qmax 队头的下标已过期,弹出当前
* 队头的下标即可。
* 【弹出规则,实际上就是队头的出队,这里没有入队】
*
* 根据以上规则,qmax 便成为了一个维护窗口为 w 的子数组的最大值更新的结构。
*
* 注意:由于 qmax 中存放的是下标,所以 qmax 的最大容量便是 w,且队头元素总是
* 当前窗口最大元素对应的下标。
*
* @author Jiajing Li
* @date 2019-02-08 15:24:51
*/
public class Main {
public static void main(String[] args) {
int[] arr = new int[]{4, 3, 5, 4, 3, 3, 6, 7};
int w = 3;
int[] res = MaxWindow.getMaxWindow(arr, w);
System.out.println("原数组 arr = " + getArrStr(arr));
System.out.println("窗口最大值数组 res = " + getArrStr(res));
}
private static String getArrStr(int[] arr) {
StringBuilder builder = new StringBuilder();
for (int val : arr) {
builder.append(val).append(" ");
}
return builder.toString();
}
}
| [
"[email protected]"
]
| |
1bbcd64d5e3fa71dc8229994706ff3610bd87fe9 | d3aa2336fa20c30bf36b94635dea657b78d2807d | /src/main/java/ru/opentech/eks/component/KafkaListener.java | e26a21453ab64f7f566bd402258cd88bd83781af | []
| no_license | weierstrass54/elastic-kafka-stream | ce0a1775820e67722b1c0f0ccdc97e9f2b1630b9 | 8b4c031f3555179615b3c68ae1027ac61baf27c2 | refs/heads/master | 2020-04-11T08:12:34.718570 | 2018-12-14T11:00:20 | 2018-12-14T11:00:20 | 161,635,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,981 | java | package ru.opentech.eks.component;
import org.apache.kafka.common.serialization.Deserializer;
import java.time.Duration;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Optional;
public class KafkaListener<K, V> {
private static final Duration DEFAULT_POLL_DURATION = Duration.ofMillis( 100 );
private Collection<String> topics;
private Deserializer<K> keyDeserializer;
private Deserializer<V> valueDeserializer;
private ConsumerRecordHandler<K, V> handler;
private Duration pollTimeout;
public KafkaListener() {
this( DEFAULT_POLL_DURATION );
}
public KafkaListener( Duration pollTimeout ) {
this.pollTimeout = pollTimeout;
}
public Collection<String> getTopics() {
return Optional.ofNullable( topics ).orElse( Collections.emptyList() );
}
public Duration getPollTimeout() {
return pollTimeout;
}
public Deserializer<K> getKeyDeserializer() {
return keyDeserializer;
}
public Deserializer<V> getValueDeserializer() {
return valueDeserializer;
}
public ConsumerRecordHandler<K, V> getHandler() {
return handler;
}
public KafkaListener<K, V> topics( String... topics ) {
this.topics = Arrays.asList( topics );
return this;
}
public KafkaListener<K, V> keyDeserializer( Deserializer<K> keyDeserializer ) {
this.keyDeserializer = keyDeserializer;
return this;
}
public KafkaListener<K, V> valueDeserializer( Deserializer<V> valueDeserializer ) {
this.valueDeserializer = valueDeserializer;
return this;
}
public KafkaListener<K, V> flatMap( ConsumerRecordHandler<K, V> handler ) {
this.handler = handler;
return this;
}
@Override
public String toString() {
return "{KafkaListener" + super.toString() + ", topics = [ " + String.join( ", ", topics ) + " ]}";
}
}
| [
"[email protected]"
]
| |
9918ab8209a9c11bcbfb5001410fce579b0f3ad5 | c188408c9ec0425666250b45734f8b4c9644a946 | /open-sphere-plugins/search/src/test/java/io/opensphere/search/controller/SearchTransformerTest.java | 793713162db573323410f976708c26630a596c5f | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
]
| permissive | rkausch/opensphere-desktop | ef8067eb03197c758e3af40ebe49e182a450cc02 | c871c4364b3456685411fddd22414fd40ce65699 | refs/heads/snapshot_5.2.7 | 2023-04-13T21:00:00.575303 | 2020-07-29T17:56:10 | 2020-07-29T17:56:10 | 360,594,280 | 0 | 0 | Apache-2.0 | 2021-04-22T17:40:38 | 2021-04-22T16:58:41 | null | UTF-8 | Java | false | false | 6,107 | java | package io.opensphere.search.controller;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.awt.Color;
import java.util.Collection;
import java.util.List;
import org.easymock.EasyMock;
import org.easymock.EasyMockSupport;
import org.junit.Test;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.Maps;
import io.opensphere.core.geometry.Geometry;
import io.opensphere.core.geometry.GeometryRegistry;
import io.opensphere.core.geometry.PointGeometry;
import io.opensphere.core.geometry.PolylineGeometry;
import io.opensphere.core.geometry.renderproperties.PointRenderProperties;
import io.opensphere.core.model.GeographicPosition;
import io.opensphere.core.model.LatLonAlt;
import io.opensphere.core.search.SearchResult;
import io.opensphere.core.util.collections.New;
import io.opensphere.search.model.SearchModel;
/**
* Unit test for {@link SearchTransformer}.
*
*/
public class SearchTransformerTest
{
/**
* The geometries published during the test.
*/
private final List<Geometry> myPublishedGeometries = New.list();
/**
* Tests the {@link SearchTransformer} ability to add and remove geometries.
*/
@Test
public void test()
{
EasyMockSupport support = new EasyMockSupport();
GeometryRegistry registry = createGeometryRegistry(support);
SearchResult noLocations = new SearchResult();
noLocations.setText("no locations");
SearchResult pointResult = new SearchResult();
pointResult.getLocations().add(LatLonAlt.createFromDegrees(10, 11));
pointResult.setText("point");
SearchResult box = new SearchResult();
box.getLocations().addAll(New.list(LatLonAlt.createFromDegrees(10, 10), LatLonAlt.createFromDegrees(10, 11),
LatLonAlt.createFromDegrees(11, 11), LatLonAlt.createFromDegrees(11, 10), LatLonAlt.createFromDegrees(10, 10)));
box.setText("box");
SearchModel model = new SearchModel();
support.replayAll();
SearchTransformer transformer = new SearchTransformer(model, registry, Maps.synchronizedBiMap(HashBiMap.create()),
Maps.synchronizedBiMap(HashBiMap.create()));
model.getShownResults().addAll(noLocations, pointResult, box);
assertEquals(4, myPublishedGeometries.size());
PointGeometry point = (PointGeometry)myPublishedGeometries.get(0);
assertEquals(Color.CYAN, point.getRenderProperties().getColor());
assertEquals(PointRenderProperties.TOP_Z, point.getRenderProperties().getZOrder());
assertTrue(point.getRenderProperties().isDrawable());
assertTrue(point.getRenderProperties().isPickable());
assertFalse(point.getRenderProperties().isObscurant());
assertFalse(point.getRenderProperties().isHidden());
assertTrue(point.getRenderProperties().isRound());
assertEquals(5f, point.getRenderProperties().getSize(), 0f);
assertEquals(7f, point.getRenderProperties().getHighlightSize(), 0f);
assertEquals(-2130706433, point.getRenderProperties().getHighlightColorARGB());
assertEquals(LatLonAlt.createFromDegrees(10, 11), ((GeographicPosition)point.getPosition()).getLatLonAlt());
PolylineGeometry boxGeom = (PolylineGeometry)myPublishedGeometries.get(2);
assertEquals(Color.CYAN, boxGeom.getRenderProperties().getColor());
assertEquals(PointRenderProperties.TOP_Z, boxGeom.getRenderProperties().getZOrder());
assertTrue(boxGeom.getRenderProperties().isDrawable());
assertTrue(boxGeom.getRenderProperties().isPickable());
assertFalse(boxGeom.getRenderProperties().isObscurant());
assertFalse(boxGeom.getRenderProperties().isHidden());
assertEquals(4f, boxGeom.getRenderProperties().getWidth(), 0f);
assertEquals(-2130706433, boxGeom.getRenderProperties().getHighlightColorARGB());
assertEquals(LatLonAlt.createFromDegrees(10, 10), ((GeographicPosition)boxGeom.getVertices().get(0)).getLatLonAlt());
assertEquals(LatLonAlt.createFromDegrees(10, 11), ((GeographicPosition)boxGeom.getVertices().get(1)).getLatLonAlt());
assertEquals(LatLonAlt.createFromDegrees(11, 11), ((GeographicPosition)boxGeom.getVertices().get(2)).getLatLonAlt());
assertEquals(LatLonAlt.createFromDegrees(11, 10), ((GeographicPosition)boxGeom.getVertices().get(3)).getLatLonAlt());
assertEquals(LatLonAlt.createFromDegrees(10, 10), ((GeographicPosition)boxGeom.getVertices().get(4)).getLatLonAlt());
model.getShownResults().clear();
assertTrue(myPublishedGeometries.isEmpty());
transformer.close();
model.getShownResults().add(pointResult);
assertTrue(myPublishedGeometries.isEmpty());
support.verifyAll();
}
/**
* Creates an easy mocked {@link GeometryRegistry}.
*
* @param support Used to create the mock.
* @return The mocked {@link GeometryRegistry}.
*/
@SuppressWarnings("unchecked")
private GeometryRegistry createGeometryRegistry(EasyMockSupport support)
{
GeometryRegistry registry = support.createMock(GeometryRegistry.class);
registry.addGeometriesForSource(EasyMock.isA(SearchTransformer.class), EasyMock.isA(Collection.class));
EasyMock.expectLastCall().andAnswer(() ->
{
myPublishedGeometries.addAll((Collection<? extends Geometry>)EasyMock.getCurrentArguments()[1]);
return null;
}).anyTimes();
registry.removeGeometriesForSource(EasyMock.isA(SearchTransformer.class), EasyMock.isA(Collection.class));
EasyMock.expectLastCall().andAnswer(() ->
{
myPublishedGeometries.removeAll((Collection<? extends Geometry>)EasyMock.getCurrentArguments()[1]);
return null;
}).anyTimes();
return registry;
}
}
| [
"[email protected]"
]
| |
8b896e88b7c0a496d91ae085657e47f2b3e67c8d | 1c444668f926e7b924878f00266816883908557e | /src/League/Player.java | fd0437ebf4717483e0f519b9be82c0f8530e5982 | []
| no_license | phankanp/Soccer-League-Organizer | fcd60af5d058762fb3e7541ded83850e58da5485 | 95d03c91eb8233e0a38075ff192cb9d281e31fb9 | refs/heads/master | 2021-09-13T23:41:58.732815 | 2018-05-06T01:30:43 | 2018-05-06T01:30:43 | 122,407,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,780 | java | package league;
import java.io.Serializable;
public class Player implements Comparable<Player>, Serializable {
private static final long serialVersionUID = 1L;
private String firstName;
private String lastName;
private int heightInInches;
private boolean previousExperience;
public Player(String firstName, String lastName, int heightInInches, boolean previousExperience) {
this.firstName = firstName;
this.lastName = lastName;
this.heightInInches = heightInInches;
this.previousExperience = previousExperience;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public int getHeightInInches() {
return heightInInches;
}
public boolean isPreviousExperience() {
return previousExperience;
}
@Override
public int compareTo(Player other) {
// We always want to sort by last name then first name
if(this.getLastName().equals(other.getLastName())) {
return this.getFirstName().compareTo(other.getFirstName());
}
else {
return this.getLastName().compareTo(other.getLastName());
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Player)) return false;
Player player = (Player) o;
if (heightInInches != player.heightInInches) return false;
if (previousExperience != player.previousExperience) return false;
if (!firstName.equals(player.firstName)) return false;
return lastName.equals(player.lastName);
}
@Override
public int hashCode() {
int result = firstName.hashCode();
result = 31 * result + lastName.hashCode();
result = 31 * result + heightInInches;
result = 31 * result + (previousExperience ? 1 : 0);
return result;
}
}
| [
"[email protected]"
]
| |
9260df7b9bb13fac3e6734bd2e05fe327e63acb9 | 879f208f56648efe1ec0df2daab454ef758f5894 | /CloudPan/src/test/java/com/zhiyou100/dao/FileDaoTest.java | 9f3fa0d0cdc2f5f8e9088ca36ad139d64606e8d2 | []
| no_license | realguoshuai/CloudPan | edfbec168af53fef7601d942f50fa5389f47845c | 068a57b825a309ba094a7f025e7d55f11894f7bf | refs/heads/master | 2021-05-14T09:51:04.734468 | 2018-01-17T09:15:42 | 2018-01-17T09:15:42 | 116,336,420 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 988 | java | package com.zhiyou100.dao;
import static org.junit.Assert.*;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.zhiyou100.entity.FileDO;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:spring-dao.xml")
public class FileDaoTest {
@Autowired
private FileDao dao;
@Test
public void testListFile() {
List<FileDO> listFile = dao.listFile();
System.out.println(listFile);
}
@Test
public void testUpdateFile() {
FileDO fileDO =new FileDO("asdafs", 20, 2);
dao.updateFile(fileDO);
}
@Test
public void testAddFile() {
FileDO fileDO =new FileDO("11111", 10, 1);
dao.addFile(fileDO);
}
@Test
public void testDeleteFile() {
dao.deleteFile(1);
}
@Test
public void downFile() {
dao.downFile(2);
}
}
| [
"[email protected]"
]
| |
6dc8f3497f08bf16bf70f75fef028e7b42754431 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/17/17_6d9e875e4f605f0f56f77d24769103a7e6cdd138/TenantDao/17_6d9e875e4f605f0f56f77d24769103a7e6cdd138_TenantDao_s.java | ef4d129ffb6f398750312f58e7173273bf0cafa9 | []
| no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,978 | java | package eu.comexis.napoleon.server.dao;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.UUID;
import com.googlecode.objectify.Key;
import eu.comexis.napoleon.shared.model.City;
import eu.comexis.napoleon.shared.model.Company;
import eu.comexis.napoleon.shared.model.Country;
import eu.comexis.napoleon.shared.model.JobTitle;
import eu.comexis.napoleon.shared.model.Nationality;
import eu.comexis.napoleon.shared.model.Owner;
import eu.comexis.napoleon.shared.model.Tenant;
import eu.comexis.napoleon.shared.model.simple.SimpleTenant;
public class TenantDao extends NapoleonDao<Tenant> {
public TenantDao() {
super();
// TODO Auto-generated constructor stub
}
public Tenant create(String companyId) {
Key<Company> companyKey = new Key<Company>(Company.class, companyId);
Tenant tenant = new Tenant();
System.out.println("Set company key " + companyKey.toString());
tenant.setCompany(companyKey);
return tenant;
}
/**
* Retrieves the list of all tenants stored in the database (with the minimum of data to be shown
* in UI)
*
* @return The list of tenants
*/
public ArrayList<SimpleTenant> getListSimpleTenants(String companyId) {
LOG.info("Get list Tenants (" + clazz + ") for company " + companyId);
Key<Company> companyKey = new Key<Company>(Company.class, companyId);
Iterator<Tenant> iterator = this.listAll(companyId).iterator();
ArrayList<SimpleTenant> tenants = new ArrayList<SimpleTenant>();
while (iterator.hasNext()) {
Tenant tenant = iterator.next();
SimpleTenant o = new SimpleTenant();
o.setId(tenant.getId());
o.setName(tenant.getLastName());
o.setCity(tenant.getCity());
o.setAddress(tenant.getStreet());
o.setMobileNumber(tenant.getMobilePhoneNumber());
o.setPhoneNumber(tenant.getPhoneNumber());
tenants.add(o);
}
return tenants;
}
@Override
public Tenant update(Tenant tenant) {
if (tenant.getCompany() != null){
return update(tenant,tenant.getCompany());
}else{
// log error
LOG.fatal("Parent Company is not set, cannot save tenant");
return null;
}
}
public Tenant update(Tenant tenant, String companyId) {
Key<Company> companyKey = new Key<Company>(Company.class, companyId);
return update(tenant,companyKey);
}
public Tenant update(Tenant tenant, Key<Company> companyKey) {
String tenantId = tenant.getId();
CountryDao countryData = new CountryDao();
if (tenantId == null || tenantId.length() == 0) {
UUID uuid = UUID.randomUUID();
System.out.println("Creating Uuid " + uuid.toString());
tenant.setId(uuid.toString());
tenant.setCompany(companyKey);
tenant.setFlagActivated(true);
}
// if country does not exist, create it.
Country country = countryData.getByName(tenant.getCountry(), companyKey);
if (country == null) {
country = countryData.create(companyKey);
country.setName(tenant.getCountry());
countryData.update(country);
}
City city = countryData.getCityByFullName(country.getId(), tenant.getCity(),tenant.getPostalCode());
if (city == null) {
city = countryData.addCity(country.getId(), tenant.getCity(),tenant.getPostalCode());
}
if (tenant.getNationality()!= null && !tenant.getNationality().isEmpty()){
NationalityDao natDao = new NationalityDao();
Nationality nat = new Nationality();
nat.setName(tenant.getNationality());
nat.setCompany(companyKey);
natDao.update(nat);
}
if (tenant.getJobTitle()!= null && !tenant.getJobTitle().isEmpty()){
JobTitleDao jobDao = new JobTitleDao();
JobTitle job = new JobTitle();
job.setName(tenant.getJobTitle());
job.setCompany(companyKey);
jobDao.update(job);
}
return super.update(tenant);
}
}
| [
"[email protected]"
]
| |
cd9b697087e539ce6ea3639db6cb349aa4371aee | b1fe198ceb3ce00cb915f1545d47330ca7891f62 | /shiro-core/src/main/java/com/suteng/shiro/business/task/MailTask.java | 4e84701049328374d6724243e07d961ba38a0cf7 | [
"MIT"
]
| permissive | supertonsystem/project_management | faf2e26081722b5a8b661ca7d41632bb4872ff42 | 1bffd2358a3f2d65eadf39178e03f5eb65451f8a | refs/heads/master | 2020-05-24T14:24:41.139222 | 2019-08-02T06:54:05 | 2019-08-02T06:54:05 | 187,308,711 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,719 | java | package com.suteng.shiro.business.task;
import java.util.List;
import com.suteng.shiro.business.consts.MailConst;
import com.suteng.shiro.business.entity.ProjectMgt;
import com.suteng.shiro.business.entity.User;
import com.suteng.shiro.business.entity.activiti.HistoricActivityInstanceCopy;
import com.suteng.shiro.business.service.MailService;
import com.suteng.shiro.business.service.SysUserService;
import com.suteng.shiro.business.service.WorkProjectMgtActivitiService;
import com.suteng.shiro.business.service.WorkProjectMgtService;
import com.suteng.shiro.util.SpringUtil;
import org.apache.commons.lang3.StringUtils;
/**
* @Author:louyi
* @Description:
* @Date:Create in 17:17 2019/5/10
*/
public class MailTask implements Runnable {
private String processInstanceId;
public MailTask(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
@Override
public void run() {
WorkProjectMgtService workProjectMgtService = (WorkProjectMgtService) SpringUtil.getBean("workProjectMgtServiceImpl");
WorkProjectMgtActivitiService workProjectMgtActivitiService = (WorkProjectMgtActivitiService) SpringUtil.getBean("workProjectMgtActivitiServiceImpl");
MailService mailService = (MailService) SpringUtil.getBean("mailServiceImpl");
SysUserService sysUserService = (SysUserService) SpringUtil.getBean("sysUserServiceImpl");
//邮件通知
try {
ProjectMgt entity = new ProjectMgt();
entity.getWorkProjectMgt().setProcessInstanceId(processInstanceId);
ProjectMgt projectMgt = workProjectMgtService.getOneByEntity(entity);
if (projectMgt == null) {
System.out.println("---------------------" + processInstanceId);
}
List<HistoricActivityInstanceCopy> historicActivityInstances = workProjectMgtActivitiService.findHistoryActivity(processInstanceId);
//获取办公室节点处理人发送邮件通知
Long userId = null;
for (HistoricActivityInstanceCopy h : historicActivityInstances) {
if ("办公室".equals(h.getActivityName())) {
userId = Long.valueOf(h.getAssignee());
}
}
if (userId == null) {
return;
}
User user = sysUserService.getByPrimaryKey(userId);
String to = StringUtils.isEmpty(user.getEmail()) ? MailConst.MAIL_DEFAULT_TO : user.getEmail();
mailService.sendProjectFinishRemind(to, "项目【" + projectMgt.getTitle() + "】已结束", projectMgt.getTitle());
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
| |
7970864f1c0d98ddd1aaf689c1f6535526717b4c | 4194f086c43f931ce7f6fc9546a36022eeddadf6 | /JavaSE/JavaCode/src/com/wmhou/chapter5/lambdademo/InnerClassDemo.java | 88dad13e15d0a0d28508272a535ede98575fea33 | []
| no_license | jrchhoo/java_blog | 8df2fdacb5cd9e44a783e02130cce7e77f370b68 | b96eabcc71cdbc67076686d85cb0b8252d4a1d4d | refs/heads/master | 2022-11-12T00:29:54.221948 | 2018-07-04T14:30:33 | 2018-07-04T14:30:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 648 | java | package com.wmhou.chapter5.lambdademo;
import java.util.Arrays;
import java.util.List;
/**
* Description:Lambda实例:匿名内部类创建接口对象
* <br/>网站:<a href="https://github.com/wmhou/java_blog">Java_blog on Github</a>
* <br/>Program Name: Java_blog
* <br/>Date:2018-03-14
*
* @author 侯伟民
* @version 1.0
*/
class LambdaDemo {
public static void main(String[] args) {
List<Integer> list = Arrays.asList(1, 3, 5, 7, 9);
for (Integer i: list) {
System.out.println(i);
}
list.forEach(i -> System.out.println(i));
list.forEach(System.out::println);
}
}
| [
"[email protected]"
]
| |
c3de52eaf15a55e07170d36dae09cba3a923a6d9 | 7503a134f8570e133c5f173db14fe257ffb18a5d | /src/com/briup/iocore/ReadTeacher.java | 9709df9f1abf96447f998670f04fde67f2fc565f | []
| no_license | 6WE6/CoreJava | 5ea6e37e7bebafde50f8900a24886140705c8d9a | 8c2d9e1ff6a117cd2032b87dee3304199969ed83 | refs/heads/master | 2020-04-19T16:48:38.950404 | 2019-02-27T08:33:06 | 2019-02-27T08:33:06 | 168,315,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,223 | java | package com.briup.iocore;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
public class ReadTeacher {
public static void main(String[] args) {
try {
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("src/com/briup/iocore/teacher.txt"));
{
//依次读取ObjectInputStream输入流中的四个对象
Teacher t1 = (Teacher) ois.readObject();
Teacher t2 = (Teacher) ois.readObject();
ObjectSequenceBean osb = (ObjectSequenceBean) ois.readObject();
Teacher t3 = (Teacher) ois.readObject();
//
System.out.println("t1的student引用和p是否相同:"+(t1.getStudent() == osb));
System.out.println("t2的student引用和p是否相同:"+(t2.getStudent() == osb));
System.out.println("t2和t3是否引用同一个对象:"+(t2 == t3));
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
| |
042426942a4a6d8b7a472f52d6cd1b32003bfc13 | a3d87a5ea89fc5815daf2c9739fc67922fa2ad0c | /src/gamemodel/Tile_Standard.java | 8350ec22522217baf3dcf0596e50e6eaa4f638d0 | []
| no_license | Boy-Blu/Match-3 | 58683530748b63c6db6eb463f00e74d9e7f9c5a9 | b8d2e543b23d05792a3c927a1bd9a6573d42a979 | refs/heads/master | 2020-03-21T16:51:30.863007 | 2018-11-14T21:20:50 | 2018-11-14T21:20:50 | 138,797,901 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | package gamemodel;
public class Tile_Standard extends Tile{
public Tile_Standard(int col) {
if(col < 1 || col > 7) throw new IllegalArgumentException();
this.color = col;
this.sr = new Remove_Strat_Standard();
}
@Override
public int getColour() {
// TODO Auto-generated method stub
return this.color;
}
@Override
public Type getType() {
// TODO Auto-generated method stub
return Type.STANDARD;
}
}
| [
"[email protected]"
]
| |
e5eddbe31c1a07fae2b53a72fbcd350abc0334f9 | e6fb277a7a47b09aa222566c0c874352cf31acae | /DevOppsServices/DevOppsServices/src/com/devopps/portal/service/SubCategoryServiceImpl (2).java | 8a09526f598ebe8001d03b87822300881f9aa875 | []
| no_license | devops81/Dmat-Sourcecode | fba1b5e409669811532bdf17f4f0ca90f416f29a | 869f1a3b1f7cc2988ff384b4a9f1668f18103d72 | refs/heads/master | 2020-12-02T22:17:53.373880 | 2017-07-04T09:10:26 | 2017-07-04T09:10:26 | 96,108,012 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,712 | java | package com.devopps.portal.service;
import java.util.List;
import org.hibernate.HibernateException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import com.devopps.portal.dao.ISubCategoryDao;
import com.devopps.portal.exception.DuplicateAreasException;
import com.devopps.portal.exception.ExceptionHandler;
import com.devopps.portal.exception.NoRecordsFoundException;
import com.devopps.portal.model.CategorySubCategoryDetails;
import com.devopps.portal.model.ResponseHeader;
import com.devopps.portal.model.SaveSubCategoriesRequest;
import com.devopps.portal.model.SubCategoryResponseBody;
import com.devopps.portal.model.SubCategoryServiceResponse;
import com.devopps.portal.util.IConstants;
import com.devopps.portal.util.IStatusCodeConstants;
@Component("ISubCategoryService")
public class SubCategoryServiceImpl implements ISubCategoryService {
@Autowired
@Qualifier("ISubCategoryDao")
ISubCategoryDao subCategoryDao;
@Override
public SubCategoryServiceResponse getSubCategories(int categoryId) {
SubCategoryServiceResponse response = new SubCategoryServiceResponse();
List<CategorySubCategoryDetails> subCategoryDetails = null;
try {
subCategoryDetails = subCategoryDao.getSubCategories(categoryId);
} catch (HibernateException ex) {
ex.printStackTrace();
return buildGetSubcategoriesResponse(subCategoryDetails, IConstants.FAILURE, IStatusCodeConstants.STATUS_FAILURE);
} catch (Exception ex) {
ex.printStackTrace();
return buildGetSubcategoriesResponse(subCategoryDetails, IConstants.FAILURE, IStatusCodeConstants.STATUS_FAILURE);
}
response = buildGetSubcategoriesResponse(subCategoryDetails,IConstants.SUCCESS, IStatusCodeConstants.STATUS_SUCCESS);
return response;
}
@Override
public SubCategoryServiceResponse saveSubCategory(SaveSubCategoriesRequest saveSubCategoriesRequest){
SubCategoryServiceResponse subCategoryServiceResponse = new SubCategoryServiceResponse();
int subCategoryId = -1;
try {
subCategoryId = subCategoryDao.saveSubCategory(saveSubCategoriesRequest);
} catch (HibernateException ex) {
ex.printStackTrace();
return buildSaveSubCategoryResponse(IConstants.FAILURE, IStatusCodeConstants.STATUS_FAILURE, subCategoryId);
} catch (DuplicateAreasException dx) {
ExceptionHandler.handle(dx);
return buildSaveSubCategoryResponse(IConstants.DUPLICATE_AREA,IStatusCodeConstants.STATUS_DUPLICATE, subCategoryId);
} catch (NoRecordsFoundException rfx) {
ExceptionHandler.handle(rfx);
return buildSaveSubCategoryResponse(IConstants.NO_RECORDS_FOUND, IStatusCodeConstants.NO_RECORDS_FOUND, subCategoryId);
} catch (Exception ex) {
ex.printStackTrace();
return buildSaveSubCategoryResponse(IConstants.FAILURE,IStatusCodeConstants.STATUS_FAILURE, subCategoryId);
}
subCategoryServiceResponse = buildSaveSubCategoryResponse(IConstants.SUCCESS,IStatusCodeConstants.STATUS_SUCCESS, subCategoryId);
return subCategoryServiceResponse;
}
private SubCategoryServiceResponse buildGetSubcategoriesResponse(List<CategorySubCategoryDetails> subCategoryDetails, String statusDesc, String statusCode) {
SubCategoryServiceResponse response = new SubCategoryServiceResponse();
ResponseHeader responseHeader = new ResponseHeader();
SubCategoryResponseBody responseBody = new SubCategoryResponseBody();
responseHeader.setStatusCode(statusCode);
responseHeader.setStatusDesc(statusDesc);
responseHeader.setOperationName(IConstants.FETCH_SUBCATEGORIES);
responseBody.setStatusMsg(statusDesc);
responseBody.setSubCategoryDetails(subCategoryDetails);
response.setSubCategoryResponseHeader(responseHeader);
response.setSubCategoryResponseBody(responseBody);
return response;
}
private SubCategoryServiceResponse buildSaveSubCategoryResponse(String statusDesc, String statusCode, int subCategoryId) {
SubCategoryServiceResponse subCategoryServiceResponse = new SubCategoryServiceResponse();
ResponseHeader subCategoryResponseHeader = new ResponseHeader();
SubCategoryResponseBody subCategoryResponseBody = new SubCategoryResponseBody();
subCategoryResponseHeader.setStatusCode(statusCode);
subCategoryResponseHeader.setStatusDesc(statusDesc);
subCategoryResponseHeader.setOperationName(IConstants.SAVE_SUB_CATEGORY);
subCategoryResponseBody.setStatusMsg(statusDesc);
subCategoryResponseBody.setSubCategoryId(subCategoryId);
subCategoryServiceResponse.setSubCategoryResponseHeader(subCategoryResponseHeader);
subCategoryServiceResponse.setSubCategoryResponseBody(subCategoryResponseBody);
return subCategoryServiceResponse;
}
}
| [
"[email protected]"
]
| |
80aeaf856342cd71b07c36ffcbd1534d9e301f13 | efd756e2b6d36b4b042e8ca60e08564f1281e014 | /src/main/java/com/spiderdt/mars/util/Sredis.java | 7c431ae8ae9bb95e144f344c8d2c83bda443a74c | []
| no_license | jiangjikun/springMVC-java-gradle-demo | 5feb535e3d85065b09b14e8967a37765ee3da310 | 8b13f14aa5d5051a369688ae38834655f6c48fc2 | refs/heads/master | 2021-01-01T18:14:02.236371 | 2017-07-25T08:14:19 | 2017-07-25T08:14:19 | 98,281,680 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,618 | java | package com.spiderdt.mars.util;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.springframework.beans.factory.annotation.Autowired;
import redis.clients.jedis.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* 链接redis的类
*/
public class Sredis {
@Autowired
Slog log;
private JedisPool pool = null;
private JedisSentinelPool spool = null;
private Sredis jredis ;
private String host;
private Integer port;
private Integer timeout;
public String prefix="sredis";
public synchronized Sredis getInstance(){
if( null == jredis){
jredis = new Sredis();
}
return jredis;
}
public void init(){
log.info("sredis init begin");
}
public void distory(){
log.info("redis distory end");
}
public Sredis(){
}
public Sredis(String host, int port, int timeout, String prefix){
this.host = host;
this.port = port;
this.timeout = timeout;
this.prefix = prefix;
}
public Sredis(String host, int port, int timeout){
this(host,port,timeout,"sredis");
}
/**
* 建立连接池 真实环境,一般把配置参数缺抽取出来。
*
*/
private void createJedisPool() {
// 建立连接池配置参数
JedisPoolConfig config = new JedisPoolConfig();
// 设置最大连接数,和系统句柄有关
config.setMaxTotal(1024);
// 设置最大阻塞时间,是毫秒数milliseconds
config.setMaxWaitMillis(1000);
// 设置空间连接
config.setMaxIdle(10);
//连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true
config.setBlockWhenExhausted(true);
//最小空闲连接数, 默认0
config.setMinIdle(1);
//在获取连接的时候检查有效性, 默认false
config.setTestOnBorrow(true);
//在空闲时检查有效性, 默认false
config.setTestWhileIdle(false);
//在还给pool时,是否提前进行validate操作
config.setTestOnReturn(true);
// 创建连接池
pool = new JedisPool(config, host, port,timeout);
log.info("create jedis pool:"+pool.toString());
}
private void createSentinelPool() {
// 建立连接池配置参数
GenericObjectPoolConfig config = new GenericObjectPoolConfig();
// 设置最大连接数,和系统句柄有关
config.setMaxTotal(1024);
// 设置最大阻塞时间,记住是毫秒数milliseconds
config.setMaxWaitMillis(1000);
// 设置空间连接
config.setMaxIdle(10);
//config.setTestOnBorrow(true);
//连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true
config.setBlockWhenExhausted(true);
// 创建连接池
Set<String> sentinels = new HashSet<String>();
sentinels.add(host+":"+port);
spool = new JedisSentinelPool("mymaster",sentinels,config,timeout);
log.info("create jedis pool:"+spool.toString());
}
/**
* 在多线程环境同步初始化
*/
private synchronized void poolInit() {
if (pool == null){
createJedisPool();
}
}
private synchronized void spoolInit() {
if (spool == null){
createSentinelPool();
}
}
/**
* 获取一个jedis 对象
*
* @return
*/
public Jedis getJedis() {
if (pool == null)
poolInit();
Jedis tmp = pool.getResource();
int pactive = pool.getNumActive();
int idel = pool.getNumIdle();
int waiters = pool.getNumWaiters();
log.debug("get jedis:active:"+pactive+" idel:"+idel+" waiters:"+waiters);
return tmp;
}
public Jedis getJedisByS() {
if (spool == null)
spoolInit();
Jedis tmp = spool.getResource();
HostAndPort hp = spool.getCurrentHostMaster();
int port = hp.getPort();
String host = hp.getHost();
String lhq = hp.getLocalHostQuietly();
int pactive = spool.getNumActive();
int idel = spool.getNumIdle();
int waiters = spool.getNumWaiters();
log.debug("get jedis:active:"+pactive+" idel:"+idel+" waiters:"+waiters+" port"+port
+" host:"+host+" lhq:"+lhq);
return tmp;
}
public void returnRes(Jedis jedis) {
returnRes(jedis,false);
}
/**
* 归还一个连接
*
* @param jedis
*/
public void returnRes(Jedis jedis,Boolean connectionBroken) {
if(jedis != null){
try{
if(connectionBroken == true){
pool.returnBrokenResource(jedis);
}else{
pool.returnResource(jedis);
}
}catch(Exception ee){
log.error("return res error:"+ee.getMessage());
}
log.info("return res"+jedis.toString());
}
}
public void returnResByS(Jedis jedis) {
if(jedis != null){
spool.returnResource(jedis);
log.info("return res"+jedis.toString());
}
}
/**
* 设置缓存
* @param key
* @param value
* @param time 超时时间 单位是秒
*/
public void addString(String key ,String value,long time) {
Jedis redisClient = null;
try {
redisClient = getJedis();
value = isNullOrEmpty(value) ? "" : value;
//EX: seconds PX:milliseconds
// NX:Only set the key if it does not already exist. XX -- Only set the key if it already exist.
redisClient.set(prefix+"::"+key, value,"NX","EX",time);
} catch (Exception e) {
log.error("add string error:"+e.getMessage());
} finally { // 还原到连接池
returnRes(redisClient);
}
}
public void addString(String key ,String value) {
Jedis redisClient = null;
try {
redisClient = getJedis();
value = isNullOrEmpty(value) ? "" : value;
redisClient.set(prefix+"::"+key, value);
} catch (Exception e) {
log.error("add string error:"+e.getMessage());
} finally { // 还原到连接池
returnRes(redisClient);
}
}
public String getString(String key){
Jedis redisClient = null;
try {
redisClient = getJedis();
return redisClient.get(prefix+"::"+key);
} catch (Exception e) {
log.error("get string error:"+e.getMessage());
} finally { // 还原到连接池
returnRes(redisClient);
}
return null;
}
public void setDataToRedis(String key, String field, String value) {
Jedis redisClient = null;
try {
redisClient = getJedis();
redisClient.hset(prefix+"::"+key, field, value);
} catch (Exception e) { // 销毁对象
log.error("set data to redis error:"+e.getMessage());
} finally { // 还原到连接池
returnRes(redisClient);
}
}
public Map<String, String> getMapData(String key) {
Map<String, String> dataMap = null;
Jedis redisClient = null;
try {
redisClient = getJedis();
dataMap = redisClient.hgetAll(prefix+"::"+key);
} catch (Exception e) { // 销毁对象
log.error("get map data error:"+e.getMessage());
} finally { // 还原到连接池
returnRes(redisClient);
}
return dataMap;
}
public long deleteData(String key) {
long result = 0;
Jedis redisClient = null;
try {
redisClient = getJedis();
result = redisClient.del(prefix+"::"+key);
} catch (Exception e) { // 销毁对象
log.error("delete data error:"+e.getMessage());
} finally { // 还原到连接池
returnRes(redisClient);
}
return result;
}
public String getData(String key, String field) {
String data = null;
Jedis redisClient = null;
try {
redisClient = getJedis();
data = redisClient.hget(key, field);
} catch (Exception e) { // 销毁对象
log.error("get data error:"+e.getMessage());
} finally { // 还原到连接池
returnRes(redisClient);
}
return data;
}
public boolean isNullOrEmpty(Object obj) {
if (obj == null)
return true;
if (obj instanceof CharSequence)
return ((CharSequence) obj).length() == 0;
if (obj instanceof Collection)
return ((Collection) obj).isEmpty();
if (obj instanceof Map)
return ((Map) obj).isEmpty();
if (obj instanceof Object[]) {
Object[] object = (Object[]) obj;
if (object.length == 0) {
return true;
}
boolean empty = true;
for (int i = 0; i < object.length; i++) {
if (!isNullOrEmpty(object[i])) {
empty = false;
break;
}
}
return empty;
}
return false;
}
public Object unserialize( byte[] bytes) {
ByteArrayInputStream bais = null;
try {
// 反序列化
bais = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bais);
return ois.readObject();
} catch (Exception e) {
}
return null;
}
public byte[] serialize(Object object) {
ObjectOutputStream oos = null;
ByteArrayOutputStream baos = null;
try {
// 序列化
baos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(baos);
oos.writeObject(object);
byte[] bytes = baos.toByteArray();
return bytes;
} catch (Exception e) {
}
return null;
}
}
| [
"[[email protected]]"
]
| |
47af788940b203ac40c571c65f32a598c91abf52 | 261d69dfbaa16e7b2cad1ff2df8e30e2a3b47a4c | /app/src/main/java/com/kynlem/solution/streetwitness/dao/IncidentsRemoteDataSource.java | 75e2d73adc3a8c4c47f4b6df3e2b1eee0e915e98 | []
| no_license | melnyk89/street-witness-app | 3c081e4409bd7d67614363e337a62b16cce0541e | 24791bed26d8997ae32a8fc0a16076e0b735dd15 | refs/heads/master | 2021-01-20T02:05:15.032564 | 2017-07-02T15:21:31 | 2017-07-02T15:21:31 | 89,370,605 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,488 | java | package com.kynlem.solution.streetwitness.dao;
import android.os.AsyncTask;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.FormHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.Map;
/**
* Created by oleh on 05.05.17.
*/
public class IncidentsRemoteDataSource implements DataSourceInterface {
private static IncidentsRemoteDataSource INSTANCE = null;
private static String token = "";
private IncidentsRemoteDataSource() {}
public static IncidentsRemoteDataSource getInstance(){
if(INSTANCE == null){
INSTANCE = new IncidentsRemoteDataSource();
}
return INSTANCE;
}
@Override
public void getIncidents(DataSourceCallBackInterface callback) {
String query = "http://street-witness.herokuapp.com/api/incidents/";
GetRequestExecutor getIncidentsQuery = new GetRequestExecutor(callback, query);
getIncidentsQuery.execute();
}
@Override
public void saveIncident(Map<String, Object> dataToStore) {
Log.i("Store ===== ", dataToStore.toString());
PostExecutor executor = new PostExecutor("http://street-witness.herokuapp.com/api/incidents/");
executor.execute(dataToStore);
}
@Override
public void loginUser(String user, String password, LoginCallBackInterface loginCallback) {
PostLoginExecutor executor = new PostLoginExecutor("http://street-witness.herokuapp.com/auth/login",
user,password, loginCallback);
executor.execute();
}
private class PostLoginExecutor extends AsyncTask<Map<String, String>, Void, String> {
private String url;
private String userName;
private String password;
private LoginCallBackInterface callback;
public PostLoginExecutor(final String url, final String userName, final String password, final LoginCallBackInterface callback){
this.url = url;
this.userName = userName;
this.password = password;
this.callback = callback;
}
@Override
protected String doInBackground(Map<String, String>... params) {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setContentType(MediaType.APPLICATION_JSON);
JSONObject body = new JSONObject();
try {
body.put("username", userName);
body.put("password", password);
} catch (JSONException e) {
e.printStackTrace();
}
HttpEntity httpEntity = new HttpEntity(body.toString(), requestHeaders);
try{
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, String.class);
return response.getBody();
} catch (HttpStatusCodeException e) {
switch (e.getStatusCode()){
case NOT_FOUND:
Log.i("NOT FOUND", e.getStatusCode().toString());
break;
default:
Log.i("FAULT", e.getResponseBodyAsString());
}
}
return null;
}
@Override
protected void onPostExecute(String result) {
if (result == null) {
callback.onWrongUserNameOrPassword();
}
else{
try {
JSONObject jsonObject = new JSONObject(result);
callback.onLogin(jsonObject.get("auth_token").toString());
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
private class PostExecutor extends AsyncTask<Map<String, Object>, Void, String> {
private String url;
public PostExecutor(final String url){
this.url = url;
}
@Override
protected String doInBackground(Map<String, Object>... params) {
RestTemplate restTemplate = new RestTemplate();
HttpMessageConverter formHttpMessageConverter = new FormHttpMessageConverter();
HttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
restTemplate.getMessageConverters().add(formHttpMessageConverter);
restTemplate.getMessageConverters().add(stringHttpMessageConverter);
return restTemplate.postForObject(this.url, params[0], String.class);
}
@Override
protected void onPostExecute(String result) {
Log.i("ONPOstExecute - ", result);
}
}
private class GetRequestExecutor extends AsyncTask<Void, Void, ArrayList<Incident>> {
private ArrayList<Incident> data;
private String url;
private DataSourceCallBackInterface callBackInterface;
public GetRequestExecutor(final DataSourceCallBackInterface callBackInterface,
final String url){
this.callBackInterface = callBackInterface;
this.url = url;
}
@Override
protected ArrayList<Incident> doInBackground(Void... params) {
try {
token = callBackInterface.onTokenRequired();
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("Authorization", "Bearer " + token);
HttpEntity entity = new HttpEntity(headers);
ResponseEntity<RequestContainer> requestResponse =
restTemplate.exchange(url,
HttpMethod.GET, entity, new ParameterizedTypeReference<RequestContainer>() {
});
RequestContainer request = requestResponse.getBody();
data = request.getIncidents();
return request.getIncidents();
} catch (HttpStatusCodeException e) {
switch (e.getStatusCode()){
case UNAUTHORIZED:
Log.i("AUTHORIZATION FAILED", e.getStatusCode().toString());
break;
default:
Log.i("FAULT", e.getResponseBodyAsString());
}
}
return null;
}
@Override
protected void onPostExecute(ArrayList<Incident> incidents) {
if (incidents == null){
callBackInterface.onLoginRequired();
}
else {
callBackInterface.onIncidentsLoaded(incidents);
}
}
}
} | [
"[email protected]"
]
| |
34788778baed44c35d4e096ecbbd692c18d3655a | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-devopsguru/src/main/java/com/amazonaws/services/devopsguru/model/transform/UpdateEventSourcesConfigResultJsonUnmarshaller.java | 297d1c5a063430c5588db9eee0ea2163b16a3023 | [
"Apache-2.0"
]
| permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 1,728 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.devopsguru.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.devopsguru.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* UpdateEventSourcesConfigResult JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class UpdateEventSourcesConfigResultJsonUnmarshaller implements Unmarshaller<UpdateEventSourcesConfigResult, JsonUnmarshallerContext> {
public UpdateEventSourcesConfigResult unmarshall(JsonUnmarshallerContext context) throws Exception {
UpdateEventSourcesConfigResult updateEventSourcesConfigResult = new UpdateEventSourcesConfigResult();
return updateEventSourcesConfigResult;
}
private static UpdateEventSourcesConfigResultJsonUnmarshaller instance;
public static UpdateEventSourcesConfigResultJsonUnmarshaller getInstance() {
if (instance == null)
instance = new UpdateEventSourcesConfigResultJsonUnmarshaller();
return instance;
}
}
| [
""
]
| |
b9b7860d7f03413ae0a67c423cd62298b2b1a1bb | dde61f9994e3a6c9c73b07e8600686b7bbaa1404 | /ADS_010_Graphs/Person.java | d621cc20115fd6f96558d740ff18dc93caabd4d2 | []
| no_license | hirupamganguly/Datastructures-Algorithms-Dynamic-Programming | b6dd0e0bd761c48e2d5ad446aa7da7ee63757650 | 7bf9289cb88107921bdc8b3fc786fb10d2eb7863 | refs/heads/main | 2023-02-16T10:04:41.406123 | 2021-01-06T13:12:15 | 2021-01-06T13:12:15 | 327,305,696 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | public class Person {
public String name;
public int weight;
public int index;// it is the value through which graph is represented...
public Person(String name, int weight, int index){
this.name=name;
this.weight=weight;
this.index=index;
}
public String toString(){
return " "+this.index+" "+this.name+" "+this.weight+" ";
}
} | [
"[email protected]"
]
| |
2acc84cf89a624df2a209ba002173c8f937d7fca | 1bbc394d19e1e86c1504c536f84c94255ec41048 | /src/main/java/bolao/services/impl/JogoService.java | 74a32781cd72221f23831b0a31d4daffa2e4e924 | []
| no_license | luiz158/bolao_trovao | f702d3d6a11f055029959dc3c78a1922bc48bc0a | 7121411b0632c4a3bfe3a877640fb2bb01245fd8 | refs/heads/master | 2021-01-21T15:27:25.596794 | 2014-12-19T04:26:38 | 2014-12-19T04:26:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,344 | java | package bolao.services.impl;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import bolao.dao.JogoDAO;
import bolao.excecoes.ApostaException;
import bolao.excecoes.JogoException;
import bolao.model.Aposta;
import bolao.model.Jogo;
import bolao.model.Usuario;
import bolao.services.IApostaService;
import bolao.services.IJogoService;
import bolao.services.IUsuarioService;
@Transactional(readOnly=true)
@Service("jogoService")
public class JogoService implements IJogoService, Serializable {
private static final long serialVersionUID = 1L;
@Autowired
JogoDAO jogoDAO;
@Autowired
IApostaService apostaService;
@Autowired
IUsuarioService usuarioService;
@Override
public List<Jogo> getAllJogos() {
return getJogoDAO().listAll();
}
public JogoDAO getJogoDAO() {
return jogoDAO;
}
public void setJogoDAO(JogoDAO jogoDAO) {
this.jogoDAO = jogoDAO;
}
@Override
public List<Date> getAllDatasJogos() {
return getJogoDAO().datasJogos();
}
@Override
@Transactional(readOnly=false)
public void atualizaJogo(Jogo jogo) throws JogoException {
if(jogo == null || jogo.getId() == null){
throw new JogoException("Impossivel atualizar o jogo, nulo ou sem referencia");
}
Jogo jogoAntigo = this.buscar(jogo);
if(jogoAntigo == null){
throw new JogoException("Jogo nao encontrado");
}
boolean mudouPlacar = jogoDiferePlacar(jogo, jogoAntigo);
this.jogoDAO.merge(jogo);
if(mudouPlacar){
try {
List<Aposta> apostas = this.apostaService.buscaApostasPorJogo(jogo);
for(Aposta a : apostas){
this.apostaService.calculaPontuacao(a);
}
} catch (ApostaException e) {
throw new JogoException("Nao foi possivel buscar as apostas do jogo.", e);
}
}
}
@Override
@Transactional(readOnly=false)
public void adcionaJogo(Jogo jogo) throws JogoException {
if(jogo == null){
throw new JogoException("Impossivel adcionar, jogo nulo");
}
this.jogoDAO.salvar(jogo);
try {
List<Usuario> usuarios = this.usuarioService.getAllUsuarios();
for(Usuario u : usuarios){
Aposta aposta = new Aposta();
aposta.setJogo(jogo);
aposta.setUsuario(u);
this.apostaService.addAposta(aposta);
}
}catch (ApostaException e) {
throw new JogoException("Nao foi possivel adcionar aposta do jogo.", e);
}catch(Exception e){
throw new JogoException("Nao foi possivel adcionar jogo.", e);
}
}
private boolean jogoDiferePlacar(Jogo jogo1, Jogo jogo2){
return (jogo1.getPlacarCasa() !=null &&
!jogo1.getPlacarCasa().equals(jogo2.getPlacarCasa()))
|| (jogo1.getPlacarVisitante() != null &&
!jogo1.getPlacarVisitante().equals(jogo2.getPlacarVisitante()));
}
@Override
public Jogo buscar(Jogo jogo) throws JogoException {
try{
return this.jogoDAO.getOne(jogo.getId());
}catch(Exception e){
throw new JogoException("Falha ao buscar jogo");
}
}
@Override
public List<Jogo> buscaTodosJogosComPlacar() throws JogoException {
try{
return this.jogoDAO.buscaTodosJogosComPlacar();
}catch(Exception e){
throw new JogoException("Falha ao buscar jogos");
}
}
} | [
"[email protected]"
]
| |
882604436d8e8c0739e8e72a1714f165b0acf94a | bb783c9ce85fd83cd2f0e39ec6e8666a701da740 | /01_CODE/src/main/java/hs/util/MD5Util.java | e7d7ab61c0cfd848128925a791025bfcc320912b | []
| no_license | howepeng/highSchool | d7f7a27029629891504ba8414b10655dcd0c157c | 4ef0cad10af26d84e422cbd6f8937b9a72e48450 | refs/heads/master | 2021-01-18T19:26:16.801825 | 2015-05-21T16:38:36 | 2015-05-21T16:38:36 | 18,505,965 | 0 | 0 | null | 2014-11-08T16:22:55 | 2014-04-07T03:59:26 | JavaScript | UTF-8 | Java | false | false | 916 | java | package hs.util;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* MD5加密工具类
*
* @author 孙宇
*
*/
public class MD5Util {
/**
* md5加密
*
* @param str
* @return
*/
public static String md5(String str) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte[] byteDigest = md.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < byteDigest.length; offset++) {
i = byteDigest[offset];
if (i < 0)
i += 256;
if (i < 16)
buf.append("0");
buf.append(Integer.toHexString(i));
}
// 32位加密
return buf.toString();
// 16位的加密
// return buf.toString().substring(8, 24);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
}
}
| [
"[email protected]"
]
| |
614feb493e3f6790f8b4ba01e1341f1ceae8fcf6 | 089df05c3f57b1d074050b8dde76c613abb7f2f0 | /src/dendron/tree/Assignment.java | 968b72901bae69fce92777214015db101d55318c | []
| no_license | trj8497/Mutiple-Interpreter | 1c7f654b9949c76f5c4bd8610de7396127f920e1 | 25e987ee60357b4826cc3f55a69f6b4bb2f05524 | refs/heads/master | 2020-03-30T15:15:27.429832 | 2018-03-09T22:59:11 | 2018-03-09T22:59:11 | 151,355,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,822 | java | /**
* Author's Name: Tejaswini Jgatap
* File Name: Assignment.java
*/
package dendron.tree;
import dendron.machine.Machine;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class Assignment extends Object implements ActionNode {
private String ident;
private ExpressionNode rhs;
/**
* Seting up an Assignment node.
* @param ident the name of the variable that is getting a new value
* @param rhs the expression on the "right-hand side" (RHS) of the assignment statement
*/
public Assignment(String ident, ExpressionNode rhs){
this.ident = ident;
this.rhs = rhs;
}
/**
* Evaluating the RHS expression and assign the result value to the variable.
* @param symTab the table where variable values are stored
*/
@Override
public void execute(Map<String, Integer> symTab) {
int rh = rhs.evaluate(symTab);
symTab.put(ident, rh);
}
/**
* Showing this assignment on standard output as a variable followed
* by an assignment arrow (":=") followed by the infix form of the RHS
* expression.
*/
@Override
public void infixDisplay() {
System.out.print(ident + ":=");
rhs.infixDisplay();
}
/**
* This method returns a STORE instruction for the variable in
* question preceded by the code emitted by the RHS node that eventually
* pushes the value of the expression onto the stack.
* @return
*/
@Override
public List<Machine.Instruction> emit() {
List<Machine.Instruction> load = new ArrayList<>();
Machine.Store store = new Machine.Store(ident);
List<Machine.Instruction> rhload = rhs.emit();
load.addAll(rhload);
load.add(store);
return load;
}
}
| [
"[email protected]"
]
| |
011abf8437e3f3b9f3b464602497c580556927ed | 8851741e8b01cdbda1175777bcc9c82840f36e40 | /src/producer/HelpContext.java | 1ff24984e63178a0097b76a00bf59d591db24892 | []
| no_license | DmitryChebykin/ScaleAppProgram | 2165e5a62aeb4e55eef8763685ef5f55ccc6d58a | 2c200a97b9467e6fd0554ea5ed22f2a8d460a9e7 | refs/heads/master | 2023-05-04T07:02:44.481869 | 2021-05-26T03:23:26 | 2021-05-26T03:23:26 | 370,615,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | package producer;
import util.Messages;
public class HelpContext implements IContext {
@Override
public void run() {
Messages.printHelpInfo();
}
} | [
"[email protected]"
]
| |
f48c6340800354586340468a68a3f669f467a657 | a7c85a1e89063038e17ed2fa0174edf14dc9ed56 | /spring-aop-perf-tests/src/main/java/coas/perf/ComplexCondition300/Advice7.java | f9249ad43792cdbab88ff72f78beca91932dbac0 | []
| no_license | pmaslankowski/java-contracts | 28b1a3878f68fdd759d88b341c8831716533d682 | 46518bb9a83050956e631faa55fcdf426589830f | refs/heads/master | 2021-03-07T13:15:28.120769 | 2020-09-07T20:06:31 | 2020-09-07T20:06:31 | 246,267,189 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,640 | java |
package coas.perf.ComplexCondition300;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
import coas.perf.ComplexCondition300.Subject300;
@Aspect
@Component("Advice_300_7_cc")
public class Advice7 {
@Around("execution(* coas.perf.ComplexCondition300.Subject300.*(..)) and (execution(* *.junk0(..)) or execution(* *.junk1(..)) or execution(* *.junk2(..)) or execution(* *.junk3(..)) or execution(* *.junk4(..)) or execution(* *.junk5(..)) or execution(* *.junk6(..)) or execution(* *.junk7(..)) or execution(* *.junk8(..)) or execution(* *.junk9(..)) or execution(* *.junk10(..)) or execution(* *.junk11(..)) or execution(* *.junk12(..)) or execution(* *.junk13(..)) or execution(* *.junk14(..)) or execution(* *.junk15(..)) or execution(* *.junk16(..)) or execution(* *.junk17(..)) or execution(* *.junk18(..)) or execution(* *.junk19(..)) or execution(* *.junk20(..)) or execution(* *.junk21(..)) or execution(* *.junk22(..)) or execution(* *.junk23(..)) or execution(* *.junk24(..)) or execution(* *.junk25(..)) or execution(* *.junk26(..)) or execution(* *.junk27(..)) or execution(* *.junk28(..)) or execution(* *.junk29(..)) or execution(* *.target(..)))")
public Object onTarget(ProceedingJoinPoint joinPoint) throws Throwable {
int res = (int) joinPoint.proceed();
for (int i=0; i < 1000; i++) {
if (res % 2 == 0) {
res /= 2;
} else {
res = 2 * res + 1;
}
}
return res;
}
}
| [
"[email protected]"
]
| |
c2e70859ef39ce2039bd550d227376a0ef99ad8d | 3dd6a0a537979ceba8b1bd5cd5ff723d04a2603a | /src/main/java/com/job/restapitest/App.java | 71a2cd4f39341d4bd8f944249eba0b4e51d36dcc | []
| no_license | mkarthiatgithub/consumeRest | 855ef2f610693a429b50c6463ab15e83f4dca357 | b970376caca9dd81d54df86c891201ada20861f1 | refs/heads/master | 2022-10-28T01:08:11.612200 | 2020-06-13T23:02:09 | 2020-06-13T23:02:09 | 272,098,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,068 | java | package com.job.restapitest;
import com.job.restapitest.domain.CommentTest;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import java.util.List;
public class App {
public static void main(String[] args) {
ConsumeService consumeService = new ConsumeService();
Response postResponse = consumeService.postService();
Response getResponse = consumeService.getForecast("London");
final List<CommentTest> result = getResponse.readEntity(new GenericType<List<CommentTest>>() {
});
result.stream().forEach(s -> System.out.println(s));
try {
if (postResponse.getStatus() != 201) {
throw new RuntimeException("Failed with HTTP error code : " + postResponse.getStatus());
}
System.out.println("Successfully got result: " + postResponse.toString());
System.out.println("Successfully got result: " + postResponse.readEntity(CommentTest.class).toString());
} finally {
postResponse.close();
}
}
}
| [
"[email protected]"
]
| |
1038f106fd9c97c45024fe6cb65f49e243f714f7 | 28d62135d02d9c792c8539958ad4695e2dcd175d | /oopsdemo/src/oopsdemo3/TestStatic.java | 76eb437e301456e3d613a5fcb09b83e52883ec82 | []
| no_license | KumarSatyam2110/oopsdemo | e76d4d847f7642cc756360ad27af025b98053d90 | e691b8a55aaffc4677b0814e1848b22c1d576b20 | refs/heads/master | 2023-07-12T19:26:44.621656 | 2021-08-04T11:09:44 | 2021-08-04T11:09:44 | 392,645,352 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package oopsdemo3;
public class TestStatic {
public static void main(String[] args) {
Student s1=new Student(101,"Mike");
Student s2=new Student(102,"Sahil");
Student s3=new Student(103,"Siddhu");
s1.display();
s2.display();
s3.display();
}
}
| [
"[email protected]"
]
| |
c832765d8ca278f5dfead98a2ece6f87964bd95a | eb97ee5d4f19d7bf028ae9a400642a8c644f8fe3 | /tags/2008-08-12/seasar2-2.4.27/seasar-benchmark/src/main/java/benchmark/many/b05/NullBean05295.java | 32574d8cb3141a46a9af6f39590a32a9fe62fb53 | []
| no_license | svn2github/s2container | 54ca27cf0c1200a93e1cb88884eb8226a9be677d | 625adc6c4e1396654a7297d00ec206c077a78696 | refs/heads/master | 2020-06-04T17:15:02.140847 | 2013-08-09T09:38:15 | 2013-08-09T09:38:15 | 10,850,644 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 62 | java | package benchmark.many.b05;
public class NullBean05295 {
}
| [
"koichik@319488c0-e101-0410-93bc-b5e51f62721a"
]
| koichik@319488c0-e101-0410-93bc-b5e51f62721a |
5694005ef392ff1656f68d669ffb1e7ab35e664c | 03520180ab45f8dd9339474de34ca856f0d0ae7f | /Wipro/SpiralMatrix.java | df745c08e780baee49fa5452486e91f7c22d02d7 | []
| no_license | swapnil18-bit/Codes | 99668fb08f4b487dc9a7381d1d4f52bd0d9288e1 | dfe76afba01bf171863632dfbb587c4a3540a2e3 | refs/heads/master | 2023-07-20T11:24:07.732270 | 2021-09-08T18:03:24 | 2021-09-08T18:03:24 | 389,111,441 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,220 | java | package Wipro;
import java.util.ArrayList;
import java.util.Arrays;
public class SpiralMatrix {
static void display(int[][] a, int row, int col){
ArrayList <Integer> z = new ArrayList<>();
int top = 0, bot = col-1, left = 0, right = row-1, dir = 0;
while (top<=bot && left<=right){
if (dir==0){
for (int i=left; i<=right; i++){
z.add(a[top][i]);
}
top++;
}else if (dir == 1){
for (int i=top; i<=bot; i++){
z.add(a[i][right]);
}
right--;
}else if (dir == 2){
for (int i=right; i>=left; i--){
z.add(a[bot][i]);
}
bot--;
}else if (dir == 3){
for (int i=bot; i>=top; i--){
z.add(a[i][left]);
}
left++;
}
dir = (dir+1)%4;
}
System.out.println(z);
}
public static void main(String[] args) {
int[][] a = new int[][]{ {1, 2, 3, 4, 5, 6}, {7, 8, 9, 10, 11, 12}, {13, 14, 15, 16, 17, 18}};
display(a, 6, 3);
}
}
| [
"[email protected]"
]
| |
6deb61457335a2f938a034cfa3f1d6d4f994fbb4 | ea2b8c75767b0b767ab2c787cccf88c60ae7a5d2 | /src/test/java/com/example/AutoConfigTest/AutoConfigTestApplicationTests.java | f1fb31c979895454272f845c77d4d2022057949b | []
| no_license | shaunmillar/springboot-autocnfig-app | e399d550cd42f353ca4f24dc4798b1735485d913 | 60e0b10738db8a27bfba4e4ceb251b6a51ee5b4b | refs/heads/master | 2022-09-07T17:22:02.521143 | 2020-05-27T18:12:53 | 2020-05-27T18:12:53 | 266,660,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package com.example.AutoConfigTest;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class AutoConfigTestApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
]
| |
33641cc5c89e172b82195d7a40290a910dfb0d25 | 54f352a242a8ad6ff5516703e91da61e08d9a9e6 | /Source Codes/AtCoder/agc007/F/980687.java | 6c7a0bced9290aada2577531cc8845f68280d43f | []
| no_license | Kawser-nerd/CLCDSA | 5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb | aee32551795763b54acb26856ab239370cac4e75 | refs/heads/master | 2022-02-09T11:08:56.588303 | 2022-01-26T18:53:40 | 2022-01-26T18:53:40 | 211,783,197 | 23 | 9 | null | null | null | null | UTF-8 | Java | false | false | 2,217 | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/**
* @author Pavel Mavrin
*/
public class Main {
private void solve() throws IOException {
int n = nextInt();
String S = next();
String T = next();
if (S.equals(T)) {
out.println(0);
return;
}
int j = n - 1;
int res = 0;
int[] q = new int[n + 1];
int h = 0;
int t = 0;
int d = 0;
int jj = n;
for (int i = n - 1; i >= 0; i--) {
if (j > i) j = i;
while (j >= 0 && S.charAt(j) != T.charAt(i)) j--;
if (j < 0) {
out.println(-1);
return;
}
while (t > h) {
int xx = q[h] - d;
if (xx > i) {
h++;
} else {
break;
}
}
if (j < i && j != jj) {
d++;
q[t++] = (j + d);
res = Math.max(res, t - h);
}
jj = j;
// System.out.println(i + " " + j);
// for (int e = h; e < t; e++) {
// System.out.println(q[e] - d);
// }
}
out.println(res);
}
private BufferedReader br;
private PrintWriter out;
private StringTokenizer st;
String next() throws IOException {
while (st == null || !st.hasMoreTokens()) {
st = new StringTokenizer(br.readLine());
}
return st.nextToken();
}
int nextInt() throws IOException {
return Integer.parseInt(next());
}
long nextLong() throws IOException {
return Long.parseLong(next());
}
public static void main(String[] args) throws IOException {
new Main().run();
}
private void run() throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
solve();
out.close();
}
} | [
"[email protected]"
]
| |
ae1ed166363d6babae69c6b51cc91e53274ea67a | 1a73b7b663a0beb318b69e977987c46d816e350c | /app/src/main/java/com/millennium/followme/MainActivity.java | f45315146da8f3897727664284e5478d00957a51 | []
| no_license | coolsgupta/FollowMe | 77ccdd7f8e3c2912cb2ae4dfb702403d6010b3c9 | 050de926cef71674dcec1ebd4f18f999460bdae5 | refs/heads/master | 2021-01-20T19:56:38.017769 | 2016-08-08T14:33:04 | 2016-08-08T14:33:04 | 65,211,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,674 | java | package com.millennium.followme;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class MainActivity extends AppCompatActivity {
private Button mGuideButton;
private Button mFollowButton;
private TextView mStatusTextView;
public static final MediaType JSON
= MediaType.parse("application/json; charset=utf-8");
private static String URL;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mGuideButton = (Button) findViewById(R.id.guideButton);
mFollowButton = (Button) findViewById(R.id.followButton);
mStatusTextView = (TextView) findViewById(R.id.statusTextView);
}
public void guide(View view) {
mFollowButton.setVisibility(View.INVISIBLE);
mGuideButton.setVisibility(View.INVISIBLE);
mStatusTextView.setVisibility(View.VISIBLE);
final double[] latitude = new double[1];
final double[] longitude = new double[1];
URL = "http://tracknfollowme.achintsatsangi.com/users/receiver1.php";
OkHttpClient client = new OkHttpClient();
/*String post (String URL,String json) throws IOException {
RequestBody body = RequestBody.create(JSON, );
Request request = new Request.Builder()
.url(URL)
.post(body)
.build();
Response response = null;
try {
response = client.newCall(request).execute();
} catch (IOException e) {
e.printStackTrace();
}
try {
return response.body().string();
} catch (IOException e) {
e.printStackTrace();
}
}*/
LocationManager locationManager = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
LocationListener locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location loc) {
Toast.makeText(
getBaseContext(),
"Location changed: Lat: " + loc.getLatitude() + " Lng: "
+ loc.getLongitude(), Toast.LENGTH_SHORT).show();
longitude[0] = loc.getLongitude();
latitude[0] = loc.getLatitude();
Log.d("marvin",latitude[0]+","+longitude[0]);
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
};
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
mStatusTextView.setText("permission problem");
}
locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER, 0, 0, locationListener);
}
public void follow (View view){
Intent intent = new Intent(this, MapsActivity.class);
startActivity(intent);
}
}
| [
"="
]
| = |
dfc34bd54c59ca2518d40fd97348dc2149b23fda | 902ea8d12c94eeb11f493bdde15bef62d5571977 | /app/src/test/java/ru/ridewithme/testapp/ExampleUnitTest.java | 79156c6b4a5909d6955a9e4c74db767a5c988fdb | []
| no_license | xixsuse/Withme-testapp | 04f4772d79785d14a1ec5091f82ed2818e6ae36c | c1813dfdd74797d74595ce634d1288287346dca0 | refs/heads/master | 2021-04-09T15:50:55.472935 | 2016-02-28T09:04:28 | 2016-02-28T09:04:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 314 | java | package ru.ridewithme.testapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"idbolshakov@desktop"
]
| idbolshakov@desktop |
1dbea63e2f7115424378b64f16437d651020d4c4 | b2ca3ebaea76e42e9a5030ba068c230e9131cdf8 | /app/src/main/java/com/github/baoti/pioneer/data/api/AccountApi.java | 5d85714c4e9327110f6848b3bab7c1d675bbb3b2 | [
"Apache-2.0"
]
| permissive | CocofoxStudios/Pioneer | 6a55389a13e7813acefc4b15366f480ed0ada51d | adcd70a0a2958ef3f861715dcfdecf3d8988a880 | refs/heads/master | 2020-06-11T03:50:47.020808 | 2016-12-03T05:55:55 | 2016-12-03T05:55:55 | 76,010,425 | 1 | 0 | null | 2016-12-09T07:01:27 | 2016-12-09T07:01:27 | null | UTF-8 | Java | false | false | 987 | java | /*
* Copyright (c) 2014-2015 Sean Liu.
*
* 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.github.baoti.pioneer.data.api;
import com.github.baoti.pioneer.entity.Account;
import retrofit.http.POST;
import retrofit.http.Query;
/**
* Created by liuyedong on 14-12-18.
*/
public interface AccountApi {
@POST("/account/login")
ApiResponse<Account> login(@Query("account") String accountId, @Query("pwd") String password)
throws ApiException;
}
| [
"[email protected]"
]
| |
a6f34928f124c75f720f88512d1dbceba5d77223 | 1deaf31dd9526c94a1ecae03a495cfd8b81d2b93 | /authorization_module/AuthorizationFacade.java | 4f216eb590cc057ae234f21a93fd976cb7e0a890 | [
"MIT"
]
| permissive | Sigmapoint/authorization_module | ce4894eeea8e396b57a54f67b3bd5045cdc49087 | 9e76c7859796c6fec9b51ad5b983ba2a08235b18 | refs/heads/master | 2016-09-03T04:11:40.185500 | 2014-05-28T13:01:25 | 2014-05-28T13:01:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,385 | java | package authorization_module.authorization_module;
import authorization_module.authorization_module.core.AuthUser;
import authorization_module.authorization_module.core.SessionTokenHelper;
import authorization_module.authorization_module.core.UserSession;
import be.objectify.deadbolt.core.models.Role;
import models.db.customers.Customer;
import models.db.customers.User;
import org.mindrot.jbcrypt.BCrypt;
import play.mvc.Http;
import javax.persistence.PersistenceException;
import java.util.List;
public class AuthorizationFacade {
private static UsersManager manager;
public static String login(UserAuthentication user) throws UserNotExistsException, WrongCredentialsException, PersistenceException {
AuthUser authUser = AuthUser.find.where().eq("ID", user.getID()).findUnique();
if (authUser == null) {
throw new UserNotExistsException();
}
if (!BCrypt.checkpw(user.getPassword(), authUser.getPasswordSaltAndHash())) {
throw new WrongCredentialsException();
}
String token = SessionTokenHelper.generateToken();
UserSession userSession = new UserSession(authUser, token);
userSession.save();
return token;
}
private static void logoutUsingToken(String token) throws SessionNotExistsException {
UserSession userSession = UserSession.find.where().eq("token", token).findUnique();
if (userSession == null) {
throw new SessionNotExistsException();
}
userSession.delete();
}
public static String getIDLoggedUser(Http.Context context) {
String sessionToken = SessionTokenHelper.getSessionTokenFromHeader(context);
if (sessionToken != null) {
UserSession userSessionFromDB = UserSession.find.where().eq("token", sessionToken).findUnique();
if (userSessionFromDB != null) {
return userSessionFromDB.getUser().getID();
}
}
return null;
}
public static void logoutUserUsingContext(Http.Context ctx) throws SessionNotExistsException {
String sessionToken = SessionTokenHelper.getSessionTokenFromHeader(ctx);
logoutUsingToken(sessionToken);
}
public static void registerForAuth(UserAuthentication user) throws UnableToRegisterException {
String passwordSaltAndHash = BCrypt.hashpw(user.getPassword(), BCrypt.gensalt());
AuthUser auth = new AuthUser(user.getID(), passwordSaltAndHash);
try {
auth.save();
} catch (Exception e) {
throw new UnableToRegisterException(e.getMessage());
}
}
public static void changePassword(Http.Context ctx, String oldPassword, String newPassword) throws SessionNotExistsException, WrongCredentialsException {
String sessionToken = SessionTokenHelper.getSessionTokenFromHeader(ctx);
UserSession userSession = UserSession.find.fetch(UserSession.AUTH_USER_NAME).where().eq("token", sessionToken).findUnique();
if (userSession == null) {
throw new SessionNotExistsException();
}
AuthUser user = userSession.getUser();
if (user == null || !BCrypt.checkpw(oldPassword, user.getPasswordSaltAndHash())) {
throw new WrongCredentialsException();
}
user.setPasswordSaltAndHash(BCrypt.hashpw(newPassword, BCrypt.gensalt()));
user.update();
}
public static boolean canBeRegistered(UserAuthentication user) {
return AuthUser.find.where().eq("ID", user.getID()).findList().size() == 0;
}
public static void setManager(UsersManager manager) {
AuthorizationFacade.manager = manager;
}
public static List<? extends Role> getRoles(String userID) {
return manager.getRolesByID(userID);
}
public static void resetPassword(User user) throws UserNotExistsException {
AuthUser authUser = AuthUser.find.where().eq("ID", user.getID()).findUnique();
if (authUser == null) {
throw new UserNotExistsException();
}
// TODO ewentualne wylogowania aktualnych sesji
authUser.setPasswordSaltAndHash(BCrypt.hashpw(user.getPassword(), BCrypt.gensalt()));
authUser.save();
}
public static void unregisterFromAuth(UserAuthentication user) throws UserNotExistsException {
AuthUser authUser = AuthUser.find.where().eq("ID", user.getID()).findUnique();
if (authUser == null) {
throw new UserNotExistsException();
}
logoutAllSessionsOfUser(authUser);
authUser.delete();
}
private static void logoutAllSessionsOfUser(AuthUser authUser) {
List<UserSession> deletingUserSessions = UserSession.find.where().eq("user", authUser).findList();
for (UserSession session : deletingUserSessions) {
session.delete();
}
}
}
| [
"[email protected]"
]
| |
5c1b86a849a1bd7f2369055dbc998843c073a079 | ce596e0092df8a8dc1b05b315be616a369ca3028 | /src/main/java/com/redhat/fuse/apicurio/ApplicationCorsConfiguration.java | f42073ffff87ee7fa3ea5f0997d02012d759e9ba | []
| no_license | juliusgun/fuse-apicurito-generator | 4256e1e748ce06f2a21d932b07847963186a63a4 | f8f0da77e2c85472790bcaa6277b8e44de6d35cd | refs/heads/master | 2023-04-24T23:48:53.369127 | 2020-12-03T13:14:27 | 2020-12-03T13:14:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,874 | java | /*
* Copyright (C) 2018 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.redhat.fuse.apicurio;
import java.util.Arrays;
import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.filter.CorsFilter;
@Configuration
@EnableConfigurationProperties
@ConfigurationProperties("cors")
public class ApplicationCorsConfiguration {
private List<String> allowedOrigins = Arrays.asList(CorsConfiguration.ALL);
public List<String> getAllowedOrigins() {
return allowedOrigins;
}
public void setAllowedOrigins(List<String> allowedOrigins) {
this.allowedOrigins = allowedOrigins;
}
@Bean
public CorsFilter corsFilter() {
return new CorsFilter(request -> {
CorsConfiguration config = new CorsConfiguration();
config.setAllowedOrigins(allowedOrigins);
config.setAllowedMethods(Arrays.asList("HEAD", "GET", "POST", "PUT", "DELETE", "PATCH"));
config.applyPermitDefaultValues();
return config;
});
}
}
| [
"[email protected]"
]
| |
58baa5cb9ef4339918c38ca95ec07544b354d510 | 946d708e2c154ac7b2954f1df6f855b45c28fbe6 | /Kumite_Common/src/definition/Jogai.java | beffaba48917476e8d104535881a46026e5e825e | []
| no_license | gundermann/Wettkampfverwaltung_Desktop | 849763a0ce5ab5014ef05cf3c891acedddb5d54f | d4e50352225cc80ac7675d39a53457d54ee26e6b | refs/heads/master | 2020-07-05T08:27:47.842202 | 2013-08-12T05:51:51 | 2013-08-12T05:51:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 267 | java | package definition;
public enum Jogai {
NONE, JOGAI, JOGAICHUI, JOGAIHANSUKO;
public int toNumber(){
switch (this) {
case JOGAI:
return 1;
case JOGAICHUI:
return 2;
case JOGAIHANSUKO:
return 3;
default:
return 0;
}
}
}
| [
"[email protected]"
]
| |
967fa9168c1aca8bab60f8ab2524498db3d1d120 | c4820a1c7defc581c1b47f72b97364dbdfb29fe1 | /src/main/java/io/reactivesw/product/infrastructure/util/ReferenceTypes.java | 53c7be06d7da27b7fa32f9ca9c3f5cf855cf0b2b | []
| no_license | reactivesw/product-admin | 026e68233e2f87bfe718c3a6bd965381256c6186 | 221e0ddfeaef852be255d1890d68e40e7ecf2082 | refs/heads/master | 2021-01-23T00:06:00.684033 | 2017-03-21T12:33:53 | 2017-03-21T12:33:53 | 85,693,185 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | package io.reactivesw.product.infrastructure.util;
/**
* Created by Davis on 16/11/16.
*/
public enum ReferenceTypes {
CUSTOMERGROUP("customer-group"),
CHANNEL("channel"),
PRODUCTTYPE("product-type"),
CATEGORY("category"),
CART("cart"),
ZONE("zone"),
CARTDISCOUNT("cart-discount"),
SHIPPING_METHOD("shipping-method"),
STATE("state"),
CUSTOMER("customer"),
ORDER("order"),
PAYMENT("payment"),
TAXCATEGORY("tax-category");
private String value;
private ReferenceTypes(String value) {
this.value = value;
}
/**
* get type id.
*
* @return String
*/
public String getType() {
return this.value;
}
}
| [
"[email protected]"
]
| |
3bec43354f610b981804c4751bfd3fe31ad03ef8 | d2a6f18f24fe4866ec687f82fdde2a98fa9df368 | /OpenImmo/src/main/jaxb/org/openestate/io/openimmo/xml/Zimmer.java | 257e817456374ffc633b5776225b46982cd87e9c | [
"Apache-2.0"
]
| permissive | jcelmeta14/OpenEstate-IO | 0255ec398cfaa55233e5e6e6d322a4410c82c3fb | 180e62a1c23596e5e284ce7fc6d07081918b0a38 | refs/heads/master | 2023-07-14T22:51:46.528402 | 2021-08-16T00:50:09 | 2021-08-16T00:50:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,520 | java |
package org.openestate.io.openimmo.xml;
import java.io.Serializable;
import javax.annotation.Generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jvnet.jaxb2_commons.lang.CopyStrategy2;
import org.jvnet.jaxb2_commons.lang.CopyTo2;
import org.jvnet.jaxb2_commons.lang.Equals2;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy2;
import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString2;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy2;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;
/**
* Java class for <zimmer> element.
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "zimmer")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2021-08-07T06:31:15+02:00", comments = "JAXB RI v2.3.0")
public class Zimmer implements Serializable, Cloneable, CopyTo2, Equals2, ToString2
{
@XmlAttribute(name = "zimmertyp")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2021-08-07T06:31:15+02:00", comments = "JAXB RI v2.3.0")
protected Zimmer.Zimmertyp zimmertyp;
/**
* Gets the value of the zimmertyp property.
*
* @return
* possible object is
* {@link Zimmer.Zimmertyp }
*
*/
@Generated(value = "com.sun.tools.xjc.Driver", date = "2021-08-07T06:31:15+02:00", comments = "JAXB RI v2.3.0")
public Zimmer.Zimmertyp getZimmertyp() {
return zimmertyp;
}
/**
* Sets the value of the zimmertyp property.
*
* @param value
* allowed object is
* {@link Zimmer.Zimmertyp }
*
*/
@Generated(value = "com.sun.tools.xjc.Driver", date = "2021-08-07T06:31:15+02:00", comments = "JAXB RI v2.3.0")
public void setZimmertyp(Zimmer.Zimmertyp value) {
this.zimmertyp = value;
}
@Generated(value = "com.sun.tools.xjc.Driver", date = "2021-08-07T06:31:15+02:00", comments = "JAXB RI v2.3.0")
public String toString() {
final ToStringStrategy2 strategy = JAXBToStringStrategy.INSTANCE2;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
@Generated(value = "com.sun.tools.xjc.Driver", date = "2021-08-07T06:31:15+02:00", comments = "JAXB RI v2.3.0")
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
@Generated(value = "com.sun.tools.xjc.Driver", date = "2021-08-07T06:31:15+02:00", comments = "JAXB RI v2.3.0")
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) {
{
Zimmer.Zimmertyp theZimmertyp;
theZimmertyp = this.getZimmertyp();
strategy.appendField(locator, this, "zimmertyp", buffer, theZimmertyp, (this.zimmertyp!= null));
}
return buffer;
}
@Generated(value = "com.sun.tools.xjc.Driver", date = "2021-08-07T06:31:15+02:00", comments = "JAXB RI v2.3.0")
public Object clone() {
return copyTo(createNewInstance());
}
@Generated(value = "com.sun.tools.xjc.Driver", date = "2021-08-07T06:31:15+02:00", comments = "JAXB RI v2.3.0")
public Object copyTo(Object target) {
final CopyStrategy2 strategy = JAXBCopyStrategy.INSTANCE2;
return copyTo(null, target, strategy);
}
@Generated(value = "com.sun.tools.xjc.Driver", date = "2021-08-07T06:31:15+02:00", comments = "JAXB RI v2.3.0")
public Object copyTo(ObjectLocator locator, Object target, CopyStrategy2 strategy) {
final Object draftCopy = ((target == null)?createNewInstance():target);
if (draftCopy instanceof Zimmer) {
final Zimmer copy = ((Zimmer) draftCopy);
{
Boolean zimmertypShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.zimmertyp!= null));
if (zimmertypShouldBeCopiedAndSet == Boolean.TRUE) {
Zimmer.Zimmertyp sourceZimmertyp;
sourceZimmertyp = this.getZimmertyp();
Zimmer.Zimmertyp copyZimmertyp = ((Zimmer.Zimmertyp) strategy.copy(LocatorUtils.property(locator, "zimmertyp", sourceZimmertyp), sourceZimmertyp, (this.zimmertyp!= null)));
copy.setZimmertyp(copyZimmertyp);
} else {
if (zimmertypShouldBeCopiedAndSet == Boolean.FALSE) {
copy.zimmertyp = null;
}
}
}
}
return draftCopy;
}
@Generated(value = "com.sun.tools.xjc.Driver", date = "2021-08-07T06:31:15+02:00", comments = "JAXB RI v2.3.0")
public Object createNewInstance() {
return new Zimmer();
}
@Generated(value = "com.sun.tools.xjc.Driver", date = "2021-08-07T06:31:15+02:00", comments = "JAXB RI v2.3.0")
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy2 strategy) {
if ((object == null)||(this.getClass()!= object.getClass())) {
return false;
}
if (this == object) {
return true;
}
final Zimmer that = ((Zimmer) object);
{
Zimmer.Zimmertyp lhsZimmertyp;
lhsZimmertyp = this.getZimmertyp();
Zimmer.Zimmertyp rhsZimmertyp;
rhsZimmertyp = that.getZimmertyp();
if (!strategy.equals(LocatorUtils.property(thisLocator, "zimmertyp", lhsZimmertyp), LocatorUtils.property(thatLocator, "zimmertyp", rhsZimmertyp), lhsZimmertyp, rhsZimmertyp, (this.zimmertyp!= null), (that.zimmertyp!= null))) {
return false;
}
}
return true;
}
@Generated(value = "com.sun.tools.xjc.Driver", date = "2021-08-07T06:31:15+02:00", comments = "JAXB RI v2.3.0")
public boolean equals(Object object) {
final EqualsStrategy2 strategy = JAXBEqualsStrategy.INSTANCE2;
return equals(null, null, object, strategy);
}
/**
*
* Java enum for <em>zimmertyp</em> attribute in <zimmer> elements.
*
* <p>Java class for null.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="ZIMMER"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "")
@XmlEnum
@Generated(value = "com.sun.tools.xjc.Driver", date = "2021-08-07T06:31:15+02:00", comments = "JAXB RI v2.3.0")
public enum Zimmertyp {
ZIMMER;
public String value() {
return name();
}
public static Zimmer.Zimmertyp fromValue(String v) {
return valueOf(v);
}
}
}
| [
"[email protected]"
]
| |
df29bfd8d6c2a407ec8c678f9dcb2e2029649c2f | 8d21798354fca90c8efef394e6a2d6332f60f6c0 | /xinfo-msrv-frame/src/main/java/com/xinyi/xinfo/util/ReturnJSONUtils.java | bc7aeffb4f2fd4974f1f366bbf98241eb88ad111 | []
| no_license | dudefu/springboot_MybatisPlus | 177214cd13b15c536ee348c6f758964b1d612d20 | dfda681156d86ce171bc2e774d0fae69da3392da | refs/heads/master | 2023-08-07T21:43:50.441720 | 2019-08-26T06:27:24 | 2019-08-26T06:27:24 | 203,561,816 | 0 | 0 | null | 2023-07-22T14:09:00 | 2019-08-21T10:32:00 | Java | UTF-8 | Java | false | false | 1,707 | java | package com.xinyi.xinfo.util;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.xinyi.xinfo.constants.CodeMsg;
import com.xinyi.xinfo.domain.model.ReturnJSON;
@Component
public class ReturnJSONUtils
{
@Autowired
private HttpServletRequest request;
private static ReturnJSONUtils returnJSONUtils;
@PostConstruct
public void init()
{
returnJSONUtils = this;
returnJSONUtils.request = this.request;
}
/**
* 设置接口返回的JSON值
*
* @param data
* 返回数据
* @param code
* 错误码
*/
public static ReturnJSON setReturnJson(Object data, Integer... code)
{
ReturnJSON json = new ReturnJSON();
json.setCmd(returnJSONUtils.request.getRequestURI());
int codeId = CodeMsg.C404;
if (code != null && code.length > 0)
{
codeId = code[0];
}
json.setCode(codeId);
if (data != null)
{
json.setData(data);
return json;
}
String codeMsg = "C" + codeId + "_MSG";
String message;
try
{
message = (String) CodeMsg.class.getField(codeMsg).get(new CodeMsg());
}
catch (Exception e)
{
message = null;
}
json.setData(message);
return json;
}
public static String getCmd()
{
return returnJSONUtils.request.getRequestURI();
}
}
| [
"[email protected]"
]
| |
66522004ff4246bdeaebe74243d3483c2d69f760 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/main/java/org/gradle/test/performancenull_227/Productionnull_22668.java | 18be646806ecf9f002af259c31e8a864784915fc | []
| no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 588 | java | package org.gradle.test.performancenull_227;
public class Productionnull_22668 {
private final String property;
public Productionnull_22668(String param) {
this.property = param;
}
public String getProperty() {
return property;
}
private String prop0;
public String getProp0() {
return prop0;
}
public void setProp0(String value) {
prop0 = value;
}
private String prop1;
public String getProp1() {
return prop1;
}
public void setProp1(String value) {
prop1 = value;
}
}
| [
"[email protected]"
]
| |
88a37da8fb3d28e3c63e522c5e357bf064394f45 | 38c01813cf4a441cf2d511e67e6535a331fd9e2e | /website/src/main/java/com/nplatform/utils/MessageSourceUtils.java | 24e548c3bc337d788900dffee741bcbb68410208 | []
| no_license | sliu1975/vivo | 451e027f28e0a139daa84ae61ed27394638bebd3 | 6f3a7e3de6d966f1773a2a610e9b8350945b1b99 | refs/heads/master | 2023-01-18T18:01:11.716100 | 2019-07-09T02:11:44 | 2019-07-09T02:11:44 | 195,624,221 | 0 | 0 | null | 2023-01-12T11:50:33 | 2019-07-07T07:46:57 | JavaScript | UTF-8 | Java | false | false | 648 | java | package com.nplatform.utils;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Locale;
@Component
public class MessageSourceUtils {
private String locale;
@Resource(name = "resource")
private MessageSource messageSource;
public String getMSg(String key) {
Locale loc = Locale.US;
if ("CHINA".equals(locale)) {
loc = Locale.CHINA;
}
return messageSource.getMessage(key,null, loc);
}
public String getLocale() {
return locale;
}
public void setLocale(String locale) {
this.locale = locale;
}
}
| [
"[email protected]"
]
| |
db632617a5cafc6e95e41f24e736683c60a177db | d3a484f7229187a4cbdf28b803ce5aa8a5633dd1 | /src/main/java/info/gianlucacosta/mytasks/WebSecurityConfig.java | 8111923f7e0935f570241ff49262ca8829cd4eaa | [
"Apache-2.0"
]
| permissive | giancosta86/MyTasksWebService | b0c958c0fc8f6e78b493a41e93e43ee4c7760289 | 289e61aeef97f8516219a96c70579156ef81d279 | refs/heads/master | 2021-01-23T13:41:36.660496 | 2017-09-07T01:10:12 | 2017-09-07T01:10:12 | 102,673,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,410 | java | /*^
===========================================================================
MyTasksWebService
===========================================================================
Copyright (C) 2017 Gianluca Costa
===========================================================================
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 info.gianlucacosta.mytasks;
import info.gianlucacosta.mytasks.model.users.User;
import info.gianlucacosta.mytasks.webservice.UserController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationProvider;
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;
/**
* Configuration for web security: authentication and authorization settings
*/
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private AuthenticationProvider authenticationProvider;
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf()
.disable()
.authenticationProvider(authenticationProvider)
.authorizeRequests()
.antMatchers(UserController.path + "/**")
.hasAuthority(User.ADMIN_NAME)
.antMatchers(HttpMethod.OPTIONS, "/**")
.permitAll()
.anyRequest()
.authenticated()
.and()
.httpBasic();
}
} | [
"[email protected]"
]
| |
dadc48a6c8a20232e1f68c1fc4c75eef52554979 | 0cb22f20864a339d66bc1782b9ef879f696ae43e | /server/src/Utilities/ServerSender.java | 751e8e58e04dec2c428f4c49e4fa3782a45d4fd1 | []
| no_license | SaintLaurentPrince/Lab66666 | cccd73c7174586d778325ec86adcbe47638d8ef9 | 7b4e032af96778e37220271788c71236abeca0bc | refs/heads/master | 2022-12-12T08:09:06.670978 | 2020-09-11T14:29:30 | 2020-09-11T14:29:30 | 294,717,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 916 | java | package Utilities;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
public class ServerSender {
public static Socket currentClientSocket;
public static void send(Object o,int answer){
//0 - Не нужен ответ и готов к команде
//1 - Нужен ответ,к команде не готов
//2 - чисто для апдейта
try {
Map<Object,Integer> answerMap = new HashMap<>();
answerMap.put(o,answer);
System.out.println("Отсылаю ответ клиенту.");
ObjectOutputStream objectOutputStream = new ObjectOutputStream(currentClientSocket.getOutputStream());
objectOutputStream.writeObject(answerMap);
} catch (IOException e) {
System.err.println();
}
}
} | [
"[email protected]"
]
| |
5c80e3d7dc28f4dd4c73ac1375fba233cc6b1c40 | 225ecca70d42e0d7db7b080a0b69fd24d3af35f5 | /Java-Assignment/Assg-3-JAVA/src/com/java/org/PersonDetails.java | 732ba2be22831823671c507555b1f6f5f0b9a83a | []
| no_license | niraj2998/JAVA-Assignment | f1f66a2714387f70f47a21bd0786c25938797f12 | 5c4676cabbcd15db61729ee9f19e67aa923a67ce | refs/heads/main | 2023-04-27T21:28:27.567410 | 2021-05-15T04:47:46 | 2021-05-15T04:47:46 | 367,361,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,291 | java | package com.java.org;
import java.util.*;
public class PersonDetails implements Comparable {
int Weight;
int Height;
String name;
PersonDetails(int Weight, int Height, String name) {
this.Height = Height;
this.Weight = Weight;
this.name = name;
}
@Override
public String toString() {
return "Person [Weight=" + Weight + ", Height=" + Height + ", name=" + name + "]";
}
@Override
public int compareTo(Object o) {
int Weight1 = this.Weight;
int Height1 = this.Height;
PersonDetails p = (PersonDetails) o;
int Weight2 = p.Weight;
int Height2 = p.Height;
if (Weight1 < Weight2) {
return -1;
} else if (Weight1 > Weight2) {
return +1;
} else {
if (Height1 < Height2) {
return -1;
} else if (Height1 > Height2) {
return 1;
}
}
return Height2;
}
}
class Sortmain {
public static void main(String[] args) {
PersonDetails p1 = new PersonDetails(59, 5, "Hulk");
PersonDetails p2 = new PersonDetails(66, 7, "Spidy");
PersonDetails p3 = new PersonDetails(45, 8, "Thor");
PersonDetails p4 = new PersonDetails(45, 6, "Tom");
PersonDetails p5 = new PersonDetails(45, 4, "Jerry");
TreeSet<PersonDetails> n = new TreeSet<>();
n.add(p1);
n.add(p2);
n.add(p3);
n.add(p4);
n.add(p5);
System.out.println(n);
}
} | [
"[email protected]"
]
| |
61d540df64d224c4bd8a812230921532f492b11f | 80dbf4ee67e081be010ae67f3ec3f65569464b14 | /08- ArrayObjetos/src/empresa/Empresa.java | 249639b40ec5d887e1a94b6c4b6958fc5d6e116d | []
| no_license | daviddaw/08-ArrayObjetos | d44916374c181e54ad24d544de33f9f6c6d2a732 | 74657b055886efea6e9f85093f3049fe4bf5c90b | refs/heads/master | 2020-03-16T16:59:52.674400 | 2018-05-09T21:38:31 | 2018-05-09T21:38:31 | 132,813,443 | 0 | 0 | null | null | null | null | IBM852 | Java | false | false | 3,719 | java | package empresa;
import java.util.Scanner;
public class Empresa {
//private final int numDpto=4;
private Departamento[] arrayDpto;
public Empresa() {//Estamoscreando un array de Departamentos, numDpto indica el tam˝o del array
arrayDpto = new Departamento[4];
}
public Departamento[] getArrayDpto() {
return arrayDpto;
}
public void setArrayDpto(Departamento[] arrayDpto) {
this.arrayDpto = arrayDpto;
}
public void altaDpto2() {
Scanner in = new Scanner(System.in);
int codDptoAux=in.nextInt();
/*buscarDpto(codDptoAux);*/
Departamento dptoAux =buscarDpto(codDptoAux);
if (dptoAux != null) {
System.out.println(" El departamento ya existe");
}else {
nuevoDpto(codDptoAux);
}
}
public Departamento nuevoDpto(int codDptoAux) {
Scanner in = new Scanner(System.in);
String nombreDptoAux=in.next();
Departamento dptoAux=buscarDptoNombre(nombreDptoAux);
if (dptoAux!=null) {
System.out.println("El departamento "+dptoAux.toString()+"ya existe");
}else {//continuamos con el alta
System.out.println("Introduce el numero de empleados");
int numEmp=in.nextInt();
dptoAux=new Departamento(/*codDptoAux*/nombreDptoAux, numEmp);
//inserto en la posicion e la posicion codigodepartamento -1
}
return dptoAux;
}
public void insertarDpto(Departamento dptAux) {
}
public Departamento buscarDptoNombre(String nombreDptoAux) {
Departamento dptoAux=null;
boolean encontrado=false;
//busqueda secuencial del nombre enel array
for (int i = 0; i < arrayDpto.length && !encontrado; i++) {
if (arrayDpto[i]!=null && arrayDpto[i].getNombre().equalsIgnoreCase(nombreDptoAux)) {//Puededar un error si esta en null
dptoAux=arrayDpto[i];//Lo hemos encontrado
encontrado=true;//Duda
}
else {
encontrado=false;
/*System.out.println("No existe");*/ //no se pone puede estar en otra posicion
//solo cuando acabe el for podremos ponerlo
}
}
return dptoAux;
}
public Departamento buscarDpto(int codDptoAux) {
// devuelve el departamento si lo encuentra si no hay devuelve null
return arrayDpto[codDptoAux-1];
}
//secuencial
/* public boolean buscarDpto(int codDptoAux) {//no es tan eficaz
if (arrayDpto[codDptoAux-1]==null)
return false;
else {
return true;
}
}*/
public void altaDpto(String nombre, int numeroEmpleados) {//Pide los datos necesarios por parametro, nombre y numero de empleados
Departamento dpto1 = new Departamento(nombre,numeroEmpleados);//El constructor esta en departamento
//inserto el departamento creado en un array
System.out.println(" cod dpto"+dpto1.getCodDpto());
for (int i = 0; i < arrayDpto.length; i++) {
System.out.println(arrayDpto.length);
}
}
public void asignarEmpDpto() {
// TODO Auto-generated method stub
}
public void visualizarDpto() {
// TODO Auto-generated method stub
}
public void buscarEmpDptoCod() {
// TODO Auto-generated method stub
}
public void buscarNombreEmpDpto() {
// TODO Auto-generated method stub
}
public void incrementarSueldoEmp() {
// TODO Auto-generated method stub
}
public void borrarEmpleado() {
// TODO Auto-generated method stub
}
public void visualizarEmpMaxSueldo() {
// TODO Auto-generated method stub
}
public void visualizarEmpMaxSueldoEmpresa() {
// TODO Auto-generated method stub
}
public void insertarDpto() {
// TODO Auto-generated method stub
}
}
| [
"[email protected]"
]
| |
768707c66c293816199baa5860adcaa58f86e5b9 | 3d37bdb0a6a66e200985f057ff125648847f36b1 | /app/src/main/java/com/ibm/mysampleapp/camera/CameraHelper.java | dd2696d5a9b457d5032dc15d63bf1ed3a618eb95 | [
"MIT",
"Apache-2.0"
]
| permissive | kuldeep725/VisualRecognizer | 0f358aa60104e35ef866f55324f23f1ac29e6884 | 3ab4f0d5bfcb610470b6de04b2dca561a2c3972c | refs/heads/master | 2021-05-12T09:27:15.978523 | 2018-01-23T06:26:55 | 2018-01-23T06:26:55 | 117,316,905 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,826 | java | /*
* Copyright 2017 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.ibm.mysampleapp.camera;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider;
import android.util.Log;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import static android.app.Activity.RESULT_OK;
import static com.ibm.mysampleapp.activities.MainActivity.TAG;
/**
* The Class CameraHelper.
*/
public final class CameraHelper {
/**
* The Constant REQUEST_IMAGE_CAPTURE.
*/
public static final int REQUEST_IMAGE_CAPTURE = 1000;
/**
* The Constant REQUEST_PERMISSION.
*/
public static final int REQUEST_PERMISSION = 3000;
private Activity activity;
private String currentPhotoPath;
/**
* Provides convenience access to device camera.
*
* @param activity The current activity
*/
public CameraHelper(Activity activity) {
this.activity = activity;
}
/**
* Starts an activity using the device's onboard camera app.
*/
public void dispatchTakePictureIntent() {
Log.d(TAG, "dispatchTakePictureIntent fired...");
Log.d(TAG, "checkPermissions = "+checkPermissions());
if (checkPermissions()) {
Log.d(TAG, "Permission granted");
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// Ensure that there's a camera activity to handle the intent
Log.d(TAG, "takePictureIntent.resolveActivity(activity.getPackageManager()) = "+takePictureIntent.resolveActivity(activity.getPackageManager()));
if (takePictureIntent.resolveActivity(activity.getPackageManager()) != null) {
// Create the File where the photo should go
File photoFile = null;
try {
photoFile = createImageFile();
} catch (IOException ex) {
Log.e(TAG, "IOException", ex);
}
// Continue only if the File was successfully created
if (photoFile != null) {
Uri photoURI;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
photoURI =
FileProvider.getUriForFile(activity, "com.ibm.watson.developer_cloud.android.provider", photoFile);
} else {
photoURI = Uri.fromFile(photoFile);
}
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
activity.startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
}
}
}
}
private boolean checkPermissions() {
String permissions[] = {android.Manifest.permission.CAMERA, android.Manifest.permission.WRITE_EXTERNAL_STORAGE};
boolean grantCamera =
ContextCompat.checkSelfPermission(activity, permissions[0]) == PackageManager.PERMISSION_GRANTED;
boolean grantExternal =
ContextCompat.checkSelfPermission(activity, permissions[1]) == PackageManager.PERMISSION_GRANTED;
Log.d(TAG, "grantCamera = "+grantCamera+", "+"grantExternal"+grantExternal);
if (!grantCamera && !grantExternal) {
ActivityCompat.requestPermissions(activity, permissions, REQUEST_PERMISSION);
} else if (!grantCamera) {
ActivityCompat.requestPermissions(activity, new String[]{permissions[0]}, REQUEST_PERMISSION);
} else if (!grantExternal) {
ActivityCompat.requestPermissions(activity, new String[]{permissions[1]}, REQUEST_PERMISSION);
}
return grantCamera && grantExternal;
}
private File createImageFile() throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date());
Log.d(TAG, "timeStamp = "+timeStamp);
String imageFileName = "JPEG_" + timeStamp + "_";
Log.d(TAG, "imageFileName = "+imageFileName);
File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
Log.d(TAG,"storageDir = "+storageDir);
try {
boolean temp = storageDir.mkdirs();
// File file = new File(storageDir, "demoImage.jpg");
Log.d(TAG, "temp = "+temp);
}
catch (Exception e) {
Log.d(TAG, "exception occured : "+e);
}
File image = File.createTempFile(imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
Log.d(TAG, "image = "+image);
// Save a file: path for use with ACTION_VIEW intents
currentPhotoPath = "file:" + image.getAbsolutePath();
Log.d(TAG, "currentPhotoPath="+currentPhotoPath);
return image;
}
/**
* This method returns the file of the photo that was taken. It should be called in onActivityResult.
*
* @param resultCode Result Code of the previous activity
* @return If successful, the image file. Null otherwise.
*/
public File getFile(int resultCode) {
Log.d("Result code test", Integer.toString(resultCode));
if (resultCode == RESULT_OK) {
Uri targetUri = Uri.parse(currentPhotoPath);
return new File(targetUri.getPath());
}
Log.e(TAG, "Result Code was not OK");
return null;
}
/**
* This method returns a bitmap of the photo that was taken. It should be called in onActivityResult. Because the
* CameraHelper knows the path it's unnecessary to get it from the returned data.
*
* @param resultCode Result Code of the previous activity
* @return If successful, a bitmap of the image. Null otherwise.
*/
public Bitmap getBitmap(int resultCode) {
if (resultCode == RESULT_OK) {
Uri targetUri = Uri.parse(currentPhotoPath);
try {
return BitmapFactory.decodeStream(activity.getContentResolver().openInputStream(targetUri));
} catch (FileNotFoundException e) {
Log.e(TAG, "File Not Found", e);
return null;
}
}
Log.e(TAG, "Result Code was not OK");
return null;
}
}
| [
"[email protected]"
]
| |
90be3bc542c7ae07f2449c83de36afaaa2c24b86 | 0a50c64a2e18cb59434fe1ae4f99c69101904d28 | /src/main/java/ChiliGradingDetector/ChiliGradingDetector_YOLOv2.java | 240eb51c0b97dee81cefaeceb0b7daa2d3c5cbe2 | []
| no_license | Wenz111/ChiliGradingDetector | 78e7a9fd6c4f6f11203cc74b84d37f9c12edc1a2 | ec9248a49f9f6528891d6895944284e1ed1504e7 | refs/heads/master | 2023-03-10T19:29:52.680606 | 2021-02-24T11:50:32 | 2021-02-24T11:50:32 | 334,309,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,961 | java | package ChiliGradingDetector;
import org.bytedeco.javacv.CanvasFrame;
import org.bytedeco.javacv.Frame;
import org.bytedeco.javacv.FrameGrabber;
import org.bytedeco.javacv.OpenCVFrameConverter;
import org.bytedeco.opencv.opencv_core.Mat;
import org.bytedeco.opencv.opencv_core.Point;
import org.bytedeco.opencv.opencv_core.Scalar;
import org.bytedeco.opencv.opencv_core.Size;
import org.datavec.image.loader.NativeImageLoader;
import org.datavec.image.transform.ColorConversionTransform;
import org.deeplearning4j.core.storage.StatsStorage;
import org.deeplearning4j.datasets.datavec.RecordReaderDataSetIterator;
import org.deeplearning4j.nn.api.OptimizationAlgorithm;
import org.deeplearning4j.nn.conf.ConvolutionMode;
import org.deeplearning4j.nn.conf.GradientNormalization;
import org.deeplearning4j.nn.conf.WorkspaceMode;
import org.deeplearning4j.nn.conf.inputs.InputType;
import org.deeplearning4j.nn.conf.layers.ConvolutionLayer;
import org.deeplearning4j.nn.conf.layers.objdetect.Yolo2OutputLayer;
import org.deeplearning4j.nn.graph.ComputationGraph;
import org.deeplearning4j.nn.layers.objdetect.DetectedObject;
import org.deeplearning4j.nn.layers.objdetect.YoloUtils;
import org.deeplearning4j.nn.transferlearning.FineTuneConfiguration;
import org.deeplearning4j.nn.transferlearning.TransferLearning;
import org.deeplearning4j.nn.weights.WeightInit;
import org.deeplearning4j.optimize.listeners.ScoreIterationListener;
import org.deeplearning4j.ui.api.UIServer;
import org.deeplearning4j.ui.model.stats.StatsListener;
import org.deeplearning4j.ui.model.storage.InMemoryStatsStorage;
import org.deeplearning4j.util.ModelSerializer;
import org.deeplearning4j.zoo.model.YOLO2;
import org.nd4j.common.io.ClassPathResource;
import org.nd4j.linalg.activations.Activation;
import org.nd4j.linalg.api.buffer.DataType;
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.dataset.api.preprocessor.ImagePreProcessingScaler;
import org.nd4j.linalg.factory.Nd4j;
import org.nd4j.linalg.learning.config.Adam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.List;
import static org.bytedeco.opencv.global.opencv_core.CV_8U;
import static org.bytedeco.opencv.global.opencv_core.flip;
import static org.bytedeco.opencv.global.opencv_imgproc.*;
import static org.bytedeco.opencv.helper.opencv_core.RGB;
public class ChiliGradingDetector_YOLOv2 {
private static final Logger log = LoggerFactory.getLogger(ChiliGradingDetector_YOLOv2.class);
private static final int seed = 123;
private static final double detectionThreshold = 0.5;
private static final int nBoxes = 5;
private static final double lambdaNoObj = 0.5;
private static final double lambdaCoord = 5.0;
private static final double[][] priorBoxes = {{1, 3}, {2.5, 6}, {3, 4}, {3.5, 8}, {4, 9}};
private static final int batchSize = 2;
private static final int nEpochs = 1;
private static final double learningRate = 1e-4;
private static final int nClasses = 6;
private static List<String> labels;
private static final File modelFilename = new File(System.getProperty("user.dir"), "src/main/resources/generated-models/ChiliGradingDetector_yolov2.zip");
private static ComputationGraph model;
private static Frame frame = null;
private static final Scalar RED = RGB(255.0, 0, 0);
private static final Scalar GREEN = RGB(0, 255.0, 0);
private static final Scalar BLUE = RGB(173.0, 202.0, 230.0);
private static final Scalar YELLOW = RGB(255.0, 255.0, 0);
private static final Scalar MAGENTA = RGB(255.0, 0, 255.0);
private static final Scalar CYAN = RGB(0, 255.0, 255.0);
private static final Scalar[] colorMap = {RED, GREEN, BLUE, YELLOW, MAGENTA, CYAN};
private static String labelText = null;
public static void main(String[] args) throws IOException, InterruptedException {
// Create Iterators
ChiliDataSetIterator.setup();
RecordReaderDataSetIterator trainIter = ChiliDataSetIterator.trainIterator(batchSize);
RecordReaderDataSetIterator testIter = ChiliDataSetIterator.testIterator(1);
labels = trainIter.getLabels();
// Check if model exists
log.info("Model Filename Location: " + modelFilename.toString());
if (modelFilename.exists()) {
// Load trained model
log.info("Model found at: " + modelFilename.toString());
Nd4j.getRandom().setSeed(seed);
model = ModelSerializer.restoreComputationGraph(modelFilename);
System.out.println(model.summary());
} else {
log.info("Model not found run else statement");
Nd4j.getRandom().setSeed(seed);
INDArray priors = Nd4j.create(priorBoxes);
// Train model
ComputationGraph pretrained = (ComputationGraph) YOLO2.builder().build().initPretrained();
// Model Configuration
FineTuneConfiguration fineTuneConfiguration = getFineTuneConfiguration();
// Modify prebuilt model's architecture
model = getComputationGraph(pretrained, priors, fineTuneConfiguration);
System.out.println(model.summary(InputType.convolutional(
ChiliDataSetIterator.yoloHeight,
ChiliDataSetIterator.yoloWidth,
nClasses)));
// Training and Save Model
UIServer server = UIServer.getInstance();
StatsStorage storage = new InMemoryStatsStorage();
server.attach(storage);
model.setListeners(new ScoreIterationListener(1), new StatsListener(storage));
for (int i = 1; i < nEpochs; i++) {
trainIter.reset();
while (trainIter.hasNext()) {
model.fit(trainIter.next());
}
log.info("*** Completed epoch {} ***", i);
}
ModelSerializer.writeModel(model, modelFilename, true);
System.out.println("Model saved.");
}
// Evaluate the model's accuracy by using the test iterator.
OfflineValidationWithTestDataset(testIter);
// Inference the model and process the webcam stream and make predictions.
doInference();
}
private static ComputationGraph getComputationGraph(ComputationGraph pretrained, INDArray priors, FineTuneConfiguration fineTuneConfiguration) {
return new TransferLearning.GraphBuilder(pretrained)
.fineTuneConfiguration(fineTuneConfiguration)
.removeVertexKeepConnections("conv2d_23")
.removeVertexKeepConnections("outputs")
.addLayer("conv2d_23",
new ConvolutionLayer.Builder(1, 1)
.nIn(1024)
.nOut(nBoxes * (5 + nClasses))
.stride(1, 1)
.convolutionMode(ConvolutionMode.Same)
.weightInit(WeightInit.XAVIER)
.activation(Activation.IDENTITY)
.build(),
"leaky_re_lu_22")
.addLayer("outputs",
new Yolo2OutputLayer.Builder()
.lambdaNoObj(lambdaNoObj)
.lambdaCoord(lambdaCoord)
.boundingBoxPriors(priors.castTo(DataType.FLOAT))
.build(),
"conv2d_23")
.setOutputs("outputs")
.build();
}
private static FineTuneConfiguration getFineTuneConfiguration() {
return new FineTuneConfiguration.Builder()
.seed(seed)
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT)
.gradientNormalization(GradientNormalization.RenormalizeL2PerLayer)
.gradientNormalizationThreshold(1.0)
.updater(new Adam.Builder().learningRate(learningRate).build())
.l2(0.00001)
.activation(Activation.IDENTITY)
.trainingWorkspaceMode(WorkspaceMode.ENABLED)
.inferenceWorkspaceMode(WorkspaceMode.ENABLED)
.build();
}
// Evaluate visually the performance of the trained object detection model
private static void OfflineValidationWithTestDataset(RecordReaderDataSetIterator test) throws InterruptedException {
NativeImageLoader imageLoader = new NativeImageLoader();
CanvasFrame canvas = new CanvasFrame("Validate Test Dataset");
OpenCVFrameConverter.ToMat converter = new OpenCVFrameConverter.ToMat();
org.deeplearning4j.nn.layers.objdetect.Yolo2OutputLayer yout = (org.deeplearning4j.nn.layers.objdetect.Yolo2OutputLayer) model.getOutputLayer(0);
Mat convertedMat = new Mat();
Mat convertedMat_big = new Mat();
while (test.hasNext() && canvas.isVisible()) {
org.nd4j.linalg.dataset.DataSet ds = test.next();
INDArray features = ds.getFeatures();
INDArray results = model.outputSingle(features);
List<DetectedObject> objs = yout.getPredictedObjects(results, detectionThreshold);
YoloUtils.nms(objs, 0.4);
Mat mat = imageLoader.asMat(features);
mat.convertTo(convertedMat, CV_8U, 255, 0);
int w = mat.cols() * 2;
int h = mat.rows() * 2;
resize(convertedMat, convertedMat_big, new Size(w, h));
convertedMat_big = drawResults(objs, convertedMat_big, w, h);
canvas.showImage(converter.convert(convertedMat_big));
canvas.waitKey();
}
canvas.dispose();
}
// Stream video frames from Webcam and run them through YOLOv2 model and get predictions
private static void doInference() {
String cameraPos = "front";
int cameraNum = 0;
Thread thread = null;
NativeImageLoader loader = new NativeImageLoader(
ChiliDataSetIterator.yoloWidth,
ChiliDataSetIterator.yoloHeight,
3,
new ColorConversionTransform(COLOR_BGR2RGB));
ImagePreProcessingScaler scaler = new ImagePreProcessingScaler(0, 1);
if (!cameraPos.equals("front") && !cameraPos.equals("back")) {
try {
throw new Exception("Unknown argument for camera position. Choose between front and back");
} catch (Exception e) {
e.printStackTrace();
}
}
FrameGrabber grabber = null;
try {
grabber = FrameGrabber.createDefault(cameraNum);
} catch (FrameGrabber.Exception e) {
e.printStackTrace();
}
OpenCVFrameConverter.ToMat converter = new OpenCVFrameConverter.ToMat();
try {
grabber.start();
} catch (FrameGrabber.Exception e) {
e.printStackTrace();
}
CanvasFrame canvas = new CanvasFrame("Object Detection");
int w = grabber.getImageWidth();
int h = grabber.getImageHeight();
canvas.setCanvasSize(w, h);
while (true) {
try {
frame = grabber.grab();
} catch (FrameGrabber.Exception e) {
e.printStackTrace();
}
//if a thread is null, create new thread
if (thread == null) {
thread = new Thread(() ->
{
while (frame != null) {
try {
Mat rawImage = new Mat();
//Flip the camera if opening front camera
if (cameraPos.equals("front")) {
Mat inputImage = converter.convert(frame);
flip(inputImage, rawImage, 1);
} else {
rawImage = converter.convert(frame);
}
Mat resizeImage = new Mat();
resize(rawImage, resizeImage, new Size(ChiliDataSetIterator.yoloWidth, ChiliDataSetIterator.yoloHeight));
INDArray inputImage = loader.asMatrix(resizeImage);
scaler.transform(inputImage);
INDArray outputs = model.outputSingle(inputImage);
org.deeplearning4j.nn.layers.objdetect.Yolo2OutputLayer yout = (org.deeplearning4j.nn.layers.objdetect.Yolo2OutputLayer) model.getOutputLayer(0);
List<DetectedObject> objs = yout.getPredictedObjects(outputs, detectionThreshold);
YoloUtils.nms(objs, 0.4);
rawImage = drawResults(objs, rawImage, w, h);
canvas.showImage(converter.convert(rawImage));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
});
thread.start();
}
KeyEvent t = null;
try {
t = canvas.waitKey(33);
} catch (InterruptedException e) {
e.printStackTrace();
}
if ((t != null) && (t.getKeyCode() == KeyEvent.VK_Q)) {
break;
}
}
}
private static Mat drawResults(List<DetectedObject> objects, Mat mat, int w, int h) {
for (DetectedObject obj : objects) {
double[] xy1 = obj.getTopLeftXY();
double[] xy2 = obj.getBottomRightXY();
String label = labels.get(obj.getPredictedClass());
int x1 = (int) Math.round(w * xy1[0] / ChiliDataSetIterator.gridWidth);
int y1 = (int) Math.round(h * xy1[1] / ChiliDataSetIterator.gridHeight);
int x2 = (int) Math.round(w * xy2[0] / ChiliDataSetIterator.gridWidth);
int y2 = (int) Math.round(h * xy2[1] / ChiliDataSetIterator.gridHeight);
//Draw bounding box
rectangle(mat, new Point(x1, y1), new Point(x2, y2), colorMap[obj.getPredictedClass()], 0, 0, 0);
//Display label text
labelText = label + " " + String.format("%.2f", obj.getConfidence() * 100) + "%";
int[] baseline = {0};
Size textSize = getTextSize(labelText, FONT_HERSHEY_DUPLEX, 1, 1, baseline);
rectangle(mat, new Point(x1 + 2, y2 - 2), new Point(x1 + 2 + textSize.get(0), y2 - 2 - textSize.get(1)), colorMap[obj.getPredictedClass()], FILLED, 0, 0);
putText(mat, labelText, new Point(x1 + 2, y2 - 2), FONT_HERSHEY_DUPLEX, 1, RGB(0, 0, 0));
}
return mat;
}
}
| [
"[email protected]"
]
| |
0f90395afb0b1f2e7a631c76577b760d0e8d4747 | 2e40eeb51a4be39b9feb7e0cefe2ec66ed97d820 | /src/logic/dao/SponsorDao.java | 14cb319c191dcc51b70f1e4608e0ce2fca965f39 | []
| no_license | AdrianoMorini/DrinkHub | 353199dc9fb1a66263fbf6b601294ab12ba54439 | dbe005b9bb0471dd56d78c049db7eb3db3cb6abf | refs/heads/master | 2022-10-24T09:37:22.997485 | 2020-06-11T15:43:45 | 2020-06-11T15:43:45 | 271,067,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,561 | java | package logic.dao;
import java.sql.Connection;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import logic.bean.SponsorBean;
import logic.controller.LoginController;
public class SponsorDao {
private SponsorDao() {
throw new IllegalStateException("Utility class init");
}
public static void findSponsorByUsername(SponsorBean bean) {
Statement state = null;
Connection connect = null;
DatabaseManager dbMan = MariaDBDatabaseManager.getInstance();
int type = 0;
Date timeline = null;
try {
connect = dbMan.openConnection();
state = dbMan.openStatement(connect);
String sql = "SELECT type, timeline FROM test.sponsor where username = '"
+ bean.getUserSponsor() + "';";
ResultSet rs = state.executeQuery(sql);
if (!rs.first()) {
bean.setTypeSponsor(0);
bean.setTimeSponsor(null);
dbMan.closeStatement(state);
dbMan.closeConnection(connect);
return;
}
boolean moreThanOne = rs.first() && rs.next();
assert !moreThanOne;
rs.first();
type = rs.getInt("type");
timeline = rs.getDate("timeline");
rs.close();
dbMan.closeStatement(state);
dbMan.closeConnection(connect);
} catch (SQLException e2) {
// Opening connection, or opening statement, or executing query failed
e2.printStackTrace();
}
bean.setTypeSponsor(type);
bean.setTimeSponsor(timeline);
}
public static boolean setNewSponsor() {
Statement stat = null;
Connection conne = null;
DatabaseManager dbMan = MariaDBDatabaseManager.getInstance();
try {
conne = dbMan.openConnection();
stat = dbMan.openStatement(conne);
LoginController con = LoginController.getInstance();
String mysql = "INSERT INTO test.sponsor values('" + con.getBean().getUsername() +"','" + SponsorBean.getTyping() + "','" + SponsorBean.getTimeline() + "');";
ResultSet res = stat.executeQuery(mysql);
res.close();
dbMan.closeStatement(stat);
dbMan.closeConnection(conne);
} catch (SQLException e3) {
// Opening connection, or opening statement, or executing query failed
e3.printStackTrace();
}
dbMan.closeStatement(stat);
dbMan.closeConnection(conne);
return true;
}
public static void deleteSponsor() {
Statement stat = null;
Connection conne = null;
DatabaseManager dbMan = MariaDBDatabaseManager.getInstance();
try {
conne = dbMan.openConnection();
stat = dbMan.openStatement(conne);
String sql = "DELETE FROM test.sponsor WHERE (timeline < current_date);";
ResultSet rs = stat.executeQuery(sql);
rs.close();
dbMan.closeStatement(stat);
dbMan.closeConnection(conne);
} catch (SQLException e3) {
// Opening connection, or opening statement, or executing query failed
e3.printStackTrace();
}
dbMan.closeStatement(stat);
dbMan.closeConnection(conne);
}
}
| [
"[email protected]"
]
| |
4dbd8ea0c1e0cb4ce6f5610b2050d7700d440855 | 2c5b8aff137117e316f8557bf82e553e55454989 | /CrackingCode/MasterAlgorithm/src/test/java/kata/treeandgraph/bstsequence/BSTSequenceTest.java | b6bfd8a24350d47b8ea97be9c20cb10638656e2c | []
| no_license | lamadipen/Algo | 33de4fc1e7049c3d597b5e6090e408460fa2e90e | ef9e5f06214a3387dd4dbe7dd3e979a70617da1d | refs/heads/master | 2022-10-07T16:52:26.537618 | 2022-10-05T21:06:05 | 2022-10-05T21:06:05 | 82,363,649 | 2 | 0 | null | 2023-09-12T13:55:45 | 2017-02-18T05:21:18 | Java | UTF-8 | Java | false | false | 1,243 | java | package kata.treeandgraph.bstsequence;
import kata.treeandgraph.MockTreeFactory;
import kata.treeandgraph.TreeNode;
import org.junit.Test;
import java.util.LinkedList;
import java.util.List;
public class BSTSequenceTest {
@Test
public void bstSequence() {
TreeNode mockBSTTreeRoot = MockTreeFactory.getMockBSTTreeRoot();
BSTSequence bstSequence = new BSTSequence();
List<LinkedList<Integer>> actual = bstSequence.allSequence(mockBSTTreeRoot);
actual.forEach(linkedList -> {
System.out.println("--->");
linkedList.forEach(item -> System.out.print(item + " "));
System.out.println("");
}
);
}
@Test
public void bstSequenceWithSmallInput() {
TreeNode mockBSTTreeRoot = MockTreeFactory.getMockSmallBSTTreeRoot();
BSTSequence bstSequence = new BSTSequence();
List<LinkedList<Integer>> actual = bstSequence.allSequence(mockBSTTreeRoot);
actual.forEach(linkedList -> {
System.out.println("--->");
linkedList.forEach(item -> System.out.print(item + " "));
System.out.println("");
}
);
}
} | [
"[email protected]"
]
| |
19f9e2bd67ad3bf3d534384659afb26b6274a101 | 5eebed1e8a9a6f2c20a302a0765571d32d777137 | /ecsite/src/com/internousdev/ecsite/action/UserCreateCompleteAction.java | a1411625f0280045eb7c3547b07ae1426f75be17 | []
| no_license | Rush-light/backup | 6cb5e88c7d465da28947a0d2faee8acbcaf2157a | d8c522bbca514ecfba9f0dc777f8d980678ed24e | refs/heads/master | 2021-09-09T20:12:32.251682 | 2018-03-19T12:47:02 | 2018-03-19T12:47:02 | 114,627,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,330 | java | package com.internousdev.ecsite.action;
import java.sql.SQLException;
import java.util.Map;
import org.apache.struts2.interceptor.SessionAware;
import com.internousdev.ecsite.dao.UserCreateCompleteDAO;
import com.opensymphony.xwork2.ActionSupport;
public class UserCreateCompleteAction extends ActionSupport implements SessionAware {
private String loginUserId;
private String loginPassword;
private String userName;
public Map<String, Object>session;
private UserCreateCompleteDAO userCreateCompleteDAO = new UserCreateCompleteDAO();
public String execute() throws SQLException {
userCreateCompleteDAO.createUser(session.get("loginUserId").toString(),
session.get("loginPassword").toString(),
session.get("userName").toString());
String result=SUCCESS;
return result;
}
public String getLoginUserId() {
return loginUserId;
}
public void setLoginUserId(String loginUserId) {
this.loginUserId=loginUserId;
}
public String getLoginPassword() {
return loginPassword;
}
public void setLoginPassword(String loginPassword) {
this.loginPassword=loginPassword;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName=userName;
}
@Override
public void setSession(Map<String, Object> session) {
this.session=session;
}
}
| [
"[email protected]"
]
| |
2030e3ebf176224762a703cb712435985242e8b8 | 3a00ee24ca77bae312241420e7011d70d1a8d995 | /app/src/main/java/com/db/pathwaybutton/MainActivity.java | eaceff8fc442fa8694481bdccef6276223a28dd0 | []
| no_license | ahmadwahaj91/PathwayButton-Android | 1263193b157000b1fb638fc2cbf3f8af244bc66c | b2d12aaec1dee8b4df272db4592ca7ffb0225bf5 | refs/heads/master | 2020-03-17T13:23:16.446584 | 2018-06-01T11:34:04 | 2018-06-01T11:34:04 | 133,629,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 880 | java | package com.db.pathwaybutton;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import customlibraries.db.com.pathwaybutton.PathwayButton;
public class MainActivity extends AppCompatActivity {
PathwayButton pathwayButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pathwayButton = findViewById(R.id.pathway);
pathwayButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
methodClick();
}
});
}
public void methodClick() {
Toast.makeText(getApplication(), "This is my Toast message!",
Toast.LENGTH_LONG).show();
}
}
| [
"[email protected]"
]
| |
0d72e1e1e24842311b9dc729b94dd2ed65b5e963 | 6b0da737e494151c45529c57db28635214bb6808 | /PVKBeans/src/main/java/com/pvkfoods/dto/beans/Phone.java | 8931e2fbd325c92cbf24a0e86b3357d580075459 | []
| no_license | prasadp06/PVKFoods | 40e98ba58f53d95e69bed7c1c544a3d996ebb2f4 | 887e8644b4a6f116655b186e22fe8cd87d435de0 | refs/heads/master | 2021-01-21T10:05:21.648970 | 2017-03-06T05:22:32 | 2017-03-06T05:22:32 | 83,377,908 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,346 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-b10
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.03.06 at 12:20:16 AM EST
//
package com.pvkfoods.dto.beans;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for Phone complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Phone">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="number" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="phoneType" type="{http://beans.dto.pvkfoods.com}PhoneType"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Phone", propOrder = {
"number",
"phoneType"
})
public class Phone {
protected String number;
@XmlElement(required = true)
protected PhoneType phoneType;
/**
* Gets the value of the number property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNumber() {
return number;
}
/**
* Sets the value of the number property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNumber(String value) {
this.number = value;
}
/**
* Gets the value of the phoneType property.
*
* @return
* possible object is
* {@link PhoneType }
*
*/
public PhoneType getPhoneType() {
return phoneType;
}
/**
* Sets the value of the phoneType property.
*
* @param value
* allowed object is
* {@link PhoneType }
*
*/
public void setPhoneType(PhoneType value) {
this.phoneType = value;
}
}
| [
"[email protected]"
]
| |
c2166d19873b1ef251360d7233cc975a7d430268 | d1c34c06dc321c4ebf03f88f75e2de8329b5740a | /tcMenuGenerator/src/test/java/com/thecoderscorner/menu/editorui/uitests/uimenuitem/UIActionItemAndCoreTest.java | dd3ddea217f5b59faae2748ce4bf6ce32fdca8ea | [
"Apache-2.0"
]
| permissive | cnc4less/tcMenu | f4337a704ac40ce88941a43d6fa9200134e0d8a7 | 0aaa6f59cf83443cbdb34230c739228d198390e7 | refs/heads/master | 2023-04-20T03:02:37.020821 | 2021-05-07T19:59:54 | 2021-05-07T19:59:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,521 | java | /*
* Copyright (c) 2016-2019 https://www.thecoderscorner.com (Nutricherry LTD).
* This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
*
*/
package com.thecoderscorner.menu.editorui.uitests.uimenuitem;
import com.thecoderscorner.menu.domain.ActionMenuItem;
import com.thecoderscorner.menu.domain.MenuItem;
import com.thecoderscorner.menu.domain.Rgb32MenuItem;
import com.thecoderscorner.menu.domain.Rgb32MenuItemBuilder;
import com.thecoderscorner.menu.domain.state.MenuTree;
import com.thecoderscorner.menu.editorui.generator.core.VariableNameGenerator;
import com.thecoderscorner.menu.editorui.uimodel.UIMenuItem;
import javafx.application.Platform;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.testfx.api.FxRobot;
import org.testfx.framework.junit5.ApplicationExtension;
import org.testfx.framework.junit5.Start;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import static com.thecoderscorner.menu.editorui.uitests.UiUtils.textFieldHasValue;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.verify;
import static org.testfx.api.FxAssert.verifyThat;
@ExtendWith(ApplicationExtension.class)
public class UIActionItemAndCoreTest extends UIMenuItemTestBase {
@Start
public void setup(Stage stage) {
init(stage);
}
@AfterEach
protected void closeWindow() {
Platform.runLater(() -> stage.close());
}
@Test
void testEnteringAcceptableValuesIntoActionEditor(FxRobot robot) throws InterruptedException {
MenuItem actionItem = menuTree.getMenuById(8).orElseThrow();
VariableNameGenerator vng = new VariableNameGenerator(menuTree, false);
Optional<UIMenuItem> uiActionItem = editorUI.createPanelForMenuItem(actionItem, menuTree, vng, mockedConsumer);
// open the sub menu item editor panel
createMainPanel(uiActionItem);
// firstly check that all the fields are populated properly
performAllCommonChecks(actionItem, false);
robot.clickOn("#nameField");
robot.eraseText(12);
robot.write("One Shot");
writeIntoFunctionFieldAndVerifyOK(robot, "on_change");
writeIntoFunctionFieldAndVerifyOK(robot, "öôóòLatin");
writeIntoFunctionFieldAndVerifyOK(robot, "onChange");
verifyThatThereAreNoErrorsReported();
ArgumentCaptor<MenuItem> captor = ArgumentCaptor.forClass(MenuItem.class);
verify(mockedConsumer, atLeastOnce()).accept(isA(ActionMenuItem.class), captor.capture());
assertEquals(-1, captor.getValue().getEepromAddress());
assertEquals("One Shot", captor.getValue().getName());
assertEquals("onChange", captor.getValue().getFunctionName());
}
private void writeIntoFunctionFieldAndVerifyOK(FxRobot robot, String newValue) {
TextField field = robot.lookup("#functionNameTextField").query();
robot.clickOn(field);
robot.eraseText(field.getText().length());
robot.write(newValue);
robot.clickOn("#nameField");
verifyThatThereAreNoErrorsReported();
}
@Test
void testRgb32MenuItem(FxRobot robot) throws Exception {
Rgb32MenuItem item = new Rgb32MenuItemBuilder().withName("New Item").withId(321).withEepromAddr(-1)
.withFunctionName("test").withAlpha(true).menuItem();
menuTree.addMenuItem(MenuTree.ROOT, item);
Set<Integer> uncommittedItems = new HashSet<>();
uncommittedItems.add(item.getId());
VariableNameGenerator vng = new VariableNameGenerator(menuTree, false, uncommittedItems);
Optional<UIMenuItem> uiRgb = editorUI.createPanelForMenuItem(item, menuTree, vng, mockedConsumer);
// open the sub menu item editor panel
createMainPanel(uiRgb);
// firstly check that all the fields are populated properly
performAllCommonChecks(item, false);
tryToEnterBadValueIntoField(robot, "eepromField", "nameField", "40000",
"EEPROM - Value must be between -1 and 32767");
tryToEnterBadValueIntoField(robot, "eepromField", "nameField", "-2",
"EEPROM - Value must be between -1 and 32767");
robot.clickOn("#nameField");
robot.eraseText(10);
robot.write("My Test");
verifyThat("#variableField", textFieldHasValue("MyTest"));
robot.clickOn("#variableField");
robot.eraseText(10);
robot.write("OverrideVar");
robot.clickOn("#nameField");
robot.eraseText(10);
robot.write("New Test");
robot.clickOn("#variableField");
verifyThat("#variableField", textFieldHasValue("OverrideVar"));
robot.clickOn("#eepromNextBtn");
verifyThat("#eepromField", textFieldHasValue("7"));
ArgumentCaptor<MenuItem> captor = ArgumentCaptor.forClass(MenuItem.class);
verify(mockedConsumer, atLeastOnce()).accept(any(), captor.capture());
assertEquals(7, captor.getValue().getEepromAddress());
assertEquals("OverrideVar", captor.getValue().getVariableName());
}
@Test
void testEnteringBadValuesIntoBaseEditor(FxRobot robot) throws InterruptedException {
MenuItem subItem = menuTree.getSubMenuById(100).orElseThrow();
VariableNameGenerator vng = new VariableNameGenerator(menuTree, false);
Optional<UIMenuItem> uiSubItem = editorUI.createPanelForMenuItem(subItem, menuTree, vng, mockedConsumer);
// open the sub menu item editor panel
createMainPanel(uiSubItem);
// firstly check that all the fields are populated properly
performAllCommonChecks(subItem, false);
tryToEnterBadValueIntoField(robot, "nameField", "variableField", "This#Is+Err",
"Name - Text can only contain letters, numbers, spaces and '-_()*%'");
tryToEnterBadValueIntoField(robot, "nameField", "variableField", "",
"Name - field must not be blank and less than 19 characters");
tryToEnterBadValueIntoField(robot, "functionNameTextField", "variableField", "name spaces",
"Function fields must use only letters, digits, and '_'");
tryToEnterBadValueIntoField(robot, "nameField", "variableField", "This name is too long for menuitem",
"Name - field must not be blank and less than 19 characters");
tryToEnterBadValueIntoField(robot, "functionNameTextField", "nameField", "19_Bad",
"Function fields must use only letters, digits, and '_'");
ArgumentCaptor<MenuItem> captor = ArgumentCaptor.forClass(MenuItem.class);
verify(mockedConsumer, atLeastOnce()).accept(eq(subItem), captor.capture());
assertEquals(-1, captor.getValue().getEepromAddress());
MenuItem subItemCompare = menuTree.getSubMenuById(100).orElseThrow();
assertEquals(-1, subItemCompare.getEepromAddress());
}
@Test
void testSelectingAndClearingReadonlyLocal(FxRobot robot) throws InterruptedException {
// now try selecting and clearing the readonly and local only checkboxes.
MenuItem actionItem = menuTree.getMenuById(8).orElseThrow();
VariableNameGenerator vng = new VariableNameGenerator(menuTree, false);
Optional<UIMenuItem> uiActionItem = editorUI.createPanelForMenuItem(actionItem, menuTree, vng, mockedConsumer);
ArgumentCaptor<MenuItem> captor = ArgumentCaptor.forClass(MenuItem.class);
// open the sub menu item editor panel
createMainPanel(uiActionItem);
assertFalse(actionItem.isReadOnly());
assertFalse(actionItem.isLocalOnly());
robot.clickOn("#readOnlyField");
verify(mockedConsumer, atLeastOnce()).accept(eq(actionItem), captor.capture());
assertTrue(captor.getValue().isReadOnly());
assertFalse(captor.getValue().isLocalOnly());
robot.clickOn("#dontRemoteField");
verify(mockedConsumer, atLeastOnce()).accept(eq(actionItem), captor.capture());
assertTrue(captor.getValue().isReadOnly());
assertTrue(captor.getValue().isLocalOnly());
tryToEnterLettersIntoNumericField(robot, "eepromField");
}
}
| [
"[email protected]"
]
| |
525546031cd399d2aebe013bea7dd02e53834fcb | c106931d23493ca317c091006ac0bfbf5dfb7c02 | /src/com/zhangds/adapter/classadapter/Phone.java | 2b05ce5956ea786960454ec2ac16f4201b3ea4f0 | []
| no_license | zhangds-by/DesignPattern | 9e3fffddd252830ea1f7c9fa767d5fd9a4e4eee3 | 51c660af718bdfcc3190833bd945aae88c242007 | refs/heads/master | 2022-07-17T21:25:59.410845 | 2020-05-11T08:24:56 | 2020-05-11T08:24:56 | 261,987,946 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 454 | java | package com.zhangds.adapter.classadapter;
/**
* Create by zhangds
* 2020-05-11 15:33
**/
public class Phone {
public void staging(IVoltage5V iVoltage5V){
if (iVoltage5V.output5V() == 5){
System.out.println("使用适配器的电压" + iVoltage5V.output5V() + "可以充电");
}else {
System.out.println("使用适配器的电压" + iVoltage5V.output5V() + "不可以充电,会炸");
}
}
}
| [
"[email protected]"
]
| |
c2558d7e5e7f68221df0d8783857d5eb1ee4a576 | 0c876c25fa65cacc6e62ecd235b7225af02521c3 | /Reddit/src/main/java/profile/Profile.java | 838ede6c365cdd0fdd4fd0bbd2347b0a43c55b5e | []
| no_license | p-tigris/SeleniumFramework | fca0ceb343d1a0956d69685e3c72e985ecacd701 | f00ec21c91c8082bcf7f7f80c66939b9d26255c8 | refs/heads/master | 2020-08-03T11:26:26.308020 | 2019-10-26T06:51:47 | 2019-10-26T06:51:47 | 211,730,453 | 0 | 0 | null | 2019-09-29T22:39:00 | 2019-09-29T21:47:20 | Java | UTF-8 | Java | false | false | 500 | java | package profile;
import base.CommonAPI;
public class Profile extends CommonAPI {
public void navToSaved() {
clickOnElementByXpath("//a[@href='https://old.reddit.com/user/dummyacct123753/saved/']");
}
public void navToUpvoted() {
clickOnElementByXpath("//a[@href='https://old.reddit.com/user/dummyacct123753/upvoted/']");
}
public void navToHidden() {
clickOnElementByXpath("//a[@href='https://old.reddit.com/user/dummyacct123753/hidden/']");
}
}
| [
"[email protected]"
]
| |
a5c499c1d4ee24e321682fb12f3e5d16d9c16849 | 6c3798297bca7ee0a804f0f65d5a53aae6e77516 | /a072-cloud-config-client-3355/src/main/java/org/example/controller/ConfigClientController.java | d7546dbff9c31db362b74e384d6b0f7b4e7d34b6 | []
| no_license | DongLiusuo/spring-cloud-202103 | 8881e84ac0707af132324a3776d9815cdde4cce2 | e29464036d65ef8dd5cfe4349d18914bfe4d0e48 | refs/heads/master | 2023-03-15T10:12:38.312999 | 2021-03-15T13:51:18 | 2021-03-15T13:51:18 | 345,527,179 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 585 | java | package org.example.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RefreshScope
public class ConfigClientController {
@Value("${config.info}") private String configInfo;
@Value("${server.port}") private String port;
@GetMapping("/configinfo")
public String getConfigInfo() {
return port + "\r\n" + configInfo;
}
}
| [
"[email protected]"
]
| |
78d0ef0350f1a51f68de3dd5df2e8f706452ce0e | b52426723c3abeef1cf7d2f0e61dcc8bd40e18b1 | /app/src/main/java/es/pablomacias/esnuex_app/data/db/dao/DelegationDao.java | e47c5e956a5e2c628ba8ce9f7bf6999df06e9c1c | []
| no_license | pamamu/ESNUExApp | c10713aae7093ef53a552bbc86549955560d57df | fe5d15ef20de9fc91c0bb46119da8cdf8b464f6d | refs/heads/master | 2020-03-11T08:07:36.706742 | 2017-12-18T02:52:18 | 2017-12-18T02:52:18 | 129,875,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,200 | java | /*
* Copyright (C) 2017 by Pablo Macias Munoz
* [email protected]
* 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,
* (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 Lice
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
package es.pablomacias.esnuex_app.data.db.dao;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Query;
import java.util.List;
import es.pablomacias.esnuex_app.data.db.entity.DelegationEntity;
/**
* Created by pablomaciasmu on 13/11/17.
*/
@Dao
public interface DelegationDao {
@Query("SELECT * FROM Delegation")
List<DelegationEntity> loadAllsDelegation();
}
| [
"[email protected]"
]
| |
cc64227972a381c0b5ec0f6c6419829dc49700c4 | d8b3fc5fbb5832442fa775fb43d2d95bf3842db7 | /src/main/java/net/whitewalker/shopmanager/domain/commands/shop/RenameShopCommand.java | b9513699d4b61ef8d77bc51a95e20789b5cdef7b | []
| no_license | WhiteWalker72/ShopManager | 537718e2af77380901f23f0e2200d00672e00a8f | 75673d62ac06a03c68f84039f1f8c9be737fefae | refs/heads/master | 2020-03-19T18:13:01.859511 | 2018-07-23T16:38:15 | 2018-07-23T16:38:15 | 136,799,735 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,262 | java | package net.whitewalker.shopmanager.domain.commands.shop;
import net.rayze.core.spigot.commands.base.SubCommand;
import net.rayze.core.spigot.member.Member;
import net.whitewalker.shopmanager.domain.components.Shop;
import net.whitewalker.shopmanager.domain.ShopManager;
import net.whitewalker.shopmanager.utils.Chat;
class RenameShopCommand extends SubCommand<ShopCommand> {
RenameShopCommand(ShopCommand command) {
super(command, "Rename a shop", "<shop> <newname>", "sr_mod", "rename");
}
@Override
public void execute(Member member, String label, String... args) {
String shopName = args[0];
if (!getCommand().shopExistsTest(member, shopName))
return;
ShopManager shopManager = getCommand().getShopManager();
String newName = args[1];
Shop shop = shopManager.getShop(shopName);
if (shopManager.shopExists(newName)) {
member.message("§7The '" + Chat.PRIM + newName + "§7' shop already exists.");
return;
}
shop.setShopName(newName);
getCommand().getPlugin().getPersistenceService().updateShop(shop);
member.message("§7The '" + shopName + "' shop has been renamed to " + Chat.PRIM + newName + "§7.");
}
}
| [
"[email protected]"
]
| |
e45cf54afb885b07d2800f37c6a500b452e81160 | bef4be1ce5f9abf2a9e8b2bff71fa185df97c89f | /src/main/java/com/customer/support/model/Ticket.java | 943aa668d1768570bda580c48d6bc1fd6529be7e | []
| no_license | dhananjay-arora/CustomerSupport | 096c37e0dc30ece568b03f2a5e8a43c4f38e2a2f | 1cf73f5cb935f570d90c844ad369391b4992a5ba | refs/heads/master | 2020-12-04T11:02:05.873026 | 2020-01-04T09:51:57 | 2020-01-04T09:51:57 | 231,739,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | package com.customer.support.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Ticket {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int ticketid;
private String subject;
private String description;
public int getTicketid() {
return ticketid;
}
public void setTicketid(int ticketid) {
this.ticketid = ticketid;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| [
"[email protected]"
]
| |
fa23baf9331df3d74b71aa00bb6aa9df07f9ec42 | b8c1d3d65e452ff23b55e99ab51039bab502160b | /core/src/hitonoriol/madsand/gfx/TextureProcessor.java | e5babac23fe394cff11a9699ec4e972f37549dd3 | []
| no_license | Hitonoriol/MadSand | 484fd814bf33b48953e024f78b688380cae4e810 | 8b005219506b17a1f1cd63d4ae102fbc6a9ea33f | refs/heads/master | 2023-06-29T08:37:30.176768 | 2023-06-19T16:59:37 | 2023-06-19T16:59:37 | 152,192,955 | 9 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,875 | java | package hitonoriol.madsand.gfx;
import java.util.ArrayList;
import java.util.function.Consumer;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.TextureData;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.PixmapTextureData;
import hitonoriol.madsand.gfx.Effects.TextureEffect;
public class TextureProcessor {
private Texture texture;
private Pixmap pixmap;
private ArrayList<TextureEffect> effects;
private boolean effectsApplied = false;
public TextureProcessor(Texture texture) {
this.texture = texture;
}
public TextureProcessor foreachPixel(Consumer<Color> pixelAction) {
var pixmap = getPixmap();
var pixelColor = new Color();
for (int x = 0; x < pixmap.getWidth(); x++)
for (int y = 0; y < pixmap.getHeight(); y++) {
if (pixelColor.set(pixmap.getPixel(x, y)).a == 0)
continue;
pixelAction.accept(pixelColor);
pixmap.drawPixel(x, y, Color.rgba8888(pixelColor));
}
return this;
}
public TextureProcessor addEffect(TextureEffect effect) {
if (noEffects())
effects = new ArrayList<>(1);
effects.add(effect);
return this;
}
public TextureProcessor addEffects(ArrayList<TextureEffect> effects) {
this.effects = effects;
return this;
}
public void applyEffects() {
effectsApplied = true;
if (noEffects())
return;
effects.stream().forEach(effect -> effect.accept(this));
loadPixmap(pixmap);
}
public boolean noEffects() {
return effects == null;
}
public boolean isDone() {
return effectsApplied;
}
public ArrayList<TextureEffect> getEffects() {
return effects;
}
private TextureData getTextureData() {
return getTextureData(texture);
}
public void loadPixmap(Pixmap pixmap) {
loadPixmap(texture, pixmap);
}
public Pixmap getPixmap() {
if (pixmap == null)
pixmap = getTextureData().consumePixmap();
return pixmap;
}
public static TextureData getTextureData(Texture texture) {
var data = texture.getTextureData();
if (!data.isPrepared())
data.prepare();
return data;
}
public static void loadPixmap(Texture texture, Pixmap pixmap) {
texture.load(new PixmapTextureData(pixmap, null, false, false));
}
public static Texture copyTexture(Texture src) {
var copy = new Texture(src.getWidth(), src.getHeight(), Pixmap.Format.RGBA8888);
loadPixmap(copy, getTextureData(src).consumePixmap());
return copy;
}
public static Texture createTexture(TextureRegion region) {
return new Texture(extractPixmap(region));
}
public static Pixmap extractPixmap(TextureRegion textureRegion) {
return extractPixmap(textureRegion, textureRegion.getRegionWidth(), textureRegion.getRegionHeight());
}
/* Resize the longest side of region to maxSideSize, keeping the aspect ratio */
public static Pixmap extractPixmap(TextureRegion textureRegion, int maxSideSize) {
int width = textureRegion.getRegionWidth(), height = textureRegion.getRegionHeight();
float ratio = (float) maxSideSize / Math.max(width, height);
return extractPixmap(textureRegion, (int) (width * ratio), (int) (height * ratio));
}
public static Pixmap extractPixmap(TextureRegion textureRegion, int newWidth, int newHeight) {
var textureData = getTextureData(textureRegion.getTexture());
var srcMap = textureData.consumePixmap();
var resizedMap = new Pixmap(
newWidth,
newHeight,
textureData.getFormat()
);
resizedMap.drawPixmap(
srcMap,
textureRegion.getRegionX(), textureRegion.getRegionY(),
textureRegion.getRegionWidth(), textureRegion.getRegionHeight(),
0, 0,
resizedMap.getWidth(), resizedMap.getHeight()
);
return resizedMap;
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.