blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
558184ffb09538420d131748b13f658c4ccc4929 | 28101cf2701fd38c592b92fed131787edd03fa85 | /src/main/java/org/univr/staticimp/antlr/StaticImpLexer.java | afb4519d152f133cbb78174240ebb103e11a34a0 | [
"MIT"
] | permissive | nicolaserlonghi/antlr-university-project | a4cd919c2d6dafcf4c99b724885eafeaab25f01d | ba9236eb6a09d067beef49aac94fd9186b3b7c3c | refs/heads/master | 2020-04-15T10:27:57.873293 | 2019-02-07T13:24:30 | 2019-02-07T13:24:30 | 164,597,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,013 | java | // Generated from /Users/nicola/Desktop/staticimp/src/main/resources/StaticImp.g4 by ANTLR 4.7.2
package org.univr.staticimp.antlr;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.*;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class StaticImpLexer extends Lexer {
static { RuntimeMetaData.checkVersion("4.7.2", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
TNAT=1, TBOOL=2, NAT=3, BOOL=4, PLUS=5, MINUS=6, MUL=7, DIV=8, MOD=9,
POW=10, AND=11, OR=12, EQQ=13, NEQ=14, LEQ=15, GEQ=16, LT=17, GT=18, NOT=19,
IF=20, ELSEIF=21, THEN=22, ELSE=23, WHILE=24, DO=25, SKIPP=26, ASSIGN=27,
OUT=28, FOR=29, ND=30, LPAR=31, RPAR=32, LBRACE=33, RBRACE=34, SEMICOLON=35,
COMMA=36, ID=37, WS=38;
public static String[] channelNames = {
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
};
public static String[] modeNames = {
"DEFAULT_MODE"
};
private static String[] makeRuleNames() {
return new String[] {
"TNAT", "TBOOL", "NAT", "BOOL", "PLUS", "MINUS", "MUL", "DIV", "MOD",
"POW", "AND", "OR", "EQQ", "NEQ", "LEQ", "GEQ", "LT", "GT", "NOT", "IF",
"ELSEIF", "THEN", "ELSE", "WHILE", "DO", "SKIPP", "ASSIGN", "OUT", "FOR",
"ND", "LPAR", "RPAR", "LBRACE", "RBRACE", "SEMICOLON", "COMMA", "ID",
"WS"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
null, "'nat'", "'bool'", null, null, "'+'", "'-'", "'*'", "'/'", "'mod'",
"'^'", "'&'", "'|'", "'=='", "'!='", "'<='", "'>='", "'<'", "'>'", "'!'",
"'if'", "'elseif'", "'then'", "'else'", "'while'", "'do'", "'skip'",
"'='", "'out'", "'for'", "'nd'", "'('", "')'", "'{'", "'}'", "';'", "','"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
null, "TNAT", "TBOOL", "NAT", "BOOL", "PLUS", "MINUS", "MUL", "DIV",
"MOD", "POW", "AND", "OR", "EQQ", "NEQ", "LEQ", "GEQ", "LT", "GT", "NOT",
"IF", "ELSEIF", "THEN", "ELSE", "WHILE", "DO", "SKIPP", "ASSIGN", "OUT",
"FOR", "ND", "LPAR", "RPAR", "LBRACE", "RBRACE", "SEMICOLON", "COMMA",
"ID", "WS"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
public StaticImpLexer(CharStream input) {
super(input);
_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
@Override
public String getGrammarFileName() { return "StaticImp.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public String[] getChannelNames() { return channelNames; }
@Override
public String[] getModeNames() { return modeNames; }
@Override
public ATN getATN() { return _ATN; }
public static final String _serializedATN =
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2(\u00d8\b\1\4\2\t"+
"\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
"\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+
"\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\3\2\3\2\3\2\3\2\3\3\3\3\3"+
"\3\3\3\3\3\3\4\3\4\3\4\7\4\\\n\4\f\4\16\4_\13\4\5\4a\n\4\3\5\3\5\3\5\3"+
"\5\3\5\3\5\3\5\3\5\3\5\5\5l\n\5\3\6\3\6\3\7\3\7\3\b\3\b\3\t\3\t\3\n\3"+
"\n\3\n\3\n\3\13\3\13\3\f\3\f\3\r\3\r\3\16\3\16\3\16\3\17\3\17\3\17\3\20"+
"\3\20\3\20\3\21\3\21\3\21\3\22\3\22\3\23\3\23\3\24\3\24\3\25\3\25\3\25"+
"\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\27\3\27\3\27\3\27\3\27\3\30\3\30"+
"\3\30\3\30\3\30\3\31\3\31\3\31\3\31\3\31\3\31\3\32\3\32\3\32\3\33\3\33"+
"\3\33\3\33\3\33\3\34\3\34\3\35\3\35\3\35\3\35\3\36\3\36\3\36\3\36\3\37"+
"\3\37\3\37\3 \3 \3!\3!\3\"\3\"\3#\3#\3$\3$\3%\3%\3&\6&\u00ce\n&\r&\16"+
"&\u00cf\3\'\6\'\u00d3\n\'\r\'\16\'\u00d4\3\'\3\'\2\2(\3\3\5\4\7\5\t\6"+
"\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35\20\37\21!\22#\23%\24"+
"\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67\359\36;\37= ?!A\"C#E$G%I&K"+
"\'M(\3\2\6\3\2\63;\3\2\62;\3\2c|\5\2\13\f\17\17\"\"\2\u00dc\2\3\3\2\2"+
"\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3"+
"\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2"+
"\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2"+
"\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2"+
"\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3"+
"\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2"+
"\2\2K\3\2\2\2\2M\3\2\2\2\3O\3\2\2\2\5S\3\2\2\2\7`\3\2\2\2\tk\3\2\2\2\13"+
"m\3\2\2\2\ro\3\2\2\2\17q\3\2\2\2\21s\3\2\2\2\23u\3\2\2\2\25y\3\2\2\2\27"+
"{\3\2\2\2\31}\3\2\2\2\33\177\3\2\2\2\35\u0082\3\2\2\2\37\u0085\3\2\2\2"+
"!\u0088\3\2\2\2#\u008b\3\2\2\2%\u008d\3\2\2\2\'\u008f\3\2\2\2)\u0091\3"+
"\2\2\2+\u0094\3\2\2\2-\u009b\3\2\2\2/\u00a0\3\2\2\2\61\u00a5\3\2\2\2\63"+
"\u00ab\3\2\2\2\65\u00ae\3\2\2\2\67\u00b3\3\2\2\29\u00b5\3\2\2\2;\u00b9"+
"\3\2\2\2=\u00bd\3\2\2\2?\u00c0\3\2\2\2A\u00c2\3\2\2\2C\u00c4\3\2\2\2E"+
"\u00c6\3\2\2\2G\u00c8\3\2\2\2I\u00ca\3\2\2\2K\u00cd\3\2\2\2M\u00d2\3\2"+
"\2\2OP\7p\2\2PQ\7c\2\2QR\7v\2\2R\4\3\2\2\2ST\7d\2\2TU\7q\2\2UV\7q\2\2"+
"VW\7n\2\2W\6\3\2\2\2Xa\7\62\2\2Y]\t\2\2\2Z\\\t\3\2\2[Z\3\2\2\2\\_\3\2"+
"\2\2][\3\2\2\2]^\3\2\2\2^a\3\2\2\2_]\3\2\2\2`X\3\2\2\2`Y\3\2\2\2a\b\3"+
"\2\2\2bc\7v\2\2cd\7t\2\2de\7w\2\2el\7g\2\2fg\7h\2\2gh\7c\2\2hi\7n\2\2"+
"ij\7u\2\2jl\7g\2\2kb\3\2\2\2kf\3\2\2\2l\n\3\2\2\2mn\7-\2\2n\f\3\2\2\2"+
"op\7/\2\2p\16\3\2\2\2qr\7,\2\2r\20\3\2\2\2st\7\61\2\2t\22\3\2\2\2uv\7"+
"o\2\2vw\7q\2\2wx\7f\2\2x\24\3\2\2\2yz\7`\2\2z\26\3\2\2\2{|\7(\2\2|\30"+
"\3\2\2\2}~\7~\2\2~\32\3\2\2\2\177\u0080\7?\2\2\u0080\u0081\7?\2\2\u0081"+
"\34\3\2\2\2\u0082\u0083\7#\2\2\u0083\u0084\7?\2\2\u0084\36\3\2\2\2\u0085"+
"\u0086\7>\2\2\u0086\u0087\7?\2\2\u0087 \3\2\2\2\u0088\u0089\7@\2\2\u0089"+
"\u008a\7?\2\2\u008a\"\3\2\2\2\u008b\u008c\7>\2\2\u008c$\3\2\2\2\u008d"+
"\u008e\7@\2\2\u008e&\3\2\2\2\u008f\u0090\7#\2\2\u0090(\3\2\2\2\u0091\u0092"+
"\7k\2\2\u0092\u0093\7h\2\2\u0093*\3\2\2\2\u0094\u0095\7g\2\2\u0095\u0096"+
"\7n\2\2\u0096\u0097\7u\2\2\u0097\u0098\7g\2\2\u0098\u0099\7k\2\2\u0099"+
"\u009a\7h\2\2\u009a,\3\2\2\2\u009b\u009c\7v\2\2\u009c\u009d\7j\2\2\u009d"+
"\u009e\7g\2\2\u009e\u009f\7p\2\2\u009f.\3\2\2\2\u00a0\u00a1\7g\2\2\u00a1"+
"\u00a2\7n\2\2\u00a2\u00a3\7u\2\2\u00a3\u00a4\7g\2\2\u00a4\60\3\2\2\2\u00a5"+
"\u00a6\7y\2\2\u00a6\u00a7\7j\2\2\u00a7\u00a8\7k\2\2\u00a8\u00a9\7n\2\2"+
"\u00a9\u00aa\7g\2\2\u00aa\62\3\2\2\2\u00ab\u00ac\7f\2\2\u00ac\u00ad\7"+
"q\2\2\u00ad\64\3\2\2\2\u00ae\u00af\7u\2\2\u00af\u00b0\7m\2\2\u00b0\u00b1"+
"\7k\2\2\u00b1\u00b2\7r\2\2\u00b2\66\3\2\2\2\u00b3\u00b4\7?\2\2\u00b48"+
"\3\2\2\2\u00b5\u00b6\7q\2\2\u00b6\u00b7\7w\2\2\u00b7\u00b8\7v\2\2\u00b8"+
":\3\2\2\2\u00b9\u00ba\7h\2\2\u00ba\u00bb\7q\2\2\u00bb\u00bc\7t\2\2\u00bc"+
"<\3\2\2\2\u00bd\u00be\7p\2\2\u00be\u00bf\7f\2\2\u00bf>\3\2\2\2\u00c0\u00c1"+
"\7*\2\2\u00c1@\3\2\2\2\u00c2\u00c3\7+\2\2\u00c3B\3\2\2\2\u00c4\u00c5\7"+
"}\2\2\u00c5D\3\2\2\2\u00c6\u00c7\7\177\2\2\u00c7F\3\2\2\2\u00c8\u00c9"+
"\7=\2\2\u00c9H\3\2\2\2\u00ca\u00cb\7.\2\2\u00cbJ\3\2\2\2\u00cc\u00ce\t"+
"\4\2\2\u00cd\u00cc\3\2\2\2\u00ce\u00cf\3\2\2\2\u00cf\u00cd\3\2\2\2\u00cf"+
"\u00d0\3\2\2\2\u00d0L\3\2\2\2\u00d1\u00d3\t\5\2\2\u00d2\u00d1\3\2\2\2"+
"\u00d3\u00d4\3\2\2\2\u00d4\u00d2\3\2\2\2\u00d4\u00d5\3\2\2\2\u00d5\u00d6"+
"\3\2\2\2\u00d6\u00d7\b\'\2\2\u00d7N\3\2\2\2\b\2]`k\u00cf\u00d4\3\b\2\2";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
} | [
"nicolaserlonghi@gmail.com"
] | nicolaserlonghi@gmail.com |
78c5a425bf83f60adaea4c08035ae2733be23a2e | 5bf18d21fb9fd3f53e4c75f38b8d18c4f09f7408 | /src/rpg/class_cb.java | e2a6cefbb72cf5166fc7a3e4ec4c5eaf45f5e0d5 | [] | no_license | Chicken-0/Heroes_Lore_Wind_Of_Soltia | 37d95b63cf78ca454c3e466fec25ff5aae0e5b2b | 1fed69befcf170c8e52fdac531cc932b96be5992 | refs/heads/master | 2022-11-16T21:34:31.232233 | 2020-07-14T15:35:30 | 2020-07-14T15:35:30 | 277,023,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,774 | java | package rpg;
import javax.microedition.lcdui.Graphics;
// $FF: renamed from: cb
public abstract class class_cb implements class_u {
// $FF: renamed from: a cb
public class_cb field_class_cb_a;
// $FF: renamed from: b cb
public class_cb field_class_cb_b;
// $FF: renamed from: b boolean
private boolean field_boolean_b;
// $FF: renamed from: a boolean
public boolean field_boolean_a;
// $FF: renamed from: a byte
public byte field_byte_a;
// $FF: renamed from: b byte
public byte field_byte_b;
public class_cb(class_cb var1, byte var2) {
this.field_class_cb_a = var1;
this.field_class_cb_b = null;
this.field_boolean_b = true;
this.field_boolean_a = true;
this.field_byte_a = var2;
this.field_byte_b = 0;
}
// $FF: renamed from: a (int, int) boolean
public abstract boolean func_boolean_a(int var1, int var2);
// $FF: renamed from: b (int, int) boolean
public final boolean func_boolean_b(int var1, int var2) {
if (this.field_class_cb_b != null && this.field_class_cb_b.func_boolean_a(var1, var2)) {
return true;
} else {
this.field_boolean_a = true;
return false;
}
}
// $FF: renamed from: a (javax.microedition.lcdui.Graphics, int, int) void
public abstract void func_void_a(Graphics var1, int var2, int var3);
// $FF: renamed from: b (javax.microedition.lcdui.Graphics, int, int) void
public final void func_void_b(Graphics var1, int var2, int var3) {
boolean var4 = false;
if (this.field_boolean_a) {
this.field_boolean_a = false;
this.func_void_a(var1, var2, var3);
var4 = true;
}
if (this.field_class_cb_b == null) {
if (this.field_boolean_b) {
if (!var4) {
this.func_void_a(var1, var2, var3);
}
this.field_boolean_b = false;
return;
}
} else {
this.field_class_cb_b.func_void_b(var1, var2, var3);
}
}
// $FF: renamed from: a (int, int, boolean) boolean
public final boolean func_boolean_a(int var1, int var2, boolean var3) {
switch(var2) {
case 50:
this.func_void_a((byte)3, var3);
return true;
case 56:
this.func_void_a((byte)4, var3);
return true;
default:
switch(var1) {
case 1:
this.func_void_a((byte)3, var3);
return true;
case 6:
this.func_void_a((byte)4, var3);
return true;
default:
return false;
}
}
}
// $FF: renamed from: c (int, int) boolean
public final boolean func_boolean_c(int var1, int var2) {
return this.func_boolean_a(var1, var2, false);
}
// $FF: renamed from: d (int, int) boolean
public final boolean func_boolean_d(int var1, int var2) {
switch(var2) {
case 52:
this.func_void_a((byte)3);
return true;
case 54:
this.func_void_a((byte)4);
return true;
default:
switch(var1) {
case 2:
this.func_void_a((byte)3);
return true;
case 5:
this.func_void_a((byte)4);
return true;
default:
return false;
}
}
}
// $FF: renamed from: a (byte) void
public void func_void_a(byte var1) {
this.func_void_a(var1, true);
}
// $FF: renamed from: a (byte, boolean) void
public final void func_void_a(byte var1, boolean var2) {
if (var1 == 4) {
++this.field_byte_b;
if (this.field_byte_b >= this.field_byte_a) {
if (var2) {
this.field_byte_b = 0;
return;
}
this.field_byte_b = (byte)(this.field_byte_a - 1);
if (this.field_byte_b < 0) {
this.field_byte_b = 0;
return;
}
}
} else {
--this.field_byte_b;
if (this.field_byte_b < 0) {
if (var2) {
this.field_byte_b = (byte)(this.field_byte_a - 1);
return;
}
this.field_byte_b = 0;
}
}
}
// $FF: renamed from: a (byte, byte) void
public void func_void_a(byte var1, byte var2) {
this.field_class_cb_b = null;
if (class_bs.field_class_as_a != null) {
class_bs.field_class_as_a.func_void_a();
}
this.func_void_b();
}
// $FF: renamed from: a () void
public final void func_void_a() {
this.field_class_cb_b = null;
if (class_bs.field_class_as_a != null) {
class_bs.field_class_as_a.func_void_a();
}
this.func_void_b();
}
// $FF: renamed from: a (byte, byte, java.lang.Object[]) void
public final void func_void_a(byte var1, byte var2, Object[] var3) {
this.field_class_cb_b = new class_af(this, var1, var2, var3, (char[])null, (char[])null);
}
// $FF: renamed from: a (byte, byte, java.lang.Object[], char[], char[]) void
public final void func_void_a(byte var1, byte var2, Object[] var3, char[] var4, char[] var5) {
this.field_class_cb_b = new class_af(this, var1, var2, var3, var4, var5);
}
// $FF: renamed from: a (java.lang.Object[]) void
public final void func_void_a(Object[] var1) {
this.field_class_cb_b = new class_af(this, (byte)1, (byte)0, var1, (char[])null, (char[])null);
}
// $FF: renamed from: b () void
public final void func_void_b() {
if (this.field_class_cb_a != null) {
this.field_class_cb_a.func_void_b();
}
this.field_boolean_a = true;
}
// $FF: renamed from: c () void
public final void func_void_c() {
if (this.field_class_cb_b != null) {
this.field_class_cb_b.func_void_c();
}
this.field_boolean_a = true;
}
// $FF: renamed from: a () int
public final int func_int_a() {
return this.field_byte_b / 5 + 1;
}
// $FF: renamed from: b () int
public final int func_int_b() {
return (this.field_byte_a - 1) / 5 + 1;
}
// $FF: renamed from: c () int
public final int func_int_c() {
return (this.func_int_a() - 1) * 5;
}
// $FF: renamed from: d () int
public final int func_int_d() {
int var1;
return (var1 = this.func_int_a() * 5 - 1) > this.field_byte_a - 1 ? this.field_byte_a - 1 : var1;
}
// $FF: renamed from: a (javax.microedition.lcdui.Graphics, int, int, boolean) void
public final void func_void_a(Graphics var1, int var2, int var3, boolean var4) {
byte var5 = (byte)(this.field_byte_b % 5);
int var6;
if ((var6 = this.field_byte_a - (this.func_int_a() - 1) * 5) > 5) {
var6 = 5;
}
for(byte var7 = 0; var7 < var6; ++var7) {
if (var7 != var5) {
func_void_a(var1, var2, var3, var7, false);
}
}
func_void_a(var1, var2 + 27, var3 + 10, 120, 137, 4136767, 10452799, 4144959);
func_void_a(var1, var2 + 27, var3 + 10, 120, 137, 6242111);
func_void_a(var1, var2, var3, var5, true);
if (var4) {
if (this.func_int_a() > 1) {
var1.drawImage(class_ce.field_class_javax_microedition_lcdui_Image_k, var2 + 70, var3 + 4, 20);
}
if (this.func_int_a() < this.func_int_b()) {
var1.drawImage(class_ce.field_class_javax_microedition_lcdui_Image_n, var2 + 70, var3 + 148, 20);
}
}
}
// $FF: renamed from: a (javax.microedition.lcdui.Graphics, int, int, int, int, int, int) void
private static final void func_void_a(Graphics var0, int var1, int var2, int var3, int var4, int var5, int var6) {
var0.setColor(var5);
var0.drawLine(var1 + 1, var2, var1 + var3 - 2, var2);
var0.drawLine(var1, var2 + 1, var1, var2 + var4 - 2);
var0.setColor(var6);
var0.drawLine(var1 + var3 - 1, var2 + 1, var1 + var3 - 1, var2 + var4 - 1);
var0.drawLine(var1 + 1, var2 + var4 - 1, var1 + var3 - 2, var2 + var4 - 1);
}
// $FF: renamed from: c (javax.microedition.lcdui.Graphics, int, int, int, int, int) void
private static final void func_void_c(Graphics var0, int var1, int var2, int var3, int var4, int var5) {
var0.setColor(var5);
var0.fillRect(var1 + 1, var2 + 1, var3 - 2, var4 - 2);
}
// $FF: renamed from: a (javax.microedition.lcdui.Graphics, int, int, int, int, int, int, int) void
public static final void func_void_a(Graphics var0, int var1, int var2, int var3, int var4, int var5, int var6, int var7) {
var0.setColor(var5);
var0.drawLine(var1 + 1, var2, var1 + var3 - 2, var2);
var0.drawLine(var1 + var3 - 1, var2 + 1, var1 + var3 - 1, var2 + var4 - 2);
var0.drawLine(var1 + 1, var2 + var4 - 1, var1 + var3 - 2, var2 + var4 - 1);
var0.drawLine(var1, var2 + 1, var1, var2 + var4 - 2);
var0.setColor(var6);
var0.drawLine(var1 + 1, var2 + 1, var1 + var3 - 3, var2 + 1);
var0.drawLine(var1 + 1, var2 + 1, var1 + 1, var2 + var4 - 3);
var0.setColor(var7);
var0.drawLine(var1 + var3 - 2, var2 + 1, var1 + var3 - 2, var2 + var4 - 3);
var0.drawLine(var1 + 1, var2 + var4 - 2, var1 + var3 - 2, var2 + var4 - 2);
}
// $FF: renamed from: a (javax.microedition.lcdui.Graphics, int, int, int, int, int) void
public static final void func_void_a(Graphics var0, int var1, int var2, int var3, int var4, int var5) {
var0.setColor(var5);
var0.fillRect(var1 + 2, var2 + 2, var3 - 4, var4 - 4);
}
// $FF: renamed from: b (javax.microedition.lcdui.Graphics, int, int, int, int, int) void
public static final void func_void_b(Graphics var0, int var1, int var2, int var3, int var4, int var5) {
var0.setColor(var5);
var0.drawLine(var1 + 1, var2, var1 + var3 - 2, var2);
var0.drawLine(var1, var2 + 1, var1, var2 + var4 - 2);
var0.drawLine(var1 + var3 - 1, var2 + 1, var1 + var3 - 1, var2 + var4 - 2);
var0.drawLine(var1 + 1, var2 + var4 - 1, var1 + var3 - 2, var2 + var4 - 1);
var0.fillRect(var1 + 1, var2 + 1, var3 - 2, var4 - 2);
}
// $FF: renamed from: a (javax.microedition.lcdui.Graphics, int, int, int, int) void
public static final void func_void_a(Graphics var0, int var1, int var2, int var3, int var4) {
func_void_a(var0, var1, var2, var3, var4, 2039615, 6242111, 2039615);
}
// $FF: renamed from: b (javax.microedition.lcdui.Graphics, int, int, int, int) void
public static final void func_void_b(Graphics var0, int var1, int var2, int var3, int var4) {
func_void_a(var0, var1, var2, var3, var4, 4136767);
}
// $FF: renamed from: a (javax.microedition.lcdui.Graphics, int, int, byte, boolean) void
public static final void func_void_a(Graphics var0, int var1, int var2, byte var3, boolean var4) {
int var5 = var1 + 3;
int var6 = var2 + 10 + var3 * 23;
var0.setColor(var4 ? 4136767 : 6242111);
var0.fillRect(var5 + 1, var6, 24, 1);
var0.fillRect(var5, var6 + 1, 1, 16);
var0.fillRect(var5 + 1, var6 + 17, 24, 1);
var0.setColor(var4 ? 10452799 : 14663551);
var0.fillRect(var5 + 1, var6 + 1, 24, 1);
var0.fillRect(var5 + 1, var6 + 1, 1, 16);
var0.setColor(var4 ? 4144959 : 8347519);
var0.fillRect(var5 + 2, var6 + 16, 23, 1);
var0.setColor(var4 ? 6242111 : 10452863);
var0.fillRect(var5 + 2, var6 + 2, 24, 14);
}
// $FF: renamed from: a (javax.microedition.lcdui.Graphics, int, int, int) void
public static final void func_void_a(Graphics var0, int var1, int var2, int var3) {
MyGameCanvas.func_void_c(var0, var3, var1, var2, 8);
int var4 = MyGameCanvas.func_int_a(var3);
var0.drawImage(class_ce.field_class_javax_microedition_lcdui_Image_m, var1 - var4, var2, 24);
}
// $FF: renamed from: a (javax.microedition.lcdui.Graphics, int, int, ad, boolean) void
public static final void func_void_a(Graphics var0, int var1, int var2, class_ad var3, boolean var4) {
var0.drawImage(class_ce.field_array_class_javax_microedition_lcdui_Image_d[var3.field_byte_f], var1, var2 + 1, 3);
if (var4 && var3.field_byte_h > 1) {
MyGameCanvas.func_void_c(var0, var3.field_byte_h, var1 + 11, var2 + 2, 8);
}
}
// $FF: renamed from: a (javax.microedition.lcdui.Graphics, int, int, ad) void
public static final void func_void_a(Graphics var0, int var1, int var2, class_ad var3) {
boolean var4 = false;
if (!(var3 instanceof class_e)) {
var0.setColor(16777215);
var2 = var2 + UIGeneral.func_int_a(var0, var1, var2, 115, 1, var3.field_array_char_a) - (UIGeneral.func_int_a() + 2);
var0.setColor(14663551);
if (MyGameCanvas.canvasWidth > 128) {
UIGeneral.func_int_a(var0, var1, var2 + 15, 110, 1, var3.field_array_char_b);
} else {
UIGeneral.func_int_a(var0, var1, var2 + 15, 75, 1, var3.field_array_char_b);
}
} else {
class_e var5;
if (!(var5 = (class_e)var3).field_boolean_b) {
var0.setColor(14663551);
var2 = var2 + UIGeneral.func_int_a(var0, var1, var2, 115, 1, var5.func_array_char_a()) - (UIGeneral.func_int_a() + 2);
var0.setColor(16777215);
UIGeneral.func_int_a(var0, var1, var2 + 16, 115, 1, class_ce.field_class_z_g.loadByIndex(5));
} else {
var0.setColor(16777215);
var2 = var2 + UIGeneral.func_int_a(var0, var1, var2, 115, 1, var5.field_array_char_a) - (UIGeneral.func_int_a() + 2);
var0.setColor(14663551);
UIGeneral.func_int_a(var0, var1, var2 + 25, class_ce.field_class_z_g.loadByIndex(var5 instanceof class_l ? 4 : 46), 1);
MyGameCanvas.func_void_c(var0, var5.field_short_a, var1 + 155 - 47, var2 + 25, 8);
class_t var6;
if (var3 instanceof class_t && (var6 = (class_t)var3).field_byte_c != -1) {
var0.setColor(16711680);
var2 = var2 + UIGeneral.func_int_a(var0, var1 + 55, var2 + 10, 115, 1, class_t.field_class_z_a.loadByIndex(var6.field_byte_c)) - (UIGeneral.func_int_a() + 2);
}
var0.setColor(14663551);
UIGeneral.func_int_a(var0, var1, var2 + 40, class_ce.field_class_z_g.loadByIndex(3), 1);
MyGameCanvas.func_void_d(var0, var1 + 155 - 47, var2 + 40, var5.field_byte_e, var5.field_byte_d);
StringBuffer var8 = new StringBuffer();
for(int var7 = 0; var7 < var5.field_array_byte_j.length; ++var7) {
if (var5.field_array_byte_j[var7] > 0) {
var8.append(UIGeneral.toString(class_ce.field_class_z_a.loadByIndex(9 + var7))).append("+").append(var5.field_array_byte_j[var7]).append(" ");
}
}
var8.append(UIGeneral.toString(var5.field_array_char_b));
Object var9 = null;
char[] var10 = var8.toString().toCharArray();
if (MyGameCanvas.canvasWidth > 128) {
UIGeneral.func_int_a(var0, var1, var2 + 55, 110, 1, var10);
} else {
UIGeneral.func_int_a(var0, var1, var2 + 55, 75, 1, var10);
}
}
}
}
// $FF: renamed from: a (javax.microedition.lcdui.Graphics, int, int, ad, byte, char[], boolean) void
public static final void func_void_a(Graphics var0, int var1, int var2, class_ad var3, byte var4, char[] var5, boolean var6) {
func_void_b(var0, var1, var2 + 1, 28, 31, 12558207);
int var7 = MyGameCanvas.func_int_a(var0, class_ce.field_class_z_g.loadByIndex(2), var1 + 2, var2 + 1);
MyGameCanvas.func_void_c(var0, var4, var7 + 2, var2 + 1, 4);
var0.setColor(16777215);
UIGeneral.func_void_a(var0, var1 + 90, var2 + 2, var5, 1);
boolean var8 = false;
if (var6) {
func_void_a(var0, var1 + 30, var2 + 14, 117, 19, 4136767, 10452799, 4144959);
func_void_a(var0, var1 + 30, var2 + 14, 117, 19, 6233919);
} else {
func_void_a(var0, var1 + 30, var2 + 14, 117, 19, 6242111, 14663551, 8347519);
func_void_a(var0, var1 + 30, var2 + 14, 117, 19, 10452863);
}
if (var3 != null) {
var0.drawImage(class_ce.field_array_class_javax_microedition_lcdui_Image_d[var3.field_byte_f], var1 + 14, var2 + 19, 3);
var0.setColor(16777215);
if (var3 instanceof class_e && !((class_e)var3).field_boolean_b) {
UIGeneral.func_int_a(var0, var1 + 34, var2 + 20, var3.func_array_char_a(), 1);
return;
}
UIGeneral.func_int_a(var0, var1 + 34, var2 + 20, var3.field_array_char_a, 1);
}
}
// $FF: renamed from: a (javax.microedition.lcdui.Graphics, int, int, int, char[], boolean) void
public static final void func_void_a(Graphics var0, int var1, int var2, int var3, char[] var4, boolean var5) {
if (var5) {
func_void_a(var0, var1, var2, var3, 19, 4136767, 10452799, 4144959);
func_void_a(var0, var1, var2, var3, 19, 6233919);
} else {
func_void_a(var0, var1, var2, var3, 19, 6242111, 14663551, 8347519);
func_void_a(var0, var1, var2, var3, 19, 10452863);
}
if (var4 != null) {
var0.setColor(16777215);
UIGeneral.func_int_a(var0, var1 + var3 / 2 - UIGeneral.getTextWidth(var4) / 2, var2 + 5, var4, 1);
}
}
// $FF: renamed from: a (javax.microedition.lcdui.Graphics, int, int, int, int, boolean) void
public static final void func_void_a(Graphics var0, int var1, int var2, int var3, int var4, boolean var5) {
if (var5) {
func_void_a(var0, var1, var2, var3, var4, 6242111, 14663551, 8347519);
} else {
func_void_a(var0, var1, var2, var3, var4, 4136767, 10452799, 4144959);
}
}
// $FF: renamed from: a (javax.microedition.lcdui.Graphics, int, int, int, int, char[], int, int, int, int) void
public static final void func_void_a(Graphics var0, int var1, int var2, int var3, int var4, char[] var5, int var6, int var7, int var8, int var9) {
var0.setColor(var8);
var0.fillRect(var1, var2, var3, var4);
if (var5 != null) {
var3 = var3 - var6 - var6;
var0.setColor(var9);
if (var7 == 1) {
UIGeneral.func_void_b(var0, var1 + var6 + (var3 >> 1), var2 + 1, var3, 1, var5, 0, 0, var5.length);
} else {
UIGeneral.func_int_a(var0, var1 + var6, var2 + 1, var3, 1, var5);
}
}
}
// $FF: renamed from: c (javax.microedition.lcdui.Graphics, int, int, int, int) void
public static final void func_void_c(Graphics var0, int var1, int var2, int var3, int var4) {
func_void_a(var0, var1, var2, var3, var4, 16768959, 12558207);
func_void_c(var0, var1, var2, var3, var4, 14663551);
}
}
| [
"magdno2@gmail.com"
] | magdno2@gmail.com |
f8a109c7fe00abf42832861cb16ad1257a47b4ad | 3d31f9dfc76440b33a00666a30d5816e84b007eb | /study/src/baseball/client/BaseballPlayer.java | c1cd335b0dd21a471c862a86950716df5673ae51 | [] | no_license | fellownew/workspace | 7bd5d1a1fd0d3f2faa11983cf6c33f1254008903 | dff111ab5507630a06c5fa8e4d9c03ed6dd7cb7e | refs/heads/master | 2021-01-01T19:20:42.379190 | 2015-03-31T00:36:42 | 2015-03-31T00:36:42 | 29,329,576 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,077 | java | package baseball.client;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
/**
* 표준I/O로 값을 받고 서버로 값 보냄
*
*/
public class BaseballPlayer {
Socket socket;
BufferedReader in = null;
PrintWriter pw = null;
public static void main(String[] args) throws Exception {
BaseballPlayer player = new BaseballPlayer();
player.player();
}
public void player() throws IOException{
String str = null;
try {
socket = new Socket("localhost", 13678);
pw = new PrintWriter(socket.getOutputStream(),true);
in = new BufferedReader(new InputStreamReader(System.in));
BaseballPlayerThread pt = new BaseballPlayerThread(socket);
Thread t = new Thread(pt);
t.start();//thread 시작.
str = in.readLine();
while (!str.equals("!@#")) {
pw.println(str);
str = in.readLine();
}
} finally {
if (in != null) {
in.close();
}
if (pw != null) {
pw.close();
}
if(socket!=null){
socket.close();
}
}
}
} | [
"hotttnew@naver.com"
] | hotttnew@naver.com |
3ece12a30a8063e77c7818a5fc41ac2e68cdce99 | a91c4552803da20f91f32177b1e94220c94b4673 | /mybatis/mybatis-plus/src/main/java/org/zero/mybatis/plus/service/IOrderMaster2Service.java | c1b4a6366445e6d29cdf61b9e554931570286ca7 | [] | no_license | hiyzx/spring-boot | 96dbaff35157d5dfa348a3cb040e32d6a5df6d6b | a24176a732a18a77b1ca40faefe4a5705391e5a0 | refs/heads/master | 2022-11-25T21:41:18.883612 | 2021-03-03T01:43:57 | 2021-03-03T01:43:57 | 102,811,803 | 2 | 1 | null | 2022-11-21T22:38:43 | 2017-09-08T03:12:54 | Java | UTF-8 | Java | false | false | 348 | java | package org.zero.mybatis.plus.service;
import org.zero.mybatis.plus.entity.OrderMaster;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author hiyzx
* @since 2020-01-04
*/
public interface IOrderMaster2Service extends IService<OrderMaster> {
void save(Integer stockId, Integer count);
}
| [
"hiyzx"
] | hiyzx |
243ed6bee8041c7e0d4e48bf7d007111bb7b34ee | 17768ef1f9ddf74718afcc69f6354490a19814f7 | /src/main/java/com/lytips/ITags/entity/MsgRelation.java | ce47985be1a0e66a3c65e5a79eac2359e09584ba | [] | no_license | AnswerKaiWang/Itags | 8906ce914870d9cef204194552aec427fa3c3f6c | ba78f7e31018d236e54e99918e1be07e48b8ddd2 | refs/heads/master | 2021-06-27T23:49:47.057669 | 2017-09-09T16:58:28 | 2017-09-09T16:58:28 | 102,966,646 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,588 | java | package com.lytips.ITags.entity;
import java.util.Date;
import java.util.List;
public class MsgRelation {
private Integer id;
private Integer userId; //发布动态者
private Integer msgId; //动态ID
private Integer referenceUserId; // 引用者
private Integer referenceMsgId; //引用消息id
private Integer type; // 1收藏 2转发 3评论 4点赞 5消息回复
private Integer state = 1;
private Date createTime = new Date();
private Date updateTime = new Date();
private ExtraMsg extraMsg;
private UserInfo user;
private UserInfo referenceUser;
private Integer isRead = 0;
public Integer getIsRead() {
return isRead;
}
public void setIsRead(Integer isRead) {
this.isRead = isRead;
}
public UserInfo getUser() {
return user;
}
public void setUser(UserInfo user) {
this.user = user;
}
public UserInfo getReferenceUser() {
return referenceUser;
}
public void setReferenceUser(UserInfo referenceUser) {
this.referenceUser = referenceUser;
}
private List<MsgRelation> replyMsg;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getMsgId() {
return msgId;
}
public void setMsgId(Integer msgId) {
this.msgId = msgId;
}
public Integer getReferenceUserId() {
return referenceUserId;
}
public void setReferenceUserId(Integer referenceUserId) {
this.referenceUserId = referenceUserId;
}
public Integer getReferenceMsgId() {
return referenceMsgId;
}
public void setReferenceMsgId(Integer referenceMsgId) {
this.referenceMsgId = referenceMsgId;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public ExtraMsg getExtraMsg() {
return extraMsg;
}
public void setExtraMsg(ExtraMsg extraMsg) {
this.extraMsg = extraMsg;
}
public List<MsgRelation> getReplyMsg() {
return replyMsg;
}
public void setReplyMsg(List<MsgRelation> replyMsg) {
this.replyMsg = replyMsg;
}
}
| [
"1163549485@qq.com"
] | 1163549485@qq.com |
2f1b4a17098cce6e18d15c1f78755b5a8774d95f | ae914e5d261dabe13b45d8832791338c2d192332 | /game/boards/MnkBoardRect.java | 371d690697201cfd1a5734fb52af76710b4ef071 | [] | no_license | spcfox/prog-intro | e787ec097ecbf77242024fbeb074f3d5d1e40240 | 55b0bc21016bb39839e623c09641035e7abce050 | refs/heads/master | 2023-03-31T01:35:09.944818 | 2021-04-10T08:55:41 | 2021-04-10T08:55:41 | 356,518,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 215 | java | package game.boards;
import game.position.MnkPositionRect;
public class MnkBoardRect extends MnkBoard {
public MnkBoardRect(int m, int n, int k) {
super(new MnkPositionRect(m, n, k));
}
}
| [
"rafter.gar@yandex.ru"
] | rafter.gar@yandex.ru |
10a22f64a183b69d64317ba5f2ae74ce89cdb0b4 | 93cd49fa1d10317988c3dd98965286b0d9dbc7ca | /src/main/java/com/comphenix/packetwrapper/WrapperPlayServerExplosion.java | 5f26ebb8168f9f6bb7a324b258ff27bb01a708ae | [] | no_license | adriancfbr/CHProject | de6dc52bccb4b5a620888946a4d3c916ba7d9ca1 | b33ac681e3e349f759c3ef026672ec98ab922111 | refs/heads/master | 2021-01-09T20:41:35.984207 | 2016-07-28T18:02:56 | 2016-07-28T18:02:56 | 61,957,868 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,578 | java | /**
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
* Copyright (C) dmulloy2 <http://dmulloy2.net>
* Copyright (C) Kristian S. Strangeland
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.comphenix.packetwrapper;
import java.util.List;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.BlockPosition;
public class WrapperPlayServerExplosion extends AbstractPacket {
public static final PacketType TYPE = PacketType.Play.Server.EXPLOSION;
public WrapperPlayServerExplosion() {
super(new PacketContainer(TYPE), TYPE);
handle.getModifier().writeDefaults();
}
public WrapperPlayServerExplosion(PacketContainer packet) {
super(packet, TYPE);
}
/**
* Retrieve X.
*
* @return The current X
*/
public double getX() {
return handle.getDoubles().read(0);
}
/**
* Set X.
*
* @param value - new value.
*/
public void setX(double value) {
handle.getDoubles().write(0, value);
}
/**
* Retrieve Y.
*
* @return The current Y
*/
public double getY() {
return handle.getDoubles().read(1);
}
/**
* Set Y.
*
* @param value - new value.
*/
public void setY(double value) {
handle.getDoubles().write(1, value);
}
/**
* Retrieve Z.
*
* @return The current Z
*/
public double getZ() {
return handle.getDoubles().read(2);
}
/**
* Set Z.
*
* @param value - new value.
*/
public void setZ(double value) {
handle.getDoubles().write(2, value);
}
/**
* Retrieve Radius.
* <p>
* Notes: currently unused in the client
*
* @return The current Radius
*/
public float getRadius() {
return handle.getFloat().read(0);
}
/**
* Set Radius.
*
* @param value - new value.
*/
public void setRadius(float value) {
handle.getFloat().write(0, value);
}
/**
* Retrieve Record count.
* <p>
* Notes: this is the count, not the size. The size is 3 times this value.
*
* @return The current Record count
*/
public List<BlockPosition> getRecors() {
return handle.getBlockPositionCollectionModifier().read(0);
}
/**
* Set Record count.
*
* @param value - new value.
*/
public void setRecords(List<BlockPosition> value) {
handle.getBlockPositionCollectionModifier().write(0, value);
}
public float getPlayerVelocityX() {
return handle.getFloat().read(0);
}
public void setPlayerVelocityX(float value) {
handle.getFloat().write(0, value);
}
public float getPlayerVelocityY() {
return handle.getFloat().read(1);
}
public void setPlayerVelocityY(float value) {
handle.getFloat().write(1, value);
}
public float getPlayerVelocityZ() {
return handle.getFloat().read(2);
}
public void setPlayerVelocityZ(float value) {
handle.getFloat().write(2, value);
}
}
| [
"adriancf@outlook.com.br"
] | adriancf@outlook.com.br |
08df168fac2355ef4a167f12d12bb30616eceb6e | 66fbd7b734a52b3468e47d5b81d1d03d0d55931c | /src/main/java/io/apicurio/datamodels/cmd/commands/DeleteServerCommand_Aai20.java | 868b4cfed6ebf0a6cf2b8cafb21668a17b7297e6 | [
"Apache-2.0"
] | permissive | lbroudoux/apicurio-data-models | dcb9d56e8f9ed2da3b017285d10be60eb0c435e0 | ecc841d00663748d4d1d1757de4d5fc54210969a | refs/heads/master | 2023-01-29T14:51:17.445454 | 2021-07-01T17:45:49 | 2021-07-01T17:45:49 | 199,882,835 | 0 | 0 | Apache-2.0 | 2023-01-26T21:04:07 | 2019-07-31T15:28:42 | Java | UTF-8 | Java | false | false | 3,325 | java | /*
* Copyright 2019 Red Hat
*
* 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 io.apicurio.datamodels.cmd.commands;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.apicurio.datamodels.Library;
import io.apicurio.datamodels.asyncapi.models.AaiServer;
import io.apicurio.datamodels.asyncapi.v2.models.Aai20Document;
import io.apicurio.datamodels.cmd.AbstractCommand;
import io.apicurio.datamodels.compat.LoggerCompat;
import io.apicurio.datamodels.compat.MarshallCompat.NullableJsonNodeDeserializer;
import io.apicurio.datamodels.compat.NodeCompat;
import io.apicurio.datamodels.core.Constants;
import io.apicurio.datamodels.core.models.Document;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* A command used to delete a single server from an aaidocument.
* @author c.desc2@gmail.com
*/
public class DeleteServerCommand_Aai20 extends AbstractCommand {
public String _serverName;
@JsonDeserialize(using=NullableJsonNodeDeserializer.class)
public Object _oldServer;
DeleteServerCommand_Aai20() {
}
DeleteServerCommand_Aai20(AaiServer server) {
this._serverName = server.getName();
}
/**
* @see io.apicurio.datamodels.cmd.ICommand#execute(Document)
*/
@Override
public void execute(Document document) {
LoggerCompat.info("[DeleteServerCommand_Aai20] Executing.");
this._oldServer = null;
Aai20Document parent = (Aai20Document) document;
if (this.isNullOrUndefined(parent.servers)) {
return;
}
AaiServer server = parent.servers.get(_serverName);
if (this.isNullOrUndefined(server)) {
return;
}
Map<String, AaiServer> servers = parent.servers;
servers.remove(_serverName);
if (servers.size() == 0) {
NodeCompat.setProperty(parent, Constants.PROP_SERVERS, null);
}
this._oldServer = Library.writeNode(server);
}
/**
* @see io.apicurio.datamodels.cmd.ICommand#undo(Document)
*/
@Override
public void undo(Document document) {
LoggerCompat.info("[DeleteServerCommand_Aai20] Reverting.");
if (this.isNullOrUndefined(this._oldServer)) {
return;
}
Aai20Document parent = (Aai20Document) document;
if (this.isNullOrUndefined(parent)) {
return;
}
AaiServer server = parent.createServer(_serverName);
Library.readNode(this._oldServer, server);
Map<String, AaiServer> servers = parent.servers;
if (this.isNullOrUndefined(servers)) {
servers = new LinkedHashMap<>();
NodeCompat.setProperty(parent, Constants.PROP_SERVERS, servers);
}
servers.put(_serverName, server);
}
}
| [
"noreply@github.com"
] | lbroudoux.noreply@github.com |
0135ce5faa16a74516b1d5a935effe72731b835e | 7c1dd68804ba8af748a1487684d7957435d8ce5c | /ReverseN.java | cf44b2c01f03166fdd2ccff2a2333b456cd3e7f3 | [] | no_license | shreyaprog/program4 | 3b7670e79f0738e937a99fd0c660844dd18fc987 | 6e73d9082f0c3f07d1805de405de9da7441f6206 | refs/heads/master | 2022-12-18T06:04:41.347803 | 2020-09-29T06:41:09 | 2020-09-29T06:41:09 | 266,278,675 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | import java.util.Scanner;
class ReverseN
{
public void rev()
{
int n,reverse=0;
Scanner in=new Scanner(System.in);
System.out.println("Enter a number:");
n=in.nextInt();
while(n!=0)
{
reverse =reverse*10;
reverse=reverse+n%10;
n=n/10;
}
System.out.println("Reverse of the number is"+reverse);
}
} | [
"admin@samsung"
] | admin@samsung |
d717230397a6516a470f09c6ae2f8833aaa1e826 | f9c72ec9b5aed50422649291d6e92be04e9f8b0f | /CoreJava/src/SessionTask/session_task_1_2.java | 1705c0b681506c15f2599c1029d629b5fb63e79b | [] | no_license | sarwarali847/CORE_JAVA | c19240c72e9a347f0dec3706340700755cd809e5 | bdc27ede73e3d14eb44354fb4f0ace228b3f84ef | refs/heads/master | 2023-08-16T00:46:20.610658 | 2021-10-25T04:55:13 | 2021-10-25T04:55:13 | 416,643,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 554 | java | /*Program1 --> ask user to enter an int value and
check whether its a palindrome */
package SessionTask;
import java.util.*;
public class session_task_1_2 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n;
System.out.println("Enter number:");
n=sc.nextInt();
int rem,sum,temp1,temp2;
temp1=n;
temp2=n;
sum=0;
while(temp1!=0)
{
rem=temp1%10;
sum=sum*10+rem;
temp1/=10;
}
if(sum==temp2)
System.out.println("Palindrome");
else
System.out.println("Not a palindrome");
}
}
| [
"sarwarali847@gmail.com"
] | sarwarali847@gmail.com |
9234e98298e64c7af8bef542184d4ae274da73f9 | f502c75d73433c145a7cc947bc54508c6458b87c | /springcloud_2/demo_ms_user/demo_user/src/main/java/com/demo/user/service/impl/ProvincesServiceImpl.java | 51bc6257d3a6c9ade7d6eb13e7ecb7456811a557 | [] | no_license | zteye/SpringCloud | 3a0dc87ecf8e828f6e9a7852f24c7f076c408311 | 60568372b765daa1710e4fa57e1efa597d41e814 | refs/heads/master | 2020-11-26T08:35:15.877397 | 2020-02-20T12:34:07 | 2020-02-20T12:34:07 | 229,016,262 | 0 | 0 | null | 2019-12-19T09:07:21 | 2019-12-19T09:07:20 | null | UTF-8 | Java | false | false | 3,478 | java | package com.demo.user.service.impl;
import com.demo.user.dao.ProvincesMapper;
import com.demo.user.pojo.Provinces;
import com.demo.user.service.ProvincesService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
/****
* @Author:shenkunlin
* @Description:Provinces业务层接口实现类
* @Date 2019/6/14 0:16
*****/
@Service
public class ProvincesServiceImpl implements ProvincesService {
@Autowired
private ProvincesMapper provincesMapper;
/**
* Provinces条件+分页查询
* @param provinces 查询条件
* @param page 页码
* @param size 页大小
* @return 分页结果
*/
@Override
public PageInfo<Provinces> findPage(Provinces provinces, int page, int size){
//分页
PageHelper.startPage(page,size);
//搜索条件构建
Example example = createExample(provinces);
//执行搜索
return new PageInfo<Provinces>(provincesMapper.selectByExample(example));
}
/**
* Provinces分页查询
* @param page
* @param size
* @return
*/
@Override
public PageInfo<Provinces> findPage(int page, int size){
//静态分页
PageHelper.startPage(page,size);
//分页查询
return new PageInfo<Provinces>(provincesMapper.selectAll());
}
/**
* Provinces条件查询
* @param provinces
* @return
*/
@Override
public List<Provinces> findList(Provinces provinces){
//构建查询条件
Example example = createExample(provinces);
//根据构建的条件查询数据
return provincesMapper.selectByExample(example);
}
/**
* Provinces构建查询对象
* @param provinces
* @return
*/
public Example createExample(Provinces provinces){
Example example=new Example(Provinces.class);
Example.Criteria criteria = example.createCriteria();
if(provinces!=null){
// 省份ID
if(!StringUtils.isEmpty(provinces.getProvinceid())){
criteria.andEqualTo("provinceid",provinces.getProvinceid());
}
// 省份名称
if(!StringUtils.isEmpty(provinces.getProvince())){
criteria.andEqualTo("province",provinces.getProvince());
}
}
return example;
}
/**
* 删除
* @param id
*/
@Override
public void delete(String id){
provincesMapper.deleteByPrimaryKey(id);
}
/**
* 修改Provinces
* @param provinces
*/
@Override
public void update(Provinces provinces){
provincesMapper.updateByPrimaryKey(provinces);
}
/**
* 增加Provinces
* @param provinces
*/
@Override
public void add(Provinces provinces){
provincesMapper.insert(provinces);
}
/**
* 根据ID查询Provinces
* @param id
* @return
*/
@Override
public Provinces findById(String id){
return provincesMapper.selectByPrimaryKey(id);
}
/**
* 查询Provinces全部数据
* @return
*/
@Override
public List<Provinces> findAll() {
return provincesMapper.selectAll();
}
}
| [
"zteye@163.com"
] | zteye@163.com |
5bdbd3b5e4739f3b02e3c5464d578309d4b1ec2d | 147d63354053796da37cdaa2cfd8cb358c77e9a1 | /components/org.wso2.carbon.identity.cors.valve/src/test/java/org/wso2/carbon/identity/cors/valve/test/CORSResponseWrapperTest.java | 10a321a4519a86391526ddd346a2b29d6ee33a3a | [
"Apache-2.0"
] | permissive | wso2-extensions/identity-carbon-auth-rest | 3cb535c5dcdd53ea282f7a050740f871ed5564f1 | 32c5fa094afa1859bc87dadf33ece1c8df787aaa | refs/heads/master | 2023-07-06T19:04:24.704368 | 2023-06-29T08:44:47 | 2023-06-29T08:44:47 | 64,106,926 | 2 | 124 | Apache-2.0 | 2023-09-14T09:36:40 | 2016-07-25T05:47:55 | Java | UTF-8 | Java | false | false | 8,440 | java | /*
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.identity.cors.valve.test;
import org.testng.annotations.Test;
import org.wso2.carbon.identity.cors.valve.constant.Header;
import org.wso2.carbon.identity.cors.valve.internal.wrapper.CORSResponseWrapper;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
/**
* Tests the CORS response wrapper.
*/
public class CORSResponseWrapperTest {
@Test
public void testReset() {
final String otherHeaderName = "X-Other-Header";
final Map<String, String> headers = new HashMap<>();
headers.put(Header.ACCESS_CONTROL_ALLOW_CREDENTIALS, "allow-credentials");
headers.put(Header.ACCESS_CONTROL_ALLOW_HEADERS, "allow-headers");
headers.put(Header.ACCESS_CONTROL_ALLOW_METHODS, "allow-methods");
headers.put(Header.ACCESS_CONTROL_ALLOW_ORIGIN, "allow-origin");
headers.put(Header.ACCESS_CONTROL_EXPOSE_HEADERS, "expose-headers");
headers.put(Header.ACCESS_CONTROL_MAX_AGE, "max-age");
headers.put(Header.VARY, "vary");
headers.put(otherHeaderName, "other-header");
final MockHttpServletResponse responseMock = new MockHttpServletResponse(headers);
final CORSResponseWrapper corsResponseWrapper = new CORSResponseWrapper(responseMock);
corsResponseWrapper.reset();
assertEquals(headers.get(Header.ACCESS_CONTROL_ALLOW_CREDENTIALS), "allow-credentials");
assertEquals(headers.get(Header.ACCESS_CONTROL_ALLOW_HEADERS), "allow-headers");
assertEquals(headers.get(Header.ACCESS_CONTROL_ALLOW_METHODS), "allow-methods");
assertEquals(headers.get(Header.ACCESS_CONTROL_ALLOW_ORIGIN), "allow-origin");
assertEquals(headers.get(Header.ACCESS_CONTROL_EXPOSE_HEADERS), "expose-headers");
assertEquals(headers.get(Header.ACCESS_CONTROL_MAX_AGE), "max-age");
assertEquals(headers.get(Header.VARY), "vary");
assertFalse(headers.containsKey(otherHeaderName));
assertTrue(responseMock.isReset());
}
private static final class MockHttpServletResponse implements HttpServletResponse {
private final Map<String, String> headers;
private boolean reset;
MockHttpServletResponse(final Map<String, String> headers) {
this.headers = headers;
}
@Override
public String getHeader(final String name) {
return headers.get(name);
}
@Override
public Collection<String> getHeaderNames() {
return headers.keySet();
}
public boolean isReset() {
return reset;
}
@Override
public void reset() {
headers.clear();
reset = true;
}
@Override
public void setHeader(final String name, final String value) {
headers.put(name, value);
}
@Override
public void addCookie(final Cookie cookie) {
throw new UnsupportedOperationException();
}
@Override
public void addDateHeader(final String name, final long date) {
throw new UnsupportedOperationException();
}
@Override
public void addHeader(final String name, final String value) {
throw new UnsupportedOperationException();
}
@Override
public void addIntHeader(final String name, final int value) {
throw new UnsupportedOperationException();
}
@Override
public boolean containsHeader(final String name) {
throw new UnsupportedOperationException();
}
@Override
public String encodeRedirectUrl(final String url) {
throw new UnsupportedOperationException();
}
@Override
public String encodeRedirectURL(final String url) {
throw new UnsupportedOperationException();
}
@Override
public String encodeUrl(final String url) {
throw new UnsupportedOperationException();
}
@Override
public String encodeURL(final String url) {
throw new UnsupportedOperationException();
}
@Override
public Collection<String> getHeaders(final String name) {
throw new UnsupportedOperationException();
}
@Override
public int getStatus() {
throw new UnsupportedOperationException();
}
@Override
public void setStatus(final int sc) {
throw new UnsupportedOperationException();
}
@Override
public void sendError(final int sc) throws IOException {
throw new UnsupportedOperationException();
}
@Override
public void sendError(final int sc, final String msg) throws IOException {
throw new UnsupportedOperationException();
}
@Override
public void sendRedirect(final String location) throws IOException {
throw new UnsupportedOperationException();
}
@Override
public void setDateHeader(final String name, final long date) {
throw new UnsupportedOperationException();
}
@Override
public void setIntHeader(final String name, final int value) {
throw new UnsupportedOperationException();
}
@Override
public void setStatus(final int sc, final String sm) {
throw new UnsupportedOperationException();
}
@Override
public void flushBuffer() throws IOException {
throw new UnsupportedOperationException();
}
@Override
public int getBufferSize() {
throw new UnsupportedOperationException();
}
@Override
public void setBufferSize(final int size) {
throw new UnsupportedOperationException();
}
@Override
public String getCharacterEncoding() {
throw new UnsupportedOperationException();
}
@Override
public void setCharacterEncoding(final String charset) {
throw new UnsupportedOperationException();
}
@Override
public String getContentType() {
throw new UnsupportedOperationException();
}
@Override
public void setContentType(final String type) {
throw new UnsupportedOperationException();
}
@Override
public Locale getLocale() {
throw new UnsupportedOperationException();
}
@Override
public void setLocale(final Locale loc) {
throw new UnsupportedOperationException();
}
@Override
public ServletOutputStream getOutputStream() throws IOException {
throw new UnsupportedOperationException();
}
@Override
public PrintWriter getWriter() throws IOException {
throw new UnsupportedOperationException();
}
@Override
public boolean isCommitted() {
throw new UnsupportedOperationException();
}
@Override
public void resetBuffer() {
throw new UnsupportedOperationException();
}
@Override
public void setContentLength(final int len) {
throw new UnsupportedOperationException();
}
}
}
| [
"oshan.ivantha@gmail.com"
] | oshan.ivantha@gmail.com |
f151217c96aba58f5d2aba36f225d598efdf93fa | 6e2214a8a679a161a80f45163fa5d5655ebd5a47 | /src/test/java/org/test/model/InMemoryUser.java | 54dcbbdc76f319aa425f3fcb027aec292512446b | [] | no_license | eureka84/twitter-stream | 594a5d0413cc5beb4f27ee4da50443007691009e | 8792a53f44af04acb4710abd8717d3a110a12d4c | refs/heads/master | 2021-12-03T00:21:29.221676 | 2017-06-22T20:45:47 | 2017-06-22T20:45:47 | 95,153,022 | 1 | 0 | null | 2021-11-21T22:37:00 | 2017-06-22T20:17:01 | Java | UTF-8 | Java | false | false | 5,195 | java | package org.test.model;
import twitter4j.RateLimitStatus;
import twitter4j.Status;
import twitter4j.URLEntity;
import twitter4j.User;
import java.util.Date;
/**
* @author asciarra
*/
public class InMemoryUser implements User {
private final long id;
private final Date createdAt;
private final String name;
private final String screenName;
public InMemoryUser(long id, Date createdAt, String name, String screenName) {
this.id = id;
this.createdAt = createdAt;
this.name = name;
this.screenName = screenName;
}
@Override
public long getId() {
return id;
}
@Override
public String getName() {
return name;
}
@Override
public String getEmail() {
return null;
}
@Override
public String getScreenName() {
return screenName;
}
@Override
public String getLocation() {
return null;
}
@Override
public String getDescription() {
return null;
}
@Override
public boolean isContributorsEnabled() {
return false;
}
@Override
public String getProfileImageURL() {
return null;
}
@Override
public String getBiggerProfileImageURL() {
return null;
}
@Override
public String getMiniProfileImageURL() {
return null;
}
@Override
public String getOriginalProfileImageURL() {
return null;
}
@Override
public String getProfileImageURLHttps() {
return null;
}
@Override
public String getBiggerProfileImageURLHttps() {
return null;
}
@Override
public String getMiniProfileImageURLHttps() {
return null;
}
@Override
public String getOriginalProfileImageURLHttps() {
return null;
}
@Override
public boolean isDefaultProfileImage() {
return false;
}
@Override
public String getURL() {
return null;
}
@Override
public boolean isProtected() {
return false;
}
@Override
public int getFollowersCount() {
return 0;
}
@Override
public Status getStatus() {
return null;
}
@Override
public String getProfileBackgroundColor() {
return null;
}
@Override
public String getProfileTextColor() {
return null;
}
@Override
public String getProfileLinkColor() {
return null;
}
@Override
public String getProfileSidebarFillColor() {
return null;
}
@Override
public String getProfileSidebarBorderColor() {
return null;
}
@Override
public boolean isProfileUseBackgroundImage() {
return false;
}
@Override
public boolean isDefaultProfile() {
return false;
}
@Override
public boolean isShowAllInlineMedia() {
return false;
}
@Override
public int getFriendsCount() {
return 0;
}
@Override
public Date getCreatedAt() {
return createdAt;
}
@Override
public int getFavouritesCount() {
return 0;
}
@Override
public int getUtcOffset() {
return 0;
}
@Override
public String getTimeZone() {
return null;
}
@Override
public String getProfileBackgroundImageURL() {
return null;
}
@Override
public String getProfileBackgroundImageUrlHttps() {
return null;
}
@Override
public String getProfileBannerURL() {
return null;
}
@Override
public String getProfileBannerRetinaURL() {
return null;
}
@Override
public String getProfileBannerIPadURL() {
return null;
}
@Override
public String getProfileBannerIPadRetinaURL() {
return null;
}
@Override
public String getProfileBannerMobileURL() {
return null;
}
@Override
public String getProfileBannerMobileRetinaURL() {
return null;
}
@Override
public boolean isProfileBackgroundTiled() {
return false;
}
@Override
public String getLang() {
return null;
}
@Override
public int getStatusesCount() {
return 0;
}
@Override
public boolean isGeoEnabled() {
return false;
}
@Override
public boolean isVerified() {
return false;
}
@Override
public boolean isTranslator() {
return false;
}
@Override
public int getListedCount() {
return 0;
}
@Override
public boolean isFollowRequestSent() {
return false;
}
@Override
public URLEntity[] getDescriptionURLEntities() {
return new URLEntity[0];
}
@Override
public URLEntity getURLEntity() {
return null;
}
@Override
public String[] getWithheldInCountries() {
return new String[0];
}
@Override
public int compareTo(User o) {
return 0;
}
@Override
public RateLimitStatus getRateLimitStatus() {
return null;
}
@Override
public int getAccessLevel() {
return 0;
}
}
| [
"asciarra@byte-code.com"
] | asciarra@byte-code.com |
59afe5050682ab025842673aaec7733ef650f56d | cdc2dbc8a3262f2932470180ab69b524fbc823a0 | /com.test123.framework/src/test/java/gluecode/login_scenario.java | 3fc46a946b1cd33e1c38b37726c1d1161bac9616 | [] | no_license | mrunal2609/Testproject | 23b51c87a8ee8ca3ee89e8d8a3d4559a62f41336 | 5e6b3751a7f2166c0a37f9c6ab02227fcd77c48a | refs/heads/master | 2023-05-14T00:14:29.278225 | 2019-09-28T07:26:01 | 2019-09-28T07:26:01 | 211,460,436 | 0 | 0 | null | 2023-05-09T18:14:32 | 2019-09-28T07:16:02 | Gherkin | UTF-8 | Java | false | false | 57 | java | package gluecode;
public class login_scenario {
}
| [
"sahil@DESKTOP-KHUCIV0"
] | sahil@DESKTOP-KHUCIV0 |
53822bebdb03070cedd8d7bcb555cb6dd5359bcc | 9a0595250f01f6986dbbfc9ead1efdf8c5a1a18d | /platforms/android/app/src/main/java/com/envision/demo/util/EncryUtil/Base64.java | ed703aaffd9cb565266d12f3d552d82af58eca19 | [] | no_license | hantichao/enhybrid-demo | fc74a378474f0f78315519eee35bb7b4c867a17b | 86c8be8fc3c0bb574be98bbf8fe958eac7dcd66c | refs/heads/master | 2022-03-20T15:41:42.656341 | 2019-11-14T08:05:56 | 2019-11-14T08:05:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,979 | java | package com.envision.demo.util.EncryUtil;
import java.io.UnsupportedEncodingException;
public class Base64 {
/**
* Chunk size per RFC 2045 section 6.8.
*
* <p>The {@value} character limit does not count the trailing CRLF, but counts
* all other characters, including any equal signs.</p>
*
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 section 6.8</a>
*/
static final int CHUNK_SIZE = 76;
/**
* Chunk separator per RFC 2045 section 2.1.
*
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 section 2.1</a>
*/
static final byte[] CHUNK_SEPARATOR = "\r\n".getBytes();
/**
* The base length.
*/
static final int BASELENGTH = 255;
/**
* Lookup length.
*/
static final int LOOKUPLENGTH = 64;
/**
* Used to calculate the number of bits in a byte.
*/
static final int EIGHTBIT = 8;
/**
* Used when encoding something which has fewer than 24 bits.
*/
static final int SIXTEENBIT = 16;
/**
* Used to determine how many bits data contains.
*/
static final int TWENTYFOURBITGROUP = 24;
/**
* Used to get the number of Quadruples.
*/
static final int FOURBYTE = 4;
/**
* Used to test the sign of a byte.
*/
static final int SIGN = -128;
/**
* Byte used to pad output.
*/
static final byte PAD = (byte) '=';
// Create arrays to hold the base64 characters and a
// lookup for base64 chars
private static byte[] base64Alphabet = new byte[BASELENGTH];
private static byte[] lookUpBase64Alphabet = new byte[LOOKUPLENGTH];
// Populating the lookup and character arrays
static {
for (int i = 0; i < BASELENGTH; i++) {
base64Alphabet[i] = (byte) -1;
}
for (int i = 'Z'; i >= 'A'; i--) {
base64Alphabet[i] = (byte) (i - 'A');
}
for (int i = 'z'; i >= 'a'; i--) {
base64Alphabet[i] = (byte) (i - 'a' + 26);
}
for (int i = '9'; i >= '0'; i--) {
base64Alphabet[i] = (byte) (i - '0' + 52);
}
base64Alphabet['+'] = 62;
base64Alphabet['/'] = 63;
for (int i = 0; i <= 25; i++) {
lookUpBase64Alphabet[i] = (byte) ('A' + i);
}
for (int i = 26, j = 0; i <= 51; i++, j++) {
lookUpBase64Alphabet[i] = (byte) ('a' + j);
}
for (int i = 52, j = 0; i <= 61; i++, j++) {
lookUpBase64Alphabet[i] = (byte) ('0' + j);
}
lookUpBase64Alphabet[62] = (byte) '+';
lookUpBase64Alphabet[63] = (byte) '/';
}
private static boolean isBase64(byte octect) {
if (octect == PAD) {
return true;
} else if (base64Alphabet[octect] == -1) {
return false;
} else {
return true;
}
}
/**
* Tests a given byte array to see if it contains
* only valid characters within the Base64 alphabet.
*
* @param arrayOctect byte array to test
* @return true if all bytes are valid characters in the Base64
* alphabet or if the byte array is empty; false, otherwise
*/
public static boolean isArrayByteBase64(byte[] arrayOctect) {
arrayOctect = discardWhitespace(arrayOctect);
int length = arrayOctect.length;
if (length == 0) {
// shouldn't a 0 length array be valid base64 data?
// return false;
return true;
}
for (int i = 0; i < length; i++) {
if (!isBase64(arrayOctect[i])) {
return false;
}
}
return true;
}
/**
* Encodes binary data using the base64 algorithm but
* does not chunk the output.
*
* @param binaryData binary data to encode
* @return Base64 characters
*/
public static byte[] encodeBase64(byte[] binaryData) {
return encodeBase64(binaryData, false);
}
/**
* Encodes binary data using the base64 algorithm and chunks
* the encoded output into 76 character blocks
*
* @param binaryData binary data to encode
* @return Base64 characters chunked in 76 character blocks
*/
public static byte[] encodeBase64Chunked(byte[] binaryData) {
return encodeBase64(binaryData, true);
}
/**
* Decodes a byte[] containing containing
* characters in the Base64 alphabet.
*
* @param pArray A byte array containing Base64 character data
* @return a byte array containing binary data
*/
public static byte[] decode(byte[] pArray) {
return decodeBase64(pArray);
}
/**
* Encodes binary data using the base64 algorithm, optionally
* chunking the output into 76 character blocks.
*
* @param binaryData Array containing binary data to encode.
* @param isChunked if isChunked is true this encoder will chunk
* the base64 output into 76 character blocks
* @return Base64-encoded data.
*/
public static byte[] encodeBase64(byte[] binaryData, boolean isChunked) {
int lengthDataBits = binaryData.length * EIGHTBIT;
int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
byte encodedData[] = null;
int encodedDataLength = 0;
int nbrChunks = 0;
if (fewerThan24bits != 0) {
//data not divisible by 24 bit
encodedDataLength = (numberTriplets + 1) * 4;
} else {
// 16 or 8 bit
encodedDataLength = numberTriplets * 4;
}
// If the output is to be "chunked" into 76 character sections,
// for compliance with RFC 2045 MIME, then it is important to
// allow for extra length to account for the separator(s)
if (isChunked) {
nbrChunks =
(CHUNK_SEPARATOR.length == 0 ? 0 : (int) Math.ceil((float) encodedDataLength / CHUNK_SIZE));
encodedDataLength += nbrChunks * CHUNK_SEPARATOR.length;
}
encodedData = new byte[encodedDataLength];
byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
int encodedIndex = 0;
int dataIndex = 0;
int i = 0;
int nextSeparatorIndex = CHUNK_SIZE;
int chunksSoFar = 0;
//log.debug("number of triplets = " + numberTriplets);
for (i = 0; i < numberTriplets; i++) {
dataIndex = i * 3;
b1 = binaryData[dataIndex];
b2 = binaryData[dataIndex + 1];
b3 = binaryData[dataIndex + 2];
//log.debug("b1= " + b1 +", b2= " + b2 + ", b3= " + b3);
l = (byte) (b2 & 0x0f);
k = (byte) (b1 & 0x03);
byte val1 =
((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
byte val2 =
((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
byte val3 =
((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc);
encodedData[encodedIndex] = lookUpBase64Alphabet[val1];
//log.debug( "val2 = " + val2 );
//log.debug( "k4 = " + (k<<4) );
//log.debug( "vak = " + (val2 | (k<<4)) );
encodedData[encodedIndex + 1] =
lookUpBase64Alphabet[val2 | (k << 4)];
encodedData[encodedIndex + 2] =
lookUpBase64Alphabet[(l << 2) | val3];
encodedData[encodedIndex + 3] = lookUpBase64Alphabet[b3 & 0x3f];
encodedIndex += 4;
// If we are chunking, let's put a chunk separator down.
if (isChunked) {
// this assumes that CHUNK_SIZE % 4 == 0
if (encodedIndex == nextSeparatorIndex) {
System.arraycopy(
CHUNK_SEPARATOR,
0,
encodedData,
encodedIndex,
CHUNK_SEPARATOR.length);
chunksSoFar++;
nextSeparatorIndex =
(CHUNK_SIZE * (chunksSoFar + 1)) +
(chunksSoFar * CHUNK_SEPARATOR.length);
encodedIndex += CHUNK_SEPARATOR.length;
}
}
}
// form integral number of 6-bit groups
dataIndex = i * 3;
if (fewerThan24bits == EIGHTBIT) {
b1 = binaryData[dataIndex];
k = (byte) (b1 & 0x03);
//log.debug("b1=" + b1);
//log.debug("b1<<2 = " + (b1>>2) );
byte val1 =
((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
encodedData[encodedIndex] = lookUpBase64Alphabet[val1];
encodedData[encodedIndex + 1] = lookUpBase64Alphabet[k << 4];
encodedData[encodedIndex + 2] = PAD;
encodedData[encodedIndex + 3] = PAD;
} else if (fewerThan24bits == SIXTEENBIT) {
b1 = binaryData[dataIndex];
b2 = binaryData[dataIndex + 1];
l = (byte) (b2 & 0x0f);
k = (byte) (b1 & 0x03);
byte val1 =
((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
byte val2 =
((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
encodedData[encodedIndex] = lookUpBase64Alphabet[val1];
encodedData[encodedIndex + 1] =
lookUpBase64Alphabet[val2 | (k << 4)];
encodedData[encodedIndex + 2] = lookUpBase64Alphabet[l << 2];
encodedData[encodedIndex + 3] = PAD;
}
if (isChunked) {
// we also add a separator to the end of the final chunk.
if (chunksSoFar < nbrChunks) {
System.arraycopy(
CHUNK_SEPARATOR,
0,
encodedData,
encodedDataLength - CHUNK_SEPARATOR.length,
CHUNK_SEPARATOR.length);
}
}
return encodedData;
}
/**
* Decodes Base64 data into octects
*
* @param base64Data Byte array containing Base64 data
* @return Array containing decoded data.
*/
public static byte[] decodeBase64(byte[] base64Data) {
// RFC 2045 requires that we discard ALL non-Base64 characters
base64Data = discardNonBase64(base64Data);
// handle the edge case, so we don't have to worry about it later
if (base64Data.length == 0) {
return new byte[0];
}
int numberQuadruple = base64Data.length / FOURBYTE;
byte decodedData[] = null;
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0, marker0 = 0, marker1 = 0;
// Throw away anything not in base64Data
int encodedIndex = 0;
int dataIndex = 0;
{
// this sizes the output array properly - rlw
int lastData = base64Data.length;
// ignore the '=' padding
while (base64Data[lastData - 1] == PAD) {
if (--lastData == 0) {
return new byte[0];
}
}
decodedData = new byte[lastData - numberQuadruple];
}
for (int i = 0; i < numberQuadruple; i++) {
dataIndex = i * 4;
marker0 = base64Data[dataIndex + 2];
marker1 = base64Data[dataIndex + 3];
b1 = base64Alphabet[base64Data[dataIndex]];
b2 = base64Alphabet[base64Data[dataIndex + 1]];
if (marker0 != PAD && marker1 != PAD) {
//No PAD e.g 3cQl
b3 = base64Alphabet[marker0];
b4 = base64Alphabet[marker1];
decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
decodedData[encodedIndex + 1] =
(byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
decodedData[encodedIndex + 2] = (byte) (b3 << 6 | b4);
} else if (marker0 == PAD) {
//Two PAD e.g. 3c[Pad][Pad]
decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
} else if (marker1 == PAD) {
//One PAD e.g. 3cQ[Pad]
b3 = base64Alphabet[marker0];
decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
decodedData[encodedIndex + 1] =
(byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
}
encodedIndex += 3;
}
return decodedData;
}
/**
* Discards any whitespace from a base-64 encoded block.
*
* @param data The base-64 encoded data to discard the whitespace
* from.
* @return The data, less whitespace (see RFC 2045).
*/
static byte[] discardWhitespace(byte[] data) {
byte groomedData[] = new byte[data.length];
int bytesCopied = 0;
for (int i = 0; i < data.length; i++) {
switch (data[i]) {
case (byte) ' ' :
case (byte) '\n' :
case (byte) '\r' :
case (byte) '\t' :
break;
default:
groomedData[bytesCopied++] = data[i];
}
}
byte packedData[] = new byte[bytesCopied];
System.arraycopy(groomedData, 0, packedData, 0, bytesCopied);
return packedData;
}
/**
* Discards any characters outside of the base64 alphabet, per
* the requirements on page 25 of RFC 2045 - "Any characters
* outside of the base64 alphabet are to be ignored in base64
* encoded data."
*
* @param data The base-64 encoded data to groom
* @return The data, less non-base64 characters (see RFC 2045).
*/
static byte[] discardNonBase64(byte[] data) {
byte groomedData[] = new byte[data.length];
int bytesCopied = 0;
for (int i = 0; i < data.length; i++) {
if (isBase64(data[i])) {
groomedData[bytesCopied++] = data[i];
}
}
byte packedData[] = new byte[bytesCopied];
System.arraycopy(groomedData, 0, packedData, 0, bytesCopied);
return packedData;
}
/**
* Encodes a byte[] containing binary data, into a byte[] containing
* characters in the Base64 alphabet.
*
* @param pArray a byte array containing binary data
* @return A byte array containing only Base64 character data
*/
public static byte[] encode(byte[] pArray) {
return encodeBase64(pArray, false);
}
public static String encode(String str) throws UnsupportedEncodingException
{
String baseStr = new String(encode(str.getBytes("UTF-8")));
String tempStr = Digest.digest(str).toUpperCase();
String result = tempStr+baseStr;
return new String(encode(result.getBytes("UTF-8")));
}
public static String decode(String cryptoStr) throws
UnsupportedEncodingException {
if(cryptoStr.length()<40)
return "";
try
{
String tempStr = new String(decode(cryptoStr.getBytes("UTF-8")));
String result = tempStr.substring(40, tempStr.length());
return new String(decode(result.getBytes("UTF-8")));
}
catch(java.lang.ArrayIndexOutOfBoundsException ex)
{
return "";
}
}
/**
* Decodes Base64 data into octects
*
* @param encoded string containing Base64 data
* @return Array containind decoded data.
*/
public static byte[] decode2(String encoded) {
if (encoded == null) {
return null;
}
char[] base64Data = encoded.toCharArray();
// remove white spaces
int len = removeWhiteSpace(base64Data);
if (len % FOURBYTE != 0) {
return null;//should be divisible by four
}
int numberQuadruple = (len / FOURBYTE);
if (numberQuadruple == 0) {
return new byte[0];
}
byte decodedData[] = null;
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
int i = 0;
int encodedIndex = 0;
int dataIndex = 0;
decodedData = new byte[(numberQuadruple) * 3];
for (; i < numberQuadruple - 1; i++) {
if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))
|| !isData((d3 = base64Data[dataIndex++]))
|| !isData((d4 = base64Data[dataIndex++]))) {
return null;
}//if found "no data" just return null
b1 = base64Alphabet[d1];
b2 = base64Alphabet[d2];
b3 = base64Alphabet[d3];
b4 = base64Alphabet[d4];
decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
}
if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) {
return null;//if found "no data" just return null
}
b1 = base64Alphabet[d1];
b2 = base64Alphabet[d2];
d3 = base64Data[dataIndex++];
d4 = base64Data[dataIndex++];
if (!isData((d3)) || !isData((d4))) {//Check if they are PAD characters
if (isPad(d3) && isPad(d4)) {
if ((b2 & 0xf) != 0)//last 4 bits should be zero
{
return null;
}
byte[] tmp = new byte[i * 3 + 1];
System.arraycopy(decodedData, 0, tmp, 0, i * 3);
tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
return tmp;
} else if (!isPad(d3) && isPad(d4)) {
b3 = base64Alphabet[d3];
if ((b3 & 0x3) != 0)//last 2 bits should be zero
{
return null;
}
byte[] tmp = new byte[i * 3 + 2];
System.arraycopy(decodedData, 0, tmp, 0, i * 3);
tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
return tmp;
} else {
return null;
}
} else { //No PAD e.g 3cQl
b3 = base64Alphabet[d3];
b4 = base64Alphabet[d4];
decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
}
return decodedData;
}
private static boolean isWhiteSpace(char octect) {
return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9);
}
private static boolean isData(char octect) {
return (octect < BASELENGTH && base64Alphabet[octect] != -1);
}
private static boolean isPad(char octect) {
return (octect == PAD);
}
/**
* remove WhiteSpace from MIME containing encoded Base64 data.
*
* @param data the byte array of base64 data (with WS)
* @return the new length
*/
private static int removeWhiteSpace(char[] data) {
if (data == null) {
return 0;
}
// count characters that's not whitespace
int newSize = 0;
int len = data.length;
for (int i = 0; i < len; i++) {
if (!isWhiteSpace(data[i])) {
data[newSize++] = data[i];
}
}
return newSize;
}
}
| [
"zoe.guo"
] | zoe.guo |
463a478e0200e6b444923bfa7924c163e016460f | 1b973b7c91288012be50a389a7c6ce9842abc250 | /src/main/java/hello/POSController.java | efc14cb5d3170c90a23342878d48087d7c20fe6d | [
"MIT"
] | permissive | lpmi-13/tinderflow | 5c50d2756401ca5bc6b7be4ec6b5858c8e001b5e | 33577de8630826fc362aa0106af8ffccd6f6eded | refs/heads/master | 2022-03-20T16:34:00.086693 | 2019-08-13T06:53:24 | 2019-08-13T06:53:24 | 103,565,431 | 0 | 0 | NOASSERTION | 2022-02-26T01:08:12 | 2017-09-14T18:07:10 | Java | UTF-8 | Java | false | false | 717 | java | //package hello;
//
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//
//@RestController
//@RequestMapping("/pos")
//public class POSController {
//
// @Autowired
// public Tagger tagger;
//
// @RequestMapping(method = RequestMethod.GET, params= {"sentence"})
// public String sendPOSTags(@RequestParam(value="sentence") String sentence) {
// return tagger.taggedWords(sentence);
// }
//
//}
| [
"leskis@gmail.com"
] | leskis@gmail.com |
a9f4842875927807ee20fee5fb8c674e2f0fec65 | 8030d94c8ee99a043d89852170772f7f2cd4e886 | /src/main/java/ee/ignorance/transformiceapi/protocol/client/HoleRequest.java | 09b090f24a30ada200f4be3cf96ed05c4597f3fc | [] | no_license | Tikitaka/TransformiceAPI | d3c67a2227e825fb3fddcf5ba1dbb6d71761d47d | d24dab393dfaf2e50d001dd1c9a06f405428ece9 | refs/heads/master | 2021-01-15T17:37:23.240767 | 2011-03-06T19:26:35 | 2011-03-06T19:26:35 | 1,447,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 513 | java | package ee.ignorance.transformiceapi.protocol.client;
import ee.ignorance.transformiceapi.protocol.ByteBuffer;
public class HoleRequest extends AbstractClientRequest {
private String gameCode;
public HoleRequest(String gameCode) {
this.gameCode = gameCode;
}
@Override
public char[] getBytes() {
ByteBuffer bf = new ByteBuffer();
bf.write(0x05);
bf.write(18);
bf.write(0x01);
bf.print("0");
bf.write(0x01);
bf.print(gameCode);
return bf.getBytesChar();
}
}
| [
"ignorance77@gmail.com"
] | ignorance77@gmail.com |
4b18aa51b930d475c0e27083c98596011ca0106b | 138e0360b83f23e408025e6cbc83fcdbe31c032b | /ecsite2/src/com/internousdev/ecsite/util/DateUtil.java | 5ac98f11c8d9c0991153be526aeed33f315fad5f | [] | no_license | ritumutaka/ECsite | f0bde5ce3f023fadf48e4fd5a63fd48ae34bf5d4 | 3a01a4b18577de331ba89150a265a3ad13722bc7 | refs/heads/master | 2020-04-19T15:01:52.448420 | 2019-01-31T02:06:50 | 2019-01-31T02:06:50 | 168,262,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 280 | java | package com.internousdev.ecsite.util;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateUtil {
public String getDate() {
Date date = new Date();
SimpleDateFormat SDF = new SimpleDateFormat("yyyy/MM/dd/HH:mm:ss");
return SDF.format(date);
}
}
| [
"kazu427@gmail.com"
] | kazu427@gmail.com |
99121bee83611dd531208e94a2f8f470113d991b | f7bab368547f73e8dd1d280f179a9c87f957b6cc | /src/main/java/Controllers/Servlet.java | 05824eb5faa4c8f93c6f1bbe805de4dd6856a952 | [] | no_license | AbdoBoum/Blood-Donation-Plateform | b2c6bb99c241dfb6ab2254891ae0f080cae3f797 | d56b026ef662f64ced4c757865bdcc5c73f6b823 | refs/heads/master | 2022-06-25T13:20:36.775513 | 2020-12-24T13:19:14 | 2020-12-24T13:19:14 | 171,478,942 | 10 | 3 | null | 2020-12-24T13:19:15 | 2019-02-19T13:30:38 | JavaScript | UTF-8 | Java | false | false | 625 | java | package Controllers;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class Servlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
this.getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
}
}
| [
"abderrahim.boumahdi@um5s.net.ma"
] | abderrahim.boumahdi@um5s.net.ma |
ca3d6e6cc2ae208478697ae7ee7526a89689768d | e772db4dae7213e2b8c7bcfdd6654752a7d538be | /src/test/java/com/wallet/HelloWordTest.java | 89056e43be2361c47f1adf8bc4913ccc8fc8a073 | [] | no_license | matos-claudio/wallet-api | 823fbb5511c530d7eaa0fbba808e0be5fde29f6a | ae9ca3907b91c433c5010d06c0027243c1d30d21 | refs/heads/master | 2023-07-29T19:49:45.011296 | 2021-09-15T14:57:52 | 2021-09-15T14:57:52 | 406,177,393 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package com.wallet;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class HelloWordTest {
@Test
public void testHelloWorld() {
assertEquals(1, 1);
}
}
| [
"cloud.devmob@gmail.com"
] | cloud.devmob@gmail.com |
b75da6a0e4b0fad3a6a0475d8b722b74c150e1cd | fe32ea6e76da9592cd990948d5e67cbcd8f25978 | /src/wzorce_projektowe/Person.java | 950b35db69ae72b6709c5bd34d62a651ffc1788e | [] | no_license | atom0wy/wzorce_projektowe | c5d75ca439293c68b5d3d11d5ce2c620ed1f14fc | 9ff75d88c26924d83a530c7ad4a9f171908bdc9b | refs/heads/main | 2023-04-03T19:18:33.828503 | 2021-03-27T13:51:03 | 2021-03-27T13:51:03 | 347,585,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 848 | java | package wzorce_projektowe;
import java.util.Objects;
public class Person {
String pesel;
String name;
public Person(String pesel, String name) {
this.pesel = pesel;
this.name = name;
}
public String getPesel() {
return pesel;
}
public void setPesel(String pesel) {
this.pesel = pesel;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Person)) return false;
Person person = (Person) o;
return Objects.equals(pesel, person.pesel) && Objects.equals(name, person.name);
}
@Override
public int hashCode() {
return Objects.hash(pesel, name);
}
} | [
"uzytkownik@kursGIT.pl"
] | uzytkownik@kursGIT.pl |
74014da34db4ad71c433e4b4752463108d02d511 | 06f233236143781954e18772d0b75689a99d9410 | /LinkedLists180415/src/Main.java | 9d501683ae6999e558ec4c472c70b95a316f8385 | [] | no_license | klaskowski/SDAcademyProjects | 6b9876d58100025799575458f8a3f93583dfa325 | 2c1e042846cd5f6432402b17d2c3003969b498a2 | refs/heads/master | 2020-12-20T23:35:17.612215 | 2018-10-11T20:22:26 | 2018-10-11T20:22:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,773 | java | import java.util.Scanner;
public class Main {
static Node firstNode;
static Node lastNode;
public static void main(String[] args) {
readList();
displayList();
removeFirstValue(3);
displayList();
int counter = removeAllValues(1);
displayList();
System.out.println("You deleted " + counter + " items");
removeForIndex(0);
displayList();
}
public static void readList() {
Scanner scanner = new Scanner(System.in);
System.out.print("Number of elements: ");
int itemCount = scanner.nextInt();
for (int i = 0; i < itemCount; i++) {
readItem(scanner, i);
}
}
public static void readItem(Scanner scanner, int index) {
System.out.print("Item " + index + ": ");
int value = scanner.nextInt();
add(value);
}
public static void add(int value) {
Node newNode = new Node();
newNode.setValue(value);
//daca sunt la prima adaugare
if (firstNode == null) {
firstNode = newNode;
lastNode = firstNode;
} else {
lastNode.setNextNode(newNode);
lastNode = newNode;
}
}
private static void deleteNode(Node previousNode) {
if (previousNode == null) {
deleteFirstNode();
} else if (previousNode.getNextNode() == lastNode) {
deleteLastNode(previousNode);
} else {
deleteInlineNode(previousNode);
}
}
private static void deleteFirstNode() {
firstNode = firstNode.getNextNode();
}
private static void deleteLastNode(Node previousNode) {
previousNode.setNextNode(null);
lastNode = previousNode;
}
private static void deleteInlineNode(Node previousNode) {
previousNode.setNextNode(previousNode.getNextNode().getNextNode());
}
public static int removeFirstValue(int value) {
return removeValues(value, true);
}
public static int removeAllValues(int value) {
return removeValues(value, false);
}
/**
* removes occurring values from a list.
* @param value the value to be removed
* @param stopOnFirst specifies if it should stop after the first removal
* @return the number of removed items
*/
private static int removeValues(int value, boolean stopOnFirst){
Node currentNode = firstNode;
Node previousNode = null;
int counter = 0;
while (currentNode != null) {
if (currentNode.getValue() == value) {
deleteNode(previousNode);
counter++;
if(stopOnFirst){
break;
}
}else{
previousNode = currentNode;
}
currentNode = currentNode.getNextNode();
}
return counter;
}
public static int removeForIndex(int index) {
Node currentNode = firstNode;
Node previousNode = null;
int position = 0;
while(currentNode != null){
if(position == index){
deleteNode(previousNode);
}else{
previousNode = currentNode;
}
position++;
currentNode = currentNode.getNextNode();
}
return 0;
}
public static void displayList() {
Node currentNode = firstNode;
System.out.print("{");
while (currentNode != null) {
System.out.print(currentNode.getValue());
if(currentNode != lastNode){
System.out.print(", ");
}
currentNode = currentNode.getNextNode();
}
System.out.println("}");
}
}
| [
"jitaruvictor@gmail.com"
] | jitaruvictor@gmail.com |
59edb95067e21e577076390c5a4256f766e57039 | e02e8ef60aac3b8150c6f286744c7867468b4435 | /src/org/venipedia/ui/MassPageCreation.java | c8893146c1f5c9841151cf4634a5feed4a8de1d3 | [] | no_license | PiRSquared17/qwiki-wiki | e5ead6e0af6fa8966c48b273de972aaadfcaa769 | 4963d69e2408b0537e6fc01bce34ce45aa224c7b | refs/heads/master | 2020-05-17T08:30:42.819798 | 2012-02-25T15:42:36 | 2012-02-25T15:42:36 | 32,191,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,507 | java | package org.venipedia.ui;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.SwingWorker;
import org.venipedia.QwikiWiki;
import org.venipedia.bot.ImportPair;
import org.venipedia.bot.ImportSpec;
import org.venipedia.entities.DatabaseTable;
import org.venipedia.entities.Page;
public class MassPageCreation extends JInternalFrame {
private static final long serialVersionUID = -3512602067595201245L;
QwikiWiki parent;
private JTextField comboBox;
/**
* Create the frame.
*/
public MassPageCreation(QwikiWiki qw) {
parent = qw;
setTitle("Mass-upload pages");
setFrameIcon(new ImageIcon(MassPageCreation.class.getResource("/icons/blogs-stack.png")));
setClosable(true);
setBounds(100, 100, 450, 300);
GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.columnWidths = new int[]{0, 0, 0};
gridBagLayout.rowHeights = new int[]{0, 0, 0, 0};
gridBagLayout.columnWeights = new double[]{1.0, 0.0, Double.MIN_VALUE};
gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
getContentPane().setLayout(gridBagLayout);
JLabel lblSelectImportSpecification = new JLabel("Select import specification:");
GridBagConstraints gbc_lblSelectImportSpecification = new GridBagConstraints();
gbc_lblSelectImportSpecification.gridwidth = 2;
gbc_lblSelectImportSpecification.insets = new Insets(0, 0, 5, 0);
gbc_lblSelectImportSpecification.gridx = 0;
gbc_lblSelectImportSpecification.gridy = 0;
getContentPane().add(lblSelectImportSpecification, gbc_lblSelectImportSpecification);
comboBox = new JTextField();
comboBox.setColumns(24);
GridBagConstraints gbc_comboBox = new GridBagConstraints();
gbc_comboBox.gridwidth = 2;
gbc_comboBox.insets = new Insets(0, 0, 5, 5);
gbc_comboBox.fill = GridBagConstraints.HORIZONTAL;
gbc_comboBox.gridx = 0;
gbc_comboBox.gridy = 1;
getContentPane().add(comboBox, gbc_comboBox);
JButton btnHelp = new JButton("Help");
btnHelp.setIcon(new ImageIcon(MassPageCreation.class.getResource("/icons/question.png")));
GridBagConstraints gbc_btnHelp = new GridBagConstraints();
gbc_btnHelp.anchor = GridBagConstraints.WEST;
gbc_btnHelp.insets = new Insets(0, 0, 0, 5);
gbc_btnHelp.gridx = 0;
gbc_btnHelp.gridy = 2;
getContentPane().add(btnHelp, gbc_btnHelp);
JButton btnUpload = new JButton("Upload");
btnUpload.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
upload();
}
});
btnUpload.setIcon(new ImageIcon(MassPageCreation.class.getResource("/icons/upload-cloud.png")));
GridBagConstraints gbc_btnUpload = new GridBagConstraints();
gbc_btnUpload.gridx = 1;
gbc_btnUpload.gridy = 2;
getContentPane().add(btnUpload, gbc_btnUpload);
pack();
}
protected void upload() {
SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
protected Void doInBackground() {
uploadData();
return null;
}
};
worker.execute();
}
protected void uploadData() {
String specName = getComboBox().getText();
// first we ask VeniBot to get us our specification file
ImportSpec spec = parent.getVeniBot().getImportSpec(specName);
String db = spec.getDatabase();
String tableName = spec.getTableName();
// then we ask BlueBot to go grab the data table
DatabaseTable table = parent.getBlueBot().getTable(db, tableName);
String template = spec.getTemplate();
int totalArticles = table.getRowCount();
parent.setMaximum(totalArticles);
for(int row=0;row<totalArticles;row++){
String title = table.getValuetA(row, spec.getTitle());
parent.setStatus("Uploading \""+title+"\" (page "+row+" of "+totalArticles+")...");
Page page = new Page(title);
page.append("{{");
page.append(template);
page.append("\n");
for(ImportPair pair:spec.getPairs()){
page.append("|");
page.append(pair.getTemplateField());
page.append(" = ");
page.append(table.getValuetA(row, pair.getColumn()));
page.append("\n");
}
page.append("}}");
parent.getVeniBot().upload(page);
parent.setProgress(row);
}
parent.setProgress(0);
parent.setStatus("Done with upload.");
dispose();
}
protected JTextField getComboBox() {
return comboBox;
}
}
| [
"ryan.a.muller@gmail.com"
] | ryan.a.muller@gmail.com |
b6d669f8ebbcc0c8d32aa351fb034c46de6ddf44 | 54927e4089a3d756f6a7834b9038932ad37b9c5b | /src/com/lwf/ustb/www/FEE/mutant/AOIS_53/ParkingFeeCalculator.java | 1b5b9d8bbf5146b54c786b88af8d972af0fa507e | [] | no_license | phantomDai/parkingfeesystem | a6c2873be3b9416611ae4abf364c7a6921eecceb | 66519374fc83646a11f6a8f02c4f2b7bc0919b0e | refs/heads/master | 2021-05-07T00:13:25.901481 | 2019-06-21T06:36:20 | 2019-06-21T06:36:20 | 110,121,082 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,391 | java | // This is a mutant program.
// Author : ysma
package com.lwf.ustb.www.FEE.mutant.AOIS_53;
import com.lwf.ustb.www.FEE.util.*;
public class ParkingFeeCalculator
{
private double formatDouble( double d )
{
java.lang.String t = String.format( "%.2f", d );
double r = new java.lang.Double( t );
return r;
}
private double parkingFeeWithoutDiscount( int typeOfVehicle, int typeOfCar, int dayOfWeek, double apd )
{
double fee = 0.0;
if (apd <= 0 || apd > 24) {
return -1;
}
if (typeOfVehicle != com.lwf.ustb.www.FEE.util.Vehicle.MOTORCYCLE && typeOfVehicle != com.lwf.ustb.www.FEE.util.Vehicle.CAR) {
return -1;
}
if (typeOfVehicle == com.lwf.ustb.www.FEE.util.Vehicle.CAR && typeOfCar != com.lwf.ustb.www.FEE.util.Car.TWO_DOOR_COUPE && typeOfCar != com.lwf.ustb.www.FEE.util.Car.OTHERS) {
return -1;
}
if (++dayOfWeek != com.lwf.ustb.www.FEE.util.Day.WEEKDAY && dayOfWeek != com.lwf.ustb.www.FEE.util.Day.WEEKEND) {
return -1;
}
int parkingHours;
if (apd % 1 == 0) {
parkingHours = (int) apd;
} else {
parkingHours = (int) apd + 1;
}
switch (dayOfWeek) {
case com.lwf.ustb.www.FEE.util.Day.WEEKDAY :
if (parkingHours <= 2) {
if (typeOfVehicle == com.lwf.ustb.www.FEE.util.Vehicle.MOTORCYCLE) {
fee = parkingHours * 4;
} else {
if (typeOfCar == com.lwf.ustb.www.FEE.util.Car.TWO_DOOR_COUPE) {
fee = parkingHours * 4.5;
} else {
fee = parkingHours * 5;
}
}
} else {
if (parkingHours <= 4) {
if (typeOfVehicle == com.lwf.ustb.www.FEE.util.Vehicle.MOTORCYCLE) {
fee = 2 * 4 + (parkingHours - 2) * 5;
} else {
if (typeOfCar == com.lwf.ustb.www.FEE.util.Car.TWO_DOOR_COUPE) {
fee = 2 * 4.5 + (parkingHours - 2) * 5.5;
} else {
fee = 2 * 5 + (parkingHours - 2) * 6;
}
}
} else {
if (typeOfVehicle == com.lwf.ustb.www.FEE.util.Vehicle.MOTORCYCLE) {
fee = 2 * 4 + 2 * 5 + (parkingHours - 4) * 6;
} else {
if (typeOfCar == com.lwf.ustb.www.FEE.util.Car.TWO_DOOR_COUPE) {
fee = 2 * 4.5 + 2 * 5.5 + (parkingHours - 4) * 6.5;
} else {
fee = 2 * 5 + 2 * 6 + (parkingHours - 4) * 7;
}
}
}
}
break;
case com.lwf.ustb.www.FEE.util.Day.WEEKEND :
if (parkingHours <= 2) {
if (typeOfVehicle == com.lwf.ustb.www.FEE.util.Vehicle.MOTORCYCLE) {
fee = parkingHours * 5;
} else {
if (typeOfCar == com.lwf.ustb.www.FEE.util.Car.TWO_DOOR_COUPE) {
fee = parkingHours * 6;
} else {
fee = parkingHours * 7;
}
}
} else {
if (parkingHours <= 4) {
if (typeOfVehicle == com.lwf.ustb.www.FEE.util.Vehicle.MOTORCYCLE) {
fee = 2 * 5 + (parkingHours - 2) * 6.5;
} else {
if (typeOfCar == com.lwf.ustb.www.FEE.util.Car.TWO_DOOR_COUPE) {
fee = 2 * 6 + (parkingHours - 2) * 7.5;
} else {
fee = 2 * 7 + (parkingHours - 2) * 8.5;
}
}
} else {
if (typeOfVehicle == com.lwf.ustb.www.FEE.util.Vehicle.MOTORCYCLE) {
fee = 2 * 5 + 2 * 6.5 + (parkingHours - 4) * 8;
} else {
if (typeOfCar == com.lwf.ustb.www.FEE.util.Car.TWO_DOOR_COUPE) {
fee = 2 * 6 + 2 * 7.5 + (parkingHours - 4) * 9;
} else {
fee = 2 * 7 + 2 * 8.5 + (parkingHours - 4) * 10;
}
}
}
}
break;
default :
}
return formatDouble( fee );
}
private double parkingFeeWithDiscountCoupon( int typeOfVehicle, int typeOfCar, int dayOfWeek, double apd )
{
return formatDouble( parkingFeeWithoutDiscount( typeOfVehicle, typeOfCar, dayOfWeek, apd ) * 0.5 );
}
private double parkingFeeWithEstimation( int typeOfVehicle, int typeOfCar, int dayOfWeek, double apd, java.lang.String estimation )
{
if (estimation.equals( "(0, 2]" ) && apd > 0 && apd <= 2 || estimation.equals( "(2, 4]" ) && apd > 2 && apd <= 4 || estimation.equals( "(4, 24]" ) && apd > 4 && apd <= 24) {
return formatDouble( parkingFeeWithoutDiscount( typeOfVehicle, typeOfCar, dayOfWeek, apd ) * 0.4 );
} else {
if (!estimation.equals( "(0, 2]" ) && !estimation.equals( "(2, 4]" ) && !estimation.equals( "(4, 24]" )) {
return -1;
} else {
return formatDouble( parkingFeeWithoutDiscount( typeOfVehicle, typeOfCar, dayOfWeek, apd ) * 1.2 );
}
}
}
public double parkingFee( int typeOfVehical, int typeOfCar, int dayOfWeek, double apd, boolean discountCoupon, java.lang.String estimation )
{
double fee = -1;
if (discountCoupon && estimation != null) {
fee = -1;
} else {
if (discountCoupon) {
fee = parkingFeeWithDiscountCoupon( typeOfVehical, typeOfCar, dayOfWeek, apd );
} else {
if (estimation != null) {
fee = parkingFeeWithEstimation( typeOfVehical, typeOfCar, dayOfWeek, apd, estimation );
} else {
fee = parkingFeeWithoutDiscount( typeOfVehical, typeOfCar, dayOfWeek, apd );
}
}
}
return fee;
}
}
| [
"daihepeng@sina.cn"
] | daihepeng@sina.cn |
7245979aa4a9eb83c2fd9b37ec912c538e8c1336 | 3aed5bbdb2d01622a8e3307aa829a7b6abe3b0fb | /Spring_Boot_Session3/Complete_Code/OneToMany/OneToMany/src/main/java/com/masai/books/BookManagement/entity/Course.java | 062463a8305945f48cac6a50467c8460d48175d2 | [] | no_license | varunbhtt21/Masai_Spring_Session | ca8a9dc45f8ded4556a83c0e914d6a64c060116b | 03224cd6b6e43d0d429e14d1ff93d2e092761d3a | refs/heads/master | 2023-03-25T18:56:50.432585 | 2021-03-15T18:23:31 | 2021-03-15T18:23:31 | 344,687,351 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 864 | java | package com.masai.books.BookManagement.entity;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import lombok.*;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import java.util.ArrayList;
import java.util.List;
@Entity
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class Course {
@Id
Long courseId;
String courseName;
@ToString.Exclude
@OneToMany(mappedBy = "course",fetch = FetchType.LAZY)
@JsonManagedReference
List<Review> reviewList = new ArrayList<>();
public List<Review> getReviewList() {
return reviewList;
}
public void addReview(Review review) {
this.reviewList.add(review);
}
public void removeReview(Review review){
this.reviewList.remove(review);
}
}
| [
"varunbhatt21@gmail.com"
] | varunbhatt21@gmail.com |
861bc5752f9f9baa788397351232eee6a8906480 | 09e71a4ad59678799673a8999ab8bd3c427fd314 | /src/test/java/com/niit/Backend/UserDAOTestCase.java | 2dc847c2f88ca40cc151301c26b1f61f47cb5a1b | [] | no_license | surendar789/online-shoppingstore | abfc3df10b0a9df02728fbe80e68b6e00414dcd2 | d57eaa24ffe43780f2460bd1da6ec0bb2be42340 | refs/heads/master | 2021-07-25T12:59:30.588720 | 2017-11-04T10:13:45 | 2017-11-04T10:13:45 | 109,388,223 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,563 | java | package com.niit.Backend;
import static org.junit.Assert.*;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import com.niit.Dao.UserDAO;
import com.niit.model.User;
public class UserDAOTestCase {
@Autowired
static AnnotationConfigApplicationContext context;
@Autowired
static UserDAO userDAO;
@Autowired
static User user;
@BeforeClass
public static void initialize() {
context = new AnnotationConfigApplicationContext();
context.scan("com.niit");
context.refresh();
userDAO = (UserDAO) context.getBean("userDAO");
user = (User) context.getBean("user");
}
/*@Test
public void createUserTestCase() {
user.setId("admin1");
user.setName("admin1");
user.setPassword("admin1");
user.setRole("ROLE_ADMIN");
user.setContact("9989988806");
boolean flag = userDAO.save(user);
assertEquals("createUserTestCase", true, flag);
}
/*@Test
public void updateUserTestCase() {
user.setId("admin");
user.setName("admin");
user.setPassword("admin");
user.setRole("ROLE_ADMIN");
user.setContact("8877665544");
boolean flag = userDAO.update(user);
assertEquals("updateUserTestCase", true, flag);
}
@Test
public void validateUserTestCase() {
boolean flag = userDAO.validate("admin", "admin");
assertEquals(true, flag);
}
@Test
public void listAllUserTestCase() {
int actualSize = userDAO.list().size();
assertEquals(5, actualSize);
}*/
}
| [
"surendar8rrs@gmail.com"
] | surendar8rrs@gmail.com |
5ff01346aa3bd9feebdb26cbba6849df4b4ece9a | df48a5bbab3210a44579a74e62acd9ef093807aa | /java/morelang/src/main/java/com/deitui/morelang/index/admin/OpenAlipayAppController.java | 653682be4249addb0414b6403540bae9f7f001a3 | [] | no_license | lrjxgl/mmLang | 6fa664d5a2dd05b0af861f8e5b62f3f8a529d5ea | 8d905ae87a6cce3eab0d61d77944069cfa3a81be | refs/heads/main | 2023-06-26T16:30:23.732793 | 2021-07-30T01:37:18 | 2021-07-30T01:37:18 | 382,492,998 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,561 | java |
package com.deitui.morelang.index.admin;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.deitui.morelang.index.model.OpenAlipayAppModel;
import com.model.Help;
@RestController
@CrossOrigin("*")
public class OpenAlipayAppController {
@RequestMapping("/admin/open_alipay_app/index")
public String Index() {
OpenAlipayAppModel am=new OpenAlipayAppModel();
String where=" 1 ";
List list=am.where(where).Dselect();
Map<String,Object> redata=new HashMap<String,Object>();
redata.put("error",0);
redata.put("message","succcess");
redata.put("list", list);
return JSON.toJSONString(redata);
}
@RequestMapping("/admin/open_alipay_app/show")
public String Show(
@RequestParam(value="token",defaultValue="") String token,
@RequestParam(value="id",defaultValue="0") int id
) {
OpenAlipayAppModel am=new OpenAlipayAppModel();
Map data=am.where("id="+id).selectRow();
Map<String,Object> redata=new HashMap<String,Object>();
redata.put("error",0);
redata.put("message","succcess");
redata.put("data", data);
return JSON.toJSONString(redata);
}
@RequestMapping("/admin/open_alipay_app/add")
public String Add(
@RequestParam(value="token",defaultValue="") String token,
@RequestParam(value="id",defaultValue="0") int id
) {
OpenAlipayAppModel am=new OpenAlipayAppModel();
Map data=new HashMap();
if(id!=0) {
data=am.where("id="+id).selectRow();
data.put("trueimgurl", Help.image_site(data.get("imgurl")+""));
}
Map<String,Object> redata=new HashMap<String,Object>();
redata.put("error",0);
redata.put("message","succcess");
redata.put("data", data);
return JSON.toJSONString(redata);
}
@RequestMapping("/admin/open_alipay_app/save")
public String Save(
@RequestParam(value="token",defaultValue="") String token,
@RequestParam(value="id",defaultValue="0") int id,
@RequestParam(value="title",defaultValue="") String title,
@RequestParam(value="appid",defaultValue="") String appid,
@RequestParam(value="appkey",defaultValue="") String appkey,
@RequestParam(value="status",defaultValue="0") int status,
@RequestParam(value="appcert_path",defaultValue="") String appcert_path,
@RequestParam(value="alicert_path",defaultValue="") String alicert_path,
@RequestParam(value="rootcert_path",defaultValue="") String rootcert_path,
@RequestParam(value="notify_url",defaultValue="") String notify_url,
@RequestParam(value="return_url",defaultValue="") String return_url,
@RequestParam(value="openlogin",defaultValue="0") int openlogin,
@RequestParam(value="merchant_private_key",defaultValue="") String merchant_private_key
) {
Map indata= new HashMap();
indata.put("title", title);
indata.put("appid", appid);
indata.put("appkey", appkey);
indata.put("status", status);
indata.put("appcert_path", appcert_path);
indata.put("alicert_path", alicert_path);
indata.put("rootcert_path", rootcert_path);
indata.put("notify_url", notify_url);
indata.put("return_url", return_url);
indata.put("openlogin", openlogin);
indata.put("merchant_private_key", merchant_private_key);
OpenAlipayAppModel am=new OpenAlipayAppModel();
if(id==0) {
am.insert(indata);
}else {
am.update(indata, "id="+id);
}
return Help.success(0, "保存成功");
}
@RequestMapping("/admin/open_alipay_app/status")
public String Status(
@RequestParam(value="token",defaultValue="") String token,
@RequestParam(value="id",defaultValue="0") int id
) {
OpenAlipayAppModel am=new OpenAlipayAppModel();
Map row=am.where("id="+id).selectRow();
JSONObject json=(JSONObject) new JSONObject().toJSON(row);
int status=0;
if(json.getIntValue("status")==1) {
status=2;
}else {
status=1;
}
Map indata=new HashMap();
indata.put("status", status);
am.update(indata,"id="+id);
Map<String,Object> redata=new HashMap<String,Object>();
redata.put("error",0);
redata.put("message","succcess");
redata.put("status", status);
return JSON.toJSONString(redata);
}
@RequestMapping("/admin/open_alipay_app/recommend")
public String recommend(
@RequestParam(value="token",defaultValue="") String token,
@RequestParam(value="id",defaultValue="0") int id
) {
OpenAlipayAppModel am=new OpenAlipayAppModel();
Map row=am.where("id="+id).selectRow();
JSONObject json=(JSONObject) new JSONObject().toJSON(row);
int status=0;
if(json.getIntValue("is_recommend")==1) {
status=0;
}else {
status=1;
}
Map indata=new HashMap();
indata.put("is_recommend", status);
am.update(indata,"id="+id);
Map<String,Object> redata=new HashMap<String,Object>();
redata.put("error",0);
redata.put("message","succcess");
redata.put("is_recommend", status);
return JSON.toJSONString(redata);
}
@RequestMapping("/admin/open_alipay_app/delete")
public String delete(
@RequestParam(value="token",defaultValue="") String token,
@RequestParam(value="id",defaultValue="0") int id
) {
OpenAlipayAppModel am=new OpenAlipayAppModel();
Map indata= new HashMap();
indata.put("status", 11);
am.update(indata, "id="+id);
return Help.success(0, "删除成功");
}
}
| [
"362606856@qq.com"
] | 362606856@qq.com |
b5d84191612221a3322aee0c7e5dbf4dfde46d2c | 921b73fb6a0964210b9f513b9aa08b4d1c2cf7d7 | /src/main/java/TercerParcialExamen/Visitor/Documento.java | 4b13d48854a051022fc4986764030f9c2369af23 | [] | no_license | X4TKC/PatronesDeDiseno | d781ff5b4c7459f01dfe484cdc18e7a9ec89d75b | 0ccbadc36ae5355707193766cec3e71dac5830b3 | refs/heads/master | 2020-08-10T03:14:55.449201 | 2019-11-15T12:26:14 | 2019-11-15T12:26:14 | 214,243,199 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 822 | java | package TercerParcialExamen.Visitor;
public class Documento {
private String text;
private String name;
private String formato;
private int numChar;
public Documento (String text, String name){
this.text=text;
this.name=name;
}
public int getNumChar() {
return numChar;
}
public void setNumChar(int numChar) {
this.numChar = numChar;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFormato() {
return formato;
}
public void setFormato(String formato) {
this.formato = formato;
}
}
| [
"tovilaskevin@gmail.com"
] | tovilaskevin@gmail.com |
a52f556add3ed5251e57e87adfed0f42233e5d60 | e152697a077902bc7e67c96d68d89e20c68daaa9 | /src/firefly/java/edu/caltech/ipac/firefly/server/visualize/OptimizeForMemoryPurger.java | cd0db163077cee4d24820256c691352d2f315f70 | [] | no_license | gpdf/Caltech-firefly | 0c4fd82374a87df1af3eff5998fb3dfed4ce4caa | e4a928d1a95b98f57011cc3636323e53dcdb8aff | refs/heads/master | 2020-12-28T07:50:17.000586 | 2015-04-06T21:46:59 | 2015-04-06T21:47:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,200 | java | /*
* License information at https://github.com/Caltech-IPAC/firefly/blob/master/License.txt
*/
package edu.caltech.ipac.firefly.server.visualize;
/**
* User: roby
* Date: 10/10/13
* Time: 9:50 AM
*/
import edu.caltech.ipac.firefly.visualize.PlotState;
import java.util.ConcurrentModificationException;
import java.util.Map;
/**
* @author Trey Roby
*/
public class OptimizeForMemoryPurger implements MemoryPurger {
public void purgeOtherPlots(PlotState excludeState) {
PlotClientCtx ctx= VisContext.getPlotCtx(excludeState.getContextString());
if (ctx!=null) {
String excludeKey= ctx.getKey();
synchronized (VisContext.class) {
try {
for(Map.Entry<String,PlotClientCtx> entry : VisContext.getMap().entrySet()) {
if (!entry.getKey().equals(excludeKey)) {
entry.getValue().freeResources(PlotClientCtx.Free.YOUNG);
}
}
} catch (ConcurrentModificationException e) {
// just abort the purging - another thread is updating the map
}
}
}
}
}
| [
"roby@ipac.caltech.edu"
] | roby@ipac.caltech.edu |
16ba0ed9e9013ad94d979065e15e248dac7feb5a | 1e784aa934e72cf3faaf17c6a723433e07d2d7d3 | /Thinking_in_Java/src/agree/Thinking_in_Java/No18/OSExecute.java | 8e91535288a3da059f68f104369c151d22d794e7 | [] | no_license | nymanz/study_workspace | 921aa091672ca48cdbed533cd5759447f285b082 | 157cb2935e9f5981cbe718f566e45f7518f679f9 | refs/heads/master | 2022-12-21T06:23:36.386923 | 2020-04-08T15:35:15 | 2020-04-08T15:35:15 | 118,579,443 | 3 | 1 | null | 2022-12-16T01:12:34 | 2018-01-23T08:15:53 | Java | UTF-8 | Java | false | false | 861 | java | package com.agree.Thinking_in_JAVA_eighteen;
import java.io.BufferedReader;
import java.io.*;
public class OSExecute {
public static void command(String command){
boolean err = false;
try{
Process process=new ProcessBuilder(command.split(" ")).start();
BufferedReader results = new BufferedReader(
new InputStreamReader(process.getInputStream()));
String s;
while((s=results.readLine())!=null){
System.out.println(s);
}
BufferedReader errors = new BufferedReader(new InputStreamReader(process.getErrorStream()));
while((s = errors.readLine())!=null){
System.out.println(s);
err = true;
}
}catch(Exception e ){
if(!command.startsWith("CMD /C")){
command("CMD /C"+command);
}
else
throw new RuntimeException(e);
}
if(err){
throw new OSExcuteException("Errors executing"+command);
}
}
}
| [
"980299466@qq.com"
] | 980299466@qq.com |
2078407490c00314b0d5943725207ff7fce2d7b1 | e271e34cbd168b9f4641a4946d7b10e13cb782c5 | /src/main/java/top/dpdaidai/architect/multithreading/T07_SynchronizedObject.java | eefa88aabf32af945c838fac577b14cdc0f21423 | [] | no_license | dpdaidai/stuty-architect | 6a4e96e7e33602476c82de00f4fa57f78c339ed1 | 303848c5c04becd8fa2149aaabd336a05db82b4f | refs/heads/master | 2023-07-06T05:51:05.883438 | 2021-08-12T01:40:18 | 2021-08-12T01:40:18 | 327,666,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,242 | java | package top.dpdaidai.architect.multithreading;
import java.util.concurrent.TimeUnit;
/**
* 方法级别的锁锁的是对象本身 , 可以从hashCode查看是否是同一个对象
*
* @Author chenpantao
* @Date 1/12/21 11:03 PM
* @Version 1.0
*/
public class T07_SynchronizedObject {
synchronized
void fatherMethod(String name){
System.out.println(name + " father method start" + this.hashCode());
try {
TimeUnit.SECONDS.sleep(3);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(name + " father method end");
}
public static void main(String[] args) {
T07_Child child01 = new T07_Child();
new Thread(()-> child01.childMethod("child01")).start();
new Thread(()-> child01.childMethod("child01_1")).start();
T07_Child child02 = new T07_Child();
new Thread(()-> child02.childMethod("child02")).start();
}
}
class T07_Child extends T07_SynchronizedObject{
// synchronized
void childMethod(String name){
System.out.println(name + " child method start");
super.fatherMethod(name);
System.out.println(name + " child method end");
}
}
| [
"pantaochen@gmail.com"
] | pantaochen@gmail.com |
b7fdcbb4892d13370d88b6a6f7c6a3a5e5c85a2f | 5b67b1c7c039850f2179fd7ac05240aa314ff253 | /app/src/main/java/com/appunite/example/debugutilsexample/dagger/ForApplication.java | deabaaac2824e778a36ef4f0b1e31ea530ad7bd9 | [] | no_license | Garzas/debug-helper-example | 673b1553f5312e773f4fd59b7b64031199868552 | 7cea28547f0188145b7642da8ba8edc932740870 | refs/heads/master | 2021-01-01T04:29:39.008926 | 2016-05-19T07:07:29 | 2016-05-19T07:07:29 | 57,291,264 | 0 | 1 | null | 2016-04-28T13:36:13 | 2016-04-28T10:03:21 | Java | UTF-8 | Java | false | false | 570 | java | package com.appunite.example.debugutilsexample.dagger;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.inject.Qualifier;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
@Qualifier
@Target({PARAMETER, FIELD, CONSTRUCTOR, METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ForApplication {
}
| [
"zerasop@gmail.com"
] | zerasop@gmail.com |
e3c35367d6e248bb665de35992472c1e1f76769d | 0b45406d98abe37443fbf3d8d13493bb161454ea | /app/src/main/java/test/testandroid/RVAdapter.java | 77954ed11d64720a132d89e1f9a0afb080ee9916 | [] | no_license | Bassilij/TestAndroid | dd171b869a1b758b29cb76b9daea9ac219f45c9d | 69fa1020fbc988cef3b093df57d626625da4e350 | refs/heads/master | 2020-12-02T08:03:17.094856 | 2017-07-10T12:54:19 | 2017-07-10T12:54:19 | 96,763,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,575 | java | package test.testandroid;
import android.graphics.Color;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import test.testandroid.Retrofit.Users;
/**
* Created by Bassilij on 10.07.2017.
*/
public class RVAdapter extends RecyclerView.Adapter<RVAdapter.PersonViewHolder>{
public static class PersonViewHolder extends RecyclerView.ViewHolder {
CardView cv;
TextView Name;
ImageView imageView;
TextView Age;
TextView Similarity;
TextView Datet;
TextView Mess;
PersonViewHolder(View itemView) {
super(itemView);
cv = (CardView)itemView.findViewById(R.id.message);
Name = (TextView) itemView.findViewById(R.id.Name);
imageView = (ImageView) itemView.findViewById(R.id.Image);
Age = (TextView) itemView.findViewById(R.id.Age);
Similarity = (TextView) itemView.findViewById(R.id.Similarity);
Datet = (TextView) itemView.findViewById(R.id.Date);
Mess = (TextView) itemView.findViewById(R.id.Mes);
Mess.setBackgroundColor(Color.BLUE);
Mess.setTextColor(Color.WHITE);
}
}
List<Users> persons;
RVAdapter(List<Users> persons){
this.persons = persons;
}
@Override
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
}
@Override
public PersonViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.card, viewGroup, false);
PersonViewHolder pvh = new PersonViewHolder(v);
return pvh;
}
@Override
public void onBindViewHolder(PersonViewHolder personViewHolder, int i) {
personViewHolder.Name.setText(persons.get(i).getName());
personViewHolder.Age.setText(persons.get(i).getAge().toString()+" лет, ");
//personViewHolder.Similarity.setText(persons.get(i).getSimilarity()+"%");
personViewHolder.Datet.setText(persons.get(i).getLastSeen());
//personViewHolder.Mess.setText(persons.get(i).getUnreadMessages()+"");
//personViewHolder.imageView.setImageResource(persons.get(i).getAvatar());
/////////////////////////////////////////////////////////////////////////////////////////
try {
String date = persons.get(i).getLastSeen();
SimpleDateFormat format = new SimpleDateFormat();
format.applyPattern("dd.MM.yyyy KK:mm"); //KK:mm
Date docDate= format.parse(date);
SimpleDateFormat format2 = new SimpleDateFormat();
format2.applyPattern("dd.MM.yyyy");
SimpleDateFormat format3 = new SimpleDateFormat();
format3.applyPattern("HH:mm");
Date tekDate = new Date();
if (format2.format(tekDate).equals(format2.format(docDate)))
personViewHolder.Datet.setText("Сегодня, " + format3.format(docDate));
} catch (ParseException e) {
e.printStackTrace();
}
int Mes = persons.get(i).getUnreadMessages();
if(Mes > 0)
personViewHolder.Mess.setText(Mes+"");
if(Mes > 999)
personViewHolder.Mess.setText("999+");
try {
Glide
.with(personViewHolder.imageView.getContext())
.load(persons.get(i).getAvatar())
.override(75, 75)
.into(personViewHolder.imageView);
} catch (Exception e){}
//TextView Similarity = (TextView) card.findViewById(R.id.Similarity);
int similarity = persons.get(i).getSimilarity();
personViewHolder.Similarity.setText(similarity+"%");
personViewHolder.Similarity.setTextColor(Color.GREEN);
if(similarity <= 40)
personViewHolder.Similarity.setTextColor(Color.RED);
else if (similarity <= 70)
personViewHolder.Similarity.setTextColor(Color.YELLOW);
/////////////////////////////////////////////////////////////////////////////////////////
}
@Override
public int getItemCount() {
return persons.size();
}
} | [
"fok-wassya@yandex.ru"
] | fok-wassya@yandex.ru |
271051b570bbbaad77acf31f236e4bd766f67883 | 928d61ace1726bcc305774a2f326c175b0f00779 | /test/test/DepartmentManagerJUnitTest.java | 1940e67de14eff76ad30b9b5ea789ee326649565 | [] | no_license | langenet/Assignment3 | 5d0a3b1bb9910016c530c20e085d027f40333c27 | 5809aa459226b5dc664501a4d8ad3ea94e30e7f1 | refs/heads/master | 2020-04-21T05:35:15.120463 | 2019-02-12T21:04:06 | 2019-02-12T21:04:06 | 169,345,173 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,178 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package test;
import businesslayer.DepartmentEmployeeService;
import businesslayer.DepartmentManagerService;
import datatransferobjects.DepartmentManager;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import static org.junit.Assert.*;
import org.junit.Test;
/**
*
* @author Robert Lange and Alexander Riccio
*/
public class DepartmentManagerJUnitTest {
public DepartmentManagerJUnitTest() {
}
@Test
public void testingDepartmentManagerGetById() {
int empNo = 110022;
String deptNo = "d001";
Date fromDate = new GregorianCalendar(1985, 0, 1).getTime();
Date toDate = new GregorianCalendar(1991, 9, 1).getTime();
DepartmentManagerService departmentManagerService = new DepartmentManagerService();
DepartmentManager departmentManagerValue = departmentManagerService.getById(empNo, deptNo);
assertTrue(departmentManagerValue.getFromDate().equals(fromDate));
assertTrue(departmentManagerValue.getToDate().equals(toDate));
}
/**
* This is failing because the database doesn't use an ID column Since we
* need to stick with this database design, we need to add some logic to
* either verify if the entry is already in the table, or try to randomize
* the emp_no and dept_no.
*/
// @Test
// public void testingDepartmentManagerAdd() {
//
// int empNo = 100001;
// String deptNo = "d004";
// Date fromDate = new GregorianCalendar(1996, 8, 2).getTime();
// Date toDate = new GregorianCalendar(2006, 4, 25).getTime();
//
// DepartmentEmployeeService departmentEmployeeService = new DepartmentEmployeeService();
// assertTrue(departmentEmployeeService.add(empNo, deptNo, fromDate, toDate));
// }
@Test
public void testingDepartmentManagerView() {
int empNo = 110022;
String deptNo = "d001";
Date fromDate = new GregorianCalendar(1985, 0, 1).getTime();
Date toDate = new GregorianCalendar(1991, 9, 1).getTime();
DepartmentManager firstDepartmentManager = new DepartmentManager.Builder(empNo,
deptNo,
fromDate,
toDate).build();
empNo = 111939;
deptNo = "d009";
fromDate = new GregorianCalendar(1996, 0, 3).getTime();
toDate = new GregorianCalendar(9999, 0, 1).getTime();
DepartmentManager lastDepartmentManager = new DepartmentManager.Builder(empNo,
deptNo,
fromDate,
toDate).build();
DepartmentManagerService departmentManagerService = new DepartmentManagerService();
List<DepartmentManager> departmentManagers = departmentManagerService.view();
assertTrue(departmentManagers.size() == departmentManagerService.viewCount());
assertTrue(departmentManagers.contains(firstDepartmentManager));
assertTrue(departmentManagers.contains(lastDepartmentManager));
}
}
| [
"Riccio.peacenlove@gmail.com"
] | Riccio.peacenlove@gmail.com |
e85585646e02be88ff671a76762163814fcd3e56 | ce159acffe95457f43a578c18cf7cf8338736d24 | /area/MaxRectangleInHistogram.java | 06d7c20ce381935eeea2cae7d5ab0a91a7476867 | [] | no_license | yzsxjhft/alg | f09c6095b698bfbe355c6f532eb93d1ea7516570 | 9117ebdeaf3a7a37df2b8cb7e87b5f87e6c62e63 | refs/heads/master | 2020-06-17T05:34:15.760732 | 2019-08-17T15:49:13 | 2019-08-17T15:49:13 | 195,814,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,040 | java | import java.util.Stack;
public class MaxRectangleInHistogram {
public static void main(String[] args) {
int[] gram = {2, 1, 5, 6, 2, 3};
System.out.println(new MaxRectangleInHistogram().largest3(gram));
}
public int largest1(int[] heights) {
int num = heights.length;
int res = 0;
for (int i=0; i<num; i++) {
int h = heights[i];
for (int j=i; j<num; j++) {
h = Math.min(h, heights[j]);
res = Math.max(res, (j-i+1)*h);
}
}
return res;
}
public int largest2(int[] heights) {
int len = heights.length;
int[] leftMin = new int[len];
int[] rightMin = new int[len];
for (int i=0; i<len; i++) {
int j = i-1;
while (j>=0 && heights[j] >= heights[i]) j--;
leftMin[i] = j;
j = i+1;
while (j<len && heights[j] >= heights[i]) j++;
rightMin[i] = j;
}
int area = 0;
for (int i=0; i<len; i++) {
int tmp = (rightMin[i] - leftMin[i] - 1) * heights[i];
area = Math.max(area, tmp);
}
return area;
}
public int largest3(int[] heights) {
int len = heights.length;
Stack<Integer> stack = new Stack<>();
int p = 0;
int area = 0;
while (p < len) {
if (stack.isEmpty() || heights[p] >= heights[stack.peek()]) {
stack.push(p++);
} else {
int topIndex = stack.pop();
int leftMin = stack.isEmpty()?-1:stack.peek();
int rightMin = p;
area = Math.max(area, (rightMin-leftMin-1)*heights[topIndex]);
}
}
while (!stack.isEmpty()) {
int topIndex = stack.pop();
int leftMin = stack.isEmpty()?-1:stack.peek();
int rightMin = len;
area = Math.max(area, (rightMin-leftMin-1)*heights[topIndex]);
}
return area;
}
}
| [
"="
] | = |
5963b19d5d494b72669902f9f488036affb9e13d | 16d88eba1992531099d34ee3abf000fc883b1580 | /chapter_009/crud/src/main/java/aoleynikov/servlets/service/Service.java | 2826fe9ac37278899f7e211cbfb9081422e8198e | [
"Apache-2.0"
] | permissive | misterflud/aoleynikov | 14b5cfab275da7ca713ee24241eaa1e36f2396ef | c90891629b6868c8f0c7c19edfb627c29228bd67 | refs/heads/master | 2021-01-11T23:55:24.395578 | 2018-12-24T18:00:28 | 2018-12-24T18:00:28 | 78,645,246 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,425 | java | package aoleynikov.servlets.service;
import java.awt.List;
import java.util.ArrayList;
import aoleynikov.servlets.model.AnonUser;
import aoleynikov.servlets.model.BaseUser;
import aoleynikov.servlets.dao.ConnectionWithDataBaseDao;
import aoleynikov.servlets.model.User;
/**
* Service class.
* @author Anton Oleynikov
* created on 30.11.2017
*/
public class Service {
/**
* Service for get user.
* @param user user
* @return
*/
public BaseUser get(BaseUser user) {
return new ConnectionWithDataBaseDao().getUser(user);
}
/**
* Service for get all users.
* @return list
*/
public ArrayList<BaseUser> getAll() {
return new ConnectionWithDataBaseDao().getAll();
}
/**
* Service for add user.
* @param user user
*/
public void addUser(BaseUser user) {
new ConnectionWithDataBaseDao().createUser(user);
}
/**
* Service for authentication user.
* @param user user
* @return boolean
*/
public boolean authUser(AnonUser user) {
return new ConnectionWithDataBaseDao().authUser(user);
}
/**
* Service for deletes user.
* @param user user
*/
public void deleteUser(BaseUser user) {
new ConnectionWithDataBaseDao().deleteUser(user);
}
/**
* Service for edit user.
* @param editUser
*/
public void editUser(BaseUser editUser) {
new ConnectionWithDataBaseDao().editUser(editUser);
}
}
| [
"yurolejniko@yandex.ru"
] | yurolejniko@yandex.ru |
c7c43fd10b02859e30eb6b8e8907bb6ee11649f4 | 6d7740b891f836d706a6a122a0efd6f553bd6b1c | /src/main/java/com/cskaoyan/mallSpringboot/renguopingVO/ResponseVo.java | 9ea97b6cd9136b196d155620faa3caa726f2b881 | [] | no_license | SongChina/project_mall | 119c5d198e71269e20833ce90a925b6203077393 | 68f15ac52f9a905c0ea9d84b4e3d4fe3d8fbd173 | refs/heads/master | 2022-10-26T14:31:21.769757 | 2019-07-12T03:34:37 | 2019-07-12T03:34:37 | 194,968,402 | 2 | 0 | null | 2022-10-12T20:28:51 | 2019-07-03T02:51:52 | Java | UTF-8 | Java | false | false | 533 | java | package com.cskaoyan.mallSpringboot.renguopingVO;
public class ResponseVo {
int errno;
Object data;
String errmsg;
public int getErrno() {
return errno;
}
public void setErrno(int errno) {
this.errno = errno;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmas) {
this.errmsg = errmas;
}
}
| [
"815443129@qq.com"
] | 815443129@qq.com |
b9e93bcd31cc7efce53d0923b3ed9bf04fa8cd27 | a407678d9973a09183ca556b54d9d35cd7a2b765 | /src/minecraft/java/org/darkstorm/darkbot/minecraftbot/ai/BlockBreakActivity.java | d29bae506a041b4ca41a7e35ce1eab323382ccf5 | [
"BSD-2-Clause"
] | permissive | dahquan1/DarkBot | d4920b6f196e9b5a8bffe1adcfe150abc7e88d50 | 09ff65b67060486eaa723a68e3faf4a6296a194c | refs/heads/master | 2020-12-25T04:17:12.624939 | 2014-03-04T21:02:02 | 2014-03-04T21:02:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,992 | java | package org.darkstorm.darkbot.minecraftbot.ai;
import org.darkstorm.darkbot.minecraftbot.MinecraftBot;
import org.darkstorm.darkbot.minecraftbot.protocol.ConnectionHandler;
import org.darkstorm.darkbot.minecraftbot.protocol.bidirectional.*;
import org.darkstorm.darkbot.minecraftbot.protocol.bidirectional.Packet18Animation.Animation;
import org.darkstorm.darkbot.minecraftbot.protocol.writeable.*;
import org.darkstorm.darkbot.minecraftbot.world.World;
import org.darkstorm.darkbot.minecraftbot.world.block.*;
import org.darkstorm.darkbot.minecraftbot.world.entity.MainPlayerEntity;
public class BlockBreakActivity implements Activity {
private final MinecraftBot bot;
private BlockLocation location;
private int lastId, timeout, wait;
public BlockBreakActivity(MinecraftBot bot, BlockLocation location) {
this(bot, location, 10 * 20);
}
public BlockBreakActivity(MinecraftBot bot, BlockLocation location, int timeout) {
this.location = location;
lastId = bot.getWorld().getBlockIdAt(location);
this.bot = bot;
int x = location.getX(), y = location.getY(), z = location.getZ();
MainPlayerEntity player = bot.getPlayer();
World world = bot.getWorld();
if(player == null)
return;
int face = getBreakBlockFaceAt(location);
if(face == -1)
return;
player.face(x + 0.5, y + 0.5, z + 0.5);
int idAbove = world.getBlockIdAt(x, y + 1, z);
if(idAbove == 12 || idAbove == 13)
wait = 30;
ConnectionHandler connectionHandler = bot.getConnectionHandler();
player.switchTools(BlockType.getById(world.getBlockIdAt(location)).getToolType());
connectionHandler.sendPacket(new Packet12PlayerLook((float) player.getYaw(), (float) player.getPitch(), true));
connectionHandler.sendPacket(new Packet18Animation(player.getId(), Animation.SWING_ARM));
connectionHandler.sendPacket(new Packet14BlockDig(0, x, y, z, face));
connectionHandler.sendPacket(new Packet14BlockDig(2, x, y, z, face));
this.timeout = timeout;
}
@Override
public void run() {
if(timeout > 0) {
if(lastId != bot.getWorld().getBlockIdAt(location))
timeout = 1;
timeout--;
} else if(wait > 0)
wait--;
}
@Override
public boolean isActive() {
return timeout > 0 || wait > 0;
}
@Override
public void stop() {
wait = 0;
timeout = 0;
}
private int getBreakBlockFaceAt(BlockLocation location) {
int x = location.getX(), y = location.getY(), z = location.getZ();
World world = bot.getWorld();
if(isEmpty(world.getBlockIdAt(x - 1, y, z)))
return 4;
else if(isEmpty(world.getBlockIdAt(x, y, z + 1)))
return 3;
else if(isEmpty(world.getBlockIdAt(x, y, z - 1)))
return 2;
else if(isEmpty(world.getBlockIdAt(x, y + 1, z)))
return 1;
else if(isEmpty(world.getBlockIdAt(x, y - 1, z)))
return 0;
else if(isEmpty(world.getBlockIdAt(x + 1, y, z)))
return 5;
return -1;
}
private boolean isEmpty(int id) {
BlockType type = BlockType.getById(id);
return !type.isSolid() && !type.isInteractable() && !type.isPlaceable();
}
}
| [
"darkstorm@evilminecraft.net"
] | darkstorm@evilminecraft.net |
adc0c558756eabea5abbf1e7617cb57ab4d876a4 | 9a7446fb587ed3640b7ae5fc68034bce464fb3aa | /src/main/java/sms/ApiWhatsApp.java | d6e32e7fc6da6733318008fdee86b56aa3cd5344 | [] | no_license | ortoni/February | cab9b96fabe8766386a1adb978da4701ae5e4ae9 | cbbfc62efef7da85d885a15bcedf0296eb7e1453 | refs/heads/master | 2021-07-02T22:20:29.472251 | 2019-02-08T06:25:25 | 2019-02-08T06:25:25 | 120,718,414 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,172 | java | package sms;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
public class ApiWhatsApp extends ApiWhastsAppBuilder {
@Test(dataProvider = "whatsAppApi")
public void postJob(String phoneNumber, String msg) throws InterruptedException {
driver.get("https://api.whatsapp.com/send?phone=91" + phoneNumber + "&text=" + msg);
System.out.println(phoneNumber);
// To navigate to next contact
try {
Thread.sleep(250);
waitTillAlertDiasable();
} catch (Exception e) {
}
// Click on SEND Link
try {
Thread.sleep(100);
WebElement send = driver.findElementByLinkText("SEND");
waitAndClick(send);
} catch (Exception e1) {
}
// Disabled for performance
// If number is not available in WhatsApp!
/*try {
WebElement numberNotAvail = driver.findElementByXPath(
"//div[text()='Phone number shared via url is invalid.']/following::div[1]/div");
waitAndClick(numberNotAvail);
} catch (Exception e2) {
}*/
try {
WebElement sendButton = driver.findElementByXPath("//span[@data-icon='send']/..");
waitAndClick(sendButton);
} catch (Exception e) {
}
}
}
| [
"koushik350@gmail.com"
] | koushik350@gmail.com |
f65bcabbd2b5c3d55573df681a77a30b366ae790 | 69eba0d52d1b0a4c866e65417607436f06e0467b | /FormHttpSession/src/FirstServlet.java | a2862215f58dda5e5d03aaeb8f91287b04ee9ba3 | [] | no_license | samsnisar/httpsession | f044b969604e7ae4d96f3b40b5112ef99f23fffb | 1a7f54f7eb14f868092b6279b8001dcd7c131449 | refs/heads/master | 2020-07-31T01:51:28.522161 | 2019-09-23T19:55:04 | 2019-09-23T19:55:04 | 210,440,339 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,163 | java |
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class FirstServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public FirstServlet() {
super();
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String s1=request.getParameter("t1");
String s2=request.getParameter("t2");
HttpSession session=request.getSession();
session.setAttribute("name", s1);
session.setAttribute("email", s2);
PrintWriter pw=response.getWriter();
pw.println("<form action='SecondServlet' method='post'>");
pw.println("Name:<input type='text' name='t3'><br><br>");
pw.println("City:<input type='text' name='t4'><br><br>");
pw.println("Age:<input type='text' name='t5'><br><br>");
pw.println("<input type='submit'><br><br>");
pw.println("</form>");
}
}
| [
"noreply@github.com"
] | samsnisar.noreply@github.com |
2d2f6010f21392ea1203893d29a1334b511ec885 | 03437c87f7ac8cdf14f7869e836e36c2a62707b6 | /src/fr/football/pojos/Stade.java | 7617256a0de4d2ac197ea75af8267fd8c282228f | [] | no_license | shady-ladow/projectFootball | bcf125ac8aa24113e4083ab456b889a46d1cb66f | b9ed3270e4a005272979da27ed2b2d12915fea19 | refs/heads/master | 2020-03-11T08:09:46.531203 | 2018-04-17T09:20:01 | 2018-04-17T09:20:01 | 129,875,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 51 | java | package fr.football.pojos;
public class Stade {
}
| [
"shady.sweetshop@gmail.com"
] | shady.sweetshop@gmail.com |
bfeb8d0b22085ecfb8c56ff475eab0cf734ef333 | 897ac101cda331d4b849bf46f1a19bc60b5ac6d1 | /src/com/murphy/mvc/HandlerMapping.java | a11debda147de4db0442f78f2740d9ca98ffa0ab | [] | no_license | tanbinh123/ExpressManage | 7e9ddad7eef42a989c07f4985fb62be9b3ae57f7 | a6ef5ac61405d9d6ee47007e3e69a90e896a84ee | refs/heads/master | 2023-07-09T12:24:11.182710 | 2021-08-17T12:55:49 | 2021-08-17T12:55:49 | 476,792,970 | 1 | 0 | null | 2022-04-01T16:24:57 | 2022-04-01T16:24:56 | null | UTF-8 | Java | false | false | 3,830 | java | package com.murphy.mvc;
import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
/**
* 映射器(包含了大量的网址与方法的对应关系)
* @author murphy
*/
public class HandlerMapping {
private static Map<String,MVCMapping> data = new HashMap<>();
public static MVCMapping get(String uri){
return data.get(uri);
}
public static void load(InputStream is ){
Properties ppt = new Properties();
try {
ppt.load(is);
} catch (IOException e) {
e.printStackTrace();
}
//获取配置文件中描述的一个个的类
Collection<Object> values = ppt.values();
for (Object cla:values) {
String className = (String) cla;
try {
//加载配置文件中描述的每一个类
Class c = Class.forName(className);
//创建这个类的对象
Object obj = c.getConstructor().newInstance();
//获取这个类的所有方法
Method[] methods = c.getMethods();
for (Method m:methods) {
Annotation[] as = m.getAnnotations();
if(as != null){
for(Annotation annotation:as){
if(annotation instanceof ResponseBody){
//说明此方法,用于返回字符串给客户端
MVCMapping mapping = new MVCMapping(obj,m,ResponseType.TEXT);
Object o = data.put(((ResponseBody) annotation).value(),mapping);
if(o != null){
//存在了重复的请求地址
throw new RuntimeException("请求地址重复:"+((ResponseBody) annotation).value());
}
}else if(annotation instanceof ResponseView){
//说明此方法,用于返回界面给客户端
MVCMapping mapping = new MVCMapping(obj,m,ResponseType.VIEW);
Object o = data.put(((ResponseView) annotation).value(),mapping);
if(o != null){
//存在了重复的请求地址
throw new RuntimeException("请求地址重复:"+((ResponseView) annotation).value());
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 映射对象,每一个对象封装了一个方法,用于处理请求
*/
public static class MVCMapping{
private Object obj;
private Method method;
private ResponseType type;
public MVCMapping() {
}
public MVCMapping(Object obj, Method method, ResponseType type) {
this.obj = obj;
this.method = method;
this.type = type;
}
public Object getObj() {
return obj;
}
public void setObj(Object obj) {
this.obj = obj;
}
public Method getMethod() {
return method;
}
public void setMethod(Method method) {
this.method = method;
}
public ResponseType getType() {
return type;
}
public void setType(ResponseType type) {
this.type = type;
}
}
}
| [
"631341307@qq.com"
] | 631341307@qq.com |
8f97e2bbf3f3ccaea3a8ef8826f141168bf6b2ff | 2d0012008ecb0641b795482a88def8550f25da8b | /src/main/java/eke/Modell/Szamla/SzamlaBuilderImpl.java | c2778228ebf90e80c0e14393575cdb9676b3ac54 | [] | no_license | bencespinter/PT_2021 | d981b2d4c0e9065b261dfa99d1792211823e44cf | 2463c5ac2bae6b20cf1ffb9fdb1100b955bd3c97 | refs/heads/main | 2023-06-01T07:20:13.049424 | 2021-06-23T06:51:08 | 2021-06-23T06:51:08 | 379,506,940 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | package eke.Modell.Szamla;
import ProgTech.Model.RendelesLista.RendelesListaElem;
import ProgTech.Model.Vevo;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
public class SzamlaBuilderImpl implements SzamlaBuilder {
List<Map> szamlaelemek = new ArrayList<Map>();
@Override
public SzamlaBuilder fejlecHozzaad(Vevo vevo) {
//...
return this;
}
@Override
public SzamlaBuilder törzsreszHozzaad(List<RendelesListaElem> rendeles) {
//...
return this;
}
@Override
public SzamlaBuilder fizetesiHataridoHozzaad(Date datum) {
//...
return this;
}
@Override
public Szamla Build() {
return new Szamla(szamlaelemek);
}
}
| [
"pinter.bence.sandor@gmail.com"
] | pinter.bence.sandor@gmail.com |
e76c839bbed124f612856876ce3f55699d779b1b | 9800a8d54a4657985d5b2fbd70851dbc492300e2 | /search/BreadthFirstFrontier.java | 6d46a2cbb2a4c2283c7595a50821c69e0f59a515 | [] | no_license | HenryPearson2001/AISearchingAlgorithms | eafb4ab9cee3048cbed74f4c097cd0a5ed7a8059 | 8e7c4faf8fe82957a55a16ba143c3d586e07ea67 | refs/heads/main | 2023-03-18T06:55:21.784686 | 2021-03-11T11:38:13 | 2021-03-11T11:38:13 | 339,764,234 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 946 | java | package search;
import java.util.Queue;
import java.util.LinkedList;
public class BreadthFirstFrontier implements Frontier {
private Queue<Node> frontier = new LinkedList<Node>();
private int totalNodes = 0;
private int maxStored = 0;
public void addNode(Node node) {
totalNodes += 1;
if (frontier.size() > maxStored) {
maxStored = frontier.size();
}
this.frontier.add(node);
}
public void clearContents() {
this.frontier.clear();
}
public boolean isEmpty() {
return this.frontier.isEmpty();
}
public Node remove() {
return this.frontier.poll();
}
// methods for tracking efficiency
public int getTotalNodes() {
return this.totalNodes;
}
public int getMaxStored() {
return this.maxStored;
}
public void resetCounts() {
this.totalNodes = 0;
this.maxStored = 0;
}
} | [
"pearsonhenryj@icloud.com"
] | pearsonhenryj@icloud.com |
1c2ab68b1ba317de38d3ec1407ca8e39fc626774 | ca688b8ecf8012835dd00dde86473912bf9281fd | /src/main/java/com/dimple/framework/config/KaptchaConfig.java | 0fc2261fcc781fb4c35fc83208b0790e1f0c14a1 | [] | no_license | y1024/DimpleBlog | 777d569c670355d66a5e6e197f8dd5296866591d | efd09bc3462105c122b010ac64eaaacea37fb6a1 | refs/heads/master | 2020-04-29T02:02:52.955668 | 2019-02-26T09:12:39 | 2019-02-26T09:12:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,570 | java | package com.dimple.framework.config;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Properties;
/**
* @ClassName: KaptchaConfig
* @Description: 验证码插件配置
* @Auther: Owenb
* @Date: 11/30/18 9:39
* @Version: 1.0
*/
@Configuration
public class KaptchaConfig {
/**
* 生成字符的验证码图片
*
* @return
*/
@Bean(name = "kaptchaCharacterImage")
public DefaultKaptcha getKaptchaBean() {
DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
Properties properties = new Properties();
// 是否有边框 默认为true 我们可以自己设置yes,no
properties.setProperty("kaptcha.border", "yes");
// 边框颜色 默认为Color.BLACK
properties.setProperty("kaptcha.border.color", "105,179,90");
// 验证码文本字符颜色 默认为Color.BLACK
properties.setProperty("kaptcha.textproducer.font.color", "blue");
// 验证码图片宽度 默认为200
properties.setProperty("kaptcha.image.width", "160");
// 验证码图片高度 默认为50
properties.setProperty("kaptcha.image.height", "60");
// 验证码文本字符大小 默认为40
properties.setProperty("kaptcha.textproducer.font.size", "30");
// KAPTCHA_SESSION_KEY
properties.setProperty("kaptcha.session.key", "kaptchaCode");
// 验证码文本字符间距 默认为2
properties.setProperty("kaptcha.textproducer.char.space", "3");
// 验证码文本字符长度 默认为5
properties.setProperty("kaptcha.textproducer.char.length", "5");
// 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize)
properties.setProperty("kaptcha.textproducer.font.names", "Arial,Courier");
// 验证码噪点颜色 默认为Color.BLACK
properties.setProperty("kaptcha.noise.color", "white");
Config config = new Config(properties);
defaultKaptcha.setConfig(config);
return defaultKaptcha;
}
/**
* 生成数字计算的验证码
*
* @return
*/
@Bean(name = "kaptchaMathImage")
public DefaultKaptcha getKaptchaBeanMath() {
DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
Properties properties = new Properties();
// 是否有边框 默认为true 我们可以自己设置yes,no
properties.setProperty("kaptcha.border", "yes");
// 边框颜色 默认为Color.BLACK
properties.setProperty("kaptcha.border.color", "105,179,90");
// 验证码文本字符颜色 默认为Color.BLACK
properties.setProperty("kaptcha.textproducer.font.color", "blue");
// 验证码图片宽度 默认为200
properties.setProperty("kaptcha.image.width", "160");
// 验证码图片高度 默认为50
properties.setProperty("kaptcha.image.height", "60");
// 验证码文本字符大小 默认为40
properties.setProperty("kaptcha.textproducer.font.size", "35");
// KAPTCHA_SESSION_KEY
properties.setProperty("kaptcha.session.key", "kaptchaCodeMath");
// 验证码文本生成器
properties.setProperty("kaptcha.textproducer.impl", "com.dimple.utils.KaptchaMathCreater");
// 验证码文本字符间距 默认为2
properties.setProperty("kaptcha.textproducer.char.space", "3");
// 验证码文本字符长度 默认为5
properties.setProperty("kaptcha.textproducer.char.length", "6");
// 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize)
properties.setProperty("kaptcha.textproducer.font.names", "Arial,Courier");
// 验证码噪点颜色 默认为Color.BLACK
properties.setProperty("kaptcha.noise.color", "white");
// 干扰实现类
properties.setProperty("kaptcha.noise.impl", "com.google.code.kaptcha.impl.NoNoise");
// 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy
properties.setProperty("kaptcha.obscurificator.impl", "com.google.code.kaptcha.impl.ShadowGimpy");
Config config = new Config(properties);
defaultKaptcha.setConfig(config);
return defaultKaptcha;
}
}
| [
"bianxiaofeng@sohu.com"
] | bianxiaofeng@sohu.com |
ae85d02088d90591e8eb49ec3de3d2465a8be1f4 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XRENDERING-481-1-2-FEMO-WeightedSum:TestLen:CallDiversity/org/xwiki/rendering/internal/macro/toc/TreeParametersBuilder_ESTest_scaffolding.java | 17b6de73b8e4f81948332cc9e5d1242e433ad501 | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,223 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Sat Apr 04 12:30:40 UTC 2020
*/
package org.xwiki.rendering.internal.macro.toc;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class TreeParametersBuilder_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.xwiki.rendering.internal.macro.toc.TreeParametersBuilder";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(TreeParametersBuilder_ESTest_scaffolding.class.getClassLoader() ,
"org.xwiki.rendering.internal.macro.toc.TreeParametersBuilder",
"org.xwiki.rendering.block.match.BlockMatcher",
"org.xwiki.rendering.block.AbstractBlock",
"org.xwiki.rendering.block.MacroBlock",
"org.xwiki.rendering.block.XDOM",
"org.xwiki.rendering.macro.toc.TocMacroParameters",
"org.xwiki.rendering.internal.macro.toc.TreeParameters",
"org.xwiki.rendering.block.match.BlockNavigator$1",
"org.xwiki.rendering.block.BlockFilter",
"org.xwiki.rendering.block.Block$Axes",
"org.xwiki.rendering.block.CompatibilityBlock",
"org.xwiki.rendering.listener.ImageListener",
"org.xwiki.rendering.block.match.BlockNavigator",
"org.xwiki.rendering.block.Block",
"org.xwiki.rendering.transformation.MacroTransformationContext",
"org.xwiki.rendering.syntax.Syntax",
"org.xwiki.rendering.transformation.Transformation",
"org.xwiki.rendering.macro.toc.TocMacroParameters$Scope",
"org.xwiki.rendering.listener.LinkListener",
"org.xwiki.rendering.block.match.ClassBlockMatcher",
"org.xwiki.rendering.block.SectionBlock",
"org.xwiki.rendering.transformation.TransformationContext",
"org.xwiki.rendering.listener.Listener",
"org.xwiki.rendering.block.MetaDataBlock"
);
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
303d7ce1b54a322396b68bd8eae9e5d530833fa6 | 66a1d9ed43a765d406bf8a8fd6dfdaa52c3d1cd6 | /HelloWorld.java | 15dc357ccbfaff9263ad7c4b99e157ca58938930 | [] | no_license | SukruthiMS/Java_prog | a728cca9851c56562392259d7ac409891ad5116c | 0e6818632e618fa293cd84cc245fa716c6b99fcd | refs/heads/master | 2022-12-05T18:53:07.067889 | 2020-08-29T18:36:51 | 2020-08-29T18:36:51 | 285,751,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 128 | java | public class HelloWorld{
public static void main(String[] args)
{
String a="Hello";
System.out.println(a +" World");
}
}
| [
"noreply@github.com"
] | SukruthiMS.noreply@github.com |
9aebf073e57c959505fb23536d17a5da98074a71 | d0a15eadc3f661cf9cd19eefecfa012046198392 | /src/main/java/com/rolandoramirezx/barbershopserver/barbershopserver/config/WebSecurityConfig.java | d0dcdc73a6b29e2ea3fdd5a0dc1fd180279f7c0b | [] | no_license | rolandoramirezx/barbershop-server | 8488c21002583a01c528207c5d15917c29fcb1b5 | a9389960789a908208e30a856f38debe79bc866c | refs/heads/master | 2021-04-28T03:58:39.256411 | 2018-02-22T01:08:08 | 2018-02-22T01:08:08 | 122,151,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,130 | java | package com.rolandoramirezx.barbershopserver.barbershopserver.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().permitAll();
http.csrf().disable();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");
}
}
| [
"rolando.ramirezx@gmail.com"
] | rolando.ramirezx@gmail.com |
19cb583bf6d0287e889f272cf5ad58169525f11e | f4131871f87f10dae873867c989be944f7799e85 | /metro-ccms/ccms-web/src/main/java/com/metro/ccms/web/model/utils/JexlEngineUtils.java | 382188e403a9f2e55d25c16ce321637749cd3fbd | [
"MIT"
] | permissive | Twisted928/Metro | 134ff9876306523dd133efd4ce2e38057ba5d8d9 | ecb4495934265f7f2ce460801a6c3edfc3a3deaa | refs/heads/master | 2023-06-22T23:34:48.666044 | 2021-05-25T18:40:48 | 2021-05-25T18:40:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 650 | java | package com.metro.ccms.web.model.utils;
import org.apache.commons.jexl2.*;
/**
* @author :yuanjh
* @description:表达式引擎
* @modified By:
* @version: 1.0
*/
public class JexlEngineUtils {
private static final JexlEngine ENGINE = new JexlEngine();
private JexlEngineUtils() {
}
private static JexlEngine getJexlEngine() {
return ENGINE;
}
public static Expression createExpression(String expressionStr) {
ENGINE.setStrict(true);
return ENGINE.createExpression(expressionStr);
}
public static UnifiedJEXL createUjexl() {
return new UnifiedJEXL(ENGINE);
}
}
| [
"1349762764@qq.com"
] | 1349762764@qq.com |
cbbd19b1186e4d85b37e7c0648b0dc73c3973706 | 6a9c11a35caa24ef286788d175e08f4e630e05b6 | /src/StatePattern/GumballMachine.java | 119a84a755ab9f510a53a5dcbff89868f339965d | [] | no_license | Novjoon/DesignPattern | 283ef84ac4b3c98b5ac84f397930f56217df0844 | d284c4a35813c8f89c4fe3ec5a6a96b6fc458fef | refs/heads/master | 2020-09-12T00:43:11.259377 | 2019-12-27T04:53:45 | 2019-12-27T04:53:45 | 222,244,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,375 | java | package StatePattern;
public class GumballMachine {
final static int SOLD_OUT = 0;
final static int NO_QUARTER = 1;
final static int HAS_QUARTER = 2;
final static int SOLD = 3;
int state = SOLD_OUT;
static int count = 10;
public GumballMachine(int count) {
this.count = count;
if (count > 0) {
state = NO_QUARTER;
}
}
public void insertQuarter() {
if (state == HAS_QUARTER) {
System.out.println("동전은 한 개만 넣어주세요");
} else if (state == SOLD_OUT) {
System.out.println("매진되었습니다. 다음 기회에 이용해주세요");
} else if (state == SOLD) {
System.out.println("잠깐만 기다려 주세요. 알맹이가 배출되고 있습니다");
} else if (state == NO_QUARTER) {
state = HAS_QUARTER;
System.out.println("동전이 투입되었습니다");
}
}
public void ejectQuarter() {
if (state == HAS_QUARTER) {
System.out.println("동전이 반환됩니다");
state = NO_QUARTER;
} else if (state == NO_QUARTER) {
System.out.println("동전을 넣어주세요");
} else if (state == SOLD) {
System.out.println("이미 알맹이를 뽑으셨습니다");
} else if (state == SOLD_OUT) {
System.out.println("동전을 넣지 않으셨습니다. 동전이 반환되지 않습니다");
}
}
public void turnCrank() {
if (state == SOLD) {
System.out.println("손잡이는 한 번만 돌려주세요");
} else if (state == NO_QUARTER) {
System.out.println("동전을 넣어주세요");
} else if (state == SOLD_OUT) {
System.out.println("매진되었습니다");
} else if (state == HAS_QUARTER) {
System.out.println("손잡이를 돌리셨습니다");
state = SOLD;
dispense();
}
}
public void dispense() {
if (state == SOLD) {
System.out.println("알맹이가 나가고 있습니다");
//count = count – 1;
if (count == 0) {
System.out.println("더 이상 알맹이가 없습니다");
state = SOLD_OUT;
} else {
state = NO_QUARTER;
}
} else if (state == NO_QUARTER) {
System.out.println("동전을 넣어주세요");
} else if (state == SOLD_OUT) {
System.out.println("매진입니다");
} else if (state == HAS_QUARTER) {
System.out.println("알맹이가 나갈 수 없습니다");
}
}
// 기타 메소드
}
| [
"Lion.novjoon@gmail.com"
] | Lion.novjoon@gmail.com |
c54f6829c1ef0fe6205680c0548ef5b03905e0ca | d545fa5467636a274fc72543508ff48414d4189e | /app/src/main/java/com/example/proekt/ReservationConfirmation.java | 3385f253630b901e27030d86d5a8dc9ab0361ed8 | [] | no_license | nikolanenchev-rldatix/proekt | f630113b84efd9fac806cbaf8453eef3e9b1c023 | 293c4f281c47d7689b44ca32ed23bf0e3872e8cb | refs/heads/master | 2023-02-09T07:51:45.982426 | 2020-12-27T21:29:35 | 2020-12-27T21:29:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,004 | java | package com.example.proekt;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Fragment;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import org.w3c.dom.Text;
public class ReservationConfirmation extends AppCompatActivity {
String city = "";
String date = "";
String hour = "";
String user = "";
String park = "";
DBHelper db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reservation_confirmation);
db = new DBHelper(this);
if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){
Fragment frag1 = getFragmentManager().findFragmentById(R.id.fragment1);
Fragment frag3 = getFragmentManager().findFragmentById(R.id.fragment3);
}else{
Fragment frag1 = getFragmentManager().findFragmentById(R.id.fragment1);
Fragment frag2 = getFragmentManager().findFragmentById(R.id.fragment2);
}
Bundle extras = getIntent().getExtras();
if(extras != null){
city = extras.getString("city");
user = extras.getString("user");
hour = extras.getString("hour");
date = extras.getString("date");
park = extras.getString("park");
}
TextView citytext = (TextView) findViewById(R.id.cityconf);
TextView parktext = (TextView) findViewById(R.id.parkconf);
TextView datetext = (TextView) findViewById(R.id.dateconf);
TextView timetext = (TextView) findViewById(R.id.hourconf);
TextView park2 = findViewById(R.id.help);
citytext.setText(city);
parktext.setText(park);
datetext.setText(date);
timetext.setText(hour);
park2.setText(park);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
getMenuInflater().inflate(R.menu.my_menu,menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
Intent intent = new Intent(this, MyReservations.class);
startActivity(intent);
return true;
}
public void functionConfirm(View v){
final Button confirm = findViewById(R.id.potvrda);
confirm.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
Boolean insert = db.insertReservation(user, city, park, date, hour);
if (insert == true) {
Toast.makeText(getApplicationContext(), "Your reservation has been successfully made! ", Toast.LENGTH_SHORT).show();
}
}
});
}
} | [
"nikolanencev1@gmail.com"
] | nikolanencev1@gmail.com |
64b0573e9e42d18ab19c63981bafa9f426154f3e | 1f8579ab8d126d829658d711ff23f478554f5503 | /src/main/java/at/ac/tuwien/inso/indoor/sensorserver/services/analysis/GraphCreator.java | e29f5fa50e439a28807086ee9a583bc4565865e0 | [] | no_license | IanMadlenya/indoor-positioning | 23aa6990409ce15dbd165d7071717881ce8590e0 | 0eb73cef1f50ece5d839ef7f0ae0176f47c3429b | refs/heads/master | 2021-04-06T19:57:02.829089 | 2016-10-08T20:47:06 | 2016-10-08T20:47:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 155 | java | package at.ac.tuwien.inso.indoor.sensorserver.services.analysis;
/**
* Created by PatrickF on 03.10.2014.
*/
@Deprecated
public class GraphCreator {
}
| [
"patrick.favre@rise-world.com"
] | patrick.favre@rise-world.com |
138ae8a3efae732f15c73e3da75a1c5f32779b65 | 9c6dd956ab30bde4f21a9881f066b0bea22c9986 | /sms-api/src/main/java/com/sms/api/vo/UserVo.java | 3dd32c47f1178a7a8f78f7ae5ceb4739cdb3f207 | [] | no_license | xingguov587/sms | e863ea5536110db2d30ed55b3ac352637be3dce2 | c2607672c4e57236fd712fac620ab032add1913c | refs/heads/master | 2023-04-24T19:12:21.925104 | 2021-05-19T11:52:26 | 2021-05-19T11:52:26 | 356,877,039 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,611 | java | package com.sms.api.vo;
import com.sms.api.request.Page;
public class UserVo extends Page {
private Integer id;
private Integer roleId;
private Integer pid;
private String nickName;
private Integer sex;
private String sno;
private String job;
private String headImg;
private String phone;
private Integer grade;
private String email;
private String passWord;
private Integer creator;
private Integer reviser;
private String dataStatus;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public Integer getPid() {
return pid;
}
public void setPid(Integer pid) {
this.pid = pid;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public String getSno() {
return sno;
}
public void setSno(String sno) {
this.sno = sno;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}
public String getHeadImg() {
return headImg;
}
public void setHeadImg(String headImg) {
this.headImg = headImg;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Integer getGrade() {
return grade;
}
public void setGrade(Integer grade) {
this.grade = grade;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassWord() {
return passWord;
}
public void setPassWord(String passWord) {
this.passWord = passWord;
}
public Integer getCreator() {
return creator;
}
public void setCreator(Integer creator) {
this.creator = creator;
}
public Integer getReviser() {
return reviser;
}
public void setReviser(Integer reviser) {
this.reviser = reviser;
}
public String getDataStatus() {
return dataStatus;
}
public void setDataStatus(String dataStatus) {
this.dataStatus = dataStatus;
}
}
| [
"1161629819@qq.com"
] | 1161629819@qq.com |
7b36f2c3ef98c2ff4c2504c88fb271f363b4dab5 | 083732248f39a85f0efbe090c3c7b5acb6c97cb4 | /src/ij/plugin/NewPlugin.java | aeb64d3b9a0d8cf1e1e055ef013bd2fe6af0669c | [] | no_license | agubba3/ImageJ_ImageAnalysis | 9be9d544514d685eddcf9ca1b23832cda4f9baed | 88f506f86268de3cbd03ed8453b8e7e8af4dacf1 | refs/heads/master | 2020-05-30T14:38:28.896215 | 2014-12-24T03:37:18 | 2014-12-24T03:37:18 | 28,431,709 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,515 | java | package ij.plugin;
import java.awt.*;
import ij.*;
import ij.gui.*;
import ij.plugin.frame.Editor;
import ij.text.TextWindow;
import ij.io.SaveDialog;
import ij.util.Tools;
/** This class creates a new macro or the Java source for a new plugin. */
public class NewPlugin implements PlugIn {
public static final int MACRO=0, JAVASCRIPT=1, PLUGIN=2, PLUGIN_FILTER=3, PLUGIN_FRAME=4,
TEXT_FILE=5, TABLE=6, MACRO_TOOL=7, PLUGIN_TOOL=8;
private static int rows = 16;
private static int columns = 60;
private static int tableWidth = 350;
private static int tableHeight = 250;
private int type = MACRO;
private String name = "Macro.txt";
private boolean monospaced;
private boolean menuBar = true;
private Editor ed;
public void run(String arg) {
type = -1;
if (arg.startsWith("text")||arg.equals("")) {
type = TEXT_FILE;
name = "Untitled.txt";
} else if (arg.equals("macro")) {
type = MACRO;
name = "Macro.txt";
} else if (arg.equals("macro-tool")) {
type = MACRO_TOOL;
name = "Macro_Tool.txt";
} else if (arg.equals("javascript")) {
type = JAVASCRIPT;
name = "Script.js";
} else if (arg.equals("plugin")) {
type = PLUGIN;
name = "My_Plugin.java";
} else if (arg.equals("frame")) {
type = PLUGIN_FRAME;
name = "Plugin_Frame.java";
} else if (arg.equals("plugin-tool")) {
type = PLUGIN_TOOL;
name = "Prototype_Tool.java";
} else if (arg.equals("filter")) {
type = PLUGIN_FILTER;
name = "Filter_Plugin.java";
} else if (arg.equals("table")) {
String options = Macro.getOptions();
if (IJ.isMacro() && options!=null && options.indexOf("[Text File]")!=-1) {
type = TEXT_FILE;
name = "Untitled.txt";
arg = "text+dialog";
} else {
type = TABLE;
name = "Table";
}
}
menuBar = true;
if (arg.equals("text+dialog") || type==TABLE) {
if (!showDialog()) return;
}
if (type==-1)
createPlugin("Converted_Macro.java", PLUGIN, arg);
else if (type==MACRO || type==MACRO_TOOL || type==TEXT_FILE || type==JAVASCRIPT) {
if (type==TEXT_FILE && name.equals("Macro"))
name = "Untitled.txt";
createMacro(name);
} else if (type==TABLE)
createTable();
else
createPlugin(name, type, arg);
}
public void createMacro(String name) {
int options = (monospaced?Editor.MONOSPACED:0)+(menuBar?Editor.MENU_BAR:0);
String text = "";
ed = new Editor(rows, columns, 0, options);
if (type==MACRO_TOOL)
text = Tools.openFromIJJarAsString("/macros/"+name);
if ((type==MACRO||type==MACRO_TOOL) && !name.endsWith(".txt"))
name = SaveDialog.setExtension(name, ".txt");
else if (type==JAVASCRIPT && !name.endsWith(".js")) {
if (name.equals("Macro")) name = "script";
name = SaveDialog.setExtension(name, ".js");
}
if (text!=null)
ed.create(name, text);
}
void createTable() {
new TextWindow(name, "", tableWidth, tableHeight);
}
public void createPlugin(String name, int type, String methods) {
ed = (Editor)IJ.runPlugIn("ij.plugin.frame.Editor", "");
if (ed==null) return;
String pluginName = name;
if (!(name.endsWith(".java") || name.endsWith(".JAVA")))
name = SaveDialog.setExtension(name, ".java");
String className = pluginName.substring(0, pluginName.length()-5);
String text = "";
if (type==PLUGIN_TOOL) {
text += "// Prototype plugin tool. There are more plugin tools at\n";
text += "// http://imagej.nih.gov/ij/plugins/index.html#tools\n";
}
text += "import ij.*;\n";
text += "import ij.process.*;\n";
text += "import ij.gui.*;\n";
text += "import java.awt.*;\n";
switch (type) {
case PLUGIN:
text += "import ij.plugin.*;\n";
text += "import ij.plugin.frame.*;\n";
text += "\n";
text += "public class "+className+" implements PlugIn {\n";
text += "\n";
text += "\tpublic void run(String arg) {\n";
if (methods.equals("plugin")) {
text += "\t\tImagePlus imp = IJ.getImage();\n";
text += "\t\tIJ.run(imp, \"Invert\", \"\");\n";
text += "\t\tIJ.wait(1000);\n";
text += "\t\tIJ.run(imp, \"Invert\", \"\");\n";
} else
text += methods;
text += "\t}\n";
break;
case PLUGIN_FILTER:
text += "import ij.plugin.filter.*;\n";
text += "\n";
text += "public class "+className+" implements PlugInFilter {\n";
text += "\tImagePlus imp;\n";
text += "\n";
text += "\tpublic int setup(String arg, ImagePlus imp) {\n";
text += "\t\tthis.imp = imp;\n";
text += "\t\treturn DOES_ALL;\n";
text += "\t}\n";
text += "\n";
text += "\tpublic void run(ImageProcessor ip) {\n";
text += "\t\tip.invert();\n";
text += "\t}\n";
break;
case PLUGIN_FRAME:
text += "import ij.plugin.frame.*;\n";
text += "\n";
text += "public class "+className+" extends PlugInFrame {\n";
text += "\n";
text += "\tpublic "+className+"() {\n";
text += "\t\tsuper(\""+className+"\");\n";
text += "\t\tTextArea ta = new TextArea(15, 50);\n";
text += "\t\tadd(ta);\n";
text += "\t\tpack();\n";
text += "\t\tGUI.center(this);\n";
text += "\t\tshow();\n";
text += "\t}\n";
break;
case PLUGIN_TOOL:
text += "import ij.plugin.tool.PlugInTool;\n";
text += "import java.awt.event.*;\n";
text += "\n";
text += "public class "+className+" extends PlugInTool {\n";
text += "\n";
text += "\tpublic void mousePressed(ImagePlus imp, MouseEvent e) {\n";
text += "\t\tIJ.log(\"mouse pressed: \"+e);\n";
text += "\t}\n";
text += "\n";
text += "\tpublic void mouseDragged(ImagePlus imp, MouseEvent e) {\n";
text += "\t\tIJ.log(\"mouse dragged: \"+e);\n";
text += "\t}\n";
text += "\n";
text += "\tpublic void showOptionsDialog() {\n";
text += "\t\tIJ.log(\"icon double-clicked\");\n";
text += "\t}\n";
break;
}
text += "\n";
text += "}\n";
ed.create(pluginName, text);
}
public boolean showDialog() {
String title;
String widthUnit, heightUnit;
int width, height;
if (type==TABLE) {
title = "New Table";
name = "Table";
width = tableWidth;
height = tableHeight;
widthUnit = "pixels";
heightUnit = "pixels";
} else {
title = "New Text Window";
name = "Untitled";
width = columns;
height = rows;
widthUnit = "characters";
heightUnit = "lines";
}
GenericDialog gd = new GenericDialog(title);
gd.addStringField("Name:", name, 16);
gd.addMessage("");
gd.addNumericField("Width:", width, 0, 3, widthUnit);
gd.addNumericField("Height:", height, 0, 3, heightUnit);
if (type!=TABLE) {
gd.setInsets(5, 30, 0);
gd.addCheckbox("Menu Bar", true);
gd.setInsets(0, 30, 0);
gd.addCheckbox("Monospaced Font", monospaced);
}
gd.showDialog();
if (gd.wasCanceled())
return false;
name = gd.getNextString();
width = (int)gd.getNextNumber();
height = (int)gd.getNextNumber();
if (width<1) width = 1;
if (height<1) height = 1;
if (type!=TABLE) {
menuBar = gd.getNextBoolean();
monospaced = gd.getNextBoolean();
columns = width;
rows = height;
if (rows>100) rows = 100;
if (columns>200) columns = 200;
} else {
tableWidth = width;
tableHeight = height;
if (tableWidth<128) tableWidth = 128;
if (tableHeight<75) tableHeight = 75;
}
return true;
}
/** Returns the Editor the newly created macro or plugin was opened in. */
public Editor getEditor() {
return ed;
}
}
| [
"anirudhgubba@gmail.com"
] | anirudhgubba@gmail.com |
0ae7ed753e88224c478e6ef9915b0c6ebcc72c26 | 9860121d29a0f34af1b1ddcdf7dc8037e047f9e4 | /betakendething/src/main/java/com/trimph/everything/ui/view/HomeViewImpl.java | 9a8078174c90b3a166d69a59aadb09edf162f6eb | [] | no_license | triumph20150514/EveryTBeTkend2 | 8271ea0f5f69652fcc46c41b8ecc6459295816aa | 34df4fa57e9be86753bc2a6ab6975dfc68cf5e08 | refs/heads/master | 2021-01-20T04:28:59.208549 | 2017-01-22T03:49:04 | 2017-01-22T03:49:04 | 89,695,078 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,711 | java | package com.trimph.everything.ui.view;
import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.trimph.everything.R;
import com.trimph.everything.base.RootView;
import com.trimph.everything.model.GankItemBean;
import com.trimph.everything.model.SectionVideoInfo;
import com.trimph.everything.model.VideoInfo;
import com.trimph.everything.model.VideoRes;
import com.trimph.everything.ui.activity.MainActivity;
import com.trimph.everything.ui.adapter.HomeVideoTypeAdapter;
import com.trimph.everything.ui.adapter.HomeViewAdapter;
import com.trimph.everything.ui.adapter.NewsListAdapter;
import com.trimph.everything.ui.contact.HomeContact;
import com.trimph.everything.utils.GlideUtils;
import com.trimph.everything.utils.JumpToUtils;
import com.trimph.everything.weight.BannerIndicator;
import com.trimph.everything.weight.LVGhost;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
/**
* author: Trimph
* data: 2016/11/11.
* description:
*/
public class HomeViewImpl extends RootView<HomeContact.presenter> implements HomeContact.view {
@BindView(R.id.recycler)
RecyclerView recycler;
HomeViewAdapter homeViewAdapter;
public Context mContext;
MyAdapter myAdapter;
View handerView;
@BindView(R.id.load_view)
LVGhost loadView;
// @BindView(R.id.pullToRefresh)
// PullToRefreshView pullToRefresh;
HomeVideoTypeAdapter videoTypeAdapter;
public List<SectionVideoInfo> videoInfos = new ArrayList<>();
public List<SectionVideoInfo> noTitleVideoInfos = new ArrayList<>();
BannerIndicator banner;
NewsListAdapter newsListAdapter;
@BindView(R.id.swipeRefresh)
SwipeRefreshLayout swipeRefresh;
public HomeViewImpl(Context context) {
this(context, null);
}
public HomeViewImpl(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void init(Context context) {
this.mContext = context;
inflate(context, R.layout.home_vew, this);
handerView = ((MainActivity) mContext).getLayoutInflater().inflate(R.layout.home_viepager_title, null, false);
banner = (BannerIndicator) handerView.findViewById(R.id.banner);
// homeViewAdapter = new HomeViewAdapter(context);
}
@Override
public void showContent(VideoRes videoRes) {
if (videoRes != null) {
initData(videoRes);
videoInfos.addAll(noTitleVideoInfos);
if (newsListAdapter == null) {
// videoTypeAdapter = new HomeVideoTypeAdapter(mContext, R.layout.home_item_view_layout,
// R.layout.home_item_title, videoInfos);
// myAdapter = new MyAdapter(mContext, R.layout.home_item_view_layout, videoRes.list.get(0).childList);
newsListAdapter = new NewsListAdapter(mContext, videoInfos);
if (handerView == null) {
Toast.makeText(mContext, "怎么喂空咧", Toast.LENGTH_SHORT).show();
}
if (banner == null) {
Toast.makeText(mContext, "Banner怎么喂空咧", Toast.LENGTH_SHORT).show();
}
newsListAdapter.setHeaderView(handerView);
}
// Log.e("TypeAdapter-------", videoTypeAdapter.getData().size() + "");
// Log.e("TypeAdapter--------", ((SectionVideoInfo) videoTypeAdapter.getData().get(0)).isHeader + "");
// videoTypeAdapter.addHeaderView(handerView);
if (recycler != null) {
recycler.setAdapter(newsListAdapter);
recycler.setLayoutManager(new LinearLayoutManager(mContext));
}
initListener();
}
}
/**
* 结束刷新
*/
public void stopRefresh() {
if (swipeRefresh != null) {
swipeRefresh.setRefreshing(false);
}
}
private void initListener() {
newsListAdapter.setOnItemListener(new NewsListAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, SectionVideoInfo bean, int pos) {
if (bean.t != null) {
JumpToUtils.JupmToVidoInfo(mContext, bean.t);
}
}
});
if (swipeRefresh != null) {
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
if (rPresenter != null) {
rPresenter.getVideo();
}
}
});
}
// videoTypeAdapter.setOnRecyclerViewItemChildClickListener(new BaseQuickAdapter.OnRecyclerViewItemChildClickListener() {
// @Override
// public void onItemChildClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
// Log.e("OnClickPositionChild", i + "");
// }
// });
// videoTypeAdapter.setOnRecyclerViewItemClickListener(new BaseQuickAdapter.OnRecyclerViewItemClickListener() {
// @Override
// public void onItemClick(View view, int i) {
// Log.e("OnClickPosition", i + "");
// VideoInfo videoInfo = videoInfos.get(i).t;
// Log.e("OnClickPosition", videoInfo.toString() + "");
// JumpToUtils.JupmToVidoInfo(mContext, videoInfo);
// }
// });
}
/**
* 分类
*
* @param videoRes
*/
private void initData(VideoRes videoRes) {
List<VideoInfo> list;
for (int i = 0; i < videoRes.list.size(); i++) {
if (videoRes.list.get(i).title.equals("免费推荐")) {
// Log.e("HomeView size 免费推荐:" + i, ":" + videoRes.list.get(i).childList + "");
list = videoRes.list.get(i).childList;
for (int j = 0; j < list.size(); j++) {
VideoInfo videoInfo = list.get(j);
if (j == 0) {
SectionVideoInfo sectionVideoInfo1 = new SectionVideoInfo(true, "Banner");
sectionVideoInfo1.setType(-1);
videoInfos.add(sectionVideoInfo1);
SectionVideoInfo sectionVideoInfo = new SectionVideoInfo(true, "免费推荐");
sectionVideoInfo.setType(1);
videoInfos.add(sectionVideoInfo);
Log.e("HomeView 免费推荐*********:" + i, ":" + videoInfos.get(0).isHeader + "");
videoInfos.add(new SectionVideoInfo(videoInfo));
// Log.e("HomeView size 免费推荐---:" + i, ":" + videoInfos.get(0).isHeader + "");
} else {
videoInfos.add(new SectionVideoInfo(videoInfo));
}
}
}
// Log.e("HomeView size 免费推荐---:" + i, ":" + videoRes.list.get(i).childList.toString() + "");
else if (videoRes.list.get(i).title.equals("热点资讯")) {
Log.e("HomeView size 热点资讯:" + i, ":" + videoRes.list.get(i).childList + "");
list = videoRes.list.get(i).childList;
for (int j = 0; j < list.size(); j++) {
VideoInfo videoInfo = list.get(j);
SectionVideoInfo sectionVideoInfo;
if (j == 0) {
SectionVideoInfo sectionVideoInfo1 = new SectionVideoInfo(true, "热点资讯");
sectionVideoInfo1.setType(1);
videoInfos.add(sectionVideoInfo1);
videoInfos.add(new SectionVideoInfo(videoInfo));
} else {
videoInfos.add(new SectionVideoInfo(videoInfo));
}
}
// videoInfos.addAll(videoRes.list.get(i).getChildList());
} else if (videoRes.list.get(i).title.equals("精彩推荐")) {
Log.e("HomeView size 精彩推荐:" + i, ":" + videoRes.list.get(i).childList + "");
list = videoRes.list.get(i).childList;
for (int j = 0; j < list.size(); j++) {
VideoInfo videoInfo = list.get(j);
if (j == 0) {
// videoInfo.header = "精彩推荐";
// videoInfo.isHeader = true;
SectionVideoInfo sectionVideoInfo1 = new SectionVideoInfo(true, "精彩推荐");
sectionVideoInfo1.setType(1);
videoInfos.add(sectionVideoInfo1);
videoInfos.add(new SectionVideoInfo(videoInfo));
} else {
videoInfos.add(new SectionVideoInfo(videoInfo));
}
}
// videoInfos.addAll(videoRes.list.get(i).getChildList());
} else if (videoRes.list.get(i).title.equals("好莱坞")) {
Log.e("HomeView size 好莱坞:" + i, ":" + videoRes.list.get(i).childList + "");
list = videoRes.list.get(i).childList;
for (int j = 0; j < list.size(); j++) {
VideoInfo videoInfo = list.get(j);
if (j == 0) {
// videoInfo.header = "好莱坞";
// videoInfo.isHeader = true;
SectionVideoInfo sectionVideoInfo1 = new SectionVideoInfo(true, "好莱坞");
sectionVideoInfo1.setType(1);
videoInfos.add(sectionVideoInfo1);
videoInfos.add(new SectionVideoInfo(videoInfo));
} else {
videoInfos.add(new SectionVideoInfo(videoInfo));
}
}
// videoInfos.addAll(videoRes.list.get(i).getChildList());
} else if (videoRes.list.get(i).title.equals("专题")) {
Log.e("HomeView size 专题:" + i, ":" + videoRes.list.get(i).childList + "");
list = videoRes.list.get(i).childList;
for (int j = 0; j < list.size(); j++) {
VideoInfo videoInfo = list.get(j);
if (j == 0) {
// videoInfo.header = "专题";
// videoInfo.isHeader = true;
// videoInfos.add(new SectionVideoInfo(videoInfo));
} else {
// videoInfos.add(new SectionVideoInfo(videoInfo));
}
}
// videoInfos.addAll(videoRes.list.get(i).getChildList());
} else if (videoRes.list.get(i).title.equals("直播专区")) {
Log.e("HomeView size 直播专区:" + i, ":" + videoRes.list.get(i).childList + "");
list = videoRes.list.get(i).childList;
for (int j = 0; j < list.size(); j++) {
VideoInfo videoInfo = list.get(j);
if (j == 0) {
// videoInfo.header = "直播专区";
// videoInfo.isHeader = true;
// videoInfos.add(new SectionVideoInfo(true, "直播专区"));
// videoInfos.add(new SectionVideoInfo(videoInfo));
} else {
// videoInfos.add(new SectionVideoInfo(videoInfo));
}
}
// videoInfos.addAll(videoRes.list.get(i).getChildList());
} else {
Log.e("HomeView size else:" + i, ":" + videoRes.list.get(i).childList + "");
list = videoRes.list.get(i).childList;
for (int j = 0; j < list.size(); j++) {
VideoInfo videoInfo = list.get(j);
// videoInfo.header = "直播专区";
// videoInfo.isHeader = true;
// noTitleVideoInfos.add(new SectionVideoInfo(videoInfo));
}
// videoInfos.addAll(videoRes.list.get(i).getChildList());
}
}
}
/**
* BaseRecycleViewAdapter
*/
public class MyAdapter extends BaseQuickAdapter<VideoInfo> {
public MyAdapter(Context context, int layoutResId, List<VideoInfo> data) {
super(context, layoutResId, data);
}
@Override
protected void convert(BaseViewHolder baseViewHolder, VideoInfo videoInfo) {
baseViewHolder.setText(R.id.video_title, videoInfo.title);
GlideUtils.DisplayImage(mContext, (ImageView) baseViewHolder.convertView.findViewById(R.id.video_iamge), videoInfo.pic);
}
}
@Override
public void showBannerImage(List<GankItemBean> gankItemBeanList) {
Log.e("showBannerImage-------", gankItemBeanList.get(0).toString());
if (gankItemBeanList == null) {
rPresenter.getVideo();
}
if (gankItemBeanList != null) {
Log.e("showBannerImage-------", "size" + gankItemBeanList.size());
if (handerView == null) {
Log.e("showBannerImage-------", "handerView ==null");
}
if (banner != null) {
Log.e("showBannerImage-------", "banner ==null");
banner.setSource(gankItemBeanList).startScroll(); // 添加 startScroll 不然图片就出不来
newsListAdapter.notifyDataSetChanged();
}
}
}
@Override
public void showImage(GankItemBean gankItemBeanList) {
Log.e("GankitemBean", gankItemBeanList.toString());
}
@Override
public void showDialog() {
if (loadView != null) {
loadView.setVisibility(VISIBLE);
// loadView.startAnim();
}
}
@Override
public void closeDialog() {
if (loadView != null) {
// loadView.stopAnim();
Log.e("Dialog", "closeDialog");
loadView.setVisibility(GONE);
}
stopRefresh();
}
@Override
public void stopBanner() {
if (banner != null) {
banner.pauseScroll();
}
}
@Override
public void setPersenter(HomeContact.presenter persenter) {
this.rPresenter = persenter;
}
}
| [
"tx09trimph@163.com"
] | tx09trimph@163.com |
a0dddafe9c8129a1e050b0365a263ef4a3d5ff6d | af6a65d83973df5953a4617c49213b7b928b4690 | /src/Methods/AgeCalculatorTest.java | 11db715b0bc87ba3e3461d68866189ced68ffc27 | [] | no_license | TubaKursun/JavaPractice | 5d582cbf95304c2d323e5349e4e2539b3ddcc1ba | c79faba06e7ac4ceebdd53a89df1f28487f5ce89 | refs/heads/master | 2023-08-11T09:37:08.441859 | 2021-10-02T19:18:10 | 2021-10-02T19:18:10 | 408,982,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 53 | java | package Methods;
public class AgeCalculatorTest {
}
| [
"tubakursun82@gmail.com"
] | tubakursun82@gmail.com |
fe0bfb21a757957c102ee78963694efbf80999ef | 374dfbbd914ad30f2e1710be5f96ec5ca4c02f4b | /src/main/java/fr/clement/luc/Chemin.java | 3b0f15530de5b530ef4c6ce782fc508fb17355ae | [] | no_license | luc-clement/generic-genetic-algorithm | e40fd25a6c48436e3791db5b2889d83c00d53f12 | 8229b4fe564f122477e56c3670135e54a8de8030 | refs/heads/master | 2021-01-19T00:46:26.663319 | 2015-03-16T21:57:53 | 2015-03-16T21:57:53 | 32,236,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 470 | java | package fr.clement.luc;
public class Chemin extends Individual<Chromosome> {
public int compareTo(Individual<Chromosome> o) {
// TODO Auto-generated method stub
return 0;
}
@Override
void applyMutation() {
// TODO Auto-generated method stub
}
@Override
void doOptimisation() {
// TODO Auto-generated method stub
}
@Override
<T extends Individual<?>> T combination(T individual) {
// TODO Auto-generated method stub
return null;
}
}
| [
"luc.clement421@gmail.com"
] | luc.clement421@gmail.com |
e233869f891547dc827e69cc2fc9ac0726e06283 | 3dd5f817e11a3225cf719f015b5693de9a92d37b | /forest-core/src/test/java/com/thebeastshop/forest/http/TestCallbackClient.java | 636618d12601edb684a5fe238e0357bcdb9d67f9 | [
"MIT"
] | permissive | luchao0111/forest-1 | 15891c7bcd7598ec2fc6b76a52909ea4e42626f7 | 1778fded64cb27fb80d645b459e946fadb5ed5ec | refs/heads/master | 2021-06-20T16:04:33.662984 | 2017-08-07T11:26:33 | 2017-08-07T11:26:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,030 | java | package com.thebeastshop.forest.http;
import com.thebeastshop.forest.config.ForestConfiguration;
import com.thebeastshop.forest.http.client.CallbackClient;
import com.thebeastshop.forest.mock.GetMockServer;
import com.thebeastshop.forest.callback.OnSuccess;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* @author gongjun[jun.gong@thebeastshop.com]
* @since 2017-06-06 15:56
*/
public class TestCallbackClient {
private final static Logger log = LoggerFactory.getLogger(TestCallbackClient.class);
@Rule
public GetMockServer server = new GetMockServer(this);
private static ForestConfiguration configuration;
private static CallbackClient callbackClient;
@BeforeClass
public static void prepareClient() {
configuration = ForestConfiguration.configuration();
callbackClient = configuration.createInstance(CallbackClient.class);
}
@Before
public void prepareMockServer() {
server.initServer();
}
@Test
public void testGetOnSuccess() {
callbackClient.getOnSuccess("foo", new OnSuccess<String>() {
@Override
public void onSuccess(String data, ForestRequest request, ForestResponse response) {
log.info("response: " + data);
assertNotNull(data);
assertEquals(GetMockServer.EXPECTED, data);
}
});
}
@Test
public void testGetOnSuccessMap() {
callbackClient.getOnSuccessMap("foo", new OnSuccess<Map>() {
@Override
public void onSuccess(Map data, ForestRequest request, ForestResponse response) {
log.info("response: " + data);
assertNotNull(data);
assertEquals("ok", data.get("status"));
}
});
}
}
| [
"jun.gong@thebeastshop.com"
] | jun.gong@thebeastshop.com |
68edfc6ec53ec227c3455bbf76756144da77ec9e | d0f2d7fbf8c3a2e992c5d01e64bc3e27cb518d3e | /CRS/src/Data.java | 62a2d608558a2d6b92633181450fe636a4c193a5 | [] | no_license | ZiyiWang716/CouseRegistrationSystem | 1f786332bfe754af0c43d0b9f1ce3db63c232560 | c3cbb38fa8293f5e48b1819e0f6b024d3241a043 | refs/heads/main | 2023-01-29T04:37:27.479567 | 2020-12-08T18:06:11 | 2020-12-08T18:06:11 | 319,720,045 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,603 | java | import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
/**
* stores all the students, admins, and courses data and accomplishes serialization and deserialization
*
*/
public class Data implements Serializable {
private ArrayList<Course> courses;
private ArrayList<Student> students;
private ArrayList<Admin> admins;
public Data(ArrayList<Course> c,ArrayList<Student> s,ArrayList<Admin> a) {
this.courses=c;
this.students=s;
this.admins=a;
}
public void serialize() {
try
{
FileOutputStream fos = new FileOutputStream(new File("myData"));
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(this);
System.out.println("Information serialized! See you next time!");
oos.close();
fos.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}
public static Data deserialize() throws IOException, ClassNotFoundException{
Data data =null;
FileInputStream fis = new FileInputStream("myData");
ObjectInputStream ois = new ObjectInputStream(fis);
data= (Data) ois.readObject();
return data;
}
public ArrayList<Course> getCourses() {
return this.courses;
}
public ArrayList<Student> getStudents(){
return this.students;
}
public ArrayList<Admin> getAdmins(){
return this.admins;
}
}
| [
"noreply@github.com"
] | ZiyiWang716.noreply@github.com |
731c35803474ee1244cf54263be9529efa1771eb | f89e0f2f29c335f58a4234bd3fdfa6cffb8ab4d2 | /src/main/java/com/glory/mybatis/utils/JdbcUtil.java | 30b805e9ec36b2e2e7bccf208a51d027b7adbb8c | [] | no_license | 6Glory9/mybatis-generator | cafa5b5b83079b99a5d2dd2b2c13e3f54b10101e | fcc7175030d3b5fcdca8d3cfa243f8cc2a724108 | refs/heads/master | 2021-05-02T07:52:26.979097 | 2018-02-09T01:28:30 | 2018-02-09T01:28:30 | 120,840,112 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,254 | java | package com.glory.mybatis.utils;
import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by glory on 2018-02-07.
*/
public class JdbcUtil {
// 定义数据库的链接
private Connection conn;
// 定义sql语句的执行对象
private PreparedStatement pstmt;
// 定义查询返回的结果集合
private ResultSet rs;
// 初始化
public JdbcUtil(String driver, String url, String username, String password) {
try {
Class.forName(driver);
conn = DriverManager.getConnection(url, username, password);
System.out.println("数据库连接成功");
} catch (Exception e) {
e.printStackTrace();
}
}
// 更新数据
public boolean updateByParams(String sql, List params) throws SQLException {
// 影响行数
int result = -1;
pstmt = conn.prepareStatement(sql);
int index = 1;
// 填充sql语句中的占位符
if (null != params && !params.isEmpty()) {
for (int i = 0; i < params.size(); i++) {
pstmt.setObject(index++, params.get(i));
}
}
result = pstmt.executeUpdate();
return result > 0 ? true : false;
}
// 查询多条记录
public List<Map> selectByParams(String sql, List params) throws SQLException {
List<Map> list = new ArrayList<>();
int index = 1;
pstmt = conn.prepareStatement(sql);
if (null != params && !params.isEmpty()) {
for (int i = 0; i < params.size(); i++) {
pstmt.setObject(index++, params.get(i));
}
}
rs = pstmt.executeQuery();
ResultSetMetaData metaData = rs.getMetaData();
int colsLen = metaData.getColumnCount();
while (rs.next()) {
Map map = new HashMap(colsLen);
for (int i = 0; i < colsLen; i++) {
String columnName = metaData.getColumnName(i + 1);
Object columnValue = rs.getObject(columnName);
if (null == columnValue) {
columnValue = "";
}
map.put(columnName, columnValue);
}
list.add(map);
}
return list;
}
// 释放连接
public void release() {
try {
if (null != rs) {
rs.close();
}
if (null != pstmt) {
pstmt.close();
}
if (null != conn) {
conn.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
System.out.println("释放数据库连接");
}
} | [
"jxilong@yiji.com"
] | jxilong@yiji.com |
15de641e3ad1fc129d2c1dc2f22d2f8c4c6c37c1 | b88ac36f4bbadbfa6b4976983ea07722089423b1 | /src/com/teksystems/finish/Main.java | 024f1cb53d245c48b69f0181cf0d9ca8c891a649 | [] | no_license | alexalspaw-tekcamp/java-2.4-breakout | 2c308cdcbe58c75adb644ebed75c3b3746fdbf0e | 6b3b1004350b6d9182f79aefb3bf58bf06d06be6 | refs/heads/main | 2023-07-18T08:51:02.740297 | 2021-09-03T14:39:12 | 2021-09-03T14:39:12 | 402,093,378 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,057 | java | package com.teksystems.finish;
public class Main {
public static void main(String[] args) {
AudioFile song = new Song("Cigarette Daydreams", "3:13", "Cage the Elephant");
PodcastingApp<Podcast> podcastingApp = new PodcastingApp<>("Apple Podcasts");
// podcastingApp.addToApp(song);
/* Do the following tasks here in the main method.
Create 5 podcasts.
Create 1 Podcasting Apps.
It may not make the most sense, but suppose later a client asks for the ability to create a
hybrid "playlist" that contains podcasts as well as songs. This would be a prime opportunity
to create an abstraction (interface or abstract class). For generics there is an existing
class where those could be added.
Below are suggested method calls if you get those built out.
Load podcasts into the podcasting app
- play and stop a podcast
- go to the next() and previous() podcasts
- stop()
- put a podcast on repeat()
- show the playlist
- remove a podcast from the playlist
*/
}
}
| [
"aalspaw@teksystems.com"
] | aalspaw@teksystems.com |
4e14474f82aadc5a9f1fdd39fed05d6dc0c945f0 | 5bc337f80ad690003f5152374d6384b0c63e740a | /spring/spring-jpa/src/main/java/com/stevens/spring_jpa_query/empModel/ParameterId.java | 4d84403dce617321823616eb995fe557c4c8a1ba | [] | no_license | CharlesStevens/spring | 5dedd7aa04c399bb7ccbb1e6b88c7e2f799114b2 | a0b4a7a4fa673d2aabbef5360432660772fcb8a1 | refs/heads/master | 2022-12-23T08:58:23.139986 | 2021-06-11T20:02:59 | 2021-06-11T20:02:59 | 147,059,161 | 0 | 0 | null | 2022-12-16T15:36:40 | 2018-09-02T06:04:48 | Java | UTF-8 | Java | false | false | 993 | java | package com.stevens.spring_jpa_query.empModel;
import java.io.Serializable;
import java.util.Objects;
public class ParameterId implements Serializable {
String paramName;
Long paramId;
public ParameterId() {
}
public ParameterId(String paramName, Long paramId) {
this.paramName = paramName;
this.paramId = paramId;
}
public String getParamName() {
return paramName;
}
public void setParamName(String paramName) {
this.paramName = paramName;
}
public Long getParamId() {
return paramId;
}
public void setParamId(Long paramId) {
this.paramId = paramId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ParameterId)) {
return false;
}
ParameterId that = (ParameterId) o;
return paramName.equals(that.paramName) &&
paramId.equals(that.paramId);
}
@Override
public int hashCode() {
return Objects.hash(paramName, paramId);
}
}
| [
"abhiswastik14@gmail.com"
] | abhiswastik14@gmail.com |
54fe4b7d9c7ce4ff33f6078799774b715ab42042 | 0e5afc3eff1575d86a016e9dc008416dd5ff24d0 | /app/src/androidTest/java/com/app/reforcandoalfa/ExampleInstrumentedTest.java | 0f5f628230bb4ddfd7a35c54567bbb1a551634cd | [] | no_license | jvsena42/ReforcandoAlfa | 476d99914392c814ea878e5959377fd389402ed6 | c5e36186283d61411686e1909f15f4a4f353bc6b | refs/heads/master | 2020-04-15T19:43:15.285576 | 2019-01-10T02:22:42 | 2019-01-10T02:22:42 | 164,961,560 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 728 | java | package com.app.reforcandoalfa;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.app.reforcandoalfa", appContext.getPackageName());
}
}
| [
"jvsena16@gmail.com"
] | jvsena16@gmail.com |
1c899dce9cc9497be0c80aa8a7f28f9aa48d703b | fdae1f3cdb8009a335c682bbe42fce50d4ef684d | /x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/dataframe/action/PutDataFrameTransformAction.java | f1159725b1a7b801f2426e339b10e08857262fe4 | [
"Elastic-2.0",
"LicenseRef-scancode-elastic-license-2018",
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-other-permissive"
] | permissive | hackery/elasticsearch | 6239e18223c6b8481fd618eea8fa471802418395 | 4e392e118fcc4f6c0058294d07ac89913e9945ac | refs/heads/master | 2021-06-03T21:46:57.381022 | 2019-06-12T13:54:28 | 2019-06-12T13:54:28 | 79,211,925 | 0 | 0 | Apache-2.0 | 2019-06-12T14:29:02 | 2017-01-17T09:37:11 | Java | UTF-8 | Java | false | false | 5,507 | java | /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.dataframe.action;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.AcknowledgedRequest;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.indices.InvalidIndexNameException;
import org.elasticsearch.xpack.core.dataframe.DataFrameField;
import org.elasticsearch.xpack.core.dataframe.transforms.DataFrameTransformConfig;
import org.elasticsearch.xpack.core.dataframe.utils.DataFrameStrings;
import org.elasticsearch.xpack.core.dataframe.DataFrameMessages;
import java.io.IOException;
import java.util.Locale;
import java.util.Objects;
import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.validateIndexOrAliasName;
public class PutDataFrameTransformAction extends Action<AcknowledgedResponse> {
public static final PutDataFrameTransformAction INSTANCE = new PutDataFrameTransformAction();
public static final String NAME = "cluster:admin/data_frame/put";
private PutDataFrameTransformAction() {
super(NAME);
}
@Override
public AcknowledgedResponse newResponse() {
return new AcknowledgedResponse();
}
public static class Request extends AcknowledgedRequest<Request> implements ToXContentObject {
private final DataFrameTransformConfig config;
public Request(DataFrameTransformConfig config) {
this.config = config;
}
public Request(StreamInput in) throws IOException {
super(in);
this.config = new DataFrameTransformConfig(in);
}
public static Request fromXContent(final XContentParser parser, final String id) throws IOException {
return new Request(DataFrameTransformConfig.fromXContent(parser, id, false));
}
@Override
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = null;
if(config.getPivotConfig() != null
&& config.getPivotConfig().getMaxPageSearchSize() != null
&& (config.getPivotConfig().getMaxPageSearchSize() < 10 || config.getPivotConfig().getMaxPageSearchSize() > 10_000)) {
validationException = addValidationError(
"pivot.max_page_search_size [" +
config.getPivotConfig().getMaxPageSearchSize() + "] must be greater than 10 and less than 10,000",
validationException);
}
for(String failure : config.getPivotConfig().aggFieldValidation()) {
validationException = addValidationError(failure, validationException);
}
String destIndex = config.getDestination().getIndex();
try {
validateIndexOrAliasName(destIndex, InvalidIndexNameException::new);
if (!destIndex.toLowerCase(Locale.ROOT).equals(destIndex)) {
validationException = addValidationError("dest.index [" + destIndex +"] must be lowercase", validationException);
}
} catch (InvalidIndexNameException ex) {
validationException = addValidationError(ex.getMessage(), validationException);
}
if (DataFrameStrings.isValidId(config.getId()) == false) {
validationException = addValidationError(
DataFrameMessages.getMessage(DataFrameMessages.INVALID_ID, DataFrameField.ID.getPreferredName(), config.getId()),
validationException);
}
if (DataFrameStrings.hasValidLengthForId(config.getId()) == false) {
validationException = addValidationError(
DataFrameMessages.getMessage(DataFrameMessages.ID_TOO_LONG, DataFrameStrings.ID_LENGTH_LIMIT),
validationException);
}
return validationException;
}
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
return this.config.toXContent(builder, params);
}
public DataFrameTransformConfig getConfig() {
return config;
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
this.config.writeTo(out);
}
@Override
public int hashCode() {
return Objects.hash(config);
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Request other = (Request) obj;
return Objects.equals(config, other.config);
}
}
}
| [
"noreply@github.com"
] | hackery.noreply@github.com |
2befbc8ce41f43ae87d38e50c921d24809f0c3f9 | 694d574b989e75282326153d51bd85cb8b83fb9f | /google-ads/src/main/java/com/google/ads/googleads/v3/services/InvoiceServiceSettings.java | 4a92794093a7a3fe295e29cfba405d6c846aad80 | [
"Apache-2.0"
] | permissive | tikivn/google-ads-java | 99201ef20efd52f884d651755eb5a3634e951e9b | 1456d890e5c6efc5fad6bd276b4a3cd877175418 | refs/heads/master | 2023-08-03T13:02:40.730269 | 2020-07-17T16:33:40 | 2020-07-17T16:33:40 | 280,845,720 | 0 | 0 | Apache-2.0 | 2023-07-23T23:39:26 | 2020-07-19T10:51:35 | null | UTF-8 | Java | false | false | 6,861 | java | /*
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.ads.googleads.v3.services;
import com.google.ads.googleads.v3.services.stub.InvoiceServiceStubSettings;
import com.google.api.core.ApiFunction;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import java.io.IOException;
import java.util.List;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* Settings class to configure an instance of {@link InvoiceServiceClient}.
*
* <p>The default instance has everything set to sensible defaults:
*
* <ul>
* <li>The default service address (googleads.googleapis.com) and default port (443) are used.
* <li>Credentials are acquired automatically through Application Default Credentials.
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
* </ul>
*
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object. For
* example, to set the total timeout of listInvoices to 30 seconds:
*
* <pre>
* <code>
* InvoiceServiceSettings.Builder invoiceServiceSettingsBuilder =
* InvoiceServiceSettings.newBuilder();
* invoiceServiceSettingsBuilder.listInvoicesSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30));
* InvoiceServiceSettings invoiceServiceSettings = invoiceServiceSettingsBuilder.build();
* </code>
* </pre>
*/
@Generated("by gapic-generator")
@BetaApi
public class InvoiceServiceSettings extends ClientSettings<InvoiceServiceSettings> {
/** Returns the object with the settings used for calls to listInvoices. */
public UnaryCallSettings<ListInvoicesRequest, ListInvoicesResponse> listInvoicesSettings() {
return ((InvoiceServiceStubSettings) getStubSettings()).listInvoicesSettings();
}
public static final InvoiceServiceSettings create(InvoiceServiceStubSettings stub)
throws IOException {
return new InvoiceServiceSettings.Builder(stub.toBuilder()).build();
}
/** Returns a builder for the default ExecutorProvider for this service. */
public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
return InvoiceServiceStubSettings.defaultExecutorProviderBuilder();
}
/** Returns the default service endpoint. */
public static String getDefaultEndpoint() {
return InvoiceServiceStubSettings.getDefaultEndpoint();
}
/** Returns the default service scopes. */
public static List<String> getDefaultServiceScopes() {
return InvoiceServiceStubSettings.getDefaultServiceScopes();
}
/** Returns a builder for the default credentials for this service. */
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
return InvoiceServiceStubSettings.defaultCredentialsProviderBuilder();
}
/** Returns a builder for the default ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InvoiceServiceStubSettings.defaultGrpcTransportProviderBuilder();
}
public static TransportChannelProvider defaultTransportChannelProvider() {
return InvoiceServiceStubSettings.defaultTransportChannelProvider();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
return InvoiceServiceStubSettings.defaultApiClientHeaderProviderBuilder();
}
/** Returns a new builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
}
/** Returns a builder containing all the values of this settings class. */
public Builder toBuilder() {
return new Builder(this);
}
protected InvoiceServiceSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);
}
/** Builder for InvoiceServiceSettings. */
public static class Builder extends ClientSettings.Builder<InvoiceServiceSettings, Builder> {
protected Builder() throws IOException {
this((ClientContext) null);
}
protected Builder(ClientContext clientContext) {
super(InvoiceServiceStubSettings.newBuilder(clientContext));
}
private static Builder createDefault() {
return new Builder(InvoiceServiceStubSettings.newBuilder());
}
protected Builder(InvoiceServiceSettings settings) {
super(settings.getStubSettings().toBuilder());
}
protected Builder(InvoiceServiceStubSettings.Builder stubSettings) {
super(stubSettings);
}
public InvoiceServiceStubSettings.Builder getStubSettingsBuilder() {
return ((InvoiceServiceStubSettings.Builder) getStubSettings());
}
// NEXT_MAJOR_VER: remove 'throws Exception'
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
* <p>Note: This method does not support applying settings to streaming methods.
*/
public Builder applyToAllUnaryMethods(
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
super.applyToAllUnaryMethods(
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
return this;
}
/** Returns the builder for the settings used for calls to listInvoices. */
public UnaryCallSettings.Builder<ListInvoicesRequest, ListInvoicesResponse>
listInvoicesSettings() {
return getStubSettingsBuilder().listInvoicesSettings();
}
@Override
public InvoiceServiceSettings build() throws IOException {
return new InvoiceServiceSettings(this);
}
}
}
| [
"noreply@github.com"
] | tikivn.noreply@github.com |
26f6bb31ef9ce8d63973541050f2343c4f7b4b50 | 113134a5b6abb7f3096753305290e19799d2b0d8 | /app/src/main/java/com/histudent/jwsoft/histudent/model/manage/AudioManager.java | d092151eeba9c6b9dcb3ce44a90bd99f04ded17d | [] | no_license | dengjiaping/trunk | 5047c99d25125b75451142fdb260d81be85f28b8 | bd24e8a6fdc7f2ca003e95ec45c723c17bf50684 | refs/heads/master | 2021-08-26T07:05:59.113508 | 2017-11-22T01:42:11 | 2017-11-22T01:42:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,967 | java | package com.histudent.jwsoft.histudent.model.manage;
import com.histudent.jwsoft.histudent.HTApplication;
import com.histudent.jwsoft.histudent.HiStudentLog;
import com.histudent.jwsoft.histudent.model.entity.AudioPlayEvent;
import com.histudent.jwsoft.histudent.model.entity.AudioPlayStatusEvent;
import com.netease.nimlib.sdk.media.player.AudioPlayer;
import com.netease.nimlib.sdk.media.player.OnPlayListener;
import org.greenrobot.eventbus.EventBus;
import javax.inject.Inject;
/**
* Created by huyg on 2017/10/23.
*/
public class AudioManager {
private AudioPlayer mPlayer;
private int mode;
private long position;
private String lastSource = "";
private int count;
@Inject
public AudioManager() {
mPlayer = new AudioPlayer(HTApplication.getInstance());
mPlayer.setOnPlayListener(mListener);
mode = android.media.AudioManager.STREAM_MUSIC;
}
public int getMode() {
return mode;
}
/**
* 设置播放模式
* AudioManager.STREAM_VOICE_CALL 表示使用听筒模式
* AudioManager.STREAM_MUSIC 表示使用扬声器模式
*
* @param mode
*/
public void setMode(int mode) {
this.mode = mode;
}
/**
* 设置资源
*
* @param source
*/
public void setSource(String source) {
if (mPlayer != null) {
mPlayer.setDataSource(source);
}
}
/**
* 播放
*/
public void start(String source) {
if (!lastSource.equals(source)) {
mPlayer.setDataSource(source);
lastSource = source;
mPlayer.start(mode);
} else {
resume();
}
}
public void start(String source, int position) {
mPlayer.stop();
mPlayer.setDataSource(source);
lastSource = source;
mPlayer.start(mode);
mPlayer.seekTo(position);
}
/**
* 暂停
*/
public void pause() {
if (mPlayer != null) {
position = mPlayer.getCurrentPosition();
mPlayer.stop();
}
}
/**
* 停止
*/
public void stop() {
if (mPlayer != null) {
mPlayer.stop();
position = 0;
lastSource = "";
count = 0;
}
}
/**
* 继续播放
*/
public void resume() {
if (mPlayer != null) {
mPlayer.start(mode);
mPlayer.seekTo((int) position);
}
}
public boolean getState() {
if (mPlayer != null) {
return mPlayer.isPlaying();
}
return false;
}
/**
* 播放音频监听
*/
OnPlayListener mListener = new OnPlayListener() {
// 音频转码解码完成,会马上开始播放了
public void onPrepared() {
EventBus.getDefault().post(new AudioPlayStatusEvent(1));
}
// 播放结束
public void onCompletion() {
EventBus.getDefault().post(new AudioPlayStatusEvent(0));
position = 0;
count = 0;
}
// 播放被中断了
public void onInterrupt() {
//EventBus.getDefault().post(new AudioPlayStatusEvent(-1));
}
// 播放过程中出错。参数为出错原因描述
public void onError(String error) {
EventBus.getDefault().post(new AudioPlayStatusEvent(-1));
}
// 播放进度报告,每隔 500ms 会回调一次,告诉当前进度。 参数为当前进度,单位为毫秒,可用于更新 UI
public void onPlaying(long position) {
if (count % 2 == 1) {
AudioManager.this.position = position;
HiStudentLog.i("position" + position);
double p = position / 1000.0;
EventBus.getDefault().post(new AudioPlayEvent(((int)p) * 1000));
}
count++;
}
};
}
| [
"742315209@qq.com"
] | 742315209@qq.com |
e2206536d571c4d1e07418dcf43e022acc0229b4 | 40bbd349528f4799b438b23511ff79176a8dbc99 | /rpc-common/src/main/java/com/vito16/rpc/common/RpcProperties.java | 17c31b95fcc6ebe549e27de4e4879bf0cd7472cf | [] | no_license | vito16/vito-rpc | 1041412570a82eb22d3fb660d6a16db50e306e02 | b682bcf7e3e00451d76258ee3eb374de4770adbd | refs/heads/main | 2023-02-04T15:03:35.522680 | 2020-12-22T15:54:03 | 2020-12-22T15:54:03 | 313,163,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 798 | java | package com.vito16.rpc.common;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* @author vito
* @date 2020/11/10
*/
@Data
@ConfigurationProperties(prefix = "vito.rpc")
public class RpcProperties {
private Consumer consumer;
private Provider provider;
private String zkConn;
public static class Provider {
private String host;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
}
public static class Consumer {
private String host;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
}
}
| [
"zhouwentao16@gmail.com"
] | zhouwentao16@gmail.com |
ce96764342858d8892a60b5736fcb6e12b712a4f | 6ee92ecc85ba29f13769329bc5a90acea6ef594f | /bizcore/WEB-INF/retailscm_core_src/com/doublechaintech/retailscm/retailstoreordershippinggroup/RetailStoreOrderShippingGroupTokens.java | b420027cf0b004b8101fe39e699c1aa8a6522351 | [] | no_license | doublechaintech/scm-biz-suite | b82628bdf182630bca20ce50277c41f4a60e7a08 | 52db94d58b9bd52230a948e4692525ac78b047c7 | refs/heads/master | 2023-08-16T12:16:26.133012 | 2023-05-26T03:20:08 | 2023-05-26T03:20:08 | 162,171,043 | 1,387 | 500 | null | 2023-07-08T00:08:42 | 2018-12-17T18:07:12 | Java | UTF-8 | Java | false | false | 4,534 | java | package com.doublechaintech.retailscm.retailstoreordershippinggroup;
import com.doublechaintech.retailscm.CommonTokens;
import java.util.Map;
import java.util.Objects;
import com.doublechaintech.retailscm.retailstoreorder.RetailStoreOrderTokens;
public class RetailStoreOrderShippingGroupTokens extends CommonTokens {
static final String ALL = "__all__"; // do not assign this to common users.
static final String SELF = "__self__";
static final String OWNER_OBJECT_NAME = "retailStoreOrderShippingGroup";
public static boolean checkOptions(Map<String, Object> options, String optionToCheck) {
if (options == null) {
return false; // completely no option here
}
if (options.containsKey(ALL)) {
// danger, debug only, might load the entire database!, really terrible
return true;
}
String ownerKey = getOwnerObjectKey();
Object ownerObject = (String) options.get(ownerKey);
if (ownerObject == null) {
return false;
}
if (!ownerObject.equals(OWNER_OBJECT_NAME)) { // is the owner?
return false;
}
if (options.containsKey(optionToCheck)) {
// options.remove(optionToCheck);
// consume the key, can not use any more to extract the data with the same token.
return true;
}
return false;
}
protected RetailStoreOrderShippingGroupTokens() {
// ensure not initialized outside the class
}
public static RetailStoreOrderShippingGroupTokens of(Map<String, Object> options) {
// ensure not initialized outside the class
RetailStoreOrderShippingGroupTokens tokens = new RetailStoreOrderShippingGroupTokens(options);
return tokens;
}
protected RetailStoreOrderShippingGroupTokens(Map<String, Object> options) {
this.options = options;
}
public RetailStoreOrderShippingGroupTokens merge(String[] tokens) {
this.parseTokens(tokens);
return this;
}
public static RetailStoreOrderShippingGroupTokens mergeAll(String[] tokens) {
return allTokens().merge(tokens);
}
protected RetailStoreOrderShippingGroupTokens setOwnerObject(String objectName) {
ensureOptions();
addSimpleOptions(getOwnerObjectKey(), objectName);
return this;
}
public static RetailStoreOrderShippingGroupTokens start() {
return new RetailStoreOrderShippingGroupTokens().setOwnerObject(OWNER_OBJECT_NAME);
}
public RetailStoreOrderShippingGroupTokens withTokenFromListName(String listName) {
addSimpleOptions(listName);
return this;
}
public static RetailStoreOrderShippingGroupTokens loadGroupTokens(String... groupNames) {
RetailStoreOrderShippingGroupTokens tokens = start();
if (groupNames == null || groupNames.length == 0) {
return allTokens();
}
addToken(tokens, BIZORDER, groupNames, new String[] {"default"});
return tokens;
}
private static void addToken(
RetailStoreOrderShippingGroupTokens pTokens,
String pTokenName,
String[] pGroupNames,
String[] fieldGroups) {
if (pGroupNames == null || fieldGroups == null) {
return;
}
for (String groupName : pGroupNames) {
for (String g : fieldGroups) {
if (Objects.equals(groupName, g)) {
pTokens.addSimpleOptions(pTokenName);
break;
}
}
}
}
public static RetailStoreOrderShippingGroupTokens filterWithTokenViewGroups(String[] viewGroups) {
return start().withBizOrder();
}
public static RetailStoreOrderShippingGroupTokens allTokens() {
return start().withBizOrder();
}
public static RetailStoreOrderShippingGroupTokens withoutListsTokens() {
return start().withBizOrder();
}
public static Map<String, Object> all() {
return allTokens().done();
}
public static Map<String, Object> withoutLists() {
return withoutListsTokens().done();
}
public static Map<String, Object> empty() {
return start().done();
}
public RetailStoreOrderShippingGroupTokens analyzeAllLists() {
addSimpleOptions(ALL_LISTS_ANALYZE);
return this;
}
protected static final String BIZORDER = "bizOrder";
public String getBizOrder() {
return BIZORDER;
}
//
public RetailStoreOrderShippingGroupTokens withBizOrder() {
addSimpleOptions(BIZORDER);
return this;
}
public RetailStoreOrderTokens withBizOrderTokens() {
// addSimpleOptions(BIZORDER);
return RetailStoreOrderTokens.start();
}
public RetailStoreOrderShippingGroupTokens searchEntireObjectText(String verb, String value) {
return this;
}
}
| [
"zhangxilai@doublechaintech.com"
] | zhangxilai@doublechaintech.com |
97dcab47f1bb4e09bdf61ffb7c8eeb58da4ac15c | 7cb19d68d0e37d65b9b2ee100048bf8fec2d4cb9 | /src/algorithm_easy/MissingNumber.java | 842eb42ca782d9a6ed8e9c450b9f857517f8fe70 | [] | no_license | ruujoa/LeetCode | 1111e5671b61d21c09205df02d571473e3cbe291 | 91fdc2584251b7ca5e909b009de899cac8678fe1 | refs/heads/master | 2021-04-15T15:59:14.453436 | 2018-03-28T07:05:22 | 2018-03-28T07:05:22 | 126,148,673 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package algorithm_easy;
public class MissingNumber {
private static int missingNumber(int[] nums) {
int len = nums.length + 1;
int sum = 0;
for (int i = 0; i < len; i++) {
sum += i;
}
int particalSum = 0;
for (int i = 0; i < nums.length; i++) {
particalSum += nums[i];
}
return sum - particalSum;
}
public static void main(String[] args) {
System.out.println(missingNumber(new int[] {9,6,4,2,3,5,7,0,1}));
System.out.println(missingNumber(new int[] {3,0,1}));
}
}
| [
"ruujoa1982@163.com"
] | ruujoa1982@163.com |
d4fc9e8d169b73851fd3f179610cb1755da3a748 | fe02f3a48cd516469abce09fff7255e50279dbbb | /dcache-nfs/src/main/java/org/dcache/nfs/status/DeniedException.java | e414c7c6277767732de8ff25ff19c098841848ad | [
"MIT"
] | permissive | devsunny/app-galleries | 149cd74d04f2547093e20c34ddaf86be289e2cce | 98aed1b18031ded93056ad12bda5b2c62c40a85b | refs/heads/master | 2022-12-21T05:20:40.210246 | 2018-09-20T01:40:20 | 2018-09-20T01:40:20 | 21,674,470 | 0 | 1 | MIT | 2022-12-16T06:42:58 | 2014-07-10T01:20:03 | Java | UTF-8 | Java | false | false | 1,307 | java | /*
* Copyright (c) 2009 - 2014 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program (see the file COPYING.LIB for more
* details); if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package org.dcache.nfs.status;
import org.dcache.nfs.ChimeraNFSException;
import static org.dcache.nfs.nfsstat.*;
public class DeniedException extends ChimeraNFSException {
private static final long serialVersionUID = -7110628957802033164L;
public DeniedException() {
super(NFSERR_DENIED);
}
public DeniedException(String msg) {
super(NFSERR_DENIED, msg);
}
}
| [
"sunnyliu2@gmail.com"
] | sunnyliu2@gmail.com |
13f7ce24c4b084f54ff4ce8b33aff67a96013c97 | b61cfd8d0eb8fc6d4423e980c682af78383993eb | /vehicle-compliance/src/it/java/uk/gov/caz/vcc/repository/LicenseAndVehicleRemoteRepositoryIT.java | 9e26949fe02a9abbfaaab84950e819fc8c6a0483 | [
"OGL-UK-3.0"
] | permissive | DEFRA/clean-air-zones-api | 984e6ba7d16cc484e74dd57b1fab6150e230ce1c | e6437781ff5dc71b01ffce9fd6f8bec2226ee0a6 | refs/heads/master | 2023-07-24T13:59:03.152029 | 2021-05-06T16:24:20 | 2021-05-06T16:24:20 | 232,327,284 | 0 | 2 | NOASSERTION | 2023-07-13T17:02:58 | 2020-01-07T13:10:59 | Java | UTF-8 | Java | false | false | 8,154 | java | package uk.gov.caz.vcc.repository;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import com.google.common.net.MediaType;
import io.restassured.RestAssured;
import java.util.ArrayList;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockserver.model.HttpRequest;
import org.mockserver.model.HttpResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.http.HttpStatus;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.util.ReflectionTestUtils;
import uk.gov.caz.vcc.annotation.FullyRunningServerIntegrationTest;
import uk.gov.caz.vcc.domain.authentication.VehicleApiCredentialRotationManager;
import uk.gov.caz.vcc.domain.exceptions.ExternalServiceCallException;
import uk.gov.caz.vcc.dto.SingleDvlaVehicleData;
import uk.gov.caz.vcc.repository.LicenseAndVehicleRepository.NtrAndDvlaData;
import uk.gov.caz.vcc.util.MockServerTestIT;
import uk.gov.caz.vcc.util.VehicleApiAuthenticationUtility;
@FullyRunningServerIntegrationTest
@TestPropertySource(properties = {
"dvla-api-endpoint=http://localhost:1080/dvla-api/details/",
"dvla-authentication-endpoint=http://localhost:1080/dvla-api/",
"dvla-api-username=test-username",
"dvla-api-password=test-password",
"redis.enabled=false",
"services.remote-vehicle-data.use-remote-api=true"
})
public class LicenseAndVehicleRemoteRepositoryIT extends MockServerTestIT {
// We need to mock calls to AWS secrets so that we can assert the returned values
@Mock
private VehicleApiCredentialRotationManager vehicleApiCredentialRotationManager;
@Autowired
private VehicleApiAuthenticationUtility vehicleApiAuthenticationUtility;
@Autowired
private LicenseAndVehicleRemoteRepository licenseAndVehicleRemoteRepository;
@LocalServerPort
int randomServerPort;
@Value("${dvla-api-password}")
private String dvlaApiPassword;
@BeforeEach
public void setup() {
RestAssured.port = randomServerPort;
RestAssured.baseURI = "http://localhost";
ReflectionTestUtils.setField(vehicleApiAuthenticationUtility,
"vehicleApiCredentialRotationManager", vehicleApiCredentialRotationManager);
ReflectionTestUtils.setField(vehicleApiAuthenticationUtility,
"dvlaApiPassword", dvlaApiPassword);
ReflectionTestUtils.setField(vehicleApiAuthenticationUtility,
"credentialRotationAttempted", false);
}
@AfterEach
public void post() {
mockServer.reset();
vehicleApiAuthenticationUtility.evictAuthTokenCache();
}
@Nested
class WhenFetchingSingleDvlaData {
@Test
public void failedAuthenticationTriggersRetry() {
String vrn = "CAS300";
mockDvlaVehicleDetailsEndpointFailure("old-token", vrn);
mockDvlaVehicleDetailsEndpointSuccess("new-token", vrn);
mockDvlaAuthEndpointSuccess("test-password");
SingleDvlaVehicleData vehicle = licenseAndVehicleRemoteRepository
.findDvlaVehicle(vrn, "old-token");
assertFalse(vehicle.hasFailed());
}
@Test
public void twiceFailedAuthenticationThrowsExternalServiceCallException() {
String vrn = "CAS300";
mockDvlaVehicleDetailsEndpointFailure("old-token", "CAS300");
mockDvlaVehicleDetailsEndpointFailure("new-token", "CAS300");
mockDvlaAuthEndpointSuccess("test-password");
assertThrows(ExternalServiceCallException.class,
() -> licenseAndVehicleRemoteRepository.findDvlaVehicle(vrn, "old-token"));
}
}
/**
* Test to assert that receiving a 401 response from the DVLA API triggers a call
* to get a new auth token and retries the request.
*/
@Test
public void failedAuthenticationTriggersRetry() {
ArrayList<String> vrns = new ArrayList<String> ();
vrns.add("CAS300");
vrns.add("CAS301");
mockDvlaVehicleDetailsEndpointFailure("old-token", "CAS300");
mockDvlaVehicleDetailsEndpointFailure("old-token", "CAS301");
mockDvlaVehicleDetailsEndpointSuccess("new-token", "CAS300");
mockDvlaVehicleDetailsEndpointSuccess("new-token", "CAS301");
mockDvlaAuthEndpointSuccess("test-password");
NtrAndDvlaData ntrAndDvlaData = licenseAndVehicleRemoteRepository
.findLicenseAndVehicle(vrns, "old-token");
assertFalse(
ntrAndDvlaData.dvlaAsyncOps().stream()
.anyMatch(dvlaOp -> dvlaOp.getHttpStatus() != HttpStatus.OK));
}
@Test
public void failedPasswordOnDvlaAuthFetchesPasswordFromSecretsAndAsyncCallRetried() {
ArrayList<String> vrns = new ArrayList<String> ();
vrns.add("CAS300");
vrns.add("CAS301");
mockDvlaVehicleDetailsEndpointFailure("old-token", "CAS300");
mockDvlaVehicleDetailsEndpointFailure("old-token", "CAS301");
mockDvlaVehicleDetailsEndpointSuccess("new-token", "CAS300");
mockDvlaVehicleDetailsEndpointSuccess("new-token", "CAS301");
mockDvlaAuthEndpointFailure("test-password");
mockAwsSecretsCall("dvla-api-password", "new-password");
mockDvlaAuthEndpointSuccess("new-password");
NtrAndDvlaData ntrAndDvlaData = licenseAndVehicleRemoteRepository
.findLicenseAndVehicle(vrns, "old-token");
assertFalse(
ntrAndDvlaData.dvlaAsyncOps().stream()
.anyMatch(dvlaOp -> dvlaOp.getHttpStatus() != HttpStatus.OK));
}
@Test
public void twiceFailedAuthenticationThrowsExternalServiceCallException() {
ArrayList<String> vrns = new ArrayList<String> ();
vrns.add("CAS300");
vrns.add("CAS301");
mockDvlaVehicleDetailsEndpointFailure("old-token", "CAS300");
mockDvlaVehicleDetailsEndpointFailure("old-token", "CAS301");
mockDvlaVehicleDetailsEndpointFailure("new-token", "CAS300");
mockDvlaVehicleDetailsEndpointFailure("new-token", "CAS301");
mockDvlaAuthEndpointSuccess("test-password");
assertThrows(ExternalServiceCallException.class,
() -> licenseAndVehicleRemoteRepository
.findLicenseAndVehicle(vrns, "old-token"));
}
private void mockDvlaVehicleDetailsEndpointFailure(String authToken, String vrn) {
mockServer
.when(HttpRequest.request()
.withPath("/dvla-api/details/")
.withMethod("POST")
.withHeader("Authorization", authToken)
.withBody("{\"registrationNumber\":\"" + vrn + "\"}"))
.respond(HttpResponse.response()
.withStatusCode(401));
}
private void mockDvlaVehicleDetailsEndpointSuccess(String authToken, String vrn) {
mockServer
.when(HttpRequest.request()
.withPath("/dvla-api/details/")
.withMethod("POST")
.withHeader("Authorization", authToken)
.withBody("{\"registrationNumber\":\"" + vrn + "\"}"))
.respond(HttpResponse.response()
.withStatusCode(200)
.withBody("{\"registrationNumber\":\"" + vrn + "\"}",
MediaType.JSON_UTF_8));
}
private void mockDvlaAuthEndpointSuccess(String password) {
mockServer
.when(HttpRequest.request()
.withPath("/dvla-api/authenticate")
.withMethod("POST")
.withBody("{\"userName\":\"test-username\",\"password\":\"" + password + "\"}"))
.respond(HttpResponse.response()
.withBody("{\"id-token\": \"new-token\"}",
MediaType.JSON_UTF_8));
}
private void mockDvlaAuthEndpointFailure(String password) {
mockServer
.when(HttpRequest.request()
.withPath("/dvla-api/authenticate")
.withMethod("POST")
.withBody("{\"userName\":\"test-username\",\"password\":\"" + password + "\"}"))
.respond(HttpResponse.response()
.withStatusCode(401));
}
private void mockAwsSecretsCall(String key, String returnValue) {
Mockito.when(vehicleApiCredentialRotationManager.getRemoteAuthenticationSecretValue(key))
.thenReturn(returnValue);
}
}
| [
"james.cruddas@informed.com"
] | james.cruddas@informed.com |
75ab3394ec2b2b5c0aeaab4969bb31a3d85fc8ae | 886aeca79890e61c0c508b14faa7bb8766381cd9 | /javaland/src/javaland/Account1.java | a4a6428c4e742b6150308bc57c2420cf88637012 | [] | no_license | znld7927/Account | 98aea0c29a44cd405f3c87552ded03e90b574642 | 41e952374d9a7bce23dda0d17470ff4e6bbb26ec | refs/heads/master | 2021-01-22T22:28:09.439912 | 2017-03-20T09:09:39 | 2017-03-20T09:09:39 | 85,546,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 411 | java | package javaland;
public class Account1 {
protected double balance;
public Account1(double s){
balance = s;
}
public double getBalance(){
return balance;
}
public void setBalance(double s){
balance =s;
}
public void credit(double s){
balance = balance + s;
}
public int debit(double s){
balance = balance - s;
return 0;
}
}
| [
"znld6715@gmail.com"
] | znld6715@gmail.com |
c092e0657e721ce12d50c6f9c30bbfe11103cbf1 | 6a6ad44dabbb8eea5a1b12c9eaf9a0a20fc5b886 | /pr2/independentwork/src/main/java/ru/mirea/kuzmin/independentwork/MainActivity.java | 8220bcefb747262ebf9789cbd24d90052df1db3a | [] | no_license | pav1on/practice2 | d7e4cece9f7c450ccd63385f4e4ca2f554bcecf7 | a12a81fa4ad410d2f03a9618d44e41d6ed31f273 | refs/heads/main | 2023-05-04T16:31:22.908893 | 2021-05-31T16:26:11 | 2021-05-31T16:26:11 | 372,564,517 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,376 | java | package ru.mirea.kuzmin.independentwork;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.app.DatePickerDialog;
import android.app.ProgressDialog;
import android.app.TimePickerDialog;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.format.DateUtils;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.TextView;
import android.widget.TimePicker;
import java.util.Calendar;
public class MainActivity extends AppCompatActivity {
Button btn;
private ProgressDialog progress;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn = (Button) findViewById(R.id.btn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
progress = new ProgressDialog(MainActivity.this);
progress.setMax(100);
progress.setMessage("Its Loading....");
progress.setTitle("Download");
progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progress.show();
new Thread(new Runnable() {
@Override
public void run() {
try {
while (progress.getProgress() <= progress.getMax()) {
Thread.sleep(200);
handle.sendMessage(handle.obtainMessage());
if (progress.getProgress() == progress.getMax()) {
progress.dismiss();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
@SuppressLint("HandlerLeak")
Handler handle = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
progress.incrementProgressBy(1);
}
};
});
}
}
| [
"pav1on@mail.ru"
] | pav1on@mail.ru |
a58e60c661f1943e5439fe5d70f1133bfce64f84 | 9acee2a860484e53a8662a36b806b5b8b00dc760 | /app/src/main/java/in/co/thingsdata/gurukul/ui/dataUi/ItemClickSupport.java | 8bf02e1319d0859ab7bccc88a9c54a28709b6e19 | [] | no_license | brewideas/GlobalGuru | c3da1fc2481c991a75ecd3a6ae33043cd84fa452 | 42061d1eaaf56f42c538a822d61d0aff308b71d2 | refs/heads/master | 2021-01-19T13:08:16.824913 | 2017-09-10T02:52:06 | 2017-09-10T02:52:06 | 88,068,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,384 | java | package in.co.thingsdata.gurukul.ui.dataUi;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import in.co.thingsdata.gurukul.R;
/**
* Created by Ritika on 2/14/2017.
*/
public class ItemClickSupport {
private final RecyclerView mRecyclerView;
private OnItemClickListener mOnItemClickListener;
private OnItemLongClickListener mOnItemLongClickListener;
private View.OnClickListener mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mOnItemClickListener != null) {
RecyclerView.ViewHolder holder = mRecyclerView.getChildViewHolder(v);
mOnItemClickListener.onItemClicked(mRecyclerView, holder.getAdapterPosition(), v);
}
}
};
private View.OnLongClickListener mOnLongClickListener = new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
if (mOnItemLongClickListener != null) {
RecyclerView.ViewHolder holder = mRecyclerView.getChildViewHolder(v);
return mOnItemLongClickListener.onItemLongClicked(mRecyclerView, holder.getAdapterPosition(), v);
}
return false;
}
};
private RecyclerView.OnChildAttachStateChangeListener mAttachListener
= new RecyclerView.OnChildAttachStateChangeListener() {
@Override
public void onChildViewAttachedToWindow(View view) {
if (mOnItemClickListener != null) {
view.setOnClickListener(mOnClickListener);
}
if (mOnItemLongClickListener != null) {
view.setOnLongClickListener(mOnLongClickListener);
}
}
@Override
public void onChildViewDetachedFromWindow(View view) {
}
};
private ItemClickSupport(RecyclerView recyclerView) {
mRecyclerView = recyclerView;
mRecyclerView.setTag(R.id.item_click_support, this);
mRecyclerView.addOnChildAttachStateChangeListener(mAttachListener);
}
public static ItemClickSupport addTo(RecyclerView view) {
ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
if (support == null) {
support = new ItemClickSupport(view);
}
return support;
}
public static ItemClickSupport removeFrom(RecyclerView view) {
ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
if (support != null) {
support.detach(view);
}
return support;
}
public ItemClickSupport setOnItemClickListener(OnItemClickListener listener) {
mOnItemClickListener = listener;
return this;
}
public ItemClickSupport setOnItemLongClickListener(OnItemLongClickListener listener) {
mOnItemLongClickListener = listener;
return this;
}
private void detach(RecyclerView view) {
view.removeOnChildAttachStateChangeListener(mAttachListener);
view.setTag(R.id.item_click_support, null);
}
public interface OnItemClickListener {
void onItemClicked(RecyclerView recyclerView, int position, View v);
}
public interface OnItemLongClickListener {
boolean onItemLongClicked(RecyclerView recyclerView, int position, View v);
}
}
| [
"ashugid@gmail.com"
] | ashugid@gmail.com |
16f1f7a926376b4f4f717f84967eccddb317054c | 2dbfb9f581a7ba93f21f937bc18e54a46af14e92 | /src/main/java/com/vodafone/azuremigration/migration/model/request/body/VmUptime.java | 7c83591770bdc813db39c881ce00ac9d0672c95f | [] | no_license | PrabhashM-Hexaware/PrabhashRepo | a63fb7deefdb0a1e1df87767d6653d24b5b7a6bf | 12da157136207aa32c2b53fc5686c5db91372cde | refs/heads/master | 2023-04-27T06:35:37.106744 | 2020-07-21T10:38:08 | 2020-07-21T10:38:08 | 262,084,954 | 0 | 0 | null | 2023-04-14T17:17:43 | 2020-05-07T15:14:46 | Java | UTF-8 | Java | false | false | 303 | java |
package com.vodafone.azuremigration.migration.model.request.body;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Builder
@Getter
@Setter
@ToString
public class VmUptime {
private Integer daysPerMonth;
private Integer hoursPerDay;
}
| [
"mumbainights101@gmail.com"
] | mumbainights101@gmail.com |
686c6c86fea98bfc880b38ad1be08a868561db61 | d28568ab32332befc9386bf493bf9e9452999f5e | /app/src/androidTest/java/com/ford/kcooley8/SYNCController/ApplicationTest.java | ffdb1349a94379cf29be637454949ce2fb7ef9fb | [] | no_license | scottmayberry/SYNC_Controller | f17643d07fd35a2ac1051f77ee130b7366044d3a | feef6ccb7e98dbfb2226306a93a81cbe074c8aa7 | refs/heads/master | 2021-01-01T18:25:34.099191 | 2017-07-25T17:46:06 | 2017-07-25T17:46:06 | 98,334,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package com.ford.kcooley8.SYNCController;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"sctmayberry@gmail.com"
] | sctmayberry@gmail.com |
202a29f677db19bb13262377a23538380101ba63 | 06f9ea2af63dd4f2b053bfcff64df229d1aa58f6 | /Week 13/UsersImpl.java | aba922e70ecf1d2b726d267939386fc59d82b041 | [] | no_license | BBK-PiJ-2016-50/PiJ-Exercises | 036915b7b67eeabbf99d2626d26648f421ad13ef | 1b0060eb0f644e0f2d0098241c6867ea2f20e6c3 | refs/heads/master | 2021-01-11T01:55:00.655374 | 2017-03-21T20:41:23 | 2017-03-21T20:41:23 | 70,837,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 469 | java | public class UsersImpl implements Users {
private String name;
private int libraryID;
private Library lib;
public UsersImpl(String name) {
this.name = name;
}
public String getName() {
return name;
}
public int getLibraryID() {
return libraryID;
}
public int register(Library library) {
this.lib = library;
this.libraryID = lib.getID(this.name);
return this.libraryID;
}
public String getLibrary() {
return lib.getLibName();
}
} | [
"ianrobinson01@hotmail.com"
] | ianrobinson01@hotmail.com |
a5c92d6f134b7e0a265c9959b6bbd330b850434a | d966dac4cef43d17a829d49566d8311924ed78b0 | /bootique/src/main/java/io/bootique/meta/config/ConfigObjectMetadata.java | d525e0850b6a3d92f030b271b79cf97f2c06c945 | [
"Apache-2.0"
] | permissive | cybernetics/bootique | 9296c3a173dc2f11406b1b1f73d0a6a825d3292d | e21a1a3cfdd436c549e8a6b86a04b7e584a88e5c | refs/heads/master | 2021-04-28T21:29:59.319108 | 2016-12-31T08:18:18 | 2016-12-31T12:37:13 | 77,770,325 | 1 | 0 | null | 2017-01-01T07:44:11 | 2017-01-01T07:44:10 | null | UTF-8 | Java | false | false | 3,761 | java | package io.bootique.meta.config;
import java.util.ArrayList;
import java.util.Collection;
import java.util.stream.Stream;
/**
* Descriptor of a configuration object.
*
* @since 0.21
*/
public class ConfigObjectMetadata extends ConfigValueMetadata {
private static final ConfigMetadataVisitor<Stream<ConfigMetadataNode>> SUB_CONFIGS_EXTRACTOR = new ConfigMetadataVisitor<Stream<ConfigMetadataNode>>() {
@Override
public Stream<ConfigMetadataNode> visitObjectMetadata(ConfigObjectMetadata metadata) {
return metadata.getAllSubConfigs();
}
@Override
public Stream<ConfigMetadataNode> visitValueMetadata(ConfigValueMetadata metadata) {
return Stream.empty();
}
@Override
public Stream<ConfigMetadataNode> visitListMetadata(ConfigListMetadata metadata) {
return Stream.empty();
}
@Override
public Stream<ConfigMetadataNode> visitMapMetadata(ConfigMapMetadata metadata) {
return Stream.empty();
}
};
private Collection<ConfigMetadataNode> subConfigs;
private Collection<ConfigMetadataNode> properties;
public ConfigObjectMetadata() {
this.properties = new ArrayList<>();
this.subConfigs = new ArrayList<>();
}
/**
* Returns a builder that starts with an already available object. Occasionally it is useful for the caller to
* provide the initial object, e.g. to cache the instance before the builder is finished to avoid compilation cycles.
*
* @param baseObject an initial object that will be further customized by the builder.
* @return a builder that starts with the provided base object instead of creating a new one.
*/
public static Builder builder(ConfigObjectMetadata baseObject) {
return new Builder(baseObject);
}
public static Builder builder() {
return builder(new ConfigObjectMetadata());
}
public static Builder builder(String name) {
return builder().name(name);
}
@Override
public <T> T accept(ConfigMetadataVisitor<T> visitor) {
return visitor.visitObjectMetadata(this);
}
public Collection<ConfigMetadataNode> getProperties() {
return properties;
}
/**
* Returns subconfigs that directly inherit from this config.
*
* @return subconfigs that directly inherit from this config.
*/
public Collection<ConfigMetadataNode> getSubConfigs() {
return subConfigs;
}
/**
* Returns this config plus all subconfigs that directly or indirectly inherit from this config.
*
* @return this config plus all subconfigs that directly or indirectly inherit from this config.
*/
public Stream<ConfigMetadataNode> getAllSubConfigs() {
if (subConfigs.isEmpty()) {
return Stream.of(this);
}
Stream<ConfigMetadataNode> subconfigs = subConfigs.stream().flatMap(n -> n.accept(SUB_CONFIGS_EXTRACTOR));
return Stream.concat(Stream.of(this), subconfigs);
}
public static class Builder extends ConfigValueMetadata.Builder<ConfigObjectMetadata, Builder> {
public Builder(ConfigObjectMetadata toBuild) {
super(toBuild);
}
public Builder addProperty(ConfigMetadataNode property) {
toBuild.properties.add(property);
return this;
}
public Builder addProperties(Collection<? extends ConfigValueMetadata> properties) {
toBuild.properties.addAll(properties);
return this;
}
public Builder addSubConfig(ConfigMetadataNode subConfig) {
toBuild.subConfigs.add(subConfig);
return this;
}
}
}
| [
"andrus@objectstyle.com"
] | andrus@objectstyle.com |
3b5adcc9fa2423879b774cedeafd30f51bc3ff37 | 36ce551b3af8dba709e47ec3bc60dec75be98f80 | /src/Exercise03/Exercise03_22.java | 6348caf07571f7719560fde777c3ff5c074c0a1a | [
"MIT"
] | permissive | TanayDeo/Introduction-to-Java-Programming | 2edc4e9377183bc07f123f274174612f51a27cec | 0230c83ed347518bea25f082449eba3bf0fb0423 | refs/heads/main | 2023-08-11T14:41:44.595528 | 2021-10-07T12:43:12 | 2021-10-07T12:43:12 | 409,104,971 | 0 | 0 | MIT | 2021-09-22T07:26:14 | 2021-09-22T07:26:14 | null | UTF-8 | Java | false | false | 974 | java | /*
(Geometry: point in a circle?) Write a program that prompts the user to enter a
point (x, y) and checks whether the point is within the circle centered at (0, 0)
with radius 10. For example, (4, 5) is inside the circle and (9, 9) is outside the
circle, as shown in Figure 3.7a.
* @author Kalpesh Mahida
* ID 20CS030
* Email 20cs030@charusat.edu.in
*/
import java.util.Scanner;
public class Exercise_03_22 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// Prompt the user to enter a point
System.out.print("Enter a point with two coordinates: ");
double x = input.nextDouble();
double y = input.nextDouble();
// Check whether the point is within the circle
boolean withinCircle =
(Math.pow(Math.pow(x, 2) + Math.pow(y, 2), 0.5) <= 10);
// Display results
System.out.println("Point (" + x + ", "+ y + ") is " +
((withinCircle) ? "in " : "not in ") + "the circle");
}
}
| [
"noreply@github.com"
] | TanayDeo.noreply@github.com |
4264402450e3aea3a8edfe58779292e6240a232e | 4feec5f45a429c87a6ba34986c739b9109be3669 | /url-shortener/src/main/java/com/knihapaul/urlshortener/web/controller/RegistrationController.java | 429d55e52e5faa5dff694eec85ca363ae659cf19 | [] | no_license | PavelKniha/UrlShortener | f0a5ef736687a73cd1565a0df4272aef36e947f3 | 426e305db7d2708370e99d901fc26acd49a1680e | refs/heads/master | 2021-01-10T16:02:52.123902 | 2016-01-02T15:03:24 | 2016-01-02T15:03:24 | 48,394,151 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,537 | java | package com.knihapaul.urlshortener.web.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.knihapaul.urlshortener.exception.EmailAlreadyExistException;
import com.knihapaul.urlshortener.persistence.model.User;
import com.knihapaul.urlshortener.persistence.service.UserDto;
import com.knihapaul.urlshortener.persistence.service.UserService;
import com.knihapaul.urlshortener.web.util.GenericResponse;
@Controller
public class RegistrationController {
private UserService userService;
@Autowired
public RegistrationController(UserService userService) {
this.userService = userService;
}
@RequestMapping(value = "/user/registration", method = RequestMethod.POST)
@ResponseBody
public GenericResponse registerUser(@Valid UserDto userDto) {
User registered = createNewUser(userDto);
if (registered == null) {
throw new EmailAlreadyExistException("User with email: "
+ userDto.getEmail() + " already exists");
}
return new GenericResponse("success");
}
private User createNewUser(UserDto userDto) {
User user = null;
try {
user = userService.registerNewUser(userDto);
} catch (EmailAlreadyExistException e) {
return null;
}
return user;
}
}
| [
"pozzallo706123@gmail.com"
] | pozzallo706123@gmail.com |
ee78f57c709c2fba27c78275eab4dd7fe6874a52 | ae91ae01254194a67e384090e7ccbe9e73b509bd | /src/com/clov4r/moboplayer/android/nil/library/AudioAndSubtitleSortLib.java | c93ddb3dfd9ea7d8979500c15a3b7f3acda28d1f | [] | no_license | teppi210/MoboVideoViewLibrary | 173650b45c0179820fbcd8581fff3174479c9cce | 9ba7f6ce6cb63016b9ff925d9047ce59f3dac7e0 | refs/heads/master | 2021-01-23T09:15:39.661845 | 2017-04-26T06:05:00 | 2017-04-26T06:05:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 737 | java | package com.clov4r.moboplayer.android.nil.library;
import java.util.Comparator;
public class AudioAndSubtitleSortLib implements Comparator<Object> {
@Override
public int compare(Object arg0, Object arg1) {
// TODO Auto-generated method stub
if (arg0 instanceof LocalSubtitle) {
return compareSubtitle((LocalSubtitle) arg0, (LocalSubtitle) arg1);
} else if (arg0 instanceof LocalAudioInfo) {
return compareAudioTrack((LocalAudioInfo) arg0,
(LocalAudioInfo) arg1);
}
return 0;
}
private int compareSubtitle(LocalSubtitle sub1, LocalSubtitle sub2) {
return sub1.index - sub2.index;
}
private int compareAudioTrack(LocalAudioInfo audio1, LocalAudioInfo audio2) {
return audio1.index - audio2.index;
}
}
| [
"liyanwei@clov4r.com"
] | liyanwei@clov4r.com |
727eb042585766d3bb3768a0bf70b920e448a8f2 | 3f63e69d905c10e0fc54e45ce38cd69ec1239bcc | /viewPager/viewflow-example/src/org/taptwo/android/widget/viewflow/example/TitleViewFlowExample.java | 1927d1422d76694a03bd26322984a3b408468c9f | [] | no_license | Rahul0305/project | 7e354542a88c7a01250522db307777b840483b08 | 3b39cbbefc4af57fd70d8be51a3fdb2106caa66f | refs/heads/master | 2016-09-03T07:15:41.357409 | 2012-08-22T10:19:25 | 2012-08-22T10:19:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,175 | java |
package org.taptwo.android.widget.viewflow.example;
import org.taptwo.android.widget.TitleFlowIndicator;
import org.taptwo.android.widget.ViewFlow;
import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
public class TitleViewFlowExample extends Activity {
private ViewFlow viewFlow;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(R.string.title_title);
setContentView(R.layout.title_layout);
viewFlow = (ViewFlow) findViewById(R.id.viewflow);
AndroidVersionAdapter adapter = new AndroidVersionAdapter(this);
viewFlow.setAdapter(adapter, 3);
TitleFlowIndicator indicator = (TitleFlowIndicator) findViewById(R.id.viewflowindic);
indicator.setTitleProvider(adapter);
viewFlow.setFlowIndicator(indicator);
}
/* If your min SDK version is < 8 you need to trigger the onConfigurationChanged in ViewFlow manually, like this */
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
viewFlow.onConfigurationChanged(newConfig);
}
} | [
"rahulpatel0305@gmail.com"
] | rahulpatel0305@gmail.com |
06f7df4f364fef42bf45fd9bad8ada3cdd8211a0 | fc899a1e26154cf76d3d044179ba43c7e9218436 | /TDD-demostration/1可读性/17outputHasLineNumbers.java | e73999b90e1c8c2fc9703d734f1d9a92639feeb2 | [] | no_license | chwod/mms-application | b39150a9bc2158b783be47f3536642336d34b9bc | a255503ecdc08e402c16193104f361e8e27ad53c | refs/heads/master | 2021-07-24T00:52:55.060989 | 2020-07-08T14:49:45 | 2020-07-08T14:49:45 | 224,956,396 | 7 | 18 | null | 2020-10-13T17:52:34 | 2019-11-30T03:55:18 | JavaScript | UTF-8 | Java | false | false | 292 | java | @Test
public void outputHasLineNumbers() {
String content = "1st match on #1\nand\n2nd match on #3";
String out = grep.grep("match", "test.txt", content);
assertThat(out.indexOf("test.txt:1 1st match"), is(not(-1)));
assertThat(out.indexOf("test.txt:3 2nd match"), is(not(-1)));
} | [
"liuxun@chwod.com"
] | liuxun@chwod.com |
c8e484833e63225025429d0dba8e9340c3377295 | 8d5bffe7e1492bd693c5c4d75e06fa681a3613fc | /pano-web/src/main/java/cn/com/platform/common/quartz/service/JobService.java | 1d37828691fd93aab8effd1da3a40398c47386cc | [] | no_license | tangyoucheng/gradle-multi-pano-git | 2c5fcb65635e1f1d9c307d76a9b97b20b8fb5114 | ad5c1bde3967d7f12d8b7adbf3dfb923e1395461 | refs/heads/master | 2020-07-09T11:04:50.575563 | 2019-12-10T03:43:50 | 2019-12-10T03:43:50 | 203,952,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,952 | java | package cn.com.platform.common.quartz.service;
import javax.annotation.PostConstruct;
import org.quartz.Scheduler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.com.platform.platform.mapper.common01.PlatformJobCron01Mapper;
import cn.com.platform.platform.mapper.common01.PlatformJobRepeat01Mapper;
/**
* job调度信息 服务层
*
* @author ruoyi
*/
@Service
public class JobService {
@Autowired
private Scheduler scheduler;
@Autowired
private PlatformJobCron01Mapper platformJobCron01Mapper;
@Autowired
private PlatformJobRepeat01Mapper platformJobRepeat01Mapper;
/**
* 项目启动时,初始化定时器
*/
@PostConstruct
public void init() {
// 定时任务
// List<PlatformJobF01Dto> jobList = ciszJob01Mapper.selectJobAll();
// for (PlatformJobF01Dto job : jobList) {
// CronTrigger cronTrigger = CronScheduleUtils.getCronTrigger(scheduler, job.getJobId());
// // 如果不存在,则创建
// CronJob cronJob = new CronJob();
// BeanUtils.copyProperties(job, cronJob);
// if (cronTrigger == null) {
// CronScheduleUtils.createScheduleJob(scheduler, cronJob);
// } else {
// CronScheduleUtils.updateScheduleJob(scheduler, cronJob);
// }
// }
// 重复任务
// List<PlatformJobRepeatF01Dto> jobRepeatList = platformJobRepeat01Mapper.selectJobAll();
// for (PlatformJobRepeatF01Dto job : jobRepeatList) {
// SimpleTrigger simpleTrigger = RepeatScheduleUtils.getSimpleTrigger(scheduler, job.getJobId());
// // 如果不存在,则创建
// RepeatJob repeatJob = new RepeatJob();
// BeanUtils.copyProperties(job, repeatJob);
// if (simpleTrigger == null) {
// RepeatScheduleUtils.createScheduleJob(scheduler, repeatJob);
// } else {
// RepeatScheduleUtils.updateScheduleJob(scheduler, repeatJob);
// }
// }
}
}
| [
"tangyoucheng@gmail.com"
] | tangyoucheng@gmail.com |
5c557dbbf64cf00722030dff10af1253fd9d1482 | 9d3a6eadec7daec65561e01e97fd186e6aaa6e1d | /antun-rest-app/src/main/java/com/hblg/bigdata/autun/domain/User.java | 16515f789c5da4296b7f55e5acefd4af1b36d2de | [] | no_license | hubo111/antun-rest-app | 64d73f31d144f55ad2ea37c67eee780ce8b8687d | c4c8d57355d04fd4c4e6ea101c271371ca37979e | refs/heads/master | 2021-08-22T04:47:24.897891 | 2017-11-29T09:49:14 | 2017-11-29T09:49:14 | 112,448,200 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,495 | java | package com.hblg.bigdata.autun.domain;
import java.io.Serializable;
import java.util.Date;
/**
* @author
*/
public class User implements Serializable {
private Long id;
/**
* 创建时间
*/
private Date gmtCreate;
/**
* 修改时间
*/
private Date gmtModified;
/**
* 姓名
*/
private String name;
/**
* 性别
*/
private Integer sex;
private String birth;
private String phone;
private String idNo;
private Long province;
private Long city;
private Long town;
private String channelCode;
private String productCode;
/**
* 0:未发送,1:外发失败(网络原因);2:外发成功,数据有效,3:外发成功,数据无效
*/
private Integer stutus;
/**
* 外发码
*/
private Integer sendCode;
/**
* 外发结果
*/
private String sendResult;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtModified() {
return gmtModified;
}
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public String getBirth() {
return birth;
}
public void setBirth(String birth) {
this.birth = birth;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getIdNo() {
return idNo;
}
public void setIdNo(String idNo) {
this.idNo = idNo;
}
public Long getProvince() {
return province;
}
public void setProvince(Long province) {
this.province = province;
}
public Long getCity() {
return city;
}
public void setCity(Long city) {
this.city = city;
}
public Long getTown() {
return town;
}
public void setTown(Long town) {
this.town = town;
}
public String getChannelCode() {
return channelCode;
}
public void setChannelCode(String channelCode) {
this.channelCode = channelCode;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public Integer getStutus() {
return stutus;
}
public void setStutus(Integer stutus) {
this.stutus = stutus;
}
public Integer getSendCode() {
return sendCode;
}
public void setSendCode(Integer sendCode) {
this.sendCode = sendCode;
}
public String getSendResult() {
return sendResult;
}
public void setSendResult(String sendResult) {
this.sendResult = sendResult;
}
} | [
"949105648@qq.com"
] | 949105648@qq.com |
d5c3aa7a3607e7f8399dcf4191e592f53c1d67fb | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/18/18_ab184cb5bdf99feb83f591fbe810cf394ca2ba36/HeadlinesRequest/18_ab184cb5bdf99feb83f591fbe810cf394ca2ba36_HeadlinesRequest_s.java | c7d65bef47e30853d632f32400b89acc71822230 | [] | 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,351 | java | package org.fox.ttrss.util;
import java.lang.reflect.Type;
import java.util.List;
import org.fox.ttrss.ApiRequest;
import org.fox.ttrss.GlobalState;
import org.fox.ttrss.OnlineActivity;
import org.fox.ttrss.R;
import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.ArticleList;
import android.content.Context;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
public class HeadlinesRequest extends ApiRequest {
public static final int HEADLINES_REQUEST_SIZE = 30;
public static final int HEADLINES_BUFFER_MAX = 500;
private int m_offset = 0;
private OnlineActivity m_activity;
private ArticleList m_articles = GlobalState.getInstance().m_loadedArticles;
public HeadlinesRequest(Context context, OnlineActivity activity) {
super(context);
m_activity = activity;
}
protected void onPostExecute(JsonElement result) {
if (result != null) {
try {
JsonArray content = result.getAsJsonArray();
if (content != null) {
Type listType = new TypeToken<List<Article>>() {}.getType();
final List<Article> articles = new Gson().fromJson(content, listType);
while (m_articles.size() > HEADLINES_BUFFER_MAX)
m_articles.remove(0);
if (m_offset == 0)
m_articles.clear();
else
if (m_articles.get(m_articles.size()-1).id == -1)
m_articles.remove(m_articles.size()-1); // remove previous placeholder
for (Article f : articles)
m_articles.add(f);
if (articles.size() == HEADLINES_REQUEST_SIZE) {
Article placeholder = new Article(-1);
m_articles.add(placeholder);
}
/* if (m_articles.size() == 0)
m_activity.setLoadingStatus(R.string.no_headlines_to_display, false);
else */
m_activity.setLoadingStatus(R.string.blank, false);
return;
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (m_lastError == ApiError.LOGIN_FAILED) {
m_activity.login();
} else {
m_activity.setLoadingStatus(getErrorMessage(), false);
}
}
public void setOffset(int skip) {
m_offset = skip;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
ea4284567d1a3f3da581d620d8300a2ce1b1db78 | 85c87acb93e704602de168a6d390d05be97d94fc | /Exceptions.java | 786f876ebad76b610b3f00769fa696f60f70dba1 | [] | no_license | mreid-moz/haroun | 73b2a04b642cfa9738aeba1ee82a7dd8dc8b9ed9 | 49cb240f0d3ac801cae7b6e55fc2f94de15aa690 | refs/heads/master | 2021-01-01T15:54:47.302145 | 2014-02-24T17:40:59 | 2014-02-24T17:40:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 548 | java | import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Exceptions {
public static Throwable getRootCause(final Throwable throwable) {
List<Throwable> list = new ArrayList<Throwable>();
list.add(throwable);
Throwable cause = throwable.getCause();
while (cause != null && !list.contains(cause)) {
list.add(cause);
cause = cause.getCause();
}
Collections.reverse(list);
return list.get(0);
}
}
| [
"skenny@gmail.com"
] | skenny@gmail.com |
ed79e550a51422b5123b4a7d69105299043ddb17 | c42b765897ef1302fc6191720843b8e4d68b3a8c | /src/main/java/org/imaginea/test/automation/framework/exceptions/TafException.java | 9a2405709590bf082ccd9e0c2841ae51aabbaf09 | [] | no_license | turansedat/taf | b3ce9a759a931809600ff8708ddfb379a91c391e | 08b8893a2ccc4f1e1002d0627fe84332227e0451 | refs/heads/master | 2022-08-04T23:03:00.209314 | 2020-05-20T20:52:52 | 2020-05-20T20:52:52 | 265,542,018 | 0 | 0 | null | 2020-05-20T11:20:02 | 2020-05-20T11:20:01 | null | UTF-8 | Java | false | false | 425 | java | package org.imaginea.test.automation.framework.exceptions;
/**
* Created by varunm on 18-12-2014.
*/
public class TafException extends Exception {
public TafException(){
super();
}
public TafException(Throwable t){
super(t);
}
public TafException(String message){
super(message);
}
public TafException(String message, Throwable t){
super(message, t);
}
}
| [
"mr.varun.menon@gmail.com"
] | mr.varun.menon@gmail.com |
3ed12115eac4ab5fee6cca3aac518364d80d5f29 | 48f2c146d2450a2e7004d97a0df50c952d9c07e3 | /src/main/java/coyote/commons/jdbc/datasource/ReplicationConnection.java | c03f63c49d9c41c8f4dae4bee3c493f684a96f5d | [
"MIT"
] | permissive | sdcote/commons | c0389f7c6544f58508571ddc534012bdbdf5e790 | ab358f66fc1f1418d0e4066481805fc809ce7fa0 | refs/heads/master | 2020-04-12T08:47:02.106934 | 2017-02-23T16:38:21 | 2017-02-23T16:38:21 | 19,671,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,697 | java | package coyote.commons.jdbc.datasource;
import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
import java.sql.Struct;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;
import coyote.commons.Assert;
class ReplicationConnection implements Connection {
private Connection _currentConn;
private final Connection _readWriteConn;
private final Connection _readOnlyConn;
public ReplicationConnection( final Connection readWriteConn, final Connection readOnlyConn ) {
Assert.notNull( readWriteConn, "Connection cannot be null" );
Assert.notNull( readOnlyConn, "Connection cannot be null" );
_readWriteConn = readWriteConn;
_readOnlyConn = readOnlyConn;
_currentConn = _readWriteConn;
}
@Override
public void abort( final Executor executor ) throws SQLException {
_currentConn.abort( executor );
}
@Override
public void clearWarnings() throws SQLException {
_currentConn.clearWarnings();
}
@Override
public void close() throws SQLException {
_readWriteConn.close();
_readOnlyConn.close();
}
@Override
public void commit() throws SQLException {
_currentConn.commit();
}
@Override
public Array createArrayOf( final String typeName, final Object[] elements ) throws SQLException {
return _currentConn.createArrayOf( typeName, elements );
}
@Override
public Blob createBlob() throws SQLException {
return _currentConn.createBlob();
}
@Override
public Clob createClob() throws SQLException {
return _currentConn.createClob();
}
@Override
public NClob createNClob() throws SQLException {
return _currentConn.createNClob();
}
@Override
public SQLXML createSQLXML() throws SQLException {
return _currentConn.createSQLXML();
}
@Override
public Statement createStatement() throws SQLException {
return _currentConn.createStatement();
}
@Override
public Statement createStatement( final int resultSetType, final int resultSetConcurrency ) throws SQLException {
return _currentConn.createStatement( resultSetType, resultSetConcurrency );
}
@Override
public Statement createStatement( final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability ) throws SQLException {
return _currentConn.createStatement( resultSetType, resultSetConcurrency, resultSetHoldability );
}
@Override
public Struct createStruct( final String typeName, final Object[] attributes ) throws SQLException {
return _currentConn.createStruct( typeName, attributes );
}
@Override
public boolean getAutoCommit() throws SQLException {
return _currentConn.getAutoCommit();
}
@Override
public String getCatalog() throws SQLException {
return _currentConn.getCatalog();
}
@Override
public Properties getClientInfo() throws SQLException {
return _currentConn.getClientInfo();
}
@Override
public String getClientInfo( final String name ) throws SQLException {
return _currentConn.getClientInfo( name );
}
@Override
public int getHoldability() throws SQLException {
return _currentConn.getHoldability();
}
@Override
public DatabaseMetaData getMetaData() throws SQLException {
return _currentConn.getMetaData();
}
@Override
public int getNetworkTimeout() throws SQLException {
return _currentConn.getNetworkTimeout();
}
@Override
public String getSchema() throws SQLException {
return _currentConn.getSchema();
}
@Override
public int getTransactionIsolation() throws SQLException {
return _currentConn.getTransactionIsolation();
}
@Override
public Map<String, Class<?>> getTypeMap() throws SQLException {
return _currentConn.getTypeMap();
}
@Override
public SQLWarning getWarnings() throws SQLException {
return _currentConn.getWarnings();
}
@Override
public boolean isClosed() throws SQLException {
return _currentConn.isClosed();
}
@Override
public boolean isReadOnly() throws SQLException {
return _currentConn.isReadOnly();
}
@Override
public boolean isValid( final int timeout ) throws SQLException {
return _currentConn.isValid( timeout );
}
@Override
public boolean isWrapperFor( final Class<?> iface ) throws SQLException {
return _currentConn.isWrapperFor( iface );
}
@Override
public String nativeSQL( final String sql ) throws SQLException {
return _currentConn.nativeSQL( sql );
}
@Override
public CallableStatement prepareCall( final String sql ) throws SQLException {
return _currentConn.prepareCall( sql );
}
@Override
public CallableStatement prepareCall( final String sql, final int resultSetType, final int resultSetConcurrency ) throws SQLException {
return _currentConn.prepareCall( sql, resultSetType, resultSetConcurrency );
}
@Override
public CallableStatement prepareCall( final String sql, final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability ) throws SQLException {
return _currentConn.prepareCall( sql, resultSetType, resultSetConcurrency, resultSetHoldability );
}
@Override
public PreparedStatement prepareStatement( final String sql ) throws SQLException {
return _currentConn.prepareStatement( sql );
}
@Override
public PreparedStatement prepareStatement( final String sql, final int autoGeneratedKeys ) throws SQLException {
return _currentConn.prepareStatement( sql, autoGeneratedKeys );
}
@Override
public PreparedStatement prepareStatement( final String sql, final int resultSetType, final int resultSetConcurrency ) throws SQLException {
return _currentConn.prepareStatement( sql, resultSetType, resultSetConcurrency );
}
@Override
public PreparedStatement prepareStatement( final String sql, final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability ) throws SQLException {
return _currentConn.prepareStatement( sql, resultSetType, resultSetConcurrency, resultSetHoldability );
}
@Override
public PreparedStatement prepareStatement( final String sql, final int[] columnIndexes ) throws SQLException {
return _currentConn.prepareStatement( sql, columnIndexes );
}
@Override
public PreparedStatement prepareStatement( final String sql, final String[] columnNames ) throws SQLException {
return _currentConn.prepareStatement( sql, columnNames );
}
@Override
public void releaseSavepoint( final Savepoint savepoint ) throws SQLException {
_currentConn.releaseSavepoint( savepoint );
}
@Override
public void rollback() throws SQLException {
_currentConn.rollback();
}
@Override
public void rollback( final Savepoint savepoint ) throws SQLException {
_currentConn.rollback();
}
@Override
public void setAutoCommit( final boolean autoCommit ) throws SQLException {
_currentConn.setAutoCommit( autoCommit );
}
@Override
public void setCatalog( final String catalog ) throws SQLException {
_currentConn.setCatalog( catalog );
}
@Override
public void setClientInfo( final Properties properties ) throws SQLClientInfoException {
_currentConn.setClientInfo( properties );
}
@Override
public void setClientInfo( final String name, final String value ) throws SQLClientInfoException {
_currentConn.setClientInfo( name, value );
}
@Override
public void setHoldability( final int holdability ) throws SQLException {
_currentConn.setHoldability( holdability );
}
@Override
public void setNetworkTimeout( final Executor executor, final int milliseconds ) throws SQLException {
_currentConn.setNetworkTimeout( executor, milliseconds );
}
@Override
public void setReadOnly( final boolean readOnly ) throws SQLException {
if ( readOnly ) {
if ( _currentConn != _readOnlyConn ) {
switchToConnection( _readOnlyConn );
}
} else {
if ( _currentConn != _readWriteConn ) {
switchToConnection( _readWriteConn );
}
}
_currentConn.setReadOnly( readOnly );
}
@Override
public Savepoint setSavepoint() throws SQLException {
return _currentConn.setSavepoint();
}
@Override
public Savepoint setSavepoint( final String name ) throws SQLException {
return _currentConn.setSavepoint( name );
}
@Override
public void setSchema( final String schema ) throws SQLException {
_currentConn.setSchema( schema );
}
@Override
public void setTransactionIsolation( final int level ) throws SQLException {
_currentConn.setTransactionIsolation( level );
}
@Override
public void setTypeMap( final Map<String, Class<?>> map ) throws SQLException {
_currentConn.setTypeMap( map );
}
private void switchToConnection( final Connection connection ) throws SQLException {
connection.setAutoCommit( _currentConn.getAutoCommit() );
connection.setCatalog( _currentConn.getCatalog() );
connection.setTransactionIsolation( _currentConn.getTransactionIsolation() );
_currentConn = connection;
}
@Override
@SuppressWarnings("unchecked")
public <T> T unwrap( final Class<T> iface ) throws SQLException {
return (T)_currentConn;
}
}
| [
"sdcote@gmail.com"
] | sdcote@gmail.com |
b4dce1015cd409c3ce9d1d4b581a2c4e793f0a82 | 9848b4476db71b779614bea50a3b3cd9719fc1ff | /src/main/java/com/example/restapp/controller/DetailsController.java | 63b1e84d45f74133434a2135d0dcd97293ee8d3d | [] | no_license | harsha-sira/dynamodb-springboot-app | 27365fa0a56f2aaa7c7560aff8b4542d3858494d | b158b7235a0432596cca6d2c54a350bf8ef3c6c4 | refs/heads/master | 2020-09-12T03:09:55.394350 | 2019-12-26T16:51:20 | 2019-12-26T16:51:20 | 222,282,889 | 0 | 0 | null | 2019-12-26T16:51:21 | 2019-11-17T17:08:21 | Java | UTF-8 | Java | false | false | 1,892 | java | package com.example.restapp.controller;
import com.amazonaws.util.StringUtils;
import com.example.restapp.model.Banks;
import com.example.restapp.model.ExRateSubscription;
import com.example.restapp.model.UserDetails;
import com.example.restapp.repo.BankRepository;
import com.example.restapp.repo.ExRateSubscriptionRepository;
import com.example.restapp.repo.UserDetailsRepository;
import com.example.restapp.utils.ResponseWrapper;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@RestController
@RequestMapping("/api/v1/users/")
public class DetailsController {
private UserDetailsRepository userDetailsRepository;
public DetailsController(UserDetailsRepository userDetailsRepository) {
this.userDetailsRepository = userDetailsRepository;
}
/*
getting all user details
*/
@RequestMapping("/all")
public ResponseWrapper<List<UserDetails>> getAllUserDetails()
{
Iterable<UserDetails> allBanks = userDetailsRepository.findAll();
List<UserDetails> users = new ArrayList<>();
for (UserDetails user:allBanks) {
users.add(user);
}
return new ResponseWrapper<>(users, HttpStatus.OK);
}
/*
adding user details
*/
@CrossOrigin
@PostMapping("/add")
public ResponseWrapper<UserDetails> addBank(@RequestBody UserDetails userDetails)
{
UserDetails user = userDetailsRepository.save(userDetails);
return new ResponseWrapper<>(user,HttpStatus.OK);
}
/*
gets the bank counts;
*/
@RequestMapping("/count")
public ResponseWrapper<String> getUsersCount()
{
long count = userDetailsRepository.count();
return new ResponseWrapper<>(String.valueOf(count),HttpStatus.OK);
}
}
| [
"harshasandamal100@gmail.com"
] | harshasandamal100@gmail.com |
c239c20cb1c3398c80ae4e19e9a5a7960a911edc | 81a9ab25c865f3c5a8005c0d95fa56b9444008f8 | /yx-service/yx-sys/yx-sys-model/src/main/java/com/yx/sys/model/SysSmsLog.java | ab530a22c4ca7f67108f4f59489c2f07e9204ce7 | [
"Apache-2.0"
] | permissive | VTracyHuang/yx-framework | 020cae74ae82a9dc45430f2d79c1ef7d8504c8bd | 8a51229fbd3ffae381f3d1a45a4f71d3375167a9 | refs/heads/master | 2023-04-29T13:24:32.911429 | 2020-01-09T11:46:00 | 2020-01-09T11:46:00 | 255,297,898 | 0 | 0 | Apache-2.0 | 2023-03-27T22:22:06 | 2020-04-13T10:39:37 | JavaScript | UTF-8 | Java | false | false | 1,895 | java | package com.yx.sys.model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.yx.common.core.base.BaseModel;
/**
* <p>
* 发送短信记录表
* </p>
*
* @author TangHuaLiang
* @since 2018-07-19
*/
@TableName("sys_sms_log")
public class SysSmsLog extends BaseModel {
private static final long serialVersionUID = 1L;
/**
* 接收短信用户id
*/
@TableField("user_id")
private Long userId;
/**
* 手机号
*/
@TableField("phone")
private Long phone;
/**
* 业务id
*/
@TableField("bus_id")
private Long busId;
/**
* 验证码
*/
@TableField("vcode")
private Long vcode;
/**
* 类型:1:验证码类型,2:发标类型,3:还款类型,4:收益类型,5:逾期类型,6:垫付类型
*/
@TableField("type")
private Integer type;
/**
* 短信内容
*/
@TableField("message")
private String message;
public Long getBusId() {
return busId;
}
public void setBusId(Long busId) {
this.busId = busId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getPhone() {
return phone;
}
public void setPhone(Long phone) {
this.phone = phone;
}
public Long getVcode() {
return vcode;
}
public void setVcode(Long vcode) {
this.vcode = vcode;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String toString() {
return "SysSmsLog{" +
", userId=" + userId +
", phone=" + phone +
", vcode=" + vcode +
", type=" + type +
", message=" + message +
"}";
}
}
| [
"993213thl"
] | 993213thl |
d8760406f1bf1ead39fee35d27faa4aad81a2892 | aad82f53c79bb1b0fa0523ca0b9dd18d8f39ec6d | /Alan M Shaji/29-Jan/qstn3.java | de6ec1f62912bee5d28f2b862e08959e3e0a842e | [] | no_license | Cognizant-Training-Coimbatore/Lab-Excercise-Batch-2 | 54b4d87238949f3ffa0b3f0209089a1beb93befe | 58d65b309377b1b86a54d541c3d1ef5acb868381 | refs/heads/master | 2020-12-22T06:12:23.330335 | 2020-03-17T12:32:29 | 2020-03-17T12:32:29 | 236,676,704 | 1 | 0 | null | 2020-10-13T19:56:02 | 2020-01-28T07:00:34 | Java | UTF-8 | Java | false | false | 446 | java | package apache;
interface father
{
public void XY();
}
interface mother
{
public void XX();
}
class Child implements father, mother
{
public void XX()
{
System.out.println("Mother's XX");
}
public void XY()
{
System.out.println("Father's XY");
}
}public class qstn3 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Child obj=new Child();
obj.XY();
obj.XX();
}
} | [
"noreply@github.com"
] | Cognizant-Training-Coimbatore.noreply@github.com |
8431b40ffe60bbc2586bacc20204954b1a1edc8b | 017f9ad113ce17ad194850e7143b53a8f378eeee | /src/main/java/ma/ensa/dao/DemandeAttestationDao.java | 5960aeaed095db9cebf8754bbc63efeb61e0d7d3 | [] | no_license | elabsi/RH_BackEnd | 67372bfe5c1daca1288743d0f00c0ed3fc41f732 | 43ded0f99324fd9515d2e6b7d9577819961935ed | refs/heads/master | 2022-01-28T21:13:08.561569 | 2019-06-16T23:11:33 | 2019-06-16T23:11:33 | 183,769,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | package ma.ensa.dao;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import ma.ensa.entities.Collaborateur;
import ma.ensa.entities.DemandeAttestation;
public interface DemandeAttestationDao extends JpaRepository<DemandeAttestation, Long>{
public List<DemandeAttestation> findByCollaborateur(Collaborateur c);
}
| [
"redouanmkdem@gmail.com"
] | redouanmkdem@gmail.com |
2e63716abc01fe70d4f6fce2834d5e78adee825c | 2cc4f993ec641e3d58792765e659bf4ced18bff8 | /app/src/main/java/com/bawei/redchild/home/H_Frag_nbu1.java | 7eae2383a4cf7fbb7820553d5594460de6a8bf08 | [] | no_license | BringEveryAimRise/RedChild5 | e4bb5b0ff9cde2f6287b4a14962787cbeb350a56 | f7600d7ff91cb57b493c271c576b71fa66a91e73 | refs/heads/master | 2021-01-23T02:06:11.187648 | 2017-05-31T12:53:28 | 2017-05-31T12:53:28 | 92,908,014 | 0 | 4 | null | 2017-05-31T10:40:21 | 2017-05-31T05:31:32 | Java | UTF-8 | Java | false | false | 2,557 | java | package com.bawei.redchild.home;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bawei.redchild.MainActivity;
import com.bawei.redchild.R;
import com.bawei.redchild.home.baseadapter.H_recyview_adapter;
import com.bawei.redchild.home.bean.Home_frag1_bena_nbu;
import com.bawei.redchild.home.h_url_f1.Gsons;
import com.bawei.redchild.home.h_url_f1.Tianhenxian;
import com.bawei.redchild.home.h_url_f1.Url;
import com.bumptech.glide.Glide;
import com.squareup.okhttp.Request;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.callback.StringCallback;
import java.util.List;
import static android.R.attr.id;
import static android.R.id.list;
/**
*日期:2017/5/31
* 时间:9:32
* 作者:高伟振
*类描述:复用的fragment
*/
public class H_Frag_nbu1 extends Fragment {
public String path;
private RecyclerView review_home_nbuxs;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View inflate = inflater.inflate(R.layout.h__frag_nbu1, container, false);
review_home_nbuxs= (RecyclerView) inflate.findViewById(R.id.recview_home_nbuxs);
review_home_nbuxs.setLayoutManager(new LinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false));
initview1();
return inflate;
}
private void initview1() {
OkHttpUtils.get().url(Url.jsonpath+path).build().execute(new StringCallback() {
@Override
public void onError(Request request, Exception e) {
}
@Override
public void onResponse(String response) {
Home_frag1_bena_nbu home_frag1_bena_nbu = Gsons.GetGsonfrom(response, Home_frag1_bena_nbu.class);
List<Home_frag1_bena_nbu.DataBean> data = home_frag1_bena_nbu.getData();
H_recyview_adapter h_recyview_adapter = new H_recyview_adapter(data, getActivity());
review_home_nbuxs.setAdapter(h_recyview_adapter);
review_home_nbuxs.addItemDecoration(new Tianhenxian(getActivity(),Tianhenxian.VERTICAL_LIST));
}
});
}
}
| [
"bringeveryaimrise@outlook.com"
] | bringeveryaimrise@outlook.com |
2167ce164539cb317e8abf56c50eea7472113fa2 | 8c8a8c449ea396bf6f216c0e786fae205055d32b | /LibAsync/src/main/java/com/mar/lib/async/rxjava/internal/util/AppendOnlyLinkedArrayList.java | fe375377d852fe86dcc2fcd683931217d808478f | [] | no_license | malibo1123/MarLib | 2bf59c9205b0574673b85929dbd077318be4839f | a72c5fd5e127cd6c490c8f043e7ea1fabea5b1da | refs/heads/master | 2022-01-07T09:07:10.035811 | 2019-05-29T09:48:49 | 2019-05-29T09:48:49 | 106,175,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,396 | java | /**
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
* the License for the specific language governing permissions and limitations under the License.
*/
package com.mar.lib.async.rxjava.internal.util;
import org.reactivestreams.Subscriber;
import com.mar.lib.async.rxjava.Observer;
import com.mar.lib.async.rxjava.functions.*;
/**
* A linked-array-list implementation that only supports appending and consumption.
*
* @param <T> the value type
*/
public class AppendOnlyLinkedArrayList<T> {
final int capacity;
final Object[] head;
Object[] tail;
int offset;
/**
* Constructs an empty list with a per-link capacity.
* @param capacity the capacity of each link
*/
public AppendOnlyLinkedArrayList(int capacity) {
this.capacity = capacity;
this.head = new Object[capacity + 1];
this.tail = head;
}
/**
* Append a non-null value to the list.
* <p>Don't add null to the list!
* @param value the value to append
*/
public void add(T value) {
final int c = capacity;
int o = offset;
if (o == c) {
Object[] next = new Object[c + 1];
tail[c] = next;
tail = next;
o = 0;
}
tail[o] = value;
offset = o + 1;
}
/**
* Set a value as the first element of the list.
* @param value the value to set
*/
public void setFirst(T value) {
head[0] = value;
}
/**
* Predicate interface suppressing the exception.
*
* @param <T> the value type
*/
public interface NonThrowingPredicate<T> extends Predicate<T> {
@Override
boolean test(T t);
}
/**
* Loops over all elements of the array until a null element is encountered or
* the given predicate returns true.
* @param consumer the consumer of values that returns true if the forEach should terminate
*/
@SuppressWarnings("unchecked")
public void forEachWhile(NonThrowingPredicate<? super T> consumer) {
Object[] a = head;
final int c = capacity;
while (a != null) {
for (int i = 0; i < c; i++) {
Object o = a[i];
if (o == null) {
break;
}
if (consumer.test((T)o)) {
break;
}
}
a = (Object[])a[c];
}
}
/**
* Interprets the contents as NotificationLite objects and calls
* the appropriate Subscriber method.
*
* @param <U> the target type
* @param subscriber the subscriber to emit the events to
* @return true if a terminal event has been reached
*/
public <U> boolean accept(Subscriber<? super U> subscriber) {
Object[] a = head;
final int c = capacity;
while (a != null) {
for (int i = 0; i < c; i++) {
Object o = a[i];
if (o == null) {
break;
}
if (NotificationLite.acceptFull(o, subscriber)) {
return true;
}
}
a = (Object[])a[c];
}
return false;
}
/**
* Interprets the contents as NotificationLite objects and calls
* the appropriate Observer method.
*
* @param <U> the target type
* @param observer the observer to emit the events to
* @return true if a terminal event has been reached
*/
public <U> boolean accept(Observer<? super U> observer) {
Object[] a = head;
final int c = capacity;
while (a != null) {
for (int i = 0; i < c; i++) {
Object o = a[i];
if (o == null) {
break;
}
if (NotificationLite.acceptFull(o, observer)) {
return true;
}
}
a = (Object[])a[c];
}
return false;
}
/**
* Loops over all elements of the array until a null element is encountered or
* the given predicate returns true.
* @param <S> the extra state type
* @param state the extra state passed into the consumer
* @param consumer the consumer of values that returns true if the forEach should terminate
* @throws Exception if the predicate throws
*/
@SuppressWarnings("unchecked")
public <S> void forEachWhile(S state, BiPredicate<? super S, ? super T> consumer) throws Exception {
Object[] a = head;
final int c = capacity;
for (;;) {
for (int i = 0; i < c; i++) {
Object o = a[i];
if (o == null) {
return;
}
if (consumer.test(state, (T)o)) {
return;
}
}
a = (Object[])a[c];
}
}
}
| [
"malibo@douyu.tv"
] | malibo@douyu.tv |
bc4710940938a2ad37576d0d035eb83886e9b3f8 | 7857270be2044a48746716387e48f58e9cd5d014 | /app/src/main/java/com/baelight/weatherartist/util/ApkUpdateAgent.java | 0ed805c345e3df8538a59b39ca565e839f018012 | [
"MIT"
] | permissive | nicktogo/WeatherArtist | c880f8d90258a3c240b196604fc8e26efcd6c825 | 784fff3541bce0230393cab98178bbaa67e1497a | refs/heads/master | 2020-12-25T17:26:02.547947 | 2018-02-08T01:06:00 | 2018-02-08T01:06:00 | 35,531,510 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,784 | java | package com.baelight.weatherartist.util;
import android.app.Activity;
import android.app.DialogFragment;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import com.baelight.weatherartist.BuildConfig;
import com.baelight.weatherartist.MyApplication;
import com.baelight.weatherartist.R;
import com.baelight.weatherartist.fragment.UpdateFragment;
import com.baelight.weatherartist.model.Update;
import java.util.List;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.listener.FindListener;
/**
* Created by nick on 2016/3/4.
*/
public class ApkUpdateAgent {
public static final String URL_PREFIX = "http://file.bmob.cn/";
public static void update(final Activity activity) {
BmobQuery<Update> queryUpdate = new BmobQuery<>();
queryUpdate.addWhereGreaterThan(Update.VERSION_CODE, BuildConfig.VERSION_CODE);
queryUpdate.setLimit(1);
queryUpdate.findObjects(MyApplication.getContext(), new FindListener<Update>() {
@Override
public void onSuccess(List<Update> list) {
for (Update update : list) {
DialogFragment updateFragment = new UpdateFragment();
Bundle bundle = new Bundle();
bundle.putString(activity.getString(R.string.new_update_url), URL_PREFIX + update.getApk().getUrl());
bundle.putString(activity.getString(R.string.new_update_msg), update.getUpdateMsg());
updateFragment.setArguments(bundle);
updateFragment.show(activity.getFragmentManager(), "");
}
}
@Override
public void onError(int i, String s) {
Log.i("ApkUpdateAgent", s);
}
});
}
}
| [
"findnick@163.com"
] | findnick@163.com |
81d552e147597a833b6839ede0d8818f724e7d28 | 5a116ccded5f8fbc4b76b37eb6ba31e54a0ab00b | /oncecenter-common-utils/src/main/java/com/treefintech/b2b/oncecenter/common/utils/BankCardNoUtil.java | 97cd0e796b5153ed5fdb6ac7daae5bab274ebaac | [] | no_license | FanFanFan37/one-peace-oncecenter | 4bcae8e50169ae414d8d1c696b4048b19d70dc57 | 0a5760f65809acea96d39c9fa6f6fe46787694da | refs/heads/master | 2023-07-07T01:26:59.443152 | 2019-10-22T13:12:09 | 2019-10-22T13:12:09 | 197,860,014 | 0 | 0 | null | 2021-08-13T15:33:33 | 2019-07-20T00:42:04 | Java | UTF-8 | Java | false | false | 3,593 | java | package com.treefintech.b2b.oncecenter.common.utils;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.InputStream;
/**
* 支付宝接口---根据银行卡号获取银行编码
* @author whb
* @date 2018年9月28日 下午3:31:12
* @Description: 根据银行卡号获取对应的银行变化如:ICBC
* https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardBinCheck=true&cardNo=6217360599000454941
* {"cardType":"DC","bank":"ZJNX","key":"6217360599000454941","messages":[],"validated":true,"stat":"ok"}
*/
public class BankCardNoUtil {
private static Logger log = LoggerFactory.getLogger(BankCardNoUtil.class);
private static CloseableHttpClient httpClient = HttpClients.createDefault();
private static int TIMEOUT = 1800000;
private static RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(TIMEOUT)
.setSocketTimeout(TIMEOUT).build();
private static String RequestUrl = "https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardBinCheck=true&cardNo=";
/**
* 根据银行卡号获取对应的银行变化如:ICBC
*
* @param bankCardId
* @return
*/
public static String getBankCardNo(String bankCardId) {
try {
String result = getString(RequestUrl + bankCardId, "UTF-8");
System.out.println("getBankCardNo for result = " + result);
} catch (Exception e) {
log.info("获取银行卡有误");
}
return null;
}
public static void main(String[] args) {
System.out.println(BankCardNoUtil.getBankCardNo("6217360599000454941"));
}
/**
* get方式调用http,返回byte[]
*
* @param String url
* @return byte[]
* @throws Exception
*/
private static byte[] getBytes(String url) throws Exception {
HttpGet request = null;
try {
// HTTP请求
request = new HttpGet(url);
request.setConfig(requestConfig);
log.debug(request.getRequestLine().toString());
// 发送请求,返回响应
HttpResponse response = httpClient.execute(request);
// 响应成功
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == HttpStatus.SC_OK) {
InputStream stream = response.getEntity().getContent();
return IOUtils.toByteArray(stream);
}
} catch (Exception e) {
throw new Exception("GET请求失败:[" + url + "]", e);
} finally {
if (request != null) {
try {
request.releaseConnection();
} catch (Exception e) {
}
}
}
return null;
}
/**
* get方式调用http,返回String
*
* @param String url
* @param String charsetName
* @return String
* @throws Exception
*/
private static String getString(String url, String charsetName) throws Exception {
byte[] bytes = getBytes(url);
if (bytes == null || bytes.length <= 0) {
return "";
}
return new String(bytes, charsetName);
}
}
| [
"zhangfan@treefinance.com.cn"
] | zhangfan@treefinance.com.cn |
7d06efaf8a71bc4f85bd58eb83aafb490c215f8b | 32f38cd53372ba374c6dab6cc27af78f0a1b0190 | /app/src/main/java/com/alipay/mobile/liteprocess/rpc/RpcCall.java | b6ca10ec4f6edb74ec826af4177d7601e9efbf6a | [] | no_license | shuixi2013/AmapCode | 9ea7aefb42e0413f348f238f0721c93245f4eac6 | 1a3a8d4dddfcc5439df8df570000cca12b15186a | refs/heads/master | 2023-06-06T23:08:57.391040 | 2019-08-29T04:36:02 | 2019-08-29T04:36:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 110 | java | package com.alipay.mobile.liteprocess.rpc;
public interface RpcCall {
CallRet call(CallArgs callArgs);
}
| [
"hubert.yang@nf-3.com"
] | hubert.yang@nf-3.com |
36ffe470ca144bd24a1a1d1722ff1e2f5b8998d8 | 62fbdb2171719b12f8b08ac8716a43d1ed914623 | /src/by/it/naryshkin/calc/PathCreator.java | 59bead1d454dbe631f165ace6976c483b9874402 | [] | no_license | DmitryMarus/JD2021-04-21 | 2eea39f1658ff639326c35b4acdda2f079aa74e4 | 7b83a62133dd978a7751517843f096fae43aedf2 | refs/heads/master | 2023-06-10T21:22:51.794722 | 2021-07-06T21:00:47 | 2021-07-06T21:00:47 | 365,497,418 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package by.it.naryshkin.calc;
import java.io.File;
class PathCreator {
public static final String USER_DIR = "user.dir";
public static final String SRC = "src";
private PathCreator() {
}
static String getFileName(Class<?> aClass, String filename) {
String root = System.getProperty(USER_DIR);
String path = aClass
.getName()
.replace(aClass.getSimpleName(), "")
.replace(".", File.separator);
return root + File.separator + SRC + File.separator + path + filename;
}
}
| [
"narishun@gmail.com"
] | narishun@gmail.com |
2eff47ca4cdd0cc7a5d843258fe0153aba094b46 | e20603415d0b3eb92df89c4c7e869a23a4028bb0 | /thirdparty/sscf_calendarview/src/main/java/com/sscf/askstock/calendarview/CalendarLayout.java | d5b4c72962ddfcf00d7f2314fef4f15046e9ae60 | [] | no_license | yibing0703/NF_Threeparty09 | ea2bb8b98ed0cdca4e2eda0f9f77bb5c096e88cc | c1e7ef3bfade3b7a2051560dc25ad108faa85ea5 | refs/heads/master | 2022-02-15T08:31:20.095352 | 2019-09-16T05:16:00 | 2019-09-16T05:16:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 28,481 | java | /*
* Copyright (C) 2016 huanghaibin_dev <huanghaibin_dev@163.com>
* WebSite https://github.com/MiracleTimes-Dev
* 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.sscf.askstock.calendarview;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.Nullable;
import android.support.v4.view.MotionEventCompat;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import android.widget.AbsListView;
import android.widget.LinearLayout;
/**
* 日历布局
*/
@SuppressWarnings("unused")
public class CalendarLayout extends LinearLayout {
/**
* 多点触控支持
*/
private int mActivePointerId;
private static final int ACTIVE_POINTER = 1;
private static final int INVALID_POINTER = -1;
/**
* 周月视图
*/
private static final int CALENDAR_SHOW_MODE_BOTH_MONTH_WEEK_VIEW = 0;
/**
* 仅周视图
*/
private static final int CALENDAR_SHOW_MODE_ONLY_WEEK_VIEW = 1;
/**
* 仅月视图
*/
private static final int CALENDAR_SHOW_MODE_ONLY_MONTH_VIEW = 2;
/**
* 默认展开
*/
private static final int STATUS_EXPAND = 0;
/**
* 默认收缩
*/
private static final int STATUS_SHRINK = 1;
/**
* 默认状态
*/
private int mDefaultStatus;
private boolean isWeekView;
/**
* 星期栏
*/
WeekBar mWeekBar;
/**
* 自定义ViewPager,月视图
*/
MonthViewPager mMonthView;
/**
* 自定义的周视图
*/
WeekViewPager mWeekPager;
/**
* 年视图
*/
YearViewPager mYearView;
/**
* ContentView
*/
ViewGroup mContentView;
/**
* 默认手势
*/
private static final int GESTURE_MODE_DEFAULT = 0;
// /**
// * 仅日历有效
// */
// private static final int GESTURE_MODE_ONLY_CALENDAR = 1;
/**
* 禁用手势
*/
private static final int GESTURE_MODE_DISABLED = 2;
/**
* 手势模式
*/
private int mGestureMode;
private int mCalendarShowMode;
private int mTouchSlop;
private int mContentViewTranslateY; //ContentView 可滑动的最大距离距离 , 固定
private int mViewPagerTranslateY = 0;// ViewPager可以平移的距离,不代表mMonthView的平移距离
private float downY;
private float mLastY;
private boolean isAnimating = false;
/**
* 内容布局id
*/
private int mContentViewId;
/**
* 手速判断
*/
private VelocityTracker mVelocityTracker;
private int mMaximumVelocity;
private int mItemHeight;
private CalendarViewDelegate mDelegate;
public CalendarLayout(Context context, AttributeSet attrs) {
super(context, attrs);
setOrientation(LinearLayout.VERTICAL);
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.CalendarLayout);
mContentViewId = array.getResourceId(R.styleable.CalendarLayout_calendar_content_view_id, 0);
mDefaultStatus = array.getInt(R.styleable.CalendarLayout_default_status, STATUS_EXPAND);
mCalendarShowMode = array.getInt(R.styleable.CalendarLayout_calendar_show_mode, CALENDAR_SHOW_MODE_BOTH_MONTH_WEEK_VIEW);
mGestureMode = array.getInt(R.styleable.CalendarLayout_gesture_mode, GESTURE_MODE_DEFAULT);
array.recycle();
mVelocityTracker = VelocityTracker.obtain();
final ViewConfiguration configuration = ViewConfiguration.get(context);
mTouchSlop = configuration.getScaledTouchSlop();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}
/**
* 初始化
*
* @param delegate delegate
*/
final void setup(CalendarViewDelegate delegate) {
this.mDelegate = delegate;
mItemHeight = mDelegate.getCalendarItemHeight();
initCalendarPosition(delegate.mSelectedCalendar.isAvailable() ?
delegate.mSelectedCalendar :
delegate.createCurrentDate());
updateContentViewTranslateY();
}
/**
* 初始化当前时间的位置
*
* @param cur 当前日期时间
*/
private void initCalendarPosition(Calendar cur) {
int diff = CalendarUtil.getMonthViewStartDiff(cur, mDelegate.getWeekStart());
int size = diff + cur.getDay() - 1;
updateSelectPosition(size);
}
/**
* 当前第几项被选中,更新平移量
*
* @param selectPosition 月视图被点击的position
*/
final void updateSelectPosition(int selectPosition) {
int line = (selectPosition + 7) / 7;
mViewPagerTranslateY = (line - 1) * mItemHeight;
}
/**
* 设置选中的周,更新位置
*
* @param week week
*/
final void updateSelectWeek(int week) {
mViewPagerTranslateY = (week - 1) * mItemHeight;
}
/**
* 更新内容ContentView可平移的最大距离
*/
void updateContentViewTranslateY() {
Calendar calendar = mDelegate.mIndexCalendar;
if (mDelegate.getMonthViewShowMode() == CalendarViewDelegate.MODE_ALL_MONTH) {
mContentViewTranslateY = 5 * mItemHeight;
} else {
mContentViewTranslateY = CalendarUtil.getMonthViewHeight(calendar.getYear(), calendar.getMonth(), mItemHeight, mDelegate.getWeekStart())
- mItemHeight;
}
//已经显示周视图,则需要动态平移contentView的高度
if (mWeekPager.getVisibility() == VISIBLE) {
if (mContentView == null)
return;
mContentView.setTranslationY(-mContentViewTranslateY);
}
}
/**
* 更新日历项高度
*/
final void updateCalendarItemHeight() {
mItemHeight = mDelegate.getCalendarItemHeight();
if (mContentView == null)
return;
Calendar calendar = mDelegate.mIndexCalendar;
updateSelectWeek(CalendarUtil.getWeekFromDayInMonth(calendar, mDelegate.getWeekStart()));
if (mDelegate.getMonthViewShowMode() == CalendarViewDelegate.MODE_ALL_MONTH) {
mContentViewTranslateY = 5 * mItemHeight;
} else {
mContentViewTranslateY = CalendarUtil.getMonthViewHeight(calendar.getYear(), calendar.getMonth(),
mItemHeight, mDelegate.getWeekStart()) - mItemHeight;
}
translationViewPager();
if (mWeekPager.getVisibility() == VISIBLE) {
mContentView.setTranslationY(-mContentViewTranslateY);
}
}
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(MotionEvent event) {
if (mDelegate.isShowYearSelectedLayout) {
return false;
}
if (mContentView == null) {
return false;
}
int action = event.getAction();
float y = event.getY();
mVelocityTracker.addMovement(event);
switch (action) {
case MotionEvent.ACTION_DOWN:
int index = MotionEventCompat.getActionIndex(event);
mActivePointerId = MotionEventCompat.getPointerId(event, index);
mLastY = downY = y;
return true;
case MotionEventCompat.ACTION_POINTER_DOWN: {
final int indexx = MotionEventCompat.getActionIndex(event);
mActivePointerId = MotionEventCompat.getPointerId(event, indexx);
if (mActivePointerId == 0) {
//核心代码:就是让下面的 dy = y- mLastY == 0,避免抖动
mLastY = MotionEventCompat.getY(event, mActivePointerId);
}
break;
}
case MotionEvent.ACTION_MOVE:
if (mGestureMode == GESTURE_MODE_DISABLED ||
mCalendarShowMode == CALENDAR_SHOW_MODE_ONLY_MONTH_VIEW ||
mCalendarShowMode == CALENDAR_SHOW_MODE_ONLY_WEEK_VIEW) {//禁用手势,或者只显示某种视图
return false;
}
getPointerIndex(event, mActivePointerId);
if (mActivePointerId == INVALID_POINTER) {
//如果切换了手指,那把mLastY换到最新手指的y坐标即可,核心就是让下面的 dy== 0,避免抖动
mLastY = y;
mActivePointerId = ACTIVE_POINTER;
}
float dy = y - mLastY;
//向上滑动,并且contentView平移到最大距离,显示周视图
if (dy < 0 && mContentView.getTranslationY() == -mContentViewTranslateY) {
//mContentView.onTouchEvent(event);
mLastY = y;
return false;
}
hideWeek(false);
//向下滑动,并且contentView已经完全平移到底部
if (dy > 0 && mContentView.getTranslationY() + dy >= 0) {
mContentView.setTranslationY(0);
translationViewPager();
mLastY = y;
return super.onTouchEvent(event);
}
//向上滑动,并且contentView已经平移到最大距离,则contentView平移到最大的距离
if (dy < 0 && mContentView.getTranslationY() + dy <= -mContentViewTranslateY) {
mContentView.setTranslationY(-mContentViewTranslateY);
translationViewPager();
mLastY = y;
return super.onTouchEvent(event);
}
//否则按比例平移
mContentView.setTranslationY(mContentView.getTranslationY() + dy);
translationViewPager();
mLastY = y;
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_POINTER_UP:
int pointerIndex = getPointerIndex(event, mActivePointerId);
if (mActivePointerId == INVALID_POINTER)
break;
mLastY = MotionEventCompat.getY(event, pointerIndex);
break;
case MotionEvent.ACTION_UP:
final VelocityTracker velocityTracker = mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
float mYVelocity = velocityTracker.getYVelocity();
if (mContentView.getTranslationY() == 0
|| mContentView.getTranslationY() == mContentViewTranslateY) {
expand();
break;
}
if (Math.abs(mYVelocity) >= 800) {
if (mYVelocity < 0) {
shrink();
} else {
expand();
}
return super.onTouchEvent(event);
}
if (event.getY() - downY > 0) {
expand();
} else {
shrink();
}
break;
}
return super.onTouchEvent(event);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (isAnimating) {
return true;
}
if (mGestureMode == GESTURE_MODE_DISABLED) {
return false;
}
if (mYearView == null ||
mContentView == null ||
mContentView.getVisibility() != VISIBLE) {
return super.onInterceptTouchEvent(ev);
}
if (mCalendarShowMode == CALENDAR_SHOW_MODE_ONLY_MONTH_VIEW ||
mCalendarShowMode == CALENDAR_SHOW_MODE_ONLY_WEEK_VIEW) {
return false;
}
if (mYearView.getVisibility() == VISIBLE || mDelegate.isShowYearSelectedLayout) {
return super.onInterceptTouchEvent(ev);
}
final int action = ev.getAction();
float y = ev.getY();
switch (action) {
case MotionEvent.ACTION_DOWN:
isWeekView = !isExpand();
int index = MotionEventCompat.getActionIndex(ev);
mActivePointerId = MotionEventCompat.getPointerId(ev, index);
mLastY = downY = y;
break;
case MotionEvent.ACTION_MOVE:
float dy = y - mLastY;
/*
如果向上滚动,且ViewPager已经收缩,不拦截事件
*/
if (dy < 0 && mContentView.getTranslationY() == -mContentViewTranslateY) {
return false;
}
/*
* 如果向下滚动,有 2 种情况处理 且y在ViewPager下方
* 1、RecyclerView 或者其它滚动的View,当mContentView滚动到顶部时,拦截事件
* 2、非滚动控件,直接拦截事件
*/
if (dy > 0 && mContentView.getTranslationY() == -mContentViewTranslateY
&& y >= CalendarUtil.dipToPx(getContext(), 98)) {
if (!isScrollTop()) {
return false;
}
}
if (dy > 0 && mContentView.getTranslationY() == 0 && y >= CalendarUtil.dipToPx(getContext(), 98)) {
return false;
}
if (Math.abs(dy) > mTouchSlop) {//大于mTouchSlop开始拦截事件,ContentView和ViewPager得到CANCEL事件
if ((dy > 0 && mContentView.getTranslationY() <= 0)
|| (dy < 0 && mContentView.getTranslationY() >= -mContentViewTranslateY)) {
mLastY = y;
return true;
}
}
break;
}
return super.onInterceptTouchEvent(ev);
}
private int getPointerIndex(MotionEvent ev, int id) {
int activePointerIndex = MotionEventCompat.findPointerIndex(ev, id);
if (activePointerIndex == -1) {
mActivePointerId = INVALID_POINTER;
}
return activePointerIndex;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mContentView != null && mMonthView != null) {
int year = mDelegate.mIndexCalendar.getYear();
int month = mDelegate.mIndexCalendar.getMonth();
int monthHeight = CalendarUtil.getMonthViewHeight(year, month,
mDelegate.getCalendarItemHeight(),
mDelegate.getWeekStart()) + CalendarUtil.dipToPx(getContext(), 41);
int height = getHeight();
if (monthHeight >= height && mMonthView.getHeight() > 0) {
height = monthHeight;
heightMeasureSpec = MeasureSpec.makeMeasureSpec(monthHeight +
CalendarUtil.dipToPx(getContext(), 41) +
mDelegate.getWeekBarHeight(), MeasureSpec.EXACTLY);
} else if (monthHeight < height && mMonthView.getHeight() > 0) {
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
}
int h = height - mItemHeight
- (mDelegate != null ? mDelegate.getWeekBarHeight() :
CalendarUtil.dipToPx(getContext(), 40))
- CalendarUtil.dipToPx(getContext(), 1);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int heightSpec = MeasureSpec.makeMeasureSpec(h,
MeasureSpec.EXACTLY);
mContentView.measure(widthMeasureSpec, heightSpec);
mContentView.layout(mContentView.getLeft(), mContentView.getTop(), mContentView.getRight(), mContentView.getBottom());
} else {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mMonthView = (MonthViewPager) findViewById(R.id.vp_month);
mWeekPager = (WeekViewPager) findViewById(R.id.vp_week);
mContentView = (ViewGroup) findViewById(mContentViewId);
mYearView = (YearViewPager) findViewById(R.id.selectLayout);
if (mContentView != null) {
mContentView.setOverScrollMode(View.OVER_SCROLL_NEVER);
}
}
/**
* 平移ViewPager月视图
*/
private void translationViewPager() {
float percent = mContentView.getTranslationY() * 1.0f / mContentViewTranslateY;
mMonthView.setTranslationY(mViewPagerTranslateY * percent);
}
public void setModeBothMonthWeekView() {
mCalendarShowMode = CALENDAR_SHOW_MODE_BOTH_MONTH_WEEK_VIEW;
}
public void setModeOnlyWeekView() {
mCalendarShowMode = CALENDAR_SHOW_MODE_ONLY_WEEK_VIEW;
}
public void setModeOnlyMonthView() {
mCalendarShowMode = CALENDAR_SHOW_MODE_ONLY_MONTH_VIEW;
}
@Nullable
@Override
protected Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
Parcelable parcelable = super.onSaveInstanceState();
bundle.putParcelable("super", parcelable);
bundle.putBoolean("isExpand", isExpand());
return bundle;
}
@Override
protected void onRestoreInstanceState(Parcelable state) {
Bundle bundle = (Bundle) state;
Parcelable superData = bundle.getParcelable("super");
boolean isExpand = bundle.getBoolean("isExpand");
if (isExpand) {
post(new Runnable() {
@Override
public void run() {
expand(0);
}
});
} else {
post(new Runnable() {
@Override
public void run() {
shrink(0);
}
});
}
super.onRestoreInstanceState(superData);
}
/**
* 是否展开了
*
* @return isExpand
*/
public final boolean isExpand() {
return mContentView == null || mMonthView.getVisibility() == VISIBLE;
}
public boolean expand() {
return expand(240);
}
/**
* 展开
*
* @param duration 时长
* @return 展开是否成功
*/
public boolean expand(int duration) {
if (isAnimating ||
mCalendarShowMode == CALENDAR_SHOW_MODE_ONLY_WEEK_VIEW ||
mContentView == null)
return false;
if (mMonthView.getVisibility() != VISIBLE) {
mWeekPager.setVisibility(GONE);
onShowMonthView();
isWeekView = false;
mMonthView.setVisibility(VISIBLE);
}
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mContentView,
"translationY", mContentView.getTranslationY(), 0f);
objectAnimator.setDuration(duration);
objectAnimator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float currentValue = (Float) animation.getAnimatedValue();
float percent = currentValue * 1.0f / mContentViewTranslateY;
mMonthView.setTranslationY(mViewPagerTranslateY * percent);
isAnimating = true;
}
});
objectAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
isAnimating = false;
hideWeek(true);
if (mDelegate.mViewChangeListener != null && isWeekView) {
mDelegate.mViewChangeListener.onViewChange(true);
}
isWeekView = false;
}
});
objectAnimator.start();
return true;
}
public boolean shrink() {
return shrink(240);
}
/**
* 收缩
*
* @param duration 时长
* @return 成功或者失败
*/
public boolean shrink(int duration) {
if (isAnimating || mContentView == null) {
return false;
}
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mContentView,
"translationY", mContentView.getTranslationY(), -mContentViewTranslateY);
objectAnimator.setDuration(duration);
objectAnimator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float currentValue = (Float) animation.getAnimatedValue();
float percent = currentValue * 1.0f / mContentViewTranslateY;
mMonthView.setTranslationY(mViewPagerTranslateY * percent);
isAnimating = true;
}
});
objectAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
isAnimating = false;
showWeek();
isWeekView = true;
}
});
objectAnimator.start();
return true;
}
/**
* 初始化状态
*/
final void initStatus() {
if (mContentView == null) {
return;
}
if ((mDefaultStatus == STATUS_SHRINK ||
mCalendarShowMode == CALENDAR_SHOW_MODE_ONLY_WEEK_VIEW) &&
mCalendarShowMode != CALENDAR_SHOW_MODE_ONLY_MONTH_VIEW) {
post(new Runnable() {
@Override
public void run() {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mContentView,
"translationY", mContentView.getTranslationY(), -mContentViewTranslateY);
objectAnimator.setDuration(0);
objectAnimator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float currentValue = (Float) animation.getAnimatedValue();
float percent = currentValue * 1.0f / mContentViewTranslateY;
mMonthView.setTranslationY(mViewPagerTranslateY * percent);
isAnimating = true;
}
});
objectAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
isAnimating = false;
showWeek();
}
});
objectAnimator.start();
}
});
} else {
if (mDelegate.mViewChangeListener == null) {
return;
}
post(new Runnable() {
@Override
public void run() {
mDelegate.mViewChangeListener.onViewChange(true);
}
});
}
}
/**
* 隐藏周视图
*/
private void hideWeek(boolean isNotify) {
if (isNotify) {
onShowMonthView();
}
mWeekPager.setVisibility(GONE);
mMonthView.setVisibility(VISIBLE);
}
/**
* 显示周视图
*/
private void showWeek() {
onShowWeekView();
mWeekPager.getAdapter().notifyDataSetChanged();
mWeekPager.setVisibility(VISIBLE);
mMonthView.setVisibility(INVISIBLE);
}
/**
* 周视图显示事件
*/
private void onShowWeekView() {
if (mWeekPager.getVisibility() == VISIBLE) {
return;
}
if (mDelegate.mViewChangeListener != null && !isWeekView) {
mDelegate.mViewChangeListener.onViewChange(false);
}
}
/**
* 周视图显示事件
*/
private void onShowMonthView() {
if (mMonthView.getVisibility() == VISIBLE) {
return;
}
if (mDelegate.mViewChangeListener != null && isWeekView) {
mDelegate.mViewChangeListener.onViewChange(true);
}
}
/**
* ContentView是否滚动到顶部 如果完全不适合,就复写这个方法
*
* @return 是否滚动到顶部
*/
protected boolean isScrollTop() {
if (mContentView instanceof CalendarScrollView) {
return ((CalendarScrollView) mContentView).isScrollToTop();
}
if (mContentView instanceof RecyclerView)
return ((RecyclerView) mContentView).computeVerticalScrollOffset() == 0;
if (mContentView instanceof AbsListView) {
boolean result = false;
AbsListView listView = (AbsListView) mContentView;
if (listView.getFirstVisiblePosition() == 0) {
final View topChildView = listView.getChildAt(0);
result = topChildView.getTop() == 0;
}
return result;
}
return mContentView.getScrollY() == 0;
}
/**
* 隐藏内容布局
*/
@SuppressLint("NewApi")
final void hideContentView() {
if (mContentView == null)
return;
mContentView.animate()
.translationY(getHeight() - mMonthView.getHeight())
.setDuration(220)
.setInterpolator(new LinearInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
mContentView.setVisibility(INVISIBLE);
mContentView.clearAnimation();
}
});
}
/**
* 显示内容布局
*/
@SuppressLint("NewApi")
final void showContentView() {
if (mContentView == null)
return;
mContentView.setTranslationY(getHeight() - mMonthView.getHeight());
mContentView.setVisibility(VISIBLE);
mContentView.animate()
.translationY(0)
.setDuration(180)
.setInterpolator(new LinearInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
}
});
}
@SuppressWarnings("unused")
private int getCalendarViewHeight() {
return mMonthView.getVisibility() == VISIBLE ? mDelegate.getWeekBarHeight() + mMonthView.getHeight() :
mDelegate.getWeekBarHeight() + mDelegate.getCalendarItemHeight();
}
/**
* 如果有十分特别的ContentView,可以自定义实现这个接口
*/
public interface CalendarScrollView {
/**
* 是否滚动到顶部
*
* @return 是否滚动到顶部
*/
boolean isScrollToTop();
}
}
| [
"726759622@qq.com"
] | 726759622@qq.com |