blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
โ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5bf25a792633a497d10b7c86d6a84cf05cbba849
|
67f0de47f811e846627f459f9e695f7f0189c0cb
|
/clickapuntos/src/mx/com/clickapuntos/controller/PerfilController.java
|
7c402cf3f92684f40bf0f3287fd69386b6ed0ead
|
[] |
no_license
|
d3non/clickapuntos
|
c2c281420ef05e2ed556ac5e29aa69cd6ac41de0
|
7db3da1c1f3cc87abb03ebebbd0b6958c7e17607
|
refs/heads/master
| 2021-05-07T14:32:26.392004 | 2017-11-07T20:02:37 | 2017-11-07T20:02:37 | 109,874,697 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,583 |
java
|
package mx.com.clickapuntos.controller;
import java.sql.Date;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import javax.servlet.http.HttpSession;
import mx.com.clickapuntos.bean.UserBean;
import mx.com.clickapuntos.persistence.PuntosUsuarios;
import mx.com.clickapuntos.persistence.Usuarios;
import mx.com.clickapuntos.persistence.Usuariosdirecciones;
import mx.com.clickapuntos.service.IMediaService;
import mx.com.clickapuntos.service.IUsuariosService;
import mx.com.clickapuntos.validator.UserPerfilValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;
import mx.com.clickapuntos.persistence.Usuariosdatos;
@Controller
@RequestMapping("/perfilUser.htm")
@SessionAttributes("userBean")
public class PerfilController {
private IUsuariosService usuariosService;
private UserPerfilValidator userPerfilValidator;
public IMediaService mediaService;
@Inject
public void setHomeService(IMediaService mediaService) {
this.mediaService = mediaService;
}
@Autowired
public void UserLogginController(IUsuariosService usuariosService, UserPerfilValidator userPerfilValidator) {
this.usuariosService = usuariosService;
this.userPerfilValidator = userPerfilValidator;
}
@RequestMapping(method = RequestMethod.GET)
public String showPerfilUser(ModelMap model,HttpServletRequest req){
HttpSession sesion = req.getSession(true);
Usuarios user = (Usuarios) sesion.getAttribute("user");
UserBean userBean = new UserBean();
userBean.setCompanias(usuariosService.getCompaniasAll());
if(user != null){
user = usuariosService.getUsuariosByIdUser(user.getIdusuarios());
if(user.getUsrusername()!=null){
userBean.setNickname(user.getUsrusername());
userBean.setNombre(user.getUsrusername());
}
if(user.getIdcompaniacelular()!=null){
userBean.setCompania(String.valueOf(user.getIdcompaniacelular()));
}
if(user.getTipoplan()!=null){
userBean.setTipoplan(String.valueOf(user.getTipoplan()));
}
if(user.getUsremail()!=null){
if(!user.getUsremail().equals("")) userBean.setCorreo(user.getUsremail());
}
if(user.getUsrsexo()!=null){
if(!user.getUsrsexo().equals("")) userBean.setSexo(user.getUsrsexo());
}
userBean.setBloqueoCelular("No blockeo");
if(user.getUsrcelular()!=null){
if(!user.getUsrcelular().equals("")) userBean.setCelular(user.getUsrcelular());
userBean.setBloqueoCelular("blockeo");
}
userBean.setIdUser(String.valueOf(user.getIdusuarios()));
Usuariosdatos usuariosDatos=usuariosService.getUsuariosDatosByIdUser(Integer.parseInt(userBean.getIdUser()));
if(usuariosDatos!=null){
String fecha=null;
if(usuariosDatos.getUsrnombres()!=null) userBean.setNombre(usuariosDatos.getUsrnombres());
if(usuariosDatos.getUsramaterno()!=null)userBean.setApellidoMaterno(usuariosDatos.getUsramaterno());
if(usuariosDatos.getUsrapaterno()!=null)userBean.setApellidoPaterno(usuariosDatos.getUsrapaterno());
if(usuariosDatos.getFechaNacimiento()!=null){
fecha=String.valueOf(usuariosDatos.getFechaNacimiento());
String[] fechas=fecha.split("-");
if(fechas.length==3){
userBean.setAnio(fechas[0]);
userBean.setMes(fechas[1]);
userBean.setDia(fechas[2]);
}
}
}
Usuariosdirecciones usuariosDirecciones=usuariosService.getUsuariosDireccionesByIdUser(Integer.parseInt(userBean.getIdUser()));
if(usuariosDirecciones!=null){
if(usuariosDirecciones.getUdcalle()!=null) userBean.setCalle(usuariosDirecciones.getUdcalle());
if(usuariosDirecciones.getUdcodigopostal()!=null) userBean.setCp(usuariosDirecciones.getUdcodigopostal());
}
}
sesion.setAttribute("user", user);
model.addAttribute("userBean",userBean);
long numTotal=0;
if(user!=null){
PuntosUsuarios pus=mediaService.getPuntosUsuarioById(user.getIdusuarios());
if(pus!=null){
numTotal=pus.getPuntosDisponibles();
}
}
model.put("numTotal", numTotal);
Integer banPromo=(Integer)sesion.getAttribute("banPromo");
if(banPromo!=null){
if(banPromo>0){
banPromo=null;
sesion.setAttribute("banPromo",banPromo);
}
}
return "perfilUser";
}
@RequestMapping(method = RequestMethod.POST)
public String onSubmit(@ModelAttribute("userBean") UserBean ub,
BindingResult result,HttpServletRequest req,ModelMap model) {
if(ub.getIdUser()!=null){
System.out.println("Tracing 1");
if(!ub.getIdUser().equals("")){
System.out.println("Tracing 2");
userPerfilValidator.validate(ub, result);
Usuarios user=usuariosService.getUsuariosByIdUser(Long.valueOf(ub.getIdUser()));
long numTotal=0;
if(user!=null){
PuntosUsuarios pus=mediaService.getPuntosUsuarioById(user.getIdusuarios());
if(pus!=null){
numTotal=pus.getPuntosDisponibles();
}
}
model.put("numTotal", numTotal);
System.out.println(" Errores : " + result);
if(!result.hasErrors()){
System.out.println("Tracing 3");
user.setUsrcelular(ub.getCelular());
user.setIdcompaniacelular(Integer.parseInt(ub.getCompania()));
user.setTipoplan(Integer.parseInt(ub.getTipoplan()));
user.setUsremail(ub.getCorreo());
user.setUsrusername(ub.getNickname());
Usuariosdatos userDatos=usuariosService.getUsuariosDatosByIdUser(Integer.parseInt(ub.getIdUser()));
if(userDatos==null){
userDatos=new Usuariosdatos();
}
Date fechaNac=Date.valueOf(ub.getAnio()+"-"+ub.getMes()+"-"+ub.getDia());
userDatos.setFechaNacimiento(fechaNac);
userDatos.setIdusuarios(Integer.parseInt(ub.getIdUser()));
userDatos.setUsramaterno(ub.getApellidoMaterno().toUpperCase());
userDatos.setUsrapaterno(ub.getApellidoPaterno().toUpperCase());
userDatos.setUsrnombres(ub.getNombre().toUpperCase());
usuariosService.SaveOrUpdate(userDatos);
user.setUsuariosdatos(userDatos);
Usuariosdirecciones userDirecciones=usuariosService.getUsuariosDireccionesByIdUser(Integer.parseInt(ub.getIdUser()));
if(userDirecciones==null){
userDirecciones=new Usuariosdirecciones();
}
userDirecciones.setIdusuariosdirecciones(Integer.parseInt(ub.getIdUser()));
userDirecciones.setUdcalle(ub.getCalle());
userDirecciones.setUdnumerocel(ub.getCelular());
userDirecciones.setUdcodigopostal(ub.getCp());
usuariosService.SaveOrUpdateDirecciones(userDirecciones);
user.setUsuariosdirecciones(userDirecciones);
user.setUsrsexo(ub.getSexo());
usuariosService.actualizaUsuario(user);
HttpSession sesion=req.getSession(true);
Usuarios us=(Usuarios)sesion.getAttribute("user");
if(us!=null){
us=usuariosService.getUsuariosByIdUser(user.getIdusuarios());
if(us.getUsrstatus()!=null){
if(us.getUsrstatus().equals("1")){
usuariosService.createMensaje(new Long("0"),us);
}
}
sesion.setAttribute("user", us);
}
System.out.println("Exito en actualizacion User");
}
}
}
return "perfilUser";
}
}
|
[
"d3non@D3non"
] |
d3non@D3non
|
750ab3c211f6338d6fe18c6e38369203283f82b5
|
e8b12eaf45109db7156869f135cf4af9cd2f7d65
|
/src/oop/Shingle.java
|
a082f377c472320bf885bb1f07ada98d034ca9d0
|
[] |
no_license
|
Ltrmex/DocumentSimilarity
|
21c139d0031d7689b587cbfece79a7ce1109de08
|
71a4aab3dc6f5d3daa48fbeb99860f34fcd653d9
|
refs/heads/master
| 2021-09-03T20:41:54.247286 | 2018-01-11T21:43:59 | 2018-01-11T21:43:59 | 117,156,975 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 538 |
java
|
package oop;
public class Shingle {
//Variables
private int docId;
private int hashCode;
//Constructors
public Shingle() {}
public Shingle(int docId, int hashCode) {
super();
this.docId = docId;
this.hashCode = hashCode;
}
//Get and set for docId
public int getDocId() {
return docId;
}
public void setDocId(int docId) {
this.docId = docId;
}
//Get and set for hashCode
public int getHashCode() {
return hashCode;
}
public void setHashCode(int hashCode) {
this.hashCode = hashCode;
}
}//Shingle
|
[
"[email protected]"
] | |
894da1ccb83b04d50bd0fe2ecc08e4fb583310c5
|
03893b4dc2b0d76a39cc7eb59d1d862edd6cfe33
|
/src/main/java/com/ftm/giflib/controller/GifController.java
|
de549d8d6ca53f3db2ae884672e13f497dda97a6
|
[] |
no_license
|
tejada7/giflib
|
f33cfdc38bbe93138d9a245bb1351756fd957792
|
685e4e87254471bc2b182cd277995b1a067bf9a5
|
refs/heads/master
| 2021-07-08T05:47:12.766156 | 2017-10-04T18:08:26 | 2017-10-04T18:09:00 | 105,759,454 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,299 |
java
|
package com.ftm.giflib.controller;
import com.ftm.giflib.data.GifRepository;
import com.ftm.giflib.model.Gif;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.time.LocalDate;
import java.util.List;
@Controller
public class GifController {
@Autowired
private GifRepository gifRepository;
@RequestMapping("/") // Links to the application's root or homepage
public String listGifs(ModelMap modelMap) {
List<Gif> allGifs = gifRepository.getAllGifs();
modelMap.put("gifs", allGifs);
return "home"; // As the HTML file located resources/templates is named home.html
}
@RequestMapping("/gif")
@ResponseBody
public String getSpecificGif() {
return "<h1>This should display one single gif</h1>";
}
@RequestMapping("/gif/{name}")
public String gifDetails(@PathVariable String name, ModelMap modelMap ) {
Gif gif = gifRepository.findByName(name);
modelMap.put("gif", gif);
return "gif-details";
}
}
|
[
"[email protected]"
] | |
c8320b71be019b76c60ba80bfa9a58199dae174b
|
db0b516014fd7f67b19165050b7e4772d4966e98
|
/JavaStudy/src/ch4/FlowEx11.java
|
3a50a463ae55e81430bed9b65475030d18a813b6
|
[] |
no_license
|
kimue24/JavaStduy
|
ecfdc77351b5277acf1ab1efea11aa034ae6c67a
|
1ab0db8b13ddb3d228ea49721caf2c255389f67d
|
refs/heads/master
| 2023-03-24T10:05:35.067666 | 2021-03-22T00:33:22 | 2021-03-22T00:33:22 | 290,674,527 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,029 |
java
|
package ch4;
import java.util.Scanner;
public class FlowEx11 {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.print("๋น์ ์ ์ฃผ๋ฏผ๋ฒํธ๋ฅผ ์
๋ ฅํ์ธ์ (1111111-2222222)>");
Scanner scanner = new Scanner(System.in);
String regNo = scanner.nextLine();
char gender = regNo.charAt(7);
switch(gender) {
case '1': case '3':
switch(gender) {
case '1':
System.out.println("๋น์ ์ 2000๋
์ด์ ์ ์ถ์ํ ๋จ์์
๋๋ค.");
break;
case '3':
System.out.println("๋น์ ์ 2000๋
์ดํ์ ์ถ์ํ ๋จ์์
๋๋ค.");
}
break;
case '2': case '4':
switch(gender) {
case '2' :
System.out.println("๋น์ ์ 2000๋
๋ ์ด์ ์ ์ถ์ํ ์ฌ์์
๋๋ค.");
break;
case '4':
System.out.println("๋น์ ์ 2000๋
๋ ์ดํ์ ์ถ์ํ ์ฌ์์
๋๋ค.");
break;
}
break;
default:
System.out.println("์ ํจํ์ง ์์ ์ฃผ๋ฏผ๋ฑ๋ก๋ฒํธ์
๋๋ค.");
}
} // main์ ๋
}
|
[
"[email protected]"
] | |
d7765e39c89e14539403723ff627e8e99f1d9300
|
6fa3ff55adc7c5ae8b62099582cf58e46dec434a
|
/app/src/main/java/com/truiton/bnuwallet/utils/RecyclerTouchListener.java
|
8cdc78ee927488ef170c2ca8432f36c0607101d6
|
[
"Apache-2.0"
] |
permissive
|
xtianmpimbaza/ytbit
|
bf6f3e75d0a5ff61f3157d47a690310613dae032
|
8d15427505420a3449ae0fed526ef3c80b208105
|
refs/heads/master
| 2020-06-03T20:28:02.799632 | 2019-06-13T08:14:02 | 2019-06-13T08:14:02 | 191,719,461 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,874 |
java
|
package com.truiton.bnuwallet.utils;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
/**
* Created by ravi on 21/02/18.
*/
public class RecyclerTouchListener implements RecyclerView.OnItemTouchListener {
private ClickListener clicklistener;
private GestureDetector gestureDetector;
public RecyclerTouchListener(Context context, final RecyclerView recycleView, final ClickListener clicklistener) {
this.clicklistener = clicklistener;
gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapUp(MotionEvent e) {
return true;
}
@Override
public void onLongPress(MotionEvent e) {
View child = recycleView.findChildViewUnder(e.getX(), e.getY());
if (child != null && clicklistener != null) {
clicklistener.onLongClick(child, recycleView.getChildAdapterPosition(child));
}
}
});
}
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
View child = rv.findChildViewUnder(e.getX(), e.getY());
if (child != null && clicklistener != null && gestureDetector.onTouchEvent(e)) {
clicklistener.onClick(child, rv.getChildAdapterPosition(child));
}
return false;
}
@Override
public void onTouchEvent(RecyclerView rv, MotionEvent e) {
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
public interface ClickListener {
void onClick(View view, int position);
void onLongClick(View view, int position);
}
}
|
[
"[email protected]"
] | |
4ecf49153e04e6733ae3acb87d14054ee38aa6b4
|
ded8c188d6789c3494de305aadbfe02c0f2c9982
|
/Triangulo_IG/MyApplication2/app/src/main/java/com/example/myapplication2/MainActivity.java
|
daded8d1000fb0cd42269b92e1e755df60bf3cef
|
[] |
no_license
|
BaconWarrior/Examen-Informatica-2
|
d020bd112db0e6b0596b5c872695799ced80cc1d
|
e966567d559a2abb9f6574da82804f366b718a52
|
refs/heads/master
| 2023-01-09T22:23:36.246289 | 2020-11-08T06:32:07 | 2020-11-08T06:32:07 | 310,727,028 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,081 |
java
|
package com.example.myapplication2;
import android.opengl.GLSurfaceView;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
private GLSurfaceView gLView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
gLView = new MyGLSurfaceView(this);
setContentView(gLView);
}
/*
@Override
protected void onPause() {
super.onPause();
//La siguiente llamada pausa el hilo de renderizado.
//Si su aplicaciรณn OpenGL consume mucha memoria,
//deberรญa considerar desasignar los objetos
//que consumen mucha memoria aquรญ.
gLView.onPause();
}
@Override
protected void onResume() {
super.onResume();
//La siguiente llamada reanuda
//un hilo de procesamiento en pausa.
//Si desasignรณ objetos grรกficos
//para onPause (), este es un buen
//lugar para reasignarlos.
gLView.onResume();
}
*/
}
|
[
"[email protected]"
] | |
52ce4d7489a86caae1cc366909bd97297950d4ae
|
51ada5f52bdbfdb5e98163bf3237b27bc53139bd
|
/rz-common/src/main/java/com/rick/scaffold/common/http/HttpService.java
|
5d9d201a9665024cd433f4b1881a4911a687dec9
|
[] |
no_license
|
hzwjava/scaffold
|
b201210c21b46b50011c5a0dc022a8880bcbebbd
|
ca1ac0d3f6c0272ed34dbafe8bb0967ce357f7b5
|
refs/heads/master
| 2021-01-12T07:25:28.676836 | 2016-03-21T03:29:29 | 2016-03-21T03:29:29 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 114 |
java
|
package com.rick.scaffold.common.http;
public interface HttpService {
String put(String url, String params);
}
|
[
"[email protected]"
] | |
2fecaa3b9206828c4294cd496e154b9f1feecccd
|
4ba02b02d6df41daa1f5ee6dadbf59772585d92b
|
/blog-common/src/main/java/com/whoai/blog/dto/ArticleCateTagInputDTO.java
|
0788a9cedf6e4c7e7f4aee79f6fea001bf802a50
|
[] |
no_license
|
littlexiaotimpro/graduation.design
|
5740d7fb531d554fcbac9c8c772f1a85b8b0e4a2
|
cd8d855a83b1fc1fab7397e633fc3ffd709cf552
|
refs/heads/master
| 2023-06-22T14:38:11.867175 | 2022-08-28T00:44:27 | 2022-08-28T00:44:27 | 172,858,257 | 0 | 0 | null | 2023-06-14T22:22:15 | 2019-02-27T06:38:24 |
Java
|
UTF-8
|
Java
| false | false | 542 |
java
|
package com.whoai.blog.dto;
import com.whoai.blog.entity.Article;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class ArticleCateTagInputDTO extends AbstractInputDTO<ArticleCateTagInputDTO, Article> {
private String enCategory;
private String enTag;
@Override
public Article convertToEntity() {
DTOConvert<ArticleCateTagInputDTO, Article> converter = converter();
converter.setEntity(new Article());
return converter.convert(this);
}
}
|
[
"[email protected]"
] | |
0eead2f3c4763075eba65251dff731ca1c9adf58
|
9e3277edb9f2ccb7fae844ed1aa310a910ae560e
|
/src/main/java/org/xsdforms/xsdformbuilder/form/field/NumberField.java
|
615cde96b6c7d0972fe9eeacdf9eb11a71b546c3
|
[
"MIT"
] |
permissive
|
lrozanski/xsdformbuilder
|
656994dba6eb094031bcab38317421cb39c5b4cc
|
a8a85ab4a70a259dc8068c0db470dc8a11d9587f
|
refs/heads/master
| 2016-09-05T20:26:46.287888 | 2014-07-19T10:05:23 | 2014-07-19T10:05:23 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,962 |
java
|
package org.xsdforms.xsdformbuilder.form.field;
import org.xsdforms.xsdformbuilder.configuration.impl.FieldConfiguration;
import org.xsdforms.xsdformbuilder.form.AbstractForm;
public class NumberField extends AbstractField {
private static final Long serialVersionUID = -1L;
private static int fieldCount;
private Double value;
private Integer minValue;
private Integer maxValue;
private Integer decimalPlaces;
public NumberField(FieldConfiguration configuration, AbstractForm parentForm, String name,
String label, Double value, Integer decimalPlaces) {
super(configuration, parentForm, name, label);
this.value = value;
this.decimalPlaces = decimalPlaces;
String id = String.format("%s_field_%s_%s", parentForm.getId(), fieldCount++, label);
this.setId(id);
this.getCssClasses().add("xsd-field-number");
}
public NumberField(FieldConfiguration configuration, AbstractForm parentForm, String name,
String label, Double value, Integer minValue, Integer maxValue, Integer decimalPlaces) {
super(configuration, parentForm, name, label);
this.value = value;
this.minValue = minValue;
this.maxValue = maxValue;
this.decimalPlaces = decimalPlaces;
}
public Double getValue() {
return value;
}
public void setValue(Double value) {
this.value = value;
}
public Integer getMinValue() {
return minValue;
}
public void setMinValue(Integer minValue) {
this.minValue = minValue;
}
public Integer getMaxValue() {
return maxValue;
}
public void setMaxValue(Integer maxValue) {
this.maxValue = maxValue;
}
public Integer getDecimalPlaces() {
return decimalPlaces;
}
public void setDecimalPlaces(Integer decimalPlaces) {
this.decimalPlaces = decimalPlaces;
}
}
|
[
"[email protected]"
] | |
b4948be7a51f1aaf40b3c52ff592cbcc6b603523
|
eb96dba1c879e6ee60b94db34ece7ff42fc2e9ba
|
/src/main/java/fun/rubicon/cluster/bot/commands/BotStopCommand.java
|
26c3ebd580e90aa2a08ef5bcdef15465955f9e24
|
[] |
no_license
|
Rubicon-Bot/RubiconCluster
|
5de76a69e75a7dddb74b4c5e713f8a1b74082ab8
|
b3035fd7d425e0a6d6d952e2da4af2a55ec100a3
|
refs/heads/master
| 2020-03-19T00:10:51.515686 | 2018-05-30T16:29:32 | 2018-05-30T16:29:32 | 135,459,933 | 5 | 0 | null | 2018-05-30T16:29:33 | 2018-05-30T15:06:11 |
Java
|
UTF-8
|
Java
| false | false | 3,049 |
java
|
package fun.rubicon.cluster.bot.commands;
import com.jcraft.jsch.JSchException;
import fun.rubicon.cluster.Server;
import fun.rubicon.cluster.bot.command.BotCommand;
import fun.rubicon.cluster.ssh.SSHBotCredentials;
import fun.rubicon.cluster.ssh.SSHController;
import net.dv8tion.jda.core.EmbedBuilder;
import net.dv8tion.jda.core.entities.Guild;
import net.dv8tion.jda.core.entities.Message;
import net.dv8tion.jda.core.entities.User;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
import org.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.*;
import java.io.IOException;
public class BotStopCommand extends BotCommand {
/*
* start container all
* start container <host>
* start bot all
* start bot <host>
*/
private final Logger logger = LoggerFactory.getLogger(getClass().getSimpleName());
@Override
public void execute(MessageReceivedEvent event, Message message, Guild guild, String content, String invoke, String[] args, String prefix, User author) {
if (args.length < 2) {
message.getTextChannel().sendMessage(new EmbedBuilder().setColor(Color.red).setTitle(":warning: Wrong usage!").setDescription("You must provide at least **two** argument.").build()).queue();
return;
}
switch (args[0].toLowerCase()) {
case "container":
startContainers(event, args);
return;
case "bot":
if(args[1].equalsIgnoreCase("all")) {
}
default:
message.getTextChannel().sendMessage(new EmbedBuilder().setColor(Color.orange).setTitle(":warning: Wrong usage!").setDescription("Valid options are `container` and `bot`").build()).queue();
return;
}
}
private void startContainers(MessageReceivedEvent messageReceivedEvent, String[] args) {
boolean all = args[1].equalsIgnoreCase("all");
JSONArray array = Server.getInstance().getConfig().getArray("bot_credentials");
if(all) {
for(Object obj : array) {
SSHBotCredentials credentials = SSHBotCredentials.parse((String) obj);
SSHController sshController = null;
try {
sshController = new SSHController(credentials.getHost(), credentials.getUser(), credentials.getPassword());
sshController.send(String.format(Server.getInstance().getConfig().getString("cmd_bot_stop"), credentials.getPath()));
messageReceivedEvent.getTextChannel().sendMessage(new EmbedBuilder().setTitle(":green_heart: Stopping Procedure").setDescription(String.format("Stopping Container on `%s`...", credentials.getHost())).setColor(Color.yellow).build()).queue();
} catch (JSchException e) {
e.printStackTrace();
} finally {
if(sshController != null) sshController.close();
}
}
}
}
}
|
[
"[email protected]"
] | |
4faefe77a3b57d380e579d0c0d41fbbc3d75774e
|
21236b35ff5b108a5862527da31a324149d717a3
|
/src/main/java/dev/infrastructr/deck/api/services/AppUrlProvider.java
|
219a31092075b989d99bea2456457d771f737821
|
[
"MIT"
] |
permissive
|
infrastructr/deck-api
|
c0bb0acc3d06683acb98e26eb0a6055065952f6a
|
7ff57719679b69f92c9e9ec2fbda25180790d7ae
|
refs/heads/master
| 2022-10-02T11:04:10.854969 | 2020-05-25T21:24:34 | 2020-05-25T21:24:34 | 245,249,537 | 0 | 0 |
MIT
| 2022-09-08T01:06:24 | 2020-03-05T19:25:17 |
Java
|
UTF-8
|
Java
| false | false | 937 |
java
|
package dev.infrastructr.deck.api.services;
import dev.infrastructr.deck.api.props.ApiCommonProps;
import dev.infrastructr.deck.api.props.ApiRequestMappingProps;
import org.springframework.stereotype.Service;
import java.util.UUID;
import static java.text.MessageFormat.format;
@Service
public class AppUrlProvider {
private final ApiRequestMappingProps apiHostProps;
private final ApiCommonProps apiCommonProps;
public AppUrlProvider(
ApiRequestMappingProps apiHostProps,
ApiCommonProps apiCommonProps
){
this.apiHostProps = apiHostProps;
this.apiCommonProps = apiCommonProps;
}
public String getHostHeartbeatUrl(UUID hostId){
return format(apiCommonProps.getBaseUrl() + apiHostProps.getHostHeartbeat(), hostId);
}
public String getHostInitUrl(UUID hostId){
return format(apiCommonProps.getBaseUrl() + apiHostProps.getHostInit(), hostId);
}
}
|
[
"[email protected]"
] | |
57eb8c33563d26b9d69fc27cd47968184f64d776
|
f32c308fc14e83f698dd1e36141b442a43ac7274
|
/5.Array/Extra Practice/ArrayAsList.java
|
fe9eaf3ea79c615193c0d01c998b030eaf46c10a
|
[] |
no_license
|
Swapnil2095/Java
|
1b5d0490136ecc081bd3953f1db7645356d0e2a2
|
b7c6e4cb6a37931f6b0d561d20d3492862cbb7b1
|
refs/heads/master
| 2021-07-15T05:20:16.637670 | 2017-10-12T12:48:50 | 2017-10-12T12:48:50 | 103,417,378 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,016 |
java
|
/*public static List asList(Tโฆa)
It takes an array and creates a wrapper that implements List,
which makes the original array available as a list.Nothing is copied and all,
only a single wrapper object is created.Operations on the list wrapper are
propagated to the original array.This means that if you shuffle the list wrapper,
the original array is shuffled as well,if you overwrite an element,
it gets overwritten in the original array,etc.Of course,
some List operations arenโt allowed on the wrapper,
like adding or removing elements from the list,you can only read or overwrite the elements.
*/
// Java program to demonstrate asList()
import java.util.Arrays;
import java.util.List;ย
public class ArrayAsList {
ย ย ย ย public static void main(String[] args)
ย ย ย ย {
ย ย ย ย ย ย ย ย Integer ar[] = {4, 6, 1, 8, 3, 9, 7, 4, 2};
ย
ย ย ย ย ย ย ย ย // Creates a wrapper list over ar[]
ย ย ย ย ย ย ย ย List<Integer> l1 = Arrays.asList(ar);
ย
ย ย ย ย ย ย ย ย System.out.println(l1);
ย ย ย ย }
}
|
[
"[email protected]"
] | |
d09e37e350883c2671ffd9ef099df81221a7b99b
|
212b056b9f2814616917c43e203839f737ec54f7
|
/app/src/main/java/com/wenyu/ylive/biz/home/main/model/IHomeMainModel.java
|
60e4991493057910bb40c5f780a72d95e78e9ba2
|
[
"Apache-2.0"
] |
permissive
|
viralsavaniIM/AndroidLive
|
043ee84c1b526250dc45890b88b27f3bb05f7788
|
b45d8e18330a4829229f6358490907a2c076cc89
|
refs/heads/master
| 2021-01-02T08:41:44.053506 | 2017-06-01T12:08:05 | 2017-06-01T12:08:05 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 420 |
java
|
package com.wenyu.ylive.biz.home.main.model;
import com.google.gson.JsonElement;
import com.wenyu.mvp.model.IMvpModel;
import com.wenyu.ylive.common.bean.Room;
import java.util.List;
import rx.Observable;
/**
* Created by chan on 17/4/2.
*/
public interface IHomeMainModel extends IMvpModel {
Observable<List<Room>> fetchRoomList(int category, int page);
Observable<JsonElement> fetchLivePermission();
}
|
[
"[email protected]"
] | |
40bbbaf0b1779bc8c2afde38b54731cc0bece717
|
f16d3e311edea8722c50a3ee354b10490d8b5b4c
|
/sensor-xom/src/com/acme/sensors/model/Sensor.java
|
d8644c764b8ed7ea182533baa5f3cefe73547335
|
[
"MIT"
] |
permissive
|
ibmbpm/odm-rules-bluemix-sensors
|
ff43f99abb0b39bf6d8848908160ce63e21fade6
|
20178a93f09c999b96470d892607e83c0564a254
|
refs/heads/master
| 2021-04-30T22:16:42.766414 | 2016-04-22T20:18:30 | 2016-04-22T20:18:30 | 58,564,241 | 1 | 0 | null | 2016-05-11T17:01:38 | 2016-05-11T17:01:36 |
Java
|
UTF-8
|
Java
| false | false | 3,295 |
java
|
package com.acme.sensors.model;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class Sensor {
private String name;
public double getTemp() {
return temp;
}
public void setTemp(double temp) {
this.temp = temp;
}
public double getHumidity() {
return humidity;
}
public void setHumidity(double humidity) {
this.humidity = humidity;
}
public double getObjectTemp() {
return objectTemp;
}
public void setObjectTemp(double objectTemp) {
this.objectTemp = objectTemp;
}
public String getName() {
return name;
}
public double getFeelsLikeTemp() {
if (feelsLikeTemp == 0.0)
this.computeFeelsLikeTemperature();
return feelsLikeTemp;
}
public String getWarning() {
return warning;
}
public void setWarning(String warning) {
this.warning = warning;
}
public void setName(String name) {
this.name = name;
}
private double temp = 20.0;
private double humidity = 50;
private double objectTemp = 20.0;
private double feelsLikeTemp=0.0;
private String warning = "";
private String type = "indoor";
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Sensor() {
};
public Sensor(String name, String type, double temp, double humidity, double objectTemp) {
this.name = name;
this.type = type;
this.temp = temp;
this.humidity= humidity;
this.objectTemp = objectTemp;
}
// from http://stackoverflow.com/questions/2808535/round-a-double-to-2-decimal-places
public static double round(double value, int places) {
if (places < 0) throw new IllegalArgumentException();
BigDecimal bd = new BigDecimal(value);
bd = bd.setScale(places, RoundingMode.HALF_UP);
return bd.doubleValue();
}
// from http://www.srh.noaa.gov/images/epz/wxcalc/heatIndex.pdf
public void computeFeelsLikeTemperature() {
if (temp < 26.7 || humidity < 40){
feelsLikeTemp = temp;
} else {
double tempF = temp * 9/5 + 32;
double feelsLikeTempF = - 42.379 + (2.04901523 * tempF) + (10.14333127 * humidity)
- (0.22475541 * tempF * humidity) - (6.83783 * 0.001 * tempF * tempF)
- (5.481717 * 0.01 * humidity * humidity)
+ (1.22874 * 0.001 * tempF * tempF * humidity)
+ (8.5282 * 0.0001 * tempF * humidity * humidity )
- (1.99 * 1/1000000 * tempF * tempF * humidity * humidity);
feelsLikeTemp = (feelsLikeTempF - 32) * 5 / 9;
}
feelsLikeTemp = round(feelsLikeTemp, 2);
System.out.print("The temperature " + temp + "C with humidity " + humidity + "% feels like " + feelsLikeTemp + "C");
}
@Override
public String toString() {
return "Sensor [name=" + name + ", type=" + type +", temp=" + temp + ", humidity=" + humidity
+ ", objectTemp=" + objectTemp
+ ", feelsLikeTemp="
+ feelsLikeTemp + "]";
}
public static void main(String[] args) {
Sensor sensor = new Sensor();
sensor.setTemp(35);
sensor.setHumidity(80);
computeFeelsLikeTemp(sensor);
}
private static void computeFeelsLikeTemp(Sensor sensor) {
sensor.computeFeelsLikeTemperature();
}
}
|
[
"[email protected]"
] | |
bf36ca9282ed17816854724fead3676c7547b480
|
48b37cb4a2976184ca9892776d2b9e03f281d4ab
|
/app/src/main/java/bignerdranch/android/earthquake/PreferencesActivity.java
|
718a457e8a077e31a2f27554599cb8342a3c1561
|
[] |
no_license
|
alieveldar/Earthquake
|
5352d0290b6a35e1d18803b29b5eeda8686e09ce
|
3e8381d58af965b6baf555eee3b7a92e3d12c4d6
|
refs/heads/master
| 2021-01-24T00:15:41.523832 | 2018-03-15T13:39:05 | 2018-03-15T13:39:05 | 122,759,434 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 779 |
java
|
package bignerdranch.android.earthquake;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.Spinner;
/**
* Created by modus on 2/27/18.
*/
public class PreferencesActivity extends PreferenceActivity {
public static final String PREF_MIN_MAG = "PREF_MIN_MAG";
public static final String PREF_UPDATE_FREQ = "PREF_UPDATE_FREQ";
public static final String PREF_AUTO_UPDDATE = "PREF_AUTO_UPDATE";
SharedPreferences pref;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.userpreferences);
}
}
|
[
"[email protected]"
] | |
cd765b0f5970a487f342aeb3e89b3548a9d384c7
|
d236ed648e26aaffcd895b1fb9feb49100b5fb3f
|
/src/nir/model/util/Mat.java
|
10e180aea11eadc7adc4c53f32b3fea5f87ef4fd
|
[] |
no_license
|
Grobych/NIR_complex
|
8a6e6d08cebea8c95d102b4e6e7c5583b4eabc07
|
9ac7423f9c5ec2b935cd159e8f3ade4afed22221
|
refs/heads/master
| 2023-01-31T19:59:25.371334 | 2020-12-18T14:55:29 | 2020-12-18T14:55:29 | 311,916,617 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,281 |
java
|
package nir.model.util;
import org.locationtech.jts.geom.Coordinate;
import java.util.ArrayList;
import java.util.List;
public class Mat {
public static double getRad(double x1, double y1, double x2, double y2) {
double difX = x2 - x1;
double difY = y2 - y1;
return Math.atan2(difY, difX);
}
public static List<Coordinate> line_s4(int x1, int y1, int x2, int y2) {
List<Coordinate> res = new ArrayList<>();
int x = x1, y = y1;
int dx = Math.abs(x2 - x1), dy = Math.abs(y2 - y1);
int sx = (x2 - x1) > 0 ? 1 : ((x2 - x1) == 0 ? 0 : -1);
int sy = (y2 - y1) > 0 ? 1 : ((y2 - y1) == 0 ? 0 : -1);
int e = 2 * dy - dx;
boolean change = false;
if (dy > dx) {
int z = dx;
dx = dy;
dy = z;
change = true;
}
res.add(new Coordinate(x, y));
for (int k = 1; k <= (dx + dy); k++) {
if (e < dx) {
if (change) y += sy;
else x += sx;
e += 2 * dy;
} else {
if (change) x += sx;
else y = y + sy;
e -= 2 * dx;
}
res.add(new Coordinate(x, y));
}
return res;
}
}
|
[
"[email protected]"
] | |
2ab32cac46e2ef9e97ddb86b9e9c5ca7910fbf1a
|
6047bfb9d39addbaca7c8d0c8d423ec12a4c24b6
|
/src/main/java/com/Generic/Belbort/Controller/MainController.java
|
fe1fc29a31a737946c936aa4afcf748fc48e2aab
|
[] |
no_license
|
Vitold-sys/Belbort
|
23e448fcb9b64ef445f4e17b7b646142f6941cd6
|
db047f574888c618cfb88975d8242ac8ecdd06f0
|
refs/heads/master
| 2023-01-11T08:44:14.669189 | 2019-11-13T14:32:32 | 2019-11-13T14:32:32 | 221,478,600 | 0 | 0 | null | 2023-01-05T00:48:28 | 2019-11-13T14:31:00 |
Java
|
UTF-8
|
Java
| false | false | 1,279 |
java
|
package com.Generic.Belbort.Controller;
import com.Generic.Belbort.domain.User;
import com.Generic.Belbort.repo.MessageRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.HashMap;
@Controller
@RequestMapping("/")
public class MainController {
private final MessageRepo messageRepo;
@Value("${spring.profiles.active}")
private String profile;
@Autowired
public MainController(MessageRepo messageRepo) {
this.messageRepo = messageRepo;
}
@GetMapping
public String main(Model model, @AuthenticationPrincipal User user) {
HashMap<Object, Object> data = new HashMap<>();
if (user!=null) {
data.put("profile", user);
data.put("messages", messageRepo.findAll());
}
model.addAttribute("frontendData", data);
model.addAttribute("isDevMode", "dev".equals(profile));
return "index";
}
}
|
[
"[email protected]"
] | |
7a284b595c47147d21f9fecb370930eaa749527f
|
d0dd1b92e48f3174fbbe4139ef5bb04f5b722e47
|
/src/main/java/com/example/filmmanagementsystem/entities/Director.java
|
731636a2ae736e8823cf4f62a2b0710569d3a08f
|
[] |
no_license
|
shyamajay/filmdemo
|
2305723c04f321936fb87204244ea6242329f860
|
0ee0ff78ba26e90643264146a45920abe4757c1f
|
refs/heads/master
| 2023-04-26T07:32:09.938930 | 2021-05-27T00:38:33 | 2021-05-27T00:38:33 | 371,382,666 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,112 |
java
|
package com.example.filmmanagementsystem.entities;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@Entity
//@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
public class Director {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(unique = true)
private String directorName;
private int age;
private String gender;
private int awardCount;
@ManyToMany(targetEntity = Movie.class,cascade = CascadeType.PERSIST)
@JoinTable(name = "movie_director",
joinColumns = { @JoinColumn(name = "movie_id ") },
inverseJoinColumns = { @JoinColumn(name = "director_id") })
@JsonIgnoreProperties("directors")
List<Movie> movies = new ArrayList<Movie>();
public Director() {
super();
}
public Director(int id, String directorName, int age, String gender, int awardCount) {
super();
this.id = id;
this.directorName = directorName;
this.age = age;
this.gender = gender;
this.awardCount = awardCount;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDirectorName() {
return directorName;
}
public void setDirectorName(String directorName) {
this.directorName = directorName;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public int getAwardCount() {
return awardCount;
}
public void setAwardCount(int awardCount) {
this.awardCount = awardCount;
}
public List<Movie> getMovies() {
return movies;
}
public void setMovies(List<Movie> movies) {
this.movies = movies;
}
}
|
[
"[email protected]"
] | |
d769b8c3d6226ce20498881f08d2a2e745891b38
|
c715f2dddf959010109a6192d759176077a91140
|
/src/view/ImageUtils.java
|
2901341b31e768891318358f0352a2c42f89b48d
|
[] |
no_license
|
yuvalsegall/Roulette
|
df778393bbd0f559de7f706e66023d0cc9b4c786
|
038d43e52ea5cb17f0d788b28572995465302343
|
refs/heads/master
| 2021-01-10T00:58:02.534876 | 2015-06-15T02:33:03 | 2015-06-15T02:33:03 | 36,073,461 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 842 |
java
|
/*
*/
package view;
import java.net.URL;
import javafx.scene.image.Image;
/**
*
* @author iblecher
*/
public class ImageUtils {
private static final String RESOURCES_DIR = "/resources/";
private static final String IMAGE_EXTENSION = ".jpg";
public static Image getImage(String filename) {
if (filename == null || filename.isEmpty()) {
return null;
}
if (!filename.endsWith(IMAGE_EXTENSION)) {
filename = filename + IMAGE_EXTENSION;
}
return new Image(ImageUtils.class.getResourceAsStream(RESOURCES_DIR + filename));
}
public static void main(String[] args) {
URL url = ImageUtils.class.getResource(RESOURCES_DIR + "computer.jpg");
System.out.println(url != null ? url.toString() : "null");
}
}
|
[
"[email protected]"
] | |
80a6e596979dc41f5d1b2c5249a473e210c46ddb
|
481adc8f5686985a7b9241055d50ff6084beea95
|
/wear/tiles/tiles/src/main/java/androidx/wear/tiles/ActionBuilders.java
|
1aa8fbbdee3027317b92c4fed1e09bc2e1adaeb9
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
RikkaW/androidx
|
5f5e8a996f950a85698073330c16f5341b48e516
|
6d53f95e5d979366cf7935ad7f4f14f76a951ea5
|
refs/heads/androidx-main
| 2023-06-18T22:35:12.976328 | 2021-07-24T13:53:34 | 2021-07-24T13:53:34 | 389,105,112 | 4 | 0 |
Apache-2.0
| 2021-07-24T13:53:34 | 2021-07-24T13:25:43 | null |
UTF-8
|
Java
| false | false | 25,100 |
java
|
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package androidx.wear.tiles;
import static java.util.stream.Collectors.toMap;
import android.annotation.SuppressLint;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.Scope;
import androidx.wear.tiles.StateBuilders.State;
import androidx.wear.tiles.proto.ActionProto;
import java.util.Collections;
import java.util.Map;
/** Builders for actions that can be performed when a user interacts with layout elements. */
public final class ActionBuilders {
private ActionBuilders() {}
/** Shortcut for building an {@link AndroidStringExtra}. */
@NonNull
public static AndroidStringExtra stringExtra(@NonNull String value) {
return AndroidStringExtra.builder().setValue(value).build();
}
/** Shortcut for building an {@link AndroidIntExtra}. */
@NonNull
public static AndroidIntExtra intExtra(int value) {
return AndroidIntExtra.builder().setValue(value).build();
}
/** Shortcut for building an {@link AndroidLongExtra}. */
@NonNull
public static AndroidLongExtra longExtra(long value) {
return AndroidLongExtra.builder().setValue(value).build();
}
/** Shortcut for building an {@link AndroidDoubleExtra}. */
@NonNull
public static AndroidDoubleExtra doubleExtra(double value) {
return AndroidDoubleExtra.builder().setValue(value).build();
}
/** Shortcut for building an {@link AndroidBooleanExtra}. */
@NonNull
public static AndroidBooleanExtra booleanExtra(boolean value) {
return AndroidBooleanExtra.builder().setValue(value).build();
}
/** A string value that can be added to an Android intent's extras. */
public static final class AndroidStringExtra implements AndroidExtra {
private final ActionProto.AndroidStringExtra mImpl;
private AndroidStringExtra(ActionProto.AndroidStringExtra impl) {
this.mImpl = impl;
}
/** Gets the value. Intended for testing purposes only. */
@NonNull
public String getValue() {
return mImpl.getValue();
}
/** Returns a new {@link Builder}. */
@NonNull
public static Builder builder() {
return new Builder();
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public static AndroidStringExtra fromProto(@NonNull ActionProto.AndroidStringExtra proto) {
return new AndroidStringExtra(proto);
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
ActionProto.AndroidStringExtra toProto() {
return mImpl;
}
/** @hide */
@Override
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public ActionProto.AndroidExtra toAndroidExtraProto() {
return ActionProto.AndroidExtra.newBuilder().setStringVal(mImpl).build();
}
/** Builder for {@link AndroidStringExtra}. */
public static final class Builder implements AndroidExtra.Builder {
private final ActionProto.AndroidStringExtra.Builder mImpl =
ActionProto.AndroidStringExtra.newBuilder();
Builder() {}
/** Sets the value. */
@NonNull
public Builder setValue(@NonNull String value) {
mImpl.setValue(value);
return this;
}
@Override
@NonNull
public AndroidStringExtra build() {
return AndroidStringExtra.fromProto(mImpl.build());
}
}
}
/** An integer value that can be added to an Android intent's extras. */
public static final class AndroidIntExtra implements AndroidExtra {
private final ActionProto.AndroidIntExtra mImpl;
private AndroidIntExtra(ActionProto.AndroidIntExtra impl) {
this.mImpl = impl;
}
/** Gets the value. Intended for testing purposes only. */
public int getValue() {
return mImpl.getValue();
}
/** Returns a new {@link Builder}. */
@NonNull
public static Builder builder() {
return new Builder();
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public static AndroidIntExtra fromProto(@NonNull ActionProto.AndroidIntExtra proto) {
return new AndroidIntExtra(proto);
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
ActionProto.AndroidIntExtra toProto() {
return mImpl;
}
/** @hide */
@Override
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public ActionProto.AndroidExtra toAndroidExtraProto() {
return ActionProto.AndroidExtra.newBuilder().setIntVal(mImpl).build();
}
/** Builder for {@link AndroidIntExtra}. */
public static final class Builder implements AndroidExtra.Builder {
private final ActionProto.AndroidIntExtra.Builder mImpl =
ActionProto.AndroidIntExtra.newBuilder();
Builder() {}
/** Sets the value. */
@NonNull
public Builder setValue(int value) {
mImpl.setValue(value);
return this;
}
@Override
@NonNull
public AndroidIntExtra build() {
return AndroidIntExtra.fromProto(mImpl.build());
}
}
}
/** A long value that can be added to an Android intent's extras. */
public static final class AndroidLongExtra implements AndroidExtra {
private final ActionProto.AndroidLongExtra mImpl;
private AndroidLongExtra(ActionProto.AndroidLongExtra impl) {
this.mImpl = impl;
}
/** Gets the value. Intended for testing purposes only. */
public long getValue() {
return mImpl.getValue();
}
/** Returns a new {@link Builder}. */
@NonNull
public static Builder builder() {
return new Builder();
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public static AndroidLongExtra fromProto(@NonNull ActionProto.AndroidLongExtra proto) {
return new AndroidLongExtra(proto);
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
ActionProto.AndroidLongExtra toProto() {
return mImpl;
}
/** @hide */
@Override
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public ActionProto.AndroidExtra toAndroidExtraProto() {
return ActionProto.AndroidExtra.newBuilder().setLongVal(mImpl).build();
}
/** Builder for {@link AndroidLongExtra}. */
public static final class Builder implements AndroidExtra.Builder {
private final ActionProto.AndroidLongExtra.Builder mImpl =
ActionProto.AndroidLongExtra.newBuilder();
Builder() {}
/** Sets the value. */
@NonNull
public Builder setValue(long value) {
mImpl.setValue(value);
return this;
}
@Override
@NonNull
public AndroidLongExtra build() {
return AndroidLongExtra.fromProto(mImpl.build());
}
}
}
/** A double value that can be added to an Android intent's extras. */
public static final class AndroidDoubleExtra implements AndroidExtra {
private final ActionProto.AndroidDoubleExtra mImpl;
private AndroidDoubleExtra(ActionProto.AndroidDoubleExtra impl) {
this.mImpl = impl;
}
/** Gets the value. Intended for testing purposes only. */
public double getValue() {
return mImpl.getValue();
}
/** Returns a new {@link Builder}. */
@NonNull
public static Builder builder() {
return new Builder();
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public static AndroidDoubleExtra fromProto(@NonNull ActionProto.AndroidDoubleExtra proto) {
return new AndroidDoubleExtra(proto);
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
ActionProto.AndroidDoubleExtra toProto() {
return mImpl;
}
/** @hide */
@Override
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public ActionProto.AndroidExtra toAndroidExtraProto() {
return ActionProto.AndroidExtra.newBuilder().setDoubleVal(mImpl).build();
}
/** Builder for {@link AndroidDoubleExtra}. */
public static final class Builder implements AndroidExtra.Builder {
private final ActionProto.AndroidDoubleExtra.Builder mImpl =
ActionProto.AndroidDoubleExtra.newBuilder();
Builder() {}
/** Sets the value. */
@NonNull
public Builder setValue(double value) {
mImpl.setValue(value);
return this;
}
@Override
@NonNull
public AndroidDoubleExtra build() {
return AndroidDoubleExtra.fromProto(mImpl.build());
}
}
}
/** A boolean value that can be added to an Android intent's extras. */
public static final class AndroidBooleanExtra implements AndroidExtra {
private final ActionProto.AndroidBooleanExtra mImpl;
private AndroidBooleanExtra(ActionProto.AndroidBooleanExtra impl) {
this.mImpl = impl;
}
/** Gets the value. Intended for testing purposes only. */
public boolean getValue() {
return mImpl.getValue();
}
/** Returns a new {@link Builder}. */
@NonNull
public static Builder builder() {
return new Builder();
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public static AndroidBooleanExtra fromProto(
@NonNull ActionProto.AndroidBooleanExtra proto) {
return new AndroidBooleanExtra(proto);
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
ActionProto.AndroidBooleanExtra toProto() {
return mImpl;
}
/** @hide */
@Override
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public ActionProto.AndroidExtra toAndroidExtraProto() {
return ActionProto.AndroidExtra.newBuilder().setBooleanVal(mImpl).build();
}
/** Builder for {@link AndroidBooleanExtra}. */
public static final class Builder implements AndroidExtra.Builder {
private final ActionProto.AndroidBooleanExtra.Builder mImpl =
ActionProto.AndroidBooleanExtra.newBuilder();
Builder() {}
/** Sets the value. */
@SuppressLint("MissingGetterMatchingBuilder")
@NonNull
public Builder setValue(boolean value) {
mImpl.setValue(value);
return this;
}
@Override
@NonNull
public AndroidBooleanExtra build() {
return AndroidBooleanExtra.fromProto(mImpl.build());
}
}
}
/**
* Interface defining an item that can be included in the extras of an intent that will be sent
* to an Android activity. Supports types in android.os.PersistableBundle, excluding arrays.
*/
public interface AndroidExtra {
/**
* Get the protocol buffer representation of this object.
*
* @hide
*/
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
ActionProto.AndroidExtra toAndroidExtraProto();
/**
* Return an instance of one of this object's subtypes, from the protocol buffer
* representation.
*
* @hide
*/
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
static AndroidExtra fromAndroidExtraProto(@NonNull ActionProto.AndroidExtra proto) {
if (proto.hasStringVal()) {
return AndroidStringExtra.fromProto(proto.getStringVal());
}
if (proto.hasIntVal()) {
return AndroidIntExtra.fromProto(proto.getIntVal());
}
if (proto.hasLongVal()) {
return AndroidLongExtra.fromProto(proto.getLongVal());
}
if (proto.hasDoubleVal()) {
return AndroidDoubleExtra.fromProto(proto.getDoubleVal());
}
if (proto.hasBooleanVal()) {
return AndroidBooleanExtra.fromProto(proto.getBooleanVal());
}
throw new IllegalStateException("Proto was not a recognised instance of AndroidExtra");
}
/** Builder to create {@link AndroidExtra} objects. */
@SuppressLint("StaticFinalBuilder")
interface Builder {
/** Builds an instance with values accumulated in this Builder. */
@NonNull
AndroidExtra build();
}
}
/** A launch action to send an intent to an Android activity. */
public static final class AndroidActivity {
private final ActionProto.AndroidActivity mImpl;
private AndroidActivity(ActionProto.AndroidActivity impl) {
this.mImpl = impl;
}
/**
* Gets the package name to send the intent to, for example, "com.google.weather". Intended
* for testing purposes only.
*/
@NonNull
public String getPackageName() {
return mImpl.getPackageName();
}
/**
* Gets the fully qualified class name (including the package) to send the intent to, for
* example, "com.google.weather.WeatherOverviewActivity". Intended for testing purposes
* only.
*/
@NonNull
public String getClassName() {
return mImpl.getClassName();
}
/** Gets the extras to be included in the intent. Intended for testing purposes only. */
@NonNull
public Map<String, AndroidExtra> getKeyToExtraMapping() {
return Collections.unmodifiableMap(
mImpl.getKeyToExtraMap().entrySet().stream()
.collect(
toMap(
Map.Entry::getKey,
f ->
AndroidExtra.fromAndroidExtraProto(
f.getValue()))));
}
/** Returns a new {@link Builder}. */
@NonNull
public static Builder builder() {
return new Builder();
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public static AndroidActivity fromProto(@NonNull ActionProto.AndroidActivity proto) {
return new AndroidActivity(proto);
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public ActionProto.AndroidActivity toProto() {
return mImpl;
}
/** Builder for {@link AndroidActivity} */
public static final class Builder {
private final ActionProto.AndroidActivity.Builder mImpl =
ActionProto.AndroidActivity.newBuilder();
Builder() {}
/** Sets the package name to send the intent to, for example, "com.google.weather". */
@NonNull
public Builder setPackageName(@NonNull String packageName) {
mImpl.setPackageName(packageName);
return this;
}
/**
* Sets the fully qualified class name (including the package) to send the intent to,
* for example, "com.google.weather.WeatherOverviewActivity".
*/
@NonNull
public Builder setClassName(@NonNull String className) {
mImpl.setClassName(className);
return this;
}
/** Adds an entry into the extras to be included in the intent. */
@SuppressLint("MissingGetterMatchingBuilder")
@NonNull
public Builder addKeyToExtraMapping(@NonNull String key, @NonNull AndroidExtra extra) {
mImpl.putKeyToExtra(key, extra.toAndroidExtraProto());
return this;
}
/** Adds an entry into the extras to be included in the intent. */
@SuppressLint("MissingGetterMatchingBuilder")
@NonNull
public Builder addKeyToExtraMapping(
@NonNull String key, @NonNull AndroidExtra.Builder extraBuilder) {
mImpl.putKeyToExtra(key, extraBuilder.build().toAndroidExtraProto());
return this;
}
/** Builds an instance from accumulated values. */
@NonNull
public AndroidActivity build() {
return AndroidActivity.fromProto(mImpl.build());
}
}
}
/**
* An action used to launch another activity on the system. This can hold multiple different
* underlying action types, which will be picked based on what the underlying runtime believes
* to be suitable.
*/
public static final class LaunchAction implements Action {
private final ActionProto.LaunchAction mImpl;
private LaunchAction(ActionProto.LaunchAction impl) {
this.mImpl = impl;
}
/** Gets an action to launch an Android activity. Intended for testing purposes only. */
@Nullable
public AndroidActivity getAndroidActivity() {
if (mImpl.hasAndroidActivity()) {
return AndroidActivity.fromProto(mImpl.getAndroidActivity());
} else {
return null;
}
}
/** Returns a new {@link Builder}. */
@NonNull
public static Builder builder() {
return new Builder();
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public static LaunchAction fromProto(@NonNull ActionProto.LaunchAction proto) {
return new LaunchAction(proto);
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
ActionProto.LaunchAction toProto() {
return mImpl;
}
/** @hide */
@Override
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public ActionProto.Action toActionProto() {
return ActionProto.Action.newBuilder().setLaunchAction(mImpl).build();
}
/** Builder for {@link LaunchAction}. */
public static final class Builder implements Action.Builder {
private final ActionProto.LaunchAction.Builder mImpl =
ActionProto.LaunchAction.newBuilder();
Builder() {}
/** Sets an action to launch an Android activity. */
@NonNull
public Builder setAndroidActivity(@NonNull AndroidActivity androidActivity) {
mImpl.setAndroidActivity(androidActivity.toProto());
return this;
}
/** Sets an action to launch an Android activity. */
@NonNull
public Builder setAndroidActivity(
@NonNull AndroidActivity.Builder androidActivityBuilder) {
mImpl.setAndroidActivity(androidActivityBuilder.build().toProto());
return this;
}
@Override
@NonNull
public LaunchAction build() {
return LaunchAction.fromProto(mImpl.build());
}
}
}
/** An action used to load (or reload) the tile contents. */
public static final class LoadAction implements Action {
private final ActionProto.LoadAction mImpl;
private LoadAction(ActionProto.LoadAction impl) {
this.mImpl = impl;
}
/**
* Gets the state to load the next tile with. This will be included in the {@link
* androidx.wear.tiles.RequestBuilders.TileRequest} sent after this action is invoked by a
* {@link androidx.wear.tiles.ModifiersBuilders.Clickable}. Intended for testing purposes
* only.
*/
@Nullable
public State getRequestState() {
if (mImpl.hasRequestState()) {
return State.fromProto(mImpl.getRequestState());
} else {
return null;
}
}
/** Returns a new {@link Builder}. */
@NonNull
public static Builder builder() {
return new Builder();
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public static LoadAction fromProto(@NonNull ActionProto.LoadAction proto) {
return new LoadAction(proto);
}
/** @hide */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
ActionProto.LoadAction toProto() {
return mImpl;
}
/** @hide */
@Override
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public ActionProto.Action toActionProto() {
return ActionProto.Action.newBuilder().setLoadAction(mImpl).build();
}
/** Builder for {@link LoadAction}. */
public static final class Builder implements Action.Builder {
private final ActionProto.LoadAction.Builder mImpl =
ActionProto.LoadAction.newBuilder();
Builder() {}
/**
* Sets the state to load the next tile with. This will be included in the {@link
* androidx.wear.tiles.RequestBuilders.TileRequest} sent after this action is invoked by
* a {@link androidx.wear.tiles.ModifiersBuilders.Clickable}.
*/
@NonNull
public Builder setRequestState(@NonNull State requestState) {
mImpl.setRequestState(requestState.toProto());
return this;
}
/**
* Sets the state to load the next tile with. This will be included in the {@link
* androidx.wear.tiles.RequestBuilders.TileRequest} sent after this action is invoked by
* a {@link androidx.wear.tiles.ModifiersBuilders.Clickable}.
*/
@NonNull
public Builder setRequestState(@NonNull State.Builder requestStateBuilder) {
mImpl.setRequestState(requestStateBuilder.build().toProto());
return this;
}
@Override
@NonNull
public LoadAction build() {
return LoadAction.fromProto(mImpl.build());
}
}
}
/** Interface defining an action that can be used by a layout element. */
public interface Action {
/**
* Get the protocol buffer representation of this object.
*
* @hide
*/
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
ActionProto.Action toActionProto();
/**
* Return an instance of one of this object's subtypes, from the protocol buffer
* representation.
*
* @hide
*/
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
static Action fromActionProto(@NonNull ActionProto.Action proto) {
if (proto.hasLaunchAction()) {
return LaunchAction.fromProto(proto.getLaunchAction());
}
if (proto.hasLoadAction()) {
return LoadAction.fromProto(proto.getLoadAction());
}
throw new IllegalStateException("Proto was not a recognised instance of Action");
}
/** Builder to create {@link Action} objects. */
@SuppressLint("StaticFinalBuilder")
interface Builder {
/** Builds an instance with values accumulated in this Builder. */
@NonNull
Action build();
}
}
}
|
[
"[email protected]"
] | |
3165d43e895328e4fd90bbd33641eec098b0eb7b
|
0c3b78eef27af58cab50704a7f96175fefec4efc
|
/src/main/java/com/zte/sms/action/StudentAction.java
|
617afd40494b035a28a5a6defcaeb20951f33fb9
|
[] |
no_license
|
hjz-z0/StudentMangeSystem
|
072015fc634381bb4d9590f46c263ab52fa8658f
|
80a96b6917b39dcac3eedd986e7b9c773defbd2f
|
refs/heads/master
| 2022-06-19T00:49:11.483257 | 2020-05-05T15:02:58 | 2020-05-05T15:02:58 | 261,504,805 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 10,321 |
java
|
package com.zte.sms.action;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.zte.sms.constant.Constant;
import com.zte.sms.entity.Course;
import com.zte.sms.entity.Grade;
import com.zte.sms.entity.Student;
import com.zte.sms.entity.vo.PageInfo;
import com.zte.sms.entity.vo.StudentVO;
import com.zte.sms.exception.StudentImportException;
import com.zte.sms.exception.StudentUsernameExistException;
import com.zte.sms.factory.ObjectFactory;
import com.zte.sms.service.CourseService;
import com.zte.sms.service.GradeService;
import com.zte.sms.service.StudentService;
import com.zte.sms.util.ExcelUtil;
public class StudentAction {
public String findStudents(HttpServletRequest req, HttpServletResponse resp) {
// ่ทๅ่ฎฐๅฝ
StudentService studentProxy = (StudentService) ObjectFactory.getObject("studentProxy");
List<Student> studnets = studentProxy.findStudentByPage();
req.setAttribute("students", studnets);
// ่ฟๅadminMain.jsp
return "adminMain";
}
public String toModifyStudentInfo(HttpServletRequest req, HttpServletResponse resp) {
String username = req.getParameter("username");
StudentService studentProxy = (StudentService) ObjectFactory.getObject("studentProxy");
Student student = studentProxy.findByName(username);
int sid = student.getSid();
Student student1 = studentProxy.findById(sid);
req.setAttribute("student",student1);
return "modifyStudentInfo";
}
public String modifyMyInfo(HttpServletRequest req, HttpServletResponse resp){
StudentService studentProxy = (StudentService) ObjectFactory.getObject("studentProxy");
String username = req.getParameter("username");
String name = req.getParameter("name");
String sex = req.getParameter("sex");
String age = req.getParameter("age");
int gender = 0;
if ("female".equals(sex)){
gender = 1;
}else {
gender = 0;
}
Student student = studentProxy.findByName(username);
student.setName(name);
student.setAge(Integer.parseInt(age));
student.setGender(gender);
studentProxy.modifyMyInfo(student);
req.setAttribute("msg","ๆดๆฐไธชไบบไฟกๆฏๆๅ๏ผ");
return "successModify";
}
public void findStudentsByPage(HttpServletRequest req, HttpServletResponse resp) throws IOException {
// ่ทๅ่ฎฐๅฝ
StudentService studentProxy = (StudentService) ObjectFactory.getObject("studentProxy");
String pageNoStr = req.getParameter("pageNo");
String pageSizeStr = req.getParameter("pageSize");
int pageNo = 0;
int pageSize = 0;
if (pageNoStr == null) {
pageNo = Constant.PAGE_NO;
} else {
pageNo = Integer.parseInt(pageNoStr);
}
if (pageSizeStr == null) {
pageSize = Constant.PAGE_SIZE;
} else {
pageSize = Integer.parseInt(pageSizeStr);
}
PageHelper.startPage(pageNo, pageSize);
List<Student> students = studentProxy.findStudentByPage();
PageInfo<Student> pageInfo = new PageInfo<Student>(students);
resp.setContentType(Constant.CONTENT_TYPE);
resp.getWriter().print(JSON.toJSON(pageInfo));
}
// ๆพ็คบๅญฆ็็ฎก็้กต้ข
public String toStudentManager(HttpServletRequest req, HttpServletResponse resp) {
// ่ทๅ้กต้ขไธญ็ไธๆๅ่กจๅผ
GradeService gradeProxy = (GradeService) ObjectFactory.getObject("gradeProxy");
CourseService courseProxy = (CourseService) ObjectFactory.getObject("courseProxy");
List<Grade> gradeList = gradeProxy.findAll();
List<Course> courseList = courseProxy.findAll();
req.setAttribute("gradeList", gradeList);
req.setAttribute("courseList", courseList);
// ๆพ็คบๆทปๅ ๅญฆ็้กต้ข
return "toStudentManager";
}
// ๆ ก้ช็จๆทๅๆฏๅฆๅทฒ็ปๅญๅจ
public void findByUsername(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.setContentType(Constant.CONTENT_TYPE);
String username = req.getParameter("username");
StudentService studentProxy = (StudentService) ObjectFactory.getObject("studentProxy");
Map<String, Object> map = new HashMap<String, Object>();
try {
Student student = studentProxy.findByUsername(username);
map.put("valid", true);// ่ฎพ็ฝฎvalidๅฑๆง๏ผๅจfalseๆถ๏ผ่พๅบmessageๆๅฏนๅบ็ๅผ
} catch (StudentUsernameExistException e) {
// TODO: handle exception
map.put("valid", false);
map.put("message", e.getMessage());
}
// ่ฟๅ2ไธชๅผ๏ผmessage,ๆฏๅฆ่พๅบ่พๅบ่ฏฅๆถๆฏ๏ผvalid
resp.getWriter().print(JSON.toJSON(map));
}
// ๆฐๅขๅญฆๅ
public String addStudent(HttpServletRequest req, HttpServletResponse resp) {
// ่ทๅ่กจๅไธญๆไบค่ฟๆฅ็ๅผ
String username = req.getParameter("username");
String password = req.getParameter("password");
String name = req.getParameter("name");
int age = Integer.parseInt(req.getParameter("age"));
int gender = Integer.parseInt(req.getParameter("gender"));
int gid = Integer.parseInt(req.getParameter("gid"));
int cid = Integer.parseInt(req.getParameter("cid"));
// ่ฐ็จproxy
StudentService studentProxy = (StudentService) ObjectFactory.getObject("studentProxy");
Student student = new Student(null, username, password, name, gender, age, gid, cid);
studentProxy.addStudent(student);
req.setAttribute("msg", "ๆทปๅ ๅญฆ็ๆๅ");
// ่ฟๅๅญฆ็็ฎก็ไธป้กต้ข
return "toStudentManager";
}
// ๆพ็คบไฟฎๆนๅญฆๅ้กต้ข
public void findById(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.setContentType(Constant.CONTENT_TYPE);
// ่ฐ็จproxy
StudentService studentProxy = (StudentService) ObjectFactory.getObject("studentProxy");
int sid = Integer.parseInt(req.getParameter("sid"));
Student student = studentProxy.findById(sid);
resp.getWriter().print(JSON.toJSON(student));
}
// ไฟฎๆนๅญฆๅ
public String modifyStudent(HttpServletRequest req, HttpServletResponse resp) {
// ่ทๅ่กจๅไธญๆไบค่ฟๆฅ็ๅผ
String username = req.getParameter("gusername");
String name = req.getParameter("name");
int sid = Integer.parseInt(req.getParameter("sid"));
int age = Integer.parseInt(req.getParameter("age"));
int gender = Integer.parseInt(req.getParameter("gender"));
int gid = Integer.parseInt(req.getParameter("gid"));
int cid = Integer.parseInt(req.getParameter("cid"));
// ่ฐ็จproxy
StudentService studentProxy = (StudentService) ObjectFactory.getObject("studentProxy");
Student student = new Student(sid, username, null, name, gender, age, gid, cid);
studentProxy.modifyStudent(student);
req.setAttribute("msg", "ไฟฎๆนๅญฆ็ๆๅ");
// ่ฟๅๅญฆๅๅ่กจ้กต้ข
return "toStudentManager";
}
// ๅ ้คๅญฆๅ
public String deleteStudent(HttpServletRequest req, HttpServletResponse resp) {
int sid = Integer.parseInt(req.getParameter("sid"));
StudentService studentProxy = (StudentService) ObjectFactory.getObject("studentProxy");
try {
studentProxy.removeById(sid);
req.setAttribute("msg", "ๅ ้คๆๅ");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
req.setAttribute("msg", "ๅ ้คๅคฑ่ดฅ");
}
// ่ฟๅๅญฆๅๅ่กจ้กต้ข
return "toStudentManager";
}
// ๅฏผๅบexcel
// ไธ้่ฆ่ฟๅๅผ
public void exportExcel(HttpServletRequest req, HttpServletResponse resp) throws IOException {
// ่ฎพ็ฝฎๅๅบ็ฑปๅ
resp.setContentType("application/x-excel");
// ่ฎพ็ฝฎๅค็ๆนๅผไธบ้ไปถ
resp.setHeader("content-disposition", "attachment;filename=students1.xls");
StudentService studentProxy = (StudentService) ObjectFactory.getObject("studentProxy");
List<Student> students = studentProxy.findStudentByPage();
// ๅฐ่ฎฐๅฝ่พๅบๅฐๅฏนๅบ็xls,้่ฟๆต่งๅจไธ่ฝฝ
ExcelUtil.exportStudent(students, resp.getOutputStream());
}
// ๅฏผๅบๆฐๆฎๅฐๆฐๆฎๅบ
public String importExcel(HttpServletRequest req, HttpServletResponse resp) {
String fileName = "student.xls";
File file = new File("d:/students.xls");
StudentService studentProxy = (StudentService) ObjectFactory.getObject("studentProxy");
try {
studentProxy.importExcel(fileName, file);
req.setAttribute("msg", "ๅฏผๅ
ฅๆๅ");
} catch (StudentImportException e) {
// TODO Auto-generated catch block
e.printStackTrace();
req.setAttribute("msg", e.getMessage());
}
// ่ฟๅๅญฆๅๅ่กจ้กต้ข
return "toStudentManager";
}
// ๆๆกไปถๆฅ่ฏข
public void findByCondition(HttpServletRequest req, HttpServletResponse resp) throws IOException {
// ่ทๅ่ฎฐๅฝ
StudentService studentProxy = (StudentService) ObjectFactory.getObject("studentProxy");
String pageNoStr = req.getParameter("pageNo");
String pageSizeStr = req.getParameter("pageSize");
int pageNo = 0;
int pageSize = 0;
if (pageNoStr == null) {
pageNo = Constant.PAGE_NO;
} else {
pageNo = Integer.parseInt(pageNoStr);
}
if (pageSizeStr == null) {
pageSize = Constant.PAGE_SIZE;
} else {
pageSize = Integer.parseInt(pageSizeStr);
}
String name = req.getParameter("name");
String minAge = req.getParameter("minAge");
String maxAge = req.getParameter("maxAge");
String gender = req.getParameter("gender");
String gid = req.getParameter("gid");
String cid = req.getParameter("cid");
//ๅฐไธ่ฟฐๅผ็ป่ฃ
ๆVO
StudentVO queryVO = new StudentVO();
if(!"".equals(name)){
queryVO.setName("%"+name+"%");
}
if(!"".equals(minAge)){
queryVO.setMinAge(Integer.parseInt(minAge));
}
if(!"".equals(maxAge)){
queryVO.setMaxAge(Integer.parseInt(maxAge));
}
if(!"all".equals(gender)){
queryVO.setGender(Integer.parseInt(gender));
}
if(!"all".equals(gid)){
queryVO.setGid(Integer.parseInt(gid));
}
if(!"all".equals(cid)){
queryVO.setCid(Integer.parseInt(cid));
}
PageHelper.startPage(pageNo, pageSize);
List<Student> students=null;
if("".equals(name)&&"".equals(minAge)&&"".equals(maxAge)&&"all".equals(gender)&&"all".equals(gid)&&"all".equals(cid)){
students = studentProxy.findStudentByPage();
}
else{
students = studentProxy.findStudentByCondition(queryVO);
}
PageInfo<Student> pageInfo = new PageInfo<Student>(students);
resp.setContentType(Constant.CONTENT_TYPE);
resp.getWriter().print(JSON.toJSON(pageInfo));
}
}
|
[
"[email protected]"
] | |
04d8aa224ed6e1c1ff3b3de254eb909002e23959
|
ab30df4b1585692472d32a9cbcf6c8ae107dc9a7
|
/generated-test-cases/Optimization/19-run/Evosuite_Optimization_ESTest.java
|
36bff7eb31cd16ec3372903018d77be8ae5b71ee
|
[
"Apache-2.0"
] |
permissive
|
fpalomba/issta16-test-code-quality-matters
|
8d87b51ce1ca8305cf9ff67b2eb71899cbfb7d46
|
b18697fb7f3ed77a8875d39c6b81a1afa82d7245
|
refs/heads/master
| 2020-12-24T21:27:40.669676 | 2016-04-22T21:38:36 | 2016-04-22T21:38:36 | 56,882,946 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,022 |
java
|
/*
* This file was automatically generated by EvoSuite
* Fri Dec 18 21:32:23 GMT 2015
*/
package weka.core;
import static org.junit.Assert.*;
import org.junit.Test;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.testdata.EvoSuiteFile;
import org.evosuite.runtime.testdata.EvoSuiteLocalAddress;
import org.evosuite.runtime.testdata.EvoSuiteRemoteAddress;
import org.evosuite.runtime.testdata.EvoSuiteURL;
import org.junit.runner.RunWith;
import weka.core.Optimization;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true)
public class Optimization_ESTest extends Optimization_ESTest_scaffolding {
//Test case number: 0
/*
* 8 covered goals:
* Goal 1. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I187 Branch 192 IFEQ L1136 - true
* Goal 2. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I203 Branch 193 IFLT L1138 - false
* Goal 3. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I223 Branch 194 IFLT L1141 - true
* Goal 4. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I223 Branch 194 IFLT L1141 - false
* Goal 5. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I232 Branch 195 IFNE L1142 - true
* Goal 6. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I232 Branch 195 IFNE L1142 - false
* Goal 7. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I251 Branch 196 IF_ICMPGE L1144 - true
* Goal 8. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I251 Branch 196 IF_ICMPGE L1144 - false
*/
@Test
public void test0() throws Throwable {
weka.core.matrix.Matrix matrix0 = new weka.core.matrix.Matrix(620, 620);
double[] doubleArray0 = new double[6];
boolean[] booleanArray0 = new boolean[12];
booleanArray0[0] = true;
double[] doubleArray1 = Optimization.solveTriangle(matrix0, doubleArray0, false, booleanArray0);
assertArrayEquals(new double[] {0.0, Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN}, doubleArray1, 0.01);
}
//Test case number: 1
/*
* 5 covered goals:
* Goal 1. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I28 Branch 184 IFEQ L1115 - true
* Goal 2. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I180 Branch 191 IFLT L1136 - true
* Goal 3. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I180 Branch 191 IFLT L1136 - false
* Goal 4. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I187 Branch 192 IFEQ L1136 - false
* Goal 5. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I203 Branch 193 IFLT L1138 - true
*/
@Test
public void test1() throws Throwable {
double[] doubleArray0 = new double[1];
boolean[] booleanArray0 = new boolean[9];
booleanArray0[0] = true;
double[] doubleArray1 = Optimization.solveTriangle((weka.core.matrix.Matrix) null, doubleArray0, false, booleanArray0);
assertArrayEquals(new double[] {0.0}, doubleArray1, 0.01);
}
//Test case number: 2
/*
* 8 covered goals:
* Goal 1. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I47 Branch 186 IFEQ L1117 - true
* Goal 2. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I64 Branch 187 IF_ICMPGE L1119 - false
* Goal 3. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I85 Branch 188 IF_ICMPGE L1122 - true
* Goal 4. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I85 Branch 188 IF_ICMPGE L1122 - false
* Goal 5. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I94 Branch 189 IFNE L1123 - true
* Goal 6. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I94 Branch 189 IFNE L1123 - false
* Goal 7. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I111 Branch 190 IF_ICMPGE L1125 - true
* Goal 8. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I111 Branch 190 IF_ICMPGE L1125 - false
*/
@Test
public void test2() throws Throwable {
double[][] doubleArray0 = new double[15][8];
weka.core.matrix.Matrix matrix0 = new weka.core.matrix.Matrix(doubleArray0, (-27), (-27));
boolean[] booleanArray0 = new boolean[17];
booleanArray0[2] = true;
double[] doubleArray1 = Optimization.solveTriangle(matrix0, doubleArray0[6], true, booleanArray0);
assertArrayEquals(new double[] {Double.NaN, Double.NaN, 0.0, Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN}, doubleArray1, 0.01);
}
//Test case number: 3
/*
* 6 covered goals:
* Goal 1. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I16 Branch 183 IFNONNULL L1112 - true
* Goal 2. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I28 Branch 184 IFEQ L1115 - false
* Goal 3. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I40 Branch 185 IF_ICMPGE L1117 - true
* Goal 4. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I40 Branch 185 IF_ICMPGE L1117 - false
* Goal 5. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I47 Branch 186 IFEQ L1117 - false
* Goal 6. weka.core.Optimization.solveTriangle(Lweka/core/matrix/Matrix;[DZ[Z)[D: I64 Branch 187 IF_ICMPGE L1119 - true
*/
@Test
public void test3() throws Throwable {
double[] doubleArray0 = new double[1];
boolean[] booleanArray0 = new boolean[16];
booleanArray0[0] = true;
double[] doubleArray1 = Optimization.solveTriangle((weka.core.matrix.Matrix) null, doubleArray0, true, booleanArray0);
assertArrayEquals(new double[] {0.0}, doubleArray1, 0.01);
}
}
|
[
"[email protected]"
] | |
37ddf1edc5faab7c64f0aba6961163bb16ae9d29
|
bb097f23913615f7d2f58ce60b781d271e423652
|
/vizmap-gui-core-impl/src/main/java/org/cytoscape/view/vizmap/gui/core/internal/CyActivator.java
|
262db7ef108a3f0a0d831c02be51114c0b76a5a9
|
[] |
no_license
|
ashishtiwarigsoc/cytoscape-impl
|
2f52af2f1eac6df914314c0855e3622494caff72
|
a1e477c958c575fa503470cae5b57b135982df29
|
refs/heads/develop
| 2021-01-18T09:51:15.887416 | 2016-05-06T00:25:02 | 2016-05-06T00:25:02 | 58,349,821 | 0 | 1 | null | 2016-05-09T05:08:50 | 2016-05-09T05:08:50 | null |
UTF-8
|
Java
| false | false | 1,623 |
java
|
package org.cytoscape.view.vizmap.gui.core.internal;
/*
* #%L
* Cytoscape VizMap GUI Core Impl (vizmap-gui-core-impl)
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2006 - 2013 The Cytoscape Consortium
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 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 Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.Properties;
import org.cytoscape.service.util.AbstractCyActivator;
import org.cytoscape.view.vizmap.gui.core.internal.cellrenderer.ContinuousMappingCellRendererFactoryImpl;
import org.cytoscape.view.vizmap.gui.editor.ContinuousMappingCellRendererFactory;
import org.osgi.framework.BundleContext;
public class CyActivator extends AbstractCyActivator {
@Override
public void start(BundleContext context) throws Exception {
ContinuousMappingCellRendererFactory continuousMappingCellRendererFactoryImpl = new ContinuousMappingCellRendererFactoryImpl();
registerService(context, continuousMappingCellRendererFactoryImpl, ContinuousMappingCellRendererFactory.class, new Properties());
}
}
|
[
"jm@0ecc0d97-ab19-0410-9704-bfe1a75892f5"
] |
jm@0ecc0d97-ab19-0410-9704-bfe1a75892f5
|
6d64a93b0278d7cc8e4e1c4ecc68fa59e6565944
|
2dbbb7ff2a3f12523f5970288b5ab2eedf18bc13
|
/testp2Scheduler/src/main/java/testp2/app/config/WebConfigExtended.java
|
ad940abce76c0e5030546de54894622f2bf0f293
|
[] |
no_license
|
applifireAlgo/DefaultRepo
|
6582660a37c2c5f47cc9df2838fdacf21eb8693a
|
38ed513a1b33ed842be655b77d6c2b151d83d3e8
|
refs/heads/master
| 2020-12-22T02:49:43.475101 | 2016-06-03T13:29:34 | 2016-06-03T13:29:34 | 42,858,818 | 0 | 1 | null | 2016-03-10T18:11:36 | 2015-09-21T10:10:13 | null |
UTF-8
|
Java
| false | false | 555 |
java
|
package testp2.app.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import com.athena.config.server.WebConfig;
/**
*
*
* @author Anant
*
*/
@Configuration
@EnableTransactionManagement
@EnableAsync
@ComponentScan(basePackages = { "com.athena", "com.spartan", "testp2.app" })
public class WebConfigExtended extends WebConfig {
}
|
[
"sagarjadhav@sagarjadhav-desktop"
] |
sagarjadhav@sagarjadhav-desktop
|
435d4ff0d576b91e70334f5c10cba3c802b4cfda
|
a5959a2922f4078e7f3946552337fb2fbc86616a
|
/service/service-order/src/main/java/com/atguigu/gmall/order/ServiceOrderApplication.java
|
54bdabc8f2ab4417b1bebd0b9b22c549cc627905
|
[] |
no_license
|
sengeiou/gmall0316
|
7dda7d1736efdafa2c45d773b60ea8bb3936fd07
|
946c110a085d5908c8154714f30e5e87d500ced6
|
refs/heads/master
| 2022-12-31T06:16:28.294884 | 2020-10-21T13:00:41 | 2020-10-21T13:00:41 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 652 |
java
|
package com.atguigu.gmall.order;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients(basePackages = {"com.atguigu.gmall"})
@ComponentScan("com.atguigu.gmall")
public class ServiceOrderApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceOrderApplication.class, args);
}
}
|
[
"[email protected]"
] | |
5cdec7b008b039c716e289d7832b87ec2784ae3c
|
0629065480dd5d5bc4c767d48a733d02cc79e3ff
|
/src/exercises/CountMovieSpaces.java
|
a00d67cecc2ad0308b6199ebe2ca698391e66811
|
[] |
no_license
|
CSA-Giles/ChapterSeven
|
7d635baefb47f6926051b880798e569008f1c619
|
74a36ff7182012d9319e887b6bbbb90b40be5903
|
refs/heads/master
| 2020-12-29T22:41:33.734529 | 2020-02-11T16:05:00 | 2020-02-11T16:05:00 | 238,759,688 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 547 |
java
|
package exercises;
import java.util.Scanner;
public class CountMovieSpaces {
public static void main(String[] args){
String movieQuote;
Scanner input = new Scanner(System.in);
int spaces = 0;
System.out.print("Enter your favorite movie quote >>> ");
movieQuote = input.nextLine();
for(int i = 0; i < movieQuote.length(); ++i){
if(movieQuote.charAt(i) == ' '){
++spaces;
}
}
System.out.println("Amount of spaces: " + spaces);
}
}
|
[
"[email protected]"
] | |
49cf455e725808e30640a6aae8d96baf7a2eeea0
|
8de7891a3ab36567957aa537795b5c1fc40c69c6
|
/concrete-pom/concrete-test/src/main/java/org/coodex/concrete/test/ConcreteTokenProvider.java
|
4547422618c90a254464bddc882d3cc64a8fd4e9
|
[
"Apache-2.0"
] |
permissive
|
coodex2016/concrete.coodex.org
|
a09ae70f5fee21c045d83c1495915c0aba22f8ce
|
d4ff2fdcafba4a8a426b6ceb79b086c931147525
|
refs/heads/0.5.x
| 2023-08-04T04:37:51.116386 | 2023-07-13T05:48:51 | 2023-07-13T05:48:51 | 85,026,857 | 23 | 10 |
NOASSERTION
| 2023-02-22T00:09:24 | 2017-03-15T03:52:33 |
Java
|
UTF-8
|
Java
| false | false | 1,851 |
java
|
/*
* Copyright (c) 2018 coodex.org ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.coodex.concrete.test;
import org.coodex.concrete.common.Token;
import org.coodex.concrete.core.token.TokenWrapper;
import org.junit.runner.Description;
//import java.util.HashMap;
//import java.util.Map;
/**
* Created by davidoff shen on 2016-09-06.
*/
public class ConcreteTokenProvider {
// private final static Logger log = LoggerFactory.getLogger(ConcreteTokenProvider.class);
// private final static TokenManager TOKEN_MANAGER_INSTANCE = getInstance();
// private static TokenManager getInstance() {
// try {
// return BeanServiceLoaderProvider.getBeanProvider().getBean(TokenManager.class);
// } catch (ConcreteException ex) {
// log.warn("error occurred: {}. Using LocalTokenManager", ex.getLocalizedMessage());
// return new LocalTokenManager();
// }
// }
// public static Token getToken(String id) {
// return TOKEN_MANAGER_INSTANCE.getToken(Common.isBlank(id) ? Common.getUUIDStr() : id, true);
// }
public static Token getToken(Description description) {
TokenID testToken = description.getAnnotation(TokenID.class);
return TokenWrapper.getToken(testToken == null ? null : testToken.value());
}
}
|
[
"[email protected]"
] | |
b6d92dd4f0feeb5aa5c44c2ec29911eb5f51ed68
|
0e56cc6c31ee011d276264ff545e2409f9939e54
|
/app/src/main/java/library/wlt/com/aleaf/PickerViewActivity.java
|
ced0e34007e579ffb158899db74cdfaa503f7965
|
[] |
no_license
|
qingfengwlt/aleaf
|
861a2652666ab27d4f6339f28aeb9c895279e349
|
41eb004a3f5de77442faf974a051a583ab7eaf5d
|
refs/heads/master
| 2020-04-05T10:21:37.262055 | 2018-11-09T02:03:41 | 2018-11-09T02:03:41 | 156,795,806 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,271 |
java
|
package library.wlt.com.aleaf;
import android.os.Build;
import android.widget.Toast;
import com.contrarywind.listener.OnItemSelectedListener;
import com.contrarywind.view.WheelView;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
public class PickerViewActivity extends BaseAppCompatActivity {
@BindView(R.id.wv)
WheelView wheelView;
@Override
protected int resLayoutId() {
return R.layout.activity_picker_view;
}
@Override
protected void initUI() {
wheelView.setCyclic(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
wheelView.setTooltipText("sss");
}
final List<String> mOptionsItems = new ArrayList<>();
mOptionsItems.add("item0");
mOptionsItems.add("item1");
mOptionsItems.add("item2");
wheelView.setAdapter(new ArrayWheelAdapter(mOptionsItems));
wheelView.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(int index) {
Toast.makeText(PickerViewActivity.this, "" + mOptionsItems.get(index), Toast.LENGTH_SHORT).show();
}
});
}
@Override
protected void initData() {
}
}
|
[
"[email protected]"
] | |
01ebb60acb66fa6eb9a710b5d6a0e92e00de66ba
|
11f16ec3788483e76dfab6a3abb8276fddf123ff
|
/GOP/GranuleJIDE/mytest/DirtyTree20/src/gTree20X7.java
|
3e25a0076aee1c9f857b9c2a783f2eec1c11978b
|
[] |
no_license
|
su657708481/-
|
35290bc95ae28fc24491f3e77ead85aafca46838
|
0393852a621610069f0080c123557790e73669d8
|
refs/heads/master
| 2021-06-30T11:48:33.029700 | 2020-12-12T12:09:49 | 2020-12-12T12:09:49 | 193,850,849 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 170 |
java
|
granule gTree20X7(Tree20X7) {
external int v20X7;
{
return v20X7 == 0;
}
}
class Tree20X7 within gTree20X7 {
public int get7() { return 200; }
}
|
[
"[email protected]"
] | |
ede9b5952ad531332b34fb064de722e96a492f58
|
5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1
|
/Code Snippet Repository/Spring/Spring3918.java
|
3dde9855844cca2b9bd9ac65843ae45830e215c1
|
[] |
no_license
|
saber13812002/DeepCRM
|
3336a244d4852a364800af3181e03e868cf6f9f5
|
be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9
|
refs/heads/master
| 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 663 |
java
|
@Test
public void testSpecificHourSecond() throws Exception {
CronTrigger trigger = new CronTrigger("55 * 10 * * *", timeZone);
calendar.set(Calendar.HOUR_OF_DAY, 9);
calendar.set(Calendar.SECOND, 54);
Date date = calendar.getTime();
TriggerContext context1 = getTriggerContext(date);
calendar.add(Calendar.HOUR_OF_DAY, 1);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 55);
assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context1));
calendar.add(Calendar.MINUTE, 1);
TriggerContext context2 = getTriggerContext(date);
assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context2));
}
|
[
"[email protected]"
] | |
dc97fca167bc790ceeef0d33f71c5d0719bc338b
|
ac1768b715e9fe56be8b340bc1e4bc7f917c094a
|
/ant_tasks/tags/release/11.02.x/11.02.0/common/source/java/ch/systemsx/cisd/common/utilities/AnnotationUtils.java
|
e503b8b3ddea9c5cc78293bd8402d8a6998244dd
|
[
"Apache-2.0"
] |
permissive
|
kykrueger/openbis
|
2c4d72cb4b150a2854df4edfef325f79ca429c94
|
1b589a9656d95e343a3747c86014fa6c9d299b8d
|
refs/heads/master
| 2023-05-11T23:03:57.567608 | 2021-05-21T11:54:58 | 2021-05-21T11:54:58 | 364,558,858 | 0 | 0 |
Apache-2.0
| 2021-06-04T10:08:32 | 2021-05-05T11:48:20 |
Java
|
UTF-8
|
Java
| false | false | 6,474 |
java
|
/*
* Copyright 2008 ETH Zuerich, CISD
*
* 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 ch.systemsx.cisd.common.utilities;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
/**
* General utility methods for working with annotations.
*
* @author Christian Ribeaud
*/
public final class AnnotationUtils
{
private AnnotationUtils()
{
// Can not be instantiated.
}
/**
* For given <code>Class</code> returns a list of methods that are annotated with given
* <var>annotationClass</var>.
*/
public final static List<Method> getAnnotatedMethodList(final Class<?> clazz,
final Class<? extends Annotation> annotationClass)
{
return AnnotationUtils.getAnnotatedMethodList(clazz, annotationClass, null);
}
/**
* For given <code>Class</code> returns a list of methods that are annotated with given
* <var>annotationClass</var>.
*
* @param methods if <code>null</code>, then a new <code>List</code> is created.
*/
private final static List<Method> getAnnotatedMethodList(final Class<?> clazz,
final Class<? extends Annotation> annotationClass, final List<Method> methods)
{
assert clazz != null : "Unspecified class.";
assert annotationClass != null : "Unspecified annotation class.";
List<Method> list = methods;
if (list == null)
{
list = new ArrayList<Method>();
}
for (final Method method : clazz.getDeclaredMethods())
{
if (method.getAnnotation(annotationClass) != null)
{
list.add(method);
}
}
final Class<?> superclass = clazz.getSuperclass();
if (superclass != null)
{
return getAnnotatedMethodList(superclass, annotationClass, list);
}
return list;
}
/**
* For given <code>Class</code> returns a list of fields that are annotated with given
* <var>annotationClass</var>.
*/
public final static List<Field> getAnnotatedFieldList(final Class<?> clazz,
final Class<? extends Annotation> annotationClass)
{
return AnnotationUtils.getAnnotatedFieldList(clazz, annotationClass, null);
}
/**
* For given <code>Class</code> returns a list of fields that are annotated with given
* <var>annotationClass</var>.
*
* @param fields if <code>null</code>, then a new <code>List</code> is created.
*/
private final static List<Field> getAnnotatedFieldList(final Class<?> clazz,
final Class<? extends Annotation> annotationClass, final List<Field> fields)
{
assert clazz != null : "Unspecified class.";
assert annotationClass != null : "Unspecified annotation class.";
List<Field> list = fields;
if (list == null)
{
list = new ArrayList<Field>();
}
for (final Field field : clazz.getDeclaredFields())
{
if (field.getAnnotation(annotationClass) != null)
{
list.add(field);
}
}
final Class<?> superclass = clazz.getSuperclass();
if (superclass != null)
{
return getAnnotatedFieldList(superclass, annotationClass, list);
}
return list;
}
/**
* From the list of given annotations tries to return the one of given type.
*
* @return <code>null</code> if not found.
*/
public final static <A extends Annotation> A tryGetAnnotation(final Annotation[] annotations,
final Class<A> annotationType)
{
assert annotations != null : "Unspecified annotations";
assert annotationType != null : "Unspecified annotation type";
for (final Annotation annotation : annotations)
{
if (annotation.annotationType().equals(annotationType))
{
return annotationType.cast(annotation);
}
}
return null;
}
/**
* Returns a list of method parameters where given <var>annotation</var> could be found.
*
* @return never <code>null</code> but could return an empty list.
*/
public final static <A extends Annotation> List<Parameter<A>> getAnnotatedParameters(
final Method method, final Class<A> annotationType)
{
assert method != null : "Unspecified method";
assert annotationType != null : "Unspecified annotation type";
final Annotation[][] annotations = method.getParameterAnnotations();
final Class<?>[] types = method.getParameterTypes();
final List<Parameter<A>> list = new ArrayList<Parameter<A>>();
for (int i = 0; i < types.length; i++)
{
final Class<?> type = types[i];
final A annotationOrNull = tryGetAnnotation(annotations[i], annotationType);
if (annotationOrNull != null)
{
list.add(new Parameter<A>(i, type, annotationOrNull));
}
}
return list;
}
//
// Helper classes
//
public final static class Parameter<A extends Annotation>
{
/**
* This parameter index in the list of method arguments.
*/
private final int index;
private final Class<?> type;
private final A annotation;
Parameter(final int index, final Class<?> type, final A annotation)
{
this.index = index;
this.type = type;
this.annotation = annotation;
}
public final int getIndex()
{
return index;
}
public final Class<?> getType()
{
return type;
}
public final A getAnnotation()
{
return annotation;
}
}
}
|
[
"fedoreno"
] |
fedoreno
|
16fa45e7964d085b19bf7a279f9218a1d0ac9465
|
b62a7b521d80668ff65a0952b019fed2978f4048
|
/src/com/programs/thread/MyThread.java
|
1722a4991c2128f0bfdbf6ed99b1e273a77b996c
|
[] |
no_license
|
azhakesan/java-programs
|
d8d5102d9c0102710258ebc9fd6ff573fbb59dfc
|
727c6623662b31c9164305ed6fef3af289a3d3b1
|
refs/heads/master
| 2020-03-09T04:40:02.307382 | 2018-08-11T21:17:33 | 2018-08-11T21:17:33 | 128,576,369 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 250 |
java
|
/**
*
*/
package com.programs.thread;
/**
*
*/
public class MyThread extends Thread {
public void run() {
System.out.println("---Inside My Thread---");
for (int i = 0; i < 10; i++) {
System.out.println("Child Thread =" + i);
}
}
}
|
[
"[email protected]"
] | |
f3ef017128dfea9c0cfd0a64300103b2de94e9a9
|
fc2cfa41616a61ec18ab5797ea6d8109a21b581d
|
/core/src/test/java/juzu/impl/template/spi/juzu/ast/TemplateBuilderTestCase.java
|
7ae38124ff05b6fb7eb3b42d1870b7a1132042bb
|
[] |
no_license
|
digideskio/juzu
|
3594c8e8bfe3eea873ef830c8a33284958abb535
|
1f0c1c2ca002b92401e1d8491587bec8c2bb1d73
|
refs/heads/master
| 2021-01-11T02:57:55.332824 | 2013-05-23T14:17:05 | 2013-05-23T14:17:05 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,789 |
java
|
/*
* Copyright 2013 eXo Platform SAS
*
* 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 juzu.impl.template.spi.juzu.ast;
import juzu.impl.common.Tools;
import juzu.impl.template.spi.juzu.dialect.gtmpl.GroovyTemplateStub;
import juzu.io.Streams;
import juzu.template.TemplateRenderContext;
import org.junit.Test;
import java.io.StringWriter;
import java.util.Collections;
/** @author <a href="mailto:[email protected]">Julien Viet</a> */
public class TemplateBuilderTestCase extends AbstractTemplateTestCase {
@Test
public void testFoo() throws Exception {
GroovyTemplateStub s = template("a<%=foo%>c");
s.init(Thread.currentThread().getContextClassLoader());
StringWriter out = new StringWriter();
new TemplateRenderContext(s, Collections.singletonMap("foo", "b")).render(Streams.closeable(Tools.UTF_8, out));
assertEquals("abc", out.toString());
}
@Test
public void testCarriageReturn() throws Exception {
GroovyTemplateStub s = template("a\r\nb");
s.init(Thread.currentThread().getContextClassLoader());
StringWriter out = new StringWriter();
new TemplateRenderContext(s, Collections.<String, Object>emptyMap()).render(Streams.closeable(Tools.UTF_8, out));
assertEquals("a\nb", out.toString());
}
}
|
[
"[email protected]"
] | |
5df7e351b44e12f786b5ef0682a46bdb9bb057d2
|
20024006213018977e621655d1e7a958aa6fee76
|
/app/src/main/java/com/nativeboys/eshop/models/MessageModel.java
|
ebe5a33068f491b62bcac0e8cdf02c6e8cf6218d
|
[] |
no_license
|
giannislvc/E-shop
|
f182ceb85ebc89c81ac1aa02e470f50c2d760c03
|
c2e1e61bb67d1d87b2d8e9707d40dca125e3faf4
|
refs/heads/master
| 2020-11-30T05:14:41.002322 | 2020-01-14T11:37:00 | 2020-01-14T11:37:00 | 230,313,513 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,902 |
java
|
package com.nativeboys.eshop.models;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.firebase.database.IgnoreExtraProperties;
@IgnoreExtraProperties
public class MessageModel {
private String id;
private String senderId;
private String text;
private long timestamp;
private int type; // text or image
public MessageModel() {
// Required empty
}
public MessageModel(String senderId, String text, long timestamp, int type) {
this.senderId = senderId;
this.text = text;
this.timestamp = timestamp;
this.type = type;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getSenderId() {
return senderId;
}
public void setSenderId(String senderId) {
this.senderId = senderId;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
@Override
public boolean equals(@Nullable Object obj) {
if (obj instanceof MessageModel) {
MessageModel msg = (MessageModel) obj;
return msg.getId().equals(id);
}
return false;
}
@NonNull
@Override
public String toString() {
return "MessageModel{" +
"id='" + id + '\'' +
", senderId='" + senderId + '\'' +
", text='" + text + '\'' +
", timestamp='" + timestamp + '\'' +
", type=" + type +
'}';
}
}
|
[
"[email protected]"
] | |
d95f26b3aa98f8a06b6a7d7d91724a596adf3ce7
|
269cb964e9446ae113c14f69e9b3eecc12be2523
|
/src/test/java/com/github/uuidcode/spring/test/context/SimpleContext2.java
|
784b1aaeb640f0d0eb86366c3338ad2a0c69bdc5
|
[] |
no_license
|
uuidcode/spring-test
|
533aec5031b1001bf1e1f629a36cf97a9ed5e664
|
2c9cecc7f1db1937137b309165a8d139ec05fe99
|
refs/heads/master
| 2021-04-30T09:02:34.314828 | 2018-05-27T12:02:02 | 2018-05-27T12:02:02 | 121,389,392 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 311 |
java
|
package com.github.uuidcode.spring.test.context;
import javax.sql.DataSource;
import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.context.annotation.Bean;
public class SimpleContext2 {
@Bean
public DataSource simpleDataSource() {
return new BasicDataSource();
}
}
|
[
"[email protected]"
] | |
63d0b417b0d8334b9e72093b8399ed12e6045e9f
|
1a5e30569cab0ed18e7d5b5a752084aed6971604
|
/AppiumWGHTest/WGHTest/src/main/java/com/example/wghtest/Level3/Thermometer/WDFnL3Thermometer.java
|
47f985c00416dec55e91308cde583e7355d9ebb0
|
[] |
no_license
|
LinKuanTing/AppiumTestWithAndroid
|
4e7c845d588b1df3a56f0ec2cf5509afbf559a97
|
31f7ba4c814bd2e9e92f4ed614ea2227e7cd4ffb
|
refs/heads/main
| 2023-06-12T09:22:07.361931 | 2021-06-16T02:49:33 | 2021-06-16T02:49:33 | 377,351,409 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,179 |
java
|
package com.example.wghtest.Level3.Thermometer;
import com.example.wghtest.Level3.WDFnBaseMeasureMenuItems;
import org.openqa.selenium.By;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.touch.offset.PointOption;
import static com.example.wghtest.WGHTestBase.adDriver;
public class WDFnL3Thermometer extends WDFnBaseMeasureMenuItems {
protected AndroidElement _btnSave;
protected AndroidElement _tvDataMean;
protected AndroidElement _lvType,_lvTempTen,_lvTempDigit,_lvTempPoint;
protected AndroidElement _etMemo;
protected static String _strBluetoothID = "tw.com.wgh3h:id/imageView_ble";
private String __strDataMeanID = "tw.com.wgh3h:id/ll_tips";
protected String _strTimeID = "tw.com.wgh3h:id/textView_record_time";
private String __strTypeID = "tw.com.wgh3h:id/wv_one";
private String __strTempTenID = "tw.com.wgh3h:id/wv_two";
private String __strTempDigitID = "tw.com.wgh3h:id/wv_three";
private String __strTempPointID = "tw.com.wgh3h:id/wv_four";
private String __strMemoID = "tw.com.wgh3h:id/editText_memo";
private String __strSaveID = "tw.com.wgh3h:id/action_btn_right";
protected String _strBLEMessageID = "android:id/message";
public WDFnL3Thermometer(){
super._strDateTimeID = this._strTimeID;
}
public void setValue() throws InterruptedException {
setTime();
this._lvType = (AndroidElement) adDriver.findElement(By.id(__strTypeID));
this._lvTempTen = (AndroidElement) adDriver.findElement(By.id(__strTempTenID));
this._lvTempDigit = (AndroidElement) adDriver.findElement(By.id(__strTempDigitID));
this._lvTempPoint = (AndroidElement) adDriver.findElement(By.id(__strTempPointID));
int Type_X = _lvType.getLocation().getX()+_lvType.getSize().getWidth()/2;
int Type_Y = _lvType.getLocation().getY()+_lvType.getSize().getHeight();
touchAction.press(PointOption.point(Type_X,Type_Y-1)).waitAction().moveTo(PointOption.point(Type_X,Type_Y-(int)(Math.random()*400-200) )).release().perform();
int TempTen_X = _lvTempTen.getLocation().getX()+_lvTempTen.getSize().getWidth()/2;
int TempTen_Y = _lvTempTen.getLocation().getY()+_lvTempTen.getSize().getHeight();
touchAction.press(PointOption.point(TempTen_X,TempTen_Y-1)).waitAction().moveTo(PointOption.point(TempTen_X,TempTen_Y-(int)(Math.random()*400-200) )).release().perform();
int TempDigit_X = _lvTempDigit.getLocation().getX()+_lvTempDigit.getSize().getWidth()/2;
int TempDigit_Y = _lvTempDigit.getLocation().getY()+_lvTempDigit.getSize().getHeight();
touchAction.press(PointOption.point(TempDigit_X,TempDigit_Y-1)).waitAction().moveTo(PointOption.point(TempDigit_X,TempDigit_Y-(int)(Math.random()*600-400) )).release().perform();
int TempPoint_X = _lvTempPoint.getLocation().getX()+_lvTempPoint.getSize().getWidth()/2;
int TempPoint_Y = _lvTempPoint.getLocation().getY()+_lvTempPoint.getSize().getHeight();
touchAction.press(PointOption.point(TempPoint_X,TempPoint_Y-1)).waitAction().moveTo(PointOption.point(TempPoint_X,TempPoint_Y-(int)(Math.random()*600-300) )).release().perform();
_etMemo = (AndroidElement) adDriver.findElement(By.id(__strMemoID));
if (_etMemo.getText().equals("Add Demo")){
_etMemo.clear();
_etMemo.setValue("Update Demo");
}else {
_etMemo.setValue("Add Demo");
}
clickSave();
try {
adDriver.findElement(By.id(_strButton1ID)).click();
}catch (Exception eNoFindElement){
//ๆฐๅข็ด้ๆ ๆ่ทณๅบ่จๆฏ้กฏ็คบๅฒๅญๆๅ
//ๆดๆฐ็ด้ๆ ไธๆ่ทณๅบ่จๆฏ
}
}
public void clickDataMean(){
this._tvDataMean = (AndroidElement) adDriver.findElement(By.id(this.__strDataMeanID));
_tvDataMean.click();
}
public void clickSave(){
this._btnSave = (AndroidElement) adDriver.findElement(By.id(__strSaveID));
_btnSave.click();
}
public void scanBle() {
clickBLE(_strBluetoothID);
}
}
|
[
"[email protected]"
] | |
e9b4c12764526c113f82cdcc2f267d50f74afe80
|
c885ef92397be9d54b87741f01557f61d3f794f3
|
/results/Lang-6/org.apache.commons.lang3.text.translate.CharSequenceTranslator/BBC-F0-opt-40/tests/27/org/apache/commons/lang3/text/translate/CharSequenceTranslator_ESTest.java
|
1768cd94983a58e3281c1105be1e48d6cb7f20de
|
[
"CC-BY-4.0",
"MIT"
] |
permissive
|
pderakhshanfar/EMSE-BBC-experiment
|
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
|
fea1a92c2e7ba7080b8529e2052259c9b697bbda
|
refs/heads/main
| 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null |
UTF-8
|
Java
| false | false | 13,949 |
java
|
/*
* This file was automatically generated by EvoSuite
* Sat Oct 23 08:29:10 GMT 2021
*/
package org.apache.commons.lang3.text.translate;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.io.StringWriter;
import java.io.Writer;
import java.nio.CharBuffer;
import org.apache.commons.lang3.text.translate.AggregateTranslator;
import org.apache.commons.lang3.text.translate.CharSequenceTranslator;
import org.apache.commons.lang3.text.translate.LookupTranslator;
import org.apache.commons.lang3.text.translate.NumericEntityEscaper;
import org.apache.commons.lang3.text.translate.NumericEntityUnescaper;
import org.apache.commons.lang3.text.translate.UnicodeEscaper;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class CharSequenceTranslator_ESTest extends CharSequenceTranslator_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
CharSequence[][] charSequenceArray0 = new CharSequence[0][7];
LookupTranslator lookupTranslator0 = new LookupTranslator(charSequenceArray0);
CharSequenceTranslator[] charSequenceTranslatorArray0 = new CharSequenceTranslator[0];
CharSequenceTranslator charSequenceTranslator0 = lookupTranslator0.with(charSequenceTranslatorArray0);
assertNotNull(charSequenceTranslator0);
}
@Test(timeout = 4000)
public void test01() throws Throwable {
NumericEntityEscaper numericEntityEscaper0 = NumericEntityEscaper.between(673, 673);
CharBuffer charBuffer0 = CharBuffer.allocate(673);
StringWriter stringWriter0 = new StringWriter();
int int0 = numericEntityEscaper0.translate((CharSequence) charBuffer0, 358, (Writer) stringWriter0);
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test02() throws Throwable {
NumericEntityEscaper numericEntityEscaper0 = new NumericEntityEscaper();
char[] charArray0 = new char[4];
CharBuffer charBuffer0 = CharBuffer.wrap(charArray0);
StringWriter stringWriter0 = new StringWriter();
int int0 = numericEntityEscaper0.translate((CharSequence) charBuffer0, 0, (Writer) stringWriter0);
assertEquals(1, int0);
}
@Test(timeout = 4000)
public void test03() throws Throwable {
NumericEntityEscaper numericEntityEscaper0 = NumericEntityEscaper.above(675);
CharBuffer charBuffer0 = CharBuffer.allocate(675);
charBuffer0.compact();
String string0 = numericEntityEscaper0.translate((CharSequence) charBuffer0);
assertEquals("", string0);
}
@Test(timeout = 4000)
public void test04() throws Throwable {
AggregateTranslator aggregateTranslator0 = new AggregateTranslator((CharSequenceTranslator[]) null);
StringWriter stringWriter0 = new StringWriter(49);
// Undeclared exception!
try {
aggregateTranslator0.translate((CharSequence) "31", (Writer) stringWriter0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.lang3.text.translate.AggregateTranslator", e);
}
}
@Test(timeout = 4000)
public void test05() throws Throwable {
NumericEntityEscaper numericEntityEscaper0 = NumericEntityEscaper.below(4005);
char[] charArray0 = new char[8];
CharBuffer charBuffer0 = CharBuffer.wrap(charArray0);
CharBuffer charBuffer1 = CharBuffer.wrap((CharSequence) charBuffer0);
charBuffer0.get(charArray0);
StringWriter stringWriter0 = new StringWriter(4005);
// Undeclared exception!
try {
numericEntityEscaper0.translate((CharSequence) charBuffer1, (Writer) stringWriter0);
fail("Expecting exception: IndexOutOfBoundsException");
} catch(IndexOutOfBoundsException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("java.nio.Buffer", e);
}
}
@Test(timeout = 4000)
public void test06() throws Throwable {
NumericEntityEscaper numericEntityEscaper0 = new NumericEntityEscaper();
StringWriter stringWriter0 = new StringWriter();
// Undeclared exception!
try {
numericEntityEscaper0.translate((CharSequence) "FFFFFFFF", (-1), (Writer) stringWriter0);
fail("Expecting exception: StringIndexOutOfBoundsException");
} catch(StringIndexOutOfBoundsException e) {
}
}
@Test(timeout = 4000)
public void test07() throws Throwable {
NumericEntityEscaper numericEntityEscaper0 = NumericEntityEscaper.below(92);
StringWriter stringWriter0 = new StringWriter(92);
// Undeclared exception!
try {
numericEntityEscaper0.translate((CharSequence) null, 38, (Writer) stringWriter0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("java.lang.Character", e);
}
}
@Test(timeout = 4000)
public void test08() throws Throwable {
char[] charArray0 = new char[6];
CharBuffer charBuffer0 = CharBuffer.wrap(charArray0);
StringWriter stringWriter0 = new StringWriter();
NumericEntityEscaper numericEntityEscaper0 = NumericEntityEscaper.between((-1671), (-1671));
// Undeclared exception!
try {
numericEntityEscaper0.translate((CharSequence) charBuffer0, (-1664), (Writer) stringWriter0);
fail("Expecting exception: IndexOutOfBoundsException");
} catch(IndexOutOfBoundsException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("java.nio.Buffer", e);
}
}
@Test(timeout = 4000)
public void test09() throws Throwable {
NumericEntityEscaper numericEntityEscaper0 = NumericEntityEscaper.below(92);
CharBuffer charBuffer0 = CharBuffer.allocate(5141);
// Undeclared exception!
numericEntityEscaper0.translate((CharSequence) charBuffer0);
}
@Test(timeout = 4000)
public void test10() throws Throwable {
AggregateTranslator aggregateTranslator0 = new AggregateTranslator((CharSequenceTranslator[]) null);
CharBuffer charBuffer0 = CharBuffer.allocate(1);
// Undeclared exception!
try {
aggregateTranslator0.translate((CharSequence) charBuffer0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.lang3.text.translate.AggregateTranslator", e);
}
}
@Test(timeout = 4000)
public void test11() throws Throwable {
NumericEntityEscaper numericEntityEscaper0 = NumericEntityEscaper.above(675);
CharBuffer charBuffer0 = CharBuffer.allocate(675);
CharBuffer charBuffer1 = CharBuffer.wrap((CharSequence) charBuffer0);
charBuffer0.compact();
// Undeclared exception!
try {
numericEntityEscaper0.translate((CharSequence) charBuffer1);
fail("Expecting exception: IndexOutOfBoundsException");
} catch(IndexOutOfBoundsException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("java.nio.Buffer", e);
}
}
@Test(timeout = 4000)
public void test12() throws Throwable {
CharSequenceTranslator[] charSequenceTranslatorArray0 = new CharSequenceTranslator[8];
NumericEntityEscaper numericEntityEscaper0 = NumericEntityEscaper.between(2315, 2475);
charSequenceTranslatorArray0[0] = (CharSequenceTranslator) numericEntityEscaper0;
UnicodeEscaper unicodeEscaper0 = UnicodeEscaper.between(2336, (-1530));
charSequenceTranslatorArray0[1] = (CharSequenceTranslator) unicodeEscaper0;
charSequenceTranslatorArray0[2] = (CharSequenceTranslator) numericEntityEscaper0;
NumericEntityUnescaper.OPTION[] numericEntityUnescaper_OPTIONArray0 = new NumericEntityUnescaper.OPTION[4];
NumericEntityUnescaper.OPTION numericEntityUnescaper_OPTION0 = NumericEntityUnescaper.OPTION.errorIfNoSemiColon;
numericEntityUnescaper_OPTIONArray0[0] = numericEntityUnescaper_OPTION0;
numericEntityUnescaper_OPTIONArray0[1] = numericEntityUnescaper_OPTIONArray0[0];
numericEntityUnescaper_OPTIONArray0[2] = numericEntityUnescaper_OPTIONArray0[1];
numericEntityUnescaper_OPTIONArray0[3] = numericEntityUnescaper_OPTION0;
NumericEntityUnescaper numericEntityUnescaper0 = new NumericEntityUnescaper(numericEntityUnescaper_OPTIONArray0);
charSequenceTranslatorArray0[3] = (CharSequenceTranslator) numericEntityUnescaper0;
charSequenceTranslatorArray0[4] = (CharSequenceTranslator) numericEntityUnescaper0;
CharSequence[][] charSequenceArray0 = new CharSequence[0][0];
LookupTranslator lookupTranslator0 = new LookupTranslator(charSequenceArray0);
charSequenceTranslatorArray0[5] = (CharSequenceTranslator) lookupTranslator0;
charSequenceTranslatorArray0[6] = (CharSequenceTranslator) numericEntityEscaper0;
charSequenceTranslatorArray0[7] = (CharSequenceTranslator) numericEntityEscaper0;
AggregateTranslator aggregateTranslator0 = new AggregateTranslator(charSequenceTranslatorArray0);
char[] charArray0 = new char[5];
charArray0[1] = '&';
charArray0[2] = '#';
CharBuffer charBuffer0 = CharBuffer.wrap(charArray0);
// Undeclared exception!
try {
aggregateTranslator0.translate((CharSequence) charBuffer0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Semi-colon required at end of numeric entity
//
verifyException("org.apache.commons.lang3.text.translate.NumericEntityUnescaper", e);
}
}
@Test(timeout = 4000)
public void test13() throws Throwable {
NumericEntityEscaper numericEntityEscaper0 = NumericEntityEscaper.below(2544);
CharBuffer charBuffer0 = CharBuffer.allocate(2544);
StringWriter stringWriter0 = new StringWriter();
numericEntityEscaper0.translate((CharSequence) charBuffer0, (Writer) stringWriter0);
assertTrue(charBuffer0.hasRemaining());
}
@Test(timeout = 4000)
public void test14() throws Throwable {
char[] charArray0 = new char[6];
CharBuffer charBuffer0 = CharBuffer.wrap(charArray0);
StringWriter stringWriter0 = new StringWriter();
NumericEntityEscaper numericEntityEscaper0 = NumericEntityEscaper.between((-1671), (-1671));
numericEntityEscaper0.translate((CharSequence) charBuffer0, (Writer) stringWriter0);
assertEquals("\u0000\u0000\u0000\u0000\u0000\u0000", stringWriter0.toString());
}
@Test(timeout = 4000)
public void test15() throws Throwable {
NumericEntityUnescaper.OPTION[] numericEntityUnescaper_OPTIONArray0 = new NumericEntityUnescaper.OPTION[1];
NumericEntityUnescaper.OPTION numericEntityUnescaper_OPTION0 = NumericEntityUnescaper.OPTION.semiColonRequired;
numericEntityUnescaper_OPTIONArray0[0] = numericEntityUnescaper_OPTION0;
NumericEntityUnescaper numericEntityUnescaper0 = new NumericEntityUnescaper(numericEntityUnescaper_OPTIONArray0);
StringWriter stringWriter0 = new StringWriter();
numericEntityUnescaper0.translate((CharSequence) null, (Writer) stringWriter0);
assertEquals("", stringWriter0.toString());
}
@Test(timeout = 4000)
public void test16() throws Throwable {
UnicodeEscaper unicodeEscaper0 = UnicodeEscaper.between((-2469), (-2469));
CharBuffer charBuffer0 = CharBuffer.allocate(1966);
// Undeclared exception!
try {
unicodeEscaper0.translate((CharSequence) charBuffer0, (Writer) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Writer must not be null
//
verifyException("org.apache.commons.lang3.text.translate.CharSequenceTranslator", e);
}
}
@Test(timeout = 4000)
public void test17() throws Throwable {
UnicodeEscaper unicodeEscaper0 = UnicodeEscaper.above(0);
String string0 = unicodeEscaper0.translate((CharSequence) null);
assertNull(string0);
}
@Test(timeout = 4000)
public void test18() throws Throwable {
NumericEntityEscaper numericEntityEscaper0 = NumericEntityEscaper.below((-557));
// Undeclared exception!
try {
numericEntityEscaper0.with((CharSequenceTranslator[]) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.lang3.text.translate.CharSequenceTranslator", e);
}
}
@Test(timeout = 4000)
public void test19() throws Throwable {
NumericEntityEscaper numericEntityEscaper0 = NumericEntityEscaper.below(2544);
CharBuffer charBuffer0 = CharBuffer.allocate(2544);
numericEntityEscaper0.translate((CharSequence) charBuffer0);
StringWriter stringWriter0 = new StringWriter();
// Undeclared exception!
numericEntityEscaper0.translate((CharSequence) charBuffer0, (Writer) stringWriter0);
}
@Test(timeout = 4000)
public void test20() throws Throwable {
String string0 = CharSequenceTranslator.hex(49);
assertEquals("31", string0);
}
}
|
[
"[email protected]"
] | |
802eabf7c1e20aa303526b3adba56375a1569902
|
4126689c8fafda1f4ddec19aacf824d394f98411
|
/BCBWeb/src/rmi/BrickCityBankClient.java
|
bd817d64d9822734ac94542a90f928eaa1f3182e
|
[] |
no_license
|
ralphtq/brickcitybank
|
f59fb36f1533e9288aea78183b8b6ab218b68f22
|
6f574f53a1fe8124ab21198f4547520266698eb5
|
refs/heads/master
| 2021-01-10T04:54:06.756907 | 2009-02-20T20:31:01 | 2009-02-20T20:31:01 | 45,216,442 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,406 |
java
|
/**
* BrickCityBankClient.java
*
* @author Louis Duke
*
* Unless otherwise noted the following code is the sole intellectual property of
* the author, all rights reserved.
*/
package rmi;
import java.rmi.*;
import java.sql.ResultSet;
import java.io.*;
import java.util.*;
/**
* @author Louis Duke
*/
public class BrickCityBankClient {
/**
* Main function of the Client
*
* @param args
*/
public static void main(String[] args) {
//Variables we will need
BCBRemoteServer myServ = null;
String uRespon = "no input";
BufferedReader in = new BufferedReader(new InputStreamReader( System.in ));
//try and look up the server.
try{
myServ = (BCBRemoteServer)Naming.lookup("rmi://localhost:1099/BCBServer");
}catch( Exception e ){
System.err.println( "Client Terminating - Server Lookup Failed: " +e.getMessage());
System.exit(1);
}
//prompt the user for the root password
System.out.println("");
System.out.println("Welcome to the Brick City Bank Client\n");
System.out.println("Please input your MySQL root password:");
System.out.println("");
//get user input
try{
uRespon = in.readLine();
}catch(IOException e){
System.err.println(e.getMessage());
}
//create database
try{
myServ.createDB(uRespon);
}catch(Exception e){
System.out.println("FAIL");
e.getMessage();
}
System.out.println("================Creating Database================");
System.out.println("");
try{
//Enter Actual server usage
myServ.setPass(uRespon);
myServ.establishConn();
System.out.println("Welcome to the Brick City Bank Demo\n");
System.out.println("Current State of the user table:");
ArrayList<String> al1 = new ArrayList<String>();
al1 = myServ.getAllUsers();
if(al1.get(0) == null)
{
System.out.println("Your MySQL password is incorrect. Please try again.\nExiting...");
System.exit(0);
}
for(int i = 0; i < al1.size(); i++)
{
System.out.print(al1.get(i));
}
System.out.println();
// Insert
myServ.setPass(uRespon);
myServ.establishConn();
System.out.println("Inserting \"Tom Smith\" with ID=5...");
myServ.insertRecord();
myServ.setPass(uRespon);
myServ.establishConn();
al1 = myServ.getAllUsers();
for(int i = 0; i < al1.size(); i++)
{
System.out.print(al1.get(i));
}
System.out.println("Done inserting!\n\n");
// Update
myServ.setPass(uRespon);
myServ.establishConn();
System.out.println("Updating first name of user with UID=1...");
myServ.updateRecord();
myServ.setPass(uRespon);
myServ.establishConn();
al1 = myServ.getAllUsers();
for(int i = 0; i < al1.size(); i++)
{
System.out.print(al1.get(i));
}
System.out.println("Done updating!\n\n");
// Delete
myServ.setPass(uRespon);
myServ.establishConn();
System.out.println("Deleting user with UID=2...");
myServ.dropRecord();
myServ.setPass(uRespon);
myServ.establishConn();
al1 = myServ.getAllUsers();
for(int i = 0; i < al1.size(); i++)
{
System.out.print(al1.get(i));
}
System.out.println("Done deleting!\n\nThis concludes Deliverable 2 =)\nPress the Enter key to exit...");
in.readLine();
}catch(Exception e){
System.err.println(e.getMessage());
}
}
}
|
[
"jeffreydmueller@77c099dc-cc87-11dd-a8b6-f5aca7b582bb"
] |
jeffreydmueller@77c099dc-cc87-11dd-a8b6-f5aca7b582bb
|
2d74e62b89b32c5f91c747b10a30711a1767b1cc
|
0083ba8e122c2e502beed0443f4c46aeca65dd19
|
/src/main/java/TwitterPreprocessing/HappyEmoticons.java
|
624505c76ba30f38dd5507dba57d9047396d7419
|
[
"MIT"
] |
permissive
|
iosifidisvasileios/Semi-Supervised-Learning
|
f2d3485a557e99b5052fb5da5ec105c9bf15a76d
|
d085f072904bce3ebb104b3e71dbad438ee0aa5e
|
refs/heads/master
| 2022-12-04T12:15:32.080002 | 2022-11-21T15:17:54 | 2022-11-21T15:17:54 | 156,223,340 | 0 | 1 |
MIT
| 2022-11-21T15:18:20 | 2018-11-05T13:36:22 |
Scala
|
UTF-8
|
Java
| false | false | 2,561 |
java
|
package TwitterPreprocessing;
import java.util.HashSet;
/**
* Created by iosifidis on 06.08.16.
*/
public class HappyEmoticons {
private HashSet<String> happyArray = new HashSet<>();
public HappyEmoticons() {
happyArray.add(":)");
happyArray.add(":D");
happyArray.add(";)");
happyArray.add(":-)");
happyArray.add(":P");
happyArray.add("=)");
happyArray.add("(:");
happyArray.add(";-)");
happyArray.add("XD");
happyArray.add("=D");
happyArray.add("=]");
happyArray.add(";D");
happyArray.add(":]");
happyArray.add(";D");
happyArray.add(":-D");
happyArray.add("^_^");
happyArray.add("8)");
happyArray.add("(8");
happyArray.add(":-P");
happyArray.add("(;");
happyArray.add(";P");
happyArray.add(";]");
happyArray.add("(=");
happyArray.add("[:");
happyArray.add("8D");
happyArray.add(":'โ)");
happyArray.add(":')");
happyArray.add(":*");
happyArray.add(":-*");
happyArray.add(":^*");
happyArray.add(">:P");
happyArray.add("XโP");
happyArray.add("xโp");
happyArray.add(":โp");
happyArray.add(":p");
happyArray.add("=p");
happyArray.add(":โร");
happyArray.add(":โb");
happyArray.add(":b");
happyArray.add("d:");
happyArray.add("<3");
happyArray.add("โค");
happyArray.add("๐ธ");
happyArray.add("๐ผ");
happyArray.add("๐ป");
happyArray.add("๐บ");
happyArray.add("๐น");
happyArray.add("๐ฒ");
happyArray.add("โบ๏ธ");
happyArray.add("๐ฝ");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐
");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
happyArray.add("๐");
}
public HashSet<String> getHappyArray() {
return happyArray;
}
}
|
[
"[email protected]"
] | |
d38f82587d3fb2f9e4671a6744d7ef63268a9d76
|
2508bff721138f274584782d360316ea1f5922bc
|
/src/main/java/com/zrf/rabbitmq/example/immutable/ImmuTableDemo2.java
|
affd6d3fdd09cf71ccee1b367577de6a45932d0c
|
[] |
no_license
|
ZZZrf123/rabbitdemo
|
f96a54cdd31aa39dc21415ae473dea2f1ec39342
|
0b4516d2f5106ae9b43bba5953df05c529395f96
|
refs/heads/master
| 2022-07-01T23:45:21.851903 | 2020-03-10T08:08:54 | 2020-03-10T08:08:54 | 246,239,249 | 0 | 0 | null | 2022-06-21T02:57:28 | 2020-03-10T07:52:14 |
Java
|
UTF-8
|
Java
| false | false | 540 |
java
|
package com.zrf.rabbitmq.example.immutable;
import com.google.common.collect.Maps;
import com.zrf.rabbitmq.annoations.NotThreadSafe;
import java.util.Collections;
import java.util.Map;
@NotThreadSafe
public class ImmuTableDemo2 {
private static Map<Integer,Integer> c = Maps.newHashMap();
static{
c.put(1,2);
c.put(3,4);
c.put(5,6);
c = Collections.unmodifiableMap(c);
}
public static void main(String[] args) {
c.put(1,3);
System.out.println("{}"+c.get(1));
}
}
|
[
"[email protected]"
] | |
08a82cf588d62671c19de45930947e4f9c530a43
|
1de00515cdeb79d606f97795491c95783010ab98
|
/app/src/main/java/com/nadillla/tesgithub/ui/slideshow/SlideshowViewModel.java
|
149b62f4fa2b790e1aa7b98ef0de9e26d8c75388
|
[] |
no_license
|
nadillachantika/tesgitbranch
|
c3ab47f8aa2c08f6d43d457a015b5433d6a97726
|
394945d61590832feafc9a97ee67f50945e24235
|
refs/heads/main
| 2023-04-08T20:25:30.515469 | 2021-04-24T03:26:31 | 2021-04-24T03:26:31 | 361,058,589 | 0 | 0 | null | 2021-04-24T03:26:32 | 2021-04-24T03:09:51 |
Java
|
UTF-8
|
Java
| false | false | 465 |
java
|
package com.nadillla.tesgithub.ui.slideshow;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class SlideshowViewModel extends ViewModel {
private MutableLiveData<String> mText;
public SlideshowViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is slideshow fragment");
}
public LiveData<String> getText() {
return mText;
}
}
|
[
"[email protected]"
] | |
e42c82026cbbc2144bb3f891d472914e4b7d8667
|
917c229f173164ec94fc134368e7bbc341ff8d8d
|
/ZDesk/src/com/zinglabs/work/GradeData.java
|
28b4927e1681b429ced2078cbd23390501b59494
|
[] |
no_license
|
JunHeGitHub/ITest
|
ef16283f54754bee766b963f2b9e1c0adf124a7c
|
d7d866a5033040a051284c3db8cfe2f744065312
|
refs/heads/master
| 2021-01-09T06:44:39.659251 | 2017-02-15T09:46:10 | 2017-02-15T09:46:10 | 81,161,881 | 1 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,635 |
java
|
package com.zinglabs.work;
import com.zinglabs.base.BaseForm;
public class GradeData extends BaseForm{
public String grade_id;
public int use_grade_index;
public String record_id;
public String grade_record_text;
public String grade_user;
public String grade_time;
public String grade_insert_time;
public int grade_status;
public String grade_status_text;
public int grade_step;
public int grade_flag;
public String caller_number;
public String record_begin_time;
public int record_length;
public String file_name;
public String file_location;
public String phone_number;
public String pfxDescription;
public String pfxParentId;
public float pfxMinVal;
public float pfxMaxVal;
public String business_type;
public String csr_id;
public String agent_user;
public String useGradeIndex;
public String useGradeIndexName;
public String grade_name;
public String grade_yipiaofoujue;
public String grade_important;
public String isMp3;
public String getIsMp3() {
return isMp3;
}
public void setIsMp3(String isMp3) {
this.isMp3 = isMp3;
}
public String getCsr_id() {
return csr_id;
}
public void setCsr_id(String csr_id) {
this.csr_id = csr_id;
}
public String getAgent_user() {
return agent_user;
}
public void setAgent_user(String agent_user) {
this.agent_user = agent_user;
}
public String getPfxDescription() {
return pfxDescription;
}
public void setPfxDescription(String pfxDescription) {
this.pfxDescription = pfxDescription;
}
public String getPfxParentId() {
return pfxParentId;
}
public void setPfxParentId(String pfxParentId) {
this.pfxParentId = pfxParentId;
}
public float getPfxMinVal() {
return pfxMinVal;
}
public void setPfxMinVal(float pfxMinVal) {
this.pfxMinVal = pfxMinVal;
}
public float getPfxMaxVal() {
return pfxMaxVal;
}
public void setPfxMaxVal(float pfxMaxVal) {
this.pfxMaxVal = pfxMaxVal;
}
public String getGrade_id() {
return grade_id;
}
public void setGrade_id(String grade_id) {
this.grade_id = grade_id;
}
public String getGrade_user() {
return grade_user;
}
public void setGrade_user(String grade_user) {
this.grade_user = grade_user;
}
public String getGrade_time() {
return grade_time;
}
public void setGrade_time(String grade_time) {
this.grade_time = grade_time;
}
public String getGrade_insert_time() {
return grade_insert_time;
}
public void setGrade_insert_time(String grade_insert_time) {
this.grade_insert_time = grade_insert_time;
}
public int getGrade_status() {
return grade_status;
}
public void setGrade_status(int grade_status) {
this.grade_status = grade_status;
}
public int getGrade_step() {
return grade_step;
}
public void setGrade_step(int grade_step) {
this.grade_step = grade_step;
}
public int getGrade_flag() {
return grade_flag;
}
public void setGrade_flag(int grade_flag) {
this.grade_flag = grade_flag;
}
public String getCaller_number() {
return caller_number;
}
public void setCaller_number(String caller_number) {
this.caller_number = caller_number;
}
public String getRecord_begin_time() {
return record_begin_time;
}
public void setRecord_begin_time(String record_begin_time) {
this.record_begin_time = record_begin_time;
}
public int getRecord_length() {
return record_length;
}
public void setRecord_length(int record_length) {
this.record_length = record_length;
}
public String getFile_name() {
return file_name;
}
public void setFile_name(String file_name) {
this.file_name = file_name;
}
public String getFile_location() {
return file_location;
}
public void setFile_location(String file_location) {
this.file_location = file_location;
}
public String getPhone_number() {
return phone_number;
}
public void setPhone_number(String phone_number) {
this.phone_number = phone_number;
}
public String getUseGradeIndex() {
return useGradeIndex;
}
public void setUseGradeIndex(String useGradeIndex) {
this.useGradeIndex = useGradeIndex;
}
public String getUseGradeIndexName() {
return useGradeIndexName;
}
public void setUseGradeIndexName(String useGradeIndexName) {
this.useGradeIndexName = useGradeIndexName;
}
public String getGrade_status_text() {
return grade_status_text;
}
public void setGrade_status_text(String grade_status_text) {
this.grade_status_text = grade_status_text;
}
public String getRecord_id() {
return record_id;
}
public void setRecord_id(String record_id) {
this.record_id = record_id;
}
public String getGrade_record_text() {
return grade_record_text;
}
public void setGrade_record_text(String grade_record_text) {
this.grade_record_text = grade_record_text;
}
public int getUse_grade_index() {
return use_grade_index;
}
public void setUse_grade_index(int use_grade_index) {
this.use_grade_index = use_grade_index;
}
public String getBusiness_type() {
return business_type;
}
public void setBusiness_type(String business_type) {
this.business_type = business_type;
}
public String getGrade_name() {
return grade_name;
}
public void setGrade_name(String grade_name) {
this.grade_name = grade_name;
}
public String getGrade_yipiaofoujue() {
return grade_yipiaofoujue;
}
public void setGrade_yipiaofoujue(String grade_yipiaofoujue) {
this.grade_yipiaofoujue = grade_yipiaofoujue;
}
public String getGrade_important() {
return grade_important;
}
public void setGrade_important(String grade_important) {
this.grade_important = grade_important;
}
}
|
[
"[email protected]"
] | |
4a3eb0e43fa502f9737d7ac265ae2ade23a65cc7
|
66801aed4edd95d1dfd418fad9f64194a2f4ab21
|
/MVCapitalProcess/src/mvcapital/entidade/Entidade.java
|
487a155f56ce835bb09518dedb06f8cc47ec1e97
|
[] |
no_license
|
smoisesr/fidc
|
7de156cf5ea18030c3c2ec08e5de273998bc88b6
|
e2de133b35a556d1eae329908f04e2f1a167309e
|
refs/heads/master
| 2021-01-02T09:34:14.156385 | 2015-07-01T16:42:11 | 2015-07-01T16:42:11 | 38,376,726 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 17,190 |
java
|
package mvcapital.entidade;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;
public class Entidade
{
// idEntidade
// Nome
// NomeCurto
// Cadastro
// DataDeInicio
// idSubclasseCNAE
// idGrupoEconomico
// idTipoCadastro
// Endereco
// Numero
// Complemento
// idCEP
// DataAtualizacao
private int idEntidade=0;
private String nome=""; //$NON-NLS-1$
private String nomeCurto=""; //$NON-NLS-1$
private String cadastro=""; //$NON-NLS-1$
private Date dataDeInicio=Calendar.getInstance().getTime();
private int idSubclasseCNAE=0;
private int idGrupoEconomico=0;
private int idTipoCadastro=0;
private String endereco=""; //$NON-NLS-1$
private String numero=""; //$NON-NLS-1$
private String complemento=""; //$NON-NLS-1$
private int idCEP=0;
private static SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd"); //$NON-NLS-1$
private Connection conn = null;
public Entidade()
{
}
public Entidade(Connection conn)
{
this.setConn(conn);
}
public Entidade(int idEntidade, Connection conn)
{
this.idEntidade = idEntidade;
this.setConn(conn);
this.setMembers();
}
public Entidade(String nome, String cadastro, Connection conn)
{
this.conn = conn;
int idEntidade=0;
// System.out.println("Constructor for " + nome + " " + conn);
Statement stmt = null;
try {
stmt = (Statement) this.conn.createStatement();
} catch (SQLException e1) {
e1.printStackTrace();
}
String query = "SELECT idEntidade FROM Entidade WHERE cadastro = '" + cadastro + "'" + " limit 1"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// System.out.println(query);
try
{
ResultSet rs = stmt.executeQuery(query);
while (rs.next())
{
idEntidade = rs.getInt("idEntidade"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
if(idEntidade==0)
{
try {
stmt = (Statement) conn.createStatement();
} catch (SQLException e1) {
e1.printStackTrace();
}
String nomeCurto = nome;
if(nome.length()>45)
{
nomeCurto = nome.substring(0, 45);
}
String stringDataCadastro = sdfd.format(Calendar.getInstance().getTime());
String sql = "INSERT INTO `Entidade` (`nome`,`nomeCurto`,`dataDeInicio`,`idTipoCadastro`,`cadastro`) VALUES ('"+nome+"','"+nomeCurto + "','" + stringDataCadastro + "',2,'" + cadastro +"')"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
// System.out.println(sql);
try {
stmt.executeUpdate(sql);
} catch (SQLException e) {
e.printStackTrace();
}
// System.out.println("New Cedente: " + nomeCedente);
query = "SELECT idEntidade FROM Entidade WHERE nome like '" + nome + "'"; //$NON-NLS-1$ //$NON-NLS-2$
// System.out.println(query);
ResultSet rs = null;
try {
rs = stmt.executeQuery(query);
} catch (SQLException e) {
e.printStackTrace();
}
try {
while (rs.next())
{
idEntidade = rs.getInt("idEntidade"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
}
this.idEntidade=idEntidade;
this.setConn(conn);
this.setMembers();
}
public Entidade(String nome, Connection conn)
{
this.conn = conn;
int idEntidade=0;
// System.out.println("Constructor for " + nome + " " + conn);
Statement stmt = null;
try {
stmt = (Statement) this.conn.createStatement();
} catch (SQLException e1) {
e1.printStackTrace();
}
String query = "SELECT idEntidade FROM Entidade WHERE nome like '" + nome + "'" + " limit 1"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// System.out.println(query);
try
{
ResultSet rs = stmt.executeQuery(query);
while (rs.next())
{
idEntidade = rs.getInt("idEntidade"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
if(idEntidade==0)
{
try {
stmt = (Statement) conn.createStatement();
} catch (SQLException e1) {
e1.printStackTrace();
}
String nomeCurto = nome;
if(nome.length()>45)
{
nomeCurto = nome.substring(0, 45);
}
String stringDataCadastro = sdfd.format(Calendar.getInstance().getTime());
String sql = "INSERT INTO `Entidade` (`nome`,`nomeCurto`,`dataDeInicio`,`idTipoCadastro`) VALUES ('"+nome+"','"+nomeCurto + "','" + stringDataCadastro + "',2)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
// System.out.println(sql);
try {
stmt.executeUpdate(sql);
} catch (SQLException e) {
e.printStackTrace();
}
// System.out.println("New Cedente: " + nomeCedente);
query = "SELECT idEntidade FROM Entidade WHERE nome like '" + nome + "'"; //$NON-NLS-1$ //$NON-NLS-2$
// System.out.println(query);
ResultSet rs = null;
try {
rs = stmt.executeQuery(query);
} catch (SQLException e) {
e.printStackTrace();
}
try {
while (rs.next())
{
idEntidade = rs.getInt("idEntidade"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
}
this.idEntidade=idEntidade;
this.setConn(conn);
this.setMembers();
}
public static void updateCadastro(int idEntidade, String cadastro, Connection conn)
{
// System.out.println("Constructor for " + nome + " " + conn);
Statement stmt = null;
try {
stmt = (Statement) conn.createStatement();
} catch (SQLException e1) {
e1.printStackTrace();
}
try {
stmt = (Statement) conn.createStatement();
} catch (SQLException e1) {
e1.printStackTrace();
}
String sql = "UPDATE `Entidade` SET `cadastro` = '"+ cadastro + "' WHERE idEntidade = " + idEntidade; //$NON-NLS-1$ //$NON-NLS-2$
// System.out.println(sql);
try {
stmt.executeUpdate(sql);
} catch (SQLException e) {
e.printStackTrace();
}
// System.out.println("New Cedente: " + nomeCedente);
}
public static void updateEndereco(int idEntidade, String endereco, String stringCEP, Connection conn)
{
// System.out.println("Constructor for " + nome + " " + conn);
Statement stmt = null;
try {
stmt = (Statement) conn.createStatement();
} catch (SQLException e1) {
e1.printStackTrace();
}
try {
stmt = (Statement) conn.createStatement();
} catch (SQLException e1) {
e1.printStackTrace();
}
int idCEP = obtainCEP(stringCEP, conn);
String sql = "UPDATE `Entidade` SET " //$NON-NLS-1$
+ "`endereco` = " + "'"+ endereco + "'" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ",`idCEP` = "+ idCEP //$NON-NLS-1$
+ " WHERE idEntidade = " + idEntidade; //$NON-NLS-1$
// System.out.println(sql);
if(idCEP!=0)
{
try {
stmt.executeUpdate(sql);
} catch (SQLException e) {
e.printStackTrace();
}
}
else
{
System.out.println("NewCEP:"+stringCEP+ "\t"+endereco);
}
// System.out.println("New Cedente: " + nomeCedente);
}
public static int obtainCEP(String stringCEP, Connection conn)
{
int idCEP=0;
// System.out.println("Constructor for " + nome + " " + conn);
Statement stmt = null;
try {
stmt = (Statement) conn.createStatement();
} catch (SQLException e1) {
e1.printStackTrace();
}
try {
stmt = (Statement) conn.createStatement();
} catch (SQLException e1) {
e1.printStackTrace();
}
String query = "SELECT idCEP from cep where CEP=" + "'" + stringCEP + "'"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// System.out.println(query);
ResultSet rs = null;
try {
rs = stmt.executeQuery(query);
} catch (SQLException e) {
e.printStackTrace();
}
try {
while (rs.next())
{
idCEP = rs.getInt("idCEP"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
return idCEP;
}
public static int getIdEntidadeBanco(String numeroBanco, Connection conn)
{
int idEntidadeBanco=0;
Statement stmt=null;
try {
stmt = (Statement) conn.createStatement();
} catch (SQLException e) {
e.printStackTrace();
}
String query = "SELECT idEntidadeBanco FROM codigobanco WHERE codigo=" + numeroBanco; //$NON-NLS-1$
System.out.println(query);
ResultSet rs = null;
try {
rs = stmt.executeQuery(query);
} catch (SQLException e) {
e.printStackTrace();
}
try {
while (rs.next())
{
idEntidadeBanco = rs.getInt("idEntidadeBanco"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
if(idEntidadeBanco==0)
{
System.out.println("Error bringing idEntidadeBanco"); //$NON-NLS-1$
}
return idEntidadeBanco;
}
public void showMembers()
{
System.out.println("\tnome: "+ this.getNome()); //$NON-NLS-1$
System.out.println("\tnomeCurto: "+ this.getNomeCurto()); //$NON-NLS-1$
System.out.println("\tcadastro: "+ this.getCadastro()); //$NON-NLS-1$
System.out.println("\tdataDeInicio: "+ this.getDataDeInicio()); //$NON-NLS-1$
System.out.println("\tidSubclasseCNAE: "+ this.getIdSubclasseCNAE()); //$NON-NLS-1$
System.out.println("\tidGrupoEconomico: "+ this.getIdGrupoEconomico()); //$NON-NLS-1$
System.out.println("\tidTipoDeCadastro: "+ this.getIdTipoDeCadastro()); //$NON-NLS-1$
System.out.println("\tendereco: "+ this.getEndereco()); //$NON-NLS-1$
System.out.println("\tcomplemento: "+ this.getComplemento()); //$NON-NLS-1$
System.out.println("\tidCEP: "+ this.getIdCEP()); //$NON-NLS-1$
// System.out.println("\tidBairro: "+ this.getIdBairro());
// System.out.println("\tidCidade: "+ this.getIdCidade());
// System.out.println("\tidUnidadeFederal: "+ this.getIdUnidadeFederal());
}
protected void setMembers()
{
this.setNome();
this.setNomeCurto();
this.setCadastro();
this.setDataDeInicio();
this.setIdSubclasseCNAE();
this.setIdGrupoEconomico();
this.setIdTipoDeCadastro();
this.setEndereco();
this.setIdCEP();
this.setComplemento();
// this.setIdBairro();
// this.setIdCidade();
// this.setIdUnidadeFederal();
}
public int getIdEntidade() {
return idEntidade;
}
public String getNome() {
return nome;
}
public void setNome() {
/**
* Finding nome for Entidade
*/
//System.out.println("idEntidade within setNome " + idEntidade);
try
{
Statement stmt = (Statement) this.conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT nome FROM Entidade WHERE idEntidade=" + this.getIdEntidade()); //$NON-NLS-1$
while (rs.next())
{
this.nome = rs.getString("nome"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public String getNomeCurto() {
return nomeCurto;
}
public void setNomeCurto(String nomeCurto)
{
this.nomeCurto = nomeCurto;
}
public void setNomeCurto() {
/**
* Finding nomeCurto for Entidade
*/
try
{
Statement stmt = (Statement) this.conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT nomeCurto FROM Entidade WHERE idEntidade=" + this.getIdEntidade()); //$NON-NLS-1$
while (rs.next())
{
this.nomeCurto = rs.getString("nomeCurto"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public String getCadastro() {
return cadastro;
}
public void setCadastro() {
/**
* Finding cadastro for Entidade
*/
try
{
Statement stmt = (Statement) this.conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT cadastro FROM Entidade WHERE idEntidade=" + this.getIdEntidade()); //$NON-NLS-1$
while (rs.next())
{
this.cadastro = rs.getString("cadastro"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public Date getDataDeInicio() {
return dataDeInicio;
}
public void setDataDeInicio() {
/**
* Finding dataDeInicio for Entidade
*/
try
{
Statement stmt = (Statement) this.conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT dataDeInicio FROM Entidade WHERE idEntidade=" + this.getIdEntidade()); //$NON-NLS-1$
while (rs.next())
{
this.dataDeInicio = rs.getDate("dataDeInicio"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public int getIdSubclasseCNAE() {
return idSubclasseCNAE;
}
public void setIdSubclasseCNAE() {
/**
* Finding idSubclasseCNAE for Entidade
*/
try
{
Statement stmt = (Statement) this.conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT idSubclasseCNAE FROM Entidade WHERE idEntidade=" + this.getIdEntidade()); //$NON-NLS-1$
while (rs.next())
{
this.idSubclasseCNAE = rs.getInt("idSubclasseCNAE"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public int getIdGrupoEconomico() {
return idGrupoEconomico;
}
public void setIdGrupoEconomico() {
/**
* Finding idGrupoEconomico for Entidade
*/
try
{
Statement stmt = (Statement) this.conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT idGrupoEconomico FROM Entidade WHERE idEntidade=" + this.getIdEntidade()); //$NON-NLS-1$
while (rs.next())
{
this.idGrupoEconomico = rs.getInt("idGrupoEconomico"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public int getIdTipoDeCadastro() {
return idTipoCadastro;
}
public void setIdTipoDeCadastro() {
/**
* Finding idTipoDeCadastro for Entidade
*/
try
{
Statement stmt = (Statement) this.conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT idTipoCadastro FROM Entidade WHERE idEntidade=" + this.getIdEntidade()); //$NON-NLS-1$
while (rs.next())
{
this.idTipoCadastro = rs.getInt("idTipoCadastro"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public String getEndereco() {
return endereco;
}
public void setEndereco() {
/**
* Finding endereco for Entidade
*/
try
{
Statement stmt = (Statement) this.conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT endereco FROM Entidade WHERE idEntidade=" + this.getIdEntidade()); //$NON-NLS-1$
while (rs.next())
{
this.endereco = rs.getString("endereco"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public void setIdCEP() {
/**
* Finding idCep for Entidade
*/
try
{
Statement stmt = (Statement) this.conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT idCEP FROM Entidade WHERE idEntidade=" + this.getIdEntidade()); //$NON-NLS-1$
while (rs.next())
{
this.idCEP = rs.getInt("idCEP"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public String getComplemento() {
return complemento;
}
public void setComplemento() {
/**
* Finding complemento for Entidade
*/
try
{
Statement stmt = (Statement) this.conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT complemento FROM Entidade WHERE idEntidade=" + this.getIdEntidade()); //$NON-NLS-1$
while (rs.next())
{
this.complemento = rs.getString("complemento"); //$NON-NLS-1$
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public Connection getConn() {
return conn;
}
public void setConn(Connection conn) {
this.conn = conn;
}
public int getIdCEP() {
return idCEP;
}
public void setIdEntidade(int idEntidade) {
this.idEntidade = idEntidade;
}
public static SimpleDateFormat getSdfd() {
return sdfd;
}
public static void setSdfd(SimpleDateFormat sdfd) {
Entidade.sdfd = sdfd;
}
public void setNome(String nome) {
this.nome = nome;
}
public void setCadastro(String cadastro) {
this.cadastro = cadastro;
}
public void setDataDeInicio(Date dataDeInicio) {
this.dataDeInicio = dataDeInicio;
}
public void setIdSubclasseCNAE(int idSubclasseCNAE) {
this.idSubclasseCNAE = idSubclasseCNAE;
}
public void setIdGrupoEconomico(int idGrupoEconomico) {
this.idGrupoEconomico = idGrupoEconomico;
}
public void setIdTipoDeCadastro(int idTipoDeCadastro) {
this.idTipoCadastro = idTipoDeCadastro;
}
public void setEndereco(String endereco) {
this.endereco = endereco;
}
public void setComplemento(String complemento) {
this.complemento = complemento;
}
public void setIdCEP(int idCEP) {
this.idCEP = idCEP;
}
public int getIdTipoCadastro() {
return idTipoCadastro;
}
public void setIdTipoCadastro(int idTipoCadastro) {
this.idTipoCadastro = idTipoCadastro;
}
public String getNumero() {
return numero;
}
public void setNumero(String numero) {
this.numero = numero;
}
}
|
[
"[email protected]"
] | |
265528e35131e80f160d285a6ea21e685b6e8b42
|
e66c5bc63be6007e1a0a8aef87f40d0a917bf95e
|
/MaterialDesign/app/src/main/java/com/hfad/materialdesign/activity/CoordinatorLayout.java
|
be60b26c9e585e394bf658e8eb778caa5fdbcd28
|
[] |
no_license
|
kib06277/Material_Design
|
296588574b64e36abc7738d46f4bb57063e6f12f
|
1d2c31b5dddc505fe8b9423b4cfce251e8362ab0
|
refs/heads/master
| 2020-08-07T22:20:17.895406 | 2019-10-09T05:57:36 | 2019-10-09T05:57:36 | 213,603,325 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,066 |
java
|
package com.hfad.materialdesign.activity;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.hfad.materialdesign.Adapter.NormalRecyclerViewAdapter;
import com.hfad.materialdesign.R;
public class CoordinatorLayout extends AppCompatActivity
{
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cdl);
RecyclerView rv = (RecyclerView) findViewById(R.id.cdl_recyclerView);
CollapsingToolbarLayout collapsing_toolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsing_toolbar.setTitle("Title");
//่จญๅฎ็ทๆงๅธๅฑ
rv.setLayoutManager(new LinearLayoutManager(this));
rv.setAdapter(new NormalRecyclerViewAdapter(this));
}
}
|
[
"[email protected]"
] | |
aeef8bd6f7b062ab2dd117a6e2eb7b38daa682f5
|
8136410b2740e6f6d69b1d391668e8800cfb0a7d
|
/src/main/java/com/headfirst/observer/Observer.java
|
358ae0992e947abbe2e90c6f6e33a0cb9ab1e9c1
|
[] |
no_license
|
suqun/JavaDesignPatterns
|
0806461e2ba6442de51472f5b09971e76b705574
|
402f4658af6aaccfa43dcd6753aa9c6ce56c90a0
|
refs/heads/master
| 2020-05-16T22:25:18.243216 | 2017-05-02T08:49:08 | 2017-05-02T08:49:08 | 38,610,607 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 432 |
java
|
package com.headfirst.observer;
/**
* Created by larry on 10/24/15.
* ่งๅฏ่
ๆฅๅฃ
* ๆๆ่งๅฏ่
้ฝๅฟ
้กปๅฎ็ฐupdateๆนๆณ๏ผไปฅๅฎ็ฐ่งๅฏ่
ๆฅๅฃ
*/
public interface Observer {
//ๅฝๆฐ่ฑก็ถๆๆนๅๆถ๏ผ่ฟไธชๆนๆณไผ่ขซ่ฐ็จ๏ผไปฅ้็ฅๆๆ็่งๅฏ่
//็ดๆฅไผ ๅ
ฅ่งๆตๅผไธๆๆบ๏ผ็ง็ฑปๅไธชๆฐๅจๅฐๆฅๅฏ่ฝๅบ็ฐๅๅ
public void update(float temp,float humidity,float pressure);
}
|
[
"[email protected]"
] | |
bfddeadd17f21c2539e56999a0de7f553a334ba8
|
d7500c2e0b2458208e7b9a171627342b68b40428
|
/IBeansTest/src/main/java/self/test/service/TransferService.java
|
8e616b59be09ce6be91aeef9994733bfa8f955e6
|
[] |
no_license
|
Y-cs/IBeans
|
7e215523b2d7f1432bca74ada8ebf473ae428ae3
|
51e3383d9679ed8eb7659de6de9635ae93f37ca7
|
refs/heads/master
| 2023-05-26T14:50:55.264365 | 2021-06-10T03:39:04 | 2021-06-10T03:39:04 | 360,174,082 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 173 |
java
|
package self.test.service;
/**
* @author ๅบ็ซ
*/
public interface TransferService {
void transfer(String fromCardNo,String toCardNo,int money) throws Exception;
}
|
[
"[email protected]"
] | |
d3e2f8512c6529bbfd47ac464ed3d94cd0e56834
|
1a0307b40247908a6d2af31c558b548d3b054cd8
|
/Labs/PRJ321_haunvcse61546_lab8/PRJ321_Lab8_EJB/PRJ321_Lab8_EJB-ejb/src/java/com/lab8/sessions/UserSessionBeanLocalHome.java
|
5903c1b80b29aed386b76bb2e7a75e8450133c53
|
[] |
no_license
|
jasonnguyenvn/AJProjects
|
ec7bc1a1f3870e92175e3214478cb89bb46695f5
|
f8797c2d38ec04674a26ec52fe89976ed0fd7170
|
refs/heads/master
| 2021-05-29T19:09:46.703120 | 2015-10-07T13:29:23 | 2015-10-07T13:29:23 | 43,446,158 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 368 |
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.lab8.sessions;
import javax.ejb.CreateException;
import javax.ejb.EJBLocalHome;
/**
*
* @author Hau
*/
public interface UserSessionBeanLocalHome extends EJBLocalHome {
com.lab8.sessions.UserSessionBeanLocal create() throws CreateException;
}
|
[
"[email protected]"
] | |
ff5f0ddec50e04a96af670b6250aecb6daf4fd34
|
a31b0777178262ece879af5fda35ccebeb3be9e8
|
/src/main/java/merlobranco/springframework/repositories/IngredientRepository.java
|
d801688c715aa13eb6f33d92843b552a3102c88a
|
[] |
no_license
|
merlobranco/spring5-recipe-app
|
d75460899b6c6c98fa9aad13a98e747020dec555
|
659f25db91682eef3f4edf05af91462fa133598e
|
refs/heads/master
| 2023-06-18T06:17:49.281942 | 2021-07-18T20:35:00 | 2021-07-18T20:35:00 | 359,546,191 | 0 | 0 | null | 2021-04-19T19:30:39 | 2021-04-19T17:38:42 |
Java
|
UTF-8
|
Java
| false | false | 344 |
java
|
package merlobranco.springframework.repositories;
import java.util.Set;
import org.springframework.data.repository.CrudRepository;
import merlobranco.springframework.domain.Ingredient;
public interface IngredientRepository extends CrudRepository<Ingredient, Long> {
public Set<Ingredient> findByRecipeId(Long recipeId);
}
|
[
"[email protected]"
] | |
e767dfd98b86ca3699347ee40806633513e2200a
|
524703c6660e5e95531ade59e49f8e5e39f36e85
|
/Milestone4/src/GUI/OthelloButton.java
|
2c8cf19bdda4c9b649093d847493674e58a60928
|
[] |
no_license
|
brandonmarino/3rd-Year-Game-Project
|
826404491f8447b121fff582948909a35457ba41
|
3871c8564b56031f86c2505fa9b99aee5041d326
|
refs/heads/master
| 2020-06-18T11:21:36.264871 | 2014-12-09T03:35:26 | 2014-12-09T03:35:26 | 75,140,593 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,435 |
java
|
package GUI;
import java.awt.*;
import javax.swing.Icon;
import javax.swing.JButton;
import Boards.Board.PLAYER;
/**
*
* @author Pheonix
* Extension of JButton that stores it's location on a grid
*/
public class OthelloButton extends JButton//I would like to extend JButton here but when I did, a bug showed up where instances of OthelloButton would only be visible on mouseover. No visible online fix.
{
private int xOnGrid, yOnGrid;
private Icon image;
private PLAYER player;
/**
* Constructor
* @param x stores the x coordinate of the button
* @param y stores the y coordinate of the button
* @param aPlayer is starting PLAYER value
*/
public OthelloButton(int x, int y, PLAYER aPlayer)
{
super();
xOnGrid = x;
yOnGrid = y;
setPlayer(aPlayer);
}
/**Will be useful later if we want to have fancier looking buttons.
* It will change the icon on the button with the appropriate file
* @param aPlayer PLAYER who's icon will be on this button.
*/
public void setIcon(PLAYER aPlayer)
{
player = aPlayer;
validate();
repaint();
}
public PLAYER getPlayer()
{
return player;
}
public void setPlayer(PLAYER aPlayer)
{
player = aPlayer;
setIcon(aPlayer);
}
/**
* Will be useful later
* See setIcon()
*/
public void flipIcon()
{
if (player == PLAYER.PLAYER1)
{
setPlayer(PLAYER.PLAYER2);
}
else if (player == PLAYER.PLAYER2)
{
setPlayer(PLAYER.PLAYER1);
}
validate();
repaint();
}
public int getX(){return xOnGrid;}
public int getY(){return yOnGrid;}
@Override
public String toString()
{
return "X: "+ getX() + " Y: " + getY() + " Player: " + getPlayer();
}
/**
* Draws the correct collour of ellipse if a player is selected
*
* @param g graphics for button
*/
@Override
public void paintComponent(Graphics g)
{
if(player == PLAYER.EMPTY)
super.paintComponent(g);
else if (player == PLAYER.PLAYER1) //player1 is always black in othello
{
g.setColor(Color.BLACK);
g.fillOval(getHorizontalAlignment(), getVerticalAlignment(), getWidth(), getHeight());
}
else if (player == PLAYER.PLAYER2)
{
g.setColor(Color.WHITE);
g.fillOval(getHorizontalAlignment(), getVerticalAlignment(), getWidth(), getHeight());
}
}
}
|
[
"[email protected]"
] | |
b7d2f2f886a4d86f1f70eeee88e46bc6b73b662a
|
83a6efc9607cb164843981f5f4141ad58462ba43
|
/app/src/test/java/com/example/jetsu/samplequiz/ExampleUnitTest.java
|
aab141aacf0a26bc2be804ced96b71542b064b8f
|
[] |
no_license
|
vayct/test-SampleQuiz
|
2b06b4b1e0c70b913abc5eb1dda198e514d4c919
|
1e1477db321d773a1813ece474fd8d4d8b2b3da9
|
refs/heads/master
| 2021-01-22T04:01:51.868851 | 2017-05-25T17:38:53 | 2017-05-25T17:38:53 | 92,423,203 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 406 |
java
|
package com.example.jetsu.samplequiz;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
[
"[email protected]"
] | |
76b7b30c4ed66761833f38868fafa2cabdc2773a
|
37d91b2c5551d9fd58d4d272190f1092c24b0970
|
/src/main/java/com/learning/InterviewPreparation/DesignPattern/FactoryPatternDemo2/UserFace.java
|
9e3a74e1a5f661b9bc7aa9544ae0503b21312d1e
|
[] |
no_license
|
rahulmen/MultiThreading
|
bacada1256334e0dd9b395e62516528b1e503e07
|
972b0df80d16154e668920b158a20db4bbd82e15
|
refs/heads/master
| 2022-07-24T12:27:49.222928 | 2020-04-09T16:43:02 | 2020-04-09T16:43:02 | 150,064,897 | 0 | 1 | null | 2022-07-06T20:06:20 | 2018-09-24T06:51:15 |
Java
|
UTF-8
|
Java
| false | false | 260 |
java
|
package com.learning.InterviewPreparation.DesignPattern.FactoryPatternDemo2;
public class UserFace {
public static void main(String[] args){
Car car = CarFactory.getCar(CarType.MINI);
System.out.print(car.carType.name());
}
}
|
[
"[email protected]"
] | |
f945e7679f93343ee300dd2001c7c78b4b19dc78
|
57afc256237152a1d0ed911bf55e0991e40c66e0
|
/cloud-crdt/src/main/java/io/datakernel/crdt/TimestampContainer.java
|
cc67c64f72c6afb7477390b98ac9c9cb9d4544bd
|
[
"Apache-2.0"
] |
permissive
|
ievgeniibrovdii/datakernel
|
ab3d98e856906979985c16346dfe77d7665ae71e
|
d3ce59217a3c4b8e1057b7a18da59641a0b44050
|
refs/heads/master
| 2020-06-12T02:12:33.792028 | 2019-06-27T14:38:03 | 2019-06-27T14:50:12 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,476 |
java
|
package io.datakernel.crdt;
import io.datakernel.eventloop.Eventloop;
import io.datakernel.serializer.AbstractBinarySerializer;
import io.datakernel.serializer.BinarySerializer;
import io.datakernel.serializer.util.BinaryInput;
import io.datakernel.serializer.util.BinaryOutput;
import org.jetbrains.annotations.Nullable;
import java.util.function.BinaryOperator;
public final class TimestampContainer<S> {
private final long timestamp;
private final S state;
public TimestampContainer(long timestamp, S state) {
this.timestamp = timestamp;
this.state = state;
}
public static <S> TimestampContainer<S> now(S state) {
return new TimestampContainer<>(Eventloop.getCurrentEventloop().currentTimeMillis(), state);
}
public long getTimestamp() {
return timestamp;
}
public S getState() {
return state;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TimestampContainer<?> that = (TimestampContainer<?>) o;
return timestamp == that.timestamp && state.equals(that.state);
}
@Override
public int hashCode() {
return 31 * (int) (timestamp ^ (timestamp >>> 32)) + state.hashCode();
}
@Override
public String toString() {
return "[" + state + "](ts=" + timestamp + ')';
}
public static <S> CrdtFunction<TimestampContainer<S>> createCrdtFunction(BinaryOperator<S> combiner) {
return new CrdtFunction<TimestampContainer<S>>() {
@Override
public TimestampContainer<S> merge(TimestampContainer<S> first, TimestampContainer<S> second) {
return new TimestampContainer<>(Math.max(first.getTimestamp(), second.getTimestamp()), combiner.apply(first.getState(), second.getState()));
}
@Nullable
@Override
public TimestampContainer<S> extract(TimestampContainer<S> state, long timestamp) {
if (state.getTimestamp() > timestamp) {
return state;
}
return null;
}
};
}
public static <S> BinarySerializer<TimestampContainer<S>> createSerializer(BinarySerializer<S> stateSerializer) {
return new AbstractBinarySerializer<TimestampContainer<S>>() {
@Override
public void encode(BinaryOutput out, TimestampContainer<S> item) {
out.writeLong(item.getTimestamp());
stateSerializer.encode(out, item.getState());
}
@Override
public TimestampContainer<S> decode(BinaryInput in) {
return new TimestampContainer<>(in.readLong(), stateSerializer.decode(in));
}
};
}
}
|
[
"[email protected]"
] | |
738463019095ea168b3b3a14385dea584db194b7
|
1030433b019bca48919f9d6d93b19b3108072f04
|
/CMSC350/src/cmsc350/project2/Project2.java
|
724bb2f7fdc3a17dcb975afc687953b4d2173617
|
[] |
no_license
|
dbryant313/UMUC-1
|
4c027bd161222371ab3b142ddaf525ae78606abc
|
97d396120f09b88e3bbb51516b328d3427239cc4
|
refs/heads/master
| 2020-12-28T17:24:39.536453 | 2014-07-28T00:04:09 | 2014-07-28T00:04:09 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,212 |
java
|
package cmsc350.project2;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
/**
* Name: Justin Smith
* CMSC 350
* Project: 2
* Date: 11/17/12 11:22 AM
* Requires: J2SE 7+
*/
public class Project2 {
public static void main(String[] args) {
if(args.length == 0) {
System.out.println("Usage: Project2 [-f : file | -s : \"String\"]\n");
System.out.println("Note: When running input from a file or the command line all data will be treated\n" +
"as a string and evaluated based on the String class compareTo() method. You must\n" +
"define your own objects to in order to use DoubleOrderedList in any other way.");
System.out.println("\nRunning default example that adds randomly generated integers to the list\n");
DoubleOrderedList<Integer> list = new DoubleOrderedList<>();
int rand;
for(int i = 0; i < 20; i++) {
rand = (int) (Math.random() * 1000);
System.out.println("Adding " + rand + " to list");
list.add(rand);
}
System.out.println("Printing ordered list contents");
System.out.println(list);
System.exit(0);
} // End no args present
String fileName = null;
String userInput = null;
if(args[0].charAt(0) == '-') {
switch(args[0].charAt(1)) {
case 'f':
fileName = args[1];
break;
case 's':
userInput = args[1];
break;
default:
System.out.println("Usage: Project2 [-f : file | -s : \"String\"]");
System.out.println("Nothing too fancy, it will break!");
}
} else {
System.out.println("Usage: Project2 [-f : file | -s : \"String\"]");
System.out.println("Nothing too fancy, it will break!");
}
DoubleOrderedList<String> list = new DoubleOrderedList<>();
if(fileName != null) {
try {
BufferedReader reader = new BufferedReader(new FileReader(fileName));
String in;
while((in = reader.readLine()) != null) {
list.addAll(in.split("[\\p{Punct}\\s]+"));
}
reader.close();
} catch (FileNotFoundException e) {
System.err.println("File: " + fileName + " not found.");
System.exit(1);
} catch (IOException e) {
System.err.println("IOException on file: " + fileName);
System.exit(1);
}
} else if(userInput != null) {
list.addAll(userInput.split("\\s+"));
} else {
System.out.println("Usage: Project2 [-f : file | -s : \"String\"]");
System.out.println("Nothing too fancy, it will break!");
System.exit(1);
}
System.out.println("Printing list: \n" + list);
System.out.println("Total strings read: " + list.size());
}
}
|
[
"[email protected]"
] | |
1d5e0ac1f37b308932c950630d050516e60aac04
|
9f004c3df4413eb826c229332d95130a1d5c8457
|
/src/Sagar_Assignment_39/Assignment39.java
|
89088ea5cd9eceada6df248e00162432a1d2c8e2
|
[] |
no_license
|
MayurSTechnoCredit/JAVATechnoJuly2021
|
dd8575c800e8f0cac5bab8d5ea32b25f7131dd0d
|
3a422553a0d09b6a99e528c73cc2b8efe260a07a
|
refs/heads/master
| 2023-08-22T14:43:37.980748 | 2021-10-16T06:33:34 | 2021-10-16T06:33:34 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 681 |
java
|
/*Assignment-39 : 25th Sep'2021
Print first N elements of the Fibonacci series.
n -> 8
output : 0,1,1,2,3,5,8,13*/
package Sagar_Assignment_39;
public class Assignment39 {
void findFirstNElementsOfFibonacciSeries(int num) {
int num1=0;
int num2=1;
int sum=0;
System.out.println("First "+num+" Elements of the Fibonacci Series :");
System.out.print(num1+" ");
System.out.print(num2+" ");
for(int index=0;index<num-2;index++){
sum=num1+num2;
num1=num2;
num2=sum;
System.out.print(num2+" ");
}
}
public static void main(String[] args) {
Assignment39 assignment39 = new Assignment39();
assignment39.findFirstNElementsOfFibonacciSeries(8);
}
}
|
[
"[email protected]"
] | |
9882c95c378c5ba85fbfc5a25aa582cd12302db4
|
c22436079b48b581f648adf91c216b4488ffb1d3
|
/src/edu/mit/csail/cgs/tools/chipseq/GetBindingInRegion.java
|
e714cbba5f4bdbc64af682fae8aea9f0e35296d1
|
[] |
no_license
|
fengpku/GEM3
|
b53ad424d7c15cf65648633562fefcd70b6dbdf3
|
f7e5688a13c287fe4cd4cc63190b0dd82e3ab9eb
|
refs/heads/master
| 2020-08-04T19:05:43.032810 | 2018-08-14T00:41:26 | 2018-08-14T00:41:26 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,449 |
java
|
package edu.mit.csail.cgs.tools.chipseq;
import java.util.*;
import java.sql.*;
import java.io.*;
import edu.mit.csail.cgs.datasets.species.*;
import edu.mit.csail.cgs.datasets.general.*;
import edu.mit.csail.cgs.datasets.chipseq.*;
import edu.mit.csail.cgs.ewok.verbs.*;
import edu.mit.csail.cgs.tools.utils.Args;
import edu.mit.csail.cgs.utils.NotFoundException;
import edu.mit.csail.cgs.utils.Pair;
import edu.mit.csail.cgs.warpdrive.components.Snapshot;
/**
* Reads regions on STDIN, from a file, or uses a list such as all genes
* and produces a line on STDOUT for each that lists either the analyses and binding
* events for each.
*
* java edu.mit.csail.cgs.tools.chipseq.GetBindingInRegion --species "$MM;mm9" --genes refGene
* java edu.mit.csail.cgs.tools.chipseq.GetBindingInRegion --species "$MM;mm9" --region 10:0-1000000
* java edu.mit.csail.cgs.tools.chipseq.GetBindingInRegion --species "$MM;mm9" --regionfile foo.txt
* java edu.mit.csail.cgs.tools.chipseq.GetBindingInRegion --species "$MM;mm9"
* this form above reads regions from STDIN
*
* --plots causes plots with the chipseq data to be produced.
*
*/
public class GetBindingInRegion {
private ChipSeqLoader loader;
private Genome genome;
private List<RefGeneGenerator> geneGenerators;
private List<Region> regions;
private int plotExpand;
private boolean plots;
private String plotPrefix = "";
public GetBindingInRegion() throws SQLException, IOException {
geneGenerators = new ArrayList<RefGeneGenerator>();
regions = new ArrayList<Region>();
loader = new ChipSeqLoader();
plots = false;
}
public void parseArgs(String[] args) throws NotFoundException, IOException{
genome = Args.parseGenome(args).cdr();
geneGenerators = Args.parseGenes(args);
List<Region> fromfile = Args.readLocations(args,"regionfile");
if (fromfile != null) {
regions.addAll(fromfile);
}
regions.addAll(Args.parseRegions(args));
plots = Args.parseFlags(args).contains("plots");
plotExpand = Args.parseInteger(args,"plotexpand",2500);
plotPrefix = Args.parseString(args,"plotprefix","");
}
public void setGenome(Genome g) {genome = g;}
public void setGenes(Collection<RefGeneGenerator> g) {geneGenerators.clear(); geneGenerators.addAll(g);}
public void setRegions(Collection<Region> r) {regions.clear(); regions.addAll(r);}
public void computeRegions() throws IOException, SQLException {
for (RefGeneGenerator generator : geneGenerators) {
Iterator<Gene> iter = generator.getAll();
while (iter.hasNext()) {
regions.add(iter.next());
}
}
if (regions.size() == 0) {
System.err.println("Reading regions from STDIN");
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String line = null;
while ((line = reader.readLine()) != null) {
regions.add(Region.fromString(genome, line));
}
}
Collections.sort(regions);
}
public List<Region> getRegions() {return regions;}
public Collection<ChipSeqAnalysis> getAnalysesForRegion(Region r) throws SQLException {
return ChipSeqAnalysis.withResultsIn(loader, r);
}
public void print(Region r) throws SQLException {
System.out.print(r.toString());
for (ChipSeqAnalysis a : getAnalysesForRegion(r)) {
System.out.print("\t" + a.getName() + ";" + a.getVersion());
}
System.out.println();
}
public void plot(Region r) throws SQLException, NotFoundException, IOException {
Collection<ChipSeqAnalysis> analyses = getAnalysesForRegion(r);
if (analyses.size() == 0) { return ;}
r = r.expand(plotExpand,plotExpand);
System.err.println("Doing plot for " + r);
ArrayList<String> args = new ArrayList<String>();
args.add("--noexit");
args.add("--species");
args.add(String.format("%s;%s", genome.getSpecies(), genome.getVersion()));
args.add("--picture");
args.add(plotPrefix + (r.toString().replaceAll(":","_")) + ".png");
args.add("--genes");
args.add("refGene");
args.add("--chrom");
args.add(String.format("%s:%d-%d",r.getChrom(), r.getStart(),r.getEnd()));
Map<Pair<String,String>, List<String>> chipseqtracks = new HashMap<Pair<String,String>, List<String>>();
for (ChipSeqAnalysis analysis : analyses) {
args.add("--chipseqanalysis");
args.add(analysis.getName() + ";" + analysis.getVersion());
for (ChipSeqAlignment align : analysis.getForeground()) {
Pair<String,String> namever = new Pair<String,String>(align.getExpt().getName(),
align.getName());
if (!chipseqtracks.containsKey(namever)) {
chipseqtracks.put(namever, new ArrayList<String>());
}
chipseqtracks.get(namever).add(align.getExpt().getReplicate());
}
}
for (Pair<String,String> p : chipseqtracks.keySet()) {
args.add("--chipseq");
String arg = p.car();
for (String rep : chipseqtracks.get(p)) {
arg = arg + ";" + rep;
}
arg = arg + ";" + p.cdr();
args.add(arg);
}
System.err.println("Args are " + args);
String[] asarray = new String[args.size()];
for (int i = 0; i < args.size(); i++) {
asarray[i] = args.get(i);
}
Snapshot.main(asarray);
}
public void close() {
loader.close();
loader = null;
for (RefGeneGenerator g : geneGenerators) {
g.close();
}
}
public static void main(String args[]) {
try {
GetBindingInRegion get = new GetBindingInRegion();
get.parseArgs(args);
get.computeRegions();
for (Region r : get.getRegions()) {
if (get.plots) {
get.plot(r);
} else {
get.print(r);
}
}
get.close();
} catch (Exception e) {
e.printStackTrace();
}
System.exit(0);
}
}
|
[
"[email protected]"
] | |
6918b24892be93b52007e075d44903478a44a420
|
488a4e612dad4a35bf59b850fd686da707299ecc
|
/src/main/java/com/example/database/dao/PersonDAOHashMap.java
|
289996d545e3dd0a0f30b180c54fb5733ef5b770
|
[] |
no_license
|
DanielJan/restAPI
|
9fc201662575c75507218e9515296463d665d723
|
f67bcc74f103085d1dae4ac0294083b6e034b055
|
refs/heads/master
| 2020-12-31T05:40:50.183179 | 2016-09-20T12:56:47 | 2016-09-20T12:56:47 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,363 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.example.database.dao;
import com.example.AlreadyExists;
import com.example.Person;
import com.example.PersonNotFound;
import java.util.Collection;
import java.util.HashMap;
import java.util.Optional;
import javax.annotation.PostConstruct;
import org.springframework.stereotype.Repository;
/**
*
* @author damian.wrobel
*/
@Repository(value = "personDAOHashMap")
public class PersonDAOHashMap implements PersonDAO {
private HashMap<Integer, Person> persons = new HashMap<Integer, Person>();
@PostConstruct
private void setup() {
Person olek = new Person("Olek", 40, 3);
Person adam = new Person("Adam", 14, 2);
Person karol = new Person("Karol", 30, 1);
persons.put(olek.getId(), olek);
persons.put(adam.getId(), adam);
persons.put(karol.getId(), karol);
}
@Override
public Optional<Person> searchPersonBy(int id) {
return Optional.ofNullable(persons.get(id));
}
@Override
public void deletePerson(int id) {
if (persons.containsKey(id)) {
persons.remove(id);
System.out.println("Usuniฤto osobฤ");
} else {
throw new PersonNotFound(id);
}
}
@Override
public void modifyPerson(int id, String name, Integer age) {
Optional<Person> optPerson = searchPersonBy(id);
if (optPerson.isPresent()) {
Person objPer = optPerson.get();
if (name != null & age != null) {
objPer.setAge(age);
objPer.setName(name);
} else if (name != null & age == null) {
objPer.setName(name);
} else if (name == null & age != null) {
objPer.setAge(age);
}
} else {
throw new PersonNotFound(id);
}
}
@Override
public void addPerson(Person person) {
if (!persons.containsKey(person.getId())) {
persons.put(person.getId(), person);
} else {
throw new AlreadyExists(person.getId());
}
}
@Override
public Collection<Person> showPersons() {
return persons.values();
}
}
|
[
"[email protected]"
] | |
c95e36d6fcba11dff630f6a0efce547d19ada8ec
|
30b32840b6b60248b36441572281eb4c457bcfe5
|
/src/main/java/com/gaozhaoxi/springbooteleven/SpringBootElevenApplication.java
|
8e7dcfc679864c93e67f268c2bf7b90e9d946876
|
[] |
no_license
|
LeonhardtSD/SpringBootEleven
|
a1df8f22df52088ae89aa6d61122865bdfb6944f
|
a1e717a8f92afe5018dfb5b334889c8bfd418bee
|
refs/heads/master
| 2020-03-17T17:00:19.988292 | 2018-05-17T06:48:16 | 2018-05-17T06:48:16 | 133,771,061 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 464 |
java
|
package com.gaozhaoxi.springbooteleven;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
@EnableCaching //่ฆๅ ไธ@EnableCachingๆณจ่งฃๆไผ็ๆใ
@SpringBootApplication
public class SpringBootElevenApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootElevenApplication.class, args);
}
}
|
[
"[email protected]"
] | |
ad06f6ec7a3da062e7d05114951f6661a9696b1e
|
41589b12242fd642cb7bde960a8a4ca7a61dad66
|
/teams/fibbyBot7/Messenger.java
|
e40ac3adb693491ec2d0e1becbaab657d8ed533d
|
[] |
no_license
|
Cixelyn/bcode2011
|
8e51e467b67b9ce3d9cf1160d9bd0e9f20114f96
|
eccb2c011565c46db942b3f38eb3098b414c154c
|
refs/heads/master
| 2022-11-05T12:52:17.671674 | 2011-01-27T04:49:12 | 2011-01-27T04:49:12 | 275,731,519 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,764 |
java
|
package fibbyBot7;
import java.util.LinkedList;
import battlecode.common.*;
/**
* Messenger Class. Loosely based on the old Lazer6 messaging code
*
*
* <pre>
* MESSAGE BLOCK FORMAT------------------------------------------|
* idx 0 1 2 3 |
* ints [ hash , header , data , data..........|
* locs [ source , origin , data , data..........|
* strs [-----------------------------------------------------|
* </pre>
* @author Cory
*
*/
public class Messenger {
//public variable
final RobotPlayer myPlayer;
//send component needs to be enabled
private boolean canSend;
public boolean shouldReceive = false;
//static limits
private static final int ROUND_MOD = 4;
private static final int ID_MOD = 1024;
private final int teamKey;
private final int myID;
//Defined indexes for readability
public static final int idxHash = 0;
public static final int idxHeader = 1;
public static final int idxSender = 0;
public static final int idxOrigin = 1;
public static final int firstData = 2;
public static final int minSize = firstData;
final LinkedList<Message> messageQueue;
private boolean[][] hasHeard = new boolean[ROUND_MOD][];
public Messenger(RobotPlayer player) {
myPlayer = player; //Assign the player
canSend = false; //Default robot doesn't have antennae
messageQueue = new LinkedList<Message>(); //Build Queue
shouldReceive = true;
//Initialize our entire 'has heard' table
for(int i=0; i<ROUND_MOD; i++) {
hasHeard[i] = new boolean[ID_MOD];
}
//set ID and key
myID = myPlayer.myRC.getRobot().getID();
if(myPlayer.myRC.getTeam()==Team.A) {
teamKey = 131071; //first 6 digit mersenne prime
} else {
teamKey = 174763; //first 6 digit wagstaff prime
}
}
/**
* This call is run whenever the robot gains an antennae
* Note that components can never be removed, so a robot cannot lose it's sending ability.
*/
public void enableSender() {
canSend = true;
}
/**
* Should the robot receive messages?
* Useful holding messages until robots are active.
* @param state whether you should
*/
public void toggleReceive(boolean state) {
shouldReceive = state;
}
/**
* Internal sending function
* @param m message to send where the relevant location blocks and int blocks reserved for headers
* and such are left blank. sendMsg computs the hashes and inserts them in.
*/
private void sendMsg(MsgType type, Message m) {
//debug code to make sure we're not calling something that can't be done.
assert canSend;
//fill in message
int currTime = Clock.getRoundNum();
m.ints[idxHeader] = Encoder.encodeMsgHeader(type, currTime, myID);
MapLocation myLoc = myPlayer.myRC.getLocation();
m.locations[idxSender] = myLoc; //sender location
m.locations[idxOrigin] = myLoc; //origin location
m.ints[idxHash] = teamKey; //super simple hash
messageQueue.add(m);
//I've heard my own message
hasHeard[currTime%ROUND_MOD][myID%ID_MOD] = true;
}
/**
* This internal function builds a <code>battlecode.common.Message</code> with
* <code>iSize</code> ints and <code>lSize</code> locations
* @param iSize number of ints
* @param lSize number of locations
* @return
*/
private Message buildNewMessage(int iSize, int lSize) {
Message m = new Message();
m.ints = new int[minSize+iSize];
m.locations = new MapLocation[minSize+lSize];
return m;
}
public void sendNotice(MsgType t) {
sendMsg(t,buildNewMessage(0,0));
}
public void sendLoc(MsgType t, MapLocation loc)
{
Message m = buildNewMessage(0,1);
m.locations[firstData ] = loc;
sendMsg(t,m);
}
public void sendIntDoubleLoc(MsgType t, int int1, MapLocation loc1, MapLocation loc2)
{
Message m = buildNewMessage(1,2);
m.ints[firstData] = int1;
m.locations[firstData ] = loc1;
m.locations[firstData+1] = loc2;
sendMsg(t,m);
}
public void sendDoubleLoc(MsgType t, MapLocation loc1, MapLocation loc2) {
Message m = buildNewMessage(0,2);
m.locations[firstData ] = loc1;
m.locations[firstData+1] = loc2;
sendMsg(t,m);
}
/**
* Very primitive receive function
*/
public void receiveAll() {
Message[] rcv = myPlayer.myRC.getAllMessages();
boolean isValid = true;
for(Message m: rcv) {
if (!isValid)
System.out.println("Message dropped!");
isValid = false;
////////BEGIN MESSAGE VALIDATION SYSTEM
///////Begin inlined message validation checker
if(m.ints==null) break;
if(m.ints.length<minSize) break;
//////We should have a checksum -- make sure the checksum is right.
if(m.ints[idxHash]!=teamKey) break;
//////We at least have a valid int header
MsgType t = Encoder.decodeMsgType(m.ints[idxHeader]); //pull out the header
//////Now make sure we have enough ints & enough maplocations
if(m.ints.length!=t.numInts) break;
if(m.locations==null) break;
if(m.locations.length!=t.numLocs) break;
////////MESSAGE HAS BEEN VALIDATED
isValid = true;
if(t.shouldCallback) {
myPlayer.myBehavior.newMessageCallback(t,m);
}
}
}
public void sendAll() throws Exception{
while(!messageQueue.isEmpty()) {
while(myPlayer.myBroadcaster.isActive())
myPlayer.myRC.yield();
myPlayer.myBroadcaster.broadcast(messageQueue.pop());
}
}
}
|
[
"[email protected]"
] | |
fdc8b88979f46edbe74a8f0576cd38bea8ab8a3e
|
d4eee98967f83278602e586a1a697171990720ea
|
/app/src/main/java/com/wangdh/basetest/entity/MovieEntity.java
|
8acffe2c44ac3b97505f4128dacbb5e071ec0816
|
[] |
no_license
|
coderKingDH/BaseTest
|
6cedb807bb5badd8e0a285c065f05420e3689dc2
|
31af7c38a4d00e3138fb762d964cfb049bef0c6a
|
refs/heads/master
| 2021-01-11T18:21:50.271814 | 2016-09-30T02:49:49 | 2016-09-30T02:49:49 | 69,627,667 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 171 |
java
|
package com.wangdh.basetest.entity;
/**
* ไฝ่
: wdh <br>
* ๅ
ๅฎนๆ่ฆ: <br>
* ๅๅปบๆถ้ด: 2016/8/22 17:54<br>
* ๆ่ฟฐ: <br>
*/
public class MovieEntity {
}
|
[
"[email protected]"
] | |
8624421abcc691aea20a76794dea50e5352232c2
|
c00bea65dcbf88fbc01f9041baafd44e79cfce84
|
/src/main/java/com/woutwoot/wowpvp/game/gamer/Creator.java
|
5f03d1b5a086bcaf3640a751fdcb94768118f173
|
[] |
no_license
|
WorldofWoutCraft/WoWPvP
|
904c024438e84048dc974e79c8fd82c5595717ce
|
a2069e747c1fb3780e086fe6b1b4566790d74030
|
refs/heads/master
| 2020-05-29T21:39:59.581015 | 2015-02-15T15:35:49 | 2015-02-15T15:35:49 | 27,511,900 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 217 |
java
|
package com.woutwoot.wowpvp.game.gamer;
import java.util.UUID;
/**
* Created by Wout on 3/12/2014 - 23:01.
*/
public class Creator extends Gamer{
public Creator(UUID player) {
super(player);
}
}
|
[
"[email protected]"
] | |
013f38cddd618f6721b317afee388f64a78d3c96
|
233edcff3aa6dc5b49ce4969d2da628496372fd4
|
/src/main/java/org/folio/rest/impl/TransactionsApi.java
|
ce67788f34366a61f5c074b2dc5d8a686cc569d8
|
[
"Apache-2.0"
] |
permissive
|
aparnaapple40/mod-finance
|
e773aa67269a416662eb890dbbf906940a066d09
|
8bac751c494cab35af6c2b4d4608a8bc27cccd2a
|
refs/heads/master
| 2023-04-26T20:11:27.711862 | 2021-05-19T10:35:00 | 2021-05-19T10:35:00 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,008 |
java
|
package org.folio.rest.impl;
import static io.vertx.core.Future.succeededFuture;
import static org.apache.commons.lang.StringUtils.isEmpty;
import static org.folio.rest.util.ErrorCodes.MISMATCH_BETWEEN_ID_IN_PATH_AND_BODY;
import static org.folio.rest.util.HelperUtils.OKAPI_URL;
import static org.folio.rest.util.HelperUtils.getEndpoint;
import java.util.Map;
import javax.ws.rs.core.Response;
import org.folio.rest.annotations.Validate;
import org.folio.rest.core.models.RequestContext;
import org.folio.rest.exception.HttpException;
import org.folio.rest.jaxrs.model.Transaction;
import org.folio.rest.jaxrs.model.Transaction.TransactionType;
import org.folio.rest.jaxrs.resource.Finance;
import org.folio.services.transactions.TransactionService;
import org.folio.services.transactions.TransactionStrategyFactory;
import org.folio.spring.SpringContextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import io.vertx.core.AsyncResult;
import io.vertx.core.Context;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
public class TransactionsApi extends BaseApi implements Finance {
private static final String TRANSACTIONS_LOCATION_PREFIX = getEndpoint(Finance.class) + "/%s";
@Autowired
private TransactionStrategyFactory transactionStrategyFactory;
@Autowired
private TransactionService transactionService;
public TransactionsApi() {
SpringContextUtil.autowireDependencies(this, Vertx.currentContext());
}
@Validate
@Override
public void postFinanceAllocations(String lang, Transaction allocation, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
transactionStrategyFactory.createTransaction(Transaction.TransactionType.ALLOCATION, allocation, new RequestContext(vertxContext, okapiHeaders))
.thenAccept(type -> asyncResultHandler
.handle(succeededFuture(buildResponseWithLocation(okapiHeaders.get(OKAPI_URL), String.format(TRANSACTIONS_LOCATION_PREFIX, type.getId()), type))))
.exceptionally(fail -> handleErrorResponse(asyncResultHandler, fail));
}
@Validate
@Override
public void postFinanceTransfers(String lang, Transaction transfer, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
transactionStrategyFactory.createTransaction(Transaction.TransactionType.TRANSFER, transfer, new RequestContext(vertxContext, okapiHeaders))
.thenAccept(type -> asyncResultHandler
.handle(succeededFuture(buildResponseWithLocation(okapiHeaders.get(OKAPI_URL), String.format(TRANSACTIONS_LOCATION_PREFIX, type.getId()), type))))
.exceptionally(fail -> handleErrorResponse(asyncResultHandler, fail));
}
@Validate
@Override
public void postFinanceEncumbrances(String lang, Transaction encumbrance, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
transactionStrategyFactory.createTransaction(Transaction.TransactionType.ENCUMBRANCE, encumbrance, new RequestContext(vertxContext, okapiHeaders))
.thenAccept(type -> asyncResultHandler
.handle(succeededFuture(buildResponseWithLocation(okapiHeaders.get(OKAPI_URL), String.format(TRANSACTIONS_LOCATION_PREFIX, type.getId()), type))))
.exceptionally(fail -> handleErrorResponse(asyncResultHandler, fail));
}
@Validate
@Override
public void putFinanceEncumbrancesById(String id, String lang, Transaction encumbrance, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
if (isEmpty(encumbrance.getId())) {
encumbrance.setId(id);
}
if (id.equals(encumbrance.getId())) {
transactionStrategyFactory.updateTransaction(Transaction.TransactionType.ENCUMBRANCE, encumbrance, new RequestContext(vertxContext, okapiHeaders))
.thenAccept(types -> asyncResultHandler.handle(succeededFuture(buildNoContentResponse())))
.exceptionally(fail -> handleErrorResponse(asyncResultHandler, fail));
} else {
asyncResultHandler.handle(succeededFuture(buildErrorResponse(new HttpException(422, MISMATCH_BETWEEN_ID_IN_PATH_AND_BODY))));
}
}
@Validate
@Override
public void getFinanceTransactions(String query, int offset, int limit, String lang, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
transactionService.retrieveTransactions(query, offset, limit, new RequestContext(vertxContext, okapiHeaders))
.thenAccept(types -> asyncResultHandler.handle(succeededFuture(buildOkResponse(types))))
.exceptionally(fail -> handleErrorResponse(asyncResultHandler, fail));
}
@Validate
@Override
public void getFinanceTransactionsById(String id, String lang, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
transactionService.retrieveTransactionById(id, new RequestContext(vertxContext, okapiHeaders))
.thenAccept(type -> asyncResultHandler.handle(succeededFuture(buildOkResponse(type))))
.exceptionally(fail -> handleErrorResponse(asyncResultHandler, fail));
}
@Validate
@Override
public void postFinancePayments(String lang, Transaction payment, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
transactionStrategyFactory.createTransaction(Transaction.TransactionType.PAYMENT, payment, new RequestContext(vertxContext, okapiHeaders))
.thenAccept(type -> asyncResultHandler
.handle(succeededFuture(buildResponseWithLocation(okapiHeaders.get(OKAPI_URL), String.format(TRANSACTIONS_LOCATION_PREFIX, type.getId()), type))))
.exceptionally(fail -> handleErrorResponse(asyncResultHandler, fail));
}
@Validate
@Override
public void postFinancePendingPayments(String lang, Transaction pendingPayment, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
transactionStrategyFactory.createTransaction(Transaction.TransactionType.PENDING_PAYMENT, pendingPayment, new RequestContext(vertxContext, okapiHeaders))
.thenAccept(transaction -> asyncResultHandler
.handle(succeededFuture(buildResponseWithLocation(okapiHeaders.get(OKAPI_URL), String.format(TRANSACTIONS_LOCATION_PREFIX, transaction.getId()), transaction))))
.exceptionally(fail -> handleErrorResponse(asyncResultHandler, fail));
}
@Override
public void putFinancePendingPaymentsById(String id, String lang, Transaction pendingPayment,
Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
if (isEmpty(pendingPayment.getId())) {
pendingPayment.setId(id);
} else if (!id.equals(pendingPayment.getId())) {
asyncResultHandler.handle(succeededFuture(buildErrorResponse(new HttpException(422, MISMATCH_BETWEEN_ID_IN_PATH_AND_BODY))));
return;
}
transactionStrategyFactory.updateTransaction(
TransactionType.PENDING_PAYMENT, pendingPayment, new RequestContext(vertxContext, okapiHeaders))
.thenAccept(types -> asyncResultHandler.handle(succeededFuture(buildNoContentResponse())))
.exceptionally(fail -> handleErrorResponse(asyncResultHandler, fail));
}
@Validate
@Override
public void postFinanceCredits(String lang, Transaction credit, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
transactionStrategyFactory.createTransaction(Transaction.TransactionType.CREDIT, credit, new RequestContext(vertxContext, okapiHeaders))
.thenAccept(type -> asyncResultHandler
.handle(succeededFuture(buildResponseWithLocation(okapiHeaders.get(OKAPI_URL), String.format(TRANSACTIONS_LOCATION_PREFIX, type.getId()), type))))
.exceptionally(fail -> handleErrorResponse(asyncResultHandler, fail));
}
}
|
[
"[email protected]"
] | |
e9c9fa63328a8a8b572129cad7fb51f04ce11a20
|
a0745d32e6c949f0f9f6cd139b0e8efb32d052ee
|
/code/ShoppingPal/app/src/main/java/project/ca326/dcu/shoppingpal/CreateActivity.java
|
68d4631afa9ce6ffe346caa96c4921c6ee9f1a10
|
[] |
no_license
|
kyrilkhaletsky/3rd-Year-Project
|
4b7ec6c5bde4763926c9defb1e61a27e32468105
|
a4ee1314228ba42ab238db7222fabc09f9feb7be
|
refs/heads/master
| 2020-04-22T11:52:21.941875 | 2019-02-12T17:29:33 | 2019-02-12T17:29:33 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,574 |
java
|
package project.ca326.dcu.shoppingpal;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.util.ArrayList;
public class CreateActivity extends AppCompatActivity implements View.OnClickListener{
Button buttonSave;
Button buttonAdd;
EditText addName;
EditText addItems;
ListView showItems;
private String userID;
private FirebaseDatabase mFirebaseDatabase;
private FirebaseAuth mAuth;
private FirebaseAuth.AuthStateListener mAuthListener;
private DatabaseReference myRef;
ArrayList<String> items = new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create);
mAuth = FirebaseAuth.getInstance();
mFirebaseDatabase = FirebaseDatabase.getInstance();
myRef = mFirebaseDatabase.getReference();
FirebaseUser user = mAuth.getCurrentUser();
userID = user.getUid();
if(mAuth.getCurrentUser() == null){
finish();
startActivity(new Intent(this, MainActivity.class));
}
buttonSave = (Button)findViewById(R.id.buttonSave);
buttonAdd = (Button)findViewById(R.id.buttonAdd);
addName = (EditText)findViewById(R.id.etProfileName);
addItems = (EditText)findViewById(R.id.etItems);
showItems = (ListView)findViewById(R.id.lvItems);
buttonAdd.setOnClickListener(this);
buttonSave.setOnClickListener(this);
}
@Override
public void onClick(View view) {
//get the item from input
String getInput = addItems.getText().toString();
if (view == buttonAdd) {
//checks if item has already been added
if (items.contains(getInput.toLowerCase().trim())) {
Toast.makeText(getBaseContext(), "Item has already been Added", Toast.LENGTH_SHORT).show();
}
//doesn't allow the user to input empty string
else if (getInput == null || getInput.trim().equals("")) {
Toast.makeText(getBaseContext(), "Input field cannot be Empty", Toast.LENGTH_SHORT).show();
}
//if input ok change string to lowercase and remove any possible whitespace characters
else {
items.add(getInput.toLowerCase().replaceAll("\\s+",""));
//add item to an array and clear the field for the next item
ArrayAdapter<String> adapter = new ArrayAdapter<String>(CreateActivity.this, android.R.layout.simple_list_item_1, items);
showItems.setAdapter(adapter);
((EditText) findViewById(R.id.etItems)).setText("");
}
}
if (view == buttonSave) {
//remove possible whitespace
String key = addName.getText().toString().replaceAll("\\s+","");
//if array and name are not empty
if (!key.equals("") && !items.isEmpty()) {
//profile name(key) and according items in relation to the userID
myRef.child("users").child(userID).child(key).setValue(items);
//clear all fields for next Profile addition
((EditText) findViewById(R.id.etProfileName)).setText("");
showItems.setAdapter(null);
items.clear();
Toast.makeText(getBaseContext(), "Profile added Successfully", Toast.LENGTH_SHORT).show();
//reset the sharedPref value to 0 if a new profile was created
SharedPreferences sharedPref = getSharedPreferences("Preferences", 0);
SharedPreferences.Editor prefEditor = sharedPref.edit();
prefEditor.putInt("userProfile", 0);
prefEditor.apply();
}
//if any fields are left empty
else {
Toast.makeText(getBaseContext(), "Name or Item fields cannot be Empty", Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onBackPressed() {
finish();
}
}
|
[
"[email protected]"
] | |
5881687b4dc4cc16fc6c52729a08c6f29e57c695
|
a8c10a52bd2d63322824a7db515372958ec25e01
|
/src/test/java/jtdiff/util/TestEditOperation.java
|
62794c558deaddc1bc589a57a1e8202ae766c885
|
[] |
no_license
|
cagdasgerede/Veysel
|
c4ef3f42af6528f26067e34a3ebcd46ecfd27059
|
7972524edb3b74790dacda02be22f03a45997e4e
|
refs/heads/master
| 2020-04-06T04:21:19.444518 | 2017-04-07T21:48:57 | 2017-04-07T21:48:57 | 82,975,358 | 2 | 2 | null | 2017-04-07T21:48:58 | 2017-02-23T21:55:25 |
Java
|
UTF-8
|
Java
| false | false | 1,803 |
java
|
package jtdiff.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
public class TestEditOperation {
EditOperation mEditOperation;
@Before
public void setUp() {
mEditOperation = new EditOperation();
}
@Test
public void testType() {
mEditOperation.type(EditOperation.Type.INSERT);
assertEquals(EditOperation.Type.INSERT, mEditOperation.type());
mEditOperation.type(EditOperation.Type.DELETE);
assertEquals(EditOperation.Type.DELETE, mEditOperation.type());
mEditOperation.type(EditOperation.Type.CHANGE);
assertEquals(EditOperation.Type.CHANGE, mEditOperation.type());
mEditOperation.type(EditOperation.Type.NO_CHANGE);
assertEquals(EditOperation.Type.NO_CHANGE, mEditOperation.type());
}
@Test
public void testSourceNodePosition() {
mEditOperation.sourceNodePosition(42);
assertEquals(42, mEditOperation.sourceNodePosition());
}
@Test
public void testTargetNodePosition() {
mEditOperation.targetNodePosition(24);
assertEquals(24, mEditOperation.targetNodePosition());
}
@Test
public void testSourceNodeLabel() {
mEditOperation.sourceNodeLabel("source");
assertEquals("source", mEditOperation.sourceNodeLabel());
}
@Test
public void testTargetNodeLabel() {
mEditOperation.targetNodeLabel("target");
assertEquals("target", mEditOperation.targetNodeLabel());
}
@Test
public void testToString() {
mEditOperation
.type(EditOperation.Type.INSERT)
.sourceNodePosition(42)
.sourceNodeLabel("source")
.targetNodePosition(24)
.targetNodeLabel("target");
assertEquals("<INSERT, 42, source, 24, target>",
mEditOperation.toString());
}
}
|
[
"[email protected]"
] | |
4b2635bb4e5cf3f23d97cf0dff251aeaf175c0e3
|
ce63e4d11ba949ad00ef766365f4a0a68913dde3
|
/HtmlCreate/src/HtmlCreate/create.java
|
6cc1855ec7acfb454d04ad2cbfa41279a39f5e17
|
[] |
no_license
|
shironatan/Create_HTML
|
af2cb8d02b693febab10b8807478acd233273339
|
2d65e58ebb23f54abf2ca58ab487cb01b29038b9
|
refs/heads/master
| 2020-04-07T18:45:16.585021 | 2018-11-22T00:48:21 | 2018-11-22T00:48:21 | 158,622,208 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,997 |
java
|
package HtmlCreate;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.EtchedBorder;
public class create extends JFrame implements ActionListener{
public static void main(String[] args) {
// TODO ่ชๅ็ๆใใใใกใฝใใใปในใฟใ
create frame = new create("Create html");
frame.setVisible(true);
}
public JTextField text1;
public JTextField text2;
public JTextArea area1;
create(String title) {
setTitle(title);
setBounds(100, 100, 300, 250);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel top = new JPanel();
JLabel label1 = new JLabel("Create html");
top.add(label1);
JLabel label2 = new JLabel("File name");
top.add(label2); //1่ก็ฎ
label2.setHorizontalAlignment(JLabel.CENTER);
text1 = new JTextField(10);
top.add(text1); //1่ก็ฎ
JLabel label3 = new JLabel("Title");
label3.setHorizontalAlignment(JLabel.LEFT);
top.add(label3); //2่ก็ฎ
text2 = new JTextField(10);
top.add(text2); //2่ก็ฎ
JLabel label4 = new JLabel("Contents");
top.add(label4); //3่ก็ฎ
label4.setHorizontalAlignment(JLabel.LEFT);
area1 = new JTextArea();
area1.setPreferredSize(new Dimension(180,40));
area1.setLineWrap(true);
area1.setBorder(new EtchedBorder(EtchedBorder.LOWERED));
top.add(area1);
JLabel label5 = new JLabel("Title");
top.add(label5); //4่ก็ฎ
JButton btn = new JButton("Push");
btn.addActionListener(this);
top.add(btn);
Container contentPane = getContentPane();
contentPane.add(top, BorderLayout.CENTER);
}
public void actionPerformed(ActionEvent e) {
fileTest4 filetest = new fileTest4();
filetest.setfileTest4(text1.getText(),text2.getText(),area1.getText());
}
}
|
[
"[email protected]"
] | |
f90798789c0c62cb141316eba545b5587dba7f9c
|
724748a8008b9b85ded9535dc8bd7a11ae1dd20f
|
/function/udf/string/IfNullKudf.java
|
6d6ade6084fa113763efc0de388460727efbd8be
|
[
"Apache-2.0"
] |
permissive
|
Chengyanliang/ksql-machine-learning-udf
|
e42985b1db0d9f3d8e64bf02e1f395fe45b30a56
|
e26c1eb34c7b938761ac91d34b234c6825bedf2c
|
refs/heads/master
| 2020-04-07T18:27:36.164832 | 2018-03-26T12:36:24 | 2018-03-26T12:36:24 | 158,610,934 | 1 | 0 |
Apache-2.0
| 2018-11-21T21:58:32 | 2018-11-21T21:58:32 | null |
UTF-8
|
Java
| false | false | 1,101 |
java
|
/**
* Copyright 2017 Confluent Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package io.confluent.ksql.function.udf.string;
import io.confluent.ksql.function.KsqlFunctionException;
import io.confluent.ksql.function.udf.Kudf;
public class IfNullKudf implements Kudf {
@Override
public void init() {
}
@Override
public Object evaluate(Object... args) {
if (args.length != 2) {
throw new KsqlFunctionException("IfNull udf should have two input argument.");
}
if (args[0] == null) {
return args[1];
} else {
return args[0];
}
}
}
|
[
"[email protected]"
] | |
a5f8a29855e2a2fcdfced2a87d694357830c27b2
|
34221f3f7738d7a33c693e580dc6a99789349cf3
|
/app/src/main/java/defpackage/bgi.java
|
965e821caff6413a9669875c58970873660943f5
|
[] |
no_license
|
KobeGong/TasksApp
|
0c7b9f3f54bc4be755b1f605b41230822d6f9850
|
aacdd5cbf0ba073460797fa76f1aaf2eaf70f08e
|
refs/heads/master
| 2023-08-16T07:11:13.379876 | 2021-09-25T17:38:57 | 2021-09-25T17:38:57 | 374,659,931 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 620 |
java
|
package defpackage;
/* renamed from: bgi reason: default package */
/* compiled from: PG */
abstract class bgi extends defpackage.bca {
public bgi(defpackage.ayp ayp) {
super(defpackage.bgh.b, ayp);
}
public final /* bridge */ /* synthetic */ void a(java.lang.Object obj) {
super.a((defpackage.ayw) (com.google.android.gms.common.api.Status) obj);
}
public final /* synthetic */ defpackage.ayw a(com.google.android.gms.common.api.Status status) {
if (status == null) {
return com.google.android.gms.common.api.Status.c;
}
return status;
}
}
|
[
"[email protected]"
] | |
cf1f7849f80a55392cbba1f845317a9604eb12c3
|
6a167c502daebecfd0a1395b4e556000052c222f
|
/gwt28-ol3-wrapper/src/main/java/ol/control/Zoom.java
|
f3cfb7e4c3ea1ad589a2d33d036c40a6bde37a49
|
[
"Apache-2.0"
] |
permissive
|
danmoldo/OpenLayers3GWT2.8Wrapper
|
3a7dd55d72160e5f0d2168808806ced00b363128
|
1dccb216ca4c2254b960d98b4c1d68a44123b395
|
refs/heads/master
| 2021-01-10T12:48:28.677361 | 2018-06-11T10:58:42 | 2018-06-11T10:58:42 | 47,361,722 | 3 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 160 |
java
|
package ol.control;
import jsinterop.annotations.JsType;
/**
* @author Dan Moldovan
*/
@JsType(isNative = true)
public interface Zoom extends Control {
}
|
[
"mihai.stanciu85"
] |
mihai.stanciu85
|
95bf62df42200cd2f460dfd578d09528f09f617c
|
ba031393afb7976bf53407d5d4c0efd7d35e4afc
|
/src/main/java/com/krawlly/util/ticket/CertificateData.java
|
75eaad10a6c3e6fab44a3593d27c36fbc6bc049c
|
[] |
no_license
|
Krawlly/LoginTicketJAVA
|
a56eba81a276adc939a9003cba580062b52ff999
|
c8915ab889e348afab8e0b6f3ead840a11dd8e53
|
refs/heads/master
| 2021-01-01T05:14:27.835249 | 2016-04-21T18:16:19 | 2016-04-21T18:16:19 | 56,779,979 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 766 |
java
|
package com.krawlly.util.ticket;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import com.krawlly.util.ticket.TicketFactory.CertificateProvider;
public class CertificateData implements CertificateProvider {
private final byte[] cert;
public CertificateData(byte[] certificate) {
this.cert = certificate;
}
public Certificate getCertificate(CertificateFactory cf) throws IOException, CertificateException {
InputStream is = null;
try {
is = new ByteArrayInputStream(cert);
return cf.generateCertificate(is);
} finally {
if (is != null)
is.close();
}
}
}
|
[
"[email protected]"
] | |
6bbcfcd59fdc973319baf89ab59630f42bc211b2
|
c118afcbac955f054c36acbb4376c9e9aebf480e
|
/src/main/java/com/tmk/uploadmanager/control/MainController.java
|
35d10ffb635749309b0be8a6697dec2bd79da7be
|
[
"MIT"
] |
permissive
|
thetmk/UploadManager
|
c5009c5da2492f92c7ec41f9d64e6b174ac95019
|
579488b450a2c68a3aeff1157630b69c046157bb
|
refs/heads/master
| 2016-09-06T11:37:27.174755 | 2015-04-06T14:22:40 | 2015-04-06T14:22:40 | 31,236,292 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 16,441 |
java
|
package com.tmk.uploadmanager.control;
import com.tmk.uploadmanager.model.CollectionList;
import com.tmk.uploadmanager.model.CollectionListModel;
import com.tmk.uploadmanager.model.Serializer;
import com.tmk.uploadmanager.model.Upload;
import com.tmk.uploadmanager.model.UploadCollection;
import com.tmk.uploadmanager.view.MainFrame;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import org.apache.commons.io.FilenameUtils;
/**
* Controls the main gui window
*
* @author tmk
*/
public class MainController {
/**
* GUI Class instance
*/
private MainFrame mainFrame;
/**
* Non-static class with nested classes for certain ActionListeners
*/
private MainFrameActions actions;
/**
* CollectionList instance which stores UploadCollection instances
*/
private CollectionList collection;
/**
* Constructor
*/
public MainController() {
try {
SwingUtilities.invokeAndWait(() -> {
mainFrame = new MainFrame();
setUpMainGui();
setUpActionListeners();
});
} catch (InterruptedException | InvocationTargetException ex) {
Logger.getLogger(MainController.class.getName()).log(Level.SEVERE, null, ex);
}
collection = new CollectionList();
}
/**
* Sets some basic GUI stuff
*/
private void setUpMainGui() {
mainFrame.setTitle("Upload Manager");
mainFrame.setMinimumSize(new Dimension(1100, 600));
mainFrame.setLocationRelativeTo(null);
mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
mainFrame.pack();
mainFrame.setVisible(true);
}
/**
* Add ActionListeners to all buttons
*/
private void setUpActionListeners() {
actions = new MainFrameActions(this);
mainFrame.getButton("cSave").addActionListener(actions.new SaveBtnAction());
mainFrame.getButton("cLoad").addActionListener(actions.new LoadBtnAction());
mainFrame.getButton("cMkdir").addActionListener(actions.new CopyMkdirBtnAction());
mainFrame.getButton("uName").addActionListener(actions.new CopyNameBtnAction());
mainFrame.getButton("uTags").addActionListener(actions.new CopyTagsBtnAction());
mainFrame.getButton("uCopy").addActionListener(actions.new CopyBtnAction());
mainFrame.getButton("uSave").addActionListener(actions.new SaveUploadBtnAction());
mainFrame.getButton("tEdit").addActionListener(actions.new EditTemplateBtnAction());
mainFrame.getButton("cAdd").addActionListener(actions.new AddUploadBtnAction());
mainFrame.getButton("cRemove").addActionListener(actions.new RemoveUploadBtnAction());
mainFrame.getButton("clAdd").addActionListener(actions.new AddCollectionBtnAction());
mainFrame.getButton("clRemove").addActionListener(actions.new RemoveCollectionBtnAction());
mainFrame.getButton("cName").addActionListener(actions.new NameSetBtnAction());
mainFrame.getButton("cTags").addActionListener(actions.new TagsSetBtnAction());
mainFrame.getUploadList().addListSelectionListener(actions.new UploadSelectionListener());
mainFrame.getCollectionList().addListSelectionListener(actions.new CollectionSelectionListener());
}
/**
* Update the title of an upload. Refreshes the Upload List
*
* @param coll UploadCollection which contains the upload
* @param oldName old title
* @param newName new title
*/
public void updateUploadTitle(UploadCollection coll, String oldName, String newName) {
if (coll.contains(oldName) && !coll.contains(newName)) {
Upload up = coll.getUpload(oldName);
up.setTitle(newName);
coll.removeUpload(oldName);
coll.addUpload(newName, up);
SwingUtilities.invokeLater(() -> {
CollectionListModel model = mainFrame.getUploadListModel();
model.removeElement(oldName);
model.addElement(newName);
model.sort();
});
}
}
/**
* Update the name of an UploadCollection. Refreshes the Collection List
*
* @param oldName old name
* @param newName new name
*/
public void updateCollectionName(String oldName, String newName) {
if (collection.contains(oldName) && !collection.contains(newName)) {
UploadCollection uc = collection.getCollection(oldName);
uc.setName(newName);
collection.removeCollection(oldName);
collection.addCollection(newName, uc);
SwingUtilities.invokeLater(() -> {
CollectionListModel model = mainFrame.getCollectionListModel();
model.removeElement(oldName);
model.addElement(newName);
model.sort();
});
}
}
/**
* Open a FileChooser to determine a file to save a serialized representation
* of the current CollectionList instance to. Called when the save button is
* clicked
*/
public void saveAction() {
SwingUtilities.invokeLater(() -> {
JFileChooser fileChooser = new JFileChooser();
FileFilter filter = new FileNameExtensionFilter("Upload collection (*.ucoll)", new String[]{"ucoll"});
fileChooser.addChoosableFileFilter(filter);
fileChooser.setFileFilter(filter);
int returnVal = fileChooser.showSaveDialog(mainFrame);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
if (file == null) {
return;
}
String path = file.getAbsolutePath();
if (FilenameUtils.getExtension(file.getName()).isEmpty() || !FilenameUtils.getExtension(file.getName()).equalsIgnoreCase("ucoll")) {
path = path.concat(".ucoll");
}
String filePath = path;
Thread thread = new Thread(() -> {
try {
Serializer.save(collection, filePath);
} catch (IOException ex) {
Logger.getLogger(MainController.class.getName()).log(Level.SEVERE, null, ex);
}
});
thread.start();
}
});
}
/**
* Opens a FileChooser to load a serialized CollectionList. Called when the
* load button is clicked
*/
public void loadAction() {
SwingUtilities.invokeLater(() -> {
JFileChooser fileChooser = new JFileChooser();
FileFilter filter = new FileNameExtensionFilter("Upload collection (*.ucoll)", new String[]{"ucoll"});
fileChooser.addChoosableFileFilter(filter);
fileChooser.setFileFilter(filter);
int returnVal = fileChooser.showOpenDialog(mainFrame);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
if (file == null) {
return;
} else if (!file.exists() || !file.canRead()) {
throw new RuntimeException(String.format("Unable to read data file %s", file.getAbsolutePath()));
}
String filePath = file.getAbsolutePath();
Thread thread = new Thread(() -> {
try {
collection = Serializer.load(filePath);
SwingUtilities.invokeLater(() -> {
updateView(); // Update the collection list on the main frame
});
} catch (IOException ex) {
Logger.getLogger(MainController.class.getName()).log(Level.SEVERE, null, ex);
}
});
thread.start();
}
});
}
/**
* Saves the template value to the current collection. Called when the
* template button is clicked
*/
public void editTemplateAction() {
getSelectedCollection().setTemplate(mainFrame.getTemplate().getText());
}
/**
* Returns the currently selected Upload
*
* @return selected upload
*/
public Upload getSelectedUpload() {
JList uploadList = mainFrame.getUploadList();
String current = (String) uploadList.getSelectedValue();
UploadCollection uc = getSelectedCollection();
if (uc != null && uc.contains(current)) {
return uc.getUpload(current);
}
return null;
}
/**
* Returns the currently selected UploadCollection
*
* @return selected collection
*/
public UploadCollection getSelectedCollection() {
JList collectionList = mainFrame.getCollectionList();
String current = (String) collectionList.getSelectedValue();
if (collection.contains(current)) {
return collection.getCollection(current);
}
return null;
}
/**
* Updates the Upload instance of the currently selected upload with values
* from the GUI. Called when the Save button is clicked.
*/
public void saveUploadAction() {
SwingUtilities.invokeLater(() -> {
Upload up = getSelectedUpload();
if (up != null) {
JTextField title = mainFrame.getTextField("uTitle");
if (!up.getTitle().equals(title.getText())) {
updateUploadTitle(getSelectedCollection(), up.getTitle(), title.getText());
}
up.setCover(mainFrame.getTextField("uCover").getText());
up.setTags(mainFrame.getTextField("uTags").getText());
up.setImage(mainFrame.getTextField("uImage").getText());
up.setDescription(mainFrame.getDescription().getText());
}
});
}
/**
* Asks for a collection name and adds a new collection with that name.
*/
public void addCollectionAction() {
SwingUtilities.invokeLater(() -> {
String name = JOptionPane.showInputDialog("Please enter the collection title");
if (name != null) {
name = name.trim();
}
CollectionListModel model = mainFrame.getCollectionListModel();
if (!collection.contains(name)) {
UploadCollection uc = new UploadCollection(name, "", "");
collection.addCollection(name, uc);
model.addElement(name);
model.sort();
}
});
}
/**
* Removes the currently selected collection
*/
public void removeCollectionAction() {
SwingUtilities.invokeLater(() -> {
UploadCollection selected = getSelectedCollection();
if (collection.contains(selected.getName())) {
collection.removeCollection(selected.getName());
SwingUtilities.invokeLater(() -> {
mainFrame.getCollectionList().clearSelection();
CollectionListModel model = mainFrame.getCollectionListModel();
model.removeElement(selected.getName());
});
}
});
}
/**
* Asks for a new upload name and adds a new Upload with that name
*/
public void addUploadAction() {
SwingUtilities.invokeLater(() -> {
String name = JOptionPane.showInputDialog("Please enter the upload title");
if (name != null) {
name = name.trim();
}
CollectionListModel model = mainFrame.getUploadListModel();
if (!getSelectedCollection().contains(name)) {
Upload up = new Upload(name, "", "", "", "");
getSelectedCollection().addUpload(name, up);
model.addElement(name);
model.sort();
}
});
}
/**
* Remove the currently selected upload
*/
public void removeUploadAction() {
SwingUtilities.invokeLater(() -> {
Upload u = getSelectedUpload();
UploadCollection uc = getSelectedCollection();
if (u != null && uc != null) {
uc.removeUpload(u.getTitle());
SwingUtilities.invokeLater(() -> {
mainFrame.getUploadList().clearSelection();
CollectionListModel model = mainFrame.getUploadListModel();
model.removeElement(u.getTitle());
});
}
});
}
/**
* Fill the collection template with data from the current upload and save it
* to clipboard
*/
public void copyAction() {
SwingUtilities.invokeLater(() -> {
Upload up = getSelectedUpload();
if (up != null) {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
StringSelection s = new StringSelection(getSelectedCollection().format(up));
clipboard.setContents(s, s);
}
});
}
/**
* Copy a combination of the current collection name and current upload name
* into clipboard
*/
public void copyNameAction() {
SwingUtilities.invokeLater(() -> {
UploadCollection uc = getSelectedCollection();
Upload up = getSelectedUpload();
if (up != null) {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
StringSelection s = new StringSelection(String.format("%s - %s", uc.getName(), up.getTitle()));
clipboard.setContents(s, s);
}
});
}
/**
* Concatenates and copies the current collection's und upload's tags to
* clipboard
*/
public void copyTagsAction() {
SwingUtilities.invokeLater(() -> {
UploadCollection uc = getSelectedCollection();
Upload up = getSelectedUpload();
if (up != null) {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
StringSelection s = new StringSelection(String.format("%s %s", uc.getTags(), up.getTags()));
clipboard.setContents(s, s);
}
});
}
/**
* Copy mkdir commands for each upload in the current collection to clipboard
*/
public void copyMkdirAction() {
SwingUtilities.invokeLater(() -> {
JList collectionList = mainFrame.getUploadList();
UploadCollection col = getSelectedCollection();
StringBuilder mkdir = new StringBuilder();
for (String key : col.getCollection().keySet()) {
Upload up = col.getUpload(key);
mkdir.append(String.format("mkdir \"%s - %s\"\n", col.getName(), up.getTitle()));
}
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
StringSelection s = new StringSelection(mkdir.toString());
clipboard.setContents(s, s);
});
}
/**
* Update the name of the current collection with the value from the GUI
*/
public void nameSetAction() {
UploadCollection uc = getSelectedCollection();
String newName = mainFrame.getTextField("cName").getText();
updateCollectionName(uc.getName(), newName);
}
/**
* Update the tags of the current collection with the value from the GUI
*/
public void tagsSetAction() {
UploadCollection uc = getSelectedCollection();
String tags = mainFrame.getTextField("cTags").getText();
uc.setTags(tags);
}
/**
* Updates the GUI when a collection is selected
*
* @param idx Index of the JList element that was selected
*/
public void collectionSelected(int idx) {
// Update GUI
SwingUtilities.invokeLater(() -> {
CollectionListModel model = mainFrame.getUploadListModel();
JTextField title = mainFrame.getTextField("uTitle");
JTextField tags = mainFrame.getTextField("uTags");
JTextField cover = mainFrame.getTextField("uCover");
JTextField image = mainFrame.getTextField("uImage");
JTextArea desc = mainFrame.getDescription();
if (idx < 0 || idx >= model.capacity()) {
if (idx == -1) {
title.setText(null);
tags.setText(null);
cover.setText(null);
image.setText(null);
desc.setText(null);
model.clear();
}
return;
}
UploadCollection uc = getSelectedCollection();
if (uc != null) {
model.clear();
for (String key : uc.getCollection().keySet()) {
model.addElement(key);
}
model.sort();
mainFrame.getTemplate().setText(uc.getTemplate());
mainFrame.getTextField("cName").setText(uc.getName());
mainFrame.getTextField("cTags").setText(uc.getTags());
}
});
}
/**
* Updates the GUI when an upload is selected
*
* @param idx Index of the JList element that was selected
*/
public void uploadSelected(int idx) {
// Update GUI
SwingUtilities.invokeLater(() -> {
CollectionListModel model = mainFrame.getUploadListModel();
JTextField title = mainFrame.getTextField("uTitle");
JTextField tags = mainFrame.getTextField("uTags");
JTextField cover = mainFrame.getTextField("uCover");
JTextField image = mainFrame.getTextField("uImage");
JTextArea desc = mainFrame.getDescription();
if (idx < 0 || idx >= model.capacity()) {
if (idx == -1) {
title.setText(null);
tags.setText(null);
cover.setText(null);
image.setText(null);
desc.setText(null);
}
return;
}
String selected = (String) model.get(idx);
UploadCollection col = getSelectedCollection();
if (col.contains(selected)) {
Upload up = col.getUpload(selected);
title.setText(up.getTitle());
tags.setText(up.getTags());
cover.setText(up.getCover());
image.setText(up.getImage());
desc.setText(up.getDescription());
}
});
}
/**
* Replaces the contents of the collection JList
*/
public void updateView() {
SwingUtilities.invokeLater(() -> {
CollectionListModel cmodel = mainFrame.getCollectionListModel();
cmodel.clear();
for (String key : collection.getList().keySet()) {
cmodel.addElement(key);
}
cmodel.sort();
});
}
}
|
[
"[email protected]"
] | |
0af643e473be9cbc7ea2a628adcd11a94c5bf7b8
|
7781b0ed557dc48c88dd866cde810e4a1192c717
|
/src/main/java/com/xiaoxiong/nbst01/net/RestResultGenerator.java
|
f8a86ad5b4b35ad5b17252d5a9b0c9b000268f14
|
[] |
no_license
|
IkeFan/NBSt01
|
937cefd4f78ce1453850843083d6085aeb635ca2
|
84b67a011da00ca7ace0d0c3eb47252e26c93348
|
refs/heads/master
| 2020-03-15T09:28:04.210763 | 2018-05-25T06:40:54 | 2018-05-25T06:40:54 | 132,075,380 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,153 |
java
|
package com.xiaoxiong.nbst01.net;
import com.xiaoxiong.nbst01.common.AppException;
import com.xiaoxiong.nbst01.common.ErrorCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* ็ๆrestResultๅทฅๅ
ท็ฑป
* Created by Administrator on 2017/2/23 0023.
*/
public class RestResultGenerator {
private static final Logger LOGGER = LoggerFactory.getLogger(RestResultGenerator.class);
/**
* normal
*
* @param success
* @param data
* @param message
* @param <T>
* @return
*/
public static <T> RestResult<T> genResult(boolean success, T data, int code, String message) {
RestResult<T> result = RestResult.newInstance();
result.setResult(success);
result.setData(data);
result.setCode(code);
result.setMessage(message);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("generate rest result:{}", result);
}
return result;
}
/**
* success
*
* @param data
* @param <T>
* @return
*/
public static <T> RestResult<T> genSuccessResult(T data) {
return genResult(true, data, ErrorCode.RESULT_SUCCESS.getCode(), null);
}
/**
* error message
*
* @param message error message
* @param <T>
* @return
*/
public static <T> RestResult<T> genErrorResult(int code, String message) {
return genResult(false, null, code, message);
}
/**
* errorCode message
*
* @param errorCode error message
* @param <T>
* @return
*/
public static <T> RestResult<T> genErrorResult(ErrorCode errorCode) {
return genResult(false, null, errorCode.getCode(), errorCode.getMessage());
}
/**
* error
*
* @param error error enum
* @param <T>
* @return
*/
public static <T> RestResult<T> genErrorResult(AppException error) {
return genErrorResult(error.getCode(), error.getMessage());
}
/**
* success no message
*
* @return
*/
public static RestResult genSuccessResult() {
return genSuccessResult(null);
}
}
|
[
"gh083102"
] |
gh083102
|
65e281f3f96c8e0df089907f324109e4a509109d
|
6b9da666a3e5e66bfe751adb7f9317c465c09a59
|
/src/ui/ATM.java
|
15f9c31b8644ac2d605a040a27de49eceba5e527
|
[] |
no_license
|
ksdrof500/NEW-ATM
|
7e8729af786890878f39317ad4b1e87efe0c8ec7
|
d6e9f744a4ae27b521cd2f454ca25f6baaab2710
|
refs/heads/master
| 2020-03-19T06:56:43.655118 | 2018-06-09T14:21:44 | 2018-06-09T14:21:44 | 136,069,304 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,399 |
java
|
package ui;
import common.Screen;
import interfaces.Menuinteraction;
import main.ATMCaseStudy;
import utils.Keypad;
import viewmodel.BalanceInquiry;
import viewmodel.Deposit;
import viewmodel.Withdrawal;
public class ATM extends Screen implements Menuinteraction {
private boolean userAuthenticated; // whether user is authenticated
private int currentAccountNumber; // current user's account number
private Keypad keypad; // ATM's keypad
// constants corresponding to main menu options
private static final int BALANCE_INQUIRY = 1;
private static final int WITHDRAWAL = 2;
private static final int DEPOSIT = 3;
private static final int EXIT = 4;
// no-argument ATM constructor initializes instance variables
public ATM() {
userAuthenticated = false; // user is not authenticated to start
currentAccountNumber = 0; // no current account number to start
keypad = Keypad.getInstance();
} // end no-argument ATM constructor
// start ATM
@Override
public void run() {
// welcome and authenticate user; perform transactions
while (true) {
// loop while user is not yet authenticated
while (!userAuthenticated) {
displayMessageLine("\nWelcome!");
authenticateUser(); // authenticate user
} // end while
menu(); // user is now authenticated
userAuthenticated = false; // reset before next ATM session
currentAccountNumber = 0; // reset before next ATM session
displayMessageLine("\nThank you! Goodbye!");
} // end while
} // end method run
@Override
public void menu() {
boolean userExited = false; // user has not chosen to exit
// loop while user has not chosen option to exit system
while (!userExited) {
// decide how to proceed based on user's menu selection
switch (displayMainMenu()) {
// user chose to perform one of three transaction types
case BALANCE_INQUIRY:
new BalanceInquiry(currentAccountNumber, this).execute();
break;
case WITHDRAWAL:
new Withdrawal(currentAccountNumber, this).execute();
break;
case DEPOSIT:
new Deposit(currentAccountNumber, this).execute();
break;
case EXIT: // user chose to terminate session
displayMessageLine("\nExiting the system...");
userExited = true; // this ATM session should end
break;
default: // user did not enter an integer from 1-4
displayMessageLine("\nYou did not enter a valid selection. Try again.");
break;
} // end switch
} // end while
} // end method performTransactions
// display the main menu and perform transactions
@Override
public int displayMainMenu() {
displayMessageLine("\nMain menu:");
displayMessageLine("1 - View my balance");
displayMessageLine("2 - Withdraw cash");
displayMessageLine("3 - Deposit funds");
displayMessageLine("4 - Exit\n");
displayMessage("Enter a choice: ");
return keypad.getInput(); // return user's selection
} // end method displayMainMenu
// attempts to authenticate user against database
private void authenticateUser() {
displayMessage("\nPlease enter your account number: ");
int accountNumber = keypad.getInput(); // input account number
displayMessage("\nEnter your PIN: "); // prompt for PIN
int pin = keypad.getInput(); // input PIN
// set userAuthenticated to boolean value returned by database
userAuthenticated = ATMCaseStudy.getPersistence().authenticateUser(accountNumber, pin);
// check whether authentication succeeded
if (userAuthenticated) {
currentAccountNumber = accountNumber; // save user's account #
} // end if
else
displayMessageLine("Invalid account number or PIN. Please try again.");
} // end method authenticateUser
@Override
public void displayBalance(double available, double total) {
displayMessageLine("\nBalance Information:");
displayMessage(" - Available balance: ");
displayDollarAmount(available);
displayMessage("\n - Total balance: ");
displayDollarAmount(total);
displayMessageLine("");
}
@Override
public int displayAmount() {
displayMessageLine("\nWithdrawal Menu:");
displayMessageLine("1 - $20");
displayMessageLine("2 - $40");
displayMessageLine("3 - $60");
displayMessageLine("4 - $100");
displayMessageLine("5 - $200");
displayMessageLine("6 - Cancel transaction");
displayMessage("\nChoose a withdrawal amount: ");
return Keypad.getInstance().getInput(); // get user input through keypad
}
} // end class ATM
|
[
"[email protected]"
] | |
3b44890b9d7117c6fde9f22d167d5d855f19879a
|
77ecfc86a29f7016fe2e7cc4cac6c4c475ca6b5d
|
/trunk/src/main/java/com/lwxf/newstore/webapp/domain/entity/company/Company.java
|
61a12230ae6e71c2deb703891b67e946bae4000a
|
[] |
no_license
|
mingyuan1031/microservicecloud-config
|
967a0784715567efadcd55a2b702cff265ab86f0
|
19aa4932ae1bb12302a277cf0cebbf71bafb91ba
|
refs/heads/master
| 2020-03-27T04:34:39.737990 | 2018-08-31T00:41:54 | 2018-08-31T00:41:54 | 145,951,368 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,703 |
java
|
package com.lwxf.newstore.webapp.domain.entity.company;
import java.util.*;
import java.sql.*;
import java.util.Date;
import java.util.Arrays;
import java.util.List;
import com.lwxf.mybatis.utils.TypesExtend;
import com.lwxf.commons.exception.ErrorCodes;
import com.lwxf.commons.utils.DataValidatorUtils;
import com.lwxf.commons.utils.LwxfStringUtils;
import com.lwxf.mybatis.annotation.Table;
import com.lwxf.mybatis.annotation.Column;
import com.lwxf.newstore.webapp.domain.entity.base.IdEntity;
import com.lwxf.mybatis.utils.MapContext;
import com.lwxf.newstore.webapp.common.result.RequestResult;
import com.lwxf.newstore.webapp.common.result.ResultFactory;
/**
* ๅ่ฝ๏ผcompany ๅฎไฝ็ฑป
*
* @author๏ผF_baisi([email protected])
* @created๏ผ2018-06-29 06:50
* @version๏ผ2018 Version๏ผ1.0
* @company๏ผ่ๅฑๆฐๆฟ Created with IntelliJ IDEA
*/
@Table(name = "company",displayName = "company")
public class Company extends IdEntity {
private static final long serialVersionUID = 1L;
@Column(type = Types.VARCHAR,length = 50,nullable = false,name = "name",displayName = "")
private String name;
public Company() {
}
public RequestResult validateFields() {
Map<String, String> validResult = new HashMap<>();
if (this.name == null) {
validResult.put("name", ErrorCodes.VALIDATE_NOTNULL);
}else{
if (LwxfStringUtils.getStringLength(this.name) > 50) {
validResult.put("name", ErrorCodes.VALIDATE_LENGTH_TOO_LONG);
}
}
if(validResult.size()>0){
return ResultFactory.generateErrorResult(ErrorCodes.VALIDATE_ERROR,validResult);
}else {
return null;
}
}
private final static List<String> propertiesList = Arrays.asList("name");
public static RequestResult validateFields(MapContext map) {
Map<String, String> validResult = new HashMap<>();
if(map.size()==0){
return ResultFactory.generateErrorResult("error",ErrorCodes.VALIDATE_NOTNULL);
}
boolean flag;
Set<String> mapSet = map.keySet();
flag = propertiesList.containsAll(mapSet);
if(!flag){
return ResultFactory.generateErrorResult("error",ErrorCodes.VALIDATE_ILLEGAL_ARGUMENT);
}
if(map.containsKey("name")) {
if (map.getTypedValue("name",String.class) == null) {
validResult.put("name", ErrorCodes.VALIDATE_NOTNULL);
}else{
if (LwxfStringUtils.getStringLength(map.getTypedValue("name",String.class)) > 50) {
validResult.put("name", ErrorCodes.VALIDATE_LENGTH_TOO_LONG);
}
}
}
if(validResult.size()>0){
return ResultFactory.generateErrorResult(ErrorCodes.VALIDATE_ERROR,validResult);
}else {
return null;
}
}
public void setName(String name){
this.name=name;
}
public String getName(){
return name;
}
}
|
[
"[email protected]"
] | |
101fe4f0a0e427cec7d13177db4794013c0a0046
|
61a41881c738d8befa1e38b61516d95efedb4b7c
|
/org/knowm/xchart/style/AbstractBaseTheme.java
|
f3cd6cc36ef147879428a4e1a259d36bfde92263
|
[] |
no_license
|
yanchespenda/Clustering-K-Means
|
26994a1896da53ccd097391b2a53ea9579106651
|
4126a9f1c9de4f55745bc96dafd0950c30532c04
|
refs/heads/master
| 2020-05-27T18:03:39.710381 | 2019-06-19T14:29:54 | 2019-06-19T14:29:54 | 188,734,655 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,544 |
java
|
package org.knowm.xchart.style;
import java.awt.*;
import org.knowm.xchart.style.PieStyler.AnnotationType;
import org.knowm.xchart.style.Styler.LegendPosition;
import org.knowm.xchart.style.Styler.ToolTipType;
import org.knowm.xchart.style.colors.BaseSeriesColors;
import org.knowm.xchart.style.colors.ChartColor;
import org.knowm.xchart.style.lines.BaseSeriesLines;
import org.knowm.xchart.style.markers.BaseSeriesMarkers;
import org.knowm.xchart.style.markers.Marker;
/**
* @author timmolter
* @author ekleinod
*/
public abstract class AbstractBaseTheme implements Theme {
private static final Font BASE_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 10);
// Chart Style ///////////////////////////////
@Override
public Font getBaseFont() {
return BASE_FONT;
}
@Override
public Color getChartBackgroundColor() {
return ChartColor.getAWTColor(ChartColor.WHITE);
}
@Override
public Color getChartFontColor() {
return ChartColor.getAWTColor(ChartColor.BLACK);
}
@Override
public int getChartPadding() {
return 10;
}
// SeriesMarkers, SeriesLines, SeriesColors ///////////////////////////////
@Override
public Color[] getSeriesColors() {
return new BaseSeriesColors().getSeriesColors();
}
@Override
public Marker[] getSeriesMarkers() {
return new BaseSeriesMarkers().getSeriesMarkers();
}
@Override
public BasicStroke[] getSeriesLines() {
return new BaseSeriesLines().getSeriesLines();
}
// Chart Title ///////////////////////////////
/** Base font, bold, size 14. */
@Override
public Font getChartTitleFont() {
return getBaseFont().deriveFont(Font.BOLD).deriveFont(14f);
}
@Override
public boolean isChartTitleVisible() {
return true;
}
@Override
public boolean isChartTitleBoxVisible() {
return true;
}
@Override
public Color getChartTitleBoxBackgroundColor() {
return ChartColor.getAWTColor(ChartColor.WHITE);
}
@Override
public Color getChartTitleBoxBorderColor() {
return ChartColor.getAWTColor(ChartColor.WHITE);
}
@Override
public int getChartTitlePadding() {
return 5;
}
// Chart Legend ///////////////////////////////
@Override
public Font getLegendFont() {
return getBaseFont().deriveFont(11f);
}
@Override
public boolean isLegendVisible() {
return true;
}
@Override
public Color getLegendBackgroundColor() {
return ChartColor.getAWTColor(ChartColor.WHITE);
}
@Override
public Color getLegendBorderColor() {
return ChartColor.getAWTColor(ChartColor.DARK_GREY);
}
@Override
public int getLegendPadding() {
return 10;
}
@Override
public int getLegendSeriesLineLength() {
return 24;
}
@Override
public LegendPosition getLegendPosition() {
return LegendPosition.OutsideE;
}
// Chart Axes ///////////////////////////////
@Override
public boolean isXAxisTitleVisible() {
return true;
}
@Override
public boolean isYAxisTitleVisible() {
return true;
}
@Override
public Font getAxisTitleFont() {
return getBaseFont().deriveFont(Font.BOLD).deriveFont(12f);
}
@Override
public boolean isXAxisTicksVisible() {
return true;
}
@Override
public boolean isYAxisTicksVisible() {
return true;
}
@Override
public Font getAxisTickLabelsFont() {
return getAxisTitleFont();
}
@Override
public int getAxisTickMarkLength() {
return 3;
}
@Override
public int getAxisTickPadding() {
return 4;
}
@Override
public Color getAxisTickMarksColor() {
return ChartColor.getAWTColor(ChartColor.DARK_GREY);
}
@Override
public Stroke getAxisTickMarksStroke() {
return new BasicStroke(1.0f);
}
@Override
public Color getAxisTickLabelsColor() {
return ChartColor.getAWTColor(ChartColor.BLACK);
}
@Override
public boolean isAxisTicksLineVisible() {
return true;
}
@Override
public boolean isAxisTicksMarksVisible() {
return true;
}
@Override
public int getAxisTitlePadding() {
return 10;
}
@Override
public int getXAxisTickMarkSpacingHint() {
return 74;
}
@Override
public int getYAxisTickMarkSpacingHint() {
return 44;
}
// Chart Plot Area ///////////////////////////////
@Override
public boolean isPlotGridLinesVisible() {
return true;
}
@Override
public boolean isPlotGridVerticalLinesVisible() {
return true;
}
@Override
public boolean isPlotGridHorizontalLinesVisible() {
return true;
}
@Override
public Color getPlotBackgroundColor() {
return ChartColor.getAWTColor(ChartColor.WHITE);
}
@Override
public Color getPlotBorderColor() {
return ChartColor.getAWTColor(ChartColor.DARK_GREY);
}
@Override
public boolean isPlotBorderVisible() {
return true;
}
@Override
public boolean isPlotTicksMarksVisible() {
return true;
}
@Override
public Color getPlotGridLinesColor() {
return ChartColor.getAWTColor(ChartColor.GREY);
}
@Override
public Stroke getPlotGridLinesStroke() {
return new BasicStroke(
1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10.0f, new float[] {3.0f, 5.0f}, 0.0f);
}
@Override
public double getPlotContentSize() {
return .92;
}
@Override
public int getPlotMargin() {
return 4;
}
// Tool Tips ///////////////////////////////
@Override
public boolean isToolTipsEnabled() {
return false;
}
@Override
public ToolTipType getToolTipType() {
return ToolTipType.xAndYLabels;
}
@Override
public Font getToolTipFont() {
return BASE_FONT;
}
@Override
public Color getToolTipBackgroundColor() {
return ChartColor.getAWTColor(ChartColor.WHITE);
}
@Override
public Color getToolTipBorderColor() {
return ChartColor.getAWTColor(ChartColor.DARK_GREY);
}
@Override
public Color getToolTipHighlightColor() {
return ChartColor.getAWTColor(ChartColor.LIGHT_GREY);
}
// Category Charts ///////////////////////////////
@Override
public double getAvailableSpaceFill() {
return 0.9;
}
@Override
public boolean isOverlapped() {
return false;
}
// Pie Charts ///////////////////////////////
@Override
public boolean isCircular() {
return true;
}
@Override
public double getStartAngleInDegrees() {
return 0;
}
/** Base font, size 15. */
@Override
public Font getPieFont() {
return getBaseFont().deriveFont(15f);
}
@Override
public double getAnnotationDistance() {
return .67;
}
@Override
public AnnotationType getAnnotationType() {
return AnnotationType.Percentage;
}
@Override
public boolean isDrawAllAnnotations() {
return false;
}
@Override
public double getDonutThickness() {
return .33;
}
@Override
public boolean isSumVisible() {
return false;
}
@Override
public Font getSumFont() {
return getAnnotationFont();
}
// Line, Scatter, Area Charts ///////////////////////////////
@Override
public int getMarkerSize() {
return 8;
}
// Error Bars ///////////////////////////////
@Override
public Color getErrorBarsColor() {
return ChartColor.getAWTColor(ChartColor.BLACK);
}
@Override
public boolean isErrorBarsColorSeriesColor() {
return false;
}
// Annotations ///////////////////////////////
/** Pie font, size 12. */
@Override
public Font getAnnotationFont() {
return getPieFont().deriveFont(12f);
}
}
|
[
"[email protected]"
] | |
60555533a7a5234e55431329c1014588df4fa765
|
e8cc0fe992926ed91926df2ec2e929aaae8caf25
|
/sample-demo/src/main/java/org/keithkim/safeql/sample/Demo.java
|
177b2fc5acbcebac88ae481d3e00d15fead22de2
|
[
"MIT"
] |
permissive
|
karmakaze/safeql
|
e71a04b534e4a3b6eb58420c99862c125361dd45
|
8f8004526bfd60fc5a5b4a39452641f35bff1e76
|
refs/heads/master
| 2023-06-28T02:49:40.187357 | 2021-10-29T02:14:29 | 2021-10-29T02:15:11 | 184,685,493 | 17 | 2 |
MIT
| 2023-06-14T22:47:21 | 2019-05-03T01:59:45 |
Java
|
UTF-8
|
Java
| false | false | 4,055 |
java
|
package org.keithkim.safeql.sample;
import org.jdbi.v3.core.mapper.JoinRow;
import org.jdbi.v3.core.mapper.JoinRowMapper;
import org.keithkim.safeql.sample.projects.Account;
import org.keithkim.safeql.sample.projects.Accounts0;
import org.keithkim.safeql.sample.projects.Project;
import org.keithkim.safeql.sample.projects.Projects0;
import org.keithkim.moja.monad.Async;
import org.keithkim.moja.monad.Multi;
import org.keithkim.safeql.query.Join;
import org.keithkim.safeql.statement.Database;
import org.keithkim.safeql.statement.TableDbRegistry;
import org.keithkim.safeql.statement.RawQueryStatement;
import java.util.List;
import static java.util.Arrays.asList;
public class Demo {
public void demoCompose() {
RawQueryStatement<Account> select = new RawQueryStatement<>("SELECT * FROM account", Account.class);
Async<Multi<Account>> asyncAccounts = select.multiAsync();
Async<Accounts0> asyncAccountsAndProjects = asyncAccounts.then(multiAccount -> {
return Async.async(() -> {
Accounts0 as = new Accounts0(multiAccount.toList());
as.loadProjects();
return as;
});
});
Accounts0 accountsAndProjects = asyncAccountsAndProjects.join();
for (Account account : accountsAndProjects) {
System.out.println("" + account);
}
}
public void demoJoin() {
Account.Table accountTable = new Account.Table("account", "a");
Project.Table projectTable = new Project.Table("project", "p");
Join<Account, Project> accountJoinProject = new Join(accountTable, projectTable).where(new Join.Cond2());
List<JoinRow> accountAndProjects = TableDbRegistry.using(asList(accountTable, projectTable), handle -> {
handle.registerRowMapper(JoinRowMapper.forTypes(Account.class, Project.class));
return handle.createQuery("SELECT a.id a_id, a.full_name a_full_name, a.email a_email, a.plan_name a_plan_name, a.expires_at a_expires_at, "+
"p.id p_id, p.account_id p_account_id, p.name p_name, p.domain p_domain "+
"FROM account a JOIN project p ON a.id = p.account_id "+
"WHERE p.account_id IN (<account_ids>)")
.bindList("account_ids", asList(5483L, 9999L, 412885L, 412895L, 412896L, 412897L, 412898L))
.mapTo(JoinRow.class)
.list();
});
for (JoinRow row : accountAndProjects) {
Account account = row.get(Account.class);
Project project = row.get(Project.class);
System.out.println(account +" :has: "+ project);
}
}
public Accounts0 demoAccountsWhere() {
Account.Table accountTable = new Account.Table("account", null);
Accounts0 accounts = new Accounts0(accountTable.where("id >= 1000"));
return accounts;
}
public Projects0 demoAccountsLoadProjects(Accounts0 accounts) {
Projects0 projects = accounts.loadProjects();
return projects;
}
public static void sleep(long millis) {
try {
Thread.sleep(250L);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
public static void main(String[] args) {
String jdbcUrl = System.getenv("JDBC_URL");
String dbUser = System.getenv("DB_USER");
String dbPassword = System.getenv("DB_PASSWORD");
Database db = new Database(jdbcUrl, dbUser, dbPassword);
TableDbRegistry.registerDefault(db);
Demo demo = new Demo();
demo.demoCompose();
// demoMain.demoJoin();
// Accounts accounts = demoMain.demoAccountsWhere();
// Projects projects = demoMain.demoAccountsLoadProjects(accounts);
// for (Project project : projects) {
// System.out.println("" + project);
// }
// for (Account account : accounts) {
// System.out.println("" + account);
// }
}
}
|
[
"[email protected]"
] | |
94d3b27a27fe73744d03903caf9c4a35dec9070b
|
4abb84c9223352ad5f78f7e3c565e2475d24cc88
|
/src/main/java/az/ibar/IbarLoanOrder/service/security/UserDetailsServiceImpl.java
|
ec5ebf1f82c7dfc8acc6cc3dc2127567ee0597dd
|
[] |
no_license
|
ramilmammadov/ibar
|
4f26fd8ca594ff89174028a589a42ca988fcaed2
|
de433b133675ff82b34440220d186ce1395facf4
|
refs/heads/master
| 2022-11-12T22:10:36.347468 | 2020-06-27T10:14:52 | 2020-06-27T10:14:52 | 275,183,891 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,158 |
java
|
package az.ibar.IbarLoanOrder.service.security;
import az.ibar.IbarLoanOrder.model.entity.security.User;
import az.ibar.IbarLoanOrder.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class UserDetailsServiceImpl implements UserDetailsService {
@Autowired
UserRepository userRepository;
public UserDetailsServiceImpl(UserRepository userRepository) {
this.userRepository = userRepository;
}
@Override
@Transactional
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
User user = userRepository.findByUsername(username)
.orElseThrow(() -> new UsernameNotFoundException("User Not Found with username: " + username));
return UserDetailsImpl.build(user);
}
}
|
[
"[email protected]"
] | |
95dcb28dd2021b0cfb487a3526098b26dbd21415
|
c6032bc544c256e179b781aa3bf3df5e07b7f30c
|
/build/generated/source/proto/main/java/net/grpc/chord/InquirePredecessorResponse.java
|
b6b10b1350959941b3a2b9adf3883c6006dfb081
|
[] |
no_license
|
cpwang96/Chord
|
d0c91f64df5b4bc9cb8a84215dc0b64ac9bbf814
|
42fd7f94885e071e2090dae25d0d33b06fa4d831
|
refs/heads/master
| 2020-06-25T13:32:47.344498 | 2019-07-30T06:12:58 | 2019-07-30T06:12:58 | 199,322,557 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | true | 20,334 |
java
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: chordNodeService.proto
package net.grpc.chord;
/**
* Protobuf type {@code chord.InquirePredecessorResponse}
*/
public final class InquirePredecessorResponse extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:chord.InquirePredecessorResponse)
InquirePredecessorResponseOrBuilder {
private static final long serialVersionUID = 0L;
// Use InquirePredecessorResponse.newBuilder() to construct.
private InquirePredecessorResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private InquirePredecessorResponse() {
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private InquirePredecessorResponse(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
net.grpc.chord.Identifier.Builder subBuilder = null;
if (identifier_ != null) {
subBuilder = identifier_.toBuilder();
}
identifier_ = input.readMessage(net.grpc.chord.Identifier.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(identifier_);
identifier_ = subBuilder.buildPartial();
}
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return net.grpc.chord.ChordNodeProto.internal_static_chord_InquirePredecessorResponse_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return net.grpc.chord.ChordNodeProto.internal_static_chord_InquirePredecessorResponse_fieldAccessorTable
.ensureFieldAccessorsInitialized(
net.grpc.chord.InquirePredecessorResponse.class, net.grpc.chord.InquirePredecessorResponse.Builder.class);
}
public static final int IDENTIFIER_FIELD_NUMBER = 1;
private net.grpc.chord.Identifier identifier_;
/**
* <code>.chord.Identifier identifier = 1;</code>
*/
public boolean hasIdentifier() {
return identifier_ != null;
}
/**
* <code>.chord.Identifier identifier = 1;</code>
*/
public net.grpc.chord.Identifier getIdentifier() {
return identifier_ == null ? net.grpc.chord.Identifier.getDefaultInstance() : identifier_;
}
/**
* <code>.chord.Identifier identifier = 1;</code>
*/
public net.grpc.chord.IdentifierOrBuilder getIdentifierOrBuilder() {
return getIdentifier();
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (identifier_ != null) {
output.writeMessage(1, getIdentifier());
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (identifier_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, getIdentifier());
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof net.grpc.chord.InquirePredecessorResponse)) {
return super.equals(obj);
}
net.grpc.chord.InquirePredecessorResponse other = (net.grpc.chord.InquirePredecessorResponse) obj;
if (hasIdentifier() != other.hasIdentifier()) return false;
if (hasIdentifier()) {
if (!getIdentifier()
.equals(other.getIdentifier())) return false;
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (hasIdentifier()) {
hash = (37 * hash) + IDENTIFIER_FIELD_NUMBER;
hash = (53 * hash) + getIdentifier().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static net.grpc.chord.InquirePredecessorResponse parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static net.grpc.chord.InquirePredecessorResponse parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static net.grpc.chord.InquirePredecessorResponse parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static net.grpc.chord.InquirePredecessorResponse parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static net.grpc.chord.InquirePredecessorResponse parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static net.grpc.chord.InquirePredecessorResponse parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static net.grpc.chord.InquirePredecessorResponse parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static net.grpc.chord.InquirePredecessorResponse parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static net.grpc.chord.InquirePredecessorResponse parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static net.grpc.chord.InquirePredecessorResponse parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static net.grpc.chord.InquirePredecessorResponse parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static net.grpc.chord.InquirePredecessorResponse parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(net.grpc.chord.InquirePredecessorResponse prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code chord.InquirePredecessorResponse}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:chord.InquirePredecessorResponse)
net.grpc.chord.InquirePredecessorResponseOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return net.grpc.chord.ChordNodeProto.internal_static_chord_InquirePredecessorResponse_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return net.grpc.chord.ChordNodeProto.internal_static_chord_InquirePredecessorResponse_fieldAccessorTable
.ensureFieldAccessorsInitialized(
net.grpc.chord.InquirePredecessorResponse.class, net.grpc.chord.InquirePredecessorResponse.Builder.class);
}
// Construct using net.grpc.chord.InquirePredecessorResponse.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
if (identifierBuilder_ == null) {
identifier_ = null;
} else {
identifier_ = null;
identifierBuilder_ = null;
}
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return net.grpc.chord.ChordNodeProto.internal_static_chord_InquirePredecessorResponse_descriptor;
}
@java.lang.Override
public net.grpc.chord.InquirePredecessorResponse getDefaultInstanceForType() {
return net.grpc.chord.InquirePredecessorResponse.getDefaultInstance();
}
@java.lang.Override
public net.grpc.chord.InquirePredecessorResponse build() {
net.grpc.chord.InquirePredecessorResponse result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public net.grpc.chord.InquirePredecessorResponse buildPartial() {
net.grpc.chord.InquirePredecessorResponse result = new net.grpc.chord.InquirePredecessorResponse(this);
if (identifierBuilder_ == null) {
result.identifier_ = identifier_;
} else {
result.identifier_ = identifierBuilder_.build();
}
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof net.grpc.chord.InquirePredecessorResponse) {
return mergeFrom((net.grpc.chord.InquirePredecessorResponse)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(net.grpc.chord.InquirePredecessorResponse other) {
if (other == net.grpc.chord.InquirePredecessorResponse.getDefaultInstance()) return this;
if (other.hasIdentifier()) {
mergeIdentifier(other.getIdentifier());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
net.grpc.chord.InquirePredecessorResponse parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (net.grpc.chord.InquirePredecessorResponse) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private net.grpc.chord.Identifier identifier_;
private com.google.protobuf.SingleFieldBuilderV3<
net.grpc.chord.Identifier, net.grpc.chord.Identifier.Builder, net.grpc.chord.IdentifierOrBuilder> identifierBuilder_;
/**
* <code>.chord.Identifier identifier = 1;</code>
*/
public boolean hasIdentifier() {
return identifierBuilder_ != null || identifier_ != null;
}
/**
* <code>.chord.Identifier identifier = 1;</code>
*/
public net.grpc.chord.Identifier getIdentifier() {
if (identifierBuilder_ == null) {
return identifier_ == null ? net.grpc.chord.Identifier.getDefaultInstance() : identifier_;
} else {
return identifierBuilder_.getMessage();
}
}
/**
* <code>.chord.Identifier identifier = 1;</code>
*/
public Builder setIdentifier(net.grpc.chord.Identifier value) {
if (identifierBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
identifier_ = value;
onChanged();
} else {
identifierBuilder_.setMessage(value);
}
return this;
}
/**
* <code>.chord.Identifier identifier = 1;</code>
*/
public Builder setIdentifier(
net.grpc.chord.Identifier.Builder builderForValue) {
if (identifierBuilder_ == null) {
identifier_ = builderForValue.build();
onChanged();
} else {
identifierBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <code>.chord.Identifier identifier = 1;</code>
*/
public Builder mergeIdentifier(net.grpc.chord.Identifier value) {
if (identifierBuilder_ == null) {
if (identifier_ != null) {
identifier_ =
net.grpc.chord.Identifier.newBuilder(identifier_).mergeFrom(value).buildPartial();
} else {
identifier_ = value;
}
onChanged();
} else {
identifierBuilder_.mergeFrom(value);
}
return this;
}
/**
* <code>.chord.Identifier identifier = 1;</code>
*/
public Builder clearIdentifier() {
if (identifierBuilder_ == null) {
identifier_ = null;
onChanged();
} else {
identifier_ = null;
identifierBuilder_ = null;
}
return this;
}
/**
* <code>.chord.Identifier identifier = 1;</code>
*/
public net.grpc.chord.Identifier.Builder getIdentifierBuilder() {
onChanged();
return getIdentifierFieldBuilder().getBuilder();
}
/**
* <code>.chord.Identifier identifier = 1;</code>
*/
public net.grpc.chord.IdentifierOrBuilder getIdentifierOrBuilder() {
if (identifierBuilder_ != null) {
return identifierBuilder_.getMessageOrBuilder();
} else {
return identifier_ == null ?
net.grpc.chord.Identifier.getDefaultInstance() : identifier_;
}
}
/**
* <code>.chord.Identifier identifier = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
net.grpc.chord.Identifier, net.grpc.chord.Identifier.Builder, net.grpc.chord.IdentifierOrBuilder>
getIdentifierFieldBuilder() {
if (identifierBuilder_ == null) {
identifierBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
net.grpc.chord.Identifier, net.grpc.chord.Identifier.Builder, net.grpc.chord.IdentifierOrBuilder>(
getIdentifier(),
getParentForChildren(),
isClean());
identifier_ = null;
}
return identifierBuilder_;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:chord.InquirePredecessorResponse)
}
// @@protoc_insertion_point(class_scope:chord.InquirePredecessorResponse)
private static final net.grpc.chord.InquirePredecessorResponse DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new net.grpc.chord.InquirePredecessorResponse();
}
public static net.grpc.chord.InquirePredecessorResponse getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<InquirePredecessorResponse>
PARSER = new com.google.protobuf.AbstractParser<InquirePredecessorResponse>() {
@java.lang.Override
public InquirePredecessorResponse parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new InquirePredecessorResponse(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<InquirePredecessorResponse> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<InquirePredecessorResponse> getParserForType() {
return PARSER;
}
@java.lang.Override
public net.grpc.chord.InquirePredecessorResponse getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
|
[
"[email protected]"
] | |
74f66dc3ad8613724749f46fdded06f4888eeae7
|
3c5e0a73867838bc2afbc3b431dcc53ef8ea3af0
|
/src/com/htsoft/oa/service/admin/InStockService.java
|
0ac7d223e50a7fb3f2a30c02d7a7ccdf16991686
|
[] |
no_license
|
cjp472/crm
|
5f5d21c9b2307ab5d144ca8a762f374823a950c4
|
d4a7f4dbf2983f0d3abb38ba0d0a916c08cb0c86
|
refs/heads/master
| 2020-03-19T09:48:34.976163 | 2018-05-05T07:47:27 | 2018-05-05T07:47:27 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 397 |
java
|
package com.htsoft.oa.service.admin;
/*
* ๅไบฌไผๅ่่็งๆๆ้ๅ
ฌๅธ ็ปผๅๅฎขๆ็ฎก็็ณป็ป -- http://www.ulane.cn
* Copyright (C) 2008-2009 Beijing Ulane Technology Co., LTD
*/
import com.htsoft.core.service.BaseService;
import com.htsoft.oa.model.admin.InStock;
public interface InStockService extends BaseService<InStock>{
public Integer findInCountByBuyId(Long buyId);
}
|
[
"[email protected]"
] | |
0ffeb9fbf654267bbf112dcf64e11e3eeaccbafb
|
cf1ad9a211dcf700d360e7f10253168b0375ab3a
|
/src/main/java/core/interfaces/TileFillGenerator.java
|
016de21f6da9e9d041fbfb9a70904e43ca823459
|
[] |
no_license
|
odschulz/floodit_clone
|
27a273f677e2af374b19bd0b291a0ecf8f592049
|
6ed7122a8d1e21093e563f255fd4397252f9e354
|
refs/heads/master
| 2021-01-24T13:12:54.467106 | 2018-10-16T21:09:31 | 2018-10-16T21:09:31 | 123,165,241 | 0 | 0 | null | 2018-03-04T15:18:34 | 2018-02-27T17:39:51 |
Java
|
UTF-8
|
Java
| false | false | 436 |
java
|
package core.interfaces;
/**
* Generate visual representations for tiles as fills.
*/
public interface TileFillGenerator {
/**
* Get all possible tile fills for this generator.
*
* @return all available tile fills
*/
TileFill[] getTileFills();
/**
* Generate a random tile fill from the available collection.
*
* @return a random tile fill
*/
TileFill getRandomTileFill();
}
|
[
"[email protected]"
] | |
f3ed71d2378908107f960a1b9274cda85d9a5fc6
|
74d6190633fbbc11805d6f665bacc692a30f1de0
|
/src/com/emitrom/ti4j/mobile/client/core/handlers/ui/ScrollViewDragStartHandler.java
|
f089b5ca6f8673a4020a2339b3f26c512851a0cd
|
[
"Apache-2.0"
] |
permissive
|
sksastry/titanium4j
|
82c9d34fecb8555dda22f11abaf5453855c64f8a
|
0147de71a8746be60b3170f1258da62014281664
|
refs/heads/master
| 2021-01-18T04:34:01.384587 | 2014-02-02T21:31:40 | 2014-02-02T21:31:40 | 13,526,003 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,102 |
java
|
/************************************************************************
ScrollViewDragStartHandler.java is part of Ti4j 3.1.0 Copyright 2013 Emitrom LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**************************************************************************/
package com.emitrom.ti4j.mobile.client.core.handlers.ui;
import com.emitrom.ti4j.mobile.client.core.events.ui.scrollview.ScrollViewDragStartEvent;
import com.google.gwt.event.shared.EventHandler;
public interface ScrollViewDragStartHandler extends EventHandler {
public void onDragStart(ScrollViewDragStartEvent event);
}
|
[
"[email protected]"
] | |
90e488bfdb0c9ea64ecd9fa4b5a4b66080fb0929
|
912d86084c48c9ac1e6ee00eb93010f728fd9911
|
/src/main/java/com/linqi/userservice/dao/SysUserMapper.java
|
3d2f671cd63f670938275d52d8f2a48d311d2bbb
|
[] |
no_license
|
Maxwell07/user-service
|
3d9ce0cd6e8b07726bc5f5d9f0bbcb55b627d7d8
|
7ce76c3f69c9fcedd39c7bc5405be8f272e195b1
|
refs/heads/master
| 2022-07-13T07:50:44.692399 | 2019-08-11T17:50:08 | 2019-08-11T17:50:08 | 201,796,324 | 0 | 0 | null | 2022-06-29T19:47:45 | 2019-08-11T17:44:00 |
Java
|
UTF-8
|
Java
| false | false | 971 |
java
|
package com.linqi.userservice.dao;
import com.linqi.userservice.common.beans.PageQuery;
import com.linqi.userservice.model.SysUser;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysUserMapper {
int deleteByPrimaryKey(Integer id);
int insert(SysUser record);
int insertSelective(SysUser record);
SysUser selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(SysUser record);
int updateByPrimaryKey(SysUser record);
SysUser findByKeyword(@Param("keyword") String keyword);
int countByMail(@Param("mail") String mail, @Param("id") Integer id);
int countByTelephone(@Param("telephone") String telephone, @Param("id") Integer id);
int countByDeptId(@Param("deptId") int deptId);
List<SysUser> getPageByDeptId(@Param("deptId") int deptId, @Param("page") PageQuery page);
List<SysUser> getByIdList(@Param("idList") List<Integer> idList);
List<SysUser> getAll();
}
|
[
"[email protected]"
] | |
ab73128208ec8fa56b7484c1a0c45f5dbe5f70a3
|
ffbfa13516b7967615bb0faacbcc573065b58d5c
|
/.svn/pristine/ab/ab73128208ec8fa56b7484c1a0c45f5dbe5f70a3.svn-base
|
40c62c62d35ee554cc55648ac40ca960a2e79749
|
[] |
no_license
|
mohibkohi/PowerPaint
|
8f1f493b622b6509764d59cd52ee7ac2877931a9
|
097da337f661b5181215129ba9edb0a25e013809
|
refs/heads/master
| 2021-01-21T12:11:16.194209 | 2017-08-31T21:32:07 | 2017-08-31T21:32:07 | 102,046,520 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,340 |
/*
* TCSS 305 - Line
*
*/
package model;
import java.awt.Shape;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
/**
* Line class to draw a line.
* @author mohibkohi
* @version 1.0.
*/
public class Line extends AbstractTool implements Tool {
/**
* The path being created.
*/
private final Line2D myPath;
/**
* Constructor line.
*/
public Line() {
super();
myPath = new Line2D.Double();
}
/**
* Set start point of the shape.
* @param thePoint to start drawing from.
* @param thePerfect draw perfect shape if true false otherwise.
*/
public void setPressed(final Point2D thePoint, final boolean thePerfect) {
myStart = thePoint;
myPath.setLine(myStart, thePoint);
}
/**
* Set end point of the shape.
* @param thePoint to start drawing from.
*/
public void setDragged(final Point2D thePoint) {
myPath.setLine(myStart, thePoint);
}
/**
* Return the shape.
* @return the shape.
*/
@Override
public Shape getShape() {
return myPath;
}
/**
* Return the name of the shape.
* @return string representation of the shape.
*/
public String toString() {
return "Line";
}
}
|
[
"[email protected]"
] | ||
b0329c42e6ac9318d68e34f5b846242fa0ac7cb8
|
08846c62361284a6771e89ec93453d3109b571b9
|
/src/main/java/com/jtzh/vo/ss/FileUpdateVO.java
|
dfe50f93accf92a7835cf717ff458caef7dfb6ab
|
[] |
no_license
|
lzj1995822/zhbh-api
|
a497b176a1ec1302143684652d18113be752e383
|
5c8a02d2f55e8733f91fe68ae9e0d09934fa3de3
|
refs/heads/master
| 2023-08-04T14:33:05.831163 | 2020-01-19T02:19:13 | 2020-01-19T02:19:13 | 206,700,789 | 0 | 1 | null | 2023-07-22T15:28:54 | 2019-09-06T02:57:22 |
TSQL
|
UTF-8
|
Java
| false | false | 708 |
java
|
/* */ package com.jtzh.vo.ss;
/* */
/* */ public class FileUpdateVO
/* */ {
/* */ private Long id;
/* */ private String url;
/* */
/* */ public Long getId() {
/* 9 */ return this.id;
/* */ }
/* */
/* */ public void setId(Long id) {
/* 13 */ this.id = id;
/* */ }
/* */
/* */ public String getUrl() {
/* 17 */ return this.url;
/* */ }
/* */
/* */ public void setUrl(String url) {
/* 21 */ this.url = url;
/* */ }
/* */ }
/* Location: C:\Users\rainb\Desktop\msmis.war!\WEB-INF\classes\com\gbt\vo\ss\FileUpdateVO.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 0.7.1
*/
|
[
"[email protected]"
] | |
d525b879d15578c40f2e025517acb874c2cf32c6
|
742a22bd84b7e040169db54c74345ce3584a860e
|
/src/main/java/fr/irit/smac/may/examples/mas/monitoring/interfaces/SeriesObserve.java
|
436ed0db9903166265bf69143b7a0ba934f59378
|
[] |
no_license
|
tgomas/may-elec-demo
|
e5a403639b0b3d32ef601d526b2569ebcb084f1c
|
91763a2336769e52adef37b55b8e6d97d8ecc752
|
refs/heads/master
| 2021-01-09T20:47:11.790675 | 2016-06-13T08:14:13 | 2016-06-13T08:14:13 | 61,020,063 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 161 |
java
|
package fr.irit.smac.may.examples.mas.monitoring.interfaces;
import java.util.List;
public interface SeriesObserve<T> {
public List<T> observe(String id);
}
|
[
"[email protected]"
] | |
5622fae603b2f278be173ac303f50e4777ff4552
|
40df4983d86a3f691fc3f5ec6a8a54e813f7fe72
|
/app/src/main/java/com/tencent/stat/C1752k.java
|
d411e3663a58fe680c295b0407a0af6384edbf5f
|
[] |
no_license
|
hlwhsunshine/RootGeniusTrunAK
|
5c63599a939b24a94c6f083a0ee69694fac5a0da
|
1f94603a9165e8b02e4bc9651c3528b66c19be68
|
refs/heads/master
| 2020-04-11T12:25:21.389753 | 2018-12-24T10:09:15 | 2018-12-24T10:09:15 | 161,779,612 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 704 |
java
|
package com.tencent.stat;
/* renamed from: com.tencent.stat.k */
class C1752k implements Runnable {
/* renamed from: a */
final /* synthetic */ int f5149a;
/* renamed from: b */
final /* synthetic */ int f5150b;
/* renamed from: c */
final /* synthetic */ StatFBDispatchCallback f5151c;
/* renamed from: d */
final /* synthetic */ C1748g f5152d;
C1752k(C1748g c1748g, int i, int i2, StatFBDispatchCallback statFBDispatchCallback) {
this.f5152d = c1748g;
this.f5149a = i;
this.f5150b = i2;
this.f5151c = statFBDispatchCallback;
}
public void run() {
this.f5152d.mo7947a(this.f5149a, this.f5150b, this.f5151c);
}
}
|
[
"[email protected]"
] | |
caf0819b709b023f8c8253c5547ecfb014b63dfa
|
10c7c890becde725f1e85c5126f62b375ec560ef
|
/big data medical application backend/spring-hadoop-samples-master/hive/src/main/java/org/springframework/samples/hadoop/hive/health/Service/LabDataServiceImpl.java
|
d5054d79b4a68411920a8cc2267589cbcd28dc2e
|
[] |
no_license
|
ahmadRahman1993/bigData
|
5e00c22f22f70f88dedd5862b3e7298652be41b2
|
ae5d864d295b376e27a35c5f7e0b0b35d4ed3049
|
refs/heads/master
| 2020-03-31T06:50:03.010530 | 2018-10-08T00:21:00 | 2018-10-08T00:21:00 | 151,996,868 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,514 |
java
|
package org.springframework.samples.hadoop.hive.health.Service;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.samples.hadoop.hive.health.DAO.AddmissionDataRepository;
import org.springframework.samples.hadoop.hive.health.DAO.LabDataRepository;
import org.springframework.samples.hadoop.hive.health.dto.AddmissionDataDTO;
import org.springframework.samples.hadoop.hive.health.dto.AddmissionDataJSONDTO;
import org.springframework.samples.hadoop.hive.health.dto.LabDataDTO;
import org.springframework.samples.hadoop.hive.health.dto.LabDataJSONDTO;
import org.springframework.samples.hadoop.hive.health.dto.ResponseDTO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service("labDataService")
public class LabDataServiceImpl implements LabDataService {
private static final Log log = LogFactory.getLog(LabDataServiceImpl.class);
@Autowired
private LabDataRepository labDataRepository;
public List<LabDataDTO> getLabResultsByPatientId(String personId){
List<LabDataDTO> labData = labDataRepository.getLabResultsByPatientId(personId);
return labData;
}
@Transactional
public ResponseDTO saveLabDataRecord(LabDataJSONDTO labData){
ResponseDTO responseDTO = new ResponseDTO();
responseDTO = labDataRepository.saveLabDataRecord(labData);
return responseDTO;
}
}
|
[
"[email protected]"
] | |
fff1e2b7257b3ab6f27502892be227132f731600
|
24bcb533bed679416b41a9524de2b0b72e602bc3
|
/src/main/java/se/maginteractive/test/enums/TransactionType.java
|
00b28615065840f26b208d34a1748af394131f75
|
[] |
no_license
|
MehmetAlpGuler/spring-boot-webservice
|
4ea219402fe351f33de8d764a422ddb03b0f4368
|
a8cbce3d0753f10ffebd6e65f0b3b552ee50238a
|
refs/heads/master
| 2023-03-08T21:50:10.542567 | 2021-03-01T07:23:07 | 2021-03-01T07:23:07 | 333,367,373 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 111 |
java
|
package se.maginteractive.test.enums;
public enum TransactionType {
DEPOSIT,
WITHDRAW,
PURCHASE
}
|
[
"[email protected]"
] | |
a9bfddbf7e060164df0a9b31965aeb6eb0974392
|
6744f6013074836a54de34021611255f7a5198a3
|
/TreeDFS/LowestCommonAncestorIII.java
|
62ddb71e2461c673e0b59749a279232d9f8259ec
|
[] |
no_license
|
wangweisunying/learning
|
2ff4c898be1eddefc55da73da350ff27b7b9f8f4
|
d15843546bbd71ba9f77b082dd6982c9ccc54f40
|
refs/heads/master
| 2020-03-30T14:44:19.734605 | 2019-03-16T00:31:01 | 2019-03-16T00:31:01 | 151,333,856 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,302 |
java
|
// Given the root and two nodes in a Binary Tree. Find the lowest common ancestor(LCA) of the two nodes.
// The lowest common ancestor is the node with largest depth which is the ancestor of both nodes.
// Return null if LCA does not exist.
// Example
// For the following binary tree:
// 4
// / \
// 3 7
// / \
// 5 6
// LCA(3, 5) = 4
// LCA(5, 6) = 7
// LCA(6, 7) = 7
/**
* Definition of TreeNode:
* public class TreeNode {
* public int val;
* public TreeNode left, right;
* public TreeNode(int val) {
* this.val = val;
* this.left = this.right = null;
* }
* }
*/
//ๆญฃๅๆ็ปด ๆพๅฐๅฐฑ่ฟๅ๏ผๆ นๆฎleft ๅright ็ๅบ็ฐๆ
ๅตๆฅๅคๆญ lCA ็ไฝ็ฝฎ
class Solution {
public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
if(root == null ) return null;
if(root == p || root == q) return root;
TreeNode left = lowestCommonAncestor(root.left, p, q);
TreeNode right = lowestCommonAncestor(root.right, p, q);
if(left != null && right != null) return root;
return left == null ? right : left; // cover all null;
}
}
public class Solution {
/*
* @param root: The root of the binary tree.
* @param A: A TreeNode
* @param B: A TreeNode
* @return: Return the LCA of the two nodes.
*/
class ReturnType{
boolean Ahere , Bhere;
TreeNode node;
ReturnType( TreeNode node , boolean Ahere ,boolean Bhere ){
this.Ahere = Ahere;
this.Bhere = Bhere;
this.node = node;
}
}
TreeNode res;
boolean found;
public TreeNode lowestCommonAncestor3(TreeNode root, TreeNode A, TreeNode B) {
helper(root , A , B);
return res;
}
private ReturnType helper(TreeNode root, TreeNode A, TreeNode B){
if(found){
return new ReturnType(null , false , false);
}
if(root == null){
return new ReturnType(null , false , false);
}
ReturnType left = helper(root.left , A , B);
ReturnType right = helper(root.right , A , B);
boolean isA = (root.val == A.val) || left.Ahere || right.Ahere;
boolean isB = (root.val == B.val) || left.Bhere || right.Bhere;
if(isA && isB && !found){
res = root;
found = true;
}
return new ReturnType(root , isA , isB);
}
}
/**
* Definition of TreeNode:
* public class TreeNode {
* public int val;
* public TreeNode left, right;
* public TreeNode(int val) {
* this.val = val;
* this.left = this.right = null;
* }
* }
*/
public class Solution {
/*
* @param root: The root of the binary tree.
* @param A: A TreeNode
* @param B: A TreeNode
* @return: Return the LCA of the two nodes.
*/
public TreeNode lowestCommonAncestor3(TreeNode root, TreeNode A, TreeNode B) {
ReturnType res = helper(root , A , B);
if(res.Ahere && res.Bhere){
return res.node;
}
return null;
}
private ReturnType helper(TreeNode root, TreeNode A, TreeNode B){
if(root == null){
return new ReturnType(null, false , false);
}
ReturnType left = helper(root.left , A , B);
ReturnType right = helper(root.right , A , B);
boolean Ahere = left.Ahere || right.Ahere || root == A;
boolean Bhere = left.Bhere || right.Bhere || root == B;
if(root == A || root == B){
return new ReturnType(root , Ahere , Bhere);
}
if( left.node != null && right.node != null){
return new ReturnType(root , Ahere ,Bhere);
}
if( left.node != null){
return new ReturnType(left.node , Ahere , Bhere);
}
if( right.node != null){
return new ReturnType(right.node , Ahere ,Bhere);
}
return new ReturnType(null , Ahere ,Bhere);
}
class ReturnType{
TreeNode node;
boolean Ahere;
boolean Bhere;
ReturnType(TreeNode node , boolean Ahere , boolean Bhere){
this.node = node;
this.Ahere = Ahere;
this.Bhere = Bhere;
}
}
}
|
[
"[email protected]"
] | |
d5b0225bb80c249c99825868df9165622688a935
|
c6e1c29a51c93c1a5d56221eb59ac55c01c57e36
|
/src/main/java/uk/ac/ebi/pride/archive/web/client/datamodel/adapters/ModificationAdapter.java
|
01de84696f57fddfc32dcb7aee6490a27e20f609
|
[] |
no_license
|
PRIDE-Archive/web-app
|
9227470a80763fedc9f4688011ea1a2e3d32cc04
|
78789e495c0d9e6e96a62cfaa6fe77614864214c
|
refs/heads/master
| 2016-09-15T06:12:15.882223 | 2016-05-13T10:36:32 | 2016-05-13T10:36:32 | 37,145,150 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 759 |
java
|
package uk.ac.ebi.pride.archive.web.client.datamodel.adapters;
import uk.ac.ebi.pride.widgets.client.common.handler.PrideModificationHandler;
/**
* @author Pau Ruiz Safont <[email protected]>
* Date: 11/11/13
* Time: 11:18
*/
public class ModificationAdapter implements PrideModificationHandler {
private final String type;
public ModificationAdapter(String modificationType) {
type = modificationType;
}
@Override
public int getId() {
return type.hashCode();
}
@Override
public String getName() {
return type;
}
@Override
public Double getDiffMono() {
return 0.0;
}
@Override
public boolean isBioSignificance() {
return false;
}
}
|
[
"[email protected]"
] | |
8bcfd90a52107320a46064a0f736a729153286b8
|
4364f8e72fe2a3e04bd7c9257234a6f55474f968
|
/AMS_ๅบ็กไฟกๆฏ็ปไปถ/.svn/pristine/57/57f8d783f5e8937e9ec325c3c85d46871c718a69.svn-base
|
1044f05b741c8f918f70a1d5654647099fc409b3
|
[] |
no_license
|
l871993962/liminglei
|
f511ac1cc0c53a8811eaee6a7038f72f6a7ee4cc
|
acbd64ce548e97a729b964418fb6edd0c9e78302
|
refs/heads/master
| 2023-08-03T03:39:25.813790 | 2021-09-27T01:44:51 | 2021-09-27T01:44:51 | 409,838,699 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,506 |
/**
*
* @Title: BusinessTypeService.java
* @Package com.yss.ams.base.information.support.sys.businesstype.service
* @date 2019ๅนด5ๆ13ๆฅ ไธๅ3:34:26
* @version V1.0
* @Stroy/Bug
* @author xiadeqi
*/
package com.yss.ams.base.information.support.sys.portbusinessrange.service;
import java.util.HashMap;
import java.util.List;
import com.yss.ams.base.information.support.sys.portbusinessrange.pojo.PortBusinessRangePojoVo;
import com.yss.framework.api.common.co.BasePojo;
import com.yss.framework.api.dataservice.IKeyConvertDataService;
import com.yss.framework.api.mvc.biz.IServiceBus;
import com.yss.framework.api.restful.annotations.LinkControllerMethod;
import com.yss.framework.api.restful.annotations.LinkControllerMethodArgu;
import com.yss.framework.api.restful.annotations.RestfulSupported;
import com.yss.framework.api.service.ServiceException;
import com.yss.platform.support.dataservice.pojo.dict.Vocabulary;
/**
* ไบงๅไธๅก่ๅดๆฅๅฃ
* @ClassName: BusinessTypeService
* @date 2019ๅนด5ๆ13ๆฅ ไธๅ3:34:26
* @Stroy72335/Bug
* @author xiadeqi
*/
@RestfulSupported
public interface IPortBusinessRangeService extends IServiceBus, IKeyConvertDataService {
/**
* STORY #82160 ใๅๅฎๅบ้ใไบงๅไธๅก่ๅดๅขๅ ็ปดๆค็้ข
* ่ทๅไธๅก็ฑปๅๆฐๆฎ
* @param type
* @return
* @throws ServiceException
*/
public List<Vocabulary> getDataListByType(String type) throws ServiceException;
/**
* STORY #82160 ใๅๅฎๅบ้ใไบงๅไธๅก่ๅดๅขๅ ็ปดๆค็้ข
* ๆดๆฐไธๅก็ฑปๅๆฐๆฎ
* @param type
* @param paraMap
* @return
* @throws ServiceException
*/
@LinkControllerMethod(value="updateDataList",arguTypes = PortBusinessRangePojoVo.class)
public boolean updateDataList(@LinkControllerMethodArgu("type")String type, @LinkControllerMethodArgu("paraMap")HashMap<String, String> paraMap) throws ServiceException;
/**
* STORY #86378 ใๅๅฎๅบ้ใไบๆ่ชๅจๅๅบ็จ่ๅดๅขๅ ๅ
ถไป่ชๅจๅ็ปๅ
* ๆ นๆฎไธๅก็ฑปๅไปฃ็ ่ทๅ็ปๅ้ๅ
* @param busiCode
* @return
* @throws ServiceException
*/
public List<String> getPortListByBusiCode(String busiCode) throws ServiceException;
/**
* STORY #96878 ใๅฏๅฝๅบ้ใ่ชๅจๅๅๆฐๅคๅถ้่ฟไบงๅๅๆฐๅคๅถ
* @param pojoList
* @throws ServiceException
*/
@LinkControllerMethod(value = "insertPortBusinessRange", arguTypes = List.class)
public void insertPortBusinessRange(List<BasePojo> pojoList) throws ServiceException;
}
|
[
"[email protected]"
] | ||
be7e8c571293ac8764680e0fafa3022891ed757c
|
0e02393f6d9c09f2453c3e7bc729052ff74f922f
|
/librarytao/src/main/java/com/yitao/dialog/UpOrDownLoadDialog.java
|
23b220f0fd52a6d48ea4c783b1560f5b0e3cb65c
|
[] |
no_license
|
eaglelhq/HBPostal
|
fbcb6765d082940cb3511c2312ab9b1cbe8c3180
|
76df376aed3022506bbb1eacc598dbc1377242ba
|
refs/heads/master
| 2021-05-05T19:55:44.299097 | 2018-11-12T02:49:23 | 2018-11-12T02:49:23 | 103,887,994 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,067 |
java
|
package com.yitao.dialog;
import com.yitao.library_tao.R;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.WindowManager.LayoutParams;
import android.widget.TextView;
public class UpOrDownLoadDialog extends Dialog {
Context mContext;
private TextView loadTv;
private String tishi;
public UpOrDownLoadDialog(Context context, String tishi) {
super(context);
this.tishi = tishi;
this.mContext = context;
}
public UpOrDownLoadDialog(Context context, int theme) {
super(context, theme);
this.mContext = context;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_upordown_load);
// ไฝฟdialogๅ
จๅฑ
getWindow().setLayout(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
initViews();
}
// ๆงไปถๅๅงๅ
private void initViews() {
loadTv = (TextView) findViewById(R.id.pop_fileupload_text);
loadTv.setText(tishi);
}
public void setLoadText(String text) {
loadTv.setText(text);
}
}
|
[
"[email protected]"
] | |
d4c8148026354fcac67ffa63c394c75e9ef6dd91
|
6d707f7602bc3c9b5122c745eadba10bfe03d798
|
/src/test/java/sk/fri/uniza/Auth/WeatherStationAuthTest.java
|
22c74c0a98c003fa121f4d64440d15ffb4c55b7e
|
[] |
no_license
|
mfilo94/PD-Uloha-c1
|
3b43fd1b974fc54dc1e2b95285b689ff68bd3a7d
|
149cba4c720e2feb0427888cce76161a892ca063
|
refs/heads/master
| 2022-11-09T00:05:54.715662 | 2020-06-29T18:59:20 | 2020-06-29T18:59:20 | 275,901,749 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,012 |
java
|
package sk.fri.uniza;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import retrofit2.Call;
import retrofit2.Response;
import sk.fri.uniza.model.Location;
import sk.fri.uniza.model.Token;
import sk.fri.uniza.model.WeatherData;
import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Base64;
import java.util.List;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class WeatherStationAuthTest {
private static final String token =
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9" +
".eyJhbGwiOnRydWUsImlzcyI6ImF1" +
"dGgwIn0.Dc2RhFYE41g4Dh9baSuCv3o3JoYA8TlGMD4TlMKR2Jw";
private static final DateTimeFormatter timeFormat =
DateTimeFormatter.ofPattern("HH:mm");
private static final DateTimeFormatter dateFormat =
DateTimeFormatter.ofPattern("dd.MM.yyyy");
/**
* Zรญskanie Api tรณkenu
*/
@Test
@Tag("step_6")
@DisplayName("Zรญskanie Api tรณkenu")
public void testApiToken() {
IotNode iotNode = new IotNode();
Call<Token> tokenCall =
iotNode.getWeatherStationService()
.getToken("Basic " + Base64.getEncoder()
.encodeToString("admin:heslo".getBytes()),
List.of("all"));
try {
Response<Token> response = tokenCall.execute();
assertTrue(response.isSuccessful(),
"Dotaz na server bol neรบspeลกnรฝ:" +
(response.errorBody() != null ?
response.errorBody().string() : ""));
System.out.println(response.body().getToken());
} catch (IOException e) {
assertTrue(false, e.getMessage());
}
}
/**
* Test, zoznam vลกetkรฝch meteo stanรญc
*/
@Test
@Tag("step_7")
@DisplayName("Test naฤรญtania zoznamu meteo stanรญc")
public void testListOfLocations() {
IotNode iotNode = new IotNode();
Call<List<Location>> stationLocations =
iotNode.getWeatherStationService()
.getStationLocationsAuth(token);
try {
Response<List<Location>> response =
stationLocations.execute();
assertTrue(response.isSuccessful(),
"Dotaz na server bol neรบspeลกnรฝ:" +
(response.errorBody() != null ?
response.errorBody().string() : ""));
List<Location> body = response.body();
assertEquals(body.get(0).getId(), "station_1");
assertEquals(body.get(1).getId(), "station_2");
assertEquals(body.get(2).getId(), "station_3");
System.out.println(body);
} catch (IOException e) {
assertTrue(false, e.getMessage());
}
}
/**
* Test, prijem JSON dรกt konvertovanรฝch na objekt
*/
@Test
@Tag("step_9")
@DisplayName("Test konvertovania JSON na objekt")
public void testCurrentDataObject() {
IotNode iotNode = new IotNode();
Call<WeatherData> currentWeather =
iotNode.getWeatherStationService()
.getCurrentWeatherAuth(token, "station_1");
try {
Response<WeatherData> response = currentWeather.execute();
assertTrue(response.isSuccessful(),
"Dotaz na server bol neรบspeลกnรฝ:" +
(response.errorBody() != null ?
response.errorBody().string() : ""));
WeatherData body = response.body();
assertEquals(LocalTime.now().format(timeFormat), body.getTime());
assertEquals(LocalDate.now().format(dateFormat), body.getDate());
System.out.println(body);
} catch (IOException e) {
assertTrue(false, e.getMessage());
}
}
/**
* Test, historickรฝch dรกt o pocวsรญ
*/
@Test
@Tag("step_10")
@DisplayName("Test naฤรญtania historie meteo dรกt")
public void testHisotryDataObject() {
IotNode iotNode = new IotNode();
Call<List<WeatherData>> currentWeather =
iotNode.getWeatherStationService()
.getHistoryWeatherAuth(token, "station_1",
"01/01/2020 " +
"00:00",
"02" +
"/01/2020 00:00");
try {
Response<List<WeatherData>> response = currentWeather.execute();
assertTrue(response.isSuccessful(),
"Dotaz na server bol neรบspeลกnรฝ:" +
(response.errorBody() != null ?
response.errorBody().string() : ""));
List<WeatherData> body = response.body();
LocalDateTime dateTime = LocalDateTime.of(2020, 01, 01, 0, 0);
LocalDateTime stopDate = LocalDateTime.of(2020, 01, 02, 0, 0);
for (WeatherData weatherData : body) {
LocalTime localTime =
LocalTime.parse(weatherData.getTime(), timeFormat);
LocalDate localDate =
LocalDate.parse(weatherData.getDate(), dateFormat);
assertEquals(dateTime, LocalDateTime.of(localDate, localTime));
dateTime = dateTime.plusHours(1);
}
dateTime = dateTime.minusHours(1);
assertEquals(stopDate, dateTime);
System.out.println(body);
} catch (IOException e) {
assertTrue(false, e.getMessage());
}
}
}
|
[
"[email protected]"
] | |
2a4e596fa8799532006b270cccb79467f596e3d0
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/27/27_92857c73ad5c0df469c1e874c347d293c71335f6/AccessManager/27_92857c73ad5c0df469c1e874c347d293c71335f6_AccessManager_t.java
|
78a4775f79126d7c91906a5a400ff26c38f9337f
|
[] |
no_license
|
zhongxingyu/Seer
|
48e7e5197624d7afa94d23f849f8ea2075bcaec0
|
c11a3109fdfca9be337e509ecb2c085b60076213
|
refs/heads/master
| 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null |
UTF-8
|
Java
| false | false | 18,068 |
java
|
//=============================================================================
//=== Copyright (C) 2001-2007 Food and Agriculture Organization of the
//=== United Nations (FAO-UN), United Nations World Food Programme (WFP)
//=== and United Nations Environment Programme (UNEP)
//===
//=== 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 2 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, write to the Free Software
//=== Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
//===
//=== Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
//=== Rome - Italy. email: [email protected]
//==============================================================================
package org.fao.geonet.kernel;
import jeeves.resources.dbms.Dbms;
import jeeves.server.UserSession;
import jeeves.server.context.ServiceContext;
import jeeves.utils.Xml;
import org.fao.geonet.GeonetContext;
import org.fao.geonet.constants.Geonet;
import org.fao.geonet.kernel.setting.SettingManager;
import org.jdom.Element;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
/**
* Handles the access to a metadata depending on the metadata/group.
*/
public class AccessManager {
public static final String OPER_VIEW = "0";
public static final String OPER_DOWNLOAD = "1";
public static final String OPER_EDITING = "2";
public static final String OPER_NOTIFY = "3";
public static final String OPER_DYNAMIC = "5";
public static final String OPER_FEATURED = "6";
public static final Map<String,String> ops = new HashMap<String,String>();
static {
ops.put("0","VIEW");
ops.put("1","DOWNLOAD");
ops.put("2","EDITING");
ops.put("3","NOTIFY");
ops.put("5","DYNAMIC");
ops.put("6","FEATURED");
};
//--------------------------------------------------------------------------
//---
//--- Constructor
//---
//--------------------------------------------------------------------------
/**
* Loads all permissions from database and caches them.
*
* @param dbms
* @param sm
* @throws SQLException
*/
public AccessManager(Dbms dbms, SettingManager sm) throws SQLException {
settMan = sm;
List operList = dbms.select("SELECT * FROM Operations").getChildren();
for (Object o : operList) {
Element oper = (Element) o;
String id = oper.getChildText("id");
String name = oper.getChildText("name");
//--- build Hashset of all operations
hsAllOps.add(id);
hmIdToName.put(Integer.parseInt(id), name);
hmNameToId.put(name, Integer.parseInt(id));
}
}
//--------------------------------------------------------------------------
//---
//--- API methods
//---
//--------------------------------------------------------------------------
/**
* Given a user(session) a list of groups and a metadata returns all operations that user can perform on that
* metadata (an set of OPER_XXX as keys).
* If the user is authenticated the permissions are taken from the groups the user belong.
* If the user is not authenticated, a dynamic group is assigned depending on user location (0 for internal and 1
* for external).
* @param context
* @param mdId
* @param ip
* @return
* @throws Exception
*/
public Set<String> getOperations(ServiceContext context, String mdId, String ip) throws Exception {
return getOperations(context, mdId, ip, null);
}
/**
* TODO javadoc.
*
* @param context
* @param mdId
* @param ip
* @param operations
* @return
* @throws Exception
*/
public Set<String> getOperations(ServiceContext context, String mdId, String ip, Element operations) throws Exception {
UserSession us = context.getUserSession();
// if user is an administrator OR is the owner of the record then allow all operations
if (isOwner(context,mdId)) {
return hsAllOps;
}
// otherwise build result
Set<String> out = new HashSet<String>();
Element ops;
if (operations == null) {
ops = getAllOperations(context, mdId, ip);
}
else {
ops = operations;
}
List operIds = Xml.selectNodes(ops, "record/operationid");
for (Object operId : operIds) {
Element elem = (Element) operId;
out.add(elem.getText());
}
if (us.isAuthenticated() && us.getProfile().equals(Geonet.Profile.EDITOR) && out.contains(OPER_EDITING)) {
out.add(OPER_VIEW);
}
return out;
}
/**
* Returns all operations permitted by the user on a particular metadata.
*
* @param context
* @param mdId
* @param ip
* @return
* @throws Exception
*/
public Element getAllOperations(ServiceContext context, String mdId, String ip) throws Exception {
Dbms dbms = (Dbms) context.getResourceManager().open(Geonet.Res.MAIN_DB);
UserSession usrSess = context.getUserSession();
// build group list
Set<String> groups = getUserGroups(dbms, usrSess, ip, false);
StringBuffer groupList = new StringBuffer();
for (Iterator i = groups.iterator(); i.hasNext(); ) {
String groupId = (String) i.next();
groupList.append(groupId);
if (i.hasNext())
groupList.append(", ");
}
// get allowed operations
StringBuffer query = new StringBuffer();
query.append("SELECT operationId, groupId ");
query.append("FROM OperationAllowed ");
query.append("WHERE groupId IN (");
query.append(groupList.toString());
query.append(") AND metadataId = ?");
Element operations = dbms.select(query.toString(), new Integer(mdId));
// find out what they could do if they registered and offer that as as a separate element
if (!usrSess.isAuthenticated()) {
query = new StringBuffer();
query.append("SELECT operationId, groupId ");
query.append("FROM OperationAllowed ");
query.append("WHERE groupId = -1 ");
query.append("AND metadataId = ?");
Element therecords = dbms.select(query.toString(), new Integer(mdId));
if (therecords != null) {
Element guestOperations = new Element("guestoperations");
guestOperations.addContent(therecords.cloneContent());
operations.addContent(guestOperations);
}
}
return operations;
}
/**
* Returns all groups accessible by the user (a set of ids).
*
* @param dbms
* @param usrSess
* @param ip
* @param editingGroupsOnly TODO
* @return
* @throws Exception
*/
public Set<String> getUserGroups(Dbms dbms, UserSession usrSess, String ip, boolean editingGroupsOnly) throws Exception {
Set<String> hs = new HashSet<String>();
// add All (1) network group
hs.add("1");
if (ip != null && isIntranet(ip))
hs.add("0");
// get other groups
if (usrSess.isAuthenticated()) {
// add (-1) GUEST group
hs.add("-1");
if (usrSess.getProfile().equals(Geonet.Profile.ADMINISTRATOR)) {
Element elUserGrp = dbms.select("SELECT id FROM Groups");
List list = elUserGrp.getChildren();
for (Object aList : list) {
Element el = (Element) aList;
String groupId = el.getChildText("id");
hs.add(groupId);
}
}
else {
StringBuffer query = new StringBuffer("SELECT distinct(groupId) FROM UserGroups WHERE ");
if (editingGroupsOnly) {
query.append("profile='"+Geonet.Profile.EDITOR+"' AND ");
}
query.append("userId=?");
Element elUserGrp = dbms.select(query.toString(), usrSess.getUserIdAsInt());
List list = elUserGrp.getChildren();
for (Object aList : list) {
Element el = (Element) aList;
String groupId = el.getChildText("groupid");
hs.add(groupId);
}
}
}
return hs;
}
/**
* TODO javadoc.
*
* @param dbms
* @param userId
* @return
* @throws Exception
*/
public Set<String> getVisibleGroups(Dbms dbms, String userId) throws Exception {
int id = Integer.parseInt(userId);
return getVisibleGroups(dbms,id);
}
/**
* TODO javadoc.
*
* @param dbms
* @param userId
* @return
* @throws Exception
*/
public Set<String> getVisibleGroups(Dbms dbms, int userId) throws Exception {
Set<String> hs = new HashSet<String>();
String query= "SELECT * FROM Users WHERE id=?";
List list = dbms.select(query, new Integer(userId)).getChildren();
//--- return an empty list if the user does not exist
if (list.size() == 0)
return hs;
Element user = (Element) list.get(0);
String profile = user.getChildText("profile");
Element elUserGrp;
if (profile.equals(Geonet.Profile.ADMINISTRATOR)) {
elUserGrp = dbms.select("SELECT id AS grp FROM Groups");
}
else {
elUserGrp = dbms.select("SELECT groupId AS grp FROM UserGroups WHERE userId=?", new Integer(userId));
}
for(Object o : elUserGrp.getChildren()) {
Element el = (Element) o;
String groupId =el.getChildText("grp");
hs.add(groupId);
}
return hs;
}
/**
* Returns true if, and only if, at least one of these conditions is satisfied:
* - The user is the metadata owner
* - The user is an Administrator
* - The user has edit rights over the metadata
* - The user is a Reviewer and/or UserAdmin and the metadata groupOwner
* is one of his groups.
*
* @param context
* @param id
* @return
* @throws Exception
*/
public boolean canEdit(ServiceContext context, String id) throws Exception {
return isOwner(context, id) || hasEditPermission(context, id);
}
/**
* TODO javadoc.
*
* @param context
* @param id
* @return
* @throws Exception
*/
public boolean isOwner(ServiceContext context, String id) throws Exception {
UserSession us = context.getUserSession();
if (!us.isAuthenticated()) {
return false;
}
//--- retrieve metadata info
GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
DataManager dm = gc.getDataManager();
Dbms dbms = (Dbms) context.getResourceManager().open(Geonet.Res.MAIN_DB);
MdInfo info = dm.getMetadataInfo(dbms, id);
//--- harvested metadata cannot be edited
// if (info == null || info.isHarvested)
if (info == null)
return false;
//--- check if the user is an administrator
if (us.getProfile().equals(Geonet.Profile.ADMINISTRATOR))
return true;
//--- check if the user is the metadata owner
//
if (us.getUserId().equals(info.owner))
return true;
//--- check if the user is a reviewer or useradmin
if (!us.getProfile().equals(Geonet.Profile.REVIEWER) && !us.getProfile().equals(Geonet.Profile.USER_ADMIN))
return false;
//--- if there is no group owner then the reviewer cannot review and the useradmin cannot administer
if (info.groupOwner == null)
return false;
for (String userGroup : getUserGroups(dbms, us, null, true)) {
if (userGroup.equals(info.groupOwner))
return true;
}
return false;
}
/**
* TODO javadoc.
*
* @param set
* @param delim
* @return
*/
private String join(Set<Integer> set, String delim) {
StringBuilder sb = new StringBuilder();
String loopDelim = "";
for(Integer s : set) {
sb.append(loopDelim);
sb.append(s+"");
loopDelim = delim;
}
return sb.toString();
}
/**
* Returns owners of metadata records.
*
* @param dbms
* @param metadataIds
* @return
* @throws Exception
*/
public Element getOwners(Dbms dbms, Set<Integer> metadataIds) throws Exception {
String query=
"SELECT m.id as metadataid, u.id as userid, u.name as name, u.surname as surname, u.email as email from Metadata m "+
"JOIN Users u on u.id = m.owner "+
"WHERE m.id IN (" + join(metadataIds,",") + ") "+
"ORDER BY u.id";
return dbms.select(query);
}
/**
* Returns content reviewers for metadata records.
*
* @param dbms
* @param metadataIds
* @return
* @throws Exception
*/
public Element getContentReviewers(Dbms dbms, Set<Integer> metadataIds) throws Exception {
String query=
"SELECT m.id as metadataid, u.id as userid, u.name as name, u.surname as surname, u.email as email from Metadata m "+
"JOIN UserGroups ug on m.groupOwner = ug.groupId "+
"JOIN Users u on u.id = ug.userId "+
"WHERE m.id IN (" + join(metadataIds,",") + ") "+
"AND ug.profile = '"+Geonet.Profile.REVIEWER+"' "+
"ORDER BY u.id";
return dbms.select(query);
}
/**
* Returns whether a particular metadata is visible to group 'all'.
*
* @param dbms
* @param metadataId
* @return
* @throws Exception
*/
public boolean isVisibleToAll(Dbms dbms, String metadataId) throws Exception {
// group 'all' has the magic id 1.
String query = "SELECT operationId FROM OperationAllowed WHERE groupId = 1 AND metadataId = ?";
Element result = dbms.select(query, new Integer(metadataId));
if(result == null) {
return false;
}
else {
List<Element> records = result.getChildren("record");
for(Element record : records) {
String operationId = record.getChildText("operationid");
if(operationId != null && operationId.equals(OPER_VIEW)) {
return true;
}
}
return false;
}
}
/**
* TODO javadoc.
*
* @param context
* @param id
* @return
* @throws Exception
*/
public boolean hasEditPermission(ServiceContext context, String id) throws Exception {
UserSession us = context.getUserSession();
if (!us.isAuthenticated())
return false;
//--- check if the user is an editor and has edit rights over the metadata record
String isEditorQuery = "SELECT groupId FROM UserGroups WHERE userId=? AND profile=?";
Dbms dbms = (Dbms) context.getResourceManager().open(Geonet.Res.MAIN_DB);
Element isEditorRes = dbms.select(isEditorQuery, Integer.parseInt(us.getUserId()), Geonet.Profile.EDITOR);
if (isEditorRes.getChildren().size() != 0) {
Set<String> hsOper = getOperations(context, id, context.getIpAddress());
if (hsOper.contains(OPER_EDITING)) return true;
}
return false;
}
/**
* TODO javadoc.
*
* @param descr
* @return
*/
public int getPrivilegeId(String descr) {
return hmNameToId.containsKey(descr) ? hmNameToId.get(descr) : -1;
}
/**
* TODO javadoc.
*
* @param id
* @return
*/
public String getPrivilegeName(int id) {
return hmIdToName.get(id);
}
//--------------------------------------------------------------------------
//---
//--- Private methods
//---
//--------------------------------------------------------------------------
/**
* TODO javadoc.
*
* @param ip
* @return
*/
private boolean isIntranet(String ip) {
//--- consider IPv4 & IPv6 loopback
//--- we use 'startsWith' because some addresses can be 0:0:0:0:0:0:0:1%0
if (ip.startsWith("0:0:0:0:0:0:0:1") || ip.equals("127.0.0.1")) return true;
// IPv6 link-local
String ipv6LinkLocalPrefix = "fe80:";
if(ip.toLowerCase().startsWith(ipv6LinkLocalPrefix)) {
return true;
}
// other IPv6
else if(ip.indexOf(':') >= 0) {
return false;
}
// IPv4
String network = settMan.getValue("system/intranet/network");
String netmask = settMan.getValue("system/intranet/netmask");
try {
long lIntranetNet = getAddress(network);
long lIntranetMask = getAddress(netmask);
long lAddress = getAddress(ip);
return (lAddress & lIntranetMask) == lIntranetNet ;
} catch (Exception nfe) {
nfe.printStackTrace();
return false;
}
}
/**
* Converts an ip x.x.x.x into a long.
*
* @param ip
* @return
*/
private long getAddress(String ip) {
StringTokenizer st = new StringTokenizer(ip, ".");
long a1 = Integer.parseInt(st.nextToken());
long a2 = Integer.parseInt(st.nextToken());
long a3 = Integer.parseInt(st.nextToken());
long a4 = Integer.parseInt(st.nextToken());
return a1<<24 | a2<<16 | a3<<8 | a4;
}
//--------------------------------------------------------------------------
//---
//--- Variables
//---
//--------------------------------------------------------------------------
private SettingManager settMan;
private Set<String> hsAllOps = new HashSet<String>();
private Map<Integer, String> hmIdToName = new HashMap<Integer, String>();
private Map<String, Integer> hmNameToId = new HashMap<String, Integer>();
}
|
[
"[email protected]"
] | |
874fa3088595a490510be7affc843707428d9081
|
be9b2d3ed6fc1e6c61447fbf4c8ef92cf42c3849
|
/src/test/java/com/learning/step_definitions/DataTableStepDefs.java
|
8eb3e4322a792761d9e6f837e1a4f5f805270741
|
[] |
no_license
|
Dovrannazar1990/cucumber-project
|
c3a61981611cce3ae1206fb0b773f878da3ed4bc
|
d47ebf9e4e076ac806822989d1e454e4f97144f4
|
refs/heads/master
| 2023-08-31T20:17:23.514849 | 2021-11-06T20:13:40 | 2021-11-06T20:13:40 | 425,339,072 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,523 |
java
|
package com.learning.step_definitions;
import com.learning.pages.WLoginPage;
import io.cucumber.java.en.And;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import java.util.List;
import java.util.Map;
public class DataTableStepDefs {
@Given("I have a {string}")
// @Given("I have a {word}")
public void i_have_a(String animal) {
System.out.println("Given I have a " + animal);
}
@When("I call their names")
public void i_call_their_names() {
System.out.println("When I call their names");
}
@Then("They come to me.")
public void they_come_to_me() {
System.out.println("Then they come to me");
}
@Given("I have following animals")
public void i_have_following_animals(List<String> animalLst) {
System.out.println("animalLst = " + animalLst);
}
@When("I call their names with below names")
public void iCallTheirNamesWithBelowNames(List<String> namesLst) {
System.out.println("namesLst = " + namesLst);
}
@Then("They come to me with below noise")
public void theyComeToMeWithBelowNoise(Map<String, String> animalNoiseMap) {
System.out.println("animalNoiseMap = " + animalNoiseMap);
}
@When("we provide below credentials")
public void weProvideBelowCredentials(Map<String, String> credentialMap) {
System.out.println("credentialMap = " + credentialMap);
String usernameFromTable = credentialMap.get("username");
String passwordFromTable = credentialMap.get("password");
WLoginPage loginPage = new WLoginPage();
loginPage.login(usernameFromTable, passwordFromTable);
}
@Given("this is the product reference")
public void thisIsTheProductReference(List<Map<String, Object>> productMapLst) {
// System.out.println("productMapLst = " + productMapLst);
// for (Map<String, Object> eachRawMap : productMapLst) {
// System.out.println("eachRawMap = " + eachRawMap);
// }
/**
* | Product | Price | Discount |
* | MyMoney | 100 | 0.08 |
* | FamilyAlbum | 80 | 0.15 |
* | ScreenSaver | 20 | 0.1 |
*/
Map<String, Object> thirdRowMap = productMapLst.get(2);
// The key is column name, the value is cell value
System.out.println("thirdRowMap = " + thirdRowMap);
// Print discount column of 3rd row
System.out.println("thirdRowMap.get(\"Discount\") = " + thirdRowMap.get("Discount"));
// Give me the Price value of 2nd row
System.out.println("productMapLst.get(1).get(\"Price\") = " + productMapLst.get(1).get("Price"));
}
@And("I have another product reference without header")
public void headlessTable(List<List<String>> productInfoList) {
/**
* | MyMoney | 100 | 0.08 |
* | FamilyAlbum | 80 | 0.15 |
* | ScreenSaver | 20 | 0.1 |
*/
System.out.println("productInfoList = " + productInfoList);
// Get me entire 3rd row
List<String> thirdRow = productInfoList.get(2);
System.out.println("thirdRow = " + thirdRow);
// Get the price value of third row
System.out.println("thirdRow price is = " + thirdRow.get(1));
// Get the discount column of first row
System.out.println("First row 3rd column value = " + productInfoList.get(0).get(2));
}
}
|
[
"[email protected]"
] | |
71b386c12acc7e6a7a4477a5b77cf6d21c49de98
|
3c71d7ea38510d108755d36c3f0ff7bbc2361b49
|
/src/io/swagger/client/model/SelectDTO.java
|
dad62ed62bee646c8be3bb65f9d94e67db178a67
|
[] |
no_license
|
Arxivar/ARXivar-NEXT-Dev-Java
|
a646b7075abf0c254877c7e9a0a73de7218dc62b
|
dcf690f5b857a1e784d7fe7af690dc207576d195
|
refs/heads/master
| 2022-01-26T13:21:08.710620 | 2018-07-17T12:35:17 | 2018-07-17T12:35:17 | 141,286,757 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,234 |
java
|
/*
* Abletech.Arxivar.Server.WebApi.Services
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: v1
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package io.swagger.client.model;
import java.util.Objects;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.FieldBaseForSelectDTO;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* Class of Select data
*/
@ApiModel(description = "Class of Select data")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-07-11T12:02:47.866+02:00")
public class SelectDTO {
@SerializedName("fields")
private List<FieldBaseForSelectDTO> fields = null;
@SerializedName("maxItems")
private Integer maxItems = null;
public SelectDTO fields(List<FieldBaseForSelectDTO> fields) {
this.fields = fields;
return this;
}
public SelectDTO addFieldsItem(FieldBaseForSelectDTO fieldsItem) {
if (this.fields == null) {
this.fields = new ArrayList<FieldBaseForSelectDTO>();
}
this.fields.add(fieldsItem);
return this;
}
/**
* Fields
* @return fields
**/
@ApiModelProperty(value = "Fields")
public List<FieldBaseForSelectDTO> getFields() {
return fields;
}
public void setFields(List<FieldBaseForSelectDTO> fields) {
this.fields = fields;
}
public SelectDTO maxItems(Integer maxItems) {
this.maxItems = maxItems;
return this;
}
/**
* Maximum Number of items
* @return maxItems
**/
@ApiModelProperty(value = "Maximum Number of items")
public Integer getMaxItems() {
return maxItems;
}
public void setMaxItems(Integer maxItems) {
this.maxItems = maxItems;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SelectDTO selectDTO = (SelectDTO) o;
return Objects.equals(this.fields, selectDTO.fields) &&
Objects.equals(this.maxItems, selectDTO.maxItems);
}
@Override
public int hashCode() {
return Objects.hash(fields, maxItems);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SelectDTO {\n");
sb.append(" fields: ").append(toIndentedString(fields)).append("\n");
sb.append(" maxItems: ").append(toIndentedString(maxItems)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
|
[
"[email protected]"
] | |
59f6d9a0e03636fa10b6958afa3fb3ceccccb48f
|
f3be3dd0650a445194571fc5719d541f21f56e8a
|
/src/woniuxy/f_composition/e/Test.java
|
4463c09025fdd5b1a2cccdf1ab42edb9a750a277
|
[] |
no_license
|
zhuxiuwei/design_patterns
|
a65afd24f51d42a8d7eeac2a24fb20f63e2d9574
|
30e594258a0f55433b4d8b07375aefd643761801
|
refs/heads/master
| 2023-07-27T07:51:56.218214 | 2021-09-11T10:26:16 | 2021-09-11T10:26:16 | 405,346,863 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 383 |
java
|
package woniuxy.f_composition.e;
import java.util.HashSet;
public class Test {
public static void main(String[] args) {
HashSet set = new HashSet();
MyHashSet ms = new MyHashSet(set);
ms.add(1);
ms.add(2);
ms.add(3);
HashSet set2 = new HashSet();
set2.add(10);
set2.add(20);
set2.add(30);
ms.addAll(set2);
System.out.println(ms.getCount());
}
}
|
[
"[email protected]"
] | |
014e4aa5943390811cd0af0ede74ef0d716de672
|
c9f638f2daa20d52689d3b89debc5c1d6ced8d09
|
/CetusControlWEB/src/co/com/cetus/cetuscontrol/web/bean/MyTaskMBean.java
|
56139b619dff6b504cc58bdecccaab651c1caa58
|
[] |
no_license
|
CetusTech/cetus_control
|
7b6e0b6936c06acab1ee1c6339779ba2b1573ebc
|
c0cea466ce33f32ce4f69cbbb5423b46a486f97a
|
refs/heads/master
| 2020-04-06T07:13:09.527885 | 2016-10-16T23:36:48 | 2016-10-16T23:36:48 | 46,017,740 | 0 | 0 | null | null | null | null |
ISO-8859-3
|
Java
| false | false | 16,641 |
java
|
package co.com.cetus.cetuscontrol.web.bean;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import org.primefaces.event.CloseEvent;
import org.primefaces.event.DashboardReorderEvent;
import org.primefaces.event.ItemSelectEvent;
import org.primefaces.event.SelectEvent;
import org.primefaces.event.ToggleEvent;
import org.primefaces.model.DashboardColumn;
import org.primefaces.model.DashboardModel;
import org.primefaces.model.DefaultDashboardColumn;
import org.primefaces.model.DefaultDashboardModel;
import org.primefaces.model.chart.Axis;
import org.primefaces.model.chart.AxisType;
import org.primefaces.model.chart.BarChartModel;
import org.primefaces.model.chart.ChartSeries;
import org.primefaces.model.chart.PieChartModel;
import co.com.cetus.cetuscontrol.dto.AreaDTO;
import co.com.cetus.cetuscontrol.dto.PriorityDTO;
import co.com.cetus.cetuscontrol.dto.StatusDTO;
import co.com.cetus.cetuscontrol.dto.TaskDTO;
import co.com.cetus.cetuscontrol.dto.TaskTypeDTO;
import co.com.cetus.cetuscontrol.dto.UserPortalDTO;
import co.com.cetus.cetuscontrol.web.delegate.GeneralDelegate;
import co.com.cetus.cetuscontrol.web.util.ConstantWEB;
import co.com.cetus.common.dto.ResponseDTO;
import co.com.cetus.common.util.UtilCommon;
/**
* The Class MyTaskMBean.
* Clase para el manejo de reporte diagrama con los status de las tareas del usuario relacionado.
* @author eChia - Cetus Technology
* @version CetusControlWEB (16/07/2015)
*/
@ManagedBean
@RequestScoped
public class MyTaskMBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/** The list register. */
private List< TaskDTO > listRegister = null;
/** The selected object. */
private TaskDTO selectedObject = null;
private BarChartModel barModel;
private DashboardModel model;
private PieChartModel pieModel;
protected GeneralDelegate generalDelegate = GeneralDelegate.getInstance();
Map< String, Integer > progressTask = new HashMap< String, Integer >();
private List< TaskDTO > reportTaskSelected = null;
private long prioritySelected = 0;
private boolean showViewDetail = false;
List< PriorityDTO > priorityList;
/**
*
*/
public MyTaskMBean () {
}
@PostConstruct
public void init () {
listRegister();
createBarModel();
createPieModels();
model = new DefaultDashboardModel();
DashboardColumn column1 = new DefaultDashboardColumn();
DashboardColumn column2 = new DefaultDashboardColumn();
column1.addWidget( "task" );
column2.addWidget( "priority" );
column1.addWidget( "myProgress" );
model.addColumn( column1 );
model.addColumn( column2 );
}
@SuppressWarnings ( "unchecked" )
private void listRegister () {
ResponseDTO response = null;
try {
/**Consultar tareas en curso del usuario:**/
response = generalDelegate.findTaskByPerson( getUserDTO().getPerson().getId() );
if ( UtilCommon.validateResponseSuccess( response ) ) {
//Respuesta del servicio
this.listRegister = ( List< TaskDTO > ) response.getObjectResponse();
if ( this.listRegister == null ) this.listRegister = new ArrayList< TaskDTO >();
} else {
//si no encontro registro para listar
if ( UtilCommon.validateResponseNoResult( response ) ) {
this.listRegister = new ArrayList< TaskDTO >();
}
}
/**Consultar situaciรณn del usuario:**/
response = generalDelegate.findProgressTaskByPerson( getUserDTO().getPerson().getId(), getUserDTO().getPerson().getClient().getClientCetus()
.getId() );
if ( UtilCommon.validateResponseSuccess( response ) ) {
//Respuesta del servicio
this.progressTask = ( HashMap< String, Integer > ) response.getObjectResponse();
} else {
//si no encontro registro para listar
if ( UtilCommon.validateResponseNoResult( response ) ) {
this.progressTask = new HashMap< String, Integer >();
}
}
} catch ( Exception e ) {
this.listRegister = new ArrayList< TaskDTO >();
addMessageError( null, e.getMessage(), "" );
ConstantWEB.WEB_LOG.error( e.getMessage(), e );
}
}
public void onRowSelect ( SelectEvent event ) {
try {
selectedObject = ( ( TaskDTO ) event.getObject() );
if ( selectedObject != null ) {
addObjectSession( selectedObject, "selectedObject" );
showViewDetail = true;
}
} catch ( Exception e ) {
ConstantWEB.WEB_LOG.error( e.getMessage(), e );
addMessageError( null, ConstantWEB.MESSAGE_ERROR, e.getMessage() );
}
}
@SuppressWarnings ( "unchecked" )
private void createBarModel () {
barModel = new BarChartModel();
//barModel.setTitle( ConstantWEB.MYTASK_MY_PRIORITY_DIGRAM_TITLE );
barModel.setLegendPosition( "ne" );
barModel.setSeriesColors( ConstantWEB.MYTASK_TASK_BAR_SERIESCOLORS );
Axis xAxis = barModel.getAxis( AxisType.X );
//xAxis.setLabel( ConstantWEB.MYTASK_MY_PRIORITY_H_LABEL );
Axis yAxis = barModel.getAxis( AxisType.Y );
yAxis.setLabel( ConstantWEB.MYTASK_MY_PRIORITY_V_LABEL );
yAxis.setMin( 0 );
yAxis.setMax( 10 );
ResponseDTO response = null;
try {
response = generalDelegate.findPriorityByClientCetus( getUserDTO().getPerson().getClient().getClientCetus().getId() );
if ( UtilCommon.validateResponseSuccess( response ) ) {
this.priorityList = ( List< PriorityDTO > ) response.getObjectResponse();
} else {
if ( UtilCommon.validateResponseNoResult( response ) ) {
this.priorityList = new ArrayList< PriorityDTO >();
}
}
} catch ( Exception e ) {
addMessageError( null, e.getMessage(), "" );
ConstantWEB.WEB_LOG.error( e.getMessage(), e );
}
ChartSeries prioridad = new ChartSeries();
for ( PriorityDTO priorityDTO: priorityList ) {
long sum = 0;
prioridad = new ChartSeries();
prioridad.setLabel( priorityDTO.getDescription() );
for ( TaskDTO taskDTO2: listRegister ) {
if ( taskDTO2.getPriority().getId() == priorityDTO.getId() ) sum++;
}
prioridad.set( ConstantWEB.MYTASK_MY_PRIORITY_H_LABEL, sum );
barModel.addSeries( prioridad );
}
}
private void createPieModels () {
createPieModel();
}
private void createPieModel () {
try {
pieModel = new PieChartModel();
pieModel.setFill( true );
pieModel.setShowDataLabels( true );
//pieModel.setTitle( ConstantWEB.MYTASK_MY_PROGRESS_DIGRAM_TITLE );
pieModel.setLegendPosition( "w" );
pieModel.setMouseoverHighlight( true );
pieModel.setSeriesColors( ConstantWEB.MYTASK_TASK_PIE_SERIESCOLORS );
for ( Map.Entry< String, Integer > entry: progressTask.entrySet() ) {
pieModel.set( entry.getKey(), entry.getValue() );
}
} catch ( Exception e ) {
e.printStackTrace();
}
}
public void handleReorder ( DashboardReorderEvent event ) {
FacesMessage message = new FacesMessage();
message.setSeverity( FacesMessage.SEVERITY_INFO );
message.setSummary( "Reordered: " + event.getWidgetId() );
message.setDetail( "Item index: " + event.getItemIndex() + ", Column index: " + event.getColumnIndex() + ", Sender index: "
+ event.getSenderColumnIndex() );
addMessage( message );
}
public void handleClose ( CloseEvent event ) {
FacesMessage message = new FacesMessage( FacesMessage.SEVERITY_INFO, "Panel Closed", "Closed panel id:'" + event.getComponent().getId() + "'" );
addMessage( message );
}
public void handleToggle ( ToggleEvent event ) {
FacesMessage message = new FacesMessage( FacesMessage.SEVERITY_INFO, event.getComponent().getId() + " toggled", "Status:"
+ event.getVisibility().name() );
addMessage( message );
}
private void addMessage ( FacesMessage message ) {
FacesContext.getCurrentInstance().addMessage( null, message );
}
public static UserPortalDTO getUserDTO () {
return ( UserPortalDTO ) getObjectSession( ConstantWEB.DESC_USER_DTO );
}
public static Object getObjectSession ( String pKey ) {
try {
if ( FacesContext.getCurrentInstance() != null && FacesContext.getCurrentInstance().getExternalContext() != null ) {
return FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get( pKey );
}
} catch ( Exception e ) {
ConstantWEB.WEB_LOG.error( e.getMessage(), e );
}
return null;
}
public static void addMessageError ( String compId, String msg, String detail ) {
FacesContext ctx = null;
FacesMessage fmsg = null;
try {
ctx = FacesContext.getCurrentInstance();
fmsg = new FacesMessage( FacesMessage.SEVERITY_ERROR, msg, detail );
ctx.addMessage( compId, fmsg );
} catch ( Exception e ) {
ConstantWEB.WEB_LOG.error( e.getMessage(), e );
}
}
public void addObjectSession ( Object obj, String key ) {
try {
if ( FacesContext.getCurrentInstance() != null && FacesContext.getCurrentInstance().getExternalContext() != null ) {
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put( key, obj );
}
} catch ( Exception e ) {
ConstantWEB.WEB_LOG.error( e.getMessage(), e );
}
}
@SuppressWarnings ( "unchecked" )
public void itemBarSelect ( ItemSelectEvent event ) {
showViewDetail = true;
int itemIndex = event.getSeriesIndex();
int count = 0;
String key = null;
ResponseDTO response = null;
List< ChartSeries > chartSeries = barModel.getSeries();
for ( ChartSeries chartSerie: chartSeries ) {
if ( count == itemIndex ) {
key = chartSerie.getLabel();
break;
}
count++;
}
/**Consultar tareas por prioridad seleccionada:**/
response = generalDelegate.findTaskByPersonPriority( getUserDTO().getPerson().getId(), key );
if ( UtilCommon.validateResponseSuccess( response ) ) {
//Respuesta del servicio
this.reportTaskSelected = ( List< TaskDTO > ) response.getObjectResponse();
if ( this.reportTaskSelected == null ) this.reportTaskSelected = new ArrayList< TaskDTO >();
} else {
//si no encontro registro para listar
if ( UtilCommon.validateResponseNoResult( response ) ) {
this.reportTaskSelected = new ArrayList< TaskDTO >();
}
}
}
@SuppressWarnings ( "unchecked" )
public void itemPieSelect ( ItemSelectEvent event ) {
showViewDetail = true;
int itemIndex = event.getItemIndex();
int count = 0;
String key = null;
ResponseDTO response = new ResponseDTO();
try {
@SuppressWarnings ( { "rawtypes" } )
Map< String, Integer > hmap = ( Map ) pieModel.getData();
for ( Map.Entry< String, Integer > entry: hmap.entrySet() ) {
key = entry.getKey();
if ( count == itemIndex ) {
if ( key.equals( ConstantWEB.MESSAGE_DES_RUN ) ) { // En curso
response = generalDelegate.findTaskByPersonRun( getUserDTO().getPerson().getId(), getUserDTO().getPerson().getClient().getId() );
} else if ( key.equals( ConstantWEB.MESSAGE_DES_EXPIRED ) ) { // Vencidas
response = generalDelegate.findTaskByPersonExpired( getUserDTO().getPerson().getId(), getUserDTO().getPerson().getClient()
.getClientCetus().getId() );
} else if ( key.equals( ConstantWEB.MESSAGE_DES_NEXT_OVERCOME ) ) { // Proximas a vencer
response = generalDelegate.findTaskByPersonNexOvercome( getUserDTO().getPerson().getId(), getUserDTO().getPerson().getClient()
.getClientCetus().getId() );
} else if ( key.equals( ConstantWEB.MESSAGE_DES_FINISH ) ) { // Completadas
response = generalDelegate.findTaskByPersonCompleted( getUserDTO().getPerson().getId(), getUserDTO().getPerson().getClient()
.getClientCetus().getId() );
}
if ( UtilCommon.validateResponseSuccess( response ) ) {
//Respuesta del servicio
this.reportTaskSelected = ( List< TaskDTO > ) response.getObjectResponse();
if ( this.reportTaskSelected == null ) this.reportTaskSelected = new ArrayList< TaskDTO >();
} else {
//si no encontro registro para listar
if ( UtilCommon.validateResponseNoResult( response ) ) {
this.reportTaskSelected = new ArrayList< TaskDTO >();
}
}
count = 0;
break;
}
count++;
}
} catch ( Exception e ) {
ConstantWEB.WEB_LOG.error( e.getMessage(), e );
}
}
public void closeDialogView () {
selectedObject = new TaskDTO();
selectedObject.setArea( new AreaDTO() );
selectedObject.setPriority( new PriorityDTO() );
selectedObject.setStatus( new StatusDTO() );
selectedObject.setTaskType( new TaskTypeDTO() );
}
public List< TaskDTO > getListRegister () {
return listRegister;
}
public void setListRegister ( List< TaskDTO > listRegister ) {
this.listRegister = listRegister;
}
public TaskDTO getSelectedObject () {
return selectedObject;
}
public void setSelectedObject ( TaskDTO selectedObject ) {
this.selectedObject = selectedObject;
}
public BarChartModel getBarModel () {
return barModel;
}
public void setBarModel ( BarChartModel barModel ) {
this.barModel = barModel;
}
public DashboardModel getModel () {
return model;
}
public void setModel ( DashboardModel model ) {
this.model = model;
}
public Map< String, Integer > getProgressTask () {
return progressTask;
}
public void setProgressTask ( Map< String, Integer > progressTask ) {
this.progressTask = progressTask;
}
public PieChartModel getPieModel () {
return pieModel;
}
public void setPieModel ( PieChartModel pieModel ) {
this.pieModel = pieModel;
}
public List< TaskDTO > getReportTaskSelected () {
return reportTaskSelected;
}
public void setReportTaskSelected ( List< TaskDTO > reportTaskSelected ) {
this.reportTaskSelected = reportTaskSelected;
}
public boolean isShowViewDetail () {
return showViewDetail;
}
public void setShowViewDetail ( boolean showViewDetail ) {
this.showViewDetail = showViewDetail;
}
public long getPrioritySelected () {
return prioritySelected;
}
public void setPrioritySelected ( long prioritySelected ) {
this.prioritySelected = prioritySelected;
}
}
|
[
"[email protected]"
] | |
fa5290b43b1467c8709254e5f173685ca9d5edf6
|
590fa472f2428d9e28f4ee0f642c02b6d6f60d20
|
/app/src/main/java/com/example/TrainiaTeam/Trainia/GmailLogin.java
|
b36089abebc8a6a09189b8b089fc92d452dff23d
|
[] |
no_license
|
70747H/Trainia
|
1650ab6366c62393d094973a247537b013ec86cf
|
773f9ff187eadc8d10cd6822cdbb2b795e7b1e0f
|
refs/heads/master
| 2021-01-19T04:25:12.883887 | 2016-06-29T10:29:48 | 2016-06-29T10:29:48 | 60,627,994 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 11,710 |
java
|
package com.example.TrainiaTeam.Trainia;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.IntentSender;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.Scope;
import com.google.android.gms.plus.Plus;
import com.google.android.gms.plus.model.people.Person;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.api.Scope;
import com.google.android.gms.plus.Plus;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.plus.model.people.Person;
import java.io.InputStream;
public class GmailLogin extends AppCompatActivity implements GoogleApiClient.OnConnectionFailedListener, View.OnClickListener, GoogleApiClient.ConnectionCallbacks {
Button FbloginButton;
GoogleApiClient google_api_client;
GoogleApiAvailability google_api_availability;
SignInButton signIn_btn;
private static final int SIGN_IN_CODE = 0;
private static final int PROFILE_PIC_SIZE = 120;
private ConnectionResult connection_result;
private boolean is_intent_inprogress;
private boolean is_signInBtn_clicked;
private int request_code;
ProgressDialog progress_dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
buidNewGoogleApiClient();
setContentView(R.layout.activity_gmail_login);
// buidNewGoogleApiClient();
//Customize sign-in button.a red button may be displayed when Google+ scopes are requested
custimizeSignBtn();
setBtnClickListeners();
progress_dialog = new ProgressDialog(this);
progress_dialog.setMessage("Signing in...");
}
/*
create and initialize GoogleApiClient object to use Google Plus Api.
While initializing the GoogleApiClient object, request the Plus.SCOPE_PLUS_LOGIN scope.
*/
private void buidNewGoogleApiClient(){
google_api_client = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API,Plus.PlusOptions.builder().build())
.addScope(Plus.SCOPE_PLUS_LOGIN)
.build();
}
private void custimizeSignBtn(){
signIn_btn = (SignInButton) findViewById(R.id.sign_in_button);
signIn_btn.setSize(SignInButton.SIZE_STANDARD);
signIn_btn.setScopes(new Scope[]{Plus.SCOPE_PLUS_LOGIN});
}
/*
Set on click Listeners on the sign-in sign-out and disconnect buttons
*/
private void setBtnClickListeners() {
// Button listeners
signIn_btn.setOnClickListener(this);
findViewById(R.id.sign_out_button).setOnClickListener(this);
}
@Override
public void onConnected(Bundle arg0) {
is_signInBtn_clicked = false;
// Get user's information and set it into the layout
getProfileInfo();
// Update the UI after signin
changeUI(true);
}
@Override
public void onConnectionSuspended(int arg0) {
google_api_client.connect();
changeUI(false);
}
private void gPlusSignIn() {
if (!google_api_client.isConnecting()) {
Log.d("user connected", "connected");
is_signInBtn_clicked = true;
progress_dialog.show();
resolveSignInError();
}
getProfileInfo();
}
private void gPlusRevokeAccess() {
if (google_api_client.isConnected()) {
Plus.AccountApi.clearDefaultAccount(google_api_client);
Plus.AccountApi.revokeAccessAndDisconnect(google_api_client)
.setResultCallback(new ResultCallback<Status>() {
@Override
public void onResult(Status arg0) {
Log.d("GmailLogin", "User access revoked!");
buidNewGoogleApiClient();
google_api_client.connect();
changeUI(false);
}
});
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.sign_in_button:
Toast.makeText(this, "start signIn process", Toast.LENGTH_SHORT).show();
gPlusSignIn();
break;
case R.id.sign_out_button:
Toast.makeText(this, "Sign Out from G+", Toast.LENGTH_LONG).show();
gPlusSignOut();
gPlusRevokeAccess();
break;
}
}
/**
Method to resolve any signin errors
* */
private void resolveSignInError() {
if (connection_result.hasResolution()) {
try {
is_intent_inprogress = true;
connection_result.startResolutionForResult(this, SIGN_IN_CODE);
Log.d("resolve error", "sign in error resolved");
} catch (IntentSender.SendIntentException e) {
is_intent_inprogress = false;
google_api_client.connect();
}
}
}
/*
Show and hide of the Views according to the user login status
*/
private void changeUI(boolean signedIn) {
if (signedIn) {
findViewById(R.id.sign_in_button).setVisibility(View.GONE);
findViewById(R.id.sign_out_button).setVisibility(View.VISIBLE);
} else {
findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE);
findViewById(R.id.sign_out_button).setVisibility(View.GONE);
}
}
/**
* get user's information name, email, profile pic,Date of birth,tag line and about me
* */
private void getProfileInfo() {
try {
if (Plus.PeopleApi.getCurrentPerson(google_api_client) != null) {
Person currentPerson = Plus.PeopleApi.getCurrentPerson(google_api_client);
setPersonalInfo(currentPerson);
Intent i = new Intent(this, Sign_up_2.class);
startActivity(i);
( this).overridePendingTransition(0, 0);
} else {
Toast.makeText(getApplicationContext(),
"Oops, No internet connection", Toast.LENGTH_LONG).show();
progress_dialog.dismiss();
Intent i = new Intent(this, Sign_In.class);
startActivity(i);
( this).overridePendingTransition(0, 0);
}
} catch (Exception e) {
e.printStackTrace();
}
}
/*
set the User information into the views defined in the layout
*/
private void setPersonalInfo(Person currentPerson){
String personName = currentPerson.getDisplayName();
String personPhotoUrl = currentPerson.getImage().getUrl();
String email = Plus.AccountApi.getAccountName(google_api_client);
String BirthDay = currentPerson.getBirthday();
// Person.Gender gender = currentPerson.getGender();
Toast.makeText(getApplicationContext(),
"Gender: " + currentPerson.getAgeRange(), Toast.LENGTH_LONG).show();
//Log.i(TAG, "Gender: " + currentPerson.getGender());
setProfilePic(personPhotoUrl);
progress_dialog.dismiss();
}
/*
By default the profile pic url gives 50x50 px image.
If you need a bigger size image we have to change the query parameter value from 50 to the size you want
*/
private void setProfilePic(String profile_pic){
profile_pic = profile_pic.substring(0,
profile_pic.length() - 2)
+ PROFILE_PIC_SIZE;
ImageView user_picture = (ImageView)findViewById(R.id.profile_pic);
new LoadProfilePic(user_picture).execute(profile_pic);
}
@Override
protected void onActivityResult(int requestCode, int responseCode,
Intent intent) {
// Check which request we're responding to
if (requestCode == SIGN_IN_CODE) {
request_code = requestCode;
if (responseCode != RESULT_OK) {
is_signInBtn_clicked = false;
progress_dialog.dismiss();
}
is_intent_inprogress = false;
if (!google_api_client.isConnecting()) {
google_api_client.connect();
}
}
}
/**
Perform background operation asynchronously, to load user profile picture with new dimensions from the modified url
* */
private class LoadProfilePic extends AsyncTask<String, Void, Bitmap> {
ImageView bitmap_img;
public LoadProfilePic(ImageView bitmap_img) {
this.bitmap_img = bitmap_img;
}
protected Bitmap doInBackground(String... urls) {
String url = urls[0];
Bitmap new_icon = null;
try {
InputStream in_stream = new java.net.URL(url).openStream();
new_icon = BitmapFactory.decodeStream(in_stream);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return new_icon;
}
protected void onPostExecute(Bitmap result_img) {
bitmap_img.setImageBitmap(result_img);
}
}
/**
* Sign-out from Google+ account
* */
private void gPlusSignOut() {
if (google_api_client.isConnected()) {
Plus.AccountApi.clearDefaultAccount(google_api_client);
google_api_client.disconnect();
google_api_client.connect();
changeUI(false);
}
}
@Override
public void onConnectionFailed(ConnectionResult result) {
if (!result.hasResolution()) {
google_api_availability.getErrorDialog(this, result.getErrorCode(),request_code).show();
return;
}
if (!is_intent_inprogress) {
connection_result = result;
if (is_signInBtn_clicked) {
resolveSignInError();
}
}
}
protected void onStart() {
super.onStart();
// Add this line to initiate connection
google_api_client.connect();
}
protected void onStop() {
super.onStop();
if (google_api_client.isConnected()) {
google_api_client.disconnect();
}
}
protected void onResume(){
super.onResume();
if (google_api_client.isConnected()) {
google_api_client.connect();
}
}
//____________________________________________________________________________
}
|
[
"[email protected]"
] | |
ea9eb19afa7aaaf4afd06d4bb68a3411eb9dbc83
|
2e382f31dc44b8f5cb4e4f8dd5e7943e15f06fc9
|
/backend/src/main/java/de/hackathondd/dvblive/application/AbschnittService.java
|
b305cac06282bd5b3c082672c5132de1511022dc
|
[
"MIT"
] |
permissive
|
Tiffel/dvblive
|
07200336f21d20ccfac1b5a5c247a83242ec50b7
|
833e53abd12540b5355a1536a66c431b2566a443
|
refs/heads/master
| 2020-09-07T05:39:33.124818 | 2019-11-14T13:32:21 | 2019-11-14T13:32:21 | 220,672,586 | 3 | 1 |
MIT
| 2019-11-09T18:53:27 | 2019-11-09T16:46:01 | null |
UTF-8
|
Java
| false | false | 4,157 |
java
|
package de.hackathondd.dvblive.application;
import java.time.Duration;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import de.hackathondd.dvblive.domain.Abschnitt;
import de.hackathondd.dvblive.domain.Journey;
import org.springframework.stereotype.Service;
@Service
public class AbschnittService {
private final LinienService linienService;
public AbschnittService(LinienService linienService) {
this.linienService = linienService;
}
public Collection<Abschnitt> alle() {
Map<String, Abschnitt> abschnitte = new HashMap<>();
for (LinieTo linie : linienService.getAll()) {
List<HaltestelleTo> haltestelleTos = linie.getHaltestellen();
for (int i = 0; i < linie.getHaltestellen().size() - 1; i++) {
HaltestelleTo current = haltestelleTos.get(i);
HaltestelleTo next = haltestelleTos.get(i + 1);
Duration maxVerspaetung = next.getJourneys().stream().map(Journey::getDifference)
.max(Duration::compareTo).orElseGet(() -> Duration.ZERO);
Abschnitt abschnitt = new Abschnitt(current.getTriasCode(), next.getTriasCode(), maxVerspaetung,
new Abschnitt.Position(current.getLatitude(), current.getLongitude()),
new Abschnitt.Position(next.getLatitude(), next.getLongitude()));
Abschnitt existierender = abschnitte.get(current.getTriasCode() + next.getTriasCode());
if (existierender != null) {
existierender.addLinie(linie.getNummer());
if (abschnitt.getMaxVerspaetung().minus(existierender.getMaxVerspaetung()).isNegative()) {
//der schon vorhandene ist grรถรer
} else {
//der schon vorhandene ist kleiner, also den neuen nehmen
abschnitt.addLinien(existierender.getLinien());
abschnitte.put(current.getTriasCode() + next.getTriasCode(), abschnitt);
}
} else {
abschnitt.addLinie(linie.getNummer());
abschnitte.put(current.getTriasCode() + next.getTriasCode(), abschnitt);
}
}
}
return abschnitte.values();
}
public Collection<Abschnitt> jeLinie(String triasNummer) {
Map<String, Abschnitt> abschnitte = new HashMap<>();
LinieTo linie = linienService.getLinie(triasNummer);
List<HaltestelleTo> haltestelleTos = linie.getHaltestellen();
for (int i = 0; i < linie.getHaltestellen().size() - 1; i++) {
HaltestelleTo current = haltestelleTos.get(i);
HaltestelleTo next = haltestelleTos.get(i + 1);
Duration maxVerspaetung = next.getJourneys().stream().map(Journey::getDifference)
.max(Duration::compareTo).orElseGet(() -> Duration.ZERO);
Abschnitt abschnitt = new Abschnitt(current.getTriasCode(), next.getTriasCode(), maxVerspaetung,
new Abschnitt.Position(current.getLatitude(), current.getLongitude()),
new Abschnitt.Position(next.getLatitude(), next.getLongitude()));
Abschnitt existierender = abschnitte.get(current.getTriasCode() + next.getTriasCode());
if (existierender != null) {
existierender.addLinie(linie.getNummer());
if (abschnitt.getMaxVerspaetung().minus(existierender.getMaxVerspaetung()).isNegative()) {
//der schon vorhandene ist grรถรer
} else {
//der schon vorhandene ist kleiner, also den neuen nehmen
abschnitt.addLinien(existierender.getLinien());
abschnitte.put(current.getTriasCode() + next.getTriasCode(), abschnitt);
}
} else {
abschnitt.addLinie(linie.getNummer());
abschnitte.put(current.getTriasCode() + next.getTriasCode(), abschnitt);
}
}
return abschnitte.values();
}
}
|
[
"[email protected]"
] | |
0f18d785c7ebf4c3cdb58705e92fcf8e7048c1f7
|
6f6ec5831c47bc7e89f24880128884c8e8d91cff
|
/src/main/java/com/tb121/ssm/service/UserService.java
|
997c610002689d36ca9ff4fb7376831e4573272e
|
[] |
no_license
|
tchjava/testjson
|
212af53eb28288127f18dfdf8f53be975cbe8071
|
d6fabdd713b5161ca5a49f2e7b12c1d09d1bc1e3
|
refs/heads/master
| 2020-04-07T11:05:18.637852 | 2018-12-24T03:19:48 | 2018-12-24T03:19:48 | 158,312,150 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 255 |
java
|
package com.tb121.ssm.service;
import com.tb121.ssm.entity.User;
import com.baomidou.mybatisplus.service.IService;
/**
* <p>
* ๆๅก็ฑป
* </p>
*
* @author zuoshuai
* @since 2018-11-16
*/
public interface UserService extends IService<User> {
}
|
[
"[email protected]"
] | |
203303dd19cacceee46cd9c3dde4d9ba9e48f340
|
f94aa81e24dd712f71cb0ebcbcde00ae5fde76e8
|
/src/main/java/com/github/maquina1995/rest/configuration/ValidationConfiguration.java
|
18928098ffc62ee856fd4a4c76a0f6c7098057e3
|
[
"Apache-2.0"
] |
permissive
|
MaQuiNa1995/Rest-Testing-SpringBoot-Guide
|
b7fe42de58b4eafb1f02239aa5e65e98323e5533
|
c3097b10bb043268c7ab4845f3b9db8793b6eff0
|
refs/heads/master
| 2023-08-27T15:29:08.115537 | 2021-11-08T21:55:50 | 2021-11-08T21:55:50 | 423,023,768 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 435 |
java
|
package com.github.maquina1995.rest.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
@Configuration
public class ValidationConfiguration {
@Bean
public MethodValidationPostProcessor methodValidationPostProcessor() {
return new MethodValidationPostProcessor();
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.