blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a2fe261860e84f8aabf6b7c0e4e5914770a40690 | 1c89aab3f1aad3ed4b88c199c014c239d975ae4a | /src/Decorator/Auto.java | 6dba7e9b0fc75ea4b020c09f4027277800140855 | [] | no_license | biafora-phi/StructuralPatterns | bd967b0d8f7ebd665b5efc46fb30eee6eb584557 | 6058727cdd5bc3dc3e9c5963f464e6b15602c01b | refs/heads/master | 2023-01-19T22:24:30.830248 | 2020-11-22T17:51:34 | 2020-11-22T17:51:34 | 314,881,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 73 | java | package Decorator;
public interface Auto {
public void stampa();
}
| [
"[email protected]"
] | |
9cd49e823b192215e6e320fd4a62bfcf06309e20 | 9ea704d36e5b6df52203cd31ff886edc228ab1ec | /Webadmin/src/main/java/com/ts/app/web/filter/CachingHttpHeadersFilter.java | 82dc38fcd2c8cf78e4166279559ae48335664d1f | [] | no_license | Suresh-UDS/TaskManTechGinko | 63f5d97a88f766dfd7fb00121c0d1f11c7eb14f0 | 7d23f3518b82c0510cb083c8cb7cc2ca77090bfc | refs/heads/master | 2022-12-22T14:41:46.204745 | 2018-05-21T04:41:04 | 2018-05-21T04:41:04 | 224,148,932 | 0 | 0 | null | 2022-12-07T21:23:57 | 2019-11-26T09:11:09 | JavaScript | UTF-8 | Java | false | false | 1,753 | java | package com.ts.app.web.filter;
import org.springframework.core.env.Environment;
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
/**
* This filter is used in production, to put HTTP cache headers with a long (1 month) expiration time.
*/
public class CachingHttpHeadersFilter implements Filter {
// We consider the last modified date is the start up time of the server
private final static long LAST_MODIFIED = System.currentTimeMillis();
private long CACHE_TIME_TO_LIVE = TimeUnit.DAYS.toMillis(31L);
private Environment env;
public CachingHttpHeadersFilter(Environment env) {
this.env = env;
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
CACHE_TIME_TO_LIVE = TimeUnit.DAYS.toMillis(env.getProperty("jhipster.http.cache.timeToLiveInDays",
Long.class, 31L));
}
@Override
public void destroy() {
// Nothing to destroy
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setHeader("Cache-Control", "max-age=" + CACHE_TIME_TO_LIVE + ", public");
httpResponse.setHeader("Pragma", "cache");
// Setting Expires header, for proxy caching
httpResponse.setDateHeader("Expires", CACHE_TIME_TO_LIVE + System.currentTimeMillis());
// Setting the Last-Modified header, for browser caching
httpResponse.setDateHeader("Last-Modified", LAST_MODIFIED);
chain.doFilter(request, response);
}
}
| [
"[email protected]"
] | |
4d817e3920e5bc6e062b31fcb0b0a4dcac88b286 | ce0cd1d7d6d82099036cb1f919219d87cdd39ce9 | /app/src/main/java/sg/edu/rp/c346/simplemovielist/MainActivity.java | b1087de7bfc29c7550abb4eea628c29de8e91f73 | [] | no_license | Summerfallin/SimpleMovieList | e6941c33b8e0f77fc383d9e62f683cd49647e5ef | 4ddeda1c461164d77097a55c6f6c34878b27b6a1 | refs/heads/master | 2020-03-23T04:18:26.983631 | 2018-07-16T02:13:09 | 2018-07-16T02:13:09 | 141,075,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 854 | java | package sg.edu.rp.c346.simplemovielist;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
ListView lvMovie;
ArrayList<String> alMovies = new ArrayList<>();
ArrayAdapter<String> aaMovie;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
lvMovie=findViewById(R.id.listViewMovie);
alMovies.add("Avengers Infinity War Release Date: 2018.04");
alMovies.add("Justice League Release Date: 2017.11");
aaMovie=new ArrayAdapter<>(this,android.R.layout.simple_list_item_1,alMovies);
lvMovie.setAdapter(aaMovie);
}
}
| [
"[email protected]"
] | |
4ce88bc73a9dfb2ede55881339b0710618fb2852 | 486d70f8e449a5db7966c7ddc7ef3ffc93985d49 | /jtsec-manager/jtsec-manager-pojo/src/main/java/com/jtsec/manager/pojo/vo/UserVo.java | bd0415a36965d854ac25fd8d0e813cad50f7ca6f | [] | no_license | FatLi1989/jtsec-com | 052bb4a841b134526a1aab3af64968ad58e1668a | ff4f2b3c4d7f79b94b4e9aca89edc3fc3d8c3f10 | refs/heads/master | 2020-04-19T08:02:41.900075 | 2019-01-29T01:16:40 | 2019-01-29T01:16:40 | 168,064,873 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,209 | java | package com.jtsec.manager.pojo.vo;
import lombok.Data;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @author NovLi
* @Title: userVo
* @ProjectName database_parent
* @Description: 登陆页面传接值
* @date 2018/7/916:00
*/
@Data
public class UserVo extends BasicVo {
private String userName;
private String password;
private Boolean rememberMe;
private String loginName;
private Integer userId;
private String phonenumber;
private Integer status;
private Date createTime;
private String createTimeBegin;
private String createTimeEnd;
private String email;
private String sex;
private List<Integer> roleIdList;
private Set<RoleVo> roles = new HashSet<> ();
private List<Integer> userIdList;
public UserVo (String username, String password, Boolean rememberMe, String loginName) {
this.userName = username;
this.password = password;
this.rememberMe = rememberMe;
this.loginName = loginName;
}
public UserVo (String password, String loginName) {
this.password = password;
this.loginName = loginName;
}
public UserVo (String loginName) {
this.loginName = loginName;
}
public UserVo () {
}
}
| [
"[email protected]"
] | |
648d51436bfd40a7467d22b73f4a74da27f20479 | e6ba037645e2dfab1bc8d42858118ab9986f516b | /quicklearning/src/main/java/com/dtm/quicklearning/utils/Contants.java | 40d2b30596eb2565aa746a24f4a9a044481e30e6 | [] | no_license | hoangson24198/QuickLearning | 2ef91378adcdfcd0ff29390497f9482db51158dc | 59b64bfac57dccb9cdad328658442ccceb117d41 | refs/heads/master | 2020-08-17T14:52:37.221813 | 2019-10-21T12:42:49 | 2019-10-21T12:42:49 | 215,680,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 204 | java | package com.dtm.quicklearning.utils;
public class Contants {
public static final String API = "/api";
public static final String AUTH = "/auth";
public static final String USER = "/user";
}
| [
"[email protected]"
] | |
cd00ee067da7a6c014e3550b406d2b5be94384ad | 0dd1ac8ea9dab88b6fac5fcf351b1ac32ef9cc92 | /src/main/java/com/zup/bootcamp/infrastructure/ExecutorTransacao.java | 7841069cde2ca0e57f2bf8068b69497d5ef6d201 | [
"Apache-2.0"
] | permissive | girlaineazevedozup/bootcamp-02-template-proposta | dd53156c851e3f3c92998bcb332b27927b93f944 | 35f099917bbcc91ebde69031d467a0919eb85dd1 | refs/heads/main | 2023-01-31T08:58:53.704730 | 2020-12-16T13:23:22 | 2020-12-16T13:23:22 | 317,221,737 | 0 | 0 | Apache-2.0 | 2020-11-30T12:48:01 | 2020-11-30T12:48:00 | null | UTF-8 | Java | false | false | 749 | java | package com.zup.bootcamp.infrastructure;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.function.Supplier;
@Component
public class ExecutorTransacao {
@PersistenceContext
private EntityManager manager;
@Transactional
public <T> T salvaEComita(T objeto) {
manager.persist(objeto);
return objeto;
}
@Transactional
public <T> T atualizaEComita(T objeto) {
return manager.merge(objeto);
}
@Transactional
public <T> T executa(Supplier<T> algumCodigoComRetorno){
return algumCodigoComRetorno.get();
}
}
| [
"[email protected]"
] | |
16c46273e6bc4aa6b4cd1478017b56a02ea5f1ed | 0aec52ddb84d106c27970c927c0760a70a79ba52 | /app/src/main/java/com/gayatri/navigationdrawer/QuizDbHelper.java | e59abd4690263fe3be994b9f478a4853bfc1158a | [] | no_license | gayatridev/navigationdrawer | 60f0d42fa146519b8b004a4cedbf51e4ec5857a0 | f7741e0c816d96cdf0c568dae019aeee010437fb | refs/heads/master | 2022-11-05T14:23:29.004089 | 2020-06-25T14:21:05 | 2020-06-25T14:21:05 | 274,936,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,068 | java | package com.gayatri.navigationdrawer;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.gayatri.navigationdrawer.QuizContract.*;
import androidx.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
public class QuizDbHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME="MyAwesomeQuiz.db";
private static final int DATABASE_VERSION=2;
private SQLiteDatabase db;
public QuizDbHelper(@Nullable Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
this.db=db;
//db.execSQL("DROP TABLE IF EXISTS quiz_questions");
final String SQL_CREATE_QUESTIONS_TABLE="CREATE TABLE " +
QuestionsTable.TABLE_NAME + " ( " +
QuestionsTable._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
QuestionsTable.COLUMN_QUESTION + " TEXT," +
QuestionsTable.COLUMN_OPTION1 + " TEXT," +
QuestionsTable.COLUMN_OPTION2 + " TEXT," +
QuestionsTable.COLUMN_OPTION3 + " TEXT," +
QuestionsTable.COLUMN_OPTION4 + " TEXT," +
QuestionsTable.COLUMN_CATEGORY + " INTEGER ," +
QuestionsTable.COLUMN_ANSWER_NR + " INTEGER" +
")";
db.execSQL(SQL_CREATE_QUESTIONS_TABLE);
fillQuestionTable();
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + QuestionsTable.TABLE_NAME);
onCreate(db);
}
private void fillQuestionTable() {
Question q1=new Question("Who wrote Ramayana","Valmiki","Ved Vyasa","Vinayaka","Bheeshma",1,1);
addQuestion(q1);
Question q2=new Question("Who was Bharatha s Mother","Kaushalya","Kaikayi","Sumitra","Sita",1,2);
addQuestion(q2);
Question q3=new Question("Who brought Sanjeevini Booti","Lakshmana","Hanuman","Ram ","Sugreeva",1,2);
addQuestion(q3);
}
private void addQuestion(Question question) {
this.db=db;
ContentValues cv=new ContentValues();
cv.put(QuestionsTable.COLUMN_QUESTION,question.getQuestion());
cv.put(QuestionsTable.COLUMN_OPTION1,question.getOption1());
cv.put(QuestionsTable.COLUMN_OPTION2,question.getOption2());
cv.put(QuestionsTable.COLUMN_OPTION3,question.getOption3());
cv.put(QuestionsTable.COLUMN_OPTION4,question.getOption4());
cv.put(QuestionsTable.COLUMN_CATEGORY,question.getCategory());
cv.put(QuestionsTable.COLUMN_ANSWER_NR,question.getAnswerno());
db.insert(QuestionsTable.TABLE_NAME,null,cv);
}
public ArrayList<Question> getAllQuestions(int category){
ArrayList<Question> questionList=new ArrayList<>();
db=getReadableDatabase();
Cursor c= db.rawQuery("SELECT * FROM " + QuestionsTable.TABLE_NAME + " where quiz_category=1 ", null);
if(c.moveToFirst()){
do{
Question question=new Question();
question.setQuestion(c.getString(c.getColumnIndex(QuestionsTable.COLUMN_QUESTION)));
question.setOption1(c.getString(c.getColumnIndex(QuestionsTable.COLUMN_OPTION1)));
question.setOption2(c.getString(c.getColumnIndex(QuestionsTable.COLUMN_OPTION2)));
question.setOption3(c.getString(c.getColumnIndex(QuestionsTable.COLUMN_OPTION3)));
question.setOption4(c.getString(c.getColumnIndex(QuestionsTable.COLUMN_OPTION4)));
question.setCategory(c.getInt(c.getColumnIndex(QuestionsTable.COLUMN_CATEGORY)));
question.setAnswerno(c.getInt(c.getColumnIndex(QuestionsTable.COLUMN_ANSWER_NR)));
questionList.add(question);
}while(c.moveToNext());
}
c.close();
return questionList;
}
}
| [
"[email protected]"
] | |
a81cd06054f093cc93fe4c7104c645f4957f3cbc | d41cd066c392a19398b102eab65e86fb6a7718d7 | /src/main/java/com/alten/model/Customer.java | e8de180b12b43fb76139af91cc825bca9189dde5 | [] | no_license | hitham-ramzy/demo-spring-eurka-client | 6e05f1a2773fe76ddc7fc999069adc50c8ed61ca | 3bb12f5c16ff84213cb6666de4d21df9430b06f9 | refs/heads/master | 2020-04-13T03:02:59.951166 | 2019-01-05T00:21:44 | 2019-01-05T00:21:44 | 162,920,139 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,079 | java | package com.alten.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import javax.persistence.*;
@Entity
public class Customer {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
@JsonIgnore
@JsonSerialize
private Long id;
@Column(name = "name")
private String name;
@Column(name = "address")
private String address;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@Override
public String toString() {
return "Customer{" +
"id=" + id +
", name='" + name + '\'' +
", address='" + address + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
7ce25687e0686e8cce9cf3f72b546ab6fa0016de | 5cdbeb474d4a9bf1039c6a3c8d7dbea14e6909ba | /src/main/java/com/mgh14/codegraph/MMethodVisitor.java | 7c9cfd82a2d2ff9037f9ce3824eb42f3827b7b1f | [] | no_license | mgh14/codegraph | 2cdd1f96a438694fec31e950cca66d3f9c49a3dd | 9a5d365fd5209f1cb071143750f5fca1dcca3aa0 | refs/heads/master | 2021-06-26T14:24:29.338564 | 2020-01-20T18:04:34 | 2020-01-20T18:04:34 | 227,283,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,102 | java | package com.mgh14.codegraph;
import com.mgh14.codegraph.util.ClassUtils;
import lombok.Builder;
import lombok.Value;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;
import static com.mgh14.codegraph.CodeGraphApp.ASM_VERSION;
/** */
@Slf4j
public class MMethodVisitor extends MethodVisitor {
private static final String END_DELIMITER = " //]";
private final MethodReference methodRefToVisit;
// Note: while this variable is private and final, it is NOT meant to be immutable; only the
// reference is meant to be constant. There seems to be no other way of collecting the information
// garnered in this class while parsing a method other than to give this class a data structure
// with an exterior handle that can store the information parsed here
private final Map<MethodReference, List<MethodInstructionReference>>
parentClassMethodVisitsByMethodId;
// TODO: pass in ClassReference (or something) pointing to parent of this method?
public MMethodVisitor(
MethodReference methodReferenceToVisit,
Map<MethodReference, List<MethodInstructionReference>> parentClassMethodVisitsByMethodId) {
super(ASM_VERSION);
this.methodRefToVisit = methodReferenceToVisit;
this.parentClassMethodVisitsByMethodId = parentClassMethodVisitsByMethodId;
this.parentClassMethodVisitsByMethodId.computeIfAbsent(
methodReferenceToVisit, ignored -> new ArrayList<>());
}
@Override
public void visitCode() {
log(() -> "VISIT_CODE: Beginning visit to method...", true);
super.visitCode();
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
// String noLName = name.replace("[L", StringUtils.EMPTY); // TODO: why was this needed?
MethodInstructionReference currentInstructionReference =
MethodInstructionReference.builder()
.parentRef(methodRefToVisit)
.name(name)
.owner(owner)
.desc(desc)
.opcode(opcode)
.isInterface(itf)
.build();
parentClassMethodVisitsByMethodId.get(methodRefToVisit).add(currentInstructionReference);
printInsnVisit("VISIT_METHOD_INSN", opcode, owner, name, desc);
}
@Override
public void visitInsn(int opcode) {
log(() -> String.format("VISIT_INSN: opcode: %s", ClassUtils.identifyOpcode(opcode)));
}
@Override
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
printInsnVisit("VISIT_FIELD_INSN", opcode, owner, name, desc);
}
@Override
public void visitVarInsn(int opcode, int var) {
log(
() ->
String.format(
"VISIT_VAR_INSN: opcode: %s; var: %s", ClassUtils.identifyOpcode(opcode), var));
}
@Override
public void visitLocalVariable(
String name, String desc, String signature, Label start, Label end, int index) {
log(
() ->
String.format(
"Local variable: name: %s; desc: %s; signature: %s; start: %s; end: %s; index: %d",
name, desc, signature, start, end, index));
}
@Override
public void visitEnd() {
log(() -> "END_VISIT: visit of method ended");
super.visitEnd();
}
private void printInsnVisit(
final String prefix,
final int opcode,
final String owner,
final String name,
final String desc) {
log(
() ->
String.format(
"%s: name: %s; Opcode: %s; owner: %s; desc: %s ",
prefix, name, ClassUtils.identifyOpcode(opcode), owner, desc));
}
private void log(Supplier<String> supplier) {
log(supplier, false);
}
private void log(Supplier<String> supplier, boolean requiresIndent) {
String initialIndent = requiresIndent ? "\t" : StringUtils.EMPTY;
log.debug(String.format("%s%s%s", initialIndent, supplier.get(), END_DELIMITER));
}
}
| [
"[email protected]"
] | |
740573818a2ecfb96ad30c18924c63c2965166d0 | bcaa1a733700b8be816982c239d9079fa8c334b7 | /eu.openanalytics.phaedra.calculation/src/eu/openanalytics/phaedra/calculation/pref/PreferencePage.java | 340253d64e6e8979921d33f402a3bff629c417a1 | [] | no_license | openanalytics/phaedra | dfb16cc300d0d90ca9eab233068207452d458040 | 2b0b79000bfcac311072b91f31eb196b08d294fe | refs/heads/master | 2020-12-31T07:01:38.108586 | 2020-12-16T12:30:35 | 2020-12-16T12:30:35 | 58,546,934 | 16 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,003 | java | package eu.openanalytics.phaedra.calculation.pref;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import eu.openanalytics.phaedra.calculation.Activator;
public class PreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
public PreferencePage() {
super(GRID);
}
@Override
public void init(IWorkbench workbench) {
// Do nothing.
}
@Override
protected void createFieldEditors() {
Composite parent = getFieldEditorParent();
addField(new BooleanFieldEditor(Prefs.AUTO_DEFINE_ANNOTATIONS, "Prompt to define new annotation features", parent));
}
@Override
protected IPreferenceStore doGetPreferenceStore() {
return Activator.getDefault().getPreferenceStore();
}
}
| [
"[email protected]"
] | |
b74f21886bea438a34fc508bbe138dcc519c6f42 | 4f1f45c5ac59f9ec8f1683406d9e6928a4b3c044 | /server/src/test/java/no/nav/pensjon/dsf/domene/GRUNNBU3Test.java | d719df3cbcdb63f253425994899a053bdd4a6549 | [
"MIT"
] | permissive | navikt/presys | e42d98350aa229abd0b2b640ebe1d3233dba219e | 6752deb8e57d363b968e79141c0636be19443fad | refs/heads/master | 2023-04-29T06:13:56.583597 | 2022-02-02T08:49:57 | 2022-02-02T08:49:57 | 99,563,944 | 1 | 2 | MIT | 2023-04-18T19:49:56 | 2017-08-07T09:59:33 | Java | UTF-8 | Java | false | false | 301 | java | package no.nav.pensjon.dsf.domene;
import no.nav.pensjon.dsf.domene.grunnblanketter.GRUNNBU3;
import org.junit.Test;
public class GRUNNBU3Test extends DomeneTestHelper {
@Test
public void validerGRUNNBU3() throws NoSuchMethodException {
validerEnkeltSegment(GRUNNBU3.class);
}
}
| [
"[email protected]"
] | |
ff7196c20694a8f257619601e30ee808f0bf6e78 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XRENDERING-481-38-6-MOEAD-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/internal/security/authorization/DefaultAuthorExecutor_ESTest.java | ec8a36efd12fff3509d0bbc169ec1f812adf233e | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 594 | java | /*
* This file was automatically generated by EvoSuite
* Wed Apr 08 14:33:47 UTC 2020
*/
package com.xpn.xwiki.internal.security.authorization;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class DefaultAuthorExecutor_ESTest extends DefaultAuthorExecutor_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"[email protected]"
] | |
6076c32291016f0f8a45bc09d902b55d3402297f | 8df952c107b2e2b12f4159ac4f5f775f9d7c175d | /spring-dsl-lsp-web/src/main/java/org/springframework/dsl/lsp/web/DocumentController.java | 7fe3b8e56d4a235dd50747de9843627ee173269a | [
"Apache-2.0"
] | permissive | julang2/spring-dsl | 0a17f4c921aa9711edcf2f7085ef8422b9c03e67 | cb7680273b2a91ba22d2783a0c03933802d658db | refs/heads/master | 2022-07-02T16:22:00.830460 | 2020-05-17T16:20:33 | 2020-05-17T16:20:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,243 | java | /*
* Copyright 2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.dsl.lsp.web;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dsl.service.document.DocumentService;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* Controller providing integration into a {@link DocumentService}.
*
* @author Janne Valkealahti
*
*/
@RestController
@RequestMapping("${spring.dsl.lsp.web.document-services.base-path:/document}")
public class DocumentController {
private static final Logger log = LoggerFactory.getLogger(DocumentController.class);
private DocumentService documentService;
/**
* Instantiates a new document controller.
*
* @param documentService the document service
*/
public DocumentController(DocumentService documentService) {
Assert.notNull(documentService, "documentService must be set");
this.documentService = documentService;
}
@GetMapping
public String getDocument(@RequestParam("uri") String uri) {
log.debug("Get request for document {}", uri);
return this.documentService.get(uri);
}
@PostMapping
public void saveDocument(@RequestParam("uri") String uri, @RequestBody String document) {
log.debug("Save request for document {}, with content {}", uri, document);
this.documentService.save(uri, document);
}
}
| [
"[email protected]"
] | |
7f989b143406e0e45d1b4ad7d7c1c64d82af6745 | 24e520fd76ddab4a334da0675d5013bc014ebfeb | /app/src/main/java/com/software/android/entities/Video.java | 67199469801cbe4e0481428ade2c97b156ed72d7 | [] | no_license | olariub2005/cameraapp | 057a84584c99ca8826a7d3e0b0c988992924595d | 1e666f056dbb246a90d50a711c7a5f64b69722e1 | refs/heads/master | 2020-07-26T19:46:05.292861 | 2019-09-16T10:37:45 | 2019-09-16T10:37:45 | 208,748,643 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,574 | java | package com.software.android.entities;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
import com.software.android.cameraapp.Permission;
import com.software.android.utils.GraphPath;
import com.software.android.utils.Logger;
import com.software.android.utils.Utils;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Date;
import java.util.List;
/**
* <ul>
* <li>3g2 (Mobile Video)</li>
* <li>3gp (Mobile Video)</li>
* <li>3gpp (Mobile Video)</li>
* <li>asf (Windows Media Video)</li>
* <li>avi (AVI Video)</li>
* <li>dat (MPEG Video)</li>
* <li>divx (DIVX Video)</li>
* <li>dv (DV Video)</li>
* <li>f4v (Flash Video)</li>
* <li>flv (Flash Video)</li>
* <li>m2ts (M2TS Video)</li>
* <li>m4v (MPEG-4 Video)</li>
* <li>mkv (Matroska Format)</li>
* <li>mod (MOD Video)</li>
* <li>mov (QuickTime Movie)</li>
* <li>mp4 (MPEG-4 Video)</li>
* <li>mpe (MPEG Video)</li>
* <li>mpeg (MPEG Video)</li>
* <li>mpeg4 (MPEG-4 Video)</li>
* <li>mpg (MPEG Video)</li>
* <li>mts (AVCHD Video)</li>
* <li>nsv (Nullsoft Video)</li>
* <li>ogm (Ogg Media Format)</li>
* <li>ogv (Ogg Video Format)</li>
* <li>qt (QuickTime Movie)</li>
* <li>tod (TOD Video)</li>
* <li>ts (MPEG Transport Stream)</li>
* <li>vob (DVD Video)</li>
* <li>wmv (Windows Media Video)</li>
* </ul>
* The aspect ratio of the video must be between 9x16 and 16x9, and the video
* cannot exceed 1024MB or 20 minutes in length. <br>
* <br>
*
*
* // @see https://developers.facebook.com/docs/reference/api/video
*/
public class Video implements Publishable {
private static final String COMMENTS = "comments";
private static final String CREATED_TIME = "created_time";
private static final String DESCRIPTION = "description";
private static final String EMBED_HTML = "embed_html";
private static final String FROM = "from";
private static final String ICON = "icon";
private static final String ID = "id";
private static final String NAME = "name"; // same as NAME
private static final String PICTURE = "picture";
private static final String SOURCE = "source";
private static final String TAGS = "tags";
private static final String UPDATED_TIME = "updated_time";
private static final String TITLE = "title"; // same as TITLE
private static final String PRIVACY = "privacy";
@SerializedName(COMMENTS)
private Utils.DataResult<Comment> mComments;
@SerializedName(CREATED_TIME)
private Date mCreatedTime = null;
@SerializedName(DESCRIPTION)
private String mDescription = null;
@SerializedName(EMBED_HTML)
private String mEmbedHtml = null;
@SerializedName(FROM)
private User mFrom = null;
@SerializedName(ICON)
private String mIcon = null;
@SerializedName(ID)
private String mId = null;
@SerializedName(NAME)
private String mName = null;
@SerializedName(PICTURE)
private String mPicture = null;
@SerializedName(SOURCE)
private String mSource = null;
@SerializedName(TAGS)
private Utils.DataResult<User> mTags = null;
@SerializedName(UPDATED_TIME)
private Date mUpdatedTime = null;
@SerializedName(PRIVACY)
private Privacy mPrivacy = null;
private String mFileName = null;
private Parcelable mParcelable = null;
private byte[] mBytes = null;
private Video(Builder builder) {
mDescription = builder.mDescription;
mName = builder.mTitle;
mFileName = builder.mFileName;
mPrivacy = builder.mPrivacy;
mParcelable = builder.mParcelable;
mBytes = builder.mBytes;
}
@Override
public String getPath() {
return GraphPath.VIDEOS;
}
@Override
public Permission getPermission() {
return Permission.PUBLISH_ACTION;
}
public Bundle getBundle() {
Bundle bundle = new Bundle();
// add title
if (mName != null) {
bundle.putString(TITLE, mName);
}
// add description
if (mDescription != null) {
bundle.putString(DESCRIPTION, mDescription);
}
// add privacy
if (mPrivacy != null) {
bundle.putString(PRIVACY, mPrivacy.getJSONString());
}
// add video
if (mParcelable != null) {
bundle.putParcelable(mFileName, mParcelable);
}
else if (mBytes != null) {
bundle.putByteArray(mFileName, mBytes);
}
return bundle;
}
/**
* All of the comments on this video
*/
public List<Comment> getComments() {
return mComments.data;
}
/**
* The time the video was initially published
*/
public Date getCreatedTime() {
return mCreatedTime;
}
/**
* The description of the video
*/
public String getDescription() {
return mDescription;
}
/**
* The html element that may be embedded in an Web page to play the video
*/
public String getEmbedHtml() {
return mEmbedHtml;
}
/**
* The profile (user or page) that created the video
*/
public User getFrom() {
return mFrom;
}
/**
* The icon that Facebook displays when video are published to the Feed
*/
public String getIcon() {
return mIcon;
}
/**
* The video ID
*/
public String getId() {
return mId;
}
/**
* The video title or caption
*/
public String getName() {
return mName;
}
/**
* The URL for the thumbnail picture for the video
*/
public String getPicture() {
return mPicture;
}
/**
* A URL to the raw, playable video file
*/
public String getSource() {
return mSource;
}
/**
* The users who are tagged in this video
*/
public String getFileName() {
return mFileName;
}
public List<User> getTags() {
return mTags.data;
}
/**
* The last time the video or its caption were updated
*/
public Date getUpdateTime() {
return mUpdatedTime;
}
public static class Builder {
private String mDescription = null;
private String mTitle = null;
private String mFileName = null;
private Privacy mPrivacy = null;
private Parcelable mParcelable = null;
private byte[] mBytes = null;
public Builder() {
}
/**
* Set video to be published.<br>
* <br>
* The aspect ratio of the video must be between 9x16 and 16x9, and the
* video cannot exceed 1024MB or 20 minutes in length.
*
* @param file
*/
public Builder setVideo(File file) {
try {
mParcelable = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
mFileName = file.getName();
}
catch (FileNotFoundException e) {
Logger.logError(Photo.class, "Failed to create photo from file", e);
}
return this;
}
/**
* Set video to be published.<br>
* <br>
* The aspect ratio of the video must be between 9x16 and 16x9, and the
* video cannot exceed 1024MB or 20 minutes in length.
*
* @param bytes
*/
public Builder setVideo(String fileName, byte[] bytes) {
mBytes = bytes;
mFileName = fileName;
return this;
}
/**
* Set description of the video.
*
* @param description
* The description of the video
*/
public Builder setDescription(String description) {
mDescription = description;
return this;
}
/**
* Set name of the video.
*
* @param title
* The name of the video
*/
public Builder setTitle(String title) {
mTitle = title;
return this;
}
/**
* Set privacy settings of the video.
*
* @param privacy
* The privacy settings of the video
* @see Privacy
*/
public Builder setPrivacy(Privacy privacy) {
mPrivacy = privacy;
return this;
}
public Video build() {
return new Video(this);
}
}
}
| [
"[email protected]"
] | |
e763a2013f350ce2c023eb46df405fd6b25b428f | 6459071de1e267e37ec0ebac34d33d9895be4b66 | /core/src/main/java/com/catorv/gallop/job/JobModule.java | 8c590a8b0191fc312c7fd1e1618a6d978077fa26 | [] | no_license | catorv/gallop | 822323240b33b901e896fa534dbd871c28d18f6d | b4812f3e78905d2f9fddf0539e002e7f2f57d214 | refs/heads/master | 2020-12-07T12:06:44.093582 | 2016-12-02T03:29:13 | 2016-12-02T03:29:13 | 66,290,958 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 880 | java | package com.catorv.gallop.job;
import com.catorv.gallop.job.schedule.ScheduleManager;
import com.catorv.gallop.job.schedule.ScheduledJobListener;
import com.google.inject.AbstractModule;
import com.google.inject.matcher.Matchers;
/**
* Schedule Module
* 依赖模块:
* ConfigurationModule
* LifecycleModule
* LoggerModule
* Created by cator on 8/10/16.
*/
public class JobModule extends AbstractModule {
@Override
protected void configure() {
bind(ScheduleManager.class).asEagerSingleton();
ScheduledJobListener scheduledJobListener = new ScheduledJobListener();
requestInjection(scheduledJobListener);
bindListener(Matchers.any(), scheduledJobListener);
AsyncInterceptor asyncInterceptor = new AsyncInterceptor();
requestInjection(asyncInterceptor);
bindInterceptor(Matchers.any(), Matchers.annotatedWith(Async.class),
asyncInterceptor);
}
}
| [
"[email protected]"
] | |
440e87ab5b6c52250178fdde56fd67805f980ad4 | a26e2d945f9c8cde0565c4379f33f955d3fb3638 | /CH12/src/MyAnimationPanel.java | ff5ef517990e0f438dd4018d4e6f4d0860844864 | [] | no_license | rashmitpankhania/head-first-java-notes | 14afda4230a992543c0612278df8d04cefa3e1c3 | 1072aa1535e6c9868997fa808d5eddae03196d89 | refs/heads/master | 2021-05-20T11:14:45.554051 | 2020-04-01T20:06:21 | 2020-04-01T20:06:21 | 252,269,852 | 0 | 1 | null | 2020-04-01T20:01:28 | 2020-04-01T19:37:23 | Java | UTF-8 | Java | false | false | 1,044 | java | import javax.sound.midi.ControllerEventListener;
import javax.sound.midi.ShortMessage;
import javax.swing.*;
import java.awt.*;
public class MyAnimationPanel extends JPanel implements ControllerEventListener {
boolean msg = false;
@Override
public void controlChange(ShortMessage shortMessage) {
msg = true;
repaint();
}
@Override
protected void paintComponent(Graphics g) {
if (msg) {
Graphics2D graphics2D = (Graphics2D) g;
int red = (int) (Math.random() * 255);
int green = (int) (Math.random() * 255);
int blue = (int) (Math.random() * 255);
int ht = (int) ((Math.random() * 120) + 10);
int width = (int) ((Math.random() * 120) + 10);
int x = (int) ((Math.random() * 40) + (Math.random()*100));
int y = (int) ((Math.random() * 40) + (Math.random()*100));
g.setColor(new Color(red, green, blue));
g.fillRect(x,y,ht, width);
msg = false;
}
}
}
| [
"[email protected]"
] | |
d62d99ea4c5c4615d83c0f4da53a5349192ac2c5 | 3e81486524e9f366b0cd4cb01ea1a78a84437beb | /kaleido-appengine/src/test/java/org/kaleidofoundry/core/cache/GaeCacheManagerTest.java | b78f022247e7c234363550bb0941c82f757ef3af | [
"Apache-2.0"
] | permissive | jraduget/kaleido-repository | 952a2bd21db5df5478657d73242da128154070d0 | 19b0b931874fa76cf69fb36d70596760ebd506e7 | refs/heads/master | 2023-06-30T09:33:00.020680 | 2022-01-05T22:24:07 | 2022-01-05T22:24:07 | 743,632 | 0 | 1 | Apache-2.0 | 2023-06-20T02:53:54 | 2010-06-27T19:10:16 | Java | UTF-8 | Java | false | false | 2,302 | java | /*
* Copyright 2008-2021 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kaleidofoundry.core.cache;
import java.io.IOException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.kaleidofoundry.core.context.RuntimeContext;
import com.google.appengine.tools.development.testing.LocalMemcacheServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
/**
* GAE Cache Manager
*
* @author jraduget
*/
public class GaeCacheManagerTest extends AbstractCacheManagerTest {
protected static LocalServiceTestHelper helper;
@BeforeClass
public static void init() throws IOException {
helper = new LocalServiceTestHelper(new LocalMemcacheServiceTestConfig());
helper.setUp();
}
@AfterClass
public static void tearDown() {
helper.tearDown();
}
@Override
protected String getAvailableConfiguration() {
return "classpath:/noneed";
}
@Override
protected String getCacheImplementationCode() {
return CacheProvidersEnum.gae.name();
}
@Override
protected RuntimeContext<CacheManager> getCacheManagerContext() {
return new RuntimeContext<CacheManager>("gaeCacheManager", CacheManager.class);
}
@Ignore
@Test
@Override
public void cacheDefinitionNotFoundException() {
super.cacheDefinitionNotFoundException();
}
@Ignore
@Test
@Override
public void configurationNotFoundException() {
super.configurationNotFoundException();
}
@Ignore
@Test
@Override
public void illegalConfiguration() {
super.illegalConfiguration();
}
@Ignore
@Test
@Override
public void invalidConfiguration() {
super.invalidConfiguration();
}
}
| [
"[email protected]"
] | |
bab9201e6868008248f27f356fa13db82f80403c | d0818d293683edf6f41ae654a9af0e46c7630271 | /src/ch_17/exercise17_03/Exercise17_03.java | a8866abdf2e8aad5e5da4de65fb8e85f8672efa8 | [] | no_license | smokysky/intro-to-java-programming | 798f6e325a5459ccc82cfa9601d2d64a332977fc | 72f829b69e2fc6bfe41e0a611783bf62ec9e9331 | refs/heads/master | 2023-04-13T22:37:26.404091 | 2021-04-27T01:14:50 | 2021-04-27T01:14:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,246 | java | package ch_17.exercise17_03;
import ch_17.exercise17_01.Exercise17_01;
import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
/**
* *17.3 (Sum all the integers in a binary data file) Suppose a binary data file named
* Exercise17_03.dat has been created and its data are created using
* writeInt(int) in DataOutputStream. The file contains an unspecified
* number of integers. Write a program to find the sum of the integers
*
* @author Harry D.
*/
public class Exercise17_03 {
public static void main(String[] args) {
String[] packageParts = Exercise17_01.class.getPackage().getName().split("\\.");
String filePath =
"src" + File.separator + packageParts[0] + File.separator + packageParts[1] + File.separator + "Exercise17_03.dat";
if (!(new File(filePath).exists())) {
try (FileOutputStream fis = new FileOutputStream(filePath)) {
DataOutputStream dos = new DataOutputStream(fis);
runCreateTestDatFile(dos);
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getLocalizedMessage());
}
}
try (FileInputStream fis = new FileInputStream(filePath)) {
DataInputStream dis = new DataInputStream(fis);
int sum = 0;
int numIntegers = dis.available() / 4; // An integer is stored as 4 bytes
System.out.print("The sum of: ");
for (int i = 0; i < numIntegers; i++) {
int n = dis.readInt();
if (i == 0) {
System.out.print(n + "");
} else {
System.out.print(" + " + n);
}
sum += n;
}
System.out.println(" = " + sum);
} catch (IOException e) {
e.printStackTrace();
}
}
static void runCreateTestDatFile(DataOutputStream dos) throws IOException {
for (int i = 0; i < 10; i++) {
int n = (int) (1 + Math.random() * 10);
dos.writeInt(n);
}
dos.flush();
dos.close();
}
} | [
"[email protected]"
] | |
b4878f6a296be46742cceea999ee422f68c1bbb7 | ce30e2404be37b640536398535fdef208a99a210 | /bdd-gwen-filer/src/com/savvasdalkitsis/bdd/gwen/filer/android/fragment/DirectoryListAdapter.java | 5d90e69a5644e9df6e2a23871a6c76edf94b6e8e | [] | no_license | juanvelasco/bdd-with-gwen | 1f22b979383c4486befe943351e2a6e25b8222a4 | 804d8fa993a31be23a57d14f4b781d45ff014a05 | refs/heads/master | 2021-01-16T22:59:36.096179 | 2013-12-17T13:23:35 | 2013-12-17T13:23:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,346 | java | package com.savvasdalkitsis.bdd.gwen.filer.android.fragment;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.savvasdalkitsis.bdd.gwen.filer.model.directory.DirectoryContents;
import com.savvasdalkitsis.bdd.gwen.filer.model.directory.DirectoryEntry;
public class DirectoryListAdapter extends BaseAdapter{
private DirectoryContents directoryContents;
public DirectoryListAdapter(DirectoryContents directoryContents) {
this.directoryContents = directoryContents;
}
@Override
public int getCount() {
return directoryContents.itemCount();
}
@Override
public DirectoryEntry getItem(int position) {
return directoryContents.getEntry(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return getDirectoryListRow(convertView, parent)
.bindTo(getItem(position));
}
private DirectoryListRowView getDirectoryListRow(View convertView, ViewGroup parent) {
DirectoryListRowView row = (DirectoryListRowView) convertView;
if (convertView == null) {
row = new DirectoryListRowView(parent.getContext());
}
return row;
}
}
| [
"[email protected]"
] | |
666c102b3b2c6016add85b1794831eb706d7b35b | 31929ea4e48a68b34471452823961ec13351c850 | /src/algorithmbasic/util/MainUtil.java | ddbe3c736ffba117b3f6ddd4cfff2c4ed21f5fde | [] | no_license | cJamesSmith/algorithm | db5e3cc7ecac9e805e8f2a4deb58408c770f2a59 | 1be86b3a96f81bab34c0d2f6177027d6962c7998 | refs/heads/master | 2023-08-11T18:07:31.964829 | 2021-09-22T10:09:19 | 2021-09-22T10:09:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,160 | java | package algorithmbasic.util;
import java.util.Arrays;
public class MainUtil {
public static class Node{
public int value;
public Node left;
public Node right;
public Node(int val){
this.value = val;
}
}
public static int[] generatorRandomArray(int maxValue, int maxLength) {
//创建最大长度为maxLength的随机数组[0,maxLength+1)
int length = (int) (Math.random() * (maxLength)) + 1;
int[] arr = new int[length];
for (int i = 0; i < arr.length; i++) {
//随机生成-N~N的数组值
arr[i] = (int) (Math.random() * (maxValue + 1)) - (int) (Math.random() * (maxValue + 1));
}
return arr;
}
public static int[] copyArray(int[] arr){
int[] arr1 = new int[arr.length];
for (int i = 0;i<arr.length;i++){
arr1[i] = arr[i];
}
return arr1;
}
public static void printArray(int[] arr){
for (int i = 0;i<arr.length;i++){
System.out.print(arr[i]+" ");
}
System.out.println();
}
public static void compareArray(int[] arr){
Arrays.sort(arr);
}
public static boolean compareTo(int[] arr,int[] arr1){
if(arr == null) return arr1==null;
if(arr1 == null) return arr==null;
boolean bool = arr.length == arr1.length;
if (bool){
for (int i = 0;i<arr.length;i++){
if(arr[i]!= arr1[i]) return false;
}
}
return bool;
}
/**
* 两个位置的数进行交换,值相等的情况下禁止调用
*
* @param arr
* @param i
* @param j
*/
public static void swap(int[] arr, int i, int j) {
arr[i] = arr[i] ^ arr[j];
arr[j] = arr[i] ^ arr[j];
arr[i] = arr[i] ^ arr[j];
}
/**
* 两个位置的数进行交换,值相等的情况下禁止调用
*
* @param arr
* @param i
* @param j
*/
public static void swap2(int[] arr, int i, int j) {
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
}
| [
"[email protected]"
] | |
9e5d9a6d742aecbd0e53325fe73b02523e26ba56 | 13183cabec64cabee412f7074b5ec6a776ec357e | /src/main/java/io/zdp/node/web/api/validation/model/ValidationCommitRequest.java | d3e68e6ea3bc353c2d07e1e53809128b34f4d217 | [
"MIT"
] | permissive | zerodaypayments/zdp-node | 006af49b0e5aa7c1f1c9f1ffb3c4dad575610cab | 23f1a1716f51c8146cbf3b8ea670e5e98f5da0fa | refs/heads/master | 2020-03-16T18:18:00.909372 | 2018-05-30T07:45:56 | 2018-05-30T07:45:56 | 132,867,460 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,371 | java | package io.zdp.node.web.api.validation.model;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.util.UUID;
import org.bouncycastle.util.encoders.Hex;
import io.zdp.crypto.Hashing;
import io.zdp.node.storage.account.domain.Account;
import io.zdp.node.storage.transfer.domain.CurrentTransfer;
@SuppressWarnings("serial")
public class ValidationCommitRequest implements Serializable {
private String requestUuid = UUID.randomUUID().toString();
private byte[] requestSignature;
private String serverUuid;
private byte[] transferSignature;
private CurrentTransfer transfer;
private Account fromAccount;
private Account toAccount;
public byte[] toHashData() {
return Hashing.ripemd160((requestUuid + " " + transfer.getUuid() + " " + fromAccount.getUuid() + " " + toAccount.getUuid() + " " + serverUuid).getBytes(StandardCharsets.UTF_8));
}
public Account getFromAccount() {
return fromAccount;
}
public void setFromAccount(Account fromAccount) {
this.fromAccount = fromAccount;
}
public Account getToAccount() {
return toAccount;
}
public void setToAccount(Account toAccount) {
this.toAccount = toAccount;
}
public byte[] getTransferSignature() {
return transferSignature;
}
public void setTransferSignature(byte[] transferSignature) {
this.transferSignature = transferSignature;
}
public String getRequestUuid() {
return requestUuid;
}
public void setRequestUuid(String requestUuid) {
this.requestUuid = requestUuid;
}
public byte[] getRequestSignature() {
return requestSignature;
}
public void setRequestSignature(byte[] requestSignature) {
this.requestSignature = requestSignature;
}
public String getServerUuid() {
return serverUuid;
}
public void setServerUuid(String serverUuid) {
this.serverUuid = serverUuid;
}
public CurrentTransfer getTransfer() {
return transfer;
}
public void setTransfer(CurrentTransfer transfer) {
this.transfer = transfer;
}
@Override
public String toString() {
return "ValidationCommitRequest [requestUuid=" + requestUuid + ", serverUuid=" + serverUuid + ", transferSignature=" + Hex.toHexString(transferSignature) + ", transfer=" + transfer + ", fromAccount=" + fromAccount + ", toAccount=" + toAccount + "]";
}
}
| [
"[email protected]"
] | |
ac7ccf3a6c93cd540a332115736ae7cebe1c4240 | 8e0135ad7b1e8f3859096a92fdbcfc256b2a7cfb | /packages/SystemUI/src/com/android/systemui/BatteryMeterView.java | ad48c7bc25306578ee480555855013bf4e449ff1 | [
"LicenseRef-scancode-unicode",
"Apache-2.0"
] | permissive | mt6572/k8c_frameworks_base | 2c9f94909a67be9b63cf79692d911f4968fb9c30 | c52d108b5770aed1cc0a875d57c9e987a941ed6c | refs/heads/master | 2020-04-10T15:44:23.795692 | 2018-12-10T05:58:47 | 2018-12-10T05:58:47 | 161,120,930 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,529 | java | /*
* Copyright (C) 2013 The Android Open Source Project
*
* 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.android.systemui;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.os.BatteryManager;
import android.os.Bundle;
import android.provider.Settings;
import android.util.AttributeSet;
import android.view.View;
import com.mediatek.systemui.statusbar.util.BatteryHelper;
public class BatteryMeterView extends View implements DemoMode {
public static final String TAG = BatteryMeterView.class.getSimpleName();
public static final String ACTION_LEVEL_TEST = "com.android.systemui.BATTERY_LEVEL_TEST";
public static final boolean ENABLE_PERCENT = true;
public static final boolean SINGLE_DIGIT_PERCENT = false;
public static final boolean SHOW_100_PERCENT = false;
public static final int FULL = 96;
public static final int EMPTY = 4;
public static final float SUBPIXEL = 0.4f; // inset rects for softer edges
int[] mColors;
boolean mShowPercent = true;
Paint mFramePaint, mBatteryPaint, mWarningTextPaint, mTextPaint, mBoltPaint;
int mButtonHeight;
private float mTextHeight, mWarningTextHeight;
private int mHeight;
private int mWidth;
private String mWarningString;
private final int mChargeColor;
private final float[] mBoltPoints;
private final Path mBoltPath = new Path();
private final RectF mFrame = new RectF();
private final RectF mButtonFrame = new RectF();
private final RectF mClipFrame = new RectF();
private final RectF mBoltFrame = new RectF();
private class BatteryTracker extends BroadcastReceiver {
public static final int UNKNOWN_LEVEL = -1;
// current battery status
int level = UNKNOWN_LEVEL;
String percentStr;
int plugType;
boolean plugged;
int health;
int status;
String technology;
int voltage;
int temperature;
boolean testmode = false;
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
if (testmode && ! intent.getBooleanExtra("testmode", false)) return;
level = (int)(100f
* intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0)
/ intent.getIntExtra(BatteryManager.EXTRA_SCALE, 100));
plugType = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0);
plugged = plugType != 0;
health = intent.getIntExtra(BatteryManager.EXTRA_HEALTH,
BatteryManager.BATTERY_HEALTH_UNKNOWN);
status = intent.getIntExtra(BatteryManager.EXTRA_STATUS,
BatteryManager.BATTERY_STATUS_UNKNOWN);
technology = intent.getStringExtra(BatteryManager.EXTRA_TECHNOLOGY);
voltage = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, 0);
temperature = intent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, 0);
setContentDescription(
context.getString(R.string.accessibility_battery_level, level));
postInvalidate();
} else if (action.equals(ACTION_LEVEL_TEST)) {
testmode = true;
post(new Runnable() {
int curLevel = 0;
int incr = 1;
int saveLevel = level;
int savePlugged = plugType;
Intent dummy = new Intent(Intent.ACTION_BATTERY_CHANGED);
@Override
public void run() {
if (curLevel < 0) {
testmode = false;
dummy.putExtra("level", saveLevel);
dummy.putExtra("plugged", savePlugged);
dummy.putExtra("testmode", false);
} else {
dummy.putExtra("level", curLevel);
dummy.putExtra("plugged", incr > 0 ? BatteryManager.BATTERY_PLUGGED_AC : 0);
dummy.putExtra("testmode", true);
}
getContext().sendBroadcast(dummy);
if (!testmode) return;
curLevel += incr;
if (curLevel == 100) {
incr *= -1;
}
postDelayed(this, 200);
}
});
}
}
}
BatteryTracker mTracker = new BatteryTracker();
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
filter.addAction(ACTION_LEVEL_TEST);
final Intent sticky = getContext().registerReceiver(mTracker, filter);
if (sticky != null) {
// preload the battery level
mTracker.onReceive(getContext(), sticky);
}
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
getContext().unregisterReceiver(mTracker);
}
public BatteryMeterView(Context context) {
this(context, null, 0);
}
public BatteryMeterView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public BatteryMeterView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
final Resources res = context.getResources();
TypedArray levels = res.obtainTypedArray(R.array.batterymeter_color_levels);
TypedArray colors = res.obtainTypedArray(R.array.batterymeter_color_values);
final int N = levels.length();
mColors = new int[2*N];
for (int i=0; i<N; i++) {
mColors[2*i] = levels.getInt(i, 0);
mColors[2*i+1] = colors.getColor(i, 0);
}
levels.recycle();
colors.recycle();
mShowPercent = ENABLE_PERCENT && 0 != Settings.System.getInt(
context.getContentResolver(), "status_bar_show_battery_percent", 0);
mWarningString = context.getString(R.string.battery_meter_very_low_overlay_symbol);
mFramePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mFramePaint.setColor(res.getColor(R.color.batterymeter_frame_color));
mFramePaint.setDither(true);
mFramePaint.setStrokeWidth(0);
mFramePaint.setStyle(Paint.Style.FILL_AND_STROKE);
mFramePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_ATOP));
mBatteryPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBatteryPaint.setDither(true);
mBatteryPaint.setStrokeWidth(0);
mBatteryPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mTextPaint.setColor(0xFFFFFFFF);
Typeface font = Typeface.create("sans-serif-condensed", Typeface.NORMAL);
mTextPaint.setTypeface(font);
mTextPaint.setTextAlign(Paint.Align.CENTER);
mWarningTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mWarningTextPaint.setColor(mColors[1]);
font = Typeface.create("sans-serif", Typeface.BOLD);
mWarningTextPaint.setTypeface(font);
mWarningTextPaint.setTextAlign(Paint.Align.CENTER);
mChargeColor = getResources().getColor(R.color.batterymeter_charge_color);
mBoltPaint = new Paint();
mBoltPaint.setAntiAlias(true);
mBoltPaint.setColor(res.getColor(R.color.batterymeter_bolt_color));
mBoltPoints = loadBoltPoints(res);
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
private static float[] loadBoltPoints(Resources res) {
final int[] pts = res.getIntArray(R.array.batterymeter_bolt_points);
int maxX = 0, maxY = 0;
for (int i = 0; i < pts.length; i += 2) {
maxX = Math.max(maxX, pts[i]);
maxY = Math.max(maxY, pts[i + 1]);
}
final float[] ptsF = new float[pts.length];
for (int i = 0; i < pts.length; i += 2) {
ptsF[i] = (float)pts[i] / maxX;
ptsF[i + 1] = (float)pts[i + 1] / maxY;
}
return ptsF;
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
mHeight = h;
mWidth = w;
mWarningTextPaint.setTextSize(h * 0.75f);
mWarningTextHeight = -mWarningTextPaint.getFontMetrics().ascent;
}
private int getColorForLevel(int percent) {
int thresh, color = 0;
for (int i=0; i<mColors.length; i+=2) {
thresh = mColors[i];
color = mColors[i+1];
if (percent <= thresh) return color;
}
return color;
}
@Override
public void draw(Canvas c) {
BatteryTracker tracker = mDemoMode ? mDemoTracker : mTracker;
final int level = tracker.level;
/// M: Support Battery Protection.
final boolean mChargingProtection =
tracker.plugged && BatteryHelper.isPlugForProtection(tracker.status, tracker.level);
if (level == BatteryTracker.UNKNOWN_LEVEL) return;
float drawFrac = (float) level / 100f;
final int pt = getPaddingTop();
final int pl = getPaddingLeft();
final int pr = getPaddingRight();
final int pb = getPaddingBottom();
int height = mHeight - pt - pb;
int width = mWidth - pl - pr;
/// M: Support Wireless Charging.
if (mChargingProtection && BatteryHelper.isWirelessCharging(tracker.plugType)) {
height = (int)((mHeight - pt - pb) * 0.95);
}
mButtonHeight = (int) (height * 0.12f);
mFrame.set(0, 0, width, height);
mFrame.offset(pl, pt);
mButtonFrame.set(
mFrame.left + width * 0.25f,
mFrame.top,
mFrame.right - width * 0.25f,
mFrame.top + mButtonHeight + 5 /*cover frame border of intersecting area*/);
mButtonFrame.top += SUBPIXEL;
mButtonFrame.left += SUBPIXEL;
mButtonFrame.right -= SUBPIXEL;
mFrame.top += mButtonHeight;
mFrame.left += SUBPIXEL;
mFrame.top += SUBPIXEL;
mFrame.right -= SUBPIXEL;
mFrame.bottom -= SUBPIXEL;
// first, draw the battery shape
c.drawRect(mFrame, mFramePaint);
// fill 'er up
final int color = tracker.plugged ? mChargeColor : getColorForLevel(level);
mBatteryPaint.setColor(color);
if (level >= FULL) {
drawFrac = 1f;
} else if (level <= EMPTY) {
drawFrac = 0f;
}
c.drawRect(mButtonFrame, drawFrac == 1f ? mBatteryPaint : mFramePaint);
mClipFrame.set(mFrame);
mClipFrame.top += (mFrame.height() * (1f - drawFrac));
c.save(Canvas.CLIP_SAVE_FLAG);
c.clipRect(mClipFrame);
c.drawRect(mFrame, mBatteryPaint);
c.restore();
if (mChargingProtection) {
// draw the bolt
final float bl = mFrame.left + mFrame.width() / 4.5f;
final float bt = mFrame.top + mFrame.height() / 6f;
final float br = mFrame.right - mFrame.width() / 7f;
final float bb = mFrame.bottom - mFrame.height() / 10f;
if (mBoltFrame.left != bl || mBoltFrame.top != bt
|| mBoltFrame.right != br || mBoltFrame.bottom != bb) {
mBoltFrame.set(bl, bt, br, bb);
mBoltPath.reset();
mBoltPath.moveTo(
mBoltFrame.left + mBoltPoints[0] * mBoltFrame.width(),
mBoltFrame.top + mBoltPoints[1] * mBoltFrame.height());
for (int i = 2; i < mBoltPoints.length; i += 2) {
mBoltPath.lineTo(
mBoltFrame.left + mBoltPoints[i] * mBoltFrame.width(),
mBoltFrame.top + mBoltPoints[i + 1] * mBoltFrame.height());
}
mBoltPath.lineTo(
mBoltFrame.left + mBoltPoints[0] * mBoltFrame.width(),
mBoltFrame.top + mBoltPoints[1] * mBoltFrame.height());
}
c.drawPath(mBoltPath, mBoltPaint);
/// M: Support Wireless Charging.
if (BatteryHelper.isWirelessCharging(tracker.plugType)) {
c.drawLine(mFrame.left,
mHeight,
mFrame.right,
mHeight,
mBatteryPaint);
}
} else if (level <= EMPTY) {
final float x = mWidth * 0.5f;
final float y = (mHeight + mWarningTextHeight) * 0.48f;
c.drawText(mWarningString, x, y, mWarningTextPaint);
} else if (mShowPercent && !(tracker.level == 100 && !SHOW_100_PERCENT)) {
mTextPaint.setTextSize(height *
(SINGLE_DIGIT_PERCENT ? 0.75f
: (tracker.level == 100 ? 0.38f : 0.5f)));
mTextHeight = -mTextPaint.getFontMetrics().ascent;
final String str = String.valueOf(SINGLE_DIGIT_PERCENT ? (level/10) : level);
final float x = mWidth * 0.5f;
final float y = (mHeight + mTextHeight) * 0.47f;
c.drawText(str,
x,
y,
mTextPaint);
}
}
private boolean mDemoMode;
private BatteryTracker mDemoTracker = new BatteryTracker();
@Override
public void dispatchDemoCommand(String command, Bundle args) {
if (!mDemoMode && command.equals(COMMAND_ENTER)) {
mDemoMode = true;
mDemoTracker.level = mTracker.level;
mDemoTracker.plugged = mTracker.plugged;
} else if (mDemoMode && command.equals(COMMAND_EXIT)) {
mDemoMode = false;
postInvalidate();
} else if (mDemoMode && command.equals(COMMAND_BATTERY)) {
String level = args.getString("level");
String plugged = args.getString("plugged");
if (level != null) {
mDemoTracker.level = Math.min(Math.max(Integer.parseInt(level), 0), 100);
}
if (plugged != null) {
mDemoTracker.plugged = Boolean.parseBoolean(plugged);
}
postInvalidate();
}
}
}
| [
"[email protected]"
] | |
3e15825ce05d00fc2c8dec77b80747a05985d6ed | 1f70e39863c608c6b588ffc18441969e8d1a246a | /modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskIdentityLinkCollectionResource.java | f2127f02d0cc6fabda30342a0d5d42b21792b51e | [
"Apache-2.0"
] | permissive | ttonl/flowable-engine | 3d77443727c4dffcfbdf0945cf037e9250eb8e58 | 7911b88f56bc1dda8373db3ea420ac716d4b0ef8 | refs/heads/master | 2020-03-11T08:03:37.664757 | 2018-04-17T08:09:54 | 2018-04-17T08:09:54 | 129,873,778 | 0 | 0 | Apache-2.0 | 2018-04-17T08:42:20 | 2018-04-17T08:42:19 | null | UTF-8 | Java | false | false | 4,626 | java | /* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.flowable.cmmn.rest.service.api.runtime.task;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.flowable.cmmn.rest.service.api.engine.RestIdentityLink;
import org.flowable.engine.common.api.FlowableIllegalArgumentException;
import org.flowable.task.api.Task;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.Authorization;
/**
* @author Frederik Heremans
*/
@RestController
@Api(tags = { "Task Identity Links" }, description = "Manage Tasks Identity Links", authorizations = { @Authorization(value = "basicAuth") })
public class TaskIdentityLinkCollectionResource extends TaskBaseResource {
@ApiOperation(value = "List identity links for a task", tags = { "Task Identity Links" }, nickname = "listTasksInstanceIdentityLinks")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Indicates the task was found and the requested identity links are returned."),
@ApiResponse(code = 404, message = "Indicates the requested task was not found.")
})
@GetMapping(value = "/cmmn-runtime/tasks/{taskId}/identitylinks", produces = "application/json")
public List<RestIdentityLink> getIdentityLinks(@ApiParam(name = "taskId") @PathVariable("taskId") String taskId, HttpServletRequest request) {
Task task = getTaskFromRequest(taskId);
return restResponseFactory.createRestIdentityLinks(taskService.getIdentityLinksForTask(task.getId()));
}
@ApiOperation(value = "Create an identity link on a task", tags = { "Task Identity Links" }, nickname = "createTaskInstanceIdentityLinks",
notes = "It's possible to add either a user or a group.")
@ApiResponses(value = {
@ApiResponse(code = 201, message = "Indicates the task was found and the identity link was created."),
@ApiResponse(code = 404, message = "Indicates the requested task was not found or the task doesn’t have the requested identityLink. The status contains additional information about this error.")
})
@PostMapping(value = "/cmmn-runtime/tasks/{taskId}/identitylinks", produces = "application/json")
public RestIdentityLink createIdentityLink(@ApiParam(name = "taskId") @PathVariable("taskId") String taskId, @RequestBody RestIdentityLink identityLink, HttpServletRequest request, HttpServletResponse response) {
Task task = getTaskFromRequest(taskId);
if (identityLink.getGroup() == null && identityLink.getUser() == null) {
throw new FlowableIllegalArgumentException("A group or a user is required to create an identity link.");
}
if (identityLink.getGroup() != null && identityLink.getUser() != null) {
throw new FlowableIllegalArgumentException("Only one of user or group can be used to create an identity link.");
}
if (identityLink.getType() == null) {
throw new FlowableIllegalArgumentException("The identity link type is required.");
}
if (identityLink.getGroup() != null) {
taskService.addGroupIdentityLink(task.getId(), identityLink.getGroup(), identityLink.getType());
} else {
taskService.addUserIdentityLink(task.getId(), identityLink.getUser(), identityLink.getType());
}
response.setStatus(HttpStatus.CREATED.value());
return restResponseFactory.createRestIdentityLink(identityLink.getType(), identityLink.getUser(), identityLink.getGroup(), task.getId(), null, null);
}
}
| [
"[email protected]"
] | |
5c7e5ae41aecd28a94f81faed2cf2129ac5c3d08 | 1ec4fde5042871e327aedde8e0ab8c9ecd6033fc | /java/com/cviceni/cv3/Ban.java | ef77941e88add2e3fe7d332fb25a7a9a7d6639fb | [] | no_license | Del-S/mobile_umte_cvika | 90797d7bc94d0a2e1c503384b832f87b99fc628f | 550b5cff09c348a44348b906fb28a10b806555fe | refs/heads/master | 2021-01-22T13:04:25.932149 | 2016-03-21T16:44:00 | 2016-03-21T16:44:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 728 | java | package com.cviceni.cv3;
public class Ban {
private int id;
private String title;
private String description;
public Ban() {
}
public Ban(int id, String title, String description) {
this.id = id;
this.title = title;
this.description = description;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| [
"[email protected]"
] | |
f6bcc7779e2ed2c4f0109695b3d358d5f34a50e6 | b134b1163aaefb1d600a2c092569eddc37e4d8ef | /src/test/java/org/test/Excel.java | 6857b1acd0114430ca712a75818e3744ac515a2f | [] | no_license | NandaKishore02/saranya | 3951d47fe922a5054aeaca050ebb94bc4f5df47c | f9e214d70fa2a6764306c5533e575d79fa79f284 | refs/heads/master | 2023-03-08T20:50:16.147063 | 2021-02-26T04:54:10 | 2021-02-26T04:54:10 | 342,465,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 980 | java | package org.test;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class Excel {
public static void main(String[] args) throws IOException {
File file=new File("C:\\Users\\Nanda kishare\\eclipse-workspace\\Nanda\\ExcelRead\\Data\\Test.xlsx");
FileInputStream stream=new FileInputStream(file);
Workbook w = new XSSFWorkbook(stream);
Sheet sheet = w.getSheet("Test");
Row row = sheet.getRow(4);
Cell cell = row.getCell(1);
System.out.println(cell);
int pn = sheet.getPhysicalNumberOfRows();
System.out.println(pn);
Sheet sheet2 = w.getSheet("test");
Row row2 = sheet.getRow(2);
int phs = row.getPhysicalNumberOfCells();
System.out.println(phs);
}
}
| [
"[email protected]"
] | |
b1d5b228d8fa27a4ec556693a7eb9843d873dc5a | 4da4927fe55f78fa256294e2580353fbea93800d | /webmodule/src/main/java/com/zhou/redis/RedisConfig.java | 6d50b28486ad1ee0ccaad4709ff704478f8165e5 | [] | no_license | supermaniszhou/studySpringboot | 78b47efa7f6e26741f96a0ee1e89f805c62298de | 6e7d8a00b8890126bf35914ea6820a9e5dbb6c51 | refs/heads/master | 2022-10-22T13:17:41.888063 | 2020-04-26T05:48:14 | 2020-04-26T05:48:14 | 156,347,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,331 | java | package com.zhou.redis;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import java.lang.reflect.Method;
@Configuration
@EnableCaching//开启注解
public class RedisConfig extends CachingConfigurerSupport {
@Bean
public KeyGenerator keyGenerator() {
return new KeyGenerator() {
@Override
public Object generate(Object target, Method method, Object... params) {
StringBuilder sb = new StringBuilder();
sb.append(target.getClass().getName());
sb.append(method.getName());
for (Object obj : params) {
sb.append(obj.toString());
}
return sb.toString();
}
};
}
/**
* 申明缓存管理器,会创建一个切面(aspect)并触发Spring缓存注解的切点(pointcut)
* 根据类或者方法所使用的注解以及缓存的状态,这个切面会从缓存中获取数据,将数据添加到缓存之中或者从缓存中移除某个值
*
* @return
*/
@Bean
public RedisCacheManager cacheManager(RedisTemplate redisTemplate) {
return new RedisCacheManager(redisTemplate);
}
//创建redis连接工厂 这个部分可以在application。properties 文件中配置。
// @Bean
// public RedisConnectionFactory redisFactory() {
// JedisConnectionFactory factory = new JedisConnectionFactory();
// factory.setPort(6379);
// factory.setHostName("127.0.0.1");
// return factory;
// }
@Bean
public RedisTemplate redisTemplate(RedisConnectionFactory factory) {
//创建一个模板类
RedisTemplate<String, Object> template = new RedisTemplate<>();
//将刚才的redis 工厂设置到模板类中
template.setConnectionFactory(factory);
//设置key的序列化器
template.setKeySerializer(new StringRedisSerializer());
//设置value的序列化器 使用jackson 2 ,将对象序列化为json
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
//json转对象类,不设置默认的会将json转成hashmap
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
jackson2JsonRedisSerializer.setObjectMapper(om);
template.setValueSerializer(jackson2JsonRedisSerializer);
return template;
}
}
| [
"[email protected]"
] | |
39bb002db161e893d620527a55fce0596786cf4f | 0f6b68a589ae83ef23f01ff92c49cb9b18a55442 | /shared/src/main/java/com/autodesk/shejijia/shared/components/common/uielements/commentview/photoselect/album/AlbumActivity.java | b6421116ada4822af319151dbe0666dc0c4b9227 | [] | no_license | tinyfight/ld_app | d51981f6e34aeb2e747d9ddcb0907e5bb77a5bf2 | e22f9cd5eed48df0361ceac0da156aabe7b4b3ad | refs/heads/master | 2023-03-17T06:43:10.312241 | 2016-12-19T10:17:04 | 2016-12-19T10:21:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,222 | java | package com.autodesk.shejijia.shared.components.common.uielements.commentview.photoselect.album;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;
import com.autodesk.shejijia.shared.R;
//import com.autodesk.shejijia.shared.components.common.uielements.commentview.photoselect.album.previewimage.ImageDetailFragment;
import com.autodesk.shejijia.shared.components.common.uielements.commentview.model.CommentRepository;
import com.autodesk.shejijia.shared.components.common.uielements.commentview.photoselect.base.PhotoSelectBaseActivity;
import com.autodesk.shejijia.shared.components.common.uielements.commentview.utils.ActivityUtils;
public class AlbumActivity extends PhotoSelectBaseActivity {
public static final String TAG = AlbumActivity.class.getSimpleName();
private AlbumPresenter mAlbumPresenter;
private Button mSubmitBtn;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_album);
initViews();
AlbumFragment albumFragment;
// ImageDetailFragment imageDetailFragment;
// if (savedInstanceState != null) { //内存重启时调用 解决 内存重启时可能发生的Fragment重叠异常
// imageDetailFragment =
// (ImageDetailFragment) getSupportFragmentManager().findFragmentByTag(ImageDetailFragment.TAG);
// albumFragment =
// (AlbumFragment) getSupportFragmentManager().findFragmentByTag(AlbumFragment.TAG);
//
// if (imageDetailFragment != null && albumFragment != null) {
// getSupportFragmentManager().beginTransaction()
// .hide(albumFragment)
// .show(imageDetailFragment)
// .commit();
// }
// }
// else {
//创建AlbumFragment
albumFragment = AlbumFragment.newInstance();
ActivityUtils.addFragmentToActivity(
getSupportFragmentManager(), albumFragment, AlbumFragment.TAG, false);
// }
CommentRepository albumRepository = CommentRepository.getInstance(this);
//创建AlbumPresenter
mAlbumPresenter = new AlbumPresenter(
albumRepository,
getSupportLoaderManager(),
albumFragment);
}
// @Override
// protected int getLayoutResID() {
// return 0;
//// }
protected void initViews() {
mSubmitBtn = (Button) mToolbar.findViewById(R.id.btn_submit);
mSubmitBtn.setEnabled(false);
mSubmitBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mAlbumPresenter.returnResult();
}
});
}
// @Override
// protected int initDatas(Bundle savedInstanceState) {
// return 0;
// }
public void setSubmitBtnText(CharSequence text, boolean enabled) {
mSubmitBtn.setText(text);
mSubmitBtn.setEnabled(enabled);
}
public void setToolbarTitle(CharSequence title) {
mToolbar.setTitle(title);
}
@Override
public void onBackPressed() {
AlbumFragment albumFragment =
(AlbumFragment) getSupportFragmentManager().findFragmentByTag(AlbumFragment.TAG);
if (albumFragment == null) {
super.onBackPressed();
return;
}
if (albumFragment.isHidden()) {
getSupportFragmentManager()
.beginTransaction()
.show(albumFragment)
.commit();
} else if (albumFragment.mFab.getVisibility() != View.VISIBLE) {
albumFragment.hideFolderList();
return;
}
super.onBackPressed();
}
@Override
protected void onDestroy() {
super.onDestroy();
mAlbumPresenter.clearCache();
}
@Override
public void onConfigurationChanged(Configuration config) {
super.onConfigurationChanged(config);
}
}
| [
"[email protected]"
] | |
c9a209426100c8e3e3950eb88d984dd6b7cdf6c4 | cc3897eb0373eb7834beac0ad54a4cdf6563ec42 | /UPAnalysis/src/upAnalysis/summary/ops/FieldRead.java | 0c216de291c7c9cd0fd2b78daebd3620b7c4f75f | [
"MIT"
] | permissive | devuxd/Reacher | f70c4ed97e4da6317568511117359e8b3e046e18 | 0a4d658816913170c32456b3ed49980958ae98d6 | refs/heads/master | 2020-07-15T03:06:29.986861 | 2019-08-30T22:43:24 | 2019-08-30T22:43:24 | 205,465,337 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,657 | java | package upAnalysis.summary.ops;
import java.util.HashMap;
import java.util.HashSet;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.dom.ASTNode;
import upAnalysis.summary.ASTOrderAnalysis;
import upAnalysis.summary.Path;
import upAnalysis.summary.summaryBuilder.rs.FieldReadStmt;
import upAnalysis.summary.summaryBuilder.rs.ResolvedSource;
import upAnalysis.utils.SourceLocation;
import edu.cmu.cs.crystal.tac.model.Variable;
public class FieldRead extends NodeSource
{
private IField fieldName;
private Variable receiver;
private FieldRead(Variable target, IField fieldName, Variable receiver, ASTNode node, HashSet<Predicate> constraints)
{
super(node, target, constraints);
if (fieldName == null || receiver == null)
throw new NullPointerException();
this.fieldName = fieldName;
this.receiver = receiver;
}
public FieldRead(Variable target, IField fieldName, Variable receiver, ASTNode node)
{
this(target, fieldName, receiver, node, new HashSet<Predicate>());
}
public String toString()
{
return super.toString() + fieldName.getDeclaringType().getFullyQualifiedName() + "." + fieldName.getElementName();
}
public IField getFieldName() {
return fieldName;
}
public Variable getReceiver() {
return receiver;
}
public Source copy()
{
return new FieldRead(var, fieldName, receiver, node);
}
public ResolvedSource resolve(Path path, int index, boolean inLoop,
HashMap<Source, ResolvedSource> varBindings)
{
return new FieldReadStmt(fieldName, null, inLoop, new SourceLocation(node), index);
}
}
| [
"[email protected]"
] | |
71b21238a553bd218c73024beb8ccbd35b668ca4 | d4f50156e73fd9801316577ed9fac226a231cbce | /src/com/ztspeech/simutalk2/net/AsyncHttpDownloader.java | b77f7c33a69847dd33ca59b6da09c41fb6540f77 | [] | no_license | JayceHuang/Simutalk2 | 308d8dc71a4a7750cb089490f7035954eb0afe4a | ede66a5c36c9d26ebc5493583042f064b096b52e | refs/heads/master | 2021-05-30T11:31:21.557702 | 2013-09-17T01:54:52 | 2013-09-17T01:54:52 | 12,861,166 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,979 | java | package com.ztspeech.simutalk2.net;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import android.os.AsyncTask;
import cn.ac.ia.files.RequestParam;
import com.ztspeech.simutalk2.dictionary.util.LogInfo;
public class AsyncHttpDownloader extends AsyncTask<String, String, byte[]> {
public interface OnAsyncHttpDownloaderLisenter {
public void onData(byte[] data);
public void onBegin();
public void onEnd();
}
private VoiceDataCache voiceDataCache = VoiceDataCache.getInstance();
private OnAsyncHttpDownloaderLisenter mLisenter = null;
private String downloadId = "";
private String host = "";
private String userId = "";
private String app = "";
private String type = "";
// 根据url下载文件,前提是这个文件是文本文件,函数的返回值是文件中的内容
public AsyncHttpDownloader(OnAsyncHttpDownloaderLisenter lisenter) {
mLisenter = lisenter;
}
public void setParam(String sHost, String app, String userId) {
// host = "http://" + sHost + "/filesservlet";
host = "http://" + sHost + "/FilesServer/filesservlet";
this.userId = userId;
this.app = app;
}
public void download(String id, String type) {
byte[] data = voiceDataCache.findVoice(id, type);
if (data != null) {
mLisenter.onData(data);
return;
}
downloadId = id;
this.type = type;
String url = host + "?" + RequestParam.APP + "=" + this.app + "&" + RequestParam.FILE_ID + "=" + id + "&"
+ RequestParam.TYPE + "=" + type + "&" + RequestParam.USER_ID + "=" + this.userId;
mLisenter.onBegin();
this.execute(url);
}
@Override
protected void onCancelled() {
// TODO Auto-generated method stub
super.onCancelled();
mLisenter.onEnd();
}
@Override
protected void onPostExecute(byte[] result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
mLisenter.onData(result);
mLisenter.onEnd();
}
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
}
@Override
protected void onProgressUpdate(String... values) {
// TODO Auto-generated method stub
super.onProgressUpdate(values);
}
private byte[] download(String urlStr) {
ByteArrayOutputStream out = new ByteArrayOutputStream(10240);
int BUFFER_SIZE = 1024;
byte[] ret = null;
byte[] buf = new byte[BUFFER_SIZE];
HttpURLConnection urlConn = null;
InputStream is = null;
try {
// 使用IO流读取数据
// 创建url
LogInfo.LogOut(">>>>>>>>>>>>>>>...urlStr=" + urlStr);
URL url = new URL(urlStr);
// 创建http
urlConn = (HttpURLConnection) url.openConnection();
urlConn.setConnectTimeout(NetDefine.HTTP_CONNECT_TIMEOUT);
urlConn.setReadTimeout(NetDefine.HTTP_READ_TIMEOUT);
// 读取数据
is = urlConn.getInputStream();
int nRead = 0;
while (true) {
nRead = is.read(buf, 0, BUFFER_SIZE);
if (nRead == -1) {
break;
}
if (nRead > 0) {
out.write(buf, 0, nRead);
}
}
ret = out.toByteArray();
} catch (IOException e) {
e.printStackTrace();
}
if (urlConn != null) {
urlConn.disconnect();
urlConn = null;
}
return ret;
}
@SuppressWarnings("unused")
private InputStream getInputStream(String urlStr) throws IOException {
// 创建url
URL url = new URL(urlStr);
// 创建http
HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
urlConn.setConnectTimeout(NetDefine.HTTP_CONNECT_TIMEOUT);
urlConn.setReadTimeout(NetDefine.HTTP_READ_TIMEOUT);
// 读取数据
InputStream inputStream = urlConn.getInputStream();
return inputStream;
}
@Override
protected byte[] doInBackground(String... params) {
// TODO Auto-generated method stub
String url = (String) params[0];
byte[] result = download(url);
if (result != null) {
if (result.length > 0) {
voiceDataCache.add(downloadId, result, type);
}
}
return result;
}
}
| [
"[email protected]"
] | |
54075ca2ed385db85a8ecf5fde17a9290492d4c7 | 91e67632d2a4d3e02b8ebe954c47fe5ae2bdfb33 | /app/src/main/java/com/omneagate/activity/dialog/MenuAdapter.java | 73b100360b6c07e1de873d993159d4c37856de85 | [] | no_license | RamprasathPnr/FpsPosUttarPradesh | a2b14022d59f41b5af0d7d8e6a564ee3abd1fbb3 | 99fb57ecb4b0df59b29119f398a83eaf434d2681 | refs/heads/master | 2021-08-31T13:32:10.236720 | 2017-12-21T13:47:01 | 2017-12-21T13:47:01 | 115,010,323 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,079 | java | package com.omneagate.activity.dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.omneagate.DTO.MenuDataDto;
import com.omneagate.activity.GlobalAppState;
import com.omneagate.activity.R;
import java.util.List;
public class MenuAdapter extends BaseAdapter {
Context ct;
List<MenuDataDto> menuList;
private LayoutInflater mInflater;
public MenuAdapter(Context context, List<MenuDataDto> orders) {
ct = context;
menuList = orders;
mInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public int getCount() {
return menuList.size();
}
public MenuDataDto getItem(int position) {
return menuList.get(position);
}
public long getItemId(int position) {
return position;
}
public View getView(final int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
View view = convertView;
if (view == null) {
view = mInflater.inflate(R.layout.menu_background, null);
holder = new ViewHolder();
holder.number = (TextView) view.findViewById(R.id.textViewMenu);
holder.imageView = (ImageView) view.findViewById(R.id.imageViewMenu);
view.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.number.setText(menuList.get(position).getName());
if (GlobalAppState.language != null && GlobalAppState.language.equalsIgnoreCase("te")) {
holder.number.setText(menuList.get(position).getLName());
}
// holder.imageView.setImageResource(menuList.get(position).getId());
return view;
}
class ViewHolder {
TextView number;
ImageView imageView;
}
} | [
"[email protected]"
] | |
c1950078626751f058c1aea1c9ee7864db8f471a | 05e2ac04037d6203b309bde9ee2190bc8be1af3b | /src/main/java/org/una/tienda/facturacion/services/IProductoPrecioService.java | e7090bd246d3bf18472d88bacb762d84bc291f4a | [] | no_license | GabieSB/Facturas | 8089f134ba1beb8ea19e377f5abb9d3c1e512cab | 7fc97203ad77608b22c722b8251280cfcaa0cd80 | refs/heads/master | 2022-12-20T09:43:19.233057 | 2020-10-19T00:48:46 | 2020-10-19T00:48:46 | 305,009,395 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 633 | java | package org.una.tienda.facturacion.services;
import java.util.Optional;
import org.una.tienda.facturacion.dto.ProductoPrecioDTO;
import org.una.tienda.facturacion.exceptions.EModificarContenidoInactivoExeption;
public interface IProductoPrecioService {
public ProductoPrecioDTO create(ProductoPrecioDTO productoDTO);
public Optional<ProductoPrecioDTO> findByProductoId(Long id);
public void delete(Long id);
public Optional<ProductoPrecioDTO> findById(Long id);
public Optional<ProductoPrecioDTO> update(ProductoPrecioDTO precioDTO, Long id) throws EModificarContenidoInactivoExeption;
}
| [
"[email protected]"
] | |
7f1f741b3b0493ae39b1725fac8d105679d00f84 | bdb39260a37cef70de7929c070b1679a4e64ee7f | /lib/src/main/java/com/example/RxJavaDemo.java | ef318b2fa76739dfdf006c1c7c04cb13354c0dbf | [
"Apache-2.0"
] | permissive | orient33/demoKotlin | 21e509c1cd2b0eda676801a58ed94a9e3976918f | ac8870f5ab83eebc271aa86d4352f2f155336f7e | refs/heads/master | 2023-06-22T11:55:21.715767 | 2023-06-20T01:27:39 | 2023-06-20T01:27:39 | 163,295,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,315 | java | package com.example;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
class RxJavaDemo {
static void test() {
Disposable d = Observable.create(emitter -> {
int i = 1 + 2;
log("12. subscribe: " + emitter);
})
.subscribe((result) -> {
log("on result : " + result);
}, e -> {
log("on error : " + e);
});
d = Flowable.create(e -> log("19.emitter.!!"), BackpressureStrategy.LATEST).subscribe(r -> {
log("Flowable complete ");
});
Observable<String> o = Observable.create(e -> {
log("observable. not .. is subscribe?");
e.onNext("1");
e.onComplete();
// e.onError(new RuntimeException("----------"));
});
String v = o.blockingFirst();
log("block first : " + v);
Flowable.create(e -> {
e.onNext("a");
e.onNext("b");
e.onComplete();
}, BackpressureStrategy.LATEST)
.subscribe(r -> {
log(" consumer " + r);
})
.isDisposed();
Single<String> s = Single.<String>create(emitter -> {
try {
synchronized (emitter) {
emitter.wait(7100);
}
} catch (InterruptedException e) {
log("interrupted!");
}
emitter.onSuccess("tt");
// emitter.onError(new RuntimeException("22"));
}).timeout(6, TimeUnit.SECONDS, Schedulers.computation());
try {
log("Single block get: " + s.blockingGet());
} catch (RuntimeException e) {
log("Single block . time out. " + e);
}
}
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
private static void log(String s) {
System.out.println(sdf.format(new Date()) + ". RxJavaDemo: " + s);
}
}
| [
"[email protected]"
] | |
d14c37d70a34554567c0f21e8459e0a956c53344 | 9570a5944cc50742b694a67b4e6af6ba1fe9068f | /src/test/java/cookiesbasedauth/CreateIssueInJira.java | a0259f1fc2358023caf3670acd347391e0d9a629 | [] | no_license | veenamathew1234/APITestingRestAssured | faefd9a33e690bfe6701dcd14eeedaa080c85c51 | 085914309a0e95a06216dbf79969df0b2868928a | refs/heads/master | 2021-07-11T23:42:22.429847 | 2019-10-22T11:12:50 | 2019-10-22T11:12:50 | 213,962,648 | 0 | 0 | null | 2020-10-13T16:36:16 | 2019-10-09T16:01:54 | HTML | UTF-8 | Java | false | false | 1,802 | java | package cookiesbasedauth;
import javax.swing.text.AbstractDocument.Content;
import org.json.simple.JSONObject;
import org.testng.annotations.Test;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
public class CreateIssueInJira {
String jsessionID;
@Test
public void createJSessionID() {
JSONObject json=new JSONObject();
json.put("username", "veenamathew1234");
json.put("password", "Welcome123ra");
// Response rs= RestAssured.given()
// .header("Content-Type", "application/json")
// .body(json.toJSONString())
// .post("http://localhost:8080/rest/auth/1/session");
RequestSpecification request=RestAssured.given();
request.header("Content-Type","application/json");
request.body(json.toJSONString());
Response rs=request.post("http://localhost:8080/rest/auth/1/session");
System.out.println(rs.getBody().jsonPath().prettify());
jsessionID=rs.getCookies().get("JSESSIONID");
System.out.println("cookies="+rs.getCookies().get("JSESSIONID"));
}
@Test
public void createJiraTask()
{
Response response=RestAssured.given()
.contentType(ContentType.JSON)
.cookie(jsessionID)
.body("{\\n \\\"fields\\\": {\\n \\\"project\\\":\\n {\\n \\\"key\\\": \\\"TEST\\\"\\n },\\n \\\"summary\\\": \\\"REST ye merry gentlemen.\\\",\\n \\\"description\\\": \\\"Creating of an issue using project keys and issue type names using the REST API\\\",\\n \\\"issuetype\\\": {\\n \\\"name\\\": \\\"Bug\\\"\\n }\\n }\\n}")
.post("http://localhost:8080/rest/api/2/project");
System.out.println(response.getBody().jsonPath().prettify());
}
}
| [
"[email protected]"
] | |
5ee94af40aa336d35c6e1ebc0ba60d2cbaa44fd2 | 5c9489d3c60141df5e3983cd511f69320ae86c6f | /EVA2_9_Restaurante/app/src/main/java/com/example/usuario/eva2_9_Restaurante/DetalleAsignatura.java | 33f8866c95c0d73a2b84ca6ac9c00d8ad0449c30 | [] | no_license | AdrianBalderrama/U2_MOVILES_1 | a5056f5cbe089e411cc6b59f9f3ece63e387e713 | 36407ddeb4397fd7c672124912836aa8265bd945 | refs/heads/master | 2020-04-05T20:05:44.267107 | 2018-11-12T06:01:58 | 2018-11-12T06:01:58 | 157,163,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,323 | java | package com.example.usuario.eva2_9_Restaurante;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
public class DetalleAsignatura extends AppCompatActivity {
ImageView imgVwRest;
TextView txtVwPlace, txtVwDescr, txtVwDireccion, txtVwTelf;
String btelf;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detalle_clima);
imgVwRest = findViewById(R.id.imgVwRest);
txtVwPlace =findViewById(R.id.txtVwPlace);
txtVwDescr = findViewById(R.id.txtVwDescr);
txtVwDireccion = findViewById(R.id.txtVwDireccion);
txtVwTelf = findViewById(R.id.txtVwTelf);
Intent inDatos = getIntent();
Bundle bnDatos = inDatos.getExtras();
txtVwPlace.append(" " + bnDatos.getString("bLugar") + "\n");
txtVwDescr.append(" " + bnDatos.getString("bDescripcion") + "\n");
int bimg = bnDatos.getInt("bImagen");
txtVwDireccion.append("" + bnDatos.getString("bDireccion"));
btelf = bnDatos.getString("bTelefono");
txtVwTelf.setText("Tel: " + btelf);
imgVwRest.setBackgroundResource(bimg);
}
} | [
"[email protected]"
] | |
e5d5a8d00102358f681047bbf7913c402f297fb1 | f44ea6f635bf4a6c3e4a2de4920f34938d09c3cc | /mall-mbg/src/main/java/com/coding/cloud/mall/model/CmsSubjectComment.java | 05562be39b7c7ad699297acf92e6a7e529337837 | [] | no_license | lwz525/mall-swarm | 1a0ac087b83a7e4d4b23332717be2aac2187570e | 77f9a35704e3ec8060634c324c9299d0ff260492 | refs/heads/master | 2023-06-02T10:21:42.053453 | 2021-06-27T13:20:55 | 2021-06-27T13:20:55 | 379,658,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,276 | java | package com.coding.cloud.mall.model;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
public class CmsSubjectComment implements Serializable {
private Long id;
private Long subjectId;
private String memberNickName;
private String memberIcon;
private String content;
private Date createTime;
private Integer showStatus;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getSubjectId() {
return subjectId;
}
public void setSubjectId(Long subjectId) {
this.subjectId = subjectId;
}
public String getMemberNickName() {
return memberNickName;
}
public void setMemberNickName(String memberNickName) {
this.memberNickName = memberNickName;
}
public String getMemberIcon() {
return memberIcon;
}
public void setMemberIcon(String memberIcon) {
this.memberIcon = memberIcon;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getShowStatus() {
return showStatus;
}
public void setShowStatus(Integer showStatus) {
this.showStatus = showStatus;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", subjectId=").append(subjectId);
sb.append(", memberNickName=").append(memberNickName);
sb.append(", memberIcon=").append(memberIcon);
sb.append(", content=").append(content);
sb.append(", createTime=").append(createTime);
sb.append(", showStatus=").append(showStatus);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | [
"[email protected]"
] | |
e389622c5e208daea7eeb20bb59b0e4f64475015 | 3c4fb0c87f45655d8ec914838033bde17c0a1b90 | /app/src/main/java/com/simonk/project/prettyrss/error/NothingFoundErrorInterceptor.java | d50f605cac600e3ed00d5297618bcd7f5e20485c | [] | no_license | SimonKab/Pretty-RSS | c6a2d6edf14ef5d8c4b2103254942983c26c210e | c4c9310931705c735fbdf99ed7985937be427a7d | refs/heads/master | 2020-04-22T15:02:06.561039 | 2019-02-13T07:37:35 | 2019-02-13T07:37:35 | 170,464,426 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 715 | java | package com.simonk.project.prettyrss.error;
import com.simonk.project.prettyrss.R;
public class NothingFoundErrorInterceptor implements ErrorLayout.ErrorLayoutInterceptor {
@Override
public boolean checkIsItHandlingError(Exception exception) {
return false;
}
@Override
public ErrorLayout.InterceptorData handleError(Exception exception) {
return null;
}
@Override
public boolean checkIsItHandlingError(ErrorType errorType) {
return errorType == ErrorType.NOTHING_FOUND;
}
@Override
public ErrorLayout.InterceptorData handleError(ErrorType errorType) {
return new ErrorLayout.InterceptorData(R.string.nothing_found, false);
}
}
| [
"[email protected]"
] | |
4366b10315d56baf25ba0f10957229b17eb9f3cd | 9bee6dc1d50753a171c24aeceaf6ba43b73f5138 | /Practica3_PC/src/parte2/Producto.java | bf6c1e3a4f13d44b556aa0c1fa534b02798325cb | [
"MIT"
] | permissive | vuvuxka/Programacion-Concurrente | 61cbf7a1d72b15163b1066609b2d1282f4b45b23 | d4aca7599f27edbdbd681b18f62b996031762dfe | refs/heads/master | 2021-04-28T13:07:30.739809 | 2018-02-19T17:17:36 | 2018-02-19T17:17:36 | 122,095,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 211 | java | package parte2;
public class Producto {
private String ref;
public Producto(String r){
ref = r;
}
public String getRef() {
return ref;
}
public void setRef(String ref) {
this.ref = ref;
}
}
| [
"[email protected]"
] | |
e5697aad2e7dc46a27bbf218334e172e7403f88d | 3223c50c30a7423284d298e1b9054db5ceb1f952 | /modules/test-tasks/src/apb/tests/tasks/JavacTest.java | 6fcb9a0d03f29a6b2459214ac55c14e94caac621 | [
"Apache-2.0"
] | permissive | nagaramesh/apb | c79b7ebce34d4617d0cc5afde9f26fcf26f37ade | c43185c9471f488651198d9fc1ae241aff0374a7 | refs/heads/master | 2021-01-23T20:14:24.074888 | 2012-09-19T19:43:31 | 2012-09-20T13:55:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,161 | java |
// Copyright 2008-2009 Emilio Lopez-Gabeiras
//
// 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 apb.tests.tasks;
import java.io.File;
import java.io.IOException;
import apb.BuildException;
import apb.tests.testutils.FileAssert;
import static apb.tasks.CoreTasks.javac;
//
public class JavacTest
extends TaskTestCase
{
//~ Methods ..............................................................................................
public void testFail()
throws IOException
{
boolean exceptionThrown;
try {
compile("unchecked");
exceptionThrown = false;
}
catch (BuildException e) {
exceptionThrown = true;
}
assertTrue(exceptionThrown);
FileAssert.assertDoesNotExist(new File(basedir, "Hello.class"));
}
public void testOk()
throws IOException
{
compile("-unchecked");
FileAssert.assertExists(new File(basedir, "Hello.class"));
}
private void compile(final String lintOptions)
{
javac(dataPath("src/hello")).to("$basedir") //
.lint(true) //
.lintOptions(lintOptions) //
.debug(true) //
.sourceVersion("1.6") //
.targetVersion("1.6") //
.deprecated(true) //
.trackUnusedDependencies(true) //
.failOnWarning(true) //
.execute();
}
}
| [
"[email protected]"
] | |
e3445218c60d83fb3804a4e6d3e67fdc8a0868e9 | f6a0bc4b256629422d8892930289d4fbc6b23821 | /src/main/java/org/gescobar/management/cdi/AbstractMBeanFactory.java | 2398343235afb9807a7edcc175080f37505df720 | [] | no_license | exsolvi/jmx-annotations | 71c04eaaf5ac63fcc5a3cf4bbb5d911d737ef037 | 7227b6d0042e9bce142656fd4f399b656c3a8b92 | refs/heads/master | 2020-04-17T12:01:36.630695 | 2010-10-13T20:41:13 | 2010-10-13T20:41:13 | 1,996,095 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,075 | java | package org.gescobar.management.cdi;
import java.util.Set;
import javax.enterprise.inject.spi.AnnotatedConstructor;
import javax.enterprise.inject.spi.AnnotatedField;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedType;
import org.gescobar.management.MBean;
import org.gescobar.management.MBeanFactory;
import org.gescobar.management.ManagementException;
import org.gescobar.management.util.MBeanImpl;
/**
* @author German Escobar
*
* An abstract class used a as a base class for {@link org.gescobar.management.MBeanFactory}
* implementations that create MBeans from AnnotatedTypes.
*/
public abstract class AbstractMBeanFactory implements MBeanFactory {
/**
* This method has to be implemented by concrete classes to retrieve the annotated
* type from which the MBean is going to be created.
* @param instance the object that is going to be exposed.
* @return an AnnotatedType representing the object received by parameter.
* @throws Exception
*/
protected abstract AnnotatedType<? extends Object> getAnnotatedType(Object instance) throws Exception;
/* (non-Javadoc)
* @see org.gescobar.management.MBeanFactory#createMBean(java.lang.Object)
*/
@Override
public <T> MBeanImpl<T> createMBean(T instance) throws ManagementException {
try {
AnnotatedType<? extends Object> at = getAnnotatedType(instance);
// select the type of visitor
AnnotatedTypeVisitor visitor = null;
if (at.isAnnotationPresent(MBean.class)) {
visitor = new DynamicMBeanInfoBuilder();
} else {
visitor = new StandardMBeanInfoBuilder();
}
processAnnotatedType(at, visitor);
// create the MBean
MBeanImpl<T> mBean = new MBeanImpl<T>(instance, visitor.getFields(), visitor.getMethods(),
visitor.getMBeanInfo());
return mBean;
} catch (Exception e) {
throw new ManagementException(e);
}
}
/**
* This method is used to create the {@link ExposedMembers} and the {@link javax.management.MBeanInfo}
* objects using the AnnotatedType to retrieve everything that should be exposed
* as JMX.
* @param <T>
* @param at
* @param visitor
*/
private <T> void processAnnotatedType(AnnotatedType<T> at, AnnotatedTypeVisitor visitor) {
// visit annotated type
visitor.visitAnnotatedType(at);
// visit constructors
Set<AnnotatedConstructor<T>> annConstructors = at.getConstructors();
for (AnnotatedConstructor<T> ac : annConstructors) {
visitor.visitAnnotatedConstructor(ac);
}
// visit fields
Set<AnnotatedField<? super T>> annFields = at.getFields();
for (AnnotatedField<? super T> af : annFields) {
visitor.visitAnnotatedField(af);
}
// visit methods
Set<AnnotatedMethod<? super T>> annMethods = at.getMethods();
for (AnnotatedMethod<? super T> am : annMethods) {
visitor.visitAnnotatedMethod(am);
}
}
}
| [
"[email protected]"
] | |
43e4c59aff9a82597a2f566b305bf316af223208 | e7a5fef43a0636786e422e736fd7abd5be705225 | /Recursion/Fibonacci.java | fbc2a5728272b326836aebd6cc17630cc7228b31 | [] | no_license | aakash55555/Programming | 88e66a688f41b63d20aba76e8ac722df467d8399 | db18f24515c239fe5e42e9e07954b2e735444cb3 | refs/heads/master | 2022-11-19T06:57:03.624814 | 2020-07-23T09:31:08 | 2020-07-23T09:31:08 | 271,451,350 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,028 | java | /*
*
The fibonacci sequence is a famous bit of mathematics, and it happens to have a recursive definition.
The first two values in the sequence are 0 and 1 (essentially 2 base cases). Each subsequent value is the
sum of the previous two values, so the whole sequence is: 0, 1, 1, 2, 3, 5, 8, 13, 21 and so on.
Define a recursive fibonacci(n) method that returns the nth fibonacci number, with n=0 representing the start
of the sequence.
fibonacci(0) → 0
fibonacci(1) → 1
fibonacci(2) → 1
*/
package Recursion;
import java.util.Scanner;
public class Fibonacci {
public int fibonacci(int n) {
if(n == 0){
return 0;
}
else if(n == 1){
return 1;
}
return fibonacci(n-2) + fibonacci(n-1);
}
public static void main(String[] args) {
Fibonacci count = new Fibonacci();
Scanner scan = new Scanner(System.in);
System.out.print("Enter the number = ");
int num = scan.nextInt();
int fibo = count.fibonacci(num);
System.out.print("Fibonacci number= "+ fibo);
}
}
| [
"[email protected]"
] | |
6744e71094aaf305136c7a990d6600c45e073f17 | 013e83b707fe5cd48f58af61e392e3820d370c36 | /spring-messaging/src/main/java/org/springframework/messaging/MessagingException.java | c174010eb74f857af5991cdc6e94a57776716ec9 | [] | no_license | yuexiaoguang/spring4 | 8376f551fefd33206adc3e04bc58d6d32a825c37 | 95ea25bbf46ee7bad48307e41dcd027f1a0c67ae | refs/heads/master | 2020-05-27T20:27:54.768860 | 2019-09-02T03:39:57 | 2019-09-02T03:39:57 | 188,770,867 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,256 | java | package org.springframework.messaging;
import org.springframework.core.NestedRuntimeException;
/**
* 与消息相关的任何失败的基本异常.
*/
@SuppressWarnings("serial")
public class MessagingException extends NestedRuntimeException {
private final Message<?> failedMessage;
public MessagingException(Message<?> message) {
super(null);
this.failedMessage = message;
}
public MessagingException(String description) {
super(description);
this.failedMessage = null;
}
public MessagingException(String description, Throwable cause) {
super(description, cause);
this.failedMessage = null;
}
public MessagingException(Message<?> message, String description) {
super(description);
this.failedMessage = message;
}
public MessagingException(Message<?> message, Throwable cause) {
super(null, cause);
this.failedMessage = message;
}
public MessagingException(Message<?> message, String description, Throwable cause) {
super(description, cause);
this.failedMessage = message;
}
public Message<?> getFailedMessage() {
return this.failedMessage;
}
@Override
public String toString() {
return super.toString() + (this.failedMessage == null ? ""
: (", failedMessage=" + this.failedMessage));
}
}
| [
"[email protected]"
] | |
b3358030688097becf3ea441f7d3ccfe58223df3 | 539001576aa692898d6ce9524d667d06e1d9578f | /app/src/main/java/com/example/courierapp/model/LoginRequest.java | 209f908d9c988d2c7fe892af1129c3c6b24aba28 | [] | no_license | mkrishna1/CourierApp | f0ee0f932ef2d861084a72a7e152f5d522054da5 | 2fb735023fdd39c61a472a15e955edcda6e8ce60 | refs/heads/master | 2022-11-28T07:50:34.078333 | 2020-08-08T13:10:43 | 2020-08-08T13:10:43 | 282,920,785 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 520 | java | package com.example.courierapp.model;
import com.google.gson.annotations.SerializedName;
public class LoginRequest {
@SerializedName("mobile_no")
String mobileNumber;
@SerializedName("password")
String password;
public LoginRequest(String mobileNumber, String password) {
this.mobileNumber = mobileNumber;
this.password = password;
}
public String getMobileNumber() {
return mobileNumber;
}
public String getPassword() {
return password;
}
}
| [
"mathi3567"
] | mathi3567 |
f3e99fd7219727ca83e6001bcb253503c6b3fdab | 7113dd6f71592192efeeb569a66dc139450a6019 | /buster-core/src/test/java/com/db1group/buster/common/QueryHandlerNotFoundExceptionTest.java | 922f50d750e83636db828d2caefd0031a1bb936c | [] | no_license | db1group/buster | 76013f542d10800f6b480bfd708fd67280b7d15b | 780b27477c8ddc4fc92c9c6d88ebfd523ac87a46 | refs/heads/master | 2022-12-26T19:35:53.330641 | 2020-09-28T11:27:29 | 2020-09-28T11:27:29 | 293,379,418 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 564 | java | package com.db1group.buster.common;
import com.db1group.buster.query.Query;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class QueryHandlerNotFoundExceptionTest {
@Test
void constructor() {
QueryHandlerNotFoundException exception = new QueryHandlerNotFoundException(new FakeQuery());
assertEquals("Handler to Query com.db1group.buster.common.QueryHandlerNotFoundExceptionTest$FakeQuery not found", exception.getMessage());
}
class FakeQuery implements Query<String> {
}
} | [
"[email protected]"
] | |
fa6d474de4c0b85d00993605eea297e44c403e25 | 4535b693a966e8e5a719edf2f6a133544759fe18 | /WunderlistSmartWatchExtension/gen/com/wunderkinder/wunderlistextension/Manifest.java | e74418c8d440e7db996b90a064bf090a2841c420 | [] | no_license | The1andONLYdave/SonySmartWatch2Hackathon | d6c674b77469bd5842416418c1838a269b0ffcc4 | cd9646fb50b95fb37b74daebdcb1c66ee56733af | refs/heads/master | 2020-12-26T05:01:38.101792 | 2013-09-09T08:52:56 | 2013-09-09T08:52:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 206 | java | /*___Generated_by_IDEA___*/
package com.wunderkinder.wunderlistextension;
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
} | [
"[email protected]"
] | |
6c6b4f2a0d323302478c9fd367f85ac64e0a2948 | 02023da19a10a9ea42e5bbe0e29a83dc884fa971 | /FindingJobs/src/leetCode/LetterCombinationsofaPhoneNumber.java | d978b4c353718cc75d2aa9bbef10c29186d79f9f | [] | no_license | liuwei1991/FindingJobs | b5127f4f9c354ff9c86f45a79da5073abfa0b257 | 42eb2bbd83dab43d2499e6c9080e3c4878395fae | refs/heads/master | 2021-01-01T06:05:44.260239 | 2017-05-25T13:06:15 | 2017-05-25T13:06:15 | 22,870,456 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,477 | java | package leetCode;
import java.util.ArrayList;
import java.util.List;
public class LetterCombinationsofaPhoneNumber {
private char[][] phone = { {}, {}, { 'a', 'b', 'c' }, { 'd', 'e', 'f' },
{ 'g', 'h', 'i' }, { 'j', 'k', 'l' }, { 'm', 'n', 'o' },
{ 'p', 'q', 'r', 's' }, { 't', 'u', 'v' }, { 'w', 'x', 'y', 'z' } };
public List<String> letterCombinations(String digits) {
List<String> result = new ArrayList<String>();
this.solve(result, "", 0, digits);
return result;
}
public void solve(List<String> result, String tmp, int start, String digits) {
if (start == digits.length()) {
result.add(tmp);
return;
}
int button = digits.charAt(start) - '0';
if (button >= 2 && button <= 6 || button == 8) {
this.solve(result, tmp + phone[button][0], start + 1, digits);
this.solve(result, tmp + phone[button][1], start + 1, digits);
this.solve(result, tmp + phone[button][2], start + 1, digits);
} else if (button == 7 || button == 9) {
this.solve(result, tmp + phone[button][0], start + 1, digits);
this.solve(result, tmp + phone[button][1], start + 1, digits);
this.solve(result, tmp + phone[button][2], start + 1, digits);
this.solve(result, tmp + phone[button][3], start + 1, digits);
} else {
this.solve(result, tmp, start + 1, digits);
}
}
public static void main(String[] args){
LetterCombinationsofaPhoneNumber lc = new LetterCombinationsofaPhoneNumber();
String s ="2342";
lc.letterCombinations(s);
}
}
| [
"[email protected]"
] | |
b2a49966a98acdd7bcad230947b14267a985e944 | ff8b1fc42f93e9d3b9aa4a9c1b8b8071a8ad5382 | /spring-boot-db-auth/src/main/java/com/sample/model/AuthUser.java | e8eb4bf8f30f9c1953fbf475fac11127a8e305e4 | [] | no_license | somnpal12/spring-cloud | 091d962fa04214e1bea9638fd5cdc79c37d786ac | 2bfc66077d11b291e172d7a341c4d255ef173720 | refs/heads/master | 2022-04-21T21:11:59.144955 | 2020-04-19T13:18:34 | 2020-04-19T13:18:34 | 255,101,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,143 | java | package com.sample.model;
import com.sample.entity.User;
import lombok.Builder;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.Collection;
import java.util.List;
@Builder
@Data
public class AuthUser implements UserDetails {
private User user;
List<SimpleGrantedAuthority> simpleGrantedAuthorities;
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return simpleGrantedAuthorities;
}
@Override
public String getPassword() {
return user.getPassword();
}
@Override
public String getUsername() {
return user.getName();
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
}
| [
"[email protected]"
] | |
eeb8089874f4d5179ffab720c4ff422ea561fdc4 | 32e7f8c61db50bee9b07ac0afad7a78b4bfd6f3f | /tomcat-datasource/src/main/java/br/edu/ifpb/tomcat/datasource/entidades/JPAEntity.java | 3835b9c2920ff261c38584add6f34c68bac6a899 | [] | no_license | claudivanmoreira/tomat-datasource | d562fa7c2926341a99e848d581733fb534b06da8 | 1bba5661ae8b25334584747b0a62d5b20b561af8 | refs/heads/master | 2021-01-10T21:33:32.843853 | 2014-10-17T18:21:58 | 2014-10-17T18:21:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 819 | 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 br.edu.ifpb.tomcat.datasource.entidades;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
/**
*
* @author Desenvolvedor01
*/
@MappedSuperclass
public abstract class JPAEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
| [
"[email protected]"
] | |
62f20562e3658d06a8cd8d475f5d1c0427a13568 | 71dc08ecd65afd5096645619eee08c09fc80f50d | /src/main/java/org/jetbrains/anko/c.java | ce42d5d15492e6786ec2f7cf9b7db10a7c36f7b0 | [] | no_license | lanshifu/FFmpegDemo | d5a4a738feadcb15d8728ee92f9eb00f00c77413 | fdbafde0bb8150503ae68c42ae98361c030bf046 | refs/heads/master | 2020-06-25T12:24:12.590952 | 2019-09-08T07:35:16 | 2019-09-08T07:35:16 | 199,304,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package org.jetbrains.anko;
import defpackage.xv;
import java.util.concurrent.Callable;
/* compiled from: Async.kt */
final class c implements Callable {
private final /* synthetic */ xv a;
c(xv xvVar) {
this.a = xvVar;
}
public final /* synthetic */ V call() {
return this.a.invoke();
}
}
| [
"[email protected]"
] | |
8ec8d96fa7a17099388b7e045acf0198810eccc3 | a65bd8df7483ae0305181c60310f8e9f0c81cbe6 | /app/src/main/java/com/example/admin/bibleapp/util/ViewHelper.java | 10cacad4c8a61f4d9e760aa417d1f694563432da | [] | no_license | balajipaulraj/Nexus | 4cef84551c2c3f0bc368aa1721a1ea885d762816 | 216ff3867db7d10cd033410c0c8d26fcfdd4529c | refs/heads/master | 2022-09-05T16:02:47.310427 | 2020-05-30T06:22:14 | 2020-05-30T06:22:14 | 267,246,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 677 | java | package com.example.admin.bibleapp.util;
import android.view.View;
public class ViewHelper {
public static boolean isViewHit(View view, View origin, int x, int y) {
int[] viewLocation = new int[2];
view.getLocationOnScreen(viewLocation);
int[] parentLocation = new int[2];
origin.getLocationOnScreen(parentLocation);
int screenX = parentLocation[0] + x;
int screenY = parentLocation[1] + y;
if (screenX < viewLocation[0] || screenX >= viewLocation[0] + view.getWidth() || screenY < viewLocation[1] || screenY >= viewLocation[1] + view.getHeight()) {
return false;
}
return true;
}
}
| [
"[email protected]"
] | |
ffb201cc4d58eceb14bf2998c0a9bbcf852f47c8 | be4b32fa7e7766ffe641170beb238aa914ccbe75 | /app/src/main/java/com/qwerty/depresso/main/post/editPost/EditPostView.java | 1adfb7028f50f4ab4349b526bc24767a6464e0dc | [] | no_license | HARrrrisoon39/Depresso-Android-Studio | 1858a1f299e56a4f20dc07e9f8826efeeee35387 | 42271b8dc8acfcf9bc7d3b11529d92eae8f85db4 | refs/heads/master | 2022-11-23T11:39:51.504611 | 2020-07-29T12:27:21 | 2020-07-29T12:27:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 862 | java | /*
* Copyright 2018 Rozdoum
*
* 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.qwerty.depresso.main.post.editPost;
import com.qwerty.depresso.main.post.createPost.CreatePostView;
/**
* Created by Alexey on 03.05.18.
*/
public interface EditPostView extends CreatePostView {
void openMainActivity();
}
| [
"[email protected]"
] | |
3b2c014196cb42cc6d570ccb80147a6d6439957c | 07d51e7f1c6dc8463d5369a72d3614ff5112a3e9 | /cs251/project1/PercolationVisualizer.java | d9ced9ee4a5105daff961312939ed2980cc6cd2d | [] | no_license | dharsiddharth7/Purdue-Coursework | 7736688a6ea30f300b90bd76dc029d4aae53229c | 5587f4a5880f3f6614ef48d9a45b9581262af740 | refs/heads/master | 2020-03-27T00:18:11.984174 | 2018-08-21T20:13:59 | 2018-08-21T20:13:59 | 143,621,864 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,259 | java | import java.awt.*;
/**
* Created by Siddharth on 9/8/17.
*/
public class PercolationVisualizer {
private static int delay = 400;
public static void visualizer(Percolation percolation, int size) {
StdDraw.clear();
//StdDraw.setCanvasSize(500,500);
StdDraw.setXscale(0, size);
StdDraw.setYscale(0, size);
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.filledSquare(size/2.0,size/2.0,size/2.0);
StdDraw.setFont(new Font("TimesRoman", Font.ROMAN_BASELINE, 15));
int sites = 0;
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
if (percolation.isFull(i,j) && percolation.isOpen(i,j) && percolation.validateIndices(i,j)) {
sites++;
StdDraw.setPenColor(StdDraw.BOOK_BLUE);
} else if (percolation.isOpen(i,j) && percolation.validateIndices(i,j)) {
sites++;
StdDraw.setPenColor(StdDraw.WHITE);
} else
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.filledSquare(j + 0.498, size - i - 0.498, 0.498);
}
}
percolates(percolation,size);
StdDraw.text(0.09 * size, -(size * 0.025), sites + " open sites");
}
public static void percolates(Percolation percolation,int size) {
if (percolation.percolates()) {
StdDraw.text(0.935 * size, -(size * 0.025), "Percolates");
}
else {
StdDraw.text(0.875 * size, -(size * 0.025), "Does not percolate");
}
}
public static void main(String[] args) {
//In in = new In("/Users/Siddharth/Desktop/samples/test5.txt/");
int gridSize = StdIn.readInt();
Percolation percolation = new Percolation(gridSize);
StdDraw.show(0);
while (!StdIn.isEmpty()) {
int i = StdIn.readInt();
int j = gridSize-StdIn.readInt()-1;
percolation.open(j,i);
visualizer(percolation, gridSize);
StdDraw.show(delay);
}
}
}
| [
"[email protected]"
] | |
aa93cd81d5a755afd187148429e6830f4af9075e | 1a84d3edf90658f9d8333a8580b58a1cbe95bdb3 | /src/main/java/app/H2Runner.java | 9d71941eb9b97b05342fc9c5b1a9690c7a63ae7c | [] | no_license | zoony82/springBootMaven | a09f5058a81e1716af6780308bb901b3e0fa7951 | 4a2411031cdf9481e5b84f13684484289288b562 | refs/heads/master | 2020-05-20T14:02:29.897809 | 2019-05-27T14:41:29 | 2019-05-27T14:41:29 | 185,613,677 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,150 | java | package app;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.Statement;
@Component
public class H2Runner implements ApplicationRunner {
@Autowired //기본적으로 데이터 소스가 빈으로 등록이 되서, 가져다 사용하면 된다
DataSource dataSource;
@Override
public void run(ApplicationArguments args) throws Exception {
try(Connection connection = dataSource.getConnection()){
connection.getMetaData().getURL();
connection.getMetaData().getUserName();
Statement statement = connection.createStatement();
String sql = "Create Table User(id integer not null,name varchar(255), PRIMARY KEY(Id))";
statement.executeUpdate(sql);
// connection.close();
System.out.println(connection.getMetaData().getURL() + " : " + connection.getMetaData().getUserName());
}
}
}
| [
"[email protected]"
] | |
d8c39d7134f91359dce2ab75b8a13ea82211ba73 | cc5f7034037cf8c5de9f403e4544bfc672458bdf | /app/src/main/java/mac2015/lavit/ui/view/MainView.java | 82a309dafa6a45883432733a09fa69e0971c39ef | [] | no_license | skliba/MobileAppChallenge-Lavit | b1f51a81c87b89995d2f5831540c7a30e6657608 | ad7a0be0f72edaadb46c162b22d97cf857495690 | refs/heads/master | 2021-01-10T03:22:29.241414 | 2015-09-23T13:45:42 | 2015-09-23T13:45:42 | 42,989,483 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | package mac2015.lavit.ui.view;
import mac2015.lavit.domain.models.User;
/**
* Created by dmacan on 23.9.2015..
*/
public interface MainView extends View {
void showProfileInfo(User user);
}
| [
"[email protected]"
] | |
8a4dfa99b54d45dc79c3bd23b6d1e954b27b2570 | ad012a1298d56206f30cebb96eeea66a8e5141e9 | /app/src/main/java/memelord/com/bro_finder/MyEventsActivity.java | bf648f47aad69ad6623173636a39312109ea4edb | [] | no_license | christoffer-thygesen/bro-finder | 7703b4f14eeebe2b33df8eb8e7ce3cccda7fe956 | 878d57c5d7cd4da13185b5d439f311765f640f04 | refs/heads/master | 2021-08-24T07:38:23.207377 | 2017-12-08T15:13:52 | 2017-12-08T15:13:52 | 112,650,441 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,505 | java | package memelord.com.bro_finder;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
public class MyEventsActivity extends AppCompatActivity {
/*
final ArrayList<String> myEventList = new ArrayList<String>();
final ArrayAdapter myEventAdapter = new ArrayAdapter(this,R.layout.myeventlist , myEventList);
ListView listView = (ListView)findViewById(R.id.list);
//listView.setAdapter(myEventAdapter);
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_events);
final ListView myEvents = findViewById(R.id.MyEventList);
ListView participatingEvents = findViewById(R.id.myParticipatingEvents);
final ArrayList<Event> myEventsList = new ArrayList<>();
final MyEventsAdapter myAdapter = new MyEventsAdapter(this, myEventsList);
final MyEventsAdapter myParticipatingEventsAdapter = new MyEventsAdapter(this, myEventsList);
Event a = new Event("123", "Kicking a ball", "Football", "abc", "John", 5, 2, 2017, 06022017, 333, 444, 555);
Event b = new Event("1234", "Kicking a bottle", "Beer", "ab", "Jo", 6, 2, 2017, 06022017, 333, 444, 555);
Event c = new Event("1235", "Kicking ", "Walk", "abcd", "Johnathan", 5, 3, 2017, 06022017, 333, 444, 555);
myEventsList.add(0, a);
myEventsList.add(1, b);
myEventsList.add(2, c);
CheckBox box = findViewById(R.id.checkboxAll);
myEvents.setAdapter(myAdapter);
participatingEvents.setAdapter(myParticipatingEventsAdapter);
box.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked == true){
for(int i = 0; i<myEvents.getChildCount();i++){
View mChild = myEvents.getChildAt(i);
CheckBox checkitOff = mChild.findViewById(R.id.checkBox);
checkitOff.setChecked(true);
}}
else if(isChecked != true){
for(int i = 0; i<myEvents.getChildCount();i++){
View mChild = myEvents.getChildAt(i);
CheckBox checkitOff = mChild.findViewById(R.id.checkBox);
checkitOff.setChecked(false);
}
}}
});}
/*
for(Event myEvents : myEventList) {
if(Event.getId(creatorID).equals(someId) {
ListView myEvents = (ListView)findViewById(R.id.myEventList);
//found it!
}
}
for(Event myParticipatingEvents : myEventList)(
if(Event.getId( *id = participating*?){
ListView participatingEvents = (ListView)findViewById(R.id.myParticipatingEvents);
* */
public void refreshButton(View v){
recreate();
Toast.makeText( MyEventsActivity.this, "Refreshed page",
Toast.LENGTH_SHORT).show();
}
public void deleteEvents(View v){
/*for(int i = 0; i<myEventsList.getCount();i++){
if(myEventsList.isChecked){
DatabaseManager.getInstance(.deleteEvent();)
}
}*/
}
}
| [
"[email protected]"
] | |
987ca07d7b21bb17794215dfa78d9d64c8d7f6f6 | 877c345d867d40fc7c0e88d66804572a651d228c | /Task1.java | 1f777e7266a2a4d20c387d932a60d3406f2532ee | [] | no_license | Hitashee/AdvanceTatoc | 77bc5938c98ca058e5fbc1e3466d440a3394afc4 | 2cb141efcf6ca74b38bd3e0f57d18107287ea1d6 | refs/heads/master | 2021-01-17T17:28:12.542129 | 2016-06-28T03:48:58 | 2016-06-28T03:48:58 | 62,047,791 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,107 | java | package advance;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class Task1 extends GetDriver{
WebDriver task1()
{
WebDriver driver=getDriver();
System.out.println("Task 1");
driver.get("http://10.0.1.86/tatoc/advanced/hover/menu");
WebElement menu=driver.findElement(By.className("menutop"));
Actions builder = new Actions(driver);
builder.moveToElement(menu).build().perform();
System.out.println("Action performed on Menu");
WebDriverWait wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("/html/body/div/div[2]/div[2]/span[5]")));
if(driver.findElement(By.xpath("/html/body/div/div[2]/div[2]/span[5]")).getText().contains("Go Next"))
{
driver.findElement(By.xpath("/html/body/div/div[2]/div[2]/span[5]")).click();
System.out.println("Proceed to next");
}
return driver;
}
}
| [
"[email protected]"
] | |
54b6fdc8890821057617d1bf986f1bbe1893a805 | 608c310d924c1a871c8b23511daea3346e5f332f | /src/enstabretagne/base/math/Randomizer.java | 7c0e574e7f7503d320b0f599238358fc6770a8ff | [] | no_license | ceciless/EnstaSimulationEngineandDemo | 5822cb26b08866e06fa350ce15a9098cf8aa4674 | 9cb913f18f717a7cc0e3009e314072bf01d116ed | refs/heads/master | 2021-01-10T13:28:56.135590 | 2016-02-07T14:20:59 | 2016-02-07T14:20:59 | 51,250,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,052 | java | /**
* Classe Randomizer.java
*@author Olivier VERRON
*@version 1.0.
*/
package enstabretagne.base.math;
import java.util.Random;
/**
* @author Audoli
*
*/
public class Randomizer {
static final double ProbMin = 1.0E-12;
static final double ProbMax = 1.0 - ProbMin;
public Randomizer(Random r){
}
/**
*
* @param replicaSeed
* @param mixer
* @return
*/
public static int GetSeed(int replicaSeed, String mixer) {
int seed = replicaSeed;
if (seed == 0)
seed = (int) System.currentTimeMillis();
if (mixer == null)
return seed;
boolean b = false;
for(int i=0;i<mixer.length(); i++) // Use a specific (but portable) HashCode
{
int n = mixer.codePointAt(i);
b = !b;
if (b)
seed += n;
else
seed *= n;
}
return seed;
}
public String RandomGeneratorType() {
// TODO Auto-generated method stub
return "RandomADeterminer";
}
}
| [
"[email protected]"
] | |
185b08f901bcff54a05a099a4b3e68cdc54ef371 | 0bafaad70405a9bc544d6bba5f8b3542df9f6918 | /src/main/java/Objects/Travel.java | b728ba081e1c77a8efce38e539adce90c4e82702 | [] | no_license | Drym/SmartServerV2 | 302faad0267237d3e96f9ccfc6b914828ee0411f | f7786c684d4b0860a8cf2de333a7e65abffde635 | refs/heads/master | 2020-07-02T22:10:13.993360 | 2017-02-17T14:52:03 | 2017-02-17T14:52:03 | 74,279,165 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,511 | java | package Objects;
import java.util.Calendar;
import java.util.Date;
/**
* Created by thibault on 09/12/2016.
*/
public class Travel {
private int id;
private Date date;
private int time;
public Travel() {
this.id = -1;
this.date = new Date();
this.time = -1;
}
public Travel(Date date, int time) {
this.id = -1;
this.date = date;
this.time = time;
}
public Travel(int id, Date date, int time) {
this.id = id;
this.date = date;
this.time = time;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public int getTime() {
return time;
}
public void setTime(int time) {
this.time = time;
}
/*
return the number of the day in the week
*/
public int getDay(){
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.DAY_OF_WEEK);
}
/*
return the number of seconds this midnight
*/
public int getStart(){
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.HOUR_OF_DAY) * 3600 + cal.get(Calendar.MINUTE) * 60 + cal.get(Calendar.SECOND);
}
public static int getStartHour(int seconds){
return seconds/3600;
}
}
| [
"[email protected]"
] | |
a4c0e9df831598083f13b9e4f9c746c2e36b5a26 | 260f25087f7f07a8eb2b306c37c56493c75ab318 | /nos2jdbc-core/src/main/java/org/seasar/extension/jdbc/name/PropertyName.java | 01eb7a3b8686f5bc15b58ed69970cb7cb4b5f0c5 | [
"Apache-2.0"
] | permissive | ns2j/nos2jdbc | 6726c5c81cfd080722b36dd66fced5abf1dda0ba | 140d995f95da0771afe297f12bf0ef813eae122d | refs/heads/master | 2023-08-28T02:25:28.443009 | 2023-08-22T06:02:55 | 2023-08-22T06:02:55 | 101,460,069 | 7 | 0 | Apache-2.0 | 2023-05-30T06:05:17 | 2017-08-26T03:32:09 | Java | UTF-8 | Java | false | false | 2,619 | java | /*
* Copyright 2004-2015 the Seasar Foundation and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.seasar.extension.jdbc.name;
import org.seasar.framework.util.StringUtil;
/**
* プロパティ名をあらわすクラスです。ネストしたプロパティに対応しています。
*
* @author higa
* @param <T>
* プロパティの型です。
*/
public class PropertyName<T> implements CharSequence {
/**
* プロパティの名前です。
*/
protected final String name;
/**
* コンストラクタです。
*/
public PropertyName() {
this(null, null);
}
/**
* コンストラクタです。
*
* @param name
* 名前
*/
public PropertyName(final String name) {
this(null, name);
}
/**
* コンストラクタです。
*
* @param parent
* 親
* @param name
* 名前
*/
public PropertyName(final PropertyName<?> parent, final String name) {
if (StringUtil.isEmpty(name)) {
this.name = "";
return;
}
if (parent == null || parent.length() == 0) {
this.name = name;
return;
}
this.name = parent + "." + name;
}
public char charAt(final int index) {
return name.charAt(index);
}
public int length() {
return name.length();
}
public CharSequence subSequence(final int start, final int end) {
return name.substring(start, end);
}
@Override
public String toString() {
return name;
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof CharSequence) {
return name.equals(obj.toString());
}
return false;
}
@Override
public int hashCode() {
return name.hashCode();
}
} | [
"igari.y@gmail"
] | igari.y@gmail |
456c46fd9d55326696e013dc8227427c8242c8b7 | 3c762fba7c3ef9326cf9336bac723fc7ad445d5a | /src/test/java/io/appium/java_client/android/AndroidActivityTest.java | c130e0b655770524e817c79d169950c04428ee81 | [
"Apache-2.0"
] | permissive | hoangdang1449/java-client | a4b297a5bee379eac644ba60258ab644e6e12a69 | 395a9cd151fbbc3a646c2a693ab21b121db626bb | refs/heads/master | 2020-12-24T12:47:53.410647 | 2016-06-15T20:44:31 | 2016-06-15T20:44:31 | 61,485,297 | 1 | 0 | null | 2016-06-19T14:55:14 | 2016-06-19T14:55:14 | null | UTF-8 | Java | false | false | 2,704 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* 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.appium.java_client.android;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
public class AndroidActivityTest extends BaseAndroidTest {
@Before public void setUp() throws Exception {
driver.startActivity("io.appium.android.apis", ".ApiDemos");
}
@Test public void startActivityInThisAppTestCase() {
driver.startActivity("io.appium.android.apis",
".accessibility.AccessibilityNodeProviderActivity");
assertEquals(driver.currentActivity(),
".accessibility.AccessibilityNodeProviderActivity");
}
@Test public void startActivityWithWaitingAppTestCase() {
driver.startActivity("io.appium.android.apis",
".accessibility.AccessibilityNodeProviderActivity",
"io.appium.android.apis", ".accessibility.AccessibilityNodeProviderActivity");
assertEquals(driver.currentActivity(),
".accessibility.AccessibilityNodeProviderActivity");
}
@Test public void startActivityInNewAppTestCase() {
driver.startActivity("com.android.contacts", ".ContactsListActivity");
assertEquals(driver.currentActivity(), ".ContactsListActivity");
driver.pressKeyCode(AndroidKeyCode.BACK);
assertEquals(driver.currentActivity(), ".ContactsListActivity");
}
@Test public void startActivityInNewAppTestCaseWithoutClosingApp() {
driver.startActivity("io.appium.android.apis",
".accessibility.AccessibilityNodeProviderActivity");
assertEquals(driver.currentActivity(), ".accessibility.AccessibilityNodeProviderActivity");
driver.startActivity("com.android.contacts", ".ContactsListActivity",
"com.android.contacts", ".ContactsListActivity", false);
assertEquals(driver.currentActivity(), ".ContactsListActivity");
driver.pressKeyCode(AndroidKeyCode.BACK);
assertEquals(driver.currentActivity(),
".accessibility.AccessibilityNodeProviderActivity");
}
}
| [
"[email protected]"
] | |
1b7cbfba70d98ec5c4963022644bd56c648c123e | fec4c1754adce762b5c4b1cba85ad057e0e4744a | /jf-base/src/main/java/com/jf/dao/TopFieldModuleFieldMapper.java | 726b295f806c8c934e5ada41e2c7925ce38a9b99 | [] | no_license | sengeiou/workspace_xg | 140b923bd301ff72ca4ae41bc83820123b2a822e | 540a44d550bb33da9980d491d5c3fd0a26e3107d | refs/heads/master | 2022-11-30T05:28:35.447286 | 2020-08-19T02:30:25 | 2020-08-19T02:30:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,175 | java | package com.jf.dao;
import com.jf.common.base.BaseDao;
import com.jf.entity.TopFieldModuleField;
import com.jf.entity.TopFieldModuleFieldExample;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface TopFieldModuleFieldMapper extends BaseDao<TopFieldModuleField, TopFieldModuleFieldExample> {
int countByExample(TopFieldModuleFieldExample example);
int deleteByExample(TopFieldModuleFieldExample example);
int deleteByPrimaryKey(Integer id);
int insert(TopFieldModuleField record);
int insertSelective(TopFieldModuleField record);
List<TopFieldModuleField> selectByExample(TopFieldModuleFieldExample example);
TopFieldModuleField selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") TopFieldModuleField record, @Param("example") TopFieldModuleFieldExample example);
int updateByExample(@Param("record") TopFieldModuleField record, @Param("example") TopFieldModuleFieldExample example);
int updateByPrimaryKeySelective(TopFieldModuleField record);
int updateByPrimaryKey(TopFieldModuleField record);
}
| [
"[email protected]"
] | |
6d1e13256a051a9629202c2d6371e3da64b8062a | 5f76a59e182e85d3a9c49331b4c8627c8bdd037f | /src/test/java/com/appsrd/stepdefinition/login_page_test_cases.java | a689013a288a627c98ad84ff0e87db655fb1e8f7 | [] | no_license | Shanjr07/appsrdlogistics | f3db63b63bfa5e88b2146a94e525f0f09165a831 | a1da33290031b381d7f0c85eaa14c9548539d17d | refs/heads/master | 2023-04-07T04:51:48.971908 | 2021-04-14T08:51:05 | 2021-04-14T08:51:05 | 352,550,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,559 | java | package com.appsrd.stepdefinition;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import com.appsrd.object.loginpage;
import com.appsrd.resource.base;
public class login_page_test_cases extends base {
@Parameters({ "Url" })
@BeforeMethod
public void browser(String s1) {
//ubuntuopenbrowser(s1);
openbrowser(s1);
}
@Parameters({ "Username", "invalid_password", "error_message" })
@Test(priority = 1)
public void login_with_incorrect_password(String s1, String s2, String s3) {
loginpage page1 = new loginpage();
send(s1, page1.getUserid());
send(s2, page1.getPass());
click(page1.getLogin());
errorwait(page1.getError());
// text(page1.getError());
Assert.assertTrue(text(page1.getError()).equals(s3), "it shows" + text(page1.getError()));
}
@Parameters({ "Username", "password", "dashboard_url" })
@Test(priority = 2)
public void login_with_correct__username_password(String s1, String s2, String s3) {
loginpage page1 = new loginpage();
send(s1, page1.getUserid());
send(s2, page1.getPass());
click(page1.getLogin());
urlwait("http://qa.appsrdlogistics.com/dashboard/classic");
Assert.assertTrue(url().equals(s3), "it shows" + url());
}
/*@Parameters({ "Username", "password" })
@Test(priority = 3)
public void Forget_password(String s1, String s2) {
//loginpage page1 = new loginpage();
}
*/
@AfterMethod
public void close() {
browserclose();
}
}
| [
"[email protected]"
] | |
f35a6e358dc4d249c292e727e246d8d8fd58a073 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/main/java/org/gradle/test/performancenull_305/Productionnull_30466.java | 837374b72900f03d8a2227de289f9a2b401526e9 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 588 | java | package org.gradle.test.performancenull_305;
public class Productionnull_30466 {
private final String property;
public Productionnull_30466(String param) {
this.property = param;
}
public String getProperty() {
return property;
}
private String prop0;
public String getProp0() {
return prop0;
}
public void setProp0(String value) {
prop0 = value;
}
private String prop1;
public String getProp1() {
return prop1;
}
public void setProp1(String value) {
prop1 = value;
}
}
| [
"[email protected]"
] | |
b6396c7ae13f65534b99cf122039be9e5773de94 | ce2839b4a6d703ec5c7bc3cc3ddcc47df5fc5e4f | /src/main/java/com/tvm/trainingevents/config/LoggingConfiguration.java | de81a6caef34a8221111df191a145b6224537e5a | [] | no_license | igormusic/trainingEvents | 5ee9b7f36548a5eb42042d806b7eb4508f5f3e69 | 4a6b07e315a188c7b94337168a2b1430852281be | refs/heads/master | 2021-04-15T04:00:10.420145 | 2018-03-22T11:20:42 | 2018-03-22T11:20:42 | 126,324,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,479 | java | package com.tvm.trainingevents.config;
import java.net.InetSocketAddress;
import java.util.Iterator;
import io.github.jhipster.config.JHipsterProperties;
import ch.qos.logback.classic.AsyncAppender;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.boolex.OnMarkerEvaluator;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggerContextListener;
import ch.qos.logback.core.Appender;
import ch.qos.logback.core.filter.EvaluatorFilter;
import ch.qos.logback.core.spi.ContextAwareBase;
import ch.qos.logback.core.spi.FilterReply;
import net.logstash.logback.appender.LogstashTcpSocketAppender;
import net.logstash.logback.encoder.LogstashEncoder;
import net.logstash.logback.stacktrace.ShortenedThrowableConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
@Configuration
@RefreshScope
public class LoggingConfiguration {
private static final String LOGSTASH_APPENDER_NAME = "LOGSTASH";
private static final String ASYNC_LOGSTASH_APPENDER_NAME = "ASYNC_LOGSTASH";
private final Logger log = LoggerFactory.getLogger(LoggingConfiguration.class);
private LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
private final String appName;
private final String serverPort;
private final EurekaInstanceConfigBean eurekaInstanceConfigBean;
private final String version;
private final JHipsterProperties jHipsterProperties;
public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort,
@Autowired(required = false) EurekaInstanceConfigBean eurekaInstanceConfigBean, @Value("${info.project.version}") String version, JHipsterProperties jHipsterProperties) {
this.appName = appName;
this.serverPort = serverPort;
this.eurekaInstanceConfigBean = eurekaInstanceConfigBean;
this.version = version;
this.jHipsterProperties = jHipsterProperties;
if (jHipsterProperties.getLogging().getLogstash().isEnabled()) {
addLogstashAppender(context);
addContextListener(context);
}
if (jHipsterProperties.getMetrics().getLogs().isEnabled()) {
setMetricsMarkerLogbackFilter(context);
}
}
private void addContextListener(LoggerContext context) {
LogbackLoggerContextListener loggerContextListener = new LogbackLoggerContextListener();
loggerContextListener.setContext(context);
context.addListener(loggerContextListener);
}
private void addLogstashAppender(LoggerContext context) {
log.info("Initializing Logstash logging");
LogstashTcpSocketAppender logstashAppender = new LogstashTcpSocketAppender();
logstashAppender.setName(LOGSTASH_APPENDER_NAME);
logstashAppender.setContext(context);
String optionalFields = "";
if (eurekaInstanceConfigBean != null) {
optionalFields = "\"instance_id\":\"" + eurekaInstanceConfigBean.getInstanceId() + "\",";
}
String customFields = "{\"app_name\":\"" + appName + "\",\"app_port\":\"" + serverPort + "\"," +
optionalFields + "\"version\":\"" + version + "\"}";
// More documentation is available at: https://github.com/logstash/logstash-logback-encoder
LogstashEncoder logstashEncoder=new LogstashEncoder();
// Set the Logstash appender config from JHipster properties
logstashEncoder.setCustomFields(customFields);
// Set the Logstash appender config from JHipster properties
logstashAppender.addDestinations(new InetSocketAddress(jHipsterProperties.getLogging().getLogstash().getHost(),jHipsterProperties.getLogging().getLogstash().getPort()));
ShortenedThrowableConverter throwableConverter = new ShortenedThrowableConverter();
throwableConverter.setRootCauseFirst(true);
logstashEncoder.setThrowableConverter(throwableConverter);
logstashEncoder.setCustomFields(customFields);
logstashAppender.setEncoder(logstashEncoder);
logstashAppender.start();
// Wrap the appender in an Async appender for performance
AsyncAppender asyncLogstashAppender = new AsyncAppender();
asyncLogstashAppender.setContext(context);
asyncLogstashAppender.setName(ASYNC_LOGSTASH_APPENDER_NAME);
asyncLogstashAppender.setQueueSize(jHipsterProperties.getLogging().getLogstash().getQueueSize());
asyncLogstashAppender.addAppender(logstashAppender);
asyncLogstashAppender.start();
context.getLogger("ROOT").addAppender(asyncLogstashAppender);
}
// Configure a log filter to remove "metrics" logs from all appenders except the "LOGSTASH" appender
private void setMetricsMarkerLogbackFilter(LoggerContext context) {
log.info("Filtering metrics logs from all appenders except the {} appender", LOGSTASH_APPENDER_NAME);
OnMarkerEvaluator onMarkerMetricsEvaluator = new OnMarkerEvaluator();
onMarkerMetricsEvaluator.setContext(context);
onMarkerMetricsEvaluator.addMarker("metrics");
onMarkerMetricsEvaluator.start();
EvaluatorFilter<ILoggingEvent> metricsFilter = new EvaluatorFilter<>();
metricsFilter.setContext(context);
metricsFilter.setEvaluator(onMarkerMetricsEvaluator);
metricsFilter.setOnMatch(FilterReply.DENY);
metricsFilter.start();
for (ch.qos.logback.classic.Logger logger : context.getLoggerList()) {
for (Iterator<Appender<ILoggingEvent>> it = logger.iteratorForAppenders(); it.hasNext();) {
Appender<ILoggingEvent> appender = it.next();
if (!appender.getName().equals(ASYNC_LOGSTASH_APPENDER_NAME)) {
log.debug("Filter metrics logs from the {} appender", appender.getName());
appender.setContext(context);
appender.addFilter(metricsFilter);
appender.start();
}
}
}
}
/**
* Logback configuration is achieved by configuration file and API.
* When configuration file change is detected, the configuration is reset.
* This listener ensures that the programmatic configuration is also re-applied after reset.
*/
class LogbackLoggerContextListener extends ContextAwareBase implements LoggerContextListener {
@Override
public boolean isResetResistant() {
return true;
}
@Override
public void onStart(LoggerContext context) {
addLogstashAppender(context);
}
@Override
public void onReset(LoggerContext context) {
addLogstashAppender(context);
}
@Override
public void onStop(LoggerContext context) {
// Nothing to do.
}
@Override
public void onLevelChange(ch.qos.logback.classic.Logger logger, Level level) {
// Nothing to do.
}
}
}
| [
"[email protected]"
] | |
7f68cd27063423adcfabcc282d2e752b46eaabb8 | 20653f143393717376ab77deaab54a90750f9c41 | /ShoppingListExtGlass/src/main/java/org/openintents/shopping/glass/OIShoppingListSender.java | d5c947c5564f82cd782b44d8f46bc052ce859715 | [] | no_license | Dima0o/shoppinglist | f9426c1941d4a56f98b4cff7c6318b5d8a9b2244 | 907f8cb963e0e358c5c90b663be168fa09f42bf0 | refs/heads/master | 2021-01-21T19:01:29.270840 | 2015-07-15T13:38:13 | 2015-07-15T16:06:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,770 | java | package org.openintents.shopping.glass;
import android.app.Activity;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.database.ContentObserver;
import android.database.Cursor;
import android.util.Log;
import org.openintents.shopping.Shopping;
import org.openintents.shopping.provider.ShoppingUtils;
import org.openintents.shopping.provider.ThemeUtils2;
public class OIShoppingListSender {
private static final String LOG_TAG = "OIShoppingListSender";
private boolean mInvalideShoppingVersion;
private Cursor mShoppingListIds;
private Activity context;
private int mShoppingListPos;
private int mPos;
private ContentObserver mContentObserver;
private long mShoppingListId;
private String mShoppingListName;
private Cursor mExistingItems;
public OIShoppingListSender(Activity activity) {
this.context = activity;
try {
PackageInfo info = context.getPackageManager().getPackageInfo("org.openintents.shopping", 0);
if (info.versionCode < 10024) {
mInvalideShoppingVersion = true;
}
} catch (PackageManager.NameNotFoundException e) {
mInvalideShoppingVersion = true;
}
initShoppingLists(false);
}
private void initShoppingLists(boolean setDefault) {
if (mInvalideShoppingVersion) {
return;
}
mShoppingListIds = ShoppingUtils.getListsIds(context);
if (setDefault) {
long activeListId = ShoppingUtils.getDefaultList(context);
Log.d(LOG_TAG, "active list " + activeListId);
mShoppingListPos = 0;
int count = 0;
if (mShoppingListIds.moveToFirst()) {
do {
long id = mShoppingListIds.getLong(0);
if (id == activeListId) {
mShoppingListPos = count;
Log.d(LOG_TAG, "active list pos " + count);
break;
}
count++;
} while (mShoppingListIds.moveToNext());
}
}
setCurrentShoppingListId(mShoppingListPos);
refreshCursor();
/*
context.getContentResolver().registerContentObserver(Shopping.Contains.CONTENT_URI,
true, mContentObserver) ;
context.getContentResolver().registerContentObserver(Shopping.ContainsFull.CONTENT_URI,
true, mContentObserver);
context.getContentResolver().registerContentObserver(
Shopping.Items.CONTENT_URI, true, mContentObserver);
*/
mPos = 0;
}
private void setCurrentShoppingListId(int mShoppingListPos2) {
mShoppingListIds.moveToPosition(mShoppingListPos);
if (mShoppingListIds.getCount() > 0) {
mShoppingListId = mShoppingListIds.getLong(0);
}
Log.d(LOG_TAG, "mShoppingListId: " + mShoppingListId);
ThemeUtils2.setRemoteStyle(context, mShoppingListIds.getString(1), 14,
true);
mShoppingListName = mShoppingListIds.getString(2);
}
private void refreshCursor() {
Log.d(LOG_TAG, "refreshCursor() called");
try {
if (mExistingItems != null) {
mExistingItems.close();
}
String sortOrder = "contains.modified_date"; //
mExistingItems = context.getContentResolver()
.query(
Shopping.ContainsFull.CONTENT_URI,
new String[]{Shopping.ContainsFull._ID,
Shopping.ContainsFull.ITEM_NAME,
Shopping.ContainsFull.ITEM_TAGS,
Shopping.ContainsFull.QUANTITY,
Shopping.ContainsFull.MODIFIED_DATE,
Shopping.ContainsFull.STATUS},
Shopping.ContainsFull.LIST_ID + " = ? AND "
+ Shopping.ContainsFull.STATUS + "<= ?",
new String[]{
String.valueOf(mShoppingListId),
String.valueOf(Shopping.Status.WANT_TO_BUY)},
null);
} catch (Exception e) {
e.printStackTrace();
}
}
public Item getItem(int pos) {
Item result = null;
if (mExistingItems != null) {
mExistingItems.requery();
mExistingItems.moveToPosition(pos);
if (mExistingItems.getCount() > 0) {
result = new Item(
mExistingItems.getString(0), mExistingItems.getString(1),
mExistingItems.getString(2), mExistingItems.getInt(3),
// mExistingItems.getInt(4),
mExistingItems.getInt(5)
);
}
}
return result;
}
public String getShoppingListName() {
return mShoppingListName;
}
public int getCount() {
return mExistingItems.getCount();
}
public static class Item {
private Item(String id, String item, String tags, int quantity,
int bought) {
this.item = item;
this.tags = tags;
this.quantity = quantity;
if (bought == 1) {
this.bought = false;
} else {
this.bought = true;
}
}
public String id;
public String item;
public String tags;
public int quantity;
public boolean bought;
}
} | [
"[email protected]"
] | |
4188731db30d6a3073cc851488eecf716ac81690 | 3e91e71323a043bd404203bd4d5efd9aae15b18e | /OrderSys/src/com/ordersys/dao/impl/DeskDaoImpl.java | a35c04ee1ba4fd869fce4f9bdcf209b4b9aa691c | [] | no_license | ZhanXiaoFeng/MyProject | f5dc60612a0c644f3837192f4298bad68c2d927a | 61ecfb266173e5dc7b283cb4fd5bc4a40912b6cd | refs/heads/master | 2022-07-17T15:41:49.300176 | 2018-08-23T10:53:07 | 2018-08-23T10:53:07 | 141,031,392 | 1 | 0 | null | 2022-06-29T16:45:38 | 2018-07-15T13:54:32 | JavaScript | GB18030 | Java | false | false | 3,535 | java | package com.ordersys.dao.impl;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import com.ordersys.bean.Desk;
import com.ordersys.dao.DeskDao;
import com.ordersys.utils.MySQLTool;
/**
* DeskDao 接口下的具体实现类
* @author ZRF
*
*/
public class DeskDaoImpl implements DeskDao {
@Override
// 插入餐桌号
public int insertDesk(Desk desk) throws SQLException {
// 获取链接对象
Connection conn = MySQLTool.getConnection();
// 执行sql语句
String sql = "insert into tb_desk (id) values(?)";
PreparedStatement ps = conn.prepareStatement(sql);
ps.setInt(1, desk.getId());
int res = ps.executeUpdate();
// 释放资源
MySQLTool.free(ps, conn);
return res;
}
@Override
// 更新餐桌数据
public int updateDesk(Desk desk) throws SQLException {
Connection conn = MySQLTool.getConnection();
String sql = "update tb_desk set waiterid=?, totalprice=?,pay=? where id=? ";
PreparedStatement ps = conn.prepareStatement(sql);
ps.setInt(1, desk.getWaiterId());
ps.setInt(2, desk.getTotalPrice());
ps.setBoolean(3, desk.isPay());
ps.setInt(4, desk.getId());
int res = ps.executeUpdate();
return res;
}
@Override
// 通过桌子id查找总桌子号
public Desk selectDesk(int deskId) throws SQLException {
Connection conn = MySQLTool.getConnection();
String sql = "select * from tb_desk where id = ?";
PreparedStatement ps = conn.prepareStatement(sql);
ps.setInt(1, deskId);
ResultSet rs = ps.executeQuery();
if (rs.next()) { // 注意是使用if循环
return new Desk(deskId, rs.getInt("waiterId"),
rs.getInt("totalPrice"), rs.getBoolean("pay"));
}
MySQLTool.free(rs, ps, conn);
return null;
}
@Override
// 查找所有桌子
public List<Desk> selectAllDesks() throws SQLException {
List<Desk> res = new ArrayList<Desk>();
Connection conn = MySQLTool.getConnection();
String sql = "select * from tb_desk";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) { // 注意是使用while循环
Desk desk = new Desk();
desk.setId(rs.getInt("id"));
res.add(desk);
}
MySQLTool.free(rs, stmt, conn);
return res;
}
@Override
// 查找所有空桌
public List<Desk> selectAllNotSelectedDesks() throws SQLException {
List<Desk> res = new ArrayList<Desk>();
Connection conn = MySQLTool.getConnection();
String sql = "select * from tb_desk where pay=1";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) { // 注意是使用while循环
Desk desk = new Desk();
desk.setId(rs.getInt("id"));
res.add(desk);
}
MySQLTool.free(rs, stmt, conn);
return res;
}
@Override
// 查找所有已被使用的桌子
public List<Desk> selectAllHaveSelectedDesks() throws SQLException {
List<Desk> res = new ArrayList<Desk>();
Connection conn = MySQLTool.getConnection();
String sql = "select * from tb_desk where pay=0";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) { // 注意是使用while循环
Desk desk = new Desk();
desk.setId(rs.getInt("id"));
desk.setTotalPrice(rs.getInt("totalPrice"));
res.add(desk);
}
MySQLTool.free(rs, stmt, conn);
return res;
}
}
| [
"[email protected]"
] | |
ca823d63ab8ebaaa06e92b1a90d306a811c85a1a | 8b4e8269d07bac3ad536d126409fa3a13b99aae7 | /weimob-bs-multidb/src/main/java/com/weimob/bs/multidb/dao/mysql/annotation/TargetDataSource.java | 6918760243d0e8aa4c00d1ae0465cb7c74803f47 | [] | no_license | klauss123/multidb | 580be71be7c613d0795ede43fb3b7b7819766406 | 9fb3744bb2bb4c57b4d6a6cb173743f6c7c26804 | refs/heads/master | 2021-01-01T05:29:04.250807 | 2016-04-27T12:42:46 | 2016-04-27T12:42:46 | 57,050,039 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 280 | java | package com.weimob.bs.multidb.dao.mysql.annotation;
import java.lang.annotation.*;
/**
* Created by Adam on 2016/4/26.
*/
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface TargetDataSource {
String name();
}
| [
"[email protected]"
] | |
fdd1a1ae0dea2c940de194bcf934c8c5b16e95f3 | c9aa9aa37e91314dec82d99a04100152d78aa193 | /src/plant/com/control/ShowAllHerbs.java | af66fe7c311fe6fd5a61d7ad36453ee495678be2 | [] | no_license | phack12/Online-Plant-Selling | c0267d1e21275e4aa2a2a9b1e9a1762ac48e19bc | 9a3f586f668628e11fcd44c7d64ad28c8ba9ed07 | refs/heads/master | 2022-12-09T22:12:20.643540 | 2020-08-29T14:28:44 | 2020-08-29T14:28:44 | 291,274,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,805 | java | package plant.com.control;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import plant.com.bo.FLower;
import plant.com.util.PlantDbConnection;
/**
* Servlet implementation class ShowAllHerbs
*/
public class ShowAllHerbs extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
List<FLower> list = new ArrayList<FLower>();
//fill using jdbc
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try{
con = PlantDbConnection.getConnection();
stmt = con.createStatement();
//join we need product and its cat
//String sql ="select * from product p ,product_cat c where p.cat_id=c.id";
//String sql ="select * from product ";
String sql ="select *from herbs";
rs = stmt.executeQuery(sql);
while(rs.next()){
FLower f = new FLower();
f.setFlowerId(rs.getString(1));
f.setFlowerName(rs.getString(2));
f.setFlowerDesc(rs.getString(3));
f.setFlowerImage(rs.getString(4));
//cat
//add into list
list.add(f);
}//end while
}catch(Exception e){
e.printStackTrace();
}finally{
try {
PlantDbConnection.closeConnection(con);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
request.setAttribute("allherbs", list);
request.getRequestDispatcher("herbs.jsp").forward(request, response);
}
}
| [
"[email protected]"
] | |
4b577ee56de8bdf065c31a49a434b5669ce96cd7 | e55c2f8a9794bc588837c341bc28094ddf766a53 | /src/day28/IntefaceCalls.java | d02685f57d75ede369f93bf50008bf46d5f6f591 | [] | no_license | SareSena/renastechJava | bfcd0732626a013b790f66294f5fda6575dcc4c9 | 2ba2bc722d6333590d3ceabcd79f00075da5c8b2 | refs/heads/main | 2023-06-19T10:59:09.991959 | 2021-07-23T00:51:22 | 2021-07-23T00:51:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 679 | java | package day28;
public class IntefaceCalls implements InterfaceIntroduction{
// ////differences between abstract class and interface
@Override
public void method3() {
}
@Override
public void method4() {
}
@Override
public void method5() {
}
// //A class can inherit from one class only (extends)
// //A class can inherit multiple interfaces (implements)
/* below methods will be inherited
default void method1(){};
static void method2(){};
public abstract void method3();//public and abstract
abstract void method4();//public and abstract
void method5(); //public and abstract
*/
}
| [
"[email protected]"
] | |
fb7b21399559c34b823f874df564de9dc2cc947c | 55ec4bdb3474eed777f6f7a7fffd12896ed71109 | /Farva/app/src/main/java/com/builders/farva/CreatePathActivity.java | 2468c32f79476d86b127880b4fe1506c74745b29 | [] | no_license | build3r/Ghoomio | 48df7e5739f089ae3fa42558ce36ab15f74d1db0 | 4f35e41128d5379e45123623ad2ad4727d689a84 | refs/heads/master | 2020-12-11T05:30:26.795887 | 2015-07-26T05:45:05 | 2015-07-26T05:45:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,137 | java | package com.builders.farva;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
public class CreatePathActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_path);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_create_path, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"[email protected]"
] | |
96fa1a23e3c66644151f11d98d07b6786dacc776 | 5440c44721728e87fb827fb130b1590b25f24989 | /GPP/com/brt/gpp/comum/mapeamentos/entidade/OfertaPacoteDados.java | 5f1b8dc6e7d00a454be8c6a4459e3fe65fa73d10 | [] | no_license | amigosdobart/gpp | b36a9411f39137b8378c5484c58d1023c5e40b00 | b1fec4e32fa254f972a0568fb7ebfac7784ecdc2 | refs/heads/master | 2020-05-15T14:20:11.462484 | 2019-04-19T22:34:54 | 2019-04-19T22:34:54 | 182,328,708 | 0 | 0 | null | null | null | null | ISO-8859-13 | Java | false | false | 4,716 | java | package com.brt.gpp.comum.mapeamentos.entidade;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
/**
* Classe responsavel por conter as informacoes da
* tabela TBL_PRO_OFERTA_PACOTE_DADOS
*
* @author Joćo Paulo Galvagni
* @since 31/08/2007
*/
public class OfertaPacoteDados implements Entidade, Comparable
{
private int idtOferta;
private String desOferta;
private TipoSaldo tipoSaldo;
private PacoteDados pacoteDados;
private Date dataCadastro;
private Date dataInicioOferta;
private Date dataFimOferta;
private boolean enviaBroadcast;
private Collection assinantes;
public OfertaPacoteDados()
{
idtOferta = -1;
tipoSaldo = null;
pacoteDados = null;
dataCadastro = null;
dataInicioOferta = null;
dataFimOferta = null;
enviaBroadcast = false;
assinantes = new ArrayList();
}
/**
* @return the assinantes
*/
public Collection getAssinantes()
{
return assinantes;
}
/**
* @param assinantes the assinantes to set
*/
public void setAssinantes(Collection assinantes)
{
this.assinantes = assinantes;
}
/**
* @return the dataCadastro
*/
public Date getDataCadastro()
{
return dataCadastro;
}
/**
* @param dataCadastro the dataCadastro to set
*/
public void setDataCadastro(Date dataCadastro)
{
this.dataCadastro = dataCadastro;
}
/**
* @return the dataFimOferta
*/
public Date getDataFimOferta()
{
return dataFimOferta;
}
/**
* @param dataFimOferta the dataFimOferta to set
*/
public void setDataFimOferta(Date dataFimOferta)
{
this.dataFimOferta = dataFimOferta;
}
/**
* @return the dataInicioOferta
*/
public Date getDataInicioOferta()
{
return dataInicioOferta;
}
/**
* @param dataInicioOferta the dataInicioOferta to set
*/
public void setDataInicioOferta(Date dataInicioOferta)
{
this.dataInicioOferta = dataInicioOferta;
}
/**
* @return the enviaBroadcast
*/
public boolean isEnviaBroadcast()
{
return enviaBroadcast;
}
/**
* @param enviaBroadcast the enviaBroadcast to set
*/
public void setEnviaBroadcast(boolean enviaBroadcast)
{
this.enviaBroadcast = enviaBroadcast;
}
/**
* @return the idtOferta
*/
public int getIdtOferta()
{
return idtOferta;
}
/**
* @param idtOferta the idtOferta to set
*/
public void setIdtOferta(int idtOferta)
{
this.idtOferta = idtOferta;
}
/**
* @return the pacoteDados
*/
public PacoteDados getPacoteDados()
{
return pacoteDados;
}
/**
* @param pacoteDados the pacoteDados to set
*/
public void setPacoteDados(PacoteDados pacoteDados)
{
this.pacoteDados = pacoteDados;
}
/**
* @return the tipoSaldo
*/
public TipoSaldo getTipoSaldo()
{
return tipoSaldo;
}
/**
* @param tipoSaldo the tipoSaldo to set
*/
public void setTipoSaldo(TipoSaldo tipoSaldo)
{
this.tipoSaldo = tipoSaldo;
}
public boolean equals(Object obj)
{
if(!(obj instanceof OfertaPacoteDados))
return false;
return ((OfertaPacoteDados)obj).getIdtOferta() == idtOferta;
}
public String toString()
{
return "ID:" + idtOferta;
}
public int compareTo(Object obj)
{
if(!(obj instanceof OfertaPacoteDados))
throw new IllegalArgumentException();
return this.idtOferta - ((OfertaPacoteDados)obj).getIdtOferta();
}
/**
* Retorna o hash do objeto.
*
* @return int Hash do objeto.
*/
public int hashCode()
{
StringBuffer result = new StringBuffer();
result.append(this.getClass().getName());
result.append("||");
result.append(this.idtOferta);
return result.toString().hashCode();
}
/**
* Retorna uma nova instancia do mesmo objeto
*
*/
public Object clone()
{
OfertaPacoteDados oferta = new OfertaPacoteDados();
oferta.setIdtOferta(this.idtOferta);
oferta.setPacoteDados(this.pacoteDados);
oferta.setDataCadastro(this.dataCadastro);
oferta.setDataInicioOferta(this.dataInicioOferta);
oferta.setEnviaBroadcast(this.enviaBroadcast);
oferta.setAssinantes(this.assinantes);
return oferta;
}
/**
* @return the desOferta
*/
public String getDesOferta()
{
return desOferta;
}
/**
* @param desOferta the desOferta to set
*/
public void setDesOferta(String desOferta)
{
this.desOferta = desOferta;
}
} | [
"[email protected]"
] | |
92a972b60ccb2bd4fcb0b07970f6a72ae8e088f8 | 5c264e9d534084091eef3bd96c76edad5277279c | /Hacking/src/hacking/main/files/Program.java | 14e896f3dfe1fa320a337639485c6f74a61bbedf | [] | no_license | Reecer9714/EclipseWorkspace | 22b1c7269b689390e89a2556944bf7323bd97525 | 16346bda7943c0dc1b5e7fbd56439c8b96a91f07 | refs/heads/master | 2021-01-23T05:03:43.637859 | 2019-03-03T03:10:11 | 2019-03-03T03:10:11 | 86,269,773 | 0 | 0 | null | 2018-04-13T21:48:55 | 2017-03-26T22:38:01 | Java | UTF-8 | Java | false | false | 1,273 | java | package hacking.main.files;
import hacking.main.GUIGame;
import hacking.main.programs.gui.GUIProgram;
public abstract class Program extends File{
private double version;
protected GUIProgram guiProgram;
//TODO: Figure out if these constructors are even necessary
public Program(GUIGame g, String n){
this(g, n, null, g.getMyComputer().getMainDrive().getDir().getFolder("Programs"));
}
public Program(GUIGame g, String n, GUIProgram p){
this(g, n, p, g.getMyComputer().getMainDrive().getDir().getFolder("Programs"));
}
public Program(GUIGame g, String n, Folder f){
this(g, n, null, f);
}
public Program(GUIGame g, String n, GUIProgram p, Folder f){
super(g, n, f);
this.version = 1.0;
this.ext = ".exe";
this.guiProgram = p;
f.addFile(this);
}
public double getVersion(){
return version;
}
public void upgradeVersion(){
this.version += 0.1;
}
protected void setVersion(double v){
this.version = v;
}
//Open GUI
@Override
public void open(){
if(guiProgram != null){
//open the program
guiProgram.run();
}else{
//open terminal
//tell terminal this program is running and hand over control
//run program
run();
}
}
//Used for taking over terminal control
public abstract void run();
}
| [
"[email protected]"
] | |
009bc565b5615702d5b6113345e63497d43b3eb3 | 86cd55855a94884d1c80a96629dadca819b9d0e2 | /Advance_lesson_16_Spring_Core/src/main/java/ua/lviv/lgs/application/CustomConfiguration.java | 8d1e2ac16ba1c6d0722d2002ffdf421993114a3b | [] | no_license | DimaLishchyshyn/Java_Advance_practice | fe78a8aa3465941a350390dc81e6b293a2aca280 | 8e2928e451937845886c2d30ba055b2b3afeb07a | refs/heads/master | 2022-06-24T16:06:32.845318 | 2020-04-04T18:32:03 | 2020-04-04T18:32:03 | 253,046,198 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 635 | java | package ua.lviv.lgs.application;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import ua.lviv.lgs.dao.StudentDao;
import ua.lviv.lgs.dao.impl.StudentDaoImpl;
import ua.lviv.lgs.domion.Student;
@Configuration
public class CustomConfiguration {
@Bean(name = "studentDao")
public StudentDao getStudentDao() {
StudentDao studentDao = new StudentDaoImpl();
return studentDao;
}
@Bean(name = "student")
public Student getStudent() {
Student student = new Student();
student.setId(1);
student.setName("Dima");
student.setAge(30);
return student;
}
} | [
"[email protected]"
] | |
7544ae65f410db1e288c293327f57905f3d7c88d | 8fe347a4e6af54c7698dc83735146b31d8f930a2 | /src/main/java/com/bjtu/websystem/config/MybatisPlusConfig.java | 89ee11aadb61e17dd8bb0b7d0272e418a37366db | [] | no_license | nekle/backend_jiaotongSystem | 028c14bec5ebf193468190193321ca7c155ce4d8 | 6c4ab32ff269ea4923195ea5d1c41503ca01cd02 | refs/heads/master | 2023-04-09T01:06:49.650263 | 2021-04-15T09:47:34 | 2021-04-15T09:47:34 | 354,337,159 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,337 | java | package com.bjtu.websystem.config;
/**
* @author Nekkl
* @version 1.0
* @description: TODO
* @date 2021/4/7 20:37
*/
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MybatisPlusConfig {
/**
* 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除)
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
paginationInnerInterceptor.setDbType(DbType.MYSQL);
paginationInnerInterceptor.setOverflow(true);
interceptor.addInnerInterceptor(paginationInnerInterceptor);
return interceptor;
}
@Bean
public ConfigurationCustomizer configurationCustomizer() {
return configuration -> configuration.setUseDeprecatedExecutor(false);
}
}
| [
"[email protected]"
] | |
b00fdbc6220bd1e3b4365e862f04f86d6db22e7d | d5f3977967509ca21a2f3ddf585a1c49b6870066 | /2016-07-08/RMI/Evening.java | 08a0b3bd42c2552042ecbaffcaf34d547fe254d8 | [] | no_license | zsimo93/MW_examsEX | a39d5693822b3376cfd0eb2ba41e16406ff9e22c | 2435c1ee3d0f4f68fe447ae122c518142f874865 | refs/heads/master | 2021-01-19T10:32:35.201673 | 2017-02-16T18:10:33 | 2017-02-16T18:10:33 | 82,190,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 505 | java | package RMI1;
import java.util.Date;
import java.util.List;
public class Evening {
private Date date;
private List<String> tables;
private int remSeats;
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public List<String> getTables() {
return tables;
}
public void setTables(List<String> tables) {
this.tables = tables;
}
public int getRemSeats() {
return remSeats;
}
public void decrRem() {
this.remSeats = remSeats-2;
}
}
| [
"[email protected]"
] | |
8f17a73cc0b507a2292cbb8a1625c254bd58ba23 | 1e6657ab4aa53cf969c8d935937eb1e87491deb5 | /src/main/java/com/petanikode/cobamaven/Main.java | b4aab8a26fc833aff11148d83c13f7bc21912369 | [] | no_license | petanikode/java-gson-example | f641a1c60f8f735c9b0ecec348afed78d33d3378 | 3d90e8437136bd26f030ecccc1b3ee4d39e90781 | refs/heads/master | 2021-05-09T10:36:55.585955 | 2018-01-25T21:16:44 | 2018-01-25T21:16:44 | 118,968,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,577 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.petanikode.cobamaven;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
/**
*
* @author petanikode
*/
public class Main {
public static void main(String[] args) {
User mUser = new User("Petani Kode", "[email protected]", 22);
// ubah objek menjadi string JSON
Gson gson = new Gson();
String jsonUser = gson.toJson(mUser);
System.out.println(jsonUser);
// ubah string JSON menjadi Objek
Gson gsonBuilder = new GsonBuilder().create();
User myUser = gsonBuilder.fromJson(jsonUser, User.class);
System.out.println(myUser.name);
// deserialisasi data JSON dari Webservice
try {
String jsonWeb = getJson("https://api.github.com/users/petanikode");
GithubUser gitUser = gson.fromJson(jsonWeb, GithubUser.class);
System.out.println("Hasil deserialisasi dari Webservice: ");
System.out.println(gitUser.name);
System.out.println(gitUser.email);
System.out.println(gitUser.blog);
System.out.println(gitUser.location);
System.out.println(gitUser.html_url);
} catch (Exception e) {
System.out.println("Terjadi masalah: " + e.getMessage());
}
}
public static String getJson(String url) throws Exception {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
// add request header
request.addHeader("User-Agent", "Mozilla/5.0");
HttpResponse response = client.execute(request);
System.out.println("\nSending 'GET' request to URL : " + url);
System.out.println("Response Code : "
+ response.getStatusLine().getStatusCode());
BufferedReader rd = new BufferedReader(
new InputStreamReader(response.getEntity().getContent()));
StringBuffer result = new StringBuffer();
String line = "";
while ((line = rd.readLine()) != null) {
result.append(line);
}
return result.toString();
}
}
| [
"[email protected]"
] | |
06bf081b57791f2fb3344f92aae28eefd2624e29 | f27883bf0aeb2c65c1ea00035aea01059d2d5b37 | /src/test/java/ru/patterns/creational/factory/FactoryTest.java | 7bb95355defe5b727c0ed79d2bc38c23929d56bd | [
"Apache-2.0"
] | permissive | Sir-Hedgehog/design_patterns | 27e73fa83305d3cab903cabee110662379c7d433 | c2b3d3355ad6d5e6d487c89a2705f3cbc09a662e | refs/heads/main | 2023-05-29T03:55:02.590804 | 2021-06-02T20:15:10 | 2021-06-02T20:15:10 | 300,958,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,365 | java | package ru.patterns.creational.factory;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* @author Sir-Hedgehog (mailto:[email protected])
* @version 1.0
* @since 03.10.2020
*/
public class FactoryTest {
@Test
public void checkSpecialtyOfFootballPlayerInSportsAcademy() {
FilterOfSpecialty filterOfSpecialty = new FilterOfSpecialty();
SportsAcademy academy = filterOfSpecialty.filter("football");
Sportsman sportsman = academy.preparesSportsman();
assertEquals(sportsman.sport(), "Football player kicks ball into the goal!");
}
@Test
public void checkSpecialtyOfBasketballPlayerInSportsAcademy() {
FilterOfSpecialty filterOfSpecialty = new FilterOfSpecialty();
SportsAcademy academy = filterOfSpecialty.filter("basketball");
Sportsman sportsman = academy.preparesSportsman();
assertEquals(sportsman.sport(), "Basketball player throws ball into the ring!");
}
@Test
public void checkUnknownSpecialtyOfPlayerInSportsAcademy() {
FilterOfSpecialty filterOfSpecialty = new FilterOfSpecialty();
try {
filterOfSpecialty.filter("tennis");
} catch (RuntimeException expected) {
assertEquals("Our sports academy doesn't prepare sportsmen of such type", expected.getMessage());
}
}
}
| [
"mailto:[email protected]"
] | mailto:[email protected] |
cef82ce9ec6d30c372c13ebdbefa9322908ea71f | 52614e6c6b7bd25c24e77fb149a502754973f38d | /src/web_basic/html_ch04/urlEmailTelServlet.java | 0469b8a163ea1aa944bc9a0f1ee7db5f275a1217 | [] | no_license | SurinJeon/web_basic | c2fbd125108dd52daeea5b43f248fdb5cbc45fa4 | 25ed58e810c1809d39319463389d0aa17b441c57 | refs/heads/master | 2023-04-10T03:14:39.340482 | 2021-04-08T07:42:59 | 2021-04-08T07:42:59 | 350,625,920 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,444 | java | package web_basic.html_ch04;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/html_ch04/urlEmailTelServlet")
public class urlEmailTelServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
process(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html; charset = utf-8");
PrintWriter out = response.getWriter();
String id = request.getParameter("id");
String passwd = request.getParameter("passwd");
String passwdConfirm = request.getParameter("passwdConfirm");
String name = request.getParameter("userName");
String email = request.getParameter("email");
String tel = request.getParameter("tel");
String url = request.getParameter("sns");
String member = request.getParameter("member");
String stuff = request.getParameter("stuff");
String satis = request.getParameter("satis");
String subject = request.getParameter("subject");
String[] mailing = request.getParameterValues("mailing");
String color = request.getParameter("color");
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String startstr = request.getParameter("start");
int startYear = Integer.parseInt(startstr.substring(0, 4));
int startMonth = Integer.parseInt(startstr.substring(5, 7));
int startDate = Integer.parseInt(startstr.substring(8, 10));
Date start = new Date(startYear - 1900, startMonth - 1, startDate);
String startFormat = format.format(start);
String endstr = request.getParameter("end");
int endYear = Integer.parseInt(endstr.substring(0, 4));
int endMonth = Integer.parseInt(endstr.substring(5, 7));
int endDate = Integer.parseInt(endstr.substring(8, 10));
Date end = new Date(endYear - 1900, endMonth - 1, endDate);
String endFormat = format.format(end);
DateTimeFormatter format2 = DateTimeFormatter.ofPattern("hh:mm:ss");
String startTime1 = request.getParameter("startTime1"); //11:00
int startHour = Integer.parseInt(startTime1.substring(0, 2));
int startMinute = Integer.parseInt(startTime1.substring(3, 5));
LocalTime startTime = LocalTime.of(startHour, startMinute, 00);
String endTime1 = request.getParameter("endTime1");
int endHour = Integer.parseInt(endTime1.substring(0, 2));
int endMinute = Integer.parseInt(endTime1.substring(3, 5));
LocalTime endTime = LocalTime.of(endHour, endMinute, 00);
switch(subject){
case "grm":
subject = "문법";
break;
case "wr":
subject = "작문";
break;
case "rd":
subject = "독해";
break;
}
for(int i = 0; i < mailing.length; i++) {
switch(mailing[i]) {
case "news":
mailing[i] = "해외 단신";
break;
case "dialog":
mailing[i] = "5분 회화";
break;
case "pops":
mailing[i] = "모닝팝스";
break;
}
}
boolean isCorrect;
if(passwd.equals(passwdConfirm)) {
isCorrect = true;
} else {
isCorrect = false;
}
out.println("<h1>" + "가입정보" + "</h1>" + "<br>");
out.println("id: " + id + "<br>");
out.println("password 일치 여부: " + isCorrect + "<br>");
out.println("name: " + name + "<br>");
out.println("email: " + email + "<br>");
out.println("tel: " + tel + "<br>");
out.println("sns: " + url + "<br>");
out.println("<hr>");
out.println("<h1>" + "등록정보" + "</h1>" + "<br>");
out.println("member: " + member + "<br>");
out.println("stuff: " + stuff + "<br>");
out.println("satis: " + satis + "<br>"); // 안 넘어옴..
out.println("<hr>");
out.println("<h1>" + "신청과목" + "</h1>" + "<br>");
out.println("subject: " + subject + "<br>");
out.println("<hr>");
out.println("<h1>" + "메일링" + "</h1>" + "<br>");
out.println("mailing: " + Arrays.toString(mailing) + "<br>");
// System.out.println(Arrays.toString(mailing));
out.println("<hr>");
out.println("<h1>" + "선호색상" + "</h1>" + "<br>");
out.println("color: " + color + "<br>");
out.println("<hr>");
out.println("<h1>" + "조회기간" + "</h1>" + "<br>");
out.println(startFormat + " to " + endFormat);
// out.println(endDay.toString());
out.println("<hr>");
out.println("<h1>" + "대관 시간" + "</h1>" + "<br>");
// out.println(start + " to " + end);
out.println(startTime + "<br>");
out.println(endTime);
out.println();
out.println();
out.println();
}
}
| [
"[email protected]"
] | |
4d237fe28ed2d3c1140e1baeae902e0f3544532c | fdb345f7ec8b45f0bba5eb2d0c5ddee596283242 | /src/main/java/Mendix/api/Recipe.java | 37560a07e0a96f31649210046aeb5485a48167a0 | [] | no_license | Dimmen/recipes | 3d58818a0966ae7eb657f7760ac99c7507802870 | 0e44ea6f83bbbd5e3b1c189ea7125bb846cd0351 | refs/heads/master | 2020-03-26T18:50:29.425989 | 2018-08-23T18:51:30 | 2018-08-23T18:51:30 | 145,233,878 | 0 | 0 | null | 2018-08-22T04:35:06 | 2018-08-18T16:07:22 | HTML | UTF-8 | Java | false | false | 1,105 | java | package Mendix.api;
import Mendix.db.RecipeId;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
public class Recipe {
@NotNull
@Valid
private Head head;
@NotNull
private Ingredients ingredients;
@NotNull
private Directions directions;
public Recipe(){
}
public Recipe(Head head , Ingredients ingredients , Directions directions){
this.head = head;
this.ingredients = ingredients;
this.directions = directions;
}
public Head getHead() {
return head;
}
public void setHead(Head head) {
this.head = head;
}
public Ingredients getIngredients() {
return ingredients;
}
public void setIngredients(Ingredients ingredients) {
this.ingredients = ingredients;
}
public Directions getDirections() {
return directions;
}
public void setDirections(Directions directions) {
this.directions = directions;
}
public RecipeId generateRecipeId(){
return new RecipeId(head.getTitle());
}
} | [
"[email protected]"
] | |
1462e1662b46ae5bba82fef7273d3faaa4d30785 | deb452b74aabead6d12b928a70fc3df6fc37219b | /src/jjava/ASTPrimaryExpression.java | 9f9f670f4bb67fd2911de59462d2a33af7c16bfc | [] | no_license | johnmwai/Joomla-Extension-Factory | 62360aca53d88982895a6f9951bb1520d064c62a | e0b3ae91ad8e5467a4e6452bd1b0f6c150513223 | refs/heads/master | 2021-01-25T05:57:00.905452 | 2017-02-02T11:39:17 | 2017-02-02T11:39:17 | 80,710,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 913 | java | /* Generated By:JJTree: Do not edit this line. ASTPrimaryExpression.java Version 4.3 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=true,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=*,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package jjava;
public
class ASTPrimaryExpression extends SimpleNode {
public ASTPrimaryExpression(int id) {
super(id);
}
public ASTPrimaryExpression(JavaParser p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTPrimaryExpression(id);
}
public static Node jjtCreate(JavaParser p, int id) {
return new ASTPrimaryExpression(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}
/* JavaCC - OriginalChecksum=42a3b0aad7ef4c93cd65b33f7ad09a6e (do not edit this line) */
| [
"[email protected]"
] | |
ef8b6900b23d769a9f46da521a4e89926e3ea4c0 | 00e16bdca9f82b7edcb80af795f229620e1164c7 | /src/main/java/com.fuwenhao/interviewTest/NioDemo/NioSocketDemoTest.java | 3ff62049d58015ba541cff2cd4f957a2aed85b38 | [] | no_license | fwh666/fwh | 5cae8bed1de054d301332f590cdf3133cd5077a8 | 87dc67ca4799358a45d93d5db6bf4a8072b29ae6 | refs/heads/master | 2021-07-09T02:58:27.973779 | 2018-12-19T09:51:27 | 2018-12-19T09:51:27 | 132,687,330 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,670 | java | package com.fuwenhao.interviewTest.NioDemo;
import org.junit.Test;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.Iterator;
/**
* create by fwh on 2018/5/24 下午9:59
* 描述:
* nio高性能编程
*/
public class NioSocketDemoTest {
private Selector selector;//通道选择器(管理器)
/**
* 初始化端口
*/
public void initServer(int port) throws IOException {
ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();
serverSocketChannel.configureBlocking(false);//设置为非阻塞模式
serverSocketChannel.socket().bind(new InetSocketAddress(port));//设置通讯地址
this.selector = Selector.open();//开启服务
serverSocketChannel.register(selector, SelectionKey.OP_ACCEPT);//注册开放的服务端
System.out.println("服务端已经启动");
System.out.printf("测试展示效果:%s", selector);
}
/**
* 客户端监听
*/
public void listennerSlector() throws IOException, InterruptedException {
//轮询监听器
while (true) {
//等待客户端连接 //select模型,多路复用
this.selector.select();
//select()方法在将线程置于睡眠状态,直到这些感兴趣的事情中的操作中的一个发生或者 10 秒钟的时间过去。
selector.select(10000);//此处设置超过多久时间后会抛出异常。
System.out.println("有新的客户请求发过来了");
Iterator<SelectionKey> iterKey = this.selector.selectedKeys().iterator();
while (iterKey.hasNext()) {
SelectionKey key = iterKey.next();
iterKey.remove();
//处理请求
handler(key);
}
}
}
/**
* 处理客户端请求
*
* @param key
*/
public void handler(SelectionKey key) throws IOException {
if (key.isAcceptable()) {
//处理客户端连接请求
ServerSocketChannel serverSocketChannel = (ServerSocketChannel) key.channel();
SocketChannel socketChannel = serverSocketChannel.accept();
socketChannel.configureBlocking(false);//注意:此处要把接收端设置为非阻塞状态。
//接收客户端发送的消息时,需要给通道设置权限
socketChannel.register(selector, SelectionKey.OP_READ);//注意:此处选择为可读的,要了解其他的几种状态。
} else if (key.isReadable()) {
//处理读事件
SocketChannel socketChannel = (SocketChannel) key.channel();
ByteBuffer byteBuffer = ByteBuffer.allocate(1024);//设置存储值大小
int read = socketChannel.read(byteBuffer);//读取数据用于判断
if (read > 0) {//说明有数据
String info = new String(byteBuffer.array(), "gbk").trim();
System.out.println("服务端读取的信息为:" + info);
} else { //没有数据
System.out.println("客户端关闭了");
key.cancel();//关闭客户端
}
}
}
@Test
public void testNioDemo() throws IOException, InterruptedException {
NioSocketDemoTest nioSocketDemoTest = new NioSocketDemoTest();
nioSocketDemoTest.initServer(8888);
nioSocketDemoTest.listennerSlector();
}
}
| [
""
] | |
e67e917fea8be8b7676d2e91bea5fa88a4c6f509 | 92061aae80206f826a25296ece6ed56aaffe236f | /src/main/java/com/jianglibo/vaadin/dashboard/repositories/BoxRepository.java | fba56c363cff0cc42814e77819bebad68e69090d | [] | no_license | jwangkun/easyinstaller | 3132abb8ccd98092628c04b32aaadd3cabde1254 | 470a02a12c67d7dfc0ddc3aa0bf832adf8a64c5f | refs/heads/master | 2021-01-12T13:07:35.868641 | 2016-10-27T13:03:57 | 2016-10-27T13:03:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,101 | java | package com.jianglibo.vaadin.dashboard.repositories;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import com.jianglibo.vaadin.dashboard.domain.Box;
@RepositoryRestResource(collectionResourceRel = "boxs", path = "boxs")
public interface BoxRepository extends JpaRepository<Box, Long>, BoxRepositoryCustom<Box>,
JpaSpecificationExecutor<Box>, RepositoryCommonMethod<Box> {
Page<Box> findByArchivedEquals(boolean trashed, Pageable pageable);
long countByArchivedEquals(boolean trashed);
Page<Box> findByIpContainingIgnoreCaseOrDescriptionContainingIgnoreCaseAndArchivedEquals(String filterStr,
String filterStr2, boolean trashed, Pageable pageable);
long countByIpContainingIgnoreCaseOrDescriptionContainingIgnoreCaseAndArchivedEquals(String filterStr,
String filterStr2, boolean trashed);
Box findByIp(String string);
}
| [
"[email protected]"
] | |
1fab534f1bb3c4d5a5bb6c432a4198816738be66 | 00691c1f887c2dc2f85d90440368e596e32b307a | /n00bctf18/rev_apk/sources/android/support/v7/app/AlertDialog.java | dc7b48f27a5ca7d8c145a61131c95853b2e78344 | [] | no_license | aman589/2018-ctfs-chall-and-sol | d11cad09447dc55062747d667b5f1393faa65bcf | 888d79243155085523899267c594028fb4208b34 | refs/heads/master | 2020-08-09T22:30:21.067835 | 2019-10-10T13:52:55 | 2019-10-10T13:52:55 | 214,190,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,407 | java | package android.support.v7.app;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnDismissListener;
import android.content.DialogInterface.OnKeyListener;
import android.content.DialogInterface.OnMultiChoiceClickListener;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Message;
import android.support.annotation.ArrayRes;
import android.support.annotation.AttrRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.annotation.RestrictTo.Scope;
import android.support.annotation.StringRes;
import android.support.annotation.StyleRes;
import android.support.v7.app.AlertController.AlertParams;
import android.support.v7.appcompat.R;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
public class AlertDialog extends AppCompatDialog implements DialogInterface {
static final int LAYOUT_HINT_NONE = 0;
static final int LAYOUT_HINT_SIDE = 1;
final AlertController mAlert;
public static class Builder {
private final AlertParams P;
private final int mTheme;
public Builder(@NonNull Context context) {
this(context, AlertDialog.resolveDialogTheme(context, 0));
}
public Builder(@NonNull Context context, @StyleRes int themeResId) {
this.P = new AlertParams(new ContextThemeWrapper(context, AlertDialog.resolveDialogTheme(context, themeResId)));
this.mTheme = themeResId;
}
@NonNull
public Context getContext() {
return this.P.mContext;
}
public Builder setTitle(@StringRes int titleId) {
this.P.mTitle = this.P.mContext.getText(titleId);
return this;
}
public Builder setTitle(@Nullable CharSequence title) {
this.P.mTitle = title;
return this;
}
public Builder setCustomTitle(@Nullable View customTitleView) {
this.P.mCustomTitleView = customTitleView;
return this;
}
public Builder setMessage(@StringRes int messageId) {
this.P.mMessage = this.P.mContext.getText(messageId);
return this;
}
public Builder setMessage(@Nullable CharSequence message) {
this.P.mMessage = message;
return this;
}
public Builder setIcon(@DrawableRes int iconId) {
this.P.mIconId = iconId;
return this;
}
public Builder setIcon(@Nullable Drawable icon) {
this.P.mIcon = icon;
return this;
}
public Builder setIconAttribute(@AttrRes int attrId) {
TypedValue out = new TypedValue();
this.P.mContext.getTheme().resolveAttribute(attrId, out, true);
this.P.mIconId = out.resourceId;
return this;
}
public Builder setPositiveButton(@StringRes int textId, OnClickListener listener) {
this.P.mPositiveButtonText = this.P.mContext.getText(textId);
this.P.mPositiveButtonListener = listener;
return this;
}
public Builder setPositiveButton(CharSequence text, OnClickListener listener) {
this.P.mPositiveButtonText = text;
this.P.mPositiveButtonListener = listener;
return this;
}
public Builder setNegativeButton(@StringRes int textId, OnClickListener listener) {
this.P.mNegativeButtonText = this.P.mContext.getText(textId);
this.P.mNegativeButtonListener = listener;
return this;
}
public Builder setNegativeButton(CharSequence text, OnClickListener listener) {
this.P.mNegativeButtonText = text;
this.P.mNegativeButtonListener = listener;
return this;
}
public Builder setNeutralButton(@StringRes int textId, OnClickListener listener) {
this.P.mNeutralButtonText = this.P.mContext.getText(textId);
this.P.mNeutralButtonListener = listener;
return this;
}
public Builder setNeutralButton(CharSequence text, OnClickListener listener) {
this.P.mNeutralButtonText = text;
this.P.mNeutralButtonListener = listener;
return this;
}
public Builder setCancelable(boolean cancelable) {
this.P.mCancelable = cancelable;
return this;
}
public Builder setOnCancelListener(OnCancelListener onCancelListener) {
this.P.mOnCancelListener = onCancelListener;
return this;
}
public Builder setOnDismissListener(OnDismissListener onDismissListener) {
this.P.mOnDismissListener = onDismissListener;
return this;
}
public Builder setOnKeyListener(OnKeyListener onKeyListener) {
this.P.mOnKeyListener = onKeyListener;
return this;
}
public Builder setItems(@ArrayRes int itemsId, OnClickListener listener) {
this.P.mItems = this.P.mContext.getResources().getTextArray(itemsId);
this.P.mOnClickListener = listener;
return this;
}
public Builder setItems(CharSequence[] items, OnClickListener listener) {
this.P.mItems = items;
this.P.mOnClickListener = listener;
return this;
}
public Builder setAdapter(ListAdapter adapter, OnClickListener listener) {
this.P.mAdapter = adapter;
this.P.mOnClickListener = listener;
return this;
}
public Builder setCursor(Cursor cursor, OnClickListener listener, String labelColumn) {
this.P.mCursor = cursor;
this.P.mLabelColumn = labelColumn;
this.P.mOnClickListener = listener;
return this;
}
public Builder setMultiChoiceItems(@ArrayRes int itemsId, boolean[] checkedItems, OnMultiChoiceClickListener listener) {
this.P.mItems = this.P.mContext.getResources().getTextArray(itemsId);
this.P.mOnCheckboxClickListener = listener;
this.P.mCheckedItems = checkedItems;
this.P.mIsMultiChoice = true;
return this;
}
public Builder setMultiChoiceItems(CharSequence[] items, boolean[] checkedItems, OnMultiChoiceClickListener listener) {
this.P.mItems = items;
this.P.mOnCheckboxClickListener = listener;
this.P.mCheckedItems = checkedItems;
this.P.mIsMultiChoice = true;
return this;
}
public Builder setMultiChoiceItems(Cursor cursor, String isCheckedColumn, String labelColumn, OnMultiChoiceClickListener listener) {
this.P.mCursor = cursor;
this.P.mOnCheckboxClickListener = listener;
this.P.mIsCheckedColumn = isCheckedColumn;
this.P.mLabelColumn = labelColumn;
this.P.mIsMultiChoice = true;
return this;
}
public Builder setSingleChoiceItems(@ArrayRes int itemsId, int checkedItem, OnClickListener listener) {
this.P.mItems = this.P.mContext.getResources().getTextArray(itemsId);
this.P.mOnClickListener = listener;
this.P.mCheckedItem = checkedItem;
this.P.mIsSingleChoice = true;
return this;
}
public Builder setSingleChoiceItems(Cursor cursor, int checkedItem, String labelColumn, OnClickListener listener) {
this.P.mCursor = cursor;
this.P.mOnClickListener = listener;
this.P.mCheckedItem = checkedItem;
this.P.mLabelColumn = labelColumn;
this.P.mIsSingleChoice = true;
return this;
}
public Builder setSingleChoiceItems(CharSequence[] items, int checkedItem, OnClickListener listener) {
this.P.mItems = items;
this.P.mOnClickListener = listener;
this.P.mCheckedItem = checkedItem;
this.P.mIsSingleChoice = true;
return this;
}
public Builder setSingleChoiceItems(ListAdapter adapter, int checkedItem, OnClickListener listener) {
this.P.mAdapter = adapter;
this.P.mOnClickListener = listener;
this.P.mCheckedItem = checkedItem;
this.P.mIsSingleChoice = true;
return this;
}
public Builder setOnItemSelectedListener(OnItemSelectedListener listener) {
this.P.mOnItemSelectedListener = listener;
return this;
}
public Builder setView(int layoutResId) {
this.P.mView = null;
this.P.mViewLayoutResId = layoutResId;
this.P.mViewSpacingSpecified = false;
return this;
}
public Builder setView(View view) {
this.P.mView = view;
this.P.mViewLayoutResId = 0;
this.P.mViewSpacingSpecified = false;
return this;
}
@RestrictTo({Scope.LIBRARY_GROUP})
@Deprecated
public Builder setView(View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight, int viewSpacingBottom) {
this.P.mView = view;
this.P.mViewLayoutResId = 0;
this.P.mViewSpacingSpecified = true;
this.P.mViewSpacingLeft = viewSpacingLeft;
this.P.mViewSpacingTop = viewSpacingTop;
this.P.mViewSpacingRight = viewSpacingRight;
this.P.mViewSpacingBottom = viewSpacingBottom;
return this;
}
@Deprecated
public Builder setInverseBackgroundForced(boolean useInverseBackground) {
this.P.mForceInverseBackground = useInverseBackground;
return this;
}
@RestrictTo({Scope.LIBRARY_GROUP})
public Builder setRecycleOnMeasureEnabled(boolean enabled) {
this.P.mRecycleOnMeasure = enabled;
return this;
}
public AlertDialog create() {
AlertDialog dialog = new AlertDialog(this.P.mContext, this.mTheme);
this.P.apply(dialog.mAlert);
dialog.setCancelable(this.P.mCancelable);
if (this.P.mCancelable) {
dialog.setCanceledOnTouchOutside(true);
}
dialog.setOnCancelListener(this.P.mOnCancelListener);
dialog.setOnDismissListener(this.P.mOnDismissListener);
if (this.P.mOnKeyListener != null) {
dialog.setOnKeyListener(this.P.mOnKeyListener);
}
return dialog;
}
public AlertDialog show() {
AlertDialog dialog = create();
dialog.show();
return dialog;
}
}
protected AlertDialog(@NonNull Context context) {
this(context, 0);
}
protected AlertDialog(@NonNull Context context, @StyleRes int themeResId) {
super(context, resolveDialogTheme(context, themeResId));
this.mAlert = new AlertController(getContext(), this, getWindow());
}
protected AlertDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
this(context, 0);
setCancelable(cancelable);
setOnCancelListener(cancelListener);
}
static int resolveDialogTheme(@NonNull Context context, @StyleRes int resid) {
if (((resid >>> 24) & 255) >= 1) {
return resid;
}
TypedValue outValue = new TypedValue();
context.getTheme().resolveAttribute(R.attr.alertDialogTheme, outValue, true);
return outValue.resourceId;
}
public Button getButton(int whichButton) {
return this.mAlert.getButton(whichButton);
}
public ListView getListView() {
return this.mAlert.getListView();
}
public void setTitle(CharSequence title) {
super.setTitle(title);
this.mAlert.setTitle(title);
}
public void setCustomTitle(View customTitleView) {
this.mAlert.setCustomTitle(customTitleView);
}
public void setMessage(CharSequence message) {
this.mAlert.setMessage(message);
}
public void setView(View view) {
this.mAlert.setView(view);
}
public void setView(View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight, int viewSpacingBottom) {
this.mAlert.setView(view, viewSpacingLeft, viewSpacingTop, viewSpacingRight, viewSpacingBottom);
}
@RestrictTo({Scope.LIBRARY_GROUP})
void setButtonPanelLayoutHint(int layoutHint) {
this.mAlert.setButtonPanelLayoutHint(layoutHint);
}
public void setButton(int whichButton, CharSequence text, Message msg) {
this.mAlert.setButton(whichButton, text, null, msg);
}
public void setButton(int whichButton, CharSequence text, OnClickListener listener) {
this.mAlert.setButton(whichButton, text, listener, null);
}
public void setIcon(int resId) {
this.mAlert.setIcon(resId);
}
public void setIcon(Drawable icon) {
this.mAlert.setIcon(icon);
}
public void setIconAttribute(int attrId) {
TypedValue out = new TypedValue();
getContext().getTheme().resolveAttribute(attrId, out, true);
this.mAlert.setIcon(out.resourceId);
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.mAlert.installContent();
}
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (this.mAlert.onKeyDown(keyCode, event)) {
return true;
}
return super.onKeyDown(keyCode, event);
}
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (this.mAlert.onKeyUp(keyCode, event)) {
return true;
}
return super.onKeyUp(keyCode, event);
}
}
| [
"[email protected]"
] | |
ec02068fe74232b53a9f29a79d084dc6f5a7890b | e7ca3a996490d264bbf7e10818558e8249956eda | /aliyun-java-sdk-ons/src/main/java/com/aliyuncs/ons/model/v20170918/OnsMqttQueryHistoryOnlineResponse.java | 8aaf4f2694466d36be3d984910adedc0ae94dc40 | [
"Apache-2.0"
] | permissive | AndyYHL/aliyun-openapi-java-sdk | 6f0e73f11f040568fa03294de2bf9a1796767996 | 15927689c66962bdcabef0b9fc54a919d4d6c494 | refs/heads/master | 2020-03-26T23:18:49.532887 | 2018-08-21T04:12:23 | 2018-08-21T04:12:23 | 145,530,169 | 1 | 0 | null | 2018-08-21T08:14:14 | 2018-08-21T08:14:13 | null | UTF-8 | Java | false | false | 2,610 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.ons.model.v20170918;
import java.util.List;
import com.aliyuncs.AcsResponse;
import com.aliyuncs.ons.transform.v20170918.OnsMqttQueryHistoryOnlineResponseUnmarshaller;
import com.aliyuncs.transform.UnmarshallerContext;
/**
* @author auto create
* @version
*/
public class OnsMqttQueryHistoryOnlineResponse extends AcsResponse {
private String requestId;
private String helpUrl;
private Data data;
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public String getHelpUrl() {
return this.helpUrl;
}
public void setHelpUrl(String helpUrl) {
this.helpUrl = helpUrl;
}
public Data getData() {
return this.data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
private String title;
private String xUnit;
private String yUnit;
private List<StatsDataDo> records;
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public String getXUnit() {
return this.xUnit;
}
public void setXUnit(String xUnit) {
this.xUnit = xUnit;
}
public String getYUnit() {
return this.yUnit;
}
public void setYUnit(String yUnit) {
this.yUnit = yUnit;
}
public List<StatsDataDo> getRecords() {
return this.records;
}
public void setRecords(List<StatsDataDo> records) {
this.records = records;
}
public static class StatsDataDo {
private Long x;
private Float y;
public Long getX() {
return this.x;
}
public void setX(Long x) {
this.x = x;
}
public Float getY() {
return this.y;
}
public void setY(Float y) {
this.y = y;
}
}
}
@Override
public OnsMqttQueryHistoryOnlineResponse getInstance(UnmarshallerContext context) {
return OnsMqttQueryHistoryOnlineResponseUnmarshaller.unmarshall(this, context);
}
}
| [
"[email protected]"
] | |
5ddd297a4a7dc53cee1395ced30f3527812a5811 | f8a63602e441b8cbc57b7e51cd9b287b9783bae1 | /GOSSIP/sorgenti/threads/StatusManager.java | e8ea32fa987dac3463791dc5b528756208a29169 | [] | no_license | Andrea-V/-RCL-GOSSIP | 18e77a11644b550d8f7438d84f615bf32952d373 | 5cc2f6f7a8e0a20fb9b14a22d5e600023b1d381c | refs/heads/master | 2021-05-02T15:57:23.535731 | 2016-11-01T19:52:52 | 2016-11-01T19:52:52 | 72,570,754 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 2,949 | java | package threads;
import java.io.ObjectInputStream;
import java.net.Socket;
import java.net.SocketException;
import java.util.Enumeration;
import java.util.concurrent.ConcurrentHashMap;
import interfaces.GossipCallbacks;
import main.RegistryServer;
import main.User;
import utils.Const;
import utils.Contact;
import utils.StatusMessage;
/**
* Thread invocato da TcpListener, processa uno StatusMessage,
* aggiornando lo stato del RegistryServer.
* Invia opportune callbacks agli UserAgent interessati dal cambiamento.
*
* @author Andrea
* @see Thread
* @version 1.0
* @since 1.0
*/
public class StatusManager extends Thread {
/**
* Socket di comunicazione con il client.
*/
private Socket socket;
/**
* Mappa delle Callbacks.
*/
private ConcurrentHashMap<String,GossipCallbacks>callbacks;
/**
* Mappa degli Users.
*/
private ConcurrentHashMap<String,User>users;
/**
* Costruttore standard.
* @param s socket di comunicazione con il client.
* @param rs RegistryServer a cui lo StatusManager è associato.
*/
public StatusManager(Socket s,RegistryServer rs){
super();
this.setDaemon(true);
socket=s;
users=rs.getUsers();
callbacks=rs.getCallbacks();
}
/**
* Si mette in lettura sul socket, aspettando l'invio di
* messaggi di stato dal client.
*/
public void run(){
boolean stop=false;
String nick="";
while(!stop){
try{
ObjectInputStream ois=new ObjectInputStream(socket.getInputStream());
StatusMessage msg=(StatusMessage)ois.readObject();
nick=msg.getNickname();
Enumeration<String> enu=users.keys();
switch(msg.getNewStatus()){
case Const.ONLINE:
users.get(nick).setOnline(true);
while(enu.hasMoreElements()){
String k=enu.nextElement();
User v=users.get(k);
if(!k.equals(nick) && v.isOnline()){
User u=new User(users.get(nick));
callbacks.get(v.getNickname()).notifyOnline(v,u);
users.get(k).getInContacts().put(nick,new Contact(nick));
}
}
break;
case Const.OFFLINE:
users.get(msg.getNickname()).setOnline(false);
while(enu.hasMoreElements()){
String k=enu.nextElement();
User v=users.get(k);
if(!k.equals(nick) && v.isOnline())
callbacks.get(v.getNickname()).notifyOffline(v,new User(users.get(nick)));
}
break;
case Const.CLOSED:
System.out.println("chiudo connessione al server");
socket.close();
stop=true;
break;
default:
System.err.println("Errore ricezione status: ");
System.exit(Const.FAILURE);
}
}
catch(SocketException exc){
stop=true;
//users.get(nick).setOnline(false);
users.remove(nick);
callbacks.remove(nick);
}
catch(Exception exc){
System.err.println("Eccezione in ricezione messaggio TCP: "+exc.getMessage());
exc.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
2fea0229044de80ceebd1e42f778bad3c39af4dd | 84356dcef3ea94d6917fce743213ecdf1b2a3d3d | /Admission_Panel/src/in/ac/dei/edrp/admissionsystem/studentModule/studentDao.java | b6eaa478579feb5fea39a5009ca4c305d9168a1a | [] | no_license | Arushdb/Admission_panel_server | 1eed72c38688f2763528cfa478d19f45fff32734 | 04446f78b2cd5652490f7e4244653a6329b77883 | refs/heads/main | 2023-06-30T14:13:07.561003 | 2021-08-02T17:36:23 | 2021-08-02T17:36:23 | 390,290,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | package in.ac.dei.edrp.admissionsystem.studentModule;
import java.util.List;
import javax.servlet.ServletContext;
import in.ac.dei.edrp.admissionsystem.Bean.GenerateAdmitCardBean;
import in.ac.dei.edrp.admissionsystem.Bean.ReportInfoGetter;
import in.ac.dei.edrp.admissionsystem.Bean.admissionBean;
import in.ac.dei.edrp.admissionsystem.Bean.transferBean;
public interface studentDao {
public List<admissionBean> getCustomeGridData(admissionBean input);
public String generateCourseDetailPdf(admissionBean input,ServletContext sc);
}
| [
"[email protected]"
] | |
5924b14e0c2661da41ea61a26057c458f968dc78 | 82bbe3c7f7dc164ddbc14db49075c2ddeeab036b | /FirstLook.java | d1caffb9c6aff9c7b634bf816bc9b974b54159a4 | [] | no_license | zqq234/test | 6515ede7aaf2f538a88b7da39103573ab31496e5 | 2150b38e9f2739b252a40210a2d6f4453600866c | refs/heads/master | 2022-06-25T17:49:22.953327 | 2020-09-19T12:26:39 | 2020-09-19T12:26:39 | 217,680,002 | 2 | 1 | null | 2022-06-21T03:14:59 | 2019-10-26T08:36:34 | JavaScript | UTF-8 | Java | false | false | 1,888 | java | package lesson1;
/**
* @className FirstLook
* @Description TODO
* @Author zhangqianqian
* @Date 2020/3/4 21:43
* @Version 1.0
**/
public class FirstLook {
// 多线程并不一定就能提高速度,可以观察,count 不同,实际的运行效果也是不同的
private static final long count = 10_0000_0000;
public static void main(String[] args) throws InterruptedException {
// 使用并发方式
concurrency();
// 使用串行方式
serial();
}
private static void concurrency() throws InterruptedException {
long begin = System.nanoTime();
// 利用一个线程计算 a 的值
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
int a = 0;
for (long i = 0; i < count; i++) {
a--;
}
}
});
thread.start();
// 主线程内计算 b 的值
int b = 0;
for (long i = 0; i < count; i++) {
b--;
}
// 等待 thread 线程运行结束
thread.join();
// 统计耗时
long end = System.nanoTime();
double ms = (end - begin) * 1.0 / 1000 / 1000;
System.out.printf("并发: %f 毫秒%n", ms);
}
private static void serial() {
// 全部在主线程内计算 a、b 的值
long begin = System.nanoTime();
int a = 0;
for (long i = 0; i < count; i++) {
a--;
}
int b = 0;
for (long i = 0; i < count; i++) {
b--;
}
long end = System.nanoTime();
double ms = (end - begin) * 1.0 / 1000 / 1000;
System.out.printf("串行: %f 毫秒%n", ms);
}
}
| [
"[email protected]"
] | |
59125534e75743a7a2130b6bfe1cc7ec8d725757 | fec4a09f54f4a1e60e565ff833523efc4cc6765a | /Dependencies/work/decompile-00fabbe5/net/minecraft/world/entity/ai/goal/PathfinderGoalArrowAttack.java | 37283b01306046484574ee996116848ceb0fb186 | [] | no_license | DefiantBurger/SkyblockItems | 012d2082ae3ea43b104ac4f5bf9eeb509889ec47 | b849b99bd4dc52ae2f7144ddee9cbe2fd1e6bf03 | refs/heads/master | 2023-06-23T17:08:45.610270 | 2021-07-27T03:27:28 | 2021-07-27T03:27:28 | 389,780,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,367 | java | package net.minecraft.world.entity.ai.goal;
import java.util.EnumSet;
import net.minecraft.util.MathHelper;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityInsentient;
import net.minecraft.world.entity.EntityLiving;
import net.minecraft.world.entity.monster.IRangedEntity;
public class PathfinderGoalArrowAttack extends PathfinderGoal {
private final EntityInsentient mob;
private final IRangedEntity rangedAttackMob;
private EntityLiving target;
private int attackTime;
private final double speedModifier;
private int seeTime;
private final int attackIntervalMin;
private final int attackIntervalMax;
private final float attackRadius;
private final float attackRadiusSqr;
public PathfinderGoalArrowAttack(IRangedEntity irangedentity, double d0, int i, float f) {
this(irangedentity, d0, i, i, f);
}
public PathfinderGoalArrowAttack(IRangedEntity irangedentity, double d0, int i, int j, float f) {
this.attackTime = -1;
if (!(irangedentity instanceof EntityLiving)) {
throw new IllegalArgumentException("ArrowAttackGoal requires Mob implements RangedAttackMob");
} else {
this.rangedAttackMob = irangedentity;
this.mob = (EntityInsentient) irangedentity;
this.speedModifier = d0;
this.attackIntervalMin = i;
this.attackIntervalMax = j;
this.attackRadius = f;
this.attackRadiusSqr = f * f;
this.a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK));
}
}
@Override
public boolean a() {
EntityLiving entityliving = this.mob.getGoalTarget();
if (entityliving != null && entityliving.isAlive()) {
this.target = entityliving;
return true;
} else {
return false;
}
}
@Override
public boolean b() {
return this.a() || !this.mob.getNavigation().m();
}
@Override
public void d() {
this.target = null;
this.seeTime = 0;
this.attackTime = -1;
}
@Override
public void e() {
double d0 = this.mob.h(this.target.locX(), this.target.locY(), this.target.locZ());
boolean flag = this.mob.getEntitySenses().a(this.target);
if (flag) {
++this.seeTime;
} else {
this.seeTime = 0;
}
if (d0 <= (double) this.attackRadiusSqr && this.seeTime >= 5) {
this.mob.getNavigation().o();
} else {
this.mob.getNavigation().a((Entity) this.target, this.speedModifier);
}
this.mob.getControllerLook().a(this.target, 30.0F, 30.0F);
if (--this.attackTime == 0) {
if (!flag) {
return;
}
float f = (float) Math.sqrt(d0) / this.attackRadius;
float f1 = MathHelper.a(f, 0.1F, 1.0F);
this.rangedAttackMob.a(this.target, f1);
this.attackTime = MathHelper.d(f * (float) (this.attackIntervalMax - this.attackIntervalMin) + (float) this.attackIntervalMin);
} else if (this.attackTime < 0) {
this.attackTime = MathHelper.floor(MathHelper.d(Math.sqrt(d0) / (double) this.attackRadius, (double) this.attackIntervalMin, (double) this.attackIntervalMax));
}
}
}
| [
"[email protected]"
] | |
63dff6b2b9b6562a5f584728396b59592ea29582 | 8ec986726b3b60170aec4cb9772d3bdb163710af | /lib/lib-utils/src/main/java/org/sagebionetworks/util/TimeoutUtils.java | 906b70caba1cb23be3645479c053a552105cfcfb | [
"Apache-2.0"
] | permissive | marcomarasca/Synapse-Repository-Services | 871446d7bc8e27ca9f4e3d16c4f2007e3f69f5d3 | 294e6f422ef9a1367deaf511bc97473623233da4 | refs/heads/develop | 2023-08-17T12:25:54.442901 | 2023-08-16T15:40:47 | 2023-08-16T15:40:47 | 190,295,841 | 0 | 0 | Apache-2.0 | 2023-02-22T08:31:06 | 2019-06-04T23:55:19 | Java | UTF-8 | Java | false | false | 699 | java | package org.sagebionetworks.util;
/**
* Simple utility to determine if an event has expired. If the utility is
* injected into a dependency, expiration checks can be tested using a mock
* TimeoutUtils regardless of real time.
*
*/
public class TimeoutUtils {
/**
* Given a timeout (MS) and the start time of an event (epoch time), has the
* event expired?
*
* @param timeoutMS
* The timeout in MS.
* @param startEpochTime
* The s
* @return
*/
public boolean hasExpired(long timeoutMS, long startEpochTime) {
long now = System.currentTimeMillis();
long expires = startEpochTime + timeoutMS;
return now > expires;
}
}
| [
"[email protected]"
] | |
fa8d651d51930bcde0580e92346f14846ecc0921 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/5/5_0707ad797384d8c326e412808e94c780bbd9dc64/ItemOreDirv/5_0707ad797384d8c326e412808e94c780bbd9dc64_ItemOreDirv_s.java | 5c897bf7445921fb1018096b64e2c132ace4bedb | [] | 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,156 | java | package com.builtbroken.assemblyline.item;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.oredict.OreDictionary;
import com.builtbroken.assemblyline.ALRecipeLoader;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.minecraft.DarkCore;
import com.builtbroken.minecraft.EnumMaterial;
import com.builtbroken.minecraft.EnumOrePart;
import com.builtbroken.minecraft.IExtraInfo.IExtraItemInfo;
import com.builtbroken.minecraft.LaserEvent;
import com.builtbroken.minecraft.prefab.ItemBasic;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/** A series of items that are derived from a basic material
*
* @author DarkGuardsman */
public class ItemOreDirv extends ItemBasic implements IExtraItemInfo
{
public ItemOreDirv()
{
super(DarkCore.getNextItemId(), "Metal_Parts", AssemblyLine.CONFIGURATION);
this.setHasSubtypes(true);
this.setCreativeTab(CreativeTabs.tabMaterials);
MinecraftForge.EVENT_BUS.register(this);
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
if (itemStack != null)
{
return "item." + AssemblyLine.PREFIX + EnumOrePart.getFullName(itemStack.getItemDamage());
}
else
{
return this.getUnlocalizedName();
}
}
@Override
public Icon getIconFromDamage(int i)
{
return EnumMaterial.getIcon(i);
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister iconRegister)
{
for (EnumMaterial mat : EnumMaterial.values())
{
mat.itemIcons = new Icon[EnumOrePart.values().length];
for (EnumOrePart part : EnumOrePart.values())
{
if (mat.shouldCreateItem(part))
{
mat.itemIcons[part.ordinal()] = iconRegister.registerIcon(AssemblyLine.PREFIX + mat.simpleName + part.simpleName);
}
}
}
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (EnumMaterial mat : EnumMaterial.values())
{
for (EnumOrePart part : EnumOrePart.values())
{
ItemStack stack = EnumMaterial.getStack(this, mat, part, 1);
if (stack != null && mat.shouldCreateItem(part) && mat.itemIcons[part.ordinal()] != null)
{
par3List.add(stack);
}
}
}
}
@Override
public boolean hasExtraConfigs()
{
return false;
}
@Override
public void loadExtraConfigs(Configuration config)
{
// TODO Auto-generated method stub
}
@Override
public void loadOreNames()
{
for (EnumMaterial mat : EnumMaterial.values())
{
for (EnumOrePart part : EnumOrePart.values())
{
if (mat.shouldCreateItem(part))
{
//System.out.println(" N: " + mat.getOreName(part) + " R:" + mat.getOreNameReverse(part));
OreDictionary.registerOre(mat.getOreName(part), mat.getStack(this, part, 1));
OreDictionary.registerOre(mat.getOreNameReverse(part), mat.getStack(this, part, 1));
}
}
}
}
@ForgeSubscribe
public void LaserSmeltEvent(LaserEvent.LaserDropItemEvent event)
{
if (event.items != null)
{
for (int i = 0; i < event.items.size(); i++)
{
if (event.items.get(i).itemID == Block.blockIron.blockID)
{
event.items.set(i, EnumMaterial.getStack(this, EnumMaterial.IRON, EnumOrePart.MOLTEN, event.items.get(i).stackSize * 9));
}
else if (event.items.get(i).itemID == Block.blockGold.blockID)
{
event.items.set(i, EnumMaterial.getStack(this, EnumMaterial.GOLD, EnumOrePart.MOLTEN, event.items.get(i).stackSize * 9));
}
else if (event.items.get(i).itemID == Block.oreIron.blockID)
{
event.items.set(i, EnumMaterial.getStack(this, EnumMaterial.IRON, EnumOrePart.MOLTEN, event.items.get(i).stackSize));
}
else if (event.items.get(i).itemID == Block.oreGold.blockID)
{
event.items.set(i, EnumMaterial.getStack(this, EnumMaterial.GOLD, EnumOrePart.MOLTEN, event.items.get(i).stackSize));
}
String oreName = OreDictionary.getOreName(OreDictionary.getOreID(event.items.get(i)));
if (oreName != null)
{
for (EnumMaterial mat : EnumMaterial.values())
{
if (oreName.equalsIgnoreCase("ore" + mat.simpleName) || oreName.equalsIgnoreCase(mat.simpleName + "ore"))
{
event.items.set(i, mat.getStack(this, EnumOrePart.MOLTEN, event.items.get(i).stackSize + 1 + event.world.rand.nextInt(3)));
break;
}
else if (oreName.equalsIgnoreCase("ingot" + mat.simpleName) || oreName.equalsIgnoreCase(mat.simpleName + "ingot"))
{
event.items.set(i, mat.getStack(this, EnumOrePart.MOLTEN, event.items.get(i).stackSize));
break;
}
}
}
}
}
}
}
| [
"[email protected]"
] | |
92595e20f0aa02c90727e325b8a70e4787eb5d10 | 80862c57c315db64544cc029d3ebf2f5d50ebfdc | /src/main/java/Application.java | ce9751ba74725fd132aee96a721c169116446818 | [] | no_license | finnetrolle/streamingflatmap | e405f552d49cd8c019d3608ca8af19ed32399aa8 | c6132c514d1ed3146863ef8731b27d4a1ff95b38 | refs/heads/master | 2016-08-02T20:59:22.393532 | 2015-08-02T14:26:10 | 2015-08-02T14:26:10 | 40,081,806 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,245 | java |
import com.google.gson.Gson;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.toMap;
/**
* Created by finnetrolle on 02.08.2015.
*/
public class Application {
public static void main(String[] args) {
List<CarBrandDTO> carBrandDTOs = loadJson();
Map<String, ModelDTO> modelsByModelName = getModelsByModelName(carBrandDTOs);
Map<String, CarBrandDTO> brandsByModelName = getBrandsByModelName(carBrandDTOs);
Map<MultiKey, EngineDTO> enginesByModelNameAndEngineName = getEnginesByModelNameAndEngineName(carBrandDTOs);
List<Pair<String, String>> report = new ArrayList<>();
report.add(new Pair<>("Land Cruiser Prado", "1KZ-T"));
report.add(new Pair<>("Accord", "A20A1"));
report.add(new Pair<>("Corsa", "4A-FE"));
report.add(new Pair<>("Land Cruiser Prado", "1KZ-TE"));
report.add(new Pair<>("Mark II", "1G-FE'90"));
report.forEach(pair -> {
StringBuilder sb = new StringBuilder()
.append(brandsByModelName.get(pair.getFirst())).append(", ")
.append(modelsByModelName.get(pair.getFirst())).append(", ")
.append(enginesByModelNameAndEngineName.get(new MultiKey(pair.getFirst(), pair.getSecond())));
System.out.println(sb.toString());
});
}
public static Map<String, ModelDTO> getModelsByModelName(List<CarBrandDTO> brands) {
return brands.stream()
.flatMap(brand -> brand.getModels().stream())
.collect(Collectors.toMap(ModelDTO::getModelName, model -> model));
}
public static Map<String, CarBrandDTO> getBrandsByModelName(List<CarBrandDTO> brands) {
return brands.stream()
.flatMap(brand -> brand.getModels().stream()
.map(model -> new Pair<>(model.getModelName(), brand)))
.collect(toMap(Pair::getFirst, Pair::getSecond));
}
public static Map<MultiKey, EngineDTO> getEnginesByModelNameAndEngineName(List<CarBrandDTO> brands) {
return brands.stream()
.flatMap(brand -> brand.getModels().stream()
.map(model -> new Pair<>(brand, model)))
.flatMap(modelPair -> modelPair.getSecond().getEngines().stream()
.map(engine -> new Pair<>(modelPair, engine)))
.map(enginePair -> new Pair<>(new MultiKey(enginePair.getFirst().getSecond().getModelName(),
enginePair.getSecond().getEngineName()), enginePair.getSecond()))
.collect(toMap(Pair::getFirst, Pair::getSecond));
}
public static List<CarBrandDTO> loadJson() {
try {
ClassLoader loader = ClassLoader.getSystemClassLoader();
File file = new File(loader.getResource("world.json").getFile());
return new Gson().fromJson(new FileReader(file), CarWorldDTO.class).getBrands();
} catch (IOException e) {
return new ArrayList<>();
}
}
}
| [
"[email protected]"
] | |
350b43959b4c2888ea31010aceeeaa969388b25f | afd7287c7fb5a867b68636b8bd77e6a5ad6c7789 | /AppendPeriod.java | eef73898d00918925c53b9e0e3fb3f27fda4524d | [] | no_license | prasannapogunulla/play | 02352b144701205e53a2d28d44124371f2fccade | 626b1cb30ac2a4f0ae6cc6ee1e31f1f23abf70c6 | refs/heads/master | 2020-03-28T05:25:18.982853 | 2018-09-15T07:21:16 | 2018-09-15T07:21:16 | 147,775,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 299 | java | import java.util.Scanner;
class AppendPeriod
{
public static void main(String[] args)
{
String str1 ;
Scanner sc=new Scanner(System.in);
str1=sc.nextLine();
String str2 =".";
String str3 = str1.concat(str2);
System.out.println(str3);
}
}
| [
"[email protected]"
] | |
71d28f208321f52822195d5caf6530feb1b347d8 | 2af5e62c67b1294d2f44970e3fd478bdca7bce7d | /src/Bezier.java | 93ba90e80254cc64b79ae245e13869cc2fb257b0 | [
"MIT"
] | permissive | MichaelMBradley/Detailing | 6f6380d705a753140cc089e17e6b3d667d44bf05 | 0783c13157e8b3cfd0b067cc9fbcd6271e2b5b62 | refs/heads/main | 2023-06-20T17:27:38.321828 | 2021-08-07T05:23:38 | 2021-08-07T05:23:38 | 363,982,326 | 0 | 0 | MIT | 2021-08-02T19:49:45 | 2021-05-03T15:52:13 | Java | UTF-8 | Java | false | false | 4,867 | java | import lombok.Getter;
import processing.core.PApplet;
import processing.core.PVector;
import java.util.LinkedHashMap;
import static processing.core.PApplet.*;
public class Bezier implements Curve {
private final PVector p1, p2;
@Getter private final PVector c1, c2;
public Bezier() {
p1 = new PVector();
c1 = new PVector();
c2 = new PVector();
p2 = new PVector();
}
public Bezier(float[] bezierInfo) {
p1 = new PVector(bezierInfo[0], bezierInfo[1]);
c1 = new PVector(bezierInfo[2], bezierInfo[3]);
c2 = new PVector(bezierInfo[4], bezierInfo[5]);
p2 = new PVector(bezierInfo[6], bezierInfo[7]);
}
public Bezier(float p1x, float p1y, float c1x, float c1y, float c2x, float c2y, float p2x, float p2y) {
p1 = new PVector(p1x, p1y);
c1 = new PVector(c1x, c1y);
c2 = new PVector(c2x, c2y);
p2 = new PVector(p2x, p2y);
}
public Bezier(PVector p1in, PVector c1in, PVector c2in, PVector p2in) {
p1 = p1in;
c1 = c1in;
c2 = c2in;
p2 = p2in;
}
public Bezier(Curve from, Curve to) {
this(from, to, 0.75f);
}
public Bezier(Curve from, Curve to, float power) {
// Bezier connect
float rF = pow(from.getSize(), power), rT = pow(to.getSize(), power);
p1 = from.getEndPVector();
c1 = Traversal.newRelative(p1, rF, from.getEndAngle());
p2 = to.getStartPVector();
c2 = Traversal.newRelative(p2, rT, to.getStartAngle());
// System.out.printf("%s\nFrom: %s\tTo: %s\n", Helpers.floatArrayToString(info), from, to));
}
@Override public boolean isEmpty() {
return new PVector().equals(p1) && p1.equals(c1) && c1.equals(c2) && c2.equals(p2);
}
@Override public boolean isConnecting() {
return true;
}
@Override public float getStartAngle() {
return PVector.sub(c1, p1).heading();
}
@Override public float getEndAngle() {
return PVector.sub(p2, c2).heading();
}
@Override public PVector getStartPVector() {
return p1;
}
@Override public PVector getEndPVector() {
return p2;
}
@Override public float getSize() {
return p1.dist(p2);
}
@Override public float getRange() {
return abs(getEndAngle() - getStartAngle());
}
public Bezier getAdjacent(float offset) {
PVector n1 = Traversal.newRelative(p1, offset, getStartAngle() + HALF_PI);
PVector n2 = Traversal.newRelative(c1, offset, getStartAngle() + HALF_PI);
PVector n3 = Traversal.newRelative(c1, offset, PVector.sub(c2, c1).heading() + HALF_PI);
PVector n4 = Traversal.newRelative(c2, offset, PVector.sub(c2, c1).heading() + HALF_PI);
PVector n5 = Traversal.newRelative(c2, offset, getEndAngle() + HALF_PI);
PVector n6 = Traversal.newRelative(p2, offset, getEndAngle() + HALF_PI);
return new Bezier(n1, Traversal.crossover(n1, n2, n3, n4), Traversal.crossover(n3, n4, n5, n6), n6);
}
public Bezier[] getAdjacent(float offset, int det) {
if(det < 1) {
return new Bezier[0];
}
Bezier[] bez = new Bezier[det];
float base = 0f, chng = 1f / det;
for(int i = 0; i < det; i++) {
bez[i] = cut(base, base + chng).getAdjacent(offset);
base += chng;
}
return bez;
}
public Bezier cut(float min, float max) {
return cut(max)[0].cut(min / max)[1];
}
public Bezier[] cut(float amt) {
amt = max(0, min(1, amt));
PVector a1 = PVector.lerp(p1, c1, amt);
PVector a2 = PVector.lerp(c1, c2, amt);
PVector a3 = PVector.lerp(c2, p2, amt);
PVector b1 = PVector.lerp(a1, a2, amt);
PVector b2 = PVector.lerp(a2, a3, amt);
PVector c1 = PVector.lerp(b1, b2, amt);
return new Bezier[] { new Bezier(p1, a1, b1, c1), new Bezier(c1, b2, a3, p2) };
}
public float distance() {
return distance(20);
}
public float distance(int accuracy) {
return speed(accuracy).get(1f);
}
public LinkedHashMap<Float, Float> speed(int accuracy) {
LinkedHashMap<Float, Float> lhm = new LinkedHashMap<>();
PVector prev, next = p1;
float dist = 0;
for(int i = 0; i <= accuracy; i++) {
prev = next;
next = pointAt((float) i / accuracy);
dist += prev.dist(next);
lhm.put((float) i / accuracy, dist);
}
return lhm;
}
public PVector pointAt(float amt) {
amt = 1 - amt;
return PVector.add(PVector.add(PVector.mult(p1, pow(amt, 3)), PVector.mult(c1, 3 * pow(amt, 2) * (1 - amt))),
PVector.add(PVector.mult(c2, 3 * amt * pow(1 - amt, 2)), PVector.mult(p2, pow((1 - amt), 3))));
}
@Override public void draw(PApplet sketch) {
sketch.bezier(p1.x, p1.y, c1.x, c1.y, c2.x, c2.y, p2.x, p2.y);
}
public void drawPoints(PApplet sketch) {
sketch.point(p1.x, p1.y);
sketch.point(p2.x, p2.y);
sketch.point(c1.x, c1.y);
sketch.point(c2.x, c2.y);
}
public void drawLines(PApplet sketch) {
sketch.line(p1.x, p1.y, c1.x, c1.y);
sketch.line(c1.x, c1.y, c2.x, c2.y);
sketch.line(c2.x, c2.y, p2.x, p2.y);
}
@Override public String toString() {
return String.format("[%.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f]",
p1.x, p1.y, c1.x, c1.y, c2.x, c2.y, p2.x, p2.y);
}
}
| [
"[email protected]"
] | |
20a6ea85afca032697b49f4c3d9dc8a64e47b5c4 | 63e882b1602634c7b8024446acf91a7d84785d1d | /src/test/java/com/amazon/AppTestRun.java | 5108c7514142d30e8aaa0717d5419903d1cb0bba | [] | no_license | mikepeceros/sampleAmazonTest | 421a8979dbbb870e5b4d655b01008eabdaeb0784 | b3e7e19380ddb714ee78d6080ebf85b3f9aaccc1 | refs/heads/main | 2023-01-03T23:53:24.529911 | 2020-11-02T17:32:14 | 2020-11-02T17:32:14 | 308,761,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,857 | java | package com.amazon;
import com.amazon.pages.DashboardPage;
import com.amazon.utilities.Utils;
import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import java.util.concurrent.TimeUnit;
@CucumberOptions(plugin = {"pretty",
"json:target/cucumber_json_reports/home-page.json",
"json:target/cucumber-json/cucumber.json",
"html:target/home-page-html"},
features = {"src/test/resources/features/amazon/"},
tags = { "@SearchProduct" },
glue = { "com.amazon.steps"})
public class AppTestRun extends AbstractTestNGCucumberTests {
static private RemoteWebDriver webDriver;
protected static DashboardPage dashboardPage;
private final String amazonScreenshotsFolder = "./target/screenshots/";
public AppTestRun(){}
public void initPages(RemoteWebDriver webDriver) {
dashboardPage = new DashboardPage(webDriver);
}
@BeforeTest
public void cleanResources(){
Utils utils = new Utils();
utils.cleanFolder(amazonScreenshotsFolder);
}
@BeforeMethod
@Parameters({ "browser" })
public void startBrowser(String browser){
switch (browser.toLowerCase()){
case "chrome":
startChrome();
break;
case "firefox":
startFirefox();
break;
default:
break;
}
}
@AfterMethod
public void quitDriver(){
if (webDriver != null) {
webDriver.quit();
}
}
public RemoteWebDriver startChrome(){
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
try{
WebDriverManager.chromedriver().setup();
webDriver = new ChromeDriver(options);
webDriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
initPages(webDriver);
}catch (Exception e){
//TODO
}
return webDriver;
}
public RemoteWebDriver startFirefox(){
try{
WebDriverManager.firefoxdriver().setup();
webDriver = new FirefoxDriver();
webDriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
webDriver.manage().window().maximize();
initPages(webDriver);
}catch (Exception e){
//TODO
}
return webDriver;
}
} | [
"[email protected]"
] | |
3b121a2400eef3db99645668cad3d476f77789a9 | ead0fda02a8c6a65b5e028b3ea6a4f897f012601 | /main/src/main/main02.java | 87b77c0074370d5f2ebbf2642f540bce8fa73547 | [] | no_license | smilodon410/Java_code_study-Eclipse_work_space- | 8b13dcccdf18c9ea84b2abdd8f49a39373d09179 | 56b1b8edec2edcdfa2cf3e2d315ea06b6c601ea4 | refs/heads/master | 2023-01-30T10:22:06.939158 | 2020-12-09T05:26:25 | 2020-12-09T05:26:25 | 319,239,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,542 | java | package main;
import java.util.Random;
import java.util.Scanner;
public class main02 {
public static void main(String[] args) {
//ex08
//1부터 입력 숫자까지의 합을 구하세요
Scanner scanner = new Scanner(System.in);
Scanner scanner1 = new Scanner(System.in);
//
// System.out.println("숫자를 입력하세요: ");
//
// int x = scanner.nextInt();
// int sum = 0;
//
// for (int j = 0; j <= x; j++) {
// sum += j;
// }
// System.out.println("1부터" + x + "까지의 합 :" + sum);
//ex09 - 대입 증가
// int a = 3;
// int b;
// b = a++;
// System.out.println(a + " " + b);
//
// int c = 3, d;
// d = ++c;
// System.out.println(c + " " + d);
//ex10
//i가 짝수이면 호랑이 홀수이면 꼬끼리
// for (int i = 1; i <= 20; i++) {
// if( i % 2 == 0) {
// System.out.println( i + " = " + "호랑이");
// } else {
// System.out.println( i + " = " + "코끼리");
// }
// }
//
//if else 문장은 반드시 삼항연산이 되는지 확인하자
// for (int i = 1; i <= 20; i++) {
// System.out.println((i % 2 == 0)? "호랑이" : "독수리");
// }
//삼항 연산
// int a = 10;
// if( 3 > 2) {
// a += 1;
// } else {
// a -= 1;
// }
// //위와 완전 같음
// a = ( 3 > 2 ? a++ : a -- );
//3의 4승을 구하는 프로그램을 작성하세요
// int num = scanner.nextInt();
// int num2 = scanner1.nextInt();
// System.out.println(num+"의 " + num2 + "승은 " + Math.pow(num, num2));
//
// int sum = 1;
// for (int i = 0; i < 6; i++) {
// sum = sum * 3;
// }
// System.out.println(sum);
//ex11
//"!"값을 구하자
// int num = scanner.nextInt();
// long sum = 1;
// for (int i = 1; i <= num; i++) {
// sum = sum * i;
// }
// System.out.println( num + "! = " + sum);
//ex12
//예제 - swap 프로그램
// int a = 10, b = 20;
// int temp;
// System.out.println(a + " " + b);
// temp = a;
// a = b;
// b = temp;
// System.out.println(a + " " + b);
//ex13
// Random rnd = new Random();
// int r = rnd.nextInt(100); //0~99까지 랜덤하게 숫자를 생성해줌
// System.out.println(r);
//
// System.out.println(rnd.nextInt(6));
//
// System.out.println(""); //seperate : 구분 할 때 활용한다.
//
// for (int i = 0; i < 10; i++) {
// r = rnd.nextInt(100);
// System.out.println(r);
// }
//
// System.out.println("");
//
// for (int i = 0; i < 10; i++) {
// System.out.println(rnd.nextInt(100));
// }
}
}
| [
"[email protected]"
] | |
46414585640aadd476f54b3e7cfdb5b564252520 | 08f1b5c0399106c289a1ab10fac71772dc6abe49 | /TestOrgProject/src/com/testing/Testing.java | 91e38f3347b3265f67f63249488095c1982dd464 | [] | no_license | SMTInternals/TestingOrgProject | 9b188236f88335f7e550fe507e2d565499972233 | 16b3643f4802a21a8a96d8e58a62cf132f10d32b | refs/heads/master | 2021-01-03T07:55:18.301791 | 2020-02-12T10:56:23 | 2020-02-12T10:56:23 | 239,989,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 147 | java | package com.testing;
public class Testing {
public static void main(String[] args) {
System.out.println("Welcome to GIT HUB");
}
}
| [
"[email protected]"
] | |
a122ef982d676ca8b13e43a53435e52d4e082447 | ed2aab33f578c8d1112d96f7dcb0178c199233b0 | /src/main/java/com/advance/academy/characters/demo/service/ItemService.java | 5d5e8d363ed86cd5e71139ab9c33b48077c49b84 | [] | no_license | gnestorov/characters | 5b6a32bcc8f22465d514528299547e126014f5ff | 06ad0a9a76dfeeb45cc2a68fb0817ce20b5b73d6 | refs/heads/master | 2023-05-26T10:38:50.143518 | 2021-06-02T20:25:15 | 2021-06-02T20:25:15 | 368,789,089 | 0 | 0 | null | 2021-06-02T20:25:16 | 2021-05-19T07:59:34 | Java | UTF-8 | Java | false | false | 5,118 | java | package com.advance.academy.characters.demo.service;
import com.advance.academy.characters.demo.exception.ItemNotFoundException;
import com.advance.academy.characters.demo.model.Armor;
import com.advance.academy.characters.demo.model.Item;
import com.advance.academy.characters.demo.model.Shield;
import com.advance.academy.characters.demo.model.Weapon;
import com.advance.academy.characters.demo.repository.ArmorRepository;
import com.advance.academy.characters.demo.repository.ItemRepository;
import com.advance.academy.characters.demo.repository.ShieldRepository;
import com.advance.academy.characters.demo.repository.WeaponRepository;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashSet;
import java.util.Set;
@Service
public class ItemService {
private final ItemRepository itemRepository;
private final WeaponRepository weaponRepository;
private final ArmorRepository armorRepository;
private final ShieldRepository shieldRepository;
@Autowired
public ItemService(ItemRepository itemRepository, WeaponRepository weaponRepository, ArmorRepository armorRepository, ShieldRepository shieldRepository) {
this.itemRepository = itemRepository;
this.weaponRepository = weaponRepository;
this.armorRepository = armorRepository;
this.shieldRepository = shieldRepository;
}
public Set<Item> findAllItems() {
return new HashSet<>(itemRepository.findAll());
}
public Set<Weapon> findAllWeapons() {
return new HashSet<>(weaponRepository.findAll());
}
public Set<Armor> findAllArmors() {
return new HashSet<>(armorRepository.findAll());
}
public Set<Shield> findAllShields() {
return new HashSet<>(shieldRepository.findAll());
}
public Item findById(@NonNull Long id) {
return itemRepository.findById(id)
.orElseThrow(() -> new ItemNotFoundException(String.format("Could not find item with id '%s'", id)));
}
public void createWeapon(@NonNull Weapon weapon) {
// TODO: check if user is admin else throw HttpStatusCodeException(HttpStatus.UNAUTHORIZED)
itemRepository.save(weapon);
}
public void createArmor(@NonNull Armor armor) {
// TODO: check if user is admin else throw HttpStatusCodeException(HttpStatus.UNAUTHORIZED)
itemRepository.save(armor);
}
public void createShield(@NonNull Shield shield) {
// TODO: check if user is admin else throw HttpStatusCodeException(HttpStatus.UNAUTHORIZED)
itemRepository.save(shield);
}
public Weapon updateWeapon(Long id, Weapon weapon) {
// TODO: check if user is admin else throw HttpStatusCodeException(HttpStatus.UNAUTHORIZED)
Weapon updatedWeapon = weaponRepository.findById(id)
.orElseThrow(() -> new ItemNotFoundException(String.format("Could not find item with id '%s'", id)));
updatedWeapon.setItemType(weapon.getItemType());
updatedWeapon.setWeaponType(weapon.getWeaponType());
updatedWeapon.setName(weapon.getName());
updatedWeapon.setDamage(weapon.getDamage());
updatedWeapon.setDamageType(weapon.getDamageType());
updatedWeapon.setDescription(weapon.getDescription());
return itemRepository.save(updatedWeapon);
}
public Armor updateArmor(Long id, Armor armor) {
// TODO: check if user is admin else throw HttpStatusCodeException(HttpStatus.UNAUTHORIZED)
Armor updatedArmor = armorRepository.findById(id)
.orElseThrow(() -> new ItemNotFoundException(String.format("Could not find item with id '%s'", id)));
updatedArmor.setItemType(armor.getItemType());
updatedArmor.setArmorType(armor.getArmorType());
updatedArmor.setName(armor.getName());
updatedArmor.setDamageReduction(armor.getDamageReduction());
updatedArmor.setResistantTo(armor.getResistantTo());
updatedArmor.setWeakAgainst(armor.getWeakAgainst());
updatedArmor.setDescription(armor.getDescription());
return itemRepository.save(updatedArmor);
}
public Shield updateShield(Long id, Shield shield) {
// TODO: check if user is admin else throw HttpStatusCodeException(HttpStatus.UNAUTHORIZED)
Shield updatedShield = shieldRepository.findById(id)
.orElseThrow(() -> new ItemNotFoundException(String.format("Could not find item with id '%s'", id)));
updatedShield.setItemType(shield.getItemType());
updatedShield.setShieldType(shield.getShieldType());
updatedShield.setDefence(shield.getDefence());
updatedShield.setDescription(shield.getDescription());
return itemRepository.save(updatedShield);
}
public void deleteById(@NonNull Long id) {
// TODO: check if user is admin else throw HttpStatusCodeException(HttpStatus.UNAUTHORIZED)
itemRepository.deleteById(id);
}
public void save(@NonNull Item item) {
itemRepository.save(item);
}
}
| [
"[email protected]"
] | |
2deeaaab9af0cb5ecf082f7f3244e28681534da0 | 0cefb435ccaed1ab81a208251d1097cf9ec4fb83 | /entypo-typeface-library/src/main/java/com/mikepenz/entypo_typeface_library/Entypo.java | 2e09267aabbedf3ff09d94c7d13b98a5f4412992 | [
"Apache-2.0"
] | permissive | marbat87/Android-Iconics | 06916fdcabc59ea8eebf449affff0b15f33b4463 | 5adf0b47df54c230973f6a75f8a2f183abf03454 | refs/heads/master | 2020-05-04T15:18:37.108796 | 2019-03-31T21:56:35 | 2019-03-31T21:56:35 | 178,812,221 | 0 | 0 | Apache-2.0 | 2019-04-01T07:48:49 | 2019-04-01T07:48:49 | null | UTF-8 | Java | false | false | 16,769 | java | /*
* Copyright 2014 Mike Penz
*
* 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.mikepenz.entypo_typeface_library;
import android.content.Context;
import android.graphics.Typeface;
import com.mikepenz.iconics.typeface.IIcon;
import com.mikepenz.iconics.typeface.ITypeface;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
public class Entypo implements ITypeface {
private static final String TTF_FILE = "entypo-font-v1.0.0.1.ttf";
private static Typeface typeface = null;
private static HashMap<String, Character> mChars;
@Override
public IIcon getIcon(String key) {
return Icon.valueOf(key);
}
@Override
public HashMap<String, Character> getCharacters() {
if (mChars == null) {
HashMap<String, Character> aChars = new HashMap<String, Character>();
for (Icon v : Icon.values()) {
aChars.put(v.name(),
v.character);
}
mChars = aChars;
}
return mChars;
}
@Override
public String getMappingPrefix() {
return "ent";
}
@Override
public String getFontName() {
return "Entypo";
}
@Override
public String getVersion() {
return "1.0.0.1";
}
@Override
public int getIconCount() {
return mChars.size();
}
@Override
public Collection<String> getIcons() {
Collection<String> icons = new LinkedList<String>();
for (Icon value : Icon.values()) {
icons.add(value.name());
}
return icons;
}
@Override
public String getAuthor() {
return "Daniel Bruce";
}
@Override
public String getUrl() {
return "http://www.entypo.com/";
}
@Override
public String getDescription() {
return "411 carefully crafted premium pictograms by Daniel Bruce";
}
@Override
public String getLicense() {
return "CC BY-SA 4.0";
}
@Override
public String getLicenseUrl() {
return "https://creativecommons.org/licenses/by-sa/4.0/";
}
@Override
public Typeface getTypeface(Context context) {
if (typeface == null) {
try {
typeface = Typeface.createFromAsset(context.getAssets(), "fonts/" + TTF_FILE);
} catch (Exception e) {
return null;
}
}
return typeface;
}
public enum Icon implements IIcon {
ent_add_to_list('\ue900'),
ent_classic_computer('\ue901'),
ent_controller_fast_backward('\ue902'),
ent_creative_commons_attribution('\ue903'),
ent_creative_commons_noderivs('\ue904'),
ent_creative_commons_noncommercial_eu('\ue905'),
ent_creative_commons_noncommercial_us('\ue906'),
ent_creative_commons_public_domain('\ue907'),
ent_creative_commons_remix('\ue908'),
ent_creative_commons_share('\ue909'),
ent_creative_commons_sharealike('\ue90a'),
ent_creative_commons('\ue90b'),
ent_document_landscape('\ue90c'),
ent_remove_user('\ue90d'),
ent_warning('\ue90e'),
ent_arrow_bold_down('\ue90f'),
ent_arrow_bold_left('\ue910'),
ent_arrow_bold_right('\ue911'),
ent_arrow_bold_up('\ue912'),
ent_arrow_down('\ue913'),
ent_arrow_left('\ue914'),
ent_arrow_long_down('\ue915'),
ent_arrow_long_left('\ue916'),
ent_arrow_long_right('\ue917'),
ent_arrow_long_up('\ue918'),
ent_arrow_right('\ue919'),
ent_arrow_up('\ue91a'),
ent_arrow_with_circle_down('\ue91b'),
ent_arrow_with_circle_left('\ue91c'),
ent_arrow_with_circle_right('\ue91d'),
ent_arrow_with_circle_up('\ue91e'),
ent_bookmark('\ue91f'),
ent_bookmarks('\ue920'),
ent_chevron_down('\ue921'),
ent_chevron_left('\ue922'),
ent_chevron_right('\ue923'),
ent_chevron_small_down('\ue924'),
ent_chevron_small_left('\ue925'),
ent_chevron_small_right('\ue926'),
ent_chevron_small_up('\ue927'),
ent_chevron_thin_down('\ue928'),
ent_chevron_thin_left('\ue929'),
ent_chevron_thin_right('\ue92a'),
ent_chevron_thin_up('\ue92b'),
ent_chevron_up('\ue92c'),
ent_chevron_with_circle_down('\ue92d'),
ent_chevron_with_circle_left('\ue92e'),
ent_chevron_with_circle_right('\ue92f'),
ent_chevron_with_circle_up('\ue930'),
ent_cloud('\ue931'),
ent_controller_fast_forward('\ue932'),
ent_controller_jump_to_start('\ue933'),
ent_controller_next('\ue934'),
ent_controller_paus('\ue935'),
ent_controller_play('\ue936'),
ent_controller_record('\ue937'),
ent_controller_stop('\ue938'),
ent_controller_volume('\ue939'),
ent_dot_single('\ue93a'),
ent_dots_three_horizontal('\ue93b'),
ent_dots_three_vertical('\ue93c'),
ent_dots_two_horizontal('\ue93d'),
ent_dots_two_vertical('\ue93e'),
ent_download('\ue93f'),
ent_emoji_flirt('\ue940'),
ent_flow_branch('\ue941'),
ent_flow_cascade('\ue942'),
ent_flow_line('\ue943'),
ent_flow_parallel('\ue944'),
ent_flow_tree('\ue945'),
ent_install('\ue946'),
ent_layers('\ue947'),
ent_open_book('\ue948'),
ent_resize_100('\ue949'),
ent_resize_full_screen('\ue94a'),
ent_save('\ue94b'),
ent_select_arrows('\ue94c'),
ent_sound_mute('\ue94d'),
ent_sound('\ue94e'),
ent_trash('\ue94f'),
ent_triangle_down('\ue950'),
ent_triangle_left('\ue951'),
ent_triangle_right('\ue952'),
ent_triangle_up('\ue953'),
ent_uninstall('\ue954'),
ent_upload_to_cloud('\ue955'),
ent_upload('\ue956'),
ent_add_user('\ue957'),
ent_address('\ue958'),
ent_adjust('\ue959'),
ent_air('\ue95a'),
ent_aircraft_landing('\ue95b'),
ent_aircraft_take_off('\ue95c'),
ent_aircraft('\ue95d'),
ent_align_bottom('\ue95e'),
ent_align_horizontal_middle('\ue95f'),
ent_align_left('\ue960'),
ent_align_right('\ue961'),
ent_align_top('\ue962'),
ent_align_vertical_middle('\ue963'),
ent_archive('\ue964'),
ent_area_graph('\ue965'),
ent_attachment('\ue966'),
ent_awareness_ribbon('\ue967'),
ent_back_in_time('\ue968'),
ent_back('\ue969'),
ent_bar_graph('\ue96a'),
ent_battery('\ue96b'),
ent_beamed_note('\ue96c'),
ent_bell('\ue96d'),
ent_blackboard('\ue96e'),
ent_block('\ue96f'),
ent_book('\ue970'),
ent_bowl('\ue971'),
ent_box('\ue972'),
ent_briefcase('\ue973'),
ent_browser('\ue974'),
ent_brush('\ue975'),
ent_bucket('\ue976'),
ent_cake('\ue977'),
ent_calculator('\ue978'),
ent_calendar('\ue979'),
ent_camera('\ue97a'),
ent_ccw('\ue97b'),
ent_chat('\ue97c'),
ent_check('\ue97d'),
ent_circle_with_cross('\ue97e'),
ent_circle_with_minus('\ue97f'),
ent_circle_with_plus('\ue980'),
ent_circle('\ue981'),
ent_circular_graph('\ue982'),
ent_clapperboard('\ue983'),
ent_clipboard('\ue984'),
ent_clock('\ue985'),
ent_code('\ue986'),
ent_cog('\ue987'),
ent_colours('\ue988'),
ent_compass('\ue989'),
ent_copy('\ue98a'),
ent_credit_card('\ue98b'),
ent_credit('\ue98c'),
ent_cross('\ue98d'),
ent_cup('\ue98e'),
ent_cw('\ue98f'),
ent_cycle('\ue990'),
ent_database('\ue991'),
ent_dial_pad('\ue992'),
ent_direction('\ue993'),
ent_document('\ue994'),
ent_documents('\ue995'),
ent_drink('\ue996'),
ent_drive('\ue997'),
ent_drop('\ue998'),
ent_edit('\ue999'),
ent_email('\ue99a'),
ent_emoji_happy('\ue99b'),
ent_emoji_neutral('\ue99c'),
ent_emoji_sad('\ue99d'),
ent_erase('\ue99e'),
ent_eraser('\ue99f'),
ent_export('\ue9a0'),
ent_eye('\ue9a1'),
ent_feather('\ue9a2'),
ent_flag('\ue9a3'),
ent_flash('\ue9a4'),
ent_flashlight('\ue9a5'),
ent_flat_brush('\ue9a6'),
ent_folder_images('\ue9a7'),
ent_folder_music('\ue9a8'),
ent_folder_video('\ue9a9'),
ent_folder('\ue9aa'),
ent_forward('\ue9ab'),
ent_funnel('\ue9ac'),
ent_game_controller('\ue9ad'),
ent_gauge('\ue9ae'),
ent_globe('\ue9af'),
ent_graduation_cap('\ue9b0'),
ent_grid('\ue9b1'),
ent_hair_cross('\ue9b2'),
ent_hand('\ue9b3'),
ent_heart_outlined('\ue9b4'),
ent_heart('\ue9b5'),
ent_help_with_circle('\ue9b6'),
ent_help('\ue9b7'),
ent_home('\ue9b8'),
ent_hour_glass('\ue9b9'),
ent_image_inverted('\ue9ba'),
ent_image('\ue9bb'),
ent_images('\ue9bc'),
ent_inbox('\ue9bd'),
ent_infinity('\ue9be'),
ent_info_with_circle('\ue9bf'),
ent_info('\ue9c0'),
ent_key('\ue9c1'),
ent_keyboard('\ue9c2'),
ent_lab_flask('\ue9c3'),
ent_landline('\ue9c4'),
ent_language('\ue9c5'),
ent_laptop('\ue9c6'),
ent_leaf('\ue9c7'),
ent_level_down('\ue9c8'),
ent_level_up('\ue9c9'),
ent_lifebuoy('\ue9ca'),
ent_light_bulb('\ue9cb'),
ent_light_down('\ue9cc'),
ent_light_up('\ue9cd'),
ent_line_graph('\ue9ce'),
ent_link('\ue9cf'),
ent_list('\ue9d0'),
ent_location_pin('\ue9d1'),
ent_location('\ue9d2'),
ent_lock_open('\ue9d3'),
ent_lock('\ue9d4'),
ent_log_out('\ue9d5'),
ent_login('\ue9d6'),
ent_loop('\ue9d7'),
ent_magnet('\ue9d8'),
ent_magnifying_glass('\ue9d9'),
ent_mail('\ue9da'),
ent_man('\ue9db'),
ent_map('\ue9dc'),
ent_mask('\ue9dd'),
ent_medal('\ue9de'),
ent_megaphone('\ue9df'),
ent_menu('\ue9e0'),
ent_message('\ue9e1'),
ent_mic('\ue9e2'),
ent_minus('\ue9e3'),
ent_mobile('\ue9e4'),
ent_modern_mic('\ue9e5'),
ent_moon('\ue9e6'),
ent_mouse('\ue9e7'),
ent_music('\ue9e8'),
ent_network('\ue9e9'),
ent_new_message('\ue9ea'),
ent_new('\ue9eb'),
ent_news('\ue9ec'),
ent_note('\ue9ed'),
ent_notification('\ue9ee'),
ent_old_mobile('\ue9ef'),
ent_old_phone('\ue9f0'),
ent_palette('\ue9f1'),
ent_paper_plane('\ue9f2'),
ent_pencil('\ue9f3'),
ent_phone('\ue9f4'),
ent_pie_chart('\ue9f5'),
ent_pin('\ue9f6'),
ent_plus('\ue9f7'),
ent_popup('\ue9f8'),
ent_power_plug('\ue9f9'),
ent_price_ribbon('\ue9fa'),
ent_price_tag('\ue9fb'),
ent_print('\ue9fc'),
ent_progress_empty('\ue9fd'),
ent_progress_full('\ue9fe'),
ent_progress_one('\ue9ff'),
ent_progress_two('\uea00'),
ent_publish('\uea01'),
ent_quote('\uea02'),
ent_radio('\uea03'),
ent_reply_all('\uea04'),
ent_reply('\uea05'),
ent_retweet('\uea06'),
ent_rocket('\uea07'),
ent_round_brush('\uea08'),
ent_rss('\uea09'),
ent_ruler('\uea0a'),
ent_scissors('\uea0b'),
ent_share_alternitive('\uea0c'),
ent_share('\uea0d'),
ent_shareable('\uea0e'),
ent_shield('\uea0f'),
ent_shop('\uea10'),
ent_shopping_bag('\uea11'),
ent_shopping_basket('\uea12'),
ent_shopping_cart('\uea13'),
ent_shuffle('\uea14'),
ent_signal('\uea15'),
ent_sound_mix('\uea16'),
ent_sports_club('\uea17'),
ent_spreadsheet('\uea18'),
ent_squared_cross('\uea19'),
ent_squared_minus('\uea1a'),
ent_squared_plus('\uea1b'),
ent_star_outlined('\uea1c'),
ent_star('\uea1d'),
ent_stopwatch('\uea1e'),
ent_suitcase('\uea1f'),
ent_swap('\uea20'),
ent_sweden('\uea21'),
ent_switch('\uea22'),
ent_tablet('\uea23'),
ent_tag('\uea24'),
ent_text_document_inverted('\uea25'),
ent_text_document('\uea26'),
ent_text('\uea27'),
ent_thermometer('\uea28'),
ent_thumbs_down('\uea29'),
ent_thumbs_up('\uea2a'),
ent_thunder_cloud('\uea2b'),
ent_ticket('\uea2c'),
ent_time_slot('\uea2d'),
ent_tools('\uea2e'),
ent_traffic_cone('\uea2f'),
ent_tree('\uea30'),
ent_trophy('\uea31'),
ent_tv('\uea32'),
ent_typing('\uea33'),
ent_unread('\uea34'),
ent_untag('\uea35'),
ent_user('\uea36'),
ent_users('\uea37'),
ent_v_card('\uea38'),
ent_video('\uea39'),
ent_vinyl('\uea3a'),
ent_voicemail('\uea3b'),
ent_wallet('\uea3c'),
ent_water('\uea3d'),
ent_500px_with_circle('\uea3e'),
ent_500px('\uea3f'),
ent_basecamp('\uea40'),
ent_behance('\uea41'),
ent_creative_cloud('\uea42'),
ent_dropbox('\uea43'),
ent_evernote('\uea44'),
ent_flattr('\uea45'),
ent_foursquare('\uea46'),
ent_google_drive('\uea47'),
ent_google_hangouts('\uea48'),
ent_grooveshark('\uea49'),
ent_icloud('\uea4a'),
ent_mixi('\uea4b'),
ent_onedrive('\uea4c'),
ent_paypal('\uea4d'),
ent_picasa('\uea4e'),
ent_qq('\uea4f'),
ent_rdio_with_circle('\uea50'),
ent_renren('\uea51'),
ent_scribd('\uea52'),
ent_sina_weibo('\uea53'),
ent_skype_with_circle('\uea54'),
ent_skype('\uea55'),
ent_slideshare('\uea56'),
ent_smashing('\uea57'),
ent_soundcloud('\uea58'),
ent_spotify_with_circle('\uea59'),
ent_spotify('\uea5a'),
ent_swarm('\uea5b'),
ent_vine_with_circle('\uea5c'),
ent_vine('\uea5d'),
ent_vk_alternitive('\uea5e'),
ent_vk_with_circle('\uea5f'),
ent_vk('\uea60'),
ent_xing_with_circle('\uea61'),
ent_xing('\uea62'),
ent_yelp('\uea63'),
ent_dribbble_with_circle('\uea64'),
ent_dribbble('\uea65'),
ent_facebook_with_circle('\uea66'),
ent_facebook('\uea67'),
ent_flickr_with_circle('\uea68'),
ent_flickr('\uea69'),
ent_github_with_circle('\uea6a'),
ent_github('\uea6b'),
ent_google_with_circle('\uea6c'),
ent_google('\uea6d'),
ent_instagram_with_circle('\uea6e'),
ent_instagram('\uea6f'),
ent_lastfm_with_circle('\uea70'),
ent_lastfm('\uea71'),
ent_linkedin_with_circle('\uea72'),
ent_linkedin('\uea73'),
ent_pinterest_with_circle('\uea74'),
ent_pinterest('\uea75'),
ent_rdio('\uea76'),
ent_stumbleupon_with_circle('\uea77'),
ent_stumbleupon('\uea78'),
ent_tumblr_with_circle('\uea79'),
ent_tumblr('\uea7a'),
ent_twitter_with_circle('\uea7b'),
ent_twitter('\uea7c'),
ent_vimeo_with_circle('\uea7d'),
ent_vimeo('\uea7e'),
ent_youtube_with_circle('\uea7f'),
ent_youtube('\uea80');
char character;
Icon(char character) {
this.character = character;
}
public String getFormattedName() {
return "{" + name() + "}";
}
public char getCharacter() {
return character;
}
public String getName() {
return name();
}
// remember the typeface so we can use it later
private static ITypeface typeface;
public ITypeface getTypeface() {
if (typeface == null) {
typeface = new Entypo();
}
return typeface;
}
}
}
| [
"[email protected]"
] | |
b2ac38c4b4ccef61afdcec6e0fe53e7df8cc5497 | b01df4d3847aed7c3dd2861fa0d66c5f138398e9 | /Game/src/models/animation/Animation.java | 625e1f1a2a4007f700ef1f5d37dcabb61266aee6 | [] | no_license | M-e-n-n-o/3DGame | 700d6172ec03242375ff84de950b28018d27103f | 5d3bb22b075c4908522ddd1856e0a353590ff77d | refs/heads/main | 2023-03-22T02:09:05.969806 | 2021-03-17T08:40:22 | 2021-03-17T08:40:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 630 | java | package models.animation;
import models.TexturedModel;
import java.util.List;
public class Animation {
private float animationLength;
private List<TexturedModel> keyframes;
public Animation(List<TexturedModel> keyframes, float animationLength) {
this.keyframes = keyframes;
this.animationLength = animationLength;
}
public float getAnimationLength() {
return animationLength;
}
public List<TexturedModel> getKeyframes() {
return keyframes;
}
public void setAnimationLength(float animationLength) {
this.animationLength = animationLength;
}
}
| [
"[email protected]"
] | |
209bbcac7a01ae829080904be0f66d6042f343af | e283a75546d3f3aa1cde440f95d21a0e7f5a5511 | /sundries/src/test/java/com/ideal/multithreading/Interrupt.java | ada962e40e35de8c59201de5e0a00f92c4af4af8 | [] | no_license | itman782016351/test | 5063b578fb719aa29525f24c3811c688921ff612 | 717b027de6951d604ab066eb94b52555570745dd | refs/heads/master | 2022-12-24T10:33:40.797648 | 2019-11-28T08:41:15 | 2019-11-28T08:41:15 | 165,792,446 | 0 | 0 | null | 2022-12-10T04:27:27 | 2019-01-15T05:44:45 | JavaScript | UTF-8 | Java | false | false | 848 | java | package com.ideal.multithreading;
/**
* @author zhaopei
* @create 2019-03-09 10:32
*/
public class Interrupt {
public static void main(String[] args) {
A a = new A();
Thread t1 = new Thread(a);
t1.start();
System.out.println("执行睡眠之前1:" + t1.isInterrupted());
try {
System.out.println("执行睡眠之前2:" + t1.isInterrupted());
t1.sleep(1000);//线程进入阻塞状态
t1.interrupt();
} catch (InterruptedException e) {
System.out.println(e);
e.printStackTrace();
} finally {
System.out.println("执行睡眠之后:" + t1.isInterrupted());
}
}
}
class A implements Runnable {
@Override
public void run() {
System.out.println(Thread.currentThread());
}
}
| [
"[email protected]"
] | |
c932f8eca8f5b97cab57320737151c7ff79de614 | e7e953538f1dccd49e1ad6d6c7c657eb64366881 | /Mobile.java | 7ef86784b4111df22cc9cebf72ea92e19682558d | [] | no_license | 22aishwaryagoyal/FIS | c239c7fc595ecbf35a5bc31f6b5743cc2f4dff36 | 357cd12fb4fd9aad76635162b8818c9de4143ce5 | refs/heads/main | 2023-06-18T09:39:47.292259 | 2021-07-13T12:52:25 | 2021-07-13T12:52:25 | 383,995,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 429 | java |
class Mobile extends ElectronicDevice
{
private int memory;
private String mode;
public Mobile(int modelNo, String brandName, String color, int power,int memory,String mode) {
super(modelNo, brandName, color, power);
this.memory=memory;
this.mode=mode;
}
private Camera camera;
public Camera getCamera() {
return camera;
}
public void setCamera(Camera camera) {
this.camera = camera;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.