blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
โ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
627b80035d83e6579b94f20bba32a8ba87548aab | 24c377025b318f996fa333d82d8079e10e877c60 | /src/main/java/com/c4/intepark/review/model/vo/RvAvg.java | bf2fa214308f5e0e8e97097f6a0be7f8fe95b85b | [] | no_license | dldmstn963/intepark | 0940009080f177035ae0b187bdd873e66ce53e65 | 585dab3a85d21a097e1e5ea9f9b02bdeb7625a04 | refs/heads/master | 2022-12-22T01:01:24.479952 | 2020-01-30T08:01:25 | 2020-01-30T08:01:25 | 223,113,640 | 0 | 0 | null | 2019-12-05T06:46:54 | 2019-11-21T07:25:57 | CSS | UTF-8 | Java | false | false | 1,019 | java | package com.c4.intepark.review.model.vo;
import org.springframework.stereotype.Component;
@Component
public class RvAvg implements java.io.Serializable {
private static final long serialVersionUID = 5302L;
private double rvavg; //๋ฆฌ๋ทฐํ๊ท ์ ์
private int count; //์ด ๊ฐฏ์
private String consid;
public RvAvg() {}
public RvAvg(double rvavg, int count, String consid) {
super();
this.rvavg = rvavg;
this.count = count;
this.consid = consid;
}
public double getRvavg() {
return rvavg;
}
public void setRvavg(double rvavg) {
this.rvavg = rvavg;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public String getConsid() {
return consid;
}
public void setConsid(String consid) {
this.consid = consid;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
@Override
public String toString() {
return "RvAvg [rvavg=" + rvavg + ", count=" + count + ", consid=" + consid + "]";
}
}
| [
"[email protected]"
] | |
626c87d07155757200921d8a3b1786556300ad63 | d2c3c726a4c10060d7792bb9c3b7fd4d361acc76 | /app/src/main/java/com/example/mjetpack/ui/publish/PreviewActivity.java | de562d501a9271981ebdf52285d69dec0de3fcf3 | [] | no_license | mm46468648/JetpackVideo | fd92fa3a1c5ee1f13c66e7d96760d88a249e7443 | b515ce26b75eb3afe0e2f07992e6c1af228676e8 | refs/heads/master | 2023-06-28T11:26:59.680525 | 2021-08-05T09:26:44 | 2021-08-05T09:26:44 | 274,055,202 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,142 | java | package com.example.mjetpack.ui.publish;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import com.bumptech.glide.Glide;
import com.example.mjetpack.R;
import com.example.mjetpack.databinding.ActivityLayoutPreviewBinding;
import com.google.android.exoplayer2.DefaultLoadControl;
import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.upstream.DataSpec;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.upstream.FileDataSource;
import com.google.android.exoplayer2.util.Util;
import java.io.File;
public class PreviewActivity extends AppCompatActivity implements View.OnClickListener {
private ActivityLayoutPreviewBinding mPreviewBinding;
public static final String KEY_PREVIEW_URL = "preview_url";
public static final String KEY_PREVIEW_VIDEO = "preview_video";
public static final String KEY_PREVIEW_BTNTEXT = "preview_btntext";
public static final int REQ_PREVIEW = 1000;
private SimpleExoPlayer player;
public static void startActivityForResult(Activity activity, String previewUrl, boolean isVideo, String btnText) {
Intent intent = new Intent(activity, PreviewActivity.class);
intent.putExtra(KEY_PREVIEW_URL, previewUrl);
intent.putExtra(KEY_PREVIEW_VIDEO, isVideo);
intent.putExtra(KEY_PREVIEW_BTNTEXT, btnText);
activity.startActivityForResult(intent, REQ_PREVIEW);
activity.overridePendingTransition(0, 0);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPreviewBinding = DataBindingUtil.setContentView(this, R.layout.activity_layout_preview);
String previewUrl = getIntent().getStringExtra(KEY_PREVIEW_URL);
boolean isVideo = getIntent().getBooleanExtra(KEY_PREVIEW_VIDEO, false);
String btnText = getIntent().getStringExtra(KEY_PREVIEW_BTNTEXT);
if (TextUtils.isEmpty(btnText)) {
mPreviewBinding.actionOk.setVisibility(View.GONE);
} else {
mPreviewBinding.actionOk.setVisibility(View.VISIBLE);
mPreviewBinding.actionOk.setText(btnText);
mPreviewBinding.actionOk.setOnClickListener(this);
}
mPreviewBinding.actionClose.setOnClickListener(this);
if (isVideo) {
previewVideo(previewUrl);
} else {
previewImage(previewUrl);
}
}
private void previewImage(String previewUrl) {
mPreviewBinding.photoView.setVisibility(View.VISIBLE);
Glide.with(this).load(previewUrl).into(mPreviewBinding.photoView);
}
private void previewVideo(String previewUrl) {
mPreviewBinding.playerView.setVisibility(View.VISIBLE);
player = ExoPlayerFactory.newSimpleInstance(this, new DefaultRenderersFactory(this), new DefaultTrackSelector(), new DefaultLoadControl());
Uri uri = null;
File file = new File(previewUrl);
if (file.exists()) {
DataSpec dataSpec = new DataSpec(Uri.fromFile(file));
FileDataSource fileDataSource = new FileDataSource();
try {
fileDataSource.open(dataSpec);
uri = fileDataSource.getUri();
} catch (FileDataSource.FileDataSourceException e) {
e.printStackTrace();
}
} else {
uri = Uri.parse(previewUrl);
}
ProgressiveMediaSource.Factory factory = new ProgressiveMediaSource.Factory(new DefaultDataSourceFactory(this, Util.getUserAgent(this, getPackageName())));
ProgressiveMediaSource mediaSource = factory.createMediaSource(uri);
player.prepare(mediaSource);
player.setPlayWhenReady(true);
mPreviewBinding.playerView.setPlayer(player);
}
@Override
protected void onPause() {
super.onPause();
if (player != null) {
player.setPlayWhenReady(false);
}
}
@Override
protected void onResume() {
super.onResume();
if (player != null) {
player.setPlayWhenReady(true);
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (player != null) {
player.setPlayWhenReady(false);
player.stop(true);
player.release();
}
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.action_close) {
finish();
} else if (v.getId() == R.id.action_ok) {
setResult(RESULT_OK, new Intent());
finish();
}
}
}
| [
"[email protected]"
] | |
216e88ec8f55ee2fb5630bc7469f87aadc8d6314 | c589249a9ea618e08b8dc0a2127e5a362ad38a12 | /app/src/main/java/com/example/ll/demo02/okhttp/builder/HasParamsable.java | eaf2628452a7a7871c1a4927cb335ae680a6ccf5 | [] | no_license | xiaomu1095/Demo02 | d5c5652d9a7c066e7f2eceea43ca150e5b4a40f6 | 0502ce4295c1169dac228396cc0db5077e561f8d | refs/heads/master | 2021-01-21T04:55:34.791719 | 2016-06-20T10:09:51 | 2016-06-20T10:09:51 | 55,045,927 | 0 | 0 | null | 2016-06-20T10:09:52 | 2016-03-30T08:27:13 | Java | UTF-8 | Java | false | false | 297 | java | package com.example.ll.demo02.okhttp.builder;
import java.util.Map;
/**
* Created by zhy on 16/3/1.
*/
public interface HasParamsable {
public abstract OkHttpRequestBuilder params(Map<String, String> params);
public abstract OkHttpRequestBuilder addParams(String key, String val);
}
| [
"[email protected]"
] | |
e6ba8953d4bcca14223fe12b75aaf5de17c49289 | 4aa90348abcb2119011728dc067afd501f275374 | /app/src/main/java/com/tencent/mm/plugin/sns/ui/bb.java | 14b23ac75d01c15794d771ef2470b9f83c4b37bf | [] | no_license | jambestwick/HackWechat | 0d4ceb2d79ccddb45004ca667e9a6a984a80f0f6 | 6a34899c8bfd50d19e5a5ec36a58218598172a6b | refs/heads/master | 2022-01-27T12:48:43.446804 | 2021-12-29T10:36:30 | 2021-12-29T10:36:30 | 249,366,791 | 0 | 0 | null | 2020-03-23T07:48:32 | 2020-03-23T07:48:32 | null | UTF-8 | Java | false | false | 26,921 | java | package com.tencent.mm.plugin.sns.ui;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory.Options;
import android.graphics.Color;
import android.media.MediaMetadataRetriever;
import android.net.Uri;
import android.os.Build.VERSION;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import com.tencent.mm.compatible.util.Exif;
import com.tencent.mm.g.a.ll;
import com.tencent.mm.modelsfs.FileOp;
import com.tencent.mm.plugin.mmsight.SightCaptureResult;
import com.tencent.mm.plugin.sns.data.SnsCmdList;
import com.tencent.mm.plugin.sns.i.f;
import com.tencent.mm.plugin.sns.i.g;
import com.tencent.mm.plugin.sns.i.j;
import com.tencent.mm.plugin.sns.model.ae;
import com.tencent.mm.plugin.sns.model.av;
import com.tencent.mm.plugin.sns.model.av.a;
import com.tencent.mm.plugin.sns.model.b.b;
import com.tencent.mm.plugin.sns.ui.bc.1;
import com.tencent.mm.pluginsdk.ui.d.i;
import com.tencent.mm.pluginsdk.ui.tools.k;
import com.tencent.mm.sdk.platformtools.BackwardSupportUtil;
import com.tencent.mm.sdk.platformtools.BackwardSupportUtil.c;
import com.tencent.mm.sdk.platformtools.ac;
import com.tencent.mm.sdk.platformtools.af;
import com.tencent.mm.sdk.platformtools.bh;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.ui.base.MMPullDownView;
import com.tencent.mm.ui.base.MMPullDownView.d;
import com.tencent.mm.ui.base.MMPullDownView.e;
import com.tencent.mm.ui.base.r;
import com.tencent.mm.ui.base.u;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
public class bb implements a, b {
protected String filePath;
private String jKk;
private Activity mActivity;
protected ListView nKG;
private String nlp;
protected MMPullDownView onH;
public int qOh = 0;
private boolean qRc = false;
private String rIa;
private boolean rIb;
private int rIc;
protected LoadingMoreView rLe;
private int rLf = 0;
private boolean rLg = false;
protected boolean rLh = false;
public int rLi = 0;
a rLj;
private String rLk;
com.tencent.mm.modelsns.b rLl = null;
protected SnsHeader raX;
private boolean rtl;
protected r tipDialog = null;
protected String title;
static /* synthetic */ void e(bb bbVar) {
View inflate = LayoutInflater.from(bbVar.mActivity).inflate(g.qFf, (ViewGroup) bbVar.mActivity.findViewById(f.qFf));
u uVar = new u(bbVar.mActivity);
uVar.setGravity(48, 0, BackwardSupportUtil.b.b(bbVar.mActivity, 200.0f));
uVar.duration = 1000;
uVar.setView(inflate);
uVar.cancel();
uVar.fhK.TG();
uVar.kUH = ((int) (uVar.duration / 70)) + 1;
uVar.fhK.J(70, 70);
}
public bb(Activity activity) {
this.mActivity = activity;
}
public final void onCreate() {
this.qOh = this.mActivity.getWindowManager().getDefaultDisplay().getHeight();
ae.bvs().start();
this.nKG = this.rLj.bBK();
this.nKG.post(new 1(this));
x.i("MicroMsg.SnsActivity", "list is null ? " + (this.nKG != null));
this.nKG.setScrollingCacheEnabled(false);
this.raX = new SnsHeader(this.mActivity);
this.raX.rBG = new 6(this);
this.rLe = new LoadingMoreView(this.mActivity);
this.nKG.addHeaderView(this.raX);
this.nKG.addFooterView(this.rLe);
this.nKG.setOnScrollListener(new 7(this));
this.onH = this.rLj.bBL();
x.i("MicroMsg.SnsActivity", "pullDownView is null ? " + (this.onH != null));
this.onH.ycp = new 8(this);
this.onH.mp(false);
this.onH.mm(false);
this.onH.ycB = new 9(this);
this.onH.ycC = new d(this) {
final /* synthetic */ bb rLm;
{
this.rLm = r1;
}
public final boolean azl() {
View childAt = this.rLm.nKG.getChildAt(this.rLm.nKG.getFirstVisiblePosition());
if (childAt == null || childAt.getTop() != 0) {
return false;
}
return true;
}
};
this.onH.mn(false);
this.onH.ycq = new e(this) {
final /* synthetic */ bb rLm;
{
this.rLm = r1;
}
public final boolean azk() {
x.e("MicroMsg.SnsActivity", "bottomLoad isAll:" + this.rLm.rLh);
if (!this.rLm.rLh) {
this.rLm.rLj.bBJ();
}
return true;
}
};
this.onH.ycR = true;
MMPullDownView mMPullDownView = this.onH;
mMPullDownView.bgColor = Color.parseColor("#f4f4f4");
mMPullDownView.ycT = mMPullDownView.bgColor;
this.title = this.mActivity.getIntent().getStringExtra("sns_title");
SnsHeader snsHeader = this.raX;
Object obj = bh.ov(this.jKk) ? this.rIa : this.jKk;
String str = this.rIa;
CharSequence charSequence = this.nlp;
CharSequence charSequence2 = this.rLk;
if (obj == null || str == null) {
x.e("MicroMsg.SnsHeader", "userName or selfName is null ");
} else {
snsHeader.userName = obj.trim();
snsHeader.gze = str.trim();
snsHeader.fuf = str.equals(obj);
x.d("MicroMsg.SnsHeader", "userNamelen " + obj.length() + " " + obj);
snsHeader.rBF.ksb.setText(obj);
if (!(snsHeader.rBF == null || snsHeader.rBF.ihQ == null)) {
com.tencent.mm.pluginsdk.ui.a.b.b(snsHeader.rBF.ihQ, snsHeader.userName, true);
}
if (obj != null && obj.length() > 0) {
snsHeader.rBF.ksb.setText(i.a(snsHeader.context, com.tencent.mm.plugin.sns.data.i.A(charSequence)));
snsHeader.rBF.rqT.setText(i.b(snsHeader.context, charSequence2, snsHeader.rBF.rqT.getTextSize()));
}
snsHeader.rBF.ihQ.setContentDescription(snsHeader.context.getString(j.qKj, new Object[]{snsHeader.rBF.ksb.getText()}));
}
SnsHeader snsHeader2 = this.raX;
int type = this.rLj.getType();
snsHeader2.type = type;
if (type == 1 && snsHeader2.rBF.rqT != null) {
snsHeader2.rBF.rqT.setVisibility(8);
}
this.raX.bAT();
if (VERSION.SDK_INT < 11) {
x.d("MicroMsg.SnsActivity", "sdk not support dragdrop event");
} else {
new 5(this).run();
}
ae.bvr().gCl.add(this);
av.qSu++;
ae.bvq().a(this);
}
public final void iL(boolean z) {
this.rLj.iL(z);
}
public final void a(String str, String str2, String str3, String str4, boolean z, boolean z2, int i) {
this.rIa = str;
this.jKk = str2;
this.nlp = str3;
this.rLk = str4;
this.rIb = z;
this.rtl = z2;
this.rIc = i;
}
public static void onResume() {
ae.bvq().I(2, false);
com.tencent.mm.pluginsdk.wallet.i.CB(7);
com.tencent.mm.sdk.b.b llVar = new ll();
llVar.fCN.fCO = true;
com.tencent.mm.sdk.b.a.xef.a(llVar, Looper.getMainLooper());
x.d("MicroMsg.SnsActivity", "SnsActivity req pause auto download logic");
}
public static void onPause() {
com.tencent.mm.sdk.b.b llVar = new ll();
llVar.fCN.fCO = false;
com.tencent.mm.sdk.b.a.xef.a(llVar, Looper.getMainLooper());
x.d("MicroMsg.SnsActivity", "AppAttachDownloadUI cancel pause auto download logic");
}
/* JADX WARNING: inconsistent code. */
/* Code decompiled incorrectly, please refer to instructions dump. */
protected final void onActivityResult(int i, int i2, Intent intent) {
x.i("MicroMsg.SnsActivity", "onAcvityResult requestCode:" + i);
if (i2 == -1) {
int a;
switch (i) {
case 2:
if (intent != null) {
com.tencent.mm.kernel.g.Dk();
a = bh.a((Integer) com.tencent.mm.kernel.g.Dj().CU().get(68393, null), 0);
com.tencent.mm.kernel.g.Dk();
com.tencent.mm.kernel.g.Dj().CU().set(68393, Integer.valueOf(a + 1));
Intent intent2 = new Intent();
intent2.putExtra("CropImageMode", 4);
intent2.putExtra("CropImage_Filter", true);
intent2.putExtra("CropImage_DirectlyIntoFilter", true);
com.tencent.mm.plugin.sns.c.a.ifs.a(this.mActivity, intent, intent2, ae.getAccSnsTmpPath(), 4, new 13(this));
return;
}
return;
case 4:
if (intent != null) {
this.filePath = intent.getStringExtra("CropImage_OutputPath");
V(intent);
return;
}
return;
case 5:
this.filePath = k.b(this.mActivity.getApplicationContext(), intent, ae.getAccSnsTmpPath());
x.d("MicroMsg.SnsActivity", "onActivityResult CONTEXT_TAKE_PHOTO filePath" + this.filePath);
if (this.filePath != null) {
com.tencent.mm.kernel.g.Dk();
a = bh.a((Integer) com.tencent.mm.kernel.g.Dj().CU().get(68392, null), 0);
com.tencent.mm.kernel.g.Dk();
com.tencent.mm.kernel.g.Dj().CU().set(68392, Integer.valueOf(a + 1));
this.qRc = true;
V(intent);
return;
}
return;
case 6:
x.d("MicroMsg.SnsActivity", "onActivityResult CONTEXT_UPLOAD_MEDIA");
if (intent != null) {
this.rLj.a(intent.getIntExtra("sns_local_id", -1), null, null);
ae.bvr().buj();
return;
}
return;
case 7:
x.d("MicroMsg.SnsActivity", "onActivityResult CONTEXT_CHANGE_BG");
this.raX.bAT();
ae.bvr().buj();
return;
case 8:
if (intent != null) {
x.d("MicroMsg.SnsActivity", "onActivityResult CONTEXT_GALLERY_OP");
SnsCmdList snsCmdList = (SnsCmdList) intent.getParcelableExtra("sns_cmd_list");
if (snsCmdList != null) {
this.rLj.a(-1, snsCmdList.qQO, snsCmdList.qQP);
return;
}
return;
}
return;
case 9:
ae.bvr().buj();
c.a(this.nKG);
return;
case 10:
if (intent != null && i2 == -1) {
Cursor managedQuery = this.mActivity.managedQuery(intent.getData(), null, null, null, null);
if (managedQuery.moveToFirst()) {
this.mActivity.startActivity(new Intent("android.intent.action.EDIT", Uri.parse("content://com.android.contacts/contacts/" + managedQuery.getString(managedQuery.getColumnIndexOrThrow("_id")))));
return;
}
return;
}
return;
case 12:
a = intent.getIntExtra("sns_gallery_op_id", -1);
if (a > 0) {
x.d("MicroMsg.SnsActivity", "notify cause by del item");
SnsCmdList snsCmdList2 = new SnsCmdList();
snsCmdList2.wt(a);
this.rLj.a(-1, snsCmdList2.qQO, snsCmdList2.qQP);
return;
}
return;
case 13:
ae.bvA().auv();
return;
case 14:
new af(Looper.getMainLooper()).post(new 2(this));
ArrayList stringArrayListExtra = intent.getStringArrayListExtra("key_select_video_list");
if ((stringArrayListExtra == null || stringArrayListExtra.size() <= 0) && bh.ov(intent.getStringExtra("K_SEGMENTVIDEOPATH"))) {
Serializable stringArrayListExtra2 = intent.getStringArrayListExtra("CropImage_OutputPath_List");
if (stringArrayListExtra2 == null || stringArrayListExtra2.size() == 0) {
x.i("MicroMsg.SnsActivity", "no image selected");
return;
}
ArrayList arrayList = new ArrayList();
Iterator it = stringArrayListExtra2.iterator();
while (it.hasNext()) {
if (Exif.fromFile((String) it.next()).getLocation() != null) {
arrayList.add(String.format("%s\n%f\n%f", new Object[]{(String) it.next(), Double.valueOf(Exif.fromFile((String) it.next()).getLocation().latitude), Double.valueOf(Exif.fromFile((String) it.next()).getLocation().longitude)}));
}
}
this.qRc = intent.getBooleanExtra("isTakePhoto", false);
Intent intent3 = new Intent(this.mActivity, SnsUploadUI.class);
intent3.putExtra("KSnsPostManu", true);
intent3.putExtra("KTouchCameraTime", bh.Wo());
if (this.rLl != null) {
this.rLl.b(intent3, "intent_key_StatisticsOplog");
this.rLl = null;
}
if (this.rtl) {
intent3.putExtra("Ksnsupload_source", 11);
}
int intExtra = intent.getIntExtra("CropImage_filterId", 0);
intent3.putExtra("sns_kemdia_path_list", stringArrayListExtra2);
intent3.putExtra("KFilterId", intExtra);
if (this.qRc) {
intent3.putExtra("Kis_take_photo", true);
}
intent3.putStringArrayListExtra("sns_media_latlong_list", arrayList);
x.d("MicroMsg.SnsActivity", "shared type %d", Integer.valueOf(intent3.getIntExtra("Ksnsupload_type", -1)));
this.mActivity.startActivityForResult(intent3, 6);
return;
}
String stringExtra;
if (stringArrayListExtra == null || stringArrayListExtra.size() <= 0) {
stringExtra = intent.getStringExtra("K_SEGMENTVIDEOPATH");
} else {
stringExtra = (String) stringArrayListExtra.get(0);
}
String stringExtra2 = intent.getStringExtra("KSEGMENTVIDEOTHUMBPATH");
if (bh.ov(stringExtra2) || !FileOp.bO(stringExtra2)) {
stringExtra2 = ae.getAccSnsTmpPath() + com.tencent.mm.a.g.bV(stringExtra);
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
try {
mediaMetadataRetriever.setDataSource(stringExtra);
Bitmap frameAtTime = mediaMetadataRetriever.getFrameAtTime(0);
if (frameAtTime == null) {
x.e("MicroMsg.SnsActivity", "get bitmap error");
try {
mediaMetadataRetriever.release();
return;
} catch (Exception e) {
return;
}
}
x.i("MicroMsg.SnsActivity", "getBitmap1 %d %d", Integer.valueOf(frameAtTime.getWidth()), Integer.valueOf(frameAtTime.getHeight()));
com.tencent.mm.sdk.platformtools.d.a(frameAtTime, 80, CompressFormat.JPEG, stringExtra2, true);
Options UL = com.tencent.mm.sdk.platformtools.d.UL(stringExtra2);
x.i("MicroMsg.SnsActivity", "getBitmap2 %d %d", Integer.valueOf(UL.outWidth), Integer.valueOf(UL.outHeight));
try {
mediaMetadataRetriever.release();
} catch (Exception e2) {
}
} catch (Exception e3) {
x.e("MicroMsg.SnsActivity", "savebitmap error %s", e3.getMessage());
} catch (Throwable th) {
try {
mediaMetadataRetriever.release();
} catch (Exception e4) {
}
}
}
x.i("MicroMsg.SnsActivity", "video path %s thumb path %s and %s %s ", stringExtra, stringExtra2, Long.valueOf(FileOp.me(stringExtra)), Long.valueOf(FileOp.me(stringExtra2)));
Intent intent4 = new Intent();
intent4.putExtra("KSightPath", stringExtra);
intent4.putExtra("KSightThumbPath", stringExtra2);
intent4.putExtra("sight_md5", com.tencent.mm.a.g.bV(stringExtra));
intent4.putExtra("KSnsPostManu", true);
intent4.putExtra("KTouchCameraTime", bh.Wo());
intent4.putExtra("Ksnsupload_type", 14);
intent4.putExtra("Kis_take_photo", false);
com.tencent.mm.bm.d.b(this.mActivity, "sns", ".ui.SnsUploadUI", intent4);
return;
case 15:
return;
case 17:
SightCaptureResult sightCaptureResult = (SightCaptureResult) intent.getParcelableExtra("key_req_result");
if (sightCaptureResult == null) {
return;
}
if (sightCaptureResult.oqz) {
this.filePath = sightCaptureResult.oqH;
if (!bh.ov(this.filePath)) {
this.qRc = true;
V(intent);
return;
}
return;
}
x.i("MicroMsg.SnsActivity", "video path %s thumb path ", sightCaptureResult.oqB, sightCaptureResult.oqC);
Intent intent5 = new Intent();
intent5.putExtra("KSightPath", sightCaptureResult.oqB);
intent5.putExtra("KSightThumbPath", sightCaptureResult.oqC);
if (bh.ov(sightCaptureResult.oqE)) {
intent5.putExtra("sight_md5", com.tencent.mm.a.g.bV(sightCaptureResult.oqB));
} else {
intent5.putExtra("sight_md5", sightCaptureResult.oqE);
}
intent5.putExtra("KSnsPostManu", true);
intent5.putExtra("KTouchCameraTime", bh.Wo());
intent5.putExtra("Ksnsupload_type", 14);
intent5.putExtra("Kis_take_photo", false);
try {
byte[] toByteArray = sightCaptureResult.oqG.toByteArray();
if (toByteArray != null) {
intent5.putExtra("KMMSightExtInfo", toByteArray);
}
} catch (Exception e5) {
x.i("MicroMsg.SnsActivity", "put sight extinfo to snsuploadui error: %s", e5.getMessage());
}
com.tencent.mm.bm.d.b(this.mActivity, "sns", ".ui.SnsUploadUI", intent5);
return;
default:
x.e("MicroMsg.SnsActivity", "onActivityResult: not found this requestCode");
return;
}
} else if (i == 5 || i == 2 || i == 4) {
new af(Looper.getMainLooper()).post(new Runnable(this) {
final /* synthetic */ bb rLm;
{
this.rLm = r1;
}
public final void run() {
com.tencent.mm.plugin.sns.c.a.ift.uo();
}
});
}
}
private void V(Intent intent) {
new af(Looper.getMainLooper()).post(new 3(this));
x.d("MicroMsg.SnsActivity", "onActivityResult CONTEXT_CHOSE_IMAGE_CONFIRM");
x.d("MicroMsg.SnsActivity", "CONTEXT_CHOSE_IMAGE_CONFIRM filePath " + this.filePath);
if (this.filePath != null) {
int intExtra;
String str = "pre_temp_sns_pic" + com.tencent.mm.a.g.s((this.filePath + System.currentTimeMillis()).getBytes());
com.tencent.mm.plugin.sns.storage.r.X(ae.getAccSnsTmpPath(), this.filePath, str);
this.filePath = ae.getAccSnsTmpPath() + str;
x.d("MicroMsg.SnsActivity", "newPath " + this.filePath);
if (intent != null) {
intExtra = intent.getIntExtra("CropImage_filterId", 0);
} else {
intExtra = 0;
}
Intent intent2 = new Intent(this.mActivity, SnsUploadUI.class);
intent2.putExtra("KSnsPostManu", true);
intent2.putExtra("KTouchCameraTime", bh.Wo());
if (this.rLl != null) {
this.rLl.b(intent2, "intent_key_StatisticsOplog");
this.rLl = null;
}
intent2.putExtra("sns_kemdia_path", this.filePath);
intent2.putExtra("KFilterId", intExtra);
if (this.qRc) {
intent2.putExtra("Kis_take_photo", true);
}
if (this.rtl) {
intent2.putExtra("Ksnsupload_source", 11);
}
this.mActivity.startActivityForResult(intent2, 6);
this.qRc = false;
}
}
protected final boolean xQ(int i) {
int i2 = 3;
com.tencent.mm.kernel.g.Dk();
if (com.tencent.mm.kernel.g.Dj().isSDCardAvailable()) {
x.d("MicroMsg.SnsActivity", "selectPhoto " + i);
if (i == 2) {
Intent intent = new Intent();
intent.putExtra("username", this.rIa);
intent.setClass(this.mActivity, SettingSnsBackgroundUI.class);
this.mActivity.startActivityForResult(intent, 7);
return true;
} else if (i != 1) {
return true;
} else {
com.tencent.mm.kernel.g.Dk();
int a = bh.a((Integer) com.tencent.mm.kernel.g.Dj().CU().get(68385, null), 0);
com.tencent.mm.kernel.g.Dk();
int a2 = bh.a((Integer) com.tencent.mm.kernel.g.Dj().CU().get(68386, null), 0);
if (!this.rLg && a < 3 && a2 == 0) {
this.rLg = true;
Context context = this.mActivity;
OnClickListener 4 = new 4(this, i);
com.tencent.mm.ui.base.i.a aVar = new com.tencent.mm.ui.base.i.a(context);
aVar.Ez(j.qMK);
aVar.YG(context.getString(j.qML) + "\n\n" + context.getString(j.qMM));
aVar.EC(j.qMQ).a(4);
aVar.a(new 1());
aVar.akx().show();
return true;
} else if (this.mActivity.getSharedPreferences(ac.cfs(), 0).getString("gallery", "1").equalsIgnoreCase("0")) {
k.a(this.mActivity, 2, null);
return true;
} else {
a2 = com.tencent.mm.k.g.zY().getInt("SnsCanPickVideoFromAlbum", 1);
x.i("MicroMsg.SnsActivity", "takeVideo %d", Integer.valueOf(a2));
if (com.tencent.mm.platformtools.r.ien) {
a2 = 0;
}
if (a2 != 1 && a2 == 0) {
i2 = 1;
}
k.a(this.mActivity, 14, 9, 4, i2, false, null);
return true;
}
}
}
u.fI(this.mActivity);
return false;
}
public final void onDestroy() {
if (this.raX != null) {
SnsHeader snsHeader = this.raX;
if (!(snsHeader.rBK == null || snsHeader.rBK.isRecycled())) {
snsHeader.rBK.recycle();
}
}
com.tencent.mm.kernel.g.Dk();
if (com.tencent.mm.kernel.g.Dh().Cy()) {
ae.bvs().K(this.mActivity);
ae.bvq().b(this);
}
if (this.tipDialog != null) {
this.tipDialog.dismiss();
this.tipDialog = null;
}
com.tencent.mm.kernel.g.Dk();
if (com.tencent.mm.kernel.g.Dh().Cy()) {
ae.bvr().gCl.remove(this);
av.qSu--;
}
this.rLe.setVisibility(8);
ab.bzE();
com.tencent.mm.kernel.g.Dk();
if (com.tencent.mm.kernel.g.Dh().Cy()) {
ae.bvs().start();
}
this.nKG.setAdapter(null);
}
public final void JT(String str) {
}
public final void aF(String str, boolean z) {
}
public final void bun() {
this.raX.bAT();
}
protected final void iE(boolean z) {
x.d("MicroMsg.SnsActivity", "snsactivty onIsAll ");
this.rLe.iE(z);
}
protected final void xv(int i) {
x.d("MicroMsg.SnsActivity", "snsactivty onIsRecent ");
this.rLe.xv(i);
}
public final void L(int i, boolean z) {
this.rLj.L(i, z);
}
public final void bwe() {
if (this.raX != null) {
this.raX.bAT();
}
}
public final void aE(String str, boolean z) {
if (this.rLj.getType() == 1 && this.nKG != null && this.nKG.getAdapter() != null && (this.nKG.getAdapter() instanceof ax)) {
((ax) this.nKG.getAdapter()).notifyDataSetChanged();
}
}
public final ListView bBK() {
return this.rLj.bBK();
}
}
| [
"[email protected]"
] | |
7033215a2e246896442414a32d32663bfff6f83c | fd439b0a8f283fe3ec8aafc9108289a43b66bb11 | /src/java/Com/Admin/Controller/sendEmailservlet.java | 60dac710bfd19f6902f429212ac8a250ceea038a | [] | no_license | nppsan/MPPnew | 6786e9f1ff0a124f7ee2d0e55e3be4fef7ea16a5 | 74cda70c23bad1c6c92dee2ac584dce4e9071f92 | refs/heads/master | 2023-04-01T04:50:54.980798 | 2021-04-09T12:48:37 | 2021-04-09T12:48:37 | 334,108,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,090 | 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.Admin.Controller;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author Teju
*/
@WebServlet(name = "sendEmailservlet", urlPatterns = {"/sendEmailservlet"})
public class sendEmailservlet extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
String txtName = request.getParameter("txtName");
String txtSub = request.getParameter("txtSub");
String txtEmail = request.getParameter("txtEmail");
String txtMobNo = request.getParameter("txtMobNo");
String txtFeedback = request.getParameter("txtFeedback");
SendMail.send(txtName,txtSub,txtEmail,txtMobNo,txtFeedback);
out.println("Mail send successfully");
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"NPP@DESKTOP-7KBD033"
] | NPP@DESKTOP-7KBD033 |
77ad1dd946056fba68b900e0b8ff4dec8dd4a146 | 5d082ec8189269d772a89e4432c2453c97e3dd58 | /api/src/main/java/headfirst/modules/DataAccessModule.java | 6d88acc97b0e0175217189e15149fd83403e3a00 | [] | no_license | DavidNovo/sql | 36fb642f45a04671247e176cbaa1e819d0b1b7e8 | 2ed137d5379cb00cf0f046b2e2d209529d67aae2 | refs/heads/master | 2020-04-15T14:27:02.294361 | 2019-01-09T00:35:32 | 2019-01-09T00:35:32 | 164,756,263 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 309 | java | package headfirst.modules;
import com.google.inject.AbstractModule;
import headfirst.dataAccess.EchoRepo;
import headfirst.dataAccess.interfaces.DbRepo;
public class DataAccessModule extends AbstractModule {
@Override protected void configure() {
bind(DbRepo.class).to(EchoRepo.class);
}
}
| [
"[email protected]"
] | |
8092ed4fc6e2b163782e7299e924451062a17d5c | 945735fbd24e85b6e372e574039e5b3799c9444b | /src/com/xj/entity/Product.java | 4c61a7e9bc23e03c27ff2438c0040477427a42d8 | [] | no_license | Darrenjoe/Trading-website-ssm-jsp | 2d90bca98e2ea0ef2488ce26983cb44d7607b9ee | c0219585f10272e6badc8846e50cf7dd601f0c5c | refs/heads/master | 2020-03-22T07:53:32.288689 | 2018-07-04T14:22:19 | 2018-07-04T14:22:19 | 139,731,063 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,015 | java | package com.xj.entity;
/**
* ๅๅไฟกๆฏๅฎไฝ็ฑป
* @author Darren
* @Date 2018ๅนด4ๆ1ๆฅ ไธๅ3:31:45
*/
public class Product {
/**
* ไธป้ฎID
*/
private String id;
/**
* ๅๅๅ็งฐ
*/
private String name;
/**
* ๅๅ็ฑปๅ
*/
private String gategory;
/**
* ๅๅ็ฎไป
*/
private String productDesc;
/**
* ๅพ็ๅฐๅ
*/
private String imgUrl;
/**
* ๆฏๅฆไผๆ
*/
private int discount;
/**
* ๅๅไปทๆ ผ
*/
private String price;
/**
* ไผๆ ไปทๆ ผ
*/
private String disprice;
/**
* ๅบๅญ้
*/
private int inventory;
/**
* ็ถๆ
*/
private int state;
/**
* ็จๆทID๏ผ็จไบๅ
ณ่ไธไผ ๅๅ็็จๆท
*/
private String userId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getGategory() {
return gategory;
}
public void setGategory(String gategory) {
this.gategory = gategory;
}
public String getProductDesc() {
return productDesc;
}
public void setProductDesc(String productDesc) {
this.productDesc = productDesc;
}
public int getDiscount() {
return discount;
}
public void setDiscount(int discount) {
this.discount = discount;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getDisprice() {
return disprice;
}
public void setDisprice(String disprice) {
this.disprice = disprice;
}
public int getInventory() {
return inventory;
}
public void setInventory(int inventory) {
this.inventory = inventory;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
}
| [
"[email protected]"
] | |
a1beafedcfd099672c28d5c1c7fd78e825b74a5f | a6003881eec8dffa202a93e54bea98ffb129252b | /Library Assistant/src/library/assistant/ui/addbook/BookAddController.java | 16595c757887101f9c43f12b52c7a71eb22fa270 | [] | no_license | clemesu1/LibraryManagementSystem | 4a09ecba643fd13b23da319799fa922a4a3856f1 | 53a3b2417348611659aa44a0b0eaaf13a7ca8ed7 | refs/heads/master | 2020-04-08T13:30:36.123286 | 2018-12-05T20:16:49 | 2018-12-05T20:16:49 | 159,394,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,135 | java | package library.assistant.ui.addbook;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXTextField;
import java.net.URL;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import library.assistant.alert.AlertMaker;
import library.assistant.database.DatabaseHandler;
import library.assistant.ui.listbook.BookListController;
public class BookAddController implements Initializable {
@FXML
private JFXTextField title;
@FXML
private JFXTextField id;
@FXML
private JFXTextField author;
@FXML
private JFXTextField publisher;
@FXML
private JFXButton saveButton;
@FXML
private JFXButton cancelButton;
DatabaseHandler databaseHandler;
@FXML
private AnchorPane rootPane;
private Boolean isInEditMode = Boolean.FALSE;
@Override
public void initialize(URL url, ResourceBundle rb) {
databaseHandler = DatabaseHandler.getInstance();
checkData();
}
@FXML
private void addBook(ActionEvent event) {
String bookID = id.getText();
String bookAuthor = author.getText();
String bookName = title.getText();
String bookPublisher = publisher.getText();
if(bookID.isEmpty() || bookAuthor.isEmpty() || bookName.isEmpty() || bookPublisher.isEmpty()) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setHeaderText(null);
alert.setContentText("Please enter in all fields");
alert.showAndWait();
return;
}
if(isInEditMode) {
handleEditOperation();
return;
}
String qu = "INSERT INTO BOOK VALUES (" +
"'" + bookID + "'," +
"'" + bookName + "'," +
"'" + bookAuthor+ "'," +
"'" + bookPublisher + "'," +
"" + "true" + "" +
")";
System.out.println(qu);
if(databaseHandler.execAction(qu)) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setHeaderText(null);
alert.setContentText("Success");
alert.showAndWait();
Stage stage = (Stage) rootPane.getScene().getWindow();
stage.close();
} else //Error
{
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setHeaderText(null);
alert.setContentText("Failed");
alert.showAndWait();
}
}
@FXML
private void cancel(ActionEvent event) {
Stage stage = (Stage) rootPane.getScene().getWindow();
stage.close();
}
private void checkData() {
String qu = "SELECT title FROM BOOK";
ResultSet rs = databaseHandler.execQuery(qu);
try {
while(rs.next()) {
String titlex = rs.getString("title");
System.out.println(titlex);
}
} catch (SQLException ex) {
Logger.getLogger(BookAddController.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void inflateUI(BookListController.Book book) {
title.setText(book.getTitle());
id.setText(book.getId());
author.setText(book.getAuthor());
publisher.setText(book.getPublisher());
id.setEditable(false);
isInEditMode = Boolean.TRUE;
}
private void handleEditOperation() {
BookListController.Book book = new BookListController.Book(title.getText(), id.getText(), author.getText(), publisher.getText(), true);
if(databaseHandler.updateBook(book)) {
AlertMaker.showSimpleAlert("Success", "Book Updated");
}
else {
AlertMaker.showErrorMessage("Failed", "Cannot update book");
}
}
}
| [
"[email protected]"
] | |
793086befff313974693ed4005f883cd1b126731 | 407aef1bf4193e75d606e9470b14bdc42abbf6bc | /corant-modules/corant-modules-query/corant-modules-query-sql/src/main/java/org/corant/modules/query/sql/DefaultQueryRunner.java | 24f1457768f0d50fc96b81e470f9bccabe604961 | [
"Apache-2.0"
] | permissive | ChienHsu/corant | 344e781cc8f052e771c35e8108b4fbba2fead251 | 1225547a364a1998fc4738a65fd4d01c31c2820b | refs/heads/master | 2023-08-11T07:16:09.521934 | 2021-10-09T07:27:25 | 2021-10-09T07:27:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,803 | java | /*
* Copyright (c) 2013-2018, Bingo.Chen ([email protected]).
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package org.corant.modules.query.sql;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.Duration;
import javax.sql.DataSource;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.StatementConfiguration;
/**
* corant-modules-query-sql
*
* @author bingo ไธๅ1:21:08
*
*/
public class DefaultQueryRunner extends QueryRunner {
/**
*
*/
public DefaultQueryRunner() {}
/**
* @param pmdKnownBroken
*/
public DefaultQueryRunner(boolean pmdKnownBroken) {
super(pmdKnownBroken);
}
/**
* @param ds
*/
public DefaultQueryRunner(DataSource ds) {
super(ds);
}
/**
* @param ds
* @param pmdKnownBroken
*/
public DefaultQueryRunner(DataSource ds, boolean pmdKnownBroken) {
super(ds, pmdKnownBroken);
}
/**
* @param ds
* @param pmdKnownBroken
* @param stmtConfig
*/
public DefaultQueryRunner(DataSource ds, boolean pmdKnownBroken,
StatementConfiguration stmtConfig) {
super(ds, pmdKnownBroken, stmtConfig);
}
/**
* @param ds
* @param stmtConfig
*/
public DefaultQueryRunner(DataSource ds, StatementConfiguration stmtConfig) {
super(ds, stmtConfig);
}
/**
* @param stmtConfig
*/
public DefaultQueryRunner(StatementConfiguration stmtConfig) {
super(stmtConfig);
}
public <T> T select(String sql, ResultSetHandler<T> rsh, int expectRows, Duration timeout)
throws SQLException {
Connection conn = prepareConnection();
return this.<T>select(conn, true, sql, rsh, expectRows, timeout, (Object[]) null);
}
public <T> T select(String sql, ResultSetHandler<T> rsh, int expectRows, Duration timeout,
Object... params) throws SQLException {
Connection conn = prepareConnection();
return this.<T>select(conn, true, sql, rsh, expectRows, timeout, params);
}
<T> T select(Connection conn, boolean closeConn, String sql, ResultSetHandler<T> rsh,
int expectRows, Duration timeout, Object... params) throws SQLException {
if (conn == null) {
throw new SQLException("Null connection");
}
if (sql == null) {
if (closeConn) {
close(conn);
}
throw new SQLException("Null SQL statement");
}
if (rsh == null) {
if (closeConn) {
close(conn);
}
throw new SQLException("Null ResultSetHandler");
}
PreparedStatement stmt = null;
ResultSet rs = null;
T result = null;
try {
stmt = this.prepareStatement(conn, sql);
if (expectRows > 0) {
stmt.setMaxRows(expectRows);// force max rows
}
if (timeout != null) {
stmt.setQueryTimeout((int) timeout.toSeconds());// set the time out
}
fillStatement(stmt, params);
rs = wrap(stmt.executeQuery());
result = rsh.handle(rs);
} catch (SQLException e) {
rethrow(e, sql, params);
} finally {
try {
close(rs);
} finally {
close(stmt);
if (closeConn) {
close(conn);
}
}
}
return result;
}
}
| [
"[email protected]"
] | |
d0b8bcc313c10f44ef8547472881b49052e2e72a | 9b88a63b48e737ed6ce26690f10d0fd7bfe795a2 | /demo/based/demo/src/main/java/com/example/demo/DemoApplication.java | 73152996ee7320b35f5f6e08d731b8adbc0fcac7 | [] | no_license | zhanghouwen/demo | 8508ccd1f0a837418a11497b99640ca759efb4ef | b3a9e69bdda9449ec4543ab681494ce01dcb2486 | refs/heads/master | 2022-12-23T22:37:16.085121 | 2019-08-14T06:47:22 | 2019-08-14T06:47:22 | 202,288,309 | 2 | 1 | null | 2022-12-11T01:55:06 | 2019-08-14T06:27:15 | JavaScript | UTF-8 | Java | false | false | 565 | java | package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
| [
"[email protected]"
] | |
6fce04474d6190edd7e56e4f6f28c56a6f39de17 | ebc44a700f4d8b714ad614f73cae9915486e4f5a | /web003/src/com/hp/dao/CustomerDao.java | fb1e88a49f7cebbc72d7a75dfbe1df793b732ef9 | [] | no_license | myangml/day03 | 48231615ab0518a5bf279f444302ee6b9e37c156 | e005332440b46d9473e4e6a8db47cf075bc4e612 | refs/heads/master | 2023-07-16T16:34:18.131019 | 2021-09-06T11:09:00 | 2021-09-06T11:09:00 | 403,590,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,884 | java | package com.hp.dao;
import com.hp.entity.Customer;
import com.hp.entity.User;
import com.hp.util.DBHelper;
import com.hp.util.PageBeanUtil;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CustomerDao {
//ๅ
จๆฅ
public List<Map> selectAll(Map map) {
System.out.println(" Customer map dao = " + map);
for (Object o : map.keySet()) {
System.out.println("o = " + o);
}
String page = (String) map.get("page");
String limit = (String) map.get("limit");
String cust_name = (String) map.get("cust_name");
System.out.println("dao cust_name = " + cust_name);
String cust_phone = (String) map.get("cust_phone");
String modify_time = (String) map.get("modify_time");
String username = (String) map.get("username");
String cust_sex = (String) map.get("cust_sex");
List<Map> lists = new ArrayList<>();
Connection connection = DBHelper.getConnection();
//String sql = "select c.*,u.username from t_customer c,t_user u where c.user_id=u.id; ";
String sql = "select c.* , t.username as username , t.password as password , t.real_name as real_name , t.type as type from t_customer c join t_user t on c.user_id = t.id where 1=1 ";
// sql = sql + " and t.is_del=1 ";
if (null!=cust_name&&cust_name.length()>0){
sql = sql + " and c.cust_name like '%"+cust_name+"%' ";
}
if (null!=cust_phone&&cust_phone.length()>0){
sql = sql + " and c.cust_phone like '%"+cust_phone+"%' ";
}
if (null!=modify_time&&modify_time.length()>0){
sql = sql + " and c.modify_time like '%"+modify_time+"%' ";
}
if (null!=cust_sex&&cust_sex.length()>0){
sql = sql + " and c.cust_sex = "+cust_sex+" ";
}
if (null!=username&&username.length()>0){
sql = sql + " and username like '%"+username+"%' ";
}
sql = sql + " limit ? , ?";
System.out.println(" dao de sql = " + sql);
PreparedStatement ps = null;
ResultSet rs = null;
PageBeanUtil pageBeanUtil = new PageBeanUtil(Integer.parseInt(page),Integer.parseInt(limit));
try {
ps = connection.prepareStatement(sql);
ps.setInt(1,pageBeanUtil.getStart());
ps.setInt(2,Integer.parseInt(limit));
// System.out.println("ps = " + ps);
rs = ps.executeQuery();
while(rs.next()) {
Map datamap = new HashMap();
datamap.put("id",rs.getInt("id"));
datamap.put("cust_name",rs.getString("cust_name"));
datamap.put("cust_company",rs.getString("cust_company"));
datamap.put("cust_birth",rs.getString("cust_birth"));
datamap.put("cust_sex",rs.getInt("cust_sex"));
datamap.put("cust_phone",rs.getString("cust_phone"));
datamap.put("cust_position",rs.getString("cust_position"));
datamap.put("create_time",rs.getString("create_time"));
datamap.put("modify_time",rs.getString("modify_time"));
datamap.put("username",rs.getString("username"));
datamap.put("password",rs.getString("password"));
datamap.put("real_name",rs.getString("real_name"));
datamap.put("type",rs.getString("type"));
lists.add(datamap);
}
} catch (SQLException e) {
e.printStackTrace();
}finally {
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return lists;
}
//ๆฅ่ฏขๆปๆกๆฐ
public int selectCount(Map map){
String cust_name = (String) map.get("cust_name");
String cust_phone = (String) map.get("cust_phone");
String modify_time = (String) map.get("modify_time");
String username = (String) map.get("username");
String cust_sex = (String) map.get("cust_sex");
Connection connection = DBHelper.getConnection();
//2. ๅsql
String sql = " select count(*) total from t_customer c join t_user t on c.user_id = t.id where 1=1 ";
if (null!=cust_name&&cust_name.length()>0){
sql = sql + " and c.cust_name like '%"+cust_name+"%' ";
}
if (null!=cust_phone&&cust_phone.length()>0){
sql = sql + " and c.cust_phone like '%"+cust_phone+"%' ";
}
if (null!=modify_time&&modify_time.length()>0){
sql = sql + " and c.modify_time like '%"+modify_time+"%' ";
}
if (null!=cust_sex&&cust_sex.length()>0){
sql = sql + " and c.cust_sex = "+cust_sex+" ";
}
if (null!=username&&username.length()>0){
sql = sql + " and username like '%"+username+"%' ";
}
System.out.println("sql count ็ = " + sql);
PreparedStatement ps=null;
ResultSet rs=null;
int total = 0;
try {
ps = connection.prepareStatement(sql);
rs = ps.executeQuery();
if (rs.next()) {
total = rs.getInt("total");
}
} catch (SQLException e) {
e.printStackTrace();
}finally {
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return total;
}
//ๆทปๅ
public int addCustomer(Customer customer) {
Connection conn = null;
PreparedStatement ps = null;
int i = 0;
try {
//ๅผ้พๆฅ
conn = DBHelper.getConnection();
//ๅsql
String sql = "insert into t_customer values(null,?,?,?,?,?,?,?,?,?,?)";
System.out.println("insert sql = " + sql);
ps = conn.prepareStatement(sql);
ps.setString(1,customer.getCust_name());
ps.setString(2,customer.getCust_company());
ps.setString(3,customer.getCust_position());
ps.setString(4,customer.getCust_phone());
ps.setString(5,customer.getCust_birth());
ps.setInt(6,customer.getCust_sex());
ps.setString(7,customer.getCust_desc());
ps.setInt(8,customer.getUser_id());
ps.setString(9,customer.getCreate_time());
ps.setString(10,customer.getModify_time());
i = ps.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}finally{
try { conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return i;
}
//ๆidๅ ้ค
public int delectIdCustomer(Integer id){
PreparedStatement pstm = null;
int i = 0;
Connection conn=DBHelper.getConnection();
String sql = "delete from t_customer where id=?";
try {
pstm = conn.prepareStatement(sql);
pstm.setInt(1, id);
i = pstm.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}finally{
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return i;
}
public static void main(String[] args) {
// Customer customer = new Customer();
// customer.setCust_name("yingying");
// customer.setCust_company("jituan");
// customer.setCust_position("cc");
// customer.setCust_phone("15617245676");
// customer.setCust_birth("2007-03-07");
// customer.setCust_sex(2);
// customer.setCust_desc("dgfbv");
// customer.setUser_id(25);
// customer.setCreate_time("2007-03-07");
// customer.setModify_time("2007-03-08");
// Map paramMap =new HashMap();
// paramMap.put("page","1");
// paramMap.put("limit","5");
// CustomerDao dao = new CustomerDao();
// int i = dao.delectIdCustomer(18);
// System.out.println("i = " + i);
// int i = dao.addCustomer(customer);
// List users = dao.selectAll();
// for (Object customer:users) {
// System.out.println("Customer = " + customer);
// }
// int i = dao.selectCount(paramMap);
// System.out.println("i = " + i);
// List<Map> customer = dao.selectAll(paramMap);
// System.out.println("customer = " + customer);
// System.out.println("customer = " + customer.size());
}
}
| [
"[email protected]"
] | |
7f6fe729b18c87f3b783fab0af9809ba0d9c68ad | 6baf1fe00541560788e78de5244ae17a7a2b375a | /hollywood/com.oculus.browser-base/sources/defpackage/C5540x61.java | c855625640b775f0fb28a48c91c5aa0c34f51709 | [] | no_license | phwd/quest-tracker | 286e605644fc05f00f4904e51f73d77444a78003 | 3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba | refs/heads/main | 2023-03-29T20:33:10.959529 | 2021-04-10T22:14:11 | 2021-04-10T22:14:11 | 357,185,040 | 4 | 2 | null | 2021-04-12T12:28:09 | 2021-04-12T12:28:08 | null | UTF-8 | Java | false | false | 781 | java | package defpackage;
import java.util.List;
import org.chromium.chrome.browser.tab.Tab;
/* renamed from: x61 reason: default package and case insensitive filesystem */
/* compiled from: chromium-OculusBrowser.apk-stable-281887347 */
public class C5540x61 extends RK {
/* renamed from: a reason: collision with root package name */
public final /* synthetic */ C5880z61 f11589a;
public C5540x61(C5880z61 z61) {
this.f11589a = z61;
}
@Override // defpackage.RK
public void a(List list, List list2, boolean z) {
this.f11589a.b();
}
@Override // defpackage.RK
public void b(Tab tab, int i) {
this.f11589a.b();
}
@Override // defpackage.RK
public void d(Tab tab, int i) {
this.f11589a.b();
}
}
| [
"[email protected]"
] | |
fda7babe94a64eb346f056be10b3e36a33ffe6f9 | bc198450e0b7c8718da535f5420ad0cf794e6d97 | /samspring3/src/main/java/com/sampackage/service/CustomerService.java | 6299a4e02902991db8c68f160195ec36494b8e70 | [] | no_license | sakkoub/SpringSamples | 7ad7e83e7d332d747a5e4a90732cf003f6192c63 | ae68481d64b15c4fec070798d9d3777d9d01048e | refs/heads/master | 2022-07-19T12:12:20.899704 | 2022-07-13T07:08:30 | 2022-07-13T07:08:30 | 151,923,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 163 | java | package com.sampackage.service;
import com.sampackage.model.Customer;
import java.util.List;
public interface CustomerService {
List<Customer> findAll();
}
| [
"[email protected]"
] | |
b99abd17202b3afaf78da3c3ae4991c2ef46b9f8 | 492843b1374fd5466d6bf79630290aab9fe17c3b | /src/main/java/it/aegidea/wolf/model/repos/UserRepository.java | fc80793f4dc2e74e2dabd6f5036d9138e1e58772 | [] | no_license | il-lore/tmp_wolf | 7ceda774caf451a79958eb3f3a696c3da680c9c4 | 33eabeff05f0d98f1a1120f1f8a8d9dff7545063 | refs/heads/master | 2021-05-10T13:39:43.895223 | 2018-01-23T11:02:04 | 2018-01-23T11:02:04 | 118,487,180 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 284 | java | package it.aegidea.wolf.model.repos;
import it.aegidea.wolf.model.beans.auth.WfUser;
import org.springframework.data.repository.Repository;
public interface UserRepository extends Repository<WfUser, Long> {
WfUser findById(Long id);
WfUser findByUsername(String username);
}
| [
"[email protected]"
] | |
caac77b5ac5aebe6e54d7304e33d3c7be23c1edd | 9987110960a600d05c335de20a118da712b29191 | /android/jdonkey/src/main/java/org/dkf/jmule/adapters/menu/ShowThePathMenuAction.java | a7b70d8c0ea925ec463e3ac73689b805753a79da | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | a-pavlov/jed2k | 57a9a23a018cf52f7aaa54bc977cc9be02b6c8e8 | c27cc2b28c01789e09511f8446934e6555863858 | refs/heads/master | 2023-08-31T20:22:28.949276 | 2023-08-22T16:58:22 | 2023-08-22T16:58:22 | 35,595,139 | 123 | 55 | NOASSERTION | 2023-08-21T19:15:39 | 2015-05-14T06:32:38 | Java | UTF-8 | Java | false | false | 3,060 | java | package org.dkf.jmule.adapters.menu;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import org.dkf.jmule.Platforms;
import org.dkf.jmule.R;
import org.dkf.jmule.transfers.Transfer;
import org.dkf.jmule.util.Ref;
import org.dkf.jmule.views.AbstractDialog;
import org.dkf.jmule.views.MenuAction;
import java.lang.ref.WeakReference;
public class ShowThePathMenuAction extends MenuAction {
private final Transfer transfer;
@SuppressWarnings("WeakerAccess")
public final static class ShowThePathDialog extends AbstractDialog {
Context context;
String filename;
public static ShowThePathDialog newInstance(Context context, String filename) {
return new ShowThePathDialog(context, filename);
}
// Important to keep this guy 'public', even if IntelliJ thinks you shouldn't.
// otherwise, the app crashes when you turn the screen and the dialog can't
public ShowThePathDialog(Context contex, String filename) {
super(R.layout.dialog_default_info);
this.context = contex;
this.filename = filename;
}
@Override
protected void initComponents(Dialog dlg, Bundle savedInstanceState) {
TextView title = findView(dlg, R.id.dialog_default_info_title);
title.setText(R.string.transfers_context_menu_show_path_title);
TextView text = findView(dlg, R.id.dialog_default_info_text);
String pathsTemplate = context.getResources().getString(R.string.transfers_context_menu_show_path_body);
String pathsStr = String.format(pathsTemplate, Platforms.data().getAbsolutePath(), filename);
text.setText(pathsStr);
Button okButton = findView(dlg, R.id.dialog_default_info_button_ok);
okButton.setText(android.R.string.ok);
okButton.setOnClickListener(new OkButtonOnClickListener(dlg));
}
}
private final static class OkButtonOnClickListener implements View.OnClickListener {
private final WeakReference<Dialog> dialogPtr;
OkButtonOnClickListener(Dialog newNoWifiInformationDialog) {
this.dialogPtr = Ref.weak(newNoWifiInformationDialog);
}
@Override
public void onClick(View view) {
if (Ref.alive(dialogPtr)) {
dialogPtr.get().dismiss();
}
}
}
public ShowThePathMenuAction(Context context
, Transfer transfer) {
super(context, R.drawable.ic_search_black_24dp, R.string.transfers_context_menu_show_path_title);
this.transfer = transfer;
}
@Override
protected void onClick(Context context) {
if (transfer != null) {
ShowThePathDialog dialog = ShowThePathDialog.newInstance(context, transfer.getFilePath());
dialog.show(((Activity)context).getFragmentManager());
}
}
}
| [
"[email protected]"
] | |
56d384e0b99e26413424c1e9e9271bd9a7f51113 | 6abef99fe11266fbe9cf400003e821d3ffab29e5 | /JohnProject/src/main/java/com/kh/john/member/socket/MemberSocketHandler.java | d08b9421642c915db431772126a4c0746f5ffe56 | [] | no_license | jackson-hong/projectjohn | 55ed636798a4327f3f2b7a029a4b94ec5ac974bc | d569536b6e3fd68cd7960d1801111dc1ed26da0d | refs/heads/master | 2023-02-07T13:59:16.856881 | 2020-12-30T14:49:48 | 2020-12-30T14:49:48 | 323,524,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,838 | java | package com.kh.john.member.socket;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.SessionAttribute;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.kh.john.member.model.service.MemberService;
import com.kh.john.member.model.vo.Member;
import com.kh.john.member.model.vo.MemberChat;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class MemberSocketHandler extends TextWebSocketHandler {
@Autowired
private MemberService service;
Map<Member, WebSocketSession> users= new HashMap<Member, WebSocketSession>();
private ObjectMapper objectMapper=new ObjectMapper();
@Override
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
log.debug("********๋ฉค๋ฒ ์์ผ ํธ๋ค๋ฌ ์คํ********");
Map<String, Object> map=session.getAttributes();
Member member=(Member)map.get("loginMember");
users.put(member, session);
}
@Override
protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
List<MemberChat> allChatList=service.loadAllChatList();
if(message.getPayload().equals("messageOnOpen")) {
session.sendMessage(new TextMessage(objectMapper.writeValueAsString(allChatList)));
return;
}
MemberChat memberChat=objectMapper.readValue(message.getPayload(), MemberChat.class);//JSON์ผ๋ก ๋ฐ์ ๋ฉ์ธ์ง๋ฅผ ํด์ํด์ memberChat ๊ฐ์ฒด์ ์ ์ฅ
allChatList=service.reloadChatList(memberChat);//์ ์ฅ
//map์ ๋ฐ๋ณต๋ฌธ ๋๋ฆด ์ ์๋๋ก ํด์ฃผ๋ ๊ฒ
Iterator<Member> it=users.keySet().iterator();//users๋ผ๋ map ์ ์ฒด๋ฅผ ๋๋ฆด ๊ฒ์ด๋ค
while(it.hasNext()) {
Member key=it.next();//user์ ์๋ Member๊ฐ์ฒด๋ก ํ๋์ฉ ๋ฝ์์์ key๋ณ์๋ก ์ง์
users.get(key).sendMessage(new TextMessage(objectMapper.writeValueAsString(allChatList)));
}
}
@Override
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception {
log.debug("********๋ฉค๋ฒ ์์ผ ํธ๋ค๋ฌ ์ข
๋ฃ********");
List<Member> keyList=new ArrayList<Member>();
Iterator<Member> it=users.keySet().iterator();
while(it.hasNext()) {
Member key=it.next();
if(users.get(key).equals(session)) {
keyList.add(key);
}
}
for(Member listKey : keyList) {
users.remove(listKey);
}
}
}
| [
"[email protected]"
] | |
58526e7e29e7dfafc681a7d7b4ef36f7cbc5feea | 0ab5692d673902fdb2abb2821518cdd7b5911b83 | /tester-common/src/main/java/com/tester/testercommon/util/endecrypt/Md5Security.java | b3d76fd039248cf19552da4e6342e6de6a6b599b | [] | no_license | Tticc/test-parent | c3e7013d64b45be76e8c6f99756a790850b37c37 | 56925bfcc845d314d3d2d8571e7eb13860cda16d | refs/heads/master | 2023-07-25T16:03:25.398450 | 2023-07-19T06:36:27 | 2023-07-19T06:36:27 | 230,424,535 | 0 | 1 | null | 2023-02-22T08:28:57 | 2019-12-27T10:32:51 | JavaScript | UTF-8 | Java | false | false | 797 | java | package com.tester.testercommon.util.endecrypt;
import org.springframework.util.DigestUtils;
/**
* @Author ๆธฉๆ่ฅ
* @Date
*/
public class Md5Security {
public static void main(String[] args) throws Exception {
String pwd = "123456";
String salt = "305a878cd5e668aebb66baa6";
String encrypt = encrypt(pwd + salt);
System.out.println("final pwd: " + encrypt);
}
private static String SECRET_KEY = "e95f8a3e7205ced3e12o";
public static String encrypt(String message) throws Exception {
message = message + SECRET_KEY;
return DigestUtils.md5DigestAsHex(message.getBytes("UTF-8"));
}
public String decrypt(String ciphertext) throws Exception {
throw new RuntimeException("Do not support decryption.");
}
}
| [
"[email protected]"
] | |
18f121c30be25c1e3922790b764be7eb8b67b7ab | bf80feaf90a5b0f25f336e605623f25e405fa9e6 | /app/src/test/java/com/proyecto/atodoloancho/ExampleUnitTest.java | 2c5a1bec38c73eeda0bd9ad5b9566b8bee29948e | [] | no_license | MarioOsuna/ATodoLoAncho | 7be16c38c2690755b536441c693c9d2d51ae9bd0 | 30cf638d2c806109d695479969cc8b644d4ada3d | refs/heads/master | 2022-12-25T19:22:39.257509 | 2020-10-08T07:45:55 | 2020-10-08T07:45:55 | 302,267,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.proyecto.atodoloancho;
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() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
5dafae67d4b894ffbf5b43c6506b18150b48df41 | 79165ff35a29a5fb4b7f6bfce7fcd6d213c531c2 | /circleindicatorcard/src/main/java/dom/ui/circleindicatorcard/layoutmanager/CenterSnapHelper.java | c733fd0bf69b46b3bd202b9875dfa26738d8fe82 | [
"MIT"
] | permissive | dominicg666/CardSlider | e4bce9d160bad64db132c8f0524a390d0b36c4ff | 08b442d5592b75f459acc82a35a762903cdede2e | refs/heads/master | 2020-03-18T14:27:08.940086 | 2018-05-25T13:36:39 | 2018-05-25T13:36:39 | 134,848,767 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,501 | java | package dom.ui.circleindicatorcard.layoutmanager;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.LayoutManager;
import android.view.animation.DecelerateInterpolator;
import android.widget.Scroller;
/**
* Class intended to support snapping for a {@link RecyclerView}
* which use {@link BannerLayoutManager} as its {@link LayoutManager}.
* <p>
* The implementation will snap the center of the target child view to the center of
* the attached {@link RecyclerView}.
*/
public class CenterSnapHelper extends RecyclerView.OnFlingListener {
RecyclerView mRecyclerView;
Scroller mGravityScroller;
/**
* when the dataSet is extremely large
* {@link #snapToCenterView(BannerLayoutManager, BannerLayoutManager.OnPageChangeListener)}
* may keep calling itself because the accuracy of float
*/
private boolean snapToCenter = false;
// Handles the snap on scroll case.
private final RecyclerView.OnScrollListener mScrollListener =
new RecyclerView.OnScrollListener() {
boolean mScrolled = false;
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
final BannerLayoutManager layoutManager =
(BannerLayoutManager) recyclerView.getLayoutManager();
final BannerLayoutManager.OnPageChangeListener onPageChangeListener =
layoutManager.onPageChangeListener;
if (onPageChangeListener != null) {
onPageChangeListener.onPageScrollStateChanged(newState);
}
if (newState == RecyclerView.SCROLL_STATE_IDLE && mScrolled) {
mScrolled = false;
if (!snapToCenter) {
snapToCenter = true;
snapToCenterView(layoutManager, onPageChangeListener);
} else {
snapToCenter = false;
}
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (dx != 0 || dy != 0) {
mScrolled = true;
}
}
};
@Override
public boolean onFling(int velocityX, int velocityY) {
BannerLayoutManager layoutManager = (BannerLayoutManager) mRecyclerView.getLayoutManager();
if (layoutManager == null) {
return false;
}
RecyclerView.Adapter adapter = mRecyclerView.getAdapter();
if (adapter == null) {
return false;
}
if (!layoutManager.getInfinite() &&
(layoutManager.mOffset == layoutManager.getMaxOffset()
|| layoutManager.mOffset == layoutManager.getMinOffset())) {
return false;
}
final int minFlingVelocity = mRecyclerView.getMinFlingVelocity();
mGravityScroller.fling(0, 0, velocityX, velocityY,
Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE);
if (layoutManager.mOrientation == BannerLayoutManager.VERTICAL
&& Math.abs(velocityY) > minFlingVelocity) {
final int currentPosition = layoutManager.getCurrentPosition();
final int offsetPosition = (int) (mGravityScroller.getFinalY() /
layoutManager.mInterval / layoutManager.getDistanceRatio());
mRecyclerView.smoothScrollToPosition(layoutManager.getReverseLayout() ?
currentPosition - offsetPosition : currentPosition + offsetPosition);
return true;
} else if (layoutManager.mOrientation == BannerLayoutManager.HORIZONTAL
&& Math.abs(velocityX) > minFlingVelocity) {
final int currentPosition = layoutManager.getCurrentPosition();
final int offsetPosition = (int) (mGravityScroller.getFinalX() /
layoutManager.mInterval / layoutManager.getDistanceRatio());
mRecyclerView.smoothScrollToPosition(layoutManager.getReverseLayout() ?
currentPosition - offsetPosition : currentPosition + offsetPosition);
return true;
}
return true;
}
/**
* Please attach after {{@link LayoutManager} is setting}
* Attaches the {@link CenterSnapHelper} to the provided RecyclerView, by calling
* {@link RecyclerView#setOnFlingListener(RecyclerView.OnFlingListener)}.
* You can call this method with {@code null} to detach it from the current RecyclerView.
*
* @param recyclerView The RecyclerView instance to which you want to add this helper or
* {@code null} if you want to remove CenterSnapHelper from the current
* RecyclerView.
* @throws IllegalArgumentException if there is already a {@link RecyclerView.OnFlingListener}
* attached to the provided {@link RecyclerView}.
*/
public void attachToRecyclerView(@Nullable RecyclerView recyclerView)
throws IllegalStateException {
if (mRecyclerView == recyclerView) {
return; // nothing to do
}
if (mRecyclerView != null) {
destroyCallbacks();
}
mRecyclerView = recyclerView;
if (mRecyclerView != null) {
final LayoutManager layoutManager = mRecyclerView.getLayoutManager();
if (!(layoutManager instanceof BannerLayoutManager)) return;
setupCallbacks();
mGravityScroller = new Scroller(mRecyclerView.getContext(),
new DecelerateInterpolator());
snapToCenterView((BannerLayoutManager) layoutManager,
((BannerLayoutManager) layoutManager).onPageChangeListener);
}
}
void snapToCenterView(BannerLayoutManager layoutManager,
BannerLayoutManager.OnPageChangeListener listener) {
final int delta = layoutManager.getOffsetToCenter();
if (delta != 0) {
if (layoutManager.getOrientation()
== BannerLayoutManager.VERTICAL)
mRecyclerView.smoothScrollBy(0, delta);
else
mRecyclerView.smoothScrollBy(delta, 0);
} else {
// set it false to make smoothScrollToPosition keep trigger the listener
snapToCenter = false;
}
if (listener != null)
listener.onPageSelected(layoutManager.getCurrentPosition());
}
/**
* Called when an instance of a {@link RecyclerView} is attached.
*/
void setupCallbacks() throws IllegalStateException {
if (mRecyclerView.getOnFlingListener() != null) {
throw new IllegalStateException("An instance of OnFlingListener already set.");
}
mRecyclerView.addOnScrollListener(mScrollListener);
mRecyclerView.setOnFlingListener(this);
}
/**
* Called when the instance of a {@link RecyclerView} is detached.
*/
void destroyCallbacks() {
mRecyclerView.removeOnScrollListener(mScrollListener);
mRecyclerView.setOnFlingListener(null);
}
}
| [
"[email protected]"
] | |
32e27d0903249ba858437dfa6c9c121eacd4f27c | df0fe59ab2c19d0c30fa928b774dd12b96963347 | /gesso-criteria/src/main/java/ec/com/gesso/criteria/from/fetch/impl/FetchEntityEager.java | 5de00e99da12ec88dbfb8753c52001efcd7a6d02 | [] | no_license | gaortiz1/PREVEN | 06fdb17020ae9a0cf51b16b5199424ee9bf0d7a6 | 4980373903d99d3d241f03ef7be520977c3eab91 | refs/heads/master | 2021-03-12T21:55:32.412933 | 2015-08-05T02:44:56 | 2015-08-05T02:44:56 | 37,887,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 926 | java | /**
*
*/
package ec.com.gesso.criteria.from.fetch.impl;
import javax.persistence.criteria.From;
import org.hibernate.jpa.criteria.FromImplementor;
import ec.com.gesso.criteria.entity.attribute.basic.AttributeOneValue;
import ec.com.gesso.criteria.entity.attribute.decorator.AttributeJoin;
import ec.com.gesso.criteria.from.AbstractTemplateFrom;
import ec.com.gesso.criteria.from.FromCriteria;
/**
* @author gortiz
*
*/
public final class FetchEntityEager extends AbstractTemplateFrom<AttributeJoin<AttributeOneValue>> {
private FetchEntityEager(From<?, ?> from) {
super(from);
}
public static FromCriteria<AttributeJoin<AttributeOneValue>> join(final From<?, ?> from){
return new FetchEntityEager(from);
}
@Override
public From<?, ?> getFrom(AttributeJoin<AttributeOneValue> field) {
return (FromImplementor<?, ?>) from.fetch(field.getNombreCampo(), field.getJoinTypeCriteria().getJoinType());
}
}
| [
"[email protected]"
] | |
5d4b083c1fc1e2689c00faa0ef87c712eeef2a9b | eec1c4c8b8688f7418b01008b54f42f9c807cf54 | /solid-concepts/src/com/morfeu/ocp/StartOCP.java | 47470291fe950ac9c237fec2fef969195bd78a30 | [
"Apache-2.0"
] | permissive | devmorfeu/design-patterns | a594cc9f8d3e2030b340c137eb6d50fa2c01a0b6 | 9717ae5cdde29828d684a148da88247865ece9ec | refs/heads/main | 2023-08-19T01:35:35.676131 | 2021-10-17T22:18:00 | 2021-10-17T22:18:00 | 412,223,291 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 696 | java | package com.morfeu.ocp;
import com.morfeu.ocp.vehicles.Car;
import com.morfeu.ocp.vehicles.Motorcycle;
import com.morfeu.ocp.vehicles.TypeVehicle;
/**
* OPEN/CLOSED PRINCIPLE
* "aberto para extensรฃo e fechado para modificaรงรฃo"
*
* Ou seja, as entidades de software como classes, mรณdulos, funรงรตes,
* etc, devem estar abertas para extensรฃo, porรฉm fechadas para modificaรงรฃo.
*/
public class StartOCP {
public static void main(String[] args) {
var typeVehicle = TypeVehicle.MOTORCYCLE;
if (typeVehicle == TypeVehicle.CAR) {
new Car("preto", "2021", 2.0, 4);
} else {
new Motorcycle("azul", "2021", 250);
}
}
}
| [
"[email protected]"
] | |
4dcf35b5f180c77150d57525380db34d2ed87d57 | 94c4e9779877c30f6f2fe3e4e47ee23740be3e77 | /zenofAS/launcher/src/main/java/com/cooeeui/brand/zenlauncher/widgets/weather/WeatherWidget.java | a520717ad7da52f4a33e63d321cf1dbb53218f06 | [] | no_license | MatrixYang/testproject | 53705220185c3d1058749cbda84f24ead88a1af5 | b501fd3dbe3d4d280c1c59c98df3720fe4b11313 | refs/heads/master | 2021-01-01T17:46:08.161020 | 2017-07-24T05:42:47 | 2017-07-24T05:42:47 | 98,152,924 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package com.cooeeui.brand.zenlauncher.widgets.weather;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
/**
* Created by Administrator on 2016/3/3.
*/
public class WeatherWidget extends AppWidgetProvider {
public WeatherWidget(){
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
super.onUpdate(context, appWidgetManager, appWidgetIds);
}
}
| [
"[email protected]"
] | |
99792fdde9cc2cdbb8121a366e8e66e033ad470c | 648ad4ed5d69b7dc9835cc2d4fe020cb1926498a | /src/main/java/com/example/Calculator/BaseFragment.java | 23ebcce4fb19b8d7dba760a81bb24d9da417fd23 | [] | no_license | radhica/Calculator-Android | 636fcd40ac8e537924e0a3095689f4b8f75e9162 | 0568526a96f53731892f4eb3db1048d943c8be59 | refs/heads/master | 2021-01-02T06:32:01.843898 | 2014-07-21T03:27:59 | 2014-07-21T03:27:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package com.example.Calculator;
import android.app.Fragment;
import com.example.Events.BaseEvent;
import com.squareup.otto.Bus;
/**
* Created by rsampath on 7/16/14.
*/
public class BaseFragment extends Fragment {
public void postToBus( BaseEvent event )
{
CalculatorApplication.postToBus( event );
}
@Override
public void onResume()
{
super.onResume();
registerWithBus();
}
@Override
public void onPause()
{
super.onPause();
unRegisterFromBus();
}
private void registerWithBus()
{
getBus().register(this);
}
private void unRegisterFromBus()
{
getBus().unregister( this );
}
protected Bus getBus()
{
return CalculatorApplication.getInstance().getBus();
}
} | [
"[email protected]"
] | |
00f7ae3a187eb28b8160d8c298a4ed6ee440b408 | c6d098560193122ca64c3e10f73d980a068a9b42 | /jd1-homework/src/by/htp/hometask/array2d/Task19.java | 5e1d4fffb96bae80374f20e148a0ce8aaeb46a8f | [] | no_license | VictorPetrakov/Arrays2dTask-app | 088ee834633937595f7db899bc366d5b17424439 | f6853ac97ffb6274d022b1996dede7bd1690fed7 | refs/heads/master | 2021-04-09T19:59:12.254308 | 2020-03-21T14:04:01 | 2020-03-21T14:04:01 | 248,874,625 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,092 | java | package by.htp.hometask.array2d;
//19. ะกัะพัะผะธัะพะฒะฐัั ะบะฒะฐะดัะฐัะฝัั ะผะฐััะธัั ะฟะพััะดะบะฐ n ะฟะพ ะทะฐะดะฐะฝะฝะพะผั ะพะฑัะฐะทัั(n - ัะตัะฝะพะต):
//| 1 1 1 ... 1 1 1|
//| 0 1 1 ... 1 1 0|
//| 0 0 1 ... 1 0 0|
//| 0 0 1 ... 1 0 0|
//| 0 1 1 ... 1 1 0|
//| 1 1 1 ... 1 1 1|
public class Task19 {
public static void main(String[] args) {
int n;
int m;
n = 6;
m = 6;
int mas[][] = new int[n][m];
for (int i = 0; i < mas.length; i++) {
for (int j = 0; j < mas.length; j++) {
if (i <= j && i + j < n) {
mas[i][j] = 1;
}
if (i > j && i + j >= n) {
mas[i][j] = 1;
}
}
}
for (int i = 0; i < mas.length; i++) {
mas[i][i] = 1;
}
int k;
k = mas.length - 1;
for (int i = 0; i < mas.length; i++) {
mas[i][k] = 1;
k--;
}
for (int i = 0; i < mas.length; i++) {
for (int j = 0; j < mas[i].length; j++) {
System.out.print(mas[i][j] + " ");
}
System.out.println();
}
}
}
| [
"[email protected]"
] | |
61a6eb6de31badfe5389e079915dc1740713d4be | e21f59e9130d79a21825d6a689fc36f654c0f0cd | /src/main/java/com/lek/app/web/rest/util/PaginationUtil.java | 6ee9bdbd6ddec0cbf31445396375b55da2467872 | [] | no_license | LekTerMiNaL/learnJhipster | ef5fbf5ef7a239fbb3d7cc4fd1cb9121ac641adb | 5599d73f788538a0b318ce44dc62a5d41ab02b64 | refs/heads/master | 2021-01-09T20:22:29.135738 | 2016-06-28T17:28:27 | 2016-06-28T17:28:38 | 62,161,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,912 | java | package com.lek.app.web.rest.util;
import org.springframework.data.domain.Page;
import org.springframework.http.HttpHeaders;
import java.net.URI;
import java.net.URISyntaxException;
/**
* Utility class for handling pagination.
*
* <p>
* Pagination uses the same principles as the <a href="https://developer.github.com/v3/#pagination">Github API</a>,
* and follow <a href="http://tools.ietf.org/html/rfc5988">RFC 5988 (Link header)</a>.
*/
public class PaginationUtil {
public static HttpHeaders generatePaginationHttpHeaders(Page<?> page, String baseUrl)
throws URISyntaxException {
HttpHeaders headers = new HttpHeaders();
headers.add("X-Total-Count", "" + page.getTotalElements());
String link = "";
if ((page.getNumber() + 1) < page.getTotalPages()) {
link = "<" + (new URI(baseUrl + "?page=" + (page.getNumber() + 1) + "&size=" + page.getSize())).toString() + ">; rel=\"next\",";
}
// prev link
if ((page.getNumber()) > 0) {
link += "<" + (new URI(baseUrl + "?page=" + (page.getNumber() - 1) + "&size=" + page.getSize())).toString() + ">; rel=\"prev\",";
}
// last and first link
int lastPage = 0;
if (page.getTotalPages() > 0) {
lastPage = page.getTotalPages() - 1;
}
link += "<" + (new URI(baseUrl + "?page=" + lastPage + "&size=" + page.getSize())).toString() + ">; rel=\"last\",";
link += "<" + (new URI(baseUrl + "?page=" + 0 + "&size=" + page.getSize())).toString() + ">; rel=\"first\"";
headers.add(HttpHeaders.LINK, link);
return headers;
}
public static HttpHeaders generateSearchPaginationHttpHeaders(String query, Page<?> page, String baseUrl)
throws URISyntaxException {
HttpHeaders headers = new HttpHeaders();
headers.add("X-Total-Count", "" + page.getTotalElements());
String link = "";
if ((page.getNumber() + 1) < page.getTotalPages()) {
link = "<" + (new URI(baseUrl + "?page=" + (page.getNumber() + 1) + "&size=" + page.getSize())).toString() + "&query=" + query + ">; rel=\"next\",";
}
// prev link
if ((page.getNumber()) > 0) {
link += "<" + (new URI(baseUrl + "?page=" + (page.getNumber() - 1) + "&size=" + page.getSize())).toString() + "&query=" + query + ">; rel=\"prev\",";
}
// last and first link
int lastPage = 0;
if (page.getTotalPages() > 0) {
lastPage = page.getTotalPages() - 1;
}
link += "<" + (new URI(baseUrl + "?page=" + lastPage + "&size=" + page.getSize())).toString() + "&query=" + query + ">; rel=\"last\",";
link += "<" + (new URI(baseUrl + "?page=" + 0 + "&size=" + page.getSize())).toString() + "&query=" + query + ">; rel=\"first\"";
headers.add(HttpHeaders.LINK, link);
return headers;
}
}
| [
"[email protected]"
] | |
fb8b90f9294e223bf68acdaedcac17425088390e | b66d8fe1a1968794660d8721a9c8021cd681f4cc | /participant-management/src/main/java/whz/pti/swt/participantmanagement/ParticipantManagementApplication.java | 212ba128fa6ce661a792cc012e16419ec12dc4f5 | [] | no_license | mendigulovan/masterProject | 481b87b3b15b7dfe1572fdb6e3883a6ef04e6f10 | 68a248ec3c68321656bb5ca8019809fbabbfcf31 | refs/heads/master | 2023-07-13T22:46:39.802493 | 2021-08-18T15:38:30 | 2021-08-18T15:38:30 | 397,650,861 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,013 | java | package whz.pti.swt.participantmanagement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import whz.pti.swt.participantmanagement.organizer.aggregate.EventEntity;
import whz.pti.swt.participantmanagement.organizer.service.HackathonEventService;
import whz.pti.swt.participantmanagement.participant.aggregate.ParticipantDataEntity;
import whz.pti.swt.participantmanagement.participant.aggregate.ParticipantEntity;
import whz.pti.swt.participantmanagement.participant.services.ParticipantService;
import java.util.ArrayList;
@SpringBootApplication
public class ParticipantManagementApplication {
public static void main(String[] args) {
SpringApplication.run(ParticipantManagementApplication.class, args);
}
@Autowired
private ParticipantService participantService;
@Autowired
private HackathonEventService eventService;
@Bean
CommandLineRunner runner() throws InterruptedException {
return args -> {
System.out.println(".....................Start Participant-Management.....................");
ParticipantEntity st1 = new ParticipantEntity("", "", "Alina Bolotbekova");
ParticipantEntity st2 = new ParticipantEntity("", "", "Begaiym Asanbekova");
ParticipantEntity st3 = new ParticipantEntity("", "", "Nagima Mendigulova");
ParticipantEntity st4 = new ParticipantEntity("", "", "Sezimai Zholboldueva");
participantService.addParticipant(st1).get();
Thread.sleep(5000);
participantService.addParticipant(st2).get();
Thread.sleep(5000);
participantService.addParticipant(st3).get();
Thread.sleep(5000);
participantService.addParticipant(st4).get();
Thread.sleep(5000);
System.out.println("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::");
getEventsAndParticipants();
};
}
private void getEventsAndParticipants() {
ArrayList<EventEntity> allEvents = (ArrayList<EventEntity>) eventService.findAllEvents();
for (EventEntity event : allEvents) {
System.out.println(event.getDescription() + ":: " + event.getEventId());
if (event.getParticipantsOfEvent().size() > 0) {
for (ParticipantDataEntity part : event.getParticipantsOfEvent()) {
System.out.println("Name of Participant: "+ part.getName() + "::Food Wish: "
+ part.getFoodWishes() + " ::Technology: " + part.getTechnologie() + ":: T-Shirt size: " + part.getTShirtSize());
}
}else{
System.out.println(event.getDescription()+" Participant can't participate in this Event");
}
}
}
}
| [
"[email protected]"
] | |
ea4623614931e15df56d8ebae3d2c1c3535bc7d8 | ed703b411aeceb4bad5eda89d4b4b89757d9875a | /src/main/java/ViewObjects/Jsons/JsonFormat/ChatFormatter.java | c11c285455a0fb020eea0dc49a553d5732e5b814 | [] | no_license | massi08/code12 | d1bc0cc70bc82d72de4dd4fa455ba53bd47b19b7 | ff53d305afde928ac632cac60c17a235ab90bbff | refs/heads/master | 2021-01-22T22:08:57.537339 | 2017-03-20T21:45:01 | 2017-03-20T21:45:01 | 85,511,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 922 | java | package ViewObjects.Jsons.JsonFormat;
import ViewObjects.Jsons.JSONdata;
import modele.Message;
import modele.User;
import java.util.List;
public class ChatFormatter {
/**
* Transforme une discussion et sa liste de message en json
* @param messages
* @param idDiscussion
* @return
*/
public static String JsonConversation(List<Message> messages, int idDiscussion){
String json="{";
json+= JSONdata.addAttribute("Messages", messages, false);
json+=JSONdata.addAttribute("discussion", idDiscussion,true);
json+="}";
return json ;
}
/**
* Transforme une liste d'users en json
* @param users
* @return
*/
public static String JsonUserList(List<User> users){
String jsonresult="{";
jsonresult+=JSONdata.addAttribute("users", users, true);
jsonresult+="}";
return jsonresult ;
}
}
| [
"[email protected]"
] | |
d2d1b2e48b0d44aa6960250ccb1998d85e5ea980 | 973774793623d1ed6eb08a387d6e3ed83b55bc3a | /Web/road-manage-web/ever4j-src/org/ever4j/attachment/dao/AttachmentDao.java | c7b9d7b40b30f26c8bad578726d1d73f27273c28 | [] | no_license | weimengtsgit/RoadManage | 09e5ca6ed6b2889e41e33589f053d53c9a580159 | ad862593367c6fa18182f5cbd308eaed5942c78f | refs/heads/master | 2020-04-27T17:13:53.505778 | 2015-04-09T03:28:32 | 2015-04-09T03:28:32 | 33,536,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 247 | java | package org.ever4j.attachment.dao;
import org.ever4j.attachment.entity.Attachment;
import org.base4j.orm.hibernate.BaseDao;
import org.springframework.stereotype.Repository;
@Repository
public class AttachmentDao extends BaseDao<Attachment>{
}
| [
"[email protected]"
] | |
675be1ee5b2d4429e260fa99e67ab0f35a81601a | 45c0ddd978ad04734c41ca5d35876a29908a3555 | /src/serp/bytecode/lowlevel/Entry.java | 78f6586207f3bd18694df841bd0c9a953657ffa8 | [] | no_license | slemur/SF3 | 716ae426e2bb98dc63fe9a03e2e7b02b8d7a4962 | e6b910b498f165d74385bab18da57fc43c90877d | refs/heads/master | 2021-01-10T18:51:38.326951 | 2012-01-17T20:34:58 | 2012-01-17T20:34:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,268 | java | package serp.bytecode.lowlevel;
import java.io.*;
import java.util.*;
import serp.bytecode.visitor.*;
/**
* Base type for all constant pool entries. Entries should generally be
* considered immutable; modifying an entry directly can have dire
* consequences, and often renders the resulting class file invalid.
*
* <p>Entries cannot be shared among constant pools.</p>
*
* @author Abe White
*/
public abstract class Entry implements VisitAcceptor {
public static final int UTF8 = 1;
public static final int INT = 3;
public static final int FLOAT = 4;
public static final int LONG = 5;
public static final int DOUBLE = 6;
public static final int CLASS = 7;
public static final int STRING = 8;
public static final int FIELD = 9;
public static final int METHOD = 10;
public static final int INTERFACEMETHOD = 11;
public static final int NAMEANDTYPE = 12;
private ConstantPool _pool = null;
private int _index = 0;
/**
* Read a single entry from the given bytecode stream and returns it.
*/
public static Entry read(DataInput in) throws IOException {
Entry entry = create(in.readUnsignedByte());
entry.readData(in);
return entry;
}
/**
* Write the given entry to the given bytecode stream.
*/
public static void write(Entry entry, DataOutput out)
throws IOException {
out.writeByte(entry.getType());
entry.writeData(out);
}
/**
* Create an entry based on its type code.
*/
public static Entry create(int type) {
switch (type) {
case CLASS:
return new ClassEntry();
case FIELD:
return new FieldEntry();
case METHOD:
return new MethodEntry();
case INTERFACEMETHOD:
return new InterfaceMethodEntry();
case STRING:
return new StringEntry();
case INT:
return new IntEntry();
case FLOAT:
return new FloatEntry();
case LONG:
return new LongEntry();
case DOUBLE:
return new DoubleEntry();
case NAMEANDTYPE:
return new NameAndTypeEntry();
case UTF8:
return new UTF8Entry();
default:
throw new IllegalArgumentException("type = " + type);
}
}
/**
* Return the type code for this entry type.
*/
public abstract int getType();
/**
* Return true if this is a wide entry -- i.e. if it takes up two
* places in the constant pool. Returns false by default.
*/
public boolean isWide() {
return false;
}
/**
* Returns the constant pool containing this entry, or null if none.
*/
public ConstantPool getPool() {
return _pool;
}
/**
* Returns the index of the entry in the owning constant pool, or 0.
*/
public int getIndex() {
return _index;
}
/**
* This method is called after reading the entry type from bytecode.
* It should read all the data for this entry from the given stream.
*/
abstract void readData(DataInput in) throws IOException;
/**
* This method is called after writing the entry type to bytecode.
* It should write all data for this entry to the given stream.
*/
abstract void writeData(DataOutput out) throws IOException;
/**
* Subclasses must call this method before their state is mutated.
*/
Object beforeModify() {
if (_pool == null)
return null;
return _pool.getKey(this);
}
/**
* Subclasses must call this method when their state is mutated.
*/
void afterModify(Object key) {
if (_pool != null)
_pool.modifyEntry(key, this);
}
/**
* Sets the owning pool of the entry.
*/
void setPool(ConstantPool pool) {
// attempting to overwrite current pool?
if (_pool != null && pool != null && _pool != pool)
throw new IllegalStateException("Entry already belongs to a pool");
_pool = pool;
}
/**
* Set the index of this entry within the pool.
*/
void setIndex(int index) {
_index = index;
}
}
| [
"[email protected]"
] | |
506d1009f92bd03d9ec6e055917f349c640344b4 | acafa0151099e40fb3bd9211427c1c27a5542bea | /src/com/pland/designpatterns/abstractfactory/ShapeFactoryProducer.java | 0a6108fe9a8fe56aeb02363be7e93c13c84df18c | [] | no_license | RyanCA/J02_Leetcode_Patterns | 26b9b0345021d3347f8781adbab37c92ba152d73 | 196c511baabeac5bac4328a12c8b8d0aff424993 | refs/heads/master | 2021-01-12T18:26:00.863226 | 2018-11-17T23:17:41 | 2018-11-17T23:17:41 | 71,375,217 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 499 | java | package com.pland.designpatterns.abstractfactory;
public class ShapeFactoryProducer implements ShapeFactory{
private static ShapeFactoryProducer instance = new ShapeFactoryProducer();
public static ShapeFactoryProducer getInstance(){
return instance;
}
@Override
public Shape getShape(String shape) {
// TODO Auto-generated method stub
if("Rectangle".equals(shape)){
return new Rectangle();
}
else if("Circle".equals(shape)){
return new Circle();
}
return null;
}
}
| [
"[email protected]"
] | |
c46e05d5ff6f559da3b3df8e1a2e3d2828efae2d | fd762c46c95159ad8151293d60762d2fc8c38007 | /src/main/java/pl/longhorn/autopoly/log/BoardLogAfterIdQuery.java | 69ed5911d1c8858257e85910b2641012b015f39b | [] | no_license | jaksak/autopoly | f647feb500e96452aa17214c5e4ac73d5edab635 | a54e295d511990c8e49783b9af06fae1318a4ed0 | refs/heads/master | 2022-12-25T05:51:42.257716 | 2020-10-11T04:28:35 | 2020-10-11T04:28:35 | 298,645,575 | 0 | 0 | null | 2020-10-01T15:36:01 | 2020-09-25T18:03:13 | Java | UTF-8 | Java | false | false | 1,058 | java | package pl.longhorn.autopoly.log;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
@Service
@RequiredArgsConstructor
public class BoardLogAfterIdQuery {
private final BoardLogQuery boardLogQuery;
public List<BoardLog> getLogByBoardIdAndAfter(String boardId, String afterId) {
var logsFromBoard = boardLogQuery.getByBoardId(boardId);
var logsAfterId = getLogsAfterId(logsFromBoard, afterId);
if (logsAfterId.isEmpty()) {
return logsFromBoard;
} else {
return logsAfterId;
}
}
private List<BoardLog> getLogsAfterId(List<BoardLog> logs, String afterId) {
List<BoardLog> toReturn = new LinkedList<>();
boolean idExceed = false;
for (BoardLog log : logs) {
if (idExceed) {
toReturn.add(log);
} else if (afterId.equals(log.getId())) {
idExceed = true;
}
}
return toReturn;
}
}
| [
"[email protected]"
] | |
0d5577b9bc284873deca89303c89e940da8e520a | 23a96a03e550ee22a14b8fe9ed2ce44b6341de18 | /ide/trunk/src/org/jclarion/clarion/ide/editor/ProcedureCallEditor.java | ff75c72d973a07e630522bf899e87c32849c4ce6 | [] | no_license | polarisltd/jClarion | 29782a3ed0a144943c6d99dd81f6c16ef0a504d8 | 37e57590cb9cc41448fdd09fda91c9094b0dd057 | refs/heads/master | 2020-12-31T07:33:15.586952 | 2016-04-28T13:51:58 | 2016-04-28T13:55:40 | 57,305,055 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,799 | java | package org.jclarion.clarion.ide.editor;
import java.util.Collection;
import java.util.TreeSet;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.jclarion.clarion.appgen.app.Procedure;
import org.jclarion.clarion.ide.model.ClarionProcedureInput;
import org.jclarion.clarion.ide.model.app.ProcedureModel;
public class ProcedureCallEditor extends FormPage {
private boolean dirty;
private Table list;
private Table calls;
private Text filter;
private Button move;
private TreeSet<String> procedures;
@Override
public void doSave(IProgressMonitor monitor) {
if (procedures==null) return;
if (dirty) {
dirty=false;
getProcedure().getProcedure().replaceCalls(procedures);
}
}
/**
* Create the form page.
* @param id
* @param title
*/
public ProcedureCallEditor(String id, String title) {
super(id, title);
}
/**
* Create the form page.
* @param editor
* @param id
* @param title
* @wbp.parser.constructor
* @wbp.eval.method.parameter id "Some id"
* @wbp.eval.method.parameter title "Some title"
*/
public ProcedureCallEditor(FormEditor editor, String id, String title) {
super(editor, id, title);
}
/**
* Create contents of the form.
* @param managedForm
*/
@Override
protected void createFormContent(IManagedForm managedForm) {
FormToolkit toolkit = managedForm.getToolkit();
ScrolledForm form = managedForm.getForm();
form.setText("Procedure Calls");
Composite body = form.getBody();
toolkit.decorateFormHeading(form.getForm());
toolkit.paintBordersFor(body);
body.setLayout(new GridLayout(3,false));
filter = new Text(body,SWT.NONE);
GridData gd = new GridData();
gd.horizontalSpan=3;
filter.setLayoutData(gd);
filter.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
loadList(((Text)e.widget).getText());
}
});
list = new Table(body,SWT.SINGLE);
list.setLayoutData(new GridData(GridData.FILL, GridData.FILL,true,true));
loadList("");
move = new Button(body,SWT.PUSH);
move.setText(">>>");
move.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e)
{
move();
}
@Override
public void widgetDefaultSelected(SelectionEvent e)
{
}
});
calls = new Table(body,SWT.SINGLE);
calls.setLayoutData(new GridData(GridData.FILL, GridData.FILL,true,true));
procedures = new TreeSet<String>();
for (String s : getProcedure().getProcedure().getCalls()) {
procedures.add(s);
}
refreshCalls();
calls.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (calls.getSelectionCount()>0) {
list.deselectAll();
move.setText("<<<");
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
Label space = new Label(body,SWT.NONE);
space.setLayoutData(new GridData(GridData.BEGINNING,GridData.BEGINNING,false,false,2,1));
Canvas addNew = new Canvas(body,SWT.NONE);
addNew.setLayout(new RowLayout(SWT.HORIZONTAL));
final Text addNewText = new Text(addNew,SWT.BORDER);
addNewText.setLayoutData(new RowData(130,SWT.DEFAULT));
final Button addNewAction = new Button(addNew,SWT.PUSH);
addNewAction.setText("Add New");
addNewAction.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
String text = addNewText.getText().trim();
if (text.length()>0) {
procedures.add(text);
refreshCalls();
dirty=true;
getEditor().editorDirtyStateChanged();
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
list.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (list.getSelectionCount()>0) {
calls.deselectAll();
move.setText(">>>");
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
list.addMouseListener(new MouseListener() {
@Override
public void mouseDoubleClick(MouseEvent e) {
move();
}
@Override
public void mouseDown(MouseEvent e) {
}
@Override
public void mouseUp(MouseEvent e) {
}
});
calls.addMouseListener(new MouseListener() {
@Override
public void mouseDoubleClick(MouseEvent e) {
move();
}
@Override
public void mouseDown(MouseEvent e) {
}
@Override
public void mouseUp(MouseEvent e) {
}
});
}
private void move()
{
int ofs= calls.getSelectionIndex();
if (ofs>-1) {
procedures.remove(calls.getItem(ofs).getText());
}
ofs = list.getSelectionIndex();
if (ofs>-1) {
procedures.add(list.getItem(ofs).getText());
}
refreshCalls();
dirty=true;
getEditor().editorDirtyStateChanged();
}
public boolean isDirty()
{
return dirty;
}
private void refreshCalls() {
calls.removeAll();
loadTable(calls,procedures);
}
private void loadList(String string) {
string=string.toLowerCase();
TreeSet<String> procedures = new TreeSet<String>();
for (Procedure p : getProcedure().getApp().getApp().getProcedures()) {
String lname = p.getName().toLowerCase();
if (string.length()==0 || lname.indexOf(string)>-1) {
procedures.add(p.getName());
}
}
list.setRedraw(false);
list.removeAll();
loadTable(list,procedures);
list.setRedraw(true);
list.redraw();
}
private void loadTable(Table list, Collection<String> procedures) {
for (String name : procedures) {
TableItem ti = new TableItem(list,SWT.NONE);
ti.setText(name);
}
}
public ProcedureModel getProcedure()
{
ClarionProcedureInput input = (ClarionProcedureInput)getEditorInput();
return input.getModel();
}
}
| [
"[email protected]"
] | |
74a168c9707351f801c1ac95c1ef67e810e8d982 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/17/17_7e072ec98e81e5e981c4673a4e519ba346939112/GeocacheListController/17_7e072ec98e81e5e981c4673a4e519ba346939112_GeocacheListController_t.java | 5b3fa1b639a2936679bf25d9aa8a6f68c9a400e4 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 5,463 | java | /*
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
package com.google.code.geobeagle.ui.cachelist;
import com.google.code.geobeagle.R;
import com.google.code.geobeagle.data.GeocacheVectors;
import com.google.code.geobeagle.io.Database;
import com.google.code.geobeagle.io.GpxImporter;
import com.google.code.geobeagle.io.DatabaseDI.SQLiteWrapper;
import com.google.code.geobeagle.ui.ErrorDisplayer;
import android.app.ListActivity;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnCreateContextMenuListener;
import android.widget.ListView;
import android.widget.AdapterView.AdapterContextMenuInfo;
public class GeocacheListController {
public static class CacheListOnCreateContextMenuListener implements OnCreateContextMenuListener {
private final GeocacheVectors mGeocacheVectors;
CacheListOnCreateContextMenuListener(GeocacheVectors geocacheVectors) {
mGeocacheVectors = geocacheVectors;
}
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
AdapterContextMenuInfo acmi = (AdapterContextMenuInfo)menuInfo;
if (acmi.position > 0) {
menu.setHeaderTitle(mGeocacheVectors.get(acmi.position - 1).getId());
menu.add(0, MENU_VIEW, 0, "View");
menu.add(0, MENU_DELETE, 1, "Delete");
}
}
}
static final int MENU_DELETE = 0;
static final int MENU_VIEW = 1;
public static final String SELECT_CACHE = "SELECT_CACHE";
private final ContextAction mContextActions[];
private final Database mDatabase;
private final ErrorDisplayer mErrorDisplayer;
private final FilterNearestCaches mFilterNearestCaches;
private final GpxImporter mGpxImporter;
private final ListActivity mListActivity;
private final MenuActionRefresh mMenuActionRefresh;
private final MenuActions mMenuActions;
private final SQLiteWrapper mSqliteWrapper;
GeocacheListController(ListActivity listActivity, MenuActions menuActions,
ContextAction[] contextActions, SQLiteWrapper sqliteWrapper, Database database,
GpxImporter gpxImporter, MenuActionRefresh menuActionRefresh,
FilterNearestCaches filterNearestCaches, ErrorDisplayer errorDisplayer) {
mListActivity = listActivity;
mErrorDisplayer = errorDisplayer;
mContextActions = contextActions;
mMenuActions = menuActions;
mGpxImporter = gpxImporter;
mMenuActionRefresh = menuActionRefresh;
mSqliteWrapper = sqliteWrapper;
mFilterNearestCaches = filterNearestCaches;
mDatabase = database;
}
public boolean onContextItemSelected(MenuItem menuItem) {
try {
AdapterContextMenuInfo adapterContextMenuInfo = (AdapterContextMenuInfo)menuItem
.getMenuInfo();
mContextActions[menuItem.getItemId()].act(adapterContextMenuInfo.position - 1);
} catch (final Exception e) {
mErrorDisplayer.displayErrorAndStack(e);
}
return true;
}
public void onCreate() {
try {
// Upgrade database if necessary.
mSqliteWrapper.openWritableDatabase(mDatabase);
mSqliteWrapper.close();
mSqliteWrapper.openReadableDatabase(mDatabase);
mMenuActionRefresh.sort();
} catch (final Exception e) {
mErrorDisplayer.displayErrorAndStack(e);
}
}
public boolean onCreateOptionsMenu(Menu menu) {
mListActivity.getMenuInflater().inflate(R.menu.cache_list_menu, menu);
return true;
}
public void onListItemClick(ListView l, View v, int position, long id) {
try {
if (position > 0)
mContextActions[MENU_VIEW].act(position - 1);
else
mMenuActions.act(R.id.menu_refresh);
} catch (final Exception e) {
mErrorDisplayer.displayErrorAndStack(e);
}
}
public boolean onMenuOpened(int featureId, Menu menu) {
menu.findItem(R.id.menu_toggle_filter).setTitle(mFilterNearestCaches.getMenuString());
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
try {
mMenuActions.act(item.getItemId());
} catch (Exception e) {
mErrorDisplayer.displayErrorAndStack(e);
}
return true;
}
public void onPause() {
try {
mGpxImporter.abort();
} catch (InterruptedException e) {
// Nothing we can do here! There is no chance to communicate to
// the user.
}
}
}
| [
"[email protected]"
] | |
2858c186dcaf57423cdca94b6c52c4dc59dd5df6 | 3ee15bafa38ba20bfe72ed2a623b253820988760 | /src/main/java/com/siwoo/projpa/service/ProjectServiceImpl.java | 09af86bc00fdbb03710d7bc38dc0d9fa1389e584 | [] | no_license | Siwoo-Kim/app-toby | 41cd8fadd015c5116ba5ad69adc6478b35993b3c | fdf87ac5ae37041f4bfc59da55254ca0a6165d6a | refs/heads/master | 2020-03-07T07:59:22.182222 | 2018-04-08T16:03:21 | 2018-04-08T16:03:21 | 127,363,892 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,436 | java | package com.siwoo.projpa.service;
import com.siwoo.projpa.domain.BasicTime;
import com.siwoo.projpa.domain.Project;
import com.siwoo.projpa.domain.ProjectSummary;
import com.siwoo.projpa.domain.User;
import com.siwoo.projpa.repository.ProjectRepository;
import com.siwoo.projpa.repository.SectionRepository;
import com.siwoo.projpa.repository.UserRepository;
import com.siwoo.projpa.service.support.ServiceArgumentException;
import com.siwoo.projpa.service.support.ServiceSupporter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.interceptor.DefaultTransactionAttribute;
import org.springframework.util.Assert;
import javax.validation.constraints.AssertTrue;
import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Function;
@Service
public class ProjectServiceImpl implements ProjectService {
@Autowired UserRepository userRepository;
@Autowired ProjectRepository projectRepository;
@Autowired SectionRepository sectionRepository;
@Autowired AuditService auditService;
@Override
public ProjectSummary summary(long projectId) {
return projectRepository.getProjectSummary(projectId);
}
@Override
public void assign(Project project, User user) {
Optional<User> foundUser = userRepository.findById(user.getId());
Optional<Project> foundProject = projectRepository.findById(project.getId());
if(!foundUser.isPresent() || !foundProject.isPresent()) {
throw new ServiceArgumentException("Argument is invalid");
}
project = foundProject.get();
user = foundUser.get();
user.addProject(project);
}
@Override
public void create(Project project) {
defaultValue(project);
projectRepository.save(project);
}
private void defaultValue(Project project) {
if(project.getBasicTime() == null || project.getBasicTime().getCreated() == null) {
project.setBasicTime(new BasicTime(LocalDateTime.now(), null));
}
}
@Autowired PlatformTransactionManager platformTransactionManager;
@Override
public void updateLastUpdatedSections() {
List<Object[]> rows = sectionRepository.findMaxUpdateTimeAndProjectGroupByProject();
for (Object[] row : rows) {
updateLastUpdatedSection((LocalDateTime) row[0], (String) row[1]);
}
}
private void updateLastUpdatedSection(LocalDateTime updateTime, String projectName) {
Project project = projectRepository.findByName(projectName);
project.setLastUpdatedSection(updateTime);
projectRepository.save(project);
}
@Override
public void displayProjectUsers(String name) {
List<User> users = userRepository.findByProjectName(name);
for(int i=0; i<users.size(); i++) {
User user = users.get(i);
System.out.println("Project: " + name);
System.out.println(i + 1 + ": " + user.getName() + ", "+ user.getEmail());
}
}
@Override
public Project maxManagerProject() {
Map<Project,Long> data = countManagers();
Project max;
return data.entrySet().stream()
.max((o1, o2) -> o1.getValue().compareTo(o2.getValue()))
.map(projectLongEntry -> projectLongEntry.getKey())
.get();
}
@Override
public Map<Project,Long> countManagers() {
List<Object[]> rows = projectRepository.findIdAndManagerCount();
return mappingToMap(rows, id -> projectRepository.findById((Long) id).get());
}
@Override
public List<Project> getAll() {
return projectRepository.findAll();
}
@Override
public Project get(Long projectId) {
ServiceSupporter.throwIfNull(projectId);
return projectRepository.getOne(projectId);
}
private Map mappingToMap(List<Object[]> rows, Function<Object, Object> doWork) {
HashMap<Object, Object> map = new HashMap<>();
for(Object[] row: rows) {
if(row[0] != null) {
long id = (long) row[0];
Object object = doWork.apply(id);
map.put(object, row[1]);
}
}
return map;
}
}
| [
"[email protected]"
] | |
2c10758e3681019a614bccc17ca3e3dbf1b8f6ab | c1214aa6018d24bd42c4c7f3ebb5ce7a06c93350 | /Androidhive/app/src/main/java/com/goblog/androidhive/activity/LoginActivity.java | a7491add33f1031afc1f753324e8083254edbd90 | [] | no_license | michaelhaikal31/Simulasi-Keluhan-Diskominfo | bde1240beaa029ba59b6dd0a3133c80acec98e16 | 28f830006545ddc3ab1fec9aae31eb2491afc72b | refs/heads/master | 2020-09-21T11:50:42.600558 | 2016-08-30T08:45:54 | 2016-08-30T08:45:54 | 66,257,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,692 | java | package com.goblog.androidhive.activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.goblog.androidhive.R;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
/**
* Created by haikal on 8/12/2016.
*/
public class LoginActivity extends AppCompatActivity {
private EditText inputEmail, inputPassword;
private FirebaseAuth auth;
private ProgressBar progressBar;
private Button btnSignup, btnLogin, btnReset;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Get Firebase auth instance
auth = FirebaseAuth.getInstance();
if (auth.getCurrentUser() != null) {
startActivity(new Intent(LoginActivity.this, MainActivity.class));
finish();
}
// set the view now
setContentView(R.layout.activity_login);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
inputEmail = (EditText) findViewById(R.id.email);
inputPassword = (EditText) findViewById(R.id.password);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
btnSignup = (Button) findViewById(R.id.btn_signup);
btnLogin = (Button) findViewById(R.id.btn_login);
btnReset = (Button) findViewById(R.id.btn_reset_password);
//Get Firebase auth instance
auth = FirebaseAuth.getInstance();
btnSignup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(LoginActivity.this, SignupActivity.class));
}
});
btnReset.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(LoginActivity.this, ResetPasswordActivity.class));
}
});
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String email = inputEmail.getText().toString();
final String password = inputPassword.getText().toString();
if (TextUtils.isEmpty(email)) {
Toast.makeText(getApplicationContext(), "Enter email address!", Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(password)) {
Toast.makeText(getApplicationContext(), "Enter password!", Toast.LENGTH_SHORT).show();
return;
}
progressBar.setVisibility(View.VISIBLE);
//authenticate user
auth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
// If sign in fails, display a message to the user. If sign in succeeds
// the auth state listener will be notified and logic to handle the
// signed in user can be handled in the listener.
progressBar.setVisibility(View.GONE);
if (!task.isSuccessful()) {
// there was an error
if (password.length() < 6) {
inputPassword.setError(getString(R.string.minimum_password));
} else {
Toast.makeText(LoginActivity.this, getString(R.string.auth_failed), Toast.LENGTH_LONG).show();
}
} else {
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
}
});
}
});
}
}
| [
"[email protected]"
] | |
becb3710b11ce7bf2ed4c3ec59b35755720ceff5 | 4e69438d502ca384caec860c1ff6fe0200bf4dea | /src/test/java/com/thread/testsynchronized/ALogin.java | c09c9d2d5b5949c51ff42df1d4ff397e4ba47b99 | [] | no_license | JackEasons/GithubRepository | 9276d4983fa1179a75d611d56e9c99c6828e8a01 | 0191acbd7f9572b3526e49660788c92301ed0003 | refs/heads/master | 2023-01-09T09:12:15.098155 | 2017-11-28T02:44:37 | 2017-11-28T02:44:37 | 83,630,919 | 0 | 0 | null | 2020-11-03T04:39:46 | 2017-03-02T03:38:52 | Java | UTF-8 | Java | false | false | 145 | java | package com.thread.testsynchronized;
public class ALogin extends Thread {
@Override
public void run() {
LoginServlet.post("a", "aa");
}
}
| [
"[email protected]"
] | |
0a1a28dddb9b2cf9a0cf094b4778924645febb91 | 1f380861e4d36d347bb37ec972083283859e94b9 | /src/main/java/com/practice/kafkaApp/controller/TransactionController.java | 4fae18f40fddd6161e4348723c5c40da0b186c41 | [] | no_license | ShengKai-Kwan/simple-kafka-app | cba7779846456d38afe18b32ee0c1b213bb4d530 | 1b1a90be726a7e50860688336aeb20d63ad4fad4 | refs/heads/master | 2023-01-14T17:06:54.826354 | 2020-11-26T06:18:38 | 2020-11-26T06:18:38 | 314,216,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,774 | java | package com.practice.kafkaApp.controller;
import com.practice.kafkaApp.model.Transaction;
import com.practice.kafkaApp.repository.TransactionRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@CrossOrigin
@RestController
public class TransactionController {
private static final Logger logger =
LoggerFactory.getLogger(TransactionController.class);
private final KafkaTemplate<String, Object> template;
private final String transferTopic;
private final String verificationResultTopic;
public TransactionController(final KafkaTemplate<String, Object> template,
@Value("${tpd.verification-result-topic}") final String verificationResultTopic,
@Value("${tpd.transfer-topic}") final String transferTopic){
this.template = template;
this.verificationResultTopic = verificationResultTopic;
this.transferTopic = transferTopic;
}
@Autowired
AccountController accountController;
@Autowired
TransactionRepository transactionRepository;
@GetMapping(value = "/listAllTransferRequestByIcNo/{ic}")
public ResponseEntity<List<Transaction>> listTransactionsByIcNo(@PathVariable(value = "ic") String ic){
return ResponseEntity.ok(transactionRepository.listTransactionsByIcNo(ic));
}
@GetMapping(value = "/checkTransferStatusForTXUID/{txuid}")
public String checkTransferStatusForTXUID(@PathVariable(value = "txuid") String txuid){
return transactionRepository.checkTransferStatusForTXUID(txuid);
}
@PostMapping(value = "/transfer")
public Transaction transfer(@RequestBody Transaction transactionDetail){
String pattern = "yyyyMMddHHmmss";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
String date = simpleDateFormat.format(new Date());
transactionDetail.setTx_uid("TX" + date);
transactionDetail.setStatus("PROCESSING");
logger.info(transactionDetail.toString());
this.template.send(transferTopic, transactionDetail);
logger.info("Sending transaction detail: " + transactionDetail.getTx_uid() + ", TOPIC: " + transferTopic);
return transactionDetail;
}
@KafkaListener(topics = "transfer-topic", containerFactory = "kafkaListenerContainerFactory")
public void transferListener(Transaction transactionDetail){
logger.info("====================================");
logger.info("Receiving transaction detail: " + transactionDetail.getTx_uid());
logger.info(transactionDetail.toString());
try {
transactionRepository.save(transactionDetail);
transactionDetail.setReason(validateTransactionAcct(transactionDetail));
this.template.send(verificationResultTopic, transactionDetail);
logger.info("Sending transaction detail2: " + transactionDetail.getTx_uid());
}catch(Exception e){
logger.info("ERROR @transferListener: " + e.toString());
}
}
@KafkaListener(topics = "acct-verification-result-topic", containerFactory = "kafkaListenerContainerFactory")
public void verifyResultListener(Transaction transactionDetail){
logger.info("Receiving verified transaction detail: " + transactionDetail.getTx_uid());
if(transactionDetail.getReason().equals("Valid"))transactionDetail.setStatus("SUCCEED");
else transactionDetail.setStatus("FAILED");
try{
transactionRepository.save(transactionDetail);
}catch(Exception e){
logger.info("ERROR @verifyResultListener: " + e.toString());
}
}
public String validateTransactionAcct(Transaction transactionDetail){
boolean isValidDebitAcct = accountController.verifyAccount(transactionDetail.getDebit_account_no(), transactionDetail.getDebit_ic_no());
boolean isValidCreditAcct = accountController.verifyAccount(transactionDetail.getCredit_account_no(), transactionDetail.getCredit_ic_no());
if(!isValidCreditAcct && !isValidDebitAcct)
return "BothDebitNCreditAcctNotFound";
else if(!isValidCreditAcct)
return "CreditAccountNotFound";
else if(!isValidDebitAcct)
return "DebitAccountNotFound";
else
return "Valid";
}
}
| [
"[email protected]"
] | |
d70c391ff9cc1910c3277b2e0afd7d109f0a185c | 31746d36d2690e8a1ef72556361ade34e0c5b4c1 | /app/src/main/java/proyecto/com/domos/net/models/UserDatos.java | 1699e57118daa3a1c9ef09b48ff8b91d7ffc88eb | [] | no_license | rich4rdruizgit/Domos | b208524c1a97303003c0b504b67d828671d40885 | d55d6e27df317e34aa9f14ec0c965373547650b4 | refs/heads/master | 2021-05-04T04:22:41.188029 | 2018-02-20T02:08:20 | 2018-02-20T02:08:20 | 120,331,915 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 766 | java | package proyecto.com.domos.net.models;
import com.google.gson.annotations.SerializedName;
/**
* Created by rich4 on 7/02/2018.
*/
public class UserDatos {
@SerializedName("email")
private String email;
@SerializedName("password")
private String password;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "UserDatos{" +
"email='" + email + '\'' +
", password='" + password + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
d7471ecb70d399133be00c6fd379d2885289421f | 5fb4e8eed7858fa68e424b2a6157926a7ed604c3 | /ylc/src/com/nangua/xiaomanjflc/utils/ApplicationUtil.java | bb0929bd12ac37d36f6c317abcffeb3e77457af4 | [] | no_license | dougisadog/xmjf | 556b679f98d2385d93786046dd17686f62aed037 | 362ed0fed861934cd0f48f4969c0a26ff9f8720e | refs/heads/master | 2021-01-02T03:14:35.075447 | 2017-08-01T02:21:43 | 2017-08-01T02:21:43 | 98,949,368 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,809 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.nangua.xiaomanjflc.utils;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.util.DisplayMetrics;
import android.util.Log;
import com.louding.frame.KJDB;
import com.nangua.xiaomanjflc.AppConstants;
import com.nangua.xiaomanjflc.AppVariables;
import com.nangua.xiaomanjflc.bean.database.UserConfig;
import com.nangua.xiaomanjflc.cache.CacheBean;
import com.nangua.xiaomanjflc.support.ApkInfo;
import java.util.Date;
import java.util.List;
/**
* ๅบ็จๅทฅๅ
ท็ฑปใ
*
* @author Geek_Soledad ([email protected])
*/
public class ApplicationUtil {
/**
* ้่ฟๅ
ๅ่ทๅๅบ็จ็จๅบ็ๅ็งฐใ
*
* @param packageName
* ๅ
ๅใ
* @return ่ฟๅๅ
ๅๆๅฏนๅบ็ๅบ็จ็จๅบ็ๅ็งฐใ
*/
public static String getProgramNameByPackageName(Context ctx,
String packageName) {
PackageManager pm = ctx.getPackageManager();
String name = null;
try {
name = pm.getApplicationLabel(
pm.getApplicationInfo(packageName,
PackageManager.GET_META_DATA)).toString();
} catch (NameNotFoundException e) {
e.printStackTrace();
}
return name;
}
/**
* ่ทๅๆๅ
ณๆฌ็จๅบ็ไฟกๆฏใ
*
* @return ๆๅ
ณๆฌ็จๅบ็ไฟกๆฏใ
*/
public static ApkInfo getApkInfo(Context ctx) {
ApkInfo apkInfo = null;
if (null == CacheBean.getInstance().getApkInfo()) {
apkInfo = new ApkInfo();
ApplicationInfo applicationInfo = ctx.getApplicationInfo();
apkInfo.packageName = applicationInfo.packageName;
apkInfo.iconId = applicationInfo.icon;
apkInfo.iconDrawable = ctx.getResources().getDrawable(apkInfo.iconId);
apkInfo.programName = ctx.getResources()
.getText(applicationInfo.labelRes).toString();
PackageInfo packageInfo = null;
try {
packageInfo = ctx.getPackageManager().getPackageInfo(
apkInfo.packageName, 0);
apkInfo.versionCode = packageInfo.versionCode;
apkInfo.versionName = packageInfo.versionName;
} catch (NameNotFoundException e) {
e.printStackTrace();
}
DisplayMetrics displayMetrics = ctx.getResources().getDisplayMetrics();
apkInfo.width = displayMetrics.widthPixels;
apkInfo.height = displayMetrics.heightPixels;
apkInfo.dpi = displayMetrics.densityDpi;
float density = displayMetrics.density;//ๅฑๅนๅฏๅบฆ๏ผ0.75 / 1.0 / 1.5๏ผ
//ๅฑๅนๅฎฝๅบฆ็ฎๆณ:ๅฑๅนๅฎฝๅบฆ๏ผๅ็ด ๏ผ/ๅฑๅนๅฏๅบฆ
apkInfo.screenWidth = (int) (apkInfo.width/density);//ๅฑๅนๅฎฝๅบฆ(dp)
apkInfo.screenHeight = (int)(apkInfo.height/density);//ๅฑๅน้ซๅบฆ(dp)
Log.i("MainActivity", "height:" + displayMetrics.heightPixels);
Log.i("MainActivity", "width:" + displayMetrics.widthPixels);
CacheBean.getInstance().setApkInfo(apkInfo);
}
else {
apkInfo = CacheBean.getInstance().getApkInfo();
}
return apkInfo;
}
/**
* ๆฃๆต ๆถ้ดๆฏๅฆ่ถ
ๆถ
* @param lastTime ไธๆฌกๆฃๆตๆถ้ด
* @return
*/
public static boolean checkTime(long lastTime) {
return new Date().getTime() - lastTime > AppConstants.TIME;
}
/**
* ๆๅฟๅฏ็ ๅผนๅบ ๅคๅฎ
* @param context
* @return
*/
public static boolean isNeedGesture(Context context) {
KJDB kjdb = KJDB.create(context);
if (null == kjdb)
return false;
List<UserConfig> userConfigs = kjdb.findAllByWhere(UserConfig.class, "uid=" + AppVariables.uid);
UserConfig userConfig = null;
if (userConfigs.size() > 0) {
userConfig = userConfigs.get(0);
}
if (null != userConfig && userConfig.isNeedGesture()) {
if (AppVariables.needGesture || checkTime(userConfig.getLastGestureCheckTime())) {
userConfig.setLastGestureCheckTime(new Date().getTime());
kjdb.update(userConfig);
AppVariables.needGesture = false;
return true;
}
}
return false;
}
/**
* ้ๅฏ
* @param context
*/
public static void restartApplication(Context context) {
final Intent intent = context.getPackageManager()
.getLaunchIntentForPackage(context.getPackageName());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(intent);
}
}
| [
"[email protected]"
] | |
d2e6effbe8021232008d557cd6716799ac7584a0 | 59ca721ca1b2904fbdee2350cd002e1e5f17bd54 | /aliyun-java-sdk-core/src/main/java/com/aliyuncs/endpoint/LocalConfigGlobalEndpointResolver.java | ffb16478f8869de60bccc6fa2fd1de4ecd387b05 | [
"Apache-2.0"
] | permissive | longtx/aliyun-openapi-java-sdk | 8fadfd08fbcf00c4c5c1d9067cfad20a14e42c9c | 7a9ab9eb99566b9e335465a3358553869563e161 | refs/heads/master | 2020-04-26T02:00:35.360905 | 2019-02-28T13:47:08 | 2019-02-28T13:47:08 | 173,221,745 | 2 | 0 | NOASSERTION | 2019-03-01T02:33:35 | 2019-03-01T02:33:35 | null | UTF-8 | Java | false | false | 1,713 | java | package com.aliyuncs.endpoint;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class LocalConfigGlobalEndpointResolver extends LocalConfigRegionalEndpointResolver {
public LocalConfigGlobalEndpointResolver() {
JsonObject obj = readLocalConfigAsJsonObject();
initLocalConfig(obj);
}
public LocalConfigGlobalEndpointResolver(String configJsonStr) {
// For testability
JsonObject obj = (new JsonParser()).parse(configJsonStr).getAsJsonObject();
initLocalConfig(obj);
}
protected void initLocalConfig(JsonObject obj) {
initGlobalEndpointData(obj);
initRegionIds(obj);
initLocationCodeMapping(obj);
}
private void initGlobalEndpointData(JsonObject obj) {
if (!obj.has("global_endpoints")) {
return;
}
JsonObject globalEndpoints = obj.get("global_endpoints").getAsJsonObject();
for (String locationServiceCode : globalEndpoints.keySet()) {
String endpoint = globalEndpoints.get(locationServiceCode).getAsString();
putEndpointEntry(makeEndpointKey(locationServiceCode), endpoint);
}
}
@Override
public String resolve(ResolveEndpointRequest request) {
if (request.isOpenApiEndpoint() && isRegionIdValid(request)) {
return fetchEndpointEntry(request);
} else {
return null;
}
}
@Override
public String makeEndpointKey(ResolveEndpointRequest request) {
return makeEndpointKey(request.productCodeLower);
}
public String makeEndpointKey(String productCodeLower) {
return getNormalizedProductCode(productCodeLower);
}
}
| [
"[email protected]"
] | |
8317e9f96da2669c89a6668d93b1157e92c06c28 | 6323547a541e54e1585d8bed43ad829c43244d3f | /src/main/java/info/loenwind/travelhut/handlers/EnderIOAdapter.java | cbdb8c3a9265d2e18cb5339a1a756b3bd37714fa | [
"CC0-1.0"
] | permissive | HenryLoenwind/TravelHut | 7896c82ecb0e5ab644bf9a49fcd67ecea466133b | ed6ec62b0fccdb63353f1588107d3646f5618b5f | refs/heads/master | 2021-01-12T07:34:58.609407 | 2017-05-22T10:06:23 | 2017-05-22T10:10:25 | 76,982,357 | 4 | 3 | null | 2017-06-28T21:34:44 | 2016-12-20T18:40:24 | Java | UTF-8 | Java | false | false | 801 | java | package info.loenwind.travelhut.handlers;
import java.util.Random;
import crazypants.enderio.material.fusedQuartz.FusedQuartzType;
import net.minecraft.block.BlockColored;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumDyeColor;
import net.minecraftforge.fml.common.Loader;
public class EnderIOAdapter {
public static IBlockState getEIOGlass(Random rand) {
return FusedQuartzType.ENLIGHTENED_FUSED_GLASS.getBlock().getDefaultState().withProperty(BlockColored.COLOR,
EnumDyeColor.values()[rand.nextInt(EnumDyeColor.values().length)]);
}
public static IBlockState getGlass(Random rand) {
if (Loader.isModLoaded("EnderIO")) {
return getEIOGlass(rand);
}
return Blocks.GLASS.getDefaultState();
}
}
| [
"[email protected]"
] | |
20c32436ba11b0eb93fb30218d09b42e0e7ad8ac | 74360ddb842727175e67027b194d1c1e12ab3b8b | /app/src/main/java/com/yy/doorplate/database/SchoolInfoDatabase.java | 6be391444e80bfbf6acec1e0cff550f240ba1918 | [] | no_license | xumingda/Doorplate_6 | 2effad18d4824e23378b304cdb7ba59e8b5dbdf2 | 03b8ad3c6b685128014cfd53bfd62e24ac36d260 | refs/heads/master | 2020-07-04T11:10:31.247751 | 2019-08-14T04:46:42 | 2019-08-14T04:46:42 | 202,265,838 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,045 | java | package com.yy.doorplate.database;
import java.util.ArrayList;
import java.util.List;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.yy.doorplate.MyApplication;
import com.yy.doorplate.model.SchoolInfoModel;
public class SchoolInfoDatabase {
private static final String TABLE = "SchoolInfo";
private SQLiteDatabase sqLiteDatabase;
private static final String TAG = "SchoolInfoDatabase";
private void openDB() {
try {
sqLiteDatabase = SQLiteDatabase.openOrCreateDatabase(
MyApplication.DATABASE, null);
} catch (Exception e) {
e.printStackTrace();
}
}
private void create() {
String sql = "create table if not exists " + TABLE + "("
+ "id INTEGER PRIMARY KEY AUTOINCREMENT,"
+ "infoName verchar(20)," + "infoCode verchar(50) UNIQUE,"
+ "content verchar(5000)" + ")";
try {
sqLiteDatabase.execSQL(sql);
} catch (Exception e) {
e.printStackTrace();
}
}
private void initDB() {
openDB();
create();
}
public synchronized List<SchoolInfoModel> query_all() {
initDB();
Cursor cursor = null;
try {
cursor = sqLiteDatabase.query(TABLE, null, null, null, null, null,
null, null);
} catch (Exception e) {
e.printStackTrace();
}
if (cursor == null) {
return null;
}
List<SchoolInfoModel> list = new ArrayList<SchoolInfoModel>();
while (cursor.moveToNext()) {
SchoolInfoModel model = new SchoolInfoModel();
model.infoName = cursor.getString(1);
model.infoCode = cursor.getString(2);
model.content = cursor.getString(3);
list.add(model);
}
close();
if (cursor.getCount() == 0) {
cursor.close();
return null;
} else {
cursor.close();
return list;
}
}
public synchronized SchoolInfoModel query_by_infoCode(String infoCode) {
initDB();
Cursor cursor = null;
try {
cursor = sqLiteDatabase.query(TABLE, null, "infoCode = ?",
new String[] { infoCode }, null, null, null);
} catch (Exception e) {
e.printStackTrace();
}
if (cursor == null) {
return null;
}
if (cursor.moveToFirst()) {
SchoolInfoModel model = new SchoolInfoModel();
model.infoName = cursor.getString(1);
model.infoCode = cursor.getString(2);
model.content = cursor.getString(3);
close();
return model;
} else {
close();
return null;
}
}
public synchronized void insert(SchoolInfoModel model) {
initDB();
ContentValues values = new ContentValues();
values.put("infoName", model.infoName);
values.put("infoCode", model.infoCode);
values.put("content", model.content);
try {
sqLiteDatabase.insert(TABLE, null, values);
} catch (Exception e) {
e.printStackTrace();
}
close();
}
public synchronized void delete_all() {
initDB();
String sql = "delete from " + TABLE;
try {
sqLiteDatabase.execSQL(sql);
} catch (Exception e) {
e.printStackTrace();
}
close();
}
private void close() {
try {
sqLiteDatabase.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
22f693d8cf7c473c086a21e4db9dfbc3a27ad73c | 39d9bb7791787972a09da0a4e9c748d8fec3a86c | /gcoinsExample/app/src/main/java/gcode/baseproject/domain/repository/customer/GetDataAsyncTask.java | d99fbf3767b9b360cc9e8658cb62a1d46df824d3 | [] | no_license | DanielDPS/SGRApp | 4ccfc629302233a31ac7563021beb155c3f77866 | 1c60acd3b798b6ed0ef779b2c149ca3c09af77d3 | refs/heads/master | 2020-04-29T05:23:44.514159 | 2019-05-27T15:27:00 | 2019-05-27T15:27:00 | 175,881,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,183 | java | package gcode.baseproject.domain.repository.customer;
import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import java.util.List;
import gcode.baseproject.interactors.MyContext;
import gcode.baseproject.interactors.db.dao.CustomerDao;
import gcode.baseproject.interactors.db.entities.CustomerEntity;
import gcode.baseproject.interactors.progress.ValidatingProgress;
import gcode.baseproject.view.ui.account.MainActivity;
public class GetDataAsyncTask extends AsyncTask<Void,Void, List<CustomerEntity>>
{
private CustomerDao customerDaoAsyncTask ;
private List<CustomerEntity> list;
public GetDataAsyncTask(CustomerDao DAO ){
this.customerDaoAsyncTask= DAO;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
public List<CustomerEntity> getList(){
return this.list;
}
@Override
protected List<CustomerEntity> doInBackground(Void... voids) {
this.list= customerDaoAsyncTask.getCustomers();
return list;
}
@Override
protected void onPostExecute(List<CustomerEntity> entities) {
super.onPostExecute(entities);
}
}
| [
"[email protected]"
] | |
04ec83317266ad594e1ca621e9d580c8ad169fb0 | 8695d1ae6024bc7dfb2d8da57101b1b11e2b8f7f | /SPRINGBOOT/demo/src/main/java/com/example/demo/DemoApplication.java | 9752e24ae2e7053d131269a55a58d8d20b0dea77 | [] | no_license | arun-vikram/java-full-stack | c590120a021ecf4c1a17a2e826c9dce3ecaf5c2a | 89efe4d76f555f57897d25d042464e12ef5c9075 | refs/heads/main | 2023-06-18T17:57:14.627627 | 2021-07-14T15:48:27 | 2021-07-14T15:48:27 | 379,301,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 692 | java |
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@GetMapping("/hello")
public String hello(@RequestParam(value = "name", defaultValue = "World") String name) {
return String.format("Hello %s!", name);
}
}
| [
"[email protected]"
] | |
438f3c82d8c6893eeba2f0094e38cc78f0609fe9 | cd8843d24154202f92eaf7d6986d05a7266dea05 | /saaf-base-5.0/1012_saaf-bpm-application/src/main/java/com/sie/saaf/app/BpmApplication.java | 6134a8fd1158dab7201a8a5443d5a6d335284a11 | [] | no_license | lingxiaoti/tta_system | fbc46c7efc4d408b08b0ebb58b55d2ad1450438f | b475293644bfabba9aeecfc5bd6353a87e8663eb | refs/heads/master | 2023-03-02T04:24:42.081665 | 2021-02-07T06:48:02 | 2021-02-07T06:48:02 | 336,717,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,007 | java | package com.sie.saaf.app;
import com.sie.saaf.common.util.SpringBeanUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
@RestController
@ImportResource({"classpath*:com/sie/saaf/app/config/spring*.xml"/*com,"com/sie/saaf/app/config/message.cfg.xml"*/})
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
@ComponentScan({"org.activiti.rest.editor", "org.activiti.rest.diagram"})
@EnableWebSecurity
public class BpmApplication {
private static Logger log= LoggerFactory.getLogger(BpmApplication.class);
/**
* ๅฎไพๅRestTemplate๏ผ้่ฟ@LoadBalancedๆณจ่งฃๅผๅฏๅ่กก่ด่ฝฝ่ฝๅ.
* @return restTemplate
*/
@Bean
@LoadBalanced
public RestTemplate restTemplate() {
return new RestTemplate();
}
public static void main(String[] args) {
//SpringApplication.run(BpmApplication.class, args);
ApplicationContext context = SpringApplication.run(BpmApplication.class);
SpringBeanUtil.setApplicationContext(context);
String[] activeProfiles = context.getEnvironment().getActiveProfiles();
for (String profile : activeProfiles) {
log.warn("Spring Boot ไฝฟ็จprofileไธบ:{}" , profile);
}
}
}
| [
"[email protected]"
] | |
9d5109db738e79f156696c755112a4490d8ac372 | aec434d9c5bcfbdb6452cbdf130f49011872b089 | /src/main/java/javaForCompleteBeginners/programming_CoreJavaClasses/vidY_twentyFive_PublicPrivateProtected/world/Oak.java | d29af4b48034be873b6a6a909a98d64c4f7aca99 | [] | no_license | Artistic-King4777/Cave-Of-Programming_NotesFor-ALlClassesAndVids | cf80bb085b464ad63c277634a227d209588c6546 | 45ca66b85f2802140f47f2d322a467915bcf31b6 | refs/heads/master | 2021-09-23T21:53:41.192470 | 2018-09-28T01:44:29 | 2018-09-28T01:44:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 705 | java | package javaForCompleteBeginners.programming_CoreJavaClasses.vidY_twentyFive_PublicPrivateProtected.world;
public class Oak extends Plant{
// Consstructor
public Oak() {
// Won't work -- type is private
// so means can only be accessed within the Plant Class
// type = "tree";
// This works --- size is protected, Oak is a subclass of plant. and
// Protected is still un callable from the outside like a
// private but its accessible within the class, any sub class
// and the same package
this.size = "large";
// No access specifier; works because Oak and Plant in same package
this.height = 10;
}
}
| [
"[email protected]"
] | |
a29fd4e2dc50e4276883e57c9e6ffcad92b7a333 | 4483fc9fa659335d9077c5e62bf21284332adeac | /src/com/directv/bundlesIntegration/manager/INVProcessor.java | 937d2714a7e35ff83ab92ad72a1c960013fa3569 | [] | no_license | sivagurut/BundleServices | 9fac0d00dc331cbe4b5262bc42c96196c7f7dbac | df66332e449cf31698ae7829126a11ccce9ccad8 | refs/heads/master | 2021-03-12T20:16:32.662332 | 2011-05-25T06:17:00 | 2011-05-25T06:17:00 | 1,653,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,304 | java | package com.directv.bundlesIntegration.manager;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.directv.broadbandBundles.ui.model.output.ResponseDTO;
import com.directv.bundlesIntegration.exception.NVCException;
// TODO: Auto-generated Javadoc
/**
* The Interface INVProcessor.
*/
public interface INVProcessor {
/**
* Process submitted info.
*
* @param request the request
* @param response the response
*
* @return the response dto
* @throws NVCException the nVC exception
*/
public ResponseDTO processSubmittedInfo(HttpServletRequest request, HttpServletResponse response) throws NVCException;
/**
* Process nv customizations.
*
* @param xmlCustomizationInput the xml customization input
*
* @return the map< string,? extends object>
* @throws NVCException the nVC exception
*/
public Map<String, ? extends Object> processNVCustomizations(String xmlCustomizationInput) throws NVCException;
/**
* Cancel bundle.
*
* @param request the request
* @param response the response
*
* @return the response dto
* @throws NVCException the nVC exception
*/
public ResponseDTO cancelBundle(HttpServletRequest request, HttpServletResponse response) throws NVCException;
}
| [
"[email protected]"
] | |
852d8c2024a27b19c389035eb96aaa615bd353ee | 1861114f43b179876e1e8d3364b3ab8043ecb4de | /src/main/java/thaumicenergistics/parts/AEPartEssentiaIO.java | 66791144056c577de44d3202d0b23f2f3bb57363 | [
"MIT"
] | permissive | teamoort/ThaumicEnergistics | bc7f4a26b5659067ce0b26acd3e2c147a8719dd9 | be3ace09d3a55e6c56a9d06464518d24261ddcb5 | refs/heads/master | 2021-01-15T17:46:10.113974 | 2014-09-05T06:25:11 | 2014-09-05T06:25:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,008 | java | package thaumicenergistics.parts;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Vec3;
import net.minecraftforge.fluids.FluidStack;
import thaumcraft.api.aspects.Aspect;
import thaumicenergistics.container.ContainerPartEssentiaIOBus;
import thaumicenergistics.fluids.GaseousEssentia;
import thaumicenergistics.gui.GuiEssentiatIO;
import thaumicenergistics.integration.tc.EssentiaConversionHelper;
import thaumicenergistics.integration.tc.EssentiaItemContainerHelper;
import thaumicenergistics.integration.tc.EssentiaTileContainerHelper;
import thaumicenergistics.network.IAspectSlotPart;
import thaumicenergistics.network.packet.client.PacketClientAspectSlot;
import thaumicenergistics.network.packet.client.PacketClientEssentiaIOBus;
import thaumicenergistics.registries.AEPartsEnum;
import thaumicenergistics.util.EffectiveSide;
import thaumicenergistics.util.IInventoryUpdateReceiver;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.RedstoneMode;
import appeng.api.definitions.Materials;
import appeng.api.networking.IGridNode;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.security.MachineSource;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEFluidStack;
import appeng.parts.automation.UpgradeInventory;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public abstract class AEPartEssentiaIO
extends AbstractAEPartBase
implements IGridTickable, IInventoryUpdateReceiver, IAspectSlotPart, IAEAppEngInventory
{
/**
* How much essentia can be transfered per second.
*/
private final static int BASE_TRANSFER_PER_SECOND = 4;
/**
* How much additional essentia can be transfered per upgrade.
*/
private final static int ADDITIONAL_TRANSFER_PER_SECOND = 7;
private final static int MINIMUM_TICKS_PER_OPERATION = 10;
private final static int MAXIMUM_TICKS_PER_OPERATION = 40;
private final static int MAXIMUM_TRANSFER_PER_SECOND = 64;
private final static int MINIMUM_TRANSFER_PER_SECOND = 1;
/**
* Maximum number of filter slots.
*/
private final static int MAX_FILTER_SIZE = 9;
private final static int BASE_SLOT_INDEX = 4;
private final static int[] TIER2_INDEXS = { 0, 2, 6, 8 };
private final static int[] TIER1_INDEXS = { 1, 3, 5, 7 };
private final static int UPGRADE_INVENTORY_SIZE = 4;
/**
* How much AE power is required to keep the part active.
*/
private static final double IDLE_POWER_DRAIN = 0.7;
/**
* The amount of power required to transfer 1 essentia.
*/
private static final double POWER_DRAIN_PER_ESSENTIA = 0.5;
private static final RedstoneMode[] REDSTONE_MODES = RedstoneMode.values();
protected List<Aspect> filteredAspects = new ArrayList<Aspect>( AEPartEssentiaIO.MAX_FILTER_SIZE );
private RedstoneMode redstoneMode = RedstoneMode.IGNORE;
protected byte filterSize;
protected byte upgradeSpeedCount = 0;
protected boolean redstoneControlled;
private boolean lastRedstone;
private int[] availableFilterSlots = { AEPartEssentiaIO.BASE_SLOT_INDEX };
private UpgradeInventory upgradeInventory = new UpgradeInventory( this.associatedItem, this, AEPartEssentiaIO.UPGRADE_INVENTORY_SIZE );
private List<ContainerPartEssentiaIOBus> listeners = new ArrayList<ContainerPartEssentiaIOBus>();
public AEPartEssentiaIO( final AEPartsEnum associatedPart )
{
super( associatedPart );
// Initialize the list
for( int index = 0; index < AEPartEssentiaIO.MAX_FILTER_SIZE; index++ )
{
this.filteredAspects.add( null );
}
}
private boolean canDoWork()
{
boolean canWork = true;
if( this.redstoneControlled )
{
switch ( this.getRedstoneMode() )
{
case HIGH_SIGNAL:
canWork = this.redstonePowered;
break;
case IGNORE:
break;
case LOW_SIGNAL:
canWork = !this.redstonePowered;
break;
case SIGNAL_PULSE:
canWork = false;
break;
}
}
return canWork;
}
private int getTransferAmountPerSecond()
{
return BASE_TRANSFER_PER_SECOND + ( this.upgradeSpeedCount * ADDITIONAL_TRANSFER_PER_SECOND );
}
private void notifyListenersOfFilterAspectChange()
{
for( ContainerPartEssentiaIOBus listener : this.listeners )
{
listener.setFilteredAspect( this.filteredAspects );
}
}
private void notifyListenersOfFilterSizeChange()
{
for( ContainerPartEssentiaIOBus listener : this.listeners )
{
listener.setFilterSize( this.filterSize );
}
}
private void notifyListenersOfRedstoneControlledChange()
{
for( ContainerPartEssentiaIOBus listener : this.listeners )
{
listener.setRedstoneControlled( this.redstoneControlled );
}
}
private void notifyListenersOfRedstoneModeChange()
{
for( ContainerPartEssentiaIOBus listener : this.listeners )
{
listener.setRedstoneMode( this.redstoneMode );
}
}
private void resizeAvailableArray()
{
// Resize the available slots
this.availableFilterSlots = new int[1 + ( this.filterSize * 4 )];
// Add the base slot
this.availableFilterSlots[0] = AEPartEssentiaIO.BASE_SLOT_INDEX;
if( this.filterSize < 2 )
{
// Reset tier 2 slots
for( int i = 0; i < AEPartEssentiaIO.TIER2_INDEXS.length; i++ )
{
this.filteredAspects.set( AEPartEssentiaIO.TIER2_INDEXS[i], null );
}
if( this.filterSize < 1 )
{
// Reset tier 1 slots
for( int i = 0; i < AEPartEssentiaIO.TIER1_INDEXS.length; i++ )
{
this.filteredAspects.set( AEPartEssentiaIO.TIER1_INDEXS[i], null );
}
}
else
{
// Tier 1 slots
System.arraycopy( AEPartEssentiaIO.TIER1_INDEXS, 0, this.availableFilterSlots, 1, 4 );
}
}
else
{
// Add both
System.arraycopy( AEPartEssentiaIO.TIER1_INDEXS, 0, this.availableFilterSlots, 1, 4 );
System.arraycopy( AEPartEssentiaIO.TIER2_INDEXS, 0, this.availableFilterSlots, 5, 4 );
}
}
private boolean takePowerFromNetwork( final int essentiaAmount, final Actionable mode )
{
// Get the energy grid
IEnergyGrid eGrid = this.gridBlock.getEnergyGrid();
// Ensure we have a grid
if( eGrid == null )
{
return false;
}
// Calculate amount of power to take
double powerDrain = AEPartEssentiaIO.POWER_DRAIN_PER_ESSENTIA * essentiaAmount;
// Extract
return( eGrid.extractAEPower( powerDrain, mode, PowerMultiplier.CONFIG ) >= powerDrain );
}
protected boolean extractEssentiaFromNetwork( final int amountToFillContainer )
{
// Get the aspect in the container
Aspect aspectToMatch = EssentiaTileContainerHelper.instance.getAspectInContainer( this.facingContainer );
// Do we have the power to transfer this amount?
if( !this.takePowerFromNetwork( amountToFillContainer, Actionable.SIMULATE ) )
{
// Not enough power
return false;
}
// Loop over all aspect filters
for( Aspect filterAspect : this.filteredAspects )
{
// Can we transfer?
if( ( filterAspect == null ) || ( !this.aspectTransferAllowed( filterAspect ) ) )
{
// Invalid or not allowed
continue;
}
// Are we searching for a match?
if( ( aspectToMatch != null ) && ( filterAspect != aspectToMatch ) )
{
// Not a match
continue;
}
// Can we inject any of this into the container
if( EssentiaTileContainerHelper.instance.injectIntoContainer( this.facingContainer, 1, filterAspect, Actionable.SIMULATE ) < 1 )
{
// Container will not accept any of this
continue;
}
// Get the gas form of the essentia
GaseousEssentia essentiaGas = GaseousEssentia.getGasFromAspect( filterAspect );
// Create the fluid stack
IAEFluidStack toExtract = EssentiaConversionHelper.instance.createAEFluidStackInEssentiaUnits( essentiaGas, amountToFillContainer );
// Simulate a network extraction
IAEFluidStack extractedStack = this.extractFluid( toExtract, Actionable.SIMULATE );
// Were we able to extract any?
if( ( extractedStack != null ) && ( extractedStack.getStackSize() > 0 ) )
{
// Fill the container
int filledAmount = (int)EssentiaTileContainerHelper.instance.injectIntoContainer( this.facingContainer, extractedStack,
Actionable.MODULATE );
// Were we able to fill the container?
if( filledAmount == 0 )
{
continue;
}
// Take the power required for the filled amount
this.takePowerFromNetwork( (int)EssentiaConversionHelper.instance.convertFluidAmountToEssentiaAmount( filledAmount ),
Actionable.MODULATE );
// Take from the network
this.extractFluid( EssentiaConversionHelper.instance.createAEFluidStackInFluidUnits( essentiaGas, filledAmount ), Actionable.MODULATE );
// Done
return true;
}
}
return false;
}
/**
* Extracts fluid from the ME network.
*
* @param toExtract
* @param action
* @return
*/
protected final IAEFluidStack extractFluid( final IAEFluidStack toExtract, final Actionable action )
{
if( ( this.gridBlock == null ) || ( this.facingContainer == null ) )
{
return null;
}
IMEMonitor<IAEFluidStack> monitor = this.gridBlock.getFluidMonitor();
if( monitor == null )
{
return null;
}
return monitor.extractItems( toExtract, action, new MachineSource( this ) );
}
protected boolean injectEssentaToNetwork( int amountToDrainFromContainer )
{
// Get the aspect in the container
Aspect aspectToDrain = EssentiaTileContainerHelper.instance.getAspectInContainer( this.facingContainer );
if( ( aspectToDrain == null ) || ( !this.aspectTransferAllowed( aspectToDrain ) ) )
{
return false;
}
// Simulate a drain from the container
FluidStack drained = EssentiaTileContainerHelper.instance.extractFromContainer( this.facingContainer, amountToDrainFromContainer,
aspectToDrain, Actionable.SIMULATE );
// Was any drained?
if( drained == null )
{
return false;
}
// Create the fluid stack
IAEFluidStack toFill = AEApi.instance().storage().createFluidStack( drained );
// Simulate inject into the network
IAEFluidStack notInjected = this.injectFluid( toFill, Actionable.SIMULATE );
// Was any not injected?
if( notInjected != null )
{
// Calculate how much was injected into the network
int amountInjected = (int)( toFill.getStackSize() - notInjected.getStackSize() );
// None could be injected
if( amountInjected == 0 )
{
return false;
}
// Convert from fluid units to essentia units
amountInjected = (int)EssentiaConversionHelper.instance.convertFluidAmountToEssentiaAmount( amountInjected );
// Some was unable to be injected, adjust the drain amounts
amountToDrainFromContainer = amountInjected;
toFill.setStackSize( amountInjected );
}
// Do we have the power to inject?
if( !this.takePowerFromNetwork( amountToDrainFromContainer, Actionable.SIMULATE ) )
{
// Not enough power
return false;
}
// Take power
this.takePowerFromNetwork( amountToDrainFromContainer, Actionable.MODULATE );
// Inject
this.injectFluid( toFill, Actionable.MODULATE );
// Drain
EssentiaTileContainerHelper.instance.extractFromContainer( this.facingContainer, amountToDrainFromContainer, aspectToDrain,
Actionable.MODULATE );
return true;
}
/**
* Injects fluid into the ME network.
*
* @param toInject
* @param action
* @return
*/
protected final IAEFluidStack injectFluid( final IAEFluidStack toInject, final Actionable action )
{
if( ( this.gridBlock == null ) || ( this.facingContainer == null ) )
{
return null;
}
IMEMonitor<IAEFluidStack> monitor = this.gridBlock.getFluidMonitor();
if( monitor == null )
{
return null;
}
return monitor.injectItems( toInject, action, new MachineSource( this ) );
}
public boolean addFilteredAspectFromItemstack( final EntityPlayer player, final ItemStack itemStack )
{
Aspect itemAspect = EssentiaItemContainerHelper.instance.getAspectInContainer( itemStack );
if( itemAspect != null )
{
// Are we already filtering this aspect?
if( this.filteredAspects.contains( itemAspect ) )
{
return true;
}
// Add to the first open slot
for( int avalibleIndex = 0; avalibleIndex < this.availableFilterSlots.length; avalibleIndex++ )
{
int filterIndex = this.availableFilterSlots[avalibleIndex];
// Is this space empty?
if( this.filteredAspects.get( filterIndex ) == null )
{
// Is this server side?
if( EffectiveSide.isServerSide() )
{
// Set the filter
this.setAspect( filterIndex, itemAspect, player );
}
return true;
}
}
}
return false;
}
public void addListener( final ContainerPartEssentiaIOBus container )
{
if( !this.listeners.contains( container ) )
{
this.listeners.add( container );
}
}
public abstract boolean aspectTransferAllowed( Aspect aspect );
@Override
public int cableConnectionRenderTo()
{
return 5;
}
public abstract boolean doWork( int transferAmount );
@Override
public Object getClientGuiElement( final EntityPlayer player )
{
return new GuiEssentiatIO( this, player );
}
@Override
public void getDrops( final List<ItemStack> drops, final boolean wrenched )
{
// Were we wrenched?
if( wrenched )
{
// No drops
return;
}
// Add upgrades to drops
for( int slotIndex = 0; slotIndex < AEPartEssentiaIO.UPGRADE_INVENTORY_SIZE; slotIndex++ )
{
// Get the upgrade card in this slot
ItemStack slotStack = this.upgradeInventory.getStackInSlot( slotIndex );
// Is it not null?
if( ( slotStack != null ) && ( slotStack.stackSize > 0 ) )
{
// Add to the drops
drops.add( slotStack );
}
}
}
/**
* Determines how much power the part takes for just
* existing.
*/
@Override
public double getIdlePowerUsage()
{
return AEPartEssentiaIO.IDLE_POWER_DRAIN;
}
@Override
public int getLightLevel()
{
return 0;
}
public RedstoneMode getRedstoneMode()
{
return this.redstoneMode;
}
@Override
public Object getServerGuiElement( final EntityPlayer player )
{
return new ContainerPartEssentiaIOBus( this, player );
}
@Override
public TickingRequest getTickingRequest( final IGridNode arg0 )
{
return new TickingRequest( MINIMUM_TICKS_PER_OPERATION, MAXIMUM_TICKS_PER_OPERATION, false, false );
}
public UpgradeInventory getUpgradeInventory()
{
return this.upgradeInventory;
}
@Override
public boolean onActivate( final EntityPlayer player, final Vec3 position )
{
boolean activated = super.onActivate( player, position );
this.onInventoryChanged( null );
return activated;
}
@Override
public void onChangeInventory( final IInventory inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack )
{
if( inv == this.upgradeInventory )
{
this.onInventoryChanged( inv );
}
}
/**
* Called when a player has clicked the redstone button in the gui.
*
* @param player
*/
public void onClientRequestChangeRedstoneMode( final EntityPlayer player )
{
// Get the current ordinal, and increment it
int nextOrdinal = this.redstoneMode.ordinal() + 1;
// Bounds check
if( nextOrdinal >= AEPartEssentiaIO.REDSTONE_MODES.length )
{
nextOrdinal = 0;
}
// Set the mode
this.redstoneMode = AEPartEssentiaIO.REDSTONE_MODES[nextOrdinal];
// Notify listeners
this.notifyListenersOfRedstoneModeChange();
}
/**
* Called when a client gui is requesting a full update.
*
* @param player
*/
public void onClientRequestFullUpdate( final EntityPlayer player )
{
// Set the filter list
new PacketClientAspectSlot().createFilterListUpdate( this.filteredAspects, player ).sendPacketToPlayer();
// Set the state of the bus
new PacketClientEssentiaIOBus().createFullUpdate( player, this.redstoneMode, this.filterSize, this.redstoneControlled ).sendPacketToPlayer();
}
@Override
public void onInventoryChanged( final IInventory sourceInventory )
{
int oldFilterSize = this.filterSize;
this.filterSize = 0;
this.redstoneControlled = false;
this.upgradeSpeedCount = 0;
Materials aeMaterals = AEApi.instance().materials();
for( int i = 0; i < this.upgradeInventory.getSizeInventory(); i++ )
{
ItemStack slotStack = this.upgradeInventory.getStackInSlot( i );
if( slotStack != null )
{
if( aeMaterals.materialCardCapacity.sameAsStack( slotStack ) )
{
this.filterSize++ ;
}
else if( aeMaterals.materialCardRedstone.sameAsStack( slotStack ) )
{
this.redstoneControlled = true;
}
else if( aeMaterals.materialCardSpeed.sameAsStack( slotStack ) )
{
this.upgradeSpeedCount++ ;
}
}
}
// Did the filter size change?
if( oldFilterSize != this.filterSize )
{
this.resizeAvailableArray();
}
// Is this client side?
if( EffectiveSide.isClientSide() )
{
return;
}
this.notifyListenersOfFilterSizeChange();
this.notifyListenersOfRedstoneControlledChange();
}
@Override
public void onNeighborChanged()
{
super.onNeighborChanged();
if( this.redstonePowered )
{
if( !this.lastRedstone )
{
this.doWork( this.getTransferAmountPerSecond() );
}
}
this.lastRedstone = this.redstonePowered;
}
@Override
public void readFromNBT( final NBTTagCompound data )
{
super.readFromNBT( data );
// Read redstone mode
this.redstoneMode = RedstoneMode.values()[data.getInteger( "redstoneMode" )];
for( int index = 0; index < AEPartEssentiaIO.MAX_FILTER_SIZE; index++ )
{
String aspectTag = data.getString( "AspectFilter#" + index );
if( !aspectTag.equals( "" ) )
{
this.filteredAspects.set( index, Aspect.aspects.get( aspectTag ) );
}
}
this.upgradeInventory.readFromNBT( data, "upgradeInventory" );
this.onInventoryChanged( this.upgradeInventory );
}
@Override
public final boolean readFromStream( final ByteBuf stream ) throws IOException
{
return super.readFromStream( stream );
}
/**
* Called client-side to keep the client-side part in sync
* with the server-side part. This aids in keeping the
* gui in sync even in high network lag enviroments.
*
* @param filteredAspects
*/
@SideOnly(Side.CLIENT)
public void receiveFilterList( final List<Aspect> filteredAspects )
{
this.filteredAspects = filteredAspects;
}
/**
* Called client-side to keep the client-side part in sync
* with the server-side part. This aids in keeping the
* gui in sync even in high network lag enviroments.
*
* @param filterSize
*/
@SideOnly(Side.CLIENT)
public void receiveFilterSize( final byte filterSize )
{
this.filterSize = filterSize;
this.resizeAvailableArray();
}
public void removeListener( final ContainerPartEssentiaIOBus container )
{
this.listeners.remove( container );
}
/**
* Called when the internal inventory changes.
*/
@Override
public void saveChanges()
{
this.host.markForSave();
}
@Override
public final void setAspect( final int index, final Aspect aspect, final EntityPlayer player )
{
// Set the filter
this.filteredAspects.set( index, aspect );
// Update the listeners
this.notifyListenersOfFilterAspectChange();
}
@Override
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
{
if( this.canDoWork() )
{
// Calculate the amount to transfer per second
int transferAmountPerSecond = this.getTransferAmountPerSecond();
// Calculate amount to transfer this operation
int transferAmount = (int)( transferAmountPerSecond * ( ticksSinceLastCall / 20.F ) );
// Clamp
if( transferAmount < MINIMUM_TRANSFER_PER_SECOND )
{
transferAmount = MINIMUM_TRANSFER_PER_SECOND;
}
else if( transferAmount > MAXIMUM_TRANSFER_PER_SECOND )
{
transferAmount = MAXIMUM_TRANSFER_PER_SECOND;
}
if( this.doWork( transferAmount ) )
{
return TickRateModulation.URGENT;
}
}
return TickRateModulation.IDLE;
}
@Override
public void writeToNBT( final NBTTagCompound data )
{
super.writeToNBT( data );
// Write the redstone mode
data.setInteger( "redstoneMode", this.redstoneMode.ordinal() );
for( int i = 0; i < AEPartEssentiaIO.MAX_FILTER_SIZE; i++ )
{
Aspect aspect = this.filteredAspects.get( i );
String aspectTag = "";
if( aspect != null )
{
aspectTag = aspect.getTag();
}
data.setString( "AspectFilter#" + i, aspectTag );
}
this.upgradeInventory.writeToNBT( data, "upgradeInventory" );
}
@Override
public final void writeToStream( final ByteBuf stream ) throws IOException
{
super.writeToStream( stream );
}
}
| [
"[email protected]"
] | |
ad35212499a36a197daaae094c1cc000aba41e31 | 688c66d40f8bbd5114c04c2fc4e78eb44625d19e | /rabbit/src/Lesson29/ABC.java | 27b8e18bb383c9d807c1b60b022c59b1c0c094f8 | [] | no_license | multinames/java-courses | 67bddff2be114ba568afc0b6a2cf8e58f3d774d3 | bd75e9c44081199aa0e85c9f588ec9677a05a9aa | refs/heads/master | 2022-12-23T18:28:29.440732 | 2020-09-30T05:30:49 | 2020-09-30T05:30:49 | 226,126,693 | 0 | 0 | null | 2022-12-16T15:09:16 | 2019-12-05T14:57:55 | Java | UTF-8 | Java | false | false | 71 | java | package Lesson29;
public class ABC {
public void Show(){
}
}
| [
"[email protected]"
] | |
e73cf7c6b2d8ad226e97f2b2ac10bdb43f0c7b22 | 666025f7d07cbea88c8800f7f516fe0d3b071e04 | /src/me/cwang/discosheep/BabyParty.java | 88c8b80bfdba265e42fb4123c5a04a54dfc4f826 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Gibstick/DiscoSheep | c649958d52b7b4fb59d2fbaa1495d2dca5bb14fa | 4841885835c1df9ce9c17afbb4b1ac38a8173ded | refs/heads/master | 2021-01-23T08:52:56.819105 | 2015-12-20T06:41:56 | 2015-12-20T06:41:56 | 11,070,535 | 1 | 2 | null | 2015-12-20T06:41:56 | 2013-06-30T13:23:13 | Java | UTF-8 | Java | false | false | 1,194 | java | package me.cwang.discosheep;
import org.bukkit.entity.Ageable;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Sheep;
/**
* Created by Charlie on 2015-08-17.
*/
public class BabyParty extends DiscoDecorator {
private int guestBabyCount;
private int sheepBabyCount;
public BabyParty(AbstractParty p, int babyness) {
super(p);
sheepBabyCount = (int) ((babyness / 100.0d) * getSheep());
int totalGuests = 0;
for (int i : getGuestMap().values()) {
totalGuests += i;
}
guestBabyCount = (int) ((babyness / 100.0d) * totalGuests);
}
@Override
protected Entity spawnGuest(EntityType type) {
Entity guest = super.spawnGuest(type);
if (guest instanceof Ageable && guestBabyCount > 0) {
Ageable baby = (Ageable) guest;
baby.setBaby();
--guestBabyCount;
}
return guest;
}
@Override
protected Sheep spawnSheep() {
Sheep sheep = super.spawnSheep();
if (sheepBabyCount > 0) {
sheep.setBaby();
--sheepBabyCount;
}
return sheep;
}
}
| [
"[email protected]"
] | |
6c01944581f50230c2d4391365ea58cc12675884 | 13aa3182020544625c9d7bbb10f8b5e21a3b321a | /Trivinho/app/src/main/java/javeriana/compumovil/tcp/trivinho/CustomInfoWindowAdapter.java | dc0a847b1c854812cb0c7ec0214f9ebf9b10f3b8 | [] | no_license | IntroCompuMovil18301/Trivinho | 38a9f5bedae55fee0aa37a2724e976417ddb65d8 | 9d3df5dd601d2e7e49277735d363506f113cf96f | refs/heads/master | 2020-03-23T20:56:16.402692 | 2018-11-19T17:23:03 | 2018-11-19T17:23:03 | 142,072,034 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,676 | java | package javeriana.compumovil.tcp.trivinho;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.storage.FileDownloadTask;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import java.io.File;
import java.io.IOException;
import javeriana.compumovil.tcp.trivinho.negocio.Alojamiento;
import javeriana.compumovil.tcp.trivinho.negocio.FotoAlojamiento;
public class CustomInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
private final View view;
private static LayoutInflater inflater = null;
private Context contexto;
private StorageReference mStorageRef;
private ImageView foto;
public CustomInfoWindowAdapter(Context contexto) {
this.contexto = contexto;
inflater = (LayoutInflater)contexto.getSystemService(contexto.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.infowindowconstum,null);
mStorageRef = FirebaseStorage.getInstance().getReference();
}
private void agregarInformacion(Marker marker){
Alojamiento alojamiento = null;
TextView tipo = (TextView) view.findViewById(R.id.infoTipo);
TextView moneda = (TextView) view.findViewById(R.id.infoMoneda);
TextView precio = (TextView) view.findViewById(R.id.infoPrecio);
TextView descripion = (TextView) view.findViewById(R.id.infoDescripcion);
foto = (ImageView) view.findViewById(R.id.infoimage);
RatingBar rating = (RatingBar) view.findViewById(R.id.infoRating);
if(marker.getTag() instanceof Alojamiento){
alojamiento = (Alojamiento) marker.getTag();
}
if(alojamiento!=null){
tipo.setText(alojamiento.getTipo());
moneda.setText(alojamiento.getTipoMoneda());
moneda.setVisibility(View.VISIBLE);
precio.setText(Double.toString(alojamiento.getValorPorNoche()));
precio.setVisibility(View.VISIBLE);
descripion.setText(alojamiento.getDescripcion());
descripion.setVisibility(View.VISIBLE);
rating.setRating(alojamiento.getPuntaje());
rating.setVisibility(View.VISIBLE);
foto.setVisibility(View.VISIBLE);
FotoAlojamiento fotoAlojamiento = alojamiento.getFotos().get(0);
descargaryMostrarFoto(fotoAlojamiento.getRutaFoto());
}
else{
tipo.setText(marker.getTitle());
moneda.setVisibility(View.GONE);
precio.setVisibility(View.GONE);
descripion.setText(marker.getSnippet());
rating.setVisibility(View.GONE);
foto.setVisibility(View.GONE);
}
}
@Override
public View getInfoContents(Marker marker) {
agregarInformacion(marker);
return view;
}
@Override
public View getInfoWindow(Marker m) {
agregarInformacion(m);
return view;
}
private void descargaryMostrarFoto (String ruta){
final StorageReference fotoUsuario = mStorageRef.child(ruta);
File localFile = null;
try {
localFile = File.createTempFile("images", "jpg");
} catch (IOException e) {
e.printStackTrace();
}
final File finalLocalFile = localFile;
fotoUsuario.getFile(localFile)
.addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() {
@Override
public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {
// Successfully downloaded data to local file
// ...
String filePath = finalLocalFile.getPath();
Bitmap bitmap = BitmapFactory.decodeFile(filePath);
foto.setImageBitmap(bitmap);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Handle failed download
// ...
}
});
}
}
| [
"[email protected]"
] | |
ee2615faa7dae7a92e48ba041250439b2c67abf1 | bd540b8f8b80b0773497128b366bb37abe0b930e | /xs2a-impl/src/main/java/de/adorsys/aspsp/xs2a/web/aspect/PaymentCancellationAspect.java | 02cee362e6941704fcb5e2f2bc2a736932493aaf | [
"Apache-2.0"
] | permissive | toretest/xs2a | 3445d3b1eee1de2caa88b8d9536325494df786e1 | 9b23b037ba9f9fc64fc58ffee927c0ef383f5eb1 | refs/heads/master | 2020-04-04T17:06:10.937371 | 2018-11-01T18:25:52 | 2018-11-01T18:25:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,534 | java | /*
* Copyright 2018-2018 adorsys GmbH & Co KG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.adorsys.aspsp.xs2a.web.aspect;
import de.adorsys.aspsp.xs2a.domain.Links;
import de.adorsys.aspsp.xs2a.domain.ResponseObject;
import de.adorsys.aspsp.xs2a.domain.pis.CancelPaymentResponse;
import de.adorsys.aspsp.xs2a.service.message.MessageService;
import de.adorsys.aspsp.xs2a.service.profile.AspspProfileServiceWrapper;
import de.adorsys.aspsp.xs2a.web.PaymentController;
import de.adorsys.psd2.xs2a.core.profile.PaymentType;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
@Aspect
@Component
public class PaymentCancellationAspect extends AbstractLinkAspect<PaymentController> {
public PaymentCancellationAspect(AspspProfileServiceWrapper aspspProfileService, MessageService messageService) {
super(aspspProfileService, messageService);
}
@AfterReturning(pointcut = "execution(* de.adorsys.aspsp.xs2a.service.PaymentService.cancelPayment(..)) && args(paymentType,paymentId)", returning = "result", argNames = "result,paymentType,paymentId")
public ResponseObject<CancelPaymentResponse> cancelPayment(ResponseObject<CancelPaymentResponse> result, PaymentType paymentType, String paymentId) {
if (!result.hasError()) {
CancelPaymentResponse response = result.getBody();
response.setLinks(buildCancellationLinks(response.isStartAuthorisationRequired(), paymentType, paymentId));
return result;
}
return enrichErrorTextMessage(result);
}
private Links buildCancellationLinks(boolean startAuthorisationRequired, PaymentType paymentType, String paymentId) {
Links links = new Links();
if (startAuthorisationRequired) {
links.setStartAuthorisation(buildPath("/v1/{payment-service}/{payment-id}/cancellation-authorisations", paymentType.getValue(), paymentId));
}
return links;
}
}
| [
"[email protected]"
] | |
f5c2ad57aba7cb50073ef2748ce6de5d1f39fc6e | f8f2c2a018fba9ecd0cc8b5dfbf8f6d81412e15d | /WebView_progressbar/app/act/MainActivity.java | f1b690610cf1f71b37672b5f2fbd493bb7a59b4a | [] | no_license | guanqingqing/Android_code | fb30459bd121ffe62fc8e1b20fb9f065aab61164 | 6b108dfd64b696f46a4c8ec426103d9dc432d04f | refs/heads/master | 2021-01-01T17:34:08.661499 | 2017-08-25T03:10:37 | 2017-08-25T03:10:37 | 98,098,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,357 | java | package com.bway.webview_progressbar.act;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;
import com.bway.webview_progressbar.R;
import com.bway.webview_progressbar.bean.Data;
import com.bway.webview_progressbar.fragment.MyFragment;
import com.google.gson.Gson;
import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;
import java.util.List;
/**
* ๅฎ็ฐTablayoutๅViewPager็็ปๅ
*/
@ContentView(R.layout.activity_main)
public class MainActivity extends AppCompatActivity {
@ViewInject(R.id.tablayout)
private TabLayout mTabLayout;
@ViewInject(R.id.viewpager)
private ViewPager mViewPager;
private List<Data.DataBean> mList;
private Fragment[] frags;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
x.view().inject(this);
lodeData();
}
private void lodeData() {
//่ฏทๆฑๆฐๆฎ(ๆฐๆฎไธบtablayoutๆพ็คบ็ๆฐๆฎ)
String urlPath ="http://lf.snssdk.com/neihan/service/tabs/";
RequestParams params=new RequestParams(urlPath);
x.http().get(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
if(result!=null){
Gson gson=new Gson();
Data data = gson.fromJson(result,Data.class);
//่ฐ็จๆนๆณ
initTab(data.getData());
}else {
onError(new NullPointerException("่ฟๅๆฐๆฎไธบ็ฉบ"),false);
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
Toast.makeText(MainActivity.this, "่ฟๅๆฐๆฎไธบ็ฉบ", Toast.LENGTH_SHORT).show();
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
}
private void initTab(final List<Data.DataBean> data) {
if(data!=null) {
frags = new Fragment[data.size()];
mList=data;
}
mViewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
return getFragment(position);
}
@Override
public int getCount() {
return data==null?0:data.size();
}
@Override
public CharSequence getPageTitle(int position) {
return data.get(position).getName();
}
});
mTabLayout.setupWithViewPager(mViewPager);
}
private Fragment getFragment(int position) {
Fragment fragment = frags[position];
if(fragment==null){
fragment=MyFragment.getInstance(mList.get(position).getUrl());
frags[position]=fragment;
}
return fragment;
}
}
| [
"[email protected]"
] | |
055385c7354484af61327df2010cb0324449f3e0 | f321db1ace514d08219cc9ba5089ebcfff13c87a | /generated-tests/random/tests/s2/6_re2j/evosuite-tests/com/google/re2j/Parser_ESTest_scaffolding.java | bbb617ed690901c3ab73f81416dae442dc15f933 | [] | no_license | sealuzh/dynamic-performance-replication | 01bd512bde9d591ea9afa326968b35123aec6d78 | f89b4dd1143de282cd590311f0315f59c9c7143a | refs/heads/master | 2021-07-12T06:09:46.990436 | 2020-06-05T09:44:56 | 2020-06-05T09:44:56 | 146,285,168 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,693 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Fri Mar 22 10:40:18 GMT 2019
*/
package com.google.re2j;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class Parser_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "com.google.re2j.Parser";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("user.dir", "/home/apaniche/performance/Dataset/gordon_scripts/projects/6_re2j");
java.lang.System.setProperty("java.io.tmpdir", "/tmp");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(Parser_ESTest_scaffolding.class.getClassLoader() ,
"com.google.re2j.Parser",
"com.google.re2j.CharClass",
"com.google.re2j.Regexp$Op",
"com.google.re2j.UnicodeTables",
"com.google.re2j.Parser$1",
"com.google.re2j.Parser$Stack",
"com.google.re2j.Regexp",
"com.google.re2j.Utils",
"com.google.re2j.CharGroup",
"com.google.re2j.Regexp$1",
"com.google.re2j.Parser$StringIterator",
"com.google.re2j.Parser$Pair",
"com.google.re2j.PatternSyntaxException",
"com.google.re2j.Unicode"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(Parser_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"com.google.re2j.Parser",
"com.google.re2j.Parser$Stack",
"com.google.re2j.Parser$StringIterator",
"com.google.re2j.Parser$Pair",
"com.google.re2j.Regexp$Op",
"com.google.re2j.UnicodeTables",
"com.google.re2j.Parser$1",
"com.google.re2j.Regexp",
"com.google.re2j.CharGroup",
"com.google.re2j.Regexp$1",
"com.google.re2j.Utils",
"com.google.re2j.Unicode",
"com.google.re2j.PatternSyntaxException",
"com.google.re2j.CharClass"
);
}
}
| [
"[email protected]"
] | |
5f78fa731c0a1dc2b35a796c2e821c78a8bfe806 | 5d87cfd2ede0858ed3ca041d49ecc02ee1aebd15 | /JavaApplication_lecture/src/lambda_stream/StreamMapMain.java | 926cf38221209bb24d5ab3ab8a2da1b44c68f5b9 | [] | no_license | yskim621/javaapp_lecture | cad3149e46f1088dae9dec4f32273cad570ef3e9 | 1d5a9fe4cc73d094aebc6aee4b062cf549343346 | refs/heads/main | 2023-04-07T15:25:00.009870 | 2021-04-20T01:14:50 | 2021-04-20T01:14:50 | 318,985,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 687 | java | package lambda_stream;
import java.util.Arrays;
import java.util.List;
public class StreamMapMain {
public static void main(String[] args) {
List<Student> list = Arrays.asList(
new Student(1, "๊น์ข์ง", "๋จ์", "์ปดํจํฐ๊ณตํ๊ณผ", 80 ),
new Student(2, "ํ๋ฒ๋", "๋จ์", "๊ธฐ๊ณ๊ณตํ๊ณผ", 92),
new Student(3, "์ ๊ด์", "์ฌ์", "์ปดํจํฐ๊ณตํ๊ณผ", 87),
new Student(4, "์ค๋ด๊ธธ", "๋จ์", "์ปดํจํฐ๊ณตํ๊ณผ", 85),
new Student(5, "๋จ์ํ", "์ฌ์", "์ ์๊ณตํ๊ณผ", 78)
);
list.stream()
.filter(student->student.getGender().equals("๋จ์"))
.mapToInt(Student::getScore)
.forEach(student -> System.out.println(student));
}
}
| [
"[email protected]"
] | |
159358d31d8bb9cb68b4dd2f642cf98fc2c50cab | c6f7082aa65331afa538ff88104b009753108c60 | /MaPraNodes/src/phenomizer/algorithm/ComparatorPhenoPval.java | bf2dbe6dc250ed3d1728abb08dcc52a041f6b1e8 | [] | no_license | HappyLiPei/mapra | f9857a1e3ac544c489bf498610d7490bf615f752 | 46598604faa4730c0fc7c2b16fdf49290451d5c7 | refs/heads/master | 2020-04-09T10:42:07.579763 | 2016-08-16T01:40:28 | 2016-08-16T01:40:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,068 | java | package phenomizer.algorithm;
public class ComparatorPhenoPval extends ComparatorPheno {
@Override
/**
* Method to compare the results of PhenomizerAlgorithmWithPval for two diseases
* @param arg0: array with id (pos 0), score (pos 1) and pvalue (pos 2) of a disease
* @param arg1: array with id (pos 0), score (pos 1) and pvalue (pos 2) of a second disease
* @return: returns a positive value if arg0 has a higher rank than arg1
* returns a negative value if arg0 has a lower rank than arg1
* returns 0 if the arrays are identical (should never happen in PhenomizerAlgorithmWithPval)
*/
public int compare(String[] arg0, String[] arg1) {
//compare pvalues -> ascending order
int comparison_pval = Double.compare(Double.valueOf(arg0[2]), Double.valueOf(arg1[2]));
if(comparison_pval!=0){
return comparison_pval;
}
//equal pvalues
else{
//compare scores
int comparison_score = Double.compare(Double.valueOf(arg0[1]), Double.valueOf(arg1[1]));
if(comparison_score!=0){
return -comparison_score;
}
//equal pvalues +equal scores
else{
return Integer.compare(Integer.valueOf(arg0[0]), Integer.valueOf(arg1[0]));
}
}
}
@Override
/**
* Method to compare the results of PhenomizerAlgorithmWithPval for two diseases
* @param arg0: array with id (pos 0), score (pos 1) and p value (pos 2) of a disease
* @param arg1: array with id (pos 0), score (pos 1) and p value (pos 2) of a second disease
* @return: returns a positive value if arg0 has a higher rank than arg1
* returns a negative value if arg0 has a lower rank than arg1
* returns 0 ar0 and arg1 have the same rank
*/
public int compareWithoutID(String[] arg0, String[] arg1) {
//compare pvalues -> ascending order
int comparison_pval = Double.compare(Double.valueOf(arg0[2]), Double.valueOf(arg1[2]));
if(comparison_pval!=0){
return comparison_pval;
}
//equal pvalues -> compare scores in descending order
else{
return -Double.compare(Double.valueOf(arg0[1]), Double.valueOf(arg1[1]));
}
}
}
| [
"[email protected]"
] | |
962890f763ade462aa86462eab8ebba869d2a0d3 | 7775d63f96b67c0f7ea77160e2a1a8e44957ff86 | /src/com/javarush/test/level28/lesson15/big01/model/HHStrategy.java | 40d900e12f1052fef46062e5194468c977148238 | [] | no_license | saudabaew/com.javarush.test | 58390fdfa44bd09ce3226de674b62224e8d87b1e | d689012c6bbf105015bde0c205a8dafcbcf809eb | refs/heads/master | 2021-05-16T07:00:40.896234 | 2018-02-14T02:18:10 | 2018-02-14T02:18:10 | 103,628,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,529 | java | package com.javarush.test.level28.lesson15.big01.model;
import com.javarush.test.level28.lesson15.big01.vo.Vacancy;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* Created by 1 on 30.08.2017.
*/
public class HHStrategy implements Strategy
{
private static final String URL_FORMAT = "http://hh.ua/search/vacancy?text=java+%s&page=%d";
private static final int timeout = 5 * 1000;
private static final String userAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36";
private static final String referrer = "http://hh.ua/search/vacancy?text=java+%D0%BA%D0%B8%D0%B5%D0%B2";
@Override
public List<Vacancy> getVacancies(String searchString) throws IOException
{
ArrayList<Vacancy> list = new ArrayList<>();
Document document;
for (int i = 0; true; i++)
{
document = getDocument(searchString, i);
if (document == null) break;
Elements vac = document.getElementsByAttributeValue("data-qa", "vacancy-serp__vacancy");
if (vac.size() == 0) break;
for (Element v : vac
)
{
Vacancy vacancy = new Vacancy();
vacancy.setTitle(v.getElementsByAttributeValue("data-qa", "vacancy-serp__vacancy-title").text());
vacancy.setCity(v.getElementsByAttributeValue("data-qa", "vacancy-serp__vacancy-address").text());
vacancy.setCompanyName(v.getElementsByAttributeValue("data-qa", "vacancy-serp__vacancy-employer").text());
vacancy.setSiteName(document.title());
vacancy.setUrl(v.getElementsByAttributeValue("data-qa", "vacancy-serp__vacancy-title").attr("href"));
String salary = v.select("[data-qa=\"vacancy-serp__vacancy-compensation\"]").text();
vacancy.setSalary(salary != null ? salary : "");
list.add(vacancy);
}
}
return list;
}
protected Document getDocument(String searchString, int page) throws IOException
{
Document document = Jsoup.connect(String.format(URL_FORMAT, searchString, page))
.userAgent(userAgent)
.referrer(referrer)
.timeout(timeout)
.get();
return document;
}
}
| [
"[email protected]"
] | |
f2ce02887665ce2582ea7b5a7f22aa367ad0fd64 | b998b375e53c0d8141db7f8e07cb01b494ed3d0a | /boot.oat_files/arm64/dex/out1/android/util/secutil/LogSwitcher.java | 1a91a4f8b08a3d296c063d86630151f6bf0c3d27 | [] | no_license | atthisaccount/SPay-inner-workings | c3b6256c8ed10c2492d19eca8e63f656cd855be2 | 6dd83a6ea0916c272423ea0dc1fa3757baa632e7 | refs/heads/master | 2022-03-22T04:12:05.100198 | 2019-10-06T13:25:49 | 2019-10-06T13:25:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,242 | java | package android.util.secutil;
import android.os.SystemProperties;
import com.samsung.android.smartface.SmartFaceManager;
public final class LogSwitcher {
public static boolean isShowingGlobalLog;
public static boolean isShowingSecDLog;
public static boolean isShowingSecELog;
public static boolean isShowingSecILog;
public static boolean isShowingSecVLog;
public static boolean isShowingSecWLog;
public static boolean isShowingSecWtfLog;
static {
isShowingGlobalLog = false;
isShowingSecVLog = false;
isShowingSecDLog = false;
isShowingSecILog = false;
isShowingSecWLog = false;
isShowingSecELog = false;
isShowingSecWtfLog = false;
try {
isShowingGlobalLog = SmartFaceManager.PAGE_BOTTOM.equals(SystemProperties.get("persist.log.seclevel", SmartFaceManager.PAGE_MIDDLE));
isShowingSecVLog = isShowingGlobalLog;
isShowingSecDLog = isShowingGlobalLog;
isShowingSecILog = isShowingGlobalLog;
isShowingSecWLog = isShowingGlobalLog;
isShowingSecELog = isShowingGlobalLog;
isShowingSecWtfLog = isShowingGlobalLog;
} catch (Exception e) {
}
}
}
| [
"[email protected]"
] | |
435b908c7ae533ce4f3239ad9edeb49f88bc8967 | 30cc3a37a8c4effa0d19d325b2b04f39b0479b8a | /gateway/src/main/java/com/mescourses/web/rest/util/PaginationUtil.java | 6139a71516c07023f546bee06704524c127713c2 | [] | no_license | RICM-eCOM/base_jhipster_project | a43f783ed5abc811e9256648ca96d7260b603b70 | a0d625b3dc53ac9f39ceccb41516b40f0b6cdb26 | refs/heads/master | 2021-08-30T21:29:47.638704 | 2017-12-19T13:35:52 | 2017-12-19T13:35:52 | 107,015,253 | 0 | 3 | null | 2017-10-31T13:56:11 | 2017-10-15T13:36:54 | Java | UTF-8 | Java | false | false | 1,737 | java | package com.mescourses.web.rest.util;
import org.springframework.data.domain.Page;
import org.springframework.http.HttpHeaders;
import org.springframework.web.util.UriComponentsBuilder;
/**
* Utility class for handling pagination.
*
* <p>
* Pagination uses the same principles as the <a href="https://developer.github.com/v3/#pagination">GitHub API</a>,
* and follow <a href="http://tools.ietf.org/html/rfc5988">RFC 5988 (Link header)</a>.
*/
public final class PaginationUtil {
private PaginationUtil() {
}
public static HttpHeaders generatePaginationHttpHeaders(Page page, String baseUrl) {
HttpHeaders headers = new HttpHeaders();
headers.add("X-Total-Count", Long.toString(page.getTotalElements()));
String link = "";
if ((page.getNumber() + 1) < page.getTotalPages()) {
link = "<" + generateUri(baseUrl, page.getNumber() + 1, page.getSize()) + ">; rel=\"next\",";
}
// prev link
if ((page.getNumber()) > 0) {
link += "<" + generateUri(baseUrl, page.getNumber() - 1, page.getSize()) + ">; rel=\"prev\",";
}
// last and first link
int lastPage = 0;
if (page.getTotalPages() > 0) {
lastPage = page.getTotalPages() - 1;
}
link += "<" + generateUri(baseUrl, lastPage, page.getSize()) + ">; rel=\"last\",";
link += "<" + generateUri(baseUrl, 0, page.getSize()) + ">; rel=\"first\"";
headers.add(HttpHeaders.LINK, link);
return headers;
}
private static String generateUri(String baseUrl, int page, int size) {
return UriComponentsBuilder.fromUriString(baseUrl).queryParam("page", page).queryParam("size", size).toUriString();
}
}
| [
"[email protected]"
] | |
005ce2bdbfd1554eb4b3369d4126c05c8641361a | 127a2f42b30552c4b7e4daa09b157f4ba775ff04 | /src/main/java/com/poovarasan/base/XMPPAuth.java | 34edc8d75c44c638d76a5b0455689d182658b462 | [] | no_license | poovarasanvasudevan/moiledashboard | 0b8e766851bbc748d91e5c09c3bc49eb0aeabaf3 | 01fbf931bebbbcea599b549640d56905124ef4ec | refs/heads/master | 2021-01-20T03:34:18.080909 | 2017-05-18T09:35:08 | 2017-05-18T09:35:08 | 89,554,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,168 | java | package com.poovarasan.base;
import com.poovarasan.models.User;
import com.poovarasan.repository.UserRepository;
import org.apache.vysper.xmpp.addressing.Entity;
import org.apache.vysper.xmpp.authorization.UserAuthorization;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import java.util.Optional;
/**
* Created by poovarasanv on 10/5/17.
* Project : mobiledashboard
*/
public class XMPPAuth implements UserAuthorization {
private final UserRepository userRepository;
private final BCryptPasswordEncoder bCryptPasswordEncoder;
public XMPPAuth(UserRepository userRepository, BCryptPasswordEncoder bCryptPasswordEncoder) {
this.userRepository = userRepository;
this.bCryptPasswordEncoder = bCryptPasswordEncoder;
}
@Override
public boolean verifyCredentials(Entity entity, String s, Object o) {
return false;
}
@Override
public boolean verifyCredentials(String s, String s1, Object o) {
Optional<User> user = userRepository.findByUsername(s.replace("@localhost", ""));
return user.map(user1 -> user1.getPasswordConfirm().equals(s1)).orElse(false);
}
}
| [
"[email protected]"
] | |
1bf84c8cd077bf401b7073f89d9296fc2beb432f | cf99e4708b3d93cbb0c4dc42031f761b5d1e2e71 | /eureka_client/src/test/java/com/dagemen/client/parten/state/GumballMachine.java | a0c1d9c0a92648d541d34c39bff669d6abc27504 | [] | no_license | chiyanking/spring-cloud-application | d9770ffe1abb9245ecc5254e139029d769c83c4a | 4def31814384ca304cc089a04dcc2108090fb9fd | refs/heads/master | 2020-03-20T08:39:51.972567 | 2018-08-29T03:20:55 | 2018-08-29T03:20:55 | 137,315,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,697 | java | package com.dagemen.client.parten.state;
public class GumballMachine {
private static final int SALD_OUT = 0;//ๅฎๅฎ
private static final int NO_QUARTER = 1;//ๆฒกๆ็กฌๅธ
private static final int HAS_QUARTER = 2;//ๆ็กฌๅธ
private static final int SOLD = 3;//ๅฎๅบ
int state = SALD_OUT;//ๅๅงๆฐ้
int count = 0;//็ณๆๆฐ้
public GumballMachine(int count) {
this.count = count;
}
public void insertQuarter() {
if (state == HAS_QUARTER) {
System.out.println("you can't insert another quarter");
} else if (state == NO_QUARTER) {
state = HAS_QUARTER;
System.out.println("you inserted a quarter");
} else if (state == SALD_OUT) {
System.out.println("you cant't insert a quarter , the machine sald out! ");
} else if (state == SOLD) {
System.out.println("please wait ,we're already giving you a gumball");
}
}
public void ejectQuarter() {
if (state == HAS_QUARTER) {
System.out.println("quarter returned");
state = NO_QUARTER;
} else if (state == NO_QUARTER) {
System.out.println("you haven't inserted a quarter");
} else if (state == SALD_OUT) {
System.out.println("you can't eject , you haven't inserted a quarter yet ");
} else if (state == SOLD) {
System.out.println("sorry, you already turned the crank ");
}
}
public void turnCrank() {
if (state == HAS_QUARTER) {
System.out.println("you turned ....");
state = SOLD;
dispense();
} else if (state == NO_QUARTER) {
System.out.println("you truned but there's no quarter,please ");
} else if (state == SALD_OUT) {
System.out.println("you can't eject , you haven't inserted a quarter yet ");
} else if (state == SOLD) {
System.out.println("sorry, you already turned the crank ");
}
}
public void dispense() {
if (state == SOLD) {
System.out.println("A gumball comee rolling out the slot ");
count--;
if (count == 0) {
System.out.println("Oops ,out of gumball");
state = SALD_OUT;
} else {
state = NO_QUARTER;
}
} else if (state == HAS_QUARTER) {
System.out.println(" No gumball dispensed ");
} else if (state == NO_QUARTER) {
System.out.println(" you need to pay fisrt ");
} else if (state == SALD_OUT) {
System.out.println(" No gumball dispensed ");
}
}
}
| [
"[email protected]"
] | |
f2784cc7daf607c3515a81e9ca13cde1a2776b51 | 5acfba487d1a5de1a5dedcffb69c9882669bf934 | /src/test/java/com/mirolyubov/CalculatorTest.java | 590147aeb8b75630cbe45846137c502cfa1f31e8 | [] | no_license | SlavaMirolyubov/JUnit_part2 | f9fdd3d8d8a3163fb2144b8548366a411dde5a9d | b8b97b26ac51aa5e375b2b81f843b734eca87961 | refs/heads/master | 2020-05-17T00:23:57.134898 | 2019-04-25T15:10:28 | 2019-04-25T15:10:28 | 183,394,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,048 | java | package com.mirolyubov;
import com.mirolyubov.MyExceptions.BracketsException;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
@Tag("Other")
class CalculatorTest {
private Calculator calculator;
@BeforeEach
void setUp() {
calculator = new Calculator();
}
@AfterEach
void tearDown() {
calculator = null;
}
@Test
void calculate() {
assertEquals("4", calculator.calculate("2+2"));
}
@Test
void calculateBadExpression() {
assertEquals("", calculator.calculate("2+2+ABC"));
}
@Test
void calculateBadOpenBrackets() {
assertThrows(BracketsException.class, () -> {
calculator.calculate("2+(2+8");
});
}
@Test
void calculateBadCloseBrackets() {
assertThrows(BracketsException.class, () -> {
calculator.calculate("2+2)+8");
});
}
} | [
"[email protected]"
] | |
0de87a9412ee068401c3055c7093efc0ed86f5bc | 829651c606408723eadba3909bb17a3bc17f90b4 | /mycontactform.java | 42ad47ee2cfef6357a3aa4043417f3fba9bf765f | [] | no_license | gaurav-km/java-app | e85d46e3334a406f3741080c0584025952a1efc5 | 22a772a1b64870be1bbd868ae866995374d2de81 | refs/heads/master | 2020-03-31T06:15:25.004383 | 2018-10-07T18:55:07 | 2018-10-07T18:55:07 | 151,974,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 51,950 | java |
import java.awt.Color;
import java.awt.Font;
import java.awt.Image;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
/*
* 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.
*/
/**
*
* @author shadab
*/
public class mycontactform extends javax.swing.JFrame {
/**
* Creates new form mycontactform
*/
String imgpath=null;
int pos=0;
public static int currentUserId;
public mycontactform() {
initComponents();
this.setLocationRelativeTo(null);
populatedJtable();
jTable1_info.setShowGrid(true);
JTableHeader th= jTable1_info.getTableHeader();
th.setForeground(Color.blue);
th.setFont(new Font ("Tahoma",Font.PLAIN,14));
System.out.println(currentUserId+ "from contact");
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1_gray = new javax.swing.JPanel();
mycontact_panel = new javax.swing.JPanel();
jLabel1_mycontact = new javax.swing.JLabel();
jLabel1_yello = new javax.swing.JLabel();
jLabel1_usename = new javax.swing.JLabel();
jLabel1_minipic = new javax.swing.JLabel();
jLabel1_close = new javax.swing.JLabel();
jLabel1_mini = new javax.swing.JLabel();
jLabel1_fname = new javax.swing.JLabel();
jSeparator1_fname = new javax.swing.JSeparator();
jLabel1_lname = new javax.swing.JLabel();
jSeparator1_fname1 = new javax.swing.JSeparator();
jLabel1_phone = new javax.swing.JLabel();
jSeparator1_phone = new javax.swing.JSeparator();
jLabel1_email = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jSeparator2 = new javax.swing.JSeparator();
jTextField1_fname = new javax.swing.JTextField();
jTextField1_lname = new javax.swing.JTextField();
jTextField1_phone = new javax.swing.JTextField();
jTextField1_email = new javax.swing.JTextField();
jLabel1_image = new javax.swing.JLabel();
jLabel1_picframe = new javax.swing.JLabel();
jLabel1_address = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1_adress = new javax.swing.JTextArea();
jLabel1_ID = new javax.swing.JLabel();
jComboBox1_email = new javax.swing.JComboBox();
jButton1_picsel = new javax.swing.JButton();
jButton1_edit = new javax.swing.JButton();
jScrollPane2 = new javax.swing.JScrollPane();
jTable1_info = new javax.swing.JTable();
jButton1_add1 = new javax.swing.JButton();
jLabel1_combo1 = new javax.swing.JLabel();
jTextField1_id = new javax.swing.JTextField();
jButton1_del = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jButton1next = new javax.swing.JButton();
jButton1_rt = new javax.swing.JButton();
jButton1_lf = new javax.swing.JButton();
jButton1_lfnext = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
jPanel1_gray.setBackground(new java.awt.Color(25, 181, 254));
jPanel1_gray.setForeground(new java.awt.Color(255, 255, 255));
jPanel1_gray.setToolTipText("");
mycontact_panel.setBackground(new java.awt.Color(34, 167, 240));
mycontact_panel.setForeground(new java.awt.Color(102, 102, 102));
jLabel1_mycontact.setBackground(new java.awt.Color(34, 167, 240));
jLabel1_mycontact.setFont(new java.awt.Font("Segoe UI Light", 1, 18)); // NOI18N
jLabel1_mycontact.setForeground(new java.awt.Color(255, 255, 255));
jLabel1_mycontact.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/icons8_Address_Book_32px.png"))); // NOI18N
jLabel1_mycontact.setText("MyContacts");
jLabel1_yello.setBackground(new java.awt.Color(240, 255, 0));
jLabel1_yello.setText(" ");
jLabel1_usename.setBackground(new java.awt.Color(34, 167, 240));
jLabel1_usename.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
jLabel1_usename.setForeground(new java.awt.Color(255, 255, 255));
jLabel1_usename.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/icons8_Customer_32px.png"))); // NOI18N
jLabel1_usename.setText("UserName");
jLabel1_minipic.setBackground(new java.awt.Color(255, 255, 0));
jLabel1_minipic.setText(" ");
jLabel1_minipic.setOpaque(true);
javax.swing.GroupLayout mycontact_panelLayout = new javax.swing.GroupLayout(mycontact_panel);
mycontact_panel.setLayout(mycontact_panelLayout);
mycontact_panelLayout.setHorizontalGroup(
mycontact_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mycontact_panelLayout.createSequentialGroup()
.addGroup(mycontact_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1_yello, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(mycontact_panelLayout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jLabel1_usename, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(6, 6, 6)
.addComponent(jLabel1_minipic, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(231, 231, 231)
.addComponent(jLabel1_mycontact, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
mycontact_panelLayout.setVerticalGroup(
mycontact_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mycontact_panelLayout.createSequentialGroup()
.addComponent(jLabel1_yello)
.addGap(1, 1, 1)
.addComponent(jLabel1_usename, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel1_minipic, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(mycontact_panelLayout.createSequentialGroup()
.addGap(11, 11, 11)
.addComponent(jLabel1_mycontact))
);
jLabel1_close.setForeground(new java.awt.Color(207, 0, 15));
jLabel1_close.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/icons8_Shutdown_24px_2.png"))); // NOI18N
jLabel1_close.setText(" ");
jLabel1_close.setToolTipText("");
jLabel1_close.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jLabel1_close.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel1_closeMouseClicked(evt);
}
});
jLabel1_mini.setBackground(new java.awt.Color(0, 102, 102));
jLabel1_mini.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/icons8_Minus_24px.png"))); // NOI18N
jLabel1_mini.setText(" ");
jLabel1_mini.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jLabel1_mini.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel1_miniMouseClicked(evt);
}
});
jLabel1_fname.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
jLabel1_fname.setForeground(new java.awt.Color(255, 255, 255));
jLabel1_fname.setText("FirstName");
jSeparator1_fname.setForeground(new java.awt.Color(51, 255, 0));
jSeparator1_fname.setOpaque(true);
jLabel1_lname.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
jLabel1_lname.setForeground(new java.awt.Color(255, 255, 255));
jLabel1_lname.setText("LastName");
jSeparator1_fname1.setForeground(new java.awt.Color(0, 0, 0));
jSeparator1_fname1.setOpaque(true);
jLabel1_phone.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
jLabel1_phone.setForeground(new java.awt.Color(255, 255, 255));
jLabel1_phone.setText("Phone");
jSeparator1_phone.setBackground(new java.awt.Color(0, 255, 0));
jSeparator1_phone.setOpaque(true);
jLabel1_email.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
jLabel1_email.setForeground(new java.awt.Color(255, 255, 255));
jLabel1_email.setText("Email");
jSeparator1.setBackground(new java.awt.Color(0, 204, 0));
jSeparator1.setOpaque(true);
jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);
jSeparator2.setOpaque(true);
jTextField1_fname.setBackground(new java.awt.Color(25, 181, 254));
jTextField1_fname.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
jTextField1_fname.setText(" ");
jTextField1_fname.setBorder(null);
jTextField1_fname.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1_fnameActionPerformed(evt);
}
});
jTextField1_lname.setBackground(new java.awt.Color(25, 181, 254));
jTextField1_lname.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
jTextField1_lname.setText(" ");
jTextField1_lname.setBorder(null);
jTextField1_phone.setBackground(new java.awt.Color(25, 181, 254));
jTextField1_phone.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField1_phone.setText(" ");
jTextField1_phone.setBorder(null);
jTextField1_phone.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1_phoneActionPerformed(evt);
}
});
jTextField1_email.setBackground(new java.awt.Color(25, 181, 254));
jTextField1_email.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
jTextField1_email.setText(" ");
jTextField1_email.setBorder(null);
jLabel1_image.setBackground(new java.awt.Color(238, 238, 238));
jLabel1_image.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
jLabel1_image.setForeground(new java.awt.Color(255, 255, 255));
jLabel1_image.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/icons8_Full_Image_32px.png"))); // NOI18N
jLabel1_image.setText("ProfilePic:");
jLabel1_picframe.setBackground(new java.awt.Color(204, 204, 204));
jLabel1_picframe.setText(" ");
jLabel1_picframe.setOpaque(true);
jLabel1_address.setBackground(new java.awt.Color(238, 238, 238));
jLabel1_address.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
jLabel1_address.setForeground(new java.awt.Color(255, 255, 255));
jLabel1_address.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1_address.setText("Address:");
jTextArea1_adress.setColumns(20);
jTextArea1_adress.setRows(5);
jScrollPane1.setViewportView(jTextArea1_adress);
jLabel1_ID.setBackground(new java.awt.Color(238, 238, 238));
jLabel1_ID.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
jLabel1_ID.setForeground(new java.awt.Color(255, 255, 255));
jLabel1_ID.setText("ID:");
jComboBox1_email.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
jComboBox1_email.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "family", "work", "friends" }));
jComboBox1_email.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox1_emailActionPerformed(evt);
}
});
jButton1_picsel.setBackground(new java.awt.Color(0, 181, 204));
jButton1_picsel.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
jButton1_picsel.setForeground(new java.awt.Color(255, 255, 255));
jButton1_picsel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/icons8_Full_Image_32px.png"))); // NOI18N
jButton1_picsel.setText("Browse");
jButton1_picsel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton1_picsel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1_picselActionPerformed(evt);
}
});
jButton1_edit.setBackground(new java.awt.Color(32, 185, 115));
jButton1_edit.setFont(new java.awt.Font("Segoe UI Light", 1, 14)); // NOI18N
jButton1_edit.setForeground(new java.awt.Color(255, 255, 255));
jButton1_edit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/icons8_Edit_Property_32px.png"))); // NOI18N
jButton1_edit.setText("Edit");
jButton1_edit.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton1_edit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1_editActionPerformed(evt);
}
});
jTable1_info.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
jTable1_info.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jTable1_info.setRowHeight(12);
jTable1_info.setRowMargin(2);
jTable1_info.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTable1_infoMouseClicked(evt);
}
});
jScrollPane2.setViewportView(jTable1_info);
jButton1_add1.setBackground(new java.awt.Color(0, 255, 51));
jButton1_add1.setFont(new java.awt.Font("Segoe UI Light", 1, 14)); // NOI18N
jButton1_add1.setForeground(new java.awt.Color(255, 255, 255));
jButton1_add1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/icons8_Add_User_Male_32px_3.png"))); // NOI18N
jButton1_add1.setText("add");
jButton1_add1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton1_add1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1_add1ActionPerformed(evt);
}
});
jLabel1_combo1.setBackground(new java.awt.Color(238, 238, 238));
jLabel1_combo1.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
jLabel1_combo1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1_combo1.setText("group");
jTextField1_id.setBackground(new java.awt.Color(25, 181, 254));
jTextField1_id.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
jTextField1_id.setText(" ");
jTextField1_id.setBorder(null);
jTextField1_id.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1_idActionPerformed(evt);
}
});
jButton1_del.setBackground(new java.awt.Color(255, 0, 0));
jButton1_del.setFont(new java.awt.Font("Segoe UI Light", 1, 14)); // NOI18N
jButton1_del.setForeground(new java.awt.Color(255, 255, 255));
jButton1_del.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/icons8_Banned_32px.png"))); // NOI18N
jButton1_del.setText("Delete");
jButton1_del.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton1_del.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1_delActionPerformed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Segoe UI Light", 1, 16)); // NOI18N
jLabel1.setForeground(new java.awt.Color(51, 51, 51));
jLabel1.setText("List of Contacts");
jButton1next.setBackground(new java.awt.Color(44, 130, 201));
jButton1next.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton1next.setForeground(new java.awt.Color(255, 255, 255));
jButton1next.setText("<<");
jButton1next.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1nextActionPerformed(evt);
}
});
jButton1_rt.setBackground(new java.awt.Color(1, 50, 67));
jButton1_rt.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton1_rt.setForeground(new java.awt.Color(255, 255, 255));
jButton1_rt.setText("<");
jButton1_rt.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton1_rt.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1_rtActionPerformed(evt);
}
});
jButton1_lf.setBackground(new java.awt.Color(31, 58, 147));
jButton1_lf.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton1_lf.setForeground(new java.awt.Color(255, 255, 255));
jButton1_lf.setText(">");
jButton1_lf.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton1_lf.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1_lfActionPerformed(evt);
}
});
jButton1_lfnext.setBackground(new java.awt.Color(44, 130, 201));
jButton1_lfnext.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton1_lfnext.setForeground(new java.awt.Color(255, 255, 255));
jButton1_lfnext.setText(" >>");
jButton1_lfnext.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton1_lfnext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1_lfnextActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1_grayLayout = new javax.swing.GroupLayout(jPanel1_gray);
jPanel1_gray.setLayout(jPanel1_grayLayout);
jPanel1_grayLayout.setHorizontalGroup(
jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(mycontact_panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1_grayLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1_mini)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel1_close)
.addContainerGap())
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGap(26, 26, 26)
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1_grayLayout.createSequentialGroup()
.addGap(4, 4, 4)
.addComponent(jSeparator1_phone, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(86, 86, 86))
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1_lname)
.addComponent(jLabel1_phone)
.addComponent(jLabel1_fname))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField1_phone, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField1_lname, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jSeparator1_fname, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField1_fname, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jSeparator1_fname1, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jLabel1_ID, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField1_id, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(81, 81, 81)))
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGap(121, 121, 121)
.addComponent(jLabel1_image, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGap(88, 88, 88)
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(13, 13, 13)
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addComponent(jLabel1_address)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addComponent(jLabel1_picframe, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(47, 47, 47)
.addComponent(jButton1_picsel))))
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jButton1next, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton1_rt, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton1_lf, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton1_lfnext, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addComponent(jLabel1_combo1, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jComboBox1_email, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addComponent(jLabel1_email)
.addGap(30, 30, 30)
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField1_email, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(333, 333, 333)
.addComponent(jButton1_del)
.addGap(35, 35, 35)
.addComponent(jButton1_edit, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
.addComponent(jButton1_add1)
.addGap(23, 23, 23))))
.addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING)
);
jPanel1_grayLayout.setVerticalGroup(
jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGap(7, 7, 7)
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1_mini)
.addComponent(jLabel1_close, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(11, 11, 11)
.addComponent(mycontact_panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6)
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGap(9, 9, 9)
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1_ID, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField1_id, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField1_fname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1_fname))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1_fname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(27, 27, 27)
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addComponent(jLabel1_lname)
.addGap(46, 46, 46)
.addComponent(jLabel1_phone))
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(jTextField1_lname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1_fname1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(38, 38, 38)
.addComponent(jTextField1_phone, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1_phone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(47, 47, 47)
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1_email)
.addComponent(jTextField1_email, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1_grayLayout.createSequentialGroup()
.addGap(13, 13, 13)
.addComponent(jLabel1_image, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(90, 90, 90))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1_grayLayout.createSequentialGroup()
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1_picsel)
.addComponent(jLabel1_picframe, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)))
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1_address))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1_del)
.addComponent(jButton1_edit)
.addComponent(jButton1_add1)
.addComponent(jComboBox1_email, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1_combo1, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1_grayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1next)
.addComponent(jLabel1)
.addComponent(jButton1_rt)
.addComponent(jButton1_lf)
.addComponent(jButton1_lfnext))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1_gray, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1_gray, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
public void populatedJtable()
{
contactQuery cq= new contactQuery();
ArrayList<contact> ctList=cq.contactList(currentUserId);
String[] colNames={" Id","FirstName","LastName","Group","Phone","Email","Adress"," Image"};
Object[][] rows=new Object[ctList.size()][8];
for(int i=0; i<ctList.size();i++)
{
rows[i][0]=ctList.get(i).getCid();
rows[i][1]=ctList.get(i).getFname();
rows[i][2]=ctList.get(i).getLname();
rows[i][3]=ctList.get(i).getGroupc();
rows[i][4]=ctList.get(i).getPhone();
rows [i][5]=ctList.get(i).getEmail();
rows [i][6]=ctList.get(i).getAddress();
if(ctList.get(i).getPic()!=null)
{
rows[i][7]= new ImageIcon(new ImageIcon(ctList.get(i).getPic()).getImage().getScaledInstance(120,80,Image.SCALE_SMOOTH));
// rows[i][7]=pic; //.getScaledInstance(70,100,Image.SCALE_SMOOTH));
}
else
{
rows[i][7]=null;
}
mymodel mmd=new mymodel(rows,colNames);
jTable1_info.setModel(mmd);
jTable1_info.setRowHeight(80);
jTable1_info.getColumnModel().getColumn(7).setPreferredWidth(120);
}
}
private void jLabel1_closeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel1_closeMouseClicked
System.exit(0);
// TODO add your handling code here:
}//GEN-LAST:event_jLabel1_closeMouseClicked
private void jLabel1_miniMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel1_miniMouseClicked
this.setState(JFrame.ICONIFIED);
// TODO add your handling code here:
}//GEN-LAST:event_jLabel1_miniMouseClicked
private void jTextField1_fnameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1_fnameActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField1_fnameActionPerformed
private void jComboBox1_emailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1_emailActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBox1_emailActionPerformed
private void jButton1_picselActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1_picselActionPerformed
myfunc mf=new myfunc();
imgpath= mf.BrowseImage(jLabel1_picframe);
System.out.println(imgpath);
}//GEN-LAST:event_jButton1_picselActionPerformed
public void clearFields()
{
jTextField1_id.setText("");
jTextField1_fname.setText("");
jTextField1_lname.setText("");
jTextField1_phone.setText("");
jTextField1_email.setText("");
jTextArea1_adress.setText("");
jComboBox1_email.setSelectedIndex(0);
jLabel1_picframe.setIcon(null);
imgpath=null;
}
private void showData( int Index)
{
jTextField1_fname.setText(jTable1_info.getValueAt(Index, 1).toString());
jTextField1_lname.setText(jTable1_info.getValueAt(Index, 2).toString());
jComboBox1_email.setSelectedItem(jTable1_info.getValueAt(Index, 3));
jTextField1_phone.setText(jTable1_info.getValueAt(Index, 4).toString());
jTextField1_email.setText(jTable1_info.getValueAt(Index, 5).toString());
jTextArea1_adress.setText(jTable1_info.getValueAt(Index, 6).toString());
jTextField1_id.setText(jTable1_info.getValueAt(Index, 0).toString());
Image pic=((ImageIcon)jTable1_info.getValueAt(Index, 7)).getImage().getScaledInstance(jLabel1_picframe.getWidth(),jLabel1_picframe.getHeight(),Image.SCALE_SMOOTH);
ImageIcon img=new ImageIcon(pic);
jLabel1_picframe.setIcon(img);
}
private void jButton1_editActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1_editActionPerformed
int id=Integer.valueOf( jTextField1_id.getText());
String fname=jTextField1_fname.getText();
String lname=jTextField1_lname.getText();
String phone=jTextField1_phone.getText();
String address= jTextArea1_adress.getText();
String group=jComboBox1_email.getSelectedItem().toString();
String email=jTextField1_email.getText();
//if the user update data and image
if(imgpath !=null)
{
byte[]img=null;
try {
Path pth=Paths.get(imgpath);
img=Files.readAllBytes(pth);
contact c=new contact(id, fname, lname, group ,phone,email,address,img, currentUserId);
contactQuery cq=new contactQuery();
cq.UpdateContact(c, true);
refreshJtable();
clearFields();
} catch (FileNotFoundException ex) {
Logger.getLogger(mycontactform.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(mycontactform.class.getName()).log(Level.SEVERE, null, ex);
}
}
else{
contact c=new contact(id, fname, lname, group ,phone,email,address,null, currentUserId);
contactQuery cq=new contactQuery();
cq.UpdateContact(c,false);
refreshJtable();
clearFields();
}
}//GEN-LAST:event_jButton1_editActionPerformed
public void refreshJtable(){
jTable1_info.setModel(new DefaultTableModel());
populatedJtable();
}
private void jTable1_infoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1_infoMouseClicked
//get selected row data
int rowIndex=jTable1_info.getSelectedRow();
jTextField1_fname.setText(jTable1_info.getValueAt(rowIndex, 1).toString());
jTextField1_lname.setText(jTable1_info.getValueAt(rowIndex, 2).toString());
jComboBox1_email.setSelectedItem(jTable1_info.getValueAt(rowIndex, 3));
jTextField1_phone.setText(jTable1_info.getValueAt(rowIndex, 4).toString());
jTextField1_email.setText(jTable1_info.getValueAt(rowIndex, 5).toString());
jTextArea1_adress.setText(jTable1_info.getValueAt(rowIndex, 6).toString());
jTextField1_id.setText(jTable1_info.getValueAt(rowIndex, 0).toString());
Image pic=((ImageIcon)jTable1_info.getValueAt(rowIndex, 7)).getImage().getScaledInstance(jLabel1_picframe.getWidth(),jLabel1_picframe.getHeight(),Image.SCALE_SMOOTH);
ImageIcon img=new ImageIcon(pic);
jLabel1_picframe.setIcon(img);
// TODO add your handling code here:
}//GEN-LAST:event_jTable1_infoMouseClicked
private void jButton1_add1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1_add1ActionPerformed
//int id=Integer.valueOf( jTextField1_id.getText());
String fname=jTextField1_fname.getText();
String lname=jTextField1_lname.getText();
String phone=jTextField1_phone.getText();
String address= jTextArea1_adress.getText();
String group=jComboBox1_email.getSelectedItem().toString();
String email=jTextField1_email.getText();
byte[] img=null;
if(imgpath!=null)
{
try {
Path pth=Paths.get(imgpath);
img=Files.readAllBytes(pth);
contact c=new contact(null,fname,lname,group,phone,email,address,img,currentUserId);
contactQuery cq= new contactQuery();
cq.InsertContact(c);
refreshJtable();
clearFields();
}
// TODO add your handling code here:
catch (FileNotFoundException ex) {
Logger.getLogger(mycontactform.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(mycontactform.class.getName()).log(Level.SEVERE, null, ex);
}}
else
{
JOptionPane.showMessageDialog(null,"Please select Image");
}
}//GEN-LAST:event_jButton1_add1ActionPerformed
private void jButton1_delActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1_delActionPerformed
int id=Integer.valueOf( jTextField1_id.getText());
contactQuery cq=new contactQuery();
cq.DeleteContact(id);
refreshJtable();
clearFields();
}//GEN-LAST:event_jButton1_delActionPerformed
private void jTextField1_phoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1_phoneActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField1_phoneActionPerformed
private void jTextField1_idActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1_idActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField1_idActionPerformed
private void jButton1nextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1nextActionPerformed
pos=0;
showData(pos);
}//GEN-LAST:event_jButton1nextActionPerformed
private void jButton1_rtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1_rtActionPerformed
pos--;
showData(pos);
}//GEN-LAST:event_jButton1_rtActionPerformed
private void jButton1_lfnextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1_lfnextActionPerformed
pos=jTable1_info.getRowCount()-1;
showData(pos);
}//GEN-LAST:event_jButton1_lfnextActionPerformed
private void jButton1_lfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1_lfActionPerformed
pos++;
showData(pos);
// TODO add your handling code here:
}//GEN-LAST:event_jButton1_lfActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(mycontactform.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(mycontactform.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(mycontactform.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(mycontactform.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new mycontactform().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1_add1;
private javax.swing.JButton jButton1_del;
private javax.swing.JButton jButton1_edit;
private javax.swing.JButton jButton1_lf;
private javax.swing.JButton jButton1_lfnext;
private javax.swing.JButton jButton1_picsel;
private javax.swing.JButton jButton1_rt;
private javax.swing.JButton jButton1next;
private javax.swing.JComboBox<String> jComboBox1_email;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel1_ID;
private javax.swing.JLabel jLabel1_address;
private javax.swing.JLabel jLabel1_close;
private javax.swing.JLabel jLabel1_combo1;
private javax.swing.JLabel jLabel1_email;
private javax.swing.JLabel jLabel1_fname;
private javax.swing.JLabel jLabel1_image;
private javax.swing.JLabel jLabel1_lname;
private javax.swing.JLabel jLabel1_mini;
public javax.swing.JLabel jLabel1_minipic;
private javax.swing.JLabel jLabel1_mycontact;
private javax.swing.JLabel jLabel1_phone;
private javax.swing.JLabel jLabel1_picframe;
public javax.swing.JLabel jLabel1_usename;
private javax.swing.JLabel jLabel1_yello;
private javax.swing.JPanel jPanel1_gray;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator1_fname;
private javax.swing.JSeparator jSeparator1_fname1;
private javax.swing.JSeparator jSeparator1_phone;
private javax.swing.JSeparator jSeparator2;
public javax.swing.JTable jTable1_info;
private javax.swing.JTextArea jTextArea1_adress;
private javax.swing.JTextField jTextField1_email;
private javax.swing.JTextField jTextField1_fname;
private javax.swing.JTextField jTextField1_id;
private javax.swing.JTextField jTextField1_lname;
private javax.swing.JTextField jTextField1_phone;
private javax.swing.JPanel mycontact_panel;
// End of variables declaration//GEN-END:variables
private Object setIcon(ImageIcon pic) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| [
"[email protected]"
] | |
3981d594354018de6ec006b97664811b6dceb264 | 5207e7dc3cf864ec713ec23cee9ccd46617b9892 | /src/test/java/tests/webTemplateTests/MenuTests.java | 99c8dff392d9332643662ef79e61bf1ec1c02227 | [] | no_license | IT-Labs/TADemoTemplate | 61027cd3df1f9ff626670b0d0a6972c2cef1a459 | 0e5d936e4a0a486de8a11bcd79cdfb107b6a071d | refs/heads/master | 2023-05-30T23:18:31.649911 | 2021-06-25T14:33:12 | 2021-06-25T14:33:12 | 374,677,470 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | package tests.webTemplateTests;
import base.TestBase;
import org.openqa.selenium.By;
import org.testng.Assert;
import org.testng.annotations.Test;
public class MenuTests extends TestBase {
@Test
public static void verifyMenuItems(){
Assert.assertTrue(driver.findElement(By.linkText("HOME")).isDisplayed());
Assert.assertTrue(driver.findElement(By.linkText("ABOUT")).isDisplayed());
}
}
| [
"[email protected]"
] | |
746a399b4628dcf8b617660b599ade13cc52f5a4 | 219c878734ccd5f6e0e435f4ca3060a62bc85702 | /src/hurjmc/gui/maze/MazePanel.java | 773d074a99d65805d04ea926d94fc6764a26be88 | [] | no_license | hurjmc/JMCUtilities | ab5a37badf08aa2b25b72c9f0789e0ad8515009c | 318738e45b1f5cfbeb344c300bc7d9555067a3c8 | refs/heads/master | 2016-09-01T16:55:11.575914 | 2014-07-12T14:52:14 | 2014-07-12T14:52:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,377 | java | /*
* (C) COPYRIGHT IBM CORP. 2014 ALL RIGHTS RESERVED
*
* Provided for use as educational material.
*
* Redistribution for other purposes is not permitted.
*
*/
package hurjmc.gui.maze;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
public class MazePanel extends JPanel {
/**
*
*/
private static final long serialVersionUID = 1L;
List <int[]> squares;
int[] player;
Dimension preferred;
public MazePanel() {
this.squares = new ArrayList<int[]>();
}
public void paintComponent(Graphics g) {
g.setColor(Color.white);
g.fillRect(0, 0, preferred.width, preferred.height);
g.setColor(Color.black);
for (int[] square : squares) {
g.fillRect(square[0], square[1], square[2], square[2]);
}
if (player != null){
g.setColor(Color.green);
g.fillOval(player[0], player[1], player[2], player[2]);
}
}
public void setSquare(int x, int y, int size) {
squares.add(new int[] { x, y, size });
this.repaint();
}
public void setPreferred(Dimension preferred) {
this.preferred = preferred;
}
@Override
public Dimension getPreferredSize() {
return this.preferred;
}
public void setPlayer(int x, int y, int size) {
player = new int[] {x, y, size, size};
this.repaint();
}
}
| [
"[email protected]"
] | |
671524d27eff7a8d840d70742f0dc280288cdcf8 | 34b210bda83083f19bfa658b8488a18107ea21af | /src/Test2.java | 08ceb47a9acc1b7ed2427261f1ce1bdf2bfdc4ed | [] | no_license | btran33/AttendanceGUI | 6f4dd4507f813477f72d999f740ba413fcfe6f2d | e4e85b8cfb546f2007e095b3ca069d4db719e702 | refs/heads/main | 2023-04-25T11:07:37.617514 | 2021-05-04T19:04:55 | 2021-05-04T19:04:55 | 364,358,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,750 | 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.
*/
/**
*
* @author joeyt
*/
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;
import java.util.ArrayList;
import java.util.Random;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.File;
import java.time.LocalDateTime;
import java.util.regex.Pattern;
public class Test2 {
public static void main(String[] args) {
String fLocation = "C:\\\\Users\\\\joeyt\\\\Documents\\\\NetBeansProjects\\\\Attendance\\\\src\\\\TestWrite2.csv";
ArrayList<Student> stuList = new ArrayList<Student>();
ArrayList<LocalDateTime> dates = new ArrayList<LocalDateTime>();
dates.add(LocalDateTime.now());
stuList.add(new Student("k000000", "fname","lname",1,dates));
fileWriterTest(fLocation,stuList);
}
public static boolean fileWriterTest(String fLocation, ArrayList<Student> stuList){
//String fileName = "TestWrite.csv";
//String fLocation = "C:/Users/joeyt/Documents/NetBeansProjects/Attendance/src/TestWrite.csv";
boolean validWrite = true;
String string = String.format("\\\\");
String[] parts = fLocation.split(string);
fLocation = parts[0];
for(int i=1;i<parts.length-1;i++)
{
fLocation = fLocation + "/" + parts[i];
}
File old = new File(fLocation);
old.delete();
String fNewLocation = fLocation + "/New.csv";
File fNew = new File(fNewLocation);
System.out.print(stuList.size());
while(stuList.size()!=0){
try{
int i = 0;
FileWriter writer = new FileWriter(fNew, true);
BufferedWriter bw = new BufferedWriter(writer);
String str = stuList.get(i).getkNum() + "," + stuList.get(i).getFirstName() + "," + stuList.get(i).getLastName() + "," + stuList.get(i).getTotalAbs();
for(int j=0; j<stuList.get(i).getTotalAbs();j++)
{
str = str + "," + stuList.get(i).getDateOfAbs().get(j).toString();
}
stuList.remove(i);
bw.write(str);
bw.write("\n");
bw.close();
System.out.print("Write done");
}catch(IOException exptn){
exptn.printStackTrace();
validWrite = false;
}
}
return validWrite;
}
}
| [
"[email protected]"
] | |
31910887768a8f3cf0b3259de94506602d126e30 | 215546a62ef6ed62ccf864d8c19de9f71ec9a090 | /week_7_Factory/src/me/tudoriem/cts/simpleFactory/TestFactory.java | 7c439ce5284668a1800dc7e4e6b9b12991bc5721 | [] | no_license | tudorie-mariuscosmin/cts_labs | 4a02718ede5c24b52c4458d0296cced7e1232237 | 9e9b5d2e775cf0f13e7332ea431bd73f6d06f3db | refs/heads/main | 2023-05-07T21:21:11.380903 | 2021-05-25T12:30:31 | 2021-05-25T12:30:31 | 341,556,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 574 | java | package me.tudoriem.cts.simpleFactory;
public class TestFactory {
public static void main(String[] args) {
SuperHero superMan = new SuperHero("SuperMan", new Pistol("Pistol", 100));
superMan.setWeapon(new MachineGun(500, 1000));
superMan.setWeapon(new Bazooka());
SuperHero batman = new SuperHero("Batman", WeaponsFactory.getWeapon(WeaponType.PISTOL, "Pistol"));
batman.setWeapon(WeaponsFactory.getWeapon(WeaponType.MACHINE_GUN, "MG"));
batman.setWeapon(WeaponsFactory.getWeapon(WeaponType.BAZOOKA, "Boom"));
}
}
| [
"[email protected]"
] | |
5e50ef8c6fec7901f999644d05c3f68fee3b99e9 | 04109e93fd3c29de7d8b721aeee1a50f24ab6a3f | /src/main/java/myfirstMethod.java | 61cf9fcc448e818d17e9d9c8c576d95b21feab91 | [] | no_license | dipal-v/useJenkins | acbe50fec547eef3531eafb2ef93cfb272ad5e18 | 85a25858203378b7d85315a73b40e162ae3c40d7 | refs/heads/master | 2020-12-02T06:43:10.686653 | 2017-07-11T14:46:54 | 2017-07-11T14:46:54 | 96,885,943 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,017 | java | import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.response.Response;
import com.jayway.restassured.response.ValidatableResponse;
import javafx.beans.binding.When;
import jdk.nashorn.internal.ir.RuntimeNode;
import org.junit.Test;
import org.junit.runner.Request;
import static com.jayway.restassured.RestAssured.get;
import static com.jayway.restassured.RestAssured.given;
import static com.jayway.restassured.RestAssured.when;
import static org.codehaus.groovy.tools.shell.util.Logger.io;
/**
* Created by dipal vyas on 02/05/2017.
*/
public class myfirstMethod {
public String endPoint = "http://terminal-customer-v1.relationship-sit.89d9.dev-inmarsat.openshiftapps.com/api/terminal/";
public Response response;
public ValidatableResponse json;
public void getterminalID(String termID)
{
response = when().
get(endPoint + termID).
then().
contentType(ContentType.XML).
extract().
response();
String abc = response.asString();
System.out.print(abc);
}
public void verifyResponsecode(int statCode)
{
json = response.then().statusCode(statCode);
}
// public String terminalId;
//
// public String endPoint = "http://terminal-customer-v1.relationship-sit.89d9.dev-inmarsat.openshiftapps.com/api/terminal/";
//
//
// public void getRequest(String terminalId)
// {
// given().param(terminalId);
// }
//
// public void getResponse()
// {
//
// }
// String abc;
// String xyz = "901112118097036";
// public void firstApi()
// {
//
// abc = when().
// get("http://terminal-customer-v1.relationship-sit.89d9.dev-inmarsat.openshiftapps.com/api/terminal/" + xyz).
// then().
// contentType(ContentType.XML).extract().body().asString();
//
//
// // String abc = response.toString();
// System.out.println(abc);
//
//
// }
}
| [
"[email protected]"
] | |
d3cd9ff5eacf2fef780e4f42cafb189ae50a8909 | 64e6cd377ad1464534b7c517984427cc202fc6bb | /Ashbot-master 2/src/AshBrain.java | accf05a840043fd4b4b6295778936e9121250415 | [] | no_license | ArelySkywalker/Java | 3c55dff0045d14e05c7581282d572066847a67d0 | d3e8816d7be1a7fe9400d210534ee944eac23de8 | refs/heads/master | 2021-05-02T11:02:23.501907 | 2019-03-28T19:15:52 | 2019-03-28T19:15:52 | 45,858,947 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,352 | java | import java.util.HashSet;
import java.util.Random;
public class AshBrain
{
// These Hashmaps store data for quick lookup time
static HashSet<String> pokemonHash = new HashSet<String>();
static HashSet<String> stateHash = new HashSet<String>();
//Constructor, initializes AI by grabbing data from ENUMS.
public AshBrain()
{
getEnums();
}
/*
* This method determines the response to the user upon receiving input.
* It implements direct matching, partial matching, and stochasticity.
*/
public static String communicate(String input){
String response;
if(input.toLowerCase().equals("hi") || input.toLowerCase().equals("hello") ||
input.toLowerCase().equals("hey") || input.toLowerCase().equals("yo") ||
input.toLowerCase().equals("howdy") || input.toLowerCase().equals("hola"))
response = "Hi!";
else if(input.toLowerCase().contains("bye"))
response = "Bye!";
else if(input.toLowerCase().contains("you")
&& input.toLowerCase().contains("old")
|| input.toLowerCase().contains("age"))
response = "I am 10 years old. How old are you?";
else if(input.toLowerCase().contains("how") && input.toLowerCase().contains("are") &&
input.toLowerCase().contains("you"))
response = "Fine thanks! Do you like Pokemon?";
else if(input.toLowerCase().contains("what") && input.toLowerCase().contains("your")
&& input.toLowerCase().contains("name"))
response = "My name is Ash. What's yours?";
else if(input.toLowerCase().contains("pikachu")
&& input.toLowerCase().contains("you")
&& input.toLowerCase().contains("did")
|| input.toLowerCase().contains("get")
|| input.toLowerCase().contains("receive")
|| input.toLowerCase().contains("gave"))
response = "Professor Oak. Do you have a Pikachu?";
else if(input.toLowerCase().contains("your")
&& input.toLowerCase().contains("favorite")
&& input.toLowerCase().contains("pokemon"))
response = "My Pikachu of course! What's yours?";
else if(input.toLowerCase().contains("where")
&& input.toLowerCase().contains("you")
&& input.toLowerCase().contains("from"))
response = "I'm from Pallet Town. What state are you from?";
else if(input.toLowerCase().contains("your")
&& input.toLowerCase().contains("first")
&& input.toLowerCase().contains("pokemon"))
response = "Pikachu! What was yours?";
else if(input.toLowerCase().contains("badges")
&& input.toLowerCase().contains("you")
&& input.toLowerCase().contains("have"))
response = "57 right now! How many do you have?";
else if(input.toLowerCase().contains("you")
&& input.toLowerCase().contains("caught"))
response = "77 so far. What about you?";
else if(input.toLowerCase().contains("many")
|| input.toLowerCase().contains("much")
&& input.toLowerCase().contains("pokemon")
&& input.toLowerCase().contains("there")
|| input.toLowerCase().contains("exist"))
response = "Hmm... my Pokedex says there 721 discovered Pokemon so far!";
else if(input.toLowerCase().contains("who")
&& input.toLowerCase().contains("want")
&& input.toLowerCase().contains("you")
|| input.toLowerCase().contains("goal"))
response = "I want to be the very best, like no one ever was! Who do you want to be?";
else if(input.toLowerCase().contains("you")
&& input.toLowerCase().contains("friends")
|| input.toLowerCase().contains("best"))
response = "My best friends are Brock and Misty! Who are yours?";
else if(input.toLowerCase().contains("what")
&& input.toLowerCase().contains("you")
&& input.toLowerCase().contains("test"))
response = "To catch them is my real test!";
else if(input.toLowerCase().contains("what")
&& input.toLowerCase().contains("you")
&& input.toLowerCase().contains("cause"))
response = "To train them is my cause!";
else if(input.toLowerCase().equals("meowth"))
response = "Prepare for trouble. Make it double. "
+ "To protect the world from devastation. To unite all peoples\n "
+ "within our nation. To denounce the evils of truth and love.\n To "
+ "extend our reach to the stars above. Jessie! James!\n Team Rocket,"
+ " blast off at the speed of light! Surrender now, or prepare to fight!\n"
+ " Meowth! That's right!";
else if(isNumeric(input))
response = "That's a nice number!";
else if (pokemonHash.contains(input.toLowerCase())
|| input.toLowerCase().contains("my")
|| input.toLowerCase().contains("favorite")
|| input.toLowerCase().contains("is"))
response = "That's a cool Pokemon!";
else if (stateHash.contains(input.toLowerCase())
|| input.toLowerCase().contains("I")
|| input.toLowerCase().contains("am")
|| input.toLowerCase().contains("from"))
response = "I've never been there before! Do they have cool Pokemon?";
else if(input.toLowerCase().contains("yes"))
response = "Cool.";
else if(input.toLowerCase().contains("no"))
response = "Oh ok.";
//If input is unrecognized, return a random response.
else response = randomResponse();
return response;
}
//This generates a random response. It is called when the input from the user is unrecognized.
private static String randomResponse(){
Random rand = new Random();
int randNum = rand.nextInt(6);
if(randNum == 0) return "Do they have cool pokemon where you're from?";
else if(randNum == 1) return "Want to battle?";
else if(randNum == 2) return "I really like Pokemon! Let's talk more about that!";
else if(randNum == 3) return "Are we still talking about Pokemon?";
else if(randNum == 4) return "uuuhhhh I've never heard of that Pokemon";
else return "I don't know what you're talking about. Let's keep this Pokemon oriented!";
}
//This function checks if an entered string is a number
private static boolean isNumeric(String str)
{
try
{
double d = Double.parseDouble(str);
}
catch(NumberFormatException nfe)
{
return false;
}
return true;
}
//This function is used to get out ENUMS and put them in hashmaps for quick searches
public static void getEnums()
{
for (PokemonNames name : PokemonNames.values())
{
pokemonHash.add(name.name());
}
for (State stateName : State.values())
{
stateHash.add(stateName.name());
}
}
} | [
"[email protected]"
] | |
cac2c439b97fcc3578bbb669ba88abbc5f109518 | 0c9714ff4b4debc1c23c2724104ece64d9ea4986 | /app/src/main/java/com/mdrayefenam/karigorbangla/Activity/SplashScreen.java | 7d18cf984183cf22f032e0f940d1be8f1b7750e4 | [] | no_license | MDRAYEFENAM/Karigor | b7d4a002d0845755c5b04fd7160ef75fc19cbf6a | 34bc7ea25fcc7ee129a2dbf8327bb7b8edac11f0 | refs/heads/master | 2021-03-21T22:00:42.292312 | 2020-03-25T19:09:39 | 2020-03-25T19:09:39 | 244,321,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,332 | java | package com.mdrayefenam.karigorbangla.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import com.mdrayefenam.karigorbangla.R;
import com.mdrayefenam.karigorbangla.SessionClass.SessionClass;
import androidx.appcompat.app.AppCompatActivity;
public class SplashScreen extends AppCompatActivity {
SessionClass sessionClass;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView( R.layout.splash_screen);
sessionClass = SessionClass.getInstance(this);
if (sessionClass.isLoggedIn()) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashScreen.this, MainServiceSelectPage.class);
startActivity(intent);
finish();
}
}, 2000);
} else {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashScreen.this, MainServiceSelectPage.class);
startActivity(intent);
finish();
}
}, 2000);
}
}
}
| [
"[email protected]"
] | |
8fe4a5c22eef073f4f812a0e1e44054852c715e6 | 1721c1e45201b0c6ae5c81d9bdd69ea6cfb76dfe | /turms-service/src/main/java/im/turms/service/workflow/access/servicerequest/dto/RequestHandlerResult.java | 8f8f1d0e029170dc4cb10a84e4630413ee1722b4 | [
"Apache-2.0"
] | permissive | foundations/turms | aa677206b2c8256cfe66347059c311fe7bcab1dd | f08e1ec0d14a470f49a335988f0abe5f9b9244d6 | refs/heads/master | 2023-08-07T03:29:44.848472 | 2021-09-01T10:59:46 | 2021-09-01T11:18:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,788 | java | /*
* Copyright (C) 2019 The Turms Project
* https://github.com/turms-im/turms
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.turms.service.workflow.access.servicerequest.dto;
import im.turms.common.model.dto.notification.TurmsNotification;
import im.turms.common.model.dto.request.TurmsRequest;
import im.turms.server.common.constant.TurmsStatusCode;
import im.turms.server.common.util.ProtoUtil;
import java.util.Set;
/**
* @author James Chen
*/
public record RequestHandlerResult(
TurmsNotification.Data dataForRequester,
boolean forwardDataForRecipientsToOtherSenderOnlineDevices,
Set<Long> recipients,
TurmsRequest dataForRecipients,
TurmsStatusCode code,
String reason
) {
@Override
public String toString() {
return "RequestHandlerResult[" +
"dataForRequester=" + ProtoUtil.toLogString(dataForRequester) +
", forwardDataForRecipientsToOtherSenderOnlineDevices=" + forwardDataForRecipientsToOtherSenderOnlineDevices +
", recipients=" + recipients +
", dataForRecipients=" + ProtoUtil.toLogString(dataForRecipients) +
", code=" + code +
", reason=" + reason +
']';
}
}
| [
"[email protected]"
] | |
b689a2b52c5dbdfb842f14d8aa8259674ea69421 | d99ca7c70d2a7792a7b5544655d1a06ff6d4960f | /airport/src/com/xhystc/airport/dao/AirportDao.java | 1d3f25950e9920ca7318be3ff4b08f7690ac5cf1 | [] | no_license | xhystc/AirportTicketManagment | 4dde40aceb5bd5e4c002df3b89fdcc3776393b22 | eba55335a687b8f9906d627c80e3da622ea61707 | refs/heads/master | 2021-05-15T14:51:54.667654 | 2017-11-01T14:28:16 | 2017-11-01T14:28:16 | 107,345,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package com.xhystc.airport.dao;
import com.xhystc.airport.entities.Airport;
import java.util.List;
public interface AirportDao
{
Airport addAirport(String name,String location);
boolean deleteAirport(long id);
List<Airport> findAirports(String name);
Airport findAirport(String name);
Airport findAirport(long id);
}
| [
"[email protected]"
] | |
d330e42c1a5080c346fa537cbcbfa611af4f347b | 99bd3fa9696c6b0cb077df4316958c852a6de806 | /src/test/java/com/node/system/test/freemarker/ui/FreemarkerUtil.java | e657dfe17bc29ecae882aa67dbd3c2cc055bdc6f | [
"Apache-2.0"
] | permissive | WilliamMajanja-zz/node-eduoa | 16894e924656a4e2f5b2066622fc6e5c440a3fdf | 815363656d66677ec8c7c2acebab6f8643749457 | refs/heads/master | 2022-09-09T15:06:52.114339 | 2013-08-23T02:17:39 | 2013-08-23T02:17:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,221 | java | package com.node.system.test.freemarker.ui;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;
import freemarker.template.Template;
import freemarker.template.TemplateException;
public abstract class FreemarkerUtil {
private static Configuration configuration;
private static final String TEMPLATE_DIR = FreemarkerUtil.class
.getResource("/").getPath() + "../..";
public static Template getTemplate(String ftl) {
try {
return getConfiguration().getTemplate(
"target/test-classes/com/node/test/freemarker/ui/ftl/"
+ ftl);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public static synchronized Configuration getConfiguration() {
if (configuration == null) {
try {
Properties properties = new Properties();
properties.load(FreemarkerUtil.class
.getResourceAsStream("/freemarker.properties"));
configuration = new Configuration();
configuration.setSettings(properties);
configuration.setDirectoryForTemplateLoading(new File(
TEMPLATE_DIR));
configuration.setObjectWrapper(new DefaultObjectWrapper());
Map<String, String> map = new HashMap<String, String>();
map.put("dwz", "src/main/webapp/WEB-INF/ui/dwz.ftl");
configuration.addAutoImport("dwz",
"src/main/webapp/WEB-INF/ui/index.ftl");
} catch (IOException e) {
e.printStackTrace();
} catch (TemplateException e) {
e.printStackTrace();
}
}
return configuration;
}
public static String execute(Template template, Map<?, ?> rootMap) {
Writer out = new BufferedWriter(new OutputStreamWriter(System.out));
StringWriter out2 = new StringWriter();
try {
template.process(rootMap, out);
template.process(rootMap, out2);
out.flush();
out2.flush();
out2.close();
} catch (TemplateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return out2.getBuffer().toString();
}
}
| [
"[email protected]"
] | |
bff76eb05acb46ec4c094d6f0c43a2cd0c54d79c | 7b518109d5aae7372fb7f21e2f7755e353da19ce | /src/java/Servlet/LogoutServlet.java | 1fc092304399ff2165d8cfdc2714591625a468a7 | [] | no_license | FabianaOliveira/Fabiana | 586029c208f3e9f2d5c11d7495c25614742dba43 | 0fbe643a8c835409157628ee68d66f1d3f0852cd | refs/heads/master | 2020-12-31T04:56:10.175415 | 2016-04-23T01:15:59 | 2016-04-23T01:15:59 | 56,894,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,990 | 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 Servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author escm
*/
public class LogoutServlet extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet LogoutServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet LogoutServlet at " + request.getContextPath() + "</h1>");
out.println("</body>");
out.println("</html>");
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"[email protected]"
] | |
f4a1f8cc95e1a37909144fdd68daf2e821d32391 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/3/org/apache/commons/math3/optim/AbstractConvergenceChecker_getAbsoluteThreshold_60.java | 5d27adc69ed1e1d0fc65b99a9cd80f89153334f5 | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 305 | java |
org apach common math3 optim
base converg checker implement
param pair type point pair
version
abstract converg checker abstractconvergencecheck pair
absolut threshold
absolut threshold getabsolutethreshold
absolut threshold absolutethreshold
| [
"[email protected]"
] | |
9d54d24e0f80c0d7a5af0d6dad2986b12a954a0e | 34c3b0887f71165a6d4a533bc06ffa2624c2dc10 | /summer-alipay-core/src/main/java/com/alipay/api/domain/AntMerchantExpandIndirectOnlineModifyModel.java | 15050ebb526f1160aefd14ef462c3096dace19e3 | [] | no_license | songhaoran/summer-alipay | 91a7a7fdddf67265241785cd6bb2b784c0f0f1c4 | d02e33d9ab679dfc56160af4abd759c0abb113a4 | refs/heads/master | 2021-05-04T16:39:11.272890 | 2018-01-17T09:52:32 | 2018-01-17T09:52:32 | 120,255,759 | 1 | 0 | null | 2018-02-05T04:42:15 | 2018-02-05T04:42:15 | null | UTF-8 | Java | false | false | 5,763 | java | package com.alipay.api.domain;
import java.util.Date;
import java.util.List;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
/**
* ็บฟไธ้ด่ฟๅๆทไฟฎๆน
*
* @author auto create
* @since 1.0, 2017-09-25 15:18:27
*/
public class AntMerchantExpandIndirectOnlineModifyModel extends AlipayObject {
private static final long serialVersionUID = 1786826238135458742L;
/**
* ๅๆทๅฐๅไฟกๆฏ
*/
@ApiListField("address_info")
@ApiField("address_info")
private List<AddressInfo> addressInfo;
/**
* ๅๆท็ฎ็งฐ
*/
@ApiField("alias_name")
private String aliasName;
/**
* ็ญพ็บฆๅ็ๆบๆpid
*/
@ApiField("bank_pid")
private String bankPid;
/**
* ๅๆทๅฏนๅบ้ถ่กๆๅผ็ซ็็ป็ฎๅกไฟกๆฏ
*/
@ApiListField("bankcard_info")
@ApiField("bank_card_info")
private List<BankCardInfo> bankcardInfo;
/**
* ๅๆท่ฏไปถ็ผๅท๏ผไผไธๆ่
ไธชไฝๅทฅๅๆทๆไพ่ฅไธๆง็
ง๏ผไบไธๅไฝๆไพไบ่ฏๅท๏ผ
*/
@ApiField("business_license")
private String businessLicense;
/**
* ๅๆท่ฏไปถ็ฑปๅ๏ผๅๅผ่ๅด๏ผNATIONAL_LEGAL๏ผ่ฅไธๆง็
ง๏ผNATIONAL_LEGAL_MERGE:่ฅไธๆง็
ง(ๅค่ฏๅไธ)๏ผINST_RGST_CTF๏ผไบไธๅไฝๆณไบบ่ฏไนฆ
*/
@ApiField("business_license_type")
private String businessLicenseType;
/**
* ๅๆท่็ณปไบบไฟกๆฏ
*/
@ApiListField("contact_info")
@ApiField("contact_info")
private List<ContactInfo> contactInfo;
/**
* ๆฏไปๆบๆpid/source id๏ผๆๅกๅPID๏ผ
*/
@ApiField("isv_pid")
private String isvPid;
/**
* ๅๆท็ๆฏไปๅฎ่ดฆๅท
*/
@ApiListField("logon_id")
@ApiField("string")
private List<String> logonId;
/**
* mcc็ผ็
*/
@ApiField("mcc")
private String mcc;
/**
* ๅๆท็นๆฎ่ต่ดจ็ญ
*/
@ApiField("memo")
private String memo;
/**
* ๅๆทๅ็งฐ
*/
@ApiField("name")
private String name;
/**
* ๅๆท็ๆฏไปไบ็ปด็ ไธญไฟกๆฏ๏ผ็จไบ่ฅ้ๆดปๅจ
*/
@ApiListField("pay_code_info")
@ApiField("string")
private List<String> payCodeInfo;
/**
* ๅๆทๅฎขๆ็ต่ฏ
*/
@ApiField("service_phone")
private String servicePhone;
/**
* ๅๆทๅจ้ถ่ก็ซฏ็็ญพ็บฆๆถ้ด
*/
@ApiField("sign_bank_time")
private Date signBankTime;
/**
* ็ซ็นไฟกๆฏ
*/
@ApiListField("site_info")
@ApiField("site_info")
private List<SiteInfo> siteInfo;
/**
* ๅๆทๅจๆฏไปๅฎๅ
ฅ้ฉปๆๅๅ๏ผ็ๆ็ๆฏไปๅฎๅ
ๅ
จๅฑๅฏไธ็ๅๆท็ผๅท
*/
@ApiField("sub_merchant_id")
private String subMerchantId;
/**
* ๅๆทๅจๅ็ๆบๆ็ๅฏไธไปฃ็ ๏ผ่ฏฅไปฃๅทๅจ่ฏฅๆบๆไธไฟๆๅฏไธ๏ผextenalID๏ผ
*/
@ApiField("unique_id_by_bank")
private String uniqueIdByBank;
/**
* ๅๆทๅจๆฏไปๆบๆ็็ๅฏไธไปฃ็ ๏ผๆๅกๅๅฏน่ฏฅๅๆทๅ้
็ID๏ผ
*/
@ApiField("unique_id_by_isv")
private String uniqueIdByIsv;
public List<AddressInfo> getAddressInfo() {
return this.addressInfo;
}
public void setAddressInfo(List<AddressInfo> addressInfo) {
this.addressInfo = addressInfo;
}
public String getAliasName() {
return this.aliasName;
}
public void setAliasName(String aliasName) {
this.aliasName = aliasName;
}
public String getBankPid() {
return this.bankPid;
}
public void setBankPid(String bankPid) {
this.bankPid = bankPid;
}
public List<BankCardInfo> getBankcardInfo() {
return this.bankcardInfo;
}
public void setBankcardInfo(List<BankCardInfo> bankcardInfo) {
this.bankcardInfo = bankcardInfo;
}
public String getBusinessLicense() {
return this.businessLicense;
}
public void setBusinessLicense(String businessLicense) {
this.businessLicense = businessLicense;
}
public String getBusinessLicenseType() {
return this.businessLicenseType;
}
public void setBusinessLicenseType(String businessLicenseType) {
this.businessLicenseType = businessLicenseType;
}
public List<ContactInfo> getContactInfo() {
return this.contactInfo;
}
public void setContactInfo(List<ContactInfo> contactInfo) {
this.contactInfo = contactInfo;
}
public String getIsvPid() {
return this.isvPid;
}
public void setIsvPid(String isvPid) {
this.isvPid = isvPid;
}
public List<String> getLogonId() {
return this.logonId;
}
public void setLogonId(List<String> logonId) {
this.logonId = logonId;
}
public String getMcc() {
return this.mcc;
}
public void setMcc(String mcc) {
this.mcc = mcc;
}
public String getMemo() {
return this.memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public List<String> getPayCodeInfo() {
return this.payCodeInfo;
}
public void setPayCodeInfo(List<String> payCodeInfo) {
this.payCodeInfo = payCodeInfo;
}
public String getServicePhone() {
return this.servicePhone;
}
public void setServicePhone(String servicePhone) {
this.servicePhone = servicePhone;
}
public Date getSignBankTime() {
return this.signBankTime;
}
public void setSignBankTime(Date signBankTime) {
this.signBankTime = signBankTime;
}
public List<SiteInfo> getSiteInfo() {
return this.siteInfo;
}
public void setSiteInfo(List<SiteInfo> siteInfo) {
this.siteInfo = siteInfo;
}
public String getSubMerchantId() {
return this.subMerchantId;
}
public void setSubMerchantId(String subMerchantId) {
this.subMerchantId = subMerchantId;
}
public String getUniqueIdByBank() {
return this.uniqueIdByBank;
}
public void setUniqueIdByBank(String uniqueIdByBank) {
this.uniqueIdByBank = uniqueIdByBank;
}
public String getUniqueIdByIsv() {
return this.uniqueIdByIsv;
}
public void setUniqueIdByIsv(String uniqueIdByIsv) {
this.uniqueIdByIsv = uniqueIdByIsv;
}
}
| [
"[email protected]"
] | |
a4227a8731b534e61cfb06f4e709bc95fff11d1f | d931d17af0848c2636dabddc67ed8c13a7cfa39e | /src/test/java/chamadostecnicos/AcompanhamentoControllerTest.java | 41c332d2cb73f21002df6213a622ef63c76a62d5 | [] | no_license | jeanmbm/chamadostecnicos | 7668cb7d20e27ced73a0f002e7921dd20da9948e | 716d16fed6ed8669accb4a98a1495a1518e2e190 | refs/heads/master | 2023-05-08T03:14:06.466735 | 2021-05-30T23:56:38 | 2021-05-30T23:56:38 | 350,430,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 628 | java | package chamadostecnicos;
import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.Test;
import chamadostecnicos.controller.AcompanhamentoController;
import chamadostecnicos.model.Acompanhamento;
class AcompanhamentoControllerTest {
AcompanhamentoController acompanhamentoController = new AcompanhamentoController();
@Test
void listarAcompanhamento() {
List<Acompanhamento> acompanhamentos = new ArrayList<Acompanhamento>();
acompanhamentos = acompanhamentoController.listarAcompanhamento();
assertTrue(!acompanhamentos.isEmpty());
}
}
| [
"[email protected]"
] | |
edb6fd4313ff9db5b167a00f9961509ecb398ed7 | 8b16505b1329ed46feb03d89639d97cd918ba64c | /demo-application/src/main/java/com/example/demo/service/EmpServiceImpl.java | f2ea85586ed0e2249df9c73fd7e2b9f8ebd4e56d | [] | no_license | sivasuit/spring-boot-examples | 5ce1db11dd6148c661cace11cd530c77065d5893 | 951cb74996a7292deb1d98d36da9226bf397eac1 | refs/heads/master | 2023-09-01T18:11:28.693170 | 2020-05-04T08:42:40 | 2020-05-04T08:42:40 | 259,522,054 | 0 | 0 | null | 2023-07-23T13:48:20 | 2020-04-28T03:32:17 | Java | UTF-8 | Java | false | false | 558 | java | package com.example.demo.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.demo.modal.Employee;
import com.example.demo.repository.EmployeeRepository;
@Service
public class EmpServiceImpl implements EmpService{
@Autowired
EmployeeRepository employeeRepo;
public List<Employee> getEmployees() {
return employeeRepo.findAll();
}
@Override
public Employee saveEmployee(Employee employee) {
return employeeRepo.save(employee);
}
}
| [
"[email protected]"
] | |
91a1d805503721dffc6489f158f28fcbaa1872a7 | 5c64004c54c4a64035cce2224bdcfe450e6f9bab | /si-onem2m-src/IITP_IoT_2_7/src/main/java/net/herit/iot/onem2m/resource/RestResponse.java | a7e234422e4d787182ad243caa7257362be61a40 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | uguraba/SI | 3fd091b602c843e3b7acc12aa40ed5365964663b | 9e0f89a7413c351b2f739b1ee8ae2687c04d5ec1 | refs/heads/master | 2021-01-08T02:37:39.152700 | 2018-03-08T01:28:24 | 2018-03-08T01:28:24 | 241,887,209 | 0 | 0 | BSD-2-Clause | 2020-02-20T13:13:19 | 2020-02-20T13:12:20 | null | UTF-8 | Java | false | false | 1,943 | java | package net.herit.iot.onem2m.resource;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlAccessType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"code",
"message",
"content",
"commandId"
})
public class RestResponse {
@XmlElement(name = "code")
private String code;
@XmlElement(name = "message")
private String message;
@XmlElement(name = "content")
private String content;
@XmlElement(name = "_commandId")
private String commandId;
/**
* @return the code
*/
public String getCode() {
return code;
}
/**
* @param code the code to set
*/
public void setCode(String code) {
this.code = code;
}
/**
* @return the message
*/
public String getMessage() {
return message;
}
/**
* @param message the message to set
*/
public void setMessage(String message) {
this.message = message;
}
/**
* @return the content
*/
public String getContent() {
return content;
}
/**
* @param commandId the commandId to set
*/
public void setContent(String content) {
this.content = content;
}
/**
* @return the commandId
*/
public String getCommandId() {
return commandId;
}
/**
* @param command the command to set
*/
public void setCommandId(String commandId) {
this.commandId = commandId;
}
protected static final String NL = "\r\n";
public String toString() {
StringBuilder sbld = new StringBuilder();
sbld.append("[SSCommand]").append(NL);
sbld.append("code:").append(code).append(NL);
sbld.append("message:").append(message).append(NL);
sbld.append("content:").append(content).append(NL);
sbld.append("commandId:").append(commandId).append(NL);
sbld.append(NL).append(super.toString());
return sbld.toString();
}
}
| [
"[email protected]"
] | |
87e7b15ed1c9217f35df3bae1079540797e497b9 | 46ba0d668f5e8bb988e8afffbccfc859e2a67db8 | /app/src/main/java/com/example/snmlangerandcanteenstore/VendorActivity.java | d0745e15a4518db9aefaa571e3e4c05fd78dbddd | [] | no_license | debeshasingh/SNMLangerAndCanteenStore | 913e3be8b6d669378665900ad42b2bbf60cc0bac | 238a1a109f080920bdfe4a85e7f8ca5a56b79d80 | refs/heads/master | 2021-05-24T18:46:34.294542 | 2020-05-28T04:28:52 | 2020-05-28T04:28:52 | 253,502,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,141 | java |
package com.example.snmlangerandcanteenstore;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.WindowManager;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import com.example.snmlangerandcanteenstore.constant.AppConstants;
import com.example.snmlangerandcanteenstore.constant.HelperInterface;
import com.example.snmlangerandcanteenstore.fragment.login.UserListFragment;
import com.example.snmlangerandcanteenstore.fragment.vendor.VendorListFragment;
import com.example.snmlangerandcanteenstore.helper.ApplicationHelper;
public class VendorActivity extends AppCompatActivity implements HelperInterface {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (BuildConfig.SCREEN)
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
setContentView(R.layout.activity_vendor);
vendorList();
}
public void vendorList() {
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
Fragment fragment = VendorListFragment.newInstance();
fragmentTransaction.add(R.id.frame_vendor, fragment, AppConstants.FRAGMENT_VENDOR_LIST);
fragmentTransaction.addToBackStack(AppConstants.FRAGMENT_VENDOR_LIST);
fragmentTransaction.commit();
}
@Override
public void onBackPressed() {
onBack();
}
public void onBack() {
int count = getSupportFragmentManager().getBackStackEntryCount();
if (count > 1) {
getSupportFragmentManager().popBackStack();
} else {
finish();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
onBack();
}
return super.onOptionsItemSelected(item);
}
@Override
public ApplicationHelper getHelper() {
return ApplicationHelper.getInstance();
}
}
| [
"[email protected]"
] | |
b581d8ac20c7da1e174835770d7854d8f73e9323 | 46f89683bacf355ca0cd13ef9e391b8ac73952d8 | /app/src/main/java/com/example/practice/Lecture_4/FnExample.java | f20dccb1d1dfb7be5cba0a6928b06715b3aa2d2a | [] | no_license | deepakmeett/Practice | 1f3c9d5f49b4bc9a13f5747b41c8a17a05d6f525 | 4d6a54892b30e016ac94055fc32eac2a7ea7a3d7 | refs/heads/master | 2021-12-14T22:21:41.574842 | 2021-12-08T13:06:24 | 2021-12-08T13:06:24 | 213,930,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 606 | java | package com.company.Lecture_4;
import java.util.Scanner;
public class FnExample {
public static void main(String[] args) {
int a = 7;
int b = 9;
{
System.out.println(a);
swap(4,5);
}
}
public static void swap(int x, int b) {
int t = x;
x = b;
b = t;
System.out.print(x+b);
}
public static void converter(int s, int e, int step) {
while (s <= e) {
float c = (5f / 9) * (s - 32);
System.out.println(c);
s += step;
}
}
}
| [
"[email protected]"
] | |
dcb17f7b5ef69518841534e8f6cb98d7f3360b19 | 29e1c1336cea70a97ea0b957831b561cc439a25c | /src/test/java/com/mt/blockchain/service/BlockServiceTest.java | dc1f105dd26f3f22caf1a02804770c42aae867bf | [] | no_license | MaciejTomczyk/blockchain-demo | cf6aa91aea9c5abea5559d69bab4eee54e59d6b1 | c4f2b70d1374dd6b8445795289f2ceddda896859 | refs/heads/master | 2021-04-03T07:58:59.172172 | 2018-03-08T20:39:32 | 2018-03-08T20:39:32 | 124,445,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,218 | java | package com.mt.blockchain.service;
import com.mt.blockchain.model.Block;
import com.mt.blockchain.model.Blockchain;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class BlockServiceTest {
@Mock
private HashService hashService;
@InjectMocks
private BlockService blockService = new BlockService();
@Test
public void shouldCreateNewBlock() {
// given
Blockchain blockchain = new Blockchain();
Block b = new Block();
blockchain.setChain(new ArrayList<>());
blockchain.getChain().add(b);
when(hashService.hash(any())).thenReturn("");
// when
blockService.newBlock(blockchain, 100L, null);
// then
verify(hashService, atLeastOnce()).hash(any());
assertEquals(2, blockchain.getChain().size());
}
} | [
"[email protected]"
] | |
fb8b806360a8d3f455c8f384ff00edb251706144 | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/jdbi/learning/5881/StatementContext.java | 80450a406c7f1470d8aadc7d8431e6ac9a89fb98 | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,453 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jdbi.v3.core.statement;
import java.io.Closeable;
import java.lang.reflect.Type;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collector;
import org.jdbi.v3.core.CloseException;
import org.jdbi.v3.core.Handle;
import org.jdbi.v3.core.argument.Argument;
import org.jdbi.v3.core.argument.Arguments;
import org.jdbi.v3.core.array.SqlArrayArgumentStrategy;
import org.jdbi.v3.core.array.SqlArrayType;
import org.jdbi.v3.core.array.SqlArrayTypes;
import org.jdbi.v3.core.collector.JdbiCollectors;
import org.jdbi.v3.core.config.ConfigRegistry;
import org.jdbi.v3.core.config.JdbiConfig;
import org.jdbi.v3.core.extension.ExtensionMethod;
import org.jdbi.v3.core.generic.GenericType;
import org.jdbi.v3.core.mapper.ColumnMapper;
import org.jdbi.v3.core.mapper.ColumnMappers;
import org.jdbi.v3.core.mapper.Mappers;
import org.jdbi.v3.core.mapper.RowMapper;
import org.jdbi.v3.core.mapper.RowMappers;
import org.jdbi.v3.core.qualifier.QualifiedType;
import org.jdbi.v3.meta.Beta;
import static java.util.Objects.requireNonNull;
/**
* The statement context provides access to statement-local configuration.
* Context is inherited from the parent {@link Handle} initially and changes will
* not outlive the statement.
* The context will be passed through most major jdbi APIs.
*
* DISCLAIMER: The class is not intended to be extended. The final modifier is absent to allow
* mock tools to create a mock object of this class in the user code.
*/
public class StatementContext implements Closeable {
private final ConfigRegistry config;
private final ExtensionMethod extensionMethod;
private final Set<Cleanable> cleanables = new LinkedHashSet<>();
private String rawSql;
private String renderedSql;
private ParsedSql parsedSql;
private PreparedStatement statement;
private Connection connection;
private Binding binding = new Binding();
private boolean returningGeneratedKeys = false;
private String[] generatedKeysColumnNames = new String[0];
private boolean concurrentUpdatable = false;
private Instant executionMoment, completionMoment, exceptionMoment;
StatementContext() {
this(new ConfigRegistry());
}
StatementContext(ConfigRegistry config) {
this(config, null);
}
StatementContext(ConfigRegistry config, ExtensionMethod extensionMethod) {
this.config = requireNonNull(config);
this.extensionMethod = extensionMethod;
}
/**
* Gets the configuration object of the given type, associated with this context.
*
* @param configClass the configuration type
* @param <C> the configuration type
* @return the configuration object of the given type, associated with this context.
*/
public <C extends JdbiConfig<C>> C getConfig(Class<C> configClass) {
return config.get(configClass);
}
/**
* @return the {@code ConfigRegistry} this context owns
*/
public ConfigRegistry getConfig() {
return config;
}
/**
* Returns the attributes applied in this context.
*
* @return the defined attributes.
*/
public Map<String, Object> getAttributes() {
return getConfig(SqlStatements.class).getAttributes(); }
/**
* Obtain the value of an attribute
*
* @param key the name of the attribute
* @return the value of the attribute
*/
public Object getAttribute(String key) {
return getConfig(SqlStatements.class).getAttribute(key);
}
/**
* Define an attribute for in this context.
*
* @param key the key for the attribute
* @param value the value for the attribute
*/
public void define(String key, Object value) {
getConfig(SqlStatements.class).define(key, value);
}
/**
* Obtain an argument for given value in this context
*
* @param type the type of the argument.
* @param value the argument value.
* @return an Argument for the given value.
*/
public Optional<Argument> findArgumentFor(Type type, Object value) {
return getConfig(Arguments.class).findFor(type, value);
}
/**
* Obtain an argument for given value in this context
*
* @param type the type of the argument.
* @param value the argument value.
* @return an Argument for the given value.
*/
@Beta
public Optional<Argument> findArgumentFor(QualifiedType type, Object value) {
return getConfig(Arguments.class).findFor(type, value);
}
/**
* @return the strategy used to bind array-type arguments to SQL statements
*/
public SqlArrayArgumentStrategy getSqlArrayArgumentStrategy() {
return getConfig(SqlArrayTypes.class).getArgumentStrategy();
}
/**
* Obtain an {@link SqlArrayType} for the given array element type in this context
*
* @param elementType the array element type.
* @return an {@link SqlArrayType} for the given element type.
*/
public Optional<SqlArrayType<?>> findSqlArrayTypeFor(Type elementType) {
return getConfig(SqlArrayTypes.class).findFor(elementType);
}
/**
* Obtain a mapper for the given type in this context.
*
* @param <T> the type to map
* @param type the target type to map to
* @return a mapper for the given type, or empty if no row or column mappers
* is registered for the given type.
*/
public <T> Optional<RowMapper<T>> findMapperFor(Class<T> type) {
return getConfig(Mappers.class).findFor(type);
}
/**
* Obtain a mapper for the given type in this context.
*
* @param <T> the type to map
* @param type the target type to map to
* @return a mapper for the given type, or empty if no row or column mappers
* is registered for the given type.
*/
public <T> Optional<RowMapper<T>> findMapperFor(GenericType<T> type) {
return getConfig(Mappers.class).findFor(type);
}
/**
* Obtain a mapper for the given type in this context.
*
* @param type the target type to map to
* @return a mapper for the given type, or empty if no row or column mappers
* is registered for the given type.
*/
public Optional<RowMapper<?>> findMapperFor(Type type) {
return getConfig(Mappers.class).findFor(type);
}
/**
* Obtain a mapper for the given qualified type in this context.
*
* @param type the target qualified type to map to
* @return a mapper for the given qualified type, or empty if no row or column mappers
* is registered for the given type.
*/
@Beta
public Optional<RowMapper<?>> findMapperFor(QualifiedType type) {
return getConfig(Mappers.class).findFor(type);
}
/**
* Obtain a column mapper for the given type in this context.
*
* @param <T> the type to map
* @param type the target type to map to
* @return a ColumnMapper for the given type, or empty if no column mapper is registered for the given type.
*/
public <T> Optional<ColumnMapper<T>> findColumnMapperFor(Class<T> type) {
return getConfig(ColumnMappers.class).findFor(type);
}
/**
* Obtain a column mapper for the given type in this context.
*
* @param <T> the type to map
* @param type the target type to map to
* @return a ColumnMapper for the given type, or empty if no column mapper is registered for the given type.
*/
public <T> Optional<ColumnMapper<T>> findColumnMapperFor(GenericType<T> type) {
return getConfig(ColumnMappers.class).findFor(type);
}
/**
* Obtain a column mapper for the given type in this context.
*
* @param type the target type to map to
* @return a ColumnMapper for the given type, or empty if no column mapper is registered for the given type.
*/
public Optional<ColumnMapper<?>> findColumnMapperFor(Type type) {
return getConfig(ColumnMappers.class).findFor(type);
}
/**
* Obtain a column mapper for the given qualified type in this context.
*
* @param type the qualified target type to map to
* @return a ColumnMapper for the given type, or empty if no column mapper is registered for the given type.
*/
@Beta
public Optional<ColumnMapper<?>> findColumnMapperFor(QualifiedType type) {
return getConfig(ColumnMappers.class).findFor(type);
}
/**
* Obtain a row mapper for the given type in this context.
*
* @param type the target type to map to
* @return a RowMapper for the given type, or empty if no row mapper is registered for the given type.
*/
public Optional<RowMapper<?>> findRowMapperFor(Type type) {
return getConfig(RowMappers.class).findFor(type);
}
/**
* Obtain a row mapper for the given type in this context.
*
* @param <T> the type to map
* @param type the target type to map to
* @return a RowMapper for the given type, or empty if no row mapper is registered for the given type.
*/
public <T> Optional<RowMapper<T>> findRowMapperFor(Class<T> type) {
return getConfig(RowMappers.class).findFor(type);
}
/**
* Obtain a row mapper for the given type in this context.
*
* @param <T> the type to map
* @param type the target type to map to
* @return a RowMapper for the given type, or empty if no row mapper is registered for the given type.
*/
public <T> Optional<RowMapper<T>> findRowMapperFor(GenericType<T> type) {
return getConfig(RowMappers.class).findFor(type);
}
/**
* Obtain a collector for the given type.
*
* @param containerType the container type.
* @return a Collector for the given container type, or empty null if no collector is registered for the given type.
*/
public Optional<Collector<?, ?, ?>> findCollectorFor(Type containerType) {
return getConfig(JdbiCollectors.class).findFor(containerType);
}
/**
* Returns the element type for the given container type.
*
* @param containerType the container type.
* @return the element type for the given container type, if available.
*/
public Optional<Type> findElementTypeFor(Type containerType) {
return getConfig(JdbiCollectors.class).findElementTypeFor(containerType);
}
StatementContext setRawSql(String rawSql) {
this.rawSql = rawSql;
return this;
}
/**
* Obtain the initial sql for the statement used to create the statement
*
* @return the initial sql
*/
public String getRawSql() {
return rawSql;
}
void setRenderedSql(String renderedSql) {
this.renderedSql = renderedSql;
}
/**
* Obtain the rendered SQL statement
* <p>
* Not available until until statement execution time
* </p>
*
* @return the sql statement after processing template directives.
*/
public String getRenderedSql() {
return renderedSql;
}
void setParsedSql(ParsedSql parsedSql) {
this.parsedSql = parsedSql;
}
/**
* Obtain the parsed SQL statement
* <p>
* Not available until until statement execution time
* </p>
*
* @return the sql statement as it will be executed against the database
*/
public ParsedSql getParsedSql() {
return parsedSql;
}
void setStatement(PreparedStatement stmt) {
statement = stmt;
}
/**
* Obtain the actual prepared statement being used.
* <p>
* Not available until execution time
* </p>
*
* @return Obtain the actual prepared statement being used.
*/
public PreparedStatement getStatement() {
return statement;
}
StatementContext setConnection(Connection connection) {
this.connection = connection;
return this;
}
/**
* Obtain the JDBC connection being used for this statement
*
* @return the JDBC connection
*/
public Connection getConnection() {
return connection;
}
StatementContext setBinding(Binding b) {
this.binding = b;
return this;
}
/**
* @return the statement binding
*/
public Binding getBinding() {
return binding;
}
/**
* Sets whether the current statement returns generated keys.
* @param b return generated keys?
*/
public void setReturningGeneratedKeys(boolean b) {
if (isConcurrentUpdatable() && b) {
throw new IllegalArgumentException("Cannot create a result set that is concurrent "
+ "updatable and is returning generated keys.");
}
this.returningGeneratedKeys = b;
}
/**
* @return whether the statement being generated is expected to return generated keys.
*/
public boolean isReturningGeneratedKeys() {
return returningGeneratedKeys || generatedKeysColumnNames.length > 0;
}
/**
* @return the generated key column names, if any
*/
public String[] getGeneratedKeysColumnNames() {
return Arrays.copyOf(generatedKeysColumnNames, generatedKeysColumnNames.length);
}
/**
* Set the generated key column names.
* @param generatedKeysColumnNames the generated key column names
*/
public void setGeneratedKeysColumnNames(String[] generatedKeysColumnNames) {
this.generatedKeysColumnNames = Arrays.copyOf(generatedKeysColumnNames, generatedKeysColumnNames.length);
}
/**
* Return if the statement should be concurrent updatable.
*
* If this returns true, the concurrency level of the created ResultSet will be
* {@link java.sql.ResultSet#CONCUR_UPDATABLE}, otherwise the result set is not updatable,
* and will have concurrency level {@link java.sql.ResultSet#CONCUR_READ_ONLY}.
*
* @return if the statement generated should be concurrent updatable.
*/
public boolean isConcurrentUpdatable() {
return concurrentUpdatable;
}
/**
* Set the context to create a concurrent updatable result set.
*
* This cannot be combined with {@link #isReturningGeneratedKeys()}, only
* one option may be selected. It does not make sense to combine these either, as one
* applies to queries, and the other applies to updates.
*
* @param concurrentUpdatable if the result set should be concurrent updatable.
*/
public void setConcurrentUpdatable(final boolean concurrentUpdatable) {
if (concurrentUpdatable && isReturningGeneratedKeys()) {
throw new IllegalArgumentException("Cannot create a result set that is concurrent "
+ "updatable and is returning generated keys.");
}
this.concurrentUpdatable = concurrentUpdatable;
}
public Instant getExecutionMoment() {
return executionMoment;
}
public void setExecutionMoment(Instant executionMoment) {
this.executionMoment = executionMoment;
}
public Instant getCompletionMoment() {
return completionMoment;
}
public void setCompletionMoment(Instant completionMoment) {
this.completionMoment = completionMoment;
}
public Instant getExceptionMoment() {
return exceptionMoment;
}
public void setExceptionMoment(Instant exceptionMoment) {
this.exceptionMoment = exceptionMoment;
}
/**
* Convenience method to measure elapsed time between start of query execution and completion or exception as appropriate. Do not call with a null argument or before a query has executed/exploded.
*/
public long getElapsedTime(ChronoUnit unit) {
return unit.between(executionMoment, completionMoment == null ? exceptionMoment : completionMoment);
}
/**
* Registers a {@code Cleanable} to be invoked when the statement context is closed. Cleanables can be registered
* on a statement context, which will be cleaned up when
* the statement finishes or (in the case of a ResultIterator), the object representing the results is closed.
* <p>
* Resources cleaned up by Jdbi include {@link ResultSet}, {@link Statement}, {@link Handle},
* {@link java.sql.Array}, and {@link StatementBuilder}.
*
* @param cleanable the Cleanable to clean on close
*/
public void addCleanable(Cleanable cleanable) {
cleanables.add(cleanable);
}
@Override
@SuppressWarnings("PMD.DoNotThrowExceptionInFinally")
public void close() {
SQLException exception = null;
try {
List<Cleanable> cleanables = new ArrayList<>(this.cleanables);
this.cleanables.clear();
Collections.reverse(cleanables);
for (Cleanable cleanable : cleanables) {
try {
cleanable.close();
} catch (SQLException e) {
if (exception == null) {
exception = e;
} else {
exception.addSuppressed(e);
}
}
}
} finally {
if (exception != null) {
throw new CloseException("Exception thrown while cleaning StatementContext", exception);
}
}
}
public ExtensionMethod getExtensionMethod() {
return extensionMethod;
}
}
| [
"[email protected]"
] | |
c66fa610548121c76af16b319b8d030171bd4cae | 4c2bf78305bb63a44932c4f67a327beadbf9d2f5 | /app/src/main/java/com/tilicho/marketsimplifiedsystemtask/data/remote/NetworkInterceptor.java | 4e897bbdd0447fcc2f357d543ffe956a9a2f37f5 | [] | no_license | manu-1910/MarketSimplified-SystemTask | 00319b0c807f681936f4a59f59e40c68f8dce22a | 1e79a8267c80881cfa8f5345f18d8e07571c9cee | refs/heads/master | 2023-06-07T20:17:43.492892 | 2020-09-28T07:57:05 | 2020-09-28T07:57:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,125 | java | package com.tilicho.marketsimplifiedsystemtask.data.remote;
import android.util.Log;
import java.io.IOException;
import okhttp3.Connection;
import okhttp3.Interceptor;
import okhttp3.Protocol;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class NetworkInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
logRequestDetails(request, chain.connection());
return chain.proceed(request);
}
private synchronized void logRequestDetails(Request request, Connection connection)
throws IOException {
RequestBody requestBody = request.body();
Protocol protocol = connection != null ? connection.protocol() : Protocol.HTTP_1_1;
String requestStartMessage =
"--> " + request.method() + ' ' + request.url() + ' ' + protocol;
if (requestBody != null) {
requestStartMessage += " (" + requestBody.contentLength() + "-byte body)";
}
Log.d("REQUEST", requestStartMessage);
}
}
| [
"[email protected]"
] | |
ea7b3cc4f295f2c1f3e4c81cbc64a8b0e5c80964 | 554fc45582ff4e7183f6368e99f13f5f841a7144 | /mobile/src/web/webxt_forms/src/main/java/mobile/web/webxt_forms/client/forms/JsonGridExample.java | 8ce8e0cab38210b7d12e091224b713f292598f7b | [
"Apache-2.0"
] | permissive | diemontufar/microxt | 55e029b3559f9da042415379756e844da3b20474 | f381629d5abd3e8ae524e54cc3baf1a8abb51f92 | refs/heads/master | 2021-05-28T22:39:30.419414 | 2015-03-20T07:35:52 | 2015-03-20T07:35:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,530 | java | package mobile.web.webxt_forms.client.forms;
import java.util.ArrayList;
import java.util.List;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.data.BaseListLoader;
import com.extjs.gxt.ui.client.data.HttpProxy;
import com.extjs.gxt.ui.client.data.JsonLoadResultReader;
import com.extjs.gxt.ui.client.data.ListLoadResult;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.ModelType;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.google.gwt.core.client.GWT;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.user.client.Element;
public class JsonGridExample extends LayoutContainer {
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
setLayout(new FlowLayout(10));
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(new ColumnConfig("Sender", "Sender", 100));
columns.add(new ColumnConfig("Email", "Email", 165));
columns.add(new ColumnConfig("Phone", "Phone", 100));
columns.add(new ColumnConfig("State", "State", 50));
columns.add(new ColumnConfig("Zip", "Zip Code", 65));
// create the column model
ColumnModel cm = new ColumnModel(columns);
// defines the xml structure
ModelType type = new ModelType();
type.setRoot("records");
type.addField("Sender", "name");
type.addField("Email", "email");
type.addField("Phone", "phone");
type.addField("State", "state");
type.addField("Zip", "zip");
// Determine if Explorer or Example for JSON path
String path = GWT.getHostPageBaseURL() + "data/data.json";
// use a http proxy to get the data
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, path);
HttpProxy<String> proxy = new HttpProxy<String>(builder);
// need a loader, proxy, and reader
JsonLoadResultReader<ListLoadResult<ModelData>> reader = new JsonLoadResultReader<ListLoadResult<ModelData>>(
type);
final BaseListLoader<ListLoadResult<ModelData>> loader = new BaseListLoader<ListLoadResult<ModelData>>(
proxy, reader);
ListStore<ModelData> store = new ListStore<ModelData>(loader);
final Grid<ModelData> grid = new Grid<ModelData>(store, cm);
grid.setBorders(true);
grid.setLoadMask(true);
grid.getView().setEmptyText("Please hit the load button.");
grid.setAutoExpandColumn("Sender");
ContentPanel panel = new ContentPanel();
panel.setFrame(true);
panel.setCollapsible(true);
panel.setAnimCollapse(false);
panel.setButtonAlign(HorizontalAlignment.CENTER);
panel.setHeading("JSON Table Demo");
panel.setLayout(new FitLayout());
panel.add(grid);
panel.setSize(575, 350);
// add buttons
Button load = new Button("Load JSON",
new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
loader.load();
}
});
panel.addButton(load);
grid.getAriaSupport().setLabelledBy(
panel.getHeader().getId() + "-label");
add(panel);
}
}
| [
"[email protected]@8fa0a0d8-283d-5376-5cbe-a9d62bc2fdea"
] | [email protected]@8fa0a0d8-283d-5376-5cbe-a9d62bc2fdea |
b8b2df9a9284e400b2a0b269fd394350233be05b | fa87847799d4d5f049a01122bbd9b476e5b16cc3 | /src/main/java/com/sample/xmlread/dao/XmlRepository.java | f235096ee19456c9f387716512343143cef76128 | [] | no_license | Debo1404/xml-read | 4cc7d6b13433a970e5d706bc15f344135ca0865e | 09d6b630e8b8bb43b769419e45551c7b537f5b02 | refs/heads/master | 2023-06-02T01:25:21.889646 | 2021-06-20T07:43:01 | 2021-06-20T07:43:01 | 334,601,542 | 0 | 0 | null | 2021-06-20T07:43:02 | 2021-01-31T07:47:48 | Java | UTF-8 | Java | false | false | 275 | java | package com.sample.xmlread.dao;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.sample.xmlread.model.IPsubnet;
@Repository
public interface XmlRepository extends CrudRepository<IPsubnet, Integer>{
}
| [
"[email protected]"
] | |
6c14491f8825f0f5795d2451daf371b9ab7fd949 | 41cf27b63283026da705bb7ead268994a989a52a | /service/service_edu/src/main/java/flyerwge/eduservice/entity/query/CoursePublishQuery.java | 379ba43e13b8911a7bfb3f3edc2d81594c88cb95 | [] | no_license | flyerwge/OnlineEducationSpring | c4a5781e7396babaac81e032a99bf208f6cab558 | 8e26d67498cb6107f426f0961da908fc362f39d6 | refs/heads/master | 2023-07-04T13:49:51.394389 | 2021-08-14T15:02:13 | 2021-08-14T15:02:13 | 381,724,620 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package flyerwge.eduservice.entity.query;
import java.io.Serializable;
public class CoursePublishQuery implements Serializable {
private String id;
private String title;
private String cover;
private String lessonNum;
private String subjectLevelOne;
private String SubjectLevelTwo;
private String teacherName;
private String price;
}
| [
"[email protected]"
] | |
40aa4ef742f398fb0f69ae680136b868d5dd8656 | 8b838e80b174991ebba2b09a87bf1d9a04eccab9 | /schoolbbs-server/src/main/java/cdu/zb/controller/SchoolRegisterController.java | 5a008fed1718d5c45fc38498c68e8c247b1a3d03 | [] | no_license | simple55-alt/schoolbbs | 4bb856f541390eb3afa35a7e90a3892e85b8152e | c6a2b87525626ed9b86db5faccdf3bc0bbc26442 | refs/heads/master | 2022-04-16T06:29:12.852513 | 2020-04-14T06:20:31 | 2020-04-14T06:20:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | package cdu.zb.controller;
import cdu.zb.jsonresult.BaseApiController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* ๅ็ซฏๆงๅถๅจ
* </p>
*
* @author accountw
* @since 2020-01-09
*/
@RestController
@RequestMapping("/api/school-register")
@CrossOrigin
public class SchoolRegisterController extends BaseApiController {
}
| [
"[email protected]"
] | |
c0ed7e60c16b1b4ef93ff5bc1b6022a869a2adbd | 2891ab7d455728b4bcb51a6196b9cec5265f666f | /src/main/java/student_jekaterina_soldatova/lesson06/level_3_junior/ArrayService.java | 90d08623dbd0a3f5f9860c6d0120f57d7e470998 | [] | no_license | AlexJavaGuru/java_1_wednesday_2022 | 14eefec7c15ab7fce4d5b5a8ee545ff674e944df | dea5c75a855f4987bdf245aab7a05dddbb6ea9d0 | refs/heads/master | 2022-09-07T13:01:57.188817 | 2022-06-10T19:03:48 | 2022-06-10T19:03:48 | 449,743,084 | 11 | 7 | null | 2022-07-15T20:26:17 | 2022-01-19T15:16:45 | Java | UTF-8 | Java | false | false | 2,124 | java | package student_jekaterina_soldatova.lesson06.level_3_junior;
class ArrayService {
boolean arrayIncludesNumber(int[] arrayToCheck, int numberToCheck) {
for (int i : arrayToCheck) {
if (i == numberToCheck) {
return true;
}
}
return false;
}
int arrayIncludesNumberCountTimes(int[] arrayToCheck, int numberToCheck) {
int numberOfTimes = 0;
for (int i : arrayToCheck) {
if (i == numberToCheck) {
numberOfTimes++;
}
}
return numberOfTimes;
}
void changeOneNumberInArrayFirst(int[] array, int numberToChange, int newNumber) {
int count = 0;
for (int i = 0; i < array.length; i++) {
if (array[i] == numberToChange) {
array[i] = newNumber;
count++;
break;
}
}
if (count == 0) {
System.out.println("No such number in the array");
}
}
void changeOneNumberInArrayAllInstances(int[] array, int numberToChange, int newNumber) {
int count = 0;
for (int i = 0; i < array.length; i++) {
if (array[i] == numberToChange) {
array[i] = newNumber;
count++;
}
}
if (count == 0) {
System.out.println("No such number in the array");
}
}
void reverseArray(int[] array) {
int length = array.length;
int temporaryHolder;
for (int i = 0; i < length / 2; i++) {
temporaryHolder = array[i];
array[i] = array[(length - 1 - i)];
array[(length - 1 - i)] = temporaryHolder;
}
}
void sortArray(int[] array) {
int length = array.length;
for (int i = 0; i < length; i++) {
for (int j = i + 1; j < length; j++) {
int min;
if (array[i] >= array[j]) {
min = array[i];
array[i] = array[j];
array[j] = min;
}
}
}
}
} | [
"[email protected]"
] | |
25cba5682b1c8fee10b6f1b243c3a9be54adb29f | b6c4f4e1a067b4f9e35498a31a60187abb440eaf | /core/src/main/java/com/tianqiauto/textile/weaving/model/result/ResultShiftChuanZong.java | 70ce6a62dd197fc825d7b8ffeca84a851489c885 | [] | no_license | zhaileiworld/shanghai | a3554b8462885416d402aacd4098d49daa913994 | 7341b9bd65caac8f44c989258c3ac4157b9e2dfc | refs/heads/master | 2020-05-23T20:22:26.658684 | 2019-05-17T10:59:10 | 2019-05-17T10:59:10 | 186,929,111 | 0 | 0 | null | 2019-05-16T01:39:08 | 2019-05-16T01:37:01 | Java | UTF-8 | Java | false | false | 3,078 | java | package com.tianqiauto.textile.weaving.model.result;
import com.tianqiauto.textile.weaving.model.base.User;
import com.tianqiauto.textile.weaving.model.sys.Shift_ChuanZong;
import com.tianqiauto.textile.weaving.util.copy.MyCopyProperties;
import lombok.Data;
import org.springframework.data.domain.Page;
import java.util.Arrays;
import java.util.Date;
/**
* @ClassName ResultShiftChuanZong
* @Description TODO
* @Author lrj
* @Date 2019/4/25 10:23
* @Version 1.0
**/
@Data
public class ResultShiftChuanZong {
private Long id;
//็ญๆฌก๏ผๆบๅฐๅท๏ผ็ป่ฝดๅท๏ผๅ็บฆๅท๏ผๅๅทฅ
private String banci;
private String banci_id;
private String heyuehao;
private String heyuehao_id;
private String pibuguige;
private String users;
private String users_id;
private String jitaihao;
private String jitaihao_id;
private String zhiZhou;
private String zhiZhou_id;
private Date riqi;
private String genshu;
private String shifouwancheng;
private String beizhu;
public static Page<ResultShiftChuanZong> convert(Page<Shift_ChuanZong> shift_chuanZongs){
Page<ResultShiftChuanZong> dtoPage = shift_chuanZongs.map(shift_chuanZong -> {
ResultShiftChuanZong dto = new ResultShiftChuanZong();
MyCopyProperties.copyProperties(shift_chuanZong, dto, Arrays.asList("id","riqi","genshu","shifouwancheng","beizhu"));
if(shift_chuanZong.getJitaihao()!=null){
dto.setJitaihao(shift_chuanZong.getJitaihao().getJitaihao());
dto.setJitaihao_id(shift_chuanZong.getJitaihao().getId().toString());
}
if(shift_chuanZong.getBanci()!=null){
dto.setBanci(shift_chuanZong.getBanci().getName());
dto.setBanci_id(shift_chuanZong.getBanci().getId().toString());
}
if(shift_chuanZong.getHeyuehao()!=null){
dto.setHeyuehao(shift_chuanZong.getHeyuehao().getName());
dto.setHeyuehao_id(shift_chuanZong.getHeyuehao().getId().toString());
if(shift_chuanZong.getHeyuehao().getOrder()!=null){
dto.setPibuguige(shift_chuanZong.getHeyuehao().getOrder().getPibuguige());
}
}
if(shift_chuanZong.getZhiZhou()!=null){
dto.setZhiZhou(shift_chuanZong.getZhiZhou().getZhouhao());
dto.setZhiZhou_id(shift_chuanZong.getZhiZhou().getId().toString());
}
if(shift_chuanZong.getUsers().size()>0){
String users = "";
String users_id = "";
for(User user : shift_chuanZong.getUsers()){
users = users + user.getUsername()+user.getXingming()+"ใ";
users_id = users_id + user.getId().toString()+",";
}
dto.setUsers(users.substring(0,users.length()-1));
dto.setUsers_id(users_id.substring(0,users_id.length()-1));
}
return dto;
});
return dtoPage;
}
}
| [
"[email protected]"
] | |
3813bb674243fb22f0ac926d390cd128724086c1 | c2882688b3d1bb00785e745cce06063e5663afc7 | /bpm/bpm-impl/src/main/java/org/bndly/common/bpm/impl/ProcessVariableImpl.java | 018fdbd03e36b0d3116a46e2babbae849ef21b91 | [
"Apache-2.0"
] | permissive | bndly/bndly-commons | e04be01aabcb9e5ff6d15287a3cfa354054a26fe | 6734e6a98f7e253ed225a4f2cce47572c5a969cb | refs/heads/master | 2023-04-03T04:20:47.954354 | 2023-03-17T13:49:57 | 2023-03-17T13:49:57 | 275,222,708 | 1 | 2 | Apache-2.0 | 2023-01-02T21:59:50 | 2020-06-26T18:31:34 | Java | UTF-8 | Java | false | false | 1,076 | java | package org.bndly.common.bpm.impl;
/*-
* #%L
* BPM Impl
* %%
* Copyright (C) 2013 - 2020 Cybercon GmbH
* %%
* 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.
* #L%
*/
import org.bndly.common.bpm.api.ProcessVariable;
public class ProcessVariableImpl implements ProcessVariable {
private final String name;
private final Object value;
public ProcessVariableImpl(String name, Object value) {
this.name = name;
this.value = value;
}
@Override
public String getName() {
return name;
}
@Override
public Object getValue() {
return value;
}
}
| [
"[email protected]"
] | |
a577867ba57a35401efb907217586b66fbfd4033 | 1100109331aff950b095b87264d09223e9500812 | /src/cn/david/android/client/Constants.java | 792523c3997a309b8ce56389816a81ccf7422375 | [] | no_license | LNAmp/Netty4TimeClient | c85414cc1992f4fbc47bda26c95c0df9755ae13d | c6c2066421298fc0037200ab26a077a50f312bdf | refs/heads/master | 2021-01-17T09:32:36.293130 | 2015-10-18T09:08:43 | 2015-10-18T09:08:43 | 31,583,509 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 841 | java | package cn.david.android.client;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public final class Constants {
public static String serverIp;
public static int serverPort;
public static String username;
public static String password;
public static long loginTimeout;
static {
InputStream is = Connection.class.getClassLoader().getResourceAsStream("constants.properties");
Properties prop = new Properties();
try {
prop.load(is);
} catch (IOException e) {
e.printStackTrace();
}
serverIp = prop.getProperty("serverIp");
serverPort = Integer.parseInt(prop.getProperty("serverPort"));
username = prop.getProperty("username");
password = prop.getProperty("password");
loginTimeout = Long.parseLong(prop.getProperty("loginTimeout"));
}
}
| [
"[email protected]"
] | |
86ed3b86496499128a88a8b1f0b62f73832c8b0c | 07e687c5c252d04d4719d3224374ec8535304f8c | /javaStudy20210302.java | b90061f8bc743869c6d3bfca73c2817c62abd888 | [] | no_license | brad0520/BackEnd-Study | fe1c76094e985c7f820c487e53e54d085145de5f | 504814459099dff23a5e3bbf5e9def2ea8e62e73 | refs/heads/main | 2023-04-01T04:24:27.470176 | 2021-04-06T01:50:48 | 2021-04-06T01:50:48 | 339,046,546 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,209 | java | package java2021;
public class javaStudy20210302 {
public static void main(String[] args) {
hi1();
hi2();
hi3();
hi4();
hi();
bye();
print(4);
prints(10);
greeting(2,10);
}
public static void greeting(int a, int b) {
String x = "";
switch (a) {
case 1: x = "์๋
ํ์ธ์";
break;
case 2: x = "ํ์ด~";
break;
case 3: x = "๋ด์ฅฌ";
break;
}
for(int i=0; i<b; i++) {
System.out.println(x);
}
}
public static void prints(int b) {
for(int i=0; i<b; i++) {
System.out.println("์๋
ํ์ธ์. 20์ด ํ๊ธธ๋์
๋๋ค.!");
}
}
public static void print(int a) {
System.out.println(a);
}
public static void hi1() {
System.out.println("์ ๋ ์ฐจํ์ง์
๋๋ค.");
}
public static void hi2() {
System.out.println("์๋
ํ์ธ์.");
}
public static void hi3() {
System.out.println("ํ๋ก๊ทธ๋จ์ ๋ง๋ค์ด๋ณด์์.");
}
public static void hi4() {
System.out.println("์๋ฐ๋ฅผ ํตํด");
}
public static void hi() {
System.out.println("์๋
ํ์ธ์. ์ ๋ ํ๊ธธ๋์
๋๋ค. ์๋ถํ๋๋ฆฝ๋๋ค.");
}
public static void bye() {
System.out.println("์๋
ํ ๊ฐ์ธ์. ๋ค์์ ๋ ๋ด์!");
}
}
| [
"[email protected]"
] | |
6d7450bfd619caeda03a368712dd03b4ac03f288 | f9f28ba3c58008e8e55bfd1a46277c6c45a00223 | /src/test/java/com/tau/runners/RunCucumberTests.java | b52f3d2fd82c87427998ee49d6e233bc26332e9f | [] | no_license | zahin-abrar/tau-cucumber-course | 3eb39a57690d10a29d6d4557d7b3e448a56560ee | d0e1a228b1c114b546e429cf370ac9e640d13231 | refs/heads/master | 2023-02-17T18:20:31.025008 | 2021-01-21T15:43:54 | 2021-01-21T15:43:54 | 330,761,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 368 | java | package com.tau.runners;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(glue={"com.tau.steps"}, features = "src/test/resources", plugin = { "pretty", "html:target/site/cucumber-pretty",
"json:target/cucumber.json" })
public class RunCucumberTests {
}
| [
"[email protected]"
] | |
7ef62e7b069e82c42a1b82d5d46761298c307300 | 9e4b1d91f7521ac9198a2f36393adb971a3883ee | /LeavePlanner/src/main/java/com/company/LeavePlanner/Employee.java | df7222257e2521412b165fac77787a82b4f15d2f | [] | no_license | AmulyaReddy99/LeavePlanner | 64ee6ec6dd778eae0be978219dd022033e9f5a4c | 708a9d133fc70453c91d1bb8904714113ae02693 | refs/heads/main | 2023-07-15T11:10:30.823999 | 2021-08-30T12:34:46 | 2021-08-30T12:34:46 | 401,334,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,007 | java | package com.company.LeavePlanner;
public abstract class Employee {
private Float vacationDays = 0.0F;
private final Integer totalWorkDays = 260;
private Integer workedDays = 0;
private String type;
private String employeeId;
Employee() {}
public void work(Integer daysWorked) {
if (workedDays + daysWorked < totalWorkDays) {
workedDays += daysWorked;
}
}
public void takeVacation(Float vacationsUsed) {
vacationDays += vacationsUsed;
}
public Float getVacationDays() {
return vacationDays;
}
public Integer getWorkedDays() {
return workedDays;
}
public String getEmployeeId() {
return employeeId;
}
public void setEmployeeId(String employeeId) {
this.employeeId = employeeId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
| [
"[email protected]"
] | |
a1236d46a4fa209a8189c3b50f864c609419da83 | ccc5322cfb27c71e7838136b7d977182e731456a | /src/main/java/jp/co/soramitsu/iroha/java/detail/Hashable.java | aa35b25fc224a7b5cbd1f99a3d261304da4bbbc3 | [
"Apache-2.0"
] | permissive | Warchant/iroha-pure-java | 697789599922441fe573199342e522b167dc3b1b | dbe4237af422e06a9bed639d386768a9f98b210c | refs/heads/v1.0.0_rc2 | 2021-07-09T01:33:13.211000 | 2019-01-25T13:14:26 | 2019-01-25T13:37:59 | 136,601,870 | 9 | 8 | Apache-2.0 | 2019-01-25T13:38:00 | 2018-06-08T10:02:29 | Java | UTF-8 | Java | false | false | 532 | java | package jp.co.soramitsu.iroha.java.detail;
import com.google.protobuf.GeneratedMessageV3.Builder;
import org.spongycastle.jcajce.provider.digest.SHA3;
public abstract class Hashable<T extends Builder<T>> {
private SHA3.Digest256 digest = new SHA3.Digest256();
private T proto;
public Hashable(T t) {
this.proto = t;
}
public T getProto() {
return proto;
}
public byte[] hash() {
return digest.digest(payload());
}
public byte[] payload() {
return proto.buildPartial().toByteArray();
}
}
| [
"[email protected]"
] | |
c7cd85f80930607bc46cd6259df957a94b937205 | af576510cc533f9b8ca81bbf744b2b739273e353 | /src/patterns/singleton/lazy_load/SingletonWithSynchronizedBlock.java | d6bdaf76d3e9b404de053e9a94c5a064f0cdbf80 | [] | no_license | acprimer/DataStructure | d0718a5c7fd8a6347fb19c913e0b944120ea56ec | 79584c1771a073f4558b36ad3f51af8f9ce8e26d | refs/heads/master | 2021-01-11T00:56:20.312853 | 2020-04-21T05:27:28 | 2020-04-21T05:27:28 | 70,446,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 522 | java | package patterns.singleton.lazy_load;
/**
* Created by yaodh on 2017/4/12.
*/
public class SingletonWithSynchronizedBlock {
private static SingletonWithSynchronizedBlock instance;
private SingletonWithSynchronizedBlock() { }
public static SingletonWithSynchronizedBlock getInstance() {
if (instance == null) {
synchronized (SingletonWithSynchronizedBlock.class) {
instance = new SingletonWithSynchronizedBlock();
}
}
return instance;
}
}
| [
"[email protected]"
] | |
0ae0014786180c1f6b08a117382b2fb154f585df | c2ae1e1e2544e02a3113d9762bb84d264d5d12b6 | /src/com/application/job/action/JobDao.java | 36fa47df9572c7cd9222d1ae6c691dba0f4813e2 | [] | no_license | qtxsnwwb/EnterpriseApplication | 655f0958cadc25a0ff465de5c2c0fd8ca788cb48 | d3320de48cf8f10b7aba3a8d7f1d2c950d6f5bd5 | refs/heads/master | 2020-12-31T23:58:54.946188 | 2020-02-08T08:05:40 | 2020-02-08T08:05:40 | 239,087,683 | 0 | 1 | null | null | null | null | GB18030 | Java | false | false | 717 | java | package com.application.job.action;
/**
*
* @Description ๆ่ไฟกๆฏDAOๆฅๅฃ
*
*/
public interface JobDao {
/**
* @Description ๆทปๅ ๆ่ไฟกๆฏ
* @param jname ่ไฝๅ็งฐ
* @param partment ๆๅฑ้จ้จ
* @param worktype ๅทฅไฝๆง่ดจ
* @param salary ๆ่ช่ๅด
* @param jedu ๅญฆๅ่ฆๆฑ
* @param pnum ๆ่ไบบๆฐ
* @param jperson ่็ณปไบบ
* @param jtel ๆๆบ
* @param jmail ้ฎ็ฎฑ
* @param message ่ฏฆ็ปไฟกๆฏ
* @return ๆทปๅ ๆๅไธๅฆ
*/
public boolean add(final String jname, final String partment, final String worktype, final String salary, final String jedu, final String pnum, final String jperson, final String jtel, final String jmail, final String message);
}
| [
"[email protected]"
] | |
2f4d266cc61e9a273484d883adf9fc3cee7888a8 | 7d202bb91da6a199106d2155eca72f549163e6c6 | /app/src/main/java/com/example/clicknhelp/VerifyPhoneActivity.java | d33d0106a9fb3a5f1b09eebf6669ad90da80a2c8 | [] | no_license | riyamehere/ClickNhelp | 8d58b08df46af495bc8a12f47c92a3c3f69c6bd7 | 0370863e875c2dca4b3c339f68ee8fb21af6023d | refs/heads/master | 2022-11-22T12:44:02.216713 | 2020-07-12T12:53:08 | 2020-07-12T12:53:08 | 278,907,553 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,107 | java | package com.example.clicknhelp;
import android.content.Intent;
import android.os.Bundle;
//import android.support.annotation.NonNull;
//import android.support.design.widget.Snackbar;
//import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskExecutors;
import com.google.firebase.FirebaseException;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException;
import com.google.firebase.auth.PhoneAuthCredential;
import com.google.firebase.auth.PhoneAuthProvider;
import java.util.concurrent.TimeUnit;
public class VerifyPhoneActivity extends AppCompatActivity {
//These are the objects needed
//It is the verification id that will be sent to the user
private String mVerificationId;
//The edittext to input the code
private EditText editTextCode;
//firebase auth object
private FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_verify_phone);
//initializing objects
mAuth = FirebaseAuth.getInstance();
editTextCode = findViewById(R.id.editTextCode);
//getting mobile number from the previous activity
//and sending the verification code to the number
Intent intent = getIntent();
String mobile = intent.getStringExtra("mobile");
sendVerificationCode(mobile);
//if the automatic sms detection did not work, user can also enter the code manually
//so adding a click listener to the button
findViewById(R.id.buttonSignIn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String code = editTextCode.getText().toString().trim();
if (code.isEmpty() || code.length() < 6) {
editTextCode.setError("Enter valid code");
editTextCode.requestFocus();
return;
}
//verifying the code entered manually
verifyVerificationCode(code);
}
});
}
//the method is sending verification code
//the country id is concatenated
//you can take the country id as user input as well
private void sendVerificationCode(String mobile) {
PhoneAuthProvider.getInstance().verifyPhoneNumber(
"+91" + mobile,
60,
TimeUnit.SECONDS,
TaskExecutors.MAIN_THREAD,
mCallbacks);
}
//the callback to detect the verification status
private PhoneAuthProvider.OnVerificationStateChangedCallbacks mCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) {
//Getting the code sent by SMS
String code = phoneAuthCredential.getSmsCode();
//sometime the code is not detected automatically
//in this case the code will be null
//so user has to manually enter the code
if (code != null) {
editTextCode.setText(code);
//verifying the code
verifyVerificationCode(code);
}
}
@Override
public void onVerificationFailed(FirebaseException e) {
Toast.makeText(VerifyPhoneActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
}
@Override
public void onCodeSent(String s, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
super.onCodeSent(s, forceResendingToken);
//storing the verification id that is sent to the user
mVerificationId = s;
}
};
private void verifyVerificationCode(String code) {
//creating the credential
PhoneAuthCredential credential = PhoneAuthProvider.getCredential(mVerificationId, code);
//signing the user
signInWithPhoneAuthCredential(credential);
}
private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) {
mAuth.signInWithCredential(credential)
.addOnCompleteListener(VerifyPhoneActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
//verification successful we will start the profile activity
Intent intent = new Intent(VerifyPhoneActivity.this, SecondActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
} else {
//verification unsuccessful.. display an error message
String message = "Somthing is wrong, we will fix it soon...";
if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) {
message = "Invalid code entered...";
}
/*Snackbar snackbar = Snackbar.make(findViewById(R.id.parent), message, Snackbar.LENGTH_LONG);
snackbar.setAction("Dismiss", new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
snackbar.show();*/
}
}
});
}
} | [
"[email protected]"
] | |
6f8266e2120a772daca72ebb5319faee95791bc8 | 4d2952402b02c3804fa24519ff366f38c449645e | /src/java/user/GTTournamentResultsServlet.java | 7f2ff5f15617f15573d18a340f6120dd1f5674de | [] | no_license | davethemacguy/AlbertaWargamingGT | b4ac20b7f9b5068929e2eb026fcc2c9f5f9bc4c4 | da424ea0d0ba16a50727e2dacd62f037d3e2524e | refs/heads/master | 2020-12-25T21:22:45.119579 | 2014-02-19T20:43:20 | 2014-02-19T20:43:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,444 | java | package user;
import business.SystemResults;
import business.Tournament;
import data.TournamentResultsDB;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class GTTournamentResultsServlet extends HttpServlet {
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String tournamentSeason = request.getParameter("tournamentSeason");
String system = request.getParameter("system");
ArrayList<SystemResults> arrayOfTournamentResults = TournamentResultsDB.selectGTTournamentResults(tournamentSeason, system);
HttpSession session = request.getSession();
session.setAttribute("gtTournamentResults", arrayOfTournamentResults);
String url = "/login/gtTournamentRankings.jsp";
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher(url);
dispatcher.forward(request, response);
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
} | [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.