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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5bb05b6c497380a1d48fd7aa0730a4fb0c4284fa | 7ecabfda0c5d9ead574190fd011331fc940f7c22 | /pyg-page-interface/src/main/java/com/pyg/page/service/ItemPageService.java | 7b86e8d72a91bee2cfa899a8e9fc296e1bc4de8d | []
| no_license | shangjiapeng/pyg-parent | 13dae1a9f51fecde2bc178bc3d18f555f2123578 | 0449545172e792f4b5fb83aa0f6e4d50e1652390 | refs/heads/master | 2022-12-21T00:51:49.395628 | 2019-09-18T07:38:54 | 2019-09-18T07:38:54 | 209,247,739 | 0 | 0 | null | 2022-12-16T07:15:28 | 2019-09-18T07:38:16 | JavaScript | UTF-8 | Java | false | false | 368 | java | package com.pyg.page.service;
/**
* 商品详情页接口
*/
public interface ItemPageService {
/**
* 生成商品详细页
* @param goodsId
* @return
*/
public boolean genItemHtml(Long goodsId);
/**
* 删除商品详情页
* @param goodsIds
* @return
*/
public boolean deleteItemHtml(Long[] goodsIds);
}
| [
"[email protected]"
]
| |
a9d900b98c9181df26f804bc1239477cb985e0cf | 53cbbb7dca36689f05efae7e226a74e2134ae3f9 | /app/src/main/java/com/justineangelo888/mangareader888/SSApi/Models/Main/Sub/SubLink.java | f6bb680206ccb74fc3ec5e4fadc4f6160eb26377 | []
| no_license | justineangelo/MangaReader888 | e2164b5cbd74b30ff2fae5e9aec7d65536aa8127 | 1db7066bd7c0120d0bf9a2d5a75b9769e91fb3d3 | refs/heads/master | 2021-01-01T05:23:05.852741 | 2016-04-27T02:50:19 | 2016-04-27T02:50:19 | 56,215,490 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 319 | java | package com.justineangelo888.mangareader888.SSApi.Models.Main.Sub;
import com.justineangelo888.mangareader888.SSApi.Models.Main.Link;
/**
* Created by justine on 21/04/16.
*/
public class SubLink extends Link {
public static SubLink init() {
return new SubLink();
}
} | [
"[email protected]"
]
| |
14fbd2dee00959782cbcfe6b724be278888e6001 | 3230727d5a8678d50bd9e19af1c6ff495ecbdebd | /srb/service-core/src/main/java/com/atguigu/srb/core/controller/IntegralGradeController.java | 92243f99bc4c2ac53fab572f255f1f5738228e6f | []
| no_license | gh1006/srb | 5a94e59661a4a609a547662f02649c358598946a | 5c36403165dbe70466e3e508beed0cbd0e48971a | refs/heads/master | 2023-04-14T23:00:47.486443 | 2021-04-27T15:42:23 | 2021-04-27T15:42:23 | 362,169,586 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package com.atguigu.srb.core.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 积分等级表 前端控制器
* </p>
*
* @author Helen
* @since 2021-04-27
*/
@RestController
@RequestMapping("/integralGrade")
public class IntegralGradeController {
}
| [
"[email protected]"
]
| |
17e026693a342c7199c1aa2ebe07c8ff05fe510b | 89fd441aaae4f241fbac8915ea7607a03e605859 | /src/tk/genesishub/gFeatures/Commands/gFactionsCore.java | 55e7cd3f0c51915ca2b24bd26f8851074160f066 | [
"Apache-2.0"
]
| permissive | GenesisHub/gFeatures | f9a5979765a4dafca4d5b8ad5c6532c70bcd7aad | 718b83770cdf9dd251be3e55bbb6c69a0d55f9d0 | refs/heads/master | 2016-09-05T20:04:02.752527 | 2015-12-11T14:24:09 | 2015-12-11T14:24:09 | 33,052,981 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,425 | java | package tk.genesishub.gFeatures.Commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import tk.genesishub.gFeatures.PluginManage.PluginState;
import tk.genesishub.gFeatures.PluginManage.gFactionsPlugin;
import tk.genesishub.gFeatures.gFactions.CommandHub;
/*
gFeatures
https://github.com/Seshpenguin/gFeatures
Copyright 2015 DolphinBox
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.
*/
public class gFactionsCore {
public void CommandSwitch(final CommandSender sender, Command cmd, String label, String[] args) throws NumberFormatException, Exception{
Commands c = new Commands();
CommandHub ch = new CommandHub();
if(gFactionsPlugin.getState().equals(PluginState.ENABLE)){
ch.CommandSwitch(sender, cmd, label, args);
}
else if(c.Check("gFactions", cmd.getName())){
sender.sendMessage("GenesisHub does not recognize this command. Type /help for help.");
}
}
}
| [
"[email protected]"
]
| |
9af3308767f4314b59f54d56d28345f364a2bc55 | 3c735df40e3dac54e1b19052816a373ff7521e0e | /src/main/java/com/criminalddbb/app/service/ResourceUrlService.java | 72f2668af21e1c97286e30d426a7923a995e8e09 | []
| no_license | AlbertoGSZ/IT-Example-Project | 34d99da9252a7fd7bfc56875ad973b0690176203 | 89190aae06f2bb4352265b73227df93d06af4747 | refs/heads/master | 2022-12-23T19:25:14.409820 | 2019-10-13T04:23:55 | 2019-10-13T04:23:55 | 198,832,236 | 0 | 0 | null | 2022-12-16T05:02:49 | 2019-07-25T13:00:19 | Java | UTF-8 | Java | false | false | 843 | java | package com.criminalddbb.app.service;
import com.criminalddbb.app.domain.ResourceUrl;
import java.util.List;
import java.util.Optional;
/**
* Service Interface for managing {@link ResourceUrl}.
*/
public interface ResourceUrlService {
/**
* Save a resourceUrl.
*
* @param resourceUrl the entity to save.
* @return the persisted entity.
*/
ResourceUrl save(ResourceUrl resourceUrl);
/**
* Get all the resourceUrls.
*
* @return the list of entities.
*/
List<ResourceUrl> findAll();
/**
* Get the "id" resourceUrl.
*
* @param id the id of the entity.
* @return the entity.
*/
Optional<ResourceUrl> findOne(Long id);
/**
* Delete the "id" resourceUrl.
*
* @param id the id of the entity.
*/
void delete(Long id);
}
| [
"[email protected]"
]
| |
9a9a704a38f8874e5ce4d05b37e0d085bf1ef161 | c141c153a6795e526fcdf0c3e6cbc37d44ffc438 | /chapter-3-3-spring-boot-web-swagger2/src/test/java/com/liaoyb/springboot/Swagger2ApplicationTests.java | 3395f42bacdbc46a51319d3b4fad2f71155e3475 | []
| no_license | OnlyYC/springboot-learning | 0dbe671f7cbcc55ae52413e27509569043589c55 | d3bba258bf4ca27ab42b76f21ae037e6bdb31a6a | refs/heads/master | 2020-03-22T05:22:35.832807 | 2018-10-24T10:39:46 | 2018-10-24T10:39:46 | 139,561,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package com.liaoyb.springboot;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class Swagger2ApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
]
| |
1bd827116554bf1de969f2862731e0907708ff1a | 225011bbc304c541f0170ef5b7ba09b967885e95 | /com/google/android/gms/internal/ads/zzet.java | 8be05f175b4f07c9cb351ae8022695583686cf4b | []
| no_license | sebaudracco/bubble | 66536da5367f945ca3318fecc4a5f2e68c1df7ee | e282cda009dfc9422594b05c63e15f443ef093dc | refs/heads/master | 2023-08-25T09:32:04.599322 | 2018-08-14T15:27:23 | 2018-08-14T15:27:23 | 140,444,001 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 18,896 | java | package com.google.android.gms.internal.ads;
import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.IntentFilter;
import android.graphics.Rect;
import android.os.Build.VERSION;
import android.os.Handler;
import android.os.PowerManager;
import android.provider.Settings.System;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.ViewTreeObserver.OnScrollChangedListener;
import android.view.WindowManager;
import com.google.android.gms.ads.internal.zzbv;
import com.google.android.gms.common.util.VisibleForTesting;
import com.mobfox.sdk.networking.RequestParams;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import javax.annotation.ParametersAreNonnullByDefault;
import mf.org.apache.xerces.impl.xs.SchemaSymbols;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@zzadh
@ParametersAreNonnullByDefault
public final class zzet implements OnGlobalLayoutListener, OnScrollChangedListener {
private final Object mLock = new Object();
private boolean zzaaq = false;
private zzamj zzadz;
private final Context zzaeo;
private final WeakReference<zzajh> zzaeq;
private WeakReference<ViewTreeObserver> zzaer;
private final zzgd zzaes;
protected final zzer zzaet;
private final WindowManager zzaeu;
private final PowerManager zzaev;
private final KeyguardManager zzaew;
private final DisplayMetrics zzaex;
@Nullable
private zzfa zzaey;
private boolean zzaez;
private boolean zzafa = false;
private boolean zzafb;
private boolean zzafc;
private boolean zzafd;
@Nullable
@VisibleForTesting
private BroadcastReceiver zzafe;
private final HashSet<zzeq> zzaff = new HashSet();
private final HashSet<zzfo> zzafg = new HashSet();
private final Rect zzafh = new Rect();
private final zzew zzafi;
private float zzafj;
public zzet(Context context, zzjn com_google_android_gms_internal_ads_zzjn, zzajh com_google_android_gms_internal_ads_zzajh, zzang com_google_android_gms_internal_ads_zzang, zzgd com_google_android_gms_internal_ads_zzgd) {
this.zzaeq = new WeakReference(com_google_android_gms_internal_ads_zzajh);
this.zzaes = com_google_android_gms_internal_ads_zzgd;
this.zzaer = new WeakReference(null);
this.zzafb = true;
this.zzafd = false;
this.zzadz = new zzamj(200);
this.zzaet = new zzer(UUID.randomUUID().toString(), com_google_android_gms_internal_ads_zzang, com_google_android_gms_internal_ads_zzjn.zzarb, com_google_android_gms_internal_ads_zzajh.zzcob, com_google_android_gms_internal_ads_zzajh.zzfz(), com_google_android_gms_internal_ads_zzjn.zzare);
this.zzaeu = (WindowManager) context.getSystemService("window");
this.zzaev = (PowerManager) context.getApplicationContext().getSystemService("power");
this.zzaew = (KeyguardManager) context.getSystemService("keyguard");
this.zzaeo = context;
this.zzafi = new zzew(this, new Handler());
this.zzaeo.getContentResolver().registerContentObserver(System.CONTENT_URI, true, this.zzafi);
this.zzaex = context.getResources().getDisplayMetrics();
Display defaultDisplay = this.zzaeu.getDefaultDisplay();
this.zzafh.right = defaultDisplay.getWidth();
this.zzafh.bottom = defaultDisplay.getHeight();
zzgb();
}
@VisibleForTesting
private final boolean isScreenOn() {
return VERSION.SDK_INT >= 20 ? this.zzaev.isInteractive() : this.zzaev.isScreenOn();
}
private static int zza(int i, DisplayMetrics displayMetrics) {
return (int) (((float) i) / displayMetrics.density);
}
private final JSONObject zza(@Nullable View view, @Nullable Boolean bool) throws JSONException {
if (view == null) {
return zzgg().put("isAttachedToWindow", false).put("isScreenOn", isScreenOn()).put("isVisible", false);
}
boolean isAttachedToWindow = zzbv.zzem().isAttachedToWindow(view);
int[] iArr = new int[2];
int[] iArr2 = new int[2];
try {
view.getLocationOnScreen(iArr);
view.getLocationInWindow(iArr2);
} catch (Throwable e) {
zzane.zzb("Failure getting view location.", e);
}
Rect rect = new Rect();
rect.left = iArr[0];
rect.top = iArr[1];
rect.right = rect.left + view.getWidth();
rect.bottom = rect.top + view.getHeight();
Rect rect2 = new Rect();
boolean globalVisibleRect = view.getGlobalVisibleRect(rect2, null);
Rect rect3 = new Rect();
boolean localVisibleRect = view.getLocalVisibleRect(rect3);
Rect rect4 = new Rect();
view.getHitRect(rect4);
JSONObject zzgg = zzgg();
zzgg.put("windowVisibility", view.getWindowVisibility()).put("isAttachedToWindow", isAttachedToWindow).put("viewBox", new JSONObject().put("top", zza(this.zzafh.top, this.zzaex)).put("bottom", zza(this.zzafh.bottom, this.zzaex)).put("left", zza(this.zzafh.left, this.zzaex)).put("right", zza(this.zzafh.right, this.zzaex))).put("adBox", new JSONObject().put("top", zza(rect.top, this.zzaex)).put("bottom", zza(rect.bottom, this.zzaex)).put("left", zza(rect.left, this.zzaex)).put("right", zza(rect.right, this.zzaex))).put("globalVisibleBox", new JSONObject().put("top", zza(rect2.top, this.zzaex)).put("bottom", zza(rect2.bottom, this.zzaex)).put("left", zza(rect2.left, this.zzaex)).put("right", zza(rect2.right, this.zzaex))).put("globalVisibleBoxVisible", globalVisibleRect).put("localVisibleBox", new JSONObject().put("top", zza(rect3.top, this.zzaex)).put("bottom", zza(rect3.bottom, this.zzaex)).put("left", zza(rect3.left, this.zzaex)).put("right", zza(rect3.right, this.zzaex))).put("localVisibleBoxVisible", localVisibleRect).put("hitBox", new JSONObject().put("top", zza(rect4.top, this.zzaex)).put("bottom", zza(rect4.bottom, this.zzaex)).put("left", zza(rect4.left, this.zzaex)).put("right", zza(rect4.right, this.zzaex))).put("screenDensity", (double) this.zzaex.density);
if (bool == null) {
bool = Boolean.valueOf(zzbv.zzek().zza(view, this.zzaev, this.zzaew));
}
zzgg.put("isVisible", bool.booleanValue());
return zzgg;
}
private static JSONObject zza(JSONObject jSONObject) throws JSONException {
JSONArray jSONArray = new JSONArray();
JSONObject jSONObject2 = new JSONObject();
jSONArray.put(jSONObject);
jSONObject2.put("units", jSONArray);
return jSONObject2;
}
private final void zza(JSONObject jSONObject, boolean z) {
try {
JSONObject zza = zza(jSONObject);
ArrayList arrayList = new ArrayList(this.zzafg);
int size = arrayList.size();
int i = 0;
while (i < size) {
Object obj = arrayList.get(i);
i++;
((zzfo) obj).zzb(zza, z);
}
} catch (Throwable th) {
zzane.zzb("Skipping active view message.", th);
}
}
private final void zzgd() {
if (this.zzaey != null) {
this.zzaey.zza(this);
}
}
private final void zzgf() {
ViewTreeObserver viewTreeObserver = (ViewTreeObserver) this.zzaer.get();
if (viewTreeObserver != null && viewTreeObserver.isAlive()) {
viewTreeObserver.removeOnScrollChangedListener(this);
viewTreeObserver.removeGlobalOnLayoutListener(this);
}
}
private final JSONObject zzgg() throws JSONException {
JSONObject jSONObject = new JSONObject();
jSONObject.put("afmaVersion", this.zzaet.zzfw()).put("activeViewJSON", this.zzaet.zzfx()).put("timestamp", zzbv.zzer().elapsedRealtime()).put("adFormat", this.zzaet.zzfv()).put("hashCode", this.zzaet.zzfy()).put("isMraid", this.zzaet.zzfz()).put("isStopped", this.zzafa).put("isPaused", this.zzaaq).put("isNative", this.zzaet.zzga()).put("isScreenOn", isScreenOn()).put("appMuted", zzbv.zzfj().zzdp()).put("appVolume", (double) zzbv.zzfj().zzdo()).put("deviceVolume", (double) this.zzafj);
return jSONObject;
}
public final void onGlobalLayout() {
zzl(2);
}
public final void onScrollChanged() {
zzl(1);
}
public final void pause() {
synchronized (this.mLock) {
this.zzaaq = true;
zzl(3);
}
}
public final void resume() {
synchronized (this.mLock) {
this.zzaaq = false;
zzl(3);
}
}
public final void stop() {
synchronized (this.mLock) {
this.zzafa = true;
zzl(3);
}
}
public final void zza(zzfa com_google_android_gms_internal_ads_zzfa) {
synchronized (this.mLock) {
this.zzaey = com_google_android_gms_internal_ads_zzfa;
}
}
public final void zza(zzfo com_google_android_gms_internal_ads_zzfo) {
if (this.zzafg.isEmpty()) {
synchronized (this.mLock) {
if (this.zzafe != null) {
} else {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.SCREEN_ON");
intentFilter.addAction("android.intent.action.SCREEN_OFF");
this.zzafe = new zzeu(this);
zzbv.zzfk().zza(this.zzaeo, this.zzafe, intentFilter);
}
}
zzl(3);
}
this.zzafg.add(com_google_android_gms_internal_ads_zzfo);
try {
com_google_android_gms_internal_ads_zzfo.zzb(zza(zza(this.zzaes.zzgh(), null)), false);
} catch (Throwable e) {
zzane.zzb("Skipping measurement update for new client.", e);
}
}
final void zza(zzfo com_google_android_gms_internal_ads_zzfo, Map<String, String> map) {
String str = "Received request to untrack: ";
String valueOf = String.valueOf(this.zzaet.zzfy());
zzane.zzck(valueOf.length() != 0 ? str.concat(valueOf) : new String(str));
zzb(com_google_android_gms_internal_ads_zzfo);
}
public final void zzb(zzfo com_google_android_gms_internal_ads_zzfo) {
this.zzafg.remove(com_google_android_gms_internal_ads_zzfo);
com_google_android_gms_internal_ads_zzfo.zzgl();
if (this.zzafg.isEmpty()) {
synchronized (this.mLock) {
zzgf();
synchronized (this.mLock) {
if (this.zzafe != null) {
try {
zzbv.zzfk().zza(this.zzaeo, this.zzafe);
} catch (Throwable e) {
zzane.zzb("Failed trying to unregister the receiver", e);
} catch (Throwable e2) {
zzbv.zzeo().zza(e2, "ActiveViewUnit.stopScreenStatusMonitoring");
}
this.zzafe = null;
}
}
this.zzaeo.getContentResolver().unregisterContentObserver(this.zzafi);
this.zzafb = false;
zzgd();
ArrayList arrayList = new ArrayList(this.zzafg);
int size = arrayList.size();
int i = 0;
while (i < size) {
Object obj = arrayList.get(i);
i++;
zzb((zzfo) obj);
}
}
}
}
final boolean zzc(@Nullable Map<String, String> map) {
if (map == null) {
return false;
}
String str = (String) map.get("hashCode");
return !TextUtils.isEmpty(str) && str.equals(this.zzaet.zzfy());
}
final void zzd(Map<String, String> map) {
zzl(3);
}
final void zze(Map<String, String> map) {
if (map.containsKey("isVisible")) {
boolean z = SchemaSymbols.ATTVAL_TRUE_1.equals(map.get("isVisible")) || SchemaSymbols.ATTVAL_TRUE.equals(map.get("isVisible"));
Iterator it = this.zzaff.iterator();
while (it.hasNext()) {
((zzeq) it.next()).zza(this, z);
}
}
}
public final void zzgb() {
this.zzafj = zzalb.zzay(this.zzaeo);
}
public final void zzgc() {
synchronized (this.mLock) {
if (this.zzafb) {
this.zzafc = true;
try {
JSONObject zzgg = zzgg();
zzgg.put("doneReasonCode", RequestParams.f9038U);
zza(zzgg, true);
} catch (Throwable e) {
zzane.zzb("JSON failure while processing active view data.", e);
} catch (Throwable e2) {
zzane.zzb("Failure while processing active view data.", e2);
}
String str = "Untracking ad unit: ";
String valueOf = String.valueOf(this.zzaet.zzfy());
zzane.zzck(valueOf.length() != 0 ? str.concat(valueOf) : new String(str));
}
}
}
public final boolean zzge() {
boolean z;
synchronized (this.mLock) {
z = this.zzafb;
}
return z;
}
/* JADX WARNING: inconsistent code. */
/* Code decompiled incorrectly, please refer to instructions dump. */
protected final void zzl(int r8) {
/*
r7 = this;
r2 = 0;
r1 = 1;
r4 = r7.mLock;
monitor-enter(r4);
r0 = r7.zzafg; Catch:{ all -> 0x005d }
r3 = r0.iterator(); Catch:{ all -> 0x005d }
L_0x000b:
r0 = r3.hasNext(); Catch:{ all -> 0x005d }
if (r0 == 0) goto L_0x0026;
L_0x0011:
r0 = r3.next(); Catch:{ all -> 0x005d }
r0 = (com.google.android.gms.internal.ads.zzfo) r0; Catch:{ all -> 0x005d }
r0 = r0.zzgk(); Catch:{ all -> 0x005d }
if (r0 == 0) goto L_0x000b;
L_0x001d:
r0 = r1;
L_0x001e:
if (r0 == 0) goto L_0x0024;
L_0x0020:
r0 = r7.zzafb; Catch:{ all -> 0x005d }
if (r0 != 0) goto L_0x0028;
L_0x0024:
monitor-exit(r4); Catch:{ all -> 0x005d }
L_0x0025:
return;
L_0x0026:
r0 = r2;
goto L_0x001e;
L_0x0028:
r0 = r7.zzaes; Catch:{ all -> 0x005d }
r5 = r0.zzgh(); Catch:{ all -> 0x005d }
if (r5 == 0) goto L_0x0060;
L_0x0030:
r0 = com.google.android.gms.ads.internal.zzbv.zzek(); Catch:{ all -> 0x005d }
r3 = r7.zzaev; Catch:{ all -> 0x005d }
r6 = r7.zzaew; Catch:{ all -> 0x005d }
r0 = r0.zza(r5, r3, r6); Catch:{ all -> 0x005d }
if (r0 == 0) goto L_0x0060;
L_0x003e:
r3 = r1;
L_0x003f:
if (r5 == 0) goto L_0x0062;
L_0x0041:
if (r3 == 0) goto L_0x0062;
L_0x0043:
r0 = new android.graphics.Rect; Catch:{ all -> 0x005d }
r0.<init>(); Catch:{ all -> 0x005d }
r6 = 0;
r0 = r5.getGlobalVisibleRect(r0, r6); Catch:{ all -> 0x005d }
if (r0 == 0) goto L_0x0062;
L_0x004f:
r0 = r1;
L_0x0050:
r2 = r7.zzaes; Catch:{ all -> 0x005d }
r2 = r2.zzgi(); Catch:{ all -> 0x005d }
if (r2 == 0) goto L_0x0064;
L_0x0058:
r7.zzgc(); Catch:{ all -> 0x005d }
monitor-exit(r4); Catch:{ all -> 0x005d }
goto L_0x0025;
L_0x005d:
r0 = move-exception;
monitor-exit(r4); Catch:{ all -> 0x005d }
throw r0;
L_0x0060:
r3 = r2;
goto L_0x003f;
L_0x0062:
r0 = r2;
goto L_0x0050;
L_0x0064:
if (r8 != r1) goto L_0x0074;
L_0x0066:
r2 = r7.zzadz; Catch:{ all -> 0x005d }
r2 = r2.tryAcquire(); Catch:{ all -> 0x005d }
if (r2 != 0) goto L_0x0074;
L_0x006e:
r2 = r7.zzafd; Catch:{ all -> 0x005d }
if (r0 != r2) goto L_0x0074;
L_0x0072:
monitor-exit(r4); Catch:{ all -> 0x005d }
goto L_0x0025;
L_0x0074:
if (r0 != 0) goto L_0x007e;
L_0x0076:
r2 = r7.zzafd; Catch:{ all -> 0x005d }
if (r2 != 0) goto L_0x007e;
L_0x007a:
if (r8 != r1) goto L_0x007e;
L_0x007c:
monitor-exit(r4); Catch:{ all -> 0x005d }
goto L_0x0025;
L_0x007e:
r1 = java.lang.Boolean.valueOf(r3); Catch:{ JSONException -> 0x00d3, RuntimeException -> 0x00cb }
r1 = r7.zza(r5, r1); Catch:{ JSONException -> 0x00d3, RuntimeException -> 0x00cb }
r2 = 0;
r7.zza(r1, r2); Catch:{ JSONException -> 0x00d3, RuntimeException -> 0x00cb }
r7.zzafd = r0; Catch:{ JSONException -> 0x00d3, RuntimeException -> 0x00cb }
L_0x008c:
r0 = r7.zzaes; Catch:{ all -> 0x005d }
r0 = r0.zzgj(); Catch:{ all -> 0x005d }
r1 = r0.zzgh(); Catch:{ all -> 0x005d }
if (r1 == 0) goto L_0x00c5;
L_0x0098:
r0 = r7.zzaer; Catch:{ all -> 0x005d }
r0 = r0.get(); Catch:{ all -> 0x005d }
r0 = (android.view.ViewTreeObserver) r0; Catch:{ all -> 0x005d }
r1 = r1.getViewTreeObserver(); Catch:{ all -> 0x005d }
if (r1 == r0) goto L_0x00c5;
L_0x00a6:
r7.zzgf(); Catch:{ all -> 0x005d }
r2 = r7.zzaez; Catch:{ all -> 0x005d }
if (r2 == 0) goto L_0x00b5;
L_0x00ad:
if (r0 == 0) goto L_0x00be;
L_0x00af:
r0 = r0.isAlive(); Catch:{ all -> 0x005d }
if (r0 == 0) goto L_0x00be;
L_0x00b5:
r0 = 1;
r7.zzaez = r0; Catch:{ all -> 0x005d }
r1.addOnScrollChangedListener(r7); Catch:{ all -> 0x005d }
r1.addOnGlobalLayoutListener(r7); Catch:{ all -> 0x005d }
L_0x00be:
r0 = new java.lang.ref.WeakReference; Catch:{ all -> 0x005d }
r0.<init>(r1); Catch:{ all -> 0x005d }
r7.zzaer = r0; Catch:{ all -> 0x005d }
L_0x00c5:
r7.zzgd(); Catch:{ all -> 0x005d }
monitor-exit(r4); Catch:{ all -> 0x005d }
goto L_0x0025;
L_0x00cb:
r0 = move-exception;
L_0x00cc:
r1 = "Active view update failed.";
com.google.android.gms.internal.ads.zzane.zza(r1, r0); Catch:{ all -> 0x005d }
goto L_0x008c;
L_0x00d3:
r0 = move-exception;
goto L_0x00cc;
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.ads.zzet.zzl(int):void");
}
}
| [
"[email protected]"
]
| |
2a6fb0a1273a3508afca2df179f40254a7554f85 | 5971af9bf04fff14bfd7196dc6d0afa542a00e91 | /MavenAgvSeer/src/main/java/com/kaifantech/component/comm/manager/agv/SeerUtil.java | 164cf0147b802f5fd9466c7173892b1cb4463dce | []
| no_license | dxmcu/maven | 7841cd8a7951fe0f059852ec9070388c20b3e5c3 | 01d8933752ca7306afe96f610b37a69d86018058 | refs/heads/master | 2022-12-26T21:02:37.255799 | 2020-02-16T08:30:29 | 2020-02-16T08:30:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,014 | java | package com.kaifantech.component.comm.manager.agv;
import com.calculatedfun.util.AppTool;
import com.kaifantech.util.hex.AppByteUtil;
public class SeerUtil {
public static String cmd(int cmd) {
return cmd(cmd, null);
}
public static String cmd(String cmd) {
return PREFIX_WHEN_SEND_TASK + cmd + TASK_NAME_SUFFIX;
}
public static String cmd(int cmd, Object json) {
return PREFIX_WHEN_SEND_TASK
+ (AppTool.isNull(json) ? "00000000" : AppByteUtil.intToHex8(json.toString().length())) + cmd
+ TASK_NAME_SUFFIX + (AppTool.isNull(json) ? "" : AppByteUtil.strToHex(json.toString()));
}
public static final String PREFIX_WHEN_SEND_TASK = "5A010001";
public static final String TASK_NAME_SUFFIX = "000000";
public static final int ROBOT_STATUS_INFO_REQ = 1000;// 查询机器人信息
public static final int ROBOT_STATUS_RUN_REQ = 1002;// 查询机器人的运行状态信息(如运行时间、里程等)
public static final int ROBOT_STATUS_LOC_REQ = 1004;// 查询机器人位置
public static final int ROBOT_STATUS_SPEED_REQ = 1005;// 查询机器人速度
public static final int ROBOT_STATUS_BLOCK_REQ = 1006;// 查询机器人被阻挡状态
public static final int ROBOT_STATUS_BATTERY_REQ = 1007;// 查询机器人电池状态
public static final int ROBOT_STATUS_BRAKE_REQ = 1008;// 查询机器人抱闸状态
public static final int ROBOT_STATUS_LASER_REQ = 1009;// 查询机器人激光点云数据
public static final int ROBOT_STATUS_PATH_REQ = 1010;// 查询机器人路径数据
public static final int ROBOT_STATUS_AREA_REQ = 1011;// 查询机器人当前所在区域
public static final int ROBOT_STATUS_EMERGENCY_REQ = 1012;// 查询机器人急停状态
public static final int ROBOT_STATUS_IO_REQ = 1013;// 查询机器人 I/O 数据
public static final int ROBOT_STATUS_IMU_REQ = 1014;// 查询机器人 IMU 数据
public static final int ROBOT_STATUS_RFID_REQ = 1015;// 查询 RFID 数据
public static final int ROBOT_STATUS_ULTRASONIC_REQ = 1016;// 查询机器人的超声传感器数据
public static final int ROBOT_STATUS_PGV_REQ = 1017;// 查询二维码数据(PGV)
public static final int ROBOT_STATUS_ENCODER_REQ = 1018;// 查询编码器脉冲值
public static final int ROBOT_STATUS_TASK_REQ = 1020;// 查询机器人导航状态, 导航站点,
// 导航相关路径等
public static final int ROBOT_STATUS_RELOC_REQ = 1021;// 查询机器人重定位状态
public static final int ROBOT_STATUS_LOADMAP_REQ = 1022;// 查询机器人地图载入状态
public static final int ROBOT_STATUS_SLAM_REQ = 1025;// 查询机器人扫图状态
public static final int ROBOT_STATUS_JACK_REQ = 1027;// 查询顶升机构状态
public static final int ROBOT_STATUS_FORK_REQ = 1028;// 查询货叉(叉车)状态
public static final int ROBOT_STATUS_ROLLER_REQ = 1029;// 查询辊筒(皮带)状态
public static final int ROBOT_STATUS_DISPATCH_REQ = 1030;// 查询机器人当前的调度状态
public static final int ROBOT_STATUS_HOOK_REQ = 1031;// 查询牵引机构状态
public static final int ROBOT_STATUS_ALARM_REQ = 1050;// 查询机器人告警状态
public static final int ROBOT_STATUS_ALL1_REQ = 1100;// 查询批量数据1
public static final int ROBOT_STATUS_ALL2_REQ = 1101;// 查询批量数据2
public static final int ROBOT_STATUS_ALL3_REQ = 1102;// 查询批量数据3
public static final int ROBOT_STATUS_MAP_REQ = 1300;// 查询机器人载入的地图以及储存的地图
public static final int ROBOT_STATUS_STATION = 1301;// 查询机器人当前载入地图中的站点信息
public static final int ROBOT_STATUS_PARAMS_REQ = 1400;// 查询机器人参数
public static final int ROBOT_STATUS_INFO_RES = 11000;// 对 1000 请求的响应
public static final int ROBOT_STATUS_RUN_RES = 11002;// 对 1002 请求的响应
public static final int ROBOT_STATUS_LOC_RES = 11004;// 对 1004 请求的响应
public static final int ROBOT_STATUS_SPEED_RES = 11005;// 对 1005 请求的响应
public static final int ROBOT_STATUS_BLOCK_RES = 11006;// 对 1006 请求的响应
public static final int ROBOT_STATUS_BATTERY_RES = 11007;// 对 1007 请求的响应
public static final int ROBOT_STATUS_BRAKE_RES = 11008;// 对 1008 请求的响应
public static final int ROBOT_STATUS_LASER_RES = 11009;// 对 1009 请求的响应
public static final int ROBOT_STATUS_PATH_RES = 11010;// 对 1010 请求的响应
public static final int ROBOT_STATUS_AREA_RES = 11011;// 对 1011 请求的响应
public static final int ROBOT_STATUS_EMERGENCY_RES = 11012;// 对 1012 请求的响应
public static final int ROBOT_STATUS_IO_RES = 11013;// 对 1013 请求的响应
public static final int ROBOT_STATUS_IMU_RES = 11014;// 对 1014 请求的响应
public static final int ROBOT_STATUS_RFID_RES = 11015;// 对 1015 请求的响应
public static final int ROBOT_STATUS_ULTRASONIC_RES = 11016;// 对 1016 请求的响应
public static final int ROBOT_STATUS_PGV_RES = 11017;// 对 1017 请求的响应
public static final int ROBOT_STATUS_ENCODER_RES = 11018;// 对 1018 请求的响应
public static final int ROBOT_STATUS_TASK_RES = 11020;// 对 1020 请求的响应
public static final int ROBOT_STATUS_RELOC_RES = 11021;// 对 1021 请求的响应
public static final int ROBOT_STATUS_LOADMAP_RES = 11022;// 对 1022 请求的响应
public static final int ROBOT_STATUS_SLAM_RES = 11025;// 对 1025 请求的响应
public static final int ROBOT_STATUS_JACK_RES = 11027;// 对 1027 请求的响应
public static final int ROBOT_STATUS_FORK_RES = 11028;// 对 1028 请求的响应
public static final int ROBOT_STATUS_ROLLER_RES = 11029;// 对 1029 请求的响应
public static final int ROBOT_STATUS_DISPATCH_RES = 11030;// 对 1030 请求的响应
public static final int ROBOT_STATUS_HOOK_RES = 11031;// 对 1031 请求的响应
public static final int ROBOT_STATUS_ALARM_RES = 11050;// 对 1050 请求的响应
public static final int ROBOT_STATUS_ALL1_RES = 11100;// 对 1100 请求的响应
public static final int ROBOT_STATUS_ALL2_RES = 11101;// 对 1101 请求的响应
public static final int ROBOT_STATUS_ALL3_RES = 11102;// 对 1102 请求的响应
public static final int ROBOT_STATUS_MAP_RES = 11300;// 对 1300 请求的响应
public static final int ROBOT_STATUS_STATION_RES = 11301;// 对 1301 请求的响应
public static final int ROBOT_STATUS_PARAMS_RES = 11400;// 对 1400 请求的响应
public static final int ROBOT_CONTROL_STOP_REQ = 2000;// 停止开环运动
public static final int ROBOT_CONTROL_RELOC_REQ = 2002;// 重定位
public static final int ROBOT_CONTROL_COMFIRMLOC_REQ = 2003;// 确认定位正确
public static final int ROBOT_CONTROL_CANCELRELOC_REQ = 2004;// 取消重定位
public static final int ROBOT_CONTROL_MOTION_REQ = 2010;// 开环运动
public static final int ROBOT_CONTROL_LOADMAP_REQ = 2022;// 切换载入的地图
public static final int ROBOT_CONTROL_STOP_RES = 12000;// 对 2000 请求的响应
public static final int ROBOT_CONTROL_RELOC_RES = 12002;// 对 2002 请求的响应
public static final int ROBOT_CONTROL_COMFIRMLOC_RES = 12003;// 对 2003 请求的响应
public static final int ROBOT_CONTROL_CANCELRELOC_RES = 12004;// 对 2004
// 请求的响应
public static final int ROBOT_CONTROL_MOTION_RES = 12010;// 对 2010 请求的响应
public static final int ROBOT_CONTROL_LOADMAP_RES = 12022;// 对 2022 请求的响应
public static final int ROBOT_TASK_PAUSE_REQ = 3001;// 暂停当前导航
public static final int ROBOT_TASK_RESUME_REQ = 3002;// 继续当前导航
public static final int ROBOT_TASK_CANCEL_REQ = 3003;// 取消当前导航
public static final int ROBOT_TASK_GOTARGET_REQ = 3051;// 路径导航(根据地图上站点及路径进行导航)
public static final int ROBOT_TASK_TARGET_PATH_REQ = 3053;// 获取路径导航的路径
public static final int ROBOT_TASK_TRANSLATE_REQ = 3055;// 平动,以固定速度直线运动固定距离
public static final int ROBOT_TASK_TURN_REQ = 3056;// 转动,以固定角速度旋转固定角度
public static final int ROBOT_TASK_GOINTO_SHELF_REQ = 3063;// 顶升钻货架
public static final int ROBOT_TASK_GOTARGETLIST_REQ = 3066;// 指定路径导航(根据路径导航序列进行导航)
public static final int ROBOT_TASK_CLEARTARGETLIST_REQ = 3067;// 清除导航路径
public static final int ROBOT_TASK_TARGET_FOLLOW_REQ = 3070;// 目标跟随
public static final int ROBOT_TASK_UWB_FOLLOW_REQ = 3071;// UWB 跟随
public static final int ROBOT_TASK_PAUSE_RES = 13001;// 对 3001 请求的响应
public static final int ROBOT_TASK_RESUME_RES = 13002;// 对 3002 请求的响应
public static final int ROBOT_TASK_CANCEL_RES = 13003;// 对 3003 请求的响应
public static final int ROBOT_TASK_GOTARGET_RES = 13051;// 对 3051 请求的响应
public static final int ROBOT_TASK_TARGET_PATH_RES = 13053;// 对 3053 请求的响应
public static final int ROBOT_TASK_TRANSLATE_RES = 13055;// 对 3055 请求的响应
public static final int ROBOT_TASK_TURN_RES = 13056;// 对 3056 请求的响应
public static final int ROBOT_TASK_GOINTO_SHELF_RES = 13063;// 对 3063 请求的响应
public static final int ROBOT_TASK_GOTARGETLIST_RES = 13066;// 对 3066 请求的响应
public static final int ROBOT_TASK_CLEARTARGETLIST_RES = 13067;// 对 3067
// 请求的响应
public static final int ROBOT_TASK_TARGET_FOLLOW_RES = 13070;// 对 3070 请求的响应
public static final int ROBOT_TASK_UWB_FOLLOW_RES = 13071;// 对 3071 请求的响应
public static final int ROBOT_CONFIG_REQUIRE_REQ = 4001;// 回收控制权
public static final int ROBOT_CONFIG_RELEASE_REQ = 4002;// 释放控制权
public static final int ROBOT_CONFIG_SRC_REQUIRE_REQ = 4003;// SRC 获得控制
public static final int ROBOT_CONFIG_SRC_RELEASE_REQ = 4004;// SRC 释放控制
public static final int ROBOT_CONFIG_UPLOADMAP_REQ = 4010;// 上传地图到机器人
public static final int ROBOT_CONFIG_DOWNLOADMAP_REQ = 4011;// 从机器人下载地图
public static final int ROBOT_CONFIG_REMOVEMAP_REQ = 4012;// 删除机器人上的地图
public static final int ROBOT_CONFIG_ULTRASONIC_REQ = 4130;// 配置超声
public static final int ROBOT_CONFIG_DI_REQ = 4140;// 配置 DI
public static final int ROBOT_CONFIG_ADDOBSTACLE_REQ = 4350;// 插入动态障碍物(机器人坐标系)
public static final int ROBOT_CONFIG_ADDGOBSTACLE_REQ = 4351;// 插入动态障碍物(世界坐标系)
public static final int ROBOT_CONFIG_REMOVEOBSTACLE_REQ = 4352;// 移除动态障碍物
public static final int ROBOT_CONFIG_CLEAR_GOODSSHAPE_REQ = 4356;// 清除货架描述文件
public static final int ROBOT_CONFIG_SET_SHELFSHAPE_REQ = 4357;// 设置货架描述文件
public static final int ROBOT_CONFIG_SETERROR_REQ = 4800;// 设置第三方 Error
public static final int ROBOT_CONFIG_CLEARERROR_REQ = 4801;// 清除第三方 Error
public static final int ROBOT_CONFIG_SETWARNING_REQ = 4802;// 设置第三方 Warning
public static final int ROBOT_CONFIG_CLEARWARNING_REQ = 4803;// 清除第三方
// Warning
public static final int ROBOT_CONFIG_REQUIRE_RES = 14001;// 对 4001 请求的响应
public static final int ROBOT_CONFIG_RELEASE_RES = 14002;// 对 4002 请求的响应
public static final int ROBOT_CONFIG_SRC_REQUIRE_RES = 14003;// 对 4003 请求的响应
public static final int ROBOT_CONFIG_SRC_RELEASE_RES = 14004;// 对 4004 请求的响应
public static final int ROBOT_CONFIG_UPLOADMAP_RES = 14010;// 对 4010 请求的响应
public static final int ROBOT_CONFIG_DOWNLOADMAP_RES = 14011;// 对 4011 请求的响应
public static final int ROBOT_CONFIG_REMOVEMAP_RES = 14012;// 对 4012 请求的响应
public static final int ROBOT_CONFIG_ULTRASONIC_RES = 14130;// 对 4130 请求的响应
public static final int ROBOT_CONFIG_DI_RES = 14140;// 对 4140 请求的响应
public static final int ROBOT_CONFIG_ADDOBSTACLE_RES = 14350;// 对 4350 请求的响应
public static final int ROBOT_CONFIG_ADDGOBSTACLE_RES = 14351;// 对 4351
// 请求的响应
public static final int ROBOT_CONFIG_REMOVEOBSTACLE_RES = 14352;// 对 4352
// 请求的响应
public static final int ROBOT_CONFIG_CLEAR_GOODSSHAPE_RES = 14356;// 对 4356
// 请求的响应
public static final int ROBOT_CONFIG_SET_SHELFSHAPE_RES = 14357;// 对 4357
// 请求的响应
public static final int ROBOT_CONFIG_SETERROR_RES = 14800;// 对 4800 请求的响应
public static final int ROBOT_CONFIG_CLEARERROR_RES = 14801;// 对 4801 请求的响应
public static final int ROBOT_CONFIG_SETWARNING_RES = 14802;// 对 4802 请求的响应
public static final int ROBOT_CONFIG_CLEARWARNING_RES = 14803;// 对 4803
// 请求的响应
public static final int ROBOT_OTHER_PLAY_AUDIO_REQ = 6000;// 播放音频
public static final int ROBOT_OTHER_SETDO_REQ = 6001;// 设置 DO
public static final int ROBOT_OTHER_SETDOS_REQ = 6002;// 批量设置 DO
public static final int ROBOT_OTHER_SETRELAY_REQ = 6003;// 设置继电器
public static final int ROBOT_OTHER_SOFTEMC_REQ = 6004;// 软急停
public static final int ROBOT_OTHER_SETCHARGINGRELAY_REQ = 6005;// 设置充电继电器
public static final int ROBOT_OTHER_PAUSE_AUDIO_REQ = 6010;// 暂停播放音频
public static final int ROBOT_OTHER_RESUME_AUDIO_REQ = 6011;// 继续播放音频
public static final int ROBOT_OTHER_STOP_AUDIO_REQ = 6012;// 停止播放音频
public static final int ROBOT_OTHER_SETVDI_REQ = 6020;// 设置虚拟 DI
public static final int ROBOT_OTHER_AUDIO_LIST_REQ = 6033;// 获取音频文件列表
public static final int ROBOT_OTHER_SET_FORK_HEIGHT_REQ = 6040;// 设置货叉高度
public static final int ROBOT_OTHER_STOP_FORK_REQ = 6041;// 停止货叉
public static final int ROBOT_OTHER_SET_FORK_FORWARD_REQ = 6042;// 设置货叉前移后退
public static final int ROBOT_OTHER_WRITE_PERIPHERAL_DATA_REQ = 6049;// 写入外设用户自定义数据
public static final int ROBOT_OTHER_ROLLER_FRONT_ROLL_REQ = 6051;// 辊筒(皮带)向前滚动
public static final int ROBOT_OTHER_ROLLER_BACK_ROLL_REQ = 6052;// 辊筒(皮带)向后滚动
public static final int ROBOT_OTHER_ROLLER_LEFT_ROLL_REQ = 6053;// 辊筒(皮带)向左滚动
public static final int ROBOT_OTHER_ROLLER_RIGHT_ROLL_REQ = 6054;// 辊筒(皮带)向右滚动
public static final int ROBOT_OTHER_ROLLER_FRONT_LOAD_REQ = 6055;// 辊筒(皮带)前上料
public static final int ROBOT_OTHER_ROLLER_FRONT_UNLOAD_REQ = 6056;// 辊筒(皮带)前下料
public static final int ROBOT_OTHER_ROLLER_FRONT_PRE_LOAD_REQ = 6057;// 辊筒(皮带)前预上料
public static final int ROBOT_OTHER_ROLLER_BACK_LOAD_REQ = 6058;// 辊筒(皮带)后上料
public static final int ROBOT_OTHER_ROLLER_BACK_UNLOAD_REQ = 6059;// 辊筒(皮带)后下料
public static final int ROBOT_OTHER_ROLLER_BACK_PRE_LOAD_REQ = 6060;// 辊筒(皮带)后预上料
public static final int ROBOT_OTHER_ROLLER_LEFT_LOAD_REQ = 6061;// 辊筒(皮带)左上料
public static final int ROBOT_OTHER_ROLLER_LEFT_UNLOAD_REQ = 6062;// 辊筒(皮带)左下料
public static final int ROBOT_OTHER_ROLLER_RIGHT_LOAD_REQ = 6063;// 辊筒(皮带)右上料
public static final int ROBOT_OTHER_ROLLER_RIGHT_UNLOAD_REQ = 6064;// 辊筒(皮带)右下料
public static final int ROBOT_OTHER_ROLLER_LEFT_PRE_LOAD_REQ = 6065;// 辊筒(皮带)左预上料
public static final int ROBOT_OTHER_ROLLER_RIGHT_PRE_LOAD_REQ = 6066;// 辊筒(皮带)右预上料
public static final int ROBOT_OTHER_ROLLER_STOP_REQ = 6067;// 辊筒(皮带)停止
public static final int ROBOT_OTHER_ROLLER_LEFT_RIGHT_INVERSE_REQ = 6068;// 辊筒(皮带)左右相反
public static final int ROBOT_OTHER_ROLLER_FRONT_BACK_INVERSE_REQ = 6069;// 辊筒(皮带)前后相反
public static final int ROBOT_OTHER_JACK_LOAD_REQ = 6070;// 顶升机构上升
public static final int ROBOT_OTHER_JACK_UNLOAD_REQ = 6071;// 顶升机构下降
public static final int ROBOT_OTHER_JACK_STOP_REQ = 6072;// 顶升机构停止
public static final int ROBOT_OTHER_JACK_SET_HEIGHT_REQ = 6073;// 顶升定高
public static final int ROBOT_OTHER_HOOK_PRE_CLAMP_REQ = 6080;// 牵引预夹取
public static final int ROBOT_OTHER_HOOK_ADJUST_TO_RECOGNIZED_REQ = 6081;// 牵引调整至识别位置
public static final int ROBOT_OTHER_HOOK_CLAMP_REQ = 6082;// 牵引夹取
public static final int ROBOT_OTHER_HOOK_DETACH_REQ = 6083;// 牵引脱离
public static final int ROBOT_OTHER_HOOK_RESET_REQ = 6084;// 牵引复位
public static final int ROBOT_OTHER_HOOK_STOP_REQ = 6085;// 牵引停止
public static final int ROBOT_OTHER_SLAM_REQ = 6100;// 开始扫描地图
public static final int ROBOT_OTHER_ENDSLAM_REQ = 6101;// 停止扫描地图
public static final int ROBOT_OTHER_SET_MOTORS_REQ = 6200;// 电机调试
public static final int ROBOT_OTHER_PLAY_AUDIO_RES = 16000;// 对 6000 请求的响应
public static final int ROBOT_OTHER_SETDO_RES = 16001;// 对 6001 请求的响应
public static final int ROBOT_OTHER_SETDOS_RES = 16002;// 对 6002 请求的响应
public static final int ROBOT_OTHER_SETRELAY_RES = 16003;// 对 6003 请求的响应
public static final int ROBOT_OTHER_SOFTEMC_RES = 16004;// 对 6004 请求的响应
public static final int ROBOT_OTHER_SETCHARGINGRELAY_RES = 16005;// 对 6005
// 请求的响应
public static final int ROBOT_OTHER_PAUSE_AUDIO_RES = 16010;// 对 6010 请求的响应
public static final int ROBOT_OTHER_RESUME_AUDIO_RES = 16011;// 对 6011 请求的响应
public static final int ROBOT_OTHER_STOP_AUDIO_RES = 16012;// 对 6012 请求的响应
public static final int ROBOT_OTHER_SETVDI_RES = 16020;// 对 6020 请求的响应
public static final int ROBOT_OTHER_AUDIO_LIST_RES = 16033;// 对 6033 请求的响应
public static final int ROBOT_OTHER_SET_FORK_HEIGHT_RES = 16040;// 对 6040
// 请求的响应
public static final int ROBOT_OTHER_STOP_FORK_RES = 16041;// 对 6041 请求的响应
public static final int ROBOT_OTHER_SET_FORK_FORWARD_RES = 16042;// 对 16042
// 请求的响应
public static final int ROBOT_OTHER_WRITE_PERIPHERAL_DATA_RES = 16049;// 对
// 6049
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_FRONT_ROLL_RES = 16051;// 对 6051
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_BACK_ROLL_RES = 16052;// 对 6051
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_LEFT_ROLL_RES = 16053;// 对 6053
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_RIGHT_ROLL_RES = 16054;// 对 6054
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_FRONT_LOAD_RES = 16055;// 对 6055
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_FRONT_UNLOAD_RES = 16056;// 对
// 6056
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_FRONT_PRE_LOAD_RES = 16057;// 对
// 6057
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_BACK_LOAD_RES = 16058;// 对 6058
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_BACK_UNLOAD_RES = 16059;// 对 6059
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_BACK_PRE_LOAD_RES = 16060;// 对
// 6060
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_LEFT_LOAD_RES = 16061;// 对 6061
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_LEFT_UNLOAD_RES = 16062;// 对 6062
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_RIGHT_LOAD_RES = 16063;// 对 6063
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_RIGHT_UNLOAD_RES = 16064;// 对
// 6064
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_LEFT_PRE_LOAD_RES = 16065;// 对
// 6065
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_RIGHT_PRE_LOAD_RES = 16066;// 对
// 6066
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_STOP_RES = 16067;// 对 6067 请求的响应
public static final int ROBOT_OTHER_ROLLER_LEFT_RIGHT_INVERSE_RES = 16068;// 对
// 6068
// 请求的响应
public static final int ROBOT_OTHER_ROLLER_FRONT_BACK_INVERSE_RES = 16069;// 对
// 6069
// 请求的响应
public static final int ROBOT_OTHER_JACK_LOAD_RES = 16070;// 对 6070 请求的响应
public static final int ROBOT_OTHER_JACK_UNLOAD_RES = 16071;// 对 6071 请求的响应
public static final int ROBOT_OTHER_JACK_STOP_RES = 16072;// 对 6072 请求的响应
public static final int ROBOT_OTHER_JACK_SET_HEIGHT_RES = 16073;// 对 6073
// 请求的响应
public static final int ROBOT_OTHER_HOOK_PRE_CLAMP_RES = 16080;// 对 6080
// 请求的响应
public static final int ROBOT_OTHER_HOOK_ADJUST_TO_RECOGNIZED_RES = 16081;// 对
// 6081
// 请求的响应
public static final int ROBOT_OTHER_HOOK_CLAMP_RES = 16082;// 对 6082 请求的响应
public static final int ROBOT_OTHER_HOOK_DETACH_RES = 16083;// 对 6083 请求的响应
public static final int ROBOT_OTHER_HOOK_RESET_RES = 16084;// 对 6084 请求的响应
public static final int ROBOT_OTHER_HOOK_STOP_RES = 16085;// 对 6085 请求的响应
public static final int ROBOT_OTHER_SLAM_RES = 16100;// 对 6100 请求的响应
public static final int ROBOT_OTHER_ENDSLAM_RES = 16101;// 对 6101 请求的响应
public static final int ROBOT_OTHER_SET_MOTORS_RES = 16200;// 对 6200 请求的响应
}
| [
"[email protected]"
]
| |
57941c986e9d573fe2cdcabb3b3f020e67e95a12 | d9d7bf3d0dca265c853cb58c251ecae8390135e0 | /gcld/src/com/reign/framework/hibernate/hql/ObjectFactory.java | fd1f43774fe449596e194ee0a844045fb48e7862 | []
| no_license | Crasader/workspace | 4da6bd746a3ae991a5f2457afbc44586689aa9d0 | 28e26c065a66b480e5e3b966be4871b44981b3d8 | refs/heads/master | 2020-05-04T21:08:49.911571 | 2018-11-19T08:14:27 | 2018-11-19T08:14:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 720 | java | package com.reign.framework.hibernate.hql;
import javax.xml.namespace.*;
import javax.xml.bind.*;
import javax.xml.bind.annotation.*;
@XmlRegistry
public class ObjectFactory
{
private static final QName _Hqls_QNAME;
static {
_Hqls_QNAME = new QName("http://com.reign.framework.hibernate/hql", "hqls");
}
public Hql createHql() {
return new Hql();
}
public Hqls createHqls() {
return new Hqls();
}
@XmlElementDecl(namespace = "http://com.reign.framework.hibernate/hql", name = "hqls")
public JAXBElement<Hqls> createHqls(final Hqls value) {
return new JAXBElement<Hqls>(ObjectFactory._Hqls_QNAME, Hqls.class, null, value);
}
}
| [
"[email protected]"
]
| |
6cd48a54062b332101c9a40b41106d442b6aaa29 | 2dac9ca58ae2ff6c63c1f2a900f2159b68057b42 | /app/src/main/java/com/weatone/rbademoapp/NetworkChangeDelegate.java | 66aab820fad56af5fcc57b80f0df7e1146628a96 | []
| no_license | celinenicolas/simple-masterdetail-client-android | 2b31485a93af8a2377bddfde64361cf6a9f695aa | cea322ffc147463b6477a879dabd111fa6e4a926 | refs/heads/master | 2021-01-19T08:02:11.220594 | 2017-04-11T16:58:48 | 2017-04-11T16:58:48 | 87,596,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 235 | java | package com.weatone.rbademoapp;
/**
* @author Celine Nicolas
* @version 1.0.0, 2017-04-11
* @since 1.0.0
*/
public interface NetworkChangeDelegate {
void onConnected();
void onDisconnected();
boolean isConnected();
}
| [
"[email protected]"
]
| |
974795a68ae089e918e764f19f9552641308cd1b | 8f5e7a4920afd476b58c84697d0ad492d603cb60 | /javac/src/main/java/com/by122006/zircon/ZirconStringPlugin.java | db45bdd56175fdaca8d3578f086498757a01659f | [
"Apache-2.0"
]
| permissive | luyuhuang/Zircon | 608b0141148cfb1e34085accd0ab2e8cd1548df1 | 2116a1b17bd1735e07b7592ac9360d7a0ed98df4 | refs/heads/master | 2023-03-02T15:58:55.771046 | 2021-02-05T06:39:53 | 2021-02-05T06:39:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,803 | java | /*
* Copyright (C) 2009-2013 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.by122006.zircon;
import com.sun.source.tree.LiteralTree;
import com.sun.source.util.*;
import com.sun.tools.javac.api.BasicJavacTask;
import com.sun.tools.javac.comp.Attr;
import com.sun.tools.javac.main.JavaCompiler;
import com.sun.tools.javac.parser.ParserFactory;
import com.sun.tools.javac.parser.ScannerFactory;
import com.sun.tools.javac.util.Context;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class ZirconStringPlugin extends TreeScanner<Void, Void> implements Plugin {
public static final String NAME = "ZrString";
@Override
public String getName() {
return NAME;
}
@Override
public void init(JavacTask task, String... args) {
System.out.println("start [动态字符串插件]");
BasicJavacTask javacTask = (BasicJavacTask) task;
Context context = javacTask.getContext();
task.addTaskListener(new TaskListener() {
@Override
public void started(TaskEvent e) {
if (e.getKind() != TaskEvent.Kind.PARSE) {
return;
}
try {
startTask(context, ZirconStringPlugin.class.getClassLoader(), Attr.class.getClassLoader());
} catch (Exception exception) {
exception.printStackTrace();
}
}
@Override
public void finished(TaskEvent e) {
// System.out.println("end: TaskEvent.Kind."+e.getKind());
if (e.getKind() != TaskEvent.Kind.PARSE) {
return;
}
e.getCompilationUnit().accept(ZirconStringPlugin.this, null);
}
});
}
private void startTask(Context context, ClassLoader pcl, ClassLoader classLoader) throws Exception {
JavaCompiler compiler = null;
try {
compiler = JavaCompiler.instance(context);
} catch (Exception e) {
// e.printStackTrace();
return;
}
reloadClass("com.sun.tools.javac.parser.ZrJavaTokenizer", pcl, classLoader);
reloadClass("com.sun.tools.javac.parser.ZrJavaTokenizer$Group", pcl, classLoader);
reloadClass("com.sun.tools.javac.parser.ZrJavaTokenizer$Item", pcl, classLoader);
reloadClass("com.sun.tools.javac.parser.ZrJavadocTokenizer", pcl, classLoader);
Class<?> OOScannerClass = reloadClass("com.sun.tools.javac.parser.ZrScanner", pcl, classLoader);
Class<?> OOScannerFactoryClass = reloadClass("com.sun.tools.javac.parser.ZrScannerFactory", pcl, classLoader);
ScannerFactory var1 = (ScannerFactory) context.get(ScannerFactory.scannerFactoryKey);
ParserFactory parserFactory = (ParserFactory) get(compiler, "parserFactory");
Object instance = getInstance(OOScannerFactoryClass, context);
set(parserFactory, "scannerFactory", instance);
}
@Override
public Void visitLiteral(LiteralTree node, Void unused) {
return super.visitLiteral(node, unused);
}
public static Object get(Object obj, String field) {
try {
Field f = obj.getClass().getDeclaredField(field);
f.setAccessible(true);
return f.get(obj);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static void set(Object obj, String field, Object val) {
try {
Field f = obj.getClass().getDeclaredField(field);
f.setAccessible(true);
f.set(obj, val);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static Object getInstance(Class<?> clas, Context context) throws ReflectiveOperationException {
return clas.getDeclaredMethod("instance", Context.class).invoke(null, context);
}
@SuppressWarnings("unchecked")
/** add class claz to outClassLoader */
static <T> Class<T> reloadClass(String claz, ClassLoader incl, ClassLoader outcl) throws Exception {
try { // already loaded?
return (Class<T>) outcl.loadClass(claz);
} catch (ClassNotFoundException e) {
}
String path = claz.replace('.', '/') + ".class";
InputStream is = incl.getResourceAsStream(path);
byte[] bytes = new byte[is.available()];
is.read(bytes);
Method m = ClassLoader.class.getDeclaredMethod("defineClass", new Class[]{
String.class, byte[].class, int.class, int.class});
m.setAccessible(true);
return (Class<T>) m.invoke(outcl, claz, bytes, 0, bytes.length);
}
}
| [
"[email protected]"
]
| |
5564f30dec8db57ab4324ad0b039a02ce7c97445 | b3a02d5f1f60cd584fbb6da1b823899607693f63 | /04_DB Frameworks_Hibernate+Spring Data/99_Exams/PhotographyWorkshops/src/main/java/app/domain/entities/Photographer.java | 9fcaf08310a038da42c3555db73f5e715f66b286 | [
"MIT"
]
| permissive | akkirilov/SoftUniProject | 20bf0543c9aaa0a33364daabfddd5f4c3e400ba2 | 709d2d1981c1bb6f1d652fe4101c1693f5afa376 | refs/heads/master | 2021-07-11T02:53:18.108275 | 2018-12-04T20:14:19 | 2018-12-04T20:14:19 | 79,428,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,841 | java | package app.domain.entities;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@Entity
@Table(name = "photographers")
public class Photographer {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Column(name = "first_name")
private String firstName;
@NotNull
//@Length(min = 2, max = 50)
@Column(name = "last_name")
private String lastName;
@Pattern(regexp = "\\+[0-9]{1,3}\\/[0-9]{8,10}")
@Column(name = "phone")
private String phone;
@NotNull
@OneToOne
@JoinColumn(name = "primary_camera_id")
private Camera primaryCamera;
@NotNull
@OneToOne
@JoinColumn(name = "secondary_camera_id")
private Camera secondaryCamera;
@ManyToMany()
@JoinTable(name = "photographers_lenses",
joinColumns = @JoinColumn(name = "photographer_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "lens_id", referencedColumnName = "id"))
private Set<Lens> lenses;
@OneToMany(mappedBy = "owner")
private Set<Accessory> accessories;
public Photographer() {
super();
this.lenses = new HashSet<>();
this.accessories = new HashSet<>();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Camera getPrimaryCamera() {
return primaryCamera;
}
public void setPrimaryCamera(Camera primaryCamera) {
this.primaryCamera = primaryCamera;
}
public Camera getSecondaryCamera() {
return secondaryCamera;
}
public void setSecondaryCamera(Camera secondaryCamera) {
this.secondaryCamera = secondaryCamera;
}
public Set<Lens> getLenses() {
return lenses;
}
public void setLenses(Set<Lens> lenses) {
this.lenses = lenses;
}
public void addLens(Lens lens) {
this.lenses.add(lens);
}
public Set<Accessory> getAccessories() {
return accessories;
}
public void setAccessories(Set<Accessory> accessories) {
this.accessories = accessories;
}
public String getFullName() {
return this.firstName + " " + this.lastName;
}
}
| [
"[email protected]"
]
| |
907ca37748e8f5e9ff35c39edcf64e6e827ef419 | 40cd4da5514eb920e6a6889e82590e48720c3d38 | /desktop/applis/apps/core/common/expressionlanguage/src/main/java/code/expressionlanguage/exec/blocks/ExecFileBlock.java | abd3c74ee8b006379db59effe8a3418b9ab4ea90 | []
| no_license | Cardman/projects | 02704237e81868f8cb614abb37468cebb4ef4b31 | 23a9477dd736795c3af10bccccb3cdfa10c8123c | refs/heads/master | 2023-08-17T11:27:41.999350 | 2023-08-15T07:09:28 | 2023-08-15T07:09:28 | 34,724,613 | 4 | 0 | null | 2020-10-13T08:08:38 | 2015-04-28T10:39:03 | Java | UTF-8 | Java | false | false | 911 | java | package code.expressionlanguage.exec.blocks;
import code.expressionlanguage.ContextEl;
import code.expressionlanguage.common.AbstractFileEscapedCalc;
import code.expressionlanguage.common.FileMetricsCore;
import code.expressionlanguage.linkage.LinkageUtil;
import code.util.StringMap;
public final class ExecFileBlock extends ExecFileBlockAbs {
private final String fileName;
public ExecFileBlock(FileMetricsCore _metricsCore, String _fileName, AbstractFileEscapedCalc _fileEscapedCalc) {
super(_metricsCore,_fileEscapedCalc);
fileName = _fileName;
}
public static String name(ExecFileBlock _f) {
if (_f == null) {
return "";
}
return _f.getFileName();
}
public String getFileName() {
return fileName;
}
public static StringMap<String> export(ContextEl _cont) {
return LinkageUtil.export(_cont);
}
}
| [
"[email protected]"
]
| |
9521e2cfea461e546b61592243088d924e788b26 | 9865f3d0c59223840ab90a47cc6c8e52f5246a8b | /lab1/gumball-java-pattern/Main.java | 769f83f7ec0af3b7019b9cd7f6db0f8ff2e01aaf | []
| no_license | luminous66/cmpe202 | 0fd1159f6ded33d5369d64cfcadc73527a32b833 | 3068badaf23e77772bf9e7805202b4e84278d380 | refs/heads/master | 2020-03-28T00:20:46.960437 | 2018-11-17T08:09:08 | 2018-11-17T08:09:08 | 147,400,817 | 0 | 0 | null | 2018-09-08T06:44:17 | 2018-09-04T19:21:18 | Java | UTF-8 | Java | false | false | 1,940 | java |
public class Main {
public static void main(String[] args) {
GumballMachine gumballMachine1 = new GumballMachine(2,25,true);
System.out.println(gumballMachine1);
gumballMachine1.insertCoin(10);
gumballMachine1.turnCrank();
System.out.println(gumballMachine1);
gumballMachine1.insertCoin(25);
gumballMachine1.turnCrank();
gumballMachine1.insertCoin(25);
gumballMachine1.ejectCoin();
gumballMachine1.turnCrank();
gumballMachine1.insertCoin(25);
gumballMachine1.turnCrank();
gumballMachine1.insertCoin(25);
gumballMachine1.turnCrank();
gumballMachine1.refill(5);
gumballMachine1.insertCoin(25);
gumballMachine1.turnCrank();
System.out.println(gumballMachine1);
GumballMachine gumballMachine2 = new GumballMachine(3,50,true);
System.out.println(gumballMachine2);
gumballMachine2.insertCoin(25);
gumballMachine2.turnCrank();
System.out.println(gumballMachine2);
gumballMachine2.insertCoin(25);
gumballMachine2.turnCrank();
gumballMachine2.insertCoin(25);
gumballMachine2.insertCoin(25);
gumballMachine2.turnCrank();
gumballMachine2.insertCoin(25);
gumballMachine2.turnCrank();
gumballMachine2.insertCoin(25);
gumballMachine2.turnCrank();
gumballMachine2.insertCoin(25);
gumballMachine2.turnCrank();
System.out.println(gumballMachine2);
GumballMachine gumballMachine3 = new GumballMachine(2,50,false);
System.out.println(gumballMachine3);
gumballMachine3.insertCoin(25);
gumballMachine3.turnCrank();
System.out.println(gumballMachine3);
gumballMachine3.insertCoin(5);
gumballMachine3.turnCrank();
gumballMachine1.ejectCoin();
gumballMachine3.insertCoin(10);
gumballMachine3.insertCoin(25);
gumballMachine3.turnCrank();
gumballMachine3.insertCoin(10);
gumballMachine3.turnCrank();
gumballMachine3.insertCoin(25);
gumballMachine3.insertCoin(25);
gumballMachine3.turnCrank();
System.out.println(gumballMachine3);
}
}
| [
"[email protected]"
]
| |
caefee4c39bd4b8ee4ec68692eac42bb2fc83474 | 0ee3fd6e8dcfc6fdc3b478c5db6cd79654ecdd29 | /src/main/java/org/rb/cvlv/keeper/FXMLDocumentController.java | 941a236937b2db2b5bfefdf079ca9f3b9cdc90f8 | []
| no_license | rigels02/JavaFX-cv-lv-keeper | 10eb2f06786e3d83b0b42af17a7af91ea9a837af | 8909ab4376c909074323121890cfb0d8a1f83a8f | refs/heads/master | 2018-12-06T17:05:09.745778 | 2018-09-10T15:23:56 | 2018-09-10T15:23:56 | 113,868,326 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,662 | java | package org.rb.cvlv.keeper;
import java.io.IOException;
import java.io.StringWriter;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.concurrent.Worker;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import javafx.util.Callback;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.rb.cvlv.keeper.model.Keep;
import org.rb.cvlv.keeper.model.XKeep;
import org.rb.cvlv.keeper.model.XStatus;
import org.rb.cvlv.keeper.parser.*;
import org.rb.cvlv.keeper.xmlparser.SimpleXMLParser;
import org.w3c.dom.Document;
/**
*
* @author raitis
*/
public class FXMLDocumentController implements Initializable {
public final static String FILEPATH= "bookmarks.xml";
private Parser currentParser;
//private final static String HOME="https://www.cv.lv";
//private final static String NVALV="https://cvvp.nva.gov.lv/#/pub/vakances/saraksts";
private final static String DATEFMT="dd/MM/yyyy";
@FXML
private ListView<XKeep> fxListView;
@FXML
private TextField fxTextUrl;
@FXML
private WebView fxWebView;
@FXML
private ProgressBar fxProgressBar;
@FXML
private Button fxBtnSave;
private List<XKeep> keeps;
private SimpleDateFormat sf;
//icons for listview
private Image i_noapp,i_apply, i_int1, i_int2, i_canceled;
private boolean saveAfterReload;
@Override
public void initialize(URL url, ResourceBundle rb) {
i_noapp = new Image(getClass().getResourceAsStream("/images/notapplyt.png"));
i_apply = new Image(getClass().getResourceAsStream("/images/applyt.png"));
i_int1 = new Image(getClass().getResourceAsStream("/images/int1t.png"));
i_int2 = new Image(getClass().getResourceAsStream("/images/int2t.png"));
i_canceled = new Image(getClass().getResourceAsStream("/images/cancelt.png"));
sf = new SimpleDateFormat(DATEFMT);
loadData();
final WebEngine webEngine = fxWebView.getEngine();
webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<Worker.State>() {
@Override
public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) {
if (newValue == Worker.State.SUCCEEDED) {
System.out.println("load finished...");
/**
org.w3c.dom.Document xmlDoc = webEngine.getDocument();
transformXML(xmlDoc);
*/
fxProgressBar.setVisible(false);
fxTextUrl.setText(webEngine.getLocation());
fxBtnSave.setDisable(false);
if(saveAfterReload){
saveAfterReload=false;
saveLoadedPage();
}
}
if(newValue == Worker.State.RUNNING){
System.out.println("loading...");
fxBtnSave.setDisable(true);
fxProgressBar.setVisible(true);
}
}
});
fxProgressBar.setVisible(true);
currentParser= Parser.Home;
webEngine.load(ParserJsoupFactory.init().getUrl(Parser.Home));
fxTextUrl.setText(ParserJsoupFactory.init().getUrl(Parser.Home));
fxListView.setCellFactory(new Callback<ListView<XKeep>, ListCell<XKeep>>() {
@Override
public ListCell<XKeep> call(ListView<XKeep> param) {
return new ListCell<XKeep>() {
@Override
protected void updateItem(XKeep item, boolean empty) {
super.updateItem(item, empty);
if (item == null || empty) {
setText(null);
setStyle("");
setGraphic(null);
} else {
setText(item.printItem(sf));
if (deadLineDateNotExpired(item.getDeadline())) {
setStyle("-fx-padding:4px;-fx-border-width:1;-fx-border-color: green;-fx-border-radius: 5;-fx-border-insets:1");
} else if (twoWeeksAfterDeadLineDate(item.getDeadline())) {
setStyle("-fx-padding:4px;-fx-border-width:1px;-fx-border-color: black;-fx-border-radius: 5;-fx-border-insets:1");
} else {
setStyle("-fx-padding:4px;-fx-border-width:1px;-fx-border-color: red;-fx-border-radius: 5;-fx-border-insets:1");
}
ImageView icon = getIcon(item.getStatus());
//resizeImageView(icon);
setGraphic(icon);
}
}
}
;
}});
}
private ImageView getIcon(XStatus status) {
ImageView rect = null;
switch(status){
case Apply:
rect = new ImageView(i_apply);
break;
case Interv_1:
rect = new ImageView(i_int1);
break;
case Interv_2:
rect = new ImageView(i_int2);
break;
case Canceled:
rect = new ImageView(i_canceled);
break;
default:
rect = new ImageView(i_noapp);
}
return rect;
}
private void resizeImageView(ImageView icon) {
icon.setFitWidth(24);
icon.setPreserveRatio(true);
}
private String transformXML(Document xmlDoc) {
String xml =null;
TransformerFactory transformerFactory = TransformerFactory
.newInstance();
Transformer transformer;
try {
transformer = transformerFactory.newTransformer();
StringWriter stringWriter = new StringWriter();
/**
* transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
* transformer.setOutputProperty(OutputKeys.METHOD, "xml");
* transformer.setOutputProperty(OutputKeys.INDENT, "yes");
* transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
* transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
*/
transformer.transform(new DOMSource(xmlDoc),
new StreamResult(stringWriter));
xml = stringWriter.getBuffer().toString();
System.out.println("Transform completed...");
//System.out.println(xml);
} catch (TransformerConfigurationException ex) {
Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
} catch (TransformerException ex) {
Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
}
return xml;
}
private void saveLoadedPage(){
final WebEngine webEngine = fxWebView.getEngine();
org.w3c.dom.Document xmlDoc = webEngine.getDocument();
String url = webEngine.getLocation();
String xmlString = transformXML(xmlDoc);
IParserJsoup parser = ParserJsoupFactory.init().getJsoupParser(currentParser, xmlString);
//ParserJsoup_CVLV parser = new ParserJsoup_CVLV(xmlString);
parser.process();
String scrapHtml = parser.getBodyHTML();
//test
//System.out.println("onBtnSave()"+scrapHtml);
XKeep xkeep = new XKeep(parser.getTitle(), parser.getLocation(), parser.getPublished(),
parser.getDeadline(), fxTextUrl.getText(), "", scrapHtml);
addItem(xkeep);
saveData();
}
@FXML
void onBtnSave(ActionEvent event) {
final WebEngine webEngine = fxWebView.getEngine();
if(currentParser.equals(Parser.NVA)){
//reload selected page to get its correct location url
//
saveAfterReload =true;
webEngine.reload();
//save is done after reload of page completed. See webengine load worker handler
//stm at line #103
return;
}
saveLoadedPage();
}
private void loadData() {
SimpleXMLParser xmlParser = new SimpleXMLParser();
try {
keeps = xmlParser.deserializeXMLFile(FILEPATH);
} catch (Exception ex) {
Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
new Alert(Alert.AlertType.ERROR, ex.getMessage(),ButtonType.OK).showAndWait();
return;
}
updateListView(keeps);
}
private void saveData(){
SimpleXMLParser xmlParser = new SimpleXMLParser();
try {
xmlParser.serializeXMLFile(this.keeps, FILEPATH);
} catch (Exception ex) {
Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
new Alert(Alert.AlertType.ERROR, "Error:\n"+ex.getMessage(),ButtonType.CLOSE).showAndWait();
}
}
private void updateListView(List<XKeep> xkeeps) {
/**
List<Keep> keeps= new ArrayList<>();
for (XKeep xkeep : xkeeps) {
//Keep keep = new Keep(xkeep);
Keep keep = xkeep;
keeps.add(keep);
}
*/
ObservableList<XKeep> olist = FXCollections.observableArrayList(xkeeps);
fxListView.setItems(olist);
Integer idx_o = (Integer) MainApp.getPrimaryStage().getProperties().get(PropertyConst.SELIDX_P);
int idx = -1;
if(idx_o != null && (idx= idx_o) >= 0){
fxListView.getSelectionModel().select(idx);
fxListView.getFocusModel().focus(idx);
fxListView.scrollTo(idx);
}
}
@FXML
void onBtnComments(ActionEvent event) throws IOException {
if(fxListView.getSelectionModel().getSelectedIndex()< 0) return;
int idx = fxListView.getSelectionModel().getSelectedIndex();
XKeep keep = fxListView.getSelectionModel().getSelectedItem();
MainApp.getPrimaryStage().getProperties().put(PropertyConst.XKEEP_P, keep);
MainApp.getPrimaryStage().getProperties().put(PropertyConst.XKEEPS_P,this.keeps);
MainApp.getPrimaryStage().getProperties().put(PropertyConst.SELIDX_P,idx);
Stage stage = MainApp.getPrimaryStage();
Parent root = FXMLLoader.load(getClass().getResource("/fxml/FXMLDocView.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add("/styles/fxmldocview.css");
stage.setTitle("Comments");
stage.setScene(scene);
stage.show();
}
@FXML
void onBtnDelete(ActionEvent event) {
if(fxListView.getSelectionModel().getSelectedIndex()< 0) return;
int idx = fxListView.getSelectionModel().getSelectedIndex();
XKeep selectedItem = fxListView.getSelectionModel().getSelectedItem();
Alert confirm = new Alert(Alert.AlertType.CONFIRMATION, "Delete selected Item? :\n"+selectedItem.print(),
ButtonType.YES, ButtonType.NO);
Optional<ButtonType> selected = confirm.showAndWait();
if(selected.get().equals(ButtonType.NO)) return;
//delete
removeItem(idx);
saveData();
}
@FXML
void onBtnSelect(ActionEvent event) {
if(fxListView.getSelectionModel().getSelectedIndex()< 0) return;
int idx = fxListView.getSelectionModel().getSelectedIndex();
//test
//System.out.println("onBtnSelect:\n"+keeps.get(idx));
Keep selectedItem = fxListView.getSelectionModel().getSelectedItem();
fxWebView.getEngine().load(selectedItem.getPageUrl());
}
@FXML
void onBtnHome(ActionEvent event) {
fxTextUrl.setText(ParserJsoupFactory.init().getUrl(currentParser));
fxWebView.getEngine().load(ParserJsoupFactory.init().getUrl(currentParser));
}
private void printbody(IParserJsoup parser) {
System.out.println(">>>>----------printbody() HTML-------");
System.out.println(parser.getBodyHTML());
System.out.println("----------printbody() HTML-------<<<<");
}
private boolean deadLineDateNotExpired(Date deadLineDate){
if(deadLineDate==null) return true;
return deadLineDate.after(new Date());
}
/**
* Test that two weeks have gone after deadLineDate.
* @param deadLineDate
* @return
*/
private boolean twoWeeksAfterDeadLineDate(Date deadLineDate){
if(deadLineDate==null) return true;
Calendar cal = Calendar.getInstance();
cal.setTime(deadLineDate);
//two weeks = 14 days
int days= 14;
cal.add(Calendar.DAY_OF_YEAR,days);
Date twoWeeksDate = cal.getTime();
Date currentDate = new Date();
return currentDate.after(twoWeeksDate);
}
private void removeItem(int idx) {
fxListView.getItems().remove(idx);
keeps.remove(idx);
}
private void addItem(XKeep xkeep) {
//Keep keep = new Keep(xkeep);
fxListView.getItems().add(xkeep);
keeps.add(xkeep);
}
//--- On menu item selection ---//
@FXML
void onCVLVselected(ActionEvent event) {
fxTextUrl.setText(ParserJsoupFactory.init().getUrl(Parser.Home));
fxWebView.getEngine().load(ParserJsoupFactory.init().getUrl(Parser.Home));
currentParser = Parser.Home;
}
@FXML
void onNVASelected(ActionEvent event) {
fxTextUrl.setText(ParserJsoupFactory.init().getUrl(Parser.NVA));
fxWebView.getEngine().load(ParserJsoupFactory.init().getUrl(Parser.NVA));
currentParser = Parser.NVA;
}
}
| [
"[email protected]"
]
| |
88494019882cf8e345cc8e23e06db17abee57826 | c69b09fe89c06e1d83ae8c1d87a46678288d0eda | /_extend/solon.extend.servlet/src/main/java/org/noear/solon/extend/servlet/SolonServletHandler.java | ae39e99c2c369390aab86ed9ee3d2b7df3015ebc | [
"Apache-2.0"
]
| permissive | dongatsh/solon | fb9d3da2ce67746dd8cfe1fef288e2de1bc3d1a2 | 4c3a074e8e4db7f367f75603ea8347d2c501c69d | refs/heads/master | 2023-08-28T18:16:44.023899 | 2021-10-31T16:21:03 | 2021-10-31T16:21:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 960 | java | package org.noear.solon.extend.servlet;
import org.noear.solon.Solon;
import org.noear.solon.core.handle.Context;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author noear
* @since 1.2
* */
public class SolonServletHandler extends HttpServlet {
protected void preHandle(Context ctx) {
}
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
SolonServletContext ctx = new SolonServletContext(request, response);
ctx.contentType("text/plain;charset=UTF-8");
preHandle(ctx);
Solon.global().tryHandle(ctx);
if (ctx.getHandled() == false || ctx.status() == 404) {
response.setStatus(404);
}else{
ctx.commit();
}
}
}
| [
"[email protected]"
]
| |
45ef2cc95fd5645565a322a53e295c283fb6a1c2 | 3a63df2bce3715712e5fa7a694dfde32125bae69 | /src/com/microsoft/interview/LetterCombinationsTest.java | 9c2ecf95f381923327639a4a581245f981cd0304 | []
| no_license | singh-bk/temp3 | 8323ff09f3573cfa7f814ab1089c4254e56e5495 | 97ab3e6c8c6304ff2abafef901dcfc59aed48d9a | refs/heads/master | 2020-05-22T18:32:17.073554 | 2020-02-17T17:40:39 | 2020-02-17T17:40:39 | 186,473,122 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 411 | java | package com.microsoft.interview;
import java.util.LinkedList;
public class LetterCombinationsTest {
public static void main(String args){
String[] letters = new String[]{"", "", "ABC", "DEF", "GHI", "JKL", "MNO", "PQRS", "TUV", "WXYZ"};
int[] input = {2,3};
int len = input.length;
LinkedList<String> output = new LinkedList<String>();
for(int i=0;i<len;i++)
{
}
}
}
| [
"[email protected]"
]
| |
332bd2c95dc03a935e45e77a620d018644644dcf | 69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e | /methods/Method_38197.java | b24be6b3b0aad527e69b37e03454e8ae428bd324 | []
| no_license | P79N6A/icse_20_user_study | 5b9c42c6384502fdc9588430899f257761f1f506 | 8a3676bc96059ea2c4f6d209016f5088a5628f3c | refs/heads/master | 2020-06-24T08:25:22.606717 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,270 | java | /**
* Resolves list of all columns and properties.
*/
private void resolveColumnsAndProperties(final Class type){
PropertyDescriptor[] allProperties=ClassIntrospector.get().lookup(type).getAllPropertyDescriptors();
List<DbEntityColumnDescriptor> decList=new ArrayList<>(allProperties.length);
int idcount=0;
HashSet<String> names=new HashSet<>(allProperties.length);
for ( PropertyDescriptor propertyDescriptor : allProperties) {
DbEntityColumnDescriptor dec=DbMetaUtil.resolveColumnDescriptors(this,propertyDescriptor,isAnnotated,columnNamingStrategy);
if (dec != null) {
if (!names.add(dec.getColumnName())) {
throw new DbOomException("Duplicate column name: " + dec.getColumnName());
}
decList.add(dec);
if (dec.isId) {
idcount++;
}
}
}
if (decList.isEmpty()) {
throw new DbOomException("No column mappings in entity: " + type);
}
columnDescriptors=decList.toArray(new DbEntityColumnDescriptor[0]);
Arrays.sort(columnDescriptors);
if (idcount > 0) {
idColumnDescriptors=new DbEntityColumnDescriptor[idcount];
idcount=0;
for ( DbEntityColumnDescriptor dec : columnDescriptors) {
if (dec.isId) {
idColumnDescriptors[idcount++]=dec;
}
}
}
}
| [
"[email protected]"
]
| |
8bc0942b8e5e0410636932dcbd5976116acb0ede | 706395579d466ce70b89a0dcdc3d761fbe5b397c | /huyaElf/src/main/java/com/lyl/webElf/domain/AccountMode.java | 90500278b21daf172eda455e9138b617bd6ec30b | []
| no_license | layiliang/huyaElf | 33c3ddfec687326e7e81a7c90c70e04caa554708 | e1753fb41aea3245e2f6ae0516ef7571553f742d | refs/heads/master | 2022-07-03T04:51:27.470947 | 2020-05-25T13:45:00 | 2020-05-25T13:45:00 | 242,720,478 | 1 | 1 | null | 2022-06-17T02:55:52 | 2020-02-24T11:37:42 | Java | UTF-8 | Java | false | false | 593 | java | package com.lyl.webElf.domain;
import org.openqa.selenium.WebElement;
public class AccountMode {
private WebElement acount;//class="udb-input udb-input-account"
private WebElement pwd;
/*public WebElement getLoginMode() {
return loginMode;
}
public void setLoginMode(WebElement loginMode) {
this.loginMode = loginMode;
}*/
public WebElement getAcount() {
return acount;
}
public void setAcount(WebElement acount) {
this.acount = acount;
}
public WebElement getPwd() {
return pwd;
}
public void setPwd(WebElement pwd) {
this.pwd = pwd;
}
}
| [
"[email protected]"
]
| |
014d046aad83f70e04ffe7ae77eda0d1eefa59a4 | 70ad9e6043950bc1e686377c75b826a1c4892998 | /src/main/java/pe/bhintranet/controller/security/UserDetailsServiceImp.java | b38f63d6fc5f42653e47b6f791dd6a059b837e9f | []
| no_license | mrodriguezgm01/bhintranetweb002 | 31e7a7375bbcaf6d47aaab932121f4b7dc00f2ac | 25b1dafff3df2ce6528813d9ede4d20fba6f5073 | refs/heads/master | 2021-05-05T15:57:26.480862 | 2018-01-13T07:42:44 | 2018-01-13T07:42:44 | 117,325,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,557 | 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 pe.bhintranet.controller.security;
import java.util.ArrayList;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
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;
import org.springframework.transaction.annotation.Transactional;
import pe.bhintranet.model.dao.UsuarioDAO;
import pe.bhintranet.model.bean.Usuario;
/**
*
* @author Alumno
*/
@Service("userDetailsService")
@Transactional(readOnly = true)
public class UserDetailsServiceImp implements UserDetailsService {
@Autowired
private UsuarioDAO usuarioDAO;
@Override
public UserDetails loadUserByUsername(String string) throws UsernameNotFoundException {
System.out.println("entra 1.0");
Usuario usuario=null;
try{
usuario = usuarioDAO.selectByLoginName(string);
}catch(DataAccessException de){
System.out.println("entra 1.0.3");
de.printStackTrace();
}catch(Exception ex){
System.out.println("entra 1.0.2");
ex.printStackTrace();
}
//Usuario usuario = new Usuario(Long.valueOf("1"),string,"1234","ALBERTO");
System.out.println("entra 1.1");
if (usuario == null) {
System.out.println("entra 1.2");
throw new UsernameNotFoundException("Usuario no encontrado");
}
System.out.println("entra 1.3");
String username =usuario.getLoginname();
String password =usuario.getClave();
Collection<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
authorities.add(new SimpleGrantedAuthority(usuario.getCodrol().trim()));
//authorities.add(new SimpleGrantedAuthority("ASESOR"));
System.out.println("entra 1.4");
return new User(username, password, authorities);
}
}
| [
"moises_rodriguez@windows-server-2012-r2-1tb.c.proyecto-taxibel.internal"
]
| moises_rodriguez@windows-server-2012-r2-1tb.c.proyecto-taxibel.internal |
2d04142e9d87ffdd5a5d76e20074da0fbdb8d33f | f0e7c62ee4820ea12e75678f732a1e146d574cbc | /JavaLearning/src/main/java/com/jmlearning/randomthings/raytracer/core/Tracer.java | 19b8696c6b9756fa066ac1934236cf7b43c4dee6 | []
| no_license | jmo53439/JavaLearning | 7cbc6493281483635f3dc53c40fb03bd1b1ce556 | b13dc1af857699e35b9d753d0a9b5198e0e482dd | refs/heads/master | 2020-04-11T22:18:17.631508 | 2019-09-14T15:22:39 | 2019-09-14T15:22:39 | 162,131,819 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,809 | java | package com.jmlearning.randomthings.raytracer.core;
import com.jmlearning.randomthings.raytracer.math.Geometry;
import com.jmlearning.randomthings.raytracer.math.Vector;
import com.jmlearning.randomthings.raytracer.objects.Light;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class Tracer {
public static final double TOLERANCE = 0.000001;
private static final int MAX_RECURSION = 4;
private static final double REFLECTIVITY = 0.10;
private final ExecutorService executor = Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors());
private final List<Callable<Object>> todo = new ArrayList<>();
private final int[] pixels;
private final int width;
private final int height;
public Tracer(int[] pixels, int width, int height) {
this.pixels = pixels;
this.width = width;
this.height = height;
}
public void render(Camera camera, Scene scene) {
int xStart = width >> 1;
int yStart = height >> 1;
todo.clear();
for(int y = 0; y < height; y++) {
int yFinal = y;
todo.add(Executors.callable(() -> {
Ray ray = new Ray();
int offset = yFinal * width;
camera.transform(ray.origin.set(0.0, 0.0, 1.0)).mul(-camera.distance);
for(int wx = -xStart; wx < xStart; wx++) {
camera.transform(ray.direction.set(wx, yStart - yFinal, camera.fov)).normalize();
pixels[offset++] = traceRay(scene, ray, 0);
}
}));
}
try {
executor.invokeAll(todo);
}
catch(InterruptedException ie) {
ie.printStackTrace();
}
}
private int traceRay(Scene scene, Ray ray, int level) {
Ray hitRay = new Ray();
Geometry intersected = scene.intersect(ray, hitRay);
if(intersected != null) {
Material material = intersected.getMaterial();
Vector kd = new Vector();
Vector ks = new Vector();
Vector kr = new Vector();
for(Light light : scene.lights) {
Vector toLight = new Vector(light.position).sub(hitRay.origin);
boolean shadowed = scene.isShadowed(toLight, hitRay.origin);
if(!shadowed) {
toLight.normalize();
double intensity = toLight.dot(hitRay.direction);
if(intensity > 0.0) {
intensity *= 1.0 - REFLECTIVITY;
Color diff = material.computeDiffuse(hitRay);
kd.add(intensity * diff.red * light.color.red,
intensity * diff.green * light.color.green,
intensity * diff.blue * light.color.blue);
double specular = specularity(ray, hitRay, toLight);
if(specular > 0.0) {
specular = Math.pow(Math.min(specular, 1.0), material.computeShininess(hitRay));
Color spec = material.computeSpecular(hitRay);
ks.add(specular * spec.red * light.color.red,
specular * spec.green * light.color.green,
specular * spec.blue * light.color.blue);
}
}
}
}
if(level <= MAX_RECURSION) {
Ray result = new Ray();
result.direction.set(hitRay.direction)
.mul(-2.0 * ray.direction.dot(hitRay.direction))
.add(ray.direction);
result.origin.set(result.direction).mul(TOLERANCE).add(hitRay.origin);
Color color = new Color(traceRay(scene, result, level + 1));
kr.add(REFLECTIVITY * color.red, REFLECTIVITY * color.green, REFLECTIVITY * color.blue);
}
return shade(scene.ambient.red * material.ambient.red + kd.x + ks.x + kr.x, 0x10) |
shade(scene.ambient.green * material.ambient.green + kd.y + ks.y + kr.y, 0x08) |
shade(scene.ambient.blue * material.ambient.blue + kd.z + ks.z + kr.z, 0x00);
}
return 0x000000;
}
private static double specularity(Ray ray, Ray hitRay, Vector toLight) {
double vx = ray.origin.x - hitRay.origin.x;
double vy = ray.origin.y - hitRay.origin.y;
double vz = ray.origin.z - hitRay.origin.z;
double ol = Math.sqrt(vx * vx + vy * vy + vz * vz);
vx += toLight.x * ol;
vy += toLight.y * ol;
vz += toLight.z * ol;
double d = vx * hitRay.direction.x + vy * hitRay.direction.y + vz * hitRay.direction.z;
return d > 0.0 ? d / Math.sqrt(vx * vx + vy * vy + vz * vz) : 0.0;
}
private static int shade(double v, int shift) {
return (int)(Math.max(0.0, Math.min(v, 1.0)) * 255.0) << shift;
}
}
| [
"[email protected]"
]
| |
63d11d28847669ddbd2647660f0a638035e93988 | 6eece2b0970f17473a2351a0859b4299968f9e4c | /DirtyMobile/app/src/main/java/com/example/dirtymobile/InputValidation.java | f84a5b44aa696751bc9f6a08fb0640afaaaa7eb4 | []
| no_license | gracjanj/dirtymobile | 397e27b88a77e992a64633f1280dc48c8a59d3c1 | 9f8852f5fb9a8eb6da84e746e2e654c2188adaa6 | refs/heads/master | 2022-03-02T01:57:28.558978 | 2019-09-24T08:55:22 | 2019-09-24T08:55:22 | 199,993,736 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,810 | java | package com.example.dirtymobile;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class InputValidation extends AppCompatActivity {
EditText etName1;
Button btnName1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_input_validation);
etName1 = findViewById(R.id.etName1);
btnName1 = findViewById(R.id.btnName1);
btnName1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SQLiteDatabase sqlitedb = openOrCreateDatabase("secretdb",MODE_PRIVATE,null);
String user = etName1.getText().toString();
String sql = "SELECT * FROM Credentials WHERE username = '" + user + "'";
try {
Cursor cursor = sqlitedb.rawQuery(sql, null);
if (cursor.moveToFirst()) {
String str = cursor.getString(cursor.getColumnIndex("Password"));
Toast.makeText(InputValidation.this, str, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(InputValidation.this, "No such user", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(InputValidation.this, "SQL Error", Toast.LENGTH_SHORT).show();
}
}
});
}
}
| [
"[email protected]"
]
| |
3f058cae273b131e2286525dc4f7f519726c23bb | e676cdc2980f453a4435f41dd6b7ce01063b24a2 | /complete/src/main/java/com/hpe/event_optimizer/service/ServiceImpl.java | 5d4fb07214e05963e5b74e8d5ca825c24609f85f | []
| no_license | Naveend4981/hackathon-2018 | 572db632a6cb37534126b5b4dfa8aab78741eb45 | 8736e99258df45736e3affcae20f4063d59174f9 | refs/heads/master | 2021-01-25T00:10:29.278311 | 2018-03-05T17:08:51 | 2018-03-05T17:08:51 | 123,290,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 563 | java | package com.hpe.event_optimizer.service;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hpe.event_optimizer.dao.OptimizerDao;
import com.hpe.event_optimizer.data.Event;
@Service
public class ServiceImpl implements EventService{
@Autowired
private OptimizerDao optimizerDao;
@Override
public Set<String> getEvents() {
return optimizerDao.getEvents();
}
@Override
public boolean insertEvent(Event event){
return optimizerDao.insertEvent(event);
}
}
| [
"[email protected]"
]
| |
6852779dcf761d29e29fe6c40fbf997abb764291 | b6e0cb9ec8889888c5323021991ce5ea7ff6094c | /src/main/java/io/adagate/handlers/database/pools/GetPoolByIdOrHash.java | babe71603f63343c444ae339ab6ffab1f5273666 | []
| no_license | adagate-io/adagate-api | c3de7d195da51675b46c4aec4050394c24e314b0 | 9214bb04ca455c90cc2c7beb6795f7d8fcdb86b4 | refs/heads/main | 2023-08-28T13:13:30.485872 | 2021-11-08T15:53:57 | 2021-11-08T15:53:57 | 409,929,758 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,387 | java | package io.adagate.handlers.database.pools;
import io.vertx.core.eventbus.Message;
import io.vertx.pgclient.PgPool;
import io.vertx.sqlclient.templates.SqlTemplate;
import static io.adagate.exceptions.AdaGateModuleException.BAD_REQUEST_400_ERROR;
import static io.adagate.utils.ExceptionHandler.handleError;
import static java.lang.String.format;
import static java.util.Collections.emptyMap;
public class GetPoolByIdOrHash extends AbstractPoolsHandler {
public static final String ADDRESS = "io.adagate.pools.get";
private static final String QUERY = new StringBuilder()
.append("WITH ")
.append("latest_epoch AS (SELECT MAX(epoch_no) AS e_max FROM epoch_stake), ")
.append("max_pool_epoch AS ( ")
.append("SELECT MAX(epoch_no) AS e_max FROM epoch_stake ")
.append("JOIN pool_hash ph ")
.append("ON ph.id = pool_id ")
.append("WHERE ph.%s = '%s' ")
.append("), ")
.append("latest_pool_update AS (")
.append("SELECT ")
.append("ph.id AS pool_id, ")
.append("ph.*, ")
.append("pu.* ")
.append("FROM pool_hash ph ")
.append("JOIN pool_update pu ")
.append("ON pu.hash_id = ph.id ")
.append("WHERE ph.%s = '%s' ")
.append("ORDER BY pu.registered_tx_id DESC ")
.append("LIMIT 1 ")
.append("), ")
.append("delegator_stakes AS ( ")
.append("SELECT ")
.append("sa.id, ")
.append("sa.view AS stake_address, ")
.append("es.amount ")
.append("FROM epoch_stake es ")
.append("JOIN max_pool_epoch le ")
.append("ON es.epoch_no = le.e_max ")
.append("JOIN latest_pool_update lpu ")
.append("ON es.pool_id = lpu.pool_id ")
.append("LEFT JOIN stake_address sa ")
.append("ON sa.id = es.addr_id ")
.append("), ")
.append("reward_addr AS ( ")
.append("SELECT ")
.append("sa.id, ")
.append("sa.view AS stake_address ")
.append("FROM stake_address sa ")
.append("JOIN latest_pool_update lpu ")
.append("ON lpu.reward_addr = sa.hash_raw ")
.append("), ")
.append("owners_stake_addrs AS ( ")
.append("SELECT ")
.append("sa.id, ")
.append("sa.view AS stake_address ")
.append("FROM stake_address sa ")
.append("JOIN ( ")
.append("SELECT ")
.append("addr_id ")
.append("FROM pool_owner po ")
.append("JOIN latest_pool_update lpu ")
.append("ON lpu.hash_id = po.pool_hash_id ")
.append(") p ")
.append("ON p.addr_id = sa.id ")
.append("), ")
.append("total_active_stake AS ( ")
.append("SELECT ")
.append("SUM(es.amount) AS amount ")
.append("FROM epoch_stake es ")
.append("JOIN latest_epoch lpe ")
.append("ON lpe.e_max = es.epoch_no ")
.append("), ")
.append("pool_addresses AS ( ")
.append("SELECT * FROM owners_stake_addrs ")
.append("UNION ")
.append("SELECT * FROM reward_addr ")
.append("), ")
.append("pool_rewards AS ( ")
.append("SELECT ")
.append("SUM(r.amount) AS amount ")
.append("FROM reward r ")
.append("RIGHT JOIN pool_addresses addrs ")
.append("ON r.addr_id = addrs.id ")
.append("), ")
.append("pool_withdrawals AS ( ")
.append("SELECT ")
.append("SUM(amount) as amount ")
.append("FROM withdrawal wd ")
.append("RIGHT JOIN pool_addresses addrs ")
.append("ON wd.addr_id = addrs.id ")
.append("), ")
.append("live_pledge AS ( ")
.append("SELECT ")
.append("(SUM(txo.value) + (SELECT amount FROM pool_rewards) - (SELECT amount FROM pool_withdrawals)) AS amount ")
.append("FROM stake_address sa ")
.append("JOIN tx_out txo ")
.append("ON txo.stake_address_id = sa.id ")
.append("WHERE EXISTS (SELECT * FROM owners_stake_addrs osa WHERE sa.view = osa.stake_address) ")
.append("AND NOT EXISTS ( ")
.append("SELECT tx_out.id FROM tx_out ")
.append("INNER JOIN tx_in ")
.append("ON tx_out.tx_id = tx_in.tx_out_id AND tx_out.index = tx_in.tx_out_index ")
.append("WHERE txo.id = tx_out.id ")
.append(") ")
.append("), ")
.append("delegator_rewards AS ( ")
.append("SELECT ")
.append("SUM(r.amount) AS amount ")
.append("FROM reward r ")
.append("RIGHT JOIN delegator_stakes ds ")
.append("ON r.addr_id = ds.id ")
.append("), ")
.append("delegator_withdrawals AS ( ")
.append("SELECT ")
.append("SUM(wd.amount) AS amount ")
.append("FROM withdrawal wd ")
.append("RIGHT JOIN delegator_stakes ds ")
.append("ON wd.addr_id = ds.id ")
.append("), ")
.append("live_stake AS ( ")
.append("SELECT ")
.append("(SUM(txo.value) + (SELECT amount FROM delegator_rewards) - (SELECT amount FROM delegator_withdrawals)) AS amount ")
.append("FROM stake_address sa ")
.append("JOIN tx_out txo ")
.append("ON txo.stake_address_id = sa.id ")
.append("WHERE EXISTS (SELECT * FROM delegator_stakes ds WHERE sa.view = ds.stake_address) ")
.append("AND NOT EXISTS ( ")
.append("SELECT tx_out.id FROM tx_out ")
.append("INNER JOIN tx_in ")
.append("ON tx_out.tx_id = tx_in.tx_out_id AND tx_out.index = tx_in.tx_out_index ")
.append("WHERE txo.id = tx_out.id ")
.append(") ")
.append("), ")
.append("blocks AS ( ")
.append("SELECT COUNT(*) AS minted_amount FROM block b ")
.append("JOIN slot_leader sl ")
.append("ON b.slot_leader_id = sl.id ")
.append("JOIN latest_pool_update lpu ")
.append("ON lpu.hash_id = sl.pool_hash_id ")
.append("), ")
.append("registrations AS ( ")
.append("SELECT ")
.append("ARRAY( ")
.append("SELECT ")
.append("encode(tx.hash, 'hex') ")
.append("FROM pool_update pu ")
.append("JOIN tx ")
.append("ON tx.id = pu.registered_tx_id ")
.append("JOIN latest_pool_update lpu ")
.append("ON lpu.hash_id = pu.hash_id ")
.append(") ")
.append("), ")
.append("retiring AS ( ")
.append("SELECT ")
.append("ARRAY( ")
.append("SELECT ")
.append("encode(tx.hash, 'hex') ")
.append("FROM pool_retire pr ")
.append("JOIN tx ")
.append("ON tx.id = pr.announced_tx_id ")
.append("JOIN latest_pool_update lpu ")
.append("ON lpu.hash_id = pr.hash_id ")
.append(") ")
.append(") ")
// Start of main query
.append("SELECT ")
.append("ph.view as pool_id, ")
.append("encode(hash_raw, 'hex') as \"hex\", ")
.append("(SELECT encode(vrf_key_hash, 'hex') FROM latest_pool_update) AS vrf_key, ")
.append("(SELECT minted_amount FROM blocks) AS blocks_minted, ")
.append("(SELECT COUNT(*) FROM delegator_stakes) AS live_delegators, ")
.append("(SELECT amount FROM live_stake)::text AS live_stake, ")
.append("(SELECT SUM(amount)::text FROM delegator_stakes) AS active_stake, ")
.append("ROUND((SELECT SUM(amount) FROM delegator_stakes) / (SELECT amount FROM total_active_stake), 20) AS active_size, ")
.append("(SELECT pledge::text FROM latest_pool_update) AS declared_pledge, ")
.append("(SELECT amount::text FROM live_pledge) AS live_pledge, ")
.append("(SELECT margin FROM latest_pool_update) AS margin_cost, ")
.append("(SELECT fixed_cost::text FROM latest_pool_update) AS fixed_cost, ")
.append("(SELECT stake_address FROM reward_addr) AS reward_account, ")
.append("(SELECT ARRAY(SELECT DISTINCT(\"stake_address\") FROM owners_stake_addrs) AS owners), ")
.append("(SELECT * FROM registrations) AS registrations, ")
.append("(SELECT * FROM retiring) AS retirement ")
.append("FROM pool_hash ph ")
.append("WHERE ph.%s = '%s'")
.toString();
public GetPoolByIdOrHash(PgPool pool) {
super(pool);
}
@Override
protected String query() {
if (column.equals(POOL_VIEW_COLUMN)) {
return format(QUERY, column, id, column, id, column, id);
}
final String id = format("\\x%s", this.id);
return format(QUERY, column, id, column, id, column, id);
}
@Override
public void handle(Message<Object> message) {
if ( ! (message.body() instanceof String)) {
message.fail(BAD_REQUEST_400_ERROR.getStatusCode(), BAD_REQUEST_400_ERROR.getStatusMessage());
return;
}
initProperties((String) message.body());
SqlTemplate
.forQuery(client, query())
.execute(emptyMap())
.compose(this::mapToFirstJsonResult)
.onSuccess(message::reply)
.onFailure(err -> handleError(err, message));
}
}
| [
"[email protected]"
]
| |
122380e93c96131bcb9ff62f3065bb83c1553dac | e89a4604b3e8ea307a16c74bc93dfdd73b3e3454 | /src/com/euller/rest/controller/UserController.java | b6ddd62e2c719b978abf2634e98dfd2e8a8e99f4 | []
| no_license | EullerNobrega/JavaEE---Restful-Web-Service | dc46e6c32f7c838bc8071d53f19a2d02c1436de9 | f4d52346e239faf7cbab151dec0e6fd5cee1b0ee | refs/heads/master | 2022-12-08T23:12:09.452898 | 2020-08-24T04:14:51 | 2020-08-24T04:14:51 | 289,401,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package com.euller.rest.controller;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import org.json.JSONObject;
@Path("/users")
public class UserController {
@GET
@Produces("aplication/json")
public Response getUsers() {
JSONObject jsonObject = new JSONObject();
String result = "('application/json') Output: \n\n" + jsonObject;
return Response.status(200).entity(result).build();
}
}
| [
"[email protected]"
]
| |
de17cedf91e7e5e48b350de7d2895dd66cc0ba96 | 036756f4b0f79c0afdb136faf2c6b6eff9e428ad | /Refactoring/src/After/human/StudentDatabase.java | 26a6ce7a0e770b764d1f0063d4b0cb038f9088a1 | []
| no_license | MateuszCha/test-code-file-for-company | 777aa8fb90befa7064319da0dcca9b0467389ad9 | d3dd3261d2a7835d98db718396806a5efe39b817 | refs/heads/master | 2021-07-10T03:57:03.860015 | 2020-05-11T18:03:05 | 2020-05-11T18:03:05 | 214,900,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,087 | java | package After.human;
import java.util.ArrayList;
import java.util.List;
public class StudentDatabase {
public static List<Student> students = new ArrayList<>();
public static void addStudentInfo(Student student) {
students.add(student);
printStudentInfo(student);
}
public static void printStudentInfo(Student student) {
System.out.println("Name: " + student.getName() + " Age: " + student.getAge());
}
public static void removeStudent(int index) {
try {
students.remove(index);
}catch (IndexOutOfBoundsException err){}
}
public static void findJohnOrAlex() {
for (int i = 0; i < students.size(); i++) {
if (students.get(i).getName().equals("John")) {
System.out.println("John is in the student database.");
break;
}
if (students.get(i).getName().equals("Alex")) {
System.out.println("Alex is in the student database.");
break;
}
}
}
} | [
"[email protected]"
]
| |
9305559df50ee6e9a4e6c1dbe226dc4dce1a869b | 159549c971aa5f97dea25c9e78757b38583a5659 | /src/main/java/action/visitor/ConcreteVisitor.java | 880f2189560e56674472c9c446f4bd254cb08928 | []
| no_license | yangzhenwei-java/designPatterns | 0fb855571a6e3cfcff869d464ff5f89214d62f99 | 726e3fb464e735bf4ac6c6f17a1096af0b1dc61b | refs/heads/master | 2021-01-10T01:22:21.423343 | 2016-04-02T15:30:14 | 2016-04-02T15:30:14 | 55,301,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package action.visitor;
import java.util.Collection;
import java.util.Iterator;
public class ConcreteVisitor implements IVisitor
{
public void visitCollection(Collection collection)
{
Iterator iterator = collection.iterator();
while (iterator.hasNext())
{
Object o = iterator.next();
if (o instanceof IVisitable)
{
((IVisitable) o).accept(this);
}
}
}
public void visitFloat(FloatElement floatE)
{
System.out.println(floatE.getFe());
}
public void visitString(StringElement stringE)
{
System.out.println(stringE.getSe());
}
} | [
"[email protected]"
]
| |
4443b1b494efe7644c622ad55248bd43597690b9 | d901cec87792969e4e4f707512814d2ebb0990ce | /Java1/src/conditions/Example10.java | b078b8e40ac077cb25ee3fe1545db4da5392dc05 | []
| no_license | Hariteja25/Work-Space-2 | c6afb51b1515649128d64ffae8daf175a17e78b2 | db020a3eed4860ae79b6af32a9c6d38db34d7ee3 | refs/heads/master | 2023-03-29T04:44:02.034678 | 2021-04-03T13:49:42 | 2021-04-03T13:49:42 | 354,303,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,039 | java | package conditions;
import java.util.Scanner;
public class Example10 {
/**
take id (int), age(int) , userType(str) as input.
if id & age & userType are valid print valid data
if any one of the data is invalid print invalid data
*/
public static void main(String[] args) {
// take id (int), age(int) , userType(str) as input.
Scanner sc = new Scanner(System.in);// sc is point of contact for console
System.out.println("enter id");
int id = sc.nextInt();
System.out.println("enter age");
int age = sc.nextInt();
System.out.println(" enter usertype");
String userType = sc.next();
// if statement writing multiple conditions using AND [ && ]
// if block is executed if ALL THE conditions are satisfied
if( id>0 && age>18 && userType.equals("admin")) {
System.out.println("valid data");
}else {
System.out.println("invalid data");
}
if(id<0 || age<18 || !userType.equals("admin")) {
System.out.println("invalid data");
}else {
System.out.println("valid data");
}
}
} | [
"[email protected]"
]
| |
c564de7b6cc7bed3caf09431c4a900588db9673d | 1498096b59fd5696249b0214a39ad5f3d30fe363 | /server/src/main/java/com/proitc/wss/configuration/WebServiceConfiguration.java | 94a80d46e3d6cebfa07bc3a91b8422ddc66559c8 | []
| no_license | JuanMorenoDeveloper/ws-security-spring-boot-cxf | 8aea074bf5e7a187ea97ea05b61086560fd99607 | 143dcca49e7b65229f638f3c950364494b0648af | refs/heads/master | 2023-04-13T05:13:53.319956 | 2023-04-11T02:09:33 | 2023-04-11T02:09:33 | 83,494,726 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,447 | java | package com.proitc.wss.configuration;
import static org.apache.cxf.Bus.DEFAULT_BUS_ID;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import javax.security.auth.callback.CallbackHandler;
import javax.xml.ws.Endpoint;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.feature.LoggingFeature;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
import org.apache.wss4j.common.ConfigurationConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import com.proitc.wss.endpoint.DemoServiceEndpoint;
import com.proitc.wss.sei.DemoService;
import com.proitc.wss.support.ClientKeystorePasswordCallback;
@Configuration
@PropertySource("application-${spring.profiles.active}.properties")
public class WebServiceConfiguration {
private static final Logger log = LoggerFactory.getLogger(WebServiceConfiguration.class.getName());
@Value("${service.contextPath}")
private String contextPath;
@Value("${service.endpointUrl}")
private String endpointUrl;
@Value("${service.wsdlLocation}")
private String wsdlLocation;
/* Datos keystore */
@Value("${keystore.alias}")
private String keystoreAlias;
@Value("${keystore.password}")
private String keystorePassword;
@Value("${keystore.file}")
private String keystoreFile;
@Value("${keystore.type}")
private String keystoreType;
/**
* Contexto del servicio
*/
@Bean
public ServletRegistrationBean dispatcherServlet() {
return new ServletRegistrationBean(new CXFServlet(), contextPath);
}
/**
* Bus de integración CXF/Spring
*/
@Bean(name = DEFAULT_BUS_ID)
public SpringBus springBus() {
SpringBus springBus = new SpringBus();
springBus.setFeatures(Arrays.asList(new LoggingFeature()));
return springBus;
}
/**
* Implementación del servicio
*/
public DemoService demoServiceEndpoint() {
return new DemoServiceEndpoint();
}
/**
* Ubicación del wsdl y el endpoint
*/
@Bean
public Endpoint endpoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), demoServiceEndpoint());
endpoint.publish(endpointUrl);
log.info("Publicando servicio en " + endpointUrl);
endpoint.setWsdlLocation(wsdlLocation);
endpoint.getOutInterceptors().add(wss4jOut());
//endpoint.getInInterceptors().add(wss4jIn());
return endpoint;
}
public WSS4JOutInterceptor wss4jOut() {
Map<String, Object> properties = new HashMap<>();
properties.put(ConfigurationConstants.ACTION,
ConfigurationConstants.SIGNATURE + " " + ConfigurationConstants.TIMESTAMP);
properties.put("signingProperties", wss4jOutProperties());
properties.put(ConfigurationConstants.SIG_PROP_REF_ID, "signingProperties");
properties.put(ConfigurationConstants.SIG_KEY_ID, "DirectReference");
properties.put(ConfigurationConstants.USER, keystoreAlias);
properties.put(ConfigurationConstants.SIGNATURE_PARTS,
"{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body");
properties.put(ConfigurationConstants.PW_CALLBACK_REF, clientKeystorePasswordCallback());
properties.put(ConfigurationConstants.SIG_ALGO, "http://www.w3.org/2000/09/xmldsig#rsa-sha1");
WSS4JOutInterceptor interceptor = new WSS4JOutInterceptor(properties);
return interceptor;
}
public Properties wss4jOutProperties() {
Properties properties = new Properties();
properties.put("org.apache.wss4j.crypto.merlin.provider", "org.apache.wss4j.common.crypto.Merlin");
properties.put("org.apache.wss4j.crypto.merlin.keystore.type", keystoreType);
properties.put("org.apache.wss4j.crypto.merlin.keystore.password", keystorePassword);
properties.put("org.apache.wss4j.crypto.merlin.keystore.alias", keystoreAlias);
properties.put("org.apache.wss4j.crypto.merlin.keystore.file", keystoreFile);
return properties;
}
public CallbackHandler clientKeystorePasswordCallback() {
Map<String, String> passwords = new HashMap<>();
passwords.put(keystoreAlias, keystorePassword);
return new ClientKeystorePasswordCallback(passwords);
}
}
| [
"[email protected]"
]
| |
4920fe4c6f706c1f20f086f7d9d47a5c83ff3cbb | d502ba2480aea84241f3bd98578a887849df9df8 | /HaykanushTorchyan/Creational/Factory Method/src/main/java/com/synisys/design_patterns/singleton/domain/Motor.java | 4aade98e54ceedb91acfec383815fa25fe49baec | []
| no_license | synergytrainings/design-patterns | 821ba0e4c6c0c09ef892312256f6cdcf7e0736f4 | f0fd39de32c3f9f7f6b13377904a0c29589720bc | refs/heads/master | 2020-12-25T19:26:01.181499 | 2015-04-17T05:15:03 | 2015-04-17T05:15:17 | 25,835,095 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | package com.synisys.design_patterns.domain;
import java.math.BigDecimal;
/**
* Created by haykanush.torchyan on 11/7/2014.
*/
public abstract class Motor {
protected String type;
public abstract void run();
}
| [
"[email protected]"
]
| |
ccfa0f0be3ab534382bbec59ddd2cfb1b75443b7 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XWIKI-12798-19-2-FEMO-WeightedSum:TestLen:CallDiversity/org/xwiki/velocity/internal/DefaultVelocityEngine_ESTest_scaffolding.java | 3aeb35658c2cd9508de9efb8028bd4c6c570e516 | []
| no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 453 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Sat Apr 04 18:25:39 UTC 2020
*/
package org.xwiki.velocity.internal;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class DefaultVelocityEngine_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"[email protected]"
]
| |
4c5d1bc3aa28ed5ada4a7691ffa27eb3de9382bb | c39e1f2fa595478fbbb9f4a5ee44ce278d145caa | /Copy of Project1/src/edu/ncsu/csc216/flight/passengers/BusinessClassReservation.java | e995ce9cd8df3863e4607b76b647c6f8a25b4f09 | []
| no_license | asnorthrup/JavaProj1 | 50be68f0bf43dc4d1693783da06e7a5768672975 | 502b6d127e98157eb83878bf65cfcc6395d5ab92 | refs/heads/master | 2020-12-24T19:46:37.079206 | 2016-05-09T00:03:42 | 2016-05-09T00:03:42 | 58,332,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,175 | java | /**
*
*/
package edu.ncsu.csc216.flight.passengers;
import edu.ncsu.csc216.flight.plane.Flight;
/**
* Business class reservation is a child of the flight reservation class.
* This class represents a BusinessClassReservation.
* @author Andrew Northrup
*
*/
public class BusinessClassReservation extends FlightReservation {
/**Instance variable for the flight the reservation is for*/
private Flight f;
/**Instance variable for the seat preference of the reservation*/
private boolean seatpreference;
/**Instance variable for the name on the reservation*/
private String passengername;
//since it extends (is a child of), then this class has access to all public members of FlightReservation
/**
* Constructor for an first class reservation
* @param nameofpassenger is the name of the passenger
* @param flight is the flight this reservation is for
* @param seatrequested is the preference in seat (true for window, false for aisle)
*/
public BusinessClassReservation(String nameofpassenger, Flight flight, boolean seatrequested) {
//call to constructor in super class
super(nameofpassenger, flight, seatrequested);
this.f = flight;
this.seatpreference = seatrequested;
this.passengername = nameofpassenger.trim();
//findSeat();
}
/**
* Assign a seat to mySeat according to which child class this is.
*/
@Override
public void findSeat() {
String seatfound = mySeat;
if(seatfound == null){
seatfound = f.reserveBusinessSeat(seatpreference);
}
if(seatfound == null){
seatfound = f.reserveEconomySeat(seatpreference);
}
mySeat = seatfound;
}
/**
* The string printed on the reservation area
* @return string for what shows up on reservation screen
*/
@Override
public String stringForPrint() {
String paddedSeat = mySeat;
if(mySeat != null){
//if(mySeat.length()<4){
int seatDelta = 4 - mySeat.length();
for (int i = 0; i < seatDelta; i++){
paddedSeat = " " + paddedSeat;
}
String sr = "Business " + paddedSeat + " " + passengername;
return sr;
//}
}
paddedSeat = "none";
String s = "Business " + paddedSeat + " " + passengername;
return s;
}
}
| [
"[email protected]"
]
| |
944deca09df040f76b0a6bb911bbf3d2f41718d1 | 1e8e1d1fc1221610a71e517a9e2d06ec552df5c4 | /src/main/java/com/virtusa/codetext/numbertowordconvertor/constants/DigitConstant.java | 2b5ba7b9cf767eb79908e3c77e21adc51899ec8c | []
| no_license | springbootMicroservices2/virtusa-code-test | fab9db7d8cebdb94f29b7d77ce4c65cd31c48c45 | cbccf172bf675162cd442ac4116ff39bae425d53 | refs/heads/master | 2020-12-20T15:22:51.526453 | 2019-12-03T15:36:12 | 2019-12-03T15:36:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 447 | java | package com.virtusa.codetext.numbertowordconvertor.constants;
public class DigitConstant {
public static String[] UNITS = { "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten",
"Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen" };
public static String[] TENS = { "", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty",
"Ninety" };
}
| [
"[email protected]"
]
| |
79ff6539e7586c4675d10ced486b2a5c1732e7a4 | 9f1f102c8f456625be32acf975bcff3e3b8d953f | /CalculatorSoap/src/com/demo/ws/Main.java | 3763d4f08a8384647b79c323aca3bbbc2ecff488 | []
| no_license | sbtalk71/dbs-batch7 | 3bad24ef188d33d0c515e7171374810ddcd67f30 | dad18eda7e78d1f20725c9ee05624c9161835cc7 | refs/heads/master | 2022-12-06T22:40:05.681726 | 2019-10-18T07:11:16 | 2019-10-18T07:11:16 | 215,200,847 | 0 | 0 | null | 2022-11-24T07:13:02 | 2019-10-15T03:43:37 | Java | UTF-8 | Java | false | false | 202 | java | package com.demo.ws;
import javax.xml.ws.Endpoint;
public class Main {
public static void main(String[] args) {
Endpoint.publish("http://localhost:8181/cal", new Calculator());
}
}
| [
"[email protected]"
]
| |
e6f80e191360a962ae454a04cfe4cf2b6465c799 | 005bc0322864b962fe79a8a5eb8d492093d2364b | /src/test/java/DijkstraShortestPathsTest.java | 61c55e7d8b3704e8bf8079d49e4b229486a9ae6f | []
| no_license | NotNaturalSelection/softwareTesting1 | fe54fc6084fe5bb363e3feb898d41b496832b779 | 5a66c71c8cfa574a78c4cbc790ad175b85d95a0a | refs/heads/master | 2023-03-22T09:23:43.764365 | 2021-03-16T18:11:27 | 2021-03-16T18:11:27 | 343,914,485 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,514 | java | import java.util.LinkedHashSet;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import dijkstraAlgorithm.DijkstraShortestPaths;
public class DijkstraShortestPathsTest {
private static final Double inf = Double.POSITIVE_INFINITY;
@Test
public void testCommonCase() {
int from = 0;
LinkedHashSet<Integer> expectedOrder = new LinkedHashSet<>();
int[] intOrder = new int[]{0, 1, 4, 2, 3};
for (int i : intOrder) {
expectedOrder.add(i);
}
Double[][] paths = new Double[][]{{0d, 10d, 30d, 50d, 10d},
{10d, 0d, inf, 40d, inf},
{30d, inf, 0d, 20d, 10d},
{50d, 40d, 20d, 0d, 30d},
{10d, inf, 10d, 30d, 0d}};
Double[] expected = new Double[]{0d, 10d, 20d, 40d, 10d};
DijkstraShortestPaths sp = new DijkstraShortestPaths(paths, from);
Assertions.assertArrayEquals(expected, sp.getShortestPaths());
Assertions.assertArrayEquals(expectedOrder.toArray(), sp.getVisitOrder().toArray());
assert from == sp.getFromValue();
}
@Test
public void test2Nodes() {
Double[][] paths = new Double[][]{{0d, 10d}, {10d, 0d}};
Double[] expected = new Double[]{0d, 10d};
DijkstraShortestPaths sp = new DijkstraShortestPaths(paths, 0);
Assertions.assertArrayEquals(expected, sp.getShortestPaths());
DijkstraShortestPaths sp1 = new DijkstraShortestPaths(paths, 1);
Double[] expected1 = new Double[]{10d, 0d};
Assertions.assertArrayEquals(expected1, sp1.getShortestPaths());
}
@Test
public void test2NodesWithZeroPaths() {
Double[][] paths = new Double[][]{{0d, 0d}, {0d, 0d}};
Double[] expected = new Double[]{0d, 0d};
DijkstraShortestPaths sp = new DijkstraShortestPaths(paths, 0);
Assertions.assertArrayEquals(expected, sp.getShortestPaths());
DijkstraShortestPaths sp1 = new DijkstraShortestPaths(paths, 1);
Double[] expected1 = new Double[]{0d, 0d};
Assertions.assertArrayEquals(expected1, sp1.getShortestPaths());
}
@Test
public void test2NodesAreEqual() {
Double[][] paths = new Double[][]{{0d, 10d}, {10d, 0d}};
Double[] expected = new Double[]{0d, 10d};
DijkstraShortestPaths sp = new DijkstraShortestPaths(paths, 0);
Assertions.assertArrayEquals(expected, sp.getShortestPaths());
Double[] expected1 = new Double[]{10d, 0d};
DijkstraShortestPaths sp1 = new DijkstraShortestPaths(paths, 1);
Assertions.assertArrayEquals(expected1, sp1.getShortestPaths());
}
@Test
public void testZeroLength() {
Double[][] paths = new Double[0][0];
Assertions.assertThrows(IllegalArgumentException.class, () -> new DijkstraShortestPaths(paths, 0));
}
@Test
public void testNotSymmetricInputArray() {
Double[][] paths = new Double[][]{{0d, 10d, 30d, -50d, -10d},
{inf, 0d, inf, inf, inf},
{inf, inf, 0d, inf, 10d},
{inf, -40d, -20d, 0d, inf},
{10d, inf, 10d, 30d, 0d}};
Assertions.assertThrows(IllegalArgumentException.class, () -> new DijkstraShortestPaths(paths, 0));
}
@Test
public void testNegativePaths() {
Double[][] paths = new Double[][]{{0d, 10d, 30d, -50d, -10d},
{10d, 0d, inf, inf, inf},
{30d, inf, 0d, -20d, 10d},
{-50d, inf, -20d, 0d, 30d},
{-10d, inf, 10d, 30d, 0d}};
Assertions.assertThrows(IllegalArgumentException.class, () -> new DijkstraShortestPaths(paths, 0));
}
@Test
public void testDifferentArraysLength() {
Double[][] paths = new Double[][]{{0d, 10d, 30d, 50d, 10d}, {inf, 0d, inf}, {inf}, {}, {10d, inf, 10d, 30d, 0d, 0d, 182d, 51d}};
Assertions.assertThrows(IllegalArgumentException.class, () -> new DijkstraShortestPaths(paths, 0));
}
@Test
public void testNegativeFromValue() {
Double[][] paths = new Double[][]{};
Assertions.assertThrows(IllegalArgumentException.class, () -> new DijkstraShortestPaths(paths, -3));
}
}
| [
"[email protected]"
]
| |
520b44c86b2d56c5e474ecc22e7410df0ee34a46 | a7d47d192cb51e26d455d54b428b40026ca18ed9 | /java/third/JDBC.java | f2fafa5a2ac441827fc88000b583e668e4cd8670 | []
| no_license | poorvikgamb/ibm-fsd-000glr | 09445b7a7281efcd067c4f0fede9c892605b04d5 | 27e5d27573f62d95c37a37260c6adf7075139639 | refs/heads/master | 2023-01-12T00:00:35.826559 | 2019-09-23T03:53:51 | 2019-09-23T03:53:51 | 195,184,944 | 0 | 0 | null | 2022-12-30T18:30:26 | 2019-07-04T06:49:03 | JavaScript | UTF-8 | Java | false | false | 1,146 | java | package third;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
import java.util.Scanner;
public class JDBC {
private static Properties properties=null;
private static Scanner scanner=new Scanner(System.in);
static {
properties = new Properties();
properties.put("JDBC_URL", "jdbc:mysql://localhost:3306/hello");
properties.put("USER", "root");
properties.put("PASSWORD", "1310");
}
public JDBC(){
super();
}
public static void main(String [ ] args)throws ClassNotFoundException, SQLException
{
Database factory=Database.createConncection();
Connection connection=factory.getConnection();
PreparedStatement pst=connection.prepareStatement("insert into course values(?,?)");
System.out.print("ID: ");
int id=scanner.nextInt();
System.out.print("NAME: ");
String name=scanner.next();
System.out.print("AMOUNT: ");
int amount=scanner.nextInt();
pst.setInt(1, id);
pst.setString(2, name);
System.out.println("row(s) updated");
}
}
| [
"[email protected]"
]
| |
b4ef9a1364fee444ac4e8bdf830047819c5bd68d | 3b384419c11447fc7c1157f869157ef35cd9c76a | /creditsupport/src/main/java/com/yodata/creditsupport/orm/entity/his/SpecialInfoHisEntity.java | e46b5abafc2d921f35f2bb456392e3db4ed342b4 | []
| no_license | wjianbin/TBCredit | d6378881f8d50cade5a1d79f1257cb085299627d | fa9f1c674c1d68511147fa44286762be3c06372e | refs/heads/master | 2021-01-07T21:48:33.220303 | 2016-11-07T03:09:32 | 2016-11-07T03:09:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,993 | java | package com.yodata.creditsupport.orm.entity.his;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
* 特殊事项(法院对企业、法人、行政处罚) -- 历史
*/
@Entity
@Table(name ="ods_special_info_his", catalog="credit_db")
public class SpecialInfoHisEntity {
private Integer id; //自增主键
private String regId; //企业ID
private String fileNo; //文件编号
private Date createTime; //生成时间
private String name; //被执行人姓名(特殊事项)
private String object; //执行标的(特殊事项)
private String court; //执行法院(特殊事项)
private String status; //案件状态(特殊事项) -- 1未执行完毕/2执行完毕
private String num; //案号(特殊事项)
private Date caseDate; //立案时间(特殊事项)
private Date getinfoDate; //信息获取日期(特殊事项)
private String type; //企业负责人/企业/行政管理 -- 1/2/3
private String statuName; //转换后的案件状态名称
private String caseNo; //案号
private String sex;
private Integer age;
private String cardNumber; //省份证号
private String indentityDepature; //省份证始发地
private String head; //法定代表人
private Date filingDate; //立案时间
private String executeTarget; //执行标的
private String province; //省份
private Integer foucsNum; //关注次数
private String caseStatus; //案件状态
private String ageStr;
private String foucsNumStr;
@Transient
public String getFoucsNumStr() {
return foucsNumStr;
}
public void setFoucsNumStr(String foucsNumStr) {
this.foucsNumStr = foucsNumStr;
}
@Transient
public String getAgeStr() {
return ageStr;
}
public void setAgeStr(String ageStr) {
this.ageStr = ageStr;
}
public SpecialInfoHisEntity() {
}
public SpecialInfoHisEntity(String fileNo, Date createTime) {
this.fileNo = fileNo;
this.createTime = createTime;
}
@Column(name="IDENTITY_DEPATURE")
public String getIndentityDepature() {
return indentityDepature;
}
public void setIndentityDepature(String indentityDepature) {
this.indentityDepature = indentityDepature;
}
@Column(name="CASE_NO")
public String getCaseNo() {
return caseNo;
}
public void setCaseNo(String caseNo) {
this.caseNo = caseNo;
}
@Column(name="SEX")
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
@Column(name="AGE")
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
@Column(name="CARD_NUMBER")
public String getCardNumber() {
return cardNumber;
}
public void setCardNumber(String cardNumber) {
this.cardNumber = cardNumber;
}
@Column(name="HEAD")
public String getHead() {
return head;
}
public void setHead(String head) {
this.head = head;
}
@Column(name="FILING_DATE")
public Date getFilingDate() {
return filingDate;
}
public void setFilingDate(Date filingDate) {
this.filingDate = filingDate;
}
@Column(name="EXECUTE_TARGET")
public String getExecuteTarget() {
return executeTarget;
}
public void setExecuteTarget(String executeTarget) {
this.executeTarget = executeTarget;
}
@Column(name="PROVINCE")
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
@Column(name="FOCUS_NUMBER")
public Integer getFoucsNum() {
return foucsNum;
}
public void setFoucsNum(Integer foucsNum) {
this.foucsNum = foucsNum;
}
@Column(name="CASE_STATE")
public String getCaseStatus() {
return caseStatus;
}
public void setCaseStatus(String caseStatus) {
this.caseStatus = caseStatus;
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="ID", nullable = false)
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name="reg_id")
public String getRegId() {
return regId;
}
public void setRegId(String regId) {
this.regId = regId;
}
@Column(name="FILE_NO")
public String getFileNo() {
return fileNo;
}
public void setFileNo(String fileNo) {
this.fileNo = fileNo;
}
@Column(name="CREATE_TIME")
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Column(name="NAME", length=50)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Column(name="OBJECT", length=300)
public String getObject() {
return object;
}
public void setObject(String object) {
this.object = object;
}
@Column(name="COURT", length=30)
public String getCourt() {
return court;
}
public void setCourt(String court) {
this.court = court;
}
@Column(name="STATUS")
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
@Column(name="NUM", length=100)
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
@Column(name="CASE_DATE")
public Date getCaseDate() {
return caseDate;
}
public void setCaseDate(Date caseDate) {
this.caseDate = caseDate;
}
@Column(name="GETINFO_DATE")
public Date getGetinfoDate() {
return getinfoDate;
}
public void setGetinfoDate(Date getinfoDate) {
this.getinfoDate = getinfoDate;
}
@Column(name="TYPE")
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Transient
public String getStatuName() {
return statuName;
}
public void setStatuName(String statuName) {
this.statuName = statuName;
}
}
| [
"[email protected]"
]
| |
cfc0796726c1b672134384d9cc85968ec34364b5 | 455b5855acb4e55488b04b6e1360dfaa8f8305ed | /website/src/main/java/com/neighborhood/website/beans/NeighborGroupBean.java | 0583b9b836a15e214c83e559836d6ac21dd5db56 | [
"MIT"
]
| permissive | rvallet/ocp12-neighborhood-app | a639be3ff796ec819d17d7f0fba06fa86dd8e0fd | 496ad8f3ecf469faac97563b7f062d19ad257bbf | refs/heads/main | 2023-06-24T13:33:25.306221 | 2021-07-19T07:43:33 | 2021-07-19T07:43:33 | 364,518,498 | 1 | 0 | MIT | 2021-07-19T07:43:34 | 2021-05-05T09:03:32 | HTML | UTF-8 | Java | false | false | 643 | java | package com.neighborhood.website.beans;
import java.util.List;
public class NeighborGroupBean {
private Long id;
private String name;
private List<UserBean> neighbors;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<UserBean> getNeighbors() {
return neighbors;
}
public void setNeighbors(List<UserBean> neighbors) {
this.neighbors = neighbors;
}
}
| [
"[email protected]"
]
| |
46d4b7d10d9a95464837e23eb8bb041e8b5bd306 | 1dc7dabe2256080adb8db0852ecfaf86c22f80e8 | /.svn/pristine/46/46d4b7d10d9a95464837e23eb8bb041e8b5bd306.svn-base | c449a10003b95d36de7e8090299d808bdbf9d3aa | []
| no_license | taco-bohl/BrickBreaker | d688b1bd42ff84e509c15ab141e052b75f33fc51 | 8c6ab81013fad05789f0fe44623a31b744cb3518 | refs/heads/master | 2021-01-17T22:23:06.154107 | 2016-06-23T00:50:46 | 2016-06-23T00:50:46 | 61,761,451 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,684 | package Controls;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
/**
*
* @author Alex Radermacher
*/
public class KeyboardController implements KeyListener
{
private boolean[] keyStatus = new boolean[256];
@Override
public void keyPressed(KeyEvent e)
{
keyStatus[e.getKeyCode()] = true;
}
@Override
public void keyReleased(KeyEvent e)
{
keyStatus[e.getKeyCode()] = false;
}
@Override
public void keyTyped(KeyEvent e)
{
// do nothing
}
/**
* A method that can be used to determine if a key is being pressed down at
* the current time.
* @param keyCode an int value representing the key to check. You can either
* use the corresponding numeric value or use static constants of the KeyEvent
* class (e.g. KeyEvent.VK_LEFT which represents the left arrow key.) as
* arguments.
* @return Whether or not the key corresponding to the particular keyCode is
* currently being pressed down.
*/
public boolean getKeyStatus(int keyCode)
{
return keyStatus[keyCode];
}
/**
* A method that can be used to clear the current key press status of all keys.
* This is occasionally necessary if some other component or part of an application
* is intercepting keyboard input, which causes this listener to not receive
* keyReleased events which makes it appear as though a key is still being
* held down when it is not.
*/
public void clearKeyStatus()
{
keyStatus = new boolean[256];
}
}
| [
"[email protected]"
]
| ||
ded9f6e816641d50715aebee8801d9f272a101d0 | 1e4d8a7e6be2551d07b4f1e9daa389038358ab52 | /src/main/java/my/demo/demojwtoauth2/dto/TokenDto.java | a5821c2475ee90833c55ad7037f912184c9791aa | []
| no_license | S1000f/demo-jwt-oauth2 | 622b89dc26b7337371416d26ef7076f291cf3af4 | f9e471e0f1389f2ffc2de307ec63770a60a3f90f | refs/heads/master | 2023-07-13T00:16:53.261787 | 2021-08-19T14:11:12 | 2021-08-19T14:11:12 | 349,727,446 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 253 | java | package my.demo.demojwtoauth2.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TokenDto {
private String token;
}
| [
"[email protected]"
]
| |
7c3753cd8af6c5e36fefdf74d3d5122e348369d8 | b8ff1cc07e934863672903589993a43def84011c | /workspace/hackerRank/src/StarWarInterfacePractice/StarWarInterfacePractice.java | 271d91d654c38feb0ec1bf4b2d6f214347ead06d | []
| no_license | jennyvu/test_projects | 67d859fad8df3f43f677f4c07c74a8f81e573a87 | 1c757a29e9a0b4dc0f0e327539f5fed40d4fdcf8 | refs/heads/master | 2021-01-17T09:45:56.424424 | 2017-05-03T16:33:04 | 2017-05-03T16:33:04 | 83,992,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 788 | java | package StarWarInterfacePractice;
import java.util.Random;
public class StarWarInterfacePractice {
public static Character summonCharacter(){
Random rand = new Random();
if(Math.abs(rand.nextInt()) % 2 == 1){
return new Enemy();
}else{
return new Hero();
}
}
public static void main(String[] args) {
Enemy darkVader = new Enemy();
Hero ObiWanKenobi = new Hero();
darkVader.attack();
ObiWanKenobi.attack();
darkVader.heal();
ObiWanKenobi.heal();
System.out.println("Enemy weapon: " + darkVader.getWeapon());
System.out.println("Hero weapon: " + ObiWanKenobi.getWeapon());
ObiWanKenobi.changeWeapon("The Force");
System.out.println("Hero weapon: " + ObiWanKenobi.getWeapon());
Character spy = summonCharacter();
spy.attack();
spy.heal();
}
}
| [
"[email protected]"
]
| |
89a07694d68e72b6f39681dca3594aa57a5587da | f5222f36f82325ef657d4bf65d4aea41177764e7 | /src/cm/StudentRate.java | aca2493f678c390f5902a09f725587a6de670012 | []
| no_license | OAbouHajar/verification_Project | 86852937f81d0b4ab2bb12b8071dea03fb0f2602 | 517d6ea6e2329f8c7a7b255ede1feb61c8bac600 | refs/heads/master | 2021-01-14T23:01:41.659193 | 2020-03-12T12:47:04 | 2020-03-12T12:47:04 | 242,788,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package cm;
import java.math.BigDecimal;
class StudentRate implements IReductionRates {
@Override
public BigDecimal reduction(BigDecimal cost) {
BigDecimal studentNotReducedAmount = new BigDecimal("5.50");
BigDecimal studentReduction = new BigDecimal("0.25");
if (cost.compareTo(studentNotReducedAmount) <= 0) return cost;
else return ((cost.subtract(studentNotReducedAmount).multiply(studentReduction).add(studentNotReducedAmount)));
}
}
| [
"[email protected]"
]
| |
0dd1e47e26e63e522ed356565ca0d849fb1b5d71 | 47a13c13bb2902680533915819d86d27de19962f | /BamWebApp/src/dashBoard/ClientSuccessfulDataService.java | ff6d9c18117b48005af14ec0fea373a2fd465fc9 | []
| no_license | rbhattacharjee81/RemoteBAMWebApp | 3d77d532c4e899a3a2f542d7838a417626fb5fa9 | ff782a1d0cee0bd438711bf85ab3ddf0150f217f | refs/heads/master | 2021-01-25T06:56:12.065451 | 2017-06-07T12:19:59 | 2017-06-07T12:19:59 | 93,628,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,089 | java | package dashBoard;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import dashBoard.Client;
import utility.DBConnection;
public class ClientSuccessfulDataService {
public static List<Client> getClientListSuccessful() {
List<Client> listOfclientsSuccessful = new ArrayList<Client>();
Client client = new Client();
try {
DBConnection dbConnection = new utility.DBConnection();
Statement st = null;
ResultSet rs = null;
Connection connection = (Connection) dbConnection.dbConnection();
String client_name = "";
String type = "";
String activity = "";
String timestamp = "";
String Final_status = "";
String imgUrlSuccess="img/correct.png";
String imgUrlFail="img/wrong2.png";
String imgUrlUnder="img/loading.png";
String originalImgPop="";
st = connection.createStatement();
String query = "SELECT p.client_name,p.type,p.activity,p.timestamp,p.Final_status FROM process_state_table p where p.Final_status='Processed' UNION SELECT m.client_name,m.type,m.Activity,m.DateTimeStamp,m.Final_status FROM mj_report m where m.Final_status='Processed'";
rs = st.executeQuery(query);
while (rs.next()) {
client = new Client();
client_name = rs.getString(1);
type = rs.getString(2);
activity = rs.getString(3);
timestamp = rs.getString(4);
Final_status = rs.getString(5);
if(Final_status.equalsIgnoreCase("Processed")){
originalImgPop=imgUrlSuccess;
}
else if(Final_status.equalsIgnoreCase("Failure")){
originalImgPop=imgUrlFail;
}
else {
originalImgPop=imgUrlUnder;
}
client = new Client();
client.setActivity(type +":"+ activity);
client.setClient(client_name);
client.setRecordDate(timestamp);
client.setStatus(originalImgPop);
listOfclientsSuccessful.add(client);
}
} catch (Exception e) {
// TODO: handle exception
}
return listOfclientsSuccessful;
}
}
| [
"[email protected]"
]
| |
62d6222904672036f03ec3c4151839d60c229a5f | b3fae12438671d9e3e1c078b512f4355e0414f9b | /src/main/java/com/vts/vee/service/package-info.java | 0ed542a323a7fc78e3d89d3f619120925eab204f | []
| no_license | dinhtrung90/vee | df46af9c9d889784191e72d42438767c7a5f1cb8 | 7ebf60cd7fe0f57d158c329c3766263b8cc84dca | refs/heads/master | 2020-05-03T02:02:15.055236 | 2019-03-29T10:11:49 | 2019-03-29T10:11:49 | 178,355,988 | 0 | 0 | null | 2019-03-29T10:11:50 | 2019-03-29T07:36:06 | Java | UTF-8 | Java | false | false | 61 | java | /**
* Service layer beans.
*/
package com.vts.vee.service;
| [
"[email protected]"
]
| |
dc29b300a0a02bbbfad18a7242691f6aacaabd51 | 6ffa8be49d7ecd4491a58dd535bde716130eb319 | /02. Java Enterprise/webcalculator/src/main/java/com/seavus/webcalculator/Operation.java | fe9247ccc5577885a81544617d331816b721c47e | []
| no_license | kristijan-apostolov/svs-talent | 68f97bf12044383e296e9a0559efde179687ca08 | ad602a426667390132bb9877121b8ec60c537404 | refs/heads/master | 2020-04-13T10:53:28.373499 | 2016-11-02T09:29:37 | 2016-11-02T09:29:37 | 32,036,224 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,221 | java | package com.seavus.webcalculator;
public class Operation {
private int operand1;
private int operand2;
private int result;
private Operator operator;
public Operation(int operand1, int operand2, Operator operator) {
super();
this.operand1 = operand1;
this.operand2 = operand2;
this.operator = operator;
if (operator == Operator.ADD) {
result = operand1 + operand2;
} else if (operator == Operator.SUBTRACT) {
result = operand1 - operand2;
}
}
public int getOperand1() {
return operand1;
}
public void setOperand1(int operand1) {
this.operand1 = operand1;
}
public int getOperand2() {
return operand2;
}
public void setOperand2(int operand2) {
this.operand2 = operand2;
}
public int getResult() {
return result;
}
public void setResult(int result) {
this.result = result;
}
public Operator getOperator() {
return operator;
}
public void setOperator(Operator operator) {
this.operator = operator;
}
@Override
public String toString() {
if (operator == Operator.ADD) {
return operand1 + " + " + operand2 + " = " + result;
} else if (operator == Operator.SUBTRACT) {
return operand1 + " - " + operand2 + " = " + result;
}
return "";
}
}
| [
"[email protected]"
]
| |
af239694c06108f0d30a0d05d62be626e3da58ed | baa1449994871e42a20e23ecf308a4f5717347f7 | /src/main/java/no/trygvejw/DataHolders/Range.java | 9938f1ebed8a78cddd2db11f5a082f9a857a4f11 | []
| no_license | TrygveJW/Java-Snippets | 1d1ee8d55e03565b3a1db83c447ff5b6eea76c69 | e1538924758c6b065622e0714303b1e675f7f382 | refs/heads/master | 2023-03-03T17:56:58.527384 | 2021-01-10T11:13:19 | 2021-01-10T11:13:19 | 279,230,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | /**
* Utillity class representing an integer range.
* The values are final and cannot be changed
*/
public class Range{
public final int from;
public final int to;
/**
* Creates the range
* @param from the from value
* @param to the to value
*/
public Range(int from, int to) {
this.from = from;
this.to = to;
}
} | [
"[email protected]"
]
| |
722dbebaed39acaf84fd21caf500d4da3330a22c | fd19541384f79d1ae8814d6fcf40d6ce5fe70f19 | /PracticaTP1/src/tp/pr3/exceptions/MessageException.java | f19d6deea57e413e4438125e7b26a086943fb57b | []
| no_license | BorjaAdayUCM/Tecnologia-de-la-Programacion | b845e6b639ecf1f57ed1a84a2e7f7b4095db9484 | c30aec6b8df1d48a261a10a3cd2adff0253dea25 | refs/heads/main | 2023-03-14T15:27:44.666466 | 2021-03-08T02:57:45 | 2021-03-08T02:57:45 | 345,483,925 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 309 | java | package tp.pr3.exceptions;
@SuppressWarnings("serial")
public class MessageException extends Exception{
private String message;
public MessageException(String m)
{
super();
this.message = m;
}
public MessageException()
{
super();
}
public String getMessage()
{
return message;
}
}
| [
"[email protected]"
]
| |
35c8ee6afcea37ce35aa69ee65f3e0560dd04ef9 | 5c72a045ba99937af3f30b4d8b7515e5ada877a6 | /app/src/test/java/com/sfm/beyesheji/ExampleUnitTest.java | 30437260ddd8f86ce01f88c80be60d0f5f92d376 | []
| no_license | shanfuming/BeYeSheJi | af399a2b016f5078d65b52c46601346710306fcc | c79b55a39745940589e52285b4c01bf8956ab7a1 | refs/heads/master | 2020-03-16T08:12:11.671859 | 2018-05-09T04:19:47 | 2018-05-09T04:19:47 | 132,591,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package com.sfm.beyesheji;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"997619452.com"
]
| 997619452.com |
29d017b6831bf45e1c552f7303ba829416f8637e | 7916bc750079639273ed1a9f604030790c8bc44a | /src/main/java/cn/spark/core/LocalFile.java | e5e5fb1fa60931390e78f0d8bffcfa25d3cf4918 | []
| no_license | chenkesheng/spark-study | ea54438009d1d58364c05857ec280b23b3e400e8 | 208b8c23ceec5919ca971b12a91e750747d0f521 | refs/heads/master | 2021-07-08T16:22:17.758065 | 2019-08-16T02:44:51 | 2019-08-16T02:44:51 | 202,645,593 | 0 | 0 | null | 2020-10-13T15:21:49 | 2019-08-16T02:38:25 | Java | UTF-8 | Java | false | false | 1,513 | java | package cn.spark.core;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.Function;
import org.apache.spark.api.java.function.Function2;
/**
* @Author: cks
* @Date: Created by 2019/8/8 10:00
* @Package: cn.spark.core
* @Description: 使用本地文件创建RDD -> 统计文本文件字数
*/
public class LocalFile {
public static void main(String[] args) {
SparkConf conf = new SparkConf().setAppName("LocalFile")
.setMaster("local");
JavaSparkContext sc = new JavaSparkContext(conf);
JavaRDD<String> lines = sc.textFile("E://IdeaProjects//spark-study//src//main//java//spark.txt");
// 统计文本文件内的字数
JavaRDD<Integer> lineLength = lines.map(new Function<String, Integer>() {
private static final long serialVersionUID = 1L;
@Override
public Integer call(String s) throws Exception {
return s.length();
}
});
int count = lineLength.reduce(new Function2<Integer, Integer, Integer>() {
private static final long serialVersionUID = 1L;
@Override
public Integer call(Integer v1, Integer v2) throws Exception {
return v1 + v2;
}
});
System.out.println("文件总字数是:" + count);
// 关闭JavaSparkContext
sc.close();
}
}
| [
"[email protected]"
]
| |
0b04f677c7ec91143bbbeafa3ffa537fe79eadc5 | eade432b6d9e4d266b402085006f532865a5feae | /src/main/java/org/titilima/restservices/messenger/database/DatabaseClass.java | 3144e91284b5636ee55d72c5caa015cd8fd6cdd2 | []
| no_license | titilimab/messenger | f7b5f68691a86a7dcb9fbe90a1d6e8b8238c3ee5 | 17f9baf14da30495f4bb7544a2b3432e26899662 | refs/heads/master | 2020-03-14T01:10:57.092038 | 2018-04-28T04:57:20 | 2018-04-28T04:57:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 527 | java | package org.titilima.restservices.messenger.database;
import java.util.HashMap;
import java.util.Map;
import org.titilima.restservices.messenger.model.Message;
import org.titilima.restservices.messenger.model.Profile;
public class DatabaseClass {
private static Map<Long, Message> messages = new HashMap<>();
private static Map<Long, Profile> profiles = new HashMap<>();
public static Map<Long, Message> getMessages(){
return messages;
}
public static Map<Long, Profile> getProfiles(){
return profiles;
}
}
| [
"[email protected]"
]
| |
d4e800f5b5f9e054bba10454c3c6fa4578bfcaa2 | 71ebbe7c08d8e103a9e179b6fa8f7877450b2e30 | /src/com/xn/manager/controller/ReplacePayController.java | 60702f00900c546455de5976f52ca8a31472c925 | []
| no_license | hzhuazhi/cakeDeploy | 1120c6ece4694c8338612f4a2a29c717ebe6cf9c | 64949e707d337d0053182fc79de434ebb8cceba4 | refs/heads/master | 2023-08-20T17:40:11.407442 | 2021-10-19T07:45:17 | 2021-10-19T07:45:17 | 307,953,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,932 | java | package com.xn.manager.controller;
import com.xn.common.constant.ManagerConstant;
import com.xn.common.controller.BaseController;
import com.xn.common.util.*;
import com.xn.manager.model.*;
import com.xn.manager.model.excel.BankExcelModel;
import com.xn.manager.service.*;
import com.xn.system.entity.Account;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.util.WebUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @Description 银行卡表信息
* @Date 2020/9/6 10:18
* @Version 1.0
*/
@Controller
@RequestMapping("/replacepay")
public class ReplacePayController extends BaseController {
private static Logger log = Logger.getLogger(ReplacePayController.class);
@Autowired
private ReplacePayService<ReplacePayModel> replacePayService;
/**
* 获取页面
*/
@RequestMapping("/list")
public String list() {
return "manager/replacepay/replacepayIndex";
}
/**
*
* 获取表格数据列表
*/
@RequestMapping("/dataList")
public void dataList(HttpServletRequest request, HttpServletResponse response, ReplacePayModel model) throws Exception {
List<ReplacePayModel> dataList = new ArrayList<ReplacePayModel>();
// model.setUseStatus(1);
// model.setIsEnable(ManagerConstant.PUBLIC_CONSTANT.IS_ENABLE_ZC);
Account account = (Account) WebUtils.getSessionAttribute(request, ManagerConstant.PUBLIC_CONSTANT.ACCOUNT);
if(account !=null && account.getId() > ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ZERO){
if (account.getRoleId() != ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ONE){
// model.setAccountNum(account.getAccountNum());
model.setMerchantId(account.getId());
}
dataList = replacePayService.queryByList(model);
}
HtmlUtil.writerJson(response, model.getPage(), dataList);
}
/**
*
* 获取表格数据列表-无分页
*/
@RequestMapping("/dataAllList")
public void dataAllList(HttpServletRequest request, HttpServletResponse response, ReplacePayModel model) throws Exception {
List<ReplacePayModel> dataList = new ArrayList<ReplacePayModel>();
Account account = (Account) WebUtils.getSessionAttribute(request, ManagerConstant.PUBLIC_CONSTANT.ACCOUNT);
if(account !=null && account.getId() > ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ONE){
if(account.getRoleId()!=ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ONE){
model.setMerchantId(account.getId());
}
dataList = replacePayService.queryAllList(model);
}
HtmlUtil.writerJson(response, dataList);
}
/**
*
* 获取需要替换的卡表格数据列表
*/
@RequestMapping("/queryReplaceList")
public void queryReplaceList(HttpServletRequest request, HttpServletResponse response, ReplacePayModel model) throws Exception {
List<BankModel> dataList = new ArrayList<BankModel>();
// model.setUseStatus(1);
// model.setIsEnable(ManagerConstant.PUBLIC_CONSTANT.IS_ENABLE_ZC);
Account account = (Account) WebUtils.getSessionAttribute(request, ManagerConstant.PUBLIC_CONSTANT.ACCOUNT);
if(account !=null && account.getId() > ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ZERO){
if (account.getRoleId() != ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ONE){
model.setMerchantId(account.getId());
}
}
HtmlUtil.writerJson(response, model.getPage(), dataList);
}
/**
* 获取新增页面
*/
@RequestMapping("/jumpAdd")
public String jumpAdd(HttpServletRequest request, HttpServletResponse response, Model model) {
Account account = (Account) WebUtils.getSessionAttribute(request, ManagerConstant.PUBLIC_CONSTANT.ACCOUNT);
if(account !=null && account.getId() > ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ZERO){
MobileCardModel mobileCardModel = new MobileCardModel();
if(account.getRoleId()!=ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ONE){
mobileCardModel.setMerchantId(account.getId());
}
// model.addAttribute("mobile",mobileCardService.queryAllList(mobileCardModel));
model.addAttribute("type",replacePayService.queryAllList());
}else {
sendFailureMessage(response,"登录超时,请重新登录在操作!");
}
return "manager/replacepay/replacepayAdd";
}
/**
* 添加数据
*/
@RequestMapping("/add")
public void add(HttpServletRequest request, HttpServletResponse response,ReplacePayModel bean) throws Exception {
Account account = (Account) WebUtils.getSessionAttribute(request, ManagerConstant.PUBLIC_CONSTANT.ACCOUNT);
if(account !=null && account.getId() > ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ZERO){
bean.setMerchantId(account.getId());
replacePayService.add(bean);
sendSuccessMessage(response, "保存成功~");
}else {
sendFailureMessage(response,"登录超时,请重新登录在操作!");
}
}
/**
* 获取修改页面
*/
@RequestMapping("/jumpUpdate")
public String jumpUpdate(HttpServletRequest request, HttpServletResponse response, Model model, long id, Integer op) {
Account account = (Account) WebUtils.getSessionAttribute(request, ManagerConstant.PUBLIC_CONSTANT.ACCOUNT);
BankModel atModel = new BankModel();
atModel.setId(id);
if(account !=null && account.getId() > ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ZERO){
MobileCardModel mobileCardModel = new MobileCardModel();
if (account.getRoleId() != ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ONE){
mobileCardModel.setMerchantId(account.getId());
}
model.addAttribute("account", replacePayService.queryById(atModel));
model.addAttribute("op", op);
}else {
sendFailureMessage(response,"登录超时,请重新登录在操作!");
}
return "manager/replacepay/replacePayEdit";
}
/**
* 获取修改页面
*/
@RequestMapping("/jumpBankUpdate")
public String jumpBankUpdate(HttpServletRequest request, HttpServletResponse response, Model model, long id, Integer op) {
Account account = (Account) WebUtils.getSessionAttribute(request, ManagerConstant.PUBLIC_CONSTANT.ACCOUNT);
BankModel atModel = new BankModel();
atModel.setId(id);
if(account !=null && account.getId() > ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ZERO){
MobileCardModel mobileCardModel = new MobileCardModel();
if (account.getRoleId() != ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ONE){
mobileCardModel.setMerchantId(account.getId());
}
model.addAttribute("account", replacePayService.queryById(atModel));
model.addAttribute("op", op);
}else {
sendFailureMessage(response,"登录超时,请重新登录在操作!");
}
return "manager/replacePay/replacePayEdit";
}
/**
* 修改卡号数据
*/
@RequestMapping("/updateBank")
public void updateBank(HttpServletRequest request, HttpServletResponse response,ReplacePayModel bean, String op) throws Exception {
Account account = (Account) WebUtils.getSessionAttribute(request, ManagerConstant.PUBLIC_CONSTANT.ACCOUNT);
if(account !=null && account.getId() > ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ZERO){
//
ReplacePayModel bankChangeModel = new ReplacePayModel();
ReplacePayModel queryBean1 = replacePayService.queryByCondition(bankChangeModel);
if(queryBean1 != null && queryBean1.getId() > ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ZERO){
sendFailureMessage(response, "该卡已经部署过了,不能重复保存,请重新换卡");
}else{
ReplacePayModel replacePayModel =new ReplacePayModel();
replacePayModel.setId(bean.getBankTypeId());
List<ReplacePayModel> typeList = replacePayService.queryAllList(replacePayModel);
//修改卡状态,修改卡号,和尾号、设备号
ReplacePayModel bankModel =new ReplacePayModel();
bankModel.setId(bean.getId());
bankModel.setBankCard(bean.getBankCard());
//
replacePayService.update(bankModel);
sendSuccessMessage(response, "保存成功~");
}
}else {
sendFailureMessage(response, "登录超时,请重新登录在操作!");
}
}
/**
* 修改数据
*/
@RequestMapping("/update")
public void update(HttpServletRequest request, HttpServletResponse response,ReplacePayModel bean, String op) throws Exception {
Account account = (Account) WebUtils.getSessionAttribute(request, ManagerConstant.PUBLIC_CONSTANT.ACCOUNT);
if(account !=null && account.getId() > ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ZERO){
ReplacePayModel queryBankTypeBean = new ReplacePayModel();
queryBankTypeBean.setId(bean.getBankTypeId());
ReplacePayModel queryBean1 = (ReplacePayModel) replacePayService.queryByCondition(queryBankTypeBean);
if(queryBean1 != null && queryBean1.getId() > ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ZERO){
}else{
sendFailureMessage(response, "该信息未部署,请联系管理员!");
}
replacePayService.update(bean);
sendSuccessMessage(response, "保存成功~");
}else {
sendFailureMessage(response, "登录超时,请重新登录在操作!");
}
}
/**
* 删除数据
*/
@RequestMapping("/delete")
public void delete(HttpServletRequest request, HttpServletResponse response, ReplacePayModel bean) throws Exception {
Account account = (Account) WebUtils.getSessionAttribute(request, ManagerConstant.PUBLIC_CONSTANT.ACCOUNT);
if(account !=null && account.getId() > ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ZERO){
replacePayService.delete(bean);
sendSuccessMessage(response, "删除成功");
}else{
sendFailureMessage(response, "登录超时,请重新登录在操作!");
}
}
/**
* 启用/禁用
*/
@RequestMapping("/manyOperation")
public void manyOperation(HttpServletRequest request, HttpServletResponse response, ReplacePayModel bean) throws Exception {
Account account = (Account) WebUtils.getSessionAttribute(request, ManagerConstant.PUBLIC_CONSTANT.ACCOUNT);
if(account !=null && account.getId() > ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ZERO){
replacePayService.manyOperation(bean);
sendSuccessMessage(response, "状态更新成功");
}else{
sendFailureMessage(response, "登录超时,请重新登录在操作!");
}
}
/**
* 实际导出Excel
* @param request
* @param response
* @param model
*/
@RequestMapping("/exportData")
public void exportData(HttpServletRequest request, HttpServletResponse response, ReplacePayModel model) {
Account account = (Account) WebUtils.getSessionAttribute(request, ManagerConstant.PUBLIC_CONSTANT.ACCOUNT);
if(account !=null && account.getId() > ManagerConstant.PUBLIC_CONSTANT.SIZE_VALUE_ZERO){
List<BankModel> dataList = new ArrayList<BankModel>();
// 导出数据
String[] titles = new String[10];
String[] titleCode = new String[10];
String filename = "导入银行卡信息";
titles = new String[]{"别名", "手机号","银行名称", "银行卡账号", "开户名", "收款日限金额", "收款月限金额"};
titleCode = new String[]{"alias", "phoneNum", "bankName", "bankCard", "accountName", "inDayMoney", "inMonthMoney"};
List<Map<String,Object>> paramList = new ArrayList<>();
ExportData.exportExcel(paramList, titles, titleCode, filename, response);
}
}
}
| [
"[email protected]"
]
| |
788e1c8eb2dc0cffc756943744fcc3aacd2035a7 | 345eb34aebc18cfc2a204b4f884c1beab8faa58b | /Receive/src/com/nercms/receive/Videoplay.java | 9320d24881357c56b701dbf547b8862a447c7dcb | []
| no_license | qfkongyan/YinHe | b843456da191b18f923b3f7f8a5393627205612b | f134207b7b4766504beb55d0700b4d4e0052e29a | refs/heads/master | 2023-03-15T20:25:50.344736 | 2017-08-12T02:31:25 | 2017-08-12T02:31:25 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 841 | java | package com.nercms.receive;
import java.nio.ByteBuffer;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Bitmap.Config;
import android.util.AttributeSet;
import android.view.SurfaceView;
import android.view.View;
public class Videoplay extends SurfaceView {
public int width = 352;
public int height = 288;
public byte[] mPixel = new byte[width * height * 2];
public ByteBuffer buffer = ByteBuffer.wrap(mPixel);
public Bitmap VideoBit = Bitmap.createBitmap(width, height, Config.RGB_565);
public Videoplay(Context context, AttributeSet attrs) // ¹¹Ô캯Êý
{
super(context, attrs);
}
@Override
protected void onDraw(Canvas canvas) {
VideoBit.copyPixelsFromBuffer(buffer);
canvas.drawBitmap(VideoBit, 0, 0, null);
super.onDraw(canvas);
}
}
| [
"[email protected]"
]
| |
16034d557f1bb27adeaaca583bc17ecbf2bde503 | 6da41b3ab1c870d307e7064005296cafce626107 | /uaa/src/test/java/hoang/com/uaa/security/OAuth2TokenMockUtil.java | 4106e74e20f7109cf8aec76d9b601039add1456c | []
| no_license | vohoangptit/kafka | b8aaef05f0e750efd9a0f0e7ae6bd0a31e5044a0 | fc2b4b0bbb54d2a44258f3f1c3814930f2a5b129 | refs/heads/master | 2020-04-10T04:01:29.886091 | 2018-12-18T07:52:20 | 2018-12-18T07:52:20 | 160,785,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,358 | java | package hoang.com.uaa.security;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.OAuth2Request;
import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices;
import org.springframework.stereotype.Component;
import org.springframework.test.web.servlet.request.RequestPostProcessor;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import static org.mockito.BDDMockito.given;
/**
* A bean providing simple mocking of OAuth2 access tokens for security integration tests.
*/
@Component
public class OAuth2TokenMockUtil {
@MockBean
private ResourceServerTokenServices tokenServices;
private OAuth2Authentication createAuthentication(String username, Set<String> scopes, Set<String> roles) {
List<GrantedAuthority> authorities = roles.stream()
.map(SimpleGrantedAuthority::new)
.collect(Collectors.toList());
User principal = new User(username, "test", true, true, true, true, authorities);
Authentication authentication = new UsernamePasswordAuthenticationToken(principal, principal.getPassword(),
principal.getAuthorities());
// Create the authorization request and OAuth2Authentication object
OAuth2Request authRequest = new OAuth2Request(null, "testClient", null, true, scopes, null, null, null,
null);
return new OAuth2Authentication(authRequest, authentication);
}
public RequestPostProcessor oauth2Authentication(String username, Set<String> scopes, Set<String> roles) {
String uuid = String.valueOf(UUID.randomUUID());
given(tokenServices.loadAuthentication(uuid))
.willReturn(createAuthentication(username, scopes, roles));
given(tokenServices.readAccessToken(uuid)).willReturn(new DefaultOAuth2AccessToken(uuid));
return new OAuth2PostProcessor(uuid);
}
public RequestPostProcessor oauth2Authentication(String username, Set<String> scopes) {
return oauth2Authentication(username, scopes, Collections.emptySet());
}
public RequestPostProcessor oauth2Authentication(String username) {
return oauth2Authentication(username, Collections.emptySet());
}
public static class OAuth2PostProcessor implements RequestPostProcessor {
private String token;
public OAuth2PostProcessor(String token) {
this.token = token;
}
@Override
public MockHttpServletRequest postProcessRequest(MockHttpServletRequest mockHttpServletRequest) {
mockHttpServletRequest.addHeader("Authorization", "Bearer " + token);
return mockHttpServletRequest;
}
}
}
| [
"[email protected]"
]
| |
1fad123267b356edbc98e9f7655cd89723c5d07d | 5c9cf8c43f5c34d2b5254473345a2fd872d0e654 | /src/main/java/com/example/springbootmybatisdemo1/Springbootmybatisdemo1Application.java | af4cc62166dc65f296d5ed28c14ea101cc8e057f | []
| no_license | jiejunding/springbootmybatis | 1065b61d87ecc1891cd41cbe3ebf5870b729b0d2 | fa62c75d3857b0ea9e1e21a980a4a02762ac4389 | refs/heads/master | 2022-06-30T23:15:25.026333 | 2019-06-08T05:57:35 | 2019-06-08T05:57:35 | 190,852,012 | 0 | 0 | null | 2022-06-21T01:14:28 | 2019-06-08T06:05:51 | Java | UTF-8 | Java | false | false | 465 | java | package com.example.springbootmybatisdemo1;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan("com.example.springbootmybatisdemo1.mapper")
public class Springbootmybatisdemo1Application {
public static void main(String[] args) {
SpringApplication.run(Springbootmybatisdemo1Application.class, args);
}
}
| [
"[email protected]"
]
| |
4a49680a9d0ae1e0ab5825a50b321d4e0581072c | 47db3dfb3598f0816b743725f17e21372a233747 | /9_Chapter_IteratorComposite/9_Chapter_Composite/src/menu/MenuItem.java | cc88475b8e5a2ef00a403f1ab319abcec4068e6e | []
| no_license | Echarde1/Patterns | 2b5e578a4a970caba35a9d7848524c898f387d22 | 63af8aacab1ca79bdbbb3f38956224b6127b765e | refs/heads/master | 2020-04-11T18:10:36.910175 | 2019-01-13T19:37:34 | 2019-01-13T19:37:34 | 161,988,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 830 | java | package menu;
public class MenuItem extends MenuComponent {
String name;
String description;
boolean vegetarian;
double price;
public MenuItem(String name,
String description,
boolean vegetarian,
double price)
{
this.name = name;
this.description = description;
this.vegetarian = vegetarian;
this.price = price;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public double getPrice() {
return price;
}
public boolean isVegetarian() {
return vegetarian;
}
public void print() {
System.out.print(" " + getName());
if (isVegetarian()) {
System.out.print("(v)");
}
System.out.println(", " + getPrice());
System.out.println(" -- " + getDescription());
}
}
| [
"[email protected]"
]
| |
950a74229f4b5b7b20c1d9af9bcab1e7f3d79337 | fc8c7eea1838a6d79adbfe5c2f7456251a5ee684 | /app/src/main/java/abhi/higherorlower/TutorialActivity.java | 9174bb77bb17976f49ba517a85c1a4dc5c0ba3a7 | []
| no_license | abhi4098/HigherOrLOwer | fe4eb1174405e50b3e2df12504ff6884e3e5aaaa | ab0a9b2dcf70f450232f656ec5621fa9836cde0c | refs/heads/master | 2021-01-20T04:02:20.163787 | 2017-05-03T19:27:49 | 2017-05-03T19:27:49 | 89,625,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package abhi.higherorlower;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class TutorialActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tutorial);
}
}
| [
"[email protected]"
]
| |
06b6e3b74d93266a02449640a9a91e81823580fd | ffc292993405841d4e112c55a5dbc6542c0a77d2 | /backend/src/main/java/com/logos/dsvendas/entities/Seller.java | 8ddeb0ae0ee4b66dc3914764ebf2dd8d0c55025f | []
| no_license | beneditocarvalho/devsuperior-semana-spring-react | 934a596cf1ea043ee865a434009ee7087606ee37 | 72f56bb9a69edb992fc22b7bff1909b940c9c705 | refs/heads/master | 2023-08-08T03:41:31.119539 | 2021-09-13T16:37:38 | 2021-09-13T16:37:38 | 404,331,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 901 | java | package com.logos.dsvendas.entities;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name = "tb_sellers")
public class Seller {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
@OneToMany(mappedBy = "seller")
private List<Sale> sales = new ArrayList<>();
public Seller () {
}
public Seller(Long id, String name) {
this.id = id;
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Sale> getSales() {
return sales;
}
}
| [
"[email protected]"
]
| |
fbf62ae3edd2ced49114f80fa0ad0bb2a939eeb1 | 27578adde5f48183c3b8e8532da806dc36fea21f | /data_acquisition/src/main/java/data/SwingTableDataAcquisitor.java | e1aa46c4963da5e81e6a31935694ef738b469605 | []
| no_license | lucp/TimeSeriesAnalysis | 6f72f49f977dc0a592fc84d51ba35ee44b468fb5 | 2515ba73430459eb7d732e1acfa80fe4be44e54f | refs/heads/master | 2021-01-02T09:37:27.923314 | 2013-11-19T21:27:10 | 2013-11-19T21:27:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,327 | java | /**
* Copyright (c) 2013,
* Tomasz Choma, Olgierd Grodzki, Łukasz Potępa, Monika Rakoczy, Paweł Synowiec, Łukasz Szarkowicz
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package data;
import java.text.SimpleDateFormat;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import org.jfree.data.time.Day;
import org.jfree.data.time.TimeSeries;
public class SwingTableDataAcquisitor {
/**
* Tablica danych
*/
JTable jTable;
/**
* Format daty
*/
String dateFormat;
/**
* Konstruktor klasy
* @param table tablica danych
* @param dateFormat format daty
*/
public SwingTableDataAcquisitor(JTable table,String dateFormat){
this.jTable=table;
this.dateFormat=dateFormat;
}
/**
* Metoda pobierająca dane z tabeli
* @param name nazwa dla nowej serii danych
* @return dane z tabeli
* @throws Exception bład parsowania danych
*/
public TimeSeries readData_TimeSeries(String name) throws Exception{
TimeSeries timeSeries=new TimeSeries(name);
SimpleDateFormat dateFormatter = new SimpleDateFormat(this.dateFormat);
DefaultTableModel model=(DefaultTableModel)this.jTable.getModel();
for (int i=0;i<this.jTable.getRowCount();i++){
int added=timeSeries.getItemCount();
try{
String time=(String)model.getValueAt(i,0);
String value=(String)model.getValueAt(i,1);
if (value.contains(",")){
value=value.replaceAll(",",".");
}
if (time.contains("\"")){
time=time.replaceAll("\"", "");
}
timeSeries.add(new Day(dateFormatter.parse(time)),Double.valueOf(value));
}
catch (Exception e){
if (!timeSeries.isEmpty()){
if (timeSeries.getItemCount()!=added){
timeSeries.clear();
}
}
}
}
if (timeSeries.isEmpty()){
throw new Exception();
}
return timeSeries;
}
/**
* Funkcja wstawiająca dane do tabeli
* @param table tablica do wstawienia danych
* @param series dane do wstawienia
* @param dateFormat format daty
* @throws Exception błąd parsowania
*/
public static void updateJTable(JTable table,TimeSeries series,String dateFormat) throws Exception{
DefaultTableModel model = (DefaultTableModel)table.getModel();
while (model.getRowCount()!=0){
model.removeRow(0);
}
if (!series.isEmpty()){
SimpleDateFormat dateFormatter = new SimpleDateFormat(dateFormat);
for (int i=0;i<series.getItemCount();i++){
model.addRow(new Object[]{(String)dateFormatter.format(series.getTimePeriod(i).getStart()),Double.toString(series.getValue(i).doubleValue())});
}
}
}
/**
* Funkcja dzieląca dane na dwie równe części
* @param ts dane do podziału
* @return dwuelementowa tablica z danymi
*/
public static TimeSeries[] splitTimeSeriesOnHalf(TimeSeries ts){
TimeSeries[] out=new TimeSeries[2];
out[0]=new TimeSeries("firstHalf");
out[1]=new TimeSeries("secondHalf");
for (int i=0;i<ts.getItemCount();i++){
if (i<(ts.getItemCount()/2)){
out[0].add(ts.getDataItem(i));
}
else{
out[1].add(ts.getDataItem(i));
}
}
return out;
}
}
| [
"[email protected]"
]
| |
01be0a4f48ab710653235a5b71f5f6d3e1d4fbc4 | b6ea9fbe1c581e3e341cb577c9cc263944efa953 | /app/src/main/java/com/pandp/platzigram/view/ContainerActivity.java | 2bd520ff586e1cc79a030f91e2aca81dba5e0fce | []
| no_license | pedroag2003/Platzigram | c68cbe3f7922e1232d25650f442550f10445b31c | 5ebe0bf2811a915109c1a4cb28e5bdafc21a410d | refs/heads/master | 2021-07-09T04:07:10.384581 | 2017-10-04T21:57:03 | 2017-10-04T21:57:03 | 105,722,002 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,311 | java | package com.pandp.platzigram.view;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import com.pandp.platzigram.R;
import com.pandp.platzigram.view.fragment.HomeFragment;
import com.pandp.platzigram.view.fragment.ProfileFragment;
import com.pandp.platzigram.view.fragment.SearchFragment;
import com.roughike.bottombar.BottomBar;
import com.roughike.bottombar.OnTabSelectListener;
public class ContainerActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_container);
BottomBar bottombar = (BottomBar) findViewById(R.id.bottombar);
bottombar.setDefaultTab(R.id.home);
bottombar.setOnTabSelectListener(new OnTabSelectListener() {
@Override
public void onTabSelected(@IdRes int tabId) {
switch (tabId){
case R.id.home:
HomeFragment homeFragment = new HomeFragment();
getSupportFragmentManager().beginTransaction().replace(R.id.container, homeFragment)
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
.addToBackStack(null).commit();
break;
case R.id.profile:
ProfileFragment profileFragment = new ProfileFragment();
getSupportFragmentManager().beginTransaction().replace(R.id.container, profileFragment)
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
.addToBackStack(null).commit();
break;
case R.id.search:
SearchFragment searchFragment = new SearchFragment();
getSupportFragmentManager().beginTransaction().replace(R.id.container, searchFragment)
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
.addToBackStack(null).commit();
break;
}
}
});
}
}
| [
"[email protected]"
]
| |
4c972cdb09b7adc1dbf1c966cefd9dff668d842a | 71884638fd4d2e7ce4e927d6b116af89a0a9f548 | /FoodmainiaRecipeBook/app/src/main/java/com/example/manveer/foodmainiarecipebook/GalleryListActivity.java | 6545071aca906961cfc3e83bf998c6085a1ba0f2 | []
| no_license | manu553/foodmania-recipe-book | 241352a3155f169ff3084e07e850495002e3f51d | 8747dbd412d23a416939bc56f3ea95183e39f72b | refs/heads/master | 2020-04-27T23:23:45.412480 | 2019-03-11T00:38:07 | 2019-03-11T00:38:07 | 174,774,136 | 0 | 0 | null | 2019-03-11T00:38:08 | 2019-03-10T03:38:51 | Java | UTF-8 | Java | false | false | 1,924 | java | package com.example.manveer.foodmainiarecipebook;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import org.w3c.dom.Text;
public class GalleryListActivity extends AppCompatActivity {
ListView recipeListView;
int[] images = {
R.drawable.cake,
R.drawable.homemade_cheez_its,
R.drawable.oatmeal_cookies
};
String[] names = {
"Triple Layer Chocolate Cake",
"Home Made Cheez It",
"Oatmeal Chocolate Chip Cookies"
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gallery_list);
recipeListView = findViewById(R.id.recipeList);
RecipeListAdapter adapter = new RecipeListAdapter();
recipeListView.setAdapter( adapter );
}
class RecipeListAdapter extends BaseAdapter {
@Override
public int getCount() {
return images.length;
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = getLayoutInflater().inflate(R.layout.recipelistlayout, null);
ImageView recipeImageView = view.findViewById(R.id.singleImageView);
TextView recipeTitleText = view.findViewById(R.id.singleTitleText);
recipeImageView.setImageResource(images[position]);
recipeTitleText.setText(names[position]);
return view;
}
}
}
| [
"[email protected]"
]
| |
2b74d89b82801fe8a8cdd5e670a155a12a0cb2bc | 66bb9e407ed67a325a7f1eb816798ec7e453c863 | /intellij/org.eclipse.xtend.idea/xtend-gen/org/eclipse/xtend/core/idea/config/XtendLibraryPresentationProvider.java | e6e7a6998f509252c7afd2175a28a950ea886951 | [
"LicenseRef-scancode-generic-cla"
]
| no_license | malbac/xtext | 639f85c4a20d752cbcbad290ccae2e52f7e108bb | f5dd7b4308f1c16ef4b645c9ac811b9c0ca2e103 | refs/heads/master | 2021-01-18T12:52:18.153143 | 2015-04-24T16:54:44 | 2015-04-24T16:55:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,389 | java | /**
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) 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
*/
package org.eclipse.xtend.core.idea.config;
import com.intellij.openapi.roots.libraries.LibraryKind;
import com.intellij.openapi.roots.libraries.LibraryPresentationProvider;
import com.intellij.openapi.vfs.VirtualFile;
import java.util.List;
import javax.swing.Icon;
import org.eclipse.xtend.core.idea.config.XtendLibraryProperties;
import org.eclipse.xtend.core.idea.icons.XtendIcons;
import org.eclipse.xtend.core.idea.lang.XtendLanguage;
/**
* @author kosyakov - Initial contribution and API
*/
@SuppressWarnings("all")
public class XtendLibraryPresentationProvider extends LibraryPresentationProvider<XtendLibraryProperties> {
public final static LibraryKind LIBRARY_KIND = LibraryKind.create(XtendLanguage.INSTANCE.getID());
public XtendLibraryPresentationProvider() {
super(XtendLibraryPresentationProvider.LIBRARY_KIND);
}
@Override
public XtendLibraryProperties detect(final List<VirtualFile> classesRoots) {
return new XtendLibraryProperties();
}
@Override
public Icon getIcon() {
return XtendIcons.Xtend_16x16;
}
}
| [
"[email protected]"
]
| |
1e94d3f1668b64dd7b50c53ac7b509b6335f7a8d | c3cec8a9ce9545ef3922f8acd2c229a8e4ecb57e | /arrayList-test/v2/ArrayListTest.java | 635e054892d7ba8fb286e96c042a89f37d98526b | []
| no_license | yrane/ekstazi-tests | fc32a9928977136dd3d2b0475245d3f77defbeab | deba5748eff0c95f8483a59aaec73ddbc5afe0ea | refs/heads/master | 2022-11-07T18:41:09.038081 | 2020-06-19T21:02:17 | 2020-06-19T21:02:17 | 26,392,232 | 0 | 0 | null | 2022-11-04T00:20:40 | 2014-11-09T10:20:08 | Java | UTF-8 | Java | false | false | 1,239 | java | import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class ArrayListTest {
List<Integer> testArray;
/**
* This method is invoked before each test is run to set up the test array
* with a known set of values.
*/
@Before
// Informs JUnit that this method should be run before each test
public void setUp() {
testArray = new ArrayList<Integer>(Arrays.asList(3, 1, 4, 1, 5));
}
/**
* Adds a value to the array and verifies the add was successful.
*/
@Test
public void testAdd() {
testArray.add(9);
List<Integer> expected =
new ArrayList<Integer>(Arrays.asList(3, 1, 4, 1, 5, 9));
assertEquals(testArray, expected);
}
/**
* Removes a value from the array and verifies the remove was successful.
*/
@Test
public void testRemoveObject() {
testArray.remove(new Integer(5));
List<Integer> expected =
new ArrayList<Integer>(Arrays.asList(3, 1, 4, 1));
assertEquals(testArray, expected);
}
/**
* Tests the indexOf method and verifies the expected return value.
*/
@Test
public void testIndexOf() {
assertEquals(testArray.indexOf(4), 2);
}
}
| [
"[email protected]"
]
| |
17de230bc5373979e9e2ba7d4adc5031640ea2ba | 8760a1f6cf9226bc1197e1484ed218033cfddb0d | /Backend/musicApp/src/test/java/com/te/musicApp/MusicAppApplicationTests.java | 0a2f5a1b8edeac86fb2c2d6ba180cb549bcc11a7 | []
| no_license | TE-maheshkumarpatti/TE_MaheshKumarPatti_Batch10_MusicPlayerWebapp | 3b9ec1e983a4a32249b651ada240b452dd8551cf | bd6bdf18c47b34baf18f5d85250c921492c31fca | refs/heads/main | 2023-06-05T15:44:24.215138 | 2021-06-29T13:51:57 | 2021-06-29T13:51:57 | 381,378,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 209 | java | package com.te.musicApp;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class MusicAppApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
]
| |
375081eeef1d72348372a7d588ae828f14b3861e | 3c0aa05f3ec608afa74ed6021777b005bad0c0ca | /rxpanda/src/main/java/com/pandaq/rxpanda/requests/okhttp/base/HttpRequest.java | 75e8dd652dfa8bf4845cef4b82bda1f7b6aad372 | [
"Apache-2.0"
]
| permissive | llc-sf/RxPanda | 261efb9e8f2a8eea8d3d2d48bc9d1b57dfd4506c | ca193a5867ede1899e5f1ef12b5171e55b24ebd8 | refs/heads/master | 2023-04-05T12:39:08.365785 | 2019-08-13T02:44:53 | 2019-08-13T02:44:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,837 | java | package com.pandaq.rxpanda.requests.okhttp.base;
import android.text.TextUtils;
import com.pandaq.rxpanda.RxPanda;
import com.pandaq.rxpanda.api.Api;
import com.pandaq.rxpanda.observer.ApiObserver;
import com.pandaq.rxpanda.requests.Request;
import com.pandaq.rxpanda.transformer.CastFunc;
import com.pandaq.rxpanda.transformer.RxScheduler;
import com.pandaq.rxpanda.utils.CastUtils;
import io.reactivex.Observable;
import io.reactivex.ObservableTransformer;
import io.reactivex.annotations.NonNull;
import okhttp3.ResponseBody;
import java.lang.reflect.Type;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Created by huxinyu on 2019/1/11.
* Email : [email protected]
* <p>
* Description : baseRequest for use okHttp lib, also can return an observable response
*/
public abstract class HttpRequest<R extends HttpRequest> extends Request<R> {
// http api,兼容 rxJava 观察者模式,需要返回观察对象时,将请求转换成 Retrofit 去请求
protected Api mApi;
protected String url = "";
// request tag
protected Object tag;
protected Map<String, String> localParams = new LinkedHashMap<>();//请求参数
private long retryDelayMillis;//请求失败重试间隔时间
/**
* set request‘s tag,use to manage the request
*
* @param tag request's tag
* @return Request Object
*/
public R tag(@NonNull Object tag) {
this.tag = tag;
return CastUtils.cast(this);
}
public HttpRequest(String url) {
if (!TextUtils.isEmpty(url)) {
this.url = url;
}
}
public <T> Observable<T> request(Type type) {
injectLocalParams();
return execute(type);
}
public void request(ApiObserver callback) {
injectLocalParams();
execute(callback);
}
protected abstract <T> Observable<T> execute(Type type);
protected abstract void execute(ApiObserver callback);
/**
* 添加请求参数
*
* @param paramKey
* @param paramValue
* @return
*/
public R addParam(String paramKey, String paramValue) {
if (paramKey != null && paramValue != null) {
this.localParams.put(paramKey, paramValue);
}
return CastUtils.cast(this);
}
/**
* 添加请求参数
*
* @param params
* @return
*/
public R addParams(Map<String, String> params) {
if (params != null) {
this.localParams.putAll(params);
}
return CastUtils.cast(this);
}
/**
* 移除请求参数
*
* @param paramKey
* @return
*/
public R removeParam(String paramKey) {
if (paramKey != null) {
this.localParams.remove(paramKey);
}
return CastUtils.cast(this);
}
/**
* 设置请求参数
*
* @param params
* @return
*/
public R params(Map<String, String> params) {
if (params != null) {
this.localParams = params;
}
return CastUtils.cast(this);
}
@Override
protected void injectLocalParams() {
super.injectLocalParams();
RxPanda.getRetrofitBuilder().client(builder.build());
retrofit = RxPanda.getRetrofitBuilder().build();
if (mGlobalConfig.getGlobalParams() != null) {
localParams.putAll(mGlobalConfig.getGlobalParams());
}
if (retryDelayMillis <= 0) {
retryDelayMillis = mGlobalConfig.getRetryDelayMillis();
}
mApi = retrofit.create(Api.class);
}
protected <T> ObservableTransformer<ResponseBody, T> httpTransformer(final Type type) {
return apiResultObservable -> apiResultObservable
.compose(RxScheduler.retrySync())
.map(new CastFunc<T>(type));
}
}
| [
"[email protected]"
]
| |
56e5b8625b3b48c51cef67121bc8dad1d6bbb031 | 8b30dbfe58a6ff7857d088e76e685f0216d90464 | /modulo-04/bancodigital/src/main/java/br/com/dbccompany/bancodigital/Enum/EstadoCivil.java | c4280ac45e9b7df4d899211f8c6f638f14442b02 | []
| no_license | Possebas/EstagioDBC | 695cfdf42e0ab87e9b3c496a878e72db4a483354 | 6794dc015714f3a1be5cc4487f322b33b341bd4a | refs/heads/master | 2022-02-20T09:04:21.464030 | 2019-09-29T22:51:31 | 2019-09-29T22:51:31 | 210,992,406 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 127 | java | package br.com.dbccompany.bancodigital.Enum;
public enum EstadoCivil {
SOLTEIRO, CASADO, DIVORCIADO, VIUVO, UNIAO_ESTAVEL;
}
| [
"[email protected]"
]
| |
efaf1f871f03b396f16190816a576822109210c0 | 0dc56128bf777320185b9352800afffefd7b9946 | /room-web-app/src/main/java/com/roomwebapp/RoomWebAppApplication.java | 6631ef0a5799c510ce76aa3b40beeb2625e3b781 | []
| no_license | pravinbarate1/spring-boot | 3eb3dd7f857373ed062d9df238786aa5614d3c26 | db7c2333dc68c42a4f92b763d89c9e859faac295 | refs/heads/master | 2020-04-09T11:06:56.804107 | 2018-12-11T05:00:44 | 2018-12-11T05:00:44 | 160,295,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 314 | java | package com.roomwebapp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class RoomWebAppApplication {
public static void main(String[] args) {
SpringApplication.run(RoomWebAppApplication.class, args);
}
}
| [
"[email protected]"
]
| |
9794f9bcea62cc44df021b616ef24e43446ae0e8 | 890709f716370cbe341141951ed18444b50fca18 | /zTurn/src_1st_round/leetcode/ReverseNodesInKGroupOJ.java | 7b64487fafec255b81383ad41b83aa5fdff69f60 | []
| no_license | ziaoliu/zTurn | c65f66f311c3509b8247070b3d7a672d332bd462 | b3f120af9b1d4b8b93bb6a95dd7941c954d9f99f | refs/heads/master | 2021-07-05T20:33:47.732265 | 2016-09-29T15:57:19 | 2016-09-29T15:57:19 | 38,476,498 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,366 | java | package leetcode;
/* Reverse Nodes in k-Group
*
* Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
* If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.
* You may not alter the values in the nodes, only nodes itself may be changed.
* Only constant memory is allowed.
* For example,
* Given this linked list: 1->2->3->4->5
* For k = 2, you should return: 2->1->4->3->5
* For k = 3, you should return: 3->2->1->4->5
*
* http://codeganker.blogspot.com/2014/02/reverse-nodes-in-k-group-leetcode.html
* http://www.cnblogs.com/lichen782/p/leetcode_Reverse_Nodes_in_kGroup.html
*/
//class ListNode {
// int val;
// ListNode next;
//
// ListNode(int x) {
// val = x;
// next = null;
// }
//}
public class ReverseNodesInKGroupOJ {
public static void main(String[] args) {
ReverseNodesInKGroupOJ solution = new ReverseNodesInKGroupOJ();
Solution test = solution.new Solution();
ListNode head = new ListNode(1);
ListNode n1 = new ListNode(2);
ListNode n2 = new ListNode(3);
ListNode n3 = new ListNode(4);
ListNode n4 = new ListNode(5);
head.next = n1;
n1.next = n2;
n2.next = n3;
n3.next = n4;
ListNode tt = test.reverseKGroup(head, 2);
while (tt != null) {
System.out.print(tt.val + " -> ");
tt = tt.next;
}
}
public class Solution {
public ListNode reverseKGroup(ListNode head, int k) {
if (null == head)
return null;
if (null == head.next)
return head;
if (k <= 1)
return head;
int counter = 1;
ListNode original = new ListNode(0);
ListNode count = head;
while (count.next != null) {
counter++;
count = count.next;
}
if(k > counter)
return head;
ListNode pre = null;
int iterations = counter / k;
ListNode end = null;
ListNode preEnd = null;
for (int i = 0; i < iterations; i++) {
preEnd = end;
end = head;
for (int j = 0; j < k; j++) {
ListNode temp = head.next;
head.next = pre;
pre = head;
head = temp;
}
if (original.next == null)
original.next = pre;
else
preEnd.next = pre;
}
if (end != null)
end.next = head;
else
end = head;
return original.next;
}
}
}
| [
"Ziao@Ziao-PC"
]
| Ziao@Ziao-PC |
afb609e8a20bdeab4f235e900dc18a61b2b815c7 | b6d5413a0e6ee01c4e9190be8349578ca87662fe | /src/main/java/com/oceanus/framework/aspectj/DataScopeAspect.java | 08b8ef8557c835cb7e4cd3e42afa6b60dfa8c63c | [
"Apache-2.0"
]
| permissive | yongchongwu/oceanus.bi | 399319cf6f3e0458f5ad505b1b13ff6266683e03 | fb95580b6b09799586138e53eebb65c86ae431ce | refs/heads/main | 2023-05-06T04:18:00.851846 | 2021-05-24T05:10:39 | 2021-05-24T05:10:39 | 495,733,463 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,226 | java | package com.oceanus.framework.aspectj;
import java.lang.reflect.Method;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import com.oceanus.common.utils.ServletUtils;
import com.oceanus.common.utils.StringUtils;
import com.oceanus.common.utils.spring.SpringUtils;
import com.oceanus.framework.aspectj.lang.annotation.DataScope;
import com.oceanus.framework.security.LoginUser;
import com.oceanus.framework.security.service.TokenService;
import com.oceanus.framework.web.domain.BaseEntity;
import com.oceanus.system.system.domain.SysRole;
import com.oceanus.system.system.domain.SysUser;
/**
* 数据过滤处理
*
* @author 张家锋
*/
@Aspect
@Component
public class DataScopeAspect
{
/**
* 全部数据权限
*/
public static final String DATA_SCOPE_ALL = "1";
/**
* 自定数据权限
*/
public static final String DATA_SCOPE_CUSTOM = "2";
/**
* 部门数据权限
*/
public static final String DATA_SCOPE_DEPT = "3";
/**
* 部门及以下数据权限
*/
public static final String DATA_SCOPE_DEPT_AND_CHILD = "4";
/**
* 仅本人数据权限
*/
public static final String DATA_SCOPE_SELF = "5";
/**
* 数据权限过滤关键字
*/
public static final String DATA_SCOPE = "dataScope";
// 配置织入点
@Pointcut("@annotation(com.oceanus.framework.aspectj.lang.annotation.DataScope)")
public void dataScopePointCut()
{
}
@Before("dataScopePointCut()")
public void doBefore(JoinPoint point) throws Throwable
{
handleDataScope(point);
}
protected void handleDataScope(final JoinPoint joinPoint)
{
// 获得注解
DataScope controllerDataScope = getAnnotationLog(joinPoint);
if (controllerDataScope == null)
{
return;
}
// 获取当前的用户
LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
SysUser currentUser = loginUser.getUser();
if (currentUser != null)
{
// 如果是超级管理员,则不过滤数据
if (!currentUser.isAdmin())
{
dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(),
controllerDataScope.userAlias());
}
}
}
/**
* 数据范围过滤
*
* @param joinPoint 切点
* @param user 用户
* @param alias 别名
*/
public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias)
{
StringBuilder sqlString = new StringBuilder();
for (SysRole role : user.getRoles())
{
String dataScope = role.getDataScope();
if (DATA_SCOPE_ALL.equals(dataScope))
{
sqlString = new StringBuilder();
break;
}
else if (DATA_SCOPE_CUSTOM.equals(dataScope))
{
sqlString.append(StringUtils.format(
" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias,
role.getRoleId()));
}
else if (DATA_SCOPE_DEPT.equals(dataScope))
{
sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId()));
}
else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope))
{
sqlString.append(StringUtils.format(
" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )",
deptAlias, user.getDeptId(), user.getDeptId()));
}
else if (DATA_SCOPE_SELF.equals(dataScope))
{
if (StringUtils.isNotBlank(userAlias))
{
sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId()));
}
else
{
// 数据权限为仅本人且没有userAlias别名不查询任何数据
sqlString.append(" OR 1=0 ");
}
}
}
if (StringUtils.isNotBlank(sqlString.toString()))
{
BaseEntity baseEntity = (BaseEntity) joinPoint.getArgs()[0];
baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
}
}
/**
* 是否存在注解,如果存在就获取
*/
private DataScope getAnnotationLog(JoinPoint joinPoint)
{
Signature signature = joinPoint.getSignature();
MethodSignature methodSignature = (MethodSignature) signature;
Method method = methodSignature.getMethod();
if (method != null)
{
return method.getAnnotation(DataScope.class);
}
return null;
}
}
| [
"[email protected]"
]
| |
4b3cc771da8f41ffe60b60db8c715cfc4be73ed7 | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /src/irvine/oeis/a128/A128588.java | 7e73899f2d4bdb92b662e521ec2b537dcd9e7d7f | []
| no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package irvine.oeis.a128;
// Generated by gen_linrec.pl - DO NOT EDIT here!
import irvine.oeis.LinearRecurrence;
/**
* A128588 <code>A007318 * A128587</code>.
* @author Georg Fischer
*/
public class A128588 extends LinearRecurrence {
/** Construct the sequence. */
public A128588() {
super(new long[] {1L, 1L}, new long[] {2L, 4L}, new long[] {1L});
} // constructor()
} // A128588
| [
"[email protected]"
]
| |
64b3276b51d32855be40939d2da5b9e596c5114e | b246ae07ae96c9f3766f4b5e284f0e35f511b76e | /ArefinJSF/sunshinefarm/src/java/com/arefin/controller/ExpensesFacade.java | b7bbd11222907224c3d8599e7f50643ee0a748aa | []
| no_license | abusafayatarefin92/Arefin-JSF | 3b188e5c211f902c19dbd81551214ac9a5124f6a | 13942300b5b48d6ab86cb69117b54ddaf7f6d48f | refs/heads/master | 2020-04-20T20:22:54.567557 | 2019-02-04T18:39:14 | 2019-02-04T18:39:14 | 169,074,904 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 715 | 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 com.arefin.controller;
import com.arefin.entity.Expenses;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author User
*/
@Stateless
public class ExpensesFacade extends AbstractFacade<Expenses> {
@PersistenceContext(unitName = "sunshinefarmPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public ExpensesFacade() {
super(Expenses.class);
}
}
| [
"[email protected]"
]
| |
b6dad52dc9eb80e889e382059d831755a03092bc | b111b77f2729c030ce78096ea2273691b9b63749 | /db-example-large-multi-project/project59/src/test/java/org/gradle/test/performance/mediumjavamultiproject/project59/p297/Test5954.java | 0bd3b1422fab2015c4d9783127743d17131d6148 | []
| no_license | WeilerWebServices/Gradle | a1a55bdb0dd39240787adf9241289e52f593ccc1 | 6ab6192439f891256a10d9b60f3073cab110b2be | refs/heads/master | 2023-01-19T16:48:09.415529 | 2020-11-28T13:28:40 | 2020-11-28T13:28:40 | 256,249,773 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,556 | java | package org.gradle.test.performance.mediumjavamultiproject.project59.p297;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test5954 {
Production5954 objectUnderTest = new Production5954();
@Test
public void testProperty0() throws Exception {
String value = "value";
objectUnderTest.setProperty0(value);
Thread.sleep(250);
assertEquals(value, objectUnderTest.getProperty0());
}
@Test
public void testProperty1() throws Exception {
String value = "value";
objectUnderTest.setProperty1(value);
Thread.sleep(250);
assertEquals(value, objectUnderTest.getProperty1());
}
@Test
public void testProperty2() throws Exception {
String value = "value";
objectUnderTest.setProperty2(value);
Thread.sleep(250);
assertEquals(value, objectUnderTest.getProperty2());
}
@Test
public void testProperty3() throws Exception {
String value = "value";
objectUnderTest.setProperty3(value);
Thread.sleep(250);
assertEquals(value, objectUnderTest.getProperty3());
}
@Test
public void testProperty4() throws Exception {
String value = "value";
objectUnderTest.setProperty4(value);
Thread.sleep(250);
assertEquals(value, objectUnderTest.getProperty4());
}
@Test
public void testProperty5() throws Exception {
String value = "value";
objectUnderTest.setProperty5(value);
Thread.sleep(250);
assertEquals(value, objectUnderTest.getProperty5());
}
@Test
public void testProperty6() throws Exception {
String value = "value";
objectUnderTest.setProperty6(value);
Thread.sleep(250);
assertEquals(value, objectUnderTest.getProperty6());
}
@Test
public void testProperty7() throws Exception {
String value = "value";
objectUnderTest.setProperty7(value);
Thread.sleep(250);
assertEquals(value, objectUnderTest.getProperty7());
}
@Test
public void testProperty8() throws Exception {
String value = "value";
objectUnderTest.setProperty8(value);
Thread.sleep(250);
assertEquals(value, objectUnderTest.getProperty8());
}
@Test
public void testProperty9() throws Exception {
String value = "value";
objectUnderTest.setProperty9(value);
Thread.sleep(250);
assertEquals(value, objectUnderTest.getProperty9());
}
} | [
"[email protected]"
]
| |
423279202f407e5fcdf7b5e6d671ec0b1a8af832 | 95a2817a883796d816e0df34acefda2a49bf8c6e | /9784897978741/ActivityMondai1/src/com/example/activitymondai1/MainActivity.java | dd227fdf73aa11a9387e6e0e4a007922303f3114 | []
| no_license | Sjith/books | c7f753de2c4ae5f119212991ff228693fa045dd9 | b8596b5b60ef10bff5a3693a1fde386ef86ce378 | refs/heads/master | 2021-01-25T10:44:15.970951 | 2013-01-29T17:53:21 | 2013-01-29T17:53:21 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 1,164 | java | package com.example.activitymondai1;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button)findViewById(R.id.button1);
button.setOnClickListener(
new OnClickListener() {
public void onClick(View v) {
EditText input = (EditText)findViewById(R.id.name);
Spinner spinner = (Spinner)findViewById(R.id.spinner1);
String str = (String)spinner.getSelectedItem();
Toast.makeText(MainActivity.this, str + "\n" + input.getText() + "‚³‚ñ", Toast.LENGTH_SHORT).show();
}
}
);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
| [
"[email protected]"
]
| |
be518f6ffabb8c198ba8e4ca26ed4f96b9c66f9d | f8c26b08b48d3fcbce0a32b3d8910d2ab6992117 | /scs-adapter-source/src/main/java/com/vine/commons/cloudstream/source/CloudStreamSourceConfig.java | 56e00052eb01674934b60487a103eaea941b6f82 | []
| no_license | artembilan/spring-cloud-stream-adapter | d386224aaf379a0fa72bf44b392a092c7db476b0 | a10b94947764ab9137d3fb567e0eb0bff3d0783d | refs/heads/master | 2020-03-07T01:34:23.811384 | 2018-03-28T07:29:59 | 2018-03-28T07:57:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 882 | java | package com.vine.commons.cloudstream.source;
import com.vine.commons.cloudstream.adapter.CloudChannelConstants;
import com.vine.commons.cloudstream.adapter.CloudSourceChannel;
import com.vine.commons.cloudstream.config.CloudSourceConfig;
import com.vine.commons.cloudstream.config.IntegrationCloudStreamConfig;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Import;
import static com.vine.commons.cloudstream.adapter.CloudStreamUtil.sourceReqRep;
/**
* Created by vrustia on 3/5/18.
*/
@SpringBootConfiguration
@Import({IntegrationCloudStreamConfig.class})
public class CloudStreamSourceConfig implements CloudSourceConfig {
@Override
public CloudSourceChannel[] sources() {
return new CloudSourceChannel[]{
sourceReqRep(CloudChannelConstants.CLOUD_EXCEPTION_CHANNEL)
};
}
}
| [
"[email protected]"
]
| |
5e122719cf23895ddeac41a683bf4c1e69280cec | 0b08da581e6cb62540200931346826103793e0b5 | /Modulo 1/Relación 1/E5R1.java | 4b2634c68dadce8a8856a36acd85c0b284e252d5 | []
| no_license | Alegarse/curso-android-uma | a21abfb191f7866d9bb07b8e2945904cf7ff6fba | 1743c21a3e627e8aca5c606375c063a5cc18b674 | refs/heads/master | 2020-05-21T00:40:00.730493 | 2018-09-19T11:02:53 | 2018-09-19T11:02:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | java | /*
* Ejercicio 5 | Relacion 1 | Modulo 1
* @author Lucia Blanco
*/
import java.util.Scanner;
public class E5R1 {
public static void main(String[] args) {
Scanner teclado = new Scanner(System.in);
System.out.print("Introduce la velocidad a la que se desplaza el vehículo (km/h): ");
double speed = Double.parseDouble(teclado.nextLine());
System.out.print("Introduce el tiempo que ha circulado (h): ");
double time = Double.parseDouble(teclado.nextLine());
System.out.print("El vehículo ha recorrido: " + (speed*time) + "km.");
}
}
| [
"[email protected]"
]
| |
825bc733fe66883d263aa641e0ede7b12707b5bd | 3b91ed788572b6d5ac4db1bee814a74560603578 | /com/tencent/mm/plugin/music/model/c$1.java | e50859150ce5891b67c9f79c6da1e7ae4f9edda1 | []
| no_license | linsir6/WeChat_java | a1deee3035b555fb35a423f367eb5e3e58a17cb0 | 32e52b88c012051100315af6751111bfb6697a29 | refs/heads/master | 2020-05-31T05:40:17.161282 | 2018-08-28T02:07:02 | 2018-08-28T02:07:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,230 | java | package com.tencent.mm.plugin.music.model;
import android.media.AudioManager.OnAudioFocusChangeListener;
import com.tencent.mm.sdk.platformtools.x;
class c$1 implements OnAudioFocusChangeListener {
final /* synthetic */ c lxT;
c$1(c cVar) {
this.lxT = cVar;
}
public final void onAudioFocusChange(int i) {
x.i("MicroMsg.Music.MusicAudioFocusHelper", "focus change %d", new Object[]{Integer.valueOf(i)});
if (i == -2 || i == -3) {
x.i("MicroMsg.Music.MusicAudioFocusHelper", "audio focus lossTransient");
if (h.bic().bhQ().PZ()) {
h.bic().bhQ().bhn();
}
} else if (i == 1 || i == 2 || i == 3) {
x.i("MicroMsg.Music.MusicAudioFocusHelper", "audio focus gain");
if (h.bic().bhQ().PZ()) {
h.bic().bhQ().resume();
}
} else if (i == -1) {
x.i("MicroMsg.Music.MusicAudioFocusHelper", "audio focus loss, passive pause");
if (h.bic().bhQ().PZ()) {
h.bic().bhQ().bhn();
h.bic();
e.bhX();
h.bic().bhY();
}
h.bie().abandonAudioFocus(this.lxT.lxS);
}
}
}
| [
"[email protected]"
]
| |
20acf3e711a885aa231a7598c46bcc6edea8780e | e8ff5b0d4575a4315a7b540504cc365668de7090 | /cross-ride/src/main/java/com/crossride/techtrial/service/PersonService.java | 0b1fa0af7f85ddfbabccf1e44bb2c45584811ce4 | []
| no_license | mutenMax/Java | 64d93b78b0f3017957160161bf6fe98f3430369a | e38d67f446a50b14a3a369e447bd065ba8f7290d | refs/heads/master | 2021-08-18T04:35:47.408928 | 2021-07-19T10:37:17 | 2021-07-19T10:37:17 | 183,782,873 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | /**
*
*/
package com.crossride.techtrial.service;
import java.util.List;
import com.crossride.techtrial.model.Person;
/**
* PersonService interface for Persons.
*
* @author cossover
*
*/
public interface PersonService {
public List<Person> getAll();
public Person save(Person p);
public Person findById(Long personId);
}
| [
"[email protected]"
]
| |
6d9a613e647a926728647c4fd227467bc3c1ff8f | f6548da065024b07d336d0958c515eaa4b70a3ef | /mysql/src/main/java/com/faisco/model/RoleQo.java | 71bbc20035e1fd9cd1342a4cb95246ddaff1b4f0 | []
| no_license | LiWenLF/bootsecuritydemo | a69763886323b2301b0153af7de7d6479ebb6097 | e8a1bcfee12fdffd30c66373c12568963ecae6df | refs/heads/master | 2020-03-06T16:39:43.882430 | 2018-03-27T11:35:13 | 2018-03-27T11:35:13 | 126,976,946 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 426 | java | package com.faisco.model;
/**
* Created by admin on 2018/3/27.
*/
public class RoleQo extends PageQo{
private Long id;
private String name;
public RoleQo() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
} | [
"[email protected]"
]
| |
81913f0ea1bf3fcacca8c76ea26e2e2c731e6f64 | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-eks/src/main/java/com/amazonaws/services/eks/model/DescribeClusterResult.java | 4a6d9272ebb838b3578e73d58393927d56638333 | [
"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 | 3,766 | 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.eks.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/eks-2017-11-01/DescribeCluster" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DescribeClusterResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {
/**
* <p>
* The full description of your specified cluster.
* </p>
*/
private Cluster cluster;
/**
* <p>
* The full description of your specified cluster.
* </p>
*
* @param cluster
* The full description of your specified cluster.
*/
public void setCluster(Cluster cluster) {
this.cluster = cluster;
}
/**
* <p>
* The full description of your specified cluster.
* </p>
*
* @return The full description of your specified cluster.
*/
public Cluster getCluster() {
return this.cluster;
}
/**
* <p>
* The full description of your specified cluster.
* </p>
*
* @param cluster
* The full description of your specified cluster.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DescribeClusterResult withCluster(Cluster cluster) {
setCluster(cluster);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getCluster() != null)
sb.append("Cluster: ").append(getCluster());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DescribeClusterResult == false)
return false;
DescribeClusterResult other = (DescribeClusterResult) obj;
if (other.getCluster() == null ^ this.getCluster() == null)
return false;
if (other.getCluster() != null && other.getCluster().equals(this.getCluster()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getCluster() == null) ? 0 : getCluster().hashCode());
return hashCode;
}
@Override
public DescribeClusterResult clone() {
try {
return (DescribeClusterResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| [
""
]
| |
2ee515f6ecd2590b30fcab807aea72a8227217e2 | e14068ff76341383a7a7235634601c521c6d565b | /src/main/java/com/xiaomiStore/controller/AttentionController.java | 3e7b784330c5ff0b83d78ce70dc008d84dba6bcf | []
| no_license | LanceDai/xiaomiStore | 294a36a77f0d482d5b05ae914cfb6287a58cb5af | 33891e9b189bfa2aabe8a7cf389eafe824defcd6 | refs/heads/master | 2020-03-19T23:39:49.370072 | 2018-07-09T02:04:35 | 2018-07-09T02:04:35 | 137,014,707 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,678 | java | package com.xiaomiStore.controller;
import com.xiaomiStore.pojo.Attention;
import com.xiaomiStore.pojo.User;
import com.xiaomiStore.service.AttentionService;
import com.xiaomiStore.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
@Controller
public class AttentionController {
private final AttentionService attentionService;
private final ProductService productService;
@Autowired
public AttentionController(AttentionService attentionService, ProductService productService) {
this.attentionService = attentionService;
this.productService = productService;
}
@RequestMapping(value = "/attention", method = RequestMethod.POST)
@ResponseBody
public String changeAttention(@RequestParam("productName")String productName, HttpSession httpSession){
//判断是否登陆
User user = (User) httpSession.getAttribute("loginUser");
if (user == null) {
System.out.println("未登录");
return "false";
}
//判断数据库是否存在关注的记录
String userId = user.getUserId();
String productId = productService.getProductIdByProductName(productName);
if (attentionService.isExistByUserIdAndProductId(userId, productId) != 0){
attentionService.delete(userId, productId);
System.out.println("已关注, 取消关注");
return "false";
}
else {
attentionService.insert(new Attention(userId, productId));
System.out.println("未关注, 添加关注");
return "true";
}
}
@RequestMapping(value = "/attentionStatus", method = RequestMethod.POST)
@ResponseBody
public String isAttention(@RequestParam("productName")String productName, HttpSession httpSession){
//判断是否登陆
User user = (User) httpSession.getAttribute("loginUser");
if (user == null) {
System.out.println("未登录");
return "false";
}
//判断数据库是否存在关注的记录
String userId = user.getUserId();
String productId = productService.getProductIdByProductName(productName);
return attentionService.isExistByUserIdAndProductId(userId, productId) != 0 ? "true" : "false";
}
}
| [
"[email protected]"
]
| |
0e7d8e2f040ff69b5a3ed3678a5df2452b966ea7 | 3efa417c5668b2e7d1c377c41d976ed31fd26fdc | /src/br/com/mind5/business/phoneSnapshotSearch/info/PhonaparchInfo.java | eafe8f1e29011ff5cf50176ee5eb914c28d00c7b | []
| no_license | grazianiborcai/Agenda_WS | 4b2656716cc49a413636933665d6ad8b821394ef | e8815a951f76d498eb3379394a54d2aa1655f779 | refs/heads/master | 2023-05-24T19:39:22.215816 | 2023-05-15T15:15:15 | 2023-05-15T15:15:15 | 109,902,084 | 0 | 0 | null | 2022-06-29T19:44:56 | 2017-11-07T23:14:21 | Java | UTF-8 | Java | false | false | 2,713 | java | package br.com.mind5.business.phoneSnapshotSearch.info;
import java.util.List;
import br.com.mind5.common.DefaultValue;
import br.com.mind5.info.InfoRecord;
public final class PhonaparchInfo extends InfoRecord implements Cloneable {
public long codOwner;
public long codSnapshot;
public long codPhone;
public long codOwnerRef;
public long codOwnerRefSnapshot;
public long codCustomer;
public long codCustomerSnapshot;
public long codStore;
public long codStoreSnapshot;
public long codEmployee;
public long codEmployeeSnapshot;
public long codUser;
public long codUserSnapshot;
public boolean isDefault;
public String recordMode;
public String username;
public PhonaparchInfo() {
super();
codOwner = DefaultValue.number();
codSnapshot = DefaultValue.number();
codPhone = DefaultValue.number();
codOwnerRef = DefaultValue.number();
codOwnerRefSnapshot = DefaultValue.number();
codStore = DefaultValue.number();
codStoreSnapshot = DefaultValue.number();
codCustomer = DefaultValue.number();
codCustomerSnapshot = DefaultValue.number();
codEmployee = DefaultValue.number();
codEmployeeSnapshot = DefaultValue.number();
codUser = DefaultValue.number();
codUserSnapshot = DefaultValue.number();
isDefault = DefaultValue.boole();
recordMode = DefaultValue.recordMode();
}
public static PhonaparchInfo copyFrom(Object sourceObj) {
return copyFrom(sourceObj, PhonaparchInfo.class);
}
public static List<PhonaparchInfo> copyFrom(List<?> sourceObjs) {
return copyFrom(sourceObjs, PhonaparchInfo.class);
}
@Override public Object clone() throws CloneNotSupportedException {
return super.clone();
}
@Override public int hashCode() {
int result = 17;
result = result * 31 + (int) (codOwner ^ (codOwner >>> 32));
result = result * 31 + (int) (codSnapshot ^ (codSnapshot >>> 32));
result = result * 31 + (int) (codPhone ^ (codPhone >>> 32));
result = result * 31 + (int) (codCustomer ^ (codCustomer >>> 32));
result = result * 31 + (int) (codStore ^ (codStore >>> 32));
result = result * 31 + (int) (codEmployee ^ (codEmployee >>> 32));
return result;
}
@Override public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof PhonaparchInfo))
return false;
PhonaparchInfo obj = (PhonaparchInfo) o;
return (codOwner == obj.codOwner &&
codSnapshot == obj.codSnapshot &&
codPhone == obj.codPhone &&
codCustomer == obj.codCustomer &&
codStore == obj.codStore &&
codEmployee == obj.codEmployee);
}
}
| [
"[email protected]"
]
| |
0f69e6517239fcd471e15a06f95d6dc84294a6db | 62f51d51159a6b47dce9f46f95c1bf42b9a94458 | /JavaTheHardWay/DictionaryOrder.java | 4cb95b626dac379adaec595dac876060b4663c02 | []
| no_license | gabrielantonia/SDPre | d1b6fdafdaa4629eb4cac562c8cf3bcab429bf1c | 9da20c31233befe2cfa6187bbd8db7794dab3852 | refs/heads/master | 2020-06-15T12:25:34.715348 | 2019-07-07T23:37:04 | 2019-07-07T23:37:04 | 195,291,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,497 | java | import java.util.Scanner;
public class DictionaryOrder{
public static void main(String[]args){
Scanner keyboard = new Scanner(System.in);
int name;
System.out.print("Make up the name of a programming language! ");
name = keyboard.nextLine();
if(name.compareToIgnoreCase("c++")<0)
System.out.println(name+" comes BEFORE c++");
if(name.compareToIgnoreCase("c++")==0)
System.out.println("c++ isn't a made=up language!");
if(name.compareToIgnoreCase("c++")>0)
System.out.println(name+" comes AFTER c++");
if(name.compareToIgnoreCase("go")<0)
System.out.println(name+"comes BEFORE go");
if(name.compareToIgnoreCase("go")==0)
System.out.println(name+"go isn't a made-up language!");
if(name.compareToIgnoreCase("go")>0)
System.out.println(name+"comes AFTER go");
if ( name.compareToIgnoreCase("java") < 0 )
System.out.println( name + " comes BEFORE java" );
if ( name.compareToIgnoreCase("java") == 0 )
System.out.println( "java isn't a made-up language!" );
if ( name.compareToIgnoreCase("java") > 0 )
System.out.println( name + " comes AFTER java" );
if ( name.compareToIgnoreCase("lisp") < 0 )
System.out.println( name + " comes BEFORE lisp" );
if ( name.compareToIgnoreCase("lisp") == 0 )
System.out.println( "lisp isn't a made-up language!" );
if ( name.compareToIgnoreCase("lisp") > 0 )
System.out.println( name + " comes AFTER lisp" );
if ( name.compareToIgnoreCase("python") < 0 )
System.out.println( name + " comes BEFORE python" );
if ( name.compareToIgnoreCase("python") == 0 )
System.out.println( "python isn't a made-up language!" );
if ( name.compareToIgnoreCase("python") > 0 )
System.out.println( name + " comes AFTER python" );
if ( name.compareToIgnoreCase("ruby") < 0 )
System.out.println( name + " comes BEFORE ruby" );
if ( name.compareToIgnoreCase("ruby") == 0 )
System.out.println( "ruby isn't a made-up language!" );
if ( name.compareToIgnoreCase("ruby") > 0 )
System.out.println( name + " comes AFTER ruby" );
if ( name.compareToIgnoreCase("visualbasic") < 0 )
System.out.println( name + " comes BEFORE visualbasic" );
if ( name.compareToIgnoreCase("visualbasic") == 0 )
System.out.println( "visualbasic isn't a made-up language!" );
if ( name.compareToIgnoreCase("visualbasic") > 0 )
System.out.println( name + " comes AFTER visualbasic" );
}
}
| [
"[email protected]"
]
| |
1bdfb3da37cce0b298c9c97026d17b46da7af01e | c2ed288a505c293643e282678d96ab1da5d5c67b | /src/main/java/fr/romaindev/itemslegs/commands/GiveItemCommand.java | 5ad1ec82239090e89a3cf621a273166e38c507f3 | []
| no_license | Romain120105/ItemsLegs | 6a30f3b79cb56a63428a15f19b936fc81dd39772 | ae6a58120fdc17d1bceca4aaf8842ce1bdf802a4 | refs/heads/main | 2023-03-19T12:56:43.513707 | 2021-03-12T11:49:04 | 2021-03-12T11:49:04 | 347,045,069 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,303 | java | package fr.romaindev.itemslegs.commands;
import fr.romaindev.itemslegs.ItemFactory;
import fr.romaindev.itemslegs.items.CustomItem;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class GiveItemCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
if(args.length >= 1){
String customItemName = args[0];
CustomItem item = ItemFactory.getItemByName(customItemName);
if(item != null){
player.getInventory().addItem(item.buildItemStack(1));
return true;
}else{
player.sendMessage(ChatColor.RED+"There is no item with such name!");
return false;
}
}else{
player.sendMessage(ChatColor.RED+"Not enought arguments!");
return false;
}
}
sender.sendMessage(ChatColor.RED+"Only a player can execute this command!");
return false;
}
}
| [
"[email protected]"
]
| |
d9dda1fad61bb70d0844cdef2676890e12f61233 | 02c09dfd01fd9119a060c5e93271a38302f49c6d | /project3/graphalg/Kruskal.java | aebf3a771bf2a8d714bbea9d7bb355d30bc56a11 | []
| no_license | iyezhiyu/CS61B | 84e066d9b688bb0656446ca7443ff3e0532b0ffd | 338f121e4f07d92a8e53867c677459decadd0a97 | refs/heads/master | 2020-05-07T19:22:45.187939 | 2019-07-15T03:32:12 | 2019-07-15T03:32:12 | 180,810,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,774 | java | /* Kruskal.java */
package graphalg;
import graph.*;
import set.*;
import list.*;
import dict.*;
/**
* The Kruskal class contains the method minSpanTree(), which implements
* Kruskal's algorithm for computing a minimum spanning tree of a graph.
*/
public class Kruskal {
/**
* minSpanTree() returns a WUGraph that represents the minimum spanning tree
* of the WUGraph g. The original WUGraph g is NOT changed.
*
* @param g The weighted, undirected graph whose MST we want to compute.
* @return A newly constructed WUGraph representing the MST of g.
*/
public static WUGraph minSpanTree(WUGraph g) {
LinkedQueue que = new LinkedQueue();
WUGraph newGraph = new WUGraph();
Object[] vertices = g.getVertices();
for (int i = 0; i<vertices.length; i++) {
newGraph.addVertex(vertices[i]);
Neighbors neighbor = g.getNeighbors(vertices[i]);
for (int j = 0; j < neighbor.neighborList.length; j++) {
CEdge edge = new CEdge(vertices[i], neighbor.neighborList[j], neighbor.weightList[j]);
que.enqueue(edge);
}
}
ListSorts.quickSort(que);
DisjointSets set = new DisjointSets(g.vertexCount());
HashTableChained vertexHash = new HashTableChained();
for (int i = 0; i<vertices.length; i++) {
vertexHash.insert(vertices[i], i);
}
while (! que.isEmpty()) {
CEdge edge = null;
try {
edge = (CEdge) que.dequeue();
} catch (QueueEmptyException e) {
System.err.println(e);
}
int temp1 = set.find((Integer)(vertexHash.find(edge.u)).value());
int temp2 = set.find((Integer)(vertexHash.find(edge.v)).value());
if (temp1 != temp2) {
set.union(temp1, temp2);
newGraph.addEdge(edge.u, edge.v, edge.weight);
}
}
return newGraph;
}
}
| [
"[email protected]"
]
| |
385c8da756ca933f5e22ec046451798b4cfffef7 | ec4a3de91b493fbb5462d7f3a028a95904c901e7 | /Question_1/Question1.java | 0fd538bbcaf3674e7761cd4c778d50973f6a8eed | []
| no_license | Hououin47/Data_Structures | dc7840782dcd790ce29f94584d45917b26071ee3 | bf42381114ba92292150ec8bc03aafea69075aaa | refs/heads/master | 2022-11-25T19:52:36.935918 | 2020-07-31T22:03:49 | 2020-07-31T22:03:49 | 284,137,411 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,524 | java | import java.io.*;
import java.util.*;
public class Question1 {
public static void main(String[] args) {
Scanner scan = null;
boolean isRunning = true;
String line = null;
Queue<String> buff = new LinkedList<>();
try {
scan = new Scanner(System.in);
run(scan, buff);
} catch (Exception e) {
// blind catch
System.out.println("Could not start scanner");
}
try {
scan.close();
} catch (Exception e) {
//blind
}
}
public static void run(Scanner scan, Queue<String> buff) {
boolean isRunning = true;
String line, begin;
while (isRunning) {
line = getInput(scan);
begin = line.substring(0, 1).toUpperCase();
if (begin.equals("O")) {
line = extract(buff);
System.out.println(line);
} else if (begin.equals("X")) {
isRunning = false;
} else {
buff.add(line);
}
}
}
public static String extract(Queue<String> buff) {
if (buff.size() == 0) {
return "Buffer empty";
}
return "Data: " + buff.remove();
}
public static String getInput(Scanner scan) {
String in = new String();
try {
in = scan.nextLine();
} catch (Exception e) {
System.out.println("Invalid");
}
return in;
}
}
| [
"[email protected]"
]
| |
f22a8dc1b60b73908a14845b75a2e50022a9f4ef | acaf5541cae69187d7d862835737b3af858b9bda | /src/Enemy.java | 35de0fd6d00bcf60d338e1ff752eb97509124c44 | []
| no_license | santeala/SpaceThing | 7f6129d0f14c33dbf2d3d55eddb14ad8141f0fec | d2bc272be3b3918ee91fd18838ef0110013c05d7 | refs/heads/master | 2020-12-21T20:43:43.206557 | 2020-01-27T17:52:26 | 2020-01-27T17:52:26 | 236,554,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 500 | java | import java.awt.*;
public class Enemy {
int x, y, diameter = 30;
int speed, dx, dy = 5;
int numEnemies = 50;
public Enemy(){
x = 50;
y = 50;
}
public Enemy(int x, int y){
this.x = x;
this.y = y;
}
public void move(){
y += dy;
}
public void paint(Graphics g){
g.setColor(Color.GREEN);
g.fillOval(x, y, diameter, diameter);
}
public int getNumEnemies() {
return numEnemies;
}
}
| [
"[email protected]"
]
| |
626636e53adf39e6c1445a7d890a4aa1ee0942b5 | 88dce8a953c59a93a1070f26abf7cd665db0c4eb | /src/com/dustdawn/crm/pojo/BaseDict.java | 630e1efd463800dc2bf54614da5a89b868b0a336 | []
| no_license | dustdawn/ssm_crm | 58b30170a9fc80972cf494c678927f22b641176f | 1148809d861373c59e492005066cb62e9ac5e0b8 | refs/heads/master | 2020-06-25T01:36:04.495270 | 2019-07-27T16:13:37 | 2019-07-27T16:13:37 | 199,157,549 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,599 | java | package com.dustdawn.crm.pojo;
import java.io.Serializable;
public class BaseDict implements Serializable{
private static final long serialVersionUID = 1L;
private String dict_id;
private String dict_type_code;
private String dict_type_name;
private String dict_item_name;
private String dict_item_code;
private Integer dict_sort;
private String dict_enable;
private String dict_memo;
public String getDict_id() {
return dict_id;
}
public void setDict_id(String dict_id) {
this.dict_id = dict_id;
}
public String getDict_type_code() {
return dict_type_code;
}
public void setDict_type_code(String dict_type_code) {
this.dict_type_code = dict_type_code;
}
public String getDict_type_name() {
return dict_type_name;
}
public void setDict_type_name(String dict_type_name) {
this.dict_type_name = dict_type_name;
}
public String getDict_item_name() {
return dict_item_name;
}
public void setDict_item_name(String dict_item_name) {
this.dict_item_name = dict_item_name;
}
public String getDict_item_code() {
return dict_item_code;
}
public void setDict_item_code(String dict_item_code) {
this.dict_item_code = dict_item_code;
}
public Integer getDict_sort() {
return dict_sort;
}
public void setDict_sort(Integer dict_sort) {
this.dict_sort = dict_sort;
}
public String getDict_enable() {
return dict_enable;
}
public void setDict_enable(String dict_enable) {
this.dict_enable = dict_enable;
}
public String getDict_memo() {
return dict_memo;
}
public void setDict_memo(String dict_memo) {
this.dict_memo = dict_memo;
}
}
| [
"[email protected]"
]
| |
e2d877946e06c4e74beabb19dbbbf311784e109a | 5260531248556114eda153cf13671b4178f541b8 | /src/Ringgz/Server/MessageUI.java | e06bab4092dd590552c424b53d24065d0bcece2c | [
"Apache-2.0"
]
| permissive | JoshGlue/Ringgz | b4e4eaa82e4430b100c15183ba79681d6f974126 | eb8506b8baef77f8ca852413653789f37b86670e | refs/heads/master | 2021-01-24T21:53:52.993319 | 2016-09-20T17:58:42 | 2016-09-20T17:58:42 | 68,738,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 96 | java | package Ringgz.Server;
public interface MessageUI {
public void addMessage(String msg);
}
| [
"[email protected]"
]
| |
30aa247b256ec4149e68210a8dc6c85ad50ffde8 | 18292045b57f1f68abc5adf0b360fa22f29877b3 | /src/main/java/com/amazonservices/mws/jaxb/ServingDimension.java | 16fb84f319c69a3abb44cd89094ee6543d19c61e | [
"MIT"
]
| permissive | liccoCode/amazon-mws | 537d20493e43a4baeb65de0f23adf6a51e61c27d | 91fcf1a04ae8790015c223d282f17f9d24a578f4 | refs/heads/master | 2020-04-06T22:15:41.694302 | 2018-11-16T07:59:21 | 2018-11-16T07:59:21 | 157,830,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,950 | java |
package com.amazonservices.mws.jaxb;
import java.math.BigDecimal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/**
* <p>ServingDimension complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* <complexType name="ServingDimension">
* <simpleContent>
* <extension base="<>PositiveDimension">
* <attribute name="unitOfMeasure" use="required" type="{}ServingUnit" />
* </extension>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ServingDimension", propOrder = {
"value"
})
public class ServingDimension {
@XmlValue
protected BigDecimal value;
@XmlAttribute(name = "unitOfMeasure", required = true)
protected ServingUnit unitOfMeasure;
/**
* 获取value属性的值。
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getValue() {
return value;
}
/**
* 设置value属性的值。
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setValue(BigDecimal value) {
this.value = value;
}
/**
* 获取unitOfMeasure属性的值。
*
* @return
* possible object is
* {@link ServingUnit }
*
*/
public ServingUnit getUnitOfMeasure() {
return unitOfMeasure;
}
/**
* 设置unitOfMeasure属性的值。
*
* @param value
* allowed object is
* {@link ServingUnit }
*
*/
public void setUnitOfMeasure(ServingUnit value) {
this.unitOfMeasure = value;
}
}
| [
"[email protected]"
]
| |
e69140bc91ce173a0d9cc3c9ca208a2a02e72a3d | b5a705243a6b995e0beca721551b3e9b479e7ef4 | /Milestone1/src/javaFundamentals/arrays/Ex10a.java | bc6dbba18dcd6e757f6fe2b26ecea474b5f83903 | []
| no_license | Jyosthna12/WTN | 9901e2d2f7ece735b4108b426565efeac0cd87ef | 569d171bf54a82e683231d175ee1bd1c1ec7f94d | refs/heads/master | 2023-04-16T02:55:10.229513 | 2021-04-25T11:43:27 | 2021-04-25T11:43:27 | 271,561,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package javaFundamentals.arrays;
public class Ex10a {
public static void main(String[] args)
{
if (args.length != 9)
System.out.println("Please enter 9 integer numbers");
int[][] array = new int[3][3];
int x = 0;
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[0].length; j++) {
array[i][j] = Integer.parseInt(args[x++]);
}
}
int max = 0;
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[0].length; j++) {
max = array[i][j] > max ? array[i][j] : max;
}
}
System.out.println("The biggest number in the given array is " + max);
}
}
| [
"jyost@DESKTOP-G3LDKBE"
]
| jyost@DESKTOP-G3LDKBE |
019ab512ec420f2b692a398c5e4aa26cef037c9c | 3adcdb8ce9d5b230ea1fc86b4fecae438b8b0b93 | /src/main/java/com/huemedia/cms/model/repository/RatingRepository.java | fcd0941848826158e36950c65cc5c035a7b6004c | []
| no_license | danialahmad/feldacms | 83da6597486ffccafd039ac58909f967d107968d | b15834c24fe071017fd23177d1948c1f8fccd51e | refs/heads/master | 2016-09-06T00:14:19.853113 | 2015-08-21T20:31:26 | 2015-08-21T20:31:26 | 35,848,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 238 | java | package com.huemedia.cms.model.repository;
import org.springframework.data.repository.CrudRepository;
import com.huemedia.cms.model.entity.Rating;
public interface RatingRepository extends CrudRepository<Rating, Integer> {
}
| [
"[email protected]"
]
| |
6d809a761487ba3adde1bb24359597f3fd548d23 | 142664c0b6a8afa5ba757e163ff162a619cd2b93 | /src/test/java/za/co/ajk/incidentman/web/rest/errors/ExceptionTranslatorIntTest.java | 6f1bf18fd05bd6e3e00d44a67807ce8657476809 | []
| no_license | kappaj2/SystemGateway | 4aa92418b7836b76239df29743a433f55664bf24 | 2b828eb53a30df1259a289e6e9f66db9c2643a05 | refs/heads/master | 2021-08-31T18:28:49.841842 | 2017-12-18T10:35:23 | 2017-12-18T10:35:23 | 108,727,080 | 0 | 0 | null | 2017-11-06T20:33:15 | 2017-10-29T11:09:29 | Java | UTF-8 | Java | false | false | 6,513 | java | package za.co.ajk.incidentman.web.rest.errors;
import za.co.ajk.incidentman.SystemGatewayApp;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.zalando.problem.spring.web.advice.MediaTypes;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Test class for the ExceptionTranslator controller advice.
*
* @see ExceptionTranslator
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SystemGatewayApp.class)
public class ExceptionTranslatorIntTest {
@Autowired
private ExceptionTranslatorTestController controller;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
private MockMvc mockMvc;
@Before
public void setup() {
mockMvc = MockMvcBuilders.standaloneSetup(controller)
.setControllerAdvice(exceptionTranslator)
.setMessageConverters(jacksonMessageConverter)
.build();
}
@Test
public void testConcurrencyFailure() throws Exception {
mockMvc.perform(get("/test/concurrency-failure"))
.andExpect(status().isConflict())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value(ErrorConstants.ERR_CONCURRENCY_FAILURE));
}
@Test
public void testMethodArgumentNotValid() throws Exception {
mockMvc.perform(post("/test/method-argument").content("{}").contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value(ErrorConstants.ERR_VALIDATION))
.andExpect(jsonPath("$.fieldErrors.[0].objectName").value("testDTO"))
.andExpect(jsonPath("$.fieldErrors.[0].field").value("test"))
.andExpect(jsonPath("$.fieldErrors.[0].message").value("NotNull"));
}
@Test
public void testParameterizedError() throws Exception {
mockMvc.perform(get("/test/parameterized-error"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("test parameterized error"))
.andExpect(jsonPath("$.params.param0").value("param0_value"))
.andExpect(jsonPath("$.params.param1").value("param1_value"));
}
@Test
public void testParameterizedError2() throws Exception {
mockMvc.perform(get("/test/parameterized-error2"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("test parameterized error"))
.andExpect(jsonPath("$.params.foo").value("foo_value"))
.andExpect(jsonPath("$.params.bar").value("bar_value"));
}
@Test
public void testMissingServletRequestPartException() throws Exception {
mockMvc.perform(get("/test/missing-servlet-request-part"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.400"));
}
@Test
public void testMissingServletRequestParameterException() throws Exception {
mockMvc.perform(get("/test/missing-servlet-request-parameter"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.400"));
}
@Test
public void testAccessDenied() throws Exception {
mockMvc.perform(get("/test/access-denied"))
.andExpect(status().isForbidden())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.403"))
.andExpect(jsonPath("$.detail").value("test access denied!"));
}
@Test
public void testUnauthorized() throws Exception {
mockMvc.perform(get("/test/unauthorized"))
.andExpect(status().isUnauthorized())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.401"))
.andExpect(jsonPath("$.path").value("/test/unauthorized"))
.andExpect(jsonPath("$.detail").value("test authentication failed!"));
}
@Test
public void testMethodNotSupported() throws Exception {
mockMvc.perform(post("/test/access-denied"))
.andExpect(status().isMethodNotAllowed())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.405"))
.andExpect(jsonPath("$.detail").value("Request method 'POST' not supported"));
}
@Test
public void testExceptionWithResponseStatus() throws Exception {
mockMvc.perform(get("/test/response-status"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.400"))
.andExpect(jsonPath("$.title").value("test response status"));
}
@Test
public void testInternalServerError() throws Exception {
mockMvc.perform(get("/test/internal-server-error"))
.andExpect(status().isInternalServerError())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.500"))
.andExpect(jsonPath("$.title").value("Internal Server Error"));
}
}
| [
"[email protected]"
]
| |
388fc7acfe7623091b6a8b955352b4c91ed620c4 | e27942cce249f7d62b7dc8c9b86cd40391c1ddd4 | /modules/adwords_axis/src/main/java/com/google/api/ads/adwords/axis/v201708/cm/LocationTargetingStatus.java | 6f1c6690a0c04c4b34c36f180edebb895d25a4c1 | [
"Apache-2.0"
]
| permissive | mo4ss/googleads-java-lib | b4b6178747d25d16ae6aa0c80d80ee18a2dfe01a | efaa9c3bd8a46a3ed4b00963dc9760c6dd8bd641 | refs/heads/master | 2022-12-05T00:30:56.740813 | 2022-11-16T10:47:15 | 2022-11-16T10:47:15 | 108,132,394 | 0 | 0 | Apache-2.0 | 2022-11-16T10:47:16 | 2017-10-24T13:41:43 | Java | UTF-8 | Java | false | false | 3,634 | java | // Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* LocationTargetingStatus.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
*/
package com.google.api.ads.adwords.axis.v201708.cm;
public class LocationTargetingStatus implements java.io.Serializable {
private java.lang.String _value_;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
protected LocationTargetingStatus(java.lang.String value) {
_value_ = value;
_table_.put(_value_,this);
}
public static final java.lang.String _ACTIVE = "ACTIVE";
public static final java.lang.String _OBSOLETE = "OBSOLETE";
public static final java.lang.String _PHASING_OUT = "PHASING_OUT";
public static final LocationTargetingStatus ACTIVE = new LocationTargetingStatus(_ACTIVE);
public static final LocationTargetingStatus OBSOLETE = new LocationTargetingStatus(_OBSOLETE);
public static final LocationTargetingStatus PHASING_OUT = new LocationTargetingStatus(_PHASING_OUT);
public java.lang.String getValue() { return _value_;}
public static LocationTargetingStatus fromValue(java.lang.String value)
throws java.lang.IllegalArgumentException {
LocationTargetingStatus enumeration = (LocationTargetingStatus)
_table_.get(value);
if (enumeration==null) throw new java.lang.IllegalArgumentException();
return enumeration;
}
public static LocationTargetingStatus fromString(java.lang.String value)
throws java.lang.IllegalArgumentException {
return fromValue(value);
}
public boolean equals(java.lang.Object obj) {return (obj == this);}
public int hashCode() { return toString().hashCode();}
public java.lang.String toString() { return _value_;}
public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumSerializer(
_javaType, _xmlType);
}
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumDeserializer(
_javaType, _xmlType);
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(LocationTargetingStatus.class);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/cm/v201708", "LocationTargetingStatus"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
}
| [
"[email protected]"
]
| |
1511cf262489c79a25c9cf70d4ce31b24d7c0192 | b63d8f89879fcddef989edd0f936dffe11eca1a1 | /src/test/java/tmp/HTTPPostEncoderTest2.java | 2da2ea8f2c9f97b761ef37a1dac18db76790dcb5 | [
"Apache-2.0"
]
| permissive | songgane-zz/songgane-saml | 790ea2a99def44969f8eff54467a96514ed9bae5 | 15843b3c4b3711d22a3b89ed3d203663783a8c1b | refs/heads/master | 2021-05-30T17:16:25.429995 | 2016-03-01T13:07:00 | 2016-03-01T13:07:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,311 | java | package tmp;
/*
* Licensed to the University Corporation for Advanced Internet Development,
* Inc. (UCAID) under one or more contributor license agreements. See the
* NOTICE file distributed with this work for additional information regarding
* copyright ownership. The UCAID 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.
*/
import java.io.UnsupportedEncodingException;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
import org.joda.time.DateTime;
import org.opensaml.Configuration;
import org.opensaml.DefaultBootstrap;
import org.opensaml.common.SAMLObjectBuilder;
import org.opensaml.common.SAMLVersion;
import org.opensaml.common.binding.BasicSAMLMessageContext;
import org.opensaml.saml2.binding.encoding.HTTPPostEncoder;
import org.opensaml.saml2.core.Response;
import org.opensaml.saml2.core.Status;
import org.opensaml.saml2.core.StatusCode;
import org.opensaml.saml2.metadata.AssertionConsumerService;
import org.opensaml.saml2.metadata.Endpoint;
import org.opensaml.ws.message.encoder.MessageEncodingException;
import org.opensaml.ws.transport.http.HttpServletResponseAdapter;
import org.opensaml.xml.ConfigurationException;
import org.opensaml.xml.XMLObjectBuilderFactory;
import org.opensaml.xml.util.XMLHelper;
/**
*
*/
public class HTTPPostEncoderTest2 {
/** Velocity template engine. */
private static VelocityEngine velocityEngine;
protected static XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
static {
try{
DefaultBootstrap.bootstrap();
}catch(ConfigurationException e){
}
velocityEngine = new VelocityEngine();
velocityEngine.setProperty(RuntimeConstants.INPUT_ENCODING, "UTF-8");
velocityEngine.setProperty(RuntimeConstants.OUTPUT_ENCODING, "UTF-8");
velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
velocityEngine.setProperty("classpath.resource.loader.class",
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
velocityEngine.init();
}
public static void main(String[] args) throws MessageEncodingException, UnsupportedEncodingException {
SAMLObjectBuilder<StatusCode> statusCodeBuilder =
(SAMLObjectBuilder<StatusCode>) builderFactory.getBuilder(StatusCode.DEFAULT_ELEMENT_NAME);
StatusCode statusCode = statusCodeBuilder.buildObject();
statusCode.setValue(StatusCode.SUCCESS_URI);
SAMLObjectBuilder<Status> statusBuilder =
(SAMLObjectBuilder<Status>) builderFactory.getBuilder(Status.DEFAULT_ELEMENT_NAME);
Status responseStatus = statusBuilder.buildObject();
responseStatus.setStatusCode(statusCode);
SAMLObjectBuilder<Response> responseBuilder =
(SAMLObjectBuilder<Response>) builderFactory.getBuilder(Response.DEFAULT_ELEMENT_NAME);
Response samlMessage = responseBuilder.buildObject();
samlMessage.setID("foo");
samlMessage.setVersion(SAMLVersion.VERSION_20);
samlMessage.setIssueInstant(new DateTime(0));
samlMessage.setStatus(responseStatus);
SAMLObjectBuilder<Endpoint> endpointBuilder =
(SAMLObjectBuilder<Endpoint>) builderFactory.getBuilder(AssertionConsumerService.DEFAULT_ELEMENT_NAME);
Endpoint samlEndpoint = endpointBuilder.buildObject();
samlEndpoint.setLocation("http://example.org");
samlEndpoint.setResponseLocation("http://example.org/response");
// MockHttpServletResponse response = new MockHttpServletResponse();
// HttpServletResponseAdapter outTransport = new HttpServletResponseAdapter(response, false);
//
// BasicSAMLMessageContext messageContext = new BasicSAMLMessageContext();
// messageContext.setOutboundMessageTransport(outTransport);
// messageContext.setPeerEntityEndpoint(samlEndpoint);
// messageContext.setOutboundSAMLMessage(samlMessage);
// messageContext.setRelayState("relay");
//
// HTTPPostEncoder encoder = new HTTPPostEncoder(velocityEngine, "/templates/saml2-post-binding.vm");
// encoder.encode(messageContext);
//
// System.out.println(XMLHelper.nodeToString(samlMessage.getDOM()));
// System.out.println("Assertion String: " + response.getContentAsString());
//
// System.out.println(response.getContentType());
// System.out.println(response.getCharacterEncoding());
// System.out.println(response.getHeader("Cache-control"));
// System.out.println(response.getContentAsString().hashCode());
}
}
| [
"[email protected]"
]
| |
62d085b55e2d2174a9ca09983d04628a3cc7acca | 55fd6d231c66f420e4f8c0db135f37ce2e23a8f2 | /park-common/src/main/java/com/park/cloud/common/domain/params/user/MebBindVehicleListParams.java | f2b04ef31bf6b834a04feb1c7068ded5fb7fa628 | []
| no_license | QianUser/park | 0cc1e3c78595eca5537bdef85e9e2fecad329173 | 726879bb498f24be7b3399449b27c4547002607c | refs/heads/master | 2023-02-02T19:28:02.689427 | 2020-11-27T11:15:11 | 2020-12-22T06:52:33 | 323,564,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 492 | java | package com.park.cloud.common.domain.params.user;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
/**
* 用户绑定车牌列表参数
*/
@Data
@ApiModel
public class MebBindVehicleListParams extends ClientBaseParams {
@NotEmpty(message = "停车服务号不能为空")
@ApiModelProperty(value = "用户停车服务号", required = true)
private String parkUserId;
}
| [
"[email protected]"
]
| |
c35d76d7629790b38a05b76c2ab39fdfb59bfb1a | 7b8a10062c9280f9dab68c22125b88c559df4d3c | /bitcamp-project-server/app/src/main/java/com/eomcs/pms/web/MemberAddHandler.java | 5cb9037e0806eb9d3444ff5c79cd6eb0b686d78f | []
| no_license | dong3512/bitcamp-project2 | 80b147b272c96754ac169271ecac50e38ca4c238 | 4ee40e1a326ba7c767ee517ecd656e32cb44555d | refs/heads/main | 2023-04-29T14:57:36.307944 | 2021-05-13T14:40:45 | 2021-05-13T14:40:45 | 345,846,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,721 | java | package com.eomcs.pms.web;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.UUID;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import com.eomcs.pms.domain.Member;
import com.eomcs.pms.service.MemberService;
import net.coobird.thumbnailator.ThumbnailParameter;
import net.coobird.thumbnailator.Thumbnails;
import net.coobird.thumbnailator.geometry.Positions;
import net.coobird.thumbnailator.name.Rename;
@SuppressWarnings("serial")
@MultipartConfig(maxFileSize = 1024 * 1024 * 10)
@WebServlet("/member/add")
public class MemberAddHandler extends HttpServlet {
private String uploadDir;
@Override
public void init() throws ServletException {
this.uploadDir = this.getServletContext().getRealPath("/upload");
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
MemberService memberService = (MemberService) request.getServletContext().getAttribute("memberService");
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>회원 등록</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>회원 등록</h1>");
try {
Member m = new Member();
m.setName(request.getParameter("name"));
m.setEmail(request.getParameter("email"));
m.setPassword(request.getParameter("password"));
m.setTel(request.getParameter("tel"));
Part photoPart = request.getPart("photo");
if (photoPart.getSize() > 0) {
// 파일을 선택해서 업로드 했다면,
String filename = UUID.randomUUID().toString();
photoPart.write(this.uploadDir + "/" + filename);
m.setPhoto(filename);
// 썸네일 이미지 생성
Thumbnails.of(this.uploadDir + "/" + filename)
.size(30, 30)
.outputFormat("jpg")
.crop(Positions.CENTER)
.toFiles(new Rename() {
@Override
public String apply(String name, ThumbnailParameter param) {
return name + "_30x30";
}
});
Thumbnails.of(this.uploadDir + "/" + filename)
.size(80, 80)
.outputFormat("jpg")
.crop(Positions.CENTER)
.toFiles(new Rename() {
@Override
public String apply(String name, ThumbnailParameter param) {
return name + "_80x80";
}
});
}
memberService.add(m);
out.println("<p>회원을 등록했습니다.</p>");
// 응답헤더에 리프래시 정보를 설정한다.
response.setHeader("Refresh", "1;url=list");
// 질문!
// 클라이언트에게 응답할 때 헤더를 먼저 보내고 콘텐트를 나중에 보내는데
// 위의 코드를 보면 println()을 이용하여 콘텐트를 먼저 출력한 다음에
// 응답 헤더를 설정하는데 이것이 가능한가요?
// - println()을 실행할 때 출력 내용은 모두 버퍼로 보낸다.
// - 즉 아직 클라이언트에게 응답한 상태가 아니기 때문에 응답헤더를 설정할 수 있는 것이다.
} catch (Exception e) {
request.setAttribute("exception",e);
request.getRequestDispatcher("/error");
return;
}
out.println("</body>");
out.println("</html>");
}
}
| [
"[email protected]"
]
| |
652bdbfdbefbc53ab12b225e43c5c34498767305 | 8eabf18793e71cecfe76c4a34dbc5e54047735a8 | /src/main/java/com/ways/os/entity/BundleTranser.java | 73969b93578106d0404251ed8ee25cd708e7980f | []
| no_license | blueghost56/weatherApp | dec8e039ed8b12e9de000555496196f65e84a78d | dfd8c506a788e36a3c2b6acf5c440e803b13497f | refs/heads/master | 2021-01-10T14:18:44.149671 | 2016-03-18T06:48:51 | 2016-03-18T06:48:51 | 53,920,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 443 | java | package com.ways.os.entity;
import java.io.Serializable;
import java.util.List;
/**
* Created by wwzy on 16/3/17.
*/
public class BundleTranser implements Serializable{
private List<? extends XModel> serializables;
public List<? extends XModel> getSerializables() {
return serializables;
}
public void setSerializables(List<? extends XModel> serializables) {
this.serializables = serializables;
}
}
| [
"[email protected]"
]
| |
bed7769d2eadcc77a1536e35ab447dafd72c9546 | fc160694094b89ab09e5c9a0f03db80437eabc93 | /java-securitycenter-settings/samples/snippets/generated/com/google/cloud/securitycenter/settings/v1beta1/securitycentersettingsservice/updatecomponentsettings/AsyncUpdateComponentSettings.java | fba78e128eb9d4091ab368eb9c0d194c96d545f5 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | googleapis/google-cloud-java | 4f4d97a145e0310db142ecbc3340ce3a2a444e5e | 6e23c3a406e19af410a1a1dd0d0487329875040e | refs/heads/main | 2023-09-04T09:09:02.481897 | 2023-08-31T20:45:11 | 2023-08-31T20:45:11 | 26,181,278 | 1,122 | 685 | Apache-2.0 | 2023-09-13T21:21:23 | 2014-11-04T17:57:16 | Java | UTF-8 | Java | false | false | 2,463 | java | /*
* Copyright 2023 Google LLC
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.securitycenter.settings.v1beta1.samples;
// [START securitycenter_v1beta1_generated_SecurityCenterSettingsService_UpdateComponentSettings_async]
import com.google.api.core.ApiFuture;
import com.google.cloud.securitycenter.settings.v1beta1.ComponentSettings;
import com.google.cloud.securitycenter.settings.v1beta1.SecurityCenterSettingsServiceClient;
import com.google.cloud.securitycenter.settings.v1beta1.UpdateComponentSettingsRequest;
import com.google.protobuf.FieldMask;
public class AsyncUpdateComponentSettings {
public static void main(String[] args) throws Exception {
asyncUpdateComponentSettings();
}
public static void asyncUpdateComponentSettings() throws Exception {
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
SecurityCenterSettingsServiceClient.create()) {
UpdateComponentSettingsRequest request =
UpdateComponentSettingsRequest.newBuilder()
.setComponentSettings(ComponentSettings.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<ComponentSettings> future =
securityCenterSettingsServiceClient.updateComponentSettingsCallable().futureCall(request);
// Do something.
ComponentSettings response = future.get();
}
}
}
// [END securitycenter_v1beta1_generated_SecurityCenterSettingsService_UpdateComponentSettings_async]
| [
"[email protected]"
]
| |
b83e588dbdd24873bed8cebe74af01183980aa7a | 1c42213d966e05d607c5417607460501a3f0a0d9 | /src/main/java/com/upnest/framework/configuration/browser/HtmlUnitBrowser.java | 816a883c11f9e056f6c28cea4509eb7a258021c4 | []
| no_license | qaninjas/upnest-automation | 304a4fa1d1bb2563f8afb9fb27091a8c5368c1f6 | b6e8dd1bbe8f18f442ffecc08e951c4d8fe31165 | refs/heads/master | 2020-12-02T00:54:17.123763 | 2020-01-16T17:09:57 | 2020-01-16T17:09:57 | 230,836,680 | 1 | 2 | null | 2020-10-13T18:31:36 | 2019-12-30T02:56:03 | Java | UTF-8 | Java | false | false | 540 | java |
package com.upnest.framework.configuration.browser;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
/**
* @author krana
*
*/
public class HtmlUnitBrowser {
public Capabilities getHtmlUnitDriverCapabilities() {
DesiredCapabilities unit = DesiredCapabilities.htmlUnitWithJs();
return unit;
}
public WebDriver getHtmlUnitDriver(Capabilities cap) {
return new HtmlUnitDriver(cap);
}
}
| [
"[email protected]"
]
| |
cd18d178e2080d3bdacf572e87df57919d6bc338 | 1c5fd654b46d3fb018032dc11aa17552b64b191c | /spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletContextInitializerBeansTests.java | d740c6e4fa5727dafb89a5d4b046046150aa8ccb | [
"Apache-2.0"
]
| permissive | yangfancoming/spring-boot-build | 6ce9b97b105e401a4016ae4b75964ef93beeb9f1 | 3d4b8cbb8fea3e68617490609a68ded8f034bc67 | refs/heads/master | 2023-01-07T11:10:28.181679 | 2021-06-21T11:46:46 | 2021-06-21T11:46:46 | 193,871,877 | 0 | 0 | Apache-2.0 | 2022-12-27T14:52:46 | 2019-06-26T09:19:40 | Java | UTF-8 | Java | false | false | 2,459 | java |
package org.springframework.boot.web.servlet;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import org.junit.Test;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link ServletContextInitializerBeans}.
*
* @author Andy Wilkinson
*/
public class ServletContextInitializerBeansTests {
private ConfigurableApplicationContext context;
@Test
public void servletThatImplementsServletContextInitializerIsOnlyRegisteredOnce() {
load(ServletConfiguration.class);
ServletContextInitializerBeans initializerBeans = new ServletContextInitializerBeans(
this.context.getBeanFactory());
assertThat(initializerBeans.size()).isEqualTo(1);
assertThat(initializerBeans.iterator()).hasOnlyElementsOfType(TestServlet.class);
}
@Test
public void filterThatImplementsServletContextInitializerIsOnlyRegisteredOnce() {
load(FilterConfiguration.class);
ServletContextInitializerBeans initializerBeans = new ServletContextInitializerBeans(
this.context.getBeanFactory());
assertThat(initializerBeans.size()).isEqualTo(1);
assertThat(initializerBeans.iterator()).hasOnlyElementsOfType(TestFilter.class);
}
private void load(Class<?> configuration) {
this.context = new AnnotationConfigApplicationContext(configuration);
}
static class ServletConfiguration {
@Bean
public TestServlet testServlet() {
return new TestServlet();
}
}
static class FilterConfiguration {
@Bean
public TestFilter testFilter() {
return new TestFilter();
}
}
static class TestServlet extends HttpServlet implements ServletContextInitializer {
@Override
public void onStartup(ServletContext servletContext) {
}
}
static class TestFilter implements Filter, ServletContextInitializer {
@Override
public void onStartup(ServletContext servletContext) {
}
@Override
public void init(FilterConfig filterConfig) {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) {
}
@Override
public void destroy() {
}
}
}
| [
"[email protected]"
]
| |
5688da40ea08f0c6b4e281537e15468c5f04fafa | 2c6dcf3dd2b5898b987ab62449fb71ae2d518e37 | /src/main/java/app/finology/service/PageParser.java | 8919efe1da20184fad31b93a537dc5268d2be2fd | []
| no_license | mahbodkh/crawler | a8d0228b6834f9bb8a58f2348dfe41491018b1ba | 7339414ce145b75ff15c60709f78edd13e14875e | refs/heads/main | 2023-06-12T20:48:37.111350 | 2021-07-08T19:41:47 | 2021-07-08T19:41:47 | 384,229,730 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,907 | java | package app.finology.service;
import app.finology.exception.CrawlerBaseException;
import app.finology.util.UrlUtil;
import lombok.extern.slf4j.Slf4j;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.parser.Parser;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Created by Ebrahim Kh.
*/
@Slf4j
public class PageParser {
public static Document parse(String url) {
if (url == null && !UrlUtil.isUrl(url)) {
throw new CrawlerBaseException(String.format("for url: [%s] can not create document.", url));
}
return getDocumentByUrl(url);
}
protected static Document getDocumentByHtml(String html) {
Document jsoupDoc = Jsoup.parse(html, "UTF-8", Parser.htmlParser());
jsoupDoc.charset(StandardCharsets.UTF_8);
return jsoupDoc;
}
protected static Document getDocumentByUrl(String url) {
try {
return Jsoup.connect(url).get();
} catch (IOException e) {
throw new CrawlerBaseException(String.format("for url: [%s] ---> exception: [%s]", url, e.getMessage()));
}
}
protected static Elements getElementsByQuery(Document html, String query) {
log.debug("looking for element: {}", query);
var elements = html.select(query);
if (elements != null) {
return elements;
}
throw new CrawlerBaseException(String.format("There isn't the element ( %s )", query));
}
protected static Elements getElementsByTag(Document html, String tag) {
log.debug("looking for element by tag: {}", tag);
var elements = html.getElementsByTag(tag);
if (elements != null) {
return elements;
}
throw new CrawlerBaseException(String.format("There isn't the element by tag ( %s )", tag));
}
protected static Set<String> findLinks(Document html) {
Elements hrefElements = getElementsByQuery(html, "a[href]");
Set<String> links = new HashSet<String>();
if (hrefElements != null && hrefElements.size() > 0) {
links = hrefElements.stream()
.map(item -> item.attr("abs:href")) // href、abs:href
.filter(UrlUtil::isUrl)
.collect(Collectors.toSet());
}
return links;
}
protected static Set<String> findImages(Document html) {
Elements imgs = getElementsByTag(html, "img");
Set<String> images = new HashSet<String>();
if (imgs != null && imgs.size() > 0) {
for (Element element : imgs) {
String imgSrc = element.attr("abs:src");
images.add(imgSrc);
}
}
return images;
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.