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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cfba60dca25a68fc62083fca21326f5c9ba00890 | 070b3a569147462ec542e4d7e805d79d296c1fc6 | /server/bundles/com.zizibujuan.drip.server.util/src/com/zizibujuan/drip/server/util/servlet/RequestUtil.java | ebe82bd596925a1ac866c3d4666805a019c245af | [] | no_license | hobos/baosuzhai | b4693012196089a1e5b6b74364ffd761b36badad | 012b76c8870dde4e78fc06f06042d204b686b51f | refs/heads/master | 2023-09-01T20:40:06.874640 | 2014-04-19T02:42:36 | 2014-04-19T02:42:36 | 5,047,705 | 0 | 0 | null | 2023-08-28T23:10:46 | 2012-07-14T13:43:17 | JavaScript | UTF-8 | Java | false | false | 1,807 | java | package com.zizibujuan.drip.server.util.servlet;
import java.io.IOException;
import java.io.StringWriter;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.io.IOUtils;
import org.apache.struts2.json.JSONException;
import org.apache.struts2.json.JSONUtil;
import com.zizibujuan.drip.server.exception.json.JSONAccessException;
/**
* http请求帮助类
* @author jinzw
* @since 0.0.1
*/
public abstract class RequestUtil {
@SuppressWarnings("unchecked")
public static Map<String,Object> fromJsonObject(HttpServletRequest req) throws IOException{
Object o = deserializeJson(req);
Map<String,Object> result = (Map<String,Object>)o;
return result;
}
@SuppressWarnings("unchecked")
public static List<Map<String,Object>> fromJsonArray(HttpServletRequest req) throws IOException{
Object o = deserializeJson(req);
return (List<Map<String,Object>>)o;
}
private static Object deserializeJson(HttpServletRequest req) throws IOException {
StringWriter sw = new StringWriter();
IOUtils.copy(req.getInputStream(), sw,"UTF-8");
Object o = null;
try {
o = JSONUtil.deserialize(sw.toString());
} catch (JSONException e) {
throw new JSONAccessException(e);
}
return o;
}
private static final String HEADER_REQUESTED_WITH = "X-Requested-With";//$NON-NLS-1$
private static final String VALUE_REQUESTED_WITH = "XMLHttpRequest";//$NON-NLS-1$
/**
* 判断请求是否是ajax请求。如果返回false,则是页面跳转。
* @param req
* @return 是则返回true;否则返回false
*/
public static boolean isAjax(HttpServletRequest req) {
String xRequestedWith = req.getHeader(HEADER_REQUESTED_WITH);
if(VALUE_REQUESTED_WITH.equals(xRequestedWith)){
return true;
}
return false;
}
}
| [
"zhengwei.jin@gmail.com"
] | zhengwei.jin@gmail.com |
2b2e316df5561ac6d799e76de774653b6fb29495 | a3d8c5dd7b37c92d464cb10e485d429f2734145c | /src/com/j2assembly/resources/helpers/Interrupt.java | 0d610004d0502ea88a27aec7342a060ed3614af7 | [] | no_license | 34638a/j2assembly | 4f9c45e489ac57206bce88f94ed122962cd721af | f4a48495fbe507ae0d632210cd74290ec429388f | refs/heads/master | 2021-01-16T17:53:13.479861 | 2019-08-22T05:53:52 | 2019-08-22T05:53:52 | 100,021,622 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 461 | java | package com.j2assembly.resources.helpers;
import java.lang.annotation.Documented;
/**
* A Java wrapper for Interrupts on a microprocessor.
* Please consult the relevant interrupt methods that are supported by your specific micro-controller.
*/
@Documented
public @interface Interrupt {
/**
* The String literal for the name of the interrupt.
* @return The name of the interrupt that this function should be called on.
*/
String interuptName();
}
| [
"jordanr123@bigpond.com"
] | jordanr123@bigpond.com |
c7a2b8c4962cf9b4e6f451551c1f6af587a07abc | 5e1908113d37c2d6b109a5c4db64b1bd54e53b4a | /src/CountCompleteTreeNodes.java | d1ded514d6e66a30b7a2f8e7eacebd50905d4bd8 | [] | no_license | yanshuhang/leetcode | 637f57f1518f78f4c9ac2f570ce54a00700689f5 | 7a85ef99d1183cad5b89b8baa8dea8b1e3a2fcce | refs/heads/main | 2023-07-18T19:19:14.720987 | 2021-09-07T05:13:14 | 2021-09-07T05:13:14 | 318,226,918 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,858 | java | import java.util.HashMap;
public class CountCompleteTreeNodes {
public int solution(TreeNode root) {
if (root == null) {
return 0;
}
int height = 0;
TreeNode node = root;
while (node.left != null) {
node = node.left;
height++;
}
int low = 1 << height;
int high = (1 << (height + 1)) - 1;
while (low <= high) {
int mid = (low + high) >>> 1;
if (exits(root, height, mid)) {
low = mid + 1;
} else {
high = mid - 1;
}
}
return low - 1;
}
public boolean exits(TreeNode root, int height, int k) {
int bits = 1 << (height - 1);
TreeNode node = root;
while (node != null && bits > 0) {
if ((bits & k) == 0) {
node = node.left;
} else {
node = node.right;
}
bits >>= 1;
}
return node != null;
}
// 递归
public int solution1(TreeNode root) {
if (root == null) {
return 0;
}
return solution1(root.left) + solution1(root.right) + 1;
}
public static void main(String[] args) {
HashMap<Integer, TreeNode> map = new HashMap<>();
for (int i = 0; i < 800 ; i++) {
map.put(i, new TreeNode(i));
}
for (int i = 0; i < 800; i++) {
TreeNode node = map.get(i);
TreeNode left = map.get((i << 1) + 1);
TreeNode right = map.get((i << 1) + 2);
node.left = left;
node.right = right;
}
TreeNode root = map.get(0);
System.out.println(new CountCompleteTreeNodes().solution(root));
System.out.println(new CountCompleteTreeNodes().solution1(root));
}
}
| [
"sytem.out@hotmail.com"
] | sytem.out@hotmail.com |
a03a189d96830e605a569b11af809852843fe548 | 1f5ccce96219c0d3c5022ef45e21f00391556821 | /src/main/java/cn/yusite/hello/maven/release/module/a/ModuleAApplication.java | 9fff12c6b19fbe9c4f79aae26fe0e1f8a7c04d93 | [] | no_license | msjie/module-a | 48ddbf4aaf6beca04be65aa0fdfd2a8486d3c83c | 4d90045e1334e034d17a574bf235f1ad830cc78d | refs/heads/master | 2020-11-25T08:14:29.841450 | 2019-12-18T03:11:39 | 2019-12-18T03:11:39 | 228,570,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package cn.yusite.hello.maven.release.module.a;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
*
*
* @author shijie
*/
@SpringBootApplication
public class ModuleAApplication {
public static void main(String[] args) {
SpringApplication.run(ModuleAApplication.class);
}
}
| [
"ligongdamao@163.com"
] | ligongdamao@163.com |
c56d625c4b4ac44c6f31b516b4bc3366a0efc034 | 6e1e0c0c5ae109c6f115045a0cd5b269b84dc816 | /Programowanie_Obiektowe/Projekt1/JBibtexParser/JBibtexParser/fieldparser/IFieldParser.java | 202e877f39aafe35da94c3c05602dee1421bf3f6 | [] | no_license | aleqsio/Studies | 8100b79e3ec3ba3c31fbc0b5e6d389b5e0e851ce | 15baea38daee1654b829a9d036c61855e4b139dd | refs/heads/master | 2021-01-19T18:40:03.409534 | 2018-04-05T10:54:56 | 2018-04-05T10:54:56 | 88,372,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,250 | java | package JBibtexParser.fieldparser;
import JBibtexParser.entry.entries.StringEntry;
import JBibtexParser.typemanager.EntryField;
import JBibtexParser.util.LeveledString;
import JBibtexParser.util.exceptions.ParseErrorException;
import java.util.List;
/**
* A simple parser of a single field's contents - used for string substitutions - can also be used for adding custom behaviour based on provided {@link LeveledString} and {@link EntryField}
*/
public interface IFieldParser {
/**
* final transformation a single field's value before being added to a {@link JBibtexParser.bibliography.IBibliographyManager}
* @param fieldString - field's contents
* @param stringEntries - a list of string entries used for substitutions
* @param field - field type from either {@link JBibtexParser.typemanager.definitions.BibtexDefinition} or a custom definition implementing {@link JBibtexParser.typemanager.definitions.IDefinition} provided to the parser
* @return A list of subfields - for example single authors can be divided into separate strings
* @throws ParseErrorException
*/
List<String> parseField(LeveledString fieldString, List<StringEntry> stringEntries, EntryField field) throws ParseErrorException;
}
| [
"mikucki@gmail.com"
] | mikucki@gmail.com |
ef83fbbe6fbe7e5657e342ce4c160cdd8213c4fa | 4c26a13c6ae0663dcd713b10576fd2a7f40cb055 | /src/KNN_Combiner.java | 365d63897f8c98e4371081038bc2d1fd8a1c3d28 | [] | no_license | machongshen/Hadoop_KNN | ea51d3926b20f4c38602cfa12c99df9db5dd6ec3 | 6d16a692c1cd25f5865d881eca037c9fc67231a0 | refs/heads/master | 2021-01-19T17:11:24.044679 | 2015-03-11T01:54:52 | 2015-03-11T01:54:52 | 30,472,228 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 990 | java | import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
import Utils.*;
/**
* @author machongshen
*/
public class KNN_Combiner extends Reducer<IntWritable, Storage_Vector, IntWritable, Storage_Vector> {
protected void reduce(
IntWritable key,
java.lang.Iterable<Storage_Vector> value,
org.apache.hadoop.mapreduce.Reducer<IntWritable, Storage_Vector, IntWritable, Storage_Vector>.Context context)
throws java.io.IOException, InterruptedException {
LinkedList<Storage_Vector> vs = new LinkedList<Storage_Vector>();
// sort each vector2SF by similarty
for (Storage_Vector v : value) {
vs.add(new Storage_Vector(v.getV1(), v.getV2(), v.getV3()));
//System.out.println("V3=" + v.getV3());
}
for (int i = 0; i < vs.size(); i++) {
context.write(key, vs.get(i));
}
};
} | [
"machongshen@gmail.com"
] | machongshen@gmail.com |
f9797de6744437bae8032cb93014db03f08654cb | a735cdc7ef3fb3f405acfeffe993f0fed8e83d2e | /edu.tamu.cse.aser.d4/src/edu/tamu/aser/tide/views/ITreeNode.java | 8699fef8ffa4e500dabb9706cd5c6e32edda05c0 | [
"MIT"
] | permissive | parasol-aser/D4 | 75ea5efc65f66940ede52604b53a45eb116f4a8f | 890191c50df6f8879288463dc39f32f7f6f29b7a | refs/heads/master | 2021-03-27T20:10:42.706597 | 2020-02-18T21:48:21 | 2020-02-18T21:48:21 | 121,303,297 | 21 | 2 | null | null | null | null | UTF-8 | Java | false | false | 304 | java | package edu.tamu.aser.tide.views;
import java.util.ArrayList;
import org.eclipse.jface.resource.ImageDescriptor;
public interface ITreeNode {
public String getName();
public ImageDescriptor getImage();
public ArrayList getChildren();
public boolean hasChildren();
public ITreeNode getParent();
}
| [
"april1989@tamu.edu"
] | april1989@tamu.edu |
8707873a38677ce9597f3e6d043190aa97ebd1c0 | 62d8ad3266544b459a8751f7f760653d246c47b8 | /java/src/main/java/Leetcode/Biweek70/NumberOfWaysToDivideALongCorridor.java | fe976a02521b176ba8bf24aa9546c3730a459ed3 | [] | no_license | ymlai87416/algorithm_practice | 9311f9f54625f6a706d9432d6b0a5ca6be9b73b9 | f04daba988982f45e63623e76b1953e8b56fbfad | refs/heads/master | 2023-04-15T23:30:34.137070 | 2023-03-30T23:05:21 | 2023-03-30T23:05:21 | 58,758,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,245 | java | package Leetcode.Biweek70;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
problem: https://leetcode.com/problems/number-of-ways-to-divide-a-long-corridor/
level: hard
solution: DP is TLE only way is to use math
#math
**/
public class NumberOfWaysToDivideALongCorridor {
Map<String, Integer> result = new HashMap<>();
public int numberOfWays(String corridor) {
/*
result.clear();
int ts = 0;
for (int i = 0; i < corridor.length(); i++) {
if(corridor.charAt(i) == 'S') ts+=1;
}
if(ts%2 == 1) return 0;
return dpHelper(corridor);
*/
return combination(corridor);
}
public int combination(String corridor){
int seat = 0;
int interPlant = 0;
int startS=-1, endS=-1;
int ts = 0;
for (int i = 0; i <corridor.length(); i++) {
char ci = corridor.charAt(i);
if(ci == 'S'){
ts +=1;
if(startS == -1) startS = i;
if(endS < i) endS = i;
}
}
if(ts%2 ==1) return 0;
if(ts == 0)return 0;
List<Integer> interPlantList = new ArrayList<>();
for (int i = startS; i < endS+1; i++) {
char ci = corridor.charAt(i);
if(ci == 'S') seat += 1;
if(seat==3){
seat=1;
interPlantList.add(interPlant);
interPlant = 0;
}
else if(seat==2 && ci == 'P'){
interPlant +=1;
}
}
long t = 1;
for (Integer i: interPlantList) {
t = t * (i+1) % 1000000007;
}
return (int)t;
}
//even dp get time limited exceeded.
public int dpHelper(String corridor){
//we cannot count the way one by one
//we can continue to count if there is a plant, dp
if(corridor.length() == 0)
return 1;
//System.out.println("D2 " + corridor);
if(result.containsKey(corridor)) return result.get(corridor);
int seat = 0;
long way = 0;
for(int i=0; i<corridor.length(); ++i){
if(corridor.charAt(i) == 'S') {
seat += 1;
if (seat == 2){
way = (way + dpHelper(corridor.substring(i+1)) ) % 1000000007;
}
else if(seat == 3)
break;
}
else if(corridor.charAt(i) == 'P'){
if (seat==2){
way = (way + dpHelper(corridor.substring(i+1)) ) % 1000000007;
}
}
}
//System.out.println("D " + corridor + " " + way);
result.put(corridor, (int)way);
return (int)way;
}
public static void main(String[] args){
String s1 = "SSPPSPS";
String s2 = "PPSPSP";
String s3 = "S";
NumberOfWaysToDivideALongCorridor s = new NumberOfWaysToDivideALongCorridor();
System.out.println(s.numberOfWays(s1));
System.out.println(s.numberOfWays(s2));
System.out.println(s.numberOfWays(s3));
}
}
| [
"ymlai87416@gmail.com"
] | ymlai87416@gmail.com |
80a63dd2410e5ab5087847f1bf8cfbb76babbd5b | bafdd44d155f950c91c1c11c7796c0cbcf2dff5c | /Semestre 2/Java/TD/TD8/Pays.java | 5d614e81eed759c1142dbb3d367c45c7c0ec332a | [] | no_license | Julien-PRD/L3 | 9f3b586eebef6180f27293de27ba0b6311e6f750 | bb5efe0751022a2b24ab8f8c58fbf73428b89f1c | refs/heads/main | 2023-04-07T00:20:35.770793 | 2021-04-10T18:37:14 | 2021-04-10T18:37:14 | 352,746,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,584 | java | /**
* @author LeNomDeLEtudiant
* @version 0.1 : Date : Tue Mar 09 13:31:35 CET 2021
*
*/
import java.util.*;
import static java.util.stream.Collectors.*;
public class Pays {
private String nom;
private List<Ville> villes;
public Pays(String nom) {
super();
this.nom = nom;
villes = new ArrayList<Ville>();
}
/**
* @return the nom
*/
public String getNom() {
return nom;
}
/**
* @return the villes
*/
public List<Ville> getVilles() {
return villes;
}
public void ajouteVille(Ville v){
this.villes.add(v);
}
/* Question 5 */
/**
* @return Les habitants du pays
*/
public List<Personne> getHabitants(){
/*return villes.stream()
.map(Ville::getHabitants)
.flatMap(List::stream)
.collect(toList());
*/
return this.getVilles().stream()
.flatMap(v -> v.getHabitants().stream())
.collect(toList());
}
/* Question 6 */
/**
* @return La ville la plus peuplé
*/
public Optional<Ville> plusGrosseVille(){
return villes.stream()
.max(Comparator.comparing(Ville::getPopulation));
}
public Optional<Ville> plusGrandeVille(){
return villes.stream()
.reduce((v1,v2) -> v1.getPopulation() > v2.getPopulation() ? v1 : v2 );
}
/* Question 7 */
/**
* @return Moyenne d'age des habitants
*/
public OptionalDouble moyenneAge(){
return villes.stream()
.flatMap(v -> v.getHabitants().stream())
.mapToInt(Personne::getAge)
.average();
}
} | [
"julien.proudy@gmail.com"
] | julien.proudy@gmail.com |
20035b4b453a8d5b9121ebb4a1e58833afc768a4 | 1d5761fabc1f108e5b78120f93e7e8fa5cd64480 | /app/src/androidTest/java/cc/brainbook/study/mypermission/ExampleInstrumentedTest.java | 33b76aea54f55fd4029ab0a4e22d5338706dc4cb | [] | no_license | yongtiger/android-study-MyPermission | e05753a25a534e5d4dda3eddc15f184e9b97a017 | dff303b5f2d7b14accce5dda47beb159e3c95c59 | refs/heads/master | 2020-05-02T15:16:27.983436 | 2019-03-27T17:26:49 | 2019-03-27T17:26:49 | 178,035,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package cc.brainbook.study.mypermission;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("cc.brainbook.study.mypermission", appContext.getPackageName());
}
}
| [
"brainbook.cc@outlook.com"
] | brainbook.cc@outlook.com |
5c309d321141472e78d0b6617a7d8323359f182e | 17e5218b2758416c3246097cc1da3c5f80efc54f | /src/com/ibm/achievement/service/FindUserByActiveFlagResponse.java | e38535a39bb5a2c2f31f770ccf1b0ad5285c0f74 | [] | no_license | aufbakanleitung/AchievementTrackerSturt2 | ea138c537401b2ebc17c38e19eea4b290a1b54aa | fc7cf7e20a036394abab11217ebe3bb740caa458 | refs/heads/master | 2021-01-11T00:48:06.817750 | 2016-10-14T07:50:49 | 2016-10-14T07:50:49 | 70,485,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,129 | java | //
// Generated By:JAX-WS RI IBM 2.1.6 in JDK 6 (JAXB RI IBM JAXB 2.1.10 in JDK 6)
//
package com.ibm.achievement.service;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for findUserByActiveFlagResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="findUserByActiveFlagResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="return" type="{http://service.achievement.ibm.com/}employeeVO" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "findUserByActiveFlagResponse", namespace = "http://service.achievement.ibm.com/", propOrder = {
"_return"
})
public class FindUserByActiveFlagResponse {
@XmlElement(name = "return")
protected List<EmployeeVO> _return;
/**
* Gets the value of the return property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the return property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getReturn().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link EmployeeVO }
*
*
*/
public List<EmployeeVO> getReturn() {
if (_return == null) {
_return = new ArrayList<EmployeeVO>();
}
return this._return;
}
}
| [
"hermanvanderveer@hermans-mbp.groningen.nl.ibm.com"
] | hermanvanderveer@hermans-mbp.groningen.nl.ibm.com |
68a60b83bffcb53cdd77a7505e4c6852753b49d3 | 6076f795f68959a9618c6f5d9098fb4236bb43ef | /src/main/java/com/yiche/psc/rpse/neo4jTools/common/domain/po/Make.java | e71ab3c454ec82abc1fba4e387ed588a84595f91 | [] | no_license | weiker/Neo4j-Tools | e9f1704be21e8e9aa04dc5c040580013e92ac2cd | e960b124c86959eec3e104ce5cabf05a476e3a5f | refs/heads/master | 2021-05-07T17:02:40.967214 | 2017-10-31T02:36:45 | 2017-10-31T02:36:45 | 108,698,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,253 | java | package com.yiche.psc.rpse.neo4jTools.common.domain.po;
import java.util.Date;
public class Make {
private Integer id;
private Integer countryid;
private Integer countryclass;
private Integer masterbrandid;
private Integer manufacturerid;
private String name;
private String othername;
private String englishname;
private String phone;
private String website;
private String logo;
private String spell;
private String allspell;
private String namespell;
private String nameallspell;
private Integer salestatus;
private Boolean isenabled;
private Boolean isremoved;
private Date updatetime;
private Date createtime;
private Date dotime;
private String introduction;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCountryid() {
return countryid;
}
public void setCountryid(Integer countryid) {
this.countryid = countryid;
}
public Integer getCountryclass() {
return countryclass;
}
public void setCountryclass(Integer countryclass) {
this.countryclass = countryclass;
}
public Integer getMasterbrandid() {
return masterbrandid;
}
public void setMasterbrandid(Integer masterbrandid) {
this.masterbrandid = masterbrandid;
}
public Integer getManufacturerid() {
return manufacturerid;
}
public void setManufacturerid(Integer manufacturerid) {
this.manufacturerid = manufacturerid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getOthername() {
return othername;
}
public void setOthername(String othername) {
this.othername = othername;
}
public String getEnglishname() {
return englishname;
}
public void setEnglishname(String englishname) {
this.englishname = englishname;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getWebsite() {
return website;
}
public void setWebsite(String website) {
this.website = website;
}
public String getLogo() {
return logo;
}
public void setLogo(String logo) {
this.logo = logo;
}
public String getSpell() {
return spell;
}
public void setSpell(String spell) {
this.spell = spell;
}
public String getAllspell() {
return allspell;
}
public void setAllspell(String allspell) {
this.allspell = allspell;
}
public String getNamespell() {
return namespell;
}
public void setNamespell(String namespell) {
this.namespell = namespell;
}
public String getNameallspell() {
return nameallspell;
}
public void setNameallspell(String nameallspell) {
this.nameallspell = nameallspell;
}
public Integer getSalestatus() {
return salestatus;
}
public void setSalestatus(Integer salestatus) {
this.salestatus = salestatus;
}
public Boolean getIsenabled() {
return isenabled;
}
public void setIsenabled(Boolean isenabled) {
this.isenabled = isenabled;
}
public Boolean getIsremoved() {
return isremoved;
}
public void setIsremoved(Boolean isremoved) {
this.isremoved = isremoved;
}
public Date getUpdatetime() {
return updatetime;
}
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
public Date getDotime() {
return dotime;
}
public void setDotime(Date dotime) {
this.dotime = dotime;
}
public String getIntroduction() {
return introduction;
}
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
} | [
"weiqiang@yiche.com"
] | weiqiang@yiche.com |
5c94fabf557007e1531dfd3305fda85df1198d7a | ad68211cea0269485814938f352136801bc8dce5 | /main/java/com/anirudh/anirudhswami/personalassistant/AddContact.java | 8e09187a98a4f7b147561cdf2dbc042174156534 | [] | no_license | Anirudh-Swaminathan/MoneyManagerAndroid | 39c415640cc3e0b5750551ce39ea925b0a0b9ea5 | cd748f1b7ae702b9adc3efa1c44453d669363c8a | refs/heads/master | 2020-07-14T01:12:39.806095 | 2016-09-10T01:36:07 | 2016-09-10T01:36:07 | 67,843,310 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,516 | java | package com.anirudh.anirudhswami.personalassistant;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
public class AddContact extends AppCompatActivity {
private static String roll;
EditText name;
EditText number;
DbHelper AniDb;
Bitmap bitmap = null;
byte[] photo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_contact);
SharedPreferences spf = AddContact.this.getSharedPreferences(AddContact.this.getString(R.string.app_name), Context.MODE_PRIVATE);
if (!spf.getBoolean("loginStat", false)) {
Toast.makeText(AddContact.this, "Please Login to continue", Toast.LENGTH_SHORT).show();
Intent i = new Intent(AddContact.this, MainActivity.class);
startActivity(i);
}
roll = spf.getString("rollNumb","");
//Toast.makeText(AddContact.this,"Roll is "+roll,Toast.LENGTH_SHORT).show();
name= (EditText) findViewById(R.id.nameAdd);
number = (EditText) findViewById(R.id.numberAdd);
AniDb = new DbHelper(this);
((Button) findViewById(R.id.addData)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String na = name.getText().toString();
String nu = number.getText().toString();
//the following is code for image-insertion
if(bitmap == null) {
bitmap = ((BitmapDrawable) getResources().getDrawable(R.mipmap.ic_launcher)).getBitmap();
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
photo = baos.toByteArray();
ByteArrayInputStream imageStream = new ByteArrayInputStream(photo);
Bitmap theImage= BitmapFactory.decodeStream(imageStream);
ImageView img_here = (ImageView) findViewById(R.id.imageView2);
img_here.setImageBitmap(theImage);
//stops here
if(na.equals("")||nu.equals("")){
Toast.makeText(AddContact.this,"Enter a name and number ",Toast.LENGTH_SHORT).show();
}
else{
boolean inser = AniDb.insertContact(na, nu, photo, roll);
if(inser){
Toast.makeText(AddContact.this,"Data Inserted SCCESSFULLY!",Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(AddContact.this,"Data Couldn't be inserted Successfully",Toast.LENGTH_SHORT).show();
}
}
//update();
Intent i = new Intent(AddContact.this,Contacts.class);
startActivity(i);
finish();
}
});
((Button) findViewById(R.id.tak_pik)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i =new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i,1);
}
});
}
@Override
protected void onActivityResult(int requestCode,int resultCode,Intent data){
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == RESULT_OK){
Bundle bdn = data.getExtras();
Bitmap btm = (Bitmap) bdn.get("data");
bitmap = btm;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
photo = baos.toByteArray();
ImageView img_here = (ImageView) findViewById(R.id.imageView2);
img_here.setImageBitmap(btm);
}
}
}
| [
"aniswami97@gmail.com"
] | aniswami97@gmail.com |
bdf1058e432f6a412b0509acfb05131734ea5a16 | 3e0fa492f30dbb3188cf5110938996dbf654c1e5 | /TPs JAVA et Angular/Java projects/src/Point.java | 911d1695d54a6e332cbd561e992d897378972b1e | [] | no_license | MTeycheney/Formation-JEE | 885afd96a2dd59fd5794c65d9bfacc66cab19884 | 57d35427105043e531c15e70f4fc858efd873807 | refs/heads/master | 2021-10-08T09:44:09.849151 | 2018-12-10T18:49:57 | 2018-12-10T18:49:57 | 156,735,836 | 1 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,287 | java | import java.io.Serializable;
public class Point implements Serializable
{
/**
*
*/
private static final long serialVersionUID = -6142265591080980286L;
private int abscisse;
private int ordonnee;
static final int init_x = 0;
static final int init_y = 0;
public Point(int abs, int ord)
{
abscisse = abs;
ordonnee = ord;
}
/*
* TP12
*/
public Point()
{
this.abscisse = init_x;
this.ordonnee = init_y;
}
public int getX()
{
return abscisse;
}
public int getY()
{
return ordonnee;
}
public String toString()
{
String coor = "[" + getX() + ";" + getY() + "]";
return coor;
}
/*
* TP11: Compléter la classe Point avec une méthode equals qui renvoie vrai si et seulement les X et les Y des
deux points comparés sont les mêmes.
*/
protected Point clone()
{
return new Point(abscisse, ordonnee);
}
public boolean Equals(Object obj)
{
if(obj instanceof Point)
{
Point point = (Point) obj;
return (this.abscisse == point.abscisse) && (this.ordonnee == point.ordonnee);
}
else
{
return false;
}
}
public double distance(Point p)
{
int dx = p.getX() - this.getX();
int dy = p.getY() - this.getY();
int dx2 = dx * dx;
int dy2 = dy * dy;
return Math.sqrt(dx2 + dy2);
}
}
| [
"maxime.teycheney@gmail.com"
] | maxime.teycheney@gmail.com |
62055e6aa9c841299b825d4e91c84d825680a176 | e32b0fd6472ebbefe5b30786a9eb8242c413f7cc | /Lesson10Drink/src/com/company/Drink.java | d12621dc6f61dee87363da5a1409e86e8899908b | [] | no_license | SZabirov/Java_ITIS_2018 | d970a9226d8d74ad8da081b75e601affe897a80f | ba015c41b0953bb944cece409054a2a3314bfb4a | refs/heads/master | 2021-04-28T21:02:11.060025 | 2018-05-05T15:35:44 | 2018-05-05T15:35:44 | 121,942,677 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 146 | java | package com.company;
public class Drink {
String name;
void open() {
System.out.println("Напиток открыт");
}
}
| [
"zab.sal42@gmail.com"
] | zab.sal42@gmail.com |
6822156976641ceacec8b26d511e29656d8a13e6 | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /ant_cluster/24325/src_1607.java | 4c4aee6957f118e877966310af80d31faaab2cc7 | [
"Apache-2.0",
"BSD-2-Clause",
"Apache-1.1"
] | permissive | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,944 | 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.tools.ant.util;
/**
* BASE 64 encoding of a String or an array of bytes.
*
* Based on RFC 1421.
*
**/
public class Base64Converter {
private static final int BYTE_MASK = 0xFF;
private static final char[] ALPHABET = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 0 to 7
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 8 to 15
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 16 to 23
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', // 24 to 31
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', // 32 to 39
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', // 40 to 47
'w', 'x', 'y', 'z', '0', '1', '2', '3', // 48 to 55
'4', '5', '6', '7', '8', '9', '+', '/'}; // 56 to 63
// CheckStyle:ConstantNameCheck OFF - bc
/** Provided for BC purposes */
public static final char[] alphabet = ALPHABET;
// CheckStyle:ConstantNameCheck ON
/**
* Encode a string into base64 encoding.
* @param s the string to encode.
* @return the encoded string.
*/
public String encode(String s) {
return encode(s.getBytes());
}
/**
* Encode a byte array into base64 encoding.
* @param octetString the byte array to encode.
* @return the encoded string.
*/
public String encode(byte[] octetString) {
int bits24;
int bits6;
char[] out = new char[((octetString.length - 1) / 3 + 1) * 4];
int outIndex = 0;
int i = 0;
while ((i + 3) <= octetString.length) {
// store the octets
bits24 = (octetString[i++] & BYTE_MASK) << 16;
bits24 |= (octetString[i++] & BYTE_MASK) << 8;
bits24 |= octetString[i++];
bits6 = (bits24 & 0x00FC0000) >> 18;
out[outIndex++] = ALPHABET[bits6];
bits6 = (bits24 & 0x0003F000) >> 12;
out[outIndex++] = ALPHABET[bits6];
bits6 = (bits24 & 0x00000FC0) >> 6;
out[outIndex++] = ALPHABET[bits6];
bits6 = (bits24 & 0x0000003F);
out[outIndex++] = ALPHABET[bits6];
}
if (octetString.length - i == 2) {
// store the octets
bits24 = (octetString[i] & BYTE_MASK) << 16;
bits24 |= (octetString[i + 1] & BYTE_MASK) << 8;
bits6 = (bits24 & 0x00FC0000) >> 18;
out[outIndex++] = ALPHABET[bits6];
bits6 = (bits24 & 0x0003F000) >> 12;
out[outIndex++] = ALPHABET[bits6];
bits6 = (bits24 & 0x00000FC0) >> 6;
out[outIndex++] = ALPHABET[bits6];
// padding
out[outIndex++] = '=';
} else if (octetString.length - i == 1) {
// store the octets
bits24 = (octetString[i] & BYTE_MASK) << 16;
bits6 = (bits24 & 0x00FC0000) >> 18;
out[outIndex++] = ALPHABET[bits6];
bits6 = (bits24 & 0x0003F000) >> 12;
out[outIndex++] = ALPHABET[bits6];
// padding
out[outIndex++] = '=';
out[outIndex++] = '=';
}
return new String(out);
}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
593e42b920caa5191c1cf6f8e64daf1ac1a41fa3 | 2df75ad287977c1884367aa09a089d52fd9c5bec | /LeetCode/src/main/java/Test.java | 1d9bdf17ee5e694ab440a6ff297e9a527e981b64 | [] | no_license | shadowjljp/Algorithms_Java | c09184afe300e1d0885a411520703eb2fa26dfa4 | 40d80a00b291baf768c6f799a63f68dc20d53fd6 | refs/heads/master | 2023-08-01T15:43:42.504865 | 2021-09-16T02:20:21 | 2021-09-16T02:20:21 | 283,597,849 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | public class Test {
public static void main(String[] args) {
// double d = Double.POSITIVE_INFINITY;
// double e = Double.POSITIVE_INFINITY;
int x=-4;
System.out.println(x >>= 1);
}
}
| [
"40411574+shadowjljp@users.noreply.github.com"
] | 40411574+shadowjljp@users.noreply.github.com |
240f452633a7a0812aaebdaf73682b137fea4b4f | ce79ade8c6f027adacf61bce3a6159b7a34b6c5a | /src/main/java/spring5/demo4/aopanno/PersonProxy.java | 69e9ff67e3b42b62ef2353401774b3e29e424a93 | [] | no_license | Keroly/Java-Note | af738807dd72816e92f1c0dca7175c9880f2defb | 13ff37083a8b18bf2acf5c0b0bf92424265a8c98 | refs/heads/master | 2023-04-21T02:42:18.269750 | 2021-05-13T04:47:30 | 2021-05-13T04:47:30 | 207,996,035 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package spring5.demo4.aopanno;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
@Component
@Aspect
@Order(1)
public class PersonProxy {
//后置通知(返回通知)
@Before(value = "execution(* spring5.demo4.aopanno.User.add(..))")
public void afterReturning() {
System.out.println("Person Before.........");
}
}
| [
"15122112779@163.com"
] | 15122112779@163.com |
bdb9a49b6799e84ec78ccdaccfbcb8923b9f7c93 | bbdef892f1cc3530ba2df8723d67f7fb65cfc90d | /app/src/main/java/com/example/foodrecommend/HttpThreads/UploadingRatingThread.java | 53d80abd491da0e10a446df8b128a5e676c46858 | [] | no_license | x554536080/FoodRecommend | 9fd4ee53cbdb1de693f7c1a03b84e05a807f2f88 | ff348e398c0b41e4e6048399a93fd514273c09c6 | refs/heads/master | 2023-01-08T17:19:44.332419 | 2020-11-13T18:35:46 | 2020-11-13T18:35:46 | 312,654,530 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,530 | java | package com.example.foodrecommend.HttpThreads;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import com.example.foodrecommend.MainActivity;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
public class UploadingRatingThread extends Thread {
String fid;
String fType;
String score;
Handler handler;
public UploadingRatingThread(String fid, String fType, String score, Handler handler) {
this.fid = fid;
this.fType = fType;
this.score = score;
this.handler = handler;
}
@Override
public void run() {
JSONObject jsonObject;
try {
BufferedReader reader;
HttpURLConnection connection;
URL url = new URL("http://192.168.43.24:8080/FoodRecommend/BasicServices?function=addingRating&username=" + MainActivity.username
+ "&fType=" + fType + "&score=" + score);
StringBuilder resultData = new StringBuilder();
//配置connection
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
// connection.setReadTimeout(20000);
connection.setConnectTimeout(5000);
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setInstanceFollowRedirects(true);
int code;
if ((code = connection.getResponseCode()) == HttpURLConnection.HTTP_OK) {
reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
resultData.append(line);
}
reader.close();
}
connection.disconnect();
Log.d("respondCode", code + "");
jsonObject = new JSONObject(resultData.toString());
String result = jsonObject.getString("result");
if (!result.equals("failed")) {
Message message = new Message();
message.what = 2;
handler.sendMessage(message);
}
} catch (Exception e) {
Log.e("xds", e.toString());
}
}
}
| [
"554536080@qq.com"
] | 554536080@qq.com |
05f486bf5c4e8e33ed0f87fa67950df1b8bf8bc9 | 2b65e8173ca6ae07bd190daaa1fbbb1a19211824 | /codigo/estagio/src/test/java/br/ufu/cti/estagio/testes/carlos/extra2/Aviao.java | 061cf38f03170acc8120d4334e460a2e176b2afc | [
"Apache-2.0"
] | permissive | cti-ufu/estagio-cti | 1bd5a9ff4346f09f29a309249aad111a58c2a2ee | 08d105653c971293fd6e655345733389db820483 | refs/heads/master | 2021-01-12T19:18:13.514719 | 2016-04-18T12:46:37 | 2016-04-18T12:46:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 886 | java | package br.ufu.cti.estagio.testes.carlos.extra2;
public class Aviao {
private String modelo;
private long identificador;
private int capacidadeDePassageiros;
public Aviao(String modelo, long identificador, int capacidadeDePassageiros) {
this.modelo = modelo;
this.identificador = identificador;
this.capacidadeDePassageiros = capacidadeDePassageiros;
}
public void setModelo(String modelo) {
this.modelo = modelo;
}
public String getModelo() {
return modelo;
}
public void setIdentificador(long identificador) {
this.identificador = identificador;
}
public long getIdentificador() {
return identificador;
}
public void setCapacidadeDePassageiros(int capacidadeDePassageiros) {
this.capacidadeDePassageiros = capacidadeDePassageiros;
}
public long getCapacidadeDePassageiros() {
return capacidadeDePassageiros;
}
}
| [
"carloshumberto1990@gmail.com"
] | carloshumberto1990@gmail.com |
892a966923cb3e95907fb08979b822b0ad4022e0 | b588c020c92215b82a3de44cbe833fb6b15e071b | /src/site/com/lsxyz/baolu/site/common/ConfigurationHelper.java | c12cb04f59d8f8529451b8d923b1bd63a6415e8d | [] | no_license | xiyang/baolu | 5f43bd11d0141d38583df27693bc86a52b19225b | 68d45fbfb52c82f709a2e4f42d28d1d9ac25f998 | refs/heads/master | 2021-01-19T00:46:19.496867 | 2010-11-26T07:51:35 | 2010-11-26T07:51:35 | 1,113,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,571 | java | package com.lsxyz.baolu.site.common;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class ConfigurationHelper {
private static Logger logger = Logger.getLogger(ConfigurationHelper.class);
private static final String CONFIGURATION_FILE = "/config/jdbc.properties";
private static final String CONFIGURATION_COMMON_FILE = "/config/common.properties";
// initializing block for load configuration file
static {
InputStream is = ConfigurationHelper.class.getClassLoader().getResourceAsStream(CONFIGURATION_FILE);
InputStream commonInputStream = ConfigurationHelper.class.getClassLoader().getResourceAsStream(CONFIGURATION_COMMON_FILE);
if (is == null) {
throw new RuntimeException("Cannot find Configuration file" + ConfigurationHelper.CONFIGURATION_FILE);
}
Properties properties = new Properties();
Properties commonProperties = new Properties();
Properties emailFromProperties = new Properties();
Properties posterMailToProperties = new Properties();
Properties reviewMailToProperties = new Properties();
Properties payMailToProperties = new Properties();
Properties payEURMailToProperties = new Properties();
try {
properties.load(is);
commonProperties.load(commonInputStream);
} catch (IOException e) {
logger.error("Read configuration file " + ConfigurationHelper.CONFIGURATION_FILE, e);
throw new RuntimeException("Read configuration file " + ConfigurationHelper.CONFIGURATION_FILE, e);
}
}
}
| [
"notfish7925@gmail.com"
] | notfish7925@gmail.com |
0c8854ff593890e4885e7dc18f89caf788e31914 | aba8e92b03fa20ba78be3594a020cec67e80fa3e | /demo/src/test/java/com/example/demo/dao/UserDAOTest.java | f895e29b8f5b8d8db57528fa7e53b188fb7ff295 | [] | no_license | hugodog0313/demo | 5949bedf4fa57313eb9b9060841df68bfbb1169b | 8684670ff76ae8a6099bca11045eb87b65bfdd04 | refs/heads/main | 2023-03-27T04:52:10.822239 | 2021-03-25T08:25:53 | 2021-03-25T08:25:53 | 350,224,368 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,052 | java | package com.example.demo.dao;
import com.example.demo.vo.UserVO;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mybatis.spring.boot.test.autoconfigure.MybatisTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.test.context.ActiveProfiles;
import javax.sql.DataSource;
import java.util.Optional;
@MybatisTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
//@ContextConfiguration("application.yml")
@ActiveProfiles("test")
public class UserDAOTest {
@Autowired
UserDAO userDAO;
@Autowired
DataSource dataSource;
UserVO userVO;
@BeforeEach
public void setUp(){
String id = "3";
String name= "Hugo";
String tel = "0987654321";
Integer age = 50;
userVO = new UserVO(id,name,tel,age);
}
@Test
public void add(){
int i = userDAO.add(userVO);
Assertions.assertEquals(i,1);
}
@Test
public void findByUserId(){
// userDAO.add(userVO);
Optional<UserVO> optional = userDAO.findByUserId("2");
UserVO userVO = optional.get();
System.out.println(userVO.getId()+userVO.getName());
Assertions.assertNotNull(userVO);
}
@Test
public void delete(){
userDAO.add(userVO);
int i = userDAO.deleteByUserId("3");
Optional<UserVO> optional = userDAO.findByUserId("3");
Assertions.assertTrue(optional.isEmpty());
Assertions.assertEquals(i,1);
}
@Test
public void updateByUseId(){
userDAO.add(userVO);
userVO.setName("Aluba");
userVO.setTel("0912345678");
userVO.setAge(100);
int i = userDAO.updateByUserId(userVO);
Assertions.assertEquals(i,1);
Assertions.assertEquals("Aluba",userVO.getName());
Assertions.assertEquals("Aluba",userVO.getName());
}
}
| [
"71684522+hugodog0313@users.noreply.github.com"
] | 71684522+hugodog0313@users.noreply.github.com |
d578e0993424d20dc6b8514777c45f08e2efb98f | 0bb33fdf1fa0a48da553e2b6436c92f19680ac83 | /src/main/java/com/apps/bean/Dorm.java | 1cc95d76aaa4d5fd7f01c3631e3ca82be4681ef8 | [] | no_license | a280126366/dormitory | 944e9f077154304e029648f405cf588f7df64ac9 | de4d543ba9b96fd30a08a98ed03d3ddd28d069e0 | refs/heads/master | 2021-02-24T17:50:15.133727 | 2020-03-06T15:06:56 | 2020-03-06T15:06:56 | 245,436,950 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,451 | java | package com.apps.bean;
public class Dorm {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dorm.dor_id
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
private String dorId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dorm.dor_qua
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
private String dorQua;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dorm.dor_cost
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
private Double dorCost;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dorm.dor_num
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
private Integer dorNum;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dorm.dor_in_num
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
private Integer dorInNum;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dorm.dor_houid
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
private String dorHouid;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dorm.dor_id
*
* @return the value of dorm.dor_id
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
public String getDorId() {
return dorId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dorm.dor_id
*
* @param dorId the value for dorm.dor_id
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
public void setDorId(String dorId) {
this.dorId = dorId == null ? null : dorId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dorm.dor_qua
*
* @return the value of dorm.dor_qua
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
public String getDorQua() {
return dorQua;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dorm.dor_qua
*
* @param dorQua the value for dorm.dor_qua
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
public void setDorQua(String dorQua) {
this.dorQua = dorQua == null ? null : dorQua.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dorm.dor_cost
*
* @return the value of dorm.dor_cost
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
public Double getDorCost() {
return dorCost;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dorm.dor_cost
*
* @param dorCost the value for dorm.dor_cost
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
public void setDorCost(Double dorCost) {
this.dorCost = dorCost;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dorm.dor_num
*
* @return the value of dorm.dor_num
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
public Integer getDorNum() {
return dorNum;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dorm.dor_num
*
* @param dorNum the value for dorm.dor_num
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
public void setDorNum(Integer dorNum) {
this.dorNum = dorNum;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dorm.dor_in_num
*
* @return the value of dorm.dor_in_num
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
public Integer getDorInNum() {
return dorInNum;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dorm.dor_in_num
*
* @param dorInNum the value for dorm.dor_in_num
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
public void setDorInNum(Integer dorInNum) {
this.dorInNum = dorInNum;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dorm.dor_houid
*
* @return the value of dorm.dor_houid
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
public String getDorHouid() {
return dorHouid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dorm.dor_houid
*
* @param dorHouid the value for dorm.dor_houid
*
* @mbg.generated Thu Mar 05 18:28:22 CST 2020
*/
public void setDorHouid(String dorHouid) {
this.dorHouid = dorHouid == null ? null : dorHouid.trim();
}
} | [
"weizhancheng123@163.com"
] | weizhancheng123@163.com |
d75077b03706d34f5726988cbb10bfa069b317b0 | 2e11c6914b517a40b3f16a164272c771629c1f4c | /src/main/java/com/zum/pilot/repository/PostRepository.java | ec0f7100d410dc1aec6ef22b96e95df49b3b3449 | [] | no_license | uwangg/PilotProject | 7a0f6b7f1e07cf270630caba044b09cd1d80c16b | d201b37947e7d1a9188b79b197c69a22910656e4 | refs/heads/master | 2021-01-18T15:30:34.247395 | 2017-06-26T02:09:39 | 2017-06-26T02:09:39 | 86,659,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package com.zum.pilot.repository;
import com.zum.pilot.entity.PostEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface PostRepository extends JpaRepository<PostEntity, Long> {
Page<PostEntity> findAllByDeleteFlag(boolean deleteFlag, Pageable pageable);
PostEntity findByIdAndDeleteFlag(Long id, boolean deleteFlag);
List<PostEntity> findAllByUserEntityIdAndDeleteFlag(Long userId, boolean deleteFlag);
}
| [
"uwangg@gmail.com"
] | uwangg@gmail.com |
661d73d03407bf33313e5f7b333a8da874ca2fed | d9b86ee9663f043af48fec3327fa7ecf5c299889 | /app/src/main/java/com/victorai60/jetty/DoWebSocket.java | 38317744d58a8304ea19e8301a99ced669c32745 | [] | no_license | VictorAndroidPractice/WebSocket | 13a606fa1e292af913c0c2858bc0380dc593ea30 | acc59b5cad56ce650cac4fde8a654ebd76d910ec | refs/heads/master | 2021-01-18T15:29:49.760773 | 2017-03-30T03:47:46 | 2017-03-30T03:47:46 | 86,656,216 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 795 | java | package com.victorai60.jetty;
import org.eclipse.jetty.websocket.*;
import java.io.IOException;
class DoWebSocket implements WebSocket.OnTextMessage {
private Connection mConnection;
@Override
public void onMessage(String data) {
System.out.println("onMessage: " + data);
if (mConnection != null) {
try {
mConnection.sendMessage("Hello " + data);
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public void onOpen(Connection connection) {
mConnection = connection;
WebSocketHandler.getBroadcast().add(this);
}
@Override
public void onClose(int code, String message) {
WebSocketHandler.getBroadcast().remove(this);
}
}
| [
"zheng.song@menpuji.com"
] | zheng.song@menpuji.com |
9b5e40eaf2c26d00d3df750d3c31ca9b8d8044ff | 489cfc88d6f2a1eab17f509abba21f9b39e137bc | /src/Loading.java | ef16082de600ff23a1d3654698a01ee4ea08d9fa | [] | no_license | z2oo/ThinkinginJava | e1c2111af1660514208184f6e26aaf4d93a5dda5 | a921f16bd2e495a61e53abbe3ac1a8053699c5db | refs/heads/master | 2021-08-24T00:58:41.619524 | 2017-12-07T10:29:10 | 2017-12-07T10:29:10 | 113,436,558 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,064 | java | import java.util.Arrays;
/**
* Created by Asus on 2017/11/21.
*/
public class Loading {
public static float loading(float c, float [] w, int [] x) {
int n = w.length;
Element[] d = new Element[n];
for (int i = 0; i < n; i++)
d[i] = new Element(w[i], i);
quickSort(d, 0, n - 1);
float opt = 0;
for (int i = 0; i < n; i++) x[i] = 0;
for (int i = 0; i < n && d[i].w <= c; i++) {
x[d[i].i] = 1;
opt += d[i].w;
c -= d[i].w;
}
return opt;
}
public static void main(String[] args){
float[] w={4,3,1,2,3};
float c=6;
int[] x=new int[w.length];
System.out.println("集装箱的体积分别为:");
for(int i=0;i<w.length;i++){
System.out.print(w[i]+" ");
}
System.out.println();
loading(c,w,x);
System.out.println("可以将以下的号数的集装箱放入船上,使得集装箱的数量最多:");
for(int i=0;i<w.length;i++){
if(x[i]==1)
System.out.print((i+1)+" ");
}
}
private static void quickSort(Element[] list, int first, int last) {
if (last > first) { //长度大于1
int pivotIndex = partition(list, first, last); //将list一分为二,pivotIndex为主元位置
quickSort(list, first, pivotIndex - 1); //对左数组递归排序
quickSort(list, pivotIndex + 1, last); //对右数组递归排序
}
}
private static int partition(Element[] list, int first, int last) { //使用主元划分数组list[first...last]
Element pivot = list[first]; //将子数组的第一个元素选为主元
int low = first + 1; // low指向子数组中的第二个元素
int high = last; // high指向子数组的最后一个元素
while (high > low) {
while (low <= high && list[low].compareTo(pivot)<=0) //从左侧开始查找第一个大于主元的元素
low++;
while (low <= high && list[high].compareTo(pivot) > 0) //从右侧开始查找第一个小于或等于主元的元素
high--;
if (high > low) { //交换这两个元素
Element temp = list[high];
list[high] = list[low];
list[low] = temp;
}
}
while (high > first && list[high].compareTo(pivot) >= 0)
high--;
if (list[high].compareTo(pivot)<0) { //如果主元被移动,方法返回将子数组分为两部分的主元的新下标,否则,返回原始下标
list[first] = list[high];
list[high] = pivot;
return high;
}
else {
return first;
}
}
}
class Element implements Comparable<Element>{
float w;
int i;
public Element(float ww,int ii){
w=ww;
i=ii;
}
public int compareTo(Element x){
float xw=x.w;
return w<xw ? -1:w==xw ? 0:1;
}
}
| [
"1060472651@qq.com"
] | 1060472651@qq.com |
58ad820b2cfa37c70c480c96233ff1a8c5dce95a | 33f1c889fb4c327b2eabdf875c29e9cb110d2e48 | /app/src/main/java/com/a190729/jakubgeron/bmi/BmiForKgM.java | 98047994306979f5846e3fb83d294cb54ee1f097 | [] | no_license | Kulawy/Android_BMI | c61b7bea2a87a07a6ebba3af4195cd25c59a2339 | 121daec46bc6b170fe5b5c24bf5a74e5a05ed939 | refs/heads/master | 2021-09-10T08:27:24.329662 | 2018-03-22T22:35:02 | 2018-03-22T22:35:02 | 126,039,352 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 788 | java | package com.a190729.jakubgeron.bmi;
/**
* Created by JakubG on 08.03.2018.
*/
public class BmiForKgM extends BMI {
private final static int OVERMASS = 400;
private final static int OVERHEIGHT = 300;
public BmiForKgM(double m, double h) {
super(m, h);
}
@Override
public double calculateBmi() throws IllegalArgumentException{
if (!dataAreValid()){
throw new IllegalArgumentException();
}
return mass/((height/100)*(height/100));
}
@Override
protected boolean dataAreValid() {
return (mass > 0 && height > 0 && mass <= OVERMASS && height <= OVERHEIGHT);
}
}
// Add vertical albo horizontal guidelayn w costrait layout w graficznym tworzeniu layoutu
// content description ??? moja morda
| [
"catatu1992@gmail.com"
] | catatu1992@gmail.com |
a5163569d25cc68c211931964e2e4e376a13c5f6 | 8a98577c5995449677ede2cbe1cc408c324efacc | /Big_Clone_Bench_files_used/bcb_reduced/3/default/122437.java | 816004efef00c6c35490ea7d3ff269c683950373 | [
"MIT"
] | permissive | pombredanne/lsh-for-source-code | 9363cc0c9a8ddf16550ae4764859fa60186351dd | fac9adfbd98a4d73122a8fc1a0e0cc4f45e9dcd4 | refs/heads/master | 2020-08-05T02:28:55.370949 | 2017-10-18T23:57:08 | 2017-10-18T23:57:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,307 | java | import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Cookie;
import java.io.*;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* Servlet implementation of Jabber/XMPP JEP-0025, HTTP Polling:
*
* http://www.jabber.org/jeps/jep-0025.html
*
* This JEP specifies a gateway module between Jabber/XMPP clients
* that, because of client resource/connection limitationss,
* poll the server via HTTP. This servlet handles the special request
* body formatting that is used to tie XMPP packet contents to
* specific server connections, and to provide minimal verification
* that new polling requests come from the same clients as previous
* requests with the same session id.
*
* @author Sam Douglass
* @version 1.0.0
*
*/
public class JabberHttpPollingServlet extends HttpServlet {
private static final String ERR_IDENTIFIER_SERVER = "-1:0";
private static final String ERR_IDENTIFIER_BADREQUEST = "-2:0";
private static final String ERR_IDENTIFIER_KEYSEQ = "-3:0";
private static final String DEFAULT_JABBER_SERVER = "127.0.0.1";
private static final int DEFAULT_JABBER_PORT = 5222;
private static final int BUFFER_SIZE = 1024;
private static boolean serverConnectionBusy = false;
private String jabberServer;
private int jabberPort;
/**
* Initializes the servlet. Sets the jabberServer and jabberPort fields.
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
jabberServer = config.getInitParameter("jabberServer");
if (jabberServer == null) {
jabberServer = DEFAULT_JABBER_SERVER;
}
try {
jabberPort = Integer.parseInt(config.getInitParameter("jabberPort"));
} catch (NumberFormatException e) {
jabberPort = DEFAULT_JABBER_PORT;
}
}
/** Destroys the servlet.
*/
public void destroy() {
JabberServerConnectionRegistry.getInstance().closeAll();
}
/** Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/xml;charset=UTF-8");
String requestBodyStr;
try {
requestBodyStr = inputStreamToString(request.getInputStream());
} catch (IOException e) {
handleError(response, ERR_IDENTIFIER_SERVER, "Error getting input from client.");
return;
}
HttpPollingRequestBody body;
try {
body = new HttpPollingRequestBody(requestBodyStr);
} catch (Exception e) {
handleError(response, ERR_IDENTIFIER_BADREQUEST, "Bad request data.");
return;
}
JabberServerConnection jsc;
if (body.getSessionId() == null) {
try {
jsc = JabberServerConnectionRegistry.getInstance().createConnection(jabberServer, jabberPort);
} catch (JabberException e) {
handleError(response, ERR_IDENTIFIER_SERVER, e.getMessage());
return;
}
jsc.setClientKey(body.getKey());
} else {
jsc = JabberServerConnectionRegistry.getInstance().getConnection(body.getSessionId());
if (jsc == null) {
handleError(response, ERR_IDENTIFIER_SERVER, "Bad session id.");
return;
}
if (!keysMatch(body.getKey(), jsc.getClientKey())) {
handleError(response, ERR_IDENTIFIER_KEYSEQ, "Invalid client key.");
return;
}
if (body.getNewKey() != null) {
jsc.setClientKey(body.getNewKey());
} else {
jsc.setClientKey(body.getKey());
}
}
if (!serverConnectionBusy) {
serverConnectionBusy = true;
boolean syncRequest = body.getXmlData() != null;
if (syncRequest) {
try {
jsc.send(body.getXmlData().getBytes(), 0, body.getXmlData().length());
} catch (JabberException e) {
handleError(response, ERR_IDENTIFIER_SERVER, e.getMessage());
serverConnectionBusy = false;
return;
}
}
Cookie sessionIdCookie = new HttpPollingSessionIdCookie(jsc.getSessionId());
response.addCookie(sessionIdCookie);
try {
jsc.receive(response.getOutputStream(), syncRequest);
} catch (JabberException e) {
handleError(response, ERR_IDENTIFIER_SERVER, e.getMessage());
serverConnectionBusy = false;
return;
}
serverConnectionBusy = false;
} else {
}
}
/**
* Reads the given InputStream and returns its contents as a String.
*
* @param in the input stream to read into a String
* @return the contents of the given InputStream as a String
* @throws IOException
*/
private String inputStreamToString(InputStream in) throws IOException {
Reader r = new BufferedReader(new InputStreamReader(in));
StringWriter sw = new StringWriter(BUFFER_SIZE);
int charsRead = -1;
char[] buffer = new char[BUFFER_SIZE];
while ((charsRead = r.read(buffer)) != -1) {
sw.write(buffer, 0, charsRead);
}
return sw.toString();
}
/**
* Handles an error. Sets the identifier cookie value to the error type, and
* puts the error message into some XML in the response body according to the
* JEP.
*
* @param response the servlet response to the polling XMPP client
* @param errorType the error type (should be one of the constants defined in this class)
* @param errorMessage the message for the client to display
*/
private void handleError(HttpServletResponse response, String errorType, String errorMessage) {
Cookie errorCookie = new HttpPollingSessionIdCookie(errorType);
response.addCookie(errorCookie);
try {
PrintWriter responseWriter = response.getWriter();
responseWriter.write("<?xml version=\"1.0\"?>");
responseWriter.write("<error>" + errorMessage + "</error>");
} catch (IOException e) {
}
}
/** Returns a short description of the servlet.
*/
public String getServletInfo() {
return "A Java servlet implementation of Jabber JEP-0025 HTTP Polling (http://www.jabber.org/jeps/jep-0025.html).";
}
/** Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "This servlet accepts only POST requests.");
}
/**
* Checks to see if the key coming in with a client request matches
* the key stored from the previous client request, once the new key
* has been sha-1 then base64 encoded, as specified in the JEP:
*
* K(n, seed) = Base64Encode(SHA1(K(n - 1, seed))), for n > 0
* K(0, seed) = seed, which is client-determined
*
* @param keyNMinusOne the key from the latest client request, K[n-1]
* @param keyN the key from the previous client request, K[n]
* @return
*/
private boolean keysMatch(String keyNMinusOne, String keyN) {
boolean match = false;
try {
MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.reset();
digest.update(keyNMinusOne.getBytes());
byte[] hashedBytes = digest.digest();
String encodedHashedKey = new String(com.Ostermiller.util.Base64.encode(hashedBytes));
match = encodedHashedKey.equals(keyN);
} catch (NoSuchAlgorithmException e) {
}
return match;
}
}
| [
"nishima@mymail.vcu.edu"
] | nishima@mymail.vcu.edu |
49864d271289ec77001606a72eb281ae458105fc | 29c8bb7380f3caa9cd077d8127b296cc5b706a9c | /src/data_files/RegionNameFileFormatter.java | 7578920c69144281cc41b56062037f9dec806177 | [] | no_license | SpaceKey-HKUFYP/SpaceKey-website | c2e83005c4dd1d2059738841207fc9371c54e80c | c728f605eb3cd99982c699e0ac90fd6884ed523c | refs/heads/master | 2020-04-15T04:08:56.083034 | 2019-04-28T13:06:41 | 2019-04-28T13:06:41 | 164,372,510 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,234 | java | package fyp;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class RegionNameFileFormatter {
public static final String INPUT = "D:\\File\\HKU\\Semester 7\\COMP4801\\SpaceKey-website\\region_name";
public static final String OUTPUT = "D:\\File\\HKU\\Semester 7\\COMP4801\\SpaceKey-website\\region_name-formatted.json";
public static void main(String[] args) {
try {
System.out.println("Start reformatting...");
File fileInput = new File(INPUT);
File fileOutput = new File(OUTPUT);
BufferedReader reader = new BufferedReader(new FileReader(fileInput));
BufferedWriter writer = new BufferedWriter(new FileWriter(fileOutput));
writer.write("{global.regionName = [");
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
writer.write("{ key: " + line + ", value: " + line + ", text: " + line + " },\n");
}
writer.write("]}");
reader.close();
writer.close();
System.out.println("Done reformatting...");
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"budiman_1597@hotmail.com"
] | budiman_1597@hotmail.com |
523fb565c42e8c58f83622f88729e3a5314f3b1e | 1afb0112f63f795bc4c252bdd0f0ded5528725a8 | /scripts/fletcher/utilities/Conditions.java | 789bf7305cb78109e4e418aaca3c24fd6b21d151 | [] | no_license | joesim/ScriptsRS | b29b5ab5d81a6ca8515ece2a233c7cdcbeb107b0 | 953bf281f59db58ebcbe3006a3052a58e3cfd6e6 | refs/heads/master | 2021-06-23T23:41:25.281261 | 2017-09-04T23:28:24 | 2017-09-04T23:28:24 | 102,410,995 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,312 | java | package scripts.fletcher.utilities;
import org.tribot.api.General;
import org.tribot.api.types.generic.Condition;
import org.tribot.api2007.Inventory;
public class Conditions {
public static Condition cEmptyInventory = new Condition() {
@Override
public boolean active() {
General.sleep(100, 200);
return Inventory.getAll().length == 0;
}
};
public static Condition bankScreenOpen = new Condition() {
@Override
public boolean active() {
General.sleep(100, 200);
return org.tribot.api2007.Banking.isBankScreenOpen();
}
};
public static Condition onlyKnife = new Condition() {
@Override
public boolean active() {
General.sleep(100, 200);
return Inventory.getAll().length == 1 && Inventory.getCount("Knife") == 1;
}
};
public static Condition coinsInInv = new Condition() {
@Override
public boolean active() {
General.sleep(100, 200);
General.println("Here");
return Inventory.getCount("Coins") > 0;
}
};
public static Condition bankScreenNotOpenAndInvFull = new Condition() {
@Override
public boolean active() {
General.sleep(100, 200);
return Inventory.getAll().length == 28;
}
};
public static Condition justWait = new Condition() {
@Override
public boolean active() {
General.sleep(100, 200);
return false;
}
};
}
| [
"joel.simard@polymtl.ca"
] | joel.simard@polymtl.ca |
9472e66b4fe496efee1786eb7fd6ada70eefbf5c | 9ce8726dc28bb5f66812b1f0007bf03b3154cdbd | /src/main/java/com/idus/list/service/ListService.java | 976eadade8f7534b57e663cd3215585997b43be8 | [] | no_license | sage1991/shopping_mall_spring | 653a37a3308011e4f4a17b0e16770bb51001f82e | 9633e7f717c17254109d02da3791706ad99368c2 | refs/heads/hyunsu | 2020-05-04T15:37:39.296981 | 2019-04-21T10:53:08 | 2019-04-21T10:53:08 | 179,249,417 | 0 | 0 | null | 2019-05-04T06:43:45 | 2019-04-03T08:50:51 | Java | UTF-8 | Java | false | false | 665 | java | package com.idus.list.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.idus.list.dao.ListDao;
import com.idus.list.dto.RecentItems;
@Service
//서비스는 기능이다. dao로 가져온 데이터를 li로 정리한다.
public class ListService {
@Autowired
private ListDao dao;
public List<RecentItems> selectItems() {
List<RecentItems> result = dao.selectRecent();
return result;
}
public List<RecentItems> selectMoreItems(int bno) {
List<RecentItems> result = dao.selectMoreRecent(bno);
return result;
}
}
| [
"free_eddy@naver.com"
] | free_eddy@naver.com |
115987e5fbbe157a2464bd74dee68e43e126907b | 246bb115cbb4e6654243526c529eccba1aa806b7 | /engine/src/test/java/org/apache/hop/pipeline/transforms/loadsave/setter/FieldSetter.java | a62be63d9f19d46227c4fbe14518b3e394877fd9 | [
"Apache-2.0"
] | permissive | davidjscience/hop | 6f8f9391aa367a4fe9b446b1a7fc0f6c59e6a9ce | 9de84b1957a0b97f17d183f018b0584ed68aae5a | refs/heads/master | 2022-11-08T02:13:28.596902 | 2020-06-28T17:47:27 | 2020-06-28T17:47:27 | 275,682,334 | 0 | 0 | Apache-2.0 | 2020-06-28T22:55:52 | 2020-06-28T22:55:51 | null | UTF-8 | Java | false | false | 1,334 | java | /*! ******************************************************************************
*
* Hop : The Hop Orchestration Platform
*
* http://www.project-hop.org
*
*******************************************************************************
*
* 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.apache.hop.pipeline.transforms.loadsave.setter;
import java.lang.reflect.Field;
public class FieldSetter<T> implements ISetter<T> {
private final Field field;
public FieldSetter( Field field ) {
this.field = field;
}
public void set( Object obj, T value ) {
try {
field.set( obj, value );
} catch ( Exception e ) {
throw new RuntimeException( "Error getting " + field + " on " + obj, e );
}
}
}
| [
"mattcasters@gmail.com"
] | mattcasters@gmail.com |
0e402a7ad0698b830fc64060c0f7e2d9e3eec374 | a4cff623a9b3b6887b96d35ffd50f8ef526d95fb | /src/main/java/com/zurazu/zurazu_backend/provider/service/RegisterProductService.java | 22c60a301a9b2794c62400c4194a3391bfe21ba5 | [] | no_license | zurazu/zurazu_backend | e0521b42075435b367e23679b38b8f53fde1d058 | 89ce4c15c509534cc0df462ac570aa03bbb3f1ca | refs/heads/main | 2023-06-03T18:19:28.463364 | 2021-06-22T15:00:37 | 2021-06-22T15:00:37 | 364,473,741 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 6,714 | java | package com.zurazu.zurazu_backend.provider.service;
import com.zurazu.zurazu_backend.core.enumtype.ApplySellStatusType;
import com.zurazu.zurazu_backend.core.enumtype.SaleStatusType;
import com.zurazu.zurazu_backend.core.service.RegisterProductServiceInterface;
import com.zurazu.zurazu_backend.exception.errors.ForbiddenDeleteProductException;
import com.zurazu.zurazu_backend.exception.errors.NotFoundColorChipException;
import com.zurazu.zurazu_backend.exception.errors.NotFoundProductException;
import com.zurazu.zurazu_backend.exception.errors.NotFoundTypeException;
import com.zurazu.zurazu_backend.provider.dto.*;
import com.zurazu.zurazu_backend.provider.repository.ApplySellProductDAO;
import com.zurazu.zurazu_backend.provider.repository.CategoryDAO;
import com.zurazu.zurazu_backend.provider.repository.PurchaseInfoDAO;
import com.zurazu.zurazu_backend.provider.repository.RegisterProductDAO;
import com.zurazu.zurazu_backend.util.S3Uploader;
import com.zurazu.zurazu_backend.web.dto.RequestRegisterProductDTO;
import com.zurazu.zurazu_backend.web.dto.SelectAllProductThumbnailsDTO;
import com.zurazu.zurazu_backend.web.dto.SelectAllPurchaseLimitDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@RequiredArgsConstructor
@Service
public class RegisterProductService implements RegisterProductServiceInterface {
private final RegisterProductDAO registerProductDAO;
private final ApplySellProductDAO applySellProductDAO;
private final CategoryDAO categoryDAO;
private final S3Uploader s3Uploader;
private final PurchaseInfoDAO purchaseInfoDAO;
@Override
public void registerProduct(RequestRegisterProductDTO requestRegisterProductDTO, Map<String, MultipartFile> fileMap) {
//컬러칩 파일 없으면 익셉션 발행
MultipartFile colorChipFile = fileMap.get("colorChipImage");
if(colorChipFile == null) {
//컬러칩이 없다.
throw new NotFoundColorChipException();
} else {
fileMap.remove("colorChipImage"); // 꺼냈으니 리스트에서는 삭제
}
if(applySellProductDAO.getOneProduct(requestRegisterProductDTO.getApplySellProductIdx()) == null) {
//판매 신청된 아이템이 없다
throw new NotFoundProductException();
}
//판매 등록
registerProductDAO.registerProduct(requestRegisterProductDTO);
//신청 판매상품 상태 REGISTERED 로 변경
applySellProductDAO.updateProductSaleStatus(ApplySellStatusType.REGISTERED, requestRegisterProductDTO.getApplySellProductIdx());
//컬러칩 삽입 후 경로 반환
String colorUrl = s3Uploader.upload(colorChipFile, "colorChipImages");
//구한 경로로 디비 삽입
ColorChipDTO colorChip = new ColorChipDTO();
colorChip.setUrl(colorUrl);
colorChip.setColorText(requestRegisterProductDTO.getColorText());
colorChip.setRegisterProductIdx(requestRegisterProductDTO.getIdx());
registerProductDAO.registerColorChip(colorChip);
//일반 파일들 삽입 후 경로 반환하고 디비 삽입
List<RegisterProductImageDTO> list = new ArrayList<>();
if(fileMap != null) {
fileMap.entrySet()
.stream()
.forEach(file -> {
String imageUrl = s3Uploader.upload(file.getValue(), "registerProductImages");
RegisterProductImageDTO image = new RegisterProductImageDTO();
image.setRegisterProductIdx(requestRegisterProductDTO.getIdx());
image.setUrl(imageUrl);
list.add(image);
});
}
if(list.size() > 0) {
registerProductDAO.insertProductImages(list);
}
}
@Override
public Optional<List<ProductThumbnailDTO>> selectAllRegisterProductThumbnails(SelectAllProductThumbnailsDTO selectAllProductThumbnailsDTO) {
return Optional.ofNullable(registerProductDAO.selectAllProductThumbnails(selectAllProductThumbnailsDTO));
}
@Override
public Optional<RegisterProductDTO> selectOneRegisterProduct(int idx) {
return Optional.ofNullable(registerProductDAO.selectOneRegisterProduct(idx));
}
@Override
public Optional<List<RegisterProductImageDTO>> getAllProductImages(int productIdx) {
return Optional.ofNullable(registerProductDAO.getAllImages(productIdx));
}
@Override
public void updateRegisterProductStatus(SaleStatusType type, int productIdx) {
RegisterProductDTO registerProduct = selectOneRegisterProduct(productIdx).orElseGet(()->null);
if(registerProduct == null) {
throw new NotFoundProductException();
}
if(type == null) {
throw new NotFoundTypeException();
}
//새로 변경하고자 하는 타입이 무엇인지에 따라 신청상품 상태도 같이 변경
registerProductDAO.updateRegisterProductStatus(type, productIdx);
if(type == SaleStatusType.DONE) {
applySellProductDAO.updateProductSaleStatus(ApplySellStatusType.FINISH, registerProduct.getApplySellProductIdx());
}else if( type == SaleStatusType.PROGRESSING) {
applySellProductDAO.updateProductSaleStatus(ApplySellStatusType.REGISTERED, registerProduct.getApplySellProductIdx());
} else if(type == SaleStatusType.FINISH_DEPOSIT) {
applySellProductDAO.updateProductSaleStatus(ApplySellStatusType.REGISTERED, registerProduct.getApplySellProductIdx());
} else if(type == SaleStatusType.WAITING_DEPOSIT) {
applySellProductDAO.updateProductSaleStatus(ApplySellStatusType.REGISTERED, registerProduct.getApplySellProductIdx());
}
}
@Override
public void deleteRegisteredProduct(String registerNumber) {
RegisterProductDTO product = registerProductDAO.selectOneRegisterProduct(registerNumber);
if(product == null) {
throw new NotFoundProductException();
}
PurchaseProductDTO purchaseInfo = purchaseInfoDAO.selectOnePurchaseHistory(product.getIdx());
if(purchaseInfo != null) {
//구매내역이 존재하므로 exception
throw new ForbiddenDeleteProductException();
}
registerProductDAO.deleteRegisteredProduct(product);
applySellProductDAO.updateProductSaleStatus(ApplySellStatusType.AGREE, product.getApplySellProductIdx());
}
}
| [
"kshz9815@naver.com"
] | kshz9815@naver.com |
56d13aae432b7086b750ef90787a8787417445fd | c5f1c8e3de2efb8d03758a0f5d3f2c373b42b3bd | /src/Login/DAO/LoginDAO.java | ac017ca7395d6764cd1ac46d19372d96e9bf09ab | [] | no_license | anandpatel0099/E-Governance | 9ded0f53da787b6bc33e23b724af9e9203b6b008 | 24765852ad5c66fe8a04e8eb0da39df9b14107fc | refs/heads/master | 2020-04-16T05:39:23.055374 | 2019-01-11T21:51:00 | 2019-01-11T21:51:00 | 165,314,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,800 | java | package Login.DAO;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import Login.VO.persondetailsVO;
public class LoginDAO
{
public List verify()
{
SessionFactory sf=new Configuration().configure().buildSessionFactory();
Session session=sf.openSession();
String q="select p from persondetailsVO p";
Query query=session.createQuery(q);
List qlist=query.list();
return qlist;
}
public void enter(persondetailsVO pd)
{
SessionFactory sf=new Configuration().configure().buildSessionFactory();
Session session = sf.openSession();
Transaction tx = session.beginTransaction();
session.save(pd);
tx.commit();
}
public List forgotpassword(String un)
{
SessionFactory sf=new Configuration().configure().buildSessionFactory();
Session session=sf.openSession();
String q="select p from persondetailsVO p where p.username=:unm";
Query query=session.createQuery(q);
query.setString("unm", un);
List qlist=query.list();
return qlist;
}
public void updatePassword(persondetailsVO pd)
{
SessionFactory sf=new Configuration().configure().buildSessionFactory();
Session session = sf.openSession();
Transaction tx = session.beginTransaction();
session.update(pd);
tx.commit();
}
public List verify1(String un,String pwd)
{
SessionFactory sf=new Configuration().configure().buildSessionFactory();
Session session=sf.openSession();
String q="select p from persondetailsVO p where p.username=:unm and p.password=:pd";
Query query=session.createQuery(q);
query.setString("unm", un);
query.setString("pd", pwd);
List qlist=query.list();
return qlist;
}
} | [
"you@example.com"
] | you@example.com |
4d099acd70054425a9dd15828355f0b4b0dd355e | b651a9964f211209ccbc76f3e09b1c80974456bd | /ArvoreGenealogica/src/java/dao/LocalidadeDAO.java | 17bf2744743fb3e0b579af1000bbd8971726e2b6 | [] | no_license | icarocrespo/PP-ArvoreGenealogica | 988b4e2c818ff0e28070aa74a463a35d3ceb0add | 042415bf003689d3ec1e9e7f8e2af575054e8cdd | refs/heads/main | 2023-02-04T18:27:53.941460 | 2020-12-17T17:52:58 | 2020-12-17T17:52:58 | 306,755,784 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 208 | java | package dao;
import model.Localidade;
/**
*
* @author icaro
*/
public class LocalidadeDAO extends GenericDAO<Localidade, Integer> {
public LocalidadeDAO() {
super(Localidade.class);
}
}
| [
"icarocrespo@gmail.com"
] | icarocrespo@gmail.com |
87efb04873d4f6c34285a90cd4183db6c998e13a | d688354212575d8fa1f4e5fe0fd8f92d87b78739 | /src/main/java/com/demo/exception/ExceptionHandler.java | 42f2d9ca86a7bf8789bebcee49e42ba87b33f1c5 | [] | no_license | jcamilo36/messages | 576bb8c883fb662d27ecbdaafdb05beae3d77235 | 658f4ca49f8932a15bcd48fe6e2835821362b5b7 | refs/heads/master | 2021-01-19T07:52:55.203784 | 2017-04-07T20:04:43 | 2017-04-07T20:04:43 | 87,581,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,370 | java | package com.demo.exception;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.NoHandlerFoundException;
import javax.servlet.http.HttpServletRequest;
/**
* Exception handler.
*/
@ControllerAdvice
@Slf4j
public class ExceptionHandler {
/**
* Content type header value.
*/
private static final String CONTENT_TYPE_HEADER = "Content-Type";
/**
* Method to handle missing param exceptions.
* @param request HTTP Request
* @param ex Exception thrown
* @return response entity
*/
@org.springframework.web.bind.annotation.ExceptionHandler(NoHandlerFoundException.class)
ResponseEntity<ErrorResponse> handleError404(final HttpServletRequest request,
final Exception ex) {
ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setMessage("The requested resource does not exist.");
errorResponse.setStatus(HttpStatus.NOT_FOUND.value());
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
headers.add(CONTENT_TYPE_HEADER,MediaType.APPLICATION_JSON_UTF8_VALUE);
return new ResponseEntity<>(errorResponse, headers, HttpStatus.NOT_FOUND);
}
/**
* Method to handle an internal server error.
* @param request HTTP Request
* @param ex Exception thrown
* @return response entity
*/
@org.springframework.web.bind.annotation.ExceptionHandler(Throwable.class)
ResponseEntity<ErrorResponse> handleError500(final HttpServletRequest request,
final Exception ex) {
ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setMessage("An unexpected error happened. Please contact the administrator.");
log.error(ex.getLocalizedMessage(), ex);
errorResponse.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
headers.add(CONTENT_TYPE_HEADER,MediaType.APPLICATION_JSON_UTF8_VALUE);
return new ResponseEntity<>(errorResponse, headers, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
| [
"jcortes@hugeinc.com"
] | jcortes@hugeinc.com |
08406cec00e711afc3c3b93db4a94d3410e1d6e1 | f8f474d4b9cd2a66bc9b11735b938de560d77b26 | /docs/original_moodle/unidades/entregas/todas/3/Reto Ejemplo Segundo Previo/GUARIN- 1151893 JHONNY 2576/2019-10-20-17-35-30/Vehiculo.java | 2a1b5dd1a4613c886a178a74c5410c623ef17428 | [] | no_license | alphonse92/vplplusplus_composer | 6e630d7908c24ab9af3887e101a4f86b6566982e | 247747d1494b7d39b2bd2ff6e8bdb949a5c7d9f9 | refs/heads/master | 2020-09-07T18:23:34.101317 | 2020-04-22T22:46:00 | 2020-04-22T22:46:00 | 220,873,804 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,004 | java | /**
* Clase Vehiculo - Ejemplo de segundo parcial :D.
*
* @author (Jhonny Esneider Guarín Chavez - jhonnyesneidergcha@ufps.edu.co)
* @version 0.003 :D
*/
public abstract class Vehiculo {
public static final int TARIFA_BICICLETA = 1000;
public static final int TARIFA_MOTO = 2000;
public static final int TARIFA_CARRO_GRANDE = 10000;
public static final int TARIFA_CARRO_PEQUENO = 5000;
private String placa;
private String cedulaPropietario;
private Hora horaIngreso;
private Hora horaSalida;
private int tarifa;
private double tiempoServicio;
/**
* Constructor que recibe la cedula del propietario y la hora de inreso del vehiculo.
*/
public Vehiculo(String placa, String cedulaPropietario, int hora, int minuto, int segundo) {
this.placa = placa;
this.cedulaPropietario = cedulaPropietario;
this.horaIngreso = new Hora (hora, minuto, segundo);
}
/**
* @return the placa
*/
public String getPlaca() {
return this.placa;
}
/**
* @param placa the placa to set
*/
public void setPlaca(String placa) {
this.placa = placa;
}
/**
* Metodo que recibe la hora de salida del vehiculo y calcula el tiempo del servicio
* si las horas de ingreso y salida coinciden, de lo contrario imprime un error.
*/
public void registrarSalida(int hora, int minuto, int segundo) {
this.horaSalida = new Hora(hora, minuto, segundo);
this.tiempoServicio = 0.0d;
if (this.horaSalida.esMayor(this.horaIngreso)){
this.tiempoServicio = getHoraSalida().restar(getHoraIngreso());
}
}
/**
* Metodo que retorna el valor neto total del servicio por vehiculo si hay un registro de salida,
* de lo contrario imprime un error.
*/
public double getValorTotalServicio() {
double valorTotalServicio = 0.0d;
if(getHoraSalida() != null) valorTotalServicio = tiempoServicio * getTarifa() * 1.19d;
return valorTotalServicio;
}
/**
* @return the horaIngreso
*/
public Hora getHoraIngreso() {
return horaIngreso;
}
/**
* @return the horaSalida
*/
public Hora getHoraSalida() {
return horaSalida;
}
/**
* @return the tarifa
*/
public int getTarifa() {
return tarifa;
}
/**
* @return the cedulaPropietario
*/
public String getCedulaPropietario() {
return cedulaPropietario;
}
/**
* @param cedulaPropietario the cedulaPropietario to set
*/
public void setCedulaPropietario(String cedulaPropietario) {
this.cedulaPropietario = cedulaPropietario;
}
/**
* @return the tiempoServicio
*/
public double getTiempoServicio() {
return tiempoServicio;
}
/**
* @param tarifa the tarifa to set
*/
public void setTarifa(int tarifa) {
this.tarifa = tarifa;
}
}
| [
"eliecer.molina@uruit.com"
] | eliecer.molina@uruit.com |
fe0c3a060a8d76c04c3afbecd358830a8f81e843 | 0f751e6115f674c3419481c37d662342278c47c5 | /src/main/java/com/reachcall/util/Pool.java | ff3a156d1f11ba7983bbc26fddf1c65e8b29d80a | [
"Apache-2.0"
] | permissive | kebernet/pretty | 903c85857ec4180b510cd1127d2be203f43b146c | b40d24d8dc775bb84b0f80ea8ad666afb6c1a28b | refs/heads/master | 2020-03-31T01:55:12.231529 | 2012-12-30T20:37:39 | 2012-12-30T20:37:39 | 7,368,904 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,758 | java | /**
* Copyright 2013, Robert Cooper, Reach Health
*
* 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
*/
package com.reachcall.util;
import java.util.Map.Entry;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* A simple unlimited object pool.
*/
public abstract class Pool<T> {
protected static final Logger LOG = Logger.getLogger(Pool.class.getCanonicalName());
protected final ConcurrentHashMap<T, Pool.CheckoutInfo> locked = new ConcurrentHashMap<T, Pool.CheckoutInfo>();
protected final ConcurrentLinkedQueue<T> unlocked = new ConcurrentLinkedQueue<T>();
private final Timer sweeper;
private final int stackDepthLogging;
public Pool(final long maxCheckoutTimeMillis) {
this(maxCheckoutTimeMillis, null, 1);
}
protected Pool(final long maxCheckoutTimeMillis, final Pool.ExpiryListener listener, final int stackDepthLogging) {
this.stackDepthLogging = stackDepthLogging;
if (maxCheckoutTimeMillis > 0) {
TimerTask t = new TimerTask() {
@Override
public void run() {
for (Entry<T, Pool.CheckoutInfo> entry : locked.entrySet()) {
if ((System.currentTimeMillis() - maxCheckoutTimeMillis) > entry.getValue().time) {
locked.remove(entry.getKey());
StackTraceElement e = entry.getValue()
.getStackTrace()[stackDepthLogging];
LOG.log(Level.WARNING, "{0} checked out too long: {1}ms. {2} checked out at {3}",
new Object[] {
entry.getKey()
.getClass(), System.currentTimeMillis() - entry.getValue().time,
entry.getKey(), e.toString()
});
if (listener != null) {
listener.onExpire(entry.getKey());
}
}
}
}
};
sweeper = new Timer(true);
sweeper.scheduleAtFixedRate(t, maxCheckoutTimeMillis, maxCheckoutTimeMillis);
} else {
sweeper = null;
}
}
public void checkin(T o) {
assert o != null : "Checking in a null object";
Pool.CheckoutInfo info = locked.remove(o);
if (info != null) {
unlocked.add(o);
LOG.log(Level.FINE, "Checked in {0} after {1}ms.",
new Object[] { o.toString(), System.currentTimeMillis() - info.time });
} else {
try {
throw new RuntimeException();
} catch (RuntimeException e) {
LOG.log(Level.WARNING, "Checked in {1} ({0}) with unknown state at {2}",
new Object[] { o.hashCode(), o, e.getStackTrace()[stackDepthLogging].toString() });
LOG.log(Level.FINE, "Unknown state checkin.", e);
}
}
}
public T checkout() {
T o = unlocked.poll();
if (o == null) {
o = create();
}
try {
throw new Pool.CheckoutInfo();
} catch (Pool.CheckoutInfo info) {
locked.put(o, info);
}
LOG.log(Level.FINE, "Checkout {0} {1}", new Object[] { o.hashCode(), o.toString() });
return o;
}
protected abstract T create();
public void invalidate(T value) {
this.unlocked.remove(value);
this.locked.remove(value);
LOG.log(Level.WARNING, "Invalidated {0}", value);
}
public void invalidateAll(){
int unlockedCount = this.unlocked.size();
this.unlocked.clear();
int lockedCount = this.locked.size();
this.locked.clear();
LOG.log(Level.WARNING, "Invalidated all pool items. Cheked out {0} Checked in {1}", new Object[]{lockedCount, unlockedCount});
}
public void shutdown() {
if (this.sweeper != null) {
sweeper.cancel();
}
}
public static interface ExpiryListener<T> {
void onExpire(T o);
}
private static class CheckoutInfo extends Exception {
long time = System.currentTimeMillis();
}
}
| [
"kebernet@gmail.com"
] | kebernet@gmail.com |
099294f0b8ef6ff83f5375ef7ce30ef89631983e | f0e34fa54d6986bac8f1281cb7a7c2ea6da587e6 | /app/src/main/java/com/example/havoc/userlistusingretrofit/model/UserlistPojo.java | fbc3941d95e99c55d461c3160e2a74570db95d46 | [] | no_license | Roshanlama/retrofit | 931fb63917ab13f39435b9eb1406cd58de436922 | 96742f057f923c37f1ab9215d765ec1cb53448cd | refs/heads/master | 2021-01-01T05:58:14.214535 | 2017-07-15T14:50:47 | 2017-07-15T14:50:47 | 97,321,955 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,405 | java | package com.example.havoc.userlistusingretrofit.model;
import com.google.gson.annotations.SerializedName;
/**
* Created by havoc on 7/14/17.
*/
public class UserlistPojo {
@SerializedName("username")
private String username;
@SerializedName("id")
private String id;
@SerializedName("address")
private String address;
@SerializedName("email")
private String email;
@SerializedName("phone")
private String phone;
public UserlistPojo(String username, String id, String address, String email, String phone) {
this.username = username;
this.id = id;
this.address = address;
this.email = email;
this.phone = phone;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}
| [
"havochalo@gmail.com"
] | havochalo@gmail.com |
4db78667518b48d93814d392daac22d4f4b9f48c | 5adc61b44ad1b56a7982e200e66d299c7d3d8483 | /src/test/java/TestFirst.java | 2a861f3a2b14403282d4247857bed78c1f77553f | [
"Apache-2.0"
] | permissive | NadiiaKravchenko/Second_Project | 414ffce4682bd5d065a185bc00683c10a4c00140 | 62fb02c405bddef02b0f3849da1f1a843e1664a3 | refs/heads/master | 2023-03-24T06:35:52.151826 | 2021-03-20T15:58:28 | 2021-03-20T15:58:28 | 349,768,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class TestFirst {
WebDriver wb;
@Test
public void startgoogle() {
wb = new ChromeDriver();
wb.get("https://www.google.co.il/");
wb.quit();
}
}
| [
"nabinkra@gmail.com"
] | nabinkra@gmail.com |
f6f8bce222a8a1cd8112dc6f724ae0f3ae8f678e | 1af9375e447999dca65e55f65529dfa9c3249ee8 | /bindings/java/src/main/java/org/phash/AudioMetaData.java | b75b591c2e96e6a51d0e98628002bc8dec266756 | [
"MIT"
] | permissive | Hadryan/libAudioData | c09f2062291d727ecaf96910eca0c31a548d19ca | d854d4b85d7ca0f7ba71bbeb43d8be5b2e336565 | refs/heads/master | 2023-03-15T14:59:16.050969 | 2019-04-17T14:13:27 | 2019-04-17T14:13:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java | package org.phash;
public class AudioMetaData {
public String composer;
public String title1;
public String title2;
public String title3;
public String tpe1;
public String tpe2;
public String tpe3;
public String tpe4;
public String date;
public String genre;
public String album;
public int year;
public int duration;
public int partofset;
}
| [
"starkd88@gmail.com"
] | starkd88@gmail.com |
d3ef3f6220b6a418e4dbcc7464fb392f256271ab | 838017fba78afe8098590e3fbf9c41c46a6d1dd2 | /SWA_UserManagement/src/test/java/de/hse/swa/dao/LicenseDaoTest.java | 2697ccb6e2dd3f7abc06d9b5eab3c4c3c41ff594 | [] | no_license | LoraVenkova/SWA | 10f914903cc57138a55eb3e52655530a2a8b96a1 | 30499c5ce78311b97f51cf9588f39bede92659d2 | refs/heads/master | 2023-01-28T12:00:30.293950 | 2020-01-13T16:53:43 | 2020-01-13T16:53:43 | 227,631,091 | 0 | 0 | null | 2023-01-11T09:50:12 | 2019-12-12T14:55:13 | Java | UTF-8 | Java | false | false | 2,377 | java | package de.hse.swa.dao;
import static org.junit.Assert.*;
import java.util.List;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import de.hse.swa.dao.*;
import de.hse.swa.dbmodel.*;
public class LicenseDaoTest {
private static User user = null;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
/* //PrepareTests.initDatabase();
user = new User();
user.setName("George Test");
user.setEmailAddress("georg.test@test.com");
UserDao.getInstance().saveUser(user);
*/
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testGetInstance() {
LicenseDao l = LicenseDao.getInstance();
assertNotNull(l);
}
@Test
public void testGetLicense() {
LicenseDao l = LicenseDao.getInstance();
License license = new License();
license.setLicenseKey("1212");
l.saveLicense(license);
License licenses = l.getLicense(license.getLicenseID());
assertNotNull(licenses);
}
@Test
public void testGetLicenses() {
LicenseDao l = LicenseDao.getInstance();
License license;
for (long i=0; i < 10; ++i) {
license = new License();
license.setLicenseKey("1212" +i);
l.saveLicense(license) ;
}
List<License> licenses = l.getLicenses();
assertTrue(licenses.size()>=10);
}
@Test
public void testSaveLicense() {
LicenseDao licenseDao = LicenseDao.getInstance();
License license = new License();
license.setLicenseKey("1212");
licenseDao.saveLicense(license) ;
License licenses = licenseDao.getLicense(license.getLicenseID());
assertNotNull(licenses);
}
@Test
public void testDeleteLicense() {
LicenseDao licenseDao = LicenseDao.getInstance();
List<License> licenses = licenseDao.getLicenses();
for (License license: licenses) {
licenseDao.deleteLicense(license.getLicenseID());
}
licenses = licenseDao.getLicenses();
assertTrue(licenses.size()<1);
}
@Test
public void testGetLincensesById(){
License license = new License();
license.setLicenseKey("1212");
LicenseDao.getInstance().saveLicense(license);
License license2 = new License();
license2.setLicenseKey("1212");
LicenseDao.getInstance().saveLicense(license2);
}
}
| [
"loveit00@hs-esslingen.de"
] | loveit00@hs-esslingen.de |
5a530477e3096afb74755a33cf79e97b26d5ee7e | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_2463486_0/java/sas4eka/Test.java | be73702feec94d72c759573247d7353da279dbfe | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,675 | java | import java.io.*;
import java.util.*;
public class Test {
static BufferedReader reader;
static StringTokenizer tokenizer;
static PrintWriter writer;
static int nextInt() throws IOException {
return Integer.parseInt(nextToken());
}
static long nextLong() throws IOException {
return Long.parseLong(nextToken());
}
static double nextDouble() throws IOException {
return Double.parseDouble(nextToken());
}
static String nextToken() throws IOException {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(reader.readLine());
}
return tokenizer.nextToken();
}
static Set<Long> st;
public static void main(String[] args) throws IOException {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(
"C-small-attempt0.in")));
tokenizer = null;
writer = new PrintWriter("C-small-attempt0.out");
st = new TreeSet<Long>();
for (long i = 1; i < 10000000; i++) {
if (isPalindrom(i + "")) {
long sq = i * i;
if (isPalindrom(sq + "")) {
st.add(sq);
}
}
}
int t = nextInt();
for (int i = 1; i <= t; i++) {
writer.print("Case #" + i + ": ");
banana();
}
reader.close();
writer.close();
}
static boolean isPalindrom(String s) {
for (int i = 0; i < s.length() / 2 + 1; i++) {
if (s.charAt(i) != s.charAt(s.length() - i - 1))
return false;
}
return true;
}
private static void banana() throws IOException {
long a = nextInt();
long b = nextInt();
long res = 0;
for (Long l : st) {
if (l >= a && l <= b)
res++;
}
writer.println(res);
}
} | [
"eewestman@gmail.com"
] | eewestman@gmail.com |
b4a5e76fe47a6213ecb3e82c71b42f87b996f5c8 | 6635387159b685ab34f9c927b878734bd6040e7e | /src/bhe.java | 926703822482d3a40116330c0587be2b8a90ef15 | [] | no_license | RepoForks/com.snapchat.android | 987dd3d4a72c2f43bc52f5dea9d55bfb190966e2 | 6e28a32ad495cf14f87e512dd0be700f5186b4c6 | refs/heads/master | 2021-05-05T10:36:16.396377 | 2015-07-16T16:46:26 | 2015-07-16T16:46:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,939 | java | import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public final class bhe
{
private static final double MAX_ASPECT_RATIO_ERROR = 0.1D;
private static final String TAG = "SaveStoryToGalleryResolutionProvider";
private final xv mDeviceVideoEncodingResolutionSet;
private final xx mTranscodingResolutionProviderFactory;
public bhe()
{
this(xx.a(), xv.a());
}
private bhe(@chc xx paramxx, @chc xv paramxv)
{
mTranscodingResolutionProviderFactory = paramxx;
mDeviceVideoEncodingResolutionSet = paramxv;
}
@chd
private avc a(@chc avc paramavc)
{
Object localObject = mDeviceVideoEncodingResolutionSet.a;
double d3 = paramavc.c();
paramavc = null;
double d1 = 0.0D;
int i = 0;
Iterator localIterator = ((Set)localObject).iterator();
while (localIterator.hasNext())
{
localObject = (avc)localIterator.next();
double d2 = Math.abs(((avc)localObject).c() - d3) / d3;
if (d2 <= 0.1D)
{
int j = ((avc)localObject).d();
if ((paramavc != null) && (d2 >= d1) && ((d2 != d1) || (j <= i))) {
break label125;
}
i = j;
paramavc = (avc)localObject;
d1 = d2;
}
}
label125:
for (;;)
{
break;
return paramavc;
}
}
@chd
private static avc a(@chc Map<avc, avc> paramMap)
{
avc localavc = null;
int i = 0;
double d1 = 0.0D;
Iterator localIterator = paramMap.entrySet().iterator();
paramMap = localavc;
while (localIterator.hasNext())
{
localavc = (avc)((Map.Entry)localIterator.next()).getValue();
if (localavc != null)
{
int j = localavc.d();
double d2 = localavc.c();
if (d1 != 0.0D) {
Math.abs(d2 - d1);
}
if (j <= i) {
break label106;
}
i = j;
paramMap = localavc;
d1 = d2;
}
}
label106:
for (;;)
{
break;
return paramMap;
}
}
@chd
public final avc a(@chc Collection<avc> paramCollection)
{
if (paramCollection.size() == 0) {
throw new IllegalArgumentException("No media source resolutions to compare");
}
HashMap localHashMap = new HashMap();
Iterator localIterator = paramCollection.iterator();
while (localIterator.hasNext())
{
avc localavc = (avc)localIterator.next();
if (!localHashMap.containsKey(localavc))
{
paramCollection = xx.a(localavc).a(4000000);
if (paramCollection != null) {}
for (;;)
{
localHashMap.put(localavc, paramCollection);
break;
paramCollection = a(localavc);
}
}
}
return a(localHashMap);
}
}
/* Location:
* Qualified Name: bhe
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
0eabf46ac8b525891ff8d043adf89ae5ae43ccd5 | 2e98a39e61db1e5da89a71607b13082af4ddca94 | /flexwdreanew/src/com/flexwm/server/op/PmProductKit.java | 3aa40fbd1d91b5c3f27d0c501f096f81cff01a65 | [] | no_license | ceherrera-sym/flexwm-dreanew | 59b927a48a8246babe827f19a131b9129abe2a52 | 228ed7be7718d46a1f2592c253b096e1b942631e | refs/heads/master | 2022-12-18T13:44:42.804524 | 2020-09-15T15:01:52 | 2020-09-15T15:01:52 | 285,393,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 963 | java | /**
* SYMGF
* Derechos Reservados Mauricio Lopez Barba
* Este software es propiedad de Mauricio Lopez Barba, y no puede ser
* utilizado, distribuido, copiado sin autorizacion expresa por escrito.
*
* @author Mauricio Lopez Barba
* @version 2013-10
*/
package com.flexwm.server.op;
import com.symgae.server.PmObject;
import com.symgae.server.PmConn;
import com.symgae.shared.BmObject;
import com.symgae.shared.SFException;
import com.symgae.shared.SFParams;
import com.symgae.shared.SFPmException;
import com.flexwm.shared.op.BmoProductKit;
public class PmProductKit extends PmObject {
BmoProductKit bmoProductKit;
public PmProductKit(SFParams sfParams) throws SFPmException {
super(sfParams);
bmoProductKit = new BmoProductKit();
setBmObject(bmoProductKit);
}
@Override
public BmObject populate(PmConn pmConn) throws SFException {
bmoProductKit = (BmoProductKit)autoPopulate(pmConn, new BmoProductKit());
return bmoProductKit;
}
}
| [
"ceherrera.symetria@gmail.com"
] | ceherrera.symetria@gmail.com |
0db46bcffbe65393c002ea3cb3561f3ef5fd099b | db83b09d64da7f43eb42aa5f0b9531eedcc256dc | /src/test/java/com/bridgelabz/parkinglot/exception/mockito/TestAirportSecurity.java | eb19d21621990e19250e8709e694b083ca797569 | [] | no_license | kalyaniRane/ParkingLotSystemProblem_TDD | 40be37829d5a47c3cdf2943d97ac7ea575acab50 | 46cb291b9c00ac703ae1ce17c741028bc4fcb1d4 | refs/heads/master | 2022-04-17T00:16:10.676260 | 2020-04-05T13:25:02 | 2020-04-05T13:25:02 | 249,129,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,211 | java | package com.bridgelabz.parkinglot.exception.mockito;
import com.bridgelabz.parkinglot.AirportSecurity;
import com.bridgelabz.parkinglot.Dao.Vehicle;
import com.bridgelabz.parkinglot.ParkingLotInformer;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
public class TestAirportSecurity {
AirportSecurity airportSecurity;
ParkingLotInformer lotInformer;
@Before
public void setUp() throws Exception {
airportSecurity = new AirportSecurity();
lotInformer=mock(ParkingLotInformer.class);
}
@Test
public void givenMockitoTest_WhenCheckSecurityClassWithCheckCapacityIsFull() {
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
airportSecurity.capacityIsFull();
return null;
}
}).when(lotInformer).getInformedObserver();
lotInformer.getInformedObserver();
Assert.assertTrue(airportSecurity.isCapacityFull());
}
}
| [
"kalyanirane19@gmail.com"
] | kalyanirane19@gmail.com |
2dc48fe6e7f7bf4abdf596e504e0e648e9492fa0 | 8ea60603f4b3aaceff2ba76ca56d916ba3adc7b1 | /src/exceptions/NegativeNumberException.java | ef56d75d09eaea85c170910f92269707adc80860 | [] | no_license | ciobanuvlad/GUIproject | 1ecb4f932d8bb68f1d44260c0575b64f6d492ef4 | 617dd935855fe9a9a7836bf6d5e96135c9d76e9d | refs/heads/master | 2021-01-01T03:50:18.201748 | 2016-05-21T14:05:15 | 2016-05-21T14:05:15 | 58,932,029 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | /**
* This class it is used for prices which are negative.
*/
package exceptions;
/**
* @author Vlad
*
*/
@SuppressWarnings("serial")
public class NegativeNumberException extends Exception{
private static String message="Your Price it is negative";
public NegativeNumberException() {
super(message);
}
public String getMessage() {
return message;
}
}
| [
"Vlad@DESKTOP-AL0B7LG"
] | Vlad@DESKTOP-AL0B7LG |
9b27f0aa099bb5f122948e3e06cdfc39935e150e | 5103ed8b4f99fba3ba0fcc5852db43b3eebb8640 | /src/main/java/pl/mmalz/dao/AgentDAOImpl.java | d2f61e520671ba4bf29e9248673cadb37659e113 | [] | no_license | itsjustfortesting/LinkCreator | 20728793e39b21553c8e20ac3efaf05d62592612 | 2d36a898754a75524d4af22c80188c02fe41f313 | refs/heads/master | 2021-04-28T15:36:21.335755 | 2018-02-18T21:23:42 | 2018-02-18T21:23:42 | 121,991,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,310 | java | package pl.mmalz.dao;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import pl.mmalz.model.Agent;
import javax.persistence.NoResultException;
@Repository
public class AgentDAOImpl implements AgentDAO {
@Autowired
private SessionFactory sessionFactory;
@Override
public Agent getAgent(String identifier) {
String[] split = identifier.split(":");
if (split.length != 2) {
return null;
}
String identifierType = split[0];
String identifierValue = split[1];
Session session = sessionFactory.getCurrentSession();
Agent agent = null;
try {
if (identifierType.equals("agsymbol")) {
agent = (Agent) session.createQuery("from Agent where agSymbol = :agsymbol").setParameter("agsymbol", identifierValue).getSingleResult();
} else if (identifierType.equals("taxnumber")) {
agent = (Agent) session.createQuery("from Agent where taxNumber = :taxnumber").setParameter("taxnumber", identifierValue).getSingleResult();
}
} catch (NoResultException e) {
return null;
}
return agent;
}
}
| [
"mma@mma.pl"
] | mma@mma.pl |
c4353f49fa1d710fc90dac98a955bc7dcfe2b510 | 824987203c8db074f547730278e84570bdc7305a | /app/src/main/java/com/socialapp/wsd/Utils/StringManipulation.java | 3f5702f03e935c459a422d3a481899f4d47389e7 | [] | no_license | BillyStudio/social-app-android | 7dfc8d7a113daf59c2638dd1a8e20fd99dc8f614 | b64e7c328e31412ab7a7d5e5532c9caf29f888c9 | refs/heads/master | 2020-03-20T19:47:27.285009 | 2018-07-06T23:23:53 | 2018-07-06T23:23:53 | 137,653,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,058 | java | package com.socialapp.wsd.Utils;
public class StringManipulation {
public static String expandUsername(String username) {
return username.replace(".", "");
}
public static String condenseUsername(String username) {
return username.replace(" ", ".");
}
public static String getTags(String string){
if(string.indexOf("#") > 0){
StringBuilder sb = new StringBuilder();
char[] charArray = string.toCharArray();
boolean foundWord = false;
for( char c : charArray){
if(c == '#'){
foundWord = true;
sb.append(c);
}else{
if(foundWord){
sb.append(c);
}
}
if(c == ' ' ){
foundWord = false;
}
}
String s = sb.toString().replace(" ", "").replace("#", ",#");
return s.substring(1, s.length());
}
return string;
}
}
| [
"billy.ustb2016@gmail.com"
] | billy.ustb2016@gmail.com |
04ae88fbc7bc1df870d8f509a951312ed3d63f07 | eb7b450eef54c7c7c43001b03a1a0a6ac27fbbd6 | /SM/MS/src/org/biz/invoicesystem/ui/list/master/CustomerLV.java | 575c9ecbb10e658b7d24da4a31688727dc9d1c58 | [] | no_license | mjawath/jposible | e2feb7de7bfa80dc538639ae5ca13480f8dcc2db | b6fb1cde08dc531dd3aff1113520d106dd1a732c | refs/heads/master | 2021-01-10T18:55:41.024529 | 2018-05-14T01:25:05 | 2018-05-14T01:25:05 | 32,131,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,027 | 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 org.biz.invoicesystem.ui.list.master;
import java.util.ArrayList;
import java.util.List;
import org.biz.invoicesystem.entity.master.Customer;
import org.components.parent.controls.PTableColumn;
import org.components.windows.ListViewUI;
/**
*
* @author Jawad
*/
public class CustomerLV extends ListViewUI {
/**
* Creates new form ItemLV
*/
public CustomerLV() {
super();
List<PTableColumn> tblCols = new ArrayList();
tblCols.add(new PTableColumn(String.class, "ID"));
PTableColumn colcode = new PTableColumn(String.class, "Code");
colcode.setMinWidth(80);
tblCols.add(colcode);
PTableColumn colname = new PTableColumn(String.class, "Name");
colname.setWidth(250);
tblCols.add(colname);
getTable().init(Customer.class, tblCols);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 790, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 494, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
public Object[] getTableData(Object row) {
Customer item = (Customer) row;
return new Object[]{item, item.getId(), item.getCode()};
}
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}
| [
"mjawath@gmail.com"
] | mjawath@gmail.com |
05e55e4139632f76823680f64ca5f8b3c4f1ca73 | 58fbd06f725ad0f5644efdbc8bac05f4d596d7bb | /src/org/omg/PortableServer/_ServantLocatorStub.java | 66cc3accfd2bd223aaad8eeb584ee8cd45abe037 | [] | no_license | JadeLuo/jdk1.8 | a3ee5b4bd64a5e0a596df6a91f49485c2234049e | c9d01efd8397b552ffc8d7399f633c953aabbd7e | refs/heads/master | 2020-06-10T16:24:31.266186 | 2018-12-15T03:17:49 | 2018-12-15T03:17:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,043 | java | package org.omg.PortableServer;
/**
* org/omg/PortableServer/_ServantLocatorStub.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from /HUDSON/workspace/8-2-build-linux-amd64/jdk8u77/6540/corba/src/share/classes/org/omg/PortableServer/poa.idl
* Sunday, March 20, 2016 10:01:25 PM PDT
*/
/**
* When the POA has the NON_RETAIN policy it uses servant
* managers that are ServantLocators. Because the POA
* knows that the servant returned by this servant
* manager will be used only for a single request,
* it can supply extra information to the servant
* manager's operations and the servant manager's pair
* of operations may be able to cooperate to do
* something different than a ServantActivator.
* When the POA uses the ServantLocator interface,
* immediately after performing the operation invocation
* on the servant returned by preinvoke, the POA will
* invoke postinvoke on the servant manager, passing the
* ObjectId value and the Servant value as parameters
* (among others). This feature may be used to force
* every request for objects associated with a POA to
* be mediated by the servant manager.
*/
public class _ServantLocatorStub extends org.omg.CORBA.portable.ObjectImpl implements org.omg.PortableServer.ServantLocator
{
final public static java.lang.Class _opsClass = ServantLocatorOperations.class;
/**
* This operations is used to get a servant that will be
* used to process the request that caused preinvoke to
* be called.
* @param oid the object id associated with object on
* which the request was made.
* @param adapter the reference for POA in which the
* object is being activated.
* @param operation the operation name.
* @param the_cookie an opaque value that can be set
* by the servant manager to be used
* during postinvoke.
* @return Servant used to process incoming request.
* @exception ForwardRequest to indicate to the ORB
* that it is responsible for delivering
* the current request and subsequent
* requests to the object denoted in the
* forward_reference member of the exception.
*/
public org.omg.PortableServer.Servant preinvoke (byte[] oid, org.omg.PortableServer.POA adapter, String operation, org.omg.PortableServer.ServantLocatorPackage.CookieHolder the_cookie) throws org.omg.PortableServer.ForwardRequest
{
org.omg.CORBA.portable.ServantObject $so = _servant_preinvoke ("preinvoke", _opsClass);
ServantLocatorOperations $self = (ServantLocatorOperations) $so.servant;
try {
return $self.preinvoke (oid, adapter, operation, the_cookie);
} finally {
_servant_postinvoke ($so);
}
} // preinvoke
/**
* This operation is invoked whenener a servant completes
* a request.
* @param oid the object id ssociated with object on which
* the request was made.
* @param adapter the reference for POA in which the
* object was active.
* @param the_cookie an opaque value that contains
* the data set by preinvoke.
* @param the_servant reference to the servant that is
* associated with the object.
*/
public void postinvoke (byte[] oid, org.omg.PortableServer.POA adapter, String operation, java.lang.Object the_cookie, org.omg.PortableServer.Servant the_servant)
{
org.omg.CORBA.portable.ServantObject $so = _servant_preinvoke ("postinvoke", _opsClass);
ServantLocatorOperations $self = (ServantLocatorOperations) $so.servant;
try {
$self.postinvoke (oid, adapter, operation, the_cookie, the_servant);
} finally {
_servant_postinvoke ($so);
}
} // postinvoke
// Type-specific CORBA::Object operations
private static String[] __ids = {
"IDL:omg.org/PortableServer/ServantLocator:1.0",
"IDL:omg.org/PortableServer/ServantManager:1.0"};
public String[] _ids ()
{
return (String[])__ids.clone ();
}
private void readObject (java.io.ObjectInputStream s) throws java.io.IOException
{
String str = s.readUTF ();
String[] args = null;
java.util.Properties props = null;
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);
try {
org.omg.CORBA.Object obj = orb.string_to_object (str);
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
_set_delegate (delegate);
} finally {
orb.destroy() ;
}
}
private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
{
String[] args = null;
java.util.Properties props = null;
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);
try {
String str = orb.object_to_string (this);
s.writeUTF (str);
} finally {
orb.destroy() ;
}
}
} // class _ServantLocatorStub
| [
"https://gitee.com/Uchain/test.git"
] | https://gitee.com/Uchain/test.git |
d4439505817abe1be746a66908040608be06c476 | bbaa8e75b04a4097b1b63e6ab70ea8b5ead50072 | /src/main/java/by/romanov/voice/recognation/service/impl/UserServiceImpl.java | 11d24b3f731028e30c304b09784a3049efc4ed7f | [] | no_license | grafdark/project | 501215268ccd18a20c8867ecaf2efd54481865f3 | 552838d5894bb28f6acaccc11bd1a65fa7179a4d | refs/heads/master | 2021-01-10T18:34:08.599474 | 2016-05-06T05:23:49 | 2016-05-06T05:23:49 | 28,295,597 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 127 | java | package by.romanov.voice.recognation.service.impl;
/**
* Created by graf on 01.05.2016.
*/
public class UserServiceImpl {
}
| [
"y.ramanau@dmaby.com"
] | y.ramanau@dmaby.com |
7cf94b8959d801e59c87765e2aa523ca45b6a4a3 | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-11/u-11-111/u-11-111-1112/u-11-111-1112-11113-111111/u-11-111-1112-11113-111111-f1294.java | 41491be1069b51af8a42a46a2c515ea7fa3698fd | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
4034938312030 | [
"jenkins@khan.paloaltonetworks.local"
] | jenkins@khan.paloaltonetworks.local |
ef63ba587d1a7614dd1d164c3881ad164b660a50 | 2bc638e5faf56dae2e2cb4e7e44e8e075e937e31 | /Laskin/src/main/java/ohtu/Erotus.java | 1351e2e097068041f1d2afdddf844a83cb406828 | [] | no_license | pullari/ohtu-viikko6 | 9a3156d525061687bc9dfe7f950a45aa24f9109f | 2c944797437b2b4c0aeddef0ab7a3a1a3111f5e3 | refs/heads/master | 2021-01-20T07:52:24.397551 | 2017-05-02T20:43:40 | 2017-05-02T20:43:40 | 90,056,641 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,166 | 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 ohtu;
import javax.swing.JTextField;
/**
*
* @author pullis
*/
public class Erotus implements Komento {
Sovelluslogiikka sovellus;
JTextField tuloskentta;
JTextField syotekentta;
private int alku;
public Erotus (Sovelluslogiikka sovellus, JTextField tuloskentta, JTextField syotekentta) {
this.sovellus = sovellus;
this.tuloskentta = tuloskentta;
this.syotekentta = syotekentta;
}
@Override
public void suorita() {
int arvo = 0;
alku = Integer.parseInt(tuloskentta.getText()) + arvo;
try {
arvo = Integer.parseInt(syotekentta.getText());
int tulos = Integer.parseInt(tuloskentta.getText()) - arvo;
syotekentta.setText("");
tuloskentta.setText("" + tulos);
} catch (Exception e) {
}
}
@Override
public void peru() {
syotekentta.setText("");
tuloskentta.setText("" + alku);
}
}
| [
"samuli.rouvinen@cs.helsinki.fi"
] | samuli.rouvinen@cs.helsinki.fi |
2fea8c8e2ed1cab6feb18639a9ce36b61a6ee1ab | 352a849fc9505f7a28c9188e9a28be5fa49073b9 | /fss-search-sdk/fss-search-client/es-search-client/src/main/java/com/znv/fss/es/MultiIndexExactSearch/ExactSearchQueryParam.java | 825add4cedab513657c079fe7b2cb315331ecbc7 | [] | no_license | SelinCao/MyThirdRepository20190322 | 975a41ab9f32051f0d456db296da1c9ca05f4872 | 00746d02e0b30384af92fd3e04678c0e16d06ce4 | refs/heads/master | 2020-04-30T20:08:25.081303 | 2019-03-22T02:46:44 | 2019-03-22T02:46:44 | 177,057,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,905 | java | package com.znv.fss.es.MultiIndexExactSearch;
import com.alibaba.fastjson.annotation.JSONField;
import java.util.List;
/**
* Created by User on 2017/8/25.
*/
public class ExactSearchQueryParam {
@JSONField(name = "event_id")
private String eventId;
@JSONField(name = "enter_time_start")
private String enterTimeStart;
@JSONField(name = "enter_time_end")
private String enterTimeEnd;
@JSONField(name = "office_id")
private List<String> officeId;
@JSONField(name = "camera_id")
private List<String> cameraId;
@JSONField(name = "office_name")
private String officeName;
@JSONField(name = "camera_name")
private String cameraName;
@JSONField(name = "person_id")
private String personId;
@JSONField(name = "age_start")
private int ageStart;
@JSONField(name = "age_end")
private int ageEnd = -1;
private int gender = -1;
private int glass = -1;
private int mask = -1;
private int race = -1;
private int beard = -1;
private int emotion = -1;
@JSONField(name = "eye_open")
private int eyeOpen = -1;
@JSONField(name = "mouth_open")
private int mouthOpen = -1;
@JSONField(name = "is_calcSim")
private boolean isCalcSim;
@JSONField(name = "feature_value")
private List<String> featureValue;
@JSONField(name = "sim_threshold")
private double simThreshold;
@JSONField(name = "filter_type")
private String filterType;
private String sortField;
private String sortOrder;
private int from;
private int size;
@JSONField(name = "coarse_code_num")
private int coarseCodeNum;
public void setEventId(String eventId) {
this.eventId = eventId;
}
public String getEventId() {
return this.eventId;
}
public void setEnterTimeStart(String enterTimeStart) {
this.enterTimeStart = enterTimeStart;
}
public String getEnterTimeStart() {
return this.enterTimeStart;
}
public void setEnterTimeEnd(String enterTimeEnd) {
this.enterTimeEnd = enterTimeEnd;
}
public String getEnterTimeEnd() {
return this.enterTimeEnd;
}
public void setOfficeId(List<String> officeId) {
this.officeId = officeId;
}
public List<String> getOfficeId() {
return this.officeId;
}
public void setOfficeName(String officeName) {
this.officeName = officeName;
}
public String getOfficeName() {
return this.officeName;
}
public void setCameraId(List<String> cameraId) {
this.cameraId = cameraId;
}
public List<String> getCameraId() {
return this.cameraId;
}
public void setCameraName(String cameraName) {
this.cameraName = cameraName;
}
public String getCameraName() {
return this.cameraName;
}
public void setPersonId(String personId) {
this.personId = personId;
}
public String getPersonId() {
return this.personId;
}
public void setAgeStart(int ageStart) {
this.ageStart = ageStart;
}
public int getAgeStart() {
return this.ageStart;
}
public void setAgeEnd(int ageEnd) {
this.ageEnd = ageEnd;
}
public int getAgeEnd() {
return this.ageEnd;
}
public void setGender(int gender) {
this.gender = gender;
}
public int getGender() {
return this.gender;
}
public void setGlass(int glass) {
this.glass = glass;
}
public int getGlass() {
return this.glass;
}
public void setMask(int mask) {
this.mask = mask;
}
public int getMask() {
return this.mask;
}
public void setRace(int race) {
this.race = race;
}
public int getRace() {
return this.race;
}
public void setBeard(int beard) {
this.beard = beard;
}
public int getBeard() {
return this.beard;
}
public void setEmotion(int emotion) {
this.emotion = emotion;
}
public int getEmotion() {
return this.emotion;
}
public void setEyeOpen(int eyeOpen) {
this.eyeOpen = eyeOpen;
}
public int getEyeOpen() {
return this.eyeOpen;
}
public void setMouthOpen(int mouthOpen) {
this.mouthOpen = mouthOpen;
}
public int getMouthOpen() {
return this.mouthOpen;
}
public void setIsCalcSim(boolean isCalcSim) {
this.isCalcSim = isCalcSim;
}
public boolean getIsCalcSim() {
return this.isCalcSim;
}
public void setSimThreshold(double simThreshold) {
this.simThreshold = simThreshold;
}
public double getSimThreshold() {
return this.simThreshold;
}
public void setFilterType(String filterType) {
this.filterType = filterType;
}
public String getFilterType() {
return this.filterType;
}
public void setFeatureValue(List<String>featureValue) {
this.featureValue = featureValue;
}
public List<String> getFeatureValue() {
return featureValue;
}
public void setSortField(String sortField) {
this.sortField = sortField;
}
public String getSortField() {
return this.sortField;
}
public void setSortOrder(String sortOrder) {
this.sortOrder = sortOrder;
}
public String getSortOrder() {
return this.sortOrder;
}
public void setFrom(int from) {
this.from = from;
}
public int getFrom() {
return this.from;
}
public void setSize(int size) {
this.size = size;
}
public int getSize() {
return this.size;
}
public void setCoarseCodeNum(int coarseCodeNum) {
this.coarseCodeNum = coarseCodeNum;
}
public int getCoarseCodeNum() {
return coarseCodeNum;
}
}
| [
"czengling@163.com"
] | czengling@163.com |
0d62c38cae48532882cb3b1b88342b5a42312a7e | 952789d549bf98b84ffc02cb895f38c95b85e12c | /V_2.x/Server/branches/SpagoBIJPaloEngineOld/src/com/tensegrity/palowebviewer/modules/engine/client/ObjectKey.java | f669a88f33c3dda42d54a9e794e2f379b48b11c6 | [] | no_license | emtee40/testingazuan | de6342378258fcd4e7cbb3133bb7eed0ebfebeee | f3bd91014e1b43f2538194a5eb4e92081d2ac3ae | refs/heads/master | 2020-03-26T08:42:50.873491 | 2015-01-09T16:17:08 | 2015-01-09T16:17:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 562 | java | package com.tensegrity.palowebviewer.modules.engine.client;
public class ObjectKey {
private final Object value;
public ObjectKey(Object value) {
this.value = value;
}
public Object getObject () {
return value;
}
public boolean equals(Object o) {
boolean result = o instanceof ObjectKey;
if(result) {
ObjectKey key = (ObjectKey)o;
result = key.value == value;
}
return result;
}
public int hashCode() {
int result = 0;
if(value != null)
result = value.hashCode();
return result;
}
}
| [
"gioia@99afaf0d-6903-0410-885a-c66a8bbb5f81"
] | gioia@99afaf0d-6903-0410-885a-c66a8bbb5f81 |
ca6e63646e41918ed5392d16043795d4464ebccf | 800c573dd50a23a0f7b05ffde2f6782b4369f70f | /stress-java/src/main/java/gocgrouptool/stressjava/StressJavaApplication.java | 684f656e5fc3fe8e83aa008769967113f5c980c8 | [
"Apache-2.0"
] | permissive | labilezhu/go-cgroup-tool | 28622487908b8000599d75aa4cbd47fdceedf1dc | f1dfd9b459e53afa2489e761e8867f10326a25a7 | refs/heads/master | 2022-09-23T15:28:33.336831 | 2020-05-30T13:27:33 | 2020-05-30T13:29:17 | 268,084,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package gocgrouptool.stressjava;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import stress.Main;
@SpringBootApplication
public class StressJavaApplication {
public static void main(String[] args) {
Main.main(null);
SpringApplication.run(StressJavaApplication.class, args);
}
}
| [
"labile.zhu@gmail.com"
] | labile.zhu@gmail.com |
77863c7cd6c30f9f49d4b7d344fa158f5c6136c0 | 8870fa16fe6f0fe3e791c1463c5ee83c46f86839 | /mmoarpg/platform-gm/src/main/java/cn/qeng/gm/module/backstage/domain/LoginPlatform.java | eb7e08fb6e3bcf33cc39cadac0d58bb36238ec40 | [] | no_license | daxingyou/yxj | 94535532ea4722493ac0342c18d575e764da9fbb | 91fb9a5f8da9e5e772e04b3102fe68fe0db5e280 | refs/heads/master | 2022-01-08T10:22:48.477835 | 2018-04-11T03:18:37 | 2018-04-11T03:18:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,493 | java | /*
* Copyright © 2017 qeng.cn All Rights Reserved.
*
* 感谢您加入清源科技,不用多久,您就会升职加薪、当上总经理、出任CEO、迎娶白富美、从此走上人生巅峰
* 除非符合本公司的商业许可协议,否则不得使用或传播此源码,您可以下载许可协议文件:
*
* http://www.noark.xyz/qeng/LICENSE
*
* 1、未经许可,任何公司及个人不得以任何方式或理由来修改、使用或传播此源码;
* 2、禁止在本源码或其他相关源码的基础上发展任何派生版本、修改版本或第三方版本;
* 3、无论你对源代码做出任何修改和优化,版权都归清源科技所有,我们将保留所有权利;
* 4、凡侵犯清源科技相关版权或著作权等知识产权者,必依法追究其法律责任,特此郑重法律声明!
*/
package cn.qeng.gm.module.backstage.domain;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 登录平台.
*
* @author 小流氓(mingkai.zhou@qeng.net)
*/
@Entity
@Table(name = "login_platform")
public class LoginPlatform {
@Id
@Column(name = "id", nullable = false, length = 128)
private String id;
// 平台名称
@Column(name = "name", nullable = false, length = 128)
private String name;
// 平台密钥
@Column(name = "secretkey", nullable = false, length = 128)
private String secretkey;
// 密码登录的标识(不能修改)
@Column(name = "password", nullable = false)
private boolean password;
@Column(name = "create_time", nullable = false)
private Date createTime;
@Column(name = "modify_time", nullable = false)
private Date modifyTime;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSecretkey() {
return secretkey;
}
public void setSecretkey(String secretkey) {
this.secretkey = secretkey;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public boolean isPassword() {
return password;
}
public void setPassword(boolean password) {
this.password = password;
}
} | [
"lkjx3031274@163.com"
] | lkjx3031274@163.com |
1b581d1f2ae076c70517a6be47ef03997f5e3e74 | 0f89278a6f34c04ba622457ce2f43d746677d2fc | /app/src/main/java/com/oschina/bluelife/newcontact/widget/RecyclerViewFastScroller.java | de96818f5d17dd05570147bb27204dbf7bda1f4a | [] | no_license | bluelife/NewContact | 0fd46145ebdc0846d57d1b9878c5664325ff1870 | c74f62eea1797a553d8f1430a85c0e386d40ad27 | refs/heads/master | 2021-01-12T18:14:36.907221 | 2016-11-14T01:43:30 | 2016-11-14T01:43:30 | 71,345,847 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,455 | java | package com.oschina.bluelife.newcontact.widget;
/**
* Created by slomka.jin on 2016/10/19.
*/
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Rect;
import android.support.annotation.IdRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.oschina.bluelife.newcontact.R;
import com.oschina.bluelife.newcontact.widget.model.AlphabetItem;
import java.util.List;
public class RecyclerViewFastScroller extends LinearLayout {
private static final int BUBBLE_ANIMATION_DURATION = 100;
private static final int TRACK_SNAP_RANGE = 5;
private TextView bubble;
private View handle;
private RecyclerView recyclerView;
private int height;
private boolean isInitialized = false;
private ObjectAnimator currentAnimator = null;
public interface BubbleTextGetter {
String getTextToShowInBubble(int pos);
}
public RecyclerViewFastScroller(final Context context) {
super(context);
initialiseView();
}
public RecyclerViewFastScroller(final Context context, final AttributeSet attrs) {
super(context, attrs);
initialiseView();
}
protected void initialiseView() {
if (isInitialized)
return;
isInitialized = true;
setOrientation(HORIZONTAL);
setClipChildren(false);
setViewsToUse(R.layout.fast_scroller, R.id.fastscroller_bubble, R.id.fastscroller_handle, R.id.alphabet);
}
private void setViewsToUse(@LayoutRes int layoutResId, @IdRes int bubbleResId, @IdRes int handleResId, @IdRes int alphabetListView) {
final LayoutInflater inflater = LayoutInflater.from(getContext());
inflater.inflate(layoutResId, this, true);
bubble = (TextView) findViewById(bubbleResId);
bubble.setVisibility(INVISIBLE);
handle = findViewById(handleResId);
//Alphabet
alphabetRecyclerView = (RecyclerView) findViewById(alphabetListView);
alphabetRecyclerView.setOnTouchListener(new AlphabetTouchListener());
alphabetRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
height = h;
}
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
final int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
if (event.getX() < ViewCompat.getX(handle) - ViewCompat.getPaddingStart(handle))
return false;
if (bubble != null && bubble.getVisibility() == INVISIBLE)
showBubble();
handle.setSelected(true);
case MotionEvent.ACTION_MOVE:
final float y = event.getY();
setBubbleAndHandlePosition(y);
setRecyclerViewPosition(y);
return true;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
handle.setSelected(false);
hideBubble();
return true;
}
return super.onTouchEvent(event);
}
public void setRecyclerView(RecyclerView recyclerView) {
this.recyclerView = recyclerView;
RecyclerView.OnScrollListener onScrollListener = new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(final RecyclerView recyclerView, final int dx, final int dy) {
if (bubble == null || handle.isSelected() || recyclerView.getScrollState() == RecyclerView.SCROLL_STATE_IDLE)
return;
final int verticalScrollOffset = recyclerView.computeVerticalScrollOffset();
final int verticalScrollRange = recyclerView.computeVerticalScrollRange();
float proportion = (float) verticalScrollOffset / ((float) verticalScrollRange - height);
setBubbleAndHandlePosition(height * proportion);
setRecyclerViewPositionWithoutScrolling(height * proportion);
bubble.setVisibility(VISIBLE);
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
bubble.setVisibility(INVISIBLE);
//clearAllAlphabetWorkSelected();
}
}
};
recyclerView.addOnScrollListener(onScrollListener);
}
private void setRecyclerViewPosition(float y) {
if (recyclerView != null) {
final int itemCount = recyclerView.getAdapter().getItemCount();
float proportion;
if (ViewCompat.getY(handle) == 0)
proportion = 0f;
else if (ViewCompat.getY(handle) + handle.getHeight() >= height - TRACK_SNAP_RANGE)
proportion = 1f;
else
proportion = y / (float) height;
final int targetPos = getValueInRange(0, itemCount - 1, (int) (proportion * (float) itemCount));
((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(targetPos, 0);
final String bubbleText = ((BubbleTextGetter) recyclerView.getAdapter()).getTextToShowInBubble(targetPos);
if (bubble != null)
bubble.setText(bubbleText);
setAlphabetWorkSelected(bubbleText);
}
}
private void setRecyclerViewPositionWithoutScrolling(float y) {
if (recyclerView != null) {
final int itemCount = recyclerView.getAdapter().getItemCount();
float proportion;
if (ViewCompat.getY(handle) == 0)
proportion = 0f;
else if (ViewCompat.getY(handle) + handle.getHeight() >= height - TRACK_SNAP_RANGE)
proportion = 1f;
else
proportion = y / (float) height;
final int targetPos = getValueInRange(0, itemCount - 1, (int) (proportion * (float) itemCount));
final String bubbleText = ((BubbleTextGetter) recyclerView.getAdapter()).getTextToShowInBubble(targetPos);
if (bubble != null)
bubble.setText(bubbleText);
setAlphabetWorkSelected(bubbleText);
}
}
private int getValueInRange(int min, int max, int value) {
int minimum = Math.max(min, value);
return Math.min(minimum, max);
}
private void setBubbleAndHandlePosition(float y) {
final int handleHeight = handle.getHeight();
ViewCompat.setY(handle,getValueInRange(getPaddingTop(), height - handleHeight, (int) (y - handleHeight / 2)));
if (bubble != null) {
int bubbleHeight = bubble.getHeight();
ViewCompat.setY(bubble,getValueInRange(getPaddingTop(), height - bubbleHeight - handleHeight / 2, (int) (y - bubbleHeight)));
}
}
private void showBubble() {
if (bubble == null)
return;
bubble.setVisibility(VISIBLE);
}
private void hideBubble() {
if (bubble == null)
return;
bubble.setVisibility(INVISIBLE);
}
//----------------------------------------------------------------------------------------------
// Alphabet Section
//----------------------------------------------------------------------------------------------
private List<AlphabetItem> alphabets;
private RecyclerView alphabetRecyclerView;
private AlphabetAdapter alphabetAdapter;
public void setUpAlphabet(List<AlphabetItem> alphabetItems) {
if (alphabetItems == null || alphabetItems.size() <= 0)
return;
alphabets = alphabetItems;
alphabetAdapter = new AlphabetAdapter(getContext(), alphabets);
alphabetAdapter.setOnItemClickListener(new OnAlphabetItemClickListener());
alphabetRecyclerView.setAdapter(alphabetAdapter);
}
public void updateData(){
/*for (int i = 0; i < alphabets.size(); i++) {
if(word.equalsIgnoreCase(alphabets.get(i).word)){
alphabets.remove(i);
break;
}
}*/
alphabetAdapter.notifyDataSetChanged();
}
private class AlphabetTouchListener implements OnTouchListener {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_MOVE: {
Rect rect = new Rect();
int childCount = alphabetRecyclerView.getChildCount();
int[] listViewCoords = new int[2];
alphabetRecyclerView.getLocationOnScreen(listViewCoords);
int x = (int) motionEvent.getRawX() - listViewCoords[0];
int y = (int) motionEvent.getRawY() - listViewCoords[1];
View child;
for (int i = 0; i < childCount; i++) {
child = alphabetRecyclerView.getChildAt(i);
child.getHitRect(rect);
// This is your pressed view
if (rect.contains(x, y)) {
LinearLayoutManager layoutManager = ((LinearLayoutManager)alphabetRecyclerView.getLayoutManager());
int firstVisiblePosition = layoutManager.findFirstVisibleItemPosition();
int position = i + firstVisiblePosition;
performSelectedAlphabetWord(position);
alphabetTouchEventOnItem(position);
break;
}
}
view.onTouchEvent(motionEvent);
}
}
return true;
}
}
private void performSelectedAlphabetWord(int position) {
if (position < 0 || position >= alphabets.size())
return;
for (AlphabetItem alphabetItem : alphabets) {
alphabetItem.isActive = false;
}
alphabets.get(position).isActive = true;
alphabetAdapter.refreshDataChange(alphabets);
}
private void alphabetTouchEventOnItem(int position) {
if (alphabets == null || position < 0 || position >= alphabets.size())
return;
takeRecyclerViewScrollToAlphabetPosition(alphabets.get(position).position);
}
private class OnAlphabetItemClickListener implements AlphabetAdapter.OnItemClickListener {
@Override
public void OnItemClicked(int alphabetPosition, int position) {
performSelectedAlphabetWord(position);
takeRecyclerViewScrollToAlphabetPosition(alphabetPosition);
}
}
private void takeRecyclerViewScrollToAlphabetPosition(int position) {
if (recyclerView == null || recyclerView.getAdapter() == null)
return;
int count = recyclerView.getAdapter().getItemCount();
if (position < 0 || position > count)
return;
((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(position, 0);
}
private void setAlphabetWorkSelected(String bubbleText) {
if (bubbleText == null || bubbleText.trim().isEmpty())
return;
for (int i = 0; i < alphabets.size(); i++) {
AlphabetItem alphabetItem = alphabets.get(i);
if (alphabetItem == null || alphabetItem.word.trim().isEmpty())
continue;
if (alphabetItem.word.equals(bubbleText)) {
performSelectedAlphabetWord(i);
alphabetRecyclerView.smoothScrollToPosition(i);
break;
}
}
}
}
| [
"28998638@qq.com"
] | 28998638@qq.com |
0620d76ca1e9a3a7c55cfddea859ba9332629358 | 88e00a7475f6aaf2ccad14bc701e8228ed7f454d | /src/dfs/CourseSchedule.java | 4b73a1baaad4f755925529e71a4da580702efbb2 | [] | no_license | hailin/LeetCode | c3b239cb69ecd60e6121a7ff32a37f586b3da8b6 | 9b3567dc6450adf6503a437caa42e3a371748672 | refs/heads/master | 2020-04-26T21:53:51.720309 | 2020-01-13T05:06:12 | 2020-01-13T05:06:12 | 173,855,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,444 | java | package dfs;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* There are a total of n courses you have to take, labeled from 0 to n-1.
*
* Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]
*
* Given the total number of courses and a list of prerequisite pairs, is it possible for you to finish all courses?
*
* Example 1:
*
* Input: 2, [[1,0]]
* Output: true
* Explanation: There are a total of 2 courses to take.
* To take course 1 you should have finished course 0. So it is possible.
* Example 2:
*
* Input: 2, [[1,0],[0,1]]
* Output: false
* Explanation: There are a total of 2 courses to take.
* To take course 1 you should have finished course 0, and to take course 0 you should
* also have finished course 1. So it is impossible.
* Note:
*
* The input prerequisites is a graph represented by a list of edges, not adjacency matrices. Read more about how a graph is represented.
* You may assume that there are no duplicate edges in the input prerequisites.
*/
public class CourseSchedule {
public boolean canFinish(int numCourses, int[][] prerequisites) {
Map<Integer, Set<Integer>> graph = buildGraph(numCourses, prerequisites);
boolean[] visited = new boolean[numCourses];
boolean[] visiting = new boolean[numCourses];
for (int i = 0; i < numCourses; i++) {
if (!canFinish(graph, visited, visiting, i)) {
return false;
}
}
return true;
}
private boolean canFinish(Map<Integer, Set<Integer>> graph, boolean[] visited, boolean[] visiting, int u) {
if (visited[u]) return true;
if (visiting[u]) return false;
visiting[u] = true;
for (int v: graph.get(u)) {
if (!canFinish(graph, visited, visiting, v)) {
return false;
}
}
visiting[u] = false;
visited[u] = true;
return true;
}
private Map<Integer, Set<Integer>> buildGraph(int n, int[][] prerequisites) {
Map<Integer, Set<Integer>> graph = new HashMap<>();
for (int i = 0; i < n; i++) graph.put(i, new HashSet<>());
for (int[] prereq: prerequisites) {
graph.get(prereq[1]).add(prereq[0]);
}
return graph;
}
}
| [
"hailin@hais-mbp.attlocal.net"
] | hailin@hais-mbp.attlocal.net |
0009d0877c85853c4652c34ce26a93521b81c9f1 | 00d19d5c898a3decd14c3199b8cd08aa1515fb53 | /HomeWork1/Task_4.java | 000828c227f17e8a07ecf3205befc9ac4cd91509 | [] | no_license | EvgeniyRozhenko/IT_Academy_HomeWork | 7e88b47073c6e537bd7d9ee165770d17be999e1b | d7b405347c85a2ea61136ca8378f79a87a6d70e3 | refs/heads/main | 2023-04-01T22:54:26.350041 | 2021-04-15T17:31:44 | 2021-04-15T17:31:44 | 331,692,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,985 | java | package HomeWork1;
/* 4.* Создать СТАТИЧЕСКИЙ метод sleepIn рядом с методом main. (Взято с https://codingbat.com/prob/p187868).
4.1 Данный метод будет принимает два параметра
4.2 Будет отвечать на вопрос спать ли дальше (возвращать true либо false).
4.3 Первый параметр boolean weekday обозначает рабочий день
4.4 Второй параметр boolean vacation обозначает отпуск.
4.5 Если у нас отпуск или не рабочий день то мы можем спать дальше
4.6 На основании ответа от метода sleepIn вывести сообщение можем спать дальше или пора идти на работу
*/
public class Task_4 {
public static boolean sleepIn(boolean weekday, boolean vacation){
boolean w = weekday;
boolean v = vacation;
if (w == false && v == true){ // если у нас не рабочий день и отпуск, то = можем спать
return true;
}else if (w == false && v == false){ // если у нас не рабочий день и не отпуск, то у нас выходной = можем спать
return true;
}else if (w == true && v == true){ // если у нас рабочий день, но у нас отпуск = можем спать
return true;
}else { // у нас и рабочий день и нет отпуска = не спим
return false;
}
}
public static void main(String[] args) {
boolean sleepOrWork = sleepIn(true,false);
if (sleepOrWork == true){
System.out.println("можем спать дальше");
}else {
System.out.println("пора идти на работу");
}
}
}
| [
"66553025+EvgeniyRozhenko@users.noreply.github.com"
] | 66553025+EvgeniyRozhenko@users.noreply.github.com |
d758172d9742d4430c01f1143e4debdcb3609806 | e6a180b86a3663c1ee493276764c510669c6254f | /cms-web/src/main/java/com/zxtop/cms/util/ControllerExceptionHandler.java | 68e71d58c67a2ee7ef4a5970176b1a54d2a7c15c | [] | no_license | guiyuhao111/zxtop-cms | ec69647c1dc80f8f5558595416bcf59ff268dcbd | 0ada2c3dc814d0d2d8de7cafcc9acbcb48568278 | refs/heads/master | 2020-03-28T19:42:08.259856 | 2018-09-29T09:43:26 | 2018-09-29T09:43:29 | 149,001,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 949 | java | package com.zxtop.cms.util;
import com.zxtop.cms.commons.JsonResult;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ControllerAdvice
public class ControllerExceptionHandler {
private static Logger logger = LogManager.getLogger(ControllerExceptionHandler.class);
@ExceptionHandler(Exception.class)
@ResponseBody
public JsonResult handleException(Exception e) {
logger.error(e.getMessage());
e.printStackTrace();
return new JsonResult(e);
}
@ExceptionHandler(RuntimeException.class)
@ResponseBody
public JsonResult handleException(RuntimeException e) {
logger.error(e.getMessage());
e.printStackTrace();
return new JsonResult(e);
}
} | [
"1060455912@qq.com"
] | 1060455912@qq.com |
5eca87c512e5a78689b67c43c9af115599b8061a | 245570a7b8a5a638224e2a9e10f68ce12b57e6a6 | /final submission/RegexStopperRemoval.java | 4427e31e64bc0caa856cf3d8738a491bb2b3777c | [] | no_license | Avishek2020/Linking_Project | d5d1d1877ef28ada24a8808eb515f0c37f427e42 | 565b4f2c70eba916c741d014a9e25707c8d48e12 | refs/heads/master | 2020-03-20T20:37:56.516256 | 2019-01-27T22:29:59 | 2019-01-27T22:29:59 | 137,697,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,140 | java | package org.upb.music.artist.similarity.measures;
import java.util.ArrayList;
import java.util.List;
public class RegexStopperRemoval {
public String stopperremoval(String text)
{
String v_text ;
String v_processText=null;
v_text = text.toLowerCase();
String stopWords[]= {"are","you","how","it",":","is","a","by","e","the","but","to"};
String[] splitString = (v_text.split("\\s+"));
System.out.println(splitString.length);//
for (String string : splitString)
{
System.out.println("string 1"+string);
for(int i =0;i<stopWords.length;i++)
{
System.out.println("stopWords[i] -"+stopWords[i]);
if(!string.equals(stopWords[i]))
{
string = string.replaceAll(stopWords[i], "");
//string = string.replaceAll("\\d", "");
v_processText =string;
System.out.println("inner loopstring --"+string);
}
}
System.out.println("v_processText "+string);
}
return v_processText;
}
public static void main(String[] args) {
RegexStopperRemoval rr = new RegexStopperRemoval();
System.out.println(rr.stopperremoval("2010 hello how are you."));
}
}
| [
"avishek2020@gmail.com"
] | avishek2020@gmail.com |
0772d2229e1ccae13309ebd27ee770e8c97af961 | 62df075dafd9e6f33af82dca2e4996d46eac6106 | /src/com/eclipse/lunar/PagedViewCellLayout.java | 382677b004659af35d63545cf1a9e0a21af7d05d | [
"Apache-2.0"
] | permissive | nitroglycerine33/packages_apps_Lunar | 96b0971eb6fc626840c177e2d3cc9a8766c0feb9 | 4f67df099d24bbe14f80e81e6b6dd2b76f5d6987 | HEAD | 2016-09-05T22:12:21.923193 | 2012-11-27T18:03:03 | 2012-11-27T18:03:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,604 | java | /*
* Copyright (C) 2010 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 com.eclipse.lunar;
import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
import com.eclipse.lunar.R;
/**
* An abstraction of the original CellLayout which supports laying out items
* which span multiple cells into a grid-like layout. Also supports dimming
* to give a preview of its contents.
*/
public class PagedViewCellLayout extends ViewGroup implements Page {
static final String TAG = "PagedViewCellLayout";
private int mCellCountX;
private int mCellCountY;
private int mOriginalCellWidth;
private int mOriginalCellHeight;
private int mCellWidth;
private int mCellHeight;
private int mOriginalWidthGap;
private int mOriginalHeightGap;
private int mWidthGap;
private int mHeightGap;
private int mMaxGap;
protected PagedViewCellLayoutChildren mChildren;
public PagedViewCellLayout(Context context) {
this(context, null);
}
public PagedViewCellLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public PagedViewCellLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setAlwaysDrawnWithCacheEnabled(false);
// setup default cell parameters
Resources resources = context.getResources();
mOriginalCellWidth = mCellWidth =
resources.getDimensionPixelSize(R.dimen.apps_customize_cell_width);
mOriginalCellHeight = mCellHeight =
resources.getDimensionPixelSize(R.dimen.apps_customize_cell_height);
mCellCountX = LauncherModel.getCellCountX();
mCellCountY = LauncherModel.getCellCountY();
mOriginalWidthGap = mOriginalHeightGap = mWidthGap = mHeightGap = -1;
mMaxGap = resources.getDimensionPixelSize(R.dimen.apps_customize_max_gap);
mChildren = new PagedViewCellLayoutChildren(context);
mChildren.setCellDimensions(mCellWidth, mCellHeight);
mChildren.setGap(mWidthGap, mHeightGap);
addView(mChildren);
}
public int getCellWidth() {
return mCellWidth;
}
public int getCellHeight() {
return mCellHeight;
}
void destroyHardwareLayers() {
// called when a page is no longer visible (triggered by loadAssociatedPages ->
// removeAllViewsOnPage)
setLayerType(LAYER_TYPE_NONE, null);
}
void createHardwareLayers() {
// called when a page is visible (triggered by loadAssociatedPages -> syncPageItems)
setLayerType(LAYER_TYPE_HARDWARE, null);
}
@Override
public void cancelLongPress() {
super.cancelLongPress();
// Cancel long press for all children
final int count = getChildCount();
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
child.cancelLongPress();
}
}
public boolean addViewToCellLayout(View child, int index, int childId,
PagedViewCellLayout.LayoutParams params) {
final PagedViewCellLayout.LayoutParams lp = params;
// Generate an id for each view, this assumes we have at most 256x256 cells
// per workspace screen
if (lp.cellX >= 0 && lp.cellX <= (mCellCountX - 1) &&
lp.cellY >= 0 && (lp.cellY <= mCellCountY - 1)) {
// If the horizontal or vertical span is set to -1, it is taken to
// mean that it spans the extent of the CellLayout
if (lp.cellHSpan < 0) lp.cellHSpan = mCellCountX;
if (lp.cellVSpan < 0) lp.cellVSpan = mCellCountY;
child.setId(childId);
mChildren.addView(child, index, lp);
return true;
}
return false;
}
@Override
public void removeAllViewsOnPage() {
mChildren.removeAllViews();
destroyHardwareLayers();
}
@Override
public void removeViewOnPageAt(int index) {
mChildren.removeViewAt(index);
}
/**
* Clears all the key listeners for the individual icons.
*/
public void resetChildrenOnKeyListeners() {
int childCount = mChildren.getChildCount();
for (int j = 0; j < childCount; ++j) {
mChildren.getChildAt(j).setOnKeyListener(null);
}
}
@Override
public int getPageChildCount() {
return mChildren.getChildCount();
}
public PagedViewCellLayoutChildren getChildrenLayout() {
return mChildren;
}
@Override
public View getChildOnPageAt(int i) {
return mChildren.getChildAt(i);
}
@Override
public int indexOfChildOnPage(View v) {
return mChildren.indexOfChild(v);
}
public int getCellCountX() {
return mCellCountX;
}
public int getCellCountY() {
return mCellCountY;
}
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSpecSize = MeasureSpec.getSize(widthMeasureSpec);
int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSpecSize = MeasureSpec.getSize(heightMeasureSpec);
if (widthSpecMode == MeasureSpec.UNSPECIFIED || heightSpecMode == MeasureSpec.UNSPECIFIED) {
throw new RuntimeException("CellLayout cannot have UNSPECIFIED dimensions");
}
int numWidthGaps = mCellCountX - 1;
int numHeightGaps = mCellCountY - 1;
if (mOriginalWidthGap < 0 || mOriginalHeightGap < 0) {
int hSpace = widthSpecSize - getPaddingLeft() - getPaddingRight();
int vSpace = heightSpecSize - getPaddingTop() - getPaddingBottom();
int hFreeSpace = hSpace - (mCellCountX * mOriginalCellWidth);
int vFreeSpace = vSpace - (mCellCountY * mOriginalCellHeight);
mWidthGap = Math.min(mMaxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0);
mHeightGap = Math.min(mMaxGap,numHeightGaps > 0 ? (vFreeSpace / numHeightGaps) : 0);
mChildren.setGap(mWidthGap, mHeightGap);
} else {
mWidthGap = mOriginalWidthGap;
mHeightGap = mOriginalHeightGap;
}
// Initial values correspond to widthSpecMode == MeasureSpec.EXACTLY
int newWidth = widthSpecSize;
int newHeight = heightSpecSize;
if (widthSpecMode == MeasureSpec.AT_MOST) {
newWidth = getPaddingLeft() + getPaddingRight() + (mCellCountX * mCellWidth) +
((mCellCountX - 1) * mWidthGap);
newHeight = getPaddingTop() + getPaddingBottom() + (mCellCountY * mCellHeight) +
((mCellCountY - 1) * mHeightGap);
setMeasuredDimension(newWidth, newHeight);
}
final int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
int childWidthMeasureSpec =
MeasureSpec.makeMeasureSpec(newWidth - getPaddingLeft() -
getPaddingRight(), MeasureSpec.EXACTLY);
int childheightMeasureSpec =
MeasureSpec.makeMeasureSpec(newHeight - getPaddingTop() -
getPaddingBottom(), MeasureSpec.EXACTLY);
child.measure(childWidthMeasureSpec, childheightMeasureSpec);
}
setMeasuredDimension(newWidth, newHeight);
}
int getContentWidth() {
return getWidthBeforeFirstLayout() + getPaddingLeft() + getPaddingRight();
}
int getContentHeight() {
if (mCellCountY > 0) {
return mCellCountY * mCellHeight + (mCellCountY - 1) * Math.max(0, mHeightGap);
}
return 0;
}
int getWidthBeforeFirstLayout() {
if (mCellCountX > 0) {
return mCellCountX * mCellWidth + (mCellCountX - 1) * Math.max(0, mWidthGap);
}
return 0;
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
child.layout(getPaddingLeft(), getPaddingTop(),
r - l - getPaddingRight(), b - t - getPaddingBottom());
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
boolean result = super.onTouchEvent(event);
int count = getPageChildCount();
if (count > 0) {
// We only intercept the touch if we are tapping in empty space after the final row
View child = getChildOnPageAt(count - 1);
int bottom = child.getBottom();
int numRows = (int) Math.ceil((float) getPageChildCount() / getCellCountX());
if (numRows < getCellCountY()) {
// Add a little bit of buffer if there is room for another row
bottom += mCellHeight / 2;
}
result = result || (event.getY() < bottom);
}
return result;
}
public void enableCenteredContent(boolean enabled) {
mChildren.enableCenteredContent(enabled);
}
@Override
protected void setChildrenDrawingCacheEnabled(boolean enabled) {
mChildren.setChildrenDrawingCacheEnabled(enabled);
}
public void setCellCount(int xCount, int yCount) {
mCellCountX = xCount;
mCellCountY = yCount;
requestLayout();
}
public void setGap(int widthGap, int heightGap) {
mOriginalWidthGap = mWidthGap = widthGap;
mOriginalHeightGap = mHeightGap = heightGap;
mChildren.setGap(widthGap, heightGap);
}
public int[] getCellCountForDimensions(int width, int height) {
// Always assume we're working with the smallest span to make sure we
// reserve enough space in both orientations
int smallerSize = Math.min(mCellWidth, mCellHeight);
// Always round up to next largest cell
int spanX = (width + smallerSize) / smallerSize;
int spanY = (height + smallerSize) / smallerSize;
return new int[] { spanX, spanY };
}
/**
* Start dragging the specified child
*
* @param child The child that is being dragged
*/
void onDragChild(View child) {
PagedViewCellLayout.LayoutParams lp = (PagedViewCellLayout.LayoutParams) child.getLayoutParams();
lp.isDragging = true;
}
/**
* Estimates the number of cells that the specified width would take up.
*/
public int estimateCellHSpan(int width) {
// We don't show the next/previous pages any more, so we use the full width, minus the
// padding
int availWidth = width - (getPaddingLeft() + getPaddingRight());
// We know that we have to fit N cells with N-1 width gaps, so we just juggle to solve for N
int n = Math.max(1, (availWidth + mWidthGap) / (mCellWidth + mWidthGap));
// We don't do anything fancy to determine if we squeeze another row in.
return n;
}
/**
* Estimates the number of cells that the specified height would take up.
*/
public int estimateCellVSpan(int height) {
// The space for a page is the height - top padding (current page) - bottom padding (current
// page)
int availHeight = height - (getPaddingTop() + getPaddingBottom());
// We know that we have to fit N cells with N-1 height gaps, so we juggle to solve for N
int n = Math.max(1, (availHeight + mHeightGap) / (mCellHeight + mHeightGap));
// We don't do anything fancy to determine if we squeeze another row in.
return n;
}
/** Returns an estimated center position of the cell at the specified index */
public int[] estimateCellPosition(int x, int y) {
return new int[] {
getPaddingLeft() + (x * mCellWidth) + (x * mWidthGap) + (mCellWidth / 2),
getPaddingTop() + (y * mCellHeight) + (y * mHeightGap) + (mCellHeight / 2)
};
}
public void calculateCellCount(int width, int height, int maxCellCountX, int maxCellCountY) {
mCellCountX = Math.min(maxCellCountX, estimateCellHSpan(width));
mCellCountY = Math.min(maxCellCountY, estimateCellVSpan(height));
requestLayout();
}
/**
* Estimates the width that the number of hSpan cells will take up.
*/
public int estimateCellWidth(int hSpan) {
// TODO: we need to take widthGap into effect
return hSpan * mCellWidth;
}
/**
* Estimates the height that the number of vSpan cells will take up.
*/
public int estimateCellHeight(int vSpan) {
// TODO: we need to take heightGap into effect
return vSpan * mCellHeight;
}
@Override
public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs) {
return new PagedViewCellLayout.LayoutParams(getContext(), attrs);
}
@Override
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
return p instanceof PagedViewCellLayout.LayoutParams;
}
@Override
protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
return new PagedViewCellLayout.LayoutParams(p);
}
public static class LayoutParams extends ViewGroup.MarginLayoutParams {
/**
* Horizontal location of the item in the grid.
*/
@ViewDebug.ExportedProperty
public int cellX;
/**
* Vertical location of the item in the grid.
*/
@ViewDebug.ExportedProperty
public int cellY;
/**
* Number of cells spanned horizontally by the item.
*/
@ViewDebug.ExportedProperty
public int cellHSpan;
/**
* Number of cells spanned vertically by the item.
*/
@ViewDebug.ExportedProperty
public int cellVSpan;
/**
* Is this item currently being dragged
*/
public boolean isDragging;
// a data object that you can bind to this layout params
private Object mTag;
// X coordinate of the view in the layout.
@ViewDebug.ExportedProperty
int x;
// Y coordinate of the view in the layout.
@ViewDebug.ExportedProperty
int y;
public LayoutParams() {
super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
cellHSpan = 1;
cellVSpan = 1;
}
public LayoutParams(Context c, AttributeSet attrs) {
super(c, attrs);
cellHSpan = 1;
cellVSpan = 1;
}
public LayoutParams(ViewGroup.LayoutParams source) {
super(source);
cellHSpan = 1;
cellVSpan = 1;
}
public LayoutParams(LayoutParams source) {
super(source);
this.cellX = source.cellX;
this.cellY = source.cellY;
this.cellHSpan = source.cellHSpan;
this.cellVSpan = source.cellVSpan;
}
public LayoutParams(int cellX, int cellY, int cellHSpan, int cellVSpan) {
super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
this.cellX = cellX;
this.cellY = cellY;
this.cellHSpan = cellHSpan;
this.cellVSpan = cellVSpan;
}
public void setup(int cellWidth, int cellHeight, int widthGap, int heightGap,
int hStartPadding, int vStartPadding) {
final int myCellHSpan = cellHSpan;
final int myCellVSpan = cellVSpan;
final int myCellX = cellX;
final int myCellY = cellY;
width = myCellHSpan * cellWidth + ((myCellHSpan - 1) * widthGap) -
leftMargin - rightMargin;
height = myCellVSpan * cellHeight + ((myCellVSpan - 1) * heightGap) -
topMargin - bottomMargin;
if (LauncherApplication.isScreenLarge()) {
x = hStartPadding + myCellX * (cellWidth + widthGap) + leftMargin;
y = vStartPadding + myCellY * (cellHeight + heightGap) + topMargin;
} else {
x = myCellX * (cellWidth + widthGap) + leftMargin;
y = myCellY * (cellHeight + heightGap) + topMargin;
}
}
public Object getTag() {
return mTag;
}
public void setTag(Object tag) {
mTag = tag;
}
public String toString() {
return "(" + this.cellX + ", " + this.cellY + ", " +
this.cellHSpan + ", " + this.cellVSpan + ")";
}
}
}
interface Page {
public int getPageChildCount();
public View getChildOnPageAt(int i);
public void removeAllViewsOnPage();
public void removeViewOnPageAt(int i);
public int indexOfChildOnPage(View v);
}
| [
"nitroglycerine33@gmail.com"
] | nitroglycerine33@gmail.com |
05b1d05f2f74febadce982b70555870e0309482a | 6ecbde70bb79618c5687d5cbd048618464f8380c | /src/main/java/jettyapp/mvc/service/UserService.java | 609cb0c7283888a84759c486d71b8aed311d1588 | [] | no_license | vltsu/spring_crud | cb844a0e43a815d7add6f2ba358b59f9fb41c169 | 83c80958577c5f61e6baeab6032c1c31199879a9 | refs/heads/master | 2016-08-07T02:33:01.601189 | 2013-07-22T20:02:39 | 2013-07-22T20:02:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,248 | java | package jettyapp.mvc.service;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import jettyapp.mvc.model.User;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
public class UserService {
private SimpleJdbcTemplate jdbcTemplate;
public void setDataSource(SimpleJdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
private static final String SQL_SELECT_ALL_USERS = "select name, email, image from users";
public List<User> getAllUsers() {
return jdbcTemplate.query(
SQL_SELECT_ALL_USERS,
new UserMapper()
);
}
private static final String SQL_SELECT_USER_BY_EMAIL = "select name, email, image from users where email = ?";
public User getUserByEmail(String email) {
return jdbcTemplate.queryForObject(
SQL_SELECT_USER_BY_EMAIL,
new UserMapper(),
email
);
}
private static final String SQL_CREATE_USER = "insert into users (name, email, image) values (?,?,?)";
public void createUser(User user) {
jdbcTemplate.update(SQL_CREATE_USER,
new Object[] { user.getName(), user.getEmail(), user.getImage() });
}
private static final String SQL_UPDATE_USER = "update users set name = ?, email = ?, image =? where email = ?";
public void updateUser(User user, String email) {
jdbcTemplate.update(SQL_UPDATE_USER,
new Object[] { user.getName(), user.getEmail(), user.getImage(), email });
}
private static final String SQL_DELETE_USER = "delete from users where email = ?";
public void deleteUser(String email) {
jdbcTemplate.update(SQL_DELETE_USER,
new Object[] { email });
}
private static final class UserMapper implements ParameterizedRowMapper<User> {
public User mapRow(ResultSet rs, int rowNum) throws SQLException {
User user = new User();
user.setName(rs.getString("Name"));
user.setEmail(rs.getString("Email"));
user.setImage(rs.getString("Image"));
return user;
}
}
}
| [
"tsukanov.vl@gmail.com"
] | tsukanov.vl@gmail.com |
bd637199961aef3be3c891bf5046b8a3419b1de9 | fc98388126038d64f11cd70d28311bbc4e3ef950 | /src/br/edu/ifcvideira/Classes/Fornecedor.java | 9e5fe5549e31bc23154708422e2bc352cd0952f1 | [] | no_license | MarlonVCendron/Loja-de-Moda_Projeto-Integrador | e3e60299a74f2c47823f77a1230896268c43ebde | 0e37c883de2031aa170c994969148c277557d292 | refs/heads/master | 2020-04-01T08:20:12.756736 | 2018-11-25T23:47:55 | 2018-11-25T23:47:55 | 153,026,588 | 0 | 0 | null | 2018-10-14T23:42:12 | 2018-10-14T22:58:15 | Java | UTF-8 | Java | false | false | 1,253 | java | package br.edu.ifcvideira.Classes;
public class Fornecedor {
private int id;
private String nome;
private String cnpj;
private String email;
private String telefone;
private String rua;
private String bairro;
private String cidade;
private String estado;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCnpj() {
return cnpj;
}
public void setCnpj(String cnpj) {
this.cnpj = cnpj;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getTelefone() {
return telefone;
}
public void setTelefone(String telefone) {
this.telefone = telefone;
}
public String getRua() {
return rua;
}
public void setRua(String rua) {
this.rua = rua;
}
public String getBairro() {
return bairro;
}
public void setBairro(String bairro) {
this.bairro = bairro;
}
public String getCidade() {
return cidade;
}
public void setCidade(String cidade) {
this.cidade = cidade;
}
public String getEstado() {
return estado;
}
public void setEstado(String estado) {
this.estado = estado;
}
} | [
"luanzuffo.lz@gmail.com"
] | luanzuffo.lz@gmail.com |
c4502b964da15ce9cb3f51550724eb86bee00873 | 3e618f316b0ac9a370c5a5daba8d2aaa7c4e68d1 | /pro-security-core/src/main/java/cn/zyblogs/security/core/validate/code/image/ImageCode.java | cae46d3de254e8f91a6ac296d904627f5cd26ae6 | [] | no_license | zhangyibo1012/pro-security | fbb5b1c17b9f9a1e3de908217b9efd85c281b211 | f8b67c10f2d4f527807fd0ae9378202aed7d3a01 | refs/heads/master | 2020-03-29T09:58:45.700943 | 2018-09-24T10:12:40 | 2018-09-24T10:12:45 | 149,783,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 760 | java | package cn.zyblogs.security.core.validate.code.image;
import cn.zyblogs.security.core.validate.code.ValidateCode;
import lombok.Getter;
import lombok.Setter;
import java.awt.image.BufferedImage;
import java.time.LocalDateTime;
/**
* @Title: ImageCode.java
* @Package cn.zyblogs.security.core.validate.code
* @Description: TODO
* @Author ZhangYB
* @Version V1.0
*/
@Getter
@Setter
public class ImageCode extends ValidateCode {
private BufferedImage image;
public ImageCode(BufferedImage image, String code, int expireIn) {
super(code, expireIn);
this.image = image;
}
public ImageCode(BufferedImage image, String code, LocalDateTime expireTime) {
super(code, expireTime);
this.image = image;
}
}
| [
"35024391+zhangyibo1012@users.noreply.github.com"
] | 35024391+zhangyibo1012@users.noreply.github.com |
298f6f13728ca959ed5bdc9bda1e6106e842248b | 6fa8e84ecc47018bf6885c542f482aaf26fea0fe | /src/main/java/com/ilop/sthome/utils/HistoryDataUtil.java | 4d8049bea2db1ddf61f26736941ef4f0d4a02377 | [] | no_license | sengeiou/familylink | 0e6b71818db6d072300a884e9283858037427aeb | e3948b3be4be95c5bd8e5f330ec4ad2c0fc8af77 | refs/heads/master | 2022-04-04T04:38:36.077001 | 2020-02-14T11:38:10 | 2020-02-14T11:38:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 48,560 | java | package com.ilop.sthome.utils;
import android.content.Context;
import com.ilop.sthome.data.enums.SmartProduct;
import com.siterwell.familywellplus.R;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by ST-020111 on 2017/3/24.
*/
public class HistoryDataUtil {
/**
* 得到现在时间
*
* @return 字符串 yyyyMMdd HHmmss
*/
public static String getStringToday() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentTime);
SimpleDateFormat formatter1 = new SimpleDateFormat("HH:mm:ss.SSS+Z");
String dateString1 = formatter1.format(currentTime);
return dateString+"T"+dateString1;
}
/**
* 得到现在小时
*/
public static String getHour() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
String hour;
hour = dateString.substring(11, 13);
return hour;
}
public static String getAlert(Context context,String equipmenttype, String eqstatus){
try {
String alertstatus = eqstatus.substring(4,6);
String battery = eqstatus.substring(2,4);
if(SmartProduct.EE_DEV_DOOR1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_DOOR2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_DOOR3.equals(SmartProduct.getType(equipmenttype))){
if("55".equals(alertstatus)){
return context.getResources().getStringArray(R.array.door_actions)[0];
}else if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getStringArray(R.array.door_actions)[1];
}
}else if("66".equals(alertstatus)){
return context.getResources().getStringArray(R.array.door_actions)[2];
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_SOS1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SOS2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SOS3.equals(SmartProduct.getType(equipmenttype))){
if("55".equals(alertstatus)){
return context.getResources().getStringArray(R.array.sos_signs)[0];
}else if("66".equals(alertstatus)){
return context.getResources().getStringArray(R.array.sos_signs)[1];
}else if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_PIR1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_PIR2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_PIR3.equals(SmartProduct.getType(equipmenttype))){
if("55".equals(alertstatus)){
return context.getResources().getStringArray(R.array.pir_signs)[0];
}else if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getStringArray(R.array.pir_signs)[1];
}
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_SMALARM1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM3.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM4.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM5.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM6.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM7.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM8.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM9.equals(SmartProduct.getType(equipmenttype))){
if("BB".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert7);
}else if("55".equals(alertstatus)){
return context.getResources().getString(R.string.sthalert);
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_COALARM1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM3.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM4.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM5.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM6.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM7.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM8.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM9.equals(SmartProduct.getType(equipmenttype))){
if("BB".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert7);
}else if("55".equals(alertstatus)){
return context.getResources().getString(R.string.sthalert);
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_WTALARM1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM3.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM4.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM5.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM6.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM7.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM8.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM9.equals(SmartProduct.getType(equipmenttype))){
if("BB".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert7);
}else if("55".equals(alertstatus)){
return context.getResources().getString(R.string.sthalert);
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_THCHECK1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THCHECK2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THCHECK3.equals(SmartProduct.getType(equipmenttype))){
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else{
return context.getResources().getString(R.string.offline);
}
}else if(SmartProduct.EE_DEV_SXSMALARM1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM3.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM4.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM5.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM6.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM7.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM8.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM9.equals(SmartProduct.getType(equipmenttype))){
if("17".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert7);
}else if("19".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert9);
}else if("12".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert2);
}else if("15".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert5);
}else if("1B".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert11);
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_GASALARM1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM3.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM4.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM5.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM6.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM7.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM8.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM9.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM10.equals(SmartProduct.getType(equipmenttype))){
if("BB".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert7);
}else if("55".equals(alertstatus)){
return context.getResources().getString(R.string.sthalert);
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_THERMALARM1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM3.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM4.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM5.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM6.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM7.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM8.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM9.equals(SmartProduct.getType(equipmenttype))){
if("BB".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert7);
}else if("55".equals(alertstatus)){
return context.getResources().getString(R.string.sthalert);
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_MODE_BUTTON.equals(SmartProduct.getType(equipmenttype))){
if("55".equals(alertstatus)){
return context.getResources().getStringArray(R.array.sos_signs)[0];
}else if("66".equals(alertstatus)){
return context.getResources().getStringArray(R.array.sos_signs)[1];
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_LOCK.equals(SmartProduct.getType(equipmenttype))){
if("50".equals(alertstatus)){
return context.getResources().getStringArray(R.array.lock_input)[0];
}else if("51".equals(alertstatus)){
return context.getResources().getStringArray(R.array.lock_input)[1];
}else if("52".equals(alertstatus)){
return context.getResources().getStringArray(R.array.lock_input)[2];
}else if("53".equals(alertstatus)){
return context.getResources().getStringArray(R.array.lock_input)[3];
}else if("10".equals(alertstatus)){
return context.getResources().getStringArray(R.array.lock_input)[4];
}else if("20".equals(alertstatus)){
return context.getResources().getStringArray(R.array.lock_input)[5];
}else if("30".equals(alertstatus)){
return context.getResources().getStringArray(R.array.lock_input)[6];
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_BUTTON1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_BUTTON2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_BUTTON3.equals(SmartProduct.getType(equipmenttype))){
if("01".equals(alertstatus)){
return context.getResources().getString(R.string.trigger);
}
else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_SOCKET1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SOCKET2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SOCKET3.equals(SmartProduct.getType(equipmenttype))){
String alertstatus1 = eqstatus.substring(6,8);
if("01".equals(alertstatus1)){
return context.getResources().getString(R.string.open);
}else if("00".equals(alertstatus1)){
return context.getResources().getString(R.string.close);
}else {
return context.getResources().getString(R.string.offline);
}
}else if(SmartProduct.EE_TWO_CHANNEL_SOCKET1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_TWO_CHANNEL_SOCKET2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_TWO_CHANNEL_SOCKET3.equals(SmartProduct.getType(equipmenttype))){
if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
return context.getResources().getString(R.string.sthalert);
}
}else if(SmartProduct.EE_TEMP_CONTROL1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_TEMP_CONTROL2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_TEMP_CONTROL3.equals(SmartProduct.getType(equipmenttype))){
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15)
return context.getResources().getString(R.string.low_battery);
else
return context.getResources().getString(R.string.normal);
}else{
return context.getResources().getString(R.string.offline);
}
}
else{
return context.getResources().getString(R.string.offline);
}
}catch (Exception e){
return "";
}
}
public static String getsnapshot(Context context,String equipmenttype, String eqstatus){
try {
String alertstatus = eqstatus.substring(4,6);
String battery = eqstatus.substring(2,4);
if(SmartProduct.EE_DEV_DOOR1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_DOOR2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_DOOR3.equals(SmartProduct.getType(equipmenttype))){
if("55".equals(alertstatus)){
return context.getResources().getStringArray(R.array.door_actions)[0];
}else if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getStringArray(R.array.door_actions)[1];
}
}else if("66".equals(alertstatus)){
return context.getResources().getStringArray(R.array.door_actions)[2];
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_SOS1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SOS2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SOS3.equals(SmartProduct.getType(equipmenttype))){
if("55".equals(alertstatus)){
return context.getResources().getStringArray(R.array.sos_signs)[0];
}else if("66".equals(alertstatus)){
return context.getResources().getStringArray(R.array.sos_signs)[1];
}else if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_PIR1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_PIR2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_PIR3.equals(SmartProduct.getType(equipmenttype))){
if("55".equals(alertstatus)){
return context.getResources().getStringArray(R.array.pir_signs)[0];
}else if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getStringArray(R.array.pir_signs)[1];
}
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_SMALARM1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM3.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM4.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM5.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM6.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM7.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM8.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SMALARM9.equals(SmartProduct.getType(equipmenttype))){
if("BB".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert7);
}else if("55".equals(alertstatus)){
return context.getResources().getString(R.string.sthalert);
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_COALARM1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM3.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM4.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM5.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM6.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM7.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM8.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_COALARM9.equals(SmartProduct.getType(equipmenttype))){
if("BB".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert7);
}else if("55".equals(alertstatus)){
return context.getResources().getString(R.string.sthalert);
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_WTALARM1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM3.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM4.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM5.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM6.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM7.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM8.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_WTALARM9.equals(SmartProduct.getType(equipmenttype))){
if("BB".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert7);
}else if("55".equals(alertstatus)){
return context.getResources().getString(R.string.sthalert);
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_THCHECK1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THCHECK2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THCHECK3.equals(SmartProduct.getType(equipmenttype))){
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else{
return context.getResources().getString(R.string.offline);
}
}else if(SmartProduct.EE_DEV_SXSMALARM1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM3.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM4.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM5.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM6.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM7.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM8.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SXSMALARM9.equals(SmartProduct.getType(equipmenttype))){
if("17".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert7);
}else if("19".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert9);
}else if("12".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert2);
}else if("15".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert5);
}else if("1B".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert11);
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_GASALARM1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM3.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM4.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM5.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM6.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM7.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM8.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM9.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_GASALARM10.equals(SmartProduct.getType(equipmenttype))){
if("BB".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert7);
}else if("55".equals(alertstatus)){
return context.getResources().getString(R.string.sthalert);
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_THERMALARM1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM3.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM4.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM5.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM6.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM7.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM8.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_THERMALARM9.equals(SmartProduct.getType(equipmenttype))){
if("BB".equals(alertstatus)){
return context.getResources().getString(R.string.cxalert7);
}else if("55".equals(alertstatus)){
return context.getResources().getString(R.string.sthalert);
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_MODE_BUTTON.equals(SmartProduct.getType(equipmenttype))){
if("55".equals(alertstatus)){
return context.getResources().getStringArray(R.array.sos_signs)[0];
}else if("66".equals(alertstatus)){
return context.getResources().getStringArray(R.array.sos_signs)[1];
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
int de1 = Integer.parseInt(alertstatus,16);
if(de1<=7){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else {
return context.getResources().getString(R.string.offline);
}
}
}
}else if(SmartProduct.EE_DEV_LOCK.equals(SmartProduct.getType(equipmenttype))){
if("50".equals(alertstatus)){
return context.getResources().getStringArray(R.array.lock_input)[0];
}else if("51".equals(alertstatus)){
return context.getResources().getStringArray(R.array.lock_input)[1];
}else if("52".equals(alertstatus)){
return context.getResources().getStringArray(R.array.lock_input)[2];
}else if("53".equals(alertstatus)){
return context.getResources().getStringArray(R.array.lock_input)[3];
}else if("10".equals(alertstatus)){
return context.getResources().getStringArray(R.array.lock_input)[4];
}else if("20".equals(alertstatus)){
return context.getResources().getStringArray(R.array.lock_input)[5];
}else if("30".equals(alertstatus)){
return context.getResources().getStringArray(R.array.lock_input)[6];
}else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_BUTTON1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_BUTTON2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_BUTTON3.equals(SmartProduct.getType(equipmenttype))){
if("01".equals(alertstatus)){
return context.getResources().getString(R.string.normal);
}
else if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15){
return context.getResources().getString(R.string.low_battery);
}else {
return context.getResources().getString(R.string.normal);
}
}else{
return context.getResources().getString(R.string.offline);
}
}
}else if(SmartProduct.EE_DEV_SOCKET1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SOCKET2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_DEV_SOCKET3.equals(SmartProduct.getType(equipmenttype))){
String alertstatus1 = eqstatus.substring(6,8);
if("01".equals(alertstatus1)){
return context.getResources().getString(R.string.open);
}else if("00".equals(alertstatus1)){
return context.getResources().getString(R.string.close);
}else {
return context.getResources().getString(R.string.offline);
}
}else if(SmartProduct.EE_TWO_CHANNEL_SOCKET1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_TWO_CHANNEL_SOCKET2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_TWO_CHANNEL_SOCKET3.equals(SmartProduct.getType(equipmenttype))){
if("FF".equals(alertstatus)){
return context.getResources().getString(R.string.offline);
}else {
return context.getResources().getString(R.string.sthalert);
}
}else if(SmartProduct.EE_TEMP_CONTROL1.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_TEMP_CONTROL2.equals(SmartProduct.getType(equipmenttype))
||SmartProduct.EE_TEMP_CONTROL3.equals(SmartProduct.getType(equipmenttype))){
if("AA".equals(alertstatus)){
if(Integer.parseInt(battery,16)<=15)
return context.getResources().getString(R.string.low_battery);
else
return context.getResources().getString(R.string.normal);
}else{
return context.getResources().getString(R.string.offline);
}
}
else{
return context.getResources().getString(R.string.offline);
}
}catch (Exception e){
return "";
}
}
/**
* 网关的报警(与子设备无关,这些报警由网关判断)
* @param context
* @param eqstatus
* @return
*/
public static String getGatewayAlert(Context context,String eqstatus){
if("00000000".equals(eqstatus)){
return context.getResources().getString(R.string.electric_city_break_off);
}else if("00000001".equals(eqstatus)){
return context.getResources().getString(R.string.electric_city_normal);
}else if("00000002".equals(eqstatus)){
return context.getResources().getString(R.string.battery_normal);
}else if("00000003".equals(eqstatus)){
return context.getResources().getString(R.string.battery_low);
}else if("00000004".equals(eqstatus)){
return context.getResources().getString(R.string.ali_gateway_restart);
}else if("00000005".equals(eqstatus)){
return context.getResources().getString(R.string.ali_net_break);
}else if("00000006".equals(eqstatus)){
return context.getResources().getString(R.string.ali_net_ok);
}else if("00000007".equals(eqstatus)){
return context.getResources().getString(R.string.gateway_alert);
}else if("00000008".equals(eqstatus)){
return context.getResources().getString(R.string.ali_gateway_init);
}else if("00000009".equals(eqstatus)){
return context.getResources().getString(R.string.ali_gateway_config);
}else if("0000000A".equals(eqstatus)){
return context.getResources().getString(R.string.ali_gateway_stop_alert);
}else {
if(eqstatus.startsWith("0000010") && eqstatus.length()==8){
return "Scene";
}else {
return context.getResources().getString(R.string.unknown_error);
}
}
}
}
| [
"1805298170@qq.com"
] | 1805298170@qq.com |
c4a7a3747516d207d0951562f6fc51a84a49b694 | 81ca3968c019f39cb8d511015777cab0751b66e5 | /Personomics/app/src/main/java/com/demo/personomics/personomics/ExerciseAdapter.java | ed88aa7f913c819c8772e04df1507342e8f4e36b | [] | no_license | HenryDu25/Personomics | 19883c878ab53ef837f49fdb8710b500bc466c72 | fbe033418ba7676cc0c80e589adb046af76cfee5 | refs/heads/master | 2021-03-27T20:48:30.256832 | 2017-10-12T16:46:16 | 2017-10-12T16:46:16 | 73,139,654 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,883 | java | package com.demo.personomics.personomics;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
/**
* Created by umeshkhanna on 2016-11-20.
*/
public class ExerciseAdapter extends RecyclerView.Adapter<ExerciseAdapter.MyViewHolder> {
private Context mContext;
private List<Exercise> exerciseList;
public class MyViewHolder extends RecyclerView.ViewHolder {
public TextView name;
public ImageView icon;
public TextView description;
public MyViewHolder(View itemView) {
super(itemView);
this.name = (TextView) itemView.findViewById(R.id.name);
this.icon = (ImageView) itemView.findViewById(R.id.icon);
this.description = (TextView) itemView.findViewById(R.id.description);
}
}
public ExerciseAdapter(Context mContext, List<Exercise> exerciseList) {
this.mContext = mContext;
this.exerciseList = exerciseList;
}
@Override
public ExerciseAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.cardview_exercise, parent, false);
return new ExerciseAdapter.MyViewHolder(itemView);
}
@Override
public void onBindViewHolder(ExerciseAdapter.MyViewHolder holder, int position) {
Exercise exercise = exerciseList.get(position);
holder.name.setText(exercise.getName());
holder.icon.setImageResource(exercise.getIcon());
holder.description.setText(exercise.getDescription());
}
@Override
public int getItemCount() {
return exerciseList.size();
}
}
| [
"umeshkhanna@Umeshs-MacBook-Pro-2.local"
] | umeshkhanna@Umeshs-MacBook-Pro-2.local |
c0b5a52d35ed2ef4749c61ad0c25a93d05f3808f | e99c4bb0bbae86570368a2887e95eaf71960ae56 | /app/src/main/java/boyue/bbtuan/superroom/SuperClassActivity.java | 45b7afd6dc758e7ac58ed0ad6626d606e6c9367b | [
"Apache-2.0"
] | permissive | Liang-feng/bbtuan | 282a6dd524070d1ac9431f362637f03f3a594d38 | bc0571d9852c8430d1311dfa9262e3947aeb6e97 | refs/heads/master | 2021-01-10T16:55:54.060415 | 2016-03-19T12:18:11 | 2016-03-19T12:18:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,859 | java | package boyue.bbtuan.superroom;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.HashMap;
import boyue.bbtuan.R;
import boyue.bbtuan.tabmain.CircleFlowIndicator;
import boyue.bbtuan.tabmain.ImagePagerAdapter;
import boyue.bbtuan.tabmain.ViewFlow;
import boyue.bbtuan.view.RoundImageView;
import boyue.bbtuan.view.ScrollListView;
import boyue.bbtuan.xlist.XListView;
public class SuperClassActivity extends Activity implements View.OnClickListener,AdapterView.OnItemClickListener,XListView.IXListViewListener,ScrollListView.OnGetBottomListener {
private Button topBackButt;//返回键
private TextView topTitleTv;//界面主题
private ViewFlow mViewFlow;
private FrameLayout framelayout;
private CircleFlowIndicator mFlowIndicator;
private ArrayList<String> imageUrlList = new ArrayList<String>();
private ArrayList<String> linkUrlArray = new ArrayList<String>();
private ArrayList<String> titleList = new ArrayList<String>();
private ImageView superSearchIv;
private Handler mHandler;//刷新回调函数
private ArrayList<HashMap<String, Object>> lstTeachItem;
private ViewHolder holder = null;
private superRoomAdapter superRoomAdapter;
private XListView superClassHomeLv;
private ScrollListView supercalssScroll;
private LinearLayout superclassHomeLinLay;
private ImageView nearlyStuIv;//周围学霸
private ImageView findStuIv;//找学霸
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_superclass);
initView();
final DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
final int height = displayMetrics.heightPixels; //获取手机高度
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,height-100);
superclassHomeLinLay.setLayoutParams(lp);
lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,height-(int)(2*height/3));
framelayout.setLayoutParams(lp);
supercalssScroll.smoothScrollTo(0, 0);
supercalssScroll.setBottomListener(this);
superClassHomeLv.setPullLoadEnable(true);// 设置让它上拉,FALSE为不让上拉,便不加载更多数据
superClassHomeLv.setPullRefreshEnable(false);
superClassHomeLv.setXListViewListener(this);
lstTeachItem = new ArrayList<HashMap<String, Object>>();
superClassHomeLv.setOnItemClickListener(this);
superRoomAdapter= new superRoomAdapter(this);
mHandler = new Handler();
getData();
superClassHomeLv.setAdapter(superRoomAdapter);
}
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position,long arg3)
{
startActivity(new Intent(SuperClassActivity.this, SuperTeacherinfoActivity.class));
}
private void initView() {
topBackButt=(Button)this.findViewById(R.id.btn_supertop_back);
topBackButt.setOnClickListener(this);
topTitleTv=(TextView)this.findViewById(R.id.tv_school_name);
topTitleTv.setText("超级课堂");
nearlyStuIv=(ImageView)this.findViewById(R.id.iv_nearly_stu);
nearlyStuIv.setOnClickListener(this);
findStuIv=(ImageView)this.findViewById(R.id.iv_find_stu);
findStuIv.setOnClickListener(this);
framelayout=(FrameLayout)this.findViewById(R.id.framelayout);
superclassHomeLinLay= (LinearLayout)findViewById(R.id.linLay_superclass_home);
supercalssScroll=(ScrollListView)this.findViewById(R.id.scroll_supercalss);
superClassHomeLv=(XListView)this.findViewById(R.id.lv_superclass_home);
mViewFlow = (ViewFlow) this.findViewById(R.id.viewflow);
mFlowIndicator = (CircleFlowIndicator)this.findViewById(R.id.viewflowindic);
if (imageUrlList.size() == 0) initDate();
initBanner(imageUrlList);
superSearchIv=(ImageView)this.findViewById(R.id.iv_super_search);
superSearchIv.setOnClickListener(this);
}
private ArrayList<HashMap<String, Object>> getData() {
HashMap<String, Object> map;
for(int i=1;i<5;i++)
{
map= new HashMap<String, Object>();
map.put("superRoomteachImgIv", R.mipmap.ic_ceshi_head);
map.put("superRoomteachStarIv", R.mipmap.img_star_four);
map.put("superRoomteachSubTv", "高等数学A1");
map.put("superRoomteachNameTv", "陈志良");
map.put("superRoomteachCollegeTv", "电子工程与自动化学院");
map.put("superRoomteachPriceTv", "80~200");
map.put("superRoomteachPhoneTv", "13000000000");
lstTeachItem.add(map);
}
return lstTeachItem;
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.btn_supertop_back:
finish();
break;
case R.id.iv_super_search:
startActivity(new Intent(SuperClassActivity.this,SuperSearchActivity.class));
break;
case R.id.iv_nearly_stu:
startActivity(new Intent(SuperClassActivity.this,NearlyStuActivity.class));
break;
case R.id.iv_find_stu:
startActivity(new Intent(SuperClassActivity.this,FindStuActivity.class));
break;
default:
break;
}
}
private void showToast(String str){
Toast.makeText(SuperClassActivity.this, str, Toast.LENGTH_LONG).show();
}
private void initBanner(ArrayList<String> imageUrlList) {
mViewFlow.setAdapter(new ImagePagerAdapter(SuperClassActivity.this, imageUrlList,
linkUrlArray, titleList).setInfiniteLoop(true));
mViewFlow.setmSideBuffer(imageUrlList.size()); // 实际图片张数,
// 我的ImageAdapter实际图片张数为3
mViewFlow.setFlowIndicator(mFlowIndicator);
mViewFlow.setTimeSpan(4500);
mViewFlow.setSelection(imageUrlList.size() * 1000); // 设置初始位置
mViewFlow.startAutoFlowTimer(); // 启动自动播放
}
private void initDate() {
imageUrlList.add("http://i2.qhimg.com/dr/200__/t01fd9e7806947aec45.jpg");
imageUrlList.add("http://i9.qhimg.com/dr/200__/t0117980c71e890a2da.jpg");
imageUrlList.add("http://i2.qhimg.com/dr/200__/t01de2e90f7f972921f.jpg");
imageUrlList.add("http://pic4.nipic.com/20090922/2585201_101948877141_2.jpg");
linkUrlArray.add("");
linkUrlArray.add("");
linkUrlArray.add("");
linkUrlArray.add("");
titleList.add("");
titleList.add("");
titleList.add("");
titleList.add("");
}
//ViewHolder静态类
public static class ViewHolder {
//老师头像
public RoundImageView superRoomteachImgIv;
//老师评价星数
public ImageView superRoomteachStarIv;
//老师授课科目
public TextView superRoomteachSubTv;
//老师名字
public TextView superRoomteachNameTv;
//老师辅导学院
public TextView superRoomteachCollegeTv;
//老师授课一位学生单价
public TextView superRoomteachPriceTv;
//老师联系方式
public TextView superRoomteachPhoneTv;
}
public class superRoomAdapter extends BaseAdapter {
private LayoutInflater mInflater = null;
private superRoomAdapter(Context context)
{
//根据context上下文加载布局,即this
this.mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
// 在此适配器中所代表的数据集中的条目数
return lstTeachItem.size();
}
@Override
public Object getItem(int position) {
// 获取数据集中与指定索引对应的数据项
return position;
}
@Override
public long getItemId(int position) {
// 获取在列表中与指定索引对应的行id
return position;
}
//获取一个在数据集中指定索引的视图来显示数据
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
//如果缓存convertView为空,则需要创建View
if(convertView == null) {
holder = new ViewHolder();
//根据自定义的Item布局加载布局
convertView = mInflater.inflate(R.layout.item_teacher_room,null);
holder.superRoomteachImgIv = (RoundImageView)convertView.findViewById(R.id.thitem_img_teacher);
holder.superRoomteachStarIv = (ImageView)convertView.findViewById(R.id.thitemth_img_star);
holder.superRoomteachSubTv = (TextView)convertView.findViewById(R.id.thitem_tv_subject);
holder.superRoomteachNameTv = (TextView)convertView.findViewById(R.id.thitem_tv_name);
holder.superRoomteachCollegeTv = (TextView)convertView.findViewById(R.id.thitem_tv_college_name);
holder.superRoomteachPriceTv = (TextView)convertView.findViewById(R.id.thitem_tv_price_name);
holder.superRoomteachPhoneTv = (TextView)convertView.findViewById(R.id.thitem_tv_phone_name);
//将设置好的布局保存到缓存中,并将其设置在Tag里,以便后面方便取出Tag
convertView.setTag(holder);
}
else{
holder = (ViewHolder)convertView.getTag();
}
holder.superRoomteachImgIv.setImageResource((Integer) lstTeachItem.get(position).get("superRoomteachImgIv"));
holder.superRoomteachStarIv.setImageResource((Integer) lstTeachItem.get(position).get("superRoomteachStarIv"));
holder.superRoomteachSubTv.setText((String) lstTeachItem.get(position).get("superRoomteachSubTv"));
holder.superRoomteachNameTv.setText((String) lstTeachItem.get(position).get("superRoomteachNameTv"));
holder.superRoomteachCollegeTv.setText((String) lstTeachItem.get(position).get("superRoomteachCollegeTv"));
holder.superRoomteachPriceTv.setText((String) lstTeachItem.get(position).get("superRoomteachPriceTv"));
holder.superRoomteachPhoneTv.setText((String) lstTeachItem.get(position).get("superRoomteachPhoneTv"));
return convertView;
}
}
/** 停止刷新, */
private void onLoad() {
superClassHomeLv.stopRefresh();
superClassHomeLv.stopLoadMore();
superClassHomeLv.setRefreshTime("刚刚");
}
// 刷新
@Override
public void onRefresh() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
getData();
superClassHomeLv.setAdapter(superRoomAdapter);
onLoad();
}
}, 2000);
}
@Override
public void onBottom() {
// TODO Auto-generated method stub
superClassHomeLv.setBottomFlag(true);
}
// 加载更多
@Override
public void onLoadMore() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
getData();
superRoomAdapter.notifyDataSetChanged();
onLoad();
}
}, 2000);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode== KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0){
this.finish();
}
return false;
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
}
| [
"mengruxing@gmail.com"
] | mengruxing@gmail.com |
a2f8b1e0ccbdc600d5eea748898e2e8661d30e35 | 228214582de3e49e476054d7ea504625117aeb7b | /src/main/java/cn/gdeiassistant/Repository/Redis/ExportData/ExportDataDaoImpl.java | ff79ba6c48afa33be29390731d71fb7151c47b64 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | GdeiAssistant/GdeiAssistant | 01ab19e56a3abcb801f75bda58520c19cac07a9f | a998dbd232ba846c38ed7551e63ce8a3714c57e8 | refs/heads/master | 2022-12-16T20:44:32.433490 | 2022-12-04T22:48:26 | 2022-12-04T23:01:34 | 138,773,137 | 115 | 49 | NOASSERTION | 2022-12-04T23:01:35 | 2018-06-26T17:47:35 | Java | UTF-8 | Java | false | false | 1,803 | java | package cn.gdeiassistant.Repository.Redis.ExportData;
import cn.gdeiassistant.Tools.SpringUtils.RedisDaoUtils;
import cn.gdeiassistant.Tools.Utils.StringEncryptUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.concurrent.TimeUnit;
@Repository
public class ExportDataDaoImpl implements ExportDataDao {
private final String EXPORT_PREFIX = "EXPORT_DATA_";
private final String EXPORTING_PREFIX = "EXPORTING_DATA_";
@Autowired
private RedisDaoUtils redisDaoUtils;
@Override
public String QueryExportingDataToken(String username) {
return redisDaoUtils.get(StringEncryptUtils.SHA256HexString(EXPORTING_PREFIX + username));
}
@Override
public void RemoveExportingDataToken(String username) {
redisDaoUtils.delete(StringEncryptUtils.SHA256HexString(EXPORTING_PREFIX + username));
}
@Override
public void SaveExportingDataToken(String username, String token) {
redisDaoUtils.set(StringEncryptUtils.SHA256HexString(EXPORTING_PREFIX + username)
, token);
//一小时后以任务超时处理
redisDaoUtils.expire(StringEncryptUtils.SHA256HexString(EXPORTING_PREFIX + username)
, 1, TimeUnit.HOURS);
}
@Override
public String QueryExportDataToken(String username) {
return redisDaoUtils.get(StringEncryptUtils.SHA256HexString(EXPORT_PREFIX + username));
}
@Override
public void SaveExportDataToken(String username, String token) {
redisDaoUtils.set(StringEncryptUtils.SHA256HexString(EXPORT_PREFIX + username), token);
redisDaoUtils.expire(StringEncryptUtils.SHA256HexString(EXPORT_PREFIX + username)
, 24, TimeUnit.HOURS);
}
}
| [
"20649888+Pigbibi@users.noreply.github.com"
] | 20649888+Pigbibi@users.noreply.github.com |
095b9b5b7b2e7496a4cb32bd8fe60de77a7a40f3 | d6783fe9bd4f4093d924a809c753b58fd8f1fc4c | /app/src/main/java/com/example/admin/fastpay/MyApplication.java | 356d3baacdba7cea1410c58c7951a52f3fe525ef | [] | no_license | zengzhaoxing/app | 141c1295efed5ede81ae3f75cf02b24c44776077 | 594ac87549838385e7d7dd8f9b98be8fa5a9561e | refs/heads/master | 2020-03-17T20:56:03.991129 | 2019-03-27T09:46:09 | 2019-03-27T09:46:09 | 133,935,765 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,481 | java | package com.example.admin.fastpay;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import com.example.admin.fastpay.thirdsdk.BuglySDKConnector;
import com.example.admin.fastpay.thirdsdk.KeFuSDKConnector;
import com.example.admin.fastpay.thirdsdk.WeChatSDKConnector;
import com.iflytek.cloud.SpeechConstant;
import com.iflytek.cloud.SpeechUtility;
import com.mob.MobSDK;
import com.zxz.www.base.app.BaseApp;
import com.zxz.www.base.app.SDKAgent;
import com.zxz.www.base.utils.GetNativeBitmapSDK;
import com.zxz.www.base.utils.SPUtil;
import java.util.Stack;
import cn.jpush.android.api.JPushInterface;
import cn.sharesdk.framework.ShareSDK;
/**
* Created by sun on 2017/5/17.
*/
public class MyApplication extends BaseApp {
static {
SDKAgent.getInstance().addSDKConnector(BuglySDKConnector.getInstance());
SDKAgent.getInstance().addSDKConnector(WeChatSDKConnector.getInstance());
SDKAgent.getInstance().addSDKConnector(KeFuSDKConnector.getInstance());
}
@Override
public void onCreate() {
super.onCreate();
JPushInterface.setDebugMode(false); // 设置开启日志,发布时请关闭日志
JPushInterface.init(this); // 初始化 JPush
SpeechUtility.createUtility(this, SpeechConstant.APPID + "=591c244b");
MobSDK.init(this);
}
}
| [
"zengxianzi@yougola.com"
] | zengxianzi@yougola.com |
2c807cc0dba3eeafb02d37b16be02a4803bc5a25 | 654eee0cf42b9dafd641b40f9aa4fa39ed122955 | /src/com/company/queue/Queue.java | 8e4e0eabadf4446439d47a44a908cbb35fbf6c04 | [] | no_license | XYDong/data_structure | fee52b3991cd8adf6a8b418543926a05db3a7276 | b7fead064c7261dac904b0aaab9b3fb62edd8dda | refs/heads/master | 2023-08-25T05:23:35.419162 | 2021-10-26T09:28:24 | 2021-10-26T09:28:24 | 323,535,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package com.company.queue;
/**
* 功能描述: <br>
* <p>〈队列接口〉</p>
*
* @author Joker
* @ClassName Queue
* @date 2020/12/23 9:31
* @Version 1.0
* @ReviseName:
* @ReviseTime: 2020/12/23 9:31
*/
public interface Queue<E> {
// 添加元素
void enqueue(E e);
// 删除元素
E dequeue();
// 获取队首的元素
E getFront();
int getSize();
boolean isEmpty();
}
| [
"2028318192@qq.com"
] | 2028318192@qq.com |
f6823e6544cd0b3069942e7899a932e00ae7d410 | 42a577879387e5aa22704f0a82c75229b50a8039 | /src/main/java/cz/wake/lobby/listeners/TimedResetListener.java | e37ea467f38a2c5e87cabc3eb4b4bbe6d01d16b2 | [
"MIT"
] | permissive | RstYcz/craftlobby | f856fd65c70085a6948a231a4633b7c6716f669e | 5f208da2308b139b1f9b58b6b9b3e14618f64442 | refs/heads/master | 2022-11-26T07:12:55.751760 | 2020-07-21T23:59:30 | 2020-07-21T23:59:30 | 284,341,758 | 0 | 0 | MIT | 2020-08-01T21:29:36 | 2020-08-01T21:29:35 | null | UTF-8 | Java | false | false | 1,520 | java | package cz.wake.lobby.listeners;
import cz.craftmania.craftcore.spigot.events.time.DayChangeEvent;
import cz.craftmania.craftcore.spigot.events.time.MonthChangeEvent;
import cz.craftmania.craftcore.spigot.events.time.WeekChangeEvent;
import cz.wake.lobby.Main;
import cz.wake.lobby.utils.Log;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class TimedResetListener implements Listener {
@EventHandler
public void onWeekChange(WeekChangeEvent e) {
if (Main.getInstance().getConfig().getBoolean("server-utils.reset-week-votes", false)) {
Log.info("Zahajeni restartu tydennich hlasu!");
Main.getInstance().getSQL().resetWeekVotes();
Log.success("Reset hlasu byl dokoncen.");
}
}
@EventHandler
public void onDayChange(DayChangeEvent e) {
if (Main.getInstance().getConfig().getBoolean("server-utils.reset-daily-rewards", false)) {
Log.info("Zahajeni resetu dennich odmen!");
Main.getInstance().getSQL().resetDailyReward();
Log.success("Reset dennich odmen byl dokoncen.");
}
}
@EventHandler
public void onMonthChange(MonthChangeEvent e) {
if (Main.getInstance().getConfig().getBoolean("server-utils.reset-monthly-rewards", false)) {
Log.info("Zahajeni resetu mesicnich odmen pro VIP!");
Main.getInstance().getSQL().resetMonthlyReward();
Log.success("Reset mesicnich odmen byl dokoncen.");
}
}
}
| [
"joseff.kral@gmail.com"
] | joseff.kral@gmail.com |
846260a8e82c5516f6f22594c16cc4f193184690 | 7ddad006081401a01c785a03e878b0d2d677bf5f | /AidanAzkafaroDesonJmartFH/Complaint.java | c8bd4f76a80d9dac0282551976d49abab4977214 | [] | no_license | fadhlanhrts/others | fcfbc433efc029d4940ed4b337f59edf7ba8d9ca | 1c3327eb34229835c44958c7b4f5f03d568e2635 | refs/heads/master | 2023-08-27T22:20:17.289054 | 2021-11-05T10:00:01 | 2021-11-05T10:00:01 | 424,901,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,041 | java | package AidanAzkafaroDesonJmartFH;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;
/**
* Write a description of class Complaint here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Complaint extends Recognizable
{
// instance variables - replace the example below with your own
public String desc;
public String date;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Calendar cal = Calendar.getInstance();
public Complaint(int id, String desc){
this.desc = desc;
this.date = sdf.format(cal.getTime());
}
public boolean validate(){
return false;
}
public boolean read (String content){
return false;
}
public String toString(){
SimpleDateFormat SDformat = new SimpleDateFormat("dd/MM/yyyy");
String formatDate = SDformat.format(cal.getTime());
return "{date = " + formatDate + ", desc = '" + this.desc + "'}";
}
}
| [
"mharits@fintax.id"
] | mharits@fintax.id |
677a414b316da655e4ee1642f54b2b426c36420b | 877dfb7bfd7196fb8177846207d73519836ca457 | /src/main/java/com/auth0/samples/authapi/user/UserController.java | d7ac8f29f32ba2ddb2b36130c901d72274578faf | [] | no_license | davidsaraiva/spring-boot-auth | 5e0b6442c412aee851800a9f62c72145f7724575 | b889c0e2924712ab98ce659eb2e9042d3088884c | refs/heads/master | 2021-05-10T17:11:21.331497 | 2018-01-25T12:34:14 | 2018-01-25T12:34:14 | 118,601,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 996 | java | package com.auth0.samples.authapi.user;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/users")
public class UserController {
private ApplicationUserRepository applicationUserRepository;
private BCryptPasswordEncoder bCryptPasswordEncoder;
public UserController(ApplicationUserRepository applicationUserRepository,
BCryptPasswordEncoder bCryptPasswordEncoder) {
this.applicationUserRepository = applicationUserRepository;
this.bCryptPasswordEncoder = bCryptPasswordEncoder;
}
@PostMapping("/sign-up")
public void signUp(@RequestBody ApplicationUser user) {
user.setPassword(bCryptPasswordEncoder.encode(user.getPassword()));
applicationUserRepository.save(user);
}
}
| [
"david.saraiva@daimler.com"
] | david.saraiva@daimler.com |
7b0d9ecdabd80ffea40ee81e37bd27d9ae6adeb7 | bcb38820a3f47e490e552bdce40b6a11b10e40f1 | /target/generated-sources/annotations/com/amazonaws/handler/GetBookingsHandler_MembersInjector.java | ca7849bf2054aa8f79a4c83a31184309f4eae347 | [
"MIT-0",
"Apache-2.0"
] | permissive | rahulpopat/mb3-aws-sam-java-rest-pipeline | e761ca7508604391b5fab76c60b21de7f409d8af | cac869e08048fb70b247d08951eb83551ab7ec57 | refs/heads/master | 2022-12-23T21:37:12.770508 | 2020-04-16T16:56:34 | 2020-04-16T16:56:34 | 250,635,815 | 0 | 0 | NOASSERTION | 2022-05-20T21:30:18 | 2020-03-27T20:07:18 | Java | UTF-8 | Java | false | false | 1,539 | java | package com.amazonaws.handler;
import com.amazonaws.dao.BookingDao;
import com.fasterxml.jackson.databind.ObjectMapper;
import dagger.MembersInjector;
import javax.annotation.Generated;
import javax.inject.Provider;
@Generated(
value = "dagger.internal.codegen.ComponentProcessor",
comments = "https://google.github.io/dagger"
)
public final class GetBookingsHandler_MembersInjector
implements MembersInjector<GetBookingsHandler> {
private final Provider<ObjectMapper> objectMapperProvider;
private final Provider<BookingDao> bookingDaoProvider;
public GetBookingsHandler_MembersInjector(
Provider<ObjectMapper> objectMapperProvider, Provider<BookingDao> bookingDaoProvider) {
this.objectMapperProvider = objectMapperProvider;
this.bookingDaoProvider = bookingDaoProvider;
}
public static MembersInjector<GetBookingsHandler> create(
Provider<ObjectMapper> objectMapperProvider, Provider<BookingDao> bookingDaoProvider) {
return new GetBookingsHandler_MembersInjector(objectMapperProvider, bookingDaoProvider);
}
@Override
public void injectMembers(GetBookingsHandler instance) {
injectObjectMapper(instance, objectMapperProvider.get());
injectBookingDao(instance, bookingDaoProvider.get());
}
public static void injectObjectMapper(GetBookingsHandler instance, ObjectMapper objectMapper) {
instance.objectMapper = objectMapper;
}
public static void injectBookingDao(GetBookingsHandler instance, BookingDao bookingDao) {
instance.bookingDao = bookingDao;
}
}
| [
"poprahul@amazon.com"
] | poprahul@amazon.com |
d2ab9c39220f97fb6c191b1f6f0b37a303d53676 | d766701b5309835226b7e1d0698ac8fc578d6177 | /src/preguntas_quizz/Preguntas_quizz.java | c1c7e3ca75f60b45f79222eb7fba00592ae4c390 | [] | no_license | LuisPerez04/Cuestionario_quizz | 77757eb94ec12dc52bb70f2f93c67f012e2a349f | 926025cd990fb36795e9c5a373633a140dc5a9d3 | refs/heads/master | 2023-04-10T05:56:24.396601 | 2021-04-30T01:00:34 | 2021-04-30T01:00:34 | 362,987,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,923 | java | package preguntas_quizz;
import java.util.Scanner;
public class Preguntas_quizz {
public static String[][] preguntas;
public static String[][] incisos;
public static int contadores;
public static void banco_preguntas() {
preguntas = new String[10][2];
preguntas[0][0] = "¿Cuál es la sintaxis correcta para generar Hello World en Java?";
preguntas[0][1] = "0";
preguntas[1][0] = "¿Cómo se insertan comentarios de una línea en Java?";
preguntas[1][1] = "1";
preguntas[2][0] = "¿Qué tipo de datos se utiliza para crear una variable que almacene texto?";
preguntas[2][1] = "2";
preguntas[3][0] = "¿Cómo se crea una variable numérica que asigne el valor 5?";
preguntas[3][1] = "0";
preguntas[4][0] = "¿Qué operador se utiliza para comparar dos valores?";
preguntas[4][1] = "1";
preguntas[5][0] = "¿Para declarar un arreglo, la variable se define como tipo?";
preguntas[5][1] = "2";
preguntas[6][0] = "¿Qué instrucción se usa para crear una clase en Java?";
preguntas[6][1] = "0";
preguntas[7][0] = "¿Cuál es la sentencia correcta para crear un objeto llamado myObj de MyClass? ";
preguntas[7][1] = "1";
preguntas[8][0] = "¿Cuál es el operador que se utiliza para multiplicar números?";
preguntas[8][1] = "2";
preguntas[9][0] = "¿Cómo se inicia la sentencia if en Java?";
preguntas[9][1] = "0";
}
public static void respuestas_incisos() {
incisos = new String[10][3];
incisos[0][0] = "System.out.println( Hello World );";
incisos[0][1] = "echo( Hello World );";
incisos[0][2] = "print ( Hello World );";
incisos[1][0] = "/* This is a comment";
incisos[1][1] = "// This is a comment";
incisos[1][2] = "# This is a comment";
incisos[2][0] = "myString";
incisos[2][1] = "string";
incisos[2][2] = "String";
incisos[3][0] = "int x = 5;";
incisos[3][1] = "num x = 5";
incisos[3][2] = "x = 5;";
incisos[4][0] = "><";
incisos[4][1] = "==";
incisos[4][2] = "<>";
incisos[5][0] = "{}";
incisos[5][1] = "()";
incisos[5][2] = "[]";
incisos[6][0] = "class";
incisos[6][1] = "MyClass";
incisos[6][2] = "class()";
incisos[7][0] = "class MyClass = new myObj();";
incisos[7][1] = "MyClass myObj = new MyClass();";
incisos[7][2] = "new myObj = MyClass();";
incisos[8][0] = "%";
incisos[8][1] = "X";
incisos[8][2] = "*";
incisos[9][0] = "if (x > y)";
incisos[9][1] = "if x > y;";
incisos[9][2] = "if x > y then;";
}
public static void procesos(){
String respuesta;
Scanner entrada = new Scanner(System.in);
for (int i = 0; i < preguntas.length; i++) {
System.out.println();
System.out.println("Pregunta " + (i + 1));
System.out.println(preguntas[i][0]);
System.out.println("0.- " + incisos[i][0]);
System.out.println("1.- " + incisos[i][1]);
System.out.println("2.- " + incisos[i][2]);
System.out.println();
System.out.print("Escribe el numero correcto: ");
respuesta = entrada.nextLine();
if(preguntas[i][1].equals(respuesta)){
contadores++;
}
}
}
public static int contador(){
return contadores;
}
public static void main(String[] args) {
banco_preguntas();
respuestas_incisos();
procesos();
System.out.println();
System.out.println("Obtuviste " + contadores + " de 10 de calificacion");
}
}
| [
"Atomi@LAPTOP-2PMC52BP"
] | Atomi@LAPTOP-2PMC52BP |
eec8a800a40593b22be3e979a4a00fc8e24c63f8 | f5b57fcd8ce20eb0122884224a13af5a384453f5 | /week4/src/main/java/hello/hellospring/service/SpringConfig.java | 550f027c6160f62b99b4f7a3b25dd6675f74ff73 | [] | no_license | teamcadi/study-spring-jangsoohyun | e2e1e616de4c3b49e216b958e37741b1518fa73e | dc13c1c5cbaecb2369b1db7d5559b5771fc63413 | refs/heads/master | 2023-01-09T11:19:14.704367 | 2020-11-06T12:04:36 | 2020-11-06T12:04:36 | 291,627,659 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 561 | java | package hello.hellospring.service;
import hello.hellospring.repository.MemberRepository;
import hello.hellospring.repository.MemoryMemberRepository;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class SpringConfig {
//스프링빈에 등록
@Bean
public MemberService memberService() {
return new MemberService(memberRepository());
}
@Bean
public MemberRepository memberRepository() {
return new MemoryMemberRepository();
}
}
| [
"soohyun6879@naver.com"
] | soohyun6879@naver.com |
1792331d694fae064ee132f96c7271767662864e | 02f19c7de39a4006605f7ee594d0e3219d0b28e3 | /app/src/main/java/com/tin/chigua/mywebo/bean/HttpResponse.java | 4a8a6f0315d467eb1d13b886cbb2148a26ff7327 | [] | no_license | vap80963/MobileStore | d4c06cd2ed39ae3444ac76b142f6aa1d270caffd | 79eecd9bc6df5dde9683709d3dc54c4b69558495 | refs/heads/master | 2020-05-21T08:42:39.143361 | 2017-07-17T14:03:03 | 2017-07-17T14:03:03 | 62,787,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 227 | java | package com.tin.chigua.mywebo.bean;
import com.google.gson.JsonArray;
/**
* Created by hasee on 5/11/2017.
*/
public class HttpResponse {
public JsonArray response;
public String message;
public int code;
}
| [
"809634963@qq.com"
] | 809634963@qq.com |
4693c8a3f5f1081950d15ad1a2c303845c1fcca0 | c7a33db9eb9f33a2b685616f8b6734072ebc59a4 | /spring-demo/src/main/java/com/ioc/container/Person.java | 27e1b6f1429dac085946934e61c5d67355e8dc5d | [] | no_license | niqikai/SSM | 3c9dd2a7944d6b43448ba45bd77aa589533bf607 | 502350a4cef656db2fe171b597c26ad1a5109824 | refs/heads/master | 2020-05-27T16:04:59.788980 | 2019-11-15T15:26:54 | 2019-11-15T15:26:54 | 172,713,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 140 | java | package com.ioc.container;
public class Person {
public Person() {
System.out.println(" create person bean ... ...");
}
}
| [
"niqikai@aliyun.com"
] | niqikai@aliyun.com |
a518f855be06b3b0caa4f127d0f48d1b66703c25 | 5d715e8e8ff3573bd60f30820c2cec50c4c4c076 | /ch04/src/ch04/Ch04Ex02_01.java | 34eab1b18f7f7de1a8d6481bbc212fa9ad96d088 | [] | no_license | scox1090/work_java | e75d203cb5702ac230a3435231fb266b13105fb6 | 89507165c9f5c4293ed5ccb7f1faf96e3fb78794 | refs/heads/master | 2020-03-21T02:36:42.885130 | 2018-07-25T12:29:34 | 2018-07-25T12:29:34 | 134,252,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 160 | java | package ch04;
public class Ch04Ex02_01 {
public static void main(String[] args) {
int a = 1;
while( a <=15) {
System.out.print(a++ +" ");
}
}
}
| [
"KOITT@KOITT-PC"
] | KOITT@KOITT-PC |
ee5b880c424c71aef6f0aaa1b6b994566c6b375f | 91e0dae25c003d8ec47ee62cacbe7982f062c8a6 | /MovieService/src/main/java/movie/MovieService/MovieServiceApplication.java | 8cc6797372f7d5345e921585d1b8249b647cb239 | [] | no_license | s21165/JAZZ | 0f85ec772b28b34af221ffe026973186de141645 | a2897361e35291392a312942a81bf8c3cee8e1ce | refs/heads/main | 2023-06-02T00:40:25.955374 | 2021-06-17T21:29:27 | 2021-06-17T21:29:27 | 377,964,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package movie.movieService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MovieServiceApplication {
public static void main(String[] args) {
SpringApplication.run(MovieServiceApplication.class, args);
}
}
| [
"s21165@pjwstk.edu.pl"
] | s21165@pjwstk.edu.pl |
9cbe58b4339ad9ae171cc8198a4dcfc0ec652c0d | c545a04adbf1ca98af10b13704377e585ce7ef0c | /src/main/java/com/jun/interceptor/AuthInterceptor.java | 37d50e7ec260a275bd593dee4cfa603805a84c4b | [] | no_license | hyungjunk/CopCha | 720a987b082ef187eb26a5deddbe8753f9485cfd | 0f8a92ee0141d387de76e553fa7ad7392277d88d | refs/heads/master | 2022-12-20T12:28:04.746313 | 2020-05-14T07:20:23 | 2020-05-14T07:20:23 | 140,355,100 | 0 | 0 | null | 2022-12-16T09:42:18 | 2018-07-10T00:08:53 | Java | UTF-8 | Java | false | false | 1,242 | java | package com.jun.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AuthInterceptor extends HandlerInterceptorAdapter {
private static final Logger logger = LoggerFactory.getLogger(AuthInterceptor.class);
private void saveDest(HttpServletRequest req) {
// temporarily save the original destination
String uri = req.getRequestURI();
logger.info(uri);
String query = req.getQueryString();
logger.info(query);
if (query == null || query.equals("null")) {
query = "";
} else {
query = "?" + query;
}
if (req.getMethod().equals("GET")) {
logger.info("dest: " + (uri+query));
req.getSession().setAttribute("dest", uri+query);
}
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object Handler) throws Exception{
HttpSession session = request.getSession();
if (session.getAttribute("login") == null) {
logger.info("user is not logged in");
saveDest(request);
return false;
}
return true;
}
}
| [
"khjgd2@gmail.com"
] | khjgd2@gmail.com |
50541892a06bf9219b537a6e2a5c9cb9ac817a95 | 1d44a48c68f6f2664a21daac6942abbc496ee1e4 | /src/main/java/spring/config/controllers/FirstController.java | dd1d1f8be50f9864aa2b89927e3a1cbc8992e366 | [] | no_license | Sombrero1/spring_case_15_java_classes | e58b6c3e6dea6a1cedd1a4aca1474d74923320b0 | bc03df821faea06ef7038a023a27a08864443608 | refs/heads/master | 2023-02-08T04:55:45.406553 | 2021-01-03T09:20:42 | 2021-01-03T09:20:42 | 326,394,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 467 | java | package spring.config.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/first")
public class FirstController {
@GetMapping("/hello")
public String helloR(){
return "first/hello";
}
@GetMapping("/goodbye")
public String goodbyeR(){
return "first/goodbye";
}
}
| [
"vovashevchenko1964@mail.ru"
] | vovashevchenko1964@mail.ru |
e4e80f45315606c66b84a21785bdacf849ba9fd9 | f788c949c623a81fbbb7ab1a4d639d0338c22c55 | /源代码/IdP/openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/DefaultOIDCTokenService.java | 8939aa86790250afed43840302df2b1aa12f0c1d | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | cqguo/UPPRESSO_Source | 315205d3815e732ced5d877ea4030914fa70c60c | ee04a5de7d979af876f9ee0e1413dee9f499568f | refs/heads/main | 2023-09-02T06:59:21.941019 | 2021-11-13T04:34:04 | 2021-11-13T04:34:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,179 | java | /*******************************************************************************
* Copyright 2018 The MIT Internet Trust Consortium
*
* Portions copyright 2011-2013 The MITRE Corporation
*
* 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.mitre.openid.connect.service.impl;
import static org.mitre.openid.connect.request.ConnectRequestParameters.MAX_AGE;
import static org.mitre.openid.connect.request.ConnectRequestParameters.NONCE;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.mitre.jwt.encryption.service.JWTEncryptionAndDecryptionService;
import org.mitre.jwt.signer.service.JWTSigningAndValidationService;
import org.mitre.jwt.signer.service.impl.ClientKeyCacheService;
import org.mitre.jwt.signer.service.impl.SymmetricKeyJWTValidatorCacheService;
import org.mitre.oauth2.model.AuthenticationHolderEntity;
import org.mitre.oauth2.model.ClientDetailsEntity;
import org.mitre.oauth2.model.OAuth2AccessTokenEntity;
import org.mitre.oauth2.repository.AuthenticationHolderRepository;
import org.mitre.oauth2.service.OAuth2TokenEntityService;
import org.mitre.oauth2.service.SystemScopeService;
import org.mitre.openid.connect.config.ConfigurationPropertiesBean;
import org.mitre.openid.connect.service.OIDCTokenService;
import org.mitre.openid.connect.util.IdTokenHashUtils;
import org.mitre.openid.connect.web.AuthenticationTimeStamper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.OAuth2Request;
import org.springframework.stereotype.Service;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.nimbusds.jose.Algorithm;
import com.nimbusds.jose.JWEHeader;
import com.nimbusds.jose.JWEObject;
import com.nimbusds.jose.JWSAlgorithm;
import com.nimbusds.jose.JWSHeader;
import com.nimbusds.jose.util.Base64URL;
import com.nimbusds.jwt.EncryptedJWT;
import com.nimbusds.jwt.JWT;
import com.nimbusds.jwt.JWTClaimsSet;
import com.nimbusds.jwt.PlainJWT;
import com.nimbusds.jwt.SignedJWT;
/**
* Default implementation of service to create specialty OpenID Connect tokens.
*
* @author Amanda Anganes
*
*/
@Service
public class DefaultOIDCTokenService implements OIDCTokenService {
/**
* Logger for this class
*/
private static final Logger logger = LoggerFactory.getLogger(DefaultOIDCTokenService.class);
@Autowired
private JWTSigningAndValidationService jwtService;
@Autowired
private AuthenticationHolderRepository authenticationHolderRepository;
@Autowired
private ConfigurationPropertiesBean configBean;
@Autowired
private ClientKeyCacheService encrypters;
@Autowired
private SymmetricKeyJWTValidatorCacheService symmetricCacheService;
@Autowired
private OAuth2TokenEntityService tokenService;
@Override
public JWT createIdToken(ClientDetailsEntity client, OAuth2Request request, Date issueTime, String sub, OAuth2AccessTokenEntity accessToken) {
JWSAlgorithm signingAlg = jwtService.getDefaultSigningAlgorithm();
if (client.getIdTokenSignedResponseAlg() != null) {
signingAlg = client.getIdTokenSignedResponseAlg();
}
JWT idToken = null;
JWTClaimsSet.Builder idClaims = new JWTClaimsSet.Builder();
// if the auth time claim was explicitly requested OR if the client always wants the auth time, put it in
if (request.getExtensions().containsKey(MAX_AGE)
|| (request.getExtensions().containsKey("idtoken")) // TODO: parse the ID Token claims (#473) -- for now assume it could be in there
|| (client.getRequireAuthTime() != null && client.getRequireAuthTime())) {
if (request.getExtensions().get(AuthenticationTimeStamper.AUTH_TIMESTAMP) != null) {
Long authTimestamp = Long.parseLong((String) request.getExtensions().get(AuthenticationTimeStamper.AUTH_TIMESTAMP));
if (authTimestamp != null) {
idClaims.claim("auth_time", authTimestamp / 1000L);
}
} else {
// we couldn't find the timestamp!
logger.warn("Unable to find authentication timestamp! There is likely something wrong with the configuration.");
}
}
idClaims.issueTime(issueTime);
if (client.getIdTokenValiditySeconds() != null) {
Date expiration = new Date(System.currentTimeMillis() + (client.getIdTokenValiditySeconds() * 1000L));
idClaims.expirationTime(expiration);
}
idClaims.issuer(configBean.getIssuer());
idClaims.subject(sub);
idClaims.audience(Lists.newArrayList(client.getClientId()));
idClaims.jwtID(UUID.randomUUID().toString()); // set a random NONCE in the middle of it
String nonce = (String)request.getExtensions().get(NONCE);
if (!Strings.isNullOrEmpty(nonce)) {
idClaims.claim("nonce", nonce);
}
Set<String> responseTypes = request.getResponseTypes();
if (responseTypes.contains("token")) {
// calculate the token hash
Base64URL at_hash = IdTokenHashUtils.getAccessTokenHash(signingAlg, accessToken);
idClaims.claim("at_hash", at_hash);
}
addCustomIdTokenClaims(idClaims, client, request, sub, accessToken);
if (client.getIdTokenEncryptedResponseAlg() != null && !client.getIdTokenEncryptedResponseAlg().equals(Algorithm.NONE)
&& client.getIdTokenEncryptedResponseEnc() != null && !client.getIdTokenEncryptedResponseEnc().equals(Algorithm.NONE)
&& (!Strings.isNullOrEmpty(client.getJwksUri()) || client.getJwks() != null)) {
JWTEncryptionAndDecryptionService encrypter = encrypters.getEncrypter(client);
if (encrypter != null) {
idToken = new EncryptedJWT(new JWEHeader(client.getIdTokenEncryptedResponseAlg(), client.getIdTokenEncryptedResponseEnc()), idClaims.build());
encrypter.encryptJwt((JWEObject) idToken);
} else {
logger.error("Couldn't find encrypter for client: " + client.getClientId());
}
} else {
if (signingAlg.equals(Algorithm.NONE)) {
// unsigned ID token
idToken = new PlainJWT(idClaims.build());
} else {
// signed ID token
if (signingAlg.equals(JWSAlgorithm.HS256)
|| signingAlg.equals(JWSAlgorithm.HS384)
|| signingAlg.equals(JWSAlgorithm.HS512)) {
JWSHeader header = new JWSHeader(signingAlg, null, null, null, null, null, null, null, null, null,
jwtService.getDefaultSignerKeyId(),
null, null);
idToken = new SignedJWT(header, idClaims.build());
JWTSigningAndValidationService signer = symmetricCacheService.getSymmetricValidtor(client);
// sign it with the client's secret
signer.signJwt((SignedJWT) idToken);
} else {
idClaims.claim("kid", jwtService.getDefaultSignerKeyId());
JWSHeader header = new JWSHeader(signingAlg, null, null, null, null, null, null, null, null, null,
jwtService.getDefaultSignerKeyId(),
null, null);
idToken = new SignedJWT(header, idClaims.build());
// sign it with the server's key
jwtService.signJwt((SignedJWT) idToken);
}
}
}
return idToken;
}
/**
* @param client
* @return
* @throws AuthenticationException
*/
@Override
public OAuth2AccessTokenEntity createRegistrationAccessToken(ClientDetailsEntity client) {
return createAssociatedToken(client, Sets.newHashSet(SystemScopeService.REGISTRATION_TOKEN_SCOPE));
}
/**
* @param client
* @return
*/
@Override
public OAuth2AccessTokenEntity createResourceAccessToken(ClientDetailsEntity client) {
return createAssociatedToken(client, Sets.newHashSet(SystemScopeService.RESOURCE_TOKEN_SCOPE));
}
@Override
public OAuth2AccessTokenEntity rotateRegistrationAccessTokenForClient(ClientDetailsEntity client) {
// revoke any previous tokens
OAuth2AccessTokenEntity oldToken = tokenService.getRegistrationAccessTokenForClient(client);
if (oldToken != null) {
Set<String> scope = oldToken.getScope();
tokenService.revokeAccessToken(oldToken);
return createAssociatedToken(client, scope);
} else {
return null;
}
}
private OAuth2AccessTokenEntity createAssociatedToken(ClientDetailsEntity client, Set<String> scope) {
// revoke any previous tokens that might exist, just to be sure
OAuth2AccessTokenEntity oldToken = tokenService.getRegistrationAccessTokenForClient(client);
if (oldToken != null) {
tokenService.revokeAccessToken(oldToken);
}
// create a new token
Map<String, String> authorizationParameters = Maps.newHashMap();
OAuth2Request clientAuth = new OAuth2Request(authorizationParameters, client.getClientId(),
Sets.newHashSet(new SimpleGrantedAuthority("ROLE_CLIENT")), true,
scope, null, null, null, null);
OAuth2Authentication authentication = new OAuth2Authentication(clientAuth, null);
OAuth2AccessTokenEntity token = new OAuth2AccessTokenEntity();
token.setClient(client);
token.setScope(scope);
AuthenticationHolderEntity authHolder = new AuthenticationHolderEntity();
authHolder.setAuthentication(authentication);
authHolder = authenticationHolderRepository.save(authHolder);
token.setAuthenticationHolder(authHolder);
JWTClaimsSet claims = new JWTClaimsSet.Builder()
.audience(Lists.newArrayList(client.getClientId()))
.issuer(configBean.getIssuer())
.issueTime(new Date())
.expirationTime(token.getExpiration())
.jwtID(UUID.randomUUID().toString()) // set a random NONCE in the middle of it
.build();
JWSAlgorithm signingAlg = jwtService.getDefaultSigningAlgorithm();
JWSHeader header = new JWSHeader(signingAlg, null, null, null, null, null, null, null, null, null,
jwtService.getDefaultSignerKeyId(),
null, null);
SignedJWT signed = new SignedJWT(header, claims);
jwtService.signJwt(signed);
token.setJwt(signed);
return token;
}
/**
* @return the configBean
*/
public ConfigurationPropertiesBean getConfigBean() {
return configBean;
}
/**
* @param configBean the configBean to set
*/
public void setConfigBean(ConfigurationPropertiesBean configBean) {
this.configBean = configBean;
}
/**
* @return the jwtService
*/
public JWTSigningAndValidationService getJwtService() {
return jwtService;
}
/**
* @param jwtService the jwtService to set
*/
public void setJwtService(JWTSigningAndValidationService jwtService) {
this.jwtService = jwtService;
}
/**
* @return the authenticationHolderRepository
*/
public AuthenticationHolderRepository getAuthenticationHolderRepository() {
return authenticationHolderRepository;
}
/**
* @param authenticationHolderRepository the authenticationHolderRepository to set
*/
public void setAuthenticationHolderRepository(
AuthenticationHolderRepository authenticationHolderRepository) {
this.authenticationHolderRepository = authenticationHolderRepository;
}
/**
* Hook for subclasses that allows adding custom claims to the JWT
* that will be used as id token.
* @param idClaims the builder holding the current claims
* @param client information about the requesting client
* @param request request that caused the id token to be created
* @param sub subject auf the id token
* @param accessToken the access token
* @param authentication current authentication
*/
protected void addCustomIdTokenClaims(JWTClaimsSet.Builder idClaims, ClientDetailsEntity client, OAuth2Request request,
String sub, OAuth2AccessTokenEntity accessToken) {
}
}
| [
"1294201528@qq.com"
] | 1294201528@qq.com |
7d33894f5ca4677d7530946f793312691fe29a1a | c40cf4bb6291fd4734519383938583ef53e38fc7 | /src/main/java/zhibi/cms/mapper/SysCategoryMapper.java | bcc3d0ed71ec82573015f29cbfbf3a6d9e7339ba | [] | no_license | kadouzhyu/zxc | 7406f16685ef7f1fa726efcad0895331f1d12f8c | b1dc34cac0dbffe2fa7d868c2b9dbeb43db97bb9 | refs/heads/master | 2020-03-20T05:43:27.387651 | 2018-06-13T14:18:15 | 2018-06-13T14:18:15 | 137,224,112 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package zhibi.cms.mapper;
import zhibi.cms.domain.SysCategory;
public interface SysCategoryMapper {
int deleteByPrimaryKey(Integer id);
int insert(SysCategory record);
int insertSelective(SysCategory record);
SysCategory selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(SysCategory record);
int updateByPrimaryKey(SysCategory record);
} | [
"kadouzhyu@163.com"
] | kadouzhyu@163.com |
0d3062d2db637742efbeacd47e4f2e49d5d8d17a | 92aae431ed8cfc000a4e48940b461315a70b7c3d | /Raven/src/com/example/raven/objects/SmsSender.java | fcb8bb7ed19e3f54332994c413e20a9d358a42f5 | [] | no_license | vnovikov746/Raven | 8c081fd1591504ca7ae0dd73af55f2798a02aa5c | 4c1076ba2d68ff7b620ec96784162ea44e9f3f8a | refs/heads/master | 2020-05-16T22:02:30.782903 | 2014-12-13T16:49:05 | 2014-12-13T16:49:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,998 | java | package com.example.raven.objects;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.telephony.SmsManager;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;
import com.example.raven.HistoryActivity;
import com.example.raven.db.Constants;
import com.example.raven.db.RavenDAL;
import com.example.raven.dict.Translator;
import com.example.raven.services.ServiceHandler;
public class SmsSender {
private Context mContext;
private RavenDAL dal = HistoryActivity.dal;
private AppPreferences _appPrefs = dal.AppPreferences();
public SmsSender(Context context) {
mContext = context;
}
public void send(String phoneNo, String original) {
if (_appPrefs.getBoolean(AppPreferences.TRANSLATE_OUT))
send(phoneNo, original, true);
else
send(phoneNo, original, false);
}
public void send(String phoneNo, String original, boolean translate) {
String translated = original;
//check SIM is in
if (!checkSimState()) return;
//check Internet connection
if (isInternetConnected()) {
//check if user want to translate
if (translate) {
translated = translate(original);
if (translated.equals(original)) {
Toast.makeText(mContext, "Unable to translate text", Toast.LENGTH_LONG).show();
Toast.makeText(mContext, "Original text was sent.", Toast.LENGTH_LONG).show();
}
}
}
sendSMS(phoneNo, original, translated); // method to send message
}
private boolean isInternetConnected() {
if (ServiceHandler.getConnectivityStatus(mContext) == ServiceHandler.TYPE_NOT_CONNECTED)
{
Toast.makeText(mContext, "Not connected to Internet", Toast.LENGTH_LONG).show();
return false;
}
return true;
}
private String translate(String message) {
Translator t = Raven.SetService(Raven.YANDEX);
if (_appPrefs.getBoolean(AppPreferences.TRANSLATE_OUT)) {
String from = _appPrefs.getString(AppPreferences.TRNASLATE_TO);
if (from == "")
from = "he";
String to = "en";
String translated = t.translate(from, to, message);
String original = message;
if (translated == "")
message = original;
else
message = translated;
}
Log.d("Tranlation:", message);
return message;
}
private boolean checkSimState() {
TelephonyManager telMgr = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
int simState = telMgr.getSimState();
switch(simState)
{
case TelephonyManager.SIM_STATE_ABSENT:
displayAlert();
break;
case TelephonyManager.SIM_STATE_NETWORK_LOCKED:
// do something
break;
case TelephonyManager.SIM_STATE_PIN_REQUIRED:
// do something
break;
case TelephonyManager.SIM_STATE_PUK_REQUIRED:
// do something
break;
case TelephonyManager.SIM_STATE_READY:
return true;
case TelephonyManager.SIM_STATE_UNKNOWN:
// do something
break;
}
Log.d("checkSimState", "false");
return false;
}
private void displayAlert()
{
new AlertDialog.Builder(mContext).setMessage("Sim card not available")
.setCancelable(false)
.setPositiveButton("ok", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int id)
{
Log.d("SIM", "I am inside ok");
dialog.cancel();
}
}).show();
}
private void sendSMS(String phoneNumber, String original, String message)
{
String SENT = "SMS_SENT";
String DELIVERED = "SMS_DELIVERED";
TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
String countryCode = CountryCodeMap.COUNTRIES
.get(tm.getSimCountryIso());
if(phoneNumber.startsWith(countryCode))
{
phoneNumber = "0" + phoneNumber.substring(countryCode.length());
}
dal.addMessage(original, message, phoneNumber, Constants.SENT_BY_ME,
Constants.NOT_READ, Constants.NOT_SENT);
PendingIntent sentPI = PendingIntent.getBroadcast(mContext, 0,
new Intent(SENT), 0);
PendingIntent deliveredPI = PendingIntent.getBroadcast(mContext, 0,
new Intent(DELIVERED), 0);
// ---when the SMS has been sent---
mContext.registerReceiver(new BroadcastReceiver()
{
@Override
public void onReceive(Context arg0, Intent arg1)
{
switch(getResultCode())
{
case Activity.RESULT_OK:
// Toast.makeText(Chat.this, "SMS sent",
// Toast.LENGTH_SHORT).show();
Log.d("CHAT SMS", "SMS SENT");
break;
case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
Toast.makeText(mContext, "Generic failure",
Toast.LENGTH_SHORT).show();
break;
case SmsManager.RESULT_ERROR_NO_SERVICE:
Toast.makeText(mContext, "No service",
Toast.LENGTH_SHORT).show();
break;
case SmsManager.RESULT_ERROR_NULL_PDU:
Toast.makeText(mContext, "Null PDU",
Toast.LENGTH_SHORT).show();
break;
case SmsManager.RESULT_ERROR_RADIO_OFF:
Toast.makeText(mContext, "Radio off",
Toast.LENGTH_SHORT).show();
break;
}
}
}, new IntentFilter(SENT));
// ---when the SMS has been delivered---
mContext.registerReceiver(new BroadcastReceiver()
{
@Override
public void onReceive(Context arg0, Intent arg1)
{
switch(getResultCode())
{
case Activity.RESULT_OK:
// Toast.makeText(Chat.this, "SMS delivered",
// Toast.LENGTH_LONG).show();
Log.d("SMS CHAT", "DELIVERED");
break;
case Activity.RESULT_CANCELED:
Toast.makeText(mContext, "SMS not delivered",
Toast.LENGTH_LONG).show();
break;
}
}
}, new IntentFilter(DELIVERED));
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);
}
}
| [
"eranno@post.jce.ac.il"
] | eranno@post.jce.ac.il |
e1b00c37618fc266a752b0998e4dd8981b2fd6e3 | e5c535b8290762bca86234dfc223a26447ebf303 | /state-pattern/src/main/java/com/seven/refactor/State.java | 7eb7f4bc56088bca6109d0e5c4346cc8c496e82d | [] | no_license | hanyao94/design-pattern | 468bbe8c67f930dd664ddb0c88360df5cc8f8df6 | 2e8a710c94adb3dffb7432170df7b9856d63991e | refs/heads/master | 2023-07-24T08:41:13.516869 | 2021-08-26T16:52:17 | 2021-08-26T16:52:17 | 366,713,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,912 | java | /**
* 版权所有(C),上海海鼎信息工程股份有限公司,2016,所有权利保留。
* <p>
* 项目名: design-pattern
* 文件名: State.java
* 模块说明:
* 修改历史:
* 2021/8/23 - seven - 创建。
*/
package com.seven.refactor;
import com.seven.base.Status;
import com.seven.messy.Result;
/**
* @author seven
*/
public abstract class State {
/**
* 活动提审
*
* @param activityId 活动ID
* @param currentStatus 当前状态
* @return 执行结果
*/
public abstract Result arraignment(String activityId, Enum<Status> currentStatus);
/**
* 审核通过
*
* @param activityId 活动ID
* @param currentStatus 当前状态
* @return 执行结果
*/
public abstract Result checkPass(String activityId, Enum<Status> currentStatus);
/**
* 审核拒绝
*
* @param activityId 活动ID
* @param currentStatus 当前状态
* @return 执行结果
*/
public abstract Result checkRefuse(String activityId, Enum<Status> currentStatus);
/**
* 撤审撤销
*
* @param activityId 活动ID
* @param currentStatus 当前状态
* @return 执行结果
*/
public abstract Result checkRevoke(String activityId, Enum<Status> currentStatus);
/**
* 活动关闭
*
* @param activityId 活动ID
* @param currentStatus 当前状态
* @return 执行结果
*/
public abstract Result close(String activityId, Enum<Status> currentStatus);
/**
* 活动开启
*
* @param activityId 活动ID
* @param currentStatus 当前状态
* @return 执行结果
*/
public abstract Result open(String activityId, Enum<Status> currentStatus);
/**
* 活动执行
*
* @param activityId 活动ID
* @param currentStatus 当前状态
* @return 执行结果
*/
public abstract Result doing(String activityId, Enum<Status> currentStatus);
}
| [
"hanyao.huang@foxmail.com"
] | hanyao.huang@foxmail.com |
81ce517138bd8ce09c2a125a351dfd42985b2ddf | ce691b735f1d63496998b9acd6fb6dc3911ceff0 | /libbase/src/test/java/com/dawn/libbase/ExampleUnitTest.java | 5cfde1d96fd223721c909ef48c79c18bb00088da | [] | no_license | MatrixSpring/FrameWork | b2040f10c2fbdc2d07adf18f9763f4c9fabaf8a3 | a713eb8fc5436c28a06f9f9aecf4802893771344 | refs/heads/master | 2020-10-01T11:45:01.462785 | 2019-12-12T13:00:18 | 2019-12-12T13:00:18 | 227,530,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | package com.dawn.libbase;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"shengyan.wang@51zouchuqu.com"
] | shengyan.wang@51zouchuqu.com |
c78b4f3043485cd02b3c4f29bb03e18628faff0d | d70ef101b3e083786efc268320f903f4d24b5210 | /src/main/java/classstructuremethods/NoteMain.java | 91b28f4193d4b87b166b17778f1b42b7e7fc3c23 | [] | no_license | fido1969/training-solutions-1 | b0eaccb9cb03957e9ba208b05883af3cb31a6583 | 714f8f323772e9d606c7e5f2f41427ed9a2e9186 | refs/heads/master | 2023-03-06T06:59:24.185623 | 2021-02-17T16:01:07 | 2021-02-17T16:01:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 293 | java | package classstructuremethods;
public class NoteMain {
public static void main(String[] args) {
Note note = new Note ();
note.setName("name");
note.setText("text");
note.setTopic("topic");
System.out.println(note.getNoteText());
}
}
| [
"gy.cseko@outlook.com"
] | gy.cseko@outlook.com |
e37c7163b942ad88063a5c23442a65665806a683 | b111b77f2729c030ce78096ea2273691b9b63749 | /db-example-large-multi-project/project86/src/main/java/org/gradle/test/performance/mediumjavamultiproject/project86/p432/Production8646.java | aa29cfd6970137f732f249a2a0457e57559a2e2a | [] | no_license | WeilerWebServices/Gradle | a1a55bdb0dd39240787adf9241289e52f593ccc1 | 6ab6192439f891256a10d9b60f3073cab110b2be | refs/heads/master | 2023-01-19T16:48:09.415529 | 2020-11-28T13:28:40 | 2020-11-28T13:28:40 | 256,249,773 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,896 | java | package org.gradle.test.performance.mediumjavamultiproject.project86.p432;
public class Production8646 {
private String property0;
public String getProperty0() {
return property0;
}
public void setProperty0(String value) {
property0 = value;
}
private String property1;
public String getProperty1() {
return property1;
}
public void setProperty1(String value) {
property1 = value;
}
private String property2;
public String getProperty2() {
return property2;
}
public void setProperty2(String value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | [
"nateweiler84@gmail.com"
] | nateweiler84@gmail.com |
c9e5a44c46f4881152b83aad3d269419f866a0b6 | 741238242d07e0d8ef5c1d76376ba5464a5c983f | /src/test/java/br/com/agibank/avaliacao/stub/SalesmanStub.java | 5ab56fa24b97bdfb978da10a0f45c859cc85012e | [] | no_license | silvioAL/avaliacao | d4143da03a7d65a19d24c840b43e2ffafcf2dd5b | 6b30346d990b6e0e16d8aa3b2fe5a94b957fa8fc | refs/heads/master | 2021-07-13T21:57:43.140797 | 2021-03-11T06:18:01 | 2021-03-11T06:18:01 | 238,841,981 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 436 | java | package br.com.agibank.avaliacao.stub;
import br.com.agibank.avaliacao.model.Salesman;
import java.math.BigDecimal;
public class SalesmanStub {
public static Salesman get() {
return Salesman.builder()
.cpf("12312323423")
.fileIdentifier("3")
.layoutId("1")
.salary(new BigDecimal("2323.11"))
.name("name")
.build();
}
}
| [
"silvio.trindade@ilegra.com"
] | silvio.trindade@ilegra.com |
a24e0fad0ee21cc4fcc1270bd94e00a56d617d50 | 60409996351d4e096f2f8fc7cfc5e46212937980 | /app/src/main/java/hznj/com/zhongcexiangjiao/zxing/activity/ResultActivity.java | ae5bb01c9b804fca14f6e0dd72bc62faf1bd3e6e | [] | no_license | lnrbqpy/ZhongCeXiangJiao1 | cd9d6acde49e69a3fc51de35b25e75c185781c97 | 938493134b99aabf59690a2704d2d6ed116912e8 | refs/heads/master | 2021-07-10T22:53:17.485285 | 2017-09-26T12:51:13 | 2017-09-26T12:51:13 | 106,491,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,864 | java | package hznj.com.zhongcexiangjiao.zxing.activity;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout.LayoutParams;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import hznj.com.zhongcexiangjiao.Activity.InquireActivity;
import hznj.com.zhongcexiangjiao.Activity.bzpChaXunActivity;
import hznj.com.zhongcexiangjiao.Activity.jlChaXunActivity;
import hznj.com.zhongcexiangjiao.R;
import hznj.com.zhongcexiangjiao.zxing.decode.DecodeThread;
public class ResultActivity extends Activity implements View.OnClickListener{
private ImageView mResultImage;
private TextView mResultText;
private Button btn_chaxun;
private RadioButton rb_chengxing;
private RadioButton rb_banzhipin;
private RadioButton rb_jiaoliao;
private RadioGroup rg_tiaozhuan;
private String result;
private Bundle extras;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_result);
extras = getIntent().getExtras();
result =extras.getString("result1");
initView();
initData();
}
private void initView() {
mResultImage = (ImageView) findViewById(R.id.result_image);
mResultText = (TextView) findViewById(R.id.result_text);
btn_chaxun = (Button) findViewById(R.id.btn_chaxun);
rb_chengxing = (RadioButton) findViewById(R.id.rb_chengxing);
rb_banzhipin = (RadioButton) findViewById(R.id.rb_banzhipin);
rb_jiaoliao = (RadioButton) findViewById(R.id.rb_jiaoliao);
rg_tiaozhuan = (RadioGroup) findViewById(R.id.rg_tiaozhuan);
btn_chaxun.setOnClickListener(this);
}
private void initData() {
if (null != extras) {
int width = extras.getInt("width");
int height = extras.getInt("height");
LayoutParams lps = new LayoutParams(width, height);
lps.topMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, getResources().getDisplayMetrics());
lps.leftMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
lps.rightMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
mResultImage.setLayoutParams(lps);
mResultText.setText(result);
Bitmap barcode = null;
byte[] compressedBitmap = extras.getByteArray(DecodeThread.BARCODE_BITMAP);
if (compressedBitmap != null) {
barcode = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
// Mutable copy:
barcode = barcode.copy(Bitmap.Config.RGB_565, true);
}
mResultImage.setImageBitmap(barcode);
}
}
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.btn_chaxun:
if (rb_chengxing.isChecked()==true) {
Intent intent1 = new Intent();
intent1.setClass(this, InquireActivity.class);
Bundle bundle = new Bundle();
bundle.putString("chengxing", result);
intent1.putExtras(bundle);
startActivity(intent1);
return;
}else if (rb_banzhipin.isChecked()==true) {
Intent intent1 = new Intent();
intent1.setClass(this, bzpChaXunActivity.class);
Bundle bundle = new Bundle();
bundle.putString("chengxing", result);
intent1.putExtras(bundle);
startActivity(intent1);
return;
} else if (rb_jiaoliao.isChecked()==true) {
Intent intent1 = new Intent();
intent1.setClass(this, jlChaXunActivity.class);
Bundle bundle = new Bundle();
bundle.putString("chengxing", result);
intent1.putExtras(bundle);
startActivity(intent1);
}
}
}
}
| [
"张新伟"
] | 张新伟 |
9106034309ad7353b43e03977d556cb1a5e070e6 | 5492b13ec10ee328cb6f9a1950c6128cfa0735aa | /src/main/java/coms/ComSocket.java | 715a969729b83f18a5299d86cb309dd15e3a86b0 | [] | no_license | TheGeniuses/DisJAS | 1bab2e1814ca6d00f38a608cac563e0748233cea | d2b5872a3d394ff71b80ccb90ce54cc5a8cb7acf | refs/heads/master | 2021-01-12T17:33:31.967792 | 2016-11-18T21:59:06 | 2016-11-18T21:59:06 | 71,600,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,250 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package coms;
import java.io.IOException;
/**
* @author sai
*/
public abstract
class ComSocket {
protected boolean connected = false;
protected IOException lastError = null;
protected boolean showComs = true;
public abstract
boolean connect()
throws IOException;
public abstract
boolean disconnect()
throws IOException;
public abstract
String getConnectionInfo();
public
IOException getLastError() {
return this.lastError;
}
public
boolean isConnected() {
return this.connected;
}
public abstract
String read()
throws IOException;
public abstract
void send(String msg)
throws IOException;
protected
void setError(IOException e) {
this.lastError = e;
}
public
void setShowComs(boolean e) {
this.showComs = e;
}
public abstract
boolean waitForConnection()
throws IOException;
public abstract
boolean waitForDisconnect()
throws IOException;
}
| [
"francogpellegrini@gmail.com"
] | francogpellegrini@gmail.com |
162de5aa98b592793f9344895cde38f5bff48e6f | 5598faaaaa6b3d1d8502cbdaca903f9037d99600 | /code_changes/Apache_projects/HADOOP-11149/5220d4dc27a5c6b050a3406bc37f39ab632f56bb/MiniZKFCCluster.java | a9bc9c0ba6a2f86be8f5855bdf0c50cef1a25705 | [] | 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 | 10,711 | 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.ha;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
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.fs.CommonConfigurationKeys;
import org.apache.hadoop.ha.HAServiceProtocol.HAServiceState;
import org.apache.hadoop.ha.HealthMonitor.State;
import org.apache.hadoop.security.AccessControlException;
import org.apache.hadoop.security.authorize.PolicyProvider;
import org.apache.hadoop.test.MultithreadedTestUtil.TestContext;
import org.apache.hadoop.test.MultithreadedTestUtil.TestingThread;
import org.apache.zookeeper.KeeperException.NoNodeException;
import org.apache.zookeeper.data.Stat;
import org.apache.zookeeper.server.ZooKeeperServer;
import com.google.common.base.Preconditions;
import com.google.common.primitives.Ints;
/**
* Harness for starting two dummy ZK FailoverControllers, associated with
* DummyHAServices. This harness starts two such ZKFCs, designated by
* indexes 0 and 1, and provides utilities for building tests around them.
*/
public class MiniZKFCCluster {
private final TestContext ctx;
private final ZooKeeperServer zks;
private DummyHAService svcs[];
private DummyZKFCThread thrs[];
private Configuration conf;
private DummySharedResource sharedResource = new DummySharedResource();
private static final Log LOG = LogFactory.getLog(MiniZKFCCluster.class);
public MiniZKFCCluster(Configuration conf, ZooKeeperServer zks) {
this.conf = conf;
// Fast check interval so tests run faster
conf.setInt(CommonConfigurationKeys.HA_HM_CHECK_INTERVAL_KEY, 50);
conf.setInt(CommonConfigurationKeys.HA_HM_CONNECT_RETRY_INTERVAL_KEY, 50);
conf.setInt(CommonConfigurationKeys.HA_HM_SLEEP_AFTER_DISCONNECT_KEY, 50);
svcs = new DummyHAService[2];
svcs[0] = new DummyHAService(HAServiceState.INITIALIZING,
new InetSocketAddress("svc1", 1234));
svcs[0].setSharedResource(sharedResource);
svcs[1] = new DummyHAService(HAServiceState.INITIALIZING,
new InetSocketAddress("svc2", 1234));
svcs[1].setSharedResource(sharedResource);
this.ctx = new TestContext();
this.zks = zks;
}
/**
* Set up two services and their failover controllers. svc1 is started
* first, so that it enters ACTIVE state, and then svc2 is started,
* which enters STANDBY
*/
public void start() throws Exception {
// Format the base dir, should succeed
thrs = new DummyZKFCThread[2];
thrs[0] = new DummyZKFCThread(ctx, svcs[0]);
assertEquals(0, thrs[0].zkfc.run(new String[]{"-formatZK"}));
ctx.addThread(thrs[0]);
thrs[0].start();
LOG.info("Waiting for svc0 to enter active state");
waitForHAState(0, HAServiceState.ACTIVE);
LOG.info("Adding svc1");
thrs[1] = new DummyZKFCThread(ctx, svcs[1]);
thrs[1].start();
waitForHAState(1, HAServiceState.STANDBY);
}
/**
* Stop the services.
* @throws Exception if either of the services had encountered a fatal error
*/
public void stop() throws Exception {
if (thrs != null) {
for (DummyZKFCThread thr : thrs) {
if (thr != null) {
thr.interrupt();
}
}
}
if (ctx != null) {
ctx.stop();
}
sharedResource.assertNoViolations();
}
/**
* @return the TestContext implementation used internally. This allows more
* threads to be added to the context, etc.
*/
public TestContext getTestContext() {
return ctx;
}
public DummyHAService getService(int i) {
return svcs[i];
}
public ActiveStandbyElector getElector(int i) {
return thrs[i].zkfc.getElectorForTests();
}
public DummyZKFC getZkfc(int i) {
return thrs[i].zkfc;
}
public void setHealthy(int idx, boolean healthy) {
svcs[idx].isHealthy = healthy;
}
public void setFailToBecomeActive(int idx, boolean doFail) {
svcs[idx].failToBecomeActive = doFail;
}
public void setFailToBecomeStandby(int idx, boolean doFail) {
svcs[idx].failToBecomeStandby = doFail;
}
public void setFailToFence(int idx, boolean doFail) {
svcs[idx].failToFence = doFail;
}
public void setUnreachable(int idx, boolean unreachable) {
svcs[idx].actUnreachable = unreachable;
}
/**
* Wait for the given HA service to enter the given HA state.
* This is based on the state of ZKFC, not the state of HA service.
* There could be difference between the two. For example,
* When the service becomes unhealthy, ZKFC will quit ZK election and
* transition to HAServiceState.INITIALIZING and remain in that state
* until the service becomes healthy.
*/
public void waitForHAState(int idx, HAServiceState state)
throws Exception {
DummyZKFC svc = getZkfc(idx);
while (svc.getServiceState() != state) {
ctx.checkException();
Thread.sleep(50);
}
}
/**
* Wait for the ZKFC to be notified of a change in health state.
*/
public void waitForHealthState(int idx, State state)
throws Exception {
ZKFCTestUtil.waitForHealthState(thrs[idx].zkfc, state, ctx);
}
/**
* Wait for the given elector to enter the given elector state.
* @param idx the service index (0 or 1)
* @param state the state to wait for
* @throws Exception if it times out, or an exception occurs on one
* of the ZKFC threads while waiting.
*/
public void waitForElectorState(int idx,
ActiveStandbyElector.State state) throws Exception {
ActiveStandbyElectorTestUtil.waitForElectorState(ctx,
getElector(idx), state);
}
/**
* Expire the ZK session of the given service. This requires
* (and asserts) that the given service be the current active.
* @throws NoNodeException if no service holds the lock
*/
public void expireActiveLockHolder(int idx)
throws NoNodeException {
Stat stat = new Stat();
byte[] data = zks.getZKDatabase().getData(
DummyZKFC.LOCK_ZNODE, stat, null);
assertArrayEquals(Ints.toByteArray(svcs[idx].index), data);
long session = stat.getEphemeralOwner();
LOG.info("Expiring svc " + idx + "'s zookeeper session " + session);
zks.closeSession(session);
}
/**
* Wait for the given HA service to become the active lock holder.
* If the passed svc is null, waits for there to be no active
* lock holder.
*/
public void waitForActiveLockHolder(Integer idx)
throws Exception {
DummyHAService svc = idx == null ? null : svcs[idx];
ActiveStandbyElectorTestUtil.waitForActiveLockData(ctx, zks,
DummyZKFC.SCOPED_PARENT_ZNODE,
(idx == null) ? null : Ints.toByteArray(svc.index));
}
/**
* Expires the ZK session associated with service 'fromIdx', and waits
* until service 'toIdx' takes over.
* @throws Exception if the target service does not become active
*/
public void expireAndVerifyFailover(int fromIdx, int toIdx)
throws Exception {
Preconditions.checkArgument(fromIdx != toIdx);
getElector(fromIdx).preventSessionReestablishmentForTests();
try {
expireActiveLockHolder(fromIdx);
waitForHAState(fromIdx, HAServiceState.STANDBY);
waitForHAState(toIdx, HAServiceState.ACTIVE);
} finally {
getElector(fromIdx).allowSessionReestablishmentForTests();
}
}
/**
* Test-thread which runs a ZK Failover Controller corresponding
* to a given dummy service.
*/
private class DummyZKFCThread extends TestingThread {
private final DummyZKFC zkfc;
public DummyZKFCThread(TestContext ctx, DummyHAService svc) {
super(ctx);
this.zkfc = new DummyZKFC(conf, svc);
}
@Override
public void doWork() throws Exception {
try {
assertEquals(0, zkfc.run(new String[0]));
} catch (InterruptedException ie) {
// Interrupted by main thread, that's OK.
}
}
}
static class DummyZKFC extends ZKFailoverController {
private static final String DUMMY_CLUSTER = "dummy-cluster";
public static final String SCOPED_PARENT_ZNODE =
ZKFailoverController.ZK_PARENT_ZNODE_DEFAULT + "/" +
DUMMY_CLUSTER;
private static final String LOCK_ZNODE =
SCOPED_PARENT_ZNODE + "/" + ActiveStandbyElector.LOCK_FILENAME;
private final DummyHAService localTarget;
public DummyZKFC(Configuration conf, DummyHAService localTarget) {
super(conf, localTarget);
this.localTarget = localTarget;
}
@Override
protected byte[] targetToData(HAServiceTarget target) {
return Ints.toByteArray(((DummyHAService)target).index);
}
@Override
protected HAServiceTarget dataToTarget(byte[] data) {
int index = Ints.fromByteArray(data);
return DummyHAService.getInstance(index);
}
@Override
protected void loginAsFCUser() throws IOException {
}
@Override
protected String getScopeInsideParentNode() {
return DUMMY_CLUSTER;
}
@Override
protected void checkRpcAdminAccess() throws AccessControlException {
}
@Override
protected InetSocketAddress getRpcAddressToBindTo() {
return new InetSocketAddress(0);
}
@Override
protected void initRPC() throws IOException {
super.initRPC();
localTarget.zkfcProxy = this.getRpcServerForTests();
}
@Override
protected PolicyProvider getPolicyProvider() {
return null;
}
}
} | [
"archen94@gmail.com"
] | archen94@gmail.com |
5291e9642d45d1381f10413c2038102809dc2b3f | e862ac838d6648f82d5dcfe6a3ce510c59a5cdd2 | /Playground/src/drugi/DrugiExtendaPackagePrivate.java | f928168d847217a6a9ba65a1bd0fc727279408ed | [] | no_license | MatejVukosav/JavaPlayground | a476831f612607fd44b17e16fdbe90c7d89bb18d | c0fff4e6844a4164a05d2bc6e3cf552e654a1405 | refs/heads/master | 2021-07-09T03:40:44.139048 | 2017-10-06T00:05:58 | 2017-10-06T00:05:58 | 105,952,496 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package drugi;
import prvi.PrviPackagePrivate;
/**
* Created by Vuki on 13.9.2017..
*/
public class DrugiExtendaPackagePrivate extends PrviPackagePrivate {
private void main (){
// ne mogu dohvatit package private varijablu
this.packagePrivateInt=5;
}
}
| [
"vuki146@gmail.com"
] | vuki146@gmail.com |
a59574a0730d5343ffb3e359c1aacd040e1ff0c3 | f1b1dc4630471638def112b1cdea89f5cfb8ff0e | /src/entity/SubClass.java | 2a8604cc33553c788c02d8b3cd2f1fd16d5132f3 | [] | no_license | guoruibiao/FixedAssetsManageSyatem | e4602c909ad26db7121ce61b1011bcd1c16de87f | 99806c98ca0f82441d00be8ec150cb6192702798 | refs/heads/master | 2021-01-18T22:20:45.471792 | 2016-07-17T07:45:46 | 2016-07-17T07:45:46 | 63,519,583 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,745 | java | package entity;
/**
* 资产小类,分类所属
*
* @author 郭瑞彪
*
*/
public class SubClass {
<<<<<<< HEAD
public String getSubClassName() {
return subClassName;
}
public void setSubClassName(String subClassName) {
this.subClassName = subClassName;
}
public int getSubClassId() {
return subClassId;
}
public void setSubClassId(int subClassId) {
this.subClassId = subClassId;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public int getClassId() {
return classId;
}
public void setClassId(int classId) {
this.classId = classId;
}
/**
* 资产小类的类名所属
*/
private String subClassName;
private int subClassId;
/**
* 小类资产所属的大类范围
*/
private String className;
private int classId;
=======
/**
* 资产小类的类名所属
*/
private String name;
/**
* 小类资产所属的大类范围
*/
private String clazzName;
>>>>>>> 1b8d6745bf1df4eec54b2f29d40315ffd5f10a1c
public SubClass() {
super();
// TODO Auto-generated constructor stub
}
<<<<<<< HEAD
@Override
public String toString() {
//return "SubClass [name=" + name + ", clazzName=" + clazzName + "]";
return classId+"\t"+className+"\t"+subClassId+"\t"+subClassName;
}
=======
@Override
public String toString() {
return "SubClass [name=" + name + ", clazzName=" + clazzName + "]";
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getClazzName() {
return clazzName;
}
public void setClazzName(String clazzName) {
this.clazzName = clazzName;
}
>>>>>>> 1b8d6745bf1df4eec54b2f29d40315ffd5f10a1c
}
| [
"marksinoberg@gmail.com"
] | marksinoberg@gmail.com |
566891c80a939572b884a8a0c0c6169015f3f1a3 | 83ac626239ebc682c34aa004274319c401b714d6 | /group07/20409287/mini-jvm/src/com/coderising/jvm/loader/ClassFileLoader.java | 64ca83f91a8a2c07422c4e5561c5e658656e5bcd | [] | no_license | leijing1992/coding2017 | 83802d43e875319f7b2f773a368fec624b65918d | e53b8cc05c86abe878427890f6ccef4e5b94b4f3 | refs/heads/master | 2021-01-19T09:37:02.839346 | 2017-06-06T06:11:18 | 2017-06-06T06:11:18 | 84,895,874 | 1 | 4 | null | 2017-03-14T13:11:25 | 2017-03-14T02:23:09 | Java | UTF-8 | Java | false | false | 1,628 | java | package com.coderising.jvm.loader;
import com.coderising.jvm.clz.ClassFile;
import org.junit.Assert;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
public class ClassFileLoader {
private List<String> clzPaths = new ArrayList<>();
public byte[] readBinaryCode(String className) {
String clzFileName = className.replaceAll("\\.", "/") + ".class";
// 查找文件
boolean isFind = false;
File clzFile = null;
for (String path : clzPaths) {
File file = new File(path + clzFileName);
if (file.exists()) {
isFind = true;
clzFile = file;
break;
}
}
if (!isFind) {
throw new RuntimeException("找不到类: " + className);
}
ByteArrayOutputStream bao = new ByteArrayOutputStream();;
try (
FileInputStream fis = new FileInputStream(clzFile);
) {
byte[] buffer = new byte[4096];
int length = 0;
while ((length = fis.read(buffer)) != -1) {
bao.write(buffer, 0, length);
}
bao.flush();
} catch (IOException e) {
e.printStackTrace();
}
return bao.toByteArray();
}
public ClassFile loadClass(String className) {
byte[] byteCode = readBinaryCode(className);
// 此处应有字节码处理
ClassFileParser classFileParse = new ClassFileParser();
return classFileParse.parse(byteCode);
}
public void addClassPath(String path) {
clzPaths.add(path);
}
public String getClassPath(){
StringBuilder classPaths = new StringBuilder();
for (String clsPath : clzPaths) {
classPaths.append(clsPath).append(";");
}
classPaths.deleteCharAt(classPaths.length() - 1);
return classPaths.toString();
}
}
| [
"20409287@qq.com"
] | 20409287@qq.com |
3e01e62d8c180928827679e17a6f6feff324fa23 | fce2fd6853b6fe59ad55e519a0bd55fb9d0f0fa8 | /src/main/java/jndc/core/NDCMessageProtocol.java | 8aa958939794200185522ae5497214db6ab4bdda | [
"Apache-2.0"
] | permissive | liupingtoday/jndc | d84a003a7dec674f262560d53bb47eaf43c8555e | c545643e0b996e1e7aca3551276fff4b38bdf42c | refs/heads/master | 2023-01-22T00:55:40.321822 | 2020-11-30T02:09:40 | 2020-11-30T02:09:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,593 | java | package jndc.core;
import io.netty.channel.ChannelHandlerContext;
import jndc.utils.ByteArrayUtils;
import jndc.utils.HexUtils;
import jndc.utils.LogPrint;
import jndc.utils.ObjectSerializableUtils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.SocketAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* No Distance Connection Protocol
*/
public class NDCMessageProtocol {
/*--------------------- message types ---------------------*/
public static final byte TCP_DATA = 1;//tcp data transmission message
public static final byte TCP_ACTIVE = 2;//tcp active message
public static final byte MAP_REGISTER = 3;//client register message
public static final byte CONNECTION_INTERRUPTED = 4;//server or client connection interrupted
public static final byte NO_ACCESS = 5;//auth fail
public static final byte USER_ERROR = 6;//throw by user
public static final byte UN_CATCHABLE_ERROR = 7;//runtime unCatch
public static final byte CHANNEL_HEART_BEAT = 8;//the channel heart beat
public static final int UN_USED_PORT = 0;//the single package length
/*--------------------- static variable ---------------------*/
//the max length of single package,protocol just support 4 byte to this value,so the value need to less then Integer.MAX_VALUE
public static final int AUTO_UNPACK_LENGTH = 5 * 1024 * 1024;
public static final int FIX_LENGTH = 29;//the length of the fixed part of protocol
public static final byte[] BLANK = "BLANK".getBytes();//magic variable
public static final byte[] ACTIVE_MESSAGE = "ACTIVE_MESSAGE".getBytes();//magic variable
private static final byte[] MAGIC = "NDC".getBytes();//magic variable
/* ================= variable ================= */
private byte version = 1;//protocol version
private byte type;//data type
private InetAddress remoteInetAddress;//remote ip
private InetAddress localInetAddress;//local ip
private int remotePort;
private int serverPort;
private int localPort;
private int dataSize;
private byte[] data;
private NDCMessageProtocol() {
}
/**
* need optimization
*/
public NDCMessageProtocol copy() {
NDCMessageProtocol ndcMessageProtocol = new NDCMessageProtocol();
ndcMessageProtocol.setVersion(getVersion());
ndcMessageProtocol.setLocalInetAddress(getLocalInetAddress());
ndcMessageProtocol.setRemoteInetAddress(getRemoteInetAddress());
ndcMessageProtocol.setLocalPort(getLocalPort());
ndcMessageProtocol.setServerPort(getServerPort());
ndcMessageProtocol.setRemotePort(getRemotePort());
ndcMessageProtocol.setType(getType());
//clean data
ndcMessageProtocol.setData("".getBytes());
return ndcMessageProtocol;
}
/**
* fast create message
* @param remoteInetAddress the connector ip
* @param localInetAddress the map service ip
* @param remotePort the connector port
* @param serverPort the server port
* @param localPort the map service port
* @param type the message type
* @return
*/
public static NDCMessageProtocol of(InetAddress remoteInetAddress, InetAddress localInetAddress, int remotePort, int serverPort, int localPort, byte type) {
NDCMessageProtocol NDCMessageProtocol = new NDCMessageProtocol();
NDCMessageProtocol.setRemoteInetAddress(remoteInetAddress);
NDCMessageProtocol.setLocalInetAddress(localInetAddress);
NDCMessageProtocol.setLocalPort(localPort);
NDCMessageProtocol.setServerPort(serverPort);
NDCMessageProtocol.setRemotePort(remotePort);
NDCMessageProtocol.setType(type);
NDCMessageProtocol.setData("".getBytes());
return NDCMessageProtocol;
}
/**
* parse the fix part of data
* @param bytes
* @return
*/
public static NDCMessageProtocol parseFixInfo(byte[] bytes) {
if (bytes.length < FIX_LENGTH) {
throw new RuntimeException("unSupportFormat");
}
//replace with Arrays.compare in jdk 9
if (!Arrays.equals(MAGIC, Arrays.copyOfRange(bytes, 0, 3))) {
throw new RuntimeException("unSupportProtocol");
}
byte version = Arrays.copyOfRange(bytes, 3, 4)[0];
byte type = Arrays.copyOfRange(bytes, 4, 5)[0];
byte[] localInetAddress = Arrays.copyOfRange(bytes, 5, 9);
byte[] remoteInetAddress = Arrays.copyOfRange(bytes, 9, 13);
int localPort = HexUtils.byteArray2Int(Arrays.copyOfRange(bytes, 13, 17));
int serverPort = HexUtils.byteArray2Int(Arrays.copyOfRange(bytes, 17, 21));
int remotePort = HexUtils.byteArray2Int(Arrays.copyOfRange(bytes, 21, 25));
int dataSize = HexUtils.byteArray2Int(Arrays.copyOfRange(bytes, 25, FIX_LENGTH));
NDCMessageProtocol NDCMessageProtocol = new NDCMessageProtocol();
NDCMessageProtocol.setVersion(version);
NDCMessageProtocol.setType(type);
try {
NDCMessageProtocol.setLocalInetAddress(InetAddress.getByAddress(localInetAddress));
NDCMessageProtocol.setRemoteInetAddress(InetAddress.getByAddress(remoteInetAddress));
} catch (UnknownHostException e) {
throw new RuntimeException("UnknownHostException");
}
NDCMessageProtocol.setLocalPort(localPort);
NDCMessageProtocol.setServerPort(serverPort);
NDCMessageProtocol.setRemotePort(remotePort);
NDCMessageProtocol.setDataSize(dataSize);
return NDCMessageProtocol;
}
/**
* decode
*
* @param bytes
* @return
*/
public static NDCMessageProtocol parseTotal(byte[] bytes) {
NDCMessageProtocol NDCMessageProtocol = parseFixInfo(bytes);
byte[] data = Arrays.copyOfRange(bytes, FIX_LENGTH, FIX_LENGTH + NDCMessageProtocol.getDataSize());
NDCMessageProtocol.setDataWithVerification(data);
return NDCMessageProtocol;
}
/**
* need verification
* @param bytes
*/
public void setDataWithVerification(byte[] bytes) {
if (bytes.length < dataSize) {
throw new RuntimeException("broken data");
}
setData(bytes);
}
/**
* auto unpack
*
* @return
*/
public List<NDCMessageProtocol> autoUnpack() {
List<NDCMessageProtocol> ndcMessageProtocols = new ArrayList<>();
byte[] data = getData();
List<byte[]> list = ByteArrayUtils.bytesUnpack(data, AUTO_UNPACK_LENGTH);
list.forEach(x -> {
NDCMessageProtocol copy = copy();
copy.setData(x);
ndcMessageProtocols.add(copy);
});
return ndcMessageProtocols;
}
/**
* encode
*
* @return
*/
public byte[] toByteArray() {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
byteArrayOutputStream.write(MAGIC);//3 byte
byteArrayOutputStream.write(version);//1 byte -->4
byteArrayOutputStream.write(type);//1 byte -->5
byteArrayOutputStream.write(localInetAddress.getAddress());//4 byte -->9
byteArrayOutputStream.write(remoteInetAddress.getAddress());//4 byte -->13
byteArrayOutputStream.write(HexUtils.int2ByteArray(localPort));//4 byte -->17
byteArrayOutputStream.write(HexUtils.int2ByteArray(serverPort));//4 byte -->21
byteArrayOutputStream.write(HexUtils.int2ByteArray(remotePort));//4 byte -->25
dataSize = data.length;
if (dataSize > AUTO_UNPACK_LENGTH) {
throw new RuntimeException("too long data,need run autoUnpack()");
}
byteArrayOutputStream.write(HexUtils.int2ByteArray(dataSize));//4 byte -->29
byteArrayOutputStream.write(data);
} catch (IOException e) {
throw new RuntimeException(e);
}
return byteArrayOutputStream.toByteArray();
}
/**
* byte array to object
* @param tClass
* @param <T>
* @return
*/
public <T> T getObject(Class<T> tClass) {
byte[] data = getData();
if (data == null) {
throw new RuntimeException("byte empty");
}
T t = ObjectSerializableUtils.bytes2object(data, tClass);
return t;
}
/* --------------------------getter setter-------------------------- */
@Override
public String toString() {
return "NDCMessageProtocol{" +
"version=" + version +
", type=" + type +
", remoteInetAddress=" + remoteInetAddress +
", localInetAddress=" + localInetAddress +
", remotePort=" + remotePort +
", serverPort=" + serverPort +
", localPort=" + localPort +
", dataSize=" + dataSize +
'}';
}
public byte getVersion() {
return version;
}
public void setVersion(byte version) {
this.version = version;
}
public byte getType() {
return type;
}
public void setType(byte type) {
this.type = type;
}
public InetAddress getRemoteInetAddress() {
return remoteInetAddress;
}
public void setRemoteInetAddress(InetAddress remoteInetAddress) {
this.remoteInetAddress = remoteInetAddress;
}
public InetAddress getLocalInetAddress() {
return localInetAddress;
}
public void setLocalInetAddress(InetAddress localInetAddress) {
this.localInetAddress = localInetAddress;
}
public int getRemotePort() {
return remotePort;
}
public void setRemotePort(int remotePort) {
this.remotePort = remotePort;
}
public int getServerPort() {
return serverPort;
}
public void setServerPort(int serverPort) {
this.serverPort = serverPort;
}
public int getLocalPort() {
return localPort;
}
public void setLocalPort(int localPort) {
this.localPort = localPort;
}
public int getDataSize() {
return dataSize;
}
public void setDataSize(int dataSize) {
this.dataSize = dataSize;
}
public byte[] getData() {
return data;
}
public void setData(byte[] data) {
this.data = data;
}
}
| [
"30173268@qq.com"
] | 30173268@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.