blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | 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 132 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 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ab78d672c55ce94b4da4f051acb352e18daf1ef6 | 8780530566622c886e22ddac6675cce94ff7626c | /Contests-Java/src/Codechef/MINMO.java | 70955e7a522ff64bfc01953c7c2bab004e438e48 | [] | no_license | somnathrakshit/Code | 50917f830c572df6917e6ad2f72f5126e84abef8 | 9577f40b028d192db25bd64d9aa40264a93cbaae | refs/heads/master | 2020-05-21T05:52:51.507840 | 2018-04-09T16:05:23 | 2018-04-09T16:05:23 | 64,105,277 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,096 | java | /*
* Name : MINMO.java
* Author: Somnath Rakshit
* Date : Sep 02, 2016
*/
package Codechef;
import java.io.*;
import java.util.InputMismatchException;
class MINMO {
public static void main(String[] args) throws Exception {
InputReader in = new InputReader(System.in);
OutputWriter out = new OutputWriter(System.out);
int i, j, n, bb, m = 0;
n = in.readInt();
bb = in.readInt();
String xt[] = in.readStringFull().split(" ");
String yt[] = in.readStringFull().split(" ");
int x[] = new int[xt.length];
int y[] = new int[yt.length];
int a, b, c, d;
for (i = 0; i < xt.length; i++) {
x[i] = Integer.parseInt(xt[i]);
y[i] = Integer.parseInt(yt[i]);
}
for (i = 0; i < x.length; i++) {
a = getDistance(1, 1, x[i], y[i]);
b = getDistance(n, 1, x[i], y[i]);
c = getDistance(n, n, x[i], y[i]);
d = getDistance(1, n, x[i], y[i]);
m += min(a, b, c, d);
}
out.printLine(m);
out.flush();
out.close();
}
public static int min(int... n) {
int i = 0;
int min = n[0];
while (++i < n.length)
if (n[i] < min)
min = n[i];
return min;
}
public static int getDistance(int x1, int y1, int x2, int y2) {
int a = Math.abs(y1 - y2);
int b = Math.abs(x1 - x2);
return a + b;
}
//FAST I/O
private static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;
public int[] readIntArray(int size) {
int[] array = new int[size];
for (int i = 0; i < size; i++)
array[i] = readInt();
return array;
}
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 readInt() {
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 - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public String readString() {
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 String readStringFull() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (c != '\n');
return res.toString();
}
public double readDouble() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
double res = 0;
while (!isSpaceChar(c) && c != '.') {
if (c == 'e' || c == 'E')
return res * Math.pow(10, readInt());
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
}
if (c == '.') {
c = read();
double m = 1;
while (!isSpaceChar(c)) {
if (c == 'e' || c == 'E')
return res * Math.pow(10, readInt());
if (c < '0' || c > '9')
throw new InputMismatchException();
m /= 10;
res += (c - '0') * m;
c = read();
}
}
return res * sgn;
}
public long readLong() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public String next() {
return readString();
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
private static class OutputWriter {
private final PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
}
public OutputWriter(Writer writer) {
this.writer = new PrintWriter(writer);
}
public void print(Object... objects) {
for (int i = 0; i < objects.length; i++) {
if (i != 0)
writer.print(' ');
writer.print(objects[i]);
}
}
public void printIntArray(int objects[]) {
for (int i = 0; i < objects.length; i++) {
writer.print(objects[i]);
writer.print(' ');
}
writer.println();
}
public void printLine(Object... objects) {
print(objects);
writer.println();
}
public void close() {
writer.close();
}
public void flush() {
writer.flush();
}
}
}
| [
"somnath52@gmail.com"
] | somnath52@gmail.com |
1b17d27d5f8414473e2e666d7bd39dc280ed6eb8 | cbed20e79682e24354eee3216386e637096d6b14 | /app/src/main/java/smile/khaled/mohamed/rehab/utils/ValidateUtils.java | 40b83f96f0fa33c7d6a28aa350d29d6ff8685c6b | [] | no_license | mohamedkhaledalizayed/Rehab | adc3e6ce3581aef790f9e94103c29d9d978fa32c | b82751c00ed1389af65747f80a6a19d8904db289 | refs/heads/master | 2020-04-15T12:14:55.432887 | 2019-01-28T23:25:22 | 2019-01-28T23:25:22 | 164,666,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,043 | java | package smile.khaled.mohamed.rehab.utils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ValidateUtils {
public static boolean validPhone(String phone){
Pattern pattern = Pattern.compile("^[1-9]{1}[0-9]{8}$");
Matcher matcher = pattern.matcher(phone);
return matcher.find();
}
public static boolean validPrice(String phone){
Pattern pattern = Pattern.compile("[0-9]+");
Matcher matcher = pattern.matcher(phone);
return matcher.find();
}
public static boolean validPassword(String password) {
return password.length() >= 6;
}
public static boolean missingInputs(String... inputs) {
for (String input : inputs) {
if (input.isEmpty())
return true;
}
return false;
}
public static boolean validMail(String email) {
return email.matches("^[_A-Za-z0-9-+]+(\\.[_A-Za-z0-9-]+)*@"
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
}
}
| [
"mohamedsmile999@gmail.com"
] | mohamedsmile999@gmail.com |
5f38c28c07121980ad9edb9c56c27ca402191e17 | 6c0d4f3828966746d72471b2131f68a05b4036bf | /src/product/gpon/com/topvision/ems/gpon/onu/dao/mybatis/GponOnuDaoImpl.java | 3acf545ebc88c8f8723857f9aed9cf6dd4e31c79 | [] | no_license | kevinXiao2016/topvision-server | b5b97de7436edcae94ad2648bce8a34759f7cf0b | b5934149c50f22661162ac2b8903b61a50bc63e9 | refs/heads/master | 2020-04-12T00:54:33.351152 | 2018-12-18T02:16:14 | 2018-12-18T02:16:14 | 162,215,931 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,273 | java | /***********************************************************************
* $Id: GponDaoImpl.java,v1.0 2016年10月17日 下午4:07:12 $
*
* @author: Rod John
*
* (c)Copyright 2011 Topvision All rights reserved.
***********************************************************************/
package com.topvision.ems.gpon.onu.dao.mybatis;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.topvision.ems.epon.onu.dao.OnuDao;
import com.topvision.ems.epon.onu.dao.UniDao;
import com.topvision.ems.gpon.onu.dao.GponOnuDao;
import com.topvision.ems.gpon.onu.domain.GponOnuAttribute;
import com.topvision.ems.gpon.onu.domain.GponOnuCapability;
import com.topvision.ems.gpon.onu.domain.GponOnuInfoSoftware;
import com.topvision.ems.gpon.onu.domain.GponOnuIpHost;
import com.topvision.ems.gpon.onu.domain.GponOnuUniPvid;
import com.topvision.ems.gpon.onu.domain.GponUniAttribute;
import com.topvision.framework.dao.mybatis.MyBatisDaoSupport;
/**
* @author Rod John
* @created @2016年10月17日-下午4:07:12
*
*/
@Repository("gponOnuDao")
public class GponOnuDaoImpl extends MyBatisDaoSupport<GponOnuAttribute> implements GponOnuDao {
@Autowired
private OnuDao onuDao;
@Autowired
private UniDao uniDao;
/* (non-Javadoc)
* @see com.topvision.ems.gpon.onu.dao.GponOnuDao#syncGponOnuIpHosts(java.lang.Long, java.util.List)
*/
@Override
public void syncGponOnuIpHosts(Long entityId, List<GponOnuIpHost> gponOnuIpHosts) {
List<Long> onuIdList = new ArrayList<Long>();
for (GponOnuIpHost gponOnuIpHost : gponOnuIpHosts) {
gponOnuIpHost.setEntityId(entityId);
Long onuId = onuDao.getOnuIdByIndex(gponOnuIpHost.getEntityId(), gponOnuIpHost.getOnuIndex());
gponOnuIpHost.setOnuId(onuId);
if (!onuIdList.contains(onuId)) {
onuIdList.add(onuId);
}
}
SqlSession sqlSession = getBatchSession();
try {
for (Long onuId : onuIdList) {
sqlSession.delete(getNameSpace() + "delGponOnuIpHostByOnuId", onuId);
}
for (GponOnuIpHost gponOnuIpHost : gponOnuIpHosts) {
sqlSession.insert(getNameSpace() + "syncGponOnuIpHosts", gponOnuIpHost);
}
sqlSession.commit();
} catch (Exception e) {
logger.error("", e);
sqlSession.rollback();
} finally {
sqlSession.close();
}
}
/* (non-Javadoc)
* @see com.topvision.ems.gpon.onu.dao.GponOnuDao#syncGponSoftware(java.lang.Long, java.util.List)
*/
@Override
public void syncGponSoftware(Long entityId, List<GponOnuInfoSoftware> gponOnuInfoSoftwares) {
for (GponOnuInfoSoftware gponOnuInfoSoftware : gponOnuInfoSoftwares) {
gponOnuInfoSoftware.setEntityId(entityId);
gponOnuInfoSoftware.setOnuId(onuDao.getOnuIdByIndex(gponOnuInfoSoftware.getEntityId(),
gponOnuInfoSoftware.getOnuIndex()));
}
SqlSession sqlSession = getBatchSession();
try {
for (GponOnuInfoSoftware gponOnuInfoSoftware : gponOnuInfoSoftwares) {
sqlSession.insert(getNameSpace() + "syncGponSoftware", gponOnuInfoSoftware);
}
sqlSession.commit();
} catch (Exception e) {
logger.error("", e);
sqlSession.rollback();
} finally {
sqlSession.close();
}
}
@Override
public void syncGponOnuUniPvid(Long entityId, List<GponOnuUniPvid> gponOnuUniPvidList) {
for (GponOnuUniPvid gponOnuUniPvid : gponOnuUniPvidList) {
gponOnuUniPvid.setEntityId(entityId);
gponOnuUniPvid.setUniId(uniDao.getUniIdByIndex(entityId, gponOnuUniPvid.getUniIndex()));
}
SqlSession sqlSession = getBatchSession();
try {
for (GponOnuUniPvid gponOnuUniPvid : gponOnuUniPvidList) {
sqlSession.insert(getNameSpace() + "syncGponOnuUniPvid", gponOnuUniPvid);
}
sqlSession.commit();
} catch (Exception e) {
logger.error("", e);
sqlSession.rollback();
} finally {
sqlSession.close();
}
}
/* (non-Javadoc)
* @see com.topvision.framework.dao.mybatis.MyBatisDaoSupport#getDomainName()
*/
@Override
protected String getDomainName() {
return "com.topvision.ems.gpon.onu.dao.GponOnuDao";
}
/* (non-Javadoc)
* @see com.topvision.ems.gpon.onu.dao.GponOnuDao#syncGponOnuCapability(java.util.List, java.util.HashMap)
*/
@Override
public void syncGponOnuCapability(List<GponOnuCapability> gponOnuCapabilities, HashMap<Long, Long> onuMap) {
SqlSession session = getBatchSession();
try {
for (GponOnuCapability gponOnuCapability : gponOnuCapabilities) {
if (onuMap.containsKey(gponOnuCapability.getOnuIndex())) {
gponOnuCapability.setOnuId(onuMap.get(gponOnuCapability.getOnuIndex()));
session.update(getNameSpace() + "updateGponOnuCapability", gponOnuCapability);
}
}
session.commit();
} catch (Exception e) {
logger.error("", e);
session.rollback();
} finally {
session.close();
}
}
/* (non-Javadoc)
* @see com.topvision.ems.gpon.onu.dao.GponOnuDao#queryForGponOnuCapability(long)
*/
@Override
public GponOnuCapability queryForGponOnuCapability(long onuId) {
return getSqlSession().selectOne(getNameSpace("queryForGponOnuCapability"), onuId);
}
@Override
public GponOnuInfoSoftware queryForGponOnuSoftware(Long onuId) {
return getSqlSession().selectOne(getNameSpace("queryForGponOnuSoftware"), onuId);
}
@Override
public List<GponOnuIpHost> loadGponOnuIpHost(HashMap<String, Object> map) {
return getSqlSession().selectList(getNameSpace("loadGponOnuIpHost"), map);
}
@Override
public void addGponOnuIpHost(GponOnuIpHost gponOnuIpHost) {
getSqlSession().insert(getNameSpace("syncGponOnuIpHosts"), gponOnuIpHost);
}
@Override
public GponOnuIpHost getGponOnuIpHost(Long onuId, Integer onuIpHostIndex) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("onuId", onuId);
map.put("onuIpHostIndex", onuIpHostIndex);
return getSqlSession().selectOne(getNameSpace("getGponOnuIpHost"), map);
}
@Override
public void modifyGponOnuIpHost(GponOnuIpHost gponOnuIpHost) {
getSqlSession().update(getNameSpace("syncGponOnuIpHosts"), gponOnuIpHost);
}
@Override
public void delGponOnuIpHost(Long onuId, Integer onuIpHostIndex) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("onuId", onuId);
map.put("onuIpHostIndex", onuIpHostIndex);
getSqlSession().delete(getNameSpace("delGponOnuIpHost"), map);
}
@Override
public void delGponOnuIpHostByOnuId(Long onuId) {
getSqlSession().delete(getNameSpace("delGponOnuIpHostByOnuId"), onuId);
}
@Override
public List<Integer> usedHostIpIndex(Long onuId) {
return getSqlSession().selectList(getNameSpace("getUsedHostIpIndex"), onuId);
}
@Override
public List<GponUniAttribute> loadGponOnuUniList(Long onuId) {
return getSqlSession().selectList(getNameSpace("loadGponOnuUniList"), onuId);
}
@Override
public GponUniAttribute loadUniVlanConfig(Long uniId) {
return getSqlSession().selectOne(getNameSpace("loadUniVlanConfig"), uniId);
}
@Override
public void setUniVlanConfig(Long uniId, Integer gponOnuUniPri, Integer gponOnuUniPvid) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("uniId", uniId);
map.put("gponOnuUniPri", gponOnuUniPri);
map.put("gponOnuUniPvid", gponOnuUniPvid);
getSqlSession().update(getNameSpace("updateUniVlanConfig"), map);
}
}
| [
"785554043@qq.com"
] | 785554043@qq.com |
15af7debd7b633ec2931893053db97e68ba6d111 | 080b899cfaebbdacb8494526c2592ed23bf5e518 | /hiro-injection/src/main/java/org/jglue/hiro/Injector.java | 2ece25c10b059eccb7791dd3e8a9b8b8b490b30e | [] | no_license | BrynCooke/hiro | 6696bf9fc594435ad66ee00118ec0f3505d206d8 | 8a05d090c0e2d0f9d0886a0061b808248927a0e2 | refs/heads/master | 2020-12-24T14:35:33.760832 | 2014-09-26T13:33:45 | 2014-09-26T13:33:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 120 | java | package org.jglue.hiro;
public interface Injector {
<T> T get(TypeLiteral<T> type);
<T> T get(Class<T> type);
}
| [
"bryncooke@gmail.com"
] | bryncooke@gmail.com |
740080d9c85e8faf830a29ebd78e7baed516b9f6 | 9bf92fabd9830e4f2c2eaa1112893de21e7eaee1 | /src/main/java/com/voshodnerd/springjaxws/impl/HelloWorldBoImpl.java | b391d5fcb63e5365ee9e16385785b521b32cb36e | [] | no_license | voshod-nerd/simpleJAX-WS | ecde0b544529237879dcc07f7f5c99c452b66023 | 2c99a73e77393cc852e76ef0a5bcffb2c0ac9e16 | refs/heads/master | 2021-01-22T03:12:58.785282 | 2016-10-27T11:22:54 | 2016-10-27T11:22:54 | 72,101,093 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 467 | 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.voshodnerd.springjaxws.impl;
import com.voshodnerd.springjaxws.interfaces.HelloWorldBo;
/**
*
* @author Талалаев
*/
public class HelloWorldBoImpl implements HelloWorldBo{
public String getHelloWorld(){
return "JAX-WS + Spring!";
}
} | [
"Талалаев@Talalaev-PC.btfoms.ru"
] | Талалаев@Talalaev-PC.btfoms.ru |
614928995473f0340b5ebefac63f006fc67a5f4d | 53d565b75b45d87364eadf8301bfabba1a46f141 | /module_3/src/main/java/ua/com/alevel/service/IncomeCategoryService.java | 5aa34aecfbcfa7823d9f3ad45ebb5cea9c4e2c0f | [] | no_license | DemianenkoVadim/nix_7 | 7273f045e081227f5e6304259a49ecb06fd4bd5c | 51ba9a98e6b473ef8e65174a1d89aa7890d221b4 | refs/heads/master | 2023-09-05T01:32:19.807829 | 2021-11-08T13:20:53 | 2021-11-08T13:20:53 | 384,735,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 300 | java | package ua.com.alevel.service;
import ua.com.alevel.entity.IncomeCategory;
import java.sql.SQLException;
public interface IncomeCategoryService {
void addIncomeCategory(IncomeCategory incomeCategory) throws SQLException;
void printsAllFinancialIncomeInDatabase() throws SQLException;
}
| [
"demvs18@gmail.com"
] | demvs18@gmail.com |
5c2bffec1fef4e1aa53e8a2c5528284be7daaae5 | 021f26eb0321e1175bc99165bbb2860987ce41c7 | /20191_COMP217/final_exam/problem2/Phone.java | d0eb3ec6fcb2312bbf47429834b13c9062e78f71 | [] | no_license | gogog123/study | eb5ddfdcfe4df67976869d7da7f5a6c1d87b7d91 | fb960fa55f05722c10e19ea16e36cc6a53d0d0c3 | refs/heads/master | 2023-02-09T10:49:09.240150 | 2021-01-04T15:45:18 | 2021-01-04T15:45:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 633 | java | package problem2;
public class Phone {
private String name, address, telNum;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getTelNum() {
return telNum;
}
public void setTelNum(String telNum) {
this.telNum = telNum;
}
Phone(String name, String address, String telNum) {
this.name = name;
this.address = address;
this.telNum = telNum;
}
public String toString() {
return name + " " + address + " " + telNum;
}
}
| [
"dogdriip@gmail.com"
] | dogdriip@gmail.com |
202c68fe5495573f18ff1daf802438324cb62c98 | 13c2d3db2d49c40c74c2e6420a9cd89377f1c934 | /program_data/JavaProgramData/91/1184.java | 4d2dca2b98f12e8475612d9b079b4c49b2947704 | [
"MIT"
] | permissive | qiuchili/ggnn_graph_classification | c2090fefe11f8bf650e734442eb96996a54dc112 | 291ff02404555511b94a4f477c6974ebd62dcf44 | refs/heads/master | 2021-10-18T14:54:26.154367 | 2018-10-21T23:34:14 | 2018-10-21T23:34:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package <missing>;
public class GlobalMembers
{
public static int Main()
{
String s = new String(new char[999]);
int i;
int n;
int t;
int tt;
int ttt;
s = new Scanner(System.in).nextLine();
n = s.length();
for (i = 1;i <= n;i++)
{
if (i < n)
{
t = s.charAt(i - 1);
tt = s.charAt(i);
ttt = t + tt;
System.out.printf("%c",ttt);
}
if (i == n)
{
t = s.charAt(i - 1);
tt = s.charAt(0);
ttt = t + tt;
System.out.printf("%c",ttt);
}
}
return 0;
}
}
| [
"y.yu@open.ac.uk"
] | y.yu@open.ac.uk |
270150aa51c083016b51ce3bd3aa5fd940940d5a | 478b1366b0b96b9cdfc93a6edaa5d12394a52106 | /cxf-client/src/main/java/com/dbs/services/person/ObjectFactory.java | 736fa543750cb031bd2f9b154e0048747f8085e4 | [] | no_license | Yufeng0918/webservice-learning | e536d97e5231fdb75ea66d2aea21faa35fc0e2a0 | 874160ae483e3b786a6d6a1af79da5e34f04e3c5 | refs/heads/master | 2022-07-09T17:54:41.189858 | 2020-05-12T15:42:03 | 2020-05-12T15:42:03 | 263,379,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,487 | java |
package com.dbs.services.person;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the com.dbs.services.person package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _GetPerson_QNAME = new QName("http://services.dbs.com/", "getPerson");
private final static QName _GetPersonResponse_QNAME = new QName("http://services.dbs.com/", "getPersonResponse");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.dbs.services.person
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link GetPerson }
*
*/
public GetPerson createGetPerson() {
return new GetPerson();
}
/**
* Create an instance of {@link GetPersonResponse }
*
*/
public GetPersonResponse createGetPersonResponse() {
return new GetPersonResponse();
}
/**
* Create an instance of {@link Person }
*
*/
public Person createPerson() {
return new Person();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link GetPerson }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://services.dbs.com/", name = "getPerson")
public JAXBElement<GetPerson> createGetPerson(GetPerson value) {
return new JAXBElement<GetPerson>(_GetPerson_QNAME, GetPerson.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link GetPersonResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://services.dbs.com/", name = "getPersonResponse")
public JAXBElement<GetPersonResponse> createGetPersonResponse(GetPersonResponse value) {
return new JAXBElement<GetPersonResponse>(_GetPersonResponse_QNAME, GetPersonResponse.class, null, value);
}
}
| [
"jiangyufeng.0918@gmail.com"
] | jiangyufeng.0918@gmail.com |
eea11341c7cb88c112c3afab81e885dc4b5fa6a8 | b547b92001c978a0cc555fdfb9238a6af1a65f15 | /src/main/java/com/school/MPPS/MppsModel/MppsTeacher.java | d24726e077f2f41164c0c5cf6a3067f471679a53 | [] | no_license | KrishnaTejaVemuri/dbms_Spring | fc07a85a8d1537bb6748a7972c7a66ef895073aa | 898ad6b476bb5a5e5fce3c519ff3009dd783fd46 | refs/heads/master | 2020-08-12T16:21:04.058365 | 2019-10-13T10:17:12 | 2019-10-13T10:17:12 | 214,798,833 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,244 | java | package com.school.MPPS.MppsModel;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
@Entity
public class MppsTeacher {
@Id
private int MppsTid;
@NotNull
private String FirstName;
private String LastName;
@NotNull
private int Age;
private String Caste;
@NotNull
private String Edq;
@NotNull
private String cat;
public MppsTeacher(int mppsTid) {
super();
MppsTid = mppsTid;
}
public MppsTeacher() {
super();
}
public int getMppsTid() {
return MppsTid;
}
public void setMppsTid(int mppsTid) {
MppsTid = mppsTid;
}
public String getFirstName() {
return FirstName;
}
public void setFirstName(String firstName) {
FirstName = firstName;
}
public String getLastName() {
return LastName;
}
public void setLastName(String lastName) {
LastName = lastName;
}
public int getAge() {
return Age;
}
public void setAge(int age) {
Age = age;
}
public String getCaste() {
return Caste;
}
public void setCaste(String caste) {
Caste = caste;
}
public String getEdq() {
return Edq;
}
public void setEdq(String edq) {
Edq = edq;
}
public String getCat() {
return cat;
}
public void setCat(String cat) {
this.cat = cat;
}
}
| [
"vemuri.kteja.cse17@itbhu.ac.in"
] | vemuri.kteja.cse17@itbhu.ac.in |
4077c43e0d441010165e4d2ee81ba7a38e011434 | 2041dd7af979d9f61c44da1f050a2f793b637f25 | /A2-WS1718/src/parser/WikiAnimationFilmParserMain.java | e36b775e060e16903b5c312c847cefa6d729009b | [] | no_license | TriPham259/Java-Praktikum | bf92e4ba161018678cf3cd1dc59cf96c7a5ce8bf | 332ad187f64fb37e8f316a0109e7179dd4683da7 | refs/heads/master | 2021-08-22T07:21:59.638691 | 2017-11-29T16:04:48 | 2017-11-29T16:04:48 | 106,854,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,537 | java | package parser;
import java.io.IOException;
import java.net.MalformedURLException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.ParseException;
import java.util.List;
import java.util.Properties;
public class WikiAnimationFilmParserMain {
/*
* Gegeben: main zum Starten des Programmss
*/
public static void main(String[] args) throws MalformedURLException, IOException, ParseException {
String fileName = "animation.html";
/*
* Damit das Programm auch von der Console korrekt startet, muss an erster
* Stelle des classpath immer der Pfad zum bin Verzeichnis des Projekts der
* Aufgabe 2 stehen !!!!!
*/
Path animationPath = Paths.get(System.getProperty("java.class.path").split(";")[0].trim(), fileName);
WikiAnimationFilmParser parser = new WikiAnimationFilmParser("file:///" + animationPath.toAbsolutePath());
// redirect the output of echoPage to firstParse.txt
// java -cp D:\GitHub\PM2\A2-WS718\bin parser.WikiAnimationFilmParserMain > firstParse.txt
// parser.echoPage();
ppList(parser.contentToFilmList());
}
/*
* Zeilenweise Ausgabe einer Liste Gegeben
*/
private static void ppList(List<?> list) {
for (Object o : list) {
System.out.println(o);
}
}
/**
* Untersuchen der Systemumgebung
*/
private static void showProps() {
Properties props = System.getProperties();
for (Object key : props.keySet()) {
System.out.println(key + ":" + props.getProperty((String) key));
}
}
} | [
"tripham@Tris-MacBook-Pro.local"
] | tripham@Tris-MacBook-Pro.local |
41ba7511312f18b3d99ea78fe7aab778edbf090a | f009dc33f9624aac592cb66c71a461270f932ffa | /src/main/java/com/alipay/api/response/AntMerchantExpandContractFacetofaceQueryResponse.java | 5fdc98850329200b875774ee56fda99430138ae0 | [
"Apache-2.0"
] | permissive | 1093445609/alipay-sdk-java-all | d685f635af9ac587bb8288def54d94e399412542 | 6bb77665389ba27f47d71cb7fa747109fe713f04 | refs/heads/master | 2021-04-02T16:49:18.593902 | 2020-03-06T03:04:53 | 2020-03-06T03:04:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,931 | java | package com.alipay.api.response;
import java.util.Date;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: ant.merchant.expand.contract.facetoface.query response.
*
* @author auto create
* @since 1.0, 2019-01-07 20:51:15
*/
public class AntMerchantExpandContractFacetofaceQueryResponse extends AlipayResponse {
private static final long serialVersionUID = 1353372855326891883L;
/**
* 订单创建时间
*/
@ApiField("gmt_create")
private Date gmtCreate;
/**
* 产品签约审核结果,申请单状态为审核失败时失败原因用“;”分割,其他状态产品签约审核结果为空
*/
@ApiField("order_detail")
private String orderDetail;
/**
* 支付宝端商户入驻申请单据号
*/
@ApiField("order_no")
private String orderNo;
/**
* 支付宝商户入驻申请单状态,申请单状态包括:暂存、审核中、审核成功、审核失败
*/
@ApiField("order_status")
private String orderStatus;
/**
* 由开发者创建的外部入驻申请单据号
*/
@ApiField("out_biz_no")
private String outBizNo;
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtCreate( ) {
return this.gmtCreate;
}
public void setOrderDetail(String orderDetail) {
this.orderDetail = orderDetail;
}
public String getOrderDetail( ) {
return this.orderDetail;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getOrderNo( ) {
return this.orderNo;
}
public void setOrderStatus(String orderStatus) {
this.orderStatus = orderStatus;
}
public String getOrderStatus( ) {
return this.orderStatus;
}
public void setOutBizNo(String outBizNo) {
this.outBizNo = outBizNo;
}
public String getOutBizNo( ) {
return this.outBizNo;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
82f2565e9c600246f5ac82586357bb7b0a8dcfd5 | b719e47082a2ba3258d6e36c632f4e7d6d1444db | /src/main/java/Arrays/Matrix.java | ae88b99a5ee96e8449ec70d9176da4b7c0bf8e48 | [] | no_license | les-web/java_introduction | 572ca0926951c204104e68099274eefd72e5ca0a | ffcf0b28255ea3b6d07990a6c859a7453a85a42d | refs/heads/master | 2022-06-02T18:39:50.019551 | 2020-02-28T15:55:43 | 2020-02-28T15:55:43 | 236,284,170 | 0 | 0 | null | 2022-05-20T21:23:47 | 2020-01-26T08:09:44 | Java | UTF-8 | Java | false | false | 493 | java | package Arrays;
public class Matrix {
public static void main(String[] args) {
char[][] tree = new char[][]{
{' ', '*', ' '},
{' ', '*', ' '},
{'*', '*', '*','*'},
{'*', '*', '*','*'},
};
for (int i = 0; i < tree.length; i++) {
for (int j = 0; j < tree[i].length; j++) {
System.out.print(tree[i][j]);
}
System.out.println();
}
}
}
| [
"leszek-zebrowski@o2.pl"
] | leszek-zebrowski@o2.pl |
96992f67788c2f74213fab056795227b658f8270 | 4611a1dce5df01ad4c3fa78ed93c7be3aa6c5903 | /src/de/hs_karlsruhe/Sheets/FourthExerciseSheetTest.java | 27c619dd175373835fbd29fb6b5f9faa5d47d45e | [
"MIT"
] | permissive | boppbo/pepperoni-pizza | ffbf675fe85582cd474ae46f6566b069aa8c1843 | 43950737a84f15af66757db8aaa4a2a734bd2b11 | refs/heads/master | 2021-01-10T14:17:41.663402 | 2016-01-15T21:04:31 | 2016-01-15T21:20:03 | 49,744,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 807 | java | package de.hs_karlsruhe.Sheets;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* Tests for the fourth exercise sheet.
* Created by boris on 07.12.2015.
*/
public class FourthExerciseSheetTest {
private FourthExerciseSheet.Quersumme instance = new FourthExerciseSheet.Quersumme();
@Test
public void testZero() {
assertEquals(this.instance.calc(0), 0);
}
@Test
public void testOnehundret() {
assertEquals(this.instance.calc(100), 1);
}
@Test
public void test333() {
assertEquals(this.instance.calc(333), 9);
}
@Test
public void testSeven() {
assertEquals(this.instance.calc(7), 7);
}
@Test
public void testFoo() {
assertEquals(this.instance.calc(96837651), 45);
}
} | [
"boris.bopp@gmail.com"
] | boris.bopp@gmail.com |
386633dcfa77eb5cad6304cbd7d13cdb6ee0f99f | 4ab0293618a9543eee50a283508ad8709e0b6844 | /src/main/java/com/shf/springboot/task/decorator/AsyncTaskDecorator.java | 96d0075a4a6b3c0abfabe4305bd150ab6f56e83c | [] | no_license | SoulSong/springboot-features-sample | 017eca3565dcac2a156bec2ae0fd7b721a9e99a7 | 4b93acca6ee122998e3107ddbd61185d31b8d7dc | refs/heads/master | 2023-06-21T18:36:58.286275 | 2022-03-16T14:51:37 | 2022-03-16T14:51:37 | 192,562,009 | 0 | 0 | null | 2023-06-14T22:25:34 | 2019-06-18T14:58:13 | Java | UTF-8 | Java | false | false | 1,312 | java | package com.shf.springboot.task.decorator;
import org.springframework.core.task.TaskDecorator;
import java.util.Collection;
import java.util.Iterator;
/**
* Description:
* Define a task_decorator_chain for combine all customized task decorator.
*
* @author: songhaifeng
* @date: 2019/10/8 13:36
*/
public class AsyncTaskDecorator implements TaskDecorator {
private final Collection<ThreadTaskDecorator> decorators;
public AsyncTaskDecorator(Collection<ThreadTaskDecorator> decorators) {
this.decorators = decorators;
}
@Override
public Runnable decorate(Runnable runnable) {
return new AsyncTaskDecoratorChain(decorators.iterator(), runnable).decoratorRunnable();
}
private final class AsyncTaskDecoratorChain {
private final Iterator<ThreadTaskDecorator> decorators;
private final Runnable runnable;
AsyncTaskDecoratorChain(Iterator<ThreadTaskDecorator> decorators, Runnable runnable) {
this.decorators = decorators;
this.runnable = runnable;
}
Runnable decoratorRunnable() {
Runnable delegate = runnable;
while (decorators.hasNext()) {
delegate = decorators.next().decorator(delegate);
}
return delegate;
}
}
}
| [
"songhaifeng@patsnap.com"
] | songhaifeng@patsnap.com |
d11cfba91a91afe06d9b787155166cf4899d314b | a565137c1de4669226ad057cd336618fdf2481d4 | /src/test/java/com/moon/core/util/CPUUtilTestTest.java | 75b99dce4f94e1720e93f6d5903baf60daa1957e | [
"MIT"
] | permissive | moon-util/moon-util | ec58aefa46c526ae11b1a55a946c1763ecb9c693 | 28c5cb418861da4d0a5a035a3de919b86b939c0e | refs/heads/master | 2022-12-25T23:01:28.564115 | 2020-12-17T15:55:52 | 2020-12-17T15:55:52 | 184,226,062 | 8 | 1 | MIT | 2022-12-16T15:29:24 | 2019-04-30T08:46:31 | Java | UTF-8 | Java | false | false | 349 | java | package com.moon.core.util;
import org.junit.jupiter.api.Test;
/**
* @author moonsky
*/
class CPUUtilTestTest {
@Test
void testCountOfProcessors() {
}
static int total = 1542;
static int[] nums = {51, 53, 54, 54, 60, 63, 64, 70, 78, 78, 84, 86, 86, 87, 88, 95, 96, 97, 99, 99,};
@Test
void testCompute() {
}
} | [
"xua744531854@163.com"
] | xua744531854@163.com |
85da56bf899dc17b53e352cbd58fd1369d837459 | bb7b1aba05970d403c26cefb58541cdac9689b03 | /src/com/szczerbicki/MainActivity.java | faa1b02e3cb394184eb1540a3493af1c89cc1070 | [] | no_license | pawelszczerbicki/electionRandomizer | 84c54e8a31036560d589494cb3bf4bb41a724950 | a44056c8e064f0c04a22c5c63b67850c613cc6e1 | refs/heads/master | 2020-05-18T11:34:49.091613 | 2015-04-27T22:11:53 | 2015-04-27T22:11:53 | 34,691,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 535 | java | package com.szczerbicki;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends SensorDetector {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
protected void shakeDetected() {
runPresidentActivity(null);
}
public void runPresidentActivity(View v) {
startActivity(new Intent(this, PresidentActivity.class));
}
}
| [
"szczerbicki.pawel@gmail.com"
] | szczerbicki.pawel@gmail.com |
04eedcc039579213113396a2e84a5a7af47f8820 | bc6690169b7b8b42335b30b281736e40223eff79 | /Hardened Things Mod/items/otherStuff/itemCompressedAir.java | a1552bc49fad6520e5c60e002b7c5ae74b133c70 | [] | no_license | SHoCKYCAKE/Hardened-Things-Mod | ce4d79803fff0eaeffac0fce73b2329e7fd22db1 | f73eac78a9914b5e2d44caba17d1d2cbf3f636f6 | refs/heads/master | 2020-06-03T13:40:47.586030 | 2014-01-02T13:43:49 | 2014-01-02T13:43:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package EasyCompressorMod.items.otherStuff;
import EasyCompressorMod.items.itemInfo;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class itemCompressedAir extends Item{
public itemCompressedAir(int id) {
super(id);
setCreativeTab(CreativeTabs.tabMaterials);
setMaxStackSize(64);
setUnlocalizedName(itemInfo.compressedAir_UNLOCALIZED_NAME);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister register) {
itemIcon = register.registerIcon(itemInfo.TEXTURE_LOC + ":" + itemInfo.compressedAir_ICON);
}
} | [
"bratenbengle.yannic@t-online.de"
] | bratenbengle.yannic@t-online.de |
70e508a5fab985f8b69323f49e51693aacbe815c | acd2200e6d395a5265d42e3dd38c5c27d5732c3d | /implement-LinkedList/src/MyLinkedList.java | 63fcc70d15e9974a3bb49af4cf00cac24cb76aeb | [] | no_license | duc-nguyen-cg/List-prc-java | 59d5115091fa37d8753ddf655e748543d153ee87 | 980539fdbca647799d4782bf765de1a8b96a7029 | refs/heads/master | 2023-04-03T11:08:29.124495 | 2021-04-19T10:10:30 | 2021-04-19T10:10:30 | 357,826,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,119 | java | public class MyLinkedList<E> {
public Node head;
private int numNodes;
private class Node {
public Node next;
private E data;
public Node(E data){
this.data = data;
}
// private Node(E data, Node next){
// this.data = data;
// this.next = next;
// }
public E getData(){
return this.data;
}
}
public MyLinkedList(){
}
public MyLinkedList(E o){
head = new Node(o);
}
//passed
public E get(int index){
Node temp = head;
for (int i = 0; i < index; i++){
temp = temp.next;
}
return temp.getData();
}
//passed
public E getFirst(){
return head.getData();
}
//passed
public E getLast(){
Node temp = head;
while (temp.next != null){
temp = temp.next;
}
return temp.getData();
}
//passed
public void add(int index, E element){
Node temp = head;
Node holder;
for (int i = 0; i < index-1 && temp.next != null; i++){
temp = temp.next;
}
holder = temp.next;
temp.next = new Node(element);
temp.next.next = holder;
numNodes++;
}
//passed
public void addFirst(E e){
Node temp = head;
head = new Node(e);
head.next = temp;
numNodes++;
}
//passed
public void addLast(E e){
Node temp = head;
if (temp == null){
head = new Node(e);
} else {
while (temp.next != null){
temp = temp.next;
}
temp.next = new Node(e);
temp.next.next = null;
}
numNodes++;
}
//passed
public E remove(int index){
E result = null;
if (index > 0){
Node temp = head;
for (int i = 0; i < index - 1 && temp.next != null; i++){
temp = temp.next;
}
result = temp.next.getData();
if (temp.next.next != null){
Node holder = temp.next.next;
temp.next = holder; //delete middle
} else {
temp.next = null; //if delete tail
}
} else {
result = head.getData();
head = head.next; //if delete head
}
numNodes--;
return result;
}
//passed, but delete only once
public boolean remove(Object e){
Node temp = head;
for (int i = 0; i < numNodes; i++){
if (temp.getData().equals((E) e)){
remove(i);
return true;
}
temp = temp.next;
}
return false;
}
//passed
public int size(){
return numNodes;
}
//passed
public void clear(){
numNodes = 0;
head = null;
}
//passed
public int indexOf(E o){
Node temp = head;
for (int i = 0; i < numNodes && temp.next != null; i++){
if (temp.getData().equals(o)){
return i;
}
temp = temp.next;
}
return -1;
}
//passed
public boolean contains(E o){
if (head != null){
Node temp = head;
while (temp.next != null){
if (temp.getData().equals(o)){
return true;
}
temp = temp.next;
}
}
return false;
}
// @Override
// public MyLinkedList<E> clone(){
// MyLinkedList<E> newList = new MyLinkedList<>();
// newList.head = new Node(head.getData(), head.next);
// newList.head.next = head.next;
// newList.numNodes = numNodes;
// return newList;
// }
//passed
public void printList(){
Node temp = head;
System.out.print("[\t");
for (int i = 0; i < numNodes; i++){
System.out.print(temp.getData()+"\t");
temp = temp.next;
}
System.out.println("]");
}
}
| [
"ngocduc.2109@gmail.com"
] | ngocduc.2109@gmail.com |
852a4d4fbea6ac94ad8f095a3e3d74a0beeaeb41 | dafc4237b31ed94948c4e8be23ec29ddd7ec1be0 | /app/src/main/java/theagency/vn/support/MyArrayAdapter.java | ebc0e20daf3c1c604fe89bdac8efe516328f4637 | [] | no_license | ben9505/Burgerstein | 26f89b071bb42e3c34d22202cd45c68c189eb976 | 52157211b25b86d49e1c24bb650222d703ff19be | refs/heads/master | 2021-04-29T14:39:33.354279 | 2018-02-16T17:24:03 | 2018-02-16T17:24:03 | 121,778,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,233 | java | package theagency.vn.support;
import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.ArrayList;
import theagency.vn.burgerstein.R;
/**
* Created by Administrator PC on 3/16/2015.
*/
public class MyArrayAdapter extends BaseAdapter {
Context mContext;
private LayoutInflater mLayoutInflater = null;
ArrayList<Products> mArrayProducts;
String[] arrayTitle;
Helper mHelper;
public MyArrayAdapter(Context mContext, ArrayList<Products> mArrayProducts, String[] pArrayTitle) {
this.mContext = mContext;
mLayoutInflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.mArrayProducts = mArrayProducts;
arrayTitle = pArrayTitle;
mHelper = Helper.shareIns(mContext);
}
@Override
public int getCount() {
return mArrayProducts.size();
}
@Override
public Object getItem(int position) {
return mArrayProducts.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
ViewHolder viewHolder;
if (convertView == null) {
v = mLayoutInflater.inflate(R.layout.item_listview_detail, null);
viewHolder = new ViewHolder(v);
v.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) v.getTag();
}
String langID = mContext.getResources().getString(R.string.langID);
int index = Integer.parseInt(mArrayProducts.get(position).getmSymptomID());
int indexNahrstoff = Integer.parseInt(mArrayProducts.get(position).getmNahrstoffID());
viewHolder.mInfo01.setText(arrayTitle[index - 1]);
viewHolder.mInfo02.setText(mArrayProducts.get(position).getmWirkung());
viewHolder.mInfo03.setText(Html.fromHtml(mArrayProducts.get(position).getmDosierung()));
if (index==25) {
if (indexNahrstoff==33) {
if (langID.equalsIgnoreCase("de")) {
viewHolder.mInfo03.setText(Html.fromHtml("Aminosäuren mit Vitaminen, Mineralstoffen, Spurenelementen (morgens)<br /><br />Evtl. vegetabiles Protein mit ausgewogenem Aminogramm."));
}
}
}
if (langID.equalsIgnoreCase("fr")) {
if (indexNahrstoff==1) {
if (position==1){
viewHolder.mInfo03.setText(Html.fromHtml("Le matin:<br/><b>2,5 g</b> Glutamine,<br/><b>2 g</b> Arginine,<br/><b>700 mg</b> Lysine,<br/><b>1 g</b> Glycine,<br/><b>1 g</b> Taurine"));
}
}
if (indexNahrstoff==2) {
if (position==0) {
viewHolder.mInfo02.setText(Html.fromHtml("Calcium: stabilise les mastocytes<br />Carence en manganèse: accroît la tendance aux allergies<br />Zinc: inhibe la libération d’histamine"));
}
}
if (indexNahrstoff==9){
String text = mArrayProducts.get(position).getmWirkung();
viewHolder.mInfo02.setText(replaceText(text));
}
if (index==25) {
if (indexNahrstoff==33) {
viewHolder.mInfo03.setText(Html.fromHtml("Acides amin?s avec des vitamines, mineraux et oligo-?l?ments (le matin)<br /><br />?vent. v?g?tale avec<br />aminogramm ?quilibr?."));
}
}
if (mArrayProducts.get(position).getmWirkung().equalsIgnoreCase("27")){
viewHolder.mInfo02.setText(Html.fromHtml("Nécessaire au métabolisme " +
"normal de l'homocystéine; des " +
"taux élevés d'homocystéine " +
"peuvent entraîner un risque " +
"accru de fractures osseuses"));
viewHolder.mInfo03.setText(Html.fromHtml("<b>0,4-0,8 mg</b> (répartir<br />matin/soir)"));
}
if (viewHolder.mInfo01.getText().toString().equalsIgnoreCase("Burnout")) {
String a = viewHolder.mInfo02.getText().toString().replaceAll("\n"," ");
viewHolder.mInfo02.setText(a);
}
if (indexNahrstoff==23){
if (position==5) {
String text = "<b>300-600 mg</b> magnésium élémentaire (répartir matin/soir)<br />" +
"Également sous forme de " +
"sels mineraux alcalins avec " +
"calcium et zinc.";
viewHolder.mInfo03.setText(Html.fromHtml(text));
}
}
if (indexNahrstoff==24){
if (position==0) {
String text = "<b>800-1’600 mg</b> (correspond à<br />50-100 mg de magnésium élémentaire), le soir<br/>1 h avant le coucher";
viewHolder.mInfo03.setText(Html.fromHtml(text));
}
}
if (indexNahrstoff==26) {
String a = "Recommandation:<br /><b>600 µg</b> d’acide folique,<br /><b>20-30 mg</b> de fer,<br /><b>10 mg</b> de zinc,<br /><b>150 µg</b> de iode, vitamines, oligo-éléments, minéraux, etc.). Il est recommandé de prendre le produit avant même la conception.";
viewHolder.mInfo03.setText(Html.fromHtml(a));
}
if (indexNahrstoff==30) {
String text = mArrayProducts.get(position).getmDosierung();
text = text.replaceAll("<br/>"," ");
text = text.replaceAll("<br />"," ");
viewHolder.mInfo03.setText(Html.fromHtml(text));
}
if (indexNahrstoff==33) {
String text = "Acides aminés avec des vitamines, mineraux et oligo-éléments (le matin)<br /><br />Évent. végétale avec<br />aminogramm équilibré.";
viewHolder.mInfo03.setText(Html.fromHtml(text));
}
if (indexNahrstoff==41) {
if (position==2) {
String text = " Co-facteur nécessaire à la" +
" formation endogène de" +
" l'hormone du sommeil" +
" mélatonine";
viewHolder.mInfo02.setText(Html.fromHtml(text));
}
}
if (indexNahrstoff==45) {
if (position==3) {
String text = "<b>1ère semaine: 3x 400 UI</b>, aux repas (répartir matin/ midi/ soir<br /><br /><b>2ème semaine: 2x 400 UI</b>, aux repas (répartir matin/ soir)<br /><br /><b>Dose chronique/d’entretien:</b><br /><b>400 UI</b> (le matin)<br /><br />Prendre chaque fois avec 0,5 g de vitamine C.";
viewHolder.mInfo03.setText(Html.fromHtml(text));
}
}
}else {
if (indexNahrstoff==1) {
if ( position==0) {
viewHolder.mInfo01.setText(Html.fromHtml("Gedächtnisprobleme / Konzentrationsstö- rungen / Lernen"));
}
if ( position==1 ){
viewHolder.mInfo03.setText(Html.fromHtml("Morgens:<br/><b>2,5 g</b> Glutamin,<br /><b>2 g</b> Arginin,<br/><b>700 mg</b> Lysin,<br /><b>1 g</b> Glycin,<br/><b>1 g</b> Taurin"));
}
}
if (indexNahrstoff==2) {
if (position==0) {
if (langID.equalsIgnoreCase("de")) {
if (mHelper.getDpWidth()>500) {
viewHolder.mInfo02.setText(Html.fromHtml("Kalzium: stabilisiert die Mastzellen<br />Manganmangel: erhöht die Allergieneigung<br />Zink: hemmt Histaminfreisetzung"));
}
}
}
viewHolder.mInfo03.setText(Html.fromHtml("<b>800 mg</b> Calcium,<br />" +
"<b>300 mg</b> Magnesium,<br />" +
"<b>10 mg</b> Zink,<br />"+
"<b>2 mg</b> Mangan<br />" +
"Pulver: nüchtern vor dem " +
"Morgenessen / Tabletten:<br />" +
"magensaftresistent"));
}
if (indexNahrstoff==3) {
String text = mArrayProducts.get(position).getmDosierung();
text = text.replaceAll("<br/>"," ");
text = text.replaceAll("<br />"," ");
viewHolder.mInfo03.setText(Html.fromHtml(text));
}
if ( indexNahrstoff==4 ) {
String text = mArrayProducts.get(position).getmDosierung();
text = text.replaceAll("<br/>"," ");
text = text.replaceAll("<br />"," ");
viewHolder.mInfo03.setText(Html.fromHtml(text));
}
if ( indexNahrstoff==9 ) {
viewHolder.mInfo03.setText(Html.fromHtml("<b>14-60 mg</b> (initial bei nachgewiesenem Mangel auch höher dosiert möglich, nach Laborwerten), (aufgeteilt morgens/abends)"));
}
if ( indexNahrstoff==10 ) {
if (position==1) {
viewHolder.mInfo02.setText(Html.fromHtml(viewHolder.mInfo02.getText().toString()));
}
}
if (indexNahrstoff==13) {
String text = mArrayProducts.get(position).getmDosierung();
text = text.replaceAll("<br/>"," ");
text = text.replaceAll("<br />"," ");
viewHolder.mInfo03.setText(Html.fromHtml(text));
}
if (indexNahrstoff==18) {
viewHolder.mInfo03.setText(Html.fromHtml("Prävention: <b>1-1,5 g</b> (aufgeteilt morgens/ mittags)<br/>Therapie: <b>3 g</b> (aufgeteilt morgens/ mittags/ abends)"));
}
if ( indexNahrstoff==23 ) {
String text = mArrayProducts.get(position).getmDosierung();
text = text.replaceAll("<br/>"," ");
text = text.replaceAll("<br />"," ");
viewHolder.mInfo03.setText(Html.fromHtml(text));
if (position==5) {
viewHolder.mInfo03.setText(Html.fromHtml("<b>300-600 mg</b> elementares Magnesium (aufgeteilt morgens/abends)<br/><br/>Auch in Form basischer Mineralsalze, kombiniert mit Kalzium und Zink, möglich."));
}
}
if ( indexNahrstoff==24 ) {
viewHolder.mInfo03.setText(Html.fromHtml("<b>800-1’600 mg</b> (entspricht<br /><b>50-100 mg</b> elementarem Magnesium), abends, 1 h vor dem Zubettgehen"));
}
if (indexNahrstoff==28) {
if (position==4) {
if (mHelper.getDpWidth()>500) {
viewHolder.mInfo02.setText("Mildert PMS-Symptome (Prostaglandinsynthese, PGE1)");
}else{
viewHolder.mInfo02.setText("Mildert PMS-Symptome (Prostaglandinsynthe-\nse, PGE1)");
}
}
}
if (indexNahrstoff==29) {
String text = mArrayProducts.get(position).getmDosierung();
text = text.replaceAll("<br/>"," ");
text = text.replaceAll("<br />"," ");
viewHolder.mInfo03.setText(Html.fromHtml(text));
}
if (indexNahrstoff==30) {
if (position==1) {
viewHolder.mInfo01.setText(Html.fromHtml("Gedächtnisprobleme / Konzentrationsstö- rungen / Lernen"));
}
}
if (indexNahrstoff==31) {
if (position==0) {
viewHolder.mInfo01.setText(Html.fromHtml("Gedächtnisprobleme / Konzentrationsstö- rungen / Lernen"));
}
}
if (indexNahrstoff==32) {
if (position==1) {
viewHolder.mInfo01.setText(Html.fromHtml("Gedächtnisprobleme / Konzentrationsstö- rungen / Lernen"));
}
}
if (indexNahrstoff==32) {
String text = mArrayProducts.get(position).getmDosierung();
text = text.replaceAll("<br/>"," ");
text = text.replaceAll("<br />"," ");
viewHolder.mInfo03.setText(Html.fromHtml(text));
}
if (indexNahrstoff==37) {
String text = mArrayProducts.get(position).getmDosierung();
text = text.replaceAll("<br/>"," ");
text = text.replaceAll("<br />"," ");
viewHolder.mInfo03.setText(Html.fromHtml(text));
}
if (indexNahrstoff==41) {
String text = mArrayProducts.get(position).getmDosierung();
text = text.replaceAll("<br/>"," ");
text = text.replaceAll("<br />"," ");
viewHolder.mInfo03.setText(Html.fromHtml(text));
}
if (indexNahrstoff==45) {
if (position==3) {
viewHolder.mInfo03.setText(Html.fromHtml("<b>1. Woche: 3x 400 I.E.</b>, zu den Mahlzeiten (aufgeteilt morgens/mittags/abends)<br/><br/><b>2. Woche: 2x 400 I.E.</b>, zu den Mahlzeiten (aufgeteilt morgens/mittags/abends)<br/><br/><b>Chronische Erhaltungsdosis:</b><b>400 I.E.</b> (morgens)<br/><br/>Zusammen mit<br />2x 0,5 g Vitamin C einnehmen."));
}
}
if (indexNahrstoff==47) {
String text = mArrayProducts.get(position).getmDosierung();
text = text.replaceAll("<br/>"," ");
text = text.replaceAll("<br />"," ");
viewHolder.mInfo03.setText(Html.fromHtml(text));
if (position==1) {
viewHolder.mInfo03.setText(Html.fromHtml("Prävention: <b>10-30 mg</b> (aufgeteilt morgens/abends)<br />Akuter Infekt:<br /><b>60-90 mg</b> (aufgeteilt morgens/ mittags/ abends)"));
}
}
}
return v;
}
public String replaceText(String text){
String txtWirkung = text.replaceAll("\n"," ");
return txtWirkung;
}
class ViewHolder {
public TextView mInfo01,mInfo02,mInfo03;
public ViewHolder(View base) {
mInfo01 = (TextView) base.findViewById(R.id.textViewInfo01);
mInfo02 = (TextView) base.findViewById(R.id.textViewInfo02);
mInfo03 = (TextView) base.findViewById(R.id.textViewInfo03);
mInfo01.setTypeface(mHelper.FONT_REGULAR);
mInfo02.setTypeface(mHelper.FONT_REGULAR);
mInfo03.setTypeface(mHelper.FONT_REGULAR);
}
}
}
| [
"hiendeveloper505@gmail.com"
] | hiendeveloper505@gmail.com |
e494f331758045224e8f8a10f24501aeed293db0 | 17df5ef85db64b306be23455d404e3d6eb934deb | /src/main/java/kohgylw/kiftd/server/filter/IPFilter.java | eae7239648e388d256a15b04be0dccac2c8b30f3 | [] | no_license | GeorgeGuoo/kiftd-source | 60185246cb8f11c8b2f32008aa825225319e180b | d10e60479bfe46892be326bce41053911b9cce56 | refs/heads/master | 2020-08-02T21:06:59.243198 | 2019-09-28T09:26:05 | 2019-09-28T09:26:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,825 | java | package kohgylw.kiftd.server.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.context.ApplicationContext;
import org.springframework.core.annotation.Order;
import org.springframework.web.context.support.WebApplicationContextUtils;
import kohgylw.kiftd.server.util.ConfigureReader;
import kohgylw.kiftd.server.util.IpAddrGetter;
/**
*
* <h2>阻止特定IP访问过滤器</h2>
* <p>该过滤器用于阻止特定IP进行访问,从而保护用户资源。</p>
* @author 青阳龙野(kohgylw)
* @version 1.0
*/
@WebFilter
@Order(1)
public class IPFilter implements Filter {
private IpAddrGetter idg;
private boolean enable;
@Override
public void init(FilterConfig filterConfig) throws ServletException {
ApplicationContext context = WebApplicationContextUtils
.getWebApplicationContext(filterConfig.getServletContext());
idg = context.getBean(IpAddrGetter.class);
enable = ConfigureReader.instance().hasBannedIP();
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
if(enable) {
HttpServletRequest hsr = (HttpServletRequest) request;
if(ConfigureReader.instance().isBannedIP(idg.getIpAddr(hsr))) {
((HttpServletResponse)response).sendError(HttpServletResponse.SC_FORBIDDEN);
}else {
chain.doFilter(request, response);
}
}else {
chain.doFilter(request, response);
}
}
@Override
public void destroy() {
}
}
| [
"kohgylw@163.com"
] | kohgylw@163.com |
6e39822fa2b2b2a37139a1e59a24b5f8dd640529 | c1e5290ba0194c0d4b769ada3f2b05e1616aa2fc | /src/test/java/com/example/ExampleTest.java | d15feb1d8bbd807b5fafe4647ec50789164dac33 | [] | no_license | hamuhamu/spring_boot_example | 3e134fd10867acbac0dda8f354620d67b4f911e6 | ad5672b65932449127b8fc55f47511f17701bf5f | refs/heads/master | 2021-01-12T13:38:06.161202 | 2016-11-30T01:40:46 | 2016-11-30T01:40:46 | 69,967,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 483 | java | package com.example;
import static org.junit.Assert.assertSame;
import org.junit.Test;
public class ExampleTest {
@Test
public void サンプルテスト() {
Example example = new Example();
int expected = 3;
int actual = example.add(1, 2);
assertSame(expected, actual);
}
@Test(expected = IllegalArgumentException.class)
public void 引数を負数とした場合に例外が投げられること() {
Example example = new Example();
example.add(-1, 2);
}
}
| [
"yuki-ohashi@M0060-2.local"
] | yuki-ohashi@M0060-2.local |
348916bd472294a33b0d219a3e8f0dd4ff70ea90 | 13b181fbcd4486633f221f02efba0cb24ad44066 | /src/main/java/com/digikent/denetimyonetimi/dto/paydas/DenetimPaydasRequestDTO.java | 19d64be7b78be19c5e3eb57b2a8df74dff16e938 | [] | no_license | murat1309/VadiRestMobile | 612ce49e4d6902631658adf81546b266fe51a199 | b2a3bb13b3598b8d0bd5f7f2e54b2091dce3cf75 | refs/heads/master | 2020-04-07T23:13:09.154801 | 2018-10-01T06:49:59 | 2018-10-01T06:49:59 | 158,803,179 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 358 | java | package com.digikent.denetimyonetimi.dto.paydas;
import java.io.Serializable;
/**
* Created by Kadir on 25.01.2018.
*/
public class DenetimPaydasRequestDTO implements Serializable {
private String filter;
public String getFilter() {
return filter;
}
public void setFilter(String filter) {
this.filter = filter;
}
}
| [
"kadir.yaka@vadi.com.tr"
] | kadir.yaka@vadi.com.tr |
cc8b3586e3b5758307e87ab739aec4278e20391f | 4141ce5f26b426087d9d5fc6914254a3505d4706 | /src/test/java/org/springframework/data/gemfire/config/xml/GatewayReceiverAutoStartNamespaceTest.java | 1be08711c7301f0078631b4d4142f24d4f179f0a | [
"LicenseRef-scancode-generic-cla"
] | no_license | saleti7/spring-data-gemfire | 8fc73fed790307799ae4fdc6a71e6daad05d3674 | a5b182471ab6e8d15fc2b9caa490cb78aaafa2c9 | refs/heads/master | 2021-03-27T09:47:38.062169 | 2017-12-17T02:23:29 | 2017-12-18T01:22:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,354 | java | /*
* Copyright 2010-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.gemfire.config.xml;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import javax.annotation.Resource;
import org.apache.geode.cache.wan.GatewayReceiver;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer;
import org.springframework.data.gemfire.wan.GatewayReceiverFactoryBean;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.StringUtils;
/**
* The GatewayReceiverAutoStartNamespaceTest class is a test suite of test cases testing the contract
* and functionality of Gateway Receiver configuration in Spring Data GemFire using the XML namespace (XSD).
* This test class tests the auto start configuration of the GatewayReceiver Gemfire Component in SDG.
*
* @author John Blum
* @see org.junit.Test
* @see org.junit.runner.RunWith
* @see org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer
* @see org.springframework.data.gemfire.wan.GatewayReceiverFactoryBean
* @see org.springframework.test.context.ActiveProfiles
* @see org.springframework.test.context.ContextConfiguration
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
* @see org.apache.geode.cache.wan.GatewayReceiver
* @since 1.5.0
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(value = "GatewayReceiverNamespaceTest-context.xml",
initializers = GemfireTestApplicationContextInitializer.class)
@ActiveProfiles("autoStart")
@SuppressWarnings("unused")
public class GatewayReceiverAutoStartNamespaceTest {
@Resource(name = "&Auto")
private GatewayReceiverFactoryBean autoGatewayReceiverFactory;
@Test
public void testAuto() throws Exception {
assertNotNull("The 'Auto' GatewayReceiverFactoryBean was not properly configured and initialized!",
autoGatewayReceiverFactory);
GatewayReceiver autoGatewayReceiver = autoGatewayReceiverFactory.getObject();
try {
assertNotNull(autoGatewayReceiver);
assertTrue(StringUtils.isEmpty(autoGatewayReceiver.getBindAddress()));
assertEquals("neo", autoGatewayReceiver.getHost());
assertEquals(15500, autoGatewayReceiver.getStartPort());
assertEquals(25500, autoGatewayReceiver.getEndPort());
assertEquals(10000, autoGatewayReceiver.getMaximumTimeBetweenPings());
assertTrue(autoGatewayReceiver.isRunning());
assertEquals(16384, autoGatewayReceiver.getSocketBufferSize());
}
finally {
autoGatewayReceiver.stop();
}
}
}
| [
"jblum@pivotal.io"
] | jblum@pivotal.io |
439405a2475a4cbd097523258210cfe70c1438ae | bbe10639bb9c8f32422122c993530959534560e1 | /delivery/app-release_source_from_JADX/com/google/android/gms/internal/zzqf.java | 33aafd42600b1035d5a8b68bb438bbe2a0327188 | [
"Apache-2.0"
] | permissive | ANDROFAST/delivery_articulos | dae74482e41b459963186b6e7e3d6553999c5706 | ddcc8b06d7ea2895ccda2e13c179c658703fec96 | refs/heads/master | 2020-04-07T15:13:18.470392 | 2018-11-21T02:15:19 | 2018-11-21T02:15:19 | 158,476,390 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,905 | java | package com.google.android.gms.internal;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
public interface zzqf extends IInterface {
public static abstract class zza extends Binder implements zzqf {
private static class zza implements zzqf {
private IBinder zzoo;
zza(IBinder iBinder) {
this.zzoo = iBinder;
}
public IBinder asBinder() {
return this.zzoo;
}
public void zzh(int i, Bundle bundle) throws RemoteException {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.identity.intents.internal.IAddressCallbacks");
obtain.writeInt(i);
if (bundle != null) {
obtain.writeInt(1);
bundle.writeToParcel(obtain, 0);
} else {
obtain.writeInt(0);
}
this.zzoo.transact(2, obtain, obtain2, 0);
obtain2.readException();
} finally {
obtain2.recycle();
obtain.recycle();
}
}
}
public zza() {
attachInterface(this, "com.google.android.gms.identity.intents.internal.IAddressCallbacks");
}
public static zzqf zzcb(IBinder iBinder) {
if (iBinder == null) {
return null;
}
IInterface queryLocalInterface = iBinder.queryLocalInterface("com.google.android.gms.identity.intents.internal.IAddressCallbacks");
return (queryLocalInterface == null || !(queryLocalInterface instanceof zzqf)) ? new zza(iBinder) : (zzqf) queryLocalInterface;
}
public IBinder asBinder() {
return this;
}
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
switch (code) {
case 2:
data.enforceInterface("com.google.android.gms.identity.intents.internal.IAddressCallbacks");
zzh(data.readInt(), data.readInt() != 0 ? (Bundle) Bundle.CREATOR.createFromParcel(data) : null);
reply.writeNoException();
return true;
case 1598968902:
reply.writeString("com.google.android.gms.identity.intents.internal.IAddressCallbacks");
return true;
default:
return super.onTransact(code, data, reply, flags);
}
}
}
void zzh(int i, Bundle bundle) throws RemoteException;
}
| [
"cespedessanchezalex@gmail.com"
] | cespedessanchezalex@gmail.com |
dbd45634d0aad02652ace1ed9b439a9489c7cd39 | 7330e9b8e7994ad2f05c8570e57230ea7ab9c810 | /src/main/java/io/github/mainstringargs/alphavantagescraper/input/technicalindicators/SlowKPeriod.java | fd28d49f01962903d2b9a70c1d48b01266669813 | [
"Apache-2.0"
] | permissive | slipperyBU/alpha-vantage-scraper | 97654f590d106e0b4aa84ba8c925d2f57f85423e | f123cf7bc5d08bdce73bfaf5aebb873225f7d4d9 | refs/heads/master | 2023-06-02T19:45:32.981632 | 2021-06-14T22:03:59 | 2021-06-14T22:03:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 609 | java | package io.github.mainstringargs.alphavantagescraper.input.technicalindicators;
import io.github.mainstringargs.alphavantagescraper.input.ApiParameter;
public class SlowKPeriod implements ApiParameter {
private final String period;
private SlowKPeriod(String period) {
this.period = period;
}
public static SlowKPeriod of(int time) {
assert time > 0;
return new SlowKPeriod(String.format("%d", time));
}
@Override
public String getKey() {
return "slowkperiod";
}
@Override
public String getValue() {
return period;
}
}
| [
"mainstringargs@users.noreply.github.com"
] | mainstringargs@users.noreply.github.com |
e20717e371fdb33127b0f18a124aa9e962dd48e6 | b0a731bb7fec0e3ee41f1b716955ecdcb2b6ef5c | /Milkomeda/src/main/java/com/github/yizzuide/milkomeda/halo/HaloListener.java | eea066143c8194868033d1e6a4ea50029416bb5f | [
"MIT"
] | permissive | newschen/Milkomeda | d539480d98cb1734f904dc7e3e4ab81542626849 | 90b700585c1958902ccaafee539a6cefb3e5e07a | refs/heads/master | 2023-01-02T11:10:18.160458 | 2020-10-22T03:03:22 | 2020-10-22T03:10:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,106 | java | package com.github.yizzuide.milkomeda.halo;
import org.springframework.core.annotation.AliasFor;
import java.lang.annotation.*;
/**
* HaloListener
* 持久化事件监听器
* <pre>
* 注入参数如下:
* - Object param
* 该参数类型根据Mapper方法的参数决定,如果是一个参数,则为实体或简单数据类型;如果是多个参数,则为Map。
* - Object result
* Mapper方法返回值。
* - SqlCommandType commandType
* 该SQL的操作类型:INSERT、UPDATE、DELETE、SELECT。
* </pre>
*
* @author yizzuide
* @since 2.5.0
* @version 3.11.4
* Create at 2020/01/30 22:36
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface HaloListener {
/**
* 监听的表名
* @return String
*/
@AliasFor("tableName")
String value() default "*";
/**
* 监听的表名
* @return String
*/
@AliasFor("value")
String tableName() default "*";
/**
* 监听类型
* @return 默认为后置监听
*/
HaloType type() default HaloType.POST;
}
| [
"fu837014586@163.com"
] | fu837014586@163.com |
33c04ee18266c1f84857a5a123812d29b8ab174f | 983bac0598b3e46b5e6c5279d7eb62acd3aefe1d | /src/network/NodeSimulatableEvent.java | 9cb9197fdf28b90c5d553c639e26db962a033292 | [] | no_license | AlexMaskovyak/hardware-varying-network-simulator | 0b3747fe7b6aef4d6de3ab5f75509d6756803116 | 4a2d10717568422770a122c3ca147823274b695f | refs/heads/master | 2020-04-29T08:53:38.306475 | 2010-04-06T22:49:51 | 2010-04-06T22:49:51 | 35,670,423 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,104 | java | package network;
import simulation.ISimulatable;
import simulation.ISimulatableEvent;
import simulation.SimulatableEvent;
public class NodeSimulatableEvent extends SimulatableEvent implements ISimulatableEvent {
protected String _event;
protected IPacket _packet;
/**
* Default constructor.
* @param source ISimulatable which generated this event.
* @param time during which this event occurred.
* @param event description of the event.
*/
public NodeSimulatableEvent(ISimulatable source, double time, String event, IPacket packet) {
super(source, time);
_event = event;
_packet = packet;
}
/**
* Description of this event.
* @return event description.
*/
public String getEvent() {
return _event;
}
/**
* Packet that caused this event.
* @return Packet that was sent or received.
*/
public IPacket getPacket() {
return _packet;
}
/**
* Obtains the Node that caused this event to occur.
* @return Node associated with this event.
*/
public Node getNode() {
return (Node)super.getSource();
}
}
| [
"alexander.maskovyak@gmail.com"
] | alexander.maskovyak@gmail.com |
ec3336e9cdd6eb28b6bfad065b6b3e96b4590cbf | ed2d07bafed459e2578878467961412ee9f66f08 | /api/checkers/checkers-domain/src/main/java/io/github/anthogdn/iataaa/checkersDomain/move/CheckersBoardMove.java | 83e44b81b83ffc731e2a66603749f0c14ec1f05f | [
"Beerware"
] | permissive | AnthoGdn/iataaa | 88f0356aa90fda2c294b0e3925460e5d889a3074 | a22b27353d4d669625ae763ae07aaface2532af3 | refs/heads/master | 2023-01-10T09:12:09.603588 | 2018-10-14T22:00:56 | 2018-10-14T22:00:56 | 122,852,678 | 0 | 0 | NOASSERTION | 2023-01-04T15:13:23 | 2018-02-25T16:17:17 | Java | UTF-8 | Java | false | false | 27,602 | java | package io.github.anthogdn.iataaa.checkersDomain.move;
import io.github.anthogdn.iataaa.checkersDomain.model.Case;
import io.github.anthogdn.iataaa.checkersDomain.model.Move;
import io.github.anthogdn.iataaa.checkersDomain.model.PlayerNb;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import java.util.*;
import java.util.stream.Collectors;
import static io.github.anthogdn.iataaa.checkersDomain.model.CheckersBoard.*;
public class CheckersBoardMove {
private static final int FIRST_POSITION_OF_LAST_LINE = CASE_NB_OF_LINE
* (LINE_NB - 1);
private static final int LAST_POSITION_OF_FIRST_LINE = CASE_NB_OF_LINE - 1;
private static List<Case[]> availableMoves = new ArrayList<>();
private static int moveSize = 1;
private static Set<Move> availableChainMoves = new HashSet<>();
public static List<Case[]> getAvailableMoves(Case[] cases, PlayerNb playerNb) {
computeAvailableMoves(cases, playerNb);
List<Case[]> result = new ArrayList<>(availableMoves);
availableMoves.clear();
availableChainMoves.clear();
moveSize = 1;
return result;
}
public static Set<Move> getAvailableChainMoves(Case[] cases, PlayerNb playerNb) {
computeAvailableMoves(cases, playerNb);
Set<Move> chainMoves = new HashSet<>(availableChainMoves);
availableMoves.clear();
availableChainMoves.clear();
moveSize = 1;
return chainMoves;
}
// PRIVATE
private static void computeAvailableMoves(Case[] cases, PlayerNb playerNb) {
Case[] casesClone = cases.clone();
if (playerNb == PlayerNb.PLAYER_2) {
casesClone = reverseCases(cases);
}
List<Integer> whiteCasesPosition = getWhiteCases(casesClone);
final Case[] finalCases = casesClone;
whiteCasesPosition.forEach(whiteCase -> fillAvailableMoves(finalCases, whiteCase));
availableMoves = transformPieceToQueen(availableMoves);
availableChainMoves = availableChainMoves
.stream()
.map(CheckersBoardMove::transformPieceToQueen)
.collect(Collectors.toSet());
if (playerNb == PlayerNb.PLAYER_2) {
availableMoves = availableMoves
.stream()
.map(CheckersBoardMove::reverseCases)
.collect(Collectors.toList());
availableChainMoves = availableChainMoves
.stream()
.map(move -> new Move(
move.getMove()
.stream()
.map(CheckersBoardMove::reverseCases)
.collect(Collectors.toList())
))
.collect(Collectors.toSet());
}
}
// Return -1 if result don't exist.
private static int getTopLeftCornerPosition(int position) {
int res = -1;
if ( !(position % 10 == 0 || position >= FIRST_POSITION_OF_LAST_LINE) ) {
res = position + (position / 5) % 2 + (PIECE_SIZE / 10) - 1;
}
return res;
}
// Return -1 if result don't exist.
private static int getTopRightCornerPosition(int position) {
int res = -1;
if ( !( (position + 1) % 10 == 0 || position >= FIRST_POSITION_OF_LAST_LINE) ) {
res = position + (position / 5) % 2 + (PIECE_SIZE / 10);
}
return res;
}
// Return -1 if result don't exist.
private static int getBottomLeftCornerPosition(int position) {
int res = -1;
if ( !(position % 10 == 0 || position <= LAST_POSITION_OF_FIRST_LINE) ) {
res = position - (PIECE_SIZE / 10) - (((position / 5) + 1) % 2);
}
return res;
}
// Return -1 if result don't exist.
private static int getBottomRightCornerPosition(int position) {
int res = -1;
if ( !( (position + 1) % 10 == 0 || position <= LAST_POSITION_OF_FIRST_LINE) ) {
res = position - PIECE_SIZE / 10 - ((position / 5 + 1) % 2) + 1;
}
return res;
}
// Return -1 if result don't exist.
public static int getTopLeftCornerPosition(int position, int distance) {
int tmpPosition = position;
do {
tmpPosition = getTopLeftCornerPosition(tmpPosition);
--distance;
} while (tmpPosition != -1 && distance > 0);
return tmpPosition;
}
// Return -1 if result don't exist.
public static int getTopRightCornerPosition(int position, int distance) {
int tmpPosition = position;
do {
tmpPosition = getTopRightCornerPosition(tmpPosition);
--distance;
} while (tmpPosition != -1 && distance > 0);
return tmpPosition;
}
// Return -1 if result don't exist.
public static int getBottomLeftCornerPosition(int position, int distance) {
int tmpPosition = position;
do {
tmpPosition = getBottomLeftCornerPosition(tmpPosition);
--distance;
} while (tmpPosition != -1 && distance > 0);
return tmpPosition;
}
// Return -1 if result don't exist.
public static int getBottomRightCornerPosition(int position, int distance) {
int tmpPosition = position;
do {
tmpPosition = getBottomRightCornerPosition(tmpPosition);
--distance;
} while (tmpPosition != -1 && distance > 0);
return tmpPosition;
}
// Return -1 if result don't exist.
private static List<Integer> getAllTopLeftCornerPositions(int position) {
List<Integer> res = new ArrayList<>();
for (
int tmpPosition = getTopLeftCornerPosition(position);
tmpPosition != -1;
tmpPosition = getTopLeftCornerPosition(tmpPosition)
) {
res.add(tmpPosition);
}
return res;
}
// Return -1 if result don't exist.
static List<Integer> getAllTopRightCornerPositions(int position) {
List<Integer> res = new ArrayList<>();
for (
int tmpPosition = getTopRightCornerPosition(position);
tmpPosition != -1;
tmpPosition = getTopRightCornerPosition(tmpPosition)
) {
res.add(tmpPosition);
}
return res;
}
// Return -1 if result don't exist.
public static List<Integer> getAllBottomLeftCornerPositions(int position) {
List<Integer> res = new ArrayList<>();
for (
int tmpPosition = getBottomLeftCornerPosition(position);
tmpPosition != -1;
tmpPosition = getBottomLeftCornerPosition(tmpPosition)
) {
res.add(tmpPosition);
}
return res;
}
// Return -1 if result don't exist.
public static List<Integer> getAllBottomRightCornerPositions(int position) {
List<Integer> res = new ArrayList<>();
for (
int tmpPosition = getBottomRightCornerPosition(position);
tmpPosition != -1;
tmpPosition = getBottomRightCornerPosition(tmpPosition)
) {
res.add(tmpPosition);
}
return res;
}
// Return -1 if result don't exist.
private static List<Integer> getAllTopLeftCornerPositions(int src, int tgt) {
List<Integer> res = new ArrayList<>();
for (
int tmpPosition = getTopLeftCornerPosition(src);
tmpPosition != -1 && tmpPosition != tgt;
tmpPosition = getTopLeftCornerPosition(tmpPosition)
) {
res.add(tmpPosition);
}
return res;
}
// Return -1 if result don't exist.
private static List<Integer> getAllTopRightCornerPositions(int src, int tgt) {
List<Integer> res = new ArrayList<>();
for (
int tmpPosition = getTopRightCornerPosition(src);
tmpPosition != -1 && tmpPosition != tgt;
tmpPosition = getTopRightCornerPosition(tmpPosition)
) {
res.add(tmpPosition);
}
return res;
}
// Return -1 if result don't exist.
private static List<Integer> getAllBottomLeftCornerPositions(int src, int tgt) {
List<Integer> res = new ArrayList<>();
for (
int tmpPosition = getBottomLeftCornerPosition(src);
tmpPosition != -1 && tmpPosition != tgt;
tmpPosition = getBottomLeftCornerPosition(tmpPosition)
) {
res.add(tmpPosition);
}
return res;
}
// Return -1 if result don't exist.
private static List<Integer> getAllBottomRightCornerPositions(int src, int tgt) {
List<Integer> res = new ArrayList<>();
for (
int tmpPosition = getBottomRightCornerPosition(src);
tmpPosition != -1 && tmpPosition != tgt;
tmpPosition = getBottomRightCornerPosition(tmpPosition)
) {
res.add(tmpPosition);
}
return res;
}
private static Optional<Case[]> getMove(int position, Case[] pieces, int srcPosition) {
Optional<Case[]> move = Optional.empty();
if (position != -1) {
Case boardCase = pieces[position];
if (boardCase == Case.EMPTY) {
move = Optional.of(getMoveWhiteCase(pieces, srcPosition, position));
}
}
return move;
}
private static List<Case[]> getMovesForQueen(List<Integer> positions, Case[] pieces, int srcPosition) {
int k, i;
List<Case[]> moves = new ArrayList<>();
Case[] newCases;
int sizePositions = positions.size();
if (!positions.isEmpty()) {
i = 0;
k = positions.get(i);
while (i < sizePositions && pieces[k] == Case.EMPTY) {
// We add all position until we meet a piece.
newCases = getMoveWhiteCase(pieces, srcPosition, k);
moves.add(newCases);
k = positions.get(i);
++i;
if (i < sizePositions) {
k = positions.get(i);
}
}
}
return moves;
}
// Fill availableMoves of all possible moves
private static void fillAvailableMoves(Case[] pieces, int srcPosition) {
assert pieces[srcPosition] != Case.BLACK_PIECE;
assert pieces[srcPosition] != Case.BLACK_QUEEN;
assert pieces[srcPosition] != Case.EMPTY;
boolean isPossibleToJump = sequenceJump(pieces, srcPosition, 1, new ArrayList<>(), new Move());
if (!isPossibleToJump && moveSize == 1) { // If we can't jump a piece.
// If moveSize is not equal to 1 then it's useless
// to continue because there are more long move in availableMove.
if (pieces[srcPosition] == Case.WHITE_PIECE) {
// If piece is not queen and it can't jump piece.
//------------------------------------------------------------------
Optional<Case[]> cases;
// Left side piece.
int topLeftCornerPosition = getTopLeftCornerPosition(srcPosition);
if (topLeftCornerPosition != -1) {
cases = getMove(topLeftCornerPosition, pieces, srcPosition);
cases.ifPresent(it -> {
availableMoves.add(it);
List<Case[]> moveList = new ArrayList<>();
moveList.add(it);
availableChainMoves.add(new Move(moveList));
});
}
//------------------------------------------------------------------
// Right side piece.
int topRightCornerPosition = getTopRightCornerPosition(srcPosition);
if (topRightCornerPosition != -1) {
cases = getMove(topRightCornerPosition, pieces, srcPosition);
cases.ifPresent(it -> {
availableMoves.add(it);
List<Case[]> moveList = new ArrayList<>();
moveList.add(it);
availableChainMoves.add(new Move(moveList));
});
}
} else {
// Piece is a queen and it can't jump piece.
List<Case[]> moves;
moves = getMovesForQueen(getAllTopLeftCornerPositions(srcPosition), pieces, srcPosition);
availableMoves.addAll(moves);
moves.forEach(move -> availableChainMoves.add(new Move(move)));
moves = getMovesForQueen(getAllTopRightCornerPositions(srcPosition), pieces, srcPosition);
availableMoves.addAll(moves);
moves.forEach(move -> availableChainMoves.add(new Move(move)));
moves = getMovesForQueen(getAllBottomLeftCornerPositions(srcPosition), pieces, srcPosition);
availableMoves.addAll(moves);
moves.forEach(move -> availableChainMoves.add(new Move(move)));
moves = getMovesForQueen(getAllBottomRightCornerPositions(srcPosition), pieces, srcPosition);
availableMoves.addAll(moves);
moves.forEach(move -> availableChainMoves.add(new Move(move)));
}
}
}
private static boolean isNotInInterval(int src, int tgt, Direction direction, List<Integer> prohibited) {
List<Integer> positions;
switch (direction) {
case TOP_LEFT :
positions = getAllTopLeftCornerPositions(src, tgt);
break;
case TOP_RIGHT :
positions = getAllTopRightCornerPositions(src, tgt);
break;
case BOTTOM_LEFT :
positions = getAllBottomLeftCornerPositions(src, tgt);
break;
default :
positions = getAllBottomRightCornerPositions(src, tgt);
break;
}
return prohibited.stream().noneMatch(positions::contains);
}
// Return false if piece can't jump piece. Else true and save more longer moves in availableMoves.
private static boolean sequenceJump(
Case[] pieces,
int srcPosition,
final int size,
List<Integer> jumpedCases,
Move move
) {
assert pieces[srcPosition] != Case.BLACK_PIECE;
assert pieces[srcPosition] != Case.BLACK_QUEEN;
assert pieces[srcPosition] != Case.EMPTY;
boolean isPossibleToJump = false;
if (pieces[srcPosition] == Case.WHITE_PIECE) {
int tgtPosition;
int jumpedPosition;
boolean isAddJumpedMoveToSequence;
// Top left
jumpedPosition = getTopLeftCornerPosition(srcPosition);
tgtPosition = getTopLeftCornerPosition(srcPosition, 2);
isAddJumpedMoveToSequence = addJumpedMoveToSequence(
pieces, srcPosition, jumpedPosition, tgtPosition, size, move
);
isPossibleToJump = isAddJumpedMoveToSequence;
// Top right
jumpedPosition = getTopRightCornerPosition(srcPosition);
tgtPosition = getTopRightCornerPosition(srcPosition, 2);
isAddJumpedMoveToSequence = addJumpedMoveToSequence(
pieces, srcPosition, jumpedPosition, tgtPosition, size, move
);
isPossibleToJump = isPossibleToJump || isAddJumpedMoveToSequence;
// Bottom left
jumpedPosition = getBottomLeftCornerPosition(srcPosition);
tgtPosition = getBottomLeftCornerPosition(srcPosition, 2);
isAddJumpedMoveToSequence = addJumpedMoveToSequence(
pieces, srcPosition, jumpedPosition, tgtPosition, size, move
);
isPossibleToJump = isPossibleToJump || isAddJumpedMoveToSequence;
// Bottom right
jumpedPosition = getBottomRightCornerPosition(srcPosition);
tgtPosition = getBottomRightCornerPosition(srcPosition, 2);
isAddJumpedMoveToSequence = addJumpedMoveToSequence(
pieces, srcPosition, jumpedPosition, tgtPosition, size, move
);
isPossibleToJump = isPossibleToJump || isAddJumpedMoveToSequence;
} else { // If piece is queen
List<Integer> positions;
Case[] newCases;
int jumpedPos;
Pair<List<Integer>, Integer> couple;
// Top left
positions = getAllTopLeftCornerPositions(srcPosition);
couple = getPositionsToJump(pieces, positions);
positions = couple.getLeft();
jumpedPos = couple.getRight();
if (jumpedPos != -1) {
for (int tgtPos : positions) {
if (isNotInInterval(srcPosition, tgtPos, Direction.TOP_LEFT, jumpedCases)) {
isPossibleToJump = true;
newCases = getJumpBlackCase(pieces, srcPosition, jumpedPos, tgtPos);
jumpedCases.add(jumpedPos);
Move clonedChainMove = move.clone();
clonedChainMove.add(newCases);
sequenceJump(newCases, tgtPos, size + 1, jumpedCases, clonedChainMove);
jumpedCases.remove(jumpedCases.indexOf(jumpedPos));
}
}
}
// Top right
positions = getAllTopRightCornerPositions(srcPosition);
couple = getPositionsToJump(pieces, positions);
positions = couple.getLeft();
jumpedPos = couple.getRight();
if (jumpedPos != -1) {
for (int tgtPos : positions) {
if (isNotInInterval(srcPosition, tgtPos, Direction.TOP_RIGHT, jumpedCases)) {
isPossibleToJump = true;
newCases = getJumpBlackCase(pieces, srcPosition, jumpedPos, tgtPos);
jumpedCases.add(jumpedPos);
Move clonedChainMove = move.clone();
clonedChainMove.add(newCases);
sequenceJump(newCases, tgtPos, size + 1, jumpedCases, clonedChainMove);
jumpedCases.remove(jumpedCases.indexOf(jumpedPos));
}
}
}
// Bottom left
positions = getAllBottomLeftCornerPositions(srcPosition);
couple = getPositionsToJump(pieces, positions);
positions = couple.getLeft();
jumpedPos = couple.getRight();
if (jumpedPos != -1) {
for (int tgtPos : positions) {
if (isNotInInterval(srcPosition, tgtPos, Direction.BOTTOM_LEFT, jumpedCases)) {
isPossibleToJump = true;
newCases = getJumpBlackCase(pieces, srcPosition, jumpedPos, tgtPos);
jumpedCases.add(jumpedPos);
Move clonedChainMove = move.clone();
clonedChainMove.add(newCases);
sequenceJump(newCases, tgtPos, size + 1, jumpedCases, clonedChainMove);
jumpedCases.remove(jumpedCases.indexOf(jumpedPos));
}
}
}
// Bottom right
positions = getAllBottomRightCornerPositions(srcPosition);
couple = getPositionsToJump(pieces, positions);
positions = couple.getLeft();
jumpedPos = couple.getRight();
if (jumpedPos != -1) {
for (int tgtPos : positions) {
if (isNotInInterval(srcPosition, tgtPos, Direction.BOTTOM_RIGHT, jumpedCases)) {
isPossibleToJump = true;
newCases = getJumpBlackCase(pieces, srcPosition, jumpedPos, tgtPos);
jumpedCases.add(jumpedPos);
Move clonedChainMove = move.clone();
clonedChainMove.add(newCases);
sequenceJump(newCases, tgtPos, size + 1, jumpedCases, clonedChainMove);
jumpedCases.remove(jumpedCases.indexOf(jumpedPos));
}
}
}
}
if (size != 1 && !isPossibleToJump) {
// If size == 1 so method runs for first time (in recursion) and we return directly isPossibleMove.
// Else it's not first run. We verify availableMoves list. We add more longer move and clear others.
if (size == moveSize) {
availableMoves.add(pieces);
availableChainMoves.add(move);
} else if (size > moveSize) {
moveSize = size;
availableMoves.clear();
availableMoves.add(pieces);
availableChainMoves.clear();
availableChainMoves.add(move);
}
}
return isPossibleToJump;
}
// Positions is diagonal positions list.
// This method return positions list where queen can move after jump piece
// and return jumped piece position.
// If getPositionsToJump(..).getRight == -1 then queen can't jump piece.
private static Pair<List<Integer>, Integer> getPositionsToJump(Case[] pieces, List<Integer> positions) {
List<Integer> positionsToJump = new ArrayList<>();
int jumpedPosition = -1;
if (!positions.isEmpty()) {
int i = 0;
int k = positions.get(i);
while (pieces[k] == Case.EMPTY && i < positions.size()) {
++i;
if (i < positions.size()) {
k = positions.get(i);
}
}
if (i < positions.size() &&
(pieces[k] == Case.BLACK_PIECE
|| pieces[k] == Case.BLACK_QUEEN)) {
jumpedPosition = k;
++i;
if (i < positions.size()) {
k = positions.get(i);
if (pieces[k] != Case.EMPTY) {
jumpedPosition = -1;
}
while (pieces[k] == Case.EMPTY && i < positions.size()) {
positionsToJump.add(k);
++i;
if (i < positions.size()) {
k = positions.get(i);
}
}
}
}
}
return new ImmutablePair<>(positionsToJump, jumpedPosition);
}
private static boolean addJumpedMoveToSequence(
Case[] pieces,
int srcPosition,
int jumpedPosition,
int tgtPosition,
int size,
Move move
) {
boolean isPossibleToJump = false;
if (jumpedPosition != -1 && tgtPosition != -1) {
if (pieces[tgtPosition] == Case.EMPTY
&& (pieces[jumpedPosition] == Case.BLACK_PIECE
|| pieces[jumpedPosition] == Case.BLACK_QUEEN)
) {
// If piece can jump adverse piece in top left corner
isPossibleToJump = true;
Case[] newCases = getJumpBlackCase(pieces, srcPosition, jumpedPosition, tgtPosition);
Move clonedMove = move.clone();
clonedMove.add(newCases);
sequenceJump(newCases, tgtPosition, size + 1, null, clonedMove);
}
}
return isPossibleToJump;
}
// Return case list without black piece in jumpedPosition.
// And white piece in srcPosition move to tgtPosition.
private static Case[] getJumpBlackCase(
Case[] pieces, int srcPosition, int jumpedPosition, int tgtPosition
) {
assert (pieces[srcPosition] == Case.WHITE_QUEEN)
|| pieces[srcPosition] == Case.WHITE_PIECE;
assert pieces[tgtPosition] == Case.EMPTY;
assert pieces[jumpedPosition] == Case.BLACK_PIECE
|| pieces[jumpedPosition] == Case.BLACK_QUEEN;
Case[] res = pieces.clone();
Case srcPi = res[srcPosition];
res[srcPosition] = Case.EMPTY;
res[jumpedPosition] = Case.EMPTY;
res[tgtPosition] = srcPi;
return res;
}
// Return case list with white piece in srcPosition move to tgtPosition.
private static Case[] getMoveWhiteCase(Case[] pieces, int srcPosition, int tgtPosition) {
assert pieces[srcPosition] != Case.BLACK_PIECE;
assert pieces[srcPosition] != Case.BLACK_QUEEN;
assert pieces[srcPosition] != Case.EMPTY;
assert pieces[tgtPosition] == Case.EMPTY;
Case[] res = pieces.clone();
Case p = res[srcPosition];
res[srcPosition] = Case.EMPTY;
res[tgtPosition] = p;
return res;
}
private static List<Integer> getWhiteCases(Case[] pieces) {
List<Integer> positions = new ArrayList<>(15);
for (int i = 0; i < pieces.length; ++i) {
if (pieces[i] == Case.WHITE_PIECE || pieces[i] == Case.WHITE_QUEEN) {
positions.add(i);
}
}
return positions;
}
private static int reverseCaseIndice(int indice) {
assert indice >= 0 && indice < PIECE_SIZE : "indice = " + indice;
return 49 - indice;
}
public static Case[] reverseCases(Case[] pieces) {
Case[] reverseCases = new Case[PIECE_SIZE];
for (int i = 0; i < PIECE_SIZE; ++i) {
reverseCases[reverseCaseIndice(i)] = oppositeColor(pieces[i]);
}
return reverseCases;
}
private static Case oppositeColor(Case piece) {
Case opposite;
switch (piece) {
case WHITE_PIECE :
opposite = Case.BLACK_PIECE;
break;
case BLACK_PIECE :
opposite = Case.WHITE_PIECE;
break;
case WHITE_QUEEN :
opposite = Case.BLACK_QUEEN;
break;
case BLACK_QUEEN :
opposite = Case.WHITE_QUEEN;
break;
default :
opposite = Case.EMPTY;
break;
}
return opposite;
}
private static Case[] transformPieceToQueen(Case[] cases) {
Case[] clonedCases = cases.clone();
for (int i = 49; i >= 45; --i) {
if (clonedCases[i] == Case.WHITE_PIECE) {
clonedCases[i] = Case.WHITE_QUEEN;
}
}
return clonedCases;
}
private static List<Case[]> transformPieceToQueen(List<Case[]> cases) {
return cases
.stream()
.map(CheckersBoardMove::transformPieceToQueen)
.collect(Collectors.toList());
}
private static Move transformPieceToQueen(Move move) {
return new Move(
move.getMove()
.stream()
.map(cases -> {
if (Arrays.equals(cases, move.getLast())) {
return transformPieceToQueen(cases);
} else {
return cases;
}
})
.collect(Collectors.toList())
);
}
// ENUM
private enum Direction {
TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT
}
}
| [
"gdn.anthony@gmail.com"
] | gdn.anthony@gmail.com |
06e876ff7cc8e087cf80a02f0e00dcf75c76ccff | c47486a117a3f2f4e8f1e4c44156720d4ea8484f | /simple-service-stock/src/main/java/yu/controller/StockController.java | e5379d0fff7d65ff212b39211e384722691c03c2 | [] | no_license | yufarui/simple-spring-cloud-alibaba | d2d4ceb61aecb71f1c1ea41059e79b7630222756 | d96c5f89e77462ea0d8e7f8bd93be0cd696df654 | refs/heads/master | 2021-05-25T13:45:42.548801 | 2020-06-10T12:14:32 | 2020-06-10T12:14:32 | 253,778,004 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package yu.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class StockController {
@GetMapping("/product/stock/{productId}")
public String getStock(@PathVariable("productId") String productId) {
return productId;
}
}
| [
"2412442175@qq.com"
] | 2412442175@qq.com |
9690a2200cb4581da2f2c1944c4b7d879753be8d | b4b62c5c77ec817db61820ccc2fee348d1d7acc5 | /src/main/java/com/alipay/api/response/AntMerchantExpandTradeorderQueryResponse.java | dd4ddd5755a1e5db1eca6f258cf63cca53153f1f | [
"Apache-2.0"
] | permissive | zhangpo/alipay-sdk-java-all | 13f79e34d5f030ac2f4367a93e879e0e60f335f7 | e69305d18fce0cc01d03ca52389f461527b25865 | refs/heads/master | 2022-11-04T20:47:21.777559 | 2020-06-15T08:31:02 | 2020-06-15T08:31:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,138 | java | package com.alipay.api.response;
import java.util.Date;
import java.util.List;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
import com.alipay.api.domain.ItemOrderOpenData;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: ant.merchant.expand.tradeorder.query response.
*
* @author auto create
* @since 1.0, 2019-01-07 20:51:15
*/
public class AntMerchantExpandTradeorderQueryResponse extends AlipayResponse {
private static final long serialVersionUID = 2433428591443385587L;
/**
* 订单金额;单位:分
*/
@ApiField("amount")
private Long amount;
/**
* 业务序列号
*/
@ApiField("biz_seq")
private String bizSeq;
/**
* 买家ID
*/
@ApiField("buyer_id")
private String buyerId;
/**
* 订单扩展信息
*/
@ApiField("ext_info")
private String extInfo;
/**
* 订单创建时间
*/
@ApiField("gmt_create")
private Date gmtCreate;
/**
* 订单修改时间
*/
@ApiField("gmt_modified")
private Date gmtModified;
/**
* 支付时间
*/
@ApiField("gmt_paid")
private Date gmtPaid;
/**
* 商品订单列表
*/
@ApiListField("item_orders")
@ApiField("item_order_open_data")
private List<ItemOrderOpenData> itemOrders;
/**
* 订单物流状态
*/
@ApiField("logistics_status")
private String logisticsStatus;
/**
* 订单描述
*/
@ApiField("memo")
private String memo;
/**
* 商家补贴金额;单位:分
*/
@ApiField("merchant_subsidy_amount")
private Long merchantSubsidyAmount;
/**
* 订单ID
*/
@ApiField("order_id")
private String orderId;
/**
* 外部订单号
*/
@ApiField("out_biz_no")
private String outBizNo;
/**
* 外部业务类型;TO_SHOP(到店)、GAS(加油)
*/
@ApiField("out_biz_type")
private String outBizType;
/**
* 平台商ID
*/
@ApiField("partner_id")
private String partnerId;
/**
* 平台补贴金额;单位:分
*/
@ApiField("partner_subsidy_amount")
private Long partnerSubsidyAmount;
/**
* 订单实际支付金额;单位:分
*/
@ApiField("real_amount")
private Long realAmount;
/**
* 卖家ID
*/
@ApiField("seller_id")
private String sellerId;
/**
* 门店ID
*/
@ApiField("shop_id")
private String shopId;
/**
* 订单状态;INIT(初始化)、WAIT_PAY(待支付)、PAID(已支付)、TIMEOUT_CLOSED(超时关闭)、SUCCESS_FINISHED(订单成功完结)、REFUNDED(已退款)
*/
@ApiField("status")
private String status;
/**
* 交易号
*/
@ApiField("trade_no")
private String tradeNo;
/**
* 业务类型;GAS_SERVICE(加油业务),SHOP_SERVICE(到店业务)
*/
@ApiField("type")
private String type;
public void setAmount(Long amount) {
this.amount = amount;
}
public Long getAmount( ) {
return this.amount;
}
public void setBizSeq(String bizSeq) {
this.bizSeq = bizSeq;
}
public String getBizSeq( ) {
return this.bizSeq;
}
public void setBuyerId(String buyerId) {
this.buyerId = buyerId;
}
public String getBuyerId( ) {
return this.buyerId;
}
public void setExtInfo(String extInfo) {
this.extInfo = extInfo;
}
public String getExtInfo( ) {
return this.extInfo;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtCreate( ) {
return this.gmtCreate;
}
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
public Date getGmtModified( ) {
return this.gmtModified;
}
public void setGmtPaid(Date gmtPaid) {
this.gmtPaid = gmtPaid;
}
public Date getGmtPaid( ) {
return this.gmtPaid;
}
public void setItemOrders(List<ItemOrderOpenData> itemOrders) {
this.itemOrders = itemOrders;
}
public List<ItemOrderOpenData> getItemOrders( ) {
return this.itemOrders;
}
public void setLogisticsStatus(String logisticsStatus) {
this.logisticsStatus = logisticsStatus;
}
public String getLogisticsStatus( ) {
return this.logisticsStatus;
}
public void setMemo(String memo) {
this.memo = memo;
}
public String getMemo( ) {
return this.memo;
}
public void setMerchantSubsidyAmount(Long merchantSubsidyAmount) {
this.merchantSubsidyAmount = merchantSubsidyAmount;
}
public Long getMerchantSubsidyAmount( ) {
return this.merchantSubsidyAmount;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getOrderId( ) {
return this.orderId;
}
public void setOutBizNo(String outBizNo) {
this.outBizNo = outBizNo;
}
public String getOutBizNo( ) {
return this.outBizNo;
}
public void setOutBizType(String outBizType) {
this.outBizType = outBizType;
}
public String getOutBizType( ) {
return this.outBizType;
}
public void setPartnerId(String partnerId) {
this.partnerId = partnerId;
}
public String getPartnerId( ) {
return this.partnerId;
}
public void setPartnerSubsidyAmount(Long partnerSubsidyAmount) {
this.partnerSubsidyAmount = partnerSubsidyAmount;
}
public Long getPartnerSubsidyAmount( ) {
return this.partnerSubsidyAmount;
}
public void setRealAmount(Long realAmount) {
this.realAmount = realAmount;
}
public Long getRealAmount( ) {
return this.realAmount;
}
public void setSellerId(String sellerId) {
this.sellerId = sellerId;
}
public String getSellerId( ) {
return this.sellerId;
}
public void setShopId(String shopId) {
this.shopId = shopId;
}
public String getShopId( ) {
return this.shopId;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatus( ) {
return this.status;
}
public void setTradeNo(String tradeNo) {
this.tradeNo = tradeNo;
}
public String getTradeNo( ) {
return this.tradeNo;
}
public void setType(String type) {
this.type = type;
}
public String getType( ) {
return this.type;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
cce16f20c7112c1343bc7115ec706917057729c6 | 2fb01180082e42a2dbdb9df61556acea0967038d | /func_Gson.java | 6c152dc7e2b422d7e8b05691be8df4ad8b965e8e | [] | no_license | bijancot/JavaLocalStorage | 5b568bc7f3fe2f3c62fce42faa108bf1d7c15169 | c911c8dfb76b2cd46260f7ffa6d6d89f9f1b8f17 | refs/heads/master | 2020-04-07T13:09:41.124423 | 2019-03-06T09:07:05 | 2019-03-06T09:07:05 | 158,395,246 | 1 | 0 | null | 2018-12-10T13:52:31 | 2018-11-20T13:38:32 | Java | UTF-8 | Java | false | false | 8,718 | java | import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import com.google.gson.stream.JsonReader;
import com.sun.org.apache.xpath.internal.operations.Equals;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonArray;
import java.io.FileWriter;
import java.sql.*;
public class func_Gson{
public static void GetGSON(){
Gson gson = new Gson();
try {
JsonReader reader = new JsonReader(new FileReader("./user.json"));
JsonObject inputObj = gson.fromJson(reader, JsonObject.class);
inputObj.get("user").getAsJsonArray().get(0);
JsonArray jarray = inputObj.getAsJsonArray("user");
for(int i =0; i< jarray.size();i++){
try{
JsonObject kolo = jarray.get(i).getAsJsonObject();
JsonObject jolo = kolo.getAsJsonObject();
String a = jolo.get("nama").getAsString();
String b = jolo.get("no_telp").getAsString();
String c = jolo.get("alamat").getAsString();
String d = jolo.get("panggilan").getAsString();
String e = jolo.get("email").getAsString();
System.out.println(a+"\t"+b+"\t"+c+"\t"+d+"\t"+e);
} catch(Exception o){
func.Menu();
}
}
}catch (IOException e) {
//e.printStackTrace();
func.Menu();
}
}
public static void AddGSON(String nama, String no_telp, String alamat, String panggilan, String email){
try{
Gson gson = new Gson();
JsonReader reader = new JsonReader(new FileReader("./user.json"));
JsonObject inputObj = gson.fromJson(reader, JsonObject.class);
JsonObject newObject = new JsonObject() ;
newObject.addProperty("nama",nama);
newObject.addProperty("no_telp",no_telp);
newObject.addProperty("alamat",alamat);
newObject.addProperty("panggilan",panggilan);
newObject.addProperty("email",email);
inputObj.get("user").getAsJsonArray().add(newObject);
String yolo = inputObj.toString();
try (FileWriter writor = new FileWriter("./user.json")) {
gson.toJson(inputObj, writor);
} catch (IOException e) {
e.printStackTrace();
}
}catch(IOException e){
e.printStackTrace();
}
}
public static void EditGSON(String param, String nama, String no_telp, String alamat, String panggilan, String email){
Gson gson = new Gson();
try {
JsonReader reader = new JsonReader(new FileReader("./user.json"));
JsonObject inputObj = gson.fromJson(reader, JsonObject.class);
inputObj.get("user").getAsJsonArray().get(0);
JsonArray jarray = inputObj.getAsJsonArray("user");
for(int i =0; i< jarray.size();i++){
JsonObject kolo = jarray.get(i).getAsJsonObject();
JsonObject jolo = kolo.getAsJsonObject();
if(jolo.get("nama").getAsString().equals(param)){
jolo.addProperty("nama",nama);
jolo.addProperty("no_telp",no_telp);
jolo.addProperty("alamat",alamat);
jolo.addProperty("panggilan",panggilan);
jolo.addProperty("email",email);
}
}
try (FileWriter writor = new FileWriter("./user.json")) {
gson.toJson(inputObj, writor);
} catch (IOException e) {
e.printStackTrace();
}
}catch (IOException e) {
e.printStackTrace();
}
}
public static void RemoveGSON(String Nama){
Gson gson = new Gson();
try {
JsonReader reader = new JsonReader(new FileReader("./user.json"));
JsonObject inputObj = gson.fromJson(reader, JsonObject.class);
inputObj.get("user").getAsJsonArray().get(0);
JsonArray jarray = inputObj.getAsJsonArray("user");
for(int i =0; i< jarray.size();i++){
JsonObject kolo = jarray.get(i).getAsJsonObject();
JsonObject jolo = kolo.getAsJsonObject();
if(jolo.get("nama").getAsString().equals(Nama)){
jolo.getAsJsonObject().remove("nama");
jolo.getAsJsonObject().remove("no_telp");
jolo.getAsJsonObject().remove("alamat");
jolo.getAsJsonObject().remove("panggilan");
jolo.getAsJsonObject().remove("email");
jarray.remove(i);
continue;
}
}
try (FileWriter writor = new FileWriter("./user.json")) {
gson.toJson(inputObj, writor);
} catch (IOException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static void AddtoTemp(String Query){
try{
Gson gson = new Gson();
JsonReader reader = new JsonReader(new FileReader("./temp.json"));
JsonObject inputObj = gson.fromJson(reader, JsonObject.class);
JsonObject newObject = new JsonObject() ;
newObject.addProperty("queue",Query);
inputObj.get("dato").getAsJsonArray().add(newObject);
String yolo = inputObj.toString();
try (FileWriter writor = new FileWriter("./temp.json")) {
gson.toJson(inputObj, writor);
} catch (IOException e) {
e.printStackTrace();
}
}catch(IOException e){
e.printStackTrace();
}
}
static void GetQue(){
Gson gson = new Gson();
try {
JsonReader reader = new JsonReader(new FileReader("./temp.json"));
JsonObject inputObj = gson.fromJson(reader, JsonObject.class);
inputObj.get("dato").getAsJsonArray().get(0);
JsonArray jarray = inputObj.getAsJsonArray("dato");
for(int i =0; i< jarray.size();i++){
JsonObject kolo = jarray.get(i).getAsJsonObject();
JsonObject jolo = kolo.getAsJsonObject();
try{
String sql = jolo.get("queue").getAsString();
Database.stmt = Database.conn.createStatement();
Database.stmt.executeUpdate(sql);
jolo.getAsJsonObject().remove("queue");
jarray.remove(i);
try (FileWriter writor = new FileWriter("./temp.json")) {
gson.toJson(inputObj, writor);
} catch (IOException x) {
x.printStackTrace();
}
}catch(Exception e){
e.printStackTrace();
}
}
}catch (IOException e) {
//e.printStackTrace();
func.Menu();
}
}
public static void GetGSONS(String nama){
Gson gson = new Gson();
try {
JsonReader reader = new JsonReader(new FileReader("./user.json"));
JsonObject inputObj = gson.fromJson(reader, JsonObject.class);
inputObj.get("user").getAsJsonArray().get(0);
JsonArray jarray = inputObj.getAsJsonArray("user");
for(int i =0; i< jarray.size();i++){
JsonObject kolo = jarray.get(i).getAsJsonObject();
JsonObject jolo = kolo.getAsJsonObject();
if(jolo.get("nama").equals(nama)){
String a = jolo.get("nama").getAsString();
String b = jolo.get("no_telp").getAsString();
String c = jolo.get("alamat").getAsString();
String d = jolo.get("panggilan").getAsString();
String e = jolo.get("email").getAsString();
System.out.println(a+"\t"+b+"\t"+c+"\t"+d+"\t"+e);
}
else if(jolo.get("nama").equals(nama)==false){
continue;
}
}
}catch (IOException e) {
e.printStackTrace();
}
}
} | [
"panjidia995@gmail.com"
] | panjidia995@gmail.com |
8ba922216b91b60c5483a788532d4be929992b1d | b701415de83675f52f1b6ed85d66fb92ecb042a3 | /view/ChatServerView.java | d3e810d0e48a5442dd1b1239815b3aed6051a07d | [] | no_license | bxagha/netchat | 3009f9f67c83615a5b6d2d1ff63795c1df0a7c56 | 64e260f45465a001c63bf34265c4b5bdcbe3540e | refs/heads/master | 2020-12-24T19:37:12.899548 | 2016-04-19T18:41:14 | 2016-04-19T18:41:14 | 56,621,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,945 | java | package view;
import model.ChatServer;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
public class ChatServerView extends JFrame implements Runnable {
protected Socket socket;
protected DataOutputStream outStream;
protected JTextArea outTextArea;
protected JTextField infoServerStatus;
protected Button onOf;
// protected boolean isOn;
public ChatServerView(String title) {
super(title);
setSize(300, 200);
setLocation(20, 20);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setLayout(new BorderLayout());
setVisible(true);
JPanel jp = new JPanel();
jp.setLayout(new BorderLayout());
add(BorderLayout.CENTER, outTextArea = new JTextArea());
add(BorderLayout.SOUTH, jp);
jp.add(BorderLayout.CENTER, infoServerStatus = new JTextField());
jp.add(BorderLayout.EAST, onOf = new Button("Выключить"));
onOf.setBackground(Color.pink);
infoServerStatus.setHorizontalAlignment(JTextField.CENTER);
infoServerStatus.setText("Сервер работает");
infoServerStatus.setBackground(Color.GREEN);
infoServerStatus.setEditable(false);
onOf.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(ChatServer.isOnOf()){
ChatServer.setOnOf(false);
onOf.setBackground(Color.GREEN);
onOf.setLabel("Включить");
infoServerStatus.setText("Сервер выключен");
infoServerStatus.setBackground(Color.pink);
}else {
ChatServer.setOnOf(true);
onOf.setBackground(Color.pink);
onOf.setLabel("Выключить");
infoServerStatus.setText("Сервер работает");
infoServerStatus.setBackground(Color.GREEN);
}
}
});
addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
super.windowClosed(e); //todo
// isOn = false;
try {
outStream.close();
} catch (IOException e1) {
e1.printStackTrace();
}
try {
socket.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
});
(new Thread(this)).start();
}
@Override
public void run() {
// isOn = true;
}
}
| [
"bxagha@gmail.com"
] | bxagha@gmail.com |
5b15160066373972ea884fdd14445b406b3f2a26 | de9b9b0e8d59c681eba5b5f281bb43a068843322 | /src/NarayanMysql/ProductEntityPK.java | 98f20e885920eff6586a08d88f31b1a009a5f3a5 | [] | no_license | narayansau/JAva_Groovy_JPA | e490f87cf6b6f539553e9171782d4bb995bc30b6 | 3fba77ce80fef206fbe6cba50a8606c58db6c647 | refs/heads/master | 2020-03-27T20:34:24.829693 | 2018-09-02T11:18:59 | 2018-09-02T11:18:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,106 | java | package NarayanMysql;
import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;
import java.util.Objects;
public class ProductEntityPK implements Serializable {
private int id;
private int categoryIdCategory;
@Column(name = "id", nullable = false)
@Id
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Column(name = "Category_idCategory", nullable = false)
@Id
public int getCategoryIdCategory() {
return categoryIdCategory;
}
public void setCategoryIdCategory(int categoryIdCategory) {
this.categoryIdCategory = categoryIdCategory;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ProductEntityPK that = (ProductEntityPK) o;
return id == that.id &&
categoryIdCategory == that.categoryIdCategory;
}
@Override
public int hashCode() {
return Objects.hash( id, categoryIdCategory );
}
}
| [
"narayansau@yahoo.com"
] | narayansau@yahoo.com |
87ce795104ee55093fcd9179a02145ace1a7ecf6 | aabd762c13acdcc8839562888017487301c20606 | /src/UserInterface.java | 8532b33fbe79b1ed569beb5e5a63c13babdb3bb0 | [] | no_license | ProphetRush/LAB3-Protection | f7fd6e9ce94c61449f5ec6f0b45dcb1cfeff716b | 737ff886613ca1f1f00dd643ea3d35b8895b401c | refs/heads/master | 2021-06-18T03:50:19.993061 | 2017-06-07T13:57:53 | 2017-06-07T13:57:53 | 93,392,245 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,977 | java | import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import java.util.ArrayList;
/**
* Created by Prophet on 6/5/2017.
*/
public class UserInterface
{
public JTable table1;
public JButton loginButton;
public JButton addUserButton;
public JButton PLAYButton;
public JLabel UserLable;
public JScrollPane UserTable;
public JPanel MainPanel;
public JTextField username;
public JComboBox add_userType;
public JTextField Add_Username;
public JPasswordField pwd;
public JPasswordField Add_pwd;
public JLabel UserGroup;
public JButton logOutButton;
public JLabel vlable;
public JTextField vcodeString;
public JButton changeButton;
private void createUIComponents() {
// TODO: place custom component creation code here
String[] columnNames = {"UserName", "UserType", "userID"};
User admin = new User("admin", "123456", "Computer Center Staff");
String[] UserInfo = new String[3];
UserInfo[0] = admin.username;
UserInfo[1] = admin.getUserType();
UserInfo[2] = admin.getId();
Object[][] userTable = {UserInfo};
DefaultTableModel UserModel = new DefaultTableModel(userTable, columnNames) {
public boolean isCellEditable(int row, int column) {
return false;
}
};
table1 = new JTable(UserModel);
DefaultTableCellRenderer r = new DefaultTableCellRenderer();
r.setHorizontalAlignment(JLabel.CENTER);
table1.setDefaultRenderer(Object.class, r);
ImageIcon pic1 = new ImageIcon("src/init.png");
vlable = new JLabel(pic1);
}
public UserInterface(){
JFrame frame = new JFrame("UserInterface");
frame.setContentPane(this.MainPanel);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
}
| [
"LIAOSIZHE@Gmail.com"
] | LIAOSIZHE@Gmail.com |
03246da1dd25ad7a7074211081cb1bc0876066a5 | dcf1a4b97f1630be4553cfebd4e74abd5f5c80ce | /app/src/main/java/com/xiandong/fst/model/PayModelImpl.java | b2c318d6fa0dbea5b1689f1f1faf006988826ad6 | [] | no_license | EGOSICK/NewFenShenTu | 39d39c6f01121c4a26c88bcb6430589972e916dd | 58693c40a4d06e054c22a797c1ca68aca3287cfa | refs/heads/master | 2021-01-11T06:36:24.838889 | 2017-03-02T08:04:18 | 2017-03-02T08:04:18 | 81,193,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,427 | java | package com.xiandong.fst.model;
import android.app.Activity;
import android.util.Log;
import com.xiandong.fst.application.Constant;
import com.xiandong.fst.model.bean.AbsBaseBean;
import com.xiandong.fst.model.bean.EWaiPayBean;
import com.xiandong.fst.model.bean.PayBean;
import com.xiandong.fst.model.bean.PayOrderBean;
import com.xiandong.fst.model.bean.RedPacketPayBean;
import com.xiandong.fst.presenter.PayPresenter;
import com.xiandong.fst.tools.dbmanager.AppDbManager;
import com.xiandong.fst.utils.GsonUtil;
import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;
/**
* Created by dell on 2017/01/10
*/
public class PayModelImpl implements PayModel {
@Override
public void getOrderId(PayBean payBean, final Activity context, final PayPresenter payPresenter) {
RequestParams params = new RequestParams(Constant.APIURL + "faorder");
params.addBodyParameter("come", "android");
params.addBodyParameter("position", payBean.getPosition());
params.addBodyParameter("pcontent", payBean.getAddress());
params.addBodyParameter("price", payBean.getMoney());
params.addBodyParameter("title",payBean.getTitle());
params.addBodyParameter("time", payBean.getTime());
params.addBodyParameter("uid", payBean.getUid());
params.addBodyParameter("phone", payBean.getPhone());
params.addBodyParameter("info", payBean.getDetail());
params.addBodyParameter("type", payBean.getType() + "");
x.http().post(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
AbsBaseBean bean = GsonUtil.fromJson(result, AbsBaseBean.class);
PayOrderBean orderBean;
switch (bean.getResult()) {
case 1: // 微信 订单
orderBean = GsonUtil.fromJson(result, PayOrderBean.class);
payPresenter.getOrderIdSuccess(orderBean.getOrderid());
break;
case 2:
orderBean = GsonUtil.fromJson(result, PayOrderBean.class);
payPresenter.getOrderIdSuccess(orderBean.getOrderid());
break;
case 3:
payPresenter.getOrderIdSuccess("");
break;
default:
payPresenter.getOrderIdFails(bean.getMessage());
break;
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
payPresenter.getOrderIdFails(ex.getMessage());
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
}
@Override
public void getRedPacketOrderId(RedPacketPayBean payBean, final PayPresenter payPresenter) {
RequestParams params = new RequestParams(Constant.APIURL + "addredbag");
params.addBodyParameter("uid", payBean.getUid());
params.addBodyParameter("type", payBean.getType() + "");
params.addBodyParameter("distance", payBean.getDistance());
params.addBodyParameter("totalfee", payBean.getTotalFee());
params.addBodyParameter("totalcount", payBean.getTotalCount());
x.http().post(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
AbsBaseBean bean = GsonUtil.fromJson(result, AbsBaseBean.class);
PayOrderBean orderBean;
switch (bean.getResult()) {
case 1: // 微信 订单
orderBean = GsonUtil.fromJson(result, PayOrderBean.class);
payPresenter.getOrderIdSuccess(orderBean.getOrderid());
break;
case 2:
orderBean = GsonUtil.fromJson(result, PayOrderBean.class);
payPresenter.getOrderIdSuccess(orderBean.getOrderid());
break;
case 3:
payPresenter.getOrderIdSuccess("");
break;
default:
payPresenter.getOrderIdFails(bean.getMessage());
break;
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
payPresenter.getOrderIdFails(ex.getMessage());
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
}
@Override
public void getEWaiPriceOrderId(EWaiPayBean payBean, final PayPresenter payPresenter) {
RequestParams params = new RequestParams(Constant.APIURL + "extra");
params.addParameter("uid", AppDbManager.getUserId());
params.addParameter("oid", payBean.getId());
params.addParameter("money", payBean.getMoney());
params.addParameter("type",payBean.getType());
x.http().post(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
Log.d("OrderDetailsModelImpl", result);
AbsBaseBean absBaseBean = GsonUtil.fromJson(result, AbsBaseBean.class);
switch (absBaseBean.getResult()) {
case Constant.HTTPSUCCESS:
PayOrderBean orderBean = GsonUtil.fromJson(result, PayOrderBean.class);
payPresenter.getOrderIdSuccess(orderBean.getOrderid());
break;
default:
payPresenter.getOrderIdFails(absBaseBean.getMessage());
break;
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
payPresenter.getOrderIdFails(ex.getMessage());
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
}
} | [
"776819681@qq.com"
] | 776819681@qq.com |
ff436e607730d0dab13898fa766447d662c73a01 | 51ec63113b3994312e300e6976527ee3c5bf1114 | /ArrayListChallenge - Alternate Solution/src/dev/twobeardednomads/dev/twobeardednomands/Contact.java | 46fcc62f0a7c714a3b9805ba790d4a4604c516ae | [] | no_license | 10xOXR/LearningJavaProjects | c78d08025ac39aa1a57a48ab3cc216be8abefedb | c572125ec14b3d50e390549d2c9a6785348e9a21 | refs/heads/master | 2022-12-20T14:02:48.506103 | 2020-10-04T12:28:51 | 2020-10-04T12:28:51 | 255,301,473 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 500 | java | package dev.twobeardednomands;
public class Contact {
private String name;
private String phoneNumber;
public Contact(String name, String phoneNumber) {
this.name = name;
this.phoneNumber = phoneNumber;
}
public String getName() {
return name;
}
public String getPhoneNumber() {
return phoneNumber;
}
public static Contact createContact(String name, String phoneNumber) {
return new Contact(name, phoneNumber);
}
}
| [
"10xoxr@gmail.com"
] | 10xoxr@gmail.com |
a358b45bb337cf17f4f12590dfc52c05e62035ed | dcb4f468b88df896ff3f922391e447e843d63a7f | /app/src/main/java/manipal/com/present_manipal/splash_screen.java | ea2b6d386e0319e678f109ea87fbf90d197180f1 | [] | no_license | pratikshagadkari/present_manipal | 5b98df7225f4abae2ee6aa2b108d10967f1463ea | dae8da920ea90d316880976b9f847b0c5a3dc0ab | refs/heads/master | 2020-06-01T08:06:20.342436 | 2019-06-07T08:34:21 | 2019-06-07T08:34:21 | 190,712,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,264 | java | package manipal.com.present_manipal;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.WindowManager;
import com.crashlytics.android.Crashlytics;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import io.fabric.sdk.android.Fabric;
public class splash_screen extends AppCompatActivity {
int SPLASH_DISPLAY_LENGTH=2000;
FirebaseAuth auth;
FirebaseUser user;
FirebaseStorage firebaseStorage;
StorageReference storageReference;
FirebaseDatabase data;
DatabaseReference ref;
String imageURL;
final String PREFS_NAME = "MyPrefsFile";
@Override
protected void onCreate(Bundle savedInstanceState) {
SharedPreferences preferences=getSharedPreferences("User Info",MODE_PRIVATE);
final int choice=preferences.getInt("Type", 0);
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics());
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_splash_screen);
final SharedPreferences settings = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
data = FirebaseDatabase.getInstance();
auth = FirebaseAuth.getInstance();
user = auth.getCurrentUser();
ref = data.getReference();
firebaseStorage=FirebaseStorage.getInstance();
storageReference=firebaseStorage.getReference();
if (settings.getBoolean("my_first_time", true)) {
Intent i=new Intent(splash_screen.this,app_tutorial.class);
startActivity(i);
finish();
settings.edit().putBoolean("my_first_time", false).apply();
}
else{
if (user != null) {
String s=user.getEmail();
Log.d("user_det",auth.getUid());
data.getReference().child("Teachers").child(auth.getUid()).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if(dataSnapshot.exists()){
storageReference.child(auth.getUid()).getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
imageURL= uri.toString();
}
});
Log.d("user_det",dataSnapshot.child("type").getValue().toString());
if(dataSnapshot.child("type").getValue().toString().equals("teacher")){
Intent mainIntent = new Intent(splash_screen.this, teacher_mainpage.class);
startActivity(mainIntent);
finish();
}
}
else{
storageReference.child(auth.getUid()).getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
imageURL= uri.toString();
}
});
data.getReference().child("Students").child(auth.getUid()).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if(dataSnapshot.exists()){
if(dataSnapshot.child("type").getValue().toString().equals("student")) {
Intent mainIntent = new Intent(splash_screen.this, student_mainpage.class);
startActivity(mainIntent);
finish();
}
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
else {
Intent mainIntent = new Intent(splash_screen.this, choice_page.class);
startActivity(mainIntent);
finish();
}
}
}
},SPLASH_DISPLAY_LENGTH);
}
}
/**/
/**/ | [
"pratikshagadkari123@gmail.com"
] | pratikshagadkari123@gmail.com |
9727f5948d8b4b65687ea9bf93e4653f0ac6cea3 | 2f5b8741780ec712d26f82d8b28a4e5c5885e4a4 | /Exception_Handling/app6/src/M15.java | 31fde8b47ecbb397df8d17cc3a25aced8c4e9562 | [] | no_license | Vijay-Ky/5BFSD_APTECH | e60e8380eed116afd9a1e9abbd69b7a503ed66fe | 1d1a9eb21eb63b86f771687ac1ec6560fbcaa787 | refs/heads/main | 2023-03-27T13:02:00.311280 | 2021-03-30T08:44:27 | 2021-03-30T08:44:27 | 331,601,827 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 624 | java | class M15
{
public static void main(String[] args) //throws InterruptedException
{
/*
try
{
System.out.println(1000);
Class.forName("");//min one Class.forName max any no. of we can keep
Class.forName("");
Class.forName("");
}
catch (ClassNotFoundException ex)
{
}
System.out.println("done");*/
try
{
Class.forName("");
Thread.sleep(10000);
}
catch (ClassNotFoundException ex)
{
}
catch (InterruptedException ex)
{
}
/*
try
{
Class.forName("");
Thread.sleep(10000);
}
catch (ClassNotFoundException ex)
{
}*/
//System.out.println("done");
}
} | [
"vijayky007@gmail.com"
] | vijayky007@gmail.com |
5acbe4ee9e90f76da3c1d3824c39029ee632de2d | b7de9ce0697c99ba70b460cb418da5c2d61d9b5f | /World.java | 0dfe25ad8878b92f3cc47c66b04a0945d7abb71d | [] | no_license | yjiu99/git_exam1 | e3e943cdd29ad0fac3275cc40f4b9a0c617f7790 | e659aa1eb9a0b4f3ac514b930630d91a6ae3fa0d | refs/heads/main | 2023-08-18T02:14:45.631364 | 2021-09-28T00:24:26 | 2021-09-28T00:24:26 | 411,075,691 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 522 | java | package git_exam1;
public class World {
static int factorial(int n){
int result = 1;
for (int i=1;i<=n;++i)
result *= i;
return result;
}
static int sum(int n){
int result = 0;
for (int i=0;i<=n;++i)
result += i;
return result;
}
public static void main(String[] args){
for(int i=5;i<=10;++i)
System.out.println(sum(i));
for(int i=5;i<=10;++i)
System.out.println(factorial(i));
}
}
| [
"yjiu9992@gmail.com"
] | yjiu9992@gmail.com |
0424ab636a41a5947079737ec4808e20812da570 | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /frameworks/base/media/java/android/media/AudioSystem.java | 661b0fdf1e7a1fd5dbd0345561e6e422622e2b49 | [
"MIT",
"LicenseRef-scancode-unicode",
"Apache-2.0"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | Java | false | false | 18,826 | java | /*
* Copyright (C) 2006 The Android Open Source Project
*
* 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 android.media;
/* IF YOU CHANGE ANY OF THE CONSTANTS IN THIS FILE, DO NOT FORGET
* TO UPDATE THE CORRESPONDING NATIVE GLUE AND AudioManager.java.
* THANK YOU FOR YOUR COOPERATION.
*/
/**
* @hide
*/
public class AudioSystem
{
/* These values must be kept in sync with AudioSystem.h */
/*
* If these are modified, please also update Settings.System.VOLUME_SETTINGS
* and attrs.xml and AudioManager.java.
*/
/* The audio stream for phone calls */
public static final int STREAM_VOICE_CALL = 0;
/* The audio stream for system sounds */
public static final int STREAM_SYSTEM = 1;
/* The audio stream for the phone ring and message alerts */
public static final int STREAM_RING = 2;
/* The audio stream for music playback */
public static final int STREAM_MUSIC = 3;
/* The audio stream for alarms */
public static final int STREAM_ALARM = 4;
/* The audio stream for notifications */
public static final int STREAM_NOTIFICATION = 5;
/* @hide The audio stream for phone calls when connected on bluetooth */
public static final int STREAM_BLUETOOTH_SCO = 6;
/* @hide The audio stream for enforced system sounds in certain countries (e.g camera in Japan) */
public static final int STREAM_SYSTEM_ENFORCED = 7;
/* @hide The audio stream for DTMF tones */
public static final int STREAM_DTMF = 8;
/* @hide The audio stream for text to speech (TTS) */
public static final int STREAM_TTS = 9;
/**
* @deprecated Use {@link #numStreamTypes() instead}
*/
public static final int NUM_STREAMS = 5;
// Expose only the getter method publicly so we can change it in the future
private static final int NUM_STREAM_TYPES = 10;
public static final int getNumStreamTypes() { return NUM_STREAM_TYPES; }
/*
* Sets the microphone mute on or off.
*
* @param on set <var>true</var> to mute the microphone;
* <var>false</var> to turn mute off
* @return command completion status see AUDIO_STATUS_OK, see AUDIO_STATUS_ERROR
*/
public static native int muteMicrophone(boolean on);
/*
* Checks whether the microphone mute is on or off.
*
* @return true if microphone is muted, false if it's not
*/
public static native boolean isMicrophoneMuted();
/* modes for setPhoneState, must match AudioSystem.h audio_mode */
public static final int MODE_INVALID = -2;
public static final int MODE_CURRENT = -1;
public static final int MODE_NORMAL = 0;
public static final int MODE_RINGTONE = 1;
public static final int MODE_IN_CALL = 2;
public static final int MODE_IN_COMMUNICATION = 3;
public static final int NUM_MODES = 4;
/* Routing bits for the former setRouting/getRouting API */
/** @deprecated */
@Deprecated public static final int ROUTE_EARPIECE = (1 << 0);
/** @deprecated */
@Deprecated public static final int ROUTE_SPEAKER = (1 << 1);
/** @deprecated use {@link #ROUTE_BLUETOOTH_SCO} */
@Deprecated public static final int ROUTE_BLUETOOTH = (1 << 2);
/** @deprecated */
@Deprecated public static final int ROUTE_BLUETOOTH_SCO = (1 << 2);
/** @deprecated */
@Deprecated public static final int ROUTE_HEADSET = (1 << 3);
/** @deprecated */
@Deprecated public static final int ROUTE_BLUETOOTH_A2DP = (1 << 4);
/** @deprecated */
@Deprecated public static final int ROUTE_ALL = 0xFFFFFFFF;
/*
* Checks whether the specified stream type is active.
*
* return true if any track playing on this stream is active.
*/
public static native boolean isStreamActive(int stream, int inPastMs);
/*
* Checks whether the specified stream type is active on a remotely connected device. The notion
* of what constitutes a remote device is enforced by the audio policy manager of the platform.
*
* return true if any track playing on this stream is active on a remote device.
*/
public static native boolean isStreamActiveRemotely(int stream, int inPastMs);
/*
* Checks whether the specified audio source is active.
*
* return true if any recorder using this source is currently recording
*/
public static native boolean isSourceActive(int source);
/*
* Sets a group generic audio configuration parameters. The use of these parameters
* are platform dependent, see libaudio
*
* param keyValuePairs list of parameters key value pairs in the form:
* key1=value1;key2=value2;...
*/
public static native int setParameters(String keyValuePairs);
/*
* Gets a group generic audio configuration parameters. The use of these parameters
* are platform dependent, see libaudio
*
* param keys list of parameters
* return value: list of parameters key value pairs in the form:
* key1=value1;key2=value2;...
*/
public static native String getParameters(String keys);
// These match the enum AudioError in frameworks/base/core/jni/android_media_AudioSystem.cpp
/* Command sucessful or Media server restarted. see ErrorCallback */
public static final int AUDIO_STATUS_OK = 0;
/* Command failed or unspecified audio error. see ErrorCallback */
public static final int AUDIO_STATUS_ERROR = 1;
/* Media server died. see ErrorCallback */
public static final int AUDIO_STATUS_SERVER_DIED = 100;
private static ErrorCallback mErrorCallback;
/*
* Handles the audio error callback.
*/
public interface ErrorCallback
{
/*
* Callback for audio server errors.
* param error error code:
* - AUDIO_STATUS_OK
* - AUDIO_STATUS_SERVER_DIED
* - AUDIO_STATUS_ERROR
*/
void onError(int error);
};
/*
* Registers a callback to be invoked when an error occurs.
* @param cb the callback to run
*/
public static void setErrorCallback(ErrorCallback cb)
{
synchronized (AudioSystem.class) {
mErrorCallback = cb;
if (cb != null) {
cb.onError(checkAudioFlinger());
}
}
}
private static void errorCallbackFromNative(int error)
{
ErrorCallback errorCallback = null;
synchronized (AudioSystem.class) {
if (mErrorCallback != null) {
errorCallback = mErrorCallback;
}
}
if (errorCallback != null) {
errorCallback.onError(error);
}
}
/*
* AudioPolicyService methods
*/
//
// audio device definitions: must be kept in sync with values in system/core/audio.h
//
// reserved bits
public static final int DEVICE_BIT_IN = 0x80000000;
public static final int DEVICE_BIT_DEFAULT = 0x40000000;
// output devices, be sure to update AudioManager.java also
public static final int DEVICE_OUT_EARPIECE = 0x1;
public static final int DEVICE_OUT_SPEAKER = 0x2;
public static final int DEVICE_OUT_WIRED_HEADSET = 0x4;
public static final int DEVICE_OUT_WIRED_HEADPHONE = 0x8;
public static final int DEVICE_OUT_BLUETOOTH_SCO = 0x10;
public static final int DEVICE_OUT_BLUETOOTH_SCO_HEADSET = 0x20;
public static final int DEVICE_OUT_BLUETOOTH_SCO_CARKIT = 0x40;
public static final int DEVICE_OUT_BLUETOOTH_A2DP = 0x80;
public static final int DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = 0x100;
public static final int DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = 0x200;
public static final int DEVICE_OUT_AUX_DIGITAL = 0x400;
public static final int DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800;
public static final int DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000;
public static final int DEVICE_OUT_USB_ACCESSORY = 0x2000;
public static final int DEVICE_OUT_USB_DEVICE = 0x4000;
public static final int DEVICE_OUT_REMOTE_SUBMIX = 0x8000;
public static final int DEVICE_OUT_DEFAULT = DEVICE_BIT_DEFAULT;
public static final int DEVICE_OUT_ALL = (DEVICE_OUT_EARPIECE |
DEVICE_OUT_SPEAKER |
DEVICE_OUT_WIRED_HEADSET |
DEVICE_OUT_WIRED_HEADPHONE |
DEVICE_OUT_BLUETOOTH_SCO |
DEVICE_OUT_BLUETOOTH_SCO_HEADSET |
DEVICE_OUT_BLUETOOTH_SCO_CARKIT |
DEVICE_OUT_BLUETOOTH_A2DP |
DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER |
DEVICE_OUT_AUX_DIGITAL |
DEVICE_OUT_ANLG_DOCK_HEADSET |
DEVICE_OUT_DGTL_DOCK_HEADSET |
DEVICE_OUT_USB_ACCESSORY |
DEVICE_OUT_USB_DEVICE |
DEVICE_OUT_REMOTE_SUBMIX |
DEVICE_OUT_DEFAULT);
public static final int DEVICE_OUT_ALL_A2DP = (DEVICE_OUT_BLUETOOTH_A2DP |
DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER);
public static final int DEVICE_OUT_ALL_SCO = (DEVICE_OUT_BLUETOOTH_SCO |
DEVICE_OUT_BLUETOOTH_SCO_HEADSET |
DEVICE_OUT_BLUETOOTH_SCO_CARKIT);
public static final int DEVICE_OUT_ALL_USB = (DEVICE_OUT_USB_ACCESSORY |
DEVICE_OUT_USB_DEVICE);
// input devices
public static final int DEVICE_IN_COMMUNICATION = DEVICE_BIT_IN | 0x1;
public static final int DEVICE_IN_AMBIENT = DEVICE_BIT_IN | 0x2;
public static final int DEVICE_IN_BUILTIN_MIC = DEVICE_BIT_IN | 0x4;
public static final int DEVICE_IN_BLUETOOTH_SCO_HEADSET = DEVICE_BIT_IN | 0x8;
public static final int DEVICE_IN_WIRED_HEADSET = DEVICE_BIT_IN | 0x10;
public static final int DEVICE_IN_AUX_DIGITAL = DEVICE_BIT_IN | 0x20;
public static final int DEVICE_IN_VOICE_CALL = DEVICE_BIT_IN | 0x40;
public static final int DEVICE_IN_BACK_MIC = DEVICE_BIT_IN | 0x80;
public static final int DEVICE_IN_REMOTE_SUBMIX = DEVICE_BIT_IN | 0x100;
public static final int DEVICE_IN_ANLG_DOCK_HEADSET = DEVICE_BIT_IN | 0x200;
public static final int DEVICE_IN_DGTL_DOCK_HEADSET = DEVICE_BIT_IN | 0x400;
public static final int DEVICE_IN_USB_ACCESSORY = DEVICE_BIT_IN | 0x800;
public static final int DEVICE_IN_USB_DEVICE = DEVICE_BIT_IN | 0x1000;
public static final int DEVICE_IN_DEFAULT = DEVICE_BIT_IN | DEVICE_BIT_DEFAULT;
public static final int DEVICE_IN_ALL = (DEVICE_IN_COMMUNICATION |
DEVICE_IN_AMBIENT |
DEVICE_IN_BUILTIN_MIC |
DEVICE_IN_BLUETOOTH_SCO_HEADSET |
DEVICE_IN_WIRED_HEADSET |
DEVICE_IN_AUX_DIGITAL |
DEVICE_IN_VOICE_CALL |
DEVICE_IN_BACK_MIC |
DEVICE_IN_REMOTE_SUBMIX |
DEVICE_IN_ANLG_DOCK_HEADSET |
DEVICE_IN_DGTL_DOCK_HEADSET |
DEVICE_IN_USB_ACCESSORY |
DEVICE_IN_USB_DEVICE |
DEVICE_IN_DEFAULT);
public static final int DEVICE_IN_ALL_SCO = DEVICE_IN_BLUETOOTH_SCO_HEADSET;
// device states, must match AudioSystem::device_connection_state
public static final int DEVICE_STATE_UNAVAILABLE = 0;
public static final int DEVICE_STATE_AVAILABLE = 1;
private static final int NUM_DEVICE_STATES = 1;
public static final String DEVICE_OUT_EARPIECE_NAME = "earpiece";
public static final String DEVICE_OUT_SPEAKER_NAME = "speaker";
public static final String DEVICE_OUT_WIRED_HEADSET_NAME = "headset";
public static final String DEVICE_OUT_WIRED_HEADPHONE_NAME = "headphone";
public static final String DEVICE_OUT_BLUETOOTH_SCO_NAME = "bt_sco";
public static final String DEVICE_OUT_BLUETOOTH_SCO_HEADSET_NAME = "bt_sco_hs";
public static final String DEVICE_OUT_BLUETOOTH_SCO_CARKIT_NAME = "bt_sco_carkit";
public static final String DEVICE_OUT_BLUETOOTH_A2DP_NAME = "bt_a2dp";
public static final String DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES_NAME = "bt_a2dp_hp";
public static final String DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER_NAME = "bt_a2dp_spk";
public static final String DEVICE_OUT_AUX_DIGITAL_NAME = "aux_digital";
public static final String DEVICE_OUT_ANLG_DOCK_HEADSET_NAME = "analog_dock";
public static final String DEVICE_OUT_DGTL_DOCK_HEADSET_NAME = "digital_dock";
public static final String DEVICE_OUT_USB_ACCESSORY_NAME = "usb_accessory";
public static final String DEVICE_OUT_USB_DEVICE_NAME = "usb_device";
public static final String DEVICE_OUT_REMOTE_SUBMIX_NAME = "remote_submix";
public static String getDeviceName(int device)
{
switch(device) {
case DEVICE_OUT_EARPIECE:
return DEVICE_OUT_EARPIECE_NAME;
case DEVICE_OUT_SPEAKER:
return DEVICE_OUT_SPEAKER_NAME;
case DEVICE_OUT_WIRED_HEADSET:
return DEVICE_OUT_WIRED_HEADSET_NAME;
case DEVICE_OUT_WIRED_HEADPHONE:
return DEVICE_OUT_WIRED_HEADPHONE_NAME;
case DEVICE_OUT_BLUETOOTH_SCO:
return DEVICE_OUT_BLUETOOTH_SCO_NAME;
case DEVICE_OUT_BLUETOOTH_SCO_HEADSET:
return DEVICE_OUT_BLUETOOTH_SCO_HEADSET_NAME;
case DEVICE_OUT_BLUETOOTH_SCO_CARKIT:
return DEVICE_OUT_BLUETOOTH_SCO_CARKIT_NAME;
case DEVICE_OUT_BLUETOOTH_A2DP:
return DEVICE_OUT_BLUETOOTH_A2DP_NAME;
case DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES:
return DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES_NAME;
case DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER:
return DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER_NAME;
case DEVICE_OUT_AUX_DIGITAL:
return DEVICE_OUT_AUX_DIGITAL_NAME;
case DEVICE_OUT_ANLG_DOCK_HEADSET:
return DEVICE_OUT_ANLG_DOCK_HEADSET_NAME;
case DEVICE_OUT_DGTL_DOCK_HEADSET:
return DEVICE_OUT_DGTL_DOCK_HEADSET_NAME;
case DEVICE_OUT_USB_ACCESSORY:
return DEVICE_OUT_USB_ACCESSORY_NAME;
case DEVICE_OUT_USB_DEVICE:
return DEVICE_OUT_USB_DEVICE_NAME;
case DEVICE_OUT_REMOTE_SUBMIX:
return DEVICE_OUT_REMOTE_SUBMIX_NAME;
case DEVICE_OUT_DEFAULT:
default:
return "";
}
}
// phone state, match audio_mode???
public static final int PHONE_STATE_OFFCALL = 0;
public static final int PHONE_STATE_RINGING = 1;
public static final int PHONE_STATE_INCALL = 2;
// device categories config for setForceUse, must match AudioSystem::forced_config
public static final int FORCE_NONE = 0;
public static final int FORCE_SPEAKER = 1;
public static final int FORCE_HEADPHONES = 2;
public static final int FORCE_BT_SCO = 3;
public static final int FORCE_BT_A2DP = 4;
public static final int FORCE_WIRED_ACCESSORY = 5;
public static final int FORCE_BT_CAR_DOCK = 6;
public static final int FORCE_BT_DESK_DOCK = 7;
public static final int FORCE_ANALOG_DOCK = 8;
public static final int FORCE_DIGITAL_DOCK = 9;
public static final int FORCE_NO_BT_A2DP = 10;
public static final int FORCE_SYSTEM_ENFORCED = 11;
private static final int NUM_FORCE_CONFIG = 12;
public static final int FORCE_DEFAULT = FORCE_NONE;
// usage for setForceUse, must match AudioSystem::force_use
public static final int FOR_COMMUNICATION = 0;
public static final int FOR_MEDIA = 1;
public static final int FOR_RECORD = 2;
public static final int FOR_DOCK = 3;
public static final int FOR_SYSTEM = 4;
private static final int NUM_FORCE_USE = 5;
// usage for AudioRecord.startRecordingSync(), must match AudioSystem::sync_event_t
public static final int SYNC_EVENT_NONE = 0;
public static final int SYNC_EVENT_PRESENTATION_COMPLETE = 1;
public static native int setDeviceConnectionState(int device, int state, String device_address);
public static native int getDeviceConnectionState(int device, String device_address);
public static native int setPhoneState(int state);
public static native int setForceUse(int usage, int config);
public static native int getForceUse(int usage);
public static native int initStreamVolume(int stream, int indexMin, int indexMax);
public static native int setStreamVolumeIndex(int stream, int index, int device);
public static native int getStreamVolumeIndex(int stream, int device);
public static native int setMasterVolume(float value);
public static native float getMasterVolume();
public static native int setMasterMute(boolean mute);
public static native boolean getMasterMute();
public static native int getDevicesForStream(int stream);
// helpers for android.media.AudioManager.getProperty(), see description there for meaning
public static native int getPrimaryOutputSamplingRate();
public static native int getPrimaryOutputFrameCount();
public static native int getOutputLatency(int stream);
public static native int setLowRamDevice(boolean isLowRamDevice);
public static native int checkAudioFlinger();
}
| [
"karun.matharu@gmail.com"
] | karun.matharu@gmail.com |
bbc9a867822df8c8abb9473fb4167d00cba74ee8 | c929e65885ce5bb493d6f694532c1ac2906abfcf | /src/main/java/com/ciwei/mybatisplusgenerator/MybatisPlusGeneratorApplication.java | 39a092d62dd39a0796c6a36a1a79605a0ff354fe | [] | no_license | ciweigg2/mybatis-plus-generator | f3018be41e7c5832e5a3dfc4eea48295717f52ee | 2edcf199a588168d83e04f4451eee3f766902b7c | refs/heads/master | 2021-06-21T07:19:22.467756 | 2019-08-18T12:19:40 | 2019-08-18T12:19:40 | 202,997,522 | 0 | 0 | null | 2021-03-31T21:20:50 | 2019-08-18T12:00:51 | Java | UTF-8 | Java | false | false | 351 | java | package com.ciwei.mybatisplusgenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MybatisPlusGeneratorApplication {
public static void main(String[] args) {
SpringApplication.run(MybatisPlusGeneratorApplication.class, args);
}
}
| [
"1085160569@qq.com"
] | 1085160569@qq.com |
79dbbc90a14c918cef5adf917e7395c03f1a1b1e | b22a7c2056c6e5457111e5225509a99f1f4a26f9 | /ListView/app/src/main/java/org/cchmc/camo2j/listview/MainActivity.java | 6c10657f84a322b11eae384ef7e6d514da8e1730 | [] | no_license | Reggie86/AndroidStudioProjects | 4c37f7d30afe9940465824ed0ab9cbbbc45ccb6b | 9d6227ad57c6e395a5a5a29eba6fc6340a1721f2 | refs/heads/master | 2021-01-11T11:17:09.655155 | 2017-01-11T16:49:48 | 2017-01-11T16:49:48 | 78,657,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,468 | java | package org.cchmc.camo2j.listview;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ListView myListView = (ListView)findViewById(R.id.myListView);
final ArrayList<String> familyMembers = new ArrayList<String>();
familyMembers.add ("Dad");
familyMembers.add ("Mom");
familyMembers.add ("Grace");
familyMembers.add ("Haley");
//Another Method
//ArrayList<String> familyMembers = new ArrayList<String>(asList("Dad","Mom",Grace","Haley"));
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,familyMembers);
myListView.setAdapter(arrayAdapter);
myListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(getApplicationContext(), "Hello "+ familyMembers.get(position), Toast.LENGTH_LONG).show();
}
});
}
}
| [
"dcampbell@cchmc.org"
] | dcampbell@cchmc.org |
1f45c7ff8bc0e261b424310ed19a4e6889a561fa | b0161074c8843cbadf9037d91568387e2ca46f47 | /src/java/domain/EGender.java | ad7bc01b4cf579d5953ee25ebee8c0100ad04005 | [] | no_license | Tusifu/student-Registration | 874f7f18476ba929afb59a87d5fb8fd2bc19e5fe | 99519a1e4329a7fe94487e245f729ca4a388c5ae | refs/heads/master | 2020-09-28T09:25:02.142535 | 2019-12-08T23:31:18 | 2019-12-08T23:31:18 | 226,746,847 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | 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 domain;
/**
*
* @author Edison
*/
public enum EGender {
MALE,FEMALE;
}
| [
"tusifuedison@gmail.com"
] | tusifuedison@gmail.com |
a17b043cfc3f1ebacdd88ea8f604e33d9c3f544e | 9a21965d440506705c517cabe40dbb67244a6b73 | /xteacher/src/main/java/com/zjhz/teacher/NetworkRequests/retrofit/Model/LoginRespon.java | 6e5784349e81dda590d6a0a2eb32ed6789bf907a | [] | no_license | tianbaojun/XMvp | e6528041ee6fc43d79d004a4f8bff2d96477ff18 | ede7fbbec1f5d4134a2d97b4106b1ee98524c2be | refs/heads/master | 2021-01-15T08:13:56.469611 | 2017-08-18T08:52:43 | 2017-08-18T08:52:43 | 99,560,727 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,652 | java | package com.zjhz.teacher.NetworkRequests.retrofit.Model;
import com.zjhz.teacher.NetworkRequests.response.UserLogin;
import com.zjhz.teacher.bean.BaseModel;
import java.util.List;
/**
* Created by Administrator on 2017/8/16.
*/
public class LoginRespon extends BaseModel {
/**
* msg : 登录成功!
* code : 0
* total : 1
* data : {"imMark":"1","os":"APP","sources":[{"sourceType":"2"}],"TimeOut":14400,"nickName":"章银平","roles":[],"userId":"288078455667429377","phoneNo":"14957576283","token":"4df3f3df98ce815894430806d852dd72","photoUrl":"","loginTime":1502870176221,"teacherId":"288078455667429376","sourceType":"2","schoolId":"288069341826519040","schoolName":"杭州智鹏千校云","jobNumber":"18001"}
*/
private String msg;
private int code;
private int total;
private UserLogin data;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public UserLogin getData() {
return data;
}
public void setData(UserLogin data) {
this.data = data;
}
public static class DataBean {
/**
* imMark : 1
* os : APP
* sources : [{"sourceType":"2"}]
* TimeOut : 14400
* nickName : 章银平
* roles : []
* userId : 288078455667429377
* phoneNo : 14957576283
* token : 4df3f3df98ce815894430806d852dd72
* photoUrl :
* loginTime : 1502870176221
* teacherId : 288078455667429376
* sourceType : 2
* schoolId : 288069341826519040
* schoolName : 杭州智鹏千校云
* jobNumber : 18001
*/
private String imMark;
private String os;
private int TimeOut;
private String nickName;
private String userId;
private String phoneNo;
private String token;
private String photoUrl;
private long loginTime;
private String teacherId;
private String sourceType;
private String schoolId;
private String schoolName;
private String jobNumber;
private List<SourcesBean> sources;
private List<?> roles;
public String getImMark() {
return imMark;
}
public void setImMark(String imMark) {
this.imMark = imMark;
}
public String getOs() {
return os;
}
public void setOs(String os) {
this.os = os;
}
public int getTimeOut() {
return TimeOut;
}
public void setTimeOut(int TimeOut) {
this.TimeOut = TimeOut;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getPhoneNo() {
return phoneNo;
}
public void setPhoneNo(String phoneNo) {
this.phoneNo = phoneNo;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getPhotoUrl() {
return photoUrl;
}
public void setPhotoUrl(String photoUrl) {
this.photoUrl = photoUrl;
}
public long getLoginTime() {
return loginTime;
}
public void setLoginTime(long loginTime) {
this.loginTime = loginTime;
}
public String getTeacherId() {
return teacherId;
}
public void setTeacherId(String teacherId) {
this.teacherId = teacherId;
}
public String getSourceType() {
return sourceType;
}
public void setSourceType(String sourceType) {
this.sourceType = sourceType;
}
public String getSchoolId() {
return schoolId;
}
public void setSchoolId(String schoolId) {
this.schoolId = schoolId;
}
public String getSchoolName() {
return schoolName;
}
public void setSchoolName(String schoolName) {
this.schoolName = schoolName;
}
public String getJobNumber() {
return jobNumber;
}
public void setJobNumber(String jobNumber) {
this.jobNumber = jobNumber;
}
public List<SourcesBean> getSources() {
return sources;
}
public void setSources(List<SourcesBean> sources) {
this.sources = sources;
}
public List<?> getRoles() {
return roles;
}
public void setRoles(List<?> roles) {
this.roles = roles;
}
public static class SourcesBean {
/**
* sourceType : 2
*/
private String sourceType;
public String getSourceType() {
return sourceType;
}
public void setSourceType(String sourceType) {
this.sourceType = sourceType;
}
}
}
}
| [
"woabw@foxmail.com"
] | woabw@foxmail.com |
8013575ce897a65d4a9989e0b5c126a36f21e6d1 | a473a21aa063dfeec5cda7de10b7898ff5bd139a | /src/test/java/com/adv/qa/selenium/tests/currency/phase3/A110_Security_Range_ListsTest.java | 752edfe7f81d295366ecf56b54487dee79c9994d | [] | no_license | Chetna-Mishra/E5H5Automation | ffa5af4d94a947bdca17801e1ad01ca93d537fd1 | 9353e3c3597b05ba19b403321173ddf3863612d9 | refs/heads/master | 2020-05-20T21:17:46.167381 | 2017-04-06T04:14:51 | 2017-04-06T04:14:51 | 84,525,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,687 | java | package com.adv.qa.selenium.tests.currency.phase3;
import java.util.List;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import com.adv.qa.selenium.framework.Assert;
import com.adv.qa.selenium.framework.BaseTest;
import com.adv.qa.selenium.framework.pageObjects.LoginPage;
import com.adv.qa.selenium.framework.pageObjects.currency.CurrencyPageNew;
import com.adv.qa.selenium.helpers.DataResource;
import com.adv.qa.selenium.helpers.DataRow;
/**
* @author : Draxayani
* Test Reference No : A110 Security Range Lists
* Purpose : Security range Lists
* ACCESS : ADI
*/
public class A110_Security_Range_ListsTest extends BaseTest{
/*Launch the browser*/
@BeforeClass
public void beforeClass() throws Exception {
super.setUp();
}
@Test( dataProvider ="dp")
public void verify(DataRow dataRow) throws InterruptedException{
String userName = dataRow.get("userName");
String passWord = dataRow.get("passWord");
String currencyCode = dataRow.get("currencyCode");
List<String> securitRangeForItem = dataRow.findNamesReturnValues("securitRangeForItem");
List<String> securitRangeForStore = dataRow.findNamesReturnValues("securitRangeForStore");
/*Log in to application*/
LoginPage loginPage = new LoginPage(driver);
Assert.assertTrue(testcases, loginPage.isLoginPageDisplayed(), "Login page", "displayed");
loginPage.logIn(userName, passWord);
/*Navigate to currency page Home page e5 application*/
CurrencyPageNew currencyPage = new CurrencyPageNew(driver);
/*Verify command line*/
Assert.assertTrue(testcases,currencyPage.isCommandDisplayed(),"Command line","displayed");
createIMAccounts(currencyPage,securitRangeForItem,currencyCode);
createIMAccounts(currencyPage,securitRangeForStore,currencyCode);
currencyPage.logOut(1);
}
private void createIMAccounts(CurrencyPageNew currencyPage,List<String> elements,String currencyCode) throws InterruptedException{
String message = "The previously-requested action has been performed";
String code = "EDTADRCDE ACT=INSERT,COMPANY="+companyId;
currencyPage.isCommandDisplayed();
/*Verify command line*/
Assert.assertTrue(testcases,currencyPage.isCommandDisplayed(),"Command line","displayed");
currencyPage.fillCurrenceyCode(code);
/*Verify currency search page displayed*/
Assert.assertEquals(testcases,currencyPage.getTableHeader(), "M"+currencyCode+" - Range List Code Edit","Currency search page","displayed");
/*Create security range*/
currencyPage.insertSecurityRange(elements);
currencyPage.clickOnUpdate();
if(currencyPage.getToolContentText().contains(message)){
testcases.add(getCurreentDate()+" | Pass : Security range "+elements.get(0)+ " created");
}
else{
currencyPage.clickOnCancel();
testcases.add(getCurreentDate()+" | Fail : Security range "+elements.get(0)+ " created");
}
}
@AfterClass (alwaysRun = true)
public void tearDown(){
super.tearDown();
}
@DataProvider
public Object[][] dp()
{
String folder = "src/test/resources/";
String xmlFilePath = folder + "phase3.xml";
String[] nodeID = { "A110" };
String [] selectedNames = {"userName","passWord","currencyCode","securitRangeForItem","securitRangeForStore"};
DataResource dataResourceSelected = new DataResource (xmlFilePath, selectedNames, true,nodeID);
DataRow [] [] rows = dataResourceSelected.getDataRows4DataProvider();
return rows;
}
}
| [
"Chetna.Mishra@ChetnaM-PC.acs.acsresource.com"
] | Chetna.Mishra@ChetnaM-PC.acs.acsresource.com |
14737faf59fa63fc77f33f5ee54a09480887eeb4 | 690f3f008d94abf130c4005146010cd63cd71567 | /JavaTest/src/main/java/proxy/staticproxy/StaticProxy.java | 4383f6d587838ecae3fce36ec3fb29be99a40040 | [] | no_license | Oaks907/bookspace | 819b8ec87067f8e9776a8b79210c74d33673aec9 | 114a4fc43ed6134b4a236ccdffd30a9594b54796 | refs/heads/master | 2022-12-24T17:01:02.454129 | 2021-05-26T15:53:02 | 2021-05-26T15:53:02 | 143,092,798 | 0 | 0 | null | 2022-12-16T05:20:36 | 2018-08-01T02:19:53 | Java | UTF-8 | Java | false | false | 680 | java | package proxy.staticproxy;
import proxy.Iservice;
import proxy.RealService;
/**
* Create by haifei on 19/10/2018 4:09 PM.
* 静态代理
*/
public class StaticProxy implements Iservice{
private RealService realService;
public StaticProxy(RealService realService) {
this.realService = realService;
}
@Override
public void sayHello(String str) {
System.out.println("proxy: before say hello.");
realService.sayHello(str);
System.out.println("proxy: after say hello.");
}
public void doSomething() {
System.out.println("proxy:before do something.");
realService.doSomething();
System.out.println("proxy:after do something.");
}
}
| [
"haifei.li@renren-inc.com"
] | haifei.li@renren-inc.com |
deef1e2c6ef567a50e25b86c8c97d370056e69c5 | e7d78e7b3aa516f42cb42ca71ed923aad4980c9a | /src/by/bsu/samples/memento/GameStateBad1.java | 9aa995871a58a319478dfd0dd6343ad2c00950dc | [] | no_license | slavchoo/ExamPatternMemento | 3cca351039d3ff03a96a77d331435966541e75b5 | 071d83ec47dd0bd1e1d0a56a69e931088114278d | refs/heads/master | 2020-04-02T01:04:56.775709 | 2013-01-06T11:39:00 | 2013-01-06T11:39:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,092 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package by.bsu.samples.memento;
/**
*
* @author training
*/
//нарушение инкапсуляции
public class GameStateBad1 implements IDraw {
private Integer[][] cells;
private Integer moves;
public void setElement( Integer x, Integer y, Integer nmbr) {
cells[x][y] = nmbr;
}
public GameStateBad1( ) {
cells = new Integer[9][9];
moves = 0;
}
public void draw() {
for(int x = 0 ; x < 9 ; x++)
{
for(int y = 0 ; y < 9 ; y++)
System.out.print(cells[x][y].toString() + ' ');
System.out.print("\n");
}
}
public GameStateBadMemento getState( ) {
GameStateBadMemento res = new GameStateBadMemento( );
res.cells = this.cells;
return res;
}
public void setState( GameStateBadMemento istate) {
this.cells = istate.cells;
}
}
class GameStateBadMemento {
public Integer[][] cells;
public GameStateBadMemento( ){
cells = new Integer[9][9];
}
} | [
"slavchoo2@gmail.com"
] | slavchoo2@gmail.com |
ddb57a42dd41931fc5d1e1eef6e839f04e56f86a | d6540635e8a7c668a6a1e1073923fa50cf6e4712 | /src/main/java/org/hgz/thread/demo/HashMapDemo.java | 79bf640f2335747beb21fa61cc5e1c925948214a | [] | no_license | huang-gz/nettylearn | 50fe646daed3f8a74292b7956df2654b43a35389 | 9aaefc7517ff9c3d7caff41f26ea4a768366f0b7 | refs/heads/master | 2021-09-22T11:36:15.374720 | 2018-09-10T01:28:03 | 2018-09-10T01:28:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,212 | java | package org.hgz.thread.demo;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author huang_guozhong
* @Description
* @Copyright 2015 © anzhi.com
* @Created 2017/10/13 18:20
*/
public class HashMapDemo {
public static void main(String[] args) {
concurrentHashMapDemo ();
}
public static void hashMapDemo(){
HashMap<String, Object> map = new HashMap<String, Object> ();
int i = 0;
for(;;) {
map.put (++i + "", i + "");
}
}
public static void concurrentHashMapDemo(){
ConcurrentHashMap<String, Object> map = new ConcurrentHashMap<String, Object> ();
int i = 0;
for(;;) {
map.put (++i + "", i + "");
if(i == 100) {
break;
}
}
Object o = map.get ("10");
map.size ();
System.out.println (o);
}
public static void treeMapDemo(){
TreeMap<String, Object> map = new TreeMap<String, Object> ();
map.put ("1", new Object ());
}
public static void hashTableDemo(){
Hashtable<String, Object> hashtable = new Hashtable<String, Object> ();
hashtable.put ("key", "value");
hashtable.get ("key");
}
} | [
"huangguozhong@anzhi.com"
] | huangguozhong@anzhi.com |
b0e5eeb210ebc837b5d7f5b0081b79b65e17a567 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/28/28_bff0eba163ce6e5b3f45c901028fe0659bde0dcb/AutomaticDmsExportWithoutHibernate/28_bff0eba163ce6e5b3f45c901028fe0659bde0dcb_AutomaticDmsExportWithoutHibernate_s.java | 045e6b2d5c9a03b1b15d5011a2507eff6df0d5cd | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 16,485 | java | package de.sub.goobi.Export.dms;
/**
* This file is part of the Goobi Application - a Workflow tool for the support of mass digitization.
*
* Visit the websites for more information.
* - http://digiverso.com
* - http://www.intranda.com
*
* Copyright 2011, intranda GmbH, Göttingen
*
*
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions
* of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to
* link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and
* conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this
* library, you may extend this exception to your version of the library, but you are not obliged to do so. If you do not wish to do so, delete this
* exception statement from your version.
*/
import java.io.File;
import java.io.IOException;
import org.apache.log4j.Logger;
import ugh.dl.DocStruct;
import ugh.dl.Fileformat;
import ugh.dl.Metadata;
import ugh.exceptions.DocStructHasNoTypeException;
import ugh.exceptions.MetadataTypeNotAllowedException;
import ugh.exceptions.PreferencesException;
import ugh.exceptions.TypeNotAllowedForParentException;
import ugh.exceptions.WriteException;
import ugh.fileformats.excel.RDFFile;
import ugh.fileformats.mets.MetsModsImportExport;
import de.sub.goobi.Beans.Benutzer;
import de.sub.goobi.Export.download.ExportMetsWithoutHibernate;
import de.sub.goobi.Metadaten.MetadatenVerifizierungWithoutHibernate;
import de.sub.goobi.Persistence.apache.FolderInformation;
import de.sub.goobi.Persistence.apache.ProcessManager;
import de.sub.goobi.Persistence.apache.ProcessObject;
import de.sub.goobi.Persistence.apache.ProjectManager;
import de.sub.goobi.Persistence.apache.ProjectObject;
import de.sub.goobi.config.ConfigMain;
import de.sub.goobi.config.ConfigProjects;
import de.sub.goobi.helper.Helper;
import de.sub.goobi.helper.enums.MetadataFormat;
import de.sub.goobi.helper.exceptions.DAOException;
import de.sub.goobi.helper.exceptions.ExportFileException;
import de.sub.goobi.helper.exceptions.SwapException;
import de.sub.goobi.helper.exceptions.UghHelperException;
public class AutomaticDmsExportWithoutHibernate extends ExportMetsWithoutHibernate {
private static final Logger myLogger = Logger.getLogger(AutomaticDmsExportWithoutHibernate.class);
ConfigProjects cp;
private boolean exportWithImages = true;
private boolean exportFulltext = true;
private FolderInformation fi;
private ProjectObject project;
public final static String DIRECTORY_SUFFIX = "_tif";
public AutomaticDmsExportWithoutHibernate() {
}
public AutomaticDmsExportWithoutHibernate(boolean exportImages) {
this.exportWithImages = exportImages;
}
public void setExportFulltext(boolean exportFulltext) {
this.exportFulltext = exportFulltext;
}
/**
* DMS-Export an eine gewünschte Stelle
*
* @param myProzess
* @param zielVerzeichnis
* @throws InterruptedException
* @throws IOException
* @throws WriteException
* @throws PreferencesException
* @throws UghHelperException
* @throws ExportFileException
* @throws MetadataTypeNotAllowedException
* @throws DocStructHasNoTypeException
* @throws DAOException
* @throws SwapException
* @throws TypeNotAllowedForParentException
*/
@Override
public void startExport(ProcessObject process) throws DAOException, IOException, PreferencesException, WriteException, SwapException, TypeNotAllowedForParentException, InterruptedException {
this.myPrefs = ProcessManager.getRuleset(process.getRulesetId()).getPreferences();
this.project =ProjectManager.getProjectById(process.getProjekteID());
this.cp = new ConfigProjects(this.project.getTitel());
String atsPpnBand = process.getTitle();
/*
* -------------------------------- Dokument einlesen
* --------------------------------
*/
Fileformat gdzfile;
Fileformat newfile;
try {
this.fi = new FolderInformation(process.getId(), process.getTitle());
String metadataPath = this.fi.getMetadataFilePath();
gdzfile = process.readMetadataFile(metadataPath, this.myPrefs);
switch (MetadataFormat.findFileFormatsHelperByName(this.project.getFileFormatDmsExport())) {
case METS:
newfile = new MetsModsImportExport(this.myPrefs);
break;
case METS_AND_RDF:
newfile = new RDFFile(this.myPrefs);
break;
default:
newfile = new RDFFile(this.myPrefs);
break;
}
newfile.setDigitalDocument(gdzfile.getDigitalDocument());
gdzfile = newfile;
} catch (Exception e) {
Helper.setFehlerMeldung(Helper.getTranslation("exportError") + process.getTitle(), e);
myLogger.error("Export abgebrochen, xml-LeseFehler", e);
return;
}
trimAllMetadata(gdzfile.getDigitalDocument().getLogicalDocStruct());
/*
* -------------------------------- Metadaten validieren
* --------------------------------
*/
if (ConfigMain.getBooleanParameter("useMetadatenvalidierung")) {
MetadatenVerifizierungWithoutHibernate mv = new MetadatenVerifizierungWithoutHibernate();
if (!mv.validate(gdzfile, this.myPrefs, process.getId(), process.getTitle())) {
throw new InterruptedException("invalid data");
}
}
/*
* -------------------------------- Speicherort vorbereiten und
* downloaden --------------------------------
*/
String zielVerzeichnis;
File benutzerHome;
zielVerzeichnis = this.project.getDmsImportImagesPath();
benutzerHome = new File(zielVerzeichnis);
/* ggf. noch einen Vorgangsordner anlegen */
if (this.project.isDmsImportCreateProcessFolder()) {
benutzerHome = new File(benutzerHome + File.separator + process.getTitle());
zielVerzeichnis = benutzerHome.getAbsolutePath();
/* alte Import-Ordner löschen */
if (!Helper.deleteDir(benutzerHome)) {
Helper.setFehlerMeldung("Export canceled, Process: " + process.getTitle(), "Import folder could not be cleared");
return;
}
/* alte Success-Ordner löschen */
File successFile = new File(this.project.getDmsImportSuccessPath() + File.separator + process.getTitle());
if (!Helper.deleteDir(successFile)) {
Helper.setFehlerMeldung("Export canceled, Process: " + process.getTitle(), "Success folder could not be cleared");
return;
}
/* alte Error-Ordner löschen */
File errorfile = new File(this.project.getDmsImportErrorPath() + File.separator + process.getTitle());
if (!Helper.deleteDir(errorfile)) {
Helper.setFehlerMeldung("Export canceled, Process: " + process.getTitle(), "Error folder could not be cleared");
return;
}
if (!benutzerHome.exists()) {
benutzerHome.mkdir();
}
}
/*
* -------------------------------- der eigentliche Download der Images
* --------------------------------
*/
try {
if (this.exportWithImages) {
imageDownload(process, benutzerHome, atsPpnBand, DIRECTORY_SUFFIX);
fulltextDownload(process, benutzerHome, atsPpnBand, DIRECTORY_SUFFIX);
} else if (this.exportFulltext) {
fulltextDownload(process, benutzerHome, atsPpnBand, DIRECTORY_SUFFIX);
}
} catch (Exception e) {
Helper.setFehlerMeldung("Export canceled, Process: " + process.getTitle(), e);
return;
}
/*
* -------------------------------- zum Schluss Datei an gewünschten Ort
* exportieren entweder direkt in den Import-Ordner oder ins
* Benutzerhome anschliessend den Import-Thread starten
* --------------------------------
*/
if (this.project.isUseDmsImport()) {
if (MetadataFormat.findFileFormatsHelperByName(this.project.getFileFormatDmsExport()) == MetadataFormat.METS) {
/* Wenn METS, dann per writeMetsFile schreiben... */
writeMetsFile(process, benutzerHome + File.separator + atsPpnBand + ".xml", gdzfile, false);
} else {
/* ...wenn nicht, nur ein Fileformat schreiben. */
gdzfile.write(benutzerHome + File.separator + atsPpnBand + ".xml");
}
/* ggf. sollen im Export mets und rdf geschrieben werden */
if (MetadataFormat.findFileFormatsHelperByName(this.project.getFileFormatDmsExport()) == MetadataFormat.METS_AND_RDF) {
writeMetsFile(process, benutzerHome + File.separator + atsPpnBand + ".mets.xml", gdzfile, false);
}
Helper.setMeldung(null, process.getTitle() + ": ", "DMS-Export started");
if (!ConfigMain.getBooleanParameter("exportWithoutTimeLimit")) {
/* Success-Ordner wieder löschen */
if (this.project.isDmsImportCreateProcessFolder()) {
File successFile = new File(this.project.getDmsImportSuccessPath() + File.separator + process.getTitle());
Helper.deleteDir(successFile);
}
}
// return ;
}
return;
}
/**
* run through all metadata and children of given docstruct to trim the
* strings calls itself recursively
*/
private void trimAllMetadata(DocStruct inStruct) {
/* trimm all metadata values */
if (inStruct.getAllMetadata() != null) {
for (Metadata md : inStruct.getAllMetadata()) {
if (md.getValue() != null) {
md.setValue(md.getValue().trim());
}
}
}
/* run through all children of docstruct */
if (inStruct.getAllChildren() != null) {
for (DocStruct child : inStruct.getAllChildren()) {
trimAllMetadata(child);
}
}
}
public void fulltextDownload(ProcessObject myProzess, File benutzerHome, String atsPpnBand, final String ordnerEndung) throws IOException,
InterruptedException, SwapException, DAOException {
// Helper help = new Helper();
// File tifOrdner = new File(myProzess.getImagesTifDirectory());
// download sources
File sources = new File(fi.getSourceDirectory());
if (sources.exists() && sources.list().length > 0) {
File destination = new File(benutzerHome + File.separator
+ atsPpnBand + "_src");
if (!destination.exists()) {
destination.mkdir();
}
File[] dateien = sources.listFiles();
for (int i = 0; i < dateien.length; i++) {
File meinZiel = new File(destination + File.separator
+ dateien[i].getName());
Helper.copyFile(dateien[i], meinZiel);
}
}
File ocr = new File(fi.getOcrDirectory());
if (ocr.exists()) {
File[] folder = ocr.listFiles();
for (File dir : folder) {
if (dir.isDirectory() && dir.list().length > 0) {
String suffix = dir.getName().substring(dir.getName().lastIndexOf("_"));
File destination = new File(benutzerHome + File.separator + atsPpnBand + "_" + suffix);
if (!destination.exists()) {
destination.mkdir();
}
File[] files = dir.listFiles();
for (int i = 0; i < files.length; i++) {
File target = new File(destination + File.separator + files[i].getName());
Helper.copyFile(files[i], target);
}
}
}
}
// File sources = new File(fi.getSourceDirectory());
// if (sources.exists()) {
// File destination = new File(benutzerHome + File.separator
// + atsPpnBand + "_src");
// if (!destination.exists()) {
// destination.mkdir();
// }
// File[] dateien = sources.listFiles();
// for (int i = 0; i < dateien.length; i++) {
// File meinZiel = new File(destination + File.separator
// + dateien[i].getName());
// Helper.copyFile(dateien[i], meinZiel);
// }
// }
//
//
// File txtFolder = new File(this.fi.getTxtDirectory());
// if (txtFolder.exists()) {
// File destination = new File(benutzerHome + File.separator + atsPpnBand + "_txt");
// if (!destination.exists()) {
// destination.mkdir();
// }
// File[] dateien = txtFolder.listFiles();
// for (int i = 0; i < dateien.length; i++) {
// File meinZiel = new File(destination + File.separator + dateien[i].getName());
// Helper.copyFile(dateien[i], meinZiel);
// }
// }
//
// File wordFolder = new File(this.fi.getWordDirectory());
// if (wordFolder.exists()) {
// File destination = new File(benutzerHome + File.separator + atsPpnBand + "_wc");
// if (!destination.exists()) {
// destination.mkdir();
// }
// File[] dateien = wordFolder.listFiles();
// for (int i = 0; i < dateien.length; i++) {
// File meinZiel = new File(destination + File.separator + dateien[i].getName());
// Helper.copyFile(dateien[i], meinZiel);
// }
// }
//
// File pdfFolder = new File(this.fi.getPdfDirectory());
// if (pdfFolder.exists()) {
// File destination = new File(benutzerHome + File.separator + atsPpnBand + "_pdf");
// if (!destination.exists()) {
// destination.mkdir();
// }
// File[] dateien = pdfFolder.listFiles();
// for (int i = 0; i < dateien.length; i++) {
// File meinZiel = new File(destination + File.separator + dateien[i].getName());
// Helper.copyFile(dateien[i], meinZiel);
// }
// }
}
public void imageDownload(ProcessObject myProzess, File benutzerHome, String atsPpnBand, final String ordnerEndung) throws IOException,
InterruptedException, SwapException, DAOException {
/*
* -------------------------------- erstmal alle Filter
* --------------------------------
*/
// FilenameFilter filterTifDateien = new FilenameFilter() {
// public boolean accept(File dir, String name) {
// return name.endsWith(".tif");
// }
// };
/*
* -------------------------------- dann den Ausgangspfad ermitteln
* --------------------------------
*/
Helper help = new Helper();
File tifOrdner = new File(this.fi.getImagesTifDirectory());
/*
* -------------------------------- jetzt die Ausgangsordner in die
* Zielordner kopieren --------------------------------
*/
if (tifOrdner.exists() && tifOrdner.list().length > 0) {
File zielTif = new File(benutzerHome + File.separator + atsPpnBand + ordnerEndung);
/* bei Agora-Import einfach den Ordner anlegen */
if (this.project.isUseDmsImport()) {
if (!zielTif.exists()) {
zielTif.mkdir();
}
} else {
/*
* wenn kein Agora-Import, dann den Ordner mit
* Benutzerberechtigung neu anlegen
*/
Benutzer myBenutzer = (Benutzer) Helper.getManagedBeanValue("#{LoginForm.myBenutzer}");
try {
help.createUserDirectory(zielTif.getAbsolutePath(), myBenutzer.getLogin());
} catch (Exception e) {
Helper.setFehlerMeldung("Export canceled, error", "could not create destination directory");
myLogger.error("could not create destination directory", e);
}
}
/* jetzt den eigentlichen Kopiervorgang */
File[] dateien = tifOrdner.listFiles(Helper.dataFilter);
for (int i = 0; i < dateien.length; i++) {
File meinZiel = new File(zielTif + File.separator + dateien[i].getName());
Helper.copyFile(dateien[i], meinZiel);
}
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
74e29ff75243d48f3ce1869d600f31cbf5ba00a7 | 2e909a25d9e74ea9e8c7656f0602e6a19940c553 | /src/main/java/cps/lab/gui/menu/TransformMenuItem.java | 8e0fc01c0955bd1ec3a29515883d181ca2e1ba2d | [] | no_license | himanshusn/digital-signal-processing | 04f3603bd2246483805b54bc612624760fb5c3b2 | fc5e237de169a927e5df9feae1d7a83c013e6211 | refs/heads/master | 2021-05-28T06:02:02.671550 | 2014-01-08T16:54:00 | 2014-01-08T16:54:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 561 | java | package cps.lab.gui.menu;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JMenuItem;
import cps.lab.gui.windows.TransformWindow;
public class TransformMenuItem extends JMenuItem implements ActionListener {
TransformWindow transformWindow;
public TransformMenuItem(String text) {
super(text);
this.transformWindow = new TransformWindow();
this.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent e) {
transformWindow.setVisible(true);
}
}
| [
"maciekdeb@gmail.com"
] | maciekdeb@gmail.com |
29dc8071b2bbd61f911c7533f7b7ae9067f856b6 | ca353d63ab2a7e1c4f51097268de3086f34c9ed3 | /src/main/java/DAO/criterias/PurchaseCriteria.java | 70c744b578cae0915de4ac3cfcbd8cc5a650a836 | [] | no_license | ginvaell/PalashkaTravel | 6992333d98d32df6b331c4b7a68fbf45241da4ee | 1ab88f78a28d93d4a54644bbea2c91abf480a066 | refs/heads/master | 2021-01-10T11:23:36.087732 | 2015-11-23T17:42:55 | 2015-11-23T17:42:55 | 45,853,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,517 | java | package DAO.criterias;
import DAO.Criteria;
public abstract class PurchaseCriteria implements Criteria{
private String id;
private String userId;
private String tour;
private String tourId;
private String countOver;
private String countUnder;
private String priceOver;
private String priceUnder;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getTour() {
return tour;
}
public void setTour(String tour) {
this.tour = tour;
}
public String getTourId() {
return tourId;
}
public void setTourId(String tourId) {
this.tourId = tourId;
}
public String getCountOver() {
return countOver;
}
public void setCountOver(String countOver) {
this.countOver = countOver;
}
public String getCountUnder() {
return countUnder;
}
public void setCountUnder(String countUnder) {
this.countUnder = countUnder;
}
public String getPriceOver() {
return priceOver;
}
public void setPriceOver(String priceOver) {
this.priceOver = priceOver;
}
public String getPriceUnder() {
return priceUnder;
}
public void setPriceUnder(String priceUnder) {
this.priceUnder = priceUnder;
}
}
| [
"ginvaell@gmail.com"
] | ginvaell@gmail.com |
92b2dd5a484847fca2f266ff6f9af671331429f9 | bcfa76559e2811e65a3aebf145106eb08f54407a | /aether-api/src/main/java/org/sonatype/aether/collection/UnsolvableVersionConflictException.java | 6c04e1072695a60ffc5f2732c258769ad11ae288 | [] | no_license | cstamas/sonatype-aether | 2cd8b073dfc452e58ee31c32cd4b720064cf0c09 | 138e51b4fabab985304a40289dba73fe218016cd | refs/heads/master | 2021-01-17T23:13:27.619529 | 2010-09-22T16:03:39 | 2010-09-22T16:03:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,687 | java | package org.sonatype.aether.collection;
/*
* Copyright (c) 2010 Sonatype, Inc. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the Apache License Version 2.0 is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
*/
import java.util.Collection;
import java.util.Collections;
import org.sonatype.aether.RepositoryException;
/**
* @author Benjamin Bentmann
*/
public class UnsolvableVersionConflictException
extends RepositoryException
{
private final Object dependencyConflictId;
private final Collection<String> versions;
public UnsolvableVersionConflictException( Object dependencyConflictId, Collection<String> versions )
{
super( "Could not resolve version conflict for " + dependencyConflictId + " with requested versions: "
+ versions );
this.dependencyConflictId = ( dependencyConflictId != null ) ? dependencyConflictId : "";
this.versions = ( versions != null ) ? versions : Collections.<String> emptyList();
}
public Object getDependencyConflictId()
{
return dependencyConflictId;
}
public Collection<String> getVersions()
{
return versions;
}
}
| [
"benjamin.bentmann@udo.edu"
] | benjamin.bentmann@udo.edu |
407330d88f2eaafe75a835dd7ec5e6322bb95ee8 | 1319c04fbb9f4eb24c5baee7dd0e96e8319eb441 | /src/main/java/com/letme/Utility/Mapper.java | ce3854c222aae82c2f6658a410c6a94092c5e470 | [] | no_license | rayedbajwa/freelanceApi | 61d08788d260dd136a4a0686fabdfdd1686a43d2 | 3ce377d3c37597d112b7c367a227739fabc7a8e6 | refs/heads/master | 2021-04-29T10:26:22.698197 | 2017-01-04T15:04:03 | 2017-01-04T15:04:03 | 77,642,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,428 | java | package com.letme.Utility;
/**
* Created by mbajwa11 on 1/3/17.
*/
import com.letme.Tasks.controller.TasksController;
import com.letme.Tasks.entity.Tasks;
import org.slf4j.LoggerFactory;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.logging.Logger;
/**
* Utility class for converting JSON to Entities
*/
public class Mapper{
private Tasks finalObj;
SimpleDateFormat formatter = new SimpleDateFormat("MM-dd-yyyy");
private static final org.slf4j.Logger log = LoggerFactory.getLogger(Mapper.class);
public Tasks convertJsontoTask(HashMap<String, String> temp)throws
IllegalAccessException,
IllegalArgumentException, ParseException{
finalObj = new Tasks(
temp.get("name"),
Integer.parseInt(temp.get("type_id")),
temp.get("desc"),
formatter.parse(temp.get("created_date")),
formatter.parse(temp.get("expire_date")),
Integer.parseInt(temp.get("budget")),
temp.get("street_add"),
Integer.parseInt(temp.get("city_id")),
Integer.parseInt(temp.get("country_id")),
Integer.parseInt(temp.get("zip")),
Integer.parseInt(temp.get("status")),
Boolean.parseBoolean(temp.get("active"))
);
return finalObj;
}
}
| [
"muhammadrayed_bajwa@optum.com"
] | muhammadrayed_bajwa@optum.com |
e6c9afa927ca05a42b4bf1789e9bbb12a73fbfd8 | 4ff8c09e32db1a5721039da74b93e51ee9e56008 | /src/main/java/com/n26/code/dto/TransactionRequestDTO.java | 2a482a3158c3fc697e4321f6761a1d44a097b376 | [] | no_license | waqas80/n26code | b1a4776b8d7e297973d7f7f9806a5c94ee7d8d6a | 6b65e2445f425d91be95352c2db16b70095de263 | refs/heads/master | 2020-03-18T19:33:35.937347 | 2018-05-28T13:04:55 | 2018-05-28T13:04:55 | 134,550,321 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 826 | java | package com.n26.code.dto;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonAutoDetect(fieldVisibility= Visibility.ANY, getterVisibility=Visibility.NONE, setterVisibility= Visibility.NONE)
@JsonPropertyOrder({
"amount",
"timestamp"
})
public class TransactionRequestDTO {
@JsonProperty("amount")
protected double amount;
@JsonProperty("timestamp")
protected long timestamp;
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
}
| [
"waqas80@Waqass-MacBook-Pro.local"
] | waqas80@Waqass-MacBook-Pro.local |
65f1d1402a090928cd1a1dd77a3086852849b3f8 | 2a983ca82d81f9a4f31b3fa71f5b236d13194009 | /instrument-modules/user-modules/module-log-data-pusher/src/main/java/com/shulie/instrument/module/log/data/pusher/push/DataPusher.java | 93733135d83ae4a9da3f0da0421eae1a76f6aead | [
"Apache-2.0"
] | permissive | hengyu-coder/LinkAgent-1 | 74ea4dcf51a0a05f2bb0ff22b309f02f8bf0a1a1 | 137ddf2aab5e91b17ba309a83d5420f839ff4b19 | refs/heads/main | 2023-06-25T17:28:44.903484 | 2021-07-28T03:41:20 | 2021-07-28T03:41:20 | 382,327,899 | 0 | 0 | Apache-2.0 | 2021-07-02T11:39:46 | 2021-07-02T11:39:46 | null | UTF-8 | Java | false | false | 1,604 | java | /**
* Copyright 2021 Shulie Technology, Co.Ltd
* Email: shulie@shulie.io
* 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,
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.shulie.instrument.module.log.data.pusher.push;
import com.shulie.instrument.module.log.data.pusher.log.callback.LogCallback;
import com.shulie.instrument.module.log.data.pusher.server.ServerAddrProvider;
/**
* 数据推送者
*
* @author xiaobin.zfb
* @since 2020/8/6 10:35 下午
*/
public interface DataPusher {
/**
* 名称
*
* @return 名称
*/
String getName();
/**
* 设置地址提供者
*
* @param provider 服务地址提供者
*/
void setServerAddrProvider(ServerAddrProvider provider);
/**
* 初始化
*
* @param serverOptions 启动参数
* @return 初始化是否成功
*/
boolean init(ServerOptions serverOptions);
/**
* 获取日志变更时的回调函数的一个实现实例
*
* @return 日志处理Callback
*/
LogCallback buildLogCallback();
/**
* 启动
*
* @return 返回启动是否成功
*/
boolean start();
/**
* 停止
*/
void stop();
}
| [
"jirenhe@shulie.io"
] | jirenhe@shulie.io |
80d6601f4d8b2b0baf2ef9685133c79b0f6c1b7e | 950f73f7b17153a2a4ac14594b1c5215bd8db6dc | /src/main/GamePanel.java | 4ca638d54a95853edbbc992b339a40255e790110 | [] | no_license | candy-e/Blood_Cross | 8df949d0ea5848610598b669ef893f12cf6b7cea | 5f0832169f49d85f44ddfba02257e6d5c58aafaf | refs/heads/master | 2021-01-13T03:09:48.567364 | 2016-12-24T11:35:50 | 2016-12-24T11:35:50 | 77,434,263 | 0 | 0 | null | 2016-12-27T07:13:33 | 2016-12-27T07:13:33 | null | UTF-8 | Java | false | false | 2,529 | java | package main;
import game_state.core.GameStateManager;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;
public class GamePanel extends JPanel implements Runnable, KeyListener{
private static final long serialVersionUID = 1L;
public static final int SCALE = 1;
public static final int WIDTH = 320;
public static final int HEIGHT = 240;
//game thread
private Thread thread;
private boolean isRunning;
private static final int FPS = 60;
private static final int TARGET_TIME = 1000/FPS;
private int width;
private int height;
private BufferedImage image;
private Graphics2D g;
//Game State Manager
private GameStateManager gsm;
//constructor
public GamePanel(int width, int height){
super();
this.width = width;
this.height = height;
this.setPreferredSize(new Dimension(width*SCALE, height*SCALE));
this.setFocusable(true);
this.requestFocus();
}
//Methods
private void init(){
this.image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
this.g = (Graphics2D) this.image.getGraphics();
this.isRunning = true;
this.gsm = new GameStateManager();
}
public void addNotify(){
super.addNotify();
if(this.thread == null){
this.thread = new Thread(this);
this.addKeyListener(this);
this.thread.start();
}
}
private void update(){
this.gsm.update();
}
private void draw(){
this.gsm.draw(this.g);
}
private void drawToScreen(){
Graphics g = getGraphics();
g.drawImage(image, 0, 0, width*SCALE, height*SCALE, null);
g.dispose();
}
//Methods for Runnable
@Override
public void run() {
this.init();
long start;
long elapsed;
long wait;
//game loop
while(this.isRunning){
start = System.nanoTime();
this.update();
this.draw();
this.drawToScreen();
elapsed = System.nanoTime() - start;
wait = TARGET_TIME - elapsed / 1000000;
if(wait < 0)
wait = 10;
try {
Thread.sleep(wait);
} catch (Exception e) {
e.printStackTrace();
}
}
}
//Methods for KeyListener
@Override
public void keyPressed(KeyEvent e) {
this.gsm.keyPressed(e.getKeyCode());
}
@Override
public void keyReleased(KeyEvent e) {
this.gsm.keyReleased(e.getKeyCode());
}
@Override
public void keyTyped(KeyEvent e) {
}
}
| [
"neilromblon@live.com"
] | neilromblon@live.com |
728696a3684bc61397aebfaafd43f43f94a13c52 | 7fe96ff16066e922bc99621d0cc80e51cfdc1cce | /javasrc/ch02_2/ex2_2_14.java | 561ae0fddd0062f01b9e48d9b04e9e678d94cac3 | [] | no_license | Vagacoder/Algorithms4E | a0948644eebbab7eaecb8224caaad0d23bfc54e9 | eeb3ec913c3ba5c1e9ea8c432c0a1fc82f9cdc49 | refs/heads/master | 2021-08-03T01:30:59.402846 | 2021-07-25T06:46:42 | 2021-07-25T06:46:42 | 219,931,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,306 | java | package javasrc.ch02_2;
/*
* 2.2.14 Merging sorted queues.
Develop a static method that takes two queues of sorted items as arguments and
returns a queue that results from merging the queues into sorted order.
*/
import javasrc.ch01_3.LinkedListQueue;
public class ex2_2_14{
public static void main(String[] args){
LinkedListQueue<Integer> q1 = new LinkedListQueue<>();
LinkedListQueue<Integer> q2 = new LinkedListQueue<>();
q1.enqueue(1);
q1.enqueue(5);
q1.enqueue(19);
q1.enqueue(27);
q1.enqueue(33);
q2.enqueue(8);
q2.enqueue(10);
q2.enqueue(12);
q2.enqueue(36);
q2.enqueue(49);
LinkedListQueue<Integer> result = new LinkedListQueue<>();
while(!q1.isEmpty() || !q2.isEmpty()){
if(q1.isEmpty()){
result.enqueue(q2.dequeue());
} else if (q2.isEmpty()){
result.enqueue(q1.dequeue());
} else {
int temp1 = q1.peekTop();
int temp2 = q2.peekTop();
if(temp1 < temp2){
result.enqueue(q1.dequeue());
} else {
result.enqueue(q2.dequeue());
}
}
}
result.print();
}
} | [
"qiruihu@gmail.com"
] | qiruihu@gmail.com |
07445dccdaff254612b7bfede9ec4f585b57c6f5 | 029cf03d459e7492be9380dd4e53c8436c8594a8 | /mandate-domain/src/main/java/com/ote/mandate/business/command/model/DefineMainHeirCommand.java | 403f669ee8542c506ddee5f2416d65c7374d2ffc | [] | no_license | oterrien-CQRS/contract-service | f041e058a2ef8954b44cacc64c2b75c849b30b05 | 198d993317d102630ea9c9864cc8ad76e0c11e61 | refs/heads/master | 2020-04-13T21:08:58.892610 | 2019-01-10T22:03:30 | 2019-01-10T22:03:30 | 163,448,947 | 1 | 0 | null | 2019-01-10T20:19:01 | 2018-12-28T20:58:06 | Java | UTF-8 | Java | false | false | 502 | java | package com.ote.mandate.business.command.model;
import com.ote.mandate.business.aggregate.Heir;
import lombok.Getter;
import lombok.ToString;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
@Getter
@ToString(callSuper = true)
public class DefineMainHeirCommand extends BaseMandateCommand {
@NotNull
@Valid
private final Heir mainHeir;
public DefineMainHeirCommand(String id, Heir mainHeir) {
super(id);
this.mainHeir = mainHeir;
}
}
| [
"oterrien@neuf.fr"
] | oterrien@neuf.fr |
6c57bebc94326ca4ff9ccf77cd5f5e719fabf11c | 1273468fd71ad2f27f2f1a26dfdaa5f97af314c8 | /src/test/java/org/launchcode/TechjobsApplicationTests 2.java | fc908eba3700a7ce594078017c31a749f407df3f | [] | no_license | NoviceWare/techjobs-oo | ade270407558705ad7bb400bc5446094737536a7 | 2b5e5c28265a6985327cf460453db5dc383dfc0a | refs/heads/master | 2020-06-04T09:47:21.446591 | 2019-06-24T20:10:21 | 2019-06-24T20:10:21 | 191,973,646 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package org.launchcode;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class TechjobsApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"pdu@noviceware.com"
] | pdu@noviceware.com |
c24c0fc7b1d8f62643fbe0507efa728cf28dc3f8 | f43b98b96fe68e38f1a4cda4fd865c44b4d3f7d0 | /src/main/java/com/valerijovich/customerdemo/CustomerDemoApplication.java | f01c6bd64aa6cd6fbab70603e9cce3f7ae326222 | [] | no_license | valerijovich/CustomerDemo | 498ac4f099c4ca1c64ec13c383581624fb2a383e | ec8efd89350994797152dc61205104703ad1f5d1 | refs/heads/master | 2023-06-24T08:35:53.184912 | 2021-07-12T13:08:16 | 2021-07-12T13:08:16 | 385,251,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package com.valerijovich.customerdemo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CustomerDemoApplication {
public static void main(String[] args) {
SpringApplication.run(CustomerDemoApplication.class, args);
}
}
| [
"paulvalerijovich@gmail.com"
] | paulvalerijovich@gmail.com |
412b7b9c617392a77924ffdc8edae6641282a3f5 | 55179e4dfc63f4ef0f4552979b8b91de34ab8ff4 | /src/main/java/ibeeproject/model/zona/Severidad.java | ca35e2ee4ecf9cf53db3d1b0aca9bddd33564858 | [] | no_license | ezilocchi/ibeeproject | da032b5a11b94003810dd2b3908c952dadfb3542 | 182c1d58c47192c48f30932615d4c560e3f3c7e0 | refs/heads/master | 2021-01-10T19:00:37.044742 | 2014-06-13T20:17:31 | 2014-06-13T20:17:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 256 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ibeeproject.model.zona;
/**
*
* @author Fede
*/
public class Severidad {
private String demonimacion;
private String descripcion;
}
| [
"ezilocchi@gmail.com"
] | ezilocchi@gmail.com |
115c0b114b9ff28d00d9046966adfb04c7a2b833 | dbc9aa7693df8e7e142218b45b8e23931e7367c7 | /src/chapter13/BetterRead.java | 3fe0d036661b484fc51022fc7f22b610aef30fee | [] | no_license | xiaweizi/ThinkingInJavaDemo | 1fdb98b756dc0fa3c152b984429b9e57645b5837 | 14dc4dc14207cce062caf7042f9685381e0429e6 | refs/heads/master | 2021-04-27T03:21:12.508205 | 2018-05-07T06:09:23 | 2018-05-07T06:09:23 | 122,712,564 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,204 | java | package chapter13;
import java.util.Scanner;
/**
* <pre>
* author : xiaweizi
* class : chapter13.BetterRead
* e-mail : 1012126908@qq.com
* time : 2018/04/15
* desc :
* </pre>
*/
public class BetterRead {
public static void main(String[] args) {
// Scanner 可以接受任何类型的 Readable 输入对象
Scanner stdin = new Scanner(SimpleRead.input);
System.out.println("What is your name?");
// 所有的输入,分词以及翻译的操作都隐藏在不同类型的 next 方法 中.
String name = stdin.nextLine(); // nextLine() 返回 String
System.out.println(name);
System.out.println("How old are you? What is your favorite double?");
System.out.println("(input: <age> <double>)");
// Scanner 直接读入 integer 和 double 类型数据
int age = stdin.nextInt();
double favorite = stdin.nextDouble();
System.out.println(age);
System.out.println(favorite);
System.out.format("Hi %s.\n", name);
System.out.format("In 5 years you will be %d.\n", age + 5);
System.out.format("My favorite double is %f.", favorite / 2);
}
} | [
"1012126908@qq.com"
] | 1012126908@qq.com |
d99cf16b9f231d23173aabf2cdb92ef56bb06fe3 | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/javax_swing_event_InternalFrameAdapter_wait_long_int.java | 1f60b0d155560521e3f4d9501def58210b58eb3f | [] | 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 | 224 | java | class javax_swing_event_InternalFrameAdapter_wait_long_int{ public static void function() {javax.swing.event.InternalFrameAdapter obj = new javax.swing.event.InternalFrameAdapter();obj.wait(-7942315492414729150,705623977);}} | [
"peter2008.ok@163.com"
] | peter2008.ok@163.com |
6dfe50a73367662f45a5cb01f2a5946f31da9794 | 0ae67a9702a7a70ab6449b42c4900a403336292b | /Direction.java | abc8372ea5a153c8faf7c81f11505057e0780c8d | [] | no_license | xoxo-Martyna/PIO_Project | e8de8faabff7711ccc6563f8d2b244abfd8a8b40 | e8d35227da5db13173d4e726cc46b626eee35b23 | refs/heads/master | 2021-07-08T03:08:25.289953 | 2021-05-25T14:01:53 | 2021-05-25T14:01:53 | 244,401,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 430 | java | public class Direction {
private double x;
private double y;
public Direction( double x, double y ){
this.x = x;
this.y = y;
}
public double getX(){
return x;
}
public double getY(){
return y;
}
public boolean isHorizontal(){
double x = this.x < 0 ? -1*this.x: this.x;
double y = this.y < 0 ? -1*this.y: this.y;
return x >= y;
}
} | [
"hubert.nakielski@gmail.com"
] | hubert.nakielski@gmail.com |
591a4066e1c315f501724b3de37c403c56acf573 | f6726b9a941b642d7887e52aa82b0d0b868eec91 | /StylistPark/SP/src/main/java/com/spshop/stylistpark/widgets/stikkyheader/StikkyHeader.java | ec072fd64394171c447fbaf9ba0feb2cc91e06e9 | [] | no_license | spmoblie/sp_app | 67b088e0df056ec91cff95acf9e6d231784c6f66 | ee85f3c6a28eb0682c9f61a67782a84d44be96fc | refs/heads/master | 2020-04-16T02:09:51.785827 | 2020-04-09T02:52:09 | 2020-04-09T02:52:09 | 60,585,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,248 | java | package com.spshop.stylistpark.widgets.stikkyheader;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
public abstract class StikkyHeader {
protected Context mContext;
protected View mHeader;
protected int mMinHeightHeader;
protected HeaderAnimator mHeaderAnimator;
protected int mHeightHeader;
protected int mMaxHeaderTransaction;
protected View mFakeHeader;
protected void measureHeaderHeight() {
int height = mHeader.getHeight();
if (height == 0) {
//waiting for the height
mHeader.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@SuppressWarnings("deprecation")
@Override
public void onGlobalLayout() {
int height = mHeader.getHeight();
if (height > 0) {
mHeader.getViewTreeObserver().removeGlobalOnLayoutListener(this);
setHeightHeader(height);
}
}
});
} else {
setHeightHeader(height);
}
}
public void setHeightHeader(final int heightHeader) {
mHeightHeader = heightHeader;
// some implementations dont use a fake header
if (mFakeHeader != null) {
ViewGroup.LayoutParams lpFakeHeader = mFakeHeader.getLayoutParams();
lpFakeHeader.height = mHeightHeader;
mFakeHeader.setLayoutParams(lpFakeHeader);
}
ViewGroup.LayoutParams lpHeader = mHeader.getLayoutParams();
lpHeader.height = mHeightHeader;
mHeader.setLayoutParams(lpHeader);
calculateMaxTransaction();
setupAnimator(); // update heights
}
private void calculateMaxTransaction() {
mMaxHeaderTransaction = mMinHeightHeader - mHeightHeader;
}
protected void setupAnimator() {
mHeaderAnimator.setupAnimator(mHeader, mMinHeightHeader, mHeightHeader, mMaxHeaderTransaction);
}
public void setMinHeightHeader(int minHeightHeader) {
this.mMinHeightHeader = minHeightHeader;
calculateMaxTransaction();
}
}
| [
"136736673@qq.com"
] | 136736673@qq.com |
a0bd665b0dc25909f824ca981fbf937d613b75a1 | 558cc3898cc537451bf533b6e0bc3541aebe4b5a | /app/src/main/java/com/eli/convertlink/MusicTrack.java | 90515019966f6f542b3c12eb0346968161261fd1 | [] | no_license | esudaley/convert_link | 321e65921a66480a86a3d0c057aa163497e23f69 | 647593884e4b8b07a23194f70dc38a89b17a436a | refs/heads/main | 2023-07-08T17:48:31.021838 | 2021-08-11T17:09:59 | 2021-08-11T17:09:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 920 | java | package com.eli.convertlink;
import android.graphics.Bitmap;
import kaaes.spotify.webapi.android.models.Track;
public class MusicTrack {
private String trackName, artist, imageUrl;
private Bitmap bitmap;
private String url;
public MusicTrack(Track track) {
this.trackName = track.name;
this.artist = track.artists.get(0).name;
this.imageUrl = track.album.images.get(0).url;
this.url = track.external_urls.get("spotify");
}
public String getTrackName() {
return trackName;
}
public String getArtist() {
return artist;
}
public String getImageUrl() {
return imageUrl;
}
public void setBitmap(Bitmap image) {
this.bitmap = image;
}
public Bitmap getBitmap() {
return bitmap;
}
public void setUrl(String url) { this.url = url; }
public String getUrl() { return url; }
}
| [
"51211969+esudaley@users.noreply.github.com"
] | 51211969+esudaley@users.noreply.github.com |
cc1ee5e7fd6f21bcca1397005bbf4ce81fea82b4 | d4506724ba8a4f2ae64b999d9e6631c7a149b45c | /src/main/java/yd/swig/SWIGTYPE_p_f_p__GFileIOStream_long_p__GCancellable_p_p__GError__int.java | a01ab8295aa8df54da218b0e309d2d0a27bfdddb | [] | no_license | ydaniels/frida-java | 6dc70b327ae8e8a6d808a0969e861225dcc0192b | cf3c198b2a4b7c7a3a186359b5c8c768deacb285 | refs/heads/master | 2022-12-08T21:28:27.176045 | 2019-10-24T09:51:44 | 2019-10-24T09:51:44 | 214,268,850 | 2 | 1 | null | 2022-11-25T19:46:38 | 2019-10-10T19:30:26 | Java | UTF-8 | Java | false | false | 941 | java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.1
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package yd.swig;
public class SWIGTYPE_p_f_p__GFileIOStream_long_p__GCancellable_p_p__GError__int {
private transient long swigCPtr;
protected SWIGTYPE_p_f_p__GFileIOStream_long_p__GCancellable_p_p__GError__int(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_f_p__GFileIOStream_long_p__GCancellable_p_p__GError__int() {
swigCPtr = 0;
}
protected static long getCPtr(SWIGTYPE_p_f_p__GFileIOStream_long_p__GCancellable_p_p__GError__int obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
| [
"yomi@erpsoftapp.com"
] | yomi@erpsoftapp.com |
185a3588e6a15c374a57fd638a48e6aa02f181f4 | 2afa9a03bf79e605f5f41534458ae83cd1ddbd86 | /app/src/main/java/za/co/myconcepts/instaclone/activities/ViewImageOnMap.java | 1016fddadd9610267a28c74a248030fb59dc7047 | [] | no_license | citispy/InstaClone | 9ab4b0c0f410b9353bb0be1629a145ebf681fb32 | f6480ef6815b9f306304b49186565c418554598a | refs/heads/master | 2021-09-19T10:44:41.738796 | 2018-07-27T09:18:09 | 2018-07-27T09:18:09 | 105,771,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,002 | java | package za.co.myconcepts.instaclone.activities;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.Toast;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.squareup.picasso.Picasso;
import za.co.myconcepts.instaclone.R;
import za.co.myconcepts.instaclone.helpers.SetThemeHelper;
public class ViewImageOnMap extends AppCompatActivity implements OnMapReadyCallback {
private GoogleMap mMap;
private String latitude, longitude;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Check Theme
SetThemeHelper.setTheme(this);
setContentView(R.layout.activity_view_image_on_map);
Toolbar toolbar = (Toolbar) findViewById(R.id.include);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
upArrow.setColorFilter(getResources().getColor(android.R.color.white), PorterDuff.Mode.SRC_ATOP);
getSupportActionBar().setHomeAsUpIndicator(upArrow);
Bundle bundle = getIntent().getBundleExtra("bundle");
String imageURL = bundle.getString("image_url");
latitude = bundle.getString("latitude");
longitude = bundle.getString("longitude");
ImageView ivImage = (ImageView) findViewById(R.id.ivImage);
Picasso.with(this).load(imageURL)
.placeholder(R.color.cardview_dark_background)
.resize(600,600)
.centerCrop()
.into(ivImage);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
LatLng ll = new LatLng(Double.parseDouble(latitude), Double.parseDouble(longitude));
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(ll, 16.5f), 4000, null);
mMap.addMarker(new MarkerOptions().position(ll));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id) {
case R.id.miBrowse:
Intent browseUserIntent = new Intent(ViewImageOnMap.this, BrowseUsers.class);
startActivity(browseUserIntent);
break;
case R.id.miNotifications:
Intent notificationsIntent = new Intent(ViewImageOnMap.this, NotificationsActivity.class);
startActivity(notificationsIntent);
break;
case R.id.miProfile:
Intent profileIntent = new Intent(ViewImageOnMap.this, Profile.class);
startActivity(profileIntent);
break;
case android.R.id.home:
Intent homeIntent = new Intent(ViewImageOnMap.this, MainActivity.class);
startActivity(homeIntent);
break;
case R.id.miSettings:
Intent settingsIntent = new Intent(ViewImageOnMap.this, SettingsActivity.class);
startActivity(settingsIntent);
break;
}
return true;
}
}
| [
"m.yusuf.isaacs@gmail.com"
] | m.yusuf.isaacs@gmail.com |
a50dc459043eab39ac55dc2d364031dd3fe5836c | fa569b2e22ebb44589ca7de19c680cec99d6d336 | /service/java/qmedataservice/qmespringds/src/test/java/com/malcolm/qme/springdata/repository/MediaTypeRepositoryImplTest.java | 2785c6e92949d27436d6af000df5ccc17dd95115 | [] | no_license | MalcolmPereira/QMe | 73a9ecf5e7869f93a50ebe7e69673a932381b408 | 96db418ebee68edceb002f26f586c588618b9670 | refs/heads/master | 2020-04-16T15:12:18.382953 | 2018-03-17T17:05:18 | 2018-03-17T17:05:18 | 28,116,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,531 | java | /**
* Name : com.malcolm.qme.springdata.repository.MediaTypeRepositoryImplTest.java
* Date : 5/14/15
* Developer : Malcolm
* Purpose : Tests for SpringData MediaTypeEntity Repository
*/
package com.malcolm.qme.springdata.repository;
import com.malcolm.qme.core.domain.MediaType;
import com.malcolm.qme.core.repository.MediaTypeRepository;
import com.malcolm.qme.core.repository.QMeException;
import com.malcolm.qme.springdata.config.QMeSpringDataJPAConfig;
import com.malcolm.qme.springdata.entity.MediaTypeEntity;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
/**
* @author Malcolm
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {QMeSpringDataJPAConfig.class})
public class MediaTypeRepositoryImplTest {
/**
* Question Hit Repository
*/
@Autowired
@Qualifier("MediaTypeRepository")
private MediaTypeRepository mediaTypeRepository;
@Mock
private MediaTypeSpringDataRepository mediaTypeSpringDataRepositoryMOCK;
@InjectMocks
private MediaTypeRepository mediaTypeRepositoryWithMock;
@Before
public void initMocks(){
mediaTypeRepositoryWithMock = new MediaTypeRepositoryImpl();
MockitoAnnotations.initMocks(this);
}
@Test
public void testFindAll() throws QMeException {
assertNotNull(mediaTypeRepository);
final List<MediaType> mediaTypeList = mediaTypeRepository.findAll();
assertNotNull(mediaTypeList);
assertThat(mediaTypeList.size(), greaterThan(0));
}
@Test
public void testFindById() throws QMeException {
assertNotNull(mediaTypeRepository);
final MediaType mediaType = mediaTypeRepository.findById(1);
assertNotNull(mediaType);
assertThat(mediaType.getMediaTypeID(), equalTo(1));
}
@Test
public void testCRUD() throws QMeException {
assertNotNull(mediaTypeRepository);
MediaType mediaType = new MediaType("MediaTypeRepositoryImplTest");
mediaType = mediaTypeRepository.save(mediaType);
assertNotNull(mediaType);
assertThat(mediaType.getMediaTypeID(), greaterThan(1));
final Integer mediaTypeID = mediaType.getMediaTypeID();
mediaType = mediaTypeRepository.update(mediaType,1L);
assertNotNull(mediaType);
assertThat(mediaType.getMediaTypeID(), equalTo(mediaTypeID));
mediaType = mediaTypeRepository.findById(mediaTypeID);
assertNotNull(mediaType);
assertThat(mediaType.getMediaTypeID(), equalTo(mediaTypeID));
mediaTypeRepository.delete(mediaTypeID);
mediaType = mediaTypeRepository.findById(mediaTypeID);
assertNull(mediaType);
}
@Test
public void testFindAllNullReturn() throws QMeException {
when(mediaTypeSpringDataRepositoryMOCK.findAll()).thenReturn(null);
List<MediaType> mediaTypeList = mediaTypeRepositoryWithMock.findAll();
verify(mediaTypeSpringDataRepositoryMOCK).findAll();
assertNotNull(mediaTypeList);
assertThat(mediaTypeList.size(), equalTo(0));
}
@Test(expected = QMeException.class)
public void testFindAllQMeException() throws QMeException {
when(mediaTypeSpringDataRepositoryMOCK.findAll()).thenThrow(new RuntimeException("some error"));
mediaTypeRepositoryWithMock.findAll();
verify(mediaTypeSpringDataRepositoryMOCK).findAll();
}
@Test(expected = QMeException.class)
public void testFindByIDQMeException() throws QMeException {
when(mediaTypeSpringDataRepositoryMOCK.findOne(1)).thenThrow(new RuntimeException("some error"));
mediaTypeRepositoryWithMock.findById(1);
verify(mediaTypeSpringDataRepositoryMOCK).findOne(1);
}
@Test(expected = QMeException.class)
public void testSaveQMeException() throws QMeException {
when(mediaTypeSpringDataRepositoryMOCK.save(Matchers.<MediaTypeEntity>anyObject())).thenThrow(new RuntimeException("some error"));
mediaTypeRepositoryWithMock.save(new MediaType("MediaTypeRepositoryImplTest"));
verify(mediaTypeSpringDataRepositoryMOCK).save(Matchers.<MediaTypeEntity>anyObject());
}
@Test(expected = QMeException.class)
public void testUpdateQMeException() throws QMeException {
when(mediaTypeSpringDataRepositoryMOCK.save(Matchers.<MediaTypeEntity>anyObject())).thenThrow(new RuntimeException("some error"));
mediaTypeRepositoryWithMock.update(new MediaType("MediaTypeRepositoryImplTest"), 1L);
verify(mediaTypeSpringDataRepositoryMOCK).save(Matchers.<MediaTypeEntity>anyObject());
}
@Test(expected = QMeException.class)
public void testDeleteQMeException() throws QMeException {
doThrow(new RuntimeException("some error")).when(mediaTypeSpringDataRepositoryMOCK).delete(1);
mediaTypeRepositoryWithMock.delete(1);
verify(mediaTypeSpringDataRepositoryMOCK).delete(1);
}
}
| [
"malcolm.j.pereira@gmail.com"
] | malcolm.j.pereira@gmail.com |
455284e664ed2c2d6c5f98ce8dbf70e4cee07c2f | 3ef55e152decb43bdd90e3de821ffea1a2ec8f75 | /large/module0376_internal/src/java/module0376_internal/a/IFoo0.java | 86b28be960248fb1a66ae5fa997653a039040251 | [
"BSD-3-Clause"
] | permissive | salesforce/bazel-ls-demo-project | 5cc6ef749d65d6626080f3a94239b6a509ef145a | 948ed278f87338edd7e40af68b8690ae4f73ebf0 | refs/heads/master | 2023-06-24T08:06:06.084651 | 2023-03-14T11:54:29 | 2023-03-14T11:54:29 | 241,489,944 | 0 | 5 | BSD-3-Clause | 2023-03-27T11:28:14 | 2020-02-18T23:30:47 | Java | UTF-8 | Java | false | false | 859 | java | package module0376_internal.a;
import javax.management.*;
import javax.naming.directory.*;
import javax.net.ssl.*;
/**
* Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
* labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
* Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
*
* @see java.util.logging.Filter
* @see java.util.zip.Deflater
* @see javax.annotation.processing.Completion
*/
@SuppressWarnings("all")
public interface IFoo0<U> extends java.util.concurrent.Callable<U> {
javax.lang.model.AnnotatedConstruct f0 = null;
javax.management.Attribute f1 = null;
javax.naming.directory.DirContext f2 = null;
String getName();
void setName(String s);
U get();
void set(U e);
}
| [
"gwagenknecht@salesforce.com"
] | gwagenknecht@salesforce.com |
fe3157b146c89bc7adb6fddfe3225df56b2c939d | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /test/irvine/oeis/a060/A060094Test.java | 1b32d71341b6fb43f508880474ee57bee6ea1a8e | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package irvine.oeis.a060;
import irvine.oeis.AbstractSequenceTest;
/**
* Tests the corresponding class.
* @author Sean A. Irvine
*/
public class A060094Test extends AbstractSequenceTest {
}
| [
"sean.irvine@realtimegenomics.com"
] | sean.irvine@realtimegenomics.com |
eff898e06641d20ffe09750c1869626d459e8b6a | 74648aa3ef4419d8b014e1b92350b15e25b10b50 | /01_java-basic/src/day10/Test04.java | 45205c0fc36e8eff885b9fdcac8c33e591d29037 | [] | no_license | k8go4go/happy | 0e893ff0fcb2d81cf3550a030fa36ae56a78fc4e | a10a28b258716b642a7ea4c1f63ceb08f5a91e32 | refs/heads/master | 2021-01-21T10:41:58.313262 | 2017-10-18T00:04:21 | 2017-10-18T00:04:21 | 91,704,705 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 702 | java | package day10;
// 추상클래스
abstract class AbsSuper {
public void test() {
System.out.println("구현된 메서드");
}
// 추상메서드
public abstract void call();
}
// 추상클래스를 상속받은 하위클래스는 추상메서드를 반드시
// 재정의(오버라이딩) 해야 한다.
class AbsSub extends AbsSuper {
public void call() {
System.out.println("재정의된 메서드");
}
}
public class Test04 {
public static void main(String[] args) {
// 추상클래스는 객체 생성 불가
// AbsSuper aSuper = new AbsSuper();
// 자식 클래스를 이용(묵시적 형변환)
AbsSuper aSuper = new AbsSub();
aSuper.call();
aSuper.test();
}
}
| [
"8go4go@gmail.com"
] | 8go4go@gmail.com |
eb7b7619b94456a47d41d4089b1c3cabc6962f06 | ecab973fba2ecaf2545668a89fd6c7aee8091b1e | /mvn/web/core/src/main/java/test/sys/context/PropertyLoadingFactoryBean.java | 5c8be03c57b4974fbaf2208bcd03852b9b45a8ce | [] | no_license | naresh516/Batch-33 | 763a2884798a75a81eff26f859212b845977ee77 | 944d03b00f57afb355a941cc8e737ae85612d587 | refs/heads/master | 2020-03-28T13:48:14.211318 | 2018-10-21T20:50:44 | 2018-10-21T20:50:44 | 148,430,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,781 | java | /*
* Copyright 2007 The Kuali Foundation
*
* Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
*
* 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 test.sys.context;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Security;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import javax.security.auth.x500.X500Principal;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openssl.PEMReader;
import org.bouncycastle.openssl.PEMWriter;
import org.bouncycastle.x509.X509V1CertificateGenerator;
import org.bouncycastle.x509.X509V3CertificateGenerator;
import javax.crypto.Cipher;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import java.util.Collection;
import java.util.Iterator;
import org.apache.commons.lang.StringUtils;
import org.kuali.kfs.sys.KFSConstants;
import org.kuali.rice.core.config.JAXBConfigImpl;
import org.kuali.rice.core.util.ClassLoaderUtils;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.core.io.DefaultResourceLoader;
import static test.logging.FormattedLogger.*;
public class PropertyLoadingFactoryBean implements FactoryBean {
private static final String PROPERTY_FILE_NAMES_KEY = "property.files";
private static final String PROPERTY_TEST_FILE_NAMES_KEY = "property.test.files";
private static final String SECURITY_PROPERTY_FILE_NAME_KEY = "security.property.file";
private static final String CONFIGURATION_FILE_NAME = "configuration";
private static final Properties BASE_PROPERTIES = new Properties();
private static final String HTTP_URL_PROPERTY_NAME = "http.url";
private static final String KSB_REMOTING_URL_PROPERTY_NAME = "ksb.remoting.url";
private static final String REMOTING_URL_SUFFIX = "/remoting";
protected static final String ENCRYPTION_STRATEGY = "RSA/ECB/PKCS1Padding";
protected static final String KEYSTORE_TYPE = "JCEKS";
protected static final String KEYSTORE_PASSWORD_PROPERTY = "keystore.password";
protected static final String KEYSTORE_LOCATION_PROPERTY = "keystore.file";
protected static final String ENCRYPTED_PROPERTY_EXTENSION = ".encrypted";
protected static final String PASSWORD_PROPERTY_EXTENSION = ".password";
protected static final String RICE_RSA_KEY_NAME = "rice-rsa-key";
static {
Security.addProvider(new BouncyCastleProvider());
}
private Properties props = new Properties();
private boolean testMode;
private boolean secureMode;
/**
* Main entry method.
*/
public Object getObject() throws Exception {
loadBaseProperties();
props.putAll(BASE_PROPERTIES);
if (secureMode) {
loadPropertyList(props,SECURITY_PROPERTY_FILE_NAME_KEY);
} else {
loadPropertyList(props,PROPERTY_FILE_NAMES_KEY);
if (testMode) {
loadPropertyList(props,PROPERTY_TEST_FILE_NAMES_KEY);
}
}
if (StringUtils.isBlank(System.getProperty(HTTP_URL_PROPERTY_NAME))) {
props.put(KSB_REMOTING_URL_PROPERTY_NAME, props.getProperty(KFSConstants.APPLICATION_URL_KEY) + REMOTING_URL_SUFFIX);
}
else {
props.put(KSB_REMOTING_URL_PROPERTY_NAME, new StringBuffer("http://").append(System.getProperty(HTTP_URL_PROPERTY_NAME)).append("/kfs-").append(props.getProperty(KFSConstants.ENVIRONMENT_KEY)).append(REMOTING_URL_SUFFIX).toString());
}
config("%s set to %s", KSB_REMOTING_URL_PROPERTY_NAME, props.getProperty(KSB_REMOTING_URL_PROPERTY_NAME));
decryptProps(props);
return props;
}
/**
* Decrypts encrypted values in properties. Interprets that any property in the {@link Properties} instance
* provided with a key ending with the {@code ENCRYPTED_PROPERTY_EXTENSION} is considered to be encrypted.
* It is then decrypted and replaced with a key of the same name only using the {@code PASSWORD_PROPERTY_EXTENSION}
*
* @param props the {@link Properties} to decrypt
* @throws {@link Exception} if there's any problem decrypting/encrypting properties.
*/
protected void decryptProps(final Properties props) throws Exception {
final String keystore = props.getProperty(KEYSTORE_LOCATION_PROPERTY);
final String storepass = props.getProperty(KEYSTORE_PASSWORD_PROPERTY);
final FileInputStream fs = new FileInputStream(keystore);
final KeyStore jks = KeyStore.getInstance(KEYSTORE_TYPE);
jks.load(fs, storepass.toCharArray());
fs.close();
final Cipher cipher = Cipher.getInstance(ENCRYPTION_STRATEGY);
cipher.init(Cipher.DECRYPT_MODE, (PrivateKey) jks.getKey(RICE_RSA_KEY_NAME, storepass.toCharArray()));
for (final String key : props.stringPropertyNames()) {
if (key.endsWith(ENCRYPTED_PROPERTY_EXTENSION)) {
final String prefix = key.substring(0, key.indexOf(ENCRYPTED_PROPERTY_EXTENSION));
final String encrypted_str = props.getProperty(key);
props.setProperty(prefix + PASSWORD_PROPERTY_EXTENSION,
new String(cipher.doFinal(new BASE64Decoder().decodeBuffer(encrypted_str))));
}
}
}
public Class getObjectType() {
return Properties.class;
}
public boolean isSingleton() {
return true;
}
private static void loadPropertyList(Properties props, String listPropertyName) {
entering();
debug("Loading property %s", listPropertyName);
for (String propertyFileName : getBaseListProperty(listPropertyName)) {
loadProperties(props,propertyFileName);
}
exiting();
}
private static void loadProperties(Properties props, String propertyFileName) {
entering();
debug("Loading %s", propertyFileName);
InputStream propertyFileInputStream = null;
try {
try {
propertyFileInputStream = new DefaultResourceLoader(ClassLoaderUtils.getDefaultClassLoader()).getResource(propertyFileName).getInputStream();
props.load(propertyFileInputStream);
}
finally {
if (propertyFileInputStream != null) {
propertyFileInputStream.close();
}
}
}
catch (FileNotFoundException fnfe) {
try {
try {
propertyFileInputStream = new FileInputStream(propertyFileName);
props.load(propertyFileInputStream);
}
finally {
if (propertyFileInputStream != null) {
propertyFileInputStream.close();
}
}
}
catch (Exception e) {
warn("Could not load property file %s", propertyFileName);
throwing(e);
}
}
catch (IOException e) {
warn("PropertyLoadingFactoryBean unable to load property file: %s", propertyFileName);
}
finally {
exiting();
}
}
public static String getBaseProperty(String propertyName) {
loadBaseProperties();
return BASE_PROPERTIES.getProperty(propertyName);
}
protected static List<String> getBaseListProperty(String propertyName) {
loadBaseProperties();
try {
if (BASE_PROPERTIES == null) {
error("BASE PROPERTIES IS NULL!!");
}
debug("Returning list of %s", BASE_PROPERTIES.getProperty(propertyName));
return Arrays.asList(BASE_PROPERTIES.getProperty(propertyName).split(","));
}
catch (Exception e) {
// NPE loading properties
return new ArrayList<String>();
}
}
protected static void loadBaseProperties() {
if (BASE_PROPERTIES.isEmpty()) {
List<String> riceXmlConfigurations = new ArrayList<String>();
riceXmlConfigurations.add("classpath:META-INF/common-config-defaults.xml");
JAXBConfigImpl riceXmlConfigurer = new JAXBConfigImpl(riceXmlConfigurations);
try {
riceXmlConfigurer.parseConfig();
BASE_PROPERTIES.putAll(riceXmlConfigurer.getProperties());
}
catch (Exception e) {
warn("Couldn't load the rice configs");
warn(e.getMessage());
}
}
loadProperties(BASE_PROPERTIES, new StringBuffer("classpath:").append(CONFIGURATION_FILE_NAME).append(".properties").toString());
final String additionalProps = BASE_PROPERTIES.getProperty("additional.config.locations");
config("Adding props from %s", additionalProps);
final JAXBConfigImpl additionalConfigurer = new JAXBConfigImpl(java.util.Arrays.asList(additionalProps.split(",")));
try {
additionalConfigurer.parseConfig();
BASE_PROPERTIES.putAll(additionalConfigurer.getProperties());
if (isDebuggingEnabled()) {
BASE_PROPERTIES.list(System.out);
}
}
catch (Exception e) {
warn("Unable to load additional configs");
warn(e.getMessage());
// e.printStackTrace();
}
}
public void setTestMode(boolean testMode) {
this.testMode = testMode;
}
public void setSecureMode(boolean secureMode) {
this.secureMode = secureMode;
}
public static void clear() {
BASE_PROPERTIES.clear();
}
}
| [
"nareshbora@gmail.com"
] | nareshbora@gmail.com |
3b0ca2753dfb387f3b818e5ec5e1036af35c25b2 | 3725fec5819219ead50e96e508ec703e5faa2a7c | /inventory-service/src/main/java/com/ecommerce/inventoryservice/request/BookFiltersRequest.java | f7cce8a3baf9ad53678e98633145cf48a52150c6 | [] | no_license | brktopcu/ecommerce-microservices | f33c0acc15e7334eeca9240f022dd5bb2738bf70 | 1e2dc4fb86078eaad12ff738760444b672e64506 | refs/heads/master | 2023-04-26T04:04:16.888159 | 2021-05-25T19:49:36 | 2021-05-25T19:49:36 | 349,976,648 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 229 | java | package com.ecommerce.inventoryservice.request;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class BookFiltersRequest {
private String category;
private Long maxPrice;
private Long minPrice;
}
| [
"buraktopcu12@hotmail.com"
] | buraktopcu12@hotmail.com |
5faff08d5d214affd6d3c2b694cef8299182674e | 0afc040b0089fe170ae1357c47dcb6e6f98a2bfd | /sso-platform-core/src/main/java/com/zzq/cloud/platform/config/AliYunConfig.java | 2e5e3293241d298980970dd12ab5b838dde05371 | [] | no_license | 787390869/spring-security-oauth2 | e927f20532daff41543203355105490a5208f39a | 8c161b7ec51ba8737c299f2a72f73dcf25dddd56 | refs/heads/master | 2023-04-12T08:24:33.364914 | 2021-05-08T02:31:04 | 2021-05-08T02:31:04 | 365,459,286 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 962 | java | package com.zzq.cloud.platform.config;
import com.zzq.cloud.sdk.security.SecurityModel;
import lombok.Data;
import lombok.Getter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* @Author ZhangZiQiang
* @CreateTime 2021/5/7
*/
@Getter
@Configuration
@ConfigurationProperties(prefix = AliYunConfig.ALIYUN_PREFIX)
public class AliYunConfig {
public static final String ALIYUN_PREFIX = "aliyun";
public static String accessKey = "yourAccessKey";
public static String accessSecret = "yourAccessSecret";
public static String appKey = "yourAppKey";
public void setAccessKey(String accessKey) {
AliYunConfig.accessKey = accessKey;
}
public void setAccessSecret(String accessSecret) {
AliYunConfig.accessSecret = accessSecret;
}
public void setAppKey(String appKey) {
AliYunConfig.appKey = appKey;
}
}
| [
"sadsad"
] | sadsad |
ea24a1751be0625401133fd3de4806a5895e1da4 | 00c2216e4248e7ceb31a0de0b1770176fa3d6944 | /tree/src/main/java/java8/defaultmethods/DerivedGreetingService.java | 83e02f10f0fb7b17591fb7c7fbb091ae357d9bcf | [] | no_license | jianbinhusky/offgo | 1890ef406344a0b72cda4f023c569688282ea0be | 3d31165782301bb0bde8027ef47a0f32f61d9b76 | refs/heads/master | 2021-05-13T19:49:07.715179 | 2018-03-09T02:09:44 | 2018-03-09T02:09:44 | 116,899,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package java8.defaultmethods;
/**
* A GreetingService implementation that uses {@link AbstractGreetingService} as base class and therefore has to
* redefine {@link #greet()}.
*/
public class DerivedGreetingService extends AbstractGreetingService {
@Override
public String greet() {
return "Salut le monde!";
}
}
| [
"hujianbin93@gmail.com"
] | hujianbin93@gmail.com |
3a0aa108a5ce9666a5d43af81f13b3700ea30141 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/elastic--elasticsearch/cc83c2f848be69a77f1275fe1ff5363dcdd4c955/after/NodesStatsRequestBuilder.java | 4fa5a58a98cdcfc790b925e29dcb5ac081e96679 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,606 | java | /*
* Licensed to ElasticSearch and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. ElasticSearch licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.action.admin.cluster.node.stats;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
/**
*
*/
public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<NodesStatsRequest, NodesStatsResponse, NodesStatsRequestBuilder> {
public NodesStatsRequestBuilder(ClusterAdminClient clusterClient) {
super((InternalClusterAdminClient) clusterClient, new NodesStatsRequest());
}
/**
* Sets all the request flags.
*/
public NodesStatsRequestBuilder all() {
request.all();
return this;
}
/**
* Clears all stats flags.
*/
public NodesStatsRequestBuilder clear() {
request.clear();
return this;
}
/**
* Should the node indices stats be returned.
*/
public NodesStatsRequestBuilder setIndices(boolean indices) {
request.setIndices(indices);
return this;
}
/**
* Should the node OS stats be returned.
*/
public NodesStatsRequestBuilder setOs(boolean os) {
request.setOs(os);
return this;
}
/**
* Should the node OS stats be returned.
*/
public NodesStatsRequestBuilder setProcess(boolean process) {
request.setProcess(process);
return this;
}
/**
* Should the node JVM stats be returned.
*/
public NodesStatsRequestBuilder setJvm(boolean jvm) {
request.setJvm(jvm);
return this;
}
/**
* Should the node thread pool stats be returned.
*/
public NodesStatsRequestBuilder setThreadPool(boolean threadPool) {
request.setThreadPool(threadPool);
return this;
}
/**
* Should the node Network stats be returned.
*/
public NodesStatsRequestBuilder setNetwork(boolean network) {
request.setNetwork(network);
return this;
}
/**
* Should the node file system stats be returned.
*/
public NodesStatsRequestBuilder setFs(boolean fs) {
request.setFs(fs);
return this;
}
/**
* Should the node Transport stats be returned.
*/
public NodesStatsRequestBuilder setTransport(boolean transport) {
request.setTransport(transport);
return this;
}
/**
* Should the node HTTP stats be returned.
*/
public NodesStatsRequestBuilder setHttp(boolean http) {
request.setHttp(http);
return this;
}
@Override
protected void doExecute(ActionListener<NodesStatsResponse> listener) {
((ClusterAdminClient) client).nodesStats(request, listener);
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
f1e414fae2c0b97079f7332c312613fea0f687b5 | a2bfed1340ba735a6493f2f71fe1e4502bc423da | /src/oop/com/innerClass/MethodInnerClassTest.java | 7491b5ce72a15f77e402ebb1e854faa25e85e07a | [] | no_license | sadanspace/javase-practice | 6201f6b9e56b3756b9dc2ed2df94ef8b18d59955 | ee9e9df6edd607e39e2d6167474f2027cf87c7a4 | refs/heads/master | 2020-07-03T15:03:12.087219 | 2020-01-03T10:05:46 | 2020-01-03T10:05:46 | 201,945,940 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 612 | java | package src.oop.com.innerClass;
/*
方法内部类:
1. 类名不能使用访问修饰符、static修饰符
2. 变量名不能使用static修饰符
*/
public class MethodInnerClassTest {
private String info = "hello world";
public void function(int temp){
class Inner{
private void print(){
System.out.println("类中的属性:"+info);
System.out.println("方法中的参数"+temp);
}
}
new Inner().print();
}
public static void main(String[] args) {
new MethodInnerClassTest().function(10);
}
}
| [
"yxq1575856216@gmail.com"
] | yxq1575856216@gmail.com |
e2bf31cf181c229e6a9ca58d0f0b69e445ee9d29 | d994cdd20090ef266ec405090a478fc241b09f47 | /src/main/java/com/exxeta/maau/demoliquibase/repository/CarRepository.java | b5ffd5228304e20deecd45fcc9fe185a60eeb559 | [] | no_license | johnsonaux/daimler-tutorial-with-liquibase | 3568d13a7cb9cebbaee783f36a7f353752a8a5fc | adc22a695e04c4be9193462ae10e69092053f910 | refs/heads/master | 2020-03-26T21:37:08.809905 | 2018-08-20T14:33:28 | 2018-08-20T14:33:28 | 145,398,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 426 | java | package com.exxeta.maau.demoliquibase.repository;
import com.exxeta.maau.demoliquibase.model.Car;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CarRepository extends JpaRepository<Car, Long> {
List<Car> findByDailyProductionId(Long dailyProductionId);
List<Car> findByDealerId(Long dealerId);
}
| [
"Marc.Aumueller@EXXETA.com"
] | Marc.Aumueller@EXXETA.com |
2c1e7ce5bfbbca0bdcfe93cbe910e329eec2b23d | d3ad8c790c40a00d95c465bb7a94234f3cef3838 | /app/src/main/java/com/example/user/fantasyzoo/Enclosure.java | 57130fee22e68e6cd73f739100868e4cbcf249f7 | [] | no_license | DianaM10/wk8assignment2java_fantasy_zoo | 7c29b4b6ce57f67015887456e33b1b12a53fc7b1 | 52f8543d6826bfcdee2c5fc570b3169b18eb542b | refs/heads/master | 2020-08-01T07:54:45.341721 | 2017-01-05T17:02:15 | 2017-01-05T17:02:15 | 73,583,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 293 | java | package com.example.user.fantasyzoo;
import java.util.ArrayList;
/**
* Created by user on 14/11/2016.
*/
public abstract class Enclosure {
public int size;
public Enclosure(int size) {
this.size = size;
}
public int getSize() {
return(size);
}
}
| [
"dianaman82@gmail.com"
] | dianaman82@gmail.com |
854d20c0065a66d93b8827685ebd8dc568626dcb | 9e94a2df772c338bd1181e6a8bf6ef8c0ebdef67 | /src/main/java/com/example/demo/config/SwaggerConfiguration.java | b180f31ac21dcb872c3570050baabac0464b8374 | [] | no_license | nuax-bespin/sample-backend-app-new | 9c54162e39ea5fb3628fb0772e5dc336d2a0bc5e | eedc961b59d9bee713ba6d3fe1cd7b775ee2973d | refs/heads/master | 2023-06-15T09:20:50.737546 | 2021-07-12T10:43:52 | 2021-07-12T10:43:52 | 385,212,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,258 | java | package com.example.demo.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import springfox.documentation.builders.*;
import springfox.documentation.service.*;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger.web.*;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.time.LocalDateTime;
import java.util.List;
import static com.google.common.base.Predicates.not;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Sets.newHashSet;
@Configuration
@EnableSwagger2
@ConditionalOnProperty(name = "swagger.enabled", havingValue = "true", matchIfMissing = false)
public class SwaggerConfiguration {
public static final String DEFAULT_INCLUDE_PATTERN = "/.*";
public static final String securitySchemaOAuth2 = "oauth2Scheme";
@Autowired
private SwaggerConfigurationProperties swaggerConfigurationProperties;
private Docket commonApiDoc(){
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.useDefaultResponseMessages(false)
.forCodeGeneration(true)
.protocols(null != swaggerConfigurationProperties.getProtocol() && swaggerConfigurationProperties.getProtocol().isHttpsOnly() ? newHashSet("https") : newHashSet("http", "https"))
.genericModelSubstitutes(ResponseEntity.class)
.ignoredParameterTypes(java.sql.Date.class)
//.directModelSubstitute(LocalDate.class, java.sql.Date.class)
//.directModelSubstitute(ZonedDateTime.class, java.sql.Date.class)
.directModelSubstitute(LocalDateTime.class, java.sql.Date.class)
.select()
.paths(not(PathSelectors.regex("/error.*")))
.paths(PathSelectors.regex(StringUtils.hasText(swaggerConfigurationProperties.getIncludePatterns())?swaggerConfigurationProperties.getIncludePatterns():DEFAULT_INCLUDE_PATTERN))
.build();
}
private ApiInfo apiInfo(){
Contact contact = new Contact(
swaggerConfigurationProperties.getContactName(),
swaggerConfigurationProperties.getContactUrl(),
swaggerConfigurationProperties.getContactEmail());
return new ApiInfo(
swaggerConfigurationProperties.getTitle(),
swaggerConfigurationProperties.getDescription(),
swaggerConfigurationProperties.getVersion(),
swaggerConfigurationProperties.getTermsOfServiceUrl(),
contact,
swaggerConfigurationProperties.getLicense(),
swaggerConfigurationProperties.getLicenseUrl(), newArrayList());
}
@Bean
@ConditionalOnProperty(name = "swagger.security.enabled", havingValue = "false")
public Docket unsecuredDocket() {
return commonApiDoc();
}
@Bean
@ConditionalOnProperty(name = "swagger.security.enabled", havingValue = "true")
public Docket securedDocket() {
return commonApiDoc()
.securityContexts(newArrayList(securityContext()))
.securitySchemes(newArrayList(oauth()));
}
@Bean
@ConditionalOnProperty(name = "swagger.security.enabled", havingValue = "true")
public springfox.documentation.swagger.web.SecurityConfiguration security() {
SwaggerConfigurationProperties.Security security = swaggerConfigurationProperties.getSecurity();
String clientId = null;
String clientSecret = "UNDEFINED";
switch (security.getFlow()) {
case "clientCredentials":
clientSecret = security.getClientCredentialsFlow().getClientSecret();
clientId = security.getClientCredentialsFlow().getClientId();
break;
case "resourceOwnerPassword":
clientSecret = security.getResourceOwnerPasswordFlow().getClientSecret();
clientId = security.getResourceOwnerPasswordFlow().getClientId();
break;
case "authorizationCode":
clientSecret = security.getAuthorizationCodeFlow().getTokenRequestEndpoint().getClientSecretName();
clientId = security.getAuthorizationCodeFlow().getTokenRequestEndpoint().getClientIdName();
break;
case "implicit":
SwaggerConfigurationProperties.ImplicitFlow implicitFlow = security.getImplicitFlow();
clientId = implicitFlow.getClientId();
clientSecret = "UNDEFINED";
break;
}
return springfox.documentation.swagger.web.SecurityConfigurationBuilder.builder()
.clientId(clientId)
.clientSecret(clientSecret)
.realm(security.getRealm())
.appName(security.getApiName())
.scopeSeparator(" ")
.useBasicAuthenticationWithAccessCodeGrant(false)
.build();
}
@Bean
@ConditionalOnProperty(name = "swagger.security.enabled", havingValue = "true")
public SecurityScheme oauth() {
return new OAuthBuilder()
.name(securitySchemaOAuth2)
.grantTypes(getGrantTypes())
.scopes(scopes())
.build();
}
@ConditionalOnProperty(name = "swagger.security.enabled", havingValue = "true")
public SecurityContext securityContext() {
SecurityReference securityReference = SecurityReference.builder()
.reference(securitySchemaOAuth2)
.scopes(scopes().toArray(new AuthorizationScope[scopes().size()]))
.build();
return SecurityContext.builder()
.securityReferences(newArrayList(securityReference))
.forPaths(PathSelectors.regex(swaggerConfigurationProperties.getIncludePatterns()))
.build();
}
private List<AuthorizationScope> scopes() {
List<AuthorizationScope> globalScopes = newArrayList();
swaggerConfigurationProperties
.getSecurity()
.getGlobalScopes()
.forEach(scope -> globalScopes.add(new AuthorizationScope(scope.getName(), scope.getDescription())));
return globalScopes;
}
private List<GrantType> getGrantTypes(){
GrantType grantType;
String flow = swaggerConfigurationProperties.getSecurity().getFlow();
switch (flow) {
case "clientCredentials":
grantType = new ClientCredentialsGrant(swaggerConfigurationProperties.getSecurity().getClientCredentialsFlow().getTokenEndpointUrl());
break;
case "resourceOwnerPassword":
grantType = new ResourceOwnerPasswordCredentialsGrant(swaggerConfigurationProperties.getSecurity().getResourceOwnerPasswordFlow().getTokenEndpointUrl());
break;
case "authorizationCode":
TokenEndpoint tokenEndpoint = new TokenEndpointBuilder()
.url(swaggerConfigurationProperties.getSecurity().getAuthorizationCodeFlow().getTokenEndpoint().getUrl())
.tokenName(swaggerConfigurationProperties.getSecurity().getAuthorizationCodeFlow().getTokenEndpoint().getTokenName())
.build();
TokenRequestEndpoint tokenRequestEndpoint = new TokenRequestEndpointBuilder()
.url(swaggerConfigurationProperties.getSecurity().getAuthorizationCodeFlow().getTokenRequestEndpoint().getUrl())
.clientIdName(swaggerConfigurationProperties.getSecurity().getAuthorizationCodeFlow().getTokenRequestEndpoint().getClientIdName())
.clientSecretName(swaggerConfigurationProperties.getSecurity().getAuthorizationCodeFlow().getTokenRequestEndpoint().getClientSecretName())
.build();
grantType = new AuthorizationCodeGrantBuilder()
.tokenEndpoint(tokenEndpoint)
.tokenRequestEndpoint(tokenRequestEndpoint)
.build();
break;
case "implicit":
SwaggerConfigurationProperties.ImplicitFlow implicitFlow = swaggerConfigurationProperties.getSecurity().getImplicitFlow();
grantType = new ImplicitGrantBuilder().loginEndpoint(new LoginEndpoint(implicitFlow.getAuthorizationEndpointUrl())).build();
break;
default:
implicitFlow = swaggerConfigurationProperties.getSecurity().getImplicitFlow();
grantType = new ImplicitGrantBuilder().loginEndpoint(new LoginEndpoint(implicitFlow.getAuthorizationEndpointUrl())).build();
}
if (grantType == null) {
throw new IllegalArgumentException("No grantType was found for the desired flow. Please review your configuration.");
}
return newArrayList(grantType);
}
@Bean
public UiConfiguration uiConfig() {
String[] supportedSubmitMethods = UiConfiguration.Constants.DEFAULT_SUBMIT_METHODS;
if(!swaggerConfigurationProperties.isEnableTryOutMethods()){
supportedSubmitMethods = UiConfiguration.Constants.NO_SUBMIT_METHODS;
}
return UiConfigurationBuilder.builder()
.validatorUrl(null)
.docExpansion(DocExpansion.of("none"))
.operationsSorter(OperationsSorter.of("alpha"))
.tagsSorter(TagsSorter.of("alpha"))
.supportedSubmitMethods(supportedSubmitMethods)
.defaultModelRendering(ModelRendering.of("schema"))
.build();
}
}
| [
"nuax79@gmail.com"
] | nuax79@gmail.com |
7acbbf563c90571f63fa29838c20d389452fe50e | c8df5c3bb5126d2859ed0b2e6328ca7faea8fc4f | /metadata-extractor-tests/Tests/com/drew/lang/RandomAccessTestBase.java | 6e41ff8133edd75832609d6babcb17d5af52b30b | [
"Apache-2.0"
] | permissive | ydanila/j-metadata-extractor | a1757217dad17319afd0e4dd2d9a9ddfe755d920 | d76165b62a18ac907115b24b30ca1c4d20b06517 | refs/heads/master | 2020-07-03T09:54:33.754400 | 2015-03-30T11:38:09 | 2015-03-30T11:38:09 | 24,785,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,826 | java | /*
* Copyright 2002-2013 Drew Noakes
*
* 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.
*
* More information about this project is available at:
*
* http://drewnoakes.com/code/exif/
* http://code.google.com/p/metadata-extractor/
*/
package com.drew.lang;
import org.junit.Assert;
import org.junit.Test;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/**
* Base class for testing implementations of {@link RandomAccessReader}.
*
* @author Drew Noakes http://drewnoakes.com
*/
public abstract class RandomAccessTestBase
{
protected abstract RandomAccessReader createReader(byte[] bytes);
@Test
public void testDefaultEndianness()
{
assertEquals(true, createReader(new byte[1]).isMotorolaByteOrder());
}
@Test
public void testGetInt8() throws Exception
{
byte[] buffer = new byte[]{0x00, 0x01, (byte)0x7F, (byte)0xFF};
RandomAccessReader reader = createReader(buffer);
assertEquals((byte)0, reader.getInt8(0));
assertEquals((byte)1, reader.getInt8(1));
assertEquals((byte)127, reader.getInt8(2));
assertEquals((byte)255, reader.getInt8(3));
}
@Test
public void testGetUInt8() throws Exception
{
byte[] buffer = new byte[]{0x00, 0x01, (byte)0x7F, (byte)0xFF};
RandomAccessReader reader = createReader(buffer);
assertEquals(0, reader.getUInt8(0));
assertEquals(1, reader.getUInt8(1));
assertEquals(127, reader.getUInt8(2));
assertEquals(255, reader.getUInt8(3));
}
@Test
public void testGetUInt8_OutOfBounds()
{
try {
RandomAccessReader reader = createReader(new byte[2]);
reader.getUInt8(2);
Assert.fail("Exception expected");
} catch (IOException ex) {
assertEquals("Attempt to read from beyond end of underlying data source (requested index: 2, requested count: 1, max index: 1)", ex.getMessage());
}
}
@Test
public void testGetInt16() throws Exception
{
assertEquals(-1, createReader(new byte[]{(byte)0xff, (byte)0xff}).getInt16(0));
byte[] buffer = new byte[]{0x00, 0x01, (byte)0x7F, (byte)0xFF};
RandomAccessReader reader = createReader(buffer);
assertEquals((short)0x0001, reader.getInt16(0));
assertEquals((short)0x017F, reader.getInt16(1));
assertEquals((short)0x7FFF, reader.getInt16(2));
reader.setMotorolaByteOrder(false);
assertEquals((short)0x0100, reader.getInt16(0));
assertEquals((short)0x7F01, reader.getInt16(1));
assertEquals((short)0xFF7F, reader.getInt16(2));
}
@Test
public void testGetUInt16() throws Exception
{
byte[] buffer = new byte[]{0x00, 0x01, (byte)0x7F, (byte)0xFF};
RandomAccessReader reader = createReader(buffer);
assertEquals(0x0001, reader.getUInt16(0));
assertEquals(0x017F, reader.getUInt16(1));
assertEquals(0x7FFF, reader.getUInt16(2));
reader.setMotorolaByteOrder(false);
assertEquals(0x0100, reader.getUInt16(0));
assertEquals(0x7F01, reader.getUInt16(1));
assertEquals(0xFF7F, reader.getUInt16(2));
}
@Test
public void testGetUInt16_OutOfBounds()
{
try {
RandomAccessReader reader = createReader(new byte[2]);
reader.getUInt16(1);
Assert.fail("Exception expected");
} catch (IOException ex) {
assertEquals("Attempt to read from beyond end of underlying data source (requested index: 1, requested count: 2, max index: 1)", ex.getMessage());
}
}
@Test
public void testGetInt32() throws Exception
{
assertEquals(-1, createReader(new byte[]{(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff}).getInt32(0));
byte[] buffer = new byte[]{0x00, 0x01, (byte)0x7F, (byte)0xFF, 0x02, 0x03, 0x04};
RandomAccessReader reader = createReader(buffer);
assertEquals(0x00017FFF, reader.getInt32(0));
assertEquals(0x017FFF02, reader.getInt32(1));
assertEquals(0x7FFF0203, reader.getInt32(2));
assertEquals(0xFF020304, reader.getInt32(3));
reader.setMotorolaByteOrder(false);
assertEquals(0xFF7F0100, reader.getInt32(0));
assertEquals(0x02FF7F01, reader.getInt32(1));
assertEquals(0x0302FF7F, reader.getInt32(2));
assertEquals(0x040302FF, reader.getInt32(3));
}
@Test
public void testGetUInt32() throws Exception
{
assertEquals(4294967295L, createReader(new byte[]{(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff}).getUInt32(0));
byte[] buffer = new byte[]{0x00, 0x01, (byte)0x7F, (byte)0xFF, 0x02, 0x03, 0x04};
RandomAccessReader reader = createReader(buffer);
assertEquals(0x00017FFFL, reader.getUInt32(0));
assertEquals(0x017FFF02L, reader.getUInt32(1));
assertEquals(0x7FFF0203L, reader.getUInt32(2));
assertEquals(0xFF020304L, reader.getUInt32(3));
reader.setMotorolaByteOrder(false);
assertEquals(4286513408L, reader.getUInt32(0));
assertEquals(0x02FF7F01L, reader.getUInt32(1));
assertEquals(0x0302FF7FL, reader.getUInt32(2));
assertEquals(0x040302FFL, reader.getInt32(3));
}
@Test
public void testGetInt32_OutOfBounds()
{
try {
RandomAccessReader reader = createReader(new byte[3]);
reader.getInt32(0);
Assert.fail("Exception expected");
} catch (IOException ex) {
assertEquals("Attempt to read from beyond end of underlying data source (requested index: 0, requested count: 4, max index: 2)", ex.getMessage());
}
}
@Test
public void testGetInt64() throws IOException
{
byte[] buffer = new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, (byte)0xFF};
RandomAccessReader reader = createReader(buffer);
assertEquals(0x0001020304050607L, reader.getInt64(0));
assertEquals(0x01020304050607FFL, reader.getInt64(1));
reader.setMotorolaByteOrder(false);
assertEquals(0x0706050403020100L, reader.getInt64(0));
assertEquals(0xFF07060504030201L, reader.getInt64(1));
}
@Test
public void testGetInt64_OutOfBounds() throws Exception
{
try {
RandomAccessReader reader = createReader(new byte[7]);
reader.getInt64(0);
Assert.fail("Exception expected");
} catch (IOException ex) {
assertEquals("Attempt to read from beyond end of underlying data source (requested index: 0, requested count: 8, max index: 6)", ex.getMessage());
}
try {
RandomAccessReader reader = createReader(new byte[7]);
reader.getInt64(-1);
Assert.fail("Exception expected");
} catch (IOException ex) {
assertEquals("Attempt to read from buffer using a negative index (-1)", ex.getMessage());
}
}
@Test
public void testGetFloat32() throws Exception
{
final int nanBits = 0x7fc00000;
assertTrue(Float.isNaN(Float.intBitsToFloat(nanBits)));
byte[] buffer = new byte[]{0x7f, (byte)0xc0, 0x00, 0x00};
RandomAccessReader reader = createReader(buffer);
assertTrue(Float.isNaN(reader.getFloat32(0)));
}
@Test
public void testGetFloat64() throws Exception
{
final long nanBits = 0xfff0000000000001L;
assertTrue(Double.isNaN(Double.longBitsToDouble(nanBits)));
byte[] buffer = new byte[]{(byte)0xff, (byte)0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
RandomAccessReader reader = createReader(buffer);
assertTrue(Double.isNaN(reader.getDouble64(0)));
}
@Test
public void testGetNullTerminatedString() throws Exception
{
byte[] bytes = new byte[]{0x41, 0x42, 0x43, 0x44, 0x00, 0x45, 0x46, 0x47};
RandomAccessReader reader = createReader(bytes);
assertEquals("", reader.getNullTerminatedString(0, 0));
assertEquals("A", reader.getNullTerminatedString(0, 1));
assertEquals("AB", reader.getNullTerminatedString(0, 2));
assertEquals("ABC", reader.getNullTerminatedString(0, 3));
assertEquals("ABCD", reader.getNullTerminatedString(0, 4));
assertEquals("ABCD", reader.getNullTerminatedString(0, 5));
assertEquals("ABCD", reader.getNullTerminatedString(0, 6));
assertEquals("BCD", reader.getNullTerminatedString(1, 3));
assertEquals("BCD", reader.getNullTerminatedString(1, 4));
assertEquals("BCD", reader.getNullTerminatedString(1, 5));
assertEquals("", reader.getNullTerminatedString(4, 3));
}
@Test
public void testGetString() throws Exception
{
byte[] bytes = new byte[]{0x41, 0x42, 0x43, 0x44, 0x00, 0x45, 0x46, 0x47};
RandomAccessReader reader = createReader(bytes);
assertEquals("", reader.getString(0, 0));
assertEquals("A", reader.getString(0, 1));
assertEquals("AB", reader.getString(0, 2));
assertEquals("ABC", reader.getString(0, 3));
assertEquals("ABCD", reader.getString(0, 4));
assertEquals("ABCD\0", reader.getString(0, 5));
assertEquals("ABCD\0E", reader.getString(0, 6));
assertEquals("BCD", reader.getString(1, 3));
assertEquals("BCD\0", reader.getString(1, 4));
assertEquals("BCD\0E", reader.getString(1, 5));
assertEquals("\0EF", reader.getString(4, 3));
}
@Test
public void testIndexPlusCountExceedsIntMaxValue()
{
RandomAccessReader reader = createReader(new byte[10]);
try {
reader.getBytes(0x6FFFFFFF, 0x6FFFFFFF);
} catch (IOException e) {
assertEquals("Number of requested bytes summed with starting index exceed maximum range of signed 32 bit integers (requested index: 1879048191, requested count: 1879048191)", e.getMessage());
}
}
@Test
public void testOverflowBoundsCalculation()
{
RandomAccessReader reader = createReader(new byte[10]);
try {
reader.getBytes(5, 10);
} catch (IOException e) {
assertEquals("Attempt to read from beyond end of underlying data source (requested index: 5, requested count: 10, max index: 9)", e.getMessage());
}
}
@Test
public void testGetBytesEOF() throws Exception
{
createReader(new byte[50]).getBytes(0, 50);
RandomAccessReader reader = createReader(new byte[50]);
reader.getBytes(25, 25);
try {
createReader(new byte[50]).getBytes(0, 51);
fail("Expecting exception");
} catch (IOException ex) {}
}
@Test
public void testGetInt8EOF() throws Exception
{
createReader(new byte[1]).getInt8(0);
RandomAccessReader reader = createReader(new byte[2]);
reader.getInt8(0);
reader.getInt8(1);
try {
reader = createReader(new byte[1]);
reader.getInt8(0);
reader.getInt8(1);
fail("Expecting exception");
} catch (IOException ex) {}
}
}
| [
"yakodani@gmail.com"
] | yakodani@gmail.com |
f2047eb0cdd8da2b8a9cd3f7cd8da1669cac878a | 3ae960e88c162043e988f2c975f0c13519797c54 | /src/main/java/com/example/qachallenge/pages/BrokenImagesPage.java | 9d4659657142b1d1276847a133af1451b570f934 | [] | no_license | rohith3532/qa-challenge-contmcloud | f05c44deac111759321b18ea0ff7869ff3e616b9 | a74b4cde7cb4b115085161f050b6187e7a53e7a1 | refs/heads/main | 2023-06-07T16:16:37.148515 | 2021-06-28T00:02:35 | 2021-06-28T00:02:35 | 380,401,279 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,584 | java | package com.example.qachallenge.pages;
import java.util.List;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
import org.openqa.selenium.By;
import java.io.IOException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
public class BrokenImagesPage {
private WebDriver driver;
int iBrokenImageCount = 0;
public static String status = "passed";
//1. By locators
private By images = By.tagName("img");
//2. Constructor of the page class
public BrokenImagesPage(WebDriver driver)
{
this.driver=driver;
}
//3. Page actions
public void VerifyBrokenImagesCount() throws ClientProtocolException, IOException
{
List<WebElement> image_list = driver.findElements(images);
int ImagesCount = image_list.size();
for (WebElement img : image_list)
{
if (img != null)
{
HttpClient client = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(img.getAttribute("src"));
HttpResponse response = client.execute(request);
/* For valid images, the HttpStatus will be 200 */
if (response.getStatusLine().getStatusCode() != 200)
{
System.out.println(img.getAttribute("outerHTML") + " is broken.");
iBrokenImageCount++;
}
}
}
status = "passed";
System.out.println("The page " + "https://the-internet.herokuapp.com/broken_images" + " has " + iBrokenImageCount + " broken images");
}
}
| [
"rohith3532@gmail.com"
] | rohith3532@gmail.com |
4fae93cabf1adbc95efaae49b9bf4a5608e1c795 | 33c743fe08587f8975ad9fd02c1c13beaa2487a3 | /app/src/androidTest/java/edu/quinnipiac/ls02beeradvisor/ExampleInstrumentedTest.java | 319f820c7deaaf42a67f5f3419a388a7a14cc3c1 | [] | no_license | SER210-SP21/headfirst-ch2-AidanSchmid | d4c17302627360f3420a843d529ac1518df151ac | 2ce6559fd1d741147e54484ca96620aad0a9d1be | refs/heads/master | 2023-03-21T23:20:27.750844 | 2021-03-17T19:22:43 | 2021-03-17T19:22:43 | 336,962,563 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | package edu.quinnipiac.ls02beeradvisor;
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("edu.quinnipiac.ls02beeradvisor", appContext.getPackageName());
}
} | [
"Aidan.schmid@quinnipiac.edu"
] | Aidan.schmid@quinnipiac.edu |
030a789d17642283e91f5cfd7be2381e5029e1a1 | 3f875bd2ed264f2daab190d35eca004702a7ad74 | /src/SelectorDeSecuencias.java | 2e1b90279be0ceaa119b7994ba2dce3a3f439cb7 | [
"Apache-2.0"
] | permissive | carala/DI-Juego | f8227f7dc9ba6d7cd400207d2869e95cb4a84b21 | 06171115c5d4cb09bf0c5d6a24864f63ad1131d4 | refs/heads/master | 2021-01-12T01:37:54.283883 | 2017-01-09T09:14:37 | 2017-01-09T09:14:37 | 78,410,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,927 | java | import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.StringTokenizer;
import javax.swing.JOptionPane;
public class SelectorDeSecuencias{
public static ArrayList<Integer> seleccionarSecuenciaDeTxt() throws IOException{
File f = new File("FicheroSecuencias.txt");
FileReader fr = new FileReader(f);
BufferedReader br = new BufferedReader(fr);
String linea = "init";
ArrayList<String> lineas = new ArrayList<String>();
ArrayList<Integer> resultado = new ArrayList<Integer>();
while(linea!=null){
linea = br.readLine();
lineas.add(linea);
}
System.out.println(lineas);
int opc=-1;
do{
switch(JOptionPane.showOptionDialog(null, "Seleccione la secuencia", "Opcion", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, new Object[]{"Facil","Medio","Dificil"},"0"))
{
case 0: opc=0;
break;
case 1: opc=1;
break;
case 2: opc=2;
break;
default:
JOptionPane.showMessageDialog(null, "Escoja de nuevo.");
break;
}
}while(opc==-1);
if(opc == 0 ){
linea = String.valueOf(lineas.get(opc));
StringTokenizer tokens = new StringTokenizer(linea);
while(tokens.hasMoreTokens()){
resultado.add(Integer.parseInt(tokens.nextToken()));
}
}else if(opc == 1 ){
linea = String.valueOf(lineas.get(opc));
StringTokenizer tokens = new StringTokenizer(linea);
while(tokens.hasMoreTokens()){
resultado.add(Integer.parseInt(tokens.nextToken()));
}
}else if(opc == 2 ){
linea = String.valueOf(lineas.get(opc));
StringTokenizer tokens = new StringTokenizer(linea);
while(tokens.hasMoreTokens()){
resultado.add(Integer.parseInt(tokens.nextToken()));
}
}
return resultado;
}
}
| [
"@carala"
] | @carala |
d77a88ef28da192b63c048f1eb2c122117a81661 | 041fa6ded4044055f0b9f86930d49b72dd1e8b73 | /src/ie/ittd/year2/project/concert/adminClasses/DeleteConcert.java | dd70f9c534605459a9eb152dcc568e90176e1d5d | [] | no_license | JasonLloyd/2ndYearProject | 09f4e8e0648740da8d058b736fa2f5407a016a8c | dfd721474b17a9e5820857fc3e2b476b2015dddb | refs/heads/master | 2020-05-17T13:25:40.060385 | 2014-02-27T22:31:43 | 2014-02-27T22:31:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,879 | java | package ie.ittd.year2.project.concert.adminClasses;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.HeadlessException;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import ie.ittd.year2.project.concert.dbFiles.*;
public class DeleteConcert
{
dbConnect2 db = new dbConnect2();
ResultSet rset;
theHandler handler = new theHandler();
confirmationScreens z = new confirmationScreens();
private GridBagLayout gbl = new GridBagLayout();
private JTextField codeField = new JTextField(16);
private JButton deleteConcert = new JButton("Delete Concert");
private JButton back = new JButton("Back");
private GridBagConstraints c = new GridBagConstraints();
private JFrame deleteConcertFrame = new JFrame();
private JPanel panel1 = new JPanel(gbl);
private JPanel panel2 = new JPanel();
private JPanel panel3 = new JPanel();
private Font f2 = new Font("Roman",Font.BOLD + Font.ITALIC,25);
int i = 0;
public DeleteConcert()
{
db.connect();
JTable t1 = db.concertTable();
JScrollPane scrollPane = new JScrollPane(t1);
JLabel title = new JLabel("Delete Concert");
JLabel code = new JLabel("Enter concert code to delete concert from system:");
deleteConcertFrame.setTitle("Delete Concert");
deleteConcertFrame.setSize(540,400);
deleteConcertFrame.setLocation(500, 250);
deleteConcertFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
deleteConcertFrame.getContentPane().setLayout(new BorderLayout());
deleteConcertFrame.setVisible(true);
deleteConcertFrame.add(panel1,BorderLayout.CENTER);
deleteConcertFrame.add(panel2,BorderLayout.NORTH);
deleteConcertFrame.add(panel3,BorderLayout.SOUTH);
panel2.setLayout(new FlowLayout(FlowLayout.CENTER));
panel3.setLayout(new BorderLayout());
panel1.setBackground(Color.white);
panel2.setBackground(Color.white);
title.setFont(f2);
panel2.add(title);
c.insets = new Insets(0,0,0,0);
c.gridx = 0;
c.gridy = 0;
panel1.add(code,c);
c.insets = new Insets(20,0,0,0);
c.gridx = 0;
c.gridy = 1;
panel1.add(codeField,c);
c.insets = new Insets(50,350,0,0);
c.gridx = 0;
c.gridy = 2;
panel1.add(deleteConcert,c);
c.insets = new Insets(50,0,0,0);
c.gridx = 1;
c.gridy = 2;
panel1.add(back,c);
deleteConcert.addActionListener(handler);
back.addActionListener(handler);
panel3.add(scrollPane);
}
private class theHandler implements ActionListener
{
@Override
public void actionPerformed(ActionEvent e)
{
JButton pushedButton = (JButton) (e.getSource());
if(pushedButton.equals(deleteConcert))
{
rset = db.getConcerts();
String deleteConcert = codeField.getText();
if(deleteConcert.equals("") || deleteConcert.equals(null))
{
z.fieldsNotFilledIn();
}
else
{
int deleteConcertCode = 0;
try
{
deleteConcertCode = Integer.parseInt(deleteConcert);
db.deleteConcert(deleteConcertCode);
}catch(NumberFormatException e1)
{
JOptionPane.showMessageDialog(null, "The concert code must be only numbers","Delete concert error",JOptionPane.WARNING_MESSAGE);
}
}
}
if(pushedButton.equals(back))
{
db.closeDB();
deleteConcertFrame.setVisible(false);
AdminHomeScreen x = new AdminHomeScreen(LoginPage.usernameCopy);
}
}
}
}
| [
"x00074511@ittd.ie"
] | x00074511@ittd.ie |
9c22e0d06eda831a7bb2f9fc3d99ad43b26f333a | bfe2b0d78191bd09d8c4b19606b542e4f99ee05a | /CloudHomeExchange/src/com/entity/User.java | e46b8a1b9be0f5e28d82164ea8970bd9d1ec2cb3 | [] | no_license | xinyi-huang96/cloud | 8d63d657ddc655bd9c65fe085b56f4b5204ef91f | 6ba109f831ff5e9e8ea4576be0b70d9e4a90cc4d | refs/heads/master | 2022-09-13T16:01:20.940403 | 2020-06-02T00:33:21 | 2020-06-02T00:33:21 | 251,303,010 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,509 | java | package com.entity;
public class User {
private String uid;
private String nickName;
private int type;
private int gender;
private String birth;
private String email;
private int telephone;
private String psw;
private int state;
public User(String uid, String nickName, int gender, String birth, String email, int telephone) {
super();
this.uid = uid;
this.nickName = nickName;
this.gender = gender;
this.birth = birth;
this.email = email;
this.telephone = telephone;
}
public User() {
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getGender() {
return gender;
}
public void setGender(int gender) {
this.gender = gender;
}
public String getBirth() {
return birth;
}
public void setBirth(String birth) {
this.birth = birth;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getTelephone() {
return telephone;
}
public void setTelephone(int telephone) {
this.telephone = telephone;
}
public String getPsw() {
return psw;
}
public void setPsw(String psw) {
this.psw = psw;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
}
| [
"xinyi.huang96@users.noreply.github.com"
] | xinyi.huang96@users.noreply.github.com |
f1f423d8baaa25d3c14e92b6909b962987878c79 | df9133eacbbb1ee65aa23062c976904d3c543dd3 | /core/src/main/java/com/nvish/awsCSConnector/core/servlets/AWSDeleteAnalysisSchemeServlet.java | 6e2e28bce4c5979dd331978b2f8ff970ec6b8055 | [] | no_license | meghsarora/awsCSConnector | 695a8ed8841e90dfcc9e57117503dddfbe2bfee3 | 695bf526a22ce82d7252bbfd27f08a19f8e8af81 | refs/heads/master | 2022-09-16T19:23:11.118684 | 2020-02-26T12:57:48 | 2020-02-26T12:57:48 | 243,258,901 | 0 | 0 | null | 2022-09-01T23:20:39 | 2020-02-26T12:37:09 | Java | UTF-8 | Java | false | false | 2,238 | java | package com.nvish.awsCSConnector.core.servlets;
//import com.day.cq.wcm.api.Page;
import com.google.gson.JsonObject;
import com.nvish.awsCSConnector.core.services.AWSAnalysisSchemeService;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.resource.ResourceResolverFactory;
import org.apache.sling.api.servlets.HttpConstants;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import java.io.IOException;
@Component(service= Servlet.class,
immediate = true,
property={
"sling.servlet.methods=" + HttpConstants.METHOD_POST,
"sling.servlet.paths=/bin/aws/awsdeleteanalysisschemeservlet"
})
//@SlingServlet(methods = { "POST" }, paths = { "/bin/aws/schemeservlet" })
public class AWSDeleteAnalysisSchemeServlet extends SlingAllMethodsServlet {
private static final long serialVersionUID = 3617806403446339290L;
@Reference
private ResourceResolverFactory resolverFactory;
@Reference
AWSAnalysisSchemeService analysisSchemeService;
private static final Logger LOG = LoggerFactory.getLogger(AWSDeleteAnalysisSchemeServlet.class);
@Override
protected void doPost(final SlingHttpServletRequest request, final SlingHttpServletResponse response)
throws ServletException, IOException {
LOG.info("******in AWSDeleteAnalysisSchemeServlet: ");
String comp = request.getParameter("comp");
JsonObject jsonUplaodStatus = new JsonObject();
try {
if (comp != null && !comp.isEmpty()) {
LOG.info("AWSDeleteAnalysisSchemeServlet schemeName** : " + comp);
jsonUplaodStatus=analysisSchemeService.deleteAnalysisScheme(comp);
LOG.info("JSON UPLOAD STATUS: "+jsonUplaodStatus);
response.getWriter().print(jsonUplaodStatus.toString());
}
}
catch (Exception e){
jsonUplaodStatus.addProperty("status","failure");
LOG.error("Error while Uploading document :", e);
response.getWriter().print(jsonUplaodStatus.toString());
}
}
}
| [
"megha.arora@nvish.com"
] | megha.arora@nvish.com |
e218afe9b08391ed958b718f07dc6f122b1be3c4 | d6194e3a1875bd622d450c09d1aae6e34609e9c9 | /src/stack/ComparativeStackEfficiencyTest.java | edc3a0755eff380c7de8f6ad52449b28e51a548c | [] | no_license | desstiony/Learn_Data_Structure | 076497ba930be88cd6022121edd8c7a9cb409136 | c8526efb10a57b31007b8cbf78d420bdf328d95b | refs/heads/master | 2020-05-07T01:26:10.747967 | 2019-05-21T03:20:51 | 2019-05-21T03:20:51 | 180,272,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,275 | java | package stack;
import org.junit.Test;
import java.util.Random;
/**
* @description: 比较数组栈与链表栈入栈出栈效率
* @author: Mr.gong
* @Data: 2019/5/6 20:34
**/
public class ComparativeStackEfficiencyTest {
/** 操作数量. */
int opCount = 1000000;
public double testStack(Stack<Integer> stack, int opCount){
long startTime = System.nanoTime();
Random random = new Random();
for (int i = 0; i < opCount; i++){
stack.push(random.nextInt(Integer.MAX_VALUE));
}
for (int i = 0; i < opCount; i++){
stack.pop();
}
long endTime = System.nanoTime();
return (endTime - startTime) / 1000000000.0;
}
@Test
public void comparativeQueueEfficiency(){
ArrayStack<Integer> arrayStack = new ArrayStack<>();
double time1 = testStack(arrayStack, opCount);
System.out.println("ArrayStack time is:" + time1 + "s");
LinkedListStack<Integer> linkedListStack = new LinkedListStack<>();
double time2 = testStack(linkedListStack, opCount);
System.out.println("LinkedListStack time is:" + time2 + "s");
// ArrayStack time is:0.103198632s
// LinkedListStack time is:0.328848217s
}
}
| [
"desstiony@163.com"
] | desstiony@163.com |
a421138acb785e7e249eca0bc68472c0e3b89636 | d877fcd4e044cf27adfc93790a86071dd69c6f47 | /src/kandrm/JLatVis/gui/settings/logical/NodeTags.java | 3f8c1f7d8b0166966dca002541cc0592d0198083 | [
"MIT"
] | permissive | blackwolf-cz/JLatVis | c806bd66730ce19df37b0ebf8b7f76da639d8aee | 6cd5581377215d079d7e53801783cfa8cf82e774 | refs/heads/master | 2021-03-12T19:27:20.208303 | 2017-09-08T15:52:05 | 2017-09-08T15:52:05 | 102,878,234 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,358 | java | package kandrm.JLatVis.gui.settings.logical;
import javax.swing.JOptionPane;
import kandrm.JLatVis.guiConnect.settings.logical.NodeTagsModel;
/**
*
* @author Michal Kandr
*/
public class NodeTags extends javax.swing.JDialog {
private NodeTagsModel model;
public NodeTags(java.awt.Frame parent){
this(parent, new NodeTagsModel());
}
public NodeTags(java.awt.Frame parent, NodeTagsModel model) {
super(parent, false);
this.model = model;
initComponents();
}
public NodeTagsModel getModel(){
return model;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
tagsTable = new javax.swing.JTable();
okButton = new javax.swing.JButton();
cancelButton = new javax.swing.JButton();
addButton = new javax.swing.JButton();
removeButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Node tags");
tagsTable.setModel(model);
tagsTable.getTableHeader().setReorderingAllowed(false);
jScrollPane1.setViewportView(tagsTable);
okButton.setText("OK");
okButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
okButtonActionPerformed(evt);
}
});
cancelButton.setText("Cancel");
cancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelButtonActionPerformed(evt);
}
});
addButton.setFont(new java.awt.Font("Tahoma", 1, 14));
addButton.setText("+");
addButton.setMargin(new java.awt.Insets(2, 8, 2, 8));
addButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addButtonActionPerformed(evt);
}
});
removeButton.setFont(new java.awt.Font("Tahoma", 1, 14));
removeButton.setText("-");
removeButton.setMargin(new java.awt.Insets(2, 8, 2, 8));
removeButton.setMaximumSize(new java.awt.Dimension(31, 25));
removeButton.setMinimumSize(new java.awt.Dimension(31, 25));
removeButton.setPreferredSize(new java.awt.Dimension(31, 25));
removeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
removeButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(removeButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(addButton)))
.addGroup(layout.createSequentialGroup()
.addGap(28, 28, 28)
.addComponent(okButton)
.addGap(31, 31, 31)
.addComponent(cancelButton)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(okButton)
.addComponent(cancelButton)))
.addGroup(layout.createSequentialGroup()
.addComponent(addButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(removeButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
model.save();
tagsTable.removeEditor();
dispose();
}//GEN-LAST:event_okButtonActionPerformed
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
tagsTable.removeEditor();
dispose();
}//GEN-LAST:event_cancelButtonActionPerformed
private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed
model.addEmptyRow();
}//GEN-LAST:event_addButtonActionPerformed
private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed
int[] selected = tagsTable.getSelectedRows();
if(selected.length < 1){
return;
}
int confirm = JOptionPane.showConfirmDialog(null, "Chosen tags will be deleted. Delete?", "Delete tags", JOptionPane.YES_NO_OPTION);
if(confirm == 0){
for(int i=selected.length-1; i>=0; --i){
model.removeRow(i);
}
}
}//GEN-LAST:event_removeButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton addButton;
private javax.swing.JButton cancelButton;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JButton okButton;
private javax.swing.JButton removeButton;
private javax.swing.JTable tagsTable;
// End of variables declaration//GEN-END:variables
}
| [
"michal@kandr.name"
] | michal@kandr.name |
6a5dde6dad377fb11b0d6d0df9736ad8d9d3b881 | acc55b6b81551beda92c643f8241aa8bdc0fc843 | /src/main/java/cn/futuremove/adminportal/core/service/JdbcBaseService.java | 127dbad245fcb621f95f37c6e1ae0ed6b3bc9c3e | [] | no_license | renjunqu/adminportal | c8098566c40d99ecfbaa35c591469242915fd87a | 88b3842b7a55222f24dd057d2fc814628ebbaf8e | refs/heads/master | 2021-01-20T07:45:57.222662 | 2015-07-08T11:07:37 | 2015-07-08T11:07:37 | 40,231,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package cn.futuremove.adminportal.core.service;
import javax.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;
import cn.futuremove.adminportal.core.dao.JdbcBaseDao;
/**
*
*
*/
@Transactional
public class JdbcBaseService {
@Resource
protected JdbcBaseDao jdbcBaseDao;
}
| [
"root@figoxudeMacBook-Pro.local"
] | root@figoxudeMacBook-Pro.local |
cfc3a7de320f970597b100c1f2b7c6e7f63a487c | c3e94b6eeae17f7343cfeed51e26794420461bc0 | /iRecommend4App/.svn/pristine/3e/3e8a31dfb4ad9131b5e375f733f50ff2a8424128.svn-base | ea8edd71fc3ab3c3cd38d74e9ead76325348f30d | [] | no_license | zyq11223/recommend-2 | 0ce973f25bcb0582a0db6866132bebf5cfdc1088 | 153aa60cbcf46627df36912296076ce1e5b2f28f | refs/heads/master | 2020-12-22T14:04:59.941568 | 2016-11-15T04:31:40 | 2016-11-15T04:31:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,499 | package com.ifeng.iRecommend.featureEngineering;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.log4j.Logger;
/**
*
* <PRE>
* 作用 : 文本处理工具类
* 包括从文章提取图片url,过滤非法字符,过滤html标签等方法
*
* 使用 :
*
* 示例 :
*
* 注意 :
*
* 历史 :
* -----------------------------------------------------------------------------
* VERSION DATE BY CHANGE/COMMENT
* -----------------------------------------------------------------------------
* 1.0 2015-12-8 hexl create
* -----------------------------------------------------------------------------
* </PRE>
*/
public class TextProTools {
static Logger LOG = Logger.getLogger(TextProTools.class);
/**
* 过滤非法字符
*
* @param str
* @return
*/
public static String filterString(String str) {
String reStr = str;
try {
reStr = reStr.replaceAll("[^(\n\r\t \\!@#$%^&*()_\\-+=\\{\\}\\|\\[\\];:'\"\\<>,\\.?/`~·!@#¥%……&*()——{}【】|、;‘’:《》,。?a-zA-Z0-9\\u4e00-\\u9fa5)]", "");
} catch (Exception e) {
LOG.error("[ERROR] Some error occured in filterString.", e);
LOG.error("[ERROR] filterString str is " + str, e);
return reStr;
}
return reStr;
}
/**
* 从正文中提取图片的url,存储下来,用于在分词完成后再拼接回原位置
*
* @param s
* @return
*/
public static List<String> findPicUrl(String s) {
if (s == null || s.isEmpty())
return null;
s = s.toLowerCase();
List<String> picUrl = new ArrayList<String>();
// 匹配图片的url
Pattern pattern = Pattern.compile("http://.*?.(jpg|jpeg|gif|bmp|png|undefined)");
Matcher matcher = pattern.matcher(s);
int whileFlag = 0;
while (matcher.find()) {
whileFlag++;
if (whileFlag > 200) {
LOG.info("findPicUrl while cycle error.");
}
picUrl.add(matcher.group());
}
if (picUrl.size() >= 1)
return picUrl;
else
return null;
}
/**
* 用于判断文章类型,用于区分doc和docpic,video三种
*
* @param typeInfo
* @return
*/
static public String processDocType(String typeInfo, String other) {
String typeResult = null;
if (other.contains("source=phvideo"))
typeResult = "video";
else if (typeInfo.equals("0")) {
typeResult = "doc";
} else {
typeResult = "docpic";
}
return typeResult;
}
/**
* 过滤html标签
*
* @param s
* @return
*/
public static String filterHtml(String s) {
if (s != null) {
// \n type 1
String str = s.replaceAll("</p>", "</p>\n");
// \n type 2
str = str.replaceAll("<br/>", "<br/>\n");
// mark pictures with special stamp #p#
str = str.replaceAll("<[img|IMG|Img][.[^<]]*/>", "#p#");
// clear all html tags
str = str.replaceAll("<[.[^<]]*>", " ");
return str;
} else {
return s;
}
}
/**
* 过滤html标签
*
* @param s
* @return
*/
public static String filterHtmlPure(String s) {
if (s != null) {
// \n type 1
String str = s.replaceAll("<[.[^<]]*>", "");
str = str.replaceAll("\n", "");
// \n type 2
// str = str.replaceAll("<br/>", "<br/>\n");
// mark pictures with special stamp #p#
// str = str.replaceAll("<[img|IMG|Img][.[^<]]*/>", "#p#");
// clear all html tags
// str = str.replaceAll("<[.[^<]]*>", " ");
return str;
} else {
return s;
}
}
}
| [
"zzb19910123@gmail.com"
] | zzb19910123@gmail.com | |
78f2f4d39cc692550a6022351ebcbffab2a40179 | aad746a0d0e3605095e323229443b7bbb7506d1d | /src/javaMorningExercise.java | b2018f2017d326b94eea09898330d4807dbd30ca | [] | no_license | amadoazua3/codeup-java-exercises | 99140cb54ab41d8c45fc85d0cf79f861a36601cb | a7897b8676646c5132f79fff4aeadc6d5ff1be38 | refs/heads/main | 2023-06-24T23:28:18.227542 | 2021-07-23T02:48:31 | 2021-07-23T02:48:31 | 379,039,403 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,788 | java | import java.util.Arrays;
import java.util.Scanner;
public class javaMorningExercise {
// public static void main(String[] args) {
//
// // Create a method that will return how many capital letters are in a string.
//
// uppercaseCount("HlkeAElkKlW");
//
// }
//
// public static void uppercaseCount(String Str){
//
// int uppercase = 0;
//
// for(int i = 0; i < Str.length(); i++){
//
// if(Character.isUpperCase(Str.charAt(i))){
// uppercase++;
// }
//
// }
// System.out.println("There are " + uppercase + " capital letters in this string.");
// }
// TODO: Create a method which will return a String[] containing the user's favorite vacation spots
// -> Each time the user inputs a new vacation spot, reset the array to be one element longer in length
// -> Then, add the old elements
// -> Finally, add the new element
// -> When the user decides to finish inputting spots, return the String[].
// -> sout out the returned value!
public static void main(String[] args) {
String[] locations = {};
System.out.println("Please input your vacation spot: ");
System.out.println("Press q anytime to exit");
System.out.println(Arrays.toString(vacation(input(), locations)));
}
public static String input(){
Scanner scanner = new Scanner(System.in);
return scanner.nextLine();
}
public static String[] vacation(String input, String[] locations){
String[] result = Arrays.copyOf(locations, locations.length + 1);
result[result.length - 1] = input;
if(!input.equalsIgnoreCase("q")){
vacation(input(), result);
}
return result;
}
}
| [
"amado.azua3@gmail.com"
] | amado.azua3@gmail.com |
25c1b4f33daa4d2920f6f16e0c6c4249da014d7a | a6c71d84a96ab4beb10c81b4d5b9b7ecacd22d25 | /src/modelo/Consulta.java | a6f68cf83a4145104d195c6829e32d048ba06b85 | [] | no_license | Decolinow/AgendaMedico | 88260935f82a120f3cdcc5be4b38d602768f6fc9 | 202fc2a17fbd1c0ce7aa08216fe52ad49a79eae9 | refs/heads/master | 2020-12-24T13:28:38.326215 | 2014-03-12T04:21:22 | 2014-03-12T04:21:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,336 | java | package modelo;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
public class Consulta implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String nomeCliente;
private String nomePlano;
private Medico medico;
private Date data;
private boolean cancelado;
public String getNomeCliente() {
return nomeCliente;
}
public void setNomeCliente(String nomeCliente) {
this.nomeCliente = nomeCliente;
}
public String getNomePlano() {
return nomePlano;
}
public void setNomePlano(String nomePlano) {
this.nomePlano = nomePlano;
}
public Medico getMedico() {
return medico;
}
public void setMedico(Medico medico) {
this.medico = medico;
}
public Date getData() {
return data;
}
public void setData(Date data) {
this.data = data;
}
public boolean isCancelado() {
return cancelado;
}
public void setCancelado(boolean cancelado) {
this.cancelado = cancelado;
}
public Consulta(String nomeCliente, String nomePlano, Medico medico,
Date data, boolean cancelado) {
super();
this.nomeCliente = nomeCliente;
this.nomePlano = nomePlano;
this.medico = medico;
this.data = data;
this.cancelado = cancelado;
}
public String getStatus() {
if (cancelado)
return "Cancelado";
else
return "Confirmado";
}
}
| [
"andrebc@gmail.com"
] | andrebc@gmail.com |
fc2c71626db4a45eeaba68e61516998f4b3f7897 | 7b9c72676bf87569779dbfead42ad591973a2fb7 | /Design Pattern/Singleton/src/edu/najah/cap/SingleObject.java | d08c10fdbc68a28908ee497d6c775d79d1c705ef | [] | no_license | mohmmaddwekat/AdvancedSoftwareDevelopment | cea5b191f3ee5e18caa9328d284fb3167027c306 | 94d042d58d87a5bd66a1dc3e983f519b6ea36088 | refs/heads/main | 2023-08-27T19:38:53.682588 | 2021-09-27T05:43:00 | 2021-09-27T05:43:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 287 | java | package edu.najah.cap;
public class SingleObject {
private static SingleObject instance = null;
public int id = 0;
private SingleObject() {
}
public static SingleObject getInstance() {
if(instance == null) {
instance = new SingleObject();
}
return instance;
}
}
| [
"mustafakassaf@gmail.com"
] | mustafakassaf@gmail.com |
0af9fb05de15e07a6b969509e861ff0cfbae410f | 5598faaaaa6b3d1d8502cbdaca903f9037d99600 | /code_changes/Apache_projects/HDFS-31/947d39b9a3cac447ecc4821f7230ac11c8e93176/~JournalService.java | 5a439996928ecb021b533c1486d5b46f77abcf9a | [] | no_license | SPEAR-SE/LogInBugReportsEmpirical_Data | 94d1178346b4624ebe90cf515702fac86f8e2672 | ab9603c66899b48b0b86bdf63ae7f7a604212b29 | refs/heads/master | 2022-12-18T02:07:18.084659 | 2020-09-09T16:49:34 | 2020-09-09T16:49:34 | 286,338,252 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 15,716 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hdfs.server.journalservice;
import java.io.IOException;
import java.net.InetSocketAddress;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.DFSUtil;
import org.apache.hadoop.hdfs.NameNodeProxies;
import org.apache.hadoop.hdfs.protocol.UnregisteredNodeException;
import org.apache.hadoop.hdfs.protocol.proto.JournalProtocolProtos.JournalProtocolService;
import org.apache.hadoop.hdfs.protocol.proto.JournalSyncProtocolProtos.JournalSyncProtocolService;
import org.apache.hadoop.hdfs.protocolPB.JournalProtocolPB;
import org.apache.hadoop.hdfs.protocolPB.JournalProtocolServerSideTranslatorPB;
import org.apache.hadoop.hdfs.protocolPB.JournalSyncProtocolPB;
import org.apache.hadoop.hdfs.protocolPB.JournalSyncProtocolServerSideTranslatorPB;
import org.apache.hadoop.hdfs.protocolPB.JournalSyncProtocolTranslatorPB;
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NamenodeRole;
import org.apache.hadoop.hdfs.server.protocol.FenceResponse;
import org.apache.hadoop.hdfs.server.protocol.FencedException;
import org.apache.hadoop.hdfs.server.protocol.JournalInfo;
import org.apache.hadoop.hdfs.server.protocol.JournalServiceProtocols;
import org.apache.hadoop.hdfs.server.protocol.JournalSyncProtocol;
import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocol;
import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration;
import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo;
import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest;
import org.apache.hadoop.ipc.ProtobufRpcEngine;
import org.apache.hadoop.ipc.RPC;
import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.security.UserGroupInformation;
import com.google.common.annotations.VisibleForTesting;
import com.google.protobuf.BlockingService;
/**
* This class interfaces with the namenode using {@link JournalProtocol} over
* RPC. It has two modes: <br>
* <ul>
* <li>Mode where an RPC.Server is provided from outside, on which it
* {@link JournalProtocol} is registered. The RPC.Server stop and start is
* managed outside by the application.</li>
* <li>Stand alone mode where an RPC.Server is started and managed by the
* JournalListener.</li>
* </ul>
*
* The received journal operations are sent to a listener over callbacks. The
* listener implementation can handle the callbacks based on the application
* requirement.
*/
public class JournalService implements JournalServiceProtocols {
public static final Log LOG = LogFactory.getLog(JournalService.class.getName());
private final InetSocketAddress nnAddress;
private NamenodeRegistration registration;
private final NamenodeProtocol namenode;
private final StateHandler stateHandler = new StateHandler();
private final RPC.Server rpcServer;
private long epoch = 0;
private String fencerInfo;
private final Journal journal;
private final JournalListener listener;
enum State {
/** The service is initialized and ready to start. */
INIT(false, false),
/**
* RPC server is started.
* The service is ready to receive requests from namenode.
*/
STARTED(false, false),
/** The service is fenced by a namenode and waiting for roll. */
WAITING_FOR_ROLL(false, true),
/**
* The existing log is syncing with another source
* and it accepts journal from Namenode.
*/
SYNCING(true, true),
/** The existing log is in sync and it accepts journal from Namenode. */
IN_SYNC(true, true),
/** The service is stopped. */
STOPPED(false, false);
final boolean isJournalAllowed;
final boolean isStartLogSegmentAllowed;
State(boolean isJournalAllowed, boolean isStartLogSegmentAllowed) {
this.isJournalAllowed = isJournalAllowed;
this.isStartLogSegmentAllowed = isStartLogSegmentAllowed;
}
}
static class StateHandler {
State current = State.INIT;
synchronized void start() {
if (current != State.INIT) {
throw new IllegalStateException("Service cannot be started in "
+ current + " state.");
}
current = State.STARTED;
}
synchronized void waitForRoll() {
if (current != State.STARTED) {
throw new IllegalStateException("Cannot wait-for-roll in " + current
+ " state.");
}
current = State.WAITING_FOR_ROLL;
}
synchronized void startLogSegment() {
if (current == State.WAITING_FOR_ROLL) {
current = State.SYNCING;
}
}
synchronized void isStartLogSegmentAllowed() throws IOException {
if (!current.isStartLogSegmentAllowed) {
throw new IOException("Cannot start log segment in " + current
+ " state.");
}
}
synchronized void isJournalAllowed() throws IOException {
if (!current.isJournalAllowed) {
throw new IOException("Cannot journal in " + current + " state.");
}
}
synchronized boolean isStopped() {
if (current == State.STOPPED) {
LOG.warn("Ignore stop request since the service is in " + current
+ " state.");
return true;
}
current = State.STOPPED;
return false;
}
}
/**
* Constructor to create {@link JournalService} where an RPC server is
* created by this service.
* @param conf Configuration
* @param nnAddr host:port for the active Namenode's RPC server
* @param serverAddress address to start RPC server to receive
* {@link JournalProtocol} requests. This can be null, if
* {@code server} is a valid server that is managed out side this
* service.
* @param listener call-back interface to listen to journal activities
* @throws IOException on error
*/
JournalService(Configuration conf, InetSocketAddress nnAddr,
InetSocketAddress serverAddress, JournalListener listener)
throws IOException {
this.nnAddress = nnAddr;
this.listener = listener;
this.journal = new Journal(conf);
this.namenode = NameNodeProxies.createNonHAProxy(conf, nnAddr,
NamenodeProtocol.class, UserGroupInformation.getCurrentUser(), true)
.getProxy();
this.rpcServer = createRpcServer(conf, serverAddress, this);
}
Journal getJournal() {
return journal;
}
synchronized NamenodeRegistration getRegistration() {
if (!journal.isFormatted()) {
throw new IllegalStateException("Journal is not formatted.");
}
if (registration == null) {
registration = new NamenodeRegistration(
NetUtils.getHostPortString(rpcServer.getListenerAddress()), "",
journal.getStorage(), NamenodeRole.BACKUP);
}
return registration;
}
/**
* Start the service.
*/
public void start() {
stateHandler.start();
// Start the RPC server
LOG.info("Starting journal service rpc server");
rpcServer.start();
for (boolean registered = false, handshakeComplete = false;;) {
try {
// Perform handshake
if (!handshakeComplete) {
handshake();
handshakeComplete = true;
LOG.info("handshake completed");
}
// Register with the namenode
if (!registered) {
registerWithNamenode();
registered = true;
LOG.info("Registration completed");
break;
}
} catch (IOException ioe) {
LOG.warn("Encountered exception ", ioe);
} catch (Exception e) {
LOG.warn("Encountered exception ", e);
}
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {
LOG.warn("Encountered exception ", ie);
}
}
stateHandler.waitForRoll();
try {
namenode.rollEditLog();
} catch (IOException e) {
LOG.warn("Encountered exception ", e);
}
}
/**
* Stop the service. For application with RPC Server managed outside, the
* RPC Server must be stopped the application.
*/
public void stop() throws IOException {
if (!stateHandler.isStopped()) {
rpcServer.stop();
journal.close();
}
}
@Override
public void journal(JournalInfo journalInfo, long epoch, long firstTxnId,
int numTxns, byte[] records) throws IOException {
if (LOG.isTraceEnabled()) {
LOG.trace("Received journal " + firstTxnId + " " + numTxns);
}
stateHandler.isJournalAllowed();
verify(epoch, journalInfo);
listener.journal(this, firstTxnId, numTxns, records);
}
@Override
public void startLogSegment(JournalInfo journalInfo, long epoch, long txid)
throws IOException {
if (LOG.isTraceEnabled()) {
LOG.trace("Received startLogSegment " + txid);
}
stateHandler.isStartLogSegmentAllowed();
verify(epoch, journalInfo);
listener.startLogSegment(this, txid);
stateHandler.startLogSegment();
}
@Override
public FenceResponse fence(JournalInfo journalInfo, long epoch,
String fencerInfo) throws IOException {
LOG.info("Fenced by " + fencerInfo + " with epoch " + epoch);
// It is the first fence if the journal is not formatted,
if (!journal.isFormatted()) {
journal.format(journalInfo.getNamespaceId(), journalInfo.getClusterId());
}
verifyFence(epoch, fencerInfo);
verify(journalInfo.getNamespaceId(), journalInfo.getClusterId());
long previousEpoch = epoch;
this.epoch = epoch;
this.fencerInfo = fencerInfo;
// TODO:HDFS-3092 set lastTransId and inSync
return new FenceResponse(previousEpoch, 0, false);
}
@Override
public RemoteEditLogManifest getEditLogManifest(JournalInfo journalInfo,
long sinceTxId) throws IOException {
if (LOG.isTraceEnabled()) {
LOG.trace("Received getEditLogManifest " + sinceTxId);
}
if (!journal.isFormatted()) {
throw new IOException("This journal service is not formatted.");
}
verify(journalInfo.getNamespaceId(), journalInfo.getClusterId());
//journal has only one storage directory
return journal.getRemoteEditLogs(sinceTxId);
}
/** Create an RPC server. */
private static RPC.Server createRpcServer(Configuration conf,
InetSocketAddress address, JournalServiceProtocols impl) throws IOException {
RPC.setProtocolEngine(conf, JournalProtocolPB.class,
ProtobufRpcEngine.class);
JournalProtocolServerSideTranslatorPB xlator =
new JournalProtocolServerSideTranslatorPB(impl);
BlockingService service =
JournalProtocolService.newReflectiveBlockingService(xlator);
JournalSyncProtocolServerSideTranslatorPB syncXlator =
new JournalSyncProtocolServerSideTranslatorPB(impl);
BlockingService syncService =
JournalSyncProtocolService.newReflectiveBlockingService(syncXlator);
RPC.Server rpcServer = RPC.getServer(JournalProtocolPB.class, service,
address.getHostName(), address.getPort(), 1, false, conf, null);
DFSUtil.addPBProtocol(conf, JournalSyncProtocolPB.class, syncService,
rpcServer);
return rpcServer;
}
private void verifyEpoch(long e) throws FencedException {
if (epoch != e) {
String errorMsg = "Epoch " + e + " is not valid. "
+ "Resource has already been fenced by " + fencerInfo
+ " with epoch " + epoch;
LOG.warn(errorMsg);
throw new FencedException(errorMsg);
}
}
private void verifyFence(long e, String fencer) throws FencedException {
if (e <= epoch) {
String errorMsg = "Epoch " + e + " from fencer " + fencer
+ " is not valid. " + "Resource has already been fenced by "
+ fencerInfo + " with epoch " + epoch;
LOG.warn(errorMsg);
throw new FencedException(errorMsg);
}
}
/**
* Verifies a journal request
*/
private void verify(int nsid, String clusid) throws IOException {
String errorMsg = null;
final NamenodeRegistration reg = getRegistration();
if (nsid != reg.getNamespaceID()) {
errorMsg = "Invalid namespaceID in journal request - expected "
+ reg.getNamespaceID() + " actual " + nsid;
LOG.warn(errorMsg);
throw new UnregisteredNodeException(errorMsg);
}
if ((clusid == null)
|| (!clusid.equals(reg.getClusterID()))) {
errorMsg = "Invalid clusterId in journal request - incoming "
+ clusid + " expected " + reg.getClusterID();
LOG.warn(errorMsg);
throw new UnregisteredNodeException(errorMsg);
}
}
/**
* Verifies a journal request
*/
private void verify(long e, JournalInfo journalInfo) throws IOException {
verifyEpoch(e);
verify(journalInfo.getNamespaceId(), journalInfo.getClusterId());
}
/**
* Register this service with the active namenode.
*/
private void registerWithNamenode() throws IOException {
NamenodeRegistration nnReg = namenode.register(getRegistration());
String msg = null;
if(nnReg == null) { // consider as a rejection
msg = "Registration rejected by " + nnAddress;
} else if(!nnReg.isRole(NamenodeRole.NAMENODE)) {
msg = " Name-node " + nnAddress + " is not active";
}
if(msg != null) {
LOG.error(msg);
throw new IOException(msg); // stop the node
}
}
private void handshake() throws IOException {
NamespaceInfo nsInfo = namenode.versionRequest();
listener.verifyVersion(this, nsInfo);
// If this is the first initialization of journal service, then storage
// directory will be setup. Otherwise, nsid and clusterid has to match with
// the info saved in the edits dir.
if (!journal.isFormatted()) {
journal.format(nsInfo.getNamespaceID(), nsInfo.getClusterID());
} else {
verify(nsInfo.getNamespaceID(), nsInfo.getClusterID());
}
}
@VisibleForTesting
long getEpoch() {
return epoch;
}
public static JournalSyncProtocol createProxyWithJournalSyncProtocol(
InetSocketAddress address, Configuration conf, UserGroupInformation ugi)
throws IOException {
RPC.setProtocolEngine(conf, JournalSyncProtocolPB.class,
ProtobufRpcEngine.class);
Object proxy = RPC.getProxy(JournalSyncProtocolPB.class,
RPC.getProtocolVersion(JournalSyncProtocolPB.class), address, ugi,
conf, NetUtils.getDefaultSocketFactory(conf), 30000);
return new JournalSyncProtocolTranslatorPB((JournalSyncProtocolPB) proxy);
}
}
| [
"archen94@gmail.com"
] | archen94@gmail.com |
6dbe60190e53a74ec383dc480e14d34d763b76a1 | 51f049c3c8855cb847dff80c981a745be3f68b90 | /app/src/main/java/br/com/dev/felipeferreira/netflixapp/model/FilmeDetalhes.java | d2e99f1b39d9fd7a9b451260f00aacf63a31ca77 | [] | no_license | felipeferreira-dev/NetflixApp | f9ca38d2c1784a7a5bc4e36a18d800419b0a3d7a | 57430940c3a629a7ece288197b67a7bf1bb5be03 | refs/heads/master | 2023-07-05T12:59:50.517427 | 2021-08-06T04:29:29 | 2021-08-06T04:29:29 | 331,941,919 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 577 | java | /*
* *
* * Março, 03 2021
* *
* * @author dev.felipeferreira@gmail.com (Felipe Ferreira).
*
*/
package br.com.dev.felipeferreira.netflixapp.model;
import java.util.List;
public class FilmeDetalhes {
private final Filme filme;
private final List<Filme> filmesSimilar;
public FilmeDetalhes(Filme filme, List<Filme> filmesSimilar) {
this.filme = filme;
this.filmesSimilar = filmesSimilar;
}
public Filme getFilme() {
return filme;
}
public List<Filme> getFilmesSimilar() {
return filmesSimilar;
}
}
| [
"dev.felipeferreira@gmail.com"
] | dev.felipeferreira@gmail.com |
70468f76989c3a49c5eb767ce2a45064e8340c35 | e85b4ef0fd9fb4d56e63bb8fe6f28001feeb97b2 | /build/tmp/recompileMc/sources/net/minecraft/block/BlockTrapDoor.java | 51b0b5cf4300126defed3f30c1a6730a2d6e5af3 | [] | no_license | kieranjazy/Chromatic-Engineering | c51fecbfc4b3dee8fee9a8c71649288c62c45893 | 78df5b912b9a58edcdf5ebd12ee3b5a89c0fcfc4 | refs/heads/master | 2021-01-01T15:28:28.584483 | 2018-03-01T14:48:01 | 2018-03-01T14:48:01 | 94,486,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,019 | java | package net.minecraft.block;
import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockTrapDoor extends Block
{
public static final PropertyDirection FACING = BlockHorizontal.FACING;
public static final PropertyBool OPEN = PropertyBool.create("open");
public static final PropertyEnum<BlockTrapDoor.DoorHalf> HALF = PropertyEnum.<BlockTrapDoor.DoorHalf>create("half", BlockTrapDoor.DoorHalf.class);
protected static final AxisAlignedBB EAST_OPEN_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.1875D, 1.0D, 1.0D);
protected static final AxisAlignedBB WEST_OPEN_AABB = new AxisAlignedBB(0.8125D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
protected static final AxisAlignedBB SOUTH_OPEN_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.1875D);
protected static final AxisAlignedBB NORTH_OPEN_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.8125D, 1.0D, 1.0D, 1.0D);
protected static final AxisAlignedBB BOTTOM_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.1875D, 1.0D);
protected static final AxisAlignedBB TOP_AABB = new AxisAlignedBB(0.0D, 0.8125D, 0.0D, 1.0D, 1.0D, 1.0D);
protected BlockTrapDoor(Material materialIn)
{
super(materialIn);
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(OPEN, Boolean.valueOf(false)).withProperty(HALF, BlockTrapDoor.DoorHalf.BOTTOM));
this.setCreativeTab(CreativeTabs.REDSTONE);
}
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
AxisAlignedBB axisalignedbb;
if (((Boolean)state.getValue(OPEN)).booleanValue())
{
switch ((EnumFacing)state.getValue(FACING))
{
case NORTH:
default:
axisalignedbb = NORTH_OPEN_AABB;
break;
case SOUTH:
axisalignedbb = SOUTH_OPEN_AABB;
break;
case WEST:
axisalignedbb = WEST_OPEN_AABB;
break;
case EAST:
axisalignedbb = EAST_OPEN_AABB;
}
}
else if (state.getValue(HALF) == BlockTrapDoor.DoorHalf.TOP)
{
axisalignedbb = TOP_AABB;
}
else
{
axisalignedbb = BOTTOM_AABB;
}
return axisalignedbb;
}
/**
* Used to determine ambient occlusion and culling when rebuilding chunks for render
*/
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
public boolean isFullCube(IBlockState state)
{
return false;
}
public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
{
return !((Boolean)worldIn.getBlockState(pos).getValue(OPEN)).booleanValue();
}
/**
* Called when the block is right clicked by a player.
*/
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (this.blockMaterial == Material.IRON)
{
return false;
}
else
{
state = state.cycleProperty(OPEN);
worldIn.setBlockState(pos, state, 2);
this.playSound(playerIn, worldIn, pos, ((Boolean)state.getValue(OPEN)).booleanValue());
return true;
}
}
protected void playSound(@Nullable EntityPlayer player, World worldIn, BlockPos pos, boolean p_185731_4_)
{
if (p_185731_4_)
{
int i = this.blockMaterial == Material.IRON ? 1037 : 1007;
worldIn.playEvent(player, i, pos, 0);
}
else
{
int j = this.blockMaterial == Material.IRON ? 1036 : 1013;
worldIn.playEvent(player, j, pos, 0);
}
}
/**
* Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
* change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
* block, etc.
*/
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
{
if (!worldIn.isRemote)
{
boolean flag = worldIn.isBlockPowered(pos);
if (flag || blockIn.getDefaultState().canProvidePower())
{
boolean flag1 = ((Boolean)state.getValue(OPEN)).booleanValue();
if (flag1 != flag)
{
worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(flag)), 2);
this.playSound((EntityPlayer)null, worldIn, pos, flag);
}
}
}
}
/**
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
* IBlockstate
*/
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
IBlockState iblockstate = this.getDefaultState();
if (facing.getAxis().isHorizontal())
{
iblockstate = iblockstate.withProperty(FACING, facing).withProperty(OPEN, Boolean.valueOf(false));
iblockstate = iblockstate.withProperty(HALF, hitY > 0.5F ? BlockTrapDoor.DoorHalf.TOP : BlockTrapDoor.DoorHalf.BOTTOM);
}
else
{
iblockstate = iblockstate.withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(OPEN, Boolean.valueOf(false));
iblockstate = iblockstate.withProperty(HALF, facing == EnumFacing.UP ? BlockTrapDoor.DoorHalf.BOTTOM : BlockTrapDoor.DoorHalf.TOP);
}
if (worldIn.isBlockPowered(pos))
{
iblockstate = iblockstate.withProperty(OPEN, Boolean.valueOf(true));
}
return iblockstate;
}
/**
* Check whether this Block can be placed on the given side
*/
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side)
{
return true;
}
protected static EnumFacing getFacing(int meta)
{
switch (meta & 3)
{
case 0:
return EnumFacing.NORTH;
case 1:
return EnumFacing.SOUTH;
case 2:
return EnumFacing.WEST;
case 3:
default:
return EnumFacing.EAST;
}
}
protected static int getMetaForFacing(EnumFacing facing)
{
switch (facing)
{
case NORTH:
return 0;
case SOUTH:
return 1;
case WEST:
return 2;
case EAST:
default:
return 3;
}
}
/**
* Convert the given metadata into a BlockState for this Block
*/
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(FACING, getFacing(meta)).withProperty(OPEN, Boolean.valueOf((meta & 4) != 0)).withProperty(HALF, (meta & 8) == 0 ? BlockTrapDoor.DoorHalf.BOTTOM : BlockTrapDoor.DoorHalf.TOP);
}
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
/**
* Convert the BlockState into the correct metadata value
*/
public int getMetaFromState(IBlockState state)
{
int i = 0;
i = i | getMetaForFacing((EnumFacing)state.getValue(FACING));
if (((Boolean)state.getValue(OPEN)).booleanValue())
{
i |= 4;
}
if (state.getValue(HALF) == BlockTrapDoor.DoorHalf.TOP)
{
i |= 8;
}
return i;
}
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
}
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
}
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {FACING, OPEN, HALF});
}
public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
{
return (p_193383_4_ == EnumFacing.UP && p_193383_2_.getValue(HALF) == BlockTrapDoor.DoorHalf.TOP || p_193383_4_ == EnumFacing.DOWN && p_193383_2_.getValue(HALF) == BlockTrapDoor.DoorHalf.BOTTOM) && !((Boolean)p_193383_2_.getValue(OPEN)).booleanValue() ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
}
@Override
public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity)
{
if (state.getValue(OPEN))
{
IBlockState down = world.getBlockState(pos.down());
if (down.getBlock() == net.minecraft.init.Blocks.LADDER)
return down.getValue(BlockLadder.FACING) == state.getValue(FACING);
}
return false;
}
public static enum DoorHalf implements IStringSerializable
{
TOP("top"),
BOTTOM("bottom");
private final String name;
private DoorHalf(String name)
{
this.name = name;
}
public String toString()
{
return this.name;
}
public String getName()
{
return this.name;
}
}
} | [
"kieranjayes@hotmail.com"
] | kieranjayes@hotmail.com |
53523be865d8de70cd0efe779572b66b5bb26a4a | 8315a5638199dfc53287217ff453df84c255fdc9 | /src/main/java/com/tcp/stack/tool/MenuUtil.java | 2d1c3ef047538018b7634e9c09b2018fb4156ea1 | [] | no_license | dongqihuang/stack | 33ec94b13ead4fb91d0cfe9374e726df6b4ced7c | 50ee2b9e70581d86f4b9a772d8a5cd1be40bbbd1 | refs/heads/master | 2021-09-26T15:16:15.976897 | 2018-10-31T08:52:47 | 2018-10-31T08:52:47 | 90,632,198 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,231 | java | package com.tcp.stack.tool;
import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class MenuUtil {
public static void openMenu(WebDriver driver, String menu, String subMenu) {
try {
WebDriverWait driverWait = new WebDriverWait(driver, 10);
WebElement menuDiv = driverWait.until(ExpectedConditions.visibilityOfElementLocated(By.id("mCSB_1_container")));
if(menuDiv != null) {
// 判断“主机”菜单是否是打开状态,如果否则打开或选中状态
WebElement sidebarItem = menuDiv.findElement(By.linkText(menu)).findElement(By.xpath(".."));
String sidebarItemClass = sidebarItem.getAttribute("class");
if(!sidebarItemClass.contains("open") && !sidebarItemClass.contains("selected")) {
sidebarItem.click();
}
if(StringUtils.isNotBlank(subMenu)) {
driverWait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText(subMenu))).click();
}
}else{
// 获取菜单列表失败
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"huangdongqi@tuscloud.io"
] | huangdongqi@tuscloud.io |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.