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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a5d5de79e407468b426f75709fef2b6bea54d4d7 | bf335904c147b65e25946b8415f0b2dc4a63caae | /src/test/chapter1/part3/MyStackTest.java | b4d6979834f8b7f170f7a99afccd4b8573c86f6c | [] | no_license | cuong-mai/data-structures-and-algorithms-book-sedgewick-wayne | 76a1de5fcd3d78b614327faf47e2400ff89dbbe4 | 5fda10b68c7e72150b67e216874c99e8c8a3776d | refs/heads/master | 2020-12-02T12:16:38.255601 | 2020-02-03T04:22:10 | 2020-02-03T04:22:10 | 231,002,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 831 | java | package chapter1.part3;
import org.junit.Assert;
import org.junit.Test;
import java.util.Iterator;
public class MyStackTest {
private final String INPUT = "to be or not to - be - - that - - - is";
@Test
public void test() {
MyStack<String> stack = new MyStack<>();
String[] splitStrings = INPUT.split(" ");
for (String s : splitStrings) {
if (!s.equals("-")) {
stack.push(s);
} else {
String p = stack.pop();
System.out.println(p);
}
}
Assert.assertFalse(stack.isEmpty());
Assert.assertEquals(2, stack.size());
Iterator<String> iterator = stack.iterator();
Assert.assertEquals("is", iterator.next());
Assert.assertEquals("to", iterator.next());
}
}
| [
"cuong@cuongmai.net"
] | cuong@cuongmai.net |
4efdb3cf8efb02f77eae82a618c44b5b849cf39f | 39830d0883f98281ab56f6da6a65b24264a3d619 | /src/com/cmbs/ssm/service/impl/CustomerServiceImpl.java | 3e16c80cbaef9f15aa0f261164c075aa57c4b41d | [] | no_license | DataMZ/cmbs | 2197ce919d6ccb3b9e46e370822e76bc60945d2b | 749211b867555a32b66d1f95c27d6df90bb4e8ad | refs/heads/master | 2020-03-28T22:39:32.362063 | 2019-07-29T04:33:13 | 2019-07-29T04:33:13 | 149,221,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,770 | java | package com.cmbs.ssm.service.impl;
import com.cmbs.ssm.mapper.CustomerMapper;
import com.cmbs.ssm.pojo.Customer;
import com.cmbs.ssm.service.CustomerService;
import com.cmbs.ssm.utils.BusinessMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Map;
/**
* @author: zwc
* @date: 2018/9/8 14:51
* @description:
*/
@Service
public class CustomerServiceImpl implements CustomerService {
@Autowired
private CustomerMapper customerMapper;
@Override
public Customer queryByIdTypeAndNum(Customer customer) {
return customerMapper.queryByIdTypeAndNum(customer);
}
@Override
public boolean idCardCodeVerify(String cardcode) {
//第一代身份证正则表达式(15位)
String isIDCard1 = "^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$";
//第二代身份证正则表达式(18位)
String isIDCard2 ="^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])((\\d{4})|\\d{3}[A-Z])$";
//验证身份证
if (cardcode.matches(isIDCard1) || cardcode.matches(isIDCard2)) {
return true;
}
return false;
}
@Override
public boolean officerCardCodeVerify(String cardcode) {
//军官证7位
String isIDCard1 = "\\d{7}";
//校验
if(cardcode.matches(isIDCard1)) {
return true;
}
return false;
}
@Override
public boolean passportCardCodeVerify(String cardcode) {
//护照校验7位
String isIDCard1 = "^1[45][0-9]{7}|G[0-9]{8}|P[0-9]{7}|S[0-9]{7,8}|D[0-9]+$";
if(cardcode.matches(isIDCard1)) {
return true;
}
return false;
}
@Override
public Customer setDateFormat(Customer customer) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
customer.setCustomerBirthdayFormat(simpleDateFormat.format(customer.getCustomerBirthday()));
return customer;
}
@Override
public Customer setIdCardName(Customer customer) {
Map<String,String> cardMap = BusinessMap.getCardMap();
customer.setIdTypeStr(cardMap.get(customer.getIdType()));
return customer;
}
@Override
public boolean addCustomer(Customer customer) {
boolean isAdd = false;
if(customerMapper.addCustomer(customer)==1) {
isAdd = true;
}
return isAdd;
}
@Override
public boolean updateByIdTypeAndNum(Customer customer) {
boolean isUpdate = false;
if(customerMapper.updateByIdTypeAndNum(customer)==1) {
isUpdate = true;
}
return isUpdate;
}
}
| [
"458375497@qq.com"
] | 458375497@qq.com |
20fc7c7a229b3a81759529f24e76e94eb979a6aa | f55e7639cb72914e2a24e89f52d74636f5bc3317 | /src/main/java/com/epam/jwd/text/interpreter/impl/TerminalExpressionOr.java | 82a374851c88f9315b666e95b602b6f2c2e45076 | [] | no_license | S1mpleKnight/textProcessing | a592e4e86859b877685bae13afd0504b42de252b | 9daf050ee165dc325091edce3503a6144ad8b796 | refs/heads/master | 2023-03-26T09:08:27.528092 | 2021-03-26T08:33:47 | 2021-03-26T08:33:47 | 334,184,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 285 | java | package com.epam.jwd.text.interpreter.impl;
import com.epam.jwd.text.interpreter.api.AbstractExpression;
public class TerminalExpressionOr implements AbstractExpression{
@Override
public void interpret(Expression c){
c.pushValue(c.popValue() | c.popValue());
}
}
| [
"became.adult77@gmail.com"
] | became.adult77@gmail.com |
ba44c37384c1ac21d9d2a55c46111b3d9048cacc | b93e4e1550d76c054d5e004c7c027a7cd94898c3 | /springclouddemo2/demo2-common-service1/src/main/java/com/example/demo/Demo2CommonService1Application.java | ac0c513fa134958bf38dcbdd66e9da0b460f00eb | [] | no_license | ZhangGuozhao/springclouddemo | 14a7a5fd5379aa373831118786dee9f3a1dfd180 | ec316b535815f615987180b3611999a55c021383 | refs/heads/master | 2021-08-08T00:47:25.243633 | 2017-11-09T08:00:54 | 2017-11-09T08:00:54 | 109,664,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
@EnableDiscoveryClient
@SpringBootApplication
public class Demo2CommonService1Application {
public static void main(String[] args) {
SpringApplication.run(Demo2CommonService1Application.class, args);
}
}
| [
"412687009@qq.com"
] | 412687009@qq.com |
f362e1c02caeef4ed1dc963a393b4d9b87da431c | 3ff5f86c737006e382752eee1375045b15b29679 | /hulaBusiness/common/src/main/java/com/common/retrofit/entity/resultImpl/ResponseResult.java | 4e1f27be744fc0323d9d7b8765705a973cb50ed7 | [] | no_license | NFKJ/RxCodeRetrofit | 3dabfa40d3df34773761d949ee25acf93eacd644 | 2f86a46708fb83090116c05197173ca888a72db0 | refs/heads/master | 2020-06-16T03:23:26.579499 | 2017-01-12T07:11:12 | 2017-01-12T07:11:12 | 75,248,953 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 227 | java | package com.common.retrofit.entity.resultImpl;
public class ResponseResult {
private HttpResult d;
public HttpResult getD() {
return d;
}
public void setD(HttpResult d) {
this.d = d;
}
}
| [
"703473298@qq.com"
] | 703473298@qq.com |
69a15e79cacc09718ba976a4224ec82ac4c1fa96 | ac82c09fd704b2288cef8342bde6d66f200eeb0d | /projects/OG-Core/src/main/java/com/opengamma/core/position/Portfolio.java | 798634aa3bb62f9105aa9577c12ff6b334a505ac | [
"Apache-2.0"
] | permissive | cobaltblueocean/OG-Platform | 88f1a6a94f76d7f589fb8fbacb3f26502835d7bb | 9b78891139503d8c6aecdeadc4d583b23a0cc0f2 | refs/heads/master | 2021-08-26T00:44:27.315546 | 2018-02-23T20:12:08 | 2018-02-23T20:12:08 | 241,467,299 | 0 | 2 | Apache-2.0 | 2021-08-02T17:20:41 | 2020-02-18T21:05:35 | Java | UTF-8 | Java | false | false | 1,510 | java | /**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.core.position;
import com.opengamma.core.Attributable;
import com.opengamma.id.UniqueId;
import com.opengamma.id.UniqueIdentifiable;
import com.opengamma.util.PublicSPI;
/**
* A portfolio of positions, typically having business-level meaning.
* <p>
* A portfolio is the primary element of business-level grouping within the source of positions.
* It consists of a number of positions which are grouped using a flexible tree structure.
* <p>
* A portfolio typically has meta-data.
* <p>
* This interface is read-only.
* Implementations may be mutable.
*/
@PublicSPI
public interface Portfolio extends UniqueIdentifiable, Attributable {
/**
* Gets the unique identifier of the portfolio.
* <p>
* This specifies a single version-correction of the portfolio.
*
* @return the unique identifier for this portfolio, not null within the engine
*/
@Override
UniqueId getUniqueId();
/**
* Gets the root node in the portfolio.
* <p>
* The positions stored in a portfolios are held in a tree structure.
* This method accesses the root of the tree structure.
*
* @return the root node of the tree structure, not null
*/
PortfolioNode getRootNode();
/**
* Gets the name of the portfolio intended for display purposes.
*
* @return the display name, not null
*/
String getName();
}
| [
"cobaltblue.ocean@gmail.com"
] | cobaltblue.ocean@gmail.com |
98f8a772eb08e40681ecd9658e6d35d8ea9f672a | bdd8adc98f3d86c05b27b6757b0783ca27c7d1d6 | /aboot-system/src/main/java/com/wteam/modules/library/domain/dto/OrderTimeDTO.java | 34ebfc05858805c9872652830ad740f0b0005861 | [] | no_license | linzexin12138/library | 5af100556d97cfd9e9615623c4a07a617f3860b3 | 810a52592f0490277b9eb4163d630d86f8513ee4 | refs/heads/master | 2022-12-28T05:16:36.479488 | 2020-10-13T14:21:22 | 2020-10-13T14:21:22 | 300,242,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 354 | java | package com.wteam.modules.library.domain.dto;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalTime;
/**
* @author Charles
* @since 2020/9/28 19:07
*/
@Data
public class OrderTimeDTO implements Serializable {
private Long id;
private String name;
private LocalTime starTime;
private LocalTime endTime;
}
| [
"836392826@qq.com"
] | 836392826@qq.com |
04201bd98deefd8b9886c201f9dcf38db7fbee21 | ac187f3921a55b876bc39cec2b2b86c61ba24a9e | /ServicioWebV3/app/src/main/java/com/example/tecsup/serviciowebv3/usuarios.java | b2eec597e3a943da569e83e11d3a6b7a0dcecbde | [] | no_license | GlendaJulia/AndroidStudioProjects | 324d455a2ace973573612b7432c4406d1c65e4ca | 4e2c84a45dc382e1cb430f290962f3953113c791 | refs/heads/master | 2020-04-10T10:31:21.801470 | 2018-12-08T19:09:21 | 2018-12-08T19:09:21 | 160,968,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,350 | java | package com.example.tecsup.serviciowebv3;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONException;
import java.util.ArrayList;
import java.util.List;
public class usuarios extends AppCompatActivity {
EditText txtBuscar;
Button btnBuscar, btnCargar, btnSalir, btnAgregar;
ListView lstLista;
List<String> elementosLista;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_usuarios);
txtBuscar = findViewById(R.id.txtBuscar);
btnBuscar = findViewById(R.id.btnBuscar);
btnCargar = findViewById(R.id.btnCargar);
btnSalir = findViewById(R.id.btnSalir);
btnAgregar = findViewById(R.id.btnAgregar);
lstLista = findViewById(R.id.lstLista);
registerForContextMenu(lstLista);
}
public void mostrarAlerta(String titulo, String mensaje){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(titulo);
builder.setMessage(mensaje);
builder.setPositiveButton("Aceptar", null);
AlertDialog alerta = builder.create();
alerta.show();
}
public void cargarLista(View v){
AsyncTask.execute(new Runnable() {
@Override
public void run() {
elementosLista = new ArrayList<String>();
RequestQueue queue = Volley.newRequestQueue(getApplicationContext());
String url ="http://192.168.43.49:8080/WebApp05.1/rest/usuarios/list";
JsonArrayRequest stringRequest = new JsonArrayRequest(url,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
try {
for (int i=0; i<response.length();i++){
String codigo = response.getJSONObject(i).getString("codigo");
String nombre = response.getJSONObject(i).getString("nombre");
String clave = response.getJSONObject(i).getString("clave");
String estado = response.getJSONObject(i).getString("estado");
String data = "CODIGO: \u0009" + codigo + "\n" +
"NOMBRE: \u0009" + nombre + "\n" +
"CLAVE: \u0009" + clave + "\n" +
"ESTADO: \u0009" + estado;
elementosLista.add(data);
}
ArrayAdapter<String> adaptador =
new ArrayAdapter<String>(getApplicationContext(),
android.R.layout.simple_list_item_1, elementosLista);
lstLista.setAdapter(adaptador);
mostrarAlerta("Estado de Carga",
"Se cargaron " + elementosLista.size() + " elementos" );
} catch (JSONException e) {
mostrarAlerta("Error de JSON",
"Se produjo un error al intentar leer la data recibida");
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
mostrarAlerta("Error de conexion",
"Compuebe que el servicio este activo");
}
});
queue.add(stringRequest);
};
});
}
public void buscarUsuario(View v){
AsyncTask.execute(new Runnable() {
@Override
public void run() {
elementosLista = new ArrayList<String>();
String buscar = txtBuscar.getText().toString().trim();
RequestQueue queue = Volley.newRequestQueue(getApplicationContext());
String url ="http://192.168.43.49:8080/WebApp05.1/rest/usuarios/consult?nombre=" + buscar;
JsonArrayRequest stringRequest = new JsonArrayRequest(url,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
try {
for (int i=0; i<response.length();i++){
String codigo = response.getJSONObject(i).getString("codigo");
String nombre = response.getJSONObject(i).getString("nombre");
String clave = response.getJSONObject(i).getString("clave");
String estado = response.getJSONObject(i).getString("estado");
String data = "CODIGO: \u0009" + codigo + "\n" +
"NOMBRE: \u0009" + nombre + "\n" +
"CLAVE: \u0009" + clave + "\n" +
"ESTADO: \u0009" + estado;
elementosLista.add(data);
}
ArrayAdapter<String> adaptador =
new ArrayAdapter<String>(getApplicationContext(),
android.R.layout.simple_list_item_1, elementosLista);
lstLista.setAdapter(adaptador);
mostrarAlerta("Estado de Carga",
"Se cargaron " + elementosLista.size() + " elementos" );
} catch (JSONException e) {
mostrarAlerta("Error de JSON",
"Se produjo un error al intentar leer la data recibida");
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
mostrarAlerta("Error de conexion",
"Compuebe que el servicio este activo");
}
});
queue.add(stringRequest);
};
});
}
public void Salir(View v){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Salir");
builder.setMessage("¿Desea realmente salir de la aplicacion?");
builder.setPositiveButton("Salir", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent mostrarLogin = new Intent(getApplicationContext(),MainActivity.class);
startActivity(mostrarLogin);
finish();
}
});
builder.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
AlertDialog alerta = builder.create();
alerta.show();
}
public void addUsuario(View v){
Intent addUsuaurio = new Intent(this, addUsuarios.class);
startActivity(addUsuaurio);
finish();
}
String valor ="";
@Override
public void onCreateContextMenu(ContextMenu menucontextual, View v, ContextMenu.ContextMenuInfo menuInfo){
super.onCreateContextMenu(menucontextual,v,menuInfo);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.sub_menu, menucontextual);
int seleccionLista;
if(v.getId()==R.id.lstLista){
seleccionLista = ((AdapterView.AdapterContextMenuInfo)menuInfo).position;
menucontextual.setHeaderTitle(lstLista.getAdapter().getItem(seleccionLista).toString().substring(9,10));
valor=lstLista.getAdapter().getItem(seleccionLista).toString();
}
}
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
switch (item.getItemId()) {
case R.id.eliminar:
Toast.makeText(getBaseContext(), "Elegiste Eliminar" + valor.substring(9, 10), Toast.LENGTH_SHORT).show();
AsyncTask.execute(new Runnable() {
@Override
public void run() {
RequestQueue queue = Volley.newRequestQueue(getApplicationContext());
String url = "http://192.168.43.49:8080/WebApp05.1/rest/usuarios/delete?codigo=" + valor.substring(9, 10);
JsonArrayRequest stringRequest = new JsonArrayRequest(Request.Method.DELETE, url, null,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
try {
String valor = response.getJSONObject(0).getString("rpt");
if (valor.equals("true")) {
Toast.makeText(getApplicationContext(), "eliminado", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(), "No se puedo eleiminar", Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
Toast.makeText(getApplicationContext(), "error de la data recibida", Toast.LENGTH_LONG).show();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), "Compruebe que tiene accceso a internet", Toast.LENGTH_LONG).show();
}
});
queue.add(stringRequest);
}
;
});
return true;
case R.id.actualizar:
Intent editarUsuarios = new Intent(this, actualizar.class);
int posicion = Integer.parseInt(valor.substring(9, 10));
editarUsuarios.putExtra("ID", posicion);
startActivity(editarUsuarios);
return true;
default:
return super.onContextItemSelected(item);
}
}
}
| [
"40405402+GlendaJulia@users.noreply.github.com"
] | 40405402+GlendaJulia@users.noreply.github.com |
3f69d18a673aedd35a9abc310715c559fc6e04fc | 68449dd01b0998714a5a8e9016d5097fb2112dd9 | /Leetcode/算法/119-杨辉三角II/Main.java | 0bb62cf4c9e2b30b4cac59da1214841f93812044 | [] | no_license | XsJim/Problem-Solving-Record-Java | 113dd58f180033dcedadb7358d7f06d666c00312 | a0453d2ddf206aa22372f14701481dc1558839e0 | refs/heads/master | 2021-07-05T16:51:53.573573 | 2021-06-19T08:43:24 | 2021-06-19T08:43:24 | 239,968,743 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 971 | java | import java.util.List;
import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
System.out.println(new Solution().getRow(0));
System.out.println(new Solution().getRow(1));
System.out.println(new Solution().getRow(2));
System.out.println(new Solution().getRow(3));
System.out.println(new Solution().getRow(33));
}
}
class Solution {
// 根据二项展开式和杨辉三角的关系,直接递推得出杨辉三角的某一行
public List<Integer> getRow(int rowIndex) {
List<Integer> ans = new ArrayList<>();
ans.add(1);
int prev = 1;
int index = 1;
while (index < rowIndex) {
int current = (int)(1.0 * prev * (rowIndex - index + 1) / index);
ans.add(current);
prev = current;
index++;
}
if (rowIndex != 0) ans.add(1);
return ans;
}
} | [
"shixinsheng@live.cn"
] | shixinsheng@live.cn |
2949f26a867509317c495e9420649140a36d6631 | 3f22ab7508d7fe1b0768aa60e46dae17ecd18d72 | /app/src/main/java/com/models/AllProductsPojo.java | e66c4796737841750c2412bcf014e03bf6072827 | [] | no_license | rohtml/MyAndroRepo | 7124b6a809d1e42b3c15843e08081b390c6a0afa | 35846dc31898235eac4bce5dabc92f1849b9a922 | refs/heads/master | 2020-05-25T02:04:06.994599 | 2019-05-20T05:00:29 | 2019-05-20T05:00:29 | 187,569,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 672 | java |
package com.models;
import java.util.ArrayList;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class AllProductsPojo {
@SerializedName("code")
@Expose
private String code;
@SerializedName("data")
@Expose
private ArrayList<AllProductsResponse> data = null;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public ArrayList<AllProductsResponse> getData() {
return data;
}
public void setData(ArrayList<AllProductsResponse> data) {
this.data = data;
}
}
| [
"rohtml@gmail.com"
] | rohtml@gmail.com |
976607af5fb82687275f7f761f06b077d3ff5649 | 0f75d604811fbb47a3158d917f7ff592ad017238 | /app/src/main/java/me/hash/asm/OnClickAnalytics.java | 03ca7c9b521462e425f7a5f5bc7f083e270696b5 | [] | no_license | HashWaney/ASMDemo | 945ae7aa22c23e4e7fadd52ae48303069ed5df49 | 62e634d1674b85c08f3e5a16dbe521c9ceee4606 | refs/heads/master | 2022-10-15T18:24:37.881738 | 2020-06-09T16:21:15 | 2020-06-09T16:21:15 | 270,310,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 469 | java | package me.hash.asm;
import android.util.Log;
import android.view.View;
import androidx.annotation.Keep;
/**
* Created by Hash on 2020/6/7.
*/
public class OnClickAnalytics {
// 为啥这里要用static 方法,因为这个通过类加载的形式,类名的方式调用onViewClick方法
// 因为这个类
@Keep
public static void onViewClick(View view) {
Log.e(OnClickAnalytics.class.getSimpleName(), "插入成功:" + view);
}
}
| [
"HashWaney@gmail.com"
] | HashWaney@gmail.com |
f5011fe650bd39eed0a84b776b8f069a58e65a82 | a268734e0391427c98b2d897048fd38c0cf3c7ff | /src/ex21jdbc/statement/SelectSQL1.java | b3c62274a7b5a590c9c298f46c178749c95b31a6 | [] | no_license | sseoy/K01JAVA | f253a2d8b8ba6eec45b2732de4ceb937230ba98c | f04bbc31d88bc682a981c52ae048abe8ffc09cfd | refs/heads/master | 2021-02-19T11:20:32.675335 | 2020-06-30T12:29:24 | 2020-06-30T12:29:24 | 245,307,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,120 | java | package ex21jdbc.statement;
import java.sql.SQLException;
public class SelectSQL1 extends ConnectDB {
//생성자메소드
public SelectSQL1() {
super();
}
/*
ResultSet클래스
:select문 실행시 쿼리의 실행결과가 ResultSet객체에 저장된다.
결과로 반환된 레코드의 처음부터 마지막까지 next()메소드를 통해 확인후
반복하면서 추출하게 된다.
-get XXX()계열의 메소드
오라클의 자료형이
number타입 : getInt()
char/varchar2타입 : getString()
date타입 : getDate()
메소드로 각 컬럼의 데이터를 추출한다.
-인자는 select절의 컬럼순서대로 인덱스(1부터 시작)를 사용하러간
컬러명을 사용할수 잇다.
-자료형에 상관없이 getString()으로 모든 데이터를 추출할수 있다.
*/
@Override
void execute() {
try {
stmt = con.createStatement();
String query = "SELECT id, pass, name, regidate from member";
rs = stmt.executeQuery(query);
while(rs.next()) {
String id = rs.getString(1);
String pw = rs.getString("pass");
String name = rs.getString("name");
/*
오라클의 date타입을 getDate()로 추출하면
2020-03-25 형태로 출력된다. 이경우 date형 자료가 되기
때문에 java.sql.Date클래스의 참조변수로 저장해야한다.
*/
java.sql.Date regidate = rs.getDate("regidate");
System.out.printf("%-10s %-10s %-13s %-20s\n",
id, pw, name, regidate);
}
}
catch (SQLException e) {
System.out.println("쿼리오류발생");
e.printStackTrace();
}
finally {
close(); //DB자원반납
}
}
public static void main(String[] args) {
SelectSQL1 selectSQL1 = new SelectSQL1();
selectSQL1.execute();
}
} | [
"Kosmo_15@DESKTOP-BF01J45"
] | Kosmo_15@DESKTOP-BF01J45 |
510653934068f21ebaf036aed46a0c72e0e9d7d2 | 14e474525676291b975403b819a1b52c59909824 | /Provider/src/com/shashi/provider/db/ProviderDatabase.java | 60d798281e4c721671db7cec0fcc2f9bdaedfbb4 | [] | no_license | varuniiit/serviceme1 | cd11409da636c57693b9ad4a814efcc5b0ef6dda | f5bd2b3db08500300c7f1677ae7520f0fad4f048 | refs/heads/master | 2016-09-06T05:14:56.725531 | 2015-01-04T16:23:03 | 2015-01-04T16:23:03 | 28,478,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,327 | java | package com.shashi.provider.db;
import com.j256.ormlite.field.DatabaseField;
//@Table(name = "WorkerNotification")
public class ProviderDatabase {
@DatabaseField(generatedId = true, canBeNull = false)
int id;
@DatabaseField(canBeNull = true)
String customerName;
@DatabaseField(canBeNull = true)
String timeToService;
@DatabaseField(canBeNull = true)
String locationToService;
@DatabaseField(canBeNull = true)
String providerAcceptedStatus;
@DatabaseField(canBeNull = true)
String customerAcceptedStatus;
@DatabaseField(canBeNull = true)
String requestId;
@DatabaseField(canBeNull = true)
String installationId;
public ProviderDatabase() {
// TODO Auto-generated constructor stub
}
public String getInstallationId() {
return installationId;
}
public void setInstallationId(String installationId) {
this.installationId = installationId;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getTimeToService() {
return timeToService;
}
public void setTimeToService(String timeToService) {
this.timeToService = timeToService;
}
public String getLocationToService() {
return locationToService;
}
public void setLocationToService(String locationToService) {
this.locationToService = locationToService;
}
public String getProviderAcceptedStatus() {
return providerAcceptedStatus;
}
public void setProviderAcceptedStatus(String acceptedStatus) {
this.providerAcceptedStatus = acceptedStatus;
}
public String getCustomerAcceptedStatus() {
return customerAcceptedStatus;
}
public void setCustomerAcceptedStatus(String customerAcceptedStatus) {
this.customerAcceptedStatus = customerAcceptedStatus;
}
public String getRequestId() {
return requestId;
}
public void setRequestId(String customerId) {
this.requestId = customerId;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("id=").append(id);
sb.append(", ").append(customerName);
sb.append(", ").append(timeToService);
sb.append(", ").append(locationToService);
sb.append(", ").append(providerAcceptedStatus);
return sb.toString();
}
}
| [
"sharathmk99@gmail.com"
] | sharathmk99@gmail.com |
81229991aaed1b9c8e976aa07b6125d21f21e911 | c116fc2d962d7c81add805eac4deff6ac6a3b829 | /laboratory/src/main/java/thot/LaboratoryListener.java | 140cc8a9def190a9120b030efb18b7dacecef899 | [] | no_license | lagerbie/classmanager | efb1cdd91e70e7e096cfb3b653fc1669b9ad8a65 | c2cf39b2256b11d6aed0cf990fa24d37063cf603 | refs/heads/master | 2020-03-16T02:25:12.159265 | 2018-05-07T13:57:33 | 2018-05-07T13:57:33 | 132,464,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,144 | java | /*
* ClassManager - Supervision de classes et Laboratoire de langue
* Copyright (C) 2013 Fabrice Alleau <fabrice.alleau@siclic.fr>
*
* This file is part of ClassManager.
*
* ClassManager is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* ClassManager 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with ClassManager. If not, see <http://www.gnu.org/licenses/>.
*/
package thot;
/**
* Listener pour écouter les changement d'état du coeur du laboratoire de
* langue.
*
* @author Fabrice Alleau
* @version 1.90
*/
public interface LaboratoryListener extends LaboListener {
/**
* Appelé quand la langue a été changée.
*
* @param language la nouvelle langue pour l'interface.
*/
void languageChanged(String language);
/**
* Appelé quand le volume du module multimédia a changé.
*
* @param volume le nouveau volume en poucentage (de 0 à 100).
*/
void mediaVolumeChanged(int volume);
/**
* Appelé quand le volume du module audio a changé.
*
* @param volume le nouveau volume en poucentage (de 0 à 100).
*/
void audioVolumeChanged(int volume);
/**
* Appelé quand l'état des commandes de l'élève ont changé.
*
* @param freeze le nouvel état.
*/
void studentControlChanged(boolean freeze);
/**
* Appelé pour afficher un message à l'écran.
*
* @param message le message à afficher.
*/
void newMessage(String message);
/**
* Appelé quand une demande d'aide à été envoyée.
*
* @param success le succes de la commande.
*/
void helpDemandSuccess(boolean success);
}
| [
"lagerbiie@yahoo.fr"
] | lagerbiie@yahoo.fr |
36ae0c5e751e12bf0024391c4c8e5cc8da63f924 | 3fa81745f496781124bb772ef018db4125d70e6f | /src/Input.java | c534bb621de2c619192b7cb8936fa8eed7b150e9 | [] | no_license | jg2356/compilers_ch2 | debe18c0315779eff6f6863d3a7f495b544f1664 | bd3eb5258932d3bdf42155a4ab3ea8d0e7f056d9 | refs/heads/master | 2021-01-10T18:46:03.919854 | 2015-05-23T20:22:13 | 2015-05-23T20:22:13 | 35,767,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 616 | java | import java.util.ArrayList;
import java.util.Iterator;
public class Input implements Iterator<Character> {
private final Iterator<Character> iterator;
public Input(String text) {
if (text == null)
throw new IllegalArgumentException("text");
ArrayList<Character> input = new ArrayList<Character>();
for (Character c : text.toCharArray()) {
input.add(c);
}
iterator = input.iterator();
}
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public Character next() {
return iterator.next();
}
@Override
public void remove() {
iterator.remove();
}
}
| [
"k13gomez@gmail.com"
] | k13gomez@gmail.com |
3ae1b1dfc38ed6ecd5f48e2e55fa783610c91878 | 699b0c576e4ab65d2fc4abcfef3ea57743545af8 | /Basics/src/Eighth_test.java | e850a5868fbaf61d746d7460a399944175ce12c2 | [] | no_license | DimaShebanov/JavaWorkspace | d019559ef397e3984b9e8604855d521a493fb6cd | 1329364e1bedf1267ed909b8bb156f2a538bd3f0 | refs/heads/master | 2021-01-21T06:42:55.329991 | 2017-05-17T14:15:01 | 2017-05-17T14:15:01 | 91,575,820 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | public class Eighth_test {
public static void main(String[] args) {
int num=2278;
int res=square(num);
System.out.println(res);
}
public static int square(int num)
{
int res=0;
for (double i=1;i<=num;i+=0.5)
{
if (num/i>=i&&num/i<=i+0.99)
{
res=(int)i;
}
}
return res;
}
}
| [
"dima.shebanov1997@gmail.com"
] | dima.shebanov1997@gmail.com |
61e1693bc77241ae2a304ae794588ddcc2ede952 | 10186b7d128e5e61f6baf491e0947db76b0dadbc | /org/w3c/dom/html/HTMLBaseFontElement.java | 5805bb3d644960583f88b62ad6795c63c9294fa6 | [
"SMLNJ",
"Apache-1.1",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | MewX/contendo-viewer-v1.6.3 | 7aa1021e8290378315a480ede6640fd1ef5fdfd7 | 69fba3cea4f9a43e48f43148774cfa61b388e7de | refs/heads/main | 2022-07-30T04:51:40.637912 | 2021-03-28T05:06:26 | 2021-03-28T05:06:26 | 351,630,911 | 2 | 0 | Apache-2.0 | 2021-10-12T22:24:53 | 2021-03-26T01:53:24 | Java | UTF-8 | Java | false | false | 441 | java | package org.w3c.dom.html;
public interface HTMLBaseFontElement extends HTMLElement {
String getColor();
void setColor(String paramString);
String getFace();
void setFace(String paramString);
String getSize();
void setSize(String paramString);
}
/* Location: /mnt/r/ConTenDoViewer.jar!/org/w3c/dom/html/HTMLBaseFontElement.class
* Java compiler version: 1 (45.3)
* JD-Core Version: 1.1.3
*/ | [
"xiayuanzhong+gpg2020@gmail.com"
] | xiayuanzhong+gpg2020@gmail.com |
03bcfe370c97eecbd87542b6aa530142bdeeb27f | 84821afb0594651f4d6ac945699f778bc52aec4d | /pay-service-user/src/main/java/wusc/edu/pay/core/agent/biz/AgentRequestLogBiz.java | 6bb922026e1cdbe43c3568f000fceaf5074ee18d | [] | no_license | zhengefeng/Test-Pay | 04a7f0cfa3a4afb4859ea54dc6de14470a0b95ff | 3ec27bf8653a696baf7211cf6a2147c00c35cc64 | refs/heads/master | 2021-01-21T06:46:28.887897 | 2017-03-27T05:33:23 | 2017-03-27T05:33:23 | 86,283,659 | 4 | 5 | null | null | null | null | UTF-8 | Java | false | false | 1,247 | java | package wusc.edu.pay.core.agent.biz;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import wusc.edu.pay.common.page.PageBean;
import wusc.edu.pay.common.page.PageParam;
import wusc.edu.pay.core.agent.dao.AgentRequestLogDao;
import wusc.edu.pay.facade.agent.entity.AgentRequestLog;
/***
* 代理商申请文件日志biz类
* @author Administrator
*
*/
@Component("agentRequestLogBiz")
public class AgentRequestLogBiz {
@Autowired
private AgentRequestLogDao agentRequestLogDao;
/***
* 查询申请列表
*/
public PageBean listPage(PageParam pageParam, Map<String, Object> paramMap){
return agentRequestLogDao.listPage(pageParam, paramMap);
}
public AgentRequestLog getFileById(long id) {
return agentRequestLogDao.getById(id);
}
public long createFile(AgentRequestLog log) {
return agentRequestLogDao.insert(log);
}
public long updateFile(AgentRequestLog log) {
return agentRequestLogDao.update(log);
}
/***
* 查询审核记录列表
* @param id
* @return
*/
public List<AgentRequestLog> listRequestLogByFileId(Long id) {
return agentRequestLogDao.listRequestLogByFileId(id);
}
}
| [
"fengzhenge@zaonline.com"
] | fengzhenge@zaonline.com |
587016f65bd69de074360bdc10396fd60cb6b6b5 | 579430f037591f76ec1654fceef0bbd267000b35 | /src/main/java/com/init/prueba/entitys/Grupo.java | a7f383f0e1151ea0e524229652accd4f82dfb8af | [] | no_license | eduardojesus12/prueba-api-java | 4f20b69154562e4c40d9bd790db9b8068f6d7bb5 | 5be460176aaf33313c11be54f059ea48b7977783 | refs/heads/main | 2023-04-04T20:08:00.645743 | 2021-04-01T22:28:11 | 2021-04-01T22:28:11 | 353,824,921 | 0 | 0 | null | 2021-04-01T23:54:07 | 2021-04-01T20:57:34 | Java | UTF-8 | Java | false | false | 1,204 | java | package com.init.prueba.entitys;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name="grupos")
public class Grupo {
@Id
@Column(name="id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(name="descripcion", nullable = false, length=255)
private String descripcion;
@Column(name="tipo", nullable = false, length=255)
private String tipo;
@OneToMany( targetEntity=Participante.class )
private List participantes;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public String getTipo() {
return tipo;
}
public void setTipo(String tipo) {
this.tipo = tipo;
}
public List getParticipantes() {
return participantes;
}
public void setParticipantes(List participantes) {
this.participantes = participantes;
}
}
| [
"c.eduardo.jesus@outlook.com"
] | c.eduardo.jesus@outlook.com |
70d6584daf6437a70be9b02e589b54c49dfa3407 | 8ccf02af2c905660b1a71f8606a3b9b3a8b4077c | /app/src/test/java/com/adiguzel/anil/kochisstteil/ExampleUnitTest.java | d393e5f6afaa934b2577ea55c1e6ebf250d78113 | [] | no_license | adgzlanl/KochIsstTeil_app_Android | 5974e510fe8bb82c0171d1e69edc27c335e19639 | 1f174c5e62fd1dac6cbf7e4626e8193056d47cfc | refs/heads/master | 2021-07-04T11:36:00.999966 | 2017-09-26T22:10:07 | 2017-09-26T22:10:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package com.adiguzel.anil.kochisstteil;
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);
}
} | [
"aniladiguzel@outlook.com"
] | aniladiguzel@outlook.com |
854b5873f377eb835dedcbf2c47e58479b3d9009 | 902ff761b2afabf27ff3ddcf39a6b30b7284a964 | /app/src/main/java/tv/twitch/android/settings/z/d.java | ce50589d4be12464fcc666edc93e469721acb7b4 | [] | no_license | FrozenAlex/TwitchMod | 0c1047a0950872f6a75912deafeabefa5ff65533 | 171f533bf96edc47e491beefa9d50d4ea7d2c059 | refs/heads/master | 2022-11-17T12:06:08.242370 | 2022-11-14T13:43:04 | 2022-11-14T13:43:04 | 276,454,639 | 49 | 3 | null | 2020-07-01T18:33:58 | 2020-07-01T18:33:58 | null | UTF-8 | Java | false | false | 1,021 | java | package tv.twitch.android.settings.z;
import tv.twitch.android.mod.settings.SettingsController;
import tv.twitch.android.shared.ui.menus.j;
import tv.twitch.android.shared.ui.menus.s.b;
/**
* Source: SystemSettingsPresenter
*/
public class d extends tv.twitch.android.settings.l.b {
public static final class ToggleMenuChangeListener implements j { // TODO: __INJECT_CLASS
@Override
public void a(tv.twitch.android.shared.ui.menus.k.b bVar) {}
@Override
public void a(b item, boolean isChecked) {
SettingsController.OnToggleEvent(item, isChecked);
}
}
@Override
protected tv.twitch.android.settings.l.d U1() {
return null;
}
@Override
public String X1() {
return null;
}
@Override
protected j V1() { // TODO: __REPLACE_METHOD
return new ToggleMenuChangeListener();
}
@Override
public void c2() { // TODO: __REPLACE_METHOD
SettingsController.initialize(R1(), W1());
}
}
| [
"nopbreak@gmail.com"
] | nopbreak@gmail.com |
5078e3787d4744d7eab603dfca96aa51e0491d66 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XWIKI-13316-7-12-FEMO-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/internal/template/InternalTemplateManager_ESTest.java | da8a9b827a13dcf80c9c7161e90880ed562aa577 | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 584 | java | /*
* This file was automatically generated by EvoSuite
* Sat Apr 04 00:05:13 UTC 2020
*/
package com.xpn.xwiki.internal.template;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class InternalTemplateManager_ESTest extends InternalTemplateManager_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
d2d55b42c63c7d38d429d9d0ccb1ed68a3af8683 | 19a8a3b96688305bf493cf0eb99686a52b4e2515 | /src/main/java/com/yash/hrms/security/SecurityUtils.java | deec389e164a9b0345e0ca9b3f2dd84ab0346c91 | [] | no_license | rahulsinghc606/Preonbaording-application | 6ce343b6c8870e862ecd5fd4c32304c5129c6c6a | fda6184ea849cef42cd43459193ed1c21d339e8e | refs/heads/master | 2021-06-09T00:53:41.957287 | 2018-11-29T05:49:11 | 2018-11-29T05:49:11 | 159,482,563 | 1 | 0 | null | 2018-11-29T05:49:12 | 2018-11-28T10:13:37 | Java | UTF-8 | Java | false | false | 2,486 | java | package com.yash.hrms.security;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.Optional;
/**
* Utility class for Spring Security.
*/
public final class SecurityUtils {
private SecurityUtils() {
}
/**
* Get the login of the current user.
*
* @return the login of the current user
*/
public static Optional<String> getCurrentUserLogin() {
SecurityContext securityContext = SecurityContextHolder.getContext();
return Optional.ofNullable(securityContext.getAuthentication())
.map(authentication -> {
if (authentication.getPrincipal() instanceof UserDetails) {
UserDetails springSecurityUser = (UserDetails) authentication.getPrincipal();
return springSecurityUser.getUsername();
} else if (authentication.getPrincipal() instanceof String) {
return (String) authentication.getPrincipal();
}
return null;
});
}
/**
* Check if a user is authenticated.
*
* @return true if the user is authenticated, false otherwise
*/
public static boolean isAuthenticated() {
SecurityContext securityContext = SecurityContextHolder.getContext();
return Optional.ofNullable(securityContext.getAuthentication())
.map(authentication -> authentication.getAuthorities().stream()
.noneMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(AuthoritiesConstants.ANONYMOUS)))
.orElse(false);
}
/**
* If the current user has a specific authority (security role).
* <p>
* The name of this method comes from the isUserInRole() method in the Servlet API
*
* @param authority the authority to check
* @return true if the current user has the authority, false otherwise
*/
public static boolean isCurrentUserInRole(String authority) {
SecurityContext securityContext = SecurityContextHolder.getContext();
return Optional.ofNullable(securityContext.getAuthentication())
.map(authentication -> authentication.getAuthorities().stream()
.anyMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(authority)))
.orElse(false);
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
019ab7078612f5ea5776cb2d05aa8b56a0a9655f | f3396f0967c5bdd64d2336dd2ccab0fc916421e7 | /unfinished mostly/Errors.java | c823d1a6fecf24eaed49398a5fbff86c9bc35ceb | [] | no_license | TimothyFHinds/javaprojects | b8df27aee4ba307c93ea2eb56e8fbd93cc0f0ab5 | ab70592dd3d8544f0fa16cb956688d227cb67e0c | refs/heads/master | 2021-06-22T08:42:57.534535 | 2017-08-26T18:00:54 | 2017-08-26T18:00:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 436 | java | //Timothy Hinds
public class Errors //Errors was not capitalized in the code given
{
public static void main(String[] args) //static was missing, and main was capitalized
{
System.out.println("Welcome to Java!"); //Welcome to Java didn't have the proper quotations ""
//System was not capitalized
} //The braces were not alligned
}
| [
"butterstim@yahoo.com"
] | butterstim@yahoo.com |
d46b0b06d91adc4a84c511ea45ee26bb1d60b510 | 446d853ba81b700e5cb4a61de59adccf02ac5975 | /app/src/main/java/com/example/shap/bean/ShoppingCart.java | c9462203abb79ff44cbb53de21c9816f464a6dee | [] | no_license | fenshuizuship/FengShiZu | 9fee7bb6343f2769750ea0a4413c797d2063a6af | a361a291c804d2d092e6114a0aee7885e46cea3a | refs/heads/master | 2020-06-09T18:01:09.930051 | 2019-06-30T06:22:51 | 2019-06-30T06:22:51 | 193,481,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 605 | java | package com.example.shap.bean;
import java.io.Serializable;
/**
* Created by <a href="http://www.cniao5.com">菜鸟窝</a>
* 一个专业的Android开发在线教育平台
*/
public class ShoppingCart extends Wares implements Serializable {
private int count;
private boolean isChecked=true;
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public boolean isChecked() {
return isChecked;
}
public void setIsChecked(boolean isChecked) {
this.isChecked = isChecked;
}
}
| [
"gyf@163.com"
] | gyf@163.com |
9b99630307f69b24cf9d0d0543f329f5529f2871 | 1bee028d03c458783cb9feb1b59489b5cbb5cf96 | /lab1/src/com/github/vitaliyp/trolab/lab1/director/DirectorWorker.java | 3c8956dabb5dda413f6d36f1bf4e9720b1b45586 | [
"Unlicense"
] | permissive | vitaliyp/tro-lab | 5c75a318f9e7c86e2c2422244d3d5463bbe21595 | 556c6e7faaea0f7958fed0d3d88ef24b3c54b540 | refs/heads/master | 2020-12-30T14:56:12.640608 | 2013-09-19T20:41:15 | 2013-09-19T20:41:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,709 | java | package com.github.vitaliyp.trolab.lab1.director;
import com.github.vitaliyp.tro.lab1.ComputerCommand;
import com.github.vitaliyp.trolab.lab1.commons.WorkerDataContainer;
import java.io.*;
import java.net.Socket;
import java.util.ArrayList;
import java.util.concurrent.Semaphore;
public class DirectorWorker implements Runnable {
private Semaphore semaphore;
private final Task task;
private ComputingNode node;
public DirectorWorker(Task task, ComputingNode node, Semaphore semaphore) {
this.semaphore = semaphore;
this.task = task;
this.node = node;
}
@Override
public void run() {
//Open connection
Socket socket = null;
try {
socket = new Socket(node.getAdress(), node.getPort());
ObjectInputStream objectInputStream =
new ObjectInputStream(socket.getInputStream());
ObjectOutputStream objectOutputStream =
new ObjectOutputStream(socket.getOutputStream());
//Send compute command
objectOutputStream.writeObject(ComputerCommand.COMPUTE);
objectOutputStream.flush();
//Get numbers of processors on node
int nProc = objectInputStream.readInt();
node.setProcessors(nProc);
semaphore.release();
try {
synchronized (task){
task.wait();
}
} catch (InterruptedException e) {
e.printStackTrace();
}
//Send a worker class
//Send name of class and number of bytes over a network
objectOutputStream.writeUTF(task.getWorkerClassName());
objectOutputStream.flush();
File f = new File(task.getWorkerClassFileName());
int n = (int)f.length();
objectOutputStream.writeInt(n);
objectOutputStream.flush();
//Send class bytecode across the network
BufferedInputStream bufferedFileInputStream =
new BufferedInputStream(new FileInputStream(f));
int b;
while((b=bufferedFileInputStream.read())!=-1){
objectOutputStream.writeByte(b);
}
objectOutputStream.flush();
//Get data from task
ArrayList<WorkerDataContainer> dataContainers =
task.giveData(nProc);
//Send number of data containers
objectOutputStream.writeInt(dataContainers.size());
objectOutputStream.flush();
//Send data containers one by one
for(WorkerDataContainer container: dataContainers){
objectOutputStream.writeObject(container);
objectOutputStream.flush();
}
//Retrieve results
for (int i = 0; i<nProc; i++){
try {
task.takeResult((WorkerDataContainer)objectInputStream.readObject());
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
} catch (IOException e) {
throw new RuntimeException("Cant connect to host", e);
} finally {
try {
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
| [
"vitaliypopadiuk@gmail.com"
] | vitaliypopadiuk@gmail.com |
b2aaa50325c5d30216779715d9636e7a18a6dd19 | b38d0c7145ffd58a7aec45561948c40470f81f15 | /Mediacombustivel.java | 6b097379d3da707f0ca9b26372e857cec2f67cea | [] | no_license | zaqueu1976/java_URI | 3cd50941ffade527ac7acc34696168b7ae97b2b9 | 6ae8471126a55124a40d1d0d6cc9674536d4e98b | refs/heads/master | 2022-12-03T09:14:38.912834 | 2020-08-24T13:29:25 | 2020-08-24T13:29:25 | 289,929,660 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 493 | java | import java.util.Scanner;
public class Mediacombustivel{
public static void main( String args[]){
int a,b,c;
float d;
//KM = a
a = 120;
// Litros = b
b = 10;
//C = Consumo
c = a / b;
// tempo percorrido
d = 10;
d = a / c;
System.out.println("Valor de consumo =" + c);
System.out.println("Valor percorrido em horas =" + d);
}
} | [
"zaqueujr@gmail.com"
] | zaqueujr@gmail.com |
0221a2fec4b409eacc23ffdf7c5a19e2dcf0fb84 | baaa141b8992c847bf68b2335b465aa3e8949334 | /app/src/test/java/com/example/dialog_filatov_d/ExampleUnitTest.java | 4c335bed674140e506dc447f43a05fc50152ebe3 | [] | no_license | FilatovDm/Dialog_Filatov_D | c8acaf51381912a581fe88705a7eec546943d33f | 516e50a7be7ba990d0d9501067cc12e673d52319 | refs/heads/master | 2023-01-13T05:01:27.972733 | 2020-11-12T19:45:27 | 2020-11-12T19:45:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package com.example.dialog_filatov_d;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"filatov-d@mail.ru"
] | filatov-d@mail.ru |
80760fa58392daf557a4aa26b33ea5701b48fba8 | 80dba67901ec79d3c52f68e318a3afc2a7623e52 | /assignment7/Assignment.java | e2c0949f087f8ba0c8fcac21be9087f60f0d6b2d | [] | no_license | mrlonelyjtr/Algorithms-Specialization | 1d386c73e8142498cc985fa7e5806b46363c6a20 | 41d03ce6dc33a0eec2720e7a967a0b73c6d80aac | refs/heads/master | 2021-01-20T08:07:52.165651 | 2017-06-20T17:26:31 | 2017-06-20T17:26:31 | 90,104,252 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,217 | java | import java.io.*;
import java.util.*;
public class Main {
private static MaxPQ<Integer> low = new MaxPQ<>();
private static MinPQ<Integer> high = new MinPQ<>();
public static void main(String[] args) {
String path = "Median.txt";
try {
BufferedReader reader = new BufferedReader(new FileReader(path));
String str = "";
int sum = 0;
while ((str = reader.readLine()) != null) {
Scanner sc = new Scanner(str);
int median = calMedian(sc.nextInt());
sum = (sum + median) % 10000;
}
// Answer: 1213
System.out.println(sum);
}
catch (Exception e){
e.printStackTrace();
}
}
private static int calMedian(int k){
if (!high.isEmpty() && k > high.min())
high.insert(k);
else
low.insert(k);
if (low.size() > high.size() + 1)
high.insert(low.delMax());
else if (high.size() > low.size() + 1)
low.insert(high.delMin());
if (high.size() > low.size())
return high.min();
else
return low.max();
}
}
| [
"296793179@qq.com"
] | 296793179@qq.com |
27ddcb430354c7b2867a8074a632354c86ef98a4 | e949311aee594d4b2c01a3682f7f28831402070f | /src/com/neotech/review06/Forest.java | 5baf53f1863b61a81ff593f1fea381f4c28443f3 | [] | no_license | humairay/JavaReview | ab0f6c7b10f3d712a57541a178c037f8d67ca239 | 5c29d3179435aaf9021e83020e22f0be2af493ab | refs/heads/master | 2023-07-08T22:18:34.423904 | 2021-08-13T22:02:41 | 2021-08-13T22:02:41 | 395,808,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package com.neotech.review06;
public class Forest {
public static void main(String[] args) {
Wolf w = new Wolf("Wolfy", 4);
w.sleep();
w.displayInfo();
System.out.println("----------------");
Fox f = new Fox("Foxy", 4, "Orange");
f.sleep();
f.displayInfo();
System.out.println("----------------");
Bear b = new Bear("Teddy", 2);
b.sleep();
b.displayInfo();
b.roar();
}
}
| [
"humairay714@gmail.com"
] | humairay714@gmail.com |
242994720f856b0ddb4526aa8e7b600281df8de1 | 6a082eaf9873858ceefbfa9118cc4914be57d4b9 | /threebody-parent/.svn/pristine/24/242994720f856b0ddb4526aa8e7b600281df8de1.svn-base | 5c268dc1871345042222421e34606b0e8340cfeb | [
"Apache-2.0"
] | permissive | idongshuai/threebody-mall | 371f6f38f40106a5744d964acdf16499911a7c89 | a6eb2e16011018024a03d259847dc9fb08d679ab | refs/heads/master | 2022-12-23T21:08:29.494577 | 2021-09-18T10:21:08 | 2021-09-18T10:21:08 | 143,390,028 | 1 | 0 | Apache-2.0 | 2022-12-16T07:11:34 | 2018-08-03T06:55:53 | JavaScript | UTF-8 | Java | false | false | 4,762 | package net.dongshuai.pojo;
import java.io.Serializable;
import java.util.Date;
public class TbUser implements Serializable {
private Long id;
private String username;
private String password;
private String phone;
private String email;
private Date created;
private Date updated;
private String sourceType;
private String nickName;
private String name;
private String status;
private String headPic;
private String qq;
private Long accountBalance;
private String isMobileCheck;
private String isEmailCheck;
private String sex;
private Integer userLevel;
private Integer points;
private Integer experienceValue;
private Date birthday;
private Date lastLoginTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
public String getSourceType() {
return sourceType;
}
public void setSourceType(String sourceType) {
this.sourceType = sourceType == null ? null : sourceType.trim();
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName == null ? null : nickName.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public String getHeadPic() {
return headPic;
}
public void setHeadPic(String headPic) {
this.headPic = headPic == null ? null : headPic.trim();
}
public String getQq() {
return qq;
}
public void setQq(String qq) {
this.qq = qq == null ? null : qq.trim();
}
public Long getAccountBalance() {
return accountBalance;
}
public void setAccountBalance(Long accountBalance) {
this.accountBalance = accountBalance;
}
public String getIsMobileCheck() {
return isMobileCheck;
}
public void setIsMobileCheck(String isMobileCheck) {
this.isMobileCheck = isMobileCheck == null ? null : isMobileCheck.trim();
}
public String getIsEmailCheck() {
return isEmailCheck;
}
public void setIsEmailCheck(String isEmailCheck) {
this.isEmailCheck = isEmailCheck == null ? null : isEmailCheck.trim();
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex == null ? null : sex.trim();
}
public Integer getUserLevel() {
return userLevel;
}
public void setUserLevel(Integer userLevel) {
this.userLevel = userLevel;
}
public Integer getPoints() {
return points;
}
public void setPoints(Integer points) {
this.points = points;
}
public Integer getExperienceValue() {
return experienceValue;
}
public void setExperienceValue(Integer experienceValue) {
this.experienceValue = experienceValue;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public Date getLastLoginTime() {
return lastLoginTime;
}
public void setLastLoginTime(Date lastLoginTime) {
this.lastLoginTime = lastLoginTime;
}
} | [
"dongshuai@dongshuai.net"
] | dongshuai@dongshuai.net | |
8ef346adb3bbeb9c8424b5854a26b3410cda6f13 | 6088a8606ada4be5d5216ae4143380f34c647253 | /projects/batfish/src/main/java/org/batfish/representation/cisco/RipProcess.java | 1d9e0735e310e74d03c426e010b15b5de43c808b | [
"Apache-2.0"
] | permissive | adrianliaw/batfish | 6898fd9f42ad5b68f3890aea1c0dcd590423f29f | 45d1e092b889d7606cb5ae4ff0eecbe894485b54 | refs/heads/master | 2021-07-02T21:13:17.847636 | 2019-12-11T22:41:46 | 2019-12-11T22:41:46 | 227,485,749 | 1 | 0 | Apache-2.0 | 2019-12-12T00:21:05 | 2019-12-12T00:21:04 | null | UTF-8 | Java | false | false | 4,047 | java | package org.batfish.representation.cisco;
import java.io.Serializable;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import org.batfish.datamodel.Prefix;
import org.batfish.datamodel.RoutingProtocol;
public class RipProcess implements Serializable {
private static final int DEFAULT_DEFAULT_INFORMATION_METRIC = 1;
private final SortedSet<String> _activeInterfaceList;
private long _defaultInformationMetric;
private boolean _defaultInformationOriginate;
private String _defaultInformationOriginateMap;
private Integer _defaultInformationOriginateMapLine;
private String _distributeListIn;
private boolean _distributeListInAcl;
private int _distributeListInLine;
private String _distributeListOut;
private boolean _distributeListOutAcl;
private int _distributeListOutLine;
private final SortedSet<Prefix> _networks;
private boolean _passiveInterfaceDefault;
private final SortedSet<String> _passiveInterfaceList;
private final SortedMap<RoutingProtocol, RipRedistributionPolicy> _redistributionPolicies;
public RipProcess() {
_activeInterfaceList = new TreeSet<>();
_defaultInformationMetric = DEFAULT_DEFAULT_INFORMATION_METRIC;
_networks = new TreeSet<>();
_passiveInterfaceList = new TreeSet<>();
_redistributionPolicies = new TreeMap<>();
}
public SortedSet<String> getActiveInterfaceList() {
return _activeInterfaceList;
}
public long getDefaultInformationMetric() {
return _defaultInformationMetric;
}
public boolean getDefaultInformationOriginate() {
return _defaultInformationOriginate;
}
public String getDefaultInformationOriginateMap() {
return _defaultInformationOriginateMap;
}
public Integer getDefaultInformationOriginateMapLine() {
return _defaultInformationOriginateMapLine;
}
public String getDistributeListIn() {
return _distributeListIn;
}
public boolean getDistributeListInAcl() {
return _distributeListInAcl;
}
public int getDistributeListInLine() {
return _distributeListInLine;
}
public String getDistributeListOut() {
return _distributeListOut;
}
public boolean getDistributeListOutAcl() {
return _distributeListOutAcl;
}
public int getDistributeListOutLine() {
return _distributeListOutLine;
}
public SortedSet<Prefix> getNetworks() {
return _networks;
}
public boolean getPassiveInterfaceDefault() {
return _passiveInterfaceDefault;
}
public SortedSet<String> getPassiveInterfaceList() {
return _passiveInterfaceList;
}
public SortedMap<RoutingProtocol, RipRedistributionPolicy> getRedistributionPolicies() {
return _redistributionPolicies;
}
public void setDefaultInformationMetric(int defaultInformationMetric) {
_defaultInformationMetric = defaultInformationMetric;
}
public void setDefaultInformationOriginate(boolean defaultInformationOriginate) {
_defaultInformationOriginate = defaultInformationOriginate;
}
public void setDefaultInformationOriginateMap(String defaultInformationOriginateMap) {
_defaultInformationOriginateMap = defaultInformationOriginateMap;
}
public void setDistributeListIn(String distributeListIn) {
_distributeListIn = distributeListIn;
}
public void setDistributeListInAcl(boolean distributeListInAcl) {
_distributeListInAcl = distributeListInAcl;
}
public void setDistributeListInLine(int distributeListInLine) {
_distributeListInLine = distributeListInLine;
}
public void setDistributeListOut(String distributeListOut) {
_distributeListOut = distributeListOut;
}
public void setDistributeListOutAcl(boolean distributeListOutAcl) {
_distributeListOutAcl = distributeListOutAcl;
}
public void setDistributeListOutLine(int distributeListOutLine) {
_distributeListOutLine = distributeListOutLine;
}
public void setPassiveInterfaceDefault(boolean passiveInterfaceDefault) {
_passiveInterfaceDefault = passiveInterfaceDefault;
}
}
| [
"ratul@ratul.org"
] | ratul@ratul.org |
b1eccb21c8b5cb2688143b0edc4eb3fed8ed9a08 | 0a9c8d0adbb8048433da7670ea83b51fcaceba31 | /app/src/main/java/com/idx/launcher/video/data/VideoContentAdapter.java | e5eb6edacad6042f77bf571ddf265397894a52bc | [] | no_license | sqHayden/Launcher | 9d89bfe9fd7dfd1a3713b5beb4c0fbf82fcafb4a | 11f9bb5e79525de6f58f4b2849a50ac346c9aa45 | refs/heads/master | 2020-03-21T14:47:48.944823 | 2018-06-25T02:09:22 | 2018-06-25T02:09:22 | 138,676,131 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,332 | java | package com.idx.launcher.video.data;
import android.content.Context;
import android.graphics.Typeface;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.idx.launcher.R;
import com.idx.launcher.video.VideoContentInterface;
import java.util.ArrayList;
import java.util.List;
/**
* Created by sunny on 18-4-16.
*/
public class VideoContentAdapter extends RecyclerView.Adapter<VideoContentAdapter.VideoViewHolder> {
private static final String TAG=VideoContentAdapter.class.getSimpleName();
private List<Movie> movies=new ArrayList<>();
private VideoContentInterface videoContentInterface;
private Context mContext;
public VideoContentAdapter(Context context,List<Movie> movies ){
this.mContext=context;
this.movies=movies;
}
@Override
public VideoViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.video_content,null);
VideoViewHolder videoViewHolder=new VideoViewHolder(view,videoContentInterface);
videoViewHolder.movie_id=view.findViewById(R.id.movie_index);
videoViewHolder.movie_image=view.findViewById(R.id.movie_image);
videoViewHolder.movie_name=view.findViewById(R.id.movie_name);
videoViewHolder.movie_grade=view.findViewById(R.id.movie_grade);
return videoViewHolder;
}
@Override
public void onBindViewHolder(VideoViewHolder holder, int position) {
holder.movie_id.setText(Integer.toString(position+1));
// holder.movie_image.setImageUrl(movies.get(position).getIconaddress());
Glide.with(mContext).load(movies.get(position).getIconaddress()).into(holder.movie_image);
holder.movie_name.setText(movies.get(position).getTitle());
holder.movie_name.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
holder.movie_grade.setText(movies.get(position).getGrade()+"分");
}
@Override
public int getItemCount() {
return movies.size();
}
public class VideoViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
//电影海报
private ImageView movie_image;
//电影名称
private TextView movie_name;
//电影评分
private TextView movie_grade;
//电影列表位置
private TextView movie_id;
//电影集数
private TextView movie_update;
public VideoViewHolder(View view,VideoContentInterface contentInterface){
super(view);
videoContentInterface=contentInterface;
view.setOnClickListener(this);
}
@Override
public void onClick(View view) {
if (videoContentInterface!=null) {
videoContentInterface.onVideoItem(view, getPosition());
}else {
Log.i(TAG, "onClick: videoContentInterface为空");
}
}
}
public void setVideoContentInterface(VideoContentInterface contentInterface){
this.videoContentInterface=contentInterface;
}
}
| [
"ryan.fp.chan@mail.foxconn.com"
] | ryan.fp.chan@mail.foxconn.com |
800db7e83297e38eb34813f2190890db8396e5be | 62b7db2fdcc76c5c22586d261a534fd87547d54e | /src/main/java/com/gafahtec/exceaune/exception/ExceptionResponse.java | 2f0d1abfe0a12665e332bb6b6eefc7700393dbe9 | [] | no_license | gascarzah/exceaune-backend | 178dd32ba866ac0edc38c9aec1eb66b3e73ae03c | 857be40b07bbbc1bcda1403db961dfbe381ddcfc | refs/heads/main | 2023-07-30T12:30:26.362889 | 2021-09-10T00:15:13 | 2021-09-10T00:15:13 | 404,905,830 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 325 | java | package com.gafahtec.exceaune.exception;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ExceptionResponse {
private LocalDateTime fecha;
private String mensaje;
private String detalles;
}
| [
"gascarzah@gmail.com"
] | gascarzah@gmail.com |
661066e662ec6420c28999dc209150dace22cdf8 | 0bd64984f8237e62c3b1b15c0496cb6dc5b0911f | /src/main/java/com/sjtu/onlinelibrary/EntityChangeListener.java | 0a922f740c350f9802aa3ea37ff8234a65ea48fb | [] | no_license | echalkpad/Online-Digital-Library | 11b27f7aaa3ae616343fce008c62b207c54b88a3 | 1566a95b8ce6cf62a8216bcda19340647ab9e32d | refs/heads/master | 2021-05-01T21:40:08.139159 | 2013-09-05T02:32:45 | 2013-09-05T02:32:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 247 | java | package com.sjtu.onlinelibrary;
/**
* Listens for registry based events.
*
*/
public interface EntityChangeListener {
void itemSaved(final Persistable item, boolean created);
void itemDeleted(final Persistable item);
}
| [
"chenmj4444@163.com"
] | chenmj4444@163.com |
ea6ab9dfcb7ceaade73df9734b796584c30451bd | 4b0bf4787e89bcae7e4759bde6d7f3ab2c81f849 | /aliyun-java-sdk-aiccs/src/main/java/com/aliyuncs/aiccs/transform/v20191015/ListHotlineRecordDetailResponseUnmarshaller.java | 61134f73da893306e2b00f9ea21e7e671ba2c9a1 | [
"Apache-2.0"
] | permissive | aliyun/aliyun-openapi-java-sdk | a263fa08e261f12d45586d1b3ad8a6609bba0e91 | e19239808ad2298d32dda77db29a6d809e4f7add | refs/heads/master | 2023-09-03T12:28:09.765286 | 2023-09-01T09:03:00 | 2023-09-01T09:03:00 | 39,555,898 | 1,542 | 1,317 | NOASSERTION | 2023-09-14T07:27:05 | 2015-07-23T08:41:13 | Java | UTF-8 | Java | false | false | 3,028 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.aiccs.transform.v20191015;
import java.util.ArrayList;
import java.util.List;
import com.aliyuncs.aiccs.model.v20191015.ListHotlineRecordDetailResponse;
import com.aliyuncs.aiccs.model.v20191015.ListHotlineRecordDetailResponse.ResultData;
import com.aliyuncs.aiccs.model.v20191015.ListHotlineRecordDetailResponse.ResultData.DataItem;
import com.aliyuncs.transform.UnmarshallerContext;
public class ListHotlineRecordDetailResponseUnmarshaller {
public static ListHotlineRecordDetailResponse unmarshall(ListHotlineRecordDetailResponse listHotlineRecordDetailResponse, UnmarshallerContext _ctx) {
listHotlineRecordDetailResponse.setRequestId(_ctx.stringValue("ListHotlineRecordDetailResponse.RequestId"));
listHotlineRecordDetailResponse.setMessage(_ctx.stringValue("ListHotlineRecordDetailResponse.Message"));
listHotlineRecordDetailResponse.setHttpStatusCode(_ctx.integerValue("ListHotlineRecordDetailResponse.HttpStatusCode"));
listHotlineRecordDetailResponse.setCode(_ctx.stringValue("ListHotlineRecordDetailResponse.Code"));
listHotlineRecordDetailResponse.setSuccess(_ctx.booleanValue("ListHotlineRecordDetailResponse.Success"));
ResultData resultData = new ResultData();
resultData.setCurrentPage(_ctx.longValue("ListHotlineRecordDetailResponse.ResultData.CurrentPage"));
resultData.setTotalResults(_ctx.longValue("ListHotlineRecordDetailResponse.ResultData.TotalResults"));
resultData.setTotalPage(_ctx.longValue("ListHotlineRecordDetailResponse.ResultData.TotalPage"));
resultData.setOnePageSize(_ctx.longValue("ListHotlineRecordDetailResponse.ResultData.OnePageSize"));
List<DataItem> data = new ArrayList<DataItem>();
for (int i = 0; i < _ctx.lengthValue("ListHotlineRecordDetailResponse.ResultData.Data.Length"); i++) {
DataItem dataItem = new DataItem();
dataItem.setServicerName(_ctx.stringValue("ListHotlineRecordDetailResponse.ResultData.Data["+ i +"].ServicerName"));
dataItem.setStartTime(_ctx.longValue("ListHotlineRecordDetailResponse.ResultData.Data["+ i +"].StartTime"));
dataItem.setEndTime(_ctx.longValue("ListHotlineRecordDetailResponse.ResultData.Data["+ i +"].EndTime"));
dataItem.setOssUrl(_ctx.stringValue("ListHotlineRecordDetailResponse.ResultData.Data["+ i +"].OssUrl"));
data.add(dataItem);
}
resultData.setData(data);
listHotlineRecordDetailResponse.setResultData(resultData);
return listHotlineRecordDetailResponse;
}
} | [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
3487c5a144df511d2794755d76b9e21355bbf8be | 58ef3df402b828fd3d17f8042c8962006ace7f24 | /src/chess/model/pieces/Queen.java | 4e36a834acbafa037cff43432e99900cf15da4b5 | [] | no_license | michailgames/chess | e73a6ade56e576935b4ea54216940f2d223e4e52 | 729bbfc036121e161ef6c26c85318ed3474e7568 | refs/heads/master | 2021-01-17T09:18:56.523493 | 2016-05-30T19:24:03 | 2016-05-30T19:24:03 | 31,729,581 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 898 | java | package chess.model.pieces;
import chess.model.board.Color;
public class Queen extends AbstractStraightMovingPiece {
private final static Queen whiteQueen = new Queen(Color.WHITE);
private final static Queen blackQueen = new Queen(Color.BLACK);
public static Queen getInstance(Color color) {
return color == Color.WHITE ? whiteQueen : blackQueen;
}
private static final Direction[] availableDirections = { new Direction(-1, -1), new Direction(-1, 0),
new Direction(-1, 1), new Direction(0, -1), new Direction(0, 1), new Direction(1, -1), new Direction(1, 0),
new Direction(1, 1) };
public Queen(Color color) {
super(color);
}
@Override
public String getUnicodeString() {
return "\u265b";
}
@Override
protected Direction[] getAvailableDirections() {
return availableDirections;
}
}
| [
"michailgames@yahoo.com"
] | michailgames@yahoo.com |
3b74c1ffc48efed5b8e9bfded91078a8c823a760 | e9e26e6433de9997c8d5b693ba950c993fb06d8f | /Project GA/assignments_allen/exams/171/midterm01_practice/code/Q6.java | c31bff65761e2f66b11ad62fe172bb44de14a467 | [] | no_license | hphuong1995/csdept | 8c9de234ef002c3a633800004583a0428df6d1f1 | a3c1a29fb7c04ce60f350014cdbea023f94d5751 | refs/heads/master | 2023-01-19T23:23:29.740379 | 2019-07-23T03:48:25 | 2019-07-23T03:48:25 | 180,229,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 781 | java | /****************
* Name: M. Allen
*
* Generate a shape in a window at random.
****************/
import java.awt.Color;
public class Q6
{
public static void main( String[] args )
{
Window win = new Window();
int winSize = 300;
win.setSize( winSize, winSize );
int val1 = (int)( Math.random() * 2 ) + 1;
int val2 = (int)( Math.random() * 2 ) + 1;
int shapeSize = 50;
int shapeLoc = ( winSize / 2 ) - ( shapeSize / 2 );
if ( val1 < val2 )
{
Oval o = new Oval( shapeLoc, shapeLoc, shapeSize, shapeSize );
win.add( o );
}
else if ( val1 > val2 )
{
Rectangle r = new Rectangle( shapeLoc, shapeLoc, shapeSize, shapeSize );
win.add( r );
}
else
win.setBackground( Color.black );
}
}
| [
"nguyen.phuo@uwlax.edu"
] | nguyen.phuo@uwlax.edu |
a9a332e743357915faf3d53edf77841369fe2e68 | 364ae53a3d58cddda15f9a9a9acfad0103eee5eb | /app/src/main/java/mypocketvakil/example/com/score/custom/CustomTextView.java | e062c8522d121951f5a2714523df4aeb6167f4f0 | [] | no_license | sanyamjain65/Score | a44710695ec17e400a899a89390c9c42cc05ac07 | e90172e7a6c1d94727f327ce3a85972d3789dbdc | refs/heads/master | 2020-12-31T06:10:04.060697 | 2017-04-06T19:53:27 | 2017-04-06T19:53:27 | 80,620,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,002 | java | package mypocketvakil.example.com.score.custom;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;
import mypocketvakil.example.com.score.R;
/**
* Created by sanyam jain on 15-09-2016.
*/
public class CustomTextView extends TextView {
public static final String ANDROID_SCHEMA = "http://schemas.android.com/apk/res/android";
public CustomTextView(Context context) {
super(context);
applyCustomFont(context, null);
}
public CustomTextView(Context context, AttributeSet attrs) {
super(context, attrs);
applyCustomFont(context, attrs);
}
public CustomTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
applyCustomFont(context, attrs);
}
private void applyCustomFont(Context context, AttributeSet attrs) {
TypedArray attributeArray = context.obtainStyledAttributes(attrs, R.styleable.CustomView);
String fontName = attributeArray.getString(R.styleable.CustomView_font);
Typeface customFont = selectTypeface(context, fontName);
setTypeface(customFont);
attributeArray.recycle();
}
private Typeface selectTypeface(Context context, String fontName) {
if (fontName.contentEquals(context.getString(R.string.OpenSans_Light))) {
return FontCache.getTypeface("OpenSans-Light.ttf", context);
} else if (fontName.contentEquals(context.getString(R.string.OpenSans_Reguler))) {
return FontCache.getTypeface("OpenSans-Regular.ttf", context);
} else if (fontName.contentEquals(context.getString(R.string.OpenSans_Semibold))) {
return FontCache.getTypeface("OpenSans-Semibold.ttf", context);
} else {
// no matching font found
return FontCache.getTypeface("OpenSans-Regular.ttf", context);
}
}
}
| [
"sanyam.j65@gmail.com"
] | sanyam.j65@gmail.com |
536b2bb8deebc8381098db295558363eaf9b392c | 67be483a5304d1e841096b8e460fa9d72e3345f6 | /cart/cart-core/org/quantum/nine/cart/CartCoreApplicationTest.java | bcb5bf83909110aad2b173054fd60448e43f317c | [] | no_license | funXMutulay/corniche | 9ac48d556662d2c81e8765f78beda2cdca34442f | e415103dacb7598b6caa2f42f9bdb9ab2e8625ae | refs/heads/master | 2021-05-17T23:10:19.443414 | 2020-03-29T07:13:07 | 2020-03-29T07:13:07 | 250,993,034 | 0 | 0 | null | 2020-03-31T11:50:36 | 2020-03-29T09:12:01 | JavaScript | UTF-8 | Java | false | false | 589 | java | package org.quantum.nine.cart;
import org.junit.Test;
import org.quantum.nine.cart.common.services.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = JCartCoreApplication.class)
public class JCartCoreApplicationTest {
@Autowired EmailService emailService;
@Test
public void testSendEmail()
{
emailService.sendEmail("admin@gmail.com", "JCart - Test Mail", "This is a test email from JCart");
}
}
| [
"mkebe1@yahoo.fr"
] | mkebe1@yahoo.fr |
747829200c1e2a7ef934bb555244f92ca316d3fa | 59cacfc0e7352888d82b5c8e5edad9239b285bf0 | /app/src/main/java/com/example/stockassistant/StockAdapter.java | 68409c911af9a3cb02d5d300c0565b6395a8dbf9 | [] | no_license | womfeld/StockAssistant | 0fcf144fd7d9d28ab0596d3ae86318c7befe3f15 | bcd4975dfba0a05662f1ee0f517f57aee1e1d480 | refs/heads/master | 2023-03-29T20:08:39.159999 | 2021-04-05T21:18:35 | 2021-04-05T21:18:35 | 354,973,246 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,861 | java | package com.example.stockassistant;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Locale;
public class StockAdapter extends RecyclerView.Adapter<StockViewHolder> {
private ArrayList<Stock> stocklist;
private MainActivity mainActivity;
public StockAdapter(MainActivity mainActivity, ArrayList<Stock> stockArrayList){
this.mainActivity = mainActivity;
this.stocklist = stockArrayList;
}
public StockViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.stock_entry, parent, false);
itemView.setOnClickListener((View.OnClickListener) mainActivity);
itemView.setOnLongClickListener((View.OnLongClickListener) mainActivity);
return new StockViewHolder(itemView);
}
@Override
public void onBindViewHolder(@NonNull StockViewHolder holder, int position) {
Stock s = stocklist.get(position);
if(s.getPriceChange() < 0){
//Set all label colors to red if the net price change was greater than zero
holder.stockName.setTextColor(Color.parseColor("red"));
holder.ticker.setTextColor(Color.parseColor("red"));
holder.price.setTextColor(Color.parseColor("red"));
holder.priceChange.setTextColor(Color.parseColor("red"));
holder.percentage.setTextColor(Color.parseColor("red"));
holder.direction.setText("▼");
holder.direction.setTextColor(Color.parseColor("red"));
}
else {
//Set all label colors to green if the net price change was greater than zero
holder.stockName.setTextColor(Color.parseColor("green"));
holder.ticker.setTextColor(Color.parseColor("green"));
holder.price.setTextColor(Color.parseColor("green"));
holder.priceChange.setTextColor(Color.parseColor("green"));
holder.percentage.setTextColor(Color.parseColor("green"));
holder.direction.setText("▲");
holder.direction.setTextColor(Color.parseColor("green"));
}
holder.ticker.setText(s.getTicker());
holder.stockName.setText(s.getStockName());
//Maybe change this later
holder.percentage.setText("("+String.format(Locale.US, "%.2f",s.getPercentage())+"%)");
holder.priceChange.setText(String.format(Locale.US,"%.2f",s.getPriceChange()));
holder.price.setText(" $"+String.format(Locale.US,"%.2f",s.getPrice()));
}
@Override
public int getItemCount() {
return stocklist.size();
}
}
| [
"womfeld@hawk.iit.edu"
] | womfeld@hawk.iit.edu |
27933ab561900a2fa46dddb42e69cad8502fbaf9 | b4d21b75a3db507e2df3897feb759382c0d55bb5 | /String/anagram.java | 2359e5d304e004229e6e7386d00bc1b00299b830 | [] | no_license | KDSbami/ADI-2019 | 8e02443667a4ca6d66ec401a2ff56169b652d431 | c064801408047eac562dca6fccb661cda72cd0d5 | refs/heads/master | 2020-06-21T02:41:21.340489 | 2019-10-02T06:35:07 | 2019-10-02T06:35:07 | 197,324,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 893 | java | import java.util.*;
public class anagram{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
String data = new String();
String data2 = new String();
data = sc.next();
data2 = sc.next();
int arr[] = new int[26];
int arr2[] = new int[26];
int a =0;
if(data.length()!=data2.length())
{
System.out.print("NOT AN ANAGRAM");
return;
}
for(int i=0;i<data.length();i++)
{
a = data.charAt(i);
arr[a-97]++;
a = data2.charAt(i);
arr2[a-97]++;
}
for(int i=0;i<26;i++)
{
if(arr[i]!=arr[i])
{
System.out.print("not an anagram");
return;
}
}
System.out.print("anagram");
}
}
| [
"karamdeep.singh11@gmail.com"
] | karamdeep.singh11@gmail.com |
0168732be5c32b7c152245c228d9cf14f5d9b0d2 | 88c1f6fb81f33314f046270485fcb3c9774049ef | /Android_SDK/RobotPenDemo/app/src/main/java/cn/robotpen/demo/multiple/ChangeTypeActivity.java | 842813f1e48447e8a6ef2a3ff854eea57cdf67ee | [] | no_license | zhaocheng19940105/SDK | 81528cae61495a3c1b7182cbeb5bad042d0aa370 | 279bfbbaafc1681314b8f00ae4e66b24b298b28b | refs/heads/master | 2021-05-03T20:57:58.723278 | 2016-10-16T08:31:53 | 2016-10-16T08:31:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,452 | java | package cn.robotpen.demo.multiple;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import cn.robotpen.core.services.PenService;
import cn.robotpen.core.views.MultipleCanvasView;
import cn.robotpen.demo.R;
import cn.robotpen.demo.RobotPenApplication;
import cn.robotpen.demo.bluetooth.BleListActivity;
import cn.robotpen.demo.utils.ResUtils;
import cn.robotpen.file.services.FileManageService;
import cn.robotpen.model.interfaces.Listeners;
import cn.robotpen.model.symbol.ConnectState;
import cn.robotpen.model.symbol.Keys;
import cn.robotpen.model.symbol.SceneType;
public class ChangeTypeActivity extends Activity implements Switch.OnCheckedChangeListener,View.OnClickListener,MultipleCanvasView.CanvasManageInterface{
PageItem mPageItem;
private PenService mPenService;
private String mTag;
private boolean isPenSvrBinding;
private ProgressDialog mProgressDialog;
private Handler mHandler = new Handler();
private MultipleCanvasView mPenCanvasView;
private String mNoteKey = "0";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_change_type);
mPageItem = new PageItem();
mTag = Keys.APP_USB_SERVICE_NAME;//默认为USB连接形式
// 启动USB服务
RobotPenApplication.getInstance().bindPenService(mTag);
Intent intent = getIntent();
String tempNote = intent.getStringExtra(Keys.KEY_TARGET);
if(tempNote!=null&&!tempNote.equals("")){
mNoteKey = tempNote;
}
}
@Override
protected void onResume() {
super.onResume();
if (mPenService == null) {
mProgressDialog = ProgressDialog.show(this, "", getString(R.string.service_usb_start), true);
// 启动笔服务
initPenService();
}
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
if (mPenService != null) {
RobotPenApplication.getInstance().unBindPenService();//断开笔服务
}
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked){
mPageItem.connectDevice.setEnabled(true);
mPageItem.deviceType.setText("蓝牙");
mTag = Keys.APP_PEN_SERVICE_NAME;//切换为蓝牙
}else{
mPageItem.connectDevice.setEnabled(false);
mPageItem.deviceType.setText("USB");
mTag = Keys.APP_USB_SERVICE_NAME;//切换为蓝牙
}
changePenService(mTag);
}
@Override
public void onClick(View v) {
if(v.getId()==R.id.connectDevice){
Intent intent = new Intent(this,BleListActivity.class);
this.startActivity(intent);
}else if(v.getId()==R.id.deviceType){
Toast.makeText(ChangeTypeActivity.this,"当前设定的笔服务为:"+mTag,Toast.LENGTH_SHORT).show();
String tag = RobotPenApplication.getInstance().getConnectDeviceType();
Toast.makeText(ChangeTypeActivity.this,"当前连接的设备类型为:"+tag,Toast.LENGTH_SHORT).show();
}
}
/**
* 初始化笔服务
*/
public void initPenService() {
//如果正在执行,那么退出
if(isPenSvrBinding) return;
mPenService = RobotPenApplication.getInstance().getPenService();
if (mPenService == null)
RobotPenApplication.getInstance().bindPenService(mTag);
isPenServiceReady(mTag);
}
/**
* 判断笔服务是否已启动完毕,如果未启动则一直确认到启动为止
*/
private void isPenServiceReady(String mTag) {
isPenSvrBinding = true;
mPenService = RobotPenApplication.getInstance().getPenService();
if (mPenService != null) {
dismissProgressDialog();
isPenSvrBinding = false;
penSvrInitComplete();
String tag = RobotPenApplication.getInstance().getConnectDeviceType();
Toast.makeText(ChangeTypeActivity.this,"已成功启动笔服务"+tag,Toast.LENGTH_SHORT).show();
} else {
final String currentTag = mTag;
if(mTag.equals(Keys.APP_USB_SERVICE_NAME)){
showProgressDialog("正在加载USB服务……", true);
}else {
showProgressDialog("正在加载蓝牙服务……", true);
}
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
isPenServiceReady(currentTag);
}
}, 500);
}
}
/**
* 切换为指定的笔服务
*/
private void changePenService(String tag) {
if (!mPenService.getSvrTag().equals(tag)) {
//解除绑定
RobotPenApplication.getInstance().unBindPenService();
isUnBindPenService(tag);
}
}
/**
* 判断服务是否已解绑完成,解绑完成后根据tag绑定新的服务
*/
private void isUnBindPenService(final String bindTag){
if(mPenService == null || !mPenService.getIsBind()){
RobotPenApplication.getInstance().setConnectDeviceType(bindTag);
initPenService();
}else{
if(mTag.equals(Keys.APP_USB_SERVICE_NAME)){
showProgressDialog("正在绑定USB服务……", true);
}else {
showProgressDialog("正在绑定蓝牙服务……", true);
}
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
isUnBindPenService(bindTag);
}
}, 500);
}
}
/**
* 笔服务成功后,操作……此处可以自定义
*/
private void penSvrInitComplete(){
if (mTag.equals(Keys.APP_USB_SERVICE_NAME)){
mPenService.setSceneType(SceneType.INCH_101);// 设置场景值,用于坐标转化
mPenService.setIsPressure(true);//允许获取压感值
mPenService.setOnConnectStateListener(onConnectStateListener);// 如果要弹出确认则必须设置连接监听
}else if(mTag.equals(Keys.APP_PEN_SERVICE_NAME)){
mPenService.setSceneType(SceneType.INCH_101_BLE);// 设置场景值,用于坐标转化
mPenService.setIsPressure(true);//允许获取压感值
}
if(mPenCanvasView==null){
mPenCanvasView = new MultipleCanvasView(ChangeTypeActivity.this, this);//画布只能通过new的方式创建
mPenCanvasView.setDataSaveDir(ResUtils.getSavePath(ResUtils.DIR_NAME_DATA));
mPageItem.lineWindow.addView(mPenCanvasView);
mPenCanvasView.setPenIcon(R.drawable.ic_pen);
mPenCanvasView.refresh();
}else {
mPenCanvasView.refresh(); //这里一定要重新刷新一下画布
}
}
/**
* 弹出授权
*/
private Listeners.OnConnectStateListener onConnectStateListener = new Listeners.OnConnectStateListener() {
@Override
public void stateChange(String arg0, ConnectState arg1) {
// TODO Auto-generated method stub
if (arg1 == ConnectState.CONNECTED) {
dismissProgressDialog();
}
}
};
@Override
public PenService getPenService() {
return mPenService;
}
@Override
public MultipleCanvasView.PenModel getPenModel() {
return MultipleCanvasView.PenModel.WaterPen;
}
@Override
public float getPenWeight() {
return 2;
}
@Override
public int getPenColor() {
return 0xFFFFFFFF;
}
@Override
public int getBgColor() {
return 0xFF37474F;
}
@Override
public Uri getBgPhoto() {
return null;
}
@Override
public int getBgResId() {
return 0;
}
@Override
public ImageView.ScaleType getBgScaleType() {
return ImageView.ScaleType.CENTER;
}
@Override
public void onCanvasSizeChanged(int i, int i1, SceneType sceneType) {
}
@Override
public float getIsRubber() {
return 0.0f;
}
@Override
public void penRouteStatus(boolean b) {
}
@Override
public FileManageService getFileService() {
return null;
}
@Override
public long getCurrUserId() {
return 0;
}
@Override
public String getNoteKey() {
return mNoteKey;
}
class PageItem{
Switch switchButton;
Button connectDevice;
TextView deviceType;
RelativeLayout lineWindow;
public PageItem(){
switchButton = (Switch) findViewById(R.id.switch1);
switchButton.setOnCheckedChangeListener(ChangeTypeActivity.this);
connectDevice= (Button) findViewById(R.id.connectDevice);
connectDevice.setOnClickListener(ChangeTypeActivity.this);
deviceType = (TextView) findViewById(R.id.deviceType);
deviceType.setOnClickListener(ChangeTypeActivity.this);
lineWindow = (RelativeLayout) findViewById(R.id.lineWindow);
}
}
/**
*显示对话框
**/
public boolean showProgressDialog(String msg,boolean isNew) {
boolean isCreate = true;
if (isNew) {
if (mProgressDialog != null) dismissProgressDialog();
mProgressDialog = ProgressDialog.show(this, "", msg, true);
} else {
if (mProgressDialog == null) {
mProgressDialog = ProgressDialog.show(this, "", msg, true);
}else{
isCreate = false;
}
}
return isCreate;
}
/**
*关闭对话框
**/
public void dismissProgressDialog(){
if(mProgressDialog != null){
if(mProgressDialog.isShowing())
mProgressDialog.dismiss();
mProgressDialog = null;
}
}
}
| [
"linhw@ppwrite.com"
] | linhw@ppwrite.com |
4995f96ffa938579642583057344f109391f8474 | bfcd024394318f0591d039d577ad438d606247bd | /actualProject/src/logic/playerState/Result.java | 9eb77ad76e8e3605922532b9eb136c1dd86e9848 | [] | no_license | derMacon/PS2ProgrammierPraktikum | 9b256e4a953d734bb9cf9782436a5566836e11ad | 4e7e222527cc7f85c086bf265174f0190fafc97f | refs/heads/master | 2021-06-24T00:01:28.455642 | 2020-11-16T09:25:32 | 2020-11-16T09:25:32 | 147,942,937 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,469 | java | package logic.playerState;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
* Class that compares the results of all players and generates the winner.
*/
public class Result {
/**
* List of winners
*/
private List<ResultRanking> ranking;
/**
* Constructor takes an array of players participating in the game. Converts it to list
* containing the result ranking. Since it is possible to have multiple winners / it is
* possible for the players to share the same ranking a special class must be implemented
* containing both the ranking and the list of players having the same score.
* <p>
* Constructor used in the actual game.
*
* @param players players participating in the game
* @pre null != players
*/
public Result(Player[] players) {
assert null != players;
this.ranking = genResultRankingList(players);
}
/**
* Constructor used for testing
*
* @param ranking ranking of the players
* @pre null != ranking
*/
public Result(List<ResultRanking> ranking) {
assert null != ranking;
this.ranking = ranking;
}
/**
* Getter for the ranked list
*
* @return the ranked list of the game
*/
public List<ResultRanking> getRankedList() {
return this.ranking;
}
/**
* Generates a list of ResultRanking objects.
*
* @param players player array that will be sorted
* @return ordered list containing ResultRanking objects
* @pre players.length > 0;
*/
private List<ResultRanking> genResultRankingList(Player[] players) {
assert players.length > 0;
LinkedList<Player> rankedWithoutEqualTemperedPlayers = new LinkedList<>(Arrays.asList(players));
Collections.sort(rankedWithoutEqualTemperedPlayers);
return orderRanking(new LinkedList<>(), rankedWithoutEqualTemperedPlayers);
}
/**
* Converts a conventional ordered player list into a list of ResultRanking objects. Equally Ranked Players will
* be put into the same ranking index.
*
* @param output output list of ResultRanking objects
* @param players ordered list of players
* @return output list containing ranked players
* @pre null != output
* @pre null != players
*/
private LinkedList<ResultRanking> orderRanking(LinkedList<ResultRanking> output,
LinkedList<Player> players) {
assert null != output && null != players;
// exit condition -> sorted when no players are left
if (players.isEmpty()) {
return output;
}
// output is empty -> first initialize Result Ranking in List,
if (output.isEmpty()) {
ResultRanking resRank = new ResultRanking(1);
output.add(resRank);
return orderRanking(output, players);
}
// Put highest ranking player in ResultRanking
if (output.getLast().isEmpty()) {
ResultRanking resRank = output.getLast();
resRank.addPlayer(players.removeLast());
return orderRanking(output, players);
}
// last player always most valuable one, matches current ranking
if (output.getLast().matchesRank(players.getLast())) {
output.getLast().addPlayer(players.removeLast());
return orderRanking(output, players);
}
// last player doesn't match last rank in list
output.add(new ResultRanking(output.getLast().getRankingPosition() + 1));
return orderRanking(output, players);
}
@Override
public String toString() {
StringBuilder output = new StringBuilder("Ordered Ranking:\n");
Player currPlayer = null;
for (int i = 0; i < this.ranking.size(); i++) {
output.append(i + ". Spot");
for (int j = 0; j < this.ranking.get(i).getRankedPlayers().size(); j++) {
currPlayer = this.ranking.get(i).getRankedPlayers().get(j);
output.append("\t" + currPlayer.getName() + " -> Result{" + "points="
+ currPlayer.getBoardPoints() + '}' + "\n");
}
}
return output.toString();
}
/**
* Generates a treeView object (used by the gui to show result to the user)
*
* @return a treeView object (used by the gui to show result to the user)
*/
public TreeView<String> toTreeView() {
TreeItem<String> rootItem = new TreeItem<>("Ranking");
rootItem.setExpanded(true);
for (ResultRanking currRanking : this.ranking) {
rootItem.getChildren().add(currRanking.toTreeItem());
}
return new TreeView<>(rootItem);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
final Result other = (Result) obj;
int i = 0;
int thisSize = this.ranking.size();
boolean equals = thisSize == other.ranking.size();
while (equals && i < thisSize) {
equals = this.ranking.get(i).equals(other.ranking.get(i));
i++;
}
return equals;
}
}
| [
"silash169@gmail.com"
] | silash169@gmail.com |
7004933be9eba61bc8a94a9a6cd159584420d373 | 4e390e1d3ee8db4277d7e86c74e67730a3583a1b | /components/skoly_components_sources/component-1/skoly/src/main/java/sk/skoly/model/Student.java | c6a2d389563628b2324295fd9dd3cdf375c52c38 | [] | no_license | WasteService/WasteService.github.io | 6dd28b9673895dc53c00bfee751a0378d684813a | fefe1185e6c7a53806f28e759f5104904a80db01 | refs/heads/master | 2023-01-05T09:56:28.057174 | 2020-10-28T10:13:53 | 2020-10-28T10:13:53 | 307,663,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,168 | java | package sk.skoly.model;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
@Entity
public class Student extends Entita {
private String priezvisko;
private String meno;
private String titul;
private Platca platca;
private String ulica;
private String psc;
private String mesto;
private String telefon;
private String mobil;
private String fax;
private String www;
private String email;
public String getPriezvisko() {
return priezvisko;
}
public void setPriezvisko(String priezvisko) {
this.priezvisko = priezvisko;
}
public String getMeno() {
return meno;
}
public void setMeno(String meno) {
this.meno = meno;
}
public String getTitul() {
return titul;
}
public void setTitul(String titul) {
this.titul = titul;
}
@ManyToOne()
@OnDelete(action = OnDeleteAction.NO_ACTION)
@ListDisplayed
public Platca getPlatca() {
return platca;
}
public void setPlatca(Platca platca) {
this.platca = platca;
}
public String getUlica() {
return ulica;
}
public void setUlica(String ulica) {
this.ulica = ulica;
}
public String getPsc() {
return psc;
}
public void setPsc(String psc) {
this.psc = psc;
}
public String getMesto() {
return mesto;
}
public void setMesto(String mesto) {
this.mesto = mesto;
}
public String getTelefon() {
return telefon;
}
public void setTelefon(String telefon) {
this.telefon = telefon;
}
public String getMobil() {
return mobil;
}
public void setMobil(String mobil) {
this.mobil = mobil;
}
public String getFax() {
return fax;
}
public void setFax(String fax) {
this.fax = fax;
}
public String getWww() {
return www;
}
public void setWww(String www) {
this.www = www;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Transient
@ListDisplayed
public String getFormatedName() {
return String.format("%s, %s", priezvisko, meno);
}
@Override
public String toString() {
return getFormatedName();
}
}
| [
""
] | |
974cdba30a002fcf7052eaca8a074c26c9222da5 | 06779312e31accd40c87dda560cbd7a14103be2b | /mypjt01/src/mypjt01/CLasss.java | 2ea72cc675a54d0e2092f2980f0236f68c7112d5 | [] | no_license | ksjqwe456/JAVA-School | d4ef60cf795b3b662a3f87d60f1e54763a60ddd4 | 6b872e55155744f35ce2c58d5715f4e3cabfb5c8 | refs/heads/master | 2020-07-11T04:35:06.446248 | 2019-08-26T10:35:47 | 2019-08-26T10:35:47 | null | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,691 | java | package mypjt01;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class CLasss {
public static void main(String[] args) {
ConvertLenght1 cl = new ConvertLenght1();
cl.display();
}
}
class ConvertLenght1 extends JFrame implements ActionListener {
JLabel num, result;
JPanel p1, p2, p3;
JTextField tf1, tf2;
JButton btn;
ConvertLenght1() {
p1 = new JPanel(new GridLayout(1, 2));
p2 = new JPanel(new GridLayout(1, 2));
num = new JLabel("길이를 입력");
result = new JLabel("RESULT");
btn = new JButton("BUTTON");
tf1 = new JTextField();
tf2 = new JTextField();
num.setForeground(Color.white);
result.setForeground(Color.black);
p1.setBackground(Color.RED);
p2.setBackground(Color.yellow);
p1.add(num);
p1.add(tf1);
p2.add(result);
p2.add(tf2);
btn.addActionListener(this);
add(p1);
add(p2);
add(btn);
}
void display() {
setLayout(new FlowLayout());
setSize(250, 200);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("거리계산하기");
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btn) {
tf2.setText("" + Double.parseDouble(tf1.getText()) / 2.54);
}
}
} | [
"ksjqwe456@naver.com"
] | ksjqwe456@naver.com |
d9141bbbe109361c5d483b5ce426344742bae1c1 | 7060bd58c47bb36484cfaad59b50d9c0df41846d | /JavaRushTasks/1.JavaSyntax/src/com/javarush/task/pro/task17/task1702/Circle.java | 9f43907ffcb6ebeb99fc5cda56040cfa0f65a9aa | [] | no_license | KhaliullinArR/java-rush-tasks | 4e6a60282e4d218bd114d19e950f8bf2861d0182 | 7fa398e85c0f6d2843b74193396ec73ee3f69549 | refs/heads/main | 2023-04-08T09:52:02.711984 | 2021-04-20T17:41:24 | 2021-04-20T17:41:24 | 357,000,449 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 178 | java | package com.javarush.task.pro.task17.task1702;
public class Circle extends Shape {
@Override
public void printInfo() {
System.out.println("Круг");
}
}
| [
"74345012+KhaliullinArR@users.noreply.github.com"
] | 74345012+KhaliullinArR@users.noreply.github.com |
e00ed9fb5c45cc83c15fb99287654e3d0d771a5f | 8d6fcd641b719a2530b27ce186d474033624a2d6 | /src/main/java/com/kastro/lesson6/weatherdto/Temperature.java | ff41ac47f72c6157f43b693b55d535298134a7ec | [] | no_license | Nadezhda-Kastro/javaCore | 87d474e7977e56e4ed1719f86aee5d263dd89f18 | c4dd5691d226e11c44cc34dfab0615bc51957dbf | refs/heads/master | 2023-07-13T01:08:45.375545 | 2021-08-16T08:13:00 | 2021-08-16T08:13:00 | 377,791,072 | 0 | 0 | null | 2021-08-16T11:53:15 | 2021-06-17T10:26:12 | Java | UTF-8 | Java | false | false | 590 | java | package com.kastro.lesson6.weatherdto;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Temperature {
@JsonProperty("Minimum")
private TemperatureInfo minimum;
@JsonProperty("Maximum")
private TemperatureInfo maximum;
public TemperatureInfo getMinimum() {
return minimum;
}
public void setMinimum(TemperatureInfo minimum) {
this.minimum = minimum;
}
public TemperatureInfo getMaximum() {
return maximum;
}
public void setMaximum(TemperatureInfo maximum) {
this.maximum = maximum;
}
}
| [
"kroshka_kastro@mail.ru"
] | kroshka_kastro@mail.ru |
1e95317f76f23f8fde07a6b785f7680cbc9872f8 | 26b7f30c6640b8017a06786e4a2414ad8a4d71dd | /src/number_of_direct_superinterfaces/i36437.java | 9096258c75371990e4871bc4236abf30429a22a0 | [] | no_license | vincentclee/jvm-limits | b72a2f2dcc18caa458f1e77924221d585f23316b | 2fd1c26d1f7984ea8163bc103ad14b6d72282281 | refs/heads/master | 2020-05-18T11:18:41.711400 | 2014-09-14T04:25:18 | 2014-09-14T04:25:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 69 | java | package number_of_direct_superinterfaces;
public interface i36437 {} | [
"vincentlee.dolbydigital@yahoo.com"
] | vincentlee.dolbydigital@yahoo.com |
d061ab65661095cc6ad7bb79599821ab487a0258 | e0846064ec21ed48107f0ff47621cf622321a597 | /app/src/main/java/edu/zju/homework3/FragmentB.java | 7b24d4c15724d826d7053b8057585f0d85b2f706 | [] | no_license | liuqiliqi/homework3 | 18cca6f9b36562fd810941a43d4108d662eb9612 | 1358a788d5f98ea1a45e4e988dc4eb41c2319f00 | refs/heads/master | 2020-06-18T08:49:02.150175 | 2019-07-10T16:31:48 | 2019-07-10T16:31:48 | 196,223,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,298 | java | package edu.zju.homework3;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
public class FragmentB extends Fragment {
private Button bt;
private ImageView ima;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragmentb, container, false);
}
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
bt=(Button) getView().findViewById(R.id.button4);
ima =(ImageView) getView().findViewById(R.id.imageView2);
final Animation loadAnimation = AnimationUtils.loadAnimation(getActivity(),R.anim.expand);
bt.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
ima.startAnimation(loadAnimation);
}
});
}
}
| [
"46392322+liuqiliqi@users.noreply.github.com"
] | 46392322+liuqiliqi@users.noreply.github.com |
52944af2750ea808d3becfc1f61379c5ce6ba7d7 | d84fb71a651132a6afba4c5671c32d666d454148 | /src/test/java/isToeplitzMatrixTest.java | 13ce361385ef5709e4f055a35f54d9153bf3ccdc | [] | no_license | QWERTYP5391/more-practice | afd09b905f158926977af89ecf6a8dff5092a206 | 2b144ad8ab199fa75d1428e70972da184e257bde | refs/heads/master | 2021-06-28T08:08:26.996743 | 2020-08-07T14:35:15 | 2020-08-07T14:35:15 | 173,505,141 | 0 | 0 | null | 2020-10-13T12:12:06 | 2019-03-02T22:20:17 | Java | UTF-8 | Java | false | false | 445 | java | import org.junit.Test;
import static org.junit.Assert.*;
public class isToeplitzMatrixTest {
@Test
public void isToeplitzMatrix() {
int[][] matrix = {{1, 2, 3, 4}, {5, 1, 2, 3}, {9, 5, 1, 2}};
assertTrue(isToeplitzMatrix.isToeplitzMatrix(matrix));
}
@Test
public void isToeplitzMatrix2() {
int[][] matrix = {{1,2},{2,2}};
assertFalse(isToeplitzMatrix.isToeplitzMatrix(matrix));
}
} | [
"etunkara51@gmail.com"
] | etunkara51@gmail.com |
a061bd6a2984de6f02ee5d34fff665b6e98258ef | 24a2accb69be9bed4a8df65dc6be9bc5a0b5aeab | /Leetcode/src/leetcode/string/problems/ReverseWordsInStringIII.java | d952bd5cc9a06cc152dded3e10c969cd638d2eac | [] | no_license | hardikkhanna/LeetCode | 5aa76d47f1ca45890db08f64eb03853d4cbd6175 | a8da2b66ac5a924a6f453b0a58df7c89621b33b5 | refs/heads/master | 2023-05-29T20:52:28.091201 | 2021-06-17T17:35:57 | 2021-06-17T17:35:57 | 325,298,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 560 | java | /**
*
*/
package leetcode.string.problems;
/**
* @author Hardik
*
* Date : Jan 18, 2021 Time : 11:24:32 PM
*/
public class ReverseWordsInStringIII {
public static void main(String[] args) {
String str = "";
str = reverseString(str);
System.out.println(str);
}
/**
* @param str
* @return
*/
private static String reverseString(String s) {
String ans = "";
String[] arr = s.split(" ");
for (String str : arr) {
StringBuilder word = new StringBuilder(str);
ans += word.reverse() + " ";
}
return ans.trim();
}
}
| [
"khannahardik007@gmail.com"
] | khannahardik007@gmail.com |
7bda5927bf0c66d30fe835bde89eac38d88de266 | 2b554c46349d636018fa72dfe96fb99454fbc3c7 | /spring-feignclients/src/main/java/com/etoc/config/FeignClientRemote.java | 9fa7b0323309d13f50493923b19fc8590bbe791b | [] | no_license | liuxiaolonger/spring-demo | 8ac8a56014c4df6a5e077b27a0e1e5d36ba1cf0c | 434c004c4abdc6f3e3834987f8b67cd15986b197 | refs/heads/master | 2022-07-12T18:15:42.337307 | 2019-12-01T05:36:51 | 2019-12-01T05:36:51 | 178,666,430 | 0 | 0 | null | 2022-06-29T17:48:51 | 2019-03-31T09:18:01 | Java | UTF-8 | Java | false | false | 456 | java | package com.etoc.config;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@FeignClient(name = "spring-api",fallbackFactory=FeignClientFallBack.class)
public interface FeignClientRemote {
@GetMapping("/emp/{id}/")
public ResponseEntity<?> get(@PathVariable("id") Integer id);
}
| [
"896846152@qq.com"
] | 896846152@qq.com |
b49897aa77da60c5b25bd269447afd197ebc201b | bdf6256c0dfb8a31ac8fb249888b01840d945231 | /app/src/main/java/lili/tesla/lushertest/presentation/screen/table3/presenter/Table3Presenter.java | 19367406da2d1031d6100452f27db65eb8f450c4 | [] | no_license | lilitesla/LusherTest | 51081fa50f5ee59a86de1a91440c648a5cf2fb5e | 4559265960ef60bda036a1c81e9818ff768cbd13 | refs/heads/master | 2021-08-14T06:25:59.506226 | 2017-11-14T20:41:06 | 2017-11-14T20:41:06 | 109,182,488 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,321 | java | package lili.tesla.lushertest.presentation.screen.table3.presenter;
import lili.tesla.lushertest.presentation.application.App;
import lili.tesla.lushertest.presentation.screen.table3.view.Table3View;
import lili.tesla.lushertest.presentation.screen.base.BasePresenter;
/**
* Created by Лилия on 02.11.2017.
*/
public class Table3Presenter extends BasePresenter<Table3View> {
public int testNum = 0;
public int clickCount = 0;
public boolean isSecondTry = false;
public boolean isWasSecondTry = false;
public void setImagesColors(int testNum) {
mView.setImagesColors(testNum);
}
public void setImagesVisible(int testNum) { mView.setImagesVisible(testNum);}
public void onImageClick(int num) {
App.arrayTab3[testNum][num] ++;
clickCount ++;
if (clickCount < 6 ) {
mView.setImagesVisible(clickCount);
} else {
if (!isSecondTry) {
if (testNum < 4) {
startNewTest();
} else {
isSecondTry = true;
testNum = 0;
}
}
if (isSecondTry) {
while ((testNum < 5)&&(isRightTest()||isWasSecondTry)) {
isWasSecondTry = false;
testNum ++;
}
if (testNum < 5) {
testNum --;
isWasSecondTry = true;
startNewTest();
} else {
mView.showTable2Screen();
}
}
}
}
public void startNewTest() {
testNum ++;
if (clickCount == 6) {
clickCount = 0;
}
for (int i = 0; i < 4; i ++) {
App.arrayTab3[testNum][i] = 0;
}
setImagesColors(testNum);
setImagesVisible(clickCount);
}
private boolean isRightTest(){
int[] counts = new int[4];
for (int i = 0; i < 4; i ++) {
counts[i] = 0;
}
for (int i = 0; i < 4; i ++) {
counts[App.arrayTab3[testNum][i]] ++;
}
if ((counts[0] > 1)||(counts[1] > 1) ||(counts[2] > 1) ||(counts[3] > 1)) {
return false;
} else {
return true;
}
}
} | [
"liliangelok@mail.ru"
] | liliangelok@mail.ru |
a80d74b3ae1db890aa152a6647b1840f290ec75a | b05cfb16dc91d74fdb993d4add0bc086afee1cbf | /test-feature/src/main/java/org/deveasy/test/feature/steps/AwsEC2ContainerSteps.java | 922d3c5a4f39280c415c7fbf4dee88f2425e06af | [
"Apache-2.0"
] | permissive | GSSoftwareConsultancy/dev-easy-test-api | 1885a13c479863caee1ee89e2fd14733779776ff | 073b41e466d6482b10c13d711d70ab7ca9a6860c | refs/heads/master | 2021-09-17T20:18:50.591425 | 2018-05-07T10:30:06 | 2018-05-07T10:30:06 | 120,139,420 | 0 | 0 | Apache-2.0 | 2018-04-16T22:53:39 | 2018-02-03T23:36:50 | Java | UTF-8 | Java | false | false | 864 | java | /*
* Copyright 2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.deveasy.test.feature.steps;
/**
* Steps for managing the Application.
* Currently support Spring, Spring Boot and Drop Wizard Applications
* @author Joseph Aruja GS Software Consultancy Ltd
*/
public class AwsEC2ContainerSteps {
}
| [
"joseph.a.aruja@gmail.com"
] | joseph.a.aruja@gmail.com |
8ac892b7738eadfa4fc98e89ea0420a9686eeb2b | 6d14f910165dbe0148288cc452ed3cf4511f12cf | /app/src/main/java/com/poovarasan/afka/storage/SimpleStorageConfiguration.java | 1faad0827a791d462ea434016b927a74b752b039 | [] | no_license | poovarasanvasudevan/alfa | 79aa26f0ac2ba224292481e230bd158695b6f329 | f3ba2c4f48cf0d1e605cf68e6f76e93e6e2ba3b4 | refs/heads/master | 2020-12-30T14:44:34.903162 | 2017-06-09T09:13:52 | 2017-06-09T09:13:52 | 91,079,283 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,512 | java | package com.poovarasan.afka.storage;
import android.os.Build;
import android.util.Log;
import java.io.FileInputStream;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
/**
* Each of the specific storage types (like External storage tool) need its own
* configurations. This configuration class is build and used in the storage
* classes.<br>
* <br>
*
* <b>Examples:</b><br>
* <br>
*
* Default unsecured configuration:<br>
*
* <pre>
* {@code
* SimpleStorageConfiguration configuration = new SimpleStorageConfiguration.Builder()
* .build()
* }
* </pre>
*
* Secured configuration:
*
* <pre>
* {
* @code
* final int CHUNK_SIZE = 16 * 1024;
* final String IVX = "1234567890123456";
* final String SECRET_KEY = "secret1234567890";
*
* SimpleStorageConfiguration configuration = new SimpleStorageConfiguration.Builder().setChuckSize(CHUNK_SIZE).setEncryptContent(IVX, SECRET_KEY).build();
* }
* </pre>
*
* @author Roman Kushnarenko - sromku (sromku@gmail.com)
*
*/
public class SimpleStorageConfiguration {
/**
* The best chunk size: <i>http://stackoverflow.com/a/237495/334522</i>
*/
private int mChunkSize;
private boolean mIsEncrypted;
private byte[] mIvParameter;
private byte[] mSecretKey;
private SimpleStorageConfiguration(Builder builder) {
mChunkSize = builder._chunkSize;
mIsEncrypted = builder._isEncrypted;
mIvParameter = builder._ivParameter;
mSecretKey = builder._secretKey;
}
/**
* Get chunk size. The chuck size is used while reading the file by chunks
* {@link FileInputStream#read(byte[], int, int)}.
*
* @return The chunk size
*/
public int getChuckSize() {
return mChunkSize;
}
/**
* Encrypt the file content.<br>
*
* @see <a
* href="https://en.wikipedia.org/wiki/Block_cipher_modes_of_operation">Block
* cipher mode of operation</a>
*/
public boolean isEncrypted() {
return mIsEncrypted;
}
/**
* Get secret key
*
* @return
*/
public byte[] getSecretKey() {
return mSecretKey;
}
/**
* Get iv parameter
*
* @return
*/
public byte[] getIvParameter() {
return mIvParameter;
}
/**
* Configuration Builder class. <br>
* Following Builder design pattern.
*
* @author sromku
*/
public static class Builder {
private int _chunkSize = 8 * 1024; // 8kbits = 1kbyte;
private boolean _isEncrypted = false;
private byte[] _ivParameter = null;
private byte[] _secretKey = null;
private static final String UTF_8 = "UTF-8";
public Builder() {
}
/**
* Build the configuration for storage.
*
* @return
*/
public SimpleStorageConfiguration build() {
return new SimpleStorageConfiguration(this);
}
/**
* Set chunk size. The chuck size is used while reading the file by
* chunks {@link FileInputStream#read(byte[], int, int)}. The preferable
* value is 1024xN bits. While N is power of 2 (like 1,2,4,8,16,...)<br>
* <br>
*
* The default: <b>8 * 1024</b> = 8192 bits
*
* @param chunkSize
* The chunk size in bits
* @return The {@link Builder}
*/
public Builder setChuckSize(int chunkSize) {
_chunkSize = chunkSize;
return this;
}
/**
* Encrypt and descrypt the file content while writing and reading
* to/from disc.<br>
*
*
* @param ivx
* This is not have to be secret. It used just for better
* randomizing the cipher. You have to use the same IV
* parameter within the same encrypted and written files.
* Means, if you want to have the same content after
* descryption then the same IV must be used.<br>
* <br>
*
* <b>Important: The length must be 16 long</b><br>
*
* <i>About this parameter from wiki:
* https://en.wikipedia.org
* /wiki/Block_cipher_modes_of_operation
* #Initialization_vector_.28IV.29</i><br>
* <br>
* @param secretKey
* Set the secret key for encryption of file content. <br>
* <br>
*
* <b>Important: The length must be 16 long</b> <br>
*
* <i>Uses SHA-256 to generate a hash from your key and trim
* the result to 128 bit (16 bytes)</i><br>
* <br>
* @see <a
* href="https://en.wikipedia.org/wiki/Block_cipher_modes_of_operation">Block
* cipher mode of operation</a>
*
*/
public Builder setEncryptContent(String ivx, String secretKey) {
_isEncrypted = true;
// Set IV parameter
try {
_ivParameter = ivx.getBytes(UTF_8);
}
catch (UnsupportedEncodingException e) {
Log.e("SimpleStorageConfiguration", "UnsupportedEncodingException", e);
}
// Set secret key
try {
/*
* We generate random salt and then use 1000 iterations to
* initialize secret key factory which in-turn generates key.
*/
int iterationCount = 1000; // recommended by PKCS#5
int keyLength = 128;
SecureRandom random = new SecureRandom();
byte[] salt = new byte[16]; // keyLength / 8 = salt length
random.nextBytes(salt);
KeySpec keySpec = new PBEKeySpec(secretKey.toCharArray(), salt, iterationCount, keyLength);
SecretKeyFactory keyFactory = null;
if (Build.VERSION.SDK_INT >= 19) {
// see:
// http://android-developers.blogspot.co.il/2013/12/changes-to-secretkeyfactory-api-in.html
// Use compatibility key factory -- only uses lower 8-bits
// of passphrase chars
keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1And8bit");
}
else {
// Traditional key factory. Will use lower 8-bits of
// passphrase chars on
// older Android versions (API level 18 and lower) and all
// available bits
// on KitKat and newer (API level 19 and higher).
keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
}
byte[] keyBytes = keyFactory.generateSecret(keySpec).getEncoded();
_secretKey = keyBytes;
}
catch (InvalidKeySpecException e) {
Log.e("SimpleStorageConfiguration", "InvalidKeySpecException", e);
}
catch (NoSuchAlgorithmException e) {
Log.e("SimpleStorageConfiguration", "NoSuchAlgorithmException", e);
}
return this;
}
}
}
| [
"poosan9@gmail.com"
] | poosan9@gmail.com |
7d3316a958b25504e1a1f3fe8a5fa962c239f786 | 7a906b9872acc9578d08c9093423a1377142089b | /workspace-spring-boot/sample/src/main/java/kr/d/controller/BoardController.java | e8c5a90e3e523fcf3a76a8f838858fb1d818bf4f | [] | no_license | pk6407/Kh-academy-test | eaaf45744528297389afe94bb5f5aa0f7bf69c3a | 2245178662dcbe77b0ee7c6d013f020470940d73 | refs/heads/master | 2023-03-05T05:52:56.544406 | 2021-02-10T08:10:04 | 2021-02-10T08:10:04 | 306,557,800 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,080 | java | package kr.d.controller;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import kr.d.member.MemberVo;
@RestController
public class BoardController {
JdbcTemplate jdbcTemp;
@Autowired
public BoardController(JdbcTemplate jdbcTemp) {
this.jdbcTemp = jdbcTemp;
}
@RequestMapping(value="select", method= {RequestMethod.POST,RequestMethod.GET})
public ModelAndView selectMember(String findStr) {
ModelAndView mv = new ModelAndView();
List<MemberVo>list = new ArrayList<MemberVo>();
String str = "";
try {
PreparedStatement ps = null;
ResultSet rs = null;
Connection conn = jdbcTemp.getDataSource().getConnection();
String sql = "select * from members where mid like ? or name like ? or phone like ? or email like ? ";
ps = conn.prepareStatement(sql);
ps.setNString(1, "%" + findStr + "%");
ps.setNString(2, "%" + findStr + "%");
ps.setNString(3, "%" + findStr + "%");
ps.setNString(4, "%" + findStr + "%");
rs = ps.executeQuery();
while(rs.next()) {
MemberVo vo = new MemberVo();
vo.setMid(rs.getString("mid"));
vo.setName(rs.getString("mid"));
vo.setPhone(rs.getString("mid"));
vo.setEmail(rs.getString("mid"));
list.add(vo);
}
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
mv.addObject("list",list);
mv.setViewName("member/select");
return mv;
}
}
| [
"noreply@github.com"
] | pk6407.noreply@github.com |
6c8a235285606df450699ab3f0381ba709d851c8 | eb8cea55abd57dbdfa0dfb824915ae9c9ebd80e1 | /ProyectoPrestamoDeEscenariosDeportivos/src/ec/edu/model/ManagementStage.java | a662c684de93fc51837aea3cac70c38e5623f323 | [] | no_license | dradav1997/free | 89bb9a161076560539f4c1ae9b192cb3cc0daf9d | fd570e04927cd65a7e2e43bbdf15352ecf475669 | refs/heads/master | 2020-09-06T16:25:51.260374 | 2019-11-08T14:08:22 | 2019-11-08T14:08:22 | 220,479,292 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,418 | java | package ec.edu.model;
import java.util.ArrayList;
import java.util.Calendar;
import ec.edu.model.types.Gender;
import ec.edu.model.types.TypesOfActors;
public class ManagementStage {
private String routeActorsFile="Resources/Files/Escenarios.txt";
private ArrayList<Stage> stages;
public ManagementStage() {
}
public boolean addStage(String id, String name, String description, String observation) {
if (!exist(id)) {
stages.add(new Stage(id, name, description, observation));
return true;
}else {
return false;
}
}
public void modifyStage(String id, String name, String description, String observation) {
stages.set(positionObject(id),new Stage(id, name, description, observation) );
}
public void deleteStage(String id) {
for (Stage stage : stages) {
if (stage.getId().equals(id)) {
stages.remove(positionObject(id));
}
}
}
public int positionObject(String id) {
for (int i = 0; i < stages.size(); i++) {
if (stages.get(i).getId().equals(id)) {
return i;
}
}
return -1;
}
public boolean exist(String id) {
for (Stage stage : stages) {
if (id.compareTo(stage.getId())==0) {
return true;
}
}
return false;
}
public Stage searchById(String id) {
if (exist(id)) {
return stages.get(positionObject(id));
}
return null;
}
}
| [
"noreply@github.com"
] | dradav1997.noreply@github.com |
08ed9a89cae2cb63fcd40542957533ea48576d9a | b97bc0706448623a59a7f11d07e4a151173b7378 | /src/main/java/com/tcmis/client/catalog/beans/VvProgramBean.java | 3a867409f82227dc2dd12d19f86c113a4c77f75f | [] | no_license | zafrul-ust/tcmISDev | 576a93e2cbb35a8ffd275fdbdd73c1f9161040b5 | 71418732e5465bb52a0079c7e7e7cec423a1d3ed | refs/heads/master | 2022-12-21T15:46:19.801950 | 2020-02-07T21:22:50 | 2020-02-07T21:22:50 | 241,601,201 | 0 | 0 | null | 2022-12-13T19:29:34 | 2020-02-19T11:08:43 | Java | UTF-8 | Java | false | false | 1,834 | java | package com.tcmis.client.catalog.beans;
import java.util.*;
import java.math.*;
import com.tcmis.common.framework.BaseDataBean;
/******************************************************************************
* CLASSNAME: VvProgramBean <br>
* @version: 1.0, May 12, 2014 <br>
*****************************************************************************/
public class VvProgramBean extends BaseDataBean {
private String companyId;
private String facilityId;
private BigDecimal programId;
private String programName;
private String emapRequired;
private String jspLabel;
private BigDecimal displayOrder;
private String status;
//constructor
public VvProgramBean() {
}
//setters
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public void setFacilityId(String facilityId) {
this.facilityId = facilityId;
}
public void setProgramId(BigDecimal programId) {
this.programId = programId;
}
public void setProgramName(String programName) {
this.programName = programName;
}
public void setEmapRequired(String emapRequired) {
this.emapRequired = emapRequired;
}
public void setJspLabel(String jspLabel) {
this.jspLabel = jspLabel;
}
public void setDisplayOrder(BigDecimal displayOrder) {
this.displayOrder = displayOrder;
}
public void setStatus(String status) {
this.status = status;
}
//getters
public String getCompanyId() {
return companyId;
}
public String getFacilityId() {
return facilityId;
}
public BigDecimal getProgramId() {
return programId;
}
public String getProgramName() {
return programName;
}
public String getEmapRequired() {
return emapRequired;
}
public String getJspLabel() {
return jspLabel;
}
public BigDecimal getDisplayOrder() {
return displayOrder;
}
public String getStatus() {
return status;
}
} | [
"julio.rivero@wescoair.com"
] | julio.rivero@wescoair.com |
1648e73bad221a1f9ad0f2097183d0c812774e85 | 2ccb11509e9963bdea8c7567c7929fa2ece01ae4 | /src/com/lihui/controller/ActivitiesController.java | 0fed39f095639e785bd36e57bd91ea28ae0f122a | [] | no_license | lihui13603981029/domain | 838f35b923db9636bdbe3512ba5426ce8d4a15ec | 71fa00b23dfa3cbaf3b06f3662ba6c3d4856732b | refs/heads/master | 2020-03-19T16:24:41.799085 | 2018-06-29T07:05:30 | 2018-06-29T07:06:07 | 136,714,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,358 | java | package com.lihui.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.lihui.bean.ActivitiesInfo;
import com.lihui.service.api.IActivity;
import com.lihui.tools.Result;
import net.sf.json.JSON;
import net.sf.json.JSONObject;
import java.util.List;
@Controller
@RequestMapping(value="/activities")
public class ActivitiesController {
@Autowired
IActivity activityService;
@RequestMapping(value="/allMsg",method=RequestMethod.GET)
@ResponseBody
public Result findAllActivitiesMsg() {
List<ActivitiesInfo> activitiesInfos = this.activityService.selectAllExample();
Result result = new Result();
if (activitiesInfos != null) {
JSON json = JSONObject.fromObject(activitiesInfos);
result.setStatus("sucess");
result.setStatusCode("200");
}else{
result.setStatus("error");
}
return result;
}
@RequestMapping(value="/detail",method= RequestMethod.GET)
@ResponseBody
public Result getDetailActivity(@RequestParam() Integer id){
Result result = new Result();
return null;
}
}
| [
"397727593@qq.com"
] | 397727593@qq.com |
1481887f35d69ef5708491dbbffc11d461f5d94b | 85f5fab4407aa5dde3929e2626ddfe1789d35e0f | /PCBuilder/src/main/java/com/pcbuilder/entities/OpticalDrive.java | a5b334f22823fc09ec83c6d5dc39573e3fc696c6 | [] | no_license | dTrksak/PCBuilder | 2ffdf1882ece5e4956899c821a8397f3b26cd32f | 21b91e8b27cc3702f3c591f9835ae372df084f16 | refs/heads/main | 2023-04-15T16:58:07.945196 | 2021-04-29T22:25:49 | 2021-04-29T22:25:49 | 336,148,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,804 | java | package com.pcbuilder.entities;
import java.io.Serializable;
import javax.persistence.*;
/**
* The persistent class for the optical_drive database table.
*
*/
@Entity
@Table(name="optical_drive")
@NamedQuery(name="OpticalDrive.findAll", query="SELECT o FROM OpticalDrive o")
public class OpticalDrive implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="optical_drive_id")
private int opticalDriveId;
private Byte bd;
@Column(name="bd_write")
private String bdWrite;
private Byte cd;
@Column(name="cd_write")
private String cdWrite;
private Byte dvd;
@Column(name="dvd_write")
private String dvdWrite;
//bi-directional many-to-one association to Product
@ManyToOne
@JoinColumn(name="product_id")
private Product product;
public OpticalDrive() {
}
public int getOpticalDriveId() {
return this.opticalDriveId;
}
public void setOpticalDriveId(int opticalDriveId) {
this.opticalDriveId = opticalDriveId;
}
public Byte getBd() {
return this.bd;
}
public void setBd(Byte bd) {
this.bd = bd;
}
public String getBdWrite() {
return this.bdWrite;
}
public void setBdWrite(String bdWrite) {
this.bdWrite = bdWrite;
}
public Byte getCd() {
return this.cd;
}
public void setCd(Byte cd) {
this.cd = cd;
}
public String getCdWrite() {
return this.cdWrite;
}
public void setCdWrite(String cdWrite) {
this.cdWrite = cdWrite;
}
public Byte getDvd() {
return this.dvd;
}
public void setDvd(Byte dvd) {
this.dvd = dvd;
}
public String getDvdWrite() {
return this.dvdWrite;
}
public void setDvdWrite(String dvdWrite) {
this.dvdWrite = dvdWrite;
}
public Product getProduct() {
return this.product;
}
public void setProduct(Product product) {
this.product = product;
}
} | [
"mana_grey@hotmail.com"
] | mana_grey@hotmail.com |
1cf5e2cee4d981256893391095d4a811a2503fc0 | 1139341251ea585f734a847037ac0a2101baf80f | /HelloGit/src/com/xaut/Stu.java | e8b12b60290a74a3b9a67ab74c52786c509dc3c3 | [] | no_license | Whb133/HelloGit | dfbaa6c0535fc87385097f0ba1d5c09d83a464e2 | 86b31e0079fa1cd1b65d61cd0ce50c12ecd005a4 | refs/heads/master | 2022-11-24T08:37:21.735487 | 2020-07-22T02:58:41 | 2020-07-22T02:58:41 | 267,198,080 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 93 | java | package com.xaut;
/**
* @author whb
* @date 2020/5/26-22:31
* @
*/
public class Stu {
}
| [
"1336547912@qq.com"
] | 1336547912@qq.com |
120e0cbb874fd726cd567e4ebebe4d073904fdfc | 7bd08b970699e58857e01026556d8e574446807c | /src/sqlibrary/queries/SQLQueries.java | edc180cb6a9450c47ffff79a226ab36c5ee55dc3 | [] | no_license | gilmarsantana2/SQLLibrary | e21e4b860458477070d6f0cb3f8615c701f1a841 | a33f33a64e6fc4a59a3bef0c7c1598196132927e | refs/heads/master | 2023-08-27T07:32:25.578314 | 2021-10-28T01:47:13 | 2021-10-28T01:47:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,714 | java | package sqlibrary.queries;
import sqlibrary.annotation.*;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class SQLQueries {
/**
* Script INSERT INTO
*
* @param model Classe Model que deve conter as anotações
* @return INSERT INTO teste (nome,estrangeiro_key) VALUES ('novo nome','100');
*/
public static String insertInto(Object model) {
Class<?> classe = model.getClass();
StringBuilder sql = new StringBuilder("INSERT INTO " + getTableName(model) + " (");
for (Field field : classe.getDeclaredFields()) {
if (field.isAnnotationPresent(Ignore.class)) continue;
if (field.isAnnotationPresent(PrimaryKey.class)) continue;
if (field.isAnnotationPresent(ForeignKey.class)) {
ForeignKey att = field.getAnnotation(ForeignKey.class);
if (att.value().isBlank()) sql.append(field.getName()).append(", ");
else sql.append(att.value()).append(", ");
continue;
}
if (field.isAnnotationPresent(TableCollumn.class)) {
TableCollumn att = field.getAnnotation(TableCollumn.class);
if (att.value().isBlank()) sql.append(field.getName()).append(", ");
else sql.append(att.value()).append(", ");
} else {
sql.append(field.getName()).append(", ");
}
}
//remove a ultima virgula
sql = new StringBuilder(sql.substring(0, sql.lastIndexOf(",")) + ") VALUES (");
for (Field field : classe.getDeclaredFields()) {
if (field.isAnnotationPresent(Ignore.class)) continue;
if (field.isAnnotationPresent(PrimaryKey.class)) continue;
if (field.isAnnotationPresent(ForeignKey.class)) {
field.setAccessible(true);
Class<?> foreignTable = field.getType();
boolean hasKey = false;
for (Field foreignKey : foreignTable.getDeclaredFields()) {
foreignKey.setAccessible(true);
if (foreignKey.isAnnotationPresent(PrimaryKey.class)) {
try {
sql.append(getFieldType(foreignKey.get(field.get(model))));
} catch (IllegalAccessException e) {
e.printStackTrace();
}
hasKey = true;
break;
}
}
if (hasKey) continue;
else
throw new NullPointerException("Anotação PrimaryKey não encontrada na classe " + foreignTable.getName());
}
if (field.isAnnotationPresent(SQLAdapterFormat.class)) {
field.setAccessible(true);
sql.append(getAdapterFormater(field, model));
} else {
field.setAccessible(true);
try {
sql.append(getFieldType(field.get(model)));
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
//remove as ulimas aspas
sql = new StringBuilder(sql.substring(0, sql.lastIndexOf(",")) + ");");
return sql.toString();
}
/**
* Script DELETE
*
* @param model Classe Model que deve conter as anotações
* @return DELETE FROM teste WHERE id = '1';
*/
public static String delete(Object model) {
return "DELETE FROM " + getTableName(model) + " WHERE " + getPrimaryKey(model) + ";";
}
/**
* Script UPDATE
*
* @param model Classe Model que deve conter as anotações
* @return UPDATE teste SET nome = 'novo nome', estrangeiro_key = '100' WHERE id = '1';
*/
public static String update(Object model) {
Class<?> classe = model.getClass();
StringBuilder sql = new StringBuilder("UPDATE " + getTableName(model) + " SET ");
for (Field field : classe.getDeclaredFields()) {
if (field.isAnnotationPresent(Ignore.class)) continue;
if (field.isAnnotationPresent(PrimaryKey.class)) continue;
if (field.isAnnotationPresent(ForeignKey.class)) {
field.setAccessible(true);
Class<?> foreignTable = field.getType();
ForeignKey key = field.getAnnotation(ForeignKey.class);
boolean hasKey = false;
for (Field foreignKey : foreignTable.getDeclaredFields()) {
foreignKey.setAccessible(true);
if (foreignKey.isAnnotationPresent(PrimaryKey.class)) {
try {
if (key.value().isBlank())
sql.append(field.getName()).append(" = ").append(getFieldType(foreignKey.get(field.get(model))));
else
sql.append(key.value()).append(" = ").append(getFieldType(foreignKey.get(field.get(model))));
} catch (IllegalAccessException e) {
e.printStackTrace();
}
hasKey = true;
break;
}
}
if (hasKey) continue;
else
throw new NullPointerException("Anotação PrimaryKey não encontrada na classe " + foreignTable.getName());
}
if (field.isAnnotationPresent(TableCollumn.class)) {
field.setAccessible(true);
TableCollumn collum = field.getAnnotation(TableCollumn.class);
try {
if (collum.value().isBlank()) sql.append(field.getName()).append(" = ");
else sql.append(collum.value()).append(" = ");
if (field.isAnnotationPresent(SQLAdapterFormat.class)) {
sql.append(getAdapterFormater(field, model));
} else sql.append(getFieldType(field.get(model)));
} catch (IllegalAccessException e) {
e.printStackTrace();
}
} else {
field.setAccessible(true);
try {
sql.append(field.getName()).append(" = ");
if (field.isAnnotationPresent(SQLAdapterFormat.class)){
sql.append(getAdapterFormater(field, model));
} else sql.append(getFieldType(field.get(model)));
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
//remove a ultima virgula
sql = new StringBuilder(sql.substring(0, sql.lastIndexOf(",")) + " WHERE " + getPrimaryKey(model) + ";");
return sql.toString();
}
/**
* Script SELECT para um unico Elemento contendo PrimaryKey
*
* @param model Classe Model que deve conter as anotações
* @return SELECT * FROM teste WHERE id = '1';
*/
public static String selectById(Object model) {
return "SELECT * FROM " + getTableName(model) + " WHERE " + getPrimaryKey(model) + ";";
}
/**
* Script SELECT para varios Elementos
*
* @param tableName Nome da Classe da consulta
* @param search Busca de todos os elemetos personalizado
* @return SELECT * FROM teste WHERE Script Personalizado;
*/
public static String selectSpecial(String tableName, String search) {
return "SELECT * FROM " + tableName + " WHERE " + search + ";";
}
/**
* Script Select para todos os itens da tabela sem restrições
*
* @param tableName Nome da tabela a ser consultada
* @return SELECT * FROM teste;
*/
public static String selectAll(String tableName) {
return "SELECT * FROM " + tableName + ";";
}
/**
* Script de busca do Ultimo PrimaryKey inserido na tabela
*
* @param model Classe que deve conter as anotações;
* @return SELECT id FROM teste ORDER BY id DESC LIMIT 1;
*/
public static String getLastID(Object model) {
var sql1 = "SELECT ";
var sql2 = " FROM " + getTableName(model) + " ORDER BY ";
var sql3 = "";
var sql4 = " DESC LIMIT 1;";
Class<?> classe = model.getClass();
boolean hasKey = false;
for (Field field : classe.getDeclaredFields()) {
if (field.isAnnotationPresent(PrimaryKey.class)) {
PrimaryKey att = field.getAnnotation(PrimaryKey.class);
if (att.value().isBlank()) sql3 = field.getName();
else sql3 = att.value();
hasKey = true;
break;
}
}
if (!hasKey)
throw new NullPointerException("Anotação TableName não encontrada na classe " + classe.getName());
return sql1 + sql3 + sql2 + sql3 + sql4;
}
private static String getTableName(Object model) {
Class<?> classe = model.getClass();
String tableName;
if (classe.isAnnotationPresent(TableName.class)) {
TableName table = classe.getAnnotation(TableName.class);
tableName = table.value();
} else throw new NullPointerException("Anotação TableName não encontrada na classe " + classe.getName());
return tableName;
}
private static String getPrimaryKey(Object model) {
Class<?> classe = model.getClass();
String key = "";
boolean haskey = false;
for (Field field : classe.getDeclaredFields()) {
if (field.isAnnotationPresent(PrimaryKey.class)) {
field.setAccessible(true);
PrimaryKey primaryKey = field.getAnnotation(PrimaryKey.class);
try {
try {
if (primaryKey.value().isBlank())
key = field.getName() + " = " + field.get(model).toString() + "";
else key = primaryKey.value() + " = " + field.get(model).toString() + "";
} catch (NullPointerException e) {
if (primaryKey.value().isBlank()) key = field.getName() + " = " + 0;
else key = primaryKey.value() + " = " + 0;
}
haskey = true;
break;
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
if (!haskey)
throw new NullPointerException("Anotação PrimaryKey não encontrada na classe " + classe.getName());
return key;
}
private static String getFieldType(Object value) {
if (value == null) return "default, ";
if (Number.class.isInstance(value) || Boolean.class.isInstance(value)) return value + ", ";
else return "'" + value + "', ";
}
private static String getAdapterFormater(Field target, Object model) {
SQLAdapterFormat format = target.getAnnotation(SQLAdapterFormat.class);
Class<?> adapter = format.value();
try {
Method method = adapter.getDeclaredMethod("setAdapter", Object.class);
SQLAdapter t = (SQLAdapter) adapter.getDeclaredConstructor().newInstance();
return getFieldType(method.invoke(t, target.get(model)));
} catch (IllegalAccessException | InvocationTargetException | InstantiationException | NoSuchMethodException e) {
e.printStackTrace();
return null;
}
}
}
| [
"gilmarsantana2@gmail.com"
] | gilmarsantana2@gmail.com |
87f00daabde6184ec48223091750887ff9680665 | 777df459235bb5fcde0bc68b8205f89aa0d49e02 | /10OOHeranca/src/dpacoteabstrato/AFuncionario.java | 18538bf3acbdd8a442cc4b146d4edcfdaeb0372f | [] | no_license | BrunoMMB/Java | 3b073e5193d795653f7ad7f6442abbd5bd24afb5 | 9b7ba7bfc9d73d1a8a8f402a878b5e65154e59b5 | refs/heads/master | 2022-12-01T04:06:20.234046 | 2020-08-20T00:50:57 | 2020-08-20T00:50:57 | 288,866,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 441 | 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 dpacoteabstrato;
/**
*
* @author EDYA
*/
public abstract class AFuncionario {
protected String nome;
protected String cpf;
protected double salario;
public double getBonificacao() {
return (this.salario +100);
}
}
| [
"ctlaltbruno@gmail.com"
] | ctlaltbruno@gmail.com |
ba0a72af54c1a9a27b5308c3e92bd3f4c1ca6792 | 45d9e0cb4fbeb3f3433828b7717ae7a309989b6a | /src/java/Entidades/AluguelHasVeiculoPK.java | 2b0e635b5e8452a806a01bc5fdafb1d10b58d5a1 | [] | no_license | batata9/DW4Bim | d612074190a8be79d055c8c4f663107718c21969 | 87b9a0ede3edc33c28abd89cfbedfaa8e0d5f1c1 | refs/heads/master | 2020-04-10T02:53:53.240017 | 2018-12-07T02:00:12 | 2018-12-07T02:00:12 | 160,755,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,053 | 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 Entidades;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
/**
*
* @author angelodezoti
*/
@Embeddable
public class AluguelHasVeiculoPK implements Serializable {
@Basic(optional = false)
@Column(name = "id_aluguel")
private int idAluguel;
@Basic(optional = false)
@Column(name = "veiculo_id_veiculo")
private int veiculoIdVeiculo;
public AluguelHasVeiculoPK() {
}
public AluguelHasVeiculoPK(int idAluguel, int veiculoIdVeiculo) {
this.idAluguel = idAluguel;
this.veiculoIdVeiculo = veiculoIdVeiculo;
}
public int getIdAluguel() {
return idAluguel;
}
public void setIdAluguel(int idAluguel) {
this.idAluguel = idAluguel;
}
public int getVeiculoIdVeiculo() {
return veiculoIdVeiculo;
}
public void setVeiculoIdVeiculo(int veiculoIdVeiculo) {
this.veiculoIdVeiculo = veiculoIdVeiculo;
}
@Override
public int hashCode() {
int hash = 0;
hash += (int) idAluguel;
hash += (int) veiculoIdVeiculo;
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof AluguelHasVeiculoPK)) {
return false;
}
AluguelHasVeiculoPK other = (AluguelHasVeiculoPK) object;
if (this.idAluguel != other.idAluguel) {
return false;
}
if (this.veiculoIdVeiculo != other.veiculoIdVeiculo) {
return false;
}
return true;
}
@Override
public String toString() {
return "Entidades.AluguelHasVeiculoPK[ idAluguel=" + idAluguel + ", veiculoIdVeiculo=" + veiculoIdVeiculo + " ]";
}
}
| [
"angelodezoti00@gmail.com"
] | angelodezoti00@gmail.com |
68a48e7e6880d3770b3cab25cbfd9aad70a4e3b1 | a30fbb9c2ace8ec4f2bf5089ec4ce1dc770e1de2 | /app/src/main/java/com/ruitong/yuchuan/maptest/utils/PinYinUtil.java | f6b645f23ccacf4fb7b7583f8fa3f2bb475799c7 | [] | no_license | ZEROwolfHwang/HCCYUCHUAN | 4b18aec87bab4dcc39f82cdfc48823d094f82d0c | 31b833ec6f65c71eaae7c484d9477393ad247699 | refs/heads/master | 2021-05-16T13:09:15.050733 | 2017-10-12T03:57:37 | 2017-10-12T03:57:37 | 105,357,991 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,805 | java | package com.ruitong.yuchuan.maptest.utils;
/**
* Created by Administrator on 2016/11/16.
*/
import com.orhanobut.logger.Logger;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import java.util.HashSet;
import java.util.Set;
/**
*
* @author : Robert robert@xiaobei668.com
* @version : 1.00
* Create Time : 2011-3-22-下午07:04:30
* Description :
* 处理汉字和对应拼音转换的工具类
* History:
* Editor version Time Operation Description*
*
*
*/
public class PinYinUtil {
/**
*
* @param src
* @return
* author : Robert
* about version :1.00
* create time : 2011-3-22-下午07:04:27
* Description :
* 传入汉字字符串,拼接成对应的拼音,返回拼音的集合
*/
public static Set<String> getPinYinSet(String src){
Set<String> lstResult = new HashSet<String>();
char[] t1 = null; //字符串转换成char数组
t1 = src.toCharArray();
//①迭代汉字
for(char ch : t1){
String s[] = getPinYin(ch);
Set<String> lstNew = new HashSet<String>();
//②迭代每个汉字的拼音数组
for(String str : s){
if(lstResult.size()==0){
lstNew.add(str);
}else{
for(String ss : lstResult){
ss += str;
lstNew.add(ss);
}
}
}
lstResult.clear();
lstResult = lstNew;
}
return lstResult;
}
public static void main(String[] args) {
Set<String> lst = PinYinUtil.getPinYinSet("迭代每个汉字的拼音数组,该分享来自程序员之家");
for (String string : lst) {
Logger.i(string);
}
}
/**
*
* @param src
* @return
* author : Robert
* about version :1.00
* create time : 2011-3-22-下午02:21:42
* Description :
* 传入中文汉字,转换出对应拼音
* 注:出现同音字,默认选择汉字全拼的第一种读音
*/
public static String getPinYin(String src) {
char[] t1 = null;
t1 = src.toCharArray();
String[] t2 = new String[t1.length];
// 设置汉字拼音输出的格式
HanyuPinyinOutputFormat t3 = new HanyuPinyinOutputFormat();
t3.setCaseType(HanyuPinyinCaseType.LOWERCASE);
t3.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
t3.setVCharType(HanyuPinyinVCharType.WITH_V);
String t4 = "";
int t0 = t1.length;
try {
for (int i = 0; i < t0; i++) {
// 判断能否为汉字字符
// Logger.i(t1[i]);
if (Character.toString(t1[i]).matches("[\\u4E00-\\u9FA5]+")) {
t2 = PinyinHelper.toHanyuPinyinStringArray(t1[i], t3);// 将汉字的几种全拼都存到t2数组中
t4 += t2[0];// 取出该汉字全拼的第一种读音并连接到字符串t4后
} else {
// 如果不是汉字字符,间接取出字符并连接到字符串t4后
t4 += Character.toString(t1[i]);
}
}
} catch (BadHanyuPinyinOutputFormatCombination e) {
e.printStackTrace();
}
return t4;
}
/**
* @param src
* @return
* author : Robert
* about version :1.00
* create time : 2011-3-22-下午02:52:35
* Description :
* 将单个汉字转换成汉语拼音,考虑到同音字问题,返回字符串数组的形式
*/
public static String[] getPinYin(char src){
char[] t1 = {src};
String[] t2 = new String[t1.length];
// 设置汉字拼音输出的格式
HanyuPinyinOutputFormat t3 = new HanyuPinyinOutputFormat();
t3.setCaseType(HanyuPinyinCaseType.LOWERCASE);
t3.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
t3.setVCharType(HanyuPinyinVCharType.WITH_V);
// 判断能否为汉字字符
if (Character.toString(t1[0]).matches("[\\u4E00-\\u9FA5]+")) {
try {
// 将汉字的几种全拼都存到t2数组中
t2 = PinyinHelper.toHanyuPinyinStringArray(t1[0], t3);
} catch (BadHanyuPinyinOutputFormatCombination e) {
e.printStackTrace();
}
} else {
// 如果不是汉字字符,则把字符直接放入t2数组中
t2[0] = String.valueOf(src);
}
return t2;
}
/**
*
* @param src
* @return
* author : Robert
* about version :1.00
* create time : 2011-3-22-下午03:03:02
* Description :
* 传入没有多音字的中文汉字,转换出对应拼音
* 注:如果传入的中文中有任一同音字都会返回字符串信息:false
*/
public static String getNoPolyphone(String src){
char[] t1 = null;
t1 = src.toCharArray();
String[] t2 = new String[t1.length];
// 设置汉字拼音输出的格式
HanyuPinyinOutputFormat t3 = new HanyuPinyinOutputFormat();
t3.setCaseType(HanyuPinyinCaseType.LOWERCASE);
t3.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
t3.setVCharType(HanyuPinyinVCharType.WITH_V);
String t4 = "";
int t0 = t1.length;
try {
for (int i = 0; i < t0; i++) {
// 判断能否为汉字字符
// Logger.i(t1[i]);
if (Character.toString(t1[i]).matches("[\\u4E00-\\u9FA5]+")) {
t2 = PinyinHelper.toHanyuPinyinStringArray(t1[i], t3);// 将汉字的几种全拼都存到t2数组中
if(t2.length>1){
return "false";
}else{
t4 += t2[0];// 取出该汉字全拼的第一种读音并连接到字符串t4后
}
} else {
// 如果不是汉字字符,间接取出字符并连接到字符串t4后
t4 += Character.toString(t1[i]);
}
}
} catch (BadHanyuPinyinOutputFormatCombination e) {
e.printStackTrace();
}
return t4;
}
} | [
"1059901966@qq.com"
] | 1059901966@qq.com |
4a6650cf5f2a2e8e92743db2bc0f2a4f2dd5b6a5 | 81029def8e45bc0116eec0ff39e64e310e23c6a9 | /src/main/java/com/codeclan/example/folderservice/models/User.java | b276208aacf7cc6d737594cdd3f6ebfa28f70e6d | [] | no_license | Crsmith89/Week_13_Day_2_Filing_HW | b11fa25a28a50e395b845eaa20b86cf846722109 | 5a5d0f06ebc135109e091612a965a6431588dc0d | refs/heads/main | 2023-07-21T23:47:54.703135 | 2021-09-07T19:17:55 | 2021-09-07T19:17:55 | 404,058,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,058 | java | package com.codeclan.example.folderservice.models;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
import java.util.List;
@Entity
@Table(name="users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(name="name")
private String name;
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
@JsonIgnoreProperties({"user"})
private List<Folder> folders;
public User(String name) {
this.name = name;
}
public User() {}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Folder> getFolders() {
return folders;
}
public void setFolders(List<Folder> folders) {
this.folders = folders;
}
public void addFolder(Folder folder) {
this.folders.add(folder);
}
}
| [
"craig_ag_smith@outlook.com"
] | craig_ag_smith@outlook.com |
c3bd0444a4d6f242f3b2f0e42fd76c9f677eb06e | aaa03dd77c3022905080d87e34803367c233079a | /app/src/main/java/com/example/myapplication/Strategy/DeliveryLoginBehavior.java | 7d9f635dcd947315cf7da34ba0119739e6402412 | [] | no_license | Mengchen-G/Hungry-Foodie | 5751da7b5fd1ec81bec36791a8c3c5c44a83ffae | 5b35d17c8b6a7ee202a446225b72c18f5d1917f2 | refs/heads/master | 2022-05-26T22:51:25.170374 | 2020-04-28T21:47:17 | 2020-04-28T21:47:17 | 255,160,471 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 193 | java | package com.example.myapplication.Strategy;
public class DeliveryLoginBehavior implements LoginBehavior{
public void loginType(){
System.out.println("login for customer");
}
}
| [
"theFieryDev@gmail.com"
] | theFieryDev@gmail.com |
5d6172b8c7a7d2ede4574ec037dd10ebee3aa3fd | 8e4ba6355b2ecd0cdf15debbf616532710295ab7 | /src/RS2/jagcached/net/FileSystemConstants.java | ef38383286b5c4ecc09d7981cc54626bb5fef94c | [] | no_license | Javatar99/CombatScapeServer | 6bc7f508c099f5b666b789a85224f31f0000925b | 30bed9916f2a7bf94576471ca8a0dd0d6783a2c8 | refs/heads/master | 2020-03-18T15:36:29.246630 | 2018-06-06T02:47:35 | 2018-06-06T02:47:35 | 134,917,426 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 757 | java | package RS2.jagcached.net;
/**
* Holds file system related constants.
*
* @author Graham
*/
public final class FileSystemConstants {
/**
* The number of caches.
*/
public static final int CACHE_COUNT = 5;
/**
* The number of archives in cache 0.
*/
public static final int ARCHIVE_COUNT = 9;
/**
* The size of an index.
*/
public static final int INDEX_SIZE = 6;
/**
* The size of a header.
*/
public static final int HEADER_SIZE = 8;
/**
* The size of a chunk.
*/
public static final int CHUNK_SIZE = 512;
/**
* The size of a block.
*/
public static final int BLOCK_SIZE = HEADER_SIZE + CHUNK_SIZE;
/**
* Default private constructor to prevent instantiation.
*/
private FileSystemConstants() {
}
}
| [
"davidschlachter96@gmail.com"
] | davidschlachter96@gmail.com |
19b719b77b04ff3cfc26d0417269eb6c0237c7de | af2bb71c75e863024fb2381c91738fd50850d23d | /src/main/java/com/example/sell/service/impl/CategroyServiceImpl.java | f7da716859eceac46ee029181b55c11af6c6a16c | [] | no_license | github3332422/- | 272cb9f0b9d6846e0df68cb62be583c4833f8101 | 4adc88c625dd2547585c72ff8c97b2d6d8d8af9a | refs/heads/master | 2020-09-23T22:46:47.635204 | 2019-12-03T11:51:09 | 2019-12-03T11:51:09 | 194,655,362 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,098 | java | package com.example.sell.service.impl;
import com.example.sell.dataobject.ProductCategory;
import com.example.sell.repository.ProductCategroyRepository;
import com.example.sell.service.CategroyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @program: sell
* @description: 服务层
* @author: 张清
* @create: 2019-11-26 07:31
**/
@Service
public class CategroyServiceImpl implements CategroyService {
@Autowired
private ProductCategroyRepository repository;
@Override
public ProductCategory findOne(Integer categroyId) {
return repository.findOne(categroyId);
}
@Override
public List<ProductCategory> findAll() {
return repository.findAll();
}
@Override
public List<ProductCategory> findByCategroyRepository(List<Integer> list) {
return repository.findByCategroyTypeIn(list);
}
@Override
public ProductCategory save(ProductCategory productCategroy) {
return repository.save(productCategroy);
}
}
| [
"mail.zhangqing@gmail.com"
] | mail.zhangqing@gmail.com |
6fa096140708a710b4478c61fe2e6300006af22b | 5a7cbac87d711b791f0d895d9640513d6532b35a | /restli-testsuite-server/src/main/java/testsuite/AssociationResource.java | 94d1449a43fa616b05ec12577a8ebc9e204ccbf4 | [
"BSD-2-Clause"
] | permissive | linkedin/rest.li-test-suite | 7065511562aedd33b85a58a75272447f35289419 | 574b0423753cb1aa68b13df822611c4be96281c4 | refs/heads/master | 2023-06-03T11:27:03.626596 | 2019-11-20T20:36:58 | 2019-11-20T20:36:58 | 181,730,998 | 3 | 6 | BSD-2-Clause | 2020-08-24T17:33:12 | 2019-04-16T16:54:46 | Java | UTF-8 | Java | false | false | 3,603 | java | package testsuite;
import com.linkedin.restli.common.CompoundKey;
import com.linkedin.restli.common.HttpStatus;
import com.linkedin.restli.server.BatchDeleteRequest;
import com.linkedin.restli.server.BatchUpdateRequest;
import com.linkedin.restli.server.BatchUpdateResult;
import com.linkedin.restli.server.UpdateResponse;
import com.linkedin.restli.server.annotations.AssocKey;
import com.linkedin.restli.server.annotations.Finder;
import com.linkedin.restli.server.annotations.Key;
import com.linkedin.restli.server.annotations.RestLiAssociation;
import com.linkedin.restli.server.resources.AssociationResourceTemplate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import testsuite.complexkey.ComplexKey;
/**
* @author jbetz@linkedin.com
*/
@RestLiAssociation(name = "association",
namespace = "testsuite",
assocKeys = {
@Key(name = "part1", type = String.class),
@Key(name = "part2", type = Long.class),
@Key(name = "part3", type = String.class)
})
public class AssociationResource extends AssociationResourceTemplate<LargeRecord>
{
private ComplexKey convert(CompoundKey key)
{
String part1 = (String)key.getPart("part1");
Long part2 = (Long)key.getPart("part2");
String part3 = (String)key.getPart("part3");
return new ComplexKey().setPart1(part1).setPart2(part2).setPart3(Fruits.valueOf(part3));
}
@Override
public LargeRecord get(CompoundKey key)
{
ComplexKey recordKey = convert(key);
return new LargeRecord().setKey(recordKey).setMessage(new Message().setMessage("test message"));
}
@Override
public Map<CompoundKey, LargeRecord> batchGet(Set<CompoundKey> ids)
{
HashMap<CompoundKey, LargeRecord> results = new HashMap<CompoundKey, LargeRecord>();
for(CompoundKey key: ids)
{
LargeRecord record = get(key);
results.put(key, record);
}
return results;
}
@Override
public UpdateResponse update(CompoundKey key, LargeRecord entity)
{
return new UpdateResponse(HttpStatus.S_204_NO_CONTENT);
}
@Override
public BatchUpdateResult<CompoundKey, LargeRecord> batchUpdate(BatchUpdateRequest<CompoundKey, LargeRecord> entities)
{
Map<CompoundKey, UpdateResponse> results = new HashMap<CompoundKey, UpdateResponse>();
for(Map.Entry<CompoundKey, LargeRecord> entry: entities.getData().entrySet())
{
UpdateResponse update = update(entry.getKey(), entry.getValue());
results.put(entry.getKey(), update);
}
return new BatchUpdateResult<CompoundKey, LargeRecord>(results);
}
@Override
public UpdateResponse delete(CompoundKey key)
{
return new UpdateResponse(HttpStatus.S_204_NO_CONTENT);
}
@Override
public BatchUpdateResult<CompoundKey, LargeRecord> batchDelete(BatchDeleteRequest<CompoundKey, LargeRecord> ids)
{
Map<CompoundKey, UpdateResponse> results = new HashMap<CompoundKey, UpdateResponse>();
for(CompoundKey key: ids.getKeys())
{
UpdateResponse update = delete(key);
results.put(key, update);
}
return new BatchUpdateResult<CompoundKey, LargeRecord>(results);
}
@Finder("part1")
public List<LargeRecord> byPart1(@AssocKey("part1") String part1)
{
ArrayList<LargeRecord> results = new ArrayList<LargeRecord>();
for(long i = 1l; i < 4l; i++)
{
results.add(get(new CompoundKey().append("part1", part1).append("part2", i).append("part3", "APPLE")));
}
return results;
}
}
| [
"mlamure@linkedin.com"
] | mlamure@linkedin.com |
7006a24c6e0529bdd4e13d4c18f4dd46fd305fee | 762b2786928d086bbae6951f5ffad59547692d90 | /src/algorithm/leetCode/No2/Solution.java | 8ddaf0d82fb510edd9a64dfe2bbd5237f3275603 | [] | no_license | freestylewill/algorithm-structure | 200eac33d2d35d01eeaa07e1a55a1fda48d5d825 | 6de69aa6a951afdd6a1c6f4599dbaa700d56bedd | refs/heads/master | 2022-06-13T04:53:55.694911 | 2020-05-08T15:36:39 | 2020-05-08T15:36:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,539 | java | package algorithm.leetCode.No2;
class Solution {
public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
ListNode listNode = new ListNode(-1);
ListNode result = listNode;
int nextValue = 0;
while (l1 != null || l2 != null) {
int thisValue = 0;
int sum = (l1 == null ? 0 : l1.val) + (l2 == null ? 0 : l2.val);
int tmp = sum + nextValue;
if (tmp >= 10) {
thisValue = tmp % 10;
nextValue = 1;
} else {
thisValue = tmp;
nextValue = 0;
}
listNode.next = new ListNode(thisValue);
listNode = listNode.next;
if (l1 != null) l1 = l1.next;
if (l2 != null) l2 = l2.next;
}
if (nextValue == 1) {
listNode.next = new ListNode(1);
}
return result.next;
}
public static void main(String[] args) {
Solution solution = new Solution();
ListNode l1 = new ListNode(1);
ListNode l2 = new ListNode(8);
// ListNode l3 = new ListNode(3);
l1.next = l2;
// l2.next = l3;
ListNode l4 = new ListNode(0);
// ListNode l5 = new ListNode(6);
// ListNode l6 = new ListNode(4);
// l4.next = l5;
// l5.next = l6;
ListNode listNode = solution.addTwoNumbers(l1, l4);
while (listNode != null) {
System.out.println(listNode.val);
listNode = listNode.next;
}
}
} | [
"tianwei.li@bitmart.com"
] | tianwei.li@bitmart.com |
7a01965639a3f974d0c2a13ad8e309764117d49a | c0d6f6ba5333026f6515a6d6a8c9214b9f66e271 | /RANKER SELENIUM FRAMEWORK/src/com/testsuite/slideshow/SlideShowTests.java | c79782127bd7ccfa1a8aec97804b520b4d2363e3 | [] | no_license | KallolModak/RankerAutomation | b274adf65658b53c7596064049605a6441f51b47 | 06f4dc4d0000b8128c6d8268ef504a36e321479d | refs/heads/master | 2020-04-14T18:57:59.096245 | 2014-12-04T14:11:03 | 2014-12-04T14:11:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,513 | java | package com.testsuite.slideshow;
import org.testng.Assert;
import org.testng.annotations.Test;
import com.base.BaseSetup;
import com.paeobjects.home.Commonpage;
import com.pageobjects.slideshow.PicsPage;
import com.pageobjects.slideshow.Slideshow;
public class SlideShowTests extends BaseSetup{
@Test(priority=1)
public void Node_Ranking(){
Commonpage common=new Commonpage(getDriver());
Slideshow slideshow=common.clickOnAList("2");
for(int i=1;i<5;i++){
if(i>1){
slideshow.clickNext();
}
System.out.println("Slide No :- "+slideshow.getSlideNo());
Assert.assertEquals(String.valueOf(i), slideshow.getSlideNo());
}
}
// @Test(priority=1)
public void Node_Name(){
Commonpage common=new Commonpage(getDriver());
Slideshow slideshow=common.clickOnAList("1");
}
@Test(priority=3)
public void NodeImage_hover(){
Slideshow slideshow=new Slideshow(getDriver());
slideshow.mousehovernodeimg();
String s=slideshow.nodeImageAttribute();
// System.out.println(s);
Assert.assertTrue(s.contains("display: inline"), "Img Zoom button");
}
@Test(priority=4)
public void NodeImage_click(){
// Commonpage common=new Commonpage(getDriver());
// Slideshow slideshow=common.clickOnAList("1");
Slideshow slideshow=new Slideshow(getDriver());
PicsPage picspge=slideshow.clickOnNodepic();
Assert.assertTrue(picspge.verifyPicsGallery(), "Pics Gallery in Pics page");
picspge.hoveronSlideNxt();
String s=picspge.nxtBGround();
System.out.println(s);
}
}
| [
"kallol@ranker.com"
] | kallol@ranker.com |
329dd22da211690dc2297b777ecd8dfc63c479db | 4fc6ffad8193b9509194386da6d5a787f1e6e934 | /atcrowdfunding-portal-service-boot/src/test/java/cn/heima/day26/socket/Demo3_MoreThread.java | d25960941da027ce6dfaa16c3720a18b5e2e3b38 | [] | no_license | yang123456/atcrowdfunding | 10e55bcfa547d58ebebf3c4d0e78c060a1761642 | 24fac4bc929e578cae56729532b173780084c6dd | refs/heads/master | 2022-12-25T04:05:05.093207 | 2020-06-08T08:46:12 | 2020-06-08T08:46:12 | 194,290,499 | 0 | 0 | null | 2022-12-16T07:25:58 | 2019-06-28T14:51:31 | JavaScript | UTF-8 | Java | false | false | 1,808 | java | package cn.heima.day26.socket;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Scanner;
public class Demo3_MoreThread {
/**
* @param args
*/
public static void main(String[] args) {
new Receive().start();
new Send().start();
}
}
class Receive extends Thread {
public void run() {
try {
DatagramSocket socket = new DatagramSocket(6666); //创建Socket相当于创建码头
DatagramPacket packet = new DatagramPacket(new byte[1024], 1024);//创建Packet相当于创建集装箱
while(true) {
socket.receive(packet); //接货,接收数据
byte[] arr = packet.getData(); //获取数据
int len = packet.getLength(); //获取有效的字节个数
String ip = packet.getAddress().getHostAddress(); //获取ip地址
int port = packet.getPort(); //获取端口号
System.out.println(ip + ":" + port + ":" + new String(arr,0,len));
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
class Send extends Thread {
public void run() {
try {
Scanner sc = new Scanner(System.in); //创建键盘录入对象
DatagramSocket socket = new DatagramSocket(); //创建Socket相当于创建码头
while(true) {
String line = sc.nextLine(); //获取键盘录入的字符串
if("quit".equals(line)) {
break;
}
DatagramPacket packet = //创建Packet相当于集装箱
new DatagramPacket(line.getBytes(), line.getBytes().length, InetAddress.getByName("127.0.0.1"), 6666);
socket.send(packet); //发货,将数据发出去
}
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} | [
"763216917@qq.com"
] | 763216917@qq.com |
d6add8bfef258143d570c2db941b33e32e6913cc | 0f0ec203f65cffc46a2c9e832d7563bc198bbe3f | /lendingengine/src/main/java/com/peerlender/lendingengine/domain/model/Balance.java | 14122222dc249b8e0eaa1e4ed9924392d97af588 | [] | no_license | vladimiriusIT/lendingapp-microservices | ea3b86fab904ca5a7cade7c58586f7753e7c4a34 | f52a371f098037d5e46e9934621eecc4e672eb34 | refs/heads/main | 2023-06-30T04:37:07.566378 | 2021-07-23T10:56:03 | 2021-07-23T10:56:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,171 | java | package com.peerlender.lendingengine.domain.model;
import javax.persistence.*;
import java.util.HashMap;
import java.util.Map;
@Entity
public class Balance {
@Id
@GeneratedValue
private long id;
@ElementCollection
@MapKeyClass(Currency.class)
@OneToMany(targetEntity = Money.class, cascade = CascadeType.ALL)
private Map<Currency, Money> moneyMap = new HashMap<>();
public void topUp(final Money money) {
if (moneyMap.get(money.getCurrency()) == null) {
moneyMap.put(money.getCurrency(), money);
} else {
moneyMap.put(money.getCurrency(),
moneyMap.get(
money.getCurrency())
.add(money));
}
}
public void withdraw(final Money money) {
final Money moneyInBalance = moneyMap.get(money.getCurrency());
if (moneyInBalance == null) {
throw new IllegalStateException();
} else {
moneyMap.put(money.getCurrency(), moneyMap.get(money.getCurrency()).minus(money));
}
}
public Map<Currency, Money> getMoneyMap() {
return moneyMap;
}
}
| [
"vladistratiev@vladis-mac.local"
] | vladistratiev@vladis-mac.local |
4dc70166ce2cc05bfef1479eee41fa44e2d06394 | c8bbce04f73257200855712b2b58182a8919dd65 | /poo2_barbearia/src/conexao/Singleton.java | 43d72ebc68db46b4277e35a2775e91c82cbab2e8 | [] | no_license | junnin77/poo2 | 0a0ad31d6542dd110420c0abf12239c08971f8fe | 1124c5e8d269794a25613ac32345cb341406db84 | refs/heads/master | 2023-01-27T11:33:11.416004 | 2020-12-04T17:46:23 | 2020-12-04T17:46:23 | 318,561,162 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | 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 conexao;
/**
*
* @author edvar
*/
public class Singleton {
private static Singleton uniqueInstance;
private Singleton() {
}
public static synchronized Singleton getInstance() {
if (uniqueInstance == null)
uniqueInstance = new Singleton();
return uniqueInstance;
}
}
| [
"edvar@DESKTOP-88CE7K1"
] | edvar@DESKTOP-88CE7K1 |
bd57593fde87cce17bebd9edebad9d9a85b1da6b | 10ed0ac2b4d144bfbb86d0f6896976b770d69d45 | /src/model/EncValue.java | 02ca68762aa1e9c0b1afe81a0216447a10c46310 | [] | no_license | ripa1995/bachelor-thesis | c9490792a6068080f7f6fb12ef90ec7735af2670 | 78133dbb9314c6845572684177f51dd359d38c62 | refs/heads/master | 2022-10-20T07:24:45.112562 | 2020-01-23T12:29:44 | 2020-01-23T12:29:44 | 133,789,076 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 590 | java | package model;
public class EncValue {
private String varName;
private String key;
public EncValue(String varName, String key) {
this.varName = varName;
this.key = key;
}
public String getVarName() {
return varName;
}
public void setVarName(String varName) {
this.varName = varName;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
@Override
public String toString() {
return "("+this.getVarName()+","+this.getKey()+")";
}
}
| [
"rripamonti@studenti.uninsubria.it"
] | rripamonti@studenti.uninsubria.it |
8d3b19da8f03e77a825dfb74c9e96f49e2d61834 | e120ed3af95b858e16b93477c1ced150bac09fc1 | /spqr/src/main/java/io/github/mstachniuk/graphqljavaexample/graphql/spqr/SpqrUserQuery.java | af1ab4be119bca14c8d7806a2f98f8b7576e158f | [] | no_license | mstachniuk/graphql-java-example | 4da7cf8984070380f6f29b3212d84a5e86ea45b1 | 37a0437cea0dcf3b58d6a889dfae3a500a7b3785 | refs/heads/master | 2021-06-10T00:28:49.142808 | 2021-01-12T20:06:44 | 2021-01-12T20:06:44 | 129,631,439 | 5 | 1 | null | 2021-01-11T22:30:59 | 2018-04-15T16:57:26 | Java | UTF-8 | Java | false | false | 1,317 | java | package io.github.mstachniuk.graphqljavaexample.graphql.spqr;
import io.github.mstachniuk.graphqljavaexample.user.Admin;
import io.github.mstachniuk.graphqljavaexample.user.Moderator;
import io.github.mstachniuk.graphqljavaexample.user.User;
import io.github.mstachniuk.graphqljavaexample.user.UserService;
import io.leangen.graphql.annotations.GraphQLQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class SpqrUserQuery {
@Autowired
private UserService userService;
@GraphQLQuery(name = "users")
public List<SpqrUser> getAllUsers() {
return userService.getUsers().stream()
.map(this::toSpqr)
.collect(Collectors.toList());
}
private SpqrUser toSpqr(User user) {
if(user instanceof Admin) {
return new SpqrAdmin(user.getId(), user.getName(), user.getEmail(), ((Admin) user).isSuperAdmin());
} else if(user instanceof Moderator) {
return new SpqrModerator(user.getId(), user.getName(), user.getEmail(), ((Moderator) user).getPermissions());
}
throw new RuntimeException("Type " + user.getClass().getName() + " NOT implemented as User");
}
}
| [
"mstachniuk@gmail.com"
] | mstachniuk@gmail.com |
b767bdbfb9c768f046e3f13c7dc4bde474cbf267 | 41054ba624da47a0c2e963e82c007cf5ec572e98 | /src/main/java/turbomann/Chapter_1/FOO.java | b1dcde6e3dd1b650b367aded1ce2b479ac0c0b96 | [] | no_license | turbomann/HF | 7120b5067374ba28864bcf3b4068dad6b5e3fee4 | 7aab02a5372a7b3a655e44e18dc78d0cbbda3fff | refs/heads/master | 2022-12-29T00:17:54.851450 | 2019-10-23T19:33:45 | 2019-10-23T19:33:45 | 113,082,395 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 255 | java | package turbomann.Chapter_1;
public class FOO {
public static void main(String[] args) {
int x= 5;
while (x>1){
x=x-1;
if (x<3){
System.out.println("Small x ");
}
}
}
}
| [
"headsimulation@gmail.com"
] | headsimulation@gmail.com |
8fbf4685353a85f6a4e9096cd6e71073dc0309a2 | 1666a61485a70ad36a6921ff440a5042d72ff85d | /src/main/java/com/miage/OnlineBooking/repo/BookingRepo.java | 0c42080581fafe2f944b8c2494a52d2d5e71dfda | [] | no_license | bhaktitilara/OnlineBooking | 21007b91f485f1c115296d18946957cd3303da8d | 7108d5e56a90120d214579c2ae4f5ea48b06e3b0 | refs/heads/main | 2023-04-18T03:26:36.615819 | 2021-05-05T13:52:29 | 2021-05-05T13:52:29 | 357,675,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package com.miage.OnlineBooking.repo;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import com.miage.OnlineBooking.domain.Booking;
import com.miage.OnlineBooking.domain.User;
/**
*
* @author bhakti
*/
public interface BookingRepo extends JpaRepository<Booking, Long> {
List<Booking> findByUser(User user);
List<Booking> findAll();
}
| [
"bhaktitilara@gmail.com"
] | bhaktitilara@gmail.com |
ec0ddafdd92f9dd4d07093644c7272315714c95e | 394c7d7f9ce8a5e96bd3305ac90a627e676f4278 | /minmeng-manager/src/main/java/com/minmeng/manager/action/ui/PageViewAction.java | 567dcd2cf83532d3877a58fb3683c4969d1ba327 | [] | no_license | rain567/minmeng | a14d7c5181d66452fe230b209a77feb9a6e58663 | c09fe6bbc1942a9471e6161456d30cb094365b47 | refs/heads/master | 2022-10-08T17:23:19.600938 | 2019-07-16T08:30:39 | 2019-07-16T08:30:39 | 196,681,565 | 0 | 0 | null | 2022-09-01T23:09:48 | 2019-07-13T05:19:04 | JavaScript | UTF-8 | Java | false | false | 2,580 | java | package com.minmeng.manager.action.ui;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.fixwork.mapping.ActionPath;
import org.fixwork.mapping.ActionUri;
import org.fixwork.util.Error;
import org.fixwork.util.StringUtils;
import org.fixwork.util.Success;
import com.minmeng.entity.ui.Page;
import com.minmeng.entity.ui.PageView;
import com.minmeng.entity.ui.View;
/**
* @Description 页面控件
* @Company 贵州沃尔达科技有限公司
* @Author 杨大江
* @Version 1.0.1
* @Date 2018-12-26
*/
@ActionPath(path="/ui/page-view/",dir="/WEB-INF/jsp/ui/page-view/")
public class PageViewAction extends UIAction{
static final Logger log = Logger.getLogger(PageViewAction.class);
@ActionUri(uri="([/])?")
public String index(){
return "index.jsp";
}
@ActionUri(uri="getList([/])?")
public void getList(String pageName){
List<PageView> list = pageViewService.query(pageName);
Map<String,Object> m = new HashMap<String,Object>();
m.put("rows", list);
printJson(m);
}
@ActionUri(uri="save([/])?",description="UI设置-保存页面控件")
public void save(String viewId,String pageName,String status,Integer sorter,String id){
Page page = pageService.getByName(pageName);
if(page == null){
printJson(new Error( "未指定页面."));
return;
}
View view = viewService.get(viewId);
if(view == null){
printJson(new Error( "未指定控件."));
return;
}
if(StringUtils.isEmpty(id)){
printJson(new Error( "未设置ID."));
return;
}
if(StringUtils.isEmpty(status)){
printJson(new Error( "未设置状态."));
return;
}
if(!status.matches("\\d+")){
printJson(new Error( "未设置状态."));
return;
}
PageView pageView = pageViewService.get(id);
if(pageView == null){
pageView = new PageView();
}
pageView.setId(id);
pageView.setPageId(page.getId());
pageView.setView(view);
pageView.setSorter(sorter);
pageView.setStatus(status);
if(pageViewService.save(pageView)!=null){
Map<String,PageView> map = new HashMap<String,PageView>();
map.put("row", pageView);
printJson(map);
sqlDump("保存页面控件:"+view.getName()+".");
}else {
printJson(new Error( "保存失败."));
}
}
@ActionUri(uri="del([/])?",description="UI设置-删除页面控件")
public void del(String ids) {
if(pageViewService.delete(ids.split(","))>0){
printJson(new Success( "删除完成."));
sqlDump("删除页面控件:"+ids+".");
}else {
printJson(new Error( "删除失败."));
}
}
}
| [
"396740242@qq.com"
] | 396740242@qq.com |
f2ed4b6344655722f23a30199e70535976beb5e6 | ae85100db76a1c66417ac7033eb96c99d335dec2 | /LiveData-master/TestApplication/app/src/main/java/com/achal/test/mvvm/models/Canada.java | 5c3a1f448347a807ba4358632420694263149f95 | [] | no_license | badgujarachal/Achalsample | 3b6fdd863025bce82d4ac5602e1f5898bd4c4471 | b6234103c7886881b0141fac99d4000e170b5124 | refs/heads/master | 2022-04-24T09:12:23.049469 | 2020-04-23T06:32:54 | 2020-04-23T06:32:54 | 258,115,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 619 | java | package com.achal.test.mvvm.models;
public class Canada {
private String title;
private String description;
private String imageHref;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getImageHref() {
return imageHref;
}
public void setImageHref(String imageHref) {
this.imageHref = imageHref;
}
} | [
"achalrb@ix.lentra.ai"
] | achalrb@ix.lentra.ai |
cd5c91a15cc6a1b2a41c53514e32c9abf89709f3 | 7b4864b9837d7c5f1384463fb9958ac875b3b1ff | /lib/jpbc 1.2.1/jpbc-test/src/test/java/it/unisa/dia/gas/jpbc/bls/BlsTest.java | 4c9fa29f0d263dc8c7a335a73c84c5cf443b1715 | [] | no_license | yyb19980802/TestEncrypt | 3ed533746ec63ccc826f855b8cf77c1bc3ae0fda | 3223a805b4ac31e3f2a64cb097d00297f61ec016 | refs/heads/master | 2021-07-16T13:08:00.083436 | 2019-12-04T13:48:35 | 2019-12-04T13:48:35 | 218,992,643 | 0 | 0 | null | 2020-10-13T17:48:54 | 2019-11-01T13:41:07 | Java | UTF-8 | Java | false | false | 1,954 | java | package it.unisa.dia.gas.jpbc.bls;
import it.unisa.dia.gas.jpbc.Element;
import it.unisa.dia.gas.plaf.jpbc.AbstractJPBCTest;
import org.junit.Test;
import org.junit.runners.Parameterized;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertTrue;
/**
* @author Angelo De Caro (angelo.decaro@gmail.com)
*/
public class BlsTest extends AbstractJPBCTest {
@Parameterized.Parameters
public static Collection parameters() {
Object[][] data = {
{false, "it/unisa/dia/gas/plaf/jpbc/pairing/a/a_181_603.properties"},
{true, "it/unisa/dia/gas/plaf/jpbc/pairing/a/a_181_603.properties"},
};
return Arrays.asList(data);
}
public BlsTest(boolean usePBC, String curvePath) {
super(usePBC, curvePath);
}
@Test
public void testBls() {
// Generate system parameters
Element g = pairing.getG2().newRandomElement();
// Generate the secret key
Element x = pairing.getZr().newRandomElement();
// Generate the corresponding public key
Element pk = g.duplicate().powZn(x); // We need to duplicate g because it's a system parameter.
// Map the hash of the message m to some element of G1
byte[] hash = "ABCDEF".getBytes(); // Generate an hash from m (48-bit hash)
Element h = pairing.getG1().newElement().setFromHash(hash, 0, hash.length);
// Generate the signature
Element sig = h.powZn(x); // We can discard the value h, so we don't need to duplicate it.
// Map again the hash of the message m
hash = "ABCDEF".getBytes(); // Generate an hash from m (48-bit hash)
h = pairing.getG1().newElement().setFromHash(hash, 0, hash.length);
// Verify the signature
Element temp1 = pairing.pairing(sig, g);
Element temp2 = pairing.pairing(h, pk);
assertTrue(temp1.isEqual(temp2));
}
} | [
"979480544@qq.com"
] | 979480544@qq.com |
7a7c535186f6115f6f31ab0184bbe808cec9ca06 | 3ae0a34122b5c45145a0f42e02461e23eb5296c3 | /mybatis1/src/main/java/com/shangguan/mybatis1/interceptor/TimeCostInterceptor.java | 7c419203b9234f91d89dcb9ad8863028fdf871ff | [] | no_license | qq120882247/spring-boot-example | 50ff4d381dd2aa2f4bad16af0b69f8aeb7b65636 | 248f571334b759e21060d3ea0d529c018dc96a7e | refs/heads/master | 2022-02-23T11:49:25.655062 | 2019-07-27T12:20:47 | 2019-07-27T12:20:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,442 | java | package com.shangguan.mybatis1.interceptor;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import com.shangguan.mybatis1.util.SimpleDateFormatCache;
public class TimeCostInterceptor implements HandlerInterceptor {
/**
* preHandle在执行Controller之前执行,返回true,则继续执行Contorller
* 返回false则请求中断。
*/
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
crossDomain(request, response);
long startTime = System.currentTimeMillis();
request.setAttribute("startTime", startTime);
return true;
}
/**
* postHandle是在请求执行完,但渲染ModelAndView返回之前执行
*/
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
long startTime = (Long) request.getAttribute("startTime");
long endTime = System.currentTimeMillis();
long executeTime = endTime - startTime;
if (handler instanceof HandlerMethod) {
StringBuilder sb = new StringBuilder(1000);
sb.append("-----------------------").append(SimpleDateFormatCache.getYmdhms().format(new Date()))
.append("-------------------------------------\n");
HandlerMethod h = (HandlerMethod) handler;
sb.append("Controller: ").append(h.getBean().getClass().getName()).append("\n");
sb.append("Method : ").append(h.getMethod().getName()).append("\n");
sb.append("Params : ").append(getParamString(request.getParameterMap())).append("\n");
sb.append("URI : ").append(request.getRequestURI()).append("\n");
sb.append("RequestIP : ").append(request.getRemoteAddr()).append("\n");
sb.append("CostTime : ").append(executeTime).append("ms").append("\n");
sb.append("-------------------------------------------------------------------------------");
System.out.println(sb.toString());
}
}
private String getParamString(Map<String, String[]> map) {
StringBuilder sb = new StringBuilder();
for (Entry<String, String[]> e : map.entrySet()) {
sb.append(e.getKey()).append("=");
String[] value = e.getValue();
if (value != null && value.length == 1) {
sb.append(value[0]).append("\t");
} else {
sb.append(Arrays.toString(value)).append("\t");
}
}
return sb.toString();
}
/**
* afterCompletion是在整个请求执行完毕后执行
*/
public void afterCompletion(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, Exception arg3)
throws Exception {
}
public void crossDomain(HttpServletRequest request, HttpServletResponse response) {
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
response.setHeader("Access-Control-Allow-Credentials", "true");
}
}
| [
"1220560544@qq.com"
] | 1220560544@qq.com |
1d2f92b4f4db2b6582882a967be30d7690b63ba0 | f0535d908d431567138e8145822e5a6c777d5623 | /常用设计模式/src/代理模式/代理模式的扩展/普通代理/GamePlayerProxy.java | 503c3069a63793438d22abb5192337ef4533cfa4 | [
"Apache-2.0"
] | permissive | sunnyjinyubao/design-pattern-java- | 85230f5b5569f89afca5e376b4df45dca41ee7c4 | f86bbf600027b9258c870d2ff4bd7624fcbf34e2 | refs/heads/master | 2020-04-26T18:52:27.046793 | 2019-03-04T14:24:53 | 2019-03-04T14:24:53 | 173,757,586 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 956 | java | package 代理模式.代理模式的扩展.普通代理;
import 代理模式.我是游戏至尊.IGamePlayer;
/**
* 仅仅修改了构造函数,传递进来一个代理者名称,即可进行代理,在这种改造下,系统
* 更加简洁了,调用者只知道代理存在就可以,不用知道代理了谁
*/
public class GamePlayerProxy implements IGamePlayer {
private IGamePlayer gamePlayer = null;
//通过构造函数传递要对谁进行代练
public GamePlayerProxy(String name){
try {
gamePlayer = new GamePlayer(this,name);
} catch (Exception e) {
// TODO 异常处理
}
}
//代练杀怪
public void killBoss() {
this.gamePlayer.killBoss();
}
//代练登录
public void login(String user, String password) {
this.gamePlayer.login(user, password);
}
//代练升级
public void upgrade() {
this.gamePlayer.upgrade();
}
}
| [
"1345551624@qq.com"
] | 1345551624@qq.com |
146cb4123ce974eb1db9d4a92ef8cb1fab949240 | 6f822f89319288854d6eb290e27961022c0ea5f3 | /ARnote/src/main/java/com/IDS/administrator/arnote/Map/MapPane.java | 70c91ddfad9cec7fdff7a082cff2315b81084f07 | [] | no_license | DLBL0624/ARNote | 405fac2260b30beedf048a418ae1f87ba89bc9b2 | 7fa4237023555cfd43aa5e732639227bd67c1063 | refs/heads/master | 2020-03-10T14:20:50.422407 | 2018-04-23T13:21:12 | 2018-04-23T13:21:12 | 129,424,142 | 0 | 0 | null | 2018-04-22T00:40:05 | 2018-04-13T15:55:55 | Java | UTF-8 | Java | false | false | 7,365 | java | package com.IDS.administrator.arnote.Map;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.View;
import com.IDS.administrator.arnote.Message;
import com.IDS.administrator.arnote.MessageManager;
import com.IDS.administrator.arnote.R;
import com.IDS.administrator.arnote.VuforiaSamples.app.UserDefinedTargets.UserDefinedTargets;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import java.util.ArrayList;
public class MapPane extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
Context mContext;
private LocationManager locationManager;
private Location currentLocation;
private Marker userMarker;
public static LatLng userLocation;
private boolean isMark = false;
private ArrayList<Message> markedMess = new ArrayList<Message>();
private ArrayList<Marker> messMarker = new ArrayList<Marker>();
LocationListener userLocationListener;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
mContext = this;
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
mMap.setMyLocationEnabled(true);
LocationManager locationManager = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
//remove all existed message marker
removeMessageMarks();
MessageMarkDestroy();
userLocationListener = new LocationListener() {
public void onLocationChanged(Location location) { //当坐标改变时触发此函数,如果Provider传进相同的坐标,它就不会被触发
// log it when the location changes
if (location != null) {
if(isMark)userMarker.remove();
Log.i("SuperMap", "Location changed : Lat: "
+ location.getLatitude() + " Lng: "
+ location.getLongitude());
userLocation = new LatLng(location.getLatitude(),location.getLongitude());
userMarker = mMap.addMarker(new MarkerOptions().position(userLocation).title("Here's me").snippet("lalala").icon(BitmapDescriptorFactory.fromResource(R.drawable.usericon)));
MessageManager.latitude = userLocation.latitude;
MessageManager.longitude = userLocation.longitude;
isMark = true;
}
}
public void onProviderDisabled(String provider) {
// Provider被disable时触发此函数,比如GPS被关闭
}
public void onProviderEnabled(String provider) {
// Provider被enable时触发此函数,比如GPS被打开
}
public void onStatusChanged(String provider, int status, Bundle extras) {
// Provider的转态在可用、暂时不可用和无服务三个状态直接切换时触发此函数
}
};
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
1000, 5, userLocationListener);
// Criteria criteria = new Criteria();
//
// Location location = locationManager.getLastKnownLocation(locationManager
// .getBestProvider(criteria, false));
// double latitude = location.getLatitude();
// double longitude = location.getLongitude();
// userLocation = new LatLng(latitude,longitude);
// userMarker = mMap.addMarker(new MarkerOptions().position(userLocation).title("Here's me").snippet("lalala"));
getMessageList(MessageManager.messList);
drawMessageMarks();
}
public void OnAddClick(View view) {
if( view.getId()==R.id.m_add) {
Intent i = new Intent(MapPane.this, UserDefinedTargets.class);
startActivity(i);
}
}
public void OnMapClick(View view) {
if( view.getId()==R.id.m_map) {
}
}
// public void getLastLocation(){
// String provider = getBestProvider();
// currentLocation = locationManager.getLastKnownLocation(provider);
// if(currentLocation != null){
// setCurrentLocation(currentLocation);
// }
// else
// {
// Toast.makeText(this, "Location not yet acquired", Toast.LENGTH_LONG).show();
// }
// }
public double getUserPositionLatitude(){//X
return this.userLocation.latitude;
}
public double getUserPositionlongitude(){//Y
return this.userLocation.longitude;
}
public void getMessageList(ArrayList<Message> meslist){
Message mes;
LatLng mesLocation;
String str;
for(int i=0; i<meslist.size(); i++){
mes = meslist.get(i);
markedMess.add(mes);
}
}
public void drawMessageMarks(){
Message mes;
LatLng mesLocation;
String str;
Marker mMarker;
for(int i = 0; i< markedMess.size(); i++){
mes = markedMess.get(i);
mesLocation = new LatLng(mes.getLocationX(),mes.getLocationY());
str = mes.getMessage();
mMarker = mMap.addMarker(new MarkerOptions().position(mesLocation).title("Message!").snippet(str));
messMarker.add(mMarker);
}
}
public void removeMessageMarks(){
for(int i = messMarker.size()-1; i>=0; i--){
messMarker.get(i).remove();
messMarker.remove(i);
}
}
public void MessageMarkDestroy(){
for(int i = markedMess.size()-1; i>=0; i--){
markedMess.remove(i);
}
}
}
| [
"xjn0624@gmail.com"
] | xjn0624@gmail.com |
b2477b52a2cdf66d7f57f2e0dad3d8f910434b91 | d2af02ff8ff869c12e5365ca2e892db71e55457f | /ezbudgetservice/src/main/java/com/digitalacademy/ezbudgetservice/interceptors/EzBudgetServiceInterceptorAppConfig.java | 93da179ed8e3c289693188d5044e037d92aa70c7 | [] | no_license | BigHanchai/EzBudget | db94cab814d27f6e11379f299d72420a521517c0 | 2248cb5a3b3dd5a87435da60a9f1a5112accd4d7 | refs/heads/master | 2022-01-19T06:58:16.925992 | 2019-07-25T17:09:25 | 2019-07-25T17:09:25 | 198,352,953 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 685 | java | package com.digitalacademy.ezbudgetservice.interceptors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Component
public class EzBudgetServiceInterceptorAppConfig implements WebMvcConfigurer {
@Autowired
com.digitalacademy.ezbudgetservice.interceptors.EzBudgetServiceInterceptor ezBudgetServiceInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(ezBudgetServiceInterceptor);
}
}
| [
"hanchai.anansinchai@scb.co.th"
] | hanchai.anansinchai@scb.co.th |
2ec19084595473a09ee51f386cdf3efe2ec63585 | 9e8c2c565cbf8cf0de8244bfed749d4ecba539a8 | /portlets/HRMSDBServices-portlet/docroot/WEB-INF/service/com/hrms/model/CandidateWrapper.java | f795a986a61d5e5803c946d7bdb8c558b96d58eb | [] | no_license | Yashpalsinh/hrms-Phase1 | 342c721fc2fdd6284b8488a941d4a38b8452dbbb | 8f2e10f9446accb44456b6f58aa8733a873347f1 | refs/heads/master | 2021-01-15T13:44:53.105848 | 2015-03-24T13:24:56 | 2015-03-24T13:24:56 | 31,701,263 | 0 | 7 | null | 2015-03-24T13:24:56 | 2015-03-05T07:26:28 | Java | UTF-8 | Java | false | false | 24,027 | java | /**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of the Liferay Enterprise
* Subscription License ("License"). You may not use this file except in
* compliance with the License. You can obtain a copy of the License by
* contacting Liferay, Inc. See the License for the specific language governing
* permissions and limitations under the License, including but not limited to
* distribution rights of the Software.
*
*
*
*/
package com.hrms.model;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.ModelWrapper;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
* This class is a wrapper for {@link Candidate}.
* </p>
*
* @author yashpalsinh
* @see Candidate
* @generated
*/
public class CandidateWrapper implements Candidate, ModelWrapper<Candidate> {
public CandidateWrapper(Candidate candidate) {
_candidate = candidate;
}
@Override
public Class<?> getModelClass() {
return Candidate.class;
}
@Override
public String getModelClassName() {
return Candidate.class.getName();
}
@Override
public Map<String, Object> getModelAttributes() {
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("candidateId", getCandidateId());
attributes.put("employeeDepartmentId", getEmployeeDepartmentId());
attributes.put("employeeSubDepartmentId", getEmployeeSubDepartmentId());
attributes.put("employeeDesignationId", getEmployeeDesignationId());
attributes.put("title", getTitle());
attributes.put("firstName", getFirstName());
attributes.put("middleName", getMiddleName());
attributes.put("lastName", getLastName());
attributes.put("dateOfBirth", getDateOfBirth());
attributes.put("nationality", getNationality());
attributes.put("maritalStatus", getMaritalStatus());
attributes.put("street1", getStreet1());
attributes.put("street2", getStreet2());
attributes.put("street3", getStreet3());
attributes.put("city", getCity());
attributes.put("zip", getZip());
attributes.put("countryId", getCountryId());
attributes.put("personalEmail", getPersonalEmail());
attributes.put("currentCtc", getCurrentCtc());
attributes.put("expectedCtc", getExpectedCtc());
attributes.put("noticePeriod", getNoticePeriod());
attributes.put("resumeId", getResumeId());
attributes.put("resumePath", getResumePath());
attributes.put("employeeProofId", getEmployeeProofId());
attributes.put("proofNumber", getProofNumber());
attributes.put("gender", getGender());
attributes.put("status", getStatus());
attributes.put("shortListed", getShortListed());
attributes.put("createDate", getCreateDate());
attributes.put("modifiedDate", getModifiedDate());
attributes.put("createBy", getCreateBy());
attributes.put("modifiedBy", getModifiedBy());
return attributes;
}
@Override
public void setModelAttributes(Map<String, Object> attributes) {
Long candidateId = (Long)attributes.get("candidateId");
if (candidateId != null) {
setCandidateId(candidateId);
}
Long employeeDepartmentId = (Long)attributes.get("employeeDepartmentId");
if (employeeDepartmentId != null) {
setEmployeeDepartmentId(employeeDepartmentId);
}
Long employeeSubDepartmentId = (Long)attributes.get(
"employeeSubDepartmentId");
if (employeeSubDepartmentId != null) {
setEmployeeSubDepartmentId(employeeSubDepartmentId);
}
Long employeeDesignationId = (Long)attributes.get(
"employeeDesignationId");
if (employeeDesignationId != null) {
setEmployeeDesignationId(employeeDesignationId);
}
String title = (String)attributes.get("title");
if (title != null) {
setTitle(title);
}
String firstName = (String)attributes.get("firstName");
if (firstName != null) {
setFirstName(firstName);
}
String middleName = (String)attributes.get("middleName");
if (middleName != null) {
setMiddleName(middleName);
}
String lastName = (String)attributes.get("lastName");
if (lastName != null) {
setLastName(lastName);
}
Date dateOfBirth = (Date)attributes.get("dateOfBirth");
if (dateOfBirth != null) {
setDateOfBirth(dateOfBirth);
}
String nationality = (String)attributes.get("nationality");
if (nationality != null) {
setNationality(nationality);
}
Integer maritalStatus = (Integer)attributes.get("maritalStatus");
if (maritalStatus != null) {
setMaritalStatus(maritalStatus);
}
String street1 = (String)attributes.get("street1");
if (street1 != null) {
setStreet1(street1);
}
String street2 = (String)attributes.get("street2");
if (street2 != null) {
setStreet2(street2);
}
String street3 = (String)attributes.get("street3");
if (street3 != null) {
setStreet3(street3);
}
String city = (String)attributes.get("city");
if (city != null) {
setCity(city);
}
Long zip = (Long)attributes.get("zip");
if (zip != null) {
setZip(zip);
}
Long countryId = (Long)attributes.get("countryId");
if (countryId != null) {
setCountryId(countryId);
}
String personalEmail = (String)attributes.get("personalEmail");
if (personalEmail != null) {
setPersonalEmail(personalEmail);
}
Long currentCtc = (Long)attributes.get("currentCtc");
if (currentCtc != null) {
setCurrentCtc(currentCtc);
}
Long expectedCtc = (Long)attributes.get("expectedCtc");
if (expectedCtc != null) {
setExpectedCtc(expectedCtc);
}
String noticePeriod = (String)attributes.get("noticePeriod");
if (noticePeriod != null) {
setNoticePeriod(noticePeriod);
}
Long resumeId = (Long)attributes.get("resumeId");
if (resumeId != null) {
setResumeId(resumeId);
}
String resumePath = (String)attributes.get("resumePath");
if (resumePath != null) {
setResumePath(resumePath);
}
Long employeeProofId = (Long)attributes.get("employeeProofId");
if (employeeProofId != null) {
setEmployeeProofId(employeeProofId);
}
String proofNumber = (String)attributes.get("proofNumber");
if (proofNumber != null) {
setProofNumber(proofNumber);
}
Integer gender = (Integer)attributes.get("gender");
if (gender != null) {
setGender(gender);
}
Boolean status = (Boolean)attributes.get("status");
if (status != null) {
setStatus(status);
}
Boolean shortListed = (Boolean)attributes.get("shortListed");
if (shortListed != null) {
setShortListed(shortListed);
}
Date createDate = (Date)attributes.get("createDate");
if (createDate != null) {
setCreateDate(createDate);
}
Date modifiedDate = (Date)attributes.get("modifiedDate");
if (modifiedDate != null) {
setModifiedDate(modifiedDate);
}
Long createBy = (Long)attributes.get("createBy");
if (createBy != null) {
setCreateBy(createBy);
}
Long modifiedBy = (Long)attributes.get("modifiedBy");
if (modifiedBy != null) {
setModifiedBy(modifiedBy);
}
}
/**
* Returns the primary key of this candidate.
*
* @return the primary key of this candidate
*/
@Override
public long getPrimaryKey() {
return _candidate.getPrimaryKey();
}
/**
* Sets the primary key of this candidate.
*
* @param primaryKey the primary key of this candidate
*/
@Override
public void setPrimaryKey(long primaryKey) {
_candidate.setPrimaryKey(primaryKey);
}
/**
* Returns the candidate ID of this candidate.
*
* @return the candidate ID of this candidate
*/
@Override
public long getCandidateId() {
return _candidate.getCandidateId();
}
/**
* Sets the candidate ID of this candidate.
*
* @param candidateId the candidate ID of this candidate
*/
@Override
public void setCandidateId(long candidateId) {
_candidate.setCandidateId(candidateId);
}
/**
* Returns the employee department ID of this candidate.
*
* @return the employee department ID of this candidate
*/
@Override
public long getEmployeeDepartmentId() {
return _candidate.getEmployeeDepartmentId();
}
/**
* Sets the employee department ID of this candidate.
*
* @param employeeDepartmentId the employee department ID of this candidate
*/
@Override
public void setEmployeeDepartmentId(long employeeDepartmentId) {
_candidate.setEmployeeDepartmentId(employeeDepartmentId);
}
/**
* Returns the employee sub department ID of this candidate.
*
* @return the employee sub department ID of this candidate
*/
@Override
public long getEmployeeSubDepartmentId() {
return _candidate.getEmployeeSubDepartmentId();
}
/**
* Sets the employee sub department ID of this candidate.
*
* @param employeeSubDepartmentId the employee sub department ID of this candidate
*/
@Override
public void setEmployeeSubDepartmentId(long employeeSubDepartmentId) {
_candidate.setEmployeeSubDepartmentId(employeeSubDepartmentId);
}
/**
* Returns the employee designation ID of this candidate.
*
* @return the employee designation ID of this candidate
*/
@Override
public long getEmployeeDesignationId() {
return _candidate.getEmployeeDesignationId();
}
/**
* Sets the employee designation ID of this candidate.
*
* @param employeeDesignationId the employee designation ID of this candidate
*/
@Override
public void setEmployeeDesignationId(long employeeDesignationId) {
_candidate.setEmployeeDesignationId(employeeDesignationId);
}
/**
* Returns the title of this candidate.
*
* @return the title of this candidate
*/
@Override
public java.lang.String getTitle() {
return _candidate.getTitle();
}
/**
* Sets the title of this candidate.
*
* @param title the title of this candidate
*/
@Override
public void setTitle(java.lang.String title) {
_candidate.setTitle(title);
}
/**
* Returns the first name of this candidate.
*
* @return the first name of this candidate
*/
@Override
public java.lang.String getFirstName() {
return _candidate.getFirstName();
}
/**
* Sets the first name of this candidate.
*
* @param firstName the first name of this candidate
*/
@Override
public void setFirstName(java.lang.String firstName) {
_candidate.setFirstName(firstName);
}
/**
* Returns the middle name of this candidate.
*
* @return the middle name of this candidate
*/
@Override
public java.lang.String getMiddleName() {
return _candidate.getMiddleName();
}
/**
* Sets the middle name of this candidate.
*
* @param middleName the middle name of this candidate
*/
@Override
public void setMiddleName(java.lang.String middleName) {
_candidate.setMiddleName(middleName);
}
/**
* Returns the last name of this candidate.
*
* @return the last name of this candidate
*/
@Override
public java.lang.String getLastName() {
return _candidate.getLastName();
}
/**
* Sets the last name of this candidate.
*
* @param lastName the last name of this candidate
*/
@Override
public void setLastName(java.lang.String lastName) {
_candidate.setLastName(lastName);
}
/**
* Returns the date of birth of this candidate.
*
* @return the date of birth of this candidate
*/
@Override
public java.util.Date getDateOfBirth() {
return _candidate.getDateOfBirth();
}
/**
* Sets the date of birth of this candidate.
*
* @param dateOfBirth the date of birth of this candidate
*/
@Override
public void setDateOfBirth(java.util.Date dateOfBirth) {
_candidate.setDateOfBirth(dateOfBirth);
}
/**
* Returns the nationality of this candidate.
*
* @return the nationality of this candidate
*/
@Override
public java.lang.String getNationality() {
return _candidate.getNationality();
}
/**
* Sets the nationality of this candidate.
*
* @param nationality the nationality of this candidate
*/
@Override
public void setNationality(java.lang.String nationality) {
_candidate.setNationality(nationality);
}
/**
* Returns the marital status of this candidate.
*
* @return the marital status of this candidate
*/
@Override
public int getMaritalStatus() {
return _candidate.getMaritalStatus();
}
/**
* Sets the marital status of this candidate.
*
* @param maritalStatus the marital status of this candidate
*/
@Override
public void setMaritalStatus(int maritalStatus) {
_candidate.setMaritalStatus(maritalStatus);
}
/**
* Returns the street1 of this candidate.
*
* @return the street1 of this candidate
*/
@Override
public java.lang.String getStreet1() {
return _candidate.getStreet1();
}
/**
* Sets the street1 of this candidate.
*
* @param street1 the street1 of this candidate
*/
@Override
public void setStreet1(java.lang.String street1) {
_candidate.setStreet1(street1);
}
/**
* Returns the street2 of this candidate.
*
* @return the street2 of this candidate
*/
@Override
public java.lang.String getStreet2() {
return _candidate.getStreet2();
}
/**
* Sets the street2 of this candidate.
*
* @param street2 the street2 of this candidate
*/
@Override
public void setStreet2(java.lang.String street2) {
_candidate.setStreet2(street2);
}
/**
* Returns the street3 of this candidate.
*
* @return the street3 of this candidate
*/
@Override
public java.lang.String getStreet3() {
return _candidate.getStreet3();
}
/**
* Sets the street3 of this candidate.
*
* @param street3 the street3 of this candidate
*/
@Override
public void setStreet3(java.lang.String street3) {
_candidate.setStreet3(street3);
}
/**
* Returns the city of this candidate.
*
* @return the city of this candidate
*/
@Override
public java.lang.String getCity() {
return _candidate.getCity();
}
/**
* Sets the city of this candidate.
*
* @param city the city of this candidate
*/
@Override
public void setCity(java.lang.String city) {
_candidate.setCity(city);
}
/**
* Returns the zip of this candidate.
*
* @return the zip of this candidate
*/
@Override
public long getZip() {
return _candidate.getZip();
}
/**
* Sets the zip of this candidate.
*
* @param zip the zip of this candidate
*/
@Override
public void setZip(long zip) {
_candidate.setZip(zip);
}
/**
* Returns the country ID of this candidate.
*
* @return the country ID of this candidate
*/
@Override
public long getCountryId() {
return _candidate.getCountryId();
}
/**
* Sets the country ID of this candidate.
*
* @param countryId the country ID of this candidate
*/
@Override
public void setCountryId(long countryId) {
_candidate.setCountryId(countryId);
}
/**
* Returns the personal email of this candidate.
*
* @return the personal email of this candidate
*/
@Override
public java.lang.String getPersonalEmail() {
return _candidate.getPersonalEmail();
}
/**
* Sets the personal email of this candidate.
*
* @param personalEmail the personal email of this candidate
*/
@Override
public void setPersonalEmail(java.lang.String personalEmail) {
_candidate.setPersonalEmail(personalEmail);
}
/**
* Returns the current ctc of this candidate.
*
* @return the current ctc of this candidate
*/
@Override
public long getCurrentCtc() {
return _candidate.getCurrentCtc();
}
/**
* Sets the current ctc of this candidate.
*
* @param currentCtc the current ctc of this candidate
*/
@Override
public void setCurrentCtc(long currentCtc) {
_candidate.setCurrentCtc(currentCtc);
}
/**
* Returns the expected ctc of this candidate.
*
* @return the expected ctc of this candidate
*/
@Override
public long getExpectedCtc() {
return _candidate.getExpectedCtc();
}
/**
* Sets the expected ctc of this candidate.
*
* @param expectedCtc the expected ctc of this candidate
*/
@Override
public void setExpectedCtc(long expectedCtc) {
_candidate.setExpectedCtc(expectedCtc);
}
/**
* Returns the notice period of this candidate.
*
* @return the notice period of this candidate
*/
@Override
public java.lang.String getNoticePeriod() {
return _candidate.getNoticePeriod();
}
/**
* Sets the notice period of this candidate.
*
* @param noticePeriod the notice period of this candidate
*/
@Override
public void setNoticePeriod(java.lang.String noticePeriod) {
_candidate.setNoticePeriod(noticePeriod);
}
/**
* Returns the resume ID of this candidate.
*
* @return the resume ID of this candidate
*/
@Override
public long getResumeId() {
return _candidate.getResumeId();
}
/**
* Sets the resume ID of this candidate.
*
* @param resumeId the resume ID of this candidate
*/
@Override
public void setResumeId(long resumeId) {
_candidate.setResumeId(resumeId);
}
/**
* Returns the resume path of this candidate.
*
* @return the resume path of this candidate
*/
@Override
public java.lang.String getResumePath() {
return _candidate.getResumePath();
}
/**
* Sets the resume path of this candidate.
*
* @param resumePath the resume path of this candidate
*/
@Override
public void setResumePath(java.lang.String resumePath) {
_candidate.setResumePath(resumePath);
}
/**
* Returns the employee proof ID of this candidate.
*
* @return the employee proof ID of this candidate
*/
@Override
public long getEmployeeProofId() {
return _candidate.getEmployeeProofId();
}
/**
* Sets the employee proof ID of this candidate.
*
* @param employeeProofId the employee proof ID of this candidate
*/
@Override
public void setEmployeeProofId(long employeeProofId) {
_candidate.setEmployeeProofId(employeeProofId);
}
/**
* Returns the proof number of this candidate.
*
* @return the proof number of this candidate
*/
@Override
public java.lang.String getProofNumber() {
return _candidate.getProofNumber();
}
/**
* Sets the proof number of this candidate.
*
* @param proofNumber the proof number of this candidate
*/
@Override
public void setProofNumber(java.lang.String proofNumber) {
_candidate.setProofNumber(proofNumber);
}
/**
* Returns the gender of this candidate.
*
* @return the gender of this candidate
*/
@Override
public int getGender() {
return _candidate.getGender();
}
/**
* Sets the gender of this candidate.
*
* @param gender the gender of this candidate
*/
@Override
public void setGender(int gender) {
_candidate.setGender(gender);
}
/**
* Returns the status of this candidate.
*
* @return the status of this candidate
*/
@Override
public boolean getStatus() {
return _candidate.getStatus();
}
/**
* Returns <code>true</code> if this candidate is status.
*
* @return <code>true</code> if this candidate is status; <code>false</code> otherwise
*/
@Override
public boolean isStatus() {
return _candidate.isStatus();
}
/**
* Sets whether this candidate is status.
*
* @param status the status of this candidate
*/
@Override
public void setStatus(boolean status) {
_candidate.setStatus(status);
}
/**
* Returns the short listed of this candidate.
*
* @return the short listed of this candidate
*/
@Override
public boolean getShortListed() {
return _candidate.getShortListed();
}
/**
* Returns <code>true</code> if this candidate is short listed.
*
* @return <code>true</code> if this candidate is short listed; <code>false</code> otherwise
*/
@Override
public boolean isShortListed() {
return _candidate.isShortListed();
}
/**
* Sets whether this candidate is short listed.
*
* @param shortListed the short listed of this candidate
*/
@Override
public void setShortListed(boolean shortListed) {
_candidate.setShortListed(shortListed);
}
/**
* Returns the create date of this candidate.
*
* @return the create date of this candidate
*/
@Override
public java.util.Date getCreateDate() {
return _candidate.getCreateDate();
}
/**
* Sets the create date of this candidate.
*
* @param createDate the create date of this candidate
*/
@Override
public void setCreateDate(java.util.Date createDate) {
_candidate.setCreateDate(createDate);
}
/**
* Returns the modified date of this candidate.
*
* @return the modified date of this candidate
*/
@Override
public java.util.Date getModifiedDate() {
return _candidate.getModifiedDate();
}
/**
* Sets the modified date of this candidate.
*
* @param modifiedDate the modified date of this candidate
*/
@Override
public void setModifiedDate(java.util.Date modifiedDate) {
_candidate.setModifiedDate(modifiedDate);
}
/**
* Returns the create by of this candidate.
*
* @return the create by of this candidate
*/
@Override
public long getCreateBy() {
return _candidate.getCreateBy();
}
/**
* Sets the create by of this candidate.
*
* @param createBy the create by of this candidate
*/
@Override
public void setCreateBy(long createBy) {
_candidate.setCreateBy(createBy);
}
/**
* Returns the modified by of this candidate.
*
* @return the modified by of this candidate
*/
@Override
public long getModifiedBy() {
return _candidate.getModifiedBy();
}
/**
* Sets the modified by of this candidate.
*
* @param modifiedBy the modified by of this candidate
*/
@Override
public void setModifiedBy(long modifiedBy) {
_candidate.setModifiedBy(modifiedBy);
}
@Override
public boolean isNew() {
return _candidate.isNew();
}
@Override
public void setNew(boolean n) {
_candidate.setNew(n);
}
@Override
public boolean isCachedModel() {
return _candidate.isCachedModel();
}
@Override
public void setCachedModel(boolean cachedModel) {
_candidate.setCachedModel(cachedModel);
}
@Override
public boolean isEscapedModel() {
return _candidate.isEscapedModel();
}
@Override
public java.io.Serializable getPrimaryKeyObj() {
return _candidate.getPrimaryKeyObj();
}
@Override
public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
_candidate.setPrimaryKeyObj(primaryKeyObj);
}
@Override
public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() {
return _candidate.getExpandoBridge();
}
@Override
public void setExpandoBridgeAttributes(
com.liferay.portal.model.BaseModel<?> baseModel) {
_candidate.setExpandoBridgeAttributes(baseModel);
}
@Override
public void setExpandoBridgeAttributes(
com.liferay.portlet.expando.model.ExpandoBridge expandoBridge) {
_candidate.setExpandoBridgeAttributes(expandoBridge);
}
@Override
public void setExpandoBridgeAttributes(
com.liferay.portal.service.ServiceContext serviceContext) {
_candidate.setExpandoBridgeAttributes(serviceContext);
}
@Override
public java.lang.Object clone() {
return new CandidateWrapper((Candidate)_candidate.clone());
}
@Override
public int compareTo(com.hrms.model.Candidate candidate) {
return _candidate.compareTo(candidate);
}
@Override
public int hashCode() {
return _candidate.hashCode();
}
@Override
public com.liferay.portal.model.CacheModel<com.hrms.model.Candidate> toCacheModel() {
return _candidate.toCacheModel();
}
@Override
public com.hrms.model.Candidate toEscapedModel() {
return new CandidateWrapper(_candidate.toEscapedModel());
}
@Override
public com.hrms.model.Candidate toUnescapedModel() {
return new CandidateWrapper(_candidate.toUnescapedModel());
}
@Override
public java.lang.String toString() {
return _candidate.toString();
}
@Override
public java.lang.String toXmlString() {
return _candidate.toXmlString();
}
@Override
public void persist()
throws com.liferay.portal.kernel.exception.SystemException {
_candidate.persist();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof CandidateWrapper)) {
return false;
}
CandidateWrapper candidateWrapper = (CandidateWrapper)obj;
if (Validator.equals(_candidate, candidateWrapper._candidate)) {
return true;
}
return false;
}
/**
* @deprecated As of 6.1.0, replaced by {@link #getWrappedModel}
*/
public Candidate getWrappedCandidate() {
return _candidate;
}
@Override
public Candidate getWrappedModel() {
return _candidate;
}
@Override
public void resetOriginalValues() {
_candidate.resetOriginalValues();
}
private Candidate _candidate;
} | [
"yashpalsinh.vala@azilen.com"
] | yashpalsinh.vala@azilen.com |
9cb546b6559d38b3a34e57c1f8168259c3e6ec75 | 05948ca1cd3c0d2bcd65056d691c4d1b2e795318 | /classes2/com/xiaoenai/app/d/l.java | 3767ca20bb28ef92ffed7bf2450776aba5091446 | [] | no_license | waterwitness/xiaoenai | 356a1163f422c882cabe57c0cd3427e0600ff136 | d24c4d457d6ea9281a8a789bc3a29905b06002c6 | refs/heads/master | 2021-01-10T22:14:17.059983 | 2016-10-08T08:39:11 | 2016-10-08T08:39:11 | 70,317,042 | 0 | 8 | null | null | null | null | UTF-8 | Java | false | false | 1,547 | java | package com.xiaoenai.app.d;
import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import com.xiaoenai.app.classes.gameCenter.model.GameEntry;
import com.xiaoenai.app.utils.f.a;
class l
implements Runnable
{
l(k paramk, GameEntry paramGameEntry) {}
public void run()
{
SQLiteDatabase localSQLiteDatabase = this.b.getWritableDatabase();
ContentValues localContentValues = new ContentValues();
localContentValues.put("id", Integer.valueOf(this.a.getId()));
localContentValues.put("name", this.a.getName());
localContentValues.put("appKey", this.a.getAppKey());
localContentValues.put("intro", this.a.getIntro());
localContentValues.put("icon_url", this.a.getIcon_url());
localContentValues.put("package", this.a.getMpackage());
localContentValues.put("start_type", Integer.valueOf(this.a.getStartType()));
localContentValues.put("login_url", this.a.getLoginUrl());
if (this.a.getId() != -1)
{
a.c("更新: messageId{}", new Object[] { Integer.valueOf(this.a.getId()) });
localSQLiteDatabase.update("gamelist", localContentValues, "id=?", new String[] { String.valueOf(this.a.getId()) });
}
for (;;)
{
localSQLiteDatabase.close();
return;
a.c("插入", new Object[0]);
localSQLiteDatabase.insert("gamelist", null, localContentValues);
}
}
}
/* Location: E:\apk\xiaoenai2\classes2-dex2jar.jar!\com\xiaoenai\app\d\l.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"1776098770@qq.com"
] | 1776098770@qq.com |
d9aa8b4c2e3c60e78cb41fbe505d1129a7fa8b56 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/main/java/org/gradle/test/performancenull_12/Productionnull_1102.java | c369e046db485b277cab4a0c7fc15d42a14342a9 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 585 | java | package org.gradle.test.performancenull_12;
public class Productionnull_1102 {
private final String property;
public Productionnull_1102(String param) {
this.property = param;
}
public String getProperty() {
return property;
}
private String prop0;
public String getProp0() {
return prop0;
}
public void setProp0(String value) {
prop0 = value;
}
private String prop1;
public String getProp1() {
return prop1;
}
public void setProp1(String value) {
prop1 = value;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
782aa9387d948d90c87408e8d5b6a0bd4e50f1cd | 3cab08c3eb19a76b869523b96d2f27fa7d259e56 | /Mp3App/app/src/main/java/com/example/mp3app/Controller/Adapter/BannerAdapter.java | fc1319001f22703d02e55ad6bfa7a576d389ced2 | [] | no_license | leequada/AppMp3 | 064bcea3880065dbec46796272a07009d9122805 | f39ea44f38f66e1616da8bc25fe858ae2dcef5ed | refs/heads/main | 2023-06-21T18:25:09.544746 | 2021-07-14T17:41:20 | 2021-07-14T17:41:20 | 386,025,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,474 | java | package com.example.mp3app.Controller.Adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.viewpager.widget.PagerAdapter;
import com.example.mp3app.Model.Quangcao;
import com.example.mp3app.R;
import com.example.mp3app.View.BannertoSongActivity;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.zip.Inflater;
public class BannerAdapter extends PagerAdapter {
TextView namesong , descreption;
Context context;
ArrayList<Quangcao> qc;
public BannerAdapter(Context context, ArrayList<Quangcao> qc) {
this.context = context;
this.qc = qc;
}
@Override
public int getCount() {
return qc.size();
}
@Override
public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
return view == object;
}
@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, final int position) {
LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.temp_banner_fragment,null);
ImageView imgbackgroundbanner = view.findViewById(R.id.imgviewbackgroundbanner);
ImageView imgsongbanner = view.findViewById(R.id.imgviewBanner);
namesong = (TextView) view.findViewById(R.id.TitleBanner);
descreption = (TextView) view.findViewById(R.id.contentBanner);
Picasso.with(context).load(qc.get(position).getImage()).into(imgbackgroundbanner);
Picasso.with(context).load(qc.get(position).getImagesong()).into(imgsongbanner);
namesong.setText(qc.get(position).getNamesong());
descreption.setText(qc.get(position).getContent());
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, BannertoSongActivity.class);
intent.putExtra("Banner", qc.get(position));
context.startActivity(intent);
}
});
container.addView(view);
return view;
}
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
container.removeView((View) object);
}
}
| [
"54482872+leequada@users.noreply.github.com"
] | 54482872+leequada@users.noreply.github.com |
f9b4ae6982005d76e4bf105c375ead1e0e849e50 | 2cd36d65162c4a8c1351915af4651cbf27cb51f7 | /src/main/java/org/giavacms/vertxjpars/common/AbstractServiceRs.java | 4ccbea9c6dc2a92bd89a48534421f7e08cb1509c | [] | no_license | fiorenzino/vertx-jpa-rs | 834c393efd7835f5a477be3a3070ad2617906d56 | 9a19d87dd311f4e8dad170d60012d464b4f571b0 | refs/heads/master | 2021-01-12T12:47:02.977114 | 2016-10-03T09:56:26 | 2016-10-03T09:56:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,161 | java | package org.giavacms.vertxjpars.common;
import io.vertx.core.*;
import io.vertx.core.http.HttpServer;
import io.vertx.core.http.HttpServerResponse;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.RoutingContext;
/**
* Created by fiorenzo on 03/06/16.
*/
abstract public class AbstractServiceRs extends AbstractVerticle
{
protected Logger logger = LoggerFactory.getLogger(getClass());
protected Router router;
protected String path;
public AbstractServiceRs(Router router, Vertx vertx, String path) {
this.router = router;
this.vertx = vertx;
this.path = path;
}
public AbstractServiceRs() {
}
@Override
public void start(Future<Void> startFuture) throws Exception {
logger.info("start " + getClass().getSimpleName());
startWebApp((start) -> {
if (start.succeeded()) {
completeStartup(start, startFuture);
} else {
logger.error("error - startWebApp: " + start.cause().getMessage());
}
});
}
protected void completeStartup(AsyncResult<HttpServer> http, Future<Void> fut) {
if (http.succeeded()) {
logger.info(getClass().getSimpleName() + " Application started");
fut.complete();
} else {
fut.fail(http.cause());
}
}
protected abstract void startWebApp(Handler<AsyncResult<HttpServer>> next);
protected void end404(RoutingContext routingContext, String msg) {
HttpServerResponse response = routingContext.response()
.setStatusCode(404).setStatusMessage("ERROR CONTEXT: " + msg);
allowOrigin(routingContext, response)
.end();
}
protected HttpServerResponse allowOrigin(RoutingContext routingContext, HttpServerResponse response) {
if (routingContext.request().getHeader("Origin") != null) {
response.putHeader("Access-Control-Allow-Origin",
routingContext.request().getHeader("Origin"));
}
return response;
}
}
| [
"fiorenzino@gmail.com"
] | fiorenzino@gmail.com |
460b8251279520b2e4d176a4bb180d70c081a02d | 659de79fc65a96979841c391290af89780fead96 | /src/main/java/dzien5/Zad89.java | 1af42ca56987912431861006c3b94d48855ad8ae | [] | no_license | olszewskimichal/javaFromBeginnings | 183bba52ae6442df3fc9e25605918d586190e4e1 | c02f7fb8b7dcb01595bfa66a3ebade9ff814b6ad | refs/heads/master | 2020-04-11T00:18:21.552579 | 2019-01-14T17:51:19 | 2019-01-14T17:51:19 | 161,382,680 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 414 | java | package dzien5;
import java.math.BigInteger;
public class Zad89 {
private static BigInteger silnia(long val) {
BigInteger bigInteger = BigInteger.ONE;
for (int i = 1; i <= val; i++) {
bigInteger = bigInteger.multiply(BigInteger.valueOf(i));
}
return bigInteger;
}
public static void main(String[] args) {
System.out.println(silnia(5));
System.out.println(silnia(10));
}
}
| [
"olszewskimichal@outlook.com"
] | olszewskimichal@outlook.com |
ae3677b80e92bda260526d5cc64a5c2cb04f4f6c | 821a833e84cb62dfb86449f2c2abf8a97f99dadb | /hrm/src/main/java/com/kakarote/hrm/entity/VO/QueryInItConfigVO.java | a611b6cb7ad90ee6a49d1abbe4546754bdd63b1d | [] | no_license | jack2572/72crm-11.0-Spring | 59f6c25458ab1a02066cb1b8e3ed0ca0557d1c02 | 1fa4ec2fdf727111eca73ef4c94dfbb7712c83bb | refs/heads/master | 2023-07-27T16:33:02.173645 | 2021-08-27T10:21:39 | 2021-08-27T10:21:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 447 | java | package com.kakarote.hrm.entity.VO;
import com.kakarote.hrm.entity.PO.HrmSalaryConfig;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import java.util.Map;
@Getter
@Setter
public class QueryInItConfigVO {
@ApiModelProperty("其他初始化配置")
private HrmSalaryConfig otherInitConfig;
@ApiModelProperty("状态初始化配置")
private Map<Integer,Integer> statusInitConfig;
}
| [
"banma@5kcrm.com"
] | banma@5kcrm.com |
713fb7f1fe0fadbf49c044b8a0364fda4c2bec30 | 34cadb91192497bc3e18810bb10a40ae312a2d90 | /src/test/java/org/ghc/tests/pages/KPAUIAccountPreferencesTests.java | 31b4fe77339a1e394be380b4dc521ed50fbc0d37 | [] | no_license | kfrankgh/kp-webtest | 5659659b0b6987cb17b5773ba8fc6d72bb0cff4e | 4653675bff6459a18ce20a99d20ec3d676f4b6d6 | refs/heads/master | 2020-03-09T00:38:48.507056 | 2018-04-07T03:40:25 | 2018-04-07T03:40:25 | 128,493,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,436 | java | package org.ghc.tests.pages;
import org.ghc.pages.KPAUIAccountAndPreferencesPage;
import org.ghc.utils.extensions.KPAUIEveryTest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
import static org.ghc.utils.KPAUICredentials.accountName.EVERYTHING;
import static org.ghc.utils.helpers.KPAUITestHelper.*;
import static org.testng.Assert.*;
import static org.testng.Assert.assertEquals;
public class KPAUIAccountPreferencesTests extends KPAUIEveryTest {
private KPAUIAccountAndPreferencesPage accountAndPreferencesPage;
@BeforeMethod(alwaysRun = true)
public void beforeTest(Method method) {
accountAndPreferencesPage = super.initializeTest(method)
.signIn(EVERYTHING)
.openMedicalRecordsShade()
.openAccountAndPreferencesPage();
}
//------------------------------------------------------------------------------------------------------------------
@Test(description = "Verify Kaiser Permanente Member Services link opens the KP Member Services Page", groups = {"qa", "prod"})
public void validateKPMemberServicesLinkClick() {
accountAndPreferencesPage.openMemberServicesLink();
}
@Test(description = "Verify Washington Healthplanfinder link opens the WA Healthplanfinder Page", groups = {"qa", "prod"})
public void validateWAHealthPlanFinderLinkClick() {
accountAndPreferencesPage.openWaHealthPlanFinderLink();
}
@Test(description = "Verify 'follow these steps' link opens the Changing your status page", groups = {"qa", "prod"})
public void validateFollowTheseStepsLinkClick() {
accountAndPreferencesPage.openFollowTheseStepsLink();
}
@Test(description = "Verify Privacy Policy link opens the Privacy Policy page", groups = {"qa", "prod"})
public void validatePrivacyPolicyLinkClick() {
accountAndPreferencesPage.openPrivacyPolicyLink();
}
@Test(description = "Verify Member ID is correct", groups = {"qa", "prod"})
public void validateMemberId() {
String actualId = accountAndPreferencesPage.getMemberIdString();
String expectedId = EVERYTHING.getID();
assertEquals(expectedId, actualId);
}
@Test(description = "Verify Member Info fields are populated", groups = {"smoke", "qa", "prod"})
public void verifyMemberInfoFieldsArePopulated() {
assertNotNull(accountAndPreferencesPage.getNameField().getText(), "Name Field is empty.");
assertNotNull(accountAndPreferencesPage.getMailingAddressField().getText(),
"Mailing Address field is empty.");
assertNotNull(accountAndPreferencesPage.getResidentialAddressField().getText(),
"Residential Address field is empty.");
assertNotNull(accountAndPreferencesPage.getPrimaryPhoneField().getText(),
"Primary Phone field is empty.");
String lastUpdatedOnText = "^Last updated on \\d{2}/\\d{2}/\\d{4}$";
assertTrue(accountAndPreferencesPage.getLastUpdatedOnField().getText().matches(lastUpdatedOnText),
errorMsg(lastUpdatedOnText, accountAndPreferencesPage.getLastUpdatedOnField().getText()));
assertTrue(accountAndPreferencesPage.getLastUpdatedOnField().getText().matches(lastUpdatedOnText),
errorMsg("lastupdated", accountAndPreferencesPage.getLastUpdatedOnField().getText()));
}
} | [
"kfrankgm@gmail.com"
] | kfrankgm@gmail.com |
9214d7c9ac0874c571afe52c10b140bd8958701e | 301c7c03f64c9e096fa4d5680410b0b2338c4dac | /src/main/java/com/user/role/controller/UserRollController.java | add7d6a99244d940ccd516327c226b81c95058dc | [] | no_license | harshadak2805/ServerSide | 9d3bd83008d1e8e11fd1dc2a7bca814af33ca5af | 2e99dab4d7bc569b16a38b64b6f3190d97f62076 | refs/heads/master | 2020-08-20T10:01:49.598407 | 2019-10-18T11:34:36 | 2019-10-18T11:34:36 | 216,009,871 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,787 | java | package com.user.role.controller;
import java.util.List;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.user.role.model.User;
import com.user.role.model.UserRoll;
import com.user.role.service.UserRollService;
import ch.qos.logback.classic.Logger;
/**
*
* @author Laxman.Nikam
* userRoll Controller
*/
@RestController
@RequestMapping(value = "/userRoll")
public class UserRollController {
@Autowired
UserRollService userRollService;
private static final Logger logger = (Logger) LoggerFactory.getLogger(UserRollController.class);
/**
*
* @author Laxman.Nikam
* @throws RecordNotFoundException
* @return UserRoll List Details
*/
@GetMapping("/getAllUserRoll")
public ResponseEntity<List<UserRoll>> getAllUserRoll() {
logger.info("getAllUserRoll API called");
return new ResponseEntity<List<UserRoll>>(userRollService.getAllUserRoll(), new HttpHeaders(), HttpStatus.OK);
}
/**
*
* @author Laxman.Nikam
* @param userRoll
* @throws RecordNotFoundException
* @return
*/
@PostMapping("/createRole")
public ResponseEntity<UserRoll> createRole(@RequestBody UserRoll userRoll) {
logger.info("crate Role API called");
return new ResponseEntity<UserRoll>(userRollService.createRole(userRoll), new HttpHeaders(), HttpStatus.OK);
}
}
| [
"harshada.kudale@harbingergroup.com"
] | harshada.kudale@harbingergroup.com |
0acfc7df87f8316604a557ff0510fc7098cd0ef1 | d9a009f6878c0d3b90c9546c1e0e01ad4aa310e5 | /src/vo/Student.java | 341703d499bfb159e4c8cddb712214bcc5391553 | [] | no_license | liujianping0329/leetCode | 7c659fd86f18649f6cb2157711b88cf40d81a864 | 00d1456f47b7cab8a4588fc6cf44a714d65316d7 | refs/heads/master | 2023-05-03T10:34:17.806766 | 2023-04-29T09:04:08 | 2023-04-29T09:04:08 | 167,491,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 119 | java | package vo;
public class Student {
public int age;
public Student(int age) {
this.age = age;
}
}
| [
"ljp@ifourthwall.com"
] | ljp@ifourthwall.com |
a9681df0358527532432bd5a8fb2a74bdbdd112a | 1dcab9d37bf70728a2b2eee25c02a5a30e4f438b | /modules/iam-access-groups/src/test/java/com/ibm/cloud/platform_services/iam_access_groups/v2/model/UpdateAccountSettingsOptionsTest.java | 50bbabdc4ff953114d254b85d2469a6518e8c998 | [
"Apache-2.0"
] | permissive | carecarestinga/platform-services-java-sdk | 74cff402f72c8fa78310a3eeb19bc49b497948df | 124e0b4f7b468e8e8362376c8bad35067c39bd6c | refs/heads/master | 2022-12-06T21:58:53.188976 | 2020-08-31T22:19:54 | 2020-08-31T22:19:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,125 | java | /*
* (C) Copyright IBM Corp. 2020.
*
* 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.ibm.cloud.platform_services.iam_access_groups.v2.model;
import com.ibm.cloud.platform_services.iam_access_groups.v2.model.UpdateAccountSettingsOptions;
import com.ibm.cloud.platform_services.iam_access_groups.v2.utils.TestUtilities;
import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
/**
* Unit test class for the UpdateAccountSettingsOptions model.
*/
public class UpdateAccountSettingsOptionsTest {
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
final List<FileWithMetadata> mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata();
@Test
public void testUpdateAccountSettingsOptions() throws Throwable {
UpdateAccountSettingsOptions updateAccountSettingsOptionsModel = new UpdateAccountSettingsOptions.Builder()
.accountId("testString")
.publicAccessEnabled(true)
.transactionId("testString")
.build();
assertEquals(updateAccountSettingsOptionsModel.accountId(), "testString");
assertEquals(updateAccountSettingsOptionsModel.publicAccessEnabled(), Boolean.valueOf(true));
assertEquals(updateAccountSettingsOptionsModel.transactionId(), "testString");
}
@Test(expectedExceptions = IllegalArgumentException.class)
public void testUpdateAccountSettingsOptionsError() throws Throwable {
new UpdateAccountSettingsOptions.Builder().build();
}
} | [
"noreply@github.com"
] | carecarestinga.noreply@github.com |
d70ad991a0dadebb4532aa0b1d13168af4e4eb00 | 120db99aa3f3d817ea575e3acb206c7ddf5c1287 | /jthinker/src/oss/jthinker/widgets/JLink.java | 0845c544438c99251a5a54b1f27e0a26ae0402f4 | [] | no_license | ShakirrIsmail/jthinker | e1a0312783ba733e131eaa022987361fae1278b2 | a6029cb24ba028dd3861d2f1fc6c173501f7b9e5 | refs/heads/master | 2021-01-21T10:38:43.096657 | 2010-12-01T20:09:06 | 2010-12-01T20:09:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,601 | java | /*
* Copyright (c) 2008, Ivan Appel <ivan.appel@gmail.com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of Ivan Appel nor the names of any other jThinker
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package oss.jthinker.widgets;
import oss.jthinker.swingutils.WindowUtils;
import java.awt.Color;
import java.awt.Component;
import java.awt.Point;
import oss.jthinker.swingutils.ComponentLocationTrigger;
import oss.jthinker.swingutils.MouseLocator;
import oss.jthinker.util.IgnoreMixer;
import oss.jthinker.util.MixedQuadripoleTrigger;
import oss.jthinker.util.Mixer;
import oss.jthinker.util.QuadripoleTrigger;
import oss.jthinker.util.QuadripoleTriggerListener;
import oss.jthinker.util.Trigger;
/**
* A connection between a {@see JNode} and something else, used as a
* base superclass for {@see JEdge} and {@see JLeg}.
*
* @author iappel
* @param T type of the object on connection's end.
*/
public class JLink<T extends Component> extends JLine implements QuadripoleTriggerListener<Point> {
private final JNode peerA;
private final T peerZ;
private boolean switchState;
protected JLink(JNode peerA, boolean arrow) {
super(arrow);
this.peerA = peerA;
peerZ = null;
}
protected JLink(JNode peerA, T peerZ, boolean arrow) {
super(arrow);
this.peerA = peerA;
this.peerZ = peerZ;
}
/**
* Returns a node, on which edge starts.
*
* @return a node, on which edge starts.
*/
public JNode getPeerA() {
return peerA;
}
/**
* Returns a component, on which edge ends.
*
* @return a component, on which edge ends.
*/
public T getPeerZ() {
return peerZ;
}
/** {@inheritDoc} */
public void setSwitched(boolean switching) {
setForeground(switching ? Color.BLUE : WindowUtils.getDefaultForeground());
switchState = switching;
}
/**
* Checks, where mouse pointer is and switches component accordingly.
* Mouse pointer's near location is treated as one being not further
* than five pixels away from the line.
*
* @param p location of the mouse pointer
*/
public void switchOnMouseMove(Point p) {
setSwitched(distanceToPoint(p) < 5.0);
}
/** {@inheritDoc} */
public boolean isSwitched() {
return switchState;
}
public void leftStateChanged(Point event) {
setEndA(event);
}
public void rightStateChanged(Point event) {
setEndZ(event);
}
protected void setupEvents() {
Trigger<Point> ta = new ComponentLocationTrigger(peerA);
Trigger<Point> tb;
if (peerZ == null) {
tb = MouseLocator.getInstance();
} else {
tb = new ComponentLocationTrigger(peerZ);
}
Mixer<Point> mixa = new JNodeAdjuster(peerA);
Mixer<Point> mixb;
if (peerZ instanceof JNode) {
mixb = new JNodeAdjuster((JNode)peerZ);
} else {
mixb = new IgnoreMixer<Point>();
}
QuadripoleTrigger quad = new MixedQuadripoleTrigger<Point>(ta, tb, mixa, mixb);
quad.addStateConsumer(this);
}
}
| [
"ivan.appel@gmail.com"
] | ivan.appel@gmail.com |
a6af75711fb0bfdcacfcd17bb436ee0eda877112 | 3fb209a7c9d8790e694454f7fe3bf75af9c2fa41 | /old__CentralLimitApplet.java | ad1895493d941da9911186f2e3dce4b4a45a5fde | [
"Apache-2.0"
] | permissive | elonen/central-limit-demo | 0c44b0cd4bfbb859ef447621f24e5d6d76a717e7 | f58789be686b0f34edf671c3692d58a8c0001d4e | refs/heads/master | 2022-11-29T12:08:41.785009 | 2020-08-08T22:29:58 | 2020-08-08T22:52:17 | 286,089,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,787 | java | import java.awt.*;
import java.applet.*;
import java.util.*;
/**
* An applet to demostrate central limit theorem of probability.
* It utilizes an expression evaluator class by The-Son LAI.
* <p>
* The whole program is distributed under the Modified BSD
* license with the kind permission from The-Son. See below.
* <p>
* Copyright (c) 2001 by Jarno Elonen and The-Son LAI
* <p>
* http://iki.fi/elonen/, http://lts.online.fr/java/
*/
public class CentralLimitApplet extends Applet
{
/*
* The distribution licence
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. Redistributions in
* binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution. The name of the author may not
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Start the applet, create panels
*/
public void init()
{
this.setLayout( null );
// Create the parameter panel
Panel p = new Panel();
p.setLayout( new FlowLayout( FlowLayout.LEFT, 0,0 ));
p.add( new Label( "Examine sum of", Label.LEFT ));
p.add( sumOfTF );
p.add( new Label( "occurences of a" ));
p.add( new Label( "phenomenon" ));
p.add( new Label( "whose min =" ));
p.add( minTF );
p.add( new Label( "," ));
p.add( new Label( "max =" ));
p.add( maxTF );
p.add( new Label( "," ));
p.add( new Label( "prob. func. P(x)=" ));
p.add( funcTF );
p.add( new Label( "and repeat it" ));
p.add( repeatTF );
p.add( new Label( "times. " ));
p.add( goButt );
Panel p2 = new Panel( new BorderLayout());
p2.add( BorderLayout.CENTER, p );
Panel p3 = new Panel( new BorderLayout());
p3.add( BorderLayout.CENTER, goButt );
p2.add( BorderLayout.SOUTH, p3 );
add( p2 );
p2.setBounds( 0,0, 100, getSize().height );
myImg = createImage( getSize().width-100, getSize().height );
clearCanvas();
repaint();
}
/**
* Redraw the screen
*/
public void paint( Graphics g )
{
g.drawImage( myImg, 100,0, null );
}
/**
* Listen for button strokes
*/
public boolean action( Event evt, Object what )
{
if ( evt.target == goButt )
{
simulate();
repaint();
return true;
}
return false;
}
/**
* This can be called from Javascript.
* Sets the text fields and simulates a round.
*/
public void simulate( int min, int max, int sum,
int repeat, String func )
{
minTF.setText( "" + min );
maxTF.setText( "" + max );
sumOfTF.setText( "" + sum );
repeatTF.setText( "" + repeat );
funcTF.setText( func );
simulate();
repaint();
}
/**
* Paints the canvas white and draws
* black borders around it
*/
private void clearCanvas()
{
int w = myImg.getWidth(null), h = myImg.getHeight(null);
Graphics g = myImg.getGraphics();
g.setColor( Color.white );
g.fillRect( 0,0, 99999, 99999 );
g.setColor( Color.black );
g.drawRect( 0,0, w-1,h-1 );
}
/**
* Runs a simulation with given parameters
* and draws the result as a histogram to the screen.
*/
private void simulate()
{
try
{
int min = getLimited( minTF, "Min", -9999, 9999 );
int max = getLimited( maxTF, "Max", -9999, 9999 );
int sumOf = getLimited( sumOfTF, "Sum", 1, 1000 );
int repeat = getLimited( repeatTF, "Repeat count", 1, 10000000 );
if ( min >= max )
throw new Exception( "Min must be < Max." );
int totalMin = (min*sumOf);
int totalMax = (max*sumOf);
Graphics g = myImg.getGraphics();
int w = myImg.getWidth(null), h = myImg.getHeight(null);
clearCanvas();
repaint();
// Draw the scale
g.setColor( Color.black );
g.drawString( "" + totalMin, 2,h-8 );
String maxStr = "" + totalMax;
g.drawString( maxStr, w-g.getFontMetrics().stringWidth( maxStr )-2, h-8 );
String avgStr = "" + (totalMin+totalMax)/2;
g.drawString( avgStr, w/2-g.getFontMetrics().stringWidth( avgStr )/2-2, h-8 );
myEval.setExpression( funcTF.getText());
int range = max-min+1;
int totalRange = totalMax-totalMin+1;
// Calculate propabilities from the function
double fTotal = 0;
double prob[] = new double[ range ];
for ( int i=0; i<range; ++i )
{
myEval.addVariable( "x", i+min );
Double dbl = myEval.getValue();
if ( dbl == null )
throw new Exception( "Invalid function '" +
funcTF.getText() + "'" );
prob[i] = dbl.doubleValue();
fTotal += prob[i];
}
// Normalize P to 0..1
for ( int i=0; i<range; ++i )
prob[i] /= fTotal;
// Simulate the experiment
double maxFreq = 0;
double freq[] = new double[ totalRange ];
for ( int i=0; i<repeat; ++i )
{
int sum = 0;
for ( int j=0; j<sumOf; ++j )
{
double d = myRnd.nextDouble();
int k=0;
while ( d>prob[k] && k<=range )
d -= prob[k++];
sum += k;
}
freq[sum]++;
if ( freq[sum] > maxFreq )
maxFreq = freq[sum];
}
// Normalize freq to 0...1
for ( int i=0; i<totalRange; ++i )
freq[i] /= maxFreq;
// Draw the result histogram
g.setColor( Color.blue );
for ( int x=1; x<w-1; ++x )
{
int v = (int)(freq[(int)(totalRange*(double)x/w)] * (h-60));
g.drawLine( x,h-30, x,h-30-v );
}
}
catch( Exception e )
{
clearCanvas();
myImg.getGraphics().drawString( e.getMessage(), 10,20 );
}
}
/**
* Gets an integer from given TextField or throw an Exception if
* it doesn't fall into given limits or is not a number.
*/
private int getLimited( TextField tf, String name, int min, int max )
throws Exception
{
try
{
int val = Integer.parseInt( tf.getText());
if ( val < min || val > max )
throw new NumberFormatException();
return val;
}
catch( NumberFormatException nfe )
{
String msg = "'" + name + "' must be an integer between [" +
min + ", " + max +"]";
throw new Exception( msg );
}
}
private TextField
sumOfTF = new TextField( "10", 12 ),
minTF = new TextField( "1", 8 ),
maxTF = new TextField( "6", 8 ),
funcTF = new TextField( "1/6", 12 ),
repeatTF = new TextField( "10000", 12 );
private Button goButt = new Button( "Simulate" );
private Image myImg;
private MathEvaluator myEval = new MathEvaluator();
private Random myRnd = new Random();
/**
* <i>Mathematic expression evaluator.</i> Supports the following functions:
* +, -, *, /, ^, %, cos, sin, tan, acos, asin, atan, sqrt, sqr, log, min, max, ceil, floor, abs, neg, rndr.<br>
* When the getValue() is called, a Double object is returned. If it returns null, an error occured.<p>
* <pre>
* Sample:
* MathEvaluator m = new MathEvaluator("-5-6/(-2) + sqr(15+x)");
* m.addVariable("x", 15.1d);
* System.out.println( m.getValue() );
* </pre>
* Refactored slightly for smaller size by Jarno Elonen
* @version 1.1
* @author The-Son LAI, <a href="mailto:Lts@writeme.com">Lts@writeme.com</a>
* @date April 2001
**/
public static class MathEvaluator
{
protected static Operator[] operators = null;
private Node node = null;
private String expression = null;
private Hashtable variables = new Hashtable();
/***
* adds a variable and its value in the MathEvaluator
*/
public void addVariable(String v, double val)
{
variables.put(v, new Double(val));
}
/***
* sets the expression
*/
public void setExpression(String s)
{
if ( operators == null )
initializeOperators();
expression = s;
}
/***
* evaluates and returns the value of the expression
*/
public Double getValue()
{
if (expression == null) return null;
try
{
node = new Node(expression);
return evaluate(node);
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
private static Double evaluate(Node n)
{
if ( n.hasOperator() && n.hasChild() )
{
if ( n.nOperator.getType() == 1 )
n.nValue = evaluateExpression( n.nOperator, evaluate( n.nLeft ), null );
else if ( n.nOperator.getType() == 2 )
n.nValue = evaluateExpression( n.nOperator, evaluate( n.nLeft ), evaluate( n.nRight ) );
}
return n.nValue;
}
private static Double evaluateExpression(Operator o, Double f1, Double f2)
{
String op = o.getOperator();
Double res = null;
if ( "+".equals(op) ) res = new Double( f1.doubleValue() + f2.doubleValue() );
else if ( "-".equals(op) ) res = new Double( f1.doubleValue() - f2.doubleValue() );
else if ( "*".equals(op) ) res = new Double( f1.doubleValue() * f2.doubleValue() );
else if ( "/".equals(op) ) res = new Double( f1.doubleValue() / f2.doubleValue() );
else if ( "^".equals(op) ) res = new Double( Math.pow(f1.doubleValue(), f2.doubleValue()) );
else if ( "%".equals(op) ) res = new Double( f1.doubleValue() % f2.doubleValue() );
else if ( "&".equals(op) ) res = new Double( f1.doubleValue() + f2.doubleValue() ); // todo
else if ( "|".equals(op) ) res = new Double( f1.doubleValue() + f2.doubleValue() ); // todo
else if ( "cos".equals(op) ) res = new Double( Math.cos(f1.doubleValue()) );
else if ( "sin".equals(op) ) res = new Double( Math.sin(f1.doubleValue()) );
else if ( "tan".equals(op) ) res = new Double( Math.tan(f1.doubleValue()) );
else if ( "acos".equals(op) ) res = new Double( Math.acos(f1.doubleValue()) );
else if ( "asin".equals(op) ) res = new Double( Math.asin(f1.doubleValue()) );
else if ( "atan".equals(op) ) res = new Double( Math.atan(f1.doubleValue()) );
else if ( "sqr".equals(op) ) res = new Double( f1.doubleValue() * f1.doubleValue() );
else if ( "sqrt".equals(op) ) res = new Double( Math.sqrt(f1.doubleValue()) );
else if ( "log".equals(op) ) res = new Double( Math.log(f1.doubleValue()) );
else if ( "min".equals(op) ) res = new Double( Math.min(f1.doubleValue(), f2.doubleValue()) );
else if ( "max".equals(op) ) res = new Double( Math.max(f1.doubleValue(), f2.doubleValue()) );
else if ( "exp".equals(op) ) res = new Double( Math.exp(f1.doubleValue()) );
else if ( "floor".equals(op) ) res = new Double( Math.floor(f1.doubleValue()) );
else if ( "ceil".equals(op) ) res = new Double( Math.ceil(f1.doubleValue()) );
else if ( "abs".equals(op) ) res = new Double( Math.abs(f1.doubleValue()) );
else if ( "neg".equals(op) ) res = new Double( - f1.doubleValue() );
else if ( "rnd".equals(op) ) res = new Double( Math.random() * f1.doubleValue() );
return res;
}
private void initializeOperators()
{
operators = new Operator[25];
operators[0] = new Operator("+" , 2, 0);
operators[1] = new Operator("-" , 2, 0);
operators[2] = new Operator("*" , 2, 10);
operators[3] = new Operator("/" , 2, 10);
operators[4] = new Operator("^" , 2, 10);
operators[5] = new Operator("%" , 2, 10);
operators[6] = new Operator("&" , 2, 0);
operators[7] = new Operator("|" , 2, 0);
operators[8] = new Operator("cos" , 1, 20);
operators[9] = new Operator("sin" , 1, 20);
operators[10] = new Operator("tan" , 1, 20);
operators[11] = new Operator("acos" , 1, 20);
operators[12] = new Operator("asin" , 1, 20);
operators[13] = new Operator("atan" , 1, 20);
operators[14] = new Operator("sqrt" , 1, 20);
operators[15] = new Operator("sqr" , 1, 20);
operators[16] = new Operator("log" , 1, 20);
operators[17] = new Operator("min" , 2, 0);
operators[18] = new Operator("max" , 2, 0);
operators[19] = new Operator("exp" , 1, 20);
operators[20] = new Operator("floor", 1, 20);
operators[21] = new Operator("ceil" , 1, 20);
operators[22] = new Operator("abs" , 1, 20);
operators[23] = new Operator("neg" , 1, 20);
operators[24] = new Operator("rnd" , 1, 20);
}
private Double getDouble(String s)
{
if ( s == null ) return null;
Double res = null;
try {
res = Double.valueOf( s );
}
catch(Exception e) {
return (Double) variables.get(s);
}
return res;
}
protected class Operator
{
private String op;
private int type;
private int priority;
public Operator(String o, int t, int p)
{
op = o;
type = t;
priority = p;
}
public String getOperator() {
return op;
}
public void setOperator(String o) {
op = o;
}
public int getType() {
return type;
}
public int getPriority() {
return priority;
}
}
protected class Node
{
public String nString = null;
public Operator nOperator = null;
public Node nLeft = null;
public Node nRight = null;
public Node nParent = null;
public int nLevel = 0;
public Double nValue = null;
public Node(String s) throws Exception
{
init(null, s, 0);
}
public Node(Node parent, String s, int level) throws Exception
{
init(parent, s, level);
}
private void init(Node parent, String s, int level) throws Exception
{
s = removeIllegalCharacters(s);
s = removeBrackets(s);
s = addZero(s);
if ( checkBrackets(s) != 0 ) throw new Exception("Wrong number of brackets in [" + s + "]");
nParent = parent;
nString = s;
nValue = getDouble(s);
nLevel = level;
int sLength = s.length();
int inBrackets = 0;
int startOperator = 0;
for (int i=0; i<sLength; i++)
{
if ( s.charAt(i) == '(' )
inBrackets++;
else if ( s.charAt(i) == ')' )
inBrackets--;
else
{
// the expression must be at "root" level
if ( inBrackets == 0 )
{
Operator o = getOperator(nString,i);
if ( o != null )
{
// if first operator or lower priority operator
if ( nOperator == null || nOperator.getPriority() >= o.getPriority() )
{
nOperator = o;
startOperator = i;
}
}
}
}
}
if ( nOperator != null )
{
// one operand, should always be at the beginning
if ( startOperator==0 && nOperator.getType() == 1 )
{
// the brackets must be ok
if ( checkBrackets( s.substring( nOperator.getOperator().length() ) ) == 0 )
{
nLeft = new Node( this, s.substring( nOperator.getOperator().length() ) , nLevel + 1);
nRight = null;
return;
}
else
throw new Exception("Error during parsing... missing brackets in [" + s + "]");
}
// two operands
else if ( startOperator > 0 && nOperator.getType() == 2 )
{
nOperator = nOperator;
nLeft = new Node( this, s.substring(0, startOperator), nLevel + 1 );
nRight = new Node( this, s.substring(startOperator + nOperator.getOperator().length()), nLevel + 1);
}
}
}
private Operator getOperator(String s, int start)
{
String temp = s.substring(start);
temp = getNextWord(temp);
for (int i=0; i<operators.length; i++)
{
if ( temp.startsWith(operators[i].getOperator()) )
return operators[i];
}
return null;
}
private String getNextWord(String s)
{
int sLength = s.length();
for (int i=1; i<sLength; i++)
{
char c = s.charAt(i);
if ( (c > 'z' || c < 'a') && (c > '9' || c < '0') )
return s.substring(0, i);
}
return s;
}
/***
* checks if there is any missing brackets
* @return true if s is valid
*/
protected int checkBrackets(String s)
{
int sLength = s.length();
int inBracket = 0;
for (int i=0; i<sLength; i++)
{
if ( s.charAt(i) == '(' && inBracket >= 0 )
inBracket++;
else if ( s.charAt(i) == ')' )
inBracket--;
}
return inBracket;
}
/***
* returns a string that doesnt start with a + or a -
*/
protected String addZero(String s)
{
if ( s.startsWith("+") || s.startsWith("-") )
{
int sLength = s.length();
for (int i=0; i<sLength; i++)
{
if ( getOperator(s, i) != null )
return "0" + s;
}
}
return s;
}
protected boolean hasChild() {
return ( nLeft != null || nRight != null );
}
protected boolean hasOperator() {
return ( nOperator != null );
}
protected boolean hasLeft() {
return ( nLeft != null );
}
protected boolean hasRight() {
return ( nRight != null );
}
/***
* Removes spaces, tabs and brackets at the begining
*/
public String removeBrackets(String s)
{
String res = s;
if ( s.length() > 2 && res.startsWith("(") && res.endsWith(")") && checkBrackets(s.substring(1,s.length()-1)) == 0 )
{
res = res.substring(1, res.length()-1 );
}
if ( res != s )
return removeBrackets(res);
else
return res;
}
/***
* Removes illegal characters
*/
public String removeIllegalCharacters(String s)
{
char[] illegalCharacters = { ' ' };
String res = s;
for ( int j=0; j<illegalCharacters.length; j++)
{
int i = res.lastIndexOf(illegalCharacters[j], res.length());
while ( i != -1 )
{
String temp = res;
res = temp.substring(0,i);
res += temp.substring(i + 1);
i = res.lastIndexOf(illegalCharacters[j], s.length());
}
}
return res;
}
}
}
} | [
"elonen@iki.fi"
] | elonen@iki.fi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.