blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d69b16576adef2574008b1b98d9debda8af4cb65 | 97d028b49b6b660fe0c5f6ad9ac2bc9580580b3a | /MyApplication2/app/src/main/java/com/example/asusnb/myapplication/MainActivity.java | 9f206b82f99f2338d2e4176091339ddf23406f3e | [] | no_license | garyhsu123/android_final_project | 79d98e76b33eadde24b9577a9cbba44a1073113c | 9cf83c8bcd4cbfeecd9396acfd97aa7f5461ff2b | refs/heads/master | 2021-06-26T20:18:14.453079 | 2020-09-13T11:09:27 | 2020-09-13T11:09:27 | 95,203,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 969 | java | package com.example.asusnb.myapplication;
import android.content.Intent;
import android.media.Image;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
ImageView logo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
logo=(ImageView)findViewById(R.id.imageLogo) ;
logo.setOnClickListener(btnClock);
}
private Button.OnClickListener btnClock = new Button.OnClickListener(){
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(MainActivity.this,Main2Activity.class);
startActivity(intent);
}
};
}
| [
"[email protected]"
] | |
2677042883a86aab4a608fe1fe224078f6f07aa0 | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /imm-20200930/src/main/java/com/aliyun/imm20200930/models/TrimPolicy.java | fba38ddf1e8f6de516776ad4839cd822ea32e45e | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 1,847 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.imm20200930.models;
import com.aliyun.tea.*;
public class TrimPolicy extends TeaModel {
@NameInMap("DisableDeleteEmptyCell")
public Boolean disableDeleteEmptyCell;
@NameInMap("DisableDeleteRepeatedStyle")
public Boolean disableDeleteRepeatedStyle;
@NameInMap("DisableDeleteUnusedPicture")
public Boolean disableDeleteUnusedPicture;
@NameInMap("DisableDeleteUnusedShape")
public Boolean disableDeleteUnusedShape;
public static TrimPolicy build(java.util.Map<String, ?> map) throws Exception {
TrimPolicy self = new TrimPolicy();
return TeaModel.build(map, self);
}
public TrimPolicy setDisableDeleteEmptyCell(Boolean disableDeleteEmptyCell) {
this.disableDeleteEmptyCell = disableDeleteEmptyCell;
return this;
}
public Boolean getDisableDeleteEmptyCell() {
return this.disableDeleteEmptyCell;
}
public TrimPolicy setDisableDeleteRepeatedStyle(Boolean disableDeleteRepeatedStyle) {
this.disableDeleteRepeatedStyle = disableDeleteRepeatedStyle;
return this;
}
public Boolean getDisableDeleteRepeatedStyle() {
return this.disableDeleteRepeatedStyle;
}
public TrimPolicy setDisableDeleteUnusedPicture(Boolean disableDeleteUnusedPicture) {
this.disableDeleteUnusedPicture = disableDeleteUnusedPicture;
return this;
}
public Boolean getDisableDeleteUnusedPicture() {
return this.disableDeleteUnusedPicture;
}
public TrimPolicy setDisableDeleteUnusedShape(Boolean disableDeleteUnusedShape) {
this.disableDeleteUnusedShape = disableDeleteUnusedShape;
return this;
}
public Boolean getDisableDeleteUnusedShape() {
return this.disableDeleteUnusedShape;
}
}
| [
"[email protected]"
] | |
9e361b68f174fadd36b1304841525312831b5b4b | 53167799c1c1ffd71d765476911902a041d7a089 | /src/main/java/com/gavin/community/mapper/QuestionMapper.java | 60cfb6ca3e63e5e5a7aea26f699a26be4ce82059 | [] | no_license | Gavin6581/community | 27f354a5c33cc644c0bc5afee716b8e5db62d459 | aced042bda9116250360909e90fbf910ca6896ef | refs/heads/main | 2023-02-21T13:49:11.133683 | 2021-01-28T05:26:44 | 2021-01-28T05:26:44 | 331,500,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | package com.gavin.community.mapper;
import com.gavin.community.model.Question;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface QuestionMapper {
@Insert("insert into question (title,description,gmt_create,gmt_modified,creator,tag) values(#{title},#{description},#{gmtCreate},#{gmtModified},#{creator},#{tag})")
void create(Question question);
}
| [
"[email protected]"
] | |
1b7e05e1eb1f4c0998e52df3bbcbedfcf7bdb154 | e5b193babffd9501adb9de6d079127ece94d06b3 | /hotdog-after-end-master/hotdog-trade/src/main/java/com/pmzhongguo/ex/datalab/manager/AccountFeeReductionManager.java | 9ebe250930ca14478b3924bc4babd10ee78dd473 | [] | no_license | wh0amis/caex | 8ff4ffd5aacd4f04f9ab936eb24943e291d2ddd4 | 701cac06f7f2894c7a6dd02ea90a36459643ae63 | refs/heads/main | 2023-05-11T11:47:46.954443 | 2021-06-06T17:35:18 | 2021-06-06T17:35:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,403 | java | package com.pmzhongguo.ex.datalab.manager;
import com.pmzhongguo.ex.core.web.ErrorInfoEnum;
import com.pmzhongguo.ex.core.web.resp.ObjResp;
import com.pmzhongguo.ex.core.web.resp.Resp;
import com.pmzhongguo.ex.datalab.entity.AccountFee;
import com.pmzhongguo.ex.datalab.entity.AccountFeeDetail;
import com.pmzhongguo.ex.datalab.enums.AccountFeeDetailEnum;
import com.pmzhongguo.ex.datalab.service.AccountFeeService;
import com.qiniu.util.DateStyleEnum;
import com.qiniu.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.Date;
/**
* 手续费资产还原
*
* @author jary
* @creatTime 2019/12/6 10:00 AM
*/
@Component
public class AccountFeeReductionManager implements AccountFeeChangeService {
@Autowired private AccountFeeService accountFeeService;
@Override
public ObjResp executeAccountFeeChange(AccountFee accountFeeChane, AccountFee accountFeeDB) {
if (accountFeeDB.getId() == null){
return new ObjResp(Resp.FAIL,ErrorInfoEnum.SYMBOL_FEE_ACCOUNT_NOT_EXIST.getErrorENMsg(),null);
}
BigDecimal subtract = accountFeeDB.getForzenAmount().add(accountFeeChane.getForzenAmount());
if (subtract.compareTo(BigDecimal.ZERO) < 0) {
return compareAccountFeeAmount();
}
accountFeeDB.setForzenAmount(subtract);
accountFeeDB.setTotalAmount(accountFeeDB.getTotalAmount().add(accountFeeChane.getForzenAmount().abs()));
accountFeeService.accountFeeFrozen(accountFeeDB,executeAccountFeeChange(accountFeeDB,accountFeeChane.getForzenAmount()));
return new ObjResp(Resp.SUCCESS, Resp.SUCCESS_MSG, null);
}
@Override
public AccountFeeDetail executeAccountFeeChange(AccountFee accountFeeDB, BigDecimal floatAmount) {
return new AccountFeeDetail(
accountFeeDB.getMemberId(),
accountFeeDB.getFeeCurrency(),
AccountFeeDetailEnum.REDUCTION.getType(),
accountFeeDB.getTotalAmount(),
floatAmount.abs().negate(),
DateUtil.dateToString(new Date(), DateStyleEnum.YYYY_MM_DD_HH_MM_SS), null);
}
@Override
public ObjResp compareAccountFeeAmount() {
return new ObjResp(Resp.FAIL, ErrorInfoEnum.NOT_SUFFICIENT_FROZEN_FUNDS.getErrorENMsg(), null);
}
}
| [
"[email protected]"
] | |
122a9bae8253044a043078d6cb1c5142e23f4afe | 280a9cdbc08ad5d4999ba4e528eec9432058383e | /orders-and-customers/src/main/java/io/eventuate/examples/tram/sagas/ordersandcustomers/orders/domain/Order.java | f53980857072d437c16fac2c31d1692e14e13a12 | [
"Apache-2.0"
] | permissive | shyding/eventuate-tram-sagas | b0c09490c5cdcc265b7884f89f6e209219d90e00 | b41a0558a14cafc1074a4bf88acdcda1ef987510 | refs/heads/master | 2020-05-28T02:13:27.756339 | 2019-05-22T17:51:07 | 2019-05-22T17:51:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,282 | java | package io.eventuate.examples.tram.sagas.ordersandcustomers.orders.domain;
import io.eventuate.examples.tram.sagas.ordersandcustomers.orders.service.OrderDetails;
import io.eventuate.tram.events.ResultWithEvents;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Collections;
@Entity
@Table(name="orders")
@Access(AccessType.FIELD)
public class Order {
@Id
@GeneratedValue
private Long id;
private OrderState state;
@Embedded
private OrderDetails orderDetails;
public Order() {
}
public Order(OrderDetails orderDetails) {
this.orderDetails = orderDetails;
this.state = OrderState.PENDING;
}
public static ResultWithEvents<Order> createOrder(OrderDetails orderDetails) {
return new ResultWithEvents<Order>(new Order(orderDetails), Collections.emptyList());
}
public Long getId() {
return id;
}
public void noteCreditReserved() {
this.state = OrderState.APPROVED;
}
public void noteCreditReservationFailed() {
this.state = OrderState.REJECTED;
}
public OrderState getState() {
return state;
}
}
| [
"[email protected]"
] | |
d35ce1cd2ac969fe50f7a1c081ae39f8737ccb09 | f5b0c9be6293194dd81d3af987bd513ab4e87221 | /src/com/codeforces/competitions/year2016/round346div2/TaskA.java | f045f81782ccc60060309142ae0e8b0dcf97b466 | [] | no_license | rahulkhairwar/dsa-library | 13f8eb7765d3fa4e8cf2a746a3007e3a9447b2f8 | b14d14b4e3227ef596375bab55e88d50c7b950a6 | refs/heads/master | 2022-04-28T06:37:16.098693 | 2020-04-04T19:00:11 | 2020-04-04T19:00:11 | 43,200,287 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,007 | java | package com.codeforces.competitions.year2016.round346div2;
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
public final class TaskA
{
static int n, a, b;
static InputReader in;
static OutputWriter out;
public static void main(String[] args)
{
in = new InputReader(System.in);
out = new OutputWriter(System.out);
solve();
out.flush();
in.close();
out.close();
}
static void solve()
{
n = in.nextInt();
a = in.nextInt();
b = in.nextInt();
if (b == 0)
out.println(a);
else if (b < 0)
{
int curr = a;
while (b < 0)
{
b++;
if (curr == 1)
curr = n;
else
curr--;
}
out.println(curr);
}
else
{
int curr = a;
while (b > 0)
{
b--;
if (curr == n)
curr = 1;
else
curr++;
}
out.println(curr);
}
}
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
public InputReader(InputStream stream)
{
this.stream = stream;
}
public int read()
{
if (numChars == -1)
throw new InputMismatchException();
if (curChar >= numChars)
{
curChar = 0;
try
{
numChars = stream.read(buf);
} catch (IOException e)
{
throw new InputMismatchException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
public int nextInt()
{
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-')
{
sgn = -1;
c = read();
}
int res = 0;
do
{
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c & 15;
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public int[] nextIntArray(int arraySize)
{
int array[] = new int[arraySize];
for (int i = 0; i < arraySize; i++)
array[i] = nextInt();
return array;
}
public long nextLong()
{
int c = read();
while (isSpaceChar(c))
c = read();
int sign = 1;
if (c == '-')
{
sign = -1;
c = read();
}
long result = 0;
do
{
if (c < '0' || c > '9')
throw new InputMismatchException();
result *= 10;
result += c & 15;
c = read();
} while (!isSpaceChar(c));
return result * sign;
}
public long[] nextLongArray(int arraySize)
{
long array[] = new long[arraySize];
for (int i = 0; i < arraySize; i++)
array[i] = nextLong();
return array;
}
public float nextFloat() // problematic
{
float result, div;
byte c;
result = 0;
div = 1;
c = (byte) read();
while (c <= ' ')
c = (byte) read();
boolean isNegative = (c == '-');
if (isNegative)
c = (byte) read();
do
{
result = result * 10 + c - '0';
} while ((c = (byte) read()) >= '0' && c <= '9');
if (c == '.')
while ((c = (byte) read()) >= '0' && c <= '9')
result += (c - '0') / (div *= 10);
if (isNegative)
return -result;
return result;
}
public double nextDouble() // not completely accurate
{
double ret = 0, div = 1;
byte c = (byte) read();
while (c <= ' ')
c = (byte) read();
boolean neg = (c == '-');
if (neg)
c = (byte) read();
do
{
ret = ret * 10 + c - '0';
} while ((c = (byte) read()) >= '0' && c <= '9');
if (c == '.')
while ((c = (byte) read()) >= '0' && c <= '9')
ret += (c - '0') / (div *= 10);
if (neg)
return -ret;
return ret;
}
public String next()
{
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do
{
res.appendCodePoint(c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
public boolean isSpaceChar(int c)
{
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public String nextLine()
{
int c = read();
StringBuilder result = new StringBuilder();
do
{
result.appendCodePoint(c);
c = read();
} while (!isNewLine(c));
return result.toString();
}
public boolean isNewLine(int c)
{
return c == '\n';
}
public void close()
{
try
{
stream.close();
} catch (IOException e)
{
e.printStackTrace();
}
}
}
static class OutputWriter
{
private PrintWriter writer;
public OutputWriter(OutputStream stream)
{
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
stream)));
}
public OutputWriter(Writer writer)
{
this.writer = new PrintWriter(writer);
}
public void println(int x)
{
writer.println(x);
}
public void print(int x)
{
writer.print(x);
}
public void println(int array[], int size)
{
for (int i = 0; i < size; i++)
println(array[i]);
}
public void print(int array[], int size)
{
for (int i = 0; i < size; i++)
print(array[i] + " ");
}
public void println(long x)
{
writer.println(x);
}
public void print(long x)
{
writer.print(x);
}
public void println(long array[], int size)
{
for (int i = 0; i < size; i++)
println(array[i]);
}
public void print(long array[], int size)
{
for (int i = 0; i < size; i++)
print(array[i]);
}
public void println(float num)
{
writer.println(num);
}
public void print(float num)
{
writer.print(num);
}
public void println(double num)
{
writer.println(num);
}
public void print(double num)
{
writer.print(num);
}
public void println(String s)
{
writer.println(s);
}
public void print(String s)
{
writer.print(s);
}
public void println()
{
writer.println();
}
public void printSpace()
{
writer.print(" ");
}
public void flush()
{
writer.flush();
}
public void close()
{
writer.close();
}
}
static class CMath
{
static long power(long number, long power)
{
if (number == 1 || number == 0 || power == 0)
return 1;
if (power == 1)
return number;
if (power % 2 == 0)
return power(number * number, power / 2);
else
return power(number * number, power / 2) * number;
}
static long modPower(long number, long power, long mod)
{
if (number == 1 || number == 0 || power == 0)
return 1;
number = mod(number, mod);
if (power == 1)
return number;
long square = mod(number * number, mod);
if (power % 2 == 0)
return modPower(square, power / 2, mod);
else
return mod(modPower(square, power / 2, mod) * number, mod);
}
static long moduloInverse(long number, long mod)
{
return modPower(number, mod - 2, mod);
}
static long mod(long number, long mod)
{
return number - (number / mod) * mod;
}
}
}
| [
"[email protected]"
] | |
31d3956f3a2349a415170f6a3d3a4f0b798f192d | 80caa2b5432f7d562f1d7a7dcb0fb4053fd93afc | /4kforge_linux/src/a.java | f6aaa8369fbd26371f00eedc894b307d99b4628c | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | Zarkonnen/4kforge | 209b84dca5fb57f42491ab221f75c54d16bc178f | e8e44e61bb533b0a1555562b9f1c0623f6ee326f | refs/heads/master | 2021-01-16T18:29:38.734212 | 2014-04-28T08:23:27 | 2014-04-28T08:23:27 | 13,564,390 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,895 | java | import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.image.BufferStrategy;
import javax.swing.JApplet;
public class a extends JApplet implements Runnable, KeyListener, MouseListener, MouseMotionListener {
@Override
public void keyTyped(KeyEvent e) {}
@Override
public void mouseClicked(MouseEvent e) {}
@Override
public void mouseReleased(MouseEvent e) {}
@Override
public void mouseEntered(MouseEvent e) {}
@Override
public void mouseExited(MouseEvent e) {}
@Override
public void mouseDragged(MouseEvent me) {}
@Override
public void mouseMoved(MouseEvent me) {
my = me.getY();
mx = me.getX();
}
@Override
public void mousePressed(MouseEvent e) {
click = true;
}
@Override
public void keyPressed(KeyEvent e) {
key[((KeyEvent) e).getKeyCode()] = true;
}
@Override
public void keyReleased(KeyEvent e) {
key[((KeyEvent) e).getKeyCode()] = false;
}
boolean key[] = new boolean[65535];
boolean click = false;
int my, mx;
BufferStrategy strategy;
@Override
public void init() {
setIgnoreRepaint(true);
Canvas canvas = new Canvas();
add(canvas);
canvas.setBounds(0, 0, 800, 600);
canvas.createBufferStrategy(2);
strategy = canvas.getBufferStrategy();
canvas.addKeyListener(this);
canvas.addMouseListener(this);
canvas.addMouseMotionListener(this);
new Thread(this).start();
}
@Override
public void run() {
int tick = 0;
while(true) {
tick++;
Graphics2D g = (Graphics2D) strategy.getDrawGraphics();
g.setColor(Color.BLACK);
g.fillRect(0, 0, 800, 600);
g.setColor(Color.RED);
g.fillOval(tick % 800, 200, 50, 50);
strategy.show();
try { Thread.sleep(25); } catch (Exception e) {}
}
}
} | [
"[email protected]"
] | |
2599a1b735865505f5fbcc1c56f5598b69c84375 | 0ae3d747473e14708d4a6cfb1ef3c19111a8ec0f | /Java/SideCar/src/main/java/puj/as/sidecar/entities/Confirmacion.java | a437f54b13c834092f29e7ec43166da9b64d3beb | [] | no_license | JuanCastaneda2/ProyectoArqui | 8c9e1641488bf74e4132261c18a11348e954fc17 | 6a61764dd99b4e0c8f249a1a362e801739eb2ce6 | refs/heads/master | 2023-05-14T16:18:03.732090 | 2021-06-04T21:41:59 | 2021-06-04T21:41:59 | 373,320,785 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 739 | 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 puj.as.sidecar.entities;
import java.io.Serializable;
import java.util.Date;
/**
*
* @author admin
*/
public class Confirmacion implements Serializable {
int aprobacion;
String fecha;
public Confirmacion() {
}
public int getAprobacion() {
return aprobacion;
}
public void setAprobacion(int aprobacion) {
this.aprobacion = aprobacion;
}
public String getFecha() {
return fecha;
}
public void setFecha(String fecha) {
this.fecha = fecha;
}
}
| [
"[email protected]"
] | |
0b0e00fef654fa14810043c6548331470ac74693 | dba54235b4da9c1ef71020fb79eda385f8af03ad | /src/main/java/egovframework/com/cmm/service/impl/FileManageDAO.java | ba498263811b619b5ca057bfe7309091ddd92f55 | [] | no_license | ktyuzz/egov3.7_mybatis_jpa_springdatarest | a6f2227f897d598fa58baf990a9f7fc94d45777b | 52bcb3f6ffcdce2e99250470a947fee2d993dd44 | refs/heads/master | 2020-03-08T02:16:10.501891 | 2018-04-10T02:39:50 | 2018-04-10T02:39:50 | 127,854,527 | 10 | 4 | null | null | null | null | UTF-8 | Java | false | false | 4,204 | java | package egovframework.com.cmm.service.impl;
import java.util.Iterator;
import java.util.List;
import egovframework.com.cmm.service.FileVO;
import org.springframework.stereotype.Repository;
/**
* @Class Name : EgovFileMngDAO.java
* @Description : 파일정보 관리를 위한 데이터 처리 클래스
* @Modification Information
*
* 수정일 수정자 수정내용
* ------- ------- -------------------
* 2009. 3. 25. 이삼섭 최초생성
*
* @author 공통 서비스 개발팀 이삼섭
* @since 2009. 3. 25.
* @version
* @see
*
*/
@Repository("FileManageDAO")
public class FileManageDAO extends EgovComAbstractDAO {
/**
* 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다.
*
* @param fileList
* @return
* @throws Exception
*/
public String insertFileInfs(List<?> fileList) throws Exception {
FileVO vo = (FileVO) fileList.get(0);
String atchFileId = vo.getAtchFileId();
insert("FileManageDAO.insertFileMaster", vo);
Iterator<?> iter = fileList.iterator();
while (iter.hasNext()) {
vo = (FileVO) iter.next();
insert("FileManageDAO.insertFileDetail", vo);
}
return atchFileId;
}
/**
* 하나의 파일에 대한 정보(속성 및 상세)를 등록한다.
*
* @param vo
* @throws Exception
*/
public void insertFileInf(FileVO vo) throws Exception {
insert("FileManageDAO.insertFileMaster", vo);
insert("FileManageDAO.insertFileDetail", vo);
}
/**
* 여러 개의 파일에 대한 정보(속성 및 상세)를 수정한다.
*
* @param fileList
* @throws Exception
*/
public void updateFileInfs(List<?> fileList) throws Exception {
FileVO vo;
Iterator<?> iter = fileList.iterator();
while (iter.hasNext()) {
vo = (FileVO) iter.next();
insert("FileManageDAO.insertFileDetail", vo);
}
}
/**
* 여러 개의 파일을 삭제한다.
*
* @param fileList
* @throws Exception
*/
public void deleteFileInfs(List<?> fileList) throws Exception {
Iterator<?> iter = fileList.iterator();
FileVO vo;
while (iter.hasNext()) {
vo = (FileVO) iter.next();
delete("FileManageDAO.deleteFileDetail", vo);
}
}
/**
* 하나의 파일을 삭제한다.
*
* @param fvo
* @throws Exception
*/
public void deleteFileInf(FileVO fvo) throws Exception {
delete("FileManageDAO.deleteFileDetail", fvo);
}
/**
* 파일에 대한 목록을 조회한다.
*
* @param vo
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<FileVO> selectFileInfs(FileVO vo) throws Exception {
return selectList("FileManageDAO.selectFileList", vo);
}
/**
* 파일 구분자에 대한 최대값을 구한다.
*
* @param fvo
* @return
* @throws Exception
*/
public int getMaxFileSN(FileVO fvo) throws Exception {
return (Integer) selectOne("FileManageDAO.getMaxFileSN", fvo);
}
/**
* 파일에 대한 상세정보를 조회한다.
*
* @param fvo
* @return
* @throws Exception
*/
public FileVO selectFileInf(FileVO fvo) throws Exception {
return (FileVO) selectOne("FileManageDAO.selectFileInf", fvo);
}
/**
* 전체 파일을 삭제한다.
*
* @param fvo
* @throws Exception
*/
public void deleteAllFileInf(FileVO fvo) throws Exception {
update("FileManageDAO.deleteCOMTNFILE", fvo);
}
/**
* 파일명 검색에 대한 목록을 조회한다.
*
* @param vo
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<FileVO> selectFileListByFileNm(FileVO fvo) throws Exception {
return selectList("FileManageDAO.selectFileListByFileNm", fvo);
}
/**
* 파일명 검색에 대한 목록 전체 건수를 조회한다.
*
* @param fvo
* @return
* @throws Exception
*/
public int selectFileListCntByFileNm(FileVO fvo) throws Exception {
return (Integer) selectOne("FileManageDAO.selectFileListCntByFileNm", fvo);
}
/**
* 이미지 파일에 대한 목록을 조회한다.
*
* @param vo
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<FileVO> selectImageFileList(FileVO vo) throws Exception {
return selectList("FileManageDAO.selectImageFileList", vo);
}
}
| [
"[email protected]"
] | |
3b74796239a4b699cecefc04c7a411376088a400 | 873a4521bbd362f5988a3a0298f12447b5bf169a | /app/src/main/java/com/example/indoorlocalization/ParticleFilter.java | 1a4c3f89dcbaae5c5f16868b385b3372845caca9 | [] | no_license | MevFrank/Indoor_localization | 05ce656a5c76afd9c258c5ebac81eed561c5251c | 839c05eba730f37a90de6dd52d38f4027b0a427a | refs/heads/master | 2020-06-08T03:01:51.962418 | 2019-06-21T21:26:16 | 2019-06-21T21:26:16 | 193,147,230 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,484 | java | package com.example.indoorlocalization;
import android.graphics.PointF;
import java.util.Random;
public class ParticleFilter {
static Particle[] particles;
int numParticles = 0;
public int eliminateCount = 0;
private float xScale = 2613/48.99f; // x pixels per meter
private float yScale = 810/15.04f; // y pixels per meter
Random gen = new Random();
public ParticleFilter(int numParticles, PointF[] landmarks, int width, int height){
this.numParticles = numParticles;
particles = new Particle[numParticles];
for (int i = 0; i < numParticles; i++) {
particles[i] = new Particle(landmarks, width, height);
}
}
public void move(float turn, float forward) throws Exception {
for (int i = 0; i < numParticles; i++) {
particles[i].move(turn, forward);
}
}
void calNewProbability(Particle[] par){
double totalWeight = 0;
for (int i = 0; i < par.length; i++ ){
totalWeight += par[i].probability ;
}
for (int i = 0; i < par.length; i++ ){
par[i].probability = par[i].probability / totalWeight ;
}
}
void reSamp(Particle[] par) throws Exception {
calNewProbability(par);
Particle[] new_particles = new Particle[numParticles];
int x = 0;
double add = 0;
for (int i = 0; i < par.length; i++ ){
int y = (int) Math.round(par[i].probability * Double.valueOf(eliminateCount));
if (y == 0){ add = par[i].probability * Double.valueOf(eliminateCount); }
if (y > 0){
Double xx = Double.valueOf(y) + add;
y = Integer.valueOf(xx.toString());
for (int ii = 0; ii < y ; ii++ ) {
new_particles[x + ii].set(par[i].x, par[i].y, par[i].orientation, par[i].probability);
}
x += y;
new_particles[x].set(par[i].x, par[i].y, par[i].orientation, par[i].probability);
x += 1;
add = 0;
}
}
//Particle best = getBestParticle();
particles = new_particles;//new set of particles are generated
}
void eliminate() throws Exception {
int count= 0;
for (int i = 0; i < numParticles; i++) {
if (particles[i].x > 2.3f * xScale && particles[i].x <= 9.09f * xScale){
if (particles[i].y <= 9.0f * yScale || particles[i].y >= 14.04f * yScale ){
particles[i].set(particles[i].x, particles[i].y, particles[i].orientation,0.0);
count += 1;
}
}
if (particles[i].x > 9.09f * xScale && particles[i].x <= 16.84f* xScale ){
if (particles[i].y <= 9.0f * yScale || particles[i].y >= 10.65f * yScale ){
particles[i].set(particles[i].x, particles[i].y, particles[i].orientation, 0);
count += 1;
}
}
if (particles[i].x > 16.84f* xScale && particles[i].x <= 19.14f* xScale ){
if (particles[i].y <= 6.18f * yScale || particles[i].y >= 13.44f * yScale ){
particles[i].set(particles[i].x, particles[i].y, particles[i].orientation, 0);
count += 1;
}}
if (particles[i].x > 19.14f * xScale& particles[i].x <= 31.43f* xScale ){
if (particles[i].y <= 9.0f * yScale || particles[i].y >= 10.65f * yScale ){
particles[i].set(particles[i].x, particles[i].y, particles[i].orientation, 0);
count += 1;
}
}
if (particles[i].x > 31.43f * xScale || particles[i].x <= 2.3f * xScale ){
particles[i].set(particles[i].x, particles[i].y, particles[i].orientation, 0);
count += 1;
}
}
eliminateCount = count;
}
public Particle getBestParticle() {
Particle particle = particles[0];
for (int i = 1; i < numParticles; i++) {
if (particles[i].probability > particle.probability) {
particle = particles[i];
}
}
return particle;
}
private int circle(int i, int numParticles) {
while (i>numParticles - 1) {
i-= numParticles;
}
while (i < 0) {
i += numParticles;
}
return i;
}
}
| [
"[email protected]"
] | |
82467d34c79ad28d8993a74b482d4e6b515808e2 | 36073e09d6a12a275cc85901317159e7fffa909e | /nuxeo_nuxeo/modifiedFiles/2/fix/AnnotationFeature.java | 0a51e07b9849d9b9c4b6d761e583656e697d67f1 | [] | no_license | monperrus/bug-fixes-saner16 | a867810451ddf45e2aaea7734d6d0c25db12904f | 9ce6e057763db3ed048561e954f7aedec43d4f1a | refs/heads/master | 2020-03-28T16:00:18.017068 | 2018-11-14T13:48:57 | 2018-11-14T13:48:57 | 148,648,848 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,132 | java | package org.nuxeo.ecm.platform.annotations.repository.service;
import org.nuxeo.ecm.platform.test.PlatformFeature;
import org.nuxeo.runtime.api.Framework;
import org.nuxeo.runtime.test.runner.Deploy;
import org.nuxeo.runtime.test.runner.Features;
import org.nuxeo.runtime.test.runner.FeaturesRunner;
import org.nuxeo.runtime.test.runner.LocalDeploy;
import org.nuxeo.runtime.test.runner.SimpleFeature;
@Features(PlatformFeature.class)
@Deploy({ "org.nuxeo.ecm.platform.url.core", "org.nuxeo.ecm.relations.api", "org.nuxeo.ecm.relations",
"org.nuxeo.ecm.relations.jena", "org.nuxeo.ecm.platform.types.api", "org.nuxeo.ecm.platform.types.core",
"org.nuxeo.ecm.annotations", "org.nuxeo.ecm.annotations.contrib", "org.nuxeo.ecm.annotations.repository",
"org.nuxeo.ecm.annotations.repository.test", "org.nuxeo.runtime.jtajca", "org.nuxeo.runtime.datasource" })
@LocalDeploy({ "org.nuxeo.runtime.datasource:anno-ds.xml" })
public class AnnotationFeature extends SimpleFeature {
@Override
public void initialize(FeaturesRunner runner) {
Framework.addListener(new AnnotationsJenaSetup());
}
}
| [
"[email protected]"
] | |
2bf539244e85f892fef10f5f72d895e1b7d1e962 | f64b24556b8467051097a2e3d0c2084d609d94c6 | /src/servlet/PropertyServlet.java | ebbb8579b3e6f4c29616cc7e87dc043c2bf5cc3e | [] | no_license | miracleant/wechat | 90761b9454b90eb7b75f3bf1360c53d974c0f744 | 7b29f635886cd6bc314c09a511a843513d85345d | refs/heads/master | 2020-03-22T07:16:42.997217 | 2018-07-04T08:14:11 | 2018-07-04T08:14:11 | 139,690,588 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,427 | java | package servlet;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import bean.Category;
import bean.Property;
import util.Page;
public class PropertyServlet extends BaseBackServlet {
public String add(HttpServletRequest request, HttpServletResponse response, Page page) {
int cid = Integer.parseInt(request.getParameter("cid"));
Category c = categoryDAO.get(cid);
String name= request.getParameter("name");
Property p = new Property();
p.setCategory(c);
p.setName(name);
propertyDAO.add(p);
return "@admin_property_list?cid="+cid;
}
public String delete(HttpServletRequest request, HttpServletResponse response, Page page) {
int id = Integer.parseInt(request.getParameter("id"));
Property p = propertyDAO.get(id);
propertyDAO.delete(id);
return "@admin_property_list?cid="+p.getCategory().getId();
}
public String edit(HttpServletRequest request, HttpServletResponse response, Page page) {
int id = Integer.parseInt(request.getParameter("id"));
Property p = propertyDAO.get(id);
request.setAttribute("p", p);
return "admin/editProperty.jsp";
}
public String update(HttpServletRequest request, HttpServletResponse response, Page page) {
int cid = Integer.parseInt(request.getParameter("cid"));
Category c = categoryDAO.get(cid);
int id = Integer.parseInt(request.getParameter("id"));
String name= request.getParameter("name");
Property p = new Property();
p.setCategory(c);
p.setId(id);
p.setName(name);
propertyDAO.update(p);
return "@admin_property_list?cid="+p.getCategory().getId();
}
public String list(HttpServletRequest request, HttpServletResponse response, Page page) {
int cid = Integer.parseInt(request.getParameter("cid"));
Category c = categoryDAO.get(cid);
List<Property> ps = propertyDAO.list(cid, page.getStart(),page.getCount());
int total = propertyDAO.getTotal(cid);
page.setTotal(total);
page.setParam("&cid="+c.getId());
request.setAttribute("ps", ps);
request.setAttribute("c", c);
request.setAttribute("page", page);
return "admin/listProperty.jsp";
}
} | [
"[email protected]"
] | |
5ffe87ac2ebfe99a6d0c4f20e8b13450b5123f9d | b868286769251723a185c432c8d7dfec143af965 | /app/build/generated/source/buildConfig/debug/com/aim/BuildConfig.java | 2cea26f2b3a8e919ae6d3fa5d28fce35598da057 | [] | no_license | manojkumarr21/WeatherApp | f498490b4ddb26e99e0b1a9b29a6024079c49d01 | 5d7eb8d0464b790e59db05b9a1401fb1589b76bf | refs/heads/master | 2020-07-08T04:45:52.978688 | 2019-08-21T12:13:56 | 2019-08-21T12:13:56 | 203,568,490 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.aim;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.aim";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"manojkumartr21"
] | manojkumartr21 |
255e350fd9f3db47fc8c72baaa08fd9b9f4891a2 | 3de40896c4f99cff3ad5be818fb7b8bdd20476ad | /src/main/java/Item.java | 730678fa535ebae03a7893cba80a63a28a06595b | [] | no_license | glushko-v/servlet | bd5b91699da0aefeabbcb1676f371f229a1d6a9e | ce4d1fd31a81138d945e633de30ce7d841d2df18 | refs/heads/master | 2023-09-01T14:31:30.913339 | 2019-08-16T08:21:37 | 2019-08-16T08:21:37 | 196,356,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,723 | java | import com.fasterxml.jackson.annotation.JsonProperty;
import javax.persistence.*;
import java.util.Date;
import java.util.Objects;
@Entity
@Table(name = "ITEM")
public class Item {
private long id;
private String name;
private Date dateCreated;
private Date lastUpdatedDate;
private String description;
public Item(long id, String name, Date dateCreated, Date lastUpdatedDate, String description) {
this.id = id;
this.name = name;
this.dateCreated = dateCreated;
this.lastUpdatedDate = lastUpdatedDate;
this.description = description;
}
public Item() {
}
@JsonProperty("Number")
@Id
@Column(name = "ID")
@SequenceGenerator(name = "I_SEQ", sequenceName = "ITEM_SEQ", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "I_SEQ")
public long getId() {
return id;
}
@JsonProperty("Name")
@Column(name = "ITEM_NAME")
public String getName() {
return name;
}
@JsonProperty("Date Created")
@Column(name = "DATE_CREATED")
public Date getDateCreated() {
return dateCreated;
}
@JsonProperty("Date Updated")
@Column(name = "DATE_UPDATED")
public Date getLastUpdatedDate() {
return lastUpdatedDate;
}
@JsonProperty("Description")
@Column(name = "DESCRIPTION")
public String getDescription() {
return description;
}
public void setName(String name) {
this.name = name;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public void setLastUpdatedDate(Date lastUpdatedDate) {
this.lastUpdatedDate = lastUpdatedDate;
}
public void setDescription(String description) {
this.description = description;
}
public void setId(long id) {
this.id = id;
}
@Override
public String toString() {
return "id=" + id + " " + name + " " + dateCreated + " " + description;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Item item = (Item) o;
return name.equals(item.name) &&
dateCreated.getTime() == item.dateCreated.getTime() &&
lastUpdatedDate.getTime() == item.lastUpdatedDate.getTime() &&
// dateCreated.equals(item.dateCreated) &&
// lastUpdatedDate.equals(item.lastUpdatedDate) &&
description.equals(item.description);
}
@Override
public int hashCode() {
return Objects.hash(name, dateCreated, lastUpdatedDate, description);
}
}
| [
"[email protected]"
] | |
908c70f9bd8f4f8b4494d4293be83870fd5cfa38 | 7eb4e6bbd2733cbfcebc00021c5670c70a4706eb | /griddler/GriddlerBoard.java | eed1ec7afa8ca1ef432274578d2de6565cc15484 | [] | no_license | zaba258/puzzlies_griddlers | 98469c49854de12c2f50916615f1a7fa44b774c8 | 27578cae6df0d06ae71f4a619b9c0f3f24b1bb08 | refs/heads/master | 2020-04-08T20:38:02.166970 | 2011-04-06T13:04:19 | 2011-04-06T13:04:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,430 | java | package griddler;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.KeyboardFocusManager;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseMotionAdapter;
import java.lang.Math;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import javax.swing.Action;
import javax.swing.AbstractAction;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
import javax.swing.event.UndoableEditEvent;
import javax.swing.event.UndoableEditListener;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.undo.*;
import utils.MyPreferences;
import utils.Stopwatch;
import utils.TR;
/**
*
* @author zeroos
*/
public class GriddlerBoard extends JPanel{
private GriddlerData data;
private GriddlerStaticData editData;
private MyPreferences pref;
public Stopwatch stopwatch;
private UndoManager undoManager = new UndoManager();
private boolean paused = false;
public static final int SINGLE = 0;
public static final int BLOCK = 1;
public static final int LINE = 2;
//
int hlCol = -2;
int hlRow = -2;
int leftColorVal = 1;
int middleColorVal = -1;
int rightColorVal = 0;
int lastSelectedFieldX = 0;//the x coordinate of the last selected (clicked) field
int lastSelectedFieldY = 0;//the y coordinate of the last selected (clicked) field
int currentlySelectedFieldX = 0;//the x coordinate of the last selected (clicked) field
int currentlySelectedFieldY = 0;//the y coordinate of the last selected (clicked) field
boolean selectionInProgress = false;//the user is currently selecting fields (only if selectMode != SINGLE)
int paintingColor = 0;//what color we are currently painting with (makes sense only if selectionInProgress)
//
boolean editMode = false;
int selectMode = SINGLE;
EventListenerList changeListenerList = new EventListenerList();
EventListenerList hlChangeListenerList = new EventListenerList();
EventListenerList undoableEditListenerList = new EventListenerList();
AbstractAction finishAction;
//sizes
int fieldW;
int fieldH;
int offsetX;
int offsetY;
int gridOffsetX;
int gridOffsetY;
int linesOffsetX;
int linesOffsetY;
int gridW;
int gridH;
//colors
Color lineColor;
Color line5Color;
Color hlLineColor;
Color bgColor;
//actions
public Action undo = new AbstractAction(){
public void actionPerformed(ActionEvent e) {
undo();
}
};
public Action redo = new AbstractAction(){
public void actionPerformed(ActionEvent e) {
redo();
}
};
public Action nextSelectMode = new AbstractAction(){
public void actionPerformed(ActionEvent e){
nextSelectMode();
}
};
public GriddlerBoard(){
this(false);
}
public GriddlerBoard(boolean editMode){
this(new GriddlerStaticData(), null, editMode);
}
public GriddlerBoard(GriddlerData data){
this(data, null, false);
}
public GriddlerBoard(GriddlerData data, AbstractAction finishAction){
this(data, finishAction, false);
}
public GriddlerBoard(GriddlerData data, AbstractAction finishAction, boolean editMode){
this.data = data;
this.editMode = editMode;
this.finishAction = finishAction;
this.stopwatch = new Stopwatch();
this.stopwatch.start();
pref = MyPreferences.getInstance();
init();
}
public void calcGridSize(){
gridOffsetX = offsetX+(getData().getDesc().getLongestRow())*fieldW;
gridOffsetY = offsetY+(getData().getDesc().getLongestCol())*fieldH;
linesOffsetX = gridOffsetX;
linesOffsetY = gridOffsetY;
gridW = getData().getW()*fieldW;
gridH = getData().getH()*fieldH;
if(editMode){
gridOffsetX += fieldW;
gridOffsetY += fieldH;
//gridOffsetX = offsetX;
//gridOffsetY = offsetY;
linesOffsetX += 2*fieldW;
linesOffsetY += 2*fieldH;
}
revalidate();
}
protected void init(){
setOpaque(true);
lineColor = new Color(pref.getInt("lineColor", new Color(51,51,51).getRGB()));
line5Color = new Color(pref.getInt("line5Color", new Color(90,90,90).getRGB()));
hlLineColor = new Color(pref.getInt("hlLineColor", new Color(0xff, 0xff, 0x00).getRGB()));
bgColor = new Color(pref.getInt("bgColor", new Color (230,230,230).getRGB()));
setBackground(bgColor);
pref.addChangeListener(new ChangeListener(){
public void stateChanged(ChangeEvent e){
lineColor = new Color(pref.getInt("lineColor", new Color(0x66, 0x66, 0x66).getRGB()));
line5Color = new Color(pref.getInt("line5Color", new Color(0x00, 0x00, 0x00).getRGB()));
hlLineColor = new Color(pref.getInt("hlLineColor", new Color(0xff, 0xff, 0x00).getRGB()));
bgColor = new Color(pref.getInt("bgColor", new Color (0xcc,0xcc,0xcc).getRGB()));
setBackground(bgColor);
repaint();
}
});
fieldW = pref.getInt("fieldW", 20);
fieldH = pref.getInt("fieldH", 20);
offsetX = pref.getInt("offsetX", 0);
offsetY = pref.getInt("offsetY", 0);
calcGridSize();
//set shortcuts
final String shortcuts = pref.get("fields_shortcuts", "`1234567890qwertyuiopasdfghjkl");
for(int i=0; i<shortcuts.length(); i++){
getInputMap().put(KeyStroke.getKeyStroke(shortcuts.charAt(i)),
"shortcut");
}
Action action = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
shortcutPressed(shortcuts.indexOf(e.getActionCommand())-1);
}
};
getActionMap().put("shortcut", action);
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE,0),"undo"); //backspace for undo
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_Z,InputEvent.CTRL_MASK),"undo"); //ctrl+z for undo
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_Z,InputEvent.CTRL_MASK + InputEvent.SHIFT_MASK),"redo"); //ctrl+shift+z for redo
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_Y,InputEvent.CTRL_MASK),"redo"); //ctrl+y for redo
getActionMap().put("undo", undo);
getActionMap().put("redo", redo);
setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET);
setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET);
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0),"nextSelectMode"); //tab for nextSelectMode
getActionMap().put("nextSelectMode", nextSelectMode);
setListeners();
}
private void setListeners(){
//add listeners
addMouseMotionListener(new MouseAdapter() {
public void mouseMoved(MouseEvent e){
if(paused) return;
//set highlighted column and row, even when mouse is not over board
int x = e.getX()-gridOffsetX;
int y = e.getY()-gridOffsetY;
setHlCol((int)Math.floor((float)x/fieldW));
setHlRow((int)Math.floor((float)y/fieldH));
}
public void mouseDragged(MouseEvent e){
if(paused) return;
mouseMoved(e);
if( (e.getX() < gridOffsetX+gridW && e.getY() < gridOffsetY+gridH) &&
(e.getX() > gridOffsetX && e.getY() > gridOffsetY)){
//position of mouse in fields
final int x = (int)Math.floor((float)(e.getX()-gridOffsetX)/fieldW);
final int y = (int)Math.floor((float)(e.getY()-gridOffsetY)/fieldH);
if(x>=0 && y>=0){
final int prevFieldVal = getData().getFieldVal(x,y);
final int newFieldVal;
if((e.getModifiers()&e.BUTTON2_MASK) != 0){
newFieldVal = middleColorVal;
}else if((e.getModifiers()&e.BUTTON3_MASK) != 0){
newFieldVal = rightColorVal;
}else{//BUTTON1
newFieldVal = leftColorVal;
}
if(selectMode == BLOCK && currentlySelectedFieldX == x && currentlySelectedFieldY == y) repaint();
currentlySelectedFieldX = x;
currentlySelectedFieldY = y;
selectionInProgress = true;
if(newFieldVal == prevFieldVal) return;
if(selectMode == SINGLE){
//generate undoable event
fireUndoableEditEventOccured(new UndoableEditEvent(this,
new AbstractUndoableEdit(){
public void undo(){
super.undo();
getData().setFieldVal(prevFieldVal,x,y);
}
public void redo(){
super.redo();
getData().setFieldVal(newFieldVal,x,y);
}
})
);
//set field value
getData().setFieldVal(newFieldVal,x,y);
}
}
}
}
});
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e){
if(paused){
unpause();
return;
}
//only when mouse is over grid
if( (e.getX() < gridOffsetX+gridW && e.getY() < gridOffsetY+gridH) &&
(e.getX() > gridOffsetX && e.getY() > gridOffsetY)){
//position of mouse in fields
final int x = (int)Math.floor((float)(e.getX()-gridOffsetX)/fieldW);
final int y = (int)Math.floor((float)(e.getY()-gridOffsetY)/fieldH);
if(x>=0 && y>=0){
final int prevFieldVal = getData().getFieldVal(x,y);
final int newFieldVal;
if(e.getButton() == e.BUTTON2){
newFieldVal = middleColorVal;
}else if(e.getButton() == e.BUTTON3){
newFieldVal = rightColorVal;
}else{//BUTTON1
newFieldVal = leftColorVal;
}
lastSelectedFieldX = x;
lastSelectedFieldY = y;
paintingColor = newFieldVal;
if(newFieldVal == prevFieldVal) return;
//generate undoable event
fireUndoableEditEventOccured(new UndoableEditEvent(this,
new AbstractUndoableEdit(){
public void undo(){
super.undo();
getData().setFieldVal(prevFieldVal,x,y);
}
public void redo(){
super.redo();
getData().setFieldVal(newFieldVal,x,y);
}
})
);
//set field value
getData().setFieldVal(newFieldVal,x,y);
}
//only when mouse over desc rows
}else if(e.getX() > offsetX && e.getY() > gridOffsetY && e.getX() < gridOffsetX-(editMode?fieldW:0)){
//position of mouse in px
int x = e.getX()-offsetX;
int y = e.getY()-gridOffsetY;
//position of mouse in fields
x = (int)Math.floor((float)x/fieldW);
y = (int)Math.floor((float)y/fieldH);
try{
//in front of each line is a gap,
//due to that they should be moved
x-= getData().getDesc().getLongestRow()-getData().getDesc().getRow(y).size();
DescField f = getData().getDesc().getRow(y).get(x);
if(e.getButton() == e.BUTTON1){
setLeftColor(f.value);
if(e.getClickCount() == 2){
FieldsManager.getInstance((Window)getTopLevelAncestor(), getData(), f.value);
}
}else if(e.getButton() == e.BUTTON2){
setMiddleColor(f.value);
}else if(e.getButton() == e.BUTTON3){
setRightColor(f.value);
}
}catch(IndexOutOfBoundsException ex){
}
//only when mouse over desc cols
}else if(e.getX() > gridOffsetX && e.getY() > offsetY && e.getY() < gridOffsetY-(editMode?fieldH:0)){
//position of mouse in px
int x = e.getX()-gridOffsetX;
int y = e.getY()-offsetY;
//position of mouse in fields
x = (int)Math.floor((float)x/fieldW);
y = (int)Math.floor((float)y/fieldH);
try{
//in front of each line is a gap,
//due to that they should be moved
y-= getData().getDesc().getLongestCol()-getData().getDesc().getCol(x).size();
DescField f = getData().getDesc().getCol(x).get(y);
if(e.getButton() == e.BUTTON1){
setLeftColor(f.value);
if(e.getClickCount() == 2){
FieldsManager.getInstance((Window)getTopLevelAncestor(), getData(), f.value);
}
}else if(e.getButton() == e.BUTTON2)
setMiddleColor(f.value);
else if(e.getButton() == e.BUTTON3)
setRightColor(f.value);
}catch(IndexOutOfBoundsException ex){
}
}else if(editMode){
if(e.getX() > gridOffsetX-fieldW &&
e.getX() < gridOffsetX+gridW+fieldW &&
e.getY() > gridOffsetY &&
e.getY() < gridOffsetY+gridH){
//add new col area
if(e.getX() < gridOffsetX){
//at the front
getData().addLeftCol();
}else{
//at the end
getData().addRightCol();
}
}else if(e.getX() > gridOffsetX &&
e.getX() < gridOffsetX+gridW &&
e.getY() > gridOffsetY-fieldH &&
e.getY() < gridOffsetY+gridH+fieldH){
//add new row area
if(e.getY() < gridOffsetY){
//at the front
getData().addTopRow();
}else{
//at the end
getData().addBottomRow();
}
}
}
}
public void mouseReleased(MouseEvent e){
if(selectMode == BLOCK && selectionInProgress){
//undo(); //mouse was pressed one time and we have to undo it
final int startX = currentlySelectedFieldX < lastSelectedFieldX?currentlySelectedFieldX:lastSelectedFieldX;
final int startY = currentlySelectedFieldY < lastSelectedFieldY?currentlySelectedFieldY:lastSelectedFieldY;
final int endX = currentlySelectedFieldX > lastSelectedFieldX?currentlySelectedFieldX:lastSelectedFieldX;
final int endY = currentlySelectedFieldY > lastSelectedFieldY?currentlySelectedFieldY:lastSelectedFieldY;
final int prevColor = paintingColor;
int[][] tempGrid = new int[getData().getW()][getData().getH()];
for(int x=startX; x<=endX; x++){
for(int y=startY; y<=endY; y++){
tempGrid[x][y] = getData().getFieldVal(x,y);
getData().setFieldVal(paintingColor, x,y);
}
}
final int[][] prevGrid = tempGrid;
AbstractUndoableEdit edit = new AbstractUndoableEdit(){
public void undo(){
super.undo();
for(int x=startX; x<=endX; x++){
for(int y=startY; y<=endY; y++){
getData().setFieldVal(prevGrid[x][y], x,y);
}
}
}
public void redo(){
super.redo();
for(int x=startX; x<=endX; x++){
for(int y=startY; y<=endY; y++){
getData().setFieldVal(prevColor, x,y);
}
}
}
};
fireUndoableEditEventOccured(new UndoableEditEvent(this, edit));
}
selectionInProgress = false;
}
});
addGriddlerDataListenerToData(data);
}
private void addGriddlerDataListenerToData(GriddlerData d){
d.addGriddlerDataListener(new GriddlerDataListener(){
public void fieldChanged(int x, int y){
if(x==-1){
calcGridSize();
repaint();
}else repaint(gridOffsetX+x*fieldW, gridOffsetY+y*fieldH, fieldW, fieldH);
}
public void fieldsListChanged(){
repaint();
}
public void descChanged(){
//reinit!
calcGridSize();
repaint();
}
public void boardFinished(){
if(finishAction != null) finishAction.actionPerformed(new ActionEvent(this, 0, ""));
}
});
}
int shortcutPrevColor = -3; //what color was on previous position
int shortcutLastColor = -3; //what shortcut was previously pressed
int shortcutCounter = 0;
long shortcutLastTime = 0;
public void shortcutPressed(int colorNum){
long timeNow = Calendar.getInstance().getTimeInMillis();
final int max_delay = 1000;
if(timeNow-shortcutLastTime < max_delay && shortcutLastColor == colorNum){
//multiple clicks
shortcutCounter++;
if(shortcutCounter%3 == 0){//foutrh click
setRightColor(shortcutPrevColor);
shortcutPrevColor = getLeftColorVal();
setLeftColor(colorNum);
}else if(shortcutCounter%3 == 1){//double click
setLeftColor(shortcutPrevColor);
shortcutPrevColor = getMiddleColorVal();
setMiddleColor(colorNum);
}else if(shortcutCounter%3 == 2){//triple click
setMiddleColor(shortcutPrevColor);
shortcutPrevColor = getRightColorVal();
setRightColor(colorNum);
}
}else{
//single click
shortcutPrevColor = getLeftColorVal();
setLeftColor(colorNum);
shortcutCounter = 0;
}
shortcutLastTime = timeNow;
shortcutLastColor = colorNum;
}
public void addHlChangeListener(ChangeListener l){
hlChangeListenerList.add(ChangeListener.class, l);
}
public void removeHlChangeListener(ChangeListener l){
hlChangeListenerList.remove(ChangeListener.class, l);
}
public void fireHlChange(){
ChangeListener listeners[] =
hlChangeListenerList.getListeners(ChangeListener.class);
for(ChangeListener l: listeners){
l.stateChanged(new ChangeEvent(this));
}
}
public void addChangeListener(ChangeListener l){
changeListenerList.add(ChangeListener.class, l);
}
public void removeChangeListener(ChangeListener l){
changeListenerList.remove(ChangeListener.class, l);
}
public void fireChange(){
ChangeListener listeners[] =
changeListenerList.getListeners(ChangeListener.class);
for(ChangeListener l: listeners){
l.stateChanged(new ChangeEvent(this));
}
}
public void addUndoableEditListener(UndoableEditListener l){
undoableEditListenerList.add(UndoableEditListener.class, l);
}
public void removeUndoableEditListener(UndoableEditListener l){
undoableEditListenerList.remove(UndoableEditListener.class, l);
}
public void fireUndoableEditEventOccured(UndoableEditEvent e){
undoManager.addEdit(e.getEdit());
UndoableEditListener listeners[] =
undoableEditListenerList.getListeners(UndoableEditListener.class);
for(UndoableEditListener l: listeners){
l.undoableEditHappened(e);
}
}
public int getLeftColorVal(){
return leftColorVal;
}
public int getMiddleColorVal(){
return middleColorVal;
}
public int getRightColorVal(){
return rightColorVal;
}
public void setLeftColor(int c){
if(c<getData().getFields().length && c>-2){
fireChange();
leftColorVal = c;
}
}
public void setMiddleColor(int c){
if(c<getData().getFields().length && c>-2){
fireChange();
middleColorVal = c;
}
}
public void setRightColor(int c){
if(c<getData().getFields().length && c>-2){
fireChange();
rightColorVal = c;
}
}
public void setFieldW(int w){
fieldW = w;
calcGridSize();
repaint();
}
public void setFieldH(int h){
fieldH = h;
calcGridSize();
repaint();
}
public void setSelectMode(int s){
selectMode = s;
fireChange();
}
public int getSelectMode(){
return selectMode;
}
public void nextSelectMode(){
setSelectMode((getSelectMode()+1)%LINE);
}
public GriddlerData getData(){
if(!editMode){
return data;
}else{
return editData;
}
}
public void setEditData(GriddlerData gd){
if(gd == null){
setEditMode(false);
editData = null;
}else{
editData = new GriddlerStaticData();
editData.setDesc(data.getDesc());
editData.setFields(gd.getFieldsAsArrayList());
int[][] oldGrid = gd.getGrid();
int[][] newGrid = new int[oldGrid.length][oldGrid[0].length];
for(int x=0; x<oldGrid.length; x++){
for(int y=0; y<oldGrid[0].length; y++){
newGrid[x][y] = oldGrid[x][y];
}
}
editData.setGrid(newGrid);
editData.crop(data.getW(), data.getH());
for(GriddlerDataListener listener: gd.getGriddlerDataListeners()){
editData.addGriddlerDataListener(listener);
}
}
}
public void setData(GriddlerData gd){
setEditMode(false);
setEditData(null);
for(GriddlerDataListener listener: data.getGriddlerDataListeners()){
gd.addGriddlerDataListener(listener);
}
data = gd;
calcGridSize();
repaint();
revalidate();
}
public int getHlRow(){
return hlRow;
}
public int getHlCol(){
return hlCol;
}
public void setHlCol(int n){
//repaint previous area
if(hlCol == n) return;
if(hlCol != -2) repaint(gridOffsetX+hlCol*fieldW-1, offsetY, fieldW+3, 1+gridH+gridOffsetY+(editMode?fieldW:0));
if(n < 0 || n >= getData().getW()) hlCol = -2;
else{
hlCol = n;
//repaint new area
repaint(gridOffsetX+hlCol*fieldW-1, offsetY, fieldW+3, 1+gridH+gridOffsetY+(editMode?fieldW:0));
}
fireHlChange();
}
public void setHlRow(int n){
//repaint previous area
if(hlRow == n) return;
if(hlRow != -2) repaint(offsetX, gridOffsetY+hlRow*fieldH-1, 1+gridW+gridOffsetX+(editMode?fieldH:0), gridH+3);
if(n < 0 || n >= getData().getH()) hlRow = -2;
else{
hlRow = n;
//repaint new area
repaint(offsetX, gridOffsetY+hlRow*fieldH-1, gridW+gridOffsetX+(editMode?fieldH:0), gridH+3);
}
fireHlChange();
}
public void setEditMode(boolean editMode){
this.editMode = editMode;
if(editMode && editData == null){
setEditData(data);
}
if(!editMode && editData != null){
//if going to normal mode from edit mode
data.setDesc(editData.getDesc());
data.crop(editData.getW(), editData.getH());
}
calcGridSize();
repaint();
revalidate();
}
public boolean getEditMode(){
return this.editMode;
}
protected void paintComponent(Graphics g){
super.paintComponent(g);
if(!paused){
paintGrid(g);
paintDesc((Graphics2D)g);
paintLines(g);
}else{
paintPauseMsg(g);
}
}
protected void paintGrid(Graphics g){
for(int y=0; y<getData().getH(); y++){
for(int x=0; x<getData().getW(); x++){
Field f;
if(selectMode == BLOCK && selectionInProgress){
if(((x >= lastSelectedFieldX && x <= currentlySelectedFieldX) ||
(x <= lastSelectedFieldX && x >= currentlySelectedFieldX)) &&
((y >= lastSelectedFieldY && y <= currentlySelectedFieldY) ||
(y <= lastSelectedFieldY && y >= currentlySelectedFieldY))){
f = getData().getField(paintingColor);
}else{
f = getData().getField(x,y, !editMode);
}
}else{
f = getData().getField(x,y, !editMode);
}
f.paint(g,
gridOffsetX+x*fieldW,
gridOffsetY+y*fieldH,
fieldW,
fieldH
);
}
}
}
protected void paintDesc(Graphics2D g){
Color descColor = new Color(pref.getInt("descColor", new Color(0x00, 0x00, 0x00).getRGB()));
int descOffsetY;
int descOffsetX;
if(editMode){
descOffsetY = this.gridOffsetY - fieldH;
descOffsetX = this.gridOffsetX - fieldW;
}else{
descOffsetY = this.gridOffsetY;
descOffsetX = this.gridOffsetX;
}
for(int x=0; x<getData().getDesc().getColsSize(); x++){
int lineStart = descOffsetY-getData().getDesc().getCol(x).size()*fieldH;
int linePos = descOffsetX+x*fieldW;
if(editMode) linePos += fieldW;
for(int y=0; y<getData().getDesc().getCol(x).size(); y++){
DescField f = getData().getDesc().getCol(x).get(y);
Field field;
try{
field = getData().getField(f.value);
}catch(IndexOutOfBoundsException e){
field = getData().getField(0);
}
f.paint(g, field, linePos, lineStart+y*fieldH, fieldW, fieldH);
g.setColor(lineColor);
g.drawLine(linePos,
lineStart+fieldH*y,
linePos+fieldW,
lineStart+fieldH*y);
}
}
for(int y=0; y<getData().getDesc().getRowsSize(); y++){
int lineStart = descOffsetX-getData().getDesc().getRow(y).size()*fieldW;
int linePos = descOffsetY+y*fieldH;
if(editMode) linePos += fieldH;
for(int x=0; x<getData().getDesc().getRow(y).size(); x++){
DescField f = getData().getDesc().getRow(y).get(x);
Field field;
try{
field = getData().getField(f.value);
}catch(IndexOutOfBoundsException e){
field = getData().getField(0);
}
f.paint(g, field, lineStart+x*fieldW, linePos, fieldW, fieldH);
g.setColor(lineColor);
g.drawLine(lineStart+fieldW*x,
linePos,
lineStart+fieldW*x,
linePos+fieldH);
}
}
}
protected void paintLines(Graphics g){
g.setColor(lineColor);
//draw border
//left
g.drawLine( gridOffsetX-(editMode?fieldW:0),
gridOffsetY,
gridOffsetX-(editMode?fieldW:0),
gridOffsetY+gridH);
//right
g.drawLine( gridOffsetX+gridW+(editMode?fieldW:0),
gridOffsetY,
gridOffsetX+gridW+(editMode?fieldW:0),
gridOffsetY+gridH);
//bottom
g.drawLine( gridOffsetX,
gridOffsetY+gridH+(editMode?fieldH:0),
gridOffsetX+gridW,
gridOffsetY+gridH+(editMode?fieldH:0));
//top
g.drawLine( gridOffsetX,
gridOffsetY-(editMode?fieldH:0),
gridOffsetX+gridW,
gridOffsetY-(editMode?fieldH:0));
//draw grid
g.setColor(lineColor);
int prevLineL = 0;
for(int y=0; y<=getData().getH(); y++){
//horizontal lines
int lineL;
//count line length
if(y!=getData().getH()){
try{
lineL = getData().getDesc().getRow(y).size();
}catch(IndexOutOfBoundsException e){
lineL = 0;
}
if(editMode) lineL += 2;
}else{
lineL = prevLineL;
}
//draw line
if(y%5==0) g.setColor(line5Color);
g.drawLine( linesOffsetX-(prevLineL>lineL?prevLineL:lineL)*fieldW,
gridOffsetY+y*fieldH,
linesOffsetX+getData().getW()*fieldW,
gridOffsetY+y*fieldH);
if(y%5==0){
g.drawLine( linesOffsetX-(prevLineL>lineL?prevLineL:lineL)*fieldW,
gridOffsetY+y*fieldH+1,
linesOffsetX+getData().getW()*fieldW,
gridOffsetY+y*fieldH+1);
g.setColor(lineColor);
}
prevLineL = lineL;
}
prevLineL = 0;
for(int x=0; x<=getData().getW(); x++){
//vertical lines
int lineL;
if(x!=getData().getW()){
try{
lineL = getData().getDesc().getCol(x).size();
}catch(IndexOutOfBoundsException e){
lineL = 0;
}
if(editMode) lineL += 2;
}else{
lineL = prevLineL;
}
if(x%5==0) g.setColor(line5Color);
g.drawLine( gridOffsetX+x*fieldW,
linesOffsetY-(prevLineL>lineL?prevLineL:lineL)*fieldH,
gridOffsetX+x*fieldW,
linesOffsetY+getData().getH()*fieldH);
prevLineL = lineL;
if(x%5==0){
g.drawLine( gridOffsetX+x*fieldW+1,
linesOffsetY-(prevLineL>lineL?prevLineL:lineL)*fieldH,
gridOffsetX+x*fieldW+1,
linesOffsetY+getData().getH()*fieldH);
g.setColor(lineColor);
}
}
//draw highlighted lines
g.setColor(hlLineColor);
int lineL;
if(hlRow>=0){
try{
lineL = getData().getDesc().getRow(hlRow).size();
}catch(IndexOutOfBoundsException e){
lineL = 0;
}
if(editMode) lineL += 2;
g.fillRect( linesOffsetX-lineL*fieldW,
gridOffsetY+hlRow*fieldH,
gridW+lineL*fieldW+1,
1);
g.fillRect( linesOffsetX-lineL*fieldW,
gridOffsetY+(hlRow+1)*fieldH,
gridW+lineL*fieldW+1,
1);
}
if(hlCol>=0){
try{
lineL = getData().getDesc().getCol(hlCol).size();
}catch(IndexOutOfBoundsException e){
lineL = 0;
}
if(editMode) lineL += 2;
g.fillRect( gridOffsetX+hlCol*fieldW,
linesOffsetY-lineL*fieldH,
1,
gridH+lineL*fieldH+1);
g.fillRect( gridOffsetX+(hlCol+1)*fieldW,
linesOffsetY-lineL*fieldH,
1,
gridH+lineL*fieldH+1);
}
}
public void paintPauseMsg(Graphics g){
g.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 20));
g.drawString(TR.t("PAUSED"), 20, 30);
g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 15));
g.drawString(TR.t("Click anywhere on the board to unpause."), 20, 60);
}
public void pause(){
paused = true;
stopwatch.pause();
repaint();
}
public void unpause(){
stopwatch.start();
paused = false;
repaint();
}
public void togglePause(){
if(paused) unpause();
else pause();
}
public boolean canUndo(){
return undoManager.canUndo();
}
public void undo(){
if(canUndo()) undoManager.undo();
}
public boolean canRedo(){
return undoManager.canRedo();
}
public void redo(){
if(canRedo()) undoManager.redo();
}
public Dimension getPreferredSize(){
return new Dimension(gridOffsetX+gridW+(editMode?fieldW:0),gridOffsetY+gridH+(editMode?fieldH:0));
}
public Dimension getMinimumSize(){
return getPreferredSize();
}
}
| [
"[email protected]"
] | |
055cb74bcc8be5a28e6d9f26ebff8d9a67dbd070 | bfc13295a4f4042c641d3836b5a41095c8b6aaa1 | /src/main/java/com/example/demo/services/CountriesService.java | 44270292e7afca04b692cf3d993655fb063be43c | [] | no_license | harilearning1989/SpringRestOracleDemo | cca350b3976383bb925f69562097a73e6412f4f5 | d6a14cc135a3192feeb43fb70e2e57482e2c5f60 | refs/heads/master | 2023-04-28T03:17:36.259382 | 2021-05-13T03:05:37 | 2021-05-13T03:05:37 | 330,617,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 513 | java | package com.example.demo.services;
import com.example.demo.entity.CountriesEntity;
import com.example.demo.repos.ICountriesRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class CountriesService implements ICountriesService{
@Autowired
private ICountriesRepository iCountriesRepository;
@Override
public Iterable<CountriesEntity> getAllCountries() {
return iCountriesRepository.findAll();
}
}
| [
"[email protected]"
] | |
9996a8251444490f207ca759d3a9e4d6268f1890 | fc28e959f0febe59fd31751f6bd583544637b18c | /cloud-consumer-feign-hystrix-order80/src/main/java/com/suave/cloud/service/PaymentHystrixService.java | 2bdb3c68285f40a06fbb8f765065eb7d5a8162d0 | [] | no_license | suavess/cloud2020 | 36f0401a092b8d9c8d88b63e2978676336c1d2a7 | 7d70421cb53381be0751a39fc36ca8c2034bb0fd | refs/heads/master | 2023-03-01T15:13:01.393832 | 2021-01-22T09:38:18 | 2021-01-22T09:38:18 | 325,509,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 674 | java | package com.suave.cloud.service;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
/**
* @author Suave
* @date 2021/1/11 11:55
*/
@Component
@FeignClient(value = "CLOUD-PAYMENT-HYSTRIX-SERVICE", fallback = PaymentFallbackService.class)
public interface PaymentHystrixService {
@GetMapping("/payment/hystrix/ok/{id}")
String paymentInfoOk(@PathVariable("id") Integer id);
@GetMapping("/payment/hystrix/timeout/{id}")
String paymentInfoTimeout(@PathVariable("id") Integer id);
}
| [
"[email protected]"
] | |
6dfeeaf51dbe222fb7557cc3badb7d12a96e2237 | afd69dc79e1a57922f211026d34e28c71c4c0ed0 | /eduAssistant/security/src/main/java/ro/unitbv/eduassistant/config/sec/JwtAuthenticationTokenFilter.java | 505ead432299d62ae488d3e71533330cd0f81d6b | [] | no_license | VladFernoaga/eduAssistant | 568629e98ba0d254be93bb59db90ad7ed26d70a1 | 10227fe905b569643f39eba60bf5c2639cf01d23 | refs/heads/master | 2023-07-02T05:56:58.361019 | 2021-08-03T09:35:55 | 2021-08-03T09:35:55 | 114,674,238 | 0 | 5 | null | null | null | null | UTF-8 | Java | false | false | 2,786 | java | package ro.unitbv.eduassistant.config.sec;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.web.filter.OncePerRequestFilter;
public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
private final Log logger = LogFactory.getLog(this.getClass());
@Autowired
private UserDetailsService userDetailsService;
@Autowired
private JwtTokenUtil jwtTokenUtil;
@Value("${jwt.header}")
private String tokenHeader;
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
FilterChain chain) throws ServletException, IOException {
String authToken = request.getHeader(this.tokenHeader);
if (authToken != null && authToken.startsWith("Bearer ")) {
authToken = authToken.substring(7);
}
String username = jwtTokenUtil.getUsernameFromToken(authToken);
// logger.info("export authentication for user " + username);
if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
// It is not completely necessary to load the user details from the database. You could also
// store the information in the token and read it from it. It's up to you ;)
UserDetails userDetails = this.userDetailsService.loadUserByUsername(username);
// For simple validation it is completely sufficient to just check the token integrity. You don't have to call
// the database compellingly. Again it's up to you ;)
if (jwtTokenUtil.validateToken(authToken, userDetails)) {
UsernamePasswordAuthenticationToken authentication =
new UsernamePasswordAuthenticationToken(userDetails, null,
userDetails.getAuthorities());
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
logger.debug("authenticated user " + username + ", setting security context");
SecurityContextHolder.getContext().setAuthentication(authentication);
}
}
chain.doFilter(request, response);
}
}
| [
"[email protected]"
] | |
97683b756729bc333def871ca1271b3f86b3a020 | bc1ccd0bdd54eff50875328c56beaf3b51a64748 | /CoordinateGuiWidgetCore/src/main/java/org/snobot/coordinate_gui/shuffleboard/data/PurePursuitDataType.java | f99594d92c53993b2575623784aec0c765e033ec | [
"MIT"
] | permissive | snobotsim/CoordinateGui | 76f612144c3720da7cbefcbd35762c288b88b94a | 8ffe6f8e1bf35a9960f08c5f922b5e9f67508131 | refs/heads/master | 2023-01-20T11:43:00.670320 | 2022-02-27T06:18:09 | 2022-02-27T06:18:09 | 236,128,123 | 1 | 0 | MIT | 2022-02-27T06:18:09 | 2020-01-25T05:06:43 | Java | UTF-8 | Java | false | false | 808 | java | package org.snobot.coordinate_gui.shuffleboard.data;
import java.util.Map;
import java.util.function.Function;
import edu.wpi.first.shuffleboard.api.data.ComplexDataType;
public final class PurePursuitDataType extends ComplexDataType<PurePursuitData>
{
public static final PurePursuitDataType INSTANCE = new PurePursuitDataType();
public static final String NAME = SmartDashboardNames.sPURE_PERSUIT_TABLE_TYPE;
private PurePursuitDataType()
{
super(NAME, PurePursuitData.class);
}
@Override
public Function<Map<String, Object>, PurePursuitData> fromMap()
{
return map ->
{
return new PurePursuitData(map);
};
}
@Override
public PurePursuitData getDefaultValue()
{
return new PurePursuitData();
}
}
| [
"[email protected]"
] | |
bb8e98d95e417243224a604f72e4804a85c0998b | 8fd28d1861362f3d2381f598b919aff6c62a3b43 | /src/main/java/com/isi/znd/kra/controller/VoteController.java | 627106af52389df11cd9543d4d31c2c2f29d5555 | [] | no_license | ImedZnd/spring-reddit-clone | f6a85c22874209a76bd0ef572fd66fc277765a2d | a469548ee432dc5262d15f396cfa5f7e11cca71b | refs/heads/master | 2023-04-26T19:05:18.451771 | 2021-05-12T23:46:06 | 2021-05-12T23:46:06 | 365,250,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 702 | java | package com.isi.znd.kra.controller;
import com.isi.znd.kra.dto.VoteDto;
import com.isi.znd.kra.service.VoteService;
import lombok.AllArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/votes/")
@AllArgsConstructor
@CrossOrigin(origins = "http://localhost:4200")
public class VoteController {
private final VoteService voteService;
@PostMapping
public ResponseEntity<Void> vote(@RequestBody VoteDto voteDto) {
System.out.println(voteDto);
voteService.vote(voteDto);
return new ResponseEntity<>(HttpStatus.OK);
}
} | [
"[email protected]"
] | |
ff0086b63960000c598a53969b1a6d0e8984562e | 3621e884123f260364f7110d01b8db341ae3c633 | /src/main/java/com/ads/voteapi/domain/repositories/SessionRepository.java | 61eaed2bd0439aeadd6847de7b6b68e7b6ff3a20 | [] | no_license | AndersonSAndrade/vote-api | 47fbb98fb1d4e4ee26684553df812fe20fcb9719 | cfb73360aa8ff4eab4c45bb30c02556fe9eea2f7 | refs/heads/developer | 2023-09-06T10:21:41.691993 | 2021-11-19T17:28:40 | 2021-11-19T17:28:40 | 428,698,517 | 1 | 1 | null | 2022-04-26T01:56:58 | 2021-11-16T14:56:16 | Java | UTF-8 | Java | false | false | 793 | java | package com.ads.voteapi.domain.repositories;
import com.ads.voteapi.domain.entity.Session;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
/**
* @author : Anderson S. Andrade
* @since : 18/11/21, quinta-feira
**/
public interface SessionRepository extends JpaRepository<Session, Long> {
@Modifying
@Transactional
@Query(" update Session s set s.status=:status where s.id=:id ")
void hasClosedSession(@Param("id") Long id, @Param("status") Integer status);
Session findByIdAndAndScheduleId(Long id, Long scheduleId);
}
| [
"[email protected]"
] | |
3e3bc2af068573d138b5852c6fbeb57336183f5e | a2e3bc957b7c6ec667b116da90a2b5d5329a4b0e | /app/src/androidTest/java/com/example/administrator/expandablelistview/ExampleInstrumentedTest.java | 2b72d93804ed54c58de5301755de2b6cfc7bd2b1 | [] | no_license | dixingkang/ExpandableListView | 9e969742c0fb9498f731363be6c6fbae20beefd0 | 4f84cff7e3318f27aa9cdc6f788be46a8d96da72 | refs/heads/master | 2020-12-24T09:38:03.013033 | 2016-11-09T11:05:39 | 2016-11-09T11:05:39 | 73,276,842 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 792 | java | package com.example.administrator.expandablelistview;
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.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.administrator.expandablelistview", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
0248c94224487bb4e150e89660e9f2628da18662 | d008ae59622e50b63f0607e2f41c2b79b2316a82 | /src/main/java/com/github/savitoh/centralerroapi/seguranca/AutenticacaoJwtEntryPoint.java | 27a91abb4e454d5e7018df0a17d1af775c3150d5 | [] | no_license | savitoh/central-erro-api-codenation-acelera-dev-java | 05a323f286a34fa4b96ed04dc4476425679752d7 | f32afa54589dd93bdaa4cdbb04dfcce676a5bf7b | refs/heads/master | 2023-03-28T04:00:04.885333 | 2021-03-28T06:27:21 | 2021-03-28T06:27:21 | 282,643,467 | 0 | 0 | null | 2021-03-28T06:27:22 | 2020-07-26T12:17:36 | Java | UTF-8 | Java | false | false | 1,888 | java | package com.github.savitoh.centralerroapi.seguranca;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.github.savitoh.centralerroapi.exception.payload.ApiErrorResponsePayload;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class AutenticacaoJwtEntryPoint implements AuthenticationEntryPoint {
private static final Logger logger = LoggerFactory.getLogger(AutenticacaoJwtEntryPoint.class);
private final ObjectMapper objectMapper;
public AutenticacaoJwtEntryPoint() {
objectMapper = new ObjectMapper();
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
}
@Override
public void commence(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse,
AuthenticationException e) throws IOException, ServletException {
logger.error("Um acesso não autorizado foi verificado. Mensagem: {}", e.getMessage());
httpServletResponse.setStatus(HttpStatus.UNAUTHORIZED.value());
final var apiErrorResponsePayload = new ApiErrorResponsePayload(e.getMessage(), HttpStatus.UNAUTHORIZED);
httpServletResponse.getOutputStream()
.println(objectMapper.writeValueAsString(apiErrorResponsePayload));
httpServletResponse.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
}
}
| [
"[email protected]"
] | |
70f0ce3a8f0b25b2614305c024348eb817c3ad24 | 704e2fcb9b900617815203c3373b24b2fe3757e4 | /app/src/main/java/com/mondiamedia/ahmedbadr/githubreopos/views/activities/MainActivity.java | f2cefd4bb2f76a4f0fd97ed9385183ee8a1afd98 | [] | no_license | AhmedBadrSayed/GitHub-Repos | 0644d0044b606520d3a79fc3f4f703df25e6c6db | 926358012c4dfc6f735bd9b0904c1e7dad149bf7 | refs/heads/master | 2021-02-28T05:51:15.777521 | 2020-03-13T20:49:07 | 2020-03-13T20:49:07 | 245,667,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,737 | java | package com.mondiamedia.ahmedbadr.githubreopos.views.activities;
import android.arch.lifecycle.Observer;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.mondiamedia.ahmedbadr.githubreopos.Application;
import com.mondiamedia.ahmedbadr.githubreopos.R;
import com.mondiamedia.ahmedbadr.githubreopos.databinding.ActivityMainBinding;
import com.mondiamedia.ahmedbadr.githubreopos.databinding.ContentMainBinding;
import com.mondiamedia.ahmedbadr.githubreopos.models.GitRepo;
import com.mondiamedia.ahmedbadr.githubreopos.view_models.RepositoriesViewModel;
import com.mondiamedia.ahmedbadr.githubreopos.views.adapters.ReposRecyclerViewAdapter;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
public class MainActivity extends AppCompatActivity {
ActivityMainBinding mActivityMainBinding;
ContentMainBinding mContentMainBinding;
@Inject
public RepositoriesViewModel mRepositoriesViewModel;
private Observer<List<GitRepo>> mLiveDataObserver;
private ReposRecyclerViewAdapter mReposRecyclerViewAdapter;
private List<GitRepo> mReposList = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
((Application) getApplicationContext()).applicationComponent.inject(this);
super.onCreate(savedInstanceState);
mActivityMainBinding = DataBindingUtil.setContentView(this, R.layout.activity_main);
mContentMainBinding = DataBindingUtil.setContentView(this, R.layout.content_main);
setSupportActionBar(mActivityMainBinding.toolbar);
initViews();
}
private void initViews() {
startShimmerEffect();
setupReposRecyclerView();
mLiveDataObserver = listLiveData -> {
stopShimmerEffect();
mContentMainBinding.swipeContainer.setRefreshing(false);
mReposList.clear();
if (listLiveData == null) {
mContentMainBinding.reposRecyclerView.setVisibility(View.GONE);
mContentMainBinding.emptyViewLayout.setVisibility(View.VISIBLE);
return;
}
mReposList.addAll(listLiveData);
mReposRecyclerViewAdapter.notifyDataSetChanged();
mContentMainBinding.reposRecyclerView.setVisibility(View.VISIBLE);
mContentMainBinding.emptyViewLayout.setVisibility(View.GONE);
};
mRepositoriesViewModel.init();
getAndBindTrendingRepos();
mContentMainBinding.swipeContainer.setOnRefreshListener(() -> {
startShimmerEffect();
mContentMainBinding.reposRecyclerView.setVisibility(View.GONE);
refreshedRepos();
});
}
void startShimmerEffect() {
mContentMainBinding.shimmerFrameLayout.startShimmer();
mContentMainBinding.shimmerFrameLayout.setVisibility(View.VISIBLE);
}
void stopShimmerEffect() {
mContentMainBinding.shimmerFrameLayout.stopShimmer();
mContentMainBinding.shimmerFrameLayout.setVisibility(View.GONE);
}
private void setupReposRecyclerView() {
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
mContentMainBinding.reposRecyclerView.setLayoutManager(layoutManager);
mReposRecyclerViewAdapter = new ReposRecyclerViewAdapter(mReposList, this);
mContentMainBinding.reposRecyclerView.setAdapter(mReposRecyclerViewAdapter);
}
private void getAndBindTrendingRepos() {
mRepositoriesViewModel.getRepos().observe(this, mLiveDataObserver);
}
public void refreshedRepos(View view) {
refreshedRepos();
}
private void refreshedRepos() {
mRepositoriesViewModel.refreshRepos().observe(this, mLiveDataObserver);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"ahmed.badr@mondiamedia"
] | ahmed.badr@mondiamedia |
0e33acd590ed7fc6edf9ac4c6e19fbd6355c402c | a5a3dee556a1fd1ed8d883fd9bc3de6d61769388 | /b90ft4/src/main/java/b90ft4/web/main/service/MainService.java | 964d2c9f58af6d1db44f3f771f6b8539888a40e4 | [] | no_license | durad-han/B90FT4 | 6372a7ccf968b488e5ca39f2a8e22470abf7a19a | 78cb1c5673ddc389486387107998d0ce712f405a | refs/heads/master | 2020-12-24T19:59:56.936339 | 2017-05-28T05:28:01 | 2017-05-28T05:28:01 | 86,213,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 68 | java | package b90ft4.web.main.service;
public interface MainService {
}
| [
"[email protected]"
] | |
2630f60814856b6fa3b7a3aa60417244c197d051 | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/transform/UpdateVpcLinkRequestProtocolMarshaller.java | 1cd0d3604d6118e84b27406f47a2ae704d889b37 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 2,641 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.apigatewayv2.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.apigatewayv2.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.protocol.*;
import com.amazonaws.protocol.Protocol;
import com.amazonaws.annotation.SdkInternalApi;
/**
* UpdateVpcLinkRequest Marshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class UpdateVpcLinkRequestProtocolMarshaller implements Marshaller<Request<UpdateVpcLinkRequest>, UpdateVpcLinkRequest> {
private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.REST_JSON).requestUri("/v2/vpclinks/{vpcLinkId}")
.httpMethodName(HttpMethodName.PATCH).hasExplicitPayloadMember(false).hasPayloadMembers(true).serviceName("AmazonApiGatewayV2").build();
private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory;
public UpdateVpcLinkRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) {
this.protocolFactory = protocolFactory;
}
public Request<UpdateVpcLinkRequest> marshall(UpdateVpcLinkRequest updateVpcLinkRequest) {
if (updateVpcLinkRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
final ProtocolRequestMarshaller<UpdateVpcLinkRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING,
updateVpcLinkRequest);
protocolMarshaller.startMarshalling();
UpdateVpcLinkRequestMarshaller.getInstance().marshall(updateVpcLinkRequest, protocolMarshaller);
return protocolMarshaller.finishMarshalling();
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
44c9addeeb0abb26c552828c9d98a0885840b229 | 7b1c6720943d11a4dcd194c17e29530749a49520 | /Contexto/src/com/virna5/edge/EdgeNode.java | c774227f9a05fb20e76ac1cec7d403195f86db3b | [] | no_license | msantrax/Controle-F | c7147fce4dca3bb0402e70febad4783b1f58981f | 90023601c25d9ca14e13bbeda07b787f98e7cba5 | refs/heads/master | 2023-06-04T20:26:09.030591 | 2021-06-22T20:10:31 | 2021-06-22T20:10:31 | 379,338,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,047 | 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.virna5.edge;
import com.virna5.contexto.DescriptorNode;
import java.beans.IntrospectionException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.event.ChangeListener;
import org.openide.ErrorManager;
import org.openide.nodes.PropertySupport;
import org.openide.nodes.Sheet;
public class EdgeNode extends DescriptorNode implements ChangeListener {
private static final Logger log = Logger.getLogger(EdgeNode.class.getName());
public EdgeNode(EdgeDescriptor fod) throws IntrospectionException{
super (fod);
log.setLevel(Level.FINE);
}
@Override
public EdgeDescriptor getDescriptor(){
return getLookup().lookup(EdgeDescriptor.class);
}
@Override
@SuppressWarnings("unchecked")
protected Sheet createSheet() {
Sheet sheet = super.createSheet();
Sheet.Set set = Sheet.createPropertiesSet();
set.setName("header");
set.setDisplayName("Geral");
PropertySupport.Reflection psr;
//BaseDescriptor obj = (BaseDescriptor)this.getBean(); //getLookup().lookup(EdgeDescriptor.class);
EdgeDescriptor obj = getLookup().lookup(EdgeDescriptor.class);
// try {
//
// psr = new PropertySupport.Reflection<>(obj, String.class, "inputfile_path");
// psr.setName("Arquivo observado");
// set.put(psr);
//
//
//
// } catch (NoSuchMethodException noSuchMethodException) {
// ErrorManager.getDefault().notify(noSuchMethodException);
// }
sheet.put(set);
return sheet;
}
}
// public FileObserverNode(Children children) {
// //super(children);
// }
// public FileObserverNode(BaseDescriptor c, Index.ArrayChildren child){
// this (c, child, new InstanceContent());
// log.setLevel(Level.ALL);
// }
//
// private FileObserverNode (BaseDescriptor c, Index.ArrayChildren child, InstanceContent ct){
// super (child, new AbstractLookup(ct));
// ct.set(Arrays.asList(c,this), null);
// //c.addPropertyChangeListener(WeakListeners.propertyChange(this, c));
// this.content = ct;
//
// }
//
// @Override
// public void updateProp(){
// log.info("updating properties");
// this.firePropertySetsChange(null, this.getPropertySets());
//
// }
//
//
// @Override
// @SuppressWarnings("unchecked")
// public void stateChanged(ChangeEvent e) {
//// Set newcontent = new HashSet<Classmap>();
//// @SuppressWarnings("unchecked")
//// boolean add = newcontent.add(getClassmap());
//// content.set(newcontent, null);
// }
//
//
| [
"[email protected]"
] | |
f26198c188ade76a097ab1157251a1f4d71280f2 | 13f27bcd537dec2bf19c4d8c4913b338b4d47e26 | /src/com/dhc/pos/dynamic/template/os/struct/FunctionPageTemplate.java | bc9ff49ce0162a2df277e3f4e96f43eb30663e51 | [] | no_license | suntinghui/POS2Android_Standard | b3e54ef00609599238a73776e0f889e73b3e4054 | 9507550943c3279afdbe4cea23fc0251a7e65500 | refs/heads/master | 2020-06-02T11:02:13.596017 | 2013-12-19T15:06:12 | 2013-12-19T15:06:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,907 | java | package com.dhc.pos.dynamic.template.os.struct;
import java.util.Vector;
import android.view.View;
import com.dhc.pos.dynamic.core.ViewPage;
import com.dhc.pos.dynamic.template.StructTemplate;
public class FunctionPageTemplate extends StructTemplate {
public FunctionPageTemplate(String id, String name) {
super(id, name);
}
@Override
public void dateInit() {
ViewPage templatePage = this.getTemplatePage();
if (null == templatePage) {
return;
}
if (null != templatePage.getTarget()) {
int i =0;
/**
* 标注已经加载过模板了
*/
this.getCurrentPage().setTemplate(null);
if (templatePage.getTarget().isPage()) {
Vector<String> comIndex = new Vector<String>();
for ( ;i<templatePage.getViewIndex().size(); i++) {
if (null != this.getCurrentPage().getComponent(templatePage.getViewIndex().get(i))) {
continue;
}
if (templatePage.getViewIndex().get(i).equals(templatePage.getTarget().getId())) {
i++;
break;
}
/**
* 定位到标签前的所有组件
*/
comIndex.add(templatePage.getViewIndex().get(i));
}
this.getCurrentPage().getViewIndex().addAll(0, comIndex);
/**
* 增加标签后的所有的组件
*/
for (; i<templatePage.getViewIndex().size(); i++) {
if (null != this.getCurrentPage().getComponent(templatePage.getViewIndex().get(i))) {
continue;
}
this.getCurrentPage().getViewIndex().add(templatePage.getViewIndex().get(i));
}
} else {
// TODO 针对某一类标签进行替换
}
} else {
/**
* 没有替换标签,则全部加载到当前界面之后
*/
this.getCurrentPage().getViewIndex().addAll(templatePage.getViewIndex());
}
}
@Override
public Vector<View> excute() {
// TODO Auto-generated method stub
return null;
}
}
| [
"[email protected]"
] | |
8c4fef6ede7f8dd4c984b30709c1885b3d65d2bf | 7ef056b44609074281f84049f2c3433adfa62b0a | /app/src/main/java/com/incendiary/reactivegplus/PendingResultObservable.java | ca1809fc88a6d01b40bf332dc84f6b9122ffc2f9 | [
"Apache-2.0"
] | permissive | esafirm/Android-ReactiveGPlus | 2a1db0b6c16d0e9ea774b1059461ac1a979af031 | 2d2fc0348111e8fcfa2e1d54f60b6c2c3541fd4d | refs/heads/master | 2021-01-23T06:26:11.533001 | 2015-08-04T07:48:40 | 2015-08-04T07:48:40 | 37,865,216 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 986 | java | package com.incendiary.reactivegplus;
import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.ResultCallback;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action0;
import rx.subscriptions.Subscriptions;
public class PendingResultObservable<T extends Result> implements Observable.OnSubscribe<T> {
private final PendingResult<T> result;
private boolean complete = false;
public PendingResultObservable(PendingResult<T> result) {
this.result = result;
}
@Override
public void call(final Subscriber<? super T> subscriber) {
result.setResultCallback(new ResultCallback<T>() {
@Override
public void onResult(T t) {
subscriber.onNext(t);
complete = true;
subscriber.onCompleted();
}
});
subscriber.add(Subscriptions.create(new Action0() {
@Override
public void call() {
if (!complete) {
result.cancel();
}
}
}));
}
} | [
"[email protected]"
] | |
f64eff10a9f9710efdf8f0f5c3d3a59002a55499 | 6351ecb8b7a2cb9056ae5e03aab90b4c66c66a79 | /src/Human/Student.java | b449dffaff4adcf24818adaa79dbe42dfddfcbe8 | [] | no_license | NataliaGulidova/Curses | dd8cabb26f48f85181acf71a6d1124585d64b65b | 1d648b58282683b5fdea9122f37c3bd0b0e6f0f3 | refs/heads/master | 2020-12-30T12:55:35.505446 | 2017-07-27T18:46:12 | 2017-07-27T18:46:12 | 91,234,903 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,222 | java | package Human;
/**
* Created by Admin on 22.06.2017.
*/
import java.util.Scanner;
public class Student extends Human implements Comparable{
private int numberGroup;
private double averadgeScore;
private int recordBookNumber;
public Student(String sex, String surname, int age, boolean isSex) {
super(sex, surname, age, isSex);
}
public Student(String sex, String surname, int age, boolean isSex, int numberGroup, double averadgeScore, int recordBookNumber) {
super(sex, surname, age, isSex);
this.numberGroup = numberGroup;
this.averadgeScore = averadgeScore;
this.recordBookNumber = recordBookNumber;
}
public Student(String name, String lastName, int age, boolean sex, long zach, String group) {
}
public Student(String sex, String surname, int age, int numberGroup, double averadgeScore, int recordBookNumder) {
}
public void setRecordBookNumber(int recordBookNumber) {
this.recordBookNumber = recordBookNumber;
}
public int compareTo (Object o) {
Student b = (Student) o;
int comp = (this.getSurname()).compareToIgnoreCase(b.getSurname());
if (comp > 0) return 1;
else if (comp < 0) return -1;
else
return 0;
}
public int getRecordBookNumber() {
return recordBookNumber;
}
public int getNumberGroup() {
return numberGroup;
}
public void setNumberGroup(int numberGroup) {
this.numberGroup = numberGroup;
}
public double getAveradgeScore() {
return averadgeScore;
}
public void setAveradgeScore(double averadgeScore) {
this.averadgeScore = averadgeScore;
}
public int getRecordBookNumder() {
return recordBookNumber;
}
public void setRecordBookNumder(int recordBookNumder) {
this.recordBookNumber = recordBookNumder;
}
@Override
public String toString() {
return "Student" + " "+"sex: " + getSex() + " " + " age: " + getAge()+" " +" surname:" + " " + getSurname() +" "+ "numberGroup:" +
numberGroup +" " + " averadgeScore:" + averadgeScore +" "+ " recordBookNumber:" + recordBookNumber;
}
}
| [
"[email protected]"
] | |
4e5004717168c910a592cacce7a8eb7c23b6282e | fd2c3e33943e58ec5c6ab9a72417585a52965846 | /app/src/main/java/com/tmejs/andoridappjunction/activities/StartGameActivity.java | 9a3faa47a960da0edb7610b41edb4190f6b1fd35 | [] | no_license | jMerta/AndoridAppJunction | 5315472e0a158d28758d94d3b3b63f9b1b921836 | ed546cf2eafa75b022aff7b56ef58b0cb445f523 | refs/heads/master | 2021-08-19T11:45:35.077659 | 2017-11-26T02:47:30 | 2017-11-26T02:47:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,492 | java | package com.tmejs.andoridappjunction.activities;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import com.tmejs.andoridappjunction.ApplicationController;
import com.tmejs.andoridappjunction.R;
import com.tmejs.andoridappjunction.activities.system.MyActivity;
import com.tmejs.andoridappjunction.activities.system.WaitingActivity;
public class StartGameActivity extends MyActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start_game);
((Button) findViewById(R.id.activity_start_game_start_game_button)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.e("StartGameActivity", "Start game button clicked");
ApplicationController.showNews("Zmieniam na StartingGameActivity");
ApplicationController.switchActivity(StartingGameActivity.class);
}
});
((Button) findViewById(R.id.activity_start_game_join_game_button)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.e("StartGameActivity", "Join game button clicked");
ApplicationController.switchActivity(JoinGameActivity.class);
}
});
}
}
| [
"[email protected]"
] | |
6025994d39feae52e4d41fe25aa45be105785373 | f232c2c7966e5769d1f68af87c83615fe4202870 | /backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/ImportVmCommandTest.java | ccc3e0832cf7a693ec794264f0a6fee7befadd8e | [] | no_license | BillTheBest/ovirt-engine | 54d0d3cf5b103c561c4e72e65856948f252b41a1 | 7d5d711b707e080a69920eb042f6f547dfa9443f | refs/heads/master | 2016-08-05T16:52:16.557733 | 2011-11-07T02:49:42 | 2011-11-07T02:49:42 | 2,938,776 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,572 | java | package org.ovirt.engine.core.bll;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.ovirt.engine.core.common.action.ImportVmParameters;
import org.ovirt.engine.core.common.businessentities.VM;
import org.ovirt.engine.core.common.config.Config;
import org.ovirt.engine.core.compat.Guid;
import org.ovirt.engine.core.dal.VdcBllMessages;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ Config.class, ImportExportCommon.class })
public class ImportVmCommandTest {
@Test
public void insufficientDiskSpace() {
final int lotsOfSpace = 1073741824;
final int diskSpacePct = 0;
final ImportVmCommand<ImportVmParameters> c = setupDiskSpaceTest(lotsOfSpace, diskSpacePct);
assertFalse(c.canDoAction());
assertTrue(c.getReturnValue()
.getCanDoActionMessages()
.contains(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW.toString()));
}
@Test
public void sufficientDiskSpace() {
final int extraDiskSpaceRequired = 0;
final int diskSpacePct = 0;
final ImportVmCommand<ImportVmParameters> c = setupDiskSpaceTest(extraDiskSpaceRequired, diskSpacePct);
assertTrue(c.canDoAction());
}
private ImportVmCommand<ImportVmParameters> setupDiskSpaceTest(final int diskSpaceRequired, final int diskSpacePct) {
ConfigMocker cfgMocker = new ConfigMocker();
cfgMocker.mockConfigLowDiskSpace(diskSpaceRequired);
cfgMocker.mockConfigLowDiskPct(diskSpacePct);
cfgMocker.mockLimitNumberOfNetworkInterfaces(Boolean.TRUE);
mockImportExportCommonAlwaysTrue();
return new TestHelperImportVmCommand(createParameters());
}
protected ImportVmParameters createParameters() {
final VM v = createVM();
v.setvm_name("testVm");
final ImportVmParameters p =
new ImportVmParameters(v, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid());
return p;
}
protected VM createVM() {
final VM v = new VM();
v.setvm_guid(Guid.NewGuid());
v.setDiskSize(2);
return v;
}
protected static void mockImportExportCommonAlwaysTrue() {
ImportExportCommonMocker mocker = new ImportExportCommonMocker();
mocker.mockCheckStorageDomain(true);
mocker.mockCheckStoragePool(true);
}
}
| [
"[email protected]"
] | |
b9ef752e5301f20d3e172fe46795dc71f3221b02 | 97134c41127c323ccdda21f11c243efe16de5860 | /Kepler-Server/src/main/java/org/alexdev/kepler/game/moderation/FuserightsManager.java | f46e994fb62eecb12b8cc618c33ea4b884013915 | [] | no_license | odasm/Kepler | ae4d2b397a76d55d3c53f72c4d13e55af6783d80 | abafa94b5c9778b757fed8f85e2c2901a9892c0e | refs/heads/master | 2020-03-19T19:25:51.186313 | 2018-06-10T10:43:57 | 2018-06-10T10:43:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,670 | java | package org.alexdev.kepler.game.moderation;
import org.alexdev.kepler.dao.mysql.FuserightsDao;
import org.alexdev.kepler.game.player.Player;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
public class FuserightsManager {
private static FuserightsManager instance;
private HashMap<String, Integer> fuserights;
public FuserightsManager() {
this.fuserights = FuserightsDao.getFuserights();
}
/**
* Get the available fuserights for user.
*
* @param minimumRank the minimum rank to see the fuseright
* @return the lsit of fuserights
*/
public List<String> getAvailableFuserights(int minimumRank) {
List<String> fuses = new ArrayList<>();
for (var kvp : this.fuserights.entrySet()) {
if (minimumRank >= kvp.getValue()) {
fuses.add(kvp.getKey());
}
}
return fuses;
}
/**
* Get if the rank has a fuseright.
*
* @param fuse the fuse to check against
* @param minimumRank the rank to check with
* @return true, if successful
*/
public boolean hasFuseright(String fuse, int minimumRank) {
for (var kvp : this.fuserights.entrySet()) {
if (minimumRank >= kvp.getValue() && kvp.getKey().equals(fuse)) {
return true;
}
}
return false;
}
/**
* Get the fuseright manager instance.
*
* @return the fuseright manager
*/
public static FuserightsManager getInstance() {
if (instance == null) {
instance = new FuserightsManager();
}
return instance;
}
}
| [
"[email protected]"
] | |
3d44b5e99a1f2cb66d810a4d0ed504ff25456ed2 | 87b327e6e1f8462c8a83202ae3dd2380e15d1f67 | /app/src/main/java/com/postpc/nisha/storyline/MapFinishActivity.java | e090068a7a281741ded00fe117915c26f28c9a98 | [] | no_license | AmotzL/Storyline_PostPC | fa57a806376fe7abb8a62266ed4094d61e182697 | 9b37db081f920630175552cce2c82eee4b5c5c58 | refs/heads/master | 2020-05-18T11:55:19.068496 | 2019-05-01T09:17:15 | 2019-05-01T09:17:15 | 184,393,416 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,454 | java | package com.postpc.nisha.storyline;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Color;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.PolylineOptions;
import java.text.SimpleDateFormat;
import java.util.Date;
public class MapFinishActivity extends AppCompatActivity implements OnMapReadyCallback, GoogleMap.OnMarkerClickListener {
public static final String FIELD = "StoryName";
GoogleMap mMap;
private String curStoryName;
DbForStoriesHelper storiesDb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
storiesDb = LoginActivity.getStoriesDb();
setContentView(R.layout.activity_map_finish);
if (getIntent().hasExtra(FIELD)){
curStoryName = getIntent().getStringExtra(FIELD);
}
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.setOnMarkerClickListener(this);
updateMap();
}
public void updateMap() {
PolylineOptions poly_line = new PolylineOptions();
LatLngBounds.Builder bounds_builder = new LatLngBounds.Builder();
DbForStoriesHelper storiesDb = LoginActivity.getStoriesDb();
Cursor all = storiesDb.getAllUserLocations(curStoryName);
while (all.moveToNext()) {
LatLng tmp_latLog = new LatLng(all.getDouble(1), all.getDouble(2));
poly_line.add(tmp_latLog).width(5).color(Color.RED);
bounds_builder.include(tmp_latLog);
mMap.addMarker(new MarkerOptions().position(tmp_latLog).title(String.valueOf(all.getInt(0))));
}
LatLngBounds bounds = bounds_builder.build();
mMap.addPolyline(poly_line);
mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 200));
}
@Override
public boolean onMarkerClick(Marker marker) {
String db_index = marker.getTitle();
Cursor all = storiesDb.getTimeOfLocation(db_index);
if (all.getCount() > 0)
{
all.moveToNext();
long markerTime = Long.valueOf(all.getString(1));
long minsToAdd = 60;
String startTime = Epoch2DateString(markerTime, "HH:mm:ss",0);
String startDate = Epoch2DateString(markerTime, "dd/MM/yyyy",0);
String endTime = Epoch2DateString(markerTime, "HH:mm:ss",minsToAdd);
String endDate = Epoch2DateString(markerTime, "dd/MM/yyyy",minsToAdd);
goToRunningStoryActivity(startTime, startDate, endTime, endDate);
}
return false;
}
private void goToRunningStoryActivity(String startTime, String startDate, String endTime, String endDate) {
Cursor storyDetails = storiesDb.getStoryDetailsFromName(curStoryName);
storyDetails.moveToNext();
String folderPath = getImagesDir(storiesDb);
Intent intent = new Intent(MapFinishActivity.this, AlbumActivity.class);
intent.putExtra("StartDate", startDate);
intent.putExtra("StartTime", startTime);
intent.putExtra("EndDate", endDate);
intent.putExtra("EndTime", endTime);
intent.putExtra("FolderPath", folderPath);
startActivity(intent);
}
public static String Epoch2DateString(long epochSeconds, String formatString, long minutesToAdd) {
Date updatedate = new Date(epochSeconds + minutesToAdd*60*1000);
SimpleDateFormat format = new SimpleDateFormat(formatString);
return format.format(updatedate);
}
public static String getImagesDir(DbForStoriesHelper storiesHelper){
String fullPath = storiesHelper.getPathAsString();
Uri uri = Uri.parse(fullPath);
return uri.getLastPathSegment();
}
}
| [
"[email protected]"
] | |
415544c2553d741318f5a14cd25d65a37c80b3b3 | ee344ec49fed13a6516dd2b0a9802031e342909f | /app/src/main/java/com/example/myapplicationstructure/view/fragment/BlankFragment.java | 7bd874b19514053ab60aea45eaded23d4a0fcd0c | [] | no_license | AkhileshGahlot/Android-Demo-MVVM-Acrhitecture | 70c5ff52379456e23bcc5bd25f67f6d22362cd28 | 1c9fe68a385022607e57a2b5f263b834bb0dc161 | refs/heads/master | 2023-03-28T23:06:50.122420 | 2021-04-02T06:27:01 | 2021-04-02T06:27:01 | 353,921,990 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,213 | java | package com.example.myapplicationstructure.view.fragment;
import android.os.Bundle;
import androidx.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.myapplicationstructure.R;
import com.example.myapplicationstructure.view.base_view.BaseFragment;
public class BlankFragment extends BaseFragment {
public static BlankFragment newInstance() {
return new BlankFragment();
}
// @Override
// public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
// @Nullable Bundle savedInstanceState) {
// return inflater.inflate(R.layout.blank_fragment, container, false);
// }
@Override
public View onCreateViewPost(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.blank_fragment, container, false);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// TODO: Use the ViewModel
}
@Override
public void onClick(View view) {
}
} | [
"[email protected]"
] | |
3505932e59ed5a7ca6566e65028cec3ebd4ece20 | 07230f54d47351242c4e496b8fe4ef4ae51a401f | /EZRobotControl/app/src/main/java/com/teamez/ezrobotcontrol/WifiDirectBroadcastReceiver.java | 319a614cc6fff53c1823a0653b55dc4019cad9ff | [] | no_license | jakobkd/SPRO3 | 846eeeb847d497f2a45368ca49b5b626c6ed35c5 | 9b444b7f440f9aaa15170cc73f21f2806eb44c90 | refs/heads/master | 2020-07-30T19:55:11.970486 | 2020-01-21T00:19:30 | 2020-01-21T00:19:30 | 210,340,299 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,631 | java | package com.teamez.ezrobotcontrol;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.NetworkInfo;
import android.net.wifi.p2p.WifiP2pManager;
import android.widget.Toast;
public class WifiDirectBroadcastReceiver extends BroadcastReceiver {
private WifiP2pManager mManager;
private WifiP2pManager.Channel mChannel;
private MainActivity mActivity;
public WifiDirectBroadcastReceiver(WifiP2pManager mManager, WifiP2pManager.Channel mChannel, MainActivity mainActivity) {
this.mManager = mManager;
this.mChannel = mChannel;
this.mActivity = mainActivity;
}
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION.equals(action)) {
// Determine if Wifi P2P mode is enabled or not, alert
// the Activity.
int state = intent.getIntExtra(WifiP2pManager.EXTRA_WIFI_STATE, -1);
if (state == WifiP2pManager.WIFI_P2P_STATE_ENABLED) {
//mActivity.setIsWifiP2pEnabled
//Toast.makeText(mActivity, "p2p enabled", Toast.LENGTH_LONG).show();
//wifi is on
} else {
//wifi is off
//Toast.makeText(mActivity, "p2p not enabled", Toast.LENGTH_LONG).show();
}
} else if (WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION.equals(action)) {
// The peer list has changed! We should probably do something about
// that.
if(mManager != null) {
mManager.requestPeers(mChannel, mActivity.peerListListener);
}
} else if (WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION.equals(action)) {
// Connection state changed! We should probably do something about
// that.
if(mManager == null) {
return;
}
NetworkInfo networkInfo = intent.getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO);
if(networkInfo.isConnected()) {
mManager.requestConnectionInfo(mChannel, mActivity.connectionInfoListener);
}
} else if (WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action)) {
//DeviceListFragment fragment = (DeviceListFragment) activity.getFragmentManager()
//.findFragmentById(R.id.frag_list);
//fragment.updateThisDevice((WifiP2pDevice) intent.getParcelableExtra(
//WifiP2pManager.EXTRA_WIFI_P2P_DEVICE));
}
}
}
| [
"[email protected]"
] | |
9ff807445188ee4b99e871e937274b60b8d4d06e | bdbfa1b1b2ecc586efc590219fea0979e5413cff | /app/src/main/java/com/hanzla/recycler/Adapter/RecyclerviewAdapter.java | 81c9ee0855ca86a3bb10863655b796114c00d96a | [] | no_license | Hanzla327/RecyclerView | e67bb55396a473090805aa20491ea06ca78dbb01 | edb8b5a8348643f477c66d47800ee16a27d9a574 | refs/heads/master | 2023-05-20T07:54:36.780122 | 2021-06-13T01:58:20 | 2021-06-13T01:58:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,714 | java | package com.hanzla.recycler.Adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.hanzla.recycler.Model.Student;
import com.hanzla.recycler.R;
import java.util.List;
public class RecyclerviewAdapter extends RecyclerView.Adapter<RecyclerviewAdapter.ViewHolder> {
private Context context;
private List<Student> studentList;
private OnItemClickListener buttonListener;
public interface OnItemClickListener{
void onDeleteClick(int position);
}
public void setOnItemClickListener(OnItemClickListener listener){
buttonListener = listener;
}
public RecyclerviewAdapter() {
}
public RecyclerviewAdapter(Context context, List<Student> studentList) {
this.context = context;
this.studentList = studentList;
}
@NonNull
@Override
public RecyclerviewAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.cardd,parent,false);
return new ViewHolder(view,buttonListener);
}
@Override
public void onBindViewHolder(@NonNull RecyclerviewAdapter.ViewHolder holder, int position) {
Student student =studentList.get(position);
holder.txtName.setText(student.getName());
holder.txtRollNo.setText(student.getRollNo());
}
@Override
public int getItemCount() {
return studentList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
ImageView imageView_dlt;
TextView txtName,txtRollNo;
public ViewHolder(@NonNull View itemView,OnItemClickListener listener) {
super(itemView);
txtName = itemView.findViewById(R.id.txtName);
txtRollNo =itemView.findViewById(R.id.txtRollNo);
imageView_dlt=itemView.findViewById(R.id.img_dlt);
imageView_dlt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(listener != null) {
int position = getAdapterPosition();
if(position != RecyclerView.NO_POSITION){
listener.onDeleteClick(position);
}
}
}
});
}
@Override
public void onClick(View v) {
}
}
}
| [
"[email protected]"
] | |
c281987097a596c781dc3b43614542c265dbbe48 | aaa536bca855a7637417205807427b093ca37e49 | /admin-bot/src/main/java/com/symphony/adminbot/commons/BotConstants.java | 52b130b200843ca225a200af89c33854fa2d8cb0 | [
"CDDL-1.0",
"EPL-1.0",
"CDDL-1.1",
"Classpath-exception-2.0",
"GPL-2.0-only",
"Apache-2.0"
] | permissive | symphonyoss/symphony-admin-bot | 3a23db46ff833d3a90e06b336f01ea48a745a3d9 | 73efd36681dfa7a5c9d559e74cd9c929539fc6c8 | refs/heads/master | 2022-04-08T22:18:37.102117 | 2017-11-10T17:15:12 | 2017-11-10T17:15:12 | 96,667,123 | 0 | 3 | Apache-2.0 | 2020-03-04T21:40:42 | 2017-07-09T07:01:18 | Java | UTF-8 | Java | false | false | 3,386 | java | /*
* Copyright 2017 The Symphony Software Foundation
*
* Licensed to The Symphony Software Foundation (SSF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package com.symphony.adminbot.commons;
/**
* Created by nick.tarsillo on 7/1/17.
*/
public class BotConstants {
//For error messages
public static final String NOT_ENTITLED = "User is not entitled to use these endpoints.";
public static final String INTERNAL_ERROR = "Internal server error.";
public static final String NO_CERT = "Please provide a cert with request.";
//Symphony API Errors
public static final String USERS_EXIST = "Could not create user: {\"code\":0,\"message\":\"User already exists.\"}";
//For cert generation
public static final String BOT_USERNAME = "BotUser";
//Cache
public static final int VALID_DURATION = 7200;
public static final long EXPIRE_TIME_DAYS = 1;
public static final long MANAGER_EXPIRE_MINUTES = 30;
//For Email Confirmation
public static final String ADMIN_BOT_NAME = "Admin Bot";
//Success Messages
public static final String DEVELOPER_WELCOME_SUCCESS = "Developer welcome succeeded.";
//Bootstrap Error Messages
public static final String BOT_APP_EXISTS = "Bot or app already exists.";
public static final String DEVELOPER_REQUIRED = "All developer fields are required.";
public static final String APP_NAME_REQUIRED = "App name is required.";
public static final String APP_DESCRIPTION_REQUIRED = "App description is required.";
public static final String APP_DOMAIN_REQUIRED = "App domain is required.";
public static final String APP_COMPANY_REQUIRED = "App company name is required.";
public static final String APP_URL_REQUIRED = "App url is required.";
public static final String BOT_EMAIL_REQUIRED = "Bot email is required.";
public static final String BOT_NAME_REQUIRED = "Bot name is required.";
public static final String ICON_START_WITH_HTTPS = "Icon url must start with \"https://\".";
public static final String APP_START_WITH_HTTPS = "App url must start with \"https://\".";
public static final String DOMAIN_MUST_MATCH = "Domain must match app url domain.";
public static final String DEVELOPER_NOT_FOUND = "Developer not found.";
public static final String DUPLICATE_DEVELOPER = "Developers cannot have same emails.";
public static final String DEVELOPER_EXISTS = "One or more developers already exists on pod.";
public static final String INVALID_APP_ICON_URL = "The app icon url is invalid.";
public static final String INVALID_APP_URL = "The app url is invalid.";
public static final String BOT_DEVELOPER_EMAIL_SAME = "The bot email must be different than developers' emails.";
}
| [
"[email protected]"
] | |
b099a5985a866162208aa4731aa532614fe80609 | 742b17fb2d6ccd58ade913299bcd13e1c062410d | /src/main/java/org/peimari/gleaflet/client/draw/DeleteStopEvent.java | 76338c68047e22c7300b1d75e9dd433320fe1e21 | [
"Apache-2.0"
] | permissive | mstahv/g-leaflet-draw | b6cb063da23f6026fdcac9344023506e2665cb53 | 1fa8824765bc6b226dbfb86479ecc1d3eba9d648 | refs/heads/master | 2020-12-25T16:48:12.488334 | 2018-05-10T13:26:22 | 2018-05-10T13:26:22 | 13,362,903 | 7 | 13 | NOASSERTION | 2019-04-29T14:05:09 | 2013-10-06T13:54:55 | Java | UTF-8 | Java | false | false | 135 | java | package org.peimari.gleaflet.client.draw;
public class DeleteStopEvent extends DrawEvent {
protected DeleteStopEvent() {
}
}
| [
"[email protected]"
] | |
7129bb32ed1226acc5a9713a70aa2059db6032cf | 5d26d3fbb84cf8dd35a4c3988ac7c197455cda76 | /src/main/java/com/xunfeng/ai/HttpUtils.java | e416fe09258ce115176164809476ebbc4e40752b | [] | no_license | danile4140/Jmeter | 6d2edef28a98e39895cce204d727ec7fa31bae7b | 966bef0e57539b16f4be69527ca0ed05e9ff6425 | refs/heads/master | 2020-04-13T17:42:53.275752 | 2018-12-28T02:16:00 | 2018-12-28T02:16:00 | 163,355,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,471 | java | package com.xunfeng.ai;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
/**
* Created by danny.deng on 2018/12/24.
*/
public class HttpUtils {
public static String doPostJson(String url, String json) {
// 创建Httpclient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = null;
String resultString = "";
try {
// 创建Http Post请求
HttpPost httpPost = new HttpPost(url);
// 创建请求内容
StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
// 执行http请求
response = httpClient.execute(httpPost);
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
response.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return resultString;
}
}
| [
"[email protected]"
] | |
18614af62dfa7f99b45293445713fd4301a5c853 | 1c5e8605c1a4821bc2a759da670add762d0a94a2 | /src/dahua/fdc/basedata/mobile/GlobalTargetBill.java | b8f981ab8bd18de663f98822eb14ff2b37985289 | [] | no_license | shxr/NJG | 8195cfebfbda1e000c30081399c5fbafc61bb7be | 1b60a4a7458da48991de4c2d04407c26ccf2f277 | refs/heads/master | 2020-12-24T06:51:18.392426 | 2016-04-25T03:09:27 | 2016-04-25T03:09:27 | 19,804,797 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 9,913 | java | package com.kingdee.eas.fdc.basedata.mobile;
import com.kingdee.bos.framework.ejb.EJBRemoteException;
import com.kingdee.bos.util.BOSObjectType;
import java.rmi.RemoteException;
import com.kingdee.bos.framework.AbstractBizCtrl;
import com.kingdee.bos.orm.template.ORMObject;
import java.lang.String;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.bos.metadata.entity.SorterItemCollection;
import com.kingdee.eas.framework.CoreBaseCollection;
import com.kingdee.bos.util.*;
import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.eas.fdc.basedata.mobile.app.*;
import com.kingdee.eas.framework.CoreBaseInfo;
import com.kingdee.bos.framework.*;
public class GlobalTargetBill extends FdcMobileBill implements IGlobalTargetBill
{
public GlobalTargetBill()
{
super();
registerInterface(IGlobalTargetBill.class, this);
}
public GlobalTargetBill(Context ctx)
{
super(ctx);
registerInterface(IGlobalTargetBill.class, this);
}
public BOSObjectType getType()
{
return new BOSObjectType("07D1D10F");
}
private GlobalTargetBillController getController() throws BOSException
{
return (GlobalTargetBillController)getBizController();
}
/**
*exists-System defined method
*@param pk pk
*@return
*/
public boolean exists(IObjectPK pk) throws BOSException, EASBizException
{
try {
return getController().exists(getContext(), pk);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*exists-System defined method
*@param filter filter
*@return
*/
public boolean exists(FilterInfo filter) throws BOSException, EASBizException
{
try {
return getController().exists(getContext(), filter);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*exists-System defined method
*@param oql oql
*@return
*/
public boolean exists(String oql) throws BOSException, EASBizException
{
try {
return getController().exists(getContext(), oql);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*getValue-System defined method
*@param pk pk
*@return
*/
public GlobalTargetBillInfo getGlobalTargetBillInfo(IObjectPK pk) throws BOSException, EASBizException
{
try {
return getController().getGlobalTargetBillInfo(getContext(), pk);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*getValue-System defined method
*@param pk pk
*@param selector selector
*@return
*/
public GlobalTargetBillInfo getGlobalTargetBillInfo(IObjectPK pk, SelectorItemCollection selector) throws BOSException, EASBizException
{
try {
return getController().getGlobalTargetBillInfo(getContext(), pk, selector);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*getValue-System defined method
*@param oql oql
*@return
*/
public GlobalTargetBillInfo getGlobalTargetBillInfo(String oql) throws BOSException, EASBizException
{
try {
return getController().getGlobalTargetBillInfo(getContext(), oql);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*addnew-System defined method
*@param model model
*@return
*/
public IObjectPK addnew(GlobalTargetBillInfo model) throws BOSException, EASBizException
{
try {
return getController().addnew(getContext(), model);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*addnew-System defined method
*@param pk pk
*@param model model
*/
public void addnew(IObjectPK pk, GlobalTargetBillInfo model) throws BOSException, EASBizException
{
try {
getController().addnew(getContext(), pk, model);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*update-System defined method
*@param pk pk
*@param model model
*/
public void update(IObjectPK pk, GlobalTargetBillInfo model) throws BOSException, EASBizException
{
try {
getController().update(getContext(), pk, model);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*updatePartial-System defined method
*@param model model
*@param selector selector
*/
public void updatePartial(GlobalTargetBillInfo model, SelectorItemCollection selector) throws BOSException, EASBizException
{
try {
getController().updatePartial(getContext(), model, selector);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*updateBigObject-System defined method
*@param pk pk
*@param model model
*/
public void updateBigObject(IObjectPK pk, GlobalTargetBillInfo model) throws BOSException
{
try {
getController().updateBigObject(getContext(), pk, model);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*delete-System defined method
*@param pk pk
*/
public void delete(IObjectPK pk) throws BOSException, EASBizException
{
try {
getController().delete(getContext(), pk);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*getPKList-System defined method
*@return
*/
public IObjectPK[] getPKList() throws BOSException, EASBizException
{
try {
return getController().getPKList(getContext());
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*getPKList-System defined method
*@param oql oql
*@return
*/
public IObjectPK[] getPKList(String oql) throws BOSException, EASBizException
{
try {
return getController().getPKList(getContext(), oql);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*getPKList-System defined method
*@param filter filter
*@param sorter sorter
*@return
*/
public IObjectPK[] getPKList(FilterInfo filter, SorterItemCollection sorter) throws BOSException, EASBizException
{
try {
return getController().getPKList(getContext(), filter, sorter);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*getCollection-System defined method
*@return
*/
public GlobalTargetBillCollection getGlobalTargetBillCollection() throws BOSException
{
try {
return getController().getGlobalTargetBillCollection(getContext());
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*getCollection-System defined method
*@param view view
*@return
*/
public GlobalTargetBillCollection getGlobalTargetBillCollection(EntityViewInfo view) throws BOSException
{
try {
return getController().getGlobalTargetBillCollection(getContext(), view);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*getCollection-System defined method
*@param oql oql
*@return
*/
public GlobalTargetBillCollection getGlobalTargetBillCollection(String oql) throws BOSException
{
try {
return getController().getGlobalTargetBillCollection(getContext(), oql);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*delete-System defined method
*@param filter filter
*@return
*/
public IObjectPK[] delete(FilterInfo filter) throws BOSException, EASBizException
{
try {
return getController().delete(getContext(), filter);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*delete-System defined method
*@param oql oql
*@return
*/
public IObjectPK[] delete(String oql) throws BOSException, EASBizException
{
try {
return getController().delete(getContext(), oql);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*delete-System defined method
*@param arrayPK arrayPK
*/
public void delete(IObjectPK[] arrayPK) throws BOSException, EASBizException
{
try {
getController().delete(getContext(), arrayPK);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
} | [
"[email protected]"
] | |
ea9df17d549a90318fb3088ad2b434c94ff9271b | a03b9201e9dbcaf328826201ec11d5c57abf742b | /src/com/easefun/polyvsdk/demo/PolyvPlayerAdvertisementView.java | 31629cb95ea5c150b0103af91b1ef085da54472a | [] | no_license | jlayi/polyv-android-sdk-demo | 1e077ef0e64e5a9a11b4b511afbe395e7fe3f8c3 | 4c8a2b9c3c6fc8dc9da8d492000d2573d331cffa | refs/heads/master | 2020-07-26T15:13:22.310264 | 2017-06-08T11:10:51 | 2017-06-08T11:10:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,052 | java | package com.easefun.polyvsdk.demo;
import java.net.MalformedURLException;
import java.net.URL;
import com.easefun.polyvsdk.R;
import com.easefun.polyvsdk.Video.ADMatter;
import com.easefun.polyvsdk.demo.AnimateFirstDisplayListener;
import com.easefun.polyvsdk.ijk.IjkVideoView;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
/**
* 广告视图,只针对图片广告做处理,视频广告在IjkVideoView中已经处理
* @author TanQu 2016-3-3
*/
public class PolyvPlayerAdvertisementView extends RelativeLayout {
private Context mContext = null;
private PopupWindow popupWindow = null;
private IjkVideoView mIjkVideoView = null;
private ImageView mAdvertisementImage = null;
private ImageButton mStartBtn = null;
private TextView mCountDown = null;
private DisplayImageOptions mOptions = null;
private View mAnchorView = null;
private ADMatter mADMatter = null;
private int countDownNum = 0;
private static final int COUNT_DOWN = 1;
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
countDownNum--;
mCountDown.setText(String.valueOf(countDownNum));
if (countDownNum <= 0) {
//重要,调用此方法才能继续播放
if (ADMatter.LOCATION_FIRST.equals(mADMatter.getLocation())
|| ADMatter.LOCATION_LAST.equals(mADMatter.getLocation())) {
mIjkVideoView.playNext();
}
hide();
} else {
handler.sendEmptyMessageDelayed(COUNT_DOWN, 1000);
}
}
};
public PolyvPlayerAdvertisementView(Context context) {
super(context);
mContext = context;
initViews();
}
public PolyvPlayerAdvertisementView(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
initViews();
}
public PolyvPlayerAdvertisementView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mContext = context;
initViews();
}
public void setIjkVideoView(IjkVideoView ijkVideoView) {
mIjkVideoView = ijkVideoView;
}
private void initViews() {
LayoutInflater.from(getContext()).inflate(R.layout.polyv_player_advertisement_view, this);
mAdvertisementImage = (ImageView) findViewById(R.id.advertisement_image);
mAdvertisementImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String path = mADMatter.getAddrUrl();
if (TextUtils.isEmpty(path) == false) {
try {
new URL(path);
} catch (MalformedURLException e) {
return;
}
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(path));
mContext.startActivity(intent);
}
}
});
mCountDown = (TextView) findViewById(R.id.count_down);
mStartBtn = (ImageButton) findViewById(R.id.advertisement_start_btn);
mStartBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mIjkVideoView.start();
hide();
}
});
if (mOptions == null) {
mOptions = new DisplayImageOptions.Builder().showImageOnLoading(R.drawable.bg_loading) // 设置图片在下载期间显示的图片
.showImageForEmptyUri(R.drawable.bg_loading)// 设置图片Uri为空或是错误的时候显示的图片
.showImageOnFail(R.drawable.bg_loading) // 设置图片加载/解码过程中错误时候显示的图片
.bitmapConfig(Bitmap.Config.RGB_565)// 设置图片的解码类型
.cacheInMemory(true)// 设置下载的图片是否缓存在内存中
.cacheOnDisk(true)// 设置下载的图片是否缓存在SD卡中
.displayer(new FadeInBitmapDisplayer(100))// 是否图片加载好后渐入的动画时间
.imageScaleType(ImageScaleType.IN_SAMPLE_INT).build();// 构建完成
}
if (popupWindow == null) {
popupWindow = new PopupWindow(mContext);
popupWindow.setContentView(this);
}
}
/**
* 设置图片并显示
* @param anchorView
* @param adMatter
*/
public void show(View anchorView, ADMatter adMatter) {
mAnchorView = anchorView;
mADMatter = adMatter;
countDownNum = adMatter.getTimeSize();
refresh();
//暂停图片广告不需要倒计时,是点击开始按钮继续
if (ADMatter.LOCATION_PAUSE.equals(adMatter.getLocation())) {
mStartBtn.setVisibility(View.VISIBLE);
mCountDown.setVisibility(View.GONE);
} else {
mStartBtn.setVisibility(View.GONE);
mCountDown.setVisibility(View.VISIBLE);
handler.removeMessages(COUNT_DOWN);
handler.sendEmptyMessageDelayed(COUNT_DOWN, 1000);
}
}
/**
* 重新设置控件
*/
public void refresh() {
int[] location = new int[2];
mAnchorView.getLocationInWindow(location);
Rect anchorRect = new Rect(location[0], location[1], location[0] + mAnchorView.getWidth(), location[1] + mAnchorView.getHeight());
popupWindow.setWidth(mAnchorView.getWidth());
popupWindow.setHeight(mAnchorView.getHeight());
popupWindow.showAtLocation(mAnchorView, Gravity.NO_GRAVITY, 0, anchorRect.top);
ImageLoader.getInstance().displayImage(mADMatter.getMatterUrl(), mAdvertisementImage, mOptions, new AnimateFirstDisplayListener());
mCountDown.setText(String.valueOf(countDownNum));
}
/**
* 是否在显示中
* @return
*/
public boolean isShowing() {
return popupWindow.isShowing();
}
/**
* 隐藏
*/
public void hide() {
Drawable drawable = mAdvertisementImage.getDrawable();
if (drawable != null && drawable instanceof BitmapDrawable) {
Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
if (bitmap != null && bitmap.isRecycled() == false) {
bitmap.recycle();
bitmap = null;
}
}
mAdvertisementImage.setImageBitmap(null);
popupWindow.dismiss();
System.gc();
if (handler != null) {
handler.removeMessages(COUNT_DOWN);
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
super.onTouchEvent(event);
return true;
}
}
| [
"[email protected]"
] | |
cbc53cb02835c3a828d03de261d94c80fd235905 | a0292155dc93032ae013ae2d71b52be3049f0824 | /javaee-study/ee-study/src/main/java/free/mapper/ArticleMapper.java | 6678b922e200ca47bc1f4393e0f4c12e403ca182 | [] | no_license | xiashashafree/MyCode | 7c185114904fd5a7f78516cc4d90853d18b68cc6 | 69c8166f917b271a930e63fc985cb55b5bb6b71d | refs/heads/master | 2020-08-23T05:05:40.640654 | 2020-06-29T14:38:00 | 2020-06-29T14:38:00 | 216,549,103 | 0 | 0 | null | 2020-07-02T03:41:06 | 2019-10-21T11:16:20 | JavaScript | UTF-8 | Java | false | false | 303 | java | package free.mapper;
import free.model.Article;
import java.util.List;
public interface ArticleMapper {
int deleteByPrimaryKey(Integer id);
int insert(Article record);
Article selectByPrimaryKey(Integer id);
List<Article> selectAll();
int updateByPrimaryKey(Article record);
} | [
"[email protected]"
] | |
bc53e253f124373ca7290f6ea19dd9fe9774661b | 2f8cc7bce0734e9728d05aba825ab6ce68251027 | /src/main/java/tasks/ir_a_login.java | a09fb09c39ed52d785af882b54cef3b59741f5de | [] | no_license | janz376/azureSerenity | 2428079365eb1db11ddc92aecfd9c1b479a81733 | 387ca3939ad44861271c4666a6806696e62f0a94 | refs/heads/master | 2021-03-16T20:28:45.573836 | 2020-03-12T22:14:20 | 2020-03-12T22:14:20 | 246,939,714 | 0 | 0 | null | 2020-10-13T20:18:59 | 2020-03-12T22:12:20 | Java | UTF-8 | Java | false | false | 352 | java | package tasks;
import net.serenitybdd.screenplay.Task;
import net.serenitybdd.screenplay.actions.Click;
import static ui.cabecera_global_de_barra_navegacion.getPantallaLogin;
public class ir_a_login {
public static Task called () {
return Task.where("Go To Login screen",
Click.on(getPantallaLogin()));
}
} | [
"[email protected]"
] | |
b97c0cddbe8219eb2bdf2ae8d7c8e86da141fe09 | 81a07c7d172a587d226eb47130560fd597df19b7 | /src/main/java/com/example/demo/model/bean/mall/Wishlist.java | dda3eb62b964f61a5b1d0754ceeb63e3f63d3c66 | [] | no_license | symanwula/housecalldemo | 12d850368e38e642e80f3096a915c5222c98f1b1 | d5b8ba26f1fac62dcd316fe2084c55a0d39dd0c6 | refs/heads/master | 2023-06-18T16:00:10.120054 | 2021-07-14T08:23:01 | 2021-07-14T08:23:01 | 385,850,401 | 0 | 0 | null | 2021-07-14T08:23:01 | 2021-07-14T07:21:15 | JavaScript | UTF-8 | Java | false | false | 1,653 | java | package com.example.demo.model.bean.mall;
import java.util.Date;
import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import com.example.demo.model.bean.user.UserBean;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@DynamicInsert
@DynamicUpdate
@AssociationOverrides({
@AssociationOverride(name = "primaryKey.user", joinColumns = @JoinColumn(name = "userId")),
@AssociationOverride(name = "primaryKey.product", joinColumns = @JoinColumn(name = "productId"))
})
public class Wishlist {
@EmbeddedId
private WishlistId primaryKey = new WishlistId();
@Temporal(TemporalType.DATE)
@Column(nullable = false)
@CreationTimestamp
private Date createDate;
@Transient
private Integer tempProductId;
@Transient
private Integer tempUserId;
@Transient
public UserBean getUser() {
return getPrimaryKey().getUser();
}
public void setUser(UserBean user) {
getPrimaryKey().setUser(user);
}
@Transient
public Product getProduct() {
return getPrimaryKey().getProduct();
}
public void setProduct(Product product) {
getPrimaryKey().setProduct(product);
}
}
| [
"[email protected]"
] | |
e5b362122ea2310caf3d5263952a8bd546015021 | 10c7597a8f999d4ebc1d6d8a6b173141e8f3246c | /app/src/main/java/com/example/appointmentapp/MainActivity.java | e6748142558da56f4c4a605add8de679f19e6b4b | [] | no_license | Hitesh-Puri/Appointment-App | 22e3d982c1cd229f2111aa6ed0176d83ecc85117 | 1347e82dc98c7bd959be2fcc55b760b88e329fbf | refs/heads/main | 2023-02-01T04:42:21.957080 | 2020-12-15T08:25:34 | 2020-12-15T08:25:34 | 321,600,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,132 | java | package com.example.appointmentapp;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.app.ActivityOptions;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Pair;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
public static int SPLASH_SCREEN=3000;
Animation topAnim,bottomAnim;
ImageView image;
TextView name, tagging;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//FOR REMOVING STATUS BAR FROM TOP
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
//animations
topAnim= AnimationUtils.loadAnimation(this,R.anim.top_animation);
bottomAnim= AnimationUtils.loadAnimation(this,R.anim.bottom_animation);
//hooks
image= findViewById(R.id.logo);
name= findViewById(R.id.display);
tagging = findViewById(R.id.tag);
image.setAnimation(topAnim);
name.setAnimation(bottomAnim);
tagging.setAnimation(bottomAnim);
//FOR LINKING THIS MAIN ACTIVITY TO THE NEXT LOGIN ACTIVITY
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(MainActivity.this,Login.class);
// Attach all the elements those you want to animate in design
Pair[] pairs=new Pair[2];
pairs[0]=new Pair<View,String>(image,"logo2");
pairs[1]=new Pair<View,String>(name,"hello");
ActivityOptions options=ActivityOptions.makeSceneTransitionAnimation(MainActivity.this,pairs);
startActivity(intent, options.toBundle());
}
},SPLASH_SCREEN);
}
} | [
"[email protected]"
] | |
4cb51cd9f523b097ed5cdbf8f7b0d710670e6dec | 9a0aec57360028ecd24d7831170af3f1de15a2fb | /src/day26/SwappingValures.java | 1e3df62435f66927788d24d537ed07f0e8103562 | [] | no_license | SafarEkberli/JavaProgrammingB15Online1 | 10ef4ba5007c202455dad8ba7ff111e21d61619b | 18ee4c1cca57e0798a5566365eee2108760a079a | refs/heads/master | 2020-12-02T09:20:21.167609 | 2019-12-30T18:06:22 | 2019-12-30T18:06:22 | 230,959,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 602 | java | package day26;
public class SwappingValures {
public static void main(String[] args) {
String name1= "Emma";
String name2 = " Jason";
String tempContainer = name1;
name1=name2;
name2=tempContainer;
System.out.println("name1 = " + name1);
System.out.println("name2 = "+ name2);
int[] myNumbers= {10,40,30,7};
int temp = myNumbers[0];
myNumbers[0]= myNumbers[3];
myNumbers[3]=temp;
System.out.println("first item "+ myNumbers[0]);
System.out.println("last item"+ myNumbers[3]);
}
}
| [
"[email protected]"
] | |
0934f10e838a6eb1aa82beb176d8dd212bfff932 | 7bc00f604debcb1a04193798b1607bae7d4a2b79 | /2020_01_23/src/과제/과제/Home02_03.java | 2718912f6a2067effb90eb56399b10ed384d2579 | [] | no_license | Yujin309/U | 49b6ae2bdfa749d121fb70b2f48efcf2e97a773b | 845777deba2893fd8c3d0110de0bee84dac1a310 | refs/heads/master | 2021-01-04T09:31:25.616552 | 2020-02-14T11:06:44 | 2020-02-14T11:06:44 | 240,489,608 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 80 | java | package °úÁ¦;
public class Home02_03 {
public interface.Ishop
{
}
}
| [
"[email protected]"
] | |
5c573404021e1907f5617a7cfdb4668ae9d049f1 | 3a24cb44e7978b65237a03bb407297856b450c6e | /Java/Programacion3/Animacion/Vista/IDibujo.java | 4bcf95f4dd31b58db0596fe816697ae0140dc59f | [] | no_license | LuisDiegoCF/MisPrimerosProyectos | 8b29ac49ef7c4a57f3a5ad8a0a8d4eab05cbddad | 7e235b0edd530a53b8a3c079045d77549c0c1615 | refs/heads/master | 2023-05-07T08:31:27.661358 | 2021-06-01T11:25:38 | 2021-06-01T11:25:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 112 | java | package Animacion.Vista;
import java.awt.*;
public interface IDibujo {
public void dibujar(Graphics g);
}
| [
"[email protected]"
] | |
00299542bccef91a722cb8c2effd871faa51f2f0 | e304b9cd2840b35c484540289dda475d900c1052 | /new-api-gateway/src/main/java/com/open/capacity/client/filter/RateLimitFilter.java | 1bf5e97cbbf608e86d6651107f7e119ad3302299 | [
"Apache-2.0"
] | permissive | pq1518110364/open-capacity-platform | 9ce7b380e71ea01e594a4775df84477df8ef982f | feb46e49c496bd9aea8908fc577d6773f50a0619 | refs/heads/master | 2022-07-01T06:35:54.500928 | 2020-01-07T06:39:38 | 2020-01-07T06:39:38 | 232,259,768 | 2 | 1 | Apache-2.0 | 2022-06-21T02:35:27 | 2020-01-07T06:39:07 | JavaScript | UTF-8 | Java | false | false | 5,415 | java | package com.open.capacity.client.filter;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.stereotype.Component;
import org.springframework.util.AntPathMatcher;
import org.springframework.web.server.ServerWebExchange;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.open.capacity.client.service.impl.SysClientServiceImpl;
import com.open.capacity.client.utils.RedisLimiterUtils;
import com.open.capacity.common.web.Result;
import com.open.capacity.redis.util.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import reactor.core.publisher.Mono;
/**
* Created by owen on 2018/12/10. 根据应用 url 限流 oauth_client_details if_limit 限流开关
* limit_count 阈值
*/
@Slf4j
@Component
public class RateLimitFilter implements GlobalFilter, Ordered {
// url匹配器
private final AntPathMatcher pathMatcher = new AntPathMatcher();
@Resource
private RedisUtil redisUtil;
@Resource
private RedisTemplate<String, Object> redisTemplate ;
@Autowired
private RedisLimiterUtils redisLimiterUtils;
@Autowired
private ObjectMapper objectMapper;
@Resource
SysClientServiceImpl sysClientServiceImpl;
@Override
public int getOrder() {
return -500;
}
/**
* 1. 判断token是否有效
* 2. 如果token有对应clientId
* 2.1 判断clientId是否有效
* 2.2 判断请求的服务service是否有效
* 2.3 判断clientId是否有权限访问service
* 3. 判断 clientId+service 每日限流
* @param exchange
* @param accessToken
* @return
*/
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
String accessToken = extractToken(exchange.getRequest());
if (!checkRateLimit(exchange, accessToken)) {
log.error("TOO MANY REQUESTS!");
exchange.getResponse().setStatusCode(HttpStatus.TOO_MANY_REQUESTS);
ServerHttpResponse response = exchange.getResponse();
JSONObject message = new JSONObject();
message.put("resp_code", -1);
message.put("resp_msg", "TOO MANY REQUESTS!");
byte[] bits = message.toJSONString().getBytes(StandardCharsets.UTF_8);
DataBuffer buffer = response.bufferFactory().wrap(bits);
response.setStatusCode(HttpStatus.TOO_MANY_REQUESTS);
//指定编码,否则在浏览器中会中文乱码
response.getHeaders().add("Content-Type", "application/json;charset=UTF-8");
return response.writeWith(Mono.just(buffer));
}
return chain.filter(exchange);
}
private String extractToken(ServerHttpRequest request) {
List<String> strings = request.getHeaders().get("Authorization");
String authToken = null;
if (strings != null) {
authToken = strings.get(0).substring("Bearer".length()).trim();
}
if (StringUtils.isBlank(authToken)) {
strings = request.getQueryParams().get("access_token");
if (strings != null) {
authToken = strings.get(0);
}
}
return authToken;
}
private Boolean checkRateLimit(ServerWebExchange exchange, String accessToken) {
try {
String reqUrl = exchange.getRequest().getPath().value();
// 1. 按accessToken查找对应的clientId
Map<String, Object> params = (Map<String, Object>) redisTemplate.opsForValue().get("token:" + accessToken) ;
//
if(params!=null){
String clientId = String.valueOf(params.get("clientId")) ;
Map client = sysClientServiceImpl.getClient(clientId);
if(client!=null){
String flag = String.valueOf(client.get("if_limit") ) ;
if("1".equals(flag)){
String accessLimitCount = String.valueOf(client.get("limit_count") ) ;
if (!accessLimitCount.isEmpty()) {
Result result = redisLimiterUtils.rateLimitOfDay(clientId, reqUrl ,
Long.parseLong(accessLimitCount));
if (-1 == result.getResp_code()) {
log.error("token:" + accessToken + result.getResp_msg());
// ((ResultMsg)
// this.error_info.get()).setMsg("clientid:" +
// client_id + ":token:" + accessToken + ":" +
// result.getMsg());
// ((ResultMsg) this.error_info.get()).setCode(401);
return false;
}
}
}
}
}
} catch (Exception e) {
StackTraceElement stackTraceElement= e.getStackTrace()[0];
log.error("checkRateLimit:" + "---|Exception:" +stackTraceElement.getLineNumber()+"----"+ e.getMessage());
}
return true;
}
}
| [
"[email protected]"
] | |
f15786667512211abbcc1a3b275288d027792f47 | f54092f10560bec64db7cccef3053e7a932b7dc7 | /android/app/src/main/java/com/brwcodexarcanum/MainApplication.java | 0d78453876576e014fad7ee9ba2176c3c0038816 | [
"MIT"
] | permissive | dejawho/BrwCodexArcanum | 95d6387f1e2e11e987a8f66141d3b45da27f70a3 | ba2f1d0b6e14dd013b2c419fc97a7c77c2edb6c8 | refs/heads/master | 2023-01-23T15:35:39.663030 | 2020-06-28T16:38:05 | 2020-06-28T16:38:05 | 219,503,365 | 0 | 0 | MIT | 2023-01-05T00:05:31 | 2019-11-04T13:04:15 | JavaScript | UTF-8 | Java | false | false | 2,357 | java | package com.brwcodexarcanum;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this); // Remove this line if you don't want Flipper enabled
}
/**
* Loads Flipper in React Native templates.
*
* @param context
*/
private static void initializeFlipper(Context context) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
1bc0238e4a9cd2f28797878825a2cc15eaa360a3 | f3bf13101bfa0a9b8c3363684de9fcd7d0e35de6 | /examples/tasks/src/test/java/org/jboss/seam/rest/example/tasks/ftest/TaskPage.java | 51dc6fa036a269a638bc9f48c730632d4b73b3c3 | [] | no_license | maschmid/rest | be1be2a1b41ba8437d421d8f3316a2f48c3f8eb8 | c2e00bbd866c55e1c82bb0e4f371b545bc24d943 | refs/heads/master | 2021-01-16T20:11:41.638737 | 2011-02-16T13:01:14 | 2011-02-16T13:01:14 | 1,373,680 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,461 | java | /*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat, Inc., and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.seam.rest.example.tasks.ftest;
import java.net.URL;
import org.jboss.test.selenium.framework.AjaxSelenium;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.locator.option.OptionLocator;
import org.jboss.test.selenium.locator.option.OptionValueLocator;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.waitXhr;
import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.locator.option.OptionLocatorFactory.optionValue;
/**
* Page object for the tasks page (tasks.html)
* @author <a href="http://community.jboss.org/people/jharting">Jozef Hartinger</a>
*
*/
public class TaskPage extends AbstractPage
{
public static final JQueryLocator NEW_TASK_NAME_FIELD = jq("#editTaskName");
public static final JQueryLocator NEW_TASK_CATEGORY_SELECT = jq("#editTaskCategory");
public static final JQueryLocator NEW_TASK_SUBMIT = jq("#editTaskSubmit");
public static final JQueryLocator TASK_BY_NAME = jq(".name:contains('{0}')");
public static final JQueryLocator TASK_BY_ID_AND_CATEGORY = jq("#{0} ~ #{1}:first .name");
public static final JQueryLocator TASK_DONE_BUTTON = jq("#{0} img:first");
public static final JQueryLocator TASK_DELETE_BUTTON = jq("#{0} img:last");
public static final JQueryLocator TASK_EDIT_BUTTON = jq("#{0} img:nth-child(2)");
public static final JQueryLocator TASK_EDIT_FORM = jq("#{0} .updateTask");
public static final JQueryLocator TASK_EDIT_NAME_FIELD = jq("#{0} .nameField");
public static final JQueryLocator TASK_EDIT_CATEGORY_SELECT = jq("#{0} #editTaskCategory");
public static final OptionLocator<OptionValueLocator> TASK_CATEGORY_OPTION = optionValue("{0}");
public static final JQueryLocator TASK_EDIT_UPDATE_BUTTON = jq("#{0} #update");
public TaskPage(AjaxSelenium selenium, URL contextPath)
{
super(selenium, contextPath);
reload();
}
@Override
public String getPageSuffix()
{
return "tasks.html";
}
public void newTask(String name, String category)
{
selenium.type(NEW_TASK_NAME_FIELD, name);
selenium.select(NEW_TASK_CATEGORY_SELECT, TASK_CATEGORY_OPTION.format(category));
waitXhr(selenium).click(NEW_TASK_SUBMIT);
}
public boolean isTaskPresent(String taskName)
{
return selenium.isElementPresent(TASK_BY_NAME.format(taskName));
}
public boolean isTaskPresent(String categoryName, int taskId)
{
return selenium.isElementPresent(TASK_BY_ID_AND_CATEGORY.format(categoryName, taskId));
}
public boolean isTaskPresent(String categoryName, int taskId, String taskName)
{
return isTaskPresent(categoryName, taskId) && selenium.getText(TASK_BY_ID_AND_CATEGORY.format(categoryName, taskId)).equals(taskName);
}
public void resolveTask(int id)
{
waitXhr(selenium).click(TASK_DONE_BUTTON.format(id));
}
public void editTask(int id, String taskName, String categoryName)
{
selenium.click(TASK_EDIT_BUTTON.format(id));
waitForJQuery();
selenium.type(TASK_EDIT_NAME_FIELD.format(id), taskName);
// for some reason we need to hit the select first
selenium.isElementPresent(TASK_EDIT_CATEGORY_SELECT.format(id));
selenium.select(TASK_EDIT_CATEGORY_SELECT.format(id), TASK_CATEGORY_OPTION.format(categoryName));
waitXhr(selenium).click(TASK_EDIT_UPDATE_BUTTON.format(id));
}
public void removeTask(int id)
{
waitXhr(selenium).click(TASK_DELETE_BUTTON.format(id));
}
public boolean isEditFormPresent(int id)
{
return selenium.isElementPresent(TASK_EDIT_FORM.format(id));
}
}
| [
"[email protected]"
] | |
45448d18081d9fa5e911af85aee8936c2c11bc30 | b9536a191739385b0c5c0bbac12c0b4dfdea501b | /src/main/java/com/bigdata/content/service/FileUploadService.java | f00359662b2c4bd878ecd4901787f40110ad692d | [] | no_license | mengboy/graduationproject | c04914c03c112e35f0ab8c8cda38fc33d8039136 | c1aac5dae6d43d3b1abfb7542837a8989420763d | refs/heads/master | 2021-01-25T11:15:32.361698 | 2018-06-23T12:02:32 | 2018-06-23T12:02:32 | 123,386,466 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package com.bigdata.content.service;
import org.springframework.web.multipart.MultipartFile;
public interface FileUploadService {
public String saveFile(MultipartFile file, String path);
}
| [
"[email protected]"
] | |
69fb48499ae708685b850aa838fa71365f7d1bb2 | 83f647d6a98a085928645224b67cf472c23bdf83 | /Project10/src/Demointerface.java | 0b8947b673eefba5065a5cfd5cca324eac65bf17 | [] | no_license | Junaid-447/Java-Projects | 732cc170b88965cc77790018eca508c4d6f08a3d | 8ba416e14ff4e692df60b5865a95522afe6b35fe | refs/heads/master | 2021-07-11T02:06:01.661577 | 2021-03-15T20:57:58 | 2021-03-15T20:57:58 | 235,696,014 | 1 | 0 | null | 2020-01-31T19:19:32 | 2020-01-23T00:32:26 | null | UTF-8 | Java | false | false | 391 | java | interface showable
{
void show();
}
interface prinatable
{
void print();
}
public class Demointerface {
void show()
{
System.out.println("Show the output");
}
void print()
{
System.out.println("Print the output");
}
public static void main(String a[])
{
Demointerface a1=new Demointerface();
a1.show();
a1.print();
}
}
| [
"[email protected]"
] | |
3cea4a74f65ba82879c7d939f7c6ca1ac5c12f16 | 78f6365deb9dd8e9561a37f345ba1c81d92d8872 | /Chat/Database/src/main/java/com/jets/database/controller/IDatabaseConnection.java | 43b8f55e29a26831f1aded6235ecc8cd75d462dc | [] | no_license | M-Aly/JavaChatApp | 87831cf6c5f8450db334d94bead70d0b0b4dc290 | 2345d406451685baa7e0815ea509fe6bbf58895c | refs/heads/master | 2020-04-22T05:11:56.787947 | 2019-02-26T07:46:38 | 2019-02-26T07:46:38 | 170,151,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 370 | java | package com.jets.database.controller;
import java.sql.Connection;
/**
*
* @author Zainab
* @author Mohamed Ali
*/
public interface IDatabaseConnection {
/**
get a connection from the database
*/
public Connection getConnection();
/**
set automatic commit
*/
public void setAutoCommit(boolean autoCommit);
}
| [
"[email protected]"
] | |
7015ac738529619e332e0ce7719a3c2d538c6e3f | 923f2c50b623922c921755b9f9436cd5a08e6a29 | /estacionamento/src/main/java/projeto/pucgoias/estacionamento/controller/VeiculoController.java | bde89ac116bea5ae0653131e25c91fb123109699 | [] | no_license | pauloHenriqueTomaz/Estacionamento | 60993d7c12e70dafe7aab8e246ba5023457e53b6 | 3494e04ae13b6040140766500071f720363c5935 | refs/heads/master | 2020-03-20T12:25:30.855008 | 2018-06-18T16:29:47 | 2018-06-18T16:29:47 | 137,429,731 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 8,356 | java | package projeto.pucgoias.estacionamento.controller;
import java.util.ArrayList;
import java.util.List;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import projeto.pucgoias.estacionamento.controller.VeiculoBean;
import projeto.pucgoias.estacionamento.entidade.Veiculo;
import projeto.pucgoias.estacionamento.negocio.VeiculoService;
import projeto.pucgoias.estacionamento.util.VeiculoException;
/**
* Classe que controla as requisicoes do usuario web
* @author Paulo Henrique
*
*/
@ManagedBean(name="veiculoController")
/*libera a memoria mais rápido com isso temos uma aplicação que tende a escalar melhor. */
@RequestScoped
/*indica que uma classe particular serve como um controlador, atuando como um estereótipo para a classe anotada */
@Controller
public class VeiculoController {
/*Para marcar a injeção de suas dependencias @autowired */
@Autowired
private VeiculoBean veiculoBean;
@Autowired
private List<VeiculoBean> listaveiculoBean;
@Autowired
private VeiculoService veiculoService;
/**
* Construtor da classe de veiculo
*/
public VeiculoController(){
veiculoBean = new VeiculoBean();
}
/**
* Inclui um veiculo na base de dados
* @return
*/
public String incluir() {
try{
Veiculo veiculo = new Veiculo();
//preenche os dados da tela no objeto persistente
veiculo.setIdveiculo(veiculoBean.getIdveiculo());
veiculo.setDescVeiculo(veiculoBean.getDescVeiculo());
veiculo.setTempUso(veiculoBean.getTempUso());
veiculo.setLocVaga(veiculoBean.getLocVaga());
veiculo.setPlacVeiculo(veiculoBean.getPlacVeiculo());
veiculo.setDataEntrada(veiculoBean.getDataEntrada());
veiculo.setDataSaida(veiculoBean.getDataSaida());
veiculo.setValorPagar(veiculoBean.getTempUso()*5);
getVeiculoService().incluir(veiculo);
return "sucesso";
}
catch (Exception e) {
String msg = "Inclusao nao realizada. Motivo: " + e.getMessage();
FacesMessage message = new FacesMessage(msg);
this.getFacesContext().addMessage("formulario", message);
return "falha";
}
}
/**
* Lista os veiculos cadastradas
* @return
*/
public String listar() {
try{
List<Veiculo> listaveiculo = getVeiculoService().listar();
if(listaveiculo==null || listaveiculo.size()==0){
FacesMessage message = new FacesMessage("Nenhum registro encontrado.");
this.getFacesContext().addMessage("formulario", message);
}
//preeche a lista de veiculos da tela
listaveiculoBean = new ArrayList<VeiculoBean>();
for (Veiculo veiculo : listaveiculo) {
VeiculoBean veiculoBean = new VeiculoBean();
veiculoBean.setIdveiculo(veiculo.getIdveiculo());
veiculoBean.setDescVeiculo(veiculo.getDescVeiculo());
veiculoBean.setTempUso(veiculo.getTempUso());
veiculoBean.setLocVaga(veiculo.getLocVaga());
veiculoBean.setPlacVeiculo(veiculo.getPlacVeiculo());
veiculoBean.setDataEntrada(veiculo.getDataEntrada());
veiculoBean.setDataSaida(veiculo.getDataSaida());
veiculoBean.setValorPagar(veiculo.getTempUso()*5);
listaveiculoBean.add(veiculoBean);
}
return "listar";
}
catch (Exception e) {
e.printStackTrace();
String msg = "Listagem nao realizada. Motivo: " + ((e instanceof VeiculoException ? ((VeiculoException)e).getEx().getMessage():""));
FacesMessage message = new FacesMessage(msg);
this.getFacesContext().addMessage("formulario", message);
return "falha";
}
}
/**
* Consulta um veiculo cadastrado
* @return
*/
public String consultar() {
try{
String idveiculo = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("idveiculo");
Veiculo veiculo = getVeiculoService().consultar(Integer.valueOf(idveiculo));
if(veiculo==null || veiculo.getIdveiculo()==null){
FacesMessage message = new FacesMessage("Nenhum registro encontrado.");
this.getFacesContext().addMessage("formulario", message);
return "listar";
}
//preenche os dados do bean da tela
veiculoBean.setIdveiculo(veiculo.getIdveiculo());
veiculoBean.setDescVeiculo(veiculo.getDescVeiculo());
veiculoBean.setTempUso(veiculo.getTempUso());
veiculoBean.setLocVaga(veiculo.getLocVaga());
veiculoBean.setPlacVeiculo(veiculo.getPlacVeiculo());
veiculoBean.setDataEntrada(veiculo.getDataEntrada());
veiculoBean.setDataSaida(veiculo.getDataSaida());
veiculoBean.setValorPagar(veiculo.getTempUso()*5);
return "editar";
}
catch (Exception e) {
String msg = "Consulta nao realizada. Motivo: " + e.getMessage();
FacesMessage message = new FacesMessage(msg);
this.getFacesContext().addMessage("formulario", message);
return "falha";
}
}
/**
* Cria um novo veiculo
* @return
*/
public String criar() {
try{
veiculoBean = new VeiculoBean();
return "criar";
}
catch (Exception e) {
String msg = "Criacao nao realizada. Motivo: " + e.getMessage();
FacesMessage message = new FacesMessage(msg);
this.getFacesContext().addMessage("formulario", message);
return "falha";
}
}
/**
* Exclui um veiculo cadastrado
* @return
*/
public String excluir() {
try{
String idveiculo = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("idveiculo");
Veiculo veiculo = getVeiculoService().consultar(Integer.valueOf(idveiculo));
if(veiculo==null || veiculo.getIdveiculo()==null){
FacesMessage message = new FacesMessage("Nenhum registro encontrado.");
this.getFacesContext().addMessage("formulario", message);
return "listar";
}
getVeiculoService().excluir(veiculo.getIdveiculo());
return "sucesso";
}
catch (Exception e) {
e.printStackTrace();
String msg = "Exclusao nao realizada. Motivo: " + ((e instanceof VeiculoException ? ((VeiculoException)e).getEx().getMessage():""));
FacesMessage message = new FacesMessage(msg);
this.getFacesContext().addMessage("formulario", message);
return "falha";
}
}
/**
* Altera um veiculo cadastrado
* @return
*/
public String alterar() {
try{
Veiculo veiculo = getVeiculoService().consultar(veiculoBean.getIdveiculo());
if(veiculo==null || veiculo.getIdveiculo()==null){
FacesMessage message = new FacesMessage("Nenhum registro encontrado.");
this.getFacesContext().addMessage("formulario", message);
return "listar";
}
//preenche os dados da tela no objeto persistente
veiculo.setIdveiculo(veiculoBean.getIdveiculo());
veiculo.setDescVeiculo(veiculoBean.getDescVeiculo());
veiculo.setTempUso(veiculoBean.getTempUso());
veiculo.setLocVaga(veiculoBean.getLocVaga());
veiculo.setPlacVeiculo(veiculoBean.getPlacVeiculo());
veiculo.setDataEntrada(veiculoBean.getDataEntrada());
veiculo.setDataSaida(veiculoBean.getDataSaida());
veiculo.setValorPagar(veiculoBean.getTempUso()*5);
getVeiculoService().alterar(veiculo);
return "sucesso";
}
catch (Exception e) {
String msg = "Alteracao nao realizada. Motivo: " + ((e instanceof VeiculoException ? ((VeiculoException)e).getEx().getMessage():""));
FacesMessage message = new FacesMessage(msg);
this.getFacesContext().addMessage("formulario", message);
return "falha";
}
}
private FacesContext getFacesContext(){
return FacesContext.getCurrentInstance();
}
public VeiculoBean getVeiculoBean() {
return veiculoBean;
}
public void setVeiculoBean(VeiculoBean veiculoBean) {
this.veiculoBean = veiculoBean;
}
public List<VeiculoBean> getListaveiculoBean() {
return listaveiculoBean;
}
public void setListaveiculoBean(List<VeiculoBean> listaveiculoBean) {
this.listaveiculoBean = listaveiculoBean;
}
public VeiculoService getVeiculoService() {
return veiculoService;
}
public void setVeiculoService(VeiculoService veiculoService) {
this.veiculoService = veiculoService;
}
}
| [
"[email protected]"
] | |
aad0906e72c184d5e4345cfe50fcf5042549635d | 57dd575933f88bb394530513a290190d090d64cb | /projects/dailyenglish/src/main/java/com/hyron/presentation/utils/Page.java | 78afdd3b6a05ef070ded9d74e8f5b9cb691d67b4 | [] | no_license | uo2p/mi | 9c693d0e8a189287ece6a25b4b981c15a1001fb5 | a72eba179b629bc526d38d9f9622838c117a6c06 | refs/heads/master | 2021-01-10T21:59:41.467036 | 2014-01-27T01:19:48 | 2014-01-27T01:19:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 924 | java | package com.hyron.presentation.utils;
public class Page {
private int rowsPerPage;
private int totalRecords;
private int recordOffset;
private String visibility;
private boolean local;
public Page(){
}
public int getRowsPerPage() {
return rowsPerPage;
}
public void setRowsPerPage(int rowsPerPage) {
this.rowsPerPage = rowsPerPage;
}
public int getTotalRecords() {
return totalRecords;
}
public void setTotalRecords(int totalRecords) {
this.totalRecords = totalRecords;
}
public int getRecordOffset() {
return recordOffset;
}
public void setRecordOffset(int recordOffset) {
this.recordOffset = recordOffset;
}
public String getVisibility() {
return visibility;
}
public void setVisibility(String visibility) {
this.visibility = visibility;
}
public boolean isLocal() {
return local;
}
public void setLocal(boolean local) {
this.local = local;
}
}
| [
"[email protected]"
] | |
d13bb90d10a5000c30296624d22ab25733e25e85 | 678547eb8ea837db52a90f3ae7355ec4e98d75aa | /src/main/java/com/hzst/oaCenterService/mapper/SysMapper.java | 1650f0a5b4c964cfcc3e7d76c134464ae3420fef | [] | no_license | 5mFiveMeter/oacenter_s | 2e31bc941394d0ca793f5f433968c615d5ee1e8e | 217c623e4f3fee3876ae38dcef4d71921ea96ec6 | refs/heads/master | 2022-06-30T01:23:40.611625 | 2020-03-18T09:23:03 | 2020-03-18T09:23:03 | 247,019,563 | 2 | 0 | null | 2022-06-21T02:58:52 | 2020-03-13T08:11:58 | Java | UTF-8 | Java | false | false | 278 | java | package com.hzst.oaCenterService.mapper;
import com.hzst.oaCenterService.entity.Sys;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author wm
* @since 2020-03-16
*/
public interface SysMapper extends BaseMapper<Sys> {
}
| [
"[email protected]"
] | |
92d71a9d866f897ae5521f6f0a73da8fbeeee390 | c1e2cf3de7eca4b0fdc69703b221ce6e2620c2c4 | /src/main/java/com/leetcode/demo/array/L011MostWater.java | 2d35215f277baf0436e1ecda73aa29c768f8e094 | [] | no_license | gaoyuanyuan2/leetcode | b8700a8a94a5c0b2f5f07834aaa59c5d314c78e3 | 6e277cf1496a8815edf08f5a5d86a0c190df60fd | refs/heads/main | 2023-06-20T05:47:10.443221 | 2021-07-18T14:08:46 | 2021-07-18T14:08:46 | 347,562,156 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package com.leetcode.demo.array;
public class L011MostWater {
public int maxArea(int[] height) {
int left = 0, right = height.length - 1;
int max = 0;
while (left < right) {
max = Math.max(max, (right - left) * Math.min(height[right],
height[left]));
if (height[left] < height[right]) {
left++;
} else {
right--;
}
}
return max;
}
} | [
"[email protected]"
] | |
eca37fc9dbc03aa1220c16e3cc3e579133ae8c1e | c11b3a3a2909c185f349843531061581272bbcd3 | /src/main/java/z38/Main.java | cb6f903ae1f9c33495a5c64482ff9bf562140c59 | [] | no_license | MikiKru/javaadv_programming | 02ef2533021afa18133d055509690fd2b5dfccfc | 770cc6f430ecc8cc53362e7dc27a4dcc3cee3e7c | refs/heads/master | 2022-11-24T21:35:15.210144 | 2020-08-01T20:00:17 | 2020-08-01T20:00:17 | 282,399,397 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 581 | java | package z38;
public class Main {
public static void main(String[] args) {
CoffeeMachine coffeeMachine = new CoffeeMachine(5);
Thread thread = new Thread(new CoffeeMachineMaker(coffeeMachine));
thread.start();
while(true) {
try {
thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Thread thread1 = new Thread(new CoffeeMachineFiller(coffeeMachine));
thread1.start();
System.out.println("===");
}
}
}
| [
"[email protected]"
] | |
b6f35f4e0f98ae9d2a093726ede6842496ea3bf3 | 2ccea3393ea41668aeb787ac0ce306e3a20d59b2 | /src/main/java/com/example/demo/math/service/MathServiceImpl.java | 3e475f453ce45e4faa7b77d6ae08d2f68b4cfb20 | [] | no_license | lmn165/bitcamp-spring-boot | 5174dc3ec11b42a239a3d4c1c9485e2832e63156 | e78ac61de69658cae4531c754a469928e27aa7f5 | refs/heads/main | 2023-06-16T19:46:14.785936 | 2021-07-16T07:27:01 | 2021-07-16T07:27:01 | 382,279,444 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,333 | java | package com.example.demo.math.service;
import com.example.demo.math.domain.MathDTO;
public class MathServiceImpl implements MathService {
@Override
public int add(MathDTO calculator) {
return calculator.getNum1() + calculator.getNum2();
}
@Override
public int subtract(MathDTO calculator) {
return calculator.getNum1() - calculator.getNum2();
}
@Override
public int multiple(MathDTO calculator) {
return calculator.getNum1() * calculator.getNum2();
}
@Override
public int divide(MathDTO calculator) {
return calculator.getNum1() / calculator.getNum2();
}
@Override
public int remain(MathDTO calculator) {
return calculator.getNum1() % calculator.getNum2();
}
@Override
public int[] sequence(MathDTO calculator) {
int[] arr = new int[calculator.getNum2()-calculator.getNum1()+1];
for (int i=0, j=calculator.getNum1(); j <= calculator.getNum2(); i++, j++){
arr[i] = j;
}
return arr;
}
@Override
public int[] sequence2(MathDTO calculator) {
int[] arr = new int[10];
int i = 0;
for (int j=1; j <= 10; j++){
arr[i] = j;
i++;
// System.out.print(i + "\t"); // \t : 탭
}
return arr;
}
}
| [
"[email protected]"
] | |
d85df09002b71e244ee54992540b13c6a4ec66e5 | e73c25c8c5489780b763f1f3f03e8f1558a9014a | /src/main/java/com/tencentcloudapi/ecm/v20190719/EcmClient.java | c6e6ad3ac2a10e9cf18b8d4904a7741f6b083f76 | [
"Apache-2.0"
] | permissive | jangocheng/tencentcloud-sdk-java | e5b0eb782431a7637b7f470a4590a6191b23a9dd | 46643a0f993fa61e42977f25db0c76c8b95a8c64 | refs/heads/master | 2021-05-19T23:46:50.902374 | 2020-04-01T01:49:42 | 2020-04-01T01:49:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,486 | java | /*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.tencentcloudapi.ecm.v20190719;
import java.lang.reflect.Type;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.AbstractClient;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.JsonResponseModel;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.ecm.v20190719.models.*;
public class EcmClient extends AbstractClient{
private static String endpoint = "ecm.tencentcloudapi.com";
private static String version = "2019-07-19";
public EcmClient(Credential credential, String region) {
this(credential, region, new ClientProfile());
}
public EcmClient(Credential credential, String region, ClientProfile profile) {
super(EcmClient.endpoint, EcmClient.version, credential, region, profile);
}
/**
*创建模块
* @param req CreateModuleRequest
* @return CreateModuleResponse
* @throws TencentCloudSDKException
*/
public CreateModuleResponse CreateModule(CreateModuleRequest req) throws TencentCloudSDKException{
JsonResponseModel<CreateModuleResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<CreateModuleResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "CreateModule"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*删除镜像
* @param req DeleteImageRequest
* @return DeleteImageResponse
* @throws TencentCloudSDKException
*/
public DeleteImageResponse DeleteImage(DeleteImageRequest req) throws TencentCloudSDKException{
JsonResponseModel<DeleteImageResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<DeleteImageResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "DeleteImage"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*删除业务模块
* @param req DeleteModuleRequest
* @return DeleteModuleResponse
* @throws TencentCloudSDKException
*/
public DeleteModuleResponse DeleteModule(DeleteModuleRequest req) throws TencentCloudSDKException{
JsonResponseModel<DeleteModuleResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<DeleteModuleResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "DeleteModule"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*获取概览页统计的基本数据
* @param req DescribeBaseOverviewRequest
* @return DescribeBaseOverviewResponse
* @throws TencentCloudSDKException
*/
public DescribeBaseOverviewResponse DescribeBaseOverview(DescribeBaseOverviewRequest req) throws TencentCloudSDKException{
JsonResponseModel<DescribeBaseOverviewResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<DescribeBaseOverviewResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "DescribeBaseOverview"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*获取带宽硬盘等数据的限制
* @param req DescribeConfigRequest
* @return DescribeConfigResponse
* @throws TencentCloudSDKException
*/
public DescribeConfigResponse DescribeConfig(DescribeConfigRequest req) throws TencentCloudSDKException{
JsonResponseModel<DescribeConfigResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<DescribeConfigResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "DescribeConfig"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*展示镜像列表
* @param req DescribeImageRequest
* @return DescribeImageResponse
* @throws TencentCloudSDKException
*/
public DescribeImageResponse DescribeImage(DescribeImageRequest req) throws TencentCloudSDKException{
JsonResponseModel<DescribeImageResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<DescribeImageResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "DescribeImage"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*获取机型配置列表
* @param req DescribeInstanceTypeConfigRequest
* @return DescribeInstanceTypeConfigResponse
* @throws TencentCloudSDKException
*/
public DescribeInstanceTypeConfigResponse DescribeInstanceTypeConfig(DescribeInstanceTypeConfigRequest req) throws TencentCloudSDKException{
JsonResponseModel<DescribeInstanceTypeConfigResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<DescribeInstanceTypeConfigResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "DescribeInstanceTypeConfig"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*获取实例的相关信息。
* @param req DescribeInstancesRequest
* @return DescribeInstancesResponse
* @throws TencentCloudSDKException
*/
public DescribeInstancesResponse DescribeInstances(DescribeInstancesRequest req) throws TencentCloudSDKException{
JsonResponseModel<DescribeInstancesResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<DescribeInstancesResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "DescribeInstances"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*通过实例id获取当前禁止的操作
* @param req DescribeInstancesDeniedActionsRequest
* @return DescribeInstancesDeniedActionsResponse
* @throws TencentCloudSDKException
*/
public DescribeInstancesDeniedActionsResponse DescribeInstancesDeniedActions(DescribeInstancesDeniedActionsRequest req) throws TencentCloudSDKException{
JsonResponseModel<DescribeInstancesDeniedActionsResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<DescribeInstancesDeniedActionsResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "DescribeInstancesDeniedActions"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*获取模块列表
* @param req DescribeModuleRequest
* @return DescribeModuleResponse
* @throws TencentCloudSDKException
*/
public DescribeModuleResponse DescribeModule(DescribeModuleRequest req) throws TencentCloudSDKException{
JsonResponseModel<DescribeModuleResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<DescribeModuleResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "DescribeModule"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*展示模块详细信息
* @param req DescribeModuleDetailRequest
* @return DescribeModuleDetailResponse
* @throws TencentCloudSDKException
*/
public DescribeModuleDetailResponse DescribeModuleDetail(DescribeModuleDetailRequest req) throws TencentCloudSDKException{
JsonResponseModel<DescribeModuleDetailResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<DescribeModuleDetailResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "DescribeModuleDetail"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*获取节点列表
* @param req DescribeNodeRequest
* @return DescribeNodeResponse
* @throws TencentCloudSDKException
*/
public DescribeNodeResponse DescribeNode(DescribeNodeRequest req) throws TencentCloudSDKException{
JsonResponseModel<DescribeNodeResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<DescribeNodeResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "DescribeNode"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*CPU 内存 硬盘等基础信息峰值数据
* @param req DescribePeakBaseOverviewRequest
* @return DescribePeakBaseOverviewResponse
* @throws TencentCloudSDKException
*/
public DescribePeakBaseOverviewResponse DescribePeakBaseOverview(DescribePeakBaseOverviewRequest req) throws TencentCloudSDKException{
JsonResponseModel<DescribePeakBaseOverviewResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<DescribePeakBaseOverviewResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "DescribePeakBaseOverview"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*获取网络峰值数据
* @param req DescribePeakNetworkOverviewRequest
* @return DescribePeakNetworkOverviewResponse
* @throws TencentCloudSDKException
*/
public DescribePeakNetworkOverviewResponse DescribePeakNetworkOverview(DescribePeakNetworkOverviewRequest req) throws TencentCloudSDKException{
JsonResponseModel<DescribePeakNetworkOverviewResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<DescribePeakNetworkOverviewResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "DescribePeakNetworkOverview"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*修改实例的属性。
* @param req ModifyInstancesAttributeRequest
* @return ModifyInstancesAttributeResponse
* @throws TencentCloudSDKException
*/
public ModifyInstancesAttributeResponse ModifyInstancesAttribute(ModifyInstancesAttributeRequest req) throws TencentCloudSDKException{
JsonResponseModel<ModifyInstancesAttributeResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<ModifyInstancesAttributeResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "ModifyInstancesAttribute"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*ModifyModuleImage
* @param req ModifyModuleImageRequest
* @return ModifyModuleImageResponse
* @throws TencentCloudSDKException
*/
public ModifyModuleImageResponse ModifyModuleImage(ModifyModuleImageRequest req) throws TencentCloudSDKException{
JsonResponseModel<ModifyModuleImageResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<ModifyModuleImageResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "ModifyModuleImage"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*修改模块名称
* @param req ModifyModuleNameRequest
* @return ModifyModuleNameResponse
* @throws TencentCloudSDKException
*/
public ModifyModuleNameResponse ModifyModuleName(ModifyModuleNameRequest req) throws TencentCloudSDKException{
JsonResponseModel<ModifyModuleNameResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<ModifyModuleNameResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "ModifyModuleName"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*修改模块默认带宽上限
* @param req ModifyModuleNetworkRequest
* @return ModifyModuleNetworkResponse
* @throws TencentCloudSDKException
*/
public ModifyModuleNetworkResponse ModifyModuleNetwork(ModifyModuleNetworkRequest req) throws TencentCloudSDKException{
JsonResponseModel<ModifyModuleNetworkResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<ModifyModuleNetworkResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "ModifyModuleNetwork"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*只有状态为RUNNING的实例才可以进行此操作;接口调用成功时,实例会进入REBOOTING状态;重启实例成功时,实例会进入RUNNING状态;支持强制重启,强制重启的效果等同于关闭物理计算机的电源开关再重新启动。强制重启可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常重启时使用。
* @param req RebootInstancesRequest
* @return RebootInstancesResponse
* @throws TencentCloudSDKException
*/
public RebootInstancesResponse RebootInstances(RebootInstancesRequest req) throws TencentCloudSDKException{
JsonResponseModel<RebootInstancesResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<RebootInstancesResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "RebootInstances"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*重装实例,若指定了ImageId参数,则使用指定的镜像重装;否则按照当前实例使用的镜像进行重装;若未指定密码,则密码通过站内信形式随后发送。
* @param req ResetInstancesRequest
* @return ResetInstancesResponse
* @throws TencentCloudSDKException
*/
public ResetInstancesResponse ResetInstances(ResetInstancesRequest req) throws TencentCloudSDKException{
JsonResponseModel<ResetInstancesResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<ResetInstancesResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "ResetInstances"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*重置实例的最大带宽上限。
* @param req ResetInstancesMaxBandwidthRequest
* @return ResetInstancesMaxBandwidthResponse
* @throws TencentCloudSDKException
*/
public ResetInstancesMaxBandwidthResponse ResetInstancesMaxBandwidth(ResetInstancesMaxBandwidthRequest req) throws TencentCloudSDKException{
JsonResponseModel<ResetInstancesMaxBandwidthResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<ResetInstancesMaxBandwidthResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "ResetInstancesMaxBandwidth"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
/**
*销毁实例
* @param req TerminateInstancesRequest
* @return TerminateInstancesResponse
* @throws TencentCloudSDKException
*/
public TerminateInstancesResponse TerminateInstances(TerminateInstancesRequest req) throws TencentCloudSDKException{
JsonResponseModel<TerminateInstancesResponse> rsp = null;
try {
Type type = new TypeToken<JsonResponseModel<TerminateInstancesResponse>>() {
}.getType();
rsp = gson.fromJson(this.internalRequest(req, "TerminateInstances"), type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException(e.getMessage());
}
return rsp.response;
}
}
| [
"[email protected]"
] | |
c3ecffbc887b5289ec322df7ecc0aa278e6ddb22 | f38aca8b52123f39ccca67bc04e7a923b0e561b3 | /babynote/src/cn/year11/babynote/app/DayListItem.java | d6d4e095d89d8481fc2e776fa206675420be95b5 | [] | no_license | xulubo/babynotes | 2049b9ec5726fb2a71d6e0b22e2a05b5d7f2440a | 75e9e8750c0021ff68d7381bd22510add31457e7 | refs/heads/master | 2021-03-12T20:44:32.658387 | 2013-07-03T20:53:40 | 2013-07-03T20:53:40 | 11,161,135 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,028 | java | package cn.year11.babynote.app;
import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.content.Intent;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import android.widget.TextView;
import cn.year11.babynote.R;
import com.babycenter.pregnancytracker.common.Artifact;
import com.babycenter.pregnancytracker.common.Day;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.Locale;
public class DayListItem implements TodayListItem, View.OnFocusChangeListener {
private static final int MAX_ARTIFACTS_PER_DAY = 3;
private final Day day;
private boolean isCurrentDay = false;
private boolean isInCurrentWeek = false;
private boolean isWeekLast = false;
public DayListItem(Day paramDay) {
this.day = paramDay;
}
private void applyFonts(Activity paramActivity,
ArtifactViewHolder paramArtifactViewHolder) {
Typeface localTypeface = Typeface.createFromAsset(
paramActivity.getAssets(), "fonts/Georgia.ttf");
paramArtifactViewHolder.artifactTeaser.setTypeface(localTypeface);
paramArtifactViewHolder.artifactTitleLabel.setTypeface(localTypeface);
}
private String getImageAssetPathFromUrl(String paramString)
throws MalformedURLException {
String[] arrayOfString = new URL(paramString).getPath().split("/");
return "images/thumbnails/"
+ arrayOfString[(arrayOfString.length - 1)].replaceAll(
".je*pg", ".png");
}
private Bitmap getThumbnailFromUrl(String paramString,
AssetManager paramAssetManager) throws IOException {
return BitmapFactory.decodeStream(paramAssetManager
.open(getImageAssetPathFromUrl(paramString)));
}
private void resetArtifactContainer(LinearLayout paramLinearLayout) {
paramLinearLayout.setOnClickListener(null);
ArtifactViewHolder localArtifactViewHolder = (ArtifactViewHolder) paramLinearLayout
.getTag();
localArtifactViewHolder.rightOuterContainer.setPadding(0, 8, 0, 8);
localArtifactViewHolder.isFirst = false;
localArtifactViewHolder.artifactDivider.setVisibility(8);
localArtifactViewHolder.artifactTitleLabel.setMinimumHeight(0);
localArtifactViewHolder.daysTogoLabel.setVisibility(8);
localArtifactViewHolder.artifactCategoryLabel.setText("");
localArtifactViewHolder.artifactCategoryLabel.setVisibility(8);
localArtifactViewHolder.artifactTeaser.setText("");
localArtifactViewHolder.artifactTeaser.setVisibility(8);
localArtifactViewHolder.artifactTitleLabel.setText("");
localArtifactViewHolder.artifactTitleLabel.setVisibility(8);
localArtifactViewHolder.artifactThumbnail.setVisibility(8);
localArtifactViewHolder.dayLabel.setText("");
localArtifactViewHolder.dayLabel.setVisibility(8);
localArtifactViewHolder.activityCheckbox.setVisibility(8);
}
public boolean blockViewRecycling() {
return false;
}
public int getLayoutId() {
return R.layout.todaylist_day;
}
public View getView(TodayActivity paramTodayActivity, View paramView,
ViewGroup paramViewGroup) {
LinearLayout dayViewLayout;
int i;
View.OnClickListener onClickListener;
int j;
LinearLayout dayListItemLayout;
ArtifactViewHolder localArtifactViewHolder;
if (paramView == null) {
i = 0;
dayViewLayout = (LinearLayout) paramTodayActivity
.getLayoutInflater().inflate(getLayoutId(), paramViewGroup,
false);
} else {
i = 1;
dayViewLayout = (LinearLayout) paramView;
}
if (!isCurrentDay()) {
dayViewLayout
.setBackgroundResource(R.drawable.shape_bg_current_day);
} else if (isInCurrentWeek()) {
dayViewLayout.setBackgroundResource(R.color.background_blue);
} else {
dayViewLayout.setBackgroundColor(0);
}
final TodayActivity todayActivity = paramTodayActivity;
onClickListener = new View.OnClickListener() {
public void onClick(View paramView) {
DayListItem.ArtifactViewHolder localArtifactViewHolder = (DayListItem.ArtifactViewHolder) paramView
.getTag();
if (5 == localArtifactViewHolder.artifactType)
DayListItem.this.playVideoId(todayActivity,
localArtifactViewHolder.artifactId);
if (4 == localArtifactViewHolder.artifactType) {
DayListItem.this.showImageArtifact(todayActivity,
localArtifactViewHolder.artifactId);
}
DayListItem.this.showArtifactId(todayActivity,
localArtifactViewHolder.artifactId);
}
};
int totalArtifacts = this.day.artifacts.size();
for (j = 0; j < totalArtifacts; j++) {
if (j >= 3)
break;
dayListItemLayout = (LinearLayout) dayViewLayout.getChildAt(j);
if (i == 0) {
// break label174;
localArtifactViewHolder = new ArtifactViewHolder();
CheckBox localCheckBox1 = (CheckBox) dayListItemLayout
.findViewById(R.id.activity_checkbox);
localArtifactViewHolder.activityCheckbox = localCheckBox1;
TextView localTextView1 = (TextView) dayListItemLayout
.findViewById(R.id.day_label);
localArtifactViewHolder.dayLabel = localTextView1;
TextView localTextView2 = (TextView) dayListItemLayout
.findViewById(R.id.artifact_category_label);
localArtifactViewHolder.artifactCategoryLabel = localTextView2;
TextView localTextView3 = (TextView) dayListItemLayout
.findViewById(R.id.artifact_title_label);
localArtifactViewHolder.artifactTitleLabel = localTextView3;
TextView localTextView4 = (TextView) dayListItemLayout
.findViewById(R.id.artifact_teaser);
localArtifactViewHolder.artifactTeaser = localTextView4;
ImageView localImageView1 = (ImageView) dayListItemLayout
.findViewById(R.id.artifact_thumbnail);
localArtifactViewHolder.artifactThumbnail = localImageView1;
ImageView localImageView2 = (ImageView) dayListItemLayout
.findViewById(R.id.artifact_divider);
localArtifactViewHolder.artifactDivider = localImageView2;
LinearLayout localLinearLayout3 = (LinearLayout) dayListItemLayout
.findViewById(R.id.day_right_outer_container);
localArtifactViewHolder.rightOuterContainer = localLinearLayout3;
TextView localTextView5 = (TextView) dayListItemLayout
.findViewById(R.id.days_togo_label);
localArtifactViewHolder.daysTogoLabel = localTextView5;
applyFonts(paramTodayActivity, localArtifactViewHolder);
dayListItemLayout.setTag(localArtifactViewHolder);
dayListItemLayout.setOnFocusChangeListener(this);
} else {
resetArtifactContainer(dayListItemLayout);
localArtifactViewHolder = (ArtifactViewHolder) dayListItemLayout
.getTag();
}
dayListItemLayout.setVisibility(8);
Artifact localArtifact;
// label406:
ImageView thumbnailImageView = null;
if (j > 0) {
localArtifactViewHolder.rightOuterContainer.setPadding(0, 0, 0,
8);
localArtifactViewHolder.artifactDivider.setVisibility(0);
}
localArtifact = (Artifact) this.day.artifacts.get(j);
dayListItemLayout.setVisibility(0);
dayListItemLayout.setClickable(true);
int m = localArtifact.artifactType;
localArtifactViewHolder.artifactType = m;
long l = localArtifact.id;
localArtifactViewHolder.artifactId = l;
dayListItemLayout.setOnClickListener(onClickListener);
// PregnancyTrackerApplication localPregnancyTrackerApplication
// =
// (PregnancyTrackerApplication)paramTodayActivity.getApplication();
// boolean bool =
// localPregnancyTrackerApplication.getChecklistItemState(localArtifact.id);
// localArtifactViewHolder.activityCheckbox.setOnCheckedChangeListener(null);
// localArtifactViewHolder.activityCheckbox.setChecked(bool);
// CheckBox localCheckBox2 = localArtifactViewHolder.activityCheckbox;
/*
* 2 local2 = new CompoundButton.OnCheckedChangeListener(
* localPregnancyTrackerApplication, localArtifact) { public void
* onCheckedChanged(CompoundButton paramCompoundButton, boolean
* paramBoolean) {
* this.val$application.setChecklistItemState(this.val$a.id,
* paramBoolean); } };
* localCheckBox2.setOnCheckedChangeListener(local2);
*/
if (j == 0) {
localArtifactViewHolder.dayLabel.setVisibility(0);
localArtifactViewHolder.dayLabel
.setText(this.day.formattedDate);
}
if ((Artifact.ACTIVITY_TYPE == localArtifact.artifactType)
|| (Artifact.REMINDER_TYPE == localArtifact.artifactType))
localArtifactViewHolder.activityCheckbox.setVisibility(0);
if ((localArtifact.category != null)
&& (localArtifact.category.length() > 0)
&& (localArtifact.artifactType != Artifact.REMINDER_TYPE)
&& (localArtifact.artifactType != Artifact.VIDEO_TYPE)
&& (localArtifact.artifactType != Artifact.IMAGE_TYPE)) {
TextView categoryLabelTextView = localArtifactViewHolder.artifactCategoryLabel;
categoryLabelTextView.setText(localArtifact.category
.toUpperCase(Locale.getDefault()));
categoryLabelTextView.setVisibility(0);
}
if ((localArtifact.artifactType == Artifact.VIDEO_TYPE)
|| (localArtifact.artifactType == Artifact.IMAGE_TYPE)) {
thumbnailImageView = localArtifactViewHolder.artifactThumbnail;
}
try {
if (thumbnailImageView != null) {
thumbnailImageView.setImageBitmap(getThumbnailFromUrl(
localArtifact.thumbnail,
paramTodayActivity.getAssets()));
thumbnailImageView.setVisibility(0);
// label720:
thumbnailImageView.setScaleType(ImageView.ScaleType.FIT_XY);
}
if ((localArtifact.title != null)
&& (localArtifact.title.length() > 0)) {
TextView titleLabel = localArtifactViewHolder.artifactTitleLabel;
titleLabel.setText(localArtifact.title);
titleLabel.setVisibility(0);
}
if ((localArtifact.teaser == null)
|| (localArtifact.teaser.length() <= 0)
|| (localArtifact.artifactType == Artifact.REMINDER_TYPE))
continue;
TextView teaserTextView = localArtifactViewHolder.artifactTeaser;
teaserTextView.setText(localArtifact.teaser);
teaserTextView.setVisibility(0);
localArtifactViewHolder.isFirst = true;
if (!isCurrentDay()) {
} else {
localArtifactViewHolder.daysTogoLabel.setVisibility(0);
TextView daysTogoLabelTextView = localArtifactViewHolder.daysTogoLabel;
String str = paramTodayActivity
.getString(R.string.todayview_daystogo_n);
Object[] arrayOfObject = new Object[1];
arrayOfObject[0] = Integer.valueOf(this.day.daysToGo);
daysTogoLabelTextView.setText(String.format(str,
arrayOfObject));
}
// label897:
} catch (Exception localException) {
}
}
return dayViewLayout;
}
public boolean isCurrentDay() {
return this.isCurrentDay;
}
public boolean isEnabled() {
return true;
}
public boolean isInCurrentWeek() {
return this.isInCurrentWeek;
}
public boolean isWeekLast() {
return this.isWeekLast;
}
public void onFocusChange(View paramView, boolean paramBoolean) {
if ((paramBoolean) && (paramView.getVisibility() == 0))
paramView.setBackgroundResource(2131165198);
paramView.setBackgroundColor(0);
}
void playVideoId(Activity paramActivity, long paramLong) {
/*
* if
* (NetworkUtil.isNetworkAvailable(paramActivity.getApplicationContext
* ())) { Intent localIntent = new Intent(paramActivity,
* BcPlayerActivity.class); localIntent.putExtra("artifactId",
* paramLong); paramActivity.startActivity(localIntent); } while (true)
* { return; new
* AlertDialog.Builder(paramActivity).setMessage(2131230771
* ).setNeutralButton("Ok", null).show(); }
*/
}
public void setCurrentDay(boolean paramBoolean) {
this.isCurrentDay = paramBoolean;
setInCurrentWeek(true);
}
public void setInCurrentWeek(boolean paramBoolean) {
this.isInCurrentWeek = paramBoolean;
}
public void setWeekLast(boolean paramBoolean) {
this.isWeekLast = paramBoolean;
}
boolean showArtifactId(Activity paramActivity, long paramLong) {
/*
* Intent localIntent = new Intent(paramActivity,
* ArtifactDetailActivity.class); localIntent.putExtra("artifactId",
* paramLong); paramActivity.startActivity(localIntent);
*/
return true;
}
boolean showImageArtifact(Activity paramActivity, long paramLong) {
/*
* Intent localIntent = new Intent(paramActivity,
* ImageArtifactDetailActivity.class);
* localIntent.putExtra("artifactId", paramLong);
* paramActivity.startActivity(localIntent);
*/
return true;
}
public static class ArtifactViewHolder {
public CheckBox activityCheckbox;
public TextView artifactCategoryLabel;
public ImageView artifactDivider;
public long artifactId;
public TextView artifactTeaser;
public ImageView artifactThumbnail;
public TextView artifactTitleLabel;
public int artifactType;
public LinearLayout dayContainer;
public LinearLayout dayItemRightColumn;
public TextView dayLabel;
public LinearLayout dayRightInnerContainer;
public TextView daysTogoLabel;
public boolean isFirst;
public int rightColumnWidth;
public LinearLayout rightOuterContainer;
}
}
/*
* Location: C:\work\tools\android-decompile-tools\dex2jar\classes_dex2jar.jar
* Qualified Name: com.babycenter.pregnancytracker.app.DayListItem JD-Core
* Version: 0.6.0
*/ | [
"[email protected]"
] | |
c9fe8b23f0ea1484b544c86edc6c8bbd87f19991 | 9d9c0d9aba0c3102787a0215621b24dbe7f64b59 | /jeecms-front/src/main/java/com/jeecms/common/FrontDispatcherConfig.java | e7bbd76c71c96955087fe29c01508ad4fcb75548 | [] | no_license | hd19901110/jeecms1.4.1test | b354019c57a06384524d53aa667614c1f4e5a743 | 4e3e0cb31513e53004aa20c108f79741203becb0 | refs/heads/master | 2022-12-08T06:10:06.868825 | 2020-08-31T09:59:19 | 2020-08-31T09:59:19 | 285,445,431 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,388 | java | package com.jeecms.common;
import com.jeecms.front.config.FrontConfig;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
import javax.servlet.MultipartConfigElement;
/**
* 注册前端Dispatcher
*
* @author: tom
* @date: 2019年1月5日 下午2:06:38
* @Copyright: 江西金磊科技发展有限公司 All rights reserved.Notice
* 仅限于授权后使用,禁止非授权传阅以及私自用于商业目的。
*/
@Component
public class FrontDispatcherConfig {
/**
* 前端 DispatcherServlet bean
* @Title: frontDispatcherServlet
* @return: DispatcherServlet
*/
@Bean(name = "frontDispatcherServlet")
public DispatcherServlet frontDispatcherServlet() {
AnnotationConfigWebApplicationContext servletAppContext = new AnnotationConfigWebApplicationContext();
/*** 使用FrontConfig作为配置类 */
servletAppContext.register(FrontConfig.class);
DispatcherServlet dispatcherServlet = new DispatcherServlet(servletAppContext);
return dispatcherServlet;
}
/**
* 注册 前端 DispatcherServlet
* @Title: dispatcherServletRegistration
* @param multipartConfigProvider MultipartConfigElement
* @return: ServletRegistrationBean ServletRegistrationBean
*/
@Bean(name = "frontDispatcherServletRegistration")
public ServletRegistrationBean<DispatcherServlet> dispatcherServletRegistration(
ObjectProvider<MultipartConfigElement> multipartConfigProvider,DispatcherServlet frontDispatcherServlet) {
ServletRegistrationBean<DispatcherServlet> registration =
new ServletRegistrationBean<DispatcherServlet>(frontDispatcherServlet);
// 必须指定启动优先级,否则无法生效
registration.setLoadOnStartup(1);
registration.setName("frontDispatcherServlet");
// 注册上传配置对象,否则后台不能处理上传
/*MultipartConfigElement multipartConfig = multipartConfigProvider.getIfAvailable();
if (multipartConfig != null) {
registration.setMultipartConfig(multipartConfig);
}*/
return registration;
}
}
| [
"[email protected]"
] | |
88580c62c95d34fa64079135e2ac9efdb34f1024 | f5968cef90ba81cf508a95a7bdfa29ba146121a1 | /Lab8/src/test/java/tutorialspring4/controllers/ContextControllerTest.java | 974668f91cedf47715309a6dd694080846b5cf82 | [] | no_license | lifetofree/SpringBoot-Tutorial | 0176cdcd5ff5d9da34fcc3ac855796780aae2e20 | afea7c560527be157293bda4524f4617b9f3e03a | refs/heads/master | 2021-01-21T20:16:51.707851 | 2015-04-03T17:05:35 | 2015-04-03T17:05:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | package tutorialspring4.controllers;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.mock.web.MockServletContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = MockServletContext.class)
@WebAppConfiguration
@Ignore
public class ContextControllerTest {
}
| [
"[email protected]"
] | |
b07d127a4bc1c503cccf5f855c6ed7540cec8d49 | b664bae5e4d2d752aeee2c275590dabfa659b786 | /AppTemplate/src/main/java/rs/projecta/activity/Main_Activity.java | 0cc35097c91cae2961b9eea0ceaa84f4609c03b8 | [] | no_license | netssrmrz/coralracer | 60bb0804bac6565b57d70f8d3dd88bbed8fe53fe | bf81baaedbadfc90c72c1375ef8dd370c421f05e | refs/heads/master | 2021-07-04T15:23:27.511120 | 2020-09-04T04:32:27 | 2020-09-04T04:32:27 | 169,189,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,736 | java | package rs.projecta.activity;
public class Main_Activity
extends android.app.Activity
implements android.widget.Button.OnClickListener
{
public android.widget.LinearLayout list_view;
@Override
public void onCreate(android.os.Bundle saved_state)
{
android.widget.TextView text_view;
android.widget.Button button;
rs.projecta.level.Level level=null;
android.widget.LinearLayout.LayoutParams layout;
super.onCreate(saved_state);
this.requestWindowFeature(android.view.Window.FEATURE_NO_TITLE);
//level = rs.projecta.level.Level.Get(rs.projecta.level.Tutorial_Forward.class);
level = rs.projecta.level.Level.Get(rs.projecta.level.Tutorial_Accelerator.class);
list_view = new android.widget.LinearLayout(this);
list_view.setOrientation(android.widget.LinearLayout.VERTICAL);
list_view.setBackground(new rs.projecta.view.Wave_Drawable());
new rs.android.ui.Animate(list_view);
text_view=new android.widget.TextView(this);
text_view.setTextColor(0xff009900);
text_view.setTextSize(18);
text_view.setGravity(
android.view.Gravity.BOTTOM|android.view.Gravity.CENTER_HORIZONTAL);
list_view.addView(text_view,
new android.widget.LinearLayout.LayoutParams(
android.widget.LinearLayout.LayoutParams.MATCH_PARENT, 0, 90f)
);
layout=new android.widget.LinearLayout.LayoutParams(
android.widget.LinearLayout.LayoutParams.MATCH_PARENT, 0, 10f);
layout.setMargins(50, 50, 50, 50);
button = new android.widget.Button(this);
button.setTag(level.getClass().getName());
button.setOnClickListener(this);
button.setText("Start!");
button.setId(1);
list_view.addView(button, layout);
if (rs.projecta.Tilt_Manager.Has_Tilt_Sensors(this))
{
text_view.setText("Tilt the device left or right to maneuver.\n\n" + level.Get_Description());
}
else
{
text_view.setText("Touch the screen on the left or right to maneuver.\n\n" + level.Get_Description());
}
this.setContentView(list_view,
new android.widget.LinearLayout.LayoutParams(
android.widget.LinearLayout.LayoutParams.MATCH_PARENT,
android.widget.LinearLayout.LayoutParams.MATCH_PARENT, 1f)
);
}
@Override
public void onClick(android.view.View button)
{
android.content.Intent i;
String level_class;
rs.projecta.view.Wave_Drawable b;
b=(rs.projecta.view.Wave_Drawable)this.list_view.getBackground();
level_class = (String)button.getTag();
i = new android.content.Intent(this, Play_Activity.class);
i.setFlags(android.content.Intent.FLAG_ACTIVITY_NO_HISTORY);
i.putExtra("level_class", level_class);
this.startActivity(i);
}
}
| [
"[email protected]"
] | |
7bf79a548c976ce520380b1188b5552a9194e16f | 6b2ddd6bd54fb6c5fb95899cb36931a7f5d22c14 | /src/test/java/hw5/steps/HomePageSteps.java | c90f1871950eeaf2786ce47ced06fba6355c9663 | [] | no_license | maryvictol/MariiaTolstaia | 0b6513b6b92e7f400376b8b754609c44d4f066cc | 831f4379d41e565277b476abb8f070938fe02dd0 | refs/heads/master | 2023-05-10T21:02:22.353338 | 2020-02-17T14:34:09 | 2020-02-17T14:34:09 | 190,723,869 | 0 | 1 | null | 2023-05-09T18:08:52 | 2019-06-07T10:10:29 | Java | UTF-8 | Java | false | false | 2,869 | java | package hw5.steps;
import hw5.TestProvider;
import hw5.voids.BasePage;
import hw5.voids.HomePage;
import io.qameta.allure.Step;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.testng.asserts.SoftAssert;
import java.util.List;
import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.testng.Assert.assertEquals;
public class HomePageSteps extends BasePageSteps {
private HomePage homePage;
public HomePageSteps(WebDriver driver) {
super.driver = driver;
TestProvider.getInstance().setDriver(driver);
homePage = new HomePage(driver);
basePage = new BasePage(driver);
}
@Step("Check Displayed List of Images Elements")
public void checkDisplayedListOfImagesElements(int expectElementsNumber){
List<WebElement> elements = homePage.getImagesOnIndexPage();
assertThat(elements.size(), equalTo(expectElementsNumber));
SoftAssert softAssert = new SoftAssert();
for (WebElement icon : elements) {
softAssert.assertTrue(icon.isDisplayed());
}
softAssert.assertAll();
}
@Step("Check Iframe is Displayed")
public void checkIframeIsDisplayed(){
assertThat("",homePage.getIframe().isDisplayed());
}
@Step("Check List of Text Elements")
public void checkListOfTextElements(List<String> expectListElements) {
List<String> listElements = homePage.getTextUnderImagesOnIndexPage()
.stream()
.map(WebElement::getText)
.collect(Collectors.toList());
assertThat(listElements, equalTo(expectListElements));
}
@Step("Check Text First Main Header")
public void checkTextFirstMainHeader(String expectText) {
checkTextOnPage(homePage.getFirstMainHeader(), expectText);
}
@Step("Check Text Second Main Header")
public void checkTextSecondMainHeader(String expectText) {
checkTextOnPage(homePage.getSecondMainHeader(), expectText);
}
@Step("Check Text SubHeader")
public void checkTextSubHeader(String expectText) {
checkTextOnPage(homePage.getSubHeader(), expectText);
}
@Step("Check URL JDI Github Link")
public void checkURLJdiGithubLink(String expectText) {
assertEquals(homePage.getSubHeader().getAttribute("href"),expectText);
}
@Step("Switch to Frame")
public void switchToFrame() {
driver.switchTo().frame(homePage.getIframe());
}
@Step("Switch to Original Window Back")
public void switchToOriginalWindowBack() {
driver.switchTo().defaultContent();
}
@Step("Check Epam Logo is Displayed")
public void checkEpamLogoIsDisplayed(){
assertThat("",homePage.getEpamLogo().isDisplayed());
}
}
| [
"[email protected]"
] | |
9540d30bf75b77214a70290967590390eb721f68 | c44d27a2559f559a2f520ae25462a881d22f81f1 | /src/main/java/autocode/model/AutoCodeInfo.java | 414a095ff2664b14b78101b564d4593e3f69a587 | [] | no_license | wzf1200/mybatis-generator | 8826de70cfb65d1ce54d297308d1c69996af9edc | 9f561f28d9f1588105a35ac874477a0c451b53fa | refs/heads/master | 2020-03-17T02:53:27.981873 | 2017-11-07T10:12:36 | 2017-11-07T10:12:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,425 | java | /*
* $Id: AutoCodeInfo.java,v 1.1 2012/09/11 06:38:07 chenhua Exp $
*
* Copyright (c) 2010 ChinaSoft International, Ltd. All rights reserved
* ResourceOne BizFoundation Project
*
*/
package autocode.model;
import autocode.util.StringUtil;
/**
* 生成代码和相关配置文件时需要的一些属性值
*
* @author Rone BizFoudation Team: ganjp
* @version 4.3
* @since 4.3
*/
public class AutoCodeInfo {
private boolean useI18n;//是否使用国际化
private String encode = "UTF-8";//字符编码
private String moduleName;
private String basePackageName;
//vm模板路径
private String poVmFilePath;
private String daoVmFilePath;
private String restVmFilePath;
private String serviceVmFilePath;
private String serviceImplVmFilePath;
private String serviceTestVmFilePath;
private String controllerVmFilePath;
private String bizMvcVmFilePath;
private String viewListVmFilePath;
private String viewListJsVmFilePath;
private String viewNewVmFilePath;
private String viewNewJsVmFilePath;
private String viewUpdateVmFilePath;
private String viewUpdateJsVmFilePath;
private String viewShowVmFilePath;
private String viewShowJsVmFilePath;
private String i18nVmFilePath;
//java包名
private String poPackageName;
private String daoPackageName;
private String restPackageName;
private String servicePackageName;
private String serviceImplPackageName;
private String serviceTestPackageName;
private String controllerPackageName;
//生成后的java文件名称
private String poName;
private String daoName;
private String restName;
private String serviceName;
private String serviceImplName;
private String serviceTestName;
private String controllerName;
//生成后的文件路径(包括文件名称和文件类型)
private String poPath;
private String daoPath;
private String hbmPath;
private String restPath;
private String servicePath;
private String serviceImplPath;
private String serviceTestPath;
private String controllerPath;
//配置文件对应的路径(包括文件名称和文件类型)
private String srcSpringConfigPath;
private String testSpringConfigPath;
private String bizmvcConfigPath;
private String i18nConfigRelativePath;
private String[] i18nFileNames;
//页面文件对应的路径
private String viewListFilePath;
private String viewListJsPath;
private String viewNewFilePath;
private String viewNewJsPath;
private String viewUpdateFilePath;
private String viewUpdateJsPath;
private String viewShowFilePath;
private String viewShowJsPath;
public String getServiceVmFilePath() {
return serviceVmFilePath;
}
public void setServiceVmFilePath(String serviceVmFilePath) {
this.serviceVmFilePath = serviceVmFilePath;
}
public String getServiceImplVmFilePath() {
return serviceImplVmFilePath;
}
public void setServiceImplVmFilePath(String serviceImplVmFilePath) {
this.serviceImplVmFilePath = serviceImplVmFilePath;
}
public String getServiceTestVmFilePath() {
return serviceTestVmFilePath;
}
public void setServiceTestVmFilePath(String serviceTestVmFilePath) {
this.serviceTestVmFilePath = serviceTestVmFilePath;
}
public String getSrcSpringConfigPath() {
return srcSpringConfigPath;
}
public void setSrcSpringConfigPath(String srcSpringConfigPath) {
this.srcSpringConfigPath = srcSpringConfigPath;
}
public String getTestSpringConfigPath() {
return testSpringConfigPath;
}
public void setTestSpringConfigPath(String testSpringConfigPath) {
this.testSpringConfigPath = testSpringConfigPath;
}
public String getPoVmFilePath() {
return poVmFilePath;
}
public void setPoVmFilePath(String poVmFilePath) {
this.poVmFilePath = poVmFilePath;
}
public String getRestVmFilePath() {
return restVmFilePath;
}
public void setRestVmFilePath(String restVmFilePath) {
this.restVmFilePath = restVmFilePath;
}
public String getDaoVmFilePath() {
return daoVmFilePath;
}
public void setDaoVmFilePath(String daoVmFilePath) {
this.daoVmFilePath = daoVmFilePath;
}
public String getControllerVmFilePath() {
return controllerVmFilePath;
}
public void setControllerVmFilePath(String controllerVmFilePath) {
this.controllerVmFilePath = controllerVmFilePath;
}
public String getBizMvcVmFilePath() {
return bizMvcVmFilePath;
}
public void setBizMvcVmFilePath(String bizMvcVmFilePath) {
this.bizMvcVmFilePath = bizMvcVmFilePath;
}
public String getPoPackageName() {
return poPackageName;
}
public void setPoPackageName(String poPackageName) {
this.poPackageName = poPackageName;
}
public String getDaoPackageName() {
return daoPackageName;
}
public void setDaoPackageName(String daoPackageName) {
this.daoPackageName = daoPackageName;
}
public String getRestPackageName() {
return restPackageName;
}
public void setRestPackageName(String restPackageName) {
this.restPackageName = restPackageName;
}
public String getServicePackageName() {
return servicePackageName;
}
public void setServicePackageName(String servicePackageName) {
this.servicePackageName = servicePackageName;
}
public String getServiceImplPackageName() {
return serviceImplPackageName;
}
public void setServiceImplPackageName(String serviceImplPackageName) {
this.serviceImplPackageName = serviceImplPackageName;
}
public String getServiceTestPackageName() {
return serviceTestPackageName;
}
public void setServiceTestPackageName(String serviceTestPackageName) {
this.serviceTestPackageName = serviceTestPackageName;
}
public String getControllerPackageName() {
return controllerPackageName;
}
public void setControllerPackageName(String controllerPackageName) {
this.controllerPackageName = controllerPackageName;
}
public String getPoName() {
return poName;
}
public void setPoName(String poName) {
this.poName = poName;
}
public String getDaoName() {
return daoName;
}
public void setDaoName(String daoName) {
this.daoName = daoName;
}
public String getRestName() {
return restName;
}
public void setRestName(String restName) {
this.restName = restName;
}
public String getServiceName() {
return serviceName;
}
public void setServiceName(String serviceName) {
this.serviceName = serviceName;
}
public String getServiceImplName() {
return serviceImplName;
}
public void setServiceImplName(String serviceImplName) {
this.serviceImplName = serviceImplName;
}
public String getServiceTestName() {
return serviceTestName;
}
public void setServiceTestName(String serviceTestName) {
this.serviceTestName = serviceTestName;
}
public String getControllerName() {
return controllerName;
}
public void setControllerName(String controllerName) {
this.controllerName = controllerName;
}
public String getPoPath() {
return poPath;
}
public void setPoPath(String poPath) {
this.poPath = poPath;
}
public String getDaoPath() {
return daoPath;
}
public void setDaoPath(String daoPath) {
this.daoPath = daoPath;
}
public String getServicePath() {
return servicePath;
}
public void setServicePath(String servicePath) {
this.servicePath = servicePath;
}
public String getServiceImplPath() {
return serviceImplPath;
}
public void setServiceImplPath(String serviceImplPath) {
this.serviceImplPath = serviceImplPath;
}
public String getServiceTestPath() {
return serviceTestPath;
}
public void setServiceTestPath(String serviceTestPath) {
this.serviceTestPath = serviceTestPath;
}
public String getControllerPath() {
return controllerPath;
}
public void setControllerPath(String controllerPath) {
this.controllerPath = controllerPath;
}
public String getHbmPath() {
return hbmPath;
}
public void setHbmPath(String hbmPath) {
this.hbmPath = hbmPath;
}
public String getRestPath() {
return restPath;
}
public void setRestPath(String restPath) {
this.restPath = restPath;
}
public String getBizmvcConfigPath() {
return bizmvcConfigPath;
}
public void setBizmvcConfigPath(String bizmvcConfigPath) {
this.bizmvcConfigPath = bizmvcConfigPath;
}
public String getViewNewVmFilePath() {
return viewNewVmFilePath;
}
public void setViewNewVmFilePath(String viewNewVmFilePath) {
this.viewNewVmFilePath = viewNewVmFilePath;
}
public String getViewNewFilePath() {
return viewNewFilePath;
}
public void setViewNewFilePath(String viewNewFilePath) {
this.viewNewFilePath = viewNewFilePath;
}
public String getViewListVmFilePath() {
return viewListVmFilePath;
}
public void setViewListVmFilePath(String viewListVmFilePath) {
this.viewListVmFilePath = viewListVmFilePath;
}
public String getViewUpdateVmFilePath() {
return viewUpdateVmFilePath;
}
public void setViewUpdateVmFilePath(String viewUpdateVmFilePath) {
this.viewUpdateVmFilePath = viewUpdateVmFilePath;
}
public String getViewShowVmFilePath() {
return viewShowVmFilePath;
}
public void setViewShowVmFilePath(String viewShowVmFilePath) {
this.viewShowVmFilePath = viewShowVmFilePath;
}
public String getViewListFilePath() {
return viewListFilePath;
}
public void setViewListFilePath(String viewListFilePath) {
this.viewListFilePath = viewListFilePath;
}
public String getViewUpdateFilePath() {
return viewUpdateFilePath;
}
public void setViewUpdateFilePath(String viewUpdateFilePath) {
this.viewUpdateFilePath = viewUpdateFilePath;
}
public String getViewShowFilePath() {
return viewShowFilePath;
}
public void setViewShowFilePath(String viewShowFilePath) {
this.viewShowFilePath = viewShowFilePath;
}
public String getI18nVmFilePath() {
return i18nVmFilePath;
}
public void setI18nVmFilePath(String vmFilePath) {
i18nVmFilePath = vmFilePath;
}
public String getI18nConfigRelativePath() {
return i18nConfigRelativePath;
}
public void setI18nConfigRelativePath(String configRelativePath) {
i18nConfigRelativePath = configRelativePath;
}
public String[] getI18nFileNames() {
return i18nFileNames;
}
public void setI18nFileNames(String[] fileNames) {
i18nFileNames = fileNames;
}
public boolean isUseI18n() {
return useI18n;
}
public void setUseI18n(boolean useI18n) {
this.useI18n = useI18n;
}
public String getViewListJsPath() {
return viewListJsPath;
}
public void setViewListJsPath(String viewListJsPath) {
this.viewListJsPath = viewListJsPath;
}
public String getViewNewJsPath() {
return viewNewJsPath;
}
public void setViewNewJsPath(String viewNewJsPath) {
this.viewNewJsPath = viewNewJsPath;
}
public String getViewUpdateJsPath() {
return viewUpdateJsPath;
}
public void setViewUpdateJsPath(String viewUpdateJsPath) {
this.viewUpdateJsPath = viewUpdateJsPath;
}
public String getViewShowJsPath() {
return viewShowJsPath;
}
public void setViewShowJsPath(String viewShowJsPath) {
this.viewShowJsPath = viewShowJsPath;
}
public String getViewListJsVmFilePath() {
return viewListJsVmFilePath;
}
public void setViewListJsVmFilePath(String viewListJsVmFilePath) {
this.viewListJsVmFilePath = viewListJsVmFilePath;
}
public String getViewNewJsVmFilePath() {
return viewNewJsVmFilePath;
}
public void setViewNewJsVmFilePath(String viewNewJsVmFilePath) {
this.viewNewJsVmFilePath = viewNewJsVmFilePath;
}
public String getViewUpdateJsVmFilePath() {
return viewUpdateJsVmFilePath;
}
public void setViewUpdateJsVmFilePath(String viewUpdateJsVmFilePath) {
this.viewUpdateJsVmFilePath = viewUpdateJsVmFilePath;
}
public String getViewShowJsVmFilePath() {
return viewShowJsVmFilePath;
}
public void setViewShowJsVmFilePath(String viewShowJsVmFilePath) {
this.viewShowJsVmFilePath = viewShowJsVmFilePath;
}
public String getEncode() {
return encode;
}
public void setEncode(String encode) {
if(StringUtil.isBlank(encode)){
encode = "UTF-8";
}
this.encode = encode;
}
public String getModuleName() {
return moduleName;
}
public void setModuleName(String moduleName) {
this.moduleName = moduleName;
}
public String getBasePackageName() {
return basePackageName;
}
public void setBasePackageName(String basePackageName) {
this.basePackageName = basePackageName;
}
} | [
"[email protected]"
] | |
e0bfbd59b8020a62f90a75e1354ab4f614c7c383 | ed4b89333d3e312670b5291dd6273e72325e6e52 | /Phase2 Labs/LoginServletProject/src/main/java/org/yogesh/servlet/LoginController.java | 4814fe97c66793fb01fecf5cada75ba3f0f401ff | [] | no_license | git-yogeshsharma87/Spring | 5e301bf1191eeec0ba4239d9e56b434c5d82eaca | 0d04d0ff4169a5cdbeea781beb0edbf783a1a521 | refs/heads/master | 2023-08-25T10:44:49.209995 | 2021-11-02T22:36:19 | 2021-11-02T22:36:19 | 424,017,209 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,877 | java | package org.yogesh.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class LoginController
*/
@WebServlet("/LoginController")
public class LoginController extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public LoginController() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
*/
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Map<String,String> cred = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
cred.put("Tom","Jerry");
cred.put("Yog","San");
cred.put("Tim","Cook");
cred.put("Harry","potter");
cred.put("Welcome","Welcome@123");
cred.put("Test11","Test1121");
String username = request.getParameter("username");
String password = request.getParameter("password");
RequestDispatcher rd = null;
//if(username.equalsIgnoreCase("tom") && password.equals("jerry")) {
if (cred.containsKey(username) && cred.get(username).equals(password)) {
rd=request.getRequestDispatcher("SuccessServlet");
rd.forward(request, response);
} else {
rd=request.getRequestDispatcher("login.html");
PrintWriter out = response.getWriter();
rd.include(request, response);
out.println("<center><span style = 'color:red'> Invalid Credentials!!</span></center>");
}
}
}
| [
"[email protected]"
] | |
bfeb7d5ce9761cec507b2707fc318aebd42bf38b | 876b39031c58106cd289e3310b54746b512a46ef | /Acceleromter/app/build/generated/source/buildConfig/debug/com/javacodegeeks/androidaccelerometerexample/BuildConfig.java | 91b84b632ffa7edd9740553a9383a74d1f42f290 | [] | no_license | HoaiTV/Android-SensorApp | 8c96ff1dced77500d99a32a338346640c663cfdd | 14fadda626ad1afcfd2015824b44d5dd96766844 | refs/heads/master | 2020-04-16T13:38:59.426949 | 2020-04-04T02:26:56 | 2020-04-04T02:26:56 | 165,636,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 497 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.javacodegeeks.androidaccelerometerexample;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.javacodegeeks.androidaccelerometerexample";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"[email protected]"
] | |
e320105d2297f35b162b0ff35795f2840e7e2d7f | e92cda89f4a32f1e89d5862d0480d2e14c2d64ca | /teams/zephyr23_soldiers/Supply.java | 36e061ab24a7bc6521522727fff9e1dec47f2c08 | [] | no_license | TheDuck314/battlecode2015 | e2d29e518137c563c265f854a27faba2c78c16cf | 845e52bec1a7cb9f3f7f19a3415b5635d44a2fa6 | refs/heads/master | 2016-09-05T21:26:23.066985 | 2015-02-16T17:34:22 | 2015-02-16T17:34:22 | 28,834,784 | 14 | 5 | null | null | null | null | UTF-8 | Java | false | false | 15,042 | java | package zephyr23_soldiers;
import battlecode.common.*;
public class Supply extends Bot {
public static void shareSupply() throws GameActionException {
RobotInfo[] nearbyAllies = rc.senseNearbyRobots(GameConstants.SUPPLY_TRANSFER_RADIUS_SQUARED, us);
double mySupply = rc.getSupplyLevel();
int myUpkeep = rc.getType().supplyUpkeep;
double myTurnsOfSupplyLeft = mySupply / myUpkeep;
if (myTurnsOfSupplyLeft < 4) return; // no sense spending bytecodes sharing if there's not much to share
int resupplyDroneID = MessageBoard.RESUPPLY_DRONE_ID.readInt();
RobotInfo allyToSupply = null;
double minTurnsOfSupplyLeft = myTurnsOfSupplyLeft;
for (RobotInfo ally : nearbyAllies) {
if (needsSupply(ally.type) && ally.ID != resupplyDroneID) {
double allyTurnsOfSupplyLeft = ally.supplyLevel / ally.type.supplyUpkeep;
if (allyTurnsOfSupplyLeft < minTurnsOfSupplyLeft) {
minTurnsOfSupplyLeft = allyTurnsOfSupplyLeft;
allyToSupply = ally;
}
}
}
if (allyToSupply != null) {
double allySupply = allyToSupply.supplyLevel;
int allyUpkeep = allyToSupply.type.supplyUpkeep;
// we solve: (my supply - x) / (my upkeep) = (ally supply + x) / (ally upkeep)
double transferAmount = (mySupply * allyUpkeep - allySupply * myUpkeep) / (myUpkeep + allyUpkeep);
if (transferAmount > 20) {
// Debug.indicate("supply", 2, "transferring " + (int) transferAmount + " to " + allyToSupply.location.toString() + " to even things up");
rc.transferSupplies((int) transferAmount, allyToSupply.location);
}
}
}
// turn mod 3 = 0 -> bots compete to determine max supply need
// turn mod 3 = 1 -> resupply drone(s) read max supply need
// turn mod 3 = 2 -> resupply drone(s) reset max supply need comms channels
static int numTurnsSupplyRequestUnfulfilled = 0;
public static void requestResupplyIfNecessary() throws GameActionException {
if (Clock.getRoundNum() % 3 == 0) return; // can only request supply on certain turns
double travelTimeFromHQ = Math.sqrt(here.distanceSquaredTo(ourHQ));
// lookaheadTurns increases as our supply request remains unfulfilled, giving
// us higher and higher priority over time
double lookaheadTurns = 2.0 * travelTimeFromHQ;
int mySupplyNeeded = (int) (lookaheadTurns * rc.getType().supplyUpkeep - rc.getSupplyLevel());
if (mySupplyNeeded <= 0) {
numTurnsSupplyRequestUnfulfilled = 0;
return;
} else {
numTurnsSupplyRequestUnfulfilled++;
}
int totalSupplyUpkeepNearby = rc.getType().supplyUpkeep;
double totalSupplyNearby = rc.getSupplyLevel();
RobotInfo[] nearbyAllies = rc.senseNearbyRobots(GameConstants.SUPPLY_TRANSFER_RADIUS_SQUARED, us);
for (RobotInfo ally : nearbyAllies) {
totalSupplyUpkeepNearby += ally.type.supplyUpkeep;
totalSupplyNearby += ally.supplyLevel;
}
int supplyRequestSize = (int) ((lookaheadTurns + numTurnsSupplyRequestUnfulfilled) * totalSupplyUpkeepNearby - totalSupplyNearby);
// Debug.indicate("supply", 0, " supplyUpkeepNearby = " + totalSupplyUpkeepNearby + "; supplyNearby = " + totalSupplyNearby);
// Debug.indicate("supply", 1, "supply requestSize: " + supplyRequestSize + "; turns unfulfilled = " + numTurnsSupplyRequestUnfulfilled);
if (supplyRequestSize > MessageBoard.MAX_SUPPLY_NEEDED.readInt()) {
MessageBoard.MAX_SUPPLY_NEEDED.writeInt(supplyRequestSize);
MessageBoard.NEEDIEST_SUPPLY_LOC.writeMapLocation(here);
}
}
static MapLocation supplyRunnerDest = null;
static double supplyRunnerNeed = 0;
static boolean onSupplyRun = true;
static MapLocation supplyRunnerLastLoc = null;
static int supplyRunnerTurnsSinceMove = 0;
public static void runSupplies() throws GameActionException {
MessageBoard.RESUPPLY_DRONE_ID.writeInt(rc.getID());
if (here.equals(supplyRunnerLastLoc)) {
supplyRunnerTurnsSinceMove++;
if (supplyRunnerTurnsSinceMove >= 50 && here.distanceSquaredTo(ourHQ) > GameConstants.SUPPLY_TRANSFER_RADIUS_SQUARED) {
// System.out.println("supply runner disintegrating");
rc.disintegrate();
}
} else {
supplyRunnerTurnsSinceMove = 0;
}
supplyRunnerLastLoc = here;
// read supply needs
if (Clock.getRoundNum() % 3 == 1) {
supplyRunnerNeed = MessageBoard.MAX_SUPPLY_NEEDED.readInt();
if (supplyRunnerNeed > 0) {
supplyRunnerDest = MessageBoard.NEEDIEST_SUPPLY_LOC.readMapLocation();
// Debug.indicate("supply", 0, "max supply needed = " + supplyRunnerNeed + " at " + supplyRunnerDest.toString());
} else {
supplyRunnerDest = null;
// Debug.indicate("supply", 0, "no supply need");
}
}
// reset supply need comms channels
if (Clock.getRoundNum() % 3 == 2) {
MessageBoard.MAX_SUPPLY_NEEDED.writeInt(0);
}
if (supplyRunnerDest != null && here.distanceSquaredTo(supplyRunnerDest) < 35) {
if (supplyRunnerTransferSupplyAtDest()) {
onSupplyRun = false; // supplies have been dropped off; return to HQ
}
} else {
// try helping out whoever we encounter on the way to the main destination
supplyRunnerTryOpportunisticTransferSupply();
}
if (onSupplyRun) {
// call off a supply run if the need vanishes or if we run out of spare supply
if (supplyRunnerNeed == 0 || supplyRunnerSpareSupplyAmount() <= 0) {
onSupplyRun = false;
}
} else {
// start a supply run when there is need and we have enough supply to fulfill it
if (supplyRunnerNeed > 0) {
double supplyNeededForRun = supplyRunnerNeed + RobotType.DRONE.supplyUpkeep * Math.sqrt(ourHQ.distanceSquaredTo(supplyRunnerDest));
if (rc.getSupplyLevel() > supplyNeededForRun) {
onSupplyRun = true;
} else {
// rc.setIndicatorLine(here, supplyRunnerDest, 255, 0, 0);
}
}
}
MapLocation[] enemyTowers = rc.senseEnemyTowerLocations();
RobotInfo[] nearbyEnemies = rc.senseNearbyRobots(35, them);
if(supplyRunnerRetreatIfNecessary(nearbyEnemies, enemyTowers)) return;
NavSafetyPolicy safetyPolicy = new SafetyPolicyAvoidAllUnits(enemyTowers, nearbyEnemies);
if (onSupplyRun) {
NewNav.goTo(supplyRunnerDest, safetyPolicy);
// Debug.indicate("supply", 2, "going to supply dest");
// rc.setIndicatorLine(here, supplyRunnerDest, 0, 255, 0);
} else {
NewNav.goTo(ourHQ, safetyPolicy);
// Debug.indicate("supply", 2, "returning to HQ");
}
}
private static boolean supplyRunnerTransferSupplyAtDest() throws GameActionException {
int transferAmount = (int) supplyRunnerSpareSupplyAmount();
if (transferAmount <= 0) return true; // we didn't succeed but we are out of supply so it's like we succeeded
RobotInfo[] nearbyAllies = rc.senseNearbyRobots(GameConstants.SUPPLY_TRANSFER_RADIUS_SQUARED, us);
double minSupply = 1e99;
RobotInfo allyToSupply = null;
for (RobotInfo ally : nearbyAllies) {
if (needsSupply(ally.type)) {
if (ally.supplyLevel < minSupply) {
minSupply = ally.supplyLevel;
allyToSupply = ally;
}
}
}
if (allyToSupply != null) {
// Debug.indicate("supply", 1, "dropping off " + transferAmount + " supplies at destination");
rc.transferSupplies(transferAmount, allyToSupply.location);
return true;
} else {
return false;
}
}
// We're not at our main supply destination, but we give people we encounter
// on the way however much they need. However we don't give them all of our
// supply because we are saving it for the main destination.
private static void supplyRunnerTryOpportunisticTransferSupply() throws GameActionException {
RobotInfo[] nearbyAllies = rc.senseNearbyRobots(GameConstants.SUPPLY_TRANSFER_RADIUS_SQUARED, us);
double travelTimeFromHQ = Math.sqrt(here.distanceSquaredTo(ourHQ));
double transferAmount = 0;
RobotInfo transferTarget = null;
for (RobotInfo ally : nearbyAllies) {
if (needsSupply(ally.type)) {
double supplyNeed = 2 * travelTimeFromHQ * ally.type.supplyUpkeep - ally.supplyLevel;
if (supplyNeed > transferAmount) {
transferAmount = supplyNeed;
transferTarget = ally;
}
}
}
if (transferTarget != null) {
transferAmount = Math.min(transferAmount, supplyRunnerSpareSupplyAmount());
if (transferAmount > 1) {
// Debug.indicate("supply", 1, "opportunistically transferring " + transferAmount + " to " + transferTarget.location);
rc.transferSupplies((int) transferAmount, transferTarget.location);
}
}
}
private static double supplyRunnerSpareSupplyAmount() {
return rc.getSupplyLevel() - 2 * RobotType.DRONE.supplyUpkeep * Math.sqrt(here.distanceSquaredTo(ourHQ));
}
private static boolean needsSupply(RobotType rt) {
return !rt.isBuilding && rt != RobotType.BEAVER && rt != RobotType.MISSILE;
}
private static boolean needToRetreat(RobotInfo[] nearbyEnemies) {
for (RobotInfo enemy : nearbyEnemies) {
switch (enemy.type) {
case MISSILE:
if (here.distanceSquaredTo(enemy.location) <= 15) return true;
break;
case LAUNCHER:
if (here.distanceSquaredTo(enemy.location) <= 24) return true;
break;
default:
if (enemy.type.attackRadiusSquared >= here.distanceSquaredTo(enemy.location)) return true;
break;
}
}
return false;
}
private static boolean supplyRunnerRetreatIfNecessary(RobotInfo[] nearbyEnemies, MapLocation[] enemyTowers) throws GameActionException {
if(!needToRetreat(nearbyEnemies)) return false;
Direction bestRetreatDir = null;
RobotInfo currentClosestEnemy = Util.closest(nearbyEnemies, here);
boolean mustMoveOrthogonally = false;
if (rc.getCoreDelay() >= 0.6 && currentClosestEnemy.type == RobotType.MISSILE) mustMoveOrthogonally = true;
int bestDistSq = here.distanceSquaredTo(currentClosestEnemy.location);
for (Direction dir : Direction.values()) {
if (!rc.canMove(dir)) continue;
if (mustMoveOrthogonally && dir.isDiagonal()) continue;
MapLocation retreatLoc = here.add(dir);
if (inEnemyTowerOrHQRange(retreatLoc, enemyTowers)) continue;
RobotInfo closestEnemy = Util.closest(nearbyEnemies, retreatLoc);
int distSq = retreatLoc.distanceSquaredTo(closestEnemy.location);
if (distSq > bestDistSq) {
bestDistSq = distSq;
bestRetreatDir = dir;
}
}
if (bestRetreatDir != null) {
rc.move(bestRetreatDir);
return true;
}
return false;
}
static double hqLastSupply = 0;
static double hqSupplyReservedForResupplyDrone = 0;
static final double HQ_SUPPLY_DRONE_RESERVE_RATIO = 0.5;
static final double HQ_SUPPLY_TURN_BUILDUP_LIMIT = 100.0;
public static void hqGiveSupply() throws GameActionException {
// reserve a fraction of the supply just generated for the resupply drone
hqSupplyReservedForResupplyDrone += HQ_SUPPLY_DRONE_RESERVE_RATIO * BotHQ.totalSupplyGenerated;
// need to make sure vast amounts of supply don't build up unused if only the supply drone is visiting the HQ.
// so every turn a fraction of the unreserved supply is reserved for the drone
hqSupplyReservedForResupplyDrone += (rc.getSupplyLevel() - hqSupplyReservedForResupplyDrone) / HQ_SUPPLY_TURN_BUILDUP_LIMIT;
// Debug.indicate("supply", 0, "supply reserved for drone = " + hqSupplyReservedForResupplyDrone);
// feed the resupply drone if it's around
int resupplyDroneID = MessageBoard.RESUPPLY_DRONE_ID.readInt();
if (rc.canSenseRobot(resupplyDroneID)) {
MapLocation resupplyDroneLoc = rc.senseRobot(resupplyDroneID).location;
if (ourHQ.distanceSquaredTo(resupplyDroneLoc) <= GameConstants.SUPPLY_TRANSFER_RADIUS_SQUARED) {
// Debug.indicate("supply", 1, "transferring " + hqSupplyReservedForResupplyDrone + " to resupply drone");
rc.transferSupplies((int) hqSupplyReservedForResupplyDrone, resupplyDroneLoc);
hqSupplyReservedForResupplyDrone = 0;
}
}
// feed nearby robots whatever supply is not reserved for the resupply drone
RobotInfo[] nearbyAllies = rc.senseNearbyRobots(GameConstants.SUPPLY_TRANSFER_RADIUS_SQUARED, us);
double minTurnsOfSupplyLeft = 1e99;
RobotInfo allyToSupply = null;
for (RobotInfo ally : nearbyAllies) {
if (needsSupply(ally.type) && ally.ID != resupplyDroneID) {
double allyTurnsOfSupplyLeft = ally.supplyLevel / ally.type.supplyUpkeep;
if (allyTurnsOfSupplyLeft < minTurnsOfSupplyLeft) {
minTurnsOfSupplyLeft = allyTurnsOfSupplyLeft;
allyToSupply = ally;
}
}
}
if (allyToSupply != null) {
int transferAmount = (int) (rc.getSupplyLevel() - hqSupplyReservedForResupplyDrone);
if (transferAmount > 0) {
// Debug.indicate("supply", 2, "transferring " + transferAmount + " to " + allyToSupply.location.toString());
rc.transferSupplies(transferAmount, allyToSupply.location);
}
} else {
// Debug.indicate("supply", 0, "no non-drone to supply :(");
}
}
}
| [
"[email protected]"
] | |
22e65c995fae88365d1cfca247c5240a13324682 | bdbfcf1069c914f5c0ee49ae682a5a4398a93e40 | /src/day14_StringClass/combineTwoString.java | 48a4aefdf4362b69502dbbaafc4e5501f5958d70 | [] | no_license | akmammet/JavaPractice | f1db0584ef6360ce2c37b96998bc5bb2333246e9 | 1d40ae3494fe0e513a4a3e9e27b7f73d85985495 | refs/heads/master | 2022-04-24T02:55:44.038914 | 2020-04-25T17:28:14 | 2020-04-25T17:28:14 | 258,832,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | package day14_StringClass;
/*
1. Ask user to enter two words. Print the first word, second word, second word, first word
Input:
one
two
Output:
onetwotwoone
DO NOT USE + OPERATOR
*/
import java.util.Scanner;
public class combineTwoString {
public static void main(String[] args) {
Scanner scan =new Scanner(System.in);
System.out.println("enter first word");
String word1 =scan.next();
System.out.println("enter second word");
String word2= scan.next();
String result = word1.concat(word2).concat(word2).concat(word1);
System.out.println(result);
}
}
| [
"[email protected]"
] | |
171dbd1abac1f290b5a38a7893dfa146571473c3 | f763af9d7f3cb2d9015e512e353385bc5abc8318 | /CTCI-Ch3-StacksAndQueues-Ex1-ThreeStacksInOneArray/src/Demo.java | 3ef152b9e557f61641031db278ec48a4c178bcfa | [] | no_license | shonessy/Data_Structures_And_Algorithms_in_Java-AND-Programming_Interviews_Exposed | 18b66b5656cf577b88189fadad79c940800835f0 | c1c8fd74385fcae1ee2ec0b7e84a68de4bcbc2b6 | refs/heads/master | 2021-09-03T03:50:12.432391 | 2017-12-18T23:37:56 | 2017-12-18T23:37:56 | 109,734,362 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,295 | java |
public class Demo {
public static void main(String[] args) {
FixedSizeMultiStacks stack = new FixedSizeMultiStacks(3, 10);
stack.push(5, 1);
stack.push(10, 1);
stack.push(15, 1);
stack.push(20, 1);
stack.push(3, 2);
stack.push(6, 2);
stack.push(9, 2);
stack.push(12, 2);
stack.push(7, 3);
stack.push(14, 3);
stack.push(21, 3);
stack.push(28, 3);
System.out.println("Prvi Stack: ");
stack.displayStack(1);
System.out.println();
System.out.println("Drugi Stack: ");
stack.displayStack(2);
System.out.println();
System.out.println("Treci Stack: ");
stack.displayStack(3);
System.out.println();
System.out.println("Peek 1: " + stack.peek(1));
System.out.println("Peek 2: " + stack.peek(2));
System.out.println("Peek 3: " + stack.peek(3));
System.out.println();
System.out.println("Pop 1: " + stack.pop(1));
System.out.println("Peek 1: " + stack.peek(1));
stack.displayStack(1);
System.out.println();
System.out.println("Pop 2: " + stack.pop(2));
System.out.println("Peek 2: " + stack.peek(2));
stack.displayStack(2);
System.out.println();
System.out.println("Pop 3: " + stack.pop(3));
System.out.println("Peek 3: " + stack.peek(3));
stack.displayStack(3);
System.out.println();
}
}
| [
"[email protected]"
] | |
c44b203dc3475c2d973512f416eeb625ff79af89 | 40c41739fea8b4f050af4ce0a646ce33984d71ab | /src/main/java/com/springboot/rest/restservice/service/TaskService.java | 0825e3159711b9b14018ee4a52c2dafd9a953316 | [] | no_license | bayje8/project-manager-service | 1a7fcba18a872667ce1ba7a4e1dd8e3cbd037283 | 743b8f4d72265b56cacbe18bbfddafeddc07155f | refs/heads/master | 2020-04-27T05:09:42.060170 | 2019-04-02T05:32:49 | 2019-04-02T05:32:49 | 174,074,158 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,978 | java | package com.springboot.rest.restservice.service;
import java.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.springboot.rest.restservice.dto.TaskDTO;
import com.springboot.rest.restservice.entity.ParentTask;
import com.springboot.rest.restservice.entity.Task;
import com.springboot.rest.restservice.mapper.TaskDTOMapper;
import com.springboot.rest.restservice.repository.TaskRepository;
@Service
public class TaskService implements ITaskService {
@Autowired
private TaskRepository taskRepository;
@Autowired
private IParentTaskService parentTaskService;
@Autowired
private TaskDTOMapper mapper;
@Override
public List<TaskDTO> retrieveAllTasks(int projectId) {
List<TaskDTO> list = new ArrayList<TaskDTO>();
Optional<ParentTask> parentTask;
Iterable<Task> iterable = taskRepository.findAll();
for (Task task : iterable) {
if (task.getProject_id() == projectId) {
parentTask = parentTaskService.getParentTaskById(task.getParent_id());
if (parentTask.isPresent()) {
list.add(mapper.getTaskDTO(task, parentTask.get().getParent_task()));
} else {
list.add(mapper.getTaskDTO(task, ""));
}
}
}
return list;
}
@Override
public TaskDTO retrieveTaskById(int id) {
Task task = taskRepository.findById(id).get();
Optional<ParentTask> parenttask = parentTaskService.getParentTaskById(task.getParent_id());
if (parenttask.isPresent()) {
return mapper.getTaskDTO(task, parenttask.get().getParent_task());
} else {
return mapper.getTaskDTO(task, "");
}
}
@Override
public TaskDTO createTask(TaskDTO taskDto) {
Task task = mapper.getTask(taskDto);
taskRepository.save(task);
return taskDto;
}
@Override
public TaskDTO editTask(TaskDTO taskDto) {
Task task = mapper.getTask(taskDto);
taskRepository.save(task);
return taskDto;
}
@Override
public void deleteTask(int id) {
taskRepository.deleteById(id);
}
}
| [
"[email protected]"
] | |
cc1c40a2ba4e5958f28bcefc81ede062abac6caa | cfcaf63b3c25b30d3c383c9399b2f38c581eda86 | /leetcode_notes/leetcode_cn/0147.对链表进行插入排序/0147-对链表进行插入排序.java | 83d153d0e1c1397d0adf584420fc153b491e05e7 | [
"BSD-3-Clause"
] | permissive | robinali/java_notes | f361f525599495f8709691d60885a0a3faeb897b | b462c75851c1cd234b4027cd2b6181f0fbb0ef60 | refs/heads/master | 2021-06-18T09:23:33.244454 | 2021-04-13T02:32:33 | 2021-04-13T02:32:33 | 200,970,947 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 966 | java | /**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
class Solution {
// 147
// Reference: cspiration
public ListNode insertionSortList(ListNode head) {
// Time: O(n^2) Space: O(1)
if(head == null || head.next == null) return head;
ListNode dummy = new ListNode(0);
dummy.next = head;
ListNode cur = head, temp = null, prev = null;
while(cur != null && cur.next != null) {
if(cur.val <= cur.next.val) {
cur = cur.next;
} else {
temp = cur.next;
cur.next = temp.next;
prev = dummy;
while(prev.next.val <= temp.val) {
prev = prev.next;
}
temp.next = prev.next;
prev.next = temp;
}
}
return dummy.next;
}
} | [
"[email protected]"
] | |
aa77dd836b764b4f15de84de0e593b0d991242cb | 30f6c627320b25503b9958c501b23f93ede364ac | /BookSearch-master/build/app/generated/source/r/debug/io/flutter/plugins/firebase/database/R.java | 7eebf26a6313eb05e56dfd7eefc68f8ee5e76a4d | [] | no_license | daviddl9/ShareText | bd6fdb35863d5377ffd51a387b6fd752e019e184 | 817a646214ee178e3be78d7280a3c7aaf730a3cd | refs/heads/master | 2020-03-19T07:43:38.321091 | 2019-01-14T05:00:15 | 2019-01-14T05:00:15 | 136,143,838 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,525 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package io.flutter.plugins.firebase.database;
public final class R {
public static final class attr {
public static final int buttonSize = 0x7f020040;
public static final int circleCrop = 0x7f020047;
public static final int colorScheme = 0x7f020056;
public static final int font = 0x7f020074;
public static final int fontProviderAuthority = 0x7f020076;
public static final int fontProviderCerts = 0x7f020077;
public static final int fontProviderFetchStrategy = 0x7f020078;
public static final int fontProviderFetchTimeout = 0x7f020079;
public static final int fontProviderPackage = 0x7f02007a;
public static final int fontProviderQuery = 0x7f02007b;
public static final int fontStyle = 0x7f02007c;
public static final int fontWeight = 0x7f02007d;
public static final int imageAspectRatio = 0x7f020088;
public static final int imageAspectRatioAdjust = 0x7f020089;
public static final int scopeUris = 0x7f0200bf;
}
public static final class bool {
public static final int abc_action_bar_embed_tabs = 0x7f030000;
}
public static final class color {
public static final int common_google_signin_btn_text_dark = 0x7f040026;
public static final int common_google_signin_btn_text_dark_default = 0x7f040027;
public static final int common_google_signin_btn_text_dark_disabled = 0x7f040028;
public static final int common_google_signin_btn_text_dark_focused = 0x7f040029;
public static final int common_google_signin_btn_text_dark_pressed = 0x7f04002a;
public static final int common_google_signin_btn_text_light = 0x7f04002b;
public static final int common_google_signin_btn_text_light_default = 0x7f04002c;
public static final int common_google_signin_btn_text_light_disabled = 0x7f04002d;
public static final int common_google_signin_btn_text_light_focused = 0x7f04002e;
public static final int common_google_signin_btn_text_light_pressed = 0x7f04002f;
public static final int common_google_signin_btn_tint = 0x7f040030;
public static final int notification_action_color_filter = 0x7f040046;
public static final int notification_icon_bg_color = 0x7f040047;
public static final int notification_material_background_media_default_color = 0x7f040048;
public static final int primary_text_default_material_dark = 0x7f04004d;
public static final int ripple_material_light = 0x7f040052;
public static final int secondary_text_default_material_dark = 0x7f040053;
public static final int secondary_text_default_material_light = 0x7f040054;
}
public static final class dimen {
public static final int compat_button_inset_horizontal_material = 0x7f05004b;
public static final int compat_button_inset_vertical_material = 0x7f05004c;
public static final int compat_button_padding_horizontal_material = 0x7f05004d;
public static final int compat_button_padding_vertical_material = 0x7f05004e;
public static final int compat_control_corner_material = 0x7f05004f;
public static final int notification_action_icon_size = 0x7f050059;
public static final int notification_action_text_size = 0x7f05005a;
public static final int notification_big_circle_margin = 0x7f05005b;
public static final int notification_content_margin_start = 0x7f05005c;
public static final int notification_large_icon_height = 0x7f05005d;
public static final int notification_large_icon_width = 0x7f05005e;
public static final int notification_main_column_padding_top = 0x7f05005f;
public static final int notification_media_narrow_margin = 0x7f050060;
public static final int notification_right_icon_size = 0x7f050061;
public static final int notification_right_side_padding_top = 0x7f050062;
public static final int notification_small_icon_background_padding = 0x7f050063;
public static final int notification_small_icon_size_as_large = 0x7f050064;
public static final int notification_subtext_size = 0x7f050065;
public static final int notification_top_pad = 0x7f050066;
public static final int notification_top_pad_large_text = 0x7f050067;
}
public static final class drawable {
public static final int common_full_open_on_phone = 0x7f060053;
public static final int common_google_signin_btn_icon_dark = 0x7f060054;
public static final int common_google_signin_btn_icon_dark_focused = 0x7f060055;
public static final int common_google_signin_btn_icon_dark_normal = 0x7f060056;
public static final int common_google_signin_btn_icon_dark_normal_background = 0x7f060057;
public static final int common_google_signin_btn_icon_disabled = 0x7f060058;
public static final int common_google_signin_btn_icon_light = 0x7f060059;
public static final int common_google_signin_btn_icon_light_focused = 0x7f06005a;
public static final int common_google_signin_btn_icon_light_normal = 0x7f06005b;
public static final int common_google_signin_btn_icon_light_normal_background = 0x7f06005c;
public static final int common_google_signin_btn_text_dark = 0x7f06005d;
public static final int common_google_signin_btn_text_dark_focused = 0x7f06005e;
public static final int common_google_signin_btn_text_dark_normal = 0x7f06005f;
public static final int common_google_signin_btn_text_dark_normal_background = 0x7f060060;
public static final int common_google_signin_btn_text_disabled = 0x7f060061;
public static final int common_google_signin_btn_text_light = 0x7f060062;
public static final int common_google_signin_btn_text_light_focused = 0x7f060063;
public static final int common_google_signin_btn_text_light_normal = 0x7f060064;
public static final int common_google_signin_btn_text_light_normal_background = 0x7f060065;
public static final int googleg_disabled_color_18 = 0x7f060066;
public static final int googleg_standard_color_18 = 0x7f060067;
public static final int notification_action_background = 0x7f060069;
public static final int notification_bg = 0x7f06006a;
public static final int notification_bg_low = 0x7f06006b;
public static final int notification_bg_low_normal = 0x7f06006c;
public static final int notification_bg_low_pressed = 0x7f06006d;
public static final int notification_bg_normal = 0x7f06006e;
public static final int notification_bg_normal_pressed = 0x7f06006f;
public static final int notification_icon_background = 0x7f060070;
public static final int notification_template_icon_bg = 0x7f060071;
public static final int notification_template_icon_low_bg = 0x7f060072;
public static final int notification_tile_bg = 0x7f060073;
public static final int notify_panel_notification_icon_bg = 0x7f060074;
}
public static final class id {
public static final int action0 = 0x7f070006;
public static final int action_container = 0x7f07000e;
public static final int action_divider = 0x7f070010;
public static final int action_image = 0x7f070011;
public static final int action_text = 0x7f070017;
public static final int actions = 0x7f070018;
public static final int adjust_height = 0x7f07001b;
public static final int adjust_width = 0x7f07001c;
public static final int async = 0x7f070020;
public static final int auto = 0x7f070021;
public static final int blocking = 0x7f070023;
public static final int cancel_action = 0x7f070026;
public static final int chronometer = 0x7f07002b;
public static final int dark = 0x7f070032;
public static final int end_padder = 0x7f070038;
public static final int forever = 0x7f07003e;
public static final int icon = 0x7f070041;
public static final int icon_group = 0x7f070042;
public static final int icon_only = 0x7f070043;
public static final int info = 0x7f070046;
public static final int italic = 0x7f070047;
public static final int light = 0x7f070049;
public static final int line1 = 0x7f07004a;
public static final int line3 = 0x7f07004b;
public static final int media_actions = 0x7f07004e;
public static final int none = 0x7f070053;
public static final int normal = 0x7f070054;
public static final int notification_background = 0x7f070055;
public static final int notification_main_column = 0x7f070056;
public static final int notification_main_column_container = 0x7f070057;
public static final int right_icon = 0x7f07005d;
public static final int right_side = 0x7f07005e;
public static final int standard = 0x7f070077;
public static final int status_bar_latest_event_content = 0x7f070079;
public static final int text = 0x7f07007e;
public static final int text2 = 0x7f07007f;
public static final int time = 0x7f070082;
public static final int title = 0x7f070083;
public static final int wide = 0x7f07008b;
}
public static final class integer {
public static final int cancel_button_image_alpha = 0x7f080002;
public static final int google_play_services_version = 0x7f080004;
public static final int status_bar_notification_info_maxnum = 0x7f080005;
}
public static final class layout {
public static final int notification_action = 0x7f09001b;
public static final int notification_action_tombstone = 0x7f09001c;
public static final int notification_media_action = 0x7f09001d;
public static final int notification_media_cancel_action = 0x7f09001e;
public static final int notification_template_big_media = 0x7f09001f;
public static final int notification_template_big_media_custom = 0x7f090020;
public static final int notification_template_big_media_narrow = 0x7f090021;
public static final int notification_template_big_media_narrow_custom = 0x7f090022;
public static final int notification_template_custom_big = 0x7f090023;
public static final int notification_template_icon_group = 0x7f090024;
public static final int notification_template_lines_media = 0x7f090025;
public static final int notification_template_media = 0x7f090026;
public static final int notification_template_media_custom = 0x7f090027;
public static final int notification_template_part_chronometer = 0x7f090028;
public static final int notification_template_part_time = 0x7f090029;
}
public static final class string {
public static final int common_google_play_services_enable_button = 0x7f0b001d;
public static final int common_google_play_services_enable_text = 0x7f0b001e;
public static final int common_google_play_services_enable_title = 0x7f0b001f;
public static final int common_google_play_services_install_button = 0x7f0b0020;
public static final int common_google_play_services_install_text = 0x7f0b0021;
public static final int common_google_play_services_install_title = 0x7f0b0022;
public static final int common_google_play_services_notification_channel_name = 0x7f0b0023;
public static final int common_google_play_services_notification_ticker = 0x7f0b0024;
public static final int common_google_play_services_unknown_issue = 0x7f0b0025;
public static final int common_google_play_services_unsupported_text = 0x7f0b0026;
public static final int common_google_play_services_update_button = 0x7f0b0027;
public static final int common_google_play_services_update_text = 0x7f0b0028;
public static final int common_google_play_services_update_title = 0x7f0b0029;
public static final int common_google_play_services_updating_text = 0x7f0b002a;
public static final int common_google_play_services_wear_update_text = 0x7f0b002b;
public static final int common_open_on_phone = 0x7f0b002c;
public static final int common_signin_button_text = 0x7f0b002d;
public static final int common_signin_button_text_long = 0x7f0b002e;
public static final int status_bar_notification_info_overflow = 0x7f0b0039;
}
public static final class style {
public static final int TextAppearance_Compat_Notification = 0x7f0c00e7;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00e8;
public static final int TextAppearance_Compat_Notification_Info_Media = 0x7f0c00e9;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ea;
public static final int TextAppearance_Compat_Notification_Line2_Media = 0x7f0c00eb;
public static final int TextAppearance_Compat_Notification_Media = 0x7f0c00ec;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00ed;
public static final int TextAppearance_Compat_Notification_Time_Media = 0x7f0c00ee;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00ef;
public static final int TextAppearance_Compat_Notification_Title_Media = 0x7f0c00f0;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0c0158;
public static final int Widget_Compat_NotificationActionText = 0x7f0c0159;
}
public static final class styleable {
public static final int[] FontFamily = { 0x7f020076, 0x7f020077, 0x7f020078, 0x7f020079, 0x7f02007a, 0x7f02007b };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x01010532, 0x01010533, 0x0101053f, 0x7f020074, 0x7f02007c, 0x7f02007d };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_font = 3;
public static final int FontFamilyFont_fontStyle = 4;
public static final int FontFamilyFont_fontWeight = 5;
public static final int[] LoadingImageView = { 0x7f020047, 0x7f020088, 0x7f020089 };
public static final int LoadingImageView_circleCrop = 0;
public static final int LoadingImageView_imageAspectRatio = 1;
public static final int LoadingImageView_imageAspectRatioAdjust = 2;
public static final int[] SignInButton = { 0x7f020040, 0x7f020056, 0x7f0200bf };
public static final int SignInButton_buttonSize = 0;
public static final int SignInButton_colorScheme = 1;
public static final int SignInButton_scopeUris = 2;
}
}
| [
"[email protected]"
] | |
9da981c9787f8bc9b9e083a5825f5f336943a4b6 | b8e7d6af7f225674381145a376efaf921bd7ffff | /src/test/java/com/webapp/redsocial/BorrarAmigoTest.java | 31def88e31f9cd98b1802058d02bd7b3c753d030 | [] | no_license | christianrb1992/RedSocialMantenimiento | e45ac7e3b38114d71b8236a7ab7193773e35e8f5 | 1def536101beb64c951c4c61a6ddc2a8f8242da6 | refs/heads/master | 2021-08-23T11:16:10.243528 | 2017-12-04T17:03:22 | 2017-12-04T17:03:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,210 | java | package com.webapp.redsocial;
import static org.junit.Assert.assertTrue;
import com.redsocial.auxiliares.Utilidades;
import com.redsocial.modelo.Usuario;
import com.redsocial.persistencia.DAOUsuario;
import cucumber.annotation.en.Given;
import cucumber.annotation.en.Then;
import cucumber.annotation.en.When;
public class BorrarAmigoTest {
private Usuario emisor, receptor;
@Given("^Usuario conectado para eliminar un amigo$")
public void Usuario_conectado_para_eliminar_un_amigo() {
emisor=new Usuario();
receptor=new Usuario();
}
@When("^\"([^\"]*)\" borra a \"([^\"]*)\"$")
public void borra_a(String emisor, String receptor) throws Exception {
this.emisor.setemail(emisor);
this.emisor.setNombre(emisor);
this.emisor.setPwd(emisor);
DAOUsuario.insert(this.emisor);
this.receptor.setemail(receptor);
this.receptor.setNombre(receptor);
this.receptor.setPwd(receptor);
DAOUsuario.insert(this.receptor);
Utilidades.enviarSolicitud(this.emisor, this.receptor);
Utilidades.aceptarSolicitud(this.emisor, this.receptor);
}
@Then("^Borrar de amigos$")
public void Borrar_de_amigos() throws Exception {
Utilidades.borrarAmistad(receptor, emisor);
DAOUsuario.deleteConEmail(emisor.getemail());
DAOUsuario.deleteConEmail(receptor.getemail());
}
@When("^\"([^\"]*)\" intenta borrar a \"([^\"]*)\" pero no son amigos$")
public void intenta_borrar_a_pero_no_son_amigos(String emisor, String receptor) throws Exception {
this.emisor.setemail(emisor);
this.emisor.setNombre(emisor);
this.emisor.setPwd(emisor);
DAOUsuario.insert(this.emisor);
this.receptor.setemail(receptor);
this.receptor.setNombre(receptor);
this.receptor.setPwd(receptor);
DAOUsuario.insert(this.receptor);
}
@Then("^Mensaje de error al borrado$")
public void Mensaje_de_error_al_borrado() throws Exception {
try {
Utilidades.borrarAmistad(receptor, emisor);
} catch (Exception e) {
assertTrue(e.getMessage().equals("No puedes eliminar a alguien que no es tu amigo"));
}
DAOUsuario.deleteConEmail(emisor.getemail());
DAOUsuario.deleteConEmail(receptor.getemail());
}
}
| [
"[email protected]"
] | |
a590920d7f92311f7809961901998d3095d74d0b | 0124e218059472b8bfc4e63de33113496d94371c | /iEnvironment.OwenZhang.Edition/app/src/main/java/com/wsn/ienvironment/view/MultiAxisChart03View.java | d45a6c5db74baf0f872242b6b6000ce7c7d6dc28 | [
"Apache-2.0"
] | permissive | OwenMasculinity/iEnvironment | 6774fbd9edd141b4ea94873ad5525c1322c726fc | fa455d3c0591d913e6932af1f3f14b91ff8734b0 | refs/heads/master | 2020-04-11T17:44:17.629111 | 2018-12-16T05:54:25 | 2018-12-16T05:54:25 | 161,971,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,300 | java | package com.wsn.ienvironment.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import org.xclcharts.chart.AreaChart;
import org.xclcharts.chart.AreaData;
import org.xclcharts.chart.LineChart;
import org.xclcharts.chart.LineData;
import org.xclcharts.chart.PieChart;
import org.xclcharts.chart.PieData;
import org.xclcharts.chart.PointD;
import org.xclcharts.chart.SplineChart;
import org.xclcharts.chart.SplineData;
import org.xclcharts.common.DensityUtil;
import org.xclcharts.event.click.PointPosition;
import org.xclcharts.renderer.XEnum;
import org.xclcharts.renderer.plot.PlotGrid;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
public class MultiAxisChart03View extends DemoView {
private String TAG = "MultiAxisChart03View";
//用来显示面积图,左边及底部的轴
private AreaChart chart = new AreaChart();
//标签集合
private LinkedList<String> mLabels = new LinkedList<String>();
//数据集合
private LinkedList<AreaData> mDataset = new LinkedList<AreaData>();
//用来显示折线,右边及顶部的轴
private LineChart chartLn = new LineChart();
private LinkedList<LineData> chartData = new LinkedList<LineData>();
//曲线图,用来显示最两边的两条竖轴
private SplineChart chartLnAxes = new SplineChart();
private LinkedList<SplineData> chartDataAxes = new LinkedList<SplineData>();
private LinkedList<String> mLabelsAxes = new LinkedList<String>();
//饼图
private PieChart chartPie = new PieChart();
private LinkedList<PieData> chartDataPie = new LinkedList<PieData>();
private Paint mPaintTooltips = new Paint(Paint.ANTI_ALIAS_FLAG);
public MultiAxisChart03View(Context context) {
super(context);
// TODO Auto-generated constructor stub
initView();
}
public MultiAxisChart03View(Context context, AttributeSet attrs){
super(context, attrs);
initView();
}
public MultiAxisChart03View(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initView();
}
private void initView()
{
chartLabels();
chartLabelsAxes();
chartDataSetPie();
chartDataSet();
chartDataSetLn();
chartDataSetAxes();
chartRender();
chartRenderLn();
chartRenderLnAxes();
chartRenderPie();
//綁定手势滑动事件
this.bindTouch(this,chart);
this.bindTouch(this,chartLn);
// this.bindTouch(this,chartLnAxes);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
//图所占范围大小
chart.setChartRange(w ,h);
chartLn.setChartRange(w ,h);
chartLnAxes.setChartRange(w ,h);
float left = DensityUtil.dip2px(getContext(), 42);
float top = DensityUtil.dip2px(getContext(), 62);
float piewidth = Math.min(w, h) / 4;//1.5f;
chartPie.setChartRange(left, top, piewidth, piewidth);
}
private void chartRender()
{
try{
//设置绘图区默认缩进px值,留置空间显示Axis,Axistitle....
int [] ltrb = getBarLnDefaultSpadding();
//chart.setPadding(ltrb[0], ltrb[1], ltrb[2], ltrb[3]);
float left = DensityUtil.dip2px(getContext(), 40); //left 40
float right = DensityUtil.dip2px(getContext(), 40); //right 20
chart.setPadding(left, ltrb[1],right, ltrb[3]); //ltrb[2]
//轴数据源
//标签轴
chart.setCategories(mLabels);
//数据轴
chart.setDataSource(mDataset);
//仅横向平移
chart.setPlotPanMode(XEnum.PanMode.HORIZONTAL);
//数据轴最大值
chart.getDataAxis().setAxisMax(300);
chart.getDataAxis().setAxisMin(0);
//数据轴刻度间隔
chart.getDataAxis().setAxisSteps(50);
//网格
chart.getPlotGrid().showHorizontalLines();
chart.getPlotGrid().showVerticalLines();
//把轴线和刻度线给隐藏起来
//chart.getDataAxis().hideAxisLine();
chart.getDataAxis().hideTickMarks();
// chart.getCategoryAxis().hideAxisLine();
chart.getCategoryAxis().hideTickMarks();
chart.getDataAxis().setTickLabelRotateAngle(-90);
chart.getDataAxis().getTickLabelPaint().setColor(Color.RED);
chart.getCategoryAxis().getTickLabelPaint().setColor(Color.RED);
//标题
chart.setTitle("混合图(区域、折线、饼图)");
chart.addSubtitle("(XCL-Charts Demo)");
//轴标题
//chart.getAxisTitle().setLowerAxisTitle("(时间点)");
//透明度
chart.setAreaAlpha(200);
//显示图例
chart.getPlotLegend().hide();
//把轴线设成和横向网络线一样和大小和颜色,演示下定制性,这块问得人较多
PlotGrid plot = chart.getPlotGrid();
chart.getDataAxis().getAxisPaint().setStrokeWidth(
plot.getHorizontalLinePaint().getStrokeWidth());
chart.getCategoryAxis().getAxisPaint().setStrokeWidth(
plot.getHorizontalLinePaint().getStrokeWidth());
chart.getDataAxis().getAxisPaint().setColor(
plot.getHorizontalLinePaint().getColor());
chart.getCategoryAxis().getAxisPaint().setColor(
plot.getHorizontalLinePaint().getColor());
chart.getDataAxis().getTickMarksPaint().setColor(
plot.getHorizontalLinePaint().getColor());
chart.getCategoryAxis().getTickMarksPaint().setColor(
plot.getHorizontalLinePaint().getColor());
plot.hideHorizontalLines();
//激活点击监听
chart.ActiveListenItemClick();
//为了让触发更灵敏,可以扩大5px的点击监听范围
chart.extPointClickRange(10);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.e(TAG, e.toString());
}
}
private void chartDataSet()
{
List<Double> dataSeries2 = new LinkedList<Double>();
dataSeries2.add((double)140); //40
dataSeries2.add((double)122);
dataSeries2.add((double)130);
dataSeries2.add((double)135);
dataSeries2.add((double)115); //15
AreaData line2 = new AreaData("小小熊",dataSeries2,
Color.RED,
Color.YELLOW //(int)Color.rgb(254, 170, 50)
);
//设置线上每点对应标签的颜色
line2.getDotLabelPaint().setColor(Color.rgb(83, 148, 235));
//设置点标签
line2.setLabelVisible(true);
line2.getLabelOptions().setLabelBoxStyle(XEnum.LabelBoxStyle.CAPRECT);
line2.getLabelOptions().setOffsetY(20.f);
line2.setApplayGradient(true);
line2.setGradientMode(Shader.TileMode.MIRROR);
line2.setAreaBeginColor(Color.WHITE); //Color.rgb(254, 170, 50));
line2.setAreaEndColor(Color.rgb(224, 65, 10));
line2.setDotStyle(XEnum.DotStyle.RING);
line2.getPlotLine().getDotPaint().setColor(Color.WHITE);
line2.getPlotLine().getPlotDot().setRingInnerColor(Color.RED);
mDataset.add(line2);
}
private void chartRenderLn()
{
try {
//设置绘图区默认缩进px值,留置空间显示Axis,Axistitle....
int [] ltrb = getBarLnDefaultSpadding();
float left = DensityUtil.dip2px(getContext(), 40); //left 40
float right = DensityUtil.dip2px(getContext(), 40); //right 20
chartLn.setPadding(left, ltrb[1],right, ltrb[3]); //ltrb[2]
//设定数据源
chartLn.setCategories(mLabels);
chartLn.setDataSource(chartData);
//数据轴最大值
chartLn.getDataAxis().setAxisMax(70);
//数据轴刻度间隔
chartLn.getDataAxis().setAxisSteps(10);
//仅横向平移
chartLn.setPlotPanMode(XEnum.PanMode.HORIZONTAL);
//背景网格
chartLn.getPlotGrid().hideEvenRowBgColor();
chartLn.getPlotGrid().hideHorizontalLines();
chartLn.getPlotGrid().hideOddRowBgColor();
chartLn.getPlotGrid().hideVerticalLines();
//chartLn.getPlotGrid().showHorizontalLines();
//chartLn.getDataAxis().hideAxisLine();
chartLn.getDataAxis().hideTickMarks();
//chartLn.getCategoryAxis().hideAxisLine();
chartLn.getCategoryAxis().hideTickMarks();
chartLn.getDataAxis().setTickLabelRotateAngle(-90);
chartLn.getDataAxis().getTickLabelPaint().setColor(Color.rgb(106, 218, 92));
chartLn.getCategoryAxis().getTickLabelPaint().setColor(Color.rgb(106, 218, 92));
chartLn.getDataAxis().setHorizontalTickAlign(Align.RIGHT);
chartLn.getDataAxis().getTickLabelPaint().setTextAlign(Align.LEFT);
//调整轴显示位置
chartLn.setDataAxisLocation(XEnum.AxisLocation.RIGHT);
chartLn.setCategoryAxisLocation(XEnum.AxisLocation.TOP);
//把轴线设成和横向网络线一样和大小和颜色,演示下定制性,这块问得人较多
PlotGrid plot = chart.getPlotGrid();
chartLn.getDataAxis().getAxisPaint().setStrokeWidth(
plot.getHorizontalLinePaint().getStrokeWidth());
chartLn.getCategoryAxis().getAxisPaint().setStrokeWidth(
plot.getHorizontalLinePaint().getStrokeWidth());
chartLn.getDataAxis().getAxisPaint().setColor(
plot.getHorizontalLinePaint().getColor());
chartLn.getCategoryAxis().getAxisPaint().setColor(
plot.getHorizontalLinePaint().getColor());
chartLn.getDataAxis().getTickMarksPaint().setColor(
plot.getHorizontalLinePaint().getColor());
chartLn.getCategoryAxis().getTickMarksPaint().setColor(
plot.getHorizontalLinePaint().getColor());
//图例显示在正下方
chartLn.getPlotLegend().setVerticalAlign(XEnum.VerticalAlign.BOTTOM);
chartLn.getPlotLegend().setHorizontalAlign(XEnum.HorizontalAlign.CENTER);
} catch (Exception e) {
// TODO Auto-generated catch block
Log.e(TAG, e.toString());
}
}
private void chartDataSetLn()
{
LinkedList<Double> dataSeries0= new LinkedList<Double>();
dataSeries0.add(0d);
LineData line2 = new LineData("Area圆环",dataSeries0, Color.rgb(224, 65, 10)); //(int)Color.rgb(48, 145, 255));
line2.setDotStyle(XEnum.DotStyle.RING);
line2.getPlotLine().getDotPaint().setColor(Color.WHITE);
line2.getPlotLine().getPlotDot().setRingInnerColor(Color.RED);
//line2.getLabelOptions().hideBox();
//Line 1
LinkedList<Double> dataSeries1= new LinkedList<Double>();
dataSeries1.add(40d);
dataSeries1.add(35d);
dataSeries1.add(50d);
dataSeries1.add(60d);
dataSeries1.add(55d);
LineData lineData1 = new LineData("直线",dataSeries1, Color.rgb(106, 218, 92));
lineData1.setLabelVisible(true);
lineData1.setDotStyle(XEnum.DotStyle.HIDE);
lineData1.getDotLabelPaint().setColor(Color.BLUE);
lineData1.getDotLabelPaint().setTextSize(22);
lineData1.getDotLabelPaint().setTextAlign(Align.LEFT);
lineData1.setItemLabelRotateAngle(45.f);
lineData1.getLabelOptions().setLabelBoxStyle(XEnum.LabelBoxStyle.RECT);
//Line 2
LinkedList<Double> dataSeries2= new LinkedList<Double>();
dataSeries2.add((double)50);
dataSeries2.add((double)42);
dataSeries2.add((double)55);
dataSeries2.add((double)65);
dataSeries2.add((double)58);
LineData lineData2 = new LineData("圆环",dataSeries2, Color.rgb(48, 145, 255));
lineData2.setDotStyle(XEnum.DotStyle.RING);
lineData2.getPlotLine().getDotPaint().setColor(Color.RED);
lineData2.setLabelVisible(true);
lineData2.getPlotLine().getPlotDot().setRingInnerColor(Color.GREEN);
lineData2.getLabelOptions().setLabelBoxStyle(XEnum.LabelBoxStyle.CAPRECT);
//lineData2.setLineStyle(XEnum.LineStyle.DASH);
LinkedList<Double> dataSeries3= new LinkedList<Double>();
dataSeries3.add((double)55);
dataSeries3.add((double)42);
dataSeries3.add((double)65);
dataSeries3.add((double)45);
LineData lineData3 = new LineData("角",dataSeries3, Color.rgb(199, 64, 219));
lineData3.setDotStyle(XEnum.DotStyle.TRIANGLE);
lineData3.getLabelOptions().setLabelBoxStyle(XEnum.LabelBoxStyle.TEXT);
chartData.add(line2);
chartData.add(lineData1);
chartData.add(lineData2);
chartData.add(lineData3);
}
private void chartRenderLnAxes()
{
try {
//设置绘图区默认缩进px值,留置空间显示Axis,Axistitle....
int [] ltrb = getBarLnDefaultSpadding();
float left = DensityUtil.dip2px(getContext(), 20); //left 40
float right = DensityUtil.dip2px(getContext(), 20); //right 20
chartLnAxes.setPadding(left, ltrb[1],right, ltrb[3]); //ltrb[2]
//设定数据源
chartLnAxes.setCategories(mLabelsAxes);
chartLnAxes.setDataSource(chartDataAxes);
//数据轴最大值
chartLnAxes.getDataAxis().setAxisMax(70);
//数据轴刻度间隔
chartLnAxes.getDataAxis().setAxisSteps(10);
//标签轴最大值
chartLnAxes.setCategoryAxisMax(70);
//标签轴最小值
chartLnAxes.setCategoryAxisMin(0);
chartLnAxes.getPlotLegend().hide();
//背景网格
chartLnAxes.getPlotGrid().hideEvenRowBgColor();
chartLnAxes.getPlotGrid().hideHorizontalLines();
chartLnAxes.getPlotGrid().hideOddRowBgColor();
chartLnAxes.getPlotGrid().hideVerticalLines();
chartLnAxes.getDataAxis().hideAxisLine();
chartLnAxes.getDataAxis().hideTickMarks();
chartLnAxes.getCategoryAxis().hideAxisLine();
chartLnAxes.getCategoryAxis().hideTickMarks();
chartLnAxes.getCategoryAxis().setTickLabelRotateAngle(-90);
chartLnAxes.getDataAxis().setTickLabelRotateAngle(-90);
chartLnAxes.getDataAxis().getTickLabelPaint().setColor(Color.rgb(48, 145, 255));
chartLnAxes.getCategoryAxis().getTickLabelPaint().setColor(Color.rgb(199, 64, 219));
chartLnAxes.getDataAxis().setHorizontalTickAlign(Align.RIGHT);
chartLnAxes.getDataAxis().getTickLabelPaint().setTextAlign(Align.LEFT);
//调整轴显示位置
chartLnAxes.setDataAxisLocation(XEnum.AxisLocation.RIGHT);
chartLnAxes.setCategoryAxisLocation(XEnum.AxisLocation.LEFT);
} catch (Exception e) {
// TODO Auto-generated catch block
Log.e(TAG, e.toString());
}
}
private void chartLabelsAxes()
{
mLabelsAxes.add("0");
mLabelsAxes.add("10");
mLabelsAxes.add("20");
mLabelsAxes.add("30");
mLabelsAxes.add("40");
mLabelsAxes.add("50");
mLabelsAxes.add("60");
mLabelsAxes.add("70");
}
private void chartDataSetAxes()
{
//线1的数据集
List<PointD> linePoint1 = new ArrayList<PointD>();
linePoint1.add(new PointD(0d, 0d));
SplineData dataSeries1 = new SplineData("",linePoint1,
Color.rgb(54, 141, 238) );
dataSeries1.setDotStyle(XEnum.DotStyle.HIDE);
//设定数据源
chartDataAxes.add(dataSeries1);
}
private void chartLabels()
{
mLabels.add("1h46'");
mLabels.add("3h46'");
mLabels.add("5h46'");
mLabels.add("7h46'");
mLabels.add("8h46'");
}
private void chartRenderPie()
{
chartPie.setPadding(0,0,0,0);
//标签显示(隐藏,显示在中间,显示在扇区外面)
chartPie.setLabelStyle(XEnum.SliceLabelStyle.INSIDE);
chartPie.getLabelPaint().setColor(Color.WHITE);
chartPie.setDataSource(chartDataPie);
//显示图例
chartPie.getPlotLegend().hide();
}
private void chartDataSetPie()
{
/*
chartDataPie.add(new PieData("closed","25%" , (0.25*100),(int)Color.rgb(155, 187, 90)));
chartDataPie.add(new PieData("inspect","45%" , (0.45*100),(int)Color.rgb(191, 79, 75)));
chartDataPie.add(new PieData("workdone","15%" , (0.15*100),(int)Color.rgb(60, 173, 213)));
chartDataPie.add(new PieData("dispute","15%" , (0.15*100),(int)Color.rgb(90, 79, 88)));
*/
chartDataPie.add(new PieData("closed","25%" , 25, Color.rgb(155, 187, 90)));
chartDataPie.add(new PieData("inspect","45%" , 45, Color.rgb(191, 79, 75)));
chartDataPie.add(new PieData("workdone","15%" , 15, Color.rgb(60, 173, 213)));
chartDataPie.add(new PieData("dispute","15%" , 15, Color.rgb(90, 79, 88)));
}
@Override
public void render(Canvas canvas) {
try{
chart.render(canvas);
chartLn.render(canvas);
chartLnAxes.render(canvas);
chartPie.render(canvas);
} catch (Exception e){
Log.e(TAG, e.toString());
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
super.onTouchEvent(event);
if(event.getAction() == MotionEvent.ACTION_UP)
{
triggerClick(event.getX(),event.getY());
}
return true;
}
//触发监听
private void triggerClick(float x,float y)
{
PointPosition record = chart.getPositionRecord(x,y);
if( null == record) return;
AreaData lData = mDataset.get(record.getDataID());
Double lValue = lData.getLinePoint().get(record.getDataChildID());
//在点击处显示tooltip
mPaintTooltips.setColor(Color.rgb(240, 73, 119));
chart.getToolTip().getBackgroundPaint().setColor(Color.GREEN);
chart.getToolTip().setCurrentXY(x,y);
chart.getToolTip().addToolTip(" Key:"+lData.getLineKey(),mPaintTooltips);
chart.getToolTip().addToolTip(" Label:"+lData.getLabel(),mPaintTooltips);
chart.getToolTip().addToolTip(" Current Value:" + Double.toString(lValue),mPaintTooltips);
chart.getToolTip().setAlign(Align.LEFT);
this.invalidate();
}
}
| [
"[email protected]"
] | |
9709a82a40cbc4b42e2aa9254e2620fddea755ed | b0bbaef36a623759bacf829c646368402e491b49 | /marketplace/src/main/java/com/intuit/domain/Project.java | 4536ca416b9a4627feb0123ab014206720f71bfa | [] | no_license | vipul1231/MarketPlace | 8bd52b803a2813cfca928f2dcbbae38cb1c6c789 | a6705062c2ad0ab96187f606614d2caacc6bba1a | refs/heads/master | 2020-08-02T17:17:20.303412 | 2019-10-08T05:19:35 | 2019-10-08T05:19:35 | 211,442,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,390 | java | package com.intuit.domain;
import lombok.Data;
import java.util.Date;
@Data
public class Project {
private String projectId;
private String projectName;
private String type;
private ProjectStatus status;
private String buyerId;
private String sellerId;
private Double lowestBidPrice;
private Date postedDate;
public Project(String projectId, String projectName, String type, ProjectStatus status,String buyerId, String sellerId, Double lowesetBidPrice, Date postedDate){
this.projectId = projectId;
this.projectName = projectName;
this.type = type;
this.status = status;
this.buyerId = buyerId;
this.sellerId = sellerId;
this.lowestBidPrice = lowesetBidPrice;
this.postedDate = postedDate;
}
private static class ProjectBuilder {
private String projectId;
private String projectName;
public ProjectBuilder setProjectId(String projectId) {
this.projectId = projectId;
return this;
}
public ProjectBuilder setProjectName(String projectName) {
this.projectName = projectName;
return this;
}
public ProjectBuilder setType(String type) {
this.type = type;
return this;
}
public ProjectBuilder setStatus(ProjectStatus status) {
this.status = status;
return this;
}
public ProjectBuilder setBuyerId(String buyerId) {
this.buyerId = buyerId;
return this;
}
public ProjectBuilder setSellerId(String sellerId) {
this.sellerId = sellerId;
return this;
}
public ProjectBuilder setLowestBidPrice(Double lowestBidPrice) {
this.lowestBidPrice = lowestBidPrice;
return this;
}
public ProjectBuilder setPostedDate(Date postedDate) {
this.postedDate = postedDate;
return this;
}
private String type;
private ProjectStatus status;
private String buyerId;
private String sellerId;
private Double lowestBidPrice;
private Date postedDate;
public Project build(){
return new Project(projectId, projectName, type, status,buyerId,sellerId,lowestBidPrice,postedDate);
}
}
}
| [
"[email protected]"
] | |
c7c10d04a227e65062551320a42c5725b1239f1c | 7dbb3c1c822356256f1f6409993e4481f0cb816a | /src/main/java/com/jnit/app/exceptions/NotFoundException.java | fd0fa204cca592407869b3c9511d3610874a7262 | [] | no_license | bhiapp4/userapp | b8894bc4835a98f019162a05ab5dd460985814b3 | 04fd35263443def2de0a221ac80382b595c414cf | refs/heads/master | 2021-01-15T20:28:02.957235 | 2017-08-17T17:18:23 | 2017-08-17T17:18:23 | 99,852,148 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | package com.jnit.app.exceptions;
public class NotFoundException extends Exception{
private static final long serialVersionUID = 1L;
public NotFoundException(){
super();
}
public NotFoundException(String message){
super(message);
}
}
| [
"[email protected]"
] | |
31d777dbde5d828a0921e25e9c3cf96dffb193f5 | 7eb93897e6c0de545bac10bcdd74374d275fa589 | /src/control/AcercaDeServlet.java | 53b563c7015b863865369fce6f3300ffacd96568 | [] | no_license | JonAbrego/RuidoVivo | 8c33a1207c4d7a207d9947a33041c442d8a54d9c | 84204b9703336daa70865bdf0a9f0aaf186030bd | refs/heads/master | 2021-01-10T16:36:33.889143 | 2015-05-29T07:54:27 | 2015-05-29T07:54:27 | 36,207,758 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package control;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping("/acercaDe.htm")
public class AcercaDeServlet {
@RequestMapping(method=RequestMethod.GET)
public String showTienda(){
return "acercaDe";
}
} | [
"[email protected]"
] | |
a911945307b4de5cf270bed52f0c9b84eaed8846 | 887aa2d0d109ed221eaa7408c17733e27669613c | /src/letter_count.java | 9f870b45e23f8df0285802a8d81b7ad7ef3b9fe4 | [] | no_license | qige2016/practice | ca1a0a01b4241b333f7622dc1388e48a4feb91f3 | e6f94b79353f3616d291ca27b0c7a9791cb9ea61 | refs/heads/master | 2021-01-23T04:59:07.027780 | 2017-05-31T13:34:04 | 2017-05-31T13:34:04 | 92,946,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,272 | java | import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
/**
* Created by Administrator on 2017/5/30.
* # 题 3
# 给定一个只包含字母的字符串,返回单个字母出现的次数
# 考察字典的概念和使用
# 返回值为包含元组的列表,格式如下(对列表中元组的顺序不做要求)
# 参数 "hello"
# 返回值 [('h', 1), ('e', 1), ('l', 2), ('o', 1)]
*/
public class letter_count {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.println("请输入只包含字母的字符串:");
String str = input.nextLine();
char[] chs = str.toCharArray();
Map<Character,Integer>map = new HashMap<Character, Integer>();
for(int i = 0;i < chs.length;i++){
Integer value = map.get(chs[i]);
if(value == null){
map.put(chs[i],1);
}else{
map.put(chs[i],value + 1);
}
}
StringBuffer sb = new StringBuffer();
for(Map.Entry i : map.entrySet()){
sb.append("("+"'"+i.getKey()+"'"+i.getValue()+")"+",");
}
System.out.print("["+sb.substring(0,sb.length()-1)+"]");
}
}
| [
"[email protected]"
] | |
8704fa1c6ca13c9ce525cf9b4f76a3ed91a38f4c | bbd565ef2af18d41099ff168b431fc11b88a97fc | /Lab1/Lab1/obj/Debug/81/android/src/mono/android/app/XamarinAndroidEnvironmentVariables.java | 4e3048bb70d7a4a9507e0e00cc42f64a60d0bd58 | [] | no_license | HappyBullying/Labs_SoftwareDevelopment | 2d82a915483b7aad2acf55c9dd4ff5c4afc70e07 | 3070b26107c672ad1dfac4621900936b7d810729 | refs/heads/master | 2022-01-14T23:44:37.829562 | 2019-05-26T17:33:14 | 2019-05-26T17:33:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 433 | java | package mono.android.app;
public class XamarinAndroidEnvironmentVariables
{
// Variables are specified the in "name", "value" pairs
public static final String[] Variables = new String[] {
"MONO_LOG_LEVEL", "info",
"XAMARIN_BUILD_ID", "23deef03-c8b9-4204-b80f-4e150b516c5c",
"XA_HTTP_CLIENT_HANDLER_TYPE", "Xamarin.Android.Net.AndroidClientHandler",
"XA_TLS_PROVIDER", "btls",
"MONO_GC_PARAMS", "major=marksweep",
};
}
| [
"[email protected]"
] | |
69bc7c84c1946af28306fe9d70505b65adaf357a | df496493338304b0833ec32353fc241f9789104c | /core_example/src/main/java/paul/zhang/vertx/example/core/eventbus/messagecodec/ClusterReceiver.java | b39bd70c4a156da5e0df68c2821cd586631dc88f | [] | no_license | ZhangPengPaul/vertx_example | ae851a69d938b8f6c5632fc20b768ba2f8b37132 | 5fd16de0e22c19b49c9f9a5af9c4f284e2d15b5d | refs/heads/master | 2020-04-06T06:57:37.665354 | 2016-08-31T09:04:41 | 2016-08-31T09:04:41 | 65,260,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,199 | java | package paul.zhang.vertx.example.core.eventbus.messagecodec;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.EventBus;
import paul.zhang.vertx.example.core.eventbus.messagecodec.util.CustomMessage;
import paul.zhang.vertx.example.core.eventbus.messagecodec.util.CustomMessageCodec;
import paul.zhang.vertx.example.core.util.Runner;
/**
* Created by PaulZhang on 2016/8/10.
*/
public class ClusterReceiver extends AbstractVerticle {
public static void main(String[] args) {
Runner.runClusteredExample(ClusterReceiver.class);
}
@Override
public void start() throws Exception {
EventBus eb = vertx.eventBus();
eb.registerDefaultCodec(CustomMessage.class, new CustomMessageCodec());
eb.consumer("cluster-message-receiver", message -> {
CustomMessage customMessage = (CustomMessage) message.body();
System.out.println("Custom message received: " + customMessage.getSummary());
// Replying is same as publishing
CustomMessage replyMessage = new CustomMessage(200, "a00000002", "Message sent from cluster receiver!");
message.reply(replyMessage);
});
}
}
| [
"[email protected]"
] | |
3675bfb22f0cbc61896da7cff662ae0d7dff809f | e08314b8c22df72cf3aa9e089624fc511ff0d808 | /src/sdk4.0/ces/sdk/system/dao/impl/DBOrgUserInfoDao.java | 685606c7d7b33d9c9324c43e675191f44d7283ee | [] | no_license | quxiongwei/qhzyc | 46acd4f6ba41ab3b39968071aa114b24212cd375 | 4b44839639c033ea77685b98e65813bfb269b89d | refs/heads/master | 2020-12-02T06:38:21.581621 | 2017-07-12T02:06:10 | 2017-07-12T02:06:10 | 96,864,946 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 4,015 | java | package ces.sdk.system.dao.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.dbutils.handlers.ArrayListHandler;
import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.apache.commons.lang.StringUtils;
import ces.sdk.system.bean.OrgTypeInfo;
import ces.sdk.system.bean.OrgUserInfo;
import ces.sdk.system.common.StandardSQLHelper;
import ces.sdk.system.common.decorator.SdkQueryRunner;
import ces.sdk.system.dao.OrgUserInfoDao;
import ces.sdk.system.factory.SdkQueryRunnerFactory;
import ces.sdk.util.JdbcUtil;
import ces.sdk.util.StringUtil;
public class DBOrgUserInfoDao extends DBBaseDao implements OrgUserInfoDao{
/**
* 查询参数
*/
private static String ORG_USER_SELECT_PARAM = null;
/**
* 更新参数
*/
private static String ORG_USER_UPDATE_PARAM = null;
static {
String[] columnsNameArray = ORG_USER_COLUMNS_NAME.split(",");
String[] param = JdbcUtil.getSelectParamAndUpdateParam(columnsNameArray);
ORG_USER_SELECT_PARAM = param[0];
ORG_USER_UPDATE_PARAM = param[1];
}
@Override
public OrgUserInfo save(OrgUserInfo orgUserInfo) {
//建立一条标准的sql
String sql = StandardSQLHelper.standardInsertSql(ORG_USER_COLUMNS_NAME, ORG_USER_TABLE_NAME, JdbcUtil.generatorPlaceHolder(orgUserInfo.getClass().getDeclaredFields()).toString());
orgUserInfo.setId(super.generateUUID());
SdkQueryRunner qr = SdkQueryRunnerFactory.createSdkQueryRunner();
qr.update(sql,JdbcUtil.getColumnsValueByBean(ORG_USER_COLUMNS_NAME, orgUserInfo,ADD_STATUS));
return orgUserInfo;
}
@Override
public void delete(String id) {
Object[] idsArray = id.split(",");
String sql = StandardSQLHelper.standardDeleteSql(ORG_USER_TABLE_NAME, "id in " + JdbcUtil.generatorPlaceHolder(idsArray));
SdkQueryRunner qr = SdkQueryRunnerFactory.createSdkQueryRunner();
qr.update(sql,idsArray);
}
@Override
public int delete(String orgId, String userId, String userType) {
List<String> condition = new ArrayList<String>();
List<Object> values = new ArrayList<Object>();
if(StringUtils.isNotBlank(orgId)){
condition.add("org_id = ?");
values.add(orgId);
}
if(StringUtils.isNotBlank(userId)){
condition.add("user_id = ?"); //
values.add(userId);
}
if(StringUtils.isNotBlank(userType)){
condition.add("user_type = ?");
values.add(userType);
}
String sql = StandardSQLHelper.standardDeleteSql(ORG_USER_TABLE_NAME, condition.toArray());
SdkQueryRunner qr = SdkQueryRunnerFactory.createSdkQueryRunner();
return qr.update(sql,values.toArray());
}
@Override
public List<OrgUserInfo> findByCondition(Map<String,String> param) {
List<String> condition = new ArrayList<String>();
List<Object> values = new ArrayList<Object>();
if(null!=param&¶m.size()!=0){
String orgId = param.get("orgId");
String userId = param.get("userId");
String userType = param.get("userType");
if(StringUtils.isNotBlank(orgId)){
condition.add("org_id = ?");
values.add(orgId);
}
if(StringUtils.isNotBlank(userId)){
condition.add("user_id = ?"); //
values.add(userId);
}
if(StringUtils.isNotBlank(userType)){
condition.add("user_type = ?");
values.add(userType);
}
}
String sql = StandardSQLHelper.standardSelectSql(ORG_USER_SELECT_PARAM, ORG_USER_TABLE_NAME,null,condition.toArray());
SdkQueryRunner qr = SdkQueryRunnerFactory.createSdkQueryRunner();
List<OrgUserInfo> orgUserInfo = new ArrayList<OrgUserInfo>();
orgUserInfo = qr.query(sql, new BeanListHandler<OrgUserInfo>(OrgUserInfo.class),values.toArray());
return orgUserInfo;
}
@Override
public void changeOrgUser(String userId, String orgId, String userType) {
String sql = "update " + ORG_USER_TABLE_NAME + " set org_id = ? where user_id = ? and user_type = ?";
SdkQueryRunner qr = SdkQueryRunnerFactory.createSdkQueryRunner();
qr.update(sql,orgId,userId,userType);
}
}
| [
"[email protected]"
] | |
45f17a4c101c839bc4eaa9e047234daa01b2b778 | 14288df45ef583a37c7d2d893f20034d9fb45e83 | /Company/Consumer/consumer/src/main/java/yitgogo/consumer/order/model/ModelDiliver.java | c7e8b814024cd37e08e8d89ef88632db66974620 | [] | no_license | KungFuBrother/AndroidStudio | a1ce284f44f20bbdd1d90df356eed898137e7ebe | 990a687ed0b4c29208f7df91ad94fc61ed9cc282 | refs/heads/master | 2016-08-12T19:01:09.548129 | 2015-12-05T07:04:11 | 2015-12-05T07:04:11 | 47,050,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,011 | java | package yitgogo.consumer.order.model;
import org.json.JSONException;
import org.json.JSONObject;
/**
* 配送方式
*
* @author Tiger
*
*/
public class ModelDiliver {
public final static int TYPE_SELF = 0;
public final static int TYPE_HOME = 1;
public final static String NAME_SELF = "自取";
public final static String NAME_HOME = "送货上门";
int type = TYPE_SELF;
String name = NAME_SELF;
public ModelDiliver() {
}
public ModelDiliver(JSONObject object) {
if (object != null) {
type = object.optInt("type");
name = object.optString("name");
}
}
public ModelDiliver(int type, String name) {
this.type = type;
this.name = name;
}
public int getType() {
return type;
}
public String getName() {
return name;
}
public JSONObject toJsonObject() throws JSONException {
JSONObject jsonObject = new JSONObject();
jsonObject.put("type", type);
jsonObject.put("name", name);
return jsonObject;
}
}
| [
"[email protected]"
] | |
356302e9a19a7744d1f6e158bf44321bba4ed9db | e3406840999ee97ade70a7e99d9128a9ba97e9f6 | /Section5/src/com/egehurturk/LargestElem.java | 3265b126d8691512314d46c026382399487b8e5e | [] | no_license | egehurturk/JavaRepo | 4c83bdb8eeef02adbca2e3bdb30e134d292a635d | b2641286258eb36cf1343d414e140c88eeeea43a | refs/heads/main | 2023-01-06T19:47:08.362642 | 2020-11-15T08:54:52 | 2020-11-15T08:54:52 | 312,992,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 865 | java | package com.egehurturk;
import java.util.Scanner;
class LargestElem {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.print("Enter number of elements in the array:");
int number = s.nextInt();
int[] a = new int[number];
System.out.println("Enter elements of array:");
for(int i = 0; i < number; i++)
{
a[i] = s.nextInt();
}
int largestElem = findLargestElem(a);
System.out.println(largestElem);
}
public static int findLargestElem(int[] array) {
int temp = 0;
for (int i=0;i<array.length;i++) {
if (temp == 0) {
temp += array[i];
}
if (array[i] > temp) {
temp = array[i];
}
}
return temp;
}
}
| [
"[email protected]"
] | |
f5b62065d3dd2fe947efa7ff0163a74d6d69fa57 | 2376d7ec6ead5de727f3a61c029d3b9901f3989a | /MainClass/src/PayRollDemo.java | a4b84d612b5ec71c50597348725b2925e5241987 | [] | no_license | suv27/OldCollegeWork | 81a0c749bcbcad7e778bcc1755dd7d7ce17c83f5 | 4f44bc4abd975d4d4df34891a91614fc0975b25f | refs/heads/master | 2022-03-01T21:21:28.726746 | 2019-10-18T06:28:28 | 2019-10-18T06:28:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,364 | java | /*
Starlyn Urena
**************
Main Program
**************
*/
import java.util.Scanner;
public class PayRollDemo
{
public static void main(String[] args)
{
//declare variables
String name;
int id;
double payrate;
double hoursworked;
//Create a scanner
Scanner auch = new Scanner(System.in);
//Ask for employee date and accept them
System.out.println("What's your name: ");
name = auch.next();
System.out.println("What's your id number: ");
id = auch.nextInt();
System.out.println("What's your hourly pay rate: ");
payrate = auch.nextDouble();
do{
System.out.println("ERROR: Enter 6.00 or greater for pay rate");
}
while(payrate < 6.00);
System.out.println("What's your number of hours worked: ");
hoursworked = auch.nextDouble();
while(hoursworked < 0)
{
System.out.println("ERROR: Enter 0 or greater for hours");
}
//call class
PayRollClass call = new PayRollClass(name, id, payrate, hoursworked);
//call methods
call.setEmployeesName(name);
call.setIdNumber(id);
call.setHourlyPayRate(payrate);
call.setNumberOfHoursWorked(hoursworked);
//print out gross pay
System.out.println("Your earned gross pay is " + call.employeeGrossPlay());
}
} | [
"[email protected]"
] | |
0cb4830eae7cfb2dc9c60d1fb18e48b0222e022b | b9e3f11b29d1facdda7b0151ac05a1058d01ba56 | /src-gen/twm/Shamrock.java | 52aede7f367922a9938c4e52a4d0ee59082393a4 | [] | no_license | oppl/Comprehand | 4012a881a2fc74fd1bd3cea89b700c0e8e3babbe | b2810d85b1563f4c8fde9572f9432d249c3b5a56 | refs/heads/master | 2021-01-11T17:31:05.142768 | 2017-01-23T10:23:18 | 2017-01-23T10:23:18 | 79,793,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 600 | java | package twm;
/** [20.03.08 13:24] **/
/** GENERATED FROM TEMPLATE concept.ftl **/
import mane.metamodel.Concept;
/**
* Shamrock represents a concrete Model Element (layer M1) of a
* twm model.
*
*/
public class Shamrock extends Concept {
/**
* Constructor
*
* @param manager model Manager
*/
public Shamrock(mane.metamodel.Manager manager){
super("unknown","Shamrock", manager);
}
/**
* Constructor
*
* @param manager model Manager
*/
public Shamrock(String name, mane.metamodel.Manager manager){
super("unknown","Shamrock", manager);
this.setName(name);
}
}
| [
"[email protected]"
] | |
b61d0888674e5922dfe7019038b8a7442f442af9 | d9e8279668d4a93703e7641c0428165aec016706 | /src/main/java/com/educandoweb/course/resource/exception/StandardError.java | d8999a2e495f780d36b08805d20da6b934b7f8d2 | [] | no_license | cristpsantos/workshop_spring_mongo | 890f341248279f99f4beea9444b824a317309906 | 056253d45ff218bf617f2092c61a665ce9fb37c5 | refs/heads/master | 2023-02-22T22:22:29.947185 | 2021-01-20T23:36:51 | 2021-01-20T23:36:51 | 330,822,686 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,167 | java | package com.educandoweb.course.resource.exception;
import java.io.Serializable;
public class StandardError implements Serializable {
private static final long serialVersionUID = 1L;
private Long timestamp;
private Integer status;
private String error;
private String message;
private String path;
public StandardError() {
}
public StandardError(Long timestamp, Integer status, String error, String message, String path) {
super();
this.timestamp = timestamp;
this.status = status;
this.error = error;
this.message = message;
this.path = path;
}
public Long getTimestamp() {
return timestamp;
}
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
} | [
"[email protected]"
] | |
a3c43141ede4a7a361507760df199629190a92c3 | d2cb1f4f186238ed3075c2748552e9325763a1cb | /pre_compile/nonstatic_methods/methods/java_net_DatagramSocket_getLocalSocketAddress.java | 6aee76b9a8b1fa5969064f34e5f2b96aa5597a63 | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 174 | java | class java_net_DatagramSocket_getLocalSocketAddress{ public static void function() {java.net.DatagramSocket obj = new java.net.DatagramSocket();obj.getLocalSocketAddress();}} | [
"[email protected]"
] | |
2893c8aa8471e576c09eeeaab7db08045bb6e65a | 43eeb80d4d19aaf4511fd6ae8a47b0b2703e64a0 | /src/main/java/com/dev/security/JwtTokenFilter.java | 9c32871d9e58ef91fd33df6a6042f8170dc3d98a | [] | no_license | haykelMtar/jwt-app | 2e77d2845c25bfb32955f3a25b10a88d274204c9 | 27c14533bf47c07e642d8a966224dba90d89ab7a | refs/heads/master | 2021-01-05T18:49:43.309492 | 2020-03-08T17:33:02 | 2020-03-08T17:33:02 | 241,106,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,627 | java | package com.dev.security;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.filter.OncePerRequestFilter;
import com.dev.exception.CustomException;
// We should use OncePerRequestFilter since we are doing a database call, there is no point in doing this more than once
public class JwtTokenFilter extends OncePerRequestFilter {
private JwtTokenProvider jwtTokenProvider;
public JwtTokenFilter(JwtTokenProvider jwtTokenProvider) {
this.jwtTokenProvider = jwtTokenProvider;
}
@Override
protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException {
String token = jwtTokenProvider.resolveToken(httpServletRequest);
try {
if (token != null && jwtTokenProvider.validateToken(token)) {
Authentication auth = jwtTokenProvider.getAuthentication(token);
SecurityContextHolder.getContext().setAuthentication(auth);
}
} catch (CustomException ex) {
//this is very important, since it guarantees the user is not authenticated at all
SecurityContextHolder.clearContext();
httpServletResponse.sendError(ex.getHttpStatus().value(), ex.getMessage());
return;
}
filterChain.doFilter(httpServletRequest, httpServletResponse);
}
}
| [
"[email protected]"
] | |
f15834af8912c0270228b3ab5f1c7886304b51bf | 66bfdbed138167b77328425def3196359000b2f0 | /app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/graphics/drawable/R.java | 6686120ad2df91edb070939196f402714b5f2fe3 | [] | no_license | AbdulrahmanMHsn/SocialNetwork | 5b4f9bb8c03e1ca00dc50757f5dfe42b91361b5d | f203156d5f12f7b095b6445683953dd89185d907 | refs/heads/master | 2020-05-18T15:36:50.367124 | 2019-05-02T00:58:19 | 2019-05-02T00:58:19 | 184,501,598 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,406 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.graphics.drawable;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f030029;
public static final int coordinatorLayoutStyle = 0x7f0300c7;
public static final int font = 0x7f03011a;
public static final int fontProviderAuthority = 0x7f03011c;
public static final int fontProviderCerts = 0x7f03011d;
public static final int fontProviderFetchStrategy = 0x7f03011e;
public static final int fontProviderFetchTimeout = 0x7f03011f;
public static final int fontProviderPackage = 0x7f030120;
public static final int fontProviderQuery = 0x7f030121;
public static final int fontStyle = 0x7f030122;
public static final int fontVariationSettings = 0x7f030123;
public static final int fontWeight = 0x7f030124;
public static final int keylines = 0x7f030150;
public static final int layout_anchor = 0x7f030155;
public static final int layout_anchorGravity = 0x7f030156;
public static final int layout_behavior = 0x7f030157;
public static final int layout_dodgeInsetEdges = 0x7f030183;
public static final int layout_insetEdge = 0x7f03018f;
public static final int layout_keyline = 0x7f030190;
public static final int statusBarBackground = 0x7f0301f2;
public static final int ttcIndex = 0x7f030253;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f05007e;
public static final int notification_icon_bg_color = 0x7f05007f;
public static final int ripple_material_light = 0x7f05008b;
public static final int secondary_text_default_material_light = 0x7f05008d;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f060057;
public static final int compat_button_inset_vertical_material = 0x7f060058;
public static final int compat_button_padding_horizontal_material = 0x7f060059;
public static final int compat_button_padding_vertical_material = 0x7f06005a;
public static final int compat_control_corner_material = 0x7f06005b;
public static final int compat_notification_large_icon_max_height = 0x7f06005c;
public static final int compat_notification_large_icon_max_width = 0x7f06005d;
public static final int notification_action_icon_size = 0x7f0600d9;
public static final int notification_action_text_size = 0x7f0600da;
public static final int notification_big_circle_margin = 0x7f0600db;
public static final int notification_content_margin_start = 0x7f0600dc;
public static final int notification_large_icon_height = 0x7f0600dd;
public static final int notification_large_icon_width = 0x7f0600de;
public static final int notification_main_column_padding_top = 0x7f0600df;
public static final int notification_media_narrow_margin = 0x7f0600e0;
public static final int notification_right_icon_size = 0x7f0600e1;
public static final int notification_right_side_padding_top = 0x7f0600e2;
public static final int notification_small_icon_background_padding = 0x7f0600e3;
public static final int notification_small_icon_size_as_large = 0x7f0600e4;
public static final int notification_subtext_size = 0x7f0600e5;
public static final int notification_top_pad = 0x7f0600e6;
public static final int notification_top_pad_large_text = 0x7f0600e7;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f07008d;
public static final int notification_bg = 0x7f07008e;
public static final int notification_bg_low = 0x7f07008f;
public static final int notification_bg_low_normal = 0x7f070090;
public static final int notification_bg_low_pressed = 0x7f070091;
public static final int notification_bg_normal = 0x7f070092;
public static final int notification_bg_normal_pressed = 0x7f070093;
public static final int notification_icon_background = 0x7f070094;
public static final int notification_template_icon_bg = 0x7f070095;
public static final int notification_template_icon_low_bg = 0x7f070096;
public static final int notification_tile_bg = 0x7f070097;
public static final int notify_panel_notification_icon_bg = 0x7f070098;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f080011;
public static final int action_divider = 0x7f080013;
public static final int action_image = 0x7f080014;
public static final int action_text = 0x7f08001a;
public static final int actions = 0x7f08001b;
public static final int async = 0x7f080024;
public static final int blocking = 0x7f080028;
public static final int bottom = 0x7f080029;
public static final int chronometer = 0x7f080033;
public static final int end = 0x7f080051;
public static final int forever = 0x7f08005f;
public static final int icon = 0x7f080067;
public static final int icon_group = 0x7f080068;
public static final int info = 0x7f08006c;
public static final int italic = 0x7f08006e;
public static final int left = 0x7f080072;
public static final int line1 = 0x7f080074;
public static final int line3 = 0x7f080075;
public static final int none = 0x7f080096;
public static final int normal = 0x7f080097;
public static final int notification_background = 0x7f080098;
public static final int notification_main_column = 0x7f080099;
public static final int notification_main_column_container = 0x7f08009a;
public static final int right = 0x7f0800b5;
public static final int right_icon = 0x7f0800b6;
public static final int right_side = 0x7f0800b7;
public static final int start = 0x7f0800e3;
public static final int tag_transition_group = 0x7f0800e9;
public static final int tag_unhandled_key_event_manager = 0x7f0800ea;
public static final int tag_unhandled_key_listeners = 0x7f0800eb;
public static final int text = 0x7f0800ec;
public static final int text2 = 0x7f0800ed;
public static final int time = 0x7f0800f4;
public static final int title = 0x7f0800f5;
public static final int top = 0x7f0800f8;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f09000e;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f0b0034;
public static final int notification_action_tombstone = 0x7f0b0035;
public static final int notification_template_custom_big = 0x7f0b003c;
public static final int notification_template_icon_group = 0x7f0b003d;
public static final int notification_template_part_chronometer = 0x7f0b0041;
public static final int notification_template_part_time = 0x7f0b0042;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0e0088;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0f010d;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0f010e;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f0110;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0f0113;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0f0115;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0f01b9;
public static final int Widget_Compat_NotificationActionText = 0x7f0f01ba;
public static final int Widget_Support_CoordinatorLayout = 0x7f0f01db;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f030029 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] CoordinatorLayout = { 0x7f030150, 0x7f0301f2 };
public static final int CoordinatorLayout_keylines = 0;
public static final int CoordinatorLayout_statusBarBackground = 1;
public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f030155, 0x7f030156, 0x7f030157, 0x7f030183, 0x7f03018f, 0x7f030190 };
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0;
public static final int CoordinatorLayout_Layout_layout_anchor = 1;
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2;
public static final int CoordinatorLayout_Layout_layout_behavior = 3;
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4;
public static final int CoordinatorLayout_Layout_layout_insetEdge = 5;
public static final int CoordinatorLayout_Layout_layout_keyline = 6;
public static final int[] FontFamily = { 0x7f03011c, 0x7f03011d, 0x7f03011e, 0x7f03011f, 0x7f030120, 0x7f030121 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f03011a, 0x7f030122, 0x7f030123, 0x7f030124, 0x7f030253 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"[email protected]"
] | |
13fc486d1ed80030605c657176701295a1229e1a | dc872f15afe26843371d7219b673898387aabc22 | /OpenEdXMobile/src/main/java/sa/gov/moe/etraining/http/interceptor/StaleIfErrorInterceptor.java | dd50ac88aa77eff8ba02d7f4cd8bbb4e2ea682d7 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ilearninteractive/mob-app-android | ddd4b5e1ebfba23efe594d4d0ccc1d1c6efa6543 | d661b8aecb871e21378f317665dfdd97217b633d | refs/heads/master | 2020-03-23T22:00:47.534494 | 2018-08-15T13:04:38 | 2018-08-15T13:04:38 | 142,147,439 | 1 | 1 | Apache-2.0 | 2018-11-02T17:36:42 | 2018-07-24T11:13:12 | Java | UTF-8 | Java | false | false | 2,099 | java | package sa.gov.moe.etraining.http.interceptor;
import android.support.annotation.NonNull;
import java.io.IOException;
import java.util.regex.Pattern;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.internal.http.HttpMethod;
/**
* An OkHttp interceptor that adds the 'stale-if-error' Cache-Control directive to requests if
* possible and not already present. The maximum stale value will be set to
* {@link Integer#MAX_VALUE} in seconds.
*/
public class StaleIfErrorInterceptor implements Interceptor {
/**
* A regular expression for finding a valid 'stale-if-error' directive in the Cache-Control
* header.
*/
private static final Pattern PATTERN_STALE_IF_ERROR = Pattern.compile(
"(?:^|[,;])\\s*stale-if-error\\s*(?:=\\s*[^,;\\s]+\\s*)?(?:$|[,;])");
@Override
public Response intercept(@NonNull final Chain chain) throws IOException {
Request request = chain.request();
// Verify that the HTTP method is for loading data only and doesn't have any side-effects,
// and that the request doesn't contain the 'only-if-cached' Cache-Control directive to
// force loading from the cache.
if (!HttpMethod.invalidatesCache(request.method()) &&
!request.cacheControl().onlyIfCached()) {
// If the request already has the 'stale-if-error' Cache-Control directive, then proceed
// the request chain without interference.
for (final String cacheControlValue : request.headers("Cache-Control")) {
if (PATTERN_STALE_IF_ERROR.matcher(cacheControlValue).matches()) {
return chain.proceed(request);
}
}
// Otherwise add a 'stale-if-error' Cache-Control directive, with the maximum stale
// value set to a very high value.
request = request.newBuilder()
.addHeader("Cache-Control", "stale-if-error=" + Integer.MAX_VALUE)
.build();
}
return chain.proceed(request);
}
}
| [
"[email protected]"
] | |
343addf24605800ebc79ed4a24aa1bbf2c02b47e | 55e99aeb017aa1ec29ae03c0181d89a6a0fefdf2 | /ProyectoGestion/src/Ventanas/VentanaCambiarContrasenya.java | ec7001f3081a85cb58054bd166f3deee3032c67f | [] | no_license | jramos6/gestion-eventos | 3972a493694f4d0ec96b9d2efced6fab12985026 | cc961c2c2a40099692df293c291060af1c60c4ba | refs/heads/master | 2021-01-10T23:56:16.856568 | 2017-01-18T10:51:07 | 2017-01-18T10:51:07 | 70,782,099 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,610 | java | package Ventanas;
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.Font;
import java.awt.Color;
import java.awt.GridLayout;
import javax.swing.JPasswordField;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* Ventana que da la opción de cambiar la contraseña al administrador del programa
* @author Javier Rivero y Aitor Santamaria
*
*/
public class VentanaCambiarContrasenya extends JFrame {
/**
* Serial number
*/
private static final long serialVersionUID = 1L;
private JPanel contentPane;
private JPasswordField passwordFieldContraActual;
private JPasswordField passwordFieldNuevaContra1;
private JPasswordField passwordFieldNuevaContra2;
/**
* Create the frame.
*/
public VentanaCambiarContrasenya() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 600, 400);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
JPanel panelN = new JPanel();
panelN.setBackground(Color.CYAN);
contentPane.add(panelN, BorderLayout.NORTH);
JLabel lblCambioDeContrasea = new JLabel("Cambio de contraseña del administrador: ");
lblCambioDeContrasea.setFont(new Font("Bookman Old Style", Font.PLAIN, 13));
panelN.add(lblCambioDeContrasea);
JPanel panelS = new JPanel();
contentPane.add(panelS, BorderLayout.SOUTH);
VentanaCambiarContrasenya vcc =this;
JButton btnVolver = new JButton("Volver");
btnVolver.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
VentanaAdministrador va = new VentanaAdministrador();
va.setVisible(true);
vcc.dispose();
}
});
panelS.add(btnVolver);
JButton btnAceptar = new JButton("Aceptar");
btnAceptar.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
String contraActual = passwordFieldContraActual.getText();
String contraNueva1 = passwordFieldNuevaContra1.getText();
String contraNueva2 = passwordFieldNuevaContra2.getText();
//Comprobamos que no hay espacios vacios
if(passwordFieldContraActual.getText().equals("") || passwordFieldNuevaContra1.getText().equals("") || passwordFieldNuevaContra2.getText().equals("")){
JOptionPane.showMessageDialog(null, "No se pueden dejar campos en blanco", "ERROR", JOptionPane.ERROR_MESSAGE);
vaciarCampos();
}
//Comprobamos que la contraseña actual es correcta
else if(!contraActual.equals(VentanaLogin.bd.obtenerContraAdmin())){
JOptionPane.showMessageDialog(null, "Contraseña actual incorrecta", "ERROR", JOptionPane.ERROR_MESSAGE);
vaciarCampos();
}
//Comprobamos que las dos contraseñas nuevas coinciden
else if(!contraNueva1.equals(contraNueva2)){
JOptionPane.showMessageDialog(null, "Las nuevas contraseñas no coinciden", "ERROR", JOptionPane.ERROR_MESSAGE);
vaciarCampos();
}else{
//Actualizamos la contraseña del administrador en la base de datos
VentanaLogin.bd.actualizarContraAdmin(contraNueva1);
JOptionPane.showMessageDialog(null, "Contraseña actualizada correctamente");
}
}
});
panelS.add(btnAceptar);
JPanel panel = new JPanel();
contentPane.add(panel, BorderLayout.CENTER);
panel.setLayout(new GridLayout(0, 2, 0, 0));
JPanel panelRelleno1 = new JPanel();
panel.add(panelRelleno1);
JPanel panelRelleno2 = new JPanel();
panel.add(panelRelleno2);
JLabel lblContrasenyaActual = new JLabel("Contraseña actual: ");
panel.add(lblContrasenyaActual);
passwordFieldContraActual = new JPasswordField();
panel.add(passwordFieldContraActual);
JLabel lblNuevaContrasenya = new JLabel("Nueva contraseña: ");
panel.add(lblNuevaContrasenya);
passwordFieldNuevaContra1 = new JPasswordField();
panel.add(passwordFieldNuevaContra1);
JLabel lblRepetirContrasenya = new JLabel("Repetir contraseña: ");
panel.add(lblRepetirContrasenya);
passwordFieldNuevaContra2 = new JPasswordField();
panel.add(passwordFieldNuevaContra2);
JPanel panelRelleno4 = new JPanel();
panel.add(panelRelleno4);
JPanel panelRelleno3 = new JPanel();
panel.add(panelRelleno3);
}
public void vaciarCampos(){
passwordFieldContraActual.setText("");
passwordFieldNuevaContra1.setText("");
passwordFieldNuevaContra2.setText("");
}
}
| [
"[email protected]"
] | |
c93b0768ccbcd26a2f48909ca6fb140b15a38929 | 77ceed3d1b9d8899229ae3f9fded19830b0ab5fb | /TestSchultegrid/app/src/test/java/com/test/testschultegrid/ExampleUnitTest.java | 32de3e24e8d061973175d5d23db20d25cd9d17c0 | [] | no_license | everysun/learnTry | fcd2118b077f8296d54c4ab1d8f73e9bd0e25a5b | cb42e1fcd31f9fc3866e97fc75935066ecae2f47 | refs/heads/master | 2021-01-10T12:09:00.435495 | 2020-04-17T11:41:34 | 2020-04-17T11:41:34 | 53,730,727 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package com.test.testschultegrid;
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);
}
} | [
"[email protected]"
] | |
3b14d6fe97812f9393d2a026ff39dbe656bc2d85 | 214daf9bb0b894f60dd361d06547fe704206249b | /lims Maven Webapp/src/main/java/com/ioes/lims/action/IndexAction.java | 7dbc5816865f39840fc1fabcf48c29e67e104a61 | [] | no_license | zxpduan/LIMS | 55c3817ef06113be6ab0877e179e11e7b12a57db | f75601869726c7bf5ff753f93080aac578e62733 | refs/heads/master | 2021-07-16T12:01:29.652364 | 2017-10-22T14:33:08 | 2017-10-22T14:33:08 | 107,872,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,011 | java | package com.ioes.lims.action;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import com.ioes.lims.beans.Favorite;
import com.ioes.lims.beans.User;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.sias.util.Initbean;
import com.sias.util.RedisUitl;
import com.sias.util.SessionUtil;
import com.sias.util.dataTypeUtil;
@Service("indexAction")
@Scope("prototype")
public class IndexAction extends BaseAction<User> {
private static Logger logger = Logger.getLogger(IndexAction.class);
public String index(){
HttpServletRequest request1=ServletActionContext.getRequest();
String userid=request1.getSession().getAttribute("_user_id").toString();//user id
User u=userDao.findById(userid);
request.put("username", u.getUsername());
List <Favorite> lfs=favoriteDAO.findByUserid(thissession.getAttribute("_user_id").toString());
for (Favorite favorite : lfs) {
switch (favorite.getFavcode()) {
case 1:
request.put("navfix", favorite.getFavvalue());
break;
case 2:
request.put("leftnavfix", favorite.getFavvalue());
break;
case 3:
request.put("skin", favorite.getFavvalue());
break;
case 4:
request.put("deskfun", favorite.getFavvalue());
break;
case 5:
request.put("breakcrumbsfix", favorite.getFavvalue());
break;
}
}
return "index";
}
}
| [
"[email protected]"
] | |
1b95cb74ff340143e1b148245c8e2cc15da133ab | 6ea4e4b76ea385a63fa36bfaa9d59118b71aa141 | /src/main/java/labprograms/ACMS/mutants/SDL_22/AirlinesBaggageBillingService.java | a6d7404a772d82ac64c5d42f626b3e1a1e0dfdb0 | [] | no_license | phantomDai/DMT | 4e0d691b6f9cdec0909f49a10a48f5174de23986 | ec9efe5f3ccd30df7a512c0def948e87b6b9d884 | refs/heads/master | 2022-07-04T08:15:13.700999 | 2021-03-17T03:24:15 | 2021-03-17T03:24:15 | 186,924,147 | 0 | 2 | null | 2022-06-17T02:09:57 | 2019-05-16T00:54:46 | Java | UTF-8 | Java | false | false | 1,918 | java | package labprograms.ACMS.mutants.SDL_22;
// Author : ysma
public class AirlinesBaggageBillingService
{
int airClass = 0;
int area = 0;
double luggage = 0;
double benchmark = 0;
double takealong = 0;
double luggagefee = 0;
int tln = 0;
boolean isStudent = false;
double economicfee = 0;
public double feeCalculation( int airClass, int area, boolean isStudent, double luggage, double economicfee )
{
this.airClass = this.preairclass( airClass );
this.area = this.prearea( area );
switch (this.airClass) {
case 0 :
benchmark = 40;
break;
case 1 :
benchmark = 30;
break;
case 2 :
benchmark = 20;
break;
case 3 :
benchmark = 0;
break;
}
if (true) {
takealong = 7;
tln = 1;
if (isStudent) {
benchmark = 30;
}
}
if (this.area == 0) {
switch (this.airClass) {
case 0 :
tln = 2;
takealong = 5;
break;
case 1 :
tln = 1;
takealong = 5;
break;
case 2 :
tln = 1;
takealong = 5;
break;
case 3 :
tln = 1;
takealong = 5;
break;
}
}
if (benchmark > luggage) {
luggage = benchmark;
}
return luggagefee = (luggage - benchmark) * economicfee * 0.015;
}
public int preairclass( int airClass )
{
int result = 0;
result = airClass % 4;
return result;
}
public int prearea( int area )
{
int result = 0;
result = area % 2;
return result;
}
}
| [
"[email protected]"
] | |
fbde17ea5925e3a65dc36a301ceb24ee295e3b13 | 9edf63bccfec04db2e584100ef34f8a9064f014f | /app/src/androidTest/java/com/example/permissionchecker/ExampleInstrumentedTest.java | 6d3de1dca313b2602c1a8401501924ec09af684e | [] | no_license | androcoded/android-permission-checker | 2bf4031a6a15e34bd4bd746138c7cbc6ea143ee1 | 5d6820d08193cbcdf3ea72e1c7cd4a005e7440b1 | refs/heads/master | 2022-04-19T21:58:36.343004 | 2020-04-13T12:51:29 | 2020-04-13T12:51:29 | 255,325,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | package com.example.permissionchecker;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext();
assertEquals("com.example.permissionchecker", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
caf5eb5ce141b9d539120cc121015eda247ef8df | 8bad6d131117e98c0ba45d97cc68547c94a7fe15 | /JavaSwing/Swing2-BorderLayoutAndTextAreas/src/main/java/client/MainFrame.java | c330d0f7c2d634d5a9d0f95712b9aff0c83dbccf | [] | no_license | barcvilla/Java-Swing | 51b0163e5f35a86126fa80ad2aa1f1b776b24de9 | 8b296ad0d5d5f0896ef778aa1e9ccde6940468ae | refs/heads/master | 2020-03-27T09:28:50.441499 | 2019-01-07T16:17:42 | 2019-01-07T16:17:42 | 146,344,984 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,100 | 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 client;
import java.awt.BorderLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
/**
*
* @author PC
*/
public class MainFrame extends JFrame {
private JButton btn;
private JTextArea textArea;
public MainFrame() {
super("Hello World");
setLayout(new BorderLayout());
textArea = new JTextArea();
btn = new JButton("Click me!");
add(textArea, BorderLayout.CENTER);
add(btn, BorderLayout.SOUTH);
setSize(600, 500);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new MainFrame();
}
});
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.