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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
90aa721c9502d8f31507fa0a62a9ed2bf41ba7b8 | 94a4d8f7672a828843e10c68b91c376423cbb9e1 | /src/com/oxygen/map/MyOrientationListener.java | 7a4e99572eecd82a09928602aff3a95cda59c0fb | [] | no_license | oxygen0106/Wall | 9bb95bb6f59d86835e2df458cc0e57f6a020fc62 | 68ca04b258ae330422d0e16f4ca0315808c42b89 | refs/heads/master | 2016-08-04T14:08:33.804723 | 2015-06-29T09:13:20 | 2015-06-29T09:13:20 | 23,254,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,129 | java | package com.oxygen.map;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
/**
* 方向传感器监听类实现
* @author oxygen
*
*/
public class MyOrientationListener implements SensorEventListener {
private Context context;
private SensorManager sensorManager;
private Sensor aSensor;
private Sensor mSensor;
float[] accelerometerValues = new float[3];
float[] magneticFieldValues = new float[3];
private float lastX=0f;
private OnOrientationListener onOrientationListener;//声明内部监听接口类对象
/**
* Constructor
* @param context
*/
public MyOrientationListener(Context context) {
this.context = context;
}
/**
* @param
* @return void
* @Description 开始判断方向
*/
public void start() {
// 获得传感器管理器
sensorManager = (SensorManager) context
.getSystemService(Context.SENSOR_SERVICE);
if (sensorManager != null) {// 获得加速度和磁力传感器
aSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mSensor = sensorManager
.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
}
if (aSensor != null && mSensor != null) {// 注册两个传感器
sensorManager.registerListener(this, aSensor,
SensorManager.SENSOR_DELAY_UI);
sensorManager.registerListener(this, mSensor,
SensorManager.SENSOR_DELAY_UI);
}
}
/**
* @param
* @return void
* @Description 停止方向检测
*/
public void stop() {
sensorManager.unregisterListener(this);
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// TODO Auto-generated method stub
}
@Override
public void onSensorChanged(SensorEvent sensorEvent) {
if (sensorEvent.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD)
magneticFieldValues = sensorEvent.values;
if (sensorEvent.sensor.getType() == Sensor.TYPE_ACCELEROMETER)
accelerometerValues = sensorEvent.values;
float[] values = new float[3];// [0]为Z轴旋转方向,[1]为X轴前后,[2]为Y轴左右
float[] R = new float[9];
SensorManager.getRotationMatrix(R, null, accelerometerValues,
magneticFieldValues);
SensorManager.getOrientation(R, values);//加速度传感器和磁场传感器矩阵方向坐标转换
values[0] = (float) Math.toDegrees(values[0]);//度数转换
float x = values[0];
if (x!=0f&&Math.abs(x - lastX) > 2.0) {//设置触发监听事件的方向改变阈值
onOrientationListener.onOrientationChanged(x);
}
lastX = x;
}
/**
* @param @param onOrientationListener
* @return void
* @Description 设置监听事件
*/
public void setOnOrientationListener(
OnOrientationListener onOrientationListener) {
this.onOrientationListener = onOrientationListener;
}
/**
* @ClassName OnOrientationListener
* @Description 内部监听器接口及回调方法声明
*/
public interface OnOrientationListener {
void onOrientationChanged(float x);
}
}
| [
"oxygen0106@163.com"
] | oxygen0106@163.com |
4dce0af6ec50318019dcf425200e45b45841c767 | 2eac2e7fea4b87e4a4ed269d224edecd7d0a42e1 | /server/src/test/java/com/cyanspring/server/bt/ExchangeBtLevelTwoSellOrderTest.java | 29d24de72e80183d96a9568dc19bedd2c5b858f3 | [
"BSD-2-Clause"
] | permissive | MarvelFisher/midas | 0c0b2f0f8e75a1bf6c9e998b5a48aca5b447b630 | c3fa256d491abc54cdc83949efa82d475c24e55b | refs/heads/master | 2021-01-19T10:34:50.539982 | 2017-02-17T15:16:44 | 2017-02-17T15:16:44 | 82,187,760 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 22,956 | java | package com.cyanspring.server.bt;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import org.junit.Test;
import webcurve.util.PriceUtils;
import com.cyanspring.common.Default;
import com.cyanspring.common.business.ChildOrder;
import com.cyanspring.common.business.OrderField;
import com.cyanspring.common.downstream.DownStreamException;
import com.cyanspring.common.marketdata.Quote;
import com.cyanspring.common.type.ExchangeOrderType;
import com.cyanspring.common.type.ExecType;
import com.cyanspring.common.type.OrdStatus;
import com.cyanspring.common.type.OrderSide;
import com.cyanspring.common.type.QtyPrice;
public class ExchangeBtLevelTwoSellOrderTest extends ExchangeBtOrderTest {
@Test
public void testFullyFilled() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.2);
quote.setBidVol(40000);
quote.getBids().add(new QtyPrice(40000, 68.2));
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 2000, 68.1, ExchangeOrderType.LIMIT,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.FILLED));
assertTrue(orderAck.order.getCumQty() == order.getQuantity());
assertTrue(orderAck.order.getAvgPx() == 68.2);
assertTrue(PriceUtils.Equal(quote.getBidVol(), 38000));
assertTrue(PriceUtils.Equal(quote.getBids().get(0).getQuantity(), 38000));
}
@Test
public void testPartiallyFilled() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.2);
quote.setBidVol(40000);
quote.getBids().add(new QtyPrice(40000, 68.2));
double BidVol = quote.getBidVol();
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 80000, 68.1, ExchangeOrderType.LIMIT,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.PARTIALLY_FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.PARTIALLY_FILLED));
assertTrue(orderAck.order.getCumQty() == BidVol);
assertTrue(orderAck.order.getAvgPx() == 68.2);
assertTrue(PriceUtils.Equal(quote.getBidVol(), 0));
assertTrue(quote.getBids().size() == 0);
}
@Test
public void testLatePartiallyFilled() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.3);
quote.setBidVol(40000);
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 80000, 68.4, ExchangeOrderType.LIMIT,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
assertTrue(orderAck.order.getCumQty() == 0);
quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.1);
quote.setBidVol(40000);
double BidVol = quote.getBidVol();
quote.getBids().add(new QtyPrice(40000, 68.5));
exchange.setQuote(quote);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.PARTIALLY_FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.PARTIALLY_FILLED));
assertTrue(orderAck.order.getCumQty() == BidVol);
assertTrue(orderAck.order.getAvgPx() == 68.4);
assertTrue(PriceUtils.Equal(quote.getBidVol(), 0));
assertTrue(quote.getBids().size() == 0);
}
@Test
public void testLateFullyFilled() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.3);
quote.setBidVol(40000);
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 80000, 68.4, ExchangeOrderType.LIMIT,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
assertTrue(orderAck.order.getCumQty() == 0);
quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.2);
quote.setBidVol(120000);
double BidVol = quote.getBidVol();
quote.getBids().add(new QtyPrice(120000, 68.5));
exchange.setQuote(quote);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.FILLED));
assertTrue(orderAck.order.getCumQty() == order.getQuantity());
assertTrue(PriceUtils.Equal(quote.getBidVol(), BidVol - order.getQuantity()));
assertTrue(quote.getBids().size() == 1);
assertTrue(PriceUtils.Equal(quote.getBids().get(0).getQuantity(), BidVol - order.getQuantity()));
assertTrue(PriceUtils.Equal(quote.getBids().get(0).getPrice(), quote.getBid()));
}
@Test
public void testLimitOrderMultipleFilled() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.2);
quote.setBidVol(40000);
quote.getBids().add(new QtyPrice(40000, 68.2));
quote.getBids().add(new QtyPrice(20000, 68.1));
quote.getBids().add(new QtyPrice(80000, 68.0));
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 80000, 68.0, ExchangeOrderType.LIMIT,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
assertTrue(orderAck.order.getCumQty() == 0);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.PARTIALLY_FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.PARTIALLY_FILLED));
assertTrue(orderAck.order.getCumQty() == 40000);
assertTrue(orderAck.order.getAvgPx() == 68.2);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.PARTIALLY_FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.PARTIALLY_FILLED));
assertTrue(orderAck.order.getCumQty() == 60000);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.FILLED));
assertTrue(orderAck.order.getCumQty() == 80000);
assertTrue(PriceUtils.Equal(quote.getBidVol(), 60000));
assertTrue(PriceUtils.Equal(quote.getBid(), 68.0));
assertTrue(quote.getBids().size() == 1);
assertTrue(PriceUtils.Equal(quote.getBids().get(0).getQuantity(), 60000));
assertTrue(PriceUtils.Equal(quote.getBids().get(0).getPrice(), 68.0));
}
@Test
public void testAmendOrder() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.3);
quote.setBidVol(40000);
quote.getBids().add(new QtyPrice(40000, 68.3));
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 80000, 68.4, ExchangeOrderType.LIMIT,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
assertTrue(orderAck.order.getCumQty() == 0);
Map<String, Object> changes = new HashMap<String, Object>();
changes.put(OrderField.QUANTITY.value(), 2000.0);
changes.put(OrderField.PRICE.value(), 68.5);
sender.amendOrder(order, changes);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.REPLACE));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.REPLACED));
assertTrue(2000.0 == orderAck.order.getQuantity());
assertTrue(68.5 == orderAck.order.getPrice());
}
@Test
public void testAmendOrderFilled() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.3);
quote.setBidVol(40000);
quote.getBids().add(new QtyPrice(40000, 68.3));
double BidVol = quote.getBidVol();
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 80000, 68.4, ExchangeOrderType.LIMIT,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
assertTrue(orderAck.order.getCumQty() == 0);
Map<String, Object> changes = new HashMap<String, Object>();
changes.put(OrderField.QUANTITY.value(), 2000.0);
changes.put(OrderField.PRICE.value(), 68.3);
sender.amendOrder(order, changes);
// second last ack
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.REPLACE));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.REPLACED));
assertTrue(2000.0 == orderAck.order.getQuantity());
assertTrue(68.3 == orderAck.order.getPrice());
// last ack
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.FILLED));
assertTrue(orderAck.order.getCumQty() == orderAck.order.getQuantity());
assertTrue(PriceUtils.Equal(quote.getBidVol(), BidVol - order.getQuantity()));
assertTrue(quote.getBids().size() == 1);
assertTrue(PriceUtils.Equal(quote.getBids().get(0).getQuantity(), BidVol - order.getQuantity()));
assertTrue(PriceUtils.Equal(quote.getBids().get(0).getPrice(), quote.getBid()));
}
@Test
public void testAmendOrderNoFilled() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.3);
quote.setBidVol(40000);
quote.getBids().add(new QtyPrice(40000, 68.3));
double BidVol = quote.getBidVol();
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 80000, 68.4, ExchangeOrderType.LIMIT,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
assertTrue(orderAck.order.getCumQty() == 0);
Map<String, Object> changes = new HashMap<String, Object>();
changes.put(OrderField.PRICE.value(), 68.5);
sender.amendOrder(order, changes);
// second last ack
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.REPLACE));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.REPLACED));
assertTrue(68.5 == orderAck.order.getPrice());
// last ack
orderAck = popFirstOrderAck();
assertTrue(orderAck == null);
assertTrue(PriceUtils.Equal(quote.getBidVol(), BidVol));
assertTrue(quote.getBids().size() == 1);
assertTrue(PriceUtils.Equal(quote.getBids().get(0).getQuantity(), BidVol));
assertTrue(PriceUtils.Equal(quote.getBids().get(0).getPrice(), quote.getBid()));
}
@Test
public void testAmendOrderPartiallyFilled() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.3);
quote.setBidVol(40000);
quote.getBids().add(new QtyPrice(40000, 68.3));
double BidVol = quote.getBidVol();
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 80000, 68.4, ExchangeOrderType.LIMIT,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
assertTrue(orderAck.order.getCumQty() == 0);
Map<String, Object> changes = new HashMap<String, Object>();
changes.put(OrderField.PRICE.value(), 68.3);
sender.amendOrder(order, changes);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.REPLACE));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.REPLACED));
assertTrue(68.3 == orderAck.order.getPrice());
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.PARTIALLY_FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.PARTIALLY_FILLED));
assertTrue(orderAck.order.getCumQty() == BidVol);
new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.3);
quote.setBidVol(40000);
quote.getBids().add(new QtyPrice(40000, 68.3));
exchange.setQuote(quote);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.FILLED));
assertTrue(orderAck.order.getCumQty() == orderAck.order.getQuantity());
assertTrue(PriceUtils.Equal(quote.getBidVol(), 0));
assertTrue(quote.getBids().size() == 0);
}
@Test
public void testMultipleOrderFilled() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.3);
quote.setBidVol(40000);
quote.getBids().add(new QtyPrice(40000, 68.3));
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 80000, 68.4, ExchangeOrderType.LIMIT,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
assertTrue(orderAck.order.getQuantity() == order.getQuantity());
assertTrue(orderAck.order.getCumQty() == 0);
order = new ChildOrder("0005.HK", OrderSide.Sell, 40000, 68.45, ExchangeOrderType.LIMIT,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
assertTrue(orderAck.order.getCumQty() == 0);
assertTrue(orderAck.order.getQuantity() == order.getQuantity());
quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.5);
quote.setBidVol(100000);
quote.getBids().add(new QtyPrice(100000, 68.5));
exchange.setQuote(quote);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.FILLED));
assertTrue(orderAck.order.getAvgPx() == 68.4);
assertTrue(orderAck.order.getCumQty() == 80000);
assertTrue(orderAck.order.getQuantity() == 80000);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.PARTIALLY_FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.PARTIALLY_FILLED));
assertTrue(orderAck.order.getAvgPx() == 68.45);
assertTrue(orderAck.order.getCumQty() == 20000);
assertTrue(orderAck.order.getQuantity() == 40000);
assertTrue(PriceUtils.Equal(quote.getBidVol(), 0));
assertTrue(quote.getBids().size() == 0);
}
@Test
public void testCancelOrder() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.3);
quote.setBidVol(40000);
quote.getBids().add(new QtyPrice(40000, 68.3));
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 80000, 68.4, ExchangeOrderType.LIMIT,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
assertTrue(orderAck.order.getQuantity() == order.getQuantity());
assertTrue(orderAck.order.getCumQty() == 0);
sender.cancelOrder(order);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.CANCELED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.CANCELED));
assertTrue(orderAck.order.getQuantity() == order.getQuantity());
assertTrue(orderAck.order.getCumQty() == 0);
}
@Test
public void testCancelOrderReject() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.3);
quote.setBidVol(40000);
quote.getBids().add(new QtyPrice(40000, 68.3));
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 80000, 68.4, ExchangeOrderType.LIMIT,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
assertTrue(orderAck.order.getQuantity() == order.getQuantity());
assertTrue(orderAck.order.getCumQty() == 0);
order = new ChildOrder("0005.HK", OrderSide.Sell, 80000, 68.2, ExchangeOrderType.LIMIT,
"", "", Default.getUser(), Default.getAccount(), null);
sender.cancelOrder(order);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.REJECTED));
}
@Test
public void testMarketOrderPartiallyFilled() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.3);
quote.setBidVol(40000);
quote.getBids().add(new QtyPrice(40000, 68.3));
double BidVol = quote.getBidVol();
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 80000, 0, ExchangeOrderType.MARKET,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
assertTrue(orderAck.order.getQuantity() == order.getQuantity());
assertTrue(orderAck.order.getCumQty() == 0);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.PARTIALLY_FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.PARTIALLY_FILLED));
assertTrue(orderAck.order.getCumQty() == BidVol);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.CANCELED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.CANCELED));
assertTrue(PriceUtils.Equal(quote.getBidVol(), 0));
assertTrue(quote.getBids().size() == 0);
}
@Test
public void testMarketOrderFullyFilled() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.3);
quote.setBidVol(40000);
quote.getBids().add(new QtyPrice(40000, 68.3));
double BidVol = quote.getBidVol();
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 20000, 0, ExchangeOrderType.MARKET,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
assertTrue(orderAck.order.getQuantity() == order.getQuantity());
assertTrue(orderAck.order.getCumQty() == 0);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.FILLED));
assertTrue(orderAck.order.getCumQty() == orderAck.order.getQuantity());
orderAck = popFirstOrderAck();
assertTrue(orderAck == null);
assertTrue(PriceUtils.Equal(quote.getBidVol(), BidVol - order.getQuantity()));
assertTrue(quote.getBids().size() == 1);
assertTrue(PriceUtils.Equal(quote.getBids().get(0).getQuantity(), BidVol - order.getQuantity()));
}
@Test
public void testMarketOrderMultipleFilled() throws DownStreamException {
Quote quote = new Quote("0005.HK", new LinkedList<QtyPrice>(), new LinkedList<QtyPrice>());
quote.setBid(68.3);
quote.setBidVol(40000);
quote.getBids().add(new QtyPrice(40000, 68.2));
quote.getBids().add(new QtyPrice(20000, 68.3));
quote.getBids().add(new QtyPrice(80000, 68.4));
exchange.setQuote(quote);
ChildOrder order = new ChildOrder("0005.HK", OrderSide.Sell, 80000, 0, ExchangeOrderType.MARKET,
"", "", Default.getUser(), Default.getAccount(), null);
sender.newOrder(order);
OrderAck orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.NEW));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.NEW));
assertTrue(orderAck.order.getCumQty() == 0);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.PARTIALLY_FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.PARTIALLY_FILLED));
assertTrue(orderAck.order.getCumQty() == 40000);
assertTrue(orderAck.order.getAvgPx() == 68.2);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.PARTIALLY_FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.PARTIALLY_FILLED));
assertTrue(orderAck.order.getCumQty() == 60000);
orderAck = popFirstOrderAck();
assertTrue(orderAck.execType.equals(ExecType.FILLED));
assertTrue(orderAck.order.getOrdStatus().equals(OrdStatus.FILLED));
assertTrue(orderAck.order.getCumQty() == 80000);
assertTrue(PriceUtils.Equal(quote.getBidVol(), 60000));
assertTrue(PriceUtils.Equal(quote.getBid(), 68.4));
assertTrue(quote.getBids().size() == 1);
assertTrue(PriceUtils.Equal(quote.getBids().get(0).getQuantity(), 60000));
assertTrue(PriceUtils.Equal(quote.getBids().get(0).getPrice(), 68.4));
}
}
| [
"dennis.chen@hkfdt.com"
] | dennis.chen@hkfdt.com |
7898eba0a396992b0e9c341b0d553cc7b5563397 | 2067235a11aecc2f5af13ffeaa0f90c2bec2080e | /src/NaveenLeapYear.java | 2b18a545f640a1913111ff49e27eab23fe2635fb | [] | no_license | vhmethre/Java-Practice | 67be2c30afea0308d85bdfe912cf3ab11b3c21ad | 92e9e521f15c54f4006f3d812a2e9ad710785d08 | refs/heads/master | 2023-08-30T06:55:49.360486 | 2021-10-25T13:56:49 | 2021-10-25T13:56:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java |
public class NaveenLeapYear {
public static void main(String[] args) {
// TODO Auto-generated method stub
int num = 2020;
if (num % 4 == 0) {
System.out.println("The given number is Leap year");
} else {
System.out.println("The given number is not an Leap year");
}
}
}
| [
"vhmethre@gmail.com"
] | vhmethre@gmail.com |
70301af1016097366ad4616c3aae6ca36f419456 | 9fc7f217c1ad1173086cbcee297c2e26da9da2fd | /src/main/java/br/com/byron/luderia/domain/filter/UserFilter.java | 54c656fd8e2eb07a5b57bd82d636e6cbb42eb1a3 | [] | no_license | byron-codes/Luderia | ec5f1c0fa2d619f81ea43811eb59cbbb2f2fbc8e | 7f148fc855a86c3570d9b8b3bc7004b6784dc930 | refs/heads/master | 2022-11-16T16:47:25.791506 | 2020-07-11T16:56:21 | 2020-07-11T16:56:21 | 236,067,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 157 | java | package br.com.byron.luderia.domain.filter;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class UserFilter extends GenericFilter {
}
| [
"vinicius.moraes@iteris.com.br"
] | vinicius.moraes@iteris.com.br |
dfb9fd2d138bf0f01bbc16ea355a7769106aa255 | c289f1ab4f56db1c386f699d5ec9942845eae443 | /Ficha 5/Ex5/src/DoubleLinkedUnordered/DoublyLinkedList.java | 66f9fdecec663bd44662a7fe5bcac23e81b0885a | [] | no_license | MoreiraJorge/Data-Structures-Java | bb41e1ceadfd844ed3cb42ec9e6e0dccc3ac0c15 | 79cec4ede9618cda2648de066f0ef316c13c784e | refs/heads/master | 2022-12-14T12:51:27.250950 | 2020-09-17T15:27:03 | 2020-09-17T15:27:03 | 213,029,143 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,889 | java | package DoubleLinkedUnordered;
import Interfaces.ListADT;
import java.util.Iterator;
public class DoublyLinkedList<T> implements ListADT<T> {
private class DoublyLinkedListIterator<T> implements Iterator<T> {
private int expectedModCount = modCount;
private DoubleNode<T> current = (DoubleNode<T>) head;
@Override
public boolean hasNext() {
if (current != null) {
return true;
}
return false;
}
@Override
public T next() {
if (hasNext()) {
T tmp = current.getElement();
current = current.getNext();
return tmp;
}
throw new ArrayIndexOutOfBoundsException();
}
}
protected DoubleNode<T> head, tail;
protected int size = 0;
protected int modCount = 0;
public DoublyLinkedList() {
this.head = null;
this.tail = null;
}
@Override
public T removeFirst() {
if(isEmpty()){
return null;
} else if(size() == 1){
T tmp = (T) this.head;
this.head = null;
this.tail = null;
size--;
return tmp;
} else {
T tmp = (T) this.head;
this.head = this.head.getNext();
this.head.setPrevious(null);
size--;
return tmp;
}
}
@Override
public T removeLast() {
if(isEmpty()){
return null;
} else if(size() == 1){
T tmp = (T) this.tail;
this.tail = null;
this.head = this.tail;
size--;
return tmp;
} else {
T tmp = (T) this.tail;
this.tail = tail.getPrevious();
tail.setNext(null);
size--;
return tmp;
}
}
@Override
public T remove(T element) {
if (isEmpty() == true) {
return null;
}
DoubleNode<T> tmp = search(element);
if(tmp != null) {
if (this.head == tmp || size() == 1) {
return removeFirst();
} else if (this.tail == tmp) {
return removeLast();
} else {
tmp.getNext().setPrevious(tmp.getPrevious());
tmp.getNext().getPrevious().setNext(tmp.getNext());
}
size--;
return tmp.getElement();
}
return null;
}
@Override
public T first() {
if(isEmpty()){
return null;
}
return head.getElement();
}
@Override
public T last() {
if(isEmpty()){
return null;
}
return tail.getElement();
}
@Override
public boolean contains(T target) {
return (search(target) == target);
}
@Override
public boolean isEmpty() {
return (size() == 0);
}
@Override
public int size() {
return this.size;
}
@Override
public Iterator<T> iterator() {
Iterator<T> itr = new DoublyLinkedListIterator<T>();
return itr;
}
private DoubleNode<T> search(T target) {
DoubleNode<T> current = this.head;
if (isEmpty() == true) {
return null;
}
while (current != null) {
if (current.getElement() == target) {
return current;
} else {
current = current.getNext();
}
}
return null;
}
@Override
public String toString() {
String text = "";
Iterator<T> it = new DoublyLinkedListIterator<T>();
if (isEmpty()) {
return null;
}
while (it.hasNext()) {
text += it.next().toString() + "\n";
}
return text;
}
}
| [
"8160297@estg.ipp.pt"
] | 8160297@estg.ipp.pt |
3dfa1bcbf4782beb2c0bb18623b67abdfe77d597 | f1b0cb5b3838857e9d77690ffaa1c166a07e22b0 | /trifu/AplicatieInCrys/src/Clase/CerereTraining.java | 619e0122a67131a8c6b95ccc7c85f001f7fb551f | [] | no_license | radianghe/TMA | 45814e1208e040f3d79c9329f5fc2db7c3c64722 | c349bd75f278e26f12e53c39069d8f19f5416f78 | refs/heads/Workbench | 2020-12-04T20:08:16.727074 | 2016-09-20T11:24:13 | 2016-09-20T11:24:13 | 67,406,656 | 0 | 1 | null | 2016-09-20T11:10:08 | 2016-09-05T09:21:25 | HTML | UTF-8 | Java | false | false | 3,378 | java | package Clase;
public class CerereTraining {
private String numeTl;
private String numeUser;
private String prenumeUser;
private String tipTraining;
private String numeCurs;
private String numeProvider;
private String monedaCurs;
private float costCurs;
private int anCurs;
private int nrZileCurs;
private String perioada;
private String tipCurs;
private String desfasurareCurs;
private String suportCurs;
private String mailUser;
private String status;
public CerereTraining(String numeTl, String numeUser, String prenumeUser, String tipTraining, String numeCurs,
String numeProvider, String monedaCurs, float costCurs, int anCurs, int nrZileCurs, String perioada,
String tipCurs, String desfasurareCurs, String suportCurs, String mailUser) {
super();
this.numeTl = numeTl;
this.numeUser = numeUser;
this.prenumeUser = prenumeUser;
this.tipTraining = tipTraining;
this.numeCurs = numeCurs;
this.numeProvider = numeProvider;
this.monedaCurs = monedaCurs;
this.costCurs = costCurs;
this.anCurs = anCurs;
this.nrZileCurs = nrZileCurs;
this.perioada = perioada;
this.tipCurs = tipCurs;
this.desfasurareCurs = desfasurareCurs;
this.suportCurs = suportCurs;
this.mailUser = mailUser;
}
public String getNumeTl() {
return numeTl;
}
public void setNumeTl(String numeTl) {
this.numeTl = numeTl;
}
public String getNumeUser() {
return numeUser;
}
public void setNumeUser(String numeUser) {
this.numeUser = numeUser;
}
public String getPrenumeUser() {
return prenumeUser;
}
public void setPrenumeUser(String prenumeUser) {
this.prenumeUser = prenumeUser;
}
public String getTipTraining() {
return tipTraining;
}
public void setTipTraining(String tipTraining) {
this.tipTraining = tipTraining;
}
public String getNumeCurs() {
return numeCurs;
}
public void setNumeCurs(String numeCurs) {
this.numeCurs = numeCurs;
}
public String getNumeProvider() {
return numeProvider;
}
public void setNumeProvider(String numeProvider) {
this.numeProvider = numeProvider;
}
public String getMonedaCurs() {
return monedaCurs;
}
public void setMonedaCurs(String monedaCurs) {
this.monedaCurs = monedaCurs;
}
public float getCostCurs() {
return costCurs;
}
public void setCostCurs(float costCurs) {
this.costCurs = costCurs;
}
public int getAnCurs() {
return anCurs;
}
public void setAnCurs(int anCurs) {
this.anCurs = anCurs;
}
public int getNrZileCUrs() {
return nrZileCurs;
}
public void setNrZileCUrs(int nrZileCUrs) {
this.nrZileCurs = nrZileCUrs;
}
public String getPerioada() {
return perioada;
}
public void setPerioada(String perioada) {
this.perioada = perioada;
}
public String getTipCurs() {
return tipCurs;
}
public void setTipCurs(String tipCurs) {
this.tipCurs = tipCurs;
}
public String getDesfasurareCurs() {
return desfasurareCurs;
}
public void setDesfasurareCurs(String desfasurareCurs) {
this.desfasurareCurs = desfasurareCurs;
}
public String getSuportCurs() {
return suportCurs;
}
public void setSuportCurs(String suportCurs) {
this.suportCurs = suportCurs;
}
public String getMailUser() {
return mailUser;
}
public void setMailUser(String mailUser) {
this.mailUser = mailUser;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
| [
"alexandru.trifu7@gmail.com"
] | alexandru.trifu7@gmail.com |
ff594dd5bd9e9917ab0098adb97ed68f6f0400d7 | 9923a38ac9f12507c16c761e7b304b833d3f0c66 | /src/EvenNumbers.java | ac6c1dc46de1064a6333c86199728748b115d8c1 | [] | no_license | DzhalunIvan/Hillel | b3f1e3f5cc9171c366298e50192ea80b5cceb5c1 | a271fd636d8a87fbb7f47bc848b88fa403c50d4b | refs/heads/master | 2022-11-20T08:25:55.466185 | 2020-07-08T18:57:34 | 2020-07-08T18:57:34 | 260,300,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 561 | java | import java.util.Scanner;
public class EvenNumbers {
public static void main(String[] args) {
System.out.println("Please enter the number");
Scanner scanner = new Scanner(System.in);
while (!scanner.hasNextDouble()) {
System.out.println("Wrong input! Please, try again");
scanner.next();
}
int x1 = scanner.nextInt();
if (x1%2==0){
System.out.printf("Number %d is even",x1);
}
else {
System.out.printf("Number %d is odd",x1);
}
}
}
| [
"swildua@gmail.com"
] | swildua@gmail.com |
65c7e615dc6928541d23f542d8cd0226a1d060c3 | 552aca759cf800ffd8b721ec07781d3d6eee9c44 | /wire-schema/src/test/java/com/squareup/wire/schema/IdentifierSetTest.java | a58ef7e195a53cc317101fb3a55e79128b0f8fb6 | [
"Apache-2.0"
] | permissive | killagu/wire | 200a1c58c7c170eb1b8a408fd05968b6c98b4d66 | 6cc18b6da585f61c03ea95b87396d90e732ba59d | refs/heads/master | 2020-04-08T15:21:26.344885 | 2018-11-26T18:26:48 | 2018-11-26T18:26:48 | 159,474,967 | 0 | 0 | Apache-2.0 | 2018-11-28T09:17:26 | 2018-11-28T09:17:26 | null | UTF-8 | Java | false | false | 10,223 | java | /*
* Copyright (C) 2015 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.squareup.wire.schema;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public final class IdentifierSetTest {
@Test public void enclosing() throws Exception {
assertThat(IdentifierSet.enclosing("a.b.Outer#member")).isEqualTo("a.b.Outer");
assertThat(IdentifierSet.enclosing("a.b.Outer")).isEqualTo("a.b.*");
assertThat(IdentifierSet.enclosing("a.b.*")).isEqualTo("a.*");
assertThat(IdentifierSet.enclosing("a.*")).isNull();
}
@Test public void enclosingOnNestedClass() throws Exception {
assertThat(IdentifierSet.enclosing("a.b.Outer.Inner#member")).isEqualTo("a.b.Outer.Inner");
assertThat(IdentifierSet.enclosing("a.b.Outer.Inner")).isEqualTo("a.b.Outer.*");
assertThat(IdentifierSet.enclosing("a.b.Outer.*")).isEqualTo("a.b.*");
}
@Test public void empty() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.build();
assertThat(policy(set, "a.b.Message")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.b.Message#member")).isEqualTo(Policy.INCLUDED);
}
/** Note that including a type includes nested members, but not nested types. */
@Test public void includeType() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.include("a.b.Message")
.build();
assertThat(policy(set, "a.b.Message")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.b.Message#member")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.b.Message.Nested")).isEqualTo(Policy.UNSPECIFIED);
assertThat(policy(set, "a.b.Another")).isEqualTo(Policy.UNSPECIFIED);
assertThat(policy(set, "a.b.Another#member")).isEqualTo(Policy.UNSPECIFIED);
}
@Test public void includeMember() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.include("a.b.Message#member")
.build();
assertThat(policy(set, "a.b.Message")).isEqualTo(Policy.UNSPECIFIED);
assertThat(policy(set, "a.b.Message.Nested")).isEqualTo(Policy.UNSPECIFIED);
assertThat(policy(set, "a.b.Message#member")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.b.Message#other")).isEqualTo(Policy.UNSPECIFIED);
assertThat(policy(set, "a.b.Another")).isEqualTo(Policy.UNSPECIFIED);
assertThat(policy(set, "a.b.Another#member")).isEqualTo(Policy.UNSPECIFIED);
}
@Test public void includePackage() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.include("a.b.*")
.build();
assertThat(policy(set, "a.b.Message")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.b.Message#member")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.b.c.Message")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.b.c.Message#member")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.c.Another")).isEqualTo(Policy.UNSPECIFIED);
assertThat(policy(set, "a.c.Another#member")).isEqualTo(Policy.UNSPECIFIED);
}
@Test public void excludeType() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.exclude("a.b.Message")
.build();
assertThat(policy(set, "a.b.Message")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.b.Message#member")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.b.Another")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.b.Another#member")).isEqualTo(Policy.INCLUDED);
}
@Test public void excludeMember() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.exclude("a.b.Message#member")
.build();
assertThat(policy(set, "a.b.Message")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.b.Message#member")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.b.Message#other")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.b.Another")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.b.Another#member")).isEqualTo(Policy.INCLUDED);
}
@Test public void excludePackage() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.exclude("a.b.*")
.build();
assertThat(policy(set, "a.b.Message")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.b.Message#member")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.b.c.Message")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.b.c.Message#member")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.c.Another")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.c.Another#member")).isEqualTo(Policy.INCLUDED);
}
@Test public void excludePackageTakesPrecedenceOverIncludeType() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.exclude("a.b.*")
.include("a.b.Message")
.build();
assertThat(policy(set, "a.b.Message")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.b.Message#member")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.b.Another")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.b.Another#member")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.c.YetAnother")).isEqualTo(Policy.UNSPECIFIED);
assertThat(policy(set, "a.c.YetAnother#member")).isEqualTo(Policy.UNSPECIFIED);
}
@Test public void excludeTypeTakesPrecedenceOverIncludeMember() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.exclude("a.b.Message")
.include("a.b.Message#member")
.build();
assertThat(policy(set, "a.b.Message")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.b.Message#member")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.b.Message#other")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.b.Another")).isEqualTo(Policy.UNSPECIFIED);
assertThat(policy(set, "a.b.Another#member")).isEqualTo(Policy.UNSPECIFIED);
}
@Test public void excludeMemberTakesPrecedenceOverIncludeType() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.exclude("a.b.Message#member")
.include("a.b.Message")
.build();
assertThat(policy(set, "a.b.Message")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.b.Message#member")).isEqualTo(Policy.EXCLUDED);
assertThat(policy(set, "a.b.Message#other")).isEqualTo(Policy.INCLUDED);
assertThat(policy(set, "a.b.Another")).isEqualTo(Policy.UNSPECIFIED);
assertThat(policy(set, "a.b.Another#member")).isEqualTo(Policy.UNSPECIFIED);
}
@Test public void trackingUnusedIncludes() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.include("a.*")
.include("b.IncludedType")
.include("c.IncludedMember#member")
.build();
assertThat(set.unusedIncludes()).containsExactly(
"a.*", "b.IncludedType", "c.IncludedMember#member");
set.includes(ProtoType.get("a.*"));
assertThat(set.unusedIncludes()).containsExactly(
"b.IncludedType", "c.IncludedMember#member");
set.includes(ProtoType.get("b.IncludedType"));
assertThat(set.unusedIncludes()).containsExactly(
"c.IncludedMember#member");
set.includes(ProtoMember.get("c.IncludedMember#member"));
assertThat(set.unusedIncludes()).isEmpty();
}
@Test public void trackingUnusedExcludes() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.exclude("a.*")
.exclude("b.ExcludedType")
.exclude("c.ExcludedMember#member")
.build();
assertThat(set.unusedExcludes()).containsExactly(
"a.*", "b.ExcludedType", "c.ExcludedMember#member");
set.includes(ProtoType.get("a.*"));
assertThat(set.unusedExcludes()).containsExactly(
"b.ExcludedType", "c.ExcludedMember#member");
set.includes(ProtoType.get("b.ExcludedType"));
assertThat(set.unusedExcludes()).containsExactly(
"c.ExcludedMember#member");
set.includes(ProtoMember.get("c.ExcludedMember#member"));
assertThat(set.unusedExcludes()).isEmpty();
}
@Test public void trackingUnusedIncludesPrecedence() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.include("a.*")
.include("a.IncludedType")
.build();
set.includes(ProtoMember.get("a.IncludedType#member"));
assertThat(set.unusedIncludes()).containsExactly("a.IncludedType");
}
@Test public void trackingUnusedExcludesPrecedence() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.exclude("a.*")
.exclude("a.IncludedType")
.build();
set.includes(ProtoMember.get("a.IncludedType#member"));
assertThat(set.unusedExcludes()).containsExactly("a.IncludedType");
}
@Test public void trackingUnusedPrecedence() throws Exception {
IdentifierSet set = new IdentifierSet.Builder()
.include("a.*")
.exclude("a.*")
.build();
set.includes(ProtoType.get("a.Message"));
assertThat(set.unusedExcludes()).isEmpty();
assertThat(set.unusedIncludes()).containsExactly("a.*");
}
private Policy policy(IdentifierSet set, String identifier) {
if (identifier.contains("#")) {
ProtoMember protoMember = ProtoMember.get(identifier);
if (set.includes(protoMember)) return Policy.INCLUDED;
if (set.excludes(protoMember)) return Policy.EXCLUDED;
return Policy.UNSPECIFIED;
} else {
ProtoType protoType = ProtoType.get(identifier);
if (set.includes(protoType)) return Policy.INCLUDED;
if (set.excludes(protoType)) return Policy.EXCLUDED;
return Policy.UNSPECIFIED;
}
}
enum Policy {
INCLUDED, UNSPECIFIED, EXCLUDED
}
}
| [
"jwilson@squareup.com"
] | jwilson@squareup.com |
a9a23662c5154023b4148a0e779610e6818a41d0 | 406fdf2d53cd4fa7443129cd672f4ccc6282dec8 | /item-impl/src/main/java/org/ecommerce/item/impl/AbstractItemState.java | d5dc25c93e347ef82871a578e0f263ee7d645550 | [
"Apache-2.0"
] | permissive | arber77/4DV609-eCommerce | af4e1db5627598cb62eec79d97d95bb96d320144 | 743dc288f1f33f51d7793e02b44ee5e48b394fde | refs/heads/master | 2021-06-05T11:12:39.964981 | 2016-11-14T16:12:06 | 2016-11-14T16:12:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 658 | java | package org.ecommerce.item.impl;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.lightbend.lagom.javadsl.immutable.ImmutableStyle;
import com.lightbend.lagom.serialization.Jsonable;
import org.ecommerce.item.api.CreateItemRequest;
import org.ecommerce.item.api.CreateItemResponse;
import org.ecommerce.item.api.Item;
import org.immutables.value.Value;
import java.time.LocalDateTime;
import java.util.Optional;
@Value.Immutable
@ImmutableStyle
@JsonDeserialize
public interface AbstractItemState extends Jsonable {
@Value.Parameter
Optional<Item> getItem();
@Value.Parameter
LocalDateTime getTimestamp();
}
| [
"ah.mousavi@hotmail.com"
] | ah.mousavi@hotmail.com |
17d9a0c8c659a3a47b01c67d4c1883a361a0356a | ca576d8c9e0e7c7d03e1e93061ede277f72d0ed3 | /smart-services/service-core/src/main/java/com/sct/service/core/web/support/collection/ResultVOEntity.java | 1eaf5c06fcaf8bbe8df99ab68c122423b727c0e3 | [
"Apache-2.0"
] | permissive | hubeixiang/smart-city | f73d6932fb81f300c9cbb83763a7e8c868177d8d | ff178d300da40d22bfd09d067c5fe6c615a30c98 | refs/heads/develop | 2023-03-13T06:24:26.370445 | 2021-03-01T07:35:36 | 2021-03-01T07:35:36 | 310,278,160 | 4 | 4 | Apache-2.0 | 2021-01-02T13:58:48 | 2020-11-05T11:28:52 | Java | UTF-8 | Java | false | false | 956 | java | package com.sct.service.core.web.support.collection;
import java.util.ArrayList;
import java.util.List;
public class ResultVOEntity<E> implements ResultVO {
private List<String> columns = new ArrayList<>();
private List<E> data = new ArrayList<>();
public static <E> ResultVOEntity of() {
ResultVOEntity resultVOEntity = new ResultVOEntity();
return resultVOEntity;
}
public static <E> ResultVOEntity of(List<String> columns, List<E> data) {
ResultVOEntity resultVOEntity = ResultVOEntity.of();
resultVOEntity.setColumns(columns);
resultVOEntity.setData(data);
return resultVOEntity;
}
public List<String> getColumns() {
return columns;
}
public void setColumns(List<String> columns) {
this.columns = columns;
}
public List<E> getData() {
return data;
}
public void setData(List<E> data) {
this.data = data;
}
}
| [
"hubeixiang@aliyun.com"
] | hubeixiang@aliyun.com |
c25577ca3dc10e6efca64eea2e5b423b37230502 | c89cf58fe1499e49f558b8218d4c1f0e8f70ae1f | /Spring_Guru/spring5-mvc-rest-master/src/main/java/guru/springfamework/api/v1/model/CatorgoryListDTO.java | f5a1738f4988280854e60ebcd2405d1ef99c8c38 | [] | no_license | AsteRons/Java | 19f5efe80f87568a75aa775929c97ec553c70d62 | 63f4352aebd2cd8afa4b33795048f9a408c8d354 | refs/heads/master | 2022-03-01T15:59:32.469412 | 2020-05-25T14:47:10 | 2020-05-25T14:47:10 | 120,139,641 | 1 | 0 | null | 2022-02-09T23:46:24 | 2018-02-03T23:40:26 | Java | UTF-8 | Java | false | false | 217 | java | package guru.springfamework.api.v1.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
@Data
@AllArgsConstructor
public class CatorgoryListDTO {
List<CategoryDTO> categories;
}
| [
"maciej.rudnik2@gmail.com"
] | maciej.rudnik2@gmail.com |
3f31ba98019caaa85207bdfac4d2fcfc3e159580 | 7981034ce4b16511c55c16c81567cbbf4ccc459b | /MyApplication/app/src/main/java/com/example/myapplication/shop/ToastUtil.java | 3c11022105d58760aadb9315c8f32b697bf5a1ef | [] | no_license | gaoyingwei/MyApp | 5c6743de5656c1a2669ce4c124920153bd1da5c7 | 4abe3615aaa6fc74057963f44cc45de05f2a5193 | refs/heads/master | 2021-03-31T21:18:52.387607 | 2020-05-20T10:14:37 | 2020-05-20T10:14:37 | 248,132,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 686 | java | package com.example.myapplication.shop;
import android.content.Context;
import android.os.Handler;
import android.widget.Toast;
public class ToastUtil {
private static Toast mToast;
private static Handler mHandler = new Handler();
private static Runnable r = new Runnable() {
public void run() {
mToast.cancel();
}
};
public static void makeText(Context mContext, String text) {
mHandler.removeCallbacks(r);
if (mToast != null)
mToast.setText(text);
else
mToast = Toast.makeText(mContext, text, Toast.LENGTH_LONG);
mHandler.postDelayed(r, 2000);
mToast.show();
}
}
| [
"1874074246@qq.com"
] | 1874074246@qq.com |
7cf53706a675b5e5d62fa361316d37636066cc76 | bbe0779fb6770499ec430e999730d44e184a8e53 | /src/test/java/xyz/xiaopo/telegramBot/ApplicationTests.java | 406fdb9a206ef03de659b74ee6c5081fa726da14 | [] | no_license | xiao-po/telegram-bot-yande | 934a5762235e6516bc914abb6c99afb99d1ea31d | 2a82cf87987a1b37caf7141ede318f0ca2e08d2e | refs/heads/master | 2020-04-13T13:24:35.852067 | 2019-01-01T11:34:46 | 2019-01-01T11:34:46 | 163,229,357 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package xyz.xiaopo.telegramBot;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"wangluy@ipharmacare.net"
] | wangluy@ipharmacare.net |
cd2d70dfb4f43d6b9f59ae5b699927478c230663 | a45ba529c9373f082d494a30474c44140237a2ab | /dbadapter/src/main/java/com/adapter/dbadapter/repo/Dao.java | a9d25ed0c145950e2a116094a71e130083ae662e | [] | no_license | pavan-choudhary/restAdapter | d0706fa18ee22d48b80e5c5c8738c3b484308726 | fb40d1f6e32f9db5af692dcf51d1e59e57bc521d | refs/heads/master | 2022-04-06T07:41:45.716367 | 2020-02-27T16:29:53 | 2020-02-27T16:29:53 | 240,663,852 | 0 | 0 | null | 2020-02-15T07:33:06 | 2020-02-15T07:33:05 | null | UTF-8 | Java | false | false | 611 | java | package com.adapter.dbadapter.repo;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;
@SuppressWarnings("unchecked")
@Repository
public class Dao{
@Value("${query}") String query;
@PersistenceContext
EntityManager entityManager;
public List<String> getAll() {
List<String> results = entityManager.createNativeQuery("select CAST(row_to_json(row) as VARCHAR) from (" + query + ") row;").getResultList();
return results;
}
}
| [
"choudhary.pavan18@gmail.com"
] | choudhary.pavan18@gmail.com |
5f7a8ca12bf868f89f4772ad8902be88c0d8d9f5 | ec55cd5992609465076807360ff4032953450734 | /fuzhi.java | 6f52eb034b59272164fe11cf9e1dd7ca1365060e | [] | no_license | liqing69/java | c7148bfedd12321ca00dc6f4a481a1201830e57b | cbc2381eb77e93b137cf42bf800c8864788fb177 | refs/heads/master | 2016-09-05T16:48:19.366181 | 2013-11-19T10:51:58 | 2013-11-19T10:51:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 147 | java | <script type="text/javascript">
{
var x,y;
x=0;
y=12;
ducument.write(x+y=);
ducument.write("<br/>");
x=1;
y=90;
ducument.write(xy=);
}
</script>
| [
"921218132@qq.com"
] | 921218132@qq.com |
24b25e45cbb255fd654a2c8f0e613e5f81056f5b | 22ab12ab777e82cdb7f533cd5a07190e7b747401 | /src/main/java/mekanism/common/content/qio/QIOServerCraftingTransferHandler.java | 1db69beddb152e51f6f39ce0102febc79603addc | [
"MIT"
] | permissive | TehStoneMan/Mekanism | 5550fea83a60f7f77a6fda0e207cc2e65864dc93 | 24108d99ed37cebc90e08dd70169b8dc4d820379 | refs/heads/master | 2022-01-30T08:57:50.060438 | 2022-01-01T18:19:23 | 2022-01-01T18:19:23 | 33,217,796 | 0 | 0 | null | 2016-08-04T12:53:34 | 2015-04-01T00:32:42 | Java | UTF-8 | Java | false | false | 45,292 | java | package mekanism.common.content.qio;
import it.unimi.dsi.fastutil.bytes.Byte2ObjectArrayMap;
import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap;
import it.unimi.dsi.fastutil.bytes.Byte2ObjectMaps;
import it.unimi.dsi.fastutil.bytes.Byte2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2IntArrayMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2LongMap;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import javax.annotation.Nullable;
import mekanism.api.Action;
import mekanism.api.inventory.AutomationType;
import mekanism.api.math.MathUtils;
import mekanism.common.Mekanism;
import mekanism.common.content.qio.QIOCraftingTransferHelper.BaseSimulatedInventory;
import mekanism.common.content.qio.QIOCraftingTransferHelper.SingularHashedItemSource;
import mekanism.common.inventory.container.MekanismContainer;
import mekanism.common.inventory.container.QIOItemViewerContainer;
import mekanism.common.inventory.container.SelectedWindowData;
import mekanism.common.inventory.container.slot.HotBarSlot;
import mekanism.common.inventory.container.slot.InsertableSlot;
import mekanism.common.inventory.container.slot.MainInventorySlot;
import mekanism.common.inventory.slot.CraftingWindowInventorySlot;
import mekanism.common.lib.inventory.HashedItem;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.StackUtils;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ICraftingRecipe;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.items.ItemHandlerHelper;
/**
* Used for the server side transfer handling by the {@link mekanism.common.network.to_server.PacketQIOFillCraftingWindow}
*/
public class QIOServerCraftingTransferHandler {
private final QIOCraftingWindow craftingWindow;
private final ResourceLocation recipeID;
private final PlayerEntity player;
@Nullable
private final QIOFrequency frequency;
private final List<HotBarSlot> hotBarSlots;
private final List<MainInventorySlot> mainInventorySlots;
private final Byte2ObjectMap<SlotData> availableItems = new Byte2ObjectOpenHashMap<>();
private final Map<UUID, FrequencySlotData> frequencyAvailableItems = new HashMap<>();
private final NonNullList<ItemStack> recipeToTest = NonNullList.withSize(9, ItemStack.EMPTY);
public static void tryTransfer(QIOItemViewerContainer container, byte selectedCraftingGrid, PlayerEntity player, ResourceLocation recipeID,
ICraftingRecipe recipe, Byte2ObjectMap<List<SingularHashedItemSource>> sources) {
QIOServerCraftingTransferHandler transferHandler = new QIOServerCraftingTransferHandler(container, selectedCraftingGrid, player, recipeID);
transferHandler.tryTransfer(recipe, sources);
}
private QIOServerCraftingTransferHandler(QIOItemViewerContainer container, byte selectedCraftingGrid, PlayerEntity player, ResourceLocation recipeID) {
this.player = player;
this.recipeID = recipeID;
this.frequency = container.getFrequency();
this.craftingWindow = container.getCraftingWindow(selectedCraftingGrid);
this.hotBarSlots = container.getHotBarSlots();
this.mainInventorySlots = container.getMainInventorySlots();
}
private void tryTransfer(ICraftingRecipe recipe, Byte2ObjectMap<List<SingularHashedItemSource>> sources) {
//Calculate what items are available inside the crafting window and if they can be extracted as we will
// need to be able to extract the contents afterwards anyway
for (byte slot = 0; slot < 9; slot++) {
CraftingWindowInventorySlot inputSlot = craftingWindow.getInputSlot(slot);
if (!inputSlot.isEmpty()) {
ItemStack available = inputSlot.extractItem(inputSlot.getCount(), Action.SIMULATE, AutomationType.INTERNAL);
if (available.getCount() < inputSlot.getCount()) {
//TODO: Eventually it would be nice if we added in some support so that if an item is staying put in its crafting slot
// we don't actually need to do any validation of if it can be extracted from when it will just end up in the same spot anyways
// but for now this isn't that major of a concern as our slots don't actually have any restrictions on them in regards to extracting
Mekanism.logger.warn("Received transfer request from: {}, for: {}, and was unable to extract all items from crafting input slot: {}.",
player, recipeID, slot);
return;
}
availableItems.put(slot, new SlotData(available));
}
}
for (Byte2ObjectMap.Entry<List<SingularHashedItemSource>> entry : sources.byte2ObjectEntrySet()) {
byte targetSlot = entry.getByteKey();
if (targetSlot < 0 || targetSlot >= 9) {
Mekanism.logger.warn("Received transfer request from: {}, for: {}, with an invalid target slot id: {}.", player, recipeID, targetSlot);
return;
}
int stackSize = 0;
List<SingularHashedItemSource> singleSources = entry.getValue();
for (Iterator<SingularHashedItemSource> iter = singleSources.iterator(); iter.hasNext(); ) {
SingularHashedItemSource source = iter.next();
byte slot = source.getSlot();
int used;
if (slot == -1) {
used = simulateQIOSource(targetSlot, source.getQioSource(), source.getUsed(), stackSize);
} else {
used = simulateSlotSource(targetSlot, slot, source.getUsed(), stackSize);
}
if (used == -1) {
//Error occurred and was logged, exit
return;
} else if (used == 0) {
//Unable to use any of this source due to it not stacking with an earlier one for example
// remove this source
iter.remove();
} else {
if (used < source.getUsed()) {
//If we used less than we were expected to (most likely due to stack sizes) then we need
// to decrease the amount of the source being used
source.setUsed(used);
}
stackSize += used;
}
}
if (singleSources.isEmpty()) {
//There should always be at least one (the first source) that didn't get removed, but in case something went wrong,
// and it got removed anyway, then we catch it here and fail
Mekanism.logger.warn("Received transfer request from: {}, for: {}, that had no valid sources, this should not be possible.", player, recipeID);
return;
}
ItemStack resultItem = recipeToTest.get(targetSlot);
if (!resultItem.isEmpty() && resultItem.getMaxStackSize() < stackSize) {
//Note: This should never happen as if it would happen it should be caught in the above simulation and have the amount used reduced to not happen
Mekanism.logger.warn("Received transfer request from: {}, for: {}, that tried to transfer more items into: {} than can stack ({}) in one slot.",
player, recipeID, targetSlot, resultItem.getMaxStackSize());
return;
}
}
CraftingInventory dummy = MekanismUtils.getDummyCraftingInv();
for (int slot = 0; slot < 9; slot++) {
dummy.setItem(slot, StackUtils.size(recipeToTest.get(slot), 1));
}
if (!recipe.matches(dummy, player.level)) {
Mekanism.logger.warn("Received transfer request from: {}, but source items aren't valid for the requested recipe: {}.", player, recipeID);
} else if (!hasRoomToShuffle()) {
//Note: Uses debug logging level as there are a couple cases this might not be 100% accurate on the client side
Mekanism.logger.debug("Received transfer request from: {}, but there is not enough room to shuffle items around for the requested recipe: {}.",
player, recipeID);
} else {
transferItems(sources);
}
}
/**
* Simulates transferring an item from the QIO into a recipe target slot
*
* @return {@code -1} if an error occurred, and we should bail, otherwise the amount that should be actually used.
*/
private int simulateQIOSource(byte targetSlot, UUID qioSource, int used, int currentStackSize) {
if (qioSource == null) {
return fail("Received transfer request from: {}, for: {}, with no valid source.", player, recipeID);
}
FrequencySlotData slotData = frequencyAvailableItems.get(qioSource);
if (slotData == null) {
if (frequency == null) {
return fail("Received transfer request from: {}, for: {}, with a QIO source but no selected frequency.", player, recipeID);
}
HashedItem storedItem = frequency.getTypeByUUID(qioSource);
if (storedItem == null) {
return fail("Received transfer request from: {}, for: {}, could not find stored item with UUID: {}.", player, recipeID, qioSource);
}
long stored = frequency.getStored(storedItem);
slotData = stored == 0 ? FrequencySlotData.EMPTY : new FrequencySlotData(storedItem, stored);
frequencyAvailableItems.put(qioSource, slotData);
}
return addStackToRecipe(targetSlot, slotData, used, (byte) -1, currentStackSize);
}
/**
* Simulates transferring an item from an inventory slot into a recipe target slot
*
* @return {@code -1} if an error occurred, and we should bail, otherwise the amount that should be actually used.
*/
private int simulateSlotSource(byte targetSlot, byte slot, int used, int currentStackSize) {
if (slot < 0 || slot >= 9 + PlayerInventory.getSelectionSize() + 27) {
return fail("Received transfer request from: {}, for: {}, with an invalid slot id: {}.", player, recipeID, slot);
}
SlotData slotData = availableItems.get(slot);
if (slotData == null) {
if (slot < 9) {
//If our known available items don't contain the slot, and it is a crafting window slot,
// fail as we already looked up all the items that we have available in the crafting slots
return fail("Received transfer request from: {}, for: {}, with a request to take from crafting window slot: {}, but that slot cannot be taken from.",
player, recipeID, slot);
}
InsertableSlot inventorySlot;
if (slot < 9 + PlayerInventory.getSelectionSize()) {
//Hotbar
int actualSlot = slot - 9;
if (actualSlot >= hotBarSlots.size()) {
//Something went wrong, shouldn't happen even with an invalid packet
return fail("Received transfer request from: {}, for: {}, could not find hotbar slot: {}.", player, recipeID, actualSlot);
}
inventorySlot = hotBarSlots.get(actualSlot);
if (!inventorySlot.mayPickup(player)) {
return fail("Received transfer request from: {}, for: {}, with a request to take from hotbar slot: {}, but that slot cannot be taken from.",
player, recipeID, actualSlot);
}
} else {
//Main inventory
int actualSlot = slot - 9 - PlayerInventory.getSelectionSize();
if (actualSlot >= mainInventorySlots.size()) {
//Something went wrong, shouldn't happen even with an invalid packet
return fail("Received transfer request from: {}, for: {}, could not find main inventory slot: {}.", player, recipeID, actualSlot);
}
inventorySlot = mainInventorySlots.get(actualSlot);
if (!inventorySlot.mayPickup(player)) {
return fail("Received transfer request from: {}, for: {}, with a request to take from main inventory slot: {}, but that slot cannot be taken from.",
player, recipeID, actualSlot);
}
}
slotData = inventorySlot.hasItem() ? new SlotData(inventorySlot.getItem()) : SlotData.EMPTY;
availableItems.put(slot, slotData);
}
return addStackToRecipe(targetSlot, slotData, used, slot, currentStackSize);
}
/**
* Simulates transferring an item into a recipe target slot and adds it to the recipe in a given position.
*
* @return {@code -1} if an error occurred, and we should bail, otherwise the amount that should be actually used.
*/
private int addStackToRecipe(byte targetSlot, ItemData slotData, int used, byte sourceSlot, int currentStackSize) {
if (slotData.isEmpty()) {
if (sourceSlot == -1) {
return fail("Received transfer request from: {}, for: {}, for an item that isn't stored in the frequency.", player, recipeID);
}
return fail("Received transfer request from: {}, for: {}, for an empty slot: {}.", player, recipeID, sourceSlot);
} else if (slotData.getAvailable() < used) {
if (sourceSlot == -1) {
Mekanism.logger.warn("Received transfer request from: {}, for: {}, but the QIO frequency only had {} remaining items instead of the expected: {}. "
+ "Attempting to continue by only using the available number of items.", player, recipeID, slotData.getAvailable(), used);
} else {
Mekanism.logger.warn("Received transfer request from: {}, for: {}, but slot: {} only had {} remaining items instead of the expected: {}. "
+ "Attempting to continue by only using the available number of items.", player, recipeID, sourceSlot, slotData.getAvailable(), used);
}
used = slotData.getAvailable();
}
ItemStack currentRecipeTarget = recipeToTest.get(targetSlot);
if (currentRecipeTarget.isEmpty()) {
int max = slotData.getStack().getMaxStackSize();
if (used > max) {
//This should never happen unless the player has an oversized stack in their inventory
Mekanism.logger.warn("Received transfer request from: {}, for: {}, but the item being moved can only stack to: {} but a stack of size: {} was "
+ "being moved. Attempting to continue by only using as many items as can be stacked.", player, recipeID, max, used);
used = max;
}
//We copy the stack in case any mods do dumb things in their recipes and would end up mutating our stacks that shouldn't be mutated by accident
recipeToTest.set(targetSlot, slotData.getStack().copy());
} else if (!ItemHandlerHelper.canItemStacksStack(currentRecipeTarget, slotData.getStack())) {
//If our stack can't stack with the item we already are going to put in the slot, fail "gracefully"
//Note: debug level because this may happen due to not knowing all NBT
Mekanism.logger.debug("Received transfer request from: {}, for: {}, but found items for target slot: {} cannot stack. "
+ "Attempting to continue by skipping the additional stack.", player, recipeID, targetSlot);
return 0;
} else {
int max = currentRecipeTarget.getMaxStackSize();
int needed = max - currentStackSize;
if (used > needed) {
Mekanism.logger.warn("Received transfer request from: {}, for: {}, but moving the requested amount of: {} would cause the output stack to past "
+ "its max stack size ({}). Attempting to continue by only using as many items as can be stacked.", player, recipeID, used, max);
used = needed;
}
}
slotData.simulateUse(used);
return used;
}
private boolean hasRoomToShuffle() {
//Map used to keep track of inputs while also merging identical inputs, so we can cut down
// on how many times we have to check if things can stack
Object2IntMap<HashedItem> leftOverInput = new Object2IntArrayMap<>(9);
for (byte inputSlot = 0; inputSlot < 9; inputSlot++) {
SlotData inputSlotData = availableItems.get(inputSlot);
if (inputSlotData != null && inputSlotData.getAvailable() > 0) {
//If there was an item in the slot and there still is we need to see if we have room for it anywhere
//Note: We can just make the hashed item be raw as the stack does not get modified, and we don't persist this map
leftOverInput.mergeInt(HashedItem.raw(inputSlotData.getStack()), inputSlotData.getAvailable(), Integer::sum);
}
}
if (!leftOverInput.isEmpty()) {
//If we have any leftover inputs in the crafting inventory, then get a simulated view of what the player's inventory
// will look like after things are changed
BaseSimulatedInventory simulatedInventory = new BaseSimulatedInventory(hotBarSlots, mainInventorySlots) {
@Override
protected int getRemaining(int slot, ItemStack currentStored) {
SlotData slotData = availableItems.get((byte) (slot + 9));
return slotData == null ? currentStored.getCount() : slotData.getAvailable();
}
};
Object2IntMap<HashedItem> stillLeftOver = simulatedInventory.shuffleInputs(leftOverInput, frequency != null);
if (stillLeftOver == null) {
//If we have remaining items and no frequency then we don't have room to shuffle
return false;
}
if (!stillLeftOver.isEmpty() && frequency != null) {
//If we still have left over things try adding them to the frequency
// Note: We validate the frequency is not null, even though it shouldn't be null if we have anything still left over
//We start by doing a "precheck" to see if it is potentially even possible to fit the contents in based on type counts
//Note: We calculate these numbers as a difference so that it is easier to make sure none of the numbers accidentally overflow
int availableItemTypes = frequency.getTotalItemTypeCapacity() - frequency.getTotalItemTypes(false);
long availableItemSpace = frequency.getTotalItemCountCapacity() - frequency.getTotalItemCount();
for (FrequencySlotData slotData : frequencyAvailableItems.values()) {
//Free up however much space as we used of the item
availableItemSpace += slotData.getUsed();
if (slotData.getAvailable() == 0) {
//If we used all that is available, we need to also free up an item type
//Note: Given we can't use as much as a full integer as we have nine slots that stack up to a max of 64
// if we get down to zero then we know that we actually used it all, and it isn't just the case that we
// think we are at zero because of clamping a long to an int
availableItemTypes++;
}
}
for (Object2IntMap.Entry<HashedItem> entry : stillLeftOver.object2IntEntrySet()) {
availableItemSpace -= entry.getIntValue();
if (availableItemSpace <= 0) {
//No room for all our items, fail
return false;
}
UUID uuid = frequency.getUUIDForType(entry.getKey());
if (frequency.getTypeByUUID(uuid) == null) {
//It is not stored, we need to use an item type up
// Note: We first get the uuid of the item as we need it for looking up in the slot data,
// and then we also validate against getting the type by uuid to see if it is actually
// there as uuids stay valid for a tick longer than they are stored
availableItemTypes--;
if (availableItemTypes <= 0) {
//Not enough room for types
return false;
}
} else {
//It is stored, check to make sure it isn't a type we are removing fully
FrequencySlotData slotData = frequencyAvailableItems.get(uuid);
if (slotData != null && slotData.getAvailable() == 0) {
// if it is, then we need to reclaim the item type as being available
availableItemTypes--;
if (availableItemTypes <= 0) {
//Not enough room for types
return false;
}
}
}
}
Collection<QIODriveData> drives = frequency.getAllDrives();
List<SimulatedQIODrive> simulatedDrives = new ArrayList<>(drives.size());
for (QIODriveData drive : drives) {
simulatedDrives.add(new SimulatedQIODrive(drive));
}
for (Map.Entry<UUID, FrequencySlotData> entry : frequencyAvailableItems.entrySet()) {
FrequencySlotData slotData = entry.getValue();
HashedItem type = slotData.getType();
if (type != null) {
//If there is something actually stored in the frequency for this UUID, we need to try and remove it from our simulated drives
int toRemove = slotData.getUsed();
for (SimulatedQIODrive drive : simulatedDrives) {
toRemove = drive.remove(type, toRemove);
if (toRemove == 0) {
break;
}
}
}
}
for (Object2IntMap.Entry<HashedItem> entry : stillLeftOver.object2IntEntrySet()) {
HashedItem item = entry.getKey();
int toAdd = entry.getIntValue();
//Start by trying to add to ones it can stack with
for (SimulatedQIODrive drive : simulatedDrives) {
toAdd = drive.add(item, toAdd, true);
if (toAdd == 0) {
break;
}
}
//Note: Ideally the adding to empty slots would be done afterwards for keeping it as compact as possible
// but due to how our actual adding to the slots works, the way it is here ends up actually having a more
// accurate simulation result
if (toAdd > 0) {
//And then add to empty slots if we couldn't add it all in a way that stacks
for (SimulatedQIODrive drive : simulatedDrives) {
toAdd = drive.add(item, toAdd, false);
if (toAdd == 0) {
break;
}
}
if (toAdd > 0) {
//There are some items we can't fit anywhere, fail
return false;
}
}
}
}
}
return true;
}
private void transferItems(Byte2ObjectMap<List<SingularHashedItemSource>> sources) {
SelectedWindowData windowData = craftingWindow.getWindowData();
//Extract items that will be put into the crafting window
Byte2ObjectMap<ItemStack> targetContents = new Byte2ObjectArrayMap<>(sources.size());
for (Byte2ObjectMap.Entry<List<SingularHashedItemSource>> entry : sources.byte2ObjectEntrySet()) {
for (SingularHashedItemSource source : entry.getValue()) {
byte slot = source.getSlot();
ItemStack stack;
if (slot == -1) {
UUID qioSource = source.getQioSource();
//Neither the source nor the frequency can be null here as we validated that during simulation
HashedItem storedItem = frequency.getTypeByUUID(qioSource);
if (storedItem == null) {
bail(targetContents, "Received transfer request from: {}, for: {}, could not find stored item with UUID: {}. "
+ "This likely means that more of it was requested than is stored.", player, recipeID, qioSource);
return;
}
stack = frequency.removeByType(storedItem, source.getUsed());
if (stack.isEmpty()) {
bail(targetContents, "Received transfer request from: {}, for: {}, but could not extract item: {} with nbt: {} from the QIO.",
player, recipeID, storedItem.getStack().getItem(), storedItem.getStack().getTag());
return;
} else if (stack.getCount() < source.getUsed()) {
Mekanism.logger.warn("Received transfer request from: {}, for: {}, but was unable to extract the expected amount: {} of item: {} "
+ "with nbt: {} from the QIO. This should not be possible as it should have been caught during simulation. Attempting "
+ "to continue anyways with the actual extracted amount of {}.", player, recipeID, source.getUsed(),
storedItem.getStack().getItem(), storedItem.getStack().getTag(), stack.getCount());
}
} else {
int actualSlot;
String slotType;
if (slot < 9) {//Crafting Window
actualSlot = slot;
slotType = "crafting window";
stack = craftingWindow.getInputSlot(slot).extractItem(source.getUsed(), Action.EXECUTE, AutomationType.MANUAL);
} else if (slot < 9 + PlayerInventory.getSelectionSize()) {//Hotbar
actualSlot = slot - 9;
slotType = "hotbar";
stack = hotBarSlots.get(actualSlot).remove(source.getUsed());
} else {//Main inventory
actualSlot = slot - 9 - PlayerInventory.getSelectionSize();
slotType = "main inventory";
stack = mainInventorySlots.get(actualSlot).remove(source.getUsed());
}
if (stack.isEmpty()) {
bail(targetContents, "Received transfer request from: {}, for: {}, could not extract item from {} slot: {}. "
+ "This likely means that more of it was requested than is stored.", player, recipeID, slotType, actualSlot);
return;
} else if (stack.getCount() < source.getUsed()) {
Mekanism.logger.warn("Received transfer request from: {}, for: {}, but was unable to extract the expected amount: {} from {} slot: {}. "
+ "This should not be possible as it should have been caught during simulation. Attempting to continue anyways with the "
+ "actual extracted amount of {}.", player, recipeID, source.getUsed(), slotType, actualSlot, stack.getCount());
}
}
byte targetSlot = entry.getByteKey();
if (targetContents.containsKey(targetSlot)) {
ItemStack existing = targetContents.get(targetSlot);
if (ItemHandlerHelper.canItemStacksStack(existing, stack)) {
int needed = existing.getMaxStackSize() - existing.getCount();
if (stack.getCount() <= needed) {
existing.grow(stack.getCount());
} else {
existing.grow(needed);
//Note: We can safely modify the stack as all our ways of extracting return a new stack
stack.shrink(needed);
Mekanism.logger.warn("Received transfer request from: {}, for: {}, but contents could not fully fit into target slot: {}. "
+ "This should not be able to happen, returning excess stack, and attempting to continue.", player, recipeID, targetSlot);
returnItem(stack, windowData);
}
} else {
Mekanism.logger.warn("Received transfer request from: {}, for: {}, but contents could not stack into target slot: {}. "
+ "This should not be able to happen, returning extra stack, and attempting to continue.", player, recipeID, targetSlot);
returnItem(stack, windowData);
}
} else {
//Note: We can safely modify the stack as all our ways of extracting return a new stack
targetContents.put(targetSlot, stack);
}
}
}
//Extract what items are still in the window
Byte2ObjectMap<ItemStack> remainingCraftingGridContents = new Byte2ObjectArrayMap<>(9);
for (byte slot = 0; slot < 9; slot++) {
CraftingWindowInventorySlot inputSlot = craftingWindow.getInputSlot(slot);
if (!inputSlot.isEmpty()) {
ItemStack stack = inputSlot.extractItem(inputSlot.getCount(), Action.EXECUTE, AutomationType.MANUAL);
if (!stack.isEmpty()) {
remainingCraftingGridContents.put(slot, stack);
} else {
bail(targetContents, remainingCraftingGridContents, "Received transfer request from: {}, for: {}, but failed to remove items from crafting "
+ "input slot: {}. This should not be possible as it should have been caught by an earlier check.",
player, recipeID, slot);
return;
}
}
}
//Insert items for the crafting window into it
for (ObjectIterator<Byte2ObjectMap.Entry<ItemStack>> iter = targetContents.byte2ObjectEntrySet().iterator(); iter.hasNext(); ) {
Byte2ObjectMap.Entry<ItemStack> entry = iter.next();
byte targetSlot = entry.getByteKey();
CraftingWindowInventorySlot inputSlot = craftingWindow.getInputSlot(targetSlot);
ItemStack remainder = inputSlot.insertItem(entry.getValue(), Action.EXECUTE, AutomationType.MANUAL);
if (remainder.isEmpty()) {
//If it was fully inserted, remove the entry from what we have left to deal with
iter.remove();
} else {
// otherwise, update the stack for what is remaining and also print a warning as this should have been caught earlier,
// as we then will handle any remaining contents at the end (though we shouldn't have any)
// Note: We need to use put, as entry#setValue is not supported in fastutil maps
targetContents.put(targetSlot, remainder);
Mekanism.logger.warn("Received transfer request from: {}, for: {}, but was unable to fully insert it into the {} crafting input slot. "
+ "This should not be possible as it should have been caught during simulation. Attempting to continue anyways.",
player, recipeID, targetSlot);
}
}
//Put the items that were in the crafting window in the player's inventory
for (Byte2ObjectMap.Entry<ItemStack> entry : remainingCraftingGridContents.byte2ObjectEntrySet()) {
//Insert into player's inventory
ItemStack stack = returnItemToInventory(entry.getValue(), windowData);
if (!stack.isEmpty()) {
//If we couldn't insert it all, try recombining with the slots they were in the crafting window
// (only if the type matches though)
CraftingWindowInventorySlot inputSlot = craftingWindow.getInputSlot(entry.getByteKey());
if (ItemHandlerHelper.canItemStacksStack(inputSlot.getStack(), stack)) {
stack = inputSlot.insertItem(stack, Action.EXECUTE, AutomationType.MANUAL);
}
if (!stack.isEmpty()) {
//If we couldn't insert it, then try to put the remaining items in the frequency
if (frequency != null) {
stack = frequency.addItem(stack);
}
if (!stack.isEmpty()) {
//If we couldn't insert it all, either because there was no frequency or it didn't have room for it all
// drop it as the player, and print a warning as ideally we should never have been able to get to this
// point as our simulation should have marked it as invalid
// Note: In theory we should never get to this point due to having accurate simulations ahead of time
player.drop(stack, false);
Mekanism.logger.warn("Received transfer request from: {}, for: {}, and was unable to fit all contents that were in the crafting window "
+ "into the player's inventory/QIO system; dropping items by player.", player, recipeID);
}
}
}
}
if (!targetContents.isEmpty()) {
//If we have any contents we wanted to move remaining try to return them, in theory
// this should never happen but in case it does make sure we don't void any items
bail(targetContents, "Received transfer request from: {}, for: {}, but ended up with {} items that could not be transferred into "
+ "the proper crafting grid slot. This should not be possible as it should have been caught during simulation.", player, recipeID,
targetContents.size());
}
}
/**
* Bails out if something went horribly wrong and didn't get caught by simulations, and send the various items back to the inventory.
*/
private void bail(Byte2ObjectMap<ItemStack> targetContents, String format, Object... args) {
bail(targetContents, Byte2ObjectMaps.emptyMap(), format, args);
}
/**
* Bails out if something went horribly wrong and didn't get caught by simulations, and send the various items back to the inventory.
*/
private void bail(Byte2ObjectMap<ItemStack> targetContents, Byte2ObjectMap<ItemStack> remainingCraftingGridContents, String format, Object... args) {
Mekanism.logger.warn(format, args);
SelectedWindowData windowData = craftingWindow.getWindowData();
for (ItemStack stack : targetContents.values()) {
//We don't attempt to try and return the contents being moved to the crafting inventory to their original slots
// as we don't keep track of that data and in theory unless something goes majorly wrong we should never end
// up bailing anyways
//TODO: Eventually we may want to try and make it first try to return to the same slots it came from but it doesn't matter that much
returnItem(stack, windowData);
}
//Put the items that were in the crafting window in the player's inventory
for (Byte2ObjectMap.Entry<ItemStack> entry : remainingCraftingGridContents.byte2ObjectEntrySet()) {
ItemStack stack = entry.getValue();
CraftingWindowInventorySlot inputSlot = craftingWindow.getInputSlot(entry.getByteKey());
if (ItemHandlerHelper.canItemStacksStack(inputSlot.getStack(), stack)) {
stack = inputSlot.insertItem(stack, Action.EXECUTE, AutomationType.MANUAL);
if (stack.isEmpty()) {
continue;
}
}
returnItem(stack, windowData);
}
}
/**
* Tries to reinsert the stack into the player's inventory, and then if there is any remaining items tries to insert them into the frequency if there is one and if
* not just drops them by the player.
*/
private void returnItem(ItemStack stack, @Nullable SelectedWindowData windowData) {
//Insert into player's inventory
stack = returnItemToInventory(stack, windowData);
if (!stack.isEmpty()) {
//If we couldn't insert it, then try to put the remaining items in the frequency
if (frequency != null) {
stack = frequency.addItem(stack);
}
if (!stack.isEmpty()) {
//If we couldn't insert it all, either because there was no frequency or it didn't have room for it all
// drop it as the player, and print a warning as ideally we should never have been able to get to this
// point as our simulation should have marked it as invalid
player.drop(stack, false);
}
}
}
/**
* Tries to reinsert the stack into the player's inventory in the order of hotbar, then main inventory; checks for stacks it can combine with before filling empty
* ones.
*
* @return Remaining stack that couldn't be inserted.
*/
private ItemStack returnItemToInventory(ItemStack stack, @Nullable SelectedWindowData windowData) {
stack = MekanismContainer.insertItem(hotBarSlots, stack, true, windowData);
stack = MekanismContainer.insertItem(mainInventorySlots, stack, true, windowData);
stack = MekanismContainer.insertItem(hotBarSlots, stack, false, windowData);
return MekanismContainer.insertItem(mainInventorySlots, stack, false, windowData);
}
/**
* Helper to combine a WARN level log message and returning {@code -1} to represent failure in methods that use this.
*
* @return {@code -1}
*/
private int fail(String format, Object... args) {
Mekanism.logger.warn(format, args);
return -1;
}
private static class SimulatedQIODrive {
/**
* Pointer to the actual map from the real QIODrive. Do not modify this map, it is mainly to reduce the need for doing potentially massive map copies.
*/
private final Object2LongMap<HashedItem> sourceItemMap;
private Set<HashedItem> removedTypes;
private int availableItemTypes;
private long availableItemSpace;
public SimulatedQIODrive(QIODriveData sourceDrive) {
this.sourceItemMap = sourceDrive.getItemMap();
this.availableItemSpace = sourceDrive.getCountCapacity() - sourceDrive.getTotalCount();
this.availableItemTypes = sourceDrive.getTypeCapacity() - sourceDrive.getTotalTypes();
}
public int remove(HashedItem item, int count) {
long stored = sourceItemMap.getOrDefault(item, 0);
if (stored == 0) {
return count;
}
if (stored <= count) {
//If we have less stored then we are trying to remove
if (removedTypes == null) {
removedTypes = new HashSet<>();
}
// remove the type, and refund the amount of space we get from removing it
removedTypes.add(item);
availableItemTypes++;
availableItemSpace += stored;
return count - (int) stored;
}
availableItemSpace += count;
return 0;
}
public int add(HashedItem item, int count, boolean mustContain) {
if (availableItemSpace == 0) {
//No space, fail
return count;
}
//Note: We don't need to accurately keep track of the item types we add as we only have it happening once,
// and if we fill it up on the first go around then we would be skipping it from there being no space available
boolean contains = sourceItemMap.containsKey(item) && (removedTypes == null || !removedTypes.contains(item));
if (mustContain != contains) {
//If we don't have the item and are only adding if we do, or vice versa, just return we didn't add anything
return count;
}
if (!contains) {
if (availableItemTypes == 0) {
//If we don't contain it and no space for new item types, fail
return count;
}
//If we don't contain it, we need to reduce our type count
availableItemTypes--;
}
if (count < availableItemSpace) {
//We can fit all of it
availableItemSpace -= count;
return 0;
}
//We can't fit it all so use up all the space we can
count -= (int) availableItemSpace;
availableItemSpace = 0;
return count;
}
}
private static abstract class ItemData {
private int available;
protected ItemData(int available) {
this.available = available;
}
public abstract boolean isEmpty();
public int getAvailable() {
return available;
}
public void simulateUse(int used) {
available -= used;
}
/**
* @apiNote Don't mutate this stack
*/
protected abstract ItemStack getStack();
}
private static class SlotData extends ItemData {
public static final SlotData EMPTY = new SlotData(ItemStack.EMPTY, 0);
/**
* @apiNote Don't mutate this stack
*/
private final ItemStack stack;
public SlotData(ItemStack stack) {
this(stack, stack.getCount());
}
protected SlotData(ItemStack stack, int available) {
super(available);
this.stack = stack;
}
@Override
public boolean isEmpty() {
return this == EMPTY || stack.isEmpty();
}
@Override
public ItemStack getStack() {
return stack;
}
}
private static class FrequencySlotData extends ItemData {
public static final FrequencySlotData EMPTY = new FrequencySlotData(null, 0);
/**
* @apiNote Don't mutate this stack
*/
private final HashedItem type;
private int used;
public FrequencySlotData(HashedItem type, long stored) {
//Clamp to int as with how many slots we are filling even though the frequency may have more than
// a certain amount stored, we can never need that many for usage, so we can save some extra memory
super(MathUtils.clampToInt(stored));
this.type = type;
}
@Override
public boolean isEmpty() {
return this == EMPTY || type == null;
}
@Override
public ItemStack getStack() {
return type == null ? ItemStack.EMPTY : type.getStack();
}
@Override
public void simulateUse(int used) {
super.simulateUse(used);
this.used += used;
}
public int getUsed() {
return used;
}
public HashedItem getType() {
return type;
}
}
} | [
"sara@freimer.com"
] | sara@freimer.com |
c8e12dc77e92e2175788a59b5540099bad7238d4 | be632697dcfbd6107adaf8d1ca99f7ef9d8da75d | /app/src/main/java/com/example/memorygame/activity/MainActivity.java | fd03907d0e81a2c9a01ce5b14c681ad3d2d6fa1f | [] | no_license | tomer44532/Android-Memory-Game-Java | e5591973c06d8a6a299bf3c3bce9f9e6ffa5cb51 | f23f5bb150b16d0e9486a6a6ad42fe2136f30fa7 | refs/heads/main | 2023-08-24T00:10:19.252819 | 2021-10-17T12:28:11 | 2021-10-17T12:28:11 | 408,176,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,843 | java | package com.example.memorygame.activity;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.IBinder;
import android.os.PowerManager;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import com.example.memorygame.musicService.HomeWatcher;
import com.example.memorygame.InventoryDialog;
import com.example.memorygame.musicService.MusicService;
import com.example.memorygame.interfaces.NotGameInventory;
import com.example.memorygame.R;
import com.google.gson.Gson;
public class MainActivity extends AppCompatActivity implements NotGameInventory {
private SharedPreferences sp;
private FragmentManager fm = getSupportFragmentManager();
private HomeWatcher mHomeWatcher;
private int cardsNum;
private int coins;
private int doubleCoins;
private int money;
private boolean musicOn = true;
private boolean screenBlack;
private boolean doneTutorial;
private long btnDuration = 3000;
private TextView moneyTv;
private Intent music;
private ImageButton muteBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sp = getSharedPreferences("info",MODE_PRIVATE);
///for all stages clear
/*String response;
Stage[] stages;
response = sp.getString("stages","");
if(response !="")
{
Gson gson = new Gson();
stages = gson.fromJson(response,
new TypeToken<Stage[]>(){}.getType());
}
else
{
stages = new Stage[30];
for(int i =0; i<30; i++)
{
stages[i] = new Stage();
stages[i].setCleared(true);
}
Gson gson = new Gson();
String json = gson.toJson(stages);
sp.edit().remove("stages").commit();
sp.edit().putString("stages",json).commit();
}*/
///done open stages
Animation floatBtnAnim = AnimationUtils.loadAnimation(this, R.anim.floating);
Button startBtn = findViewById(R.id.start_btn);
floatBtnAnim.setDuration(btnDuration);
startBtn.startAnimation(floatBtnAnim);
startBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(doneTutorial)
{
Intent intent = new Intent(MainActivity.this, StageSelectActivity.class);
startActivity(intent);
}
else
{
Intent intent = new Intent(MainActivity.this, TutorialActivity.class);
startActivity(intent);
}
}
});
Button start2Btn = findViewById(R.id.start2_btn);
floatBtnAnim.setDuration(btnDuration);
start2Btn.startAnimation(floatBtnAnim);
start2Btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, TwoPlayersSetting.class);
intent.putExtra("cardsNum",16);
intent.putExtra("world",0);
startActivity(intent);
}
});
Button shopBtn = findViewById(R.id.shop_btn);
floatBtnAnim.setDuration(btnDuration);
shopBtn.startAnimation(floatBtnAnim);
shopBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, ShopActivity.class);
intent.putExtra("cardsNum",cardsNum);
startActivity(intent);
}
});
ImageButton inventoryBtn = findViewById(R.id.inventory_btn);
inventoryBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle bundle = new Bundle();
//dialogFragment.setArguments(bundle);
Gson gson = new Gson();
String response = sp.getString("bought items","");
InventoryDialog inventoryFragment = new InventoryDialog();
if(response !="")
{
bundle.putString("inventory",response);
inventoryFragment.setArguments(bundle);
}
// Show DialogFragment
inventoryFragment.show(fm, "Dialog Fragment");
}
});
doubleCoins = sp.getInt("doubleCoins",0);
//Toast.makeText(this, "doube coins are "+doubleCoins, Toast.LENGTH_SHORT).show();
muteBtn = findViewById(R.id.music_btn);
Button quitBtn = findViewById(R.id.quit_btn);
floatBtnAnim.setDuration(btnDuration);
quitBtn.startAnimation(floatBtnAnim);
quitBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
//BIND Music Service
doBindService();
music = new Intent();
music.setClass(this, MusicService.class);
musicOn = sp.getBoolean("musicOn",true);
//Start HomeWatcher
mHomeWatcher = new HomeWatcher(this);
mHomeWatcher.setOnHomePressedListener(new HomeWatcher.OnHomePressedListener() {
@Override
public void onHomePressed() {
if (mServ != null) {
mServ.pauseMusic();
mServ.setWorld(5);
}
}
@Override
public void onHomeLongPressed() {
if (mServ != null) {
mServ.pauseMusic();
mServ.setWorld(5);
}
}
});
mHomeWatcher.startWatch();
if(musicOn)
{
music.putExtra("worldMusic", 3);
startService(music);
muteBtn.setImageDrawable(getResources().getDrawable(R.drawable.music_button));
muteBtn.setSelected(true);
}
else
{
muteBtn.setImageDrawable(getResources().getDrawable(R.drawable.music_button));
muteBtn.setSelected(false);
}
muteBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(musicOn)
{
mServ.pauseMusic();
musicOn = false;
muteBtn.setSelected(false);
}
else
{
muteBtn.setSelected(true);
//mServ.startMusic();
musicOn = true;
if(mServ.getWorld() !=3)
{
mServ.pauseMusic();
mServ.setWorld(3);
mServ.startMusic();
}
else
{
mServ.startMusic();
}
}
}
});
}
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}
//Bind/Unbind music service
private boolean mIsBound = false;
private MusicService mServ;
private ServiceConnection Scon =new ServiceConnection(){
public void onServiceConnected(ComponentName name, IBinder
binder) {
mServ = ((MusicService.ServiceBinder)binder).getService();
}
public void onServiceDisconnected(ComponentName name) {
mServ = null;
}
};
void doBindService(){
bindService(new Intent(this,MusicService.class),
Scon, Context.BIND_AUTO_CREATE);
mIsBound = true;
}
void doUnbindService()
{
if(mIsBound)
{
unbindService(Scon);
mIsBound = false;
}
}
@Override
protected void onResume() {
super.onResume();
musicOn = sp.getBoolean("musicOn",true);
doubleCoins = sp.getInt("doubleCoins",0);
money = sp.getInt("money",0);
doneTutorial = sp.getBoolean("doneTutorial",false);
moneyTv = findViewById(R.id.money_Tv);
moneyTv.setText(money+"");
/* if(mServ !=null)
{
Toast.makeText(this, "mserv world is " + mServ.world, Toast.LENGTH_SHORT).show();
}*/
if (mServ != null &&musicOn &&mServ.getWorld() !=4 && mServ.getWorld() !=5&& (mServ.getWorld() !=3||screenBlack)) {
mServ.resumeMusic();
screenBlack = false;
}
if(mServ !=null && mServ.getWorld()==4)
{
mServ.setWorld(3);
mServ.startMusic();
}
if(mServ !=null && mServ.getWorld()==5)
{
mServ.setWorld(3);
mServ.resumeMusic();
}
if(musicOn)
{
muteBtn.setImageDrawable(getResources().getDrawable(R.drawable.music_button));
muteBtn.setSelected(true);
}
else
{
muteBtn.setImageDrawable(getResources().getDrawable(R.drawable.music_button));
muteBtn.setSelected(false);
}
}
@Override
protected void onPause() {
super.onPause();
//Detect idle screen
PowerManager pm = (PowerManager)
getSystemService(Context.POWER_SERVICE);
boolean isScreenOn = false;
if (pm != null) {
isScreenOn = pm.isScreenOn();
}
if (!isScreenOn) {
if (mServ != null) {
mServ.pauseMusic();
screenBlack = true;
}
}
sp.edit().putBoolean("musicOn",musicOn).commit();
}
@Override
protected void onDestroy() {
//UNBIND music service
doUnbindService();
Intent music = new Intent();
music.setClass(this,MusicService.class);
stopService(music);
mHomeWatcher.stopWatch();
super.onDestroy();
}
@Override
public void doubleCoins() {
doubleCoins++;
sp.edit().putInt("doubleCoins",doubleCoins).commit();
}
}
| [
"tomer44532@gmail.com"
] | tomer44532@gmail.com |
f590b50ed924395354290fe07444b19d481e5f26 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project143/src/main/java/org/gradle/test/performance/largejavamultiproject/project143/p718/Production14363.java | 397d8cbaf1cb946c81ce183e2863dcb918120403 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,889 | java | package org.gradle.test.performance.largejavamultiproject.project143.p718;
public class Production14363 {
private String property0;
public String getProperty0() {
return property0;
}
public void setProperty0(String value) {
property0 = value;
}
private String property1;
public String getProperty1() {
return property1;
}
public void setProperty1(String value) {
property1 = value;
}
private String property2;
public String getProperty2() {
return property2;
}
public void setProperty2(String value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | [
"sterling.greene@gmail.com"
] | sterling.greene@gmail.com |
681689fd289fc92915b4a016e30926b326b4f292 | 0ea271177f5c42920ac53cd7f01f053dba5c14e4 | /5.3.5/sources/org/telegram/tgnet/TLRPC$TL_inputMessagesFilterVideo.java | 1b73b357c5d4c5a527d37674bed0e3650d37e323 | [] | no_license | alireza-ebrahimi/telegram-talaeii | 367a81a77f9bc447e729b2ca339f9512a4c2860e | 68a67e6f104ab8a0888e63c605e8bbad12c4a20e | refs/heads/master | 2020-03-21T13:44:29.008002 | 2018-12-09T10:30:29 | 2018-12-09T10:30:29 | 138,622,926 | 12 | 1 | null | null | null | null | UTF-8 | Java | false | false | 272 | java | package org.telegram.tgnet;
public class TLRPC$TL_inputMessagesFilterVideo extends TLRPC$MessagesFilter {
public static int constructor = -1614803355;
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
}
}
| [
"alireza.ebrahimi2006@gmail.com"
] | alireza.ebrahimi2006@gmail.com |
c81b290587b604d49cc652b9b9fe4c2c86cc3dec | 1f18b5b4c97b722276ab45c4e759d770c7e6df02 | /src/test/java/com/fuhao/TestRedisTemplate.java | 81d7cd2c24a456546f465f06296b70388ea37d96 | [] | no_license | fuhaooo/redis-springboot | 1229a91ac75904c0118fa437020b61401c10231a | 29fbd9d8315fa2a31ac543727cd9fdcc85750344 | refs/heads/master | 2023-06-17T19:34:34.722962 | 2021-07-16T06:31:32 | 2021-07-16T06:31:32 | 386,532,983 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,157 | java | package com.fuhao;
import com.fuhao.entity.User;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import java.util.Date;
import java.util.UUID;
/**
* @Author fuhao
* @Date 2021/7/13 2:55 下午
* @Version 1.0
*/
@SpringBootTest(classes = RedisSpringbootApplication.class)
public class TestRedisTemplate {
//注入RedisTemplate key和value都是对象Object,无法直接存储到redis,必须将对象序列化
@Autowired
private RedisTemplate redisTemplate;
@Test
public void testRedisTemplate(){
/**
* redisTemplate对象中key和value的序列化方式都是 JdkSerializationRedisSerializer、
* key : String
* value : Object
* 修改默认的key的序列化方案,改为 StringRedisSerializer 序列化方案,不然终端无法对序列化后的key进行操作了
* redisTemplate.setKeySerializer(new StringRedisSerializer());
*/
//修改key的序列化
redisTemplate.setKeySerializer(new StringRedisSerializer());
//修改hash key的序列化
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
User user = new User();
user.setId(UUID.randomUUID().toString()).setName("fuhao").setAge(22).setBir(new Date());
redisTemplate.opsForValue().set("user", user);//redis进行设置,对象需要进过序列化
User user1 = (User) redisTemplate.opsForValue().get("user");
System.out.println(user1);
RedisSerializer keySerializer = redisTemplate.getKeySerializer();
System.out.println(keySerializer);
redisTemplate.opsForList().leftPush("list",user);
redisTemplate.opsForSet().add("set",user);
redisTemplate.opsForZSet().add("zset",user,10);
redisTemplate.opsForHash().put("map","name",user);
}
}
| [
"598700987@qq.com"
] | 598700987@qq.com |
da0d306bd13bc103c2b45053edf91c0eece232ee | 75f0d81197655407fd59ec1dca79243d2aa70be9 | /nd4j-jcublas-parent/nd4j-jcublas-common/src/main/java/jcuda/driver/CUdeviceptr.java | b5f3107482655ff002b20af9bb114bc6a235741b | [
"Apache-2.0"
] | permissive | noelnamai/nd4j | 1a547e9ee5ad08f26d8a84f10af85c6c4278558f | f31d63d95e926c5d8cc93c5d0613f3b3c92e521c | refs/heads/master | 2021-01-22T09:04:35.467401 | 2015-06-05T02:49:29 | 2015-06-05T02:49:29 | 36,916,394 | 2 | 0 | null | 2015-06-05T06:37:09 | 2015-06-05T06:37:09 | null | UTF-8 | Java | false | false | 1,919 | java | /*
*
* * Copyright 2015 Skymind,Inc.
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*
*/
package jcuda.driver;
import jcuda.Pointer;
/**
* Java port of a CUdeviceptr.
*/
public class CUdeviceptr extends Pointer
{
/**
* Creates a new (null) device pointer
*/
public CUdeviceptr()
{
}
/**
* Copy constructor
*
* @param other The other pointer
*/
protected CUdeviceptr(CUdeviceptr other)
{
super(other);
}
/**
* Creates a copy of the given pointer, with an
* additional byte offset
*
* @param other The other pointer
* @param byteOffset The additional byte offset
*/
protected CUdeviceptr(CUdeviceptr other, long byteOffset)
{
super(other, byteOffset);
}
@Override
public CUdeviceptr withByteOffset(long byteOffset)
{
return new CUdeviceptr(this, byteOffset);
}
/**
* Returns a String representation of this object.
*
* @return A String representation of this object.
*/
@Override
public String toString()
{
return "CUdeviceptr["+
"nativePointer=0x"+Long.toHexString(getNativePointer())+","+
"byteOffset="+getByteOffset()+"]";
}
}
| [
"adam@skymind.io"
] | adam@skymind.io |
9f5bfa26e4864a23031810a89e8f893dc404ce66 | 53d1c9241527884649ab4c62b17f4f366464c7aa | /app/src/main/java/com/example/mniez/myapplication/TeacherModule/ExamActivity.java | 0c208317f3eddd3efac302e174b663188ecdf39e | [] | no_license | niezba/naukajezykowaplikacja | 5b50d2d1aab68aa1b8d979087841b908a02d18da | 904271487229b52bc1e108f8277103ff6280b023 | refs/heads/master | 2021-08-29T10:56:35.043916 | 2017-12-13T19:46:43 | 2017-12-13T19:46:43 | 107,602,295 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 19,786 | java | package com.example.mniez.myapplication.TeacherModule;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.widget.Toast;
import com.example.mniez.myapplication.DatabaseAccess.MobileDatabaseReader;
import com.example.mniez.myapplication.ObjectHelper.ExamQuestion;
import com.example.mniez.myapplication.ObjectHelper.TestQuestion;
import com.example.mniez.myapplication.ObjectHelper.Word;
import com.example.mniez.myapplication.R;
import com.example.mniez.myapplication.TeacherModule.Fragments.AnswersFragment;
import com.example.mniez.myapplication.TeacherModule.Fragments.ImageAnswersFragment;
import com.example.mniez.myapplication.TeacherModule.Fragments.InputAnswersFragment;
import com.example.mniez.myapplication.TeacherModule.Fragments.NumberFragment;
import com.example.mniez.myapplication.TeacherModule.Fragments.ProgressFragment;
import com.example.mniez.myapplication.TeacherModule.Fragments.QuestionFragment;
import com.example.mniez.myapplication.TeacherModule.Fragments.SoundAnswersFragment;
import java.util.ArrayList;
import java.util.Random;
public class ExamActivity extends AppCompatActivity {
SharedPreferences sharedpreferences;
private static final String MY_PREFERENCES = "DummyLangPreferences";
private static final String PREFERENCES_OFFLINE = "isOffline";
private static final String ANSWERS_TAG = "answers";
private static final String NUMBER_TAG = "number";
private static final String QUESTION_TAG = "question";
private static final String PROGRESS_TAG = "progress";
private static final String IMG_ANSWERS_TAG = "imageAnswers";
private static final String SOUND_ANSWERS_TAG = "soundAnswers";
private static final String INPUT_ANSWERS_TAG = "inputAnswers";
private int testId;
ArrayList<ExamQuestion> testQuestions;
ArrayList<Word> questionWords;
protected int questionCounter = 0;
protected int currentQuestionTypeId;
protected int currentQuestionWordId;
MobileDatabaseReader dbReader;
AnswersFragment mAnswersFragment;
NumberFragment mNumberFragment;
ProgressFragment mProgressFragment;
QuestionFragment mQuestionFragment;
ImageAnswersFragment mImageAnswersFragment;
SoundAnswersFragment mSoundsAnswersFragment;
InputAnswersFragment mInputAnswersFragment;
String inputAnswerString;
protected int currentAnswerId;
protected String answerString;
int courseId;
int isOffline;
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.navigation_home:
setQuestion(-1);
return true;
case R.id.navigation_dashboard:
onBackPressed();
return true;
case R.id.navigation_notifications:
setQuestion(1);
return true;
}
return false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
Bundle extras = getIntent().getExtras();
testId = extras.getInt("test_id", 0);
courseId = extras.getInt("course_id", 0);
setContentView(R.layout.activity_test);
dbReader = new MobileDatabaseReader(getApplicationContext());
String testName = dbReader.selectExamName(testId);
setTitle(testName);
sharedpreferences = getSharedPreferences(MY_PREFERENCES, Context.MODE_PRIVATE);
isOffline = sharedpreferences.getInt(PREFERENCES_OFFLINE, 0);
testQuestions = dbReader.selectAllQuestionsForExam(testId);
System.out.println(testQuestions.size());
questionWords = populateCurrentListOfWords(testQuestions.get(0));
dbReader.close();
Bundle args = new Bundle();
args.putInt("question_num", questionCounter + 1);
args.putInt("question_sum", testQuestions.size());
args.putInt("question_id", testQuestions.get(questionCounter).getId());
android.app.FragmentManager fragmentManager = getFragmentManager();
mNumberFragment = (NumberFragment) fragmentManager.findFragmentByTag(NUMBER_TAG);
if (mNumberFragment == null) {
mNumberFragment = new NumberFragment();
mNumberFragment.setArguments(args);
fragmentManager.beginTransaction().add(R.id.number_fragment_container, mNumberFragment, NUMBER_TAG).commit();
}
Bundle args2 = new Bundle();
args2.putString("quesstionToAsk", testQuestions.get(questionCounter).getQuestion());
args2.putInt("questionType", testQuestions.get(questionCounter).getQuestionTypeId());
args2.putInt("questionWord", testQuestions.get(questionCounter).getAnswerId());
args2.putInt("isOffline", isOffline);
mQuestionFragment = (QuestionFragment) fragmentManager.findFragmentByTag(QUESTION_TAG);
if (mQuestionFragment == null) {
mQuestionFragment = new QuestionFragment();
mQuestionFragment.setArguments(args2);
fragmentManager.beginTransaction().add(R.id.question_fragment_container, mQuestionFragment, QUESTION_TAG).commit();
}
Bundle args3 = new Bundle();
args3.putInt("answerType", testQuestions.get(questionCounter).getAnswerTypeId());
populateAnswersForQuestion(testQuestions.get(questionCounter));
args3.putString("answerString", answerString);
args3.putInt("answerIds", currentAnswerId);
args3.putInt("isOffline", isOffline);
args3.putInt("correctId", testQuestions.get(questionCounter).getAnswerId());
mAnswersFragment = (AnswersFragment) fragmentManager.findFragmentByTag(ANSWERS_TAG);
if (mAnswersFragment == null) {
mAnswersFragment = new AnswersFragment();
mAnswersFragment.setArguments(args3);
fragmentManager.beginTransaction().add(R.id.answer_fragment_container, mAnswersFragment, ANSWERS_TAG).commit();
}
Bundle args4 = new Bundle();
args4.putDouble("progress", ((((float) questionCounter)+1)/ (float) testQuestions.size())*100.0);
System.out.println("Progres:" + ((((float) questionCounter)+1)/ (float) testQuestions.size())*100.0);
mProgressFragment = (ProgressFragment) fragmentManager.findFragmentByTag(PROGRESS_TAG);
if (mProgressFragment == null) {
mProgressFragment = new ProgressFragment();
mProgressFragment.setArguments(args4);
fragmentManager.beginTransaction().add(R.id.progress_fragment_container, mProgressFragment, PROGRESS_TAG).commit();
}
mImageAnswersFragment = (ImageAnswersFragment) fragmentManager.findFragmentByTag(IMG_ANSWERS_TAG);
if (mImageAnswersFragment == null) {
mImageAnswersFragment = new ImageAnswersFragment();
mImageAnswersFragment.setArguments(args3);
fragmentManager.beginTransaction().add(R.id.answer_fragment_container, mImageAnswersFragment, IMG_ANSWERS_TAG).commit();
}
mSoundsAnswersFragment = (SoundAnswersFragment) fragmentManager.findFragmentByTag(SOUND_ANSWERS_TAG);
if (mSoundsAnswersFragment == null) {
mSoundsAnswersFragment = new SoundAnswersFragment();
mSoundsAnswersFragment.setArguments(args3);
fragmentManager.beginTransaction().add(R.id.answer_fragment_container, mSoundsAnswersFragment, SOUND_ANSWERS_TAG).commit();
}
Bundle args5 = new Bundle();
args5.putInt("answerType", testQuestions.get(questionCounter).getAnswerTypeId());
populateAnswersForInputQuestion(testQuestions.get(questionCounter));
args5.putString("answerString", inputAnswerString);
mInputAnswersFragment = (InputAnswersFragment) fragmentManager.findFragmentByTag(INPUT_ANSWERS_TAG);
if (mInputAnswersFragment == null) {
mInputAnswersFragment = new InputAnswersFragment();
mInputAnswersFragment.setArguments(args5);
fragmentManager.beginTransaction().add(R.id.answer_fragment_container, mInputAnswersFragment, INPUT_ANSWERS_TAG).commit();
}
switchCurrentAnswerType(testQuestions.get(questionCounter));
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
}
protected ArrayList<Word> populateCurrentListOfWords(ExamQuestion testQuestion) {
ArrayList<Word> newList = new ArrayList<>();
System.out.println(testQuestion.getId());
Word correctAnswer = dbReader.getParticularWordData(testQuestion.getAnswerId());
newList.add(correctAnswer);
return newList;
}
protected void populateAnswersForQuestion(ExamQuestion testQuestion) {
Random generator = new Random();
String tAnswerString = new String();
int tAnswersOrder;
switch (testQuestion.getAnswerTypeId()) {
case 7:
tAnswerString = questionWords.get(0).getNativeWord();
break;
case 8:
tAnswerString = questionWords.get(0).getTranslatedWord();
break;
case 10:
tAnswerString = questionWords.get(0).getTranslatedWord();
break;
case 12:
tAnswerString = questionWords.get(0).getNativeDefinition();
break;
case 13:
tAnswerString = questionWords.get(0).getTranslatedDefinition();
break;
default:
tAnswerString = questionWords.get(0).getTranslatedWord();
break;
}
answerString = tAnswerString;
currentAnswerId = testQuestions.get(questionCounter).getAnswerId();
}
protected void populateAnswersForInputQuestion(ExamQuestion testQuestion) {
switch (testQuestion.getAnswerTypeId()) {
case 16:
inputAnswerString = dbReader.getParticularWordData(testQuestion.getAnswerId()).getNativeWord();
break;
case 17:
inputAnswerString = dbReader.getParticularWordData(testQuestion.getAnswerId()).getTranslatedWord();
break;
default:
inputAnswerString = "";
break;
}
currentAnswerId = testQuestions.get(questionCounter).getAnswerId();
}
public void switchCurrentAnswerType(ExamQuestion testQuestion) {
switch (testQuestion.getAnswerTypeId()) {
case 7: case 10: case 12: case 13:
System.out.println("Wyświetlam fragment typu select text");
android.app.FragmentTransaction ft = getFragmentManager().beginTransaction().show(mAnswersFragment);
if(mImageAnswersFragment != null) ft.hide(mImageAnswersFragment);
if(mInputAnswersFragment != null) ft.hide(mInputAnswersFragment);
if(mSoundsAnswersFragment != null) ft.hide(mSoundsAnswersFragment).commit();
break;
case 8:
System.out.println("Wyświetlam fragment typu select image");
android.app.FragmentTransaction fx = getFragmentManager().beginTransaction().show(mImageAnswersFragment);
if(mAnswersFragment != null) fx.hide(mAnswersFragment);
if(mInputAnswersFragment != null) fx.hide(mInputAnswersFragment);
if(mSoundsAnswersFragment != null) fx.hide(mSoundsAnswersFragment).commit();
break;
case 9:
System.out.println("Wyświetlam fragment typu select sound");
android.app.FragmentTransaction fz = getFragmentManager().beginTransaction().show(mSoundsAnswersFragment);
if(mAnswersFragment != null) fz.hide(mAnswersFragment);
if(mInputAnswersFragment != null) fz.hide(mInputAnswersFragment);
if(mImageAnswersFragment != null) fz.hide(mImageAnswersFragment).commit();
break;
case 16: case 17:
System.out.println("Wyświetlam fragment typu input");
android.app.FragmentTransaction fa = getFragmentManager().beginTransaction().show(mInputAnswersFragment);
if(mAnswersFragment != null) fa.hide(mAnswersFragment);
if(mSoundsAnswersFragment != null) fa.hide(mSoundsAnswersFragment);
if(mImageAnswersFragment != null) fa.hide(mImageAnswersFragment).commit();
break;
default:
android.app.FragmentTransaction fy = getFragmentManager().beginTransaction().show(mAnswersFragment);
if(mImageAnswersFragment != null) fy.hide(mImageAnswersFragment);
if(mInputAnswersFragment != null) fy.hide(mInputAnswersFragment);
if(mSoundsAnswersFragment != null) fy.hide(mSoundsAnswersFragment).commit();
break;
}
}
public void setQuestion(int prevOrNext) {
if (prevOrNext == 1) {
if (questionCounter < testQuestions.size() - 1) {
questionCounter++;
currentQuestionTypeId = testQuestions.get(questionCounter).getQuestionTypeId();
currentQuestionWordId = testQuestions.get(questionCounter).getAnswerId();
String newQuestionToAsk = testQuestions.get(questionCounter).getQuestion();
mNumberFragment.setNumberOfQuestion(questionCounter + 1);
mQuestionFragment.setQuestionBasedOnType(currentQuestionTypeId, currentQuestionWordId, newQuestionToAsk);
mProgressFragment.setProgress(((((float) questionCounter) + 1) / (float) testQuestions.size()) * 100.0);
questionWords = populateCurrentListOfWords(testQuestions.get(questionCounter));
switchCurrentAnswerType(testQuestions.get(questionCounter));
populateAnswersForQuestion(testQuestions.get(questionCounter));
populateAnswersForInputQuestion(testQuestions.get(questionCounter));
mAnswersFragment.initiateAnswers(answerString, testQuestions.get(questionCounter).getAnswerTypeId(), currentAnswerId, currentAnswerId, 0, testQuestions.get(questionCounter).getAnswerId());
mImageAnswersFragment.initiateAnswers(answerString, testQuestions.get(questionCounter).getAnswerTypeId(), currentAnswerId, currentAnswerId, 0, testQuestions.get(questionCounter).getAnswerId());
mSoundsAnswersFragment.initiateAnswers(answerString, testQuestions.get(questionCounter).getAnswerTypeId(), currentAnswerId, currentAnswerId, 0, testQuestions.get(questionCounter).getAnswerId());
String currentString;
mInputAnswersFragment.initiateAnswers(inputAnswerString, testQuestions.get(questionCounter).getAnswerTypeId(), "", currentAnswerId, 0);
} else {
Toast.makeText(this, "To jest ostatnie pytanie w sprawdzianie", Toast.LENGTH_SHORT).show();
}
}
else if (prevOrNext == 2) {
System.out.println("Ustawiam wyniki sprawdzianu");
questionCounter = 0;
currentQuestionTypeId = testQuestions.get(questionCounter).getQuestionTypeId();
currentQuestionWordId = testQuestions.get(questionCounter).getAnswerId();
String newQuestionToAsk = testQuestions.get(questionCounter).getQuestion();
mNumberFragment.setNumberOfQuestion(questionCounter + 1);
mQuestionFragment.setQuestionBasedOnType(currentQuestionTypeId, currentQuestionWordId, newQuestionToAsk);
mProgressFragment.setProgress(((((float) questionCounter)+1)/ (float) testQuestions.size())*100.0);
questionWords = populateCurrentListOfWords(testQuestions.get(questionCounter));
switchCurrentAnswerType(testQuestions.get(questionCounter));
populateAnswersForQuestion(testQuestions.get(questionCounter));
populateAnswersForInputQuestion(testQuestions.get(questionCounter));
mAnswersFragment.initiateAnswers(answerString, testQuestions.get(questionCounter).getAnswerTypeId(), currentAnswerId, currentAnswerId, 0, testQuestions.get(questionCounter).getAnswerId());
mImageAnswersFragment.initiateAnswers(answerString, testQuestions.get(questionCounter).getAnswerTypeId(), currentAnswerId, currentAnswerId, 0, testQuestions.get(questionCounter).getAnswerId());
mSoundsAnswersFragment.initiateAnswers(answerString, testQuestions.get(questionCounter).getAnswerTypeId(), currentAnswerId, currentAnswerId, 0, testQuestions.get(questionCounter).getAnswerId());
String currentString;
mInputAnswersFragment.initiateAnswers(inputAnswerString, testQuestions.get(questionCounter).getAnswerTypeId(), "", currentAnswerId, 0);
}
else if (prevOrNext == -1) {
if (questionCounter > 0 ) {
questionCounter--;
currentQuestionTypeId = testQuestions.get(questionCounter).getQuestionTypeId();
currentQuestionWordId = testQuestions.get(questionCounter).getAnswerId();
String newQuestionToAsk = testQuestions.get(questionCounter).getQuestion();
mNumberFragment.setNumberOfQuestion(questionCounter + 1);
mQuestionFragment.setQuestionBasedOnType(currentQuestionTypeId, currentQuestionWordId, newQuestionToAsk);
mProgressFragment.setProgress(((((float) questionCounter)+1)/ (float) testQuestions.size())*100.0);
questionWords = populateCurrentListOfWords(testQuestions.get(questionCounter));
switchCurrentAnswerType(testQuestions.get(questionCounter));
populateAnswersForQuestion(testQuestions.get(questionCounter));
populateAnswersForInputQuestion(testQuestions.get(questionCounter));
mAnswersFragment.initiateAnswers(answerString, testQuestions.get(questionCounter).getAnswerTypeId(), currentAnswerId, currentAnswerId, 0, testQuestions.get(questionCounter).getAnswerId());
mImageAnswersFragment.initiateAnswers(answerString, testQuestions.get(questionCounter).getAnswerTypeId(), currentAnswerId, currentAnswerId, 0, testQuestions.get(questionCounter).getAnswerId());
mSoundsAnswersFragment.initiateAnswers(answerString, testQuestions.get(questionCounter).getAnswerTypeId(), currentAnswerId, currentAnswerId, 0, testQuestions.get(questionCounter).getAnswerId());
String currentString;
mInputAnswersFragment.initiateAnswers(inputAnswerString, testQuestions.get(questionCounter).getAnswerTypeId(), "", currentAnswerId, 0);
}
else {
Toast.makeText(this, "To jest pierwsze pytanie w sprawdzianie", Toast.LENGTH_SHORT).show();
}
}
else {
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
| [
"m.niezbecki@outlook.com"
] | m.niezbecki@outlook.com |
c3c2831958d47d5b2ed4cba03ca846fce2c96ea0 | 8590c6e57851522455a9260a714dbc86e6b3bc13 | /src/com/com/electromedica/in/mrptaskkiller/fireonscreenlockandrelease.java | c2ebb8d891e40c5e886712fa55a8f15db3b85b7c | [] | no_license | sevenuphome/AUTO-TASK-KILLER | 6566634b07f096ae876adc0df84f72dbc585cd8a | 57d6eecacaba0954316848b7162e714b43fb7727 | refs/heads/master | 2020-04-06T03:34:23.340746 | 2013-03-18T10:22:48 | 2013-03-18T10:22:48 | 9,095,938 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,061 | java | package com.electromedica.in.mrptaskkiller;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class fireonscreenlockandrelease extends BroadcastReceiver {
/**
* @see android.content.BroadcastReceiver#onReceive(Context,Intent)
*/
public static String ACTION_WIDGET_RECEIVER = "ActionReceiverUltraSimpleTaskKillerWidget";
@Override
public void onReceive(Context context, Intent intent) {
// TODO Put your code here
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
List<String> reservedPackages = new ArrayList<String>();
reservedPackages.add("system");
reservedPackages.add("com.android.launcher2");
reservedPackages.add("com.android.inputmethod.latin");
reservedPackages.add("com.android.phone");
reservedPackages.add("com.android.wallpaper");
reservedPackages.add("com.google.process.gapps");
reservedPackages.add("android.process.acore");
reservedPackages.add("android.process.media");
// On tue tous les processus, sauf ceux de la liste
int compteProcessusTues = 0;
ActivityManager am = (ActivityManager) context
.getSystemService(Activity.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> listeProcessus = am
.getRunningAppProcesses();
for (RunningAppProcessInfo processus : listeProcessus) {
Log.d("TKTKTK", "=========" + processus.pid + " : "
+ processus.processName);
String packageName = processus.processName.split(":")[0];
if (!context.getPackageName().equals(packageName)
&& !reservedPackages.contains(packageName)) {
am.restartPackage(packageName);
compteProcessusTues++;
}
}
} else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
List<String> reservedPackages = new ArrayList<String>();
reservedPackages.add("system");
reservedPackages.add("com.android.launcher2");
reservedPackages.add("com.android.inputmethod.latin");
reservedPackages.add("com.android.phone");
reservedPackages.add("com.android.wallpaper");
reservedPackages.add("com.google.process.gapps");
reservedPackages.add("android.process.acore");
reservedPackages.add("android.process.media");
// On tue tous les processus, sauf ceux de la liste
int compteProcessusTues = 0;
ActivityManager am = (ActivityManager) context
.getSystemService(Activity.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> listeProcessus = am
.getRunningAppProcesses();
for (RunningAppProcessInfo processus : listeProcessus) {
Log.d("TKTKTK", "=========" + processus.pid + " : "
+ processus.processName);
String packageName = processus.processName.split(":")[0];
if (!context.getPackageName().equals(packageName)
&& !reservedPackages.contains(packageName)) {
am.restartPackage(packageName);
compteProcessusTues++;
}
}
}
}
}
| [
"ankit4u3@gmail.com"
] | ankit4u3@gmail.com |
030591d3bb851f1b3b20d8cc8c4db09def21cba8 | a6bc96b13c6347d80bd65ccd9bc3b363a219c8b5 | /src/main/java/com/doing/travel/entity/Plan.java | 0444887dbcca650d53a42f2e7715a6f0ee1d0d22 | [] | no_license | OpenDoing/travelback | 2769b053613f0b03d1d5ca9a238dd5c0157d16a5 | 61d74d335f5556b86aebb7c85e51bec12a819816 | refs/heads/master | 2020-04-25T01:34:01.803199 | 2019-04-16T10:52:36 | 2019-04-16T10:52:36 | 172,412,168 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,862 | java | package com.doing.travel.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.Date;
@Entity
@Table(name = "plan")
public class Plan {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "user_id")
private Integer userId;
private String title;
private String start;
private String destination;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime ctime;
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date stime;
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date etime;
private Integer budget; //预算
private Integer people; //
private String fee; //出钱方式 AA? 男A女免? 我请客
private String cover; //封面
private String description;
public LocalDateTime getCtime() {
return ctime;
}
public void setCtime(LocalDateTime ctime) {
this.ctime = ctime;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getStart() {
return start;
}
public void setStart(String start) {
this.start = start;
}
public String getDestination() {
return destination;
}
public void setDestination(String destination) {
this.destination = destination;
}
public Date getStime() {
return stime;
}
public void setStime(Date stime) {
this.stime = stime;
}
public Date getEtime() {
return etime;
}
public void setEtime(Date etime) {
this.etime = etime;
}
public Integer getBudget() {
return budget;
}
public void setBudget(Integer budget) {
this.budget = budget;
}
public Integer getPeople() {
return people;
}
public void setPeople(Integer people) {
this.people = people;
}
public String getFee() {
return fee;
}
public void setFee(String fee) {
this.fee = fee;
}
public String getCover() {
return cover;
}
public void setCover(String cover) {
this.cover = cover;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| [
"dyninger@163.com"
] | dyninger@163.com |
f756eae3c54a6f0ec8ec6d47001b3ddd9c183b0e | 811629516c6f65587b32a183f0f8f92b2a0b0e94 | /src/sample/EditDialogController.java | 9bc211790c91f457bef7f26c1f4045f5400fb9b7 | [] | no_license | SergeyLosevRepo/TestFx_12 | e896112ae7050abfddc13a8e093425034e7993ef | 78c160da1d300c06bbd5c2b20effdd6970d22988 | refs/heads/master | 2021-01-01T16:28:05.197083 | 2017-07-20T13:31:07 | 2017-07-20T13:31:07 | 97,838,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,361 | java | package sample;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import java.net.URL;
import java.util.ResourceBundle;
/**
* Created by User on 13.07.17.
*/
public class EditDialogController implements Initializable{
@FXML public TextField txtName;
@FXML public TextField txtPhone;
@FXML public Button btnOk;
@FXML public Button btnCancel;
private Person person;
private ResourceBundle resourceBundle;
public void actionOk(ActionEvent actionEvent) {
this.person.setPhone(txtPhone.getText());
this.person.setFio(txtName.getText());
actionCancel(actionEvent);
}
public void setPerson (Person person){
this.person = person;
txtName.setText(person.getFio());
txtPhone.setText(person.getPhone());
}
public void actionCancel(ActionEvent actionEvent) {
Node source = (Node) actionEvent.getSource();
Stage stage = (Stage) source.getScene().getWindow();
stage.hide();
}
public Person getPerson() {
return this.person;
}
@Override
public void initialize(URL location, ResourceBundle resources) {
this.resourceBundle = resources;
}
}
| [
"losevsergio26@gmail.com"
] | losevsergio26@gmail.com |
b9c02ac572c2274d206ee52b1178d97c2d25e4ac | 96fd0d9fce51318aad2c6d6d5ffe1489bc645400 | /code/app/src/main/java/com/project/jessebalfe/languages/Score.java | e729df12a77370f99e3c85fdcf814f2b3bb1482f | [] | no_license | balfej3/2017-CA326-jbalfe-irishmadesimple | e7c70913fdcec6e8e868847c08ff2dde1530f937 | 0c9c8d2c886bd24d1e082be04671d97193aad5ad | refs/heads/master | 2021-01-12T17:26:25.023667 | 2018-11-14T16:01:36 | 2018-11-14T16:01:36 | 71,568,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,159 | java | package com.project.jessebalfe.languages;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
public class Score extends AppCompatActivity implements View.OnClickListener {
private Button logout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_score);
logout = (Button) findViewById(R.id.bLogout);
logout.setOnClickListener(this);
logout.getBackground().setColorFilter(0xFF00FF00, PorterDuff.Mode.MULTIPLY);
}
@Override
public void onClick(View v) {
//logs user out and returns to first activity register/login
if(v == logout){
FirebaseAuth.getInstance().signOut();
Toast.makeText(this, "See You Soon!", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this, Login.class);
startActivity(intent);
}
}
}
| [
"noreply@github.com"
] | balfej3.noreply@github.com |
65d6cde6478664a0afde844d5bbed427eb482240 | 56326a61656e5ca4e96ac735f2bfe34abe894f3f | /summDemo.java | e8f1b8050a5e3628890ab65c1aa1aaa5a578f7ec | [] | no_license | AshokKanjarla/Ashoka | ee95f7ee2207dc7013a1ccb446ecbba65e011b60 | 20f5356afee0fd598d4f8aa3e4cdc8886b7a6d8e | refs/heads/master | 2020-08-04T16:08:06.968658 | 2019-10-01T21:06:14 | 2019-10-01T21:06:14 | 212,197,441 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 314 | java | package com.nt.oops;
public class summDemo {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Ashok is Started");
Hello h =new Hello();
h.run();
System.out.println("Ashok is Ended");
}
}
| [
"noreply@github.com"
] | AshokKanjarla.noreply@github.com |
199baf2cdc8d8980f43e8dedfc9711e9a1881fc2 | 3e2cf0ccc59771d7183615becb8f0fe23dcb095e | /SmartBanking_Frontend/org/apache/http/client/methods/HttpEntityEnclosingRequestBase.java | d88a36e9d6786507084c7f3ef90fdeab5862166b | [] | no_license | Masebeni/smartBanking_f | de6a138d17ac8370dfd56e591a0d274144f0aa38 | 84128539a93168429020d740e3e897be6eb3b3c2 | refs/heads/master | 2020-04-18T08:47:22.344599 | 2016-09-02T20:53:52 | 2016-09-02T20:53:52 | 67,164,095 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 775 | java | package org.apache.http.client.methods;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.protocol.HTTP;
abstract class HttpEntityEnclosingRequestBase extends HttpRequestBase implements HttpEntityEnclosingRequest {
private HttpEntity entity;
public HttpEntityEnclosingRequestBase() {
this.entity = null;
}
public HttpEntity getEntity() {
return this.entity;
}
public void setEntity(HttpEntity entity) {
this.entity = entity;
}
public boolean expectContinue() {
Header expect = getFirstHeader(HTTP.EXPECT_DIRECTIVE);
return expect != null && HTTP.EXPECT_CONTINUE.equalsIgnoreCase(expect.getValue());
}
}
| [
"xmabeni1@gmail.com"
] | xmabeni1@gmail.com |
1715d20d7a8d518646cbc29be2344daabb355092 | f3457fde3b2f73309ade6b019ea0ee7d2d1c548b | /src/main/java/com/coxandkings/travel/bookingengine/db/utils/TrackingContextPatternConverter.java | 62203de317955544f151408747a7cced6b1e3256 | [] | no_license | suyash-capiot/bookingDB | c963a81b113da2187db0f5b734f52b48aabbba0c | fed7c1f6d454805863d09d1c262ff77a32296034 | refs/heads/master | 2020-04-01T23:46:08.548403 | 2018-10-19T11:27:34 | 2018-10-19T11:27:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 955 | java | package com.coxandkings.travel.bookingengine.db.utils;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.pattern.ConverterKeys;
import org.apache.logging.log4j.core.pattern.LogEventPatternConverter;
import org.apache.logging.log4j.core.pattern.PatternConverter;
@Plugin(name = "TrackingContextPatternConverter", category = PatternConverter.CATEGORY)
@ConverterKeys({"trkctx"})
public class TrackingContextPatternConverter extends LogEventPatternConverter {
private TrackingContextPatternConverter(String[]options) {
super("TrackingContext", "trackingContext");
}
public static TrackingContextPatternConverter newInstance(String[] options) {
return new TrackingContextPatternConverter(options);
}
@Override
public void format(LogEvent event, StringBuilder toAppendTo) {
toAppendTo.append(TrackingContext.getTrackingContext().toString());
}
}
| [
"sahil@capiot.com"
] | sahil@capiot.com |
59e19eab643459a5ee15796181ac950cfa96d291 | 9ce47475b068e130632d5470c40d76424e5fb6d0 | /resful-web-service/src/main/java/com/rest/resfulwebservice/helloworld/HelloWorldBean.java | 576431e74d6a386f6406528f525d93ecde3ff8b6 | [] | no_license | zemser/Todo-Applcation | 8084d2b49ad972739134a08c20b3089e65ff7ea0 | 0f7c138bafc07d9e4fc7ccab9667212c661ee3e8 | refs/heads/master | 2023-02-05T02:00:41.775434 | 2020-12-12T15:08:15 | 2020-12-12T15:08:15 | 320,850,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 494 | java | package com.rest.resfulwebservice.helloworld;
public class HelloWorldBean {
private String message;
public HelloWorldBean(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String toString() {
return "HelloWorldBean{" +
"message='" + message + '\'' +
'}';
}
}
| [
"zemser@gmail.com"
] | zemser@gmail.com |
89c9294dd4e01ba1afea1a65c49edc2848920a4a | 5f6c838a38a5bd2da31f7418a2dab94fc8fd2c6f | /app/src/main/java/com/example/cw/practice/api/Url.java | 16176d69a1329aa720b2b1c28ced2d019a4fb13a | [] | no_license | magic-coder/Practice | ffa4b75e950cbb2be29b48f7d81ba1e94338c81b | 6aa1d395681e3bf76bdfa7f818293fe4a0ffd703 | refs/heads/master | 2021-06-17T00:32:58.083862 | 2017-05-31T10:37:47 | 2017-05-31T10:37:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 178 | java | package com.example.cw.practice.api;
/**
* Created by cw on 2017/2/18.
*/
public class Url {
public static final String BASE_URL = "https://api.douban.com/v2/movie/";
}
| [
"284619466@qq.com"
] | 284619466@qq.com |
ebbe387dd268f8b6a1efcfeba92486778ae36ba5 | d748f8519e0cd870cba5057b8bf1516d5b797c85 | /src/main/java/com/jxau/yzm/mytravelproject/dao/AdminDao.java | ba717ccef7f182ffedf25ad214123dc5124f143e | [] | no_license | yezhiming157/Test_mytravel | 632c66617e7f87626ff7221383efd59af3d3a102 | 082490412ccb61e6042d41ab1a4b6ba309b5e52f | refs/heads/master | 2022-11-17T02:12:51.353824 | 2020-06-28T09:45:00 | 2020-06-28T09:45:00 | 275,550,605 | 7 | 0 | null | 2020-06-28T09:58:33 | 2020-06-28T09:25:03 | JavaScript | UTF-8 | Java | false | false | 747 | java | package com.jxau.yzm.mytravelproject.dao;
import com.jxau.yzm.mytravelproject.pojo.Admin;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
//继承JPARepository
public interface AdminDao extends JpaRepository<Admin,Integer>, JpaSpecificationExecutor<Admin> {
/**
* 查名字
* @param name
* @return
*/
@Query(value = "select * from Admin where name = ?1 ",nativeQuery = true)
public Admin findByName(String name);
@Query(value = "select * from Admin where name = ?1 and password =?2",nativeQuery = true)
public Admin findAdmin(String name,String password);
}
| [
"ye_zhm@hisuntech.com"
] | ye_zhm@hisuntech.com |
35005766a8b9ae29c93c52850197f0ed68d82510 | b0493e82e8d4aec3b7d4c34eeb8ef4aacc28be31 | /src/main/java/com/czh/interceptors/DownloadInterceptors.java | c5a6e5de8e7cf0df6587a58b873279d4e302350e | [] | no_license | haogit1024/springtest | 7b7020152d7569af8b002a6f645c38cb849c85f7 | c95a28fe2cda39190d15da3c839d9691fe02d02c | refs/heads/master | 2023-08-09T12:10:10.587584 | 2019-11-28T06:34:12 | 2019-11-28T06:34:12 | 93,315,115 | 0 | 0 | null | 2023-07-18T20:51:29 | 2017-06-04T13:26:29 | JavaScript | UTF-8 | Java | false | false | 3,478 | java | package com.czh.interceptors;
import com.czh.App;
import com.czh.entity.Error;
import com.czh.jwt.Payload;
import com.czh.util.Encrypt;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.log4j.Logger;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
public class DownloadInterceptors implements HandlerInterceptor {
private final Logger log = Logger.getLogger(DownloadInterceptors.class);
@Override
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
log.info("download interceptors run");
Encrypt encrypt = new Encrypt();
ObjectMapper mapper = new ObjectMapper();
String token = httpServletRequest.getParameter("token");
if ("".equals(token) || null == token) {
log.info("token");
responseError(httpServletResponse, mapper, 401, "UNAUTHORIZED");
return false;
}
// log.info("token = " + token);
String[] tokenData = token.split("\\.");
String base64Header = tokenData[0];
String base64Payload = tokenData[1];
String sign = tokenData[2];
String signStrTpl = base64Header + "." + base64Payload;
String payloadJson = encrypt.base64Decode(base64Payload);
// log.info("payload = " + payloadJson);
Payload payload = mapper.readValue(payloadJson, Payload.class);
Long now = new Date().getTime();
if (now > payload.getExp()) {
log.debug("token已过期");
//返回错误
responseError(httpServletResponse, mapper, 406, "SIGN_TIMEOUT");
return false;
}
String secret = App.SECRET;
// log.info("secret = " + secret);
String againSign = encrypt.hmacSHA256(signStrTpl, secret);
if (!againSign.equals(sign)) {
log.info("签名被篡改");
log.info("secret = " + secret);
log.info("signStrTpl = " + signStrTpl);
log.info("againSign = " + againSign);
log.info("sign = " + sign);
//返回错误
responseError(httpServletResponse, mapper, 406, "SIGN_FAIL");
return true;
}
//验证通过,将payload的aud(uid)保存在request中
String uid = payload.getAud();
log.info("uid = " + uid);
httpServletRequest.setAttribute("uid", uid);
return true;
}
@Override
public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
}
@Override
public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
}
private void responseError(HttpServletResponse response, ObjectMapper mapper,int status, String errorMsg) throws IOException {
response.setContentType("application/json; charset=utf-8");
response.setStatus(406);
PrintWriter out = response.getWriter();
String jsonResults = mapper.writeValueAsString(new Error(status, errorMsg));
out.write(jsonResults);
out.close();
}
}
| [
"120715979@qq.com"
] | 120715979@qq.com |
a7a3d0a94663737ec7c620ca4d7bec917e936a77 | 238cfa645e75989c19675f149466196ae6a704ec | /PiEvents/src/com/esprit/entites/Evenement.java | d94ff6b83011ae8c72c30f36239010fb67a212a5 | [] | no_license | oussamasouissi/Desktop | b4e7049cf89049f1e8187f73fa7d989de64b5baf | bb3e4138acf7188f7ac34131335ec16db71848a8 | refs/heads/master | 2020-06-19T08:43:48.616415 | 2019-05-24T08:13:43 | 2019-05-24T08:13:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,981 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.esprit.entites;
import java.util.Date;
/**
*
* @author souissi oussama
*/
public class Evenement
{
private int id;
private String titre ;
private float prix;
private String description;
private int duree ;
private int id_user;
private int etat;
private String image ;
private String type_event ;
public Evenement(int id, String titre, float prix, String description, int duree, int id_user, int etat, String image, String type_event) {
this.id = id;
this.titre = titre;
this.prix = prix;
this.description = description;
this.duree = duree;
this.id_user = id_user;
this.etat = etat;
this.image = image;
this.type_event = type_event;
}
public Evenement(String titre, float prix, String description, int duree, int id_user, int etat, String image, String type_event) {
this.titre = titre;
this.prix = prix;
this.description = description;
this.duree = duree;
this.id_user = id_user;
this.etat = etat;
this.image = image;
this.type_event = type_event;
}
public Evenement(String titre, float prix, String description, int duree, int id_user, int etat, String type_event) {
this.titre = titre;
this.prix = prix;
this.description = description;
this.duree = duree;
this.id_user = id_user;
this.etat = etat;
this.type_event = type_event;
}
public Evenement(String titre, float prix, String description, int duree, int id_user, String image, String type_event) {
this.titre = titre;
this.prix = prix;
this.description = description;
this.duree = duree;
this.id_user = id_user;
this.image = image;
this.type_event = type_event;
}
public Evenement(String titre, float prix, String description, int duree, int id_user, String type_event) {
this.titre = titre;
this.prix = prix;
this.description = description;
this.duree = duree;
this.id_user = id_user;
this.type_event = type_event;
}
public Evenement() {
}
public int getId() {
return id;
}
public String getTitre() {
return titre;
}
public float getPrix() {
return prix;
}
public String getDescription() {
return description;
}
public int getDuree() {
return duree;
}
public int getId_user() {
return id_user;
}
public int getEtat() {
return etat;
}
public String getImage() {
return image;
}
public String getType_event() {
return type_event;
}
public void setId(int id) {
this.id = id;
}
public void setTitre(String titre) {
this.titre = titre;
}
public void setPrix(float prix) {
this.prix = prix;
}
public void setDescription(String description) {
this.description = description;
}
public void setDuree(int duree) {
this.duree = duree;
}
public void setId_user(int id_user) {
this.id_user = id_user;
}
public void setEtat(int etat) {
this.etat = etat;
}
public void setImage(String image) {
this.image = image;
}
public void setType_event(String type_event) {
this.type_event = type_event;
}
@Override
public String toString() {
return "Evenement{" + "id=" + id + ", titre=" + titre + ", prix=" + prix + ", description=" + description + ", duree=" + duree + ", id_user=" + id_user + ", etat=" + etat + ", image=" + image + ", type_event=" + type_event + '}';
}
}
| [
"47186889+oussamasouissi@users.noreply.github.com"
] | 47186889+oussamasouissi@users.noreply.github.com |
9996a6b5e7eb4cd8a0241f024832eb6532ea413d | cfc60fc1148916c0a1c9b421543e02f8cdf31549 | /src/testcases/CWE23_Relative_Path_Traversal/CWE23_Relative_Path_Traversal__listen_tcp_67b.java | b9c45014144f4847a3d8e95cc6bbf2cdfe128f7c | [
"LicenseRef-scancode-public-domain"
] | permissive | zhujinhua/GitFun | c77c8c08e89e61006f7bdbc5dd175e5d8bce8bd2 | 987f72fdccf871ece67f2240eea90e8c1971d183 | refs/heads/master | 2021-01-18T05:46:03.351267 | 2012-09-11T16:43:44 | 2012-09-11T16:43:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,705 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE23_Relative_Path_Traversal__listen_tcp_67b.java
Label Definition File: CWE23_Relative_Path_Traversal.label.xml
Template File: sources-sink-67b.tmpl.java
*/
/*
* @description
* CWE: 23 Relative Path Traversal
* BadSource: listen_tcp Read data using a listening tcp connection
* GoodSource: A hardcoded string
* Sinks: readFile
* BadSink : no validation
* Flow Variant: 67 Data flow: data passed in a class from one method to another in different source files in the same package
*
* */
package testcases.CWE23_Relative_Path_Traversal;
import testcasesupport.*;
import java.io.*;
import javax.servlet.http.*;
public class CWE23_Relative_Path_Traversal__listen_tcp_67b
{
public void bad_sink(CWE23_Relative_Path_Traversal__listen_tcp_67a.Container data_container ) throws Throwable
{
String data = data_container.a;
String root = "C:\\uploads\\";
/* POTENTIAL FLAW: no validation of concatenated value */
File fIn = new File(root + data);
if( fIn.exists() && fIn.isFile() )
{
IO.writeLine(new BufferedReader(new FileReader(fIn)).readLine());
}
}
/* goodG2B() - use goodsource and badsink */
public void goodG2B_sink(CWE23_Relative_Path_Traversal__listen_tcp_67a.Container data_container ) throws Throwable
{
String data = data_container.a;
String root = "C:\\uploads\\";
/* POTENTIAL FLAW: no validation of concatenated value */
File fIn = new File(root + data);
if( fIn.exists() && fIn.isFile() )
{
IO.writeLine(new BufferedReader(new FileReader(fIn)).readLine());
}
}
}
| [
"amitf@chackmarx.com"
] | amitf@chackmarx.com |
5ce0791338c167807f786b9f8ae2ea7faed59e4b | 6b24fb152ede1b2916a1d0271dc14d3243aa06c8 | /src/com/semm/core/comando/og/LlamadaOg.java | 0046a3d28cb259b73ee6a420470aa5a22349242b | [] | no_license | githubsfuns/ion | e6d4edd5b9fc560e534abf7fd17bb2e6ee6dd393 | a231c31043250044f5ab7c7941f9266389d95e0e | refs/heads/master | 2020-04-06T18:05:46.904965 | 2017-04-04T16:26:14 | 2017-04-04T16:26:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,768 | java | package com.semm.core.comando.og;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import org.apache.log4j.Logger;
import ve.com.outsoft.Mabe.WebServices.SmsLocator;
import ve.com.outsoft.Mabe.WebServices.SmsSoap;
import com.semm.core.comando.Comando;
import com.semm.core.comando.Responder;
import com.semm.core.conexiones.CnxMensaje;
import com.semm.core.conexiones.ManejadorConexiones;
import com.semm.core.conexiones.NuevoMensaje;
import com.semm.core.conexiones.contenido.ContenidoSMS;
public class LlamadaOg extends Comando {
private static Logger log = Logger.getLogger(LlamadaOg.class);
private ManejadorConexiones mcnx = ManejadorConexiones.getInstancia();
@Override
public void ejecutar(NuevoMensaje m) {
CnxMensaje cnx = (CnxMensaje)m;
SmsLocator smsloc = new SmsLocator();
SmsSoap smssoap;
boolean ok = false;
int tries = 0;
while(!ok && tries < 3){
tries++;
try {
log.debug("Intento: " + tries);
smssoap = smsloc.getsmsSoap();
ok = smssoap.recibir(cnx.getPara(),cnx.getContenido().getMsg());
log.debug("Llamada a OG: " + cnx.getPara() + " - " + cnx.getContenido().getMsg() + " - " + ok);
} catch (Exception e) {
log.error(e);
e.printStackTrace();
if(tries >= 3){
CnxMensaje reply2 = new CnxMensaje();
reply2.setPara("0412915");
reply2.setCnx(cnx.getCnx());
reply2.setReport(false);
reply2.setProgramado(cnx.isProgramado());
reply2.setContenido(new ContenidoSMS("Erro con el WS de OG: " + e.getMessage()));
reply2.setServicio(cnx.getServicio());
reply2.setCliente(m.getCliente());
reply2.setOwner(m.getOwner());
mcnx.enviaraCola(reply2,cnx.getCnx());
}
}
}
}
}
| [
"mas@ignite.team"
] | mas@ignite.team |
d6fe3057672c0290b4b3f7a7f8301f6dc7a70102 | 07913c6017f736f298d76754d7495bce4f0c9c77 | /YanShanApp/mulit_file_download_lib/src/main/java/com/zls/www/mulit_file_download_lib/multi_file_download/manager/HttpProgressOnNextListener.java | 391d0f2e35f7e18b7218fa1e54e83e127626f509 | [] | no_license | LynTeam2/yanshan_android | 0229d94bda282fc63cc6dc9c7fbb597387904f49 | c712e7348f443e8476bb38bd1e5436540df1a721 | refs/heads/master | 2021-01-02T08:45:02.443848 | 2018-12-21T02:21:09 | 2018-12-21T02:21:09 | 99,061,284 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 841 | java | package com.zls.www.mulit_file_download_lib.multi_file_download.manager;
public abstract class HttpProgressOnNextListener<T> {
/**
* 成功后回调方法
* @param t
*/
public abstract void onNext(T t);
/**
* 开始下载
*/
public abstract void onStart();
/**
* 完成下载
*/
public abstract void onComplete();
/**
* 下载进度
* @param readLength
* @param countLength
*/
public abstract void updateProgress(long readLength, long countLength);
/**
* 失败或者错误方法
* 主动调用,更加灵活
* @param e
*/
public void onError(Throwable e){
}
/**
* 暂停下载
*/
public void onPuase(){
}
/**
* 停止下载销毁
*/
public void onStop(){
}
} | [
"635547767@qq.com"
] | 635547767@qq.com |
151af5f39255c71843fc646580dad1a796b7b5d3 | b2a635e7cc27d2df8b1c4197e5675655add98994 | /com/google/android/material/button/a.java | 3e46202c831eed22b1b91c21524f94f89d2b4121 | [] | no_license | history-purge/LeaveHomeSafe-source-code | 5f2d87f513d20c0fe49efc3198ef1643641a0313 | 0475816709d20295134c1b55d77528d74a1795cd | refs/heads/master | 2023-06-23T21:38:37.633657 | 2021-07-28T13:27:30 | 2021-07-28T13:27:30 | 390,328,492 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,154 | java | package com.google.android.material.button;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.RippleDrawable;
import android.os.Build;
import android.view.View;
import b.g.m.v;
import com.google.android.material.internal.h;
import e.f.a.f.a0.g;
import e.f.a.f.a0.k;
import e.f.a.f.a0.n;
import e.f.a.f.b;
import e.f.a.f.k;
import e.f.a.f.x.c;
import e.f.a.f.y.b;
class a {
private static final boolean s;
private final MaterialButton a;
private k b;
private int c;
private int d;
private int e;
private int f;
private int g;
private int h;
private PorterDuff.Mode i;
private ColorStateList j;
private ColorStateList k;
private ColorStateList l;
private Drawable m;
private boolean n = false;
private boolean o = false;
private boolean p = false;
private boolean q;
private LayerDrawable r;
static {
boolean bool;
if (Build.VERSION.SDK_INT >= 21) {
bool = true;
} else {
bool = false;
}
s = bool;
}
a(MaterialButton paramMaterialButton, k paramk) {
this.a = paramMaterialButton;
this.b = paramk;
}
private InsetDrawable a(Drawable paramDrawable) {
return new InsetDrawable(paramDrawable, this.c, this.e, this.d, this.f);
}
private void b(k paramk) {
if (c() != null)
c().setShapeAppearanceModel(paramk);
if (n() != null)
n().setShapeAppearanceModel(paramk);
if (b() != null)
b().setShapeAppearanceModel(paramk);
}
private g c(boolean paramBoolean) {
LayerDrawable layerDrawable = this.r;
if (layerDrawable != null && layerDrawable.getNumberOfLayers() > 0) {
if (s) {
layerDrawable = (LayerDrawable)((InsetDrawable)this.r.getDrawable(0)).getDrawable();
return (g)layerDrawable.getDrawable(paramBoolean ^ true);
}
layerDrawable = this.r;
return (g)layerDrawable.getDrawable(paramBoolean ^ true);
}
return null;
}
private Drawable m() {
boolean bool;
g g1 = new g(this.b);
g1.a(this.a.getContext());
androidx.core.graphics.drawable.a.a((Drawable)g1, this.j);
PorterDuff.Mode mode = this.i;
if (mode != null)
androidx.core.graphics.drawable.a.a((Drawable)g1, mode);
g1.a(this.h, this.k);
g g2 = new g(this.b);
g2.setTint(0);
float f = this.h;
if (this.n) {
bool = e.f.a.f.q.a.a((View)this.a, b.colorSurface);
} else {
bool = false;
}
g2.a(f, bool);
if (s) {
this.m = (Drawable)new g(this.b);
androidx.core.graphics.drawable.a.b(this.m, -1);
this.r = (LayerDrawable)new RippleDrawable(b.a(this.l), (Drawable)a((Drawable)new LayerDrawable(new Drawable[] { (Drawable)g2, (Drawable)g1 }, )), this.m);
return (Drawable)this.r;
}
this.m = (Drawable)new e.f.a.f.y.a(this.b);
androidx.core.graphics.drawable.a.a(this.m, b.a(this.l));
this.r = new LayerDrawable(new Drawable[] { (Drawable)g2, (Drawable)g1, this.m });
return (Drawable)a((Drawable)this.r);
}
private g n() {
return c(true);
}
private void o() {
g g1 = c();
g g2 = n();
if (g1 != null) {
g1.a(this.h, this.k);
if (g2 != null) {
boolean bool;
float f = this.h;
if (this.n) {
bool = e.f.a.f.q.a.a((View)this.a, b.colorSurface);
} else {
bool = false;
}
g2.a(f, bool);
}
}
}
int a() {
return this.g;
}
void a(int paramInt) {
if (c() != null)
c().setTint(paramInt);
}
void a(int paramInt1, int paramInt2) {
Drawable drawable = this.m;
if (drawable != null)
drawable.setBounds(this.c, this.e, paramInt2 - this.d, paramInt1 - this.f);
}
void a(ColorStateList paramColorStateList) {
if (this.l != paramColorStateList) {
this.l = paramColorStateList;
if (s && this.a.getBackground() instanceof RippleDrawable) {
((RippleDrawable)this.a.getBackground()).setColor(b.a(paramColorStateList));
return;
}
if (!s && this.a.getBackground() instanceof e.f.a.f.y.a)
((e.f.a.f.y.a)this.a.getBackground()).setTintList(b.a(paramColorStateList));
}
}
void a(TypedArray paramTypedArray) {
this.c = paramTypedArray.getDimensionPixelOffset(k.MaterialButton_android_insetLeft, 0);
this.d = paramTypedArray.getDimensionPixelOffset(k.MaterialButton_android_insetRight, 0);
this.e = paramTypedArray.getDimensionPixelOffset(k.MaterialButton_android_insetTop, 0);
this.f = paramTypedArray.getDimensionPixelOffset(k.MaterialButton_android_insetBottom, 0);
if (paramTypedArray.hasValue(k.MaterialButton_cornerRadius)) {
this.g = paramTypedArray.getDimensionPixelSize(k.MaterialButton_cornerRadius, -1);
a(this.b.a(this.g));
this.p = true;
}
this.h = paramTypedArray.getDimensionPixelSize(k.MaterialButton_strokeWidth, 0);
this.i = h.a(paramTypedArray.getInt(k.MaterialButton_backgroundTintMode, -1), PorterDuff.Mode.SRC_IN);
this.j = c.a(this.a.getContext(), paramTypedArray, k.MaterialButton_backgroundTint);
this.k = c.a(this.a.getContext(), paramTypedArray, k.MaterialButton_strokeColor);
this.l = c.a(this.a.getContext(), paramTypedArray, k.MaterialButton_rippleColor);
this.q = paramTypedArray.getBoolean(k.MaterialButton_android_checkable, false);
int i = paramTypedArray.getDimensionPixelSize(k.MaterialButton_elevation, 0);
int j = v.u((View)this.a);
int m = this.a.getPaddingTop();
int n = v.t((View)this.a);
int i1 = this.a.getPaddingBottom();
this.a.setInternalBackground(m());
g g = c();
if (g != null)
g.a(i);
v.a((View)this.a, j + this.c, m + this.e, n + this.d, i1 + this.f);
}
void a(PorterDuff.Mode paramMode) {
if (this.i != paramMode) {
this.i = paramMode;
if (c() != null && this.i != null)
androidx.core.graphics.drawable.a.a((Drawable)c(), this.i);
}
}
void a(k paramk) {
this.b = paramk;
b(paramk);
}
void a(boolean paramBoolean) {
this.q = paramBoolean;
}
public n b() {
LayerDrawable layerDrawable = this.r;
if (layerDrawable != null && layerDrawable.getNumberOfLayers() > 1) {
if (this.r.getNumberOfLayers() > 2) {
Drawable drawable1 = this.r.getDrawable(2);
return (n)drawable1;
}
Drawable drawable = this.r.getDrawable(1);
return (n)drawable;
}
return null;
}
void b(int paramInt) {
if (!this.p || this.g != paramInt) {
this.g = paramInt;
this.p = true;
a(this.b.a(paramInt));
}
}
void b(ColorStateList paramColorStateList) {
if (this.k != paramColorStateList) {
this.k = paramColorStateList;
o();
}
}
void b(boolean paramBoolean) {
this.n = paramBoolean;
o();
}
g c() {
return c(false);
}
void c(int paramInt) {
if (this.h != paramInt) {
this.h = paramInt;
o();
}
}
void c(ColorStateList paramColorStateList) {
if (this.j != paramColorStateList) {
this.j = paramColorStateList;
if (c() != null)
androidx.core.graphics.drawable.a.a((Drawable)c(), this.j);
}
}
ColorStateList d() {
return this.l;
}
k e() {
return this.b;
}
ColorStateList f() {
return this.k;
}
int g() {
return this.h;
}
ColorStateList h() {
return this.j;
}
PorterDuff.Mode i() {
return this.i;
}
boolean j() {
return this.o;
}
boolean k() {
return this.q;
}
void l() {
this.o = true;
this.a.setSupportBackgroundTintList(this.j);
this.a.setSupportBackgroundTintMode(this.i);
}
}
/* Location: /home/yc/Downloads/LeaveHomeSafe.jar!/com/google/android/material/button/a.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.1.3
*/ | [
"game0427game@gmail.com"
] | game0427game@gmail.com |
e12cd0dc458d9b33d5133b1df4242d4d6ee230c6 | 8a573699442fed9a7353a2c6f51cd6160c251739 | /app/src/main/java/com/example/xyzreader/data/source/remote/RemoteArticleDataSource.java | 85c1a246090fffc8d85137c7e18134540d1e8846 | [] | no_license | Bloody-Badboy/XYZ-Reader | 79cc025cc24fcbbb1dae5ee53bbc02874cca5f9f | 8177c001c60b3741757751447e3adf55ca002217 | refs/heads/master | 2020-07-26T16:43:23.606230 | 2018-10-19T15:31:19 | 2018-10-19T15:31:19 | 208,706,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,639 | java | package com.example.xyzreader.data.source.remote;
import com.example.xyzreader.data.source.ArticleDataSource;
import com.example.xyzreader.data.model.Article;
import java.io.IOException;
import java.util.List;
public class RemoteArticleDataSource implements ArticleDataSource {
private static volatile RemoteArticleDataSource sInstance = null;
private final ArticleDataService articleDataService;
private RemoteArticleDataSource(ArticleDataService articleDataService) {
this.articleDataService = articleDataService;
if (sInstance != null) {
throw new AssertionError(
"Another instance of "
+ RemoteArticleDataSource.class.getName()
+ " class already exists, Can't create a new instance.");
}
}
public static RemoteArticleDataSource getInstance(ArticleDataService articleDataService) {
if (sInstance == null) {
synchronized (RemoteArticleDataSource.class) {
if (sInstance == null) {
sInstance = new RemoteArticleDataSource(articleDataService);
}
}
}
return sInstance;
}
@Override public List<Article> getArticlesFromLocal() {
throw new UnsupportedOperationException("Method not implemented.");
}
@Override public List<Article> getArticlesFromServer() throws IOException {
return articleDataService.getArticles();
}
@Override public void storeArticlesLocally(List<Article> articles) {
throw new UnsupportedOperationException("Method not implemented.");
}
@Override public Article getArticleById(int articleId) {
throw new UnsupportedOperationException("Method not implemented.");
}
} | [
"arpan.asr30@gmail.com"
] | arpan.asr30@gmail.com |
ff96dd86757d3be38a7696f52c222a782790ab54 | 957f9e271f5d89c324322a1340c91bf16cdc2902 | /src/main/java/ru/d_shap/rucon/delegate/PropertiesObjectDelegate.java | c9d5366f2edb0c9150951b88051eb80778037e21 | [] | no_license | d-shap/rucon | 541413419013edfa44c930781528050ec22c43cc | 9f3ec62ab202cc1fd6990e56151fc61e2ab4c877 | refs/heads/master | 2022-10-10T20:44:56.170549 | 2022-09-13T10:06:14 | 2022-09-13T10:06:14 | 194,734,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,871 | java | ///////////////////////////////////////////////////////////////////////////////////////////////////
// RuCon is the application configuration helper.
// Copyright (C) 2019 Dmitry Shapovalov.
//
// This file is part of RuCon.
//
// RuCon is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RuCon is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
///////////////////////////////////////////////////////////////////////////////////////////////////
package ru.d_shap.rucon.delegate;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import ru.d_shap.rucon.BaseConfig;
import ru.d_shap.rucon.ConfigDelegate;
/**
* Configuration delegate for the properties.
*
* @author Dmitry Shapovalov
*/
public final class PropertiesObjectDelegate extends BaseConfig implements ConfigDelegate {
private final Map<Object, Object> _properties;
/**
* Create new object.
*
* @param properties the properties object.
* @param excludeProperties the properties to exclude.
*/
public PropertiesObjectDelegate(final Map<Object, Object> properties, final Set<String> excludeProperties) {
super(null, null, null, excludeProperties);
if (properties == null) {
_properties = new HashMap<>();
} else {
_properties = properties;
}
}
@Override
public Set<String> getNames() {
Map<String, String> properties = new HashMap<>();
fillObjectMap(_properties, properties);
excludeProperties(properties);
return new HashSet<>(properties.keySet());
}
@Override
public String getProperty(final String name) {
if (isExcludeProperty(name)) {
return null;
} else {
Object value = getValue(name);
return getString(value);
}
}
private Object getValue(final String name) {
for (Map.Entry<Object, Object> entry : _properties.entrySet()) {
String key = getString(entry.getKey());
if (key == null) {
if (name == null) {
return entry.getValue();
}
} else {
if (key.equals(name)) {
return entry.getValue();
}
}
}
return null;
}
}
| [
"shenf@mail.ru"
] | shenf@mail.ru |
ec86c2210cc92cc7c6ecc68e4bf3eb600ed71523 | b0dfc7557bd4935f90b514d46427dcfd1d85c30e | /sunCertifiedJavaProgrammer/chapter04/P307/src/TestOR.java | 1d2919bbec39fb4c9e9c8ffd36ec47f20fa10cad | [] | no_license | jareklaskowski7/javaCertifications | fcf99625594dd58a5c77098d72d720f2334fd2b0 | d08f18e9bf9da8a9cf5a32caf0467bb0e47ff190 | refs/heads/master | 2023-05-11T23:25:19.571714 | 2021-06-03T02:23:56 | 2021-06-03T02:23:56 | 373,316,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 585 | java | // Sun Certified Java Programmer
// Chapter 4, P307
// Operators
class TestOR {
public static void main(String[] args) {
if ((isItSmall(3)) || (isItSmall(7))) {
System.out.println("Result is true");
}
if ((isItSmall(6)) || (isItSmall(9))) {
System.out.println("Result is true");
}
}
public static boolean isItSmall(int i) {
if (i < 5) {
System.out.println("i < 5");
return true;
} else {
System.out.println("i >= 5");
return false;
}
}
}
| [
"jareklaskowski7@gmail.com"
] | jareklaskowski7@gmail.com |
6380f399fc8542502b935efae5cbc003c3a8dae2 | dd5b3e08eb436754484b44c6f3c7cceb66a4da7a | /src/com/ttw/vrj/timetowork/LocationActivity.java | 46d5c8d59f0644d2c31740e43065e73258ff0cda | [] | no_license | vladimirjeune/TimeToWork | 072f2545d2811f6dfc41f3f5575d94e2a40974dc | 8104a680e6412f8d87127c4ec7ac20c2b78d3e97 | refs/heads/master | 2020-05-20T11:56:32.520667 | 2015-07-23T06:45:04 | 2015-07-23T06:45:04 | 38,103,837 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,692 | java | package com.ttw.vrj.timetowork;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
public class LocationActivity extends ActionBarActivity {
private final String LOG_TAG = LocationActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_location);
FragmentManager fm = getSupportFragmentManager();
// Ask FragmentManager for Fragment w/ this container view id
// If already in the list because of previous screen rotation; return it.
Fragment fragment = fm.findFragmentById(R.id.container);
if (fragment == null) {
fragment = new LocationFragment();
// FragmentManager class uses fluent interface so actions can be chained
// Create new FragmentTransaction, include one add operation in it, then
// commit
fm.beginTransaction().add(R.id.container, fragment).commit();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.location, 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();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"randyjeune@gmail.com"
] | randyjeune@gmail.com |
9d960865a94654c4388c5f1615cbd95d58f11dc3 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/main/java/org/gradle/test/performancenull_218/Productionnull_21723.java | 89bcf7baeb04d47e4e5907d14325e798e65e2870 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 588 | java | package org.gradle.test.performancenull_218;
public class Productionnull_21723 {
private final String property;
public Productionnull_21723(String param) {
this.property = param;
}
public String getProperty() {
return property;
}
private String prop0;
public String getProp0() {
return prop0;
}
public void setProp0(String value) {
prop0 = value;
}
private String prop1;
public String getProp1() {
return prop1;
}
public void setProp1(String value) {
prop1 = value;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
a3f93e597a1dcc4c0a1bb690015a0e074308f049 | af5d7ed8303edafc9cb889826de943289ac7107b | /jop-test/src/test/java/cz/zcu/kiv/jop/session/ExtendedRandomGeneratorSessionImplTest.java | ef02d3180ed9a372511a25344dcbe889e9539d86 | [
"Apache-2.0"
] | permissive | mrfranta/jop-discontinued | b7ef82f197c21f3ce8ccb6a93dc132e02ca4b4f9 | 3bf6045f2dc780459a0e77cdafb0fc03302fcc42 | refs/heads/master | 2021-05-31T05:46:30.982467 | 2016-05-11T22:36:49 | 2016-05-11T22:36:49 | 43,321,360 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,227 | java | package cz.zcu.kiv.jop.session;
import java.lang.annotation.Annotation;
import java.util.Random;
import org.junit.Assert;
import org.junit.Test;
import cz.zcu.kiv.jop.annotation.FooImpl;
/**
* Test of session class {@link ExtendedRandomGeneratorSessionImpl}.
*
* @author Mr.FrAnTA
*/
public class ExtendedRandomGeneratorSessionImplTest {
/**
* Test of method {@link ExtendedRandomGeneratorSessionImpl#setRandomGenerator} for null
* annotation which expects {@link IllegalArgumentException}.
*/
@Test(expected = IllegalArgumentException.class)
public void testSetGeneratorForNullAnnotation() {
/*----- Preparation -----*/
ExtendedRandomGeneratorSessionImpl session = new ExtendedRandomGeneratorSessionImpl();
/*----- Execution & Verify -----*/
session.setRandomGenerator(null, new Random());
}
/**
* Test of method {@link ExtendedRandomGeneratorSessionImpl#setRandomGenerator} for null generator
* which "resets" the generator in session.
*/
@Test
public void testSetGeneratorForNullGenerator() {
/*----- Preparation -----*/
ExtendedRandomGeneratorSessionImpl session = new ExtendedRandomGeneratorSessionImpl();
Annotation foo = new FooImpl(0);
Random fooRand = new Random();
/*----- Execution -----*/
session.setRandomGenerator(foo, fooRand);
Random oldRand = session.setRandomGenerator(foo, null);
/*----- Verify -----*/
Assert.assertEquals(fooRand, oldRand);
Assert.assertNotEquals(fooRand, session.getRandomGenerator(foo));
}
/**
* Test of method {@link ExtendedRandomGeneratorSessionImpl#setRandomGenerator} for given random
* generator which sets the generator in session.
*/
@Test
public void testSetGenerator() {
/*----- Preparation -----*/
ExtendedRandomGeneratorSessionImpl session = new ExtendedRandomGeneratorSessionImpl();
Annotation foo = new FooImpl(0);
Random fooRand = new Random();
/*----- Execution -----*/
Random oldRand = session.setRandomGenerator(foo, fooRand);
/*----- Verify -----*/
Assert.assertNull(oldRand); // no previous generator
Assert.assertEquals(fooRand, session.getRandomGenerator(foo));
}
/**
* Test of method {@link ExtendedRandomGeneratorSessionImpl#setRandomGenerator} which re-sets the
* generator in session.
*/
@Test
public void testReSetGenerator() {
/*----- Preparation -----*/
ExtendedRandomGeneratorSessionImpl session = new ExtendedRandomGeneratorSessionImpl();
Annotation foo = new FooImpl(0);
Random newRand = new Random();
/*----- Execution -----*/
Random fooRand = session.getRandomGenerator(foo);
Random oldRand = session.setRandomGenerator(foo, newRand);
/*----- Verify -----*/
Assert.assertEquals(fooRand, oldRand);
Assert.assertEquals(newRand, session.getRandomGenerator(foo));
}
/**
* Test of method {@link ExtendedRandomGeneratorSessionImpl#setRandomGenerator} which sets
* generator for different instances of annotations.
*/
@Test
public void testSetGeneratorForDifferentAnnotations() {
/*----- Preparation -----*/
ExtendedRandomGeneratorSessionImpl session = new ExtendedRandomGeneratorSessionImpl();
Annotation foo0 = new FooImpl(0);
Random fooRand0 = new Random();
Annotation foo1 = new FooImpl(1);
Random fooRand1 = new Random();
/*----- Execution -----*/
session.setRandomGenerator(foo0, fooRand0);
session.setRandomGenerator(foo1, fooRand1);
/*----- Verify -----*/
Assert.assertNotEquals(session.getRandomGenerator(foo0), session.getRandomGenerator(foo1));
}
/**
* Test of method {@link ExtendedRandomGeneratorSessionImpl#getRandomGenerator} which for first
* call returns new instance of random generator.
*/
@Test
public void testGetGeneratorForFirstGet() {
/*----- Preparation -----*/
ExtendedRandomGeneratorSessionImpl session = new ExtendedRandomGeneratorSessionImpl();
Annotation foo = new FooImpl(0);
/*----- Execution -----*/
Assert.assertNotNull(session.getRandomGenerator(foo));
}
/**
* Test of method {@link ExtendedRandomGeneratorSessionImpl#getRandomGenerator} which returns same
* generator for different instances of annotations.
*/
@Test
public void testGetGeneratorForDifferentAnnotations() {
/*----- Preparation -----*/
ExtendedRandomGeneratorSessionImpl session = new ExtendedRandomGeneratorSessionImpl();
Annotation foo0 = new FooImpl(0);
Annotation foo1 = new FooImpl(1);
/*----- Execution -----*/
Assert.assertNotEquals(session.getRandomGenerator(foo0), session.getRandomGenerator(foo1));
}
/**
* Test of method {@link ExtendedRandomGeneratorSessionImpl#clear()} which removes all stored
* random generators in cache.
*/
@Test
public void testClear() {
/*----- Preparation -----*/
ExtendedRandomGeneratorSessionImpl session = new ExtendedRandomGeneratorSessionImpl();
Annotation foo = new FooImpl(0);
Random fooRand = new Random();
session.setRandomGenerator(foo, fooRand);
/*----- Execution -----*/
session.clear();
/*----- Verify -----*/
Assert.assertNotEquals(fooRand, session.getRandomGenerator(foo));
}
}
| [
"michal.dekany@seznam.cz"
] | michal.dekany@seznam.cz |
17ab538f6e6e25e6a4daf900b156436c3c533a40 | 2ce0b6c3ce78b11e944d1d226f1cea4c0c9b3401 | /src/ejercicioslemos/MiEjer13.java | ad2aef953a983530c89f9195188b58ce0392314c | [] | no_license | denulemos/Java-General | 5d754238337d163b1095d7f4a6d624675f85e71d | 9ee8bf33caeaf0ece6421403f5802a5e4150afea | refs/heads/master | 2021-07-17T00:20:23.198504 | 2017-10-25T14:50:44 | 2017-10-25T14:50:44 | 108,281,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,881 | java | /*
Dada la TNA que me brinda una financiera y el capital invertido, se pide:
Efectuar un programa que calcule el total obtenido al cabo de un año si
se invierte en periododo mensuales con capitalizacion y la TEA.
*/
package ejercicioslemos;
import java.util.Scanner;
/**
* @author Denisse Lemos
*/
public class MiEjer13 {
public void MiEjer()
{
System.out.println(" Ejercicio 13: "
+ " Dada la TNA que me brinda una financiera y el"
+ " capital invertido, se pide: Efectuar un programa"
+ " que calcule el total obetido al cabo de un año si"
+ " se invierte en periodo mensuales con capitalizacion"
+ " y la TEA ");
Scanner entra0 = new Scanner(System.in);
//Definicion de variables
double capital, TNA = 0;
double total, TEA;
double tasa;
int i = 0; //Variable de control para el ciclo repetitivo
//Entradas
System.out.print("Ingrese el Capital invertido: ");
while (!entra0.hasNextDouble()) //Mientras la entrada no sea decimal, aparece ese cartel
{
System.out.println("Error: Ingrese un numero decimal");
entra0.next();
}
TNA=entra0.nextDouble();
System.out.println("Ingrese la TNA: ");
if (entra0.hasNextDouble()) //Si la entrada es un decimal
{
TNA = entra0.nextDouble();
}
else //Si no es un decimal...
{
System.out.println("Error: Ingrese un numero decimal");
}
// PROCESO
total = 1000;
TEA = 10;
//Salidas
System.out.println("El total obtenido es: " + total);
System.out.println("La TEA obtenida es: " + TEA);
}
}
| [
"alumno@DESKTOP-CNRL87V"
] | alumno@DESKTOP-CNRL87V |
2be267e1249f832a7fabcea8b7ed1b962ffc7e41 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/26/26_4a9b7ff263cb771bce457cf00120ebf069987d9c/Francify/26_4a9b7ff263cb771bce457cf00120ebf069987d9c_Francify_t.java | 3c45ebc5c5b746cf42b831b694c43f86b9280155 | [] | 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 | 15,325 | java | import java.io.File;
import java.util.Set;
import java.util.TreeMap;
import processing.core.PApplet;
import processing.core.PFont;
public class Francify extends PApplet {
private static final long serialVersionUID = 1L;
public static final int PART_ONE = 0, PART_TWO = 1;
public static final boolean DRAW_DISTANCE = true;
public static final boolean DRAW_SPEED= false;
public static void main(String[] args) {
PApplet.main(new String[] { "--present", "Francify" });
}
//Skinning Color Variables
int darkColor = 0xFF002E3E;
int dataColor0 = 0xFF002E3E;
int dataColor1 = 0xFF88c23c;
Slider s;
boolean unpressed;
boolean movingSlider, leftHandle, rightHandle;
static int fontSize = 10;
PFont myFont;
PFont largerFont;
int rangeMin, rangeMax, minSYear, maxSYear;
int graphX, graphY, graphW, graphH;
int currentDisplayed;
String sliderLabel, title;
float minSpeed, maxSpeed, minDistance, maxDistance;
TreeMap<Integer, RaceRow> data;
TreeMap<String, Integer> numMedals;
public void setup() {
size(1000, 600);
graphX = 100;
graphY = 50;
graphW = getWidth() - 200;
graphH = getHeight() - 200;
frameRate(30);
currentDisplayed = PART_ONE;
unpressed = true;
movingSlider = false;
leftHandle = false;
rightHandle = false;
myFont = createFont("BrowalliaNew", fontSize);
largerFont = createFont("BrowalliaNew", 24);
// Handle data import
data = new TreeMap<Integer, RaceRow>();
numMedals = new TreeMap<String, Integer>();
minSpeed = minDistance = Float.MAX_VALUE;
maxSpeed = maxDistance = 0.0f;
minSYear = Integer.MAX_VALUE;
maxSYear = Integer.MIN_VALUE;
String[] lines = loadStrings("data"+File.separator+"Tour_De_France_Data.csv");
for(int i = 1; i < lines.length; i++){
String[] parts = lines[i].split(",");
RaceRow rr = new RaceRow();
rr.year = Integer.parseInt(parts[0]);
if(rr.year > maxSYear)
maxSYear = rr.year;
if(rr.year < minSYear)
minSYear = rr.year;
rr.firstPlaceRider = parts[1];
rr.firstCountryID = Integer.parseInt(parts[2]);
rr.firstPlaceCountry = parts[3];
rr.firstPlaceTeam = parts[4];
rr.secondPlaceRider = parts[5];
rr.c2nd = Float.parseFloat(parts[6]);
rr.secondCountryID = Integer.parseInt(parts[7]);
rr.secondPlaceCountry = parts[8];
rr.secondPlaceTeam = parts[9];
rr.thirdPlaceRider = parts[10];
rr.c3rd = Float.parseFloat(parts[11]);
rr.thirdCountryID = Integer.parseInt(parts[12]);
rr.thirdPlaceCountry = parts[13];
rr.thirdPlaceTeam = parts[14];
rr.numStages = Integer.parseInt(parts[15]);
if (parts.length > 16 && !parts[16].equals("")){
rr.distance = Float.parseFloat(parts[16]);
if(rr.distance > maxDistance)
maxDistance = rr.distance;
if(rr.distance < minDistance)
minDistance = rr.distance;
}
if (parts.length > 17 && !parts[17].equals("")){
rr.avgSpeed = Float.parseFloat(parts[17]);
if(rr.avgSpeed > maxSpeed)
maxSpeed = rr.avgSpeed;
if(rr.avgSpeed < minSpeed)
minSpeed = rr.avgSpeed;
}
if (parts.length > 18)
rr.bestTeam = parts[18];
Integer medals = numMedals.get(rr.firstPlaceCountry);
if(medals == null){
numMedals.put(rr.firstPlaceCountry, 1);
} else {
numMedals.put(rr.firstPlaceCountry, medals + 1);
}
data.put(rr.year, rr);
}
s = new Slider(graphX, graphY + graphH + 50, graphW, 50);
int[] vals = new int[maxSYear - minSYear];
for(int i = minSYear; i < maxSYear; i++){
vals[i-minSYear] = i;
}
s.setValues(vals);
s.setDrawInterval(10);
sliderLabel = "Years";
title = "Tour de France, 1903 - 2009";
}
public void draw() {
// Handle data drawing
background(0xcccccc);
drawAxes();
s.drawSlider();
drawRange();
handleInput();
drawData(DRAW_DISTANCE, s.getLeftBound(), s.getRightBound());
drawData(DRAW_SPEED, s.getLeftBound(), s.getRightBound());
updateAnim();
if (!mousePressed)
updateCursor();
}
public void updateCursor(){
int pos = s.whereIs(mouseX, mouseY);
switch(pos){
case Slider.OUTSIDE:
cursor(ARROW);
break;
case Slider.INSIDE:
cursor(MOVE);
break;
case Slider.LEFTHANDLE:
case Slider.RIGHTHANDLE:
cursor(HAND);
}
}
public void drawRange(){
fill(darkColor);
textFont(largerFont);
if(rangeMin == rangeMax){
String range = ""+rangeMin;
int rangeWidth = (int)(textWidth(range) + 0.5);
int rangeX = getWidth()/2 - rangeWidth/2;
int rangeY = graphY + graphH + 25;
text(range, rangeX, rangeY);
} else {
String range = ""+rangeMin;
int rangeWidth = (int)(textWidth(range) + 0.5);
int rangeX = graphX;
int rangeY = graphY + graphH + 25;
text(range, rangeX, rangeY);
range = ""+rangeMax;
rangeWidth = (int)(textWidth(range) + 0.5);
rangeX = graphX + graphW - rangeWidth;
rangeY = graphY + graphH + 25;
text(range, rangeX, rangeY);
}
int width = (int)(textWidth(sliderLabel) + 0.5);
text(sliderLabel, getWidth()/2 - width/2, 590);
width = (int)(textWidth(title)+0.5);
text(title, getWidth()/2 - width/2, 25);
}
public void handleInput(){
// Handle user input
if (mousePressed == true) {
if (unpressed) {
// Everything within this block occurs when first clicked
// (pressed state toggles on)
unpressed = false;
int loc = s.whereIs(mouseX, mouseY);
if (loc == Slider.INSIDE)
movingSlider = true;
else if (loc == Slider.LEFTHANDLE)
leftHandle = true;
else if (loc == Slider.RIGHTHANDLE)
rightHandle = true;
} else {
// Everything in this block occurs when the mose has been
// pressed for some period (clicking and dragging, etc.)
if(movingSlider){
s.dragAll(mouseX, pmouseX);
} else if(leftHandle){
s.dragLH(mouseX, pmouseX);
} else if(rightHandle){
s.dragRH(mouseX, pmouseX);
}
s.snapGoals();
}
}
}
public void updateAnim(){
// Update animation values (simple spring animation)
int speed = 4;
s.updateAnim(speed);
}
public void mouseReleased() {
unpressed = true;
movingSlider = false;
leftHandle = false;
rightHandle = false;
s.updateGoals();
}
public void toggleView(){
// FIXME: Finish this method
if(currentDisplayed == PART_ONE){
s = new Slider(50,700,500,150);
Set<Integer> keys = data.keySet();
int min = Integer.MAX_VALUE, max = 0;
for(int i : keys){
if(i < min)
min = i;
if(i > max)
max = i;
}
} else {
s = new Slider(50,700,500,150);
}
currentDisplayed = (currentDisplayed + 1) % 2;
}
public void drawAxes() {
// Draw Axes Lines
stroke(darkColor);
strokeWeight(3);
strokeJoin(BEVEL);
strokeCap(SQUARE);
noFill();
beginShape();
vertex(graphX, graphY);
vertex(graphX, graphY + graphH);
vertex(graphX + graphW, graphY + graphH);
endShape();
// Draw Labels
}
public void drawData(boolean distanceOrSpeed, int minBound, int maxBound,
int strokeWidth, float graphX, float graphY, float graphWidth,
float graphHeight) {
// Set colors and draw lines.
noFill();
beginShape();
strokeWeight(strokeWidth);
//Get and draw data
float y = 0, lastX = 0;
// Weather it is actively drawing or not. Prevents drawing all
// points in gaps of data
boolean activeDraw = true;
for(int i = minBound; i <= maxBound; i++){
RaceRow rr = data.get(i);
if ((rr != null) && (rr.distance > 0)){
float year = mapToPlotX(rr.year, minBound, maxBound, graphX, graphWidth);
if (distanceOrSpeed == DRAW_DISTANCE){
y = mapToPlotY(rr.distance, minDistance, maxDistance,
graphY, graphHeight);
stroke(rgba(dataColor0, 0x88));
}
else { //(distanceOrSpeed == DRAW_SPEED)
y = mapToPlotY(rr.avgSpeed, minSpeed, maxSpeed,
graphY, graphHeight);
stroke(rgba(dataColor1, 0x88));
}
if(!activeDraw){
activeDraw = true;
curveVertex(year, y);
}
if(i == minBound || i == maxBound){
curveVertex(year, y);
}
curveVertex(year, y);
lastX = year;
}
else{
if(activeDraw){
activeDraw = false;
curveVertex(lastX, y);
}
endShape();
beginShape();
}
}
endShape();
}
public void drawData(boolean distanceOrSpeed, int minBound, int maxBound) {
drawData(distanceOrSpeed, minBound, maxBound, 3, graphX, graphY,
graphW, graphH);
}
public float mapToPlotY(float y, float min, float max, float graphY,
float graphHeight) {
// Maps actual values to locations we want to draw
//Uses 10% buffer to make data more readable
int buffer = (int) ((max - min) * 0.1);
float newY = map(
y,
min - buffer,
max + buffer,
graphY + graphHeight,
graphY
);
return newY;
}
public float mapToPlotX(float x, float minBound, float maxBound,
float graphX, float graphWidth) {
float newX = map(x, minBound, maxBound, graphX, graphX + graphWidth);
return newX;
}
public int rgba(int rgb, int a){
return rgb & ((a << 24) | 0xFFFFFF);
}
public int rgba(int rgb, float a){
if(a < 0)
a = 0;
if(a > 255)
a = 255;
return rgba(rgb, a * 255);
}
private class Slider {
int x, y, w, h;
float left, right;
int goalLeft, goalRight;
int snappedLeft, snappedRight;
int drawInterval;
int[] values;
public static final int OUTSIDE = 0, INSIDE = 1, LEFTHANDLE = 2,
RIGHTHANDLE = 3;
public Slider(int x, int y, int w, int h) {
this.left = this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.right = w + x;
goalLeft = (int)(left + 0.5f);
goalRight = (int)(right + 0.5f);
snappedLeft = goalLeft;
snappedRight = goalRight;
drawInterval = 1;
}
public void setDrawInterval(int drawInterval){
this.drawInterval = drawInterval;
}
public void setValues(int[] values) {
this.values = values;
rangeMin = values[0];
rangeMax = values[values.length-1];
}
public void drawSlider() {
stroke(127,127,127);
strokeWeight(2);
noFill();
strokeJoin(ROUND);
beginShape();
vertex(x, y+h);
vertex(x, y);
vertex(x+w, y);
vertex(x+w, y+h);
endShape();
// Draw underlying data
fill(0,0,0);
strokeWeight(1);
stroke(0);
textFont(myFont);
line(x, y+h, x+w, y+h);
for (int i = 0; i < values.length; i++) {
int xpos = x + (i) * w / (values.length) + w
/ (2 * values.length);
if (values[i] % drawInterval == 0 || i == 0 || i == values.length-1) {
text(values[i], xpos
- (int) (textWidth("" + values[i]) + 0.5) / 2, y
+ h + fontSize);
}
//Draw ruler ticks
if(values[i] % 100 == 0){
line(xpos, y+h, xpos, y+h - 15);
} else if (values[i] % 10 == 0){
line(xpos, y+h, xpos, y+h - 10);
} else {
line(xpos, y+h, xpos, y+h - 5);
}
}
// Draw main bar
fill(0, 0, 0, 0);
for (int i = 0; i < h; i++) {
stroke(rgba(darkColor, i * 127 / h));
line(left, y + i, right, y + i);
}
rect(left, y, right - left, h);
// Draw left handle
stroke(0, 0, 0, 0);
fill(rgba(darkColor, 127));
arc(left, y + 10, 20, 20, PI, 3 * PI / 2);
arc(left, y + h - 10, 20, 20, PI / 2, PI);
rect(left + 0.5f - 10, y + 10, 10, h - 20);
fill(darkColor);
ellipse(left - 5, y + (h / 2) - 5, 4, 4);
ellipse(left - 5, y + (h / 2), 4, 4);
ellipse(left - 5, y + (h / 2) + 5, 4, 4);
// Draw right handle
stroke(0, 0, 0, 0);
fill(rgba(darkColor, 127));
arc(right, y + 10, 20, 20, 3 * PI / 2, 2 * PI);
arc(right, y + h - 10, 20, 20, 0, PI / 2);
rect(right + 0.5f, y + 10, 10, h - 20);
fill(darkColor);
ellipse(right + 5, y + (h / 2) - 5, 4, 4);
ellipse(right + 5, y + (h / 2), 4, 4);
ellipse(right + 5, y + (h / 2) + 5, 4, 4);
}
public int whereIs(int x, int y) {
int ret = OUTSIDE;
if (x >= left && x <= right && y > this.y && y < this.y + h) {
ret = INSIDE;
} else if (x > left - 10 && x < left && y > this.y
&& y < this.y + h) {
ret = LEFTHANDLE;
} else if (x > right && x < right + 10 && y > this.y
&& y < this.y + h) {
ret = RIGHTHANDLE;
}
return ret;
}
public void dragAll(int nx, int px){
goalLeft += nx-px;
goalRight += nx-px;
if(goalLeft < x){
goalRight += x-goalLeft;
goalLeft += x-goalLeft;
}
if(goalRight > x + w){
goalLeft -= (goalRight-(x+w));
goalRight -= (goalRight-(x+w));
}
}
public void dragLH(int nx, int px){
goalLeft += nx-px;
if(goalLeft < x){
goalLeft += x-goalLeft;
} else if(goalLeft > goalRight - w/values.length){
goalLeft = goalRight - w/values.length;
}
}
public void dragRH(int nx, int px){
goalRight += nx-px;
if(goalRight > x+w){
goalRight -= (goalRight-(x+w));
} else if(goalLeft > goalRight - w/values.length){
goalRight = goalLeft + w/values.length;
}
}
public void snapGoals(){
int leftX = goalLeft - x;
float ratioL = leftX / (float)w;
int index = (int)(ratioL * values.length + 0.5);
snappedLeft = x + w * index / values.length;
if(index == 0)
snappedLeft = x;
rangeMin = values[index];
int rightX = goalRight - x;
float ratioR = rightX / (float)w;
index = (int)(ratioR * values.length + 0.5);
if(index == values.length)
snappedRight = x+w;
snappedRight = x + w * index / values.length;
rangeMax = values[index-1];
}
public int getLeftBound(){
int leftX = (int)(left + 0.5) - x;
float ratioL = leftX / (float)w;
int index = (int)(ratioL * values.length + 0.5);
return values[index];
}
public int getRightBound(){
int rightX = (int)(right + 0.5) - x;
float ratioR = rightX / (float)w;
int index = (int)(ratioR * values.length + 0.5);
return values[index-1];
}
public void updateGoals(){
goalLeft = snappedLeft;
goalRight = snappedRight;
}
public void updateAnim(int slowness){
if(abs(snappedLeft-left) > 0){
left += (snappedLeft - left) / slowness;
if(abs(snappedLeft - left) == 1){
left = snappedLeft;
}
}
if(abs(snappedRight-right) > 0){
right += (snappedRight - right) / slowness;
if(abs(snappedRight - right) == 1){
right = snappedRight;
}
}
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
8ace6ad961fb9b8cb34a18176c777f5c35601b86 | c2d8dcdb5549da54187d84bd7bb558f1df971666 | /src/main/java/com/obrien/blockchain/service/Utils.java | bf875365a97aeda03c72bb58f9465acff789d2b2 | [] | no_license | samjamesobrien/blockchain | b5a15f8d4ac3079c2abf3805bf2ec0a4a97c33e7 | 9b0309a249f22c26dfe240f38ef0bc430bbddfa2 | refs/heads/master | 2020-12-19T15:20:29.798016 | 2020-02-03T20:42:21 | 2020-02-03T20:42:21 | 235,772,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,661 | java | package com.obrien.blockchain.service;
import com.google.common.hash.Funnels;
import com.google.common.hash.Hashing;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Signature;
import java.util.Collection;
public class Utils {
/**
* Hash a collection.
*/
public static <T> String hashCollection(final Collection<T> collection) {
return Hashing.sha256()
.hashObject(collection, Funnels.sequentialFunnel(
(input, sink) -> sink.putInt(input.hashCode())
))
.toString();
}
/**
* Sign the input with the private key.
*/
public static byte[] getSignature(final PrivateKey privateKey, final String data) {
try {
final Signature signature = Signature.getInstance("ECDSA", "BC");
signature.initSign(privateKey);
byte[] inputBytes = data.getBytes();
signature.update(inputBytes);
return signature.sign();
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
/**
* Verify a signature with the public key.
*/
public static boolean verifySignature(
final PublicKey publicKey, final String data, final byte[] signatureToVerify) {
try {
final Signature signature = Signature.getInstance("ECDSA", "BC");
signature.initVerify(publicKey);
signature.update(data.getBytes());
return signature.verify(signatureToVerify);
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
}
| [
"samjamesobrien@gmail.com"
] | samjamesobrien@gmail.com |
64253017956c927b189f10269013bac3c4209d24 | 0b30423da67d474aebe7922f752c9786b23a84c6 | /app/src/main/java/com/example/androidmyrestaurant/UpdateInfoActivity.java | f89bfa0d27258410370222d5751d698897f0dd58 | [] | no_license | OrlandoGareca/Android_My_Restaurant | 20327c98ceeb39a647f7b1224655af7010eb71ce | 718b2e9baf00d5f4e6fec4b1cd65655fedc6ccf5 | refs/heads/master | 2020-12-28T11:46:37.854596 | 2020-02-27T15:20:39 | 2020-02-27T15:20:39 | 238,319,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,267 | java | package com.example.androidmyrestaurant;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.example.androidmyrestaurant.Common.Common;
import com.example.androidmyrestaurant.Retrofit.IMyRestaurantAPI;
import com.example.androidmyrestaurant.Retrofit.RetrofitClient;
import com.facebook.accountkit.Account;
import com.facebook.accountkit.AccountKit;
import com.facebook.accountkit.AccountKitCallback;
import com.facebook.accountkit.AccountKitError;
import butterknife.BindView;
import butterknife.ButterKnife;
import dmax.dialog.SpotsDialog;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
public class UpdateInfoActivity extends AppCompatActivity {
IMyRestaurantAPI myRestaurantAPI;
CompositeDisposable compositeDisposable = new CompositeDisposable();
AlertDialog dialog;
@BindView(R.id.edt_user_name)
EditText edt_user_name;
@BindView(R.id.edt_user_address)
EditText edt_user_address;
@BindView(R.id.btn_update)
Button btn_update;
@BindView(R.id.toolbar)
Toolbar toolbar;
@Override
protected void onDestroy() {
compositeDisposable.clear();
super.onDestroy();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_update_info);
ButterKnife.bind(this);
init();
intView();
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
if(id == android.R.id.home){
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
private void intView() {
toolbar.setTitle(getString(R.string.update_information));
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
btn_update.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.show();
AccountKit.getCurrentAccount(new AccountKitCallback<Account>() {
@Override
public void onSuccess(Account account) {
compositeDisposable.add(
myRestaurantAPI.updateUserInfo(Common.API_KEY,
account.getPhoneNumber().toString(),
edt_user_name.getText().toString(),
edt_user_address.getText().toString(),
account.getId())
.observeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(UpdateUserModel -> {
if (UpdateUserModel.isSuccess()){
//si el usuario actualizo, refrescar denuevo
compositeDisposable.add(
myRestaurantAPI.getUser(Common.API_KEY,account.getId())
.observeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(userModel -> {
if (userModel.isSuccess()){
Common.currentUser = userModel.getResult().get(0);
startActivity(new Intent(UpdateInfoActivity.this,HomeActivity.class));
finish();
}
else {
Toast.makeText(UpdateInfoActivity.this, "[GET USER RESULT]"+userModel.getMessage(), Toast.LENGTH_SHORT).show();
}
dialog.dismiss();
},
throwable -> {
dialog.dismiss();
Toast.makeText(UpdateInfoActivity.this, "[GET USER]"+throwable.getMessage(), Toast.LENGTH_SHORT).show();
})
);
}
else {
Toast.makeText(UpdateInfoActivity.this, "[UPDATE USER API KEY]"+UpdateUserModel.getMessage(), Toast.LENGTH_SHORT).show();
}
dialog.dismiss();
},
throwable -> {
dialog.dismiss();
Toast.makeText(UpdateInfoActivity.this, "[UPDATE USER API]"+throwable.getMessage(), Toast.LENGTH_SHORT).show();
})
);
}
@Override
public void onError(AccountKitError accountKitError) {
Toast.makeText(UpdateInfoActivity.this, "¡no inicies sesión! Por favor, registrese", Toast.LENGTH_SHORT).show();
startActivity(new Intent(UpdateInfoActivity.this, MainActivity.class));
finish();
}
});
}
});
}
private void init() {
dialog = new SpotsDialog.Builder().setCancelable(false).setContext(this).build();
myRestaurantAPI = RetrofitClient.getInstance(Common.API_RESTAURANT_ENDPOINT).create(IMyRestaurantAPI.class);
}
}
| [
"orlando.dilmar.gareca.pena@gmail.com"
] | orlando.dilmar.gareca.pena@gmail.com |
bdfbed6370bc611319c4fc5c5743142c2482168a | f4de24afb7ca088b309cea791c13f375eb510def | /src/me/mrletsplay/streamdeck/action/StreamDeckActionParameter.java | 79676c2fe32ec349a8195595b9dc13cc1d90d413 | [] | no_license | MrLetsplay2003/StreamDeckBase | 9e1af151254ee1f37626cdc64fd54798382f5134 | a0eb8b5f06b393024435f1ddeb33722e2f341ef8 | refs/heads/master | 2023-01-28T12:01:35.559033 | 2020-12-10T08:19:08 | 2020-12-10T08:19:08 | 320,202,234 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 378 | java | package me.mrletsplay.streamdeck.action;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
public @interface StreamDeckActionParameter {
public String name();
public String friendlyName();
}
| [
"mr.letsplay2003@gmail.com"
] | mr.letsplay2003@gmail.com |
40648a7fb0331e5717047f0e02c5fdf27a1dbf7e | f9cd17921a0c820e2235f1cd4ee651a59b82189b | /src/net/cbtltd/client/resource/rate/RateConstants.java | f0448adbfdaf8f691e5f00cca23c6b12601a4493 | [] | no_license | bookingnet/booking | 6042228c12fd15883000f4b6e3ba943015b604ad | 0047b1ade78543819bcccdace74e872ffcd99c7a | refs/heads/master | 2021-01-10T14:19:29.183022 | 2015-12-07T21:51:06 | 2015-12-07T21:51:06 | 44,936,675 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,269 | java | /**
* @author bookingnet
* @
* @version 4.0.0
*/
package net.cbtltd.client.resource.rate;
import com.google.gwt.i18n.client.Constants;
public interface RateConstants
extends Constants {
String cancelHelp();
String cancelMessage();
String columnChart();
String columnChartHelp();
String createHelp();
String createLabel();
String customerError();
String customerHelp();
String customerLabel();
String dateLabel();
String deleteHelp();
String deliverReportHelp();
String disputeHelp();
String disputeLabel();
String duedateHelp();
String duedateLabel();
String lineChart();
String notesHelp();
String notesLabel();
String productError();
String productHelp();
String productLabel();
String rateLabel();
String ratenameLabel();
String rateHeader();
String ratingError();
String resolveHelp();
String resolveLabel();
String respondHelp();
String respondLabel();
String saveHelp();
String saveMessage();
String titleLabel();
String updateHelp();
String[] graphsHeaders();
String[] notesHeaders();
String[] opinionHeaders();
String[] opinionNames();
String[] qualityHeaders();
String[] qualityNames();
String[] ratingHeaders();
String[] ratingNames();
String[] reasonHeaders();
String[] reasonNames();
String[] types();
}
| [
"bookingnet@mail.ru"
] | bookingnet@mail.ru |
ba46f677e4d199de96a2eb019a02bf661de8b62c | cbd7cfffac6292230e65771a9ef937c032457e01 | /src/main/java/test/TestClass2.java | 8aba169b735f6ecc57db9a42a453956c54d2f6e1 | [] | no_license | promid/myBatis | d14411b096b1ea5f4d7d610bdc04b160ac0c7ba8 | b5146555495b2051a218e093e1995edd1441ea9b | refs/heads/master | 2021-01-11T09:26:07.669604 | 2016-12-22T01:34:36 | 2016-12-22T01:34:36 | 77,099,711 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 878 | java | package test;
import bean.Classes;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.junit.Test;
import util.MybatisUtils;
/**
* Created by DBQ on 2016/11/26.
*/
public class TestClass2 {
@Test
public void test1(){
SqlSessionFactory sqlSessionFactory = MybatisUtils.getFactory();
SqlSession session = sqlSessionFactory.openSession();
Classes classes = session.selectOne("classMapper2.getClass", 2);
System.out.println(classes);
session.close();
}
@Test
public void test2(){
SqlSessionFactory sqlSessionFactory = MybatisUtils.getFactory();
SqlSession session = sqlSessionFactory.openSession();
Classes classes = session.selectOne("classMapper2.getClass2", 2);
System.out.println(classes);
session.close();
}
}
| [
"350758787@qq.com"
] | 350758787@qq.com |
ff1dda7d31fb9b864c8fcf9592151faf79e3954f | e7806e23c5327b301487640b6219e3c78f8b3caf | /src/org/tensorflow/demo/GuideActivity.java | b15b1f9379aff127102d36db09231fba43c9135d | [] | no_license | YehiaSherifSamak/Pharahos_talk | cb901ccf3d0eb99c216c82111daa4923018e5734 | 15fac9fb4eb2439598808dc3708ba0183fcc305d | refs/heads/master | 2021-04-30T03:51:57.494578 | 2019-06-25T19:53:44 | 2019-06-25T19:53:44 | 121,520,845 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,815 | java | package org.tensorflow.demo;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.Toast;
/**
* Created by yahya on 4/24/2018.
*/
public class GuideActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.guide_activity);
ImageView mapImageView = (ImageView) findViewById(R.id.mapImageView);
Intent myIntent = getIntent();
String start = myIntent.getStringExtra("room");
String end = myIntent.getStringExtra("target");
if(start.equals("Entrance Hall"))
{
if(end.equals("nefertiti") || end.equals("ikhnaton") || end.equals("hatshepsut"))
{
mapImageView.setImageResource(R.drawable.entrance_senario_1);
}
else
{
Toast.makeText(GuideActivity.this,"ajhdabaskj", Toast.LENGTH_LONG).show();
}
}
else if(start.equals("Exit Hall"))
{
if(end.equals("tutankhamun") || end.equals("sphinx") || end.equals("ramses i"))
{
mapImageView.setImageResource(R.drawable.exit_senario_1);
}
else
{
Toast.makeText(GuideActivity.this,"ajhdabaskj", Toast.LENGTH_LONG).show();
}
}
else
{
if(end.equals("tutankhamun") || end.equals("sphinx") || end.equals("ramses i"))
{
mapImageView.setImageResource(R.drawable.corredor_senario_2);
}
else
{
mapImageView.setImageResource(R.drawable.corredor_senario_1);
}
}
}
}
| [
"ysamak17@gmail.com"
] | ysamak17@gmail.com |
3d78ec2f3a863c510ae78530e79f18fb8ffab195 | 95c49f466673952b465e19a5ee3ae6eff76bee00 | /src/main/java/com/zhihu/android/app/feed/p1083ui/fragment/hotTabManager/model/HotEndLineData.java | cbad937c89ee7460dda0461abae57cfa88ad0538 | [] | no_license | Phantoms007/zhihuAPK | 58889c399ae56b16a9160a5f48b807e02c87797e | dcdbd103436a187f9c8b4be8f71bdf7813b6d201 | refs/heads/main | 2023-01-24T01:34:18.716323 | 2020-11-25T17:14:55 | 2020-11-25T17:14:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | package com.zhihu.android.app.feed.p1083ui.fragment.hotTabManager.model;
/* renamed from: com.zhihu.android.app.feed.ui.fragment.hotTabManager.model.HotEndLineData */
public class HotEndLineData {
}
| [
"seasonpplp@qq.com"
] | seasonpplp@qq.com |
5dd741b4c45a267e4dc334dd4cdb93acc801647e | ab11b6de54854fa76659fa9f02b680474d4acf12 | /src/java/com/razin/jsf/CollegeTest.java | 0cd66678392b27ed45a2a5530f259825fd06de2b | [] | no_license | Razin-Tailor/JSFDatabaseConnectivity | 30aca0d56258b10d3076fbb359cbddfe59f2ce22 | 9d701336afc2cba4c6f73ff32ed2dfd34a3e2d3b | refs/heads/master | 2021-01-01T03:35:15.361738 | 2016-04-12T16:11:20 | 2016-04-12T16:11:20 | 56,078,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,247 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.razin.jsf;
import com.mysql.jdbc.PreparedStatement;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.faces.bean.ManagedBean;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author razintailor
*/
@ManagedBean
@Entity
@Table(name = "college_test")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "CollegeTest.findAll", query = "SELECT c FROM CollegeTest c"),
@NamedQuery(name = "CollegeTest.findById", query = "SELECT c FROM CollegeTest c WHERE c.id = :id"),
@NamedQuery(name = "CollegeTest.findByName", query = "SELECT c FROM CollegeTest c WHERE c.name = :name")})
public class CollegeTest implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 256)
@Column(name = "name")
private String name;
public CollegeTest() {
}
public CollegeTest(Integer id) {
this.id = id;
}
public CollegeTest(Integer id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void add() throws ClassNotFoundException, SQLException
{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jsf_college", "root", "");
String str = "INSERT INTO college_test (name) values (?)";
PreparedStatement ps = (PreparedStatement) con.prepareStatement(str);
ps.setString(1, name);
int i = 0;
i = ps.executeUpdate();
System.out.println("Data Added Successfully");
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof CollegeTest)) {
return false;
}
CollegeTest other = (CollegeTest) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.razin.jsf.CollegeTest[ id=" + id + " ]";
}
}
| [
"r42intailor@gmail.com"
] | r42intailor@gmail.com |
b3cebb0d05343aea0ffad6f9a1fb10ccc5b0a2cf | ef685a16964d2e929cb784da5d702daa2bf2f842 | /app/src/main/java/comnitt/boston/planegameproject/Star.java | f50339fdba538ea4bf87be81fb96a8bb44fea52e | [] | no_license | kparitosh21/PlaneGameProject | 54d5727eddbbd5dce207eac15fbcca59991d0adc | a287bb4057a45a5dcb2c5091daf4a755985228d4 | refs/heads/master | 2021-06-23T10:39:10.231887 | 2017-09-02T07:09:30 | 2017-09-02T07:09:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,415 | java | package comnitt.boston.planegameproject;
import java.util.Random;
/**
* Created by HP on 15-Jul-17.
*/
public class Star {
private int x;
private int y;
private int speed;
private int maxX;
private int maxY;
private int minX;
private int minY;
public Star(int screenX, int screenY) {
maxX = screenX;
maxY = screenY;
minX = 0;
minY = 0;
Random generator = new Random();
speed = generator.nextInt(10);
x = generator.nextInt(maxX);
y = generator.nextInt(maxY);
}
public void update(int playerSpeed)
{
x -= playerSpeed; //decresing speed with x
x -= speed;
if (x < 0) {
//scrolling background effect
x = maxX;
Random generator = new Random();
y = generator.nextInt(maxY);
speed = generator.nextInt(15);
}
}
public float getStarWidth() {
float minX = 1.0f;
float maxX = 4.0f;
Random rand = new Random();
float finalX = rand.nextFloat() * (maxX - minX) + minX;
return finalX;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
}
| [
"kprockzz22@gmail.com"
] | kprockzz22@gmail.com |
e783a6f0557ba35e65daf676d85918467d4decd7 | 696f0c40a0b6178048ffc049920edd48c35d6d4a | /han_Website/src/main/java/com/test/dao/UserDAO.java | 74e1923305070ebe37a11f7b22e32cff2cb3402f | [] | no_license | hcw0609/spring_website | 1e45c4cc5c50e089d834de6b10da2da147f2b6ab | 3c9b03e73081c3187d8b8f6465b630d315ac3622 | refs/heads/master | 2022-12-22T15:39:41.716304 | 2020-04-04T16:47:42 | 2020-04-04T16:47:42 | 236,921,974 | 0 | 0 | null | 2022-12-16T11:56:15 | 2020-01-29T06:55:03 | Java | UTF-8 | Java | false | false | 1,067 | java | package com.test.dao;
import java.util.List;
import com.test.dto.UserDTO;
import com.test.dto.VisitorDTO;
import com.test.util.Search;
public interface UserDAO {
// 회원가입
public void register(UserDTO userdto) throws Exception;
// 로그인
public UserDTO login(UserDTO userdto) throws Exception;
// EMAIL 중복체크
public int overLap_EMAIL(String EMAIL) throws Exception;
// ID 중복체크
public int overLap(UserDTO userdto) throws Exception;
// 유저 리스트
public List<UserDTO> user_list(Search search) throws Exception;
// 유저의 총 수
public int user_count(Search search) throws Exception;
// 유저 삭제
public void user_delete(UserDTO userdto) throws Exception;
// 날짜 가져오기
public List<VisitorDTO> visitor_visitor_regdate() throws Exception;
// 날자별 방문자수 가져오기 [ip중복처리 x]
public int visitor_count_all(String str) throws Exception;
// 날자별 방문자수 가져오기 [ip중복처리 o]
public int visitor_count_notall(String str) throws Exception;
}
| [
"han@DESKTOP-G13S10B"
] | han@DESKTOP-G13S10B |
3b5159430bb46f6763f827a45da868e41cb2a47e | 49b46e3a19f74b40f3a798addc8d1b95cc082bb7 | /loopa/src/main/java/org/loopa/element/receiver/AReceiver.java | 4c2cff880408125aa3bed686782e8b8b2e9f242e | [
"Apache-2.0"
] | permissive | Martouta/loopa | 43f3f283e491e4d33d2e33ef01d4d465e108dcd3 | 5e359aa8adc9e47d5ba53ef83172fdc488b1ba31 | refs/heads/master | 2021-09-04T04:07:24.164469 | 2018-01-15T14:49:05 | 2018-01-15T14:49:05 | 111,227,659 | 0 | 0 | Apache-2.0 | 2018-01-14T19:16:14 | 2017-11-18T18:07:59 | Java | UTF-8 | Java | false | false | 1,329 | java | /*******************************************************************************
* Copyright (c) 2017 Universitat Politécnica de Catalunya (UPC)
*
* 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.
*
* Contributors:
* Edith Zavala
*******************************************************************************/
package org.loopa.element.receiver;
import org.loopa.element.receiver.messageprocessor.IMessageProcessor;
import org.loopa.generic.documents.managers.IPolicyManager;
import org.loopa.generic.element.component.ALoopAElementComponent;
public abstract class AReceiver extends ALoopAElementComponent implements IReceiver {
protected AReceiver(String id, IPolicyManager policyManager, IMessageProcessor imm) {
super(id, policyManager, imm);
// TODO Auto-generated constructor stub
}
}
| [
"berec_@hotmail.com"
] | berec_@hotmail.com |
d7f0de89255498b63ceadf7d646dfbb163d35747 | 4af16df92ef766a61f650274357e10832822740d | /sbs-eureka-web/src/main/java/com/github/chen0040/eureka/web/controllers/TestController.java | f56affb3c9e1ff59f71f925f858baffda1213b4c | [
"MIT"
] | permissive | ansatsing/spring-cloud-magento-slingshot | bebd971df099d7b29f14f233d2ed4493fe624d66 | 8914d78a99ebf01393b485ac651612e558d28b11 | refs/heads/master | 2020-03-11T14:07:13.774339 | 2017-10-19T15:21:09 | 2017-10-19T15:21:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 606 | java | package com.github.chen0040.eureka.web.controllers;
import com.github.chen0040.commons.messages.Greeting;
import com.github.chen0040.eureka.web.api.SbAppClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* Created by xschen on 14/9/2017.
*/
@RestController
public class TestController {
@Autowired
private SbAppClient appClient;
@RequestMapping(value="greeting/{name}", method= RequestMethod.GET)
@ResponseBody Greeting greeting(@PathVariable("name") String name) {
return appClient.greeting(name);
}
}
| [
"xs0040@gmail.com"
] | xs0040@gmail.com |
ab062fdb3adf37cb626b4d704f2632e7fe0ad2f4 | ac23066bf44f937406e033ef83ff24d275159724 | /StructurasTaller2/src/unal/datastructures/ArrayQueue.java | 6fc8f62c536bc6cfb8188251f6ae3fb2241102c7 | [
"MIT"
] | permissive | Jhonnyguzz/Java-Projects | 372eb71d966e307f60e17b7a2bb5dad2736b437d | 1e449dc29288e21f450023e55221e3e05517c8b6 | refs/heads/master | 2021-03-30T23:39:24.192514 | 2018-03-11T20:37:01 | 2018-03-11T20:37:01 | 124,792,981 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,685 | java | package unal.datastructures;
/** a queue class that uses a one-dimensional array */
public class ArrayQueue<T>
{
// fields
int front; // one counterclockwise from first element
int rear; // position of rear element of queue
T[] queue; // element array
// constructors
/** create a queue with the given initial capacity */
@SuppressWarnings( "unchecked" )
public ArrayQueue( int initialCapacity )
{
if( initialCapacity < 1 )
throw new IllegalArgumentException
( "initialCapacity must be >= 1" );
queue = ( T[] ) new Object[ initialCapacity + 1 ];
front = rear = 0;
}
/** create a queue with initial capacity 10 */
public ArrayQueue( )
{
this( 10 );
}
// methods
/** @return true iff queue is empty */
public boolean isEmpty( )
{
return front == rear;
}
/** @return front element of queue
* @return null if queue is empty */
public T getFrontElement( )
{
if( isEmpty( ) ) return null;
else return queue[ ( front + 1 ) % queue.length ];
}
/** @return rear element of queue
* @return null if the queue is empty */
public T getRearElement( )
{
if( isEmpty( ) ) return null;
else return queue[ rear ];
}
/** insert theElement at the rear of the queue */
@SuppressWarnings( "unchecked" )
public void put( T theElement )
{
if( ( rear + 1 ) % queue.length == front )
{ // double array size
// allocate a new array
T[] newQueue = ( T[] ) new Object [ 2 * queue.length ];
// copy elements into new array
int start = ( front + 1 ) % queue.length;
if( start < 2 )
// no wrap around
System.arraycopy( queue, start, newQueue, 0, queue.length - 1 );
else
{ // queue wraps around
System.arraycopy( queue, start, newQueue, 0, queue.length - start );
System.arraycopy( queue, 0, newQueue, queue.length - start, rear + 1 );
}
// switch to newQueue and set front and rear
front = newQueue.length - 1;
rear = queue.length - 2; // queue size is queue.length - 1
queue = newQueue;
}
// put theElement at the rear of the queue
rear = ( rear + 1 ) % queue.length;
queue[ rear ] = theElement;
}
/** remove an element from the front of the queue
* @return removed element
* @return null if the queue is empty */
public T remove( )
{
if( isEmpty( ) ) return null;
front = ( front + 1 ) % queue.length;
T frontElement = queue[ front ];
queue[ front ] = null; // enable garbage collection
return frontElement;
}
/** test program */
public static void main( String[] args )
{
int x;
ArrayQueue<Integer> q = new ArrayQueue<>( 3 );
// add a few elements
q.put( new Integer( 1 ) );
q.put( new Integer( 2 ) );
q.put( new Integer( 3 ) );
q.put( new Integer( 4 ) );
// remove and add to test wraparound array doubling
q.remove( );
q.remove( );
q.put( new Integer( 5 ) );
q.put( new Integer( 6 ) );
q.put( new Integer( 7 ) );
q.put( new Integer( 8 ) );
q.put( new Integer( 9 ) );
q.put( new Integer( 10 ) );
q.put( new Integer( 11 ) );
q.put( new Integer( 12 ) );
// delete all elements
while ( !q.isEmpty( ) )
{
System.out.println( "Rear element is " + q.getRearElement( ) );
System.out.println( "Front element is " + q.getFrontElement( ) );
System.out.println( "Removed the element " + q.remove( ) );
}
}
} | [
"jhjguzmanri@unal.edu.co"
] | jhjguzmanri@unal.edu.co |
4b3aecf12c44fd9536b2b45576abfbc5fb1d1944 | edeb76ba44692dff2f180119703c239f4585d066 | /libGPE-KML/src-test/org/gvsig/gpe/kml/writer/v21/kml/KMLPolygonWithInnerTest.java | f86ce8b2662eb9d93d40cfe704595ae84157ec26 | [] | no_license | CafeGIS/gvSIG2_0 | f3e52bdbb98090fd44549bd8d6c75b645d36f624 | 81376f304645d040ee34e98d57b4f745e0293d05 | refs/heads/master | 2020-04-04T19:33:47.082008 | 2012-09-13T03:55:33 | 2012-09-13T03:55:33 | 5,685,448 | 2 | 1 | null | null | null | null | ISO-8859-1 | Java | false | false | 2,178 | java | package org.gvsig.gpe.kml.writer.v21.kml;
import org.gvsig.gpe.writer.GPEPolygonWithInnerTest;
/* gvSIG. Sistema de Información Geográfica de la Generalitat Valenciana
*
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
*
* For more information, contact:
*
* Generalitat Valenciana
* Conselleria d'Infraestructures i Transport
* Av. Blasco Ibáñez, 50
* 46010 VALENCIA
* SPAIN
*
* +34 963862235
* gvsig@gva.es
* www.gvsig.gva.es
*
* or
*
* IVER T.I. S.A
* Salamanca 50
* 46005 Valencia
* Spain
*
* +34 963163400
* dac@iver.es
*/
/* CVS MESSAGES:
*
* $Id: KMLPolygonWithInnerTest.java 361 2008-01-10 08:41:21Z jpiera $
* $Log$
* Revision 1.2 2007/06/29 12:19:48 jorpiell
* The schema validation is made independently of the concrete writer
*
* Revision 1.1 2007/05/02 11:46:50 jorpiell
* Writing tests updated
*
*
*/
/**
* @author Jorge Piera LLodrá (jorge.piera@iver.es)
*/
public class KMLPolygonWithInnerTest extends GPEPolygonWithInnerTest {
/*
* (non-Javadoc)
* @see org.gvsig.gpe.writers.GPEWriterBaseTest#getGPEParserClass()
*/
public Class getGPEParserClass() {
return org.gvsig.gpe.kml.parser.GPEKml2_1_Parser.class;
}
/*
* (non-Javadoc)
* @see org.gvsig.gpe.writers.GPEWriterBaseTest#getGPEWriterHandlerClass()
*/
public Class getGPEWriterHandlerClass() {
return org.gvsig.gpe.kml.writer.GPEKml21WriterHandlerImplementor.class;
}
}
| [
"tranquangtruonghinh@gmail.com"
] | tranquangtruonghinh@gmail.com |
b5ca0e8e0d77dbe68c27fdad07848909cb566e9b | 6bf5a6100df0164238f845c07d1438f205dbf451 | /CCI/src/LinkedList/CreateSingleLinkedList.java | 06ae815c400b03bf906f5ef1c1a02ebcb00e3e58 | [] | no_license | harsha077/DSAndAlgorithms | f71deed927278f7da8249b7783ca467247f5be18 | 4feb75052ad11c26afaf5e741bf4205d3cd4d682 | refs/heads/master | 2022-12-18T14:43:35.828171 | 2020-09-24T13:31:46 | 2020-09-24T13:31:46 | 278,852,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,936 | java | package LinkedList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class CreateSingleLinkedList implements Cloneable{
//static SingleLinkedListNode head=null;
public static SingleLinkedListNode createSLLusingArray(int[] arr) {
SingleLinkedListNode head=null;
SingleLinkedListNode temp = null;
for (int i = 0; i < arr.length; i++) {
if(null==head) {
head = new SingleLinkedListNode(arr[i]);
temp = head;
}else {
temp.next = new SingleLinkedListNode(arr[i]);
temp = temp.next;
}
}
return head;
}
public static SingleLinkedListNode createSLLusingList(List<Integer> list) {
SingleLinkedListNode head=null;
SingleLinkedListNode temp = null;
for(Integer val:list) {
if(null==head) {
head = new SingleLinkedListNode(val);
temp = head;
}else {
temp.next = new SingleLinkedListNode(val);
temp = temp.next;
}
}
return head;
}
public static void printSingleLinkedList(SingleLinkedListNode temp) {
while(null!=temp) {
System.out.print(temp.data+" ");
temp = temp.next;
}
}
public static void main(String...args) {
int[] arr = {3,9,7,0,2,1,7};
List<Integer> list = new ArrayList<Integer>();
list.add(7);
list.add(8);
list.add(5);
//CreateSingleLinkedList.createSLLusingArray(arr);
SingleLinkedListNode head = CreateSingleLinkedList.createSLLusingList(list);
SingleLinkedListNode temp = head;
while(null!=temp) {
System.out.println(temp.data);
temp = temp.next;
}
}
@Override
protected Object clone() throws CloneNotSupportedException{
return super.clone();
}
}
class SingleLinkedListNode{
int data;
SingleLinkedListNode next=null;
SingleLinkedListNode(){
}
SingleLinkedListNode(int data) {
this.data = data;
}
}
| [
"harshavardhanv77@gmail.com"
] | harshavardhanv77@gmail.com |
46ae041772eaedf7d34d4aa57eea1147574c5779 | 9a4a861e0a7ecea241deeb5879ac47903b8aa031 | /src/main/java/com/mycompany/proyectobasededatos/Main.java | 7abe986f6e34d4903a6de7443c65403f4e13474f | [] | no_license | diego0023/Proyecto-BaseDeDatos1 | b194d808bb30d8d6af8dde4d9113857442a06882 | a4dda308fbed329883bcf6b38ef6da0b567bd037 | refs/heads/main | 2023-03-22T16:18:14.169817 | 2021-03-23T06:34:24 | 2021-03-23T06:34:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 233 | java | package com.mycompany.proyectobasededatos;
import java.sql.Connection;
public class Main {
public static void main(String[] args) {
Login login = new Login();
login.setVisible(true);
}
}
| [
"tatobig@gmail.com"
] | tatobig@gmail.com |
5481a8492a46b85e1f498be4efdc48746efc2753 | 36deb252963d9d911e8d571da1ac182dd59f1bf0 | /app/build/generated/source/r/debug/com/google/android/gms/base/R.java | 820dbd5332b6bcfae72639022a48c86232763da8 | [] | no_license | emenuDobamo/ugo | 71f97af8e11d82faec4ccd516866dfaca9ddbcfb | d88a3dc2a94b0d5347b8fd8dcae450256ffa6719 | refs/heads/master | 2020-04-06T07:08:54.621393 | 2016-09-12T05:16:08 | 2016-09-12T05:16:08 | 62,267,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,941 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.google.android.gms.base;
public final class R {
public static final class attr {
public static final int adSize = 0x7f010027;
public static final int adSizes = 0x7f010028;
public static final int adUnitId = 0x7f010029;
public static final int ambientEnabled = 0x7f0100ef;
public static final int appTheme = 0x7f010149;
public static final int buttonSize = 0x7f010111;
public static final int buyButtonAppearance = 0x7f010150;
public static final int buyButtonHeight = 0x7f01014d;
public static final int buyButtonText = 0x7f01014f;
public static final int buyButtonWidth = 0x7f01014e;
public static final int cameraBearing = 0x7f0100e0;
public static final int cameraTargetLat = 0x7f0100e1;
public static final int cameraTargetLng = 0x7f0100e2;
public static final int cameraTilt = 0x7f0100e3;
public static final int cameraZoom = 0x7f0100e4;
public static final int circleCrop = 0x7f0100de;
public static final int colorScheme = 0x7f010112;
public static final int environment = 0x7f01014a;
public static final int fragmentMode = 0x7f01014c;
public static final int fragmentStyle = 0x7f01014b;
public static final int imageAspectRatio = 0x7f0100dd;
public static final int imageAspectRatioAdjust = 0x7f0100dc;
public static final int liteMode = 0x7f0100e5;
public static final int mapType = 0x7f0100df;
public static final int maskedWalletDetailsBackground = 0x7f010153;
public static final int maskedWalletDetailsButtonBackground = 0x7f010155;
public static final int maskedWalletDetailsButtonTextAppearance = 0x7f010154;
public static final int maskedWalletDetailsHeaderTextAppearance = 0x7f010152;
public static final int maskedWalletDetailsLogoImageType = 0x7f010157;
public static final int maskedWalletDetailsLogoTextColor = 0x7f010156;
public static final int maskedWalletDetailsTextAppearance = 0x7f010151;
public static final int scopeUris = 0x7f010113;
public static final int uiCompass = 0x7f0100e6;
public static final int uiMapToolbar = 0x7f0100ee;
public static final int uiRotateGestures = 0x7f0100e7;
public static final int uiScrollGestures = 0x7f0100e8;
public static final int uiTiltGestures = 0x7f0100e9;
public static final int uiZoomControls = 0x7f0100ea;
public static final int uiZoomGestures = 0x7f0100eb;
public static final int useViewLifecycle = 0x7f0100ec;
public static final int windowTransitionStyle = 0x7f0100c7;
public static final int zOrderOnTop = 0x7f0100ed;
}
public static final class color {
public static final int common_action_bar_splitter = 0x7f0e0019;
public static final int common_google_signin_btn_text_dark = 0x7f0e0079;
public static final int common_google_signin_btn_text_dark_default = 0x7f0e001a;
public static final int common_google_signin_btn_text_dark_disabled = 0x7f0e001b;
public static final int common_google_signin_btn_text_dark_focused = 0x7f0e001c;
public static final int common_google_signin_btn_text_dark_pressed = 0x7f0e001d;
public static final int common_google_signin_btn_text_light = 0x7f0e007a;
public static final int common_google_signin_btn_text_light_default = 0x7f0e001e;
public static final int common_google_signin_btn_text_light_disabled = 0x7f0e001f;
public static final int common_google_signin_btn_text_light_focused = 0x7f0e0020;
public static final int common_google_signin_btn_text_light_pressed = 0x7f0e0021;
public static final int common_plus_signin_btn_text_dark = 0x7f0e007b;
public static final int common_plus_signin_btn_text_dark_default = 0x7f0e0022;
public static final int common_plus_signin_btn_text_dark_disabled = 0x7f0e0023;
public static final int common_plus_signin_btn_text_dark_focused = 0x7f0e0024;
public static final int common_plus_signin_btn_text_dark_pressed = 0x7f0e0025;
public static final int common_plus_signin_btn_text_light = 0x7f0e007c;
public static final int common_plus_signin_btn_text_light_default = 0x7f0e0026;
public static final int common_plus_signin_btn_text_light_disabled = 0x7f0e0027;
public static final int common_plus_signin_btn_text_light_focused = 0x7f0e0028;
public static final int common_plus_signin_btn_text_light_pressed = 0x7f0e0029;
public static final int place_autocomplete_prediction_primary_text = 0x7f0e004a;
public static final int place_autocomplete_prediction_primary_text_highlight = 0x7f0e004b;
public static final int place_autocomplete_prediction_secondary_text = 0x7f0e004c;
public static final int place_autocomplete_search_hint = 0x7f0e004d;
public static final int place_autocomplete_search_text = 0x7f0e004e;
public static final int place_autocomplete_separator = 0x7f0e004f;
public static final int wallet_bright_foreground_disabled_holo_light = 0x7f0e0062;
public static final int wallet_bright_foreground_holo_dark = 0x7f0e0063;
public static final int wallet_bright_foreground_holo_light = 0x7f0e0064;
public static final int wallet_dim_foreground_disabled_holo_dark = 0x7f0e0065;
public static final int wallet_dim_foreground_holo_dark = 0x7f0e0066;
public static final int wallet_dim_foreground_inverse_disabled_holo_dark = 0x7f0e0067;
public static final int wallet_dim_foreground_inverse_holo_dark = 0x7f0e0068;
public static final int wallet_highlighted_text_holo_dark = 0x7f0e0069;
public static final int wallet_highlighted_text_holo_light = 0x7f0e006a;
public static final int wallet_hint_foreground_holo_dark = 0x7f0e006b;
public static final int wallet_hint_foreground_holo_light = 0x7f0e006c;
public static final int wallet_holo_blue_light = 0x7f0e006d;
public static final int wallet_link_text_light = 0x7f0e006e;
public static final int wallet_primary_text_holo_light = 0x7f0e007f;
public static final int wallet_secondary_text_holo_dark = 0x7f0e0080;
}
public static final class dimen {
public static final int place_autocomplete_button_padding = 0x7f0a0076;
public static final int place_autocomplete_powered_by_google_height = 0x7f0a0077;
public static final int place_autocomplete_powered_by_google_start = 0x7f0a0078;
public static final int place_autocomplete_prediction_height = 0x7f0a0079;
public static final int place_autocomplete_prediction_horizontal_margin = 0x7f0a007a;
public static final int place_autocomplete_prediction_primary_text = 0x7f0a007b;
public static final int place_autocomplete_prediction_secondary_text = 0x7f0a007c;
public static final int place_autocomplete_progress_horizontal_margin = 0x7f0a007d;
public static final int place_autocomplete_progress_size = 0x7f0a007e;
public static final int place_autocomplete_separator_start = 0x7f0a007f;
}
public static final class drawable {
public static final int cast_ic_notification_0 = 0x7f02004c;
public static final int cast_ic_notification_1 = 0x7f02004d;
public static final int cast_ic_notification_2 = 0x7f02004e;
public static final int cast_ic_notification_connecting = 0x7f02004f;
public static final int cast_ic_notification_on = 0x7f020050;
public static final int common_full_open_on_phone = 0x7f020051;
public static final int common_google_signin_btn_icon_dark = 0x7f020052;
public static final int common_google_signin_btn_icon_dark_disabled = 0x7f020053;
public static final int common_google_signin_btn_icon_dark_focused = 0x7f020054;
public static final int common_google_signin_btn_icon_dark_normal = 0x7f020055;
public static final int common_google_signin_btn_icon_dark_pressed = 0x7f020056;
public static final int common_google_signin_btn_icon_light = 0x7f020057;
public static final int common_google_signin_btn_icon_light_disabled = 0x7f020058;
public static final int common_google_signin_btn_icon_light_focused = 0x7f020059;
public static final int common_google_signin_btn_icon_light_normal = 0x7f02005a;
public static final int common_google_signin_btn_icon_light_pressed = 0x7f02005b;
public static final int common_google_signin_btn_text_dark = 0x7f02005c;
public static final int common_google_signin_btn_text_dark_disabled = 0x7f02005d;
public static final int common_google_signin_btn_text_dark_focused = 0x7f02005e;
public static final int common_google_signin_btn_text_dark_normal = 0x7f02005f;
public static final int common_google_signin_btn_text_dark_pressed = 0x7f020060;
public static final int common_google_signin_btn_text_light = 0x7f020061;
public static final int common_google_signin_btn_text_light_disabled = 0x7f020062;
public static final int common_google_signin_btn_text_light_focused = 0x7f020063;
public static final int common_google_signin_btn_text_light_normal = 0x7f020064;
public static final int common_google_signin_btn_text_light_pressed = 0x7f020065;
public static final int common_ic_googleplayservices = 0x7f020066;
public static final int common_plus_signin_btn_icon_dark = 0x7f020067;
public static final int common_plus_signin_btn_icon_dark_disabled = 0x7f020068;
public static final int common_plus_signin_btn_icon_dark_focused = 0x7f020069;
public static final int common_plus_signin_btn_icon_dark_normal = 0x7f02006a;
public static final int common_plus_signin_btn_icon_dark_pressed = 0x7f02006b;
public static final int common_plus_signin_btn_icon_light = 0x7f02006c;
public static final int common_plus_signin_btn_icon_light_disabled = 0x7f02006d;
public static final int common_plus_signin_btn_icon_light_focused = 0x7f02006e;
public static final int common_plus_signin_btn_icon_light_normal = 0x7f02006f;
public static final int common_plus_signin_btn_icon_light_pressed = 0x7f020070;
public static final int common_plus_signin_btn_text_dark = 0x7f020071;
public static final int common_plus_signin_btn_text_dark_disabled = 0x7f020072;
public static final int common_plus_signin_btn_text_dark_focused = 0x7f020073;
public static final int common_plus_signin_btn_text_dark_normal = 0x7f020074;
public static final int common_plus_signin_btn_text_dark_pressed = 0x7f020075;
public static final int common_plus_signin_btn_text_light = 0x7f020076;
public static final int common_plus_signin_btn_text_light_disabled = 0x7f020077;
public static final int common_plus_signin_btn_text_light_focused = 0x7f020078;
public static final int common_plus_signin_btn_text_light_normal = 0x7f020079;
public static final int common_plus_signin_btn_text_light_pressed = 0x7f02007a;
public static final int ic_plusone_medium_off_client = 0x7f02009e;
public static final int ic_plusone_small_off_client = 0x7f02009f;
public static final int ic_plusone_standard_off_client = 0x7f0200a0;
public static final int ic_plusone_tall_off_client = 0x7f0200a1;
public static final int places_ic_clear = 0x7f0200b2;
public static final int places_ic_search = 0x7f0200b3;
public static final int powered_by_google_dark = 0x7f0200b4;
public static final int powered_by_google_light = 0x7f0200b5;
}
public static final class id {
public static final int adjust_height = 0x7f0f0035;
public static final int adjust_width = 0x7f0f0036;
public static final int android_pay = 0x7f0f0060;
public static final int android_pay_dark = 0x7f0f0057;
public static final int android_pay_light = 0x7f0f0058;
public static final int android_pay_light_with_border = 0x7f0f0059;
public static final int auto = 0x7f0f0042;
public static final int book_now = 0x7f0f0050;
public static final int buyButton = 0x7f0f004d;
public static final int buy_now = 0x7f0f0051;
public static final int buy_with = 0x7f0f0052;
public static final int buy_with_google = 0x7f0f0053;
public static final int cast_notification_id = 0x7f0f0004;
public static final int classic = 0x7f0f005a;
public static final int dark = 0x7f0f0043;
public static final int donate_with = 0x7f0f0054;
public static final int donate_with_google = 0x7f0f0055;
public static final int google_wallet_classic = 0x7f0f005b;
public static final int google_wallet_grayscale = 0x7f0f005c;
public static final int google_wallet_monochrome = 0x7f0f005d;
public static final int grayscale = 0x7f0f005e;
public static final int holo_dark = 0x7f0f0047;
public static final int holo_light = 0x7f0f0048;
public static final int hybrid = 0x7f0f0037;
public static final int icon_only = 0x7f0f003f;
public static final int light = 0x7f0f0044;
public static final int logo_only = 0x7f0f0056;
public static final int match_parent = 0x7f0f004f;
public static final int monochrome = 0x7f0f005f;
public static final int none = 0x7f0f0011;
public static final int normal = 0x7f0f000d;
public static final int place_autocomplete_clear_button = 0x7f0f00cb;
public static final int place_autocomplete_powered_by_google = 0x7f0f00cd;
public static final int place_autocomplete_prediction_primary_text = 0x7f0f00cf;
public static final int place_autocomplete_prediction_secondary_text = 0x7f0f00d0;
public static final int place_autocomplete_progress = 0x7f0f00ce;
public static final int place_autocomplete_search_button = 0x7f0f00c9;
public static final int place_autocomplete_search_input = 0x7f0f00ca;
public static final int place_autocomplete_separator = 0x7f0f00cc;
public static final int production = 0x7f0f0049;
public static final int sandbox = 0x7f0f004a;
public static final int satellite = 0x7f0f0038;
public static final int selectionDetails = 0x7f0f004e;
public static final int slide = 0x7f0f0031;
public static final int standard = 0x7f0f0040;
public static final int strict_sandbox = 0x7f0f004b;
public static final int terrain = 0x7f0f0039;
public static final int test = 0x7f0f004c;
public static final int wide = 0x7f0f0041;
public static final int wrap_content = 0x7f0f001b;
}
public static final class integer {
public static final int google_play_services_version = 0x7f0c0006;
}
public static final class layout {
public static final int place_autocomplete_fragment = 0x7f04003f;
public static final int place_autocomplete_item_powered_by_google = 0x7f040040;
public static final int place_autocomplete_item_prediction = 0x7f040041;
public static final int place_autocomplete_progress = 0x7f040042;
}
public static final class raw {
public static final int gtm_analytics = 0x7f070000;
}
public static final class string {
public static final int accept = 0x7f08003f;
public static final int auth_google_play_services_client_facebook_display_name = 0x7f080045;
public static final int auth_google_play_services_client_google_display_name = 0x7f080046;
public static final int cast_notification_connected_message = 0x7f080048;
public static final int cast_notification_connecting_message = 0x7f080049;
public static final int cast_notification_disconnect = 0x7f08004a;
public static final int common_google_play_services_api_unavailable_text = 0x7f080013;
public static final int common_google_play_services_enable_button = 0x7f080014;
public static final int common_google_play_services_enable_text = 0x7f080015;
public static final int common_google_play_services_enable_title = 0x7f080016;
public static final int common_google_play_services_install_button = 0x7f080017;
public static final int common_google_play_services_install_text_phone = 0x7f080018;
public static final int common_google_play_services_install_text_tablet = 0x7f080019;
public static final int common_google_play_services_install_title = 0x7f08001a;
public static final int common_google_play_services_invalid_account_text = 0x7f08001b;
public static final int common_google_play_services_invalid_account_title = 0x7f08001c;
public static final int common_google_play_services_network_error_text = 0x7f08001d;
public static final int common_google_play_services_network_error_title = 0x7f08001e;
public static final int common_google_play_services_notification_ticker = 0x7f08001f;
public static final int common_google_play_services_restricted_profile_text = 0x7f080020;
public static final int common_google_play_services_restricted_profile_title = 0x7f080021;
public static final int common_google_play_services_sign_in_failed_text = 0x7f080022;
public static final int common_google_play_services_sign_in_failed_title = 0x7f080023;
public static final int common_google_play_services_unknown_issue = 0x7f080024;
public static final int common_google_play_services_unsupported_text = 0x7f080025;
public static final int common_google_play_services_unsupported_title = 0x7f080026;
public static final int common_google_play_services_update_button = 0x7f080027;
public static final int common_google_play_services_update_text = 0x7f080028;
public static final int common_google_play_services_update_title = 0x7f080029;
public static final int common_google_play_services_updating_text = 0x7f08002a;
public static final int common_google_play_services_updating_title = 0x7f08002b;
public static final int common_google_play_services_wear_update_text = 0x7f08002c;
public static final int common_open_on_phone = 0x7f08002d;
public static final int common_signin_button_text = 0x7f08002e;
public static final int common_signin_button_text_long = 0x7f08002f;
public static final int create_calendar_message = 0x7f08004c;
public static final int create_calendar_title = 0x7f08004d;
public static final int decline = 0x7f08004e;
public static final int place_autocomplete_clear_button = 0x7f08003b;
public static final int place_autocomplete_search_hint = 0x7f08003c;
public static final int store_picture_message = 0x7f080069;
public static final int store_picture_title = 0x7f08006a;
public static final int wallet_buy_button_place_holder = 0x7f08003e;
}
public static final class style {
public static final int Theme_AppInvite_Preview = 0x7f0b0106;
public static final int Theme_AppInvite_Preview_Base = 0x7f0b001d;
public static final int Theme_IAPTheme = 0x7f0b010d;
public static final int WalletFragmentDefaultButtonTextAppearance = 0x7f0b0115;
public static final int WalletFragmentDefaultDetailsHeaderTextAppearance = 0x7f0b0116;
public static final int WalletFragmentDefaultDetailsTextAppearance = 0x7f0b0117;
public static final int WalletFragmentDefaultStyle = 0x7f0b0118;
}
public static final class styleable {
public static final int[] AdsAttrs = { 0x7f010027, 0x7f010028, 0x7f010029 };
public static final int AdsAttrs_adSize = 0;
public static final int AdsAttrs_adSizes = 1;
public static final int AdsAttrs_adUnitId = 2;
public static final int[] CustomWalletTheme = { 0x7f0100c7 };
public static final int CustomWalletTheme_windowTransitionStyle = 0;
public static final int[] LoadingImageView = { 0x7f0100dc, 0x7f0100dd, 0x7f0100de };
public static final int LoadingImageView_circleCrop = 2;
public static final int LoadingImageView_imageAspectRatio = 1;
public static final int LoadingImageView_imageAspectRatioAdjust = 0;
public static final int[] MapAttrs = { 0x7f0100df, 0x7f0100e0, 0x7f0100e1, 0x7f0100e2, 0x7f0100e3, 0x7f0100e4, 0x7f0100e5, 0x7f0100e6, 0x7f0100e7, 0x7f0100e8, 0x7f0100e9, 0x7f0100ea, 0x7f0100eb, 0x7f0100ec, 0x7f0100ed, 0x7f0100ee, 0x7f0100ef };
public static final int MapAttrs_ambientEnabled = 16;
public static final int MapAttrs_cameraBearing = 1;
public static final int MapAttrs_cameraTargetLat = 2;
public static final int MapAttrs_cameraTargetLng = 3;
public static final int MapAttrs_cameraTilt = 4;
public static final int MapAttrs_cameraZoom = 5;
public static final int MapAttrs_liteMode = 6;
public static final int MapAttrs_mapType = 0;
public static final int MapAttrs_uiCompass = 7;
public static final int MapAttrs_uiMapToolbar = 15;
public static final int MapAttrs_uiRotateGestures = 8;
public static final int MapAttrs_uiScrollGestures = 9;
public static final int MapAttrs_uiTiltGestures = 10;
public static final int MapAttrs_uiZoomControls = 11;
public static final int MapAttrs_uiZoomGestures = 12;
public static final int MapAttrs_useViewLifecycle = 13;
public static final int MapAttrs_zOrderOnTop = 14;
public static final int[] SignInButton = { 0x7f010111, 0x7f010112, 0x7f010113 };
public static final int SignInButton_buttonSize = 0;
public static final int SignInButton_colorScheme = 1;
public static final int SignInButton_scopeUris = 2;
public static final int[] WalletFragmentOptions = { 0x7f010149, 0x7f01014a, 0x7f01014b, 0x7f01014c };
public static final int WalletFragmentOptions_appTheme = 0;
public static final int WalletFragmentOptions_environment = 1;
public static final int WalletFragmentOptions_fragmentMode = 3;
public static final int WalletFragmentOptions_fragmentStyle = 2;
public static final int[] WalletFragmentStyle = { 0x7f01014d, 0x7f01014e, 0x7f01014f, 0x7f010150, 0x7f010151, 0x7f010152, 0x7f010153, 0x7f010154, 0x7f010155, 0x7f010156, 0x7f010157 };
public static final int WalletFragmentStyle_buyButtonAppearance = 3;
public static final int WalletFragmentStyle_buyButtonHeight = 0;
public static final int WalletFragmentStyle_buyButtonText = 2;
public static final int WalletFragmentStyle_buyButtonWidth = 1;
public static final int WalletFragmentStyle_maskedWalletDetailsBackground = 6;
public static final int WalletFragmentStyle_maskedWalletDetailsButtonBackground = 8;
public static final int WalletFragmentStyle_maskedWalletDetailsButtonTextAppearance = 7;
public static final int WalletFragmentStyle_maskedWalletDetailsHeaderTextAppearance = 5;
public static final int WalletFragmentStyle_maskedWalletDetailsLogoImageType = 10;
public static final int WalletFragmentStyle_maskedWalletDetailsLogoTextColor = 9;
public static final int WalletFragmentStyle_maskedWalletDetailsTextAppearance = 4;
}
}
| [
"birhanu.emenu@gmail.com"
] | birhanu.emenu@gmail.com |
a041b035da40abfcebfed391557b568aeb4c463f | 0f79571a5364b017b56cd40c6a14cbfbdb03aaa7 | /pet-clinic-data/src/main/java/twc/springframework/twcpetclinic/model/Pet.java | c775db85bfed068b8eef3dbb6110b23aeea9d019 | [] | no_license | wctan4444/spring-pet-clinic | e6f635207ada1135393fdd0ed76635d8a625b694 | 2b9e5cd008090a7ff64dac97b28799486b08ca1d | refs/heads/master | 2020-05-01T16:53:33.793635 | 2019-04-29T13:09:19 | 2019-04-29T13:09:19 | 177,584,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,444 | java | package twc.springframework.twcpetclinic.model;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.time.LocalDate;
import java.util.HashSet;
import java.util.Set;
@Entity
@Table(name = "pets")
public class Pet extends BaseEntity{
@Column(name = "name")
private String name;
@ManyToOne
@JoinColumn(name = "type_id")
private PetType petType;
@ManyToOne
@JoinColumn(name = "owner_id")
private Owner owner;
@Column(name = "birth_date")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate birthDate;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "pet")
private Set<Visit> visits = new HashSet<>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public PetType getPetType() {
return petType;
}
public void setPetType(PetType petType) {
this.petType = petType;
}
public Owner getOwner() {
return owner;
}
public void setOwner(Owner owner) {
this.owner = owner;
}
public LocalDate getBirthDate() {
return birthDate;
}
public void setBirthDate(LocalDate birthDate) {
this.birthDate = birthDate;
}
public Set<Visit> getVisits() {
return visits;
}
public void setVisits(Set<Visit> visits) {
this.visits = visits;
}
}
| [
"wctan4444@yahoo.com"
] | wctan4444@yahoo.com |
4a731ce739b11aeba20f18faa1fcd6443a9f6623 | 23f2b653364c231d3d2eecea55b480dda0f919b9 | /src/com/fieb/senai/app/enums/Sexo.java | ac14de4dd4c1e0d7de4ac017cc67bb6e728f3921 | [] | no_license | Hooligan762/PROJETO-CONCUIDO-JAVA | 072acd83fb571d953848dfd4313587168072bc94 | ede6af94e5977b37efb308919ef4cc711974024a | refs/heads/master | 2020-04-12T17:50:43.099127 | 2018-12-20T03:25:05 | 2018-12-20T03:25:05 | 162,659,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 304 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.fieb.senai.app.enums;
/**
*
* @author Ismael
*/
public enum Sexo {
MASCULINO,
FEMININO,
}
| [
"Hooligan7621@gmail.com"
] | Hooligan7621@gmail.com |
f2beb1e906c3a73e7d68cafc6713e7fd039a18bd | 6fa9eda692cf4fe6d48f2d40600db59c20803577 | /platform-db/src/test/java/com/softicar/platform/db/core/table/DbTableNameTest.java | 4b249c3f8fd3a7cb8d8d07ac89c30fba059c6919 | [
"MIT"
] | permissive | softicar/platform | a5cbfcfe0e6097feae7f42d3058e716836c9f592 | a6dad805156fc230a47eb7406959f29c59f2d1c2 | refs/heads/main | 2023-09-01T12:16:01.370646 | 2023-08-29T08:50:46 | 2023-08-29T08:50:46 | 408,834,598 | 4 | 2 | MIT | 2023-08-08T12:40:04 | 2021-09-21T13:38:04 | Java | UTF-8 | Java | false | false | 2,685 | java | package com.softicar.platform.db.core.table;
import com.softicar.platform.common.testing.AbstractTest;
import com.softicar.platform.db.core.connection.DbServerType;
import com.softicar.platform.db.core.database.DbDatabaseBuilder;
import com.softicar.platform.db.core.database.DbDatabaseScope;
import com.softicar.platform.db.core.database.IDbDatabaseScope;
import org.junit.Test;
public class DbTableNameTest extends AbstractTest {
private static final DbTableName TABLE_NAME = new DbTableName("database", "table");
@Test
public void testToStringAndGetQuotedWithMysql() {
try (IDbDatabaseScope scope = new DbDatabaseScope(
new DbDatabaseBuilder()//
.setServerType(DbServerType.MYSQL)
.build())) {
assertEquals("`database`.`table`", TABLE_NAME.toString());
assertEquals("`database`.`table`", TABLE_NAME.getQuoted());
}
}
@Test
public void testToStringAndGetQuotedWithMssql() {
try (IDbDatabaseScope scope = new DbDatabaseScope(
new DbDatabaseBuilder()//
.setServerType(DbServerType.MSSQL_SERVER_2000)
.build())) {
assertEquals("[database].[table]", TABLE_NAME.toString());
assertEquals("[database].[table]", TABLE_NAME.getQuoted());
}
}
@Test
public void testGetDatabaseNameAndTableName() {
assertEquals("database", TABLE_NAME.getDatabaseName());
assertEquals("table", TABLE_NAME.getSimpleName());
}
@Test
public void testEqualsAndHashCode() {
// equal to itself but not to null
assertTrue(TABLE_NAME.equals(TABLE_NAME));
assertFalse(TABLE_NAME.equals(null));
// equal to equal name
DbTableName equalName = new DbTableName("database", "table");
assertTrue(TABLE_NAME.equals(equalName));
assertTrue(equalName.equals(TABLE_NAME));
assertEquals(TABLE_NAME.hashCode(), equalName.hashCode());
// not equal with different database name
DbTableName differentDatabaseName = new DbTableName("foo", "table");
assertFalse(TABLE_NAME.equals(differentDatabaseName));
assertFalse(differentDatabaseName.equals(TABLE_NAME));
// not equal with different table name
DbTableName differentTableName = new DbTableName("database", "foo");
assertFalse(TABLE_NAME.equals(differentTableName));
assertFalse(differentTableName.equals(TABLE_NAME));
}
@Test
public void testCompareTo() {
assertEquals(0, new DbTableName("a", "A").compareTo(new DbTableName("a", "A")));
assertTrue(new DbTableName("a", "A").compareTo(new DbTableName("b", "A")) < 0);
assertTrue(new DbTableName("a", "A").compareTo(new DbTableName("a", "B")) < 0);
assertTrue(new DbTableName("b", "A").compareTo(new DbTableName("a", "A")) > 0);
assertTrue(new DbTableName("a", "B").compareTo(new DbTableName("a", "A")) > 0);
}
}
| [
"noreply@github.com"
] | softicar.noreply@github.com |
bd314c4a64cdd829bddb229a4dfae991e07a754a | 1da1c994aa87a55a26347fab0f978e3e0b11e70a | /ZFQG_/network/src/main/java/com/lckj/jycm/network/SelllValidateCodeRequest.java | bfc15505834ff5059acc48ef360040bbbdb592b5 | [] | no_license | s284309258/zfpay_android | 73113c8a5834526f11cc22cf72d685d26e9893d6 | bbc58bee2e75ccfe28852a929c39b5a890690e50 | refs/heads/master | 2021-05-26T03:36:07.799623 | 2020-04-15T10:22:55 | 2020-04-15T10:22:55 | 254,034,770 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,349 | java | package com.lckj.jycm.network;
public class SelllValidateCodeRequest {
/**
* system_type : securityCode
* tel : 13333333333
* bus_type : register
* sign : ABDFE877387348DJFDJF
*/
private String system_type = "securityCode";
private String tel;
private String bus_type;
private String img_id;
private String img_code;
public SelllValidateCodeRequest(String tel, String bus_type, String img_id, String img_code) {
this.tel = tel;
this.bus_type = bus_type;
this.img_code = img_code;
this.img_id = img_id;
}
private String getImg_id() {
return img_id;
}
private void setImg_id(String img_id) {
this.img_id = img_id;
}
private String getImg_code() {
return img_code;
}
private void setImg_code(String img_code) {
this.img_code = img_code;
}
public String getSystem_type() {
return system_type;
}
public void setSystem_type(String system_type) {
this.system_type = system_type;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getBus_type() {
return bus_type;
}
public void setBus_type(String bus_type) {
this.bus_type = bus_type;
}
}
| [
"s284309258@163.com"
] | s284309258@163.com |
8f0d7117e5a982cee9d741b90849d195b22600ad | 609f726c4360957d1332b38896cf3fab8c1ba5de | /core-java-ext/src/main/java/org/gluu/i18n/ExtendedResourceBundle.java | 00a5dcc31805a4737580f7522ea3b1ef8b088326 | [
"MIT"
] | permissive | GluuFederation/oxCore | f2a3749710a61c0471c9347e04d85121deb9537e | 918ea9cbf7ad7d4a4a9d88108ef0c2f36cbcf733 | refs/heads/master | 2023-08-08T00:36:31.395698 | 2023-07-17T19:58:42 | 2023-07-17T19:58:42 | 18,150,075 | 15 | 16 | MIT | 2023-07-18T18:22:14 | 2014-03-26T19:00:16 | Java | UTF-8 | Java | false | false | 3,442 | java | package org.gluu.i18n;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.StandardWatchEventKinds;
import java.nio.file.WatchKey;
import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.concurrent.locks.ReentrantLock;
/**
* Custom i18n resource bundle with realod support
*
* @author Yuriy Movchan
* @version 02/07/2020
*/
public class ExtendedResourceBundle extends ResourceBundle {
private WatchKey watcher = null;
private Date watcherLastUpdate = new Date();
private String baseName;
private Path externalResource;
private Properties properties;
private Date lastUpdate;
private final ReentrantLock updateLock = new ReentrantLock();
public ExtendedResourceBundle(String baseName, Path externalResource, Properties properties) throws IOException {
this.baseName = baseName;
this.externalResource = externalResource;
this.properties = properties;
this.lastUpdate = new Date();
Path baseFolder = externalResource.getParent();
this.watcher = baseFolder.register(FileSystems.getDefault().newWatchService(), StandardWatchEventKinds.ENTRY_MODIFY);
}
@Override
protected Object handleGetObject(String key) {
if (properties != null) {
if ((externalResource != null) && (watcher != null)) {
checkWatcher();
updateLock.lock();
try {
if (watcherLastUpdate.after(this.lastUpdate)) {
loadPropertiesFromFile(properties, externalResource);
this.lastUpdate = new Date();
}
} catch (IOException ex) {
System.err.println("Failed to reload message bundle:" + externalResource);
} finally {
updateLock.unlock();
}
}
return properties.get(key);
}
return parent.getObject(key);
}
private void checkWatcher() {
if (!watcher.pollEvents().isEmpty()) {
watcherLastUpdate = new Date();
}
}
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public Enumeration<String> getKeys() {
if (properties != null) {
Set keys = properties.keySet();
return Collections.enumeration(keys);
}
return parent.getKeys();
}
public String getBaseName() {
return baseName;
}
protected static void loadPropertiesFromFile(Properties properties, Path externalResource) throws IOException {
if (externalResource == null) {
return;
}
InputStreamReader input = null;
try {
File file = externalResource.toFile();
if (file.exists()) {
input = new FileReader(externalResource.toFile());
properties.load(input); // External bundle (will overwrite same keys).
}
} catch (IOException ex) {
System.err.println("Failed to load message bundle:" + externalResource);
throw ex;
} finally {
try {
input.close();
} catch (Exception ex) {}
}
}
}
| [
"Yuriy.Movchan@gmail.com"
] | Yuriy.Movchan@gmail.com |
b8ece18f23fc810d34a464e03e01aaf586b2dc6c | d8396830276efc393ebed8a0fddcdb0488d2ddd3 | /jOOQ/src/main/java/org/jooq/impl/BitXNor.java | 109c373f33d15976fd3380b1f636d8addf16606e | [
"Apache-2.0"
] | permissive | mabroukb/jOOQ | f741dc4e50270e7ae447cce274bb893f8fc127f0 | ac6a63dab2f7d61c2a39228409b4afa2a11200ca | refs/heads/main | 2022-02-22T19:15:31.334294 | 2022-02-02T15:06:10 | 2022-02-02T15:06:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,017 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Other licenses:
* -----------------------------------------------------------------------------
* Commercial licenses for this work are available. These replace the above
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
* database integrations.
*
* For more information, please visit: http://www.jooq.org/licenses
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.jooq.impl;
import static org.jooq.impl.DSL.*;
import static org.jooq.impl.Internal.*;
import static org.jooq.impl.Keywords.*;
import static org.jooq.impl.Names.*;
import static org.jooq.impl.SQLDataType.*;
import static org.jooq.impl.Tools.*;
import static org.jooq.impl.Tools.BooleanDataKey.*;
import static org.jooq.impl.Tools.DataExtendedKey.*;
import static org.jooq.impl.Tools.DataKey.*;
import static org.jooq.SQLDialect.*;
import org.jooq.*;
import org.jooq.Function1;
import org.jooq.Record;
import org.jooq.conf.*;
import org.jooq.impl.*;
import org.jooq.impl.QOM.*;
import org.jooq.tools.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
/**
* The <code>BIT X NOR</code> statement.
*/
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
final class BitXNor<T extends Number>
extends
AbstractField<T>
implements
QOM.BitXNor<T>
{
final Field<T> arg1;
final Field<T> arg2;
BitXNor(
Field<T> arg1,
Field<T> arg2
) {
super(
N_BIT_X_NOR,
allNotNull((DataType) dataType(INTEGER, arg1, false), arg1, arg2)
);
this.arg1 = nullSafeNotNull(arg1, INTEGER);
this.arg2 = nullSafeNotNull(arg2, INTEGER);
}
// -------------------------------------------------------------------------
// XXX: QueryPart API
// -------------------------------------------------------------------------
@Override
public final void accept(Context<?> ctx) {
switch (ctx.family()) {
default:
ctx.visit(DSL.bitNot(DSL.bitXor((Field<Number>) arg1, (Field<Number>) arg2)));
break;
}
}
// -------------------------------------------------------------------------
// XXX: Query Object Model
// -------------------------------------------------------------------------
@Override
public final Field<T> $arg1() {
return arg1;
}
@Override
public final Field<T> $arg2() {
return arg2;
}
@Override
public final QOM.BitXNor<T> $arg1(Field<T> newValue) {
return $constructor().apply(newValue, $arg2());
}
@Override
public final QOM.BitXNor<T> $arg2(Field<T> newValue) {
return $constructor().apply($arg1(), newValue);
}
@Override
public final Function2<? super Field<T>, ? super Field<T>, ? extends QOM.BitXNor<T>> $constructor() {
return (a1, a2) -> new BitXNor<>(a1, a2);
}
// -------------------------------------------------------------------------
// XXX: The Object API
// -------------------------------------------------------------------------
@Override
public boolean equals(Object that) {
if (that instanceof QOM.BitXNor) { QOM.BitXNor<?> o = (QOM.BitXNor<?>) that;
return
StringUtils.equals($arg1(), o.$arg1()) &&
StringUtils.equals($arg2(), o.$arg2())
;
}
else
return super.equals(that);
}
}
| [
"lukas.eder@gmail.com"
] | lukas.eder@gmail.com |
535cfc446146666c547364ef02c8fba5a831a921 | 824745d6e7864ba61fda45eb8fe4e513f6689c07 | /QuanLyThuChi/app/src/main/java/com/example/baseprojectandroid/async/UpdateEvenueExpenditureAsyncTask.java | 8e5c01a874616fd41ae12ee22d897eae14c16dbe | [] | no_license | conchonha/QuanLyThuChi | ab3bf26c6744712b1d353155f3104b69f022da99 | 2919b449cbacaf3e4fb0401f8c33098f50a1851d | refs/heads/master | 2023-01-19T03:39:54.862006 | 2020-11-25T07:20:16 | 2020-11-25T07:20:16 | 312,306,542 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 847 | java | package com.example.baseprojectandroid.async;
import android.os.AsyncTask;
import com.example.baseprojectandroid.cores.room.dao.EevenueExpenditureDao;
import com.example.baseprojectandroid.cores.room.table.RevenueExpenditureTable;
public class UpdateEvenueExpenditureAsyncTask extends AsyncTask<Void,Void,Void> {
private RevenueExpenditureTable mEvenueExpenditure;
private EevenueExpenditureDao mEvenueExpenditureDao;
public UpdateEvenueExpenditureAsyncTask(RevenueExpenditureTable revenueExpenditureTable, EevenueExpenditureDao eevenueExpenditureDao){
this.mEvenueExpenditure = revenueExpenditureTable;
this.mEvenueExpenditureDao = eevenueExpenditureDao;
}
@Override
protected Void doInBackground(Void... voids) {
mEvenueExpenditureDao.update(mEvenueExpenditure);
return null;
}
}
| [
"kzumi2110"
] | kzumi2110 |
1e5bc38532df1e5adc99dfb69095c10c622721c0 | 42cda976712f5e2660332cb7f92154350a1939b1 | /sharding/db2es-core/src/main/java/org/wyyt/sharding/db2es/core/entity/domain/Names.java | 43b13c3af09d39fb6875861bd0a2ce9e6836382d | [] | no_license | DevelopProjectss/middleware | 6fcf7b1cf395525c5b404a2ca74bb3264fa09e38 | 4d156e592f18cbe2909faf551ab37d6afa56a721 | refs/heads/master | 2023-02-24T21:48:38.042923 | 2021-01-29T09:40:24 | 2021-01-29T09:40:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,797 | java | package org.wyyt.sharding.db2es.core.entity.domain;
/**
* the domain entity of db2es' configuration item names
* <p>
*
* @author Ning.Zhang(Pegasus)
* *****************************************************************
* Name Action Time Description *
* Ning.Zhang Initialize 01/01/2021 Initialize *
* *****************************************************************
*/
public final class Names {
/**
* 分布式id, 具有同样的id为主备模式, 不同的id为分布式
*/
public static final String DB2ES_ID = "db2es.id";
/**
* 用于HttpServer的主机
*/
public static final String DB2ES_HOST = "db2es.host";
/**
* 用于HttpServer的端口
*/
public static final String DB2ES_PORT = "db2es.port";
/**
* 当导入Elastic-Search失败时的后续动作,true表示将错误信息记录到数据库日志中并继续后续消费;false表示将持续消费当前失败的消息,直至成功为止
*/
public static final String CONTINUE_ON_ERROR = "db2es.continueOnError";
/**
* db2es_admin的ip地址
*/
public static final String DB2ES_ADMIN_HOST = "db2es_admin_host";
/**
* db2es_admin的端口
*/
public static final String DB2ES_ADMIN_PORT = "db2es_admin_port";
/**
* 钉钉机器人的access_token
*/
public static final String DING_ACCESS_TOKEN = "ding_access_token";
/**
* 钉钉机器人的加签秘钥
*/
public static final String DING_SECRET = "ding_secret";
/**
* 钉钉机器人发送的对象(手机号), 如果有多个用逗号分隔, 如果为空, 则发送全体成员
*/
public static final String DING_MOBILES = "ding_mobiles";
/**
* 指定某个具体topic的消费位点, 优先级高于db2es.checkpoint。格式:db2es.{topic_name}-{partition}.checkpoint
*/
public static final String TOPIC_CHECKPOINT_FORMAT = "db2es.%s-%s.checkpoint";
/**
* 指定所有Topic的消费位点, 优先级低于db2es.{topic_name}-{partition}.checkpoint
*/
public static final String INITIAL_CHECKPOINT = "db2es.checkpoint";
/**
* kafka集群所使用的zookeeper集群地址, 多个用逗号隔开
*/
public static final String ZOOKEEPER_SERVERS = "zookeeper.servers";
/**
* 目标ElasticSearch的地址, 多个用逗号隔开
*/
public static final String ELASTICSEARCH_HOSTNAMES = "elasticsearch.hostnames";
/**
* ElasticSearch的用户名
*/
public static final String ELASTICSEARCH_USERNAME = "elasticsearch.username";
/**
* ElasticSearch的密码
*/
public static final String ELASTICSEARCH_PASSWORD = "encrypt.elasticsearch.password";
/**
* 用于同步失败记录异常数据库的地址
*/
public static final String DATABASE_HOST = "db.host";
/**
* 用于同步失败记录异常数据库的端口
*/
public static final String DATABASE_PORT = "db.port";
/**
* 用于同步失败记录异常数据库的库名
*/
public static final String DATABASE_NAME = "db.databaseName";
/**
* 用于同步失败记录异常数据库的用户名
*/
public static final String DATABASE_USERNAME = "db.username";
/**
* 用于同步失败记录异常数据库的密码
*/
public static final String DATABASE_PASSWORD = "encrypt.db.password";
/**
* ACM配置
*/
public static final String ACM_DATA_ID = "acm.data.id";
/**
* ACM配置
*/
public static final String ACM_GROUP_ID = "acm.group.id";
/**
* ACM配置
*/
public static final String ACM_CONFIG_PATH = "acm.config.path";
/**
* ACM配置
*/
public static final String ACM_NACOS_LOCAL_SNAPSHOT_PATH = "acm.nacos.local.snapshot.path";
/**
* ACM配置
*/
public static final String ACM_NACOS_LOG_PATH = "acm.nacos.log.path";
/**
* ES索引主分片设置
*/
public static final String NUMBER_OF_SHARDS = "index.number_of_shards";
/**
* ES索引副本分片设置
*/
public static final String NUMBER_OF_REPLICAS = "index.number_of_replicas";
/**
* ES索引刷盘间隔时间设置
*/
public static final String REFRESH_INTERVAL = "index.refresh_interval";
/**
* kafka集群地址
*/
public static final String KAFKA_BOOTSTRAP_SERVERS = "kafka.bootstrap.servers";
/**
* 接口调用签名
*/
public static final String API_KEY = "pegasuszhangning";
public static final String API_IV = "asusgeipganzgnhn";
/**
* DB2ES存储在zk中的路径
*/
public static final String ZOOKEEPER_BROKER_IDS_PATH = "/brokers/ids";
} | [
"349409664@qq.com"
] | 349409664@qq.com |
1bf632fdc834cab2d794ed25cfbf6a0651b8489c | 56137352bbd756873ab6e0e41a2ef3992cd57ae9 | /saxon9108b/net/sf/saxon/event/MessageWarner.java | 36771d7b358fa81aa72e77a7ef0d593472b26497 | [] | no_license | geonetwork/patched-jars | 1811c65ece517ccb2a655239297d197e641a41c8 | ed49940344fe2049d53ce8f4b6ae5befec7dea4f | refs/heads/master | 2023-08-04T10:29:58.648291 | 2016-06-10T12:57:25 | 2016-06-10T12:57:25 | 60,834,114 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,327 | java | package net.sf.saxon.event;
import net.sf.saxon.trans.XPathException;
import javax.xml.transform.ErrorListener;
import javax.xml.transform.TransformerException;
import java.io.StringWriter;
/**
* MessageWarner is a user-selectable receiver for XSLT xsl:message output. It causes xsl:message output
* to be notified to the warning() method of the JAXP ErrorListener, or to the error() method if
* terminate="yes" is specified. This behaviour is specified in recent versions of the JAXP interface
* specifications, but it is not the default behaviour, for backwards compatibility reasons.
*
* <p>The text of the message that is sent to the ErrorListener is an XML serialization of the actual
* message content.</p>
*/
public class MessageWarner extends XMLEmitter {
boolean abort = false;
public void startDocument(int properties) throws XPathException {
setWriter(new StringWriter());
abort = (properties & ReceiverOptions.TERMINATE) != 0;
super.startDocument(properties);
}
public void endDocument() throws XPathException {
ErrorListener listener = getPipelineConfiguration().getErrorListener();
XPathException de = new XPathException(getWriter().toString());
de.setErrorCode("XTMM9000");
try {
if (abort) {
listener.error(de);
} else {
listener.warning(de);
}
} catch (TransformerException te) {
throw XPathException.makeXPathException(te);
}
}
}
//
// The contents of this file are subject to the Mozilla Public License Version 1.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.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
// See the License for the specific language governing rights and limitations under the License.
//
// The Original Code is: all this file.
//
// The Initial Developer of the Original Code is Michael H. Kay.
//
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
//
// Contributor(s): none.
//
| [
"Simon.Pigot@csiro.au"
] | Simon.Pigot@csiro.au |
16a8a8e72492e0fac3819160c09de1a7b1631af7 | 17c8a46ee9d573912906b52fbeae77c729ca7900 | /PanneauChoix.java | d093d0d46719f20bd5d5ebad0dce2706d7f3dde2 | [] | no_license | MorganeB/Java_FiguresGeo_v3 | 189b8159a78402314191714769346a23f501f826 | 7bdb4a7c59eb78de416d6d2bb47fef50af9848a8 | refs/heads/master | 2021-01-01T17:28:37.020895 | 2013-06-19T13:38:36 | 2013-06-19T13:38:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 32 | java |
public class PanneauChoix {
}
| [
"valgrind123@gmail.com"
] | valgrind123@gmail.com |
824ff73ec59596679173663b99353af24989092b | 120870cdef59fe320fee5c97ffed6febdfb9c68d | /app/src/main/java/com/coolweather/android/gson/Suggestion.java | 0f006b0695527b68b8c71e9b6317b12d8d2001ff | [
"Apache-2.0"
] | permissive | figure-ai/CoolWeather | 3c534c496ed3249e42572770947cb779b13e226d | 86f531e2077012757664c31c9eb2958c5892c81b | refs/heads/master | 2021-01-20T02:33:28.214831 | 2017-04-27T02:21:53 | 2017-04-27T02:21:53 | 89,302,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 587 | java | package com.coolweather.android.gson;
import com.google.gson.annotations.SerializedName;
/**
* Created by anwser_mac on 2017/4/26.
*/
public class Suggestion {
@SerializedName("comf")
public Comfort comfort;
@SerializedName("cw")
public CarWash carWash;
public Sport sport;
public class Comfort {
@SerializedName("txt")
public String info;
}
public class CarWash {
@SerializedName("txt")
public String info;
}
public class Sport {
@SerializedName("txt")
public String info;
}
}
| [
"592134873qq.com"
] | 592134873qq.com |
a8e4850be873bd71a5b89322dd572804ff37d546 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/thumbplayer/api/TPCommonEnum$TP_VIDEO_DECODER_TYPE.java | 32274483df42b323c5a33b006537fb8775704edb | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 474 | java | package com.tencent.thumbplayer.api;
import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.SOURCE)
public @interface TPCommonEnum$TP_VIDEO_DECODER_TYPE {}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes7.jar
* Qualified Name: com.tencent.thumbplayer.api.TPCommonEnum.TP_VIDEO_DECODER_TYPE
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
efba5d3b38ac6e9923e4ae1ba9450477cc30da76 | b2fe2675ebeb27c86326092e975cbaa6bc7dadec | /acsharpeAll.java | f82a80dc811c766aa55b3159d41df8740182242e | [] | no_license | ShaziahGafur/DecipheringPianoMusic | 418498df1eb77ac3144e31a1205bc9675ed90168 | f68967d1e70840a1e9e47b42f66a8a8797fb9db8 | refs/heads/master | 2020-04-16T20:22:36.579520 | 2019-01-21T18:12:18 | 2019-01-21T18:12:18 | 165,897,086 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,639 | java |
public class acsharpeAll {
/**
* @param args
*/
public static void main(String[] args) {
new acsharpeAll ();
}
public acsharpeAll ()
{
double[] sample = new double[2000];//frequency values start 20, increment by 20, for 100 times
for (int i=0; i<sample.length; i++){
sample[i] = ((double)i)/1100.00;
}
double [][]bins = new double[2][sample.length];
for (int i=0; i<sample.length; i++){
System.out.println("Sample pt #"+i+": \t"+sample[i]);
}
double sum=0;
//cosine function
for (int i =0; i<sample.length; i++){
for (int j=0; j<sample.length; j++){//j = index of sample array
sum+=((sample[j]*Math.cos( (double)(-2*(Math.PI)* j* i) ) / ((double)(sample.length)) ));
}
bins[0][i]=sum;
System.out.println ("X bin "+i+" = "+bins[0][i]+" (R)");
sum=0;
}
sum=0;
System.out.println("\n\nImaginary Components");
//calculating imaginary component (sine function)
for (int i =0; i<sample.length; i++){
for (int j=0; j<sample.length; j++){//j = index of sample array
sum+=sample[j]*Math.sin(-2*(Math.PI)*i*j/((double)(sample.length)));
}
bins[1][i]=sum;
System.out.println ("X bin "+i+" = "+sum+"i");
sum=0;
}
double mag=0;
System.out.println("//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\");
//calculating magnitude
for (int i=0;i<sample.length; i++){
mag=Math.pow(bins[0][i],2);
mag+=Math.pow(bins[1][i],2);
mag=Math.sqrt(mag);
System.out.println(mag);
mag=0;
}
}
} | [
"noreply@github.com"
] | ShaziahGafur.noreply@github.com |
4d89d484d64c4bd30635ae1ae46925bdf4256263 | 434078297104217aa830da77e1c224d90548ed94 | /app/src/androidTest/java/vn/co/company/kimhao/ExampleInstrumentedTest.java | 616efda0b7699c0f506f0d61e50b938083a8610b | [] | no_license | haolk/Demo-MVP | 3b885c7015705bd66fb29b6c26cbe8aa57ef3279 | 8401465b904e5c623a88494d9f07b6f1536eafcf | refs/heads/master | 2020-05-21T04:13:29.449101 | 2019-05-27T11:41:30 | 2019-05-27T11:41:30 | 185,897,217 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | package vn.co.company.kimhao;
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() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("jp.co.company.willer", appContext.getPackageName());
}
}
| [
"haolk@rikkeisoft.com"
] | haolk@rikkeisoft.com |
b750d260d2b932791eca020245d5b1fcab4c8438 | 7dc3e905ffbefaa5bf5701fe41411a73cdecf12f | /app/src/main/java/com/example/myapplication/RecyclerViewAdapter.java | 17c40ea2da20fefd26668c08a97b04f4652f2c47 | [] | no_license | klitna/AppIncidencias-SQL | 68c9a8c0f9f50344108e8d722aff375dd8a6f871 | 91e64df3615136645b5f530419eb5b4771bb19dd | refs/heads/master | 2023-02-18T20:54:58.225524 | 2021-01-15T02:15:39 | 2021-01-15T02:15:39 | 304,089,667 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,177 | java | package com.example.myapplication;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.database.sqlite.SQLiteDatabase;
import android.os.Build;
import android.os.Parcelable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.GridLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.RecyclerView;
import com.example.myapplication.DB.IncidenciaDBHelper;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder>{
IncidenciaDBHelper dbHelper;
SQLiteDatabase db;
View fList;
ArrayList<Incidence> incidencesList = new ArrayList<Incidence>();
int rows;
Context context;
ViewHolder holderGlobal = null;
public RecyclerViewAdapter(ArrayList<Incidence> i){
incidencesList.addAll(i);
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_list, parent, false);
fList = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_list_incidences, parent, false);
dbHelper = new IncidenciaDBHelper(parent.getContext());
db = dbHelper.getWritableDatabase();
rows=dbHelper.getCountRows();
ViewHolder holder = new ViewHolder(view);
context = parent.getContext();
return holder;
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int id) {
holderGlobal = holder;
sendDataToAdapter(holder, id);
}
@Override
public int getItemCount() {
return incidencesList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder{
TextView nameTextView;
TextView urgenceTextView;
TextView idTextView;
TextView dateTextView;
ImageView stateCircle;
GridLayout layout;
public ViewHolder(@NonNull final View itemView) {
super(itemView);
nameTextView = itemView.findViewById(R.id.nameIncidenceItem);
urgenceTextView = itemView.findViewById(R.id.urgenceIncidence);
idTextView = itemView.findViewById(R.id.countUrgence);
dateTextView = itemView.findViewById(R.id.dateIncidence);
stateCircle = itemView.findViewById(R.id.stateCircle);
layout = itemView.findViewById(R.id.itemList);
ImageButton goToIncidence = itemView.findViewById(R.id.goToIncidenceButton);
goToIncidence.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
String value="Hello world";
Intent i = new Intent(itemView.getContext(), IncidenceInfoActivity.class);
i.putExtra("name",nameTextView.getText().toString());
i.putExtra("urgence",urgenceTextView.getText().toString());
i.putExtra( "date", dateTextView.getText().toString());
i.putExtra("id", idTextView.getText().toString().replace("Id: ", ""));
itemView.getContext().startActivity(i);
}
});
ImageButton deleteIncidence = itemView.findViewById(R.id.deleteItem);
deleteIncidence.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
DeleteDialogFragment dialog = new DeleteDialogFragment();
db = dbHelper.getWritableDatabase();
dbHelper.deleteIncidence(db, String.valueOf(getAdapterPosition()));
incidencesList.remove(getAdapterPosition());
notifyItemRemoved(getAdapterPosition());
notifyItemRangeChanged(getAdapterPosition(),incidencesList.size());
}
});
}
}
public void sendDataToAdapter(@NonNull ViewHolder holder, int id){
holder.nameTextView.setText(incidencesList.get(id).getName());
holder.urgenceTextView.setText(context.getResources().getString(R.string.urgence)+": " +incidencesList.get(id).getUrgency());
holder.idTextView.setText("Id: "+String.valueOf(id));
holder.dateTextView.setText(incidencesList.get(id).getDate());
if (incidencesList.get(id).getState()==0)
holder.stateCircle.setBackground(ContextCompat.getDrawable(context, R.drawable.red_circle));
else if(incidencesList.get(id).getState()==1)
holder.stateCircle.setBackground(ContextCompat.getDrawable(context, R.drawable.orange_circle));
else
holder.stateCircle.setBackground(ContextCompat.getDrawable(context, R.drawable.green_circle));
}
public void orderByDate(){
}
} | [
"cf19iryna.klitna@iesjoandaustria.org"
] | cf19iryna.klitna@iesjoandaustria.org |
6ff97983e6185451500d61c187716e3455e7cdc0 | 56a616692a7e4c5392f18f449cc240335f79598e | /fox-microservice-user/src/main/java/top/lemna/user/persistence/service/ModuleService.java | 88af330219f1ed00b751784ee32d1f6307fa8dc9 | [] | no_license | hub830/fox-microservice | d7a35199a20650243b3cc922ef49e06e228bf808 | a0c25555a471638e0320fb1f58908944c2039a6f | refs/heads/master | 2020-03-28T13:31:26.432050 | 2019-01-08T07:14:46 | 2019-01-08T07:14:46 | 148,402,117 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 654 | java | package top.lemna.user.persistence.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.RequiredArgsConstructor;
import top.lemna.user.persistence.entity.PrivilegeModule;
import top.lemna.user.persistence.repository.PrivilegeModuleRepository;
import top.lemna.user.persistence.service.base.BaseService;
/**
* 订单管理.
*
* @author hu
*
*/
@Service
@SuppressWarnings("unused")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ModuleService extends BaseService<PrivilegeModule> {
private final PrivilegeModuleRepository repository;
}
| [
"test@test.com"
] | test@test.com |
3794df4095fd3be2e73b621237edf083b9323306 | 533d15375254a16bde29b034c1f0664e1fc413dc | /app/src/main/java/rikka/akashitoolkit/ship/ShipDisplayFragment.java | 4d62774ab1afb82657267d5567183263d75b5d07 | [] | no_license | HeroinThemirror/Akashi-Toolkit | 6bff357a0851e98fa82ef0ade7ea46f280d21542 | 9e213cffb6b5c57c3581f2909a6d826288542750 | refs/heads/master | 2021-01-17T14:17:04.192765 | 2016-09-04T09:47:02 | 2016-09-04T09:47:02 | 67,379,526 | 0 | 0 | null | 2017-10-18T09:55:25 | 2016-09-05T01:54:23 | Java | UTF-8 | Java | false | false | 15,444 | java | package rikka.akashitoolkit.ship;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.NestedScrollView;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.Spinner;
import com.squareup.otto.Subscribe;
import rikka.akashitoolkit.R;
import rikka.akashitoolkit.adapter.ViewPagerAdapter;
import rikka.akashitoolkit.model.ShipType;
import rikka.akashitoolkit.otto.BookmarkAction;
import rikka.akashitoolkit.otto.BusProvider;
import rikka.akashitoolkit.otto.ShipAction;
import rikka.akashitoolkit.staticdata.ShipTypeList;
import rikka.akashitoolkit.support.Settings;
import rikka.akashitoolkit.support.Statistics;
import rikka.akashitoolkit.MainActivity;
import rikka.akashitoolkit.ui.fragments.BaseSearchFragment;
import rikka.akashitoolkit.ui.fragments.BookmarkNoItemFragment;
import rikka.akashitoolkit.utils.Utils;
import rikka.akashitoolkit.ui.widget.CheckBoxGroup;
import rikka.akashitoolkit.ui.widget.RadioButtonGroup;
import rikka.akashitoolkit.ui.widget.SimpleDrawerView;
import rikka.akashitoolkit.ui.widget.UnScrollableViewPager;
/**
* Created by Rikka on 2016/3/30.
*/
public class ShipDisplayFragment extends BaseSearchFragment {
private ViewPager mViewPager;
private MainActivity mActivity;
private int mFlag;
private int mFinalVersion;
private int mSpeed;
private int mSort;
private boolean mBookmarked;
private CheckBoxGroup[] mCheckBoxGroups = new CheckBoxGroup[3];
private RadioButtonGroup[] mRadioButtonGroups = new RadioButtonGroup[3];
private Spinner mSpinner;
private NestedScrollView mScrollView;
private void setDrawerView() {
mActivity.getRightDrawerContent().removeAllViews();
//mActivity.getRightDrawerContent().addTitle("排序"/*getString(R.string.sort)*/);
//mActivity.getRightDrawerContent().addDividerHead();
//mActivity.getRightDrawerContent().addTitle(getString(R.string.action_filter));
//mActivity.getRightDrawerContent().addDividerHead();
SimpleDrawerView body = new SimpleDrawerView(getContext());
body.addTitle(getString(R.string.sort));
body.addDivider();
View view = LayoutInflater.from(getActivity()).inflate(R.layout.drawer_item_spinner, body, false);
mSpinner = (Spinner) view.findViewById(R.id.spinner);
ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(),
R.layout.drawer_item_spinner_item, new String[]{getString(R.string.ship_type), getString(R.string.ship_class)});
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (mSort == position) {
return;
}
mSort = position;
Settings
.instance(getContext())
.putInt(Settings.SHIP_SORT, mSort);
BusProvider.instance().post(new ShipAction.SortChangeAction(mSort));
//BusProvider.instance().post(new DataChangedAction("ShipFragment"));
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
mSpinner.setAdapter(adapter);
body.addView(view);
body.addTitle(getString(R.string.action_filter));
body.addDivider();
body.setOrientation(LinearLayout.VERTICAL);
body.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
/*mCheckBoxGroups[0] = new CheckBoxGroup(getContext());
mCheckBoxGroups[0].addItem("仅收藏");
mCheckBoxGroups[0].setOnCheckedChangeListener(new CheckBoxGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(View view, int checked) {
BusProvider.instance().post(new ShipAction.OnlyBookmarkedChangeAction(checked > 0));
mBookmarked = checked > 0;
Settings
.instance(getContext())
.putBoolean(Settings.SHIP_BOOKMARKED, checked > 0);
}
});
body.addView(mCheckBoxGroups[0]);
body.addDivider();*/
mRadioButtonGroups[0] = new RadioButtonGroup(getContext());
mRadioButtonGroups[0].addItem(R.string.all);
mRadioButtonGroups[0].addItem(R.string.not_remodel);
mRadioButtonGroups[0].addItem(R.string.final_remodel);
mRadioButtonGroups[0].setOnCheckedChangeListener(new RadioButtonGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(View view, int checked) {
BusProvider.instance().post(new ShipAction.ShowFinalVersionChangeAction(checked));
mFinalVersion = checked;
Settings
.instance(getContext())
.putInt(Settings.SHIP_FINAL_VERSION, checked);
}
});
body.addView(mRadioButtonGroups[0]);
body.addDivider();
mCheckBoxGroups[1] = new CheckBoxGroup(getContext());
mCheckBoxGroups[1].addItem(R.string.speed_slow);
mCheckBoxGroups[1].addItem(R.string.speed_fast);
mCheckBoxGroups[1].setOnCheckedChangeListener(new CheckBoxGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(View view, int checked) {
BusProvider.instance().post(new ShipAction.SpeedChangeAction(checked));
mSpeed = checked;
Settings
.instance(getContext())
.putInt(Settings.SHIP_SPEED, checked);
}
});
body.addView(mCheckBoxGroups[1]);
body.addDivider();
mCheckBoxGroups[2] = new CheckBoxGroup(getContext());
for (ShipType shipType :
ShipTypeList.get(getActivity())) {
if (shipType.getId() == 1 || shipType.getId() == 12 || shipType.getId() == 15) {
continue;
}
mCheckBoxGroups[2].addItem(String.format("%s (%s)", shipType.getName().get(getActivity()), shipType.getShortX()), shipType.getId());
}
mCheckBoxGroups[2].setOnCheckedChangeListener(new CheckBoxGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(View view, int checked) {
BusProvider.instance().post(new ShipAction.TypeChangeAction(checked));
mFlag = checked;
Settings
.instance(getContext())
.putInt(Settings.SHIP_FILTER, checked);
}
});
body.addView(mCheckBoxGroups[2]);
mScrollView = new NestedScrollView(getContext());
mScrollView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
mScrollView.setPadding(0, Utils.dpToPx(4), 0, Utils.dpToPx(4));
mScrollView.setClipToPadding(false);
mScrollView.addView(body);
mActivity.getSwitch().setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int checked = buttonView.isChecked() ? 1 : 0;
BusProvider.instance().post(
new BookmarkAction.Changed(ShipFragment.TAG, checked > 0));
mBookmarked = checked > 0;
Settings
.instance(getContext())
.putBoolean(Settings.SHIP_BOOKMARKED, checked > 0);
if (mViewPager.getCurrentItem() == 1 && !mBookmarked) {
mViewPager.setCurrentItem(0, false);
}
}
});
mActivity.getRightDrawerContent().addView(mScrollView);
}
private void postSetDrawerView() {
mSort = Settings
.instance(getContext())
.getInt(Settings.SHIP_SORT, 0);
mSpinner.setSelection(mSort);
mFinalVersion = Settings
.instance(getContext())
.getInt(Settings.SHIP_FINAL_VERSION, 1);
mRadioButtonGroups[0].setChecked(mFinalVersion);
mBookmarked = Settings
.instance(getContext())
.getBoolean(Settings.SHIP_BOOKMARKED, false);
((MainActivity) getActivity()).getSwitch().setChecked(mBookmarked, true);
//mCheckBoxGroups[0].setChecked(mBookmarked ? 1 : 0);
mSpeed = Settings
.instance(getContext())
.getInt(Settings.SHIP_SPEED, 0);
mCheckBoxGroups[1].setChecked(mSpeed);
mFlag = Settings
.instance(getContext())
.getInt(Settings.SHIP_FILTER, 0);
mCheckBoxGroups[2].setChecked(mFlag);
}
@Override
protected boolean getRightDrawerLock() {
return false;
}
@Override
protected boolean getSwitchVisible() {
return true;
}
@Override
public void onStart() {
super.onStart();
BusProvider.instance().register(this);
}
@Override
public void onStop() {
BusProvider.instance().unregister(this);
super.onStop();
}
@Override
public void onShow() {
super.onShow();
BusProvider.instance().post(new ShipAction.KeywordChanged(null));
MainActivity activity = ((MainActivity) getActivity());
activity.getTabLayout().setupWithViewPager(mViewPager);
activity.getSupportActionBar().setTitle(getString(R.string.ship));
/*Observable
.create(new Observable.OnSubscribe<Object>() {
@Override
public void call(Subscriber<? super Object> subscriber) {
setDrawerView();
subscriber.onCompleted();
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<Object>() {
@Override
public void onCompleted() {
mFinalVersion = Settings
.instance(getContext())
.getInt(Settings.SHIP_FINAL_VERSION, 0);
mCheckBoxGroups[0].setChecked(mFinalVersion);
mSpeed = Settings
.instance(getContext())
.getInt(Settings.SHIP_SPEED, 0);
mCheckBoxGroups[1].setChecked(mSpeed);
mFlag = Settings
.instance(getContext())
.getInt(Settings.SHIP_FILTER, 0);
mCheckBoxGroups[2].setChecked(mFlag);
mActivity.getRightDrawerContent().addView(mScrollView);
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(Object o) {
}
});*/
setDrawerView();
postSetDrawerView();
// may crash
/*new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
setDrawerView();
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
postSetDrawerView();
}
}.execute();*/
Statistics.onFragmentStart("ShipDisplayFragment");
}
@Override
public void onHide() {
super.onHide();
Statistics.onFragmentEnd("ShipDisplayFragment");
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.ship, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public void onSearchExpand() {
BusProvider.instance().post(new ShipAction.IsSearchingChanged(true));
BusProvider.instance().post(new ShipAction.KeywordChanged(null));
if (mViewPager.getCurrentItem() == 1) {
mViewPager.setCurrentItem(0);
}
}
@Override
public void onSearchCollapse() {
BusProvider.instance().post(new ShipAction.IsSearchingChanged(false));
BusProvider.instance().post(new ShipAction.KeywordChanged(null));
}
@Override
public void onSearchTextChange(String newText) {
BusProvider.instance().post(new ShipAction.KeywordChanged(newText.replace(" ", "")));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_filter:
mActivity.getDrawerLayout().openDrawer(GravityCompat.END);
return true;
}
return super.onOptionsItemSelected(item);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mActivity = (MainActivity) getActivity();
View view = inflater.inflate(R.layout.content_unscrollable_viewpager, container, false);
mViewPager = (UnScrollableViewPager) view.findViewById(R.id.view_pager);
mViewPager.setAdapter(getAdapter());
if (!isHiddenBeforeSaveInstanceState()) {
onShow();
}
return view;
}
private ViewPagerAdapter getAdapter() {
ViewPagerAdapter adapter = new ViewPagerAdapter(getChildFragmentManager()) {
@Override
public Bundle getArgs(int position) {
Bundle bundle = new Bundle();
bundle.putInt(ShipFragment.ARG_TYPE_FLAG, mFlag);
bundle.putInt(ShipFragment.ARG_FINAL_VERSION, mFinalVersion);
bundle.putInt(ShipFragment.ARG_SPEED, mSpeed);
bundle.putInt(ShipFragment.ARG_SORT, mSort);
bundle.putBoolean(ShipFragment.ARG_BOOKMARKED, mBookmarked);
return bundle;
}
};
adapter.addFragment(ShipFragment.class, getString(R.string.all));
adapter.addFragment(BookmarkNoItemFragment.class, getString(R.string.all));
return adapter;
}
@Override
public String getSearchHint() {
return getString(R.string.search_hint_ship);
}
@Subscribe
public void bookmarkNoItem(BookmarkAction.NoItem action) {
mViewPager.setCurrentItem(1, false);
}
}
| [
"rikka@xing.moe"
] | rikka@xing.moe |
5814d2d83b98710d7bab38adafa06afb3c092f7c | e4194ddb177817460bb9f772c91e9af7de4c65bf | /agent/src/com/servlet/CompanyServlet.java | 0242ce4edad28af87b74c2d8a686b1548e0096db | [] | no_license | penglei1234/abc | 9447ccbf922743ce1d3a2084db718cb91ab3e6e9 | 7028de6f4d5fc6ba46bad6d46adf7cf89e4c838a | refs/heads/master | 2021-01-12T04:52:39.929643 | 2017-01-02T15:05:25 | 2017-01-02T15:05:25 | 77,805,726 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,891 | java | package com.servlet;
import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.dao.impl.LicenseTbDaoImpl;
import com.entity.Company;
import com.entity.LianXiRen;
import com.entity.LicenseTb;
import com.entity.User;
import com.service.CompanyService;
import com.service.WebSiteService;
import com.service.impl.CompanyServiceImpl;
import com.service.impl.WebSiteServiceImpl;
import com.tool.DateUtil;
import com.tool.Page;
public class CompanyServlet extends HttpServlet{
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
CompanyService companyService=new CompanyServiceImpl();
WebSiteService webSiteService=new WebSiteServiceImpl();
String method=request.getParameter("method");
if("save".equals(method)){
save(request, response, companyService, webSiteService);
} else if("select".equals(method)){
select(request, response, webSiteService);
} else if("update".equals(method)){
update(request, response, companyService, webSiteService);
} else if("delete".equals(method)){
delete(request, response, companyService, webSiteService);
} else if("charge".equals(method)){
charge(request, response, companyService, webSiteService);
} else if("view".equals(method)){
selectById(request, response, webSiteService);
} else if("updateCompany".equals(method)){
updateCompany(request, response, companyService, webSiteService);
} else if("saveCharge".equals(method)){
saveCharge(request, response, companyService, webSiteService);
}
}
private void select(HttpServletRequest request, HttpServletResponse response, WebSiteService webSiteService) throws ServletException, IOException{
String cname=request.getParameter("incname");
String userName=request.getParameter("userName");
Company company=null;
if(cname!=null&&!"".equals(cname)||userName!=null&&!"".equals(userName)){
company=new Company();
company.setCname(cname);
company.setUserName(userName);
request.setAttribute("company", company);
}
String spage=request.getParameter("pageNow");
int pageNow=spage==null||"".equals(spage)?1:Integer.parseInt(spage);
Page page=new Page(pageNow,5,webSiteService.selectCompanyRows(company));
List<Company> companyList=webSiteService.selectInfoByCnameAndLowyer(company, page);
request.setAttribute("companyList", companyList);
request.setAttribute("page", page);
request.getRequestDispatcher("pages/proxy/customer/customer-list.jsp").forward(request, response);
}
private void selectById(HttpServletRequest request, HttpServletResponse response, WebSiteService webSiteService) throws ServletException, IOException{
int cid=1;
String flag=request.getParameter("flag");
if(flag!=null&&!"".equals(flag)){
if("fromlist".equals(flag)){
String id=request.getParameter("id");
if(id!=null&&!"".equals(id)){
cid=Integer.parseInt(id);
}
}else if("fromcname".equals(flag)){
String cname=request.getParameter("cname");
Company company=webSiteService.selectCname(cname);
if(company!=null){
cid=company.getCid();
}
}
Company company=webSiteService.selectCompanyByCid(cid);
LicenseTb licenseTb=new LicenseTbDaoImpl().selectLicenseTbById(company.getLicenseid());
request.setAttribute("company", company);
request.setAttribute("licenseTb", licenseTb);
request.getRequestDispatcher("pages/proxy/customer/customer-edit.jsp").forward(request, response);
}else{
select(request, response, webSiteService);
}
}
private void save(HttpServletRequest request, HttpServletResponse response, CompanyService companyService, WebSiteService webSiteService) throws ServletException, IOException{
//获取传来的company的数据
String cname=request.getParameter("cname");
String cstmType=request.getParameter("cstmType");
String state=request.getParameter("state");
String lowyer=request.getParameter("lowyer");
String regtime=request.getParameter("regtime");
String licenseid=request.getParameter("licsType");
String licensecard=request.getParameter("licensecard");
String country=request.getParameter("country");
String sheng=request.getParameter("sheng");
String shi=request.getParameter("shi");
String qu=request.getParameter("qu");
String fax=request.getParameter("fax");
String phone=request.getParameter("phone");
String address=request.getParameter("address");
String remark=request.getParameter("remark");
String isdelete=request.getParameter("isdelte");
String cweb=request.getParameter("cweb");
String balance=request.getParameter("balance");
//获取lianxiren传来的数据
String[] lxname=request.getParameterValues("lxname");
String[] lxphone=request.getParameterValues("lxphone");
String[] lxfax=request.getParameterValues("lxfax");
String[] lxemail=request.getParameterValues("email");
String[] lxdepartment=request.getParameterValues("department");
//创建company对象,将company属性加入到company对象中
Company company=new Company();
company.setCname(cname);
if("0".equals(cstmType)){
company.setTid(1);
}
else if("1".equals(cstmType)){
company.setTid(2);
}
else if("2".equals(cstmType)){
company.setTid(3);
}
if("启用".equals(state)){
company.setState(1);
}else if("禁用".equals(state)){
company.setState(0);
}
company.setLowyer(lowyer);
company.setRegtime(DateUtil.toDate(regtime));
company.setLicenseid(Integer.parseInt(licenseid));
company.setCountry(country);
company.setFax(fax);
company.setPhone(phone);
company.setAddress(address);
company.setLicensecard(licensecard);
company.setSheng(sheng);
company.setShi(shi);
company.setQu(qu);
company.setRemark(remark);
int value=isdelete==null||"".equals(isdelete)?1:Integer.parseInt(isdelete);
company.setIsdelete(value);
String web=cweb==null||"".equals(cweb)?"http://":cweb;
company.setCweb(web);
User user=(User)request.getSession().getAttribute("user");
company.setUserId(user.getUserId());
company.setUserName(user.getUserRealName());
double bala=balance==null||"".equals(balance)?0:Double.parseDouble(balance);
company.setBalance(bala);
//调用service方法,将company对象传到service中,插入数据库
CompanyService cs=new CompanyServiceImpl();
int row=cs.insertCompany(company);
int cid=cs.selectCidByCname(cname);
//创建lianxiren集合,将lianxiren数据封装到集合中
List<LianXiRen> lxrList=new ArrayList<LianXiRen>();
if(lxname!=null){
for (int i = 0; i < lxname.length; i++) {
LianXiRen lxr = new LianXiRen();
lxr.setLxname(lxname[i]);
lxr.setPhone(lxphone[i]);
lxr.setFax(lxfax[i]);
lxr.setEmail(lxemail[i]);
lxr.setDepartment(lxdepartment[i]);
lxr.setCid(cid);
lxrList.add(lxr);
}
}
//遍历lianxiren集合。将数据插入到数据库中
for (LianXiRen lxren:lxrList) {
cs.insertLianXiRen(lxren);
}
select(request, response, webSiteService);
}
private void update(HttpServletRequest request, HttpServletResponse response, CompanyService companyService, WebSiteService webSiteService) throws ServletException, IOException{
String id=request.getParameter("id");
String state=request.getParameter("state");
if(id!=null&&!"".equals(id)||state!=null&&!"".equals(state)){
if("0".equals(state)){
companyService.updateCompanyState(1, Integer.parseInt(id));
}else{
companyService.updateCompanyState(0, Integer.parseInt(id));
}
}
select(request, response, webSiteService);
}
private void delete(HttpServletRequest request, HttpServletResponse response, CompanyService companyService, WebSiteService webSiteService) throws ServletException, IOException{
String id=request.getParameter("id");
String isdelete=request.getParameter("isdelete");
if(id!=null&&!"".equals(id)||isdelete!=null&&!"".equals(isdelete)){
if("0".equals(isdelete)){
companyService.deleteCompany(1, Integer.parseInt(id));
}else{
companyService.deleteCompany(0, Integer.parseInt(id));
}
}
select(request, response, webSiteService);
}
private void updateCompany(HttpServletRequest request, HttpServletResponse response, CompanyService companyService, WebSiteService webSiteService) throws ServletException, IOException{
//获取传来的company的数据
String cid=request.getParameter("cid");
String cname=request.getParameter("cname");
String cstmType=request.getParameter("cstmType");
String state=request.getParameter("state");
String lowyer=request.getParameter("lowyer");
String regtime=request.getParameter("regtime");
String licenseid=request.getParameter("licsType");
String licensecard=request.getParameter("licensecard");
String country=request.getParameter("country");
String sheng=request.getParameter("sheng");
String shi=request.getParameter("shi");
String qu=request.getParameter("qu");
String fax=request.getParameter("fax");
String phone=request.getParameter("phone");
String address=request.getParameter("address");
String remark=request.getParameter("remark");
String isdelete=request.getParameter("isdelte");
String cweb=request.getParameter("cweb");
String balance=request.getParameter("balance");
//获取lianxiren传来的数据
String[] lxid=request.getParameterValues("lxid");
String[] lxname=request.getParameterValues("lxname");
String[] lxphone=request.getParameterValues("lxphone");
String[] lxfax=request.getParameterValues("lxfax");
String[] lxemail=request.getParameterValues("email");
String[] lxdepartment=request.getParameterValues("department");
//创建company对象,将company属性加入到company对象中
Company company=new Company();
company.setCid(Integer.parseInt(cid));
company.setCname(cname);
if("0".equals(cstmType)){
company.setTid(1);
}
else if("1".equals(cstmType)){
company.setTid(2);
}
else if("2".equals(cstmType)){
company.setTid(3);
}
if("启用".equals(state)){
company.setState(1);
}else if("禁用".equals(state)){
company.setState(0);
}
company.setLowyer(lowyer);
company.setRegtime(DateUtil.toDate(regtime));
company.setLicenseid(Integer.parseInt(licenseid));
company.setCountry(country);
company.setFax(fax);
company.setPhone(phone);
company.setAddress(address);
company.setLicensecard(licensecard);
company.setSheng(sheng);
company.setShi(shi);
company.setQu(qu);
company.setRemark(remark);
int value=isdelete==null||"".equals(isdelete)?1:Integer.parseInt(isdelete);
company.setIsdelete(value);
String web=cweb==null||"".equals(cweb)?"http://":cweb;
company.setCweb(web);
User user=(User)request.getSession().getAttribute("user");
company.setUserId(user.getUserId());
company.setUserName(user.getUserRealName());
double bala=balance==null||"".equals(balance)?0:Double.parseDouble(balance);
company.setBalance(bala);
//调用service方法,将company对象传到service中,插入数据库
int res=companyService.updateCompany(company);
if(lxname!=null){
for (int i = 0; i < lxname.length; i++) {
LianXiRen lxr = new LianXiRen();
lxr.setLxid(Integer.parseInt(lxid[i]));
lxr.setLxname(lxname[i]);
lxr.setPhone(lxphone[i]);
lxr.setFax(lxfax[i]);
lxr.setEmail(lxemail[i]);
lxr.setDepartment(lxdepartment[i]);
lxr.setCid(Integer.parseInt(cid));
companyService.updateLianXiRen(lxr);
}
}
select(request, response, webSiteService);
}
private void charge(HttpServletRequest request, HttpServletResponse response, CompanyService companyService, WebSiteService webSiteService) throws ServletException, IOException{
String id=request.getParameter("id");
Company company=webSiteService.selectCompanyByCid(Integer.parseInt(id));
request.setAttribute("company", company);
request.getRequestDispatcher("pages/proxy/customer/customer-charge.jsp").forward(request, response);
}
private void saveCharge(HttpServletRequest request, HttpServletResponse response, CompanyService companyService, WebSiteService webSiteService) throws ServletException, IOException{
String cid=request.getParameter("cid");
String charge=request.getParameter("charge");
companyService.updateCompanyBalance(Double.parseDouble(charge), Integer.parseInt(cid));
select(request, response, webSiteService);
}
}
| [
"1170892006@qq.com"
] | 1170892006@qq.com |
9103d6edafd4df5e704e745d02350b604a5597cd | 5bf8ea3ee57134ea417b60972d13d54659de6015 | /library/src/main/java/com/tinyble/btmodule/utils/CommonLog.java | c4c450413a4e118a854b17c082b3f31920500c14 | [] | no_license | feer921/TinyBle | f8492be4ba55eb212378933dc4cd4edc884dc4b5 | 909d44118403ed956e54254fffb400aa9252be45 | refs/heads/master | 2021-01-20T15:07:08.644165 | 2017-02-24T08:38:50 | 2017-02-24T08:38:50 | 82,796,361 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,244 | java | package com.tinyble.btmodule.utils;
import com.tinyble.BuildConfig;
/**
* 日志输出
* <br/>
* 2015年12月23日-上午11:41:07
* @author lifei
*/
public final class CommonLog {
// public final static boolean ISDEBUG = BuildConfig.DEBUG;
public static boolean ISDEBUG = BuildConfig.DEBUG;
public static void logEnable(boolean toEnable) {
ISDEBUG = toEnable;
}
public static void w(String tag, String content) {
if (ISDEBUG) {
android.util.Log.w(tag, content);
}
}
public static void w(final String tag, Object... objs) {
if (ISDEBUG) {
android.util.Log.w(tag, getInfo(objs));
}
}
public static void i(String tag, String content) {
if (ISDEBUG) {
android.util.Log.i(tag, content);
}
}
public static void i(final String tag, Object... objs) {
if (ISDEBUG) {
android.util.Log.i(tag, getInfo(objs));
}
}
public static void d(String tag, String content) {
if (ISDEBUG) {
android.util.Log.d(tag, content);
}
}
public static void d(final String tag, Object... objs) {
if (ISDEBUG) {
android.util.Log.d(tag, getInfo(objs));
}
}
public static void e(String tag, String content) {
if (ISDEBUG) {
android.util.Log.e(tag, content);
}
}
public static void e(String tag, String content, Throwable e) {
if (ISDEBUG) {
android.util.Log.e(tag, content, e);
}
}
public static void e(final String tag, Object... objs) {
if (ISDEBUG) {
android.util.Log.e(tag, getInfo(objs));
}
}
private static String getInfo(Object... objs) {
if (objs == null) {
return "";
}
StringBuffer sb = new StringBuffer();
for (Object object : objs) {
sb.append(object);
}
return sb.toString();
}
public static void sysOut(Object msg) {
if (ISDEBUG) {
System.out.println(msg);
}
}
public static void sysErr(Object msg) {
if (ISDEBUG) {
System.err.println(msg);
}
}
}
| [
"feer921@163.com"
] | feer921@163.com |
de3711a7db297aa60c20002ffaab285b0117fd7a | 47e12176579e1bfc5e56c2b6b55564de6587d0f5 | /cakeshop-api/src/main/java/com/jpmorgan/cakeshop/config/rdbms/MysqlDataSourceConfig.java | 4bb4d834f905f91f5fb54e3799a3f46f2c14504f | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | cleancoindev/cakeshop | 34f8c2646480c278bab6ef38eab274e8bb46b246 | 38704516d4390019f573a86080d19d171334b7a6 | refs/heads/master | 2023-05-10T16:52:35.658975 | 2019-11-26T16:20:09 | 2019-11-26T16:20:09 | 227,548,701 | 0 | 1 | Apache-2.0 | 2023-04-29T05:57:00 | 2019-12-12T07:42:37 | null | UTF-8 | Java | false | false | 2,871 | java | package com.jpmorgan.cakeshop.config.rdbms;
import com.jpmorgan.cakeshop.conditions.MysqlDataSourceConditon;
import java.util.Properties;
import javax.sql.DataSource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
import org.springframework.jdbc.datasource.SimpleDriverDataSource;
/**
*
* @author Michael Kazansky
*/
@Configuration
@Conditional(MysqlDataSourceConditon.class)
public class MysqlDataSourceConfig extends AbstractDataSourceConfig {
@Bean
public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
return new PersistenceExceptionTranslationPostProcessor();
}
@Override
protected Properties hibernateProperties() {
LOG.debug("USING MYSQL HIBERNATE DIALECT");
return new Properties() {
{
setProperty("hibernate.jdbc.batch_size", StringUtils.isNotBlank(System.getProperty(JDBC_BATCH_SIZE))
? System.getProperty(JDBC_BATCH_SIZE) : env.getProperty(JDBC_BATCH_SIZE, "20"));
setProperty("hibernate.hbm2ddl.auto", StringUtils.isNotBlank(System.getProperty(HBM_2DDL_AUTO))
? System.getProperty(HBM_2DDL_AUTO) : env.getProperty(HBM_2DDL_AUTO, "update"));
setProperty("hibernate.dialect", StringUtils.isNotBlank(System.getProperty(HIBERNATE_DIALECT))
? System.getProperty(HIBERNATE_DIALECT) : env.getProperty(HIBERNATE_DIALECT, "org.hibernate.dialect.MySQLDialect"));
setProperty("hibernate.id.new_generator_mappings", "true");
}
};
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
@Override
protected DataSource getSimpleDataSource() throws ClassNotFoundException {
SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
dataSource.setDriverClass(com.mysql.jdbc.Driver.class);
dataSource.setUrl(StringUtils.isNotBlank(System.getProperty(JDBC_URL))
? System.getProperty(JDBC_URL) : env.getProperty(JDBC_URL));
dataSource.setUsername(StringUtils.isNotBlank(System.getProperty(JDBC_USER))
? System.getProperty(JDBC_USER) : env.getProperty(JDBC_USER));
dataSource.setPassword(StringUtils.isNotBlank(System.getProperty(JDBC_PASS))
? System.getProperty(JDBC_PASS) : env.getProperty(JDBC_PASS));
return dataSource;
}
}
| [
"chetan@pixelcop.net"
] | chetan@pixelcop.net |
f87466767b676174a6c052d9fd31ff87be4b0025 | b5f3834f0079886f13bc3cc9aab1a8275161fd22 | /src/main/java/org/bian/dto/CRFinancialPositionLogInitiateOutputModel.java | 95814e4054826a17d5d3d9e3cbd3db4c75d02edf | [
"Apache-2.0"
] | permissive | bianapis/sd-position-keeping-v2.0 | a1027e08f7c87861784416110ee8335885ed0ef0 | 3bbb297cfcb84ffa70025ad32b4dccede5918061 | refs/heads/master | 2020-07-14T02:13:41.087389 | 2019-09-04T06:34:30 | 2019-09-04T06:34:30 | 205,210,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,779 | java | package org.bian.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.bian.dto.CRFinancialPositionLogInitiateOutputModelCRFinancialPositionLogInstanceRecord;
import javax.validation.Valid;
/**
* CRFinancialPositionLogInitiateOutputModel
*/
public class CRFinancialPositionLogInitiateOutputModel {
private String financialPositionLogInstanceReference = null;
private String financialPositionLogInitiateActionReference = null;
private Object financialPositionLogInitiateActionRecord = null;
private String financialPositionLogInstanceStatus = null;
private CRFinancialPositionLogInitiateOutputModelCRFinancialPositionLogInstanceRecord cRFinancialPositionLogInstanceRecord = null;
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::ISO20022andUNCEFACT::Identifier general-info: Reference to the Financial Position Log instance
* @return financialPositionLogInstanceReference
**/
public String getFinancialPositionLogInstanceReference() {
return financialPositionLogInstanceReference;
}
public void setFinancialPositionLogInstanceReference(String financialPositionLogInstanceReference) {
this.financialPositionLogInstanceReference = financialPositionLogInstanceReference;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::ISO20022andUNCEFACT::Identifier general-info: Reference to an Initiate service call
* @return financialPositionLogInitiateActionReference
**/
public String getFinancialPositionLogInitiateActionReference() {
return financialPositionLogInitiateActionReference;
}
public void setFinancialPositionLogInitiateActionReference(String financialPositionLogInitiateActionReference) {
this.financialPositionLogInitiateActionReference = financialPositionLogInitiateActionReference;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Binary general-info: The Initiate service call input and output record
* @return financialPositionLogInitiateActionRecord
**/
public Object getFinancialPositionLogInitiateActionRecord() {
return financialPositionLogInitiateActionRecord;
}
public void setFinancialPositionLogInitiateActionRecord(Object financialPositionLogInitiateActionRecord) {
this.financialPositionLogInitiateActionRecord = financialPositionLogInitiateActionRecord;
}
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: The status of the Financial Position Log instance (e.g. initialised, pending, active)
* @return financialPositionLogInstanceStatus
**/
public String getFinancialPositionLogInstanceStatus() {
return financialPositionLogInstanceStatus;
}
public void setFinancialPositionLogInstanceStatus(String financialPositionLogInstanceStatus) {
this.financialPositionLogInstanceStatus = financialPositionLogInstanceStatus;
}
/**
* Get cRFinancialPositionLogInstanceRecord
* @return cRFinancialPositionLogInstanceRecord
**/
public CRFinancialPositionLogInitiateOutputModelCRFinancialPositionLogInstanceRecord getCRFinancialPositionLogInstanceRecord() {
return cRFinancialPositionLogInstanceRecord;
}
@JsonProperty("cRFinancialPositionLogInstanceRecord")
public void setCRFinancialPositionLogInstanceRecord(CRFinancialPositionLogInitiateOutputModelCRFinancialPositionLogInstanceRecord cRFinancialPositionLogInstanceRecord) {
this.cRFinancialPositionLogInstanceRecord = cRFinancialPositionLogInstanceRecord;
}
}
| [
"team1@bian.org"
] | team1@bian.org |
83fd3a84fcdd367a89659add2668da3bf85892f3 | 5f9db440f341f4b83032c47a9afb9d78e9a8ac88 | /src/main/java/com/basicsstrong/collectors/observableandobserverRxjava/schedular/SubscribeOn.java | 4e059885e4ad5b90c9c51a480acac1822a9ee248 | [] | no_license | guvenbe/functionalReactiveProgramming | fdb4f5e90d748d3b071b417d4ac54bcb6b5fccb6 | 0f6351565e0713efd0c44b71307c8c72d5543c99 | refs/heads/master | 2023-06-24T05:03:31.422051 | 2021-07-27T02:21:47 | 2021-07-27T02:21:47 | 317,489,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 765 | java | package com.basicsstrong.collectors.observableandobserverRxjava.schedular;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.schedulers.Schedulers;
public class SubscribeOn {
public static void main(String[] args) throws InterruptedException {
Observable.just("Pasta", "Pizza", "Fries", "Curry", "Chow Mein")
.subscribeOn(Schedulers.computation())
.map(e->e.toUpperCase())
.subscribeOn(Schedulers.newThread())
.filter(e->e.startsWith("P"))
.subscribe(e->print(e));
Thread.sleep(6000);
}
private static void print(String element) {
System.out.println(element + " : Printed by :" +Thread.currentThread().getName());
}
}
| [
"guvenbe@gmail.com"
] | guvenbe@gmail.com |
defa8c70428a7516a6a2d8a4b1dfb6e0b11e0c0d | b09c1692ed8fc7d296c19fbcb600a7eee66bcdb8 | /app/src/main/src/io/rong/app/fragment/setting/RongSettingFragment.java | c48ecda17b9bd923091aa3a3bca768b9999d0832 | [
"MIT"
] | permissive | oscarmore2/ChatWithSauSau | 0ddf1166666b9a8916235c7cef5e7ed8c15c840d | 4349d51de383f221eb6fcb7d080a0346a72ce25f | refs/heads/master | 2021-01-10T05:58:45.035488 | 2015-11-23T10:53:37 | 2015-11-23T10:53:37 | 46,713,274 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 656 | java | package io.rong.app.fragment.setting;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import io.rong.app.R;
import io.rong.imkit.fragment.DispatchResultFragment;
/**
* Created by Bob on 15/7/30.
*/
public class RongSettingFragment extends DispatchResultFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.rong_setting,container,false);
return view;
}
@Override
protected void initFragment(Uri uri) {
}
}
| [
"ityangb@163.com"
] | ityangb@163.com |
3c25ff5f50f24e3511ca2621e9872535156d9dfd | f37109181ee808460fedbd53aab1f054b358b7e6 | /AD/Android/MasterDetail_Juanma/app/src/androidTest/java/com/example/juanmavela/masterdetail_juanma/ExampleInstrumentedTest.java | 3127d5e2039df3928b30633f5a74989abd39e023 | [] | no_license | JuanMVP/TuAmigo-Vecino | a4db3607c6defcd14b9a738eb6a7ca67482f5757 | 4b3655a8bf339efb649a975644444c674b77c050 | refs/heads/master | 2021-10-15T22:55:11.633768 | 2019-02-06T09:55:34 | 2019-02-06T09:55:34 | 165,999,149 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package com.example.juanmavela.masterdetail_juanma;
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() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.juanmavela.masterdetail_juanma", appContext.getPackageName());
}
}
| [
"jm.vela94@gmail.com"
] | jm.vela94@gmail.com |
06ca46db392b955aa9d2cd93dd869c02355e9ffa | 8599d239b37d25f7447e91be6ad7fed8980b2869 | /FinalProject/ShchurykWeb/.idea/lab10/servlet/businessLogic/RegisterHorseCommand.java | 7fc7b6f5fc150fabcfbb86713d86f73ce894c5da | [] | no_license | Valeryshchurik/Java | c2b8d54f536a3b2b36ac321a4b61e3ef83d9f47e | a278ad3194f00c4e2cb216fc8bfcd95a420ab421 | refs/heads/master | 2020-03-29T18:40:50.495571 | 2018-09-25T07:44:01 | 2018-09-25T07:44:01 | 149,190,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,039 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.shchuryk.lab10.servlet.businessLogic;
import com.struchkov.lab10.entities.ClientsEntity;
import com.struchkov.lab10.entities.UserRoles;
import com.struchkov.lab10.util.AttributeParameterEnum;
import com.struchkov.lab10.util.Navigation;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author NotePad.by
*/
public class RegisterHorseCommand implements Command {
private BusinessLogicManager manager;
public RegisterHorseCommand(BusinessLogicManager manager) {
this.manager = manager;
}
@Override
public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ClientsEntity activeUser = (ClientsEntity)request.getSession().getAttribute(AttributeParameterEnum.USER.toString().toLowerCase());
if (activeUser == null) {
request.getRequestDispatcher("/" + Navigation.LOGIN + ".jsp")
.forward(request, response);
return;
}
if (activeUser.getRoleId() != UserRoles.ADMIN) {
request.getRequestDispatcher("/" + Navigation.INDEX + ".jsp")
.forward(request, response);
return;
}
String raceName = request.getParameter(AttributeParameterEnum.RACE_NAME_INPUT_FOR_REGISTER.toString().toLowerCase());
String horseName = request.getParameter(AttributeParameterEnum.HORSE_NAME_INPUT_FOR_REGISTER.toString().toLowerCase());
request.setAttribute(AttributeParameterEnum.RESULT.toString().toLowerCase(),
manager.registerHorse(raceName, horseName));
request.getRequestDispatcher("/" + Navigation.REGISTER_HORSE + ".jsp")
.forward(request, response);
}
}
| [
"Valeryschurik@gmail.com"
] | Valeryschurik@gmail.com |
7c0841941858115d3047a1ec78b2fd617293c19a | 244ff4eea01660d4003591f6fd963e64145154c6 | /SMPJ/src/main/java/model/spring/RegisterRequest.java | 0fffa641e6cc5ece8ac3660fa1c3fe2f833565cf | [] | no_license | gksdlsvy1/newSMPJ | 419dfe04db08d4471c2cac710533bf90f81d3645 | d3b6b93843590f7bebd8842f0144b0649a14a96a | refs/heads/master | 2020-04-17T20:28:50.738721 | 2015-07-07T22:18:50 | 2015-07-07T22:18:50 | 38,717,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,280 | java | package model.spring;
public class RegisterRequest {
private String email;
private String password;
private String confirmPassword;
private String name;
private String phone;
private String account_num;
private String account_name;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getConfirmPassword() {
return confirmPassword;
}
public void setConfirmPassword(String confirmPassword) {
this.confirmPassword = confirmPassword;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getAccountNum() {
return account_num;
}
public void setAccountNum(String account_num) {
this.account_num = account_num;
}
public String getAccountName() {
return account_name;
}
public void setAccountName(String account_name) {
this.account_name = account_name;
}
public boolean isPasswordEqualToConfirmPassword() {
return password.equals(confirmPassword);
}
}
| [
"honginpyo1@hanmail.net"
] | honginpyo1@hanmail.net |
8ff94221d4a7fd43250a9677e870d18c5839f82e | 5a6e879b573545e6e1bba8b5708351597132064c | /CarrascoIllescas-BryanExamen/src/ec/edu/ups/ejb/ReservaFacade.java | b22523dba052497a05e5be0f18f5d24c05bc7485 | [] | no_license | bcarrascoi/CarrascoIllescas-BryanExamen | 8841b7b479d8af0f1a4978c15a8d70c5007fa766 | 5eb12b74a26d478f950d3a4800f5ac0ee7cc5dd4 | refs/heads/master | 2023-06-29T22:49:26.363510 | 2021-07-30T13:56:46 | 2021-07-30T13:56:46 | 389,874,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 850 | java | package ec.edu.ups.ejb;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import ec.edu.ups.entidad.Reserva;
@Stateless
public class ReservaFacade extends AbstractFacade<Reserva>{
@PersistenceContext(unitName = "Examen")
private EntityManager em;
public ReservaFacade() {
super(Reserva.class);
// TODO Auto-generated constructor stub
}
@Override
protected EntityManager getEntityManager() {
return em;
}
public Reserva buscarCedulaCli(String cedula) {
try {
String jpql = "SELECT res, cli FROM Reserva res, Cliente cli where cli.codigoCliente = res.cliente_id AND cli.cedula ='"+cedula+"'";
Reserva reserva= (Reserva) em.createQuery(jpql).getSingleResult();
return reserva;
}catch(Exception e) {
e.printStackTrace();
return null;
}
}
}
| [
"bcarrascoi@est.ups.edu.ec"
] | bcarrascoi@est.ups.edu.ec |
c8be7d9aea0406373c230b49695014a9e3fd561d | a5afee19e829a90d571eaffac7184aad6ef57cec | /JuneOnlineBatch/src/encapsulation/student.java | 126d459840f3d63a74d7e1a0f8aa1569e3b7b5a6 | [] | no_license | abhisheksawai/juneweekday | df092ef65cb8f249d852e50bac40154482562600 | c118bc0e2e8678108c5fe8a72ca18756a2bc7c8d | refs/heads/master | 2020-07-07T17:13:07.850112 | 2019-08-20T17:06:58 | 2019-08-20T17:06:58 | 203,417,599 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package encapsulation;
public class student {
private String studname; // privagte data member
public String getNameofStud() // getter method
{
return studname;
}
public void setNameofStud(String studname) // setter method
{
this.studname= studname;
}
}
| [
"lenovo@LAPTOP-UK7PKGHG"
] | lenovo@LAPTOP-UK7PKGHG |
c50059f335cca4a504022474230d152192b5babb | fc160694094b89ab09e5c9a0f03db80437eabc93 | /java-dialogflow/samples/snippets/generated/com/google/cloud/dialogflow/v2/versions/listversions/AsyncListVersions.java | 5fcb77910cac5c78e82362505f93d7de2801ad03 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | googleapis/google-cloud-java | 4f4d97a145e0310db142ecbc3340ce3a2a444e5e | 6e23c3a406e19af410a1a1dd0d0487329875040e | refs/heads/main | 2023-09-04T09:09:02.481897 | 2023-08-31T20:45:11 | 2023-08-31T20:45:11 | 26,181,278 | 1,122 | 685 | Apache-2.0 | 2023-09-13T21:21:23 | 2014-11-04T17:57:16 | Java | UTF-8 | Java | false | false | 2,181 | java | /*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.dialogflow.v2.samples;
// [START dialogflow_v2_generated_Versions_ListVersions_async]
import com.google.api.core.ApiFuture;
import com.google.cloud.dialogflow.v2.AgentName;
import com.google.cloud.dialogflow.v2.ListVersionsRequest;
import com.google.cloud.dialogflow.v2.Version;
import com.google.cloud.dialogflow.v2.VersionsClient;
public class AsyncListVersions {
public static void main(String[] args) throws Exception {
asyncListVersions();
}
public static void asyncListVersions() throws Exception {
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VersionsClient versionsClient = VersionsClient.create()) {
ListVersionsRequest request =
ListVersionsRequest.newBuilder()
.setParent(AgentName.ofProjectName("[PROJECT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Version> future = versionsClient.listVersionsPagedCallable().futureCall(request);
// Do something.
for (Version element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
}
}
// [END dialogflow_v2_generated_Versions_ListVersions_async]
| [
"noreply@github.com"
] | googleapis.noreply@github.com |
d5ef3ae0119a3b12c67613814178b73580183a2b | c1c51f90320fc5acdc1e07f16025e9089b2eb015 | /Seminar2/src/ro/ase/acs/main/IoC.java | 50e2e0c8a35147ead29d16648d2bbc73b21350d8 | [] | no_license | alexandruluta6/CTS2021 | 5e0d3ba3d1b9ecf90fb31bf654a2107e90f08775 | 4a0622b1d3de8c42ac25d6fac28141f8b1a98491 | refs/heads/main | 2023-03-23T06:12:10.790948 | 2021-03-11T13:28:14 | 2021-03-11T13:28:14 | 342,234,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 289 | java | package ro.ase.acs.main;
import java.util.HashMap;
import java.util.Map;
public class IoC {
private Map<Class, Class> map = new HashMap<>();
public void register(Class<?> contract, Class<?> implementation) {
if(!map.containsKey(contract)) {
map.put(contract, implementation);
}
}
} | [
"lutaionel17@stud.ase.ro"
] | lutaionel17@stud.ase.ro |
c336befb4ac3a62878cfbf94b9c03af1f1e520d0 | f9347c036afcfd03d9a23884d0f13b159d23d2cd | /做题笔记/美团面试/Main2.java | 6c8ff4df863e91a3b5ac1a510f6d76dda4bdcb08 | [] | no_license | Study-dai/javaNote | 020c21556be56e5cb91d5bd54359b8adefbada74 | 25ff5dc6ac802fd14e42160a86d6c30ffaa68214 | refs/heads/master | 2023-06-13T04:57:13.059968 | 2020-03-12T13:12:20 | 2020-03-12T13:12:20 | 216,201,091 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | package 美团面试;
/*
给出一个序列包含n个正整数的序列A,然后给出一个正整数x,
你可以对序列进行任意次操作的,每次操作你可以选择序列中的一个数字,
让其与x做按位或运算。你的目的是让这个序列中的众数出现的次数最多。
请问众数最多出现多少次。
输入
输入第一行仅包含两个正整数n和x,表示给出的序列的长度和给定的正整数。(1<=n<=100000,1<=x<=1000)
接下来一行有n个正整数,即这个序列,中间用空格隔开。(1<=a_i<=1000)
输出
输出仅包含一个正整数,表示众数最多出现的次数。
样例输入
5 2
3 1 3 2 5
样例输出
3
*/
public class Main2 {
public static void main(String[] args) {
}
}
| [
"1215461373@qq.com"
] | 1215461373@qq.com |
84b3c7fbc164508f09e10ec35a1fa34e00f28fb0 | f6ce38cae3e7e03acfaa097c3054e2611388265b | /src/Test/test123.java | fb6b184a4503b0e14ab935f1050b484913624679 | [] | no_license | keyedinManuf/Demo2 | b43c3dc483ecef0be9c689dff257e88c6010cf41 | 1194d235b519b8cb3e6b0556a6a0183cd8d4dda3 | refs/heads/master | 2021-01-10T08:18:50.785115 | 2015-11-05T11:45:03 | 2015-11-05T11:45:03 | 45,450,189 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,790 | java | package Test;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;
public class test123 {
public static WebDriver dr= new FirefoxDriver();
public static String str;
@Test (priority =0)
public void AddSalesOrder() throws Exception {
try{
System.out.println("-------------CRUD Operation----------------");
System.out.println("------------------------------------------------");
System.out.println("Sceario 1: Sales Order Creation");
dr.findElement(By.xpath(".//span[@class='k-icon k-icon-clipboard']")).click();
dr.findElement(By.xpath(".//a[@href='/Dev03/Form/Create/70']")).click();
dr.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
dr.findElement(By.xpath("html/body/div[2]/div/div[1]/div[1]/div/form/div[2]/div/div/fieldset[1]/div/div/div/div[1]/div[2]/div/div/div[2]/div/div[1]/span/div/a/span[1]")).click();
dr.findElement(By.xpath("html/body/div[5]/div/input")).sendKeys("Test");
dr.findElement(By.xpath("html/body/div[5]/ul/li[2]/div")).click();
dr.findElement(By.xpath("html/body/div[2]/div/div[1]/div[1]/div/form/div[2]/div/div/fieldset[1]/div/div/div/div[5]/div[1]/div/div/div[2]/div/div[1]/span/div/a/span[1]")).click();
dr.findElement(By.xpath("html/body/div[6]/div/input")).sendKeys("KI Bikes");
dr.findElement(By.xpath("html/body/div[6]/ul/li[1]/div")).click();
dr.findElement(By.xpath("html/body/div[2]/div/div[1]/div[1]/div/form/div[2]/div/div/fieldset[1]/div/div/div/div[6]/div[1]/div/div/div[2]/div/div[1]/span/div/a/span[1]")).click();
dr.findElement(By.xpath("html/body/div[7]/div/input")).sendKeys("CAD - Canadian Dollars");
dr.findElement(By.xpath("html/body/div[7]/ul/li[1]/div")).click();
dr.findElement(By.xpath("html/body/div[2]/div/div[1]/div[1]/div/form/div[2]/div/div/fieldset[1]/div/div/div/div[8]/div[2]/div/div/div[2]/div/div[1]/span/div/a/span[1]")).click();
dr.findElement(By.xpath("html/body/div[8]/div/input")).sendKeys("Mark B");
dr.findElement(By.xpath("html/body/div[8]/ul/li[1]/div")).click();
dr.findElement(By.xpath(".//button[@class='btn btn-xs btn-success']")).click();
dr.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
WebElement orderno = dr.findElement(By.xpath("/html/body/div[2]/div/div[1]/div[1]/div/form/div[2]/div/div/fieldset[1]/div/div/div/div[1]/div[1]/div/div/div[2]/div/div[1]/span"));
str =orderno.getText();
System.out.println("Created Sales order is :"+str);}
catch(Exception e){
throw e;
}
}
@Test (enabled=true,priority =1)
public static void SearchSaleOrder() throws Exception{
try{
System.out.println("------------------------------------------------");
System.out.println("Scenario 2: Searching the newly created Sales Order");
dr.findElement(By.xpath(".//div[@data-label='Sales Orders']")).click();
dr.findElement(By.xpath(".//input[@id='Name']")).sendKeys(str);
dr.findElement(By.xpath(".//button[@data-label='Search']")).click();
WebElement table = dr.findElement(By.xpath("html/body/div[2]/div/div[1]/div[1]/div/form/div[2]/div/div[2]/div[3]/div[2]/div/table"));
boolean verify =table.isDisplayed();
System.out.println("Search result Table is Displayed:\n"+verify);
Thread.sleep(1000);
String Text = dr.findElement(By.xpath("html/body/div[2]/div/div[1]/div[1]/div/form/div[2]/div/div[2]/div[3]/div[2]/div/table/tbody/tr/td[3]")).getText();
System.out.println(Text);
if(!Text.equals(str)){
System.out.print("Search fails\n");
}else{
System.out.print("Searching is done with the newly created Sales order\n");
}
dr.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
}catch (Exception e){
throw e;
}
}
@Test (enabled=true, groups="Mygroup", priority =2)
public static void EditSalesOrder() throws Exception{
try {
System.out.println("------------------------------------------------");
System.out.println("Scenario 3: Editing the newly added Sales Order");
WebDriverWait wait = new WebDriverWait(dr,20);
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("html/body/div[2]/div/div[1]/div[1]/div/form/div[2]/div/div[2]/div[3]/div[2]/div/table/tbody/tr/td[1]/div[2]/a[2]/i")));
dr.findElement(By.xpath("html/body/div[2]/div/div[1]/div[1]/div/form/div[2]/div/div[2]/div[3]/div[2]/div/table/tbody/tr/td[1]/div[2]/a[2]/i")).click();
dr.findElement(By.xpath("html/body/div[2]/div/div[1]/div[1]/div/form/div[2]/div/div/fieldset[1]/div/div/div/div[5]/div[1]/div/div/div[2]/div/div[1]/span/div/a")).click();
dr.findElement(By.xpath("html/body/div[5]/div/input")).sendKeys("Adult Training Bikes");
dr.findElement(By.xpath("html/body/div[5]/ul/li/div/span")).click();
dr.findElement(By.xpath(".//span[@id='select2-chosen-10']")).click();
Thread.sleep(1000);
dr.findElement(By.xpath("html/body/div[6]/div/input")).sendKeys("30 - Net 30 Days");
dr.findElement(By.xpath("html/body/div[6]/ul/li/div/span")).click();
dr.findElement(By.xpath(".//button[@class='btn btn-xs btn-success']")).click();
System.out.println("Editing done successfully");
dr.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);}
catch(Exception e){
throw e;
}
}
@Test (enabled=true,groups="Mygroup", priority=3)
public static void ViewSalesOrder() throws Exception{
try{
System.out.println("------------------------------------------------");
System.out.println("Scenario 4: View the Sales Order");
dr.findElement(By.xpath(".//div[@data-label='Sales Orders']")).click();
dr.findElement(By.xpath(".//input[@id='Name']")).sendKeys(str);
dr.findElement(By.xpath(".//button[@data-label='Search']")).click();
Thread.sleep(1000);
dr.findElement(By.xpath("/html/body/div[2]/div/div[1]/div[1]/div/form/div[2]/div/div[2]/div[3]/div[2]/div/table/tbody/tr/td[1]/div[2]/a[6]")).click();
dr.findElement(By.xpath("/html/body/div[2]/div/div[1]/div[1]/div/form/div[2]/div/div[2]/div[3]/div[2]/div/table/tbody/tr/td[1]/div[2]/ul/li[3]/a")).click();
}catch (Exception e){
throw e;
}
}
@Test (enabled=true,groups="Mygroup", priority=4)
public static void DeleteSalesOrder() throws Exception{
try{
System.out.println("------------------------------------------------");
System.out.println("Scenario 5: Deleting the Sales Order");
dr.findElement(By.xpath(".//div[@data-label='Sales Orders']")).click();
dr.findElement(By.xpath(".//input[@id='Name']")).sendKeys(str);
dr.findElement(By.xpath(".//button[@data-label='Search']")).click();
Thread.sleep(1000);
dr.findElement(By.xpath("/html/body/div[2]/div/div[1]/div[1]/div/form/div[2]/div/div[2]/div[3]/div[2]/div/table/tbody/tr/td[1]/div[2]/a[6]")).click();
dr.findElement(By.xpath("/html/body/div[2]/div/div[1]/div[1]/div/form/div[2]/div/div[2]/div[3]/div[2]/div/table/tbody/tr[1]/td[1]/div[2]/ul/li[5]/a")).click();
dr.findElement(By.xpath("/html/body/div[2]/div/div[1]/div[1]/div/form/div[3]/div/button[1]")).click();
}catch (Exception e){
throw e;
}
}
@Test (enabled=false,groups = "Mygroup_2", priority = 5)
public static void SaleOrderACK() throws InterruptedException, IOException {
System.out.println("------------------------------------------------");
System.out.println("Scenario 6: Sales order Acknowledgement");
dr.findElement(By.xpath("html/body/div[1]/ul[2]/li[2]/div/a")).click();
dr.findElement(By.xpath("html/body/div[2]/div/div[1]/div[2]/div/ul/li[1]/ul/li[2]/div[1]/a[3]")).click();
dr.findElement(By.xpath("html/body/div[2]/div/div[1]/div[2]/div/ul/li[1]/ul/li[1]/ul/li[2]/div[1]/a[3]")).click();
dr.findElement(By.xpath(".//li[@class='select2-search-field']")).click();
dr.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
String string1="html/body/div[5]/ul/li[";
String string2="]/div";
List<WebElement> SOID=dr.findElements(By.xpath("html/body/div[5]"));
int Size =SOID.size();
Random select = new Random(System.currentTimeMillis());
int rval=select.nextInt(Size)+7;
dr.findElement(By.xpath(string1+rval+string2)).click();
dr.findElement(By.xpath(".//li[@class='select2-search-field']")).click();
dr.findElement(By.xpath(".//button[@class='btn btn-xs btn-success']")).click();
System.out.println("Sales order Acknowledgement done successfully");
dr.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test (enabled=false,groups = "Mygroup_2", priority=6)
public void SalesOrderListing() throws InterruptedException, AWTException, IOException {
System.out.println("------------------------------------------------");
System.out.println("Scenario 7: Sales order Listing");
dr.findElement(By.xpath(".//span[@class='k-icon k-icon-clipboard']")).click();
dr.findElement(By.xpath(".//*[@id='main']/div/div[1]/div[2]/div/ul/li[1]/ul/li[2]/div[1]/a[3]")).click();
dr.findElement(By.xpath(".//*[@id='main']/div/div[1]/div[2]/div/ul/li[1]/ul/li[1]/ul/li[1]/div[1]/a[3]")).click();
dr.findElement(By.xpath(".//span[@id='select2-chosen-2']")).click();
dr.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
String s1="html/body/div[5]/ul/li[";
String s2="]/div";
List<WebElement> options=dr.findElements(By.xpath("html/body/div[5]/ul"));
int Size = options.size();
// System.out.println("Size:" +Size);
Random rand = new Random(System.currentTimeMillis());
int rval=rand.nextInt(Size)+4;
// System.out.println("R val is : "+rval);
dr.findElement(By.xpath(s1+rval+s2)).click();
FirefoxProfile prof = new FirefoxProfile();
prof.setPreference("browser.download.folderlist",0);
prof.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/csv");
dr.findElement(By.xpath("html/body/div[2]/div/div[1]/div[1]/div/form/div[1]/div/a")).click();
Robot object = new Robot();
object.delay(3000);
object.keyPress(KeyEvent.VK_ENTER);
object.keyRelease(KeyEvent.VK_ENTER);
object.keyPress(KeyEvent.VK_ALT);
object.keyPress(KeyEvent.VK_ALT);
object.keyRelease(KeyEvent.VK_F4);
object.keyRelease(KeyEvent.VK_ALT);
System.out.println("Sales order delivery listing done Succesfully");
System.out.println("------------------------------------------------");
dr.close();
}
@BeforeTest
public void beforeTest() {
dr.navigate().to("http://kimdev01.keyedinuat.com/Dev03");
dr.manage().window().maximize();
dr.findElement(By.xpath(".//form[@method='post']/ul/li[1]/input")).sendKeys("lizc-admin");
dr.findElement(By.xpath(".//form[@method='post']/ul/li[2]/input")).sendKeys("password");
dr.findElement(By.xpath(".//form[@method='post']/ul/li[3]/input")).click();
dr.manage().timeouts().pageLoadTimeout(20, TimeUnit.SECONDS);
}
@AfterTest
public void afterTest() {
dr.quit();
}
}
| [
"stevejobscbe42@gmail.com"
] | stevejobscbe42@gmail.com |
047bb080fbc8e8283c0f331c93b078a7ec5854a8 | 55bb5eb55b725cb02d58c142cbe80e6a98fbeb15 | /src/main/java/top/chendawei/system/service/IDictService.java | c850eb7ba94fc663a9c6e21b240413941eba176e | [] | no_license | daweifly1/dawu | 09b4c1ceaeca043d71197a0cc4b800a9c5b69bc8 | d976ff320f54841c278f19c3a5fba3994d1fb4ac | refs/heads/master | 2022-09-18T18:13:42.732079 | 2019-12-12T05:10:07 | 2019-12-12T05:10:07 | 211,608,895 | 0 | 0 | null | 2022-09-01T23:13:37 | 2019-09-29T05:35:20 | Java | UTF-8 | Java | false | false | 418 | java | package top.chendawei.system.service;
import top.chendawei.system.beans.entity.Dict;
import top.chendawei.util.JsonResult;
import java.util.List;
public interface IDictService {
List<Dict> getDictType()
throws Exception;
void updateDicNum(Long[] paramArrayOfLong1, Long[] paramArrayOfLong2);
List<Dict> getDictType2();
JsonResult<String> openSessiondelete(Long[] paramArrayOfLong);
}
| [
"chendawei"
] | chendawei |
7c0c041c4cd26fde1be52afc15c2e29f12f01d1e | a14ecbc3010c5ddb1ba40149c0b82ff157a37d6b | /module_backstage/src/test/java/com/lcworld/module_backstage/ExampleUnitTest.java | 462e56d1c45bea3e9bbb23ab838c8dc85ec74258 | [] | no_license | WooYu/BusinessChain | 81c30842802bdb685ead093e9b0e3745d2aeed4c | b5de6f50636498fad2d54ebdd15d2bd120a64f79 | refs/heads/master | 2020-04-22T13:59:18.118151 | 2019-04-01T09:24:10 | 2019-04-01T09:24:10 | 170,428,078 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package com.lcworld.module_backstage;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"wuyu@lcworld-inc.com"
] | wuyu@lcworld-inc.com |
e0ffe1a029267a562455fca99235c5bb6f71c93b | 30e80864336500e84b0cd70b85abaaf86a0b5583 | /de.mhus.osgi.micro/micro-karaf/src/main/java/de/mhus/micro/karaf/FileQueueCmd.java | 8db10cd0ceae9424fafb544bc4315b39e6b5e2d5 | [
"Apache-2.0"
] | permissive | mhus/mhus-inka | e031eb106201eff72fa35facd2c1d69ba81d0052 | 28d9a3a817d90e883b80140156898e98b088c082 | refs/heads/master | 2023-02-21T12:52:26.845379 | 2023-02-10T07:57:24 | 2023-02-10T07:57:24 | 47,407,300 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,082 | java | /**
* Copyright 2018 Mike Hummel
*
* <p>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
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>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 de.mhus.micro.karaf;
import java.io.File;
import java.util.Map.Entry;
import java.util.UUID;
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
import org.apache.karaf.shell.api.action.Option;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import de.mhus.lib.core.M;
import de.mhus.lib.core.MDate;
import de.mhus.lib.core.MFile;
import de.mhus.lib.core.MPeriod;
import de.mhus.lib.core.MProperties;
import de.mhus.lib.core.MString;
import de.mhus.lib.core.console.ConsoleTable;
import de.mhus.lib.core.util.MUri;
import de.mhus.micro.ext.api.dfs.FileInfo;
import de.mhus.micro.ext.api.dfs.FileQueueApi;
import de.mhus.micro.ext.api.dfs.FileQueueOperation;
import de.mhus.micro.ext.dfs.FileQueueApiImpl;
import de.mhus.osgi.api.karaf.AbstractCmd;
@Command(scope = "sop", name = "dfq", description = "Distributed File Queue actions")
@Service
public class FileQueueCmd extends AbstractCmd {
@Argument(
index = 0,
name = "cmd",
required = true,
description =
"Command:\n"
+ " load <uri> - load a file from remote or local\n"
+ " list [ident] - list queued files\n"
+ " touch <id> [ttl] - touch file and extend expire time\n"
+ " info <id> - print file properties\n"
+ " create <name> - create a queued file\n"
+ " append <id> <content as string> - append content to the file\n"
+ " close <id> - close the queued file, now the file is available in the network\n"
+ " print <id> - print the file content\n"
+ " delete <id> - delete the queued file\n"
+ " copy <path to file> - copy the file from file system into file queue\n"
+ " move <path to file> - move a file from file system into file queue\n"
+ " set <id> <key=value> - change a propertie for a queue file\n"
+ " providers - list of available providers")
String cmd;
@Argument(
index = 1,
name = "parameters",
required = false,
description = "More Parameters",
multiValued = true)
String[] parameters;
@Option(name = "-f", aliases = "--full", description = "Full output", required = false)
boolean full = false;
@Override
public Object execute2() throws Exception {
FileQueueApi api = M.l(FileQueueApi.class);
switch (cmd) {
case "load":
{
File id = api.loadFile(MUri.toUri(parameters[0]));
System.out.println(id.getName());
}
break;
case "list":
{
ConsoleTable table = new ConsoleTable(full);
if (parameters == null) {
table.setHeaderValues("ID", "Name", "Size", "Modified", "TTL", "Source");
for (UUID id : FileQueueApiImpl.instance().getQueuedIdList(true)) {
FileInfo info = api.getFileInfo(id);
MProperties prop = FileQueueApiImpl.instance().getProperties(id);
String ttl =
MPeriod.getIntervalAsString(
prop.getLong("expires", 0)
- System.currentTimeMillis());
table.addRowValues(
id,
info.getName(),
MString.toByteDisplayString(info.getSize()),
MDate.toIso8601(info.getModified()),
ttl,
prop.getString("source", ""));
}
} else {
table.setHeaderValues("ID", "Name", "Size", "Modified");
FileQueueOperation operation =
FileQueueApiImpl.instance().getOperation(parameters[0]);
for (UUID id : operation.getQueuedIdList()) {
FileInfo info = operation.getFileInfo(id);
table.addRowValues(
id,
info.getName(),
MString.toByteDisplayString(info.getSize()),
MDate.toIso8601(info.getModified()));
}
}
table.print(System.out);
}
break;
case "touch":
{
UUID id = UUID.fromString(parameters[0]);
api.touchFile(id, parameters.length > 1 ? M.to(parameters[1], 0) : 0);
System.out.println("OK");
}
break;
case "info":
{
UUID id = UUID.fromString(parameters[0]);
MProperties prop = FileQueueApiImpl.instance().getProperties(id);
for (Entry<String, Object> entry : prop.entrySet()) {
System.out.println(entry.getKey() + "=" + entry.getValue());
}
}
break;
case "create":
{
UUID id = api.createQueueFile(parameters[0], 0);
System.out.println("File Created with id: " + id);
}
break;
case "append":
{
UUID id = UUID.fromString(parameters[0]);
byte[] content = parameters[1].getBytes();
long size = api.appendQueueFileContent(id, content);
System.out.println("New file size: " + size);
}
break;
case "close":
{
UUID id = UUID.fromString(parameters[0]);
long size = api.closeQueueFile(id);
System.out.println("File size: " + size);
}
break;
case "print":
{
UUID id = UUID.fromString(parameters[0]);
File file = api.loadFile(id);
System.out.println(MFile.readFile(file));
}
break;
case "delete":
{
UUID id = UUID.fromString(parameters[0]);
FileQueueApiImpl.instance().delete(id);
System.out.println("OK");
}
break;
case "copy":
{
File file = new File(parameters[0]);
UUID id = api.takeFile(file, true, 0);
System.out.println("Created File: " + id);
}
break;
case "move":
{
File file = new File(parameters[0]);
UUID id = api.takeFile(file, false, 0);
System.out.println("Created File: " + id);
}
break;
case "set":
{
UUID id = UUID.fromString(parameters[0]);
String key = MString.beforeIndex(parameters[1], '=');
String val = MString.afterIndex(parameters[1], '=');
FileQueueApiImpl.instance().setParameter(id, key, val);
System.out.println("OK");
}
break;
case "providers":
{
System.out.println(" Ident");
System.out.println("------------------------");
for (String provider : FileQueueApiImpl.instance().listProviders()) {
System.out.println(provider);
}
}
break;
default:
System.out.println("Unknown command");
}
return null;
}
}
| [
"mike.hummel@billingsolutions.de"
] | mike.hummel@billingsolutions.de |
f9b01038b743b05189ea2083906d45dabea13c88 | 23a020adcfc67e2268d6fc5c04a31ea1a83baef6 | /outag/formats/ogg/OggTag.java | a4eac5cb91058a2db6e8ddc7e05345f05cd3b500 | [] | no_license | jeyboy/Outag | 42e25bf40fe7ae05f3dca56f95d8766c8380956a | f638614f47ba323ba63e0f3c45d72071ad377635 | refs/heads/master | 2020-04-06T09:21:52.558636 | 2013-02-24T20:57:30 | 2013-02-24T20:57:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,057 | java | package outag.formats.ogg;
import outag.formats.generic.AbstractTag;
import outag.formats.generic.TagField;
import outag.formats.ogg.util.OggTagField;
//FIXME: Handle previously handled DESCRIPTION|COMMENT and TRACK|TRACKNUMBER
public class OggTag extends AbstractTag {
private String vendor = "";
//This is the vendor string that will be written if no other is supplied
public static final String DEFAULT_VENDOR = "outag - The Musical Box";
protected TagField createAlbumField(String content) {
return new OggTagField("ALBUM", content);
}
protected TagField createArtistField(String content) {
return new OggTagField("ARTIST", content);
}
protected TagField createCommentField(String content) {
return new OggTagField("DESCRIPTION", content);
}
protected TagField createGenreField(String content) {
return new OggTagField("GENRE", content);
}
protected TagField createTitleField(String content) {
return new OggTagField("TITLE", content);
}
protected TagField createTrackField(String content) {
return new OggTagField("TRACKNUMBER", content);
}
protected TagField createYearField(String content) {
return new OggTagField("DATE", content);
}
protected String getAlbumId() { return "ALBUM"; }
protected String getArtistId() { return "ARTIST"; }
protected String getCommentId() { return "DESCRIPTION"; }
protected String getGenreId() { return "GENRE"; }
protected String getTitleId() { return "TITLE"; }
protected String getTrackId() { return "TRACKNUMBER"; }
protected String getYearId() { return "DATE"; }
public String getVendor() {
if( !this.vendor.trim().equals("") )
return vendor;
return DEFAULT_VENDOR;
}
public void setVendor(String vendor) { this.vendor = vendor == null ? "" : vendor; }
protected boolean isAllowedEncoding(String enc) { return enc.equals("UTF-8"); }
public String toString() { return "OGG " + super.toString(); }
} | [
"jeyboy1985@gmail.com"
] | jeyboy1985@gmail.com |
c9442f1bd2eedbda4b5081f1d05ae30ea433ba52 | 1e49fe132f6cef39d767639b27c5d240bd050ebb | /src/main/java/programmers/level_1/caesar_cipher_12926/Solution.java | 7d5ea92c2f5b1813374d8651ac4e5cbc2ef4c99d | [] | no_license | wooody92/algorithm | 0646fdb7a153e3868fd42b06c9ef562de30e2e1c | af6fa25832f5d38594bb06f57a715e571221c1b3 | refs/heads/master | 2023-05-11T19:53:24.868409 | 2023-04-27T04:21:02 | 2023-04-27T04:21:02 | 276,058,967 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,326 | java | package programmers.level_1.caesar_cipher_12926;
public class Solution {
/**
* 대문자는 대문자로만 돌아가고, 소문자는 소문자로만 돌아간다.
* Z -> A, z -> a
*/
public String solution(String s, int n) {
char[] answer = s.toCharArray();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < answer.length; i++) {
if (answer[i] == ' ') {
sb.append(answer[i]);
continue;
}
answer[i] = isUpperCase(answer[i]) ? upperCase(answer[i], n) : lowerCase(answer[i], n);
sb.append(answer[i]);
}
return sb.toString();
}
private boolean isUpperCase(char c) {
if (c >= 'A' && c <= 'Z') {
return true;
}
return false;
}
private char upperCase(char c, int n) {
c += n;
if (c > 'Z') {
c -= 26;
}
return c;
}
private char lowerCase(char c, int n) {
c += n;
if (c > 'z') {
c -= 26;
}
return c;
}
public static void main(String[] args) {
Solution solution = new Solution();
String s = "Hello World"; // Gdkkn Vnqkc
int n = 25;
System.out.println(solution.solution(s, n));
}
}
| [
"pkower4@naver.com"
] | pkower4@naver.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.