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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3dbd0e4a2d3b47b887cc51811f0e6bc495408ba0 | c8fde0e9388e1c4bd537c17e4997941b767bc2ea | /src/main/java/discordbot/games/SlotMachine.java | 1df68b6630ec69fd4b148e070537a81eadd0caa6 | [] | no_license | R3T1CAL/DiscordBot | 47825bcd93ff5ceaea5b5c9ca54ce43e78d9aa83 | 4b8c6e114a7c7847fbc1a13a0773d6df22f048f2 | refs/heads/master | 2021-01-12T03:37:26.240886 | 2017-01-06T17:15:36 | 2017-01-06T17:15:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,792 | java | package discordbot.games;
import discordbot.games.slotmachine.Slot;
import discordbot.main.Config;
import java.util.Random;
public class SlotMachine {
public final static String emptySLotIcon = ":white_small_square:";
private final Random rng;
private final Slot[] slotOptions = Slot.values();
private final int wheels;
private final int[] results;
private int currentWheel;
public SlotMachine() {
rng = new Random();
wheels = 3;
currentWheel = 0;
results = new int[wheels];
}
public void spin() {
if (currentWheel < wheels) {
results[currentWheel] = rng.nextInt(slotOptions.length) + slotOptions.length;
currentWheel++;
}
}
/**
* Check if all
*
* @return the slot that won or null in case of lost
*/
public Slot winSlot() {
for (int i = 1; i < wheels; i++) {
if (results[i] != results[i - 1]) {
return null;
}
}
return slotOptions[results[0] % slotOptions.length];
}
public boolean gameInProgress() {
return wheels > currentWheel;
}
private String getIconForIndex(int i) {
if (i <= 0) {
return emptySLotIcon;
}
return slotOptions[i % slotOptions.length].getEmote();
}
@Override
public String toString() {
String table = "the slotmachine! " + Config.EOL;
String[] machineLine = new String[wheels];
for (int i = 0; i < wheels; i++) {
machineLine[i] = "";
}
int totalrows = 3;
for (int col = 0; col < wheels; col++) {
int offset = -1;
for (int row = 0; row < totalrows; row++) {
if (results[col] > 0) {
machineLine[row] += "|" + getIconForIndex(offset + results[col]);
} else {
machineLine[row] += "|" + getIconForIndex(results[col]);
}
offset++;
}
}
for (int i = 0; i < wheels; i++) {
table += machineLine[i] + "|" + Config.EOL;
}
return table;
}
}
| [
"maik_wezinkhof@hotmail.com"
] | maik_wezinkhof@hotmail.com |
d41d9e078055e7b3d15feb3b5186513de0c2312f | 8a23c7c6d4bde16ed8e2ce78f3fa11c7ed916da6 | /secao12_app_post/src/entities/Comment.java | d8a96f6e72a3fe81a19c52546899a3124a47db40 | [] | no_license | davialvs/curso-java-udemy | 9f43ac42266109ff34a8ac1f28a4aaf39cd0a391 | 9cf46877979986b9b0b966e195c659db22205f8d | refs/heads/main | 2023-03-29T20:55:30.592969 | 2021-04-05T03:52:22 | 2021-04-05T03:52:22 | 329,116,310 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | package entities;
public class Comment {
private String text;
public Comment() {
}
public Comment(String text) {
this.text = text;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}
| [
"72519831+davialvs@users.noreply.github.com"
] | 72519831+davialvs@users.noreply.github.com |
571ee09d0ffe57ca33a98faa01c6fef3111f931e | d206ddb732c07af3c1c5681d7379816d23963a21 | /payments/src/main/java/cn/armylife/payments/service/RedEnvelopesService.java | 565295c54846f044cd11ed37c64bdbad036efece | [] | no_license | sengeiou/Armylife | 68fc9e2c15f3103576289942670b5dee07cdda30 | cab3a6333d6f5ca0f54b648d2a5aa1f6556a04e9 | refs/heads/master | 2022-11-10T23:37:06.355400 | 2020-06-04T00:39:43 | 2020-06-04T00:39:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package cn.armylife.payments.service;
import cn.armylife.payments.domain.RedEnvelopes;
import java.util.List;
public interface RedEnvelopesService {
int insert(RedEnvelopes redEnvelopes);
int update(RedEnvelopes redEnvelopes);
RedEnvelopes selectRedForId(Long redId);
List<RedEnvelopes> selectRedForUser(Long userId);
int updateRedStatus(Long redId);
}
| [
"xuthus83@outlook.com"
] | xuthus83@outlook.com |
21d7a81bea3e341edaeb8aec7218dac2e7602c0c | 036f691bfa6cf2fea9884b74b3ee710eb6b502ab | /HistoriaMercado/src/mercado_test/CarrinhoTest.java | 7edcf9a7a5d7d8b12307a35c56805e25ef7fb5f1 | [] | no_license | lucianoacsilva/IMECursoTeste | f3285397e5339cef42d2731809f1a38e54f7f4af | d44c23973405711e7a5b3545f1a998f5ab6b48d4 | refs/heads/master | 2020-12-08T19:38:38.083416 | 2020-01-10T15:33:48 | 2020-01-10T15:33:48 | 233,076,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 957 | java | package mercado_test;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import mercado.Carrinho;
class CarrinhoTest {
static Carrinho carrinho;
@BeforeAll
static void oi() {
System.out.println("Iniciando teste!!");
}
@BeforeEach
void setup() {
carrinho = new Carrinho();
}
@Test
@DisplayName("Teste de desconto")
void descontoTest() {
assertEquals(90, carrinho.desconto(100));
assertEquals(160, carrinho.desconto(200));
assertEquals(225, carrinho.desconto(300));
assertEquals(280, carrinho.desconto(400));
}
@AfterEach
void sucesso() {
System.out.println("Teste realizado com sucesso!");
}
@AfterAll
static void tchau() {
System.out.println("Finalizando teste!!");
}
}
| [
"java.05@fred.cec.ime.usp.br"
] | java.05@fred.cec.ime.usp.br |
2de992658c295c9d723002a4a0db769281e70462 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/8/org/apache/commons/math3/util/MathArrays_equals_1133.java | 5ed86874c567a5fe5b9ea75b55d64b6a2b95996a | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 1,532 | java |
org apach common math3 util
arrai util
version
math arrai matharrai
return iff argument dimens
element equal defin
link precis equal
param arrai
param arrai
valu dimens
equal element
equal
length length
length
precis equal
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
1cb7e009f8ff8f345e67e84b465c88d0931df155 | 4ece50f5431f138092ba5d87f2b2bf95a1993c35 | /app/src/main/java/net/zxl/rxjava1test/Student.java | d8ea9a0e0334763fae54efdffa27efca5a28e46a | [] | no_license | primerToforget/Rxjava1Test | b9b6bc84805046a17e60e24e2243168160878565 | 9ddb7e7db4bcfe258fc6c76e7bff5d6e711e81dd | refs/heads/master | 2021-07-13T14:09:40.928913 | 2017-10-17T06:57:06 | 2017-10-17T06:57:06 | 107,068,482 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 677 | java | package net.zxl.rxjava1test;
import android.content.Context;
import java.util.List;
/**
* autour: Zxl
* date: 2017/10/16 16:20
* update: 2017/10/16
* email: zhuxinglong1992@qq.com
*/
public class Student {
public Student(String name,List<Course> course)
{
this.coures=course;
this.name=name;
}
private String name;
public List<Course> getCoures() {
return coures;
}
public void setCoures(List<Course> coures) {
this.coures = coures;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
private List<Course> coures;
}
| [
"zxl2@strongsoft.net"
] | zxl2@strongsoft.net |
3fab573e106e9e6c2d842d16c820ffb8fbc20b59 | 4305724b1b3441900dee0eb2009ac176ac7ecab0 | /src/main/java/com/thread/comparetoandlist/Detest.java | 75c7f46d9e61792193c6f90dc24394088944cdba | [] | no_license | liu92/spring_thread | 07fb5d67cbf958cb573d085ee8375adff3438ca8 | 42ed3e24f5856eebfb942bbfe49b54c21b71dec0 | refs/heads/master | 2022-12-21T03:07:51.523498 | 2020-04-27T07:32:10 | 2020-04-27T07:32:10 | 115,611,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,122 | java | package com.thread.comparetoandlist;
import java.util.List;
/**
* java类简单作用描述
* @ProjectName: Detest.java
* @Package: com.thread.comparetoandlist
* @ClassName: Detest
* @Description: java类作用描述
* @Author: 作者姓名
* @CreateDate: 2018/11/22 0022 17:49
* @UpdateUser: 作者姓名
* @UpdateDate: 2018/11/22 0022 17:49
* @UpdateRemark: The modified content
* @Version: 1.0
*/
public class Detest {
private String extParam;
private String name;
private String code;
private List<Deo> detos;
public String getExtParam() {
return extParam;
}
public void setExtParam(String extParam) {
this.extParam = extParam;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public List<Deo> getDetos() {
return detos;
}
public void setDetos(List<Deo> detos) {
this.detos = detos;
}
}
| [
"470437289@qq.com"
] | 470437289@qq.com |
dd9ef5786527d07d2c95aa07774573c8b89fae12 | d71e879b3517cf4fccde29f7bf82cff69856cfcd | /ExtractedJars/RT_News_com.rt.mobile.english/javafiles/com/google/android/exoplayer2/text/ttml/TtmlRenderUtil.java | 456a7563b229d78c918a931886ab8f28dbfde0eb | [
"MIT"
] | permissive | Andreas237/AndroidPolicyAutomation | b8e949e072d08cf6c6166c3f15c9c63379b8f6ce | c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a | refs/heads/master | 2020-04-10T02:14:08.789751 | 2019-05-16T19:29:11 | 2019-05-16T19:29:11 | 160,739,088 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 15,552 | java | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) annotate safe
package com.google.android.exoplayer2.text.ttml;
import android.text.SpannableStringBuilder;
import android.text.style.*;
import java.util.Map;
// Referenced classes of package com.google.android.exoplayer2.text.ttml:
// TtmlStyle
final class TtmlRenderUtil
{
private TtmlRenderUtil()
{
// 0 0:aload_0
// 1 1:invokespecial #8 <Method void Object()>
// 2 4:return
}
public static void applyStylesToSpan(SpannableStringBuilder spannablestringbuilder, int i, int j, TtmlStyle ttmlstyle)
{
if(ttmlstyle.getStyle() != -1)
//* 0 0:aload_3
//* 1 1:invokevirtual #17 <Method int TtmlStyle.getStyle()>
//* 2 4:iconst_m1
//* 3 5:icmpeq 27
spannablestringbuilder.setSpan(((Object) (new StyleSpan(ttmlstyle.getStyle()))), i, j, 33);
// 4 8:aload_0
// 5 9:new #19 <Class StyleSpan>
// 6 12:dup
// 7 13:aload_3
// 8 14:invokevirtual #17 <Method int TtmlStyle.getStyle()>
// 9 17:invokespecial #22 <Method void StyleSpan(int)>
// 10 20:iload_1
// 11 21:iload_2
// 12 22:bipush 33
// 13 24:invokevirtual #28 <Method void SpannableStringBuilder.setSpan(Object, int, int, int)>
if(ttmlstyle.isLinethrough())
//* 14 27:aload_3
//* 15 28:invokevirtual #32 <Method boolean TtmlStyle.isLinethrough()>
//* 16 31:ifeq 49
spannablestringbuilder.setSpan(((Object) (new StrikethroughSpan())), i, j, 33);
// 17 34:aload_0
// 18 35:new #34 <Class StrikethroughSpan>
// 19 38:dup
// 20 39:invokespecial #35 <Method void StrikethroughSpan()>
// 21 42:iload_1
// 22 43:iload_2
// 23 44:bipush 33
// 24 46:invokevirtual #28 <Method void SpannableStringBuilder.setSpan(Object, int, int, int)>
if(ttmlstyle.isUnderline())
//* 25 49:aload_3
//* 26 50:invokevirtual #38 <Method boolean TtmlStyle.isUnderline()>
//* 27 53:ifeq 71
spannablestringbuilder.setSpan(((Object) (new UnderlineSpan())), i, j, 33);
// 28 56:aload_0
// 29 57:new #40 <Class UnderlineSpan>
// 30 60:dup
// 31 61:invokespecial #41 <Method void UnderlineSpan()>
// 32 64:iload_1
// 33 65:iload_2
// 34 66:bipush 33
// 35 68:invokevirtual #28 <Method void SpannableStringBuilder.setSpan(Object, int, int, int)>
if(ttmlstyle.hasFontColor())
//* 36 71:aload_3
//* 37 72:invokevirtual #44 <Method boolean TtmlStyle.hasFontColor()>
//* 38 75:ifeq 97
spannablestringbuilder.setSpan(((Object) (new ForegroundColorSpan(ttmlstyle.getFontColor()))), i, j, 33);
// 39 78:aload_0
// 40 79:new #46 <Class ForegroundColorSpan>
// 41 82:dup
// 42 83:aload_3
// 43 84:invokevirtual #49 <Method int TtmlStyle.getFontColor()>
// 44 87:invokespecial #50 <Method void ForegroundColorSpan(int)>
// 45 90:iload_1
// 46 91:iload_2
// 47 92:bipush 33
// 48 94:invokevirtual #28 <Method void SpannableStringBuilder.setSpan(Object, int, int, int)>
if(ttmlstyle.hasBackgroundColor())
//* 49 97:aload_3
//* 50 98:invokevirtual #53 <Method boolean TtmlStyle.hasBackgroundColor()>
//* 51 101:ifeq 123
spannablestringbuilder.setSpan(((Object) (new BackgroundColorSpan(ttmlstyle.getBackgroundColor()))), i, j, 33);
// 52 104:aload_0
// 53 105:new #55 <Class BackgroundColorSpan>
// 54 108:dup
// 55 109:aload_3
// 56 110:invokevirtual #58 <Method int TtmlStyle.getBackgroundColor()>
// 57 113:invokespecial #59 <Method void BackgroundColorSpan(int)>
// 58 116:iload_1
// 59 117:iload_2
// 60 118:bipush 33
// 61 120:invokevirtual #28 <Method void SpannableStringBuilder.setSpan(Object, int, int, int)>
if(ttmlstyle.getFontFamily() != null)
//* 62 123:aload_3
//* 63 124:invokevirtual #63 <Method String TtmlStyle.getFontFamily()>
//* 64 127:ifnull 149
spannablestringbuilder.setSpan(((Object) (new TypefaceSpan(ttmlstyle.getFontFamily()))), i, j, 33);
// 65 130:aload_0
// 66 131:new #65 <Class TypefaceSpan>
// 67 134:dup
// 68 135:aload_3
// 69 136:invokevirtual #63 <Method String TtmlStyle.getFontFamily()>
// 70 139:invokespecial #68 <Method void TypefaceSpan(String)>
// 71 142:iload_1
// 72 143:iload_2
// 73 144:bipush 33
// 74 146:invokevirtual #28 <Method void SpannableStringBuilder.setSpan(Object, int, int, int)>
if(ttmlstyle.getTextAlign() != null)
//* 75 149:aload_3
//* 76 150:invokevirtual #72 <Method android.text.Layout$Alignment TtmlStyle.getTextAlign()>
//* 77 153:ifnull 175
spannablestringbuilder.setSpan(((Object) (new android.text.style.AlignmentSpan.Standard(ttmlstyle.getTextAlign()))), i, j, 33);
// 78 156:aload_0
// 79 157:new #74 <Class android.text.style.AlignmentSpan$Standard>
// 80 160:dup
// 81 161:aload_3
// 82 162:invokevirtual #72 <Method android.text.Layout$Alignment TtmlStyle.getTextAlign()>
// 83 165:invokespecial #77 <Method void android.text.style.AlignmentSpan$Standard(android.text.Layout$Alignment)>
// 84 168:iload_1
// 85 169:iload_2
// 86 170:bipush 33
// 87 172:invokevirtual #28 <Method void SpannableStringBuilder.setSpan(Object, int, int, int)>
switch(ttmlstyle.getFontSizeUnit())
//* 88 175:aload_3
//* 89 176:invokevirtual #80 <Method int TtmlStyle.getFontSizeUnit()>
{
//* 90 179:tableswitch 1 3: default 204
// 1 248
// 2 228
// 3 205
default:
return;
// 91 204:return
case 3: // '\003'
spannablestringbuilder.setSpan(((Object) (new RelativeSizeSpan(ttmlstyle.getFontSize() / 100F))), i, j, 33);
// 92 205:aload_0
// 93 206:new #82 <Class RelativeSizeSpan>
// 94 209:dup
// 95 210:aload_3
// 96 211:invokevirtual #86 <Method float TtmlStyle.getFontSize()>
// 97 214:ldc1 #87 <Float 100F>
// 98 216:fdiv
// 99 217:invokespecial #90 <Method void RelativeSizeSpan(float)>
// 100 220:iload_1
// 101 221:iload_2
// 102 222:bipush 33
// 103 224:invokevirtual #28 <Method void SpannableStringBuilder.setSpan(Object, int, int, int)>
return;
// 104 227:return
case 2: // '\002'
spannablestringbuilder.setSpan(((Object) (new RelativeSizeSpan(ttmlstyle.getFontSize()))), i, j, 33);
// 105 228:aload_0
// 106 229:new #82 <Class RelativeSizeSpan>
// 107 232:dup
// 108 233:aload_3
// 109 234:invokevirtual #86 <Method float TtmlStyle.getFontSize()>
// 110 237:invokespecial #90 <Method void RelativeSizeSpan(float)>
// 111 240:iload_1
// 112 241:iload_2
// 113 242:bipush 33
// 114 244:invokevirtual #28 <Method void SpannableStringBuilder.setSpan(Object, int, int, int)>
return;
// 115 247:return
case 1: // '\001'
spannablestringbuilder.setSpan(((Object) (new AbsoluteSizeSpan((int)ttmlstyle.getFontSize(), true))), i, j, 33);
// 116 248:aload_0
// 117 249:new #92 <Class AbsoluteSizeSpan>
// 118 252:dup
// 119 253:aload_3
// 120 254:invokevirtual #86 <Method float TtmlStyle.getFontSize()>
// 121 257:f2i
// 122 258:iconst_1
// 123 259:invokespecial #95 <Method void AbsoluteSizeSpan(int, boolean)>
// 124 262:iload_1
// 125 263:iload_2
// 126 264:bipush 33
// 127 266:invokevirtual #28 <Method void SpannableStringBuilder.setSpan(Object, int, int, int)>
return;
// 128 269:return
}
}
static String applyTextElementSpacePolicy(String s)
{
return s.replaceAll("\r\n", "\n").replaceAll(" *\n *", "\n").replaceAll("\n", " ").replaceAll("[ \t\\x0B\f\r]+", " ");
// 0 0:aload_0
// 1 1:ldc1 #99 <String "\r\n">
// 2 3:ldc1 #101 <String "\n">
// 3 5:invokevirtual #107 <Method String String.replaceAll(String, String)>
// 4 8:ldc1 #109 <String " *\n *">
// 5 10:ldc1 #101 <String "\n">
// 6 12:invokevirtual #107 <Method String String.replaceAll(String, String)>
// 7 15:ldc1 #101 <String "\n">
// 8 17:ldc1 #111 <String " ">
// 9 19:invokevirtual #107 <Method String String.replaceAll(String, String)>
// 10 22:ldc1 #113 <String "[ \t\\x0B\f\r]+">
// 11 24:ldc1 #111 <String " ">
// 12 26:invokevirtual #107 <Method String String.replaceAll(String, String)>
// 13 29:areturn
}
static void endParagraph(SpannableStringBuilder spannablestringbuilder)
{
int i;
for(i = spannablestringbuilder.length() - 1; i >= 0 && spannablestringbuilder.charAt(i) == ' '; i--);
// 0 0:aload_0
// 1 1:invokevirtual #118 <Method int SpannableStringBuilder.length()>
// 2 4:iconst_1
// 3 5:isub
// 4 6:istore_1
// 5 7:iload_1
// 6 8:iflt 28
// 7 11:aload_0
// 8 12:iload_1
// 9 13:invokevirtual #122 <Method char SpannableStringBuilder.charAt(int)>
// 10 16:bipush 32
// 11 18:icmpne 28
// 12 21:iload_1
// 13 22:iconst_1
// 14 23:isub
// 15 24:istore_1
//* 16 25:goto 7
if(i >= 0 && spannablestringbuilder.charAt(i) != '\n')
//* 17 28:iload_1
//* 18 29:iflt 49
//* 19 32:aload_0
//* 20 33:iload_1
//* 21 34:invokevirtual #122 <Method char SpannableStringBuilder.charAt(int)>
//* 22 37:bipush 10
//* 23 39:icmpeq 49
spannablestringbuilder.append('\n');
// 24 42:aload_0
// 25 43:bipush 10
// 26 45:invokevirtual #126 <Method SpannableStringBuilder SpannableStringBuilder.append(char)>
// 27 48:pop
// 28 49:return
}
public static TtmlStyle resolveStyle(TtmlStyle ttmlstyle, String as[], Map map)
{
if(ttmlstyle == null && as == null)
//* 0 0:aload_0
//* 1 1:ifnonnull 10
//* 2 4:aload_1
//* 3 5:ifnonnull 10
return null;
// 4 8:aconst_null
// 5 9:areturn
int k = 0;
// 6 10:iconst_0
// 7 11:istore 4
int i = 0;
// 8 13:iconst_0
// 9 14:istore_3
if(ttmlstyle == null && as.length == 1)
//* 10 15:aload_0
//* 11 16:ifnonnull 38
//* 12 19:aload_1
//* 13 20:arraylength
//* 14 21:iconst_1
//* 15 22:icmpne 38
return (TtmlStyle)map.get(((Object) (as[0])));
// 16 25:aload_2
// 17 26:aload_1
// 18 27:iconst_0
// 19 28:aaload
// 20 29:invokeinterface #134 <Method Object Map.get(Object)>
// 21 34:checkcast #13 <Class TtmlStyle>
// 22 37:areturn
if(ttmlstyle == null && as.length > 1)
//* 23 38:aload_0
//* 24 39:ifnonnull 92
//* 25 42:aload_1
//* 26 43:arraylength
//* 27 44:iconst_1
//* 28 45:icmple 92
{
ttmlstyle = new TtmlStyle();
// 29 48:new #13 <Class TtmlStyle>
// 30 51:dup
// 31 52:invokespecial #135 <Method void TtmlStyle()>
// 32 55:astore_0
for(k = as.length; i < k; i++)
//* 33 56:aload_1
//* 34 57:arraylength
//* 35 58:istore 4
//* 36 60:iload_3
//* 37 61:iload 4
//* 38 63:icmpge 90
ttmlstyle.chain((TtmlStyle)map.get(((Object) (as[i]))));
// 39 66:aload_0
// 40 67:aload_2
// 41 68:aload_1
// 42 69:iload_3
// 43 70:aaload
// 44 71:invokeinterface #134 <Method Object Map.get(Object)>
// 45 76:checkcast #13 <Class TtmlStyle>
// 46 79:invokevirtual #139 <Method TtmlStyle TtmlStyle.chain(TtmlStyle)>
// 47 82:pop
// 48 83:iload_3
// 49 84:iconst_1
// 50 85:iadd
// 51 86:istore_3
//* 52 87:goto 60
return ttmlstyle;
// 53 90:aload_0
// 54 91:areturn
}
if(ttmlstyle != null && as != null && as.length == 1)
//* 55 92:aload_0
//* 56 93:ifnull 123
//* 57 96:aload_1
//* 58 97:ifnull 123
//* 59 100:aload_1
//* 60 101:arraylength
//* 61 102:iconst_1
//* 62 103:icmpne 123
return ttmlstyle.chain((TtmlStyle)map.get(((Object) (as[0]))));
// 63 106:aload_0
// 64 107:aload_2
// 65 108:aload_1
// 66 109:iconst_0
// 67 110:aaload
// 68 111:invokeinterface #134 <Method Object Map.get(Object)>
// 69 116:checkcast #13 <Class TtmlStyle>
// 70 119:invokevirtual #139 <Method TtmlStyle TtmlStyle.chain(TtmlStyle)>
// 71 122:areturn
if(ttmlstyle != null && as != null && as.length > 1)
//* 72 123:aload_0
//* 73 124:ifnull 176
//* 74 127:aload_1
//* 75 128:ifnull 176
//* 76 131:aload_1
//* 77 132:arraylength
//* 78 133:iconst_1
//* 79 134:icmple 176
{
int l = as.length;
// 80 137:aload_1
// 81 138:arraylength
// 82 139:istore 5
for(int j = k; j < l; j++)
//* 83 141:iload 4
//* 84 143:istore_3
//* 85 144:iload_3
//* 86 145:iload 5
//* 87 147:icmpge 174
ttmlstyle.chain((TtmlStyle)map.get(((Object) (as[j]))));
// 88 150:aload_0
// 89 151:aload_2
// 90 152:aload_1
// 91 153:iload_3
// 92 154:aaload
// 93 155:invokeinterface #134 <Method Object Map.get(Object)>
// 94 160:checkcast #13 <Class TtmlStyle>
// 95 163:invokevirtual #139 <Method TtmlStyle TtmlStyle.chain(TtmlStyle)>
// 96 166:pop
// 97 167:iload_3
// 98 168:iconst_1
// 99 169:iadd
// 100 170:istore_3
//* 101 171:goto 144
return ttmlstyle;
// 102 174:aload_0
// 103 175:areturn
} else
{
return ttmlstyle;
// 104 176:aload_0
// 105 177:areturn
}
}
}
| [
"silenta237@gmail.com"
] | silenta237@gmail.com |
4fde736c6f743c666915795e0d633a5ec8e849d0 | d59659decc96ff98f3ac12eade4c211d743e7265 | /app/src/main/java/com/example/haoss/ui/person/integral/IntegralConvertRecordAty.java | 051c2ece5003c3cafd65333e4c7fa5335a5073d8 | [] | no_license | chentt521520/Hss_FuLi_full | 7a76b2fa78bc3f6776a2e81730a0276fdc5dcf95 | cf926c4bbe5065409b722348ae4285b72b4994bb | refs/heads/master | 2020-07-03T03:31:51.000165 | 2019-09-20T08:46:17 | 2019-09-20T08:46:17 | 201,770,085 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,071 | java | package com.example.haoss.ui.person.integral;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.ListView;
import com.example.applibrary.utils.DateTimeUtils;
import com.example.applibrary.utils.StringUtils;
import com.example.applibrary.widget.freshLoadView.RefreshLayout;
import com.example.applibrary.widget.freshLoadView.RefreshListenerAdapter;
import com.example.haoss.R;
import com.example.haoss.base.BaseActivity;
import java.util.ArrayList;
import java.util.List;
public class IntegralConvertRecordAty extends BaseActivity {
private RefreshLayout refreshLayout;
private ListIntegralConvertAdapter adapter;
private List<IntegralRecord> listData;
private int page = 1;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitleContentView(R.layout.activity_card_convert_record);
init();
getList();
}
private void init() {
listData = new ArrayList<>();
this.getTitleView().setTitleText("兑换记录");
ListView listView = findViewById(R.id.list_view);
refreshLayout = findViewById(R.id.refresh_layout);
refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {
@Override
public void onRefresh(RefreshLayout refreshLayout) {
super.onRefresh(refreshLayout);
page = 1;
getList();
}
@Override
public void onLoadMore(RefreshLayout refreshLayout) {
super.onLoadMore(refreshLayout);
page++;
getList();
}
});
adapter = new ListIntegralConvertAdapter(this, listData);
listView.setAdapter(adapter);
}
private void getList() {
// Map<String, Object> map = new HashMap<>();
// map.put("token", AppLibLication.getInstance().getToken());
// map.put("page", page);
// map.put("limit", 20);
//
// ApiManager.getIntegralConvertRecord("", map, new OnHttpCallback<List<IntegralRecord>>() {
// @Override
// public void success(List<IntegralRecord> result) {
List<IntegralRecord> result = new ArrayList<>();
long time = System.currentTimeMillis();
for (int i = 0; i < 10; i++) {
result.add(new IntegralRecord(DateTimeUtils.timeStampToDate(time + (i * 1000L)), "商品" + i, "", i, (int) (Math.random() * 1000) + ""));
}
refreshLayout.finishLoadmore();
refreshLayout.finishRefreshing();
if (page == 1) {
listData.clear();
}
if (!StringUtils.listIsEmpty(result)) {
listData.addAll(result);
}
adapter.refresh(listData);
}
// @Override
// public void error(int code, String msg) {
// refreshLayout.finishLoadmore();
// refreshLayout.finishRefreshing();
// toast(code, msg);
// }
// });
//}
}
| [
"15129858157@163.com"
] | 15129858157@163.com |
ee2b38100ba205f12c7f69dfbd5cf8e0b7f6305b | eef972e40459a278e8022a1a567358a37f6647a4 | /src/main/java/cn/itsmith/sysutils/resacl/entities/DomOwnerResA.java | dbc29f7570ae50e179cdeb50067b6f940478b095 | [] | no_license | 1562200285wxf/domain | ae422da1bdc191447c8957aa5cea4341533e598b | 5cc10c32d1f3c503761c41f07c74b57963cc2b1a | refs/heads/master | 2021-04-11T06:43:53.949805 | 2020-03-21T15:35:40 | 2020-03-21T15:35:40 | 249,000,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 166 | java | package cn.itsmith.sysutils.resacl.entities;
import lombok.Data;
@Data
public class DomOwnerResA {
Integer domId;
Integer resTypeId;
Integer ownerId;
}
| [
"email@example.com"
] | email@example.com |
9d9acf4db645dbd3de16a65fc73d1dc9cf46b574 | c8db78c0329ab107878b2d17245c4b22283a5f3d | /src/main/java/com/swjuyhz/sample/sparkstream/executor/SparkKafkaStreamExecutor.java | ed7a6d60b6fcb38b76e5b7f32bfef417cddfe31c | [] | no_license | jaeockjang/spari10 | 46c148bf0803227f64ed1c77241b46f1b15d01cd | 52532fb6875ee8c1a5cab254422d07188ccf590f | refs/heads/master | 2022-10-27T11:07:35.089954 | 2020-06-10T01:44:45 | 2020-06-10T01:44:45 | 271,143,688 | 0 | 0 | null | 2023-09-05T22:03:40 | 2020-06-10T01:06:00 | Java | UTF-8 | Java | false | false | 6,118 | java | package com.swjuyhz.sample.sparkstream.executor;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SaveMode;
import org.apache.spark.sql.SparkSession;
import org.apache.spark.streaming.Durations;
import org.apache.spark.streaming.api.java.JavaInputDStream;
import org.apache.spark.streaming.api.java.JavaPairInputDStream;
import org.apache.spark.streaming.api.java.JavaStreamingContext;
import org.apache.spark.streaming.kafka010.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import shapeless.record;
import java.io.Serializable;
import java.util.*;
@Component
public class SparkKafkaStreamExecutor implements Serializable,Runnable{
/**
*
*/
private static final long serialVersionUID = 1L;
private static final Logger log = LoggerFactory.getLogger(SparkKafkaStreamExecutor.class);
static final String path = "/home/jojang/dev/workspace/spark/data/";
@Value("${spark.stream.kafka.durations}")
private String streamDurationTime;
@Value("${kafka.broker.list}")
private String metadatabrokerlist;
@Value("${spark.kafka.topics}")
private String topicsAll;
@Autowired
private transient Gson gson;
private transient JavaStreamingContext jsc;
@Autowired
private transient JavaSparkContext javaSparkContext;
@Autowired
private SparkSession sparkSession;
@Override
public void run() {
startStreamTask();
}
public void startStreamTask() {
// System.setProperty("hadoop.home.dir", "D:\\hadoop-2.7.5");
Collection<String> topics = Arrays.asList("topic");
Map<String, Object> kafkaParams = new HashMap<>();
kafkaParams.put("metadata.broker.list", metadatabrokerlist);
kafkaParams.put("bootstrap.servers", "localhost:9092");
kafkaParams.put("key.deserializer", StringDeserializer.class);
kafkaParams.put("value.deserializer", StringDeserializer.class);
kafkaParams.put("group.id", "use_a_separate_group_id_for_each_stream");
kafkaParams.put("auto.offset.reset", "earliest");
kafkaParams.put("enable.auto.commit", true);
jsc = new JavaStreamingContext(javaSparkContext,
Durations.seconds(Integer.valueOf(streamDurationTime)));
jsc.checkpoint("checkpoint"); //保证元数据恢复,就是Driver端挂了之后数据仍然可以恢复
// 得到数据流
// final JavaPairInputDStream<String, String> stream = KafkaUtils.createDirectStream(jsc, f,
// String.class, StringDeserializer.class, StringDeserializer.class, kafkaParams, topics);
final JavaInputDStream<ConsumerRecord<String, String>> stream =
KafkaUtils.createDirectStream(
jsc,
LocationStrategies.PreferConsistent(),
ConsumerStrategies.<String, String>Subscribe( topics, kafkaParams)
);
System.out.println("stream started!");
stream.print();
stream.foreachRDD(rdd -> {
OffsetRange[] offsetRanges = ((HasOffsetRanges) rdd.rdd()).offsetRanges();
System.out.println( "rdd.count:" + rdd.count() );
});
stream.foreachRDD( x -> {
x.collect().forEach( (xx)-> { System.out.println("Kafka Received Data:" + xx.value()); });
x.collect().forEach( (xx)-> {
System.out.println("Kafka Received Data:" + xx.value());
List<KafkaData> data = Arrays.asList(new KafkaData(null, xx.value()));
Dataset<Row> dataFrame = sparkSession.createDataFrame(data, KafkaData.class);
dataFrame.createOrReplaceTempView("my_kafka");
Dataset<Row> sqlDS=sparkSession.sql("select * from my_kafka");
sqlDS.printSchema();
sqlDS.show();
});
});
stream.foreachRDD(x -> {
if (x.count() > 0) {
x.collect().forEach((xx) -> {
System.out.println("Kafka Received Data:" + xx.value());
});
List<KafkaData> data = new ArrayList<>();
x.collect().forEach(record -> {
data.add(new KafkaData(null, record.value()));
}
);
Dataset<Row> dataFrame = sparkSession.createDataFrame(data, KafkaData.class);
dataFrame.createOrReplaceTempView("my_kafka2");
Dataset<Row> sqlDS = sparkSession.sql("select * from my_kafka2");
sqlDS.printSchema();
sqlDS.show();
dataFrame.write().mode(SaveMode.Append).parquet(path + "my_kafka2.parquet");
}
});
// stream.foreachRDD ( rdd -> {
// rdd.foreach(record -> {
// String value = record.value();
// System.out.println("vvv:" + value);
// }
// );
// }
// );
// stream.foreachRDD(v -> {
//// //针对单篇文章流式处理
//// List<String> topicDatas = v.map(x-> (String)x.value()).collect();//优化点:不收集而是并发节点处理?
//// for (String topicData : topicDatas) {
//// List<Map<String, Object>> list = gson
//// .fromJson(topicData, new TypeToken<List<Map<String, String>>>() {}.getType());
//// list.parallelStream().forEach(m->{
//// //do something
//// System.out.println(m);
//// });
//// }
//// log.info("一批次数据流处理完: {}",topicDatas);
// });
// stream.foreachRDD(rdd -> {
// OffsetRange[] offsetRanges = ((HasOffsetRanges) rdd.rdd()).offsetRanges();
// System.out.println( "rdd.count:" + rdd.count() );
//// rdd.take(1).forEach(x -> System.out.println("value::::" + x.value()) );
// for (OffsetRange offsetRange : offsetRanges) {
// System.out.println("fromOffset:"+ offsetRange.fromOffset() );
// }
// });
;
//优化:为每个分区创建一个连接
// stream.foreachRDD(t->{
// t.foreachPartition(f->{
// while(f.hasNext()) {
// Map<String, Object> symbolLDAHandlered =LDAModelPpl
// .LDAHandlerOneArticle(sparkSession, SymbolAndNews.symbolHandlerOneArticle(sparkSession, f.next()._2));
// }
// });
// });
jsc.start();
}
public void destoryStreamTask() {
if(jsc!=null) {
jsc.stop();
}
}
}
| [
"jojang91@duam.net"
] | jojang91@duam.net |
0a83cf4dbb3a7b8fef8014b89dbfcb957c3a78d2 | 77bccd68393066e701ab0761a71320237382e689 | /pyramidscheme/src/main/java/uq/deco2800/pyramidscheme/controllers/TutModeController.java | 39e8bb5ffd1e7e54b4f83a518c571d194fab2d21 | [] | no_license | UQdeco2800/pyramidscheme | e6ff7e7d14a73f373a90bdb6dc08a7c4481f819e | 6711b0aeef147a2a4bd60eb5c4ff503264b26560 | refs/heads/master | 2021-01-11T12:30:16.507849 | 2017-01-18T12:20:37 | 2017-01-18T12:20:37 | 79,336,940 | 1 | 1 | null | 2022-05-02T07:31:48 | 2017-01-18T12:16:12 | Java | UTF-8 | Java | false | false | 726 | java | package uq.deco2800.pyramidscheme.controllers;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import uq.deco2800.pyramidscheme.game.GameManager;
import java.net.URL;
import java.util.ResourceBundle;
public class TutModeController implements Initializable {
@FXML
Button skipButton;
@FXML
Button nextButton1;
//
//skip button is used to go back to main menu
//next button1 is used to go to next green
public void initialize(URL arg0, ResourceBundle arg1) {
skipButton.setOnAction(event -> GameManager.changeScene("MenuScreen.fxml"));
nextButton1.setOnAction(event -> GameManager.changeScene("TutScreen2.fxml"));
}
}
| [
"milliemacdonald4@gmail.com"
] | milliemacdonald4@gmail.com |
91a118d8db0689727a00eda4426b0c61c4e9fba1 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/16/16_ff83e5f3a478388bd771b1257ba4a809e03257cc/LIFOInvocationDispatcher/16_ff83e5f3a478388bd771b1257ba4a809e03257cc_LIFOInvocationDispatcher_t.java | 3670590adf5e69fb29c48bc8a6498cb9d0850d38 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 2,245 | java | /* Copyright (c) 2000-2004 jMock.org
*/
package org.jmock.core;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.ListIterator;
import org.jmock.core.stub.TestFailureStub;
public class LIFOInvocationDispatcher
implements InvocationDispatcher
{
public static final String NO_EXPECTATIONS_MESSAGE = "No expectations set";
private ArrayList invokables = new ArrayList();
private Stub defaultStub = new TestFailureStub("unexpected invocation");
public Object dispatch( Invocation invocation ) throws Throwable {
ListIterator i = invokables.listIterator(invokables.size());
while (i.hasPrevious()) {
Invokable invokable = (Invokable)i.previous();
if (invokable.matches(invocation)) {
return invokable.invoke(invocation);
}
}
return defaultStub.invoke(invocation);
}
public void setDefaultStub( Stub defaultStub ) {
this.defaultStub = defaultStub;
}
public void add( Invokable invokable ) {
invokables.add(invokable);
}
public void verify() {
Iterator i = invokables.iterator();
while (i.hasNext()) {
((Verifiable)i.next()).verify();
}
}
public void clear() {
invokables.clear();
}
public StringBuffer describeTo( StringBuffer buffer ) {
if (anyInvokableHasDescription()) {
writeInvokablesTo(buffer);
} else {
buffer.append(NO_EXPECTATIONS_MESSAGE);
}
return buffer;
}
private void writeInvokablesTo( StringBuffer buffer ) {
Iterator iterator = invokables.iterator();
while (iterator.hasNext()) {
Invokable invokable = (Invokable)iterator.next();
if (invokable.hasDescription()) {
invokable.describeTo(buffer).append("\n");
}
}
}
private boolean anyInvokableHasDescription() {
Iterator iterator = invokables.iterator();
while (iterator.hasNext()) {
if (((Invokable)iterator.next()).hasDescription()) return true;
}
return false;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
f41c7bc26eac271cec5aacaff24ebad637d272e9 | 55b23ace5418c90a9810d2441870186d041235d8 | /src/main/java/echo/client/EchoClient.java | 432a0b99755c3ac075ebc0d51907722baf2eff6c | [] | no_license | janwee-sha/netty-in-action | 274aef0e32e1f26eba189a104b8dd95cf6b0f88d | 7a68523284035a03dbe9fab9e57a934439197c41 | refs/heads/master | 2023-03-12T10:09:34.985760 | 2021-02-16T09:54:10 | 2021-02-16T09:54:10 | 339,020,444 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,880 | java | package echo.client;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import java.net.InetSocketAddress;
public class EchoClient {
private final String host;
private final int port;
public EchoClient(String host, int port) {
this.host = host;
this.port = port;
}
public static void main(String[] args) throws Exception {
String host = "127.0.0.1";
int port = 9091;
new EchoClient(host, port).start();
}
public void start() throws Exception {
EventLoopGroup group = new NioEventLoopGroup();
try {
Bootstrap b = new Bootstrap();//创建Bootstrap
b.group(group)
.channel(NioSocketChannel.class)//适用于NIO传输的Channel类型
.remoteAddress(new InetSocketAddress(host, port))
.handler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel channel) throws Exception {
channel.pipeline().addLast(new EchoClientHandler());
}
});//在创建Channel时,向ChannelPipeline中添加一个EchoClientHandler实例
ChannelFuture cFuture = b.connect().sync();//阻塞等待连接完成
cFuture.addListener(future -> System.out.println("Connected successfully..."));
cFuture.channel().closeFuture().sync();//阻塞等待Channel关闭
} finally {
group.shutdownGracefully().sync();//关闭线程池并且释放所有的资源
}
}
}
| [
"janwee_sha@outlook.com"
] | janwee_sha@outlook.com |
169447aeec15c01f5f8260d630bb53f4e8c3729e | 11da93eea486fa9b98dba773162ce3bfcb02129e | /LinkedList.java | 806f1cc5a58e2b9ba20cce40d7ae7b33e4286269 | [] | no_license | dillonmabry/ArrayOrderedList-vs.-Array-of-LinkedLists | 1ef6b3a66d13113f8ba427d8bbfc000d52831c33 | 174bda395ac5b9559d8e016d9f3272ecebea2365 | refs/heads/master | 2020-04-20T01:07:25.456503 | 2015-09-15T02:01:57 | 2015-09-15T02:01:57 | 42,488,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,296 | java | /* Dillon Mabry
* 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 assignment3itcs2214mabrydillon;
import java.util.Iterator;
/**
*
*@author Dillon Mabry Lewis/Chase
*/
public class LinkedList<T> implements ListADT<T>
{
protected int count;
protected LinearNode<T> head, tail;
//===========================================================
// Creates an empty list.
//===========================================================
public LinkedList()
{
count = 0;
head = tail = null;
} // constructor List
//===========================================================
// Removes the first element in the list and returns a reference
// to it. Throws an EmptyListException if the list is empty.
//===========================================================
public T removeFirst() throws EmptyListException
{
if(count == 0) throw new EmptyCollectionException("In removing first element");
T result = head.getElement();
head = head.getNext();
count--;
if(count == 0)
tail = null;
return result;
} // method removeFirst
//===========================================================
// Removes the last element in the list and returns a reference
// to it. Throws an EmptyListException if the list is empty.
//===========================================================
public T removeLast() throws EmptyCollectionException
{
if(count == 0) throw new EmptyCollectionException("In removing last element");
T result = tail.getElement();
LinearNode<T> current = head;
while(current.getNext() != tail)
{
current = current.getNext();
}
tail = current;
current.setNext(null);
count--;
return result;
} // method removeLast
//===========================================================
// Removes the first instance of the specified element from the
// list if it is found in the list and returns a reference to it.
// Throws an EmptyListException if the list is empty. Throws a
// NoSuchElementException if the specified element is not found
// on the list.
//===========================================================
public T remove (T targetElement) throws
EmptyCollectionException, ElementNotFoundException
{
if (count == 0)
throw new EmptyCollectionException ("Trying to remove from an empty List");
boolean found = false;
LinearNode<T> previous = null;
LinearNode<T> current = head;
while (current != null && !found)
if (targetElement.equals (current.getElement()))
found = true;
else {
previous = current;
current = current.getNext();
}
if (!found)
throw new ElementNotFoundException ("In removing a target element");
if (count == 1)
head = tail = null;
else if (current.equals (head))
head = current.getNext();
else if (current.equals (tail))
{
tail = previous;
tail.setNext(null);
}
else
previous.setNext(current.getNext());
count--;
return current.getElement();
} // method remove
//===========================================================
// Finds the first instance of the specified element from the
// list if it is found in the list and returns true.
// Returns false otherwise
//===========================================================
public boolean contains (T targetElement)
{
boolean found = false;
LinearNode<T> current = head;
while (current != null && !found)
if (targetElement.equals (current.getElement()))
found = true;
else
{
current = current.getNext();
}
return found;
} // method contains
//===========================================================
// Returns true if the list is empty and false otherwise
//===========================================================
public boolean isEmpty()
{
return (count == 0);
}
//===========================================================
// Returns the number of elements in the list.
//===========================================================
public int size()
{
return count;
} // method size
//===========================================================
// Returns a string representation of the list.
//===========================================================
public String toString()
{
String result = "";
LinearNode<T> current = head;
while(current != null)
{
result += current.getElement()+ "\n";
current = current.getNext();
}
return result;
} // method toString
//===========================================================
// Returns ...
//===========================================================
public Iterator<T> iterator()
{
return new LinkedIterator(head,count);
} // method elements
//===========================================================
// Returns the first element of the list.
//===========================================================
public T first() throws EmptyListException
{
if(count == 0) throw new EmptyListException("In first");
return head.getElement();
} // method firstElement
//===========================================================
// Returns the last element of the list.
//===========================================================
public T last()
{
if(count == 0)
throw new EmptyCollectionException("Trying to examine last");
return tail.getElement();
} // class LinkedList
}
| [
"dcmabry@gmail.com"
] | dcmabry@gmail.com |
b70a4cb215de5c1d58f09932b77b10cddd32508a | f6a21a3f378fed0fb2939d69f8b9727d27bf344e | /SudokuLock/src/main/java/com/example/mummyding/sudokulock/SPUtil.java | 2f9641554ebc53d50c5deb0befcf52a1c24a2523 | [] | no_license | gm-jack/GithubApplication | 54b2639f215faebbbd8392389ce757ecc7b25e30 | f27ce9bed376ba516e38909ebb133065f5d22da4 | refs/heads/master | 2021-01-11T01:52:09.917506 | 2016-10-18T06:34:26 | 2016-10-18T06:34:26 | 70,653,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,138 | java | package com.example.mummyding.sudokulock;
import android.content.Context;
import android.content.SharedPreferences;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
/**
* SharedPreferences统一管理类
*/
public class SPUtil {
/**
* 保存在手机里面的文件名
*/
public static final String FILE_NAME = "share_data";
/**
* 保存数据的方法,我们需要拿到保存数据的具体类型,然后根据类型调用不同的保存方法
*
* @param context
* @param key
* @param object
*/
public static void put(Context context, String key, Object object) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
if (object instanceof String) {
editor.putString(key, (String) object);
} else if (object instanceof Integer) {
editor.putInt(key, (Integer) object);
} else if (object instanceof Boolean) {
editor.putBoolean(key, (Boolean) object);
} else if (object instanceof Float) {
editor.putFloat(key, (Float) object);
} else if (object instanceof Long) {
editor.putLong(key, (Long) object);
} else {
editor.putString(key, object.toString());
}
SharedPreferencesCompat.apply(editor);
}
/**
* 得到保存数据的方法,我们根据默认值得到保存的数据的具体类型,然后调用相对于的方法获取值
*
* @param context
* @param key
* @param defaultObject
* @return
*/
public static Object get(Context context, String key, Object defaultObject) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
if (defaultObject instanceof String) {
return sp.getString(key, (String) defaultObject);
} else if (defaultObject instanceof Integer) {
return sp.getInt(key, (Integer) defaultObject);
} else if (defaultObject instanceof Boolean) {
return sp.getBoolean(key, (Boolean) defaultObject);
} else if (defaultObject instanceof Float) {
return sp.getFloat(key, (Float) defaultObject);
} else if (defaultObject instanceof Long) {
return sp.getLong(key, (Long) defaultObject);
}
return null;
}
/**
* 移除某个key值已经对应的值
*
* @param context
* @param key
*/
public static void remove(Context context, String key) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.remove(key);
SharedPreferencesCompat.apply(editor);
}
/**
* 清除所有数据
*
* @param context
*/
public static void clear(Context context) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.clear();
SharedPreferencesCompat.apply(editor);
}
/**
* 查询某个key是否已经存在
*
* @param context
* @param key
* @return
*/
public static boolean contains(Context context, String key) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
return sp.contains(key);
}
/**
* 返回所有的键值对
*
* @param context
* @return
*/
public static Map<String, ?> getAll(Context context) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
return sp.getAll();
}
/**
* 创建一个解决SharedPreferencesCompat.apply方法的一个兼容类
*
* @author zhy
*/
private static class SharedPreferencesCompat {
private static final Method sApplyMethod = findApplyMethod();
/**
* 反射查找apply的方法
*
* @return
*/
@SuppressWarnings({"unchecked", "rawtypes"})
private static Method findApplyMethod() {
try {
Class clz = SharedPreferences.Editor.class;
return clz.getMethod("apply");
} catch (NoSuchMethodException e) {
}
return null;
}
/**
* 如果找到则使用apply执行,否则使用commit
*
* @param editor
*/
public static void apply(SharedPreferences.Editor editor) {
try {
if (sApplyMethod != null) {
sApplyMethod.invoke(editor);
return;
}
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
}
editor.commit();
}
}
} | [
"gaoming@rtmap.com"
] | gaoming@rtmap.com |
9c56bd21db19dfc68dd3d54734fa08878ea2077b | 65916e7536770fea3f60596f1699a7fae623f165 | /Practica/Practica3Semaphore/src/model/Hombre.java | 4c32abdffa97d2ba6dc2f56fd137d5d50b4cc76c | [] | no_license | chivasirre3/programacionconcurrente | 28bf64b937744df0a870bc1411038f04e0044836 | 44be9062ff7ce0ad184f10510c2c9341f4e33fb4 | refs/heads/master | 2021-01-10T13:04:04.793934 | 2012-06-16T00:27:30 | 2012-06-16T00:27:30 | 43,029,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 486 | java | package model;
public class Hombre extends Persona {
// Constructor
public Hombre(String nombre, Banio banio) {
this.setBanio(banio);
this.setNombre(nombre);
}
/**
* Entra al Ba�o y sale. Luego Duerme 1 Segundo y vuelve a intentar entrar
*/
@Override
public void run() {
while (true){
this.getBanio().ingresaAlBanioUnHombre();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
| [
"alejandromelo2005@gmail.com"
] | alejandromelo2005@gmail.com |
958fb279b9e05c080f3e79299a58610b174fece8 | f26708d9a1a987a6913ba7c64fe317bf6fb2042c | /src/main/java/codes/biscuit/skyblockaddons/utils/GuiFeatureData.java | 57e40dd656f8757d52d2c239ef7926405b0a969f | [
"MIT"
] | permissive | DidiSkywalker/SkyblockAddons | 0e9a5aa877de014178198153459b72bd20a62dc6 | 7bb17321e6ed9652bf0dc33104a7b9b2d501c195 | refs/heads/master | 2021-06-18T14:53:28.209634 | 2019-11-06T22:17:08 | 2019-11-06T22:17:08 | 201,264,589 | 0 | 0 | MIT | 2019-08-08T13:29:06 | 2019-08-08T13:29:06 | null | UTF-8 | Java | false | false | 1,531 | java | package codes.biscuit.skyblockaddons.utils;
class GuiFeatureData {
private ConfigColor defaultColor = null;
private CoordsPair defaultPos = null;
private CoordsPair defaultBarSize = null;
private EnumUtils.AnchorPoint defaultAnchor = null;
private EnumUtils.DrawType drawType = null;
GuiFeatureData(ConfigColor defaultColor) {
this.defaultColor = defaultColor;
}
GuiFeatureData(EnumUtils.DrawType drawType, ConfigColor defaultColor, EnumUtils.AnchorPoint defaultAnchor, int... positionThenSizes) {
this.drawType = drawType;
this.defaultColor = defaultColor;
this.defaultPos = new CoordsPair(positionThenSizes[0], positionThenSizes[1]);
if (positionThenSizes.length > 2) {
this.defaultBarSize = new CoordsPair(positionThenSizes[2], positionThenSizes[3]);
}
this.defaultAnchor = defaultAnchor;
}
GuiFeatureData(EnumUtils.DrawType drawType, EnumUtils.AnchorPoint defaultAnchor, int... position) {
this.drawType = drawType;
this.defaultAnchor = defaultAnchor;
this.defaultPos = new CoordsPair(position[0], position[1]);
}
ConfigColor getDefaultColor() {
return defaultColor;
}
EnumUtils.DrawType getDrawType() {
return drawType;
}
CoordsPair getDefaultPos() {
return defaultPos;
}
EnumUtils.AnchorPoint getDefaultAnchor() {
return defaultAnchor;
}
CoordsPair getDefaultBarSize() {
return defaultBarSize;
}
}
| [
"jlrochelle45@gmail.com"
] | jlrochelle45@gmail.com |
17ae9350366e6e7a08bdf4a06cfbeb99ab58cda3 | ab75b7e4597e1d402dc93c7885848905a13d41ce | /src/main/java/com/bluehoodie/midup/web/rest/errors/FieldErrorVM.java | ae4597dab46e8d7c2451a99ac00c4c1a6f3ab1c0 | [] | no_license | dgeorgiev06/midup-jhipster | 33b3da6a468e36fe96082453a59de8d5fbc26112 | 347ae881e6f83a5cfc1651fc2de369e279cbe14f | refs/heads/master | 2020-04-17T02:12:32.006726 | 2019-01-20T18:15:23 | 2019-01-20T18:15:23 | 166,124,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 652 | java | package com.bluehoodie.midup.web.rest.errors;
import java.io.Serializable;
public class FieldErrorVM implements Serializable {
private static final long serialVersionUID = 1L;
private final String objectName;
private final String field;
private final String message;
public FieldErrorVM(String dto, String field, String message) {
this.objectName = dto;
this.field = field;
this.message = message;
}
public String getObjectName() {
return objectName;
}
public String getField() {
return field;
}
public String getMessage() {
return message;
}
}
| [
"dgeorgiev06@gmail.com"
] | dgeorgiev06@gmail.com |
82d424a309cce27493076ef84fd274da7a70fc1c | 3b3b85fdf32acf360c719bc733d0593efd63c5e7 | /http/src/main/java/com/netty/http/server/HttpFileServer.java | 2b32743cfde6aa1025746158aeac440e0d7ee968 | [] | no_license | feixiangshenhua/netty-hello | 3be0aec71363fbe5bd571524fab43b4d260b31f7 | e4354f058e08c8845b5e5ed8bf3035b7f18f24e3 | refs/heads/master | 2021-01-10T11:28:18.480117 | 2016-04-11T15:52:44 | 2016-04-11T15:52:44 | 55,852,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,781 | java | package com.netty.http.server;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.HttpRequestDecoder;
import io.netty.handler.codec.http.HttpResponseEncoder;
import io.netty.handler.stream.ChunkedWriteHandler;
/**
* HTTP文件服务器
* Created by xiaoyun on 2016/3/30.
*/
public class HttpFileServer {
private static final String DEFAULT_URL = "/";
public void run(final int port, final String url) throws Exception {
EventLoopGroup bossGroup = new NioEventLoopGroup();
EventLoopGroup workerGroup = new NioEventLoopGroup();
try {
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childHandler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch) throws Exception {
// 将ByteBuf包装为HttpRequest
ch.pipeline().addLast("http-decoder", new HttpRequestDecoder());
// 将多个消息转换为单一的FullHttpRequest或者FullHttpResponse
ch.pipeline().addLast("http-aggregator", new HttpObjectAggregator(65536));
// 对http响应进行编码
ch.pipeline().addLast("http-encoder", new HttpResponseEncoder());
// 支持异步发送大的码流,但不占用过多的内存,防止发生Java内存溢出
ch.pipeline().addLast("http-chunked", new ChunkedWriteHandler());
ch.pipeline().addLast("fileServerHandler", new HttpFileServerHandler(url));
}
});
ChannelFuture future = b.bind("127.0.0.1", port).sync();
if(future.isSuccess()) {
System.out.println("HTTP 文件目录服务器启动,网址是:http://127.0.0.1:" + port + url);
}
future.channel().closeFuture().sync();
} finally {
// 优雅退出,释放线程池资源
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
}
public static void main(String[] args) throws Exception{
int port = 8080;
new HttpFileServer().run(port, DEFAULT_URL);
}
}
| [
"391720181@qq.com"
] | 391720181@qq.com |
4a8a9474630ee2798f238d95fdd1a650ca06fe63 | 69336c81f7a99885224e6580cca7611ee953d71b | /OIM-user/src/main/java/io/openindoormap/OIMUserApplication.java | 203098390605c17cc39236fb80ee3e537ead0dfb | [
"Apache-2.0"
] | permissive | Gaia3D/openindoormap | 7ffed6b801bbb4db60bea3d525711279f40fcc6f | c386a31773e6d3c5ee48d23ed36a9836130f8140 | refs/heads/develop | 2022-03-09T21:40:57.385324 | 2021-11-24T05:05:09 | 2021-11-24T05:05:09 | 130,036,374 | 6 | 2 | Apache-2.0 | 2022-02-24T01:32:00 | 2018-04-18T09:15:47 | JavaScript | UTF-8 | Java | false | false | 2,131 | java | package io.openindoormap;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import io.openindoormap.filter.XSSFilter;
import io.openindoormap.listener.OIMHttpSessionBindingListener;
import javax.servlet.http.HttpSessionBindingListener;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@SpringBootApplication
public class OIMUserApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(OIMUserApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(OIMUserApplication.class);
}
@Bean
public FilterRegistrationBean<XSSFilter> xSSFilter() {
FilterRegistrationBean<XSSFilter> registrationBean = new FilterRegistrationBean<>(new XSSFilter());
List<String> urls = getUrlList();
registrationBean.setUrlPatterns(urls);
//registrationBean.addUrlPatterns(/*);
return registrationBean;
}
@Bean
public HttpSessionBindingListener httpSessionBindingListener() {
log.info(" $$$ OIMUserApplication registerListener $$$ ");
return new OIMHttpSessionBindingListener();
}
private List<String> getUrlList() {
List<String> urls = new ArrayList<>();
urls.add("/search/*");
urls.add("/data/*");
urls.add("/datas/*");
urls.add("/upload-data/*");
urls.add("/upload-datas/*");
urls.add("/converter/*");
urls.add("/converters/*");
urls.add("/data/*");
urls.add("/datas/*");
urls.add("/data-adjust-log/*");
urls.add("/data-adjust-logs/*");
urls.add("/data-log/*");
urls.add("/data-logs/*");
urls.add("/issues/*");
urls.add("/map/*");
urls.add("/searchmap/*");
urls.add("/layer/*");
urls.add("/user-policy/*");
return urls;
}
} | [
"hskim@gaia3d.com"
] | hskim@gaia3d.com |
fbfd7a8827f20bee66bb57869016c6afc6c8454e | 86b4ff3277d690000dfa65caf34e8f46a7b56202 | /JSP_Pjt_Sonjh/src/vo/InvoiceVO.java | c598ee3cd77fda1978cfb3655abb46cf75a1a055 | [] | no_license | sonstick/JSP_Pjt_Sonjh | 0e08a2d35cc7be93b3bfcc2737a26835c1f07268 | c4b5cd6df6ed35f901dfed196d1afeba4060bfa0 | refs/heads/master | 2020-04-17T17:18:31.433703 | 2019-01-23T13:01:25 | 2019-01-23T13:01:25 | 166,727,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,217 | java | package vo;
import java.sql.Timestamp;
public class InvoiceVO {
private int no;
private String name;
private String pwd;
private String subject;
private String content;
private int readCnt;
private String cmt;
private Timestamp reg_date;
public int getNo() {
return no;
}
public void setNo(int no) {
this.no = no;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public int getReadCnt() {
return readCnt;
}
public void setReadCnt(int readCnt) {
this.readCnt = readCnt;
}
public Timestamp getReg_date() {
return reg_date;
}
public void setReg_date(Timestamp reg_date) {
this.reg_date = reg_date;
}
public String getCmt() {
return cmt;
}
public void setCmt(String cmt) {
this.cmt = cmt;
}
} | [
"sonstick@sondows"
] | sonstick@sondows |
c7d4dd578035473af3f61b60c31924443bdb123e | ee99459a6136364d6398f9ed790cac31ee1befa7 | /mybatis-test/src/main/java/com/ako/example/mybatis/SexTypeHandler.java | 1b5bae31bfe3ed37bffa563c8a70dacbe4ac3bb3 | [] | no_license | yhqairqq/javaexample | 4c76b8047575eafd9d46f71ef9d8b90dbe99cec9 | 3c7517e8e39ee55c233cf8051fd7c9d1b79dd36b | refs/heads/master | 2021-04-12T10:12:56.781270 | 2018-08-15T09:43:50 | 2018-08-15T09:43:50 | 94,528,376 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,548 | java | package com.ako.example.mybatis;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Created by yanghuanqing@wdai.com on 2018/7/30.
*/
public class SexTypeHandler extends BaseTypeHandler<SexEnum> {
@Override
public void setNonNullParameter(PreparedStatement ps, int i, SexEnum parameter, JdbcType jdbcType) throws SQLException {
ps.setString(i,parameter.getSexDec());
}
@Override
public SexEnum getNullableResult(ResultSet rs, String columnName) throws SQLException {
for(SexEnum sex:SexEnum.values()){
if(sex.getSexDec().equals(rs.getString(columnName))){
return sex;
}
}
return SexEnum.values()[0];
}
@Override
public SexEnum getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
for(SexEnum sex:SexEnum.values()){
if(sex.getSexDec().equals(rs.getString(columnIndex))){
return sex;
}
}
return SexEnum.values()[0];
}
@Override
public SexEnum getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
for(SexEnum sex:SexEnum.values()){
if(sex.getSexDec().equals(cs.getString(columnIndex))){
return sex;
}
}
return SexEnum.values()[0];
}
}
| [
"304187514@qq.com"
] | 304187514@qq.com |
ef354c8e9e2ca47a95f5225e551dc9ff54de7ec2 | 2de257be8dc9ffc70dd28988e7a9f1b64519b360 | /tags/rds-0.26/src/datascript/emit/java/UnionEmitter.java | 8e8085393a41ee0eac98fd1f2b8c55c4c63ceed0 | [] | no_license | MichalLeonBorsuk/datascript-svn | f141e5573a1728b006a13a0852a5ebb0495177f8 | 8a89530c50cdfde43696eb7309767d45979e2f40 | refs/heads/master | 2020-04-13T03:11:45.133544 | 2010-04-06T13:04:03 | 2010-04-06T13:04:03 | 162,924,533 | 0 | 1 | null | 2018-12-23T21:18:53 | 2018-12-23T21:18:52 | null | UTF-8 | Java | false | false | 5,508 | java | /* BSD License
*
* Copyright (c) 2006, Harald Wellmann, Henrik Wedekind Harman/Becker Automotive Systems
* All rights reserved.
*
* This software is derived from previous work
* Copyright (c) 2003, Godmar Back.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* * Neither the name of Harman/Becker Automotive Systems or
* Godmar Back nor the names of their contributors may be used to
* endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package datascript.emit.java;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import datascript.antlr.util.ToolContext;
import datascript.ast.CompoundType;
import datascript.ast.DataScriptException;
import datascript.ast.Field;
import datascript.ast.FunctionType;
import datascript.ast.Parameter;
import datascript.ast.UnionType;
import freemarker.template.Configuration;
import freemarker.template.Template;
public class UnionEmitter extends CompoundEmitter
{
private final List<CompoundFunctionEmitter> functions =
new ArrayList<CompoundFunctionEmitter>();
private final List<UnionFieldEmitter> fields =
new ArrayList<UnionFieldEmitter>();
private UnionType union;
public static class UnionFieldEmitter extends FieldEmitter
{
private static Template tpl = null;
public UnionFieldEmitter(Field f, CompoundEmitter j)
{
super(f, j);
}
@Override
public void emit(PrintWriter pw, Configuration cfg) throws Exception
{
if (tpl == null)
tpl = cfg.getTemplate("java/UnionFieldAccessor.ftl");
tpl.process(this, pw);
}
public String getCheckerName()
{
return AccessorNameEmitter.getCheckerName(field);
}
public String getText()
{
return field.toString();
}
}
public UnionEmitter(JavaDefaultEmitter j, UnionType union)
{
super(j);
this.union = union;
}
public UnionType getUnionType()
{
return union;
}
@Override
public CompoundType getCompoundType()
{
return union;
}
public void begin(Configuration cfg)
{
fields.clear();
for (Field field : union.getFields())
{
if (field.getAlignment() != null)
ToolContext.logError(field, "align is not allowed in union");
UnionFieldEmitter fe = new UnionFieldEmitter(field, this);
fields.add(fe);
}
params.clear();
for (Parameter param : union.getParameters())
{
CompoundParameterEmitter p = new CompoundParameterEmitter(param, this);
params.add(p);
}
functions.clear();
for (FunctionType func : union.getFunctions())
{
CompoundFunctionEmitter f = new CompoundFunctionEmitter(func);
functions.add(f);
}
try
{
Template tpl = cfg.getTemplate("java/UnionBegin.ftl");
tpl.process(this, writer);
for (UnionFieldEmitter field : fields)
{
field.emit(writer, cfg);
}
for (CompoundParameterEmitter param : params)
{
param.emit(writer, cfg);
}
for (CompoundFunctionEmitter func : functions)
{
func.emit(writer, cfg);
}
tpl = cfg.getTemplate("java/UnionRead.ftl");
tpl.process(this, writer);
tpl = cfg.getTemplate("java/UnionWrite.ftl");
tpl.process(this, writer);
}
catch (Exception e)
{
throw new DataScriptException(e);
}
}
public void end(Configuration cfg)
{
try
{
Template tpl = cfg.getTemplate("java/SequenceEnd.ftl");
tpl.process(this, writer);
}
catch (Exception e)
{
throw new DataScriptException(e);
}
}
public List<UnionFieldEmitter> getFields()
{
return fields;
}
}
| [
"hwellmann@7eccfe4a-4f19-0410-86c7-be9599f3b344"
] | hwellmann@7eccfe4a-4f19-0410-86c7-be9599f3b344 |
4b11a5f47ca5ced3c9da9e8495ba67fdbfc10a34 | 5122a4619b344c36bfc969283076c12419f198ea | /src/test/java/com/snapwiz/selenium/tests/staf/learningspaces/testcases/IT9/R1/LTILSAndAdptiveLoginWithResourceLinkIdblank.java | 87cbea9101ac79556beb7a26b45a95c9528a34af | [] | no_license | mukesh89m/automation | 0c1e8ff4e38e8e371cc121e64aacc6dc91915d3a | a0b4c939204af946cf7ca7954097660b2a0dfa8d | refs/heads/master | 2020-05-18T15:30:22.681006 | 2018-06-09T15:14:11 | 2018-06-09T15:14:11 | 32,666,214 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 992 | java | package com.snapwiz.selenium.tests.staf.learningspaces.testcases.IT9.R1;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import com.snapwiz.selenium.tests.staf.learningspaces.Driver;
import com.snapwiz.selenium.tests.staf.learningspaces.apphelper.LoginUsingLTI;
import com.snapwiz.selenium.tests.staf.learningspaces.uihelper.BooleanValue;
/*
* 21
*/
public class LTILSAndAdptiveLoginWithResourceLinkIdblank extends Driver{
@Test
public void ltiLSAndAdptiveLoginWithResourceLinkIdblank()
{
try
{
new LoginUsingLTI().ltiLogin("21");
boolean dashboard=new BooleanValue().booleanbyclass("ls-dashboard-container");
if(dashboard==false)
Assert.fail("User still lands in Dashboard with Resource Link id left blank during LTILogin.");
}
catch(Exception e)
{
Assert.fail("Exception in TestCase ltiLSAndAdptiveLoginWithResourceLinkIdblank in class LTILSAndAdptiveLoginWithResourceLinkIdblank. ", e);
}
}
}
| [
"mukesh.mandal@github.com"
] | mukesh.mandal@github.com |
2fecf747470c4ae09d0541bc96ded02475b1f5c0 | 8fe86d41925f3355fdfa33a22d9fc16c9c3cc195 | /src/main/java/com/zyp/erp/controller/back/SysPasswordController.java | 10fbde256628e9fbcdfed0e450d476fde64c5de3 | [] | no_license | zhangYaPeng/erp | 5f8586d3c174dde0a0e64530feeeef6a8e50364c | 786f39c85583ce489ffbc1e9d4e6b627fcb5e7b9 | refs/heads/master | 2022-12-21T05:17:11.577932 | 2019-06-16T09:24:05 | 2019-06-16T09:24:05 | 165,013,291 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,003 | java | package com.zyp.erp.controller.back;
import com.zyp.erp.dao.SysUserMapper;
import com.zyp.erp.domain.SysUser;
import com.zyp.erp.utils.PasswordUtil;
import com.zyp.erp.utils.login.LoginUser;
import com.zyp.erp.utils.login.UserContext;
import com.zyp.erp.utils.response.ResponseObject;
import com.zyp.erp.utils.response.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
@Controller
@RequestMapping("/back/password")
public class SysPasswordController {
@Autowired
private SysUserMapper sysUserMapper;
@RequestMapping("/view/update")
public String updateView(Model model) {
return "password/update";
}
@ResponseBody
@PostMapping("/ajax/update")
public ResponseObject updateAjax(@RequestParam String oldPassword, @RequestParam String newPassword,
HttpServletResponse response) {
LoginUser loginUser = UserContext.get();
SysUser user = sysUserMapper.selectByPrimaryKey(loginUser.getId().intValue());
String userName = user.getUserName();
String dbPassword = user.getPassword();
if ( PasswordUtil.verifyPassword(oldPassword, userName, dbPassword) ) {
String pwd = PasswordUtil.encryptPassword(newPassword, userName);
SysUser updateObject = new SysUser();
updateObject.setId(loginUser.getId().intValue());
updateObject.setPassword(pwd);
sysUserMapper.updateByPrimaryKeySelective(updateObject);
return ResponseUtil.getOK();
}
return ResponseUtil.getError("旧密码不正确");
}
}
| [
"btdxcgcool@163.com"
] | btdxcgcool@163.com |
051c9f1fa794ea309d1a5b5c5ea368509eb660fc | b8398336a317cef9e56d3d9982e4ce7a2d9734d1 | /src/Main.java | 6217b658e7fd03f72ca4992dde5844122ccff1a2 | [] | no_license | NachoOlivero/actividad8AyC | 5887a3dc7d24230d621dba40c4c56e8dadc0a08f | 1fcc4d9115234c957cf3e426ebc6d35dde21036a | refs/heads/main | 2023-05-02T03:47:57.716130 | 2021-05-31T23:51:46 | 2021-05-31T23:51:46 | 370,387,661 | 0 | 1 | null | 2021-05-24T21:05:36 | 2021-05-24T14:51:02 | Java | UTF-8 | Java | false | false | 3,344 | java | import java.util.Random;
public class Main {
private static final int MAX_VALUE = 1000000000;
public static void main(String[] args) {
int check = 4;
switch (check) {
case 1: check1(); break;
case 2: check2(); break;
case 3: check3(); break;
case 4: check4(); break;
}
}
private static void check1() { // para ver si dan los mismo
int cantPuntos = 2000;
Punto[] arr = new Punto[cantPuntos];
Random random = new Random();
double distanciaMinimaNaive = 0;
double distanciaMinimaOrdX = 0;
double distanciaMinimaOrdXY = 0;
while(true) {
do {
for(int i=0;i<cantPuntos;i++)
arr[i] = new Punto(random.nextInt(MAX_VALUE + 1),random.nextInt(MAX_VALUE + 1));
distanciaMinimaNaive = Distancias.distanciaNaive(arr);
distanciaMinimaOrdX = Distancias.distanciaOrdX(arr);
distanciaMinimaOrdXY = Distancias.distanciaOrdXY(arr);
}
while(distanciaMinimaNaive == distanciaMinimaOrdX && distanciaMinimaNaive == distanciaMinimaOrdXY );
System.out.println("Distancia minima algoritmo naive: " + distanciaMinimaNaive);
System.out.println("Distancia minima ordenados por x: " + distanciaMinimaOrdX);
System.out.println("Distancia minima ordenados por x e y: " + distanciaMinimaOrdXY + "\n");
}
}
private static void check2() { // para ver cuanto tardan
//int cantPuntos = (int) Math.pow(2, 13);
int cantPuntos = (int) Math.pow(2, 20);
Punto[] arr = new Punto[cantPuntos];
Random random = new Random();
for(int i=0;i<cantPuntos;i++)
arr[i] = new Punto(random.nextInt(MAX_VALUE + 1),random.nextInt(MAX_VALUE + 1));
long startTime = System.currentTimeMillis();
double distanciaMinimaOrdXY = Distancias.distanciaOrdXY(arr);
long endTime = System.currentTimeMillis();
System.out.println("Distancia minima ordenados por x e y: " + distanciaMinimaOrdXY + " Tiempo: " + (endTime-startTime));
startTime = System.currentTimeMillis();
double distanciaMinimaOrdX = Distancias.distanciaOrdX(arr);
endTime = System.currentTimeMillis();
System.out.println("Distancia minima ordenados por x: " + distanciaMinimaOrdX + " Tiempo: " + (endTime-startTime));
if(cantPuntos == (int) Math.pow(2, 13)) {
startTime = System.currentTimeMillis();
double distanciaMinimaNaive = Distancias.distanciaNaive(arr);
endTime = System.currentTimeMillis();
System.out.println("Distancia minima algoritmo naive: " + distanciaMinimaNaive + " Tiempo: " + (endTime-startTime));
}
}
private static void check3() { // para ver si los ordenaba bien
Random random = new Random();
int cantPuntos = 100;
Punto[] arr = new Punto[cantPuntos];
for(int i=0;i<cantPuntos;i++)
arr[i] = new Punto(random.nextInt(MAX_VALUE + 1),random.nextInt(MAX_VALUE + 1));
Distancias.ordenarPorY(arr);
for(int i=0;i<cantPuntos;i++)
System.out.println("X: " + arr[i].getX() + " Y: " + arr[i].getY() + " I: " + i);
}
private static void check4() { // para ver los tiempos promedio para las cantidades de puntos
double [][] r = Benchmarks.benchmarkNaive();
//double [][] r = Benchmarks.benchmarkOrdX();
//double [][] r = Benchmarks.benchmarkOrdXY();
int cantPuntos = Benchmarks.N_NAIVE;
//int cantPuntos = Benchmarks.N_ORD;
for(int i=0;i<cantPuntos;i++)
System.out.println((int)r[i][0]+" "+r[i][1]);
}
}
| [
"54416746+NachoOlivero@users.noreply.github.com"
] | 54416746+NachoOlivero@users.noreply.github.com |
67f2dd8b8aa7bb2102099dda117a502f94aafec0 | 8b4f30926eef1d7832ab666e27b6fe615d8604fd | /src/main/java/org/librairy/service/nlp/client/SpotlightClient.java | 0c4e75883d0a3aace965975fcc60f8f9db6aa0e2 | [
"Apache-2.0"
] | permissive | librairy/nlpES-service | 3dfb0888e992eb4f60971d56a3ce7b1080cec85d | 5f07f08ee1059595ce9d4e817372e689d903f679 | refs/heads/master | 2021-05-12T14:05:37.348728 | 2019-03-12T23:55:37 | 2019-03-12T23:55:37 | 116,943,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,499 | java | package org.librairy.service.nlp.client;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author Badenes Olmedo, Carlos <cbadenes@fi.upm.es>
*/
public class SpotlightClient {
private static final Logger LOG = LoggerFactory.getLogger(SpotlightClient.class);
private final CloseableHttpClient httpclient;
public SpotlightClient() {
this.httpclient = HttpClients.createDefault();
}
public Document request(String url, Map<String,String> parameters) throws Exception{
Document doc = null;
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpPost.setHeader("Accept", "text/xml");
List<NameValuePair> params = parameters.entrySet().stream().map(entry -> new BasicNameValuePair(entry.getKey(), entry.getValue())).collect(Collectors.toList());
httpPost.setEntity(new UrlEncodedFormEntity(params));
String xml = request(httpPost);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource is = new InputSource(new StringReader(xml));
Document document = builder.parse(is);
return document;
}
public String request(HttpUriRequest method) throws Exception
{
String xml ="";
CloseableHttpResponse response = null;
try {
response = httpclient.execute(method);
// Execute the method.
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK)
{
LOG.error("Method failed: " + response.getStatusLine());
}
// Read the response body.
// // Deal with the response.
// // Use caution: ensure correct character encoding and is not binary data
HttpEntity entity2 = response.getEntity();
// do something useful with the response body
// and ensure it is fully consumed
InputStream responseBody = entity2.getContent();
xml = IOUtils.toString(responseBody, "UTF-8");
EntityUtils.consume(entity2);
} catch (IOException e)
{
LOG.error("Fatal transport error: " + e.getMessage());
throw new Exception("Transport error executing HTTP request.", e);
}
finally
{
// Release the connection.
if (response != null) response.close();
}
return xml;
}
}
| [
"cbadenes@gmail.com"
] | cbadenes@gmail.com |
2feddadc8bbb6dd2a387504911add15bec378211 | d4a23fc879d295059676ccd39c94c135275cdada | /src/main/java/com/nfwork/dbfound/web/file/FileDownloadUtil.java | 7f998675f37633b9c1b78b4f02f56281ab73ad00 | [] | no_license | scokaven/dbfound | 3812b72151fc3b75aa1038f7b3a46947916c0cab | 11b54255490b84033416f12243a3d663d71d6d22 | refs/heads/master | 2020-09-22T19:46:47.836838 | 2019-11-23T15:09:04 | 2019-11-23T15:09:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,657 | java | package com.nfwork.dbfound.web.file;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.Map;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import com.nfwork.dbfound.exception.ParamNotFoundException;
import com.nfwork.dbfound.model.bean.Param;
import com.nfwork.dbfound.util.LogUtil;
import com.nfwork.dbfound.web.WebWriter;
public class FileDownloadUtil {
public static void download(Param p, Map<String, Param> params,
HttpServletResponse response) {
String nameParamName = p.getFileNameParam();
if (nameParamName == null) {
nameParamName = p.getName() + "_name";
}
Param nameParam = params.get(nameParamName);
if (nameParam == null) {
throw new ParamNotFoundException("nameParam: " + nameParamName
+ " 没有定义");
}
String filename = nameParam.getStringValue();
if (filename == null || "".equals(filename)) {
filename = "download.data";
}
if (p.getValue() == null) {
WebWriter.jsonWriter(response, "<font color='#e51212'>系统未找到下载文件路径!<a href='JavaScript:history.back();'>返回</a>");
return;
}
File file = null;
Object object = p.getValue();
if (object instanceof File) {
file = (File)object;
}else {
file = new File(FileUtil.getDownLoadFolder(p.getStringValue()));
}
if (file.exists()) {
try {
filename = URLEncoder.encode(filename, "utf-8");
response.setContentType("application/x-download;");
response.setHeader("Content-Disposition",
"attachment;filename=" + filename);
ServletOutputStream sout = response.getOutputStream(); // 图片输出的输出流
InputStream in = new FileInputStream(file);
try {
if (in != null) {
byte b[] = new byte[2048];
int i = in.read(b);
while (i != -1) {
sout.write(b, 0, i);
i = in.read(b);
}
}
} finally {
if (in != null) {
in.close();
}
if (sout != null) {
sout.flush(); // 输入完毕,清除缓冲
sout.close();
}
}
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
} finally {
if ("db".equals(p.getFileSaveType())
&& p.getStringValue().endsWith(".dbf")) {
file.delete();
}
}
} else {
WebWriter.jsonWriter(response, "文件:<font color='#e51212'>"
+ filename + "</font>,不存在! "
+ " <a href='JavaScript:history.back();'>返回</a>");
LogUtil.warn("文件:" + file.getAbsolutePath() + ",不存在");
}
}
}
| [
"nfwork@163.com"
] | nfwork@163.com |
ea40d62080e52f19b81d3d69d1a00b26b36751a6 | 82510f4978993812fa70a74230ba19621f03e107 | /src/main/java/com/aalhabib01/xyz/BloodDonationBackend/SpringFoxConfig.java | 9dfc45f11dc8d773a292e3b8437b4bb33341e23e | [] | no_license | aalhabib001/Blood-Donation-Backend | 9f5b7f76fce8f282253b4abc53ad7ded08822820 | da2004ccb58a1aaf379c9015a5a221f5fe66d07d | refs/heads/master | 2023-02-05T09:01:34.106969 | 2020-12-26T06:41:19 | 2020-12-26T06:41:19 | 315,462,698 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,872 | java | package com.aalhabib01.xyz.BloodDonationBackend;
import com.google.common.base.Predicates;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.Collections;
@Configuration
@EnableSwagger2
public class SpringFoxConfig {
Parameter authHeader = new ParameterBuilder()
.parameterType("header")
.name("Authorization")
.modelRef(new ModelRef("string"))
.build();
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.paths(Predicates.not(PathSelectors.regex("/error.*")))
.build()
.apiInfo(metaData())
.globalOperationParameters(Collections.singletonList(authHeader));
}
private ApiInfo metaData() {
ApiInfo apiInfo = new ApiInfo(
"Blood-Donation-Backend Spring Boot REST API",
"Spring Boot REST API for Blood-Donation-Backend",
"1.1",
"Terms of service",
"Abdullah AL Habib",
"Apache License Version 2.0",
"https://www.apache.org/licenses/LICENSE-2.0");
return apiInfo;
}
} | [
"aalhabib001@gmail.com"
] | aalhabib001@gmail.com |
846b6b6b623d2ba5864561ac83d6f7c538b0d37e | 5407d127f6f7570e0dc87ea0b3f661468b99014d | /src/main/java/duke/task/Deadline.java | d1dba058e14a77a2558afbbaa23267c2fcf8a057 | [] | no_license | Ma-Yueran/ip | dec07455d64d21145aedccf3b7d800d82162da6f | 9aba9493b384f7d188651b31ee4fabfd1361d802 | refs/heads/master | 2022-12-19T06:46:20.566902 | 2020-09-18T11:03:12 | 2020-09-18T11:03:12 | 288,386,050 | 0 | 0 | null | 2020-09-09T09:32:09 | 2020-08-18T07:29:07 | Java | UTF-8 | Java | false | false | 1,774 | java | package duke.task;
import duke.exception.EmptyTimeException;
import duke.exception.ExceptionMessage;
import duke.exception.IncorrectFormatException;
import duke.time.Time;
import duke.ui.UiPrint;
/**
* A Deadline is a task with a deadline. Deadline objects store both task
* description and deadline time.
*/
public class Deadline extends Task {
private Deadline(String icon, String description, String deadline, String taskInfo) {
super(icon, description, taskInfo);
setTime(Time.stringToTime(deadline));
}
@Override
public String getTaskType() {
return "deadline";
}
/**
* Creates a Deadline using a string with task info,
* throws exceptions when the string has wrong format.
* @param deadlineInfo the string of task info
* @return the Deadline object created
*/
public static Deadline createDeadline(String deadlineInfo) {
String[] splitStr = deadlineInfo.split(" /by ", 2);
checkException(splitStr);
String description = splitStr[0];
String deadline = splitStr[1];
Deadline newDeadline = new Deadline(UiPrint.DEADLINE_ICON, description, deadline, deadlineInfo);
return newDeadline;
}
private static void checkException(String[] splitStr) {
if (splitStr.length != 2) {
String errMessage = ExceptionMessage.DEADLINE_INCORRECT_FORMAT_MESSAGE;
throw new IncorrectFormatException(errMessage);
}
if (splitStr[1].isBlank()) {
String errMessage = ExceptionMessage.EMPTY_TIME_MESSAGE;
throw new EmptyTimeException(errMessage);
}
}
@Override
public String toString() {
return super.toString() + " (by: " + getTime() + ")";
}
}
| [
"mayuerantom@outlook.com"
] | mayuerantom@outlook.com |
0af7aa1f90e6476abb8c2e1e36727bd69fa6f0cd | 4465dbf695c62f06cc2c9e1438f894d5ce233292 | /random/src/test/java/ga/rugal/amazon/maximumareaofapieceofcakeafterhorizontalandverticalcuts/SolutionTest.java | 75efa033181a4cd96759fd05fa9c6bebf22b5da9 | [] | no_license | Rugal/algorithm | d7e12d802fee56f96533f18c84ed097bf64db34e | 130aba9c156af73cab4b971e59f56909b01cb908 | refs/heads/master | 2023-09-04T04:30:47.571420 | 2023-08-26T06:13:51 | 2023-08-26T06:13:51 | 49,036,223 | 10 | 4 | null | null | null | null | UTF-8 | Java | false | false | 957 | java | package ga.rugal.amazon.maximumareaofapieceofcakeafterhorizontalandverticalcuts;
import java.util.stream.Stream;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
public class SolutionTest {
private final Solution solution = new Solution();
static Stream<Arguments> source() {
return Stream.of(
Arguments.of(5, 4, new int[]{1, 2, 4}, new int[]{1, 3}, 4),
Arguments.of(5, 4, new int[]{3, 1}, new int[]{1}, 6)
);
}
@ParameterizedTest
@MethodSource("source")
public void maxArea(final int h,
final int w,
final int[] horizontalCuts,
final int[] verticalCuts,
final int expected) {
Assertions.assertEquals(expected, this.solution.maxArea(h, w, horizontalCuts, verticalCuts));
}
}
| [
"rugal.bernstein.0@gmail.com"
] | rugal.bernstein.0@gmail.com |
1859fb8f326ded29b2a104f66f443a0b46735d9d | 35038685b133a084fd2c1ce3b7f73fac7ed8033f | /app/src/main/java/com/example/jobtest/UI/MainActivity.java | 4296895f77f7c14855d4b5920a337453d6b24b32 | [] | no_license | MhmodElsadany/JobTesting | 5d2cde0b2a2a2d03b522bdc91bca7e4aab474ca1 | 4deaeed7f5b2c1552af4055191323ed4e7b56c46 | refs/heads/master | 2020-12-22T12:47:23.311048 | 2020-01-29T23:01:45 | 2020-01-29T23:01:45 | 236,786,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,528 | java | package com.example.jobtest.UI;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.Toast;
import com.example.jobtest.Adapter.CustomAdapterParent;
import com.example.jobtest.ViewModel.DetailViewModel;
import com.example.jobtest.Model.HomeBodyResponse;
import com.example.jobtest.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import butterknife.BindView;
import butterknife.ButterKnife;
public class MainActivity extends AppCompatActivity {
@BindView(R.id.home)
ImageView home;
@BindView(R.id.search)
ImageView search;
@BindView(R.id.profile)
ImageView profile;
@BindView(R.id.cup)
ImageView cup;
@BindView(R.id.fab_1)
FloatingActionButton fab_1;
@BindView(R.id.fab_2)
FloatingActionButton fab_2;
@BindView(R.id.fab_3)
FloatingActionButton fab_3;
@BindView(R.id.fab_4)
FloatingActionButton fab_4;
@BindView(R.id.fab)
ImageView bellman;
@BindView(R.id.rv_parent)
RecyclerView recyclerView;
boolean flag = false;
DetailViewModel model;
CustomAdapterParent mCustomAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
recyclerView.setLayoutManager(new GridLayoutManager(this, 1));
model = ViewModelProviders.of(this).get(DetailViewModel.class);
model.getResult(this).observe(this, new Observer<HomeBodyResponse>() {
@Override
public void onChanged(@Nullable HomeBodyResponse s) {
mCustomAdapter = new CustomAdapterParent(MainActivity.this, s);
recyclerView.setAdapter(mCustomAdapter);
}
});
bellman.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (flag == false) {
showAnim();
} else {
hideAnim();
}
}
});
home.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
home.setImageResource(getResources().getIdentifier("home_bottom_icon", "drawable", getPackageName()));
search.setImageResource(getResources().getIdentifier("search_grey_bottom_icon", "drawable", getPackageName()));
profile.setImageResource(getResources().getIdentifier("profile_grey_bottom_icon", "drawable", getPackageName()));
cup.setImageResource(getResources().getIdentifier("notification_grey_bottom_icon", "drawable", getPackageName()));
}
});
search.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
home.setImageResource(getResources().getIdentifier("home_grey_bottom_icon", "drawable", getPackageName()));
search.setImageResource(getResources().getIdentifier("search_bottom_icon", "drawable", getPackageName()));
profile.setImageResource(getResources().getIdentifier("profile_grey_bottom_icon", "drawable", getPackageName()));
cup.setImageResource(getResources().getIdentifier("notification_grey_bottom_icon", "drawable", getPackageName()));
}
});
profile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
home.setImageResource(getResources().getIdentifier("home_grey_bottom_icon", "drawable", getPackageName()));
search.setImageResource(getResources().getIdentifier("search_grey_bottom_icon", "drawable", getPackageName()));
profile.setImageResource(getResources().getIdentifier("profile_bottom_icon", "drawable", getPackageName()));
cup.setImageResource(getResources().getIdentifier("notification_grey_bottom_icon", "drawable", getPackageName()));
}
});
cup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
home.setImageResource(getResources().getIdentifier("home_grey_bottom_icon", "drawable", getPackageName()));
search.setImageResource(getResources().getIdentifier("search_grey_bottom_icon", "drawable", getPackageName()));
profile.setImageResource(getResources().getIdentifier("profile_grey_bottom_icon", "drawable", getPackageName()));
cup.setImageResource(getResources().getIdentifier("notification_bottom_icon", "drawable", getPackageName()));
}
});
}
public void showAnim() {
Animation show_fab_1 = AnimationUtils.loadAnimation(getApplication(), R.anim.inside_show1);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) fab_1.getLayoutParams();
layoutParams.rightMargin += (int) (fab_1.getWidth() * 1.7);
layoutParams.bottomMargin += (int) (fab_1.getHeight() * 0.25);
fab_1.setLayoutParams(layoutParams);
fab_1.startAnimation(show_fab_1);
fab_1.setClickable(true);
Animation show_fab_2 = AnimationUtils.loadAnimation(getApplication(), R.anim.inside_show1);
FrameLayout.LayoutParams layoutParamst = (FrameLayout.LayoutParams) fab_2.getLayoutParams();
layoutParamst.rightMargin += (int) (fab_2.getWidth() * 1.7);
layoutParamst.bottomMargin += (int) (fab_2.getHeight() * 0.25);
fab_2.setLayoutParams(layoutParamst);
fab_2.startAnimation(show_fab_2);
fab_2.setClickable(true);
FrameLayout.LayoutParams layoutParams3 = (FrameLayout.LayoutParams) fab_3.getLayoutParams();
layoutParams3.rightMargin += (int) (fab_3.getWidth() * 1.7);
layoutParams3.bottomMargin += (int) (fab_3.getHeight() * 0.25);
fab_3.setLayoutParams(layoutParams3);
fab_3.startAnimation(show_fab_1);
fab_3.setClickable(true);
FrameLayout.LayoutParams layoutParams4 = (FrameLayout.LayoutParams) fab_4.getLayoutParams();
layoutParams4.rightMargin += (int) (fab_3.getWidth() * 1.7);
layoutParams4.bottomMargin += (int) (fab_3.getHeight() * 0.25);
fab_4.setLayoutParams(layoutParams4);
fab_4.startAnimation(show_fab_1);
fab_4.setClickable(true);
flag = true;
}
public void hideAnim() {
Animation hide_fab_1 = AnimationUtils.loadAnimation(getApplication(), R.anim.inside_hide1);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) fab_1.getLayoutParams();
layoutParams.rightMargin -= (int) (fab_1.getWidth() * 1.7);
layoutParams.bottomMargin -= (int) (fab_1.getHeight() * 0.25);
fab_1.setLayoutParams(layoutParams);
fab_1.startAnimation(hide_fab_1);
fab_1.setClickable(false);
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) fab_2.getLayoutParams();
layoutParams2.rightMargin -= (int) (fab_2.getWidth() * 1.7);
layoutParams2.bottomMargin -= (int) (fab_2.getHeight() * 0.25);
fab_2.setLayoutParams(layoutParams2);
fab_2.startAnimation(hide_fab_1);
fab_2.setClickable(false);
FrameLayout.LayoutParams layoutParams3 = (FrameLayout.LayoutParams) fab_3.getLayoutParams();
layoutParams3.rightMargin -= (int) (fab_3.getWidth() * 1.7);
layoutParams3.bottomMargin -= (int) (fab_3.getHeight() * 0.25);
fab_3.setLayoutParams(layoutParams3);
fab_3.startAnimation(hide_fab_1);
fab_3.setClickable(false);
FrameLayout.LayoutParams layoutParams4 = (FrameLayout.LayoutParams) fab_4.getLayoutParams();
layoutParams4.rightMargin -= (int) (fab_4.getWidth() * 1.7);
layoutParams4.bottomMargin -= (int) (fab_4.getHeight() * 0.25);
fab_4.setLayoutParams(layoutParams4);
fab_4.startAnimation(hide_fab_1);
fab_4.setClickable(false);
flag = false;
}
} | [
"mahmoudelsadany81@yahoo.com"
] | mahmoudelsadany81@yahoo.com |
15b4433313e7831e7b4a7aa35eaa429f3aef1d64 | 4688d19282b2b3b46fc7911d5d67eac0e87bbe24 | /aws-java-sdk-xray/src/main/java/com/amazonaws/services/xray/model/BackendConnectionErrors.java | d97717b9207a666633ae1ae3b5ee72356b8d97bd | [
"Apache-2.0"
] | permissive | emilva/aws-sdk-java | c123009b816963a8dc86469405b7e687602579ba | 8fdbdbacdb289fdc0ede057015722b8f7a0d89dc | refs/heads/master | 2021-05-13T17:39:35.101322 | 2018-12-12T13:11:42 | 2018-12-12T13:11:42 | 116,821,450 | 1 | 0 | Apache-2.0 | 2018-09-19T04:17:41 | 2018-01-09T13:45:39 | Java | UTF-8 | Java | false | false | 9,726 | java | /*
* Copyright 2012-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.xray.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p/>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/xray-2016-04-12/BackendConnectionErrors" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class BackendConnectionErrors implements Serializable, Cloneable, StructuredPojo {
/** <p/> */
private Integer timeoutCount;
/** <p/> */
private Integer connectionRefusedCount;
/** <p/> */
private Integer hTTPCode4XXCount;
/** <p/> */
private Integer hTTPCode5XXCount;
/** <p/> */
private Integer unknownHostCount;
/** <p/> */
private Integer otherCount;
/**
* <p/>
*
* @param timeoutCount
*/
public void setTimeoutCount(Integer timeoutCount) {
this.timeoutCount = timeoutCount;
}
/**
* <p/>
*
* @return
*/
public Integer getTimeoutCount() {
return this.timeoutCount;
}
/**
* <p/>
*
* @param timeoutCount
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackendConnectionErrors withTimeoutCount(Integer timeoutCount) {
setTimeoutCount(timeoutCount);
return this;
}
/**
* <p/>
*
* @param connectionRefusedCount
*/
public void setConnectionRefusedCount(Integer connectionRefusedCount) {
this.connectionRefusedCount = connectionRefusedCount;
}
/**
* <p/>
*
* @return
*/
public Integer getConnectionRefusedCount() {
return this.connectionRefusedCount;
}
/**
* <p/>
*
* @param connectionRefusedCount
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackendConnectionErrors withConnectionRefusedCount(Integer connectionRefusedCount) {
setConnectionRefusedCount(connectionRefusedCount);
return this;
}
/**
* <p/>
*
* @param hTTPCode4XXCount
*/
public void setHTTPCode4XXCount(Integer hTTPCode4XXCount) {
this.hTTPCode4XXCount = hTTPCode4XXCount;
}
/**
* <p/>
*
* @return
*/
public Integer getHTTPCode4XXCount() {
return this.hTTPCode4XXCount;
}
/**
* <p/>
*
* @param hTTPCode4XXCount
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackendConnectionErrors withHTTPCode4XXCount(Integer hTTPCode4XXCount) {
setHTTPCode4XXCount(hTTPCode4XXCount);
return this;
}
/**
* <p/>
*
* @param hTTPCode5XXCount
*/
public void setHTTPCode5XXCount(Integer hTTPCode5XXCount) {
this.hTTPCode5XXCount = hTTPCode5XXCount;
}
/**
* <p/>
*
* @return
*/
public Integer getHTTPCode5XXCount() {
return this.hTTPCode5XXCount;
}
/**
* <p/>
*
* @param hTTPCode5XXCount
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackendConnectionErrors withHTTPCode5XXCount(Integer hTTPCode5XXCount) {
setHTTPCode5XXCount(hTTPCode5XXCount);
return this;
}
/**
* <p/>
*
* @param unknownHostCount
*/
public void setUnknownHostCount(Integer unknownHostCount) {
this.unknownHostCount = unknownHostCount;
}
/**
* <p/>
*
* @return
*/
public Integer getUnknownHostCount() {
return this.unknownHostCount;
}
/**
* <p/>
*
* @param unknownHostCount
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackendConnectionErrors withUnknownHostCount(Integer unknownHostCount) {
setUnknownHostCount(unknownHostCount);
return this;
}
/**
* <p/>
*
* @param otherCount
*/
public void setOtherCount(Integer otherCount) {
this.otherCount = otherCount;
}
/**
* <p/>
*
* @return
*/
public Integer getOtherCount() {
return this.otherCount;
}
/**
* <p/>
*
* @param otherCount
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BackendConnectionErrors withOtherCount(Integer otherCount) {
setOtherCount(otherCount);
return this;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getTimeoutCount() != null)
sb.append("TimeoutCount: ").append(getTimeoutCount()).append(",");
if (getConnectionRefusedCount() != null)
sb.append("ConnectionRefusedCount: ").append(getConnectionRefusedCount()).append(",");
if (getHTTPCode4XXCount() != null)
sb.append("HTTPCode4XXCount: ").append(getHTTPCode4XXCount()).append(",");
if (getHTTPCode5XXCount() != null)
sb.append("HTTPCode5XXCount: ").append(getHTTPCode5XXCount()).append(",");
if (getUnknownHostCount() != null)
sb.append("UnknownHostCount: ").append(getUnknownHostCount()).append(",");
if (getOtherCount() != null)
sb.append("OtherCount: ").append(getOtherCount());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof BackendConnectionErrors == false)
return false;
BackendConnectionErrors other = (BackendConnectionErrors) obj;
if (other.getTimeoutCount() == null ^ this.getTimeoutCount() == null)
return false;
if (other.getTimeoutCount() != null && other.getTimeoutCount().equals(this.getTimeoutCount()) == false)
return false;
if (other.getConnectionRefusedCount() == null ^ this.getConnectionRefusedCount() == null)
return false;
if (other.getConnectionRefusedCount() != null && other.getConnectionRefusedCount().equals(this.getConnectionRefusedCount()) == false)
return false;
if (other.getHTTPCode4XXCount() == null ^ this.getHTTPCode4XXCount() == null)
return false;
if (other.getHTTPCode4XXCount() != null && other.getHTTPCode4XXCount().equals(this.getHTTPCode4XXCount()) == false)
return false;
if (other.getHTTPCode5XXCount() == null ^ this.getHTTPCode5XXCount() == null)
return false;
if (other.getHTTPCode5XXCount() != null && other.getHTTPCode5XXCount().equals(this.getHTTPCode5XXCount()) == false)
return false;
if (other.getUnknownHostCount() == null ^ this.getUnknownHostCount() == null)
return false;
if (other.getUnknownHostCount() != null && other.getUnknownHostCount().equals(this.getUnknownHostCount()) == false)
return false;
if (other.getOtherCount() == null ^ this.getOtherCount() == null)
return false;
if (other.getOtherCount() != null && other.getOtherCount().equals(this.getOtherCount()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getTimeoutCount() == null) ? 0 : getTimeoutCount().hashCode());
hashCode = prime * hashCode + ((getConnectionRefusedCount() == null) ? 0 : getConnectionRefusedCount().hashCode());
hashCode = prime * hashCode + ((getHTTPCode4XXCount() == null) ? 0 : getHTTPCode4XXCount().hashCode());
hashCode = prime * hashCode + ((getHTTPCode5XXCount() == null) ? 0 : getHTTPCode5XXCount().hashCode());
hashCode = prime * hashCode + ((getUnknownHostCount() == null) ? 0 : getUnknownHostCount().hashCode());
hashCode = prime * hashCode + ((getOtherCount() == null) ? 0 : getOtherCount().hashCode());
return hashCode;
}
@Override
public BackendConnectionErrors clone() {
try {
return (BackendConnectionErrors) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.xray.model.transform.BackendConnectionErrorsMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| [
""
] | |
89b68db54649fcef4e5921272dc9d950041bae7a | 379e5d82ae358722987cb08638431af0a3858366 | /src/main/java/org/dhis2/data_element_rest/services/UserService.java | 880b14c803461ab1d281e7ec43f64596296c2874 | [] | no_license | d-bernat/dhis2 | 383464121377aa5d81ddab1225b0baf16b97c65d | 68fd38e1e2f388eee33f412fea44cc3a342f930c | refs/heads/master | 2023-02-24T04:21:32.803578 | 2021-01-27T07:19:24 | 2021-01-27T07:19:24 | 322,940,401 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | package org.dhis2.data_element_rest.services;
import org.dhis2.data_element_rest.domain.User;
import java.util.List;
public interface UserService
{
List<User> getAllUsers();
User getUserByName(String username);
}
| [
"mail@it-bernat.de"
] | mail@it-bernat.de |
d844477dab975d6b057c17b854735d8f25727765 | 92b3924d47c4c40da3ffdf0e7418e23fdc5635e5 | /src/test/java/pages/Page_FlightFinder.java | 8f7969c5c144ea47e61a5e9bfd2836c78bb56e42 | [] | no_license | angel4th/seleniumTasks | 7b9b71459a7e2c7c8897cd506202c486b2ae27b1 | 38e8ab63c81b16555ba2bfb13063e169df58dc0c | refs/heads/master | 2020-04-02T06:35:33.186691 | 2018-10-24T17:51:33 | 2018-10-24T17:51:33 | 154,158,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,582 | java | package pages;
import config.DriverFactory;
import webElements.Elements_FlightFinder;
import helpers.Functions;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
import org.testng.annotations.Test;
import java.util.concurrent.TimeUnit;
public class Page_FlightFinder extends DriverFactory {
//WebDriver driver;
Functions function = new Functions();//You can call functions
Elements_FlightFinder flightFinder = new Elements_FlightFinder(driver);//The webElements on flight finder web page
public Page_FlightFinder(WebDriver driver){
this.driver = driver;
PageFactory.initElements(driver, this);
}
//This function fill the blank with the information about the flight
@Test
public void fillFlight(){
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
function.selectClickOption(flightFinder.rbtnTypeOneWay);
function.selectIndexOption(flightFinder.passengersDrop, 0);
function.selectIndexOption(flightFinder.fromPortDrop, 3);
function.selectIndexOption(flightFinder.fromMonthDrop, 3);
function.selectIndexOption(flightFinder.fromDayDrop,5);
function.selectIndexOption(flightFinder.toPortDrop,3);
function.selectIndexOption(flightFinder.toMonthDrop,3);
function.selectIndexOption(flightFinder.toDayDrop,5);
function.selectClickOption(flightFinder.serviceClassBtn);
function.selectIndexOption(flightFinder.airlineDrop,2);
function.selectClickOption(flightFinder.btnContinue);
}
}
| [
"angel.4thsource@gmail.com"
] | angel.4thsource@gmail.com |
48909a4285fed23a8229bff7aa20c16a41d704ad | 9fce0a423bc700e6949b7b9493b5e4c692349a10 | /Source/src/myexception/LexerError.java | eb7859f1686a050c48f4328d42b66169701fa5fc | [] | no_license | nxvu699134/ANTLR_SimpleCode | a1dffa2754c9d87541135d9c20eb5399163bf933 | c351c3ca5e075528ae51a6f36be0008ad68bfae4 | refs/heads/master | 2021-08-28T15:39:19.836769 | 2017-12-12T17:06:50 | 2017-12-12T17:06:50 | 107,226,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 145 | java | package myexception;
public class LexerError extends Exception
{
public LexerError() {}
public LexerError(String msg)
{
super(msg);
}
}
| [
"nxvu699134@gmail.com"
] | nxvu699134@gmail.com |
ba5068a4d54d5a1c967635b8baa34cde7f7d25b7 | 0f95f50be23e409c083dd8562452cd8ca55b743c | /boss/src/com/tstar/crm/service/CrmUserService.java | 21b11dea70d887df82e59decf831c93be3154d39 | [] | no_license | RisingStar20/yan | 727d467bb43fb6fd911de9dcd73621376e5dc9c4 | 7002f62eac5872788715760f9af20af1d71173f3 | refs/heads/master | 2020-05-09T12:21:42.681959 | 2018-04-12T15:01:00 | 2018-04-12T15:01:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 495 | java | /**
*
*/
package com.tstar.crm.service;
import java.util.List;
import java.util.Map;
import com.tstar.crm.model.CrmUser;
/**
* @author zhumengfeng
*
*/
public interface CrmUserService {
CrmUser selectByPrimaryKey(String id);
Map<String, Object> selectFullInfoById(String id);
Map<String, Object> selectFullInfoByBusinessKey(String businessKey);
int countByCriteria(Map<String, Object> map);
List<CrmUser> selectByPage(Map<String, Object> map);
}
| [
"250739104@qq.com"
] | 250739104@qq.com |
fba5d82541b01fb0984a3e28a5bf598e848d8ad4 | 890af51efbc9b8237e0fd09903f78fe2bb9caadd | /general/system/com/hd/agent/system/timer/ClearLockTimer.java | 4645fd2896ce4e59fe24f932addf0db4771784d8 | [] | no_license | 1045907427/project | 815fb0c5b4b44bf5d8365acfde61b6f68be6e52a | 6eaecf09cd3414295ccf91454f62cf4d619cdbf2 | refs/heads/master | 2020-04-14T19:17:54.310613 | 2019-01-14T10:49:11 | 2019-01-14T10:49:11 | 164,052,678 | 0 | 5 | null | null | null | null | UTF-8 | Java | false | false | 927 | java | /**
* @(#)LockTimer.java
* @author chenwei
* 版本历史
* -------------------------------------------------------------------------
* 时间 作者 内容
* -------------------------------------------------------------------------
* Mar 13, 2013 chenwei 创建版本
*/
package com.hd.agent.system.timer;
import java.util.Date;
import com.hd.agent.system.service.INetLockService;
/**
*
* 网络互斥解锁定时器
* @author chenwei
*/
public class ClearLockTimer {
private INetLockService netLockService;
public INetLockService getNetLockService() {
return netLockService;
}
public void setNetLockService(INetLockService netLockService) {
this.netLockService = netLockService;
}
/**
* 清除超时的加锁数据
* @throws Exception
* @author chenwei
* @date Mar 13, 2013
*/
public void run() throws Exception{
System.out.println(new Date());
netLockService.clearLock();
}
}
| [
"1045907427@qq.com"
] | 1045907427@qq.com |
9a27fb186b799feff9319e8cab6f8412eff86516 | c1c3db938e7737ac5c98e0892bb46cda0b7c868b | /Review_6~/src/step6/Ex03.java | 2668c6d7311961c1b60877d092386ddd955a0731 | [] | no_license | sksmsy/REVIEW | 86691f3c353848b7127ed4879cba3480b2329a9e | 1b0e036ec2b87ca1e1847a6e8506cbe8016820ff | refs/heads/main | 2023-02-18T17:10:00.091887 | 2020-12-27T14:29:31 | 2020-12-27T14:29:31 | 312,788,388 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | java | package step6;
class Ex3{
int [] arr = {87, 100, 11, 72, 92};
}
public class Ex03 {
public static void main(String[] args) {
Ex3 e = new Ex3();
//ex1)전체 합 출력
int tot = 0;
for (int i = 0; i < e.arr.length; i++) {
tot += e.arr[i];
}
System.out.println(tot);
//ex2) 4의 배수 합
tot = 0;
for (int i = 0; i < e.arr.length; i++) {
if(e.arr[i] % 4 == 0) {
tot += e.arr[i];
}
}
System.out.println(tot);
//ex3) 4의 배수의 개수
int cnt = 0;
for (int i = 0; i < e.arr.length; i++) {
if(e.arr[i] % 4 == 0) {
cnt ++;
}
}
System.out.println(cnt);
//ex4) 짝수의 개수
cnt = 0;
for (int i = 0; i < e.arr.length; i++) {
if(e.arr[i] % 2 == 0) {
cnt ++;
}
}
System.out.println(cnt);
}
}
| [
"sksmsy@localhost"
] | sksmsy@localhost |
9724952840b4d12fdd645323b196d410a2de6348 | b292d288cdc5809fb67143bac903951647d502e0 | /project/product/core/src/main/java/com/chananel/product/web/rest/vm/package-info.java | 99c55cea83e7c35a2b23d58d25cab668579b7b68 | [] | no_license | zhouchong521/chananel | 574018832214b668481384a1816519c0ee3c41b9 | aed5e1226f37944ff5ca4e2f988a07200b0dfc30 | refs/heads/master | 2021-01-22T07:57:36.890634 | 2017-05-28T10:03:38 | 2017-05-28T10:03:38 | 92,652,751 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 102 | java | /**
* View Models used by Spring MVC REST controllers.
*/
package com.chananel.product.web.rest.vm;
| [
"mr_liuzeyuan@163.com"
] | mr_liuzeyuan@163.com |
ddef2fa570ec3f880ab900919fbd20f07ceaea69 | 2a1bf7fac795e7d3150efa72892ff705d05cbab5 | /src/main/java/Zadania3/Zad6/Pracownicy/Księgowa.java | 4849d7cfac6a84df7bbd5cd033ac258839f4c6d7 | [] | no_license | Rozik85/ZadaniaDomowe | e9ac580217109b96f6544f769fb94d430b32aae4 | ba857a64013f378c5d20b76d8689c84fbf76b863 | refs/heads/master | 2021-07-13T23:55:42.509009 | 2017-10-06T22:08:29 | 2017-10-06T22:08:29 | 107,245,427 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 155 | java | package Zadania3.Zad6.Pracownicy;
public class Księgowa extends Pracownik{
public Księgowa (String imię, int wypłąta){super(imię,wypłąta);}
}
| [
"rozik85@o2.pl"
] | rozik85@o2.pl |
d416964f508a682b54ba07d8f7db03109c250a3d | e7bebfd210b9a5f7d2252fac27cac9add054984c | /GLM/app/src/androidTest/java/edu/gatech/seclass/glm/dao/ListItemDaoTest.java | 9adb29d4cf877a10a4b9ce4ae1dbfaff79cd9e44 | [] | no_license | mohommedislam15/GroceryListManager | 85298cecc202f8e331303e5c2a0da46ba26b9fba | deb13d296a91673fdecc42b034c8824bd2eb2eb1 | refs/heads/master | 2023-03-16T12:45:43.770901 | 2019-08-16T04:19:23 | 2019-08-16T04:19:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,442 | java | package edu.gatech.seclass.glm.dao;
import android.support.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.List;
import edu.gatech.seclass.glm.activity.ListItemActivity;
import edu.gatech.seclass.glm.model.GroceryList;
import edu.gatech.seclass.glm.model.Item;
import edu.gatech.seclass.glm.model.ItemType;
import edu.gatech.seclass.glm.model.ListItem;
import static android.support.test.InstrumentationRegistry.getTargetContext;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
/**
* Created by thome127 on 10/14/16.
*/
@RunWith(AndroidJUnit4.class)
public class ListItemDaoTest {
private ListItemDao database;
private ItemDao databaseItem;
private ItemTypeDao databaseItemType;
private GroceryListDao databaseInitialize;
@Before
public void setUp() throws Exception {
getTargetContext().deleteDatabase(DBContract.DATABASE_NAME);
databaseInitialize = new GroceryListDao(getTargetContext());
databaseItem = new ItemDao(getTargetContext());
databaseItemType = new ItemTypeDao(getTargetContext());
database = new ListItemDao(getTargetContext());
}
@After
public void tearDown() throws Exception {
// database.close();
}
@Test
public void shouldAddListItem() throws Exception {
GroceryList newList = new GroceryList();
newList.setName("Food");
databaseInitialize.addGroceryList(newList);
long newListId = newList.getId();
ItemType newItemType = new ItemType();
newItemType.setName("Food Category");
databaseItemType.addItemType(newItemType);
Item newItem = new Item();
newItem.setName("Food");
newItem.setItemTypeId(newItemType.getId());
databaseItem.addItem(newItem);
ListItem newListItem = new ListItem();
newListItem.setGroceryListId(newListId);
newListItem.setItemId(0);
database.addListItem(newListItem);
List<ListItem> listItems = database.getListItems(0);
assertThat(listItems.size(), is(1));
assertTrue(listItems.get(0).getItem().getName().equals("Food"));
}
/*
@Test
public void shouldNotAddGroceryListWithoutName() throws Exception {
GroceryList newList = new GroceryList();
database.addGroceryList(newList);
List<GroceryList> groceryLists = database.getGroceryLists("");
assertThat(groceryLists.size(), is(0));
}
@Test
public void shouldNotAddDuplicateGroceryList() throws Exception {
GroceryList newList = new GroceryList();
newList.setName("Food");
database.addGroceryList(newList);
database.addGroceryList(newList);
List<GroceryList> groceryLists = database.getGroceryLists("");
assertThat(groceryLists.size(), is(1));
}
@Test
public void shouldSelectAGroceryList() throws Exception {
GroceryList newList = new GroceryList();
newList.setName("Food");
database.addGroceryList(newList);
List<GroceryList> groceryLists = database.getGroceryLists("");
ListItemActivity.setSelectedGroceryListId(groceryLists.get(0).getId());
Assert.assertEquals(ListItemActivity.getSelectedGroceryListId(),1);
}
@Test
public void shouldUpdateGroceryListName() throws Exception {
GroceryList newList = new GroceryList();
newList.setName("Food");
database.addGroceryList(newList);
List<GroceryList> groceryLists = database.getGroceryLists("");
database.updateGroceryList(groceryLists.get(0).getId(),"Bobby");
groceryLists = database.getGroceryLists("");
assertThat(groceryLists.size(), is(1));
assertTrue(groceryLists.get(0).getName().equals("Bobby"));
}
@Test
public void shouldDeleteGroceryList() throws Exception {
GroceryList newList = new GroceryList();
newList.setName("Food");
database.addGroceryList(newList);
List<GroceryList> groceryLists = database.getGroceryLists("");
assertThat(groceryLists.size(), is(1));
database.deleteGroceryList(groceryLists.get(0).getId());
groceryLists = database.getGroceryLists("");
assertThat(groceryLists.size(), is(0));
}
*/
}
| [
"mlefkovitz@gatech.edu"
] | mlefkovitz@gatech.edu |
2b2058d6bb97bdbfc6e887d03e90f26b7da5220f | 46a4043121060a5c9ce63345ecdf698cb9b86d63 | /app/src/main/java/nova/xiaoju/com/novaautolayout/widget/MetroLayout.java | 42c48a31b13b95fdb6c09bbe04463c974669f37a | [] | no_license | supengchao/NovaAutoLayout | 36176f873d30515882598ec0ec2f8e3d7cdc6206 | 13035956ea4e6c29973c00db0be7917fd0771515 | refs/heads/master | 2021-01-10T03:06:08.177821 | 2016-03-03T09:29:00 | 2016-03-03T09:29:00 | 53,029,714 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,941 | java | package nova.xiaoju.com.novaautolayout.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import nova.xiaoju.com.novaautolayout.AutoLayoutInfo;
import nova.xiaoju.com.novaautolayout.R;
import nova.xiaoju.com.novaautolayout.utils.AutoLayoutHelper;
import nova.xiaoju.com.novaautolayout.utils.AutoUtils;
/**
* Created by zhy on 15/12/10.
*
* //do not use
*/
public class MetroLayout extends ViewGroup
{
private final AutoLayoutHelper mHelper = new AutoLayoutHelper(this);
private static class MetroBlock
{
int left;
int top;
int width;
}
private List<MetroBlock> mAvailablePos = new ArrayList<>();
private int mDivider;
public MetroLayout(Context context, AttributeSet attrs)
{
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MetroLayout);
mDivider = a.getDimensionPixelOffset(R.styleable.MetroLayout_metro_divider, 0);
mDivider = AutoUtils.getPercentWidthSizeBigger(mDivider);
a.recycle();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
if (true)
randomColor();
if (!isInEditMode())
mHelper.adjustChildren();
measureChildren(widthMeasureSpec, heightMeasureSpec);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
private void randomColor()
{
Random r = new Random(255);
for (int i = 0, n = getChildCount(); i < n; i++)
{
View v = getChildAt(i);
v.setBackgroundColor(Color.argb(100, r.nextInt(), r.nextInt(), r.nextInt()));
}
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b)
{
initAvailablePosition();
int left = 0;
int top = 0;
int divider = mDivider;
for (int i = 0, n = getChildCount(); i < n; i++)
{
View v = getChildAt(i);
if (v.getVisibility() == View.GONE) continue;
MetroBlock newPos = findAvailablePos(v);
left = newPos.left;
top = newPos.top;
int childWidth = v.getMeasuredWidth();
int childHeight = v.getMeasuredHeight();
int right = left + childWidth;
int bottom = top + childHeight;
v.layout(left, top, right, bottom);
if (childWidth + divider < newPos.width)
{
newPos.left += childWidth + divider;
newPos.width -= childWidth + divider;
} else
{
mAvailablePos.remove(newPos);
}
MetroBlock p = new MetroBlock();
p.left = left;
p.top = bottom + divider;
p.width = childWidth;
mAvailablePos.add(p);
mergeAvailablePosition();
}
}
private void mergeAvailablePosition()
{
if (mAvailablePos.size() <= 1) return;
List<MetroBlock> needRemoveBlocks = new ArrayList<>();
MetroBlock one = mAvailablePos.get(0);
MetroBlock two = mAvailablePos.get(1);
for (int i = 1, n = mAvailablePos.size(); i < n - 1; i++)
{
if (one.top == two.top)
{
one.width = one.width + two.width;
needRemoveBlocks.add(one);
two.left = one.left;
two = mAvailablePos.get(i + 1);
} else
{
one = mAvailablePos.get(i);
two = mAvailablePos.get(i + 1);
}
}
mAvailablePos.removeAll(needRemoveBlocks);
}
private void initAvailablePosition()
{
mAvailablePos.clear();
MetroBlock first = new MetroBlock();
first.left = getPaddingLeft();
first.top = getPaddingTop();
first.width = getMeasuredWidth();
mAvailablePos.add(first);
}
private MetroBlock findAvailablePos(View view)
{
MetroBlock p = new MetroBlock();
if (mAvailablePos.size() == 0)
{
p.left = getPaddingLeft();
p.top = getPaddingTop();
p.width = getMeasuredWidth();
return p;
}
int min = mAvailablePos.get(0).top;
MetroBlock minHeightPos = mAvailablePos.get(0);
for (MetroBlock _p : mAvailablePos)
{
if (_p.top < min)
{
min = _p.top;
minHeightPos = _p;
}
}
return minHeightPos;
}
@Override
public MetroLayout.LayoutParams generateLayoutParams(AttributeSet attrs)
{
return new LayoutParams(getContext(), attrs);
}
public static class LayoutParams extends MarginLayoutParams
implements AutoLayoutHelper.AutoLayoutParams
{
private AutoLayoutInfo mAutoLayoutInfo;
public LayoutParams(Context c, AttributeSet attrs)
{
super(c, attrs);
mAutoLayoutInfo = AutoLayoutHelper.getAutoLayoutInfo(c, attrs);
}
public LayoutParams(int width, int height)
{
super(width, height);
}
public LayoutParams(ViewGroup.LayoutParams source)
{
super(source);
}
public LayoutParams(MarginLayoutParams source)
{
super(source);
}
public LayoutParams(LayoutParams source)
{
this((ViewGroup.LayoutParams) source);
mAutoLayoutInfo = source.mAutoLayoutInfo;
}
@Override
public AutoLayoutInfo getAutoLayoutInfo()
{
return mAutoLayoutInfo;
}
}
}
| [
"1459384963@qq.com"
] | 1459384963@qq.com |
cea126c1a3216afce717aa70ecfbc3b9e55201d9 | 691d588accc94c0306d9dae9706d9bdc543db8d3 | /webanno-automation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/automation/service/export/AutomationMiraTemplateExporter.java | 2987dea0b2d576016d67d78887da79cb6e9839d5 | [
"Apache-2.0"
] | permissive | pw-mini-ig/webanno | c8ecccd2d136b7ff49f5d65c54bd73dfd63f203a | 78592a4706f2fca2bcb2333203f9ae1438e607cd | refs/heads/master | 2023-02-21T06:24:14.929426 | 2021-01-28T12:59:43 | 2021-01-28T12:59:43 | 320,852,744 | 0 | 0 | Apache-2.0 | 2021-01-28T12:59:44 | 2020-12-12T14:45:30 | null | UTF-8 | Java | false | false | 5,580 | java | /*
* Copyright 2018
* Ubiquitous Knowledge Processing (UKP) Lab and FG Language Technology
* Technische Universität Darmstadt
*
* 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 de.tudarmstadt.ukp.clarin.webanno.automation.service.export;
import static java.util.Arrays.asList;
import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.zip.ZipFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import de.tudarmstadt.ukp.clarin.webanno.api.AnnotationSchemaService;
import de.tudarmstadt.ukp.clarin.webanno.api.dao.export.exporters.LayerExporter;
import de.tudarmstadt.ukp.clarin.webanno.api.export.ProjectExportRequest;
import de.tudarmstadt.ukp.clarin.webanno.api.export.ProjectExportTaskMonitor;
import de.tudarmstadt.ukp.clarin.webanno.api.export.ProjectExporter;
import de.tudarmstadt.ukp.clarin.webanno.api.export.ProjectImportRequest;
import de.tudarmstadt.ukp.clarin.webanno.automation.model.MiraTemplate;
import de.tudarmstadt.ukp.clarin.webanno.automation.service.AutomationService;
import de.tudarmstadt.ukp.clarin.webanno.automation.service.export.model.ExportedMiraTemplate;
import de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedAnnotationFeatureReference;
import de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedProject;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
import de.tudarmstadt.ukp.clarin.webanno.model.Project;
@Component
public class AutomationMiraTemplateExporter
implements ProjectExporter
{
private static final String MIRA_TEMPLATES = "mira_templates";
private @Autowired AnnotationSchemaService annotationService;
private @Autowired AutomationService automationService;
@Override
public List<Class<? extends ProjectExporter>> getImportDependencies()
{
return asList(LayerExporter.class);
}
@Override
public void exportData(ProjectExportRequest aRequest, ProjectExportTaskMonitor aMonitor,
ExportedProject aExProject, File aStage)
throws Exception
{
List<ExportedMiraTemplate> exTemplates = new ArrayList<>();
for (MiraTemplate template : automationService.listMiraTemplates(aRequest.getProject())) {
ExportedMiraTemplate exTemplate = new ExportedMiraTemplate();
exTemplate.setAnnotateAndPredict(template.isAnnotateAndRepeat());
exTemplate.setAutomationStarted(template.isAutomationStarted());
exTemplate.setCurrentLayer(template.isCurrentLayer());
exTemplate.setResult(template.getResult());
exTemplate.setTrainFeature(
new ExportedAnnotationFeatureReference(template.getTrainFeature()));
if (template.getOtherFeatures().size() > 0) {
Set<ExportedAnnotationFeatureReference> exOtherFeatures = new HashSet<>();
for (AnnotationFeature feature : template.getOtherFeatures()) {
exOtherFeatures.add(new ExportedAnnotationFeatureReference(feature));
}
exTemplate.setOtherFeatures(exOtherFeatures);
}
exTemplates.add(exTemplate);
}
aExProject.setProperty(MIRA_TEMPLATES, exTemplates);
}
@Override
public void importData(ProjectImportRequest aRequest, Project aProject,
ExportedProject aExProject, ZipFile aZip)
throws Exception
{
ExportedMiraTemplate[] templates = aExProject.getArrayProperty(MIRA_TEMPLATES,
ExportedMiraTemplate.class);
for (ExportedMiraTemplate exTemplate : templates) {
MiraTemplate template = new MiraTemplate();
template.setAnnotateAndRepeat(exTemplate.isAnnotateAndPredict());
template.setAutomationStarted(false);
template.setCurrentLayer(exTemplate.isCurrentLayer());
template.setResult("---");
AnnotationLayer trainingLayer = annotationService.findLayer(aProject,
exTemplate.getTrainFeature().getLayer());
AnnotationFeature trainingFeature = annotationService
.getFeature(exTemplate.getTrainFeature().getName(), trainingLayer);
template.setTrainFeature(trainingFeature);
Set<AnnotationFeature> otherFeatures = new HashSet<>();
if (exTemplate.getOtherFeatures() != null) {
for (ExportedAnnotationFeatureReference other : exTemplate.getOtherFeatures()) {
AnnotationLayer layer = annotationService.findLayer(aProject, other.getLayer());
AnnotationFeature feature = annotationService.getFeature(other.getName(),
layer);
otherFeatures.add(feature);
}
template.setOtherFeatures(otherFeatures);
}
automationService.createTemplate(template);
}
}
}
| [
"richard.eckart@gmail.com"
] | richard.eckart@gmail.com |
f632bce5185200cb54457ac52665e57571974517 | 7b73756ba240202ea92f8f0c5c51c8343c0efa5f | /classes5/com/tencent/mobileqq/pic/compress/PicTypeNormal.java | 1927ba7a1b05fb726d3785448fbb83579dfd0399 | [] | no_license | meeidol-luo/qooq | 588a4ca6d8ad579b28dec66ec8084399fb0991ef | e723920ac555e99d5325b1d4024552383713c28d | refs/heads/master | 2020-03-27T03:16:06.616300 | 2016-10-08T07:33:58 | 2016-10-08T07:33:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,956 | java | package com.tencent.mobileqq.pic.compress;
import com.tencent.mobileqq.hotpatch.NotVerifyClass;
import com.tencent.mobileqq.pic.CompressInfo;
import com.tencent.mobileqq.pic.Logger;
public class PicTypeNormal
extends PicType
{
PicTypeNormal(CompressInfo paramCompressInfo)
{
super(paramCompressInfo);
boolean bool = NotVerifyClass.DO_VERIFY_CLASS;
}
protected int a(CompressInfo paramCompressInfo)
{
switch (paramCompressInfo.jdField_g_of_type_Int)
{
default:
return -1;
case 0:
case 1:
return 0;
}
return 2;
}
protected final int[] a()
{
if (this.jdField_a_of_type_ComTencentMobileqqPicCompressInfo.jdField_g_of_type_Int == 2) {
return null;
}
int[] arrayOfInt = new int[2];
PicType.i = Utils.a(this.jdField_a_of_type_ComTencentMobileqqPicCompressInfo.c, this.jdField_a_of_type_ComTencentMobileqqPicCompressInfo.j);
arrayOfInt[0] = PicType.i;
arrayOfInt[1] = (arrayOfInt[0] * 2);
Logger.a("PicTypeNormal", "getScaleLargerSide", "PicType.SendPhotoMaxLongSide = " + PicType.i);
return arrayOfInt;
}
/* Error */
protected boolean d()
{
// Byte code:
// 0: fconst_1
// 1: fstore_1
// 2: iconst_0
// 3: istore 9
// 5: aload_0
// 6: getfield 80 com/tencent/mobileqq/pic/compress/PicTypeNormal:t I
// 9: ifne +891 -> 900
// 12: aload_0
// 13: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 16: getfield 82 com/tencent/mobileqq/pic/CompressInfo:jdField_g_of_type_Boolean Z
// 19: ifeq +105 -> 124
// 22: aload_0
// 23: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 26: getfield 31 com/tencent/mobileqq/pic/CompressInfo:c Ljava/lang/String;
// 29: invokestatic 86 com/tencent/mobileqq/pic/compress/Utils:b (Ljava/lang/String;)Z
// 32: ifeq +92 -> 124
// 35: aload_0
// 36: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 39: aload_0
// 40: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 43: getfield 31 com/tencent/mobileqq/pic/CompressInfo:c Ljava/lang/String;
// 46: putfield 89 com/tencent/mobileqq/pic/CompressInfo:e Ljava/lang/String;
// 49: aload_0
// 50: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 53: new 48 java/lang/StringBuilder
// 56: dup
// 57: invokespecial 51 java/lang/StringBuilder:<init> ()V
// 60: aload_0
// 61: getfield 91 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 64: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 67: aload_0
// 68: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 71: getfield 92 com/tencent/mobileqq/pic/CompressInfo:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 74: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 77: ldc 94
// 79: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 82: invokevirtual 64 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 85: putfield 97 com/tencent/mobileqq/pic/CompressInfo:f Ljava/lang/String;
// 88: aload_0
// 89: getfield 91 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 92: new 48 java/lang/StringBuilder
// 95: dup
// 96: invokespecial 51 java/lang/StringBuilder:<init> ()V
// 99: aload_0
// 100: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 103: getfield 92 com/tencent/mobileqq/pic/CompressInfo:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 106: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 109: ldc 99
// 111: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 114: invokevirtual 64 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 117: ldc 101
// 119: invokestatic 69 com/tencent/mobileqq/pic/Logger:a (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V
// 122: iconst_1
// 123: ireturn
// 124: aload_0
// 125: invokevirtual 103 com/tencent/mobileqq/pic/compress/PicTypeNormal:a ()[I
// 128: astore_2
// 129: aload_2
// 130: ifnonnull +39 -> 169
// 133: aload_0
// 134: getfield 91 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 137: ldc 105
// 139: new 48 java/lang/StringBuilder
// 142: dup
// 143: invokespecial 51 java/lang/StringBuilder:<init> ()V
// 146: aload_0
// 147: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 150: getfield 92 com/tencent/mobileqq/pic/CompressInfo:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 153: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 156: ldc 107
// 158: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 161: invokevirtual 64 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 164: invokestatic 109 com/tencent/mobileqq/pic/Logger:b (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V
// 167: iconst_0
// 168: ireturn
// 169: aload_2
// 170: iconst_0
// 171: iaload
// 172: istore 10
// 174: aload_2
// 175: iconst_1
// 176: iaload
// 177: istore 5
// 179: aload_0
// 180: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 183: aload_0
// 184: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 187: getfield 31 com/tencent/mobileqq/pic/CompressInfo:c Ljava/lang/String;
// 190: aload_0
// 191: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 194: getfield 23 com/tencent/mobileqq/pic/CompressInfo:jdField_g_of_type_Int I
// 197: invokestatic 112 com/tencent/mobileqq/pic/compress/Utils:a (Ljava/lang/String;I)Ljava/lang/String;
// 200: putfield 89 com/tencent/mobileqq/pic/CompressInfo:e Ljava/lang/String;
// 203: aload_0
// 204: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 207: getfield 89 com/tencent/mobileqq/pic/CompressInfo:e Ljava/lang/String;
// 210: invokestatic 118 android/text/TextUtils:isEmpty (Ljava/lang/CharSequence;)Z
// 213: ifeq +39 -> 252
// 216: aload_0
// 217: getfield 91 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 220: ldc 105
// 222: new 48 java/lang/StringBuilder
// 225: dup
// 226: invokespecial 51 java/lang/StringBuilder:<init> ()V
// 229: aload_0
// 230: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 233: getfield 92 com/tencent/mobileqq/pic/CompressInfo:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 236: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 239: ldc 120
// 241: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 244: invokevirtual 64 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 247: invokestatic 109 com/tencent/mobileqq/pic/Logger:b (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V
// 250: iconst_0
// 251: ireturn
// 252: aload_0
// 253: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 256: getfield 89 com/tencent/mobileqq/pic/CompressInfo:e Ljava/lang/String;
// 259: invokestatic 123 com/tencent/mobileqq/utils/FileUtils:b (Ljava/lang/String;)Z
// 262: ifeq +39 -> 301
// 265: aload_0
// 266: getfield 91 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 269: ldc 105
// 271: new 48 java/lang/StringBuilder
// 274: dup
// 275: invokespecial 51 java/lang/StringBuilder:<init> ()V
// 278: aload_0
// 279: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 282: getfield 92 com/tencent/mobileqq/pic/CompressInfo:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 285: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 288: ldc 125
// 290: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 293: invokevirtual 64 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 296: invokestatic 109 com/tencent/mobileqq/pic/Logger:b (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V
// 299: iconst_1
// 300: ireturn
// 301: new 127 android/graphics/BitmapFactory$Options
// 304: dup
// 305: invokespecial 128 android/graphics/BitmapFactory$Options:<init> ()V
// 308: astore_2
// 309: aload_2
// 310: aload_0
// 311: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 314: getfield 31 com/tencent/mobileqq/pic/CompressInfo:c Ljava/lang/String;
// 317: iload 5
// 319: iload 10
// 321: invokestatic 131 com/tencent/mobileqq/pic/compress/Utils:a (Landroid/graphics/BitmapFactory$Options;Ljava/lang/String;II)Z
// 324: ifne +39 -> 363
// 327: aload_0
// 328: getfield 91 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 331: ldc 105
// 333: new 48 java/lang/StringBuilder
// 336: dup
// 337: invokespecial 51 java/lang/StringBuilder:<init> ()V
// 340: aload_0
// 341: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 344: getfield 92 com/tencent/mobileqq/pic/CompressInfo:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 347: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 350: ldc -123
// 352: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 355: invokevirtual 64 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 358: invokestatic 109 com/tencent/mobileqq/pic/Logger:b (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V
// 361: iconst_0
// 362: ireturn
// 363: aload_0
// 364: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 367: getfield 31 com/tencent/mobileqq/pic/CompressInfo:c Ljava/lang/String;
// 370: aload_2
// 371: invokestatic 139 android/graphics/BitmapFactory:decodeFile (Ljava/lang/String;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
// 374: astore_3
// 375: aload_3
// 376: ifnonnull +100 -> 476
// 379: aload_0
// 380: getfield 91 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 383: ldc 105
// 385: new 48 java/lang/StringBuilder
// 388: dup
// 389: invokespecial 51 java/lang/StringBuilder:<init> ()V
// 392: aload_0
// 393: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 396: getfield 92 com/tencent/mobileqq/pic/CompressInfo:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 399: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 402: ldc -115
// 404: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 407: invokevirtual 64 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 410: invokestatic 109 com/tencent/mobileqq/pic/Logger:b (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V
// 413: iconst_0
// 414: ireturn
// 415: astore_2
// 416: aload_0
// 417: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 420: iconst_1
// 421: invokevirtual 144 com/tencent/mobileqq/pic/CompressInfo:a (Z)V
// 424: aload_2
// 425: invokevirtual 147 java/lang/OutOfMemoryError:printStackTrace ()V
// 428: aload_0
// 429: getfield 91 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 432: ldc 105
// 434: new 48 java/lang/StringBuilder
// 437: dup
// 438: invokespecial 51 java/lang/StringBuilder:<init> ()V
// 441: aload_0
// 442: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 445: getfield 92 com/tencent/mobileqq/pic/CompressInfo:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 448: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 451: ldc -107
// 453: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 456: invokevirtual 64 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 459: invokestatic 109 com/tencent/mobileqq/pic/Logger:b (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V
// 462: aload_0
// 463: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 466: ldc -105
// 468: putfield 89 com/tencent/mobileqq/pic/CompressInfo:e Ljava/lang/String;
// 471: aload_0
// 472: invokevirtual 153 com/tencent/mobileqq/pic/compress/PicTypeNormal:c ()Z
// 475: ireturn
// 476: aload_3
// 477: invokevirtual 159 android/graphics/Bitmap:getWidth ()I
// 480: istore 5
// 482: aload_3
// 483: invokevirtual 162 android/graphics/Bitmap:getHeight ()I
// 486: istore 6
// 488: new 164 android/graphics/Matrix
// 491: dup
// 492: invokespecial 165 android/graphics/Matrix:<init> ()V
// 495: astore 4
// 497: iload 5
// 499: iload 6
// 501: if_icmple +259 -> 760
// 504: iload 5
// 506: istore 7
// 508: iload 6
// 510: istore 8
// 512: iload 7
// 514: iload 10
// 516: if_icmple +386 -> 902
// 519: iload 10
// 521: i2f
// 522: fconst_1
// 523: iload 7
// 525: i2f
// 526: fmul
// 527: fdiv
// 528: fstore_1
// 529: iload 8
// 531: i2f
// 532: fload_1
// 533: fmul
// 534: f2i
// 535: istore 8
// 537: iload 7
// 539: i2f
// 540: fload_1
// 541: fmul
// 542: f2i
// 543: istore 7
// 545: iconst_1
// 546: istore 7
// 548: iload 5
// 550: iload 6
// 552: if_icmple +3 -> 555
// 555: aload_0
// 556: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 559: getfield 31 com/tencent/mobileqq/pic/CompressInfo:c Ljava/lang/String;
// 562: invokestatic 171 com/tencent/image/JpegExifReader:getRotationDegree (Ljava/lang/String;)I
// 565: istore 10
// 567: iload 9
// 569: istore 8
// 571: aload_0
// 572: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 575: getfield 173 com/tencent/mobileqq/pic/CompressInfo:d Z
// 578: ifeq +46 -> 624
// 581: iload 9
// 583: istore 8
// 585: iload 10
// 587: ifeq +37 -> 624
// 590: iload 9
// 592: istore 8
// 594: iload 10
// 596: bipush 90
// 598: irem
// 599: ifne +25 -> 624
// 602: aload 4
// 604: iload 10
// 606: i2f
// 607: iload 5
// 609: iconst_1
// 610: ishr
// 611: i2f
// 612: iload 6
// 614: iconst_1
// 615: ishr
// 616: i2f
// 617: invokevirtual 177 android/graphics/Matrix:postRotate (FFF)Z
// 620: pop
// 621: iconst_1
// 622: istore 8
// 624: iload 7
// 626: ifeq +11 -> 637
// 629: aload 4
// 631: fload_1
// 632: fload_1
// 633: invokevirtual 181 android/graphics/Matrix:postScale (FF)Z
// 636: pop
// 637: iload 8
// 639: ifne +10 -> 649
// 642: aload_3
// 643: astore_2
// 644: iload 7
// 646: ifeq +17 -> 663
// 649: aload_3
// 650: iconst_0
// 651: iconst_0
// 652: iload 5
// 654: iload 6
// 656: aload 4
// 658: iconst_1
// 659: invokestatic 185 android/graphics/Bitmap:createBitmap (Landroid/graphics/Bitmap;IIIILandroid/graphics/Matrix;Z)Landroid/graphics/Bitmap;
// 662: astore_2
// 663: aload_0
// 664: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 667: getfield 89 com/tencent/mobileqq/pic/CompressInfo:e Ljava/lang/String;
// 670: aload_2
// 671: aload_0
// 672: invokevirtual 187 com/tencent/mobileqq/pic/compress/PicTypeNormal:a ()I
// 675: aload_0
// 676: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 679: getfield 92 com/tencent/mobileqq/pic/CompressInfo:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 682: aload_0
// 683: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 686: invokestatic 190 com/tencent/mobileqq/pic/compress/Utils:a (Ljava/lang/String;Landroid/graphics/Bitmap;ILjava/lang/String;Lcom/tencent/mobileqq/pic/CompressInfo;)Z
// 689: istore 11
// 691: aload_0
// 692: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 695: getfield 31 com/tencent/mobileqq/pic/CompressInfo:c Ljava/lang/String;
// 698: invokestatic 193 com/tencent/image/JpegExifReader:isCrashJpeg (Ljava/lang/String;)Z
// 701: ifne +185 -> 886
// 704: new 195 android/media/ExifInterface
// 707: dup
// 708: aload_0
// 709: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 712: getfield 31 com/tencent/mobileqq/pic/CompressInfo:c Ljava/lang/String;
// 715: invokespecial 198 android/media/ExifInterface:<init> (Ljava/lang/String;)V
// 718: new 195 android/media/ExifInterface
// 721: dup
// 722: aload_0
// 723: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 726: getfield 89 com/tencent/mobileqq/pic/CompressInfo:e Ljava/lang/String;
// 729: invokespecial 198 android/media/ExifInterface:<init> (Ljava/lang/String;)V
// 732: invokestatic 203 com/tencent/mobileqq/utils/ImageUtil:a (Landroid/media/ExifInterface;Landroid/media/ExifInterface;)Z
// 735: ifne +14 -> 749
// 738: aload_0
// 739: getfield 91 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 742: ldc 105
// 744: ldc -51
// 746: invokestatic 109 com/tencent/mobileqq/pic/Logger:b (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V
// 749: aload_2
// 750: ifnull +7 -> 757
// 753: aload_2
// 754: invokevirtual 208 android/graphics/Bitmap:recycle ()V
// 757: iload 11
// 759: ireturn
// 760: iload 6
// 762: istore 7
// 764: iload 5
// 766: istore 8
// 768: goto -256 -> 512
// 771: astore_2
// 772: aload_0
// 773: getfield 91 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 776: ldc 105
// 778: new 48 java/lang/StringBuilder
// 781: dup
// 782: invokespecial 51 java/lang/StringBuilder:<init> ()V
// 785: aload_0
// 786: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 789: getfield 92 com/tencent/mobileqq/pic/CompressInfo:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 792: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 795: ldc -46
// 797: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 800: invokevirtual 64 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 803: invokestatic 109 com/tencent/mobileqq/pic/Logger:b (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V
// 806: aload_3
// 807: astore_2
// 808: goto -145 -> 663
// 811: astore_2
// 812: aload_0
// 813: getfield 91 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 816: ldc 105
// 818: new 48 java/lang/StringBuilder
// 821: dup
// 822: invokespecial 51 java/lang/StringBuilder:<init> ()V
// 825: aload_0
// 826: getfield 27 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_ComTencentMobileqqPicCompressInfo Lcom/tencent/mobileqq/pic/CompressInfo;
// 829: getfield 92 com/tencent/mobileqq/pic/CompressInfo:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 832: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 835: ldc -44
// 837: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 840: invokevirtual 64 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 843: invokestatic 109 com/tencent/mobileqq/pic/Logger:b (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V
// 846: aload_3
// 847: astore_2
// 848: goto -185 -> 663
// 851: astore_3
// 852: aload_0
// 853: getfield 91 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 856: ldc 105
// 858: new 48 java/lang/StringBuilder
// 861: dup
// 862: invokespecial 51 java/lang/StringBuilder:<init> ()V
// 865: ldc -42
// 867: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 870: aload_3
// 871: invokevirtual 217 java/io/IOException:getMessage ()Ljava/lang/String;
// 874: invokevirtual 57 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 877: invokevirtual 64 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 880: invokestatic 109 com/tencent/mobileqq/pic/Logger:b (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V
// 883: goto -134 -> 749
// 886: aload_0
// 887: getfield 91 com/tencent/mobileqq/pic/compress/PicTypeNormal:jdField_a_of_type_JavaLangString Ljava/lang/String;
// 890: ldc 105
// 892: ldc -37
// 894: invokestatic 109 com/tencent/mobileqq/pic/Logger:b (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V
// 897: goto -148 -> 749
// 900: iconst_0
// 901: ireturn
// 902: iconst_0
// 903: istore 7
// 905: goto -357 -> 548
// Local variable table:
// start length slot name signature
// 0 908 0 this PicTypeNormal
// 1 632 1 f float
// 128 243 2 localObject1 Object
// 415 10 2 localOutOfMemoryError1 OutOfMemoryError
// 643 111 2 localObject2 Object
// 771 1 2 localOutOfMemoryError2 OutOfMemoryError
// 807 1 2 localObject3 Object
// 811 1 2 localNullPointerException NullPointerException
// 847 1 2 localObject4 Object
// 374 473 3 localBitmap android.graphics.Bitmap
// 851 20 3 localIOException java.io.IOException
// 495 162 4 localMatrix android.graphics.Matrix
// 177 588 5 i int
// 486 275 6 j int
// 506 398 7 k int
// 510 257 8 m int
// 3 588 9 n int
// 172 433 10 i1 int
// 689 69 11 bool boolean
// Exception table:
// from to target type
// 363 375 415 java/lang/OutOfMemoryError
// 379 413 415 java/lang/OutOfMemoryError
// 649 663 771 java/lang/OutOfMemoryError
// 649 663 811 java/lang/NullPointerException
// 704 749 851 java/io/IOException
}
}
/* Location: E:\apk\QQ_91\classes5-dex2jar.jar!\com\tencent\mobileqq\pic\compress\PicTypeNormal.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"1776098770@qq.com"
] | 1776098770@qq.com |
4a61d2ec577212e7184520cb9634314142b423ac | 10fdc3aa333ef07a180f29a4425650945c3da9c8 | /zhuanbo-shop-api/src/main/java/com/zhuanbo/shop/api/controller/MobileUserController.java | 963f856172add120736f4615de085bf8612564c5 | [] | no_license | arvin-xiao/lexuan | 4d67f4ab40243c7e6167e514d899c6cd0c3f0995 | 6cffeee1002bad067e6c8481a3699186351d91a8 | refs/heads/master | 2023-04-27T21:01:06.644131 | 2020-05-03T03:03:52 | 2020-05-03T03:03:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,038 | java | package com.zhuanbo.shop.api.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zhuanbo.core.annotation.LoginUser;
import com.zhuanbo.core.config.AuthConfig;
import com.zhuanbo.core.config.QueueConfig;
import com.zhuanbo.core.constants.Constants;
import com.zhuanbo.core.constants.ConstantsEnum;
import com.zhuanbo.core.constants.OrderStatus;
import com.zhuanbo.core.constants.ReqResEnum;
import com.zhuanbo.core.constants.UserSignedEnum;
import com.zhuanbo.core.dto.WxTokenCoreDTO;
import com.zhuanbo.core.entity.Cart;
import com.zhuanbo.core.entity.Dictionary;
import com.zhuanbo.core.entity.NotifyMsg;
import com.zhuanbo.core.entity.Order;
import com.zhuanbo.core.entity.Storage;
import com.zhuanbo.core.entity.User;
import com.zhuanbo.core.entity.UserBindThird;
import com.zhuanbo.core.entity.UserInvite;
import com.zhuanbo.core.entity.UserPartner;
import com.zhuanbo.core.entity.UserSecurityCenter;
import com.zhuanbo.core.exception.ShopException;
import com.zhuanbo.core.storage.StorageService;
import com.zhuanbo.core.util.CharUtil;
import com.zhuanbo.core.util.MapUtil;
import com.zhuanbo.core.util.RedisUtil;
import com.zhuanbo.core.util.ResponseUtil;
import com.zhuanbo.external.service.dto.AppIdKeyDTO;
import com.zhuanbo.service.service.IAuthService;
import com.zhuanbo.service.service.ICartService;
import com.zhuanbo.service.service.IDictionaryService;
import com.zhuanbo.service.service.INotifyMsgService;
import com.zhuanbo.service.service.IOrderService;
import com.zhuanbo.service.service.IStorageService;
import com.zhuanbo.service.service.IUserBindThirdService;
import com.zhuanbo.service.service.IUserInviteService;
import com.zhuanbo.service.service.IUserPartnerService;
import com.zhuanbo.service.service.IUserSecurityCenterService;
import com.zhuanbo.service.service.IUserService;
import com.zhuanbo.service.service3rd.rabbitmq.IRabbitMQSenderService;
import com.zhuanbo.service.service3rd.rabbitmq.impl.RabbitMQSenderImpl;
import com.zhuanbo.service.vo.BaseInfoUserVO;
import com.zhuanbo.service.vo.RealNameVO;
import com.zhuanbo.service.vo.UserLoginVO;
import com.zhuanbo.service.vo.UserRedisVO;
import com.zhuanbo.shop.api.dto.req.RealNameDTO;
import com.zhuanbo.shop.api.dto.req.UserDTO;
import com.zhuanbo.shop.api.dto.resp.WxTokenDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import org.springframework.web.bind.annotation.GetMapping;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <p>
* 用户表 前端控制器
* </p>
*
* @author rome
* @since 2018-12-19
*/
@RestController
@RequestMapping("/shop/mobile/user")
@Slf4j
@RefreshScope
public class MobileUserController {
public static final String IMAGE = "image";
@Value("${serverPhone}")
private String serverPhone;
@Autowired
private IUserService userService;
@Autowired
private StorageService storageService;
@Autowired
private IStorageService iStorageService;
@Autowired
private PlatformTransactionManager txManager;
@Autowired
private IUserBindThirdService iShopUserBindThirdService;
@Autowired
private IOrderService iOrderService;
@Autowired
private IUserSecurityCenterService iShopUserSecurityCenterService;
@Autowired
private ICartService iCartService;
@Autowired
private INotifyMsgService iNotifyMsgService;
@Autowired
private IDictionaryService iDictionaryService;
@Autowired
private AuthConfig authConfig;
@Autowired
private RabbitTemplate rabbitTemplate;
@Autowired
private QueueConfig queueConfig;
@Autowired
private IRabbitMQSenderService iRabbitMQSenderService;
@Autowired
private IUserInviteService iUserInviteService;
@Autowired
private IAuthService iAuthService;
@Autowired
private IUserPartnerService iUserPartnerService;
/**
* 查
*
* @param userId
* @return
*/
@PostMapping("/info")
public Object detail(@LoginUser Long userId, HttpServletRequest request) {
User user = userService.getById(userId);
if (user == null) {
return ResponseUtil.badResult();
} else {
UserLoginVO userLoginVO = userService.packageUser(user, false);
userLoginVO.setUserToken(request.getHeader(Constants.LOGIN_TOKEN_KEY));
return ResponseUtil.ok(userLoginVO);
}
}
/**
* 上传头像 与聊吧一致,用数组
*
* @param files
* @return
*/
@Transactional
@PostMapping("/head/upload")
public Object handleFileUpload(@LoginUser Long userId, @RequestParam("files") MultipartFile[] files, HttpServletRequest request) {
if (files == null || files[0] == null) {
return ResponseUtil.fail("11111", "缺少参数file");
}
MultipartFile file = files[0];// 只用第一个
User user = userService.getById(userId);
if (user == null) {
return ResponseUtil.badResult();
}
String originalFilename = file.getOriginalFilename();
String key = generateKey(originalFilename);
storageService.store(file, key,false);
String url = storageService.generateUrl(key);
Storage storageInfo = new Storage();
storageInfo.setName(originalFilename);
storageInfo.setSize((int) file.getSize());
storageInfo.setType(file.getContentType());
storageInfo.setAddTime(LocalDateTime.now());
storageInfo.setModified(LocalDateTime.now());
storageInfo.setStorageKey(key);
storageInfo.setUrl(url);
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
TransactionStatus status = txManager.getTransaction(def);
try {
iStorageService.save(storageInfo);
user.setHeadImgUrl(storageInfo.getUrl());
user.setUpdateTime(LocalDateTime.now());
userService.updateById(user);
//推送分润
iRabbitMQSenderService.send(RabbitMQSenderImpl.USER_MODIFY_PROFIT, user);
} catch (Exception ex) {
txManager.rollback(status);
}
UserLoginVO userLoginVO = userService.packageUser(user, false);
userLoginVO.setUserToken(request.getHeader(Constants.LOGIN_TOKEN_KEY));
return ResponseUtil.ok(userLoginVO);
}
/**
* 修改个人详细信息
*
* @param userId
* @param user
* @return
*/
@Transactional
@PostMapping("/info/update")
public Object updateInfo(@LoginUser Long userId, @RequestBody User user, HttpServletRequest request) {
User u = userService.getById(userId);
if (u == null) {
return ResponseUtil.badResult();
}
if (StringUtils.isNotBlank(user.getNickname())) {
u.setNickname(user.getNickname());
}
if (u.getNickname().length() > 16) {
return ResponseUtil.result(10043);
}
u.setUpdateTime(LocalDateTime.now());
userService.updateById(u);
UserLoginVO userLoginVO = userService.packageUser(u, false);
userLoginVO.setUserToken(request.getHeader(Constants.LOGIN_TOKEN_KEY));
Map<String, Object> mqMsg = MapUtil.of("mercId", authConfig.getMercId(), "userId", u.getId(),
"mobile", u.getMobile(), "email", u.getEmail(), "type", "UPDATE", "nickname", u.getNickname());
rabbitTemplate.convertAndSend(queueConfig.getExchange(), queueConfig.getQueues().getUser().getRoutingKey(), JSON.toJSONString(mqMsg));
// live
iRabbitMQSenderService.send(RabbitMQSenderImpl.LIVE_USER_ADD, u);
// 同步分润系统
iRabbitMQSenderService.send(RabbitMQSenderImpl.USER_MODIFY_PROFIT, u);
return ResponseUtil.ok(userLoginVO);
}
private String generateKey(String originalFilename) {
int index = originalFilename.lastIndexOf('.');
String suffix = originalFilename.substring(index);
String key = null;
Storage storageInfo = null;
do {
key = CharUtil.getRandomString(20) + suffix;
storageInfo = iStorageService.getOne(new QueryWrapper<Storage>().eq("storage_key", key));
}
while (storageInfo != null);
// 格式:head/yyyymmdd/[hash].png
return "head/" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + "/" + key;
}
/**
* 设置密码
*
* @param user
* @return
*/
@PostMapping("/psd/modify")
public Object setPs(@RequestBody User user, HttpServletRequest request) {
User u = userService.getOne(new QueryWrapper<User>().eq("user_name", user.getMobile()));
if (u == null) {
return ResponseUtil.result(10007);
}
if (!Integer.valueOf(ConstantsEnum.USER_STATUS_1.value().toString()).equals(u.getStatus())) {
return ResponseUtil.result(ConstantsEnum.USER_STATUS_0.value().toString().equals(u.getStatus()) ? 10032 : 10033);
}
String hexPassword;
try {
hexPassword = DigestUtils.sha1Hex(user.getPassword().getBytes("UTF-16LE"));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
u.setPassword(hexPassword);
u.setUpdateTime(LocalDateTime.now());
userService.updateById(u);
// BCryptPasswordEncoder bc = new BCryptPasswordEncoder();
// u.setPassword(bc.encode(user.getPassword()));
// u.setUpdateTime(LocalDateTime.now());
// userService.updateById(u);
UserLoginVO userLoginVO = null;
String userToken = request.getHeader(Constants.LOGIN_TOKEN_KEY);
if (StringUtils.isBlank(userToken)) {// 登录页面设置密码,新的token
userLoginVO = userService.packageUser(u, true);
} else {// 个人中心设置密码,userToken延用
userLoginVO = userService.packageUser(u, false);
userLoginVO.setUserToken(userToken);
}
return ResponseUtil.ok(userLoginVO);
}
/**
* 解除微信绑定
*
* @param userId
* @return
*/
@Transactional
@PostMapping("/wx/unbind")
public Object unBindWX(@LoginUser Long userId) {
/*UserBindThird one = iShopUserBindThirdService.getOne(new QueryWrapper<UserBindThird>().eq("user_id", userId)
.eq("bind_type", ConstantsEnum.USER_BIND_THIRD_TYPE_WEIXIN.value().toString()));
if (one != null) {
iShopUserBindThirdService.remove(new QueryWrapper<UserBindThird>().eq("bind_id", one.getBindId()));
}*/
iShopUserBindThirdService.remove(new QueryWrapper<UserBindThird>().eq("user_id", userId));
iShopUserSecurityCenterService.update(new UserSecurityCenter(),
new UpdateWrapper<UserSecurityCenter>().eq("id", userId).set("bind_weixin", 0));
return ResponseUtil.ok();
}
/**
* 登出
*
* @param userId
* @return
*/
@PostMapping("/logout")
public Object logout(@LoginUser Long userId, HttpServletRequest request) {
RedisUtil.del(request.getHeader(Constants.LOGIN_TOKEN_KEY));
userService.removeUserCache(userId);
return ResponseUtil.ok();
}
/**
* 我的首页中心
*
* @return
*/
@PostMapping("/index")
public Object index(@LoginUser Long userId, @RequestBody UserDTO userDTO) {
User user = userService.getById(userId);
// 订单数量
List<Order> orderList = iOrderService.list(new QueryWrapper<Order>().select("order_status").eq("user_id", userId));
Map<String, Object> map = new HashMap<>();
int waitPay = 0;
int waitShip = 0;
int waitReceipt = 0;
int finish = 0;
if (!orderList.isEmpty()) {
for (Order o : orderList) {
if (OrderStatus.WAIT_PAY.getId().equals(o.getOrderStatus())) {
waitPay++;
} else if (OrderStatus.WAIT_SHIP.getId().equals(o.getOrderStatus())) {
waitShip++;
} else if (OrderStatus.WAIT_DELIVER.getId().equals(o.getOrderStatus())) {
waitReceipt++;
} else if (OrderStatus.SUCCESS.getId().equals(o.getOrderStatus())) {
finish++;
}
}
}
map.put("waitPay", String.valueOf(waitPay));
map.put("waitShip", String.valueOf(waitShip));
map.put("waitReceipt", String.valueOf(waitReceipt));
map.put("finish", String.valueOf(finish));
int inviteSurplus = 0;
// 暂时没了
/*if (user.getPtLevel() == PtLevelType.PLUS.getId() && user.getPtFormal() == 0) {
inviteSurplus = iDictionaryService.findForLong(ConstantsEnum.LEVEL_SYSTEM.stringValue(), ConstantsEnum.DEPOSIT_UPGRADE_DA_NUMBER.stringValue()).intValue();
List<UserInvite> list = iUserInviteService.list(new QueryWrapper<UserInvite>().select("id").eq("pid", userId));
if (null != list && list.size() > 0) {
List<Long> userIds = list.stream().map(ui -> ui.getId()).collect(Collectors.toList());
int inviteSurplus2 = userService.count(new QueryWrapper<User>().eq("status", 1).eq("deleted", 0).eq("pt_level", PtLevelType.PLUS.getId()).in("id", userIds));
inviteSurplus = inviteSurplus2 >= inviteSurplus ? 0 : inviteSurplus - inviteSurplus2;
}
}*/
// 购物车数量
int cartNumber = iCartService.count(new QueryWrapper<Cart>().eq("user_id", userId).eq("deleted", ConstantsEnum.DELETED_0.integerValue()).eq("checked", 0));
Map<String, Object> backMap = new HashMap<>();
backMap.put("serverPhone", serverPhone);
backMap.put("order", map);
backMap.put("cartNumber", cartNumber);
backMap.put("inviteSurplus", inviteSurplus);
int ptLevel = 0;
String ptNo = "";
if (user != null) {
ptLevel = user.getPtLevel();
ptNo = user.getPtNo();
}
backMap.put("ptLevel", ptLevel);
backMap.put("ptNo", ptNo);
backMap.put("notifyNumber", iNotifyMsgService.count(new QueryWrapper<NotifyMsg>()
.eq("user_id", userId).eq("read_flag", 0).eq("platform", userDTO.getPlatform())));
Integer inviteCardVersion = userDTO.getInviteCardVersion();
List<Dictionary> dictionaryList = iDictionaryService.findByCategoryCache(IMAGE);
Map<String, String> dictionaryMap = dictionaryList.stream().collect(Collectors.toMap(Dictionary::getName, Dictionary::getStrVal));
backMap.put("inviteCardStar", dictionaryMap.getOrDefault(userDTO.getPlatform().toLowerCase() + "_inviteCardStar_" + inviteCardVersion, ""));// m星人
backMap.put("inviteCardPlus", dictionaryMap.getOrDefault(userDTO.getPlatform().toLowerCase() + "_inviteCardPlus_" + inviteCardVersion, ""));// m达人
backMap.put("inviteCardTrain", dictionaryMap.getOrDefault( userDTO.getPlatform().toLowerCase() + "_inviteCardTrain_" + inviteCardVersion, ""));// m体验官
backMap.put("inviteCardPartner", dictionaryMap.getOrDefault( userDTO.getPlatform().toLowerCase() + "_inviteCardPartner_" + inviteCardVersion, ""));// m司令合伙人
// 邀请好友
backMap.put("inviteFriendImage", dictionaryMap.getOrDefault( "inviteFriendImage", ""));
// 邀请服务商
backMap.put("inviteServiceProviderImage", dictionaryMap.getOrDefault("inviteServiceProviderImage", ""));
// 邀请vip
backMap.put("inviteVipImage", dictionaryMap.getOrDefault("inviteVipImage", ""));
// 邀请店长
backMap.put("inviteDianZhangImage", dictionaryMap.getOrDefault("inviteDianZhangImage", ""));
// 邀请总监
backMap.put("inviteZongjianImage", dictionaryMap.getOrDefault("inviteZongjianImage", ""));
// 邀请合伙人
backMap.put("inviteHehuorenImage", dictionaryMap.getOrDefault("inviteHehuorenImage", ""));
// 邀请联创
backMap.put("inviteLianChuangImage", dictionaryMap.getOrDefault("inviteLianChuangImage", ""));
return ResponseUtil.ok(backMap);
}
/**
* 微信绑定
*
* @param userId
* @param wxTokenDTO
* @return
*/
@Transactional
@PostMapping("/wx/bind")
public Object bindWx(@LoginUser Long userId, @RequestBody WxTokenDTO wxTokenDTO, HttpServletRequest request) throws Exception {
AppIdKeyDTO appIdKeyDTO = new AppIdKeyDTO();
BeanUtils.copyProperties(wxTokenDTO, appIdKeyDTO);
WxTokenCoreDTO wxTokenCoreDTO = new WxTokenCoreDTO();
BeanUtils.copyProperties(wxTokenDTO, wxTokenCoreDTO);
return ResponseUtil.ok(iAuthService.userWxBind(request, userId, wxTokenCoreDTO, appIdKeyDTO));
}
/**
* 我的首页中心
*
* @return
*/
@PostMapping("/team")
public Object team(@LoginUser Long userId, @RequestBody UserDTO dto) {
return null;
}
/**
* 根据邀请码获取用户信息(一点信息就行了)
*
* @return
*/
@PostMapping("/info/inviteCode")
public Object infoByInviteCode(@RequestBody User user) {
user = userService.getOne(new QueryWrapper<User>().eq("invite_code", user.getInviteCode()));
if (user == null) {
return ResponseUtil.badResult();
} else {
Map<String, Object> backMap = new HashMap<>();
backMap.put("nickname", user.getNickname());
backMap.put("headImgUrl", user.getHeadImgUrl());
backMap.put("ptLevel", user.getPtLevel());
backMap.put("ptNo", user.getPtNo());
return ResponseUtil.ok(backMap);
}
}
/**
* 实名认证信息
* @return
*/
@PostMapping("/real/name/info")
public Object realNameInfo(@LoginUser Long userId) {
User user = userService.getOne(new QueryWrapper<User>().select("name", "card_type", "card_no", "card_no_abbr", "realed").eq("id", userId));
return ResponseUtil.ok(user);
}
/**
* 实名认证
* @param realNameDTO
* @return
*/
@PostMapping("/real/name")
public Object realName(@LoginUser Long userId, @RequestBody RealNameDTO realNameDTO) {
Map<String, Object> map = new ObjectMapper().convertValue(realNameDTO, Map.class);
map.put("userId", userId);
map.put(ReqResEnum.MERC_ID.String(), authConfig.getMercId());
RealNameVO realNameVO = userService.realName(map);
Map<String, Object> backMap = new HashMap<>();
backMap.put("name", realNameVO.getName());
backMap.put("cardNoAbbr", realNameVO.getCardNoAbbr());
return ResponseUtil.ok(backMap);
}
/**
* 实名认证补录
* @param realNameDTO
* @return
*/
@PostMapping("/real/name/repair")
public Object realNameRepair(@LoginUser Long userId, @RequestBody RealNameDTO realNameDTO) {
User user = userService.getById(userId);
realNameDTO.setCardNo(user.getCardNo());
realNameDTO.setName(user.getName());
Map<String, Object> map = new ObjectMapper().convertValue(realNameDTO, Map.class);
map.put("userId", userId);
map.put(ReqResEnum.MERC_ID.String(), authConfig.getMercId());
RealNameVO realNameVO = userService.realName(map);
Map<String, Object> backMap = new HashMap<>();
backMap.put("name", realNameVO.getName());
backMap.put("cardNoAbbr", realNameVO.getCardNoAbbr());
return ResponseUtil.ok(backMap);
}
/**
* 加盟合作协议签名
*
* @param userId
* @param userDTO
* @return
*/
@PostMapping("/agreement/sign")
public Object agreementSign(@LoginUser Long userId, @RequestBody UserDTO userDTO){
log.info("|加盟合作协议签名|签名用户:{},请求参数:{}", userId, userDTO);
User user = userService.getById(userId);
user.setSigned(UserSignedEnum.YES.getId());
user.setSignImgUrl(userDTO.getSignImgUrl());
user.setSignTime(LocalDateTime.now());
boolean signFlag = userService.updateById(user);
if (!signFlag) {
return ResponseUtil.fail();
}
UserRedisVO userRedisVO = new UserRedisVO();
BeanUtils.copyProperties(user, userRedisVO);
RedisUtil.set(ConstantsEnum.REDIS_USER_MPMALL.stringValue() + userId, userRedisVO, 300);
return ResponseUtil.ok();
}
/**
* 获取用户协议签名信息
*
* @param userId
* @return
*/
@GetMapping("/get/agreement/sign")
public Object getAgreementSign(@LoginUser Long userId){
log.info("|加盟合作协议签名|获取签名信息:{},请求参数:{}", userId);
User user = userService.getOne(new QueryWrapper<User>().eq("id", userId));
Integer signed = user.getSigned();
if (UserSignedEnum.NO.getId() == signed) {
log.error("|加盟合作协议签名|获取签名信息|当前用户未进行协议签名");
throw new ShopException(10054);
}
Map<String,Object> userMap = new HashMap<>();
userMap.put("signImgUrl", user.getSignImgUrl());
userMap.put("signTime", user.getSignTime());
return ResponseUtil.ok(userMap);
}
/**
* 基本信息,php
* @param u
* @return
*/
@PostMapping("/base/info")
public Object baseInfo(@RequestBody User u) {
QueryWrapper<User> query = new QueryWrapper<User>();
if (null != u.getId()) {
query.eq("id", u.getId());
}
if (StringUtils.isNotBlank(u.getInviteCode())) {
query.eq("invite_code", u.getInviteCode());
}
User user = userService.getOne(query);
if (user == null) {
return ResponseUtil.badResult();
}
BaseInfoUserVO baseInfoUserVO = new BaseInfoUserVO();
BeanUtils.copyProperties(user, baseInfoUserVO);
UserInvite userInvite = iUserInviteService.getById(u.getId());
if (userInvite != null) {
baseInfoUserVO.setInviteUserId(userInvite.getPid());
} else {
baseInfoUserVO.setInviteUserId(0L);
}
//授权
UserPartner userPartner = iUserPartnerService.getById(u.getId());
if (userPartner != null) {
baseInfoUserVO.setAuthNo(userPartner.getAuthNo());
}
return baseInfoUserVO;
}
}
| [
"13509030019@163.com"
] | 13509030019@163.com |
6692c6bdb5bd3a1e0e1f33430a78f5fbc88ddd53 | 6e8bd444cca80ab38826c67570209459ad7cd35d | /src/main/java/stg/controller/BoardDOA.java | f6c77b4db59017f8e753671fd491b168f7710fbc | [] | no_license | Ryan-Gross1993/CheckersBoard | c2aa67a6601d3bc0b3308f67c850cf284e31d66b | d762183b1604b32c16a2a3d38b499c91ee5deef5 | refs/heads/master | 2021-01-22T20:02:43.183777 | 2017-03-17T05:48:18 | 2017-03-17T05:48:18 | 85,275,494 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 247 | java | package stg.controller;
import org.springframework.data.repository.CrudRepository;
/**
* Created by prestonbattin on 3/16/17.
*/
public interface BoardDOA extends CrudRepository<BoardEntity,Long> {
public BoardEntity findByid(int ID);
}
| [
"ryan@Ryans-MBP.home"
] | ryan@Ryans-MBP.home |
5692928b4860facb14847c3064385086fc3789d8 | 805099cb4ef731650fc4aa209b83874a7cb0ae1e | /common/src/main/java/com/hung/common/exceptions/BusinessException.java | 9e3cb9e0770b208dd9e13c2c249874e8f39c1e54 | [] | no_license | hungdng/eco | 3a93a42cde03ae06007a55d49e83404f90fb144a | 7a525ffb9ad110b0606665614cb01dd85394f25c | refs/heads/main | 2023-01-12T17:46:22.403207 | 2020-11-13T08:59:45 | 2020-11-13T08:59:45 | 309,649,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,126 | java | /**
* ****************************************************
* * Description :
* * File : BusinessException.java
* * Author : hung.tran
* * Date : Nov 09, 2020
* ****************************************************
**/
package com.hung.common.exceptions;
import com.hung.common.annotation.ResponseStatus;
import com.hung.common.enums.ECOResponseStatus;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@ResponseStatus(code = ECOResponseStatus.BUSINESS_FAILURE)
public class BusinessException extends RuntimeException {
private static final long serialVersionUID = 1L;
private ECOResponseStatus code;
public BusinessException(final String msg) {
super(msg);
log.error(msg);
}
public BusinessException(final String msg, final Throwable throwable) {
super(msg, throwable);
log.error(msg, throwable);
}
public BusinessException(final String msg,final ECOResponseStatus errorCode) {
super(msg);
this.code = errorCode;
log.error(msg,errorCode);
}
public ECOResponseStatus getCode() {
return this.code;
}
}
| [
"hungdng.92@gmail.com"
] | hungdng.92@gmail.com |
ddb99b90895b1dc68642f4f537cd4a9e4c270c1d | 99d7855486713fef7cc2a8faf6a91c9f7900f743 | /Programs/Ass7/src/VideoAdapter.java | ee3ce9f00e2b69b445ac0248ec5652c17d09345e | [] | no_license | Zyanede/Class-Projects | 09296d5ef2d78234c5c735c79f37a96aede7366b | a4773b5add11e4cd1ad8e34712e348ee16008e4a | refs/heads/master | 2016-09-15T21:35:57.572903 | 2014-03-06T19:44:32 | 2014-03-06T19:44:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 308 | java | import java.util.ArrayList;
public class VideoAdapter implements VideoCardPlug{
public void printList(ArrayList<String> list){
String listString = "";
for (String s : list){
listString += s + "\t";
}
TelevisionSocket printImage=new TelevisionSocket();
printImage.print(listString);
}
}
| [
"ashleigh.amrine@gmail.com"
] | ashleigh.amrine@gmail.com |
34be4b34783d481131eab77e0fe5358082875c16 | 5ac8461fafe368721a4e33c0938ee34ca3dbf10c | /app/src/main/java/com/dictionary/dictionary/Words.java | 377f2afcf4da9a7979d7c2752d9c328ff97fe3d4 | [] | no_license | tosheee/Dictionary | 0e86a992e2144d1d89092c05e6fcb4089a078308 | 62cb7046300c19f796272caf59802073dd1974d8 | refs/heads/master | 2020-04-16T04:58:59.025861 | 2019-04-28T16:15:05 | 2019-04-28T16:15:05 | 165,288,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 59 | java | package com.dictionary.dictionary;
public class Words {
}
| [
"tosheee@abv.bg"
] | tosheee@abv.bg |
8ba506a3119eaf7fed62da69e29be6a06c7e1c5b | 2b77ae9c2987d9a7e38b3af3ada6f09c7c95b102 | /backendbuzzpage/target/generated-sources/archetype/target/classes/archetype-resources/src/main/java/spring/EnhancedDefaultKeyGenerator.java | de4de299724f460370f28dccc331f957fc7b4adf | [] | no_license | samukapsilva/backendbuzzpage | 84993e673ff9e472c33dba26ad4b0dd196f9d8da | 0b682790d99d13c1b833633de8bf2a1651bc298f | refs/heads/master | 2020-07-23T15:49:53.312958 | 2016-08-19T19:51:03 | 2016-08-19T19:51:03 | 66,018,109 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,774 | java | #set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.spring;
import java.lang.reflect.Method;
import java.util.HashSet;
import org.springframework.cache.interceptor.KeyGenerator;
/**
* Default key generator. Returns {@value ${symbol_pound}NO_PARAM_KEY} if no parameters are
* provided, the parameter itself (if primitive type) if only one is given or a
* hash code computed from all given parameters' hash code values. Uses the
* constant value {@value ${symbol_pound}NULL_PARAM_KEY} for any {@code null} parameters
* given.
*
* @author Costin Leau
* @author Chris Beams
* @since 3.1
*/
public class EnhancedDefaultKeyGenerator implements KeyGenerator {
public static final int NO_PARAM_KEY = 0;
public static final int NULL_PARAM_KEY = 53;
private static final HashSet<Class<?>> WRAPPER_TYPES = getWrapperTypes();
public Object generate(Object target, Method method, Object... params) {
if (params.length == 1 && isWrapperType(params[0].getClass())) {
return (params[0] == null ? NULL_PARAM_KEY : params[0]);
}
if (params.length == 0) {
return NO_PARAM_KEY;
}
int hashCode = 17;
for (Object object : params) {
hashCode = 31 * hashCode + (object == null ? NULL_PARAM_KEY : object.hashCode());
}
return Integer.valueOf(hashCode);
}
public static boolean isWrapperType(Class<?> clazz) {
return WRAPPER_TYPES.contains(clazz);
}
private static HashSet<Class<?>> getWrapperTypes() {
HashSet<Class<?>> ret = new HashSet<Class<?>>();
ret.add(Boolean.class);
ret.add(Character.class);
ret.add(Byte.class);
ret.add(Short.class);
ret.add(Integer.class);
ret.add(Long.class);
ret.add(Float.class);
ret.add(Double.class);
ret.add(Void.class);
return ret;
}
} | [
"samukapsilva@gmail.com"
] | samukapsilva@gmail.com |
f3d0380e3f82ac71684f569c07960f67051067ed | a1d3aa27bfec92ef6c53c47135063a5b37eb79c4 | /BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/embedded/statistics/storage/reporting/TagGroupReportRow.java | daf3b8094a08aea1d04d5b3399571011eec5902f | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | 1ekrem/sailfish-core | 661159ca9c56a025302d6795c4e702568a588482 | b6051b1eb72b2bde5731a7e645f9ea4b8f92c514 | refs/heads/master | 2020-05-01T16:36:15.334838 | 2018-12-29T12:28:57 | 2018-12-29T13:33:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,606 | java | /******************************************************************************
* Copyright 2009-2018 Exactpro (Exactpro Systems Limited)
*
* 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.exactpro.sf.embedded.statistics.storage.reporting;
import java.io.Serializable;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@SuppressWarnings("serial")
public class TagGroupReportRow implements Serializable {
private String[] dimensionsPath;
private long totalExecTime;
private long totalTcCount;
private long passedCount;
private long failedCount;
private long conditionallyPassedCount;
private BigDecimal passedPercent;
private BigDecimal failedPercent;
private BigDecimal conditionallyPassedPercent;
private int totalMatrices;
private int failedMatrices;
private String formattedExecTime;
public String getPathEnd() {
if(this.dimensionsPath != null) {
return this.dimensionsPath[dimensionsPath.length-1];
} else {
return null;
}
}
public String[] getDimensionsPath() {
return dimensionsPath;
}
public void setDimensionsPath(String[] dimensionsPath) {
this.dimensionsPath = dimensionsPath;
}
public long getTotalExecTime() {
return totalExecTime;
}
public void setTotalExecTime(long totalExecTime) {
this.totalExecTime = totalExecTime;
}
public long getTotalTcCount() {
return totalTcCount;
}
public void setTotalTcCount(long totalTcCount) {
this.totalTcCount = totalTcCount;
}
public long getPassedCount() {
return passedCount;
}
public void setPassedCount(long passedCount) {
this.passedCount = passedCount;
}
public long getFailedCount() {
return failedCount;
}
public void setFailedCount(long failedCount) {
this.failedCount = failedCount;
}
public long getConditionallyPassedCount() {
return conditionallyPassedCount;
}
public void setConditionallyPassedCount(long conditionallyPassedCount) {
this.conditionallyPassedCount = conditionallyPassedCount;
}
public BigDecimal getPassedPercent() {
return passedPercent;
}
public void setPassedPercent(BigDecimal passedPercent) {
this.passedPercent = passedPercent;
}
public BigDecimal getFailedPercent() {
return failedPercent;
}
public void setFailedPercent(BigDecimal failedPercent) {
this.failedPercent = failedPercent;
}
public BigDecimal getConditionallyPassedPercent() {
return conditionallyPassedPercent;
}
public void setConditionallyPassedPercent(BigDecimal conditionallyPassedPercent) {
this.conditionallyPassedPercent = conditionallyPassedPercent;
}
public int getTotalMatrices() {
return totalMatrices;
}
public void setTotalMatrices(int totalMatrices) {
this.totalMatrices = totalMatrices;
}
public int getFailedMatrices() {
return failedMatrices;
}
public void setFailedMatrices(int failedMatrices) {
this.failedMatrices = failedMatrices;
}
@Override
public String toString() {
ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
builder.append("dimensionsPath", dimensionsPath);
builder.append("totalExecTime", totalExecTime);
builder.append("totalTcCount", totalTcCount);
builder.append("passedCount", passedCount);
builder.append("conditionallyPassedCount", conditionallyPassedCount);
builder.append("failedCount", failedCount);
builder.append("passedPercent", passedPercent);
builder.append("conditionallyPassedPercent", conditionallyPassedPercent);
builder.append("failedPercent", failedPercent);
builder.append("totalMatrices", totalMatrices);
return builder.toString();
}
public String getFormattedExecTime() {
return formattedExecTime;
}
public void setFormattedExecTime(String formattedExecTime) {
this.formattedExecTime = formattedExecTime;
}
}
| [
"nikita.smirnov@exactprosystems.com"
] | nikita.smirnov@exactprosystems.com |
966337c4a117301efa8c8e7867eff9a57ebdd111 | a44a0897f1ca810df2e69bb28d77793c591b49f8 | /src/main/java/com/globant/internal/oncocureassist/endpoint/MetadataController.java | 8ffdf32601d5e8cc704e2d9c9ff66e608dd2a886 | [] | no_license | globant-by-java/onco_cure_assist | d791d1d153a6e44fa59190c0776ecb7b91f05e74 | f1c494d0741b7df8660ee0aeed4d79fd5394a286 | refs/heads/master | 2020-04-21T01:32:37.828271 | 2019-03-15T15:13:07 | 2019-03-15T15:13:07 | 169,227,146 | 0 | 0 | null | 2019-03-15T15:13:08 | 2019-02-05T11:01:47 | Java | UTF-8 | Java | false | false | 758 | java | package com.globant.internal.oncocureassist.endpoint;
import com.globant.internal.oncocureassist.domain.metadata.GlobalMetadata;
import com.globant.internal.oncocureassist.service.MetadataService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/api/metadata")
public class MetadataController {
private final MetadataService metadataService;
public MetadataController(MetadataService metadataService) {
this.metadataService = metadataService;
}
@GetMapping
public GlobalMetadata get() {
return metadataService.provideMetadata();
}
}
| [
"yury.dudar@globant.com"
] | yury.dudar@globant.com |
70ca1c9e78c5e8cc960f4386ccc8af5161810469 | e6497b29091fa401a58d0813c9502e57fe713f9f | /AutoAssignment/src/main/java/facade/SolutionFacade.java | 6bc62a1a6f88a896482e6f33b752cd356fd13b8d | [] | no_license | mahnazzzz/semsterProject | d35ff654bd4cbd4f5c1c3b768129b3af28ea0803 | ccd0e0074472290b2157a8b28179c9d35f6be15a | refs/heads/master | 2021-03-27T11:46:29.523323 | 2018-02-03T23:49:22 | 2018-02-03T23:49:22 | 120,139,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,698 | java | package facade;
import entity.Solution;
import entity.SolutionPK;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
/**
*
* @author PeterBoss
*/
public class SolutionFacade {
private static EntityManagerFactory emf;
public void addEntityManagerFactory(EntityManagerFactory emf) {
this.emf = emf;
}
public void addSolution(Solution s) {
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
em.persist(s);
em.getTransaction().commit();
em.close();
}
public Solution getSpecificSolution(int userId, int assignmentId) {
EntityManager em = emf.createEntityManager();
Solution solution;
SolutionPK key = new SolutionPK(userId, assignmentId);
em.getTransaction().begin();
solution = em.find(Solution.class, key);
em.getTransaction().commit();
em.close();
return solution;
}
public List<Solution> getSolutionsByUser(int userId) {
EntityManager em = emf.createEntityManager();
List<Solution> solutions;
try {
solutions = em.createNamedQuery("Solution.findByUserId").setParameter("userId", userId).getResultList();
} finally {
em.close();
}
return solutions;
}
public List<Solution> getAllSolutions() {
EntityManager em = emf.createEntityManager();
List<Solution> solutions;
try {
solutions = em.createNamedQuery("Solution.findAll", Solution.class).getResultList();
} finally {
em.close();
}
return solutions;
}
}
| [
"mahnaazi@yahoo.com"
] | mahnaazi@yahoo.com |
99652ab946435083f0df3a150722528e2e8335fa | 70375ad64773d74e8882e45b2f7351b7739fa629 | /src/test/java/org/apache/ibatis/domain/blog/mappers/CopyOfAuthorMapper.java | baa2d58bd61041eae80b4feed93bf50ec9464bc9 | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | yangfancoming/mybatis | 104e64e3f1659ebe1228413f16c4a373e8bedd1c | 7cd9c6093a608a0e0da32155e75d1fddd090c8d5 | refs/heads/master | 2022-09-22T21:09:10.430995 | 2021-05-30T10:37:34 | 2021-05-30T10:37:34 | 195,225,348 | 0 | 0 | Apache-2.0 | 2022-09-08T01:01:18 | 2019-07-04T11:00:52 | Java | UTF-8 | Java | false | false | 472 | java |
package org.apache.ibatis.domain.blog.mappers;
import org.apache.ibatis.domain.blog.Author;
import org.apache.ibatis.session.ResultHandler;
import java.util.List;
public interface CopyOfAuthorMapper {
List selectAllAuthors();
void selectAllAuthors(ResultHandler handler);
Author selectAuthor(int id);
void selectAuthor(int id, ResultHandler handler);
void insertAuthor(Author author);
int deleteAuthor(int id);
int updateAuthor(Author author);
}
| [
"34465021+jwfl724168@users.noreply.github.com"
] | 34465021+jwfl724168@users.noreply.github.com |
bf8a8b37ddf68ae4f7371dd4c32be96451222c5e | a409581b7c2ac31ee0831119c27cc95e2d8003e7 | /AndroidApps/MyRunsAndroid/app/src/main/java/edu/dartmouth/cs/myruns/ExerciseEntryManager.java | 527aba4328230f3d25523547ecd0dbbc3612c74a | [] | no_license | emilycgreene/Emily_Greene_Application | a8983d9457d7ccfb9e11e69fbeb08e26cce1005f | f4657f5d46df392d9b9a78d25eaa379b253c694a | refs/heads/master | 2020-05-18T21:29:22.909447 | 2015-07-30T23:35:12 | 2015-07-30T23:35:12 | 39,922,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,027 | java | package edu.dartmouth.cs.myruns;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.Location;
import android.location.LocationManager;
import edu.dartmouth.cs.myruns.ExerciseEntryDbHelper.ExerciseCursor;
/**
* Created by garygreene on 2/1/15.
*/
public class ExerciseEntryManager {
private static final String TAG = "ExerciseEntryManager";
public static final String ACTION_LOCATION = "edu.dartmouth.cs.myruns.ACTION_LOCATION";
private static final String PREFS_FILE = "entries";
private static final String PREFS_CURRENT_ENTRY_ID = "ExerciseEntryManager.currentRunID";
private static ExerciseEntryManager sExerciseEntryManager;
private long mCurrentId;
private SharedPreferences mPref;
private ExerciseEntryDbHelper mHelper;
private Context mAppContext;
private LocationManager mLocationManger;
// private constructor that forces the user to use RunManager.get(Context)
private ExerciseEntryManager(Context appContext) {
mAppContext = appContext;
// set up the location manager
mLocationManger = (LocationManager) mAppContext
.getSystemService(Context.LOCATION_SERVICE);
// set up the database to store runs
mHelper = new ExerciseEntryDbHelper(mAppContext);
// get the current ID so you can keep incrementing it the app was killed
mPref = mAppContext.getSharedPreferences(PREFS_FILE, Context.MODE_PRIVATE);
mCurrentId = mPref.getLong(PREFS_CURRENT_ENTRY_ID, -1);
}
public static ExerciseEntryManager get(Context c) {
if (sExerciseEntryManager == null) {
// user the application context to avoid leaking activities
sExerciseEntryManager = new ExerciseEntryManager(c.getApplicationContext());
}
return sExerciseEntryManager;
}
// set up the intents that the location manager fires
private PendingIntent getLocationPendingIntent(boolean shouldCreate) {
Intent broadcast = new Intent(ACTION_LOCATION);
int flags = shouldCreate ? 0 : PendingIntent.FLAG_NO_CREATE;
return PendingIntent.getBroadcast(mAppContext, 0, broadcast, flags);
}
// start the location updates.
public void startLocationUpdates() {
String provider = LocationManager.GPS_PROVIDER;
// get the last known location abd broadcast it if you have one
Location lastKnown = mLocationManger.getLastKnownLocation(provider);
if (lastKnown != null) {
// Reset the time to now
lastKnown.setTime(System.currentTimeMillis());
broadcastLocation(lastKnown);
}
// Start updates from the location manager using the GPS as fast as possible
PendingIntent pi = getLocationPendingIntent(true);
// min time and min distance set to 0 -- not always a good idea.
mLocationManger.requestLocationUpdates(provider, 0, 0, pi);
}
// get the last known location back to the UI via the RunFragment
// by broadcasting an intent just like the Location Manger would
private void broadcastLocation(Location lastKnown) {
Intent broadcast = new Intent(ACTION_LOCATION);
broadcast.putExtra(LocationManager.KEY_LOCATION_CHANGED, lastKnown);
mAppContext.sendBroadcast(broadcast);
}
public void stopLocationUpdates() {
PendingIntent pi = getLocationPendingIntent(false);
if (pi != null) {
mLocationManger.removeUpdates(pi);
pi.cancel();
}
}
// Is the RunManager currently tracking a run
// we overload the method for two calls in RunFragment
public boolean isTrackingExercise(ExerciseEntry entry) {
return entry != null && entry.getId() == mCurrentId;
}
public boolean isTrackingExercise() {
return getLocationPendingIntent(false) != null;
}
// **INSERT methods: location and insert run methods. Helper hides
// a lot of the database specifics
// create and insert into the database and save the id in the run
public ExerciseEntry insertEntry() {
ExerciseEntry entry = new ExerciseEntry();
entry.setId(mHelper.insertEntry(entry));
return entry;
}
// // insert location into the database
// public void insertLocation(Location loc) {
// if (mCurrentId != -1) {
// mHelper.insertLocation(mCurrentId, loc);
// } else {
// Log.e(TAG, "Location received with no tracking run; ignoring");
// }
// }
//
//
// // get a single run and return it from the database
// public Location getLastLocationForRun(long runId) {
// Location location = null;
// LocationCursor cursor = mHelper.queryLastLocation(runId);
// cursor.moveToFirst();
// // if you got a row, then get a location
// if (!cursor.isAfterLast())
// location = cursor.getLocation();
// cursor.close();
// return location;
// }
// A number of methods for creating, tracking and
// stopping runs
// create a new Run, insert it in the db and start tracking it.
public ExerciseEntry startNewEntry() {
// created a new Run and insert it into the db
ExerciseEntry entry = insertEntry();
// get the run you just inserted to check
ExerciseEntry query = getEntry(entry.getId());
// start tracking the run
startTrackingExercise(entry);
return entry;
}
// query all the runs in the DB. Returns a RunCursor (it's a wrapper)
// that includes all the runs in the DB
public ExerciseCursor queryEntries() {
return mHelper.queryEntries();
}
// get a single run and return it from the database
public ExerciseEntry getEntry(long id) {
ExerciseEntry entry = null;
ExerciseCursor cursor = mHelper.queryEntry(id);
cursor.moveToFirst();
// make sure you have a single row
if (!cursor.isAfterLast())
entry = cursor.getExerciseEntry();
cursor.close();
return entry;
}
// start tracking for a run, make sure you save the current ID
public void startTrackingExercise(ExerciseEntry entry) {
// Keep the ID
mCurrentId = entry.getId();
// save the current run id in case app is killed
mPref = mAppContext.getSharedPreferences(PREFS_FILE, Context.MODE_PRIVATE);
mPref.edit().putLong(PREFS_CURRENT_ENTRY_ID, mCurrentId).commit();
// now start the location updates
startLocationUpdates();
}
// finally, stop the run, make sure we remove the current run ID; it's
// stop so we don't want the app to restart it if it comes back from being killed;
// so clear out the id.
public void stopExercise() {
stopLocationUpdates();
mCurrentId = -1;
mPref.edit().remove(PREFS_CURRENT_ENTRY_ID).commit();
}
}
| [
"Emily.C.Greene.17@dartmouth.edu"
] | Emily.C.Greene.17@dartmouth.edu |
7e0823f9bd5992440476dc22482a87ef4657adeb | 1b3f1498bcc8d3fae5957beb4a6034a66a42ab1f | /MobileMotionCollector/src/at/ac/tuwien/motioncollector/osc/CollectorEndpoint.java | f96083931b9ccfa6fcb9caff57dc21546e60af7a | [] | no_license | blackaceatzworg/Simulations | d90a5c20de6e68e3880ef4c2fda132dd7d2160be | 834637e7678277709ccbd60ca75a1f8f9f287937 | refs/heads/master | 2016-09-05T15:13:03.416436 | 2013-11-18T07:34:58 | 2013-11-18T07:34:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,857 | java | package at.ac.tuwien.motioncollector.osc;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.net.SocketException;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import at.ac.tuwien.motioncollector.model.Position;
import com.illposed.osc.OSCListener;
import com.illposed.osc.OSCPortIn;
import com.illposed.osc.OSCMessage;
public class CollectorEndpoint implements Runnable {
List<DeviceDataHandler> dataHandlers;
BufferedWriter fileWriter;
protected void createNewFile() throws IOException {
SimpleDateFormat sdf = new SimpleDateFormat("hh_mm_ss");
// File csv = new File("/Users/daniel/temp/movement_"
// + sdf.format(new Date()) + ".csv");
File csv = new File("/Users/daniel/temp/movement.csv");
if(csv.exists()){
csv.delete();
}
this.fileWriter = new BufferedWriter(new FileWriter(csv));
}
public void run() {
try {
// File db = new File("/Users/daniel/temp/db/");
// for(File f:db.listFiles()){
// f.delete();
// }
// final StorageService service = FileDBStorageService
// .createInstance("/Users/daniel/temp/db/audience", "audience",
// "audience");
// service.createDatabase();
OSCPortIn receiver = new OSCPortIn(8000);
OSCListener listener = new OSCListener() {
private UUID userid = UUID.randomUUID();
private boolean isListening = false;
public void acceptMessage(java.util.Date time,
OSCMessage message) {
Date t = new Date();
Object[] parameter = message.getArguments();
if (parameter.length == 1 && parameter[0] instanceof String) {
try {
if (((String) parameter[0]).equals("start")) {
CollectorEndpoint.this.createNewFile();
CollectorEndpoint.this.fileWriter
.write("Date;x;y;z\n");
this.isListening = true;
} else if (((String) parameter[0]).equals("stop")) {
if(CollectorEndpoint.this.fileWriter != null){
CollectorEndpoint.this.fileWriter.close();
}
this.isListening = false;
}
return;
} catch (IOException e) {
e.printStackTrace();
}
}
if(!isListening){
return;
}
Position p = new Position((Float) parameter[0],
(Float) parameter[1], (Float) parameter[2]);
String macAddr = "no mac provided";
if (parameter.length == 4) {
macAddr = (String) parameter[3];
}
// try {
// service.SavePositionData(this.userid, t, p);
//
//
// } catch (SQLException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
SimpleDateFormat sdf2 = new SimpleDateFormat(
"yyyy-MM-dd hh:mm:ss.SSS");
try {
CollectorEndpoint.this.fileWriter.write(sdf2
.format(new Date())
+ ";"
+ String.valueOf(p.getX())
+ ";"
+ String.valueOf(p.getY())
+ ";"
+ String.valueOf(p.getZ()) + "\n");
CollectorEndpoint.this.fileWriter.flush();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss:SSS");
System.out
.println(String
.format("%s - x: %f - y: %f - z: %f - time: %s - address: %s",
message.getAddress(), p.getX(),
p.getY(), p.getZ(),
sdf.format(new Date()), macAddr));
}
};
receiver.addListener("/accxyz", listener);
receiver.startListening();
} catch (SocketException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"d.pfeiffer404@gmail.com"
] | d.pfeiffer404@gmail.com |
caa6577080da168481841116eb757c87d04a3b0f | a7d822e9bab5687be8a95e37a803aab5dec3ab8f | /Homework09/app/src/main/java/com/example/ss899/homework09/ConversationAdapter.java | 070279aa9658f604faa31f6e7cebc182f83a1d44 | [] | no_license | sramdohkar/myRepo | c3768ca40c82f4b4801ff188264e4d15cc0195d2 | 1032b2ea3f561003a66300a78dc9000d2911f8da | refs/heads/master | 2021-01-13T16:39:13.366154 | 2017-02-13T09:51:33 | 2017-02-13T09:51:33 | 78,613,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,997 | java | package com.example.ss899.homework09;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.support.v4.app.ActivityCompat;
import android.util.Base64;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
/**
* Created by shash on 17/04/2016.
*/
public class ConversationAdapter extends ArrayAdapter<User> {
List<User> mData;
Context mContext;
int mResource;
public ConversationAdapter(Context context, int resource, List<User> objects) {
super(context, resource, objects);
this.mContext = context;
this.mData = objects;
this.mResource = resource;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(mResource, parent, false);
}
String testImage = "iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAYAAAA8AXHiAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAFcklEQVR4Xu3bMW4bSRSEYZ9JjvcOm+4hNtIFNlboeA+gbI8gwLEDRTqAUgW6greDBh6In+SQ1d2socrAF6jedI/1VLYEA/72/6/vERNgGKHCMEKFYYQKwwgVhhEqDCNUGEaoMIxQYRihwjBChWGECsMIFYYRKgwjVBhGqDCMUGEYocIwQoVhhArDCBWGESoMI1QYRqgwjFBhGKHCMEKFYYQKwwgVhhEqDCNUGEaoMIxQYRihwjBChWGECsMIFYZ2Pj8/f8XnL9qNKQzt0JK/ItqNKQzt0JK/ItqNKQzt0JI/Pj5+Pj4+/knP71n7nNrnRp8zPW8KQzu05ObeynWqVA2dMYWhnbrcw8XfS7nOlaqhc6YwtFOXS1+AvZfrWKmen5//rh/TWVMY2jlc7j2V61Sp2rxmh2eNYWiHlnsP5TpXqqbm9aw5DO0cW+6ey7WlVE2d1dwchnZOLXeP5dpaqqbOD2fGMLRzbrl7KtclpWrqMzQ3haGdLcvdQ7kuLVVTn6O5KQztbF2uc7muKVVTn6W5KQztXLJcx3I9PDz8cU2pmvo8zU1haOfS5TqVq5Xq/f39v/p7abaUqqlnaG4KQzvXLNehXGqpmnqO5qYwtHPtcm9ZrhGlaupZmpvC0I6y3FuUa1Spmnqe5qYwtKMud2W5RpaqqXfQ3BSGdkYsd0W5jpXq5eXlH3p+i3oPzU1haGfUcmeW61ipXl9ff9DzW9W7aG4KQzsjlzujXLNK1dT7aG4KQzujlzuyXDNL1dQ7aW4KQzszljuiXLNL1dR7aW4KQzuzlquUa0Wpmno3zU1haGfmcq8p16pSNfV+mpvC0M7s5V5SrpWlauo7aG4KQzsrlrulXKtL1dT30NwUhnZWLfdUuW5Rqqa+i+amMLSzcrnHyvX29vZvzZrZpWrq+2huCkM7q5dL5Tq0olRNfSfNTWFo5xbLPVWuVaVq6ntpbgpDO7daLn37a1rp6PkZ6ntpbgpDO7dYbvtbqb636j/Q07nR6ntpbgpDO6uXe6pU3apy1XfS3BSGdlYul0rV/pnh6enpr8OfuVaUq76P5qYwtLNqucdK1f4Nq83pB/rZ5arvorkpDO2sWO65UnWry1XfQ3NTGNqZvdytpepWlqu+g+amMLQzc7mXlqpbVa56P81NYWhn1nKvLVW3olz1bpqbwtDOjOWqpepml6veS3NTGNoZvdxRpepmlqveSXNTGNoZudzRpepmlaveR3NTGNoZtdz2H0frXc2IUnUzylXvorkpDO2MWG77L+71nmZkqbrR5ar30NwUhnbU5a4qVTeyXPUOmpvC0I6y3NWl6kaVq56nuSkM7Vy73FuVqhtRrnqW5qYwtHPNcm9dqk4tVz1Hc1MY2rl0uVSq9sVcXapOKVc9Q3NTGNq5ZLnHSnXJt58Zri1XfZ7mpjC0s3W5rqXqrilXfZbmpjC0s2W57qXqLi1XfY7mpjC0c265eylVd0m56jOHM2MY2jm13L2VqttarjqvuTkM7Rxb7l5L1W0pV53Vs+YwtEPL3XupunPlqvnhWWMY2jlc7r2UqjtVrprRWVMY2qnLvbdSdcfKVT+mc6YwtFOXe+xPNp3bGypXRWdMYWiHltzcU6m6U+Wi501haIeW/BXRbkxhaIeW/BXRbkxhaIeW/BXRbkxhGKHCMEKFYYQKwwgVhhEqDCNUGEaoMIxQYRihwjBChWGECsMIFYYRKgwjVBhGqDCMUGEYocIwQoVhhArDCBWGESoMI1QYRqgwjFBhGKHCMEKFYYQKwwgVhhEqDCNUGEaoMIxQYRihwjBChWGECsMIFYYRKgwjVBhGqDCMUGEYocIwQoVhhArDCBWGESoMI1QYRgi+ff8Nm8F1qnaW1J0AAAAASUVORK5CYII=";
final User user = mData.get(position);
TextView txtName = (TextView) convertView.findViewById(R.id.txtName);
ImageView imgPhoto = (ImageView) convertView.findViewById(R.id.imageViewThumb);
ImageView imgStatus = (ImageView) convertView.findViewById(R.id.imageStatus);
ImageView imgCall = (ImageView) convertView.findViewById(R.id.imageCall);
// imgCall.setVisibility(View.INVISIBLE);
// String testImage=user.getpicture();
if (user.getpicture() == null || !user.getpicture().equals(null) || !user.getpicture().equals("")) {
byte[] decodedString = Base64.decode(user.getpicture(), Base64.DEFAULT); //Base64.decode(testImage, Base64.DEFAULT);
Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
imgPhoto.setImageBitmap(decodedByte);
} else {
byte[] decodedString = Base64.decode(user.getpicture(), Base64.DEFAULT);
Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
imgPhoto.setImageBitmap(decodedByte);
}
txtName.setText(user.getFullName());
if (user.getStatus().equals("false")) {
imgStatus.setImageResource(R.drawable.red_bubble_clipart_1);
}
// imgCall.setImageResource(R.drawable.phone_icon_hi);
// if ( Build.VERSION.SDK_INT >= 23 &&
// ContextCompat.checkSelfPermission(mContext, Manifest.permission.CALL_PHONE) == PackageManager.PERMISSION_GRANTED) {
//
// }
/* imgCall.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + user.getPhoneNumber()));
if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
mContext.startActivity(intent);
}
});*/
return convertView;
}
}
| [
"shashank.ramdohkar@outlook.com"
] | shashank.ramdohkar@outlook.com |
847654669b4ec136bc7ae9708aa4790588ffb55e | 9f267a03724d745f6c800a1be350ca7ccb6c357c | /Card.java | 801a34fde3cfccfea610ba48cc6ed87b9f512f8b | [] | no_license | OkaGouhei/BlackJack_4 | e2bd7fb3f7fd8ef9fd1e6f30cd0acf84716060f1 | 8c2b149265f5d895826943e7a09dcbc2a739cc7f | refs/heads/master | 2020-04-29T01:06:54.356355 | 2019-03-16T22:58:09 | 2019-03-16T22:58:09 | 175,719,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,627 | java | import java.util.Random;
import java.util.ArrayList;
import java.util.List;
//player_card ,dealer_card 両方に使えるクラスを作る
class Card{
List<Integer> card;
public Card(){
card = new ArrayList<Integer>();//playerのカードが格納されるList
}
/**
* show_card メソッド
* 持ちカードを表示する
*/
public void show_card(){
for(int i =0; i < card.size() ; i++){
card_no_mark(card.get(i));
}
}
/**
* dealer_show_card メソッド
* dealer の持ちカードを表示する
* ただし Hole Card は表示しない
*/
public void dealer_show_card(){
System.out.println("Hole Card");
for(int i =1; i < card.size() ; i++){//i = 1 と
card_no_mark(card.get(i));
}
}
/**
* card_no_mark メソッド
* トランプのナンバー、マークを表示する
* number には 1-13 までが格納される
* mark_num には 0-3までが格納される
*/
public void card_no_mark(int card_no_mark){
int number = card_no_mark % 13 +1;
int mark_num = card_no_mark % 4;
String mark[] = {"❤️ ", "♣️ ", "♦️ ","♠️ "};
System.out.println(mark[mark_num ]+":"+number);
}
/**
* point_card メソッド
* 持ちカードのポイントを表示する
* とりあえずAは1とカウント(後で場合分けして修正)
* 返り値はポイント数
*/
public int point_card(){
int point = 0;
for(Integer i : card){
int mark_num = i % 13 + 1;
if(mark_num < 10){
point += mark_num;
}else{
point += 10;
}
}
return point;
}
}
| [
"g.oka1975@gmail.com"
] | g.oka1975@gmail.com |
c807eee6e4ca651818a7364f512fbc41771e0e13 | 44ea81a2cc9f1d357c2e66b3c996a650ea62c2d5 | /src/main/java/org/alking/tecent/ai/face/FaceVerifyReply.java | 7f3b2d4d1c37abc892253dc9e811a4b4a5d69ac3 | [] | no_license | aijingsun6/tecent-ai-java | b8ba86f596a3a01954c9eb0cc46925193262b407 | 417590e76fece8de72b0e51701d301f4f6f971a1 | refs/heads/master | 2020-04-02T16:21:29.114118 | 2018-10-27T12:09:14 | 2018-10-27T12:09:14 | 154,608,968 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 825 | java | package org.alking.tecent.ai.face;
import com.google.gson.annotations.SerializedName;
import org.alking.tecent.ai.domain.BaseReply;
public class FaceVerifyReply extends BaseReply<FaceVerifyReply.Data> {
public static class Data {
@SerializedName("ismatch")
private Integer isMatch;
@SerializedName("confidence")
private Double confidence;
public Integer getIsMatch() {
return isMatch;
}
public void setIsMatch(Integer isMatch) {
this.isMatch = isMatch;
}
public Double getConfidence() {
return confidence;
}
public void setConfidence(Double confidence) {
this.confidence = confidence;
}
public Data() {
}
}
public FaceVerifyReply() {
}
}
| [
"aijingsun6@gmail.com"
] | aijingsun6@gmail.com |
5382aece1e5a14c6e88591e693dc12d42948fada | 1797991000059044a315e7a9341891dbbb7c90ae | /Data_class_1.java | e0e4b730bbaf4960b566000c17b59c2b7ce5f7de | [] | no_license | easywayautomation-koly/home_work_day08 | f1dcedd19584b64ce681330f3ed8f9dda149d90e | 5acaee8cd3e30fbce82d893f7dbbc1ac6c779e7f | refs/heads/master | 2022-12-15T18:20:26.697900 | 2020-09-06T19:10:08 | 2020-09-06T19:10:08 | 293,343,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 133 | java | package home_work_day08;
public class Data_class_1 {
public String SSN;
public String Studentname;
public String CourseName;
}
| [
"easywayautomation.koly@gmail.com"
] | easywayautomation.koly@gmail.com |
674595ec0fa04a513dab4cc0dbe6539ca7853416 | 47e7b03ccd007aaf4a388f2cee4c170aff835d99 | /src/main/java/com/gagan/server/service/implementation/AuthService.java | f30f8712ffd613be81ea03e51625c0767c4207c9 | [] | no_license | Gagandeep39/server-transaction-viewver | c6d47be4bbfb394678d16a47c913982cc1adec90 | eea54150c5b7131ce9cd934702484d23c7cb10fc | refs/heads/master | 2023-02-03T06:25:33.869767 | 2020-12-24T19:57:31 | 2020-12-24T19:57:31 | 324,146,530 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,646 | java | package com.gagan.server.service.implementation;
import com.gagan.server.domain.User;
import com.gagan.server.exceptions.InvalidCredentialException;
import com.gagan.server.model.JwtRequest;
import com.gagan.server.model.JwtResponse;
import com.gagan.server.repos.UserRepository;
import com.gagan.server.security.JwtProvider;
import com.gagan.server.service.IAuthService;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import lombok.AllArgsConstructor;
@Service
@AllArgsConstructor
public class AuthService implements IAuthService {
private final UserRepository userRepository;
private final PasswordEncoder passwordEncoder;
private final JwtProvider jwtProvider;
@Override
public JwtResponse login(JwtRequest loginRequest) {
User user = findUserByCredentials(loginRequest.getUserId(), loginRequest.getPassword());
return JwtResponse.builder()
.userId(user.getUserid())
.token(jwtProvider.generateTokenWithUsername(user.getUserid().toString()))
.build();
}
@Override
public boolean checkIfUsernameExists(String username) {
return false;
}
@Transactional(readOnly = true)
public User findUserByCredentials(Integer username, String password) {
User user = userRepository.findById(username)
.orElseThrow(() -> new InvalidCredentialException("userId", "User " + username + " doesn't exist"));
if (!passwordEncoder.matches(password, user.getPassword())) throw new InvalidCredentialException("password", "Invalid Password");
return user;
}
}
| [
"singh.gagandeep3911@gmail.com"
] | singh.gagandeep3911@gmail.com |
0914ea06e22d0d2e8fb0301f4453c07c01b92677 | 2222a9e4235623406c0640badd3cd281e487e4ac | /HelloWorldSWT/src/HelloWorldSWT.java | eb84db935b37572d339983923c6949e11f4c4f9c | [] | no_license | RayNieva/JavaAndEclipse | e84220ac25151e00afd53ef21c637cb1329a683a | 657c58d14c6bc646891a6f3917d42071f2c4722f | refs/heads/master | 2020-04-17T13:31:58.115219 | 2019-01-20T03:34:19 | 2019-01-20T03:34:19 | 166,619,611 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 425 | java | import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class HelloWorldSWT {
public static void main(String[] args) {
// TODO Auto-generated method stub
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Hello world!");
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
}
| [
"raynieva@gmail.com"
] | raynieva@gmail.com |
6d1d002d1c37b66ee71845d5b9762b6063a47d3d | 58e481b94b6ccc57aad471751c5539cebf07c9f0 | /search/src/main/java/com/search/util/ConfigProperties.java | 6456d867e87a3af920884e195d615391bb858355 | [] | no_license | onyas/web | 8a52523a6e126d9643176dde9a6c8458b9ceffc4 | b9e51151faa4bee786940599102dd90577f79bb0 | refs/heads/master | 2021-01-16T21:18:37.818019 | 2015-09-28T09:39:47 | 2015-09-28T09:39:47 | 18,627,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,926 | java | package com.search.util;
import java.io.InputStream;
import java.net.URL;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* ConfigProperties 读取配置文件类
*
* @author lzh
*/
public class ConfigProperties {
private static final Logger log = LoggerFactory
.getLogger(ConfigProperties.class);
// 属性配置文件名称
public static final String ENCODING = "utf-8";
public static final String CONFIG_FILENAME = "config.properties";
public static final char LIST_DELIMITER = '@';
// 是否已启用FileChangedReloadingStrategy策略
private static boolean strategyReloaded = false;
private static PropertiesConfiguration CONFIG_PROPERTIES = new PropertiesConfiguration();
/**
* 私有构造函数,以防止实例化
*/
private ConfigProperties() {
}
public static void init() {
}
static {
URL url = ClassLoaderUtils.getResource(CONFIG_FILENAME,
ConfigProperties.class);
if (url != null) {
try {
// 防止中文出现乱码
CONFIG_PROPERTIES.setEncoding(ENCODING);
CONFIG_PROPERTIES.setListDelimiter(LIST_DELIMITER);
CONFIG_PROPERTIES.load(CONFIG_FILENAME);
log.info(new StringBuffer().append("加载属性配置文件[")
.append(CONFIG_FILENAME).append("]成功!").toString());
} catch (ConfigurationException e) {
log.error(
new StringBuffer().append("加载属性配置文件[")
.append(CONFIG_FILENAME).append("]出错!")
.toString(), e);
}
} else {
log.warn(new StringBuffer().append("属性配置文件[")
.append(CONFIG_FILENAME).append("]不存在!").toString());
}
}
/**
* 手工启用Automatic Reloading(自动重新加载)策略
*/
public synchronized static void setReloadingStrategy() {
if (!strategyReloaded) {
CONFIG_PROPERTIES
.setReloadingStrategy(new FileChangedReloadingStrategy());
strategyReloaded = true;
}
}
/**
* 加载属性配置文件
*
* @param class1
* 类的class
* @param propertiesFileName
* 属性配置文件名称
* @return
*/
public static Properties getProperties(Class<?> class1,
String propertiesFileName) {
InputStream is = null;
Properties properties = new Properties();
try {
is = class1.getResourceAsStream(propertiesFileName);
properties.load(is);
} catch (Exception e) {
log.error("加载类[" + class1.getName() + "]相关的属性配置文件["
+ propertiesFileName + "]失败!", e);
} finally {
IOUtils.closeQuietly(is);
}
return properties;
}
/**
* 判断属性键是否存在
*
* @param configuration
* org.apache.commons.configuration.PropertiesConfiguration对象
* @param strKey
* 属性键
* @return 存在返回true,否则返回false
*/
public static boolean containsKey(PropertiesConfiguration configuration,
String strKey) {
return configuration.containsKey(strKey);
}
/**
* 根据属性键获取属性值
*
* @param configuration
* org.apache.commons.configuration.PropertiesConfiguration对象
* @param strKey
* 属性键
* @return 字符串
*/
public static String getPropertyByKey(
PropertiesConfiguration configuration, String strKey) {
if (configuration.containsKey(strKey)) {
return configuration.getString(strKey, "");
}
log.warn("配置文件中不存在键[" + strKey + "]的配置项,取默认值[]");
return "";
}
/**
* 根据属性键获取属性值
*
* @param configuration
* org.apache.commons.configuration.PropertiesConfiguration对象
* @param strKey
* 属性键
* @return 字符串数组
*/
public static String[] getArrayValueByKey(
PropertiesConfiguration configuration, String strKey) {
if (configuration.containsKey(strKey)) {
return configuration.getStringArray(strKey);
}
return new String[] {};
}
/**
* 根据属性键获取属性值
*
* @param configuration
* org.apache.commons.configuration.PropertiesConfiguration对象
* @param strKey
* 属性键
* @param defaultValue
* 默认值
* @return int整形
*/
public static int getIntPropertyByKey(
PropertiesConfiguration configuration, String strKey,
int defaultValue) {
if (configuration.containsKey(strKey)) {
return configuration.getInt(strKey, defaultValue);
}
log.warn("配置文件中不存在键[" + strKey + "]的配置项,取默认值[" + defaultValue + "]");
return defaultValue;
}
/**
* 根据属性键获取属性值
*
* @param configuration
* org.apache.commons.configuration.PropertiesConfiguration对象
* @param strKey
* 属性键
* @return int整形,若key不存在,则返回-1
*/
public static int getIntPropertyByKey(
PropertiesConfiguration configuration, String strKey) {
return getIntPropertyByKey(configuration, strKey, -1);
}
/**
* 根据属性键获取属性值
*
* @param configuration
* org.apache.commons.configuration.PropertiesConfiguration对象
* @param strKey
* 属性键
* @param defaultValue
* 默认值
* @return double双浮点型
*/
public static double getDoublePropertyByKey(
PropertiesConfiguration configuration, String strKey,
double defaultValue) {
if (configuration.containsKey(strKey)) {
return configuration.getDouble(strKey, defaultValue);
}
log.warn("配置文件中不存在键[" + strKey + "]的配置项,取默认值[" + defaultValue + "]");
return defaultValue;
}
/**
* 根据属性键获取属性值
*
* @param configuration
* org.apache.commons.configuration.PropertiesConfiguration对象
* @param strKey
* 属性键
* @param defaultValue
* 默认值
* @return float单浮点型
*/
public static float getFloatPropertyByKey(
PropertiesConfiguration configuration, String strKey,
float defaultValue) {
if (configuration.containsKey(strKey)) {
return configuration.getFloat(strKey, defaultValue);
}
log.warn("配置文件中不存在键[" + strKey + "]的配置项,取默认值[" + defaultValue + "]");
return defaultValue;
}
/**
* 根据属性键获取属性值
*
* @param configuration
* org.apache.commons.configuration.PropertiesConfiguration对象
* @param strKey
* 属性键
* @param defaultValue
* 默认值
* @return long长整型
*/
public static long getLongPropertyByKey(
PropertiesConfiguration configuration, String strKey,
long defaultValue) {
if (configuration.containsKey(strKey)) {
return configuration.getLong(strKey, defaultValue);
}
log.warn("配置文件中不存在键[" + strKey + "]的配置项,取默认值[" + defaultValue + "]");
return defaultValue;
}
/**
* 根据属性键获取属性值
*
* @param configuration
* org.apache.commons.configuration.PropertiesConfiguration对象
* @param strKey
* 属性键
* @param defaultValue
* 默认值
* @return boolean类型
*/
public static boolean getBooleanPropertyByKey(
PropertiesConfiguration configuration, String strKey,
boolean defaultValue) {
if (configuration.containsKey(strKey)) {
return configuration.getBoolean(strKey, defaultValue);
}
log.warn("配置文件中不存在键[" + strKey + "]的配置项,取默认值[" + defaultValue + "]");
return defaultValue;
}
/**
* 判断属性键是否存在
*
* @param strKey
* 属性键
* @return 字符串
*/
public static boolean containsKey(String key) {
return containsKey(CONFIG_PROPERTIES, key);
}
/**
* 根据属性键获取属性值
*
* @param strKey
* 属性键
* @return 字符串
*/
public static String getPropertyValue(String key) {
return getPropertyByKey(CONFIG_PROPERTIES, key);
}
/**
* 根据属性键获取属性值
*
* @param strKey
* 属性键
* @return 字符串数组
*/
public static String[] getPropertiesArrayValue(String key) {
return getArrayValueByKey(CONFIG_PROPERTIES, key);
}
/**
* 根据属性键获取属性值
*
* @param strKey
* 属性键
* @param defaultValue
* 默认值
* @return int整型
*/
public static int getIntPropertyValue(String key, int defaultValue) {
return getIntPropertyByKey(CONFIG_PROPERTIES, key, defaultValue);
}
/**
* 根据属性键获取属性值
*
* @param strKey
* 属性键
* @param defaultValue
* 默认值
* @return double双浮点型
*/
public static double getDoublePropertyValue(String key, double defaultValue) {
return getDoublePropertyByKey(CONFIG_PROPERTIES, key, defaultValue);
}
/**
* 根据属性键获取属性值
*
* @param strKey
* 属性键
* @param defaultValue
* 默认值
* @return float单浮点型
*/
public static float getFloatPropertyValue(String key, float defaultValue) {
return getFloatPropertyByKey(CONFIG_PROPERTIES, key, defaultValue);
}
/**
* 根据属性键获取属性值
*
* @param strKey
* 属性键
* @param defaultValue
* 默认值
* @return long长整型
*/
public static long getLongPropertyValue(String key, long defaultValue) {
return getLongPropertyByKey(CONFIG_PROPERTIES, key, defaultValue);
}
/**
* 根据属性键获取属性值
*
* @param strKey
* 属性键
* @param defaultValue
* 默认值
* @return boolean类型
*/
public static boolean getBooleanPropertyValue(String key) {
return getBooleanPropertyByKey(CONFIG_PROPERTIES, key, false);
}
/**
* 保存属性配置文件
*
* @param configuration
* @throws ConfigurationException
*/
public static void saveProperties(String propertiesFileName,
Map<String, Object> map) throws ConfigurationException {
if (map == null || map.size() == 0) {
// throw new Exception();
log.error("属性配置文件[" + propertiesFileName + "]无需要保存的属性列表!");
}
PropertiesConfiguration configuration = new PropertiesConfiguration(
propertiesFileName);
for (Entry<String, Object> entry : map.entrySet()) {
configuration.setProperty(entry.getKey(), entry.getValue());
}
configuration.save();
}
/**
* 保存属性配置文件
*
* @param configuration
* @throws ConfigurationException
*/
public static void savePropertiesAsNew(String propertiesFileName,
Map<String, Object> map, String newPropertiesFileName)
throws ConfigurationException {
if (map == null || map.size() == 0) {
log.error("属性配置文件[" + propertiesFileName + "]无需要保存的属性列表!");
}
if (StringUtils.isBlank(newPropertiesFileName)) {
log.error("另存为的属性配置文件名不能为空!");
}
PropertiesConfiguration configuration = new PropertiesConfiguration(
propertiesFileName);
for (Entry<String, Object> entry : map.entrySet()) {
configuration.setProperty(entry.getKey(), entry.getValue());
}
configuration.save(newPropertiesFileName);
}
} | [
"zhenglinlin@haodehaode.cn"
] | zhenglinlin@haodehaode.cn |
1dd7a8a5474bcc853a7d008663d5a1f0dc883d75 | 5d5ceef4d06ef0dc366fb4e432070d5948268bca | /src/com/switchsoft/vijayavani/viewpager/ItemModelPagerAdapter_5.java | ac5f24657c1ab05ec8fe48a68f0fccc7292cbc2e | [] | no_license | Ganganaidu/vijyavani | 7ae7db0a554ce8fcaeb22a0a20af663ee00b944d | ba3d13f4b2319fe19597fa6fe87888bb647064da | refs/heads/master | 2020-09-23T06:54:14.230041 | 2016-08-30T22:08:20 | 2016-08-30T22:08:20 | 66,981,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,652 | java | package com.switchsoft.vijayavani.viewpager;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.switchsoft.vijayavani.R;
import com.switchsoft.vijayavani.view.Menu;
public class ItemModelPagerAdapter_5 extends FragmentPagerAdapter{
static int PAGE_COUNT = 0;
/** Constructor of the class */
public ItemModelPagerAdapter_5(FragmentManager fm) {
super(fm);
}
/** This method will be invoked when a page is requested to create */
@Override
public Fragment getItem(int arg0) {
ItemModelFragment_5 myFragment = new ItemModelFragment_5();
Bundle data = new Bundle();
data.putInt("current_page", arg0+1);
myFragment.setArguments(data);
return myFragment;
}
/** Returns the number of pages */
@Override
public int getCount() {
PAGE_COUNT = Menu.menu_items_level5.size();
return PAGE_COUNT;
}
}
class ItemModelFragment_5 extends Fragment{
int mCurrentPage;
TextView menu_textview, price_textview;
ImageView mMainbox_Imageview;
RelativeLayout mPrice_Relativelayout;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/** Getting the arguments to the Bundle object */
Bundle data = getArguments();
/** Getting integer data of the key current_page from the bundle */
mCurrentPage = data.getInt("current_page", 0);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.menu_viewpager, container,false);
//Initializing the layout view
menu_textview = (TextView)v.findViewById(R.id.menu_textview);
mMainbox_Imageview = (ImageView)v.findViewById(R.id.mainbox_imageview);
mPrice_Relativelayout = (RelativeLayout)v.findViewById(R.id.price_relativelayout);
price_textview = (TextView)v.findViewById(R.id.price_textview);
try {
menu_textview.setText((String) Menu.menu_items_level5.get(mCurrentPage - 1).get("item_name"));
String cost = (String) Menu.menu_items_level5.get(mCurrentPage - 1).get("Item_Price");
String description = (String) Menu.menu_items_level5.get(mCurrentPage - 1).get("Item_Description");
if(!cost.equals("")){
mPrice_Relativelayout.setVisibility(View.VISIBLE);
price_textview.setText(cost);
}
} catch (Exception e) {
// TODO: handle exception
}
return v;
}
}
| [
"gkondati@nextradioapp.com"
] | gkondati@nextradioapp.com |
204befa0b92fca8f0392e4dbaf927753ad061731 | 5cbc09e180372e26aea2fdf762f0e2e94b9b3e2d | /linguochao_cloud/linguochao_cloud_feign/src/main/java/com/linguochao/feign/controller/FriendController.java | 096b19ecc48d3944038522c798ba7b3318aaf890 | [] | no_license | linguochao1024/itdan | 478beda7bd7536e44b561fb4e7e8ebb7ba14b272 | 3480b4e8595d598d3788bd71d1ba85b345828bad | refs/heads/master | 2022-11-10T01:19:56.816001 | 2020-05-02T14:33:43 | 2020-05-02T14:33:43 | 194,394,179 | 0 | 0 | null | 2022-10-12T20:43:30 | 2019-06-29T10:39:50 | Java | UTF-8 | Java | false | false | 2,287 | java | package com.linguochao.feign.controller;
import com.linguochao.feign.service.FriendService;
import entity.Result;
import entity.StatusCode;
import io.jsonwebtoken.Claims;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* description
*
* @author linguochao
* @date 2019\6\29 0029
*/
@RestController
@RequestMapping("/friend")
@CrossOrigin
public class FriendController {
@Autowired
private FriendService friendService;
@Autowired
private HttpServletRequest request;
/**
* 添加好友或非好友
*/
@RequestMapping(value = "/like/{friendid}/{type}",method = RequestMethod.PUT)
public Result addFriend(@PathVariable String friendid, @PathVariable String type){
//1.获取当前登录用户ID(userid)
Claims claims = (Claims)request.getAttribute("user_claims");
if(claims==null){
return new Result(false, StatusCode.ACCESS_ERROR,"请先登录");
}
String userid = claims.getId();
//2.判断type是1还是2
if("1".equals(type)){
//添加好友
Integer flag = friendService.addFriend(userid,friendid);
//判断是否添加成功
if(flag==1){
return new Result(true,StatusCode.OK,"添加好友成功");
}else{
return new Result(false,StatusCode.REPEATE_ERROR,"请不要重复添加好友");
}
}else{
//添加非好友
friendService.addNoFriend(userid,friendid);
return new Result(true,StatusCode.OK,"添加非好友成功");
}
}
/**
* 删除好友
*/
@RequestMapping(value = "/{friendid}",method = RequestMethod.DELETE)
public Result deleteFriend(@PathVariable String friendid){
//1.获取登录用户ID
Claims claims = (Claims)request.getAttribute("user_claims");
if(claims==null){
return new Result(false, StatusCode.ACCESS_ERROR,"请先登录");
}
String userid = claims.getId();
friendService.deleteFriend(userid,friendid);
return new Result(true,StatusCode.OK,"删除好友成功");
}
}
| [
"lgc_it@163.com"
] | lgc_it@163.com |
40e4f317b436e034f106cd54896c2d9092b31b0b | 981d1ff306309264f1435fc71b2fc4672bd01a46 | /calc/src/main/java/com/example/calc/dto/EquationDTO.java | a084801f6250b4fecca6827d51a1c30e845eab82 | [] | no_license | gphelipe1/calculadora_REST | 17d1ad8910d597e0e43c78493f8887aed0acfc55 | 2cdc6f7c7126930d9ed928bcedde9b2320eaf575 | refs/heads/master | 2023-01-02T11:35:10.175580 | 2020-10-26T23:00:12 | 2020-10-26T23:00:12 | 305,515,584 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 201 | java | package com.example.calc.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
@AllArgsConstructor
public class EquationDTO {
double x;
double y;
}
| [
"gpcfreitas@gmail.com"
] | gpcfreitas@gmail.com |
0c426077f6b165e8cf5f5427556bb25033b9ab0d | 9299dbcb9ef56989500c237c2f7495aa5a602ef7 | /FlashCard/src/com/vili/flashcards/FlashCards.java | 9684f78985fe3b6179be0fd9099fe18f814f936a | [] | no_license | viliardelean/FlashCard | f208987f6e62c65c72abef2f8a66fe92771b72e0 | 0b3e6ef0df476c05f3e1c8ff905feb5aef582275 | refs/heads/master | 2020-03-09T20:08:01.949871 | 2018-04-13T19:01:30 | 2018-04-13T19:01:30 | 128,975,995 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,314 | java | package com.vili.flashcards;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.StringTokenizer;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JTextArea;
import java.awt.Color;
public class FlashCards {
private JFrame frame;
private JPanel panel;
private ArrayList<Card> cardList;
private Iterator<Card> cardIterator;
private Card currentCard;
private JButton btnNextCard;
private JButton btnSubmit;
private JTextArea qArea;
private JTextArea aArea;
private JLabel correctIcon;
private JLabel incorrectIcon;
public FlashCards() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
// Frame and Panel
frame = new JFrame("Flash Cards");
panel = new JPanel();
frame.setBounds(100, 100, 357, 355);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setLocationRelativeTo(null);
panel.setLayout(null);
frame.setContentPane(panel);
frame.setVisible(true);
Font mFont = new Font("Helvetica Neue", Font.BOLD, 23);
// Menu Bar
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("File");
fileMenu.setBackground(Color.BLUE);
fileMenu.setFont(new Font("Segoe UI", Font.BOLD, 14));
JMenuItem opeMenuItem = new JMenuItem("Load Card Set");
fileMenu.add(opeMenuItem);
menuBar.add(fileMenu);
frame.setJMenuBar(menuBar);
opeMenuItem.addActionListener(new OpenMenuListener());
// Labels
JLabel qLabel = new JLabel("Question :");
qLabel.setBounds(10, 21, 70, 14);
panel.add(qLabel);
JLabel aLabel = new JLabel("Answer : ");
aLabel.setBounds(10, 134, 70, 14);
panel.add(aLabel);
// Text Areas for questions (q) and answers (a)
qArea = new JTextArea();
qArea.setFont(mFont);
qArea.setLineWrap(true);
qArea.setWrapStyleWord(true);
qArea.setBounds(10, 38, 331, 77);
panel.add(qArea);
aArea = new JTextArea();
aArea.setFont(mFont);
aArea.setLineWrap(true);
aArea.setWrapStyleWord(true);
aArea.setBounds(10, 154, 331, 77);
panel.add(aArea);
// The 2 buttons (Submit and Next Card)
btnSubmit = new JButton("Submit");
btnSubmit.setFont(new Font("Tahoma", Font.BOLD, 13));
btnSubmit.setBounds(10, 245, 105, 38);
panel.add(btnSubmit);
btnSubmit.addActionListener(new SubmitListener());
btnNextCard = new JButton("Next Card");
btnNextCard.setFont(new Font("Tahoma", Font.BOLD, 13));
btnNextCard.setBounds(236, 245, 105, 38);
panel.add(btnNextCard);
btnNextCard.addActionListener(e -> showNextCard());
// Icons for right and wrong answers feedback
ImageIcon icon1 = new ImageIcon(getUrl("/com/vili/resources/Correct_Icon.png"), "Correct");
ImageIcon icon2 = new ImageIcon(getUrl("/com/vili/resources/Incorrect_Icon.png"), "Incorrect");
correctIcon = new JLabel(icon1);
correctIcon.setBounds(140, 240, 70, 50);
panel.add(correctIcon);
correctIcon.setVisible(false);
incorrectIcon = new JLabel(icon2);
incorrectIcon.setBounds(140, 240, 70, 50);
panel.add(incorrectIcon);
incorrectIcon.setVisible(false);
}
// Returns the URL (complete path) of a resource or Null if the file is not found
protected URL getUrl(String path) {
java.net.URL url = getClass().getResource(path);
if (url != null) {
return url;
} else {
System.err.println("Couldn't find file: " + path);
return null;
}
}
public class OpenMenuListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileOpen = new JFileChooser();
fileOpen.showOpenDialog(fileOpen);
loadFile(fileOpen.getSelectedFile());
}
}
// Loads the file into an array list of cards
public void loadFile(File file) {
cardList = new ArrayList<Card>();
try {
BufferedReader reader = new BufferedReader(new FileReader(file));
String line = null;
while (( line = reader.readLine()) != null) {
makeCard(line);
}
reader.close();
} catch (Exception e) {
System.err.println("Couldn't read the card file");
e.printStackTrace();
}
// show the first card
cardIterator = cardList.iterator();
showNextCard();
}
public void makeCard(String lineToParse) {
StringTokenizer result = new StringTokenizer(lineToParse, ",");
if (result.hasMoreTokens()) {
Card card = new Card(result.nextToken(), result.nextToken());
cardList.add(card);
}
}
// Shows the next card when the button Next Card/Skip Card is pushed
private void showNextCard() {
correctIcon.setVisible(false);
incorrectIcon.setVisible(false);
if (cardIterator.hasNext()) {
currentCard = (Card) cardIterator.next();
qArea.setText(currentCard.getQuestion());
aArea.setText("");
aArea.requestFocus();
btnNextCard.setText("Skip Card");
} else {
// no more cards to show
qArea.setText("That was the last card.");
aArea.setText("");
btnNextCard.setEnabled(false);
btnSubmit.setEnabled(false);
}
}
public class SubmitListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
String typedAnswer = aArea.getText(); //get the answer typed by the user
// if the answer is correct
if (typedAnswer.equalsIgnoreCase(currentCard.getAnswer())) {
incorrectIcon.setVisible(false);
correctIcon.setVisible(true);
btnNextCard.setText("Next Card");
}
// if the answer is NOT correct
else {
correctIcon.setVisible(false);
incorrectIcon.setVisible(true);
aArea.setText("Correct answer: "+currentCard.getAnswer());
btnNextCard.setText("Next Card");
}
}
}
}
| [
"willyardelean@gmail.com"
] | willyardelean@gmail.com |
acdd6738fc03d69e65f7b11d7984960aa151e56f | b5b138088b29ea3fe09d37420c3d78a6e7c890e4 | /SafeCracker/src/amailloux/SafeCracker.java | 20abcc6e00dfd06c39d08eff19c5e2e6e0f0d6c1 | [] | no_license | Kawa11Senpai/JavaProjects | 1916534e08f852f3f267be22a81b5e9ea3070cdb | 0a8d4e2febdfbc4705fac38e278cb1d4244eb448 | refs/heads/master | 2021-01-12T03:58:29.811617 | 2016-12-27T09:47:31 | 2016-12-27T09:47:31 | 77,444,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,356 | java | package amailloux;
import java.util.*;
public class SafeCracker {
public static void main(String[] args) {
Scanner keyboard;
keyboard = new Scanner(System.in);
System.out.println(" Safe Cracker Jr. - A. Mailloux ");
System.out.println(" What is your guess? ");
double getRandom = (int)(Math.random()*9999+1);
int guess, game = 0;
int score = 0;
int highScore = 1000;
int answer = (int)getRandom;
String restart;
while(true){
guess = keyboard.nextInt();
if (guess == answer) {
if( score < highScore ){
highScore = score;
}
System.out.println(" You got it! ");
System.out.println(" Your score was:" + score);
game++;
getRandom = (int)(Math.random()*9999+1);
answer = (int)getRandom;
score = 0;
System.out.print("Do you want to play again?");
restart = keyboard.next();
if(restart.equalsIgnoreCase("yes") || restart.equalsIgnoreCase("yeah")){
System.out.println(" What is your guess? ");
}else{
break;
}
}else if (guess < answer){
System.out.println(" You are too low. ");
} else if (guess > answer) {
System.out.println(" You are too high. ");
}
score++;
}
if( game > 0 ){
System.out.println("That's a new best score! It took " + highScore + " guesses.");
}
}
}
| [
"ALE2165865@maricopa.edu"
] | ALE2165865@maricopa.edu |
c7167b322f19abcbb7174bf223828581dc105fec | 81101cb8b522e61b0d4f10de3a9759c428cb777e | /src/day16/ExceptionHandle6.java | e2d14301139d3ac0b3225e355c6dfc3a4334b5e8 | [] | no_license | nirajankarki02/Java-Class-Practice | 7ff19163002343c8085f842f67f2a8cc4dd5cf4f | c598548d85fd0e7f1d830c64e3bad216322db2dc | refs/heads/master | 2023-03-27T00:03:16.466448 | 2021-03-26T15:17:21 | 2021-03-26T15:17:21 | 340,137,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package day16;
//NESTED
public class ExceptionHandle6 {
public static void main(String[] args) {
/*
the sequence should always be:
try { } -----> catch { }
OR
try { } -----> catch { } -----> finally { }
OR
try { } -----> finally { }
*/
/*
there can be nested try catch within try or catch as needed as well:
try {try { } -----> catch { } } -------> catch {try { } -----> catch { } }
*/
}
}
| [
"you@example.comname"
] | you@example.comname |
d391da7764c6b1518526b9362dae85e046854196 | 564776f3153f98ada17281224097a25c397ef606 | /src/main/java/cn/com/hohistar/tutorial/springboothelloworld/web/HelloWorldController.java | 6d87fc612e574c81affd7692792e1f4fd5f846dc | [] | no_license | QXGROUP/spring-boot-helloworld | 23f44ba20ae859dfcec1a15a85a395d601cfd9a0 | 977d3412a6ebc69b14e9b2e2da51c83f37ad216b | refs/heads/master | 2020-03-27T07:04:41.573975 | 2018-09-09T00:54:05 | 2018-09-09T00:54:05 | 146,160,816 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package cn.com.hohistar.tutorial.springboothelloworld.web;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorldController {
@RequestMapping("/")
public String greeting() {
return "hello";
}
@RequestMapping("/hello")
public String sayHello(@RequestParam("name") String name) {
return "Hello " + name + "!";
}
}
| [
"mei.jini@gmail.com"
] | mei.jini@gmail.com |
bc96e02a8b067d9f4195a0dc8d8ed4500ac1758b | 9ac8184133b176912b5489e9fe90046404cff6a3 | /g-Projects/WebSocketDemos/demo01/src/main/java/top/iqqcode/demo01/controller/MessageController.java | d25ec96a41b3bb7965d67b17cca9de8bc3dbd5a7 | [] | no_license | IQQcode/Code-Java | d5524151b33811d423c6f877418b948f10f10c96 | 96b3157c16674be50e0b8a1ea58867a3de11d930 | refs/heads/master | 2022-12-27T12:32:05.824182 | 2022-07-31T09:32:18 | 2022-07-31T09:32:18 | 159,743,511 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 904 | java | package top.iqqcode.demo01.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.simp.SimpMessageSendingOperations;
import org.springframework.stereotype.Controller;
import top.iqqcode.demo01.domain.MessageBody;
@Controller
public class MessageController {
/**
* 消息发送工具对象
*/
@Autowired
private SimpMessageSendingOperations simpMessageSendingOperations;
/**
* 广播发送消息,将消息发送到指定的目标地址
*/
@MessageMapping("/test")
public void sendTopicMessage(MessageBody messageBody) {
// 将消息发送到 WebSocket 配置类中配置的代理中(/topic)进行消息转发
simpMessageSendingOperations.convertAndSend(messageBody.getDestination(), messageBody);
}
}
| [
"2726109782@qq.com"
] | 2726109782@qq.com |
22e4ef04548df1dca352dc3da92eb92ba1b784d2 | 128d65af3154866128b57471d4a30d8c2fa6b766 | /Blockinvaders/src/me/game/monsters/SmallMonster.java | 648ae111e35a8416eb1a105c7055cd448dcc9baf | [] | no_license | Totenfluch/Blockinvanders | 0e82180b76fe55d1c33e6774da0bbe12130e1c77 | 5d6d8b5205d94c7652d4da9b70ee13a3d4a5d6e6 | refs/heads/master | 2020-04-12T01:48:34.527775 | 2016-07-10T22:49:24 | 2016-07-10T22:49:24 | 55,684,201 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 946 | java | package me.game.monsters;
import javafx.scene.paint.Color;
import me.game.characters.Monster;
import me.game.monsterWeapons.MonsterStandardWeapon;
import me.game.pack.MonsterWaves;
public class SmallMonster extends Monster{
public SmallMonster(int level, double xPos, double yPos){
super(null, 11+level*5, xPos, yPos, 30, 20, 1+level, Color.BROWN, 0.25, 20);
hisWeapon = new MonsterStandardWeapon(this);
game.Monsters.add(this);
monsterType = MonsterWaves.MonsterType.SMALLMONSTER;
if(game.Coop_enabled || game.Online_Coop || game.Play_with_bot_enabled){
setInitHp(getInitHp()*2);
setLife(getInitHp());
}
}
public static void spawnSmallMonsterWave(int level){
int x = 0;
int ix = 0;
for(int i = 0; i<64; i++){
ix++;
if(i%16 == 0){
x++;
ix = 0;
}
int sub = 0;
if(x%2 == 0)
sub = 50;
new SmallMonster(level, sub+600+ix*50, x*100+50);
}
}
}
| [
"ziegler.christian@kabelmail.de"
] | ziegler.christian@kabelmail.de |
1986fc2285c29ee6e53ef74c387fe916473fe6f2 | af86c9088fa4bf56970a3cf876edc698613adeae | /app/src/test/java/sv/ub/com/taller/ExampleUnitTest.java | d822ea90431520b08e4f6325459ca48f87bcbc02 | [] | no_license | DiegoDkSanchez/tallerWebService | 99bb51f60599f50f600f4dae97637fc9f543f576 | 88aac85d2b15dacc0755b52150cef36b24e6b847 | refs/heads/master | 2020-03-27T23:05:31.827064 | 2018-09-04T04:49:13 | 2018-09-04T04:49:13 | 147,289,632 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package sv.ub.com.taller;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"diegodksanchez@gmail.com"
] | diegodksanchez@gmail.com |
274f14046e2be329c330daab9546ff9cf73379ce | be4e636700f1f83bdb5cbd331fbf585fdc4b8c11 | /src/main/java/com/gmail/golovkobalak/smarthome/cashflow/Louis.java | bf0916d995284243a22b2a2e415b411824c9e8bc | [] | no_license | AlexGolovko/Smart-Home | 70782688282e711cb8ef963321cf4c0f36b25b50 | 78c29bd48474a2c12af954300a6a7c81e9ba541f | refs/heads/master | 2021-08-22T21:29:17.040474 | 2021-01-05T10:13:12 | 2021-01-05T10:16:29 | 240,947,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package com.gmail.golovkobalak.smarthome.cashflow;
import com.gmail.golovkobalak.smarthome.telegram.bot.Bot;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@Service
public class Louis {
@Lazy
private Bot cashBot;
private UpdateCashListener listener;
public Louis(Bot cashBot, UpdateCashListener listener) {
this.cashBot = cashBot;
this.listener = listener;
}
public void run() {
cashBot.setUpdateListener(listener);
}
}
| [
"golovkobalak@gmail.com"
] | golovkobalak@gmail.com |
66368806006c765e637e7d698fbbff73b8ba90c3 | aa76c179f0b424cdf4d0f11e89265881443bdd9a | /app/src/main/java/com/lltech/manager/activity/xj/XjAty.java | 962d86b9cd8530c6791e074f5132a62bb6afd2ac | [] | no_license | 317764920/manager | ad9a63567e6c9f1c2c0787a1bc8085bda755df13 | 9813fcfe8208a4d5be746dca7d6e4b58fb0b9ca3 | refs/heads/master | 2020-12-25T09:38:17.988949 | 2016-06-23T08:39:28 | 2016-06-23T08:39:28 | 61,787,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,602 | java | package com.lltech.manager.activity.xj;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.TextView;
import com.lcx.mysdk.activity.BaseFragmentActivity;
import com.lcx.mysdk.application.BaseApplication;
import com.lltech.manager.R;
import com.lltech.manager.fragment.xj.MiddleFragment;
import com.lltech.manager.widget.TopBar;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName(类名) : XjAty
* @Description(描述) : 巡检
* @author(作者) :liuchunxu
* @date (开发日期) :2016年05月23日 10:53
*/
public class XjAty extends BaseFragmentActivity implements MiddleFragment.OnButtonClick {
private BaseApplication application = BaseApplication.getApplication();
private ViewPager mViewPager;
private TopBar topBar;
private FragmentPagerAdapter mAdapter;
private List<Fragment> mTabContents = new ArrayList<Fragment>();
int position = 0;
private TextView txt_address, txt_content;
@Override
public void setContentView() {
setContentView(R.layout.activity_xj);
}
@Override
public void initViews() {
mViewPager = $(R.id.id_vp);
topBar = $(R.id.top);
txt_address = $(R.id.txt_address);
txt_content = $(R.id.txt_content);
}
@Override
public void initListeners() {
}
@Override
public void initData() {
showFragment();
}
@Override
public void initConfig() {
topBar.getLeftBtn().setVisibility(View.GONE);
topBar.getRightBtn1().setVisibility(View.GONE);
topBar.getRightBtn2().setVisibility(View.GONE);
topBar.setTopText("巡检执行");
}
private void showFragment() {
mTabContents.clear();
MiddleFragment middleFragment;
for (int i = 0; i <= 20; i++) {
middleFragment = new MiddleFragment();
mTabContents.add(middleFragment);
}
mAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
return mTabContents.get(position);
}
@Override
public int getCount() {
return mTabContents.size();
}
};
mViewPager.setAdapter(mAdapter);
}
@Override
public void OnButtonClick(View view, Boolean value) {
if (value) {
position++;
mViewPager.setCurrentItem(position);
}
}
}
| [
"java"
] | java |
683f7d2a2fa491776041dc9518477e1715c15d4f | 44810487df97e9e550137079fc8bf8ed322d33aa | /NestingDepth.java | 5af45ef4d053a956b7941b14659be81721e6ac35 | [] | no_license | madhurima31/Google-code-jam-2020-qualifiers | c68e3e8f56f296d232c67fbaeb196bba4d9d610c | f2a80f55534a6d6ae27e6f5edff61fb22214beab | refs/heads/master | 2021-05-23T01:51:46.855880 | 2020-04-05T07:44:15 | 2020-04-05T07:44:15 | 253,181,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,209 | java | package codeJamQualifiers;
import java.util.Scanner;
import java.util.Stack;
public class NestingDepth {
private String nestingString(String s) {
int len = s.length();
StringBuilder res = new StringBuilder();
if(len==0)
return "";
int index = 0;
int prevNum = 0;
Stack<String> st =new Stack<>();
while(index<len) {
char currChar = s.charAt(index);
int currNum = Integer.valueOf(String.valueOf(currChar));
int diff = currNum - prevNum;
prevNum = currNum;
if(diff>0) {
while(diff!=0) {
st.push("(");
res.append("(");
diff--;
}
}
if(diff<0) {
while(diff!=0) {
st.pop();
res.append(")");
diff++;
}
}
res.append(currChar);
index++;
while(index<len && s.charAt(index)==currChar)
res.append(s.charAt(index++));
}
while(!st.isEmpty()) {
st.pop();
res.append(")");
}
return res.toString();
}
public static void main(String args[]){
NestingDepth sol = new NestingDepth();
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int i=1;i<=t;i++) {
String s = sc.next();
System.out.println("Case #"+i+": "+sol.nestingString(s));
}
sc.close();
}
}
| [
"madhu.mondal3131@gmail.com"
] | madhu.mondal3131@gmail.com |
3e151c07e07df14291bd5d108371789caf907207 | 45184eb9a3cdecbc2a7258700cf80e55c08ecf26 | /Source/Core/Java/ua/core/util/NVStringPair.java | 67e6bc1a7b18bd052ba97e888f2cf504c20624bd | [] | no_license | toconn/AppNew | fa93c88c049a1047d53fafca7a0e25abcc263e0b | 2add13a2befdfdaa154cc7c357dc7c2534bb3dca | refs/heads/master | 2021-01-10T20:00:47.882094 | 2018-06-03T14:11:34 | 2018-06-03T14:11:34 | 41,057,425 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,314 | java | /*
* Created on May 26, 2004
*
* To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package ua.core.util;
/**
* @author TOCONNEL
*
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class NVStringPair implements IName {
public String name = null;
public String value = null;
public NVStringPair cloneMe() {
return new NVStringPair (this.name, this.value);
}
/**
* @return Returns the name.
*/
public String getName() {
return name;
}
/**
* @param name The name to set.
*/
public void setName (String name) {
this.name = name;
}
/**
* @return Returns the value.
*/
public String getValue() {
return value;
}
/**
* @param value The value to set.
*/
public void setValue (String value) {
this.value = value;
}
/**
* @param name
* @param value
*/
public NVStringPair (String name, String value) {
super();
this.name = name;
this.value = value;
}
public NVStringPair() {
super();
}
@Override
public String toString() {
return "NVStringPair [name=" + name + ", value=" + value + "]";
}
}
| [
"tuc.github@uaconaill.com"
] | tuc.github@uaconaill.com |
18bba0f8536017f09ae4121cb37afabd2b57ce85 | d223b3a569bec4836df6425d831369c50d1f3254 | /common-base/src/main/java/com/wjs/common/base/util/ChangeCharsetUtil.java | 8098fac16b0c9f71b4b85624395d9122281216b7 | [] | no_license | pqqanqing/common | 1cb8469e32621003804a19d559472506070d80ca | 050d0e0b83934ca8a73be92dddfa911bce9bd4a9 | refs/heads/master | 2021-01-19T19:08:29.065979 | 2017-04-26T07:56:25 | 2017-04-26T07:56:25 | 88,399,844 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,717 | java | package com.wjs.common.base.util;
import java.io.UnsupportedEncodingException;
/**
* Created by panqingqing on 16/4/7.
*/
public class ChangeCharsetUtil {
/**
* 7位ASCII字符,也叫作ISO646-US、Unicode字符集的基本拉丁块
*/
public static final String US_ASCII = "US-ASCII";
/**
* ISO 拉丁字母表 No.1,也叫作 ISO-LATIN-1
*/
public static final String ISO_8859_1 = "ISO-8859-1";
/**
* 8 位 UCS 转换格式
*/
public static final String UTF_8 = "UTF-8";
/**
* 16 位 UCS 转换格式,Big Endian(最低地址存放高位字节)字节顺序
*/
public static final String UTF_16BE = "UTF-16BE";
/**
* 16 位 UCS 转换格式,Little-endian(最高地址存放低位字节)字节顺序
*/
public static final String UTF_16LE = "UTF-16LE";
/**
* 16 位 UCS 转换格式,字节顺序由可选的字节顺序标记来标识
*/
public static final String UTF_16 = "UTF-16";
/**
* 中文超大字符集
*/
public static final String GBK = "GBK";
/**
* 将字符编码转换成US-ASCII码
*/
public String toASCII(String str) {
return this.changeCharset(str, US_ASCII);
}
/**
* 将字符编码转换成ISO-8859-1码
*/
public String toISO_8859_1(String str) {
return this.changeCharset(str, ISO_8859_1);
}
/**
* 将字符编码转换成UTF-8码
*/
public String toUTF_8(String str) {
return this.changeCharset(str, UTF_8);
}
/**
* 将字符编码转换成UTF-16BE码
*/
public String toUTF_16BE(String str) {
return this.changeCharset(str, UTF_16BE);
}
/**
* 将字符编码转换成UTF-16LE码
*/
public String toUTF_16LE(String str) {
return this.changeCharset(str, UTF_16LE);
}
/**
* 将字符编码转换成UTF-16码
*/
public String toUTF_16(String str) {
return this.changeCharset(str, UTF_16);
}
/**
* 将字符编码转换成GBK码
*/
public String toGBK(String str) {
return this.changeCharset(str, GBK);
}
/**
* 字符串编码转换的实现方法
*
* @param str 待转换编码的字符串
* @param newCharset 目标编码
* @return
* @throws UnsupportedEncodingException
*/
public String changeCharset(String str, String newCharset) {
if (str != null) {
// 用默认字符编码解码字符串。
byte[] bs = str.getBytes();
// 用新的字符编码生成字符串
try {
return new String(bs, newCharset);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
return null;
}
/**
* 字符串编码转换的实现方法
*
* @param str 待转换编码的字符串
* @param oldCharset 原编码
* @param newCharset 目标编码
* @return
* @throws UnsupportedEncodingException
*/
public String changeCharset(String str, String oldCharset, String newCharset) {
if (str != null) {
// 用旧的字符编码解码字符串。解码可能会出现异常。
byte[] bs = new byte[0];
try {
bs = str.getBytes(oldCharset);
// 用新的字符编码生成字符串
return new String(bs, newCharset);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
return null;
}
}
| [
"15601870402@163.com"
] | 15601870402@163.com |
c304fec9e797d1860a6f4d9de70ad90dae184a71 | 8d214927e2d915a4dab1110066fb1354297d7032 | /src/main/java/com/wbtech/ums/objects/AbstractReturnObject.java | 0231161ed0395c500cbe97a45e4c468eab0fbff8 | [] | no_license | water54/razor | 35e66beeefcb4bc746c64ede0f1607d5275cbf07 | f1085459504b88561b29dee87ae2cfcff7ac240d | refs/heads/master | 2021-01-01T15:49:15.498485 | 2017-07-20T02:40:05 | 2017-07-20T02:40:05 | 97,710,222 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 684 | java | package com.wbtech.ums.objects;
import java.io.Serializable;
public class AbstractReturnObject implements Serializable {
private static final long serialVersionUID = 4049503783357712439L;
public int code = 0;
public String message = "";
public String data;
public String detail;
public AbstractReturnObject(int code, String message, String data, String detail) {
this.code = code;
this.message = message;
this.data = data;
this.detail = detail;
}
public AbstractReturnObject(int code, String message) {
this.code = code;
this.message = message;
}
public AbstractReturnObject() {
}
}
| [
"liuyun2451@gmail.com"
] | liuyun2451@gmail.com |
4565fc267229f778e0135ab8f7af2d21dc04f699 | 1448f519f5beeb597449613ca319a36ee691d6e6 | /openTCS-PlantOverview-Base/src/main/java/org/opentcs/guing/components/properties/type/SymbolProperty.java | 60d7827faa8679902705828da161a86f8b742c45 | [
"CC-BY-4.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | bluseking/opentcs | 2acc808042a1fe9973c33dda6f2a19366dd7e139 | 0edd4f5a882787b83e5132097cf3cf9fc6ac4cc2 | refs/heads/master | 2023-09-06T06:44:10.473728 | 2021-11-25T15:43:14 | 2021-11-25T15:43:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,926 | java | /**
* Copyright (c) The openTCS Authors.
*
* This program is free software and subject to the MIT license. (For details,
* see the licensing information (LICENSE.txt) you should have received with
* this copy of the software.)
*/
package org.opentcs.guing.components.properties.type;
import org.opentcs.data.model.visualization.LocationRepresentation;
import org.opentcs.guing.model.ModelComponent;
/**
* A property for a graphical symbol.
*
* @author Sebastian Naumann (ifak e.V. Magdeburg)
*/
public class SymbolProperty
extends AbstractComplexProperty {
/**
* The location representation.
*/
private LocationRepresentation locationRepresentation;
/**
* Creates a new instance.
*
* @param model The model component this property belongs to.
*/
public SymbolProperty(ModelComponent model) {
super(model);
}
@Override
public Object getComparableValue() {
return locationRepresentation;
}
/**
* Set the location representation for this property.
*
* @param locationRepresentation The location representation.
*/
public void setLocationRepresentation(LocationRepresentation locationRepresentation) {
this.locationRepresentation = locationRepresentation;
}
/**
* Returns the location representation for this property.
*
* @return The location representation.
*/
public LocationRepresentation getLocationRepresentation() {
return locationRepresentation;
}
@Override // java.lang.Object
public String toString() {
if (fValue != null) {
return fValue.toString();
}
return locationRepresentation == null ? "" : locationRepresentation.name();
}
@Override // AbstractProperty
public void copyFrom(Property property) {
SymbolProperty symbolProperty = (SymbolProperty) property;
symbolProperty.setValue(null);
setLocationRepresentation(symbolProperty.getLocationRepresentation());
}
}
| [
"stefan.walter@iml.fraunhofer.de"
] | stefan.walter@iml.fraunhofer.de |
5977d68bf9e3e57eda3b5bc438f20102e4fac76f | 12721743cc0bc23413b259d6f643b31b34b075d8 | /src/ThrowException.java | 03b639736f82dc19a2e4297fd48c738cc1d0494e | [] | no_license | NguyenVanThaiBinh/Module-2-part2 | 87dc95820073fea2b36885ab1fbcaef54fcffefd | cecc46cb910def16bdc966327389aa56950534ad | refs/heads/master | 2023-05-04T03:24:13.671298 | 2021-05-04T04:35:02 | 2021-05-04T04:35:02 | 359,762,844 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 474 | java | public class ThrowException {
public static class Fraction {
private int numberator, denominator;
public Fraction(int n, int d) throws Exception {
if (d == 0) throw new Exception();
numberator = n;
denominator = d;
}
}
public static void main(String[] args) {
try{
Fraction f = new Fraction(2,0);
}
catch (Exception e){
e.getMessage();
}
}
}
| [
"nguyenvanthaibinh2210@gmail.com"
] | nguyenvanthaibinh2210@gmail.com |
8159d797be11fc821eeaee369516bea76cb3b3b1 | 4c59847c121f67587978865a2eeccc0d2e7d8747 | /styx-common/src/main/java/com/spotify/styx/testdata/TestData.java | 3827fa65ebd63be0d5f9876bbfa4e06b48204636 | [
"Apache-2.0"
] | permissive | rugby110/styx | af856984b921eb6ecdc3987cecccdfa3ff6220d7 | abd000da8949e44d111633361a8eb65aabb36e38 | refs/heads/master | 2020-06-12T21:05:26.040695 | 2016-12-03T14:54:31 | 2016-12-03T14:54:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,424 | java | /*-
* -\-\-
* Spotify Styx Common
* --
* Copyright (C) 2016 Spotify AB
* --
* 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.spotify.styx.testdata;
import static com.spotify.styx.model.Partitioning.DAYS;
import static com.spotify.styx.model.Partitioning.HOURS;
import static com.spotify.styx.model.Partitioning.MONTHS;
import static com.spotify.styx.model.Partitioning.WEEKS;
import static java.util.Arrays.asList;
import static java.util.Optional.empty;
import static java.util.Optional.of;
import com.spotify.styx.model.DataEndpoint;
import com.spotify.styx.model.DataEndpoint.Secret;
import com.spotify.styx.model.WorkflowId;
import com.spotify.styx.model.WorkflowInstance;
import java.net.URI;
public final class TestData {
private TestData() {
}
public static final URI WORKFLOW_URI =
URI.create("http://example.com/foo/bar");
public static final WorkflowId WORKFLOW_ID =
WorkflowId.create("styx", "styx.TestEndpoint");
public static final WorkflowInstance WORKFLOW_INSTANCE =
WorkflowInstance.create(WORKFLOW_ID, "2016-09-01");
public static final DataEndpoint HOURLY_DATA_ENDPOINT =
DataEndpoint.create(
"styx.TestEndpoint", HOURS, empty(), empty(), empty());
public static final DataEndpoint DAILY_DATA_ENDPOINT =
DataEndpoint.create(
"styx.TestEndpoint", DAYS, empty(), empty(), empty());
public static final DataEndpoint WEEKLY_DATA_ENDPOINT =
DataEndpoint.create(
"styx.TestEndpoint", WEEKS, empty(), empty(), empty());
public static final DataEndpoint MONTHLY_DATA_ENDPOINT =
DataEndpoint.create(
"styx.TestEndpoint", MONTHS, empty(), empty(), empty());
public static final DataEndpoint FULL_DATA_ENDPOINT =
DataEndpoint.create(
"styx.TestEndpoint", DAYS, of("busybox"), of(asList("x", "y")),
of(Secret.create("name", "/path")));
}
| [
"rouz@spotify.com"
] | rouz@spotify.com |
c59b80efaf828fb7448390f285b9e1e8459b9d78 | 8f9dab5c9452c22e96e335a4d603b4c6717f45a7 | /app/src/androidTest/java/com/example/andreavalenziano/myfirstapplication/ExampleInstrumentedTest.java | 796b0303025e8777453fa3fee9618e4920b7aed4 | [] | no_license | AndreaValenziano/MyFirstProject | c809db33ae31f82946ddb81ef18ca9b479101317 | 5ea88dd2f12bc6d0e1ede65a9f26fe7ec8edef19 | refs/heads/master | 2021-01-21T15:44:31.998437 | 2017-02-17T17:10:53 | 2017-02-17T17:10:53 | 81,550,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 798 | java | package com.example.andreavalenziano.myfirstapplication;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.andreavalenziano.myfirstapplication", appContext.getPackageName());
}
}
| [
"valenzianoa@gmail.com"
] | valenzianoa@gmail.com |
5b539f0dee627f5c1624b50bdadf51f3c65426dd | a33b49470afb0fb8aa2325578ea96135a05baa9f | /StringModifiedAgain.java | 16132e3afb09d63362a13ef419bd7f0966348d1f | [] | no_license | siddharthsubramaniam1996/JAVA | a2d46b064cec1beb32c846f57dbdfe179eb10922 | ee364de6a346d98174e5299f764382213ce2081d | refs/heads/master | 2021-06-23T19:37:35.566570 | 2017-08-01T04:52:30 | 2017-08-01T04:52:30 | 53,015,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 576 | java | import java.lang.*;
class StringModifiedAgain
{
public static void main(String args[])
{
StringBuffer str=new StringBuffer ("Java Browser");
System.out.println("Original String:"+str);
System.out.println("Length of string:"+str.length());
for(int i=0;i<str.length();i++)
{
int p=i+1;
System.out.println("Charachter at position:"+p+" is "+str.charAt(i));
}
String s1=new String(str.toString());
int pos=s1.indexOf("browser");
str.insert(pos,"Enabled");
System.out.println("Modified String:");
str.setCharAt(5,'-');
System.out.println("String now");
}
}
| [
"siddharthsubramaniam1996@gmail.com"
] | siddharthsubramaniam1996@gmail.com |
25fa256d5f965d240237f85989a7c93eb065b5c8 | 371139d177f8f6958c50eea38fc66afc01fd7c5a | /hbase-mr/src/main/java/com/cw/bigdata/mr1/FruitDriver.java | 8ff1ad798c8a64a2ece7fc9e00f1071edb3611c4 | [] | no_license | cw1322311203/hbasedemo | 6ad3cb80fdca1bb3a9d372c210cb2f30c06429d8 | 2b664d4c01fb91107c03266b3c926b4ce210449a | refs/heads/master | 2022-07-12T23:09:37.063404 | 2019-12-22T08:39:31 | 2019-12-22T08:39:31 | 227,489,313 | 1 | 0 | null | 2022-06-21T02:25:43 | 2019-12-12T00:50:36 | Java | UTF-8 | Java | false | false | 1,883 | java | package com.cw.bigdata.mr1;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
/**
* 目标:使用MapReduce将hdfs本地数据导入到HBase表中
*/
public class FruitDriver implements Tool {
// 定义一个Configuration
private Configuration configuration = null;
public int run(String[] args) throws Exception {
// 1.获取Job对象
Job job = Job.getInstance(configuration);
// 2.设置驱动类路径
job.setJarByClass(FruitDriver.class);
// 3.设置Mapper和Mapper输出的KV类型
job.setMapperClass(FruitMapper.class);
job.setMapOutputKeyClass(LongWritable.class);
job.setMapOutputValueClass(Text.class);
// 4.设置Reducer类
TableMapReduceUtil.initTableReducerJob(args[1],
FruitReducer.class,
job);
// 5.设置输入输出参数
FileInputFormat.setInputPaths(job, new Path(args[0]));
// 6.提交任务
boolean result = job.waitForCompletion(true);
return result ? 0 : 1;
}
public void setConf(Configuration conf) {
configuration = conf;
}
public Configuration getConf() {
return configuration;
}
public static void main(String[] args) {
try {
Configuration configuration = new Configuration();
int run = ToolRunner.run(configuration, new FruitDriver(), args);
System.exit(run);
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"1322311203@qq.com"
] | 1322311203@qq.com |
cb72e0b7d6207333b2bb2282b8c8df2220bd3330 | 95ea92360a655265240a0da03f777a87861992c6 | /jOOQ-test/src/org/jooq/test/oracle/generatedclasses/test/routines/PEnhanceAddress2.java | 52fd68a1c11c86eda397fbb48de0b596cf485a64 | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | hekar/jOOQ | 886bd8579d6d1069d477f8d1322a51b6f4acfce0 | d5945b9ee37ac92949fa6f5e9cd229046923c2e0 | refs/heads/master | 2021-01-17T21:58:21.141951 | 2012-09-03T02:11:51 | 2012-09-03T02:11:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,029 | java | /**
* This class is generated by jOOQ
*/
package org.jooq.test.oracle.generatedclasses.test.routines;
/**
* This class is generated by jOOQ.
*/
public class PEnhanceAddress2 extends org.jooq.impl.AbstractRoutine<java.lang.Void> {
private static final long serialVersionUID = -441980941;
/**
* The procedure parameter <code>TEST.P_ENHANCE_ADDRESS2.ADDRESS</code>
*/
public static final org.jooq.Parameter<org.jooq.test.oracle.generatedclasses.test.udt.records.UAddressTypeRecord> ADDRESS = createParameter("ADDRESS", org.jooq.test.oracle.generatedclasses.test.udt.UAddressType.U_ADDRESS_TYPE.getDataType());
/**
* Create a new routine call instance
*/
public PEnhanceAddress2() {
super("P_ENHANCE_ADDRESS2", org.jooq.test.oracle.generatedclasses.test.Test.TEST);
addOutParameter(ADDRESS);
}
/**
* Get the <code>ADDRESS</code> parameter OUT value from the routine
*/
public org.jooq.test.oracle.generatedclasses.test.udt.records.UAddressTypeRecord getAddress() {
return getValue(ADDRESS);
}
}
| [
"lukas.eder@gmail.com"
] | lukas.eder@gmail.com |
feb9e537682356a30349d82d69ce408f4a033da5 | b905c12515f50918b2c4dfca315674dddfb59880 | /hibernate-basics/src/main/java/demo/question14To17/AuthorD.java | 95804e6f0dea88031ceac687c7b03cba2e15a955 | [] | no_license | vishal-14/Spring | 312d2d256c673b832e1c375629b5968411d93b58 | 5b3780ccbe1f2b0c5daa89847b06daca0bb06efb | refs/heads/master | 2020-04-28T12:25:42.650318 | 2019-03-31T11:19:31 | 2019-03-31T11:19:31 | 175,275,854 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,591 | java | package demo.question14To17;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Entity
public class AuthorD {
@Id
int id;
String firstName;
String lastName;
int age;
Date dateOfBirth;
@OneToMany(mappedBy = "authorD")
List<BookD> bookDList = new ArrayList<>();
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public Date getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public List<BookD> getBookDList() {
return bookDList;
}
public void setBookDList(List<BookD> bookDList) {
this.bookDList = bookDList;
}
@Override
public String toString() {
return "AuthorD{" +
"id=" + id +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", age=" + age +
", dateOfBirth=" + dateOfBirth +
", bookDList=" + bookDList +
'}';
}
}
| [
"vishalaggarwal.1121@yaho.com"
] | vishalaggarwal.1121@yaho.com |
44ddb949f8a5d379a87c8d4a46eb82e59a210a3e | 6931483cc1f9d77d97cecb23e40ce1adf8ce4cb9 | /app/src/main/java/com/dotinstall/secaiderf2/TopBack.java | c4ee69c8a58767a8f00398439b9e15a63f69efb3 | [] | no_license | Toshiyuki0713/SecaideRf2 | d59a3dbce84bf58fa145cd7c9e15feed7e4f2879 | 53240b2c6fdaa50eaa4db9ec99af1407ef0b6f07 | refs/heads/master | 2021-09-10T22:18:14.458600 | 2018-04-03T05:08:15 | 2018-04-03T05:08:15 | 107,652,189 | 0 | 1 | null | 2018-04-03T05:32:34 | 2017-10-20T08:26:50 | Java | UTF-8 | Java | false | false | 1,649 | java | package com.dotinstall.secaiderf2;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
/**
* Created by gosho on 2017/12/05.
*/
/*
public class BackOnCanvas extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.top);
//TextView textView = (TextView) findViewById(R.id.top);
}
*/
public class TopBack extends View {
Paint paint;
public TopBack(Context context, AttributeSet attrs) {
super(context, attrs);
paint = new Paint();
}
@Override
protected void onDraw(Canvas canvas) {
// 三角形を書く
paint.setStrokeWidth(10);
paint.setARGB(255, 102, 139, 192);
Path path = new Path();
path.moveTo(0, 0);
path.lineTo(1440, 0);
path.lineTo(0, 2000);
path.lineTo(0, 0);
canvas.drawPath(path, paint);
paint.setStrokeWidth(10);
paint.setARGB(255, 101, 173, 219);
Path path2 = new Path();
path2.moveTo(1440, 0);
path2.lineTo(1540, 0);
path2.lineTo(0, 2100);
path2.lineTo(0, 2000);
canvas.drawPath(path2, paint);
}
}
//}
| [
"s14051ti@sfc.keio.ac.jp"
] | s14051ti@sfc.keio.ac.jp |
36322fd24d08034626497347a847a5754719ec05 | 0ac05e3da06d78292fdfb64141ead86ff6ca038f | /OSWE/oswe/openCRX/rtjar/rt.jar.src/com/sun/xml/internal/ws/api/databinding/DatabindingFactory.java | 6ac276bbf46f092d33eecf3604670602582b2c87 | [] | no_license | qoo7972365/timmy | 31581cdcbb8858ac19a8bb7b773441a68b6c390a | 2fc8baba4f53d38dfe9c2b3afd89dcf87cbef578 | refs/heads/master | 2023-07-26T12:26:35.266587 | 2023-07-17T12:35:19 | 2023-07-17T12:35:19 | 353,889,195 | 7 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,367 | java | /* */ package com.sun.xml.internal.ws.api.databinding;
/* */
/* */ import com.oracle.webservices.internal.api.databinding.Databinding;
/* */ import com.oracle.webservices.internal.api.databinding.DatabindingFactory;
/* */ import com.sun.xml.internal.ws.db.DatabindingFactoryImpl;
/* */ import java.util.Map;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public abstract class DatabindingFactory
/* */ extends DatabindingFactory
/* */ {
/* 102 */ static final String ImplClass = DatabindingFactoryImpl.class.getName();
/* */
/* */
/* */
/* */ public abstract Databinding createRuntime(DatabindingConfig paramDatabindingConfig);
/* */
/* */
/* */
/* */ public abstract Map<String, Object> properties();
/* */
/* */
/* */
/* */ public static DatabindingFactory newInstance() {
/* */ try {
/* 116 */ Class<?> cls = Class.forName(ImplClass);
/* 117 */ return (DatabindingFactory)cls.newInstance();
/* 118 */ } catch (Exception e) {
/* 119 */ e.printStackTrace();
/* */
/* 121 */ return null;
/* */ }
/* */ }
/* */ }
/* Location: /Users/timmy/timmy/OSWE/oswe/openCRX/rt.jar!/com/sun/xml/internal/ws/api/databinding/DatabindingFactory.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ | [
"t0984456716"
] | t0984456716 |
83ed78b75e5107eb3392166706e1ae9f929a1465 | 2baa2fb1c2b4ff5c3c06021bdb49d2c2b3c86e0c | /src/main/java/com/adl/app/restaurant/BlankFragment.java | dc4825c3575de3d7f008fa5ba9e2518c72957168 | [] | no_license | archaic-magnon/Restaurant | 438ca655a57374ccc91ffbe31189b732730c8d37 | 37b96d6c40a799b3fdaf75dc696fd85f37388ba8 | refs/heads/master | 2022-02-22T17:55:56.472128 | 2019-10-13T21:36:10 | 2019-10-13T21:36:10 | 99,242,846 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,623 | java | package com.adl.app.restaurant;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link BlankFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link BlankFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class BlankFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private OnFragmentInteractionListener mListener;
public BlankFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment BlankFragment.
*/
// TODO: Rename and change types and number of parameters
public static BlankFragment newInstance(String param1, String param2) {
BlankFragment fragment = new BlankFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_blank, container, false);
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
}
| [
"merajahmed@Merajs-MacBook-Air.local"
] | merajahmed@Merajs-MacBook-Air.local |
b44622ceaa561c713575acd6b7d276fa73bce50b | a0728a167e1cb883255a34e055cac4ac60309f20 | /db/tempSQL/beauty/src/main/java/com/beauty/repository/specification/ProductCategorySpecification.java | 21994c08e7c6ff5c28c3a8baa7ea8c57df152132 | [] | no_license | jingug1004/pythonBasic | 3d3c6c091830215c8be49cc6280b7467fd19dc76 | 554e3d1a9880b4f74872145dc4adaf0b099b0845 | refs/heads/master | 2023-03-06T06:24:05.671015 | 2022-03-09T08:16:58 | 2022-03-09T08:16:58 | 179,009,504 | 0 | 0 | null | 2023-03-03T13:09:01 | 2019-04-02T06:02:44 | Java | UTF-8 | Java | false | false | 1,359 | java | package com.beauty.repository.specification;
import java.util.List;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Join;
import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.springframework.data.jpa.domain.Specification;
import com.beauty.entity.Category;
import com.beauty.entity.Product;
import com.beauty.entity.ProductCategory;
public class ProductCategorySpecification {
public static Specification<ProductCategory> categoryIn(List<Category> category) {
return new Specification<ProductCategory>() {
@Override
public Predicate toPredicate(Root<ProductCategory> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
// final Subquery<Product> personQuery = query.subquery(Product.class);
final Join<ProductCategory, Product> ids = root.join("product", JoinType.LEFT);
// personQuery.select(ids.<Product> get("product"));
// personQuery.where(cb.equal(ids.<Product> get("stopSelling"), 1));
query.groupBy(ids.<Product> get("productId"));
Predicate p1 = cb.equal(ids.<Product> get("stopSelling"), 0);
Predicate predicate = root.get("category").in(category);
return cb.and(p1, predicate);
}
};
}
} | [
"jingug1004@gmail.com"
] | jingug1004@gmail.com |
62f73c5a675d2ad9bb97bce15ccc0ce63e7772c9 | 8ec39fde916306478190f9c9a06cb6962a2bab1a | /Rajithasrc/src/StringSamples/StringSample15.java | 93c0a1387c953312850ac0bfefa502408235095c | [] | no_license | priyanka079/JavaBasics | 1ec3c9302f6d764821964bc4292cfdce7033124a | 9d5801ac04528c2c613dccf2e5a01d1e2a182bc7 | refs/heads/main | 2023-06-17T01:22:46.622915 | 2021-06-29T23:22:54 | 2021-06-29T23:22:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 695 | java | package StringSamples;
public class StringSample15 {
public static void main(String[] args) {
// create a string
String name = "programiz";
// create two substrings from name
// first substring contains first letter of name
// second substring contains remaining letters
String firstLetter = name.substring(0, 1);
String remainingLetters = name.substring(1, name.length());
// change the first letter to uppercase
firstLetter = firstLetter.toUpperCase();
// join the two substrings
name = firstLetter + remainingLetters;
System.out.println("Name: " + name);
}
}
| [
"rajitha21@gmail.com"
] | rajitha21@gmail.com |
5b8ede60bd952fa9cdf8edf9b2c6d2cf010b6445 | 4d7313614c6292c9965ad479681ee4f77c45f1ba | /src/com/tomclaw/tcuilite/Window.java | 087f34868b150430611e52e62aa6be62f782b9c6 | [] | no_license | amrzagloul/tcuilitelib | 97945f7d8b6e80fa6d975eaab723bd71b97201a3 | 3752da02f03961dba3d306ffa45ba71f87ad14d0 | refs/heads/master | 2021-01-16T18:14:27.605247 | 2012-10-06T19:13:43 | 2012-10-06T19:13:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,748 | java | package com.tomclaw.tcuilite;
import java.util.Enumeration;
import java.util.Hashtable;
import javax.microedition.lcdui.Graphics;
/**
* Solkin Igor Viktorovich, TomClaw Software, 2003-2012
* http://www.tomclaw.com/
* @author Solkin
*/
public class Window {
public String name = null;
public Screen screen = null;
private GObject gObject = null;
public Header header = null;
public Soft soft = null;
public Window s_prevWindow = null;
public Window s_nextWindow = null;
public boolean isPainted = false;
public Dialog dialog = null;
public long startTime = System.currentTimeMillis();
public int mSecDelay = 500;
public boolean isShowingDialog = false;
public Hashtable keyEvents;
public KeyEvent capKeyEvent = null;
public Enumeration e;
/**
* Direct draw
*/
public DirectDraw directDraw_background = null;
public DirectDraw directDraw_beforePopup = null;
public DirectDraw directDraw_afterAll = null;
/**
* constructor
*/
public Window( Screen screen ) {
this.screen = screen;
}
public void prepareGraphics() {
paint( Screen.lGraphics, screen.lCache.getWidth(), 0 );
}
/**
* paint
*/
public void paint( Graphics g ) {
paint( g, 0, 0 );
}
public void paint( Graphics g, int paintX, int paintY ) {
paint( g, paintX, paintY, false );
}
public void paint( Graphics g, int paintX, int paintY, boolean isBlock ) {
if ( ( dialog != null && !isPainted ) || dialog == null || isBlock ) {
if ( header != null && header.getWidth() != screen.getWidth() ) {
header.setLocation( 0, 0 );
header.setSize( screen.getWidth(), 0 );
}
if ( soft != null && Soft.getWidth() != screen.getWidth() ) {
soft.setLocation( 0, screen.getHeight() - soft.getHeight() );
soft.setSize( screen.getWidth(), soft.getHeight() );
}
if ( gObject != null ) {
if ( gObject.getWidth() != screen.getWidth()
|| gObject.getHeight() != screen.getHeight()
- ( header != null ? header.getHeight() : 0 )
- ( soft != null ? soft.getHeight() : 0 ) ) {
gObject.setSize( screen.getWidth(), screen.getHeight()
- ( header != null ? header.getHeight() : 0 )
- ( soft != null ? soft.getHeight() : 0 ) );
gObject.setLocation( 0, ( header != null ? header.getHeight() : 0 ) );
}
gObject.repaint( g, paintX, paintY );
}
if ( header != null ) {
header.paint( g, paintX, paintY );
}
if ( directDraw_beforePopup != null ) {
directDraw_beforePopup.paint( g, paintX, paintY );
}
/**
* Here was soft painting
*/
if ( soft != null ) {
soft.paint( g, paintX, paintY );
}
isPainted = true;
}
}
public void showDialog( final Dialog dialog ) {
Window.this.dialog = dialog;
if ( Settings.DIALOG_SHOW_ANIMATION ) {
Window.this.dialog.yOffset = screen.getHeight() / 2;
} else {
Window.this.dialog.yOffset = 0;
}
startTime = System.currentTimeMillis();
isShowingDialog = true;
screen.repaint( Screen.REPAINT_STATE_PLAIN );
}
public void closeDialog() {
if ( Settings.DIALOG_SHOW_ANIMATION ) {
Window.this.dialog.yOffset = 0;
} else {
Window.this.dialog = null;
return;
}
startTime = System.currentTimeMillis();
isShowingDialog = false;
screen.repaint( Screen.REPAINT_STATE_PLAIN );
}
/**
* Called when a key is pressed.
*/
protected void keyPressed( int keyCode ) {
if ( dialog != null ) {
dialog.keyPressed( keyCode );
return;
}
if ( ( soft == null || !( soft.isLeftPressed || soft.isRightPressed ) ) && keyEvents != null ) {
e = keyEvents.elements();
KeyEvent keyEvent;
while ( e.hasMoreElements() ) {
keyEvent = ( KeyEvent ) e.nextElement();
if ( keyEvent.keyCode == keyCode ) {
keyEvent.actionPerformed();
if ( keyEvent.isTotalCapture ) {
return;
} else {
break;
}
}
}
}
if ( Screen.getExtGameAct( keyCode ) == Screen.KEY_CODE_LEFT_MENU ) {
/** Inverting left trigger **/
if ( soft.isLeftPressed || !( soft.isLeftPressed || soft.isRightPressed ) ) {
if ( !soft.isLeftPressed ) {
soft.leftSoft.actionPerformed();
}
if ( !soft.leftSoft.isEmpty() ) {
soft.setLeftSoftPressed( !soft.isLeftPressed );
}
}
} else if ( Screen.getExtGameAct( keyCode ) == Screen.KEY_CODE_RIGHT_MENU ) {
/** Inverting right trigger **/
if ( soft.isRightPressed || !( soft.isLeftPressed || soft.isRightPressed ) ) {
if ( !soft.isRightPressed ) {
soft.rightSoft.actionPerformed();
}
if ( !soft.rightSoft.isEmpty() ) {
soft.setRightSoftPressed( !soft.isRightPressed );
}
}
} else if ( Screen.getExtGameAct( keyCode ) == Screen.KEY_CODE_RIGHT_MENU ) {
if ( s_prevWindow != null ) {
screen.setActiveWindow( s_prevWindow );
}
} else if ( soft != null && ( soft.isLeftPressed || soft.isRightPressed ) ) {
soft.keyPressed( keyCode );
} else {
gObject.keyPressed( keyCode );
}
}
/**
* Called when a key is released.
*/
protected void keyReleased( int keyCode ) {
if ( capKeyEvent != null ) {
capKeyEvent.keyCode = keyCode;
capKeyEvent.actionPerformed();
}
if ( dialog != null ) {
dialog.keyReleased( keyCode );
return;
}
if ( Screen.getExtGameAct( keyCode ) == Screen.KEY_CODE_LEFT_MENU ) {
if ( soft.leftSoft.isEmpty() ) {
soft.setLeftSoftPressed( false );
}
} else if ( Screen.getExtGameAct( keyCode ) == Screen.KEY_CODE_RIGHT_MENU ) {
if ( soft.rightSoft.isEmpty() ) {
soft.setRightSoftPressed( false );
}
} else if ( soft != null && ( soft.isLeftPressed || soft.isRightPressed ) ) {
soft.keyReleased( keyCode );
} else {
gObject.keyReleased( keyCode );
}
}
/**
* Called when a key is repeated (held down).
*/
protected void keyRepeated( int keyCode ) {
if ( dialog != null ) {
dialog.keyRepeated( keyCode );
return;
}
if ( soft != null && ( soft.isLeftPressed || soft.isRightPressed ) ) {
soft.keyRepeated( keyCode );
} else {
gObject.keyRepeated( keyCode );
}
}
/**
* Called when the pointer is dragged.
*/
protected boolean pointerDragged( int x, int y ) {
if ( dialog != null ) {
return dialog.pointerDragged( x, y );
}
if ( soft != null && ( soft.isLeftPressed || soft.isRightPressed ) ) {
/** Soft is pressed down **/
return soft.pointerDragged( x, y );
}
return gObject.pointerDragged( x, y );
}
/**
* Called when the pointer is pressed.
*/
protected void pointerPressed( int x, int y ) {
if ( dialog != null ) {
dialog.pointerPressed( x, y );
return;
}
if ( soft != null && ( x >= Soft.getX() && y >= Soft.getY()
&& x < ( Soft.getX() + Soft.getWidth() ) && y < ( Soft.getY() + soft.getHeight() ) ) ) {
/** Pointer pressed on soft **/
if ( x <= ( Soft.getX() + Soft.getWidth() / 2 ) ) {
/** Left soft is pressed (inverting trigger) **/
if ( soft.isLeftPressed || !( soft.isLeftPressed || soft.isRightPressed ) ) {
if ( !soft.isLeftPressed ) {
soft.leftSoft.actionPerformed();
}
soft.setLeftSoftPressed( !soft.isLeftPressed );
}
} else {
/** Right soft is pressed (inverting trigger) **/
if ( soft.isRightPressed || !( soft.isLeftPressed || soft.isRightPressed ) ) {
if ( !soft.isRightPressed ) {
soft.rightSoft.actionPerformed();
}
soft.setRightSoftPressed( !soft.isRightPressed );
}
}
} else if ( soft != null && ( soft.isLeftPressed || soft.isRightPressed ) ) {
soft.pointerPressed( x, y );
} else {
gObject.pointerPressed( x, y );
}
}
/**
* Called when the pointer is released.
*/
protected void pointerReleased( int x, int y ) {
if ( dialog != null ) {
dialog.pointerReleased( x, y );
return;
}
if ( soft != null && ( soft.isLeftPressed || soft.isRightPressed ) ) {
/** If any soft is already pressed down **/
if ( soft.isLeftPressed && soft.leftSoft.isEmpty() ) {
soft.setLeftSoftPressed( false );
} else if ( soft.isRightPressed && soft.rightSoft.isEmpty() ) {
soft.setRightSoftPressed( false );
} else {
soft.pointerReleased( x, y );
}
return;
}
gObject.pointerReleased( x, y );
}
public void setGObject( GObject gObject ) {
this.gObject = gObject;
this.gObject.setTouchOrientation( screen.isPointerEvents );
}
public GObject getGObject() {
return gObject;
}
public void addKeyEvent( KeyEvent keyEvent ) {
if ( keyEvents == null ) {
keyEvents = new Hashtable();
}
keyEvents.put( keyEvent.description, keyEvent );
}
public void removeKeyEvent( String description ) {
if ( keyEvents == null ) {
return;
}
if ( keyEvents.containsKey( description ) ) {
keyEvents.remove( keyEvents.get( description ) );
}
}
public void removeAllKeyEvents() {
if ( keyEvents == null ) {
return;
}
keyEvents.clear();
}
public KeyEvent getKeyEvent( String description ) {
if ( keyEvents != null && keyEvents.containsKey( description ) ) {
return ( KeyEvent ) keyEvents.get( description );
}
return null;
}
public void windowActivated() {
}
}
| [
"inbox@tomclaw.com"
] | inbox@tomclaw.com |
5687fee1e7ae8e00aae1b552767d1be61c6dc407 | 9f99e7a225279733e9e1f1e2423dcc691742d586 | /src/test/java/com/example/shdemo/service/PureDBUnitTest.java | 6f2f5ce1fe95fe5b2781e788e0005d35953e45a9 | [] | no_license | lecter69/shdemo-1 | 0f94aceca832d16c771ab3725278bd83d2371702 | 6d7b648eaaf8ab4719203c491af327bb5ef3831d | refs/heads/master | 2020-11-30T16:21:32.323397 | 2013-04-05T10:33:34 | 2013-04-05T10:33:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,057 | java | package com.example.shdemo.service;
import java.io.File;
import java.io.FileInputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import org.dbunit.Assertion;
import org.dbunit.IDatabaseTester;
import org.dbunit.JdbcDatabaseTester;
import org.dbunit.database.DatabaseConnection;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.ITable;
import org.dbunit.dataset.filter.DefaultColumnFilter;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
import org.dbunit.operation.DatabaseOperation;
import org.hibernate.cfg.annotations.reflection.XMLContext.Default;
import junit.framework.TestCase;
public class PureDBUnitTest extends TestCase {
Connection jdbcConnetion;
IDatabaseConnection connection;
private IDatabaseTester databaseTester;
private IDataSet dataset;
protected void setUp() throws Exception {
jdbcConnetion = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/workdb","sa","");
connection = new DatabaseConnection(jdbcConnetion);
databaseTester = new JdbcDatabaseTester("org.hsqldb.jdbcDriver", "jdbc:hsqldb:hsql://localhost/workdb","sa","");
dataset = new FlatXmlDataSetBuilder().build(new FileInputStream(new File("src/test/resources/fuldata.xml")));
databaseTester.setDataSet(dataset);
databaseTester.onSetup();
//DatabaseOperation.CLEAN_INSERT.execute(connection, dataset);
}
protected void tearDown() throws Exception {
databaseTester.onTearDown();
}
public void test() throws Exception {
// Operacje
IDataSet dbDataSet = connection.createDataSet();
ITable actualTable = dbDataSet.getTable("PERSON");
ITable filteredTable = DefaultColumnFilter.excludedColumnsTable(actualTable, new String[]{"ID"});
IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(new File("src/test/resources/persondata.xml"));
ITable expectedTable = expectedDataSet.getTable("PERSON");
Assertion.assertEquals(expectedTable, filteredTable);
}
}
| [
"jairek@o2.pl"
] | jairek@o2.pl |
c0636343c7c5cdc7761082a53e6ab97132905229 | c4caf822493e6c8bb90adf20ad192502d34cd284 | /MDPsim/src/mdpsimRobot/Node.java | 6cb322e792d1b60b429c9de4413088d8242744ea | [] | no_license | MDP-15/Algorithm | 799469f86bae9f2b5dc1479514e1cdaa1807770f | 576431ff39be130178f4d6d8e436d0112b5812aa | refs/heads/master | 2023-01-02T22:29:46.106965 | 2020-10-08T00:44:55 | 2020-10-08T00:44:55 | 287,704,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,956 | java | package mdpsimRobot;
import java.util.ArrayList;
public class Node {
public int x;
public int y;
public Node prev;
public RobotAction ra;
public RobotDirection rd;
public double score;
public Node (int x, int y, Node prev, RobotAction ra, RobotDirection rd, double score) {
this.x =x;
this.y =y;
this.prev = prev;
this.ra = ra;
this.rd = rd;
this.score = score;
return;
}
public double manhattanDist(int x1, int y1, int x2, int y2) {
return Math.abs(x1-x2)+Math.abs(y1-y2);
}
public ArrayList<Node>neighbours(int dx, int dy, ArrayList<ArrayList<Integer>> mapmemory){
ArrayList<Node> n = new ArrayList<Node>();
if (rd == RobotDirection.UP) {
//TR
Node tr = new Node(x,y,this,RobotAction.TR,rd.TR(),score+1+manhattanDist(x,y,dx,dy));
if (tr.isValid(mapmemory)) {
n.add(tr);
}
//TL
Node tl =new Node(x,y,this,RobotAction.TL,rd.TL(),score+1+manhattanDist(x,y,dx,dy));
if (tl.isValid(mapmemory)) {
n.add(tl);
}
//F1
Node f1 = new Node(x-1,y,this,RobotAction.F1,rd.F1(),score+1+manhattanDist(x,y,dx,dy));
if (f1.isValid(mapmemory)) {
n.add(f1);
}
//F2
Node f2 = new Node(x-2,y,this,RobotAction.F2,rd.F2(),score+1+manhattanDist(x,y,dx,dy));
if (f2.isValid(mapmemory)) {
n.add(f2);
}
//F3
Node f3 = new Node(x-3,y,this,RobotAction.F3,rd.F3(),score+1+manhattanDist(x,y,dx,dy));
if (f3.isValid(mapmemory)) {
n.add(f3);
}
} else if (rd == RobotDirection.DOWN) {
//TR
Node tr = new Node(x,y,this,RobotAction.TR,rd.TR(),score+1+manhattanDist(x,y,dx,dy));
if (tr.isValid(mapmemory)) {
n.add(tr);
}
//TL
Node tl =new Node(x,y,this,RobotAction.TL,rd.TL(),score+1+manhattanDist(x,y,dx,dy));
if (tl.isValid(mapmemory)) {
n.add(tl);
}
//F1
Node f1 = new Node(x+1,y,this,RobotAction.F1,rd.F1(),score+1+manhattanDist(x,y,dx,dy));
if (f1.isValid(mapmemory)) {
n.add(f1);
}
//F2
Node f2 = new Node(x+2,y,this,RobotAction.F2,rd.F2(),score+1+manhattanDist(x,y,dx,dy));
if (f2.isValid(mapmemory)) {
n.add(f2);
}
//F3
Node f3 = new Node(x+3,y,this,RobotAction.F3,rd.F3(),score+1+manhattanDist(x,y,dx,dy));
if (f3.isValid(mapmemory)) {
n.add(f3);
}
} else if (rd == RobotDirection.LEFT) {
//TR
Node tr = new Node(x,y,this,RobotAction.TR,rd.TR(),score+1+manhattanDist(x,y,dx,dy));
if (tr.isValid(mapmemory)) {
n.add(tr);
}
//TL
Node tl =new Node(x,y,this,RobotAction.TL,rd.TL(),score+1+manhattanDist(x,y,dx,dy));
if (tl.isValid(mapmemory)) {
n.add(tl);
}
//F1
Node f1 = new Node(x,y-1,this,RobotAction.F1,rd.F1(),score+1+manhattanDist(x,y,dx,dy));
if (f1.isValid(mapmemory)) {
n.add(f1);
}
//F2
Node f2 = new Node(x,y-2,this,RobotAction.F2,rd.F2(),score+1+manhattanDist(x,y,dx,dy));
if (f2.isValid(mapmemory)) {
n.add(f2);
}
//F3
Node f3 = new Node(x,y-3,this,RobotAction.F3,rd.F3(),score+1+manhattanDist(x,y,dx,dy));
if (f3.isValid(mapmemory)) {
n.add(f3);
}
} else if (rd == RobotDirection.RIGHT) {
//TR
Node tr = new Node(x,y,this,RobotAction.TR,rd.TR(),score+1+manhattanDist(x,y,dx,dy));
if (tr.isValid(mapmemory)) {
n.add(tr);
}
//TL
Node tl =new Node(x,y,this,RobotAction.TL,rd.TL(),score+1+manhattanDist(x,y,dx,dy));
if (tl.isValid(mapmemory)) {
n.add(tl);
}
//F1
Node f1 = new Node(x,y+1,this,RobotAction.F1,rd.F1(),score+1+manhattanDist(x,y,dx,dy));
if (f1.isValid(mapmemory)) {
n.add(f1);
}
//F2
Node f2 = new Node(x,y+2,this,RobotAction.F2,rd.F2(),score+1+manhattanDist(x,y,dx,dy));
if (f2.isValid(mapmemory)) {
n.add(f2);
}
//F3
Node f3 = new Node(x,y+3,this,RobotAction.F3,rd.F3(),score+1+manhattanDist(x,y,dx,dy));
if (f3.isValid(mapmemory)) {
n.add(f3);
}
}
return n;
}
public boolean isValid(ArrayList<ArrayList<Integer>> mapmemory) {
int mapx = 0;
int mapy = 0;
boolean verbose = false;
if (verbose) {
System.out.println(x+" "+y);
System.out.print(mapValid(x-1 ,y+1 ,mapmemory));
System.out.print(mapValid(x-1 ,y ,mapmemory));
System.out.println(mapValid(x-1 ,y-1 ,mapmemory));
System.out.print(mapValid(x ,y+1 ,mapmemory));
System.out.print(mapValid(x ,y ,mapmemory));
System.out.println(mapValid(x ,y-1 ,mapmemory));
System.out.print(mapValid(x+1 ,y+1 ,mapmemory));
System.out.print(mapValid(x+1 ,y ,mapmemory));
System.out.println(mapValid(x+1 ,y-1 ,mapmemory));
System.out.println();
}
if ( mapValid(x+1 ,y+1 ,mapmemory)
&& mapValid(x ,y+1 ,mapmemory)
&& mapValid(x-1 ,y+1 ,mapmemory)
&& mapValid(x+1 ,y ,mapmemory)
&& mapValid(x ,y ,mapmemory)
&& mapValid(x-1 ,y ,mapmemory)
&& mapValid(x+1 ,y-1 ,mapmemory)
&& mapValid(x ,y-1 ,mapmemory)
&& mapValid(x-1 ,y-1 ,mapmemory)) {
return true;
} else {
return false;
}
}
public boolean mapValid(int xpos, int ypos, ArrayList<ArrayList<Integer>> mapmemory) {
boolean verbose = false;
if (verbose) {
for (int a = 0; a < mapmemory.size(); a++) {
for (int b = 0; b < mapmemory.get(0).size(); b++) {
System.out.print(mapmemory.get(a).get(b));
}
System.out.println();
}
System.out.println();
}
try {
int a = mapmemory.get(xpos).get(ypos);
if (a != 0) {
return false;
} else {
return true;
}
} catch (Exception e) {
return false;
}
}
public boolean is(Node n) {
if (x == n.x && y == n.y && rd == n.rd) {
return true;
}
return false;
}
public boolean isCell(Node n) {
if (x == n.x && y == n.y) {
return true;
}
return false;
}
public void print() {
System.out.println("X: " + x+ "\tY: "+y+"\tRA: "+ra+"\tRD: "+rd+" Score: "+score);
System.out.println();
}
public void printParents() {
Node n = this;
boolean isnull = false;
while (!isnull) {
n.print();
if (n.prev != null) {
n = n.prev;
} else {
isnull = true;
}
}
}
}
| [
"Martzyy@users.noreply.github.com"
] | Martzyy@users.noreply.github.com |
c00c2069a4436a816e7a33646a35e0464a22549b | 8d19895dc3b59a990e71e9da8a448da9406a8898 | /TestScroll_demo/src/main/java/com/ly/test/view/MyMenuLayout.java | 1ee521f45ef350c7dddc1df4d7f8decd5a026907 | [] | no_license | MintLy/AndroidHeroDemo | b21e2a9315c9e8650aa24e83c83c39a5421a9fd0 | b6ddda926b1d27b9690cf02bc2039758de5107ed | refs/heads/master | 2021-08-23T10:40:15.345613 | 2017-12-04T15:15:48 | 2017-12-04T15:15:48 | 113,055,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,600 | java | package com.ly.test.view;
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
/**
* Created by 20170117 on 2017/10/22.
*/
public class MyMenuLayout extends LinearLayout
{
private boolean once;
private FrameLayout mMenu;
private FrameLayout mContent;
private int mMenuWidth;
private int mScreenWidth;
private int mMenuRightPadding = 200;
public MyMenuLayout(Context context, @Nullable AttributeSet attrs)
{
super(context, attrs);
WindowManager wm = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics outMetrics = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(outMetrics);
mScreenWidth = outMetrics.widthPixels;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
if (!once)
{
mMenu = (FrameLayout) getChildAt(0);
mContent = (FrameLayout) getChildAt(1);
mMenuWidth = mMenu.getLayoutParams().width = mScreenWidth
- mMenuRightPadding;
mContent.getLayoutParams().width = mScreenWidth;
once = true;
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b)
{
super.onLayout(changed, l, t, r, b);
}
}
| [
"mint_ly@163.com"
] | mint_ly@163.com |
a7a695ab26dd582537015f9ea5b2556e0ee35d30 | 30cb0bcc1fa0b150154253a0c5c13eee8e28c552 | /src/oca/arraylist/NamesArrayList.java | 117a2beed3ba4f9d119064f8800f3a3392799e72 | [] | no_license | NtandoF/oca-prep-code-snippets | 4d0a91a66aee1160726e3a3e4512ae6b0fe777b3 | a2d3f276480f8a161de4377e04fed4272ea97ecc | refs/heads/master | 2020-06-27T05:22:05.822442 | 2019-07-30T14:43:05 | 2019-07-30T14:43:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 56 | java | package oca.arraylist;
public class NamesArrayList {
}
| [
"andre.vermeulen@gmail.com"
] | andre.vermeulen@gmail.com |
21866eddb16f578703be8707efd5e0d4c89fea8d | af8610eaffcfa784928c3c8e6e62bcf13013a0ed | /src/main/java/domain/validators/TeamValidator.java | 1d91dc41e170b28f4615809d67b7dd310d63d901 | [] | no_license | Thodoras/selforggym | 0f456156571fcea6a0ce18a97db5ffcfb0813390 | 511edefd6b4e1c3bb3ef27689692138376721a01 | refs/heads/master | 2021-04-27T00:15:52.343196 | 2018-03-27T11:56:08 | 2018-03-27T11:56:08 | 123,781,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,324 | java | package domain.validators;
import dtos.TeamDto;
import peristence.repositories.TeamRepository;
import utils.exceptions.InputAlreadyExistsException;
import utils.exceptions.InvalidInputException;
import utils.exceptions.MissingFieldException;
import java.sql.SQLException;
import java.util.List;
import java.util.regex.Pattern;
public class TeamValidator {
private static final TeamValidator INSTANCE = new TeamValidator();
private static final Pattern nameInputPattern = Pattern.compile("^[a-zA-z]([a-zA-Z0-9-_](\\s)?)+$");
private TeamValidator() {
}
public static TeamValidator getInstance() {
return INSTANCE;
}
public void validateTeamDto(TeamDto teamDto) throws MissingFieldException
, InvalidInputException
, InputAlreadyExistsException {
validateTeamName(teamDto.getTeamName());
validateTeamActivity(teamDto.getTeamActivity());
}
private void validateTeamName(String teamName) throws MissingFieldException
, InvalidInputException
, InputAlreadyExistsException {
if (!hasValue(teamName)) {
throw new MissingFieldException("Team name cannot be empty!");
}
if (!nameInputPattern.matcher(teamName).matches()) {
throw new InvalidInputException("Team name should start with a letter and have at least two characters");
}
if (alreadyExists(teamName)) {
throw new InputAlreadyExistsException("Team name already exists try another one!");
}
}
private void validateTeamActivity(String activityName) throws MissingFieldException
, InvalidInputException {
if (!hasValue(activityName)) {
throw new MissingFieldException("Activity name cannot be empty!");
}
if (!nameInputPattern.matcher(activityName).matches()) {
throw new InvalidInputException("Activity name should start with a letter and have at least two characters");
}
}
private boolean hasValue(String str) {
return str != null && !str.isEmpty();
}
private Boolean alreadyExists(String teamName) {
try {
return !TeamRepository.getInstance().getByName(teamName).isEmpty();
} catch (SQLException e) {
}
return null;
}
}
| [
"theodoretopol@gmail.com"
] | theodoretopol@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.