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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b6f26db99eeedf498afcc1596850f98306692e29 | 29a71e40d47f16e2968b09dbb64d40305d241b74 | /Tree Structures/TreeSets.java | ee1c06cb2e9f435b07915f98cc73529eadbfb704 | [] | no_license | richard-dao/Data-Structures-Practice | 9b84d417ba881c60aadbb3bf38ef8799e8f42710 | 140538301f11e51359b87a9349b4c60087cd36e5 | refs/heads/main | 2023-09-06T07:25:27.822903 | 2021-11-10T04:09:08 | 2021-11-10T04:09:08 | 331,146,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 467 | java | Set<Integer> treeSet = new TreeSet<Integer>();
treeSet.add(9);
treeSet.add(10);
treeSet.add(0);
treeSet.add(1);
treeSet.add(2);
treeSet.remove(10);
treeSet.add(-1);
treeSet.add(10);
Iterator<Integer> itr2 = treeSet.iterator();
while (itr2.hasNext()) {
int next = itr2.next();
System.out.print(next + ", ");
itr2.remove();
}
for (int i : treeSet) {
System.out.print(i + ", ");
}
System.out.println(treeSet.toString());
| [
"noreply@github.com"
] | richard-dao.noreply@github.com |
3a6b22f29c0be2c4000c31653a1d4ab6f35cb94b | fdaa44551df28b58bd0a30a047c8a51ded23ddfb | /src/ex4/MyPointTest.java | 3f8985bed6b74e648bbcbb9b4dcbbe3ca126b25e | [] | no_license | BlackBlastRavenSub/ProgrammingClass | 8a3e65ffd9366c50089717a8c6af4487b2a98c22 | 8d28b8de9e0fd85aafd7cfb55f1605ba3b848f3a | refs/heads/master | 2021-09-17T15:06:45.613183 | 2018-07-03T06:45:55 | 2018-07-03T06:45:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 829 | java | package ex4;
public class MyPointTest {
public static void main(String[] args) {
MyPoint a, b, c, d;
a = new MyPoint(6, 8); // 1.
b = new MyPoint(10, 10); // 2.
c = new MyPoint(6, 8); // 3.
d = a; // 4.
System.out.println("a は " + a);
System.out.println("b は " + b);
System.out.println("c は " + c);
System.out.println("d は " + d);
System.out.println("a equals b は " + a.equals(b)); // 5.
System.out.println("a equals c は " + a.equals(c)); // 6.
System.out.println("a equals d は " + a.equals(d)); // 7.
System.out.println("a == b は " + (a == b)); // 8.
System.out.println("a == c は " + (a == c)); // 9.
System.out.println("a == d は " + (a == d)); // 10.
}
} | [
"smallbear0608@gmail.com"
] | smallbear0608@gmail.com |
ac216ab3fb5505a2dd2cfca0d1b119d1c8c2108f | 4e2748857672f2721004924e9a3a0ccf9bbd8141 | /inf/src/main/java/ftn/poslovna/inf/dto/InvoiceDTO.java | 227a364e50fa8b4c7dd075076e4c986cb115a501 | [] | no_license | PurpleCapacitor/Poslovna | 2a3585819e252f91f003c407102ad285a93100ff | 09e1d4ca45f6111a76b8aaa58b13cd8b31954149 | refs/heads/master | 2018-10-17T05:45:10.810733 | 2018-07-12T15:56:28 | 2018-07-12T15:56:28 | 140,302,760 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,622 | java | package ftn.poslovna.inf.dto;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import ftn.poslovna.inf.domain.BusinessPartner;
import ftn.poslovna.inf.domain.BusinessYear;
import ftn.poslovna.inf.domain.DeliveryNote;
import ftn.poslovna.inf.domain.InvoiceType;
public class InvoiceDTO {
private long id;
private int invoiceNum;
private Date invoiceDate;
private Date currencyDate;
private Date accountingDate;
private float goodsTotal;
private float discount;
private float tax;
private float totalAmount;
private String accountNum;
private String accountNumExtra;
private String invoiceType;
private long businessYearId;
private int yearNumber;
private long buyerId;
private String buyerName;
private long sellerId;
private String sellerName;
private long deliveryNoteId;
public InvoiceDTO(){
}
public InvoiceDTO(long id, int invoiceNum, Date invoiceDate, Date currencyDate, Date accountingDate,
float goodsTotal, float discount, float tax, float totalAmount, String accountNum, String accountNumExtra,
String invoiceType, long businessYearId, long buyerId, long sellerId, long deliveryNoteId) {
super();
this.id = id;
this.invoiceNum = invoiceNum;
this.invoiceDate = invoiceDate;
this.currencyDate = currencyDate;
this.accountingDate = accountingDate;
this.goodsTotal = goodsTotal;
this.discount = discount;
this.tax = tax;
this.totalAmount = totalAmount;
this.accountNum = accountNum;
this.accountNumExtra = accountNumExtra;
this.invoiceType = invoiceType;
this.businessYearId = businessYearId;
this.buyerId = buyerId;
this.sellerId = sellerId;
this.deliveryNoteId = deliveryNoteId;
}
public int getYearNumber() {
return yearNumber;
}
public void setYearNumber(int yearNumber) {
this.yearNumber = yearNumber;
}
public String getBuyerName() {
return buyerName;
}
public void setBuyerName(String buyerName) {
this.buyerName = buyerName;
}
public String getSellerName() {
return sellerName;
}
public void setSellerName(String sellerName) {
this.sellerName = sellerName;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getInvoiceNum() {
return invoiceNum;
}
public void setInvoiceNum(int invoiceNum) {
this.invoiceNum = invoiceNum;
}
public Date getInvoiceDate() {
return invoiceDate;
}
public void setInvoiceDate(Date invoiceDate) {
this.invoiceDate = invoiceDate;
}
public Date getCurrencyDate() {
return currencyDate;
}
public void setCurrencyDate(Date currencyDate) {
this.currencyDate = currencyDate;
}
public Date getAccountingDate() {
return accountingDate;
}
public void setAccountingDate(Date accountingDate) {
this.accountingDate = accountingDate;
}
public float getGoodsTotal() {
return goodsTotal;
}
public void setGoodsTotal(float goodsTotal) {
this.goodsTotal = goodsTotal;
}
public float getDiscount() {
return discount;
}
public void setDiscount(float discount) {
this.discount = discount;
}
public float getTax() {
return tax;
}
public void setTax(float tax) {
this.tax = tax;
}
public float getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(float totalAmount) {
this.totalAmount = totalAmount;
}
public String getAccountNum() {
return accountNum;
}
public void setAccountNum(String accountNum) {
this.accountNum = accountNum;
}
public String getAccountNumExtra() {
return accountNumExtra;
}
public void setAccountNumExtra(String accountNumExtra) {
this.accountNumExtra = accountNumExtra;
}
public String getInvoiceType() {
return invoiceType;
}
public void setInvoiceType(String invoiceType) {
this.invoiceType = invoiceType;
}
public long getBusinessYearId() {
return businessYearId;
}
public void setBusinessYearId(long businessYearId) {
this.businessYearId = businessYearId;
}
public long getBuyerId() {
return buyerId;
}
public void setBuyerId(long buyerId) {
this.buyerId = buyerId;
}
public long getSellerId() {
return sellerId;
}
public void setSellerId(long sellerId) {
this.sellerId = sellerId;
}
public long getDeliveryNoteId() {
return deliveryNoteId;
}
public void setDeliveryNoteId(long deliveryNoteId) {
this.deliveryNoteId = deliveryNoteId;
}
}
| [
"goranrajic95@gmail.com"
] | goranrajic95@gmail.com |
8cb01af6f4c4d9d1bee5ce8c6e60e5f7bc111c52 | 5098250536c3d8e9498517b54d21b45ad68f85ed | /Dadosactivity/app/src/androidTest/java/dadosactivity/cursoandroid/com/dadosactivity/ExampleInstrumentedTest.java | b47f46e6d0756a251efc57c4be624f0b088a8c8f | [] | no_license | AdemarioJ/Exemplos-App | 1c2e6445297994bd86703b3d4243729129d7702e | e52994a4098168505ffebdcc10e053c7c532b166 | refs/heads/master | 2020-04-02T00:57:06.019318 | 2018-10-19T19:51:55 | 2018-10-19T19:51:55 | 153,829,572 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 789 | java | package dadosactivity.cursoandroid.com.dadosactivity;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("dadosactivity.cursoandroid.com.dadosactivity", appContext.getPackageName());
}
}
| [
"silva.ademario@onpax.com.br"
] | silva.ademario@onpax.com.br |
ae26dbb0aad37973991faeebd1862b70afd1797a | 72f71688bf20d45df8b1ac5e2e8d1e3e84c6a519 | /restful/src/main/java/com/weiwuu/cloud/wx/util/wx/TokenThread.java | 0446ae0ec557d9d0c1a4392df17aff9c02e3142f | [] | no_license | ww-liuhui/wx | 4ece48c95612ae7f625654c5ea63525d6e8fbe43 | 8d94309d3392da9144f8ad054f31501cd1b431ae | refs/heads/master | 2021-01-10T01:52:21.071071 | 2016-03-17T07:08:19 | 2016-03-17T07:08:19 | 54,051,285 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,343 | java | package com.weiwuu.cloud.wx.util.wx;
/**
* Created by hui on 2015/11/16.
*/
import com.weiwuu.cloud.wx.domain.wx.AccessToken;
import com.weiwuu.cloud.wx.domain.wx.WeixinUserInfo;
import com.weiwuu.cloud.wx.domain.wx.WeixinUserList;
import com.weiwuu.cloud.wx.factory.RedisServiceFactory;
import com.weiwuu.protobuf.WXUser;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.Transaction;
import java.util.ArrayList;
import java.util.List;
/**
* 定时刷新微信access_token
*
* @author liu
* @date 2015-11-16
*/
public class TokenThread implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(TokenThread.class);
// 订阅号
public static String appid = "";
public static String appsecret = "";
public static AccessToken accessToken = null;
public static String ticket = null;
public static String weixinOauth2Token = null;
// 服务号
public static String appid2 = "";
public static String appsecret2 = "";
public static AccessToken accessToken2 = null;
public static String ticket2 = null;
public static String weixinOauth2Token2 = null;
public static JedisPool jedisPool = null;
public void run() {
while (true) {
try {
accessToken = WeixinUtil.getAccessToken(appid, appsecret);
JSONObject json = null;
// 拼接请求地址
String requestUrl = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=jsapi";
requestUrl = requestUrl.replace("ACCESS_TOKEN",accessToken.getToken());
json = WeixinUtil.httpRequest(requestUrl, "GET", null);
ticket = json.get("ticket").toString();
accessToken2 = WeixinUtil.getAccessToken(appid2, appsecret2);
JSONObject json2 = null;
// 拼接请求地址
String requestUrl2 = "https://api.weixin.qq" +
".com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=jsapi";
requestUrl2 = requestUrl2.replace("ACCESS_TOKEN",accessToken2.getToken());
json2 = WeixinUtil.httpRequest(requestUrl2, "GET", null);
ticket2 = json2.get("ticket").toString();
//更新关注用户列表
String WX_USER_UNIONID = "wx:user:unionid:[unionid]";
String WX_USER_OPENID = "wx:user:openid:[openid]";
String WX_USER_LIST = "wx:user:list";
Jedis jedis = jedisPool.getResource();
WeixinUserList weixinUserList = UserList.getUserList(accessToken.getToken(), "");
List<String> openIdList = new ArrayList<String>();
openIdList = weixinUserList.getOpenIdList();
try
{
String flag = null;
for (String openId : openIdList) {
flag = jedis.get(WX_USER_OPENID.replace("[openid]",openId));
if(null==flag||flag.length()==0){
WeixinUserInfo userInfo = UserInfo.getUserInfo(accessToken.getToken(), openId);
if (userInfo != null) {
WXUser.Builder builder = WXUser.newBuilder();
builder.setUnionid(userInfo.getUnionid());
builder.setSubscribe(userInfo.getSubscribe());
builder.setSubscribeTime(userInfo.getSubscribeTime());
builder.setNickname(userInfo.getNickname());
builder.setSex(userInfo.getSex());
builder.setCountry(userInfo.getCountry());
builder.setProvince(userInfo.getProvince());
builder.setCity(userInfo.getCity());
builder.setLanguag(userInfo.getLanguag());
builder.setHeadImgUrl(userInfo.getHeadImgUrl());
builder.setRemark(userInfo.getRemark());
builder.setGroupid(userInfo.getGroupid());
builder.setOpenId(userInfo.getOpenId());
WXUser wxUser = builder.build();
byte[] bytes = wxUser.toByteArray();
Transaction tc = jedis.multi();
tc.set(WX_USER_UNIONID.replace("[unionid]",userInfo.getUnionid()).getBytes(),bytes);
tc.set(WX_USER_OPENID.replace("[openid]",userInfo.getOpenId()),userInfo.getUnionid());
tc.zadd(WX_USER_LIST,Long.parseLong(userInfo.getSubscribeTime()), userInfo.getUnionid());
tc.exec();
}
}
}
LOGGER.error("更新关注用户列表成功!");
}catch (Exception e){
LOGGER.error("更新关注用户列表失败:"+e.getMessage());
e.printStackTrace();
}finally
{
RedisServiceFactory.returnResource(jedisPool, jedis);
}
if (null != accessToken && null != accessToken2) {
//log.info("获取access_token成功,有效时长{}秒 token:{}", accessToken.getExpiresIn(), accessToken.getToken());
// 休眠7000秒
Thread.sleep((accessToken.getExpiresIn() - 1200) * 1000);
} else {
// 如果access_token为null,60秒后再获取
Thread.sleep(60 * 1000);
}
} catch (InterruptedException e) {
try {
Thread.sleep(60 * 1000);
} catch (InterruptedException e1) {
LOGGER.error("更新accessToken失败:"+e.getMessage());
}
//log.error("{}", e);
}
}
}
}
| [
"liuhui@weiwuu.com"
] | liuhui@weiwuu.com |
7929248b04e045ce6d4144231ea3bc1890783247 | 22a2fd1ecb61de6dcef8a783e7374b95058161c6 | /TeamCode/src/main/java/com/kauailabs/navx/ftc/IDataArrivalSubscriber.java | 1b75594679300e91abb29641897b9046d17bef24 | [
"BSD-3-Clause"
] | permissive | MillburnHighSchoolRobotics/FTC-2018-2019 | fd1c6f727fea555dc51f088cecd409ac4b3039f2 | 70c8987903bd9703626e07b70c49232945f8755f | refs/heads/master | 2020-03-29T17:27:52.182464 | 2019-03-10T20:33:13 | 2019-03-10T20:33:13 | 150,164,172 | 6 | 0 | null | 2018-12-20T00:45:53 | 2018-09-24T20:26:31 | Java | UTF-8 | Java | false | false | 3,666 | java | /* ============================================
NavX-MXP and NavX-Micro source code is placed under the MIT license
Copyright (c) 2015 Kauai Labs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
===============================================
*/
package com.kauailabs.navx.ftc;
/**
* The IDataArrivalSubscriber interface provides a method for consumers
* of navX-Model device data to be rapidly notified whenever new data
* has arrived.
*
* Two separate "callback" functions are provided:
*
* - timesetampedDataReceived(): reception of sensor-timestamped data
* - untimestampedDataReceived(): reception of data without a sensor-
* provided timestamp.
*
* Both timestamps are at millisecond resolution. A "system timestamp"
* is provided in both casees, which represents as accurately as possible
* the time at which this process acquired the data.
*
* If available, sensor timestamps are preferred, as they are generated
* by a real-time system and thus have a greater accuracy than the
* system timestamp which is vulnerable to latencies introduced by the
* non-realtime Android operating system.
*
* To support data retrieval of various different types of data from a
* single data publisher, a "kind" object is also provided which can be
* used to indicate the type of data being referred to in the
* notification.
*
* This callback is invoked by the AHRS class whenever new data is r
* eceived from the sensor. Note that this callback is occurring
* within the context of the AHRS class IO thread, and it may
* interrupt the thread running this opMode. Therefore, it is
* very important to use thread synchronization techniques when
* communicating between this callback and the rest of the
* code in this opMode.
*
* The sensor_timestamp is accurate to 1 millisecond, and reflects
* the time that the data was actually acquired. This callback will
* only be invoked when a sensor data sample newer than the last
* is received, so it is guaranteed that the same data sample will
* not be delivered to this callback more than once.
*
* If the sensor is reset for some reason, the sensor timestamp
* will be reset to 0. Therefore, if the sensor timestamp is ever
* less than the previous sample, this indicates the sensor has
* been reset.
*
* In order to be called back, this interface must be registered
* via the AHRS registerCallback() method.
*/
public interface IDataArrivalSubscriber {
void untimestampedDataReceived(long system_timestamp, Object kind);
void timestampedDataReceived(long system_timestamp, long sensor_timestamp, Object kind);
void yawReset();
}
| [
"david.shustin@gmail.com"
] | david.shustin@gmail.com |
4ec328ddf334b68bccaac4440c90909b684b65f4 | 67ee7621afb9de07918676afb402ef85f24cb71a | /src/crazy/controller/ClientController.java | c3062a7e5da1c72d6e767835682da727caff14b5 | [] | no_license | ssraul/crazyMVC | e670fe3feccbd5f8bd9b154933e3f432743ec48c | e0b2fc95db1fe3241384c698872693d0a42b161f | refs/heads/master | 2020-02-26T15:45:13.568632 | 2016-11-09T18:22:02 | 2016-11-09T18:22:02 | 70,834,114 | 0 | 0 | null | null | null | null | ISO-8859-10 | Java | false | false | 6,403 | java | package crazy.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import crazy.model.Client;
import crazy.model.Order;
import crazy.service.IClientService;
import crazy.service.IOrderService;
@Controller
@RequestMapping(value = "/client")//es un primer filtro
public class ClientController {
@Autowired
IClientService clientService;
/**
* ejemplo 2 para obtener datos con el @PathVariable
* @param email
* @param model
* @return
*/
@RequestMapping(value = "/client/{email}/", method=RequestMethod.GET)//es un segundo filtro
public String obtenerClientePath(@PathVariable String email, Model model) {
Client c = clientService.getClient(email);
model.addAttribute("cliente1", c);
return "cliente";
}
/**
* ejemplo1 para obtener el email por parametros
* @param email
* @param model
* @return
*/
//@RequestMapping(value = {"/","/lista"}, method=RequestMethod.GET)//para que se habra llamando a diferentes RequestMapping
@RequestMapping(value = "/client", method=RequestMethod.GET)//es un segundo filtro
public String obtenerCliente(@RequestParam() String email, Model model) {
//@RequestParam(name="mail") String email // tambien se puede hacer asi, si tienen el mismo nombrename="mail"
//requiered=false, el parametro no es obligatorio, o un valor por defecto defaultValue="raul@gmail.com",
//el orden del paso de parametros es indiferente
//si nos pasan muchos parametros lo podemos gestionar con @RequestParam Map<String, String> queryMap
Client c = clientService.getClient(email);
model.addAttribute("cliente1", c);
return "cliente";
}
/**
* Para obtener listado de clientes
* @param model
* @return
*/
@RequestMapping(value = {"/","/lista"}, method=RequestMethod.GET)//es un segundo filtro
public String obtenerListaClientes(Model model) {
List<Client>listado;
listado=clientService.getClientList();
model.addAttribute("listadoClientes",listado);
return "clientes";
}
@RequestMapping(value = {"/nuevoCliente"}, method=RequestMethod.GET)//Para crear alta de clientes, solo devuelve una vista
public String addClient(Model model){
//te hace un cliente vacio para que no haya error
//model.addAttribute("cliente", new Client());
model.addAttribute("totalErrores", 0);
model.addAttribute("listaErrores", null);
return "clienteForm";
}
@RequestMapping(value = {"/borrarcliente"}, method=RequestMethod.GET)//Para crear alta de clientes, solo devuelve una vista
public String deleteClient(Model model, @RequestParam(name="email") String email){
String borrado = "OK";
clientService.deleteClient(email);
model.addAttribute("validacion", email);
return "clienteForm";
}
/*
@RequestMapping(value = {"/saveclient"}, method=RequestMethod.POST)//Para crear alta de clientes, solo devuelve una vista
public String salvarCliente(Model model, @RequestParam Map<String, String> misDatos){
//validaciones y enviar a la base de datos
String nombre = misDatos.get("nombre");
String apellido = misDatos.get("apellido");
String email = misDatos.get("email");
String insercion = "Cliente insertado correctamente";
//1.validacion de datos
//2.insertar en base de datos
if(!clientService.addClient(nombre, apellido, email)){
insercion = "Error al grabar datos";
}
misDatos.put("insercion", insercion);
model.addAttribute("datos", misDatos);
model.addAttribute("nombre",nombre);
model.addAttribute("apellido",apellido);
model.addAttribute("email",email);
model.addAttribute("insercion",insercion);
//varias maneras de devolver el resultado
return obtenerListaClientes(model);
//return "redirect:lista";
//return "clienteForm";
}
*/
/**
* Ejemplo 4 mejor manera de aņadir cliente, los name del formulario tienen que tener
* los mismos que la clase cliente name, surname, email. solo con el @ModelAttribute
* @param model
* @param cliente
* @return
*/
@RequestMapping(value = {"/saveclient"}, method=RequestMethod.POST)
public String salvarCliente(Model model,@Valid @ModelAttribute(name="cliente") Client cliente,
BindingResult result){
//BindingResult result es el resultado de la validacion de Spring
//@valid es el de las validaciones, es el equivalente a hacer la llamada validator, en la validacion manual
//@ModelAttribute, consigue los datos de la clase entera, siempre que coincidan los nombre y la
//conversion de datos tambien me la hace spring.
//si hay errores en el formulario, lo redirigimos la formulario otra vez
//si hay errores guarda el total de errores y los manda otra vez al formulario
if(result.hasErrors()){
//todos los errores
//model.addAttribute("errores",result);//podraimos tener solo este para tener errores
model.addAttribute("totalErrores", result.getErrorCount());
model.addAttribute("listaErrores", result.getAllErrors());
model.addAttribute("nombre",cliente.getName());
model.addAttribute("apellido",cliente.getSurname());
model.addAttribute("email",cliente.getEmail());
//model.addAttribute("pruebas",result.getFieldErrorCount("name"));
return "clienteForm";
}
if(clientService.addClientFull(cliente)){
return obtenerListaClientes(model);
}
//podemos hacer diferentes salidas de datos.
return obtenerListaClientes(model);
//return "clienteForm";
//return "redirect:lista";
}
/**
* Modelo compartido por todas las peticiones
* @param model
*/
@ModelAttribute
public void ejemplo(Model model){
model.addAttribute("mensaje","crazy aplication");
}
}
| [
"Usuario@AI13"
] | Usuario@AI13 |
ee71f2572d1fffec36ac03a7c6045c6387f9fca0 | 7639bb41eecf2c3c4c6988222c7f4e4c8ae3b8e6 | /algorithm/src/main/java/lt/vaidotas/bes/generatable/BigInteger8BitGeneratable.java | 10162f63122506aa60296ca8bd869ee23c124afb | [] | no_license | Juronis/bes | 1ada2ebfd323e6f5684ecef9a82dcfee58b8665d | 866619f40756ebf6331cb3ef44dfc8db76b51f0e | refs/heads/master | 2020-12-10T08:56:50.016673 | 2020-01-14T09:11:50 | 2020-01-14T09:11:50 | 233,550,410 | 0 | 0 | null | 2020-10-13T18:48:58 | 2020-01-13T08:46:55 | Java | UTF-8 | Java | false | false | 1,019 | java | package lt.vaidotas.bes.generatable;
import java.math.BigInteger;
/**
*
* @author Vaidotas
* Wrapper for BigInteger, with comparison based in last 8 bits
*/
public class BigInteger8BitGeneratable extends Generatable<BigInteger>{
static final BigInteger TwoToPowerEight = new BigInteger("256");
public BigInteger8BitGeneratable(BigInteger pObjectHolder) {
super(pObjectHolder);
}
@Override
public int compareToGenerated(Object toCompare) {
if(!(toCompare instanceof BigInteger8BitGeneratable)){
throw new ClassCastException("Invalid class type. Expected: BigInteger8BitGeneratable, got: "
+ toCompare.getClass().getCanonicalName());
}
return getObjectHolder().remainder(TwoToPowerEight)
.compareTo(((BigInteger8BitGeneratable)toCompare).getObjectHolder().remainder(TwoToPowerEight));
}
@Override
public String stringRepresentation() {
return getObjectHolder().toString();
}
}
| [
"vaidotas@smthsmth.com"
] | vaidotas@smthsmth.com |
3e629c1b767cc7ae92858884746339bf6a5d6343 | 5416372a66507791107d94c7f205c25bc099ccc2 | /src/main/java/com/melalex/chat/annotation/Actor.java | 7de8bce2068f025750e70682df85851d03a32b63 | [] | no_license | melalex/akka-chat | 4285127dcd273010343da044fd61b7ed13cf3a48 | 436893921ca7dece48b5b273588df9b4db3ec8e0 | refs/heads/master | 2022-10-09T09:17:00.510122 | 2020-06-02T12:44:22 | 2020-06-02T12:44:22 | 268,798,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package com.melalex.chat.annotation;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.lang.annotation.*;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
@Scope("prototype")
public @interface Actor {
}
| [
"alex.melashchenko@MacBook-Pro-Alex.local"
] | alex.melashchenko@MacBook-Pro-Alex.local |
8cab4b398493564c018cd2c786d55012f7828ff8 | ab0d62b6f9fb72a65040cc9b9af9ace2c1bc6e3e | /src/dungeoncrawler/Characters/Monsters/MonsterGroups/Ogres.java | 3cd52ffe2c2a03f1be94402b756a8493b057b45d | [] | no_license | nim5023/DungeonCrawl | 2636c1546a191a69a62c9018365109b64160c0ec | 6b053fa36a405357ea1872750b18f702b039bc54 | refs/heads/master | 2020-03-21T01:42:53.270293 | 2018-06-20T00:33:22 | 2018-06-20T00:33:22 | 137,957,920 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,012 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package dungeoncrawler.Characters.Monsters.MonsterGroups;
import dungeoncrawler.Characters.MonsterGroup;
import dungeoncrawler.Characters.Monsters.*;
import dungeoncrawler.DungeonCrawler;
import dungeoncrawler.ImageHandler;
import dungeoncrawler.StateHandlers.BattleHandler;
import java.util.Random;
/**
*
* @author Nick
*/
public class Ogres extends MonsterGroup{
public Ogres(){
super();
MapImage = ImageHandler.Ogre;
name = "Ogres";
monsterList.push(new OgreBrawler(450,320,BattleHandler.MonsterLevel));
monsterList.push(new OgreShaman(500,160,BattleHandler.MonsterLevel));
drctTime = 100;
moveTime = 300;
restTime = 400;
restClock = DungeonCrawler.RND.nextInt(restTime);
Speed = 2;
}
}
| [
"Nick@192.168.2.9"
] | Nick@192.168.2.9 |
8c0cc9032c30adea6e76297c3326890b7c77c9cb | 86c0e5e717955f615093788b3c3e772c2e9bf86f | /Hadoop_example/NetDataParse/src/main/java/simple/jobstream/mapreduce/site/ebsco_lxh/ExoprtID.java | 904d89a5a070a2bc7e227cedf10c7988c592c46c | [] | no_license | Sustartpython/My-Python-Examples | 17cba596de3a5818f32d72c5a6abf25cd599dac0 | 6af2314693d929c35a4636cf047eea9490969e78 | refs/heads/master | 2022-09-09T10:04:09.936098 | 2020-03-16T03:32:48 | 2020-03-16T03:32:48 | 214,319,813 | 3 | 0 | null | 2022-09-01T23:18:15 | 2019-10-11T01:47:42 | Java | UTF-8 | Java | false | false | 4,132 | java | package simple.jobstream.mapreduce.site.ebsco_lxh;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.Mapper.Context;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
import com.process.frame.base.InHdfsOutHdfsJobInfo;
import com.process.frame.base.BasicObject.BXXXXObject;
import com.process.frame.base.BasicObject.XXXXObject;
import com.process.frame.util.VipcloudUtil;
import simple.jobstream.mapreduce.common.vip.VipIdEncode;
public class ExoprtID extends InHdfsOutHdfsJobInfo {
private static int reduceNum = 1;
public static final String inputHdfsPath = "/RawData/ebsco/aph_ASP/latest";
public static final String outputHdfsPath = "/RawData/ebsco/aph_ASP/ID";
public void pre(Job job) {
String jobName = "cnki_bs." + this.getClass().getSimpleName();
job.setJobName(jobName);
}
public void post(Job job) {
}
public String getHdfsInput() {
return inputHdfsPath;
}
public String getHdfsOutput() {
return outputHdfsPath;
}
public void SetMRInfo(Job job) {
job.getConfiguration().setFloat("mapred.reduce.slowstart.completed.maps", 0.9f);
System.out.println("******mapred.reduce.slowstart.completed.maps*******" + job.getConfiguration().get("mapred.reduce.slowstart.completed.maps"));
job.getConfiguration().set("io.compression.codecs", "org.apache.hadoop.io.compress.GzipCodec,org.apache.hadoop.io.compress.DefaultCodec");
System.out.println("******io.compression.codecs*******" + job.getConfiguration().get("io.compression.codecs"));
job.setOutputFormatClass(TextOutputFormat.class);
job.setMapOutputKeyClass(Text.class);
job.setMapOutputValueClass(NullWritable.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(NullWritable.class);
job.setMapperClass(ProcessMapper.class);
job.setReducerClass(ProcessReducer.class);
TextOutputFormat.setCompressOutput(job, false);
job.setNumReduceTasks(reduceNum);
}
// ======================================处理逻辑=======================================
public static class ProcessMapper extends
Mapper<Text, BytesWritable, Text, NullWritable> {
public static Set<String> isbnSet = new HashSet<String>();
public void cleanup(Context context) throws IOException,
InterruptedException {
}
public void map(Text key, BytesWritable value, Context context)
throws IOException, InterruptedException {
String lngid= "";
String rawid = "";
String oldid = "";
String newid = "";
XXXXObject xObj = new XXXXObject();
VipcloudUtil.DeserializeObject(value.getBytes(), xObj);
for (Map.Entry<String, String> updateItem : xObj.data.entrySet()) {
if (updateItem.getKey().toLowerCase().equals("rawid")) {
rawid = updateItem.getValue().trim();
}
}
oldid = VipIdEncode.getLngid("00100", rawid, false);
rawid="aph_"+rawid;
lngid = VipIdEncode.getLngid("00100", rawid, false);
newid =oldid +"★" +lngid ;
context.getCounter("map", "count").increment(1);
context.write(new Text(newid), NullWritable.get());
}
}
public static class ProcessReducer extends
Reducer<Text, NullWritable, Text, NullWritable> {
public void reduce(Text key, Iterable<NullWritable> values,
Context context) throws IOException, InterruptedException {
context.getCounter("reducer", "count").increment(1);
context.write(key, NullWritable.get());
}
}
} | [
"476274024@qq.com"
] | 476274024@qq.com |
26361c5659646a10ce5995ee7dfd0a0614ee6bef | 4ccecc83a3120dfe8e6c348671afa1eb4e684b7c | /src/Source/Interfaces/InitializeScene.java | e0babd3a2de454d28c816345df53d832aac3e0d8 | [
"MIT"
] | permissive | mroui/cloud-tag | 508329fd5ca8287968bd0ea448065c115a17b996 | 516e5475e73303c3c74562ad776e2bac0d82e37f | refs/heads/master | 2020-07-30T01:10:56.473994 | 2019-10-03T12:56:09 | 2019-10-03T12:56:09 | 210,031,284 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 614 | java | package Source.Interfaces;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Pane;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
public interface InitializeScene {
default void init(Button exitButton, Pane pane, String xImagePath) {
try {
Image xImage = new Image(new FileInputStream(xImagePath));
exitButton.setGraphic(new ImageView(xImage));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
pane.setOpacity(0);
}
}
| [
"martynaxroj@gmail.com"
] | martynaxroj@gmail.com |
00fc326c703971aabaed3d401827c576fafe55b4 | 6832046236dcf6ea8cdbbc9d6f9384d4593a21b4 | /src/main/java/ir/maktab/dao/DAO.java | b7268fa3eb8e971d36ad32ec2fbf5e703bb52159 | [] | no_license | smmahdie/mavenUniversity | acf878322015aba075f5cb3ff8dbb5d061bbdf10 | 2e3ec9975a2ff3eafa1ba85cc92d93e2c686ef33 | refs/heads/master | 2020-03-11T14:40:24.452062 | 2018-04-18T13:09:29 | 2018-04-18T13:09:29 | 130,061,247 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,056 | java | package ir.maktab.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
import ir.maktab.entities.Person;
public abstract class DAO {
protected Connection con;
protected PreparedStatement ps;
private static final String DB_URL = "jdbc:mysql://127.0.0.1:3306/uni?user='root'";
{
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(DB_URL);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public abstract Boolean save(Person p);
public abstract Person load(Integer id);
public abstract Boolean update(Person p);
public abstract Boolean delete(Integer id);
public abstract List<Person> list();
@Override
protected void finalize(){
try {
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} | [
"smme.72523@gmail.com"
] | smme.72523@gmail.com |
c7a96442d4701a8b2288e94b3db7f3bffe3f749a | 2ece73ba430c849d495adeb4bbf8bb95f547dc0a | /src/main/java/org/avenue1/target/web/rest/LogsResource.java | e64b59f2758ec8ce4834649eac6907c546781970 | [] | no_license | avenueone/targetSvc | 795e259eb17cef1850caf492e55b47a71755a622 | 939d2f03abca4177244188f26b758259ae1cbbb9 | refs/heads/master | 2020-04-12T00:06:48.036754 | 2019-02-19T22:22:53 | 2019-02-19T22:22:53 | 162,189,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,174 | java | package org.avenue1.target.web.rest;
import org.avenue1.target.web.rest.vm.LoggerVM;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
import com.codahale.metrics.annotation.Timed;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
/**
* Controller for view and managing Log Level at runtime.
*/
@RestController
@RequestMapping("/management")
public class LogsResource {
@GetMapping("/logs")
@Timed
public List<LoggerVM> getList() {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
return context.getLoggerList()
.stream()
.map(LoggerVM::new)
.collect(Collectors.toList());
}
@PutMapping("/logs")
@ResponseStatus(HttpStatus.NO_CONTENT)
@Timed
public void changeLevel(@RequestBody LoggerVM jsonLogger) {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel()));
}
}
| [
"lee@avenue1.org"
] | lee@avenue1.org |
0c4f1d4ea91a7a5c5a43b1c98fbaba687404483c | 120f7819c49c6586bedc406f592e70d294bea7a6 | /src/main/java/com/hui/common/entity/SysAuth.java | acfc66e990791c1f3acc71c2746b89eeed7c8119 | [] | no_license | tangtaijia/hui | 010e8f5ec06f379fcb2114366bde175466e636d9 | fae90f15c20d1fb70f0c65870a00524160c80b94 | refs/heads/master | 2021-01-01T19:07:24.652658 | 2014-12-07T01:41:43 | 2014-12-07T01:41:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 998 | java | package com.hui.common.entity;
/**
*
* <权限 菜单 中间表>
* <功能详细描述>
*
* @author LuLiLi
* @version [版本号, 2014-2-6]
* @see [相关类/方法]
* @since [产品/模块版本]
*/
public class SysAuth extends BaseEntity
{
private static final long serialVersionUID = 8034803055131465661L;
/**
* 主键
*/
private Integer authId;
/**
* 权限id
*/
private Integer roleId;
/**
* 菜单id
*/
private Integer menuId;
public Integer getAuthId()
{
return authId;
}
public void setAuthId(Integer authId)
{
this.authId = authId;
}
public Integer getRoleId()
{
return roleId;
}
public void setRoleId(Integer roleId)
{
this.roleId = roleId;
}
public Integer getMenuId()
{
return menuId;
}
public void setMenuId(Integer menuId)
{
this.menuId = menuId;
}
} | [
"tangtaijia@qq.com"
] | tangtaijia@qq.com |
88029227439c33dda4cef9822c3823344c27f1a9 | bb2832ffa9bb0622fab076c5cec6ca0978cd8f1d | /src/teamCreditProjectApp/ui/OverseasExpense.java | 25f447bf6673ab7175640dcc327c5aaae82eefdf | [] | no_license | soonann/team-credit | 5a222a4d0d2d7c6aed8abe70727800692c587c1f | 9621c723cf092e847332e04a5bd7f051b19df002 | refs/heads/master | 2022-07-25T05:10:59.856715 | 2018-10-25T06:05:27 | 2018-10-25T06:05:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,351 | java | package teamCreditProjectApp.ui;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.Font;
import javax.swing.JTextField;
import teamCreditProjectApp.dataAccess.TransactionDA;
import teamCreditProjectApp.entity.Login;
import teamCreditProjectApp.entity.Transaction;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class OverseasExpense extends MasterPanel {
private JTextField dateTextField;
private JTextField descriptionTextField;
private JTextField categoryTextField;
private JTextField amountTextField;
private Transaction transaction;
private JButton okButton;
private String actions;
/**
* Create the panel.
* @wbp.parser.constructor
*/
public OverseasExpense(JFrame mf,Login l1) {
super(mf,l1);
setLayout(null);
JLabel addExpenseLabel = new JLabel("Add Expense");
addExpenseLabel.setFont(new Font("Tahoma", Font.PLAIN, 20));
addExpenseLabel.setBounds(385, 165, 133, 31);
add(addExpenseLabel);
JLabel dateLabel = new JLabel("Date:");
dateLabel.setFont(new Font("Tahoma", Font.PLAIN, 15));
dateLabel.setBounds(273, 238, 100, 19);
add(dateLabel);
dateTextField = new JTextField();
dateTextField.setBounds(376, 238, 221, 20);
add(dateTextField);
dateTextField.setColumns(10);
JLabel descriptionLabel = new JLabel("Description:");
descriptionLabel.setFont(new Font("Tahoma", Font.PLAIN, 15));
descriptionLabel.setBounds(273, 269, 100, 19);
add(descriptionLabel);
descriptionTextField = new JTextField();
descriptionTextField.setColumns(10);
descriptionTextField.setBounds(376, 268, 221, 20);
add(descriptionTextField);
JLabel categoryLabel = new JLabel("Category:");
categoryLabel.setFont(new Font("Tahoma", Font.PLAIN, 15));
categoryLabel.setBounds(273, 298, 100, 19);
add(categoryLabel);
categoryTextField = new JTextField();
categoryTextField.setColumns(10);
categoryTextField.setBounds(376, 299, 221, 20);
add(categoryTextField);
JLabel amountLabel = new JLabel("Amount:");
amountLabel.setFont(new Font("Tahoma", Font.PLAIN, 15));
amountLabel.setBounds(273, 328, 100, 19);
add(amountLabel);
amountTextField = new JTextField();
amountTextField.setColumns(10);
amountTextField.setBounds(376, 328, 221, 20);
add(amountTextField);
JButton okButton = new JButton("OK");
okButton.setFont(new Font("Tahoma", Font.PLAIN, 15));
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
actionPerformedOk();
}
private boolean validateInput() {
boolean result = false;
String msg = "";
int msgType = JOptionPane.ERROR_MESSAGE;
// retrieve the user input from the text box/area provided
String date = dateTextField.getText();
String description = descriptionTextField.getText();
String category = categoryTextField.getText();
String amount = amountTextField.getText();
if (date.length() != 10)
msg += "Please enter date in DD/MM/YYYY format.\n";
if (description.length() == 0)
msg += "Please enter description.\n";
if (category.length() == 0)
msg += "Please enter category.\n";
if (amount.length() == 0 || amount.length()<=0)
msg += "Please enter amount.\n";
if (msg.length() == 0)
result = true;
else
JOptionPane.showMessageDialog(myFrame, msg, "Alert", msgType);
return result;
}
private void actionPerformedOk() {
int id = 0;
double transactionAmount = 0;
String transactionDate = dateTextField.getText();
String description = descriptionTextField.getText();
String category = categoryTextField.getText();
// retrieve the user input from the text box/area provided
if (validateInput()) {
//category = String.parseString(categoryTextField.getText());
transactionAmount = Double.parseDouble(amountTextField.getText());
transaction = new Transaction(id,"4628-1234-1234-1234",transactionDate,transactionAmount,description,category);
actionPerformedCreate();
}
}
/**
* Purpose: This method updates the expense record
* in the database.
* Input: Nil
* Return: void
*/
public void actionPerformedUpdate(){
// Update record in database and check return value
if (TransactionDA.updateTransaction(transaction)) {
JOptionPane.showMessageDialog(myFrame,
"Record updated successfully", "Alert",
JOptionPane.INFORMATION_MESSAGE);
// reset text field for next record.
dateTextField.setEditable(false);
descriptionTextField.setEditable(false);
categoryTextField.setEditable(false);
amountTextField.setEditable(false);
okButton.setEnabled(false);
}
else {
JOptionPane.showMessageDialog(myFrame,
"Database Error. Record not updated.", "Alert",
JOptionPane.ERROR_MESSAGE);
}
}
/**
* Purpose: This method creates the expense record
* in the database.
* Input: Nil
* Return: void
*/
public void actionPerformedCreate(){
// insert to database and check return value
if (TransactionDA.createTransaction(transaction)) {
JOptionPane.showMessageDialog(myFrame,
"Record created successfully", "Alert",
JOptionPane.INFORMATION_MESSAGE);
// reset text field for next record.
dateTextField.setText("");
descriptionTextField.setText("");
categoryTextField.setText("");
amountTextField.setText("");
}
else
JOptionPane.showMessageDialog(myFrame,
"Database Error. Record not created.", "Alert",
JOptionPane.ERROR_MESSAGE);
}
});
okButton.setBounds(335, 388, 92, 31);
add(okButton);
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
JPanel contentPane = new MasterPanel(myFrame,l1);
myFrame.getContentPane().removeAll();
myFrame.setContentPane(contentPane);
myFrame.setVisible(true);
}
});
cancelButton.setFont(new Font("Tahoma", Font.PLAIN, 15));
cancelButton.setBounds(449, 388, 92, 31);
add(cancelButton);
}
public OverseasExpense(JFrame mf, Transaction e1,Login l1) {
this(mf,l1);
}
}
| [
"soonann.tan@outlook.com"
] | soonann.tan@outlook.com |
faffb87dccc8097384ed120aeb64b81f4691deb8 | d5623eb71396af7c447e049dc5e3a063eacb833d | /src/main/java/com/sequoia/web/fileupload/MultipartFileBucketValidator.java | b80f49586447fee926a477714c52129b57c61fcd | [] | no_license | kikilink/MaterialRepository | d904df117891b0c7290c0ed03f36d2f76c3ef876 | 476f63946fa555de6ed7cb593477226cbe3c5915 | refs/heads/master | 2021-08-16T03:11:17.822163 | 2018-09-03T23:31:45 | 2018-09-03T23:31:45 | 135,893,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 940 | java | package com.sequoia.web.fileupload;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
/**
* Created by sunjun on 16/9/28.
*/
@Component
public class MultipartFileBucketValidator implements Validator {
public boolean supports(Class<?> clazz) {
return MultipartFileBucket.class.isAssignableFrom(clazz);
}
public void validate(Object obj, Errors errors) {
MultipartFileBucket multipartFileBucket = (MultipartFileBucket) obj;
if (multipartFileBucket.getMultipartFile() != null) {
if (multipartFileBucket.getMultipartFile().getSize() == 0) {
errors.rejectValue("multipartFile",
"MultipartFileBucketValidator.multipartFileBucket.multipartFile",
"请选择需上传的文件");
}
}
}
} | [
"546324943@qq.com"
] | 546324943@qq.com |
e8644e697cca83ed1a57ce520f53fbab1c23f4f7 | 28090712ce57a8c6358db7a08afdbe62e944617c | /Hazi4-5.src/feladat6/zh/Test.java | def3c00a0aa9d57bcbb505f3557e8474c2e391e9 | [] | no_license | locziagoston/Prog2Hazi | 36cc26589a679759d9098bc84401b692b3f458ed | 01d0064ae03124602d66b2e04e0cc01db7be758a | refs/heads/master | 2020-03-29T16:24:29.224031 | 2018-12-03T17:11:22 | 2018-12-03T17:11:22 | 150,112,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,004 | 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 feladat6.zh;
import java.util.Scanner;
/**
*
* @author Pig
*/
public class Test {
public static void main(String[] args) {
int a;
Scanner beker=new Scanner(System.in);
a=Integer.parseInt(beker.nextLine());
h= new Hallgato[a];
for(int i=0;i<a;i++){
String sor=beker.nextLine();
String st[]=sor.split(" ");
h[i]= new Hallgato(Integer.parseInt(st[0]),Boolean.parseBoolean(st[1]));
}
for(Hallgato x: h){
if(x.dolgozatotIr().megfelelt()&&x.dolgozatotIr().megfelelt())
System.out.println("megfelelt");
else System.out.println("nem felelt meg");
}
}
private static feladat6.zh.Hallgato h[];
}
| [
"noreply@github.com"
] | locziagoston.noreply@github.com |
736ee83e9ce18695774966127054cbaa394cbf28 | 79c3a48f64a407a2fb722b61f4c4b7d862902aaa | /Traffic/src/TrafficLight.java | 6630e0eb7323debdcd049e12172324f7c70d75c4 | [] | no_license | Shinchirou/ppj | 77fe6b3743597d694d1ed03ace91b0d2f8232f76 | 4f9a062ee489a9a0e4ecce999276d5527a12504a | refs/heads/master | 2020-08-06T13:41:59.512704 | 2019-10-12T10:15:23 | 2019-10-12T10:15:23 | 212,995,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,818 | java | public class TrafficLight {
private String state;
private String lightType;
public TrafficLight(String state) {
this.state = state;
}
public TrafficLight(String state, String lightType){
this.state = state;
this.lightType = lightType;
}
public String toString(){
return "State: " + state + "\nLight type: " + lightType;
}
public void green() {
if (state.equals("green")) {
System.out.println("The light is already green.");
} else if (state.equals("red")) {
System.out.println("The light has " + state + " color " +
"but must be yellow before it can become green.");
} else {
state = "green";
System.out.println("The light is now green.");
}
}
public void yellow() {
if (state.equals("green") || state.equals("red")) {
state = "yellow";
System.out.println("The light is now yellow.");
} else {
System.out.println("The light is already yellow");
}
}
public void red() {
if (state.equals("red")) {
System.out.println("The light is already red.");
} else if (state.equals("green")) {
System.out.println("The light has " + state + " color " +
"but must be yellow before it can become red.");
} else {
state = "green";
System.out.println("The light is now red.");
}
}
public String getLightType() {
return lightType;
}
public void setLightType(String lightType) {
this.lightType = lightType;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}
| [
"b.ostaszewski@gmail.com"
] | b.ostaszewski@gmail.com |
425f8be502d93309c21ce1fed06b9821b2984eec | 28bf283d7bacd4b71b7743cf965ebf53ece7985a | /src/java/Controller/Signup.java | 65c3072ed24af7571c50f9534a0f89f92b0440e2 | [] | no_license | GS1211/quikr-clone | 7a70029bdbe43ceef44507acc6e5df1a93cfcf25 | d8a71bc7e5796ddc102cc3e10a68ecc2cace58f6 | refs/heads/master | 2020-04-09T05:39:59.780226 | 2018-12-02T18:31:04 | 2018-12-02T18:31:04 | 160,074,086 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,144 | 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 Controller;
import Modal.SignUpDAO;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author Gaurav
*/
public class Signup extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
String userfname=request.getParameter("userfname");
String userlname=request.getParameter("userlname");
String password=request.getParameter("password");
String address=request.getParameter("address");
String useremail=request.getParameter("useremail");
System.out.println(userfname+userlname);
boolean f;
SignUpDAO obj = new SignUpDAO();
f = obj.SignUp(userfname,userlname, password, address, useremail);
System.out.println(f);
response.sendRedirect("index.html");
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"noreply@github.com"
] | GS1211.noreply@github.com |
56466f62a1f07da6fbca5dd06a37448d7a226027 | f03388866db1c1cf21209440db5522878cd27641 | /src/main/java/org/lesson3/B.java | 1ccb6d33f813a5776e2c5fd1b17ac172da7cbe0a | [] | no_license | Anderwerty/study-2020 | 5edc86a1fb7dc52c7645b11a7ecc6f64063fa3cf | 53575d4fa7cb5a9bb2a2c926c368c2f60af0023a | refs/heads/master | 2022-07-02T07:23:00.696090 | 2020-02-07T09:07:09 | 2020-02-07T09:07:09 | 233,916,288 | 0 | 1 | null | 2020-10-13T18:51:13 | 2020-01-14T19:13:12 | Java | UTF-8 | Java | false | false | 191 | java | package org.lesson3;
public class B {
public static void main(String[] args) {
validate();
}
private static void validate() {
throw null;
}
}
| [
"anderwerty@gmail.com"
] | anderwerty@gmail.com |
cbf724ea90a4c9fe71790aedf7189c9bb3b9c5b1 | 9816182b851afa565bd695a4dd291e2b8126cb97 | /src/blackjack/CardDeck.java | 1b668666005a197c09ea200eb8aac569a17196c7 | [] | no_license | kghyung/edu1 | 4f3d7256795032b27a9082d9547c1172b70d15eb | 0e4f6e2a1d7d5131b20f353083e6808039e38327 | refs/heads/master | 2023-08-19T22:59:06.903710 | 2021-10-21T02:05:54 | 2021-10-21T02:05:54 | 411,598,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,156 | java | package blackjack;
import ch06.Car;
import java.util.ArrayList;
import java.util.List;
public class CardDeck { //기본 생성자 메소드, 생성자 다른점 2가지 (클래스명과 이름이 같다.)(return 타입이 없다.)
private List<Card> cards;
public CardDeck(){
init();
}
private void init(){
String[] patterns = new String[]{ "스페이드", "하트", "클럽", "다이아몬드" };
cards = new ArrayList();
for(int i =0; i< patterns.length; i++){ //4번 돈다.
for(int z=1; z<=13; z++){ //13번 돈다.
String denomination = null;
switch (z){
case 1:
denomination = "A"; break;
case 11:
denomination = "J"; break;
case 12:
denomination = "Q"; break;
case 13:
denomination = "K"; break;
default:
denomination = String.valueOf(z); //2~10은 정수를 문자열로 변경
// denomination = z + "";
Card c = new Card(patterns[i], denomination);
//둘중에 하나라도 가능
cards.add(c);
//cards.add(patterns[i], denomination);
}
}
}
}
//항상 호출하면 랜덤한 카드를 준다.
public Card getCard(){
//if 컬렉션을 배열로 했다면 먼저 섞고, 순차적으로 카드를 주었을 것이다.
//if 컬렉션을 ArrayList로 했다면 랜덤하게 카드를 준다.
int rIdx = (int)(Math.random() * cards.size());
return cards.remove(rIdx);
// return cards.remove((int)(Math.random() * cards.size()));
}
public void showAllCards(){
/*
for(int i=0; i<cards.size(); i++){
Card c = cards.get(i);
System.out.println(c);
}
*/
for(Card c : cards){
System.out.println(c);
}
}
}
| [
"kgh7216@gmail.com"
] | kgh7216@gmail.com |
63997fa714f4b854b86f6a131baf5808977b0a2d | db51c8678ad22eecf55d88598028a086a5c64983 | /src/main/java/com/infinity/bumblebee/util/BumbleMatrixMarshaller.java | f0c3a350b6bb90a3a82859848b5a21843f38d698 | [
"Apache-2.0"
] | permissive | jeffrichley/bumblebee | 601247eac5b1235700c1a1e33fb43cd97efdd95f | e07fd46aac7241ac70e69873037a676b9402a863 | refs/heads/master | 2020-05-17T00:03:47.459248 | 2015-04-24T23:52:37 | 2015-04-24T23:52:37 | 22,951,332 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,428 | java | package com.infinity.bumblebee.util;
import java.io.IOException;
import java.io.Writer;
import com.infinity.bumblebee.data.BumbleMatrix;
import com.infinity.bumblebee.exceptions.BumbleException;
import com.infinity.bumblebee.network.NeuralNet;
public class BumbleMatrixMarshaller {
public void marshal(NeuralNet network, Writer out) {
try {
StringBuilder header = new StringBuilder();
for (BumbleMatrix theta : network.getThetas()) {
header.append(theta.getRowDimension()).append(" ").append(theta.getColumnDimension()).append(" ");
}
header.append("\n");
out.write(header.toString());
for (BumbleMatrix theta : network.getThetas()) {
// we need to put this in the loop to help save on memory with big matrices
StringBuilder buff = new StringBuilder();
for (int row = 0; row < theta.getRowDimension(); row++) {
double[] rowValues = theta.getRow(row);
for (double value : rowValues) {
buff.append(Double.toString(value)).append(" ");
}
buff.append("\n");
}
out.write(buff.toString());
}
} catch (IOException e) {
throw new BumbleException("Unable to write the network to the Writer", e);
} finally {
try {
// we don't want people playing with the stream so flush and close it
out.flush();
out.close();
} catch (IOException e) {
throw new BumbleException("Unable to flush and close the Writer", e);
}
}
}
}
| [
"jeffrichley@gmail.com"
] | jeffrichley@gmail.com |
9ea540f15e555f84b30cab0d5fb9c5a5ab2a3627 | 4742ea0b8baead0affe8d7abb3ac30f03e60bacc | /QuadraticEquationsLoop.java | 83aaca6430adc65bfcf9f556eb89d07929c36bd7 | [] | no_license | ivanovaaa9/Java | 376bcb7e2ec3b2cb00273a4fd969448fffd52e60 | 0a12d49aee2c38c34cc8f8817dc32f639f5fc02c | refs/heads/main | 2023-09-02T04:03:30.804402 | 2021-11-15T16:09:04 | 2021-11-15T16:09:04 | 337,671,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,216 | 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 bg.unwe;
import java.util.Scanner;
/**
*
* @author user
*/
public class QuadraticEquationsLoop {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int limit;
double d = 0;
double x1 = 0;
double x2 = 0;
Scanner s = new Scanner(System.in);
System.out.print("Limit: ");
limit = s.nextInt();
for (int a = 1; a <= limit; a++) {
for (int b = 1; b <= limit; b++) {
for (int c = 1; c <= limit; c++) {
System.out.printf("a = %d, b = %d, c = %d\n",
a, b, c);
d = b * b - 4 * a * c;
if (d == 0) {
x1 = - b - Math.sqrt(b * b - 4 * a * c);
x1 /= 2 * a;
System.out.println("x1 = " + x1);
}else if (d > 0) {
x1 = -b - Math.sqrt(b * b - 4 * a * c);
x1 /= 2 * a;
x2 = -b + Math.sqrt(b * b - 4 * a * c);
x2 /=2 * a;
System.out.println("x1 = " + x1);
System.out.println("x2 = " + x2);
} else {
System.out.println("No solution");
}
}
}
}
}
}
| [
"noreply@github.com"
] | ivanovaaa9.noreply@github.com |
c86d420f5c8c8af52d7d184ed4b4c033a2b1c73a | cd96a317e7caaaf6125dd83ecc33b7a669c2f87c | /javamelody-core/src/main/java/net/bull/javamelody/CollectorController.java | 4c998893a36c975385464795495f78e541df3ed8 | [
"Apache-2.0"
] | permissive | sreev/javamelody | ab0f28c4343d4ff537c1126409a551bf74a9c9f6 | 5cffdbe95bcea2f09fd41690663a6d32fcbb059b | refs/heads/master | 2020-12-25T22:30:28.045727 | 2015-12-02T21:08:13 | 2015-12-02T21:08:13 | 47,281,003 | 0 | 1 | null | 2015-12-02T18:44:36 | 2015-12-02T18:44:36 | null | UTF-8 | Java | false | false | 24,729 | java | /*
* Copyright 2008-2014 by Emeric Vernat
*
* This file is part of Java Melody.
*
* 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.bull.javamelody; // NOPMD
import static net.bull.javamelody.HttpParameters.ACTION_PARAMETER;
import static net.bull.javamelody.HttpParameters.APPLICATIONS_PART;
import static net.bull.javamelody.HttpParameters.CACHE_ID_PARAMETER;
import static net.bull.javamelody.HttpParameters.CONNECTIONS_PART;
import static net.bull.javamelody.HttpParameters.COUNTER_PARAMETER;
import static net.bull.javamelody.HttpParameters.COUNTER_SUMMARY_PER_CLASS_PART;
import static net.bull.javamelody.HttpParameters.CURRENT_REQUESTS_PART;
import static net.bull.javamelody.HttpParameters.DATABASE_PART;
import static net.bull.javamelody.HttpParameters.EXPLAIN_PLAN_PART;
import static net.bull.javamelody.HttpParameters.FORMAT_PARAMETER;
import static net.bull.javamelody.HttpParameters.GRAPH_PARAMETER;
import static net.bull.javamelody.HttpParameters.HEAP_HISTO_PART;
import static net.bull.javamelody.HttpParameters.HOTSPOTS_PART;
import static net.bull.javamelody.HttpParameters.HTML_BODY_FORMAT;
import static net.bull.javamelody.HttpParameters.HTML_CONTENT_TYPE;
import static net.bull.javamelody.HttpParameters.JMX_VALUE;
import static net.bull.javamelody.HttpParameters.JNDI_PART;
import static net.bull.javamelody.HttpParameters.JOB_ID_PARAMETER;
import static net.bull.javamelody.HttpParameters.JROBINS_PART;
import static net.bull.javamelody.HttpParameters.JVM_PART;
import static net.bull.javamelody.HttpParameters.MBEANS_PART;
import static net.bull.javamelody.HttpParameters.OTHER_JROBINS_PART;
import static net.bull.javamelody.HttpParameters.PART_PARAMETER;
import static net.bull.javamelody.HttpParameters.PATH_PARAMETER;
import static net.bull.javamelody.HttpParameters.POM_XML_PART;
import static net.bull.javamelody.HttpParameters.PROCESSES_PART;
import static net.bull.javamelody.HttpParameters.REQUEST_PARAMETER;
import static net.bull.javamelody.HttpParameters.SESSIONS_PART;
import static net.bull.javamelody.HttpParameters.SESSION_ID_PARAMETER;
import static net.bull.javamelody.HttpParameters.THREADS_PART;
import static net.bull.javamelody.HttpParameters.THREAD_ID_PARAMETER;
import static net.bull.javamelody.HttpParameters.WEB_XML_PART;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Serializable;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.bull.javamelody.SamplingProfiler.SampledMethod;
import org.apache.log4j.Logger;
/**
* Contrôleur au sens MVC de l'ihm de monitoring dans le serveur collecte.
* @author Emeric Vernat
*/
class CollectorController { // NOPMD
private static final Logger LOGGER = Logger.getLogger("javamelody");
private static final String COOKIE_NAME = "javamelody.application";
private final HttpCookieManager httpCookieManager = new HttpCookieManager();
private final CollectorServer collectorServer;
CollectorController(CollectorServer collectorServer) {
super();
assert collectorServer != null;
this.collectorServer = collectorServer;
}
void addCollectorApplication(String appName, String appUrls) throws IOException {
final File file = Parameters.getCollectorApplicationsFile();
if (file.exists() && !file.canWrite()) {
throw new IllegalStateException(
"applications should be added or removed in the applications.properties file, because the user is not allowed to write: "
+ file);
}
final List<URL> urls = Parameters.parseUrl(appUrls);
collectorServer.addCollectorApplication(appName, urls);
}
void doMonitoring(HttpServletRequest req, HttpServletResponse resp, String application)
throws IOException {
try {
final String actionParameter = req.getParameter(ACTION_PARAMETER);
if (actionParameter != null) {
final String messageForReport;
if ("remove_application".equalsIgnoreCase(actionParameter)) {
collectorServer.removeCollectorApplication(application);
LOGGER.info("monitored application removed: " + application);
messageForReport = I18N.getFormattedString("application_enlevee", application);
showAlertAndRedirectTo(resp, messageForReport, "?");
return;
}
final Collector collector = getCollectorByApplication(application);
final MonitoringController monitoringController = new MonitoringController(
collector, collectorServer);
final Action action = Action.valueOfIgnoreCase(actionParameter);
if (action != Action.CLEAR_COUNTER && action != Action.MAIL_TEST
&& action != Action.PURGE_OBSOLETE_FILES) {
// on forwarde l'action (gc, invalidate session(s) ou heap dump) sur l'application monitorée
// et on récupère les informations à jour (notamment mémoire et nb de sessions)
messageForReport = forwardActionAndUpdateData(req, application);
} else {
// nécessaire si action clear_counter
messageForReport = monitoringController.executeActionIfNeeded(req);
}
if (TransportFormat.isATransportFormat(req.getParameter(FORMAT_PARAMETER))) {
final SerializableController serializableController = new SerializableController(
collector);
final Range range = serializableController.getRangeForSerializable(req);
final List<Object> serializable = new ArrayList<Object>();
final List<JavaInformations> javaInformationsList = getJavaInformationsByApplication(application);
serializable.addAll((List<?>) serializableController.createDefaultSerializable(
javaInformationsList, range, messageForReport));
monitoringController.doCompressedSerializable(req, resp,
(Serializable) serializable);
} else {
writeMessage(req, resp, application, messageForReport);
}
return;
}
doReport(req, resp, application);
} catch (final RuntimeException e) {
// catch RuntimeException pour éviter warning exception
writeMessage(req, resp, application, e.getMessage());
} catch (final Exception e) {
writeMessage(req, resp, application, e.getMessage());
}
}
private void doReport(HttpServletRequest req, HttpServletResponse resp, String application)
throws IOException, ServletException {
final Collector collector = getCollectorByApplication(application);
final MonitoringController monitoringController = new MonitoringController(collector,
collectorServer);
final String partParameter = req.getParameter(PART_PARAMETER);
final String formatParameter = req.getParameter(FORMAT_PARAMETER);
if (req.getParameter(JMX_VALUE) != null) {
doJmxValue(req, resp, application, req.getParameter(JMX_VALUE));
} else if (TransportFormat.isATransportFormat(formatParameter)) {
doCompressedSerializable(req, resp, application, monitoringController);
} else if (partParameter == null || "pdf".equalsIgnoreCase(formatParameter)) {
// la récupération de javaInformationsList doit être après forwardActionAndUpdateData
// pour être à jour
final List<JavaInformations> javaInformationsList = getJavaInformationsByApplication(application);
monitoringController.doReport(req, resp, javaInformationsList);
} else {
doCompressedPart(req, resp, application, monitoringController, partParameter);
}
}
private void doCompressedPart(HttpServletRequest httpRequest, HttpServletResponse httpResponse,
String application, MonitoringController monitoringController, String partParameter)
throws IOException, ServletException {
if (MonitoringController.isCompressionSupported(httpRequest)) {
// comme la page html peut être volumineuse
// on compresse le flux de réponse en gzip à partir de 4 Ko
// (à moins que la compression http ne soit pas supportée
// comme par ex s'il y a un proxy squid qui ne supporte que http 1.0)
final CompressionServletResponseWrapper wrappedResponse = new CompressionServletResponseWrapper(
httpResponse, 4096);
try {
doPart(httpRequest, wrappedResponse, application, monitoringController,
partParameter);
} finally {
wrappedResponse.finishResponse();
}
} else {
doPart(httpRequest, httpResponse, application, monitoringController, partParameter);
}
}
private void doPart(HttpServletRequest req, HttpServletResponse resp, String application,
MonitoringController monitoringController, String partParameter) throws IOException,
ServletException {
if (WEB_XML_PART.equalsIgnoreCase(partParameter)) {
noCache(resp);
doProxy(req, resp, application, WEB_XML_PART);
} else if (POM_XML_PART.equalsIgnoreCase(partParameter)) {
noCache(resp);
doProxy(req, resp, application, POM_XML_PART);
} else if (CONNECTIONS_PART.equalsIgnoreCase(partParameter)) {
doMultiHtmlProxy(req, resp, application, CONNECTIONS_PART, "Connexions_jdbc_ouvertes",
"connexions_intro", "db.png");
} else {
final List<JavaInformations> javaInformationsList = getJavaInformationsByApplication(application);
monitoringController.doReport(req, resp, javaInformationsList);
}
}
private void doJmxValue(HttpServletRequest req, HttpServletResponse resp, String application,
String jmxValueParameter) throws IOException {
noCache(resp);
resp.setContentType("text/plain");
boolean first = true;
for (final URL url : getUrlsByApplication(application)) {
if (first) {
first = false;
} else {
resp.getOutputStream().write('|');
resp.getOutputStream().write('|');
}
final URL proxyUrl = new URL(url.toString()
.replace(TransportFormat.SERIALIZED.getCode(), "")
.replace(TransportFormat.XML.getCode(), "")
+ '&' + JMX_VALUE + '=' + jmxValueParameter);
new LabradorRetriever(proxyUrl).copyTo(req, resp);
}
resp.getOutputStream().close();
}
private void doProxy(HttpServletRequest req, HttpServletResponse resp, String application,
String partParameter) throws IOException {
// récupération à la demande du contenu du web.xml de la webapp monitorée
// (et non celui du serveur de collecte),
// on prend la 1ère url puisque le contenu de web.xml est censé être le même
// dans tout l'éventuel cluster
final URL url = getUrlsByApplication(application).get(0);
// on récupère le contenu du web.xml sur la webapp et on transfert ce contenu
final URL proxyUrl = new URL(url.toString() + '&' + PART_PARAMETER + '=' + partParameter);
new LabradorRetriever(proxyUrl).copyTo(req, resp);
}
private void doMultiHtmlProxy(HttpServletRequest req, HttpServletResponse resp,
String application, String partParameter, String titleKey, String introductionKey,
String iconName) throws IOException {
final PrintWriter writer = createWriterFromOutputStream(resp);
final HtmlReport htmlReport = createHtmlReport(req, resp, writer, application);
htmlReport.writeHtmlHeader();
writer.write("<div class='noPrint'>");
I18N.writelnTo(
"<a href='javascript:history.back()'><img src='?resource=action_back.png' alt='#Retour#'/> #Retour#</a> ",
writer);
writer.write("<a href='?part=");
writer.write(partParameter);
writer.write("'>");
I18N.writelnTo("<img src='?resource=action_refresh.png' alt='#Actualiser#'/> #Actualiser#",
writer);
writer.write("</a></div>");
if (introductionKey != null) {
writer.write("<br/>");
writer.write(I18N.getString(introductionKey));
}
final String title = I18N.getString(titleKey);
for (final URL url : getUrlsByApplication(application)) {
final String htmlTitle = "<h3 class='chapterTitle'><img src='?resource=" + iconName
+ "' alt='" + title + "'/> " + title + " (" + getHostAndPort(url)
+ ")</h3>";
writer.write(htmlTitle);
writer.flush(); // flush du buffer de writer, sinon le copyTo passera avant dans l'outputStream
final URL proxyUrl = new URL(url.toString()
.replace(TransportFormat.SERIALIZED.getCode(), HTML_BODY_FORMAT)
.replace(TransportFormat.XML.getCode(), HTML_BODY_FORMAT)
+ '&' + PART_PARAMETER + '=' + partParameter);
new LabradorRetriever(proxyUrl).copyTo(req, resp);
}
htmlReport.writeHtmlFooter();
writer.close();
}
private void doCompressedSerializable(HttpServletRequest httpRequest,
HttpServletResponse httpResponse, String application,
MonitoringController monitoringController) throws IOException {
Serializable serializable;
try {
serializable = createSerializable(httpRequest, application);
} catch (final Exception e) {
serializable = e;
}
monitoringController.doCompressedSerializable(httpRequest, httpResponse, serializable);
}
private Serializable createSerializable(HttpServletRequest httpRequest, String application)
throws Exception { // NOPMD
final Serializable resultForSystemActions = createSerializableForSystemActions(httpRequest,
application);
if (resultForSystemActions != null) {
return resultForSystemActions;
}
final Collector collector = getCollectorByApplication(application);
final SerializableController serializableController = new SerializableController(collector);
final Range range = serializableController.getRangeForSerializable(httpRequest);
final String part = httpRequest.getParameter(PART_PARAMETER);
if (THREADS_PART.equalsIgnoreCase(part)) {
return new ArrayList<List<ThreadInformations>>(
collectorServer.getThreadInformationsLists(application));
} else if (CURRENT_REQUESTS_PART.equalsIgnoreCase(part)) {
return new LinkedHashMap<JavaInformations, List<CounterRequestContext>>(
collectorServer.collectCurrentRequests(application));
} else if (EXPLAIN_PLAN_PART.equalsIgnoreCase(part)) {
final String sqlRequest = httpRequest.getHeader(REQUEST_PARAMETER);
return collectorServer.collectSqlRequestExplainPlan(application, sqlRequest);
} else if (COUNTER_SUMMARY_PER_CLASS_PART.equalsIgnoreCase(part)) {
final String counterName = httpRequest.getParameter(COUNTER_PARAMETER);
final String requestId = httpRequest.getParameter(GRAPH_PARAMETER);
final Counter counter = collector.getRangeCounter(range, counterName);
final List<CounterRequest> requestList = new CounterRequestAggregation(counter)
.getRequestsAggregatedOrFilteredByClassName(requestId);
return new ArrayList<CounterRequest>(requestList);
} else if (APPLICATIONS_PART.equalsIgnoreCase(part)) {
// list all applications, with last exceptions if not available,
// use ?part=applications&format=json for example
final Map<String, Throwable> applications = new HashMap<String, Throwable>();
for (final String app : Parameters.getCollectorUrlsByApplications().keySet()) {
applications.put(app, null);
}
applications.putAll(collectorServer.getLastCollectExceptionsByApplication());
return new HashMap<String, Throwable>(applications);
} else if (JROBINS_PART.equalsIgnoreCase(part) || OTHER_JROBINS_PART.equalsIgnoreCase(part)) {
// pour UI Swing
return serializableController.createSerializable(httpRequest, null, null);
}
final List<JavaInformations> javaInformationsList = getJavaInformationsByApplication(application);
return serializableController.createDefaultSerializable(javaInformationsList, range, null);
}
// CHECKSTYLE:OFF
private Serializable createSerializableForSystemActions(HttpServletRequest httpRequest, // NOPMD
String application) throws IOException {
// CHECKSTYLE:ON
final String part = httpRequest.getParameter(PART_PARAMETER);
if (JVM_PART.equalsIgnoreCase(part)) {
final List<JavaInformations> javaInformationsList = getJavaInformationsByApplication(application);
return new ArrayList<JavaInformations>(javaInformationsList);
} else if (HEAP_HISTO_PART.equalsIgnoreCase(part)) {
// par sécurité
Action.checkSystemActionsEnabled();
return collectorServer.collectHeapHistogram(application);
} else if (SESSIONS_PART.equalsIgnoreCase(part)) {
// par sécurité
Action.checkSystemActionsEnabled();
final String sessionId = httpRequest.getParameter(SESSION_ID_PARAMETER);
final List<SessionInformations> sessionInformations = collectorServer
.collectSessionInformations(application, sessionId);
if (sessionId != null && !sessionInformations.isEmpty()) {
return sessionInformations.get(0);
}
return new ArrayList<SessionInformations>(sessionInformations);
} else if (HOTSPOTS_PART.equalsIgnoreCase(part)) {
// par sécurité
Action.checkSystemActionsEnabled();
return new ArrayList<SampledMethod>(collectorServer.collectHotspots(application));
} else if (PROCESSES_PART.equalsIgnoreCase(part)) {
// par sécurité
Action.checkSystemActionsEnabled();
return new LinkedHashMap<String, List<ProcessInformations>>(
collectorServer.collectProcessInformations(application));
} else if (JNDI_PART.equalsIgnoreCase(part)) {
// par sécurité
Action.checkSystemActionsEnabled();
final String path = httpRequest.getParameter(PATH_PARAMETER);
return new ArrayList<JndiBinding>(
collectorServer.collectJndiBindings(application, path));
} else if (MBEANS_PART.equalsIgnoreCase(part)) {
// par sécurité
Action.checkSystemActionsEnabled();
return new LinkedHashMap<String, List<MBeanNode>>(
collectorServer.collectMBeans(application));
} else if (DATABASE_PART.equalsIgnoreCase(part)) {
// par sécurité
Action.checkSystemActionsEnabled();
final int requestIndex = DatabaseInformations.parseRequestIndex(httpRequest
.getParameter(REQUEST_PARAMETER));
return collectorServer.collectDatabaseInformations(application, requestIndex);
} else if (CONNECTIONS_PART.equalsIgnoreCase(part)) {
// par sécurité
Action.checkSystemActionsEnabled();
return new ArrayList<List<ConnectionInformations>>(
collectorServer.collectConnectionInformations(application));
}
return null;
}
private HtmlReport createHtmlReport(HttpServletRequest req, HttpServletResponse resp,
PrintWriter writer, String application) {
final Range range = httpCookieManager.getRange(req, resp);
final Collector collector = getCollectorByApplication(application);
final List<JavaInformations> javaInformationsList = getJavaInformationsByApplication(application);
return new HtmlReport(collector, collectorServer, javaInformationsList, range, writer);
}
private static String getHostAndPort(URL url) {
return RemoteCollector.getHostAndPort(url);
}
void writeMessage(HttpServletRequest req, HttpServletResponse resp, String application,
String message) throws IOException {
noCache(resp);
final Collector collector = getCollectorByApplication(application);
final List<JavaInformations> javaInformationsList = getJavaInformationsByApplication(application);
if (application == null || collector == null || javaInformationsList == null) {
showAlertAndRedirectTo(resp, message, "?");
} else {
final PrintWriter writer = createWriterFromOutputStream(resp);
final String partParameter = req.getParameter(PART_PARAMETER);
// la période n'a pas d'importance pour writeMessageIfNotNull
new HtmlReport(collector, collectorServer, javaInformationsList, Period.TOUT, writer)
.writeMessageIfNotNull(message, partParameter);
writer.close();
}
}
private static PrintWriter createWriterFromOutputStream(HttpServletResponse httpResponse)
throws IOException {
noCache(httpResponse);
httpResponse.setContentType(HTML_CONTENT_TYPE);
return new PrintWriter(MonitoringController.getWriter(httpResponse));
}
static void writeOnlyAddApplication(HttpServletResponse resp) throws IOException {
noCache(resp);
resp.setContentType(HTML_CONTENT_TYPE);
final PrintWriter writer = createWriterFromOutputStream(resp);
writer.write("<html lang='" + I18N.getCurrentLocale().getLanguage()
+ "'><head><title>Monitoring</title></head><body>");
HtmlReport.writeAddAndRemoveApplicationLinks(null, writer);
writer.write("</body></html>");
writer.close();
}
static void showAlertAndRedirectTo(HttpServletResponse resp, String message, String redirectTo)
throws IOException {
resp.setContentType(HTML_CONTENT_TYPE);
final PrintWriter writer = createWriterFromOutputStream(resp);
writer.write("<script type='text/javascript'>alert('");
writer.write(I18N.javascriptEncode(message));
writer.write("');location.href='");
writer.write(redirectTo);
writer.write("';</script>");
writer.close();
}
private static void noCache(HttpServletResponse httpResponse) {
MonitoringController.noCache(httpResponse);
}
private String forwardActionAndUpdateData(HttpServletRequest req, String application)
throws IOException {
final String actionParameter = req.getParameter(ACTION_PARAMETER);
final String sessionIdParameter = req.getParameter(SESSION_ID_PARAMETER);
final String threadIdParameter = req.getParameter(THREAD_ID_PARAMETER);
final String jobIdParameter = req.getParameter(JOB_ID_PARAMETER);
final String cacheIdParameter = req.getParameter(CACHE_ID_PARAMETER);
final List<URL> urls = getUrlsByApplication(application);
final List<URL> actionUrls = new ArrayList<URL>(urls.size());
for (final URL url : urls) {
final StringBuilder actionUrl = new StringBuilder(url.toString());
actionUrl.append("&action=").append(actionParameter);
if (sessionIdParameter != null) {
actionUrl.append("&sessionId=").append(sessionIdParameter);
}
if (threadIdParameter != null) {
actionUrl.append("&threadId=").append(threadIdParameter);
}
if (jobIdParameter != null) {
actionUrl.append("&jobId=").append(jobIdParameter);
}
if (cacheIdParameter != null) {
actionUrl.append("&cacheId=").append(cacheIdParameter);
}
actionUrls.add(new URL(actionUrl.toString()));
}
return collectorServer.collectForApplicationForAction(application, actionUrls);
}
String getApplication(HttpServletRequest req, HttpServletResponse resp) {
// on utilise un cookie client pour stocker l'application
// car la page html est faite pour une seule application sans passer son nom en paramètre des requêtes
// et pour ne pas perdre l'application choisie entre les reconnexions
String application = req.getParameter("application");
if (application == null) {
// pas de paramètre application dans la requête, on cherche le cookie
final Cookie cookie = httpCookieManager.getCookieByName(req, COOKIE_NAME);
if (cookie != null) {
application = cookie.getValue();
if (!collectorServer.isApplicationDataAvailable(application)) {
cookie.setMaxAge(-1);
resp.addCookie(cookie);
application = null;
}
}
if (application == null) {
// pas de cookie, on prend la première application si elle existe
application = collectorServer.getFirstApplication();
}
} else if (collectorServer.isApplicationDataAvailable(application)) {
// un paramètre application est présent dans la requête: l'utilisateur a choisi une application,
// donc on fixe le cookie
httpCookieManager.addCookie(req, resp, COOKIE_NAME, String.valueOf(application));
}
return application;
}
private Collector getCollectorByApplication(String application) {
return collectorServer.getCollectorByApplication(application);
}
private List<JavaInformations> getJavaInformationsByApplication(String application) {
return collectorServer.getJavaInformationsByApplication(application);
}
private static List<URL> getUrlsByApplication(String application) throws IOException {
return CollectorServer.getUrlsByApplication(application);
}
}
| [
"evernat@free.fr"
] | evernat@free.fr |
61de3d8a18de7db2be55986249fbea6487110788 | 5ab16dc90ee97fa7b41c797569831812f48ecc2a | /android/antilost/src/main/java/com/pearl/subwayguider/scan/model/ScanModel.java | 7fe807f96b285ea8e285d7060bf4319d046f5940 | [] | no_license | pearl2015/BLE-Anti-lost-Alarm | b205407f28c48add0ccd31ef1a9c76e55f4cd8af | 4d18671e0af92e1fb5cd91acb1c2496b37519db4 | refs/heads/master | 2020-05-20T06:12:47.135843 | 2016-06-27T07:11:34 | 2016-08-08T13:46:15 | 61,277,729 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package com.pearl.subwayguider.scan.model;
import android.content.Context;
import com.pearl.subwayguider.beans.BleDevice;
import java.util.ArrayList;
/**
* Created by Administrator on 30/05/2016.
*/
public interface ScanModel {
public ArrayList<BleDevice> findBleDevices(boolean enable);
public void init();
public ArrayList<BleDevice> getList();
//method 2
public void addDevice(BleDevice newdevice);
}
| [
"huangpan2015@outlook.com"
] | huangpan2015@outlook.com |
8025e332963f78e360f1bf855877189069fc4aac | 49c4c659875741c40411b2f26ac8e63c900d52f3 | /6. Java - zaawansowana programowanie/3. File repository/src/main/java/pl/sdacademy/repository/CarRepository.java | 0a0ef68aef9ccde77dc24bdd65a7ebb9e839da3f | [] | no_license | WojtekTomekCzubak/zdjavapol94 | 95a3c2fe65fdafb52a2e1661c90c97711a143e89 | 057dbe2f58e5319eaede404297450cc868b95f21 | refs/heads/master | 2023-07-12T20:58:29.391307 | 2021-08-30T13:35:31 | 2021-08-30T13:35:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,044 | java | package pl.sdacademy.repository;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
public class CarRepository {
private Set<Car> cars;
private Path filePath;
public CarRepository(String filename) {
filePath = Paths.get(filename);
try {
cars = Files.lines(filePath)
.map(this::createCar)
.collect(Collectors.toSet());
} catch (IOException e) {
throw new RuntimeException("Błąd odczytu danych z pliku", e);
}
}
public Set<Car> getAll() {
return cars;
}
private Car createCar(String fileLine) {
String[] lineParts = fileLine.split(",");
int id = Integer.parseInt(lineParts[0]);
int maxSpeed = Integer.parseInt(lineParts[1]);
String model = lineParts[2];
String color = lineParts[3];
return new Car(id, maxSpeed, model, color);
}
public Car get(int id) {
return cars.stream()
.filter(car -> car.getId() == id)
.findFirst()
.orElse(null);
}
private int generateNextId() {
return cars.stream()
.mapToInt(Car::getId)
.max()
.orElse(0) + 1;
}
private String createFileLine(Car car) {
return car.getId() + "," + car.getMaxSpeed()
+ "," + car.getModel() + "," + car.getColor();
}
private void updateFile() {
List<String> fileLines = cars.stream()
.map(this::createFileLine)
.collect(Collectors.toList());
try {
Files.write(filePath, fileLines);
} catch (IOException e) {
throw new RuntimeException("Błąd zapisu danych do pliku", e);
}
}
public void add(Car car) {
car.setId(generateNextId());
cars.add(car);
updateFile();
}
}
| [
"dz@gm.com"
] | dz@gm.com |
840a685ca7289ce4f5feaf2f5e3faca499561ea1 | 7b45b56cdcffb68e12d810f1b66726fbb1e383b3 | /ideamosRestService/src/main/java/com/ideamos/services/CurrencyFormatterService.java | 456f2798126266b719c306c4de59ef147ed5d9bf | [] | no_license | karenlll/JavaRestService | af30529688f78f857731d3af19f3845d4750e794 | 670ae5ef0c0df68c427da517d7a78101cc2cc3a0 | refs/heads/master | 2020-11-25T11:03:53.789678 | 2019-12-17T19:14:59 | 2019-12-17T19:14:59 | 228,630,929 | 0 | 0 | null | 2020-10-13T18:16:50 | 2019-12-17T14:11:40 | Java | UTF-8 | Java | false | false | 1,818 | java | package main.java.com.ideamos.services;
import java.text.NumberFormat;
import java.util.Locale;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import org.apache.commons.lang.StringEscapeUtils;
@Path("/currencyFormat")
public class CurrencyFormatterService {
public CurrencyFormatterService() {
super();
// TODO Auto-generated constructor stub
}
@POST
public Response currencyFormatter(@FormParam("value") double value) {
try {
String response="";
if(value>= 0 && value <= Math.pow(10, 9))
{
NumberFormat formatter = NumberFormat.getInstance();
response += "US: " + formatter.getCurrencyInstance(Locale.US).format(value)+ System.getProperty("line.separator");
response += "India: " + formatter.getCurrencyInstance(Locale.US).format(value).replace("$", "Rs.") +System.lineSeparator() ;
response += "China: " + formatter.getCurrencyInstance(Locale.CHINA).format(value)+System.lineSeparator();
response += "France: " + formatter.getCurrencyInstance(Locale.FRANCE).format(value)+System.lineSeparator();
}else
{
response = "Valor no valido";
}
response = StringEscapeUtils.escapeHtml(response);
return Response.status(200).entity(response).build();
}catch (NullPointerException e)
{
return Response.status(200).entity("Required Param is null").build();
} catch (NumberFormatException e)
{
return Response.status(200).entity("Number Format Exception").build();
}
catch(Exception e)
{
return Response.status(200).entity("Exception doesn't expected").build();
}
}
}
| [
"karen.lara@correo.icesi.edu.co"
] | karen.lara@correo.icesi.edu.co |
c600de2c16bdfc9ac7b4085c51054dfecb1155f0 | 6f256f734f08e8b3f7eb54bf876062ce52ed4c31 | /test/org/marcestarlet/cartravelcalculator/api/TravelControllerTest.java | 48af3360e331e30fcf0bc8ac054f259c30cb2cee | [] | no_license | MarceStarlet/car-travel-calculator | 69f7a49939f9404ea92bcffa17bb49045fbd78d3 | 4111def86ed366160c878dc507536a8834798768 | refs/heads/master | 2020-04-18T20:43:36.747956 | 2019-01-30T04:14:59 | 2019-01-30T04:14:59 | 167,745,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,460 | java | package org.marcestarlet.cartravelcalculator.api;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.*;
import static org.junit.Assert.*;
public class TravelControllerTest {
private static final int THREAD_POOL_SIZE = 100;
@Test
public void requestTravel() {
TravelController travelCtrl = new TravelController(Arrays.asList("P","Q","S"));
assertEquals("S",travelCtrl.requestTravel("A"));
}
@Test
public void requestTravelMulti_threading_ExecutorSubmit_DiffCtrl(){
ExecutorService execSrv = Executors.newFixedThreadPool(THREAD_POOL_SIZE);
TravelController travelCtrlA = new TravelController(Arrays.asList("P","Q","S"));
TravelController travelCtrlE = new TravelController(Arrays.asList("A10","A9","A7"));
TravelController travelCtrlF = new TravelController(Arrays.asList("A9","A10","A12"));
for (int i = 0; i < THREAD_POOL_SIZE; i++) {
execSrv.execute(() -> {
String threadName = "Thread = [" + Thread.currentThread().getName() + "]";
String resultA = travelCtrlA.requestTravel("A");
String resultE = travelCtrlE.requestTravel("E");
String resultF = travelCtrlF.requestTravel("F");
assertEquals("S", resultA);
assertEquals("A7", resultE);
assertEquals("A10", resultF);
System.out.println(threadName + " A -> " + resultA);
System.out.println(threadName + " E -> " + resultE);
System.out.println(threadName + " F -> " + resultF);
});
}
try {
execSrv.shutdown();
execSrv.awaitTermination(30, TimeUnit.SECONDS);
}catch (InterruptedException e){
System.out.println("task interrupted");
} finally {
if (!execSrv.isTerminated()){
System.out.println("cancel non-finished task");
}
execSrv.shutdownNow();
System.out.println("task finished");
}
}
@Test
public void requestTravelMulti_threading_ExecutorCallable_SameCtrl(){
ExecutorService execSrv = Executors.newFixedThreadPool(THREAD_POOL_SIZE);
TravelController travelCtrl = new TravelController(Arrays.asList("P","Q","S"));
List<Callable<String>> callableTravelSrv = Arrays.asList(
() -> {
System.out.println("Thread = [" + Thread.currentThread().getName() + "] A -> ");
String result = travelCtrl.requestTravel("A");
assertEquals("S", result);
return result;
},
() -> {
System.out.println("Thread = [" + Thread.currentThread().getName() + "] E -> ");
String result = travelCtrl.requestTravel("E");
assertNotEquals("A7", result);
return result;
},
() -> {
System.out.println("Thread = [" + Thread.currentThread().getName() + "] F -> ");
String result = travelCtrl.requestTravel("F");
assertNotEquals("A10", result);
return result;
}
);
for (int i = 0; i < THREAD_POOL_SIZE; i++) {
try {
execSrv.invokeAll(callableTravelSrv)
.stream()
.map(future -> {
try {
return future.get();
} catch (Exception e) {
throw new IllegalStateException(e);
}
})
.forEach(System.out::println);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
try {
execSrv.shutdown();
execSrv.awaitTermination(5, TimeUnit.SECONDS);
}catch (InterruptedException e){
System.out.println("task interrupted");
} finally {
if (!execSrv.isTerminated()){
System.out.println("cancel non-finished task");
}
execSrv.shutdownNow();
System.out.println("task finished");
}
}
} | [
"marcestarlet@techwomen.org.mx"
] | marcestarlet@techwomen.org.mx |
fa84c3fc6af2a6ca0b4d67e6b8ec9f30c162fa9c | 51e0689ea951d2dc968d51c7fb683feba9d9b80b | /src/minecraft_server/net/minecraft/src/EntityEgg.java | b315865e37209945de97d13280819aa639b89f31 | [] | no_license | btw-mods-corp/Locktyte | ca922179f11d91b47153bb64cc55ef54485a0503 | 932603c653afb343d861955b9b6e225a5d7216bb | refs/heads/master | 2016-09-10T22:53:20.997107 | 2012-09-30T00:31:07 | 2012-09-30T00:31:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,909 | java | package net.minecraft.src;
public class EntityEgg extends EntityThrowable
{
public EntityEgg(World par1World)
{
super(par1World);
}
public EntityEgg(World par1World, EntityLiving par2EntityLiving)
{
super(par1World, par2EntityLiving);
}
public EntityEgg(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
if (par1MovingObjectPosition.entityHit != null)
{
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.thrower), 0);
}
if (!this.worldObj.isRemote && this.rand.nextInt(8) == 0)
{
byte var2 = 1;
if (this.rand.nextInt(32) == 0)
{
var2 = 4;
}
for (int var3 = 0; var3 < var2; ++var3)
{
EntityChicken var4 = new EntityChicken(this.worldObj);
var4.setGrowingAge(-24000);
var4.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
this.worldObj.spawnEntityInWorld(var4);
}
}
else if (!this.worldObj.isRemote)
{
FCUtilsItem.EjectSingleItemWithRandomVelocity(this.worldObj, (float)this.posX, (float)this.posY, (float)this.posZ, mod_FCBetterThanWolves.fcItemRawEgg.shiftedIndex, 0);
}
for (int var5 = 0; var5 < 8; ++var5)
{
this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
if (!this.worldObj.isRemote)
{
this.setDead();
}
}
}
| [
"susan69@private"
] | susan69@private |
0d8c840781f2a9d877263ffdfc218a883f7d735d | f675e8f75f7696a590a9a5ade900e705dd723f39 | /class code/Intent1/app/src/main/java/com/example/zinia/intent1/Page2.java | 1794850eff8f022eed2147eac4a3e9eeccad1b6f | [] | no_license | syedanusrat007/android-lab-3-2 | de1c00fe9795a26289bef61b2053f39c616c258a | 4759007caa3f2db57198c5e164253cfd59fc4723 | refs/heads/master | 2023-04-19T05:40:49.687326 | 2021-05-10T06:27:55 | 2021-05-10T06:27:55 | 365,939,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 610 | java | package com.example.zinia.intent1;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
public class Page2 extends AppCompatActivity {
TextView tx2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_page2);
tx2 = (TextView) findViewById(R.id.textView2);
Intent j = getIntent();
String val = j.getStringExtra("nameID2");
tx2.setText(val);
}
}
| [
"syedanusrat007@gmail.com"
] | syedanusrat007@gmail.com |
def5fee02999621bf4d71e9af1c26da5b0da2564 | 750598b7d9c9c53ef359802825de48f3c5e03128 | /src/helloworld/program.java | f4ce6c4009f25ccb0405a66ab8675473ab9af8ce | [] | no_license | theshrestha/hello-world | d5883a40673cdee510b2b7c97b8a41b160123776 | 03230ede7b3dd9d1fa04acbb8987fad5e34236ab | refs/heads/master | 2020-07-05T18:08:08.177856 | 2016-09-03T19:03:39 | 2016-09-03T19:03:39 | 67,293,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | package helloworld;
public class program {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Hello World");
}
}
| [
"theshrestha@gmail.com"
] | theshrestha@gmail.com |
2bff88df108f43aba2b90e100162a242c16c98f9 | 70bd72606e561af4656f5f18e5393b6444fdabd1 | /src/kitchen/cuisine2.java | 4eee25ef777920cfa7f6f3f6087aea3a9779048c | [] | no_license | Poukilou/cours1 | 2e52bd1d19c177dac171e35f3132f8adb42eb191 | 56cc76f3364beca55f4c407b92ae6d0af24967bb | refs/heads/master | 2020-03-24T17:52:18.484267 | 2018-07-30T13:14:48 | 2018-07-30T13:14:48 | 142,874,663 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,516 | java | package kitchen;
public class cuisine2 {
//methode avec un booléen , contexte: cuisson de blé et haricots verts pour une durée de 30 mn.
public static boolean bouffe (String ble, String haricotsVerts, int time) {
if ( (time>=30)&&(ble.equals("blé")) // on utilise .equals a la place de = dans une condition (if est une condition )
&& (haricotsVerts.equals("haricots verts"))) {
return true;
}
//ici, on a indiqué que si (par la classe if ) le temps de cuisson (variable time ) est égal ou supérieur a 30, les variables ble (blé) et haricotsVerts ( haricots verts ) renverront un "true"
else { return false;
}
// dans le cas contraire (variable time inférieur à 30 ), nous aurront un false
}
public static void main(String[] args) {
boolean miam; //création d'un type boolean avec une variable miam pour récupérer le résultat de bouffe
miam = bouffe("blé","haricots verts",30); //on indique que miam est égala la méthode bouffe dont les valeurs des argument est indiquée dans les parenthèses afin de récupérer le résultat renvoyé par la méthode
if (miam==true) {
System.out.println("aux armes, la bouffe est prete!"); // si miam est true ( avec une valeur au moins égale a 30 ), le systeme affichera "aux armes...".
}
else {
System.out.println("t'as faim, t'attends !"); // sinon (en false donc ) on aura le message "t'as faim ... " .
}
}
}
| [
"hamid.boudjerda@gmail.com"
] | hamid.boudjerda@gmail.com |
944dca6506736aadf29dbf0b395b035e94471b27 | 08a8f38f15fdbf0479997f3af3b727b558809e4f | /src/org/guiceside/support/properties/PropertiesConfigException.java | 6bbdb01b14857183ecd66b4ad75c2823c04bfc86 | [] | no_license | light-work/guiceSide | 0832afee5ed1ba0826970ef8ae3843780b533322 | 4e46211c49212169ade8b55332860c4a92b3a045 | refs/heads/master | 2021-01-18T23:23:45.652709 | 2016-05-16T06:58:38 | 2016-05-16T06:58:38 | 25,399,459 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 675 | java | package org.guiceside.support.properties;
/**
* @author zhenjia <a href='mailto:zhenjiaWang@gmail.com'>email</a>
* @since JDK1.5
* @version 1.0 2008-9-11
*
**/
public class PropertiesConfigException extends RuntimeException{
/**
*
*/
private static final long serialVersionUID = 1L;
public PropertiesConfigException() {
/* empty */
}
public PropertiesConfigException(String message) {
super(message);
}
public PropertiesConfigException(String message, Throwable rootCause) {
super(message, rootCause);
}
public PropertiesConfigException(Throwable rootCause) {
super(rootCause);
}
public Throwable getRootCause() {
return getCause();
}
}
| [
"zhenjiaWang@gmail.com"
] | zhenjiaWang@gmail.com |
47ba1d48ff023fd5fa8eedc5abe09b67aefb4039 | f3a26445469c0f1f6f32df51e4f787cdef7f316d | /src/com/telran/Test.java | 8463db25c8b1a76f61a9865b8adde1ddeb62d369 | [] | no_license | TonyYoga/Java-IO | 810b6982f32de23e05cb5f74a2a792624074ecdd | 20605e4dc0b5719e4e5d5e428afe6013506248a7 | refs/heads/master | 2020-04-26T23:52:39.227142 | 2019-03-05T09:33:52 | 2019-03-05T09:33:52 | 173,734,401 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,183 | java | package com.telran;
import com.telran.controllers.UserController;
import com.telran.controllers.UserControllerImpl;
import com.telran.data.entity.CategoryEntity;
import com.telran.data.entity.CityEntity;
import com.telran.data.entity.Role;
import com.telran.data.entity.UserEntity;
import com.telran.data.managers.CatalogManager;
import com.telran.data.managers.UserManager;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test {
public static void main(String[] args) throws IOException {
//FromClassWork
/*
UserController userController = new UserControllerImpl(
new UserManager("db","users.csv","profiles.csv"));
CatalogManager manager =
new CatalogManager("db","cat.csv","cities.csv");
manager.addCity(CityEntity.of("Ashdod"));
manager.addCity(CityEntity.of("Haifa"));
*/
// UserController userController = new UserControllerImpl(new UserManager("db", "users.csv", "profile.csv"));
CatalogManager manager = new CatalogManager("db", "cat.csv", "cities.csv");
// manager.addCity(CityEntity.of("Ashdod"));
// manager.addCity(CityEntity.of("Haifa"));
// manager.addCity(CityEntity.of("Tel Aviv"));
// manager.addCity(CityEntity.of("Ramla"));
// manager.removeCity("d61a8b08-62cd-4065-bd2d-bec17539bf97");
// manager.updateCity("5bab86b5-dacf-4931-a5ab-ca4dbf6030e5", "Toronto");
// manager.addCategory(CategoryEntity.of("Tools1"));
// manager.addCategory(CategoryEntity.of("Toyes2"));
// manager.addCategory(CategoryEntity.of("Goods3"));
// manager.addCategory(CategoryEntity.of("Drinks4"));
// manager.removeCategory("46f6b209-fb26-40bb-9cf6-14733dfb00ae");
// manager.updateCategory("a279469a-c429-488b-bade-d637b0f900ad", "Shoes");
// manager.getAllCities().forEach(System.out::println);
UserManager userManager = new UserManager("db", "users.csv", "profiles.csv");
// userManager.addUser(UserEntity.of("admin@shop.com", "000000", Role.ADMIN, userManager.addBlankProfile()));
// userManager.addUser(UserEntity.of("userFirst@shop.com", "111111", Role.USER, userManager.addBlankProfile()));
// userManager.addUser(UserEntity.of("userSecond@shop.com", "222222", Role.USER, userManager.addBlankProfile()));
// userManager.addUser(UserEntity.of("user3@shop.com", "333333", Role.USER, userManager.addBlankProfile()));
UserControllerImpl userController = new UserControllerImpl(userManager);
// userController.changePassword("admin@shop.com", "000000", "newpassword");
// userController.changePasswordForUser("admin@shop.com", "userFirst@shop.com", "new");
// userController.removeUser("admin@shop.com", "userSecond@shop.com");
// userManager.getAllUsers().forEach(System.out::println);
// userManager.up
// ProfileEntity profile = ProfileEntity.of("name", "lastName", "911");
// userManager.getAllProfiles().forEach(System.out::println);
userController.getAllUsers("admin@shop.com").forEach(System.out::println);
}
}
| [
"konkin.anton@gmail.com"
] | konkin.anton@gmail.com |
ef6bea97c1c9a4f18938c2f15e3c4bf5aec3c66b | 1c17d8626bb77a51010bdcc19dd9307ebc5cbaa5 | /spring-swagger/src/main/java/org/javamaster/spring/swagger/anno/ApiEnum.java | b3397f7e2bb0793cf2969a6c9434fdcee4deea31 | [
"Apache-2.0"
] | permissive | jufeng98/java-master | 299257f04fba29110fe72d124c63595b8c955af9 | a1fc18a6af52762ae90f78e0181073f2a95d454a | refs/heads/master | 2023-07-24T01:42:27.140862 | 2023-07-09T03:01:07 | 2023-07-09T03:01:07 | 191,107,543 | 123 | 65 | Apache-2.0 | 2022-12-16T04:38:20 | 2019-06-10T06:10:04 | JavaScript | UTF-8 | Java | false | false | 504 | java | package org.javamaster.spring.swagger.anno;
import org.javamaster.spring.swagger.enums.EnumBase;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author yudong
* @date 2022/1/4
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ApiEnum {
Class<? extends Enum<? extends EnumBase>> value();
}
| [
"liangyudong@bluemoon.com.cn"
] | liangyudong@bluemoon.com.cn |
4bc5b2ef0683a63f58690e167f8620b55ec74c78 | b1ff8f15d6e5a8927e55dc4807a7495f83157e33 | /genData.java | 9479c7faeec292f6aabdd2dc265ccf12a661894c | [] | no_license | NBKelly/QuickLinks | 8e9f33ad9b11a073985c0d55fc5efd2c1e9e7a4b | 4091a9af08c500059db40c600961ab9069a0f88d | refs/heads/master | 2021-03-10T13:47:11.032801 | 2020-03-15T07:44:39 | 2020-03-15T07:44:39 | 246,458,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | import java.util.*;
public class genData {
public static void main(String[] args) {
int num_nodes = 100000;
int num_scenarios = 100000;
Random rand = new Random();
System.out.printf("%d %d%n", num_nodes, num_scenarios);
for(int i = 0; i < num_nodes; i++) {
System.out.println(rand.nextInt(num_nodes));
}
for(int i = 0; i < num_scenarios; i++) {
System.out.printf("%d %d%n", rand.nextInt(num_nodes) , rand.nextInt(num_nodes));
}
}
}
| [
"nbk4@students.waikato.ac.nz"
] | nbk4@students.waikato.ac.nz |
8b5be89fa146a71b7f0115b33969fb29560bd90b | 329307375d5308bed2311c178b5c245233ac6ff1 | /src/com/tencent/mm/d/a/gr$a.java | 0841425ad8c9e5cf0eda4193dc2574c511058382 | [] | no_license | ZoneMo/com.tencent.mm | 6529ac4c31b14efa84c2877824fa3a1f72185c20 | dc4f28aadc4afc27be8b099e08a7a06cee1960fe | refs/heads/master | 2021-01-18T12:12:12.843406 | 2015-07-05T03:21:46 | 2015-07-05T03:21:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 239 | java | package com.tencent.mm.d.a;
import com.tencent.mm.protocal.b.ahe;
public final class gr$a
{
public ahe azL;
}
/* Location:
* Qualified Name: com.tencent.mm.d.a.gr.a
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
920807d65d63e2a95538ce59e52de4eb8a8bdb03 | ede1113a07d776ff32bd34aaf9661f8b7b0be65a | /src/gr/uoa/di/monitoring/server/servlets/DataCollectionServlet.java | a531ca025a4ac165040a75054d9c9beeee433edd | [] | no_license | Utumno/DataCollectionServlet | 40577f957ae4bed301581ea68f96b9c7479f185f | d39309b83579bb935fcdff3cdcba4b5f0d0c1e22 | refs/heads/master | 2020-06-04T13:44:19.945675 | 2014-06-16T12:30:37 | 2014-07-05T18:54:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,943 | java | package gr.uoa.di.monitoring.server.servlets;
import gr.uoa.di.java.helpers.Zip;
import gr.uoa.di.java.helpers.Zip.CompressException;
import gr.uoa.di.monitoring.android.files.Parser;
import gr.uoa.di.monitoring.android.files.ParserException;
import gr.uoa.di.monitoring.model.Data;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Paths;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
@SuppressWarnings("serial")
@WebServlet("/")
@MultipartConfig
public final class DataCollectionServlet extends Controller {
private static final String UPLOAD_LOCATION_PROPERTY_KEY = "upload.location";
private volatile String uploadsDirName;
@Override
public void init() throws ServletException {
super.init();
if (uploadsDirName == null) {
uploadsDirName = property(UPLOAD_LOCATION_PROPERTY_KEY);
final File uploadsDir = new File(uploadsDirName);
log.info("Uploads dir " + uploadsDir.getAbsolutePath());
if (!uploadsDir.isDirectory() && !uploadsDir.mkdirs()) {
throw new ServletException("Unable to create "
+ uploadsDir.getAbsolutePath() + " data upload directory");
}
}
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
Map<String, Map<Class<? extends Data>, List<Data>>> master_map = new HashMap<>();
for (File node : new File(uploadsDirName).listFiles()) {
if (node.isDirectory()) {
// directories contain the (continually updated) files for each
// device
try {
final String dirname = node.getName(); // device id
master_map.put(dirname,
Parser.parse(node.getAbsolutePath()));
} catch (ParserException e) {
log.warn("Failed to parse " + node.getAbsolutePath(), e);
}
}
}
req.setAttribute("master_map", master_map);
sc.getRequestDispatcher(DATA_COLLECTION_JSP).forward(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException {
Collection<Part> parts;
try {
parts = req.getParts();
} catch (IllegalStateException | IOException e) {
log.error("Can't get file parts from " + req, e);
return;
}
/*
* FIXME : java.io.IOException:
* org.apache.tomcat.util.http.fileupload.FileUploadException: Read
* timed out at
* org.apache.catalina.connector.Request.parseParts(Request.java:2786)
* at org.apache.catalina.connector.Request.getParts(Request.java:2640)
* at
* org.apache.catalina.connector.RequestFacade.getParts(RequestFacade.
* java:1076) at
* gr.uoa.di.monitoring.server.servlets.DataCollectionServlet
* .doPost(DataCollectionServlet.java:64) at
* javax.servlet.http.HttpServlet.service(HttpServlet.java:641) ...
* Caused by:
* org.apache.tomcat.util.http.fileupload.FileUploadException: Read
* timed out at
* org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest
* (FileUploadBase.java:338) at
* org.apache.tomcat.util.http.fileupload.servlet
* .ServletFileUpload.parseRequest(ServletFileUpload.java:129) at
* org.apache.catalina.connector.Request.parseParts(Request.java:2722)
* ... 21 more Caused by: java.net.SocketTimeoutException: Read timed
* out at java.net.SocketInputStream.socketRead0(Native Method)...
*/
for (Part part : parts) {
// save the zip into uploads dir
final String filename = getFilename(part);
File uploadedFile = new File(uploadsDirName, filename + "_"
+ System.currentTimeMillis() + ".zip");
final String imei = Parser.getDeviceID(filename);
final String absolutePath = uploadedFile.getAbsolutePath();
log.debug("absolutePath :" + absolutePath);
try {
part.write(absolutePath);
} catch (IOException e) {
log.error("Can't write file " + absolutePath + " from part "
+ part, e);
return;
}
// unzip the zip
final String unzipDirPath = workDir.getAbsolutePath()
+ File.separator + uploadedFile.getName();
log.debug("unzipDirPath :" + unzipDirPath);
try {
Zip.unZipFolder(uploadedFile, unzipDirPath);
} catch (CompressException e) {
log.error("Can't unzip file " + absolutePath, e);
}
// merge the files
final File imeiDirInUploadedFiles = new File(uploadsDirName, imei);
if (!imeiDirInUploadedFiles.isDirectory()
&& !imeiDirInUploadedFiles.mkdirs()) {
log.error("Can't create "
+ imeiDirInUploadedFiles.getAbsolutePath());
return;
}
final File unzipedFolder = new File(unzipDirPath, imei); // get this
// from FileStore
for (File file : unzipedFolder.listFiles()) {
final File destination = new File(imeiDirInUploadedFiles,
file.getName());
try {
IOCopier.joinFiles(destination, new File[] { file });
} catch (IOException e) {
log.error("Failed to append " + file.getAbsolutePath()
+ " to " + destination.getAbsolutePath());
return;
}
}
try {
removeRecursive(Paths.get(unzipDirPath));
} catch (IOException e) {
String msg = "Failed to delete folder " + unzipDirPath;
if (e instanceof java.nio.file.DirectoryNotEmptyException) {
msg += ". Still contains : ";
final File[] listFiles = Paths.get(unzipDirPath).toFile()
.listFiles();
if (listFiles != null) for (File file : listFiles) {
msg += file.getAbsolutePath() + "\n";
}
}
log.error(msg, e);
}
// FIXME : http://stackoverflow.com/questions/19935624/
// java-nio-file-files-deletepath-path-will-always-throw-on-failure
}
}
private static final class IOCopier {
public static void joinFiles(File destination, File[] sources)
throws IOException {
OutputStream output = null;
try {
output = createAppendableStream(destination);
for (File source : sources) {
appendFile(output, source);
}
} finally {
IOUtils.closeQuietly(output);
}
}
private static BufferedOutputStream createAppendableStream(
File destination) throws FileNotFoundException {
return new BufferedOutputStream(new FileOutputStream(destination,
true));
}
private static void appendFile(OutputStream output, File source)
throws IOException {
InputStream input = null;
try {
input = new BufferedInputStream(new FileInputStream(source));
IOUtils.copy(input, output);
} finally {
IOUtils.closeQuietly(input);
}
}
}
private static final class IOUtils {
private static final int BUFFER_SIZE = 1024 * 4;
public static long copy(InputStream input, OutputStream output)
throws IOException {
byte[] buffer = new byte[BUFFER_SIZE];
long count = 0;
int n = 0;
while (-1 != (n = input.read(buffer))) {
output.write(buffer, 0, n);
count += n;
}
return count;
}
public static void closeQuietly(Closeable output) {
try {
if (output != null) {
output.close();
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}
// helpers
private static String getFilename(Part part) {
// courtesy of BalusC : http://stackoverflow.com/a/2424824/281545
for (String cd : part.getHeader("content-disposition").split(";")) {
if (cd.trim().startsWith("filename")) {
String filename = cd.substring(cd.indexOf('=') + 1).trim()
.replace("\"", "");
return filename.substring(filename.lastIndexOf('/') + 1)
.substring(filename.lastIndexOf('\\') + 1); // MSIE fix.
}
}
return null;
}
}
| [
"the.ubik@gmail.com"
] | the.ubik@gmail.com |
7e0994ae0263a3def4a89fef65966f4975bafed8 | 0ba34d61e79ce7323a9b2b56a45947f10ee46c3d | /fakeFlow/src/main/java/ly/message/Message.java | e8d6a9111cfcee62163f28afca63dd6684b260a8 | [] | no_license | littlelittlewater/ad | 41b72856391798e89e53a90cd24f4f956bf17427 | 66108415db1eca8c9a1d98f2f9d9476b647e8b1c | refs/heads/master | 2022-03-12T04:32:57.298069 | 2022-03-02T03:01:59 | 2022-03-02T03:01:59 | 175,562,273 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,192 | java | package ly.message;
import ly.domain.Mission;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.UUID;
/**
* 服务器发布messionID 让客户端处理
*/
public abstract class Message {
static Logger logger = LoggerFactory.getLogger(Message.class);
public Long missionID;
public Long number;
public String uuid;
public Date createTime;
public Long getMissionID() {
return missionID;
}
public void setMissionID(Long missionID) {
this.missionID = missionID;
}
public Long getNumber() {
return number;
}
public void setNumber(Long number) {
this.number = number;
}
public Message() {
uuid = "" + new Date().getTime() + UUID.randomUUID();
createTime = new Date();
}
public abstract void cacl(Mission selected);
public Message(Message message) {
this.missionID = message.missionID;
this.number = message.number;
uuid = message.uuid;
createTime = message.createTime;
}
@Override
public String toString() {
return "Message{" +
"missionID=" + missionID +
", number=" + number +
'}';
}
public abstract String getName();
} | [
"1835630110@qq.com"
] | 1835630110@qq.com |
6d789196ae3330e006620c1a3e3bc3263d205bd9 | a224044cf798497a81e7ef8f6f3a0a90318c7697 | /src/main/java/org/registrator/community/service/MailService.java | f98c2b6fbcba924e43711550caf29ff070919579 | [] | no_license | anpavlo/ukrresources | d7e5177bd7b6554e68bbfa81211572486a3b8c1e | a91239d76e4cee975383c3228097c45b203ae009 | refs/heads/master | 2021-01-10T13:52:08.320314 | 2016-03-03T22:07:29 | 2016-03-03T22:07:29 | 53,087,017 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 190 | java | package org.registrator.community.service;
public interface MailService {
public void sendRecoveryPasswordMail(String recepientEmail, String recepientName,String token ,String url);
}
| [
"anpavlo@ukr.net"
] | anpavlo@ukr.net |
2d337313dcb211b2e855e77e3ced17a666028654 | 6335b35cd567ac5d0614cfbb0a268344044b4b49 | /src/main/java/com/hackathon/aspect/LogAspect.java | cdfaa8de4521709b63c022af03ebfd253040fa01 | [] | no_license | liqian90/test1 | af64003757b4b8e51922d4cf9b1ef09393106197 | 1dcfbcd5584ffd63f5db80eb4af5a81f1c2dbc08 | refs/heads/master | 2021-03-24T09:53:45.027822 | 2017-12-01T06:18:25 | 2017-12-01T06:18:25 | 106,407,577 | 0 | 1 | null | 2017-12-01T06:18:25 | 2017-10-10T11:21:14 | CSS | UTF-8 | Java | false | false | 1,019 | java | package com.hackathon.aspect;
//this code is test for git
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* Created by nowcoder on 2016/6/26.
*/
@Aspect
@Component
public class LogAspect {
private static final Logger logger = LoggerFactory.getLogger(LogAspect.class);
@Before("execution(* com.nowcoder.controller.*Controller.*(..))")
public void beforeMethod(JoinPoint joinPoint) {
StringBuilder sb = new StringBuilder();
for (Object arg : joinPoint.getArgs()) {
sb.append("arg:" + arg.toString() + "|");
}
logger.info("before method: " + sb.toString());
}
@After("execution(* com.hackathon.controller.IndexController.*(..))")
public void afterMethod(JoinPoint joinPoint) {
logger.info("after method: ");
}
}
| [
"xulq90@qq.com"
] | xulq90@qq.com |
127f40c29de13318ab1128d80aef24179d87e411 | ca729b4f7670a3556f04e366c25f219622f47337 | /src/main/java/com/longwen/headfirst/observer/CurrentConditionsDisplay.java | 7d9b1ea4bb10b2176ffa69e7a1e81d84c689e546 | [] | no_license | longwen8/design-pattern | 6393360954e6367ff97b99a58d040018763dd7fa | 2580b35ab137d1c8a67e3e993ede2cf090faaa7d | refs/heads/master | 2020-09-11T22:35:04.091353 | 2019-12-26T13:02:46 | 2019-12-26T13:02:46 | 222,212,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 718 | java | package com.longwen.headfirst.observer;
/**
* Created by huangxinping on 19/11/17.
*/
public class CurrentConditionsDisplay implements Observer, DisplayElement {
private float temperature;
private float humidity;
private Subject weatherData;
public CurrentConditionsDisplay(Subject weatherData){
this.weatherData = weatherData;
weatherData.registerObserver(this);
}
public void update(float temp, float humidity, float pressure) {
this.temperature = temp;
this.humidity = humidity;
display();
}
public void display() {
System.out.println("Current conditions : " + temperature + "F degrees and " + humidity + "% humidity");
}
}
| [
"937633571@qq.com"
] | 937633571@qq.com |
46c3ee88ed02e1dd0e4b6e404335801c2066de33 | 90da1c9edf8f74280e0b7777952fd94127526a5a | /Lab3VCS/src/lab3vcs/Lab3VCS.java | b39b2bbfe91e229c397f9c34686a3f708c20bff2 | [] | no_license | roguckie/VCS | 5d7cd6d5b2302ac6542f6d5c6fd626845c4e2a97 | 9f59e43eaba49db7f9b563524015f4e468712813 | refs/heads/master | 2020-12-18T16:02:17.253547 | 2020-01-21T21:55:57 | 2020-01-21T21:55:57 | 235,448,466 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | 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 lab3vcs;
/**
*
* @author galva
*/
public class Lab3VCS {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}
| [
"galva@146.85.212.41"
] | galva@146.85.212.41 |
8e52bce0fe2ff02bfd1bb15c317116a9640202d4 | bcb17cd6c39747a81a9ec1f2a4550e61d6cc7596 | /Tareas/Tarea 5/src/ArbolRN.java | abbf2d6c1170ddeb229da3cb3a9975177e8dc74e | [] | no_license | giturra/Tareas-CC3001 | 49ca56e4d281bcf6afa69b4b94fd34348482d243 | e39da39e39263b9e899bd401fa75530659d1b469 | refs/heads/master | 2021-06-14T12:23:48.665457 | 2017-05-04T01:04:16 | 2017-05-04T01:04:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,349 | java | public class ArbolRN implements ArbolBinario{
static boolean rojo = true;
static boolean negro = false;
public class Nodo {
int info;
boolean color;
Nodo padre, izq, der;
public Nodo(int x){
this.info = x;
color = rojo;
}
}
Nodo raiz;
public ArbolRN(){
raiz = null;
}
public boolean buscar(int x){
return buscar(x, this.raiz);
}
private boolean buscar(int x, Nodo nodo){
if (nodo.info == x){
return true;
}
else if (nodo.info > x){
if (nodo.izq != null){
return buscar(x, nodo.izq);
}
else{
return false;
}
}
else if (nodo.info < x){
if (nodo.der != null){
return buscar(x, nodo.der);
}
else{
return false;
}
}
else{
return false;
}
}
private Nodo rotacionIzq(Nodo padre){
Nodo hijo = padre.der;
padre.der = hijo.izq;
if (hijo.izq != null){
hijo.izq.padre = padre;
}
if (hijo != null){
hijo.padre = padre.padre;
}
if (padre.padre == null){
raiz = hijo;
}
else if (padre == padre.padre.izq){
padre.padre.izq = hijo;
}
else if (padre == padre.padre.der){
padre.padre.der = hijo;
}
hijo.izq = padre;
if (padre != null){
padre.padre = hijo;
}
return hijo;
}
private Nodo rotacionDer(Nodo padre){
Nodo hijo = padre.izq;
padre.izq = hijo.der;
if (hijo.der != null){
hijo.der.padre = padre;
}
if (hijo != null){
hijo.padre = padre.padre;
}
if (padre.padre == null){
raiz = hijo;
}
else if (padre == padre.padre.der){
padre.padre.der = hijo;
}
else if (padre == padre.padre.izq){
padre.padre.izq = hijo;
}
hijo.der = padre;
if (padre != null){
padre.padre = hijo;
}
return hijo;
}
public void insertar(int x){
Nodo nodo = new Nodo(x);
if (raiz == null){
raiz = nodo;
raiz.color = negro;
return;
}
Nodo padre = null;
Nodo hijo = raiz;
while (hijo != null){
padre = hijo;
if (nodo.info < hijo.info){
hijo = hijo.izq;
}
else{
hijo = hijo.der;
}
}
nodo.padre = padre;
if (padre == null){
raiz = nodo;
}
else if (nodo.info < padre.info){
padre.izq = nodo;
}
else{
padre.der = nodo;
}
//nodo.izq = null;
//nodo.der = null;
nodo.color = rojo;
recuperarCondiciones(nodo);
}
private void recuperarCondiciones(Nodo nodo){
while (nodo != raiz && nodo.padre.color == rojo){
if (nodo.padre == nodo.padre.padre.izq){
Nodo tio = nodo.padre.padre.der;
if (tio != null && tio.color == rojo){
nodo.padre.color = negro;
tio.color = negro;
nodo.padre.padre.color = rojo;
nodo = nodo.padre.padre;
}
else {
if (nodo == nodo.padre.der){
nodo = nodo.padre;
rotacionIzq(nodo);
}
nodo.padre.color = negro;
nodo.padre.padre.color = rojo;
rotacionDer(nodo.padre.padre);
}
}
else{
Nodo tio = nodo.padre.padre.izq;
if (tio != null && tio.color == rojo){
nodo.padre.color = negro;
tio.color = negro;
nodo.padre.padre.color = rojo;
nodo = nodo.padre.padre;
}
else{
if (nodo == nodo.padre.izq){
nodo = nodo.padre;
rotacionDer(nodo);
}
nodo.padre.color = negro;
nodo.padre.padre.color = rojo;
rotacionIzq(nodo.padre.padre);
}
}
raiz.color = negro;
}
}
public static int altura(Nodo raiz){
if(raiz == null) return 0;
return 1 + Math.max(altura(raiz.izq), altura(raiz.der));
}
}
| [
"gabrieliturrab@ug.uchile.cl"
] | gabrieliturrab@ug.uchile.cl |
f7caa6c9612f61d4ce1d3414e0e1fa7ff9a9b615 | acfad38412390f5c58d47d1100fb90b11197c5f9 | /spring-websocket-integration/src/main/java/com/devglan/service/UserService.java | 630f8fd37813fabf5edc78e93dc8dc368ca01608 | [] | no_license | shahjadealam/WebHook-WEbSocket-Example | 3f445267ca25cd6f54d7ba88873a1fccf2a192a6 | c74e624dc9cbc16b2831f548919863c08d0a1de6 | refs/heads/master | 2020-03-27T15:06:32.263358 | 2019-12-04T09:15:58 | 2019-12-04T09:15:58 | 146,698,430 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,364 | java | package com.devglan.service;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.messaging.simp.SimpMessageSendingOperations;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import com.devglan.data.Users;
@Service
@EnableAsync
public class UserService {
private String url = "http://localhost:9090/getAll";
private String url2 = "http://localhost:9090/getAll/101";
private String url3 = "http://localhost:9090/getAll/101";
RestTemplate template = new RestTemplate();
@Autowired
private SimpMessageSendingOperations messagingTemplate;
@Async
public void getData() throws InterruptedException {
Thread.sleep(5000);
System.out.println("getData : - Started");
System.out.println("Currently Executing thread name - " + Thread.currentThread().getName());
List<Users> result = template.getForObject(url, List.class);
messagingTemplate.convertAndSendToUser("user", "/queue/user", result);
//return CompletableFuture.completedFuture(result);
}
// @Async("executor")
public CompletableFuture<Users> addData() {
String requestJson = "{\"id\":100,\"name\":\"Shahjade\",\"contact\":\"88882225\",\"email\":\"moni@gmail.com\",\"work\":\"REST App\",\"city\":\"Indore\"}";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<String>(requestJson, headers);
Users result = template.postForObject(url, entity, Users.class);
return CompletableFuture.completedFuture(result);
}
@Async
public CompletableFuture<Users> getById() {
System.out.println("getById --- Started");
System.out.println("Currently Executing thread name - " + Thread.currentThread().getName());
Users result = template.getForObject(url2, Users.class);
return CompletableFuture.completedFuture(result);
}
public CompletableFuture<Users> delete() {
Users result = template.getForObject(url3, Users.class);
return CompletableFuture.completedFuture(result);
}
}
| [
"shahjade.a@HCL.COM"
] | shahjade.a@HCL.COM |
f8c040aa6ed4b78b688eed4e72dfc289ab79fc38 | 98190029d1de72d493e6a730ff4607a50a858946 | /src/main/java/l2d/game/model/L2Macro.java | ee2c23ea5b718455bb6588915dcaaa704edadcfa | [] | no_license | iBezneR/interlude | e9777e24330b0342c2657eee8ada7914cfd6d1d0 | 764c889874034cf04d8e7b67792d705bee4ef719 | refs/heads/master | 2023-03-02T13:48:24.884131 | 2018-08-29T09:37:41 | 2018-08-29T09:37:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,301 | java | package l2d.game.model;
/**
* This class ...
*
* @version $Revision: 1.3 $ $Date: 2004/10/23 22:12:44 $
*/
public class L2Macro
{
public final static int CMD_TYPE_SKILL = 1;
public final static int CMD_TYPE_ACTION = 3;
public final static int CMD_TYPE_SHORTCUT = 4;
public int id;
public final int icon;
public final String name;
public final String descr;
public final String acronym;
public final L2MacroCmd[] commands;
public static class L2MacroCmd
{
public final int entry;
public final int type;
public final int d1; // skill_id or page for shortcuts
public final int d2; // shortcut
public final String cmd;
public L2MacroCmd(int entry, int type, int d1, int d2, String cmd)
{
this.entry = entry;
this.type = type;
this.d1 = d1;
this.d2 = d2;
this.cmd = cmd;
}
}
/**
*
*/
public L2Macro(int id, int icon, String name, String descr, String acronym, L2MacroCmd[] commands)
{
this.id = id;
this.icon = icon;
this.name = name;
this.descr = descr;
this.acronym = acronym.length() > 4 ? acronym.substring(0, 4) : acronym;
this.commands = commands;
}
@Override
public String toString()
{
return "macro id=" + id + " icon=" + icon + "name=" + name + " descr=" + descr + " acronym=" + acronym + " commands=" + commands;
}
}
| [
"vadim.didenko84@gmail.com"
] | vadim.didenko84@gmail.com |
0a35f7581f989c80beca486232754e7b2a56d616 | 25b324beee9c18dc3cf3428928899b6a9a575c5d | /Lesson 6/first/team815/lesson6_inheritance/Square.java | 263c60478c9574e270b20bf731d36e7794d07324 | [] | no_license | Team815/Programming-Class | 19a1a7d6e17ab5caafc90dde125c4a4d5e611efa | d29066412e70f2c233777b7370dbe33cbcf30e90 | refs/heads/master | 2021-01-23T18:30:46.837763 | 2018-10-08T21:44:58 | 2018-10-08T21:44:58 | 102,796,764 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 291 | java | package first.team815.lesson6_inheritance;
public class Square extends EquilateralShape {
public Square(int sideLength) {
this.color = "Blue";
this.numSides = 4;
this.sideLength = sideLength;
}
@Override
public double getArea() {
return (int) Math.pow(sideLength, 2);
}
}
| [
"ACOBB6@ford.com"
] | ACOBB6@ford.com |
1d59e8db6db38004fc67da1a63822efd6fc29884 | 0e31fdb6d751d1b871bf219eec8b3977ee473f47 | /SeleniumProject/src/day4/LinksEg5.java | fffff7f74b44ad7b0f219239d76ba93e53929efb | [] | no_license | shaath/Naveen_Lakshmi_Kumari | ba65a2ba3d6701b335f09e658727456d90643b67 | b698e053bf7a264e3e0b574c194952eb0247d178 | refs/heads/master | 2020-12-30T13:19:42.313413 | 2017-05-15T13:54:20 | 2017-05-15T13:54:20 | 91,342,890 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,468 | java | package day4;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.server.browserlaunchers.Sleeper;
public class LinksEg5
{
public static void main(String[] args) throws IOException
{
WebDriver driver=new FirefoxDriver();
driver.get("http://primusbank.qedgetech.com/sitemap.html");
driver.manage().window().maximize();
WebElement block=driver.findElement(By.xpath(".//*[@id='Table_011']/tbody/tr[2]/td"));
List<WebElement> links=block.findElements(By.tagName("a"));
System.out.println(links.size());
for (int i = 0; i < links.size(); i++)
{
String ltext=links.get(i).getText();
System.out.println(ltext);
links.get(i).click();
Sleeper.sleepTightInSeconds(3);
System.out.println(driver.getTitle()+"----"+driver.getCurrentUrl());
File src=((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(src, new File("F:\\Lakshmi_Kumari_Suma_Naveen\\SeleniumProject\\src\\screenshots\\"+ltext+".png"));
driver.navigate().back();
block=driver.findElement(By.xpath(".//*[@id='Table_011']/tbody/tr[2]/td"));
links=block.findElements(By.tagName("a"));
}
}
}
| [
"you@example.com"
] | you@example.com |
a877cdfd139ec9b839137a83a9c1539677492d3e | 55a258a2f9038bf5e3c8f3120d93b1e07624f808 | /baekjoon/src/b10845/Main.java | 60dcd2ffc4c5134c10088b0d9a1e97ebcf2cda77 | [] | no_license | shkimm5189/CodeTestPrac | 787faf94edcd1ec7f76fa1f9c8b7932632a324c2 | b0bce482b4e7389238c1b19a2cd885f4b748d3aa | refs/heads/master | 2023-03-15T10:05:02.359315 | 2021-03-14T06:39:25 | 2021-03-14T06:39:25 | 297,629,664 | 0 | 0 | null | 2020-12-06T09:32:14 | 2020-09-22T11:38:05 | JavaScript | UTF-8 | Java | false | false | 3,266 | java | package b10845;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
//push X: 정수 X를 큐에 넣는 연산이다.
//pop: 큐에서 가장 앞에 있는 정수를 빼고, 그 수를 출력한다. 만약 큐에 들어있는 정수가 없는 경우에는 -1을 출력한다.
//size: 큐에 들어있는 정수의 개수를 출력한다.
//empty: 큐가 비어있으면 1, 아니면 0을 출력한다.
//front: 큐의 가장 앞에 있는 정수를 출력한다. 만약 큐에 들어있는 정수가 없는 경우에는 -1을 출력한다.
//back: 큐의 가장 뒤에 있는 정수를 출력한다. 만약 큐에 들어있는 정수가 없는 경우에는 -1을 출력한다.
public class Main {
public static void main(String[] args) throws IOException{
Queue que = new Queue();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw =new BufferedWriter(new OutputStreamWriter(System.out));
int repeat = Integer.parseInt(br.readLine());
while(repeat -- > 0) {
StringTokenizer strToken = new StringTokenizer(br.readLine());
switch(strToken.nextToken()) {
case "push":
que.push(Integer.parseInt(strToken.nextToken()));
break;
case "pop":
bw.write(que.pop()+"\n");
break;
case "size":
bw.write(que.size()+"\n");
break;
case "empty":
bw.write(que.empty()+"\n");
break;
case "front":
bw.write(que.front()+"\n");
break;
case "back":
bw.write(que.back()+"\n");
break;
}
}
bw.flush();
bw.close();
}
}
class Queue{
class Node{
int data;
Node nextNode;
Node(int data){
this.data = data;
nextNode = null;
}
}
private Node front;
private Node back;
private int size = 0;
//push X: 정수 X를 큐에 넣는 연산이다.
public void push(int data) {
Node newNode = new Node(data);
if(back != null) {
back.nextNode = newNode;
}
back = newNode;
if(front == null) {
front = back;
}
this.size++;
}
// pop: 큐에서 가장 앞에 있는 정수를 빼고, 그 수를 출력한다. 만약 큐에 들어있는 정수가 없는 경우에는 -1을 출력한다.
public int pop() {
if(front == null) {
return -1;
} else {
int temp = front.data;
front = front.nextNode;
if(front == null) {
back = null;
}
this.size--;
return temp;
}
}
// size: 큐에 들어있는 정수의 개수를 출력한다.
public int size() {
if(this.size <= 0) {
this.size = 0;
}
return size;
}
// empty: 큐가 비어있으면 1, 아니면 0을 출력한다.
public int empty() {
if(front == null) {
return 1;
}else {
return 0;
}
}
// front: 큐의 가장 앞에 있는 정수를 출력한다. 만약 큐에 들어있는 정수가 없는 경우에는 -1을 출력한다.
public int front() {
if(front == null) {
return -1;
} else {
return front.data;
}
}
// back: 큐의 가장 뒤에 있는 정수를 출력한다. 만약 큐에 들어있는 정수가 없는 경우에는 -1을 출력한다.
public int back() {
if(back == null) {
return -1;
} else {
return back.data;
}
}
}
| [
"shkimm5189@gmail.com"
] | shkimm5189@gmail.com |
7a9cc6ee9ebabd00260ad67b81f50a9e4a5a4d8d | 0c58173da036521c7cb068af1a07bc36bd1d9586 | /src/sprint1/Answer.java | 64cde38540b98bb0a15994f0d937a37e8a444030 | [] | no_license | BugunChoi/test_Sprint1 | dfce14af711e0ccfc5d47d637e29414f72aec2b4 | 5a99147599782eb03866944de20c4d99abeeb4ae | refs/heads/master | 2020-03-29T17:04:09.951338 | 2018-09-24T18:02:41 | 2018-09-24T18:02:41 | 150,142,320 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package sprint1;
import java.time.LocalDateTime;
import java.util.*;
public class Answer extends Post{
private Question question;
public Answer(String text, LocalDateTime date){
super(text, date);
}
public Answer(Question question, String text, LocalDateTime date) {
super(text, date);
this.question = question;
}
public Question getQuestion(){
return question;
}
public String toString(){
return "text: " + text + "date: " + date;
}
}
| [
"skekrhrh@gmail.com"
] | skekrhrh@gmail.com |
ccbe6302721ebda5b5308ad119948097e0b236b0 | d03709d8f07ba1cc24ea29c632dd49363dea11b3 | /4.JavaCollections/src/com/javarush/task/task26/task2613/command/InfoCommand.java | baa836f2ecc158f1ba7fce4e25f92af195d8e1ec | [] | no_license | isokolov/JavaRush | 2fe44324c98b2b3810c6c2bd2646950356c184a9 | 29d752d045f8894c92a2476b0c4cbdcfefaeb7fb | refs/heads/master | 2020-04-11T18:46:44.656505 | 2019-12-05T21:14:50 | 2019-12-05T21:14:50 | 162,009,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,183 | java | package com.javarush.task.task26.task2613.command;
import com.javarush.task.task26.task2613.CashMachine;
import com.javarush.task.task26.task2613.ConsoleHelper;
import com.javarush.task.task26.task2613.CurrencyManipulator;
import com.javarush.task.task26.task2613.CurrencyManipulatorFactory;
import java.util.Collection;
import java.util.ResourceBundle;
class InfoCommand implements Command {
private ResourceBundle res = ResourceBundle.getBundle(CashMachine.RESOURCE_PATH + "info_en");
@Override
public void execute() {
ConsoleHelper.writeMessage(res.getString("before"));
Collection<CurrencyManipulator> currencyManipulators = CurrencyManipulatorFactory.getAllCurrencyManipulators();
if (!currencyManipulators.isEmpty())
for (CurrencyManipulator cM :
currencyManipulators) {
if (!cM.hasMoney())
ConsoleHelper.writeMessage(res.getString("no.money"));
else
ConsoleHelper.writeMessage(cM.getCurrencyCode() + " - " + cM.getTotalAmount());
}
else
ConsoleHelper.writeMessage(res.getString("no.money"));
}
}
| [
"illya.sokolov82@gmail.com"
] | illya.sokolov82@gmail.com |
37958da84b4c920dacc19ce29e49e073f7e805be | a8733fe676564412537846a67ce087d3401a8e33 | /src/main/java/entities/Complaint.java | bac135af5d35ea0862b151b3bcff4d66bb9d8838 | [] | no_license | adriansacuiu/Oferte | ddb8fff99dc07410c7f640d9b1ffa85b00e6b704 | fd632c47b03071228c36a77fa1999b7014f26264 | refs/heads/master | 2020-04-10T13:15:40.875041 | 2018-12-09T14:07:23 | 2018-12-09T14:07:23 | 161,045,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,212 | java | package entities;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.hibernate.annotations.NamedQueries;
import org.hibernate.annotations.NamedQuery;
@Entity
@NamedQueries({
@NamedQuery(name="getAllComplaints", query="FROM Complaint c ORDER BY c.title DESC, c.priority DESC"),
@NamedQuery(name="getComplaintsByTitle", query="FROM Complaint c WHERE c.title = :title"),
@NamedQuery(name="getComplaintsByDescription", query="FROM Complaint c WHERE c.description = :description"),
@NamedQuery(name="getComplaintsByPriority", query="FROM Complaint c WHERE c.priority = :priority"),
@NamedQuery(name="getComplaintsByStatus", query="FROM Complaint c WHERE c.status = :status"),
@NamedQuery(name="getComplaintsByUser", query="SELECT c FROM Complaint c INNER JOIN c.user u WHERE u.username=:username"),
@NamedQuery(name="getComplaintsByAsset", query="FROM Complaint c WHERE c.asset.idAsset = :idAsset")
})
@Table(name = "COMPLAINTS")
public class Complaint implements Serializable {
private static final long serialVersionUID = 1L;
private long idComplaint;
private String title;
private String description;
private String priority;
private String status;
private User user;
private Asset asset;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ID_COMPLAINT")
public long getIdComplaint() {
return idComplaint;
}
public void setIdComplaint(long idComplaint) {
this.idComplaint = idComplaint;
}
@Column(name = "TITLE")
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Column(name = "DESCRIPTION")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Column(name = "PRIORITY")
public String getPriority() {
return priority;
}
public void setPriority(String priority) {
this.priority = priority;
}
@Column(name = "STATUS")
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
@ManyToOne
@JoinColumn(name = "ID_USER")
@JsonIgnore
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
@ManyToOne
@JoinColumn(name = "ID_ASSET")
@JsonIgnore
public Asset getAsset() {
return asset;
}
public void setAsset(Asset asset) {
this.asset = asset;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + (int) (idComplaint ^ (idComplaint >>> 32));
result = prime * result + ((priority == null) ? 0 : priority.hashCode());
result = prime * result + ((status == null) ? 0 : status.hashCode());
result = prime * result + ((title == null) ? 0 : title.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;
Complaint other = (Complaint) obj;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (idComplaint != other.idComplaint)
return false;
if (priority == null) {
if (other.priority != null)
return false;
} else if (!priority.equals(other.priority))
return false;
if (status == null) {
if (other.status != null)
return false;
} else if (!status.equals(other.status))
return false;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
return true;
}
@Override
public String toString() {
return "Complaint [idComplaint=" + idComplaint + ", title=" + title + ", description=" + description + ", priority=" + priority + ", status=" + status + "]";
}
}
| [
"adrian.sacuiu@volt.com.ro"
] | adrian.sacuiu@volt.com.ro |
e7425476d6df163608597fe81558ecb5b18c0ba3 | 6fdb23dfd6172dbcb54ffecc58f62b251af4c7af | /rest/src/main/java/ifpb/pdm/api/model/Notificacao.java | 75a1658e900eac7e30e823f6076f0c1c89d90489 | [] | no_license | FlavioHenriique/projeto-pdm-api | dc3d2f822c6773578fcd71cb91a327edd81667e7 | 7f4b44f1cdc4e155de2eef71382a69bd21819f39 | refs/heads/master | 2020-03-20T10:44:51.620029 | 2018-09-20T22:08:56 | 2018-09-20T22:08:56 | 137,382,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 582 | java | package ifpb.pdm.api.model;
public class Notificacao {
private String mensagem;
private int trabalho;
public String getMensagem() {
return mensagem;
}
public void setMensagem(String mensagem) {
this.mensagem = mensagem;
}
public int getTrabalho() {
return trabalho;
}
public void setTrabalho(int trabalho) {
this.trabalho = trabalho;
}
public Notificacao() {
}
public Notificacao(String mensagem, int trabalho) {
this.mensagem = mensagem;
this.trabalho = trabalho;
}
}
| [
"flaviohenrique638@gmail.com"
] | flaviohenrique638@gmail.com |
44b042a2644f77ee64c0f87c0bc4f22e282bb13e | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/24/24_e445d94a0526d6fd01b03f2b6284bb26490e9672/ConfigureRecipes/24_e445d94a0526d6fd01b03f2b6284bb26490e9672_ConfigureRecipes_t.java | bacfa632ae3ef289188dc56cae66bdb4c0669336 | [] | 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 | 3,629 | java | /**
* Copyright (c) Scott Killen and MisterFiber, 2012
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license
* located in /MMPL-1.0.txt
*/
package extrabiomes.config;
import net.minecraft.src.Block;
import net.minecraft.src.FurnaceRecipes;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import extrabiomes.Proxy;
import extrabiomes.api.ExtrabiomesBlock;
import extrabiomes.api.ExtrabiomesItem;
import extrabiomes.blocks.BlockCustomFlower;
import extrabiomes.blocks.BlockRedRock;
public class ConfigureRecipes {
public static void initialize() {
if (ExtrabiomesItem.scarecrow != null)
Proxy.addRecipe(
new ItemStack(ExtrabiomesItem.scarecrow),
new Object[] { " a ", "cbc", " c ",
Character.valueOf('a'), Block.pumpkin,
Character.valueOf('b'), Block.melon,
Character.valueOf('c'), Item.stick });
if (ExtrabiomesBlock.redRock != null) {
Proxy.addShapelessRecipe(new ItemStack(Item.clay, 4),
new Object[] {
new ItemStack(ExtrabiomesBlock.redRock, 1,
BlockRedRock.metaRedCobble),
new ItemStack(Item.bucketWater),
new ItemStack(Item.bucketWater),
new ItemStack(Item.bucketWater) });
Proxy.addRecipe(new ItemStack(ExtrabiomesBlock.redRock, 1,
BlockRedRock.metaRedRockBrick), new Object[] {
"##",
"##",
Character.valueOf('#'),
new ItemStack(ExtrabiomesBlock.redRock, 1,
BlockRedRock.metaRedRock) });
FurnaceRecipes.smelting().addSmelting(
ExtrabiomesBlock.redRock.blockID,
BlockRedRock.metaRedCobble,
new ItemStack(ExtrabiomesBlock.redRock.blockID, 1,
BlockRedRock.metaRedRock));
}
if (ExtrabiomesBlock.crackedSand != null)
Proxy.addShapelessRecipe(
new ItemStack(Block.sand),
new Object[] {
new ItemStack(ExtrabiomesBlock.crackedSand),
new ItemStack(Item.bucketWater) });
if (ExtrabiomesBlock.flower != null) {
Proxy.addShapelessRecipe(new ItemStack(Item.dyePowder, 1,
12), new Object[] { new ItemStack(
ExtrabiomesBlock.flower, 1,
BlockCustomFlower.metaHydrangea) });
Proxy.addShapelessRecipe(new ItemStack(Item.dyePowder, 1,
14), new Object[] { new ItemStack(
ExtrabiomesBlock.flower, 1,
BlockCustomFlower.metaOrange) });
Proxy.addShapelessRecipe(new ItemStack(Item.dyePowder, 1,
13), new Object[] { new ItemStack(
ExtrabiomesBlock.flower, 1,
BlockCustomFlower.metaPurple) });
Proxy.addShapelessRecipe(
new ItemStack(Item.dyePowder, 1, 7),
new Object[] { new ItemStack(
ExtrabiomesBlock.flower, 1,
BlockCustomFlower.metaWhite) });
Proxy.addShapelessRecipe(new ItemStack(Item.bowlSoup),
new Object[] {
Block.mushroomBrown,
new ItemStack(ExtrabiomesBlock.flower, 1,
BlockCustomFlower.metaToadstool),
new ItemStack(ExtrabiomesBlock.flower, 1,
BlockCustomFlower.metaToadstool),
Item.bowlEmpty });
Proxy.addShapelessRecipe(new ItemStack(Item.bowlSoup),
new Object[] {
Block.mushroomRed,
new ItemStack(ExtrabiomesBlock.flower, 1,
BlockCustomFlower.metaToadstool),
new ItemStack(ExtrabiomesBlock.flower, 1,
BlockCustomFlower.metaToadstool),
Item.bowlEmpty });
}
if (ExtrabiomesBlock.leafPile != null)
Proxy.addRecipe(new ItemStack(Block.leaves), new Object[] {
"###", "###", "###", Character.valueOf('#'),
new ItemStack(ExtrabiomesBlock.leafPile) });
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
bd4cfe625f14957a589cb992d0101cbc6fd1fb4a | d77964aa24cfdca837fc13bf424c1d0dce9c70b9 | /spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBinder.java | 1a9f8d9954ab7653b6f7e1245945cf33e6247a4a | [] | no_license | Suryakanta97/Springboot-Project | 005b230c7ebcd2278125c7b731a01edf4354da07 | 50f29dcd6cea0c2bc6501a5d9b2c56edc6932d62 | refs/heads/master | 2023-01-09T16:38:01.679446 | 2018-02-04T01:22:03 | 2018-02-04T01:22:03 | 119,914,501 | 0 | 1 | null | 2022-12-27T14:52:20 | 2018-02-02T01:21:45 | Java | UTF-8 | Java | false | false | 6,557 | java | /*
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.context.properties;
import org.springframework.boot.context.properties.bind.BindHandler;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver;
import org.springframework.boot.context.properties.bind.handler.IgnoreErrorsBindHandler;
import org.springframework.boot.context.properties.bind.handler.NoUnboundElementsBindHandler;
import org.springframework.boot.context.properties.bind.validation.ValidationBindHandler;
import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
import org.springframework.boot.context.properties.source.UnboundElementsSourceFilter;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.env.PropertySource;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
/**
* Bind {@link ConfigurationProperties} annotated object from a configurable list of
* {@link PropertySource}.
*
* @author Stephane Nicoll
*/
class ConfigurationPropertiesBinder {
private final Iterable<PropertySource<?>> propertySources;
private final ConversionService conversionService;
private final Validator validator;
private final Binder binder;
private Iterable<ConfigurationPropertySource> configurationSources;
ConfigurationPropertiesBinder(Iterable<PropertySource<?>> propertySources,
ConversionService conversionService, Validator validator) {
Assert.notNull(propertySources, "PropertySources must not be null");
this.propertySources = propertySources;
this.conversionService = conversionService;
this.validator = validator;
this.configurationSources = ConfigurationPropertySources.from(propertySources);
this.binder = new Binder(this.configurationSources,
new PropertySourcesPlaceholdersResolver(this.propertySources),
this.conversionService);
}
/**
* Bind the specified {@code target} object using the configuration defined by the
* specified {@code annotation}.
*
* @param target the target to bind the configuration property sources to
* @param annotation the binding configuration
* @throws ConfigurationPropertiesBindingException if the binding failed
*/
void bind(Object target, ConfigurationProperties annotation) {
Validator validator = determineValidator(target);
BindHandler handler = getBindHandler(annotation, validator);
Bindable<?> bindable = Bindable.ofInstance(target);
try {
this.binder.bind(annotation.prefix(), bindable, handler);
} catch (Exception ex) {
String message = "Could not bind properties to '"
+ ClassUtils.getShortName(target.getClass()) + "': "
+ getAnnotationDetails(annotation);
throw new ConfigurationPropertiesBindingException(message, ex);
}
}
private Validator determineValidator(Object bean) {
boolean supportsBean = (this.validator != null
&& this.validator.supports(bean.getClass()));
if (ClassUtils.isAssignable(Validator.class, bean.getClass())) {
if (supportsBean) {
return new ChainingValidator(this.validator, (Validator) bean);
}
return (Validator) bean;
}
return (supportsBean ? this.validator : null);
}
private BindHandler getBindHandler(ConfigurationProperties annotation,
Validator validator) {
BindHandler handler = BindHandler.DEFAULT;
if (annotation.ignoreInvalidFields()) {
handler = new IgnoreErrorsBindHandler(handler);
}
if (!annotation.ignoreUnknownFields()) {
UnboundElementsSourceFilter filter = new UnboundElementsSourceFilter();
handler = new NoUnboundElementsBindHandler(handler, filter);
}
if (validator != null) {
handler = new ValidationBindHandler(handler, validator);
}
return handler;
}
private String getAnnotationDetails(ConfigurationProperties annotation) {
if (annotation == null) {
return "";
}
StringBuilder details = new StringBuilder();
details.append("prefix=").append(annotation.prefix());
details.append(", ignoreInvalidFields=").append(annotation.ignoreInvalidFields());
details.append(", ignoreUnknownFields=").append(annotation.ignoreUnknownFields());
return details.toString();
}
/**
* {@link Validator} implementation that wraps {@link Validator} instances and chains
* their execution.
*/
private static class ChainingValidator implements Validator {
private final Validator[] validators;
ChainingValidator(Validator... validators) {
Assert.notNull(validators, "Validators must not be null");
this.validators = validators;
}
@Override
public boolean supports(Class<?> clazz) {
for (Validator validator : this.validators) {
if (validator.supports(clazz)) {
return true;
}
}
return false;
}
@Override
public void validate(Object target, Errors errors) {
for (Validator validator : this.validators) {
if (validator.supports(target.getClass())) {
validator.validate(target, errors);
}
}
}
}
}
| [
"suryakanta97@github.com"
] | suryakanta97@github.com |
830969a4e1551db193717389f867e6225ee2a9e4 | 18953c60db160f53c51f2c5851fbc883ac541147 | /coursecheckin/src/main/java/com/extraFunction/Cache/AppConfig.java | 10c62d479b7055ec332737da728fe3c22eb7eb40 | [] | no_license | JPHold/PersonalProject | a9027fcd8b6a9a5e0f66a34ff1c79677b92d60c0 | 9869a18a9fff83bd9e3295ee5f67b6f6554b2c1f | refs/heads/master | 2020-05-22T02:50:03.753947 | 2016-12-16T14:54:14 | 2016-12-16T14:54:14 | 64,299,150 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,656 | java | package com.extraFunction.Cache;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import static android.content.Context.MODE_PRIVATE;
import static com.constant.Constant.KEY_GESTURE_PASSWORD;
import static com.constant.Constant.KEY_GESTURE_VERIFY_STATE;
import static com.constant.Constant.KEY_GESTUR_CLOCK_OPEN;
import static com.constant.Constant.KEY_NIGHT_MODE_SWITCH;
/**
* 保存应用信息
*
* @author Administrator
*/
public class AppConfig extends Object {
//自定义
private SharedPreferences innerConfig;
//默认
private SharedPreferences defaultConfig;
public AppConfig(final Context context) {
innerConfig = context.getSharedPreferences("apponfig", MODE_PRIVATE);
defaultConfig = context.getSharedPreferences("com.hjp.coursecheckin_preferences", MODE_PRIVATE);
}
//夜间模式
public void setNightModeSwitch(boolean isNight) {
Editor editor = edit(innerConfig);
editor.putBoolean(KEY_NIGHT_MODE_SWITCH, isNight);
commit(editor);
}
public boolean getNightModeSwitch() {
return innerConfig.getBoolean(KEY_NIGHT_MODE_SWITCH, false);
}
//手势锁的加密密码
public void setGesturePassWord(String passWord) {
Editor editor = edit(innerConfig);
editor.putString(KEY_GESTURE_PASSWORD, passWord);
commit(editor);
}
public String getKeyGesturePassword() {
return innerConfig.getString(KEY_GESTURE_PASSWORD, "");
}
//手势锁的状态(已验证/无验证)
public void setGestureVerifyState(boolean isVerify) {
Editor editor = edit(innerConfig);
editor.putBoolean(KEY_GESTURE_VERIFY_STATE, isVerify);
commit(editor);
}
public boolean getGestureVerifyState() {
return innerConfig.getBoolean(KEY_GESTURE_VERIFY_STATE, false);
}
//手势锁开启/不开启
public void setGestureClockOpen(boolean isOpen) {
Editor editor = edit(defaultConfig);
editor.putBoolean(KEY_GESTUR_CLOCK_OPEN, isOpen);
commit(editor);
}
public boolean getGestureClockOpen() {
return defaultConfig.getBoolean(KEY_GESTUR_CLOCK_OPEN, true);
}
private Editor edit(SharedPreferences preferences) {
return preferences.edit();
}
private void commit(Editor editor) {
editor.commit();
}
/**
* 清空
*/
public void clear() {
Editor editor = innerConfig.edit();
editor.clear();
editor.commit();
}
}
| [
"1208405111@qq.com"
] | 1208405111@qq.com |
eb82095dfb1b638f5e22fbaebb1cffc811fd6c76 | 4342c71a07755518c5c62cc78bf057fa243b0000 | /src/com/class24/TestBank.java | 045afb40d0afcb5ca62eadbeceb8718489235b2f | [] | no_license | erickLop503/JavaClasses | 5e171b5a5c7c48d99bfb7bf2bc868eadc7a32bda | 68eff0cbe2ae92a4bcdc9b423533bab9b9e65009 | refs/heads/master | 2020-05-03T00:08:26.311658 | 2019-05-18T14:57:20 | 2019-05-18T14:57:20 | 178,301,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package com.class24;
public class TestBank {
public static void main(String[] args) {
Bank bank= new Bank();
BOA boa= new BOA();
PNC pnc= new PNC();
int interestRate;
interestRate=bank.chargeInterest();
System.out.println("Bank charges interest = "+interestRate);
interestRate=boa.chargeInterest();
System.out.println("BOA charges interest = "+interestRate);
interestRate=pnc.chargeInterest();
System.out.println("PNC charges interest = "+interestRate);
}
}
| [
"4everklopez@gmail.com"
] | 4everklopez@gmail.com |
cf5eedd86a44e167040c21d627f5b853f29edcf6 | 93395758199070718ab14ee095b59ea38252c01b | /src/test/java/com/thoughtworks/pages/ProductListingPage.java | a139ae3b599a6e6ca7c432120762702c686ac525 | [] | no_license | BrijendraSingh/UIAutomation | f0bf784d0055c41d378b0a0dc31ed5417178e839 | 3eafba3998f61e8b2ef3a4c001260047e9e4281f | refs/heads/master | 2021-03-18T17:01:49.350515 | 2020-05-08T09:15:22 | 2020-05-08T09:15:22 | 247,083,457 | 0 | 0 | null | 2020-05-08T09:15:23 | 2020-03-13T13:56:16 | null | UTF-8 | Java | false | false | 2,331 | java | package com.thoughtworks.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
import org.testng.Assert;
public class ProductListingPage extends BasePage {
public ProductListingPage(WebDriver driver) {
super(driver);
}
@FindBy(id = "taxon")
private WebElement categories;
@FindBy(id = "keywords")
private WebElement keywords;
@FindBy(xpath = "//*[@id='search-bar']//input[@type='submit'][@value='Search']")
private WebElement search;
@FindBy(className = "search-results-title")
private WebElement searchTitle;
@FindBy(className = "product-title")
private WebElement productTitle;
@FindBy(id = "quantity")
private WebElement quantity;
@FindBy(id = "add-to-cart-button")
private WebElement addToCart;
public ProductListingPage searchProduct(String category, String searchText) {
if(!(category.isEmpty() || category==null)) {
categories.click();
driver.findElement(By.xpath("//option[. = '" + category + "']")).click();
}
keywords.sendKeys(searchText);
search.click();
return new ProductListingPage(driver);
}
public ProductListingPage validateSearch(String searchText) {
Assert.assertEquals(this.IsDisplayed(searchTitle), true, "Verify Search Title is Displayed");
Assert.assertEquals(searchTitle.getText(), "Search results for '" + searchText + "'", "Verify Search Text on Search page");
return new ProductListingPage(driver);
}
public ProductListingPage selectProduct(String productName) {
driver.findElement(By.xpath("//span[text()=" + "'" + productName + "'" + "]/parent::a")).click();
Assert.assertEquals(IsDisplayed(productTitle),true,"Verify Product Is Opened");
Assert.assertEquals(productTitle.getText(),productName,"Verify Correct Product is Opened");
return new ProductListingPage(driver);
}
public ShoppingPage addToCart(int totalItems){
quantity.clear();
quantity.sendKeys(Integer.toString(totalItems));
driver.findElement(By.id("add-to-cart-button")).click();
return new ShoppingPage(driver);
}
}
| [
"jayush@thoughtworks.com"
] | jayush@thoughtworks.com |
39072d46da80aa3d1e5ee25bce8f49c04fb18d4d | bd2335e629b3701888600f1709dfbeb5bad50787 | /src/main/java/wiki/primo/generator/mybatis/plus/cae/service/ext/ILandAndHousingExpropriationCompensationInformationServiceExt.java | 526f2fd51e38c3d83fb97c585c1820d938dad814 | [] | no_license | attack204/fuckcae | dc1f466052c5d98dd206895ef4fdebf823cd47da | 1abb45324a76c37ebafe06c09adf2d5d3d309261 | refs/heads/master | 2023-08-28T13:13:02.005590 | 2021-10-28T08:16:25 | 2021-10-28T08:16:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 232 | java | package wiki.primo.generator.mybatis.plus.cae.service.ext;
/**
* <p>
* 服务类
* </p>
*
* @author attack204
* @since 2021-10-28 16:08:23
*/
public interface ILandAndHousingExpropriationCompensationInformationServiceExt{
}
| [
"757394026@qq.com"
] | 757394026@qq.com |
20c15fbdfeccf414d96380da44d56e63570b8da8 | 85e408a173c29fbb12ffef73ad0e8fd2368ef9ac | /src/main/java/fr/istic/taa/aspect/LoggingAspect.java | 7f1cac5f6b4bfd3820030ab18c8037fb638683be | [] | no_license | antoine-brezillon/istic-taa | 4537d70f9d5d5a017308ca56129ae41940e91f26 | f3c96cc6995163e93e0fa588c42a21d38b38a1ff | refs/heads/master | 2021-01-11T03:51:08.807435 | 2016-02-29T08:22:39 | 2016-02-29T08:22:39 | 71,255,524 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 930 | java | package fr.istic.taa.aspect;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;
/**
* Created by Antoine Brezillon on 21/01/16.
*/
@Component
@Aspect
public class LoggingAspect {
private String getClass(String s){
return s.substring(s.lastIndexOf(".")+1,s.indexOf("@"));
}
@Before("execution(* fr..*Resource.*(..))")
public void logBefore(JoinPoint joinPoint) {
System.out.println("Query\t" + getClass(joinPoint.getThis().toString()) + "\t : \t" + joinPoint.getSignature().getName());
}
@After("execution(* fr..*Resource.*(..))")
public void logAfter(JoinPoint joinPoint) {
System.out.println("Response\t" + getClass(joinPoint.getThis().toString()) + "\t : \t" + joinPoint.getSignature().getName());
}
}
| [
"antoine.brezillon@gmail.com"
] | antoine.brezillon@gmail.com |
1a5b870b4d8afcbad174a227bcc7ecd0bc705548 | 11fff8ced80bff9e6abbb7b1db7df45a0624c89e | /src/test/java/com/helecloud/talks/triggered/TriggeredServicesApplicationTests.java | c1306b53a92d35f85454a4c2013e526e7be39614 | [] | no_license | egelev/spring-triggered-services | 1722139fd2c0bc26c45efee085a95ca6c2de1d78 | 7dd04db1a537c8796cacb158a6389660a9d371d4 | refs/heads/main | 2023-05-27T12:57:58.050759 | 2021-06-15T10:35:41 | 2021-06-15T10:35:41 | 376,875,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 232 | java | package com.helecloud.talks.triggered;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class TriggeredServicesApplicationTests {
@Test
void contextLoads() {
}
}
| [
"emil.gelev@ft.com"
] | emil.gelev@ft.com |
fd57a072c93591c70cf80bc5b2da7710f344e963 | 4e6ce7b60cc8c3b4d9ee1bdc2888b462a0727ae6 | /app/src/demo/java/com/gulu/album/item/EPhoto.java | 60887a4715748004ffceee07eea449364c5a4ca0 | [] | no_license | kang36897/AnimationAlbum | 2a4e86c8bc668a3772ac519af333a83aac8f8625 | 076ef18457f6937bfb9826627e6dc8ac6ef1d1aa | refs/heads/master | 2021-01-23T07:34:13.628539 | 2015-10-05T02:27:56 | 2015-10-05T02:27:56 | 40,071,254 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,238 | java | package com.gulu.album.item;
import android.graphics.Bitmap;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by Administrator on 2015/7/31.
*/
public class EPhoto implements Parcelable{
private int mBitmpResId;
private Bitmap mBitmap;
public EPhoto(Parcel input){
mBitmpResId = input.readInt();
mBitmap = input.readParcelable(EPhoto.class.getClassLoader());
}
public EPhoto(int resId){
mBitmpResId = resId;
}
public EPhoto(Bitmap bitmap){
mBitmap = bitmap;
}
public int getmBitmpResId() {
return mBitmpResId;
}
public Bitmap getmBitmap() {
return mBitmap;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(mBitmpResId);
dest.writeParcelable(mBitmap, flags);
}
public final static Creator<EPhoto> CREATOR = new Creator<EPhoto>(){
@Override
public EPhoto createFromParcel(Parcel source) {
return new EPhoto(source);
}
@Override
public EPhoto[] newArray(int size) {
return new EPhoto[size];
}
};
}
| [
"kang36897@163.com"
] | kang36897@163.com |
35d686f11c38ff54e89208457e4b6d36546db9cf | bbd0326cf4699c2116eb30c02cf7fe4ebb0558c0 | /expt0/candidate/ssFix/plausible/Chart_24.java | 9c1962379a83e3f15e104050112388a188b1b429 | [
"Apache-2.0",
"Minpack"
] | permissive | qixin5/ssFix | 82131862c0a54be88e57c1df246e6e2b49901e11 | fb106c8715e232885dc25ea9ea9b9d0910cf8524 | refs/heads/master | 2021-01-23T04:59:24.836730 | 2020-12-31T02:42:18 | 2020-12-31T02:42:18 | 86,259,519 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 13,897 | java | /* DefaultBoundedRangeModel.java -- Default implementation
of BoundedRangeModel.
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.swing;
import java.io.Serializable;
import java.util.EventListener;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
/**
* A default implementation of <code>BoundedRangeModel</code>.
*
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
public class DefaultBoundedRangeModel
implements BoundedRangeModel, Serializable
{
/**
* The identifier of this class in object serialization. Verified
* using the serialver tool of Sun J2SE 1.4.1_01.
*/
private static final long serialVersionUID = 5034068491295259790L;
/**
* An event that is sent to all registered {@link ChangeListener}s
* when the state of this range model has changed.
*
* <p>The event object is created on demand, the first time it
* is actually needed.</p>
*
* @see #fireStateChanged()
*/
protected transient ChangeEvent changeEvent;
/**
* The list of the currently registered EventListeners.
*/
protected EventListenerList listenerList = new EventListenerList();
/**
* The current value of the range model, which is always between
* {@link #minimum} and ({@link #maximum} - {@link #extent}). In a
* scroll bar visualization of a {@link BoundedRangeModel}, the
* <code>value</code> is displayed as the position of the thumb.
*/
private int value;
/**
* The current extent of the range model, which is a number greater
* than or equal to zero. In a scroll bar visualization of a {@link
* BoundedRangeModel}, the <code>extent</code> is displayed as the
* size of the thumb.
*/
private int extent;
/**
* The current minimum value of the range model, which is always
* less than or equal to {@link #maximum}.
*/
private int minimum;
/**
* The current maximum value of the range model, which is always
* greater than or equal to {@link #minimum}.
*/
private int maximum;
/**
* A property that indicates whether the value of this {@link
* BoundedRangeModel} is going to change in the immediate future.
*/
private boolean isAdjusting;
/**
* Constructs a <code>DefaultBoundedRangeModel</code> with default
* values for the properties. The properties <code>value</code>,
* <code>extent</code> and <code>minimum</code> will be initialized
* to zero; <code>maximum</code> will be set to 100; the property
* <code>valueIsAdjusting</code> will be <code>false</code>.
*/
public DefaultBoundedRangeModel()
{
// The fields value, extent, minimum have the default value 0, and
// isAdjusting is already false. These fields no not need to be
// set explicitly.
maximum = 100;
}
/**
* Constructs a <code>DefaultBoundedRangeModel</code> with the
* specified values for some properties.
*
* @param value the initial value of the range model, which must be
* a number between <code>minimum</code> and <code>(maximum -
* extent)</code>. In a scroll bar visualization of a {@link
* BoundedRangeModel}, the <code>value</code> is displayed as the
* position of the thumb.
*
* @param extent the initial extent of the range model, which is a
* number greater than or equal to zero. In a scroll bar
* visualization of a {@link BoundedRangeModel}, the
* <code>extent</code> is displayed as the size of the thumb.
*
* @param minimum the initial minimal value of the range model.
*
* @param maximum the initial maximal value of the range model.
*
* @throws IllegalArgumentException if the following condition is
* not satisfied: <code>minimum <= value <= value + extent <=
* maximum</code>.
*/
public DefaultBoundedRangeModel(int value, int extent, int minimum,
int maximum)
{
if (!(minimum <= value && extent >= 0 && (value + extent) <= maximum))
throw new IllegalArgumentException();
this.value = value;
this.extent = extent;
this.minimum = minimum;
this.maximum = maximum;
// The isAdjusting field already has a false value by default.
}
/**
* Returns a string with all relevant properties of this range
* model.
*
* @return a string representing the object
*/
public String toString()
{
return getClass().getName()
+ "[value=" + value
+ ", extent=" + extent
+ ", min=" + minimum
+ ", max=" + maximum
+ ", adj=" + isAdjusting
+ ']';
}
/**
* Returns the current value of this bounded range model. In a
* scroll bar visualization of a {@link BoundedRangeModel}, the
* <code>value</code> is displayed as the position of the thumb.
*
* @return the value
*/
public int getValue()
{
return value;
}
/**
* Changes the current value of this bounded range model. In a
* scroll bar visualization of a {@link BoundedRangeModel}, the
* <code>value</code> is displayed as the position of the thumb;
* changing the <code>value</code> of a scroll bar's model
* thus moves the thumb to a different position.
*
* @param value the value
*/
public void setValue(int value)
{
value = Math.max(minimum, value);
if (value + extent > maximum)
value = maximum - extent;
if (value != this.value)
{
this.value = value;
fireStateChanged();
}
}
/**
* Returns the current extent of this bounded range model, which is
* a number greater than or equal to zero. In a scroll bar
* visualization of a {@link BoundedRangeModel}, the
* <code>extent</code> is displayed as the size of the thumb.
*
* @return the extent
*/
public int getExtent()
{
return extent;
}
/**
* Changes the current extent of this bounded range model. In a
* scroll bar visualization of a {@link BoundedRangeModel}, the
* <code>extent</code> is displayed as the size of the thumb.
*
* @param extent the new extent of the range model, which is a
* number greater than or equal to zero.
*/
public void setExtent(int extent)
{
extent = Math.max(extent, 0);
if (value + extent > maximum)
extent = maximum - value;
if (extent != this.extent)
{
this.extent = extent;
fireStateChanged();
}
}
/**
* Returns the current minimal value of this bounded range model.
*/
public int getMinimum()
{
return minimum;
}
/**
* Changes the current minimal value of this bounded range model.
*
* @param minimum the new minimal value.
*/
public void setMinimum(int minimum)
{
int value, maximum;
maximum = Math.max(minimum, this.maximum);
value = Math.max(minimum, this.value);
setRangeProperties(value, extent, minimum, maximum, isAdjusting);
}
/**
* Returns the current maximal value of this bounded range model.
*
* @return the maximum
*/
public int getMaximum()
{
return maximum;
}
/**
* Changes the current maximal value of this bounded range model.
*
* @param maximum the new maximal value.
*/
public void setMaximum(int maximum)
{
int value, extent, minimum;
minimum = Math.min(this.minimum, maximum);
extent = Math.min(this.extent, maximum - minimum);
value = Math.min(this.value, maximum - extent);
setRangeProperties(value, extent, minimum, maximum, isAdjusting);
}
/**
* Returns whether or not the value of this bounded range model is
* going to change in the immediate future. Scroll bars set this
* property to <code>true</code> while the thumb is being dragged
* around; when the mouse is relased, they set the property to
* <code>false</code> and post a final {@link ChangeEvent}.
*
* @return <code>true</code> if the value will change soon again;
* <code>false</code> if the value will probably not change soon.
*/
public boolean getValueIsAdjusting()
{
return isAdjusting;
}
/**
* Specifies whether or not the value of this bounded range model is
* going to change in the immediate future. Scroll bars set this
* property to <code>true</code> while the thumb is being dragged
* around; when the mouse is relased, they set the property to
* <code>false</code>.
*
* @param isAdjusting <code>true</code> if the value will change
* soon again; <code>false</code> if the value will probably not
* change soon.
*/
public void setValueIsAdjusting(boolean isAdjusting)
{
if (isAdjusting == this.isAdjusting)
return;
this.isAdjusting = isAdjusting;
fireStateChanged();
}
/**
* Sets all properties.
*
* @param value the new value of the range model. In a scroll bar
* visualization of a {@link BoundedRangeModel}, the
* <code>value</code> is displayed as the position of the thumb.
*
* @param extent the new extent of the range model, which is a
* number greater than or equal to zero. In a scroll bar
* visualization of a {@link BoundedRangeModel}, the
* <code>extent</code> is displayed as the size of the thumb.
*
* @param minimum the new minimal value of the range model.
*
* @param maximum the new maximal value of the range model.
* @param isAdjusting whether or not the value of this bounded range
* model is going to change in the immediate future. Scroll bars set
* this property to <code>true</code> while the thumb is being
* dragged around; when the mouse is relased, they set the property
* to <code>false</code>.
*/
public void setRangeProperties(int value, int extent, int minimum,
int maximum, boolean isAdjusting)
{
minimum = Math.min(Math.min(minimum, maximum), value);
maximum = Math.max(value, maximum);
if (extent + value > maximum)
extent = maximum - value;
extent = Math.max(0, extent);
if ((value == this.value)
&& (extent == this.extent)
&& (minimum == this.minimum)
&& (maximum == this.maximum)
&& (isAdjusting == this.isAdjusting))
return;
this.value = value;
this.extent = extent;
this.minimum = minimum;
this.maximum = maximum;
this.isAdjusting = isAdjusting;
fireStateChanged();
}
/**
* Subscribes a ChangeListener to state changes.
*
* @param listener the listener to be subscribed.
*/
public void addChangeListener(ChangeListener listener)
{
listenerList.add(ChangeListener.class, listener);
}
/**
* Cancels the subscription of a ChangeListener.
*
* @param listener the listener to be unsubscribed.
*/
public void removeChangeListener(ChangeListener listener)
{
listenerList.remove(ChangeListener.class, listener);
}
/**
* Sends a {@link ChangeEvent} to any registered {@link
* ChangeListener}s.
*
* @see #addChangeListener(ChangeListener)
* @see #removeChangeListener(ChangeListener)
*/
protected void fireStateChanged()
{
ChangeListener[] listeners = getChangeListeners();
if (changeEvent == null)
changeEvent = new ChangeEvent(this);
for (int i = listeners.length - 1; i >= 0; --i)
listeners[i].stateChanged(changeEvent);
}
/**
* Retrieves the current listeners of the specified class.
*
* @param c the class of listeners; usually {@link
* ChangeListener}<code>.class</code>.
*
* @return an array with the currently subscribed listeners, or
* an empty array if there are currently no listeners.
*
* @since 1.3
*/
public EventListener[] getListeners(Class listenerType)
{
return listenerList.getListeners(listenerType);
}
/**
* Returns all <code>ChangeListeners</code> that are currently
* subscribed for changes to this
* <code>DefaultBoundedRangeModel</code>.
*
* @return an array with the currently subscribed listeners, or
* an empty array if there are currently no listeners.
*
* @since 1.4
*/
public ChangeListener[] getChangeListeners()
{
return (ChangeListener[]) getListeners(ChangeListener.class);
}
}
| [
"xinq07@gmail.com"
] | xinq07@gmail.com |
59a421441777fb4a48196fdc948bbf10df1d4241 | e15c8b140c8f169a0cb0457b576f84fae4597420 | /src/com/javagame/math3D/SolidPolygon3D.java | 0723e01474c99a39b6944315f3cc3c815c3d34b5 | [] | no_license | TQCCC/JavaGame | 854bb826d75b777e2bfc5db52f772b1797ea2b7d | 1d1c3b99e0f687baae85ac2f31f2f8a3486db89c | refs/heads/master | 2021-01-25T09:15:10.040438 | 2017-10-05T06:18:01 | 2017-10-05T06:18:01 | 93,807,644 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,009 | java | package com.javagame.math3D;
import java.awt.Color;
/**
* The SolidPolygon3D class is a Polygon with a color.
*/
public class SolidPolygon3D extends Polygon3D {
private Color color = Color.GREEN;
public SolidPolygon3D() {
super();
}
public SolidPolygon3D(Vector3D v0, Vector3D v1, Vector3D v2) {
this(new Vector3D[] { v0, v1, v2 });
}
public SolidPolygon3D(Vector3D v0, Vector3D v1, Vector3D v2, Vector3D v3) {
this(new Vector3D[] { v0, v1, v2, v3 });
}
public SolidPolygon3D(Vector3D[] vertices) {
super(vertices);
}
public void setTo(Polygon3D polygon) {
super.setTo(polygon);
if (polygon instanceof SolidPolygon3D) {
color = ((SolidPolygon3D) polygon).color;
}
}
/**
* Gets the color of this solid-colored polygon used for rendering this
* polygon.
*/
public Color getColor() {
return color;
}
/**
* Sets the color of this solid-colored polygon used for rendering this
* polygon.
*/
public void setColor(Color color) {
this.color = color;
}
}
| [
"tqcccc@sina.com"
] | tqcccc@sina.com |
24a075b0ac646d17797524f8f8b920f4fe5727b6 | 55459643f85d03bc4175d02f0e03e61745fc6255 | /ZooKeeperLast/src/com/codingdojo/zookeeperlast/BatTest.java | 1b4fde93d65a67be4eb789ea898504080a4d0389 | [] | no_license | kellytapuelpan/fullstacktrainee | 8a824d953f317d0f4e547c8967c5a529a7b1fdae | 16abf5168de926b1e9da93152933f99fe2cf0dae | refs/heads/master | 2020-12-06T04:34:38.256663 | 2020-07-24T17:11:42 | 2020-07-24T17:11:42 | 232,342,802 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 352 | java | package com.codingdojo.zookeeperlast;
public class BatTest {
public static void main(String[] args) {
Bat uglybat = new Bat();
uglybat.attackTown();
uglybat.fly();
uglybat.attackTown();
uglybat.attackTown();
uglybat.eatHumans();
uglybat.fly();
uglybat.eatHumans();
System.out.println(uglybat.getEnergy());
}
} | [
"noreply@github.com"
] | kellytapuelpan.noreply@github.com |
6b7da8637f5dba6df502c17630b0ef84dab374d9 | 0b53014f3a54cbb243fd4a8eb8e27df88c4e75b5 | /day23-02-netstore/src/cn/yfz/filter/setCharacterEncodingFilter.java | d6d0805a47379e910da83af7c3727bd9010f9703 | [] | no_license | michaelyifangzhou/learngit | fa408d718a8a60ea7fe1ecec7dbdc89d67b3a018 | 0b5fc159ba5b33edda40a64720b1da750f2d7f5b | refs/heads/master | 2020-05-16T01:47:31.975751 | 2019-04-22T02:59:02 | 2019-04-22T02:59:02 | 182,610,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,951 | java | package cn.yfz.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet Filter implementation class setCharacterEncodingFilter
*/
@WebFilter(filterName="setCharacterEncodingFilter",urlPatterns="/*")
public class setCharacterEncodingFilter implements Filter {
private FilterConfig filterConfig;
/**
* Default constructor.
*/
public setCharacterEncodingFilter() {
// TODO Auto-generated constructor stub
}
/**
* @see Filter#destroy()
*/
public void destroy() {
// TODO Auto-generated method stub
}
/**
* @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
*/
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
// TODO Auto-generated method stub
// place your code here
HttpServletRequest request;
HttpServletResponse response;
try {
request=(HttpServletRequest) req;
response=(HttpServletResponse) resp;
} catch (Exception e) {
// TODO Auto-generated catch block
throw new ServletException("non http response or request");
}
String encoding=filterConfig.getInitParameter("encoding");
if(encoding==null){
encoding="UTF-8";
}
request.setCharacterEncoding(encoding);
response.setCharacterEncoding(encoding);
response.setContentType("text/html;charset="+encoding);
// pass the request along the filter chain
chain.doFilter(request, response);
}
/**
* @see Filter#init(FilterConfig)
*/
public void init(FilterConfig fConfig) throws ServletException {
// TODO Auto-generated method stub
this.filterConfig=fConfig;
}
}
| [
"1620623368@qq.com"
] | 1620623368@qq.com |
937ca358d1240e2fecc0e4b79a6865dd77985719 | 2c0ffcb1084d9ca867b18bf2aa241c389bbc65d6 | /src/main/java/twitter4j/User.java | 4997338f53f9f6884d8f3ba04e77629cac374e7d | [
"BSD-3-Clause",
"JSON"
] | permissive | tarchan/twitter4j | 0d46f579299d4160f32d244d990e184b94a48853 | f6bda6998a88a3e90b3c8de854ea66b798a6548d | refs/heads/master | 2021-01-18T06:14:28.221813 | 2009-11-25T15:06:40 | 2009-11-25T15:06:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,070 | java | /*
Copyright (c) 2007-2009, Yusuke Yamamoto
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 the Yusuke Yamamoto 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 Yusuke Yamamoto ``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 Yusuke Yamamoto 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 twitter4j;
import twitter4j.http.Response;
import twitter4j.org.json.JSONArray;
import twitter4j.org.json.JSONException;
import twitter4j.org.json.JSONObject;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* A data class representing Basic user information element
* @author Yusuke Yamamoto - yusuke at mac.com
* @see <a href="http://apiwiki.twitter.com/REST+API+Documentation#Basicuserinformationelement">REST API Documentation - Basic user information element</a>
*/
public class User extends TwitterResponse implements java.io.Serializable {
private int id;
private String name;
private String screenName;
private String location;
private String description;
private String profileImageUrl;
private String url;
private boolean isProtected;
private int followersCount;
private Date statusCreatedAt;
private long statusId = -1;
private String statusText = null;
private String statusSource = null;
private boolean statusTruncated = false;
private long statusInReplyToStatusId = -1;
private int statusInReplyToUserId = -1;
private boolean statusFavorited = false;
private String statusInReplyToScreenName = null;
private String profileBackgroundColor;
private String profileTextColor;
private String profileLinkColor;
private String profileSidebarFillColor;
private String profileSidebarBorderColor;
private int friendsCount;
private Date createdAt;
private int favouritesCount;
private int utcOffset;
private String timeZone;
private String profileBackgroundImageUrl;
private String profileBackgroundTile;
private int statusesCount;
private boolean isGeoEnabled;
private boolean isVerified;
private static final long serialVersionUID = -6345893237975349030L;
/*package*/User(Response res) throws TwitterException {
super(res);
init(res.asJSONObject());
}
/*package*/User(Response res, JSONObject json) throws TwitterException {
super(res);
init(json);
}
/*package*/User(JSONObject json) throws TwitterException {
super();
init(json);
}
private void init(JSONObject json) throws TwitterException {
try {
id = json.getInt("id");
name = json.getString("name");
screenName = json.getString("screen_name");
location = json.getString("location");
description = json.getString("description");
profileImageUrl = json.getString("profile_image_url");
url = json.getString("url");
isProtected = json.getBoolean("protected");
isGeoEnabled = json.getBoolean("geo_enabled");
isVerified = json.getBoolean("verified");
followersCount = json.getInt("followers_count");
profileBackgroundColor = json.getString("profile_background_color");
profileTextColor = json.getString("profile_text_color");
profileLinkColor = json.getString("profile_link_color");
profileSidebarFillColor = json.getString("profile_sidebar_fill_color");
profileSidebarBorderColor = json.getString("profile_sidebar_border_color");
friendsCount = json.getInt("friends_count");
createdAt = parseDate(json.getString("created_at"), "EEE MMM dd HH:mm:ss z yyyy");
favouritesCount = json.getInt("favourites_count");
utcOffset = getInt("utc_offset", json);
timeZone = json.getString("time_zone");
profileBackgroundImageUrl = json.getString("profile_background_image_url");
profileBackgroundTile = json.getString("profile_background_tile");
statusesCount = json.getInt("statuses_count");
if (!json.isNull("status")) {
JSONObject status = json.getJSONObject("status");
statusCreatedAt = parseDate(status.getString("created_at"), "EEE MMM dd HH:mm:ss z yyyy");
statusId = status.getLong("id");
statusText = status.getString("text");
statusSource = status.getString("source");
statusTruncated = status.getBoolean("truncated");
statusInReplyToStatusId = getLong("in_reply_to_status_id", status);
statusInReplyToUserId = getInt("in_reply_to_user_id", status);
statusFavorited = status.getBoolean("favorited");
statusInReplyToScreenName = status.getString("in_reply_to_screen_name");
}
} catch (JSONException jsone) {
throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
}
}
/**
* Returns the id of the user
*
* @return the id of the user
*/
public int getId() {
return id;
}
/**
* Returns the name of the user
*
* @return the name of the user
*/
public String getName() {
return name;
}
/**
* Returns the screen name of the user
*
* @return the screen name of the user
*/
public String getScreenName() {
return screenName;
}
/**
* Returns the location of the user
*
* @return the location of the user
*/
public String getLocation() {
return location;
}
/**
* Returns the description of the user
*
* @return the description of the user
*/
public String getDescription() {
return description;
}
/**
* Returns the profile image url of the user
*
* @return the profile image url of the user
*/
public URL getProfileImageURL() {
try {
return new URL(profileImageUrl);
} catch (MalformedURLException ex) {
return null;
}
}
/**
* Returns the url of the user
*
* @return the url of the user
*/
public URL getURL() {
try {
return new URL(url);
} catch (MalformedURLException ex) {
return null;
}
}
/**
* Test if the user status is protected
*
* @return true if the user status is protected
*/
public boolean isProtected() {
return isProtected;
}
/**
* Returns the number of followers
*
* @return the number of followers
* @since Twitter4J 1.0.4
*/
public int getFollowersCount() {
return followersCount;
}
/*package*/ static List<User> constructUsers(Response res) throws TwitterException {
try {
JSONArray list = res.asJSONArray();
int size = list.length();
List<User> users = new ArrayList<User>(size);
for (int i = 0; i < size; i++) {
users.add(new User(res, list.getJSONObject(i)));
}
return users;
} catch (JSONException jsone) {
throw new TwitterException(jsone);
} catch (TwitterException te) {
throw te;
}
}
/**
* @return created_at or null if the user is protected
* @since Twitter4J 1.1.0
*/
public Date getStatusCreatedAt() {
return statusCreatedAt;
}
/**
*
* @return status id or -1 if the user is protected
*/
public long getStatusId() {
return statusId;
}
/**
*
* @return status text or null if the user is protected
*/
public String getStatusText() {
return statusText;
}
/**
*
* @return source or null if the user is protected
* @since 1.1.4
*/
public String getStatusSource() {
return statusSource;
}
/**
*
* @return truncated or false if the user is protected
* @since 1.1.4
*/
public boolean isStatusTruncated() {
return statusTruncated;
}
/**
*
* @return in_reply_to_status_id or -1 if the user is protected
* @since 1.1.4
*/
public long getStatusInReplyToStatusId() {
return statusInReplyToStatusId;
}
/**
*
* @return in_reply_to_user_id or -1 if the user is protected
* @since 1.1.4
*/
public int getStatusInReplyToUserId() {
return statusInReplyToUserId;
}
/**
*
* @return favorited or false if the user is protected
* @since 1.1.4
*/
public boolean isStatusFavorited() {
return statusFavorited;
}
/**
*
* @return in_reply_to_screen_name or null if the user is protected
* @since 1.1.4
*/
public String getStatusInReplyToScreenName() {
return -1 != statusInReplyToUserId ? statusInReplyToScreenName : null;
}
public String getProfileBackgroundColor() {
return profileBackgroundColor;
}
public String getProfileTextColor() {
return profileTextColor;
}
public String getProfileLinkColor() {
return profileLinkColor;
}
public String getProfileSidebarFillColor() {
return profileSidebarFillColor;
}
public String getProfileSidebarBorderColor() {
return profileSidebarBorderColor;
}
public int getFriendsCount() {
return friendsCount;
}
public Date getCreatedAt() {
return createdAt;
}
public int getFavouritesCount() {
return favouritesCount;
}
public int getUtcOffset() {
return utcOffset;
}
public String getTimeZone() {
return timeZone;
}
public String getProfileBackgroundImageUrl() {
return profileBackgroundImageUrl;
}
public String getProfileBackgroundTile() {
return profileBackgroundTile;
}
public int getStatusesCount() {
return statusesCount;
}
/**
*
* @return the user is enabling geo location
* @since Twitter4J 2.0.10
*/
public boolean isGeoEnabled() {
return isGeoEnabled;
}
/**
*
* @return returns true if the user is a verified celebrity
* @since Twitter4J 2.0.10
*/
public boolean isVerified() {
return isVerified;
}
@Override
public int hashCode() {
return id;
}
@Override
public boolean equals(Object obj) {
if (null == obj) {
return false;
}
if (this == obj) {
return true;
}
return obj instanceof User && ((User) obj).id == this.id;
}
@Override
public String toString() {
return "User{" +
", id=" + id +
", name='" + name + '\'' +
", screenName='" + screenName + '\'' +
", location='" + location + '\'' +
", description='" + description + '\'' +
", profileImageUrl='" + profileImageUrl + '\'' +
", url='" + url + '\'' +
", isProtected=" + isProtected +
", followersCount=" + followersCount +
", statusCreatedAt=" + statusCreatedAt +
", statusId=" + statusId +
", statusText='" + statusText + '\'' +
", statusSource='" + statusSource + '\'' +
", statusTruncated=" + statusTruncated +
", statusInReplyToStatusId=" + statusInReplyToStatusId +
", statusInReplyToUserId=" + statusInReplyToUserId +
", statusFavorited=" + statusFavorited +
", statusInReplyToScreenName='" + statusInReplyToScreenName + '\'' +
", profileBackgroundColor='" + profileBackgroundColor + '\'' +
", profileTextColor='" + profileTextColor + '\'' +
", profileLinkColor='" + profileLinkColor + '\'' +
", profileSidebarFillColor='" + profileSidebarFillColor + '\'' +
", profileSidebarBorderColor='" + profileSidebarBorderColor + '\'' +
", friendsCount=" + friendsCount +
", createdAt=" + createdAt +
", favouritesCount=" + favouritesCount +
", utcOffset=" + utcOffset +
", timeZone='" + timeZone + '\'' +
", profileBackgroundImageUrl='" + profileBackgroundImageUrl + '\'' +
", profileBackgroundTile='" + profileBackgroundTile + '\'' +
", statusesCount=" + statusesCount +
", geoEnabled=" + isGeoEnabled +
", verified=" + isVerified +
'}';
}
}
| [
"yusuke@117b7e0d-5933-0410-9d29-ab41bb01d86b"
] | yusuke@117b7e0d-5933-0410-9d29-ab41bb01d86b |
ce82baf0dbf68dbf4573d3199334f252ae06f044 | bdb7a268fb8c4f7c58f63e797900441d530c792e | /src/bbmap/current/fileIO/ByteStreamWriter.java | 4357d14e6f58ee8ce661050035f036a5bed093b9 | [
"Apache-2.0",
"BSD-3-Clause-LBNL"
] | permissive | CruorVolt/mu_bbmap | 1b880c9b08cf1d30f1b217e0c0378330e71058f0 | a6b63f4a6c8f59a91e50464e9f3c8d8e651dc7d0 | HEAD | 2016-08-13T01:42:24.758813 | 2016-01-18T18:22:01 | 2016-01-18T18:22:01 | 44,755,707 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,264 | java | package fileIO;
import java.io.IOException;
import java.io.OutputStream;
import java.util.concurrent.ArrayBlockingQueue;
import align2.Shared;
import kmer.AbstractKmerTable;
import stream.ByteBuilder;
import stream.Read;
import ukmer.AbstractKmerTableU;
import dna.Data;
/**
* @author Brian Bushnell
* @date Oct 21, 2014
*
*/
public class ByteStreamWriter extends Thread {
/*--------------------------------------------------------------*/
/*---------------- Initialization ----------------*/
/*--------------------------------------------------------------*/
public ByteStreamWriter(String fname_, boolean overwrite_, boolean append_, boolean allowSubprocess_){
this(fname_, overwrite_, append_, allowSubprocess_, 0);
}
public ByteStreamWriter(String fname_, boolean overwrite_, boolean append_, boolean allowSubprocess_, int format){
this(FileFormat.testOutput(fname_, FileFormat.TEXT, format, 0, allowSubprocess_, overwrite_, append_, true));
}
public ByteStreamWriter(FileFormat ff){
FASTQ=ff.fastq() || ff.text();
FASTA=ff.fasta();
BREAD=ff.bread();
SAM=ff.samOrBam();
BAM=ff.bam();
SITES=ff.sites();
INFO=ff.attachment();
OTHER=(!FASTQ && !FASTA && !BREAD && !SAM && !BAM && !SITES && !INFO);
fname=ff.name();
overwrite=ff.overwrite();
append=ff.append();
allowSubprocess=ff.allowSubprocess();
assert(!(overwrite&append));
assert(ff.canWrite()) : "File "+fname+" exists and overwrite=="+overwrite;
if(append && !(ff.raw() || ff.gzip())){throw new RuntimeException("Can't append to compressed files.");}
if(!BAM || !Data.SAMTOOLS() || !Data.SH()){
outstream=ReadWrite.getOutputStream(fname, append, true, allowSubprocess);
}else{
outstream=ReadWrite.getOutputStreamFromProcess(fname, "samtools view -S -b -h - ", true, append, true);
}
queue=new ArrayBlockingQueue<ByteBuilder>(5);
buffer=new ByteBuilder(initialLen);
}
/*--------------------------------------------------------------*/
/*---------------- Primary Method ----------------*/
/*--------------------------------------------------------------*/
@Override
public void run() {
if(verbose){System.err.println("running");}
assert(open) : fname;
synchronized(this){
started=true;
this.notify();
}
ByteBuilder job=null;
if(verbose){System.err.println("waiting for jobs");}
while(job==null){
try {
job=queue.take();
// job.list=queue.take();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(verbose){System.err.println("processing jobs");}
while(job!=null && job!=POISON2){
if(job.length()>0){
try {
outstream.write(job.array, 0, job.length());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
job=null;
while(job==null){
try {
job=queue.take();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
if(verbose){System.err.println("null/poison job");}
// assert(false);
open=false;
ReadWrite.finishWriting(null, outstream, fname, allowSubprocess);
if(verbose){System.err.println("finish writing");}
synchronized(this){notifyAll();}
if(verbose){System.err.println("done");}
}
/*--------------------------------------------------------------*/
/*---------------- Control and Helpers ----------------*/
/*--------------------------------------------------------------*/
@Override
public void start(){
super.start();
if(verbose){System.err.println(this.getState());}
synchronized(this){
while(!started){
try {
this.wait(20);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
public synchronized void poison(){
//Don't allow thread to shut down before it has started
while(!started || this.getState()==Thread.State.NEW){
try {
this.wait(20);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(!open){return;}
addJob(buffer);
buffer=null;
// System.err.println("Poisoned!");
// assert(false);
// assert(false) : open+", "+this.getState()+", "+started;
open=false;
addJob(POISON2);
}
public void waitForFinish(){
while(this.getState()!=Thread.State.TERMINATED){
try {
this.join(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
/**
* @return true if there was an error, false otherwise
*/
public boolean poisonAndWait(){
poison();
waitForFinish();
return errorState;
}
//TODO Why is this synchronized?
public synchronized void addJob(ByteBuilder bb){
// System.err.println("Got job "+(j.list==null ? "null" : j.list.size()));
assert(started) : "Wait for start() to return before using the writer.";
// while(!started || this.getState()==Thread.State.NEW){
// try {
// this.wait(20);
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
boolean success=false;
while(!success){
try {
queue.put(bb);
success=true;
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
assert(!queue.contains(bb)); //Hopefully it was not added.
}
}
}
/** Called after every write to the buffer */
private final void flushBuffer(boolean force){
final int x=buffer.length();
if(x>=maxLen || (force && x>0)){
addJob(buffer);
buffer=new ByteBuilder(initialLen);
}
}
/*--------------------------------------------------------------*/
/*---------------- Print ----------------*/
/*--------------------------------------------------------------*/
@Deprecated
/** Avoid using this if possible. */
public void print(CharSequence x){
if(verbose){System.err.println("Added line '"+x+"'");}
assert(open) : x;
buffer.append(x);
flushBuffer(false);
}
@Deprecated
/** Avoid using this if possible. */
public void print(StringBuilder x){
if(verbose){System.err.println("Added line '"+x+"'");}
assert(open) : x;
buffer.append(x);
flushBuffer(false);
}
@Deprecated
/** Avoid using this if possible. */
public void print(String x){
if(verbose){System.err.println("Added line '"+x+"'");}
assert(open) : x;
buffer.append(x);
flushBuffer(false);
}
public void print(int x){
if(verbose){System.err.println("Added line '"+(x)+"'");}
assert(open) : x;
buffer.append(x);
flushBuffer(false);
}
public void print(long x){
if(verbose){System.err.println("Added line '"+(x)+"'");}
assert(open) : x;
buffer.append(x);
flushBuffer(false);
}
public void print(float x){
if(verbose){System.err.println("Added line '"+(x)+"'");}
assert(open) : x;
buffer.append(x);
flushBuffer(false);
}
public void print(double x){
if(verbose){System.err.println("Added line '"+(x)+"'");}
assert(open) : x;
buffer.append(x);
flushBuffer(false);
}
public void print(byte x){
if(verbose){System.err.println("Added line '"+((char)x)+"'");}
assert(open) : ((char)x);
buffer.append(x);
flushBuffer(false);
}
public void print(char x){
if(verbose){System.err.println("Added line '"+(x)+"'");}
assert(open) : (x);
buffer.append(x);
flushBuffer(false);
}
public void print(byte[] x){
if(verbose){System.err.println("Added line '"+new String(x)+"'");}
assert(open) : new String(x);
buffer.append(x);
flushBuffer(false);
}
public void print(char[] x){
if(verbose){System.err.println("Added line '"+new String(x)+"'");}
assert(open) : new String(x);
buffer.append(x);
flushBuffer(false);
}
public void print(ByteBuilder x){
if(verbose){System.err.println("Added line '"+x+"'");}
assert(open) : x;
buffer.append(x);
flushBuffer(false);
}
public void print(ByteBuilder x, boolean destroy){
if(!destroy || buffer.length()>0){print(x);}
else{
if(verbose){System.err.println("Added line '"+x+"'");}
assert(open) : x;
addJob(x);
}
}
public void print(Read r){
assert(!OTHER);
ByteBuilder x=(FASTQ ? r.toFastq(buffer) : FASTA ? r.toFasta(FASTA_WRAP, buffer) : SAM ? r.toSam(buffer) :
SITES ? r.toSitesB(buffer) : INFO ? r.toInfoB(buffer) : r.toText(true, buffer));
flushBuffer(false);
}
public void printKmer(long kmer, int count, int k){
AbstractKmerTable.toBytes(kmer, count, k, buffer);
flushBuffer(false);
}
public void printKmer(long kmer, int[] values, int k){
AbstractKmerTable.toBytes(kmer, values, k, buffer);
flushBuffer(false);
}
public void printKmer(long[] array, int count, int k){
AbstractKmerTableU.toBytes(array, count, k, buffer);
flushBuffer(false);
}
public void printKmer(long[] array, int[] values, int k){
AbstractKmerTableU.toBytes(array, values, k, buffer);
flushBuffer(false);
}
/*--------------------------------------------------------------*/
/*---------------- Println ----------------*/
/*--------------------------------------------------------------*/
public void println(){print('\n');}
public void println(CharSequence x){print(x); print('\n');}
public void println(String x){print(x); print('\n');}
public void println(StringBuilder x){print(x); print('\n');}
public void println(int x){print(x); print('\n');}
public void println(long x){print(x); print('\n');}
public void println(float x){print(x); print('\n');}
public void println(double x){print(x); print('\n');}
public void println(byte x){print(x); print('\n');}
public void println(char x){print(x); print('\n');}
public void println(byte[] x){print(x); print('\n');}
public void println(char[] x){print(x); print('\n');}
public void println(ByteBuilder x){print(x); print('\n');}
public void println(ByteBuilder x, boolean destroy){
if(destroy){print(x.append('\n'));}else{print(x); print('\n');}
}
public void printlnKmer(long kmer, int count, int k){printKmer(kmer, count, k); print('\n');}
public void printlnKmer(long kmer, int[] values, int k){printKmer(kmer, values, k); print('\n');}
public void printlnKmer(long[] array, int count, int k){printKmer(array, count, k); print('\n');}
public void printlnKmer(long[] array, int[] values, int k){printKmer(array, values, k); print('\n');}
public void println(Read r){print(r); print('\n');}
public void println(Read r, boolean paired){
println(r);
if(paired && r.mate!=null){println(r.mate);}
}
/*--------------------------------------------------------------*/
/*---------------- Fields ----------------*/
/*--------------------------------------------------------------*/
private ByteBuilder buffer;
public int initialLen=36000;
public int maxLen=32768;
public final boolean overwrite;
public final boolean append;
public final boolean allowSubprocess;
public final String fname;
private final OutputStream outstream;
private final ArrayBlockingQueue<ByteBuilder> queue;
private boolean open=true;
private volatile boolean started=false;
/** TODO */
public boolean errorState=false;
/*--------------------------------------------------------------*/
private final boolean BAM;
private final boolean SAM;
private final boolean FASTQ;
private final boolean FASTA;
private final boolean BREAD;
private final boolean SITES;
private final boolean INFO;
private final boolean OTHER;
private final int FASTA_WRAP=Shared.FASTA_WRAP;
/*--------------------------------------------------------------*/
// private static final ByteBuilder POISON=new ByteBuilder("POISON_ByteStreamWriter");
private static final ByteBuilder POISON2=new ByteBuilder(1);
public static boolean verbose=false;
}
| [
"lundgren.am@gmail.com"
] | lundgren.am@gmail.com |
78855723a3ad4d5a38aaa9d976da5575d90114a5 | 4eea13dc72e0ff8ec79c7a94deca38e55868b603 | /chapter14/SweetShop.java | 20971cf6fa189c04458959902ca99006b19a7b84 | [
"Apache-2.0"
] | permissive | helloShen/thinkinginjava | 1a9bfad9afa68b226684f6e063e9fa2ae36d898c | 8986b74b2b7ea1753df33af84cd56287b21b4239 | refs/heads/master | 2021-01-11T20:38:09.259654 | 2017-03-07T03:52:54 | 2017-03-07T03:52:54 | 79,158,702 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 908 | java | /**
* Exercise 7
*/
package com.ciaoshen.thinkinjava.chapter14;
import java.util.*;
class Candy {
static { System.out.println("Loading Candy"); }
}
class Gum {
static { System.out.println("Loading Gum"); }
}
class Cookie {
static { System.out.println("Loading Cookie"); }
}
public class SweetShop {
public static void main(String[] args) {
try {
Class<?> c=Class.forName(args[0]);
Object o=c.newInstance();
} catch(ClassNotFoundException cne) {
System.out.println("Couldn’t find this Class! Please check your name!");
} catch(InstantiationException ie) {
System.out.println("Error during init of object! Must have a default constructor!");
} catch(IllegalAccessException iae){
System.out.println("Error during init of object! Please check the accessibility of constructor!");
}
}
} | [
"symantec__@hotmail.com"
] | symantec__@hotmail.com |
d857b48b5948ff14bf6280e527e7eb35aaba9eec | bc9d1818644c31454bfe7fa4664d208fa71e45f8 | /src/main/java/com/Projeto1/Projeto/DigitalInnovatio1/model/Movimentacao.java | 5f0d469b695d8c6a4e469110d545aff980412bbc | [] | no_license | rcf062/Projeto-DigitalInnovation1 | 04f9ca8ad3e41cdc7be2d7af400c7ebae14c3e1f | a4e243e2002fb1baa705a0ae1185759f90371fb1 | refs/heads/master | 2023-06-21T06:45:38.426816 | 2021-08-12T01:21:19 | 2021-08-12T01:21:19 | 395,158,524 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 857 | java | package com.Projeto1.Projeto.DigitalInnovatio1.model;
import lombok.*;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
@Builder
public class Movimentacao {
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
@Embeddable
public class MovimentacaoId implements Serializable{
private long idMovimento;
private long idUsuario;
}
@EmbeddedId
private MovimentacaoId id;
private LocalDateTime dataEntrada;
private LocalDateTime dataSaida;
private BigDecimal periodo;
private Ocorrencia ocorrencia;
private Calendario calendario;
}
| [
"roberta_6290@hotmail.com"
] | roberta_6290@hotmail.com |
69ae52e1194494393680b21759df6bf0ab17898f | abc7e2b2a4f4f835b5bc695dd8087e1c8c1199df | /pankaj/SparkExamples/transent/src/com/verifone/isd/vsms2/sales/ent/popsiteinfo/package-info.java | 9fde6a7c23c371d72478032eb2dd4abe7cf5f651 | [] | no_license | katpb/spark-mongo-test | db54e83f94fc8f4d7638ea0838742331711025ed | 4489ae3315dafc828ec5fbeefd3257bc2252be8c | refs/heads/master | 2023-04-28T15:34:31.788929 | 2020-07-19T17:49:46 | 2020-07-19T17:49:46 | 268,293,363 | 0 | 2 | null | 2023-04-21T20:44:21 | 2020-05-31T14:09:23 | Java | UTF-8 | Java | false | false | 113 | java | /**
* Entity classes for pop site information
*
*/
package com.verifone.isd.vsms2.sales.ent.popsiteinfo; | [
"PankajM2@verifone.com"
] | PankajM2@verifone.com |
69659ba08db69299178657277fd4b28b25dd0431 | 41ae950b46036a9ebe6a221fcc0a23601bfbf190 | /LeetCode/src/utils/TopKPriorityQueue.java | 4bc4e9616c639e96cf1c9304addfea1bd5cfa4fa | [] | no_license | yuruiyin/AlgorithmLearn | f7a88a499d050fa9c5d666514a74de0f0a56d001 | 4224b664e6d05f233512f77088f6d1437a87cd97 | refs/heads/master | 2023-07-08T09:19:41.101604 | 2023-07-03T01:48:08 | 2023-07-03T01:48:08 | 143,147,502 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,350 | java | package utils;
import java.util.*;
public class TopKPriorityQueue<E extends Comparable> {
private PriorityQueue<E> queue;
private int K;
public TopKPriorityQueue(int maxSize) {
if (maxSize < 1) {
throw new IllegalArgumentException();
}
this.K = maxSize;
// o2.compareTo(o1)说明建立小顶堆
this.queue = new PriorityQueue<>(maxSize, (o1, o2) -> o2.compareTo(o1));
}
public TopKPriorityQueue(int maxSize, Comparator<? super E> comparator) {
if (maxSize < 1) {
throw new IllegalArgumentException();
}
this.K = maxSize;
this.queue = new PriorityQueue<>(maxSize, comparator);
}
public void add(E e) {
if (queue.size() < K) {
// 未达到最大容量,直接添加
queue.add(e);
} else {
// 队列已满
E peek = queue.peek();
if (e.compareTo(peek) < 0) { // 说明要插入的
queue.poll();
queue.add(e);
}
}
}
public E poll() {
return queue.poll();
}
public boolean isEmpty() {
return queue.isEmpty();
}
public List<E> sortedList() {
List<E> list = new ArrayList<>(queue);
Collections.sort(list);
return list;
}
}
| [
"yuruiyin@cyou-inc.com"
] | yuruiyin@cyou-inc.com |
af4fe2be6edd66ac13aff42370b59dc7e04cf491 | 85f26a4cc2259b15b12c0b6a5bc0fd4292de192b | /learnMybatis/LearnMybits/src/cn/java/dao/impl/OneToOneImpl.java | 24bb79684a75c8e35ce7c5e54a83156c8272382a | [] | no_license | UnbeatableHacker/SSM | 893f3b1ce5b4074d0b4c4957058a72f710b221c4 | 3f5fbc69ec1f1076adb89d4e92cb43673e2fd351 | refs/heads/master | 2021-01-04T05:21:21.054988 | 2020-02-20T07:22:45 | 2020-02-20T07:22:45 | 240,405,229 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,298 | java | /**
* Project Name:LearnMybits
* File Name:oneToOneImpl.java
* Package Name:cn.java.dao.impl
* Date:2020年2月15日下午12:13:11
* Copyright (c) 2020, bluemobi All Rights Reserved.
*
*/
package cn.java.dao.impl;
import java.io.IOException;
import java.io.InputStream;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Before;
import org.junit.Test;
import cn.java.entity.Husband;
/**
* Description: <br/>
* Date: 2020年2月15日 下午12:13:11 <br/>
*
* @author songXZ
* @version
* @see
*/
public class OneToOneImpl {
SqlSession session = null;
@Before
public void init() throws IOException {
SqlSessionFactoryBuilder ssfb = new SqlSessionFactoryBuilder();
InputStream ins = Resources.getResourceAsStream("mybatis.xml");
SqlSessionFactory factory = ssfb.build(ins);
session = factory.openSession();
}
/**
*
* Description: 一对一对应<br/>
*
* @author songXZ
*/
@Test
public void oneToOne() {
Husband hus1 = session.selectOne("cn.java.dao.impl.OneToOneImpl.oneToOne", 1L);
System.out.println(hus1);
}
}
| [
"1131347811@qq.com"
] | 1131347811@qq.com |
43acee6528fd784a702fc646096d13e7280ac80c | f5748681631f5685a9d8a1bcc8b757ce39f3bdd2 | /src/com/base/model/AssetUser.java | f3b96d55a40bf454b9e2762075d66c224524b9dd | [] | no_license | AlexanderChou/neteye | a573e921f8868aa2420956993451037e98dbcf9a | 772f40477251477f6b865bc2c13ff4ec30237061 | refs/heads/master | 2021-01-13T00:49:13.397622 | 2016-05-08T07:31:31 | 2016-05-08T07:31:31 | 54,363,134 | 1 | 1 | null | 2016-03-31T07:43:08 | 2016-03-21T05:50:11 | Java | UTF-8 | Java | false | false | 921 | java | package com.base.model;
public class AssetUser extends BaseEntity{
private String userName;
private String userEmail;
private String userMobile;
private String userTel;
private String userDepart;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserEmail() {
return userEmail;
}
public void setUserEmail(String userEmail) {
this.userEmail = userEmail;
}
public String getUserMobile() {
return userMobile;
}
public void setUserMobile(String userMobile) {
this.userMobile = userMobile;
}
public String getUserTel() {
return userTel;
}
public void setUserTel(String userTel) {
this.userTel = userTel;
}
public String getUserDepart() {
return userDepart;
}
public void setUserDepart(String userDepart) {
this.userDepart = userDepart;
}
}
| [
"290573449@qq.com"
] | 290573449@qq.com |
9dc70a9d06b7735acf288ac5f59d09302d22d0d6 | 7590fdbb0630b51f21c6c75eb7bce5011edaf735 | /src/edu/ucla/cens/mobilize/client/model/UserSearchData.java | 0cb48f4956a1cb467a4b8eaae74a5479d5f96a62 | [] | no_license | VijayEluri/gwt-front-end | e1b034c5c7a4ac601bdc0f00ea1fee8a00302019 | c67986ce1096315a7a81ff2b7064f0af266cf944 | refs/heads/master | 2020-05-20T11:03:11.493992 | 2015-12-16T15:41:33 | 2015-12-16T15:41:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,007 | java | package edu.ucla.cens.mobilize.client.model;
import java.util.ArrayList;
import java.util.List;
import edu.ucla.cens.mobilize.client.dataaccess.requestparams.UserSearchParams;
/**
* Use this class to store UserSearchInfo objects and metadata when fetching
* users from the server a page at a time.
*/
public class UserSearchData {
private List<UserSearchInfo> userSearchInfos;
private int totalUsers = 0;
private int startIndex = 0;
public void setUserSearchInfo(int startIndex, List<UserSearchInfo> userSearchInfos) {
this.userSearchInfos = new ArrayList<UserSearchInfo>(userSearchInfos);
this.startIndex = startIndex;
}
public void setTotalUserCount(int count) {
this.totalUsers = count;
}
public int getTotalUserCount() {
return this.totalUsers;
}
public int getStartIndex() {
return this.startIndex;
}
public List<UserSearchInfo> getUserSearchInfos() {
return this.userSearchInfos;
}
// TODO: delete or mark enabled/disabled
}
| [
"vhajdik@ucla.edu"
] | vhajdik@ucla.edu |
32e73ce3623dfd65a861393169f413d8cb7ae3c4 | 13b7c274ceee0095815feb7435182ef069ea2b5a | /src/newgui/gui/display/primaryDisplay/loggerVizualizer/PopSizeViz.java | 7902686b0e9ec62de2483495e0a1212bc813693e | [] | no_license | brendanofallon/ACG | c207ec2be82da7a93a8bd0afc512b142b0915d77 | 7fb94c2ae8ff7d4cacc33ebac3652469dcc3155a | refs/heads/master | 2021-01-15T11:18:32.507986 | 2013-11-27T20:01:39 | 2013-11-27T20:01:39 | 2,086,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,808 | java | package newgui.gui.display.primaryDisplay.loggerVizualizer;
import gui.figure.TextElement;
import gui.figure.series.ConstSizeSeries;
import gui.figure.series.XYSeriesElement;
import java.awt.Color;
import logging.PopSizeLogger;
import logging.RootHeightDensity;
public class PopSizeViz extends AbstractLoggerViz {
@Override
public void initialize() {
this.popSizeLogger = (PopSizeLogger)logger;
burninMessage = new TextElement("Burnin period (" + logger.getBurnin() + ") not exceeded", seriesFig);
burninMessage.setPosition(0.45, 0.5);
seriesFig.addElement(burninMessage);
seriesFig.setXLabel("Time in past (subs. / site)");
seriesFig.setYLabel("Scaled population size");
}
@Override
public String getDataString() {
String data = logger.getSummaryString();
return data;
}
@Override
public void update() {
if (burninMessage != null && logger.getBurninExceeded()) {
seriesFig.removeElement(burninMessage);
burninMessage = null;
}
if (logger.getBurninExceeded()) {
seriesFig.inferBoundsFromCurrentSeries();
if (meanSeries == null) {
meanSeries = new ConstSizeSeries("Mean size", popSizeLogger.getMeans(), popSizeLogger.getBinPositions() );
XYSeriesElement meanEl = new XYSeriesElement(meanSeries, seriesFig.getAxes(), seriesFig);
meanEl.setLineColor(Color.blue);
meanEl.setLineWidth((float) 1.5);
meanEl.setCanConfigure(true);
seriesFig.addSeriesElement(meanEl);
}
meanSeries.setYVals(popSizeLogger.getMeans());
if (upper95Series == null && popSizeLogger.getHistoTriggerReached()) {
upper95Series = new ConstSizeSeries("Upper 95%", popSizeLogger.getUpper95s(), popSizeLogger.getBinPositions() );
XYSeriesElement upperEl = new XYSeriesElement(upper95Series, seriesFig.getAxes(), seriesFig);
upperEl.setLineColor(Color.blue);
upperEl.setLineWidth(0.75f);
upperEl.setCanConfigure(true);
seriesFig.addSeriesElement(upperEl);
}
if (lower95Series == null && popSizeLogger.getHistoTriggerReached()) {
lower95Series = new ConstSizeSeries("Lower 95%", popSizeLogger.getLower95s(), popSizeLogger.getBinPositions() );
XYSeriesElement lowerEl = new XYSeriesElement(lower95Series, seriesFig.getAxes(), seriesFig);
lowerEl.setLineColor(Color.blue);
lowerEl.setLineWidth(0.75f);
lowerEl.setCanConfigure(true);
seriesFig.addSeriesElement(lowerEl);
}
if (upper95Series != null)
upper95Series.setYVals(popSizeLogger.getUpper95s());
if (lower95Series != null) {
lower95Series.setYVals(popSizeLogger.getLower95s());
}
}
seriesFig.repaint();
}
private ConstSizeSeries upper95Series;
private ConstSizeSeries lower95Series;
private ConstSizeSeries meanSeries;
private PopSizeLogger popSizeLogger;
private TextElement burninMessage;
}
| [
"brendanofallon@fastmail.fm"
] | brendanofallon@fastmail.fm |
9ea2ff22f2ea350fb8c25e99fcfea45e42f47a71 | 7a336d109e866e128abe483de73c4816f3776394 | /BHANDARI_BIDHAN_CPU_Sched.java | 642fc7962647bde4a538be6b2056315912eefee4 | [] | no_license | bhandab/Scheduling-Algorithms-Implementations | d1d5eaf374a766b5254a789254418526fbcad595 | a6b4ab71d6646ed4352aac8b400021d943594821 | refs/heads/master | 2021-04-15T16:37:51.735467 | 2018-03-26T12:50:45 | 2018-03-26T12:50:45 | 126,828,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,326 | java | import java.util.*;
import java.io.*;
public class BHANDARI_BIDHAN_CPU_Sched {
public static void main(String[] args){
ArrayList<BHANDARI_BIDHAN_PROCESS> jobs = new ArrayList<BHANDARI_BIDHAN_PROCESS>();
//BHANDARI_BIDHAN_PROCESS process;
String algorithm = "";
try{
Scanner in = new Scanner(new FileInputStream("in.txt"));
String firstLine = in.nextLine();
Scanner algoInfo = new Scanner(firstLine);
algoInfo.next();
algorithm = algoInfo.next();
algoInfo.close();
while(in.hasNext()){
String line = in.nextLine();
Scanner info = new Scanner(line);
info.next();
int pid = Integer.parseInt(info.next());
int arrivalTime = Integer.parseInt(info.next());
int cBurst = Integer.parseInt(info.next());
if (!algorithm.equals("pnp")){
jobs.add(new BHANDARI_BIDHAN_PROCESS(pid, arrivalTime,cBurst));
}
else{
int priority = Integer.parseInt(info.next());
jobs.add(new BHANDARI_BIDHAN_PROCESS(pid, arrivalTime, cBurst, priority));
}
info.close();
}
in.close();
}
catch(FileNotFoundException e){
System.out.println("File Not Found");
}
BHANDARI_BIDHAN_ALGORITHMS schedular = new BHANDARI_BIDHAN_ALGORITHMS(algorithm+"_out.txt",algorithm);
schedular.scheduleProcesses(jobs);
}
}
| [
"noreply@github.com"
] | bhandab.noreply@github.com |
179cca5c4c7aa31068efdacd39a571be7daf0678 | c9c043bd7f834b927aef8b84149d8e11dd19bf4d | /subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/resolveengine/artifact/ResolvedArtifactSet.java | a0f8a9e71d44286091868b40757d943867acee4c | [
"MIT",
"LGPL-2.1-only",
"Apache-2.0",
"CPL-1.0"
] | permissive | Magic-BuShe/Gradle | 93042f51d0b2b5b5d48abc6906e5f249a8706d40 | c73716667f7ad7a5d6c28eb089cfe831ee0ddd55 | refs/heads/am-components | 2021-07-04T12:03:55.227065 | 2016-11-29T03:51:44 | 2016-11-29T03:51:44 | 205,403,912 | 0 | 0 | Apache-2.0 | 2020-12-09T19:19:01 | 2019-08-30T14:59:52 | Java | UTF-8 | Java | false | false | 2,259 | java | /*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact;
import org.gradle.api.artifacts.ResolvedArtifact;
import org.gradle.api.specs.Spec;
import org.gradle.api.tasks.TaskDependency;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
/**
* A container for a set of files or artifacts. May or may not be immutable, and may require building and further resolution.
*/
public interface ResolvedArtifactSet {
/**
* Selects a subset of the artifacts of this set, and _all_ of the files (if any). Implementation may be eager or lazy, so the spec should be immutable.
*/
ResolvedArtifactSet select(Spec<? super ResolvedArtifact> artifactSpec);
/**
* Returns the resolved artifacts in this set, if any.
*/
Set<ResolvedArtifact> getArtifacts();
/**
* Collects the build dependencies required to build the artifacts in this set.
*/
void collectBuildDependencies(Collection<? super TaskDependency> dest);
/**
* Visits the contents of this set.
*/
void visit(ArtifactVisitor visitor);
ResolvedArtifactSet EMPTY = new ResolvedArtifactSet() {
@Override
public ResolvedArtifactSet select(Spec<? super ResolvedArtifact> artifactSpec) {
return this;
}
@Override
public Set<ResolvedArtifact> getArtifacts() {
return Collections.emptySet();
}
@Override
public void collectBuildDependencies(Collection<? super TaskDependency> dest) {
}
@Override
public void visit(ArtifactVisitor visitor) {
}
};
}
| [
"adam@gradle.com"
] | adam@gradle.com |
fd27facd66b9f752389bcd57757148e7cbbd1b79 | d7f62a02d4ef848206ae3ca64e2cd28a503e6cb8 | /xunxin/xunxin.core/src/main/java/com/xunxin/dao/impl/app/UserBrushAgainstRecordDaoImpl.java | db29a367858aaba28546a861b586c0e1cfc2d8db | [
"Apache-2.0"
] | permissive | zhiji6/xunxin | 9644e3496819a753c75336a12bc7c7055f0f891f | 7e241691c9a6428fd0d66dfb111d4a3c6608d1ac | refs/heads/master | 2020-05-17T06:33:40.642931 | 2018-02-08T11:35:11 | 2018-02-08T11:35:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package com.xunxin.dao.impl.app;
import org.mongodb.framework.dao.GeneralDaoImpl;
import org.springframework.stereotype.Repository;
import com.xunxin.dao.square.UserBrushAgainstRecordDao;
import com.xunxin.vo.square.UserBrushAgainstRecord;
@Repository
public class UserBrushAgainstRecordDaoImpl extends GeneralDaoImpl<UserBrushAgainstRecord> implements UserBrushAgainstRecordDao{
@Override
protected Class<UserBrushAgainstRecord> getEntityClass() {
return UserBrushAgainstRecord.class;
}
}
| [
"noseparte@aliyun.com"
] | noseparte@aliyun.com |
00700224ad2e99c002f9249a52e5124f9c1fe560 | 9539e7142eb7ec92d2a94239070e81283eb5476e | /score-http/score-service/src/main/java/org/oagi/score/service/businesscontext/ContextSchemeService.java | 5c21da662110548c98fcebf24867b83e4a872237 | [
"MIT"
] | permissive | OAGi/Score | 4040b1fe508bc17e853755d72c4f363d5f4cc97b | 36f9f65bcc51b6764cb5ec5919dbc96cf9f987d9 | refs/heads/master | 2023-08-31T03:59:58.456923 | 2023-08-28T02:37:11 | 2023-08-28T02:37:11 | 20,700,485 | 8 | 9 | MIT | 2023-08-28T02:37:12 | 2014-06-10T20:27:01 | Java | UTF-8 | Java | false | false | 4,207 | java | package org.oagi.score.service.businesscontext;
import org.jooq.Condition;
import org.jooq.DSLContext;
import org.jooq.types.ULong;
import org.oagi.score.repo.api.ScoreRepositoryFactory;
import org.oagi.score.repo.api.businesscontext.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import static org.jooq.impl.DSL.and;
import static org.jooq.impl.DSL.trueCondition;
import static org.oagi.score.repo.api.impl.jooq.entity.Tables.CTX_SCHEME;
@Service
@Transactional(readOnly = true)
public class ContextSchemeService {
@Autowired
private ScoreRepositoryFactory scoreRepositoryFactory;
@Autowired
private DSLContext dslContext;
public GetContextSchemeListResponse getContextSchemeList(GetContextSchemeListRequest request) {
GetContextSchemeListResponse response =
scoreRepositoryFactory.createContextSchemeReadRepository()
.getContextSchemeList(request);
return response;
}
public GetContextSchemeValueListResponse getContextSchemeValueList(GetContextSchemeValueListRequest request) {
GetContextSchemeValueListResponse response =
scoreRepositoryFactory.createContextSchemeReadRepository()
.getContextSchemeValueList(request);
return response;
}
public GetContextSchemeResponse getContextScheme(GetContextSchemeRequest request) {
GetContextSchemeResponse response =
scoreRepositoryFactory.createContextSchemeReadRepository()
.getContextScheme(request);
return response;
}
@Transactional
public CreateContextSchemeResponse createContextScheme(CreateContextSchemeRequest request) {
CreateContextSchemeResponse response =
scoreRepositoryFactory.createContextSchemeWriteRepository()
.createContextScheme(request);
return response;
}
@Transactional
public UpdateContextSchemeResponse updateContextScheme(UpdateContextSchemeRequest request) {
UpdateContextSchemeResponse response =
scoreRepositoryFactory.createContextSchemeWriteRepository()
.updateContextScheme(request);
return response;
}
@Transactional
public DeleteContextSchemeResponse deleteContextScheme(DeleteContextSchemeRequest request) {
DeleteContextSchemeResponse response =
scoreRepositoryFactory.createContextSchemeWriteRepository()
.deleteContextScheme(request);
return response;
}
public boolean hasSameCtxScheme(ContextScheme contextScheme) {
Condition idMatch = trueCondition();
if (contextScheme.getContextSchemeId() != null) {
idMatch = CTX_SCHEME.CTX_SCHEME_ID.notEqual(ULong.valueOf(contextScheme.getContextSchemeId()));
}
return dslContext.selectCount().from(CTX_SCHEME).where(
and(CTX_SCHEME.SCHEME_ID.eq(contextScheme.getSchemeId()),
CTX_SCHEME.SCHEME_AGENCY_ID.eq(contextScheme.getSchemeAgencyId()),
CTX_SCHEME.SCHEME_VERSION_ID.eq(contextScheme.getSchemeVersionId()),
idMatch))
.fetchOneInto(Integer.class) > 0;
}
public boolean hasSameCtxSchemeName(ContextScheme contextScheme) {
Condition idMatch = trueCondition();
if (contextScheme.getContextSchemeId() != null) {
idMatch = CTX_SCHEME.CTX_SCHEME_ID.notEqual(ULong.valueOf(contextScheme.getContextSchemeId()));
}
return dslContext.selectCount().from(CTX_SCHEME).where(
and(CTX_SCHEME.SCHEME_ID.eq(contextScheme.getSchemeId()),
CTX_SCHEME.SCHEME_AGENCY_ID.eq(contextScheme.getSchemeAgencyId()),
CTX_SCHEME.SCHEME_VERSION_ID.notEqual(contextScheme.getSchemeVersionId()),
CTX_SCHEME.SCHEME_NAME.notEqual(contextScheme.getSchemeName()),
idMatch))
.fetchOneInto(Integer.class) > 0;
}
}
| [
"hakju.oh@gmail.com"
] | hakju.oh@gmail.com |
9914caabcc6af5eb454917e56f330f002ea6ab84 | f33738b4d75ecb202b9299018b3ce52b03a20c89 | /src/main/java/com/github/saphyra/randwo/key/service/KeyQueryService.java | 806f6509b19753f960f38a8c5d94b182e90d94b8 | [] | no_license | Saphyra/rand_wo | db84c825e16bef1d5209a16fc83ea6a3d46a17ee | 2183418a3339edf6c4f3de35747c2263b93d9d7d | refs/heads/master | 2022-05-07T02:04:30.078645 | 2019-07-02T21:24:33 | 2019-07-02T21:24:33 | 188,692,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,475 | java | package com.github.saphyra.randwo.key.service;
import static java.util.Objects.isNull;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import org.springframework.stereotype.Service;
import com.github.saphyra.exceptionhandling.domain.ErrorMessage;
import com.github.saphyra.exceptionhandling.exception.BadRequestException;
import com.github.saphyra.exceptionhandling.exception.NotFoundException;
import com.github.saphyra.randwo.common.CollectionValidator;
import com.github.saphyra.randwo.common.ErrorCode;
import com.github.saphyra.randwo.key.domain.Key;
import com.github.saphyra.randwo.key.repository.KeyDao;
import com.github.saphyra.randwo.mapping.itemlabel.domain.ItemLabelMapping;
import com.github.saphyra.randwo.mapping.itemlabel.repository.ItemLabelMappingDao;
import com.github.saphyra.randwo.mapping.itemvalue.domain.ItemValueMapping;
import com.github.saphyra.randwo.mapping.itemvalue.repository.ItemValueMappingDao;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class KeyQueryService {
private final CollectionValidator collectionValidator;
private final ItemLabelMappingDao itemLabelMappingDao;
private final ItemValueMappingDao itemValueMappingDao;
private final KeyDao keyDao;
public Key findByKeyIdValidated(UUID keyId) {
return keyDao.findById(keyId)
.orElseThrow(() -> new NotFoundException(new ErrorMessage(ErrorCode.KEY_NOT_FOUND.getErrorCode()), "Key not found with keyId " + keyId));
}
public List<Key> getAll() {
return keyDao.getAll();
}
public List<Key> getKeysForLabels(List<UUID> labelIds) {
if (isNull(labelIds)) {
throw new BadRequestException(new ErrorMessage(ErrorCode.NULL_LABEL_IDS.getErrorCode()), "labelIds is null.");
}
collectionValidator.validateDoesNotContainNull(labelIds, ErrorCode.NULL_IN_LABEL_IDS);
return labelIds.stream()
//Get item ids linked to labels
.flatMap(labelId -> itemLabelMappingDao.getByLabelId(labelId).stream())
.map(ItemLabelMapping::getItemId)
.distinct()
//Get key ids linked to items
.flatMap(itemId -> itemValueMappingDao.getByItemId(itemId).stream())
.map(ItemValueMapping::getKeyId)
.distinct()
//Get keys for keyIds
.map(this::findByKeyIdValidated)
.collect(Collectors.toList());
}
}
| [
"bernat_bonda@epam.com"
] | bernat_bonda@epam.com |
83199437617b19fee0f2cb00393ac2b771418b40 | b4cbd1530d17726847d8a0e1aedff07209d6df34 | /src/main/java/br/com/victor/king_donald/repository/PromotionRepository.java | b52a289b53e96edc87a85fb3cb5a44fd70a78e20 | [] | no_license | victorfconti/king_donald | b7fd4cb2f0fcc56975c1659e0226cce182e83da6 | 83c3d59b6c4db4985ff3737e6713d5ab16c4b770 | refs/heads/master | 2020-05-09T20:46:16.379850 | 2019-04-15T06:02:43 | 2019-04-15T06:02:43 | 181,420,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 240 | java | package br.com.victor.king_donald.repository;
import br.com.victor.king_donald.model.Promotion;
import org.springframework.data.jpa.repository.JpaRepository;
public interface PromotionRepository extends JpaRepository<Promotion, Long>{
}
| [
"victorfconti@gmail.com"
] | victorfconti@gmail.com |
7e58d3219a8a0e352c8b93fa267a5081edbeee8c | 0cf3caed17923af3bc6173512b9f235ed2f64488 | /old/final-decompiled/org/junit/internal/requests/ClassRequest.java | 65987595c4a85cd29b70ae195267abd4e3fefb87 | [] | no_license | KUR-creative/java-dodge | dbf1e3611e71b22c60ab60b9b57992b3ccb31b57 | 04b4ce1493a5048b5627c888c717afac4c28f014 | refs/heads/master | 2023-03-12T10:52:17.564965 | 2023-03-09T01:31:52 | 2023-03-09T01:31:52 | 249,699,488 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,115 | java | //
// Decompiled by Procyon v0.5.36
//
package org.junit.internal.requests;
import org.junit.internal.builders.AllDefaultPossibilitiesBuilder;
import org.junit.runner.Runner;
import org.junit.runner.Request;
public class ClassRequest extends Request
{
private final Object runnerLock;
private final Class<?> fTestClass;
private final boolean canUseSuiteMethod;
private volatile Runner runner;
public ClassRequest(final Class<?> testClass, final boolean canUseSuiteMethod) {
this.runnerLock = new Object();
this.fTestClass = testClass;
this.canUseSuiteMethod = canUseSuiteMethod;
}
public ClassRequest(final Class<?> testClass) {
this(testClass, true);
}
@Override
public Runner getRunner() {
if (this.runner == null) {
synchronized (this.runnerLock) {
if (this.runner == null) {
this.runner = new AllDefaultPossibilitiesBuilder(this.canUseSuiteMethod).safeRunnerForClass(this.fTestClass);
}
}
}
return this.runner;
}
}
| [
"rhdnfka94@gmail.com"
] | rhdnfka94@gmail.com |
90f77197e6010e821dd506c326fb4bffd2ed7184 | ad7de693421790ebb6eb85804e8873fefd5a5268 | /src/main/java/wx/whsyh/service/impl/ProductService.java | d93b883da3595ebb0ce886372e6122cbd5a786d1 | [] | no_license | cbh920/whsyh | 2e4e7765e11b8587a887bb61c4afeaffbe3faa2e | 3e53991977b80347d5f46e1f5c219ff01b351969 | refs/heads/master | 2020-04-19T08:43:43.554103 | 2016-09-22T14:47:59 | 2016-09-22T14:47:59 | 67,564,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,102 | java | package wx.whsyh.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import wx.basic.util.Page;
import wx.whsyh.dao.ProductDaoI;
import wx.whsyh.model.Product;
import wx.whsyh.service.ProductServiceI;
@Service("productService")
@Transactional
public class ProductService implements ProductServiceI {
private ProductDaoI productDao;
public ProductDaoI getProductDao() {
return productDao;
}
@Autowired
public void setProductDao(ProductDaoI productDao) {
this.productDao = productDao;
}
@Override
public Page<Product> findProducts(int currentPage,int pageSize) {
Page page = new Page();
int allCount = productDao.getAllCount();
int offset=page.countOffset(currentPage, pageSize);
List<Product> list = productDao.findProducts(offset, pageSize);
page.setPageNo(currentPage);
page.setPageSize(pageSize);
page.setTotalRecords(allCount);
page.setList(list);
return page;
}
@Override
public void addProduct(Product p) {
productDao.addProduct(p);
}
@Override
public void deleteProduct(Integer id) {
if(id!=null)
{
productDao.deleteProduct(id);
}
}
@Override
public List<Product> listByName(String name) {
return productDao.listByName(name);
}
@Override
public void updateProduct(Product p) {
productDao.updateProduct(p);
}
@Override
public Product listById(int id) {
return productDao.listById(id);
}
@Override
public List<Product> listTypeAndName(String name, String type) {
return productDao.listTypeAndName(name, type);
}
@Override
public List<Product> listByType(String type) {
return productDao.listByType(type);
}
@Override
public List<Product> listByWholeName(String name) {
return productDao.listByWholeName(name);
}
@Override
public List<Product> listByAppId(int id) {
return productDao.listByAppId(id);
}
}
| [
"Administrator@172.16.161.54"
] | Administrator@172.16.161.54 |
1c4fb40ba1a37dcc2edb31d5c101d61a20445b86 | 4909acde517b72743b1ec7de071b081adf107630 | /MD2K_PhoneFramework/src/org/md2k/phoneframework/services/sensors/ConnectionService.java | 3297036b8f8724522ff308ce176da96c6cc71feb | [] | no_license | monowar/MD2K | 527afddeaeeaf8c884deabeb27d36bb051ebf5c0 | af391ee192d697d3e1e1d592a95b82c3b79d801b | refs/heads/master | 2021-01-02T09:25:59.185770 | 2015-01-07T19:06:02 | 2015-01-07T19:06:02 | 28,326,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 914 | java | package org.md2k.phoneframework.services.sensors;
import org.md2k.phoneframework.logger.Log;
import org.md2k.phoneframework.services.sensors.autosense.AutoSenseChest;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
public class ConnectionService extends Service{
AutoSenseChest autosensechest;
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// TODO Auto-generated method stub
Log.d("ConnectionService","OnStartCommand");
autosensechest=new AutoSenseChest();
autosensechest.start();
return super.onStartCommand(intent, flags, startId);
}
@Override
public void onDestroy() {
Log.d("ConnectionService","OnDestroy");
autosensechest.shutdown();
DataQueue.getInstance().kill();
}
}
| [
"smhssain@memphis.edu"
] | smhssain@memphis.edu |
99e56e4a00fb0d6cabd8d9f45140705dc0a84ca2 | 44b8358090d8ac6eea3785aebba1854d622c74c6 | /MyApplication5/zhoumozuoye2/src/main/java/com/example/zhoumozuoye2/ThreeActivity.java | 439123c2697805ba6d04e959672b00428953fb06 | [] | no_license | ZhangDongJie-niubi/GitTiJiao | 2eda7fca680eb267ec503a488defa884a1dd9ce1 | 4e7c1d96d6a8130e9e7e7251583fb1db213e2d2a | refs/heads/master | 2020-09-13T22:09:54.625076 | 2019-11-20T10:59:19 | 2019-11-20T10:59:19 | 222,916,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,860 | java | package com.example.zhoumozuoye2;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
public class ThreeActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_three);
Toolbar tb = findViewById(R.id.tb);
DrawerLayout dl = findViewById(R.id.dl);
final LinearLayout ll = findViewById(R.id.ll);
tb.setTitle("ToolBar");
setSupportActionBar(tb);
ActionBarDrawerToggle abdt = new ActionBarDrawerToggle(ThreeActivity.this, dl, tb, R.string.oppen, R.string.close);
dl.addDrawerListener(abdt);
abdt.syncState();
dl.addDrawerListener(new DrawerLayout.DrawerListener() {
@Override
public void onDrawerSlide(@NonNull View view, float v) {
float v1 = view.getWidth() * v;
ll.setX(v1);
}
@Override
public void onDrawerOpened(@NonNull View view) {
}
@Override
public void onDrawerClosed(@NonNull View view) {
}
@Override
public void onDrawerStateChanged(int i) {
}
});
Fragmenta fragmenta = new Fragmenta();
List<Fragment> arr = new ArrayList<>();
arr.add(fragmenta);
TabLayout tl = findViewById(R.id.tl);
ViewPager vp = findViewById(R.id.vp);
Shi2 shi2 = new Shi2(getSupportFragmentManager(), arr);
vp.setAdapter(shi2);
tl.setupWithViewPager(vp);
tl.getTabAt(0).setText("項目").setIcon(R.drawable.a_selector);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.bbb, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.o:
Intent intent = new Intent(ThreeActivity.this,ForeActivity.class);
startActivity(intent);
Toast.makeText(this, "收藏成功", Toast.LENGTH_SHORT).show();
break;
}
return super.onOptionsItemSelected(item);
}
}
| [
"1004568219@qq.com"
] | 1004568219@qq.com |
6d0ebcfe58ede3d5e991f0db5b9b36191d6a8754 | 33c732e6a9fced963d6c9db96e92773330631687 | /src/main/java/com/think/creator/domain/ProcessResult.java | 5db0935f7e3c9287d005208fbf3b9784b53e61e7 | [] | no_license | Think-007/id_creator | 49d0d210f2453ea152a504a5eb0fb4425004bb1a | 8e38230145f371f3d72cd11c2b57c183e8ffd2dd | refs/heads/master | 2021-07-19T19:07:32.772696 | 2017-10-28T00:36:29 | 2017-10-28T00:36:29 | 108,120,602 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,867 | java | /*
* Copyright 2012 LPF All rights reserved.
*
* History:
* ------------------------------------------------------------------------------
* Date | Who | What
* 2017年10月26日 | LPF | create the file
*/
package com.think.creator.domain;
import java.util.Map;
/**
*
* 类简要描述
*
* <p>
* 类详细描述
* </p>
*
* @author LPF
*
*/
public class ProcessResult {
// 成功
public static final int SUCCESS = 0;
// 失败
public static final int FAILED = 1;
// 超时
public static final int TIME_OUT = 2;
// 调用结果状态 -1默认 0成功 1失败 2 超时
private int retCode = -1;
// 调用结果描述
private String retMsg;
// 返回对象信息
private Object retObj;
// 返回附加信息
private Map retMap;
// 失败后的返回失败码
private int errorCode;
// 失败描述
private String errorDesc;
public int getRetCode() {
return retCode;
}
public void setRetCode(int retCode) {
this.retCode = retCode;
}
public String getRetMsg() {
return retMsg;
}
public void setRetMsg(String retMsg) {
this.retMsg = retMsg;
}
public Object getRetObj() {
return retObj;
}
public void setRetObj(Object retObj) {
this.retObj = retObj;
}
public Map getRetMap() {
return retMap;
}
public void setRetMap(Map retMap) {
this.retMap = retMap;
}
public int getErrorCode() {
return errorCode;
}
public void setErrorCode(int errorCode) {
this.errorCode = errorCode;
}
public String getErrorDesc() {
return errorDesc;
}
public void setErrorDesc(String errorDesc) {
this.errorDesc = errorDesc;
}
@Override
public String toString() {
return "ProcessResult [retCode=" + retCode + ", retMsg=" + retMsg + ", retObj=" + retObj + ", retMap=" + retMap
+ ", errorCode=" + errorCode + ", errorDesc=" + errorDesc + "]";
}
}
| [
"wylipengfei@163.com"
] | wylipengfei@163.com |
a0ee1aaa6c2db47a94a6674688242b0aacde03c8 | 75b261bea60b5fd6f4081d226b50ba19d249caba | /src/main/java/com/huicai/vueblog/config/MybatisPlusConfig.java | b6afb73790abd3867031be860427324c21420fca | [] | no_license | huangyanfang-666/vueblog01 | 2d3c7c2f067875dea321ecaac739ee0326fc1867 | 26f0ad7fe28a229e5d4e49d97db5609d9d812406 | refs/heads/master | 2022-11-17T01:25:45.400003 | 2020-07-13T06:30:29 | 2020-07-13T06:30:29 | 278,592,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 667 | java | package com.huicai.vueblog.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableTransactionManagement
@MapperScan("com.huicai.vueblog.mapper")
public class MybatisPlusConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
return paginationInterceptor;
}
}
| [
"850410056@qq.com"
] | 850410056@qq.com |
30e2b37ed0cc0ef865d1abae159b93d18f6df18c | f36a40dae1714c387ef14b99dd5d1ecece02bbea | /app/src/test/java/com/example/traig/sqlitetuts/ExampleUnitTest.java | cdfe8c1806f7ae9e9a7b4d444445289ddc054c50 | [] | no_license | taidev198/SqliteTuts | c14d64b3335e2b0f2c8eb2832eb4b8f0e632a045 | 7355ab5c8a1bcaad6959bec4fcec9bcc03ed3aea | refs/heads/master | 2021-05-04T15:37:26.295415 | 2018-02-04T23:50:01 | 2018-02-04T23:50:01 | 120,234,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package com.example.traig.sqlitetuts;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"traigiuxom9x@gmail.com"
] | traigiuxom9x@gmail.com |
87faa82619d90e4038c2b83aed675b18f2db90c2 | 3d7d658f0d95d19eae9ee94bf6f339a33e0b7679 | /lucas-services/src/main/java/com/lucas/exception/InvalidConfigurationException.java | 483699e3701eb11212ac2f6a4b114bca71ca8a19 | [] | no_license | goverdhan1/lucasware | a3a6c2e898c7f3d413628c1dc97bfb328a75ccc3 | fc59d862afd62cab0098ebe99ed5f8b604a87c35 | refs/heads/master | 2021-01-10T10:52:14.222460 | 2015-11-29T17:28:43 | 2015-11-29T17:28:43 | 47,071,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 488 | java | package com.lucas.exception;
public class InvalidConfigurationException extends RuntimeException {
private static final long serialVersionUID = 6478075679840136372L;
public InvalidConfigurationException() {
super();
}
public InvalidConfigurationException(String message) {
super(message);
}
public InvalidConfigurationException(Throwable cause) {
super(cause);
}
public InvalidConfigurationException(String message, Throwable cause) {
super(message, cause);
}
}
| [
"goverdhan.k@gmail.com"
] | goverdhan.k@gmail.com |
898db0435db902d1276ae628579523affcafaef1 | 938bc0f614cc5d5bb2d84a9d33efec8134d8a8ee | /pages.impl/com/iad/fs/sdissuer/pages/ProcessAcquirerResponseImpl.java | c1c9f1bfc4d6d116f979f071dc55a14d1a079e67 | [] | no_license | vamsikuppa/Selenium-SmartDispute | a761e2fd4620768b2e89f1482d0201ef26aeddba | c16b8b36adadeb10425341ce3312a68a4a7b602a | refs/heads/master | 2020-12-02T11:05:19.613527 | 2017-07-08T05:22:14 | 2017-07-08T05:22:14 | 96,597,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,932 | java | package com.iad.fs.sdissuer.pages;
import com.pega.iad.utils.DataTableUtils;
import com.pega.iad.utils.IADUtils;
import com.pega.ri.Wizard;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import java.util.Map;
public class ProcessAcquirerResponseImpl extends SDWorkObjectPageImpl implements ProcessAcquirerResponse {
private Wizard wizard;
public ProcessAcquirerResponseImpl(WebElement elmt, String elmtId) {
super(elmt, elmtId);
// TODO Auto-generated constructor stub
}
@Override
public void takeInitPreArbAction() {
// TODO Auto-generated method stub
findElement(INITIATE_PREARBITRATION_RADIO).click();
findElement(SUBMIT_BUTTON).click();
}
@Override
public InitPreArb getInitPreArb() {
wizard = pegaDriver.findWizard(pegaDriver.getActiveFrameId(false));
InitPreArb stage = new InitPreArbImpl(wizard, wizard.getId());
stage._setEnvironment(testEnv, wizard.getId());
return stage;
}
@Override
public void processAcceptFullAcquirerResponse(Map<String, String> respdetails) {
Assert.assertTrue(verifyElement(IADUtils.parameterizeBy(ACQUIRERRESPONSE_IND, DataTableUtils.getDataTableValue(respdetails, "Acquirer response"))));
findElement(SUBMIT_BUTTON).click();
}
@Override
public void processAcceptPartialCHLiableAcquirerResponse(Map<String, String> respdetails) {
Assert.assertTrue(verifyElement(IADUtils.parameterizeBy(ACQUIRERRESPONSE_IND, DataTableUtils.getDataTableValue(respdetails, "Acquirer response"))));
takeChLiableAction();
}
@Override
public void processAcceptPartialWOAcquirerResponse(Map<String, String> respdetails) {
Assert.assertTrue(verifyElement(IADUtils.parameterizeBy(ACQUIRERRESPONSE_IND, DataTableUtils.getDataTableValue(respdetails, "Acquirer response"))));
takeWriteOffAction();
}
}
| [
"vamsi.krishnakuppa@in.pega.com"
] | vamsi.krishnakuppa@in.pega.com |
e5c271b9e30a5878d65287800a94b18b6ba31545 | 76a8a602739792848be14e4045579926af499a36 | /src/main/java/com/sinotrans/hd/web/rest/errors/InvalidPasswordException.java | 8f24dc6410ef7f0e76e2aaa5e052d3b9891f0dcd | [] | no_license | HJxiaojie/WishSortingCenter | 1f297d933ffade0f75d1441b560f4aefc63e007b | fec0552c255009f6921fc1f87c04dd62366da649 | refs/heads/main | 2023-04-02T10:12:38.725560 | 2021-04-12T07:38:50 | 2021-04-12T07:38:50 | 357,099,054 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package com.sinotrans.hd.web.rest.errors;
import org.zalando.problem.AbstractThrowableProblem;
import org.zalando.problem.Status;
public class InvalidPasswordException extends AbstractThrowableProblem {
private static final long serialVersionUID = 1L;
public InvalidPasswordException() {
super(ErrorConstants.INVALID_PASSWORD_TYPE, "Incorrect password", Status.BAD_REQUEST);
}
}
| [
"gonghaojie@sinotrans.com"
] | gonghaojie@sinotrans.com |
a38ba085e96cb20a88d15424bd115532e95d78bd | d8cc40718b7af0193479a233a21ea2f03c792764 | /aws-java-sdk-cloudfront/src/main/java/com/amazonaws/services/cloudfront/model/transform/CreateDistributionWithTagsRequestMarshaller.java | 715d8cc4b82168c8e223e5f23fcd7187d671a05c | [
"Apache-2.0"
] | permissive | chaoweimt/aws-sdk-java | 1de8c0aeb9aa52931681268cd250ca2af59a83d9 | f11d648b62f2615858e2f0c2e5dd69e77a91abd3 | refs/heads/master | 2021-01-22T03:18:33.038352 | 2017-05-24T22:40:24 | 2017-05-24T22:40:24 | 92,371,194 | 1 | 0 | null | 2017-05-25T06:13:36 | 2017-05-25T06:13:35 | null | UTF-8 | Java | false | false | 53,101 | java | /*
* Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.cloudfront.model.transform;
import static com.amazonaws.util.StringUtils.UTF8;
import java.io.StringWriter;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.cloudfront.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.StringInputStream;
import com.amazonaws.util.XMLWriter;
/**
* CreateDistributionWithTagsRequest Marshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateDistributionWithTagsRequestMarshaller implements Marshaller<Request<CreateDistributionWithTagsRequest>, CreateDistributionWithTagsRequest> {
public Request<CreateDistributionWithTagsRequest> marshall(CreateDistributionWithTagsRequest createDistributionWithTagsRequest) {
if (createDistributionWithTagsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
Request<CreateDistributionWithTagsRequest> request = new DefaultRequest<CreateDistributionWithTagsRequest>(createDistributionWithTagsRequest,
"AmazonCloudFront");
request.setHttpMethod(HttpMethodName.POST);
String uriResourcePath = "/2017-03-25/distribution?WithTags";
uriResourcePath = com.amazonaws.util.UriResourcePathUtils.addStaticQueryParamtersToRequest(request, uriResourcePath);
request.setResourcePath(uriResourcePath);
try {
StringWriter stringWriter = new StringWriter();
XMLWriter xmlWriter = new XMLWriter(stringWriter, "http://cloudfront.amazonaws.com/doc/2017-03-25/");
DistributionConfigWithTags distributionConfigWithTags = createDistributionWithTagsRequest.getDistributionConfigWithTags();
if (distributionConfigWithTags != null) {
xmlWriter.startElement("DistributionConfigWithTags");
DistributionConfig distributionConfig = distributionConfigWithTags.getDistributionConfig();
if (distributionConfig != null) {
xmlWriter.startElement("DistributionConfig");
if (distributionConfig.getCallerReference() != null) {
xmlWriter.startElement("CallerReference").value(distributionConfig.getCallerReference()).endElement();
}
Aliases aliases = distributionConfig.getAliases();
if (aliases != null) {
xmlWriter.startElement("Aliases");
if (aliases.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(aliases.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> aliasesItemsList = (com.amazonaws.internal.SdkInternalList<String>) aliases.getItems();
if (!aliasesItemsList.isEmpty() || !aliasesItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String aliasesItemsListValue : aliasesItemsList) {
xmlWriter.startElement("CNAME");
xmlWriter.value(aliasesItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
if (distributionConfig.getDefaultRootObject() != null) {
xmlWriter.startElement("DefaultRootObject").value(distributionConfig.getDefaultRootObject()).endElement();
}
Origins origins = distributionConfig.getOrigins();
if (origins != null) {
xmlWriter.startElement("Origins");
if (origins.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(origins.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<Origin> originsItemsList = (com.amazonaws.internal.SdkInternalList<Origin>) origins.getItems();
if (!originsItemsList.isEmpty() || !originsItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (Origin originsItemsListValue : originsItemsList) {
xmlWriter.startElement("Origin");
if (originsItemsListValue.getId() != null) {
xmlWriter.startElement("Id").value(originsItemsListValue.getId()).endElement();
}
if (originsItemsListValue.getDomainName() != null) {
xmlWriter.startElement("DomainName").value(originsItemsListValue.getDomainName()).endElement();
}
if (originsItemsListValue.getOriginPath() != null) {
xmlWriter.startElement("OriginPath").value(originsItemsListValue.getOriginPath()).endElement();
}
CustomHeaders customHeaders = originsItemsListValue.getCustomHeaders();
if (customHeaders != null) {
xmlWriter.startElement("CustomHeaders");
if (customHeaders.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(customHeaders.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<OriginCustomHeader> customHeadersItemsList = (com.amazonaws.internal.SdkInternalList<OriginCustomHeader>) customHeaders
.getItems();
if (!customHeadersItemsList.isEmpty() || !customHeadersItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (OriginCustomHeader customHeadersItemsListValue : customHeadersItemsList) {
xmlWriter.startElement("OriginCustomHeader");
if (customHeadersItemsListValue.getHeaderName() != null) {
xmlWriter.startElement("HeaderName").value(customHeadersItemsListValue.getHeaderName()).endElement();
}
if (customHeadersItemsListValue.getHeaderValue() != null) {
xmlWriter.startElement("HeaderValue").value(customHeadersItemsListValue.getHeaderValue()).endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
S3OriginConfig s3OriginConfig = originsItemsListValue.getS3OriginConfig();
if (s3OriginConfig != null) {
xmlWriter.startElement("S3OriginConfig");
if (s3OriginConfig.getOriginAccessIdentity() != null) {
xmlWriter.startElement("OriginAccessIdentity").value(s3OriginConfig.getOriginAccessIdentity()).endElement();
}
xmlWriter.endElement();
}
CustomOriginConfig customOriginConfig = originsItemsListValue.getCustomOriginConfig();
if (customOriginConfig != null) {
xmlWriter.startElement("CustomOriginConfig");
if (customOriginConfig.getHTTPPort() != null) {
xmlWriter.startElement("HTTPPort").value(customOriginConfig.getHTTPPort()).endElement();
}
if (customOriginConfig.getHTTPSPort() != null) {
xmlWriter.startElement("HTTPSPort").value(customOriginConfig.getHTTPSPort()).endElement();
}
if (customOriginConfig.getOriginProtocolPolicy() != null) {
xmlWriter.startElement("OriginProtocolPolicy").value(customOriginConfig.getOriginProtocolPolicy()).endElement();
}
OriginSslProtocols originSslProtocols = customOriginConfig.getOriginSslProtocols();
if (originSslProtocols != null) {
xmlWriter.startElement("OriginSslProtocols");
if (originSslProtocols.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(originSslProtocols.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> originSslProtocolsItemsList = (com.amazonaws.internal.SdkInternalList<String>) originSslProtocols
.getItems();
if (!originSslProtocolsItemsList.isEmpty() || !originSslProtocolsItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String originSslProtocolsItemsListValue : originSslProtocolsItemsList) {
xmlWriter.startElement("SslProtocol");
xmlWriter.value(originSslProtocolsItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
if (customOriginConfig.getOriginReadTimeout() != null) {
xmlWriter.startElement("OriginReadTimeout").value(customOriginConfig.getOriginReadTimeout()).endElement();
}
if (customOriginConfig.getOriginKeepaliveTimeout() != null) {
xmlWriter.startElement("OriginKeepaliveTimeout").value(customOriginConfig.getOriginKeepaliveTimeout()).endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
DefaultCacheBehavior defaultCacheBehavior = distributionConfig.getDefaultCacheBehavior();
if (defaultCacheBehavior != null) {
xmlWriter.startElement("DefaultCacheBehavior");
if (defaultCacheBehavior.getTargetOriginId() != null) {
xmlWriter.startElement("TargetOriginId").value(defaultCacheBehavior.getTargetOriginId()).endElement();
}
ForwardedValues forwardedValues = defaultCacheBehavior.getForwardedValues();
if (forwardedValues != null) {
xmlWriter.startElement("ForwardedValues");
if (forwardedValues.getQueryString() != null) {
xmlWriter.startElement("QueryString").value(forwardedValues.getQueryString()).endElement();
}
CookiePreference cookies = forwardedValues.getCookies();
if (cookies != null) {
xmlWriter.startElement("Cookies");
if (cookies.getForward() != null) {
xmlWriter.startElement("Forward").value(cookies.getForward()).endElement();
}
CookieNames whitelistedNames = cookies.getWhitelistedNames();
if (whitelistedNames != null) {
xmlWriter.startElement("WhitelistedNames");
if (whitelistedNames.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(whitelistedNames.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> cookieNamesItemsList = (com.amazonaws.internal.SdkInternalList<String>) whitelistedNames
.getItems();
if (!cookieNamesItemsList.isEmpty() || !cookieNamesItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String cookieNamesItemsListValue : cookieNamesItemsList) {
xmlWriter.startElement("Name");
xmlWriter.value(cookieNamesItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
Headers headers = forwardedValues.getHeaders();
if (headers != null) {
xmlWriter.startElement("Headers");
if (headers.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(headers.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> headersItemsList = (com.amazonaws.internal.SdkInternalList<String>) headers
.getItems();
if (!headersItemsList.isEmpty() || !headersItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String headersItemsListValue : headersItemsList) {
xmlWriter.startElement("Name");
xmlWriter.value(headersItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
QueryStringCacheKeys queryStringCacheKeys = forwardedValues.getQueryStringCacheKeys();
if (queryStringCacheKeys != null) {
xmlWriter.startElement("QueryStringCacheKeys");
if (queryStringCacheKeys.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(queryStringCacheKeys.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> queryStringCacheKeysItemsList = (com.amazonaws.internal.SdkInternalList<String>) queryStringCacheKeys
.getItems();
if (!queryStringCacheKeysItemsList.isEmpty() || !queryStringCacheKeysItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String queryStringCacheKeysItemsListValue : queryStringCacheKeysItemsList) {
xmlWriter.startElement("Name");
xmlWriter.value(queryStringCacheKeysItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
TrustedSigners trustedSigners = defaultCacheBehavior.getTrustedSigners();
if (trustedSigners != null) {
xmlWriter.startElement("TrustedSigners");
if (trustedSigners.getEnabled() != null) {
xmlWriter.startElement("Enabled").value(trustedSigners.getEnabled()).endElement();
}
if (trustedSigners.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(trustedSigners.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> trustedSignersItemsList = (com.amazonaws.internal.SdkInternalList<String>) trustedSigners
.getItems();
if (!trustedSignersItemsList.isEmpty() || !trustedSignersItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String trustedSignersItemsListValue : trustedSignersItemsList) {
xmlWriter.startElement("AwsAccountNumber");
xmlWriter.value(trustedSignersItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
if (defaultCacheBehavior.getViewerProtocolPolicy() != null) {
xmlWriter.startElement("ViewerProtocolPolicy").value(defaultCacheBehavior.getViewerProtocolPolicy()).endElement();
}
if (defaultCacheBehavior.getMinTTL() != null) {
xmlWriter.startElement("MinTTL").value(defaultCacheBehavior.getMinTTL()).endElement();
}
AllowedMethods allowedMethods = defaultCacheBehavior.getAllowedMethods();
if (allowedMethods != null) {
xmlWriter.startElement("AllowedMethods");
if (allowedMethods.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(allowedMethods.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> allowedMethodsItemsList = (com.amazonaws.internal.SdkInternalList<String>) allowedMethods
.getItems();
if (!allowedMethodsItemsList.isEmpty() || !allowedMethodsItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String allowedMethodsItemsListValue : allowedMethodsItemsList) {
xmlWriter.startElement("Method");
xmlWriter.value(allowedMethodsItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
CachedMethods cachedMethods = allowedMethods.getCachedMethods();
if (cachedMethods != null) {
xmlWriter.startElement("CachedMethods");
if (cachedMethods.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(cachedMethods.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> cachedMethodsItemsList = (com.amazonaws.internal.SdkInternalList<String>) cachedMethods
.getItems();
if (!cachedMethodsItemsList.isEmpty() || !cachedMethodsItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String cachedMethodsItemsListValue : cachedMethodsItemsList) {
xmlWriter.startElement("Method");
xmlWriter.value(cachedMethodsItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
if (defaultCacheBehavior.getSmoothStreaming() != null) {
xmlWriter.startElement("SmoothStreaming").value(defaultCacheBehavior.getSmoothStreaming()).endElement();
}
if (defaultCacheBehavior.getDefaultTTL() != null) {
xmlWriter.startElement("DefaultTTL").value(defaultCacheBehavior.getDefaultTTL()).endElement();
}
if (defaultCacheBehavior.getMaxTTL() != null) {
xmlWriter.startElement("MaxTTL").value(defaultCacheBehavior.getMaxTTL()).endElement();
}
if (defaultCacheBehavior.getCompress() != null) {
xmlWriter.startElement("Compress").value(defaultCacheBehavior.getCompress()).endElement();
}
LambdaFunctionAssociations lambdaFunctionAssociations = defaultCacheBehavior.getLambdaFunctionAssociations();
if (lambdaFunctionAssociations != null) {
xmlWriter.startElement("LambdaFunctionAssociations");
if (lambdaFunctionAssociations.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(lambdaFunctionAssociations.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<LambdaFunctionAssociation> lambdaFunctionAssociationsItemsList = (com.amazonaws.internal.SdkInternalList<LambdaFunctionAssociation>) lambdaFunctionAssociations
.getItems();
if (!lambdaFunctionAssociationsItemsList.isEmpty() || !lambdaFunctionAssociationsItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (LambdaFunctionAssociation lambdaFunctionAssociationsItemsListValue : lambdaFunctionAssociationsItemsList) {
xmlWriter.startElement("LambdaFunctionAssociation");
if (lambdaFunctionAssociationsItemsListValue.getLambdaFunctionARN() != null) {
xmlWriter.startElement("LambdaFunctionARN").value(lambdaFunctionAssociationsItemsListValue.getLambdaFunctionARN())
.endElement();
}
if (lambdaFunctionAssociationsItemsListValue.getEventType() != null) {
xmlWriter.startElement("EventType").value(lambdaFunctionAssociationsItemsListValue.getEventType()).endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
CacheBehaviors cacheBehaviors = distributionConfig.getCacheBehaviors();
if (cacheBehaviors != null) {
xmlWriter.startElement("CacheBehaviors");
if (cacheBehaviors.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(cacheBehaviors.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<CacheBehavior> cacheBehaviorsItemsList = (com.amazonaws.internal.SdkInternalList<CacheBehavior>) cacheBehaviors
.getItems();
if (!cacheBehaviorsItemsList.isEmpty() || !cacheBehaviorsItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (CacheBehavior cacheBehaviorsItemsListValue : cacheBehaviorsItemsList) {
xmlWriter.startElement("CacheBehavior");
if (cacheBehaviorsItemsListValue.getPathPattern() != null) {
xmlWriter.startElement("PathPattern").value(cacheBehaviorsItemsListValue.getPathPattern()).endElement();
}
if (cacheBehaviorsItemsListValue.getTargetOriginId() != null) {
xmlWriter.startElement("TargetOriginId").value(cacheBehaviorsItemsListValue.getTargetOriginId()).endElement();
}
ForwardedValues forwardedValues = cacheBehaviorsItemsListValue.getForwardedValues();
if (forwardedValues != null) {
xmlWriter.startElement("ForwardedValues");
if (forwardedValues.getQueryString() != null) {
xmlWriter.startElement("QueryString").value(forwardedValues.getQueryString()).endElement();
}
CookiePreference cookies = forwardedValues.getCookies();
if (cookies != null) {
xmlWriter.startElement("Cookies");
if (cookies.getForward() != null) {
xmlWriter.startElement("Forward").value(cookies.getForward()).endElement();
}
CookieNames whitelistedNames = cookies.getWhitelistedNames();
if (whitelistedNames != null) {
xmlWriter.startElement("WhitelistedNames");
if (whitelistedNames.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(whitelistedNames.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> cookieNamesItemsList = (com.amazonaws.internal.SdkInternalList<String>) whitelistedNames
.getItems();
if (!cookieNamesItemsList.isEmpty() || !cookieNamesItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String cookieNamesItemsListValue : cookieNamesItemsList) {
xmlWriter.startElement("Name");
xmlWriter.value(cookieNamesItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
Headers headers = forwardedValues.getHeaders();
if (headers != null) {
xmlWriter.startElement("Headers");
if (headers.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(headers.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> headersItemsList = (com.amazonaws.internal.SdkInternalList<String>) headers
.getItems();
if (!headersItemsList.isEmpty() || !headersItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String headersItemsListValue : headersItemsList) {
xmlWriter.startElement("Name");
xmlWriter.value(headersItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
QueryStringCacheKeys queryStringCacheKeys = forwardedValues.getQueryStringCacheKeys();
if (queryStringCacheKeys != null) {
xmlWriter.startElement("QueryStringCacheKeys");
if (queryStringCacheKeys.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(queryStringCacheKeys.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> queryStringCacheKeysItemsList = (com.amazonaws.internal.SdkInternalList<String>) queryStringCacheKeys
.getItems();
if (!queryStringCacheKeysItemsList.isEmpty() || !queryStringCacheKeysItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String queryStringCacheKeysItemsListValue : queryStringCacheKeysItemsList) {
xmlWriter.startElement("Name");
xmlWriter.value(queryStringCacheKeysItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
TrustedSigners trustedSigners = cacheBehaviorsItemsListValue.getTrustedSigners();
if (trustedSigners != null) {
xmlWriter.startElement("TrustedSigners");
if (trustedSigners.getEnabled() != null) {
xmlWriter.startElement("Enabled").value(trustedSigners.getEnabled()).endElement();
}
if (trustedSigners.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(trustedSigners.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> trustedSignersItemsList = (com.amazonaws.internal.SdkInternalList<String>) trustedSigners
.getItems();
if (!trustedSignersItemsList.isEmpty() || !trustedSignersItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String trustedSignersItemsListValue : trustedSignersItemsList) {
xmlWriter.startElement("AwsAccountNumber");
xmlWriter.value(trustedSignersItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
if (cacheBehaviorsItemsListValue.getViewerProtocolPolicy() != null) {
xmlWriter.startElement("ViewerProtocolPolicy").value(cacheBehaviorsItemsListValue.getViewerProtocolPolicy()).endElement();
}
if (cacheBehaviorsItemsListValue.getMinTTL() != null) {
xmlWriter.startElement("MinTTL").value(cacheBehaviorsItemsListValue.getMinTTL()).endElement();
}
AllowedMethods allowedMethods = cacheBehaviorsItemsListValue.getAllowedMethods();
if (allowedMethods != null) {
xmlWriter.startElement("AllowedMethods");
if (allowedMethods.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(allowedMethods.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> allowedMethodsItemsList = (com.amazonaws.internal.SdkInternalList<String>) allowedMethods
.getItems();
if (!allowedMethodsItemsList.isEmpty() || !allowedMethodsItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String allowedMethodsItemsListValue : allowedMethodsItemsList) {
xmlWriter.startElement("Method");
xmlWriter.value(allowedMethodsItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
CachedMethods cachedMethods = allowedMethods.getCachedMethods();
if (cachedMethods != null) {
xmlWriter.startElement("CachedMethods");
if (cachedMethods.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(cachedMethods.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> cachedMethodsItemsList = (com.amazonaws.internal.SdkInternalList<String>) cachedMethods
.getItems();
if (!cachedMethodsItemsList.isEmpty() || !cachedMethodsItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String cachedMethodsItemsListValue : cachedMethodsItemsList) {
xmlWriter.startElement("Method");
xmlWriter.value(cachedMethodsItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
if (cacheBehaviorsItemsListValue.getSmoothStreaming() != null) {
xmlWriter.startElement("SmoothStreaming").value(cacheBehaviorsItemsListValue.getSmoothStreaming()).endElement();
}
if (cacheBehaviorsItemsListValue.getDefaultTTL() != null) {
xmlWriter.startElement("DefaultTTL").value(cacheBehaviorsItemsListValue.getDefaultTTL()).endElement();
}
if (cacheBehaviorsItemsListValue.getMaxTTL() != null) {
xmlWriter.startElement("MaxTTL").value(cacheBehaviorsItemsListValue.getMaxTTL()).endElement();
}
if (cacheBehaviorsItemsListValue.getCompress() != null) {
xmlWriter.startElement("Compress").value(cacheBehaviorsItemsListValue.getCompress()).endElement();
}
LambdaFunctionAssociations lambdaFunctionAssociations = cacheBehaviorsItemsListValue.getLambdaFunctionAssociations();
if (lambdaFunctionAssociations != null) {
xmlWriter.startElement("LambdaFunctionAssociations");
if (lambdaFunctionAssociations.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(lambdaFunctionAssociations.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<LambdaFunctionAssociation> lambdaFunctionAssociationsItemsList = (com.amazonaws.internal.SdkInternalList<LambdaFunctionAssociation>) lambdaFunctionAssociations
.getItems();
if (!lambdaFunctionAssociationsItemsList.isEmpty() || !lambdaFunctionAssociationsItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (LambdaFunctionAssociation lambdaFunctionAssociationsItemsListValue : lambdaFunctionAssociationsItemsList) {
xmlWriter.startElement("LambdaFunctionAssociation");
if (lambdaFunctionAssociationsItemsListValue.getLambdaFunctionARN() != null) {
xmlWriter.startElement("LambdaFunctionARN")
.value(lambdaFunctionAssociationsItemsListValue.getLambdaFunctionARN()).endElement();
}
if (lambdaFunctionAssociationsItemsListValue.getEventType() != null) {
xmlWriter.startElement("EventType").value(lambdaFunctionAssociationsItemsListValue.getEventType()).endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
CustomErrorResponses customErrorResponses = distributionConfig.getCustomErrorResponses();
if (customErrorResponses != null) {
xmlWriter.startElement("CustomErrorResponses");
if (customErrorResponses.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(customErrorResponses.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<CustomErrorResponse> customErrorResponsesItemsList = (com.amazonaws.internal.SdkInternalList<CustomErrorResponse>) customErrorResponses
.getItems();
if (!customErrorResponsesItemsList.isEmpty() || !customErrorResponsesItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (CustomErrorResponse customErrorResponsesItemsListValue : customErrorResponsesItemsList) {
xmlWriter.startElement("CustomErrorResponse");
if (customErrorResponsesItemsListValue.getErrorCode() != null) {
xmlWriter.startElement("ErrorCode").value(customErrorResponsesItemsListValue.getErrorCode()).endElement();
}
if (customErrorResponsesItemsListValue.getResponsePagePath() != null) {
xmlWriter.startElement("ResponsePagePath").value(customErrorResponsesItemsListValue.getResponsePagePath()).endElement();
}
if (customErrorResponsesItemsListValue.getResponseCode() != null) {
xmlWriter.startElement("ResponseCode").value(customErrorResponsesItemsListValue.getResponseCode()).endElement();
}
if (customErrorResponsesItemsListValue.getErrorCachingMinTTL() != null) {
xmlWriter.startElement("ErrorCachingMinTTL").value(customErrorResponsesItemsListValue.getErrorCachingMinTTL()).endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
if (distributionConfig.getComment() != null) {
xmlWriter.startElement("Comment").value(distributionConfig.getComment()).endElement();
}
LoggingConfig logging = distributionConfig.getLogging();
if (logging != null) {
xmlWriter.startElement("Logging");
if (logging.getEnabled() != null) {
xmlWriter.startElement("Enabled").value(logging.getEnabled()).endElement();
}
if (logging.getIncludeCookies() != null) {
xmlWriter.startElement("IncludeCookies").value(logging.getIncludeCookies()).endElement();
}
if (logging.getBucket() != null) {
xmlWriter.startElement("Bucket").value(logging.getBucket()).endElement();
}
if (logging.getPrefix() != null) {
xmlWriter.startElement("Prefix").value(logging.getPrefix()).endElement();
}
xmlWriter.endElement();
}
if (distributionConfig.getPriceClass() != null) {
xmlWriter.startElement("PriceClass").value(distributionConfig.getPriceClass()).endElement();
}
if (distributionConfig.getEnabled() != null) {
xmlWriter.startElement("Enabled").value(distributionConfig.getEnabled()).endElement();
}
ViewerCertificate viewerCertificate = distributionConfig.getViewerCertificate();
if (viewerCertificate != null) {
xmlWriter.startElement("ViewerCertificate");
if (viewerCertificate.getCloudFrontDefaultCertificate() != null) {
xmlWriter.startElement("CloudFrontDefaultCertificate").value(viewerCertificate.getCloudFrontDefaultCertificate()).endElement();
}
if (viewerCertificate.getIAMCertificateId() != null) {
xmlWriter.startElement("IAMCertificateId").value(viewerCertificate.getIAMCertificateId()).endElement();
}
if (viewerCertificate.getACMCertificateArn() != null) {
xmlWriter.startElement("ACMCertificateArn").value(viewerCertificate.getACMCertificateArn()).endElement();
}
if (viewerCertificate.getSSLSupportMethod() != null) {
xmlWriter.startElement("SSLSupportMethod").value(viewerCertificate.getSSLSupportMethod()).endElement();
}
if (viewerCertificate.getMinimumProtocolVersion() != null) {
xmlWriter.startElement("MinimumProtocolVersion").value(viewerCertificate.getMinimumProtocolVersion()).endElement();
}
if (viewerCertificate.getCertificate() != null) {
xmlWriter.startElement("Certificate").value(viewerCertificate.getCertificate()).endElement();
}
if (viewerCertificate.getCertificateSource() != null) {
xmlWriter.startElement("CertificateSource").value(viewerCertificate.getCertificateSource()).endElement();
}
xmlWriter.endElement();
}
Restrictions restrictions = distributionConfig.getRestrictions();
if (restrictions != null) {
xmlWriter.startElement("Restrictions");
GeoRestriction geoRestriction = restrictions.getGeoRestriction();
if (geoRestriction != null) {
xmlWriter.startElement("GeoRestriction");
if (geoRestriction.getRestrictionType() != null) {
xmlWriter.startElement("RestrictionType").value(geoRestriction.getRestrictionType()).endElement();
}
if (geoRestriction.getQuantity() != null) {
xmlWriter.startElement("Quantity").value(geoRestriction.getQuantity()).endElement();
}
com.amazonaws.internal.SdkInternalList<String> geoRestrictionItemsList = (com.amazonaws.internal.SdkInternalList<String>) geoRestriction
.getItems();
if (!geoRestrictionItemsList.isEmpty() || !geoRestrictionItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (String geoRestrictionItemsListValue : geoRestrictionItemsList) {
xmlWriter.startElement("Location");
xmlWriter.value(geoRestrictionItemsListValue);
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
if (distributionConfig.getWebACLId() != null) {
xmlWriter.startElement("WebACLId").value(distributionConfig.getWebACLId()).endElement();
}
if (distributionConfig.getHttpVersion() != null) {
xmlWriter.startElement("HttpVersion").value(distributionConfig.getHttpVersion()).endElement();
}
if (distributionConfig.getIsIPV6Enabled() != null) {
xmlWriter.startElement("IsIPV6Enabled").value(distributionConfig.getIsIPV6Enabled()).endElement();
}
xmlWriter.endElement();
}
Tags tags = distributionConfigWithTags.getTags();
if (tags != null) {
xmlWriter.startElement("Tags");
com.amazonaws.internal.SdkInternalList<Tag> tagsItemsList = (com.amazonaws.internal.SdkInternalList<Tag>) tags.getItems();
if (!tagsItemsList.isEmpty() || !tagsItemsList.isAutoConstruct()) {
xmlWriter.startElement("Items");
for (Tag tagsItemsListValue : tagsItemsList) {
xmlWriter.startElement("Tag");
if (tagsItemsListValue.getKey() != null) {
xmlWriter.startElement("Key").value(tagsItemsListValue.getKey()).endElement();
}
if (tagsItemsListValue.getValue() != null) {
xmlWriter.startElement("Value").value(tagsItemsListValue.getValue()).endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
xmlWriter.endElement();
}
request.setContent(new StringInputStream(stringWriter.getBuffer().toString()));
request.addHeader("Content-Length", Integer.toString(stringWriter.getBuffer().toString().getBytes(UTF8).length));
if (!request.getHeaders().containsKey("Content-Type")) {
request.addHeader("Content-Type", "application/xml");
}
} catch (Throwable t) {
throw new SdkClientException("Unable to marshall request to XML: " + t.getMessage(), t);
}
return request;
}
}
| [
""
] | |
1b3173f7d0206c266b9fff2d4a5d00c7cdb1013c | cf0fcfd48bdaae24e34771877dcd2637522bd839 | /app/src/main/java/com/example/creddit/SignupActivity.java | d524981ad6ae738a5143e9b5c0275ab7e97fe2a3 | [] | no_license | pawanabc59/creddit | 89b8ac8b93387625cd69ee1889380e4439f57518 | e40772866d1e434e3824467b9de461fb330b4f6f | refs/heads/master | 2021-07-12T00:10:49.437558 | 2020-11-01T15:56:09 | 2020-11-01T15:56:09 | 211,466,826 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,109 | java | package com.example.creddit;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseAuthUserCollisionException;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.text.SimpleDateFormat;
import java.util.Date;
public class SignupActivity extends AppCompatActivity {
TextView sign_login_txt;
TextInputLayout textRegisterEmail, textRegisterPassword, textRegistercPassword;
TextInputEditText editRegisterEmail, editRegisterPassword, editRegistercPassword;
Button btnRegister;
ProgressBar registerProgressBar;
FirebaseAuth firebaseAuth;
FirebaseDatabase firebaseDatabase;
FirebaseUser firebaseUser;
DatabaseReference mRef, mRef2;
String uid;
String currentDate;
SimpleDateFormat sdf;
int numberOfUsers;
SharedPref sessionManager;
String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sessionManager = new SharedPref(this);
if (sessionManager.loadNightModeState() == true) {
setTheme(R.style.darktheme);
} else {
setTheme(R.style.AppTheme);
}
setContentView(R.layout.activity_signup);
sdf = new SimpleDateFormat("dd/MM/yyyy");
currentDate = sdf.format(new Date());
sign_login_txt = findViewById(R.id.sign_login_txt);
firebaseDatabase = FirebaseDatabase.getInstance();
firebaseAuth = FirebaseAuth.getInstance();
mRef = firebaseDatabase.getReference("creddit").child("users");
mRef2 = firebaseDatabase.getReference("creddit");
textRegisterEmail = findViewById(R.id.textRegistercUsername);
textRegisterPassword = findViewById(R.id.textRegisterPassword);
textRegistercPassword = findViewById(R.id.textRegistercPassword);
editRegisterEmail = findViewById(R.id.sign_username);
editRegisterPassword = findViewById(R.id.sign_password);
editRegistercPassword = findViewById(R.id.sign_cpassword);
btnRegister = findViewById(R.id.sign_btn_signup);
registerProgressBar = findViewById(R.id.signUpProgressBar);
FirebaseDatabase.getInstance().getReference("creddit").child("numberOfUsers").addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
numberOfUsers = dataSnapshot.getValue(Integer.class);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
btnRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
btnRegister.setVisibility(View.GONE);
registerProgressBar.setVisibility(View.VISIBLE);
String email = editRegisterEmail.getText().toString().trim();
String password = editRegisterPassword.getText().toString().trim();
String c_password = editRegistercPassword.getText().toString().trim();
if (email.isEmpty()) {
editRegisterEmail.setError("Please insert email");
btnRegister.setVisibility(View.VISIBLE);
registerProgressBar.setVisibility(View.GONE);
} else if (password.isEmpty()) {
editRegisterPassword.setError("Please insert password");
btnRegister.setVisibility(View.VISIBLE);
registerProgressBar.setVisibility(View.GONE);
} else if (c_password.isEmpty()) {
editRegistercPassword.setError("Please insert confirm password");
btnRegister.setVisibility(View.VISIBLE);
registerProgressBar.setVisibility(View.GONE);
} else if (!email.matches(emailPattern)) {
editRegisterEmail.setError("Please enter valid email address");
btnRegister.setVisibility(View.VISIBLE);
registerProgressBar.setVisibility(View.GONE);
} else if (password.length() < 6) {
editRegisterPassword.setError("Password length should be minimum of 6 digits");
btnRegister.setVisibility(View.VISIBLE);
registerProgressBar.setVisibility(View.GONE);
} else {
if (password.equals(c_password)) {
Register(email, password);
} else {
Toast.makeText(getApplicationContext(), "Password does not matched", Toast.LENGTH_LONG).show();
btnRegister.setVisibility(View.VISIBLE);
registerProgressBar.setVisibility(View.GONE);
}
}
}
});
sign_login_txt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
startActivity(intent);
finish();
}
});
}
public void Register(final String email, String password) {
firebaseAuth.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
firebaseAuth.getCurrentUser().sendEmailVerification()
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()){
Toast.makeText(getApplicationContext(), "Registration successful! Please verify email.", Toast.LENGTH_SHORT).show();
registerProgressBar.setVisibility(View.GONE);
btnRegister.setVisibility(View.VISIBLE);
editRegisterEmail.setText("");
editRegisterPassword.setText("");
editRegistercPassword.setText("");
uid = firebaseAuth.getCurrentUser().getUid();
mRef.child(uid).child("createdAt").setValue(currentDate);
mRef.child(uid).child("userNumber").setValue(numberOfUsers+1);
FirebaseDatabase.getInstance().getReference("creddit").child("numberOfUsers").setValue(numberOfUsers+1);
mRef.child(uid).child("showNSFW").setValue(0);
mRef.child(uid).child("blurNSFW").setValue(0);
mRef.child(uid).child("optionalName").setValue(email);
mRef.child(uid).child("email").setValue(email);
mRef.child(uid).child("profileImage").setValue("null");
mRef2.child("search").child(uid).child("name").setValue(email);
mRef2.child("search").child(uid).child("profilePicture").setValue("null");
mRef2.child("search").child(uid).child("type").setValue("user");
firebaseAuth.signOut();
}else{
Toast.makeText(getApplicationContext(), "Error sending in email", Toast.LENGTH_SHORT).show();
}
}
});
// Toast.makeText(getApplicationContext(), "User Created", Toast.LENGTH_SHORT).show();
// String key = mRef.push().getKey();
// mRef2 = mRef.child(key);
// mRef2.child("email").setValue(email);
} else {
if (task.getException() instanceof FirebaseAuthUserCollisionException) {
Toast.makeText(getApplicationContext(), "User Alerdy exist!!!", Toast.LENGTH_SHORT).show();
registerProgressBar.setVisibility(View.GONE);
btnRegister.setVisibility(View.VISIBLE);
}
}
}
});
}
}
| [
"pawanabc59@gmail.com"
] | pawanabc59@gmail.com |
7649bc4a48e948b670139ab71c83c11f9935e861 | 9a6bdea3f32c066f0aebb7d5c1e1a43827976542 | /app/src/main/java/adoptplanet/com/adoptplanet/view/EventTabActivity.java | 2787c2953562efafe7f211e42aa46b0d14666f5a | [] | no_license | whalex/adoptplanet_android | 40093bfe41a34dd3be9c8a7069bcf8def29df75a | 918463f600155d57e072eb7e4a9d9d2289f2fa31 | refs/heads/master | 2016-09-03T06:45:11.248977 | 2015-08-14T00:07:19 | 2015-08-14T00:07:19 | 39,006,135 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,183 | java | package adoptplanet.com.adoptplanet.view;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import adoptplanet.com.adoptplanet.R;
public class EventTabActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event_tab);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_event_tab, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"ladaone1337@gmail.com"
] | ladaone1337@gmail.com |
e153dcc9591dedd9beaec559340d948fd62845c1 | fd11cdb2e2ca61acd42c4702f7e95c8841b3c66b | /desing_patterns/src/chainOfResponsibility/DescontoPorMaisDeQuinhentosReais.java | 4b7176db9ceef48e080f65706618fa9ba034fe44 | [] | no_license | olavobs/Design-Patterns | 6a2bb09f5b1a7b23c45e969377bcbc42ca197b6c | 901714e40923bb7b048842727919791601d79e69 | refs/heads/master | 2023-03-27T09:19:07.517054 | 2021-03-24T12:01:11 | 2021-03-24T12:01:11 | 280,419,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package chainOfResponsibility;
public class DescontoPorMaisDeQuinhentosReais implements Desconto {
private Desconto proximo;
@Override
public double desconta(Orcamento orcamento) {
if (orcamento.getValor() > 500) {
return orcamento.getValor() * 0.07;
}
return proximo.desconta(orcamento);
}
@Override
public void setProximoDesconto(Desconto proximoDesconto) {
this.proximo = proximoDesconto;
}
}
| [
"olavo.souza@mv.com.br"
] | olavo.souza@mv.com.br |
0131de61e63d7761ff811b416d2d407528f29e8b | f278e6a1441f12cebe55cccb1114a7fe2d9c84f3 | /src/main/java/sample/clientapp/WellKnownGetter.java | aaeef787e5eb370998464800c9c8d3a59114fd17 | [
"Apache-2.0"
] | permissive | hi-time/sample-oidc-client-application | df731e98a7a1d6434da7184f30af679866fc6ae1 | bf94858309c50be8210dd7701a945cc707c05c02 | refs/heads/master | 2023-06-13T06:55:19.980073 | 2021-07-08T06:50:35 | 2021-07-08T06:50:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,185 | java | package sample.clientapp;
import java.net.URI;
import org.springframework.http.HttpMethod;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import sample.config.ClientAppConfiguration;
import sample.jwt.WellKnownInfo;
public class WellKnownGetter {
private ClientAppConfiguration clientConfig;
private RestTemplate restTemplate;
public WellKnownGetter(ClientAppConfiguration clientConfig, RestTemplate restTemplate) {
this.clientConfig = clientConfig;
this.restTemplate = restTemplate;
}
public WellKnownInfo getWellKnown() {
RequestEntity<?> req = new RequestEntity<>(null, null, HttpMethod.GET,
URI.create(clientConfig.getAuthserverUrl()));
WellKnownInfo wellKnownInfo = null;
try {
ResponseEntity<WellKnownInfo> res = restTemplate.exchange(req, WellKnownInfo.class);
wellKnownInfo = res.getBody();
} catch (HttpClientErrorException e) {
System.out.println("!! response code=" + e.getStatusCode());
System.out.println(e.getResponseBodyAsString());
}
return wellKnownInfo;
}
}
| [
"michito.okai.zn@hitachi.com"
] | michito.okai.zn@hitachi.com |
ce5cd56d798d5f2aac0709f9d573ae1cce00bc12 | 573238d19daa8d37f904e817e9c25237ccbf4557 | /sample/src/main/java/com/zhy/sample/adapter/lv/MsgSendItemDelagate.java | 4a2b6febe9b9586d4eec75cbcf3fcfa8e2774e5e | [
"Apache-2.0"
] | permissive | TimChenDev/baseAdapter | d2a02ae7007ccd7d8d9b648884f58a820af6ba27 | 2724e57f96a39c69ab6b9c86ec06c20537518783 | refs/heads/master | 2021-04-20T06:33:59.049064 | 2020-03-26T03:05:36 | 2020-03-26T03:05:36 | 249,662,580 | 2 | 0 | Apache-2.0 | 2020-03-24T09:16:57 | 2020-03-24T09:16:56 | null | UTF-8 | Java | false | false | 917 | java | package com.zhy.sample.adapter.lv;
import com.zhy.adapter.abslistview.ViewHolder;
import com.zhy.adapter.abslistview.base.ItemViewDelegate;
import com.zhy.sample.R;
import com.zhy.sample.bean.ChatMessage;
/**
* Created by zhy on 16/6/22.
*/
public class MsgSendItemDelagate implements ItemViewDelegate<ChatMessage>
{
@Override
public int getItemViewLayoutId()
{
return R.layout.main_chat_send_msg;
}
@Override
public boolean isForViewType(ChatMessage item, int position)
{
return !item.isComMeg();
}
@Override
public void convert(ViewHolder holder, ChatMessage chatMessage, int position)
{
holder.setText(R.id.chat_send_content, chatMessage.getContent());
holder.setText(R.id.chat_send_name, chatMessage.getName());
holder.setImageResource(R.id.chat_send_icon, chatMessage.getIcon());
}
}
| [
"lmj623565791@gmail.com"
] | lmj623565791@gmail.com |
dc949684db0a90eed439ea18f8bafaa106253856 | 638d957ed8f3c5a054752510e5d01b2bd86adc25 | /module/registry/core/src/main/java/net/datatp/registry/activity/Activity.java | b7a0ce2951608de5092aafd716d3f7ad9920ac43 | [] | no_license | tuan08/datatp | 3bfed7c6175fe3950659443ebc1a580b510e466a | 7d7ff6bed36199627b143d37dd254cdb6dbf269c | refs/heads/master | 2020-04-12T06:22:53.010673 | 2016-12-07T03:19:53 | 2016-12-07T03:19:53 | 62,194,565 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,741 | java | package net.datatp.registry.activity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Activity implements Comparable<Activity> {
private String description;
private String type;
private String id;
private String coordinator;
private String activityStepBuilder;
private Map<String, String> attributes = new HashMap<>();
private List<String> logs;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCoordinator() {
return coordinator;
}
public void setCoordinator(String coordinator) {
this.coordinator = coordinator;
}
public Activity withCoordinator(Class<?> type) {
this.coordinator = type.getName();
return this;
}
public String getActivityStepBuilder() {
return activityStepBuilder;
}
public void setActivityStepBuilder(String activityStepBuilder) {
this.activityStepBuilder = activityStepBuilder;
}
public Activity withActivityStepBuilder(Class<?> type) {
this.activityStepBuilder = type.getName();
return this;
}
public Map<String, String> getAttributes() {
return attributes;
}
public void setAttributes(Map<String, String> attributes) {
this.attributes = attributes;
}
public void attribute(String name, String value) {
attributes.put(name, value);
}
public void attribute(String name, int value) {
attributes.put(name, Integer.toString(value));
}
public void attribute(String name, boolean value) {
attributes.put(name, Boolean.toString(value));
}
public String attribute(String name) {
return attributes.get(name);
}
public int attributeAsInt(String name, int defaultValue) {
String val = attributes.get(name);
return val != null ? Integer.parseInt(val) : defaultValue;
}
public boolean attributeAsBoolean(String name, boolean defaultValue) {
String val = attributes.get(name);
return val != null ? Boolean.parseBoolean(val) : defaultValue;
}
public List<String> getLogs() {
return logs;
}
public void setLogs(List<String> logs) {
this.logs = logs;
}
public void addLog(String log) {
if (logs == null)
logs = new ArrayList<String>();
logs.add(log);
}
@Override
public int compareTo(Activity o) {
return this.getId().compareToIgnoreCase(o.getId());
}
} | [
"tuan08@gmail.com"
] | tuan08@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.