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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b35c6cfb9b4b90d687c317371cf5be46d7a143b6 | b7b27db54490e57bfd0f4a497970f9a606734eca | /src/java/edu/csc413/tankgame/model/Shell.java | 8dfb0c99a1d90e684c293aaf966fa233d172cae4 | [] | no_license | tadejslamic/TankGame | e04aa7a1e3f47e607fc693ab29fd49861877765e | 667ec0a08f9b113af16e2ed02273140c0a73fd00 | refs/heads/master | 2023-06-28T08:48:42.987999 | 2021-04-29T10:45:12 | 2021-04-29T10:45:12 | 393,697,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 982 | java | package edu.csc413.tankgame.model;
import edu.csc413.tankgame.Constants;
public class Shell extends Entity {
ShellState shellState = ShellState.INIT; // 0: init 1: moving 2: destroyed
String tank_id = "";
public Shell(String id, double x, double y, double angle, String tank_id) {
super(id, x, y, angle);
this.tank_id = tank_id;
shellState = ShellState.INIT;
}
@Override
public void move(GameWorld gameWorld) {
x += Constants.SHELL_MOVEMENT_SPEED * Math.cos(angle);
y += Constants.SHELL_MOVEMENT_SPEED * Math.sin(angle);
}
public void setShellState(ShellState state) {
shellState = state;
}
public ShellState getShellState() {
return shellState;
}
public String getTankID() {
return tank_id;
}
public double getXBound() {
return x + Constants.SHELL_WIDTH;
}
public double getYBound() {
return y + Constants.SHELL_HEIGHT;
}
}
| [
"jyyblue1987@outlook.com"
] | jyyblue1987@outlook.com |
f0d82d9bac462c45cc5b79356ae046b38c271001 | ffcdd8e863403b4e8cd21b03e2eb8a60844ac2db | /src/main/java/com/graabity/microservices/templates/security/JwtAuthenticationTokenFilter.java | a42703d9cf53d0d147dfb3ff5d7f4407290279a0 | [] | no_license | suman724/microservices-security | b47cb264126718b435693bbeaacb50e64c52df76 | e7b7bf6b90f6784076a128b9a21a2b72df077d6c | refs/heads/master | 2020-04-05T16:36:15.584314 | 2018-11-12T00:23:59 | 2018-11-12T00:23:59 | 157,020,226 | 1 | 0 | null | 2018-11-11T23:49:30 | 2018-11-10T20:48:03 | Java | UTF-8 | Java | false | false | 1,680 | java | package com.graabity.microservices.templates.security;
import com.graabity.microservices.templates.model.JwtAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class JwtAuthenticationTokenFilter extends AbstractAuthenticationProcessingFilter {
public JwtAuthenticationTokenFilter() {
super("/rest/**");
}
@Override
public Authentication attemptAuthentication(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws AuthenticationException, IOException, ServletException {
String header = httpServletRequest.getHeader("Authorization");
if (header == null || !header.startsWith("Bearer ")) {
throw new RuntimeException("JWT Token is missing");
}
String authenticationToken = header.substring(7);
JwtAuthenticationToken token = new JwtAuthenticationToken(authenticationToken);
return getAuthenticationManager().authenticate(token);
}
@Override
protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain, Authentication authResult) throws IOException, ServletException {
super.successfulAuthentication(request, response, chain, authResult);
chain.doFilter(request, response);
}
}
| [
"suman724@gmail.com"
] | suman724@gmail.com |
fdd0fc92bc65b7c9a8f71aa33b5cbf3aff223308 | b20343126a2a81b3992c6457fe00acd1b4113904 | /K19-Componentes-Visuais/src/br/com/k19/modelo/Curso.java | 18f2dea3db8de6200a8183e796a6ee5e55830242 | [] | no_license | paulonatan/estudo | 6b98cadbfe5806d252c05956028420203cfcbd25 | d879912516b7c269849810be650e7644016fa7e3 | refs/heads/master | 2020-06-30T15:40:50.488085 | 2019-05-05T00:55:23 | 2019-05-05T00:55:23 | 74,360,530 | 0 | 0 | null | 2016-11-21T12:23:00 | 2016-11-21T12:17:13 | null | UTF-8 | Java | false | false | 337 | java | package br.com.k19.modelo;
public class Curso {
private String nome;
private String sigla;
public String getNome(){
return this.nome;
}
public void setNome(String nome){
this.nome = nome;
}
public String getSigla(){
return this.sigla;
}
public void setSigla(String sigla){
this.sigla = sigla;
}
}
| [
"noreply@github.com"
] | paulonatan.noreply@github.com |
1bfe8e415b71c9b84ec5b24878718ac4141d314f | 1d4f59f0bf58234b7c51c3b2ae2e0d57997acab7 | /src/main/java/com/lettin/apimanager/service/impl/UserService.java | 2d3d88e623c6dc577c3bd4ca99ceaf34d8a834cf | [] | no_license | jackhuadev/api-manager | b127f6b1777871c5cf911e12c974fec0ab9fe985 | c3ef6cf6d9d4eae99ef3abaa711c820d1a63629a | refs/heads/master | 2020-03-31T12:42:25.953581 | 2018-10-11T09:49:38 | 2018-10-11T09:49:38 | 152,226,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | package com.lettin.apimanager.service.impl;
import com.lettin.apimanager.entity.User;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Random;
/**
* created by CaiBaoHong at 2018/4/18 16:08<br>
*/
@Service
public class UserService {
/**
* 模拟查询返回用户信息
* @param uname
* @return
*/
public User findUserByName(String uname){
User user = new User();
user.setUname(uname);
user.setNick(uname+"NICK");
user.setPwd("J/ms7qTJtqmysekuY8/v1TAS+VKqXdH5sB7ulXZOWho=");//密码明文是123456
user.setSalt("wxKYXuTPST5SG0jMQzVPsg==");//加密密码的盐值
user.setUid(new Random().nextLong());//随机分配一个id
user.setCreated(new Date());
return user;
}
}
| [
"964556935@qq.com"
] | 964556935@qq.com |
2ff49078a0a6481e2f0e78a734bd2e48d2993f15 | 0b12439194ae5ebd430d529087ab2bc18baae93f | /app/src/main/java/com/cs442/team_2/sudoku/game/Cell.java | 8905ef66d8b7181608e27ae83a6a3a34b1e8d37f | [] | no_license | shorabhd/Sudoku | 67e759e2ffd73ea82c09fef0feae99084ce2c515 | ccf489f42987e251d3f28d453226ab0317684fed | refs/heads/master | 2021-01-10T03:50:23.795854 | 2016-03-11T22:58:49 | 2016-03-11T22:58:49 | 53,632,097 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,869 | java | package com.cs442.team_2.sudoku.game;
import java.util.StringTokenizer;
/**
* Sudoku cell. Every cell has value, some notes attached to it and some basic
* state (whether it is editable and valid).
*/
public class Cell
{
private CellCollection mCellCollection;
private final Object mCellCollectionLock = new Object();
private int mRowIndex = -1;
private int mColumnIndex = -1;
private CellGroup mSector; // sector containing this cell
private CellGroup mRow; // row containing this cell
private CellGroup mColumn; // column containing this cell
private int mValue;
private CellNote mNote;
private boolean mEditable;
private boolean mValid;
/**
* Creates empty editable cell.
*/
public Cell() {
this(0, new CellNote(), true, true);
}
/**
* Creates empty editable cell containing given value.
*/
public Cell(int value) {
this(value, new CellNote(), true, true);
}
private Cell(int value, CellNote note, boolean editable, boolean valid) {
if (value < 0 || value > 9) {
throw new IllegalArgumentException("Value must be between 0-9.");
}
mValue = value;
mNote = note;
mEditable = editable;
mValid = valid;
}
/**
* Gets cell's row index within CellCollection.
*/
public int getRowIndex() {
return mRowIndex;
}
/**
* Gets cell's column index within CellCollection.
*/
public int getColumnIndex() {
return mColumnIndex;
}
/**
* Called when Cell is added to CellCollection.
*/
protected void initCollection(CellCollection cellCollection, int rowIndex, int colIndex,
CellGroup sector, CellGroup row, CellGroup column) {
synchronized (mCellCollectionLock) {
mCellCollection = cellCollection;
}
mRowIndex = rowIndex;
mColumnIndex = colIndex;
mSector = sector;
mRow = row;
mColumn = column;
sector.addCell(this);
row.addCell(this);
column.addCell(this);
}
/**
* Sets cell's value. Value can be 1-9 or 0 if cell should be empty.
*/
public void setValue(int value) {
if (value < 0 || value > 9) {
throw new IllegalArgumentException("Value must be between 0-9.");
}
mValue = value;
onChange();
}
/**
* Gets cell's value. Value can be 1-9 or 0 if cell is empty.
*/
public int getValue() {
return mValue;
}
/**
* Gets note attached to the cell.
*/
public CellNote getNote() {
return mNote;
}
/**
* Sets note attached to the cell
*/
public void setNote(CellNote note) {
mNote = note;
onChange();
}
/**
* Returns whether cell can be edited.
*/
public boolean isEditable() {
return mEditable;
}
/**
* Sets whether cell can be edited.
*/
public void setEditable(Boolean editable) {
mEditable = editable;
onChange();
}
/**
* Sets whether cell contains valid value according to sudoku rules.
*/
public void setValid(Boolean valid) {
mValid = valid;
onChange();
}
/**
* Returns true, if cell contains valid value according to sudoku rules.
*/
public boolean isValid() {
return mValid;
}
/**
* Creates instance from given StringTokenizer.
*/
public static Cell deserialize(StringTokenizer data) {
Cell cell = new Cell();
cell.setValue(Integer.parseInt(data.nextToken()));
cell.setNote(CellNote.deserialize(data.nextToken()));
cell.setEditable(data.nextToken().equals("1"));
return cell;
}
/**
* Appends string representation of this object to the given StringBuilder.
*/
public void serialize(StringBuilder data) {
data.append(mValue).append("|");
if (mNote == null || mNote.isEmpty()) {
data.append("-").append("|");
} else {
mNote.serialize(data);
data.append("|");
}
data.append(mEditable ? "1" : "0").append("|");
}
/**
* Notify CellCollection that something has changed.
*/
private void onChange() {
synchronized (mCellCollectionLock) {
if (mCellCollection != null) {
mCellCollection.onChange();
}
}
}
}
| [
"shorabh.dhandharia@gmail.com"
] | shorabh.dhandharia@gmail.com |
7ea8d3e3ea688fe940d14b64d65dfd12b8ce58b5 | 9379895b0255b3f0a581775288ad60030b8df037 | /app/src/main/java/ca/nait/zli/homebookkeeping/recordfrag/BaseRecordFragment.java | 437569e50f820e268d05bae5ac70b7630ac36cff | [] | no_license | Mrsix29/Home_Bookkeeping | 95c278657cde80c1495e7aefff2758f65d602aed | b0bfdf85d39dc82249e6c6d1cf8b89802b447bb9 | refs/heads/master | 2023-04-10T15:45:09.381045 | 2021-04-19T14:45:50 | 2021-04-19T14:45:50 | 359,511,579 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,595 | java | package ca.nait.zli.homebookkeeping.recordfrag;
import android.inputmethodservice.KeyboardView;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import ca.nait.zli.homebookkeeping.R;
import ca.nait.zli.homebookkeeping.db.AccountBean;
import ca.nait.zli.homebookkeeping.db.TypeBean;
import ca.nait.zli.homebookkeeping.utils.KeyBoardUtils;
import ca.nait.zli.homebookkeeping.utils.NoteDialog;
import ca.nait.zli.homebookkeeping.utils.SelectTimeDialog;
public abstract class BaseRecordFragment extends Fragment implements View.OnClickListener {
KeyboardView keyboardView;
EditText moneyEditText;
ImageView typeImageView;
TextView typeTextView,noteTextView,timeTextView;
GridView typeGridView;
List<TypeBean> typeList;
TypeBaseAdapter adapter;
AccountBean accountBean;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
accountBean = new AccountBean();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_record, container, false);
initView(view);
setInitTime();
//给GridView填充数据的方法
loadDataToGV();
setGVListener(); //设置GridView每一项的点击事件
return view;
}
// set the init time, and show it at text view
private void setInitTime() {
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String time = simpleDateFormat.format(date);
timeTextView.setText(time);
accountBean.setTime(time);
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH)+1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
accountBean.setYear(year);
accountBean.setMonth(month);
accountBean.setDay(day);
}
private void setGVListener() {
typeGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
adapter.selectPos = position;
adapter.notifyDataSetInvalidated(); //提示绘制发生变化了
TypeBean typeBean = typeList.get(position);
String typename = typeBean.getTypename();
typeTextView.setText(typename);
accountBean.setTypeName(typename);
int selectedImageId = typeBean.getSelectedImageId();
typeImageView.setImageResource(selectedImageId);
accountBean.setSelectedImageId(selectedImageId);
}
});
}
/* 给GridView填出数据的方法*/
public void loadDataToGV() {
typeList = new ArrayList<>();
adapter = new TypeBaseAdapter(getContext(), typeList);
typeGridView.setAdapter(adapter);
}
private void initView(View view) {
keyboardView = view.findViewById(R.id.fragment_record_keyboard);
moneyEditText = view.findViewById(R.id.fragment_record_edit_text_money);
typeImageView = view.findViewById(R.id.fragment_record_image_view);
typeGridView = view.findViewById(R.id.fragment_record_grid_view);
typeTextView = view.findViewById(R.id.fragment_record_text_view_type);
noteTextView = view.findViewById(R.id.fragment_record_text_view_note);
timeTextView = view.findViewById(R.id.fragment_record_text_view_time);
noteTextView.setOnClickListener(this);
timeTextView.setOnClickListener(this);
//show the customized keyboard
KeyBoardUtils boardUtils = new KeyBoardUtils(keyboardView, moneyEditText);
boardUtils.showKeyboard();
// listen the enter button
boardUtils.setOnEnsureListener(new KeyBoardUtils.OnEnsureListener() {
@Override
public void onEnsure() {
//get the money
String moneyStr = moneyEditText.getText().toString();
if (TextUtils.isEmpty(moneyStr)||moneyStr.equals("0")) {
getActivity().finish();
return;
}
float money = Float.parseFloat(moneyStr);
accountBean.setMoney(money);
//get the information and save to DB
saveAccountToDB();
// back to last activity
getActivity().finish();
}
});
}
/* Son Class will override the method*/
public abstract void saveAccountToDB();
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.fragment_record_text_view_time:
showTimeDialog();
break;
case R.id.fragment_record_text_view_note:
showNoteDialog();
break;
}
}
private void showTimeDialog() {
SelectTimeDialog dialog = new SelectTimeDialog(getContext());
dialog.show();
dialog.setOnEnsureListener(new SelectTimeDialog.OnEnsureListener() {
@Override
public void onEnsure(String time, int year, int month, int day) {
timeTextView.setText(time);
accountBean.setTime(time);
accountBean.setYear(year);
accountBean.setMonth(month);
accountBean.setDay(day);
}
});
}
public void showNoteDialog(){
final NoteDialog dialog = new NoteDialog(getContext());
dialog.show();
dialog.setDialogSize();
dialog.setOnEnsureListener(() -> {
String msg = dialog.getEditText();
if (!TextUtils.isEmpty(msg)) {
noteTextView.setText(msg);
accountBean.setNote(msg);
}
dialog.cancel();
});
}
}
| [
"michaelzongyao@gmail.com"
] | michaelzongyao@gmail.com |
4fcae8884891d093d078273719c48027cad93354 | 16bd29d56e7c722f1f5fca21626b3359a40baf36 | /arqoid/arqoid-module/src/main/java/com/hp/hpl/jena/sparql/resultset/OutputFormatter.java | 5ac3c4e44b5310be9dc254f3a21a1b33e112c55c | [
"Apache-2.0"
] | permissive | william-vw/android-reasoning | 948d6a39372e29e5eff8c4851899d4dfc986ca62 | eb1668b88207a8e3a174361562efa066f2c75978 | refs/heads/master | 2023-02-07T20:50:25.015940 | 2023-01-24T19:26:37 | 2023-01-24T19:26:37 | 138,166,750 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,345 | java | /*
* (c) Copyright 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
* All rights reserved.
* [See end of file]
*/
package com.hp.hpl.jena.sparql.resultset;
import java.io.OutputStream;
import com.hp.hpl.jena.query.ResultSet;
/**
* Interface for all formatters of result sets.
*
* @author Andy Seaborne
*/
public interface OutputFormatter
{
/** Format a result set - output on the given stream
* @param out
* @param resultSet
*/
public void format(OutputStream out, ResultSet resultSet) ;
/** Format a boolean result - output on the given stream
* @param out
* @param booleanResult
*/
public void format(OutputStream out, boolean booleanResult) ;
/** Turn into a string */
public String asString(ResultSet resultSet) ;
}
/*
* (c) Copyright 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. 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.
*/
| [
"william.van.woensel@gmail.com"
] | william.van.woensel@gmail.com |
994a308a3117af14845eb70a5bf5a5fecf111066 | edeaa1736f84118e7f9a6707ea3ed5070c2f191a | /src/com/example/CatalogSample/ListData.java | 08a713fa66ed705ce0dc4456a42870fe116bd847 | [] | no_license | PavelKarpitskiy1/CatalogSample | b36c9e38e63dc8c4389007e15d806dfef70a8379 | 7a5ffe9160fc8678536a1a39925e227d62a1efc5 | refs/heads/master | 2021-01-15T17:37:11.591542 | 2013-11-24T10:50:23 | 2013-11-24T10:50:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 716 | java | package com.example.CatalogSample;
/**
* Created with IntelliJ IDEA.
* User: Павел
* Date: 22.11.13
* Time: 15:45
* To change this template use File | Settings | File Templates.
*/
public class ListData {
String title; //Название товара
int price; //Цена товара
String url; //ссылка для загрузки
int image; //Ссылка на изображение
String discribe; // HTML описание товара
ListData(String _title, int _price, int _image, String _discribe, String _url) {
title = _title;
price = _price;
image = _image;
discribe = _discribe;
url = _url;
}
}
| [
"warkan06@mail.ru"
] | warkan06@mail.ru |
4a3de697ccaaee478af075c35b4c525a9e8e1c1a | c0be5c70aac702fb02d44ea030c293dc066b65ad | /src/main/java/utn/frsf/ofa/cursojava/rrhh/web/resources/ClienteResource.java | 0f2e5418a0f236ef119ba39e4efa7ac4c95364d9 | [] | no_license | ptisseragit/app-rrhh-web | c59e3d0bfe44af6bbe810446d6dd054bfad9017e | 7961335cd07d3b7a1ea1b84e09a53d85e32a89e1 | refs/heads/master | 2020-03-27T19:51:37.610095 | 2018-10-03T23:31:54 | 2018-10-03T23:31:54 | 147,016,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,241 | 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 utn.frsf.ofa.cursojava.rrhh.web.resources;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import utn.frsf.ofa.cursojava.rrhh.web.modelo.Cliente;
import utn.frsf.ofa.cursojava.rrhh.web.service.ClienteService;
/**
*
* @author Cristian
*/
@Stateless
@Path("/cliente")
public class ClienteResource {
/*@GET
public Response listarClientes(){
return Response.ok("GET AQUI SE DEBERIAN LISTAR LOS CLIENTES").build();
}
@POST
public Response crearCliente(Cliente cli){
System.out.println("CLIENTE RECIBIDO : "+cli);
return Response.ok("POST " + cli.getNombre()).build();
}*/
//… RESOLVER INJECTAR UNA INSTANCIA DE ClienteService ….
@Inject ClienteService clienteService;
@GET
public Response listarClientes(@QueryParam("nombre") String nombre){
List<Cliente> lista = new ArrayList<>();
if(nombre!=null && nombre.trim().length()>0){
lista = clienteService.porNombre(nombre);
}
else {
lista = clienteService.todos();
}
return Response.ok(lista).build();
}
@GET
@Path("{id}")
public Response buscarPorId(@PathParam("id") Integer idCliente){
return Response.ok(clienteService.porId(idCliente)).build();
}
@POST
public Response crearCliente(Cliente cli){
clienteService.guardar(cli);
System.out.println("LLAMADO ...");
return Response.ok().build();
}
@PUT
public Response actualizarCliente(Cliente cli){
clienteService.guardar(cli);
return Response.ok("PUT"+cli.getNombre()).build();
}
@DELETE
@Path("{id}")
public Response actualizarCliente(@PathParam("id") Integer idCliente){
clienteService.borrar(idCliente);
return Response.ok("DELETE ok").build();
}
}
| [
"Cristian@192.168.0.107"
] | Cristian@192.168.0.107 |
89d911c49c848fc791c8c81f715f86898d708533 | e2dead21edc5813172efd35de367df14fbd191ed | /JavaLibrary2/src/utils/AccountFacadeRemote.java | bee9477766529b7113f8e0e01961709c8c097290 | [] | no_license | D-Malyszko/MB2015 | a6797ab425944f17c4654fffef46f8e151090ad3 | 603ff6d4c3f2e09fe3ea3fccab4f5ea93fcbb0f4 | refs/heads/master | 2021-01-10T17:38:15.331358 | 2015-12-15T15:25:19 | 2015-12-15T15:25:19 | 45,944,421 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 577 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package utils;
import data.Account;
import java.util.List;
import javax.ejb.Remote;
/**
*
* @author admin
*/
@Remote
public interface AccountFacadeRemote {
void create(Account account);
void edit(Account account);
void remove(Account account);
Account find(Object id);
List<Account> findAll();
List<Account> findRange(int[] range);
int count();
}
| [
"admin@user"
] | admin@user |
0330cf9bc6355d83e8a5fc94e3048990e6e4fb4c | 81c48ccdb639908df63cd5f90b4cb49449f30e1d | /haox-kerb/kerb-core-test/src/test/java/org/apache/kerberos/kerb/codec/pac/PacSid.java | ad73d0e3f93d00de464319b9a873a9532342c6f1 | [
"Apache-2.0"
] | permissive | HazelChen/directory-kerberos | 595e70f652a695278018ac8b4ebee30d37232fdc | 5e7a14455c8184bf1590fc2865345a2ff98431fe | refs/heads/master | 2020-12-30T14:56:29.674154 | 2015-01-15T08:36:03 | 2015-01-15T08:36:03 | 29,284,549 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,412 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.kerberos.kerb.codec.pac;
import java.io.IOException;
public class PacSid {
private static final String FORMAT = "%1$02x";
private byte revision;
private byte subCount;
private byte[] authority;
private byte[] subs;
public PacSid(byte[] bytes) throws IOException {
if(bytes.length < 8 || ((bytes.length - 8) % 4) != 0
|| ((bytes.length - 8) / 4) != bytes[1])
throw new IOException("pac.sid.malformed.size");
this.revision = bytes[0];
this.subCount = bytes[1];
this.authority = new byte[6];
System.arraycopy(bytes, 2, this.authority, 0, 6);
this.subs = new byte[bytes.length - 8];
System.arraycopy(bytes, 8, this.subs, 0, bytes.length - 8);
}
public PacSid(PacSid sid) {
this.revision = sid.revision;
this.subCount = sid.subCount;
this.authority = new byte[6];
System.arraycopy(sid.authority, 0, this.authority, 0, 6);
this.subs = new byte[sid.subs.length];
System.arraycopy(sid.subs, 0, this.subs, 0, sid.subs.length);
}
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("\\").append(String.format(FORMAT, ((int)revision) & 0xff));
builder.append("\\").append(String.format(FORMAT, ((int)subCount) & 0xff));
for(int i = 0; i < authority.length; i++) {
int unsignedByte = ((int)authority[i]) & 0xff;
builder.append("\\").append(String.format(FORMAT, unsignedByte));
}
for(int i = 0; i < subs.length; i++) {
int unsignedByte = ((int)subs[i]) & 0xff;
builder.append("\\").append(String.format(FORMAT, unsignedByte));
}
return builder.toString();
}
public boolean isEmpty() {
return subCount == 0;
}
public boolean isBlank() {
boolean blank = true;
for(byte sub : subs)
blank = blank && (sub == 0);
return blank;
}
public byte[] getBytes() {
byte[] bytes = new byte[8 + subCount * 4];
bytes[0] = revision;
bytes[1] = subCount;
System.arraycopy(authority, 0, bytes, 2, 6);
System.arraycopy(subs, 0, bytes, 8, subs.length);
return bytes;
}
public static String toString(byte[] bytes) {
StringBuilder builder = new StringBuilder();
for(int i = 0; i < bytes.length; i++) {
int unsignedByte = ((int)bytes[i]) & 0xff;
builder.append("\\").append(String.format(FORMAT, unsignedByte));
}
return builder.toString();
}
public static PacSid createFromSubs(byte[] bytes) throws IOException {
if((bytes.length % 4) != 0) {
Object[] args = new Object[]{bytes.length};
throw new IOException("pac.subauthority.malformed.size");
}
byte[] sidBytes = new byte[8 + bytes.length];
sidBytes[0] = 1;
sidBytes[1] = (byte)(bytes.length / 4);
System.arraycopy(new byte[]{0, 0, 0, 0, 0, 5}, 0, sidBytes, 2, 6);
System.arraycopy(bytes, 0, sidBytes, 8, bytes.length);
return new PacSid(sidBytes);
}
public static PacSid append(PacSid sid1, PacSid sid2) {
PacSid sid = new PacSid(sid1);
sid.subCount += sid2.subCount;
sid.subs = new byte[sid.subCount * 4];
System.arraycopy(sid1.subs, 0, sid.subs, 0, sid1.subs.length);
System.arraycopy(sid2.subs, 0, sid.subs, sid1.subs.length, sid2.subs.length);
return sid;
}
}
| [
"drankye@gmail.com"
] | drankye@gmail.com |
4708205e0162bac444585b6f786ad0d3aad8612f | 4f20308e76add3eafd89c746c9e513ecb05254cb | /TaxiDrive/src/com/qinyuan/model/UserPositionOverlay.java | 09cea1467557782cb3617ea72e16c6d4fc0a95c3 | [] | no_license | RyanFu/taxi | 81fd25bc8e617165a3493231f8709f3e2445fdec | ed729f18a3b55cb4509297eadf2113cc5c98ff89 | refs/heads/master | 2021-01-16T18:48:12.815528 | 2013-09-01T13:49:47 | 2013-09-01T13:49:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,537 | java | package com.qinyuan.model;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Point;
import com.baidu.mapapi.GeoPoint;
import com.baidu.mapapi.MapView;
import com.baidu.mapapi.Overlay;
import com.baidu.mapapi.Projection;
public class UserPositionOverlay extends Overlay
{
private static GeoPoint geoPoint;
private static Context context;
private static int drawable;
private static UserPositionOverlay userOverlay = new UserPositionOverlay();
public UserPositionOverlay(){super();}
// public MyPositionOverlay(GeoPoint geoPoint, Context context, int drawable)
// {
// super();
// this.geoPoint = geoPoint;
// this.context = context;
// this.drawable = drawable;
//
// }
public static UserPositionOverlay getInstance(GeoPoint pt, Context c, int d){
geoPoint = pt;
context = c;
drawable = d;
return userOverlay;
}
private Projection projection;
private Point point;
private Bitmap bitmap;
public void draw(Canvas canvas, MapView mapView, boolean shadow)
{
projection = mapView.getProjection();
point = new Point();
projection.toPixels(geoPoint, point);
bitmap = BitmapFactory.decodeResource(context.getResources(), drawable);
// canvas.drawBitmap(bitmap, point.x - bitmap.getWidth() , point.y
// -bitmap.getHeight() , null);
canvas.drawBitmap(bitmap, point.x, point.y, null);
super.draw(canvas, mapView, shadow);
}
}
| [
"dengjing@gmail.com"
] | dengjing@gmail.com |
284b9cf3f7e1d5f97651d39229f1fa89f7a33630 | 6f73d920b6a57c8538b742050ef80086b657cb81 | /src/main/java/com/fuyongbin/Realm.java | d0dbdfc31858388ba8c5c19e35435fcf5570814e | [] | no_license | yongbinfu/ShiroProject | a0c523d61e4e18a904685ca85a74887336a2668d | 4d1a36e3a39eba5ad4786f2c07a2a772e2817b9b | refs/heads/master | 2023-04-18T04:16:38.117167 | 2021-05-03T04:18:03 | 2021-05-03T04:18:03 | 363,627,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,861 | java | package com.fuyongbin;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import java.util.ArrayList;
public class Realm extends AuthorizingRealm {
/*认证*/
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
/*获取用户名*/
String username = (String) authenticationToken.getPrincipal();
String name="itlike";
String password="123456";
if (!name.equals(username)){
return null;
}
/*交由认证器去认证*/
SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo(username, password, this.getName());
return simpleAuthenticationInfo;
}
/*授权*/
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
/*获取身份信息*/
Object primaryPrincipal = principalCollection.getPrimaryPrincipal();
ArrayList<String> roles = new ArrayList<>();
roles.add("role1");
roles.add("role2");
ArrayList<String> permissions = new ArrayList<>();
permissions.add("user:create");
permissions.add("user:upda te");
SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo();
simpleAuthorizationInfo.addRoles(roles);
simpleAuthorizationInfo.addStringPermissions(permissions);
return simpleAuthorizationInfo;
}
}
| [
"851070420@qq.com"
] | 851070420@qq.com |
66bbec39f8d0f13fc8bdc13eb8a468f5a4fd3585 | 2ec905b5b130bed2aa6f1f37591317d80b7ce70d | /ihmc-robotics-toolkit/src/test/java/us/ihmc/robotics/math/trajectories/YoMinimumJerkTrajectory.java | 984c20b4be34d80e67cf3b80aa36b0c736009316 | [
"Apache-2.0"
] | permissive | ihmcrobotics/ihmc-open-robotics-software | dbb1f9d7a4eaf01c08068b7233d1b01d25c5d037 | 42a4e385af75e8e13291d6156a5c7bebebbecbfd | refs/heads/develop | 2023-09-01T18:18:14.623332 | 2023-09-01T14:16:26 | 2023-09-01T14:16:26 | 50,613,360 | 227 | 91 | null | 2023-01-25T21:39:35 | 2016-01-28T21:00:16 | Java | UTF-8 | Java | false | false | 10,174 | java | package us.ihmc.robotics.math.trajectories;
import us.ihmc.yoVariables.registry.YoRegistry;
import us.ihmc.yoVariables.variable.YoDouble;
public class YoMinimumJerkTrajectory
{
public static final boolean DEBUG = false;
private final YoDouble X0, V0, A0, Xf, Vf, Af, T0, Tf;
private double C0, C1, C2, C3, C4, C5;
public double pos, vel, acc;
public YoMinimumJerkTrajectory(String name, YoRegistry registry)
{
X0 = new YoDouble(name + "_x0", registry);
V0 = new YoDouble(name + "_v0", registry);
A0 = new YoDouble(name + "_a0", registry);
T0 = new YoDouble(name + "_t0", registry);
Xf = new YoDouble(name + "_xf", registry);
Vf = new YoDouble(name + "_vf", registry);
Af = new YoDouble(name + "_af", registry);
Tf = new YoDouble(name + "_tf", registry);
}
public double getStartTime()
{
return T0.getDoubleValue();
}
public double getFinalTime()
{
return Tf.getDoubleValue();
}
public double getPosition()
{
return pos;
}
public double getVelocity()
{
return vel;
}
public double getAcceleration()
{
return acc;
}
public void setParams(double X0, double V0, double A0, double Xf, double Vf, double Af, double T0, double Tf)
{
this.X0.set(X0);
this.V0.set(V0);
this.A0.set(A0);
this.Xf.set(Xf);
this.Vf.set(Vf);
this.Af.set(Af);
this.T0.set(T0);
this.Tf.set(Tf);
this.computeConstants();
}
private void computeConstants()
{
double DT = Tf.getDoubleValue() - T0.getDoubleValue();
double DT2 = DT * DT;
C0 = 1.0000 * X0.getDoubleValue();
C1 = 1.0000 * V0.getDoubleValue() * DT;
C2 = 0.5000 * A0.getDoubleValue() * DT2;
C3 = -10.0000 * X0.getDoubleValue() - 6.0000 * V0.getDoubleValue() * DT - 1.5000 * A0.getDoubleValue() * DT2 + 10.0000 * Xf.getDoubleValue()
- 4.0000 * Vf.getDoubleValue() * DT + 0.5000 * Af.getDoubleValue() * DT2;
C4 = 15.0000 * X0.getDoubleValue() + 8.0000 * V0.getDoubleValue() * DT + 1.5000 * A0.getDoubleValue() * DT2 - 15.0000 * Xf.getDoubleValue()
+ 7.0000 * Vf.getDoubleValue() * DT - 1.0000 * Af.getDoubleValue() * DT2;
C5 = -6.0000 * X0.getDoubleValue() - 3.0000 * V0.getDoubleValue() * DT - 0.5000 * A0.getDoubleValue() * DT2 + 6.0000 * Xf.getDoubleValue()
- 3.0000 * Vf.getDoubleValue() * DT + 0.5000 * Af.getDoubleValue() * DT2;
}
public void computeTrajectoryDoubles(double t, double[] vals)
{
computeTrajectory(t);
vals[0] = this.pos;
vals[1] = this.vel;
vals[2] = this.acc;
}
public void computeTrajectory(double t, YoDouble pos)
{
computeTrajectory(t);
pos.set(this.pos);
}
public void computeTrajectory(double t, YoDouble pos, YoDouble vel)
{
computeTrajectory(t);
pos.set(this.pos);
vel.set(this.vel);
}
public void computeTrajectory(double t, YoDouble pos, YoDouble vel, YoDouble acc)
{
computeTrajectory(t);
pos.set(this.pos);
vel.set(this.vel);
acc.set(this.acc);
}
public void computeTrajectory(double t)
{
computeConstants();
double DT = Tf.getDoubleValue() - T0.getDoubleValue();
double DT2 = DT * DT;
if (t < T0.getDoubleValue())
{
pos = X0.getDoubleValue();
vel = V0.getDoubleValue();
acc = A0.getDoubleValue();
return;
}
if (t > Tf.getDoubleValue())
{
pos = Xf.getDoubleValue();
vel = Vf.getDoubleValue();
acc = Af.getDoubleValue();
return;
}
double tau = (t - T0.getDoubleValue()) / DT;
double tau2 = tau * tau;
double tau3 = tau * tau2;
double tau4 = tau * tau3;
double tau5 = tau * tau4;
pos = C0 + C1 * tau + C2 * tau2 + C3 * tau3 + C4 * tau4 + C5 * tau5;
vel = (C1 + 2.0 * C2 * tau + 3.0 * C3 * tau2 + 4.0 * C4 * tau3 + 5.0 * C5 * tau4) / DT;
acc = (2.0 * C2 + 6.0 * C3 * tau + 12.0 * C4 * tau2 + 20.0 * C5 * tau3) / DT2;
}
private final int maxFindIterations = 10;
/**
* Finds the maximum absolute value of the velocity and acceleration of the MinimumJerkTrajectory from the given current time to the Trajectories final time.
*
* @deprecated
* @param t double : Time to start looking for a maximum velocity and acceleration.
* @param maximums double[2] : {max velocity, max acceleration}
*/
public void findMaxVelocityAndAccel(double currentTime, double[] maximums)
{
if (currentTime >= Tf.getDoubleValue())
{
maximums[0] = Vf.getDoubleValue();
maximums[1] = Af.getDoubleValue();
}
computeConstants();
double DT = Tf.getDoubleValue() - T0.getDoubleValue();
double DT2 = DT * DT;
double deltaTime = ((Tf.getDoubleValue() - T0.getDoubleValue()) / maxFindIterations);
double maxvel = Double.NEGATIVE_INFINITY;
double maxacc = Double.NEGATIVE_INFINITY;
double time = currentTime;
do
{
double tau = (time - T0.getDoubleValue()) / DT;
double tau2 = tau * tau;
double tau3 = tau * tau2;
double tau4 = tau * tau3;
double currvel = Math.abs((C1 + 2.0 * C2 * tau + 3.0 * C3 * tau2 + 4.0 * C4 * tau3 + 5.0 * C5 * tau4) / DT);
double curracc = Math.abs((2.0 * C2 + 6.0 * C3 * tau + 12.0 * C4 * tau2 + 20.0 * C5 * tau3) / DT2);
if (currvel > maxvel)
maxvel = currvel;
if (curracc > maxacc)
maxacc = curracc;
time = time + deltaTime;
}
while (time <= Tf.getDoubleValue());
maximums[0] = maxvel;
maximums[1] = maxacc;
}
private final int maxTimeIterations = 20;
private final double minTimeWindow = 0.005;
/**
* Calculates minimum final time for trajectory to keep velocity and accelerations within limits.
* If values are already within limits it will return 0.0, otherwise it will return the suggested Tf.
* The suggested Tf will always be >= the given currentTime, and always be >= Tf.
*
* @deprecated
* @param t double: current time
* @param maxV double: maximum velocity to use
* @param maxA double: maximum acceleration to use
* @return double
*/
public double timeExtension(double currentTime, double maxV, double maxA, boolean Fix)
{
// Error if parameters are already higher, ignore extension
if (Fix)
{
if (maxV < Math.abs(V0.getDoubleValue()))
{
V0.set(V0.getDoubleValue() * Math.abs(maxV / V0.getDoubleValue()) * 0.95);
if (DEBUG)
System.out.println("MinimumJerkTrajectory.timeExtension: clamped V0 to maxV");
}
if (maxV < Math.abs(Vf.getDoubleValue()))
{
Vf.set(Vf.getDoubleValue() * Math.abs(maxV / Vf.getDoubleValue()) * 0.95);
if (DEBUG)
System.out.println("MinJerkTrajectory.timeExtension: clamped Vf to maxV");
}
if (maxA < Math.abs(A0.getDoubleValue()))
{
A0.set(A0.getDoubleValue() * Math.abs(maxA / A0.getDoubleValue()) * 0.95);
if (DEBUG)
System.out.println("MinimumJerkTrajectory.timeExtension: clamped A0 to maxA");
}
if (maxA < Math.abs(Af.getDoubleValue()))
{
Af.set(Af.getDoubleValue() * Math.abs(maxA / Af.getDoubleValue()) * 0.95);
if (DEBUG)
System.out.println("MinimumJerkTrajectory.timeExtension: clamped Af to maxA");
}
}
else if ((maxV < Math.abs(V0.getDoubleValue())) || (maxA < Math.abs(A0.getDoubleValue())) || (maxV < Math.abs(Vf.getDoubleValue())) || (maxA < Math.abs(Af.getDoubleValue())))
{
if (DEBUG)
System.err.println("MinimumJerkTrajectory.timeExtension: Trying to extend time with maximums less than start or end parameters, nothing changed");
return 0.0;
}
double[] maxs = new double[2];
findMaxVelocityAndAccel(currentTime, maxs);
// If the given times are within the max vel and acceleration, then just return 0.0
// since we'll only increase the time.
if ((maxs[0] <= maxV) && (maxs[1] <= maxA))
{
return 0.0;
}
// We need to increase Tf. Remember the original.
final double TForig = Tf.getDoubleValue();
double timeadd = 0.5;
double lowerbound = Math.max(currentTime, Tf.getDoubleValue());
double upperbound = lowerbound + timeadd;
// March forward until you find an upper bound on Tf:
int timeIterations = 1;
boolean withinBounds = false;
while (!withinBounds && (timeIterations < maxTimeIterations))
{
upperbound = lowerbound + timeadd;
Tf.set(upperbound);
findMaxVelocityAndAccel(currentTime, maxs);
withinBounds = (maxs[0] < maxV) && (maxs[1] <= maxA);
timeadd = timeadd * 2.0;
timeIterations++;
}
// Squeeze play until you are within minTimeWindow or did more than maxTimeIterations.
// If no iterations are left, then just return upperBound
while ((timeIterations < maxTimeIterations) && (upperbound - lowerbound > minTimeWindow))
{
double middle = (lowerbound + upperbound) / 2.0;
Tf.set(middle);
findMaxVelocityAndAccel(currentTime, maxs);
if ((maxs[0] <= maxV) && (maxs[1] <= maxA))
{
upperbound = middle;
}
else
{
lowerbound = middle;
}
timeIterations++;
}
Tf.set(TForig);
return upperbound;
}
@Deprecated
public void updateToFinalPosition(double currentTime, double Xf)
{
computeTrajectory(currentTime);
this.T0.set(currentTime);
this.Xf.set(Xf);
this.X0.set(getPosition());
this.V0.set(getVelocity());
this.A0.set(getAcceleration());
this.computeConstants();
}
@Deprecated
public void setFinalPosition(double Xf)
{
this.Xf.set(Xf);
this.computeConstants();
}
} | [
"noreply@github.com"
] | ihmcrobotics.noreply@github.com |
433e3071f6137d99ddec84bfd9b3559a61f2b13e | 364cd139849a697e82279160c84c89c6d8ae2662 | /Core/src/main/java/com/framework/reporter/utils/VelocityLogger.java | 05ad5b0f3aa533422fa8ba4086efb6720f24c8f6 | [
"Apache-2.0"
] | permissive | AdityaGaurav/JFramework | a068a2070b639324158065d7aa7ab3437256480c | fe4f100aa223919ca524cbbf97998e04e3d604e9 | refs/heads/master | 2021-05-29T13:00:14.676291 | 2015-08-16T16:20:06 | 2015-08-16T16:20:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,041 | java | package com.framework.reporter.utils;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.runtime.RuntimeServices;
import org.apache.velocity.runtime.log.LogChute;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created with IntelliJ IDEA ( LivePerson : www.liveperson.com )
*
* Package: com.framework.reporter.utils
*
* Name : VelocityLogger
*
* User : solmarkn / Dani Vainstein
*
* Date : 2015-02-12
*
* Time : 14:02
*
*/
public class VelocityLogger implements LogChute
{
//region VelocityLogger - Variables Declaration and Initialization Section.
private static final Logger logger = LoggerFactory.getLogger( VelocityLogger.class );
//endregion
//region VelocityLogger - Constructor Methods Section
public VelocityLogger()
{
try
{
/*
* this class implements the LogSystem interface, so we
* can use it as a logger for Velocity
*/
Velocity.setProperty( Velocity.RUNTIME_LOG_LOGSYSTEM, this );
Velocity.init();
/*
* that will be enough. The Velocity initialization will be
* output to stdout because of our
* logVelocityMessage() method in this class
*/
}
catch( Exception e )
{
System.err.println("Exception : " + e);
}
}
//endregion
//region VelocityLogger - Public Methods Section
@Override
public void init( final RuntimeServices rs ) throws Exception
{
//
}
@Override
public void log( final int level, final String message )
{
logger.debug( message );
}
@Override
public void log( final int level, final String message, final Throwable t )
{
logger.error( message, t );
}
@Override
public boolean isLevelEnabled( final int level )
{
return true;
}
//endregion
//region VelocityLogger - Protected Methods Section
//endregion
//region VelocityLogger - Private Function Section
//endregion
//region VelocityLogger - Inner Classes Implementation Section
//endregion
}
| [
"solmarkn@gmail.com"
] | solmarkn@gmail.com |
0e6ac299ef2c89b425fbd185be17fa87defd98e8 | 16aafa594a2154b00c36bdd01704c4ee669d8d2b | /app/src/main/java/com/nano/starchat2/Activity/UpdateUserInfoSexActivity.java | 345a0147620ef5132e0f4e067ff0b170abcf0200 | [] | no_license | Romantic-LiXuefeng/StarChat | d5ae4098f018e63f28e46802374b70584ad2047f | 2b6704d865af57986db0f25cbfd04839231acc8a | refs/heads/master | 2021-01-17T21:15:13.287899 | 2015-11-15T05:35:43 | 2015-11-15T05:35:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,326 | java | package com.nano.starchat2.Activity;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import com.nano.starchat2.Utils.ConstantsUtil;
import com.nano.starchat2.adapter.UpdateSexAdapter;
/**
* Created by Administrator on 2015/6/20.
*/
public class UpdateUserInfoSexActivity extends Activity implements View.OnClickListener{
private ListView updateSexListView;
//private EditText editText;
private UpdateSexAdapter updateSexAdapter;
//保存
private Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_updateuserinfo_sex);
updateSexListView = (ListView)findViewById(R.id.updateuserinfo_sex_ListView);
updateSexAdapter = new UpdateSexAdapter(this);
updateSexListView.setAdapter(updateSexAdapter);
updateSexListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//男
if (0 == position)
{
updateSexAdapter.setSelect(ConstantsUtil.INT_SEX_MALE);
}
//女
if (1 == position) {
updateSexAdapter.setSelect(ConstantsUtil.INT_SEX_FEMALE);
}
updateSexAdapter.notifyDataSetChanged();
//得到当前 输入框中得字符
String currentText = ConstantsUtil.getSexCh(String.valueOf(position + 1));
//得到当前界面用户信息,如果一致就不用提交,如果不一致,就改当前界面用户信息
SharedPreferences preferences = UpdateUserInfoSexActivity.this.getSharedPreferences(
ConstantsUtil.SHAREDPREFERENCES_NAME, Context.MODE_MULTI_PROCESS);
//设置性别
String sex = preferences.getString("local_sex", "");
//如果不一致, 就提交改变一次
if (!currentText.equals(sex))
{
SharedPreferences.Editor editor = preferences.edit();
//得到英文性别
editor.putString("local_sex", currentText);
editor.commit();
}
}
});
//editText = (EditText)findViewById(R.id.edittext_update_userinfo_sex);
//btn =(Button)findViewById(R.id.button_update_userinfo_sex_save);
//btn.setOnClickListener(this);
TextView textView = (TextView)findViewById(R.id.updateuserinfo_sex_title_back);
textView.setOnClickListener(this);
}
//点击按钮 事件
@Override
public void onClick(View v) {
switch (v.getId())
{
/*case R.id.button_update_userinfo_sex_save:
{
//得到当前 输入框中得字符
String currentText = editText.getText().toString();
//得到当前界面用户信息,如果一致就不用提交,如果不一致,就改当前界面用户信息
SharedPreferences preferences = UpdateUserInfoSexActivity.this.getSharedPreferences(
ConstantsUtil.SHAREDPREFERENCES_NAME, Context.MODE_MULTI_PROCESS);
//设置性别
String sex = preferences.getString("local_sex", "");
//如果不一致, 就提交改变一次
if (!currentText.equals(sex))
{
SharedPreferences.Editor editor = preferences.edit();
//得到英文性别
editor.putString("local_sex", currentText);
editor.commit();
}
Intent intent = new Intent(UpdateUserInfoSexActivity.this, UserInfoActivity.class);
UpdateUserInfoSexActivity.this.startActivity(intent);
(UpdateUserInfoSexActivity.this).finish();
}
break;*/
//点击返回
case R.id.updateuserinfo_sex_title_back:
{
finish();
}
break;
}
}
@Override
protected void onStart() {
super.onStart();
}
@Override
protected void onRestart() {
super.onRestart();
}
@Override
protected void onResume() {
super.onResume();
//先看是否登录成功
SharedPreferences preferences = this.getSharedPreferences(
ConstantsUtil.SHAREDPREFERENCES_NAME, Context.MODE_MULTI_PROCESS);
//设置性别
String sex = preferences.getString("local_sex", "");
updateSexAdapter.setSelect(Integer.valueOf(ConstantsUtil.getSexNum(sex)));
updateSexAdapter.notifyDataSetChanged();
//editText.setText(sex);
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
protected void onStop() {
super.onStop();
}
}
| [
"pingguokiller@163.com"
] | pingguokiller@163.com |
fe867ae61826e413e7649f4ef700b809c42ebf3e | b34037db4cd39d7ee08115d7535438fa7685062a | /src/main/java/lesson7/task4/AnnuityCredit.java | d94cb0a26bbcf8eda5df1ebdc1d5054cbb42d1c9 | [] | no_license | Pudikov/AutoTest | 7306d8f280db3cbdd410ffebc3c14079fafca16e | a4b8ed1ba23889e2297377552db22c3f7f0dca9a | refs/heads/master | 2023-01-13T18:21:48.413817 | 2020-11-19T20:15:39 | 2020-11-19T20:15:39 | 294,502,967 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 685 | java | package lesson7.task4;
import java.util.ArrayList;
import java.util.List;
public class AnnuityCredit extends BaseCredit {
double i;
int n;
double S;
double K;
double A;
double i1;
public static int pow(double a, int b) {
return (int) Math.pow(a, b);
}
@Override
public List<Double> getMonthPayments() {
List<Double> graphic = new ArrayList();
i = rate / duration;
n = 12;
S = amount;
i1 = (1 + i);
K = (i * pow(i1, n)) / (pow(i1, n) - 1);
A = K * S;
for (int i = 0; i < duration; i++) {
graphic.add(A);
}
return graphic;
}
}
| [
"d.pudikov@mail.ru"
] | d.pudikov@mail.ru |
e4da7064aa265fd376d56063be8069d19cbfe517 | f6aae7ccb45336b5d796f41ab60d5df285e8631f | /src/generics/SelfBoundingMethods.java | eb8de3250d42228f0f01a443ccfe4a4e192f1b4e | [] | no_license | Ptoyamegg/TinJava | 1f81f35bc431c917e0127d909a2c4016f3fab21e | 1c044dd5fa5a551c9398220b602d7cc6dda363a2 | refs/heads/master | 2020-07-03T02:30:02.206073 | 2020-02-18T06:20:58 | 2020-02-18T06:20:58 | 201,757,205 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package generics;
public class SelfBoundingMethods {
static <T extends SelfBounded<T>> T f(T arg) {
return arg.set(arg).get();
}
public static void main(String[] args) {
A a = f(new A());
}
}
| [
"1345133130@qq.com"
] | 1345133130@qq.com |
a5d09b80a6084e3d656b71e7c45d59a40d16aef0 | 5cfe0866eec6c5c3ede5de83b02c71cfa65bd196 | /src/shiyan2/menu1.java | 1d17a5436dcb4bea31f01c5880b6277ae6267f50 | [] | no_license | Northfishall/lab1_java | 6bf35dcebc7c113ea4b1e6e571adf099defabcfa | 2ad38898658f8c0814d017e305eba5aca688b551 | refs/heads/master | 2021-05-16T04:56:36.520016 | 2017-10-12T08:04:36 | 2017-10-12T08:46:04 | 106,226,827 | 0 | 1 | null | 2017-10-20T14:32:05 | 2017-10-09T02:15:20 | Java | GB18030 | Java | false | false | 10,788 | java | package shiyan2;
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.Label;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.Stack;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.RootPaneContainer;
public class menu1 implements ActionListener {
JButton jb1=new JButton("上传文件");
JButton jb2=new JButton("显示图片");
JButton sure=new JButton("sure");
JButton exit=new JButton("exit");
JButton next=new JButton("next");
JButton sure1=new JButton("sure");
JButton sure2=new JButton("sure");
JButton sure3=new JButton("sure");
JButton sure4=new JButton("sure");
JButton gn1=new JButton("桥接词功能");
JButton gn2=new JButton("生成文本功能");
JButton gn3=new JButton("两点最短距离");
JButton gn4=new JButton("点到所有点距离");
JButton gn5=new JButton("随机游走功能");
JTextField from=new JTextField();
JTextField to =new JTextField();
JTextArea bridge_word=new JTextArea();
JTextArea User_input=new JTextArea();
JTextArea word_output=new JTextArea();
JTextArea ran_go=new JTextArea();
JTextField start=new JTextField();
JTextField start1=new JTextField();//点到其他顶点
JTextArea short2=new JTextArea();
JFrame myframe=new JFrame();
JPanel mypanel=new JPanel();
JTextField start2=new JTextField();
JTextField end=new JTextField();
JTextArea short1=new JTextArea();
JTextArea short3=new JTextArea();
JPanel pn1=new JPanel();
Graph T=new Graph();
JScrollPane jsp3 = new JScrollPane(short2);
int height=768-80;
int width=1366;
int x;
public menu1()
{
myframe.setSize(1366,768);
//myframe.add(pn1);
pn1.setVisible(false);
myframe.setVisible(true);
myframe.add(mypanel);
myframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mypanel.setLayout(null);
mypanel.add(jb1);
jb1.addActionListener(this);
jb1.setBounds(1366/2-100,height/8,200,50);
jb2.addActionListener(this);
mypanel.add(jb2);
jb2.setBounds(1366/2-100,height*2/8,200,50);
gn1.addActionListener(this);
mypanel.add(gn1);
gn1.setBounds(1366/2-100,height*3/8,200,50);
gn2.addActionListener(this);
mypanel.add(gn2);
gn2.setBounds(1366/2-100,height*4/8,200,50);
gn3.addActionListener(this);
mypanel.add(gn3);
gn3.setBounds(1366/2-100,height*5/8,200,50);
gn4.addActionListener(this);
mypanel.add(gn4);
gn4.setBounds(1366/2-100,height*6/8,200,50);
gn5.addActionListener(this);
mypanel.add(gn5);
gn5.setBounds(1366/2-100,height*7/8,200,50);
next.addActionListener(this);
exit.addActionListener(this);
sure.addActionListener(this);
sure1.addActionListener(this);
sure2.addActionListener(this);
sure3.addActionListener(this);
sure4.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==jb1)
{
JFileChooser jfc=new JFileChooser();
jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES );
jfc.showDialog(new JLabel(), "选择");
File file=jfc.getSelectedFile();
if(file.isFile())
{
try {
T = main_1.createDirectedGraph(file.getAbsolutePath());
main_1.showDirectedGraph(T);
} catch (IOException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
else if(e.getSource()==jb2)
{
JFrame frm=new JFrame();
JPanel pnl=new JPanel(new BorderLayout());
frm.add(pnl);
frm.setSize(1000,1000);
JScrollPane sp = new JScrollPane(pnl);
frm.getContentPane().add(sp);
pnl.setBounds(0, 0, 500, 500);
frm.setVisible(true);
JLabel imag=new JLabel(new ImageIcon("E:\\javaapp.gif"));
imag.setBounds(0,0,pnl.getWidth(),pnl.getHeight());
pnl.add(imag);
}
else if(e.getSource()==exit)
{
pn1.removeAll();
pn1.setVisible(false);
mypanel.setVisible(true);
}
else if(e.getSource()==gn1)
{
Label l1=new Label("查询桥接词功能");
l1.setFont(new Font("Dialog",1,25));
l1.setBounds(width/2-100,50,300,60);
pn1.add(l1);
pn1.setLayout(null);
pn1.add(from);
pn1.add(to);
pn1.add(bridge_word);
bridge_word.setLineWrap(true);
pn1.add(sure);
pn1.add(exit);
from.setBounds(width/2-100,130,200,30);
to.setBounds(width/2-100,180,200,30);
bridge_word.setBounds(width/2-100,230,200,60);
sure.setBounds(width/2-100,310,200,30);
exit.setBounds(width/2-100,360,200,30);
from.setText(null);
to.setText(null);
bridge_word.setText(null);
mypanel.setVisible(false);
pn1.setVisible(true);
myframe.add(pn1);
}
else if(e.getSource()==sure)
{
String result=main_1.queryBridgeWords(T,from.getText().toLowerCase(),to.getText().toLowerCase());
bridge_word.setText(result);
}
else if(e.getSource()==gn2)
{
Label l2=new Label("生成文本功能");
l2.setFont(new Font("Dialog",1,25));
l2.setBounds(width/2-100,50,300,60);
User_input.setBounds(width/2-100,130,200,100);
word_output.setBounds(width/2-100,250,200,100);
User_input.setLineWrap(true);
word_output.setLineWrap(true);
word_output.setEditable(false);
pn1.add(l2);
pn1.add(User_input);
pn1.add(word_output);
pn1.add(sure1);
pn1.setLayout(null);
pn1.add(exit);
sure1.setBounds(width/2-100,370,200,30);
exit.setBounds(width/2-100,420,200,30);
User_input.setText(null);
word_output.setText(null);
mypanel.setVisible(false);
pn1.setVisible(true);
myframe.add(pn1);
}
else if(e.getSource()==sure1)
{
String result=main_1.generateNewText(T,User_input.getText().toLowerCase());
word_output.setText(result);
}
else if(e.getSource()==gn5)
{
Label l3=new Label("随机游走");
l3.setFont(new Font("Dialog",1,25));
l3.setBounds(width/2-100,50,300,60);
start.setBounds(width/2-100,130,200,30);
ran_go.setBounds(width/2-150,210,300,100);
ran_go.setLineWrap(true);
ran_go.setEditable(false);
pn1.add(l3);
pn1.add(ran_go);
pn1.add(start);
pn1.add(next);
pn1.add(sure2);
pn1.setLayout(null);
pn1.add(exit);
sure2.setBounds(width/2-100,330,200,30);
exit.setBounds(width/2-100,380,200,30);
next.setBounds(width/2-100,420,200,30);
next.setVisible(false);
start.setText(null);
ran_go.setText(null);
mypanel.setVisible(false);
pn1.setVisible(true);
// JScrollPane sp = new JScrollPane(ran_go);
// myframe.getContentPane().add(sp);
// sp.setVisible(true);
myframe.add(pn1);
}
else if(e.getSource()==sure2)
{
for(int i=0;i<T.num;i++)
for(int j=0;j<T.num;j++)
T.visited[i][j]=0;
java.util.Random r=new java.util.Random();
x=(r.nextInt(T.num));
start.setText(T.int_to_s.get(""+x));
// if(!T.s_to_int.containsKey(start.getText().toLowerCase()))
// {
// ran_go.setText("no such the word!");
// return;
// }
//x=T.s_to_int.get((start.getText().toLowerCase()));
ran_go.setText(null);
next.setVisible(true);
//String result=main_1.randomWalk(T,start.getText().toLowerCase());
//ran_go.setText(result);
}
else if(e.getSource()==next)
{
String s=main_1.randgo(T,T.num,x);
if(s==null)
{
ran_go.setText(ran_go.getText()+" No words");
next.setVisible(false);
return;
}
ran_go.setText(ran_go.getText()+" "+s);
if(!T.s_to_int.containsKey(s))
{
next.setVisible(false);
return;
}
x=T.s_to_int.get(s);
}
else if(e.getSource()==gn4)
{
Label l3=new Label("点到其他个点");
l3.setFont(new Font("Dialog",1,25));
l3.setBounds(width/2-100,50,300,60);
jsp3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jsp3.setBounds(13,10,350,340);
start1.setBounds(width/2-100,130,200,30);
short2.setBounds(width/2-250,180,500,400);
jsp3.setBounds(width/2-250,180,500,400);
sure3.setBounds(width/2-100,600,200,30);
exit.setBounds(width/2-100,650,200,30);
short2.setLineWrap(true);
short2.setEditable(false);
pn1.add(l3);
pn1.add(start1);
pn1.add(jsp3);
//pn1.add(short2);
pn1.add(sure3);
pn1.setLayout(null);
pn1.add(exit);
start1.setText(null);
short2.setText(null);
mypanel.setVisible(false);
pn1.setVisible(true);
myframe.add(pn1);
}
else if(e.getSource()==sure3)
{
short2.setText("");
if(!T.s_to_int.containsKey(start1.getText().toLowerCase()))
{
short2.setText("there is no such a word!");
return;
}
Stack []result=main_1.all_calcShortestPath(T,start1.getText().toLowerCase());
int i=0;
while(i<T.num)
{
if(!result[i].isEmpty())
{
short2.setText(short2.getText()+" "+start1.getText().toLowerCase()+" ");
while(!result[i].isEmpty())
{
short2.setText(short2.getText()+(result[i].pop()+" "));
}
short2.setText(short2.getText()+("\n"));
}
i++;
}
}
else if(e.getSource()==gn3)
{
Label l3=new Label("点到点");
l3.setFont(new Font("Dialog",1,25));
l3.setBounds(width/2-100,50,300,60);
start2.setBounds(width/2-100,130,200,30);
end.setBounds(width/2-100,180,200,30);
short1.setBounds(width/2-200,220,200,200);
short1.setLineWrap(true);
short1.setEditable(false);
short3.setBounds(width/2+10,220,200,200);
short3.setLineWrap(true);
short3.setEditable(false);
pn1.add(l3);
pn1.add(start2);
pn1.add(end);
pn1.add(short1);
pn1.add(sure4);
pn1.setLayout(null);
pn1.add(exit);
pn1.add(short3);
sure4.setBounds(width/2-100,440,200,30);
exit.setBounds(width/2-100,500,200,30);
start2.setText(null);
short3.setText(null);
end.setText(null);
short1.setText(null);
mypanel.setVisible(false);
pn1.setVisible(true);
myframe.add(pn1);
}
else if(e.getSource()==sure4)
{
short3.setText(null);
short1.setText(null);
Stack stack=new Stack();
String result="there is no such word!";
if(T.s_to_int.containsKey(start2.getText().toLowerCase())&&T.s_to_int.containsKey(end.getText().toLowerCase()))
{
result=main_1.calcShortestPath(T,start2.getText().toLowerCase(),end.getText().toLowerCase());
short3.setText(null);
for(int i=0;main_1.arr[i][0]!=-1;i++)
{
for(int j=0;main_1.arr[i][j]!=-1;j++)
{
stack.push(T.int_to_s.get(""+main_1.arr[i][j]));
}
while(!stack.isEmpty())
{
short3.setText(short3.getText()+" "+stack.pop());
}
short3.setText(short3.getText()+"\n");
}
}
short1.setText(result);
}
}
}
| [
"bao@1314"
] | bao@1314 |
fee6bf1ddee949d8a510ac013f38baaec06a4a27 | ee5fb9103fc93e36a19fc36b7b18aa8bfde80bba | /worksheet.java | 217f0ea015643977df83b7a5e059d450e4e526ef | [] | no_license | alaasalmo/java_code | 2c6fcc4efbe58b0a7f4bc4987ceb626b90c82268 | 3085834b829c350e018125269d1feba1623877a1 | refs/heads/master | 2020-04-04T15:44:57.756335 | 2018-11-04T05:42:26 | 2018-11-04T05:42:26 | 156,050,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 721 | java | package xml3;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAttribute;
@XmlRootElement(name="worksheet")
public class worksheet {
private String name;
private String constant;
private items items;
@XmlAttribute
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@XmlElement
public String getConstant() {
return constant;
}
public void setConstant(String constant) {
this.constant = constant;
}
@XmlElement
public items getItems() {
return items;
}
public void setItems(items items) {
this.items = items;
}
}
| [
"noreply@github.com"
] | alaasalmo.noreply@github.com |
4b64379b0a089683291b26c6fa6a1d96afd00483 | 28cb3fc1610406645c4ed76245345cb25d581749 | /app/src/main/java/id/bonabrian/scious/register/RegisterActivity.java | fd150fc368c03d6f7dac178fa0c610c1ee4741c9 | [] | no_license | bonabrian/scious-app | d9813ee0d2190b884223406fc4c0d070b7c84acf | 120b24b91c8356370362adc8ac9e6eca6ae4ef50 | refs/heads/master | 2023-02-08T09:13:25.772248 | 2018-04-04T11:11:50 | 2018-04-04T11:11:50 | 128,050,863 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,733 | java | package id.bonabrian.scious.register;
import android.app.DatePickerDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.TextView;
import java.util.Calendar;
import butterknife.BindView;
import butterknife.ButterKnife;
import id.bonabrian.scious.R;
import id.bonabrian.scious.app.SciousApplication;
import id.bonabrian.scious.main.MainActivity;
/**
* @author Bona Brian Siagian (bonabrian)
*/
public class RegisterActivity extends AppCompatActivity implements View.OnClickListener, RegisterContract.View {
@BindView(R.id.scrollview_layout_register)
ScrollView scrollViewLayout;
@BindView(R.id.input_name)
EditText inputName;
@BindView(R.id.input_email)
EditText inputEmail;
@BindView(R.id.input_password)
EditText inputPassword;
@BindView(R.id.input_confirm_password)
EditText inputConfirmPassword;
@BindView(R.id.input_weight)
EditText inputWeight;
@BindView(R.id.input_height)
EditText inputHeight;
@BindView(R.id.input_birthday)
EditText inputBirthday;
@BindView(R.id.btn_register)
Button btnRegister;
@BindView(R.id.action_login)
TextView linkLogin;
private RegisterContract.Presenter presenter;
private ProgressDialog progressDialog;
private DatePicker datePicker;
private Calendar calendar;
private int mYear = 0, mMonth = 0, mDay = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
ButterKnife.bind(this);
presenter = new RegisterPresenter();
onAttachView();
prepareDataFromIntent();
initDate();
inputBirthday.setOnClickListener(this);
btnRegister.setOnClickListener(this);
linkLogin.setOnClickListener(this);
}
private void prepareDataFromIntent() {
if (getIntent().getExtras() != null) {
if (!getIntent().getExtras().getString("register-email").toString().isEmpty()) {
inputEmail.setText(getIntent().getExtras().getString("register-email").toString());
}
if (!getIntent().getExtras().getString("register-name").toString().isEmpty()) {
inputName.setText(getIntent().getExtras().getString("register-name").toString());
}
}
}
private void initDate() {
final Calendar cal = Calendar.getInstance();
if (mYear == 0) mYear = cal.get(Calendar.YEAR);
if (mMonth == 0) mMonth = cal.get(Calendar.MONTH);
if (mDay == 0) mDay = cal.get(Calendar.DAY_OF_YEAR);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.input_birthday:
DatePickerDialog datePickerDialog = new DatePickerDialog(this, R.style.DialogDatePickerTheme, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int day) {
mYear = year;
mMonth = month + 1;
mDay = day;
showDate(year, month + 1, day);
}
}, mYear, mMonth, mDay);
datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis());
datePickerDialog.show();
break;
case R.id.btn_register:
presenter.registerUser(
inputName.getText().toString(),
inputEmail.getText().toString(),
inputPassword.getText().toString(),
inputConfirmPassword.getText().toString(),
inputWeight.getText().toString(),
inputHeight.getText().toString(),
inputBirthday.getText().toString()
);
break;
case R.id.action_login:
showLoginView();
break;
}
}
private void showDate(int year, int month, int day) {
inputBirthday.setText(new StringBuilder().append(year).append("-").append(month).append("-").append(day));
}
@Override
public Context getContext() {
return this;
}
@Override
public void onAttachView() {
presenter.onAttach(this);
}
@Override
public void onDetachView() {
presenter.onDetach();
}
@Override
public void showErrorMessage(String message) {
Snackbar.make(scrollViewLayout, message, 10000)
.setAction(android.R.string.ok, new View.OnClickListener() {
@Override
public void onClick(View view) {
return;
}
})
.show();
}
@Override
public void showLoginView() {
finish();
}
@Override
public void showSuccessMessage(String message) {
AlertDialog.Builder builder;
if (SciousApplication.isRunningLollipopOrLater()) {
builder = new AlertDialog.Builder(getContext(), android.R.style.Theme_Material_Dialog_Alert);
} else {
builder = new AlertDialog.Builder(getContext());
}
builder.setTitle("Success")
.setMessage(message)
.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
})
.show();
}
@Override
public void showProgress() {
progressDialog = ProgressDialog.show(RegisterActivity.this, "", "Processing", true, false);
}
@Override
public void hideProgress() {
if (progressDialog.isShowing()) {
progressDialog.dismiss();
}
}
@Override
public void showMainView() {
Intent intent = new Intent(RegisterActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
@Override
public void showRegisterForm(String email, String name) {
inputEmail.setText(email);
inputName.setText(name);
}
}
| [
"bonabriansiagian@engineer.com"
] | bonabriansiagian@engineer.com |
08cc8d63e7e2894c1ecc1315f95ce19254de225e | a407678d9973a09183ca556b54d9d35cd7a2b765 | /src/irc/java/org/darkstorm/darkbot/ircbot/commands/defaults/VersionCommand.java | 8547946568e089ef0c8389ad5daf2fd12882b41b | [
"BSD-2-Clause"
] | permissive | dahquan1/DarkBot | d4920b6f196e9b5a8bffe1adcfe150abc7e88d50 | 09ff65b67060486eaa723a68e3faf4a6296a194c | refs/heads/master | 2020-12-25T04:17:12.624939 | 2014-03-04T21:02:02 | 2014-03-04T21:02:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,070 | java | package org.darkstorm.darkbot.ircbot.commands.defaults;
import org.darkstorm.darkbot.DarkBot;
import org.darkstorm.darkbot.ircbot.commands.IRCCommand;
import org.darkstorm.darkbot.ircbot.handlers.*;
import org.darkstorm.darkbot.ircbot.irc.messages.*;
public class VersionCommand extends IRCCommand {
public VersionCommand(CommandHandler commandHandler) {
super(commandHandler);
}
@Override
public void execute(Message message) {
if(message instanceof UserMessage) {
UserMessage userMessage = (UserMessage) message;
String messageText = userMessage.getMessage();
if(userMessage.isCTCP() && messageText.equals("VERSION")) {
MessageHandler messageHandler = bot.getMessageHandler();
messageHandler.sendCTCPNotice(userMessage.getSender()
.getNickname(), "VERSION DarkBot " + DarkBot.VERSION);
}
}
}
@Override
public String getName() {
return "VERSION";
}
@Override
public String getDescription() {
return "Responds to VERSION commands. Cannot be disabled.";
}
@Override
public boolean isEnabled() {
return true;
}
}
| [
"darkstorm@evilminecraft.net"
] | darkstorm@evilminecraft.net |
6b7988a9cb7bdb75897f911822bc57a18492cf18 | 2bca2a944276cc963012b815612c8bdbeb89715d | /DOMTest/src/dom/test/DOMParserDemo.java | b1c1b4ebdcef4539953f493f90ff09e53592cac2 | [] | no_license | npgarcia/CloudMSCAll | ecada58b12d90c451189cb6555d21192761c836f | 6a01759037dde2eb42a9f016e42abade78b6afac | refs/heads/master | 2021-01-25T12:19:33.602863 | 2015-04-25T01:04:48 | 2015-04-25T01:04:48 | 30,568,727 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,195 | java | package dom.test;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class DOMParserDemo {
public static void main(String[] args) throws Exception {
// Get the DOM Builder Factory
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
// Get the DOM Builder
DocumentBuilder builder = factory.newDocumentBuilder();
// Load and Parse the XML document
// document contains the complete XML as a Tree.
Document document = builder.parse(ClassLoader
.getSystemResourceAsStream("xml/employee.xml"));
List<Employee> empList = new ArrayList<>();
// Iterating through the nodes and extracting the data.
NodeList nodeList = document.getDocumentElement().getChildNodes();
//NodeList nodeList = document.getElementsByTagName("employee");
System.out.println(nodeList.getLength());
for (int i = 0; i < nodeList.getLength(); i++) {
// We have encountered an <employee> tag.
Node node = nodeList.item(i);
System.out.println(node.getNodeName());
if (node instanceof Element) {
System.out.println(node.getNodeType());
Employee emp = new Employee();
emp.id = node.getAttributes().getNamedItem("id").getNodeValue();
NodeList childNodes = node.getChildNodes();
for (int j = 0; j < childNodes.getLength(); j++) {
Node cNode = childNodes.item(j);
// Identifying the child tag of employee encountered.
if (cNode instanceof Element) {
String content = cNode.getLastChild().getTextContent()
.trim();
switch (cNode.getNodeName()) {
case "firstName":
emp.firstName = content;
break;
case "lastName":
emp.lastName = content;
break;
case "location":
emp.location = content;
break;
}
}
}
empList.add(emp);
}
}
// Printing the Employee list populated.
for (Employee emp : empList) {
System.out.println(emp);
}
}
}
| [
"ngarcia@tacitknowledge.com"
] | ngarcia@tacitknowledge.com |
615e24faab902301e8f6e398f10315c3c20bb010 | 67984d7d945b67709b24fda630efe864b9ae9c72 | /base-info/src/main/java/com/ey/piit/sdo/payment/service/LcRegService.java | bb42ec66d7cd6be836eaa3957bc773d242d52c63 | [] | no_license | JackPaiPaiNi/Piit | 76c7fb6762912127a665fa0638ceea1c76893fc6 | 89b8d79487e6d8ff21319472499b6e255104e1f6 | refs/heads/master | 2020-04-07T22:30:35.105370 | 2018-11-23T02:58:31 | 2018-11-23T02:58:31 | 158,773,760 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,559 | java | package com.ey.piit.sdo.payment.service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ey.piit.basebpm.entity.ProcessBean;
import com.ey.piit.basebpm.service.ProcessInstanceService;
import com.ey.piit.basebpm.service.ProcessTaskService;
import com.ey.piit.core.entity.BaseEntity.Oper;
import com.ey.piit.core.entity.User;
import com.ey.piit.core.exception.ServiceException;
import com.ey.piit.core.paginator.domain.PageBounds;
import com.ey.piit.core.paginator.domain.PageList;
import com.ey.piit.core.paginator.domain.Paginator;
import com.ey.piit.core.utils.UserUtils;
import com.ey.piit.sdo.payment.repository.LcRegDao;
import com.ey.piit.sdo.payment.vo.LcLogVo;
import com.ey.piit.sdo.payment.vo.LcRegItemVo;
import com.ey.piit.sdo.payment.vo.LcRegVo;
import com.ey.piit.core.utils.ExportUtil;
/**
* LC登记Service
* @author 邓海
*/
@Service
public class LcRegService {
@Autowired
private LcRegDao dao;
@Autowired
private ExportUtil exportUtil;
@Autowired
private ProcessInstanceService processInstanceService;
@Autowired
private ProcessTaskService processTaskService;
@SuppressWarnings("unchecked")
public Object callQueryByPage(LcRegVo vo, PageBounds page){
Map<String, Object> param = new HashMap<String, Object>();
param.put("vo", vo);
param.put("page", page);
dao.callSelect(param);
List<LcRegVo> list = (List<LcRegVo>) param.get("list");
Paginator paginator = new Paginator(page.getPage(), page.getLimit(), (int) param.get("total"));
return new PageList<Object>(list, paginator);
}
@SuppressWarnings("unchecked")
public Object callQueryJdmxByPage(LcRegItemVo vo, PageBounds page){
Map<String, Object> param = new HashMap<String, Object>();
param.put("vo", vo);
param.put("page", page);
dao.callSelectJdmx(param);
List<LcRegItemVo> list = (List<LcRegItemVo>) param.get("list");
Paginator paginator = new Paginator(page.getPage(), page.getLimit(), (int) param.get("total"));
return new PageList<Object>(list, paginator);
}
@SuppressWarnings("unchecked")
public Object callQueryDbd(LcRegVo vo, PageBounds page){
Map<String, Object> param = new HashMap<String, Object>();
param.put("vo", vo);
param.put("page", page);
dao.callSelectDbd(param);
List<LcRegVo> list = (List<LcRegVo>) param.get("list");
Paginator paginator = new Paginator(page.getPage(), page.getLimit(), (int) param.get("total"));
return new PageList<Object>(list, paginator);
}
@SuppressWarnings("unchecked")
public Object callQuery(LcRegVo vo){
Map<String, Object> param = new HashMap<String, Object>();
param.put("vo", vo);
dao.callSelect(param);
List<LcRegVo> list = (List<LcRegVo>) param.get("list");
return list;
}
@SuppressWarnings("unchecked")
public Object callQueryJdmx(LcRegItemVo vo){
Map<String, Object> param = new HashMap<String, Object>();
param.put("vo", vo);
dao.callSelectJdmx(param);
List<LcRegVo> list = (List<LcRegVo>) param.get("list");
return list;
}
@SuppressWarnings("unchecked")
public LcRegVo callQueryById(String id){
Map<String, Object> param = new HashMap<String, Object>();
param.put("id", id);
dao.callSelectById(param);
List<LcRegVo> list = (List<LcRegVo>) param.get("list");
List<LcLogVo> logList = (List<LcLogVo>) param.get("logList");
List<LcRegVo> htylist = (List<LcRegVo>) param.get("htylist");
List<LcRegItemVo> itemList = (List<LcRegItemVo>) param.get("itemList");
LcRegVo vo = list.get(0);
vo.setLogList(logList);
vo.setHtylist(htylist);
vo.setItemVoList(itemList);
return vo;
}
@SuppressWarnings("unchecked")
public Object callChangeById(String id, String sjc){
Map<String, Object> param = new HashMap<String, Object>();
param.put("id", id);
param.put("sjc", sjc);
dao.callChangeById(param);
this.callAfter(param);
List<LcRegVo> list = (List<LcRegVo>) param.get("list");
LcRegVo vo = list.get(0);
return vo;
}
@SuppressWarnings("unchecked")
public LcRegVo callQueryJdmxByLcbh(String lcbh){
Map<String, Object> param = new HashMap<String, Object>();
param.put("lcbh", lcbh);
dao.callSelectJdmxByLcbh(param);
List<LcRegItemVo> list = (List<LcRegItemVo>) param.get("list");
LcRegVo vo =new LcRegVo();
vo.setItemVoList(list);
return vo;
}
private Map<String, Object> save(LcRegVo vo){
Map<String, Object> param = new HashMap<String, Object>();
param.put("vo", vo);
// 主表保存
dao.callInsert(param);
return param;
}
@Transactional
public Object edit(LcRegVo vo) {
this.callBefore(vo);
Map<String, Object> param = this.save(vo);
this.callAfter(param);
return vo;
}
@Transactional
public void submit(LcRegVo vo){
// 调用提交存储过程
this.callBefore(vo);
Map<String, Object> param = this.save(vo);
this.callAfter(param);
dao.callSubmit(param);
this.callAfter(param);
// 审批流处理
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("out", "commit");
// 判断是否驳回
if(!StringUtils.isEmpty(vo.getTaskId()) && !"null".equals(vo.getTaskId())){
// 驳回提交
processTaskService.completeTask(vo.getTaskId(), vo.getZdrid(), variables);
} else {
// 开启审批流程
ProcessBean processBean = new ProcessBean();
processBean.setBusinessId(vo.getId());
processBean.setCode(vo.getLcbh());
processBean.setProcessKey("payment-LC-reg");
processBean.setType("LC信息登记");//流程类型
processBean.setUserId(vo.getZdrid());
processBean.setVariables(variables);
processBean.setName("("+vo.getGsbm()+")"+vo.getKhmc());//公司编码+客户名称
processInstanceService.startProcessInstance(processBean);
}
}
@Transactional
public void delete(String id, String sjc, int zt, String processId) {
Map<String, Object> param = new HashMap<String, Object>();
param.put("id", id);
param.put("sjc", sjc);
dao.callDelete(param);
this.callAfter(param);
if(zt == 3 && !"".equals(processId)){
processInstanceService.deleteProcessInstance(processId);
}
}
/**
* 保存交单明细
* @param vo
* @return
*/
@Transactional
public void saveJdmx(LcRegVo vo){
//删除交单明细
Map<String, Object> itemParam = new HashMap<String, Object>();
itemParam.put("vo", vo);
dao.callDeleteJdmx(itemParam);
this.callAfter(itemParam);
//提交现有交单明细
for(LcRegItemVo _vo : vo.getItemVoList()){
_vo.setZdrid(UserUtils.getUser().getLoginAcct());
_vo.setZdrmc(UserUtils.getUser().getUserName());
_vo.setLcbh(vo.getLcbh());
itemCallBefore(_vo);
Map<String, Object> param = new HashMap<String, Object>();
param.put("vo", _vo);
dao.callSaveJdmx(param);
this.callAfter(param);
}
}
@Transactional
public void approve(LcRegVo vo){
User user = UserUtils.getUser();
vo.setZdrid(user.getLoginAcct());
vo.setZdrmc(user.getUserName());
// 完成当前节点审批
Map<String, Object> variables = new HashMap<String, Object>();
if(vo.getApproveType() == 1){
variables.put("out", "agree");
processTaskService.completeTask(vo.getTaskId(), vo.getZdrid(), variables);
} else if(vo.getApproveType() == 2){
variables.put("out", "reject");
processTaskService.rejectTaskRestart(vo.getProcessId());
}
// 判断是不是终审
boolean isEnd = processInstanceService.isProcessEnd(vo.getProcessId());
if(isEnd && vo.getApproveType()==1){
vo.setApproveType(3);
}
// 调用审批存储过程
Map<String, Object> param = new HashMap<String, Object>();
param.put("vo", vo);
dao.callApprove(param);
this.callAfter(param);
}
@Transactional
public Map<String, Object> delete(LcRegVo vo){
this.callBefore(vo);
Map<String, Object> param = new HashMap<String, Object>();
param.put("vo", vo);
dao.callDelete(param);
this.callAfter(param);
return param;
}
/**
* 调用存储过程操作数据前
* 对一些必须字段赋值
* @param vo
*/
private void callBefore(LcRegVo vo) {
if (Oper.add.equals(vo.getOper())) {
vo.preInsert();
} else if (Oper.edit.equals(vo.getOper())) {
vo.preUpdate();
}
User user = UserUtils.getUser();
vo.setZdrid(user.getLoginAcct());
vo.setZdrmc(user.getUserName());
vo.setZdsj(new Date());
}
/**
* 调用存储过程操作数据前
* 对一些必须字段赋值
* @param vo
*/
private void itemCallBefore(LcRegItemVo vo) {
if (Oper.add.equals(vo.getOper())) {
vo.preInsert();
} else if (Oper.edit.equals(vo.getOper())) {
vo.preUpdate();
}
}
/**
* 调用存储过程后判断操作是否成功
* @param param
*/
private void callAfter(Map<String, Object> param){
if(!"SDO-000000".equals(param.get("resultCode").toString())){
throw new ServiceException(param.get("resultMsg").toString());
}
}
@SuppressWarnings("unchecked")
public void export(HttpServletResponse response, Map<String, Object> params, LcRegVo vo){
try {
List<LcRegVo> list = (List<LcRegVo>)this.callQuery(vo);
exportUtil.exportSync(response, params, list);
} catch (Exception e) {
throw new ServiceException("导出失败!");
}
}
//冻结,解冻
@Transactional
public void frozen(LcRegVo vo) {
Map<String, Object> param = new HashMap<String, Object>();
this.callBefore(vo);
param.put("vo", vo);
dao.callFrozen(param);
this.callAfter(param);
}
@SuppressWarnings("unchecked")
public void jdmxExport(HttpServletResponse response, Map<String, Object> params, LcRegItemVo vo){
try {
List<LcRegItemVo> list = (List<LcRegItemVo>)this.callQueryJdmx(vo);
exportUtil.exportSync(response, params, list);
} catch (Exception e) {
throw new ServiceException("导出失败!");
}
}
@SuppressWarnings("unchecked")
public Object callQueryItem(LcRegVo vo){
Map<String, Object> param = new HashMap<String, Object>();
param.put("vo", vo);
dao.callSelectMx(param);
List<LcRegVo> list = (List<LcRegVo>) param.get("list");
return list;
}
@SuppressWarnings("unchecked")
public void exportmx(HttpServletResponse response, Map<String, Object> params, LcRegVo vo){
try {
List<LcRegVo> list = (List<LcRegVo>)this.callQueryItem(vo);
exportUtil.exportSync(response, params, list);
} catch (Exception e) {
throw new ServiceException("导出失败!");
}
}
} | [
"1210287515@master"
] | 1210287515@master |
45316f1e5722c096320359f76f38bfece33bc170 | 3a6f00b87343e60e24f586dae176bdf010b5dcae | /sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsUpdateSamples.java | ca35812e9db9fcf3538d39748da8fc7957d964b9 | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"CC0-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later"
] | permissive | RaviTella/azure-sdk-for-java | 4c3267ea7a3ef17ffef89621c8add0a8b7dc72cb | d82d70fde49071ee2cefb4a69621c680dfafc793 | refs/heads/main | 2022-04-26T21:11:08.604986 | 2022-04-11T07:03:32 | 2022-04-11T07:03:32 | 394,745,792 | 0 | 0 | MIT | 2021-09-13T15:03:34 | 2021-08-10T18:25:18 | Java | UTF-8 | Java | false | false | 1,673 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.compute.generated;
import com.azure.core.util.Context;
import com.azure.resourcemanager.compute.models.ProximityPlacementGroupUpdate;
import java.util.HashMap;
import java.util.Map;
/** Samples for ProximityPlacementGroups Update. */
public final class ProximityPlacementGroupsUpdateSamples {
/*
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/examples/compute/PatchAProximityPlacementGroup.json
*/
/**
* Sample code: Create a proximity placement group.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createAProximityPlacementGroup(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.virtualMachines()
.manager()
.serviceClient()
.getProximityPlacementGroups()
.updateWithResponse(
"myResourceGroup",
"myProximityPlacementGroup",
new ProximityPlacementGroupUpdate().withTags(mapOf("additionalProp1", "string")),
Context.NONE);
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
| [
"noreply@github.com"
] | RaviTella.noreply@github.com |
73f28f86c4f86b8119b5c97af8cecca37a4e3ce9 | c6a3a2d06d19271a22443c5d6b7b86ad067f2b43 | /src/main/java/com/enshub/uncompress/ExceptionSkipPolicy.java | e0ae3dff480adfe30402d825194ea1d39e344d3a | [] | no_license | xiaofengzai/spring-batch | 0b7ac036daa8eb26aae3c5ab961e872c34b09dba | 2f16836bb9f0f633601194f94f3f9ae67b6715df | refs/heads/master | 2020-04-01T00:19:50.663002 | 2018-10-12T04:03:57 | 2018-10-12T04:03:57 | 152,692,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 679 | java | package com.enshub.uncompress;
import org.springframework.batch.core.step.skip.SkipLimitExceededException;
import org.springframework.batch.core.step.skip.SkipPolicy;
/**
* Created by szty on 2018/10/12.
*/
public class ExceptionSkipPolicy implements SkipPolicy {
private Class<? extends Exception> exceptionClassToSkip;
public ExceptionSkipPolicy(Class<? extends Exception> exceptionClassToSkip) {
super();
this.exceptionClassToSkip = exceptionClassToSkip;
}
@Override
public boolean shouldSkip(Throwable t, int skipCount) throws SkipLimitExceededException {
return exceptionClassToSkip.isAssignableFrom(t.getClass());
}
}
| [
"feng.wen@sao.so"
] | feng.wen@sao.so |
ac590af7c0d15aac24fed3039620d8a9d4b9e43b | 1c931494fafca7505a7df68d19542ba4ef05cce2 | /src/main/java/com/liuyun/site/model/borrow/PropertyBorrowModel.java | 9f48a5a61653f33b569b4417511176de1b53f806 | [] | no_license | liuyun073/wzd | 3cc9ccbfdda2c5f93d64af86681dcd1870759bb5 | 24497c148040bada8ed48a29c7079ae347787cc9 | refs/heads/master | 2020-05-31T21:12:25.874657 | 2014-09-19T13:47:26 | 2014-09-19T13:47:26 | 24,152,224 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 416 | java | package com.liuyun.site.model.borrow;
import com.liuyun.site.context.Constant;
public class PropertyBorrowModel extends BaseBorrowModel {
private BorrowModel model;
private static final long serialVersionUID = -1490035608742973452L;
public PropertyBorrowModel(BorrowModel model) {
super(model);
this.model = model;
this.model.borrowType = Constant.TYPE_PROPERTY;
this.model.setIs_jin(1);
init();
}
} | [
"525219246@qq.com"
] | 525219246@qq.com |
8e615594f49edcb17439a0679d22b1fa5944fa5f | 476a97b45986bfdbed27e749e526912ed29b64d4 | /app/src/main/java/com/example/user/giftandroidapp/ViewHolder/CartAdapter.java | e41c82766dd7144be62266e464f038967efbbeb0 | [] | no_license | Prabhavi-Jayanetti/Gift-Ordering-Mobile-Application | d65258caceb5bba90fef7edb5268754c877783f1 | 8bda3ab5ef9e26d580300394f0b7746a068e4866 | refs/heads/master | 2022-12-08T22:00:46.284281 | 2020-09-05T09:22:25 | 2020-09-05T09:22:25 | 292,866,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,167 | java | package com.example.user.giftandroidapp.ViewHolder;
import android.content.Context;
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.amulyakhare.textdrawable.TextDrawable;
import com.example.user.giftandroidapp.Common.Common;
import com.example.user.giftandroidapp.Interface.ItemClickListener;
import com.example.user.giftandroidapp.Model.Order;
import com.example.user.giftandroidapp.R;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
/**
* Created by User on 7/27/2018.
*/
class cartViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener
,View.OnCreateContextMenuListener{
public TextView txt_cart_name,txt_price;
public ImageView img_cart_count;
private ItemClickListener itemClickListener;
public void setTxt_cart_name(TextView txt_cart_name) {
this.txt_cart_name = txt_cart_name;
}
public cartViewHolder(View itemView) {
super(itemView);
txt_cart_name = (TextView)itemView.findViewById(R.id.cart_item_name);
txt_price = (TextView)itemView.findViewById(R.id.cart_item_Price);
img_cart_count = (ImageView)itemView.findViewById(R.id.cart_item_count);
itemView.setOnCreateContextMenuListener(this);
}
@Override
public void onClick(View view) {
}
@Override
public void onCreateContextMenu(ContextMenu contextMenu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) {
contextMenu.setHeaderTitle("Select action");
contextMenu.add(0,0,getAdapterPosition(), Common.DELETE);
}
}
public class CartAdapter extends RecyclerView.Adapter <cartViewHolder>{
private List<Order> listData = new ArrayList<>();
private Context context;
public CartAdapter(List<Order> listData, Context context) {
this.listData = listData;
this.context = context;
}
@Override
public cartViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context);
View itemView = inflater.inflate(R.layout.cart_layout,parent,false);
return new cartViewHolder(itemView);
}
@Override
public void onBindViewHolder(cartViewHolder holder, int position) {
TextDrawable drawable = TextDrawable.builder()
.buildRound(""+listData.get(position).getQuantity(), Color.RED);
holder.img_cart_count.setImageDrawable(drawable);
//Locale locale = new Locale("en","US");
//NumberFormat fmt = NumberFormat.getCurrencyInstance(locale);
int price = (Integer.parseInt(listData.get(position).getPrice()))*(Integer.parseInt(listData.get(position).getQuantity()));
holder.txt_price.setText(("RS" + price));
holder.txt_cart_name.setText(listData.get(position).getProductName());
}
@Override
public int getItemCount() {
return listData.size();
}
}
| [
"prabhavijayanetti@gmail.com"
] | prabhavijayanetti@gmail.com |
8177affce74fa39013408f17f1d7cc6131ca7741 | 6b9b2083ae9fde1a32d34230ba6f0184e9dca675 | /src/prop/assignment0/Program.java | 54616ce1692ceffb5ef760179d1988bfdd06b799 | [] | no_license | haj300/java-interpreter | 158fd4c98a1495b250dcc7fe87f35928a5a5d99d | e66712a66d42db0e16e31584375ad96f31de2693 | refs/heads/master | 2020-09-09T16:47:25.613079 | 2019-11-13T22:53:43 | 2019-11-13T22:53:43 | 221,500,995 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,733 | java | package prop.assignment0;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
public class Program {
public static void main(String[] args) {
String inputFileName = null;
String outputFileName = null;
IParser parser = null;
INode root = null; // Root of the parse tree.
StringBuilder builder = null;
FileOutputStream stream = null;
OutputStreamWriter writer = null;
try {
try {
if (args.length < 2)
throw new Exception("Incorrect number of parameters to program.");
inputFileName = args[0];
outputFileName = args[1];
parser = new Parser();
parser.open(inputFileName);
root = parser.parse();
builder = new StringBuilder();
builder.append("PARSE TREE:\n");
root.buildString(builder, 0);
builder.append("\nEVALUATION:\n");
builder.append(root.evaluate(null));
stream = new FileOutputStream(outputFileName);
writer = new OutputStreamWriter(stream);
writer.write(builder.toString());
}
catch (Exception exception) {
System.out.println("EXCEPTION: " + exception);
}
finally {
if (parser != null)
parser.close();
if (writer != null)
writer.close();
if (stream != null)
stream.close();
}
}
catch (Exception exception) {
System.out.println("EXCEPTION: " + exception);
}
}
} | [
"katja.lindeberg@gmail.com"
] | katja.lindeberg@gmail.com |
a132735b3d2ada8d48585a647aad0758c5358da0 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/4/org/apache/commons/math3/dfp/Dfp_multiply_1504.java | 7486602ac0a67399953a1f536f66222a9d6ff54d | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 5,593 | java |
org apach common math3 dfp
decim float point librari java
float point built radix
decim
design goal
decim math close
settabl precis mix number set
portabl code portabl
perform
accuraci result ulp basic
algebra oper
compli ieee
ieee note
trade off
memori foot print memori
repres number perform
digit bigger round greater loss
decim digit base digit
partial fill
number repres form
pre
sign time mant time radix exp
pre
sign plusmn mantissa repres fraction number
mant signific digit
exp rang
ieee note differ
ieee requir radix radix
requir met
subclass made make behav radix
number opinion behav radix
number requir met
radix chosen faster oper
decim digit time radix behavior
realiz ad addit round step ensur
number decim digit repres constant
ieee standard specif leav intern data encod
reason conclud subclass radix
system encod radix system
ieee specifi exist normal number
entiti signific radix
digit support gradual underflow
rais underflow flag number expon
exp min expmin flush expon reach min exp digit
smallest number repres
min exp digit digit min exp
ieee defin impli radix point li
signific digit left remain digit
implement put impli radix point left
digit includ signific signific digit
radix point fine
detail matter definit side effect
render invis subclass
dfp field dfpfield
version
dfp real field element realfieldel dfp
multipli
param multiplicand
product
dfp multipli dfp
make mix number precis
field radix digit getradixdigit field radix digit getradixdigit
field set ieee flag bit setieeeflagsbit dfp field dfpfield flag invalid
dfp result instanc newinst getzero
result nan qnan
dotrap dfp field dfpfield flag invalid multipli trap result
dfp result instanc newinst getzero
handl special case
nan finit nan finit
isnan
isnan
nan infinit nan finit mant mant length
result instanc newinst
result sign sign sign
result
nan infinit nan finit mant mant length
result instanc newinst
result sign sign sign
result
nan infinit nan infinit
result instanc newinst
result sign sign sign
result
nan infinit nan finit mant mant length
nan infinit nan finit mant mant length
field set ieee flag bit setieeeflagsbit dfp field dfpfield flag invalid
result instanc newinst getzero
result nan qnan
result dotrap dfp field dfpfield flag invalid multipli trap result
result
product mant length big hold largest result
mant length
act carri
mant length
mant mant multipli digit
product add product digit carri
radix
product radix
product mant length
find sig digit
mant length result
mant length
product
copi digit result
mant length
result mant mant length product
fixup expon
result exp exp exp mant length
result sign sign sign
result mant mant length
result set exp
result exp
excp
mant length
excp result round product mant length
excp result round effect check statu
excp
result dotrap excp multipli trap result
result
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
847c3adb250da55ea0b442e0c88249e91fd4c4bf | 34e279f9fcec7503beec1a8b38266b33ddd25b4d | /Lecture/methodPjt/src/kh/java/func/Calc.java | bc19044e05bb40b007c54f4b8a097b4ee71579b5 | [] | no_license | heum-ji/javaProject | 88e60fd8ecc44dce18538d43fc829db8fc381877 | 2d4bf8e645dab99fcf34c8f16f7ca3830dee70bd | refs/heads/main | 2023-05-08T15:38:47.390816 | 2021-06-06T15:51:50 | 2021-06-06T15:51:50 | 337,325,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 737 | java | package kh.java.func;
public class Calc {
public void main() {
int num1 = 10;
int num2 = 3;
int result1 = addFunction(num1, num2);
int result2 = subFunction(num1, num2);
int result3 = mulFunction(num1, num2);
double result4 = divFunction(num1, num2);
System.out.println(result1);
System.out.println(result2);
System.out.println(result3);
System.out.printf("%.2f", result4);
}
public int addFunction(int num1, int num2) {
return num1 + num2;
}
public int subFunction(int num1, int num2) {
return num1 - num2;
}
public int mulFunction(int num1, int num2) {
return num1 * num2;
}
public double divFunction(int num1, int num2) {
return (double) num1 / num2;
}
}
| [
"dragon2009t@gmail.com"
] | dragon2009t@gmail.com |
9a16a33cd6d08d7779168481e2b6ffb57ba35ca5 | 8df232c528b1a95f92e4af4aac96d2fe5d1476e3 | /app/src/main/java/com/example/ping/utils/Constant.java | 990992e0e0d925b3d294dc6854c9273e3e43fcf9 | [] | no_license | saloni-singh14/Ping | e9bfb1fbe909f645e853543eb54afb3afc7e1895 | 8177422cf2f3dc4fb1683456c07238cad334e185 | refs/heads/main | 2023-06-15T16:00:48.206684 | 2021-07-13T19:17:07 | 2021-07-13T19:17:07 | 383,174,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 495 | java | package com.example.ping.utils;
import io.agora.rtc.RtcEngine;
public class Constant {
public static final String MEDIA_SDK_VERSION;
static {
String sdk = "undefined";
try {
sdk = RtcEngine.getSdkVersion();
} catch (Throwable e) {
}
MEDIA_SDK_VERSION = sdk;
}
public static boolean SHOW_VIDEO_INFO = true;
public static final String USER_STATE_OPEN = "Open";
public static final String USER_STATE_LOCK = "Lock";
}
| [
"s.saloni1401@gmail.com"
] | s.saloni1401@gmail.com |
fb73d78d65454163514845c844efb50492fb1f65 | 827bd3b5a00b2b41ed35cbb0c7d0e3ac849af7a5 | /resource/src/main/java/com/example/resource/utils/LogUtils.java | b1f01d49b35070fad4bcf43a25b50fe4bef97388 | [] | no_license | eeqg/MyBaseProject2 | f185bae0b3230bcf024c64ff9d5714ecd2383efa | fcf9ad5ff3700dde69a84c4daf543aca90d1d6ec | refs/heads/master | 2020-03-21T12:41:41.389612 | 2019-04-03T10:07:28 | 2019-04-03T10:07:28 | 138,567,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,224 | java | package com.example.resource.utils;
import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.FormatStrategy;
import com.orhanobut.logger.Logger;
import com.orhanobut.logger.PrettyFormatStrategy;
/**
* 日志工具类
*/
public class LogUtils {
private static boolean mIsShowToast = true;
private static boolean mIsFormat = true;
private final static String TAG = "BaseProject";
static {
FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
.showThreadInfo(false) // (Optional) Whether to show thread info or not. Default true
.methodCount(1) // (Optional) How many method line to show. Default 2
.methodOffset(1) // (Optional) Hides internal method calls up to offset. Default 5
// .logStrategy(customLog) // (Optional) Changes the log strategy to print out. Default LogCat
.tag(TAG) // (Optional) Global tag for every log. Default PRETTY_LOGGER
.build();
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
}
public static void d(String tag, String msg) {
if (mIsFormat) {
Logger.t(tag).d(msg);
} else {
Log.d(tag, msg);
}
}
public static void d(Object msg) {
if (mIsFormat) {
Logger.d(msg);
} else {
Log.d(TAG, msg + "");
}
}
public static void i(String tag, String msg) {
if (mIsFormat) {
Logger.t(tag).i(msg);
} else {
Log.i(tag, msg);
}
}
public static void w(String tag, String msg) {
if (mIsFormat) {
Logger.t(tag).w(msg);
} else {
Log.w(tag, msg);
}
}
public static void e(String tag, String msg) {
if (TextUtils.isEmpty(msg))
return;
if (mIsFormat) {
Logger.t(tag).e(msg);
} else {
Log.e(tag, msg);
}
}
public static void e(String msg, Throwable throwable) {
if (mIsFormat) {
Logger.e(msg);
} else {
Log.e(TAG, msg);
}
}
public static void json(String json) {
if (mIsFormat) {
Logger.json(json);
} else {
Log.d(TAG, json);
}
}
/**
* 带toast的error日志输出
*
* @param act act
* @param msg 日志
*/
public static void errorWithToast(Activity act, String msg) {
if (mIsFormat) {
Logger.e(msg);
} else {
Log.e(TAG, msg);
}
showToast(act, msg);
}
/**
* 带toast的error日志输出
*
* @param act act
* @param msg 日志
*/
public static void errorWithToast(Activity act, String msg, Throwable throwable) {
if (mIsFormat) {
Logger.e(throwable, msg);
} else {
Log.e(TAG, msg);
}
showToast(act, msg);
}
/**
* 带toast的debug日志输出
*
* @param act act
* @param msg 日志
*/
public static void debugWithToast(Activity act, String msg) {
if (mIsFormat) {
Logger.d(msg);
} else {
Log.d(TAG, msg);
}
showToast(act, msg);
}
/**
* 带toast的debug日志输出
*/
public static void onClick() {
if (mIsFormat) {
Logger.d("*** onClick ***");
} else {
Log.d(TAG, "*** onClick ***");
}
}
/**
* 带toast的debug日志输出
*
* @param msg 日志
*/
public static void onClick(String msg) {
if (mIsFormat) {
Logger.d("*** onClick ***" + msg);
} else {
Log.d(TAG, "*** onClick ***" + msg);
}
}
/**
* 带toast的debug日志输出
*
* @param act act
* @param msg 日志
*/
public static void onClickWithToast(Activity act, String msg) {
if (mIsFormat) {
Logger.d("*** onClick ***" + msg);
} else {
Log.d(TAG, "*** onClick ***" + msg);
}
showToast(act, msg);
}
/**
* toast,带判断isShowToast和isDebugMode
*
* @param msg 内容
*/
private static void showToast(Context context, String msg) {
if (mIsShowToast) {
Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
}
}
public static void test(String msg) {
if (mIsFormat) {
Logger.d("test ==> " + msg);
} else {
Log.d(TAG, "test ==> " + msg);
}
}
public static void testWithOutFormat(String msg) {
Log.i("test", msg);
}
public static boolean isShowToast() {
return mIsShowToast;
}
public static void setShowToast(boolean mIsShowToast) {
LogUtils.mIsShowToast = mIsShowToast;
}
}
| [
"876583632@qq.com"
] | 876583632@qq.com |
1b4c24693114dd8448a430a0a52ac8842d920121 | ec94a868414f7f0c457335236e5c6b58129b5503 | /HighPlan.java | 201b39791fea89219f04f4bc7d8b7e3b57dfb838 | [] | no_license | kdg5861/Corporation | 1207aa456bb1e5aedb7bb43a4cc82cf60f9a3b19 | 0c16ab078515b1f9d4408a01bf641110d02bba5e | refs/heads/master | 2020-12-30T12:35:32.752760 | 2017-05-16T00:14:00 | 2017-05-16T00:14:00 | 91,394,951 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | /** Kyle Gorlick
HighPlan Class*/
public class HighPlan implements Benefits
{
public double getDeduct()
{
return 200;
}
public double getOfficeVisit()
{
return 20;
}
public double getEmergency()
{
return 0;
}
public double getMax()
{
return 50000;
}
public double getCost()
{
return 2000;
}
} | [
"noreply@github.com"
] | kdg5861.noreply@github.com |
e14568011f13d56ccda28c29c71c234a99494a02 | 956395698bb472308c5a9d2ffeb90b0c444cfb44 | /src/main/java/base/app.java | 103a66405a2ad3c6065dd45facb0a2d49c497801 | [] | no_license | anthonyisadulting/banaag-cop-3330-ex10 | 049c376700c33e9506724f369e22ea7d84d6c4d6 | da6b239ae6891dcf35c994cc9c5c03f9979245ab | refs/heads/master | 2023-05-07T02:13:14.900869 | 2021-06-06T20:16:06 | 2021-06-06T20:16:06 | 374,455,546 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,349 | java | package base;
import java.util.Scanner;
public class app {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.print("Enter the price of item 1:");
String item1 = in.nextLine();
int i1 = Integer.parseInt(item1);
System.out.print("Enter the quantity of item 1:");
String quantity1 = in.nextLine();
int q1 = Integer.parseInt(quantity1);
System.out.print("Enter the price of item 2:");
String item2 = in.nextLine();
int i2 = Integer.parseInt(item2);
System.out.print("Enter the quantity of item 2:");
String quantity2 = in.nextLine();
int q2 = Integer.parseInt(quantity2);
System.out.print("Enter the price of item 3:");
String item3 = in.nextLine();
int i3 = Integer.parseInt(item3);
System.out.print("Enter the quantity of item 3:");
String quantity3 = in.nextLine();
int q3 = Integer.parseInt(quantity3);
double subtotal = (i1*q1) + (i2*q2) + (i3*q3);
double tax = subtotal * 0.055;
double total = subtotal + tax;
System.out.println("Subtotal: $"+ subtotal);
System.out.println("Tax: $"+ tax);
System.out.println("Total: $"+ total);
System.out.print("");
}
}
| [
"anthonyisadulting@gmail.com"
] | anthonyisadulting@gmail.com |
f90b447af41cccbf41c967d4bc0cd0487482b8e0 | 7636110a2002631d67ffa766d7212dd6d698f809 | /src/main/java/com/lv/basui/service/impl/UserServiceImpl.java | e05d7024e2e6eb77cc720d8ac03ca1e0a0289b01 | [] | no_license | zxxzking/basui | f81cd3934001c086f2a762cf017bd7d26fed6f3e | 4fc56aa0a5d03c4691b088624e0efef36ca1a2d9 | refs/heads/master | 2022-07-06T18:23:48.181625 | 2021-04-19T09:33:38 | 2021-04-19T09:33:38 | 110,630,951 | 0 | 0 | null | 2022-06-20T23:59:57 | 2017-11-14T02:40:39 | Java | UTF-8 | Java | false | false | 2,050 | java | package com.lv.basui.service.impl;
import com.denghb.dbhelper.DbHelper;
import com.lv.basui.dao.UserDao;
import com.lv.basui.dto.CheckDto;
import com.lv.basui.entity.User;
import com.lv.basui.exception.BaseException;
import com.lv.basui.service.UserService;
import com.lv.basui.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserDao userDao;
@Autowired
private DbHelper dbHelper;
@Override
public boolean checkUserName(String userName) {
return userDao.checkUserName(userName);
}
@Override
public boolean saveUser(User user) throws Exception{
boolean b = checkUserName(user.getName());
if(!b){
throw new BaseException("1001","用户名已存在");
}
return userDao.saveUser(user);
}
@Override
public CheckDto loginCheck(String userName,String password)throws Exception{
CheckDto dto = new CheckDto();
User user = userDao.queryUserByName(userName);
if(null == user){
throw new BaseException("1001","用户不存在");
}
String newPassword = SecurityUtils.string2MD5(password);
if(!newPassword.equals(user.getPassWord())){
throw new BaseException("1002","密码错误");
}
dto.setUser(user);
return dto;
}
@Override
public User getUser(String userName){
String sql = "select * from user where name = ? and isactive = '1'";
return dbHelper.queryForObject(sql,User.class,userName);
}
@Override
public User getUser(Long userId){
String sql = "select * from user where id = ? and isactive = '1'";
return dbHelper.queryForObject(sql,User.class,userId);
}
public static void main(String[] args) {
char i = '1';
String s = String.valueOf(i);
System.out.println(Integer.valueOf(s));
}
}
| [
"lvquan@paicaifu.com"
] | lvquan@paicaifu.com |
48e5289595f7cdc4f175df391ec4f3f88d772dd2 | 0428f24b2e39b4919bb0e837957262a36e0b2ac9 | /CPS_Client/src/CPS_Clients/Controllers/Employee/ProduceReportController.java | 45c791c92c942256847cbce39c942b16c0b8fec1 | [] | no_license | GolanAdi2004/CPS | 59267b468ad5bf086f1e38293ba0f1c0b99d4d0f | de21ea9591124c4c8ac79e9f35883209341a0e0d | refs/heads/master | 2021-05-06T13:08:42.668200 | 2018-01-11T11:23:47 | 2018-01-11T11:23:47 | 113,176,598 | 0 | 0 | null | 2017-12-05T12:00:19 | 2017-12-05T12:00:19 | null | UTF-8 | Java | false | false | 2,649 | java | package CPS_Clients.Controllers.Employee;
import CPS_Clients.ConstsEmployees;
import CPS_Utilities.DialogBuilder;
import clientServerCPS.RequestsSender;
import clientServerCPS.ServerResponse;
import entities.ComplaintsReport;
import entities.DisabledReport;
import entities.PerformanceReport;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Alert.AlertType;
public class ProduceReportController extends EmployeeBaseController
{
@FXML
void OnReservationReport(ActionEvent event)
{
myControllersManager.SetScene(ConstsEmployees.ReservationReport,ConstsEmployees.ProduceReport);
}
@FXML
void OnComaplaintsReport(ActionEvent event)
{
ServerResponse<ComplaintsReport>ComplaintsRes= RequestsSender.GetComplaintsReport();
ComplaintsReport complaintReport=ComplaintsRes.GetResponseObject();
String out="Complaints Amount: " + complaintReport.getComplaintAmount()+"\n"+"Handled Complaints: " + complaintReport.getHandledComplaints();
DialogBuilder.AlertDialog(AlertType.INFORMATION, "", out, null,false);
}
@FXML
void OnDisabledParkingSpotReport(ActionEvent event)
{
ServerResponse<DisabledReport>Res= RequestsSender.GetDisabledReport("all");
DisabledReport Disabledreport=Res.GetResponseObject();
int actice= Disabledreport.getActiveList().size();
String out="Number of disabled parking spots during the quarterly: " + Disabledreport.getDisabledAmount()+"\n"+ "Number of parking spots that have already been activized: "+ actice;
DialogBuilder.AlertDialog(AlertType.INFORMATION, "", out, null,false);
}
@FXML
void OnPerformanceReport(ActionEvent event)
{
ServerResponse<PerformanceReport>Res= RequestsSender.GetPerformanceReport();
PerformanceReport PrefReport=Res.GetResponseObject();
String out="Memberships amount: " + PrefReport.getMembershipAmount()+"\n"+"Number of members with multiple cars: " + PrefReport.getMembersMultipleCars();
DialogBuilder.AlertDialog(AlertType.INFORMATION, "", out, null,false);
}
@FXML
void OnActivityReport(ActionEvent event)
{
myControllersManager.SetScene(ConstsEmployees.ActivityReport,ConstsEmployees.ProduceReport);
}
@FXML
void OnBack(ActionEvent event)
{
myControllersManager.Back(PreviousScene,ConstsEmployees.ProduceReport );
}
@FXML
void OnStatusReport(ActionEvent event)
{
myControllersManager.SetScene(ConstsEmployees.StatusReport,ConstsEmployees.ProduceReport);
}
}
| [
"34197139+benalfassy@users.noreply.github.com"
] | 34197139+benalfassy@users.noreply.github.com |
c10a92ec2ce45158b01d25103f22d3bdda8246e0 | 4d0cf6a9e5cd8fb8f635fde583410703222335b6 | /src/main/java/com/boot/controller/HomeController.java | a7861c6c2c425db3717b643ea890f17d32f7e247 | [
"MIT"
] | permissive | vinayrl/education | f55c8dbecba09b3990d58f32dfcf45bf84cda278 | e673133f56f80b27d6ffc91ae327a133f4c4cc72 | refs/heads/master | 2021-09-01T12:41:48.532982 | 2017-12-27T02:17:57 | 2017-12-27T02:17:57 | 115,471,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 368 | java | package com.boot.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping("/home")
public class HomeController {
@RequestMapping(method = RequestMethod.GET)
public String home(){
return "home";
}
}
| [
"vinayrl@users.noreply.github.com"
] | vinayrl@users.noreply.github.com |
e5676155d0fd51b03012f3c1c45c0849cb8dbd1b | a53f34d27b522cbfd98fcd2460cbf6bebf87a8a1 | /CGB-JAVASE-V1.01/src/main/java/com/test/test2.java | e201bb65aac0a879aec7d0411e48baed8f2ab5b5 | [] | no_license | LengendTang/springcloud | 08528da7c4b98fced9ba81218fa77d25a7d6da08 | 39958ab6ce0f6f993b8f869fcd80d41e2344782a | refs/heads/master | 2022-12-24T17:17:53.325994 | 2019-08-02T01:58:59 | 2019-08-02T02:20:08 | 200,145,164 | 0 | 0 | null | 2022-12-16T12:01:08 | 2019-08-02T01:47:30 | JavaScript | UTF-8 | Java | false | false | 85 | java | package com.test;
public interface test2 {
int a = 1;
String b = "nin";
}
| [
"000@000-PC"
] | 000@000-PC |
18e155223caadde5b0333d6c6d72650a443b774d | 62a27aa6fae3f9a3def0b12b69cd79588c574ec8 | /src/main/java/it/polimi/se2018/networking/socket/SocketReceiverInterface.java | c3b6141e20a710836a1b9ec5e3fda0e55c373fb8 | [] | no_license | jacopopiogargano/Sagrada-BSc-Thesis | 7728cc0cf9d71828532c64bb4d8fa3bfda84518a | 943939443b887610508eeaea764f7aae4bab4456 | refs/heads/master | 2020-04-07T20:03:30.386085 | 2018-11-22T09:53:46 | 2018-11-22T09:53:46 | 158,673,742 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 884 | java | package it.polimi.se2018.networking.socket;
import it.polimi.se2018.networking.NetworkingException;
import it.polimi.se2018.utils.Message;
/**
* Interface for Socket Receiver
*
* @author Federico Haag
*/
public interface SocketReceiverInterface{
/**
* Received a message from the specified sender.
* @param message the message received
* @param sender the sender of the message
* @throws NetworkingException if something receiving message went wrong due to connection problems
*/
void receiveMessage(Message message, SocketClientProxy sender) throws NetworkingException;
/**
* Method used by server threads that have to notify server of some kind
* of unhandlable failure that happened during their running.
*
* @param reason the string containing the explanation of the failure
*/
void fail(String reason);
}
| [
"jacopopio.gargano@mail.polimi.it"
] | jacopopio.gargano@mail.polimi.it |
58069bd03bad9a88f582fec651a4c8d561f3b264 | 8e8f550bde9f68860d87c018748ded3861585400 | /app/src/main/java/mohkarmon/a4moc/lbj/LoginActivity.java | d8f8a449d66c4a3909415b980c553fca59cb9fa2 | [] | no_license | KaranGuljinder/DesignPatterns | 37a84c5c347f0fa0cd2c2b070bc4f22f7a936446 | ff136086648fd6ecb5a75d2558cb89d2595b825f | refs/heads/master | 2020-03-23T04:58:04.140926 | 2018-07-16T09:21:30 | 2018-07-16T09:21:30 | 139,831,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,214 | java | package mohkarmon.a4moc.lbj;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import com.facebook.FacebookSdk;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.tasks.Task;
import mohkarmon.a4moc.lbj.Models.User;
import mohkarmon.a4moc.lbj.Models.ConnectedUser;
import mohkarmon.a4moc.lbj.Screens.APIClient;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class LoginActivity extends AppCompatActivity {
private final int RC_SIGN_IN = 573;
private GoogleSignInClient mGoogleSignInClient;
private SignInButton googleLoginButton;
private final String TAG = "LOGIN";
private PrefUtils prefUtils;
private APIEndpointInterface apiEndpointInterface;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.setApplicationId("228954734545096");
FacebookSdk.sdkInitialize(getApplicationContext());
setContentView(R.layout.activity_login);
prefUtils = new PrefUtils(this);
apiEndpointInterface = APIClient.getClient().create(APIEndpointInterface.class);
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestIdToken("147401436499-8v2712bn2amuldvnc6pkm5kfsak52eqg.apps.googleusercontent.com")
.build();
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
googleLoginButton = findViewById(R.id.btn_login_google);
googleLoginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GoogleSignIn();
}
});
}
private void GoogleSignIn() {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, RC_SIGN_IN);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// callbackManager.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
handleSignInResult(task);
}
}
private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
try {
GoogleSignInAccount account = completedTask.getResult(ApiException.class);
String googleToken = account.getIdToken();
prefUtils.saveGOAccessToken(googleToken);
checkLoggedInOrReg(account.getEmail(),account.getGivenName());
} catch (ApiException e) {
Log.w(TAG, "signInResult:failed code=" + e.getStatusCode());
}
}
private void RegisterUser(final String email,String username ,final String authType){
User regUser= new User(username,email,authType);
Call<User> call = apiEndpointInterface.registerUser(regUser);
call.enqueue(new Callback<User>() {
@Override
public void onResponse(Call<User> call, Response<User> response) {
ConnectedUser cUsr = ConnectedUser.getInstance();
cUsr.setEmail(email);
cUsr.setAuthType(authType);
cUsr.setUserid(response.body().getId());
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
@Override
public void onFailure(Call<User> call, Throwable t) {
Log.d("hi",t.toString());
}
});
}
@Override
public void onStart() {
super.onStart();
GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this);
// updateUI(account);
}
private void checkLoggedInOrReg(final String email, final String username){
Call<User> call = apiEndpointInterface.getUser(email);
call.enqueue(new Callback<User>() {
@Override
public void onResponse(Call<User> call, Response<User> response) {
assert response.body() != null;
if(response.body() != null){
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
else {
RegisterUser(email,username, "Google");
}
}
@Override
public void onFailure(Call<User> call, Throwable t) {
Log.d("result",t.toString());
}
});
}
}
| [
"moncifloukili@gmail.com"
] | moncifloukili@gmail.com |
09d220f063e545abd69e357553a589e8874c18ed | 8dfd77caab244debdf56f66b6465e06732364cd8 | /projects/jasn1-compiler/src/test/java-gen/org/openmuc/jasn1/compiler/pkix1explicit88/Validity.java | f397b788e4aee7df9df258f7ea7bf2c35182a52b | [] | no_license | onderson/jasn1 | d195c568b2bf62e9ef558d1caea6e228239ad848 | 6df87b86391360758fa559d55b9aa6fb98c7f507 | refs/heads/master | 2021-08-18T16:30:05.353553 | 2017-07-19T18:39:08 | 2017-07-19T18:39:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,248 | java | /**
* This class file was automatically generated by jASN1 v1.8.2-SNAPSHOT (http://www.openmuc.org)
*/
package org.openmuc.jasn1.compiler.pkix1explicit88;
import java.io.IOException;
import java.io.EOFException;
import java.io.InputStream;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.io.Serializable;
import org.openmuc.jasn1.ber.*;
import org.openmuc.jasn1.ber.types.*;
import org.openmuc.jasn1.ber.types.string.*;
public class Validity implements Serializable {
private static final long serialVersionUID = 1L;
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
public byte[] code = null;
public Time notBefore = null;
public Time notAfter = null;
public Validity() {
}
public Validity(byte[] code) {
this.code = code;
}
public Validity(Time notBefore, Time notAfter) {
this.notBefore = notBefore;
this.notAfter = notAfter;
}
public int encode(BerByteArrayOutputStream os) throws IOException {
return encode(os, true);
}
public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
os.write(code[i]);
}
if (withTag) {
return tag.encode(os) + code.length;
}
return code.length;
}
int codeLength = 0;
codeLength += notAfter.encode(os);
codeLength += notBefore.encode(os);
codeLength += BerLength.encodeLength(os, codeLength);
if (withTag) {
codeLength += tag.encode(os);
}
return codeLength;
}
public int decode(InputStream is) throws IOException {
return decode(is, true);
}
public int decode(InputStream is, boolean withTag) throws IOException {
int codeLength = 0;
int subCodeLength = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
if (totalLength == -1) {
subCodeLength += berTag.decode(is);
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
notBefore = new Time();
int choiceDecodeLength = notBefore.decode(is, berTag);
if (choiceDecodeLength != 0) {
subCodeLength += choiceDecodeLength;
subCodeLength += berTag.decode(is);
}
else {
notBefore = null;
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
notAfter = new Time();
choiceDecodeLength = notAfter.decode(is, berTag);
if (choiceDecodeLength != 0) {
subCodeLength += choiceDecodeLength;
subCodeLength += berTag.decode(is);
}
else {
notAfter = null;
}
int nextByte = is.read();
if (berTag.tagNumber != 0 || berTag.tagClass != 0 || berTag.primitive != 0
|| nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
codeLength += totalLength;
subCodeLength += berTag.decode(is);
notBefore = new Time();
subCodeLength += notBefore.decode(is, berTag);
subCodeLength += berTag.decode(is);
notAfter = new Time();
subCodeLength += notAfter.decode(is, berTag);
if (subCodeLength == totalLength) {
return codeLength;
}
throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
encode(os, false);
code = os.getArray();
}
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
return sb.toString();
}
public void appendAsString(StringBuilder sb, int indentLevel) {
sb.append("{");
sb.append("\n");
for (int i = 0; i < indentLevel + 1; i++) {
sb.append("\t");
}
if (notBefore != null) {
sb.append("notBefore: ");
notBefore.appendAsString(sb, indentLevel + 1);
}
else {
sb.append("notBefore: <empty-required-field>");
}
sb.append(",\n");
for (int i = 0; i < indentLevel + 1; i++) {
sb.append("\t");
}
if (notAfter != null) {
sb.append("notAfter: ");
notAfter.appendAsString(sb, indentLevel + 1);
}
else {
sb.append("notAfter: <empty-required-field>");
}
sb.append("\n");
for (int i = 0; i < indentLevel; i++) {
sb.append("\t");
}
sb.append("}");
}
}
| [
"stefan.feuerhahn@ise.fraunhofer.de"
] | stefan.feuerhahn@ise.fraunhofer.de |
e857d2060c8e6c2a48277006c505edc198bc1ca5 | 719afe20827c01ab6257a07ae00a319cda96d181 | /app/src/main/java/app/appsmatic/com/deliverymasterclintapp/Activites/DeliveryService.java | 5db1dd9aa04609ca1f3ed76de5a09f07e22091e3 | [] | no_license | gilihamu/DeliveryMasterClintApp | 58f279a2effbe03b0d345fcccd2f969acabda7ed | 27d5ecdcb013d324cebba1538a3b331b0c4d4bd2 | refs/heads/master | 2021-03-30T20:50:53.468354 | 2017-04-26T12:57:47 | 2017-04-26T12:57:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,749 | java | package app.appsmatic.com.deliverymasterclintapp.Activites;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Color;
import android.graphics.Typeface;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.maps.CameraUpdateFactory;
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.HashMap;
import app.appsmatic.com.deliverymasterclintapp.API.Models.NewLocaton;
import app.appsmatic.com.deliverymasterclintapp.API.Models.ResLocations;
import app.appsmatic.com.deliverymasterclintapp.API.Models.ResNewLocation;
import app.appsmatic.com.deliverymasterclintapp.API.RetrofitUtilities.ClintAppApi;
import app.appsmatic.com.deliverymasterclintapp.API.RetrofitUtilities.Genrator;
import app.appsmatic.com.deliverymasterclintapp.Adabters.BuranchesPickupAdb;
import app.appsmatic.com.deliverymasterclintapp.Adabters.DeliveryBrunchesAdb;
import app.appsmatic.com.deliverymasterclintapp.Fragments.Settings;
import app.appsmatic.com.deliverymasterclintapp.GPS.GPSTracker;
import app.appsmatic.com.deliverymasterclintapp.R;
import app.appsmatic.com.deliverymasterclintapp.SharedPrefs.SaveSharedPreference;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class DeliveryService extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
private ImageView deliverybtn;
private EditText addressInput;
private Marker marker;
private RecyclerView locationsList;
private LinearLayout userlocationsbox;
private Double lat,lang;
private EditText commentInput,streetAddressInput;
private NewLocaton newLocaton;
private TextView titleTv;
private GPSTracker gpsTracker;
@Override
protected void onCreate(Bundle savedInstanceState) {
overridePendingTransition(R.anim.fadein, R.anim.fadeout);
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.activity_delivery_service);
lat=0.0;
lang=0.0;
gpsTracker = new GPSTracker(getApplicationContext());
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
Window window = this.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//Check Os Ver For Set Status Bar
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimary));
}
deliverybtn=(ImageView)findViewById(R.id.delivery_btn);
userlocationsbox=(LinearLayout)findViewById(R.id.locationsbox);
commentInput=(EditText)findViewById(R.id.comments_input);
addressInput=(EditText)findViewById(R.id.streetname_input);
titleTv=(TextView)findViewById(R.id.deli_title);
//put title font style
Typeface face=Typeface.createFromAsset(getAssets(), "arabicfont.ttf");
titleTv.setTypeface(face);
///Set image language for Delivery button
if(SaveSharedPreference.getLangId(this).equals("ar")){
deliverybtn.setImageResource(R.drawable.send_address_btn_ar);
}else{
deliverybtn.setImageResource(R.drawable.send_address_btn_en);
}
//set action for delivery button
//Check Os Ver
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
deliverybtn.setBackgroundResource(R.drawable.ripple);
}
//User Delivery Locations List Setup
HashMap data=new HashMap();
data.put("userid",SaveSharedPreference.getOwnerId(DeliveryService.this));
Genrator.createService(ClintAppApi.class).getDeleviryLocatons(data).enqueue(new Callback<ResLocations>() {
@Override
public void onResponse(Call<ResLocations> call, Response<ResLocations> response) {
if(response.isSuccessful()){
if(response.body().getCode()==0){
Toast.makeText(getApplicationContext(),"Code from delivery locations is : "+response.body().getCode(),Toast.LENGTH_LONG).show();
}else {
if(response.body().getMessage().isEmpty()){
userlocationsbox.setVisibility(View.INVISIBLE);
}else {
userlocationsbox.setVisibility(View.VISIBLE);
locationsList=(RecyclerView)findViewById(R.id.deleviry_locatiions_list);
locationsList.setAdapter(new DeliveryBrunchesAdb(DeliveryService.this,response.body()));
locationsList.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
//put locations on map
for (int i = 0; i < response.body().getMessage().size(); i++) {
try {
LatLng sydney = new LatLng(response.body().getMessage().get(i).getLatitude(), response.body().getMessage().get(i).getLongtitude());
mMap.addMarker(new MarkerOptions().position(sydney).title(response.body().getMessage().get(i).getBranchName()));
// mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
// float zoomLevel = (float) 10.0; //This goes up to 21
// mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, zoomLevel));
}catch (Exception t){
Toast.makeText(getApplication(),t.getMessage()+"No Google Service",Toast.LENGTH_SHORT);
}
}
}
}
}else {
Toast.makeText(getApplicationContext(),"response Not Success from get delivery Locations",Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure(Call<ResLocations> call, Throwable t) {
Toast.makeText(getApplicationContext(),t.getMessage().toString(),Toast.LENGTH_LONG).show();
}
});
//Delivery button action
deliverybtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (lat == 0.0 & lang == 0.0) {
final AlertDialog.Builder builder = new AlertDialog.Builder(DeliveryService.this);
builder.setMessage("Please Pick Your Location From Map ! ")
.setCancelable(false)
.setIcon(R.drawable.erroricon)
.setTitle(R.string.sysMsg)
.setPositiveButton(R.string.Dissmiss, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
} else {
if (addressInput.getText().toString().isEmpty()) {
addressInput.setHintTextColor(Color.RED);
addressInput.setHint(getResources().getString(R.string.addressempty));
} else {
//Select new Location from map
HashMap data = new HashMap();
newLocaton = new NewLocaton();
newLocaton.setStreetAddress(addressInput.getText() + "");
newLocaton.setComment(commentInput.getText() + "");
newLocaton.setLongtitude(lang);
newLocaton.setLatitude(lat);
data.put("userid", SaveSharedPreference.getOwnerId(getApplicationContext()));
data.put("location", newLocaton);
Genrator.createService(ClintAppApi.class).addNewLocation(data).enqueue(new Callback<ResNewLocation>() {
@Override
public void onResponse(Call<ResNewLocation> call, Response<ResNewLocation> response) {
if (response.isSuccessful()) {
if (response.body().getCode() == 0) {
Toast.makeText(getApplicationContext(), "code 0 from delivery locations addition", Toast.LENGTH_LONG).show();
} else {
startActivity(new Intent(DeliveryService.this, Confirmation.class)
.putExtra("locationId", response.body().getMessage().getLocationID() + "")
.putExtra("servicetype", 2));
Toast.makeText(getApplicationContext(),getResources().getString(R.string.addresssent)+" Id: " + response.body().getMessage().getLocationID() + "", Toast.LENGTH_LONG).show();
finish();
}
} else {
Toast.makeText(getApplicationContext(), "no response from locations addition", Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure(Call<ResNewLocation> call, Throwable t) {
Toast.makeText(getApplicationContext(), t.getMessage(), Toast.LENGTH_LONG).show();
}
});
/*
Gson gson = new Gson();
String data=gson.toJson(sentNewLocation);
Log.e("dataNewLocation : ", data);
*/
}
}
}
});
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
lat=gpsTracker.getLatitude();
lang=gpsTracker.getLongitude();
LatLng currentLocation=new LatLng(lat,lang);
mMap.addMarker(new MarkerOptions().position(currentLocation).title("Your Location").icon(BitmapDescriptorFactory.fromResource(R.drawable.c_locationicon)));
float zoomLevel = (float) 16.0; //This goes up to 21
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLocation, zoomLevel));
Toast.makeText(getApplicationContext(), lat + " " + lang + "", Toast.LENGTH_SHORT).show();
mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
@Override
public void onMapClick(LatLng latLng) {
if (marker != null) {
marker.remove();
}
marker = mMap.addMarker(new MarkerOptions()
.position(
new LatLng(latLng.latitude, latLng.longitude))
.draggable(true).visible(true).title("New Place"));
lat = latLng.latitude;
lang = latLng.longitude;
Toast.makeText(getApplicationContext(), lat + " " + lang + "", Toast.LENGTH_SHORT).show();
}
});
}
}
| [
"ai.rabie89@hotmail.com"
] | ai.rabie89@hotmail.com |
7da225fc7808d7148e066abe91fd1a7b35942cc6 | 9a3be782e6598d8c3c04fcdc1a22137cd1b61064 | /_15MySpring/src/main/java/com/ld/service/BuyStockException.java | 6b92a4b4883e3a01559c2706cd23eb89b16da265 | [] | no_license | 790443637/MySpring | c10300123a580a5d2d58427ed16e5023ea70ab74 | f6e5abef1caa989ff1b1b210c6b64e333238dbed | refs/heads/master | 2021-05-12T14:40:06.661663 | 2018-03-16T15:00:01 | 2018-03-16T15:00:01 | 116,963,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package com.ld.service;
import org.springframework.stereotype.Service;
public class BuyStockException extends RuntimeException {
public BuyStockException(String msg){
super(msg);
}
public BuyStockException(String msg,Throwable a){
super(msg,a);
}
}
| [
"790443637@qq.com"
] | 790443637@qq.com |
7e298fd4966a6965a1b97999d9d2aa560199160b | e51644d95fd93cf01a0b0bc2132b43abe2576f61 | /src/FlightInputData.java | 210270ac128d7e3259399fb5ab655f30af40c5a2 | [] | no_license | Arun-Josh/ATCAlgorithm | 68b23b6fde87035a250f735ef68096bfad31ff1e | cd1e91a67c44573f8d29aaba0b16d77849bfb606 | refs/heads/master | 2020-04-25T08:28:31.440385 | 2019-02-26T06:05:29 | 2019-02-26T06:05:29 | 172,648,546 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,063 | java | import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import java.util.Scanner;
public class FlightInputData{
public FlightInputData(){}
protected Flight input(String airline) throws Exception{
Scanner scan = new Scanner(System.in);
// System.out.print("Enter flight number : ");
// String flightno = scan.nextLine();
// System.out.print("Enter flight size [S/M/L] : ");
// String flightsize = scan.nextLine();
// System.out.print("Enter the Date of Arrival at source airport [DD-MM-YYYY] : ");
// String sdate = scan.nextLine();
// System.out.print("Enter the Time at Arrival at source airport [HH:MM] (24 Hour) : ");
// String stime = scan.nextLine();
// stime = stime.concat(":00");
// System.out.print("Enter the Date of Arrival at destination airport [DD-MM-YYYY] : ");
// String ddate = scan.nextLine();
// System.out.print("Enter the Time at Arrival at destination airport [HH:MM] (24 Hour) : ");
// String dtime = scan.nextLine();
// dtime = dtime.concat(":00");
// System.out.print("Enter Ground time at source Airport [HH:MM] (24hour) : ");
// String gtsource = scan.nextLine();
// gtsource = gtsource.concat(":00");
// System.out.print("Enter Ground time at destination Airport [HH:MM] (24hour) : ");
// String gtdest = scan.nextLine();
// gtdest = gtdest.concat(":00");
// System.out.print("Enter Source Airport : ");
// String sourceport = scan.nextLine();
// System.out.print("Enter Destination Airport : ");
// String destport = scan.nextLine();
// Will be later changed ( Allocation Status )
boolean allocationstatus = false;
//Testing values
Random rand = new Random();
String flightno = Integer.toString(rand.nextInt(10000));
String flightsize = "M";
String sday = "16-10-2019";
String stime = "06:30:00";
String dday = "16-10-2019";
String dtime = "05:50:00";
String gtsource = "00:30:00";
String gtdest = "00:30:00";
String sourceport = "chennai";
String destport = "mumbai";
SimpleDateFormat dateformat = new SimpleDateFormat("dd-MM-yyyy");
Date sourcedate = dateformat.parse(sday);
Date destdate = dateformat.parse(dday);
SimpleDateFormat timeformat = new SimpleDateFormat("hh:mm:ss");
Date sourcetime = timeformat.parse(stime);
Date desttime = timeformat.parse(dtime);
Date gts = timeformat.parse(gtsource);
Date gtd = timeformat.parse(gtdest);
return new Flight(airline, flightno,flightsize,sourcedate,destdate, sourcetime, desttime, gts, gtd, sourceport.toLowerCase(),destport.toLowerCase(), allocationstatus);
}
}
| [
"astralarunjosh@gmail.com"
] | astralarunjosh@gmail.com |
116a176d447d3a05e84085e52bb75baad5fede7e | 6fd8ffb754d825cd539abd040b61a31659366ce8 | /src/com/landawn/abacus/util/function/ToFloatFunction.java | 1e3cf67684baec1a340b336073bab65471860586 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | landawn/AbacusUtil | 12412bf0121573c5f5286c2fe2ce4184c7456148 | 394f6acd18ea907216facfc490b47991c30ac153 | refs/heads/master | 2022-06-26T07:16:15.258994 | 2022-01-23T02:56:26 | 2022-01-23T02:56:26 | 49,120,236 | 87 | 15 | Apache-2.0 | 2022-06-21T01:30:27 | 2016-01-06T07:30:39 | Java | UTF-8 | Java | false | false | 1,500 | java | /*
* Copyright (C) 2016 HaiYang Li
*
* 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.landawn.abacus.util.function;
import com.landawn.abacus.util.Try;
/**
*
* @since 0.8
*
* @author Haiyang Li
*/
public interface ToFloatFunction<T> extends Try.ToFloatFunction<T, RuntimeException> {
static final ToFloatFunction<Float> UNBOX = new ToFloatFunction<Float>() {
@Override
public float applyAsFloat(Float value) {
return value == null ? 0 : value.floatValue();
}
};
static final ToFloatFunction<Number> FROM_NUM = new ToFloatFunction<Number>() {
@Override
public float applyAsFloat(Number value) {
return value == null ? 0 : value.floatValue();
}
};
/**
* @deprecated replaced with {@code FROM_NUM}.
*/
@Deprecated
static final ToFloatFunction<Number> NUM = FROM_NUM;
@Override
float applyAsFloat(T value);
}
| [
"landawn@users.noreply.github.com"
] | landawn@users.noreply.github.com |
347d410ef5d50c3780d7dba5f531a672e2af392a | 2a6f6d88218be6e637731481fe43d69086bb3110 | /src/main/java/com/epam/articleweb/articlesdao/IdGeneratorIncrementer.java | 38ae821cefd699e38827cf8882c13bddd6c5dc4d | [] | no_license | YuryYaroshevich/ArticlesWeb | 2b8f3650c2dcc0b4b1b26446f7b4977cef6af207 | ab11fb8828e2df30752f8cddac71b9c52a5210fb | refs/heads/master | 2016-09-06T19:45:59.954543 | 2014-05-11T14:46:24 | 2014-05-11T14:46:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 614 | java | package com.epam.articleweb.articlesdao;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@Component
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
class IdGeneratorIncrementer implements IdGenerator {
private int id = 0;
private Object lock = new Object();
@Override
public int generate() {
synchronized (lock) {
id++;
}
return id;
}
}
| [
"Yury_Yaroshevich@epam.com"
] | Yury_Yaroshevich@epam.com |
3adbbd21f0db892dc33092859a0f1c2ed3c00555 | 85138ab3ea89c15e7290aaab9abfdc93f4c01cfa | /app/src/main/java/com/dingzhu/appstore/ui/fragment/HomeFragment.java | d7b952787bf21b7c2688312f3089d2a89ddd596d | [] | no_license | liminwu0626/AppStore | f5dad8a35d0a1aeba5177954289188bf3456f7b9 | 34e2a0e09ec960eb839f2e7e1323fdff01d4fe12 | refs/heads/master | 2021-05-11T00:51:05.847724 | 2018-03-04T07:28:56 | 2018-03-04T07:28:56 | 118,311,779 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | package com.dingzhu.appstore.ui.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class HomeFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_home, container, false);
return null;
}
}
| [
"1091423040@qq.com"
] | 1091423040@qq.com |
3f9dd2b98c5cb7b084f9d765115f96da287ab0dc | 4947854f98d0b5a9f141c5259513ba2109399639 | /src/main/java/com/mk/archimate/config/audit/AuditEventConverter.java | b22c9c988981ad35925b322352761cc691852ac0 | [] | no_license | klabim/jhipsterSampleApplication | 30b8ddaf66230ab0a60b6c143b8f5f44f114ce93 | c80c643486b86e4ffaa336684dc75e58cffeba6d | refs/heads/master | 2021-09-16T08:46:12.445338 | 2017-11-07T15:15:08 | 2017-11-07T15:15:08 | 109,852,173 | 0 | 0 | null | 2018-06-18T14:12:53 | 2017-11-07T15:15:05 | Java | UTF-8 | Java | false | false | 3,323 | java | package com.mk.archimate.config.audit;
import com.mk.archimate.domain.PersistentAuditEvent;
import org.springframework.boot.actuate.audit.AuditEvent;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
import org.springframework.stereotype.Component;
import java.util.*;
@Component
public class AuditEventConverter {
/**
* Convert a list of PersistentAuditEvent to a list of AuditEvent
*
* @param persistentAuditEvents the list to convert
* @return the converted list.
*/
public List<AuditEvent> convertToAuditEvent(Iterable<PersistentAuditEvent> persistentAuditEvents) {
if (persistentAuditEvents == null) {
return Collections.emptyList();
}
List<AuditEvent> auditEvents = new ArrayList<>();
for (PersistentAuditEvent persistentAuditEvent : persistentAuditEvents) {
auditEvents.add(convertToAuditEvent(persistentAuditEvent));
}
return auditEvents;
}
/**
* Convert a PersistentAuditEvent to an AuditEvent
*
* @param persistentAuditEvent the event to convert
* @return the converted list.
*/
public AuditEvent convertToAuditEvent(PersistentAuditEvent persistentAuditEvent) {
if (persistentAuditEvent == null) {
return null;
}
return new AuditEvent(Date.from(persistentAuditEvent.getAuditEventDate()), persistentAuditEvent.getPrincipal(),
persistentAuditEvent.getAuditEventType(), convertDataToObjects(persistentAuditEvent.getData()));
}
/**
* Internal conversion. This is needed to support the current SpringBoot actuator AuditEventRepository interface
*
* @param data the data to convert
* @return a map of String, Object
*/
public Map<String, Object> convertDataToObjects(Map<String, String> data) {
Map<String, Object> results = new HashMap<>();
if (data != null) {
for (Map.Entry<String, String> entry : data.entrySet()) {
results.put(entry.getKey(), entry.getValue());
}
}
return results;
}
/**
* Internal conversion. This method will allow to save additional data.
* By default, it will save the object as string
*
* @param data the data to convert
* @return a map of String, String
*/
public Map<String, String> convertDataToStrings(Map<String, Object> data) {
Map<String, String> results = new HashMap<>();
if (data != null) {
for (Map.Entry<String, Object> entry : data.entrySet()) {
Object object = entry.getValue();
// Extract the data that will be saved.
if (object instanceof WebAuthenticationDetails) {
WebAuthenticationDetails authenticationDetails = (WebAuthenticationDetails) object;
results.put("remoteAddress", authenticationDetails.getRemoteAddress());
results.put("sessionId", authenticationDetails.getSessionId());
} else if (object != null) {
results.put(entry.getKey(), object.toString());
} else {
results.put(entry.getKey(), "null");
}
}
}
return results;
}
}
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
e3186cfef74e95c7f05326ff11b1b0fdda50f5ad | 007cc2783c488ccbc61da2c068d0cfa002e2169f | /Factory/sample/client/usdl/Usdl_sc1CallbackHandler.java | 4ca806a9fb3d1a0f48034d149f858c64e8163b08 | [] | no_license | road-framework/SDSN | cdc9806a3948b800191187d3ecb09c1f00ad58b3 | ad3fbb5c6bc67c6afba6dff9bd909e2c2967bd72 | refs/heads/master | 2021-01-11T07:46:37.383430 | 2019-02-25T15:24:19 | 2019-02-25T15:24:19 | 68,914,667 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,787 | java | /**
* Usdl_sc1CallbackHandler.java
* <p/>
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.6.0 Built on : May 17, 2011 (04:19:43 IST)
*/
package usdl;
/**
* Usdl_sc1CallbackHandler Callback class, Users can extend this class and implement
* their own receiveResult and receiveError methods.
*/
public abstract class Usdl_sc1CallbackHandler {
protected Object clientData;
/**
* User can pass in any object that needs to be accessed once the NonBlocking
* Web service call is finished and appropriate method of this CallBack is called.
*
* @param clientData Object mechanism by which the user can pass in user data
* that will be avilable at the time this callback is called.
*/
public Usdl_sc1CallbackHandler(Object clientData) {
this.clientData = clientData;
}
/**
* Please use this constructor if you don't want to set any clientData
*/
public Usdl_sc1CallbackHandler() {
this.clientData = null;
}
/**
* Get the client data
*/
public Object getClientData() {
return clientData;
}
/**
* auto generated Axis2 call back method for getServiceCapabilityAnon method
* override this method for handling normal response from getServiceCapabilityAnon operation
*/
public void receiveResultgetServiceCapabilityAnon(
usdl.Usdl_sc1Stub.GetCapabilityReturn result
) {
}
/**
* auto generated Axis2 Error handler
* override this method for handling error response from getServiceCapabilityAnon operation
*/
public void receiveErrorgetServiceCapabilityAnon(java.lang.Exception e) {
}
}
| [
"indikakumara@users.noreply.github.com"
] | indikakumara@users.noreply.github.com |
9d5fa0ae472cbc08814b3da5d611ccb023273f47 | 02bea09d73532814e5c87d65e62090c1ad20a05e | /src/com/auleSVGWT/server/mobile/JaxRestPeople.java | 07e69e5fbd46f1d831014f92636f05590ae1822d | [] | no_license | nikko31/AuleProjSVGWT | 71666bd55ca37e12f89ac20f7cdb1767fae5826a | aa37916b91c13bfbe85259282ad7116cffa2d146 | refs/heads/master | 2021-01-23T14:03:41.919352 | 2016-10-13T21:37:23 | 2016-10-13T21:37:23 | 53,492,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,372 | java | package com.auleSVGWT.server.mobile;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import javax.servlet.ServletContext;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/persone")
public class JaxRestPeople {
private DatabaseM db;
@Context
private ServletContext servletContext;
@GET
public Response getAllPeople(@QueryParam("number") int number, @QueryParam("search") String search){
System.out.println("il valore di number è"+ number);
if(number!=0 && search!=null){
String result=null;
try{
result=java.net.URLDecoder.decode(search, "UTF-8");
}catch(Exception e){
e.printStackTrace();
}
System.out.println("ottengo :"+result);
result= search.replace('_',' ');
if(controlOfLettersandSpaces(result)){
db= new DatabaseM();
JSONArray arr = db.getPersonSearchJson(number,result);
if(arr != null){
String json = arr.toString();
return Response.ok(json, MediaType.APPLICATION_JSON).build();
}else{
return Response.status(Response.Status.NOT_FOUND).build();
}
}
}else if(number==0 && search==null){
try {
db= new DatabaseM();
JSONArray arr = db.getPeopleJson();
if(arr!=null){
return Response.ok(arr.toJSONString(), MediaType.APPLICATION_JSON).build();
}else {
return Response.status(Response.Status.NOT_FOUND).build();
}
}catch(Exception e){
e.printStackTrace();
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
}
return Response.status(Response.Status.BAD_REQUEST).build();
}
@GET
@Path("/{person}")
public Response getPerson(@PathParam("person") String person){
System.out.println("persona "+person);
try {
String per = person.replace('_',' ');
//System.out.println("persona...."+ per+" "+person);
if(controlOfLettersandSpaceOnly(per)){
System.out.println("passato controllo");
db= new DatabaseM();
String[] persSplit= per.split(" ");
System.out.println(persSplit.length+"lunghezza");
JSONArray arr= null;
if(persSplit.length==2){
arr = db.getPersonJson(persSplit[0], persSplit[1]);
}
if(persSplit.length==3){
arr = db.getPersonJson(persSplit[0]+" "+persSplit[1], persSplit[2]);
if(arr==null){
arr = db.getPersonJson(persSplit[0],persSplit[1]+" "+persSplit[2]);
}
if(arr==null){
arr = db.getPersonJson(persSplit[0],persSplit[2]+" "+persSplit[1]);
}
if(arr==null){
arr = db.getPersonJson(persSplit[1]+" "+persSplit[0], persSplit[2]);
}
}
if(persSplit.length==4){
arr=db.getPersonJson(persSplit[0] + " " + persSplit[1], persSplit[2]+" "+ persSplit[3]);
if(arr==null){
arr=db.getPersonJson(persSplit[0] + " " + persSplit[1], persSplit[3]+" "+ persSplit[2]);
}
if(arr==null){
arr=db.getPersonJson(persSplit[1] + " " + persSplit[0], persSplit[2]+" "+ persSplit[3]);
}
if(arr==null){
arr=db.getPersonJson(persSplit[1] + " " + persSplit[0], persSplit[3]+" "+ persSplit[2]);
}
if(arr==null){
arr=db.getPersonJson(persSplit[0] ,persSplit[1]+ " " + persSplit[2]+" "+ persSplit[3]);
}
if(arr==null){
arr=db.getPersonJson(persSplit[0]+" "+persSplit[1]+ " " + persSplit[2], persSplit[3]);
}
}
//JSONObject obj = db.getPersonJson(per.substring(0, per.lastIndexOf(' ')), per.substring(per.lastIndexOf(' ') + 1));
if(arr != null){
String json = arr.toString();
return Response.ok(json, MediaType.APPLICATION_JSON).build();
}else{
return Response.status(Response.Status.NOT_FOUND).build();
}
}else if(controlDigitOnly(person)){
db= new DatabaseM();
JSONObject obj = db.getPersonWithIDJson(person);
if(obj != null){
String json = obj.toString();
return Response.ok(json, MediaType.APPLICATION_JSON).build();
}else{
return Response.status(Response.Status.NOT_FOUND).build();
}
}
}catch(Exception e){
e.printStackTrace();
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
return Response.status(Response.Status.BAD_REQUEST).build();
}
@GET
@Path("/{person}/stanze")
public Response getRoomsOfPerson(@PathParam("person") String person){
try {
String per = person.replace('_',' ');
if(controlOfLettersandSpaceOnly(per)){
db = new DatabaseM();
String[] persSplit= per.split(" ");
System.out.println(persSplit.length+"lunghezza");
JSONArray arr= null;
if(persSplit.length==2){
arr = db.getOccupedRoomOfPersonJson(persSplit[0], persSplit[1]);
}
if(persSplit.length==3){
arr = db.getOccupedRoomOfPersonJson(persSplit[0] + " " + persSplit[1], persSplit[2]);
if(arr==null){
arr = db.getOccupedRoomOfPersonJson(persSplit[0], persSplit[1] + " " + persSplit[2]);
}
if(arr==null){
arr = db.getOccupedRoomOfPersonJson(persSplit[0], persSplit[2] + " " + persSplit[1]);
}
if(arr==null){
arr = db.getOccupedRoomOfPersonJson(persSplit[1] + " " + persSplit[0], persSplit[2]);
}
}
if(persSplit.length==4){
arr=db.getOccupedRoomOfPersonJson(persSplit[0] + " " + persSplit[1], persSplit[2] + " " + persSplit[3]);
if(arr==null){
arr=db.getOccupedRoomOfPersonJson(persSplit[0] + " " + persSplit[1], persSplit[3] + " " + persSplit[2]);
}
if(arr==null){
arr=db.getOccupedRoomOfPersonJson(persSplit[1] + " " + persSplit[0], persSplit[2] + " " + persSplit[3]);
}
if(arr==null){
arr=db.getOccupedRoomOfPersonJson(persSplit[1] + " " + persSplit[0], persSplit[3] + " " + persSplit[2]);
}
if(arr==null){
arr=db.getOccupedRoomOfPersonJson(persSplit[0], persSplit[1] + " " + persSplit[2] + " " + persSplit[3]);
}
if(arr==null){
arr=db.getOccupedRoomOfPersonJson(persSplit[0]+" "+persSplit[1]+ " " + persSplit[2], persSplit[3]);
}
}
if(arr != null){
String json = arr.toString();
return Response.ok(json, MediaType.APPLICATION_JSON).build();
}else{
return Response.status(Response.Status.NOT_FOUND).build();
}
}else if(controlDigitOnly(person)){
db = new DatabaseM();
JSONArray arr = db.getOccupedRoomOfPersonWithIdJson(person);
if(arr != null){
String json = arr.toString();
return Response.ok(json, MediaType.APPLICATION_JSON).build();
}else{
return Response.status(Response.Status.NOT_FOUND).build();
}
}
}catch(Exception e){
e.printStackTrace();
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
return Response.status(Response.Status.BAD_REQUEST).build();
}
//-----------------------Controls------------------
private boolean controlOfLettersandSpaceOnly(String s) {
System.out.println("control letter space only");
int counter =0;
for(int i = 0; i < s.length(); i++) {
if(s.charAt(i)==' '){
counter ++;
}
if (!Character.isLetter(s.charAt(i)) && s.charAt(i)!=' ' && s.charAt(i)!='`' && s.charAt(i)!='\''){
//System.out.println(s.charAt(i)+" == non lo so");
System.out.println("controlOfLettersandSpaceOnly non superato");
return false;
}
}
return counter <= 3 && counter >= 1;
}
private boolean controlOfLettersandSpaces(String s) {
System.out.println("control letter spaces");
for(int i = 0; i < s.length(); i++) {
if (!Character.isLetter(s.charAt(i)) && s.charAt(i)!=' ' && s.charAt(i)!='`' && s.charAt(i)!='\''){
System.out.println("controlOfLettersandSpaces non superato");
return false;
}
}
return true;
}
private boolean controlDigitOnly(String s) {
System.out.println("control digit only");
for(int i = 0; i < s.length(); i++) {
if (!Character.isDigit(s.charAt(i))){
System.out.println("controlDigitOnly non superato");
return false;
}
}
return true;
}
}
| [
"f.fulgeri@gmail.com"
] | f.fulgeri@gmail.com |
2e81b520654341311cb9d2752f1e72c229fa5043 | daffd26347380a78b624bba096bed17f45f62de5 | /src/main/java/edu/usc/cs/ir/cwork/nutch/OutlinkUpdater.java | 2c896489a27d373785161b2bc5c1e5f6536e5218 | [] | no_license | thammegowda/parser-indexer | fa56926c423c0191d08765437a40fbdc87566720 | eefdbf8a6be781c6390bc057c34e5f289fd2cc24 | refs/heads/master | 2021-01-10T03:00:35.172609 | 2016-03-23T19:09:31 | 2016-03-23T19:09:31 | 47,856,913 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 9,502 | java | package edu.usc.cs.ir.cwork.nutch;
import edu.usc.cs.ir.cwork.solr.SolrDocUpdates;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.nutch.parse.Outlink;
import org.apache.nutch.parse.Parse;
import org.apache.nutch.parse.ParseResult;
import org.apache.nutch.parse.ParseSegment;
import org.apache.nutch.parse.ParseUtil;
import org.apache.nutch.protocol.Content;
import org.apache.nutch.util.NutchConfiguration;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.common.SolrInputDocument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.function.Function;
/**
* Created by tg on 12/21/15.
*/
public class OutlinkUpdater implements Runnable, Function<Content, SolrInputDocument> {
public static final Logger LOG = LoggerFactory.getLogger(OutlinkUpdater.class);
@Option(name="-list", usage = "File containing list of segments", required = true)
private File segmentListFile;
@Option(name="-dumpRoot", usage = "Path to root directory of nutch dump", required = true)
private static String dumpDir = "/data2/";
@Option(name="-nutch", usage = "Path to nutch home directory. Hint: path to nutch/runtime/local", required = true)
private File nutchHome;
@Option(name = "-solr", usage = "Solr URL", required = true)
private URL solrUrl;
@Option(name = "-batch", usage = "Batch size")
private int batchSize = 1000;
private Configuration nutchConf;
private ParseUtil parseUtil;
private SolrServer solrServer;
private Function<URL, String> pathFunction;
private void init() throws MalformedURLException {
//Step 1: Nutch initialization
nutchConf = NutchConfiguration.create();
nutchConf.set("plugin.folders", new File(nutchHome, "plugins").getAbsolutePath());
nutchConf.setInt("parser.timeout", 10);
URLClassLoader loader = new URLClassLoader(
new URL[]{ new File(nutchHome, "conf").toURI().toURL()},
nutchConf.getClassLoader());
nutchConf.setClassLoader(loader);
parseUtil = new ParseUtil(nutchConf);
//Step 2: initialize solr
solrServer = new HttpSolrServer(solrUrl.toString());
//step 3: path function
pathFunction = new NutchDumpPathBuilder(dumpDir);
}
/**
* Finds all segment content parts
* @param directories list of segment directories
* @return list of paths to segment content parts
*/
public static List<String> findContentParts(List<String> directories)
throws IOException, InterruptedException {
List<String> paths = new ArrayList<>();
String cmd[] = {"find", null, "-type", "f", "-regex", ".*/content/part-[0-9]+/data$"};
for (String directory : directories) {
cmd[1] = directory;
LOG.info("Run : {}", Arrays.toString(cmd));
Process process = Runtime.getRuntime().exec(cmd);
//process.wait();
List<String> lines = IOUtils.readLines(process.getInputStream());
LOG.info("Found {} content parts in {}", lines.size(), directory);
paths.addAll(lines);
}
return paths;
}
/**
* Maps the nutch protocol content into solr input doc
* @param content nutch content
* @return solr input document
* @throws Exception when an error happens
*/
public SolrInputDocument apply(Content content){
if (ParseSegment.isTruncated(content)) {
return null;
}
try {
ParseResult result = parseUtil.parse(content);
if (!result.isSuccess()) {
return null;
}
Parse parsed = result.get(content.getUrl());
if (parsed != null) {
Outlink[] outlinks = parsed.getData().getOutlinks();
if (outlinks != null && outlinks.length > 0) {
SolrInputDocument doc = new SolrInputDocument();
URL url = new URL(content.getUrl());
doc.addField("id", pathFunction.apply(url));
doc.addField("url", new HashMap<String, String>() {{
put("set", url.toString());
}});
doc.setField("host", new HashMap<String, String>() {{
put("set", url.getHost());
}});
List<String> links = new ArrayList<>();
List<String> paths = new ArrayList<>();
HashSet<String> uniqOutlinks = new HashSet<>();
for (Outlink outlink : outlinks) {
uniqOutlinks.add(outlink.getToUrl());
}
for (String link : uniqOutlinks) {
links.add(link);
paths.add(pathFunction.apply(new URL(link)));
}
doc.setField("outlinks", new HashMap<String, Object>() {{
put("set", links);
}});
doc.setField("outpaths", new HashMap<String, Object>() {{
put("set", paths);
}});
return doc;
}
} else {
System.err.println("This shouldn't be happening");
}
} catch (Exception e){
e.printStackTrace();
}
return null;
}
/**
* Indexes all the documents in the stream to solr
* @param solr the solr server
* @param docsStream input doc stream
* @param bufferSize buffer size
* @return number of documents indexed
*/
public static long indexAll(SolrServer solr,
Iterator<SolrInputDocument> docsStream,
int bufferSize) {
List<SolrInputDocument> buffer = new ArrayList<>(bufferSize);
long count = 0;
int printDelay = 2 * 1000;
long t1 = System.currentTimeMillis();
while(docsStream.hasNext()) {
buffer.add(docsStream.next());
count++;
if (buffer.size() >= bufferSize) {
// process
try {
solr.add(buffer);
} catch (SolrServerException e) {
try {
Thread.sleep(10*1000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
//One more attempt: add one by one
for (SolrInputDocument document : buffer) {
try {
solr.add(document);
} catch (Exception e1) {
e1.printStackTrace();
}
}
} catch (IOException e) {
LOG.error(e.getMessage(), e);
try {
Thread.sleep(10*1000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
//empty the buffer.
buffer.clear();
}
if (System.currentTimeMillis() - t1 > printDelay) {
t1 = System.currentTimeMillis();
LOG.info("Num docs : {}", count);
}
}
if (!buffer.isEmpty()) {
//process left out docs in buffer
try {
solr.add(buffer);
} catch (SolrServerException | IOException e) {
e.printStackTrace();
}
}
try {
LOG.info("End || Count:: {}", count);
LOG.info("Committing:: {}", solr.commit());
} catch (SolrServerException | IOException e) {
e.printStackTrace();
}
return count;
}
@Override
public void run() {
try {
this.init();
SolrDocUpdates updates = new SolrDocUpdates(this, this.segmentListFile);
updates.setSkipImages(true); //because images wont have outlinks
indexAll(solrServer, updates, batchSize);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception {
//args = "-list /home/tg/tmp/seg.list -dumpRoot /data2 -nutch /home/tg/work/coursework/cs572/nutch -solr http://locahost:8983/solr/collection3".split(" ");
OutlinkUpdater generator = new OutlinkUpdater();
CmdLineParser parser = new CmdLineParser(generator);
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
System.out.println(e.getMessage());
e.getParser().printUsage(System.err);
System.exit(1);
}
generator.init();
generator.run();
}
}
| [
"tgowdan@gmail.com"
] | tgowdan@gmail.com |
69e0fa36ba859d4312456b07fdb714a6ab3998c7 | 9036fc6db1f1074023ba69a7f689de90ac9094f6 | /src/com/leiqjl/ConvertSortedListToBinarySearchTree.java | f6bccfc6ede84a62bcf8f04b3ab6af39f0e13038 | [] | no_license | leiqjl/leetcode | 646e6fc0a7bba120934996203536b6decb62a5a8 | 1d1faf4c283e694143b9886685a6430521d1860e | refs/heads/master | 2023-09-01T06:45:45.353434 | 2023-08-29T09:27:26 | 2023-08-29T09:27:26 | 136,191,772 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 694 | java | package com.leiqjl;
/**
* 109. Convert Sorted List to Binary Search Tree - Medium
*/
public class ConvertSortedListToBinarySearchTree {
public TreeNode sortedListToBST(ListNode head) {
return convert(head, null);
}
private TreeNode convert(ListNode head, ListNode tail) {
if (head == tail) {
return null;
}
ListNode fast = head, slow = fast;
while (fast != tail && fast.next != tail) {
fast = fast.next.next;
slow = slow.next;
}
TreeNode root = new TreeNode(slow.val);
root.left = convert(head, slow);
root.right = convert(slow.next, tail);
return root;
}
}
| [
"leiqjl@gmail.com"
] | leiqjl@gmail.com |
64282ef2c949c5ac47097800b23c515050598ae3 | 143cf9ce1673cd59bbfe484230484abe3916072d | /MethodConverter_git/src/hjow/convert/module/DecryptModule.java | 06fb66680ab6370219fa7d197eb7acd307344633 | [] | no_license | HJOW/MethodConverter | a9aa8bbaf06fa4cfcc806e92bbdd322a926edb33 | 93a308dda11651f2c4a55ee93eb93bfaacfa5182 | refs/heads/master | 2020-03-29T13:28:56.947243 | 2015-06-07T02:30:41 | 2015-06-07T02:30:41 | 31,882,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,721 | java | package hjow.convert.module;
import hjow.methodconverter.ByteConverter;
import hjow.methodconverter.Controller;
import hjow.methodconverter.Padder;
import hjow.methodconverter.Statics;
import hjow.methodconverter.StringTable;
import hjow.methodconverter.ui.StatusBar;
import hjow.methodconverter.ui.StatusViewer;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import kisa.seed.SEED_KISA;
/**
* <p>This module can decrypt text.</p>
*
* <p>이 모듈은 텍스트를 복호화하는 데 사용됩니다.</p>
*
*
* @author HJOW
*
*/
public class DecryptModule implements SecurityModule
{
private static final long serialVersionUID = 8310626723161835401L;
public DecryptModule()
{
}
@Override
public String getName()
{
return getName("en");
}
@Override
public String getName(String locale)
{
if(Statics.isKoreanLocale())
{
return "복호화";
}
else
{
return "Decrypt";
}
}
/**
* <p>Decrypt bytes.</p>
*
* <p>바이트 배열을 복호화합니다.</p>
*
* <p>
* Available algorithm : DES, AES, DESede<br>
* Available keypadMethod : zero, special
* </p>
*
* @param befores : original bytes
* @param key : password
* @param algorithm : How to decrypt
* @param keypadMethod : How to pad key.
* @return bytes
*/
public byte[] convert(byte[] befores, String key, String algorithm, String keypadMethod)
{
return convert(befores, key, algorithm, keypadMethod, null);
}
/**
* <p>Decrypt bytes.</p>
*
* <p>바이트 배열을 복호화합니다.</p>
*
* <p>
* Available algorithm : DES, AES, DESede<br>
* Available keypadMethod : zero, special
* </p>
*
* @param befores : original bytes
* @param key : password
* @param algorithm : How to decrypt
* @param keypadMethod : How to pad key.
* @param charset : Character set
* @return bytes
*/
public byte[] convert(byte[] befores, String key, String algorithm, String keypadMethod, String charset)
{
String paddings = "";
int need_keySize = 8;
boolean useIv = true;
byte[] keyByte;
byte[] ivBytes;
byte[] outputs;
int padType = 0;
String apply_charset = "UTF-8";
if(charset != null) apply_charset = charset;
try
{
keyByte = key.getBytes(apply_charset);
}
catch(Exception e)
{
keyByte = key.getBytes();
}
try
{
String specialPad = keypadMethod;
if(specialPad == null) padType = 0;
else
{
if(specialPad.equalsIgnoreCase("zero") || specialPad.equalsIgnoreCase("0"))
{
padType = 0;
}
else if(specialPad.equalsIgnoreCase("special"))
{
padType = 1;
}
else if(specialPad.equalsIgnoreCase("MD5"))
{
padType = 2;
}
else if(specialPad.equalsIgnoreCase("SHA-512"))
{
padType = 3;
}
else
{
padType = 0;
}
}
}
catch(Exception e)
{
padType = 0;
}
if(algorithm.equalsIgnoreCase("DES"))
{
paddings = "DES/CBC/PKCS5Padding";
need_keySize = 8;
useIv = true;
}
else if(algorithm.equalsIgnoreCase("DESede"))
{
paddings = "TripleDES/ECB/PKCS5Padding";
need_keySize = 24;
useIv = true;
}
else if(algorithm.equalsIgnoreCase("AES"))
{
paddings = "AES";
need_keySize = 16;
useIv = false;
}
else return null;
byte[] checkKeyByte = new byte[need_keySize];
ivBytes = new byte[checkKeyByte.length];
Padder padder = null;
if(padType == 1) padder = new Padder();
else if(padType == 2 || padType == 3)
{
HashModule hashModule = new HashModule();
if(padType == 2)
{
keyByte = hashModule.convert(keyByte, "MD5");
}
else
{
keyByte = hashModule.convert(keyByte, "SHA-512");
}
}
for(int i=0; i<checkKeyByte.length; i++)
{
if(i < keyByte.length)
{
checkKeyByte[i] = keyByte[i];
}
else
{
checkKeyByte[i] = 0;
if(padType == 1) checkKeyByte[i] = padder.getPaddingByte(key.trim());
}
}
keyByte = checkKeyByte;
SecretKeySpec keySpec = new SecretKeySpec(keyByte, algorithm);
IvParameterSpec ivSpec = null;
if(useIv) ivSpec = new IvParameterSpec(ivBytes);
Cipher cipher = null;
try
{
cipher = Cipher.getInstance(paddings);
if(useIv)
{
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
}
else
{
cipher.init(Cipher.DECRYPT_MODE, keySpec);
}
outputs = new byte[cipher.getOutputSize(befores.length)];
for(int i=0; i<outputs.length; i++)
{
outputs[i] = 0;
}
int enc_len = cipher.update(befores, 0, befores.length, outputs, 0);
enc_len = enc_len + cipher.doFinal(outputs, enc_len);
return outputs;
}
catch(Exception e)
{
e.printStackTrace();
Controller.alert(Statics.fullErrorMessage(e));
return null;
}
}
/**
* <p>Decrypt texts.</p>
*
* <p>텍스트를 복호화합니다.</p>
*
* @param before : encrypted text
* @param parameters : parameters (option, key, base64, keypadding are available)
* @return original text
*/
@Override
public String convert(String before, Map<String, String> parameters)
{
return convert(null, null, before, null, null, 20, parameters);
}
/**
* <p>Decrypt texts.</p>
*
* <p>텍스트를 복호화합니다.</p>
*
* @param before : Encrypted text
* @param threadTerm : Thread term. If this is short, the process will finished early, but if this is too short, it will be unstability.
* @param algorithm : How to decrypt the text
* @param key : Password of decryption
* @param keypadding : How to pad key
* @param byteArrayEncoding : How to decrypt bytes
* @return original text
*/
@Override
public String convert(String before, long threadTerm, String algorithm, String key, String keypadding, String byteArrayEncoding)
{
return convert(before, threadTerm, algorithm, key, keypadding, byteArrayEncoding, null);
}
/**
* <p>Decrypt texts.</p>
*
* <p>텍스트를 복호화합니다.</p>
*
* @param before : Encrypted text
* @param threadTerm : Thread term. If this is short, the process will finished early, but if this is too short, it will be unstability.
* @param algorithm : How to decrypt the text
* @param key : Password of decryption
* @param keypadding : How to pad key
* @param byteArrayEncoding : How to decrypt bytes
* @param charset : Character set
* @return original text
*/
public String convert(String before, long threadTerm, String algorithm, String key, String keypadding, String byteArrayEncoding, String charset)
{
return convert(before, threadTerm, algorithm, key, keypadding, byteArrayEncoding, charset, new Hashtable<String, String>());
}
/**
* <p>Decrypt texts.</p>
*
* <p>텍스트를 복호화합니다.</p>
*
* @param before : Encrypted text
* @param threadTerm : Thread term. If this is short, the process will finished early, but if this is too short, it will be unstability.
* @param algorithm : How to decrypt the text
* @param key : Password of decryption
* @param keypadding : How to pad key
* @param byteArrayEncoding : How to decrypt bytes
* @param charset : Character set
* @param parameters : Parameters
* @return original text
*/
@SuppressWarnings("restriction")
public String convert(String before, long threadTerm, String algorithm, String key, String keypadding, String byteArrayEncoding, String charset, Map<String, String> parameters)
{
if(before == null) return null;
String target = new String(before.trim());
String option = algorithm;
String keyParam = key;
if(keyParam == null) return null;
String apply_charset = "UTF-8";
if(charset != null) apply_charset = charset;
byte[] inputs;
boolean useBase64 = false;
try
{
String useBase64Str = byteArrayEncoding;
if(useBase64Str != null)
{
try
{
useBase64 = Statics.parseBoolean(useBase64Str);
}
catch(Exception e)
{
if(useBase64Str.equalsIgnoreCase("base64"))
{
useBase64 = true;
}
else useBase64 = false;
}
}
if(useBase64)
{
inputs = new sun.misc.BASE64Decoder().decodeBuffer(target);
}
else
{
inputs = ByteConverter.stringToBytes(target);
}
}
catch (Exception e1)
{
e1.printStackTrace();
Controller.alert(Statics.fullErrorMessage(e1));
return null;
}
byte[] keyByte;
byte[] ivBytes;
byte[] outputs;
int need_keySize = 128;
boolean useIv = true;
try
{
keyByte = keyParam.getBytes(apply_charset);
}
catch(Exception e)
{
keyByte = keyParam.getBytes();
}
if(option == null) option = "DES";
else option = option.trim();
String paddings = "";
boolean isSeed = false;
boolean useSpecialPad = true;
try
{
String specialPad = keypadding;
if(specialPad == null) useSpecialPad = true;
else
{
if(specialPad.equalsIgnoreCase("zero") || specialPad.equalsIgnoreCase("0"))
{
useSpecialPad = false;
}
else if(specialPad.equalsIgnoreCase("special"))
{
useSpecialPad = true;
}
}
}
catch(Exception e)
{
useSpecialPad = true;
}
if(option.equalsIgnoreCase("DES"))
{
paddings = "DES/CBC/PKCS5Padding";
need_keySize = 8;
useIv = true;
}
else if(option.equalsIgnoreCase("DESede"))
{
paddings = "TripleDES/ECB/PKCS5Padding";
need_keySize = 168;
useIv = true;
}
else if(option.equalsIgnoreCase("AES"))
{
paddings = "AES";
need_keySize = 16;
useIv = false;
}
else if(option.equalsIgnoreCase("SEED"))
{
isSeed = true;
}
else return null;
Padder padder = null;
if(useSpecialPad) padder = new Padder();
byte[] checkKeyByte = new byte[need_keySize];
ivBytes = new byte[checkKeyByte.length];
for(int i=0; i<checkKeyByte.length; i++)
{
if(i < keyByte.length)
{
checkKeyByte[i] = keyByte[i];
}
else
{
checkKeyByte[i] = 0;
if(useSpecialPad) checkKeyByte[i] = padder.getPaddingByte(keyParam.trim());
}
}
keyByte = checkKeyByte;
if(isSeed)
{
return Statics.applyScript(this, parameters, SEED_KISA.decrypt(target, keyParam, useBase64));
}
else
{
SecretKeySpec keySpec = new SecretKeySpec(keyByte, option);
IvParameterSpec ivSpec = null;
if(useIv) ivSpec = new IvParameterSpec(ivBytes);
Cipher cipher = null;
try
{
cipher = Cipher.getInstance(paddings);
if(useIv)
{
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
}
else
{
cipher.init(Cipher.DECRYPT_MODE, keySpec);
}
outputs = new byte[cipher.getOutputSize(inputs.length)];
for(int i=0; i<outputs.length; i++)
{
outputs[i] = 0;
}
int enc_len = cipher.update(inputs, 0, inputs.length, outputs, 0);
enc_len = enc_len + cipher.doFinal(outputs, enc_len);
return Statics.applyScript(this, parameters, new String(outputs, apply_charset));
}
catch(Exception e)
{
e.printStackTrace();
Controller.alert(Statics.fullErrorMessage(e));
return before;
}
}
}
/**
* <p>Decrypt texts.</p>
*
* <p>텍스트를 복호화합니다.</p>
*
* @param stringTable : string table (null)
* @param syntax : syntax table (null)
* @param before : encrypted text
* @param statusViewer : object which is used to show the process is alive
* @param statusField : object which is used to show text
* @param threadTerm : Thread term. If this is short, the process will finished early, but if this is too short, it will be unstability.
* @param parameters : parameters (option, key, base64, keypadding are available)
* @return original text
*/
@Override
public String convert(StringTable stringTable,
Map<String, String> syntax, String before,
StatusViewer statusViewer, StatusBar statusField, long threadTerm,
Map<String, String> parameters)
{
String keyParam = parameters.get("key");
if(keyParam == null)
{
keyParam = parameters.get("defaultoption");
}
if(keyParam == null) return null;
String keypadding = parameters.get("keypadding");
String byteArrayEncoding = null;
try
{
byteArrayEncoding = String.valueOf(Statics.parseBoolean(parameters.get("base64")));
}
catch(Exception e)
{
byteArrayEncoding = null;
}
if(byteArrayEncoding == null)
{
byteArrayEncoding = parameters.get("byteencode");
}
String charset = parameters.get("charset");
return convert(before, threadTerm, parameters.get("option"), keyParam, keypadding, byteArrayEncoding, charset, parameters);
}
/**
* <p>Return available decryption algorithms.</p>
*
* <p>복호화 알고리즘들을 반환합니다.</p>
*/
@Override
public List<String> optionList()
{
List<String> results = new Vector<String>();
results.add("DES");
if(Statics.useUntestedFunction()) results.add("DESede");
results.add("AES");
if(Statics.useUntestedFunction()) results.add("SEED");
return results;
}
@Override
public boolean isAuthorized()
{
return true;
}
@Override
public boolean isAuthCode(String input_auths)
{
return true;
}
@Override
public void close()
{
}
@Override
public String defaultParameterText()
{
return "--key \"password1234\" --byteencode \"base64\"";
}
@Override
public String getParameterHelp()
{
String locale = Controller.getSystemLocale();
String results = "";
if(locale.equalsIgnoreCase("kr") || locale.equalsIgnoreCase("ko") || locale.equalsIgnoreCase("kor")
|| locale.equalsIgnoreCase("ko-KR") || locale.equalsIgnoreCase("korean"))
{
results = results + "사용 가능한 키 : key, keypadding, byteencode" + "\n\n";
results = results + "key : 복호화에 쓰일 비밀번호" + "\n\n";
results = results + "keypadding : 비밀번호를 정해진 길이에 맞추는 방법, zero, special, MD5, SHA-512 사용 가능" + "\n\n";
results = results + "byteencode : 복호화 이전 텍스트를 바이트 데이터로 변환할 방법, longcode 또는 base64 사용 가능" + "\n\n";
}
else
{
results = results + "Available keys : key, keypadding, byteencode" + "\n\n";
results = results + "key : Password of decryption" + "\n\n";
results = results + "keypadding : How to pad the password (Availables : zero, special, MD5, SHA-512)" + "\n\n";
results = results + "byteencode : How to convert text into bytes before decryption (Availables : longcode, base64)" + "\n\n";
}
return results;
}
@Override
public byte[] convert(byte[] befores, Map<String, String> parameters)
{
String key, algorithm, keypadMethod, charset;
key = parameters.get("key");
algorithm = parameters.get("option");
keypadMethod = parameters.get("keypadding");
charset = parameters.get("charset");
return convert(befores, key, algorithm, keypadMethod, charset);
}
@Override
public byte[] convert(byte[] befores, Map<String, String> parameters,
StatusBar statusBar, StatusViewer statusViewer)
{
return convert(befores, parameters);
}
@Override
public boolean isEncryptingModule()
{
return false;
}
@Override
public List<String> parameterKeyList()
{
Vector<String> keys = new Vector<String>();
keys.add("key");
keys.add("keypadding");
keys.add("byteencode");
keys.add("charset");
return keys;
}
@Override
public boolean isOptionEditable()
{
return false;
}
@Override
public String getDefinitionName()
{
return "Decrypt";
}
@Override
public String getHelps()
{
String results = "";
results = results + getName() + "\n\n";
return results + "\n\n" + getParameterHelp();
}
@Override
public String getUrl()
{
return Controller.getDefaultURL();
}
}
| [
"hujinone22@naver.com"
] | hujinone22@naver.com |
176434c2febd2923e9b35451957fcd67636c1d2a | 082fe5dc7c158a15587c0c94211d82bda961e61d | /src/by/epam/hotel/command/impl/LogoutCommand.java | 4f47f95fab02e959da28672fb1994c95653f9388 | [] | no_license | ntzqxp/tryit | d375951542834bf5e02ce9a70ad26db53451a374 | c00e5d7a3bf21074b740b00b19db0e2d964d9a2f | refs/heads/master | 2020-03-31T14:53:13.282543 | 2018-10-10T10:18:41 | 2018-10-10T10:18:41 | 152,313,728 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | package by.epam.hotel.command.impl;
import javax.servlet.http.HttpServletRequest;
import by.epam.hotel.command.ActionCommand;
import by.epam.hotel.controller.Router;
import by.epam.hotel.util.ConfigurationManager;
import by.epam.hotel.util.apptype.RouterType;
import by.epam.hotel.util.constant.PropertyConstant;
public class LogoutCommand implements ActionCommand {
@Override
public Router execute(HttpServletRequest request) {
request.getSession().invalidate();
Router router = new Router();
String page = ConfigurationManager.getProperty(PropertyConstant.PAGE_WELCOME);
router.setPage(page);
router.setType(RouterType.REDIRECT);
return router;
}
}
| [
"moiseyenko.e.a@gmail.com"
] | moiseyenko.e.a@gmail.com |
5d30400a64a0467d12560c6bd1b2eb2038fc9efb | 1147e74b85f97bd94446db577af45525cf2a69e0 | /src/main/java/ru/gbax/messaging/entity/model/MessageSortModel.java | 5efd737fedb853ea0f0b7306049a11f177ea4f0a | [] | no_license | gbax/messaging-rest-service | b52429766097d53040b0d38aa9d75723be98f6f5 | 6d7907264859974a4f353e4cee4e83746dc5c646 | refs/heads/master | 2021-01-25T12:14:05.503475 | 2015-07-26T14:59:23 | 2015-07-26T14:59:23 | 39,728,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package ru.gbax.messaging.entity.model;
/**
* Модель для сортировки сообщений
*/
public class MessageSortModel {
private String sort;
private String order;
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
public String getOrder() {
return order;
}
public void setOrder(String order) {
this.order = order;
}
}
| [
"headshrinker88@gmail.com"
] | headshrinker88@gmail.com |
0569f9204023cc0a86b7d3f801989f0caf77d89a | 29a2a02155943af582784fc8f3e12c44daefc012 | /PHAS3459/src/group1/MonthInfo.java | 1cd36ab69f660c8fb093f3be9a74d749527bf857 | [] | no_license | JosephWstn/PHAS3459 | bc8c3c800c5728d31f3e6516e1e1d99538fd7c5f | 14bf62484aa3059e0ab630b8de64ea162862eefd | refs/heads/master | 2021-03-19T11:35:48.193275 | 2018-01-17T16:38:31 | 2018-01-17T16:38:31 | 106,108,149 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,654 | java | package group1;
import java.util.Scanner;
public class MonthInfo {
int year, month;
String type, region;
double extent, area;
private Double double1;
//constructors - how scanner reads each line
public MonthInfo(){}
public MonthInfo (String line){
Scanner sc = new Scanner(line).useDelimiter(",\\s*");
this.year = sc.nextInt();
this.month = sc.nextInt();
this.type = sc.next();
this.region = sc.next();
this.extent = sc.nextDouble();
this.area = sc.nextDouble();
sc.close();
}
//getter methods to get info
public int getYear() throws Exception{
if (this.year == -9999){
throw new Exception();
}
else{
return this.year;
}
}
public int getMonth() throws Exception{
if (this.month == -9999){
throw new Exception();
}
else{
return this.month;
}
}
public String getType() throws Exception{
if (this.type == "-9999"){
throw new Exception();
}
else{
return this.type;
}
}
public String getRegion()throws Exception{
if (this.region == "-9999"){
throw new Exception();
}
else{
return this.region;
}
}
public double getExtent()throws Exception{
if (this.extent == -9999){
throw new Exception();
}
else{
return this.extent;
}
}
public double getArea()throws Exception{
if (this.area == -9999){
throw new Exception();
}
else{
return this.area;
}
}
public String toString(){
return ("Year: " +this.year+"\nMonth: "+this.month+"\nData-Type: "+this.type+"\nRegion: "+this.region+"\nExtent: "+this.extent+"\nArea: "+this.area);
}
}
| [
"zcapjdw@ucl.ac.uk"
] | zcapjdw@ucl.ac.uk |
c3369bb2015d316b49bf9a34d426a0d877a78da1 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/34/34_ea1be6c83957b15e92bb5e3368a102e814c12e65/NamedPipe/34_ea1be6c83957b15e92bb5e3368a102e814c12e65_NamedPipe_t.java | b4e394ce65a1237c184df0f0a6cfc6a1139e8e7e | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 844 | java | /**
*
*/
package server;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import model.NamedPipeStream;
/**
* @author Derek Carr
*
*/
public class NamedPipe {
private RandomAccessFile pipe;
public NamedPipe() throws FileNotFoundException {
try {
Runtime.getRuntime().exec("rm pipe");
Runtime.getRuntime().exec("chmod 666 pipe");
Runtime.getRuntime().exec("mkfifo pipe");
} catch (IOException e) {
e.printStackTrace();
}
pipe = new RandomAccessFile("./pipe", "rw");
}
public NamedPipeStream readPipe() throws IOException {
String next = pipe.readLine();
NamedPipeStream stream;
if (next != null) {
stream = new NamedPipeStream(next);
} else {
next = null;
stream = null;
}
return stream;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
9663e68b9b0a12f4e8c738aeead33ce006481713 | 5235d4e759156b87bec9d2c51c46297b7a8312a5 | /src/test/FacilityCreationTest.java | 1224f77fe9217af35abead521ae00f55382eaa3c | [] | no_license | PathologyAutomation/PathologyAutomation | d3d103c785e434d64abb836b5bb843a9cdfd737c | 286880cb8c17ccfd936240c1b79e686405145419 | refs/heads/master | 2020-06-02T13:24:58.660641 | 2014-05-08T19:08:27 | 2014-05-08T19:08:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 455 | java | package test;
import org.testng.annotations.Test;
import common.BaseTest;
import entities.Admin;
public class FacilityCreationTest extends BaseTest
{
@Test
public void shouldAbleToCreateFacility()
{
LoginRegisterPage.login(LoginFactory.getAdminLogin());
AdminDashBoardPage.Open(Admin.Facility);
FacitlityManagementPage.New(FaclityFactory.getNewFacility());
FacitlityManagementPage.VerifyFacility(FaclityFactory.getNewFacility());
}
}
| [
"marimuthugceb@gmail.com"
] | marimuthugceb@gmail.com |
3b4bf82ae00079167e1acaea9c1a83791be0fc9e | 160a34361073a54d39ffa14fdae6ce3cbc7d6e6b | /src/main/java/com/alipay/api/domain/AlipayMarketingDataModelQueryModel.java | b67a81493ceffd1886dc880095910de70b92b1c4 | [
"Apache-2.0"
] | permissive | appbootup/alipay-sdk-java-all | 6a5e55629b9fc77e61ee82ea2c4cdab2091e0272 | 9ae311632a4053b8e5064b83f97cf1503a00147b | refs/heads/master | 2020-05-01T09:45:44.940180 | 2019-03-15T09:52:14 | 2019-03-15T09:52:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,482 | java | package com.alipay.api.domain;
import java.util.List;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
/**
* 模型数据查询接口
*
* @author auto create
* @since 1.0, 2017-04-27 14:36:26
*/
public class AlipayMarketingDataModelQueryModel extends AlipayObject {
private static final long serialVersionUID = 2731683659354299759L;
/**
* 模型查询输入参数格式。此为参数列表,参数包含外部用户身分信息类型、模型输出字段及模型输出值,根据实际业务需求获取;用于实验试算法模型结果查询
key:条件查询参数。此为外部用户身份信息类型,例如:手机号、身份证
operate:操作计算符数。此为查询条件
value:查询参数值。此为查询值
*/
@ApiListField("model_query_param")
@ApiField("model_query_param")
private List<ModelQueryParam> modelQueryParam;
/**
* 模型唯一查询标识符。参数值为调用batchquery接口后获取的model_uk参数值;用于标识模型的唯一性
*/
@ApiField("model_uk")
private String modelUk;
public List<ModelQueryParam> getModelQueryParam() {
return this.modelQueryParam;
}
public void setModelQueryParam(List<ModelQueryParam> modelQueryParam) {
this.modelQueryParam = modelQueryParam;
}
public String getModelUk() {
return this.modelUk;
}
public void setModelUk(String modelUk) {
this.modelUk = modelUk;
}
}
| [
"liuqun.lq@alibaba-inc.com"
] | liuqun.lq@alibaba-inc.com |
bb2f3429057b3dcf7fda9a7db6fdd31edc75ecf7 | 038f0a27c1008f853164581ea455f484129ce9b8 | /programmingLessons/Lesson5/self_Test/self_Test_811/src/self_test_811/Self_Test_811.java | 36d93c1789ee3501ac8799b70e9f56f1e8941ff6 | [
"MIT"
] | permissive | aleksander-GD/VOP19Exercises | b388931a071f5ceab2ba93b73eb11d85086aa0a9 | 3f88dce26408f559ccde68afa7be7e4c3d6bce3f | refs/heads/master | 2021-06-26T15:11:57.190472 | 2020-11-27T08:13:02 | 2020-11-27T08:13:02 | 184,307,719 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,564 | java | package self_test_811;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
public class Self_Test_811 {
public static void main(String[] args) {
String fileName = "stuff.data";
try (ObjectOutputStream toFile
= new ObjectOutputStream(new FileOutputStream(fileName))) {
double[] doubles = {1.2, 2.4, 3.6};
toFile.writeDouble(doubles[0]);
toFile.writeDouble(doubles[1]);
toFile.writeDouble(doubles[2]);
toFile.writeInt(5);
} catch (FileNotFoundException ex) {
System.out.println("Problem opening the file " + fileName);
} catch (IOException ex) {
System.out.println("Problem with output to file " + fileName);
}
try (ObjectInputStream fromFile
= new ObjectInputStream(new FileInputStream(fileName))) {
System.out.println("Output doubles:");
double testDouble1 = fromFile.readDouble();
double testDouble2 = fromFile.readDouble();
double testDouble3 = fromFile.readDouble();
System.out.println(testDouble1 + " " + testDouble2 + " " + testDouble3);
System.out.println("Output test: ");
int readInt = (int) fromFile.readLong();
System.out.println(readInt);
} catch (Exception e) {
}
}
}
| [
"aldus17@student.sdu.dk"
] | aldus17@student.sdu.dk |
351a58dd0e2f9cb6fe87db1f9792f61d473470f6 | 966bd1e54a4559d144aebe2f02bea2283fe38eb9 | /src/main/java/com/spring/blog/controller/BoardController.java | 9349e775538079fe23069ee01a85b8a077549d03 | [] | no_license | wontaekoh/Spring-Blog | d50ff66f5a19d18147b958590aae59ca31df612b | 1ceda4cc243f01b3594e7f4c0a95f47a8f554300 | refs/heads/main | 2023-02-27T16:28:49.007530 | 2021-02-04T00:31:52 | 2021-02-04T00:31:52 | 332,944,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 263 | java | package com.spring.blog.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class BoardController {
@GetMapping({"", "/"})
public String index() {
return "index";
}
}
| [
"wontaek.oh.5@gmail.com"
] | wontaek.oh.5@gmail.com |
35e82f8b26250df7f671a668c34bf13eb570a081 | 5addbb5b06ef8c3f47221dadb384c5de7bdaf85e | /xSpleef/src/main/java/io/github/izdabait/pl/Main.java | 50b6706a55bb5fa168662ce6901ed6253e15a81d | [
"BSD-3-Clause"
] | permissive | IzDaBait/xSpleef | 07d2619e18efc79a1d1076a246595ef46561265d | b1b70546d8788ffac13aa992f22891cb595b64bc | refs/heads/master | 2022-11-08T22:58:55.825622 | 2020-07-03T02:13:34 | 2020-07-03T02:13:34 | 271,087,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,083 | java | package io.github.izdabait.pl;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler;
public class Main extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getServer().getLogger().info("xSpleef by IzDaBait successfully loaded.");
Bukkit.getServer().getPluginManager().registerEvents(this, (Plugin)this);
File dir = new File("plugins/xSpleef");
if (!dir.exists()) dir.mkdirs();
this.saveDefaultConfig();
this.getCommand("spleef").setExecutor(this);
}
ArrayList<UUID> accepting = new ArrayList<UUID>();
HashMap<UUID, Integer> oldCoordsx = new HashMap<UUID, Integer>();
HashMap<UUID, Integer> oldCoordsy = new HashMap<UUID, Integer>();
HashMap<UUID, Integer> oldCoordsz = new HashMap<UUID, Integer>();
HashMap<UUID, World> oldCoordsWorld = new HashMap<UUID, World>();
HashMap<String, ItemStack[]> inventoryContents = new HashMap<String, ItemStack[]>();
HashMap<String, ItemStack[]> inventoryArmorContents = new HashMap<String, ItemStack[]>();
int game = 0;
int vae = 0;
int freeze = 0;
int ovae = 0;
double cversion = 3;
@EventHandler
public void onbreak(BlockBreakEvent e){
FileConfiguration config = this.getConfig();
Player p = e.getPlayer();
if (p.getLocation().getX() > (config.getInt("x1"))) {
if (p.getLocation().getX() < (config.getInt("x2"))) {
if (p.getLocation().getZ() > (config.getInt("z1"))) {
if (p.getLocation().getZ() < (config.getInt("z2"))) {
if (p.getLocation().getY() > (config.getInt("y1"))) {
if (p.getLocation().getY() < (config.getInt("y2"))) {
if (!accepting.contains(p.getUniqueId())){
if (!p.hasPermission("spleef.bypass")) {
if (game == 1) {
p.sendMessage(ChatColor.GREEN + "xSpleef > " + ChatColor.DARK_RED + "A game is currently in progress!");
e.setCancelled(true);
}
}
}
}
}
}
}
}
}
}
@EventHandler
public void onplace(BlockPlaceEvent e){
FileConfiguration config = this.getConfig();
Player p = e.getPlayer();
if (p.getLocation().getX() > (config.getInt("x1"))) {
if (p.getLocation().getX() < (config.getInt("x2"))) {
if (p.getLocation().getZ() > (config.getInt("z1"))) {
if (p.getLocation().getZ() < (config.getInt("z2"))) {
if (p.getLocation().getY() > (config.getInt("y1"))) {
if (p.getLocation().getY() < (config.getInt("y2"))) {
if (!accepting.contains(p.getUniqueId())){
if (!p.hasPermission("spleef.bypass")) {
if (game == 1) {
p.sendMessage(ChatColor.GREEN + "xSpleef > " + ChatColor.DARK_RED + "A game is currently in progress!");
e.setCancelled(true);
}
}
}
}
}
}
}
}
}
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args.length == 1 && args[0].equalsIgnoreCase("go")) {
Player p = (Player) sender;
if (game == 1) {
p.sendMessage(ChatColor.DARK_RED + "A Spleef game is already in progress!");
return true;
}
if (accepting.contains(p.getUniqueId())){
game = 1;
FileConfiguration config = this.getConfig();
World world = Bukkit.getWorld(config.getString("worldname"));
if (config.getInt("config-version") != cversion) p.sendMessage(ChatColor.RED + "Looks like your config is out of date. Please update it to ensure there are no bugs.");
if (config.getBoolean("repeat") == true) {
for (int r = (config.getInt("p-ylevel")); r >= (config.getInt("p-ylevel")-(config.getInt("repeat-amount")*config.getInt("repeat-spacing"))); r = r - config.getInt("repeat-spacing")) {
for (int x = (config.getInt("p-x1")); x <= (config.getInt("p-x2")); x++) {
for (int y = r; y <= r + config.getInt("p-thickness") - 1; y++) {
for (int z = (config.getInt("p-z1")); z <= (config.getInt("p-z2")); z++) {
world.getBlockAt(x, y, z).setType(Material.SNOW_BLOCK);
}
}
}
}
} else {
for (int x = (config.getInt("p-x1")); x <= (config.getInt("p-x2")); x++) {
for (int y = (config.getInt("p-ylevel")); y <= (config.getInt("p-ylevel") + config.getInt("p-thickness") - 1); y++) {
for (int z = (config.getInt("p-z1")); z <= (config.getInt("p-z2")); z++) {
world.getBlockAt(x, y, z).setType(Material.SNOW_BLOCK);
}
}
}
}
ovae = 0;
for (Player subj : Bukkit.getOnlinePlayers()) {
if (accepting.contains(subj.getUniqueId())) {
vae = vae + 1;
if (vae > 8) {
subj.sendMessage(ChatColor.GREEN + "xSpleef > " + ChatColor.DARK_RED
+ "Sorry, there are too many players this round. You will be in the next game!");
return true;
}
oldCoordsx.put(subj.getUniqueId(), subj.getLocation().getBlockX());
oldCoordsy.put(subj.getUniqueId(), subj.getLocation().getBlockY());
oldCoordsz.put(subj.getUniqueId(), subj.getLocation().getBlockZ());
oldCoordsWorld.put(subj.getUniqueId(), subj.getLocation().getWorld());
inventoryContents.put(subj.getName(), subj.getInventory().getContents());
inventoryArmorContents.put(subj.getName(), subj.getInventory().getArmorContents());
subj.getInventory().clear();
init(subj, vae, config);
}
}
return true;
}
sender.sendMessage(ChatColor.GREEN + "xSpleef > " + ChatColor.DARK_RED + "You are not currently accepting spleef games.");
return true;
}
if (args.length == 0 || (args.length == 1 && args[0].equalsIgnoreCase("help"))) {
sender.sendMessage(ChatColor.GREEN + "This server is running xSpleef v" + this.getDescription().getVersion() + " by IzDaBait");
return true;
}
if (args.length == 1 && args[0].equalsIgnoreCase("reload")) {
if (!sender.isOp()) return false;
this.reloadConfig();
sender.sendMessage(ChatColor.GREEN + "Successfully reloaded the config!");
return true;
}
if (args.length == 1 && args[0].equalsIgnoreCase("join")) {
Player p= (Player) sender;
if (accepting.contains(p.getUniqueId())){
sender.sendMessage(ChatColor.GREEN + "xSpleef > " + ChatColor.DARK_RED + "You are already accepting spleef games. Type '/spleef leave' to leave.");
return true;
} else {
if (accepting.size() == 8) {
sender.sendMessage(ChatColor.GREEN + "xSpleef > " + ChatColor.DARK_RED + "The Spleef queue is too large! Please wait for a game to finish to join.");
return true;
} else {
accepting.add(p.getUniqueId());
sender.sendMessage(ChatColor.GREEN + "xSpleef > Joined the waiting list! When enough players are on the list type '/spleef go' to begin! Please clear your inventory.");
return true;
}
}
}
if (args.length == 1 && args[0].equalsIgnoreCase("leave")) {
Player p= (Player) sender;
if (accepting.contains(p.getUniqueId())){
accepting.remove(p.getUniqueId());
sender.sendMessage(ChatColor.GREEN + "xSpleef > Left the waiting list!");
return true;
} else {
sender.sendMessage(ChatColor.GREEN + "xSpleef > " + ChatColor.DARK_RED + "You are not currently accepting spleef games.");
return true;
}
}
if (args.length == 1 && args[0].equalsIgnoreCase("clear")) {
clear();
sender.sendMessage(ChatColor.GREEN + "xSpleef > Platform cleared.");
return true;
}
return false;
}
@Override
public void onDisable() {
// TODO Insert logic to be performed when the plugin is disabled
}
public void init(Player player, int vae, FileConfiguration config) {
// TODO Insert game logic
player.sendMessage(ChatColor.GREEN + "xSpleef > A Spleef game starting...");
double xcord = config.getInt("spawn" + vae + "x");
double ycord = config.getInt("spawnylevel");
double zcord = config.getInt("spawn" + vae + "z");
String world = config.getString("worldname");
Location loc1 = new Location(Bukkit.getWorld(world), xcord, ycord, zcord);
player.teleport(loc1);
summon(player);
}
public void clear() {
FileConfiguration config = this.getConfig();
World world = Bukkit.getWorld(config.getString("worldname"));
if (config.getBoolean("repeat") == true) {
for (int r = (config.getInt("p-ylevel")); r >= (config.getInt("p-ylevel")-(config.getInt("repeat-amount")*config.getInt("repeat-spacing"))); r = r - config.getInt("repeat-spacing")) {
for (int x = (config.getInt("p-x1")); x <= (config.getInt("p-x2")); x++) {
for (int y = r; y <= r + config.getInt("p-thickness") - 1; y++) {
for (int z = (config.getInt("p-z1")); z <= (config.getInt("p-z2")); z++) {
world.getBlockAt(x, y, z).setType(Material.AIR);
}
}
}
}
} else {
for (int x = (config.getInt("p-x1")); x <= (config.getInt("p-x2")); x++) {
for (int y = (config.getInt("p-ylevel")); y <= (config.getInt("p-ylevel") + config.getInt("p-thickness") - 1); y++) {
for (int z = (config.getInt("p-z1")); z <= (config.getInt("p-z2")); z++) {
world.getBlockAt(x, y, z).setType(Material.AIR);
}
}
}
}
}
public void summon(Player player) {
ItemStack Item = new ItemStack(Material.DIAMOND_SHOVEL); //new item of item code
Item.addEnchantment(Enchantment.DIG_SPEED, 5); //enchant the item
player.getInventory().addItem(Item);
freeze(player);
}
public void freeze(final Player player) {
final BukkitScheduler scheduler = getServer().getScheduler();
freeze = 1;
scheduler.scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
player.sendMessage(ChatColor.GREEN + "xSpleef > The game has begun!");
freeze = 0;
}
}, 100L);
}
@EventHandler
public void onMove(PlayerMoveEvent e) {
Player player = e.getPlayer();
FileConfiguration config = this.getConfig();
if (accepting.contains(player.getUniqueId())) {
if (freeze == 1) {
e.setCancelled(true);
}
if (game == 1) {
if (config.getBoolean("repeat") == true) {
if (player.getLocation().getBlockY() < (config.getInt("p-ylevel") - (config.getInt("repeat-amount") * config.getInt("repeat-spacing")))) {
loss(player, config);
}
} else {
if (player.getLocation().getBlockY() < config.getInt("p-ylevel")) {
loss(player, config);
}
}
}
}
}
public void loss(Player player, FileConfiguration config) {
if (accepting.size() == 1) {
clear();
Bukkit.broadcastMessage(ChatColor.GREEN + "xSpleef > " + ChatColor.DARK_RED + player.getName() + ChatColor.GREEN + " " + config.getString("winmessage"));
game = 0;
vae = 0;
} else {
if (config.getBoolean("broadcastloss") == true) {
Bukkit.broadcastMessage(ChatColor.GREEN + "xSpleef > " + ChatColor.DARK_RED + player.getName() + ChatColor.GOLD + " " + config.getString("losemessage"));
}
}
player.getInventory().clear();
reset(player, config);
accepting.remove(player.getUniqueId());
player.sendMessage(ChatColor.GREEN + "xSpleef > Left the waiting list!");
}
public void reset(Player player, FileConfiguration config) {
if(inventoryContents.containsKey(player.getName()) && inventoryArmorContents.containsKey(player.getName())){
player.getInventory().clear();
player.getInventory().setContents(inventoryContents.get(player.getName()));
player.getInventory().setArmorContents(inventoryArmorContents.get(player.getName()));
}
Location loc = new Location(oldCoordsWorld.get(player.getUniqueId()), oldCoordsx.get(player.getUniqueId()), oldCoordsy.get(player.getUniqueId()), oldCoordsz.get(player.getUniqueId()));
player.teleport(loc);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
// Called when a player leaves a server
Player p = event.getPlayer();
if (accepting.contains(p.getUniqueId())){
accepting.remove(p.getUniqueId());
getServer().getLogger().info("xSpleef > " + p.getName() + " Removed from spleef accepting list");
}
}
} | [
"noreply@github.com"
] | IzDaBait.noreply@github.com |
f7839f9fcbdbca18cf455d394487f97d156c4007 | a316ac8ce235897c42a638c7862bb23428f279c5 | /app/src/main/java/com/example/teacher/myapplication/MainActivity.java | 4d1c1bfb9fd4ac028c73f519879b1f564ace47ce | [] | no_license | Yvonne1231/MyRestaurant2 | 2738fc15be1c486047c984dfd86351417af4468e | 0f359bacd9cd01d5a2364a6004bcb847c33c489b | refs/heads/master | 2020-05-19T08:11:00.441280 | 2019-05-04T15:50:23 | 2019-05-04T15:50:23 | 184,914,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | package com.example.teacher.myapplication;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void Login(View view) {
Intent intent=new Intent(this,Restaurant.class);
startActivity(intent);
}
}
| [
"dushimyvo36@gmail.com"
] | dushimyvo36@gmail.com |
8816a31d857a2eaea9cd05e6e0ce3f0301697858 | af7bf9c39b2b246eecbfe7ea97e7e72ada6d3950 | /controlsfx/src/main/java/impl/org/controlsfx/spreadsheet/SpreadsheetGridView.java | dc6d037e1e37d039367da97e1600713349bf7dfa | [] | no_license | claudiodegio/controlsfx | a8c5b60b546b773578b53b16eb6e3ffd1c22b4c9 | 1c2ba0aa97c38497ab239cf7833509574ffeb724 | refs/heads/master | 2021-05-27T20:50:09.340905 | 2014-08-25T00:16:33 | 2014-08-25T00:16:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,307 | java | /**
* Copyright (c) 2013, 2014 ControlsFX
* 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 ControlsFX, any associated website, nor the
* names of its 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 CONTROLSFX 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 impl.org.controlsfx.spreadsheet;
import javafx.collections.ObservableList;
import javafx.scene.control.TableView;
import org.controlsfx.control.spreadsheet.SpreadsheetCell;
import org.controlsfx.control.spreadsheet.SpreadsheetView;
public class SpreadsheetGridView extends TableView<ObservableList<SpreadsheetCell>> {
private final SpreadsheetHandle handle;
/**
* We want to go to the next row when enter is pressed.
* But the tableView wants to go in edition.
* So this flag will be set to true when that happens
* in order for the TableCell not to go in edition.
* SEE RT-34753
*/
private boolean editWithEnter = false;
/**
* We don't want to show the current value in the TextField when we are
* editing by typing a key. We want directly to take those typed letters
* and put them into the textfield.
*/
private boolean editWithKey = false;
public SpreadsheetGridView(SpreadsheetHandle handle) {
this.handle = handle;
}
@Override
protected String getUserAgentStylesheet() {
return SpreadsheetView.class.getResource("spreadsheet.css") //$NON-NLS-1$
.toExternalForm();
}
@Override
protected javafx.scene.control.Skin<?> createDefaultSkin() {
return new GridViewSkin(handle);
}
public GridViewSkin getGridViewSkin() {
return handle.getCellsViewSkin();
}
public boolean getEditWithEnter(){
return editWithEnter;
}
public void setEditWithEnter(boolean b){
editWithEnter = b;
}
public void setEditWithKey(boolean b){
editWithKey = b;
}
public boolean getEditWithKey(){
return editWithKey;
}
};
| [
"none@none"
] | none@none |
e9d9de6986661a8d9af0baf55d0dc70f884e36fb | 67c0fdc9deaedc7f6937b4cba1c068c69991f4d2 | /aura-impl/src/main/java/org/auraframework/impl/css/util/Flavors.java | 4c2e1c49e775508358fbb47d7bf24436db3fe98d | [
"Apache-2.0"
] | permissive | SyMdUmair/aura | 3cecbd7a0c10fc2ce4fa56d022405f2733128bac | 25474961fd88d62d9e955f0649c1ccdd79b1b917 | refs/heads/master | 2021-01-18T00:58:42.713655 | 2015-04-04T00:13:01 | 2015-04-04T00:13:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,801 | java | /*
* Copyright (C) 2013 salesforce.com, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.auraframework.impl.css.util;
import java.util.List;
import org.auraframework.css.FlavorRef;
import org.auraframework.def.BaseComponentDef;
import org.auraframework.def.ComponentDef;
import org.auraframework.def.DefDescriptor;
import org.auraframework.def.FlavorAssortmentDef;
import org.auraframework.def.FlavoredStyleDef;
import org.auraframework.impl.css.flavor.FlavorRefImpl;
import org.auraframework.impl.system.DefDescriptorImpl;
import org.auraframework.util.AuraTextUtil;
import com.google.common.base.CaseFormat;
import com.google.common.base.Preconditions;
/**
* Utilities for working with flavors.
*/
public final class Flavors {
private Flavors() {} // do not construct
public static FlavorRef buildFlavorRef(DefDescriptor<ComponentDef> flavored, String reference) {
Preconditions.checkNotNull(flavored, "the flavored param must must not be null");
Preconditions.checkNotNull(reference, "the reference param must not be null");
List<String> split = AuraTextUtil.splitSimpleAndTrim(reference, ".", 3);
if (split.size() == 1) {
// standard flavor <ui:blah aura:flavor='primary'/>
// split = [flavorName]
return new FlavorRefImpl(Flavors.standardFlavorDescriptor(flavored), split.get(0));
} else if (split.size() == 2) {
// custom flavor, bundle named implied as flavors <ui:blah aura:flavor='sfdc.primary'/>
// split = [namespace, flavorName]
return new FlavorRefImpl(Flavors.customFlavorDescriptor(flavored, split.get(0), "flavors"), split.get(1));
} else if (split.size() == 3) {
// custom flavor, explicit bundle name <ui:blah aura:flavor='sfdc.flavors.primary'/>
// split = [namespace, bundle, flavorName]
return new FlavorRefImpl(Flavors.customFlavorDescriptor(flavored, split.get(0), split.get(1)), split.get(2));
} else {
throw new IllegalArgumentException("unable to parse flavor reference: " + reference);
}
}
/**
* Builds a DefDescriptor for the {@link FlavoredStyleDef} within the same component bundle of the given component.
* This is also referred to as a standard flavor.
*
* @param descriptor The def descriptor of the component bundle, e.g., ui:button.
*/
public static DefDescriptor<FlavoredStyleDef> standardFlavorDescriptor(DefDescriptor<? extends BaseComponentDef> descriptor) {
String fmt = String.format("%s://%s.%s", DefDescriptor.CSS_PREFIX, descriptor.getNamespace(),
descriptor.getName());
return DefDescriptorImpl.getInstance(fmt, FlavoredStyleDef.class);
}
/**
* Builds a DefDescriptor for a {@link FlavoredStyleDef} within a bundle distinct and separate from the given
* component. This is also referred to as a custom flavor.
*
* @param flavored The original component being flavored, e.g, ui:button.
* @param namespace The namespace containing the bundle of the flavor, e.g., "ui".
* @param bundle The name of the flavor's bundle, e.g., "flavors".
*/
public static DefDescriptor<FlavoredStyleDef> customFlavorDescriptor(DefDescriptor<? extends BaseComponentDef> flavored,
String namespace, String bundle) {
// find the bundle. Using FlavorAssortment here not because the file is there (although it could be), but
// primarily just to get at a specific bundle (e.g., folder) name.
String fmt = String.format("markup://%s:%s", namespace, bundle);
DefDescriptor<FlavorAssortmentDef> bundleDesc = DefDescriptorImpl.getInstance(fmt, FlavorAssortmentDef.class);
// find the flavored style file
// using an underscore here so that we can infer the component descriptor in FlavorIncludeDefImpl
String file = flavored.getNamespace() + "_" + flavored.getName();
fmt = String.format("%s://%s.%s", DefDescriptor.CUSTOM_FLAVOR_PREFIX, namespace, file);
return DefDescriptorImpl.getInstance(fmt, FlavoredStyleDef.class, bundleDesc);
}
/**
* Builds a CSS class name based on the given original class name. Use this for standard flavors.
*
* @param original The original class name.
*/
public static String buildFlavorClassName(String original) {
return buildFlavorClassName(original, null);
}
/**
* Builds a CSS class name based on the given original class name.
*
* @param original The original class name.
* @param namespace The namespace the flavor lives in. Pass in null for standard flavors.
*/
public static String buildFlavorClassName(String original, String namespace) {
StringBuilder builder = new StringBuilder();
if (namespace != null) {
builder.append(namespace);
builder.append(AuraTextUtil.initCap(original));
} else {
builder.append(original);
}
builder.append("-f");
return builder.toString();
}
/**
* Builds the correct CSS class name for a {@link FlavoredStyleDef}, based on the given flavor name.
* <p>
* Specifically, this converts a flavor name such as ui_button (e.g., from ui_buttonFlavors.css) to the appropriate
* CSS class name of the flavored component (e.g., uiButton), as it would be built by
* {@link Styles#buildClassName(DefDescriptor)}. This is necessary for custom flavors because the naming convention
* separates the namespace from the component name using an underscore instead of camel-casing. See
* {@link Flavors#customFlavorDescriptor(DefDescriptor, String, String)} as to why the underscore is used in this
* way (basically so that we can infer the flavored component descriptor name from the flavored style descriptor
* name).
*
* @param flavorName The name of the flavored style.
* @return The CSS class name.
*/
public static String flavoredStyleToComponentClass(String flavorName) {
if (!flavorName.contains("_")) {
return flavorName;
}
return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, flavorName);
}
}
| [
"byao@salesforce.com"
] | byao@salesforce.com |
cb9d021290cc7089147f4280482fd02d6aa8a388 | d86c05a6da5ba4bd61c2a2f5808f704539c1190c | /stepik-ws/src/main/java/org/stepik/kushnirenko/dao/UserProfileDao.java | 40f222bebc16df2e73a2891e6d9c0d7ec7189ecf | [] | no_license | KushnirenkoIvan/js | 887bd0244a6e8f4d20babdef9b2dde12317abc94 | 2c4dfcd198ed8f01abeb18e25f20716751a93b60 | refs/heads/master | 2021-01-19T07:53:20.973003 | 2017-03-28T15:24:49 | 2017-03-28T15:24:49 | 85,082,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | package org.stepik.kushnirenko.dao;
import org.stepik.kushnirenko.domain.UserProfile;
public interface UserProfileDao {
long create(UserProfile up);
UserProfile read(long id);
UserProfile readByLogin(String login);
boolean update(UserProfile up);
boolean delete(long id);
}
| [
"kushnirenkoivan@gmail.com"
] | kushnirenkoivan@gmail.com |
1bb7eeeda7dbb11fdf547dafeb4ead2b136ef565 | 3fc503bed9e8ba2f8c49ebf7783bcdaa78951ba8 | /TRAVACC_R5/travelrulesengine/src/de/hybris/platform/travelrulesengine/rao/providers/impl/DefaultRoomStayRaoProvider.java | 6c8dbc190808041d8d31255af20b345499424954 | [] | no_license | RabeS/model-T | 3e64b2dfcbcf638bc872ae443e2cdfeef4378e29 | bee93c489e3a2034b83ba331e874ccf2c5ff10a9 | refs/heads/master | 2021-07-01T02:13:15.818439 | 2020-09-05T08:33:43 | 2020-09-05T08:33:43 | 147,307,585 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,159 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.travelrulesengine.rao.providers.impl;
import de.hybris.platform.commercefacades.accommodation.RoomStayData;
import de.hybris.platform.ruleengineservices.rao.providers.RAOProvider;
import de.hybris.platform.servicelayer.dto.converter.Converter;
import de.hybris.platform.travelrulesengine.rao.RoomStayRAO;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import org.springframework.beans.factory.annotation.Required;
/**
* RAO Provider which creates RoomStayRAO facts to be used in rules evaluation
*/
public class DefaultRoomStayRaoProvider implements RAOProvider
{
private Collection<String> defaultOptions;
private Converter<RoomStayData, RoomStayRAO> roomStayRAOConverter;
@Override
public Set expandFactModel(final Object modelFact)
{
return expandFactModel(modelFact, getDefaultOptions());
}
/**
* Expand fact model set.
*
* @param modelFact
* the model fact
* @param options
* the options
*
* @return the set
*/
protected Set<Object> expandFactModel(final Object modelFact, final Collection<String> options)
{
return modelFact instanceof RoomStayData ?
expandRAO(createRAO((RoomStayData) modelFact), options) :
Collections.emptySet();
}
/**
* Create rao room stay rao.
*
* @param source
* the source
*
* @return the room stay rao
*/
protected RoomStayRAO createRAO(final RoomStayData source)
{
return getRoomStayRAOConverter().convert(source);
}
/**
* Expand rao set.
*
* @param rao
* the rao
* @param options
* the options
*
* @return the set
*/
protected Set<Object> expandRAO(final RoomStayRAO rao, final Collection<String> options)
{
final Set<Object> facts = new LinkedHashSet<>();
options.forEach(option -> {
if (("INCLUDE_ROOM_STAY").equals(option))
{
facts.add(rao);
}
});
return facts;
}
/**
* Gets default options.
*
* @return the default options
*/
protected Collection<String> getDefaultOptions()
{
return defaultOptions;
}
/**
* Sets default options.
*
* @param defaultOptions
* the default options
*/
@Required
public void setDefaultOptions(final Collection<String> defaultOptions)
{
this.defaultOptions = defaultOptions;
}
/**
* Gets roomStayRAOConverter.
*
* @return the roomStayRAOConverter
*/
protected Converter<RoomStayData, RoomStayRAO> getRoomStayRAOConverter()
{
return roomStayRAOConverter;
}
/**
* Sets roomStayRAOConverter.
*
* @param roomStayRAOConverter
* the roomStayRAOConverter
*/
@Required
public void setRoomStayRAOConverter(
final Converter<RoomStayData, RoomStayRAO> roomStayRAOConverter)
{
this.roomStayRAOConverter = roomStayRAOConverter;
}
}
| [
"sebastian.rulik@gmail.com"
] | sebastian.rulik@gmail.com |
82da1a2969cdd9e244fef70a4a86a387329b4612 | 5c64004c54c4a64035cce2224bdcfe450e6f9bab | /si-modules/LWM2M_IPE_Server/lwm2m-server-dms/src/main/java/net/herit/iot/lwm2m/dms/utils/EventSourceServlet.java | 6635c9ebec405517ef60029fc6d552ce2e790a70 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | uguraba/SI | 3fd091b602c843e3b7acc12aa40ed5365964663b | 9e0f89a7413c351b2f739b1ee8ae2687c04d5ec1 | refs/heads/master | 2021-01-08T02:37:39.152700 | 2018-03-08T01:28:24 | 2018-03-08T01:28:24 | 241,887,209 | 0 | 0 | BSD-2-Clause | 2020-02-20T13:13:19 | 2020-02-20T13:12:20 | null | UTF-8 | Java | false | false | 8,387 | java | /*
* Copyright (c) 2011 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 net.herit.iot.lwm2m.dms.utils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.Enumeration;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.continuation.Continuation;
import org.eclipse.jetty.continuation.ContinuationSupport;
/**
* <p>
* A servlet that implements the <a href="http://www.w3.org/TR/eventsource/">event source protocol</a>, also known as
* "server sent events".
* </p>
* <p>
* This servlet must be subclassed to implement abstract method {@link #newEventSource(HttpServletRequest)} to return an
* instance of {@link EventSource} that allows application to listen for event source events and to emit event source
* events.
* </p>
* <p>
* This servlet supports the following configuration parameters:
* </p>
* <ul>
* <li><code>heartBeatPeriod</code>, that specifies the heartbeat period, in seconds, used to check whether the
* connection has been closed by the client; defaults to 10 seconds.</li>
* </ul>
*
* <p>
* NOTE: there is currently no support for <code>last-event-id</code>.
* </p>
*/
@SuppressWarnings("serial")
public abstract class EventSourceServlet extends HttpServlet {
private static final Charset UTF_8 = Charset.forName("UTF-8");
private static final byte[] CRLF = new byte[] { '\r', '\n' };
private static final byte[] EVENT_FIELD;
private static final byte[] DATA_FIELD;
private static final byte[] COMMENT_FIELD;
static {
try {
EVENT_FIELD = "event: ".getBytes(UTF_8.name());
DATA_FIELD = "data: ".getBytes(UTF_8.name());
COMMENT_FIELD = ": ".getBytes(UTF_8.name());
} catch (UnsupportedEncodingException x) {
throw new RuntimeException(x);
}
}
private ScheduledExecutorService scheduler;
private int heartBeatPeriod = 10;
@Override
public void init() throws ServletException {
String heartBeatPeriodParam = getServletConfig().getInitParameter("heartBeatPeriod");
if (heartBeatPeriodParam != null)
heartBeatPeriod = Integer.parseInt(heartBeatPeriodParam);
scheduler = Executors.newSingleThreadScheduledExecutor();
}
@Override
public void destroy() {
if (scheduler != null)
scheduler.shutdown();
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Enumeration<String> acceptValues = request.getHeaders("Accept");
while (acceptValues.hasMoreElements()) {
String accept = acceptValues.nextElement();
if (accept.equals("text/event-stream")) {
EventSource eventSource = newEventSource(request);
if (eventSource == null) {
response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
} else {
respond(request, response);
Continuation continuation = ContinuationSupport.getContinuation(request);
// Infinite timeout because the continuation is never resumed,
// but only completed on close
continuation.setTimeout(0L);
continuation.suspend(response);
EventSourceEmitter emitter = new EventSourceEmitter(eventSource, continuation);
emitter.scheduleHeartBeat();
open(eventSource, emitter);
}
return;
}
}
super.doGet(request, response);
}
protected abstract EventSource newEventSource(HttpServletRequest request);
protected void respond(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setStatus(HttpServletResponse.SC_OK);
response.setCharacterEncoding(UTF_8.name());
response.setContentType("text/event-stream");
// By adding this header, and not closing the connection,
// we disable HTTP chunking, and we can use write()+flush()
// to send data in the text/event-stream protocol
response.addHeader("Connection", "close");
response.flushBuffer();
}
protected void open(EventSource eventSource, EventSource.Emitter emitter) throws IOException {
eventSource.onOpen(emitter);
}
protected class EventSourceEmitter implements EventSource.Emitter, Runnable {
private final EventSource eventSource;
private final Continuation continuation;
private final ServletOutputStream output;
private Future<?> heartBeat;
private boolean closed;
public EventSourceEmitter(EventSource eventSource, Continuation continuation) throws IOException {
this.eventSource = eventSource;
this.continuation = continuation;
this.output = continuation.getServletResponse().getOutputStream();
}
public void event(String name, String data) throws IOException {
synchronized (this) {
output.write(EVENT_FIELD);
output.write(name.getBytes(UTF_8.name()));
output.write(CRLF);
data(data);
}
}
public void data(String data) throws IOException {
synchronized (this) {
BufferedReader reader = new BufferedReader(new StringReader(data));
String line;
while ((line = reader.readLine()) != null) {
output.write(DATA_FIELD);
output.write(line.getBytes(UTF_8.name()));
output.write(CRLF);
}
output.write(CRLF);
flush();
}
}
public void comment(String comment) throws IOException {
synchronized (this) {
output.write(COMMENT_FIELD);
output.write(comment.getBytes(UTF_8.name()));
output.write(CRLF);
output.write(CRLF);
flush();
}
}
public void run() {
// If the other peer closes the connection, the first
// flush() should generate a TCP reset that is detected
// on the second flush()
try {
synchronized (this) {
output.write('\r');
flush();
output.write('\n');
flush();
}
// We could write, reschedule heartbeat
scheduleHeartBeat();
} catch (IOException x) {
// The other peer closed the connection
close();
eventSource.onClose();
}
}
protected void flush() throws IOException {
continuation.getServletResponse().flushBuffer();
}
public void close() {
synchronized (this) {
closed = true;
heartBeat.cancel(false);
}
continuation.complete();
}
private void scheduleHeartBeat() {
synchronized (this) {
if (!closed)
heartBeat = scheduler.schedule(this, heartBeatPeriod, TimeUnit.SECONDS);
}
}
}
}
| [
"root@moon.(none)"
] | root@moon.(none) |
60c597c3ca1e81ca456f944b2b11df4dcb31e800 | fcc53a73db3bce85761a716159a74b019bf68d36 | /main/test/com/stackroute/pe1/Q3ConsonentOrVowelTest.java | 32002a88a9ec7839cdfe85de2d5dc0914b437384 | [] | no_license | prerna0001/JavaPractice | 1cf1ec45e01d19b2c9bb783498f572cc216c18ee | 964d983a8dacc67991c305aaf9f8173c59fbc1f9 | refs/heads/master | 2020-05-16T23:16:37.108688 | 2019-05-02T05:35:00 | 2019-05-02T05:35:00 | 183,358,833 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 831 | java | package com.stackroute.pe1;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
public class Q3ConsonentOrVowelTest {
Q3ConsonentOrVowel q3ConsonentOrVowel;
@Before
public void setUp() throws Exception {
q3ConsonentOrVowel=new Q3ConsonentOrVowel();
}
@After
public void tearDown() throws Exception {
}
@Test
public void checkVov() {
String s=q3ConsonentOrVowel.checkVov( "e");
assertEquals("it is a vowel",s);
}
@Test
public void checkCon() {
String s= q3ConsonentOrVowel.checkCon("q");
assertEquals("it is a Consonant",s);
}
@Test
public void checkNoalp() {
String s= q3ConsonentOrVowel.checkCon("1");
assertEquals("it is not an alphabet",s);
}
} | [
"="
] | = |
3a314a83a36ec4696f8170c55149db445dca1ba9 | 4a05e66fa5a6d13a5c5051c4ae20bac41489afab | /api/src/main/java/lv/javaguru/java3/database/api/DispatchResource.java | 2af03e743165ae5b94415026be9545753b13a386 | [] | no_license | alex8586/JavaSchool | 355e8dbfa3b8216865e0731e8eec35091d438375 | bb5a676775190e00fb0fc0c4561864e2f467407f | refs/heads/master | 2021-01-12T17:05:39.589110 | 2016-12-11T22:23:51 | 2016-12-11T22:23:51 | 71,499,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | package lv.javaguru.java3.database.api;
import lv.javaguru.java3.dto.DispatchDTO;
import lv.javaguru.java3.dto.DispatchMessageDTO;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
@Path(RESTResource.API_PATH)
public interface DispatchResource {
@POST
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@Path("/vehicles/dispatch")
DispatchDTO dispatch(DispatchMessageDTO messageDTO);
}
| [
"litovec@gmail.com"
] | litovec@gmail.com |
c7e263390a65ce76664f1d7cd1e68d828c876fd3 | d756f37e71cc05eefbb58e1cf5cbec919d298057 | /src/main/java/com/example/course/domain/User.java | 6fefead1b2134594517885c2b0d95aa2f7bbd767 | [] | no_license | tuliohsa87/workshop-spring-boot-mongodb | 08cfcc02d76d35d5d0109701c5f1833e306b880c | b1b76b25d08203987e7dd7bd5ba58993c3485cba | refs/heads/master | 2023-01-06T01:13:22.070998 | 2020-11-08T14:12:14 | 2020-11-08T14:12:14 | 311,033,866 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,333 | java | package com.example.course.domain;
import java.io.Serializable;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection = "user")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private String id;
private String name;
private String email;
public User() {
}
public User(String id, String name, String email) {
super();
this.id = id;
this.name = name;
this.email = email;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
User other = (User) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
| [
"tuliohsa87@gmail.com"
] | tuliohsa87@gmail.com |
fd9914b91756344cdc5af6e9276eff7aeb2e151d | f34c72d8e5c2b72b7867e9aadf4b4b5234943cc0 | /invoice-server-jsf/src/main/java/com/bgh/myopeninvoice/jsf/jsfbeans/ApplicationBean.java | 8d20b8e35b56594bb4fc85609a4a7573ce090aae | [
"Apache-2.0"
] | permissive | chang-ngeno/my-open-invoice | aa9c1cae675caee646b10229ed4a7a2cb37761d5 | c8656ac037cffdd3714d2318a68c460ece39b30b | refs/heads/master | 2020-04-08T21:45:23.528627 | 2017-12-08T03:03:28 | 2017-12-08T03:03:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,328 | java | /*
* Copyright 2017 Branislav Cavlin
*
* 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.bgh.myopeninvoice.jsf.jsfbeans;
import org.omnifaces.util.Faces;
import org.primefaces.context.RequestContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
import java.io.IOException;
import java.io.Serializable;
/**
* Created by bcavlin on 15/03/17.
*/
@ManagedBean
@ApplicationScoped
@Component
@PropertySource("classpath:version.properties")
public class ApplicationBean implements Serializable {
private static Logger logger = LoggerFactory.getLogger(ApplicationBean.class);
@Value("${application.version}")
private String applicationVersion;
public String getApplicationVersion() {
return applicationVersion;
}
public void setApplicationVersion(String applicationVersion) {
this.applicationVersion = applicationVersion;
}
public void logout() throws IOException {
FacesContext.getCurrentInstance().getExternalContext().redirect("/logout");
}
public String getVersion() {
StringBuilder b = new StringBuilder();
b.append(FacesContext.class.getPackage().getImplementationTitle()).append("/");
b.append(FacesContext.class.getPackage().getImplementationVersion()).append(", ");
b.append(Faces.getServerInfo()).append(", ");
b.append("PrimeFaces/");
b.append(RequestContext.getCurrentInstance().getApplicationContext().getConfig().getBuildVersion());
return b.toString();
}
}
| [
"bcavlin@gmail.com"
] | bcavlin@gmail.com |
bca63f28973c9f3b44a75210251e868343142c25 | 62262319be72f336d0c4e1337b7e546c9522a430 | /src/main/java/com/alltimeslucky/battletron/server/session/service/Session.java | b8669148513bf9f5833147f1e8d2e73875f26782 | [
"Apache-2.0"
] | permissive | tvalodia/battletron | 8948ba67a8dcc7587d414b32a6bbc70b0e51747a | ea9355930a6687ad07b701f7c7d1d18eff222690 | refs/heads/master | 2023-01-12T03:38:22.527046 | 2020-01-10T15:54:00 | 2020-01-10T15:54:00 | 150,867,522 | 0 | 1 | Apache-2.0 | 2023-01-04T16:58:51 | 2018-09-29T13:38:24 | Java | UTF-8 | Java | false | false | 1,061 | java | package com.alltimeslucky.battletron.server.session.service;
import com.alltimeslucky.battletron.player.controller.PlayerController;
import com.alltimeslucky.battletron.server.websocket.ClientWebSocket;
public class Session {
private String id;
private PlayerController playerController;
private Long gameId;
private ClientWebSocket clientWebSocket;
public String getId() {
return id;
}
public Session(String id) {
this.id = id;
}
public PlayerController getPlayerController() {
return playerController;
}
public void setPlayerController(PlayerController playerController) {
this.playerController = playerController;
}
public Long getGameId() {
return gameId;
}
public void setGameId(Long gameId) {
this.gameId = gameId;
}
public ClientWebSocket getClientWebSocket() {
return clientWebSocket;
}
public void setClientWebSocket(ClientWebSocket clientWebSocket) {
this.clientWebSocket = clientWebSocket;
}
}
| [
"trishan@dataedge.co.za"
] | trishan@dataedge.co.za |
fa540bc495506f74684befbec93cdf7bf3be8515 | 42c9e3a650bb9ac7148547ce42906c7935bbe197 | /java/source/com/kodemore/servlet/control/ScGridColumn.java | 2c91c3eebc01f6a2470a945b4751be125f9dc9a4 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | LucasMcFeature/paragon-server | adfe0db9487128e897435f0fd32da8f4d7adccc3 | 00d542757089e2296a623a83ad1480be819893d3 | refs/heads/master | 2020-12-26T04:37:10.776462 | 2014-01-21T18:00:16 | 2014-01-21T18:00:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,257 | java | package com.kodemore.servlet.control;
import com.kodemore.adaptor.KmAdaptorIF;
import com.kodemore.json.KmJsonArray;
import com.kodemore.json.KmJsonMap;
import com.kodemore.meta.KmMetaAttribute;
import com.kodemore.servlet.ScServletData;
import com.kodemore.servlet.utility.ScControlRegistry;
import com.kodemore.servlet.variable.ScLocalAdaptor;
import com.kodemore.servlet.variable.ScLocalBoolean;
import com.kodemore.servlet.variable.ScLocalInteger;
import com.kodemore.servlet.variable.ScLocalRenderer;
import com.kodemore.servlet.variable.ScLocalString;
import com.kodemore.utility.Kmu;
public class ScGridColumn<T>
{
//##################################################
//# constants
//##################################################
private static final String SORT_ASCENDING = "asc";
private static final String SORT_DESCENDING = "desc";
//##################################################
//# variables
//##################################################
/**
* The unique key.
*/
private String _key;
/**
* The grid.
*/
private ScGrid<T> _grid;
/**
* The column header.
*/
private ScLocalString _header;
/**
* The column width, in pixels.
*/
private ScLocalInteger _width;
/**
* The horizontal alignment; left, right, center.
*/
private ScLocalString _alignment;
/**
* If false the column is hidden by default.
*/
private ScLocalBoolean _visible;
/**
* If true, the client side grid will allow the user to
* select it for sorting.
*/
private ScLocalBoolean _sortable;
/**
* Sort ascending (true), descending (false), or not sorted (null).
*/
private ScLocalBoolean _defaultSort;
/**
* Convert each row's model into a value for display in the
* table's column. The result must be compatible with the
* default formatter, ScFormatter.printAny(Object)
*/
private ScLocalRenderer _displayRenderer;
/**
* If non-null, include the column in the csv export.
* The result is passed to KmCsvBuffer.printAny();
*/
private ScLocalAdaptor _csvAdaptor;
//##################################################
//# constructor
//##################################################
public ScGridColumn()
{
_key = ScControlRegistry.getInstance().getNextKey();
_header = new ScLocalString();
_width = new ScLocalInteger();
_alignment = new ScLocalString();
_visible = new ScLocalBoolean(true);
_sortable = new ScLocalBoolean(false);
_defaultSort = new ScLocalBoolean(null);
_displayRenderer = new ScLocalRenderer();
_csvAdaptor = new ScLocalAdaptor();
alignLeft();
setWidth(150);
setDefaultSort();
}
//##################################################
//# key
//##################################################
public String getKey()
{
return _key;
}
public boolean hasKey(String e)
{
return Kmu.isEqual(getKey(), e);
}
//##################################################
//# grid
//##################################################
public ScGrid<T> getGrid()
{
return _grid;
}
public void setGrid(ScGrid<T> e)
{
_grid = e;
}
//##################################################
//# header
//##################################################
public String getHeader()
{
return _header.getValue();
}
public void setHeader(String e)
{
_header.setValue(e);
}
public boolean hasHeader()
{
return _header.hasValue();
}
//##################################################
//# width
//##################################################
public Integer getWidth()
{
return _width.getValue();
}
public void setWidth(Integer e)
{
_width.setValue(e);
}
public ScGridColumn<T> width(Integer e)
{
setWidth(e);
return this;
}
public boolean hasWidth()
{
return _width.hasValue() && getWidth() > 0;
}
public void setCharacterWidth(int e)
{
setWidth(8 * e);
}
//##################################################
//# align
//##################################################
public String getAlignment()
{
return _alignment.getValue();
}
public ScGridColumn<T> alignLeft()
{
_alignment.setValue("left");
return this;
}
public ScGridColumn<T> alignRight()
{
_alignment.setValue("right");
return this;
}
public ScGridColumn<T> alignCenter()
{
_alignment.setValue("center");
return this;
}
//##################################################
//# visible
//##################################################
public boolean getVisible()
{
return _visible.getValue();
}
public void setVisible(boolean e)
{
_visible.setValue(e);
}
public ScGridColumn<T> show()
{
setVisible(true);
return this;
}
public ScGridColumn<T> hide()
{
setVisible(false);
return this;
}
public boolean isVisible()
{
return getVisible();
}
public boolean isHidden()
{
return !isVisible();
}
//##################################################
//# sortable
//##################################################
public boolean getSortable()
{
return _sortable.getValue();
}
public void setSortable(boolean e)
{
_sortable.setValue(e);
}
public void setSortable()
{
setSortable(true);
}
public boolean isSortable()
{
return getSortable();
}
//##################################################
//# default sort order
//##################################################
public Boolean getDefaultSort()
{
return _defaultSort.getValue();
}
public void setDefaultSort(Boolean e)
{
if ( _grid != null )
_grid.clearDefaultSort();
_defaultSort.setValue(e);
}
public void setDefaultSort()
{
setDefaultSort(true);
}
public boolean hasDefaultSort()
{
return _defaultSort.hasValue();
}
public void clearDefaultSort()
{
_defaultSort.clearValue();
}
public String formatDefaultSort()
{
if ( !hasDefaultSort() )
return SORT_ASCENDING;
return getDefaultSort()
? SORT_ASCENDING
: SORT_DESCENDING;
}
//##################################################
//# sort: request
//##################################################
/**
* Determine if the user requested to sort on this column.
*/
public boolean isSorted()
{
return getSortOrder() != null;
}
/**
* The sort order requested by the user.
* Ascending (true), descending (false), not sorted (null).
*/
public Boolean getSortOrder()
{
String name = getData().getParameter("sortname");
if ( !hasKey(name) )
return null;
String order = getData().getParameter("sortorder");
return !Kmu.isEqual(order, SORT_DESCENDING);
}
//##################################################
//# display adaptor
//##################################################
public ScRenderer getDisplayRenderer()
{
return _displayRenderer.getValue();
}
public boolean hasDisplayRenderer()
{
return _displayRenderer.hasValue();
}
public void setDisplayAdaptor(KmAdaptorIF<T,?> e)
{
_displayRenderer.setAdaptor(e);
}
public void setDisplayAdaptor(KmMetaAttribute<T,?> e)
{
_displayRenderer.setAttribute(e);
}
public void setDisplayControl(ScControl e)
{
_displayRenderer.setControl(e);
}
//##################################################
//# csv adaptor
//##################################################
@SuppressWarnings("unchecked")
public KmAdaptorIF<T,?> getCsvAdaptor()
{
return _csvAdaptor.getValue();
}
public void setCsvAdaptor(KmAdaptorIF<T,?> e)
{
_csvAdaptor.setValue(e);
}
public boolean hasCsvAdaptor()
{
return _csvAdaptor.hasValue();
}
public boolean isCsv()
{
return hasCsvAdaptor();
}
//##################################################
//# compose
//##################################################
public void addCellDefinitionTo(KmJsonArray cells)
{
KmJsonMap map;
map = cells.addMap();
map.setString("name", getKey());
map.setString("display", formatHeader());
if ( hasWidth() )
map.setInteger("width", getWidth());
if ( isHidden() )
map.setBoolean("hide", true);
map.setBoolean("sortable", getSortable());
map.setString("align", getAlignment());
}
public void addCellDataTo(KmJsonArray cells, T model)
{
if ( !hasDisplayRenderer() )
{
cells.addNull();
return;
}
ScControl parent = getGrid();
String html = getDisplayRenderer().render(parent, model);
cells.addString(html);
}
private String formatHeader()
{
return hasHeader()
? getHeader()
: "";
}
//##################################################
//# csv
//##################################################
public Object getCsvCell()
{
return getCsvAdaptor();
}
public boolean isCsvCell()
{
return hasCsvAdaptor();
}
//##################################################
//# support
//##################################################
private ScServletData getData()
{
return ScServletData.getLocal();
}
}
| [
"wlove@accucode.com"
] | wlove@accucode.com |
35b161356445e0cb2082793701e0ebf6c73b1acd | 2e9a86693b665b879c59b14dfd63c2c92acbf08a | /webconverter/decomiledJars/rt/com/sun/jmx/remote/security/MBeanServerAccessController.java | e7157e7d13304a68d99b1ca7d6cf3c25bdd83b6b | [] | no_license | shaikgsb/webproject-migration-code-java | 9e2271255077025111e7ea3f887af7d9368c6933 | 3b17211e497658c61435f6c0e118b699e7aa3ded | refs/heads/master | 2021-01-19T18:36:42.835783 | 2017-07-13T09:11:05 | 2017-07-13T09:11:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,461 | java | package com.sun.jmx.remote.security;
import com.sun.jmx.mbeanserver.GetPropertyAction;
import java.io.ObjectInputStream;
import java.security.AccessController;
import java.util.Set;
import javax.management.Attribute;
import javax.management.AttributeList;
import javax.management.AttributeNotFoundException;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
import javax.management.IntrospectionException;
import javax.management.InvalidAttributeValueException;
import javax.management.ListenerNotFoundException;
import javax.management.MBeanException;
import javax.management.MBeanInfo;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.NotCompliantMBeanException;
import javax.management.NotificationFilter;
import javax.management.NotificationListener;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
import javax.management.OperationsException;
import javax.management.QueryExp;
import javax.management.ReflectionException;
import javax.management.loading.ClassLoaderRepository;
import javax.management.remote.MBeanServerForwarder;
public abstract class MBeanServerAccessController
implements MBeanServerForwarder
{
private MBeanServer mbs;
public MBeanServerAccessController() {}
public MBeanServer getMBeanServer()
{
return this.mbs;
}
public void setMBeanServer(MBeanServer paramMBeanServer)
{
if (paramMBeanServer == null) {
throw new IllegalArgumentException("Null MBeanServer");
}
if (this.mbs != null) {
throw new IllegalArgumentException("MBeanServer object already initialized");
}
this.mbs = paramMBeanServer;
}
protected abstract void checkRead();
protected abstract void checkWrite();
protected void checkCreate(String paramString)
{
checkWrite();
}
protected void checkUnregister(ObjectName paramObjectName)
{
checkWrite();
}
public void addNotificationListener(ObjectName paramObjectName, NotificationListener paramNotificationListener, NotificationFilter paramNotificationFilter, Object paramObject)
throws InstanceNotFoundException
{
checkRead();
getMBeanServer().addNotificationListener(paramObjectName, paramNotificationListener, paramNotificationFilter, paramObject);
}
public void addNotificationListener(ObjectName paramObjectName1, ObjectName paramObjectName2, NotificationFilter paramNotificationFilter, Object paramObject)
throws InstanceNotFoundException
{
checkRead();
getMBeanServer().addNotificationListener(paramObjectName1, paramObjectName2, paramNotificationFilter, paramObject);
}
public ObjectInstance createMBean(String paramString, ObjectName paramObjectName)
throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException
{
checkCreate(paramString);
SecurityManager localSecurityManager = System.getSecurityManager();
if (localSecurityManager == null)
{
Object localObject = getMBeanServer().instantiate(paramString);
checkClassLoader(localObject);
return getMBeanServer().registerMBean(localObject, paramObjectName);
}
return getMBeanServer().createMBean(paramString, paramObjectName);
}
public ObjectInstance createMBean(String paramString, ObjectName paramObjectName, Object[] paramArrayOfObject, String[] paramArrayOfString)
throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException
{
checkCreate(paramString);
SecurityManager localSecurityManager = System.getSecurityManager();
if (localSecurityManager == null)
{
Object localObject = getMBeanServer().instantiate(paramString, paramArrayOfObject, paramArrayOfString);
checkClassLoader(localObject);
return getMBeanServer().registerMBean(localObject, paramObjectName);
}
return getMBeanServer().createMBean(paramString, paramObjectName, paramArrayOfObject, paramArrayOfString);
}
public ObjectInstance createMBean(String paramString, ObjectName paramObjectName1, ObjectName paramObjectName2)
throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
{
checkCreate(paramString);
SecurityManager localSecurityManager = System.getSecurityManager();
if (localSecurityManager == null)
{
Object localObject = getMBeanServer().instantiate(paramString, paramObjectName2);
checkClassLoader(localObject);
return getMBeanServer().registerMBean(localObject, paramObjectName1);
}
return getMBeanServer().createMBean(paramString, paramObjectName1, paramObjectName2);
}
public ObjectInstance createMBean(String paramString, ObjectName paramObjectName1, ObjectName paramObjectName2, Object[] paramArrayOfObject, String[] paramArrayOfString)
throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
{
checkCreate(paramString);
SecurityManager localSecurityManager = System.getSecurityManager();
if (localSecurityManager == null)
{
Object localObject = getMBeanServer().instantiate(paramString, paramObjectName2, paramArrayOfObject, paramArrayOfString);
checkClassLoader(localObject);
return getMBeanServer().registerMBean(localObject, paramObjectName1);
}
return getMBeanServer().createMBean(paramString, paramObjectName1, paramObjectName2, paramArrayOfObject, paramArrayOfString);
}
@Deprecated
public ObjectInputStream deserialize(ObjectName paramObjectName, byte[] paramArrayOfByte)
throws InstanceNotFoundException, OperationsException
{
checkRead();
return getMBeanServer().deserialize(paramObjectName, paramArrayOfByte);
}
@Deprecated
public ObjectInputStream deserialize(String paramString, byte[] paramArrayOfByte)
throws OperationsException, ReflectionException
{
checkRead();
return getMBeanServer().deserialize(paramString, paramArrayOfByte);
}
@Deprecated
public ObjectInputStream deserialize(String paramString, ObjectName paramObjectName, byte[] paramArrayOfByte)
throws InstanceNotFoundException, OperationsException, ReflectionException
{
checkRead();
return getMBeanServer().deserialize(paramString, paramObjectName, paramArrayOfByte);
}
public Object getAttribute(ObjectName paramObjectName, String paramString)
throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException
{
checkRead();
return getMBeanServer().getAttribute(paramObjectName, paramString);
}
public AttributeList getAttributes(ObjectName paramObjectName, String[] paramArrayOfString)
throws InstanceNotFoundException, ReflectionException
{
checkRead();
return getMBeanServer().getAttributes(paramObjectName, paramArrayOfString);
}
public ClassLoader getClassLoader(ObjectName paramObjectName)
throws InstanceNotFoundException
{
checkRead();
return getMBeanServer().getClassLoader(paramObjectName);
}
public ClassLoader getClassLoaderFor(ObjectName paramObjectName)
throws InstanceNotFoundException
{
checkRead();
return getMBeanServer().getClassLoaderFor(paramObjectName);
}
public ClassLoaderRepository getClassLoaderRepository()
{
checkRead();
return getMBeanServer().getClassLoaderRepository();
}
public String getDefaultDomain()
{
checkRead();
return getMBeanServer().getDefaultDomain();
}
public String[] getDomains()
{
checkRead();
return getMBeanServer().getDomains();
}
public Integer getMBeanCount()
{
checkRead();
return getMBeanServer().getMBeanCount();
}
public MBeanInfo getMBeanInfo(ObjectName paramObjectName)
throws InstanceNotFoundException, IntrospectionException, ReflectionException
{
checkRead();
return getMBeanServer().getMBeanInfo(paramObjectName);
}
public ObjectInstance getObjectInstance(ObjectName paramObjectName)
throws InstanceNotFoundException
{
checkRead();
return getMBeanServer().getObjectInstance(paramObjectName);
}
public Object instantiate(String paramString)
throws ReflectionException, MBeanException
{
checkCreate(paramString);
return getMBeanServer().instantiate(paramString);
}
public Object instantiate(String paramString, Object[] paramArrayOfObject, String[] paramArrayOfString)
throws ReflectionException, MBeanException
{
checkCreate(paramString);
return getMBeanServer().instantiate(paramString, paramArrayOfObject, paramArrayOfString);
}
public Object instantiate(String paramString, ObjectName paramObjectName)
throws ReflectionException, MBeanException, InstanceNotFoundException
{
checkCreate(paramString);
return getMBeanServer().instantiate(paramString, paramObjectName);
}
public Object instantiate(String paramString, ObjectName paramObjectName, Object[] paramArrayOfObject, String[] paramArrayOfString)
throws ReflectionException, MBeanException, InstanceNotFoundException
{
checkCreate(paramString);
return getMBeanServer().instantiate(paramString, paramObjectName, paramArrayOfObject, paramArrayOfString);
}
public Object invoke(ObjectName paramObjectName, String paramString, Object[] paramArrayOfObject, String[] paramArrayOfString)
throws InstanceNotFoundException, MBeanException, ReflectionException
{
checkWrite();
checkMLetMethods(paramObjectName, paramString);
return getMBeanServer().invoke(paramObjectName, paramString, paramArrayOfObject, paramArrayOfString);
}
public boolean isInstanceOf(ObjectName paramObjectName, String paramString)
throws InstanceNotFoundException
{
checkRead();
return getMBeanServer().isInstanceOf(paramObjectName, paramString);
}
public boolean isRegistered(ObjectName paramObjectName)
{
checkRead();
return getMBeanServer().isRegistered(paramObjectName);
}
public Set<ObjectInstance> queryMBeans(ObjectName paramObjectName, QueryExp paramQueryExp)
{
checkRead();
return getMBeanServer().queryMBeans(paramObjectName, paramQueryExp);
}
public Set<ObjectName> queryNames(ObjectName paramObjectName, QueryExp paramQueryExp)
{
checkRead();
return getMBeanServer().queryNames(paramObjectName, paramQueryExp);
}
public ObjectInstance registerMBean(Object paramObject, ObjectName paramObjectName)
throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException
{
checkWrite();
return getMBeanServer().registerMBean(paramObject, paramObjectName);
}
public void removeNotificationListener(ObjectName paramObjectName, NotificationListener paramNotificationListener)
throws InstanceNotFoundException, ListenerNotFoundException
{
checkRead();
getMBeanServer().removeNotificationListener(paramObjectName, paramNotificationListener);
}
public void removeNotificationListener(ObjectName paramObjectName, NotificationListener paramNotificationListener, NotificationFilter paramNotificationFilter, Object paramObject)
throws InstanceNotFoundException, ListenerNotFoundException
{
checkRead();
getMBeanServer().removeNotificationListener(paramObjectName, paramNotificationListener, paramNotificationFilter, paramObject);
}
public void removeNotificationListener(ObjectName paramObjectName1, ObjectName paramObjectName2)
throws InstanceNotFoundException, ListenerNotFoundException
{
checkRead();
getMBeanServer().removeNotificationListener(paramObjectName1, paramObjectName2);
}
public void removeNotificationListener(ObjectName paramObjectName1, ObjectName paramObjectName2, NotificationFilter paramNotificationFilter, Object paramObject)
throws InstanceNotFoundException, ListenerNotFoundException
{
checkRead();
getMBeanServer().removeNotificationListener(paramObjectName1, paramObjectName2, paramNotificationFilter, paramObject);
}
public void setAttribute(ObjectName paramObjectName, Attribute paramAttribute)
throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
{
checkWrite();
getMBeanServer().setAttribute(paramObjectName, paramAttribute);
}
public AttributeList setAttributes(ObjectName paramObjectName, AttributeList paramAttributeList)
throws InstanceNotFoundException, ReflectionException
{
checkWrite();
return getMBeanServer().setAttributes(paramObjectName, paramAttributeList);
}
public void unregisterMBean(ObjectName paramObjectName)
throws InstanceNotFoundException, MBeanRegistrationException
{
checkUnregister(paramObjectName);
getMBeanServer().unregisterMBean(paramObjectName);
}
private void checkClassLoader(Object paramObject)
{
if ((paramObject instanceof ClassLoader)) {
throw new SecurityException("Access denied! Creating an MBean that is a ClassLoader is forbidden unless a security manager is installed.");
}
}
private void checkMLetMethods(ObjectName paramObjectName, String paramString)
throws InstanceNotFoundException
{
SecurityManager localSecurityManager = System.getSecurityManager();
if (localSecurityManager != null) {
return;
}
if ((!paramString.equals("addURL")) && (!paramString.equals("getMBeansFromURL"))) {
return;
}
if (!getMBeanServer().isInstanceOf(paramObjectName, "javax.management.loading.MLet")) {
return;
}
if (paramString.equals("addURL")) {
throw new SecurityException("Access denied! MLet method addURL cannot be invoked unless a security manager is installed.");
}
GetPropertyAction localGetPropertyAction = new GetPropertyAction("jmx.remote.x.mlet.allow.getMBeansFromURL");
String str = (String)AccessController.doPrivileged(localGetPropertyAction);
boolean bool = "true".equalsIgnoreCase(str);
if (!bool) {
throw new SecurityException("Access denied! MLet method getMBeansFromURL cannot be invoked unless a security manager is installed or the system property -Djmx.remote.x.mlet.allow.getMBeansFromURL=true is specified.");
}
}
}
| [
"Subbaraju.Gadiraju@Lnttechservices.com"
] | Subbaraju.Gadiraju@Lnttechservices.com |
0bc0133f740d811089216162782e3d325a9c76b1 | 418cbb362e8be12004bc19f3853a6b7e834e41f5 | /src/L21Regex/Ex05MatchNumbers.java | d5bbc4f7baf078dff6a223950eeb3a6d5b55c835 | [
"MIT"
] | permissive | VasAtanasov/SoftUni-Programming-Fundamentals-May-2018 | 433bd31e531b9ba19d844d6c3ed46deef851396e | 911bca8ef9a828acc247fbc2e6a9290f4d3a8406 | refs/heads/master | 2020-04-14T20:35:23.723721 | 2019-01-04T11:32:04 | 2019-01-04T11:32:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,017 | java | package L21Regex;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
public class Ex05MatchNumbers {
private static final String REGEX;
private static List<String> matches;
private static Pattern pattern;
private static BufferedReader reader;
static {
REGEX = "(^|(?<=\\s))-?[0-9]+(\\.[0-9]+)?($|(?=\\s))";
matches = new ArrayList<>();
pattern = Pattern.compile(REGEX);
reader = new BufferedReader(new InputStreamReader(System.in));
}
public static void main(String[] args) throws IOException {
String input = reader.readLine();
Matcher matcher = pattern.matcher(input);
while (matcher.find()) {
matches.add(matcher.group());
}
System.out.println(matches.stream().collect(Collectors.joining(" ")));
}
}
| [
"vas.atanasov@gmail.com"
] | vas.atanasov@gmail.com |
f9b2f25602d912bd6d221abc95b43942b599ee3c | cfa99224158d9d35bb9c04b62b16b959c727103d | /2.JavaCore/src/com/javarush/task/task15/task1518/Solution.java | 422d4f85f6a93f48837ecf228cb8e2c79042374e | [] | no_license | grubneac/JavaRushTasks | a1b64fc0858be25aee14df6ae892e69d585fe922 | 6a55b11bc882aa200d7befc393170395d562f620 | refs/heads/master | 2021-04-18T21:34:30.772782 | 2018-03-23T13:23:46 | 2018-03-23T13:23:46 | 126,311,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package com.javarush.task.task15.task1518;
/*
Статики и котики
*/
public class Solution {
static Cat cat = new Cat();
static {
cat.name="Vasika";
System.out.println(cat.name);
}
public static void main(String[] args) {
}
public static class Cat{
public String name;
}
}
| [
"a.grubnyak@cft.ru"
] | a.grubnyak@cft.ru |
9c5a0506db7612728a1b71537b28297fa6a3ec07 | 31d24c30edf75bccdbb5df86fcb4fde879ae63fd | /src/main/java/com/example/stockmarket/model/StockType.java | 2fa72805e12dbad483485204cee20c4519bafe90 | [] | no_license | skDn/stock-market | ed18bcb591172fbf83a053e0a3f194f442f8e913 | 41a682b93a791c386936cbcc4787f5eef66414e6 | refs/heads/master | 2021-03-02T16:33:17.066871 | 2020-03-08T23:00:33 | 2020-03-08T23:00:33 | 245,883,997 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 88 | java | package com.example.stockmarket.model;
public enum StockType {
COMMON, PREFERRED
}
| [
"yordanyordanov@Yordans-MBP.lan"
] | yordanyordanov@Yordans-MBP.lan |
52ab17419e260fda2b00ac59ebdf9eea45410ffb | ba8da7fb8118b4fc39fa4fcda9963d6326cd6bcd | /app/src/main/java/com/bigpicture/hje/scan/ItemListActivity.java | 9603a76cbf78229e4be1c0d88b97a81288742d03 | [] | no_license | lowcrash33/ShopItemClient | 58b0d022bd3fc3851bfaba53af75d3ba0feeea91 | 680af8a74d75224a36688b21e1a68f90ffdddbd5 | refs/heads/master | 2021-01-19T11:05:52.908683 | 2017-04-25T16:06:13 | 2017-04-25T16:06:13 | 87,928,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,177 | java | package com.bigpicture.hje.scan;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.Network.NetworkTask;
import com.VO.Item;
import com.adapter.ListViewAdapter;
import com.common.RoundedAvatarDrawable;
import com.common.Scan;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import static com.common.Scan.BR_ItemList;
import static com.common.Scan.HTTP_ACTION_ITEMLIST;
import static com.common.Scan.KEY_ItemList;
import static com.common.Scan.itemImage;
import static com.common.Scan.selectedUrl;
public class ItemListActivity extends AppCompatActivity {
private Context context;
private String shop_id;
private ArrayList<Item> itemList;
private ListView listview ;
private ListViewAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_item_list);
context = this;
shop_id = getIntent().getStringExtra("shop_id");
itemList = new ArrayList<Item>();
adapter = new ListViewAdapter() ;
listview = (ListView) findViewById(R.id.listview_item);
listview.setAdapter(adapter);
listview.setEmptyView((TextView)findViewById(R.id.textview_empty));
NetworkTask networkTask = new NetworkTask(context, HTTP_ACTION_ITEMLIST, Scan.itemList);
Map<String, String> params = new HashMap<String, String>();
params.put("shop_id", shop_id);
networkTask.execute(params);
}
//서버에서 Shop 리스트 목록을 리시버로 받음 (NetworkTask)
public void onResume(){
super.onResume();
IntentFilter filter = new IntentFilter();
filter.addAction(BR_ItemList);
registerReceiver(mItemListBR, filter);
}
public void onPause(){
super.onPause();
unregisterReceiver(mItemListBR);
}
BroadcastReceiver mItemListBR = new BroadcastReceiver(){
public void onReceive(Context context, Intent intent){
try {
JSONArray jArray = new JSONArray(intent.getStringExtra(KEY_ItemList));
for (int i = 0; i < jArray.length(); i++) {
JSONObject oneObject = jArray.getJSONObject(i); // Pulling items from the array
String item_code = oneObject.getString("item_code");
String item_name = oneObject.getString("item_name");
String item_price = oneObject.getString("item_price");
String item_type = oneObject.getString("item_type");
String item_info = oneObject.getString("item_info");
String stock_stock = oneObject.getString("stock_stock");
Item item = new Item(item_code, item_name, item_price, item_type, item_info, stock_stock);
new LoadImage(item_code).execute();
itemList.add(item);
adapter.addItem(item);
}
}catch(JSONException e){
Log.e("JSON Parsing error", e.toString());
}
}
};
private class LoadImage extends AsyncTask<String, String, Bitmap> {
private Bitmap item_image;
private String item_code, url;
public LoadImage(String item_code){
this.item_code = item_code;
url = selectedUrl+itemImage+item_code;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
protected Bitmap doInBackground(String... args) {
Log.i("Image download", "Request URL : "+url);
try {
item_image = BitmapFactory
.decodeStream((InputStream) new URL(url)
.getContent());
} catch (Exception e) {
e.printStackTrace();
}
return item_image;
}
protected void onPostExecute(Bitmap image) {
if (image != null) {
for (Item i : itemList){
if(i.getItem_code().equals(item_code)) {
RoundedAvatarDrawable tmpRoundedAvatarDrawable = new RoundedAvatarDrawable(image);
i.setItem_image(tmpRoundedAvatarDrawable);
adapter.notifyDataSetChanged();
}
}
Log.i("Image download", "Download complete!!");
} else {
Toast.makeText(context, "이미지가 존재하지 않습니다.",
Toast.LENGTH_SHORT).show();
}
}
}
}
| [
"lowcrash33@gmail.com"
] | lowcrash33@gmail.com |
d1a082ed5c8de77b46539c9f96467814d9ec5079 | 9d3885fe6f528329c38c9a801f3b7cea7041d527 | /IMRestServices/src/main/java/com/im/util/MailMail.java | e8275ef310e5e0bdb38a12b5740e819249046c7d | [] | no_license | chetanhm/Insurance-Management | 91c296c5008a2696da010ffc0a05c466de329d19 | 77280aaefe08bea31850f89edb06125deed98140 | refs/heads/master | 2022-12-23T18:10:46.477430 | 2016-09-16T12:27:56 | 2016-09-16T12:27:56 | 47,395,762 | 0 | 4 | null | 2022-12-10T02:06:06 | 2015-12-04T09:54:16 | JavaScript | UTF-8 | Java | false | false | 563 | java | package com.im.util;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
public class MailMail
{
private MailSender mailSender;
public void setMailSender(MailSender mailSender) {
this.mailSender = mailSender;
}
public void sendMail(String from, String to, String subject, String msg) {
SimpleMailMessage message = new SimpleMailMessage();
message.setFrom(from);
message.setTo(to);
message.setSubject(subject);
message.setText(msg);
mailSender.send(message);
}
}
| [
"gurav_s@Srushti-G.India.XoriantCorp.com"
] | gurav_s@Srushti-G.India.XoriantCorp.com |
7c4b166a4a6e7415e42ae3673b701c72c971e939 | ee27a735d7f854ff4bf383df3e43a50186b20cd5 | /src/spring3/form/Consumo.java | 34bfdc63d2ee17451a0c3db3f3a7c6fbe0b59635 | [] | no_license | Fmeynet/Taller2 | df3231d3e0b19bf316f231814b610c1cf6f9909f | 8ab082c74c1d2dee3e00a7c7c812df88f6cc6b51 | refs/heads/master | 2020-05-20T10:59:07.348012 | 2013-12-07T16:18:22 | 2013-12-07T16:42:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,067 | java | package spring3.form;
public class Consumo {
private int consumo;
private int monto;
private boolean morosidad;
private java.lang.String fecha_vencimiento;
private spring3.form.Token login;
private spring3.form.Cuenta cuenta;
public Consumo(){
}
/**
* @param consumo
* @param monto
* @param morosidad
* @param fecha_vencimiento
* @param login
* @param cuenta
*/
public Consumo(int consumo, int monto, boolean morosidad,
String fecha_vencimiento, Token login, Cuenta cuenta) {
this.consumo = consumo;
this.monto = monto;
this.morosidad = morosidad;
this.fecha_vencimiento = fecha_vencimiento;
this.login = login;
this.cuenta = cuenta;
}
/**
* @return the consumo
*/
public int getConsumo() {
return consumo;
}
/**
* @param consumo the consumo to set
*/
public void setConsumo(int consumo) {
this.consumo = consumo;
}
/**
* @return the monto
*/
public int getMonto() {
return monto;
}
/**
* @param monto the monto to set
*/
public void setMonto(int monto) {
this.monto = monto;
}
/**
* @return the morosidad
*/
public boolean isMorosidad() {
return morosidad;
}
/**
* @param morosidad the morosidad to set
*/
public void setMorosidad(boolean morosidad) {
this.morosidad = morosidad;
}
/**
* @return the fecha_vencimiento
*/
public java.lang.String getFecha_vencimiento() {
return fecha_vencimiento;
}
/**
* @param fecha_vencimiento the fecha_vencimiento to set
*/
public void setFecha_vencimiento(java.lang.String fecha_vencimiento) {
this.fecha_vencimiento = fecha_vencimiento;
}
/**
* @return the login
*/
public spring3.form.Token getLogin() {
return login;
}
/**
* @param login the login to set
*/
public void setLogin(spring3.form.Token login) {
this.login = login;
}
/**
* @return the cuenta
*/
public spring3.form.Cuenta getCuenta() {
return cuenta;
}
/**
* @param cuenta the cuenta to set
*/
public void setCuenta(spring3.form.Cuenta cuenta) {
this.cuenta = cuenta;
}
}
| [
"f.meynet@gmail.com"
] | f.meynet@gmail.com |
a7b4c21227d2ea1dde67290320cf8501511cc2cb | 169f45a2484612a3d147a9ced72ab4a4448df5d7 | /src/nl/tudelft/rdfgears/engine/OldOptimizer.java | ee22f9ef91e6c3f8e2776e3f8f08f902884ad229 | [] | no_license | hidders/rdf-gears-warsaw | a85e05fd12240d7859213116d84ca7a06bfc0fec | a77a792c1de1a9f7fbc19d95bbb476615bc20bc0 | refs/heads/master | 2021-01-10T20:26:02.461961 | 2013-11-08T20:59:15 | 2013-11-08T20:59:15 | 32,384,584 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,383 | java | package nl.tudelft.rdfgears.engine;
import java.util.HashSet;
import java.util.Set;
import nl.tudelft.rdfgears.rgl.datamodel.type.BagType;
import nl.tudelft.rdfgears.rgl.datamodel.type.RGLType;
import nl.tudelft.rdfgears.rgl.exception.WorkflowCheckingException;
import nl.tudelft.rdfgears.rgl.function.RGLFunction;
import nl.tudelft.rdfgears.rgl.function.standard.FilterFunction;
import nl.tudelft.rdfgears.rgl.workflow.FunctionProcessor;
import nl.tudelft.rdfgears.rgl.workflow.InputPort;
import nl.tudelft.rdfgears.rgl.workflow.Workflow;
import nl.tudelft.rdfgears.rgl.workflow.WorkflowInputPort;
import nl.tudelft.rdfgears.rgl.workflow.WorkflowNode;
public class OldOptimizer {
private Set<WorkflowNode> optimizedNodes = new HashSet<WorkflowNode>();
/**
* Optimize the workflow, disabling materialization where possible.
* Disable cache in outputNode if cacheOutputNode==false. If user wants to only print the result value, we need not
* keep the calculated intermediate values in some cache.
* @param workflow
* @return
* @throws WorkflowCheckingException
* @throws TypeCheckingNotSupportedException
*/
public Workflow optimize(Workflow workflow, boolean cacheOutputNode) throws WorkflowCheckingException {
WorkflowNode endNode = workflow.getOutputProcessor();
optimizeFlow(endNode);
if (!cacheOutputNode){
/* do NOT materialize results of output node */
if(endNode instanceof FunctionProcessor){
FunctionProcessor fproc = (FunctionProcessor) endNode;
fproc.valueIsReadMultipleTimes(false);
}
}
return workflow;
}
/**
*
* Recursively follow nodes, flagging them to NOT use cache if it isn't needed.
*
* ---.
* \
* +-------------+ \ +-------------+
* | proc A | \ | proc B |
* (?) | --( ) |
* | | | ( )----
* (?) o----------(?)B_a |
* | | | |
* +-------------+ +-------------+
*
*
* Assume A outputs a bag, which we can detect by typechecking. A may or may not iterate over its inputs,
* and B may or may not iterate over the output of A.
*
* The output bag of A need not be materialize/cached if:
* - It is read by only one processor (in this case proc B), AND
* - The reading processor iterates at most once over the bag. That is, one or more of the following conditions hold:
* I) the output of A is read in port B_a and port port B_A is marked for iteration, as only port of proc B.
* (If there is multiple ports marked in B, Cartesian product is taken and iterates many times -- unless we
* select one port in the outer loop, and we can still guarantee iterate it only once. But this is advanced
* optimization we won't do now. Notice that if we would implement
* this, it would be advantageous to put the bag we suspect to be biggest in the outer loop, and then the
* biggest after that directly on, and the smallest in the innermost loop. We would only prevent the outermost
* loop-bag from needing cache, but we want the smallest loop inside to make it fit in memory-cache
* (like with nested loop join optimization))
* II) the port is not marked for iteration, but can otherwise guarantee that the function of the processor
* will iterate at most once, and it will not output the input bag in (an element of) the output of B.
* This is e.g. the case with the Filter function.
*
* This algorithm does not exceed the workflow boundary. That is, if a workflow has no iterating ports,
* we may just unpack the workflow in the containing one. But we don't detect this. So we optimize only locally.
* @throws WorkflowCheckingException
*/
private void optimizeFlow(WorkflowNode nodeA) throws WorkflowCheckingException{
if(! optimizedNodes.contains(nodeA)){
if (nodeA instanceof FunctionProcessor){
FunctionProcessor procA = (FunctionProcessor) nodeA;
RGLType outputType = procA.getOutputType();
/**
* This if if/else/else implementation looks funky because caching is currently opt-out, not opt-in.
*
* But it works, and is very effective!
*/
if (! (outputType instanceof BagType)){
/* Now caching is one by default; leave it on.
* The processor still may not *need* caching, but if it isn't a bagType we don't
* care much.
*/
} else // we are a bag
if (procA.getOutputReaders()==null){
/* *** DO CACHE ***
* This is the output port of workflow and we didn't implement a method
* do diagnose how our output is used. So if we output a bag, we will cache it. */
// System.out.println(">>>> USING cache for function "+procA.getFunction() + " because it is last in workflow");
} else // we are not last processor in workflow
if (procA.getOutputReaders().size()!=1){
/* *** DO CACHE ***
* There are 0 readers (then it will not be generated) or multiple readers (which may all iterate, so we
* need cache)
*/
// System.out.println(">>>> USING cache for function "+procA.getFunction() + " because it has "+procA.getOutputReaders().size()+ " outputs. ");
} else // there is 1 reader
if (! readerIteratesMaximallyOnce(procA.getOutputReaders().iterator().next())){
/* *** DO CACHE ***
* it is iterated multiple times, so it needs cache. */
// System.out.println(">>>> USING cache for function "+procA.getFunction() + " because its reader may iterate many times ");
} else {
// System.out.println("Disabling cache for function "+procA.getFunction());
procA.valueIsReadMultipleTimes(false);
}
for (InputPort readingPort : procA.getPortSet()){
optimizeFlow(readingPort.getInputProcessor());
}
RGLFunction function = procA.getFunction();
if (function instanceof Workflow){
(new OldOptimizer()).optimize((Workflow) function, true);
}
} else if (nodeA instanceof WorkflowInputPort){
/**
* This thing itself has no cache. More advanced optimization may try to analyze the relation
* between processors in different nested workflows, but we don't .
*/
}
}
}
/**
* Return true iff the port will iterate maximally once over the input bag.
* This is true if it is the only iterating port, or if we know the function won't iterate more than once AND will
* not return the bag so no-one else can iterate.
*
* We indeed assume port receives an input bag.
* @param nodeB_port
* @return
*/
private boolean readerIteratesMaximallyOnce(InputPort nodeB_port) {
if (! nodeB_port.iterates()){
return functionWontIterateTwice(nodeB_port.getOwnerProcessor().getFunction());
}
else {
for (InputPort bPort : nodeB_port.getOwnerProcessor().getPortSet()){
if (bPort!=nodeB_port && bPort.iterates()){
return false; // multiple iterating ports, so will take cartesian product
}
}
return true;
}
}
/**
* It may be nice to actually delegate this determination to the function itself, by means of a
* function.functionWontIterateTwice(String portName). It can return false by default so implementation
* is not compulsory, and some methods like FilterFunction can return true.
* @param function
* @return
*/
private boolean functionWontIterateTwice(RGLFunction function) {
return (function instanceof FilterFunction);
}
}
| [
"tomek@haesik.(none)"
] | tomek@haesik.(none) |
a9abdd555d096f186f5677595befb7edf0641d63 | b6f7849a67d1116fd823c1f92cbd482f379280ff | /ServerDemo/src/test/java/cn/xhjc/ServerDemoApplicationTests.java | 53a204c113744d795bc99d9bc0b8d3e7de0e62ea | [] | no_license | XuHaijwill/OAuth2Demo | 0254529fb5546c36b0b6daedbb50c025996943a4 | d296aa7254b8775f3548417ae8c302df07b2d923 | refs/heads/master | 2022-07-18T12:09:52.985549 | 2019-06-26T12:14:00 | 2019-06-26T12:14:00 | 193,866,995 | 0 | 0 | null | 2022-06-17T02:15:22 | 2019-06-26T08:51:25 | Java | UTF-8 | Java | false | false | 328 | java | package cn.xhjc;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ServerDemoApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"zuiwoxuanlou@163.com"
] | zuiwoxuanlou@163.com |
b8db45cce901e0cce12fb73b1414b2bbf0f5a005 | d9f0555059675616201cc19134df476b1d6a3f79 | /OubliationGWT/src/edu/ycp/cs320spring2015/oubliation/client/transfer/JsParameterData.java | 906fe185f77b7d9f2dc64f6087dc7a5cc2cbb010 | [] | no_license | Oubliation/Oubliation | 146457780c44bb1b1f84d69b9b2ce6113fb62f45 | 91feb26ab217e927c3bef20721e29493b20af639 | refs/heads/master | 2021-01-23T06:55:13.054205 | 2015-05-13T04:02:01 | 2015-05-13T04:02:01 | 30,083,495 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,319 | java | package edu.ycp.cs320spring2015.oubliation.client.transfer;
import com.google.gwt.core.client.JavaScriptObject;
public class JsParameterData extends JavaScriptObject {
protected JsParameterData() {}
final public native int getInt(String field) /*-{
return this[field];
}-*/;
final public native double getDouble(String field) /*-{
return this[field];
}-*/;
final public native boolean getBoolean(String field) /*-{
return this[field];
}-*/;
final public native String getString(String field) /*-{
return this[field];
}-*/;
final public native int[] getIntArray(String field) /*-{
return this[field];
}-*/;
final public native double[] getDoubleArray(String field) /*-{
return this[field];
}-*/;
final public native boolean[] getBooleanArray(String field) /*-{
return this[field];
}-*/;
final public native String[] getStringArray(String field) /*-{
return this[field];
}-*/;
final public native int[][] getIntArray2(String field) /*-{
return this[field];
}-*/;
final public native double[][] getDoubleArray2(String field) /*-{
return this[field];
}-*/;
final public native boolean[][] getBooleanArray2(String field) /*-{
return this[field];
}-*/;
final public native String[][] getStringArray2(String field) /*-{
return this[field];
}-*/;
}
| [
"kevgrasso@gmail.com"
] | kevgrasso@gmail.com |
b01de04e1498d0635708a1c8c838c2081bde314a | 181f87801d8384c6467178a6d8ac8ad50e007589 | /app/src/main/java/com/diogenes/pokeapp/model/VersionGroupDetail.java | d90fa232c04fe9ce7e43f0aa7a160b4391f52840 | [] | no_license | diogenesRezende/PokeApp | 5b2f50559dc8c069c9c5c31f4d292ce386e7dd9f | 9c910bba0c4978df6427c9dd756bdae504de64a9 | refs/heads/master | 2021-08-31T00:32:16.644418 | 2017-12-20T00:47:10 | 2017-12-20T00:47:10 | 114,476,978 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,074 | java |
package com.diogenes.pokeapp.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class VersionGroupDetail {
@SerializedName("level_learned_at")
@Expose
private Integer levelLearnedAt;
@SerializedName("version_group")
@Expose
private GenericCommonEntity versionGroup;
@SerializedName("move_learn_method")
@Expose
private GenericCommonEntity moveLearnMethod;
public Integer getLevelLearnedAt() {
return levelLearnedAt;
}
public void setLevelLearnedAt(Integer levelLearnedAt) {
this.levelLearnedAt = levelLearnedAt;
}
public GenericCommonEntity getVersionGroup() {
return versionGroup;
}
public void setVersionGroup(GenericCommonEntity versionGroup) {
this.versionGroup = versionGroup;
}
public GenericCommonEntity getMoveLearnMethod() {
return moveLearnMethod;
}
public void setMoveLearnMethod(GenericCommonEntity moveLearnMethod) {
this.moveLearnMethod = moveLearnMethod;
}
}
| [
"diogenes.rezende@gmail.com"
] | diogenes.rezende@gmail.com |
85fd3c6372a8c555c7ffb5325f84ed38b14b97d3 | 50361bbc2a94fe5a3a4868b51b820a47e8c98467 | /src/main/java/com/kbhkn/dynamicjaxwsbeangenerator/factorypostprocessor/DynamicBeanGeneratorForJaxWSPortProxyFactoryBean.java | f7f2c92e96f2e58d3e489f9bcb502eb3866fe2f6 | [] | no_license | Kbhkn/Dynamic-JaxWs-Bean-Generator | 0d7ec4c0c4612cb703f24fb08b7e022414be2982 | 41f2fd5a1bd0cf26634b4811193bc93ae6287276 | refs/heads/master | 2023-06-29T21:37:01.001848 | 2021-08-08T21:51:07 | 2021-08-08T21:51:07 | 394,073,354 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,470 | java | package com.kbhkn.dynamicjaxwsbeangenerator.factorypostprocessor;
import com.kbhkn.dynamicjaxwsbeangenerator.reader.WebServiceClientPropertiesReader;
import com.kbhkn.dynamicjaxwsbeangenerator.ws.header.ExternalWebServiceLoggerHandler;
import com.kbhkn.dynamicjaxwsbeangenerator.ws.header.HeaderHandler;
import com.kbhkn.dynamicjaxwsbeangenerator.ws.header.MiddlewareHandlerResolver;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import javax.xml.ws.handler.Handler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean;
/**
* Creates JaxWS Port Proxy Factory beans.
*
* @author Hakan KABASAKAL, 08-Aug-21
*/
@Slf4j
@Configuration
public class DynamicBeanGeneratorForJaxWSPortProxyFactoryBean {
/**
* Creates JaxWsPortProxyFactory beans.
*
* @param env Environment.
* @return created beans.
*/
@Bean
public static BeanFactoryPostProcessor beanFactoryPostProcessor(Environment env) {
return configurableListableBeanFactory -> {
WebServiceClientPropertiesReader propReader = Binder.get(env)
.bind("ws.jaxws", WebServiceClientPropertiesReader.class)
.orElseThrow(() -> new RuntimeException("Can't fetched definitions for ws.jaxws.definitions."));
for (Map.Entry<String, WebServiceClientPropertiesReader.WebServiceDefinitions> ws : propReader.getDefinitions().entrySet()) {
WebServiceClientPropertiesReader.WebServiceDefinitions definition = ws.getValue();
String webServiceName = ws.getKey();
boolean canAdd = true;
try {
//Check that the web service has been created.
Class.forName(definition.getServiceInterface());
} catch (ClassNotFoundException e) {
canAdd = false;
log.error(
"{} could not be created. The web-service classes are either not generated from wsdl or serviceInterface is incorrect.",
webServiceName);
}
if (canAdd) {
BeanDefinition jaxWsPortProxyFactoryBean = createJaxWsPortProxyFactoryBean(definition);
((BeanDefinitionRegistry) configurableListableBeanFactory)
.registerBeanDefinition(webServiceName, jaxWsPortProxyFactoryBean);
log.info("Added WebService Definition, BeanName: {}", webServiceName);
}
}
};
}
private static BeanDefinition createJaxWsPortProxyFactoryBean(WebServiceClientPropertiesReader.WebServiceDefinitions def) {
return BeanDefinitionBuilder.rootBeanDefinition(JaxWsPortProxyFactoryBean.class)
.setLazyInit(true)
.addPropertyValue("serviceInterface", def.getServiceInterface())
.addPropertyValue("serviceName", def.getServiceName())
.addPropertyValue("portName", def.getPortName())
.addPropertyValue("namespaceUri", def.getNamespaceUri())
.addPropertyValue("endpointAddress", def.getEndpointAddress())
.addPropertyValue("lookupServiceOnStartup", false)
.addPropertyValue("handlerResolver", getHandlerResolver(def.getProperties())).getBeanDefinition();
}
@SuppressWarnings("rawtypes")
private static MiddlewareHandlerResolver getHandlerResolver(WebServiceClientPropertiesReader.WebServiceHeaderPropertiesDefinitions properties) {
MiddlewareHandlerResolver resolver = new MiddlewareHandlerResolver();
List<Handler> handlerList = new ArrayList<>();
handlerList.add(new ExternalWebServiceLoggerHandler());
if (Objects.nonNull(properties)) {
handlerList.add(new HeaderHandler(properties));
}
resolver.setHandlerList(handlerList);
return resolver;
}
}
| [
"kabasakalhakan994@gmail.com"
] | kabasakalhakan994@gmail.com |
0a6adb5b2c75d60845c9816dd9245f0059440b02 | c22fd8b384ebc630af8c9b3a0c6f033e4e0fb989 | /src/main/java/com/slimgears/slimapt/FieldPropertyInfo.java | cac15eaa97f6e4a589c319dcf5a632f8e95e4773 | [
"Apache-2.0"
] | permissive | slim-gears/slimapt | 54d5a6c3b5340367aaeef730f80b41e825cb0d8e | 134ad8918d0beb248f3436ad4b360eb317e81e94 | refs/heads/master | 2021-01-10T03:22:26.927734 | 2016-02-03T13:27:37 | 2016-02-03T13:27:37 | 50,355,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,842 | java | // Copyright 2015 Denis Itskovich
// Refer to LICENSE.txt for license details
package com.slimgears.slimapt;
import com.squareup.javapoet.TypeName;
import java.lang.annotation.Annotation;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import javax.lang.model.util.Elements;
/**
* Created by ditskovi on 12/24/2015.
*
*/
public class FieldPropertyInfo extends PropertyInfo {
private final VariableElement element;
private final TypeName type;
public FieldPropertyInfo(Elements elementUtils, VariableElement element) {
this(elementUtils, element, TypeUtils.getTypeName(element.asType()));
}
private FieldPropertyInfo(Elements elementUtils, VariableElement element, TypeName type) {
super(elementUtils);
this.element = element;
this.type = type;
}
public FieldPropertyInfo withType(TypeName type) {
return new FieldPropertyInfo(elementUtils, element, type);
}
@Override
public String getName() {
return element.getSimpleName().toString();
}
@Override
public TypeName getType() {
return type;
}
@Override
public String getSetterName() {
return TypeUtils.toCamelCase("set", getName());
}
@Override
public String getGetterName() {
return TypeUtils.toCamelCase("get", getName());
}
@Override
public <A extends Annotation> A getAnnotation(Class<A> annotationClass) {
return element != null ? element.getAnnotation(annotationClass) : null;
}
@Override
public TypeElement getTypeElement() {
return elementUtils.getTypeElement(element.asType().toString());
}
public boolean requiresTypeCasting() {
return element != null && !element.asType().toString().equals(type.toString());
}
}
| [
"denis.itskovich@gmail.com"
] | denis.itskovich@gmail.com |
869c29e850147f04864ca6dc3f2574e0834326e6 | d2f5e04812a61d57cd00484c26529870d67e4565 | /LanguageHelper/uikit/src/main/java/com/uikit/fragment/BaseWebViewFragment.java | c2991cd7916139ac9b6c4ad53eee014e7d9bc260 | [] | no_license | 15983555965/Simon_two | 1fb9df05a9ad5cf1b938f25001aa6cf1c6a53237 | 27088e974d1409fbb22f06654352c92d72f1a151 | refs/heads/master | 2021-05-01T08:12:33.410585 | 2017-03-14T14:38:19 | 2017-03-14T14:38:20 | 79,688,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,482 | java | package com.uikit.fragment;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.support.v4.content.LocalBroadcastManager;
import android.view.InputEvent;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.webkit.ConsoleMessage;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.GeolocationPermissions;
import android.webkit.JsPromptResult;
import android.webkit.JsResult;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import com.common.modules.jsbridge.WebViewJavascriptBridge;
import com.common.modules.network.NetworkState;
import com.common.modules.property.PhoneProperties;
import com.common.utils.LogUtils;
import com.common.utils.StringUtils;
import com.common.utils.UIUtils;
import com.common.utils.WebViewUtil;
import com.uikit.R;
import com.uikit.widget.EmptyView;
import com.uikit.widget.TitleBar;
import com.uikit.widget.hybrid.HybridWebView;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.lang.ref.WeakReference;
import java.net.URLDecoder;
import cz.msebera.android.httpclient.HttpStatus;
/**
* @author kevin
*/
@SuppressLint("HandlerLeak")
public abstract class BaseWebViewFragment extends BaseFragment implements OnClickListener {
public static final String ACTION_INTENT_WEB_PAGE_LOADED = "intent_web_page_loaded";
public static final int REQUEST_CODE_FILE_CHOOSE = 100;
private final String TAG = "jsbridge";
public static final String EXTRA_URL = "extra_data_url";
private static final String APP_CALL = "wecook://";
private static final int STATE_NONE = -1;
private static final int STATE_LOADING = 0;
private static final int STATE_LOAD_SUCCESS = 1;
private static final int STATE_EMPTY = 2;
private static final int STATE_LOAD_FAIL = 3;
private static final int ERROR_CODE_SUCCESS = HttpStatus.SC_OK;
private HybridWebView mWebView;
private ViewGroup mOperatorView;
private WebViewJavascriptBridge mJsbridge;
private int mState = STATE_NONE;
private int mErrorCode = ERROR_CODE_SUCCESS;
private String mCurrentUrl;
private WeakReference<Activity> mActivityRef;
private EmptyView mEmptyView;
private ValueCallback mFileChooser;
private boolean isMultFileChooser;
private View rootView;
private TitleBar mTitleBar;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
Bundle bundle = getArguments();
if (bundle != null) {
mCurrentUrl = bundle.getString(EXTRA_URL);
}
mActivityRef = new WeakReference<>(activity);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE_FILE_CHOOSE) {
if (mFileChooser != null) {
if (data != null) {
Uri uri = data.getData();
LogUtils.d(TAG, "REQUEST_CODE_FILE_CHOOSE:[uri]" + uri);
if (uri != null) {
Cursor cursor = getContext().getContentResolver()
.query(uri, new String[]{MediaStore.Images.Media.DATA}, null, null, null);
if (cursor != null) {
int pathIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
if (pathIndex >= 0) {
String imagePath = cursor.getString(pathIndex);
File file = new File(imagePath);
Uri fileUri = Uri.fromFile(file);
if (isMultFileChooser) {
mFileChooser.onReceiveValue(new Uri[]{fileUri});
} else {
mFileChooser.onReceiveValue(fileUri);
}
}
}
}
} else {
mFileChooser.onReceiveValue(null);
}
}
}
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mEmptyView = (EmptyView) view.findViewById(R.id.uikit_empty);
if (StringUtils.isEmpty(mCurrentUrl)) {
mEmptyView.setCanRefresh(false);
}
mEmptyView.setRefreshListener(new OnClickListener() {
@Override
public void onClick(View v) {
refresh();
}
});
mOperatorView = (ViewGroup) view.findViewById(R.id.uikit_webview_operator);
View operatorView = onCreateOperatorView(mOperatorView);
if (operatorView != null && operatorView.getParent() == null) {
mOperatorView.addView(operatorView);
}
mWebView = (HybridWebView) view.findViewById(R.id.uikit_webview);
mWebView.setWebViewClient(new InnerWebViewClient());
mWebView.setWebChromeClient(new InnerWebChromeClient());
mWebView.requestFocus();
mWebView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return false;
}
});
mJsbridge = new WebViewJavascriptBridge(getActivity(), mWebView);
checkUserAgent(getWebView());
loadUrl(mCurrentUrl);
}
public abstract View onCreateOperatorView(ViewGroup parent);
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
rootView = LayoutInflater.from(getContext()).inflate(R.layout.uikit_fragment_webview, null);
mTitleBar = (TitleBar) rootView.findViewById(R.id.view_titlebar);
return rootView;
}
public TitleBar getTitleBar(){
return mTitleBar;
}
@Override
public void onClick(View v) {
if (mWebView == null) {
getActivity().onBackPressed();
}
}
public WebViewJavascriptBridge getJsbridge() {
return mJsbridge;
}
public HybridWebView getWebView() {
return mWebView;
}
/**
* 后退
*/
public boolean backward() {
if (mWebView.canGoBack()) {
mWebView.goBack();
return true;
}
return false;
}
/**
* 前进
*/
public boolean forward() {
if (mWebView.canGoForward()) {
mWebView.goForward();
return true;
}
return false;
}
/**
* 刷新
*/
public void refresh() {
loadUrl(mCurrentUrl);
}
public void loadAssetHtml(String name) {
if (!StringUtils.isEmpty(name)) {
String assetUrl = "file:///android_asset/" + name;
loadUrl(assetUrl);
}
}
public EmptyView getEmptyView() {
return mEmptyView;
}
/**
* 跳转
*
* @param url
*/
public void loadUrl(String url) {
if (StringUtils.isEmpty(url)) {
mEmptyView.setVisibility(View.VISIBLE);
return;
} else {
mEmptyView.setVisibility(View.GONE);
}
mState = STATE_LOADING;
mErrorCode = ERROR_CODE_SUCCESS;
mCurrentUrl = url;
if (!NetworkState.available()) {
mState = STATE_LOAD_FAIL;
} else {
CookieSyncManager.createInstance(getActivity());
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);
CookieSyncManager.getInstance().sync();
try {
if (mWebView != null) {
mWebView.loadUrl(url);
}
} catch (Throwable e) {
e.printStackTrace();
}
}
}
@Override
public void onDestroyView() {
if (mWebView != null) {
try {
mWebView.clearView();
mWebView.freeMemory();
mWebView.destroy();
} catch (Throwable e) {
e.printStackTrace();
}
}
super.onDestroyView();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && mWebView.canGoBack()) {
backward();
return true;
}
return super.onKeyDown(keyCode, event);
}
public boolean isWebLoadSuccess() {
return mState == STATE_LOAD_SUCCESS;
}
/**
* Web与应用间调起处理
*
* @param url
*/
private void dealWithCallApp(String url) {
}
public class InnerWebChromeClient extends WebChromeClient {
@Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
mFileChooser = filePathCallback;
isMultFileChooser = true;
chooseImage();
return true;
}
public void openFileChooser(ValueCallback<Uri> uploadFile, String acceptType, String capture) {
mFileChooser = uploadFile;
chooseImage();
}
public void onSelectionStart(WebView view) {
}
/**
* 选择图片
*/
private void chooseImage() {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
getActivity().startActivityForResult(Intent.createChooser(intent, ""), REQUEST_CODE_FILE_CHOOSE);
}
/**
* 开启Html5地理位置定位
*/
@Override
public void onGeolocationPermissionsShowPrompt(String origin,GeolocationPermissions.Callback callback) {
callback.invoke(origin, true, false);
super.onGeolocationPermissionsShowPrompt(origin, callback);
}
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
//加载完成度的百分数
}
@Override
public boolean onJsAlert(WebView view, String url, String message,
JsResult result) {
LogUtils.i(TAG, "[onJsAlert] : " + message);
if (result == null) {
return true;
}
result.confirm();
Toast.makeText(view.getContext(), message, Toast.LENGTH_LONG).show();
return true;
}
/**
* 拦截js 的 prompt方法
*/
@Override
public boolean onJsPrompt(WebView view, String url, String message,
String value, JsPromptResult result) {
LogUtils.i(TAG, "[onJsPrompt] : " + message);
try {
message = URLDecoder.decode(message, "utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
result.cancel();
WebViewUtil.checkExtendRedirect(mActivityRef, view, message);
LogUtils.i(TAG, "message : " + message);
LogUtils.i(TAG, "value : " + value);
return true;
}
@Override
public boolean onJsBeforeUnload(WebView view, String url, String message, JsResult result) {
LogUtils.i(TAG, "[onJsBeforeUnload] url:" + url + " message:" + message);
return super.onJsBeforeUnload(view, url, message, result);
}
@Override
public void onReceivedTitle(WebView view, String title) {
super.onReceivedTitle(view, title);
LogUtils.i(TAG, "[onReceivedTitle] title:" + title);
mTitleBar.setTitle(title);
}
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
LogUtils.i(TAG, "[onConsoleMessage] console:" + consoleMessage.message());
return super.onConsoleMessage(consoleMessage);
}
}
private class InnerWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideKeyEvent(WebView view, KeyEvent event) {
LogUtils.i(TAG, "shouldOverrideKeyEvent ");
return super.shouldOverrideKeyEvent(view, event);
}
@Override
public void onUnhandledInputEvent(WebView view, InputEvent event) {
super.onUnhandledInputEvent(view, event);
LogUtils.i(TAG, "onUnhandledInputEvent ");
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
LogUtils.i(TAG, "onPageStarted ");
showLoading();
checkUserAgent(view);
}
@Override
public boolean shouldOverrideUrlLoading(WebView webview, String url) {
LogUtils.i(TAG, "shouldOverrideUrlLoading url : " + url);
if (url.equals(mCurrentUrl)) {
refresh();
return true;
}
if (!WebViewUtil.checkExtendRedirect(mActivityRef, webview, url)) {
if (url.startsWith(APP_CALL)) {
dealWithCallApp(url);
} else {
loadUrl(url);
}
}
return true;
}
@Override
public void onPageFinished(final WebView view, String url) {
super.onPageFinished(view, url);
if (mErrorCode != ERROR_CODE_SUCCESS)
return;
LogUtils.i(TAG, "onPageFinished ");
UIUtils.post(new Runnable() {
@Override
public void run() {
mJsbridge.loadWebViewJavascriptBridgeJs(view);
mState = STATE_LOAD_SUCCESS;
mCurrentUrl = mWebView.getUrl();
Intent intent = new Intent(ACTION_INTENT_WEB_PAGE_LOADED);
intent.putExtra(EXTRA_URL, mCurrentUrl);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
hideLoading();
}
});
}
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
super.onReceivedError(view, errorCode, description, failingUrl);
LogUtils.w(TAG, "onReceivedError errorCode : " + errorCode);
mErrorCode = errorCode;
mState = STATE_LOAD_FAIL;
hideLoading();
}
}
//TODO
private void hideLoading() {
}
//TODO
private void showLoading() {
}
/**
* 检查用户代理,如果有变化,会导致reload当前页面
*
* @param view
*/
private void checkUserAgent(WebView view) {
WebSettings settings = view.getSettings();
if (settings != null) {
String userAgent = settings.getUserAgentString();
if (!StringUtils.isEmpty(userAgent) && !StringUtils.containWith(userAgent, "Wecook")) {
userAgent += " Wecook/" + PhoneProperties.getVersionName();
}
if (StringUtils.containWith(userAgent, "NetType")) {
userAgent.replaceAll(" NetType/* ", " NetType/" + NetworkState.getNetworkType() + " ");
} else {
userAgent += " NetType/" + NetworkState.getNetworkType() + " ";
}
LogUtils.d(TAG, "user agent : " + userAgent);
settings.setUserAgentString(userAgent);
}
}
}
| [
"314462650@qq.com"
] | 314462650@qq.com |
4fe9a3436bea3f37d218d90264ad303f1fdf1b2e | 67310b5d7500649b9d53cf62226ec2d23468413c | /trunk/modules/gui-ripper-sel/src/simple/SimpleSeleniumTest.java | 1521d89ffd1b48a9399de38efe48b7d79b7e750e | [] | no_license | csnowleopard/guitar | e09cb77b2fe8b7e38d471be99b79eb7a66a5eb02 | 1fa5243fcf4de80286d26057db142b5b2357f614 | refs/heads/master | 2021-01-19T07:53:57.863136 | 2013-06-06T15:26:25 | 2013-06-06T15:26:25 | 10,353,457 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 999 | java | package simple;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.*;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
/*
* Just a simple WebDriver test file to use when developing.
*/
public class SimpleSeleniumTest {
public static void main(String[] args) throws MalformedURLException {
System.setProperty("webdriver.chrome.bin", "/usr/bin/chromium-browser");
WebDriver wd = new FirefoxDriver();
wd.get("file://localhost/home/phand/shared/Documents/School/Spring%202011/CMSC435/hg/test.html");
wd.get("http://www.phand.net");
System.out.println(wd.getCurrentUrl());
wd.get("http://www.phand.net/");
System.out.println(wd.getCurrentUrl());
}
}
| [
"csnowleopard@gmail.com"
] | csnowleopard@gmail.com |
9fa03feb879a899b5f5640c979cad0f74d636b2a | 77e7c1b4163ef593479177048f6b0bf4114b289b | /src/com/class07/Task.java | 263eb41da038901492e136df769c54f9272e9831 | [] | no_license | attaullahasem/javaClasses | 70bec50b868b983eaa43e2c1773ffa88bccdbd9d | 2bd8e8763a73837855bc59b48d712b2d4851ec64 | refs/heads/master | 2022-03-30T23:17:56.617798 | 2020-01-20T20:24:54 | 2020-01-20T20:24:54 | 219,891,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 572 | java | package com.class07;
public class Task {
public static void main(String[] args) {
/*
* create a boolean variable workDay and assign True create int variable and
* assign it to 1 as long as it is workDay print" I need a day off" and increase
* day by 1 once day is 6 print " I do not need a day off any more"
*/
boolean workDay = true;
int day = 1;
while (workDay) {
if (day == 6) {
System.out.println("I do not need a day off any more");
workDay=false;
}else {
System.out.println(" I need a day off");
}
day++;
}
}
}
| [
"attaullah.asem@gmail.com"
] | attaullah.asem@gmail.com |
e2e76948aed2ef60f3140797bfc5415b52ba3ab8 | 1ed587e3ac83633dbb71610e5923edaa51856df3 | /src/main/java/com/yangyakun/javaTool/algorithm/Mahjong.java | 318900382ee51445d4f753c5c23b09437b6d5010 | [] | no_license | itMicmouse/javaTool | d8a4c8f699ea4bee6809d4ac0f5b3a31e6386ff3 | ad231fc5291deaa4c24b92bb17a7a51aa2042511 | refs/heads/master | 2020-03-19T08:18:03.963027 | 2019-10-10T01:47:52 | 2019-10-10T01:47:52 | 136,192,641 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 366 | java | package com.yangyakun.javaTool.algorithm;
public class Mahjong {
public Mahjong(int suitNum, int rank) {
this.suitNum = suitNum;
this.rank = rank;
}
public int suitNum; // 1 筒 2 条 3 万
public int rank; //对应的数字
@Override
public String toString() {
return "("+suitNum +":" +rank + ")";
}
}
| [
"yangyakun921@gmail.com"
] | yangyakun921@gmail.com |
d2e82846eb608b794d95dac4d9f88558fa683b91 | 799ba209846e47b961a5c2192f15a373b14dd12d | /src/main/java/Irena/model/Book.java | 9c8d1c12d002a04df854e8a908a25f13ab461978 | [] | no_license | Irena-J/book-sys | 16e66554a4254edaef3d0ee7120f1ebbbd7ed175 | 4f24ca31ed47d46b8ecdce84594edf6276d0c8c0 | refs/heads/master | 2022-11-22T09:41:10.814740 | 2020-07-15T15:51:46 | 2020-07-15T15:51:46 | 279,588,350 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 517 | java | package Irena.model;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.math.BigDecimal;
import java.util.Date;
/**
* 图书信息
*/
@Getter
@Setter
@ToString
public class Book extends DictionaryTag {
private Integer id;
/**
* 图书名称
*/
private String bookName;
/**
* 作者
*/
private String author;
/**
* 价格
*/
private BigDecimal price;
/**
* 创建时间
*/
private Date createTime;
} | [
"2426733691@qq.com"
] | 2426733691@qq.com |
b2450d1a56503adb2a34a255dc7a041b956a68c2 | e7533029e6b737623c11517f77b2f143b2c508a6 | /Android/PFCRace/proj.android/src/com/joanpfc/race/Connection.java | 303dc8eeb7cb637c02bd20a7e44ab050ae9d355d | [] | no_license | juaniiton1/PFC | e1593dce6b0d6cb3bec8e18d2c99ee42798c3ebb | 1f1cb61d5c806244e48da07a0a0fa99a4b35d5be | refs/heads/master | 2021-01-19T03:13:01.328958 | 2014-03-17T18:07:24 | 2014-03-17T18:07:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 801 | java | package com.joanpfc.race;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
public class Connection {
private static Connection mInstance = null;
private Socket mSocket;
private OutputStream mOutput;
private Connection() {
}
public static Connection getInstance(){
if (mInstance == null) {
mInstance = new Connection();
}
return mInstance;
}
public void setSocket(Socket value) {
mSocket = value;
}
public Socket getSocket() {
return this.mSocket;
}
public void setOutput(OutputStream value) {
mOutput = value;
}
public OutputStream getOutput() {
return this.mOutput;
}
public void writeSocket(int value) throws IOException {
if(mOutput != null) {
mOutput.write(value);
mOutput.flush();
}
}
}
| [
"montagut.joan@gmail.com"
] | montagut.joan@gmail.com |
5d9b791280f2d666bd4daaaacea2c2c109237119 | 7c27b0df8842fc4b3876e8371646ae091f466011 | /app/src/main/java/yahnenko/ua/iceandfire/adapter/ViewHolderName.java | 51af53c2992cdb188aaa69e7d0fce4d20b4afee6 | [] | no_license | Keldmar/IceAndFire | c561eda973d22bea99b715c675825f346e8637c7 | 5bb043b28d92ea3a41f957542de4654832907ec4 | refs/heads/master | 2021-01-01T17:49:52.910251 | 2017-08-30T14:44:08 | 2017-08-30T14:44:08 | 98,167,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 600 | java | package yahnenko.ua.iceandfire.adapter;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import yahnenko.ua.iceandfire.R;
import yahnenko.ua.iceandfire.response.ByName;
/**
* Created by Keldmar on 28.07.2017.
*/
public class ViewHolderName extends RecyclerView.ViewHolder {
private TextView textName;
public ViewHolderName(View itemView) {
super(itemView);
textName = (TextView)itemView.findViewById(R.id.text_name);
}
public void setView(ByName listed) {
textName.setText(listed.name);
}
}
| [
"yahnencko.sasha@gmai.com"
] | yahnencko.sasha@gmai.com |
7b63c199008c19e8339f564e03efa8a9f50b37ad | b5f7422abd05a7f747138470613f5413438391fb | /common/src/main/java/com/baifendian/swordfish/common/job/struct/node/impexp/writer/MysqlWriter.java | 2cb9e1854d048458595f77504a43818a59ef8626 | [] | no_license | gaogf/swordfish | 1130ac317e5b7833cf2684fe8399c8bdbc3ba45c | 1ed839cedec2e6221d3e45a52d907f2cd670117a | refs/heads/master | 2021-01-16T21:30:12.885612 | 2017-08-14T03:42:37 | 2017-08-14T03:42:37 | 100,233,625 | 1 | 0 | null | 2017-08-14T06:03:59 | 2017-08-14T06:03:59 | null | UTF-8 | Java | false | false | 1,858 | java | package com.baifendian.swordfish.common.job.struct.node.impexp.writer;
import com.baifendian.swordfish.common.enums.MysqlWriteMode;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.util.List;
/**
* 写入mysql
*/
public class MysqlWriter implements Writer {
private String datasource;
private String table;
private List<String> session;
private String preSql;
private String postSql;
private MysqlWriteMode writeMode;
private Long batchSize;
private List<String> column;
public String getDatasource() {
return datasource;
}
public void setDatasource(String datasource) {
this.datasource = datasource;
}
public String getTable() {
return table;
}
public void setTable(String table) {
this.table = table;
}
public List<String> getSession() {
return session;
}
public void setSession(List<String> session) {
this.session = session;
}
public String getPreSql() {
return preSql;
}
public void setPreSql(String preSql) {
this.preSql = preSql;
}
public String getPostSql() {
return postSql;
}
public void setPostSql(String postSql) {
this.postSql = postSql;
}
public MysqlWriteMode getWriteMode() {
return writeMode;
}
public void setWriteMode(MysqlWriteMode writeMode) {
this.writeMode = writeMode;
}
public Long getBatchSize() {
return batchSize;
}
public void setBatchSize(Long batchSize) {
this.batchSize = batchSize;
}
public List<String> getColumn() {
return column;
}
public void setColumn(List<String> column) {
this.column = column;
}
@Override
public boolean checkValid() {
return StringUtils.isNotEmpty(datasource) &&
StringUtils.isNotEmpty(table) &&
CollectionUtils.isNotEmpty(column);
}
}
| [
"1306245946@qq.com"
] | 1306245946@qq.com |
3d516e191c36ce37643725c166345cc96593c6d0 | d333dacb8c9bb9751598daacda50ed50ad9afd6a | /src/test/java/test/TreeDiameter.java | 5686cda1d24a885324a34521af210ed90049d6ca | [] | no_license | mayankhooda/test | d86b6cd2a4da7e47cc778f25a41de440cd16e299 | 6ed7215142a64ee502c0f41ef52310e69ea2efec | refs/heads/master | 2022-04-25T16:50:44.923205 | 2020-05-04T05:28:51 | 2020-05-04T05:28:51 | 239,786,450 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,291 | java | package test;
import javafx.util.Pair;
import org.junit.Test;
import java.util.*;
import static org.junit.Assert.assertEquals;
public class TreeDiameter {
@Test
public void testBinaryTreeDiameter() {
Integer[] values = {1, 2, 3, 4, null, null, null};
TreeNode root = BuildTree.buildTree(values);
String s;
//s.char
//assertEquals(5, diameter(root)[0]);
assertEquals(1, (int) Integer.valueOf("1"));
}
private int[] diameter(TreeNode node) {
int[] ret = new int[2];
if (node == null)
return ret;
int[] ldh = diameter(node.left);
int[] rdh = diameter(node.right);
ret[0] = Math.max(Math.max(ldh[0], rdh[0]), 1 + rdh[1] + ldh[1]);
ret[1] = Math.max(rdh[1], ldh[1]) + 1;
Integer.valueOf('1');
return ret;
}
@Test
public void testGold() {
int[] A = {10, 13, 12, 14, 15};
int n = A.length;
int[][] dp = new int[n][2];
dp[n-1][1] = 1;
dp[n-1][0] = 1;
TreeMap<Integer, Integer> map = new TreeMap<>();
map.put(A[n-1], n-1);
for (int i=n-2; i>=0; i--) {
int x = A[i];
Integer minUpper = map.ceilingKey(x);
Integer maxLower = map.floorKey(x);
if (minUpper != null) {
dp[i][1] = dp[map.get(minUpper)][0];
}
if (maxLower != null) {
dp[i][0] = dp[map.get(maxLower)][1];
}
map.put(x, i);
}
int count = 0;
for (int i=0; i<n; i++) {
if (dp[i][0] == 1)
count++;
}
assertEquals(2, count);
}
int count = 0;
private boolean backtrack(int n, int[] arr, StringBuilder sb) {
String str = sb.toString();
if (!str.equals("") && Integer.parseInt(str) > n)
return false;
for (int i=0; i<5; i++) {
if (sb.toString().isEmpty() && i == 0)
continue;
sb.append(arr[i]);
if (backtrack(n, arr, sb) && isValid(sb)) {
count++;
System.out.println(sb.toString());
}
sb.deleteCharAt(sb.length()-1);
}
return true;
}
private boolean isValid(StringBuilder sb) {
String str = sb.toString();
String rot = rotate(str);
if (str.equals(rot))
return false;
else
return true;
}
private String rotate(String str) {
StringBuilder sb = new StringBuilder();
for (Character c : str.toCharArray()) {
if (c == '6')
sb.append('9');
else if (c == '9')
sb.append('6');
else
sb.append(c);
}
return sb.reverse().toString();
}
}
| [
"mayanknarenderhooda@gmail.com"
] | mayanknarenderhooda@gmail.com |
8a4814d1ec5dd25c5e9131f9b67a1592dfa4a452 | 17db0c236e56d02feabec27ce05b4326dd181c0d | /src/main/java/org/dmonix/xml/DefaultErrorHandler.java | 564fe64005bf5474d49da460af96564f71b000ad | [] | no_license | pnerg/dmsdk | 99875760377e0af5f576888fe896eff1fa797a34 | 33b0224649cfdc8836c80bc416a4b45999b2258d | refs/heads/master | 2021-01-16T00:28:33.061740 | 2015-10-17T13:18:51 | 2015-10-17T13:18:51 | 40,402,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 733 | java | package org.dmonix.xml;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/**
* This default implemententation of the ErrorHandler does nothing. All errors and warnings will simply be ignored by this class.
* <p>
* Copyright: Copyright (c) 2006
* </p>
* <p>
* Company: dmonix.org
* </p>
*
* @author Peter Nerg
* @since 1.1
*/
public class DefaultErrorHandler implements ErrorHandler {
public void warning(SAXParseException exception) throws SAXException {
}
public void error(SAXParseException exception) throws SAXException {
}
public void fatalError(SAXParseException exception) throws SAXException {
}
}
| [
"peter.nerg@ericsson.com"
] | peter.nerg@ericsson.com |
5d41044a4b9e4b27296d45325cdb8d30acacf3a5 | 3163934b61a9dc491a06fee409eb5a64bd11ce4a | /Decorator/src/Choco.java | a2d09665222b3f4b737f432d1d7c2b7598489a80 | [] | no_license | KorSV/Patterns | f8cd55d4ebd0407ba372453ed0d142f482cfa166 | bc56328ba433fd93fc17fb760ef85b0706afe282 | refs/heads/master | 2020-04-15T15:19:55.176580 | 2019-01-17T04:46:03 | 2019-01-17T04:46:03 | 164,791,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | public class Choco extends AdditionDecorator {
Beverage beverage;
public Choco(Beverage beverage) {
this.beverage = beverage;
}
@Override
public String getDescription() {
return beverage.getDescription() + " - " + "Chocolate";
}
@Override
public int cost() {
return 7 + beverage.cost();
}
}
| [
"koryavchenko1@mail.ru"
] | koryavchenko1@mail.ru |
bfa0664fdc51001512e5b86e6ec4d55026f50919 | 4fbbcbc3880964e05ee83d850e37fe8e5c0b5ce6 | /src/main/java/com/hotel/modelVM/CustomerVM.java | d7f54b065d3d216586700e092617ae32e8dac89a | [] | no_license | tellme-dev/TellMeMgr | 09f3cda877fb217b3002cee80a6fe7609457acd1 | 070e24a775d4e3ff66cae0c62093a630be60128b | refs/heads/master | 2016-09-12T03:30:33.956892 | 2016-01-26T06:56:19 | 2016-01-26T06:56:19 | 46,178,615 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,047 | java | package com.hotel.modelVM;
import java.util.Date;
import com.hotel.model.Customer;
public class CustomerVM {
private Integer id;
private String name;
private String mobile;
private Integer sex;
private Date birthday;
private String psd;
private String photoUrl;
private Date regTime;
private Integer userId;
private String salt;
private int countAlways;
private int countBrowse;
private int countCollection;
private int countTopic;
private int countDynamic;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getPsd() {
return psd;
}
public void setPsd(String psd) {
this.psd = psd;
}
public String getPhotoUrl() {
return photoUrl;
}
public void setPhotoUrl(String photoUrl) {
this.photoUrl = photoUrl;
}
public Date getRegTime() {
return regTime;
}
public void setRegTime(Date regTime) {
this.regTime = regTime;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt;
}
public int getCountAlways() {
return countAlways;
}
public void setCountAlways(int countAlways) {
this.countAlways = countAlways;
}
public int getCountBrowse() {
return countBrowse;
}
public void setCountBrowse(int countBrowse) {
this.countBrowse = countBrowse;
}
public int getCountCollection() {
return countCollection;
}
public void setCountCollection(int countCollection) {
this.countCollection = countCollection;
}
public int getCountTopic() {
return countTopic;
}
public void setCountTopic(int countTopic) {
this.countTopic = countTopic;
}
public int getCountDynamic() {
return countDynamic;
}
public void setCountDynamic(int countDynamic) {
this.countDynamic = countDynamic;
}
public void setCustomer(Customer customer){
this.id = customer.getId();
this.name = customer.getName();
this.mobile = customer.getMobile();
this.sex = customer.getSex();
this.birthday = customer.getBirthday();
this.psd = customer.getPsd();
this.photoUrl = customer.getPhotoUrl();
this.regTime = customer.getRegTime();
this.userId = customer.getUserId();
this.salt = customer.getSalt();
}
}
| [
"531457277@qq.com"
] | 531457277@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.