blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
35124d79da71b3c5fae6f9af4d97f64fc3142719 | 92dd6bc0a9435c359593a1f9b309bb58d3e3f103 | /src/Mar2021Leetcode/_0095UniqueBinarySearchTreesII.java | ba9435de2a056a042e1cb61928786ec6289794fd | [
"MIT"
] | permissive | darshanhs90/Java-Coding | bfb2eb84153a8a8a9429efc2833c47f6680f03f4 | da76ccd7851f102712f7d8dfa4659901c5de7a76 | refs/heads/master | 2023-05-27T03:17:45.055811 | 2021-06-16T06:18:08 | 2021-06-16T06:18:08 | 36,981,580 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 511 | java | package Mar2021Leetcode;
import java.util.List;
public class _0095UniqueBinarySearchTreesII {
static public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode() {
}
TreeNode(int val) {
this.val = val;
}
TreeNode(int val, TreeNode left, TreeNode right) {
this.val = val;
this.left = left;
this.right = right;
}
}
public static void main(String[] args) {
System.out.println(generateTrees(3));
}
public static List<TreeNode> generateTrees(int n) {
}
}
| [
"hsdars@gmail.com"
] | hsdars@gmail.com |
6a192678a98ced1dab135c5989241b12868a5775 | fe1f2c68a0540195b227ebee1621819766ac073b | /OVO_jdgui/myobfuscated/yd.java | eb232efe0a1d1389f60a7ce1a3708043779f0774 | [] | no_license | Sulley01/KPI_4 | 41d1fd816a3c0b2ab42cff54a4d83c1d536e19d3 | 04ed45324f255746869510f0b201120bbe4785e3 | refs/heads/master | 2020-03-09T05:03:37.279585 | 2018-04-18T16:52:10 | 2018-04-18T16:52:10 | 128,602,787 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 254 | java | package myobfuscated;
public abstract interface yd
{
public abstract void a()
throws xt;
}
/* Location: C:\dex2jar-2.0\classes-dex2jar.jar!\myobfuscated\yd.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"sullivan.alvin@ymail.com"
] | sullivan.alvin@ymail.com |
bb76ad74616496872c0d6c514290e0f1da56ac30 | 80d0d9d750fef2978b2986375a45e9253bdc7013 | /src/com/floppyinfant/android/data/DatabaseManager.java | d2e191046ef75bec7dd83fd1b39c002b392aab6e | [] | no_license | floppyinfant/AndroidApp | 069726ba4f36fc7f88bbeddccadc7e6759676d21 | 9d4614fcb65a30ea7cd332998d24f2a1d8814b8a | refs/heads/master | 2021-01-10T11:39:56.949590 | 2013-01-29T08:58:03 | 2013-01-29T08:58:03 | 44,705,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,809 | java | package com.floppyinfant.android.data;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
/**
* Database Adapter<br />
* a Database Manager
*
* @author TM
*
*/
public class DatabaseManager extends SQLiteOpenHelper {
/* *************************************************************************
* Database-Schema
**************************************************************************/
public static final String DATABASE_NAME = "androidapp.db";
public static final int DATABASE_VERSION = 1;
public static final String DATABASE_TABLE = "notes";
/*
* Columns | Keys
*/
public static final String KEY_ROWID = "_id";
public static final String KEY_NAME = "name";
public static final String KEY_TEXT = "text";
public static final String[] ALL_COLUMNS = new String[] {
KEY_ROWID,
KEY_NAME,
KEY_TEXT
};
public static final String[] SEARCH_COLUMNS = new String[] {
KEY_ROWID,
KEY_NAME,
KEY_TEXT
};
public static final String[] RESULT_COLUMNS = new String[] {
KEY_NAME,
KEY_TEXT
};
/*
* DCL
*/
public static final String SQL_CREATE =
"CREATE TABLE IF NOT EXISTS " + DATABASE_TABLE + " (" +
KEY_ROWID + " INTEGER PRIMARY KEY AUTOINKREMENT, " +
KEY_NAME + " TEXT NOT NULL, " +
KEY_TEXT + " TEXT" +
");";
public static final String SQL_DROP =
"DROP TABLE IF EXISTS " + DATABASE_TABLE;
private static final String TAG = "DBAdapter";
private Context mContext;
private SQLiteDatabase mDb;
/* *************************************************************************
* copy prepopulated database from assets to phone
**************************************************************************/
/**
* DBAdapter extends SQLiteOpenHelper<br/>
* is the abstraction layer to manage the underlying SQLite Database<br/>
* the database schema and the operations are encapsulated in this class.
*
* @param context
*/
public DatabaseManager(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
this.mContext = context;
copyFile();
}
/**
* copy the prepopulated database from resources,
* if it does not exist on the phone
*/
private void copyFile() {
String destPath = "/data/data/" + mContext.getPackageName() + "/databases/" + DATABASE_NAME;
File f = new File(destPath);
try {
if (!f.exists()) {
// copy sqlite-DB from Assets to Phone
InputStream in = mContext.getAssets().open(DATABASE_NAME);
OutputStream out = new FileOutputStream(destPath);
// copy 1k bytes at a time
byte[] buffer = new byte[1024];
int length;
while ((length = in.read(buffer)) > 0) {
out.write(buffer, 0, length);
}
in.close();
out.close();
}
Log.d(TAG, "copy() file to " + destPath);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* read a text file
*
* FileInputStream fin = new FileInputStream(new File(directory, filename));
*
* @param in
* @return String with the file contents
* @throws IOException
*/
public static String readTextFile(FileInputStream in) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuilder sb = new StringBuilder();
String line;
try {
while ((line = reader.readLine()) != null) {
sb.append(line);
}
} finally {
reader.close();
}
return sb.toString();
}
/**
* write a text file
*
* @param out
* @param str
* @throws IOException
*/
public static void writeTextFile(FileOutputStream out, String str) throws IOException {
OutputStreamWriter writer = new OutputStreamWriter(out);
try {
writer.write(str);
} finally {
if (writer != null) {
writer.close();
}
}
}
/* *************************************************************************
* SQLiteOpenHelper
**************************************************************************/
@Override
public void onCreate(SQLiteDatabase db) {
// copy() or create ???
Log.d(TAG, "" + SQL_CREATE);
// CREATE
try {
db.execSQL(SQL_CREATE);
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.d(TAG, "Upgrading Database '" + DATABASE_NAME + "' from Version '" + oldVersion + "' to Version '" + newVersion + "'.");
// backup (export), modify, copy ...
// DROP
// db.execSQL(DBSchema.SQL_DROP);
// CREATE
// onCreate(db);
}
/**
* Opens the database with the name and version passed to the super constructor<br/>
* from the path "/data/data/<package_name>/databases/"
*
* @return this (method chaining)
*/
public DatabaseManager open() throws SQLException {
mDb = getWritableDatabase();
return this; // Method-Chaining, self reference
}
public void close() {
super.close();
}
/* *************************************************************************
* SQL-Statement Wrapper
**************************************************************************/
/**
*
* @param title
* @param text
* @return rowId or -1 if failed
*/
public long insertRecord(String title, String text) {
// INSERT INTO <table> VALUES (NULL, title, text);
ContentValues values = new ContentValues();
values.put(KEY_NAME, title);
values.put(KEY_TEXT, text);
return mDb.insert(DATABASE_TABLE, null, values);
}
public boolean updateRecord(long rowId, String title, String text) {
// UPDATE <table> SET <col> = <value> WHERE <condition>
ContentValues args = new ContentValues();
args.put(KEY_NAME, title);
args.put(KEY_TEXT, text);
return mDb.update(DATABASE_TABLE, args, KEY_ROWID + "=" + rowId, null) > 0;
}
public boolean deleteRecord(long rowId) {
// DELETE FROM <table> WHERE <condition>
return mDb.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0;
}
public Cursor fetchRecord(long rowId) {
Cursor c = mDb.query(true, DATABASE_TABLE,
new String[] {KEY_ROWID, KEY_NAME, KEY_TEXT},
KEY_ROWID + "=" + rowId,
null, null, null, null, null);
if (c != null) {
c.moveToFirst();
}
return c;
}
public Cursor fetchAllRecords() {
Cursor c = mDb.query(DATABASE_TABLE, SEARCH_COLUMNS, null, null, null, null, KEY_NAME);
return c;
}
}
| [
"TM@.(none)"
] | TM@.(none) |
e0a344db9265b45456c1539cfe6b9dc920eb1f59 | 68b4f732a07c7175b0851984397e4ac777bea3cc | /app/src/main/java/com/findingdata/oabank/entity/ProjectEntity.java | 06abc31b5e3a5ed5123f8964036b6375136bd3fe | [] | no_license | loong214/OABank | 4d50fd8f5f2474d41f47cf4021c26ad1f4da5218 | b4a1cc3209fda4a3b32bc6a181e0017dcde6c5d8 | refs/heads/master | 2020-09-12T01:07:39.249795 | 2020-02-20T13:53:31 | 2020-02-20T13:53:31 | 222,249,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,858 | java | package com.findingdata.oabank.entity;
import java.io.Serializable;
import java.util.List;
/**
* Created by Loong on 2019/11/26.
* Version: 1.0
* Describe: 项目实体
*/
public class ProjectEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* PROJECT_ID : 1562
* PROJECT_NAME : 北辰三角洲1栋101
* PROJECT_STATUS : 40001001
* PROJECT_STATUS_CHS : 进行中
* CONTACT_PERSON : 张三
* CONTACT_PHONE : 13112345678
* BCM_USER_ID : 1165
* BCM_NAME : 戚东卫
* BCM_PHONE : 15912345679
* LOAN_TYPE : 40047001
* LOAN_TYPE_CHS : 小微助业贷款
* LOAN_AMOUNT : 80
* BORROWER : 张三
* BORROWER_PHONE : 13112345678
* BORROWER_ID_CARD :
* REMARK :
* TERMINATION_REASON :
* CREATE_BY : 1165
* CREATE_NAME : 戚东卫
* CREATE_PHONE : 15912345679
* MODIFY_BY : 0
* MODIFY_NAME :
* CREATE_TIME : 2019-12-23T08:57:57
* IS_DELETED : 0
* CUSTOMER_ID : 863
* MODIFY_CUSTOMER_NAME : 湘江新区支行
* CUSTOMER_NAME : 湘江新区支行
* IS_QUICK_MODE :
* DISPATCH_CUSTOMER_ID : 862
* DISPATCH_CUSTOMER_NAME : 长沙分行
* DISPATCH_BY : 1164
* DISPATCH_NAME : 侯亮平
* DISPATCH_PHONE : 15187654321
* DISPATCH_TIME : 2019-12-23T17:59:05
* PROJECT_FORM_ID : 7066
* CONFIRM_TIME : 2019-12-23T09:23:28
* IS_AUTO_DISPATCH : 0
* IS_DRAFT : 0
* OWNER_CUSTOMER_ID : 862
* PROPERTY_LIST:[]
* BUSINESS:[]
* NOTE_LIST:[]
* ACT_LIST:[]
*/
private int PROJECT_ID;
private String PROJECT_NAME;
private int PROJECT_STATUS;
private String PROJECT_STATUS_CHS;
private String CONTACT_PERSON;
private String CONTACT_PHONE;
private int BCM_USER_ID;
private String BCM_NAME;
private String BCM_PHONE;
private int LOAN_TYPE;
private String LOAN_TYPE_CHS;
private int LOAN_AMOUNT;
private String BORROWER;
private String BORROWER_PHONE;
private String BORROWER_ID_CARD;
private String REMARK;
private String TERMINATION_REASON;
private int CREATE_BY;
private String CREATE_NAME;
private String CREATE_PHONE;
private int MODIFY_BY;
private String MODIFY_NAME;
private String CREATE_TIME;
private int IS_DELETED;
private int CUSTOMER_ID;
private String MODIFY_CUSTOMER_NAME;
private String CUSTOMER_NAME;
private String IS_QUICK_MODE;
private int DISPATCH_CUSTOMER_ID;
private String DISPATCH_CUSTOMER_NAME;
private int DISPATCH_BY;
private String DISPATCH_NAME;
private String DISPATCH_PHONE;
private String DISPATCH_TIME;
private int PROJECT_FORM_ID;
private String CONFIRM_TIME;
private int IS_AUTO_DISPATCH;
private int IS_DRAFT;
private int OWNER_CUSTOMER_ID;
private List<PropertyEntity> PROPERTY_LIST;
private ProjectBusinessEntity BUSINESS;
private List<ProjectNoteEntity> NOTE_LIST;
private List<ProjectActionEntity> ACT_LIST;
public int getPROJECT_ID() {
return PROJECT_ID;
}
public void setPROJECT_ID(int PROJECT_ID) {
this.PROJECT_ID = PROJECT_ID;
}
public String getPROJECT_NAME() {
return PROJECT_NAME;
}
public void setPROJECT_NAME(String PROJECT_NAME) {
this.PROJECT_NAME = PROJECT_NAME;
}
public int getPROJECT_STATUS() {
return PROJECT_STATUS;
}
public void setPROJECT_STATUS(int PROJECT_STATUS) {
this.PROJECT_STATUS = PROJECT_STATUS;
}
public String getPROJECT_STATUS_CHS() {
return PROJECT_STATUS_CHS;
}
public void setPROJECT_STATUS_CHS(String PROJECT_STATUS_CHS) {
this.PROJECT_STATUS_CHS = PROJECT_STATUS_CHS;
}
public String getCONTACT_PERSON() {
return CONTACT_PERSON;
}
public void setCONTACT_PERSON(String CONTACT_PERSON) {
this.CONTACT_PERSON = CONTACT_PERSON;
}
public String getCONTACT_PHONE() {
return CONTACT_PHONE;
}
public void setCONTACT_PHONE(String CONTACT_PHONE) {
this.CONTACT_PHONE = CONTACT_PHONE;
}
public int getBCM_USER_ID() {
return BCM_USER_ID;
}
public void setBCM_USER_ID(int BCM_USER_ID) {
this.BCM_USER_ID = BCM_USER_ID;
}
public String getBCM_NAME() {
return BCM_NAME;
}
public void setBCM_NAME(String BCM_NAME) {
this.BCM_NAME = BCM_NAME;
}
public String getBCM_PHONE() {
return BCM_PHONE;
}
public void setBCM_PHONE(String BCM_PHONE) {
this.BCM_PHONE = BCM_PHONE;
}
public int getLOAN_TYPE() {
return LOAN_TYPE;
}
public void setLOAN_TYPE(int LOAN_TYPE) {
this.LOAN_TYPE = LOAN_TYPE;
}
public String getLOAN_TYPE_CHS() {
return LOAN_TYPE_CHS;
}
public void setLOAN_TYPE_CHS(String LOAN_TYPE_CHS) {
this.LOAN_TYPE_CHS = LOAN_TYPE_CHS;
}
public int getLOAN_AMOUNT() {
return LOAN_AMOUNT;
}
public void setLOAN_AMOUNT(int LOAN_AMOUNT) {
this.LOAN_AMOUNT = LOAN_AMOUNT;
}
public String getBORROWER() {
return BORROWER;
}
public void setBORROWER(String BORROWER) {
this.BORROWER = BORROWER;
}
public String getBORROWER_PHONE() {
return BORROWER_PHONE;
}
public void setBORROWER_PHONE(String BORROWER_PHONE) {
this.BORROWER_PHONE = BORROWER_PHONE;
}
public String getBORROWER_ID_CARD() {
return BORROWER_ID_CARD;
}
public void setBORROWER_ID_CARD(String BORROWER_ID_CARD) {
this.BORROWER_ID_CARD = BORROWER_ID_CARD;
}
public String getREMARK() {
return REMARK;
}
public void setREMARK(String REMARK) {
this.REMARK = REMARK;
}
public String getTERMINATION_REASON() {
return TERMINATION_REASON;
}
public void setTERMINATION_REASON(String TERMINATION_REASON) {
this.TERMINATION_REASON = TERMINATION_REASON;
}
public int getCREATE_BY() {
return CREATE_BY;
}
public void setCREATE_BY(int CREATE_BY) {
this.CREATE_BY = CREATE_BY;
}
public String getCREATE_NAME() {
return CREATE_NAME;
}
public void setCREATE_NAME(String CREATE_NAME) {
this.CREATE_NAME = CREATE_NAME;
}
public String getCREATE_PHONE() {
return CREATE_PHONE;
}
public void setCREATE_PHONE(String CREATE_PHONE) {
this.CREATE_PHONE = CREATE_PHONE;
}
public int getMODIFY_BY() {
return MODIFY_BY;
}
public void setMODIFY_BY(int MODIFY_BY) {
this.MODIFY_BY = MODIFY_BY;
}
public String getMODIFY_NAME() {
return MODIFY_NAME;
}
public void setMODIFY_NAME(String MODIFY_NAME) {
this.MODIFY_NAME = MODIFY_NAME;
}
public String getCREATE_TIME() {
return CREATE_TIME;
}
public void setCREATE_TIME(String CREATE_TIME) {
this.CREATE_TIME = CREATE_TIME;
}
public int getIS_DELETED() {
return IS_DELETED;
}
public void setIS_DELETED(int IS_DELETED) {
this.IS_DELETED = IS_DELETED;
}
public int getCUSTOMER_ID() {
return CUSTOMER_ID;
}
public void setCUSTOMER_ID(int CUSTOMER_ID) {
this.CUSTOMER_ID = CUSTOMER_ID;
}
public String getMODIFY_CUSTOMER_NAME() {
return MODIFY_CUSTOMER_NAME;
}
public void setMODIFY_CUSTOMER_NAME(String MODIFY_CUSTOMER_NAME) {
this.MODIFY_CUSTOMER_NAME = MODIFY_CUSTOMER_NAME;
}
public String getCUSTOMER_NAME() {
return CUSTOMER_NAME;
}
public void setCUSTOMER_NAME(String CUSTOMER_NAME) {
this.CUSTOMER_NAME = CUSTOMER_NAME;
}
public String getIS_QUICK_MODE() {
return IS_QUICK_MODE;
}
public void setIS_QUICK_MODE(String IS_QUICK_MODE) {
this.IS_QUICK_MODE = IS_QUICK_MODE;
}
public int getDISPATCH_CUSTOMER_ID() {
return DISPATCH_CUSTOMER_ID;
}
public void setDISPATCH_CUSTOMER_ID(int DISPATCH_CUSTOMER_ID) {
this.DISPATCH_CUSTOMER_ID = DISPATCH_CUSTOMER_ID;
}
public String getDISPATCH_CUSTOMER_NAME() {
return DISPATCH_CUSTOMER_NAME;
}
public void setDISPATCH_CUSTOMER_NAME(String DISPATCH_CUSTOMER_NAME) {
this.DISPATCH_CUSTOMER_NAME = DISPATCH_CUSTOMER_NAME;
}
public int getDISPATCH_BY() {
return DISPATCH_BY;
}
public void setDISPATCH_BY(int DISPATCH_BY) {
this.DISPATCH_BY = DISPATCH_BY;
}
public String getDISPATCH_NAME() {
return DISPATCH_NAME;
}
public void setDISPATCH_NAME(String DISPATCH_NAME) {
this.DISPATCH_NAME = DISPATCH_NAME;
}
public String getDISPATCH_PHONE() {
return DISPATCH_PHONE;
}
public void setDISPATCH_PHONE(String DISPATCH_PHONE) {
this.DISPATCH_PHONE = DISPATCH_PHONE;
}
public String getDISPATCH_TIME() {
return DISPATCH_TIME;
}
public void setDISPATCH_TIME(String DISPATCH_TIME) {
this.DISPATCH_TIME = DISPATCH_TIME;
}
public int getPROJECT_FORM_ID() {
return PROJECT_FORM_ID;
}
public void setPROJECT_FORM_ID(int PROJECT_FORM_ID) {
this.PROJECT_FORM_ID = PROJECT_FORM_ID;
}
public String getCONFIRM_TIME() {
return CONFIRM_TIME;
}
public void setCONFIRM_TIME(String CONFIRM_TIME) {
this.CONFIRM_TIME = CONFIRM_TIME;
}
public int getIS_AUTO_DISPATCH() {
return IS_AUTO_DISPATCH;
}
public void setIS_AUTO_DISPATCH(int IS_AUTO_DISPATCH) {
this.IS_AUTO_DISPATCH = IS_AUTO_DISPATCH;
}
public int getIS_DRAFT() {
return IS_DRAFT;
}
public void setIS_DRAFT(int IS_DRAFT) {
this.IS_DRAFT = IS_DRAFT;
}
public int getOWNER_CUSTOMER_ID() {
return OWNER_CUSTOMER_ID;
}
public void setOWNER_CUSTOMER_ID(int OWNER_CUSTOMER_ID) {
this.OWNER_CUSTOMER_ID = OWNER_CUSTOMER_ID;
}
public List<PropertyEntity> getPROPERTY_LIST() {
return PROPERTY_LIST;
}
public void setPROPERTY_LIST(List<PropertyEntity> PROPERTY_LIST) {
this.PROPERTY_LIST = PROPERTY_LIST;
}
public ProjectBusinessEntity getBUSINESS() {
return BUSINESS;
}
public void setBUSINESS(ProjectBusinessEntity BUSINESS) {
this.BUSINESS = BUSINESS;
}
public List<ProjectNoteEntity> getNOTE_LIST() {
return NOTE_LIST;
}
public void setNOTE_LIST(List<ProjectNoteEntity> NOTE_LIST) {
this.NOTE_LIST = NOTE_LIST;
}
public List<ProjectActionEntity> getACT_LIST() {
return ACT_LIST;
}
public void setACT_LIST(List<ProjectActionEntity> ACT_LIST) {
this.ACT_LIST = ACT_LIST;
}
}
| [
"zengxiaolong430722@gmail.com"
] | zengxiaolong430722@gmail.com |
b96aaa13fd6ebaa82b9ec7b272ddb353d2928efc | a69de5320c43a2aba8b9fc6778eb3902f26c41e7 | /app/src/main/java/com/example/olskr/cplhm2/ui/MainActivity.java | 7ed6887d6261c3545d558d294a103c55553b254a | [] | no_license | OLskrain/CPLHM2 | 8ea41b4fbf9de2c412148a2703d60af56d782180 | b2965a963c6047975db0d6b0c8e7e2be91a32633 | refs/heads/master | 2020-04-17T01:45:40.747245 | 2019-01-22T19:07:36 | 2019-01-22T19:07:36 | 166,107,234 | 0 | 0 | null | 2019-01-16T21:38:26 | 2019-01-16T20:30:02 | Java | UTF-8 | Java | false | false | 1,274 | java | package com.example.olskr.cplhm2.ui;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.EditText;
import android.widget.TextView;
import com.arellomobile.mvp.MvpAppCompatActivity;
import com.arellomobile.mvp.presenter.InjectPresenter;
import com.example.olskr.cplhm2.R;
import com.example.olskr.cplhm2.mvp.presenter.MainPresenter;
import com.example.olskr.cplhm2.mvp.view.MainView;
import com.jakewharton.rxbinding3.widget.RxTextView;
import butterknife.BindView;
import butterknife.ButterKnife;
//решение с использование MVP
public class MainActivity extends MvpAppCompatActivity implements MainView {
@BindView(R.id.edit_text1)
EditText editText;
@BindView(R.id.text_view1)
TextView textView;
@InjectPresenter
MainPresenter presenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
RxTextView.textChanges(editText)
.subscribe(charSequence -> presenter.textChanged(charSequence.toString()));
}
@Override
public void setTextViewText(String text) {
textView.setText(text);
}
}
| [
"Olskrain2@yandex.ru"
] | Olskrain2@yandex.ru |
266410e34883280a169e4a0f514e3fb488a9c7c9 | 18327004f82dcf52ee41c3be51c4aa1bc8eea9fd | /app/src/main/java/com/example/panshippingandroid/fragments/AddProductFragment.java | f91d66fc2555cbbc8797e9a38539c291d9d6386f | [] | no_license | adrijanasavic/PanShippingAndroid | a4b48946e9c3726c55326d4461c77755d2e4ed24 | 7e27d839cce2c33375b1a2d78e49febd23675300 | refs/heads/main | 2023-07-19T22:54:17.663855 | 2021-09-03T19:20:29 | 2021-09-03T19:20:29 | 402,867,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,025 | java | package com.example.panshippingandroid.fragments;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import com.bumptech.glide.Glide;
import com.example.panshippingandroid.R;
import com.example.panshippingandroid.model.ProductDto;
import com.example.panshippingandroid.model.ProductModel;
import com.example.panshippingandroid.utils.ImageUtils;
import java.io.IOException;
import java.net.HttpURLConnection;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import static com.example.panshippingandroid.activities.LoginActivity.apiService;
import static com.example.panshippingandroid.utils.Const.AUTHENTICATION_FILE_NAME;
import static com.example.panshippingandroid.utils.Const.PICK_IMAGE;
import static com.example.panshippingandroid.utils.Const.SELECT_PICTURE;
import static com.example.panshippingandroid.utils.Const.USER_ID;
public class AddProductFragment extends Fragment {
private EditText addNameEt;
private EditText addPriceEt;
private EditText addQuantityEt;
private EditText addDescriptionEt;
private ImageView addImageIv;
private ImageView cancelIv;
private Button addProductBtn;
private boolean isAllFieldsChecked = false;
private SharedPreferences sharedPreferences;
private String image;
boolean isEdit;
private Long id;
public AddProductFragment() {
}
public static AddProductFragment newInstance() {
AddProductFragment fragment = new AddProductFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sharedPreferences = requireContext().getSharedPreferences(AUTHENTICATION_FILE_NAME, Context.MODE_PRIVATE);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_add_product, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
edit();
}
public void edit() {
if (getArguments() != null) {
isEdit = getArguments().getBoolean("isEdit");
id = getArguments().getLong("productId");
}
initUI();
if (isEdit) {
cancelIv.setVisibility(View.VISIBLE);
getProductCall(id);
addProductBtn.setText("Edit");
addImageIv.setOnClickListener(this::setImage);
addProductBtn.setOnClickListener(v -> {
if (isEdit) {
Long userID = sharedPreferences.getLong(USER_ID, 0);
addProductBtn.setText("Edit");
editProductCall(id, setEditProduct(userID));
}
});
} else {
addImageIv.setOnClickListener(this::setImage);
addProductBtn.setOnClickListener(v -> {
Long userID = sharedPreferences.getLong(USER_ID, 0);
addProductCall(setProduct(userID));
});
}
cancelIv.setOnClickListener(v -> {
Glide.with(requireContext())
.load(AppCompatResources.getDrawable(requireContext(), R.drawable.sale))
.override(400, 400)
.into(addImageIv)
.clearOnDetach();
cancelIv.setVisibility(View.GONE);
});
}
public void editProductCall(Long id, ProductModel product) {
Call<Void> call = apiService.editProduct(id, product);
call.enqueue(new Callback<Void>() {
@Override
public void onResponse(@NonNull Call<Void> call, @NonNull Response<Void> response) {
if (response.code() == HttpURLConnection.HTTP_OK || response.code() == HttpURLConnection.HTTP_CREATED) {
FragmentTransaction fragmentTransaction = getParentFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.container, ViewProductsFragment.newInstance());
fragmentTransaction.commit();
} else {
Toast.makeText(getActivity(), R.string.was_not_change_product, Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(@NonNull Call<Void> call, @NonNull Throwable t) {
call.cancel();
}
});
}
private ProductModel setProduct(Long userID) {
isAllFieldsChecked = CheckAllFields();
ProductModel productModel = new ProductModel();
if (isAllFieldsChecked) {
productModel.setId(id);
productModel.setName(addNameEt.getText().toString());
productModel.setPrice(Double.parseDouble(addPriceEt.getText().toString()));
productModel.setQuantity(Integer.parseInt(addQuantityEt.getText().toString()));
productModel.setDescription(addDescriptionEt.getText().toString());
productModel.setUser(userID);
Bitmap bitmap = ((BitmapDrawable) addImageIv.getDrawable()).getBitmap();
image = ImageUtils.convertBitmapToStringImage(bitmap);
productModel.setImage(image);
}
return productModel;
}
private ProductModel setEditProduct(Long userID) {
isAllFieldsChecked = CheckAllFields();
ProductModel productModel = new ProductModel();
if (isAllFieldsChecked) {
productModel.setId(id);
productModel.setName(addNameEt.getText().toString());
productModel.setPrice(Double.parseDouble(addPriceEt.getText().toString()));
productModel.setQuantity(Integer.parseInt(addQuantityEt.getText().toString()));
productModel.setDescription(addDescriptionEt.getText().toString());
productModel.setUser(userID);
Bitmap bitmap = ((BitmapDrawable) addImageIv.getDrawable()).getBitmap();
image = ImageUtils.convertBitmapToStringImage(bitmap);
productModel.setImage(image);
if (Boolean.getBoolean("ordered")) {
productModel.setOrdered(false);
} else {
productModel.setOrdered(true);
}
}
return productModel;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_IMAGE && resultCode == Activity.RESULT_OK) {
Uri pictureUri = data.getData();
Bitmap bitmap = null;
try {
bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), pictureUri);
} catch (NullPointerException | IOException n) {
n.printStackTrace();
}
Bitmap productImage = null;
if (bitmap != null) {
productImage = ImageUtils.getResizedBitmap(bitmap, 400);
}
if (productImage != null) {
image = ImageUtils.convertBitmapToStringImage(productImage);
}
Glide.with(this)
.load(productImage)
.error(R.drawable.ic_add)
.override(400, 400)
.into(addImageIv);
}
}
private void initUI() {
addNameEt = requireView().findViewById(R.id.et_name);
addPriceEt = requireView().findViewById(R.id.et_price);
addQuantityEt = requireView().findViewById(R.id.et_quantity);
addDescriptionEt = requireView().findViewById(R.id.et_description);
addImageIv = requireView().findViewById(R.id.iv_addImage);
addProductBtn = requireView().findViewById(R.id.btn_addProduct);
cancelIv = requireView().findViewById(R.id.iv_cancel);
}
private boolean CheckAllFields() {
if (addNameEt.getText().toString().length() == 0) {
addNameEt.setError(getString(R.string.field_is_required));
return false;
}
if (addPriceEt.getText().toString().length() == 0) {
addPriceEt.setError(getString(R.string.field_is_required));
return false;
}
if (addQuantityEt.getText().toString().length() == 0) {
addQuantityEt.setError(getString(R.string.field_is_required));
return false;
}
if (addDescriptionEt.getText().toString().length() == 0) {
addDescriptionEt.setError(getString(R.string.field_is_required));
return false;
} else if (addImageIv == null) {
Toast.makeText(getActivity(), R.string.select_image, Toast.LENGTH_SHORT).show();
return false;
}
return true;
}
public void getProductCall(Long id) {
Call<ProductDto> call = apiService.getProduct(id);
call.enqueue(new Callback<ProductDto>() {
@Override
public void onResponse(@NonNull Call<ProductDto> call, @NonNull Response<ProductDto> response) {
if (response.code() == HttpURLConnection.HTTP_OK) {
ProductDto product = response.body();
if (product != null) {
addNameEt.setText(product.getName());
addPriceEt.setText(String.valueOf(product.getPrice()));
addQuantityEt.setText(String.valueOf(product.getQuantity()));
addDescriptionEt.setText(product.getDescription());
}
if (product != null) {
if (product.getImage() != null) {
Glide.with(requireContext())
.load(ImageUtils.convertStringImageToBitmap(product.getImage()))
.override(400, 400)
.into(addImageIv);
} else {
Glide.with(requireContext())
.load(AppCompatResources.getDrawable(requireContext(), R.drawable.sale))
.override(400, 400)
.into(addImageIv);
}
}
} else {
Toast.makeText(getActivity(), R.string.was_not_added_product, Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(@NonNull Call<ProductDto> call, @NonNull Throwable t) {
call.cancel();
}
});
}
public void addProductCall(ProductModel productModel) {
addProductBtn.setEnabled(false);
Call<Void> call = apiService.addProduct(productModel);
call.enqueue(new Callback<Void>() {
@Override
public void onResponse(@NonNull Call<Void> call, @NonNull Response<Void> response) {
if (response.code() == HttpURLConnection.HTTP_CREATED) {
Toast.makeText(getActivity(), R.string.successfully_added_product, Toast.LENGTH_SHORT).show();
FragmentTransaction fragmentTransaction = getParentFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.container, ViewProductsFragment.newInstance());
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
addProductBtn.setEnabled(true);
} else {
Toast.makeText(getActivity(), R.string.was_not_added_product, Toast.LENGTH_SHORT).show();
addProductBtn.setEnabled(true);
}
}
@Override
public void onFailure(@NonNull Call<Void> call, @NonNull Throwable t) {
call.cancel();
}
});
}
private void setImage(View v) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,
"Select Picture"), SELECT_PICTURE);
}
} | [
"adrijana.jovicic@gmail.com"
] | adrijana.jovicic@gmail.com |
28a32c7a766bb76511cd1c98c47ca1851f31c582 | c153a815c705af093ec9a0a27e12e476c4e259d8 | /comparable/Student1.java | 057a3de691c77f8886433f69e6379a31811449c9 | [] | no_license | kv1402/SchoolStuff | 383166bb7cc759ec26e3411bce46f8e756d72136 | 4c270311c5499e8f4c843262733feaa3bcfa0bbb | refs/heads/master | 2021-08-22T09:38:07.388687 | 2017-11-29T22:04:22 | 2017-11-29T22:04:22 | 112,530,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package Comparable;
public class Student1 implements Comparable<Student1>{
int rollno;
String name;
int age;
public Student1(int rollno, String name, int age){
this.rollno = rollno;
this.name = name;
this.age = age;
}
@Override
public int compareTo(Student1 o) {
if(this.age == o.age){
return 0;
}else if(this.age > o.age){
return 1;
}else {
return -1;
}
}
}
| [
"kieuvanbuithi@hotmail.com"
] | kieuvanbuithi@hotmail.com |
dff0f9bdfcc0cbbad521b97b0efcb61c24e957d4 | 34f8d4ba30242a7045c689768c3472b7af80909c | /jdk-12/src/jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotSafepointOp.java | f30148a91feba3307e18c93806010480744afc5b | [
"Apache-2.0"
] | permissive | lovelycheng/JDK | 5b4cc07546f0dbfad15c46d427cae06ef282ef79 | 19a6c71e52f3ecd74e4a66be5d0d552ce7175531 | refs/heads/master | 2023-04-08T11:36:22.073953 | 2022-09-04T01:53:09 | 2022-09-04T01:53:09 | 227,544,567 | 0 | 0 | null | 2019-12-12T07:18:30 | 2019-12-12T07:18:29 | null | UTF-8 | Java | false | false | 6,470 | java | /*
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.graalvm.compiler.hotspot.amd64;
import static org.graalvm.compiler.core.common.NumUtil.isInt;
import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
import static org.graalvm.compiler.core.common.GraalOptions.ImmutableCode;
import static jdk.vm.ci.amd64.AMD64.rax;
import static jdk.vm.ci.amd64.AMD64.rip;
import org.graalvm.compiler.asm.amd64.AMD64Address;
import org.graalvm.compiler.asm.amd64.AMD64MacroAssembler;
import org.graalvm.compiler.core.common.LIRKind;
import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
import org.graalvm.compiler.lir.LIRFrameState;
import org.graalvm.compiler.lir.LIRInstructionClass;
import org.graalvm.compiler.lir.Opcode;
import org.graalvm.compiler.lir.amd64.AMD64LIRInstruction;
import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.RegisterValue;
import jdk.vm.ci.code.site.InfopointReason;
import jdk.vm.ci.meta.AllocatableValue;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.Value;
/**
* Emits a safepoint poll.
*/
@Opcode("SAFEPOINT")
public final class AMD64HotSpotSafepointOp extends AMD64LIRInstruction {
public static final LIRInstructionClass<AMD64HotSpotSafepointOp> TYPE = LIRInstructionClass.create(AMD64HotSpotSafepointOp.class);
@State protected LIRFrameState state;
@Temp({OperandFlag.REG, OperandFlag.ILLEGAL}) private AllocatableValue temp;
private final GraalHotSpotVMConfig config;
private final Register thread;
public AMD64HotSpotSafepointOp(LIRFrameState state, GraalHotSpotVMConfig config, NodeLIRBuilderTool tool, Register thread) {
super(TYPE);
this.state = state;
this.config = config;
this.thread = thread;
if (config.threadLocalHandshakes || isPollingPageFar(config) || ImmutableCode.getValue(tool.getOptions())) {
temp = tool.getLIRGeneratorTool().newVariable(LIRKind.value(tool.getLIRGeneratorTool().target().arch.getWordKind()));
} else {
// Don't waste a register if it's unneeded
temp = Value.ILLEGAL;
}
}
@Override
public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler asm) {
emitCode(crb, asm, config, false, state, thread, temp instanceof RegisterValue ? ((RegisterValue) temp).getRegister() : null);
}
public static void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler asm, GraalHotSpotVMConfig config, boolean atReturn, LIRFrameState state, Register thread, Register scratch) {
if (config.threadLocalHandshakes) {
emitThreadLocalPoll(crb, asm, config, atReturn, state, thread, scratch);
} else {
emitGlobalPoll(crb, asm, config, atReturn, state, scratch);
}
}
/**
* Tests if the polling page address can be reached from the code cache with 32-bit
* displacements.
*/
private static boolean isPollingPageFar(GraalHotSpotVMConfig config) {
final long pollingPageAddress = config.safepointPollingAddress;
return config.forceUnreachable || !isInt(pollingPageAddress - config.codeCacheLowBound) || !isInt(pollingPageAddress - config.codeCacheHighBound);
}
private static void emitGlobalPoll(CompilationResultBuilder crb, AMD64MacroAssembler asm, GraalHotSpotVMConfig config, boolean atReturn, LIRFrameState state, Register scratch) {
assert !atReturn || state == null : "state is unneeded at return";
if (ImmutableCode.getValue(crb.getOptions())) {
JavaKind hostWordKind = JavaKind.Long;
int alignment = hostWordKind.getBitCount() / Byte.SIZE;
JavaConstant pollingPageAddress = JavaConstant.forIntegerKind(hostWordKind, config.safepointPollingAddress);
// This move will be patched to load the safepoint page from a data segment
// co-located with the immutable code.
if (GeneratePIC.getValue(crb.getOptions())) {
asm.movq(scratch, asm.getPlaceholder(-1));
} else {
asm.movq(scratch, (AMD64Address) crb.recordDataReferenceInCode(pollingPageAddress, alignment));
}
final int pos = asm.position();
crb.recordMark(atReturn ? config.MARKID_POLL_RETURN_FAR : config.MARKID_POLL_FAR);
if (state != null) {
crb.recordInfopoint(pos, state, InfopointReason.SAFEPOINT);
}
asm.testl(rax, new AMD64Address(scratch));
} else if (isPollingPageFar(config)) {
asm.movq(scratch, config.safepointPollingAddress);
crb.recordMark(atReturn ? config.MARKID_POLL_RETURN_FAR : config.MARKID_POLL_FAR);
final int pos = asm.position();
if (state != null) {
crb.recordInfopoint(pos, state, InfopointReason.SAFEPOINT);
}
asm.testl(rax, new AMD64Address(scratch));
} else {
crb.recordMark(atReturn ? config.MARKID_POLL_RETURN_NEAR : config.MARKID_POLL_NEAR);
final int pos = asm.position();
if (state != null) {
crb.recordInfopoint(pos, state, InfopointReason.SAFEPOINT);
}
// The C++ code transforms the polling page offset into an RIP displacement
// to the real address at that offset in the polling page.
asm.testl(rax, new AMD64Address(rip, 0));
}
}
private static void emitThreadLocalPoll(CompilationResultBuilder crb, AMD64MacroAssembler asm, GraalHotSpotVMConfig config, boolean atReturn, LIRFrameState state, Register thread,
Register scratch) {
assert !atReturn || state == null : "state is unneeded at return";
assert config.threadPollingPageOffset >= 0;
asm.movptr(scratch, new AMD64Address(thread, config.threadPollingPageOffset));
crb.recordMark(atReturn ? config.MARKID_POLL_RETURN_FAR : config.MARKID_POLL_FAR);
final int pos = asm.position();
if (state != null) {
crb.recordInfopoint(pos, state, InfopointReason.SAFEPOINT);
}
asm.testl(rax, new AMD64Address(scratch));
}
}
| [
"zeng255@163.com"
] | zeng255@163.com |
05f743177ab81877ba47b4e529a0cd32b89acc28 | 85cbcdb2486034bf67ce0514a24bc59f75d97855 | /src/main/java/com/dk/app/config/AsyncConfiguration.java | 938d631222375e71769b6706d4e04d74979e919d | [] | no_license | nickbarban/dc-5 | c0d82684abe3f5e3a5a3d34a3db1c24ba35e8b72 | c9da64a8fc098e86ffe0b9214afa1afb0ef8dbc2 | refs/heads/master | 2023-05-04T13:23:29.003807 | 2016-12-21T13:52:06 | 2016-12-21T13:52:06 | 77,055,317 | 0 | 1 | null | 2023-04-17T19:00:41 | 2016-12-21T13:47:59 | Java | UTF-8 | Java | false | false | 1,616 | java | package com.dk.app.config;
import com.dk.app.async.ExceptionHandlingAsyncTaskExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.*;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import javax.inject.Inject;
@Configuration
@EnableAsync
@EnableScheduling
public class AsyncConfiguration implements AsyncConfigurer {
private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class);
@Inject
private JHipsterProperties jHipsterProperties;
@Override
@Bean(name = "taskExecutor")
public Executor getAsyncExecutor() {
log.debug("Creating Async Task Executor");
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(jHipsterProperties.getAsync().getCorePoolSize());
executor.setMaxPoolSize(jHipsterProperties.getAsync().getMaxPoolSize());
executor.setQueueCapacity(jHipsterProperties.getAsync().getQueueCapacity());
executor.setThreadNamePrefix("dancekvartal-Executor-");
return new ExceptionHandlingAsyncTaskExecutor(executor);
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return new SimpleAsyncUncaughtExceptionHandler();
}
}
| [
"nbarban@millhouse.com"
] | nbarban@millhouse.com |
981e692a885f2a3a3d4fa43a41e061e460d9c2f9 | 1f4f0867fafe5b3cbe165061b98b341fc5d0fe0c | /app/src/main/java/me/nickcruz/jsonpokemon/api/GetPokemonEndpoint.java | 0719bc4956f21847349f1551ecb210e9b6ddce18 | [] | no_license | nickcruz/json-pokemon-list | 891e114962b366ef3bc86d48c9065a09f91ca3b8 | 6194122e9157fbee5b7d3381ab42e97bcf522047 | refs/heads/master | 2020-07-26T03:26:15.505306 | 2019-09-15T19:27:56 | 2019-09-15T19:27:56 | 208,519,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,242 | java | package me.nickcruz.jsonpokemon.api;
import android.util.Log;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import me.nickcruz.jsonpokemon.PokemonModel;
import me.nickcruz.jsonpokemon.repository.ErrorHandler;
public class GetPokemonEndpoint {
private static final String TAG = GetPokemonEndpoint.class.getSimpleName();
private static final String PATH = "pokemon/";
public Request<String> getPokemon(final GetPokemonResponseHandler getPokemonResponseHandler) {
return new StringRequest(Request.Method.GET, getURL(), new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
getPokemonResponseHandler.onGetPokemonResponse(parseResponse(response));
} catch (JSONException e) {
Log.e(TAG, e.getMessage(), e);
getPokemonResponseHandler.onError(e.getMessage());
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
getPokemonResponseHandler.onError(error.getMessage());
}
});
}
public List<PokemonModel> parseResponse(String response) throws JSONException {
List<PokemonModel> pokemon = new ArrayList<>();
JSONObject jsonObject = new JSONObject(response);
JSONArray results = jsonObject.getJSONArray("results");
for (int i = 0; i < results.length(); ++i) {
JSONObject result = (JSONObject) results.get(i);
String name = result.getString("name");
String url = result.getString("url");
pokemon.add(new PokemonModel(name, url));
}
return pokemon;
}
private String getURL() {
return PokemonAPI.API_BASE + PATH;
}
public interface GetPokemonResponseHandler extends ErrorHandler {
void onGetPokemonResponse(List<PokemonModel> pokemon);
}
}
| [
"ncruz@umich.edu"
] | ncruz@umich.edu |
e21f2dd5d98492b5826a354ebeaf6e26d54ecca5 | acdcbd5efe554791742c5226334b3b87a8ef54ca | /java-code/expense-business/src/main/java/bht/expense/business/enterprise/strategy/controller/StrategyController.java | b7cb761164b5ba98c0a7e2f04067fd0c499a8e93 | [] | no_license | helilangyan/expense | 9484515d5bbbab9ea9c8328b2e1db2a086597952 | 9cc5e0edf76b7c7e8dc943f984ea5a8cd58d6269 | refs/heads/main | 2023-06-27T12:57:59.738879 | 2021-07-22T17:58:52 | 2021-07-22T17:58:52 | 388,550,452 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,797 | java | package bht.expense.business.enterprise.strategy.controller;
import bht.expense.business.common.ResultDto;
import bht.expense.business.enterprise.strategy.detail.label.dto.StrategyLabelEntityDto;
import bht.expense.business.enterprise.strategy.dto.StrategyEntityDto;
import bht.expense.business.enterprise.strategy.service.StrategyService;
import bht.expense.business.security.entity.UserEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author 姚轶文
* @date 2021/6/25 15:17
*/
@Api(tags = "费用策略")
@RestController
@RequestMapping("enterprise/strategy")
public class StrategyController {
@Autowired
StrategyService strategyService;
@ApiOperation("列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "第几页", required = true),
@ApiImplicitParam(name = "limit", value = "每页多少条记录", required = true),
@ApiImplicitParam(name = "enterpriseId", value = "企业ID", required = true)
})
@PostMapping("/list")
public ResultDto list(int page, int limit , Long enterpriseId)
{
return strategyService.list(page, limit, enterpriseId);
}
@ApiOperation("根据ID查询")
@ApiImplicitParam(name = "id", value = "id", required = true)
@GetMapping("/{id}")
public ResultDto findById(@PathVariable Long id)
{
return strategyService.findById(id);
}
@ApiOperation("插入,新增或修改,根据ID自动判断")
@PostMapping("/insert")
public ResultDto insert(@RequestBody StrategyEntityDto strategyEntityDto) {
return strategyService.insert(strategyEntityDto);
}
@ApiOperation("根据ID删除")
@ApiImplicitParam(name = "id", value = "ID", required = true)
@DeleteMapping("/del/{id}")
public ResultDto delete(@PathVariable Long id) {
return strategyService.delete(id);
}
@ApiOperation("批量删除,传入ID数组")
@DeleteMapping("/dels/{id}")
public ResultDto deletes(@PathVariable Long[] id) {
return strategyService.deletes(id);
}
@ApiOperation("查询用户匹配的策略费用分类")
@ApiImplicitParam(name = "enterpriseId", value = "企业ID", required = true)
@PostMapping("/user-classify")
public ResultDto findUserClassify(Long enterpriseId)
{
UserEntity userEntity = (UserEntity) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
return strategyService.findUserClassify(Long.parseLong(userEntity.getId()), enterpriseId);
}
@ApiOperation("查询用户匹配的标签分类")
@ApiImplicitParam(name = "enterpriseId", value = "企业ID", required = true)
@PostMapping("/user-label")
public ResultDto findUserLabel(Long enterpriseId)
{
UserEntity userEntity = (UserEntity) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
return strategyService.findUserLabel(Long.parseLong(userEntity.getId()), enterpriseId);
}
@ApiOperation("查询用户匹配的交通工具分类")
@ApiImplicitParam(name = "enterpriseId", value = "企业ID", required = true)
@PostMapping("/user-vehicle")
public ResultDto findUserVehicle(Long enterpriseId)
{
UserEntity userEntity = (UserEntity) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
return strategyService.findUserVehicle(Long.parseLong(userEntity.getId()), enterpriseId);
}
}
| [
"helilangyan@outlook.com"
] | helilangyan@outlook.com |
8d6bb907265669080c2e7864e562a4a3915824c1 | 452190483e4c29fcebe7fce2d8a6e176fcf74d65 | /app/src/main/java/com/me/gc/scratcher1/ScratchImageView.java | 72c491a2fe7d466112fd349c92d61b4b86dc9f7a | [] | no_license | gilbertchoy/scratcher1 | 56ec3a25b024f7be9112e783d836aa9bb50de458 | 11776845988cf9d9d7e437a40a67f6021fd6208c | refs/heads/master | 2021-09-26T03:03:50.124352 | 2018-10-27T00:48:35 | 2018-10-27T00:48:35 | 137,509,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,224 | java | /**
*
* Copyright 2016 Harish Sridharan
* 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.me.gc.scratcher1;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.ImageView;
/**
* Created by Harish on 25/03/16.
*/
public class ScratchImageView extends ImageView {
public interface IRevealListener {
public void onRevealed(ScratchImageView iv);
public void onRevealPercentChangedListener(ScratchImageView siv, float percent);
}
public static final float STROKE_WIDTH = 20f;
private float mX, mY;
private static final float TOUCH_TOLERANCE = 4;
/**
* Bitmap holding the scratch region.
*/
private Bitmap mScratchBitmap;
/**
* Drawable canvas area through which the scratchable area is drawn.
*/
private Canvas mCanvas;
/**
* Path holding the erasing path done by the user.
*/
private Path mErasePath;
/**
* Path to indicate where the user have touched.
*/
private Path mTouchPath;
/**
* Paint properties for drawing the scratch area.
*/
private Paint mBitmapPaint;
/**
* Paint properties for erasing the scratch region.
*/
private Paint mErasePaint;
/**
* Gradient paint properties that lies as a background for scratch region.
*/
private Paint mGradientBgPaint;
/**
* Sample Drawable bitmap having the scratch pattern.
*/
private BitmapDrawable mDrawable;
/**
* Listener object callback reference to send back the callback when the image has been revealed.
*/
private IRevealListener mRevealListener;
/**
* Reveal percent value.
*/
private float mRevealPercent;
/**
* Thread Count
*/
private int mThreadCount = 0;
public ScratchImageView(Context context) {
super(context);
init();
}
public ScratchImageView(Context context, AttributeSet set) {
super(context, set);
init();
}
public ScratchImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
/**
* Set the strokes width based on the parameter multiplier.
* @param multiplier can be 1,2,3 and so on to set the stroke width of the paint.
*/
public void setStrokeWidth(int multiplier) {
mErasePaint.setStrokeWidth(multiplier * STROKE_WIDTH);
}
/**
* Initialises the paint drawing elements.
*/
private void init() {
mTouchPath = new Path();
mErasePaint = new Paint();
mErasePaint.setAntiAlias(true);
mErasePaint.setDither(true);
//mErasePaint.setColor(0xFFFF0000);
mErasePaint.setColor(0xff0000ff);
mErasePaint.setStyle(Paint.Style.STROKE);
mErasePaint.setStrokeJoin(Paint.Join.BEVEL);
mErasePaint.setStrokeCap(Paint.Cap.ROUND);
setStrokeWidth(6);
mGradientBgPaint = new Paint();
mErasePath = new Path();
mBitmapPaint = new Paint(Paint.DITHER_FLAG);
//Bitmap scratchBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_scratch_pattern);
//bert change overlay image here
Bitmap scratchBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.greypattern);
mDrawable = new BitmapDrawable(getResources(), scratchBitmap);
mDrawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
setEraserMode();
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mScratchBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mScratchBitmap);
Rect rect = new Rect(0, 0, mScratchBitmap.getWidth(), mScratchBitmap.getHeight());
mDrawable.setBounds(rect);
int startGradientColor = ContextCompat.getColor(getContext(), R.color.scratch_start_gradient);
int endGradientColor = ContextCompat.getColor(getContext(), R.color.scratch_end_gradient);
mGradientBgPaint.setShader(new LinearGradient(0, 0, 0, getHeight(), startGradientColor, endGradientColor, Shader.TileMode.MIRROR));
mCanvas.drawRect(rect, mGradientBgPaint);
mDrawable.draw(mCanvas);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawBitmap(mScratchBitmap, 0, 0, mBitmapPaint);
canvas.drawPath(mErasePath, mErasePaint);
}
private void touch_start(float x, float y) {
mErasePath.reset();
mErasePath.moveTo(x, y);
mX = x;
mY = y;
}
/**
* clears the scratch area to reveal the hidden image.
*/
public void clear() {
int[] bounds = getImageBounds();
int left = bounds[0];
int top = bounds[1];
int right = bounds[2];
int bottom = bounds[3];
int width = right - left;
int height = bottom - top;
int centerX = left + width / 2;
int centerY = top + height / 2;
left = centerX - width / 2;
top = centerY - height / 2;
right = left + width;
bottom = top + height;
Paint paint = new Paint();
paint.setXfermode(new PorterDuffXfermode(
PorterDuff.Mode.CLEAR));
mCanvas.drawRect(left, top, right, bottom, paint);
checkRevealed();
invalidate();
}
private void touch_move(float x, float y) {
float dx = Math.abs(x - mX);
float dy = Math.abs(y - mY);
if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
mErasePath.quadTo(mX, mY, (x + mX) / 2, (y + mY) / 2);
mX = x;
mY = y;
drawPath();
}
mTouchPath.reset();
mTouchPath.addCircle(mX, mY, 30, Path.Direction.CW);
}
private void drawPath() {
mErasePath.lineTo(mX, mY);
// commit the path to our offscreen
mCanvas.drawPath(mErasePath, mErasePaint);
// kill this so we don't double draw
mTouchPath.reset();
mErasePath.reset();
mErasePath.moveTo(mX, mY);
checkRevealed();
}
public void reveal() {
clear();
}
private void touch_up() {
drawPath();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
float x = event.getX();
float y = event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
touch_start(x, y);
invalidate();
break;
case MotionEvent.ACTION_MOVE:
touch_move(x, y);
invalidate();
break;
case MotionEvent.ACTION_UP:
touch_up();
invalidate();
break;
default:
break;
}
return true;
}
public int getColor() {
return mErasePaint.getColor();
}
public Paint getErasePaint() {
return mErasePaint;
}
public void setEraserMode() {
getErasePaint().setXfermode(new PorterDuffXfermode(
PorterDuff.Mode.CLEAR));
}
public void setRevealListener(IRevealListener listener) {
this.mRevealListener = listener;
}
public boolean isRevealed() {
return mRevealPercent == 1;
}
private void checkRevealed() {
if(! isRevealed() && mRevealListener != null) {
int[] bounds = getImageBounds();
int left = bounds[0];
int top = bounds[1];
int width = bounds[2] - left;
int height = bounds[3] - top;
// Do not create multiple calls to compare.
if(mThreadCount > 1) {
Log.d("Captcha", "Count greater than 1");
return;
}
mThreadCount++;
new AsyncTask<Integer, Void, Float>() {
@Override
protected Float doInBackground(Integer... params) {
try {
int left = params[0];
int top = params[1];
int width = params[2];
int height = params[3];
Bitmap croppedBitmap = Bitmap.createBitmap(mScratchBitmap, left, top, width, height);
return BitmapUtils.getTransparentPixelPercent(croppedBitmap);
} finally {
mThreadCount--;
}
}
public void onPostExecute(Float percentRevealed) {
// check if not revealed before.
if( ! isRevealed()) {
float oldValue = mRevealPercent;
mRevealPercent = percentRevealed;
if(oldValue != percentRevealed) {
mRevealListener.onRevealPercentChangedListener(ScratchImageView.this, percentRevealed);
}
// if now revealed.
if( isRevealed()) {
mRevealListener.onRevealed(ScratchImageView.this);
}
}
}
}.execute(left, top, width, height);
}
}
public int[] getImageBounds() {
int paddingLeft = getPaddingLeft();
int paddingTop = getPaddingTop();
int paddingRight = getPaddingRight();
int paddingBottom = getPaddingBottom();
int vwidth = getWidth() - paddingLeft - paddingRight;
int vheight = getHeight() - paddingBottom - paddingTop;
int centerX = vwidth/2;
int centerY = vheight/2;
Drawable drawable = getDrawable();
Rect bounds = drawable.getBounds();
int width = drawable.getIntrinsicWidth();
int height = drawable.getIntrinsicHeight();
if(width <= 0) {
width = bounds.right - bounds.left;
}
if(height <= 0) {
height = bounds.bottom - bounds.top;
}
int left;
int top;
if(height > vheight) {
height = vheight;
}
if(width > vwidth) {
width = vwidth;
}
ScaleType scaleType = getScaleType();
switch (scaleType) {
case FIT_START:
left = paddingLeft;
top = centerY - height / 2;
break;
case FIT_END:
left = vwidth - paddingRight - width;
top = centerY - height / 2;
break;
case CENTER:
left = centerX - width / 2;
top = centerY - height / 2;
break;
default:
left = paddingLeft;
top = paddingTop;
width = vwidth;
height = vheight;
break;
}
return new int[] {left, top, left + width, top + height};
}
}
| [
"gilbertchoy@gmail.com"
] | gilbertchoy@gmail.com |
23be57007caa84fff669816453dfa453a36e37f1 | cd21cf05a0dd6688f71f821ae3c0490d0d46bd31 | /app/src/main/java/com/example/dedan/digitalreceipts/Database/Month_Database/February/FebEntity.java | 52f24dc5f5a7e150d201bfc63d8d556edff6671b | [] | no_license | ndungudedan/DigitalReceipts2 | 140401a67a5d4d801370ea5f19df6d221a276b5c | eadddc1224e602d4763297ad9d9721a681c4e28e | refs/heads/master | 2020-04-26T07:26:39.138083 | 2020-03-16T23:47:50 | 2020-03-16T23:47:50 | 173,394,331 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,715 | java | package com.example.dedan.digitalreceipts.Database.Month_Database.February;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
@Entity(tableName = "February")
public class FebEntity {
@PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "ID")
private int KEY_ID;
@ColumnInfo(name = "SALES")
private int KEY_SALES;
@ColumnInfo(name = "No_of_Clients")
private int KEY_NO_OF_CLIENTS;
@ColumnInfo(name = "FOREIGN_KEY")
private String KEY_FOREIGN_KEY;
@ColumnInfo(name = "IDENTIFY")
private String KEY_TYPE;
public FebEntity(int KEY_SALES, int KEY_NO_OF_CLIENTS, String KEY_FOREIGN_KEY, String KEY_TYPE) {
this.KEY_SALES = KEY_SALES;
this.KEY_NO_OF_CLIENTS = KEY_NO_OF_CLIENTS;
this.KEY_FOREIGN_KEY = KEY_FOREIGN_KEY;
this.KEY_TYPE = KEY_TYPE;
}
public int getKEY_ID() {
return KEY_ID;
}
public void setKEY_ID(int KEY_ID) {
this.KEY_ID = KEY_ID;
}
public int getKEY_SALES() {
return KEY_SALES;
}
public void setKEY_SALES(int KEY_SALES) {
this.KEY_SALES = KEY_SALES;
}
public int getKEY_NO_OF_CLIENTS() {
return KEY_NO_OF_CLIENTS;
}
public void setKEY_NO_OF_CLIENTS(int KEY_NO_OF_CLIENTS) {
this.KEY_NO_OF_CLIENTS = KEY_NO_OF_CLIENTS;
}
public String getKEY_FOREIGN_KEY() {
return KEY_FOREIGN_KEY;
}
public void setKEY_FOREIGN_KEY(String KEY_FOREIGN_KEY) {
this.KEY_FOREIGN_KEY = KEY_FOREIGN_KEY;
}
public String getKEY_TYPE() {
return KEY_TYPE;
}
public void setKEY_TYPE(String KEY_TYPE) {
this.KEY_TYPE = KEY_TYPE;
}
}
| [
"dnkibere@gmail.com"
] | dnkibere@gmail.com |
d1c6ac31672a1a6c8cf697ddc2953348a040847a | c43c8158179c982606c142565fe10cdbe051e9f3 | /src/kr/ac/kookmin/cs/bigdata/pkh/WordCountForAsin.java | a5f7eccee90f26e9d0595064f00a45988cf5b6dd | [] | no_license | kmucs-web-client-2017-01/kmucs-bigdata-project-bus-team | a4089b846ad2629ef0503cb014759e8ca01eae19 | 433ef729a934a6adc9f3566a38e10201f48b03c8 | refs/heads/master | 2021-03-19T10:52:13.941320 | 2017-06-05T14:50:21 | 2017-06-05T14:50:21 | 91,996,078 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,228 | java | package kr.ac.kookmin.cs.bigdata.pkh;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import kr.ac.kookmin.cs.bigdata.pkh.WordCount.WordCountMapper;
import kr.ac.kookmin.cs.bigdata.pkh.WordCount.WordCountReducer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.Reducer.Context;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
import org.apache.hadoop.util.Tool;
import org.json.JSONException;
import org.json.JSONObject;
public class WordCountForAsin extends Configured implements Tool {
public static class WordCountForAsinMapper extends
Mapper<LongWritable, Text, Text, Text> {
public void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
try {
String[] wordAndAsinCounter = value.toString().split("\t");
String[] wordAndAsin = wordAndAsinCounter[0].split("@");
context.write(new Text(wordAndAsin[1]), new Text(wordAndAsin[0]
+ "=" + wordAndAsinCounter[1]));
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static class WordCountForAsinReducer extends
Reducer<Text, Text, Text, Text> {
public void reduce(Text key, Iterable<Text> values, Context context)
throws IOException, InterruptedException {
int sumofWordsInAsin = 0;
Map<String, Integer> tempCounter = new HashMap<String, Integer>();
for (Text val : values) {
String[] wordCounter = val.toString().split("=");
tempCounter
.put(wordCounter[0], Integer.valueOf(wordCounter[1]));
sumofWordsInAsin += Integer
.parseInt(val.toString().split("=")[1]);
}
for (String wordKey : tempCounter.keySet()) {
context.write(new Text(wordKey + "@" + key.toString()),
new Text(tempCounter.get(wordKey) + "/"
+ sumofWordsInAsin));
}
}
}
public int run(String[] args) throws Exception {
Configuration conf = new Configuration(true);
conf.set("fs.default.name", "hdfs://" + "master" + ":9000");
Job wordCountForAsin = new Job(conf, "WordCountForAsin");
wordCountForAsin.setJarByClass(WordCountForAsinMapper.class);
wordCountForAsin.setOutputKeyClass(Text.class);
wordCountForAsin.setOutputValueClass(Text.class);
wordCountForAsin.setMapperClass(WordCountForAsinMapper.class);
wordCountForAsin.setReducerClass(WordCountForAsinReducer.class);
wordCountForAsin.setInputFormatClass(TextInputFormat.class);
wordCountForAsin.setOutputFormatClass(TextOutputFormat.class);
FileInputFormat.addInputPath(wordCountForAsin, new Path(
Tfidf.INPUTPATH2));
FileOutputFormat.setOutputPath(wordCountForAsin, new Path(
Tfidf.OUTPUTPATH2));
wordCountForAsin.waitForCompletion(true);
return 0;
}
}
| [
"eaia@naver.com"
] | eaia@naver.com |
e9848a9b265130b94836fd4b661a5514900bbb3a | 7240747102e2fe1e867cea0fa8580a31a2490f4f | /App/ITalker/app/src/main/java/net/qiujuer/italker/push/App.java | 6805e245d7d05cc6858bb6b4e249f553d6095972 | [] | no_license | xxxidream/IMOOCMessager | 6bca7c7263e8ccfd88d23b0b115262ede7406a7e | 682d7bd7d99bdea66538b8af6da8f1e9e5c1db0f | refs/heads/master | 2021-06-23T13:04:30.175286 | 2017-09-06T08:32:16 | 2017-09-06T08:32:16 | 100,321,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 474 | java | package net.qiujuer.italker.push;
import com.igexin.sdk.PushManager;
import net.qiujuer.italker.common.app.Application;
import net.qiujuer.italker.factory.Factory;
/**
* Created by 16571 on 2017/8/15.
*/
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
//调用Factory进行初始化
Factory.setup();
//推送进行初始化
PushManager.getInstance().initialize(this);
}
}
| [
"1657140647@qq.com"
] | 1657140647@qq.com |
ae89550d0927812d148829f2f77fb6c7599efd8b | 9597d5ec20728ede020a4faaa973e356fc941140 | /src/main/java/com/qunar/fxd/leetcode/array/SearchInsert.java | 862d43532435fe82d4b20caf9e81698eb9149c4e | [] | no_license | fxd1/concurrent | b4bf923c3989136351c9aa44bf8a1870b06e93e9 | c5d8ed00f5b58d0285a0204e8e327d7bdafcd786 | refs/heads/master | 2021-06-15T07:42:34.428708 | 2019-07-15T02:33:16 | 2019-07-15T02:33:16 | 164,381,321 | 0 | 0 | null | 2021-03-31T20:53:47 | 2019-01-07T05:12:29 | Java | UTF-8 | Java | false | false | 592 | java | package com.qunar.fxd.leetcode.array;
/**
* https://leetcode-cn.com/problems/search-insert-position/
*
* 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。
*
* 你可以假设数组中无重复元素。
*/
public class SearchInsert {
public int searchInsert(int[] nums, int target) {
for (int i=0; i< nums.length; i++){
if (nums[i] >= target){
return i;
}
}
return nums.length;
}
}
| [
"fengxiaodong.feng@qunar.com"
] | fengxiaodong.feng@qunar.com |
91b3fd49acf41b0f8d69599538ce1928b38bc166 | b93a6242b607e1e20540da0f59a6041f8e3bc28e | /java/src/plugins/com/dgrid/plugins/GroovyMapReducePlugin.java | c29749da9012baa660760e861c2d819aaaff6e4b | [
"Apache-2.0"
] | permissive | samtingleff/dgrid | edd9b1fea991023eff89f5bac412249015a2aaed | 47fb753159e5b6c538e70fef2903c8028d7cf897 | refs/heads/master | 2021-01-17T12:47:26.170016 | 2009-05-13T21:56:16 | 2009-05-13T21:56:16 | 51,359 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 920 | java | package com.dgrid.plugins;
import java.io.File;
import com.dgrid.gen.Constants;
import com.dgrid.handlers.GroovyMapReduceTypeHandler;
import com.dgrid.plugin.BaseDGridPlugin;
import com.dgrid.service.DGridPluginManager;
public class GroovyMapReducePlugin extends BaseDGridPlugin {
public String getDescription() {
return "Adds support for simple groovy-based map/reduce jobs";
}
public void start() {
DGridPluginManager mgr = (DGridPluginManager) pluginManager;
GroovyMapReduceTypeHandler handler = new GroovyMapReduceTypeHandler(
new File("plugins/groovy/mr"));
mgr.setJobletTypeHandler(Constants.GROOVY_MR_JOB, handler);
mgr.setJobletTypeHandler(Constants.GROOVY_MR_REDUCER, handler);
}
public void stop() {
DGridPluginManager mgr = (DGridPluginManager) pluginManager;
mgr.removeJobletTypeHandler(Constants.GROOVY_MR_JOB);
mgr.removeJobletTypeHandler(Constants.GROOVY_MR_REDUCER);
}
}
| [
"sam@structure28.com"
] | sam@structure28.com |
ef5fff99b2e32abdd8dd8ad145b7e56dc5ac9b42 | e29975c788155ddcd3f0edd4e6d78fa8ba595cc8 | /de.akra.idocit.java.tests/src/test/resources/source/SpecialException.java | fb88e553d094d7783a6913b1cbf89c12d0f8883e | [
"Apache-2.0"
] | permissive | jankrause/idocit | 56aac26673bfa8fabf2a4f30eb0f32f4a33fd232 | 85b90f06d5f07413f900054766570874471a88f0 | refs/heads/master | 2020-04-20T14:39:25.204245 | 2012-11-16T11:38:40 | 2012-11-16T11:38:40 | 40,559,111 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,017 | java | /*******************************************************************************
* Copyright 2012 AKRA 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.
*******************************************************************************/
package source;
public class SpecialException extends Exception
{
private static final long serialVersionUID = 1L;
private String message;
public String getMessage()
{
return message;
}
public void setMessage(String message)
{
this.message = message;
}
}
| [
"krausedammann@web.de"
] | krausedammann@web.de |
66f135d717280f1f78df5e50df4acde502a0ef09 | 32ddc360f42609daf5e4e5f787d1799a8ada3992 | /app/src/main/java/hezra/wingsnsides/ChickenWings/ChickenFlavour.java | e6d82295a5289f58044ea31fdcbab8e22134a752 | [] | no_license | shadygoneinsane/OnlineDeliveryApp | 7927645d82ab8a34f804b4c6ad9019275e012dbd | 0c9f44cfaaba99ba48e047bbb8c159c8c1b0237e | refs/heads/master | 2021-07-17T12:15:02.399555 | 2017-10-26T06:23:49 | 2017-10-26T06:23:49 | 105,480,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package hezra.wingsnsides.ChickenWings;
/**
* Created by vikesh on 11-06-2017.
*/
public class ChickenFlavour {
private String pID;
private String pNAME;
private String pDETAIL;
private String cID;
public String getPID() {
return pID;
}
public void setPID(String pID) {
this.pID = pID;
}
public String getPNAME() {
return pNAME;
}
public void setPNAME(String pNAME) {
this.pNAME = pNAME;
}
public String getPDETAIL() {
return pDETAIL;
}
public void setPDETAIL(String pDETAIL) {
this.pDETAIL = pDETAIL;
}
public String getCID() {
return cID;
}
public void setCID(String cID) {
this.cID = cID;
}
} | [
"vikeshdass@gmail.com"
] | vikeshdass@gmail.com |
61122ca1f32f911de5bb05be368b66c0615a5be9 | 4d9d93551f7859e20cf71dc41c6b59988666745a | /src/main/java/by/epam/epamlab/constants/Constants.java | 6cff7866947c6fc4d2f16d1aa5da4cc7061c6d72 | [] | no_license | asus200786/Issue_Tracker | 2b98d06aa73036b62cfb3cdb7f53a135c41ad965 | 7c84e3d6173468f3355a5c99be560c4fca35024c | refs/heads/master | 2020-12-24T13:16:38.508696 | 2014-05-04T00:29:09 | 2014-05-04T00:29:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package by.epam.epamlab.constants;
public class Constants {
public static final String EMPTY_STRING = "";
public static final String ERROR_ANALYZER_SAX = "Error SAX parser";
public final static String ERROR_IO_STREAM = "Error IO stream";
public final static String INPUT_XML = "/users.xml ";
}
| [
"asus200786@gmail.com"
] | asus200786@gmail.com |
92828245e017c6ba091f90b1bc0678f7c5a6f010 | 432a93d060a5d90c9f9ae736400199a5179bd312 | /27.04.2019/04_04/Square.java | fb4bd476ae4d92b4e11224c1313abdfb59605e45 | [] | no_license | Levarix/PJATK-POJ | e71120bff10ab98e090c0215d4a3d6410050072d | b738fce348952313baab65177d09177554d98686 | refs/heads/master | 2020-05-01T05:16:29.198523 | 2019-09-29T10:16:57 | 2019-09-29T10:16:57 | 177,297,257 | 0 | 2 | null | 2019-05-10T20:10:56 | 2019-03-23T14:14:02 | Java | UTF-8 | Java | false | false | 733 | java | public class Square extends Rectangle {
public Square(){
}
public Square(double _side){
super(_side,_side);
}
public Square(double _side, String _color, boolean _filled){
super(_side, _side, _color, _filled);
}
public double getSide(){
return getLenght();
}
public void setSide(double _side){
setLenght(_side);
setWidth(_side);
}
public void setWidth(double _side){
super.setWidth(_side);
}
public void setLenght(double _side){
super.setLenght(_side);
}
public String toString() {
return "Square{ side= "+ getSide()+ ", color " + getColor() +", filled "+ isFilled() + "}";
}
}
| [
"noreply@github.com"
] | Levarix.noreply@github.com |
cafd3f89ddff8b86fc3776adebd2ecb075e206e7 | 66a97cb9c2a3a7d385fe4dd5ef86b5ab423389dd | /app/src/main/java/com/suwonsmartapp/hello/graphic/MusicPlayerView.java | 289e3f43ca0ff341dd2229905b7a1d4ae3a94d10 | [] | no_license | suwonsmartapp/HelloAndroid1 | 77e8cb0ca6b8e826c6e1fbca196de44874c20704 | af497d7ed2bf2b120a125337c91d069591ebc00d | refs/heads/master | 2020-04-09T05:27:21.886585 | 2015-07-08T01:00:16 | 2015-07-08T01:00:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,306 | java | package com.suwonsmartapp.hello.graphic;
import android.content.Context;
import android.media.MediaPlayer;
import android.net.Uri;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.VideoView;
import com.suwonsmartapp.hello.R;
import java.io.IOException;
/**
* Created by junsuk on 15. 5. 29..
*/
public class MusicPlayerView extends LinearLayout implements View.OnClickListener {
public static final int REQUEST_CODE_AUDIO = 0;
public static final int REQUEST_CODE_VIDEO = 1;
private Button mBtnAudioFilePick; // 파일 선택
private Button mBtnVideoFilePick; // 파일 선택
private Button mBtnPause; // 정지
private Button mBtnResume; // 재시작
private TextView mTvArtist;
private TextView mTvAlbum;
private TextView mTvTitle;
private Chronometer mPlayTime;
private TextView mTvDuration;
private SeekBar mSeekBar;
private ImageView mIvAlbumArt;
// 플레이어
private MediaPlayer mMediaPlayer;
private VideoView mVideoView;
private long mStartTime = 0;
private long mStopTime = 0;
private Context mContext;
public MusicPlayerView(Context context) {
this(context, null);
}
public MusicPlayerView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public MusicPlayerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mContext = context;
LayoutInflater.from(context).inflate(R.layout.activity_media_player, this);
// 레이아웃 초기화, 이벤트 연결
init();
}
private void init() {
mBtnAudioFilePick = (Button) findViewById(R.id.btn_audioFilePick);
mBtnVideoFilePick = (Button) findViewById(R.id.btn_videoFilePick);
mBtnPause = (Button) findViewById(R.id.btn_pause);
mBtnResume = (Button) findViewById(R.id.btn_resume);
mVideoView = (VideoView) findViewById(R.id.videoView);
mTvArtist = (TextView) findViewById(R.id.tv_artist);
mTvAlbum = (TextView) findViewById(R.id.tv_album);
mTvTitle = (TextView) findViewById(R.id.tv_title);
mPlayTime = (Chronometer) findViewById(R.id.chronometer_play_time);
mTvDuration = (TextView) findViewById(R.id.tv_duration);
mSeekBar = (SeekBar) findViewById(R.id.seekbar_play_time);
mIvAlbumArt = (ImageView) findViewById(R.id.iv_albumArt);
mBtnAudioFilePick.setOnClickListener(this);
// mBtnVideoFilePick.setOnClickListener(this);
// mBtnPause.setOnClickListener(this);
// mBtnResume.setOnClickListener(this);
// mSeekBar.setOnSeekBarChangeListener(this);
// mPlayTime.setOnChronometerTickListener(this);
}
public void startMusic(Uri fileUri) {
if (mMediaPlayer != null) {
mMediaPlayer.release();
mMediaPlayer = null;
}
try {
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setDataSource(mContext, fileUri);
mMediaPlayer.prepare();
mMediaPlayer.start();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void onClick(View v) {
if (mListener != null) {
mListener.onAudioPlayButtonClicked(); // 외부에 콜백이 호출 됨
}
}
private OnPlayerButtonClickListener mListener;
public void setOnPlayerButtonClickListener(OnPlayerButtonClickListener listener) {
mListener = listener;
}
public interface OnPlayerButtonClickListener {
void onAudioPlayButtonClicked(); // call back
}
// ViewGroup 의 위치 결정
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
}
// ViewGroup 의 크기를 결정
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
| [
"a811219@gmail.com"
] | a811219@gmail.com |
dbf7fe69d6e3f7eaeeaee7500b7cc63ff76b2fb5 | bfef483adbc9799f16e447b391f1b255b728f515 | /app/src/main/java/com/maps/subwaytransit/adapter/LineSearchResultsAdapter.java | b9d50e50427883eeb07dd5389f2a9b3c51fc89ce | [] | no_license | UmarMurtaza-CDZ/NYCRoutesAndSchedules | 7c2405818cb3b59d44297018d03ae8347d0aa455 | 4d34bca9394de39bbaf9dcef2a016bbfadce450b | refs/heads/master | 2020-04-07T23:33:41.686075 | 2018-11-23T11:51:01 | 2018-11-23T11:51:01 | 157,162,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,893 | java | package com.maps.subwaytransit.adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.maps.subwaytransit.R;
import com.maps.subwaytransit.model.RouteModel;
import java.util.ArrayList;
public class LineSearchResultsAdapter extends ArrayAdapter<RouteModel> {
private Context context;
private ArrayList<RouteModel> routeModelArrayList = new ArrayList<>();
public LineSearchResultsAdapter(Context context, ArrayList<RouteModel> routeModelArrayList) {
super(context, 0, routeModelArrayList);
this.context = context;
this.routeModelArrayList = routeModelArrayList;
}
@NonNull
public View getView(int position, View view, ViewGroup parent) {
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_single_line_search_result, parent, false);
ImageView lineLetter = (ImageView) view.findViewById(R.id.line_letter);
TextView lineName = (TextView) view.findViewById(R.id.line_name);
String resourceString = "route_" + routeModelArrayList.get(position).getRouteShortName().toLowerCase();
if (resourceString.equals("route_5x")) {
resourceString = "route_5";
}
int resourceId = context.getResources().getIdentifier(resourceString, "drawable", context.getPackageName());
if (resourceId != 0) {
lineLetter.setImageResource(resourceId);
} else {
lineLetter.setImageResource(0);
}
lineName.setText(routeModelArrayList.get(position).getRouteLongName());
return view;
}
@Override
public int getCount() {
return routeModelArrayList.size();
}
}
| [
"umarmurtaza.cdz@gmail.com"
] | umarmurtaza.cdz@gmail.com |
8fc5f705aa815a9837611cfe6ab2199f9160bdb0 | e92753867ce161db3dcb7af7392dbd00fa6918a0 | /src/main/java/com/illud/transport/service/mapper/ReplyMapper.java | ce45c0ff8f3793580ab76f05990b0bba1ecd0cd6 | [] | no_license | illudtechzone/transportTest | 33dbabcc03e7ed5ef39cdfc8d291a05993166a8b | 275b2aa7717af07ceeafbc541dfcb598f3dc53d9 | refs/heads/master | 2022-12-10T09:56:11.434071 | 2019-10-31T04:54:46 | 2019-10-31T04:54:46 | 202,313,072 | 0 | 0 | null | 2022-12-09T22:24:29 | 2019-08-14T08:58:10 | Java | UTF-8 | Java | false | false | 722 | java | package com.illud.transport.service.mapper;
import com.illud.transport.domain.*;
import com.illud.transport.service.dto.ReplyDTO;
import org.mapstruct.*;
/**
* Mapper for the entity Reply and its DTO ReplyDTO.
*/
@Mapper(componentModel = "spring", uses = {ReviewMapper.class})
public interface ReplyMapper extends EntityMapper<ReplyDTO, Reply> {
@Mapping(source = "review.id", target = "reviewId")
ReplyDTO toDto(Reply reply);
@Mapping(source = "reviewId", target = "review")
Reply toEntity(ReplyDTO replyDTO);
default Reply fromId(Long id) {
if (id == null) {
return null;
}
Reply reply = new Reply();
reply.setId(id);
return reply;
}
}
| [
"karthikeyan.p.k@lxisoft.com"
] | karthikeyan.p.k@lxisoft.com |
62c00dae786a42fb0a67ea3de3a16bd457417099 | 64db3b486ada0501e0c5acb488203df9b78c6070 | /src/main/java/com/second/boss/estate/common/result/ResultCode.java | 03db5b9c2453f830232421d27565990ad7bf0267 | [] | no_license | yinminxin/estate | 1b357a220e3e54c72fffd4897e42378149c32f8c | f7a38b70a264c7aeb22ee2bcef6792f67ac2a7bb | refs/heads/master | 2022-06-30T12:54:16.817580 | 2019-12-19T11:08:23 | 2019-12-19T11:08:23 | 228,767,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,276 | java | package com.second.boss.estate.common.result;
public enum ResultCode {
/** 成功 */
SUCCESS("200", "successed"),
/** 操作失败 */
FAIL("209", "failed"),
/** 成功 */
OK("200", "OK"),
/** 用户新建或修改数据成功 */
CREATED("201", "CREATED"),
/** 用户删除数据成功 */
NO_CONTENT("204", "NO CONTENT"),
/** 用户发出的请求有错误 */
INVALID_REQUEST("400", "INVALID REQUEST"),
/** 未经授权 用户需要进行身份验证 */
UNAUTHORIZED("401", "UNAUTHORIZED"),
/** 访问是被禁止 */
FORBIDDEN("403", "FORBIDDEN"),
/** 不存在的记录 */
NOT_FOUND("404", "NOT FOUND"),
/** 当创建一个对象时,发生一个验证错误 */
UNPROCESABLE_ENTITY("411", "UNPROCESABLE ENTITY"),
/** 资源被永久删除 */
GONE("414", "GONE"),
/** 服务器发生错误 */
INTERNAL_SERVER_ERROR("500", "INTERNAL SERVER ERROR");
private String code;
private String message;
private ResultCode(String code, String message){
this.code = code;
this.message = message != null ? message : "";
}
public String getCode() {
return code;
}
public String getMessage() {
return message;
}
} | [
"yinminxin@wondersgroup.com"
] | yinminxin@wondersgroup.com |
f1167afffc40e6afb28d4c86a3b5ffd6bba6b016 | a5cc8954d536e6b0d2773dbdb4562d01dcda165a | /src/test/java/com/example/AppTest.java | 12c082a5917677310423ea3759851c8518d45af1 | [] | no_license | zdsd0019/CrawFord | ab4e4d02593eed15213936a32952887edf6471e6 | ae17c554c607d2c50a178aeecd6843e068af8f2c | refs/heads/master | 2023-08-13T16:29:49.128931 | 2021-10-04T22:51:49 | 2021-10-04T22:51:49 | 413,605,428 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,098 | java | package com.example;
import org.testng.annotations.Test;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class AppTest
{
WebDriver driver = new ChromeDriver();
@BeforeTest
public void getWebsite() {
driver.get("https://www.crawco.co.uk/");
driver.manage().window().maximize(); //Max Chrome Browser
}
@Test(priority=1, description="Facebook - Link check")
public void testCaseOne()
{
//Confirms that the URL of our facebook link on this page is: https://www.facebook.com/crawfordandco
String expected = "https://www.facebook.com/crawfordandco";
String actual = driver.findElement(By.xpath("//*[@id='mmenu-page']/footer/div/div[1]/p[2]/a[2]")).getAttribute("href");
Assert.assertEquals(actual, expected, "test passed");
}
@AfterTest
public void terminateBrowser() {
driver.quit();
}
}
| [
"zdsd0019@gmail.com"
] | zdsd0019@gmail.com |
ef369d3df9269597d4b45e15a9b28d069fba7c9d | 2673538a24323f71cb171da1cd2ab4fe3347d59e | /AccountLibrary/src/com/asd/domain/AccountEntry.java | df42b625028788ac928fca6020f14254f4f2cbc7 | [] | no_license | befrdu/Java_FrameWork_Project | acfb44565b1550d28daa06ede66d9f60daae5ff3 | e7de3a687872cb36d461f14a6f7ce449b2887b0c | refs/heads/master | 2020-06-21T07:05:07.993935 | 2016-11-26T04:40:20 | 2016-11-26T04:40:20 | 74,799,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,568 | java | package com.asd.domain;
import java.time.LocalDate;
public class AccountEntry {
// private Date date;
private LocalDate date;
private String description;
private Double amount;
private Double balance;
private String fromAccountNumber;
private String fromPersonName;
//
// public Date getDate() {
// return date;
// }
//
// public void setDate(Date date) {
// this.date = date;
// }
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getFromAccountNumber() {
return fromAccountNumber;
}
public void setFromAccountNumber(String fromAccountNumber) {
this.fromAccountNumber = fromAccountNumber;
}
public String getFromPersonName() {
return fromPersonName;
}
public void setFromPersonName(String fromPersonName) {
this.fromPersonName = fromPersonName;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
@Override
public String toString() {
return "AccountEntry [date=" + date + ", description=" + description + ", fromAccountNumber="
+ fromAccountNumber + ", fromPersonName=" + fromPersonName + ", amount=" + amount + "]";
}
public Double getBalance() {
return balance;
}
public void setBalance(Double balance) {
this.balance = balance;
}
}
| [
"befrdu.gebreamlack@gmail.com"
] | befrdu.gebreamlack@gmail.com |
b50019dfb2143a0108eaee905eb9cd6172c5a6e5 | 48408ecc6421040310be8326dc6c68ac8df60c23 | /src/main/java/com/amogh/elasticsearch/controller/SearchController.java | 3ab5265f062f7f048b5c80a432181c1d65aa11f7 | [] | no_license | amoghshylendra/elastic-search | e41c26231582751cde93f5907ce83e45b6c56703 | 79452c82d07db39549b6d430b4c84ce6b68176e7 | refs/heads/master | 2020-04-17T13:07:16.509545 | 2019-01-19T23:21:27 | 2019-01-19T23:21:27 | 166,602,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,095 | java | package com.amogh.elasticsearch.controller;
import com.amogh.elasticsearch.model.SearchResult;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.ArrayList;
import java.util.List;
@Controller
public class SearchController {
@GetMapping("/search")
public String search(@RequestParam("searchString") String searchString, Model model){
List<SearchResult> results = new ArrayList<>();
//TODO use @searchString to search using elastic search engine
System.out.println("Searching for keyword - "+searchString+ " ...");
// assuming below as the result of elastic search
results.add(new SearchResult("Matched#1", "Additional props for Matched#1"));
results.add(new SearchResult("Matched#2", "Additional props for Matched#2"));
model.addAttribute("searchString", searchString);
model.addAttribute("results", results);
return "results";
}
}
| [
"amogh1588@gmail.com"
] | amogh1588@gmail.com |
d77f1e09dcead26c90b6708b4270e88ff9188ca2 | ff8621fd301db2eef647a30b04e19fa159ff8189 | /src/boardgame/Position.java | 4be358482abd8ecf3099c594cf6b10f136d69d1f | [] | no_license | EstefanoTenorio/chess-system-java | d04b74a9346cea6b64037215cb42add0d711a93b | 71c13eac71fe677ddfc4df4c998f1abe95d116bf | refs/heads/master | 2023-01-22T11:45:18.997337 | 2020-12-07T02:41:43 | 2020-12-07T02:41:43 | 298,121,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | java | package boardgame;
public class Position {
private int row;
private int column;
public Position(int row, int column) {
this.row = row;
this.column = column;
}
public int getRow() {
return row;
}
public void setRow(int row) {
this.row = row;
}
public int getColumn() {
return column;
}
public void setColumn(int column) {
this.column = column;
}
public void setValues(int row, int column) {
this.row = row;
this.column = column;
}
@Override
public String toString() {
return row + " ," + column;
}
}
| [
"estefano.tenorio@gmail.com"
] | estefano.tenorio@gmail.com |
6df2c5e60b8ff6633ae589aa770b31f57adc66d8 | af75488a3cff9000a279f94411f5dcc8c10dfd92 | /src/main/java/com/jakuza/servicesapp/repository/BackgroundRepository.java | 644dac028b61ab78a7ca54ff0d3dd3fceda53ff7 | [] | no_license | zoltanJakubecz/AppSystem-spring | e7154d2f289648446c2a8fe3430ba06c32e74362 | c6be4c8f91da3d80ad95d2d0dfa97113f2f5c7c2 | refs/heads/master | 2023-01-13T20:33:20.092055 | 2020-11-20T07:32:26 | 2020-11-20T07:32:26 | 314,356,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 261 | java | package com.jakuza.servicesapp.repository;
import com.jakuza.servicesapp.model.Background;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.UUID;
public interface BackgroundRepository extends JpaRepository<Background, UUID> {
}
| [
"jakuzo@gmail.com"
] | jakuzo@gmail.com |
fb2ae3be8dea03f30434c2c09b67f758b12479e6 | 53ca3e236c717863d9eb36614d6041af22951b1d | /src/main/java/com/springframework/samples/madaja/service/SeguroClienteService.java | e99fa6278cbe7e90a1695ae5508267665286e22c | [] | no_license | anacatcam/dp1-2020-g1-05 | 2ced09664d3c708414c866ce0aee1756119e31f6 | 77eec15aca318c8e718278bd60051b9f04e7be91 | refs/heads/master | 2023-02-28T17:35:23.982780 | 2021-02-09T22:52:52 | 2021-02-09T22:52:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,173 | java |
package com.springframework.samples.madaja.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.springframework.samples.madaja.model.SeguroCliente;
import com.springframework.samples.madaja.repository.SeguroClienteRepository;
@Service
public class SeguroClienteService {
private SeguroClienteRepository seguroClienteRepository;
@Autowired
public SeguroClienteService(SeguroClienteRepository seguroClienteRepository) {
this.seguroClienteRepository=seguroClienteRepository;
}
@Transactional
public void saveSeguroCliente(SeguroCliente seguroCliente) throws DataAccessException{
seguroClienteRepository.save(seguroCliente);
}
@Transactional(readOnly = true)
public SeguroCliente findSeguroClienteById(int id) throws DataAccessException {
return seguroClienteRepository.findById(id);
}
@Transactional
@Modifying
public void deleteById(int id) {
seguroClienteRepository.deleteById(id);
}
}
| [
"73110779+antoniope33@users.noreply.github.com"
] | 73110779+antoniope33@users.noreply.github.com |
a09db2ac0553699c4029abb142f250f32e3a9ff2 | 9d32980f5989cd4c55cea498af5d6a413e08b7a2 | /A92s_10_0_0/src/main/java/com/android/server/IColorCustomCommonManager.java | 1c53249f04087b38bab2014bd08db59e2c7eed79 | [] | no_license | liuhaosource/OppoFramework | e7cc3bcd16958f809eec624b9921043cde30c831 | ebe39acabf5eae49f5f991c5ce677d62b683f1b6 | refs/heads/master | 2023-06-03T23:06:17.572407 | 2020-11-30T08:40:07 | 2020-11-30T08:40:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 146 | java | package com.android.server;
import android.common.IOppoCommonFeature;
public interface IColorCustomCommonManager extends IOppoCommonFeature {
}
| [
"dstmath@163.com"
] | dstmath@163.com |
59437ef7d5fd0fc29aaad926cf772ded8f39e5bc | 7aff7cfe698005a8408bc66c2a87bbd5ec60d71d | /src/FactoryDemo/BWMFactor.java | 7023d869e154ec82c3150f740422dac49863a09a | [] | no_license | Lemon-Lin/JavaStudyDemo | 8c5ba1206a91b4f168e885ad023c44904ad4e6f2 | 2a67a9e6c2471786ae86dae12dc99b3d6d59078d | refs/heads/master | 2022-04-09T18:54:33.911880 | 2020-03-27T07:07:33 | 2020-03-27T07:07:33 | 250,231,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 640 | java | package FactoryDemo;
public interface BWMFactor {
BWM productBWM();
}
class BWM3Factor implements BWMFactor
{
@Override
public BWM productBWM() {
System.out.println("生产宝马3系");
return new BWM3();
}
}
class BWM4Factor implements BWMFactor
{
@Override
public BWM productBWM() {
System.out.println("生产宝马4系");
System.out.println("改造宝马4系");
return new BWM4i();
}
}
class BWM5Factor implements BWMFactor
{
@Override
public BWM productBWM() {
System.out.println("生产宝马5系");
return new BWM5();
}
} | [
"1796646806@qq.com"
] | 1796646806@qq.com |
b3874aabb58a1ca1d76fa8e5a6b5497f33f4e99d | 5801ceb2da66a502beabb6783d86b26445e579a6 | /IWish_Client/src/com/dto/ShowItemDTO.java | c1cdd9960df489ac1ce455387d15e888112339ea | [] | no_license | ashaabanm/iwhish | 7354c46cec98827f7f75769d9fc1e5bb81773dc9 | 6f9bd53894ef1f21d64bf43f1a703fb5e33aacac | refs/heads/master | 2023-02-17T07:17:28.632369 | 2021-01-11T15:49:28 | 2021-01-11T15:49:28 | 327,430,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 152 | java | package com.dto;
import java.util.Vector;
public class ShowItemDTO {
public HeaderDTO header;
public Vector<ItemDTO> listOfItems;
}
| [
"ahmedshaaban837@gmail.com"
] | ahmedshaaban837@gmail.com |
fef869c3e6a8437e3d07537b0906553b9a3a550c | 560266d2f7676385c599adcbbef74d4957172b94 | /app/app/src/main/java/ro/pub/cs/systems/eim/Colocviu1_13/Colocviu1_13Service.java | bafce32b23ad031557f4a8f69bc309c4a29f2be1 | [
"Apache-2.0"
] | permissive | mihaela-catrina/Colocviu1_13 | 0e65d4690c186b0109c8ceb5fe4fb1773f794ff4 | 57d5b8327d30168f1a948842896fa277a8e2b12e | refs/heads/master | 2022-04-12T14:24:05.699970 | 2020-04-13T08:53:47 | 2020-04-13T08:53:47 | 255,256,782 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,356 | java | package ro.pub.cs.systems.eim.Colocviu1_13;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
public class Colocviu1_13Service extends Service {
private ProcessingThread processingThread = null;
@Override
public void onCreate() {
super.onCreate();
Log.d(Constants.TAG, "onCreate() method was invoked");
}
@Override
public IBinder onBind(Intent intent) {
Log.d(Constants.TAG, "onBind() method was invoked");
return null;
}
@Override
public boolean onUnbind(Intent intent) {
Log.d(Constants.TAG, "onUnbind() method was invoked");
return true;
}
@Override
public void onRebind(Intent intent) {
Log.d(Constants.TAG, "onRebind() method was invoked");
}
@Override
public void onDestroy() {
Log.d(Constants.TAG, "onDestroy() method was invoked");
processingThread.stopThread();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(Constants.TAG, "onStartCommand() method was invoked");
String value = intent.getStringExtra(Constants.SERVICE_KEY);
processingThread = new ProcessingThread(this, value);
processingThread.start();
return Service.START_REDELIVER_INTENT;
}
}
| [
"mcatrina@bitdefender.com"
] | mcatrina@bitdefender.com |
e28c915098d9c23b3d64b2e181e89ac58a5d42d0 | 5100d82fbc0b94681101a172e935d1d47ed1ff11 | /factory-method-pattern/src/main/java/factory_method/PorscheFactory.java | 4ad34a3a2a6d03e67f0f1d39b9c0a6ef38aa24de | [] | no_license | ericdemo07/LowLevelDesign_Practice | 3c9d708fe3fa3d0f2ec97f40e83c2d9d96e8cfc7 | 1d2321159b6a34cfd244219adec9295b61ddffeb | refs/heads/main | 2023-08-25T04:30:41.023558 | 2021-10-15T17:54:56 | 2021-10-15T17:54:56 | 397,342,707 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 517 | java | package factory_method;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.Map;
public class PorscheFactory implements CarFactory {
private static final Map<EngineType, PorscheModel> MAP;
static {
MAP = new EnumMap<>(EngineType.class);
Arrays.stream(EngineType.values()).forEach(type -> MAP.put(type, new PorscheModel(type)));
}
@Override
public Car createCar(EngineType engineType) {
return MAP.get(engineType);
}
@Override
public String toString() {
return "Porsche : ";
}
}
| [
"ashukla@groupon.com"
] | ashukla@groupon.com |
b819ec349315fb5f5584ff80f3c760233f3e964e | 68eab9a5332af12f44437d220d7acff09b1c43f1 | /src/questions/Matrix/KthSmallestElementInARowWiseAndColumnWiseSortedTwoDArray.java | 8e186e8535989939ed6fb34eed7e406b8986388d | [] | no_license | iamrk1811/InterviewQuestion500 | 74d1706d251cf64b0660c967d9595040bdd0287b | 984770a4adfead7a25fe9f746d2bd71446e21c06 | refs/heads/master | 2023-05-02T16:21:33.926635 | 2021-05-18T18:52:19 | 2021-05-18T18:52:19 | 351,079,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,187 | java | package questions.Matrix;
import java.util.PriorityQueue;
public class KthSmallestElementInARowWiseAndColumnWiseSortedTwoDArray {
// Q - https://www.geeksforgeeks.org/kth-smallest-element-in-a-row-wise-and-column-wise-sorted-2d-array-set-1/
static class Node implements Comparable<Node> {
int row;
int col;
int value;
Node(int value, int row, int col) {
this.row = row;
this.col = col;
this.value = value;
}
@Override
public int compareTo(Node other) {
return this.value - other.value;
}
}
public int solve(int[][] mat, int k) {
int n = mat.length;
PriorityQueue<Node> pq = new PriorityQueue<>();
for (int i = 0; i < n; i++) {
pq.add(new Node(mat[0][i], 0, i));
}
for (int i = 1; i <= k - 1; i++) {
Node current = pq.remove();
int row = current.row;
int col = current.col;
int nextValue = row + 1 < n ? mat[row + 1][col] : Integer.MAX_VALUE;
pq.add(new Node(nextValue, row + 1, col));
}
return pq.peek().value;
}
}
| [
"rakibrk1811@gmail.com"
] | rakibrk1811@gmail.com |
3b09985c9e840bf5a23fbea2061205dc06cb7a35 | 03f2626b0b5bb559c970b6923409763ffb46be99 | /webmagic-xml/src/test/java/com/kuaidi/KuaiDi.java | 183aeecf7126389824ef317bbeba50427fad82f7 | [
"Apache-2.0"
] | permissive | lcsan/webmagic-my | 236b3a70ded59ca2bd9c6986319c7ce7c3531fe8 | c271356c451139c484f8907d362daa2053259299 | refs/heads/master | 2022-09-10T22:56:03.297372 | 2019-10-22T10:45:29 | 2019-10-22T10:45:29 | 108,799,431 | 0 | 1 | Apache-2.0 | 2022-09-01T22:32:38 | 2017-10-30T03:53:25 | Java | UTF-8 | Java | false | false | 2,723 | java | package com.kuaidi;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.model.OOSpider;
import us.codecraft.webmagic.model.annotation.ExtractBy;
import us.codecraft.webmagic.model.annotation.TargetUrl;
@TargetUrl("https://www.kuaidi100.com/all/")
@ExtractBy(value = "//div[@class='column-list']//a", multi = true)
public class KuaiDi {
@ExtractBy(value = "//a/text()", notNull = true)
private String name;
@ExtractBy("//a/regex('^.*?([^/]+)\\.shtml.*?$',1)")
private String code;
public String getName() {
return name;
}
public String getCode() {
return code;
}
public static void main(String[] args) {
List<String> ls = new ArrayList<String>();
ls.add("https://m.kuaidi100.com/index_all.html?type=顺丰速运&postid=821545765258");
OOSpider sp = OOSpider.create(Site.me(), KuaiDiH5.class);
List<KuaiDiH5> r = sp.getAll(ls);
Map<String, String> map = new HashMap<String, String>();
for (KuaiDiH5 kuaiDi : r) {
map.put(kuaiDi.getName(), kuaiDi.getCode());
}
sp.stop();
sp.close();
List<String> list = new ArrayList<String>();
list.add("https://www.kuaidi100.com/all/");
sp = OOSpider.create(Site.me(), KuaiDi.class);
List<KuaiDi> re = sp.getAll(list);
for (KuaiDi kuaiDi : re) {
String name = kuaiDi.getName().replaceAll("-", "").replaceAll("&", "与").replaceAll("[((]", "/")
.replaceAll("[))]", "");
String code = kuaiDi.getCode();
String cd = map.get(name);
if (null != cd) {
code = cd;
}
if (name.matches("^.*?(?:快递|速递|物流|配送|速运|快运)$")) {
System.out.println(name.replaceAll("(?:快递|速递|物流|配送|速运|快运)", "") + "\t" + code);
}
if (name.contains("/")) {
String[] str = name.split("/");
for (String string : str) {
if (name.matches("^.*?(?:快递|速递|物流|配送|速运|快运)$")) {
System.out.println(string.replaceAll("(?:快递|速递|物流|配送|速运|快运)", "") + "\t" + code);
} else {
System.out.println(string + "\t" + code);
}
}
} else {
System.out.println(name + "\t" + code);
}
}
sp.stop();
sp.close();
}
}
| [
"444139212@163.com"
] | 444139212@163.com |
68e8c456959bb9dd9ca86e86a8730adc60a86f32 | 9aa2442881eee53298be14fc46d51fb6dcd54f8b | /app/src/main/java/com/myemcu/app_15filestorm/MainActivity.java | 9a549f0b7ecb4a91978c5a6192b7d1bf35b9c525 | [] | no_license | myemcu/FileStorm | 3cd33ff1c564bb5503a5241e30bf7f628d675552 | 351d3dcce29e6678108d83056a78a7a88c4d7290 | refs/heads/master | 2021-01-19T02:38:07.295503 | 2016-08-11T07:50:50 | 2016-08-11T07:50:50 | 65,433,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,499 | java | package com.myemcu.app_15filestorm;
import android.content.Context;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.io.RandomAccessFile;
public class MainActivity extends AppCompatActivity {
private EditText mWriteTxt;
private EditText mReadTxt;
private Button mWrite;
private Button mRead;
private String fileName = "MyFile.txt";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViews();
mWrite.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
write(mWriteTxt.getText().toString()); // 写入输入内容
}
});
mRead.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mReadTxt.setText(read()); // 显示读出内容
}
});
}
private void write(String s) {
try {
//判断手机中的SD卡是否存在
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
File sdCardDir = Environment.getExternalStorageDirectory(); // 获取SD卡路径
File destFile = new File(sdCardDir.getCanonicalPath()+File.separator+fileName); // 根据路径和文件名创建文件
RandomAccessFile raf = new RandomAccessFile(destFile,"rw");
raf.seek(destFile.length()); // 把指针定位到文件末尾
raf.write(s.getBytes()); // 在文件末尾追加新内容
raf.close(); // 关闭文件
}
}
catch (Exception e) {
e.printStackTrace();
}
}
private String read() {
StringBuilder sBuilder = new StringBuilder("");
try { //判断手机中的SD卡是否存在
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
File sdCardDir = Environment.getExternalStorageDirectory(); // 获取SD卡路径
File destFile = new File(sdCardDir.getCanonicalPath()+File.separator+fileName); // 根据路径和文件名创建文件
FileInputStream fis = new FileInputStream(destFile); // 创建文件输入流
byte[] buffer = new byte[64]; // 定义缓冲区大小
int hasread;
while ((hasread=fis.read(buffer)) != -1) { // 一直循环到文件末尾
sBuilder.append(new String(buffer,0,hasread)); // 在字符串后追加内容
}
return sBuilder.toString();
}
}
catch (Exception e) {
e.printStackTrace();
}
return null;
}
private void findViews() {
mWriteTxt = (EditText) findViewById(R.id.writeTxt);
mReadTxt = (EditText) findViewById(R.id.readTxt);
mWrite = (Button) findViewById(R.id.write);
mRead = (Button) findViewById(R.id.read);
}
}
| [
"1142497680@qq.com"
] | 1142497680@qq.com |
ece368cb9b3bf28dabbe72fe2cc05d3aae9577f4 | 8f1bc60018aaa82427c3232ca2bb7bd3d6be9731 | /PizzeriaProyecto/src/PizzeriaDAL/VentaDAL.java | 43c81c8ef27ce1254538097fb0a519d3b9917364 | [] | no_license | Alquen/Pizzeria | 4d6783bedbf2c5ed3b2d1abe18160d513209389f | dfaf9c07644e0f8b248c116e8a9724e0b4070255 | refs/heads/master | 2020-04-07T22:45:57.115220 | 2018-11-28T02:01:22 | 2018-11-28T02:01:22 | 158,784,037 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,560 | 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 PizzeriaDAL;
import PizzeriaBL.VentaBL;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
* @author alque
*/
public class VentaDAL {
ConexionDAL conex = new ConexionDAL();
public int Cobrar(VentaBL ObjVenta){
int Comando = conex.EjecutarComandoSQL("INSERT INTO tblTicket(folio, id_cliente, fecha, total )"+
"VALUES ('"+ ObjVenta.getFolio()+"', '"+ ObjVenta.getId_comprador()+"','"+ ObjVenta.getFecha() +"', '"+ ObjVenta.getTotal()+"' )");
conex.Desconectar();
return Comando;
}
public int Pizza (VentaBL ObjVenta){
int Comando = conex.EjecutarComandoSQL("INSERT INTO tblVenta(folio, id_pizza, cantidad )"+
"VALUES ('"+ ObjVenta.getFolio()+"', '"+ ObjVenta.getId_pizza()+"','"+ ObjVenta.getCantidad() +"' )");
conex.Desconectar();
return Comando;
}
public String LastFolio(){
try{
String res = "";
ResultSet result = conex.EjecutarSentenciaSQL("");
while(result.next()){
String[] Folio = {
result.getString(1)
};
res = Folio[1];
}
return res;
}catch(SQLException e){
return null;
}
}
}
| [
"alque@NecroAny"
] | alque@NecroAny |
3ab8b1a83bd439ccf75716dd99fa5d7f627cee93 | 9311439f8cb946a9aa642a2f1ec6a33e23b93bd1 | /MyHashSet.java | b109ecc511e7fd4d686858607d8d66f19dbafb59 | [] | no_license | khushal1198/Design-2 | 1872926be68bc4bf58e280ab3f736562f1488907 | b00fbd0f77e6775cf752b0194e3ad8534e4d70a5 | refs/heads/master | 2022-04-23T15:41:56.504204 | 2020-04-24T21:23:00 | 2020-04-24T21:23:00 | 258,608,836 | 0 | 0 | null | 2020-04-24T19:47:42 | 2020-04-24T19:47:41 | null | UTF-8 | Java | false | false | 1,459 | java | //Time Complexity : O(1)
//Space Complexity : O(n)
// It did run successfully on Leetcode
// Problems : Understanding why we are taking 1001 rather than taking 1000 for buckets
/*
As we are supposed to just implement contain function, we have implementing a
boolean maxtrix (Not always a matrix)
While adding the element, we'll me marking that index true and the opposite while
removing the element.
*/
class MyHashSet {
int buckets;
int bucketItems;
boolean[][] exist;
public MyHashSet() {
buckets = 1001;
bucketItems = 1000;
exist = new boolean[buckets][];
}
public void add(int key) {
int bucketNo = key%buckets;
int bucketItemNo=key/bucketItems;
if(exist[bucketNo]==null)
{
exist[bucketNo] =new boolean[bucketItems];
}
exist[bucketNo][bucketItemNo] = true;
}
public void remove(int key) {
int bucketNo = key%buckets;
int bucketItemNo = key/bucketItems;
if(exist[bucketNo]==null)return;
else
{
exist[bucketNo][bucketItemNo] = false;
}
}
/** Returns true if this set contains the specified element */
public boolean contains(int key) {
int bucketNo = key%buckets;
int bucketItemNo = key/bucketItems;
if(exist[bucketNo]!=null)
{
return (exist[bucketNo][bucketItemNo]);
}
return false;
}
}
| [
"khushalpujara@gmail.com"
] | khushalpujara@gmail.com |
a30fc3d389a1c0932756320334f950f4334a0066 | bb2daa68babbc7468636a123b0fe8fc5787a71e6 | /custom/custom-dal/src/main/java/com/szy/custom/dal/enums/ExceptionEnum.java | d1dfab14d818d50b3b33b44d2429f945b397fba4 | [] | no_license | suzhongyuan55/imall-server | bb62e2463335affaf8a8f067c0df7ed2631267ea | 0368fbb970ee40ada94c4689a2810e43342733de | refs/heads/master | 2022-12-23T15:40:08.497995 | 2019-10-22T09:29:40 | 2019-10-22T09:29:40 | 216,490,310 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | package com.szy.custom.dal.enums;
import lombok.Getter;
/**
* 已知异常类型枚举
*/
@Getter
public enum ExceptionEnum {
UNKNOW_ERROR(01, "未知错误"),
PARAMETER_ERROR(02, "用户不存在"),
;
private Integer code;
private String msg;
ExceptionEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
}
| [
"suzhongyuan55@163.com"
] | suzhongyuan55@163.com |
f6dddb684424203729b035839052f4883446afbd | f8edcc1e2fedc29524d57981927644dea22d5e1d | /src/main/java/com/capstore/app/models/Coupon.java | 4112c74bd23a8184c218fc9472ef2143831c2622 | [] | no_license | KohliRamanpreet/SomeStore-Billing-Module-Team2 | 655058f253ec593de9398a40dfe196533914ab30 | 3948dce82c57fd3cafdb4b64781a9385a24f89dc | refs/heads/master | 2022-07-26T06:16:05.067395 | 2020-05-17T11:40:48 | 2020-05-17T11:40:48 | 264,462,817 | 0 | 0 | null | 2020-05-16T15:07:06 | 2020-05-16T15:07:05 | null | UTF-8 | Java | false | false | 2,039 | java | package main.java.com.capstore.app.models;
import java.sql.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "coupon")
public class Coupon {
@Id
@Column(name = "coupon_id")
private int couponId;
@Column(name = "coupon_code")
private String couponCode;
@Column(name = "user_id")
private int userId; //(Foreign Key)
@Column(name = "end_date")
private Date couponEndDate;
@Column(name = "start_date")
private Date couponStartDate;
@Column(name = "coupon_amount")
private int couponAmount;
@Column(name = "min_order_amount")
private int couponMinOrderAmount;
@Column(name = "issued_by")
private String issuedBy; //{“Admin”,”Merchant”}
public int getCouponId() {
return couponId;
}
public void setCouponId(int couponId) {
this.couponId = couponId;
}
public String getCouponCode() {
return couponCode;
}
public void setCouponCode(String couponCode) {
this.couponCode = couponCode;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getUserId() {
return userId;
}
public void setUseId(int user_id) {
this.userId = user_id;
}
public Date getCouponEndDate() {
return couponEndDate;
}
public void setCouponEndDate(Date couponEndDate) {
this.couponEndDate = couponEndDate;
}
public Date getCouponStartDate() {
return couponStartDate;
}
public void setCouponStartDate(Date couponStartDate) {
this.couponStartDate = couponStartDate;
}
public int getCouponAmount() {
return couponAmount;
}
public void setCouponAmount(int couponAmount) {
this.couponAmount = couponAmount;
}
public int getCouponMinOrderAmount() {
return couponMinOrderAmount;
}
public void setCouponMinOrderAmount(int couponMinOrderAmount) {
this.couponMinOrderAmount = couponMinOrderAmount;
}
public String getIssuedBy() {
return issuedBy;
}
public void setIssuedBy(String issuedBy) {
this.issuedBy = issuedBy;
}
public Coupon() {
}
}
| [
"himanshu.rathod1998@gmail.com"
] | himanshu.rathod1998@gmail.com |
a2d6a3313d2bc62c4f7a4680f1f130a044179ec2 | 101f24e992407705f5a130fafcec29d6daa37957 | /src/main/java/com/springboot/mydemo/test.java | dea0c950567954344622c4059ce01bf0fd211299 | [] | no_license | TONGNIANMIANBAO/ScheduleJob | 20e04447f7c6227c19932e2ea3a2393547ae3158 | 5914fd990ab79157911e792e9c3a5887a83d0193 | refs/heads/master | 2022-07-02T13:46:55.535224 | 2020-05-09T08:53:34 | 2020-05-09T08:53:34 | 262,531,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,232 | java | package com.springboot.mydemo;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.exception.InvalidConfigurationException;
import org.mybatis.generator.exception.XMLParserException;
import org.mybatis.generator.internal.DefaultShellCallback;
public class test {
public static void main(String[] args)
throws SQLException, IOException, InterruptedException, XMLParserException, InvalidConfigurationException {
List<String> warnings = new ArrayList<String>();
boolean overwrite = true;
File configFile = new File(".\\src\\main\\resources\\mybatis-generator.xml");
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(configFile);
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
myBatisGenerator.generate(null);
System.out.println("finish");
}
}
| [
"SEN@CHEN.COM"
] | SEN@CHEN.COM |
04f1072b9c28dc09d4ab22e8d1dbfb45d5c59750 | dbb93b6b1f53a5cd29d4dcb53cc00b52f40945da | /FindingGene/StringsSecondAssignment/findABC.java | f7fd31cd005d37e767d934efe65a9365bd0ef78b | [] | no_license | shipkhattri/Java-Programming-Solving-Problems-with-Software | 575a485f481e71baced14ac07943bc7c5cd3ee56 | c47fb7d5ede8c0f12b9a06dc99d2dc2d85c52257 | refs/heads/master | 2022-11-17T06:17:35.809280 | 2020-07-12T20:03:46 | 2020-07-12T20:03:46 | 270,544,833 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 609 | java |
/**
* Write a description of findABC here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class findABC {
public void findAbc(String input){
int index = input.indexOf("abc");
while (true){
if (index == -1 || index >= input.length() - 3){
break;
}
String found = input.substring(index+1, index+4);
System.out.println(found);
index = input.indexOf("abc",index+3);
}
}
public void test(){
//findAbc("abcd");
findAbc("abcabcabcabca");
}
}
| [
"noreply@github.com"
] | shipkhattri.noreply@github.com |
e11b469a77c279714815a8ca617d91e8eb781a73 | 081a308ae963c5004393dd3b79a4cb9c09ee9bac | /java/CdmController/app/src/main/java/org/alljoyn/cdmcontroller/activity/operation/AirRecirculationModeActivity.java | 5b7f444f6cf72f9461357c568ab7708f885468ab | [] | no_license | alljoyn/cdm | 2b2b2375011b5e504f026d05a997197f5a31e41d | 007981e4c07158722c2308ee20e9abcb8fd72a39 | refs/heads/master | 2021-09-25T15:00:54.684234 | 2018-04-06T21:43:40 | 2018-04-06T21:43:40 | 112,535,907 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,368 | java | /*
* Copyright AllSeen Alliance. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package org.alljoyn.cdmcontroller.activity.operation;
import android.view.View;
import org.alljoyn.cdmcontroller.activity.InterfaceActivity;
import org.alljoyn.cdmcontroller.view.property.ReadWriteBoolPropertyView;
public class AirRecirculationModeActivity extends InterfaceActivity {
@Override
protected void generatePropertyView(CustomView properties, CustomView methods) {
View isRecirculatingView = new ReadWriteBoolPropertyView(this, this.intf, "IsRecirculating");
properties.addView(isRecirculatingView);
}
}
| [
"youngkyun.jin@lge.com"
] | youngkyun.jin@lge.com |
3693775e1959353ae5843e781caa080b4c24a3ba | 16d8840daa8e8c6c73a7c89b1b4ff1614b8dbe8d | /bluej/Direction.java | 1f7bacc5aad048e920167ef8002258f29be5a35f | [] | no_license | creamchzdragon/Five-Points | e6f8b177215ff316c74c8a8f55c42c1863310aaf | 72b335790240e172dea7882b6b3982d8018b21e5 | refs/heads/master | 2020-12-26T01:13:10.140886 | 2015-10-06T22:48:59 | 2015-10-06T22:48:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 124 | java |
/**
* Direction is a simple enum for basic directions.
*/
public enum Direction {
Up,
Down,
Left,
Right
} | [
"nathanpisarski@gmail.com"
] | nathanpisarski@gmail.com |
1b3cca1666bd58097f39212e8a42ee35fe68a874 | c6992ce8db7e5aab6fd959c0c448659ab91b16ce | /sdk/avs/azure-resourcemanager-avs/src/main/java/com/azure/resourcemanager/avs/models/VisibilityParameterEnum.java | a4d869f469f239116db753c056e1f4b164ae6180 | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"CC0-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later"
] | permissive | g2vinay/azure-sdk-for-java | ae6d94d583cc2983a5088ec8f6146744ee82cb55 | b88918a2ba0c3b3e88a36c985e6f83fc2bae2af2 | refs/heads/master | 2023-09-01T17:46:08.256214 | 2021-09-23T22:20:20 | 2021-09-23T22:20:20 | 161,234,198 | 3 | 1 | MIT | 2020-01-16T20:22:43 | 2018-12-10T20:44:41 | Java | UTF-8 | Java | false | false | 1,311 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.avs.models;
import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;
/** Defines values for VisibilityParameterEnum. */
public final class VisibilityParameterEnum extends ExpandableStringEnum<VisibilityParameterEnum> {
/** Static value Visible for VisibilityParameterEnum. */
public static final VisibilityParameterEnum VISIBLE = fromString("Visible");
/** Static value Hidden for VisibilityParameterEnum. */
public static final VisibilityParameterEnum HIDDEN = fromString("Hidden");
/**
* Creates or finds a VisibilityParameterEnum from its string representation.
*
* @param name a name to look for.
* @return the corresponding VisibilityParameterEnum.
*/
@JsonCreator
public static VisibilityParameterEnum fromString(String name) {
return fromString(name, VisibilityParameterEnum.class);
}
/** @return known VisibilityParameterEnum values. */
public static Collection<VisibilityParameterEnum> values() {
return values(VisibilityParameterEnum.class);
}
}
| [
"noreply@github.com"
] | g2vinay.noreply@github.com |
2b6ddcc8da994b8df0047e80c3fa6487a4a57678 | 5ac60b140812a326e5112bee9daf8111bbe1d431 | /app/src/main/java/ua/com/expertsolution/chesva/adapter/FacilityListAdapter.java | 266e6dd2edd7b3aa4d32ef066b3f2d5c1f35c38c | [] | no_license | chrisgate/ChesvaExample | e38760e120ec090d4dda6340d42a773dd2dd18ab | ad4deef08fda29328f817fa5bb11801cd98eacc1 | refs/heads/master | 2023-02-19T05:49:16.353171 | 2021-01-20T09:16:00 | 2021-01-20T09:16:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,169 | java | package ua.com.expertsolution.chesva.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import ua.com.expertsolution.chesva.R;
import ua.com.expertsolution.chesva.common.Consts;
import ua.com.expertsolution.chesva.model.db.Facility;
public class FacilityListAdapter extends RecyclerView.Adapter<FacilityListAdapter.FacilityViewHolder> {
private final Context context;
private List<Facility> list;
private LayoutInflater inflater;
private static AdapterListener adapterListener;
public FacilityListAdapter(Context context, AdapterListener adapterListener) {
this.context = context;
this.list = new ArrayList<>();
this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.adapterListener = adapterListener;
}
public FacilityListAdapter(Context context, List<Facility> list) {
this.context = context;
this.list = list;
}
public void setList(List<Facility> newlist){
this.list = newlist;
this.notifyDataSetChanged();
}
public List<Facility> getList() {
return list;
}
public void addList(List<Facility> newlist){
list.addAll(newlist);
this.notifyDataSetChanged();
}
public void clearList(){
list.clear();
this.notifyDataSetChanged();
}
public Facility getItem(int i) {
return list.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public int getItemCount() {
return list.size();
}
public static class FacilityViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
ImageView icon;
TextView name;
TextView rfid;
public FacilityViewHolder(@NonNull View itemView) {
super(itemView);
// icon = itemView.findViewById(R.id.icon);
// name = itemView.findViewById(R.id.name);
// rfid = itemView.findViewById(R.id.rfid);
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
}
@Override
public void onClick(View view) {
adapterListener.onItemClick(getAdapterPosition(), view);
}
@Override
public boolean onLongClick(View view) {
return adapterListener.onLongItemClick(getAdapterPosition(), view);
}
}
@NonNull
@Override
public FacilityViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
return new FacilityViewHolder(inflater.inflate(R.layout.main_asset_list_item, viewGroup, false));
}
@Override
public void onBindViewHolder(@NonNull FacilityViewHolder viewHolder, final int i) {
Facility item = getItem(i);
if (item != null) {
viewHolder.name.setText(item.getName()+" ("+item.getInventoryNumber()+")");
viewHolder.rfid.setText(item.getRfid());
switch (item.getState()) {
case Consts.STATE_IN_SEARCH_OF:
Picasso.get()
.load(R.drawable.ic_search)
.error(R.drawable.ic_priority)
.into(viewHolder.icon);
break;
case Consts.STATE_FOUND:
Picasso.get()
.load(R.drawable.ic_check)
.error(R.drawable.ic_priority)
.into(viewHolder.icon);
break;
case Consts.STATE_EXCESSIVE:
Picasso.get()
.load(R.drawable.ic_clear)
.error(R.drawable.ic_priority)
.into(viewHolder.icon);
break;
case Consts.STATE_CONFIRMED:
Picasso.get()
.load(R.drawable.ic_add)
.error(R.drawable.ic_priority)
.into(viewHolder.icon);
break;
case Consts.STATE_MISSING:
Picasso.get()
.load(R.drawable.ic_priority)
.error(R.drawable.ic_priority)
.into(viewHolder.icon);
break;
case Consts.STATE_CREATED:
Picasso.get()
.load(R.drawable.ic_created)
.error(R.drawable.ic_priority)
.into(viewHolder.icon);
break;
}
}
}
public interface AdapterListener {
void onItemClick(int position, View v);
boolean onLongItemClick(int position, View v);
}
}
| [
"ardix.dev@gmail.com"
] | ardix.dev@gmail.com |
e7f9497c154716501685ccaead35d9aed0628717 | 6b258fed5b290ded90d5f681c70300027ce4afdb | /app/src/main/java/com/example/malik/foodstore/adapters/CartAdapter.java | 6f41d0fdcdce210911f0e2b78c7793224946e95f | [] | no_license | ritu92/FoodStore | 5488385275255407b2e497fd90b31874ecde85fb | 11cc5238b6e2dfaf407d5b310af57fe2f2f9c46f | refs/heads/master | 2020-12-02T17:54:32.843393 | 2017-07-11T14:35:16 | 2017-07-11T14:35:16 | 96,445,696 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,572 | java | package com.example.malik.foodstore.adapters;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.malik.foodstore.R;
import com.example.malik.foodstore.model.CartList;
import java.util.ArrayList;
/**
* Created by malik on 7/6/2017.
* Adapter to display items in the cart
* Lets you delete existing items
* Can increase or decrease quantity ot items
*/
public class CartAdapter extends RecyclerView.Adapter<CartAdapter.ViewHolder>{
ArrayList<CartList> cartListItems;
private Context context;
/**
* Constructor to access Cart adapter in other places
* @param cartListItems items you want to add
* @param context returns current context to apply
*/
public CartAdapter(ArrayList<CartList> cartListItems, Context context) {
this.cartListItems = cartListItems;
this.context = context;
}
/**
* inflates selected layout from fragment for the cart
* @param parent parent view
* @param viewType
* @return inflates the view
*/
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(context)
.inflate(R.layout.cart_detail_fragment,parent,false);
return new CartAdapter.ViewHolder(v);
}
/**
* binds the view holder to the adapter view
* @param holder We need cart adapter's view holder
* @param position sets separate values to each position in the cart
*/
@Override
public void onBindViewHolder(final CartAdapter.ViewHolder holder, int position) {
CartList cartList = cartListItems.get(position);
holder.cart_price.setText(cartList.getCart_price());
holder.cart_name.setText(cartList.getCart_name());
}
/**
* gets count of the array list we are populating in the view
* @return returns size of array
*/
@Override
public int getItemCount() {
//return 0;
return cartListItems.size();
}
/**
* assigns view by id to each view in the cart fragment item
*/
public class ViewHolder extends RecyclerView.ViewHolder{
TextView cart_price, cart_name;
public ViewHolder(View itemView) {
super(itemView);
cart_price = (TextView)itemView.findViewById(R.id.cart_price);
cart_name = (TextView)itemView.findViewById(R.id.cart_name);
}
}
}
| [
"ritu92@vt.edu"
] | ritu92@vt.edu |
172c01acbe9e0f84e699eeb1a2386039030194af | 154596d4f5691327ef9aaa328eb085c45b11c12a | /src/main/java/com/celfocus/training/spaceover/spaceship/manager/enums/SpaceShipStatus.java | 4e6f34e1e493c6ca31cb7101f73eb35b2de65eb5 | [] | no_license | jdiaspinheiro/SO_spaceship-manager | 9fcb5f7c7496095e901498ffe79662e6086ea8c0 | 5c1006a45fe922c8b2575a3de02c6fa280b156d5 | refs/heads/main | 2023-05-31T09:31:07.276476 | 2021-07-05T09:45:49 | 2021-07-05T09:45:49 | 376,081,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 123 | java | package com.celfocus.training.spaceover.spaceship.manager.enums;
public enum SpaceShipStatus {
ACTIVE,
INACTIVE
}
| [
"NB27498@novabase.pt"
] | NB27498@novabase.pt |
62a258f308a97c404ba43d847ac8b1524c4a72e4 | 701532712b9172b6f047effa9043fc1ee2c2cd46 | /src/main/java/com/none/authcenter/utils/STD3DesUtil.java | cc0ea0de9da94202c0053d66b3699a7306ffb958 | [] | no_license | hurgebao/authcenter | edf4cb9bb4e90bdd6b3368206981c55d456bf866 | a4f26e679cf2c631af6378706e4e594582af5d53 | refs/heads/master | 2022-07-16T04:40:04.446354 | 2019-10-31T02:13:18 | 2019-10-31T02:13:18 | 211,275,819 | 0 | 0 | null | 2022-06-24T02:24:46 | 2019-09-27T08:45:51 | Java | UTF-8 | Java | false | false | 3,718 | java | package com.none.authcenter.utils;
import org.apache.tomcat.util.codec.binary.Base64;
import java.security.Key;
import javax.crypto.Cipher;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESedeKeySpec;
import javax.crypto.spec.IvParameterSpec;
public class STD3DesUtil {
/**
* 加密 先加密再转为base64编码
* @param keyStr
* @param dataStr
* @return
* @throws Exception
*/
public static String des3EncodeECBBase64String(String keyStr,String dataStr) throws Exception{
byte[] data = dataStr.getBytes("UTF-8");
byte[] key = keyStr.getBytes();
byte[] result = des3EncodeECB(key, data);
return Base64.encodeBase64String(result);
}
/**
* 解密 先将base64字符串转换再解密
* @param keyStr
* @param base64DataStr
* @return
* @throws Exception
*/
public static String des3DecodeECBBase64String(String keyStr,String base64DataStr) throws Exception{
byte[] data = Base64.decodeBase64(base64DataStr);
byte[] key = keyStr.getBytes();
byte[] result = des3DecodeECB(key, data);
return new String(result, "UTF-8");
}
/**
* ECB加密,不要IV
*
* @param key
* 密钥
* @param data
* 明文
* @return Base64编码的密码
* @throws Exception
*/
public static byte[] des3EncodeECB(byte[] key, byte[] data) throws Exception {
Key deskey = null;
DESedeKeySpec spec = new DESedeKeySpec(key);
SecretKeyFactory keyfactory = SecretKeyFactory.getInstance("desede");
deskey = keyfactory.generateSecret(spec);
Cipher cipher = Cipher.getInstance("desede" + "/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, deskey);
byte[] bOut = cipher.doFinal(data);
return bOut;
}
/**
* ECB解密,不要IV
*
* @param key
* 密钥
* @param data
* Base64编码的密码
* @return 明文
* @throws Exception
*/
public static byte[] des3DecodeECB(byte[] key, byte[] data) throws Exception {
Key deskey = null;
DESedeKeySpec spec = new DESedeKeySpec(key);
SecretKeyFactory keyfactory = SecretKeyFactory.getInstance("desede");
deskey = keyfactory.generateSecret(spec);
Cipher cipher = Cipher.getInstance("desede" + "/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, deskey);
byte[] bOut = cipher.doFinal(data);
return bOut;
}
/**
* CBC加密
*
* @param key
* 密钥
* @param keyiv
* IV
* @param data
* 明文
* @return Base64编码的密码
* @throws Exception
*/
public static byte[] des3EncodeCBC(byte[] key, byte[] keyiv, byte[] data) throws Exception {
Key deskey = null;
DESedeKeySpec spec = new DESedeKeySpec(key);
SecretKeyFactory keyfactory = SecretKeyFactory.getInstance("desede");
deskey = keyfactory.generateSecret(spec);
Cipher cipher = Cipher.getInstance("desede" + "/CBC/PKCS5Padding");
IvParameterSpec ips = new IvParameterSpec(keyiv);
cipher.init(Cipher.ENCRYPT_MODE, deskey, ips);
byte[] bOut = cipher.doFinal(data);
return bOut;
}
/**
* CBC解密
*
* @param key
* 密钥
* @param keyiv
* IV
* @param data
* Base64编码的密码
* @return 明文
* @throws Exception
*/
public static byte[] des3DecodeCBC(byte[] key, byte[] keyiv, byte[] data) throws Exception {
Key deskey = null;
DESedeKeySpec spec = new DESedeKeySpec(key);
SecretKeyFactory keyfactory = SecretKeyFactory.getInstance("desede");
deskey = keyfactory.generateSecret(spec);
Cipher cipher = Cipher.getInstance("desede" + "/CBC/PKCS5Padding");
IvParameterSpec ips = new IvParameterSpec(keyiv);
cipher.init(Cipher.DECRYPT_MODE, deskey, ips);
byte[] bOut = cipher.doFinal(data);
return bOut;
}
} | [
"286316993@qq.com"
] | 286316993@qq.com |
8ab6ba708326ca34ff273f63115f6baf373637c5 | 21edc5cc3c88e4ce06631bd1b10aa8f7f0c255f7 | /vsf/src/java/com/vesmile/framework/dao/H3Support.java | e0e4458b3911efbc2d14bf6b4bb20b8b291e5320 | [] | no_license | chendl/vesmile | 08f13bec5b53d60675677df6522df4cf06babafd | 2a94f5d7773f4ac16dea329fc5f3bb145e129272 | refs/heads/master | 2020-04-02T12:57:01.716534 | 2014-04-09T04:45:00 | 2014-04-09T04:45:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 597 | java | package com.vesmile.framework.dao;
import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;
public class H3Support {
private SessionFactory sessionFactory;
private HibernateTemplate template;
private SessionFactory getSessionFactory() {
return sessionFactory;
}
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
public HibernateTemplate getTemplate(){
if(template == null){
template = new HibernateTemplate(getSessionFactory());
}
return template;
}
}
| [
"chendl@vesmile.com"
] | chendl@vesmile.com |
f67b8493bc316d8caec8ac04e1e223db7ddb2182 | c20af69f7b2b0c3f41d0ad62a8a76e560e0e0b2c | /basex-core/src/main/java/org/basex/query/value/item/Int.java | 40cd8a20fe272c7f2918df2d02635fe12086becf | [
"BSD-3-Clause"
] | permissive | ehsan-keshavarzian/basex | 6159254877d1e7b627c8e0c8daea5600ced109bf | 1a1da05853de12fed51675317bf3b0a641c98078 | refs/heads/master | 2021-08-23T02:57:05.929847 | 2017-12-02T18:18:28 | 2017-12-02T18:18:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,841 | java | package org.basex.query.value.item;
import java.math.*;
import org.basex.query.*;
import org.basex.query.util.collation.*;
import org.basex.query.value.type.*;
import org.basex.util.*;
/**
* Integer item ({@code xs:int}, {@code xs:integer}, {@code xs:short}, etc.).
*
* @author BaseX Team 2005-17, BSD License
* @author Christian Gruen
*/
public final class Int extends ANum {
/** Maximum values. */
public static final Int MAX;
/** Value 0. */
public static final Int ZERO;
/** Value 1. */
public static final Int ONE;
/** Constant values. */
private static final Int[] INTSS;
/** Integer value. */
private final long value;
// caches the first 128 integers
static {
final int nl = 128;
INTSS = new Int[nl];
for(int n = 0; n < nl; n++) INTSS[n] = new Int(n);
MAX = get(Long.MAX_VALUE);
ZERO = INTSS[0];
ONE = INTSS[1];
}
/**
* Constructor.
* @param value value
*/
private Int(final long value) {
this(value, AtomType.ITR);
}
/**
* Constructor.
* @param value value
* @param type item type
*/
public Int(final long value, final Type type) {
super(type);
this.value = value;
}
/**
* Returns an instance of this class.
* @param value value
* @return instance
*/
public static Int get(final long value) {
return value >= 0 && value < INTSS.length ? INTSS[(int) value] : new Int(value);
}
/**
* Returns an instance of this class.
* @param value value
* @param type item type
* @return instance
*/
public static Int get(final long value, final Type type) {
return type == AtomType.ITR ? get(value) : new Int(value, type);
}
@Override
public byte[] string() {
return value == 0 ? Token.ZERO : Token.token(value);
}
@Override
public boolean bool(final InputInfo ii) {
return value != 0;
}
@Override
public long itr() {
return value;
}
@Override
public float flt() {
return value;
}
@Override
public double dbl() {
return value;
}
@Override
public Item test(final QueryContext qc, final InputInfo ii) {
return value == qc.focus.pos ? this : null;
}
@Override
public BigDecimal dec(final InputInfo ii) {
return BigDecimal.valueOf(value);
}
@Override
public Int abs() {
return value < 0 ? get(-value) : this;
}
@Override
public Int ceiling() {
return this;
}
@Override
public Int floor() {
return this;
}
@Override
public ANum round(final int scale, final boolean even) {
final long v = rnd(scale, even);
return v == value ? this : get(v);
}
/**
* Returns a rounded value.
* @param s scale
* @param e half-to-even flag
* @return result
*/
private long rnd(final int s, final boolean e) {
long v = value;
if(s >= 0 || v == 0) return v;
if(s < -15) return Dec.get(new BigDecimal(v)).round(s, e).itr();
long f = 1;
final int c = -s;
for(long i = 0; i < c; i++) f = (f << 3) + (f << 1);
final boolean n = v < 0;
final long a = n ? -v : v, m = a % f, d = m << 1;
v = a - m;
if(e ? d > f || d == f && v % (f << 1) != 0 : n ? d > f : d >= f) v += f;
return n ? -v : v;
}
@Override
public boolean eq(final Item it, final Collation coll, final StaticContext sc,
final InputInfo ii) throws QueryException {
return it instanceof Int ? value == ((Int) it).value :
it.type != AtomType.DEC ? value == it.dbl(ii) :
it.eq(this, coll, sc, ii);
}
@Override
public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException {
if(it instanceof Int) return Long.compare(value, ((Int) it).value);
final double n = it.dbl(ii);
return Double.isNaN(n) ? UNDEF : value < n ? -1 : value > n ? 1 : 0;
}
@Override
public Object toJava() {
switch((AtomType) type) {
case BYT: return (byte) value;
case SHR:
case UBY: return (short) value;
case INT:
case USH: return (int) value;
case LNG:
case UIN: return value;
default: return new BigInteger(toString());
}
}
@Override
public boolean equals(final Object obj) {
if(this == obj) return true;
if(!(obj instanceof Int)) return false;
final Int i = (Int) obj;
return type == i.type && value == i.value;
}
/**
* Converts the given item to a long primitive.
* @param item item to be converted
* @param info input info
* @return long value
* @throws QueryException query exception
*/
public static long parse(final Item item, final InputInfo info) throws QueryException {
final byte[] value = item.string(info);
final long l = Token.toLong(value);
if(l != Long.MIN_VALUE || Token.eq(Token.trim(value), Token.MINLONG)) return l;
throw AtomType.ITR.castError(item, info);
}
}
| [
"christian.gruen@gmail.com"
] | christian.gruen@gmail.com |
03cf2b2d0b120c9ce7d6beb581f900ca1f95a33c | bfad430a65351afd8b28ee506203c6b539e29913 | /app/src/main/java/com/marcelo/marvelsuperheroes/HeroesFragment.java | 8cbc022cbdc36f4c07d2e00dc08a4b29c688b762 | [] | no_license | MarceloDJunior/MarvelSuperHeroes | b5b129e1b224633fca0d6cae939eb7d25cdf1e56 | a87fdb2dc488b97d0b5ce9a64e8d9c0f20b3f706 | refs/heads/main | 2023-03-08T20:19:11.092753 | 2021-02-23T23:06:05 | 2021-02-23T23:06:05 | 309,220,867 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,026 | java | package com.marcelo.marvelsuperheroes;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.marcelo.marvelsuperheroes.adapters.HeroesAdapter;
import com.marcelo.marvelsuperheroes.models.Hero;
import com.marcelo.marvelsuperheroes.models.HeroDataContainer;
import com.marcelo.marvelsuperheroes.models.HeroDataWrapper;
import com.marcelo.marvelsuperheroes.models.HeroImage;
import com.marcelo.marvelsuperheroes.services.RetrofitConfig;
import com.marcelo.marvelsuperheroes.utils.Constants;
import com.marcelo.marvelsuperheroes.utils.Utils;
import java.util.ArrayList;
import java.util.Date;
/**
* A simple {@link Fragment} subclass.
* Use the {@link HeroesFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class HeroesFragment extends Fragment {
private RecyclerView rvHeroes;
private ProgressBar progressBar;
private ProgressBar progressBarLoadMore;
private TextView tvError;
private LinearLayoutManager layoutManager;
private ArrayList<Hero> heroes;
private HeroesAdapter heroesAdapter;
private boolean isLoading = false;
private boolean loadedAll = false;
private int PAGE_SIZE = 20;
public HeroesFragment() {
// Required empty public constructor
}
public static HeroesFragment newInstance() {
HeroesFragment fragment = new HeroesFragment();
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_heroes, container, false);
progressBar = v.findViewById(R.id.pb_load_heroes);
progressBarLoadMore = v.findViewById(R.id.pb_load_more_heroes);
tvError = v.findViewById(R.id.tv_err_heroes);
rvHeroes = v.findViewById(R.id.rv_heroes);
layoutManager = new LinearLayoutManager(this.getContext());
rvHeroes.setLayoutManager(layoutManager);
heroes = new ArrayList<>();
heroesAdapter = new HeroesAdapter(heroes);
rvHeroes.setAdapter(heroesAdapter);
rvHeroes.addOnScrollListener(rvOnScrollListener);
heroesAdapter.setOnItemClickListener(heroClick);
loadHeroes();
return v;
}
private HeroesAdapter.OnItemClickListener heroClick = new HeroesAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
Hero hero = heroes.get(position);
FragmentManager fm = getActivity().getSupportFragmentManager();
HeroDetailsFragment heroDetailsFragment = HeroDetailsFragment.newInstance(hero);
heroDetailsFragment.show(fm, "");
}
};
private void loadHeroes() {
rvHeroes.setVisibility(View.GONE);
tvError.setVisibility(View.GONE);
progressBar.setVisibility(View.VISIBLE);
getHeroesFromServer();
}
private void loadMoreHeroes() {
progressBarLoadMore.setVisibility(View.VISIBLE);
tvError.setVisibility(View.GONE);
progressBar.setVisibility(View.VISIBLE);
getHeroesFromServer();
}
private RecyclerView.OnScrollListener rvOnScrollListener = new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int visibleItemCount = layoutManager.getChildCount();
int totalItemCount = layoutManager.getItemCount();
int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition();
if (!isLoading && !loadedAll) {
if ((visibleItemCount + firstVisibleItemPosition) >= totalItemCount
&& firstVisibleItemPosition >= 0
&& totalItemCount >= PAGE_SIZE) {
loadMoreHeroes();
}
}
}
};
private void getHeroesFromServer() {
isLoading = true;
Long ts = System.currentTimeMillis()/1000;
Call<HeroDataWrapper> call = new RetrofitConfig()
.getMarvelService()
.getHeroes(ts.toString(), Constants.MARVEL_PUBLIC_API_KEY, Utils.getHashKey(), "name", PAGE_SIZE, heroes.size());
call.enqueue(new Callback<HeroDataWrapper>() {
@Override
public void onResponse(Call<HeroDataWrapper> call, Response<HeroDataWrapper> response) {
Log.d("MarvelService", response.toString());
if (response.isSuccessful()) {
HeroDataWrapper heroDataWrapper = response.body();
if (heroDataWrapper.getCode() == 200) {
HeroDataContainer heroesData = heroDataWrapper.getData();
ArrayList<Hero> heroesReceived = heroesData.getResults();
heroes.addAll(heroesReceived);
heroesAdapter.notifyDataSetChanged();
isLoading = false;
if(heroes.size() >= heroesData.getTotal()) {
loadedAll = true;
}
getHeroesSuccess();
} else {
getHeroesFail();
}
} else {
isLoading = false;
getHeroesFail();
}
}
@Override
public void onFailure(Call<HeroDataWrapper> call, Throwable t) {
Log.e("MarvelService ", "Erro:" + t.getMessage());
isLoading = false;
getHeroesFail();
}
});
}
private void getHeroesSuccess() {
rvHeroes.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
tvError.setVisibility(View.GONE);
progressBarLoadMore.setVisibility(View.GONE);
}
private void getHeroesFail() {
rvHeroes.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
tvError.setText(R.string.error_server);
tvError.setVisibility(View.VISIBLE);
progressBarLoadMore.setVisibility(View.GONE);
}
} | [
"marcelo_dj28@hotmail.com"
] | marcelo_dj28@hotmail.com |
3eba1e65e8e64aded6f58558ae680f5c4a83ab16 | 8d37d9ca2d630183687255746881f8640ab4d0ab | /src/test/java/de/jamba/hudson/plugin/wsclean/TaskUtilsTest.java | 6864dfeaae1ecfc088eb22c12fc91e7c956d6e21 | [
"MIT"
] | permissive | jenkinsci/wsclean-plugin | d3a86c3b53b2ec9041861888e28ba59cb936b9a5 | 0f3bb6301328643d7cb4ebea486a9ba2bca7a9a0 | refs/heads/master | 2023-08-30T02:41:05.879925 | 2022-07-13T15:06:03 | 2022-07-13T15:06:03 | 1,163,815 | 6 | 15 | MIT | 2023-06-13T14:20:12 | 2010-12-13T05:59:53 | Java | UTF-8 | Java | false | false | 9,804 | java | package de.jamba.hudson.plugin.wsclean;
import static de.jamba.hudson.plugin.wsclean.TaskUtils.runWithTimeout;
import static de.jamba.hudson.plugin.wsclean.TaskUtils.runWithoutTimeout;
import static de.jamba.hudson.plugin.wsclean.TaskUtils.waitUntilAllAreDone;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.hamcrest.Matchers.*;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeoutException;
import org.junit.Test;
import com.google.common.collect.Lists;
public class TaskUtilsTest {
@Test
public void runWithoutTimeoutGivenTaskThatReturnsThenResultsResult() throws Exception {
// Given
final Integer expected = 123;
final Callable<Integer> task = mkTaskThatReturns(expected);
// When
final Integer actual = runWithoutTimeout(task);
// Then
assertThat(actual, equalTo(expected));
}
@Test
public void runWithoutTimeoutGivenTaskThatThrowsRTEThenThrowsThatRTE() throws Exception {
// Given
final RuntimeException expected = new RuntimeException("expected");
final Callable<Integer> task = mkTaskThatThrows(expected);
// When
try {
runWithoutTimeout(task);
fail("Expected " + expected);
} catch (RuntimeException actual) {
// Then
assertThat(actual, equalTo(expected));
}
}
@Test
public void runWithoutTimeoutGivenTaskThatsInterruptedThenThrowsIE() throws Exception {
// Given
final InterruptedException expected = new InterruptedException("expected");
final Callable<Integer> task = mkTaskThatThrows(expected);
// When
try {
runWithoutTimeout(task);
fail("Expected " + expected);
} catch (InterruptedException actual) {
// Then
assertThat(actual, equalTo(expected));
}
}
@Test
public void runWithoutTimeoutGivenTaskThatThrowsAnythingElseThenWrapsIt() throws Exception {
// Given
final Exception expected = new Exception("expected-to-be-wrapped");
final Callable<Integer> task = mkTaskThatThrows(expected);
// When
try {
runWithoutTimeout(task);
fail("Expected " + expected);
} catch (RuntimeException ex) {
// Then
final Throwable actual = ex.getCause();
assertThat(actual, equalTo(expected));
}
}
@Test
public void runWithTimeoutGivenTaskThatReturnsThenResultsResultImmediately() throws Exception {
// Given
final ExecutorService threadpool = Executors.newSingleThreadExecutor();
final long timeoutInMs = 60000L;
final long maxExpectedExecutionDurationInMs = 100L;
final Integer expected = 123;
final Callable<Integer> task = mkTaskThatReturns(expected);
// When
final long msBeforeRun = System.currentTimeMillis();
final Integer actual = runWithTimeout(threadpool, timeoutInMs, task);
final long msAfterRun = System.currentTimeMillis();
// Then
assertThat(actual, equalTo(expected));
final long actualDuration = msAfterRun - msBeforeRun;
assertThat(actualDuration, lessThan(maxExpectedExecutionDurationInMs));
}
@Test
public void runWithTimeoutGivenTaskThatTakesTooLongToReturnThenThrowsTimeout() throws Exception {
// Given
final ExecutorService threadpool = Executors.newSingleThreadExecutor();
final long timeoutInMs = 50L;
final long maxExpectedExecutionDurationInMs = timeoutInMs + 100L;
final Callable<Integer> task = mkTaskThatReturnsAfterDelay(123, timeoutInMs + 1000L);
// When
final long msBeforeRun = System.currentTimeMillis();
try {
runWithTimeout(threadpool, timeoutInMs, task);
fail("Expecting timeout");
} catch (TimeoutException expected) {
// expected
}
final long msAfterRun = System.currentTimeMillis();
// Then
final long actualDuration = msAfterRun - msBeforeRun;
assertThat(actualDuration, lessThan(maxExpectedExecutionDurationInMs));
final boolean thisThreadWasInterrupted = Thread.currentThread().isInterrupted();
assertThat(thisThreadWasInterrupted, is(false));
}
@Test
public void runWithTimeoutGivenTaskThatThrowsRTEThenThrowsThatRTE() throws Exception {
// Given
final ExecutorService threadpool = Executors.newSingleThreadExecutor();
final long timeoutInMs = 60000L;
final RuntimeException expected = new RuntimeException("expected");
final Callable<Integer> task = mkTaskThatThrows(expected);
// When
try {
runWithTimeout(threadpool, timeoutInMs, task);
fail("Expected " + expected);
} catch (RuntimeException actual) {
// Then
assertThat(actual, equalTo(expected));
}
}
@Test
public void runWithTimeoutGivenTaskThatsInterruptedThenThrowsIE() throws Exception {
// Given
final ExecutorService threadpool = Executors.newSingleThreadExecutor();
final long timeoutInMs = 60000L;
final InterruptedException expected = new InterruptedException("expected");
final Callable<Integer> task = mkTaskThatThrows(expected);
// When
try {
runWithTimeout(threadpool, timeoutInMs, task);
fail("Expected " + expected);
} catch (InterruptedException actual) {
// Then
assertThat(actual, equalTo(expected));
}
}
@Test
public void runWithTimeoutGivenTaskThatThrowsAnythingElseThenWrapsIt() throws Exception {
// Given
final ExecutorService threadpool = Executors.newSingleThreadExecutor();
final long timeoutInMs = 60000L;
final Exception expected = new Exception("expected-to-be-wrapped");
final Callable<Integer> task = mkTaskThatThrows(expected);
// When
try {
runWithTimeout(threadpool, timeoutInMs, task);
fail("Expected " + expected);
} catch (RuntimeException ex) {
// Then
final Throwable actual = ex.getCause();
assertThat(actual, equalTo(expected));
}
}
@Test
public void waitUntilAllAreDoneGivenNothingThenReturnsImmediately() throws Exception {
// Given
final long maxExpectedExecutionDurationInMs = 100L;
final Iterable<Future<?>> tasks = Collections.emptyList();
// When
final long msBeforeRun = System.currentTimeMillis();
waitUntilAllAreDone(tasks);
final long msAfterRun = System.currentTimeMillis();
// Then
final long actualDuration = msAfterRun - msBeforeRun;
assertThat(actualDuration, lessThan(maxExpectedExecutionDurationInMs));
}
@Test
public void waitUntilAllAreDoneGivenWorkingTasksThenReturnsImmediatelyAfterLastCompletes() throws Exception {
// Given
final ExecutorService threadpool = Executors.newFixedThreadPool(4);
final long minExpectedExecutionDurationInMs = 105L;
final long maxExpectedExecutionDurationInMs = minExpectedExecutionDurationInMs + 100L;
final Callable<Integer> task10 = mkTaskThatThrows(new Exception("should-be-swallowed"));
final Callable<Integer> task30 = mkTaskThatReturnsAfterDelay(123, 50L);
final Callable<Integer> task50 = mkTaskThatReturnsAfterDelay(123, 40L);
final Callable<Integer> task70 = mkTaskThatReturnsAfterDelay(123, minExpectedExecutionDurationInMs);
final List<Future<?>> tasks = Lists.newArrayList();
tasks.add(threadpool.submit(task10));
tasks.add(threadpool.submit(task30));
tasks.add(threadpool.submit(task50));
final long msBeforeRun = System.currentTimeMillis();
tasks.add(threadpool.submit(task70));
// When
waitUntilAllAreDone(tasks);
final long msAfterRun = System.currentTimeMillis();
// Then
final long actualDuration = msAfterRun - msBeforeRun;
assertThat(actualDuration, lessThan(maxExpectedExecutionDurationInMs));
assertThat(actualDuration, greaterThanOrEqualTo(minExpectedExecutionDurationInMs));
}
private static <T> Callable<T> mkTaskThatReturns(final T returnValue) {
return new Callable<T>() {
@Override
public T call() throws Exception {
return returnValue;
}
};
}
private static <T> Callable<T> mkTaskThatReturnsAfterDelay(final T returnValue, final long delayInMs) {
return new Callable<T>() {
@Override
public T call() throws Exception {
final long tsBefore = System.currentTimeMillis();
while (true) {
final long tsNow = System.currentTimeMillis();
final long delaySoFar = tsNow - tsBefore;
final long delayRemaining = delayInMs - delaySoFar;
if (delayRemaining <= 0L) {
break;
}
Thread.sleep(delayRemaining);
}
return returnValue;
}
};
}
private static <T> Callable<T> mkTaskThatThrows(final Exception thrown) {
return new Callable<T>() {
@Override
public T call() throws Exception {
throw thrown;
}
};
}
}
| [
"pjdarton@gmail.com"
] | pjdarton@gmail.com |
76e63522030d67cb834b7ba55d13f33e0d086000 | de8778f9079bc410cbe73157c7e177878daa01c9 | /assign4/Board.java | 858904a399256fb332f16322deeb78c88a3139fc | [] | no_license | rmartinsen/coursera_algorithms | 97434fc6a1b7260f6c06dfc948d9ee398f28de1d | 75e4710f64a279a3c7726c7978623cf07c4271d9 | refs/heads/master | 2021-01-11T00:09:27.219400 | 2016-11-13T22:32:59 | 2016-11-13T22:32:59 | 70,746,599 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,143 | java | import java.util.Stack;
public class Board{
private int[][] blocks;
public Board(int[][] blocks){
this.blocks = blocks;
}
public int dimension() {
return blocks[0].length;
}
public int hamming() {
int totes = 0;
for(int i = 0; i < blocks.length; i++){
for(int j = 0; j < blocks.length; j++) {
int actualValue = this.blocks[i][j];
int rightValue = i * dimension() + j + 1;
if(actualValue != rightValue && actualValue > 0) {
totes++;
}
}
}
return totes;
}
public int manhattan() {
int totes = 0;
for(int i=0; i < blocks.length; i++) {
for(int j=0; j < blocks.length; j++) {
int value = blocks[i][j];
if (value > 0) {
int actualRow = i;
int actualCol = j;
int rightRow = (value - 1) / dimension();
int rightCol = (value - 1) % dimension();
// System.out.println("value:" + value + " actR: " + actualRow + " actC " + actualCol + " rightRow " + rightRow + " rightCol " + rightCol);
totes += Math.abs(actualRow - rightRow);
totes += Math.abs(actualCol - rightCol);
}
}
}
return totes;
}
public boolean isGoal() {
for(int i = 0; i < dimension(); i++){
for(int j =0; j < dimension(); j++){
int rightValue = i * dimension() + j + 1;
int actualValue = blocks[i][j];
if(rightValue != actualValue && actualValue > 0) {
return false;
}
}
}
return true;
}
public Board twin() {
int[][] newBlocks = new int[dimension()][dimension()];
for(int i=0; i < dimension(); i++) {
for(int j=0; j < dimension(); j++) {
newBlocks[i][j] = blocks[i][j];
}
}
if(newBlocks[0][0] != 0 && newBlocks[0][1] != 0){
int temp = newBlocks[0][0];
newBlocks[0][0] = newBlocks[0][1];
newBlocks[0][1] = temp;
} else {
int temp = newBlocks[1][0];
newBlocks[1][0] = newBlocks[1][1];
newBlocks[1][1] = temp;
}
Board twinBoard = new Board(newBlocks);
return twinBoard;
}
public boolean equals(Object y) {
Board that = (Board) y;
if (this.dimension() != that.dimension()) {
return false;
}
for(int i = 0; i < this.dimension(); i++) {
for(int j = 0; j < this.dimension(); j++) {
if(this.blocks[i][j] != that.blocks[i][j]) {
return false;
}
}
}
return true;
}
public Iterable<Board> neighbors() {
int zeroI = 0;
int zeroJ = 0;
for(int i = 0; i < dimension(); i++) {
for(int j = 0; j < dimension(); j++) {
if (blocks[i][j] == 0){
zeroI = i;
zeroJ = j;
}
}
}
Stack<Board> boards = new Stack<Board>();
//Move 0 left
if(zeroJ > 0) {
Board leftBoard = swapBlocks(zeroI, zeroJ, zeroI, zeroJ - 1);
boards.push(leftBoard);
}
//Move 0 right
if(zeroJ < dimension()) {
Board rightBoard = swapBlocks(zeroI, zeroJ, zeroI, zeroJ + 1);
boards.push(rightBoard);
}
//Move 0 up
if(zeroI > 0) {
Board upBoard = swapBlocks(zeroI, zeroJ, zeroI - 1, zeroJ);
boards.push(upBoard);
}
//Move 0 down
if(zeroI < dimension()) {
Board downBoard = swapBlocks(zeroI, zeroJ, zeroI + 1, zeroJ);
boards.push(downBoard);
}
return boards;
}
private Board swapBlocks(int i1, int j1, int i2, int j2) {
int[][] newBlocks = new int[dimension()][dimension()];
for(int i=0; i < dimension(); i++) {
for(int j=0; j < dimension(); j++) {
newBlocks[i][j] = blocks[i][j];
}
}
// System.out.println(new Board(newBlocks));
int temp = newBlocks[i1][j1];
newBlocks[i1][j1] = newBlocks[i2][j2];
newBlocks[i2][j2] = temp;
// System.out.println("i1: " + i1 + " j1:" + j1 +" i2:" + i2 + " j2:" + j2);
// System.out.println(new Board(newBlocks));
return new Board(newBlocks);
}
public String toString() {
String returnString = Integer.toString(dimension());
returnString += "\n";
for(int i = 0; i < dimension(); i++) {
for(int j=0; j < dimension(); j++) {
returnString += blocks[i][j] + " ";
}
returnString += "\n";
}
return returnString;
}
} | [
"rpmartinsen@ucdavis.edu"
] | rpmartinsen@ucdavis.edu |
eef030a0b0b19adf5e05b8efb38c42524239e7f9 | 43c5826c405e9958ac81b912d3c3f34822e39c1c | /src/main/java/com/cg/ofda/entity/RestaurantEntity.java | 8257bcd370cde853d6ffec74253e25b094f33f74 | [] | no_license | ANUPAM-05/Online-Food-Deliver-Application | bd7e9971a4e809d395e5877d618ea1780f97bb1c | 458fdf61fe63d1c2d5a1ef204e3ff9703b5a4ac5 | refs/heads/master | 2023-05-05T17:59:07.815756 | 2021-06-01T05:32:23 | 2021-06-01T05:32:23 | 364,245,447 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,874 | java | package com.cg.ofda.entity;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import com.cg.ofda.model.AddressModel;
/* This is an Entity class
*
*
*/
@Entity
@Table(name = "restaurants")
public class RestaurantEntity implements Serializable {
private static final long serialVersionUID = 1L;
/*
* All the private members are defined here with suitable datatypes
*
*/
@Id
@Column(name = "restaurant_id", length = 19)
private Long restaurantId;
@Column(name = "restaurant_name", length = 30)
private String restaurantName;
@Embedded
private AddressModel address;
@ManyToMany
@JoinTable(
name = "restaurant_item_list",
joinColumns = @JoinColumn(name = "item_id"),
inverseJoinColumns = @JoinColumn(name = "restaurant_id"))
private List<ItemEntity> itemList;
@Column(name = "manager_name", length = 30)
private String managerName;
@Column(name = "contact_number", length = 50)
private String contactNumber;
/*
* A default Constructor with no implementation
*/
public RestaurantEntity() {
// default
}
/*
* A Parameterized Constructor for assigning the values to private members
*/
public RestaurantEntity(Long restaurantId,String restaurantName, AddressModel address, List<ItemEntity> itemList,
String managerName, String contactNumber) {
super();
this.restaurantId=restaurantId;
this.restaurantName = restaurantName;
this.address = address;
this.itemList = itemList;
this.managerName = managerName;
this.contactNumber = contactNumber;
}
/*
* Corresponding Getters and Setters for private members
*
*/
public Long getRestaurantId() {
return restaurantId;
}
public void setRestaurantId(Long restaurantId) {
this.restaurantId = restaurantId;
}
public String getRestaurantName() {
return restaurantName;
}
public void setRestaurantName(String restaurantName) {
this.restaurantName = restaurantName;
}
public AddressModel getAddress() {
return address;
}
public void setAddress(AddressModel address) {
this.address = address;
}
public List<ItemEntity> getItemList() {
return itemList;
}
public void setItemList(List<ItemEntity> itemList) {
this.itemList = itemList;
}
public String getManagerName() {
return managerName;
}
public void setManagerName(String managerName) {
this.managerName = managerName;
}
public String getContactNumber() {
return contactNumber;
}
public void setContactNumber(String contactNumber) {
this.contactNumber = contactNumber;
}
/* hashCode and Equals*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((address == null) ? 0 : address.hashCode());
result = prime * result + ((contactNumber == null) ? 0 : contactNumber.hashCode());
result = prime * result + ((itemList == null) ? 0 : itemList.hashCode());
result = prime * result + ((managerName == null) ? 0 : managerName.hashCode());
result = prime * result + ((restaurantId == null) ? 0 : restaurantId.hashCode());
result = prime * result + ((restaurantName == null) ? 0 : restaurantName.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
RestaurantEntity other = (RestaurantEntity) obj;
if (address == null) {
if (other.address != null)
return false;
} else if (!address.equals(other.address))
return false;
if (contactNumber == null) {
if (other.contactNumber != null)
return false;
} else if (!contactNumber.equals(other.contactNumber))
return false;
if (itemList == null) {
if (other.itemList != null)
return false;
} else if (!itemList.equals(other.itemList))
return false;
if (managerName == null) {
if (other.managerName != null)
return false;
} else if (!managerName.equals(other.managerName))
return false;
if (restaurantId == null) {
if (other.restaurantId != null)
return false;
} else if (!restaurantId.equals(other.restaurantId))
return false;
if (restaurantName == null) {
if (other.restaurantName != null)
return false;
} else if (!restaurantName.equals(other.restaurantName))
return false;
return true;
}
/*
* toString() method overridden here
*
*/
@Override
public String toString() {
return String.format(
"Restaurant [restaurantId=%s, restaurantName=%s, address=%s, itemList=%s, managerName=%s, contactNumber=%s]",
restaurantId, restaurantName, address, itemList, managerName, contactNumber);
}
}
| [
"arpittailong2015@gmail.com"
] | arpittailong2015@gmail.com |
aef4ad655fc06bef5b428f87ac097b12f1eb3af3 | 9a807b3940a4fa9dfa7985525f31bc5d2571b909 | /trunk/yyandroid/src/com/yy/android/activity/WorkerActivity.java | 7f496699d2255bc4fff848ed8ce5bde4700da894 | [] | no_license | Dekai/zdk | 1dc9f564fd671dd7d9b6a7c69ab8b1579efbf89b | 940645fa06fd4b47e990532a7831245df8962fcf | refs/heads/master | 2020-04-10T16:37:59.696623 | 2018-12-10T09:45:28 | 2018-12-10T09:45:28 | 161,151,035 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,869 | java | package com.yy.android.activity;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import android.content.Intent;
import android.opengl.Visibility;
import android.os.AsyncTask;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import com.google.gson.reflect.TypeToken;
import com.yy.android.R;
import com.yy.android.adapter.ExpatriateAdapter;
import com.yy.android.util.JSONHttpClient;
import com.yy.android.vo.ExpatriateAttendance;
import com.yy.android.vo.SpinnerData;
public class WorkerActivity extends MyBaseActivity implements OnItemClickListener, OnClickListener, OnItemSelectedListener {
private List<ExpatriateAttendance> attendanceList = new ArrayList<ExpatriateAttendance>();
private ListView listView;
private ExpatriateAdapter adapter;
private Button btn_add_worker, btn_return;
private String loadExpatriate_API = Service_Address + "expatriateattendace/getlist";
@Override
protected void setContentView() {
setContentView(R.layout.worker);
}
@Override
protected void findViewById() {
listView = (ListView) findViewById(R.id.worker_listview);
btn_add_worker = (Button) findViewById(R.id.btn_add_worker);
progress_loading = (LinearLayout) findViewById(R.id.progress_loading);
btn_return = (Button) findViewById(R.id.btn_back);
sp_project = (Spinner) findViewById(R.id.sp_project);
emptyText = (TextView) findViewById(R.id.emptyText);
ib_clock = (ImageButton) findViewById(R.id.ib_clock);
}
@Override
protected void initialize() {
listView.setEmptyView(emptyText);
listView.setOnItemClickListener(this);
btn_add_worker.setOnClickListener(this);
btn_return.setOnClickListener(this);
ib_clock.setOnClickListener(this);
spCount = 1;
initProjectSpinner(this);
new LoadExpatriateAttendance().execute();
}
@Override
public void onClick(View v) {
final Intent intent = new Intent();
switch (v.getId()) {
case R.id.btn_back:
finish();
break;
case R.id.btn_add_worker:
intent.setClass(this, AddWorkerActivity.class);
startActivity(intent);
finish();
break;
case R.id.ib_clock:
showDateSearchDialog();
break;
}
}
@Override
public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) {
ExpatriateAttendance info = attendanceList.get(position);
final Intent intent = new Intent();
intent.setClass(this, AddWorkerActivity.class);
intent.putExtra("attendance", info);
startActivity(intent);
finish();
}
class LoadExpatriateAttendance extends AsyncTask<String, String, String> {
@Override
protected String doInBackground(String... params) {
try {
JSONHttpClient jsonHttpClient = new JSONHttpClient();
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
SpinnerData selectItem = (SpinnerData) sp_project.getSelectedItem();
nameValuePairs.add(new BasicNameValuePair("projectid", selectItem.getValue()));
nameValuePairs.add(new BasicNameValuePair("startdate", startDateString));
nameValuePairs.add(new BasicNameValuePair("enddate", endDateString));
Type listType = new TypeToken<List<ExpatriateAttendance>>() {
}.getType();
List<ExpatriateAttendance> returnList = jsonHttpClient.GetList(loadExpatriate_API, nameValuePairs, ExpatriateAttendance.class,
listType);
attendanceList.clear();
attendanceList.addAll(returnList);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
showAnim();
}
@Override
protected void onPostExecute(String s) {
runOnUiThread(new Runnable() {
@Override
public void run() {
stopAnim();
adapter = new ExpatriateAdapter(WorkerActivity.this, attendanceList);
listView.setAdapter(adapter);
if (attendanceList.size() == 0) {
emptyText.setVisibility(View.VISIBLE);
}
}
});
}
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (initSpCount < spCount) {
initSpCount++;
} else {
new LoadExpatriateAttendance().execute();
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
// TODO Auto-generated method stub
}
@Override
protected void updateList() {
new LoadExpatriateAttendance().execute();
}
}
| [
"dekai.zhang@mastercard.com"
] | dekai.zhang@mastercard.com |
3ab1c152859473db10760724c019bdee14e0b31e | a929be07331f23463d871562516b6606481567ba | /safwan-data/src/main/java/com/safwan/data/dao/CategoryDao.java | 6ce02f0649e2c14a96c8f0a84cef875a185b3923 | [] | no_license | swapnesh22/safwan-main | 2b514d142bdf840abe6624cd4191e428b7292010 | fcd42a6fa78b225acaf5d4efb2938e870cf4de69 | refs/heads/master | 2020-03-18T11:28:48.329411 | 2018-05-25T13:44:45 | 2018-05-25T13:44:45 | 134,673,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 735 | java | package com.safwan.data.dao;
import java.util.List;
import com.safwan.data.exception.CustomException;
import com.safwan.data.model.Category;
import com.safwan.data.model.SubCategory;
import com.safwan.data.model.User;
public interface CategoryDao {
public void saveOrUpdate(Category category);
public void saveOrUpdate(SubCategory categoryM);
public Category findCategoryById(int categoryId);
public void deleteCategory(int id) throws CustomException;
public List<Category> listAllCategories();
public List<SubCategory> listCategories(int categoryType);//Category
public SubCategory findByCategoryMasterId(int id);
public List<SubCategory> listAllSubCategories();
public void deleteSubCategory(int id);
}
| [
"swkarpe@gmail.com"
] | swkarpe@gmail.com |
b8dd8389f590b282c7254e73292a8bc2e9097818 | f1cd6b018489afe868283416c8a3cb6059433ac0 | /src/main/java/com/example/demo/payload/revision/TaskData.java | 0b3fc6d110dc9b1836647ff75c21fe77ba22bbe5 | [] | no_license | devbybee/workforce | ac936118b77d3922c9282959ae5431440911bd78 | 0fc18215a7ddfb097c427641ae6febc031b487ea | refs/heads/master | 2020-05-21T04:04:08.968730 | 2019-05-15T07:19:17 | 2019-05-15T07:19:17 | 185,895,789 | 0 | 0 | null | 2019-05-10T01:44:00 | 2019-05-10T01:19:13 | Java | UTF-8 | Java | false | false | 1,811 | java | package com.example.demo.payload.revision;
public class TaskData {
private String task_desc;
private String task_setup = "";
private String task_cleanup = "";
private String start_date;
private String start_time;
private String end_date;
private String end_time;
private String location;
private Object qual_info;
public String getTask_desc() {
return task_desc;
}
public void setTask_desc(String task_desc) {
this.task_desc = task_desc;
}
public String getTask_setup() {
return task_setup;
}
public void setTask_setup(String task_setup) {
this.task_setup = task_setup;
}
public String getTask_cleanup() {
return task_cleanup;
}
public void setTask_cleanup(String task_cleanup) {
this.task_cleanup = task_cleanup;
}
public String getStart_date() {
return start_date;
}
public void setStart_date(String start_date) {
this.start_date = start_date;
}
public String getStart_time() {
return start_time;
}
public void setStart_time(String start_time) {
this.start_time = start_time;
}
public String getEnd_date() {
return end_date;
}
public void setEnd_date(String end_date) {
this.end_date = end_date;
}
public String getEnd_time() {
return end_time;
}
public void setEnd_time(String end_time) {
this.end_time = end_time;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public Object getQual_info() {
return qual_info;
}
public void setQual_info(Object qual_info) {
this.qual_info = qual_info;
}
}
| [
"macbook@MacBooks-MacBook-Air.local"
] | macbook@MacBooks-MacBook-Air.local |
92cb19e166ca59d4642ac949c3f1d6d590367207 | befae6a20c7b14c122e8cc3c68896eb855a1e5a9 | /src/main/java/rating/dto/RegisterMailCodeDTO.java | 281ae30f72c4fdba6078407891fb743b705495b5 | [] | no_license | santono/Rating | dee06370efb980465745cd21309f891d02107bf8 | 0d972a0aceaa26cff34d92aa8eff3684ecf94123 | refs/heads/master | 2020-03-23T07:59:20.390393 | 2018-10-18T17:46:15 | 2018-10-18T17:46:15 | 141,301,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 221 | java | package rating.dto;
public class RegisterMailCodeDTO {
private String email;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
| [
"santono@mail.ru"
] | santono@mail.ru |
ff5da3a5b380e35d942bc27a598049b1d4601178 | fc2d959eb21449a51be7f3ea6faf54d91ae59d8f | /src/main/java/korea/play/culture/association/service/GalleryService.java | c42d85db167313bb2da9d59f76ad8d2e95e8020c | [] | no_license | petto1945/MainKoreaPlayCultureAssociation | 97d15bae704f5cc804da83f8d50ef5152e99d595 | 80f17efe353299d9ef8832b8bef1cb0dd47553ab | refs/heads/master | 2020-05-01T13:20:45.912441 | 2019-03-25T00:59:32 | 2019-03-25T00:59:32 | 177,489,271 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,775 | java | package korea.play.culture.association.service;
import java.util.HashMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import korea.play.culture.association.dao.GalleryDao;
@Service("GalleryService")
public class GalleryService {
@Autowired
GalleryDao gallery;
/**
* 겔러리 게시판 처음 조회
* @param request
* @return result
* @throws Exception
*/
public HashMap<String, Object> galleryFind(HashMap<String, Object> request) throws Exception{
HashMap<String, Object> result = new HashMap<String, Object>();
HashMap<String, Object> reDao = gallery.galleryFind(request);
return result;
}
/**
* 겔러이 게시판 글쓰기
* @param request
* @return result
* @throws Exception
*/
public HashMap<String, Object> galleryInsert(HashMap<String, Object> request) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
HashMap<String, Object> reDao = gallery.galleryInsert(request);
return result;
}
/**
* 겔러리 게시판 수정하기
* @param request
* @return result
* @throws Exception
*/
public HashMap<String, Object> galleryUpdate(HashMap<String, Object> request) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
HashMap<String, Object> reDao = gallery.galleryUpdate(request);
return result;
}
/**
* 겔러리 게시판 삭제
* @param request
* @return result
* @throws Exception
*/
public HashMap<String, Object> galleryRemove(HashMap<String, Object> request) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
HashMap<String, Object> reDao = gallery.galleryRemove(request);
return result;
}
}
| [
"gimgeonhun@gimgeonhun-ui-MacBook-Pro.local"
] | gimgeonhun@gimgeonhun-ui-MacBook-Pro.local |
59497ac8cd3c4be4e1b08cdd27aef6d1deb76897 | 596e8b725f9ec35a8ebd29ccc897ab5711084970 | /labs/АбстрактнаяФабрика/Elf_Commander.java | 56b177486b99d5f9238db8c0f25702671973d558 | [] | no_license | AlishkaPank/Alisha9702-mail.ru | 7e26039be958b29e0b024820d7552b0533c8ca99 | f70e340f8a141d90b81045fea54dbe19700afb3b | refs/heads/master | 2022-04-19T09:35:52.223377 | 2020-04-16T01:38:49 | 2020-04-16T01:38:49 | 250,252,174 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 361 | java | package abstractFactory.concreteProducts;
import abstractFactory.Commander;
//ConcreteProduct
public class Elf_Commander implements Commander {
private static Elf_Commander instance;
public static Elf_Commander getInstance() {
if (instance == null){
instance = new Elf_Commander();
}
return instance;
}
}
| [
"noreply@github.com"
] | AlishkaPank.noreply@github.com |
c879e48fe3118735d430ad4c0cba97912b3736a5 | 9b73aa41e30c5282880545695ce2ed3158e84c73 | /src/main/java/news/models/Users.java | 91074a038745b388983eba80caf116bcbb1b6319 | [] | no_license | petrov94/NewsApplication | 6b430bb08f71fd919754aad78cbacd361e2e7950 | f2c1840de5f8bc6576dbb6d2e9e94d3ffb44f4e7 | refs/heads/master | 2021-01-02T22:59:33.000273 | 2017-08-26T07:27:36 | 2017-08-26T07:27:36 | 99,432,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,177 | java | package news.models;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* Created by Petar on 8/19/2017.
*/
public class Users implements Serializable{
private static final long serialVersionUID = 1L;
private Integer id;
private String username;
private String password;
private String e_mail;
private String medias;
private Date subscription;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getE_mail() {
return e_mail;
}
public void setE_mail(String e_mail) {
this.e_mail = e_mail;
}
public String getMedias() {
return medias;
}
public void setMedias(String medias) {
this.medias = medias;
}
public Date getSubscription() {
return subscription;
}
public void setSubscription(Date subscription) {
this.subscription = subscription;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
| [
"vladimirov_1993@abv.bg"
] | vladimirov_1993@abv.bg |
fc614c8fa932c98638c7bb82383a0d5268a0b8d5 | ad3425bb5f85bb2ee5ecb24c437727b7608c9423 | /Assignment3/JFreeChart_Lab3/src/org/jfree/chart/ClipPath.java | 40f42a10b2ee76668f504dc5f172d5d3fc127b46 | [] | no_license | ArtinRezaee/SENG438 | 13be512bc0b34e52c1ad6d212c4668a4182beb22 | b45b0450fccbcc78394a55e42485155234fab078 | refs/heads/master | 2021-05-04T05:51:03.295741 | 2018-03-22T17:14:18 | 2018-03-22T17:14:18 | 120,345,253 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,808 | java | /* ===========================================================
* JFreeChart : a free chart library for the Java(tm) platform
* ===========================================================
*
* (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
*
* Project Info: http://www.jfree.org/jfreechart/index.html
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* -------------
* ClipPath.java
* -------------
* (C) Copyright 2003, 2004, by David M. O'Donnell and Contributors.
*
* Original Author: David M. O'Donnell;
* Contributor(s): David Gilbert (for Object Refinery Limited);
* Nicolas Brodu;
*
* $Id: ClipPath.java,v 1.2 2005/03/28 19:38:39 mungady Exp $
*
* Changes
* -------
* 22-Apr-2003 : Added standard header (DG);
* 09-May-2003 : Added AxisLocation (DG);
* 11-Sep-2003 : Implemented Cloneable (NB);
* 21-Jan-2004 : Update for renamed method in ValueAxis (DG);
*
*/
package org.jfree.chart;
import java.awt.BasicStroke;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Stroke;
import java.awt.geom.GeneralPath;
import java.awt.geom.Rectangle2D;
import org.jfree.chart.axis.ValueAxis;
import org.jfree.ui.RectangleEdge;
/**
* This class would typically be used with a
* {@link org.jfree.chart.plot.ContourPlot}. It allows the user to define a
* <code>GeneralPath</code> curve in plot coordinates. This curve can then be
* used mask off or define regions within the contour plot. The data must be
* sorted.
*
* @author dmo
*/
public class ClipPath implements Cloneable {
/** The x values. */
private double[] xValue = null;
/** The y values. */
private double[] yValue = null;
/**
* Controls whether drawing will be clipped ( false would still allow the
* drawing or filling of path
*/
private boolean clip = true;
/** Controls whether the path is drawn as an outline. */
private boolean drawPath = false;
/** Controls whether the path is filled. */
private boolean fillPath = false;
/** The fill paint. */
private Paint fillPaint = null;
/** The draw paint. */
private Paint drawPaint = null;
/** The draw stroke. */
private Stroke drawStroke = null;
/** The composite. */
private Composite composite = null;
/**
* Constructor for ClipPath.
*/
public ClipPath() {
super();
}
/**
* Constructor for ClipPath. Default values are assumed for the fillPath and
* drawPath options as false and true respectively. The fillPaint is set to
* Color.GRAY, the drawColor is Color.BLUE, the stroke is BasicStroke(1) and the
* composite is AlphaComposite.Src.
*
* @param xValue
* x coordinates of curved to be created
* @param yValue
* y coordinates of curved to be created
*/
public ClipPath(double[] xValue, double[] yValue) {
this(xValue, yValue, true, false, true);
}
/**
* Constructor for ClipPath. The fillPaint is set to Color.GRAY, the drawColor
* is Color.BLUE, the stroke is BasicStroke(1) and the composite is
* AlphaComposite.Src.
*
* @param xValue
* x coordinates of curved to be created
* @param yValue
* y coordinates of curved to be created
* @param clip
* clip?
* @param fillPath
* whether the path is to filled
* @param drawPath
* whether the path is to drawn as an outline
*/
public ClipPath(double[] xValue, double[] yValue, boolean clip, boolean fillPath, boolean drawPath) {
this.xValue = xValue;
this.yValue = yValue;
this.clip = clip;
this.fillPath = fillPath;
this.drawPath = drawPath;
this.fillPaint = java.awt.Color.gray;
this.drawPaint = java.awt.Color.blue;
this.drawStroke = new BasicStroke(1);
this.composite = java.awt.AlphaComposite.Src;
}
/**
* Constructor for ClipPath.
*
* @param xValue
* x coordinates of curved to be created
* @param yValue
* y coordinates of curved to be created
* @param fillPath
* whether the path is to filled
* @param drawPath
* whether the path is to drawn as an outline
* @param fillPaint
* the fill paint
* @param drawPaint
* the outline stroke color
* @param drawStroke
* the stroke style
* @param composite
* the composite rule
*/
public ClipPath(double[] xValue, double[] yValue, boolean fillPath, boolean drawPath, Paint fillPaint,
Paint drawPaint, Stroke drawStroke, Composite composite) {
this.xValue = xValue;
this.yValue = yValue;
this.fillPath = fillPath;
this.drawPath = drawPath;
this.fillPaint = fillPaint;
this.drawPaint = drawPaint;
this.drawStroke = drawStroke;
this.composite = composite;
}
/**
* Draws the clip path.
*
* @param g2
* current graphics2D.
* @param dataArea
* the dataArea that the plot is being draw in.
* @param horizontalAxis
* the horizontal axis.
* @param verticalAxis
* the vertical axis.
*
* @return The GeneralPath defining the outline
*/
public GeneralPath draw(Graphics2D g2, Rectangle2D dataArea, ValueAxis horizontalAxis, ValueAxis verticalAxis) {
GeneralPath generalPath = generateClipPath(dataArea, horizontalAxis, verticalAxis);
if (this.fillPath || this.drawPath) {
Composite saveComposite = g2.getComposite();
Paint savePaint = g2.getPaint();
Stroke saveStroke = g2.getStroke();
if (this.fillPaint != null) {
g2.setPaint(this.fillPaint);
}
if (this.composite != null) {
g2.setComposite(this.composite);
}
if (this.fillPath) {
g2.fill(generalPath);
}
if (this.drawStroke != null) {
g2.setStroke(this.drawStroke);
}
if (this.drawPath) {
g2.draw(generalPath);
}
g2.setPaint(savePaint);
g2.setComposite(saveComposite);
g2.setStroke(saveStroke);
}
return generalPath;
}
/**
* Generates the clip path.
*
* @param dataArea
* the dataArea that the plot is being draw in.
* @param horizontalAxis
* the horizontal axis.
* @param verticalAxis
* the vertical axis.
*
* @return The GeneralPath defining the outline
*/
public GeneralPath generateClipPath(Rectangle2D dataArea, ValueAxis horizontalAxis, ValueAxis verticalAxis) {
GeneralPath generalPath = new GeneralPath();
double transX = horizontalAxis.valueToJava2D(this.xValue[0], dataArea, RectangleEdge.BOTTOM);
double transY = verticalAxis.valueToJava2D(this.yValue[0], dataArea, RectangleEdge.LEFT);
generalPath.moveTo((float) transX, (float) transY);
for (int k = 0; k < this.yValue.length; k++) {
transX = horizontalAxis.valueToJava2D(this.xValue[k], dataArea, RectangleEdge.BOTTOM);
transY = verticalAxis.valueToJava2D(this.yValue[k], dataArea, RectangleEdge.LEFT);
generalPath.lineTo((float) transX, (float) transY);
}
generalPath.closePath();
return generalPath;
}
/**
* Returns the composite.
*
* @return Composite
*/
public Composite getComposite() {
return this.composite;
}
/**
* Returns the drawPaint.
*
* @return Paint
*/
public Paint getDrawPaint() {
return this.drawPaint;
}
/**
* Returns the drawPath.
*
* @return boolean
*/
public boolean isDrawPath() {
return this.drawPath;
}
/**
* Returns the drawStroke.
*
* @return Stroke
*/
public Stroke getDrawStroke() {
return this.drawStroke;
}
/**
* Returns the fillPaint.
*
* @return Paint
*/
public Paint getFillPaint() {
return this.fillPaint;
}
/**
* Returns the fillPath.
*
* @return boolean
*/
public boolean isFillPath() {
return this.fillPath;
}
/**
* Returns the xValue.
*
* @return double[]
*/
public double[] getXValue() {
return this.xValue;
}
/**
* Returns the yValue.
*
* @return double[]
*/
public double[] getYValue() {
return this.yValue;
}
/**
* Sets the composite.
*
* @param composite
* The composite to set
*/
public void setComposite(Composite composite) {
this.composite = composite;
}
/**
* Sets the drawPaint.
*
* @param drawPaint
* The drawPaint to set
*/
public void setDrawPaint(Paint drawPaint) {
this.drawPaint = drawPaint;
}
/**
* Sets the drawPath.
*
* @param drawPath
* The drawPath to set
*/
public void setDrawPath(boolean drawPath) {
this.drawPath = drawPath;
}
/**
* Sets the drawStroke.
*
* @param drawStroke
* The drawStroke to set
*/
public void setDrawStroke(Stroke drawStroke) {
this.drawStroke = drawStroke;
}
/**
* Sets the fillPaint.
*
* @param fillPaint
* The fillPaint to set
*/
public void setFillPaint(Paint fillPaint) {
this.fillPaint = fillPaint;
}
/**
* Sets the fillPath.
*
* @param fillPath
* The fillPath to set
*/
public void setFillPath(boolean fillPath) {
this.fillPath = fillPath;
}
/**
* Sets the xValue.
*
* @param xValue
* The xValue to set
*/
public void setXValue(double[] xValue) {
this.xValue = xValue;
}
/**
* Sets the yValue.
*
* @param yValue
* The yValue to set
*/
public void setYValue(double[] yValue) {
this.yValue = yValue;
}
/**
* Returns the clip.
*
* @return boolean
*/
public boolean isClip() {
return this.clip;
}
/**
* Sets the clip.
*
* @param clip
* The clip to set
*/
public void setClip(boolean clip) {
this.clip = clip;
}
/**
* Returns a clone of the object (a deeper clone than default to avoid bugs when
* setting values in cloned object).
*
* @return The clone.
*
* @throws CloneNotSupportedException
* if cloning is not supported.
*/
public Object clone() throws CloneNotSupportedException {
ClipPath clone = (ClipPath) super.clone();
clone.xValue = (double[]) this.xValue.clone();
clone.yValue = (double[]) this.yValue.clone();
return clone;
}
}
| [
"satyakig901@hotmail.com"
] | satyakig901@hotmail.com |
f9112bc430ffa1c45c840d2d19384efeb461856c | aa953fb686184e167d82e65e40f28ebbd4a81c17 | /src/main/java/top/lvjp/association/exception/MyException.java | b193550803497caf2fa8f29e72ce261fae37bf8d | [] | no_license | FelixFelicis404/association-1 | 91a551d0a9e680ae5ba868be72f63e78e41e12f6 | 45b13d8b68af2109b003490d9daf5545b05ccf5c | refs/heads/master | 2020-05-07T21:40:31.146214 | 2019-03-07T07:09:15 | 2019-03-07T07:09:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 474 | java | package top.lvjp.association.exception;
import top.lvjp.association.enums.ResultEnum;
public class MyException extends RuntimeException{
private Integer code;
public MyException(Integer code,String message) {
super(message);
this.code = code;
}
public MyException(ResultEnum resultEnum){
super(resultEnum.getMessage());
this.code = resultEnum.getCode();
}
public Integer getCode() {
return code;
}
}
| [
"2320823636@qq.com"
] | 2320823636@qq.com |
9022fa3bade0475262c3aaa27243b5e33be2a609 | 2fd40aa515fc428bae96a21042becb2aa10bbb2f | /src/main/java/com/trnka/trnkadevice/ui/Renderable.java | 3458d842fcbd65c65254661737c6551276ba4adf | [] | no_license | tgramblicka/trnka-device | 14da6f433cb98e094045b1d5c92684bc8df93e90 | 1ad163221d8277b51046890ca42c2bfe5fa95157 | refs/heads/master | 2022-05-19T11:04:57.657456 | 2021-06-16T17:25:46 | 2021-06-16T17:25:46 | 184,472,213 | 0 | 0 | null | 2022-03-08T21:25:16 | 2019-05-01T19:47:09 | Java | UTF-8 | Java | false | false | 204 | java | package com.trnka.trnkadevice.ui;
import com.trnka.trnkadevice.ui.messages.Messages;
import java.util.List;
public interface Renderable {
Messages getMessage();
List<Messages> getParams();
}
| [
"t.gramblicka@gmail.com"
] | t.gramblicka@gmail.com |
d408306ea5600ab7a0149cc75c0c459f7795081e | 54d2953f37bf1094f77e5978b45f14d25942eee8 | /runtime/opaeum-runtime-core/opaeum-runtime-hibernate/src/test/generated-java/org/opaeum/runtime/bpm/request/taskrequest/taskrequestregion/active/region1/Reserved.java | a9d2074211035cfd4e04a0d43b92470b59e699f5 | [] | no_license | opaeum/opaeum | 7d30c2fc8f762856f577c2be35678da9890663f7 | a517c2446577d6a961c1fcdcc9d6e4b7a165f33d | refs/heads/master | 2022-07-14T00:35:23.180202 | 2016-01-01T15:23:11 | 2016-01-01T15:23:11 | 987,891 | 2 | 2 | null | 2022-06-29T19:45:00 | 2010-10-14T19:11:53 | Java | UTF-8 | Java | false | false | 2,728 | java | package org.opaeum.runtime.bpm.request.taskrequest.taskrequestregion.active.region1;
import java.util.Set;
import javax.persistence.Transient;
import org.opaeum.runtime.bpm.request.TaskRequest;
import org.opaeum.runtime.bpm.request.TaskRequestToken;
import org.opaeum.runtime.bpm.request.taskrequest.taskrequestregion.ReservedToSuspended;
import org.opaeum.runtime.bpm.request.taskrequest.taskrequestregion.active.Region1;
import org.opaeum.runtime.domain.CancelledEvent;
import org.opaeum.runtime.domain.OutgoingEvent;
import org.opaeum.runtime.domain.TriggerMethod;
import org.opaeum.runtime.statemachines.StateActivation;
public class Reserved<SME extends TaskRequest> extends StateActivation<SME, TaskRequestToken<SME>> {
static public String ID = "252060@_Q6NAcIoaEeCPduia_-NbFw";
@Transient
private ReservedToInProgress<SME> ReservedToInProgress;
@Transient
private ReservedToReady<SME> ReservedToReady;
@Transient
private ReservedToSuspended<SME> ReservedToSuspended;
/** Constructor for Reserved
*
* @param region
*/
public Reserved(Region1<SME> region) {
super(ID,region);
}
public SME getBehaviorExecution() {
SME result = (SME)super.getBehaviorExecution();
return result;
}
public Set<CancelledEvent> getCancelledEvents() {
Set result = getBehaviorExecution().getCancelledEvents();
return result;
}
public String getHumanName() {
String result = "Reserved";
return result;
}
public Set<OutgoingEvent> getOutgoingEvents() {
Set result = getBehaviorExecution().getOutgoingEvents();
return result;
}
public ReservedToInProgress<SME> getReservedToInProgress() {
return this.ReservedToInProgress;
}
public ReservedToReady<SME> getReservedToReady() {
return this.ReservedToReady;
}
public ReservedToSuspended<SME> getReservedToSuspended() {
return this.ReservedToSuspended;
}
public TriggerMethod[] getTriggerMethods() {
TriggerMethod[] result = new TriggerMethod[]{new TriggerMethod(false,"Revoked","Revoked"),new TriggerMethod(false,"Suspended","Suspended"),new TriggerMethod(false,"Started","Started")};
return result;
}
public boolean onCompletion() {
boolean result = false;
return result;
}
public void onEntry(TaskRequestToken token) {
super.onEntry(token);
getStateMachineExecution().setHistory(ID);
}
public void setReservedToInProgress(ReservedToInProgress<SME> ReservedToInProgress) {
this.ReservedToInProgress=ReservedToInProgress;
}
public void setReservedToReady(ReservedToReady<SME> ReservedToReady) {
this.ReservedToReady=ReservedToReady;
}
public void setReservedToSuspended(ReservedToSuspended<SME> ReservedToSuspended) {
this.ReservedToSuspended=ReservedToSuspended;
}
} | [
"ampieb@gmail.com"
] | ampieb@gmail.com |
b5cbc26da5115ab1d888d3eb4a3da5004df0bd09 | f4327edad778f5b99a4badce4c505d83d62ee699 | /CandidateCvAnalysis/src/main/java/com/capgemini/personality/controller/SkillController.java | 9911fdfd78f5b33e340349ffd06c3d75cf932f26 | [] | no_license | nagaramsaikiran/PersonalityPrediction | 4fe1bcd3976923f06604c2990f8422f3845a8ae9 | 69918b4db64a0e3af67a34624f8cccd905d4a8e2 | refs/heads/master | 2023-05-13T01:02:56.508594 | 2021-06-07T12:39:45 | 2021-06-07T12:39:45 | 373,785,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,429 | java | package com.capgemini.personality.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.capgemini.personality.entity.Skill;
import com.capgemini.personality.model.SkillDTO;
import com.capgemini.personality.service.ISkillService;
@Controller
public class SkillController {
@Autowired
private ISkillService skillService;
@RequestMapping("/skills")
public List<SkillDTO> getAllSkills() {
return skillService.getAllSkills();
}
@RequestMapping("/skills/{skillId}")
public SkillDTO getskill(@PathVariable long id) {
return skillService.getSkill(id);
}
@RequestMapping(method = RequestMethod.POST, value = "/skills")
public SkillDTO addskill(@RequestBody Skill skill) {
return skillService.addSkill(skill);
}
@RequestMapping(method = RequestMethod.PUT, value = "/skills")
public SkillDTO updateskill(@PathVariable long id, @RequestBody Skill skill) {
return skillService.updateSkill(skill);
}
@RequestMapping(method = RequestMethod.DELETE, value = "/skills/{skillId}")
public SkillDTO deleteskill(long id) {
return skillService.deleteSkill(id);
}
}
| [
"nagaramsaikiran3@gmail.com"
] | nagaramsaikiran3@gmail.com |
40b1d45dd449a8ae499f6f03ce89151813065efa | 3f3aad690461c179e6df03ef0e3eab9874ec8410 | /dangjian-admin/dangjian-admin-dao/src/main/java/cn/dlbdata/dangjian/admin/dao/model/PWxUserExample.java | de43c5c9f2ae8c84a748418375a542f03f31a99e | [] | no_license | KittySnow/dangjian | d641ace31321b2675ab62d61346c7c67390f8d7f | 3c1fb684d7dd519b9bd0d9d889826bada03aece0 | refs/heads/master | 2023-05-29T14:32:16.362104 | 2023-05-15T08:43:38 | 2023-05-15T08:43:38 | 126,756,190 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 43,865 | java | package cn.dlbdata.dangjian.admin.dao.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class PWxUserExample implements Serializable {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private static final long serialVersionUID = 1L;
public PWxUserExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria implements Serializable {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Integer value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Integer value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Integer value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Integer value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(Integer value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Integer value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<Integer> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Integer> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Integer value1, Integer value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Integer value1, Integer value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andOpenIdIsNull() {
addCriterion("open_id is null");
return (Criteria) this;
}
public Criteria andOpenIdIsNotNull() {
addCriterion("open_id is not null");
return (Criteria) this;
}
public Criteria andOpenIdEqualTo(String value) {
addCriterion("open_id =", value, "openId");
return (Criteria) this;
}
public Criteria andOpenIdNotEqualTo(String value) {
addCriterion("open_id <>", value, "openId");
return (Criteria) this;
}
public Criteria andOpenIdGreaterThan(String value) {
addCriterion("open_id >", value, "openId");
return (Criteria) this;
}
public Criteria andOpenIdGreaterThanOrEqualTo(String value) {
addCriterion("open_id >=", value, "openId");
return (Criteria) this;
}
public Criteria andOpenIdLessThan(String value) {
addCriterion("open_id <", value, "openId");
return (Criteria) this;
}
public Criteria andOpenIdLessThanOrEqualTo(String value) {
addCriterion("open_id <=", value, "openId");
return (Criteria) this;
}
public Criteria andOpenIdLike(String value) {
addCriterion("open_id like", value, "openId");
return (Criteria) this;
}
public Criteria andOpenIdNotLike(String value) {
addCriterion("open_id not like", value, "openId");
return (Criteria) this;
}
public Criteria andOpenIdIn(List<String> values) {
addCriterion("open_id in", values, "openId");
return (Criteria) this;
}
public Criteria andOpenIdNotIn(List<String> values) {
addCriterion("open_id not in", values, "openId");
return (Criteria) this;
}
public Criteria andOpenIdBetween(String value1, String value2) {
addCriterion("open_id between", value1, value2, "openId");
return (Criteria) this;
}
public Criteria andOpenIdNotBetween(String value1, String value2) {
addCriterion("open_id not between", value1, value2, "openId");
return (Criteria) this;
}
public Criteria andNickNameIsNull() {
addCriterion("nick_name is null");
return (Criteria) this;
}
public Criteria andNickNameIsNotNull() {
addCriterion("nick_name is not null");
return (Criteria) this;
}
public Criteria andNickNameEqualTo(String value) {
addCriterion("nick_name =", value, "nickName");
return (Criteria) this;
}
public Criteria andNickNameNotEqualTo(String value) {
addCriterion("nick_name <>", value, "nickName");
return (Criteria) this;
}
public Criteria andNickNameGreaterThan(String value) {
addCriterion("nick_name >", value, "nickName");
return (Criteria) this;
}
public Criteria andNickNameGreaterThanOrEqualTo(String value) {
addCriterion("nick_name >=", value, "nickName");
return (Criteria) this;
}
public Criteria andNickNameLessThan(String value) {
addCriterion("nick_name <", value, "nickName");
return (Criteria) this;
}
public Criteria andNickNameLessThanOrEqualTo(String value) {
addCriterion("nick_name <=", value, "nickName");
return (Criteria) this;
}
public Criteria andNickNameLike(String value) {
addCriterion("nick_name like", value, "nickName");
return (Criteria) this;
}
public Criteria andNickNameNotLike(String value) {
addCriterion("nick_name not like", value, "nickName");
return (Criteria) this;
}
public Criteria andNickNameIn(List<String> values) {
addCriterion("nick_name in", values, "nickName");
return (Criteria) this;
}
public Criteria andNickNameNotIn(List<String> values) {
addCriterion("nick_name not in", values, "nickName");
return (Criteria) this;
}
public Criteria andNickNameBetween(String value1, String value2) {
addCriterion("nick_name between", value1, value2, "nickName");
return (Criteria) this;
}
public Criteria andNickNameNotBetween(String value1, String value2) {
addCriterion("nick_name not between", value1, value2, "nickName");
return (Criteria) this;
}
public Criteria andSexIsNull() {
addCriterion("sex is null");
return (Criteria) this;
}
public Criteria andSexIsNotNull() {
addCriterion("sex is not null");
return (Criteria) this;
}
public Criteria andSexEqualTo(Boolean value) {
addCriterion("sex =", value, "sex");
return (Criteria) this;
}
public Criteria andSexNotEqualTo(Boolean value) {
addCriterion("sex <>", value, "sex");
return (Criteria) this;
}
public Criteria andSexGreaterThan(Boolean value) {
addCriterion("sex >", value, "sex");
return (Criteria) this;
}
public Criteria andSexGreaterThanOrEqualTo(Boolean value) {
addCriterion("sex >=", value, "sex");
return (Criteria) this;
}
public Criteria andSexLessThan(Boolean value) {
addCriterion("sex <", value, "sex");
return (Criteria) this;
}
public Criteria andSexLessThanOrEqualTo(Boolean value) {
addCriterion("sex <=", value, "sex");
return (Criteria) this;
}
public Criteria andSexIn(List<Boolean> values) {
addCriterion("sex in", values, "sex");
return (Criteria) this;
}
public Criteria andSexNotIn(List<Boolean> values) {
addCriterion("sex not in", values, "sex");
return (Criteria) this;
}
public Criteria andSexBetween(Boolean value1, Boolean value2) {
addCriterion("sex between", value1, value2, "sex");
return (Criteria) this;
}
public Criteria andSexNotBetween(Boolean value1, Boolean value2) {
addCriterion("sex not between", value1, value2, "sex");
return (Criteria) this;
}
public Criteria andLanguageIsNull() {
addCriterion("language is null");
return (Criteria) this;
}
public Criteria andLanguageIsNotNull() {
addCriterion("language is not null");
return (Criteria) this;
}
public Criteria andLanguageEqualTo(String value) {
addCriterion("language =", value, "language");
return (Criteria) this;
}
public Criteria andLanguageNotEqualTo(String value) {
addCriterion("language <>", value, "language");
return (Criteria) this;
}
public Criteria andLanguageGreaterThan(String value) {
addCriterion("language >", value, "language");
return (Criteria) this;
}
public Criteria andLanguageGreaterThanOrEqualTo(String value) {
addCriterion("language >=", value, "language");
return (Criteria) this;
}
public Criteria andLanguageLessThan(String value) {
addCriterion("language <", value, "language");
return (Criteria) this;
}
public Criteria andLanguageLessThanOrEqualTo(String value) {
addCriterion("language <=", value, "language");
return (Criteria) this;
}
public Criteria andLanguageLike(String value) {
addCriterion("language like", value, "language");
return (Criteria) this;
}
public Criteria andLanguageNotLike(String value) {
addCriterion("language not like", value, "language");
return (Criteria) this;
}
public Criteria andLanguageIn(List<String> values) {
addCriterion("language in", values, "language");
return (Criteria) this;
}
public Criteria andLanguageNotIn(List<String> values) {
addCriterion("language not in", values, "language");
return (Criteria) this;
}
public Criteria andLanguageBetween(String value1, String value2) {
addCriterion("language between", value1, value2, "language");
return (Criteria) this;
}
public Criteria andLanguageNotBetween(String value1, String value2) {
addCriterion("language not between", value1, value2, "language");
return (Criteria) this;
}
public Criteria andCityIsNull() {
addCriterion("city is null");
return (Criteria) this;
}
public Criteria andCityIsNotNull() {
addCriterion("city is not null");
return (Criteria) this;
}
public Criteria andCityEqualTo(String value) {
addCriterion("city =", value, "city");
return (Criteria) this;
}
public Criteria andCityNotEqualTo(String value) {
addCriterion("city <>", value, "city");
return (Criteria) this;
}
public Criteria andCityGreaterThan(String value) {
addCriterion("city >", value, "city");
return (Criteria) this;
}
public Criteria andCityGreaterThanOrEqualTo(String value) {
addCriterion("city >=", value, "city");
return (Criteria) this;
}
public Criteria andCityLessThan(String value) {
addCriterion("city <", value, "city");
return (Criteria) this;
}
public Criteria andCityLessThanOrEqualTo(String value) {
addCriterion("city <=", value, "city");
return (Criteria) this;
}
public Criteria andCityLike(String value) {
addCriterion("city like", value, "city");
return (Criteria) this;
}
public Criteria andCityNotLike(String value) {
addCriterion("city not like", value, "city");
return (Criteria) this;
}
public Criteria andCityIn(List<String> values) {
addCriterion("city in", values, "city");
return (Criteria) this;
}
public Criteria andCityNotIn(List<String> values) {
addCriterion("city not in", values, "city");
return (Criteria) this;
}
public Criteria andCityBetween(String value1, String value2) {
addCriterion("city between", value1, value2, "city");
return (Criteria) this;
}
public Criteria andCityNotBetween(String value1, String value2) {
addCriterion("city not between", value1, value2, "city");
return (Criteria) this;
}
public Criteria andProvinceIsNull() {
addCriterion("province is null");
return (Criteria) this;
}
public Criteria andProvinceIsNotNull() {
addCriterion("province is not null");
return (Criteria) this;
}
public Criteria andProvinceEqualTo(String value) {
addCriterion("province =", value, "province");
return (Criteria) this;
}
public Criteria andProvinceNotEqualTo(String value) {
addCriterion("province <>", value, "province");
return (Criteria) this;
}
public Criteria andProvinceGreaterThan(String value) {
addCriterion("province >", value, "province");
return (Criteria) this;
}
public Criteria andProvinceGreaterThanOrEqualTo(String value) {
addCriterion("province >=", value, "province");
return (Criteria) this;
}
public Criteria andProvinceLessThan(String value) {
addCriterion("province <", value, "province");
return (Criteria) this;
}
public Criteria andProvinceLessThanOrEqualTo(String value) {
addCriterion("province <=", value, "province");
return (Criteria) this;
}
public Criteria andProvinceLike(String value) {
addCriterion("province like", value, "province");
return (Criteria) this;
}
public Criteria andProvinceNotLike(String value) {
addCriterion("province not like", value, "province");
return (Criteria) this;
}
public Criteria andProvinceIn(List<String> values) {
addCriterion("province in", values, "province");
return (Criteria) this;
}
public Criteria andProvinceNotIn(List<String> values) {
addCriterion("province not in", values, "province");
return (Criteria) this;
}
public Criteria andProvinceBetween(String value1, String value2) {
addCriterion("province between", value1, value2, "province");
return (Criteria) this;
}
public Criteria andProvinceNotBetween(String value1, String value2) {
addCriterion("province not between", value1, value2, "province");
return (Criteria) this;
}
public Criteria andCountryIsNull() {
addCriterion("country is null");
return (Criteria) this;
}
public Criteria andCountryIsNotNull() {
addCriterion("country is not null");
return (Criteria) this;
}
public Criteria andCountryEqualTo(String value) {
addCriterion("country =", value, "country");
return (Criteria) this;
}
public Criteria andCountryNotEqualTo(String value) {
addCriterion("country <>", value, "country");
return (Criteria) this;
}
public Criteria andCountryGreaterThan(String value) {
addCriterion("country >", value, "country");
return (Criteria) this;
}
public Criteria andCountryGreaterThanOrEqualTo(String value) {
addCriterion("country >=", value, "country");
return (Criteria) this;
}
public Criteria andCountryLessThan(String value) {
addCriterion("country <", value, "country");
return (Criteria) this;
}
public Criteria andCountryLessThanOrEqualTo(String value) {
addCriterion("country <=", value, "country");
return (Criteria) this;
}
public Criteria andCountryLike(String value) {
addCriterion("country like", value, "country");
return (Criteria) this;
}
public Criteria andCountryNotLike(String value) {
addCriterion("country not like", value, "country");
return (Criteria) this;
}
public Criteria andCountryIn(List<String> values) {
addCriterion("country in", values, "country");
return (Criteria) this;
}
public Criteria andCountryNotIn(List<String> values) {
addCriterion("country not in", values, "country");
return (Criteria) this;
}
public Criteria andCountryBetween(String value1, String value2) {
addCriterion("country between", value1, value2, "country");
return (Criteria) this;
}
public Criteria andCountryNotBetween(String value1, String value2) {
addCriterion("country not between", value1, value2, "country");
return (Criteria) this;
}
public Criteria andHeadImgUrlIsNull() {
addCriterion("head_img_url is null");
return (Criteria) this;
}
public Criteria andHeadImgUrlIsNotNull() {
addCriterion("head_img_url is not null");
return (Criteria) this;
}
public Criteria andHeadImgUrlEqualTo(String value) {
addCriterion("head_img_url =", value, "headImgUrl");
return (Criteria) this;
}
public Criteria andHeadImgUrlNotEqualTo(String value) {
addCriterion("head_img_url <>", value, "headImgUrl");
return (Criteria) this;
}
public Criteria andHeadImgUrlGreaterThan(String value) {
addCriterion("head_img_url >", value, "headImgUrl");
return (Criteria) this;
}
public Criteria andHeadImgUrlGreaterThanOrEqualTo(String value) {
addCriterion("head_img_url >=", value, "headImgUrl");
return (Criteria) this;
}
public Criteria andHeadImgUrlLessThan(String value) {
addCriterion("head_img_url <", value, "headImgUrl");
return (Criteria) this;
}
public Criteria andHeadImgUrlLessThanOrEqualTo(String value) {
addCriterion("head_img_url <=", value, "headImgUrl");
return (Criteria) this;
}
public Criteria andHeadImgUrlLike(String value) {
addCriterion("head_img_url like", value, "headImgUrl");
return (Criteria) this;
}
public Criteria andHeadImgUrlNotLike(String value) {
addCriterion("head_img_url not like", value, "headImgUrl");
return (Criteria) this;
}
public Criteria andHeadImgUrlIn(List<String> values) {
addCriterion("head_img_url in", values, "headImgUrl");
return (Criteria) this;
}
public Criteria andHeadImgUrlNotIn(List<String> values) {
addCriterion("head_img_url not in", values, "headImgUrl");
return (Criteria) this;
}
public Criteria andHeadImgUrlBetween(String value1, String value2) {
addCriterion("head_img_url between", value1, value2, "headImgUrl");
return (Criteria) this;
}
public Criteria andHeadImgUrlNotBetween(String value1, String value2) {
addCriterion("head_img_url not between", value1, value2, "headImgUrl");
return (Criteria) this;
}
public Criteria andSubscribeTimeIsNull() {
addCriterion("subscribe_time is null");
return (Criteria) this;
}
public Criteria andSubscribeTimeIsNotNull() {
addCriterion("subscribe_time is not null");
return (Criteria) this;
}
public Criteria andSubscribeTimeEqualTo(Integer value) {
addCriterion("subscribe_time =", value, "subscribeTime");
return (Criteria) this;
}
public Criteria andSubscribeTimeNotEqualTo(Integer value) {
addCriterion("subscribe_time <>", value, "subscribeTime");
return (Criteria) this;
}
public Criteria andSubscribeTimeGreaterThan(Integer value) {
addCriterion("subscribe_time >", value, "subscribeTime");
return (Criteria) this;
}
public Criteria andSubscribeTimeGreaterThanOrEqualTo(Integer value) {
addCriterion("subscribe_time >=", value, "subscribeTime");
return (Criteria) this;
}
public Criteria andSubscribeTimeLessThan(Integer value) {
addCriterion("subscribe_time <", value, "subscribeTime");
return (Criteria) this;
}
public Criteria andSubscribeTimeLessThanOrEqualTo(Integer value) {
addCriterion("subscribe_time <=", value, "subscribeTime");
return (Criteria) this;
}
public Criteria andSubscribeTimeIn(List<Integer> values) {
addCriterion("subscribe_time in", values, "subscribeTime");
return (Criteria) this;
}
public Criteria andSubscribeTimeNotIn(List<Integer> values) {
addCriterion("subscribe_time not in", values, "subscribeTime");
return (Criteria) this;
}
public Criteria andSubscribeTimeBetween(Integer value1, Integer value2) {
addCriterion("subscribe_time between", value1, value2, "subscribeTime");
return (Criteria) this;
}
public Criteria andSubscribeTimeNotBetween(Integer value1, Integer value2) {
addCriterion("subscribe_time not between", value1, value2, "subscribeTime");
return (Criteria) this;
}
public Criteria andRemarkIsNull() {
addCriterion("remark is null");
return (Criteria) this;
}
public Criteria andRemarkIsNotNull() {
addCriterion("remark is not null");
return (Criteria) this;
}
public Criteria andRemarkEqualTo(String value) {
addCriterion("remark =", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotEqualTo(String value) {
addCriterion("remark <>", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThan(String value) {
addCriterion("remark >", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThanOrEqualTo(String value) {
addCriterion("remark >=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThan(String value) {
addCriterion("remark <", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThanOrEqualTo(String value) {
addCriterion("remark <=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLike(String value) {
addCriterion("remark like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotLike(String value) {
addCriterion("remark not like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkIn(List<String> values) {
addCriterion("remark in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotIn(List<String> values) {
addCriterion("remark not in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkBetween(String value1, String value2) {
addCriterion("remark between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotBetween(String value1, String value2) {
addCriterion("remark not between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andGroupIdIsNull() {
addCriterion("group_id is null");
return (Criteria) this;
}
public Criteria andGroupIdIsNotNull() {
addCriterion("group_id is not null");
return (Criteria) this;
}
public Criteria andGroupIdEqualTo(Integer value) {
addCriterion("group_id =", value, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdNotEqualTo(Integer value) {
addCriterion("group_id <>", value, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdGreaterThan(Integer value) {
addCriterion("group_id >", value, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdGreaterThanOrEqualTo(Integer value) {
addCriterion("group_id >=", value, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdLessThan(Integer value) {
addCriterion("group_id <", value, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdLessThanOrEqualTo(Integer value) {
addCriterion("group_id <=", value, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdIn(List<Integer> values) {
addCriterion("group_id in", values, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdNotIn(List<Integer> values) {
addCriterion("group_id not in", values, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdBetween(Integer value1, Integer value2) {
addCriterion("group_id between", value1, value2, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdNotBetween(Integer value1, Integer value2) {
addCriterion("group_id not between", value1, value2, "groupId");
return (Criteria) this;
}
public Criteria andTagidListIsNull() {
addCriterion("tagid_list is null");
return (Criteria) this;
}
public Criteria andTagidListIsNotNull() {
addCriterion("tagid_list is not null");
return (Criteria) this;
}
public Criteria andTagidListEqualTo(String value) {
addCriterion("tagid_list =", value, "tagidList");
return (Criteria) this;
}
public Criteria andTagidListNotEqualTo(String value) {
addCriterion("tagid_list <>", value, "tagidList");
return (Criteria) this;
}
public Criteria andTagidListGreaterThan(String value) {
addCriterion("tagid_list >", value, "tagidList");
return (Criteria) this;
}
public Criteria andTagidListGreaterThanOrEqualTo(String value) {
addCriterion("tagid_list >=", value, "tagidList");
return (Criteria) this;
}
public Criteria andTagidListLessThan(String value) {
addCriterion("tagid_list <", value, "tagidList");
return (Criteria) this;
}
public Criteria andTagidListLessThanOrEqualTo(String value) {
addCriterion("tagid_list <=", value, "tagidList");
return (Criteria) this;
}
public Criteria andTagidListLike(String value) {
addCriterion("tagid_list like", value, "tagidList");
return (Criteria) this;
}
public Criteria andTagidListNotLike(String value) {
addCriterion("tagid_list not like", value, "tagidList");
return (Criteria) this;
}
public Criteria andTagidListIn(List<String> values) {
addCriterion("tagid_list in", values, "tagidList");
return (Criteria) this;
}
public Criteria andTagidListNotIn(List<String> values) {
addCriterion("tagid_list not in", values, "tagidList");
return (Criteria) this;
}
public Criteria andTagidListBetween(String value1, String value2) {
addCriterion("tagid_list between", value1, value2, "tagidList");
return (Criteria) this;
}
public Criteria andTagidListNotBetween(String value1, String value2) {
addCriterion("tagid_list not between", value1, value2, "tagidList");
return (Criteria) this;
}
public Criteria andSubscribeSceneIsNull() {
addCriterion("subscribe_scene is null");
return (Criteria) this;
}
public Criteria andSubscribeSceneIsNotNull() {
addCriterion("subscribe_scene is not null");
return (Criteria) this;
}
public Criteria andSubscribeSceneEqualTo(String value) {
addCriterion("subscribe_scene =", value, "subscribeScene");
return (Criteria) this;
}
public Criteria andSubscribeSceneNotEqualTo(String value) {
addCriterion("subscribe_scene <>", value, "subscribeScene");
return (Criteria) this;
}
public Criteria andSubscribeSceneGreaterThan(String value) {
addCriterion("subscribe_scene >", value, "subscribeScene");
return (Criteria) this;
}
public Criteria andSubscribeSceneGreaterThanOrEqualTo(String value) {
addCriterion("subscribe_scene >=", value, "subscribeScene");
return (Criteria) this;
}
public Criteria andSubscribeSceneLessThan(String value) {
addCriterion("subscribe_scene <", value, "subscribeScene");
return (Criteria) this;
}
public Criteria andSubscribeSceneLessThanOrEqualTo(String value) {
addCriterion("subscribe_scene <=", value, "subscribeScene");
return (Criteria) this;
}
public Criteria andSubscribeSceneLike(String value) {
addCriterion("subscribe_scene like", value, "subscribeScene");
return (Criteria) this;
}
public Criteria andSubscribeSceneNotLike(String value) {
addCriterion("subscribe_scene not like", value, "subscribeScene");
return (Criteria) this;
}
public Criteria andSubscribeSceneIn(List<String> values) {
addCriterion("subscribe_scene in", values, "subscribeScene");
return (Criteria) this;
}
public Criteria andSubscribeSceneNotIn(List<String> values) {
addCriterion("subscribe_scene not in", values, "subscribeScene");
return (Criteria) this;
}
public Criteria andSubscribeSceneBetween(String value1, String value2) {
addCriterion("subscribe_scene between", value1, value2, "subscribeScene");
return (Criteria) this;
}
public Criteria andSubscribeSceneNotBetween(String value1, String value2) {
addCriterion("subscribe_scene not between", value1, value2, "subscribeScene");
return (Criteria) this;
}
public Criteria andQrSceneIsNull() {
addCriterion("qr_scene is null");
return (Criteria) this;
}
public Criteria andQrSceneIsNotNull() {
addCriterion("qr_scene is not null");
return (Criteria) this;
}
public Criteria andQrSceneEqualTo(Integer value) {
addCriterion("qr_scene =", value, "qrScene");
return (Criteria) this;
}
public Criteria andQrSceneNotEqualTo(Integer value) {
addCriterion("qr_scene <>", value, "qrScene");
return (Criteria) this;
}
public Criteria andQrSceneGreaterThan(Integer value) {
addCriterion("qr_scene >", value, "qrScene");
return (Criteria) this;
}
public Criteria andQrSceneGreaterThanOrEqualTo(Integer value) {
addCriterion("qr_scene >=", value, "qrScene");
return (Criteria) this;
}
public Criteria andQrSceneLessThan(Integer value) {
addCriterion("qr_scene <", value, "qrScene");
return (Criteria) this;
}
public Criteria andQrSceneLessThanOrEqualTo(Integer value) {
addCriterion("qr_scene <=", value, "qrScene");
return (Criteria) this;
}
public Criteria andQrSceneIn(List<Integer> values) {
addCriterion("qr_scene in", values, "qrScene");
return (Criteria) this;
}
public Criteria andQrSceneNotIn(List<Integer> values) {
addCriterion("qr_scene not in", values, "qrScene");
return (Criteria) this;
}
public Criteria andQrSceneBetween(Integer value1, Integer value2) {
addCriterion("qr_scene between", value1, value2, "qrScene");
return (Criteria) this;
}
public Criteria andQrSceneNotBetween(Integer value1, Integer value2) {
addCriterion("qr_scene not between", value1, value2, "qrScene");
return (Criteria) this;
}
public Criteria andQrSceneStrIsNull() {
addCriterion("qr_scene_str is null");
return (Criteria) this;
}
public Criteria andQrSceneStrIsNotNull() {
addCriterion("qr_scene_str is not null");
return (Criteria) this;
}
public Criteria andQrSceneStrEqualTo(String value) {
addCriterion("qr_scene_str =", value, "qrSceneStr");
return (Criteria) this;
}
public Criteria andQrSceneStrNotEqualTo(String value) {
addCriterion("qr_scene_str <>", value, "qrSceneStr");
return (Criteria) this;
}
public Criteria andQrSceneStrGreaterThan(String value) {
addCriterion("qr_scene_str >", value, "qrSceneStr");
return (Criteria) this;
}
public Criteria andQrSceneStrGreaterThanOrEqualTo(String value) {
addCriterion("qr_scene_str >=", value, "qrSceneStr");
return (Criteria) this;
}
public Criteria andQrSceneStrLessThan(String value) {
addCriterion("qr_scene_str <", value, "qrSceneStr");
return (Criteria) this;
}
public Criteria andQrSceneStrLessThanOrEqualTo(String value) {
addCriterion("qr_scene_str <=", value, "qrSceneStr");
return (Criteria) this;
}
public Criteria andQrSceneStrLike(String value) {
addCriterion("qr_scene_str like", value, "qrSceneStr");
return (Criteria) this;
}
public Criteria andQrSceneStrNotLike(String value) {
addCriterion("qr_scene_str not like", value, "qrSceneStr");
return (Criteria) this;
}
public Criteria andQrSceneStrIn(List<String> values) {
addCriterion("qr_scene_str in", values, "qrSceneStr");
return (Criteria) this;
}
public Criteria andQrSceneStrNotIn(List<String> values) {
addCriterion("qr_scene_str not in", values, "qrSceneStr");
return (Criteria) this;
}
public Criteria andQrSceneStrBetween(String value1, String value2) {
addCriterion("qr_scene_str between", value1, value2, "qrSceneStr");
return (Criteria) this;
}
public Criteria andQrSceneStrNotBetween(String value1, String value2) {
addCriterion("qr_scene_str not between", value1, value2, "qrSceneStr");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria implements Serializable {
protected Criteria() {
super();
}
}
public static class Criterion implements Serializable {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"2323280981@qq.com"
] | 2323280981@qq.com |
efa7037ef13e16ed8c4fda5223ced1c46e58f7f5 | 99801c4a93d8595313f48efcb32a46b82a234b8e | /src/apache_math_cluster/LocationWrapper.java | b7a3b11d1f94bda9cde79a83cc7a4c7292cddd51 | [] | no_license | jaredbebb/TaxiRankChange | 7fa380d4b521419275de573117caad959f693d16 | 07ff9dbfff69e016b76e78dd1a5d3d598e86f2cd | refs/heads/master | 2021-08-20T09:13:46.342176 | 2017-11-28T18:36:07 | 2017-11-28T18:36:07 | 110,158,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 510 | java | package apache_math_cluster;
import org.apache.commons.math3.ml.clustering.Clusterable;
public class LocationWrapper implements Clusterable {
private double[] points;
private Location location;
public LocationWrapper(Location location) {
this.location = location;
this.points = new double[] { location.getX(), location.getY() };
}
public Location getLocation() {
return location;
}
public double[] getPoint() {
return points;
}
public void clustererer(){
}
}
| [
"j.bebb@live.com"
] | j.bebb@live.com |
3111f0c1e6c62191044a38ed529a5c1de8a24fe0 | baa899f3ffe7b752cc461e0a86ba1860305c753b | /src/test/java/com/calata/codewars/kyu5/ScrambliesTest.java | 9da6c5a74b67eed3b851b91db9bb759532f2f22c | [] | no_license | Cal30/codewars | 0b1915f15da99f72df3c8a9a989265cfdd1e0930 | 3d4c33a7b5eda0868898f0b8c6cbce655c98e4d5 | refs/heads/master | 2020-04-02T06:45:22.752723 | 2018-12-28T11:08:49 | 2018-12-28T11:08:49 | 154,166,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 939 | java | package com.calata.codewars.kyu5;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class ScrambliesTest {
private static void testing(boolean actual, boolean expected) {
assertEquals(expected, actual);
}
@Test
public void test() {
System.out.println("Fixed Tests scramble");
testing(Scramblies.scramble("rkqodlw","world"), true);
testing(Scramblies.scramble("cedewaraaossoqqyt","codewars"),true);
testing(Scramblies.scramble("katas","steak"),false);
testing(Scramblies.scramble("scriptjavx","javascript"),false);
testing(Scramblies.scramble("scriptingjava","javascript"),true);
testing(Scramblies.scramble("scriptsjava","javascripts"),true);
testing(Scramblies.scramble("javscripts","javascript"),false);
testing(Scramblies.scramble("aabbcamaomsccdd","commas"),true);
testing(Scramblies.scramble("commas","commas"),true);
testing(Scramblies.scramble("sammoc","commas"),true);
}
} | [
"carlos.calatayud.gonzalez@bbva.com"
] | carlos.calatayud.gonzalez@bbva.com |
6d4d5c7adee5d97f3ef53a718aded823e1014bac | ec0c7dced8dd2a57aeedc6e36bee7e8b89cebacf | /app/src/main/java/threads/server/work/DownloadThreadWorker.java | 8d0bf5fdbdef26e2d73dbcb5a1249f408078f447 | [
"Apache-2.0"
] | permissive | ufarooq/IPFSLite | 212a127cc7f5632e7ef69400d600b6f36832d909 | b59275dd596a0b76a55efd39f5e4f13c6c8d9bf8 | refs/heads/master | 2021-02-17T01:41:50.863159 | 2020-03-04T21:56:59 | 2020-03-04T21:56:59 | 245,060,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,921 | java | package threads.server.work;
import android.content.Context;
import android.provider.DocumentsContract;
import android.util.Log;
import android.webkit.MimeTypeMap;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.work.Constraints;
import androidx.work.Data;
import androidx.work.ExistingWorkPolicy;
import androidx.work.NetworkType;
import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager;
import androidx.work.Worker;
import androidx.work.WorkerParameters;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong;
import threads.ipfs.CID;
import threads.ipfs.IPFS;
import threads.ipfs.LinkInfo;
import threads.server.InitApplication;
import threads.server.core.peers.Content;
import threads.server.core.threads.THREADS;
import threads.server.core.threads.Thread;
import threads.server.utils.Network;
public class DownloadThreadWorker extends Worker {
private static final String WID = "DTW";
private static final String TAG = DownloadThreadWorker.class.getSimpleName();
public DownloadThreadWorker(@NonNull Context context, @NonNull WorkerParameters params) {
super(context, params);
}
public static String getUniqueId(long idx) {
return WID + idx;
}
public static void download(@NonNull Context context, long idx) {
Constraints.Builder builder = new Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED);
Data.Builder data = new Data.Builder();
data.putLong(Content.IDX, idx);
OneTimeWorkRequest syncWorkRequest =
new OneTimeWorkRequest.Builder(DownloadThreadWorker.class)
.addTag(DownloadThreadWorker.TAG)
.setInputData(data.build())
.setConstraints(builder.build())
.build();
WorkManager.getInstance(context).enqueueUniqueWork(
getUniqueId(idx), ExistingWorkPolicy.KEEP, syncWorkRequest);
}
@NonNull
@Override
public Result doWork() {
long start = System.currentTimeMillis();
Log.e(TAG, " start [" + (System.currentTimeMillis() - start) + "]...");
try {
THREADS threads = THREADS.getInstance(getApplicationContext());
long idx = getInputData().getLong(Content.IDX, -1);
Thread thread = threads.getThreadByIdx(idx);
Objects.requireNonNull(thread);
CID cid = thread.getContent();
Objects.requireNonNull(cid);
List<LinkInfo> links = getLinks(cid);
if (links != null) {
if (links.isEmpty()) {
if (!isStopped()) {
DownloadContentWorker.download(getApplicationContext(), cid,
thread.getIdx(), thread.getName(), thread.getSize());
}
} else {
// thread is directory
if (!thread.isDir()) {
threads.setMimeType(thread, DocumentsContract.Document.MIME_TYPE_DIR);
}
List<Thread> threadList = evalLinks(thread, links);
for (Thread child : threadList) {
downloadThread(child);
}
}
}
} catch (Throwable e) {
Log.e(TAG, "" + e.getLocalizedMessage(), e);
} finally {
Log.e(TAG, " finish onStart [" + (System.currentTimeMillis() - start) + "]...");
}
return Result.success();
}
@Nullable
private List<LinkInfo> getLinks(@NonNull CID cid) {
int timeout = InitApplication.getDownloadTimeout(getApplicationContext());
IPFS ipfs = IPFS.getInstance(getApplicationContext());
AtomicLong started = new AtomicLong(System.currentTimeMillis());
List<LinkInfo> links = ipfs.ls(cid, () -> {
long diff = System.currentTimeMillis() - started.get();
boolean abort = !Network.isConnected(getApplicationContext())
|| (diff > (timeout * 1000));
return isStopped() || abort;
});
if (links == null) {
Log.e(TAG, "no links");
return null;
}
List<LinkInfo> result = new ArrayList<>();
for (LinkInfo link : links) {
if (!link.getName().isEmpty()) {
result.add(link);
}
}
return result;
}
private Thread getDirectoryThread(@NonNull Thread thread, @NonNull CID cid) {
THREADS threads = THREADS.getInstance(getApplicationContext());
List<Thread> entries = threads.getThreadsByContent(cid);
if (!entries.isEmpty()) {
for (Thread entry : entries) {
if (entry.getParent() == thread.getIdx()) {
return entry;
}
}
}
return null;
}
private List<Thread> evalLinks(@NonNull Thread thread, @NonNull List<LinkInfo> links) {
List<Thread> threadList = new ArrayList<>();
for (LinkInfo link : links) {
CID cid = link.getCid();
Thread entry = getDirectoryThread(thread, cid);
if (entry != null) {
if (!entry.isSeeding()) {
threadList.add(entry);
}
} else {
long idx = createThread(cid, link, thread);
entry = THREADS.getInstance(getApplicationContext()).getThreadByIdx(idx);
Objects.requireNonNull(entry);
threadList.add(entry);
}
}
return threadList;
}
private void downloadThread(@NonNull Thread thread) {
if (!isStopped()) {
if (thread.isDir()) {
DownloadThreadWorker.download(getApplicationContext(), thread.getIdx());
} else {
CID content = thread.getContent();
Objects.requireNonNull(content);
DownloadContentWorker.download(getApplicationContext(), content,
thread.getIdx(), thread.getName(), thread.getSize());
}
}
}
private long createThread(@NonNull CID cid, @NonNull LinkInfo link, @NonNull Thread parent) {
THREADS threads = THREADS.getInstance(getApplicationContext());
Thread thread = threads.createThread(parent.getIdx());
thread.setLeaching(parent.isLeaching());
thread.setContent(cid);
String filename = link.getName();
thread.setName(filename);
long size = link.getSize();
thread.setSize(size);
if (link.isDirectory()) {
thread.setMimeType(DocumentsContract.Document.MIME_TYPE_DIR);
} else {
String mimeType = evaluateMimeType(filename);
if (mimeType != null) {
thread.setMimeType(mimeType);
}
}
return threads.storeThread(thread);
}
private Optional<String> getExtension(@Nullable String filename) {
return Optional.ofNullable(filename)
.filter(f -> f.contains("."))
.map(f -> f.substring(filename.lastIndexOf(".") + 1));
}
@Nullable
private String evaluateMimeType(@NonNull String filename) {
try {
Optional<String> extension = getExtension(filename);
if (extension.isPresent()) {
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.get());
if (mimeType != null) {
return mimeType;
}
}
} catch (Throwable e) {
Log.e(TAG, "" + e.getLocalizedMessage(), e);
}
return null;
}
}
| [
"remmer.wilts@gmail.com"
] | remmer.wilts@gmail.com |
c5107a2aa81403ff4c7c61c2fcf6ecb9d8e178e9 | 9674282593486c745e155ceb0be7974f3058a506 | /MyFirstProject/Helloworld.java | 3702a0af5c4926a437353d048a591d526d9e5d7d | [] | no_license | sanjaynandy89/Javaprograms | d2356d08577ecbc4a721bc7bb39bfaec844dc188 | 5a6f8c3b9f7b18d1c298f5fec46e906a25294695 | refs/heads/master | 2020-08-13T13:20:11.890418 | 2019-10-14T07:32:51 | 2019-10-14T07:32:51 | 214,974,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 251 | java |
/**
* Write a description of class Helloworld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Helloworld
{
public static void main(String args[]){
System.out.println("Hello World");
}
}
| [
"sanjaynandy89@gmail.com"
] | sanjaynandy89@gmail.com |
e483311e95612909b85e190082a5b326b041c46f | a36595963cae45c72494aaf24a4c6ee387c74033 | /tests-qpid-jms-client/src/test/java/io/streamnative/pulsar/handlers/amqp/qpid/jms_1_1/connection/ExceptionListenerTest.java | b9fd0dfcda0d080ec1795a2d57266e974cd838bd | [
"Apache-2.0"
] | permissive | zhaijack/aop | a761d19a35c0256acee0781de02d0bbf4182e630 | ee9ff48b7b852f7613b55db49a448d37d19befa9 | refs/heads/master | 2023-06-26T03:54:38.557727 | 2021-07-18T09:12:40 | 2021-07-18T09:12:40 | 387,957,575 | 0 | 0 | Apache-2.0 | 2021-07-21T01:36:44 | 2021-07-21T01:28:13 | null | UTF-8 | Java | false | false | 5,669 | 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 io.streamnative.pulsar.handlers.amqp.qpid.jms_1_1.connection;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeThat;
import io.streamnative.pulsar.handlers.amqp.qpid.core.JmsTestBase;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import javax.jms.Connection;
import javax.jms.ExceptionListener;
import javax.jms.IllegalStateException;
import javax.jms.JMSException;
import org.junit.Test;
/**
* ExceptionListenerTest.
*/
public class ExceptionListenerTest extends JmsTestBase
{
@Test
public void testExceptionListenerHearsBrokerShutdown() throws Exception
{
assumeThat(getBrokerAdmin().supportsRestart(), is(equalTo(true)));
final CountDownLatch exceptionReceivedLatch = new CountDownLatch(1);
final AtomicReference<JMSException> exceptionHolder = new AtomicReference<>();
Connection connection = getConnection();
try
{
connection.setExceptionListener(exception -> {
exceptionHolder.set(exception);
exceptionReceivedLatch.countDown();
});
getBrokerAdmin().restart();
assertTrue("Exception was not propagated into exception listener in timely manner",
exceptionReceivedLatch.await(getReceiveTimeout(), TimeUnit.MILLISECONDS));
assertNotNull("Unexpected exception", exceptionHolder.get());
}
finally
{
connection.close();
}
}
@Test
public void testExceptionListenerClosesConnectionIsAllowed() throws Exception
{
assumeThat(getBrokerAdmin().supportsRestart(), is(equalTo(true)));
final Connection connection = getConnection();
try
{
final CountDownLatch exceptionReceivedLatch = new CountDownLatch(1);
final AtomicReference<JMSException> exceptionHolder = new AtomicReference<>();
final AtomicReference<Throwable> unexpectedExceptionHolder = new AtomicReference<>();
final ExceptionListener listener = exception -> {
exceptionHolder.set(exception);
try
{
connection.close();
// PASS
}
catch (Throwable t)
{
unexpectedExceptionHolder.set(t);
}
finally
{
exceptionReceivedLatch.countDown();
}
};
connection.setExceptionListener(listener);
getBrokerAdmin().restart();
assertTrue("Exception was not propagated into exception listener in timely manner",
exceptionReceivedLatch.await(getReceiveTimeout(), TimeUnit.MILLISECONDS));
assertNotNull("Unexpected exception", exceptionHolder.get());
assertNull("Connection#close() should not have thrown exception", unexpectedExceptionHolder.get());
}
finally
{
connection.close();
}
}
@Test
public void testExceptionListenerStopsConnection_ThrowsIllegalStateException() throws Exception
{
assumeThat(getBrokerAdmin().supportsRestart(), is(equalTo(true)));
final Connection connection = getConnection();
try
{
final CountDownLatch exceptionReceivedLatch = new CountDownLatch(1);
final AtomicReference<JMSException> exceptionHolder = new AtomicReference<>();
final AtomicReference<Throwable> unexpectedExceptionHolder = new AtomicReference<>();
final ExceptionListener listener = exception -> {
exceptionHolder.set(exception);
try
{
connection.stop();
fail("Exception not thrown");
}
catch (IllegalStateException ise)
{
// PASS
}
catch (Throwable t)
{
unexpectedExceptionHolder.set(t);
}
finally
{
exceptionReceivedLatch.countDown();
}
};
connection.setExceptionListener(listener);
getBrokerAdmin().restart();
assertTrue("Exception was not propagated into exception listener in timely manner",
exceptionReceivedLatch.await(getReceiveTimeout(), TimeUnit.MILLISECONDS));
assertNotNull("Unexpected exception", exceptionHolder.get());
assertNull("Connection#stop() should not have thrown exception", unexpectedExceptionHolder.get());
}
finally
{
connection.close();
}
}
}
| [
"noreply@github.com"
] | zhaijack.noreply@github.com |
403106a3f2bc446f2844726e9dc077d693367877 | 8e1270d150f48cd1b603ec812557ebc33fd7a3f6 | /recy/src/androidTest/java/com/uxin/recy/ExampleInstrumentedTest.java | 17fdd6a0160f62a26e3ce313d3a5a81a83954114 | [] | no_license | vittawang/androidemo | 7303dbc6655a8251c80ec9e23eb91fef01db4c7b | ed7c879c2728d0f1b7aff2bfb2b05202b458e6da | refs/heads/master | 2020-04-02T06:22:55.329045 | 2019-12-15T12:19:35 | 2019-12-15T12:19:35 | 154,145,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 710 | java | package com.uxin.recy;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.uxin.recy", appContext.getPackageName());
}
}
| [
"vitta.wang@uxin.com"
] | vitta.wang@uxin.com |
f36e7045de2b586a9189106cc468545c3f4fad14 | 1306f37f5b8dd19d937ed1fcfeec459d4c6d1599 | /src/test/java/com/traddis/awsimageupAndDown/AwsImageUpAndDownApplicationTests.java | 792f02a8dfd7158e920e0b39e4a9ff4de9e819cd | [] | no_license | urknin/aws-image-upAndDown | d38404e696e3c4a46db25bb792d04944498a140f | e918a2dfe566294cb9e13b256cd2e9712a45a9f7 | refs/heads/master | 2023-04-08T06:54:46.234563 | 2021-04-22T13:55:16 | 2021-04-22T13:55:16 | 360,537,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 232 | java | package com.traddis.awsimageupAndDown;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class AwsImageUpAndDownApplicationTests {
@Test
void contextLoads() {
}
}
| [
"rk.siddart@gmail.com"
] | rk.siddart@gmail.com |
22a8ef89358e1242e5f6aba2cbc77a203ef5decb | 8871d9d00ba0240e338c840e8e0f7e37901652ab | /spring-boot-08-starter-test/src/test/java/com/ping/SpringBoot08StarterTestApplicationTests.java | 22480e0b3197802f05fe5bad81930106748f60c9 | [] | no_license | pingxiaojie1214/SpringBoot-Base | 3e782be7bb4f6289ddefe2116892591428a7f264 | 484cab45491fe04f9b904504ad37a29605cd700c | refs/heads/master | 2022-06-20T00:32:50.257535 | 2020-05-13T02:14:13 | 2020-05-13T02:14:13 | 263,491,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package com.ping;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SpringBoot08StarterTestApplicationTests {
@Test
void contextLoads() {
}
}
| [
"pxj_work@163.com"
] | pxj_work@163.com |
930519f0a554a041661e28192fed4e1980b86a60 | 0cb35fb4a5b7dab459e7f0f6adaf0a05321e20f8 | /src/day2_printStatements/TaskNameAndPhoneNumber.java | b71d89f678288023736eb2943f307c90ce5caddb | [] | no_license | prondon/Batch8_Java_GitHub | f7ecf876cf83725d388dbabb32f049aca7591e85 | 1080ded6a46120d383337a85973897bca56b5fdb | refs/heads/main | 2023-07-30T05:46:11.098544 | 2021-09-17T01:51:33 | 2021-09-17T01:51:33 | 407,368,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 72 | java | package day2_printStatements;
public class TaskNameAndPhoneNumber {
}
| [
"88795982+prondon@users.noreply.github.com"
] | 88795982+prondon@users.noreply.github.com |
35a427cfc4692523e711dc505a4791db4d51a3ce | f1c6927202e8d0e569a7d8e65a9f729597a22060 | /videojuego/src/entidad/Duelo.java | db31434d0b49d8903ecad014c4daa0f35ba95707 | [] | no_license | MMCtoto/WSPSP | 86455862f83575ab1944de3aca94b497c2836c0a | 70fc5f8d7afc667fd07f37958d2e2463cab2649e | refs/heads/main | 2023-03-14T20:30:52.215547 | 2021-02-17T12:35:29 | 2021-02-17T12:35:29 | 329,710,325 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,479 | java | package entidad;
import java.util.Scanner;
public class Duelo {
private Personaje p1;
private Personaje p2;
public Personaje getP1() {
return p1;
}
public void setP1(Personaje p1) {
this.p1 = p1;
}
public Personaje getP2() {
return p2;
}
public void setP2(Personaje p2) {
this.p2 = p2;
}
public Personaje combatir() {
Personaje pInicial = null;
Personaje pFinal = null;
Personaje pGanador = null;
System.out.println("Bienvenidos a la pelea!!");
System.out.println("Los luchadores de hoy son: ");
System.out.println(p1);
System.out.println(p2);
if(p1.getIniciativa() > p2.getIniciativa()) {
pInicial = p1;
pFinal = p2;
}else {
pInicial = p2;
pFinal = p1;
}
System.out.println("Empieza el combate: " + pInicial);
boolean combateAcabado = false;
do {
pInicial.atacar(pFinal);
if(pFinal.getPuntosVida() <= 0) {
combateAcabado = true;
pGanador = pInicial;
System.out.println("Combatiente " + pFinal.getNombre() + " a muerto");
}else {
pFinal.atacar(pInicial);
if(pInicial.getPuntosVida() <= 0) {
pGanador = pFinal;
combateAcabado = true;
System.out.println("Combatiente " + pInicial.getNombre() + " a muerto");
}
}
//Cada vez que pase un turno, pauso el juego
System.out.println(pInicial);
System.out.println(pFinal);
Scanner sc = new Scanner(System.in);
sc.nextLine();
}while(!combateAcabado);
return pGanador;
}
}
| [
"c.capuchino@hotmail.com"
] | c.capuchino@hotmail.com |
cb9b3cc8dbb34f1008942995ebd9a96d9a42cea0 | 0d393e6d338fb707829a971fac3108a87009010c | /Submission/MyStack.java | ebf6d8481ad721fe3b00008733237c2c7a3d17ed | [] | no_license | tanmay2798/COL106 | d1804301f45185e33527d3b9c7da01af65bd52f9 | 53da9002d030e5447cf79cb885034f1a7b57bdcc | refs/heads/master | 2022-01-07T08:22:19.344994 | 2019-06-13T14:11:03 | 2019-06-13T14:11:03 | 178,493,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,751 | java | package Submission;
public class MyStack <E> {
E object;
MyStack<E> next;
MyStack<E> adder = null;
public MyStack() {
adder=null;
}
public int size() throws EmptyStackException {
MyStack<E> in = new MyStack<>();
in=adder;
if(in==null) {
return 0;
}
int i=0;
while(in!=null) {
in= in.next;
i++;
}
return i;
}
public void push(E item) {
MyStack<E> in = new MyStack<>();
in.object=item;
if(adder==null) {
adder=in;
}else {
in.next=adder;
adder = in;
}
}
public E pop() throws EmptyStackException {
MyStack <E> in1 = new MyStack<>();
if(adder==null) {
throw new EmptyStackException();
}
in1=adder.next;
adder.object=null;
adder.next=null;
adder=in1;
return null;
}
public E peek() throws EmptyStackException{
if(adder==null) {
throw new EmptyStackException();
}
return adder.object;
}
public boolean empty() {
if(adder==null) {
// System.out.println("true");
return true;
}
else {
// System.out.println("false");
return false;
}
}
public static void main(String[] args) {
MyStack <Integer> iObj = new MyStack<Integer>();
try {
iObj.push(1);
iObj.push(2);
iObj.push(3);
iObj.push(4);
iObj.push(5);
iObj.pop();
iObj.pop();
iObj.push(6);
iObj.pop();
iObj.pop();
iObj.push(7);
iObj.push(8);
iObj.push(9);
System.out.println(iObj.size());
}catch(EmptyStackException e) {
System.out.println(e) ;
}
iObj.empty();
System.out.println("list");
iObj = iObj.adder;
while(true){
if(iObj == null){
break;
}
System.out.println(iObj.object);
iObj = iObj.next;
}
}
}
class EmptyStackException extends Exception{
EmptyStackException(){
super();
}
}
| [
"tanmaygoyal@Tanmays-MacBook-Pro.local"
] | tanmaygoyal@Tanmays-MacBook-Pro.local |
022ab507cf950e9dbfd5257df2b49f0236cc8075 | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /IntroClassJava/dataset/digits/313d572e1f050451c688b97510efa105685fa275a8442f9119ce9b3f85f46e234cdf03593568e19798aed6b79c66f45c97be937d09b6ff9544f0f59162538575/000/mutations/2512/digits_313d572e_000.java | 4c8995a11c07ec5d4e15f4d6915012208963d02f | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,747 | java | package introclassJava;
class IntObj {
public int value;
public IntObj () {
} public IntObj (int i) {
value = i;
}
}
class FloatObj {
public float value;
public FloatObj () {
} public FloatObj (float i) {
value = i;
}
}
class LongObj {
public long value;
public LongObj () {
} public LongObj (long i) {
value = i;
}
}
class DoubleObj {
public double value;
public DoubleObj () {
} public DoubleObj (double i) {
value = i;
}
}
class CharObj {
public char value;
public CharObj () {
} public CharObj (char i) {
value = i;
}
}
public class digits_313d572e_000 {
public java.util.Scanner scanner;
public String output = "";
public static void main (String[]args) throws Exception {
digits_313d572e_000 mainClass = new digits_313d572e_000 ();
String output;
if (args.length > 0) {
mainClass.scanner = new java.util.Scanner (args[0]);
} else {
mainClass.scanner = new java.util.Scanner (System.in);
}
mainClass.exec ();
System.out.println (mainClass.output);
}
public void exec () throws Exception {
IntObj given = new IntObj (), digit10 = new IntObj (), digit9 =
new IntObj (), digit8 = new IntObj (), digit7 = new IntObj (), digit6 =
new IntObj (), digit5 = new IntObj (), digit4 = new IntObj (), digit3 =
new IntObj (), digit2 = new IntObj (), digit1 = new IntObj ();
output += (String.format ("\nEnter an interger > "));
given.value = scanner.nextInt ();
if (given.value >= 1 && given.value < 10) {
digit10.value = given.value % 10;
output +=
(String.format
("\n%d\nThat's all, have a nice day!\n", digit10.value));
}
if (given.value >= 10 && given.value < 100) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
output +=
(String.format
("\n%d\n%d\nThat's all, have a nice day!\n", digit10.value,
digit9.value));
}
if (given.value >= 100 && given.value < 1000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
output +=
(String.format ("\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value));
}
if (given.value >= 1000 && given.value < 10000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value) / 100000000 % 10;
digit7.value = (given.value / 1000) % 10;
output +=
(String.format ("\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value,
digit7.value));
}
if (given.value >= 10000 && given.value < 100000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value));
}
if (given.value >= 100000 && given.value < 1000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value));
}
if (given.value >= 1000000 && given.value < 10000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value));
}
if (given.value >= 10000000 && given.value < 100000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
digit3.value = (given.value / 10000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value, digit3.value));
}
if (given.value >= 100000000 && given.value < 1000000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
digit3.value = (given.value / 10000000) % 10;
digit2.value = (given.value / 100000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value, digit3.value,
digit2.value));
}
if (given.value >= 1000000000 && given.value < 10000000000L) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
digit3.value = (given.value / 10000000) % 10;
digit2.value = (given.value / 100000000) % 10;
digit1.value = (given.value / 1000000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value, digit3.value,
digit2.value, digit1.value));
}
if (true)
return;;
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
c40e3f192b4934acf34b597d64690abed9434556 | 8078d926a3c1eb7419e80d439f563d9b3e27fa1d | /JavaSolution/src/session3/q138_copy_list_with_random_pointer/Solution1.java | 152a3fea22ed2f95dee978052c4ad6545f6a8116 | [] | no_license | zhhgit/leetcode_solution_java | e98d5586b3ff2d7b0ea7f12eb4e25bdb9438ed00 | b7e8bb372fa59086fc1555a1322ee756df57d308 | refs/heads/master | 2021-09-29T18:04:43.146660 | 2021-09-09T06:40:23 | 2021-09-09T06:40:23 | 107,952,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,063 | java | package session3.q138_copy_list_with_random_pointer;
import java.util.HashMap;
import java.util.Map;
public class Solution1 {
public RandomListNode copyRandomList(RandomListNode head) {
if (head == null){
return null;
}
Map<RandomListNode,RandomListNode> map = new HashMap<>();
RandomListNode fakeHead = new RandomListNode(0);
RandomListNode addCurr = fakeHead;
RandomListNode curr = head;
while (curr != null){
addCurr.next = new RandomListNode(curr.label);
addCurr = addCurr.next;
map.put(curr,addCurr);
curr = curr.next;
}
for (RandomListNode key:map.keySet()){
if (key.random != null){
RandomListNode from = map.get(key);
from.random = map.get(key.random);
}
}
return fakeHead.next;
}
private static class RandomListNode {
int label;
RandomListNode next, random;
RandomListNode(int x) { this.label = x; }
};
}
| [
"zhh900601@sina.com"
] | zhh900601@sina.com |
6ba2aa48e589fa51f800c5298ca40533afad8b91 | 13d52514f0a5861ee2da1abe0f03a112e211c5d1 | /src/main/java/cz/burios/wt/widget/ValidateBox.java | 6535d3a28038a5493420fd613d79322f357dad9c | [] | no_license | buriosca-ortus/ortus | 6668311e59cdacff0acb3637b144c8ce37a72a59 | c0bdf9ac60f572eee16d5434fbb34a3e7eb505d4 | refs/heads/master | 2020-04-06T04:07:39.589595 | 2017-03-03T14:58:59 | 2017-03-03T14:58:59 | 83,041,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,359 | java | package cz.burios.wt.widget;
/**
* ValidateBox
*
* Override defaults with $.fn.validatebox.defaults.
*
* The validatebox is designed to validate the form input fields. If users enter invalid values, it will change the background color, display the alarm icon and a tooltip message. The validatebox can be integrated with form plugin and will prevent invalid fields from submission.
*
* Dependencies:
* - tooltip
*
* Usage
* Create validatebox from markup.
*
* <input id="vv" class="nestui-validatebox" data-options="required:true,validType:'email'">
*
* Create validatebox using javascript.
*
* <input id="vv">
* $('#vv').validatebox({
* required: true,
* validType: 'email'
* });
*
* To check password and retype password are same.
*
* // extend the 'equals' rule
* $.extend($.fn.validatebox.defaults.rules, {
* equals: {
* validator: function(value,param){
* return value == $(param[0]).val();
* },
* message: 'Field do not match.'
* }
* });
*
* <input id="pwd" name="pwd" type="password" class="nestui-validatebox" data-options="required:true">
* <input id="rpwd" name="rpwd" type="password" class="nestui-validatebox" required="required" validType="equals['#pwd']">
*
* Validate Rule
* The validate rule is defined by using required and validType property, here are the rules already implemented:
* email: Match email regex rule.
* url: Match URL regex rule.
* length[0,100]: Between x and x characters allowed.
* remote['http://.../action.do','paramName']: Send ajax request to do validate value, return 'true' when successfully.
*
* To custom validate rule, override $.fn.validatebox.defaults.rules that defines a validator function and invalid message. For example, to define a minLength valid type:
*
* $.extend($.fn.validatebox.defaults.rules, {
* minLength: {
* validator: function(value, param){
* return value.length >= param[0];
* },
* message: 'Please enter at least {0} characters.'
* }
* });
*
* Now you can use the minLength validtype to define an input box that should be inputed at least 5 characters:
*
* <input class="nestui-validatebox" data-options="validType:'minLength[5]'">
*
*
* @author Buriosca.cz
*
*/
public class ValidateBox {
}
| [
"buriosca@gmail.cz"
] | buriosca@gmail.cz |
90063bfac59820efe16031c84826069267fd66e6 | ea75c157dc16560020ff5b04800abc3e135a5b0e | /src/com/sanjula/InterBankingPty/java/Stage7/Customer.java | 0bd31a9ab4f261eab241addb9792b00883bf4f54 | [] | no_license | sanjulamadurapperuma/CAManagementSystem_Final | cc47518ee65c4fc4c3312c6757f964544a753add | 5b239e3369042934ce7605e89f54d497c922707f | refs/heads/master | 2020-03-06T17:28:30.959445 | 2018-04-01T13:43:34 | 2018-04-01T13:43:34 | 126,990,642 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,827 | java | package com.sanjula.InterBankingPty.java.Stage7;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class Customer implements Serializable{//Start of Customer class
private String name;
private char[] loginPassword;
private String phoneNumber;
private String emailAddress;
private List<BankAccount> bankAccountsList = new ArrayList<>();
public Customer(String name, char[] loginPassword, String phoneNumber, String emailAddress, List<BankAccount> bankAccountsList) {
this.name = name;
this.loginPassword = loginPassword;
this.phoneNumber = phoneNumber;
this.emailAddress = emailAddress;
this.bankAccountsList = bankAccountsList;
}
public Customer(){
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public char[] getLoginPassword() {
return loginPassword;
}
public void setLoginPassword(char[] loginPassword) {
this.loginPassword = loginPassword;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public List<BankAccount> getBankAccountsList() {
return bankAccountsList;
}
public void setBankAccountsList(List<BankAccount> bankAccountsList) {
this.bankAccountsList = bankAccountsList;
}
@Override
public String toString() {
return "[Customer Name : " + name +
", Phone Number : " + phoneNumber
+ ", Email Address : " + emailAddress +
", Bank Accounts : " +
getBankAccountsList() + "]\n\n";
}
}//End of Customer class
| [
"sanjula99@gmail.com"
] | sanjula99@gmail.com |
711d7b19b36ecfe294376888a2b4dfd01f4ca79b | cf29ccb4411a2652e95f1b2496c435a0850f3540 | /main/java/marlon/minecraftai/ai/path/OrebfuscatedMinePathFinder.java | babd74eed25696ec5546f2d12b692671ca39780d | [] | no_license | marloncalleja/MC-Experiment-AI | 0799cbad4f7f75f5d7c010fb3debd4cf63302048 | 95d5019dac85353b11d176a838fc265ddcb83eab | refs/heads/master | 2022-07-21T04:10:44.333081 | 2022-07-10T10:13:24 | 2022-07-10T10:13:24 | 93,537,809 | 4 | 1 | null | 2018-10-01T09:44:24 | 2017-06-06T16:05:36 | Java | UTF-8 | Java | false | false | 3,524 | java | /*******************************************************************************
* This file is part of Minebot.
*
* Minebot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Minebot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Minebot. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
package marlon.minecraftai.ai.path;
import marlon.minecraftai.ai.path.world.BlockSet;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
public class OrebfuscatedMinePathFinder extends MineBySettingsPathFinder {
public OrebfuscatedMinePathFinder(EnumFacing preferedDirection,
int preferedLayer) {
super(preferedDirection, preferedLayer);
}
private BlockPos searchCenter;
// private static final BlockWhitelist targetBlocks = new BlockWhitelist(
// Blocks.stone, Blocks.coal_ore, Blocks.diamond_ore, Blocks.iron_ore,
// Blocks.emerald_ore, Blocks.redstone_ore);
// See
// https://github.com/lishid/Orebfuscator/blob/master/src/com/lishid/orebfuscator/OrebfuscatorConfig.java
private static final BlockSet targetBlocks = new BlockSet(1, 4, 5, 14, 15,
16, 21, 46, 48, 49, 56, 73, 82, 129, 13, 87, 88, 112, 153);
private static final BlockSet visibleMakingBlocks = new BlockSet(
Blocks.gravel, Blocks.dirt).unionWith(targetBlocks).invert();
@Override
protected void onPreRunSearch(BlockPos playerPosition) {
this.searchCenter = playerPosition;
super.onPreRunSearch(playerPosition);
}
@Override
protected float rateDestination(int distance, int x, int y, int z) {
if (y == preferedLayer && isGoodForOrebufscator(x, y, z)) {
int d = ignoredAbs(x - searchCenter.getX(),
preferedDirection.getFrontOffsetX())
+ ignoredAbs(z - searchCenter.getZ(),
preferedDirection.getFrontOffsetZ());
return distance + maxDistancePoints + 10 + d * 5;
} else if (/*
* searchCenter.distance(new Pos(x, y, z)) < 10 &&
*/isVisible(x, y, z) || isVisible(x, y + 1, z)) {
System.out.println("Parent is rating: " + x + ", " + y + ", " + z);
return super.rateDestination(distance, x, y, z);
} else {
System.out.println("Skip (invisible) " + x + ", " + y + ", " + z);
return -1;
}
}
private int ignoredAbs(int diff, int offsetZ) {
if ((diff & 0x8000000) == (offsetZ & 0x8000000)) {
return 0;
} else {
return Math.abs(diff);
}
}
private boolean isGoodForOrebufscator(int x, int y, int z) {
return isInvisibleTarget(x, y, z) && isInvisibleTarget(x, y + 1, z);
}
private boolean isInvisibleTarget(int x, int y, int z) {
return targetBlocks.isAt(world, x, y, z) && !isVisible(x, y, z);
}
private boolean isVisible(int x, int y, int z) {
return visibleMakingBlocks.isAt(world, x, y, z + 1)
|| visibleMakingBlocks.isAt(world, x, y, z - 1)
|| visibleMakingBlocks.isAt(world, x + 1, y, z)
|| visibleMakingBlocks.isAt(world, x - 1, y, z)
|| visibleMakingBlocks.isAt(world, x, y + 1, z)
|| visibleMakingBlocks.isAt(world, x, y - 1, z);
}
}
| [
"marlon.calleja1994@gmail.com"
] | marlon.calleja1994@gmail.com |
f298119d8b83a2cd4c1885419e0f281eb3b405fd | 8612ffbd8afc629419be5b98f8e3b307a340f8f1 | /src/main/java/com/briup/dao/UserMapper.java | 5fe48834b374fca44bab838ac2ad5cb718b58f39 | [] | no_license | inori159/cms | 4d267bb7f70dfcb911104a59c42ea1c6ee824aa4 | 10fc78f946caedb9289abf68e29d694155b026a9 | refs/heads/master | 2020-09-09T13:40:36.475094 | 2019-11-25T12:22:34 | 2019-11-25T12:22:34 | 221,461,091 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,973 | java | package com.briup.dao;
import com.briup.bean.User;
import com.briup.bean.UserExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UserMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cms_user
*
* @mbg.generated Tue Nov 12 19:56:54 CST 2019
*/
long countByExample(UserExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cms_user
*
* @mbg.generated Tue Nov 12 19:56:54 CST 2019
*/
int deleteByExample(UserExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cms_user
*
* @mbg.generated Tue Nov 12 19:56:54 CST 2019
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cms_user
*
* @mbg.generated Tue Nov 12 19:56:54 CST 2019
*/
int insert(User record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cms_user
*
* @mbg.generated Tue Nov 12 19:56:54 CST 2019
*/
int insertSelective(User record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cms_user
*
* @mbg.generated Tue Nov 12 19:56:54 CST 2019
*/
List<User> selectByExample(UserExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cms_user
*
* @mbg.generated Tue Nov 12 19:56:54 CST 2019
*/
User selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cms_user
*
* @mbg.generated Tue Nov 12 19:56:54 CST 2019
*/
int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cms_user
*
* @mbg.generated Tue Nov 12 19:56:54 CST 2019
*/
int updateByExample(@Param("record") User record, @Param("example") UserExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cms_user
*
* @mbg.generated Tue Nov 12 19:56:54 CST 2019
*/
int updateByPrimaryKeySelective(User record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cms_user
*
* @mbg.generated Tue Nov 12 19:56:54 CST 2019
*/
int updateByPrimaryKey(User record);
} | [
"a136198159@qq.com"
] | a136198159@qq.com |
4d34f340eba480dda885ee816699dd0afb4233c0 | fb96ce1a6d74872a59ad8b5fbe342aa0a5411bae | /BIL/My_scripts/src/DataProvider/Read_excel.java | 6e8208d448d506c40b0539297f6ecb5c34780bda | [] | no_license | harish1250/BIL | df07f7e41a49f1704a5797adb978453402da5ac9 | b7ca6c40af2c7e550f27339ef4b3d10999f8777a | refs/heads/master | 2016-09-10T23:47:42.646219 | 2015-07-06T08:40:23 | 2015-07-07T07:39:01 | 34,776,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,913 | java | package DataProvider;
import java.io.File;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class Read_excel {
// Create webdriver interface reference as fields of test class
WebDriver driver;
String Path = "D:\\Hari\\BIL.WS\\Hari\\src\\Data_Repo\\Read.xls";
String BaseUrl ="https://foursquare.com/";
// Call class method setup, and instanciate webdriver interface reference with FirefoxDriver
@BeforeClass
public void setUp() {
System.setProperty("webdriver.chrome.driver","D:\\Hari\\chrome_driver\\chromedriver.exe");
driver = new ChromeDriver();
}
// Call class method tearDown, and close firefox driver instance
@AfterClass
public void tearDown() {
//driver.quit();
}
@DataProvider(name = "data-provider", parallel = false)
public Object[][] data() throws Exception {
Object[][] retObjArr=getTableArray(Path,"Sheet1", "Start", "End");
return(retObjArr);
}
public String[][] getTableArray(String xlFilePath, String sheetName, String tableStartName, String tableEndName) throws Exception{
String[][] tabArray=null;
Workbook workbook = Workbook.getWorkbook(new File(xlFilePath));
Sheet sheet = workbook.getSheet(sheetName);
int startRow,startCol, endRow, endCol,ci,cj;
/*********************Reading Cell Data*********************************/
Cell tableStart=sheet.findCell(tableStartName);
startRow=tableStart.getRow();
startCol=tableStart.getColumn();
Cell tableEnd= sheet.findCell(tableEndName, startCol+1,startRow+1, 100, 100, false);
endRow=tableEnd.getRow();
endCol=tableEnd.getColumn();
tabArray=new String[endRow-startRow-1][endCol-startCol-1];
ci=0;
for (int i=startRow+1;i<endRow;i++,ci++){
cj=0;
for (int j=startCol+1;j<endCol;j++,cj++){
tabArray[ci][cj]=sheet.getCell(j,i).getContents();
}
}
return(tabArray);
}
// Call the test method
@Test(dataProvider="data-provider")
public final void test(String Mail,String mobile,String FName,String LName,String Date,String Month,String Year )
throws InterruptedException {
driver.get(BaseUrl+"signup");
driver.manage().window().maximize();
driver.findElement(By.id("inputEmail")).clear();
driver.findElement(By.id("inputEmail")).sendKeys(Mail);
driver.findElement(By.id("inputPassword")).clear();
driver.findElement(By.id("inputPassword")).sendKeys(mobile);
driver.findElement(By.id("inputFirstName")).clear();
driver.findElement(By.id("inputFirstName")).sendKeys(FName);
driver.findElement(By.id("inputLastName")).clear();
driver.findElement(By.id("inputLastName")).sendKeys(LName);
driver.findElement(By.id("inputBirthDate")).clear();
driver.findElement(By.id("inputBirthDate")).sendKeys(Date);
driver.findElement(By.name("birthMonth")).clear();
driver.findElement(By.name("birthMonth")).sendKeys(Month);
driver.findElement(By.name("birthYear")).clear();
driver.findElement(By.name("birthYear")).sendKeys(Year);
driver.findElement(By.id("inputMale")).click();
}
}
| [
"hari.salamaddur@gmail.com"
] | hari.salamaddur@gmail.com |
0ff57c41abdad410a7ec84154ee69ea88902024a | 3a8cbcf0d83eb1083e58869803d1a2fc008f310e | /src/protocol/ProtocolException.java | 2cefb4f20b82c146123c073b9d47e04ca2899123 | [] | no_license | applekw/SimpleWebServer | 52358a70a06b5241ab4584def46a6273f97142e8 | a663d3d0e8a47894d65c7a84c527b86aa4742858 | refs/heads/master | 2021-01-22T08:19:35.611836 | 2012-10-30T06:59:35 | 2012-10-30T06:59:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,442 | java | /*
* ProtocolException.java
* Oct 7, 2012
*
* Simple Web Server (SWS) for CSSE 477
*
* Copyright (C) 2012 Chandan Raj Rupakheti
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either
* version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/lgpl.html>.
*
*/
package protocol;
/**
* This class is used to represent exceptions in processing
* HTTP protocol.
*
* @author Chandan R. Rupakheti (rupakhet@rose-hulman.edu)
*/
public class ProtocolException extends Exception {
private static final long serialVersionUID = -2475212356774585742L;
private int status;
/**
* Creates exception object with default message and default code.
*/
public ProtocolException() {
super("An error occured while executing http protocol.");
this.status = Protocol.NOT_IMPLEMENTED_CODE;
}
/**
* Creates exception object with supplied exception message.
*
* @param message The message for the exception.
*/
public ProtocolException(String message) {
super(message);
this.status = Protocol.NOT_IMPLEMENTED_CODE;
}
/**
* Creates exception object with supplied exception message.
*
* @param status The status code for the exception.
* @param message The message for the exception.
*/
public ProtocolException(int status, String message) {
super(message);
this.status = status;
}
/**
* Creates exception object generated due to another exception.
*
* @param cause The cause object for this exception to occur.
*/
public ProtocolException(Throwable cause) {
super(cause);
status = Protocol.NOT_IMPLEMENTED_CODE;
}
/**
* Creates exception object with supplied message and cause.
*
* @param message The message.
* @param cause The cause exception object.
*/
public ProtocolException(String message, Throwable cause) {
super(message, cause);
status = Protocol.NOT_IMPLEMENTED_CODE;
}
public int getStatus() {
return status;
}
}
| [
"applekw@rose-hulman.edu"
] | applekw@rose-hulman.edu |
32f5291e2ba955b60c14913fa6f1227529274d79 | 3377f911ffd02e4bf8139a30fd3c1536d3f1b0b0 | /spring-movieapp-datajpa/src/main/java/com/movieapp/controller/DetailsController.java | 47b0de77c5f8f30815d25a3e4ef55db3d407245b | [] | no_license | Tejapavan625/Movieapp-Spring-individual | da80f766c7f478938a06c37efde6d8e4889ce550 | dc0f9cf4cdf9e3831a60b0105fcefe982c052a6d | refs/heads/master | 2023-08-15T19:58:50.316527 | 2021-10-17T17:39:30 | 2021-10-17T17:39:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,916 | java | package com.movieapp.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.movieapp.model.Details;
import com.movieapp.service.IDetailsService;
@RestController
@RequestMapping("/movie-restapi")
public class DetailsController {
@Autowired
IDetailsService detailsService;
@GetMapping("/details")
public ResponseEntity<List<Details>> getAll() {
List<Details> detailsList = detailsService.getAll();
HttpHeaders headers = new HttpHeaders();
headers.add("desc", "Get All Details");// TO See Description for what u r doing
return ResponseEntity.status(HttpStatus.OK).headers(headers).body(detailsList);
}
@GetMapping("/details/platform/{platform}")
ResponseEntity<List<Details>> getByPlatform(String platform) {
List<Details> detailsList = detailsService.getByPlatform(platform);
HttpHeaders headers = new HttpHeaders();
headers.add("desc", "Get By Platform");// TO See Description for what u r doing
return ResponseEntity.status(HttpStatus.OK).headers(headers).body(detailsList);
}
@GetMapping("/details/name/{name}/platform/{platform}")
ResponseEntity<List<Details>> getByNameAndPlatform(@PathVariable String name, @PathVariable String platform) {
List<Details> detailsList = detailsService.getByNameAndPlatform(name, platform);
HttpHeaders headers = new HttpHeaders();
headers.add("desc", "Get All Details");// TO See Description for what u r doing
return ResponseEntity.status(HttpStatus.OK).headers(headers).body(detailsList);
}
}
| [
"teja.pavankumar@acheron-tech.com"
] | teja.pavankumar@acheron-tech.com |
a68ee8edf02df110a96f659de64dd3f52777421a | ce80e9f9d67e789507786dc3ecd96e7bcfdd6d63 | /app/src/main/java/com/runen/wnhz/runen/ui/adapter/puadapter/ZiliaoHomeAdapter.java | baca32624b96867b2429ee33295bb7063bc02b14 | [] | no_license | 441001150/MainstreamFramework | 3f8231ab68674336e5d1184059610991608b32a9 | 43716160f14469d9819cce8bdb7a2119da75e4f2 | refs/heads/master | 2020-03-17T18:22:31.821045 | 2018-05-12T12:52:23 | 2018-05-12T12:52:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,198 | java | package com.runen.wnhz.runen.ui.adapter.puadapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.runen.wnhz.runen.R;
import com.runen.wnhz.runen.data.entity.LessonListEntity;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by Administrator on 2018/5/2 0002.
*/
public class ZiliaoHomeAdapter extends RecyclerView.Adapter<ZiliaoHomeAdapter.ViewHolder> {
private MyItemClickListener mItemClickListener;
private LayoutInflater inflater;
private Context mContext;
private LessonListEntity mDatas;
public ZiliaoHomeAdapter(Context mContext, LessonListEntity mDatas) {
this.mContext = mContext;
this.mDatas = mDatas;
inflater = LayoutInflater.from(mContext);
}
@Override
public ZiliaoHomeAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = View.inflate(mContext, R.layout.item_ziliao_home, null);
return new ViewHolder(view, mItemClickListener);
}
@Override
public void onBindViewHolder(ZiliaoHomeAdapter.ViewHolder holder, int position) {
LessonListEntity.ListBean dataEntity = holder.lessonEntity = mDatas.getList().get(position);
//价格
holder.tvPrice.setText("¥" + dataEntity.getPrice());
//加载图片
Glide.with(mContext).load(dataEntity.getPic()).into(holder.ivPic);
// 标题
holder.tvTitle.setText(dataEntity.getTitle());
}
@Override
public int getItemCount() {
return mDatas.getList().size();
}
class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private MyItemClickListener mListener;
LessonListEntity.ListBean lessonEntity;
@BindView(R.id.recycler_item)
LinearLayout recycler_item;
@BindView(R.id.iv_pic)
ImageView ivPic;
@BindView(R.id.tv_title)
TextView tvTitle;
@BindView(R.id.tv_price)
TextView tvPrice;
public ViewHolder(View itemView, MyItemClickListener onItemClickListener) {
super(itemView);
ButterKnife.bind(this, itemView);
this.mListener = onItemClickListener;
recycler_item.setOnClickListener(this);
}
@Override
public void onClick(View view) {
if (mListener != null) {
mListener.onItemClick(view, lessonEntity);
}
}
}
/**
* 创建一个回调接口
*/
public interface MyItemClickListener {
void onItemClick(View view, LessonListEntity.ListBean lessonEntity);
}
/**
* 在activity里面adapter就是调用的这个方法,将点击事件监听传递过来,并赋值给全局的监听
*
* @param myItemClickListener
*/
public void setItemClickListener(MyItemClickListener myItemClickListener) {
this.mItemClickListener = myItemClickListener;
}
}
| [
"494739635@qq.com"
] | 494739635@qq.com |
c00cde19d2d1b8d64380ea09c10998d60e4907b7 | 7c03187466d8b4202e03f519e4f1eff21be725d4 | /Multiply.java | 55af445bdb3c71e9e191aaabb829b7aee3b8636a | [] | no_license | KanchanKumari5/LearGit | 7f2caad1d2e45ecd4719637eca4fdd032974bcaf | 314e03c77c6ce6cc835ffe109573cc9e2e1d5c20 | refs/heads/main | 2023-07-15T01:16:40.247854 | 2021-08-19T18:16:35 | 2021-08-19T18:16:35 | 397,924,645 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 171 | java | public class Multiply
{
public static void main(String[] args)
{
int a = 4;
int b =2;
System.out.println("the product is" +(a*b));
}
} | [
"kanchankumari@benchmarkit.solutions"
] | kanchankumari@benchmarkit.solutions |
915f23da6ec525e6e21d2b07c4a13aa46c19de28 | f2d980ea8ad3d8502f6211f5e7960b63549603de | /iso3166-integration/iso3166-client/src/main/java/org/sistcoop/iso3166/admin/client/Config.java | fdf9211e3598fd3e716b36e367dad84c5c5d57e6 | [
"MIT"
] | permissive | sistcoop/iso3166 | ef5e97a74d8abbfbbc30dd592b8ff064626a8773 | c04db942624cff8d7da3d113e84f5a8a05d6354f | refs/heads/master | 2021-01-22T12:17:17.519082 | 2015-11-25T17:55:58 | 2015-11-25T17:55:58 | 32,942,148 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 196 | java | package org.sistcoop.iso3166.admin.client;
/**
* @author rodrigo.sasaki@icarros.com.br
*/
public class Config {
public final static String name = "name";
private Config() {
}
}
| [
"carlosthe19916@gmail.com"
] | carlosthe19916@gmail.com |
7975de4c64a39530f032a72b1543b64e5c2a0862 | cb762d4b0f0ea986d339759ba23327a5b6b67f64 | /src/web/com/joymain/jecs/fi/webapp/action/FiFundbookBalanceFormController.java | c64304fa0835f2acbf53b7ee74e1cfd6eb7fb895 | [
"Apache-2.0"
] | permissive | lshowbiz/agnt_ht | c7d68c72a1d5fa7cd0e424eabb9159d3552fe9dc | fd549de35cb12a2e3db1cd9750caf9ce6e93e057 | refs/heads/master | 2020-08-04T14:24:26.570794 | 2019-10-02T03:04:13 | 2019-10-02T03:04:13 | 212,160,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,743 | java | package com.joymain.jecs.fi.webapp.action;
import java.util.Locale;
import java.math.BigDecimal;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.apache.commons.lang.StringUtils;
import com.joymain.jecs.webapp.action.BaseFormController;
import com.joymain.jecs.fi.model.FiFundbookBalance;
import com.joymain.jecs.fi.service.FiFundbookBalanceManager;
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
public class FiFundbookBalanceFormController extends BaseFormController {
private FiFundbookBalanceManager fiFundbookBalanceManager = null;
public void setFiFundbookBalanceManager(FiFundbookBalanceManager fiFundbookBalanceManager) {
this.fiFundbookBalanceManager = fiFundbookBalanceManager;
}
public FiFundbookBalanceFormController() {
setCommandName("fiFundbookBalance");
setCommandClass(FiFundbookBalance.class);
}
protected Object formBackingObject(HttpServletRequest request)
throws Exception {
String fbbId = request.getParameter("fbbId");
FiFundbookBalance fiFundbookBalance = null;
if (!StringUtils.isEmpty(fbbId)) {
fiFundbookBalance = fiFundbookBalanceManager.getFiFundbookBalance(fbbId);
} else {
fiFundbookBalance = new FiFundbookBalance();
}
return fiFundbookBalance;
}
public ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object command,
BindException errors)
throws Exception {
if (log.isDebugEnabled()) {
log.debug("entering 'onSubmit' method...");
}
FiFundbookBalance fiFundbookBalance = (FiFundbookBalance) command;
boolean isNew = (fiFundbookBalance.getFbbId() == null);
Locale locale = request.getLocale();
String key=null;
String strAction = request.getParameter("strAction");
if ("deleteFiFundbookBalance".equals(strAction) ) {
fiFundbookBalanceManager.removeFiFundbookBalance(fiFundbookBalance.getFbbId().toString());
key="fiFundbookBalance.delete";
}else{
fiFundbookBalanceManager.saveFiFundbookBalance(fiFundbookBalance);
key="fiFundbookBalance.update";
}
return new ModelAndView(getSuccessView());
}
protected void initBinder(HttpServletRequest request,
ServletRequestDataBinder binder) {
// TODO Auto-generated method stub
// binder.setAllowedFields(allowedFields);
// binder.setDisallowedFields(disallowedFields);
// binder.setRequiredFields(requiredFields);
super.initBinder(request, binder);
}
}
| [
"727736571@qq.com"
] | 727736571@qq.com |
7dcab596be2b8229f7f5796edc20d3dd46556ef7 | 4ac4a237f10e30526dce3edd20dd0acc49803305 | /src/com/lockpattern/app/LockPatternView.java | 404f20edeab0a2609ee5800c04346a0e7ca9616a | [
"Apache-2.0"
] | permissive | ZhaoYukai/LockPattern | 7768713a0ab97d3351b3cdc71de5316a083093be | 85eee62ab69c19986cbba1a9eabecad19b24b972 | refs/heads/master | 2016-09-09T17:04:42.095058 | 2015-08-06T02:19:22 | 2015-08-06T02:19:22 | 31,301,799 | 2 | 1 | null | null | null | null | GB18030 | Java | false | false | 14,713 | java | package com.lockpattern.app;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
public class LockPatternView extends View{
/*-------------------------------变量声明部分---------------------------------*/
//先把这9个点声明出来,但是没有初始化
private Point[][] points = new Point[3][3];
//一个布尔型变量判断点是否已经经过初始化了
private boolean isInit;
//两个变量分别用来存储布局的宽和高
private float width;
private float height;
//定义两个变量用于记录X和Y方向上的偏移量
private float offsetX;
private float offsetY;
//定义一些Bitmap对象来存储图片资源
private Bitmap pointNormal;
private Bitmap pointPressed;
private Bitmap pointError;
private Bitmap linePressed;
private Bitmap lineError;
//在屏幕上画图还需要画笔
private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
//为了准确设置画笔的落点,先定义出一个图像半径
private float bitmapR;
//为了画出点和点之间的连线,先声明一个点的集合变量。一旦一些点被按下,就把这些点放进一个集合中,然后在里面进行连线。所以这个pointList就是按下的点的集合
private List<Point> pointList = new ArrayList<Point>();
//为了记录鼠标移动的坐标,声明两个变量
private float movingX;
private float movingY;
//用于判断点是否已经被选择过
private boolean isSelect;
//用于判断点的选择是否结束
private boolean isFinish;
private static final int POINT_SINZE = 4;
//鼠标在移动,但是不是九宫格里面的点
private boolean movingNoPoint;
private Matrix matrix = new Matrix();
//监听器
private OnPatterChangeListener onPatterChangeListener;
/*-------------------------------------------------------------------------*/
/*-------------------------------构造函数部分---------------------------------*/
//声明3个构造函数
public LockPatternView(Context context) {
super(context);
}
public LockPatternView(Context context , AttributeSet attrs) {
super(context , attrs);
}
public LockPatternView(Context context , AttributeSet attrs , int defStyleAttr) {
super(context , attrs , defStyleAttr);
}
/*-------------------------------------------------------------------------*/
//绘制那9个点
@Override
protected void onDraw(Canvas canvas) {
//在这里先把那9个点初始化一下
if( ! isInit){ //如果没有经过初始化
initPoints(); //那就调用这个函数初始化一下
}
//画点
points2Canvas(canvas);
//画线
if(pointList.size() > 0){
Point a = pointList.get(0);
//绘制九宫格里面的点
for(int i=0; i<pointList.size() ; i++){
Point b = pointList.get(i);
line2Canvas(canvas, a, b);
a = b; //一次绘制完之后,原来的b点成了新的a点,而新的b点则在下一次循环中获得
}
//绘制鼠标的坐标点
if(movingNoPoint){
line2Canvas( canvas , a , new Point(movingX , movingY) );
}
}
}
/*-------------------------------------------------------------------------*/
//一个自定义函数,用于点的初始化
private void initPoints(){
//(1)我们得获取布局的宽和高,之所以要这样做是因为横屏和竖屏点的位置是不一样的,所以我们应该先确认当前状态下是横屏还是竖屏的
width = getWidth();
height = getHeight();
//(2)算偏移量
//然后判断是横屏还是竖屏
if(width > height){ //如果是横屏,则……
offsetX = (width - height)/2;
width = height; //由于九宫格是正方型,此时height简短,那就以它为基准,让width跟height的长度一样
}
else{ //如果是竖屏,则……
offsetY = (height - width)/2;
height = width; //由于九宫格是正方型,此时width简短,那就以它为基准,让height跟width的长度一样
}
//(3)导入图片资源
pointNormal = BitmapFactory.decodeResource(getResources() , R.drawable.oval_normal);
pointPressed = BitmapFactory.decodeResource(getResources() , R.drawable.oval_pressed);
pointError = BitmapFactory.decodeResource(getResources() , R.drawable.oval_error);
linePressed = BitmapFactory.decodeResource(getResources() , R.drawable.line_pressed);
lineError = BitmapFactory.decodeResource(getResources() , R.drawable.line_error);
//(4)设置点的坐标
//第一行
points[0][0] = new Point(offsetX + width/4 , offsetY + width/4);
points[0][1] = new Point(offsetX + width/2 , offsetY + width/4);
points[0][2] = new Point(offsetX + width - width/4, offsetY + width/4);
//第二行
points[1][0] = new Point(offsetX + width/4 , offsetY + width/2);
points[1][1] = new Point(offsetX + width/2 , offsetY + width/2);
points[1][2] = new Point(offsetX + width - width/4 , offsetY + width/2);
//第三行
points[2][0] = new Point(offsetX + width/4 , offsetY + width - width/4);
points[2][1] = new Point(offsetX + width/2 , offsetY + width - width/4);
points[2][2] = new Point(offsetX + width - width/4 , offsetY + width - width/4);
//(5)设置图片资源的半径,让画笔落点更准确
bitmapR = pointNormal.getWidth() / 2; //这样就获取了图像的一半,也就是圆的半径
//(6)设置密码
int index = 1;
for(Point[] p : points){
for(Point q : p){
q.index = index;
index ++ ;
}
}
//(7)初始化完成,把isInit标志设置为true
isInit = true;
}//自定义函数initPoints()结束
/*-------------------------------------------------------------------------*/
//一个自定义函数,用于将点在画布上画出来
private void points2Canvas(Canvas canvas) {
for(int i = 0; i< points.length ; i++){
for(int j = 0; j< points[i].length ; j++){
Point point = points[i][j];
if(point.state == Point.STATE_PRESSED){
//这里之所以要减去bitmapR是因为我们期望的圆的落点是以圆心为中心,而画笔在画的时候是从最左边开始画,这样就有了一个半径那样长的偏差
canvas.drawBitmap(pointPressed , point.x - bitmapR , point.y - bitmapR , paint);
}
else if(point.state == Point.STATE_NORMAL){
canvas.drawBitmap(pointNormal , point.x - bitmapR , point.y - bitmapR , paint);
}
else if(point.state == Point.STATE_ERROR){
canvas.drawBitmap(pointError , point.x - bitmapR , point.y - bitmapR , paint);
}
}
}
}//自定义函数points2Canvas()结束
/*-------------------------------------------------------------------------*/
private void line2Canvas(Canvas canvas , Point a , Point b){
//计算两点之间线的长度
float lineLength = (float) Math.sqrt( Math.abs(a.x - b.x) * Math.abs(a.x - b.x) + Math.abs(a.y - b.y) * Math.abs(a.y - b.y) );
float degrees = getDegrees( a , b );
canvas.rotate(degrees , a.x , a.y);
if(a.state == Point.STATE_PRESSED){
matrix.setScale(lineLength / linePressed.getWidth() , 1); //两个点的连线,图片资源是一个小方块,由于是动态拉长,所以x方向上会产生巨大缩放,而y方向上不变
matrix.postTranslate(a.x - linePressed.getWidth() , a.y - linePressed.getHeight());
canvas.drawBitmap(linePressed, matrix, paint);
}
else{
matrix.setScale(lineLength / lineError.getWidth() , 1);
matrix.postTranslate(a.x - lineError.getWidth() , a.y - lineError.getHeight());
canvas.drawBitmap(lineError, matrix, paint);
}
//再转回来
canvas.rotate(-degrees , a.x , a.y);
}
/*-------------------------------------------------------------------------*/
private float getDegrees(Point a , Point b){
float ax = a.x;
float ay = a.y;
float bx = b.x;
float by = b.y;
float degrees = 0;
if(ax == bx){ //y轴相等 90度或270度
if(by > ay){ //在y轴的下边 90
degrees = 90;
}
else if(by < ay){ //在y轴的上边 270
degrees = 270;
}
}
else if(ay == by){ //y轴相等 0或180
if(bx > ax){ //在y轴的下边 90
degrees = 0;
}
else if(bx < ax){ //在y轴的上边 270
degrees = 180;
}
}
else{
if(bx > ax){ //在y轴的右边 270~90
if(by > ay){ //在y轴的下边 0~90
degrees = 0;
degrees = degrees + switchDegrees(Math.abs(by - ay) , Math.abs(bx - ax));
}
else if(by < ay){ //在y轴的上边 270~0
degrees = 360;
degrees = degrees - switchDegrees(Math.abs(by - ay) , Math.abs(bx - ax));
}
}
else if(bx < ax){ //在y轴的左边 90~270
if(by > ay){ //在y轴的下边 180~270
degrees = 90;
degrees = degrees + switchDegrees(Math.abs(bx - ax) , Math.abs(by - ay));
}
else if(by < ay){ //在y轴的上边 90~180
degrees = 270;
degrees = degrees - switchDegrees(Math.abs(bx - ax) , Math.abs(by - ay));
}
}
}
return degrees;
}
/*-------------------------------------------------------------------------*/
private float switchDegrees(float x , float y){
//弧度转化为角度
return (float) Math.toDegrees(Math.atan2(x , y));
}
/*-------------------------------------------------------------------------*/
//当触碰点的时候,会发生什么样的逻辑
@Override
public boolean onTouchEvent(MotionEvent event) {
movingNoPoint = false;
isFinish = false;
//当鼠标的坐标和圆的坐标相接近,控制在某一个范围内的时候,就开始进行一系列判断了
movingX = event.getX();
movingY = event.getY();
Point point = null;
switch(event.getAction()){
case MotionEvent.ACTION_DOWN:
//如果鼠标当前“按下”的时候不在任何一个点的范围之内,checkSelectedPoint()会返回null,就什么操作也不执行
//如果鼠标当前“按下”的时候在某一个点的范围内,就把这个点返回回来,由于先来后到,返回的是遇到的第一个点
//重新绘制
if(onPatterChangeListener != null){
onPatterChangeListener.onPatterStart(true);
}
for(int i=0; i<pointList.size() ; i++){
Point p = pointList.get(i);
p.state = Point.STATE_NORMAL;
}
pointList.clear(); //在绘制之前先清空
point = checkSelectedPoint();
if(point != null){ //来判断你是否选中了某个点,一旦你选中了某个点,后面的绘制就正式开始了
isSelect = true; //既然开始了,就把isSelect设置为true,表示“开始了”这样的标示
}
break;
case MotionEvent.ACTION_MOVE:
if(isSelect){ //当鼠标移动的时候,发现isSelect是true,表示当前可以开始绘制了,那就用checkSelectedPoint()检查一下鼠标碰到了那些其他的点
point = checkSelectedPoint();
if(point == null){
movingNoPoint = true;
}
}
break;
case MotionEvent.ACTION_UP: //一旦鼠标抬起的时候,表示选择点的过程就结束了,那就让isSelect为false,并让isFinish为true。
isFinish = true;
isSelect = false;
break;
default:
break;
}
//对已被选中的,再选就重复的点进行检查
if( ! isFinish && isSelect && point != null){
if(pointList.contains(point)){ //如果当前选中的点已经被包含了
movingNoPoint = true;
}
else{ //如果这是一个新点
point.state = Point.STATE_PRESSED;
pointList.add(point);
}
}
//绘制结束
if(isFinish){
if(pointList.size() == 1){ //绘制不成立
resetPoint();
}
else if(pointList.size() > 0 && pointList.size() < POINT_SINZE){ //如果绘制错误
for(Point p : pointList){
p.state = Point.STATE_ERROR;
}
if(onPatterChangeListener != null){
onPatterChangeListener.onPatterChange(null);
}
}
else{ //如果绘制成功
if(onPatterChangeListener != null){
String passwordStr = "";
for(int i=0; i<pointList.size() ; i++){
passwordStr = passwordStr + pointList.get(i).index; //把角标一个一个拼接到字符串里
}
if( ! TextUtils.isEmpty(passwordStr)){
onPatterChangeListener.onPatterChange(passwordStr);
}
}
}
}
postInvalidate(); //每次执行onTouchEvent都要调用这个函数,让View刷新一下
return true;
}
/*-------------------------------------------------------------------------*/
public void resetPoint(){
for(int i=0; i<pointList.size() ; i++){
Point p = pointList.get(i);
p.state = Point.STATE_NORMAL;
}
pointList.clear();
}
/*-------------------------------------------------------------------------*/
//该函数是这样,如果鼠标的落点正好在圆内,就把当前这个圆点给毫不犹豫立即返回出去,表示这个点被选中了。因此要用两层for循环遍历所有点进行判断
private Point checkSelectedPoint(){
for(int i=0;i<points.length;i++){
for(int j=0;j<points[i].length;j++){
Point point = points[i][j];
if( (point.x - movingX)*(point.x - movingX) + (point.y - movingY)*(point.y - movingY) < bitmapR*bitmapR ){
return point;
}
}
}
return null;
}
/*-------------------------------------------------------------------------*/
/*
* 设置图案监听器(这个监听器会在onTouch的时候被触发)
*/
public static interface OnPatterChangeListener{
/*
* 图案改变
* @param passwordStr 图案密码
*/
void onPatterChange(String passwordStr);
/*
* 图案重新绘制
* @param isStart 是否重新绘制
*/
void onPatterStart(boolean isStart);
}
/*
* 设置图案监听器
* @param onPatterChangeListener
*/
public void setPatterChangeListener(OnPatterChangeListener onPatterChangeListener){
if(onPatterChangeListener != null){
this.onPatterChangeListener = onPatterChangeListener;
}
}
/*-------------------------------内部类部分---------------------------------*/
public static class Point{
//正常时候的标示
public static int STATE_NORMAL = 0;
//选中时候的标示
public static int STATE_PRESSED = 1;
//错误时候的标示
public static int STATE_ERROR = 2;
public float x,y; //点的x,y坐标
public int index = 0;
public int state = 0;
public Point(){
//什么也不写
}
public Point (float x , float y){
this.x = x;
this.y = y;
}
}//Point类结束
/*----------------------------------------------------------------------*/
}
| [
"kay_922163@163.com"
] | kay_922163@163.com |
c1e6c79bb63c507b37c0113ccad87d52a9c24f39 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/14/14_18a2bf634aece0029993ee4c7fbe15e8d883c0c9/ActionManager/14_18a2bf634aece0029993ee4c7fbe15e8d883c0c9_ActionManager_s.java | e66dcaa638321c4f94417d37f9ad58f66ed05c42 | [] | 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 | 6,392 | java | package com.chalcodes.weaponm.gui.action;
import java.awt.event.KeyEvent;
import java.util.HashSet;
import java.util.Set;
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.menu.SingleCDockableListMenuPiece;
import bibliothek.gui.dock.facile.menu.RootMenuPiece;
import com.chalcodes.weaponm.database.DatabaseManager;
import com.chalcodes.weaponm.event.Event;
import com.chalcodes.weaponm.event.EventListener;
import com.chalcodes.weaponm.event.EventSupport;
import com.chalcodes.weaponm.event.EventType;
import com.chalcodes.weaponm.gui.Gui;
import com.chalcodes.weaponm.gui.Strings;
import com.chalcodes.weaponm.network.NetworkManager;
/**
* Maintains collections of actions and UI elements that are enabled and
* disabled in response to events. Also generates the main window's menu bar.
*
* @author <a href="mailto:kjkrum@gmail.com">Kevin Krumwiede</a>
*/
public class ActionManager implements EventListener {
// private static final Logger log =
// LoggerFactory.getLogger(ActionManager.class.getSimpleName());
private final JMenuBar menuBar = new JMenuBar();
private final Set<AbstractAction> enableOnLoad = new HashSet<AbstractAction>(); // disable on unload
private final Set<JMenu> enableOnLoadMenus = new HashSet<JMenu>(); // because AbstractAction and JMenu have no ancestor in common that includes setEnabled(...)
private final Set<AbstractAction> enableOnConnect = new HashSet<AbstractAction>(); // disable on disconnect
private final Set<AbstractAction> disableOnConnect = new HashSet<AbstractAction>(); // enable on disconnect
public ActionManager(Gui gui, EventSupport eventSupport, DatabaseManager dbm, NetworkManager network, CControl dockControl) {
populateMenuBar(gui, eventSupport, dbm, network, dockControl);
eventSupport.addEventListener(this, EventType.DB_OPENED);
eventSupport.addEventListener(this, EventType.DB_CLOSED);
eventSupport.addEventListener(this, EventType.NET_CONNECTED);
eventSupport.addEventListener(this, EventType.NET_DISCONNECTED);
}
public JMenuBar getMenuBar() {
return menuBar;
}
private void populateMenuBar(Gui gui, EventSupport eventSupport, DatabaseManager dbm, NetworkManager network, CControl dockControl) {
final JMenu dbMenu = new JMenu();
setText(dbMenu, "MENU_DATABASE");
dbMenu.add(new OpenDatabaseAction(gui, dbm));
dbMenu.add(new NewDatabaseAction(gui, dbm));
AbstractAction saveAction = new SaveDatabaseAction(gui, dbm);
enableOnLoad.add(saveAction);
dbMenu.add(saveAction);
AbstractAction closeAction = new CloseDatabaseAction(gui);
enableOnLoad.add(closeAction);
dbMenu.add(closeAction);
menuBar.add(dbMenu);
final JMenu viewMenu = new JMenu();
setText(viewMenu, "MENU_VIEW");
final SingleCDockableListMenuPiece piece = new SingleCDockableListMenuPiece(dockControl);
final RootMenuPiece root = new RootMenuPiece(viewMenu) {
@Override
protected void updateEnabled() {
// do nothing
}
};
root.setDisableWhenEmpty(false);
root.add(piece);
//viewMenu.addSeparator();
// TODO save/load layout actions
// multiple perspectives? per database or global?
enableOnLoadMenus.add(viewMenu);
menuBar.add(viewMenu);
final JMenu netMenu = new JMenu();
setText(netMenu, "MENU_NETWORK");
enableOnLoadMenus.add(netMenu);
AbstractAction connectAction = new ConnectAction(dbm, network);
disableOnConnect.add(connectAction);
netMenu.add(connectAction);
AbstractAction disconnectAction = new DisconnectAction(network);
enableOnConnect.add(disconnectAction);
netMenu.add(disconnectAction);
netMenu.addSeparator();
AbstractAction optionsAction = new ShowLoginOptionsDialogAction(gui, dbm);
disableOnConnect.add(optionsAction);
netMenu.add(optionsAction);
menuBar.add(netMenu);
final JMenu weaponMenu = new JMenu();
setText(weaponMenu, "MENU_WEAPON");
weaponMenu.add(new ShowAboutDialogAction(gui));
weaponMenu.add(new ShowCreditsWindowAction(gui));
weaponMenu.add(new WebsiteAction());
weaponMenu.addSeparator();
weaponMenu.add(new ExitAction(gui));
menuBar.add(weaponMenu);
}
@Override
public void onEvent(Event event) {
switch(event.getType()) {
case DB_OPENED:
for(AbstractAction action : enableOnLoad) {
action.setEnabled(true);
}
for(JMenu menu : enableOnLoadMenus) {
menu.setEnabled(true);
}
break;
case DB_CLOSED:
//log.debug("handling DB_CLOSED");
for(AbstractAction action : enableOnLoad) {
action.setEnabled(false);
}
for(JMenu menu : enableOnLoadMenus) {
//log.debug("disabling {}", menu);
menu.setEnabled(false);
}
break;
case NET_CONNECTED:
for(AbstractAction action : enableOnConnect) {
action.setEnabled(true);
}
for(AbstractAction action : disableOnConnect) {
action.setEnabled(false);
}
break;
case NET_DISCONNECTED:
for(AbstractAction action : enableOnConnect) {
action.setEnabled(false);
}
for(AbstractAction action : disableOnConnect) {
action.setEnabled(true);
}
break;
}
}
/**
* Sets the text and keyboard mnemonic for an action.
*
* @param action the action
* @param key a key constant from {@link com.chalcodes.weaponm.gui.Strings}
*/
static void setText(AbstractAction action, String key) {
String raw = Strings.getString(key);
String stripped = raw.replace("_", "");
action.putValue(Action.NAME, stripped);
int idx = raw.indexOf('_');
if(idx != -1 && idx < stripped.length()) {
action.putValue(Action.MNEMONIC_KEY, KeyEvent.getExtendedKeyCodeForChar(stripped.charAt(idx)));
}
}
/**
* Sets the text and keyboard mnemonic for a button, menu, or menu item.
*
* @param button the button
* @param key a key constant from {@link com.chalcodes.weaponm.gui.Strings}
*/
static void setText(AbstractButton button, String key) {
String raw = Strings.getString(key);
String stripped = raw.replace("_", "");
button.setText(stripped);
int idx = raw.indexOf('_');
if(idx != -1 && idx < stripped.length()) {
button.setMnemonic(stripped.charAt(idx));
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
0985814990826fcce10148d1428c82c429b2abaf | 7e343783e626372ae533a7c2d69172684fdd5844 | /src/main/java/com/teamnine/controller/ForumController.java | e2343268b2ba64b43465470c8e05de4dcaa07b42 | [] | no_license | tyler2350/social-network | 24b8862ad4762b4032fe72c16c835157960f9e58 | 8211759c8b3ad7c16575c29b35186adb62399d69 | refs/heads/master | 2020-05-17T20:16:18.533647 | 2019-04-28T17:18:53 | 2019-04-28T17:23:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,279 | java | package com.teamnine.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.teamnine.bean.Forum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;
import com.teamnine.service.ForumService;
@Controller
@RequestMapping("/forumController")
/*
* By adding the @SessionAttributes annotation to the Controller class, the name and value attribute values of the
* annotation are the key values of the Model.
* Means that the data corresponding to these keys in the Model will also be stored in the HttpSession,
* not only in the HttpServletRequest object.
* This page can share the data stored in the HttpSession
*/
@SessionAttributes(value={"forum","forumEdit"}, types={String.class})
public class ForumController {
@Autowired
ForumService forumService;
/**
* Query forum information (unconditional)
* @param map
*/
@RequestMapping("/getforum")
public void getForum(Map<Object, Object> map) {
List<Forum> forum = forumService.getForum();
map.put("forum", forum);
System.out.println(forum);
}
/**
* Add forum information
* @param forum
* @return
*/
@RequestMapping("/setForum")
@ResponseBody
public String setForum(Map<Object, Object> map,HttpServletRequest request) {
Forum forum_add =new Forum();
forum_add.setBname(request.getParameter("bname"));
System.out.println(forumService.getForumName(forum_add));
if(forumService.getForumName(forum_add).toString().equals("[]")) {
forumService.setForum(forum_add);
System.out.println("Adding a forum successfully");
return "OK";
} else {
System.err.println("Adding a forum failed");
return "NO";
}
}
/**
* Get the data from the content.jsp page and save it in the map ("forumEdit") for use with the forumEdit.jsp page
* @param request
* @param map
* @return
*/
@RequestMapping("/getUpdateForum")
public String getUpdateForum(HttpServletRequest request,Map<Object, Object> map) {
Forum forum =new Forum();
forum.setBid(Integer.parseInt(request.getParameter("bid")));
forum.setBname(request.getParameter("bname"));
map.put("forumEdit", forum);
return "redirect:/admin/forumEdit.jsp";
}
/**
* Update the forum
* @param forum
*/
@RequestMapping("/updateForum")
@ResponseBody
public String updateForum(HttpServletRequest request) {
Forum forum =new Forum();
forum.setBid(Integer.parseInt(request.getParameter("bid")));
forum.setBname(request.getParameter("bname"));
if(forumService.getForumName(forum).toString().equals("[]")) {
forumService.updateForum(forum);
return "OK";
}else {
return "NO";
}
}
/**
* Delete info of the forum by bid
* @param request
* @return
*/
@RequestMapping("/deleteForum")
public String deleteForum(HttpServletRequest request) {
Forum forum_delete =new Forum();
forum_delete.setBid(Integer.parseInt(request.getParameter("bid")));
forumService.deleteForum(forum_delete);
return "redirect:/admin/index.jsp"; // redirect
}
}
| [
"jack870131@outlook.com"
] | jack870131@outlook.com |
ae4bf9f1d9f9d5504e00627858a305553899bde4 | dc8a8cb72a682a469a2583a03bf32697ccfb9c7b | /src/testCommands/MyCommand.java | 1b7736f4b209d76d453303aee729c2177014ee11 | [] | no_license | mrhalleg/RecepieBooks | 862388300aed7cf18f6be0572db1c9d1dc06c665 | a25c023e3cf1e3a93f775d337bc85c5be6c8ac99 | refs/heads/master | 2021-05-08T07:27:27.770954 | 2018-12-02T23:03:31 | 2018-12-02T23:03:31 | 106,865,922 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,025 | java | package testCommands;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
abstract class MyCommand {
protected Map<String, SubCommand> subCommands;
protected ArgumentList arguments;
protected boolean hasToBePlayer, adminOnly;
protected String permissions;
protected String name;
protected String usage;
protected String description;
protected String[] aliases;
public MyCommand(String name, boolean hasToBePlayer, boolean adminOnly, String usage,
String description, ArgumentList arguments, String... aliases) {
this.subCommands = new HashMap<>();
this.name = name;
this.hasToBePlayer = hasToBePlayer;
this.adminOnly = adminOnly;
this.usage = usage;
this.description = description;
this.aliases = aliases;
this.permissions = "";
}
protected boolean handle(CommandSender sender, Command command, String label, String[] args) {
if (args.length > 0 && this.subCommands.containsKey(args[0])) {
return this.subCommands.get(args[0]).handle(sender, command, args[0], Arrays
.copyOfRange(args, 1, args.length));
}
if (check(sender, args)) {
return execute(sender, command, label, args);
}
return false;
}
protected boolean check(CommandSender sender, String[] args) {
if (!((this.hasToBePlayer && sender instanceof Player) || !this.hasToBePlayer)) {
return false;
} else if (!((this.adminOnly && sender.isOp()) || !this.adminOnly)) {
return false;
} else if (this.arguments != null && this.arguments.match(args)) {
return false;
} else {
return sender.hasPermission(this.permissions);
}
}
protected List<String> complete(CommandSender sender, Command command, String label,
String[] args) {
List<String> list = new LinkedList<>();
sender.sendMessage("label: " + label);
for (String s : args) {
sender.sendMessage("args: " + s);
}
return list;
}
protected List<String> list(CommandSender sender, Command command, String label,
String[] args) {
List<String> list = new LinkedList<>();
sender.sendMessage("label: " + label);
for (String s : args) {
sender.sendMessage("args: " + s);
}
if (args.length == 0) {
list.addAll(Arrays.asList(this.aliases));
} else {
list.addAll(this.subCommands.keySet());
}
return list;
}
protected void addSubCommand(SubCommand command) {
this.subCommands.put(command.name, command);
for (String s : command.aliases) {
this.subCommands.put(s, command);
}
}
public boolean isHasToBePlayer() {
return this.hasToBePlayer;
}
public boolean isAdminOnly() {
return this.adminOnly;
}
public String getPermissions() {
return this.permissions;
}
public boolean execute(CommandSender sender, Command command, String label, String[] args) {
return false;
}
}
| [
"mr.halleg@gmail.com"
] | mr.halleg@gmail.com |
e4b4fb9a9c5ae45db2b8e2f9fe880a94895afa2d | 0cfeb6ce978ff410af302229a00f9833f3e0de34 | /app/src/main/java/com/cryptowallet/deviantx/UI/RoomDatabase/InterfacesDB/PairsListDao.java | e0792b3c993933762447c672aa357777c246f6d3 | [] | no_license | saudagarsulaiman/DeviantX | 7b735f47bcc20e276e69c34ce079bd1833a18b1e | f92ecbb7ec80d14edadcd70f33acd15e1dd5a149 | refs/heads/master | 2020-04-04T01:00:32.875394 | 2019-09-06T13:54:23 | 2019-09-06T13:54:23 | 155,664,438 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 631 | java | package com.cryptowallet.deviantx.UI.RoomDatabase.InterfacesDB;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import com.cryptowallet.deviantx.UI.RoomDatabase.ModelsRoomDB.PairsListDB;
@Dao
public interface PairsListDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insertPairsList(PairsListDB PairsListDB);
@Query("DELETE FROM pairs_list_table")
void deleteAllPairsList();
@Query("SELECT * from pairs_list_table")
PairsListDB getAllPairsList();
}
| [
"saudagar.sulaiman@gmail.com"
] | saudagar.sulaiman@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.