blob_id
stringlengths 40
40
| language
stringclasses 1
value | repo_name
stringlengths 5
132
| path
stringlengths 2
382
| src_encoding
stringclasses 34
values | length_bytes
int64 9
3.8M
| score
float64 1.5
4.94
| int_score
int64 2
5
| detected_licenses
listlengths 0
142
| license_type
stringclasses 2
values | text
stringlengths 9
3.8M
| download_success
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
4c1dfda435effd50454a0327ce5ea2fd1cbeeea6
|
Java
|
Sreenaveen/Restaurant-App
|
/app/src/main/java/uc/sree/restaurantfinder/FavoritesActivity.java
|
UTF-8
| 1,218
| 2.125
| 2
|
[] |
no_license
|
package uc.sree.restaurantfinder;
import android.app.ActionBar;
import android.app.ListActivity;
import android.database.Cursor;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class FavoritesActivity extends ListActivity {
DatabaseHelper myDb;
List list = new ArrayList();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_favorites);
myDb = new DatabaseHelper(this);
Cursor res = myDb.getAllData();
while (res.moveToNext()){
HashMap<String, String> hmap = new HashMap<String, String>();
hmap.put("name",res.getString(1));
hmap.put("rating",res.getString(2));
hmap.put("imageUrl",res.getString(3));
hmap.put("location",res.getString(4));
list.add(hmap);
}
ListAdapter adapter = new MySimpleArrayAdapter(this, list);
setListAdapter(adapter);
}
}
| true
|
860482b297e3997940f93fd18ab950e6ba153172
|
Java
|
ngagearun/TestingUploadCode
|
/OnlineNareshClasses/src/Methodoverloading.java
|
UTF-8
| 585
| 3.375
| 3
|
[] |
no_license
|
class Methodoverloading {
int mul;
int multiplication(int num1,int num2){
mul=num1*num2;
return mul;
}
int multiplication(int num1,int num2,int num3){
mul=num1*num2*num3;
return mul;
}
int multiplication(float num1,float num2){
mul=(int) (num1*num2);
return mul;
}
static void main(int a){
}
static void main(int a,int b){
}
public static void main(String[] args) {
Methodoverloading methodoverloading=new Methodoverloading();
System.out.println(methodoverloading.multiplication(23.5f, 41.5f));
main(10);
}
}
| true
|
55afa370c33d4ce7ec45183004e5380ae13fb81b
|
Java
|
JayDamon/MoneyMakerPersonalFinance2.1
|
/java/com/moneymaker/modules/financialtype/Bean.java
|
UTF-8
| 1,017
| 2.296875
| 2
|
[] |
no_license
|
package com.moneymaker.modules.financialtype;
import com.moneymaker.modules.financialtype.behavior.FinanceType;
import com.moneymaker.modules.financialtype.behavior.FinancialTypeBehavior;
import javafx.beans.property.SimpleIntegerProperty;
import java.beans.Beans;
/**
* Created by Jay Damon on 7/20/2017.
*/
public abstract class Bean extends Beans {
private FinancialTypeBehavior behavior;
private final SimpleIntegerProperty id = new SimpleIntegerProperty(0);
private final FinanceType type;
Bean(FinanceType type) {
this.type = type;
}
public int getID() {
return id.get();
}
public void setId(int id) {
idProperty().set(id);
}
void setBehavior(FinancialTypeBehavior t) {
this.behavior = t;
}
public FinanceType getFinanceType() {
return this.type;
}
public SimpleIntegerProperty idProperty() {
return id;
}
public FinancialTypeBehavior getBehavior() {
return this.behavior;
}
}
| true
|
950ca4cdb4d2d3d20a217972ac3718a18686d872
|
Java
|
jorgeporca/machine-learning-lab
|
/backend/lab-service/src/main/java/org/mltooling/lab/components/ExperimentsManager.java
|
UTF-8
| 6,873
| 2.296875
| 2
|
[
"Apache-2.0"
] |
permissive
|
package org.mltooling.lab.components;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.MINUTES;
import com.google.gson.Gson;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCollection;
import java.util.*;
import org.bson.Document;
import org.mltooling.core.env.Environment;
import org.mltooling.core.lab.model.LabExperiment;
import org.mltooling.core.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ExperimentsManager {
// ================ Constants =========================================== //
private static final Logger log = LoggerFactory.getLogger(ExperimentsManager.class);
public static final String EXPERIMENTS_COLLECTION_PREFIX = "experiments-";
private static final String KEY_PROPERTY = "key";
public static final String STATS_COMPLETED = "completed";
public static final String STATS_RUNNING = "running";
public static final String STATS_FAILED = "failed";
public static final String STATS_LAST_RUN = "lastRun";
// ================ Members ============================================= //
public Environment env;
private MongoDbManager mongoDbManager;
// ================ Constructors & Main ================================= //
public ExperimentsManager(MongoDbManager mongoDbManager) {
this.mongoDbManager = mongoDbManager;
}
// ================ Methods for/from SuperClass / Interfaces ============ //
// ================ Public Methods ====================================== //
public LabExperiment updateExperiment(String project, LabExperiment experiment) throws Exception {
if (StringUtils.isNullOrEmpty(experiment.getKey())) {
throw new Exception("Failed to sync experiment. The experiment key is not provided.");
}
MongoCollection collection = getExpCollection(project);
Document keyFilter = new Document(KEY_PROPERTY, experiment.getKey());
if (experimentExists(project, experiment.getKey())) {
collection.updateOne(keyFilter, new Document("$set", transformLabExperiment(experiment)));
} else {
collection.insertOne(transformLabExperiment(experiment));
}
return experiment;
}
public List<LabExperiment> getExperiments(String project) {
if (getExperimentCount(project) == 0) {
return new ArrayList<>();
}
List<LabExperiment> experiments = new ArrayList<>();
FindIterable<Document> experimentsIter = getExpCollection(project).find();
for (Document doc : experimentsIter) {
try {
experiments.add(transformMongoDocument(doc));
} catch (Exception e) {
log.info("Failed to transform experiment", e);
}
}
return experiments;
}
public static Map<String, Object> getExperimentsStats(List<LabExperiment> experiments) {
Integer running = 0;
Integer completed = 0;
Integer failed = 0;
Date lastRun = null;
for (LabExperiment experiment : experiments) {
if (lastRun == null) {
lastRun = experiment.getStartedAt();
}
if (experiment.getStartedAt() != null) {
if (lastRun.before(experiment.getStartedAt())) {
lastRun = experiment.getStartedAt();
}
}
if (experiment.getUpdatedAt() != null) {
if (lastRun.before(experiment.getUpdatedAt())) {
lastRun = experiment.getUpdatedAt();
}
}
if (experiment.getFinishedAt() != null) {
if (lastRun.before(experiment.getFinishedAt())) {
lastRun = experiment.getFinishedAt();
}
}
// set experiment to dead if it wasn't update in the last 30 minutes
long MAX_TIME_WITHOUT_UPDATE = MILLISECONDS.convert(30, MINUTES);
if (experiment.getStatus() == LabExperiment.State.RUNNING
&& experiment.getUpdatedAt() != null
&& (new Date().getTime() - experiment.getUpdatedAt().getTime())
>= MAX_TIME_WITHOUT_UPDATE) {
experiment.setStatus(LabExperiment.State.DEAD);
}
if (experiment.getStatus() == LabExperiment.State.RUNNING) {
running++;
} else if (experiment.getStatus() == LabExperiment.State.FAILED
|| experiment.getStatus() == LabExperiment.State.DEAD
|| experiment.getStatus() == LabExperiment.State.INTERRUPTED) {
failed++;
} else if (experiment.getStatus() == LabExperiment.State.COMPLETED) {
completed++;
}
}
HashMap<String, Object> statistics = new HashMap<>();
statistics.put(STATS_COMPLETED, completed);
statistics.put(STATS_RUNNING, running);
statistics.put(STATS_FAILED, failed);
statistics.put(STATS_LAST_RUN, lastRun);
return statistics;
}
/** Use with care, cannot be undone. */
protected void deleteExperimentCollection(String project) {
getExpCollection(project).drop();
}
public LabExperiment getExperiment(String project, String experimentKey) {
Document document =
getExpCollection(project).find(new Document(KEY_PROPERTY, experimentKey)).first();
LabExperiment experiment = null;
if (document != null) {
experiment = transformMongoDocument(document);
}
return experiment;
}
public boolean experimentExists(String project, String experiment) {
try {
return getExpCollection(project).countDocuments(new Document("key", experiment)) > 0;
} catch (Exception e) {
log.warn("Bad experiment name.", e);
return false;
}
}
public int getExperimentCount(String project) {
try {
return (int) getExpCollection(project).countDocuments();
} catch (Exception e) {
log.warn("Failed to count experiments.", e);
return 0;
}
}
/** Delete an experiment */
public void deleteExperiment(String project, String experimentKey) {
Document document =
getExpCollection(project).find(new Document(KEY_PROPERTY, experimentKey)).first();
if (document != null) {
getExpCollection(project).deleteOne(document);
} else {
log.warn("Failed to delete experiment " + project);
}
}
// ================ Private Methods ===================================== //
private LabExperiment transformMongoDocument(Document doc) {
return new Gson().fromJson(doc.toJson(), LabExperiment.class);
}
private Document transformLabExperiment(LabExperiment experiment) {
return Document.parse(new Gson().toJson(experiment, LabExperiment.class));
}
private MongoCollection<Document> getExpCollection(String project) {
return mongoDbManager.getLabMongoDb().getCollection(EXPERIMENTS_COLLECTION_PREFIX + project);
}
// ================ Getter & Setter ===================================== //
// ================ Builder Pattern ===================================== //
// ================ Inner & Anonymous Classes =========================== //
}
| true
|
239e57555a3db4ed1cea702320dd021e26dedd8d
|
Java
|
joeli-github/mysell
|
/mysell/src/main/java/com/my/controller/OrderController.java
|
UTF-8
| 967
| 2.046875
| 2
|
[] |
no_license
|
package com.my.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.my.common.ServerResponse;
import com.my.dto.OrderDTO;
import com.my.service.OrderMasterService;
@RestController
@RequestMapping("/manager/order")
public class OrderController {
@Autowired
private OrderMasterService orderMasterService;
/**
* 后台订单列表
* @param page
* @param size
* @return
*/
@RequestMapping("/findorderall")
public ServerResponse<Page<OrderDTO>> findOrderAll(@RequestParam(value = "page",defaultValue = "1")Integer page,
@RequestParam(value = "size",defaultValue = "10")Integer size){
return orderMasterService.findOrderAll(page, size);
}
}
| true
|
b1edaf4a81b558aec5fae047f18fc8f1d1b933e4
|
Java
|
leiding1001/simple-client
|
/src/main/java/com/example/been/PositionInfo.java
|
UTF-8
| 1,906
| 2.375
| 2
|
[] |
no_license
|
package com.example.been;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.datastax.driver.core.UDTValue;
import com.datastax.driver.core.UserType;
import com.datastax.driver.mapping.annotations.UDT;
@UDT (keyspace = "addrkeyspace", name = "positionInfo")
public class PositionInfo {
public PositionInfo() {
}
public PositionInfo(Date date, double longitude, double latitude,
float accuracy, float gasoline, float speed) {
this.date = date;
this.longitude = longitude;
this.latitude = latitude;
this.accuracy = accuracy;
this.gasoline = gasoline;
this.speed = speed;
}
public Date date ;
public double longitude ;
public double latitude ;
public float accuracy ;
public float gasoline ;
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public float getAccuracy() {
return accuracy;
}
public void setAccuracy(float accuracy) {
this.accuracy = accuracy;
}
public float getGasoline() {
return gasoline;
}
public void setGasoline(float gasoline) {
this.gasoline = gasoline;
}
public float getSpeed() {
return speed;
}
public void setSpeed(float speed) {
this.speed = speed;
}
public float speed ;
//[
// {date:0, longitude:111.0, latitude:222.0, accuracy:1.0, gasoline:1.0, speed:100.0},
// {date:1, longitude:222.0, latitude:333.0, accuracy:1.0, gasoline:1.0, speed:100.0}]
public String toString(){
return "{date:"+new SimpleDateFormat("yyyyMMDDHHmm").format(date)+",longitude:"+longitude+",latitude:"+latitude+",accuracy:"+accuracy+",gasoline:"+gasoline+",speed:"+speed+"}";
}
}
| true
|
8a0a9734c75198d16912ede1a1cbd6849060043d
|
Java
|
jingxiaohu/adver_task
|
/src/main/java/com/pyb/mvc/action/v1/pay/param/Param_wx_charge_jsapi.java
|
UTF-8
| 2,730
| 1.960938
| 2
|
[] |
no_license
|
package com.pyb.mvc.action.v1.pay.param;
import apidoc.jxh.cn.TargetComment;
import com.pyb.mvc.action.v1.param.BaseParam;
/**
* 用户充值/商品下单支付
*
* @author jingxiaohu
*/
public class Param_wx_charge_jsapi extends BaseParam {
/********************接收参数区*************************/
@TargetComment(value = "时间戳ms", isnull = "否")
public long t;//时间戳ms
@TargetComment(value = "用户token", isnull = "否")
public String token;//令牌 用户token
@TargetComment(value = "是支付 还是 充值 0:订单支付 1:充值", isnull = "是")
public Integer type;//是支付 还是 充值 0:订单支付 1:充值
@TargetComment(value = "用户对于微信公众号APPID唯一ID", isnull = "是")
public String openid;//用户对于微信公众号APPID唯一ID
/**
* 收货人信息
*/
@TargetComment(value = "收货地址", isnull = "否")
public String address;//收货地址
@TargetComment(value = "收货人姓名", isnull = "否")
public String name;//收货人姓名
@TargetComment(value = "收货人电话号码", isnull = "否")
public String telephone;//收货人电话号码
/**
* 商品相关
*/
@TargetComment(value = "商品列表JSONARRAY数组字符串[{\"clothing\":\"{\\\"size\\\":[ 120,130,140,150],\\\"color\\\":[\\\"黄色\\\",\\\"红色\\\",\\\"蓝色\\\"]}\",\"g_id\":1,\"num\":2,\"pay_price\":51}]", isnull = "是")
String goods_list = null;
/************************get set 方法区****************************/
public long getT() {
return t;
}
public void setT(long t) {
this.t = t;
}
@Override
public String getToken() {
return token;
}
@Override
public void setToken(String token) {
this.token = token;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getGoods_list() {
return goods_list;
}
public void setGoods_list(String goods_list) {
this.goods_list = goods_list;
}
}
| true
|
1ff6c2a702379ed85a4874d8afae2fe8edeb8410
|
Java
|
roking99/designpatterndemo
|
/chainofresponsibiltydemo/src/main/java/com/roking/designpattern/client/ChainClient.java
|
UTF-8
| 1,609
| 2.78125
| 3
|
[] |
no_license
|
package com.roking.designpattern.client;
import com.roking.designpattern.handler.AbstractHandler;
import com.roking.designpattern.handler.concrete.CommonHandler;
import com.roking.designpattern.handler.concrete.Director;
import com.roking.designpattern.handler.concrete.GeneralManager;
import com.roking.designpattern.handler.concrete.Manager;
import com.roking.designpattern.request.ChainRequest;
/**
* Title:职责链客户端</br>
* <p/>
* Description:职责链由客户端建立维护</br>
* <p/>
* Company: <a href="www.jd.com">京东</a></br>
*
* @author <a href=mailto:luojin1@jd.com>罗金</a>
* @date 2018/1/30.
*/
public class ChainClient {
public static void main(String[] args) {
Director director = new Director("主任");
Manager manger = new Manager("经理");
GeneralManager gm = new GeneralManager("总经理");
CommonHandler ch = new CommonHandler("通用处理");
///建立职责链
director.setNextHandler(manger);
manger.setNextHandler(gm);
gm.setNextHandler(ch);
///发送请求
ChainRequest cr = new ChainRequest(2);
director.processRequest(cr);
ChainRequest cr1 = new ChainRequest(4);
director.processRequest(cr1);
ChainRequest cr2 = new ChainRequest(12);
director.processRequest(cr2);
ChainRequest cr3 = new ChainRequest(30);
director.processRequest(cr3);
ChainRequest cr4 = new ChainRequest(-1);
director.processRequest(cr4);
ChainRequest cr5 = new ChainRequest(0);
director.processRequest(cr5);
}
}
| true
|
5cdef59bfae51a398559f30931d38cd3664abbf4
|
Java
|
nemo1560/HowToFix
|
/app/src/main/java/com/example/nemo1/ifixit/MainActivity.java
|
UTF-8
| 2,093
| 2.3125
| 2
|
[] |
no_license
|
package com.example.nemo1.ifixit;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.example.nemo1.ifixit.Interfaces.onCallBack;
import com.example.nemo1.ifixit.V.DetailFragment;
import com.example.nemo1.ifixit.V.SearchFragment;
import com.example.nemo1.ifixit.V.WebViewFragment;
public class MainActivity extends AppCompatActivity implements onCallBack {
private FragmentTransaction fragmentTransaction;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initFragment();
}
private void initFragment() {
fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.fragment_layout,new SearchFragment());
fragmentTransaction.commit();
}
//Nhan thong tin interface tu fragment SearchFragment truyen ve activity
//Activity ko implement interface duoc.
@Override
public void CallBack(String search) {
Bundle bundle = new Bundle();
Fragment fragment = new DetailFragment();
bundle.putString("search",search);
fragment.setArguments(bundle);
fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.fragment_layout,fragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}
//Nhan thong tin interface tu fragment DetailFragment truyen ve activity
@Override
public void CallBackURL(String url) {
Bundle bundle = new Bundle();
Fragment fragment = new WebViewFragment();
bundle.putString("url",url);
fragment.setArguments(bundle);
fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.fragment_layout,fragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}
}
| true
|
786114db30325d426344ff23e5e5f9901ff1ced2
|
Java
|
alicelepadat/Seminar_CTS
|
/sem_11/src/ro/ase/cts/memento/main/Program.java
|
UTF-8
| 610
| 2.625
| 3
|
[] |
no_license
|
package ro.ase.cts.memento.main;
import ro.ase.cts.memento.clase.ManagerMemento;
import ro.ase.cts.memento.clase.Meci;
public class Program {
public static void main(String[] args) {
Meci meci = new Meci("Dinamo", "FCSB", 200, 180, 10, 7);
ManagerMemento manager = new ManagerMemento();
manager.adaugaMEmento(meci.creazaMemento());
meci.setNrSpectatori(180);
manager.adaugaMEmento(meci.creazaMemento());
System.out.println(meci);
meci.seteazaMemento(manager.cereMemento(0));
System.out.println(meci);
meci.seteazaMemento(manager.getLastMemento());
System.out.println(meci);
}
}
| true
|
9a0785f912d52e56829c4b80d4cb7fae7b7a59e1
|
Java
|
wellitongb/Mobius
|
/src/mobius.esc/Jack/Tool/Software/Jack/Iflow/checkingIF/State.java
|
UTF-8
| 1,592
| 2.78125
| 3
|
[] |
no_license
|
package checkingIF;
/*
* Created on Jan 25, 2005
* @version $Id: State.java,v 1.1 2005/02/02 14:40:10 lmartini Exp $
*/
/**
* @author Luca Martini
*
* a state of the abstract interpreter
*/
import embeddingInfo.HL;
import embeddingInfo.SecLevel;
import java.util.HashMap;
import java.util.Set;
import java.util.Iterator;
import org.apache.bcel.generic.Instruction;
import org.apache.bcel.generic.InstructionList;
import org.apache.bcel.generic.MethodGen;
public class State {
private OpStack stack;
private SecEnv se;
/**
* Get the Stack value.
* @return the Stack value.
*/
public OpStack getStack() {
return stack;
}
/**
* Get the security environment value.
* @return the Se value.
*/
public SecEnv getSe() {
return se;
}
public State(MethodGen m, SecLevel sl) {
stack = new OpStack(m.getMaxStack());
se = new SecEnv(m,sl);
}
public State(SecEnv se, OpStack stack){
this.se = se;
this.stack = stack;
}
protected Object clone(){
State s = new State(se.getClone(), stack.getClone());
return s;
}
public State getClone(){
return (State) clone();
}
public boolean equals(Object o){
if (!(o instanceof State)) return false; // implies "null" is non-equal.
State f = (State) o;
return this.stack.equals(f.stack) && this.se.equals(f.se);
}
/**
* Returns a String representation of the State instance.
*/
public String toString(){
String s= "OperandStack:";
s += stack;
s += "Security Environment:\n";
s += se;
return s;
}
}
| true
|
6182d4af1b334c126c637af32483dbaf383623d2
|
Java
|
imsudipacharya/Quizzer
|
/app/src/main/java/com/bma/quizzer/QuestionsActivity.java
|
UTF-8
| 13,041
| 1.804688
| 2
|
[] |
no_license
|
package com.bma.quizzer;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.core.view.ViewCompat;
import android.animation.Animator;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
public class QuestionsActivity extends AppCompatActivity {
public static final String FILE_NAME = "QUIZZER";
public static final String KEY_NAME = "QUEST";
private Button sharebutton, nextbutton;
private TextView correctOption;
private FloatingActionButton bookmarkbutton;
private TextView questions, noindicator;
private LinearLayout optionContainer;
private int count = 0;
private List<QuestionModel> questionModelList;
private int postion = 0;
private int score = 0;
private String category;
private int setNo;
private Dialog loadingDialog;
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference reference = database.getReference();
private List<QuestionModel> bookmarkslist;
private SharedPreferences preferences;
private SharedPreferences.Editor editor;
private Gson gson;
private int matchedQuestionPosition;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_questions);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
optionContainer = findViewById(R.id.linearLayout2);
sharebutton = findViewById(R.id.sharebutton);
nextbutton = findViewById(R.id.nextbutton);
bookmarkbutton = findViewById(R.id.bookmarkbutton);
questions = findViewById(R.id.questions);
noindicator = findViewById(R.id.noOfQuestion);
preferences = getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
editor = preferences.edit();
gson = new Gson();
getBookmarks();
bookmarkbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (modelMatcher()){
bookmarkslist.remove(matchedQuestionPosition);
bookmarkbutton.setImageDrawable(getDrawable(R.drawable.ic_action_bookmarks));
}else {
bookmarkslist.add(questionModelList.get(postion));
bookmarkbutton.setImageDrawable(getDrawable(R.drawable.ic_action_name));
}
}
});
category = getIntent().getStringExtra("category");
setNo = getIntent().getIntExtra("setNo", 1);
questionModelList = new ArrayList<>();
loadingDialog = new Dialog(this);
loadingDialog.setContentView(R.layout.loading);
loadingDialog.setCancelable(false);
loadingDialog.show();
reference.child("SETS")
.child(category)
.child("questions")
.orderByChild("setNo")
.equalTo(setNo)
.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// This method is called once with the initial value and again
// whenever data at this location is updated.
for (DataSnapshot snapshot1 : dataSnapshot.getChildren()) {
questionModelList.add(snapshot1.getValue(QuestionModel.class));
}
if (questionModelList.size() > 0) {
for (int i = 0; i < 4; i++) {
optionContainer.getChildAt(i).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
checkAnswer((TextView) v);
}
});
}
playAnim(questions, 0, questionModelList.get(postion).getQuestion());
nextbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
nextbutton.setEnabled(false);
nextbutton.setAlpha(0.10f);
enableOption(true);
postion++;
if (postion == questionModelList.size()) {
Intent scoreIntent = new Intent(QuestionsActivity.this, ScoreActivity.class);
scoreIntent.putExtra("score", score);
scoreIntent.putExtra("total", questionModelList.size());
startActivity(scoreIntent);
finish();
return;
}
count = 0;
playAnim(questions, 0, questionModelList.get(postion).getQuestion());
}
});
sharebutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String body = questionModelList.get(postion).getQuestion()+ "\n" +
questionModelList.get(postion).getOptionA()+ "\n"+
questionModelList.get(postion).getOptionB()+ "\n" +
questionModelList.get(postion).getOptionC()+ "\n" +
questionModelList.get(postion).getOptionD();
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_SUBJECT,"Quizzer Challenge");
shareIntent.putExtra(Intent.EXTRA_TEXT, body);
startActivity(Intent.createChooser(shareIntent,"Share Via"));
}
});
} else {
finish();
Toast.makeText(QuestionsActivity.this, "No Questions", Toast.LENGTH_SHORT).show();
}
loadingDialog.dismiss();
}
@Override
public void onCancelled(DatabaseError error) {
// Failed to read value
Toast.makeText(QuestionsActivity.this, error.getMessage(), Toast.LENGTH_SHORT).show();
loadingDialog.dismiss();
finish();
}
});
}
@Override
protected void onPause() {
super.onPause();
storeBookmarks();
}
private void playAnim(View view, int value, final String data) {
view.animate().alpha(value).scaleX(value)
.scaleY(value)
.setDuration(500)
.setStartDelay(100)
.setInterpolator(new DecelerateInterpolator())
.setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
if (value == 0 && count < 4) {
String option = "";
if (count == 0) {
option = questionModelList.get(postion).getOptionA();
} else if (count == 1) {
option = questionModelList.get(postion).getOptionB();
} else if (count == 2) {
option = questionModelList.get(postion).getOptionC();
} else if (count == 3) {
option = questionModelList.get(postion).getOptionD();
}
playAnim(optionContainer.getChildAt(count), 0, option);
count++;
}
}
@Override
public void onAnimationEnd(Animator animation) {
if (value == 0) {
try {
noindicator.setText(postion + 1 + "/" + questionModelList.size());
((TextView) view).setText(data);
if (modelMatcher()){
bookmarkbutton.setImageDrawable(getDrawable(R.drawable.ic_action_bookmarks));
}else {
bookmarkbutton.setImageDrawable(getDrawable(R.drawable.ic_action_name));
}
} catch (ClassCastException exception) {
((Button) view).setText(data);
}
view.setTag(data);
playAnim(view, 1, data);
}
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
}
private void checkAnswer(TextView selectedOption) {
enableOption(false);
nextbutton.setEnabled(true);
nextbutton.setAlpha(1);
if (selectedOption.getText().toString().equals(questionModelList.get(postion).getCorrectAns())) {
//correct
score++;
selectedOption.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#16d904")));
} else {
//incorrect
selectedOption.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#e80212")));
correctOption = (TextView) optionContainer.findViewWithTag(questionModelList.get(postion).getCorrectAns());
correctOption.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#16d904")));
}
}
private void enableOption(boolean enable) {
for (int i = 0; i < 4; i++) {
optionContainer.getChildAt(i).setEnabled(enable);
if (enable) {
optionContainer.getChildAt(i).setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#FF6200EE")));
}
}
}
private void getBookmarks() {
String json = preferences.getString(KEY_NAME, "");
Type type = new TypeToken<List<QuestionModel>>() {
}.getType();
bookmarkslist = gson.fromJson(json, type);
if (bookmarkslist == null) {
bookmarkslist = new ArrayList<>();
}
}
private boolean modelMatcher() {
boolean matched = false;
int i = 0;
for (QuestionModel model : bookmarkslist) {
if (model.getQuestion().equals(questionModelList.get(postion).getQuestion())
&& model.getCorrectAns().equals(questionModelList.get(postion).getCorrectAns())
&& model.getSetNo() == questionModelList.get(postion).getSetNo()) {
matched = true;
matchedQuestionPosition = i;
}
i++;
}
return matched;
}
private void storeBookmarks() {
String json = gson.toJson(bookmarkslist);
editor.putString(KEY_NAME, json);
editor.commit();
}
}
| true
|
512b9620c0c1d46222a102ae7b4debd935577e8d
|
Java
|
mayckolbryan/workSpaceJavaFullStack
|
/cineapp-backend/src/main/java/com/mitocode/dao/IGeneroDAO.java
|
UTF-8
| 236
| 1.507813
| 2
|
[] |
no_license
|
/**
*
*/
package com.mitocode.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import com.mitocode.model.Genero;
/**
* @author BRYAN
*
*/
public interface IGeneroDAO extends JpaRepository<Genero, Integer>{
}
| true
|
1b00ea60e3f76370d68c9654d237e05d011afcdf
|
Java
|
erickweil/labmanager
|
/LabManager-Client/src/br/erickweil/labmanager/client/slave/SlaveServerProtocol.java
|
ISO-8859-1
| 10,033
| 1.8125
| 2
|
[] |
no_license
|
/*
* Copyright (C) 2018 Erick Leonardo Weil
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package br.erickweil.labmanager.client.slave;
import br.erickweil.labamanger.common.BroadcasterMessage;
import br.erickweil.labamanger.common.Program;
import br.erickweil.labmanager.client.ClientApp;
import br.erickweil.labmanager.client.protocol.LabProtocol;
import br.erickweil.labmanager.cmd.ProgramOpener;
import br.erickweil.labmanager.start.Inicio;
import br.erickweil.labmanager.threadsafeness.ThreadSafeListener;
import br.erickweil.labmanager.threadsafeness.ThreadSafeHandler;
import br.erickweil.labmanager.threadsafeness.ThreadSafeHandler.DataLink;
import br.erickweil.labmanager.client.ClientCmdProtocol;
import br.erickweil.webserver.ReaderWriter;
import br.erickweil.webserver.ServerProtocol;
import java.io.BufferedReader;
import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.SocketException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.OpenOption;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.PatternSyntaxException;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
/**
* <strong>Classe que implementa o protocolo de comunicao da parte servidor</strong>
*
*
*
*/
public class SlaveServerProtocol extends ServerProtocol {
private final ThreadSafeListener listener;
private final ThreadSafeHandler<BroadcasterMessage> handler;
public SlaveServerProtocol(final ThreadSafeHandler<BroadcasterMessage> handler, final ThreadSafeListener listener)
{
this.handler = handler;
this.listener = listener;
}
// debgu only;
private void print(String txt, int uuid)
{
//long ns = System.nanoTime() - nano;
//String time = String.format("%,d", ns);
//if(LOG_msgs)
//{
// System.out.println("Arrived:"+uuid+"("+txt+")");
//}
//else
System.out.println(txt);
}
/**
* Aqui que processado a comunicao de um cliente.
*
* lido a primeira linha, que indica a verso.<br/>
* atualmente a verso aceita 21.01.18.15.43<br/>
*
* <p>de acordo com a verso processado as requisies e
* esse mtodo no retorna at que acontea algum erro na
* comunicao ou o cliente desconecte.<p>
*
*
* @throws IOException
*/
@Override
public void processRequest() throws IOException {
try
{
System.out.print("Checando Cliente");
String client_ip = socket.getInetAddress().getHostAddress();
int client_port = socket.getPort();
String client_hostname;
System.out.print(".");
client_hostname = socket.getInetAddress().getCanonicalHostName();
System.out.print(".");
System.out.println("IP:"+client_ip);
System.out.println("HOSTNAME:"+client_hostname);
System.out.println("LOOPBACK:"+socket.getInetAddress().isLoopbackAddress());
if(!socket.getInetAddress().isLoopbackAddress())
{
System.err.println("cliente tentando conectar de fora");
return;
}
process();
}
catch (SocketException | EOFException e){
System.out.println("Cliente Desconectou:"+e.getMessage());
}
catch (IOException e){
System.out.println("Erro ao Desconectar:"+e.getMessage());
e.printStackTrace();
}
catch (Exception e){
e.printStackTrace();
}
finally {
}
}
private void process() throws IOException, ParseException {
String txt;
String status;
System.out.print(" .");
String gen_uuid = readln_url();
File arquivo_verificador = new File(gen_uuid+".txt");
Files.write(arquivo_verificador.toPath(), "aaaa a a a, bbbbb b b bebe cai e levanta, vamos emboora...".getBytes());
writeln_url("OK");
status = readln_url();
if(!status.equals("OK"))
{
System.err.println("Resposta '"+status+"' na validao da comunicao");
}
arquivo_verificador.delete();
if(!ClientApp.slaveConnectedOnce )
{
List<Program> blacklist = ClientApp._getBlackList();
for (int i = 0; i < blacklist.size(); i++) {
if(blacklist.get(i).start == Program.StartType.logon)
{
writeln_url("start 2");
writeln_url(blacklist.get(i).path);
writeln_url(blacklist.get(i).process);
status = readln_url();
if(!status.equals("OK"))
print(status,-1);
}
}
}
ClientApp.slaveConnectedOnce = true;
handler.waitMessage();
DataLink<BroadcasterMessage> link = handler.getMessage();
while (true) {
BroadcasterMessage msg = link.getData();
if (msg == null) {
break;
}
if (msg.arguments == null || msg.arguments.length == 0) {
writeln_url(msg.cmd.toString());
} else {
writeln_url(msg.cmd.toString() + " " + msg.arguments.length);
for (int i = 0; i < msg.arguments.length; i++) {
writeln_url(msg.arguments[i]);
}
}
if(msg.binary_data != null)
output.write(msg.binary_data);
status = readln_url();
if(!status.equals("OK"))
print(status,msg.msg_uuid);
if(status.equals("OK") && msg.cmd.responseType() == BroadcasterMessage.MessageResponse.binary)
{
int msg_length = Integer.parseInt(readln_url());
byte[] binary_response = new byte[msg_length];
input.readFully(binary_response);
if(listener != null)
{
listener.sendEvent(SlaveApp.CLIENT_RESPONSE, msg.msg_uuid, status,new LabProtocol.Response(msg.msg_uuid,status,binary_response));
}
}
else if(status.equals("OK") && msg.cmd.responseType() == BroadcasterMessage.MessageResponse.text)
{
int msg_length = Integer.parseInt(readln_url());
String[] text_response = new String[msg_length];
for(int i=0;i<msg_length;i++)
{
text_response[i] = readln_url();
}
if(listener != null)
{
listener.sendEvent(SlaveApp.CLIENT_RESPONSE, msg.msg_uuid, status,new LabProtocol.Response(msg.msg_uuid,status,text_response));
}
}
else if(listener != null) // isso pode dar problema, tudo culpa da Splash Screen
// depois tem q achar jeito melhor de saber se o slave ta on
//if(msg.cmd.responseType() != BroadcasterMessage.MessageResponse.none)
{
listener.sendEvent(SlaveApp.CLIENT_RESPONSE, msg.msg_uuid, status, null);
}
if(!status.equals("OK") && !status.equals("pong"))
{
System.err.println("Resposta '"+status+"' para o comando '"+msg.cmd+"' ");
}
//String threadname = txt.substring(0,txt.indexOf(' '));
//String msg = txt.substring(txt.indexOf(' ')+1);
/*if (msg.threadname.equals(name) || msg.threadname.equals(BroadcasterMessage.All)) {
if (listener != null && send_connected) {
listener.sendEvent(ServerApp.CLIENT_PROCESSING, name, "Processando:");
}
if (msg.arguments.length == 0) {
write(msg.cmd.toString());
} else {
write(msg.cmd.toString() + " " + msg.arguments.length);
for (int i = 0; i < msg.arguments.length; i++) {
write(msg.arguments[i]);
}
}
if (msg.binary_data != null) {
output.write(msg.binary_data);
}
response = read();
print(response);
if(response.equals("OK") && msg.binary_response)
{
int msg_length = Integer.parseInt(read());
byte[] binary_response = new byte[msg_length];
input.read(binary_response);
}
}*/
DataLink<BroadcasterMessage> n = link.next();
if (n == null) {
handler.waitMessage();
n = link.next();
}
link = n;
}
print("Terminou",0);
}
@Override
public int getTimeout()
{
return 0;
}
}
| true
|
3567900a24a56f349a60ed65b5cc0f1e1806f4bb
|
Java
|
a-v-k/profiles_challenge
|
/app/src/main/java/org/digicraft/profiles/ui/profileview/ProfileViewFragment.java
|
UTF-8
| 6,935
| 2.125
| 2
|
[] |
no_license
|
package org.digicraft.profiles.ui.profileview;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import org.digicraft.profiles.R;
import org.digicraft.profiles.data.model.Profile;
import org.digicraft.profiles.data.viewmodel.ProfileListViewModel;
import org.digicraft.profiles.ui.base.BaseFragment;
import java.util.Objects;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
import androidx.lifecycle.ViewModelProviders;
/**
* Created by Andrey Koryazhkin on 07-03-2019.
*/
public class ProfileViewFragment extends BaseFragment {
private static final String ARG_PROFILE_ID = "arg_profile_id";
private Integer mProfileId = null;
private Profile mProfile = null;
private ProfileListViewModel mViewModel;
private TextView mTxtName;
private TextView mTxtAge;
private EditText mTxtHobbies;
private TextView mTxtGender;
@SuppressWarnings("FieldCanBeLocal")
private Button mBtnSave;
private ImageView mImgPerson;
private TextView mTvImage;
public static ProfileViewFragment newInstance(Integer profileId) {
ProfileViewFragment profileViewFragment = new ProfileViewFragment();
Bundle args = new Bundle();
args.putInt(ARG_PROFILE_ID, profileId);
profileViewFragment.setArguments(args);
return profileViewFragment;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mProfileId = getArguments().getInt(ARG_PROFILE_ID, Integer.MIN_VALUE);
}
if (mProfileId == null || mProfileId == Integer.MIN_VALUE) {
throw new IllegalArgumentException("ARG_PROFILE_ID should be defined");
}
mViewModel = ViewModelProviders.of(Objects.requireNonNull(getActivity())).get(ProfileListViewModel.class);
mViewModel.setCurrentProfileId(mProfileId);
mViewModel.getSingleProfileLiveData().observe(this, profile -> {
if (profile != null) {
mProfile = profile;
fillProfile(profile);
}
});
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.profile_view_fragment, container, false);
Toolbar toolbar = view.findViewById(R.id.toolbar);
toolbar.setNavigationIcon(R.drawable.ic_baseline_arrow_back_24px);
toolbar.setNavigationOnClickListener(v -> onBackPressed());
toolbar.setTitle(R.string.title_profile_view);
toolbar.inflateMenu(R.menu.menu_profile_view);
toolbar.setOnMenuItemClickListener(this::onOptionsItemSelected);
mImgPerson = view.findViewById(R.id.img_person);
mTvImage = view.findViewById(R.id.tv_image_hint);
mTvImage.setVisibility(View.GONE);
mTxtName = view.findViewById(R.id.txt_name);
mTxtAge = view.findViewById(R.id.txt_age);
mTxtHobbies = view.findViewById(R.id.txt_hobbies);
mTxtGender = view.findViewById(R.id.txt_gender);
mBtnSave = view.findViewById(R.id.btn_save); // todo: make the menu instead of button
mBtnSave.setOnClickListener(v -> saveProfile());
return view;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
case R.id.action_delete:
deleteProfileDialog();
return true;
}
return (super.onOptionsItemSelected(item));
}
private void fillProfile(Profile profile) {
if (profile.getImage() != null && !profile.getImage().isEmpty()) {
Glide.with(this).load(profile.getImage()).centerCrop().into(mImgPerson);
mTvImage.setVisibility(View.GONE);
} else {
mTvImage.setText(R.string.no_image);
mTvImage.setVisibility(View.VISIBLE);
}
mTxtName.setText(profile.getName());
mTxtAge.setText(makeAgeString(profile));
mTxtGender.setText(makeGenderString(profile));
mTxtHobbies.setText(profile.getHobbies());
}
private String makeAgeString(Profile profile) {
return Objects.requireNonNull(getContext()).getString(R.string.age_dots, profile.getAge());
}
private String makeGenderString(Profile profile) {
Context context = Objects.requireNonNull(getContext());
String gender;
if (Profile.GENDER_MALE.equals(profile.getGender())) {
gender = context.getString(R.string.male);
} else {
gender = context.getString(R.string.female);
}
return context.getString(R.string.gender_dots, gender);
}
private void saveProfile() {
mProfile.setHobbies(mTxtHobbies.getText().toString());
showLoading();
mViewModel.updateProfile(mProfile).observe(this, result -> {
if (result != null) {
hideLoading();
if (result) {
onBackPressed();
}
} else {
showMessage("Error"); // todo: make good message
}
});
}
private void deleteProfileDialog() {
new AlertDialog.Builder(Objects.requireNonNull(getContext()))
.setMessage(R.string.delete_confirmation)
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(android.R.string.yes, (dialog, whichButton) -> deleteProfile())
.setNegativeButton(android.R.string.no, (dialog, which) -> dialog.dismiss()).show();
}
private void deleteProfile() {
// TODO: 3/9/19 show confirmation dialog
if (mProfile != null && mProfile.getFbId() != null && !mProfile.getFbId().isEmpty()) {
showLoading();
mViewModel.deleteProfile(mProfile).observe(this, result -> {
if (result != null) {
if (result) {
hideLoading();
onBackPressed();
} else {
hideLoading();
showMessage("Error while deleting profile");
}
}
});
}
}
private void onBackPressed() {
//noinspection ConstantConditions
getActivity().getSupportFragmentManager().popBackStackImmediate();
}
}
| true
|
60a8b751a115f73b7d0017bf2c62386e02b6598c
|
Java
|
Caspering/inventory_management
|
/src/main/java/com/kasperin/inventory_management/bootstrap/Bootstrap.java
|
UTF-8
| 14,751
| 2.0625
| 2
|
[
"MIT"
] |
permissive
|
/*
package com.kasperin.inventory_management.bootstrap;
import com.kasperin.inventory_management.domain.Items.FruitAndVege;
import com.kasperin.inventory_management.domain.Items.ProcessedFood;
import com.kasperin.inventory_management.domain.Items.Stationary;
import com.kasperin.inventory_management.domain.commerce.PurchaseOrder;
import com.kasperin.inventory_management.domain.customer.Member;
import com.kasperin.inventory_management.domain.enums.FoodType;
import com.kasperin.inventory_management.domain.enums.PaymentType;
import com.kasperin.inventory_management.repository.ItemsRepository.FruitAndVegeRepository;
import com.kasperin.inventory_management.repository.ItemsRepository.ProcessedFoodRepo;
import com.kasperin.inventory_management.repository.ItemsRepository.StationaryRepository;
import com.kasperin.inventory_management.repository.commerceRepository.PurchaseOrderRepository;
import com.kasperin.inventory_management.repository.customerRepository.MemberRepository;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Slf4j
@Component
@AllArgsConstructor
//@Profile("default")
@Data
public class Bootstrap implements ApplicationListener<ContextRefreshedEvent> {
private final FruitAndVegeRepository fruitAndVegeRepository;
private final StationaryRepository stationaryRepository;
private final ProcessedFoodRepo processedFoodRepo;
private final PurchaseOrderRepository purchaseOrderRepository;
private final MemberRepository memberRepository;
//private DataModel model;
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
List<FruitAndVege> savedFAV = fruitAndVegeRepository.saveAll(getFruitAndVeges());
log.info("Produce saved: {}", savedFAV);
List<ProcessedFood> savedPF = processedFoodRepo.saveAll(getProcessedFood());
log.info("Processed foods saved: {}", savedPF);
List<Stationary> savedSt = stationaryRepository.saveAll(getStationary());
log.info("Stationary saved: {}", savedSt);
List<PurchaseOrder> savedPO = purchaseOrderRepository.saveAll(getPurchaseOrder());
log.info("PurchaseOrder saved: {}", savedPO);
List<Member> savedMember= memberRepository.saveAll(getMembers());
log.info("Member saved: {}", savedMember);
//loadInMemory();
// log.info("Preferences: {}", this.loadInMemory().toString());
}
// //@Bean
//public DataModel loadInMemory(){
//
// FastByIDMap<PreferenceArray> preferences = new FastByIDMap<PreferenceArray>();
// PreferenceArray prefsForJohn = new GenericItemPreferenceArray(10);
// prefsForJohn.setUserID(0, 1);
// prefsForJohn.setItemID(0, 1L);
// prefsForJohn.setValue(0, 3.0f);
//
// prefsForJohn.setItemID(1, 2L);
// prefsForJohn.setValue(1, 4.5f);
//
// prefsForJohn.setItemID(1, 3L);
// prefsForJohn.setValue(2, 4.5f);
//
// prefsForJohn.setItemID(1, 4L);
// prefsForJohn.setValue(1, 4.5f);
//
// prefsForJohn.setItemID(1, 3L);
// prefsForJohn.setValue(2, 4.5f);
//
// prefsForJohn.setItemID(1, 2L);
// prefsForJohn.setValue(1, 4.5f);
//
// prefsForJohn.setItemID(1, 3L);
// prefsForJohn.setValue(2, 4.5f);
//
// prefsForJohn.setItemID(7, 2L);
// prefsForJohn.setValue(1, 4.5f);
//
// prefsForJohn.setItemID(1, 3L);
// prefsForJohn.setValue(2, 4.5f);
//
// prefsForJohn.setItemID(1, 2L);
// prefsForJohn.setValue(1, 4.5f);
//
// preferences.put(1L, prefsForJohn);
//
//
// PreferenceArray prefsForMike = new GenericItemPreferenceArray(10);
// prefsForMike.setUserID(0, 2);
// prefsForMike.setItemID(0, 1L);
// prefsForMike.setValue(0, 3.0f);
//
// prefsForMike.setItemID(1, 2L);
// prefsForMike.setValue(1, 4.5f);
//
// prefsForMike.setItemID(1, 3L);
// prefsForMike.setValue(2, 4.5f);
//
// prefsForMike.setItemID(1, 4L);
// prefsForMike.setValue(1, 4.5f);
//
// prefsForMike.setItemID(1, 3L);
// prefsForMike.setValue(2, 4.5f);
//
// prefsForMike.setItemID(1, 2L);
// prefsForMike.setValue(1, 4.5f);
//
// prefsForMike.setItemID(1, 3L);
// prefsForMike.setValue(2, 4.5f);
//
// prefsForMike.setItemID(7, 2L);
// prefsForMike.setValue(1, 4.5f);
//
// prefsForMike.setItemID(1, 3L);
// prefsForMike.setValue(2, 4.5f);
//
// prefsForMike.setItemID(1, 2L);
// prefsForMike.setValue(1, 4.5f);
//
// preferences.put(2L, prefsForMike);
//
//
//
// DataModel model = new GenericDataModel(preferences);
//
// return model;
//
// }
private List<Member> getMembers(){
List<Member> members = new ArrayList<>();
Member m1 = new Member();
m1.setEmail("johndoe@gmail.com");
m1.setFirstName("John");
m1.setLastName("Doe");
m1.setPhoneNumber("234-234-2222");
// m1.addPurchaseOrder(new PurchaseOrder(LocalDate.now(),34,"004453333893",PaymentType.CASH,
// getFruitAndVeges(), getStationary(),getProcessedFood()));
// m1.addPurchaseOrder(new PurchaseOrder(LocalDate.now(),14,"177004453333893",PaymentType.CASH,
// getFruitAndVeges(), getStationary(),getProcessedFood()));
members.add(m1);
Member m2 = new Member();
m2.setEmail("mlo1@gmail.com");
m2.setFirstName("Mike");
m2.setLastName("Long");
m2.setPhoneNumber("334-234-2222");
//m2.setPurchaseOrders(getPurchaseOrderSet());
members.add(m2);
Member m3 = new Member();
m3.setEmail("bens@gmail.com");
m3.setFirstName("Ben");
m3.setLastName("Skye");
m3.setPhoneNumber("253-234-2222");
//m3.setPurchaseOrders(getPurchaseOrderSet());
members.add(m3);
Member m4 = new Member();
m4.setEmail("awest@gmail.com");
m4.setMemberNumber("bs11223");
m4.setFirstName("Asia");
m4.setLastName("West");
m4.setPhoneNumber("206-204-1002");
//m3.setPurchaseOrders(getPurchaseOrderSet());
members.add(m4);
return members;
}
public List<FruitAndVege> getFruitAndVeges(){
List<FruitAndVege> fruitAndVeges = new ArrayList<>();
FruitAndVege fav1 = new FruitAndVege();
fav1.setName("Banana");
fav1.setBarcode("12335663");
fav1.setInStockQuantity(5);
fav1.setPrice(2.99);
fruitAndVeges.add(fav1);
FruitAndVege fav2 = new FruitAndVege();
fav2.setName("Orange");
fav2.setBarcode("12233323");
fav2.setInStockQuantity(54);
fav2.setPrice(1.99);
fruitAndVeges.add(fav2);
FruitAndVege fruitAndVege3 = new FruitAndVege();
fruitAndVege3.setName("Pineapple");
fruitAndVege3.setBarcode("133006");
fruitAndVege3.setInStockQuantity(8);
fruitAndVege3.setPrice(3.8);
fruitAndVeges.add(fruitAndVege3);
FruitAndVege fruitAndVege4 = new FruitAndVege();
fruitAndVege4.setName("Watermelon");
fruitAndVege4.setBarcode("1333234006");
fruitAndVege4.setInStockQuantity(18);
fruitAndVege4.setPrice(1.8);
fruitAndVeges.add(fruitAndVege4);
FruitAndVege fruitAndVege5 = new FruitAndVege();
fruitAndVege5.setName("Jack Fruit");
fruitAndVege5.setBarcode("189930033006");
fruitAndVege5.setInStockQuantity(28);
fruitAndVege5.setPrice(1.8);
fruitAndVeges.add(fruitAndVege5);
FruitAndVege fruitAndVege6 = new FruitAndVege();
fruitAndVege6.setName("Apple");
fruitAndVege6.setBarcode("1320294093006");
fruitAndVege6.setInStockQuantity(8);
fruitAndVege6.setPrice(3.18);
fruitAndVeges.add(fruitAndVege6);
FruitAndVege fruitAndVege7 = new FruitAndVege();
fruitAndVege7.setName("Mango");
fruitAndVege7.setBarcode("13304257706");
fruitAndVege7.setInStockQuantity(8);
fruitAndVege7.setPrice(3.89);
fruitAndVeges.add(fruitAndVege7);
FruitAndVege fruitAndVege8 = new FruitAndVege();
fruitAndVege8.setName("Carrot");
fruitAndVege8.setBarcode("1377773333006");
fruitAndVege8.setInStockQuantity(8);
fruitAndVege8.setPrice(3.8);
fruitAndVeges.add(fruitAndVege8);
return fruitAndVeges;
}
private Set<FruitAndVege> getFruitAndVegesSet(){
Set<FruitAndVege> fruitAndVeges = new HashSet<>();
fruitAndVeges.addAll(getFruitAndVeges());
return fruitAndVeges;
}
private List<ProcessedFood> getProcessedFood() {
List<ProcessedFood> proFood = new ArrayList<>();
ProcessedFood savedProcessedFood = new ProcessedFood();
savedProcessedFood.setName("Chips");
savedProcessedFood.setBarcode("12345");
savedProcessedFood.setPrice(1.3);
savedProcessedFood.setFoodType(FoodType.VEGAN);
savedProcessedFood.setInStockQuantity(30);
// savedProcessedFood.setPurchaseOrder();
proFood.add(savedProcessedFood);
ProcessedFood proFood2 = new ProcessedFood();
proFood2.setName("burger");
proFood2.setBarcode("123450000088");
proFood2.setPrice(1.3);
proFood2.setFoodType(FoodType.VEGAN);
proFood2.setInStockQuantity(23);
proFood.add(proFood2);
ProcessedFood proFood3 = new ProcessedFood();
proFood3.setName("fries");
proFood3.setBarcode("1238989898045");
proFood3.setPrice(1.3);
proFood3.setFoodType(FoodType.NONVEGAN);
proFood3.setInStockQuantity(33);
proFood.add(proFood3);
return proFood;
}
private Set<ProcessedFood> getProcessedFoodSet(){
Set<ProcessedFood> processedFoods = new HashSet<>();
processedFoods.addAll(getProcessedFood());
return processedFoods;
}
private List<Stationary> getStationary() {
List<Stationary> stationaries = new ArrayList<>();
Stationary st1 = new Stationary();
st1.setName("Glue");
st1.setBarcode("189999892345");
st1.setPrice(1.3);
st1.setInStockQuantity(13);
stationaries.add(st1);
Stationary st2 = new Stationary();
st2.setName("Pencil");
st2.setBarcode("1234533333");
st2.setPrice(1.3);
st2.setInStockQuantity(13);
stationaries.add(st2);
Stationary st3 = new Stationary();
st3.setName("Ink");
st3.setBarcode("12346621115");
st3.setPrice(1.3);
st3.setInStockQuantity(13);
stationaries.add(st3);
Stationary st4 = new Stationary();
st4.setName("Ruler");
st4.setBarcode("12434456245");
st4.setPrice(1.4);
st4.setInStockQuantity(13);
stationaries.add(st4);
Stationary st5 = new Stationary();
st5.setName("Eraser");
st5.setBarcode("1254222002335");
st5.setPrice(1.5);
st5.setInStockQuantity(18);
stationaries.add(st5);
return stationaries;
}
private Set<Stationary> getStationarySet(){
Set<Stationary> stationarys = new HashSet<>();
stationarys.addAll(getStationary());
return stationarys;
}
private List<PurchaseOrder> getPurchaseOrder(){
// ProcessedFood savedProcessedFood = new ProcessedFood();
// savedProcessedFood.setName("Chips");
// savedProcessedFood.setBarcode("12345");
// savedProcessedFood.setPrice(1.3);
// savedProcessedFood.setFoodType(FoodType.VEGAN);
// savedProcessedFood.setInStockQuantity(13);
//savedProcessedFood.setPurchaseOrder(new PurchaseOrder());
// FruitAndVege fav1 = new FruitAndVege();
// fav1.setName("Banana");
// fav1.setBarcode("12335663");
// fav1.setInStockQuantity(5);
// fav1.setPrice(2.99);
//
// FruitAndVege fav2 = new FruitAndVege();
// fav2.setName("Orange");
// fav2.setBarcode("12233323");
// fav2.setInStockQuantity(54);
// fav2.setPrice(1.99);
//
// Member m1 = new Member();
// m1.setEmail("jd@gmail.com");
// m1.setMemberNumber("jb11223");
// m1.setFirstName("John");
// m1.setLastName("Doe");
// m1.setPhoneNumber("234-234-2222");
// //m1.setPurchaseOrders(getPurchaseOrderSet());
//
Member m2 = new Member();
m2.setEmail("ml@gmail.com");
m2.setMemberNumber("ml11223");
m2.setFirstName("Mike");
m2.setLastName("Long");
m2.setPhoneNumber("334-234-2222");
//m2.setPurchaseOrders(getPurchaseOrderSet());
List<PurchaseOrder> purchaseOrders = new ArrayList<>();
PurchaseOrder PO1 = new PurchaseOrder();
PO1.setDateCreated(LocalDate.now());
PO1.setPaymentType(PaymentType.CARD);
// PO1.setMember(m2);
//PO1.getTotalNumberOfItemsInPurchaseOrder();
//PO1.setPurchaseOrderNumber("1233988393893893");
//PO1.setFruitAndVeges(getFruitAndVegesSet());
purchaseOrders.add(PO1);
PurchaseOrder PO2 = new PurchaseOrder();
//PO2.setMember(m2);
//PO2.setMemberNumber();
PO2.setDateCreated(LocalDate.now());
PO2.setPaymentType(PaymentType.CARD);
//PO2.getTotalNumberOfItemsInPurchaseOrder();
// PO2.setReceiptNumber("13334988393893893");
// PO2.getFruitAndVeges().add(fav1);
// PO2.getFruitAndVeges().add(fav2);
// PO2.setMemberNumber(m1.getMemberNumber());
// proFood.add(savedProcessedFood);
purchaseOrders.add(PO2);
PurchaseOrder PO3 = new PurchaseOrder();
//PO3.setMember(m2);
// PO3.setMemberNumber();
PO3.setDateCreated(LocalDate.now());
PO3.setPaymentType(PaymentType.CASH);
//PO3.getTotalNumberOfItemsInPurchaseOrder();
//PO3.setPurchaseOrderNumber("004453333893");
//PO3.setFruitAndVeges(getFruitAndVegesSet());
// PO3.setProcessedFoods(getProcessedFoodSet());
// PO3.setStationaries(getStationarySet());
purchaseOrders.add(PO3);
return purchaseOrders;
}
private Set<PurchaseOrder> getPurchaseOrderSet(){
Set<PurchaseOrder> purchaseOrders = new HashSet<>();
purchaseOrders.addAll(getPurchaseOrder());
return purchaseOrders;
}
}
*/
| true
|
6b8dfe6af6caf597a6f030c7a5e95945f4d612b2
|
Java
|
NGoutcher/Platform-Game
|
/src/com/nathan/game/graphics/Spritesheet.java
|
UTF-8
| 4,652
| 2.71875
| 3
|
[] |
no_license
|
package com.nathan.game.graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
public class Spritesheet {
private String path;
public final int SIZE;
public final int SPRITE_WIDTH, SPRITE_HEIGHT;
private int width, height;
public int[] pixels;
public BufferedImage image;
public static Spritesheet tiles = new Spritesheet("/Textures/sheets/spritesheet.png", 256);
public static Spritesheet spawn_level = new Spritesheet("/Textures/sheets/spawnsheet.png", 48);
public static Spritesheet projectile_wizard = new Spritesheet("/Textures/sheets/projectiles/wizard.png", 48);
public static Spritesheet player = new Spritesheet("/Textures/sheets/charactersheets/spritesheet.png", 256);
public static Spritesheet player_down = new Spritesheet(player, 0, 0, 1, 3, 32);
public static Spritesheet player_up = new Spritesheet(player, 2, 0, 1, 3, 32);
public static Spritesheet player_left = new Spritesheet(player, 1, 0, 1, 3, 32);
public static Spritesheet player_right = new Spritesheet(player, 3, 0, 1, 3, 32);
public static Spritesheet priest_mob = new Spritesheet("/Textures/sheets/charactersheets/priest_sheet.png", 256);
public static Spritesheet dummy_down = new Spritesheet(priest_mob, 0, 0, 1, 3, 32);
public static Spritesheet dummy_up = new Spritesheet(priest_mob, 2, 0, 1, 3, 32);
public static Spritesheet dummy_left = new Spritesheet(priest_mob, 1, 0, 1, 3, 32);
public static Spritesheet dummy_right = new Spritesheet(priest_mob, 3, 0, 1, 3, 32);
public static Spritesheet goblin = new Spritesheet("/Textures/sheets/charactersheets/goblin.png", 256);
public static Spritesheet goblin_down = new Spritesheet(goblin, 0, 0, 1, 3, 32);
public static Spritesheet goblin_up = new Spritesheet(goblin, 2, 0, 1, 3, 32);
public static Spritesheet goblin_left = new Spritesheet(goblin, 1, 0, 1, 3, 32);
public static Spritesheet goblin_right = new Spritesheet(goblin, 3, 0, 1, 3, 32);
public static Spritesheet goodMage = new Spritesheet("/Textures/sheets/charactersheets/goodmage.png", 256);
public static Spritesheet goodMage_down = new Spritesheet(goodMage, 0, 0, 1, 3, 32);
public static Spritesheet goodMage_up = new Spritesheet(goodMage, 2, 0, 1, 3, 32);
public static Spritesheet goodMage_left = new Spritesheet(goodMage, 1, 0, 1, 3, 32);
public static Spritesheet goodMage_right = new Spritesheet(goodMage, 3, 0, 1, 3, 32);
public static Spritesheet potions = new Spritesheet("/Textures/sheets/potions.png", 256);
public static Spritesheet weapons = new Spritesheet("/Textures/sheets/weapons.png", 256);
private Sprite[] sprites;
public Spritesheet(String path, int width, int height) {
this.path = path;
SIZE = -1;
SPRITE_WIDTH = width;
SPRITE_HEIGHT = height;
pixels = new int[SPRITE_WIDTH * SPRITE_HEIGHT];
load();
}
public Spritesheet(Spritesheet sheet, int x, int y, int width, int height, int spriteSize) {
int xx = x * spriteSize;
int yy = y * spriteSize;
int w = width * spriteSize;
int h = height * spriteSize;
if (width == height) SIZE = width;
else SIZE = -1;
SPRITE_WIDTH = w;
SPRITE_HEIGHT = h;
pixels = new int[w * h];
for (int y0 = 0; y0 < h; y0++) {
int yp = yy + y0;
for (int x0 = 0; x0 < w; x0++) {
int xp = xx + x0;
pixels[x0 + y0 * w] = sheet.pixels[xp + yp * sheet.SPRITE_WIDTH];
}
}
int frame = 0;
sprites = new Sprite[width * height];
for (int ya = 0; ya < height; ya++) {
for (int xa = 0; xa < width; xa++) {
int[] spritePixels = new int[spriteSize * spriteSize];
for (int y0 = 0; y0 < spriteSize; y0++) {
for (int x0 = 0; x0 < spriteSize; x0++) {
spritePixels[x0 + y0 * spriteSize] = pixels[(x0 + xa * spriteSize) + (y0 + ya * spriteSize) * SPRITE_WIDTH];
}
}
Sprite sprite = new Sprite(spritePixels, spriteSize, spriteSize);
sprites[frame++] = sprite;
}
}
}
public Spritesheet(String path, int size) {
this.path = path;
SIZE = size;
SPRITE_WIDTH = size;
SPRITE_HEIGHT = size;
load();
}
public Sprite[] getSprites() {
return sprites;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public int[] getPixels() {
return pixels;
}
private void load() {
try {
image = ImageIO.read(Spritesheet.class.getResource(path));
width = image.getWidth();
height = image.getHeight();
pixels = new int[width * height];
image.getRGB(0, 0, width, height, pixels, 0, width);
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
System.err.println("Failed!");
}
}
public BufferedImage getImage() {
return image;
}
}
| true
|
0b1b858975a52a6cdacbd25c7018f4a5463d2a6c
|
Java
|
Anugnu/CoreJava_SampleCodes
|
/Practice/src/practicePack/PhraseOmatic.java
|
UTF-8
| 649
| 3.34375
| 3
|
[] |
no_license
|
package practicePack;
public class PhraseOmatic {
String[] list1 = {"Am", "We", "They", "She", "He"};
String[] list2 = {"love", "is/are going", "moved to", "came from"};
String[] list3 = {"India.", "USA.", "Australia.", "Canada."};
public static void main(String[] args) {
PhraseOmatic obj = new PhraseOmatic();
obj.xyz();
}
public void xyz(){
int ran1 = (int) (Math.random() * list1.length);
int ran2 = (int) (Math.random() * list2.length);
int ran3 = (int) (Math.random() * list3.length);
System.out.println("What we have here- " + list1[ran1] + " " + list2[ran2]+ " " + list3[ran3]);
}
}
| true
|
ef6e37614ffc245a78faeb540a2af7929c13d8ea
|
Java
|
chandank44/the-GameBox
|
/the-gamebox/src/main/java/chandan/Services/Impl/CartServiceImpl.java
|
UTF-8
| 1,488
| 2.375
| 2
|
[] |
no_license
|
package chandan.Services.Impl;
import chandan.Dao.CartDao;
import chandan.Model.*;
import chandan.Services.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class CartServiceImpl implements CartService {
@Autowired
CartDao cartService;
/* (non-Javadoc)
* @see chandan.Services.Impl.CartService#getUser(java.lang.String)
*/
public User getUser(String p) {
User user = cartService.getUser(p);
return user;
}
/* (non-Javadoc)
* @see chandan.Services.Impl.CartService#addCartItem(chandan.Model.CartItem)
*/
public void addCartItem(CartItem cartItem) {
cartService.addCartItem(cartItem);
}
/* (non-Javadoc)
* @see chandan.Services.Impl.CartService#getCartitemByid(int)
*/
public CartItem getCartitemByid(int id) {
CartItem cart = cartService.getCartitemByid(id);
return cart;
}
/* (non-Javadoc)
* @see chandan.Services.Impl.CartService#removeCartItem(chandan.Model.CartItem)
*/
public void removeCartItem(CartItem item) {
cartService.removeCartItem(item);
}
/* (non-Javadoc)
* @see chandan.Services.Impl.CartService#getCartById(int)
*/
public Cart getCartById(int cartId) {
Cart cart = cartService.getCartById(cartId);
return cart;
}
/* (non-Javadoc)
* @see chandan.Services.Impl.CartService#removeAllCartItems(chandan.Model.Cart)
*/
public void removeAllCartItems(Cart cart) {
cartService.removeAllCartItems(cart);
}
}
| true
|
c91fcff817575d178ec412aab35d07840593cb0b
|
Java
|
arshvardhan/test
|
/MaxisGetIt/src/com/kelltontech/maxisgetit/response/matta/MattaHallListResponse.java
|
UTF-8
| 1,908
| 2.171875
| 2
|
[] |
no_license
|
package com.kelltontech.maxisgetit.response.matta;
import java.util.ArrayList;
import android.os.Parcel;
import android.os.Parcelable;
import com.kelltontech.framework.model.IModel;
import com.kelltontech.framework.model.MaxisResponse;
import com.kelltontech.maxisgetit.dao.matta.MattaBanner;
import com.kelltontech.maxisgetit.dao.matta.MattaHallList;
/**
* @author arsh.vardhan
* @modified 02-Aug-2014
*/
public class MattaHallListResponse extends MaxisResponse implements IModel, Parcelable {
private ArrayList<MattaHallList> mHallList = new ArrayList<MattaHallList>();
private ArrayList<MattaBanner> bannerList = new ArrayList<MattaBanner>();
public ArrayList<MattaHallList> getMattaHallList() {
return mHallList;
}
public void addMattaHallList(MattaHallList hallList) {
mHallList.add(hallList);
}
public ArrayList<MattaBanner> getBannerList() {
return bannerList;
}
public void addBanner(MattaBanner banner) {
this.bannerList.add(banner);
}
public static final Creator<MattaHallListResponse> CREATOR = new Creator<MattaHallListResponse>() {
@Override
public MattaHallListResponse createFromParcel(Parcel source) {
return new MattaHallListResponse(source);
}
@Override
public MattaHallListResponse[] newArray(int size) {
return new MattaHallListResponse[size];
}
};
@Override
public int describeContents() {
return 0;
}
public MattaHallListResponse(Parcel in) {
errorMessage = in.readString();
errorCode = in.readInt();
in.readTypedList(mHallList, MattaHallList.CREATOR);
in.readTypedList(bannerList, MattaBanner.CREATOR);
}
public MattaHallListResponse() {
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(errorMessage);
dest.writeInt(errorCode);
dest.writeTypedList(mHallList);
dest.writeTypedList(bannerList);
}
}
| true
|
32babf5489fb311fb2e8c9d70b9927a712f353fe
|
Java
|
bates94/assignment_primefaces
|
/src/main/java/com/example/demo/web/CountryController.java
|
UTF-8
| 2,265
| 2.3125
| 2
|
[] |
no_license
|
package com.example.demo.web;
import com.example.demo.models.Country;
import com.example.demo.models.User;
import com.example.demo.repositories.CountryRepository;
import com.example.demo.repositories.UserRepository;
import com.example.demo.utils.Messages;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.faces.context.FacesContext;
import javax.inject.Named;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;
@Named(value = "country")
@SessionScoped
public class CountryController implements Serializable {
private String city;
private String district;
private List<String> cityNames;
private List<String> districtNames;
@Autowired
CountryRepository countryRepository;
@Autowired
UserRepository userRepository;
@PostConstruct
public void init() {
cityNames = countryRepository.findAllCities();
districtNames = countryRepository.findAllDistricts(city);
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public List<String> getCityNames() {
return cityNames;
}
public void setCityNames(List<String> cityNames) {
this.cityNames = cityNames;
}
public List<String> getDistrictNames() {
return districtNames;
}
public void setDistrictNames(List<String> districtNames) {
this.districtNames = districtNames;
}
public void showDistricts(String city) {
this.city = city;
districtNames = countryRepository.findAllDistricts(city);
}
public void save() {
String username = FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal().getName();
User user = userRepository.findByUserName(username);
user.setCity(this.city);
user.setDistrict(this.district);
userRepository.save(user);
Messages.addMessage("User has been reorganized!");
}
public void add() {
}
}
| true
|
a39fa3571b6260163a24c643aa7e7e9605c33c22
|
Java
|
chyzh1689/pay
|
/pay-product/src/main/java/com/qh/pay/domain/PayPropertyDO.java
|
UTF-8
| 2,118
| 2.140625
| 2
|
[
"Apache-2.0"
] |
permissive
|
package com.qh.pay.domain;
import java.io.Serializable;
/**
* 支付参数配置
*
* @author chyzh
* @email 3048427407@qq.com
* @date 2017-10-27 17:52:44
*/
public class PayPropertyDO implements Serializable {
private static final long serialVersionUID = 1L;
//
private Integer id;
//支付公司 0 为系统默认参数
private String payCompany;
//商户号
private String merchantno;
// 0为普通文本 1 密码 2域名Ip 3 文件路径 4文件内容 5 商户号
private Integer configType;
//配置标识
private String configKey;
//值
private String value;
//名称说明
private String name;
/**
* 设置:
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取:
*/
public Integer getId() {
return id;
}
/**
* 设置:支付公司 0 为系统默认参数
*/
public void setPayCompany(String payCompany) {
this.payCompany = payCompany;
}
/**
* 获取:支付公司 0 为系统默认参数
*/
public String getPayCompany() {
return payCompany;
}
/**
* 设置:商户号
*/
public void setMerchantno(String merchantno) {
this.merchantno = merchantno;
}
/**
* 获取:商户号
*/
public String getMerchantno() {
return merchantno;
}
/**
* 设置: 0为普通文本 1 密码 2域名Ip 3 文件路径 4文件内容 5 商户号
*/
public void setConfigType(Integer configType) {
this.configType = configType;
}
/**
* 获取: 0为普通文本 1 密码 2域名Ip 3 文件路径 4文件内容 5 商户号
*/
public Integer getConfigType() {
return configType;
}
/**
* 设置:配置标识
*/
public void setConfigKey(String configKey) {
this.configKey = configKey;
}
/**
* 获取:配置标识
*/
public String getConfigKey() {
return configKey;
}
/**
* 设置:值
*/
public void setValue(String value) {
this.value = value;
}
/**
* 获取:值
*/
public String getValue() {
return value;
}
/**
* 设置:名称说明
*/
public void setName(String name) {
this.name = name;
}
/**
* 获取:名称说明
*/
public String getName() {
return name;
}
}
| true
|
291d960e951aa87cb92e890c18aeebe2fee8d306
|
Java
|
huweidongls/LHJWP
|
/app/src/main/java/com/jingna/lhjwp/dialog/CustomDialog.java
|
UTF-8
| 1,815
| 2.28125
| 2
|
[] |
no_license
|
package com.jingna.lhjwp.dialog;
import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
import com.jingna.lhjwp.R;
import com.yatoooon.screenadaptation.ScreenAdapterTools;
/**
* Created by Administrator on 2018/11/5.
*/
public class CustomDialog extends Dialog {
private Context context;
private String title;
private TextView tvTitle;
private TextView tvSure;
private TextView tvCancel;
private OnSureListener onSureListener;
public CustomDialog(@NonNull Context context, String title, OnSureListener onSureListener) {
super(context);
this.context = context;
this.title = title;
this.onSureListener = onSureListener;
initView();
}
private void initView() {
requestWindowFeature(Window.FEATURE_NO_TITLE);
View view = LayoutInflater.from(context).inflate(R.layout.dialog_custom, null);
setContentView(view);
ScreenAdapterTools.getInstance().loadView(view);
tvTitle = view.findViewById(R.id.tv_title);
tvSure = view.findViewById(R.id.tv_sure);
tvCancel = view.findViewById(R.id.tv_cancel);
tvTitle.setText(title);
tvSure.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onSureListener.onSure();
dismiss();
}
});
tvCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
}
public interface OnSureListener{
void onSure();
}
}
| true
|
784b7b5afc9f12379c2497d3ef96bb6b7f567d0e
|
Java
|
lwd112de/A4D_2017
|
/app/src/main/java/com/lwd112/lwd/a4d_2017/SettingsActivity.java
|
UTF-8
| 3,925
| 2.234375
| 2
|
[] |
no_license
|
package com.lwd112.lwd.a4d_2017;
import android.content.Intent;
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;
public class SettingsActivity extends AppCompatActivity implements CompoundButton.OnCheckedChangeListener{
Button settings_switch_01;
Button settings_switch_02;
Button settings_switch_03;
Button settings_switch_04;
TextView settings_alarm_text1;
TextView settings_alarm_text2;
TextView settings_alarm_text3;
TextView settings_alarm_text4;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
settings_alarm_text1 = (TextView)findViewById(R.id.settings_alarm_text1);
settings_alarm_text2 = (TextView)findViewById(R.id.settings_alarm_text2);
settings_alarm_text3 = (TextView)findViewById(R.id.settings_alarm_text3);
settings_alarm_text4 = (TextView)findViewById(R.id.settings_alarm_text4);
setupBackButton();
setupOkButton();
setupSettingsButton();
}
private void setupOkButton() {
Button btn_Settings2OK = (Button)findViewById(R.id.btn_Settings2OK);
btn_Settings2OK.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
private void setupBackButton() {
Button btn_Settings2Back = (Button)findViewById(R.id.btn_Settings2Back);
btn_Settings2Back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
private void setupSettingsButton()
{
ImageView btn_alarmSet1 = (ImageView)findViewById(R.id.settings_button_1);
ImageView btn_alarmSet2 = (ImageView)findViewById(R.id.settings_button_2);
ImageView btn_alarmSet3 = (ImageView)findViewById(R.id.settings_button_3);
ImageView btn_alarmSet4 = (ImageView)findViewById(R.id.settings_button_4);
btn_alarmSet1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent settingsTimeIntent1 = new Intent(v.getContext(), SettingsTimeActivity.class);
startActivity(settingsTimeIntent1);
}
});
btn_alarmSet2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent settingsTimeIntent2 = new Intent(v.getContext(), SettingsTimeActivity.class);
startActivity(settingsTimeIntent2);
}
});
btn_alarmSet3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent settingsTimeIntent3 = new Intent(v.getContext(), SettingsTimeActivity.class);
startActivity(settingsTimeIntent3);
}
});
btn_alarmSet4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent settingsTimeIntent4 = new Intent(v.getContext(), SettingsTimeActivity.class);
startActivity(settingsTimeIntent4);
}
});
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked)
{
//Toast.makeText(this,"Toggle Button ON",Toast.LENGTH_SHORT).show();
} else {
//
}
}
}
| true
|
5607554f219fffbf37c6c57d01a5c10272841bb2
|
Java
|
Matayas/Projet_test123
|
/Laboratoire/Laboratoire-1/src/gilm10129104/laboratoire1/Q1/Application.java
|
UTF-8
| 681
| 3.015625
| 3
|
[] |
no_license
|
package gilm10129104.laboratoire1.Q1;
/**
* Created by gilm101291 on 2018-01-30.
*/
public class Application {
public static void main(String[] args) {
String[] array = args;
String temp;
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array.length - 1 - i; j++) {
if (array[j].compareTo(array[j + 1]) > 0) {
temp = array[j];
array[j] = array[j + 1];
array[j + 1] = temp;
}
}
}
for (int i = 0; i < array.length; i++) {
System.out.println(array[i] + " ");
}
}
}
| true
|
af6c8e1c8bfdc34ee7761feccf856874424cbc31
|
Java
|
QA-Gabriel/Test
|
/Custom Exceptions/src/Main.java
|
UTF-8
| 645
| 3.25
| 3
|
[] |
no_license
|
public class Main {
public static void main(String xyz[]) throws MyExp{
int a, b, c;
a=b=c=0;
try{
a=0;
b=Integer.parseInt(xyz[1]);
c=a/b;
System.out.println("The Result: " + c);
if (a==0);
throw new MyExp();
}catch(MyExp x){
System.out.println("vmkldfngsjk");
}
catch(NumberFormatException x){
System.out.println("Please Only use numerical Values");
}catch(ArithmeticException abc){
System.out.println("Cannot divide by zero");
}catch(ArrayIndexOutOfBoundsException x){
System.out.println("Please Put 2 values");
}catch(Exception x ){
System.out.println("Any other exception");
}
}
}
| true
|
52c2b2f08b1aa7138f89a061d7180a4d5b253939
|
Java
|
nowto/api-mircoservices
|
/api-gateway/src/main/java/com/xunlu/api/gateway/security/Config.java
|
UTF-8
| 6,996
| 1.703125
| 2
|
[] |
no_license
|
package com.xunlu.api.gateway.security;
import com.xunlu.api.gateway.security.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.ForwardAuthenticationFailureHandler;
import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler;
import org.springframework.security.web.authentication.logout.LogoutFilter;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 配置Spring Security.
* 网关服务使用Spring Security只完成认证方式中token的认证,及鉴权.
* @author liweibo
*/
@EnableWebSecurity
public class Config extends WebSecurityConfigurerAdapter {
public static final String AUTHENTICATION_FAILURE_FORWARD_URL = "/authentication_failure";
@Autowired
private TokenService tokenService;
/**
* redisTemplate, key为string, value为json
* @param redisConnectionFactory
* @return
*/
@Bean
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
redisTemplate.setConnectionFactory(redisConnectionFactory);
redisTemplate.setKeySerializer(RedisSerializer.string());
redisTemplate.setValueSerializer(RedisSerializer.json());
redisTemplate.setHashKeySerializer(RedisSerializer.string());
redisTemplate.setHashValueSerializer(RedisSerializer.json());
redisTemplate.afterPropertiesSet();
return redisTemplate;
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and().formLogin().disable().httpBasic().disable().csrf().disable().cors().disable();
// 鉴权
http.authorizeRequests()// 网关负责鉴权
.antMatchers(
"/logout",
"/act/**",
"/article/share",
"/article/collect/option",
"/article/collect/query",
"/article/collect/status",
"/chart/plans",
"/chart/plan/del",
"/feature/**",
"/user/feedback/**",
"/hotel/**",
"/logout",
"/merchant/addMerchantEntry",
"/plan/delPlan",
"/plan/renamePlan",
"/plan/timeMeasure",
"/plan/geneby",
"/plan/smallTraffic/list",
"/plan/smallTraffic",
"/plan/train/list",
"/plan/hotel/list",
"/plan/hotel/list/filter",
"/plan/hotel",
"/plan/collect/add",
"/plan/collect/cancel",
"/plan/share",
"/plan/listFlight",
"/plan/changeFlight",
"/plan/changeTrain",
"/plan/listHotel",
"/plan/changeHotel",
"/plan/save",
"/plan/be56e057f20f883e",
"/plan/adjust/sight",
"/plan/quote",
"/plan/listRoute/filter",
"/plan/listssNew",
"/plan/listss/filter",
"/plan/listss",
"/plan/ssList/filter",
"/plan/routeList",
"/plan/routeList/filter",
"/plan/listssByAdd",
"/route/collect/add",
"/route/collect/cancel",
"/route/share",
"/scenic_spots/editPlanSS",
"/scenic_spots/collect/option",
"/scenic_spots/share",
"/system/*",
"/topic/collect/add",
"/topic/collect/cancel",
"/topic/share",
"/user/plan/list",
"/user/collect/ss",
"/user/collect/plan",
"/user/collect/topic",
"/user/collect/travels",
"/user/collect/route",
"/user/userCenter",
"/user/prefer",
"/user/nickname/modify",
"/user/personsign/modify",
"/user/password/modify",
"/user/photo/uptoken"
).hasRole("USER")
.anyRequest().permitAll();//剩余的都是不需要登录也能访问的请求
// token 认证功能
TokenAuthenticationFilter tokenAuthenticationFilter = new TokenAuthenticationFilter("/user-service/token");
tokenAuthenticationFilter.setAuthenticationManager(authenticationManagerBean());
tokenAuthenticationFilter.setAuthenticationFailureHandler(new ForwardAuthenticationFailureHandler(AUTHENTICATION_FAILURE_FORWARD_URL));
http.addFilterAfter(tokenAuthenticationFilter, LogoutFilter.class);
// 退出登录功能
http.logout()
.addLogoutHandler(new TokenLogoutHandler(tokenService))
.logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
// 开启游客模式,允许一些api不用登录也能被访问
http.anonymous();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
TokenAuthenticationProvider tokenAuthenticationProvider = new TokenAuthenticationProvider(tokenService);
auth.authenticationProvider(tokenAuthenticationProvider);
}
}
| true
|
4e8b713068ffecd51bafb0325e26c2e1fa04a04d
|
Java
|
ebi-uniprot/QuickGOBE
|
/annotation-rest/src/main/java/uk/ac/ebi/quickgo/annotation/service/comm/rest/ontology/converter/DescendantsFilterConverter.java
|
UTF-8
| 1,581
| 2.296875
| 2
|
[
"Apache-2.0"
] |
permissive
|
package uk.ac.ebi.quickgo.annotation.service.comm.rest.ontology.converter;
import uk.ac.ebi.quickgo.annotation.service.comm.rest.ontology.model.OntologyRelatives;
import uk.ac.ebi.quickgo.rest.search.query.QuickGOQuery;
import uk.ac.ebi.quickgo.rest.search.request.converter.ConvertedFilter;
import com.google.common.base.Strings;
import java.util.Set;
import static java.util.Objects.nonNull;
import static uk.ac.ebi.quickgo.rest.search.query.QuickGOQuery.or;
/**
* This class is responsible for converting an ontology model containing GO id descendant information, to a
* {@link ConvertedFilter}. This result encapsulates a {@link QuickGOQuery} applicable to filtering the annotation
* core data, by these descendants.
*
* Created 09/08/16
* @author Edd
*/
public class DescendantsFilterConverter extends AbstractOntologyFilterConverter {
@Override protected boolean validResult(OntologyRelatives.Result result) {
return nonNull(result.getDescendants());
}
@Override protected void processResult(OntologyRelatives.Result result, Set<QuickGOQuery> queries) {
result.getDescendants().stream()
.filter(desc -> !Strings.isNullOrEmpty(desc))
.forEach(desc -> queries.add(createQueryForOntologyId(desc)));
}
@Override protected ConvertedFilter<QuickGOQuery> createFilter(Set<QuickGOQuery> queries) {
if (!queries.isEmpty()) {
return new ConvertedFilter<>(or(queries.toArray(new QuickGOQuery[queries.size()])));
} else {
return FILTER_EVERYTHING;
}
}
}
| true
|
a6f1235c56ea9fc9e7ea5d9d7dd5198ca55556b3
|
Java
|
albiurs/edu_zhaw_java
|
/2.1_java-fundamentals-course/eth_e.tutorial_java1/buchstaben/src/Buchstaben.java
|
UTF-8
| 1,868
| 3.546875
| 4
|
[] |
no_license
|
public class Buchstaben {
public static void main(String[] args) {
/*
* In dieser und der folgenden Lektion werden Sie ein Programm schreiben,
* welches eine Reihe von Zeichen (Leerschläge und X-en) so in einem
* 2-dimensionalen Array speichert, dass dessen Bildschirmausgabe wie folgt
* Buchstaben (z.B. A oder Z) zeichnet:
*
* X
* X X
* Xxxxx
* x x
* x x
*
* xxxxx
* x
* x
* x
* xxxxx
*/
char [][] aaa = new char [5][5];
char [][] zzz = new char [5][5];
aaa [0][0] = ' ';
aaa [0][1] = ' ';
aaa [0][2] = 'X';
aaa [0][3] = ' ';
aaa [0][4] = ' ';
aaa [1][0] = ' ';
aaa [1][1] = 'X';
aaa [1][2] = ' ';
aaa [1][3] = 'X';
aaa [1][4] = ' ';
aaa [2][0] = 'X';
aaa [2][1] = 'X';
aaa [2][2] = 'X';
aaa [2][3] = 'X';
aaa [2][4] = 'X';
aaa [3][0] = 'X';
aaa [3][1] = ' ';
aaa [3][2] = ' ';
aaa [3][3] = ' ';
aaa [3][4] = 'X';
aaa [4][0] = 'X';
aaa [4][1] = ' ';
aaa [4][2] = ' ';
aaa [4][3] = ' ';
aaa [4][4] = 'X';
zzz [0][0] = 'X';
zzz [0][1] = 'X';
zzz [0][2] = 'X';
zzz [0][3] = 'X';
zzz [0][4] = 'X';
zzz [1][0] = ' ';
zzz [1][1] = ' ';
zzz [1][2] = ' ';
zzz [1][3] = 'X';
zzz [1][4] = ' ';
zzz [2][0] = ' ';
zzz [2][1] = ' ';
zzz [2][2] = 'X';
zzz [2][3] = ' ';
zzz [2][4] = ' ';
zzz [3][0] = ' ';
zzz [3][1] = 'X';
zzz [3][2] = ' ';
zzz [3][3] = ' ';
zzz [3][4] = ' ';
zzz [4][0] = 'X';
zzz [4][1] = 'X';
zzz [4][2] = 'X';
zzz [4][3] = 'X';
zzz [4][4] = 'X';
System.out.println();
for (int i=0; i<5; i++) {
for (int j=0; j<5; j++) {
System.out.print(aaa[i][j]);
}
System.out.println();
}
System.out.println();
for (int i=0; i<5; i++) {
for (int j=0; j<5; j++) {
System.out.print(zzz[i][j]);
}
System.out.println();
}
System.out.println();
}
}
| true
|
b060b9cbff6594fa833e8924cd2492655db31387
|
Java
|
zhzhouq9/item
|
/src/main/java/com/company/ch12Think/item148/section1/Client.java
|
UTF-8
| 595
| 3.703125
| 4
|
[] |
no_license
|
package com.company.ch12Think.item148.section1;
//枪
interface Gun {
// 枪用来干什么的?射击杀戮!
public void shoot();
}
public class Client {
public static void main(String[] args) {
Gun gun = new Handgun();
gun.shoot();
}
}
//手枪
class Handgun implements Gun {
@Override
public void shoot() {
System.out.println("手枪射击...");
}
}
//玩具枪
class ToyGun implements Gun {
@Override
public void shoot() {
// 玩具枪不能射击,这个方法就不实现了
}
}
| true
|
9c53ac71044e842d7f9b08a382c0305511eb5618
|
Java
|
iambk45/iambk-portal
|
/src/main/java/com/nagarro/dev/portal/repositories/StateRepository.java
|
UTF-8
| 368
| 1.828125
| 2
|
[] |
no_license
|
package com.nagarro.dev.portal.repositories;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.nagarro.dev.portal.models.State;
@Repository
public interface StateRepository extends JpaRepository<State, Integer> {
List<State> findByCountryId(Integer countryId);
}
| true
|
1d42d567b6b8e86f6c8fdc6ce297702196318e6c
|
Java
|
AT727/C2020
|
/src/test/java/com/team1678/frc2020/paths/TrajectoryGeneratorTest.java
|
UTF-8
| 3,086
| 2.296875
| 2
|
[] |
no_license
|
package com.team1678.frc2020.paths;
import com.team254.lib.geometry.Pose2d;
import com.team254.lib.geometry.Pose2dWithCurvature;
import com.team254.lib.geometry.Twist2d;
import com.team254.lib.trajectory.TimedView;
import com.team254.lib.trajectory.Trajectory;
import com.team254.lib.trajectory.TrajectoryIterator;
import com.team254.lib.trajectory.timing.TimedState;
import com.team254.lib.util.Util;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
public class TrajectoryGeneratorTest {
public static final double kTestEpsilon = 1e-5;
public void verifyTrajectory(final Trajectory<TimedState<Pose2dWithCurvature>> trajectory,
boolean shouldBeReversed) {
TrajectoryIterator<TimedState<Pose2dWithCurvature>> iterator = new TrajectoryIterator<>(new TimedView<>
(trajectory));
final double dt = 0.05;
TimedState<Pose2dWithCurvature> prev = null;
while (!iterator.isDone()) {
TimedState<Pose2dWithCurvature> state = iterator.getState();
Assert.assertTrue((shouldBeReversed ? -1.0 : 1.0) * state.velocity() >= -kTestEpsilon);
if (prev != null) {
// Check there are no angle discontinuities.
final double kMaxReasonableChangeInAngle = 0.3; // rad
Twist2d change = Pose2d.log(prev.state().getPose().inverse().transformBy(state.state()
.getPose()));
Assert.assertTrue(Math.abs(change.dtheta) < kMaxReasonableChangeInAngle);
if (!Util.epsilonEquals(change.dtheta, 0.0)) {
// Could be a curvature sign change between prev and now, so just check that either matches our
// expected sign.
final boolean curvature_positive = state.state().getCurvature() > kTestEpsilon ||
prev.state().getCurvature() > kTestEpsilon;
final boolean curvature_negative = state.state().getCurvature() < -kTestEpsilon ||
prev.state().getCurvature() < -kTestEpsilon;
final double actual_curvature = change.dtheta / change.dx;
if (actual_curvature < -kTestEpsilon) {
Assert.assertTrue(curvature_negative);
} else if (actual_curvature > kTestEpsilon) {
Assert.assertTrue(curvature_positive);
}
}
}
iterator.advance(dt);
prev = state;
}
Assert.assertTrue(iterator.isDone());
System.out.println("t: " + iterator.getSample().state().t());
}
@Test
public void test() {
TrajectoryGenerator.getInstance().generateTrajectories();
verifyTrajectory(TrajectoryGenerator.getInstance().getTrajectorySet().secondBarIntakeToNearShot, true);
//verifyTrajectory(TrajectoryGenerator.getInstance().getTrajectorySet().testPathReversed, true);
}
}
| true
|
7d04bc795234452eec9e931f63f5727d4c1e95f9
|
Java
|
dragan777/fasb
|
/src/main/java/com/fasb/api/requests/TransferMoneyReq.java
|
UTF-8
| 719
| 2.09375
| 2
|
[] |
no_license
|
package com.fasb.api.requests;
public class TransferMoneyReq {
private int accoundIDfrom;
private int accoundIDTo;
private Long transferMoneyValue;
public int getAccoundIDfrom() {
return accoundIDfrom;
}
public void setAccoundIDfrom(int accoundIDfrom) {
this.accoundIDfrom = accoundIDfrom;
}
public int getAccoundIDTo() {
return accoundIDTo;
}
public void setAccoundIDTo(int accoundIDTo) {
this.accoundIDTo = accoundIDTo;
}
public Long getTransferMoneyValue() {
return transferMoneyValue;
}
public void setTransferMoneyValue(Long transferMoneyValue) {
this.transferMoneyValue = transferMoneyValue;
}
}
| true
|
ba7b67e5fa3bdbc67475dd955e00e393816f4d66
|
Java
|
kawasima/bootstrap-customize-war
|
/src/test/java/net/unit8/bootstrap/customize/EmbeddedServer.java
|
UTF-8
| 831
| 2.34375
| 2
|
[
"Apache-2.0"
] |
permissive
|
package net.unit8.bootstrap.customize;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.bio.SocketConnector;
import org.eclipse.jetty.webapp.WebAppContext;
public class EmbeddedServer {
public static void main(String[] args) throws Exception {
Server server = new Server();
SocketConnector socketConnector = new SocketConnector();
socketConnector.setPort(8090);
Connector[] connectors = new Connector[]{ socketConnector };
server.setConnectors(connectors);
WebAppContext context = new WebAppContext();
context.setDescriptor("src/main/webapp/WEB-INF/web.xml");
context.setResourceBase("src/main/webapp");
context.setContextPath("/");
context.setParentLoaderPriority(true);
server.setHandler(context);
server.start();
server.join();
}
}
| true
|
1e643845b1e84a3bb47f5b067e6aadd82eb25997
|
Java
|
Yl652306922/idea
|
/src/cn/yunhe/dao/IUserDao.java
|
UTF-8
| 305
| 1.914063
| 2
|
[] |
no_license
|
package cn.yunhe.dao;
import cn.yunhe.beans.User;
import cn.yunhe.beans.UserCustom;
import java.util.List;
public interface IUserDao {
int addUser(User user);
int updateUser(User user);
List<User> queryUserList();
User queryUserById(int uid);
int addOrder(UserCustom userCustom);
}
| true
|
effea2b27c23e4984c874aef17b4301f6d8bd1c1
|
Java
|
GeorgianaLoba/Interpreter
|
/src/Model/Value/BooleanValue.java
|
UTF-8
| 895
| 3.265625
| 3
|
[] |
no_license
|
package Model.Value;
import Model.Type.Type;
import Model.Type.BooleanType;
public class BooleanValue implements Value<Boolean> {
private boolean value;
public BooleanValue(boolean val){this.value=val;}
public Boolean getValue(){return this.value;}
@Override
public Object clone() throws CloneNotSupportedException {
BooleanValue clone = (BooleanValue)super.clone();
clone.value=this.value;
return clone;
}
@Override
public boolean equals(Object another) {
if (another instanceof BooleanValue){
return this.value==((BooleanValue) another).getValue();
}
else{
return false;
}
}
@Override
public String toString(){return " "+ this.value +" ";}
@Override
public Type getType() {
return new BooleanType();
}
}
| true
|
7fd0a500add1e3f087eb07b73e1547cdadbdae7d
|
Java
|
jinghun007/miao
|
/src/main/java/com/miaoproject/controller/UserInfoController.java
|
UTF-8
| 5,828
| 2.328125
| 2
|
[] |
no_license
|
package com.miaoproject.controller;
import com.alibaba.druid.util.StringUtils;
import com.miaoproject.controller.viewObject.UserInfoVo;
import com.miaoproject.error.BusinessException;
import com.miaoproject.error.EmBusinessError;
import com.miaoproject.response.CommonReturnType;
import com.miaoproject.service.UserInfoService;
import com.miaoproject.service.model.UserInfoModel;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import sun.misc.BASE64Encoder;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Random;
@Controller
@RequestMapping("/userInfo")
@CrossOrigin(allowCredentials="true",allowedHeaders="*")
public class UserInfoController extends BaseController{
@Autowired
private UserInfoService userInfoService;
@Autowired
private HttpServletRequest httpServletRequest;
//用户登录
@RequestMapping(value = "/login",method = {RequestMethod.POST} )
@ResponseBody
public CommonReturnType login(@RequestParam(name="telphone") String telphone,
@RequestParam(name="password") String password) throws Exception{
//入参校验
if(StringUtils.isEmpty(telphone) ||
org.apache.commons.lang3.StringUtils.isNotEmpty(password)){
throw new BusinessException(EmBusinessError.PARAMETER_VALIDATION_ERROR);
}
//用户登录服务,用来校验用户登录是否合法
UserInfoModel userInfoModel=userInfoService.validateLogin(telphone,this.md5encode(password));
//将登录凭证加入到登录成功的seesion内
this.httpServletRequest.getSession().setAttribute("IS_LOGIN",true);
this.httpServletRequest.getSession().setAttribute("LOGIN_USER",userInfoModel);
return CommonReturnType.create(null);
}
//用户注册接口
@RequestMapping(value = "/register",method = {RequestMethod.POST} )
@ResponseBody
public CommonReturnType register(@RequestParam(name="telphone") String telphone,
@RequestParam(name="otpCode") String otpCode,
@RequestParam(name="name") String name,
@RequestParam(name="gender") Integer gender,
@RequestParam(name="age") Integer age,
@RequestParam(name="password") String password) throws Exception{
//验证手机号和对应的otpCode相符合
String inSeesionOtpCode=(String)httpServletRequest.getSession().getAttribute(telphone);
if(!StringUtils.equals(inSeesionOtpCode,otpCode)){
throw new BusinessException(EmBusinessError.PARAMETER_VALIDATION_ERROR,"短信验证码不符合");
}
//用户的注册流程
UserInfoModel userInfoModel=new UserInfoModel();
userInfoModel.setName(name);
userInfoModel.setGender(gender);
userInfoModel.setAge(age);
userInfoModel.setTelphone(telphone);
userInfoModel.setRegisterMode("byphone");
userInfoModel.setEncrptPassword(this.md5encode(password));
userInfoService.register(userInfoModel);
return CommonReturnType.create(null);
}
public String md5encode(String str) throws NoSuchAlgorithmException,UnsupportedEncodingException{
MessageDigest messageDigest=MessageDigest.getInstance("MD5");
BASE64Encoder base64Decoder=new BASE64Encoder();
//加密
String newStr=base64Decoder.encode(messageDigest.digest(str.getBytes("UTF-8")));
return newStr;
}
public static void main(String[] args) {
}
//用户获取otp短信接口
@RequestMapping("/getOtp")
@ResponseBody
public CommonReturnType getOtp(@RequestParam(name="telphone") String telphone){
//需要按照一定的规则生成otp验证码
Random random=new Random();
int randomInt=random.nextInt(99999);
randomInt+=10000;
String otpCode=String.valueOf(randomInt);
//将otp验证码通对应手机号码关联,使用httpseesion方式
httpServletRequest.getSession().setAttribute(telphone,otpCode);
//将otp验证码通过短信同道发送给用户,省略
System.out.println("telphone = "+telphone+" & otpCode = "+otpCode);
return CommonReturnType.create(null);
}
@RequestMapping("/get")
@ResponseBody
public CommonReturnType getUserInfo(@RequestParam(name="id") Integer id) throws BusinessException {
//调用service服务获取对应id的用户对象并返回给前端
UserInfoModel userInfoModel=userInfoService.getUserInfoById(id);
//若获取的用户信息不存在
if(userInfoModel==null){
// userInfoModel.setEncrptPassword("1233");
throw new BusinessException(EmBusinessError.USER_NOT_EXIST);
}
//讲核心领域模型用户对象转化成可供UI使用的viewObject
UserInfoVo userInfoVo= convertFromModel(userInfoModel);
//返回通用对象
return CommonReturnType.create(userInfoVo);
}
private UserInfoVo convertFromModel(UserInfoModel userInfoModel){
if(null==userInfoModel)
return null;
UserInfoVo userInfoVo=new UserInfoVo();
BeanUtils.copyProperties(userInfoModel,userInfoVo);
return userInfoVo;
}
}
| true
|
a18e24aee4ba930b57b2de4eb52b99b08b14d9d1
|
Java
|
ViktorFP/SOAP
|
/SOAP/src/by/epamlab/factories/ReservationFactory.java
|
UTF-8
| 252
| 1.734375
| 2
|
[] |
no_license
|
package by.epamlab.factories;
import by.epamlab.beans.ifaces.IReservationDAO;
import by.epamlab.impl.ReservationImplXml;
public class ReservationFactory {
public static IReservationDAO getClassFromFactory() {
return new ReservationImplXml();
}
}
| true
|
ff2575ebe371a7008005f79234da2e2494a81d5d
|
Java
|
25steps/git-rep
|
/algorithms and data structures/lesson_1/homework/src/Main.java
|
UTF-8
| 556
| 3.359375
| 3
|
[] |
no_license
|
public class Main {
static int method1(int a, int b){
int a1=1;
for (int i = 0; i < b; i++ ) {
a1*=a;
}
return a1;
}
static double method3(int[] arr){
int sum = 0;
for (int i = 0; i < arr.length; i++) {
sum += arr[i];
}
return sum/arr.length;
}
public static void main(String[] args) {
int a = -2;
int b = 3;
int[] mas = {2,4,6,8};
System.out.println(method1(a,b));
System.out.println(method3(mas));
}
}
| true
|
6334336f60d2d861e5270bbcf18a2a679969b9ab
|
Java
|
marcellodesales/my-cs-research
|
/grad-ste-ufpe-brazil/ptf-add-on-dev/src/br/ufpe/cin/stp/global/ListFilter.java
|
UTF-8
| 2,385
| 2.765625
| 3
|
[] |
no_license
|
/*
* @created 09/09/2004 11:22:36
* <a href=mailto:masj2@cin.ufpe.br>Marcello Alves de Sales Junior</a>
* Center of Informatics (CIn)-UFPE
* Software Test Program
* CIn / UFPE / Brazil
* */
package br.ufpe.cin.stp.global;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
/**
* @created 09/09/2004 11:22:36
* @author Marcello Sales Jr. <a href='masj2@cin.ufpe.br'>masj2@cin.ufpe.br</a>
* @version 1.0
*/
public class ListFilter {
/**
* <code>singleton</code> is the single instance of this class.
*/
private static ListFilter singleton;
private ListFilter() {
}
/**
* @created 09/09/2004 11:22:52
* @return The single instance.
*/
public synchronized static ListFilter getInstance() {
if (singleton == null) {
singleton = new ListFilter();
}
return singleton;
}
/**
* @created 09/09/2004 11:26:28
* @param list
* @param token
* @return filtered list based on the specified token
*/
public String[] getFilteredList(String[] originalList, String token){
List filteredSet = new Vector();
String[] filteredList = null;
for (int i = 0; i < originalList.length; i++) {
if (this.containsToken(originalList[i],token))
filteredSet.add(originalList[i]);
}
filteredList = new String[filteredSet.size()];
Iterator i = filteredSet.iterator();
int ii = -1;
while (i.hasNext())
filteredList[++ii] = (String) i.next();
return filteredList;
}
public boolean containsToken(String string, String token){
return string.toLowerCase().indexOf(token.toLowerCase()) != -1;
}
public static void main(String[] args) {
/*String token = "coM.";
String[] packages = {".combr","com.motorola","motorola.Com","motorola.cOM.br"};
String[] filtered = ListFilter.getInstance().getFilteredList(packages,token);
for (int i = 0; i < filtered.length; i++) {
System.out.println(filtered[i]);
}*/
double a = 3.0 / 0;
if (a == Double.POSITIVE_INFINITY)
System.out.println(a);
System.out.println(Integer.toBinaryString((byte)a));
byte b = (byte)a;
System.out.println(b);
}
}
| true
|
8de228f35ad451f7309f256afe4b41d51ad70915
|
Java
|
bridenbrad/inmemdb
|
/tirion-db-sql-plan/src/main/java/com/tirion/db/sql/plan/generator/SimpleFilterGenerator.java
|
UTF-8
| 11,252
| 1.757813
| 2
|
[] |
no_license
|
/**
* Copyright © 2013/2014, Veljko Zivkovic
* All rights reserved.
*
* No portion of this file may be reproduced in any form, or by any means, without the prior written
* consent of the author.
*/
package com.tirion.db.sql.plan.generator;
import java.io.StringWriter;
import java.io.Writer;
import java.util.List;
import java.util.Set;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
import com.tirion.common.NotYetImplementedException;
import com.tirion.common.type.Type;
import com.tirion.common.uuid.UuidUtil;
import com.tirion.compiler.source.Source;
import com.tirion.db.catalog.model.Field;
import com.tirion.db.sql.ast.Fields;
import com.tirion.db.sql.ast.common.FieldRef;
import com.tirion.db.sql.ast.common.constant.Constant;
import com.tirion.db.sql.ast.common.constant.ConstantRange;
import com.tirion.db.sql.ast.expression.bool.And;
import com.tirion.db.sql.ast.expression.bool.BoolExpression;
import com.tirion.db.sql.ast.expression.bool.Or;
import com.tirion.db.sql.ast.expression.compare.BetweenCompare;
import com.tirion.db.sql.ast.expression.compare.Compare;
import com.tirion.db.sql.ast.expression.compare.InCompare;
import com.tirion.db.sql.ast.expression.compare.NullCompare;
import com.tirion.db.sql.ast.expression.compare.NullCompare.IsNotNullCompare;
import com.tirion.db.sql.ast.expression.compare.SimpleCompare;
import com.tirion.db.sql.exec.operator.physical.filter.TupleFilter;
import com.tirion.db.sql.exec.operator.physical.filter.TuplesFilter;
/**
* @author Veljko Zivkovic, Copyright (C) All Rights Reserved
*/
public final class SimpleFilterGenerator implements FilterGenerator {
private static final String TUPLE_TEMPLATE_NAME = "templates/tuple-filter-template.vm";
private static final String TUPLES_TEMPLATE_NAME = "templates/tuples-filter-template.vm";
/**
* Name of Velocity template.
*/
private final String templateName;
/**
* Expression of matches(Tuple) method.
*/
private final StringBuilder matchesExpression = new StringBuilder();
/**
* Initialization of {@link Set}s.
*/
private final StringBuilder constructorExpression = new StringBuilder();
/**
* Declaration of sets.
*/
private final StringBuilder fieldDeclarations = new StringBuilder();
/**
* Variable name counter.
*/
private int counter = 0;
/**
* True if {@link TuplesFilter}, false if {@link TupleFilter}.
*/
public SimpleFilterGenerator(boolean isTuples) {
this.templateName = isTuples ? TUPLES_TEMPLATE_NAME : TUPLE_TEMPLATE_NAME;
}
@Override
public Source generateTupleFilter(Fields virtEntity, BoolExpression expression) {
try {
onExpression(virtEntity, null, expression);
return generateSourceCode();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public Source generateTuplesFilter(Fields leftVirtEntity, Fields rightVirtEntity, BoolExpression expression) {
try {
onExpression(leftVirtEntity, rightVirtEntity, expression);
return generateSourceCode();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private Source generateSourceCode() throws Exception {
VelocityEngine engine = new VelocityEngine();
engine.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
engine.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
engine.init();
Template template = engine.getTemplate(templateName);
String className = UuidUtil.nextJavaIdentifier("TupleFilter");
VelocityContext ctx = new VelocityContext();
ctx.put("constructorExpression", constructorExpression);
ctx.put("fieldDeclarations", fieldDeclarations);
ctx.put("matchesExpression", matchesExpression);
ctx.put("name", className);
Writer writer = new StringWriter();
template.merge(ctx, writer);
writer.close();
return new Source(className, writer.toString());
}
private void onExpression(Fields leftVirtEntity, Fields rightVirtEntity, BoolExpression expression) {
if(expression instanceof And) {
List<BoolExpression> children = ((And) expression).getChildren();
append("(");
for (int i = 0; i < children.size(); i++) {
BoolExpression child = children.get(i);
onExpression(leftVirtEntity, rightVirtEntity, child);
if(i < children.size() - 1) {
append(" && ");
}
}
append(")");
} else if(expression instanceof Or) {
List<BoolExpression> children = ((Or) expression).getChildren();
append("(");
for (int i = 0; i < children.size(); i++) {
BoolExpression child = children.get(i);
onExpression(leftVirtEntity, rightVirtEntity, child);
if(i < children.size() - 1) {
append(" || ");
}
}
append(")");
} else {
processCompare(leftVirtEntity, rightVirtEntity, (Compare) expression);
}
}
private void processCompare(Fields leftVirtEntity, Fields rightVirtEntity, Compare compare) {
if(compare instanceof InCompare) {
InCompare inCompare = (InCompare) compare;
Fields virtEntity = getOwningTuple(leftVirtEntity, rightVirtEntity, inCompare.getFieldRef());
processInCompare(virtEntity, virtEntity == leftVirtEntity ? "left" : "right", inCompare);
} else if(compare instanceof BetweenCompare) {
BetweenCompare betweenCompare = (BetweenCompare) compare;
Fields virtEntity = getOwningTuple(leftVirtEntity, rightVirtEntity, betweenCompare.getFieldRef());
processBetweenCompare(virtEntity, virtEntity == leftVirtEntity ? "left" : "right", betweenCompare);
} else if(compare instanceof NullCompare) {
NullCompare nullCompare = (NullCompare) compare;
Fields virtEntity = getOwningTuple(leftVirtEntity, rightVirtEntity, nullCompare.getFieldRef());
processNullCompare(virtEntity, virtEntity == leftVirtEntity ? "left" : "right", nullCompare);
} else {
processSimpleCompare(leftVirtEntity, rightVirtEntity, (SimpleCompare)compare);
}
}
private void processSimpleCompare(Fields leftFields, Fields rightFields, SimpleCompare compare) {
{
FieldRef fieldRef = compare.getFieldRef();
Fields fields = getOwningTuple(leftFields, rightFields, fieldRef);
Field field = fields.getField(fieldRef);
String tupleName = fields == leftFields ? "left" : "right";
append(tupleName + ".get" + field.getNativeType().getLargeTypeName() + "(" + field.getIndex() + ")");
}
switch (compare.getKind()) {
case EQ_OPERATOR:
append(" == ");
break;
case NEQ_OPERATOR:
append(" != ");
break;
case LT_OPERATOR:
append(" < ");
break;
case LTEQ_OPERATOR:
append(" <= ");
break;
case GT_OPERATOR:
append(" > ");
break;
case GTEQ_OPERATOR:
append(" >= ");
break;
default:
throw new NotYetImplementedException(compare.getKind().name());
}
{
if(compare.getRight() instanceof Constant) {
Constant constant = (Constant) compare.getRight();
append("((" + constant.getType().getSmallTypeName() + ") " + getJavaConstant(constant.getType(), constant.getValue()) + ")");
} else {
FieldRef fieldRef = (FieldRef) compare.getRight();
Fields virtEntity = getOwningTuple(leftFields, rightFields, fieldRef);
Field field = virtEntity.getField(fieldRef);
String tupleName = virtEntity == leftFields ? "left" : "right";
append(tupleName + ".get" + field.getDeclaredType().getLargeTypeName() + "(" + field.getIndex() + ")");
}
}
}
private void processInCompare(Fields virtEntity, String tupleName, InCompare compare) {
String setName = nextVariableName("set");
generateInCompareFieldsDeclarations(setName, virtEntity.getField(compare.getFieldRef().getName()).getNativeType());
generateInCompareConstructorExpression(setName, compare);
generateInCompareMatchesCode(tupleName, setName, compare, virtEntity);
}
private void generateInCompareFieldsDeclarations(String setName, Type type) {
fieldDeclarations.append("private Set<" + type.getLargeTypeName() + "> " + setName + ";\n");
}
private void generateInCompareConstructorExpression(String setName, InCompare compare) {
constructorExpression.append(setName + " = new HashSet<" + compare.getFieldRef().getType().getLargeTypeName() + ">();\n");
for(Object value : compare.getSet().getSortedSet()) {
constructorExpression.append(setName + ".add(" + getJavaConstant(compare.getSet().getType(), value) + ");");
}
}
private void generateInCompareMatchesCode(String tupleName, String setName, InCompare compare, Fields virtEntity) {
Field field = virtEntity.getField(compare.getFieldRef());
append("(");
append(getNullCheckSafety(tupleName, field));
append(" && ");
if(compare.hasNot()) {
append("!");
}
append(setName + ".contains(" + tupleName + ".get" + field.getNativeType().getLargeTypeName() + "(" + field.getIndex() + "));");
append(")");
}
private void processBetweenCompare(Fields virtEntity, String tupleVarName, BetweenCompare compare) {
Field field = virtEntity.getField(compare.getFieldRef());
ConstantRange range = compare.getRange();
append("(");
append(getNullCheckSafety(tupleVarName, field));
append(" && (");
append(getJavaConstant(range.getType(), range.getLow()) + " <= " + getValueExtract(tupleVarName, field));
append(" && ");
append(getValueExtract(tupleVarName, field) + " <= " + getJavaConstant(range.getType(), range.getHigh()));
append(")");
append(")");
}
private void processNullCompare(Fields virtEntity, String tupleVarName, NullCompare compare) {
if(compare instanceof IsNotNullCompare) {
append("!");
}
append(tupleVarName + ".isNull(" + virtEntity.getField(compare.getFieldRef()).getIndex() + ")");
}
private Fields getOwningTuple(Fields leftVirtEntity, Fields rightVirtEntity, FieldRef fieldRef) {
if(leftVirtEntity == null) {
return rightVirtEntity;
}
if(rightVirtEntity == null) {
return leftVirtEntity;
}
if(leftVirtEntity.fieldExists(fieldRef) && rightVirtEntity.fieldExists(fieldRef)) {
throw new IllegalStateException("Same field exists in both left & right virtual entity '" + fieldRef.toString() + "'");
}
if(leftVirtEntity.fieldExists(fieldRef)) {
return leftVirtEntity;
}
if(rightVirtEntity.fieldExists(fieldRef)) {
return rightVirtEntity;
}
throw new IllegalStateException("Unable to find field '" + fieldRef.toString() + "'");
}
private String nextVariableName(String prefix) {
return prefix + "_" + counter++;
}
private String getNullCheckSafety(String tupleVarName, Field field) {
return "!" + tupleVarName + ".isNull(" + field.getIndex() + ")";
}
private String getValueExtract(String tupleVarName, Field field) {
return tupleVarName + ".get" + field.getNativeType().getLargeTypeName() + "(" + field.getIndex() + ")";
}
private String getJavaConstant(Type type, Object value) {
switch (type) {
case VARCHAR:
return "\"" + value + "\"";
case LONG:
return value + "L";
case DOUBLE:
return value + "D";
case FLOAT:
return value + "F";
default:
return value.toString();
}
}
private void append(String value) {
matchesExpression.append(value);
}
}
| true
|
45b78eb97f738dfc8ff84be8848c7e7c1b1d5f45
|
Java
|
NavneetPrakashSingh/Project-backend
|
/src/main/java/com/example/demo/controller/VehicleController.java
|
UTF-8
| 705
| 2.25
| 2
|
[] |
no_license
|
package com.example.demo.controller;
import com.example.demo.to.Vehicle;
import com.example.demo.vehicle.IVehicle;
import com.example.demo.vehicle.VehicleEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class VehicleController {
@RequestMapping(value = "/vehicle/{id}", method = RequestMethod.GET)
public Vehicle getVehicleDetails(@PathVariable Integer id) {
IVehicle vehicle = new VehicleEntity();
return vehicle.getVehicleDetails(id);
}
}
| true
|
9dcffac65785f3485e34d5923ee30f35d8450cf5
|
Java
|
MaciejHeintze/GUI_PJATK
|
/Animal/Main.java
|
UTF-8
| 767
| 3.765625
| 4
|
[] |
no_license
|
public class Main {
public static void main(String[] args) {
Animal dog = new Dog(10);
Animal cat = new Cat(3);
System.out.print("Dog make sound: ");
dog.makeSound();
System.out.print("Cat make sound: ");
cat.makeSound();
System.out.println(dog.toString()+"\n"+cat.toString());
((Dog)dog).setType();
((Dog)dog).show();
System.out.println(dog.eat()+"\n"+cat.eat());
System.out.println("After meal: "+dog.toString()+"\n"+cat.toString());
System.out.println("New puppy: "+dog.animalMultiply(0.7,3));
System.out.println("New kitten: "+cat.animalMultiply(0.3,1));
dog.grow(4);
cat.grow(1);
System.out.println("1 year later: "+"\n"+dog.toString()+"\n"+cat.toString());
}
}
| true
|
8d1ff4c7c3878426d47237c87a85026e269dcd38
|
Java
|
aathee-sravya/tool
|
/src/main/java/com/tm/perf/tool/controller/UserController.java
|
UTF-8
| 3,351
| 2.0625
| 2
|
[] |
no_license
|
package com.tm.perf.tool.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.tm.perf.tool.api.request.LoginRequest;
import com.tm.perf.tool.api.response.CreateUserResponse;
import com.tm.perf.tool.service.UserService;
@RestController
@Configuration
@RequestMapping("user")
public class UserController {
@Autowired
UserService userService;
private static final Logger LOGGER = LoggerFactory.getLogger(UserController.class);
// @RequestMapping(value = {"/createUser"}, method = {org.springframework.web.bind.annotation.RequestMethod.POST})
// public @ResponseBody CreateUserResponse createUser(@RequestBody CreateUserRequest createUserReq) {
// LOGGER.info("UserController.createUser() - request:" + createUserReq);
// CreateUserResponse response = walletService.createUser(createUserReq);
// LOGGER.info("UserController.createUser() - response:" + response);
// return response;
// }
@RequestMapping(value = {"/loginUser"}, method = {org.springframework.web.bind.annotation.RequestMethod.POST})
public @ResponseBody CreateUserResponse loginUser(@RequestBody LoginRequest loginRequest) {
LOGGER.info("UserController.loginUser() - request:" + loginRequest);
CreateUserResponse response = userService.loginUser(loginRequest);
LOGGER.info("UserController.loginUser() - response:" + response);
return response;
}
// @RequestMapping(value = {"/getUserInfo"}, method = {org.springframework.web.bind.annotation.RequestMethod.GET})
// public @ResponseBody CreateUserResponse getUserInfo(@RequestParam CreateUserRequest createUserReq) {
// LOGGER.info("UserController.createUser() - request:" + createUserReq);
// CreateUserResponse response = walletService.createUser(createUserReq);
// LOGGER.info("UserController.createUser() - response:" + response);
// return response;
// }
//
// @RequestMapping(value = {"/getUserRoles"}, method = {org.springframework.web.bind.annotation.RequestMethod.GET})
// public @ResponseBody CreateUserResponse getUserRoles(@RequestParam CreateUserRequest createUserReq) {
// LOGGER.info("UserController.createUser() - request:" + createUserReq);
// CreateUserResponse response = walletService.createUser(createUserReq);
// LOGGER.info("UserController.createUser() - response:" + response);
// return response;
// }
//
// @RequestMapping(value = {"/getUserRoutes"}, method = {org.springframework.web.bind.annotation.RequestMethod.GET})
// public @ResponseBody CreateUserResponse getUserRoutes(@RequestParam CreateUserRequest createUserReq) {
// LOGGER.info("UserController.createUser() - request:" + createUserReq);
// CreateUserResponse response = walletService.createUser(createUserReq);
// LOGGER.info("UserController.createUser() - response:" + response);
// return response;
// }
}
| true
|
e3c16958e420e09f818c44013c8b953dd372ff04
|
Java
|
ligenghuang/Cattle
|
/app/src/main/java/com/zhifeng/cattle/modules/OrderComment.java
|
UTF-8
| 3,057
| 2.15625
| 2
|
[] |
no_license
|
package com.zhifeng.cattle.modules;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.List;
public class OrderComment {
private int order_id;
private int goods_id;
private int sku_id;
private String descrie;
private String logistics;
private String service;
private String content;
private List<String> img;
public OrderComment(int order_id, int goods_id, int sku_id, String descrie, String logistics, String service, String content, List<String> img) {
this.order_id = order_id;
this.goods_id = goods_id;
this.sku_id = sku_id;
this.descrie = descrie;
this.logistics = logistics;
this.service = service;
this.content = content;
this.img = img;
}
public int getOrder_id() {
return order_id;
}
public void setOrder_id(int order_id) {
this.order_id = order_id;
}
public int getGoods_id() {
return goods_id;
}
public void setGoods_id(int goods_id) {
this.goods_id = goods_id;
}
public int getSku_id() {
return sku_id;
}
public void setSku_id(int sku_id) {
this.sku_id = sku_id;
}
public String getDescribe() {
return descrie == null ? "" : descrie;
}
public void setDescribe(String describe) {
this.descrie = describe == null ? "" : describe;
}
public String getLogistics() {
return logistics == null ? "" : logistics;
}
public void setLogistics(String logistics) {
this.logistics = logistics == null ? "" : logistics;
}
public String getService() {
return service == null ? "" : service;
}
public void setService(String service) {
this.service = service == null ? "" : service;
}
public String getContent() {
return content == null ? "" : content;
}
public void setContent(String content) {
this.content = content == null ? "" : content;
}
public List<String> getImg() {
if (img == null) {
return new ArrayList<>();
}
return img;
}
public void setImg(List<String> img) {
this.img = img;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"order_id\":\"")
.append(order_id).append('\"');
sb.append(",\"goods_id\":\"")
.append(goods_id).append('\"');
sb.append(",\"sku_id\":\"")
.append(sku_id).append('\"');
sb.append(",\"descrie\":\"")
.append(descrie).append('\"');
sb.append(",\"logistics\":\"")
.append(logistics).append('\"');
sb.append(",\"service\":\"")
.append(service).append('\"');
sb.append(",\"content\":\"")
.append(content).append('\"');
sb.append(",\"img\":")
.append(img);
sb.append('}');
return sb.toString();
}
}
| true
|
c23003dbdb6b6c29747574337c64fae8689701bb
|
Java
|
manusov/JavaCrossPlatformCPUID
|
/source/java/src/cpuidrefactoring/rootmenu/ViewPanelDualTable.java
|
UTF-8
| 2,540
| 2.484375
| 2
|
[] |
no_license
|
/*
CPUID Utility. (C)2020 IC Book Labs
------------------------------------
Set of GUI panels and components: dual table.
*/
package cpuidrefactoring.rootmenu;
import javax.swing.BoxLayout;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
public class ViewPanelDualTable extends ViewPanel
{
private final JPanel p; // complex panel
private final JSplitPane pp; // split panel
private final JScrollPane sp1, sp2; // scroll panels
private final JTable table1, table2; // tables
private final AbstractTableModel atm1, atm2; // tables models
private final BoxLayout bl; // layout manager
private static DefaultTableCellRenderer
mRenderer1, mRenderer2; // this for centering
public ViewPanelDualTable
( int x, int y, AbstractTableModel z1, AbstractTableModel z2 )
{
atm1 = z1; atm2 = z2;
// Built panel components
table1 = new JTable( atm1 );
table2 = new JTable( atm2 );
HelperTable.optimizeColumnsWidths( table1, x-35 );
HelperTable.optimizeColumnsWidths( table2, x-35 );
sp1 = new JScrollPane( table1 );
sp2 = new JScrollPane( table2 );
// Centering table(s)
mRenderer1 = new DefaultTableCellRenderer();
mRenderer2 = new DefaultTableCellRenderer();
mRenderer1.setHorizontalAlignment( SwingConstants.CENTER );
mRenderer2.setHorizontalAlignment( SwingConstants.CENTER );
for (int i=0; i<table1.getColumnCount(); i++)
{ table1.getColumnModel().getColumn(i).setCellRenderer( mRenderer1 ); }
for (int i=0; i<table2.getColumnCount(); i++)
{ table2.getColumnModel().getColumn(i).setCellRenderer( mRenderer2 ); }
// Built split panel
pp = new JSplitPane( JSplitPane.VERTICAL_SPLIT, true );
pp.setOneTouchExpandable( true );
pp.setDividerSize( 8 );
pp.setDividerLocation( y/2 );
pp.setTopComponent( sp1 );
pp.setBottomComponent( sp2 );
// Built panel and set layout
p = new JPanel();
bl = new BoxLayout( p, BoxLayout.X_AXIS );
p.setLayout( bl );
p.add( pp );
}
// Return panel
@Override public JPanel getP()
{
return p;
}
// Return components array
@Override public JComponent[] getComponents()
{
return new JComponent[] { table1, table2 };
}
}
| true
|
fc4a4b68981d6bfb8ec6c02fa632bd695113cf91
|
Java
|
habzy/Test0010_RealVideoPlayBuffer
|
/src/com/habzy/video/RealVideoPlayBufferActivity.java
|
UTF-8
| 6,564
| 2.203125
| 2
|
[] |
no_license
|
package com.habzy.video;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import android.app.Activity;
import android.content.res.AssetFileDescriptor;
import android.media.MediaPlayer;
import android.net.LocalServerSocket;
import android.net.LocalSocket;
import android.net.LocalSocketAddress;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SurfaceHolder;
import android.view.SurfaceHolder.Callback;
import android.view.SurfaceView;
public class RealVideoPlayBufferActivity extends Activity implements Callback {
private static final String TAG = "RealVideoPlayBufferActivity";
private static final int MENU_PLAY = 1;
private MediaPlayer mPlayer;
private SurfaceView mShownSurfaceView;
private FileDescriptor mfd;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mShownSurfaceView = (SurfaceView) findViewById(R.id.shown);
SurfaceHolder holder = mShownSurfaceView.getHolder();
holder.addCallback(this);
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
// Use socket
initSocket();
transBuffer();
// use fileoutputstream
// initFOS();
}
private void playMedia() {
// mCameraLayout.setVisibility(View.GONE);
if (null == mPlayer) {
try {
mPlayer = new MediaPlayer();
mPlayer.setDisplay(mShownSurfaceView.getHolder());
// the video from SDCard
// File sdFile = Environment.getExternalStorageDirectory();
// this.mediaPlayer = new MediaPlayer();
// this.mediaPlayer.setDataSource(sdFile.getAbsoluteFile() + File.separator + "welcome.3gp");
// the video from res/
// this.mediaPlayer = MediaPlayer.create(this, R.raw.welcome);
// the video from web-site
// this.mediaPlayer.setDataSource("http://xy2.163.com/download/down/wukong.mp3");
// Play with file which record.
// mPlayer.setAudioStreamType(AudioManager.)
// mPlayer.setDataSource(mRecFile.getAbsolutePath());
// The video from asset.
// AssetFileDescriptor aFD = getAssets().openFd("play.3gp");
// mPlayer.setDataSource(aFD.getFileDescriptor(),
// aFD.getStartOffset(), aFD.getLength());
// mfd = aFD.getFileDescriptor();
// The video from local socket.
mfd = receiver.getFileDescriptor();
// The video from OutputStream.
// mfd = fos.getFD();
mPlayer.setDataSource(mfd, 49, Integer.MAX_VALUE
- (Integer.MAX_VALUE % 32));
// mPlayer.setDataSource(is.)
mPlayer.prepare();
mPlayer.start();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
FileOutputStream fos;
private void initFOS() {
fos = new FileOutputStream(new FileDescriptor());
new Thread() {
public void run() {
byte[] buffer = new byte[1024];
while (getBuffer(buffer)) {
try {
fos.write(buffer, 0, 1024);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
}.start();
// try {
// fos = new FileOutputStream(getAssets().openFd("play.3gp")
// .getFileDescriptor());
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
private LocalSocket receiver, sender;
private LocalServerSocket lss;
/**
*
*/
private void initSocket() {
receiver = new LocalSocket();
try {
lss = new LocalServerSocket("Video");
receiver.connect(new LocalSocketAddress("Video"));
receiver.setReceiveBufferSize(500000);
receiver.setSendBufferSize(500000);
sender = lss.accept();
sender.setReceiveBufferSize(500000);
sender.setSendBufferSize(500000);
} catch (IOException e) {
finish();
return;
}
}
private void transBuffer() {
new Thread() {
public void run() {
byte[] buffer = new byte[1024];
while (getBuffer(buffer)) {
try {
OutputStream os = sender.getOutputStream();
os.write(buffer);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
}.start();
}
FileInputStream fis;
int offset = 0;
AssetFileDescriptor aFD;
private boolean getBuffer(byte[] buffer) {
if (null == fis || null == aFD) {
try {
aFD = getAssets().openFd("play.3gp");
fis = new FileInputStream(aFD.getFileDescriptor());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// Simulate recorder of rate 50.
try {
Thread.sleep(20);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Log.d(TAG, "offset:" + offset);
if (offset > aFD.getLength() - 1024) {
return false;
}
try {
fis.read(buffer, 0, 1024);
offset += 1024;
return true;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
/*
* (non-Javadoc)
*
* @see android.app.Activity#onMenuOpened(int, android.view.Menu)
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
Log.d(TAG, "Create menu....");
menu.add(Menu.NONE, MENU_PLAY, Menu.NONE, R.string.menu_play);
return super.onCreateOptionsMenu(menu);
}
/*
* (non-Javadoc)
*
* @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem)
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Log.d(TAG, "Click menu....id:" + item.getItemId());
switch (item.getItemId()) {
case MENU_PLAY: {
playMedia();
}
default:
break;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onDestroy() {
if (null != lss) {
try {
lss.close();
receiver.close();
sender.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (null != mPlayer) {
mPlayer.release();
mPlayer = null;
}
super.onDestroy();
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
// TODO Auto-generated method stub
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
// TODO Auto-generated method stub
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
// TODO Auto-generated method stub
}
}
| true
|
f35a907169ca3b6fda0c0b2a246eea85317b0fd8
|
Java
|
oangecheng/AndroidTool
|
/app/src/main/java/orange/com/androidtool/Database/DatabaseFactory.java
|
UTF-8
| 3,324
| 2.84375
| 3
|
[] |
no_license
|
package orange.com.androidtool.Database;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Orange on 2016/9/19.
*/
public class DatabaseFactory {
//数据库的版本号
private static final int DATABASE_VERSION = 1;
//数据库名称
private static final String DATABASE_NAME = "Orange.db";
//用来实现锁定数据库的表
private static final Object LOCK = new Object();
//数据库
private static DatabaseFactory instance;
//MsgTable表的对象
private final MsgTable msgTable;
//数据库的辅助工具
private DatabaseHelper databaseHelper;
/**
* DatabaseFactory的构造函数,msgTable和databaseHelper
*
* @param context
*/
private DatabaseFactory(final Context context) {
this.databaseHelper = new DatabaseHelper(context, DATABASE_NAME, null, DATABASE_VERSION);
this.msgTable = new MsgTable(context, databaseHelper);
}
public static MsgTable getMsgTable(final Context context) {
return getInstance(context).msgTable;
}
public static DatabaseFactory getInstance(final Context context) {
synchronized (LOCK) {
if (instance == null) {
instance = new DatabaseFactory(context.getApplicationContext());
}
return instance;
}
}
/**
* 清空指定的数据表,为private是为了提供给clearAllTable调用
* @param tableName 需要删除的表的名称
*/
private void clearTable(String tableName){
SQLiteDatabase db = databaseHelper.getWritableDatabase();
db.beginTransaction();
try {
db.delete(tableName, null, null);
//将数据库中的表自增列清零
String sql = " update sqlite_sequence SET seq = 0 where name = '" + tableName + "' ;";
db.execSQL(sql);
db.setTransactionSuccessful();
}catch (Exception e){
e.printStackTrace();
}finally {
db.endTransaction();
}
}
/*
清空所有的表,调用的方法为 DatabaseFactory.getInstance(context).clearAllTable();
*/
public boolean clearAllTable(){
boolean ret = false;
List<String> tableList = new ArrayList<>();
//将需要清空的表加入到tableList
tableList.add(MsgTable.MsgEntry.TABLE_NAME);
for (int i=0; i<tableList.size(); i++){
try {
clearTable(tableList.get(i));
ret = true;
}catch (Exception e){
e.printStackTrace();
}
}
return ret;
}
//数据库的辅助类,为内部类
private static final class DatabaseHelper extends SQLiteOpenHelper {
private DatabaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
}
public void onCreate(final SQLiteDatabase db) {
db.execSQL(MsgTable.CREATE_TABLE);
}
public void onUpgrade(final SQLiteDatabase db, final int oldVersion, final int newVersion) {
}
}
}
| true
|
d35df18a7a676c41b5b7fc0fb3ad7301c2cba451
|
Java
|
samperson1997/Trillionaire
|
/Trillionaire/src/main/java/trillionaire/dao/StockDao.java
|
UTF-8
| 702
| 2.140625
| 2
|
[] |
no_license
|
package trillionaire.dao;
import java.util.List;
import java.util.Map;
import java.util.Set;
import trillionaire.model.Stock;
public interface StockDao {
/**
*
* @return
*/
public List<Stock> getAllStocks();
/**
*
* @param industryName
* @return
*/
public Set<Stock> getStocksByIndustry(String industryName);
/**
*
* @param areaName
* @return
*/
public Set<Stock> getStocksByArea(String areaName);
/**
*
* @param conceptName
* @return
*/
public Set<Stock> getStocksByConcept(String conceptName);
/**
*
* @return
*/
public Map<String, Object> getNameCodeMap();
}
| true
|
06334f5ff94ea9447ae24177b93ca59d0d2724fa
|
Java
|
PrakashDathu/wifi-scheduler
|
/app/src/main/java/com/example/saikumar/timepicker/AlarmReciever.java
|
UTF-8
| 598
| 2.171875
| 2
|
[] |
no_license
|
package com.example.saikumar.timepicker;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.wifi.WifiManager;
import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;
/**
* Created by saikumar on 4/11/2016.
*/
public class AlarmReciever extends BroadcastReceiver{
public void onReceive(final Context context, Intent intent)
{
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
wifiManager.setWifiEnabled(true);
}
}
| true
|
2b9182132513644b9f9fcbb4735ecfece347dfa2
|
Java
|
lucianoiam/fake-orientation-layout
|
/app/src/main/java/com/lucianoiam/widgets/MainActivity.java
|
UTF-8
| 1,739
| 2.40625
| 2
|
[
"Apache-2.0"
] |
permissive
|
package com.lucianoiam.widgets;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
public class MainActivity extends AppCompatActivity {
private FakeOrientationLayout mRotatable;
private boolean mRotated;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mRotatable = findViewById(R.id.rotatable);
findViewById(R.id.push_me).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mRotated = !mRotated;
mRotatable.setRotated(mRotated);
}
});
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
final Window window = getWindow();
final WindowManager.LayoutParams wmlp = window.getAttributes();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
wmlp.rotationAnimation = WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS;
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
wmlp.rotationAnimation = WindowManager.LayoutParams.ROTATION_ANIMATION_JUMPCUT;
}
window.setAttributes(wmlp);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
final boolean rotated = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE;
mRotatable.setRotated(rotated);
}
}
| true
|
169e50101fbd43789103d5f1592e880545c4834c
|
Java
|
aherman/Twitter
|
/app/src/main/java/com/fit/ah/twitter/api/AuthApi.java
|
UTF-8
| 3,374
| 2.1875
| 2
|
[] |
no_license
|
package com.fit.ah.twitter.api;
import android.app.ProgressDialog;
import android.content.Context;
import android.widget.Toast;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.fit.ah.twitter.helper.MyApp;
import com.fit.ah.twitter.helper.MyRunnable;
import com.fit.ah.twitter.helper.url_connection.HttpManager;
import com.fit.ah.twitter.helper.volley.MyVolley;
import com.fit.ah.twitter.Login.model.AuthProvjeraVM;
import org.apache.http.message.BasicNameValuePair;
public class AuthApi {
public static void AuthCheck(final Context context, final String username, final String password, final MyRunnable<AuthProvjeraVM> onSuccess) {
final String url = MyApi.hostIP + "/api/Users/Authentication";
final ProgressDialog progressDialog = ProgressDialog.show(context, "Twitter","Authenticating...");
progressDialog.show();
MyVolley.get(url, AuthProvjeraVM.class, new Response.Listener<AuthProvjeraVM>() {
@Override
public void onResponse(AuthProvjeraVM response) {
progressDialog.dismiss();
onSuccess.run(response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
progressDialog.dismiss();
Toast.makeText(context, "Connection error", Toast.LENGTH_SHORT).show();
}
}, new BasicNameValuePair("username",username),
new BasicNameValuePair("password",password));
}
public static void LoginSession(final Context context, final String username, final MyRunnable<AuthProvjeraVM> onSuccess) {
final String url = MyApi.hostIP + "/api/Users/AuthSession/"+username;
final ProgressDialog progressDialog = ProgressDialog.show(context, "Twitter","Processing...");
progressDialog.show();
MyVolley.get(url, AuthProvjeraVM.class, new Response.Listener<AuthProvjeraVM>() {
@Override
public void onResponse(AuthProvjeraVM response) {
onSuccess.run(response);
progressDialog.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
progressDialog.dismiss();
Toast.makeText(context, "Connection error", Toast.LENGTH_SHORT).show();
}
});
}
public static void AuthRegistration(final Context context, final String username, final MyRunnable<AuthProvjeraVM> onSuccess) {
final String url = MyApi.hostIP + "/api/Users/AuthRegister";
MyVolley.get(url, AuthProvjeraVM.class, new Response.Listener<AuthProvjeraVM>() {
@Override
public void onResponse(AuthProvjeraVM response) {
onSuccess.run(response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(context, "Connection error "+error.getMessage(), Toast.LENGTH_SHORT).show();
}
}, new BasicNameValuePair("username",username));
}
}
| true
|
2b6d68b49f29dda161e7c8dcd488a20509e7afa9
|
Java
|
SOFPA/Ciclo2Iteracion2
|
/ClinicaDeProblemas.api/src/main/java/co/edu/uniandes/csw/SOFPA/uti/master/logic/dto/_UTIMasterDTO.java
|
UTF-8
| 3,798
| 1.6875
| 2
|
[] |
no_license
|
/* ========================================================================
* Copyright 2014 SOFPA
*
* Licensed under the MIT, The MIT License (MIT)
* Copyright (c) 2014 SOFPA
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
* ========================================================================
Source generated by CrudMaker version 1.0.0.201410152247
*/
package co.edu.uniandes.csw.SOFPA.uti.master.logic.dto;
import co.edu.uniandes.csw.SOFPA.opinion.logic.dto.OpinionDTO;
import co.edu.uniandes.csw.SOFPA.usuario.logic.dto.UsuarioDTO;
import co.edu.uniandes.csw.SOFPA.uti.logic.dto.UTIDTO;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public abstract class _UTIMasterDTO {
protected UTIDTO utiEntity;
protected Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public UTIDTO getUTIEntity() {
return utiEntity;
}
public void setUTIEntity(UTIDTO utiEntity) {
this.utiEntity = utiEntity;
}
public List<OpinionDTO> createopinion;
public List<OpinionDTO> updateopinion;
public List<OpinionDTO> deleteopinion;
public List<OpinionDTO> listopinion;
public List<UsuarioDTO> createusuario;
public List<UsuarioDTO> updateusuario;
public List<UsuarioDTO> deleteusuario;
public List<UsuarioDTO> listusuario;
public List<OpinionDTO> getCreateopinion(){ return createopinion; };
public void setCreateopinion(List<OpinionDTO> createopinion){ this.createopinion=createopinion; };
public List<OpinionDTO> getUpdateopinion(){ return updateopinion; };
public void setUpdateopinion(List<OpinionDTO> updateopinion){ this.updateopinion=updateopinion; };
public List<OpinionDTO> getDeleteopinion(){ return deleteopinion; };
public void setDeleteopinion(List<OpinionDTO> deleteopinion){ this.deleteopinion=deleteopinion; };
public List<OpinionDTO> getListopinion(){ return listopinion; };
public void setListopinion(List<OpinionDTO> listopinion){ this.listopinion=listopinion; };
public List<UsuarioDTO> getCreateusuario(){ return createusuario; };
public void setCreateusuario(List<UsuarioDTO> createusuario){ this.createusuario=createusuario; };
public List<UsuarioDTO> getUpdateusuario(){ return updateusuario; };
public void setUpdateusuario(List<UsuarioDTO> updateusuario){ this.updateusuario=updateusuario; };
public List<UsuarioDTO> getDeleteusuario(){ return deleteusuario; };
public void setDeleteusuario(List<UsuarioDTO> deleteusuario){ this.deleteusuario=deleteusuario; };
public List<UsuarioDTO> getListusuario(){ return listusuario; };
public void setListusuario(List<UsuarioDTO> listusuario){ this.listusuario=listusuario; };
}
| true
|
dab89c9f3f262d2e3462ed138caf46e8761a3040
|
Java
|
f3226912/market
|
/market-api/src/main/java/cn/gdeng/market/dto/lease/contract/ContractLeaseDTO.java
|
UTF-8
| 435
| 1.976563
| 2
|
[] |
no_license
|
package cn.gdeng.market.dto.lease.contract;
import cn.gdeng.market.entity.lease.contract.ContractLeaseEntity;
import cn.gdeng.market.enums.BillingUnitEnum;
public class ContractLeaseDTO extends ContractLeaseEntity implements java.io.Serializable{
private static final long serialVersionUID = 4580586614453557354L;
public String getBillingUnitStr() {
return BillingUnitEnum.getNameByCode(getBillingUnit());
}
}
| true
|
99f697635299747bba6e42493a90e517aab3a694
|
Java
|
daggerok/frontend-maven-plugin-example
|
/src/main/java/daggerok/ReactiveNgRxApplication.java
|
UTF-8
| 614
| 1.945313
| 2
|
[
"MIT"
] |
permissive
|
package daggerok;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import reactor.core.publisher.Mono;
@SpringBootApplication
public class ReactiveNgRxApplication {
public static void main(String[] args) {
SpringApplication.run(ReactiveNgRxApplication.class, args);
}
@Controller
public static class HomePage {
@GetMapping({"", "/"})
public Mono<String> index() {
return Mono.just("index");
}
}
}
| true
|
a6dabefeb3db66599529acf43b0bc1149dedf516
|
Java
|
ismoy/DrivinDesafio
|
/app/src/main/java/cl/tofcompany/drivindesafio/Adapter/MainAdapter.java
|
UTF-8
| 2,770
| 2.28125
| 2
|
[] |
no_license
|
package cl.tofcompany.drivindesafio.Adapter;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.RecyclerView;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import cl.tofcompany.drivindesafio.R;
import cl.tofcompany.drivindesafio.activities.MainActivity;
import cn.pedant.SweetAlert.SweetAlertDialog;
public class MainAdapter extends RecyclerView.Adapter<MainAdapter.ViewHolder> {
//Initialize variable
private final Activity activity;
private final ArrayList<String> dataArrayList;
//create constructor
public MainAdapter(Activity activity, ArrayList<String> dataArrayList) {
this.activity = activity;
this.dataArrayList = dataArrayList;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
//Initialize view
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.list_row_main,parent,false);
return new ViewHolder(v);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, @SuppressLint("RecyclerView") int position) {
//Initialize main data
String imagen = dataArrayList.get(position);
//set image on imageview
Picasso.get().load(imagen).into(holder.mImageView);
holder.itemView.setOnClickListener(v -> {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setMessage("Perdon no he logrado capturar los " +
" nombres de esta raza no estaba bien claro la " +
" documentacion de la api, la position de " +
" este imagen es " + position)
.setCancelable(false)
.setPositiveButton("DAME ANIMO", (dialogInterface, i) -> activity.getApplicationContext()).create().show();
});
}
@Override
public int getItemCount() {
return dataArrayList.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
//Initialize variable
ImageView mImageView;
TextView mTextView;
public ViewHolder(@NonNull View itemView) {
super(itemView);
//Assign variable
mImageView = itemView.findViewById(R.id.image_view);
}
}
}
| true
|
c7964d95e4171e583bf4ec5f8268d76aed1f78e8
|
Java
|
WeiXiaoan/Duitang
|
/src/com/duitang/algorithm/NumUtils.java
|
GB18030
| 1,203
| 3.640625
| 4
|
[] |
no_license
|
package com.duitang.algorithm;
import java.util.ArrayList;
import java.util.List;
public class NumUtils {
public List<Integer> handle(String numInput){
List<Integer> list = new ArrayList<Integer>(); //ڴ洢õ
String[] num = numInput.split(","); //öŷָõַ
for(int i = 0; i < num.length ; i++){
list.add(Integer.parseInt(num[i])); //ַתΪ洢list
}
//㷨ؽ
return figure(list);
}
private List<Integer> figure(List<Integer> list){
int[] left = new int[list.size()]; //ڴ洢һij˻
int[] right = new int[list.size()]; //ڴ洢һұij˻
List<Integer> resultList = new ArrayList<Integer>(); //ڴ洢صĽ
left[0] = 1 ;
right[list.size()-1] = 1 ;
for(int i = 1 ; i < list.size() ; i++){
left[i] = left[i-1] * list.get(i-1);
}
for(int i = list.size()-2 ; i >= 0 ;i--){
right[i] = right[i+1] * list.get(i+1);
}
for(int i = 0 ; i < list.size() ; i++){
resultList.add(i, left[i] * right[i]);
}
return resultList;
}
}
| true
|
bb04f546a224c9abc137fadb23fffd71831f6bb4
|
Java
|
amansharma-dev/BabyListApp-MissionAndroid1.2.4
|
/app/src/main/java/com/example/babylistapp_missionandroid124/BabyItemsListActivity.java
|
UTF-8
| 5,894
| 2.125
| 2
|
[] |
no_license
|
package com.example.babylistapp_missionandroid124;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import com.example.babylistapp_missionandroid124.Adapter.RecyclerViewAdapter;
import com.example.babylistapp_missionandroid124.Data.DatabaseHandler;
import com.example.babylistapp_missionandroid124.Model.BabyItems;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
import java.util.List;
public class BabyItemsListActivity extends AppCompatActivity implements View.OnClickListener {
public static final String TAG ="BabyItemsListActivity";
private RecyclerView recyclerView;
private RecyclerViewAdapter recyclerViewAdapter;
private List<BabyItems> babyItemsList;
private DatabaseHandler databaseHandler;
private FloatingActionButton floatingActionButton;
private AlertDialog.Builder builder;
private AlertDialog alertDialog;
private EditText babyItemName;
private EditText quantity;
private EditText color;
private EditText size;
private Button saveBtn;
private CardView cardView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_baby_items_list);
recyclerView = findViewById(R.id.babyItemsList_recyclerView);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
floatingActionButton = findViewById(R.id.fab_activityBabyItems);
floatingActionButton.setOnClickListener(this);
babyItemsList = new ArrayList<>();
databaseHandler = new DatabaseHandler(this);
babyItemsList = databaseHandler.getAllBabyItems();
for (BabyItems babyItems : babyItemsList){
Log.d(TAG, "onCreate: "+babyItems.getItemName());
//babyItemsList.add(babyItems);
}
recyclerViewAdapter = new RecyclerViewAdapter(this,babyItemsList);
recyclerView.setAdapter(recyclerViewAdapter);
//whenever data is changing
recyclerViewAdapter.notifyDataSetChanged();
}
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.fab_activityBabyItems:
createAlertDialog();
break;
case R.id.saveButton_Button:
if (!babyItemName.getText().toString().isEmpty()
&& !quantity.getText().toString().isEmpty()
&& !color.getText().toString().isEmpty()
&& !size.getText().toString().isEmpty()){
saveBabyDetails(view);
//Todo: post delay in dialog dismiss
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
alertDialog.dismiss();
//Todo: move to next screen - details screen
Intent intent = new Intent(BabyItemsListActivity.this,BabyItemsListActivity.class);
startActivity(intent);
}
}, 1200);
}
else{
Snackbar.make(view,"NOT SAVED, ENTER DETAILS",Snackbar.LENGTH_LONG)
.setTextColor(getResources().getColor(R.color.colorButtonDelete))
.setAction("Action",null)
.show();
}
break;
}
createAlertDialog();
}
private void createAlertDialog(){
builder = new AlertDialog.Builder(this);
View view = getLayoutInflater().inflate(R.layout.popup,null);
babyItemName = view.findViewById(R.id.babyItemName_editText);
quantity = view.findViewById(R.id.quantity_EditText);
color = view.findViewById(R.id.color_EditText);
size = view.findViewById(R.id.size_EditText);
saveBtn = view.findViewById(R.id.saveButton_Button);
cardView = view.findViewById(R.id.popup_cardView);
cardView.setCardBackgroundColor(this.getResources().getColor(R.color.colorCard));
saveBtn = view.findViewById(R.id.saveButton_Button);
saveBtn.setOnClickListener(this);
builder.setView(view);
alertDialog = builder.create();//creating dialog object
alertDialog.show();//show
}
public void saveBabyDetails(View view){
//Todo: save each baby item in a Database
//Todo: move to next Screen - baby Items/ details screen.
String baby_ItemName = babyItemName.getText().toString().trim();
int baby_quantity = Integer.parseInt(quantity.getText().toString().trim());
String baby_color = color.getText().toString().trim();
int baby_size = Integer.parseInt(size.getText().toString().trim());
BabyItems babyItems = new BabyItems();
babyItems.setItemName(baby_ItemName);
babyItems.setQuantity(baby_quantity);
babyItems.setColor(baby_color);
babyItems.setSize(baby_size);
databaseHandler.addBabyItem(babyItems);
//snackbar is attached to a view thats why passing View view in save()
Snackbar.make(view,"Baby item saved",Snackbar.LENGTH_SHORT)
.setAction("Action",null).show();
}
}
| true
|
6b589d85f948cff2b92119c1b944ec16f1c90e97
|
Java
|
unfaix/yuneecFly
|
/src/com/yuneec/android/flyingexpert/transfer/download/db/DBConfig.java
|
UTF-8
| 574
| 1.960938
| 2
|
[] |
no_license
|
package com.yuneec.android.flyingexpert.transfer.download.db;
/**
* ****************************************************************
* DBconfig
* @Author yongdaimi
* @Remark
* @Date Mar 18, 2015 3:00:51 PM
* @Company Copyright (C) Yuneec.Inc. All Rights Reserved.
********************************************************************
*/
public class DBConfig {
public static final String DBNAME = "yuneec_dl.db";
public static final int DBVERSION= 1;
public String getDbName() {
return DBNAME;
}
public int getDbVersion() {
return DBVERSION;
}
}
| true
|
a1e598671b9f3dba35dab329a9da66cfb5401dc9
|
Java
|
RicardoAntonio24/Punto_Venta_FerreteriaACME_ERKASoftware
|
/src/views/ViewEmpleadosVentas.java
|
UTF-8
| 69,336
| 1.5
| 2
|
[] |
no_license
|
/*
* 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 views;
/**
*
* @author Andy
*/
public class ViewEmpleadosVentas extends javax.swing.JFrame {
/**
* Creates new form ViewEmpleadosVentas
*/
public ViewEmpleadosVentas() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel9 = new javax.swing.JPanel();
jPanel10 = new javax.swing.JPanel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jl_idadmin = new javax.swing.JLabel();
jl_rfc = new javax.swing.JLabel();
jtf_idadmin = new javax.swing.JTextField();
jtf_rfc = new javax.swing.JTextField();
jl_passwd = new javax.swing.JLabel();
jpf_passwd = new javax.swing.JPasswordField();
jl_nombre = new javax.swing.JLabel();
jtf_nombre = new javax.swing.JTextField();
jl_apellidopat = new javax.swing.JLabel();
jtf_apellidopat = new javax.swing.JTextField();
jl_apellidomate = new javax.swing.JLabel();
jtf_apellidomate = new javax.swing.JTextField();
jl_fechanac = new javax.swing.JLabel();
jtf_anio = new javax.swing.JTextField();
jcb_dia = new javax.swing.JComboBox<>();
jcb_mes = new javax.swing.JComboBox<>();
jl_fechain = new javax.swing.JLabel();
jl_telefono = new javax.swing.JLabel();
jcb_diain = new javax.swing.JComboBox<>();
jcb_mesin = new javax.swing.JComboBox<>();
jtf_anioin = new javax.swing.JTextField();
jtf_telefono = new javax.swing.JTextField();
jl_correoelectronico = new javax.swing.JLabel();
jl_calle = new javax.swing.JLabel();
jtf_correoelectronico = new javax.swing.JTextField();
jl_colonia = new javax.swing.JLabel();
jtf_calle = new javax.swing.JTextField();
jl_codigopostal = new javax.swing.JLabel();
jtf_colonia = new javax.swing.JTextField();
jtf_ciudad = new javax.swing.JTextField();
jl_ciudad = new javax.swing.JLabel();
jtf_codigopostal = new javax.swing.JTextField();
jl_estado = new javax.swing.JLabel();
jtf_estado = new javax.swing.JTextField();
jb_nuevo = new javax.swing.JButton();
jb_insertar = new javax.swing.JButton();
jb_modificar = new javax.swing.JButton();
jb_eliminar = new javax.swing.JButton();
jb_primero = new javax.swing.JButton();
jb_anterior = new javax.swing.JButton();
jb_siguiente = new javax.swing.JButton();
jb_ultimo = new javax.swing.JButton();
jl_nomusuario1 = new javax.swing.JLabel();
jPanel11 = new javax.swing.JPanel();
jPanel12 = new javax.swing.JPanel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jl_idempleados = new javax.swing.JLabel();
jl_rfc1 = new javax.swing.JLabel();
jtf_idempleados = new javax.swing.JTextField();
jtf_rfc1 = new javax.swing.JTextField();
jl_passwd1 = new javax.swing.JLabel();
jpf_passwd1 = new javax.swing.JPasswordField();
jl_nombre1 = new javax.swing.JLabel();
jtf_nombre1 = new javax.swing.JTextField();
jl_apellidopat1 = new javax.swing.JLabel();
jtf_apellidopat1 = new javax.swing.JTextField();
jl_apellidomate1 = new javax.swing.JLabel();
jtf_apellidomate1 = new javax.swing.JTextField();
jl_fechanac1 = new javax.swing.JLabel();
jtf_anio1 = new javax.swing.JTextField();
jcb_dia1 = new javax.swing.JComboBox<>();
jcb_mes1 = new javax.swing.JComboBox<>();
jl_fechain1 = new javax.swing.JLabel();
jl_telefono1 = new javax.swing.JLabel();
jcb_diain1 = new javax.swing.JComboBox<>();
jcb_mesin1 = new javax.swing.JComboBox<>();
jtf_anioin1 = new javax.swing.JTextField();
jtf_telefono1 = new javax.swing.JTextField();
jl_calle1 = new javax.swing.JLabel();
jl_colonia1 = new javax.swing.JLabel();
jtf_calle1 = new javax.swing.JTextField();
jl_codigopostal1 = new javax.swing.JLabel();
jtf_colonia1 = new javax.swing.JTextField();
jtf_ciudad1 = new javax.swing.JTextField();
jl_ciudad1 = new javax.swing.JLabel();
jtf_codigopostal1 = new javax.swing.JTextField();
jl_estado1 = new javax.swing.JLabel();
jtf_estado1 = new javax.swing.JTextField();
jb_nuevo1 = new javax.swing.JButton();
jb_insertar1 = new javax.swing.JButton();
jb_modificar1 = new javax.swing.JButton();
jb_eliminar1 = new javax.swing.JButton();
jb_primero1 = new javax.swing.JButton();
jb_anterior1 = new javax.swing.JButton();
jb_siguiente1 = new javax.swing.JButton();
jb_ultimo1 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jl_nomusuario2 = new javax.swing.JLabel();
jtf_nomusuario = new javax.swing.JTextField();
jb_menuprincipal = new javax.swing.JButton();
jPanel9.setBackground(new java.awt.Color(51, 51, 51));
jPanel10.setBackground(new java.awt.Color(153, 0, 0));
jPanel10.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jLabel7.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
jLabel7.setForeground(new java.awt.Color(255, 255, 255));
jLabel7.setText("Ferreteria ACME");
jLabel8.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
jLabel8.setForeground(new java.awt.Color(255, 255, 255));
jLabel8.setText("Administradores");
javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
jPanel10.setLayout(jPanel10Layout);
jPanel10Layout.setHorizontalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel8)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel7)
.addContainerGap())
);
jPanel10Layout.setVerticalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
.addContainerGap(20, Short.MAX_VALUE)
.addComponent(jLabel7)
.addGap(1, 1, 1)
.addComponent(jLabel8)
.addContainerGap())
);
jl_idadmin.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_idadmin.setForeground(new java.awt.Color(255, 255, 255));
jl_idadmin.setText("ID Administradores:");
jl_rfc.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_rfc.setForeground(new java.awt.Color(255, 255, 255));
jl_rfc.setText("R.F.C:");
jl_passwd.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_passwd.setForeground(new java.awt.Color(255, 255, 255));
jl_passwd.setText("Contraseña:");
jpf_passwd.setText("jPasswordField1");
jl_nombre.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_nombre.setForeground(new java.awt.Color(255, 255, 255));
jl_nombre.setText("Nombre:");
jl_apellidopat.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_apellidopat.setForeground(new java.awt.Color(255, 255, 255));
jl_apellidopat.setText("Apellido Paterno:");
jl_apellidomate.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_apellidomate.setForeground(new java.awt.Color(255, 255, 255));
jl_apellidomate.setText("Apellido Materno:");
jl_fechanac.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_fechanac.setForeground(new java.awt.Color(255, 255, 255));
jl_fechanac.setText("Fecha de Nacimiento:");
jcb_dia.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "01", "02", "03", "04", "05", "07", "10" }));
jcb_mes.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "01", "02", "03", "04", "05" }));
jl_fechain.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_fechain.setForeground(new java.awt.Color(255, 255, 255));
jl_fechain.setText("Fecha de Ingreso:");
jl_telefono.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_telefono.setForeground(new java.awt.Color(255, 255, 255));
jl_telefono.setText("Telefono:");
jcb_diain.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "01", "02", "03", "04", "05" }));
jcb_mesin.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "01", "02", "03", "04" }));
jl_correoelectronico.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_correoelectronico.setForeground(new java.awt.Color(255, 255, 255));
jl_correoelectronico.setText("Correo electronico:");
jl_calle.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_calle.setForeground(new java.awt.Color(255, 255, 255));
jl_calle.setText("Calle No.:");
jl_colonia.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_colonia.setForeground(new java.awt.Color(255, 255, 255));
jl_colonia.setText("Colonia:");
jl_codigopostal.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_codigopostal.setForeground(new java.awt.Color(255, 255, 255));
jl_codigopostal.setText("Codigo Postal:");
jl_ciudad.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_ciudad.setForeground(new java.awt.Color(255, 255, 255));
jl_ciudad.setText("Ciudad:");
jl_estado.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_estado.setForeground(new java.awt.Color(255, 255, 255));
jl_estado.setText("Estado:");
jb_nuevo.setBackground(new java.awt.Color(153, 153, 153));
jb_nuevo.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_nuevo.setText("Nuevo");
jb_nuevo.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204)));
jb_insertar.setBackground(new java.awt.Color(153, 153, 153));
jb_insertar.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_insertar.setText("Insertar");
jb_insertar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(0, 153, 0), new java.awt.Color(0, 153, 0), new java.awt.Color(0, 153, 0), new java.awt.Color(0, 153, 0)));
jb_modificar.setBackground(new java.awt.Color(153, 153, 153));
jb_modificar.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_modificar.setText("Modificar");
jb_modificar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(0, 153, 0), new java.awt.Color(0, 153, 0), new java.awt.Color(0, 153, 0), new java.awt.Color(0, 153, 0)));
jb_eliminar.setBackground(new java.awt.Color(153, 153, 153));
jb_eliminar.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_eliminar.setText("Eliminar");
jb_eliminar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(255, 0, 0), new java.awt.Color(255, 0, 0), new java.awt.Color(255, 0, 0), new java.awt.Color(255, 0, 0)));
jb_primero.setBackground(new java.awt.Color(153, 153, 153));
jb_primero.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_primero.setForeground(new java.awt.Color(51, 51, 51));
jb_primero.setText("|<");
jb_primero.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204)));
jb_anterior.setBackground(new java.awt.Color(204, 204, 204));
jb_anterior.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_anterior.setForeground(new java.awt.Color(51, 51, 51));
jb_anterior.setText("<<");
jb_anterior.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204)));
jb_siguiente.setBackground(new java.awt.Color(204, 204, 204));
jb_siguiente.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_siguiente.setForeground(new java.awt.Color(51, 51, 51));
jb_siguiente.setText(">>");
jb_siguiente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204)));
jb_ultimo.setBackground(new java.awt.Color(153, 153, 153));
jb_ultimo.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_ultimo.setForeground(new java.awt.Color(51, 51, 51));
jb_ultimo.setText(">|");
jb_ultimo.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204)));
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(48, 48, 48)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jl_apellidomate)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jl_rfc, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jl_idadmin, javax.swing.GroupLayout.Alignment.LEADING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jtf_idadmin, javax.swing.GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE)
.addComponent(jtf_rfc)
.addComponent(jtf_nombre, javax.swing.GroupLayout.Alignment.TRAILING)))
.addComponent(jl_nombre, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel9Layout.createSequentialGroup()
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jl_fechanac)
.addComponent(jl_correoelectronico)
.addComponent(jl_calle)
.addComponent(jl_telefono)
.addComponent(jl_fechain)
.addComponent(jl_colonia)
.addComponent(jl_codigopostal)
.addComponent(jl_apellidopat))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addGap(0, 40, Short.MAX_VALUE)
.addComponent(jb_primero, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(31, 31, 31)
.addComponent(jb_anterior, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(35, 35, 35))
.addComponent(jtf_apellidopat)
.addComponent(jtf_apellidomate, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jtf_calle)
.addComponent(jtf_correoelectronico)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jcb_dia, 0, 54, Short.MAX_VALUE)
.addComponent(jcb_diain, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jcb_mesin, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jcb_mes, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jtf_anio)
.addComponent(jtf_anioin)))
.addComponent(jtf_telefono)
.addComponent(jtf_colonia)
.addComponent(jtf_codigopostal))))
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(jl_passwd)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jb_nuevo, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jb_insertar, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jb_modificar, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jb_eliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jpf_passwd, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(26, 26, 26)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jl_estado)
.addComponent(jl_ciudad)
.addComponent(jb_siguiente, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jtf_ciudad, javax.swing.GroupLayout.PREFERRED_SIZE, 214, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtf_estado, javax.swing.GroupLayout.PREFERRED_SIZE, 214, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(41, 41, 41)
.addComponent(jb_ultimo, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)))))))
.addContainerGap(43, Short.MAX_VALUE))
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(28, 28, 28)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_idadmin)
.addComponent(jtf_idadmin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jl_passwd)
.addComponent(jpf_passwd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_rfc)
.addComponent(jtf_rfc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_nombre)
.addComponent(jtf_nombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addComponent(jb_nuevo, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6)))
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_apellidopat)
.addComponent(jtf_apellidopat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_apellidomate)
.addComponent(jtf_apellidomate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jb_insertar, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jl_fechanac)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtf_anio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jcb_dia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jcb_mes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(28, 28, 28))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jb_modificar, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_fechain)
.addComponent(jcb_diain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jcb_mesin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtf_anioin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addComponent(jb_eliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6)))
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_telefono, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtf_telefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_correoelectronico)
.addComponent(jtf_correoelectronico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtf_calle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jl_calle))
.addGap(18, 18, 18)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtf_colonia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jl_colonia)
.addComponent(jl_ciudad)
.addComponent(jtf_ciudad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtf_codigopostal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jl_estado)
.addComponent(jtf_estado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jl_codigopostal))
.addGap(59, 59, 59)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jb_primero, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jb_anterior, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jb_siguiente, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jb_ultimo, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 52, Short.MAX_VALUE))
);
jl_nomusuario1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_nomusuario1.setForeground(new java.awt.Color(255, 255, 255));
jl_nomusuario1.setText("Nombre de Usuario:");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel11.setBackground(new java.awt.Color(51, 51, 51));
jPanel12.setBackground(new java.awt.Color(153, 0, 0));
jPanel12.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jLabel9.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
jLabel9.setForeground(new java.awt.Color(255, 255, 255));
jLabel9.setText("Ferreteria ACME");
jLabel10.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
jLabel10.setForeground(new java.awt.Color(255, 255, 255));
jLabel10.setText("Empleados Ventas");
jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/1EmpleadoVenta.png"))); // NOI18N
javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
jPanel12.setLayout(jPanel12Layout);
jPanel12Layout.setHorizontalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel10)
.addGap(26, 26, 26)
.addComponent(jLabel12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel9))
);
jPanel12Layout.setVerticalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout.createSequentialGroup()
.addContainerGap(20, Short.MAX_VALUE)
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel12)
.addGroup(jPanel12Layout.createSequentialGroup()
.addComponent(jLabel9)
.addGap(3, 3, 3)
.addComponent(jLabel10)))
.addContainerGap())
);
jl_idempleados.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_idempleados.setForeground(new java.awt.Color(255, 255, 255));
jl_idempleados.setText("ID Empleados:");
jl_rfc1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_rfc1.setForeground(new java.awt.Color(255, 255, 255));
jl_rfc1.setText("R.F.C:");
jtf_idempleados.setEnabled(false);
jl_passwd1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_passwd1.setForeground(new java.awt.Color(255, 255, 255));
jl_passwd1.setText("Contraseña:");
jl_nombre1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_nombre1.setForeground(new java.awt.Color(255, 255, 255));
jl_nombre1.setText("Nombre:");
jl_apellidopat1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_apellidopat1.setForeground(new java.awt.Color(255, 255, 255));
jl_apellidopat1.setText("Apellido Paterno:");
jl_apellidomate1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_apellidomate1.setForeground(new java.awt.Color(255, 255, 255));
jl_apellidomate1.setText("Apellido Materno:");
jl_fechanac1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_fechanac1.setForeground(new java.awt.Color(255, 255, 255));
jl_fechanac1.setText("Fecha de Nacimiento:");
jcb_dia1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "01", "02", "03", "04", "05", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
jcb_mes1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }));
jl_fechain1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_fechain1.setForeground(new java.awt.Color(255, 255, 255));
jl_fechain1.setText("Fecha de Ingreso:");
jl_telefono1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_telefono1.setForeground(new java.awt.Color(255, 255, 255));
jl_telefono1.setText("Telefono:");
jcb_diain1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "01", "02", "03", "04", "05", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
jcb_mesin1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }));
jl_calle1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_calle1.setForeground(new java.awt.Color(255, 255, 255));
jl_calle1.setText("Calle No.:");
jl_colonia1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_colonia1.setForeground(new java.awt.Color(255, 255, 255));
jl_colonia1.setText("Colonia:");
jl_codigopostal1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_codigopostal1.setForeground(new java.awt.Color(255, 255, 255));
jl_codigopostal1.setText("Codigo Postal:");
jl_ciudad1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_ciudad1.setForeground(new java.awt.Color(255, 255, 255));
jl_ciudad1.setText("Ciudad:");
jl_estado1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_estado1.setForeground(new java.awt.Color(255, 255, 255));
jl_estado1.setText("Estado:");
jb_nuevo1.setBackground(new java.awt.Color(153, 153, 153));
jb_nuevo1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_nuevo1.setText("Nuevo");
jb_nuevo1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204)));
jb_insertar1.setBackground(new java.awt.Color(153, 153, 153));
jb_insertar1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_insertar1.setText("Insertar");
jb_insertar1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(0, 153, 0), new java.awt.Color(0, 153, 0), new java.awt.Color(0, 153, 0), new java.awt.Color(0, 153, 0)));
jb_modificar1.setBackground(new java.awt.Color(153, 153, 153));
jb_modificar1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_modificar1.setText("Modificar");
jb_modificar1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(0, 153, 0), new java.awt.Color(0, 153, 0), new java.awt.Color(0, 153, 0), new java.awt.Color(0, 153, 0)));
jb_eliminar1.setBackground(new java.awt.Color(153, 153, 153));
jb_eliminar1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_eliminar1.setText("Eliminar");
jb_eliminar1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(255, 0, 0), new java.awt.Color(255, 0, 0), new java.awt.Color(255, 0, 0), new java.awt.Color(255, 0, 0)));
jb_primero1.setBackground(new java.awt.Color(153, 153, 153));
jb_primero1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_primero1.setForeground(new java.awt.Color(51, 51, 51));
jb_primero1.setText("|<");
jb_primero1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204)));
jb_anterior1.setBackground(new java.awt.Color(204, 204, 204));
jb_anterior1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_anterior1.setForeground(new java.awt.Color(51, 51, 51));
jb_anterior1.setText("<<");
jb_anterior1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204)));
jb_siguiente1.setBackground(new java.awt.Color(204, 204, 204));
jb_siguiente1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_siguiente1.setForeground(new java.awt.Color(51, 51, 51));
jb_siguiente1.setText(">>");
jb_siguiente1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204)));
jb_ultimo1.setBackground(new java.awt.Color(153, 153, 153));
jb_ultimo1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_ultimo1.setForeground(new java.awt.Color(51, 51, 51));
jb_ultimo1.setText(">|");
jb_ultimo1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204)));
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/1insertar.png"))); // NOI18N
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/1inser.png"))); // NOI18N
jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/1editar.png"))); // NOI18N
jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/1eliminar.png"))); // NOI18N
jl_nomusuario2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jl_nomusuario2.setForeground(new java.awt.Color(255, 255, 255));
jl_nomusuario2.setText("Nombre de Usuario:");
jb_menuprincipal.setBackground(new java.awt.Color(153, 153, 153));
jb_menuprincipal.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jb_menuprincipal.setText("Menú Principal");
jb_menuprincipal.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204)));
javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
jPanel11.setLayout(jPanel11Layout);
jPanel11Layout.setHorizontalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(48, 48, 48)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jl_rfc1, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jl_idempleados, javax.swing.GroupLayout.Alignment.LEADING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jtf_idempleados, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(197, 197, 197)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))))
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)))
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jb_nuevo1, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jb_insertar1, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jb_modificar1, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jb_eliminar1, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(134, Short.MAX_VALUE))
.addGroup(jPanel11Layout.createSequentialGroup()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(398, 398, 398)
.addComponent(jl_ciudad1))
.addComponent(jl_nombre1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtf_ciudad1, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(365, 365, 365)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jl_passwd1)
.addComponent(jl_nomusuario2))
.addGap(18, 18, 18)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jtf_nomusuario)
.addComponent(jpf_passwd1, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE)))
.addGroup(jPanel11Layout.createSequentialGroup()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jl_colonia1)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jl_fechanac1)
.addComponent(jl_calle1)
.addComponent(jl_telefono1)
.addComponent(jl_fechain1)
.addComponent(jl_codigopostal1)
.addComponent(jl_apellidopat1)
.addComponent(jl_apellidomate1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jtf_calle1, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jtf_telefono1, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jtf_nombre1, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jtf_apellidopat1, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jtf_apellidomate1, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel11Layout.createSequentialGroup()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jcb_dia1, 0, 54, Short.MAX_VALUE)
.addComponent(jcb_diain1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jcb_mesin1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jcb_mes1, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jtf_anioin1, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
.addComponent(jtf_anio1)))
.addComponent(jtf_rfc1, javax.swing.GroupLayout.Alignment.LEADING))
.addComponent(jtf_colonia1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtf_codigopostal1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(43, 43, 43)
.addComponent(jl_estado1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtf_estado1, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(39, Short.MAX_VALUE))))
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(156, 156, 156)
.addComponent(jb_primero1, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jb_anterior1, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(30, 30, 30)
.addComponent(jb_siguiente1, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jb_ultimo1, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jb_menuprincipal, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel11Layout.setVerticalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(28, 28, 28)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_idempleados)
.addComponent(jtf_idempleados, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jl_nomusuario2)
.addComponent(jtf_nomusuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_rfc1)
.addComponent(jtf_rfc1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jl_passwd1)
.addComponent(jpf_passwd1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(7, 7, 7)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jb_nuevo1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addGap(20, 20, 20)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jb_insertar1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(55, 55, 55)
.addComponent(jb_modificar1, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel11Layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(10, 10, 10)
.addComponent(jLabel3)))
.addGap(18, 18, 18)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jb_eliminar1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addGap(72, 72, 72))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel11Layout.createSequentialGroup()
.addGap(18, 34, Short.MAX_VALUE)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_nombre1)
.addComponent(jtf_nombre1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_apellidopat1)
.addComponent(jtf_apellidopat1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtf_apellidomate1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jl_apellidomate1))
.addGap(28, 28, 28)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jl_fechanac1)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtf_anio1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jcb_dia1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jcb_mes1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(28, 28, 28)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_fechain1)
.addComponent(jcb_diain1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jcb_mesin1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtf_anioin1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(28, 28, 28)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_telefono1, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtf_telefono1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_calle1)
.addComponent(jtf_calle1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jl_ciudad1)
.addComponent(jtf_ciudad1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(18, 18, 18)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jl_colonia1)
.addComponent(jtf_codigopostal1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jl_estado1)
.addComponent(jtf_estado1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtf_colonia1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jl_codigopostal1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, Short.MAX_VALUE)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jb_primero1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jb_anterior1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jb_siguiente1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jb_ultimo1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jb_menuprincipal, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ViewEmpleadosVentas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ViewEmpleadosVentas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ViewEmpleadosVentas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ViewEmpleadosVentas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ViewEmpleadosVentas().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
public javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
public javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel9;
public javax.swing.JButton jb_anterior;
public javax.swing.JButton jb_anterior1;
public javax.swing.JButton jb_eliminar;
public javax.swing.JButton jb_eliminar1;
public javax.swing.JButton jb_insertar;
public javax.swing.JButton jb_insertar1;
public javax.swing.JButton jb_menuprincipal;
public javax.swing.JButton jb_modificar;
public javax.swing.JButton jb_modificar1;
public javax.swing.JButton jb_nuevo;
public javax.swing.JButton jb_nuevo1;
public javax.swing.JButton jb_primero;
public javax.swing.JButton jb_primero1;
public javax.swing.JButton jb_siguiente;
public javax.swing.JButton jb_siguiente1;
public javax.swing.JButton jb_ultimo;
public javax.swing.JButton jb_ultimo1;
public javax.swing.JComboBox<String> jcb_dia;
public javax.swing.JComboBox<String> jcb_dia1;
public javax.swing.JComboBox<String> jcb_diain;
public javax.swing.JComboBox<String> jcb_diain1;
public javax.swing.JComboBox<String> jcb_mes;
public javax.swing.JComboBox<String> jcb_mes1;
public javax.swing.JComboBox<String> jcb_mesin;
public javax.swing.JComboBox<String> jcb_mesin1;
public javax.swing.JLabel jl_apellidomate;
public javax.swing.JLabel jl_apellidomate1;
public javax.swing.JLabel jl_apellidopat;
public javax.swing.JLabel jl_apellidopat1;
public javax.swing.JLabel jl_calle;
public javax.swing.JLabel jl_calle1;
public javax.swing.JLabel jl_ciudad;
public javax.swing.JLabel jl_ciudad1;
public javax.swing.JLabel jl_codigopostal;
public javax.swing.JLabel jl_codigopostal1;
public javax.swing.JLabel jl_colonia;
public javax.swing.JLabel jl_colonia1;
public javax.swing.JLabel jl_correoelectronico;
public javax.swing.JLabel jl_estado;
public javax.swing.JLabel jl_estado1;
public javax.swing.JLabel jl_fechain;
public javax.swing.JLabel jl_fechain1;
public javax.swing.JLabel jl_fechanac;
public javax.swing.JLabel jl_fechanac1;
public javax.swing.JLabel jl_idadmin;
public javax.swing.JLabel jl_idempleados;
public javax.swing.JLabel jl_nombre;
public javax.swing.JLabel jl_nombre1;
public javax.swing.JLabel jl_nomusuario1;
public javax.swing.JLabel jl_nomusuario2;
public javax.swing.JLabel jl_passwd;
public javax.swing.JLabel jl_passwd1;
public javax.swing.JLabel jl_rfc;
public javax.swing.JLabel jl_rfc1;
public javax.swing.JLabel jl_telefono;
public javax.swing.JLabel jl_telefono1;
public javax.swing.JPasswordField jpf_passwd;
public javax.swing.JPasswordField jpf_passwd1;
public javax.swing.JTextField jtf_anio;
public javax.swing.JTextField jtf_anio1;
public javax.swing.JTextField jtf_anioin;
public javax.swing.JTextField jtf_anioin1;
public javax.swing.JTextField jtf_apellidomate;
public javax.swing.JTextField jtf_apellidomate1;
public javax.swing.JTextField jtf_apellidopat;
public javax.swing.JTextField jtf_apellidopat1;
public javax.swing.JTextField jtf_calle;
public javax.swing.JTextField jtf_calle1;
public javax.swing.JTextField jtf_ciudad;
public javax.swing.JTextField jtf_ciudad1;
public javax.swing.JTextField jtf_codigopostal;
public javax.swing.JTextField jtf_codigopostal1;
public javax.swing.JTextField jtf_colonia;
public javax.swing.JTextField jtf_colonia1;
public javax.swing.JTextField jtf_correoelectronico;
public javax.swing.JTextField jtf_estado;
public javax.swing.JTextField jtf_estado1;
public javax.swing.JTextField jtf_idadmin;
public javax.swing.JTextField jtf_idempleados;
public javax.swing.JTextField jtf_nombre;
public javax.swing.JTextField jtf_nombre1;
public javax.swing.JTextField jtf_nomusuario;
public javax.swing.JTextField jtf_rfc;
public javax.swing.JTextField jtf_rfc1;
public javax.swing.JTextField jtf_telefono;
public javax.swing.JTextField jtf_telefono1;
// End of variables declaration//GEN-END:variables
}
| true
|
9b6bcbeb1a7e9c360f274ec4940eaec5fb22d672
|
Java
|
palatable/lambda
|
/src/test/java/com/jnape/palatable/lambda/functions/builtin/fn3/LiftA2Test.java
|
UTF-8
| 1,570
| 2.578125
| 3
|
[
"MIT"
] |
permissive
|
package com.jnape.palatable.lambda.functions.builtin.fn3;
import com.jnape.palatable.lambda.adt.Either;
import com.jnape.palatable.lambda.adt.Maybe;
import com.jnape.palatable.lambda.functions.Fn2;
import org.junit.Test;
import static com.jnape.palatable.lambda.adt.Either.left;
import static com.jnape.palatable.lambda.adt.Either.right;
import static com.jnape.palatable.lambda.adt.Maybe.just;
import static com.jnape.palatable.lambda.adt.Maybe.nothing;
import static com.jnape.palatable.lambda.functions.builtin.fn3.LiftA2.liftA2;
import static org.junit.Assert.assertEquals;
public class LiftA2Test {
@Test
public void inference() {
Fn2<Integer, Integer, Integer> add = Integer::sum;
Maybe<Integer> a = liftA2(add, just(1), just(2));
assertEquals(just(3), a);
Maybe<Integer> b = liftA2(add, just(1), nothing());
assertEquals(nothing(), b);
Maybe<Integer> c = liftA2(add, nothing(), just(2));
assertEquals(nothing(), c);
Maybe<Integer> d = liftA2(add, nothing(), nothing());
assertEquals(nothing(), d);
Either<String, Integer> e = liftA2(add, Either.right(1), right(2));
assertEquals(right(3), e);
Either<String, Integer> f = liftA2(add, left("error"), right(2));
assertEquals(left("error"), f);
Either<String, Integer> g = liftA2(add, right(1), left("error"));
assertEquals(left("error"), g);
Either<String, Integer> h = liftA2(add, left("error"), left("another error"));
assertEquals(left("error"), h);
}
}
| true
|
af9ba996af6002d9c832a722ae66ab23ae5620f3
|
Java
|
YaroslavHrab/CI-CD-Test-with-University
|
/src/main/java/ua/com/foxminded/university/web/security/user/UserDao.java
|
UTF-8
| 596
| 2.171875
| 2
|
[] |
no_license
|
package ua.com.foxminded.university.web.security.user;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.transaction.Transactional;
import org.springframework.stereotype.Component;
@Component
@Transactional
public class UserDao implements IUserDao{
@PersistenceContext
EntityManager entityManager;
public User findOne(String username) {
return entityManager.createQuery("SELECT user FROM User user WHERE user.username = :username", User.class)
.setParameter("username", username).getSingleResult();
}
}
| true
|
43417995e20a5365fd354a7f478277440772874e
|
Java
|
MikeFot/Android--Dota2-Mobile-Stats
|
/app2/src/main/java/com/michaelfotiadis/mobiledota2/ui/view/map/MapContainer.java
|
UTF-8
| 1,923
| 2.40625
| 2
|
[] |
no_license
|
package com.michaelfotiadis.mobiledota2.ui.view.map;
import android.os.Parcel;
import android.os.Parcelable;
public class MapContainer implements Parcelable {
private final float mX;
private final float mY;
private final boolean mIsDestroyed;
private final boolean mIsTower;
private final boolean mIsRadiant;
public MapContainer(final float x, final float y, final boolean isDestroyed, final boolean isTower, final boolean mIsRadiant) {
this.mX = x;
this.mY = y;
this.mIsDestroyed = isDestroyed;
this.mIsTower = isTower;
this.mIsRadiant = mIsRadiant;
}
public float getX() {
return mX;
}
public float getY() {
return mY;
}
public boolean isRadiant() {
return mIsRadiant;
}
public boolean isTower() {
return mIsTower;
}
public boolean isDestroyed() {
return mIsDestroyed;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(final Parcel dest, final int flags) {
dest.writeFloat(this.mX);
dest.writeFloat(this.mY);
dest.writeByte(mIsDestroyed ? (byte) 1 : (byte) 0);
dest.writeByte(mIsTower ? (byte) 1 : (byte) 0);
dest.writeByte(mIsRadiant ? (byte) 1 : (byte) 0);
}
protected MapContainer(final Parcel in) {
this.mX = in.readFloat();
this.mY = in.readFloat();
this.mIsDestroyed = in.readByte() != 0;
this.mIsTower = in.readByte() != 0;
this.mIsRadiant = in.readByte() != 0;
}
public static final Creator<MapContainer> CREATOR = new Creator<MapContainer>() {
public MapContainer createFromParcel(final Parcel source) {
return new MapContainer(source);
}
public MapContainer[] newArray(final int size) {
return new MapContainer[size];
}
};
}
| true
|
e066d0b983d7c090bb9e1a52c6eb9b83cf42e960
|
Java
|
tevfikgk/Selenium2019
|
/SeleniumBatchV/src/com/class07/ExplicitWaitDemo3.java
|
UTF-8
| 987
| 2.4375
| 2
|
[] |
no_license
|
package com.class07;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.utils.CommonMethods;
public class ExplicitWaitDemo3 extends CommonMethods{
/*
*
*/
public static void main(String[] args) {
setUp("chrome", "https://the-internet.herokuapp.com");
driver.findElement(By.linkText("Dynamic Loading")).click();
driver.findElement(By.partialLinkText("Example 1:")).click();
driver.findElement(By.xpath("//button[text()='Start']")).click();
WebDriverWait wait=new WebDriverWait(driver,30);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//h4[text()='Hello World!']"))) ;
boolean visibleText= driver.findElement(By.xpath("//h4[text()='Hello World!']")).isDisplayed();
if(visibleText) {
System.out.println("Pass");
}else {
System.out.println("Fail");
}
driver.quit();
}
}
| true
|
f7a023d96a2878a069f68064961b8e34277f9032
|
Java
|
mogilka/kz.zvezdochet.core
|
/src/kz/zvezdochet/core/ui/ArrayLabelProvider.java
|
UTF-8
| 973
| 2.390625
| 2
|
[] |
no_license
|
package kz.zvezdochet.core.ui;
import org.eclipse.jface.viewers.ITableColorProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
/**
* Обработчик отображения содержимого таблицы
*
* @author Natalie Didenko
*/
public class ArrayLabelProvider extends LabelProvider implements
ITableLabelProvider, ITableColorProvider {
@Override
public Image getColumnImage(Object element, int columnIndex) {
return null;
}
@Override
public String getColumnText(Object element, int columnIndex) {
Object[] array = (Object[]) element;
Object val = array[columnIndex];
return (null == val) ? "" : val.toString();
}
@Override
public Color getForeground(Object element, int columnIndex) {
return null;
}
@Override
public Color getBackground(Object element, int columnIndex) {
return null;
}
}
| true
|
be102e78fd6eb50928a504082cd6b453ef4f1f56
|
Java
|
ismart-yuxi/spring-best-practices
|
/common/src/main/java/top/rizon/springbestpractice/common/handler/MessageSourceHandler.java
|
UTF-8
| 950
| 2.015625
| 2
|
[] |
no_license
|
package top.rizon.springbestpractice.common.handler;
import lombok.RequiredArgsConstructor;
import org.springframework.context.MessageSource;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.support.RequestContextUtils;
import javax.servlet.http.HttpServletRequest;
/**
* @author Rizon
* @date 2019/12/13
*/
@Component
@RequiredArgsConstructor
public class MessageSourceHandler {
private final HttpServletRequest request;
private final MessageSource messageSource;
public String getMessage(String code, @Nullable Object[] args, @Nullable String defaultMessage) {
return messageSource.getMessage(code, args, defaultMessage, RequestContextUtils.getLocale(request));
}
public String getMessage(String code, @Nullable Object[] args) {
return messageSource.getMessage(code, args, RequestContextUtils.getLocale(request));
}
}
| true
|
c616fa5a45be57d337038c2677f426afbdd0deb1
|
Java
|
770915026/jeesite
|
/src/main/java/com/thinkgem/jeesite/modules/taier/entity/TlCompanyInfo.java
|
UTF-8
| 2,218
| 1.75
| 2
|
[
"Apache-2.0"
] |
permissive
|
/**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.taier.entity;
import com.thinkgem.jeesite.common.persistence.DataEntity;
import com.thinkgem.jeesite.modules.sys.entity.User;
/**
* 厂家基本信息Entity
* @author gy
* @version 2018-08-20
*/
public class TlCompanyInfo extends DataEntity<TlCompanyInfo> {
private static final long serialVersionUID = 1L;
private String name; // 企业名称
private String nameEn; // 企业英文名称
private String address; // 地址
private String phone; // 联系人电话
private String email; // 邮箱
private String linkmanName; // 联系人姓名
private User user; // 用户id
private String zipCode; // 邮编
private TlFactory tlFactory;
private String factoryName;
public TlCompanyInfo() {
super();
}
public TlCompanyInfo(String id){
super(id);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNameEn() {
return nameEn;
}
public void setNameEn(String nameEn) {
this.nameEn = nameEn;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getLinkmanName() {
return linkmanName;
}
public void setLinkmanName(String linkmanName) {
this.linkmanName = linkmanName;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getZipCode() {
return zipCode;
}
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
public TlFactory getTlFactory() {
return tlFactory;
}
public void setTlFactory(TlFactory tlFactory) {
this.tlFactory = tlFactory;
}
public String getFactoryName() {
return factoryName;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
}
| true
|
b00af52fda981b70bdb2223d69b2b2c0d3da1c1e
|
Java
|
f981545521/scorpio
|
/scorpio-web/src/main/java/cn/acyou/scorpio/conf/TransactionAdviceConfig.java
|
UTF-8
| 3,208
| 2.15625
| 2
|
[] |
no_license
|
package cn.acyou.scorpio.conf;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.aop.Advisor;
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionManager;
import org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource;
import org.springframework.transaction.interceptor.RollbackRuleAttribute;
import org.springframework.transaction.interceptor.RuleBasedTransactionAttribute;
import org.springframework.transaction.interceptor.TransactionInterceptor;
import java.util.Collections;
/**
* 通过AOP切面设置全局事务,拦截service包下面指定方法
*
* @author youfang
* @version [1.0.0, 2020-4-19 下午 07:42]
**/
@Aspect
@Configuration
public class TransactionAdviceConfig {
private static final String AOP_POINTCUT_EXPRESSION = "execution(* cn.acyou.scorpio.service..*.*(..))";
@Autowired
private TransactionManager transactionManager;
@Bean
public TransactionInterceptor txAdvice() {
NameMatchTransactionAttributeSource source = new NameMatchTransactionAttributeSource();
RuleBasedTransactionAttribute txAttr_REQUIRED = new RuleBasedTransactionAttribute();
txAttr_REQUIRED.setRollbackRules(Collections.singletonList(new RollbackRuleAttribute(Exception.class)));
/* 当前存在事务就使用当前事务,当前不存在事务就创建一个新的事务 */
txAttr_REQUIRED.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
/* 读已提交 */
txAttr_REQUIRED.setIsolationLevel(TransactionDefinition.ISOLATION_READ_COMMITTED);
source.addTransactionalMethod("add*", txAttr_REQUIRED);
source.addTransactionalMethod("save*", txAttr_REQUIRED);
source.addTransactionalMethod("insert*", txAttr_REQUIRED);
source.addTransactionalMethod("del*", txAttr_REQUIRED);
source.addTransactionalMethod("delete*", txAttr_REQUIRED);
source.addTransactionalMethod("update*", txAttr_REQUIRED);
source.addTransactionalMethod("edit*", txAttr_REQUIRED);
source.addTransactionalMethod("over*", txAttr_REQUIRED);
source.addTransactionalMethod("check*", txAttr_REQUIRED);
source.addTransactionalMethod("move*", txAttr_REQUIRED);
source.addTransactionalMethod("opt*", txAttr_REQUIRED);
source.addTransactionalMethod("exec*", txAttr_REQUIRED);
source.addTransactionalMethod("do*", txAttr_REQUIRED);
source.addTransactionalMethod("set*", txAttr_REQUIRED);
return new TransactionInterceptor(transactionManager, source);
}
@Bean
public Advisor txAdviceAdvisor() {
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
pointcut.setExpression(AOP_POINTCUT_EXPRESSION);
return new DefaultPointcutAdvisor(pointcut, txAdvice());
}
}
| true
|
26050dd9c12a8e2d465525250f6f505300fce3af
|
Java
|
rayhan-ferdous/code2vec
|
/codebase/selected/seltrans/1552187.java
|
UTF-8
| 5,124
| 2.1875
| 2
|
[] |
no_license
|
package Utilities ;
import java . io . File ;
import java . io . FileInputStream ;
import java . io . FileOutputStream ;
import java . io . IOException ;
import java . io . InputStream ;
import java . io . OutputStream ;
import java . nio . channels . FileChannel ;
import java . util . zip . ZipEntry ;
import java . util . zip . ZipOutputStream ;
public class FileUtils {
public static void zipFolder ( String srcFolder , String destZipFile ) throws Exception {
ZipOutputStream zip = null ;
FileOutputStream fileWriter = null ;
fileWriter = new FileOutputStream ( destZipFile ) ;
zip = new ZipOutputStream ( fileWriter ) ;
addFolderToZip ( "" , srcFolder , zip ) ;
zip . flush ( ) ;
zip . close ( ) ;
}
private static void addFolderToZip ( String path , String srcFolder , ZipOutputStream zip ) throws Exception {
File folder = new File ( srcFolder ) ;
for ( String fileName : folder . list ( ) ) {
if ( path . equals ( "" ) ) {
addFileToZip ( folder . getName ( ) , srcFolder + "/" + fileName , zip ) ;
} else {
addFileToZip ( path + "/" + folder . getName ( ) , srcFolder + "/" + fileName , zip ) ;
}
}
}
private static void addFileToZip ( String path , String srcFile , ZipOutputStream zip ) throws Exception {
File folder = new File ( srcFile ) ;
if ( folder . isDirectory ( ) ) {
addFolderToZip ( path , srcFile , zip ) ;
} else {
byte [ ] buf = new byte [ 1024 ] ;
int len ;
FileInputStream in = new FileInputStream ( srcFile ) ;
zip . putNextEntry ( new ZipEntry ( path + "/" + folder . getName ( ) ) ) ;
while ( ( len = in . read ( buf ) ) > 0 ) {
zip . write ( buf , 0 , len ) ;
}
in . close ( ) ;
}
}
public static void deleteDir ( File file ) throws IOException {
if ( file . isDirectory ( ) ) {
if ( file . list ( ) . length == 0 ) {
file . delete ( ) ;
} else {
String files [ ] = file . list ( ) ;
for ( String temp : files ) {
File fileDelete = new File ( file , temp ) ;
deleteDir ( fileDelete ) ;
}
if ( file . list ( ) . length == 0 ) {
file . delete ( ) ;
}
}
} else {
file . delete ( ) ;
}
}
public static String getFileNameWithoutExt ( String fileName ) {
File file = new File ( fileName ) ;
int index = file . getName ( ) . lastIndexOf ( '.' ) ;
if ( index > 0 && index <= file . getName ( ) . length ( ) - 2 ) {
return file . getName ( ) . substring ( 0 , index ) ;
}
return "" ;
}
public static String getFileExtension ( File file ) {
String ext = null ;
String s = file . getName ( ) ;
int i = s . lastIndexOf ( "." ) ;
if ( i > 0 && i < s . length ( ) - 1 ) {
ext = s . substring ( i + 1 ) . toLowerCase ( ) ;
}
return ext ;
}
public static String getProjectNameFromPiqFile ( String fileName ) {
return getFileNameWithoutExt ( fileName ) . replaceAll ( "all_" , "" ) ;
}
public static void copyFile ( File sourceFile , File destFile ) throws IOException {
if ( ! destFile . exists ( ) ) {
destFile . createNewFile ( ) ;
}
FileChannel source = null ;
FileChannel destination = null ;
try {
source = new FileInputStream ( sourceFile ) . getChannel ( ) ;
destination = new FileOutputStream ( destFile ) . getChannel ( ) ;
destination . transferFrom ( source , 0 , source . size ( ) ) ;
} finally {
if ( source != null ) {
source . close ( ) ;
}
if ( destination != null ) {
destination . close ( ) ;
}
}
}
public static void copyFolder ( File src , File dest ) throws IOException {
if ( src . isDirectory ( ) ) {
if ( ! dest . exists ( ) ) {
dest . mkdir ( ) ;
System . out . println ( "Directory copied from " + src + " to " + dest ) ;
}
String files [ ] = src . list ( ) ;
for ( String file : files ) {
File srcFile = new File ( src , file ) ;
File destFile = new File ( dest , file ) ;
copyFolder ( srcFile , destFile ) ;
}
} else {
InputStream in = new FileInputStream ( src ) ;
OutputStream out = new FileOutputStream ( dest ) ;
byte [ ] buffer = new byte [ 1024 ] ;
int length ;
while ( ( length = in . read ( buffer ) ) > 0 ) {
out . write ( buffer , 0 , length ) ;
}
in . close ( ) ;
out . close ( ) ;
System . out . println ( "File copied from " + src + " to " + dest ) ;
}
}
}
| true
|
56315c193f9f8bd4629201f9995302720c4ab351
|
Java
|
spnaga68/NTracker
|
/app/src/main/java/pasu/ntracker/GoodSelection.java
|
UTF-8
| 2,907
| 2.046875
| 2
|
[] |
no_license
|
package pasu.ntracker;
import android.*;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import pasu.ntracker.viewer.VideoActivityMain;
/**
* Created by Admin on 31-03-2018.
*/
public class GoodSelection extends AppCompatActivity {
EditText goods, priority, value;
Button next;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dealer);
goods = findViewById(R.id.goods);
value = findViewById(R.id.value);
next = findViewById(R.id.next);
findViewById(R.id.track).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivityForResult(new Intent(GoodSelection.this,MainActivity.class),200);
}
});
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(GoodSelection.this,LocationActivity.class));
}
});
goods.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivityForResult(new Intent(GoodSelection.this,SimpleScannerActivity.class),200);
}
});
}
@Override
protected void onResume() {
super.onResume();
if (ContextCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED) {
} else {
// No explanation needed, we can request the permission.
ActivityCompat.requestPermissions(this,
new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},
400);
}
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.CAMERA)
== PackageManager.PERMISSION_GRANTED) {
} else {
// No explanation needed, we can request the permission.
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.CAMERA},
200);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(data!=null && data.getStringExtra("hai")!=null){
goods.setText(data.getStringExtra("hai"));
}
}
}
| true
|
10e3af8ba80a7a7df256285e96ae393036109487
|
Java
|
duongdvd/cats
|
/sourcecode/src/main/java/jp/co/willwave/aca/web/restController/EmergencyRestController.java
|
UTF-8
| 1,547
| 2.328125
| 2
|
[] |
no_license
|
package jp.co.willwave.aca.web.restController;
import jp.co.willwave.aca.common.LogicException;
import jp.co.willwave.aca.dto.api.EmergencyDTO;
import jp.co.willwave.aca.dto.api.ResponseDTO;
import jp.co.willwave.aca.service.EmergencyLogsService;
import org.apache.log4j.Logger;
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.RestController;
@RestController
@RequestMapping("/api")
public class EmergencyRestController {
private final Logger logger = Logger.getLogger(EmergencyRestController.class);
private final EmergencyLogsService emergencyLogsService;
public EmergencyRestController(EmergencyLogsService emergencyLogsService) {
this.emergencyLogsService = emergencyLogsService;
}
@PostMapping("/emergency")
public ResponseDTO sendEmergency(@RequestBody EmergencyDTO emergencyDTO) {
try {
emergencyLogsService.sendEmergency(emergencyDTO);
} catch (LogicException e) {
logger.error("Error logic exception sendEmergency ", e);
return new ResponseDTO().errorCode(e.getErrorCode())
.message(e.getMessage());
} catch (Exception e) {
logger.error("Error exception sendEmergency ", e);
return new ResponseDTO().error()
.message(e.getMessage());
}
return new ResponseDTO().success();
}
}
| true
|
17807a838c780afb8b46f8387b8bbc6b13602c4c
|
Java
|
Sakymaci/Aima-unideb-
|
/Flip4/src/ActionFunction.java
|
UTF-8
| 1,017
| 2.90625
| 3
|
[] |
no_license
|
import java.util.HashSet;
import java.util.Set;
import aima.core.agent.Action;
import aima.core.search.framework.problem.ActionsFunction;
public class ActionFunction implements ActionsFunction {
@Override
public Set<Action> actions(Object o) {
Set<Action> actionSet = new HashSet<>();
State s = (State)o;
if(s.one()) {
actionSet.add(new Actions(Actions.ONE));
}
if(s.two()) {
actionSet.add(new Actions(Actions.TWO));
}
if(s.three()) {
actionSet.add(new Actions(Actions.THREE));
}
if(s.four()) {
actionSet.add(new Actions(Actions.FOUR));
}
if(s.five()) {
actionSet.add(new Actions(Actions.FIVE));
}
if(s.six()) {
actionSet.add(new Actions(Actions.SIX));
}
if(s.seven()) {
actionSet.add(new Actions(Actions.SEVEN));
}
if(s.eight()) {
actionSet.add(new Actions(Actions.EIGHT));
}
if(s.nine()) {
actionSet.add(new Actions(Actions.NINE));
}
return actionSet;
}
}
| true
|
3292d162c0921acc51f88d6959a97c7a4e95ebf2
|
Java
|
AartisharmaPro/T-Partner
|
/app/src/main/java/com/aarti/prtnr/Routes.java
|
UTF-8
| 2,989
| 1.921875
| 2
|
[] |
no_license
|
package com.aarti.prtnr;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import com.google.android.material.bottomnavigation.BottomNavigationView;
public class Routes extends AppCompatActivity {
CardView train,bus,metro,taxi;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_routes);
train=findViewById(R.id.train);
bus=findViewById(R.id.bus);
metro=findViewById(R.id.metro);
taxi=findViewById(R.id.taxi);
train.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i=new Intent(Routes.this,Trains.class);
startActivity(i);
}
});
bus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i=new Intent(Routes.this,Bus.class);
startActivity(i);
}
});
metro.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i=new Intent(Routes.this,Metro.class);
startActivity(i);
}
});
taxi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i=new Intent(Routes.this,Cabs.class);
startActivity(i);
}
});
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_nav);
bottomNavigationView.setSelectedItemId(R.id.home);
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.nav_home:
startActivity(new Intent(getApplicationContext(), Home.class));
overridePendingTransition(0, 0);
return true;
case R.id.nav_routes:
return true;
case R.id.nav_wallet:
startActivity(new Intent(getApplicationContext(), Wallet.class));
overridePendingTransition(0, 0);
return true;
case R.id.nav_profile:
startActivity(new Intent(getApplicationContext(), Profile.class));
overridePendingTransition(0, 0);
return true;
}
return false;
}
});
}
}
| true
|
cadad156b2cc7773ee09326d96e19c49267c16a1
|
Java
|
rajneeshkumar146/java_workspace
|
/PepCodingInterviewBatch/src/DynamicProgramming/Q226_KnapSack.java
|
UTF-8
| 2,258
| 3.234375
| 3
|
[] |
no_license
|
package DynamicProgramming;
import java.util.Scanner;
public class Q226_KnapSack {
public static Scanner scn = new Scanner(System.in);
public static void main(String[] args) throws Exception {
solve();
}
public static void solve() throws Exception {
int[] weight = { 2, 3, 3, 1, 4, 3 };
int[] cost = { 40, 30, 20, 30, 10, 50 };
int cap = 7;
System.out.println(KnapSack0and1(weight, cost, cap));
System.out.println(KnapSack0and1_Rec(weight, cost, cap, 0));
}
private static int KnapSack0and1(int[] weight, int[] cost, int cap) {
int[][] dp = new int[weight.length + 1][cap + 1];
for (int i = 1; i < dp.length; i++) {
for (int j = 1; j < dp[0].length; j++) {
int NotComingCost = dp[i - 1][j];
int ComingCost = (j - weight[i - 1]) >= 0 ? cost[i - 1] + dp[i - 1][j - weight[i - 1]] : 0;
dp[i][j] = Math.max(NotComingCost, ComingCost);
}
}
return dp[dp.length - 1][dp.length - 1];
}
private static int KnapSack0and1_Rec(int[] weight, int[] cost, int cap, int vidx) {
if (vidx == cost.length || cap == 0) {
return 0;
}
int NotComingCost = KnapSack0and1_Rec(weight, cost, cap, vidx + 1);
int ComingCost = 0;
if (cap - weight[vidx] >= 0) {
ComingCost = KnapSack0and1_Rec(weight, cost, cap - weight[vidx], vidx + 1);
}
return Math.max(NotComingCost, ComingCost);
}
private static int UnboundedKnapSack_Rec(int[] weight, int[] cost, int cap, int vidx, int[][] strg) {
if (vidx == cost.length || cap == 0) {
return 0;
}
if (strg[vidx][cap] != 0) {
return strg[vidx][cap];
}
int notComingCost = UnboundedKnapSack_Rec(weight, cost, cap, vidx + 1, strg);
int comingCost = 0;
if (cap - weight[vidx] >= 0) {
comingCost = cost[vidx] + UnboundedKnapSack_Rec(weight, cost, cap - weight[vidx], vidx + 1, strg);
}
strg[vidx][cap] = Math.max(notComingCost, comingCost);
return strg[vidx][cap];
}
private static void UnboundedKanpSack_DP(int[] weight, int[] cost, int cap) {
int[] dp = new int[cap + 1];
dp[0] = 0;
for (int i = 1; i <= cap; i++) {
dp[i] = 0;
int max = (int) 1e9;
for (int j = 0; j < weight.length; j++) {
if ((i - weight[j]) >= 0) {
max = Math.max(dp[i - weight[j]] + cost[j], max);
}
}
dp[i] = max;
}
}
}
| true
|
47dd92dde87f091af4112314623ddb94a36b5e9b
|
Java
|
AnimalCracker/GameCentre
|
/app/src/main/java/fall2018/csc2017/slidingtiles/filewriters/FileWriter.java
|
UTF-8
| 2,463
| 2.875
| 3
|
[] |
no_license
|
package fall2018.csc2017.slidingtiles.filewriters;
import android.content.Context;
import android.util.Log;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.HashMap;
import fall2018.csc2017.slidingtiles.DataPacket;
import fall2018.csc2017.slidingtiles.GameCentre;
/**
* A singleton static class that will be used to write information into files anywhere in the
* program.
*
* @author Thomas Leung
* @since 2018-11-04
*/
public class FileWriter {
private static final String GLOBAL_USER_INFORMATION = "ALL_USERS.ser";
/**
* Constructor of the FileWriter class
*/
private FileWriter() {
}
/**
* Retries the global info from the file containing the information
* @param ctx the screen which calls this method
* @return the global information stored in the HashMap that was in the file
*/
@SuppressWarnings("unchecked")
public static HashMap<String, DataPacket> getGlobalUserInfo(Context ctx) {
HashMap<String, DataPacket> data = new HashMap<>();
try {
InputStream inputStream = ctx.openFileInput(GLOBAL_USER_INFORMATION);
ObjectInputStream input = new ObjectInputStream(inputStream);
data = (HashMap<String, DataPacket>) input.readObject();
inputStream.close();
} catch (FileNotFoundException e) {
Log.e("File read", "File not found: " + e.toString());
} catch (IOException e) {
Log.e("File read", "Can not read file: " + e.toString());
} catch (ClassNotFoundException e) {
Log.e("File read", "File contained unexpected data type: " + e.toString());
}
return data;
}
/**
* Rewrites the new information into the global data file
* @param ctx the screen which calls this method
*/
public static void writeIntoGlobalInfo(Context ctx) {
try {
FileOutputStream output;
output = ctx.openFileOutput(GLOBAL_USER_INFORMATION, Context.MODE_PRIVATE);
ObjectOutputStream outputStream = new ObjectOutputStream(output);
outputStream.writeObject(GameCentre.allUserData);
outputStream.close();
} catch (IOException e) {
Log.e("Exception", "File write failed: " + e.toString());
}
}
}
| true
|
e3a2660565ca2e0fff2c64ce00fdaba1d4841860
|
Java
|
GC-HandleIT/HandleIt
|
/src/main/java/com/dao/NonProfitDAO.java
|
UTF-8
| 6,490
| 2.5
| 2
|
[] |
no_license
|
package com.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import com.HandleIT.*;
public class NonProfitDAO {
public static boolean passOrFail = false;
public static ArrayList<NonProfit> soughtNps = new ArrayList<>();
public static NonProfit whoIsLogingIn = new NonProfit();
static final String JBDC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://aamcrp1u0ce3lq.cowwq3mhevc0.us-east-1.rds.amazonaws.com:3306";
static final String USER = "handleit";
static final String PASSWORD = "handl31t";
public static Connection conn = null;
public static Statement stmt = null;
public static PreparedStatement prepStmt = null;
public static ResultSet resSet = null;
public static void initConnToDatabase() {
try {
Class.forName(JBDC_DRIVER);
System.out.println("Connecting to the Database");
conn = DriverManager.getConnection(DB_URL, USER, PASSWORD);
System.out.println("Connected to the Database");
System.out.println("NP Side");
} catch (ClassNotFoundException e) {
e.printStackTrace();
System.out.println(e.getMessage());
} catch (SQLException ex) {
ex.printStackTrace();
System.out.println(ex.getMessage());
}
}
public static boolean searchForANP(String projectType, String focus) {
String formatStmt = whichStmt(projectType, focus);
try {
initConnToDatabase();
stmt = conn.createStatement();
resSet = stmt.executeQuery(formatStmt);
while (resSet.next()) {
NonProfit npForDev = new NonProfit();
npForDev.setName(resSet.getString("name"));
npForDev.setPassword(resSet.getString("password"));
npForDev.setLink(resSet.getString("link"));
npForDev.setContactPerson(resSet.getString("contact_person"));
npForDev.setEmailAddress(resSet.getString("email_address"));
npForDev.setLocation(resSet.getString("location"));
npForDev.setFocus(resSet.getString("focus"));
npForDev.setProjectType(resSet.getString("project_type"));
npForDev.setProjectDescription(resSet.getString("project_description"));
soughtNps.add(npForDev);
}
return true;
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
return false;
}
public static void writeToNPTable(NonProfit newNPObj) {
try {
initConnToDatabase();
prepStmt = conn.prepareStatement(insertToTable);
prepStmt.setString(1, newNPObj.getName());
prepStmt.setString(2, newNPObj.getPassword());
prepStmt.setString(3, newNPObj.getLink());
prepStmt.setString(4, newNPObj.getContactPerson());
prepStmt.setString(5, newNPObj.getEmailAddress());
prepStmt.setString(6, newNPObj.getLocation());
prepStmt.setString(7, newNPObj.getFocus());
prepStmt.setString(8, newNPObj.getProjectType());
prepStmt.setString(9, newNPObj.getProjectDescription());
prepStmt.executeUpdate();
passOrFail = true;
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
}
public static boolean npLoginSearch(NonProfit loginNP) {
String email = loginNP.getEmailAddress();
String password = loginNP.getPassword();
try {
initConnToDatabase();
stmt = conn.createStatement();
resSet = stmt.executeQuery("SELECT * FROM `ebdb`.`nonprofittable` where `email_address` like '" + email
+ "' and `password` like '" + password + "';");
while (resSet.next()) {
NonProfit npForLogin = new NonProfit();
npForLogin.setName(resSet.getString("name"));
npForLogin.setPassword(resSet.getString("password"));
npForLogin.setLink(resSet.getString("link"));
npForLogin.setContactPerson(resSet.getString("contact_person"));
npForLogin.setEmailAddress(resSet.getString("email_address"));
npForLogin.setLocation(resSet.getString("location"));
npForLogin.setFocus(resSet.getString("focus"));
npForLogin.setProjectType(resSet.getString("project_type"));
npForLogin.setProjectDescription(resSet.getString("project_description"));
whoIsLogingIn = npForLogin;
return true;
}
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
return false;
}
public static void updateNpTable(NonProfit newNPObj, String email, String pass) {
String updateStmt = updateTheTable(newNPObj, email, pass);
try {
initConnToDatabase();
prepStmt = conn.prepareStatement(updateStmt);
System.out.println(prepStmt);
prepStmt.executeUpdate();
passOrFail = true;
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
}
private static String insertToTable = "INSERT INTO `ebdb`.`nonprofittable` "
+ "(`name`, `password`, `link`, `contact_person`, `email_address`, `location`, `focus`, `project_type`, `project_description`)"
+ " VALUES " + "(?,?,?,?,?,?,?,?,?)";
private static String whichStmt(String projectType, String focus) {
if (projectType.equalsIgnoreCase("*") && focus.equalsIgnoreCase("*")) {
return "SELECT * FROM ebdb.nonprofittable;";
} else if (projectType.equalsIgnoreCase("*")) {
return "SELECT * FROM ebdb.nonprofittable WHERE `focus` LIKE '%" + focus + "%';";
} else if (focus.equalsIgnoreCase("*")) {
return "SELECT * FROM ebdb.nonprofittable WHERE `project_type` LIKE '%" + projectType + "%';";
}
return "SELECT * FROM ebdb.nonprofittable WHERE `focus` LIKE '%" + focus + "%' AND `project_type` LIKE '%"
+ projectType + "%';";
}
private static String updateTheTable(NonProfit newNPObj, String emailAddy, String password) {
String toUpdateTable = "UPDATE `ebdb`.`nonprofittable` SET " + "`name` = '" + newNPObj.getName() + "', "
+ "`password` = '" + newNPObj.getPassword() + "', " + "`link` = '" + newNPObj.getLink() + "', "
+ "`contact_person` = '" + newNPObj.getContactPerson() + "', " + "`email_address` = '"
+ newNPObj.getEmailAddress() + "', " + "`location` = '" + newNPObj.getLocation() + "', " + "`focus` = '"
+ newNPObj.getFocus() + "', " + "`project_type` = '" + newNPObj.getProjectType() + "', "
+ "`project_description` = '" + newNPObj.getProjectDescription() + "'" + " WHERE "
+ "`email_address` LIKE '" + emailAddy + "'" + " AND " + "`password` LIKE '" + password + "';";
System.out.println("\nMade it to the update table string");
System.out.println(toUpdateTable);
return toUpdateTable;
}
}
| true
|
ced77e0e092376d0a4868abd0812f0a1be0ad58b
|
Java
|
woutervmertens/Blockr-2.0
|
/Code2/model/src/main/java/com/swop/blocks/FunctionDefinitionBlockModel.java
|
UTF-8
| 2,736
| 3.125
| 3
|
[] |
no_license
|
package com.swop.blocks;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/**
* A block that defines a function.
*/
public class FunctionDefinitionBlockModel extends BlockModelWithBody{
//List<FunctionCallBlockModel> calls = new ArrayList<>();
/**
* Creates a block that defines a function with the given position, width and height.
*
* @param data standard data container for the Block
*/
public FunctionDefinitionBlockModel(StdBlockData data) {
super(data);
this.color = Color.white;
this.highlightColor = Color.white;
setIsFirstFlag(false);
blockModelType = BlockModelType.FUNCDEF;
}
public void setText(String txt){
this.text = txt;
}
/**
* Clones the object.
* @return A copy of this FunctionDefinitionBlockModel object.
*/
@Override
public BlockModel clone() {
FunctionDefinitionBlockModel cf = new FunctionDefinitionBlockModel(new StdBlockData(new Point(getPosition().x,getPosition().y),getWidth(),height,getText()));
cf.setHighlightState(isHighlight);
cf.setNextBlock(getNext());
cf.setFirstBodyBlockModel(getFirstBodyBlockModel());
cf.setGapSize(getGapSize());
cf.setIsFirstFlag(isFirst());
return cf;
}
/**
* Creates and return the polygon for the View to display.
* @return a Polygon object
*/
@Override
public Polygon getPolygon() {
Polygon pol = new Polygon();
pol.addPoint(position.x, position.y);
pol.addPoint(position.x + width, position.y);
pol.addPoint(position.x + width, position.y + height);
//plug body
pol.addPoint(position.x + pillarWidth + step * 4, position.y + height);
pol.addPoint(position.x + pillarWidth + step * 3, position.y + height + step);
pol.addPoint(position.x + pillarWidth + step * 2, position.y + height);
//gap
pol.addPoint(position.x + pillarWidth, position.y + height);
pol.addPoint(position.x + pillarWidth, position.y + height + getGapSize());
//socket body
pol.addPoint(position.x + pillarWidth + step * 4, position.y + height + getGapSize());
pol.addPoint(position.x + pillarWidth + step * 3, position.y + height + step + getGapSize());
pol.addPoint(position.x + pillarWidth + step * 2, position.y + height + getGapSize());
//gap bottom
pol.addPoint(position.x + width, position.y + getGapSize() + height);
pol.addPoint(position.x + width, position.y + height + pillarWidth + getGapSize());
pol.addPoint(position.x, position.y + height + pillarWidth + getGapSize());
return pol;
}
}
| true
|
46166ca82d85d90eac835ce060ae617f6da39013
|
Java
|
EruditePanda/almond3
|
/util/src/main/java/se/trixon/almond/util/StringHelper.java
|
UTF-8
| 6,545
| 2.78125
| 3
|
[
"Apache-2.0"
] |
permissive
|
/*
* Copyright 2019 Patrik Karlström.
*
* 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 se.trixon.almond.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.TreeSet;
import org.apache.commons.lang3.StringUtils;
/**
*
* @author Patrik Karlström
*/
public class StringHelper {
public static String arrayToIntervalString(int[] indices) {
if (indices == null || indices.length == 0) {
return "";
}
for (int index : indices) {
if (index < 0) {
return "";
}
}
Arrays.sort(indices);
StringBuilder builder = new StringBuilder();
LinkedList<BlockItem> blockItems = new LinkedList<>();
int prev = -1;
int next;
int lastStart = 0;
int length = 0;
log(StringUtils.repeat("FOR ", 10));
log(StringUtils.repeat(indices.length + " ", 40));
for (int i = 0; i < indices.length; i++) {
log(StringUtils.repeat("I ", 30));
log(StringUtils.repeat(i + " ", 30));
int current = indices[i];
if (i == 0) {
lastStart = current;
prev = current - 1;
} else if (length == 0) {
lastStart = current;
}
length++;
try {
next = indices[i + 1];
} catch (IndexOutOfBoundsException e) {
next = -1;
}
boolean endOfBlock = current > prev + 1 || i == indices.length - 1;
if (next > -1 && !endOfBlock) {
endOfBlock = current + 1 < next;
}
log("count=" + indices.length);
log("i=" + i);
log("prev=" + prev);
log("current=" + current);
log("next=" + next);
log("length=" + length);
log("lastStart=" + lastStart);
log("endOfBlock=" + endOfBlock);
if (endOfBlock) {
BlockItem blockItem = new BlockItem();
blockItem.length = length;
blockItem.start = lastStart;
blockItems.add(blockItem);
length = 0;
}
prev = next - 1;
}
for (BlockItem blockItem : blockItems) {
log(blockItem.toString());
builder.append(blockItem.start);
if (blockItem.length == 2) {
builder.append(",").append(blockItem.start + 1);
} else if (blockItem.length > 2) {
builder.append("-").append(blockItem.start + blockItem.length - 1);
}
builder.append(",");
}
char lastChar = builder.charAt(builder.length() - 1);
if (lastChar == ',') {
builder.deleteCharAt(builder.length() - 1);
}
log(builder.toString());
return builder.toString();
}
public static String booleanToYesNo(boolean value) {
return value ? Dict.YES.toString() : Dict.NO.toString();
}
/**
*
* @param string
* @return 1,2,3,7,8,9 from "1-3,7-9"
*/
public static TreeSet<Integer> convertStringToIntSet(String string) {
TreeSet<Integer> treeSet = new TreeSet<Integer>();
String[] args = string.split(",");
for (String arg : args) {
try {
int value = Integer.valueOf(arg.trim());
treeSet.add(value);
} catch (java.lang.NumberFormatException e) {
String[] interval = arg.split("-");
int start = Math.min(Integer.valueOf(interval[0].trim()), Integer.valueOf(interval[1].trim()));
int stop = Math.max(Integer.valueOf(interval[0].trim()), Integer.valueOf(interval[1].trim()));
for (int j = start; j <= stop; j++) {
treeSet.add(j);
}
}
}
return treeSet;
}
public static String createRegexFromGlob(String glob) {
//https://stackoverflow.com/questions/1247772/is-there-an-equivalent-of-java-util-regex-for-glob-type-patterns
String out = "^";
for (int i = 0; i < glob.length(); ++i) {
final char c = glob.charAt(i);
switch (c) {
case '*':
out += ".*";
break;
case '?':
out += '.';
break;
case '.':
out += "\\.";
break;
case '\\':
out += "\\\\";
break;
default:
out += c;
}
}
out += '$';
return out;
}
public static String[] intervalStringToArray(String intervalString) {
ArrayList<String> arrayList = new ArrayList<>();
String[] intervalItems = StringUtils.split(intervalString, ",");
for (String intervalItem : intervalItems) {
intervalItem = intervalItem.trim();
if (intervalItem.contains("-")) {
String startStop[] = StringUtils.split(intervalItem, "-");
int start = Integer.valueOf(startStop[0]);
int stop = Integer.valueOf(startStop[1]);
for (int i = start; i < stop + 1; i++) {
arrayList.add(String.valueOf(i));
}
} else {
arrayList.add(intervalItem);
}
}
return Arrays.copyOf(arrayList.toArray(), arrayList.toArray().length, String[].class);
}
private static void log(String string) {
// System.out.println(string);
// Xlog.v(StringHelper.class, string);
}
private static class BlockItem {
private int length;
private int start;
@Override
public String toString() {
return "BlockItem{" + "start=" + start + ", length=" + length + '}';
}
}
}
| true
|
cd883d4302dda3b6d5acf78aab849de1e1efdf77
|
Java
|
fahimamaan/JAVA-EXAMPLE
|
/src/main/java/com/spring/Repo/CourseRepo.java
|
UTF-8
| 883
| 2.40625
| 2
|
[] |
no_license
|
package com.spring.Repo;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.spring.Entity.Course;
@Transactional
@Repository
public class CourseRepo {
@Autowired
EntityManager entityManager;
public void save(Course course) {
entityManager.persist(course);
}
public Course findByid(Long id) {
return entityManager.find(Course.class, id);
}
public List<Course> findAll(){
Query b=entityManager.createQuery("Select c from Course c");
System.out.println(b.getMaxResults()+"ma fhfk;");
@SuppressWarnings("unchecked")
List<Course> l= b.getResultList();
return l;
}
}
| true
|
c85e99f233c2f76d77a0e1f9c5da4a9f920e1f24
|
Java
|
caddyz/bookstorebackground
|
/bookstore/src/com/bs/admin/service/JobService.java
|
UTF-8
| 2,296
| 2.15625
| 2
|
[] |
no_license
|
package com.bs.admin.service;
import java.util.List;
import org.springframework.stereotype.Service;
import com.bs.admin.pojo.Job;
import com.bs.admin.pojo.PageData;
@Service
public interface JobService {
/**
*
* <p>Title: findJobByJobId</p>
* <p>Description: </p>
通过id查询职位信息
* @param jobId
* @return
* <p> @date 2018年12月11日 </p>
*/
Job findJobByJobId(Long jobId);
/**
*
* <p>Title: removeJob</p>
* <p>Description: </p>
删除职位信息
* @param jobId
* @return
* <p> @date 2018年12月11日 </p>
*/
Integer removeJob(Long jobId);
/**
*
* <p>Title: changeJob</p>
* <p>Description: </p>
修改职位信息
* @param job
* @return
* <p> @date 2018年12月11日 </p>
*/
Integer changeJob(Job job);
/**
*
* <p>Title: findJobNameByJobId</p>
* <p>Description: </p>
通过职位id查询职位名称
* @param jobId
* @return
* <p> @date 2018年12月11日 </p>
*/
String findJobNameByJobId(Long jobId);
/**
*
* <p>Title: findAllJobName</p>
* <p>Description: </p>
查询所有职位名称
* @return
* <p> @date 2018年12月11日 </p>
*/
List<String> findAllJobName();
/**
*
* <p>Title: findJobByJobName</p>
* <p>Description: </p>
通过职位名称查询职位信息
* @param jobName
* @return
* <p> @date 2018年12月11日 </p>
*/
Job findJobByJobName(String jobName);
/**
*
* <p>Title: getPageData</p>
* <p>Description: </p>
获取分页信息
* @param name 查询字段
* @param value 查询关键字
* @param pay1 底薪1
* @param pay2 底薪2
* @param pageNum 当前页数
* @param pageSize 页面容量
* @return
* <p> @date 2018年12月11日 </p>
*/
PageData<Job> getPageData(String name, String value, Integer pay1, Integer pay2, Integer pageNum, Integer pageSize);
/**
*
* <p>Title: addJob</p>
* <p>Description: </p>
添加职位信息
* @param jobName 职位名称
* @param jobLevel 职位级别
* @param jobAllowance 职位津贴
* @param jobBasicPay 职位底薪
* @return
* <p> @date 2018年12月11日 </p>
*/
Integer addJob(String jobName, Integer jobLevel, Integer jobAllowance, Integer jobBasicPay);
}
| true
|
ee03ef189384f7240a4f6874c0ceabafac5ff210
|
Java
|
cleomart/Ole
|
/app/src/main/java/com/corey/ole/LandlordTenantProfileActivity.java
|
UTF-8
| 4,297
| 1.96875
| 2
|
[] |
no_license
|
package com.corey.ole;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.google.firebase.auth.FirebaseAuth;
public class LandlordTenantProfileActivity extends TenantProfileActivity
implements NavigationView.OnNavigationItemSelectedListener {
private String label;
private String tenantID;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_landlord_tenant_profile);
Intent tenantIntent = getIntent();
Bundle intentExtras = tenantIntent.getExtras();
tenantID = intentExtras.getString(TenantProfile.EXTRA_TENANT_ID);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
navigationView.setNavigationItemSelectedListener(this);
setDrawerData(navigationView);
findViewById(R.id.rent_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setRent();
}
});
if(!TextUtils.isEmpty(tenantID)) {
getTenantFromID(tenantID);
} else {
// Raise dialog exception
tenant = null;
}
}
private void setRent() {
Intent intent = new Intent(this, SetRentActivity.class);
intent.putExtra("tenantID", tenantID);
startActivity(intent);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.edit) {
// do something
Intent intent = new Intent(this, LandlordEditTenantProfileActivity.class);
intent.putExtra(TenantProfile.EXTRA_TENANT_ID, tenant.getId());
startActivity(intent);
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.edit, menu);
return true;
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_home) {
Intent intent = new Intent(this, LandlordHomeActivity.class);
intent.putExtra("landlordId", FirebaseAuth.getInstance().getCurrentUser().getUid());
startActivity(intent);
} else if (id == R.id.nav_messages) {
Intent intent = new Intent(this, LandlordMessagesActivity.class);
startActivity(intent);
} else if (id == R.id.nav_profile) {
Intent intent = new Intent(this, LandlordProfileActivity.class);
startActivity(intent);
return true;
} else if (id == R.id.nav_logout) {
FirebaseAuth.getInstance().signOut();
Intent intent = new Intent(this, LoginActivity.class);
startActivity(intent);
}
DrawerLayout drawer = findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
@Override
public void onBackPressed() {
DrawerLayout drawer = findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
}
| true
|
1263693f608560467b58b632fde92e5eea593f8b
|
Java
|
RubensKj/mongo-sharded-cluster
|
/mongo-sharded-app/core/src/main/java/com/rubenskj/mongo/core/dto/PlayerDTO.java
|
UTF-8
| 2,116
| 2.65625
| 3
|
[
"MIT"
] |
permissive
|
package com.rubenskj.mongo.core.dto;
import com.rubenskj.mongo.core.model.Player;
import java.util.List;
public class PlayerDTO {
private String id;
private String name;
private int age;
private String position;
private List<String> favoriteCharacters;
public PlayerDTO() {
}
public PlayerDTO(String id, String name, int age, String position, List<String> favoriteCharacters) {
this.id = id;
this.name = name;
this.age = age;
this.position = position;
this.favoriteCharacters = favoriteCharacters;
}
public PlayerDTO(String name, int age, String position, List<String> favoriteCharacters) {
this.name = name;
this.age = age;
this.position = position;
this.favoriteCharacters = favoriteCharacters;
}
public static PlayerDTO of(Player player) {
return new PlayerDTO(
player.getId(),
player.getName(),
player.getAge(),
player.getPosition(),
player.getFavoriteCharacters()
);
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
public List<String> getFavoriteCharacters() {
return favoriteCharacters;
}
public void setFavoriteCharacters(List<String> favoriteCharacters) {
this.favoriteCharacters = favoriteCharacters;
}
@Override
public String toString() {
return "PlayerDTO{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", age=" + age +
", position='" + position + '\'' +
", favoriteCharacters=" + favoriteCharacters +
'}';
}
}
| true
|
cd419be007dd0d2b8754aa499d0199796edb9579
|
Java
|
AdvancedServicesEngineeringTUWien2016/swtm
|
/analytics/webapp/src/main/java/at/ac/tuwien/swtm/analytics/webapp/service/WastebinDataService.java
|
UTF-8
| 2,238
| 2.3125
| 2
|
[] |
no_license
|
package at.ac.tuwien.swtm.analytics.webapp.service;
import at.ac.tuwien.swtm.analytics.model.Wastebin;
import at.ac.tuwien.swtm.analytics.model.WastebinMoment;
import at.ac.tuwien.swtm.analytics.model.WastebinMomentState;
import at.ac.tuwien.swtm.analytics.model.WastebinStateId;
import com.blazebit.persistence.CriteriaBuilderFactory;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import java.util.List;
/**
* Created
* by Moritz Becker (moritz.becker@gmx.at)
* on 29.05.2016.
*/
@Stateless
public class WastebinDataService {
@Inject
private EntityManager em;
@Inject
private CriteriaBuilderFactory cbf;
public WastebinMoment persistWastebinMoment(WastebinMoment wastebinMoment) {
Long existingMoments = cbf.create(em, Long.class)
.from(WastebinMoment.class, "moment")
.select("COUNT(*)")
.where("moment.wastebin.id").eq(wastebinMoment.getWastebin().getId())
.where("moment.timestamp").ge(wastebinMoment.getTimestamp())
.getSingleResult();
// only save if this moment is new
if (existingMoments == 0) {
if (wastebinMoment.getWastebin().getId() == null) {
wastebinMoment.setWastebin(getOrCreateWastebin(wastebinMoment.getWastebin().getName()));
}
em.persist(wastebinMoment);
return wastebinMoment;
} else {
return null;
}
}
public Wastebin getOrCreateWastebin(String name) {
List<Wastebin> wastebins = cbf.create(em, Wastebin.class)
.where("name").eq(name)
.getResultList();
Wastebin wastebin;
if (wastebins.isEmpty()) {
wastebin = new Wastebin();
wastebin.setName(name);
em.persist(wastebin);
} else {
wastebin = wastebins.get(0);
}
return wastebin;
}
public void updateWastebin(Wastebin wastebin) {
em.merge(wastebin);
}
public void saveWastebinMomentState(Long wastebinMomentId, WastebinMomentState.State state) {
em.persist(new WastebinMomentState(new WastebinStateId(wastebinMomentId, state)));
}
}
| true
|
e73759917d4a21483f7ad5c529f8080590c4e4de
|
Java
|
practice-mix/springmvc-multi-servlet-path
|
/src/main/java/com/practice/springmvc/multi_servlet_path/bar/BarHelloController.java
|
UTF-8
| 1,361
| 2.515625
| 3
|
[] |
no_license
|
package com.practice.springmvc.multi_servlet_path.bar;
import com.practice.springmvc.multi_servlet_path.defaul.DefaultHelloService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.WebRequest;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@RestController
public class BarHelloController {
private final BarHelloService helloService;
private final DefaultHelloService defaultHelloService;
public BarHelloController(BarHelloService helloService, DefaultHelloService defaultHelloService) {
this.helloService = helloService;
this.defaultHelloService = defaultHelloService;
}
@RequestMapping("/hello")
public Map<String, String> hello(HttpServletRequest request, WebRequest webRequest) {
String contextPath = request.getContextPath();
String servletPath = request.getServletPath();
Map<String, String> map = new HashMap<>();
map.put("greeting", helloService.hello(this.getClass().getSimpleName()));
map.put("defaultHelloService", defaultHelloService.hello(this.getClass().getSimpleName()));
map.put("contextPath", contextPath);
map.put("servletPath", servletPath);
return map;
}
}
| true
|
cb61412cb27a97ce4ecb6cee49b4902ea336f4c6
|
Java
|
sathyakuppusamy20/OFR-TenantOnline
|
/OnlineFlatRental/src/main/java/com/ofr/tenant/service/TenantService.java
|
UTF-8
| 619
| 2.078125
| 2
|
[] |
no_license
|
package com.ofr.tenant.service;
import java.util.List;
import java.util.Optional;
import com.ofr.tenant.entities.Tenant;
import com.ofr.tenant.exception.TenantNotFoundException;
public interface TenantService {
public Tenant addTenant(Tenant tenant);
public Tenant updateTenant(Tenant tenant)throws TenantNotFoundException;
public Tenant deleteTenant(Tenant tenant)throws TenantNotFoundException;
public Optional<Tenant> viewTenant(Integer tenantId)throws TenantNotFoundException;
public List<Tenant> viewAllTenant();
public boolean validateTenant(Integer tenantId)throws TenantNotFoundException;
}
| true
|
37dd2016d25f973578f6c4feab675c2c2278306a
|
Java
|
bborisov/chat-app
|
/Back-end/FirstSpringProject/src/com/ibm/validators/EmailValidator.java
|
UTF-8
| 572
| 2.859375
| 3
|
[] |
no_license
|
package com.ibm.validators;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.ibm.validators.Validator;
public class EmailValidator implements Validator {
private static final String EMAIL_REGEX = "[A-Z0-9_]+@[A-Z0-9]+\\.[A-Z]{2,4}";
private String email;
public EmailValidator(String email) {
this.email = email;
}
@Override
public boolean isValid() {
Pattern pattern = Pattern.compile(EMAIL_REGEX);
Matcher matcher = pattern.matcher(email.toUpperCase());
if (matcher.matches()) {
return true;
}
return false;
}
}
| true
|
e8deedd614f5d55fccbe3b322702f83a7b6f71cb
|
Java
|
lvjianjian/PopularAndOutlierRouteDemo
|
/src/main/java/tool/cluster/detection/IOutlierDetection.java
|
UTF-8
| 188
| 1.796875
| 2
|
[] |
no_license
|
package tool.cluster.detection;
import model.Route;
/**
* Created by lzj on 2016/7/26.
*/
public interface IOutlierDetection {
boolean isOutlier(Route detectionRoute);
}
| true
|
4b4a94cf73964eb1809b6f56b80d3fd541c17100
|
Java
|
Coolaswa/Artificial-intelligence
|
/NeuralNetwork/DeepLearning/src/main/java/nl/tue/s2id90/dl/NN/optimizer/update/L2Decay.java
|
UTF-8
| 1,076
| 2.453125
| 2
|
[] |
no_license
|
/*
* 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 nl.tue.s2id90.dl.NN.optimizer.update;
import java.util.function.Supplier;
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.factory.Nd4j;
/**
*
* @author Administrator
*/
public class L2Decay implements UpdateFunction{
float decay;
UpdateFunction f;
INDArray update;
public L2Decay(Supplier<UpdateFunction> supplier, float decay) {
this.decay = decay;
this.f = supplier.get();
}
@Override
public void update(INDArray value, boolean isBias, float learningRate, int batchSize, INDArray gradient) {
// Only apply L2Decay to weights matrix
if (!isBias) {
// Add the penalized weights to the gradient: gradient <- gradient + decay * value(weights)
gradient.addi(value.mul(decay));
}
f.update(value, isBias, learningRate, batchSize, gradient);
}
}
| true
|
1f684e00fc0f9592a151cc9a19312c60b25785db
|
Java
|
armenak/DataDefender
|
/src/main/java/com/strider/datadefender/discoverer/IDiscoverer.java
|
UTF-8
| 2,192
| 2.046875
| 2
|
[
"Apache-2.0"
] |
permissive
|
/*
*
* Copyright 2014, Armenak Grigoryan, and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
package com.strider.datadefender.discoverer;
import com.strider.datadefender.anonymizer.DatabaseAnonymizerException;
/**
* Defines contract for all discoverers
* @author Armenak Grigoryan
*/
public interface IDiscoverer {
/**
* Discovers data or data containers with data which can be be the subject
* for data anonymization. Results found should be stored in matches member variable.
* @param dbFactory
* @param properties
* @param tables Optional list of tables to anonymize -
* if the collection is empty, all tables specified in requirements
* are anonymized.
* @throws com.strider.datadefender.AnonymizerException
* @returns List of results introduced for testing purposes.
*/
// List<MatchMetaData> discover(IDBFactory dbFactory, Properties dataDiscoveryProperties, Set<String> tables) throws DatabaseAnonymizerException;
// List<MatchMetaData> discover(Properties dataDiscoveryProperties) throws DatabaseAnonymizerException;
/**
* Creates a sample requirement file from a list of sorted matches found by the discovery method.
* The requirement file will most likely require customization (for example; anonymzation function) before you want to run the Anonymizer against it.
* @param fileName
* @throws DatabaseAnonymizerException
*/
void createRequirement(String fileName) throws DatabaseAnonymizerException;
}
//~ Formatted by Jindent --- http://www.jindent.com
| true
|
8997a864c3288016055d729f0bcf008f517cea03
|
Java
|
kschallitz/GameEngine
|
/src/toolbox/Maths.java
|
UTF-8
| 3,640
| 3.328125
| 3
|
[] |
no_license
|
package toolbox;
import entities.Camera;
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Vector2f;
import org.lwjgl.util.vector.Vector3f;
/**
* Created by Kurt on 6/26/2017.
*/
public class Maths {
/**
* Computes the height at player position, given heights of the three verticies of the triangle
* see: https://en.wikipedia.org/wiki/Barycentric_coordinate_system
*
* @param p1 vertex one position
* @param p2 vertex two position
* @param p3 vertex three position
* @param pos player x, y position within the triangle
*
* @return the float representing the player's height at the given coordinates within the triangle specificed by
* p1, p2, p3
*/
public static float barryCentric(Vector3f p1, Vector3f p2, Vector3f p3, Vector2f pos) {
float det = ((p2.z - p3.z) * (p1.x - p3.x)) + ((p3.x - p2.x) * (p1.z - p3.z));
float l1 = ((p2.z - p3.z) * (pos.x - p3.x)) + ((p3.x - p2.x) * (pos.y - p3.z)) / det;
float l2 = ((p3.z - p1.z) * (pos.x - p3.x)) + ((p1.x - p3.x) * (pos.y - p3.z)) / det;
float l3 = 1.0f - l1 - l2;
return (l1 * p1.y) + (l2 * p2.y) + (l3 * p3.y);
}
/**
* Convert a 3float translation, rotation and scale into a 4 float Matrix
*
* @param translation - The 3D Vector of the translation
* @param rx - rotation x
* @param ry - rotation y
* @param rz - rotation z
* @param scale - the scale of the object
* @return -
*/
public static Matrix4f createTransformationMatrix(Vector3f translation, float rx, float ry, float rz, float scale) {
Matrix4f matrix = new Matrix4f();
matrix.setIdentity(); // resets the matrix
Matrix4f.translate(translation, matrix, matrix);
// Rotate the matrix
Matrix4f.rotate((float) Math.toRadians(rx), new Vector3f(1, 0, 0), matrix, matrix);
Matrix4f.rotate((float) Math.toRadians(ry), new Vector3f(0, 1, 0), matrix, matrix);
Matrix4f.rotate((float) Math.toRadians(rz), new Vector3f(0, 0, 1), matrix, matrix);
// Scale uniformly in all 3 dimensions
Matrix4f.scale(new Vector3f(scale, scale, scale), matrix, matrix);
return matrix;
}
public static Matrix4f createTransformationMatrix(Vector2f translation, Vector2f scale) {
Matrix4f matrix = new Matrix4f();
matrix.setIdentity();
Matrix4f.translate(translation, matrix, matrix);
Matrix4f.scale(new Vector3f(scale.x, scale.y, 1f), matrix, matrix);
return matrix;
}
/**
* Convert Camera position into a 4 float View Matrix
* The idea is that we want to move the entire world opposite the camera to simulate the camera moving though
* the world.
* @param camera - the camera position to be translated
* @return -
*/
public static Matrix4f createViewMatrix(Camera camera) {
Matrix4f matrix = new Matrix4f();
matrix.setIdentity(); // resets the matrix
// Rotate the matrix
Matrix4f.rotate((float) Math.toRadians(camera.getPitch()), new Vector3f(1, 0, 0), matrix, matrix);
Matrix4f.rotate((float) Math.toRadians(camera.getYaw()), new Vector3f(0, 1, 0), matrix, matrix);
Matrix4f.rotate((float) Math.toRadians(camera.getRoll()), new Vector3f(0, 0, 1), matrix, matrix);
Vector3f cameraPos = camera.getPosition();
Vector3f negativeCameraPos = new Vector3f(-cameraPos.x, -cameraPos.y, -cameraPos.z);
Matrix4f.translate(negativeCameraPos, matrix, matrix);
return matrix;
}
}
| true
|
10c50d228e3be9dab5022b07e35f1e5c4049833a
|
Java
|
makemoremoney/KKRefreshLayout
|
/app/src/main/java/net/z0kai/kkrefreshlayout_demo/config/FooterViewProvider.java
|
UTF-8
| 248
| 1.6875
| 2
|
[
"MIT"
] |
permissive
|
package net.z0kai.kkrefreshlayout_demo.config;
import android.content.Context;
import net.z0kai.kkrefreshlayout.IFooterView;
/**
* Created by Z_0Kai on 16/9/29.
*/
public interface FooterViewProvider {
IFooterView get(Context context);
}
| true
|
cd4fe44e3da4e5fb50a56452a06b54e48ce9fbd7
|
Java
|
SnoWhite93/JavaCode
|
/junit_exercise/src/test/java/com/feel/baking/BreakfastBurritoRecipeTest.java
|
UTF-8
| 744
| 2.484375
| 2
|
[] |
no_license
|
package com.feel.baking;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class BreakfastBurritoRecipeTest {
private static Recipe recipe;
@BeforeAll
public static void preparePie() {
FeelCookBook cookBook = new FeelCookBook();
recipe = cookBook.getBreakfastBurritoRecipe();
}
// @Test
// void testNumberOfIngredients() {
// List<String> pieIngredients = recipe.getIngredientsList();
// assertTrue(4 == pieIngredients.size());
// }
@Test
void testRecipeName() {
String recipeName = recipe.getRecipeName();
assertEquals("Breakfast Burrito", recipeName);
}
}
| true
|
4efde9872b38d2fada0bfe77495ac48e6f688782
|
Java
|
benedekh/WeLoveClouds
|
/Replicated_Storage_Service/src/weloveclouds/commons/kvstore/deserialization/helper/KVEntryDeserializer.java
|
UTF-8
| 1,911
| 2.65625
| 3
|
[] |
no_license
|
package weloveclouds.commons.kvstore.deserialization.helper;
import static weloveclouds.commons.serialization.models.XMLTokens.KEY;
import static weloveclouds.commons.serialization.models.XMLTokens.VALUE;
import static weloveclouds.commons.serialization.utils.XMLPatternUtils.XML_NODE;
import static weloveclouds.commons.serialization.utils.XMLPatternUtils.getRegexFromToken;
import java.util.regex.Matcher;
import weloveclouds.commons.kvstore.deserialization.exceptions.DeserializationException;
import weloveclouds.commons.kvstore.models.KVEntry;
import weloveclouds.commons.serialization.IDeserializer;
import weloveclouds.commons.utils.StringUtils;
/**
* A deserializer which converts a {@link String} to a {@link KVEntry}.
*
* @author Benedek
*/
public class KVEntryDeserializer implements IDeserializer<KVEntry, String> {
@Override
public KVEntry deserialize(String from) throws DeserializationException {
KVEntry deserialized = null;
if (StringUtils.stringIsNotEmpty(from)) {
try {
String key = deserializeField(from, KEY);
String value = deserializeField(from, VALUE);
if (key == null && value == null) {
return deserialized;
}
deserialized = new KVEntry(key, value);
} catch (Exception ex) {
throw new DeserializationException(ex.getMessage());
}
}
return deserialized;
}
private String deserializeField(String from, String token) throws DeserializationException {
Matcher fieldMatcher = getRegexFromToken(token).matcher(from);
if (fieldMatcher.find()) {
String deserialized = fieldMatcher.group(XML_NODE);
if (StringUtils.stringIsNotEmpty(deserialized)) {
return deserialized;
}
}
return null;
}
}
| true
|
3d13a828f99ee9a300786d9ad3e89026d418c01f
|
Java
|
Baltiyski/SoftAcad
|
/src/lesson09/animals/Dog.java
|
UTF-8
| 158
| 2.6875
| 3
|
[
"MIT"
] |
permissive
|
package lesson09.animals;
public class Dog extends Animal {
boolean isDangerous;
void bringStick() {
System.out.println("Bringing the stick...");
}
}
| true
|
6c5b665670fc200af27de469ed8b2a39a7ecdd0c
|
Java
|
bethel-school-of-technology/retask-backend
|
/src/main/java/com/retask/game/model/Task.java
|
UTF-8
| 3,251
| 2.375
| 2
|
[] |
no_license
|
package com.retask.game.model;
import java.io.Serializable;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.Calendar;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
@Table(name = "retask_tasks")
public class Task implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private Date startdate;
private Date enddate;
private Long level;
private String name;
private String description;
private Long parent_task_id;
private Long points;
private String username;
private Timestamp dateTimeCreated;
private Timestamp dateTimeUpdated;
public Task() {
}
public Task(Task task) {
// If you add a field to Task update this list
this.id = task.id;
this.startdate = task.startdate;
this.enddate = task.enddate;
this.level = task.level;
this.name = task.name;
this.description = task.description;
this.points = task.points;
this.username = task.username;
this.parent_task_id = task.parent_task_id;
this.dateTimeCreated = task.dateTimeCreated;
this.dateTimeUpdated = task.dateTimeUpdated;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getStartdate() {
return startdate;
}
public void setStartdate(Date startdate) {
this.startdate = startdate;
}
public Date getEnddate() {
return enddate;
}
public void setEnddate(Date enddate) {
this.enddate = enddate;
}
public Long getLevel() {
return level;
}
public void setLevel(Long level) {
this.level = level;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getParent_task_id() {
return parent_task_id;
}
public void setParent_task_id(Long parent_task_id) {
this.parent_task_id = parent_task_id;
}
@JsonIgnore
public Timestamp getDateTimeCreated() {
return dateTimeCreated;
}
@JsonIgnore
public void setDateTimeCreated(Timestamp dateTimeCreated) {
this.dateTimeCreated = dateTimeCreated;
}
@JsonIgnore
public Timestamp getDateTimeUpdated() {
return dateTimeUpdated;
}
@JsonIgnore
public void setDateTimeUpdated(Timestamp dateTimeUpdated) {
this.dateTimeUpdated = dateTimeUpdated;
}
@JsonIgnore
public void setCreateDateTime() {
this.setDateTimeCreated(new java.sql.Timestamp(Calendar.getInstance().getTime().getTime()));
}
@JsonIgnore
public void setUpdateDateTime() {
this.setDateTimeUpdated(new java.sql.Timestamp(Calendar.getInstance().getTime().getTime()));
}
public Long getPoints() {
return points;
}
public void setPoints(Long points) {
this.points = points;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
| true
|
920a1ab98412204ce9a468b03f1c97db0d60e263
|
Java
|
firateski/NotificationHub
|
/src/main/java/notification/channel/email/EmailDTO.java
|
UTF-8
| 869
| 2.25
| 2
|
[] |
no_license
|
package notification.channel.email;
import model.Company;
import notification.NotificationDTO;
public class EmailDTO extends NotificationDTO {
private Company company;
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
private String emailFrom;
private String emailTo;
private String subject;
public String getEmailFrom() {
return emailFrom;
}
public void setEmailFrom(String emailFrom) {
this.emailFrom = emailFrom;
}
public String getEmailTo() {
return emailTo;
}
public void setEmailTo(String emailTo) {
this.emailTo = emailTo;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
}
| true
|
c4a34e46c4f8e9c8b09b305dd01206d99b655638
|
Java
|
Herobane/2DShooterTest
|
/src/fr/herobane/shooter/GameInput.java
|
UTF-8
| 1,977
| 3.015625
| 3
|
[] |
no_license
|
package fr.herobane.shooter;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import fr.herobane.shooter.gameobjects.Direction;
import fr.herobane.shooter.gameobjects.Player;
public class GameInput extends KeyAdapter
{
@SuppressWarnings("unused")
private Game game;
private Player player;
private ArrayList<Integer> keys = new ArrayList<Integer>();
public GameInput(Game game)
{
super();
this.game = game;
this.player = (Player) Game.handler.getPlayer();
}
@Override
public void keyTyped(KeyEvent e)
{
}
@Override
public void keyPressed(KeyEvent e)
{
int keyCode = e.getKeyCode();
switch(keyCode)
{
case 65:
player.move(Direction.WEST, 1);
player.setFacing(Direction.WEST);
break;
case 68:
player.move(Direction.EAST, 1);
player.setFacing(Direction.EAST);
break;
case 87:
player.move(Direction.NORTH, 1);
player.setFacing(Direction.NORTH);
break;
case 83:
player.move(Direction.SOUTH, 1);
player.setFacing(Direction.SOUTH);
break;
}
if(!keys.contains(e.getKeyCode()))
{
keys.add(e.getKeyCode());
}
if(keys.contains(KeyEvent.VK_SPACE))
{
player.shoot();
}
if(keys.contains(KeyEvent.VK_R))
{
if(Game.gameOver)
{
Game.gameOver = false;
Game.handler.getPlayer().setAlive(true);
player.setPositionX(20);
player.setPositionY(20);
player.setVelocityX(0);
player.setVelocityY(0);
}
}
}
@Override
public void keyReleased(KeyEvent e)
{
int keyCode = e.getKeyCode();
switch(keyCode)
{
case 65:
player.move(Direction.WEST, 0);
break;
case 68:
player.move(Direction.EAST, 0);
break;
case 87:
player.move(Direction.NORTH, 0);
break;
case 83:
player.move(Direction.SOUTH, 0);
break;
}
if(keys.contains(e.getKeyCode()))
{
keys.remove(keys.indexOf(e.getKeyCode()));
}
}
}
| true
|
27a5f8738ffa33c66e042d6a47d144b20ba21fe5
|
Java
|
vishakha1993/Java_Session2Assignment2
|
/Prime_print.java
|
UTF-8
| 343
| 3.234375
| 3
|
[] |
no_license
|
import java.util.Scanner;
public class Prime_print
{
public static void main(String arg[])
{
int i,j;
System.out.println("Prime numbers between 1 and 100 \n");
for(i=1;i<=100;i++)
{
for(j=2;j<=i;j++)
{
if(i%j==0)
break;
}
if(j==i)
{
System.out.print(i+" ");
}
}
}
}
| true
|
ad3919535c5be6f8ea72f478df9565eae016a503
|
Java
|
MX-B/billing
|
/src/main/java/io/gr1d/billing/model/transfer/TransferLetter.java
|
UTF-8
| 2,285
| 2.21875
| 2
|
[] |
no_license
|
package io.gr1d.billing.model.transfer;
import io.gr1d.billing.model.enumerations.PayableStatus;
import io.gr1d.core.datasource.audit.AuditListener;
import io.gr1d.core.datasource.model.BaseModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.LinkedList;
import java.util.List;
@Entity
@Getter @Setter
@NoArgsConstructor
@Table(name = "transfer_letter")
@EntityListeners(AuditListener.class)
public class TransferLetter extends BaseModel {
@NotNull
@ManyToOne
@JoinColumn(name = "status_id", nullable = false)
private PayableStatus status;
@Column(name = "start_dt")
private LocalDate startDate;
@Column(name = "finish_dt")
private LocalDate finishDate;
@Column(name = "total_value")
private BigDecimal totalValue;
@Column(name = "transfered_value")
private BigDecimal transferedValue;
@Column(name = "provider_count")
private Integer providerCount;
@Column(name = "provider_transfered")
private Integer providerTransfered;
@Transient
private List<TransferLetterProvider> providers = new LinkedList<>();
public TransferLetter(final LocalDate startDate, final LocalDate finishDate) {
this.startDate = startDate;
this.finishDate = finishDate;
this.totalValue = BigDecimal.ZERO;
this.transferedValue = BigDecimal.ZERO;
this.providerTransfered = 0;
this.status = PayableStatus.CREATED;
}
void addProvider(final TransferLetterProvider transferLetterProvider) {
providers.add(transferLetterProvider);
}
public Integer countProvidersByStatus(final PayableStatus status) {
return (int) providers.stream()
.filter(provider -> provider.getStatus().equals(status))
.count();
}
@Override
protected String uuidBase() {
return "TL";
}
public void incrementTransferedValue(final BigDecimal value) {
this.transferedValue = this.transferedValue.add(value);
}
public void incrementProviderTransfered() {
this.providerTransfered = this.providerTransfered + 1;
}
}
| true
|
243bfd2da0a501f92cf0910bd353026ab6ade0e4
|
Java
|
ACtangle/youyi
|
/src/main/java/com/how2java/youyi/service/ProductService.java
|
UTF-8
| 677
| 1.734375
| 2
|
[] |
no_license
|
package com.how2java.youyi.service;
import com.how2java.youyi.pojo.Category;
import com.how2java.youyi.pojo.Product;
import java.util.List;
/**
* Created by melon on 18-1-8.
*/
public interface ProductService {
List<Product> list(int cid);
void add(Product product);
void delete(int pid);
Product get(int pid);
void update(Product product);
void setFirstProductImage(Product product);
void fill(List<Category> categoryies);
void fill(Category category);
void fillByRow(List<Category> categories);
void setSaleAndReviewNumber(Product p);
void setSaleAndReviewNumber(List<Product> ps);
List<Product> search(String keyword);
}
| true
|