blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
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
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
be8cc924d981381689e815166f9d75f854a6883b
|
164633874dbd755519cabef2e0b368693575d7f2
|
/bgkj-dao/src/main/java/com/pagoda/bgkj/repo/mm/TestAddressRepository.java
|
f01f47ce6f26163657e261f94b7b41424a68efdd
|
[] |
no_license
|
gspandy/bgkj
|
0bcb42c912cf96c9b5b5f8a64d744f8c55bd7c9f
|
49b36dab03cd2d261ad3ac9228588c172635eff3
|
refs/heads/master
| 2023-08-09T15:35:45.100599 | 2018-04-27T02:24:20 | 2018-04-27T02:24:20 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,946 |
java
|
package com.pagoda.bgkj.repo.mm;
import com.pagoda.platform.jms.annotation.SqlTemplate;
import com.pagoda.platform.jms.jpa.*;
import com.pagoda.bgkj.api.dto.mm.*;
import com.pagoda.bgkj.domain.mm.*;
import com.pagoda.bgkj.repo.mm.custom.*;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.springframework.data.domain.*;
import org.springframework.data.jpa.repository.*;
import org.springframework.data.repository.query.*;
import org.springframework.transaction.annotation.Transactional;
/**
* TestAddressJPA数据访问接口
*
* @author PagodaGenerator
* @generated
*/
public interface TestAddressRepository
extends TestAddressRepositoryCustom, PagodaJpaRepository<TestAddress, Long> {
/**
* 动态执行一个无参数的sql,返回分页的结果
*
* @param selectProvider 通过SqlWrapper.asSelect封装sql
* @param pageable 分页,排序参数
* @param <T>
* @return
*/
@SqlTemplate(name = "dynamicSelectPage", dynamic = true)
public <T> Page<T> dynamicSelectPage(
@Param("selectProvider") SelectStatementProvider selectProvider,
@Param("pageable") Pageable pageable,
@Param("returnType") Class<T> returnType);
/**
* 动态执行一个无参数的sql,返回单个结果
*
* @param selectProvider 通过SqlWrapper.asSelect封装sql
* @param <T>
* @return
*/
@SqlTemplate(name = "dynamicSelectOne", dynamic = true, multiple = false)
public <T> T dynamicSelectOne(
@Param("selectProvider") SelectStatementProvider selectProvider,
@Param("returnType") Class<T> returnType);
/**
* 动态执行一个无参数的sql update 语句
*
* @param updateProvider
* @return
*/
@SqlTemplate(name = "dynamicUpdate", dynamic = true)
@Modifying
public int dynamicUpdate(@Param("updateProvider") UpdateStatementProvider updateProvider);
}
|
[
"root@49acbcbc6afc"
] |
root@49acbcbc6afc
|
056061e53aab0e3a58a628c407e17c73326aa1b7
|
2af5d775877afec5a2936f5d7ea4e875f077a467
|
/processing-3.3/modes/java/src/processing/mode/java/preproc/PdePreprocessor.java
|
bc85137aca66e6f0875c5f411725689e03615651
|
[] |
no_license
|
Shamwars/Processing-3.3
|
cb5c2204ad67f5e5370caf93be6123a3a4a8a878
|
d154ffe8f5ac108221c86d7b6adec35c0fd56c72
|
refs/heads/master
| 2020-04-14T21:57:56.941009 | 2019-01-04T19:25:32 | 2019-01-04T19:25:32 | 164,146,552 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 54,603 |
java
|
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
PdePreprocessor - wrapper for default ANTLR-generated parser
Part of the Processing project - http://processing.org
Copyright (c) 2004-15 Ben Fry and Casey Reas
Copyright (c) 2001-04 Massachusetts Institute of Technology
ANTLR-generated parser and several supporting classes written
by Dan Mosedale via funding from the Interaction Institute IVREA.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package processing.mode.java.preproc;
import java.io.*;
import java.util.*;
import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import processing.app.Messages;
import processing.app.Preferences;
import processing.app.SketchException;
import processing.core.PApplet;
import processing.data.StringList;
import antlr.*;
import antlr.collections.AST;
/**
* Class that orchestrates preprocessing p5 syntax into straight Java.
* <P/>
* <B>Current Preprocessor Subsitutions:</B>
* <UL>
* <LI>any function not specified as being protected or private will
* be made 'public'. this means that <TT>void setup()</TT> becomes
* <TT>public void setup()</TT>. This is important to note when
* coding with core.jar outside of the PDE.
* <LI><TT>compiler.substitute_floats</TT> (currently "substitute_f")
* treat doubles as floats, i.e. 12.3 becomes 12.3f so that people
* don't have to add f after their numbers all the time since it's
* confusing for beginners.
* <LI><TT>compiler.enhanced_casting</TT> byte(), char(), int(), float()
* works for casting. this is basic in the current implementation, but
* should be expanded as described above. color() works similarly to int(),
* however there is also a *function* called color(r, g, b) in p5.
* <LI><TT>compiler.color_datatype</TT> 'color' is aliased to 'int'
* as a datatype to represent ARGB packed into a single int, commonly
* used in p5 for pixels[] and other color operations. this is just a
* search/replace type thing, and it can be used interchangeably with int.
* <LI><TT>compiler.web_colors</TT> (currently "inline_web_colors")
* color c = #cc0080; should unpack to 0xffcc0080 (the ff at the top is
* so that the color is opaque), which is just an int.
* </UL>
* <B>Other preprocessor functionality</B>
* <UL>
* <LI>detects what 'mode' the program is in: static (no function
* brackets at all, just assumes everything is in draw), active
* (setup plus draw or loop), and java mode (full java support).
* http://processing.org/reference/environment/
* </UL>
* <P/>
* The PDE Preprocessor is based on the Java Grammar that comes with
* ANTLR 2.7.2. Moving it forward to a new version of the grammar
* shouldn't be too difficult.
* <P/>
* Here's some info about the various files in this directory:
* <P/>
* <TT>java.g:</TT> this is the ANTLR grammar for Java 1.3/1.4 from the
* ANTLR distribution. It is in the public domain. The only change to
* this file from the original this file is the uncommenting of the
* clauses required to support assert().
* <P/>
* <TT>java.tree.g:</TT> this describes the Abstract Syntax Tree (AST)
* generated by java.g. It is only here as a reference for coders hacking
* on the preprocessor, it is not built or used at all. Note that pde.g
* overrides some of the java.g rules so that in PDE ASTs, there are a
* few minor differences. Also in the public domain.
* <P/>
* <TT>pde.g:</TT> this is the grammar and lexer for the PDE language
* itself. It subclasses the java.g grammar and lexer. There are a couple
* of overrides to java.g that I hope to convince the ANTLR folks to fold
* back into their grammar, but most of this file is highly specific to
* PDE itself.
* <TT>PdeEmitter.java:</TT> this class traverses the AST generated by
* the PDE Recognizer, and emits it as Java code, doing any necessary
* transformations along the way. It is based on JavaEmitter.java,
* available from antlr.org, written by Andy Tripp <[email protected]>,
* who has given permission for it to be distributed under the GPL.
* <P/>
* <TT>ExtendedCommonASTWithHiddenTokens.java:</TT> this adds a necessary
* initialize() method, as well as a number of methods to allow for XML
* serialization of the parse tree in a such a way that the hidden tokens
* are visible. Much of the code is taken from the original
* CommonASTWithHiddenTokens class. I hope to convince the ANTLR folks
* to fold these changes back into that class so that this file will be
* unnecessary.
* <P/>
* <TT>TokenStreamCopyingHiddenTokenFilter.java:</TT> this class provides
* TokenStreamHiddenTokenFilters with the concept of tokens which can be
* copied so that they are seen by both the hidden token stream as well
* as the parser itself. This is useful when one wants to use an
* existing parser (like the Java parser included with ANTLR) that throws
* away some tokens to create a parse tree which can be used to spit out
* a copy of the code with only minor modifications. Partially derived
* from ANTLR code. I hope to convince the ANTLR folks to fold this
* functionality back into ANTLR proper as well.
* <P/>
* <TT>whitespace_test.pde:</TT> a torture test to ensure that the
* preprocessor is correctly preserving whitespace, comments, and other
* hidden tokens correctly. See the comments in the code for details about
* how to run the test.
* <P/>
* All other files in this directory are generated at build time by ANTLR
* itself. The ANTLR manual goes into a fair amount of detail about the
* what each type of file is for.
* <P/>
*/
public class PdePreprocessor {
protected static final String UNICODE_ESCAPES = "0123456789abcdefABCDEF";
// used for calling the ASTFactory to get the root node
private static final int ROOT_ID = 0;
protected final String indent;
private final String name;
public enum Mode {
STATIC, ACTIVE, JAVA
}
private TokenStreamCopyingHiddenTokenFilter filter;
private String advClassName = "";
protected Mode mode;
Set<String> foundMethods;
SurfaceInfo sizeInfo;
/**
* Regular expression for parsing the size() method. This should match
* against any uses of the size() function, whether numbers or variables
* or whatever. This way, no warning is shown if size() isn't actually used
* in the sketch, which is the case especially for anyone who is cutting
* and pasting from the reference.
*/
// public static final String SIZE_REGEX =
// "(?:^|\\s|;)size\\s*\\(\\s*([^\\s,]+)\\s*,\\s*([^\\s,\\)]+)\\s*,?\\s*([^\\)]*)\\s*\\)\\s*\\;";
// static private final String SIZE_CONTENTS_REGEX =
// "(?:^|\\s|;)size\\s*\\(([^\\)]+)\\)\\s*\\;";
// static private final String FULL_SCREEN_CONTENTS_REGEX =
// "(?:^|\\s|;)fullScreen\\s*\\(([^\\)]+)\\)\\s*\\;";
// /** Test whether there's a void somewhere (the program has functions). */
// static private final String VOID_REGEX =
// "(?:^|\\s|;)void\\s";
/** Used to grab the start of setup() so we can mine it for size() */
static private final Pattern VOID_SETUP_REGEX =
Pattern.compile("(?:^|\\s|;)void\\s+setup\\s*\\(", Pattern.MULTILINE);
// Can't only match any 'public class', needs to be a PApplet
// http://code.google.com/p/processing/issues/detail?id=551
static private final Pattern PUBLIC_CLASS =
Pattern.compile("(^|;)\\s*public\\s+class\\s+\\S+\\s+extends\\s+PApplet", Pattern.MULTILINE);
static private final Pattern FUNCTION_DECL =
Pattern.compile("(^|;)\\s*((public|private|protected|final|static)\\s+)*" +
"(void|int|float|double|String|char|byte|boolean)" +
"(\\s*\\[\\s*\\])?\\s+[a-zA-Z0-9]+\\s*\\(",
Pattern.MULTILINE);
static private final Pattern CLOSING_BRACE = Pattern.compile("\\}");
public PdePreprocessor(final String sketchName) {
this(sketchName, Preferences.getInteger("editor.tabs.size"));
}
public PdePreprocessor(final String sketchName, final int tabSize) {
this.name = sketchName;
final char[] indentChars = new char[tabSize];
Arrays.fill(indentChars, ' ');
indent = new String(indentChars);
}
public SurfaceInfo initSketchSize(String code,
boolean sizeWarning) throws SketchException {
sizeInfo = parseSketchSize(code, sizeWarning);
return sizeInfo;
}
/**
* Break on commas, except those inside quotes,
* e.g.: size(300, 200, PDF, "output,weirdname.pdf");
* No special handling implemented for escaped (\") quotes.
*/
static private StringList breakCommas(String contents) {
StringList outgoing = new StringList();
boolean insideQuote = false;
// The current word being read
StringBuilder current = new StringBuilder();
char[] chars = contents.toCharArray();
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
if (insideQuote) {
current.append(c);
if (c == '\"') {
insideQuote = false;
}
} else {
if (c == ',') {
if (current.length() != 0) {
outgoing.append(current.toString());
current.setLength(0);
}
} else {
current.append(c);
if (c == '\"') {
insideQuote = true;
}
}
}
}
if (current.length() != 0) {
outgoing.append(current.toString());
}
return outgoing;
}
/**
* Parse a chunk of code and extract the size() command and its contents.
* Also goes after fullScreen(), smooth(), and noSmooth().
* @param code The code from the main tab in the sketch
* @param fussy true if it should show an error message if bad size()
* @return null if there was an error, otherwise an array (might contain some/all nulls)
*/
static public SurfaceInfo parseSketchSize(String code,
boolean fussy) throws SketchException {
// This matches against any uses of the size() function, whether numbers
// or variables or whatever. This way, no warning is shown if size() isn't
// actually used in the applet, which is the case especially for anyone
// who is cutting/pasting from the reference.
// String scrubbed = scrubComments(sketch.getCode(0).getProgram());
// String[] matches = PApplet.match(scrubbed, SIZE_REGEX);
// String[] matches = PApplet.match(scrubComments(code), SIZE_REGEX);
/*
1. no size() or fullScreen() method at all
will use the non-overridden settings() method in PApplet
2. size() or fullScreen() found inside setup() (static mode sketch or otherwise)
make sure that it uses numbers (or displayWidth/Height), copy into settings
3. size() or fullScreen() already in settings()
don't mess with the sketch, don't insert any defaults
really only need to deal with situation #2.. nothing to be done for 1 and 3
*/
// if static mode sketch, all we need is regex
// easy proxy for static in this case is whether [^\s]void\s is present
String uncommented = scrubComments(code);
Mode mode = parseMode(uncommented);
String searchArea = null;
switch (mode) {
case JAVA:
// it's up to the user
searchArea = null;
break;
case ACTIVE:
// active mode, limit scope to setup
// Find setup() in global scope
MatchResult setupMatch = findInCurrentScope(VOID_SETUP_REGEX, uncommented);
if (setupMatch != null) {
int start = uncommented.indexOf("{", setupMatch.end());
if (start >= 0) {
// Find a closing brace
MatchResult match = findInCurrentScope(CLOSING_BRACE, uncommented, start);
if (match != null) {
searchArea = uncommented.substring(start + 1, match.end() - 1);
} else {
throw new SketchException("Found a { that's missing a matching }", false);
}
}
}
break;
case STATIC:
// static mode, look everywhere
searchArea = uncommented;
break;
}
if (searchArea == null) {
return new SurfaceInfo();
}
StringList extraStatements = new StringList();
// First look for noSmooth() or smooth(N) so we can hoist it into settings.
String[] smoothContents = matchMethod("smooth", searchArea);
if (smoothContents != null) {
extraStatements.append(smoothContents[0]);
}
String[] noContents = matchMethod("noSmooth", searchArea);
if (noContents != null) {
if (extraStatements.size() != 0) {
throw new SketchException("smooth() and noSmooth() cannot be used in the same sketch");
} else {
extraStatements.append(noContents[0]);
}
}
String[] pixelDensityContents = matchMethod("pixelDensity", searchArea);
if (pixelDensityContents != null) {
extraStatements.append(pixelDensityContents[0]);
} else {
pixelDensityContents = matchDensityMess(searchArea);
if (pixelDensityContents != null) {
extraStatements.append(pixelDensityContents[0]);
}
}
String[] sizeContents = matchMethod("size", searchArea);
String[] fullContents = matchMethod("fullScreen", searchArea);
// First check and make sure they aren't both being used, otherwise it'll
// throw a confusing state exception error that one "can't be used here".
if (sizeContents != null && fullContents != null) {
throw new SketchException("size() and fullScreen() cannot be used in the same sketch", false);
}
// Get everything inside the parens for the size() method
//String[] contents = PApplet.match(searchArea, SIZE_CONTENTS_REGEX);
if (sizeContents != null) {
StringList args = breakCommas(sizeContents[1]);
SurfaceInfo info = new SurfaceInfo();
// info.statement = sizeContents[0];
info.addStatement(sizeContents[0]);
info.width = args.get(0).trim();
info.height = args.get(1).trim();
info.renderer = (args.size() >= 3) ? args.get(2).trim() : null;
info.path = (args.size() >= 4) ? args.get(3).trim() : null;
// Trying to remember why we wanted to allow people to use displayWidth
// as the height or displayHeight as the width, but maybe it's for
// making a square sketch window? Not going to
if (info.hasOldSyntax()) {
// return null;
throw new SketchException("Please update your code to continue.", false);
}
if (info.hasBadSize() && fussy) {
// found a reference to size, but it didn't seem to contain numbers
final String message =
"The size of this sketch could not be determined from your code.\n" +
"Use only numbers (not variables) for the size() command.\n" +
"Read the size() reference for more details.";
Messages.showWarning("Could not find sketch size", message, null);
// new Exception().printStackTrace(System.out);
// return null;
throw new SketchException("Please fix the size() line to continue.", false);
}
info.addStatements(extraStatements);
info.checkEmpty();
return info;
//return new String[] { contents[0], width, height, renderer, path };
}
// if no size() found, check for fullScreen()
//contents = PApplet.match(searchArea, FULL_SCREEN_CONTENTS_REGEX);
if (fullContents != null) {
SurfaceInfo info = new SurfaceInfo();
// info.statement = fullContents[0];
info.addStatement(fullContents[0]);
StringList args = breakCommas(fullContents[1]);
if (args.size() > 0) { // might have no args
String args0 = args.get(0).trim();
if (args.size() == 1) {
// could be either fullScreen(1) or fullScreen(P2D), figure out which
if (args0.equals("SPAN") || PApplet.parseInt(args0, -1) != -1) {
// it's the display parameter, not the renderer
info.display = args0;
} else {
info.renderer = args0;
}
} else if (args.size() == 2) {
info.renderer = args0;
info.display = args.get(1).trim();
} else {
throw new SketchException("That's too many parameters for fullScreen()");
}
}
info.width = "displayWidth";
info.height = "displayHeight";
// if (extraStatements.size() != 0) {
// info.statement += extraStatements.join(" ");
// }
info.addStatements(extraStatements);
info.checkEmpty();
return info;
}
// Made it this far, but no size() or fullScreen(), and still
// need to pull out the noSmooth() and smooth(N) methods.
if (extraStatements.size() != 0) {
SurfaceInfo info = new SurfaceInfo();
// info.statement = extraStatements.join(" ");
info.addStatements(extraStatements);
return info;
}
// not an error, just no size() specified
//return new String[] { null, null, null, null, null };
return new SurfaceInfo();
}
/*
static String readSingleQuote(char[] c, int i) {
StringBuilder sb = new StringBuilder();
try {
sb.append(c[i++]); // add the quote
if (c[i] == '\\') {
sb.append(c[i++]); // add the escape
if (c[i] == 'u') {
// grabs uNNN and the fourth N will be added below
for (int j = 0; j < 4; j++) {
sb.append(c[i++]);
}
}
}
sb.append(c[i++]); // get the char, escapee, or last unicode digit
sb.append(c[i++]); // get the closing quote
} catch (ArrayIndexOutOfBoundsException ignored) {
// this means they have bigger problems with their code
}
return sb.toString();
}
static String readDoubleQuote(char[] c, int i) {
StringBuilder sb = new StringBuilder();
try {
sb.append(c[i++]); // add the quote
while (i < c.length) {
if (c[i] == '\\') {
sb.append(c[i++]); // add the escape
sb.append(c[i++]); // add whatever was escaped
} else if (c[i] == '\"') {
sb.append(c[i++]);
break;
} else {
sb.append(c[i++]);
}
}
} catch (ArrayIndexOutOfBoundsException ignored) {
// this means they have bigger problems with their code
}
return sb.toString();
}
*/
/**
* Parses the code and determines the mode of the sketch.
*
* @param code code without comments
* @return determined mode
*/
static public Mode parseMode(CharSequence code) {
// See if we can find any function in the global scope
if (findInCurrentScope(FUNCTION_DECL, code) != null) {
return Mode.ACTIVE;
}
// See if we can find any public class extending PApplet
if (findInCurrentScope(PUBLIC_CLASS, code) != null) {
return Mode.JAVA;
}
return Mode.STATIC;
}
/**
* Calls {@link #findInScope(Pattern, String, int, int, int, int) findInScope}
* on the whole string with min and max target scopes set to zero.
*/
static protected MatchResult findInCurrentScope(Pattern pattern, CharSequence code) {
return findInScope(pattern, code, 0, code.length(), 0, 0);
}
/**
* Calls {@link #findInScope(Pattern, String, int, int, int, int) findInScope}
* starting at start char with min and max target scopes set to zero.
*/
static protected MatchResult findInCurrentScope(Pattern pattern, CharSequence code,
int start) {
return findInScope(pattern, code, start, code.length(), 0, 0);
}
/**
* Looks for the pattern at a specified target scope depth relative
* to the scope depth of the starting position.
*
* Example: Calling this with starting position inside a method body
* and target depth 0 would search only in the method body, while
* using target depth -1 would look only in the body of the enclosing class
* (but not in any methods of the class or outside of the class).
*
* By using a scope range, you can e.g. search in the whole class including
* bodies of methods and inner classes.
*
* @param pattern matching is realized by find() method of this pattern
* @param code Java code without comments
* @param start starting position in the code String (inclusive)
* @param stop ending position in the code Sting (exclusive)
* @param minTargetScopeDepth desired min scope depth of the match relative to the
* scope of the starting position
* @param maxTargetScopeDepth desired max scope depth of the match relative to the
* scope of the starting position
* @return first match at a desired relative scope depth,
* null if there isn't one
*/
static protected MatchResult findInScope(Pattern pattern, CharSequence code,
int start, int stop,
int minTargetScopeDepth,
int maxTargetScopeDepth) {
if (minTargetScopeDepth > maxTargetScopeDepth) {
int temp = minTargetScopeDepth;
minTargetScopeDepth = maxTargetScopeDepth;
maxTargetScopeDepth = temp;
}
Matcher m = pattern.matcher(code);
m.region(start, stop);
int depth = 0;
int position = start;
// We should not escape the enclosing scope. It can be either the original
// scope, or the min target scope, whichever is more out there (lower depth)
int minScopeDepth = PApplet.min(depth, minTargetScopeDepth);
while (m.find()) {
int newPosition = m.end();
int depthDiff = scopeDepthDiff(code, position, newPosition);
// Process this match only if it is not in string or char literal
if (depthDiff != Integer.MAX_VALUE) {
depth += depthDiff;
if (depth < minScopeDepth) break; // out of scope!
if (depth >= minTargetScopeDepth &&
depth <= maxTargetScopeDepth) {
return m.toMatchResult(); // jackpot
}
position = newPosition;
}
}
return null;
}
/**
* Walks the specified region (not including stop) and determines difference
* in scope depth. Adds one to depth on opening curly brace, subtracts one
* from depth on closing curly brace. Ignores string and char literals.
*
* @param code code without comments
* @param start start of the region, must not be in string literal,
* char literal or second char of escaped sequence
* @param stop end of the region (exclusive)
*
* @return scope depth difference between start and stop,
* Integer.MAX_VALUE if end is in string literal,
* char literal or second char of escaped sequence
*/
static protected int scopeDepthDiff(CharSequence code, int start, int stop) {
boolean insideString = false;
boolean insideChar = false;
boolean escapedChar = false;
int depth = 0;
for (int i = start; i < stop; i++) {
if (!escapedChar) {
char ch = code.charAt(i);
switch (ch) {
case '\\':
escapedChar = true;
break;
case '{':
if (!insideChar && !insideString) depth++;
break;
case '}':
if (!insideChar && !insideString) depth--;
break;
case '\"':
if (!insideChar) insideString = !insideString;
break;
case '\'':
if (!insideString) insideChar = !insideChar;
break;
}
} else {
escapedChar = false;
}
}
if (insideChar || insideString || escapedChar) {
return Integer.MAX_VALUE; // signal invalid location
}
return depth;
}
/**
* Looks for the specified method in the base scope of the search area.
*/
static protected String[] matchMethod(String methodName, String searchArea) {
final String left = "(?:^|\\s|;)";
// doesn't match empty pairs of parens
//final String right = "\\s*\\(([^\\)]+)\\)\\s*;";
final String right = "\\s*\\(([^\\)]*)\\)\\s*;";
String regexp = left + methodName + right;
Pattern p = matchPatterns.get(regexp);
if (p == null) {
p = Pattern.compile(regexp, Pattern.MULTILINE | Pattern.DOTALL);
matchPatterns.put(regexp, p);
}
MatchResult match = findInCurrentScope(p, searchArea);
if (match != null) {
int count = match.groupCount() + 1;
String[] groups = new String[count];
for (int i = 0; i < count; i++) {
groups[i] = match.group(i);
}
return groups;
}
return null;
}
static protected LinkedHashMap<String, Pattern> matchPatterns =
new LinkedHashMap<String, Pattern>(16, 0.75f, true) {
@Override
protected boolean removeEldestEntry(Map.Entry<String, Pattern> eldest) {
// Limit the number of match patterns at 10 most recently used
return size() == 10;
}
};
static protected String[] matchDensityMess(String searchArea) {
final String regexp =
"(?:^|\\s|;)pixelDensity\\s*\\(\\s*displayDensity\\s*\\([^\\)]*\\)\\s*\\)\\s*\\;";
return PApplet.match(searchArea, regexp);
}
/**
* Replace all commented portions of a given String as spaces.
* Utility function used here and in the preprocessor.
*/
static public String scrubComments(String what) {
char p[] = what.toCharArray();
// Track quotes to avoid problems with code like: String t = "*/*";
// http://code.google.com/p/processing/issues/detail?id=1435
boolean insideQuote = false;
int index = 0;
while (index < p.length) {
// for any double slash comments, ignore until the end of the line
if (!insideQuote &&
(p[index] == '/') &&
(index < p.length - 1) &&
(p[index+1] == '/')) {
p[index++] = ' ';
p[index++] = ' ';
while ((index < p.length) &&
(p[index] != '\n')) {
p[index++] = ' ';
}
// check to see if this is the start of a new multiline comment.
// if it is, then make sure it's actually terminated somewhere.
} else if (!insideQuote &&
(p[index] == '/') &&
(index < p.length - 1) &&
(p[index+1] == '*')) {
p[index++] = ' ';
p[index++] = ' ';
boolean endOfRainbow = false;
while (index < p.length - 1) {
if ((p[index] == '*') && (p[index+1] == '/')) {
p[index++] = ' ';
p[index++] = ' ';
endOfRainbow = true;
break;
} else {
// continue blanking this area
p[index++] = ' ';
}
}
if (!endOfRainbow) {
throw new RuntimeException("Missing the */ from the end of a " +
"/* comment */");
}
} else if (p[index] == '"' && index > 0 && p[index-1] != '\\') {
insideQuote = !insideQuote;
index++;
} else { // any old character, move along
index++;
}
}
return new String(p);
}
public void addMethod(String methodName) {
foundMethods.add(methodName);
}
public boolean hasMethod(String methodName) {
return foundMethods.contains(methodName);
}
// public void setFoundMain(boolean foundMain) {
// this.foundMain = foundMain;
// }
// public boolean getFoundMain() {
// return foundMain;
// }
public void setAdvClassName(final String advClassName) {
this.advClassName = advClassName;
}
public void setMode(final Mode mode) {
//System.err.println("Setting mode to " + mode);
this.mode = mode;
}
CommonHiddenStreamToken getHiddenAfter(final CommonHiddenStreamToken t) {
return filter.getHiddenAfter(t);
}
CommonHiddenStreamToken getInitialHiddenToken() {
return filter.getInitialHiddenToken();
}
private static int countNewlines(final String s) {
int count = 0;
for (int pos = s.indexOf('\n', 0); pos >= 0; pos = s.indexOf('\n', pos + 1))
count++;
return count;
}
private static void checkForUnterminatedMultilineComment(final String program)
throws SketchException {
final int length = program.length();
for (int i = 0; i < length; i++) {
// for any double slash comments, ignore until the end of the line
if ((program.charAt(i) == '/') && (i < length - 1)
&& (program.charAt(i + 1) == '/')) {
i += 2;
while ((i < length) && (program.charAt(i) != '\n')) {
i++;
}
// check to see if this is the start of a new multiline comment.
// if it is, then make sure it's actually terminated somewhere.
} else if ((program.charAt(i) == '/') && (i < length - 1)
&& (program.charAt(i + 1) == '*')) {
final int startOfComment = i;
i += 2;
boolean terminated = false;
while (i < length - 1) {
if ((program.charAt(i) == '*') && (program.charAt(i + 1) == '/')) {
i += 2;
terminated = true;
break;
} else {
i++;
}
}
if (!terminated) {
throw new SketchException("Unclosed /* comment */", 0,
countNewlines(program.substring(0,
startOfComment)));
}
} else if (program.charAt(i) == '"') {
final int stringStart = i;
boolean terminated = false;
for (i++; i < length; i++) {
final char c = program.charAt(i);
if (c == '"') {
terminated = true;
break;
} else if (c == '\\') {
if (i == length - 1) {
break;
}
i++;
} else if (c == '\n') {
break;
}
}
if (!terminated) {
throw new SketchException("Unterminated string constant", 0,
countNewlines(program.substring(0,
stringStart)));
}
} else if (program.charAt(i) == '\'') {
i++; // step over the initial quote
if (i >= length) {
throw new SketchException("Unterminated character constant (after initial quote)", 0,
countNewlines(program.substring(0, i)));
}
boolean escaped = false;
if (program.charAt(i) == '\\') {
i++; // step over the backslash
escaped = true;
}
if (i >= length) {
throw new SketchException("Unterminated character constant (after backslash)", 0,
countNewlines(program.substring(0, i)));
}
if (escaped && program.charAt(i) == 'u') { // unicode escape sequence?
i++; // step over the u
//i += 4; // and the four digit unicode constant
for (int j = 0; j < 4; j++) {
if (UNICODE_ESCAPES.indexOf(program.charAt(i)) == -1) {
throw new SketchException("Bad or unfinished \\uXXXX sequence " +
"(malformed Unicode character constant)", 0,
countNewlines(program.substring(0, i)));
}
i++;
}
} else {
i++; // step over a single character
}
if (i >= length) {
throw new SketchException("Unterminated character constant", 0,
countNewlines(program.substring(0, i)));
}
if (program.charAt(i) != '\'') {
throw new SketchException("Badly formed character constant " +
"(expecting quote, got " + program.charAt(i) + ")", 0,
countNewlines(program.substring(0, i)));
}
}
}
}
public PreprocessorResult write(final Writer out, String program)
throws SketchException, RecognitionException, TokenStreamException {
return write(out, program, null);
}
public PreprocessorResult write(Writer out, String program,
StringList codeFolderPackages)
throws SketchException, RecognitionException, TokenStreamException {
// these ones have the .* at the end, since a class name might be at the end
// instead of .* which would make trouble other classes using this can lop
// off the . and anything after it to produce a package name consistently.
final ArrayList<String> programImports = new ArrayList<String>();
// imports just from the code folder, treated differently
// than the others, since the imports are auto-generated.
final ArrayList<String> codeFolderImports = new ArrayList<String>();
// need to reset whether or not this has a main()
// foundMain = false;
foundMethods = new HashSet<String>();
// http://processing.org/bugs/bugzilla/5.html
if (!program.endsWith("\n")) {
program += "\n";
}
checkForUnterminatedMultilineComment(program);
if (Preferences.getBoolean("preproc.substitute_unicode")) {
program = substituteUnicode(program);
}
// For 0215, adding } as a legitimate prefix to the import (along with
// newline and semicolon) for cases where a tab ends with } and an import
// statement starts the next tab.
final String importRegexp =
"((?:^|;|\\})\\s*)(import\\s+)((?:static\\s+)?\\S+)(\\s*;)";
final Pattern importPattern = Pattern.compile(importRegexp);
String scrubbed = scrubComments(program);
Matcher m = null;
int offset = 0;
boolean found = false;
do {
m = importPattern.matcher(scrubbed);
found = m.find(offset);
if (found) {
// System.out.println("found " + m.groupCount() + " groups");
String before = m.group(1);
String piece = m.group(2) + m.group(3) + m.group(4);
// int len = piece.length(); // how much to trim out
if (!ignoreImport(m.group(3))) {
programImports.add(m.group(3)); // the package name
}
// find index of this import in the program
int start = m.start() + before.length();
int stop = start + piece.length();
// System.out.println(start + " " + stop + " " + piece);
//System.out.println("found " + m.group(3));
// System.out.println("removing '" + program.substring(start, stop) + "'");
// Remove the import from the main program
program = program.substring(0, start) + program.substring(stop);
scrubbed = scrubbed.substring(0, start) + scrubbed.substring(stop);
// Set the offset to start, because everything between
// start and stop has been deleted.
offset = m.start();
}
} while (found);
// System.out.println("program now:");
// System.out.println(program);
if (codeFolderPackages != null) {
for (String item : codeFolderPackages) {
codeFolderImports.add(item + ".*");
}
}
final PrintWriter stream = new PrintWriter(out);
final int headerOffset =
writeImports(stream, programImports, codeFolderImports);
return new PreprocessorResult(mode, headerOffset + 2,
write(program, stream), programImports);
}
static String substituteUnicode(String program) {
// check for non-ascii chars (these will be/must be in unicode format)
char p[] = program.toCharArray();
int unicodeCount = 0;
for (int i = 0; i < p.length; i++) {
if (p[i] > 127)
unicodeCount++;
}
if (unicodeCount == 0)
return program;
// if non-ascii chars are in there, convert to unicode escapes
// add unicodeCount * 5.. replacing each unicode char
// with six digit uXXXX sequence (xxxx is in hex)
// (except for nbsp chars which will be a replaced with a space)
int index = 0;
char p2[] = new char[p.length + unicodeCount * 5];
for (int i = 0; i < p.length; i++) {
if (p[i] < 128) {
p2[index++] = p[i];
} else if (p[i] == 160) { // unicode for non-breaking space
p2[index++] = ' ';
} else {
int c = p[i];
p2[index++] = '\\';
p2[index++] = 'u';
char str[] = Integer.toHexString(c).toCharArray();
// add leading zeros, so that the length is 4
//for (int i = 0; i < 4 - str.length; i++) p2[index++] = '0';
for (int m = 0; m < 4 - str.length; m++)
p2[index++] = '0';
System.arraycopy(str, 0, p2, index, str.length);
index += str.length;
}
}
return new String(p2, 0, index);
}
/**
* preprocesses a pde file and writes out a java file
* @return the class name of the exported Java
*/
private String write(final String program, final PrintWriter stream)
throws SketchException, RecognitionException, TokenStreamException {
// Match on the uncommented version, otherwise code inside comments used
// http://code.google.com/p/processing/issues/detail?id=1404
String uncomment = scrubComments(program);
PdeRecognizer parser = createParser(program);
Mode mode = parseMode(uncomment);
switch (mode) {
case JAVA:
try {
final PrintStream saved = System.err;
try {
// throw away stderr for this tentative parse
System.setErr(new PrintStream(new ByteArrayOutputStream()));
parser.javaProgram();
} finally {
System.setErr(saved);
}
setMode(Mode.JAVA);
} catch (Exception e) {
// I can't figure out any other way of resetting the parser.
parser = createParser(program);
parser.pdeProgram();
}
break;
case ACTIVE:
setMode(Mode.ACTIVE);
parser.activeProgram();
break;
case STATIC:
parser.pdeProgram();
break;
}
// set up the AST for traversal by PdeEmitter
//
ASTFactory factory = new ASTFactory();
AST parserAST = parser.getAST();
AST rootNode = factory.create(ROOT_ID, "AST ROOT");
rootNode.setFirstChild(parserAST);
makeSimpleMethodsPublic(rootNode);
// unclear if this actually works, but it's worth a shot
//
//((CommonAST)parserAST).setVerboseStringConversion(
// true, parser.getTokenNames());
// (made to use the static version because of jikes 1.22 warning)
BaseAST.setVerboseStringConversion(true, parser.getTokenNames());
final String className;
if (mode == Mode.JAVA) {
// if this is an advanced program, the classname is already defined.
className = getFirstClassName(parserAST);
} else {
className = this.name;
}
// if 'null' was passed in for the name, but this isn't
// a 'java' mode class, then there's a problem, so punt.
//
if (className == null)
return null;
// debug
if (false) {
final StringWriter buf = new StringWriter();
final PrintWriter bufout = new PrintWriter(buf);
writeDeclaration(bufout, className);
new PdeEmitter(this, bufout).print(rootNode);
writeFooter(bufout, className);
debugAST(rootNode, true);
System.err.println(buf.toString());
}
writeDeclaration(stream, className);
new PdeEmitter(this, stream).print(rootNode);
writeFooter(stream, className);
// if desired, serialize the parse tree to an XML file. can
// be viewed usefully with Mozilla or IE
if (Preferences.getBoolean("preproc.output_parse_tree")) {
writeParseTree("parseTree.xml", parserAST);
}
return className;
}
private PdeRecognizer createParser(final String program) {
// create a lexer with the stream reader, and tell it to handle
// hidden tokens (eg whitespace, comments) since we want to pass these
// through so that the line numbers when the compiler reports errors
// match those that will be highlighted in the PDE IDE
//
PdeLexer lexer = new PdeLexer(new StringReader(program));
lexer.setTokenObjectClass("antlr.CommonHiddenStreamToken");
// create the filter for hidden tokens and specify which tokens to
// hide and which to copy to the hidden text
//
filter = new TokenStreamCopyingHiddenTokenFilter(lexer);
filter.hide(PdePartialTokenTypes.SL_COMMENT);
filter.hide(PdePartialTokenTypes.ML_COMMENT);
filter.hide(PdePartialTokenTypes.WS);
filter.copy(PdePartialTokenTypes.SEMI);
filter.copy(PdePartialTokenTypes.LPAREN);
filter.copy(PdePartialTokenTypes.RPAREN);
filter.copy(PdePartialTokenTypes.LCURLY);
filter.copy(PdePartialTokenTypes.RCURLY);
filter.copy(PdePartialTokenTypes.COMMA);
filter.copy(PdePartialTokenTypes.RBRACK);
filter.copy(PdePartialTokenTypes.LBRACK);
filter.copy(PdePartialTokenTypes.COLON);
filter.copy(PdePartialTokenTypes.TRIPLE_DOT);
// Because the meanings of < and > are overloaded to support
// type arguments and type parameters, we have to treat them
// as copyable to hidden text (or else the following syntax,
// such as (); and what not gets lost under certain circumstances)
// -- jdf
filter.copy(PdePartialTokenTypes.LT);
filter.copy(PdePartialTokenTypes.GT);
filter.copy(PdePartialTokenTypes.SR);
filter.copy(PdePartialTokenTypes.BSR);
// create a parser and set what sort of AST should be generated
//
final PdeRecognizer parser = new PdeRecognizer(this, filter);
// use our extended AST class
//
parser.setASTNodeClass("antlr.ExtendedCommonASTWithHiddenTokens");
return parser;
}
/**
* Walk the tree looking for METHOD_DEFs. Any simple METHOD_DEF (one
* without TYPE_PARAMETERS) lacking an
* access specifier is given public access.
* @param node
*/
private void makeSimpleMethodsPublic(final AST node) {
if (node.getType() == PdeTokenTypes.METHOD_DEF) {
final AST mods = node.getFirstChild();
final AST oldFirstMod = mods.getFirstChild();
for (AST mod = oldFirstMod; mod != null; mod = mod.getNextSibling()) {
final int t = mod.getType();
if (t == PdeTokenTypes.LITERAL_private ||
t == PdeTokenTypes.LITERAL_protected ||
t == PdeTokenTypes.LITERAL_public) {
return;
}
}
if (mods.getNextSibling().getType() == PdeTokenTypes.TYPE_PARAMETERS) {
return;
}
final CommonHiddenStreamToken publicToken =
new CommonHiddenStreamToken(PdeTokenTypes.LITERAL_public, "public") {
{
setHiddenAfter(new CommonHiddenStreamToken(PdeTokenTypes.WS, " "));
}
};
final AST publicNode = new CommonASTWithHiddenTokens(publicToken);
publicNode.setNextSibling(oldFirstMod);
mods.setFirstChild(publicNode);
} else {
for (AST kid = node.getFirstChild(); kid != null; kid = kid
.getNextSibling())
makeSimpleMethodsPublic(kid);
}
}
protected void writeParseTree(String filename, AST ast) {
try {
PrintStream stream = new PrintStream(new FileOutputStream(filename));
stream.println("<?xml version=\"1.0\"?>");
stream.println("<document>");
OutputStreamWriter writer = new OutputStreamWriter(stream);
if (ast != null) {
((CommonAST) ast).xmlSerialize(writer);
}
writer.flush();
stream.println("</document>");
writer.close();
} catch (IOException e) {
}
}
/**
*
* @param out
* @param programImports
* @param codeFolderImports
* @return the header offset
*/
protected int writeImports(final PrintWriter out,
final List<String> programImports,
final List<String> codeFolderImports) {
int count = writeImportList(out, getCoreImports());
count += writeImportList(out, programImports);
count += writeImportList(out, codeFolderImports);
count += writeImportList(out, getDefaultImports());
return count;
}
protected int writeImportList(PrintWriter out, List<String> imports) {
return writeImportList(out, imports.toArray(new String[0]));
}
protected int writeImportList(PrintWriter out, String[] imports) {
int count = 0;
if (imports != null && imports.length != 0) {
for (String item : imports) {
out.println("import " + item + "; ");
count++;
}
out.println();
count++;
}
return count;
}
/**
* Write any required header material (eg imports, class decl stuff)
*
* @param out PrintStream to write it to.
* @param exporting Is this being exported from PDE?
* @param className Name of the class being created.
*/
protected void writeDeclaration(PrintWriter out, String className) {
if (mode == Mode.JAVA) {
// Print two blank lines so that the offset doesn't change
out.println();
out.println();
} else if (mode == Mode.ACTIVE) {
// Print an extra blank line so the offset is identical to the others
out.println("public class " + className + " extends PApplet {");
out.println();
} else if (mode == Mode.STATIC) {
out.println("public class " + className + " extends PApplet {");
out.println(indent + "public void setup() {");
}
}
/**
* Write any necessary closing text.
*
* @param out PrintStream to write it to.
*/
protected void writeFooter(PrintWriter out, String className) {
if (mode == Mode.STATIC) {
// close off setup() definition
out.println(indent + indent + "noLoop();");
out.println(indent + "}");
out.println();
}
if ((mode == Mode.STATIC) || (mode == Mode.ACTIVE)) {
// doesn't remove the original size() method, but calling size()
// again in setup() is harmless.
if (!hasMethod("settings") && sizeInfo.hasSettings()) {
out.println(indent + "public void settings() { " + sizeInfo.getSettings() + " }");
// out.println(indent + "public void settings() {");
// out.println(indent + indent + sizeStatement);
// out.println(indent + "}");
}
/*
if (sketchWidth != null && !hasMethod("sketchWidth")) {
// Only include if it's a number (a variable will be a problem)
if (PApplet.parseInt(sketchWidth, -1) != -1 || sketchWidth.equals("displayWidth")) {
out.println(indent + "public int sketchWidth() { return " + sketchWidth + "; }");
}
}
if (sketchHeight != null && !hasMethod("sketchHeight")) {
// Only include if it's a number
if (PApplet.parseInt(sketchHeight, -1) != -1 || sketchHeight.equals("displayHeight")) {
out.println(indent + "public int sketchHeight() { return " + sketchHeight + "; }");
}
}
if (sketchRenderer != null && !hasMethod("sketchRenderer")) {
// Only include if it's a known renderer (otherwise it might be a variable)
//if (PConstants.rendererList.hasValue(sketchRenderer)) {
out.println(indent + "public String sketchRenderer() { return " + sketchRenderer + "; }");
//}
}
if (sketchOutputPath != null && !hasMethod("sketchOutputPath")) {
out.println(indent + "public String sketchOutputPath() { return " + sketchOutputPath + "; }");
}
*/
if (!hasMethod("main")) {
out.println(indent + "static public void main(String[] passedArgs) {");
//out.print(indent + indent + "PApplet.main(new String[] { ");
out.print(indent + indent + "String[] appletArgs = new String[] { ");
if (Preferences.getBoolean("export.application.present")) {
out.print("\"" + PApplet.ARGS_PRESENT + "\", ");
String farbe = Preferences.get("run.present.bgcolor");
out.print("\"" + PApplet.ARGS_WINDOW_COLOR + "=" + farbe + "\", ");
if (Preferences.getBoolean("export.application.stop")) {
farbe = Preferences.get("run.present.stop.color");
out.print("\"" + PApplet.ARGS_STOP_COLOR + "=" + farbe + "\", ");
} else {
out.print("\"" + PApplet.ARGS_HIDE_STOP + "\", ");
}
// } else {
// // This is set initially based on the system control color, just
// // sets the color for what goes behind the sketch before it's added.
// String farbe = Preferences.get("run.window.bgcolor");
// out.print("\"" + PApplet.ARGS_BGCOLOR + "=" + farbe + "\", ");
}
out.println("\"" + className + "\" };");
out.println(indent + indent + "if (passedArgs != null) {");
out.println(indent + indent + " PApplet.main(concat(appletArgs, passedArgs));");
out.println(indent + indent + "} else {");
out.println(indent + indent + " PApplet.main(appletArgs);");
out.println(indent + indent + "}");
out.println(indent + "}");
}
// close off the class definition
out.println("}");
}
}
public String[] getCoreImports() {
return new String[] {
"processing.core.*",
"processing.data.*",
"processing.event.*",
"processing.opengl.*"
};
}
public String[] getDefaultImports() {
// These may change in-between (if the prefs panel adds this option)
//String prefsLine = Preferences.get("preproc.imports");
//return PApplet.splitTokens(prefsLine, ", ");
return new String[] {
"java.util.HashMap",
"java.util.ArrayList",
"java.io.File",
"java.io.BufferedReader",
"java.io.PrintWriter",
"java.io.InputStream",
"java.io.OutputStream",
"java.io.IOException"
};
}
/**
* Return true if this import should be removed from the code. This is used
* for packages like processing.xml which no longer exist.
* @param pkg something like processing.xml.XMLElement or processing.xml.*
* @return true if this shouldn't be added to the final code
*/
public boolean ignoreImport(String pkg) {
return false;
// return pkg.startsWith("processing.xml.");
}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
/**
* Find the first CLASS_DEF node in the tree, and return the name of the
* class in question.
*
* TODO [dmose] right now, we're using a little hack to the grammar to get
* this info. In fact, we should be descending the AST passed in.
*/
String getFirstClassName(AST ast) {
String t = advClassName;
advClassName = "";
return t;
}
public void debugAST(final AST ast, final boolean includeHidden) {
System.err.println("------------------");
debugAST(ast, includeHidden, 0);
}
private void debugAST(final AST ast, final boolean includeHidden,
final int indent) {
for (int i = 0; i < indent; i++)
System.err.print(" ");
if (includeHidden) {
System.err.print(debugHiddenBefore(ast));
}
if (ast.getType() > 0 && !ast.getText().equals(TokenUtil.nameOf(ast))) {
System.err.print(TokenUtil.nameOf(ast) + "/");
}
System.err.print(ast.getText().replace("\n", "\\n"));
if (includeHidden) {
System.err.print(debugHiddenAfter(ast));
}
System.err.println();
for (AST kid = ast.getFirstChild(); kid != null; kid = kid.getNextSibling())
debugAST(kid, includeHidden, indent + 1);
}
private String debugHiddenAfter(AST ast) {
return (ast instanceof antlr.CommonASTWithHiddenTokens) ?
debugHiddenTokens(((antlr.CommonASTWithHiddenTokens) ast).getHiddenAfter()) : "";
}
private String debugHiddenBefore(AST ast) {
if (!(ast instanceof antlr.CommonASTWithHiddenTokens)) {
return "";
}
antlr.CommonHiddenStreamToken parent =
((antlr.CommonASTWithHiddenTokens) ast).getHiddenBefore();
if (parent == null) {
return "";
}
antlr.CommonHiddenStreamToken child = null;
do {
child = parent;
parent = child.getHiddenBefore();
} while (parent != null);
return debugHiddenTokens(child);
}
private String debugHiddenTokens(antlr.CommonHiddenStreamToken t) {
final StringBuilder sb = new StringBuilder();
for (; t != null; t = filter.getHiddenAfter(t)) {
if (sb.length() == 0) {
sb.append("[");
}
sb.append(t.getText().replace("\n", "\\n"));
}
if (sb.length() > 0) {
sb.append("]");
}
return sb.toString();
}
}
|
[
"[email protected]"
] | |
edf36321b55a1fd3ac875f44caf74dbbbe619d29
|
f5f143087f35fa67fa4c54cad106a32e1fb45c0e
|
/src/com/jpexs/decompiler/flash/exporters/BinaryDataExporter.java
|
158185a955ab0049971e35d24ce2aaa810ae5d13
|
[] |
no_license
|
SiverDX/SWFCopyValues
|
03b665b8f4ae3a2a22f360ea722813eeb52b4ef0
|
d146d8dcf6d1f7a69aa0471f85b852e64cad02f7
|
refs/heads/master
| 2022-07-29T06:56:55.446686 | 2021-12-04T09:48:48 | 2021-12-04T09:48:48 | 324,795,135 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,127 |
java
|
/*
* Copyright (C) 2010-2018 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.exporters;
import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler;
import com.jpexs.decompiler.flash.EventListener;
import com.jpexs.decompiler.flash.ReadOnlyTagList;
import com.jpexs.decompiler.flash.RetryTask;
import com.jpexs.decompiler.flash.exporters.settings.BinaryDataExportSettings;
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.Path;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author JPEXS
*/
public class BinaryDataExporter {
public List<File> exportBinaryData(AbortRetryIgnoreHandler handler, String outdir, ReadOnlyTagList tags, BinaryDataExportSettings settings, EventListener evl) throws IOException, InterruptedException {
List<File> ret = new ArrayList<>();
if (tags.isEmpty()) {
return ret;
}
File foutdir = new File(outdir);
Path.createDirectorySafe(foutdir);
int count = 0;
for (Tag t : tags) {
if (t instanceof DefineBinaryDataTag) {
count++;
}
}
if (count == 0) {
return ret;
}
int currentIndex = 1;
for (final Tag t : tags) {
if (t instanceof DefineBinaryDataTag) {
DefineBinaryDataTag bdt = (DefineBinaryDataTag) t;
if (evl != null) {
evl.handleExportingEvent("binarydata", currentIndex, count, t.getName());
}
String ext = bdt.innerSwf == null ? ".bin" : ".swf";
final File file = new File(outdir + File.separator + Helper.makeFileName(bdt.getCharacterExportFileName() + ext));
new RetryTask(() -> {
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
fos.write(bdt.binaryData.getRangeData());
}
}, handler).run();
ret.add(file);
if (evl != null) {
evl.handleExportedEvent("binarydata", currentIndex, count, t.getName());
}
currentIndex++;
}
}
return ret;
}
}
|
[
"[email protected]"
] | |
49e289e101b2d2a1b4a79e74a86b2bba931a1757
|
96f14d98ebfe22ba28eb4fcfe8f1c97ab19071ca
|
/src/mei/KeyControl2048.java
|
964d8b0b45b8230198bcf9c4da97d18377eec941
|
[] |
no_license
|
rk0722/2048-1
|
69a13b657f05c7e817e9a9552316efbcd9b86f61
|
732dc868e59043997b25796379626faf3eadffaa
|
refs/heads/master
| 2021-08-09T03:00:17.678363 | 2017-11-12T01:58:26 | 2017-11-12T01:58:26 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 511 |
java
|
package mei;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
public class KeyControl2048 implements KeyListener {
Game2048 newGame;
public KeyControl2048(Game2048 newGame) {
this.newGame = newGame;
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
newGame.Calculation(e.getKeyCode());
System.out.println("key");
}
@Override
public void keyReleased(KeyEvent e) {
}
}
|
[
"[email protected]"
] | |
a65d98a6963bb06c2206a8f6a8dcd0dac9f314b8
|
ef19aede022ead2c210ec77c3a009ff6a65c0e98
|
/src/estoqueProjeto/Produto.java
|
a71d181a4ba5b538c392b147578f9de317f808aa
|
[] |
no_license
|
Beatrizgomesv/estoque-java
|
a1c2a0a27ec7ad9bda9f1a2a0c3e36a9de2469e7
|
598437d5d68a465ce234a50d6d960d1befc76de2
|
refs/heads/main
| 2023-06-10T23:43:04.339329 | 2021-07-05T21:38:59 | 2021-07-05T21:38:59 | 383,270,161 | 1 | 0 | null | null | null | null |
ISO-8859-1
|
Java
| false | false | 1,126 |
java
|
package estoqueProjeto;
public class Produto {
private String nome;
private double preço;
private int quantidade;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public double getPreço() {
return preço;
}
public void setPreço(double preço) {
this.preço = preço;
}
public int getQuantidade() {
return quantidade;
}
public void setQuantidade(int quantidade) {
this.quantidade = quantidade;
}
public Produto(String nome, double preço, int quantidade) {
this.nome = nome;
this.preço = preço;
this.quantidade = quantidade;
}
public Produto(String nome, double preço) {
this.nome = nome;
this.preço = preço;
}
public double valorTotalEmEstoque() {
return preço * quantidade;
}
public void addProdutos (int quantidade) {
this.quantidade += quantidade;
}
public void removeProdutos (int quantidade) {
this.quantidade -= quantidade;
}
public String toString() {
return nome
+ ", R$"
+ String.format("%.2f",preço)
+ ", "
+ quantidade
+ " Unidades, Total: R$ "
+ String.format("%.2f",valorTotalEmEstoque());
}
}
|
[
"[email protected]"
] | |
8990020fc6dbd3d47c170d58207e6ac5b493434e
|
bec08e55120fd09a0d8f59e82aff97bbff228c7b
|
/2.JavaCore/src/com/javarush/task/task19/task1922/Solution.java
|
225dbfd1860e06099fc4b2b8fbaf6095c3828a26
|
[] |
no_license
|
sergeymamonov/JavaRushTasks
|
79f087ba631334321a275227286a02998c68135f
|
5723f977672f8631692a0cf3aad5b7a32731dcd1
|
refs/heads/main
| 2023-02-22T16:14:32.665336 | 2021-01-30T07:19:35 | 2021-01-30T07:19:35 | 316,418,200 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,369 |
java
|
package com.javarush.task.task19.task1922;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Ищем нужные строки
*/
public class Solution {
public static List<String> words = new ArrayList<String>();
static {
words.add("файл");
words.add("вид");
words.add("В");
}
public static void main(String[] args) {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
try {
String fileName = bufferedReader.readLine();
bufferedReader.close();
BufferedReader bufferedReader1 = new BufferedReader(new FileReader(fileName));
String line;
while (bufferedReader1.ready()) {
int counter = 0;
line = bufferedReader1.readLine();
String[] splitLine = line.split(" ");
for (String s : splitLine) {
if (words.contains(s)) {
counter++;
}
}
if (counter == 2) {
System.out.println(line);
}
}
bufferedReader1.close();
} catch (IOException e) {
}
}
}
|
[
"[email protected]"
] | |
346f154a8952f0c52078a6f3471401e95cf7d8d4
|
80465ff002d9c5b2e4edf53e3619ec9ab02bc420
|
/backend2/src/main/java/com/google/sample/mobileassistant/backend2/MaintenanceTasksServlet.java
|
5f95c675324a46b432c3c936d3c42ea5826ff8d4
|
[] |
no_license
|
gurvg/MobileAssistant
|
fcb0425ff997e5d482484b217fb5a345d25f5c86
|
2f851257101039653eb9bb31d6ef666da4bfd7cd
|
refs/heads/master
| 2016-09-08T01:58:09.155660 | 2015-05-13T10:25:18 | 2015-05-13T10:25:26 | 35,542,135 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,064 |
java
|
/* Copyright (c) 2012 Google Inc.
*
* 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.google.sample.mobileassistant.backend2;
import com.google.appengine.api.search.Document;
import com.google.appengine.api.search.GetRequest;
import com.google.appengine.api.search.GetResponse;
import com.google.appengine.api.search.Index;
import com.google.appengine.api.search.PutException;
import com.google.appengine.api.search.StatusCode;
import java.io.IOException;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* HttpServlet for handling maintenance tasks.
*/
public class MaintenanceTasksServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.setContentType("text/plain");
if (!buildSearchIndexForPlaces()) {
resp.getWriter().println("MaintenanceTasks failed. Try again by refreshing the page.");
return;
}
resp.getWriter().println("MaintenanceTasks completed");
}
@SuppressWarnings({"cast", "unchecked"})
private boolean buildSearchIndexForPlaces() {
Index index = PlacesHelper.getIndex();
removeAllDocumentsFromIndex();
EntityManager mgr = getEntityManager();
try {
Query query = mgr.createQuery("select from Place as Place");
for (Object obj : (List<Object>) query.getResultList()) {
Place place = (Place) obj;
Document placeAsDocument = PlacesHelper.buildDocument(
place.getPlaceId(), place.getName(), place.getAddress(), place.getLocation());
try {
index.put(placeAsDocument);
} catch (PutException e) {
if (StatusCode.TRANSIENT_ERROR.equals(e.getOperationResult().getCode())) {
return false;
}
}
}
} catch (Exception e) {
return false;
} finally {
mgr.close();
}
return true;
}
private void removeAllDocumentsFromIndex() {
Index index = PlacesHelper.getIndex();
GetRequest request = GetRequest.newBuilder().setReturningIdsOnly(true).build();
GetResponse<Document> response = index.getRange(request);
for (Document document : response.getResults()) {
index.delete(document.getId());
}
}
private static EntityManager getEntityManager() {
return EMF.get().createEntityManager();
}
}
|
[
"[email protected]"
] | |
1793f0da67e5891af8c7e83c8c8fa5be698d3d10
|
ab859f0d26b9e7cf23155abc5cbc378a8239cb0a
|
/app/src/test/java/com/example/quickreddit/ExampleUnitTest.java
|
feca28aa302c69126232efff64c66f9984db60ab
|
[] |
no_license
|
RyanCorey/QuickReddit
|
3804cb5fcf42a1ee67baf3e3830aa1378402be20
|
57ec20bb94219e843664018b3e8cd0bdd007d9d4
|
refs/heads/master
| 2023-01-07T19:06:33.007205 | 2020-11-13T20:14:46 | 2020-11-13T20:14:46 | 283,576,716 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 384 |
java
|
package com.example.quickreddit;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
|
[
"[email protected]"
] | |
ab2f2859557a3c49b4fba7ef80e31f13db1f98d1
|
ac2cc0116c34db5ac2273faa97490e38911d017a
|
/000_programmering/java-workspace/CSV-data-fetcher/src/main/java/Parameters.java
|
38d609b65f81ebd41464615f7570b5fbac0f592f
|
[] |
no_license
|
olof-brandt/CSV-data-fetcher
|
0aa2c862de1ee1268c7fb45a6be87481ce563422
|
fddbc25689603fe490988c2e5b9a0c40182162c8
|
refs/heads/main
| 2023-08-24T04:25:19.567862 | 2021-10-05T21:55:10 | 2021-10-05T21:55:10 | 412,039,580 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,127 |
java
|
package sunnyOffgrid02;
public class Parameters
{
int hejsan;
static class OwnBooleans
{
//instance variables
public boolean predecidedSystem = false;
public boolean batteriesDecided = false;
public boolean latexEnglish = false;
public boolean sale = true;
public boolean autoSlope = true;
public boolean lithium = false;
public boolean solarPowerSystemDecided = false; //Samma som predecided?
public boolean createFolder = true;
public boolean createLatex = false;
public boolean runFinalPlotting = true;
}
static class OwnConstants
{
public int constantInitial = 1;
public int panelsDecided = constantInitial;
public int batteriesDecided = constantInitial;
public static int WORST_MONTH_INDEX;
//public int worstMonthNumber = worstMonthNumberInitial;
//Technical parameters
//public double solarPanelArea = 1.26; //m^2, for 200 W panel
public double PVPanelSlopeManual = 10;
public double badDayScalar = 0.1;
public double goodDayScalar = 1.0;
public int rainyDayProducedEnergy = constantInitial;
public int sunnyDayProducedEnergy = constantInitial;
public int rainyDayProducedEnergyLowestWh = constantInitial;
public int sunnyDayProducedEnergyLowestWh = constantInitial;
//SoC percentages
public int minimumSocMarginFromGoalPercent = 20;
public int maximumSocGoalPercent = 100;
public int minimumSocGoalPercent = 50;
//Efficiency in percent
public double etaPV = 0.18;
public double etaMPPT = 0.9;
public double etaSolar = etaPV * etaMPPT;
public double etaInverter = 0.9;
//Rated specifications
public int panelRatedPowerW = 200;
public int individualBatteryChargeAh = 72;
public double PVpanelAreaM2 = 1.26;
public double PVPanelSlope = constantInitial;
public double loadPowerW = constantInitial;
public double loadPowerWGross = constantInitial;
public int individualBatteryEnergyWh = 12 * individualBatteryChargeAh;
public int individualBatteryEnergyJ = 3600 * individualBatteryEnergyWh;
//SoC goals
public double socMinGoalLeadAcid = 0.5;
public double socMinGoalLithium = 0.2;
//PV simulation parameters
public double simulationDurationHours = 23.0;
public double simulationLoadStartHours = 0.5;
public double simulationLoadRising = 20.0;
public double simulationLoadFalling = 20;
public double simulationLoadDurationSeconds = 3600 * simulationDurationHours;
//Programming variables
public int countLocation = 0;
public int countLocationLen = constantInitial;
//Computer program functionality
public int beepFrequency1 = 300; //Hz
public int beepFrequency2 = 600; //Hz
public int beepDuration = 300; //ms
}
static class OwnVariables
{
public int variableInitial = 1;
public int irradiationAverageMonthly = variableInitial;
public int irradiationGoodDay = variableInitial;
public int irradiationBadDay = variableInitial;
public int temperatureAverageMonthly = variableInitial;
public int dayLengthAverageMonthly = variableInitial;
public int pvPanels = variableInitial;
public int batteries = variableInitial;
}
static class OwnVectors
{
public int[] initialVectorInt = new int[]{};
public String[] initialVectorString = new String[]{};
public int[] allMonthsNumbers = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
public String[] allMonthsTextSvenska = new String[]{"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"};
public int[] allMonthsIrradiance = initialVectorInt;
public int[] allMonthsTemperature = initialVectorInt;
public int[] allMonthsDayLength = initialVectorInt;
public int[] chosenMonthsNumbers = initialVectorInt;
public int[] chosenMonthsDayLength = initialVectorInt;
public int[] chosenMonthsIrradiance = initialVectorInt;
public int[] chosenMonthsTemperature = initialVectorInt;
public String[] chosenMonthsTextSvenska = initialVectorString;
}
static class OwnStrings
{
public String emptyString = "";
public String receiptNumber = "21";
public String csvFolderName = "csvFolder/";
public String bibliographyFile;
public String titleFileEndBattery;
public String titleFileEndPVpanel;
public String titleIterPlotBattery;
public String titleIterPlotPVpanel;
public String imageConnection;
public String imageBattery;
public String imageHeading;
public String imageLogo;
public String imagePVpanel;
public String simulationNameInitial = "";
public String simulationName = simulationNameInitial;
public String worstMonthTextInitial = "Juni";
public String worstMonthText = worstMonthTextInitial;
public String functionFolderName = simulationNameInitial;
}
}
|
[
"[email protected]"
] | |
ec9f24e59090d19ba1e19205e0d003209ab44fae
|
9de7ad20e95da3f2428eccd426e5a03fba300670
|
/app/src/main/java/com/sxjs/jd/composition/main/homefragment/MainHomeFragment.java
|
cf41a9605a575cdaa1e47d618b765afd1dbe8f85
|
[
"Apache-2.0"
] |
permissive
|
RockySteveJobs/JD-Test
|
8f0986498f2b0a2a02d51c9d74fcb0ae243d2a31
|
1360ad59fa9e029cf67155444f3864cd29fbbcfd
|
refs/heads/master
| 2021-01-19T19:59:06.353441 | 2017-04-16T12:02:01 | 2017-04-16T12:02:01 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,293 |
java
|
package com.sxjs.jd.composition.main.homefragment;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import com.sxjs.common.base.baseadapter.BaseQuickAdapter;
import com.sxjs.common.util.ScreenUtil;
import com.sxjs.common.widget.headerview.JDHeaderView;
import com.sxjs.common.widget.pulltorefresh.PtrFrameLayout;
import com.sxjs.common.widget.pulltorefresh.PtrHandler;
import com.sxjs.jd.R;
import com.sxjs.common.base.BaseFragment;
import com.sxjs.jd.entities.HomeIndex;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* @author 作者:admin on 2017/3/15 10:47.
*/
public class MainHomeFragment extends BaseFragment implements JDHeaderView.RefreshDistanceListener ,HomeContract.View, PositionChangedListener, BaseQuickAdapter.RequestLoadMoreListener {
/**
* 改变titlebar中icon颜色时的距离
*/
private static int DISTANCE_WHEN_TO_SELECTED = 40;
@BindView(R.id.scanning_layout)
LinearLayout scanningLayout;
@BindView(R.id.advisory_layout)
LinearLayout advisoryLayout;
@BindView(R.id.home_title_bar_layout)
FrameLayout homeTitleBarLayout;
@BindView(R.id.home_title_bar_bg_view)
View homeTitleBarBgView;
private View rootView = null;
private RecyclerView recyclerView;
private JDHeaderView mPtrFrame;
private HomeMultipleRecycleAdapter adapter;
private int distanceY;
/**
* 加载首页样式标记
*/
private int flag = 1;
@Inject
HomePresenter mPresenter;
public static MainHomeFragment newInstance() {
return new MainHomeFragment();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_recycle, container, false);
initBase();
unbinder = ButterKnife.bind(this, rootView);
return rootView;
}
/**
* 初始化下拉刷新及滚动距离title发生的改变
*/
private void initBase() {
DaggerHomeFragmentComponent.builder()
.appComponent(getAppComponent())
.homePresenterModule(new HomePresenterModule(this))
.build()
.inject(this);
initPtrFrame();
recyclerView = (RecyclerView) this.rootView.findViewById(R.id.recyclerView);
GridLayoutManager gridLayoutManager = new GridLayoutManager(recyclerView.getContext(), 4, GridLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(gridLayoutManager);
recyclerView.addItemDecoration(new SpaceItemDecoration(ScreenUtil.dip2px(getContext(),3)));
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
distanceY += dy;
if (distanceY > ScreenUtil.dip2px(mActivity, 20)) {
homeTitleBarBgView.setBackgroundColor(getResources().getColor(R.color.white));
if (Build.VERSION.SDK_INT > 10) {
homeTitleBarBgView.setAlpha(distanceY * 1.0f / ScreenUtil.dip2px(mActivity, 100));
}
else {
DISTANCE_WHEN_TO_SELECTED = 20;
}
}
else {
homeTitleBarBgView.setBackgroundColor(0);
}
if (distanceY > ScreenUtil.dip2px(mActivity, DISTANCE_WHEN_TO_SELECTED) && !scanningLayout.isSelected()) {
scanningLayout.setSelected(true);
advisoryLayout.setSelected(true);
}
else if (distanceY <= ScreenUtil.dip2px(mActivity, DISTANCE_WHEN_TO_SELECTED) && scanningLayout.isSelected()) {
scanningLayout.setSelected(false);
advisoryLayout.setSelected(false);
}
}
});
adapter = new HomeMultipleRecycleAdapter();
/*recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
switch (newState){
//滑动停止
case RecyclerView.SCROLL_STATE_IDLE:
break;
//手指触摸屏幕停止或拖动时
case RecyclerView.SCROLL_STATE_DRAGGING:
break;
//滑动且手指离开屏幕
case RecyclerView.SCROLL_STATE_SETTLING:
break;
}
}
});*/
/*recyclerView.setOnFlingListener(new RecyclerView.OnFlingListener() {
@Override
public boolean onFling(int velocityX, int velocityY) {
if(Math.abs(velocityY) > 5000){
}
return false;
}
});*/
adapter.setOnLoadMoreListener(this);
adapter.setEnableLoadMore(true);
adapter.setListener(this);
recyclerView.setAdapter(adapter);
mPresenter.getHomeIndexData(flag);
flag = 0;
}
/**
* 初始化下拉刷新
*/
private void initPtrFrame() {
mPtrFrame = (JDHeaderView) rootView.findViewById(R.id.rotate_header_list_view_frame);
mPtrFrame.setOnRefreshDistanceListener(this);
mPtrFrame.setPtrHandler(new PtrHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
updateData();
}
});
// 是否进入页面就开始显示刷新动作
/*mPtrFrame.postDelayed(new Runnable() {
@Override
public void run() {
mPtrFrame.autoRefresh();
}
}, 100);*/
}
/**
* 下拉后刷新数据
*/
private void updateData() {
mPtrFrame.postDelayed(new Runnable() {
@Override
public void run() {
mPresenter.getHomeIndexData(flag);
if(flag == 0){
flag = 1;
}
else{
flag = 0;
}
}
}, 1000);
}
@Override
public void onStart() {
super.onStart();
}
@Override
public void onPositionChange(int currentPosY) {
if (currentPosY > 0) {
if (homeTitleBarLayout.getVisibility() == View.VISIBLE) {
homeTitleBarLayout.setVisibility(View.GONE);
}
} else {
if (homeTitleBarLayout.getVisibility() == View.GONE) {
homeTitleBarLayout.setVisibility(View.VISIBLE);
distanceY = 0;
}
}
}
@Override
public void setHomeIndexData(HomeIndex homeIndex) {
adapter.getData().clear();
adapter.resetMaxHasLoadPosition();
adapter.setNewData(homeIndex.itemInfoList);
mPtrFrame.refreshComplete();
}
@Override
public void setRecommendedWares(HomeIndex recommendedProducts) {
adapter.getData().addAll(recommendedProducts.itemInfoList);
adapter.loadMoreComplete();
}
@Override
public void setMoreRecommendedWares(HomeIndex moreRecommendedProducts) {
adapter.getData().addAll(moreRecommendedProducts.itemInfoList);
adapter.loadMoreComplete();
}
@Override
public void currentPosition(int position) {
}
@Override
public void onLoadMoreRequested() {
recyclerView.postDelayed(new Runnable() {
@Override
public void run() {
if (adapter.getData().size() >= 90){
adapter.loadMoreEnd(false);
}
else{
mPresenter.getRecommendedWares();
}
}
},1000);
}
}
|
[
"[email protected]"
] | |
9bf76d558d45372a5e010fbac22a61b3fe246791
|
195d4c75b198bd98d358c1899b9c14f7e1202bc0
|
/src/Criteria/CriteriaPatternDemo.java
|
15e6114d196c899f330a5a9b1001e30f00ace628
|
[] |
no_license
|
hyfj44255/design_pattern
|
a1738a60f3fc0c9ff06ddf68cb50c57b23a6b488
|
b7fa06e8eedd8f84fd99b340d30ef3418809f07c
|
refs/heads/master
| 2020-04-01T13:40:25.122745 | 2018-10-16T09:52:30 | 2018-10-16T09:52:30 | 153,262,373 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,590 |
java
|
package Criteria;
import java.util.ArrayList;
import java.util.List;
public class CriteriaPatternDemo {
public static void main(String[] args) {
List<Person> persons = new ArrayList<Person>();
persons.add(new Person("Robert","Male", "Single"));
persons.add(new Person("John","Male", "Married"));
persons.add(new Person("Laura","Female", "Married"));
persons.add(new Person("Diana","Female", "Single"));
persons.add(new Person("Mike","Male", "Single"));
persons.add(new Person("Bobby","Male", "Single"));
Criteria male = new CriteriaMale();
Criteria female = new CriteriaFemale();
Criteria single = new CriteriaSingle();
Criteria singleMale = new AndCriteria(single, male);
Criteria singleOrFemale = new OrCriteria(single, female);
System.out.println("Males: ");
printPersons(male.meetCriteria(persons));
System.out.println("\nFemales: ");
printPersons(female.meetCriteria(persons));
System.out.println("\nSingle Males: ");
printPersons(singleMale.meetCriteria(persons));
System.out.println("\nSingle Or Females: ");
printPersons(singleOrFemale.meetCriteria(persons));
}
public static void printPersons(List<Person> persons){
for (Person person : persons) {
System.out.println("Person : [ Name : " + person.getName()
+", Gender : " + person.getGender()
+", Marital Status : " + person.getMaritalStatus()
+" ]");
}
}
}
|
[
"[email protected]"
] | |
14a5a85682d6c8d746a622c000430e1930de6c11
|
c8c949b3710fbb4b983d03697ec9173a0ad3f79f
|
/src/HashTable/BinaryTreeInorderTraversal.java
|
4915343950568997fe95626502ba66a8f11de7f8
|
[] |
no_license
|
mxx626/myleet
|
ae4409dec30d81eaaef26518cdf52a75fd3810bc
|
5da424b2f09342947ba6a9fffb1cca31b7101cf0
|
refs/heads/master
| 2020-03-22T15:11:07.145406 | 2018-07-09T05:12:28 | 2018-07-09T05:12:28 | 140,234,151 | 2 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,710 |
java
|
package HashTable;
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;
public class BinaryTreeInorderTraversal {
private List<Integer> res = new LinkedList();
public List<Integer> inorderTraversal(TreeNode root) {
helper(root);
return res;
}
private void helper(TreeNode node){
if (node==null) return;
helper(node.left);
res.add(node.val);
helper(node.right);
}
class TreeNode{
int val;
TreeNode left;
TreeNode right;
public TreeNode(int x){
val = x;
}
}
public List<Integer> inorderTraversal2(TreeNode root) {
if (root==null) return res;
Stack<TreeNode> s = new Stack<>();
while (root!=null){
s.push(root);
root=root.left;
}
while (!s.isEmpty()){
TreeNode cur = s.pop();
res.add(cur.val);
if (cur.right!=null){
TreeNode tmp = cur.right;
while (tmp!=null){
s.push(tmp);
tmp=tmp.left;
}
}
}
return res;
}
public List<Integer> inorderTraversal3(TreeNode root) {
if (root==null) return res;
Stack<TreeNode> s = new Stack<>();
while (root!=null || !s.isEmpty()){
if (root!=null){
s.push(root);
root=root.left;
}
else {
root = s.pop();
res.add(root.val);
root = root.right;
}
}
return res;
}
}
|
[
"[email protected]"
] | |
8bd09e75a108f043c050c402983a1cb047061cfa
|
eb35338446f5ec106b1bcc532c388c6b422b1af5
|
/AjaxProject/source/practice/servlets/LoadStateServlet.java
|
c456dc8b7130193ea9209d0198a331a672ab391d
|
[] |
no_license
|
discovered1086/WEB-UI-FRONTEND-PROJECTS
|
4b0262486e2e1bb75c395b7270e77b928e6a9b7e
|
c2f4855ce1c15ed4bb82c9cfb1b57330cf06588d
|
refs/heads/master
| 2022-02-23T00:14:40.264235 | 2019-02-22T05:07:28 | 2019-02-22T05:07:28 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,364 |
java
|
package practice.servlets;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
/**
* Created by co21321 on 3/16/2017.
*/
@WebServlet(name = "LoadStateServlet", urlPatterns = "/loadStateServlet")
public class LoadStateServlet extends HttpServlet {
List<String> stateList = null;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String country = request.getParameter("country");
PrintWriter out = response.getWriter();
/*if("USA".equals(country)){
stateList.add("Connecticut");
stateList.add("New York");
stateList.add("Maine");
stateList.add("New Hampshire");
stateList.add("Vermont");
}else{
stateList.add("West Bengal");
stateList.add("Maharastra");
stateList.add("Delhi");
}*/
response.setContentType("text/html");
if ("USA".equals(country)) {
out.print("<option value='default' selected>Select a State</option>");
out.print("<option value='Connecticut'>Connecticut</option>");
out.print("<option value='New York'>New York</option>");
out.print("<option value='Maine'>Maine</option>");
out.print("<option value='New Hampshire'>New Hampshire</option>");
out.print("<option value='Vermont'>Vermont</option>");
} else {
out.print("<option value='default' selected>Select a State</option>");
out.print("<option value='West Bengal'>West Bengal</option>");
out.print("<option value='Maharastra'>Maharastra</option>");
out.print("<option value='Manipur'>Manipur</option>");
out.print("<option value='Nagaland'>Nagaland</option>");
out.print("<option value='Himachal Pradesh'>Himachal Pradesh</option>");
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
}
|
[
"[email protected]"
] | |
eb293b02bf06e739f9cf440e35ef9aad65312db9
|
e4ae3334220eb87d4581b21005d3522654d9a7a2
|
/app/src/main/java/workout/hfad/com/myorder/Login.java
|
310905570fbd5f2b2588b9a6df2b4826e76a4241
|
[] |
no_license
|
ssnitish/Food-Ordering-App
|
a5701c84a343ef70d433b6eaed15fc8a889138dc
|
7935e1705da4e0d516bd183b00f4b981dca5f94c
|
refs/heads/master
| 2021-01-21T21:00:06.912813 | 2017-06-19T11:11:45 | 2017-06-19T11:11:45 | 94,768,682 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 328 |
java
|
package workout.hfad.com.myorder;
import android.app.Activity;
import android.os.Bundle;
/**
* Created by sameershekhar on 03-Feb-16.
*/
public class Login extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
}
}
|
[
"[email protected]"
] | |
1a3074a9e6d4f975d03acf66c338ef135b500e2b
|
5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1
|
/Code Snippet Repository/Jetty/Jetty1181.java
|
886e2dbd71c115e1f6df681bf3530b64d964e05b
|
[] |
no_license
|
saber13812002/DeepCRM
|
3336a244d4852a364800af3181e03e868cf6f9f5
|
be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9
|
refs/heads/master
| 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,114 |
java
|
@Test
public void testDecode()
{
testDecode(6,0,"00");
testDecode(6,1,"01");
testDecode(6,62,"3e");
testDecode(6,63,"3f00");
testDecode(6,63+1,"3f01");
testDecode(6,63+0x7e,"3f7e");
testDecode(6,63+0x7f,"3f7f");
testDecode(6,63+0x80,"3f8001");
testDecode(6,63+0x81,"3f8101");
testDecode(6,63+0x7f+0x80*0x01,"3fFf01");
testDecode(6,63+0x00+0x80*0x02,"3f8002");
testDecode(6,63+0x01+0x80*0x02,"3f8102");
testDecode(6,63+0x7f+0x80*0x7f,"3fFf7f");
testDecode(6,63+0x00+0x80*0x80, "3f808001");
testDecode(6,63+0x7f+0x80*0x80*0x7f,"3fFf807f");
testDecode(6,63+0x00+0x80*0x80*0x80,"3f80808001");
testDecode(8,0,"00");
testDecode(8,1,"01");
testDecode(8,128,"80");
testDecode(8,254,"Fe");
testDecode(8,255,"Ff00");
testDecode(8,255+1,"Ff01");
testDecode(8,255+0x7e,"Ff7e");
testDecode(8,255+0x7f,"Ff7f");
testDecode(8,255+0x80,"Ff8001");
testDecode(8,255+0x00+0x80*0x80,"Ff808001");
}
|
[
"[email protected]"
] | |
b5e2027334ca1005d8ea73074085c6f2b6b0b20a
|
92f6227f08e19bd2e1bf79738bf906b9ed134091
|
/chapter_010/ModelMapping/src/main/java/ru/job4j/storage/EngineStorage.java
|
6472a97444c7da91bf0e131d93560c27c8a8592c
|
[
"Apache-2.0"
] |
permissive
|
kirillkrohmal/krohmal
|
b8af0e81b46081f53c8ff857609bb99785165f3f
|
12a8ce50caf76cf2c3b54a7fbaa2813fd3550a78
|
refs/heads/master
| 2023-06-23T17:27:56.513004 | 2023-06-13T07:05:56 | 2023-06-13T07:05:56 | 91,477,464 | 0 | 0 |
Apache-2.0
| 2023-02-22T08:20:14 | 2017-05-16T15:58:50 |
Java
|
UTF-8
|
Java
| false | false | 1,635 |
java
|
package ru.job4j.storage;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.query.Query;
import ru.job4j.models.Car;
import ru.job4j.models.Engine;
import java.util.ArrayList;
import java.util.List;
public class EngineStorage {
private static final EngineStorage INSTANSE = new EngineStorage();
public static EngineStorage getInstance() {
return INSTANSE;
}
SessionFactory factory = HibernateFactory.getSessionFactory();
public Engine add(Engine engine) {
Session session = factory.openSession();
Transaction tx = session.beginTransaction();
try {
session.save(engine);
return engine;
} finally {
tx.commit();
session.close();
}
}
public void delete(int id) {
try (Session session = factory.openSession()) {
Transaction tx = session.beginTransaction();
session.delete(new Engine(id));
tx.commit();
}
}
public List<Engine> getAll() {
List<Engine> engines = new ArrayList<>();
try (Session session = factory.openSession();) {
engines.addAll(session.createQuery("from engine").list());
}
return engines;
}
public Engine update(Engine engine) {
Session session = factory.openSession();
Transaction tx = session.beginTransaction();
try {
session.update(engine);
return engine;
} finally {
tx.commit();
session.close();
}
}
}
|
[
"[email protected]"
] | |
1bfe39381086ad1b477085e840844cc6b187e087
|
2fe2cef0548033785ae6ced579aa378518561c9e
|
/src/main/java/net/awairo/mcmod/spawnchecker/presetmode/Options.java
|
2deff2b414fdd38ced5a41522e04aa386061476d
|
[] |
no_license
|
reginn/SpawnChecker
|
431add80ad803fde11bb7de20119a138b9b570b4
|
4b143d5deae5840be96312f436a4644fe699a491
|
refs/heads/master
| 2020-03-29T08:22:27.988411 | 2017-06-18T06:14:14 | 2017-06-18T06:14:14 | 94,666,775 | 1 | 0 | null | 2017-06-18T05:17:53 | 2017-06-18T05:17:53 | null |
UTF-8
|
Java
| false | false | 4,211 |
java
|
/*
* SpawnChecker.
*
* (c) 2014 alalwww
* https://github.com/alalwww
*
* This mod is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL.
* Please check the contents of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt
*
* この MOD は、Minecraft Mod Public License (MMPL) 1.0 の条件のもとに配布されています。
* ライセンスの内容は次のサイトを確認してください。 http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.awairo.mcmod.spawnchecker.presetmode;
import java.util.Map;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import net.awairo.mcmod.spawnchecker.client.common.SimpleOption;
import net.awairo.mcmod.spawnchecker.client.mode.Mode;
/**
* モードオプション
*
* @author alalwww
*/
public final class Options
{
/** 無効. */
public static final Mode.Option DISABLED;
/** マーカー. */
public static final Mode.Option MARKER;
/** ガイドライン. */
public static final Mode.Option GUIDELINE;
/** スライム. */
public static final Mode.Option SLIME;
/** ガスト. */
public static final Mode.Option GHAST;
/** 強制. */
public static final Mode.Option FORCE;
/** マーカー強制. */
public static final Mode.Option FORCE_MARKER;
/** ガイドライン強制. */
public static final Mode.Option FORCE_GUIDELINE;
/** スライムマーカー強制. */
public static final Mode.Option FORCE_SLIME;
/** スライムチャンクマーカー. */
public static final Mode.Option SLIME_CHUNK;
/** 非表示. */
public static final Mode.Option SPAWNER_HIDDEN;
/** スポーン範囲. */
public static final Mode.Option SPAWNER_SPAWN_AREA;
/** スポーン数制限範囲. */
public static final Mode.Option SPAWNER_SPAWN_LIMIT_AREA;
/** スポーン可能ポイント. */
public static final Mode.Option SPAWNER_SPAWNABLE_POINT;
/** スポーン不可能ポイント. */
public static final Mode.Option SPAWNER_UNSPAWNABLE_POINT;
/** スポーナー活性化範囲. */
public static final Mode.Option SPAWNER_ACTIVATE_AREA;
/** IDからオプションを取得するためのマップ. */
public static final ImmutableMap<String, Optional<Mode.Option>> MAP;
static
{
final Map<String, Optional<Mode.Option>> map = Maps.newHashMap();
DISABLED = appendTo(map, "disable", 0);
MARKER = appendTo(map, "marker", 10);
GUIDELINE = appendTo(map, "guideline", 20);
SLIME = appendTo(map, "slime", 30);
GHAST = appendTo(map, "ghast", 40);
FORCE = appendTo(map, "force", 50);
FORCE_MARKER = appendTo(map, "force_marker", 60);
FORCE_GUIDELINE = appendTo(map, "force_guideline", 70);
FORCE_SLIME = appendTo(map, "force_slime", 80);
SLIME_CHUNK = appendTo(map, "slime_chunk", 10);
SPAWNER_HIDDEN = appendTo(map, "spawner_hidden", 10);
SPAWNER_SPAWN_AREA = appendTo(map, "spawner_spawn_area", 20);
SPAWNER_SPAWN_LIMIT_AREA = appendTo(map, "spawner_spawn_limit_area", 30);
SPAWNER_SPAWNABLE_POINT = appendTo(map, "spawner_spawnable_point", 40);
SPAWNER_UNSPAWNABLE_POINT = appendTo(map, "spawner_unspawnable_point", 50);
SPAWNER_ACTIVATE_AREA = appendTo(map, "spawner_activate_area", 60);
MAP = ImmutableMap.copyOf(map);
}
/**
* @param id モードオプションの識別子
* @return 識別子に一致するオプションがある場合はそのオプションを返却
*/
public static Optional<Mode.Option> valueOf(String id)
{
final Optional<Mode.Option> value = MAP.get(id);
return value != null ? value : Optional.<Mode.Option> absent();
}
private static Mode.Option appendTo(Map<String, Optional<Mode.Option>> map, String id, int ordinal)
{
final Mode.Option option = SimpleOption.of(id, "spawnchecker.option." + id, ordinal);
map.put(option.id(), Optional.of(option));
return option;
}
private Options()
{
}
}
|
[
"[email protected]"
] | |
4a621cb1598dbaa615b2255ec1f7da783aed8f5f
|
c3f9e1b8b8f4aa58d2fc4e00941e25b3790c3ce2
|
/ReceiveXCBLOrder/src/main/java/rrn/org_xcbl/schemas/xcbl/v3_5/xcbl35/TransportTermsCode.java
|
41299ac3d09f33bea3de243ee6213e55e4911840
|
[] |
no_license
|
mkaragh/ngoi
|
7dcb1e4d6dab4983469fc0e839654a5e700cc65b
|
ac84f88fd3152daaa2cafea8ed89723c3816f0d7
|
refs/heads/master
| 2020-05-02T06:35:05.600711 | 2019-09-10T05:34:43 | 2019-09-10T05:34:43 | 177,798,857 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,256 |
java
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2019.04.15 at 10:06:19 AM IST
//
package rrn.org_xcbl.schemas.xcbl.v3_5.xcbl35;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for TransportTermsCode.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="TransportTermsCode">
* <restriction base="{http://www.w3.org/2001/XMLSchema}NMTOKEN">
* <enumeration value="Other"/>
* <enumeration value="Ex-Works"/>
* <enumeration value="Free-Carrier"/>
* <enumeration value="FreeAlongsideShip"/>
* <enumeration value="FreeOnBoard"/>
* <enumeration value="CostAndFreight"/>
* <enumeration value="Cost-InsuranceAndFreight"/>
* <enumeration value="CarriagePaidTo"/>
* <enumeration value="Carriage-InsurancePaidTo"/>
* <enumeration value="DeliveredAtFrontier"/>
* <enumeration value="DeliveredEx-Ship"/>
* <enumeration value="DeliveredEx-Quay"/>
* <enumeration value="DeliveredDutyUnpaid"/>
* <enumeration value="DeliveredDutyPaid"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "TransportTermsCode")
@XmlEnum
public enum TransportTermsCode {
@XmlEnumValue("Other")
OTHER("Other"),
@XmlEnumValue("Ex-Works")
EX_WORKS("Ex-Works"),
@XmlEnumValue("Free-Carrier")
FREE_CARRIER("Free-Carrier"),
@XmlEnumValue("FreeAlongsideShip")
FREE_ALONGSIDE_SHIP("FreeAlongsideShip"),
@XmlEnumValue("FreeOnBoard")
FREE_ON_BOARD("FreeOnBoard"),
@XmlEnumValue("CostAndFreight")
COST_AND_FREIGHT("CostAndFreight"),
@XmlEnumValue("Cost-InsuranceAndFreight")
COST_INSURANCE_AND_FREIGHT("Cost-InsuranceAndFreight"),
@XmlEnumValue("CarriagePaidTo")
CARRIAGE_PAID_TO("CarriagePaidTo"),
@XmlEnumValue("Carriage-InsurancePaidTo")
CARRIAGE_INSURANCE_PAID_TO("Carriage-InsurancePaidTo"),
@XmlEnumValue("DeliveredAtFrontier")
DELIVERED_AT_FRONTIER("DeliveredAtFrontier"),
@XmlEnumValue("DeliveredEx-Ship")
DELIVERED_EX_SHIP("DeliveredEx-Ship"),
@XmlEnumValue("DeliveredEx-Quay")
DELIVERED_EX_QUAY("DeliveredEx-Quay"),
@XmlEnumValue("DeliveredDutyUnpaid")
DELIVERED_DUTY_UNPAID("DeliveredDutyUnpaid"),
@XmlEnumValue("DeliveredDutyPaid")
DELIVERED_DUTY_PAID("DeliveredDutyPaid");
private final String value;
TransportTermsCode(String v) {
value = v;
}
public String value() {
return value;
}
public static TransportTermsCode fromValue(String v) {
for (TransportTermsCode c: TransportTermsCode.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
|
[
"[email protected]"
] | |
a264d4b5ee1e3c3730930048d6c324a19d686a1d
|
d8a07d2eed68c10dd6bfd06007ce7c1bc3059417
|
/lab7/src/by/bntu/fitr/povt/justcompileit/javalabs/lab07/task4/controller/Controller.java
|
577a91b5a346a8a2bcb392078bc41a48078b044d
|
[] |
no_license
|
unkn0wnl/JavaLabs
|
66c265fa47fbffb58a63155f22794a640be3629a
|
17822dc27e1c7c2f82328c7584e136646a0f1507
|
refs/heads/master
| 2020-04-02T04:42:17.603327 | 2018-12-24T14:14:43 | 2018-12-24T14:14:43 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 777 |
java
|
package by.bntu.fitr.povt.justcompileit.javalabs.lab07.task4.controller;
import by.bntu.fitr.povt.justcompileit.javalabs.lab07.printer.Printer;
import by.bntu.fitr.povt.justcompileit.javalabs.lab07.task4.model.Dice;
public class Controller {
public static void main(String[] args) {
Dice dice1 = new Dice();
Dice dice2 = new Dice();
Printer.view("Dropped first num: " + dice1.getDroppedNumber());
Printer.view("Dropped second num: " + dice2.getDroppedNumber());
if (dice1.getDroppedNumber() == dice2.getDroppedNumber()){
Printer.view("\nCongratulation!\nYou are a lucky man!\nFirst num = Second num\n");
}
Printer.view("Total sum: " + (dice1.getDroppedNumber() + dice2.getDroppedNumber()));
}
}
|
[
"[email protected]"
] | |
806df23a179f36f2127e43bd05453d94b63ad45a
|
8a89eeea8142fd3cc4a5357ccd56238a0c664e7e
|
/DataLattes/src/main/java/br/com/Modelo/AreaConhecimento.java
|
821117e98e39c2d388ae6b1855fcdfc585acc00a
|
[] |
no_license
|
weltonah/DataLattesPublic
|
85494649a5c184392a6ee6926e2aec120deb06ca
|
bcd2755d7bf00bf0e1b8bb19812495fe4c0ffc4d
|
refs/heads/master
| 2021-09-13T13:57:27.374270 | 2018-04-30T21:18:54 | 2018-04-30T21:18:54 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 996 |
java
|
package br.com.Modelo;
/**
*
*/
public class AreaConhecimento {
private String grandeArea;
private String areaConhecimento;
private String subArea;
public AreaConhecimento(String grandeArea, String areaConhecimento, String subArea) {
super();
this.grandeArea = grandeArea;
this.areaConhecimento = areaConhecimento;
this.subArea = subArea;
}
public String getGrandeArea() {
return grandeArea;
}
public void setGrandeArea(String grandeArea) {
this.grandeArea = grandeArea;
}
public String getAreaConhecimento() {
return areaConhecimento;
}
public void setAreaConhecimento(String areaConhecimento) {
this.areaConhecimento = areaConhecimento;
}
public String getSubArea() {
return subArea;
}
public void setSubArea(String subArea) {
this.subArea = subArea;
}
public void imprimir() {
System.out.println("grandeArea: " + grandeArea);
System.out.println("areaConhecimento: " + areaConhecimento);
System.out.println("subArea: " + subArea);
}
}
|
[
"[email protected]"
] | |
3124981c0996b078d92c7642e4dc92b2891cc096
|
2c20d9fe21b1acf6c30aa391e74795ab5a9085a4
|
/test/test/com/interface21/context/support/ClassPathXmlApplicationContextTestTest.java
|
910ea94338bb6cd2b4af3bbd5c5a7176e9b59677
|
[
"Apache-1.1",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
eatMelon-Masses/spring-framework-0.9
|
bb192dd5d190bf074a87d45eee06d9a1af33bf32
|
dcf0410f44a5e3d3604ce9b6a8e8be8337fa4afd
|
refs/heads/master
| 2020-08-18T06:49:59.555853 | 2019-10-21T16:07:22 | 2019-10-21T16:07:22 | 215,760,507 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 844 |
java
|
package test.com.interface21.context.support;
import junit.framework.Test;
import junit.framework.TestSuite;
import junit.framework.TestCase;
/**
* ClassPathXmlApplicationContextTest Tester.
*
* @author <Authors name>
* @since <pre>10/21/2019</pre>
* @version 1.0
*/
public class ClassPathXmlApplicationContextTestTest extends TestCase {
public ClassPathXmlApplicationContextTestTest(String name) {
super(name);
}
public void setUp() throws Exception {
super.setUp();
}
public void tearDown() throws Exception {
super.tearDown();
}
public static Test suite() {
return new TestSuite(ClassPathXmlApplicationContextTestTest.class);
}
public void testCreateParentContext() {
}
public void testGetResourceByPath() {
}
public void testGetResourceBasePath() {
System.out.println();
}
}
|
[
"[email protected]"
] | |
a48c752778234c798e73490964e7e42285f14d7d
|
fd2fb99c8c59e4448b2af7c033bc630f7c3731a2
|
/ttdbsdk/src/main/java/com/ttdb/ttdbsdk/fragment/TTHomeFragment.java
|
f17cea4e72f11676ed03a74e1be526a17856dba4
|
[] |
no_license
|
luhuanxml/TTSDK
|
43b23bcdaf242c028ce8a2d399fb938b770bf482
|
828647f42d8adeac077d5f22259862aef4f42fae
|
refs/heads/master
| 2021-01-19T04:43:12.341101 | 2017-04-06T06:49:21 | 2017-04-06T06:49:21 | 87,285,517 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,110 |
java
|
package com.ttdb.ttdbsdk.fragment;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.ttdb.ttdbsdk.R;
import com.ttdb.ttdbsdk.activity.SearchActivity;
import com.ttdb.ttdbsdk.activity.TTMainActivity;
import com.ttdb.ttdbsdk.common.WebSetUtil;
import com.ttdb.ttdbsdk.dealjs.HomeContactPlugin;
import com.ttdb.ttdbsdk.utils.Constants;
import com.ttdb.ttdbsdk.utils.SP;
import com.ttdb.ttdbsdk.view.PullToRefreshView;
import static android.content.ContentValues.TAG;
public class TTHomeFragment extends TTBaseFragment implements View.OnClickListener{
private WebView webView;
private PullToRefreshView mPullToRefreshView;
@SuppressLint({"SetJavaScriptEnabled", "AddJavascriptInterface"})
@Override
protected void initView(View view, Bundle savedInstanceState) {
mPullToRefreshView = (PullToRefreshView) view.findViewById(R.id.pull_to_refresh);
mPullToRefreshView.setOnHeaderRefreshListener(new PullToRefreshView.OnHeaderRefreshListener() {
@Override
public void onHeaderRefresh(PullToRefreshView view) {
webView.loadUrl(Constants.MAIN_PAGE + getMainParameter());
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
mPullToRefreshView.onHeaderRefreshComplete();
}
});
}
});
view.findViewById(R.id.back).setOnClickListener(this);
view.findViewById(R.id.search).setOnClickListener(this);
webView = (WebView) view.findViewById(R.id.web_home);
HomeContactPlugin home = new HomeContactPlugin(this, (TTMainActivity) getActivity());
WebSetUtil.getInstance()
.setWebSetting(webView)
.setWebLoadingListener(webView, mContext)
.setScrollBarEnabled(webView, false)
.addJavascriptInterface(home, "contact");
}
@Override
public void onStart() {
super.onStart();
String url=Constants.MAIN_PAGE + getMainParameter();
Log.d("luhuan1", "onStart: "+url);
webView.loadUrl(url);
}
@Override
protected int getLayoutId() {
return R.layout.ttdb_fragment_home;
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.back) {
mActivity.finish();
}else if (v.getId() == R.id.search) {
SP.put("good_count",mActivity.getGoodCount());
Intent intent=new Intent(mActivity, SearchActivity.class);
startActivity(intent);
}
}
}
|
[
"[email protected]"
] | |
08db6dbd1cdbe2a176262d9bc92567e12c2f04d7
|
64e91ae971bc9551de8442fcd3f28afa7a6b5707
|
/src/main/java/edu/mit/jwi/item/ILexFile.java
|
8cf7399aaae236494221deaf378bc549116e11dc
|
[
"CC-BY-4.0",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
x-englishwordnet/jwi
|
061d76b05714ea78a9f8443509b5a87798cd7a35
|
fceb76d2fc35294bf46b1f60aa0d5058821ca076
|
refs/heads/master
| 2021-06-12T17:56:25.648361 | 2020-05-18T07:03:44 | 2020-05-18T07:03:44 | 254,371,497 | 0 | 0 |
NOASSERTION
| 2020-10-13T21:03:06 | 2020-04-09T12:57:00 |
Java
|
UTF-8
|
Java
| false | false | 1,728 |
java
|
/* ******************************************************************************
* Java Wordnet Interface Library (JWI) v2.4.0
* Copyright (c) 2007-2015 Mark A. Finlayson
*
* JWI is distributed under the terms of the Creative Commons Attribution 4.0
* International Public License, which means it may be freely used for all
* purposes, as long as proper acknowledgment is made. See the license file
* included with this distribution for more details.
*******************************************************************************/
package edu.mit.jwi.item;
import java.io.Serializable;
/**
* A description of a Wordnet lexical file. This interface does not give access
* to the actual lexicographer's file, but rather is a description, giving the
* name of the file, it's assigned number, and a brief description.
*
* @author Mark A. Finlayson
* @version 2.4.0
* @since JWI 2.1.0
*/
public interface ILexFile extends IHasPOS, Serializable
{
/**
* Returns the number of the lexicographer file. This is used in sense keys
* and the data files. A lexical file number is always in the closed range
* [0, 99].
*
* @return the lexicograph file number, between 0 and 99, inclusive.
* @since JWI 2.1.0
*/
int getNumber();
/**
* Returns the name of the lexicographer file. The string will not be
* <code>null</code>, empty, or all whitespace.
*
* @return the lexicographer file name
* @since JWI 2.1.0
*/
String getName();
/**
* Returns a description of the lexicographer file contents. The string will
* not be <code>null</code>, empty, or all whitespace.
*
* @return a description of the lexicographer file contents
* @since JWI 2.1.0
*/
String getDescription();
}
|
[
"[email protected]"
] | |
eeef62905effb5bdc88083afa2104461c30b5d7c
|
077c03beb2ae317d49de48cc6de6758ba033ff82
|
/blog-core/src/main/java/com/yzy/blog/persistence/beans/BizArticleTags.java
|
b39b94ecd0bd72d2f38794927b64eb630a00bacb
|
[
"MIT"
] |
permissive
|
youzhiyong/blog
|
831c61395d25a30de0df857bdc93321027d0c211
|
52a3a51ae30a05ae12cd543dd3907a070974df44
|
refs/heads/master
| 2020-03-20T05:04:33.829796 | 2018-09-18T03:15:16 | 2018-09-18T03:15:16 | 137,203,380 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,572 |
java
|
/**
* MIT License
* Copyright (c) 2018 yadong.zhang
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.yzy.blog.persistence.beans;
import com.yzy.blog.framework.object.AbstractDO;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @website https://www.youzhiyong.top
* @version 1.0
* @date 2018/4/16 16:26
* @since 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class BizArticleTags extends AbstractDO {
private Long tagId;
private Long articleId;
}
|
[
"[email protected]"
] | |
30bc42b01a24bba9451f8bee6b7efa622d9b5825
|
cf19b83f38fc3f7326dcf935221a5886c87730b5
|
/demonstration/DeleteDemo.java
|
bacf32652c0651a3a5e50acc9715b054bb48fdbc
|
[] |
no_license
|
Jamuna01/JDBC_Creation
|
303cb00bce3a7e0f42ce328b0a7af6fb5b2f935e
|
1f47b8f671e6414d142009a1519d61010f0916b9
|
refs/heads/main
| 2023-02-27T11:36:30.278376 | 2021-02-03T04:41:11 | 2021-02-03T04:41:11 | 335,340,900 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 518 |
java
|
package jdbc.demonstration;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
public class DeleteDemo
{
public static final String SQL = "delete from user_tbl where id=3";
public static void main(String[] args) throws ClassNotFoundException
{
try
{
Connection con = DbUtil.getConnection();
Statement st = con.createStatement();
st.executeUpdate(SQL);
System.out.printf("Data deleted!");
}
catch(SQLException e)
{
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
aabb72c693ee32dd607206d26b3d65f4a42fe3bc
|
23cda07aa7f4ea466ecd27e35377208a0a00ea90
|
/command/src/main/java/com/leven/command/Goblin.java
|
5e61ffc02d13c2c856596acc06659e188a959d84
|
[
"MIT"
] |
permissive
|
11figure/designpattern
|
1a885a9843fbf972885aee805cdf1f50f5246be3
|
b61a2835bb27fd7f7975c5d62409426870fa9679
|
refs/heads/master
| 2020-03-18T16:04:11.615096 | 2019-03-02T14:38:10 | 2019-03-02T14:38:10 | 134,944,448 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 362 |
java
|
package com.leven.command;
/**
* @Author: LevenLiu
* @Description:
* @Date: Create 23:30 2018/8/5
* @Modified By:
*/
public class Goblin extends Target {
public Goblin() {
setSize(Size.NORMAL);
setVisibility(Visibility.VISIABILE);
}
@Override
public String toString() {
return "com.leven.command.Goblin ";
}
}
|
[
"[email protected]"
] | |
fccd8e258360f448f5e9825140a501530dd04ddf
|
5129ece68e362d8a535d55bb2b50af993f178f8b
|
/src/main/java/ko/maeng/recursion/Factorial.java
|
54099512daab00bf8677cf6177142271a7bfd85a
|
[] |
no_license
|
Rebwon/algorithm
|
ea7a60fccc05fcd63851b052c0dbfedf58ab29e2
|
b80c2091bf010a0ec53a180bee8ed39309593f21
|
refs/heads/master
| 2020-04-29T16:31:43.676006 | 2019-04-18T08:05:31 | 2019-04-18T08:05:31 | 176,261,881 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 293 |
java
|
package ko.maeng.recursion;
public class Factorial {
public static void main(String[] args) {
System.out.println(factorial(4));
}
public static int factorial(int n) {
if (n == 0)
return 1;
else
return n * factorial(n - 1);
}
}
|
[
"[email protected]"
] | |
6f6fa02e3be0f7fe3ad7e5837f198b11b051e3b9
|
56f59ce4f32d43314da0af9d088dd87e4765ce44
|
/share-books-server/src/test/java/me/chong/sharebooksserver/utils/ExcelUtilsTest.java
|
a5a4c02dd93226ecae7d78e169aaa4a2472b0060
|
[
"Apache-2.0"
] |
permissive
|
LXChild/ShareBooks
|
f0447b21a2a99a1604595e7e0918200a2ff640a3
|
cec5df12d28283c67230d9a0489de1983aee43db
|
refs/heads/master
| 2021-01-22T02:28:53.931235 | 2017-09-03T08:00:25 | 2017-09-03T08:00:25 | 102,247,425 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 324 |
java
|
package me.chong.sharebooksserver.utils;
import org.junit.Test;
public class ExcelUtilsTest {
@Test
public void getAllByExcel() throws Exception {
// ExcelUtils.getAllByExcel("/Users/LXChild/Downloads/书籍清单.xlsx");
ExcelUtils.getExcel("/Users/LXChild/Downloads/书籍清单2.xls");
}
}
|
[
"[email protected]"
] | |
e1c3d75417eab31b124d293af17123a6a25cb75d
|
e14ab1ee1eac74e510faef92651065f0c6a13502
|
/AngularJS/src/org/angular2/lang/html/psi/impl/Angular2HtmlNgContentSelectorImpl.java
|
be8d1101b3f392a4dbbe2b7eda3ba7b5871cbd12
|
[
"Apache-2.0"
] |
permissive
|
suosuok/intellij-plugins
|
65d44cacaa31c52aea57d5a257e6fdc431822911
|
7c2c7d5aa4dd71818279c2159ced3175f33a95c1
|
refs/heads/master
| 2022-11-24T16:51:45.620117 | 2020-06-26T16:41:00 | 2020-06-29T05:18:48 | 275,747,122 | 1 | 0 | null | 2020-06-29T06:16:44 | 2020-06-29T06:16:44 | null |
UTF-8
|
Java
| false | false | 2,523 |
java
|
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.angular2.lang.html.psi.impl;
import com.intellij.extapi.psi.StubBasedPsiElementBase;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.PsiReference;
import com.intellij.psi.StubBasedPsiElement;
import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.util.ArrayUtil;
import org.angular2.entities.Angular2DirectiveSelector;
import org.angular2.entities.Angular2DirectiveSelectorImpl;
import org.angular2.lang.html.psi.Angular2HtmlElementVisitor;
import org.angular2.lang.html.psi.Angular2HtmlNgContentSelector;
import org.angular2.lang.html.stub.Angular2HtmlNgContentSelectorStub;
import org.jetbrains.annotations.NotNull;
public class Angular2HtmlNgContentSelectorImpl extends StubBasedPsiElementBase<Angular2HtmlNgContentSelectorStub>
implements Angular2HtmlNgContentSelector, StubBasedPsiElement<Angular2HtmlNgContentSelectorStub> {
public Angular2HtmlNgContentSelectorImpl(@NotNull Angular2HtmlNgContentSelectorStub stub,
@NotNull IStubElementType nodeType) {
super(stub, nodeType);
}
public Angular2HtmlNgContentSelectorImpl(@NotNull ASTNode node) {
super(node);
}
@Override
public @NotNull Angular2DirectiveSelector getSelector() {
Angular2HtmlNgContentSelectorStub stub = getGreenStub();
String text;
if (stub != null) {
text = stub.getSelector();
}
else {
text = getText();
}
return new Angular2DirectiveSelectorImpl(this, text,
p -> new TextRange(p.second, p.second + p.first.length()));
}
@Override
public String toString() {
return "Angular2HtmlNgContentSelector (" + getSelector() + ")";
}
@Override
public PsiReference getReference() {
return ArrayUtil.getFirstElement(getReferences());
}
@Override
public PsiReference @NotNull [] getReferences() {
return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
@Override
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof Angular2HtmlElementVisitor) {
((Angular2HtmlElementVisitor)visitor).visitNgContentSelector(this);
}
else {
super.accept(visitor);
}
}
}
|
[
"[email protected]"
] | |
0cd0e20738f29fc183e0b0f786c4702bf95767bd
|
b3e8c286f69ff584622a597ae892b39475028fd6
|
/TagWriterPoc_source/sources/android/support/design/widget/FloatingActionButtonHoneycombMr1.java
|
cc7e7948e9a5b1065aa1bc809f1ee2400b9c0fc3
|
[] |
no_license
|
EXPONENCIAL-IO/Accessphere
|
292e3ecf389a216cb656d5d3c22981061b7a2f45
|
1c07e06d85ed85972d14d848818dc24079a0ca2f
|
refs/heads/master
| 2022-11-24T22:12:37.776368 | 2020-07-26T02:30:17 | 2020-07-26T02:30:17 | 282,062,061 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,816 |
java
|
package android.support.design.widget;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.support.annotation.Nullable;
import android.support.p001v4.view.ViewCompat;
import android.view.View;
class FloatingActionButtonHoneycombMr1 extends FloatingActionButtonEclairMr1 {
/* access modifiers changed from: private */
public boolean mIsHiding;
FloatingActionButtonHoneycombMr1(View view, ShadowViewDelegate shadowViewDelegate) {
super(view, shadowViewDelegate);
}
/* access modifiers changed from: 0000 */
public boolean requirePreDrawListener() {
return true;
}
/* access modifiers changed from: 0000 */
public void onPreDraw() {
updateFromViewRotation(this.mView.getRotation());
}
/* access modifiers changed from: 0000 */
public void hide(@Nullable final InternalVisibilityChangedListener listener) {
if (this.mIsHiding || this.mView.getVisibility() != 0) {
if (listener != null) {
listener.onHidden();
}
} else if (!ViewCompat.isLaidOut(this.mView) || this.mView.isInEditMode()) {
this.mView.setVisibility(8);
if (listener != null) {
listener.onHidden();
}
} else {
this.mView.animate().scaleX(0.0f).scaleY(0.0f).alpha(0.0f).setDuration(200).setInterpolator(AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR).setListener(new AnimatorListenerAdapter() {
public void onAnimationStart(Animator animation) {
FloatingActionButtonHoneycombMr1.this.mIsHiding = true;
FloatingActionButtonHoneycombMr1.this.mView.setVisibility(0);
}
public void onAnimationCancel(Animator animation) {
FloatingActionButtonHoneycombMr1.this.mIsHiding = false;
}
public void onAnimationEnd(Animator animation) {
FloatingActionButtonHoneycombMr1.this.mIsHiding = false;
FloatingActionButtonHoneycombMr1.this.mView.setVisibility(8);
if (listener != null) {
listener.onHidden();
}
}
});
}
}
/* access modifiers changed from: 0000 */
public void show(@Nullable final InternalVisibilityChangedListener listener) {
if (this.mView.getVisibility() == 0) {
return;
}
if (!ViewCompat.isLaidOut(this.mView) || this.mView.isInEditMode()) {
this.mView.setVisibility(0);
this.mView.setAlpha(1.0f);
this.mView.setScaleY(1.0f);
this.mView.setScaleX(1.0f);
if (listener != null) {
listener.onShown();
return;
}
return;
}
this.mView.setAlpha(0.0f);
this.mView.setScaleY(0.0f);
this.mView.setScaleX(0.0f);
this.mView.animate().scaleX(1.0f).scaleY(1.0f).alpha(1.0f).setDuration(200).setInterpolator(AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR).setListener(new AnimatorListenerAdapter() {
public void onAnimationStart(Animator animation) {
FloatingActionButtonHoneycombMr1.this.mView.setVisibility(0);
}
public void onAnimationEnd(Animator animation) {
if (listener != null) {
listener.onShown();
}
}
});
}
private void updateFromViewRotation(float rotation) {
if (this.mShadowDrawable != null) {
this.mShadowDrawable.setRotation(-rotation);
}
if (this.mBorderDrawable != null) {
this.mBorderDrawable.setRotation(-rotation);
}
}
}
|
[
"[email protected]"
] | |
4965bc47f7255f50d2e07161bfe1465261141812
|
beccc0f3077b10d1b879002ec6757efbb5b05757
|
/AndroidIntents/ImagePickActivity/app/src/androidTest/java/com/tutorial/jj/imagepickactivity/ApplicationTest.java
|
34375ecdaef35058b0fe7c74c2ff093f3c9d0906
|
[] |
no_license
|
jcqln/IF3111-T1-Lifecycle
|
73780f9cbadab6c42150e84a0d85a34795ae8d20
|
d502069b031700f4e7db2a96903e69bb805d1d5c
|
refs/heads/master
| 2021-01-24T03:02:56.119001 | 2015-02-08T07:18:03 | 2015-02-08T07:18:03 | 30,436,334 | 0 | 0 | null | 2015-02-06T22:39:42 | 2015-02-06T22:39:42 | null |
UTF-8
|
Java
| false | false | 351 |
java
|
package com.tutorial.jj.imagepickactivity;
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);
}
}
|
[
"[email protected]"
] | |
fa8c48b30e4900d1f76d54188d0df21412556618
|
c91959143adecb99b1921510538ec5294fdb6e09
|
/ChatRoom/app/src/main/java/bupt/chatroom/BasePermissionActivity.java
|
010367eade00e8ac786cb9d2557a093ebc206a9b
|
[] |
no_license
|
windmillknight/jain-sip-rtp-
|
c84bf96d8ce4df3d1600f582f7dcbf7b8fb16fc8
|
f6fae47a0ea1c01110e2f300897e1da867907035
|
refs/heads/master
| 2021-01-01T15:57:26.642659 | 2017-07-19T17:39:14 | 2017-07-19T17:39:14 | 97,741,853 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,586 |
java
|
package bupt.chatroom;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
public class BasePermissionActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
/**
* a method of checking permission for subclass
*
* @param permissions
* @return
*/
public static final int WRITE_EXTERNAL_CODE = 0x06;
public boolean hasPermission(String... permissions) {
for (String permission : permissions) {
if (ContextCompat.checkSelfPermission(this, permission) !=
PackageManager.PERMISSION_GRANTED) {
return false;
}
}
return true;
}
/**
* a method of requesting permission for subclass
*
* @param requestCode
* @param permissions
*/
public void requestPermission(int requestCode, String... permissions) {
ActivityCompat.requestPermissions(this, permissions, requestCode);
}
@Override
public void onRequestPermissionsResult(
int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) {
case WRITE_EXTERNAL_CODE:
doSDCardPermission();
break;
}
}
public void doSDCardPermission() {
}
}
|
[
"[email protected]"
] | |
8c1d1d10e862c29f4d108672fa203340c87d1839
|
7260b3a7b9ca40437919faadcab6fbae38e74bbb
|
/src/main/java/com/controllers/HomeController.java
|
4e2c814c499a7f877d76ae2637a0d9d43977e775
|
[] |
no_license
|
demo1972/medcare_wildfly
|
832e2e075ee6c252e6615ed8707369108578ed05
|
154fbe4d231a42895a6fabfee242c1af12bbb1af
|
refs/heads/master
| 2020-05-27T19:15:24.794838 | 2019-05-27T02:34:06 | 2019-05-27T02:34:06 | 188,758,294 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 257 |
java
|
package com.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class HomeController {
@GetMapping({"/","/index"})
public String index()
{
return "index";
}
}
|
[
"[email protected]"
] | |
9c26e0cbaf7749b2b326a905ef0660481b058d0a
|
f97c2cf44cde07b07a82198d970c84d6269d8438
|
/app/src/main/java/com/example/lucia/auditoria_red/negocio/entidade/PortifolioEnum.java
|
2d71f5e692ec201b235b089a4b7a712ebcd13416
|
[] |
no_license
|
jlalvescarvalho/Auditoria_Red
|
0f79ea9d9ddb732930afbcbaa695509b21416fbc
|
a1f889e22b273e881d69eb9cba5018615da5b36c
|
refs/heads/master
| 2021-04-03T02:31:21.949167 | 2018-04-04T01:19:43 | 2018-04-04T01:19:43 | 124,604,180 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 648 |
java
|
package com.example.lucia.auditoria_red.negocio.entidade;
public enum PortifolioEnum {
aguaInd(0.5), aguaFam(1.0), cervejaLata(1.5), cerveja600(2.0), CC_mineLata_miniPet(0.5), CCZ_mineLata_miniPet(0.8), Sabores_mineLata_MinePet(1.0),
Fanta_2L(2.0), Fanta_Guar2L(2.0), CC_2L(0.5), Kuat_e_Sprite2L(1.0), Sabores_retornaveis(2.0), ImperdoaveisStill(3.4), ImperdoaveisSSD(11.5), DVF_ind(1.1),
DVF_Fam(0.5), CC_Lata(2.2), CC_refpet(0.5), CC_Ls(0.5), Kapo(0.5);
private final double pontos;
private PortifolioEnum(double pontos){
this.pontos = pontos;
}
public double getPontos(){
return pontos;
}
}
|
[
"[email protected]"
] | |
f1f582083fbe6e5b7fe5de20575ea4e498964382
|
94cf2c1fba94269d7f1d6cbdf38f3eb22c149daf
|
/src/main/java/bank/generated/bank/_AccountFactoryPrxI.java
|
120cc658e7fad48d090f23946c548f21ac47b56d
|
[] |
no_license
|
michaelloo35/middleware-bank-server
|
9055e6cee82081d64a549ffa214cd812d4e34760
|
d6917980b415a7d72c4aace924b9e4361d94b527
|
refs/heads/master
| 2020-03-15T14:25:32.444294 | 2018-05-10T13:02:42 | 2018-05-10T13:02:42 | 132,189,755 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 672 |
java
|
// **********************************************************************
//
// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
//
// Ice version 3.7.1
//
// <auto-generated>
//
// Generated from file `bank.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package bank.generated.bank;
public class _AccountFactoryPrxI extends com.zeroc.Ice._ObjectPrxI implements AccountFactoryPrx
{
public static final long serialVersionUID = 0L;
}
|
[
"[email protected]"
] | |
9ff47347eede38e0ae13bc412c4af67f47c71665
|
5fc5c466ad37610f5736f0adcba69dcadc1c56b6
|
/src/main/java/com/algaworks/alganews/users/api/validation/ValidPricePerWordPerByRoleValidator.java
|
369682b5debe7e40bf8ccc2542a08a2a70383084
|
[] |
no_license
|
gabriel-srodrigues/alganews-api
|
ec8dd704c72cadb9293e52ee6f71fd9151f08587
|
10a226310f915af3ae34b4dfec0b8d7730d3e2e3
|
refs/heads/main
| 2023-08-24T05:27:55.514652 | 2021-10-01T19:48:23 | 2021-10-01T19:48:23 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,511 |
java
|
package com.algaworks.alganews.users.api.validation;
import com.algaworks.alganews.users.api.model.UserInput;
import com.algaworks.alganews.users.domain.model.Role;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
public class ValidPricePerWordPerByRoleValidator
implements ConstraintValidator<ValidPricePerWordPerByRole, UserInput> {
private static final int LESSER_THAN_CONSTANT = -1;
private Role requiredRole;
@Override
public final void initialize(final ValidPricePerWordPerByRole annotation) {
this.requiredRole = annotation.role();
}
public final boolean isValid(final UserInput user,
final ConstraintValidatorContext context) {
context.disableDefaultConstraintViolation();
context.buildConstraintViolationWithTemplate(context.getDefaultConstraintMessageTemplate())
.addPropertyNode("pricePerWord")
.addConstraintViolation();
return user.getPricePerWord() != null && isEditor(user) || isNotEditor(user);
}
private boolean isNotEditor(UserInput user) {
return !isEditor(user);
}
private boolean isEditor(UserInput user) {
return requiredRole.equals(user.getRole());
}
private <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
Set<Object> seen = ConcurrentHashMap.newKeySet();
return t -> seen.add(keyExtractor.apply(t));
}
}
|
[
"[email protected]"
] | |
247af93722cb815c9cdb7bf313f7b70ac39d8224
|
f9b56208a592ea932dac0d82c0b74366e17007d9
|
/src/main/java/infoshare/restapi/people/PersonDemographicsAPI.java
|
6f52a33c31c3c85be931de4fa09945bbd69a757a
|
[] |
no_license
|
Thulebona/infoshare
|
094fccd28a0da37462ad72474c4bc2a50512347f
|
af06327cd7149980421ba845d5ab5bf9763f6212
|
refs/heads/master
| 2020-04-05T11:23:32.351462 | 2016-10-19T08:30:16 | 2016-10-19T08:30:16 | 38,112,831 | 0 | 16 | null | 2015-10-16T09:25:13 | 2015-06-26T13:32:53 |
Java
|
UTF-8
|
Java
| false | false | 829 |
java
|
package infoshare.restapi.people;
import infoshare.app.conf.RestUtil;
import infoshare.domain.person.PersonDemographics;
import java.util.Set;
/**
* Created by user9 on 2016/03/02.
*/
public class PersonDemographicsAPI {
public static PersonDemographics save(PersonDemographics person) {
return RestUtil.save(PersonBaseURI.PersonDemographics.POST, person, PersonDemographics.class);
}
public static PersonDemographics findById(String personId, String id) {
String param =personId + "/" + id;
return RestUtil.getById(PersonBaseURI.PersonDemographics.GET_ID, param, PersonDemographics.class);
}
public static Set<PersonDemographics> findALL(String personId ) {
return RestUtil.getAll(PersonBaseURI.PersonDemographics.GET_ALL +personId , PersonDemographics.class);
}
}
|
[
"[email protected]"
] | |
61821efc5c218d48b690c3baaae6e3dc129a6c2c
|
e7dc41399c522bebefad93f10bd915619fc26648
|
/common/src/main/java/com/wo56/business/ord/vo/out/OrdGoodsInfoOutParam.java
|
26d95ae69e0f609e59863b51d7baee6811593a2d
|
[] |
no_license
|
mlj0381/test3
|
d022f5952ab086bc7be3dbc81569b7f1b3631e99
|
669b461e06550e60313bc634c7a384b9769f154a
|
refs/heads/master
| 2020-03-17T01:44:41.166126 | 2017-08-03T02:57:52 | 2017-08-03T02:57:52 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,382 |
java
|
package com.wo56.business.ord.vo.out;
import com.framework.core.inter.vo.OutParamVO;
public class OrdGoodsInfoOutParam extends OutParamVO {
private String consignorName;
private String consignorBill;
private String address;
private String product;
private Integer count;
private String color;
private String standard;
private String code;
public String getConsignorName() {
return consignorName;
}
public void setConsignorName(String consignorName) {
this.consignorName = consignorName;
}
public String getConsignorBill() {
return consignorBill;
}
public void setConsignorBill(String consignorBill) {
this.consignorBill = consignorBill;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getStandard() {
return standard;
}
public void setStandard(String standard) {
this.standard = standard;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
|
[
"yunqi@DESKTOP-FS7ABO9"
] |
yunqi@DESKTOP-FS7ABO9
|
cf23a9000b861d03364c271f4fde588bedb35a22
|
2cce5ab43588b9b98efc8a195bf017a9d8f7d835
|
/easysidebar/src/main/java/com/esaysidebar/activity/MyGridView.java
|
f7793f6c01e28bc8a8be5c4ddda79fd122e2616a
|
[
"Apache-2.0"
] |
permissive
|
Bigkoo/EasySideBar
|
7b4416fa5afecfacd5631d657e2076249290b799
|
afe9c698aef2f07df552d19e9ba605e84f16bd5f
|
refs/heads/master
| 2021-01-19T02:12:30.711169 | 2019-08-05T10:30:28 | 2019-08-05T10:30:28 | 84,401,744 | 190 | 46 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,032 |
java
|
package com.esaysidebar.activity;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.GridView;
/**
* 自定义GridView,解决ScrollView嵌套Grideview只显示一行半
*/
public class MyGridView extends GridView {
public MyGridView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public MyGridView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyGridView(Context context) {
super(context);
}
/**
* 其中onMeasure函数决定了组件显示的高度与宽度;
* makeMeasureSpec函数中第一个函数决定布局空间的大小,第二个参数是布局模式
* MeasureSpec.AT_MOST的意思就是子控件需要多大的控件就扩展到多大的空间
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
}
|
[
"[email protected]"
] | |
e5d513bf3c68dfec328b54da3464424252e2668f
|
28855e095371d42bba22906007139ba19324876f
|
/src/com/anaximandre/zampache/views/SongsView.java
|
96683a0a2d681a766aa776fb0b407c1775b3fd22
|
[] |
no_license
|
An4ximandre/Zampache
|
fbe6c5838c1c44d25bc8d202af46b76214d70462
|
3e6d8c24f134ffd0b118f17f60ec7d8e0013ccbc
|
refs/heads/master
| 2016-09-06T13:56:16.083934 | 2015-06-25T07:43:22 | 2015-06-25T07:43:22 | 37,973,904 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,828 |
java
|
/**
* The MIT License (MIT)
*
* Copyright (c) 2014 Daniel Schruhl
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package com.anaximandre.zampache.views;
import java.util.ArrayList;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ContextMenu.ContextMenuInfo;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import android.widget.AdapterView.AdapterContextMenuInfo;
import com.anaximandre.ampache.Song;
import com.anaximandre.zampache.Controller;
import com.anaximandre.zampache.MainActivity;
import com.anaximandre.zampache.SongArrayAdapter;
import com.anaximandre.zampache.R;
/**
* @author Daniel Schruhl
*
*/
public class SongsView extends Fragment {
// private String urlString;
private Controller controller;
/**
*
*/
public SongsView() {
// TODO Auto-generated constructor stub
}
public static Fragment newInstance(Context context) {
SongsView p = new SongsView();
return p;
}
@SuppressLint("InflateParams")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
controller = Controller.getInstance();
ViewGroup root = (ViewGroup) inflater.inflate(R.layout.ampache_songs, null);
ListView listview = (ListView) root.findViewById(R.id.songs_listview);
registerForContextMenu(listview);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
listview.setFastScrollAlwaysVisible(true);
}
if (controller.getServer() != null) {
ArrayList<String> list = new ArrayList<String>();
for (Song s : controller.getSongs()) {
list.add(s.toString());
}
SongArrayAdapter adapter = new SongArrayAdapter(getActivity().getApplicationContext(), list,
controller.getSongs());
listview.setAdapter(adapter);
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
Log.d("Play now added:", controller.getSongs().get(position).toString());
controller.getPlayNow().add(controller.getSongs().get(position));
Context context = view.getContext();
CharSequence text = getResources().getString(R.string.songsViewSongAdded);
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
});
}
return root;
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getActivity().getMenuInflater();
inflater.inflate(R.menu.context_menu_songs, menu);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
switch (item.getItemId()) {
case R.id.contextMenuAdd:
controller.getPlayNow().add(controller.getSongs().get((int) info.id));
Context context = getView().getContext();
CharSequence text = getResources().getString(R.string.songsViewSongAdded);
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
return true;
case R.id.contextMenuSongsOpen:
controller.getPlayNow().clear();
controller.getPlayNow().add(controller.getSongs().get((int) info.id));
((MainActivity) getActivity()).play(0);
return true;
default:
return super.onContextItemSelected(item);
}
}
}
|
[
"[email protected]"
] | |
9e12d464b7f9c9fa2d5936162121a62a8badb506
|
d750133b805155de72736f053ebfb861946598e9
|
/src/main/java/Application/Service/IFaireService.java
|
428bddf40c472da0cc138ea35a8ea8431f653bae
|
[] |
no_license
|
cdelourme/Project
|
c5677a30502f441ece171072491beaeb76a77784
|
73d146d30744c50dfcbb0843cf20e815d7e84a44
|
refs/heads/master
| 2021-05-15T22:57:11.395896 | 2017-10-10T07:01:08 | 2017-10-10T07:01:08 | 106,379,544 | 0 | 0 | null | 2017-10-10T06:53:45 | 2017-10-10T06:53:44 | null |
UTF-8
|
Java
| false | false | 202 |
java
|
package Application.Service;
import Application.Model.Faire;
import org.springframework.transaction.annotation.Transactional;
@Transactional
public interface IFaireService extends IService<Faire> {
}
|
[
"[email protected]"
] | |
f9e0f061d31127cd8d791be7177e191e6defe5fc
|
4293f4ca7c0c9c7dc168f1b25d02b6d0bce4ada7
|
/app/src/main/java/cn/edu/nju/cs/screencamera/RDCodeMLFile.java
|
af8010cb2e96f90bfde295b4d75ed7c72ffbfa0b
|
[] |
no_license
|
kennycaiguo/screen-camera-android
|
c7f2310702aa178bcaf9ea396633a29067f1e08e
|
79de6e5426e78c104e7daf6ca21b4ff8d4269a02
|
refs/heads/master
| 2021-01-08T11:04:27.563257 | 2018-10-02T11:55:08 | 2018-10-02T11:55:08 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 12,430 |
java
|
package cn.edu.nju.cs.screencamera;
import android.os.Environment;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import cn.edu.nju.cs.screencamera.ReedSolomon.ReedSolomonException;
/**
* Created by zhantong on 2017/6/4.
*/
public class RDCodeMLFile extends StreamDecode {
private static final String TAG = "ShiftCodeMLFile";
RDCodeMLConfig config = new RDCodeMLConfig();
int countAllRegions = 0;
int numFileBytes = -1;
int numAllRegions = -1;
int countFrames = 0;
int numDataRegions;
int indexCenterBlock;
int numRegionDataBytes;
int realCurrentRegionOffset;
int numRegions;
int numBytesPerRegion;
int numBytesPerRegionLine;
int numRSBytes;
Map<Integer, int[][][]> windows = new HashMap<>();
public RDCodeMLFile() {
}
@Override
public void beforeStream() {
numRSBytes = 6;
int numColors = 4;
int numRegionBytes = (config.regionWidth * config.regionHeight) / (8 / (int) Math.sqrt(numColors));
numRegionDataBytes = numRegionBytes - numRSBytes;
int numInterFrameParity = 1;
int numFramesPerWindow = 8;
int indexLastFrame = numFramesPerWindow - numInterFrameParity;
numBytesPerRegionLine = config.mainBlock.get(District.MAIN).getBitsPerUnit() * config.regionWidth / 8;
numBytesPerRegion = numBytesPerRegionLine * config.regionHeight;
numRegions = config.numRegionVertical * config.numRegionHorizon;
int numParityRegions = 3;
numDataRegions = numRegions - numParityRegions;
int numBytesPerFrame = numRegions * numBytesPerRegion;
indexCenterBlock = numRegions / 2;
}
@Override
public void processFrame(JsonElement frameData) {
Gson gson = new Gson();
int[] rsEncodedContent = gson.fromJson(((JsonObject) frameData).get("value"), int[].class);
int index = ((JsonObject) frameData).get("index").getAsInt();
countFrames++;
rsEncodedContent = Utils.changeNumBitsPerInt(rsEncodedContent, config.mainBlock.get(District.MAIN).getBitsPerUnit(), 8);
int[][] frame = new int[numRegions][];
for (int indexRegionOffset = 0, posOffset = 0; indexRegionOffset < numRegions; indexRegionOffset += config.numRegionHorizon, posOffset += numBytesPerRegion * config.numRegionHorizon) {
for (int indexRegionInLine = 0; indexRegionInLine < config.numRegionHorizon; indexRegionInLine++) {
int indexRegion = indexRegionOffset + indexRegionInLine;
int pos = posOffset + indexRegionInLine * numBytesPerRegionLine;
int[] regionData = new int[numBytesPerRegion];
int regionDataPos = 0;
for (int line = 0; line < numBytesPerRegion; line += numBytesPerRegionLine, pos += numBytesPerRegionLine * config.numRegionHorizon) {
System.arraycopy(rsEncodedContent, pos, regionData, regionDataPos, numBytesPerRegionLine);
regionDataPos += numBytesPerRegionLine;
}
try {
if (indexRegion == indexCenterBlock) {
Utils.rSDecode(regionData, 12, 8);
} else {
Utils.rSDecode(regionData, numRSBytes, 8);
}
frame[indexRegion] = new int[numRegionDataBytes];
System.arraycopy(regionData, 0, frame[indexRegion], 0, numRegionDataBytes);
} catch (ReedSolomonException e) {
System.out.println("RS decode failed " + indexRegion);
}
}
}
List<Integer>[] interRegionParity = new List[3];
interRegionParity[0] = new ArrayList<>();
for (int i = 0; i < numRegions - 2; i++) {
if (i != indexCenterBlock && ((numRegions - i - 3) % 4 < 2)) {
interRegionParity[0].add(i);
}
}
interRegionParity[1] = new ArrayList<>();
for (int i = 0; i < numRegions; i++) {
if (i != indexCenterBlock && (i % 2 == numRegions % 2)) {
interRegionParity[1].add(i);
}
}
interRegionParity[2] = new ArrayList<>();
for (int i = 0; i < numRegions; i++) {
if (i != indexCenterBlock) {
interRegionParity[2].add(i);
}
}
if (frame[indexCenterBlock] == null) {
System.out.println("null center region");
} else {
int currentWindow = frame[indexCenterBlock][0];
int currentFrame = frame[indexCenterBlock][1];
if (numFileBytes == -1) {
numFileBytes = (frame[indexCenterBlock][2] << 24) | (frame[indexCenterBlock][3] << 16) | (frame[indexCenterBlock][4] << 8) | frame[indexCenterBlock][5];
numAllRegions = (int) Math.ceil(numFileBytes / (double) numRegionDataBytes);
System.out.println("numFileBytes: " + numFileBytes + " numAllRegions: " + numAllRegions + " numRegionDataBytes: " + numRegionDataBytes);
}
realCurrentRegionOffset = (currentWindow * 7 + currentFrame) * (numDataRegions - 1);
System.out.println("realCurrentRegionOffset: " + realCurrentRegionOffset);
System.out.println("window " + currentWindow + " frame " + currentFrame + " data:" + Arrays.toString(frame));
if (!windows.containsKey(currentWindow)) {
windows.put(currentWindow, new int[8][numRegions][]);
}
int[][][] window = windows.get(currentWindow);
for (int i = 0; i < frame.length; i++) {
if (frame[i] != null) {
if (window[currentFrame][i] == null) {
window[currentFrame][i] = frame[i];
if (i < numDataRegions && i != indexCenterBlock && currentFrame < 7 && realCurrentRegionOffset + (i < indexCenterBlock ? i : i - 1) < numAllRegions) {
countAllRegions++;
}
if (numAllRegions == -1 || countAllRegions == numAllRegions) {
System.out.println("done in " + countFrames + " frames");
return;
}
}
}
}
if (currentFrame != 7) {
interRegionEC(interRegionParity, window, currentFrame, numRegionDataBytes);
} else {
interFrameEC(window, currentFrame, numRegionDataBytes, interRegionParity);
}
}
System.out.println("progress: " + (double) countAllRegions / numAllRegions);
}
@Override
public void afterStream() {
if (numAllRegions == countAllRegions) {
byte[] out = new byte[numFileBytes];
int outPos = 0;
int numRegionsPerWindow = 7 * numDataRegions;
int i = 0;
while (true) {
int window = i / numRegionsPerWindow;
int frame = i % numRegionsPerWindow / numDataRegions;
int region = i % numRegionsPerWindow % numDataRegions;
if (region != indexCenterBlock) {
int[] regionData = windows.get(window)[frame][region];
System.out.println("window: " + window + " frame: " + frame + " region: " + region + " bytes: " + (regionData == null ? "null" : regionData.length));
for (int pos = 0; pos < regionData.length && outPos < out.length; pos++, outPos++) {
out[outPos] = (byte) regionData[pos];
}
if (outPos == out.length) {
break;
}
}
i++;
}
String sha1 = FileVerification.bytesToSHA1(out);
Log.d(TAG, "file SHA-1 verification: " + sha1);
String randomFileName = UUID.randomUUID().toString();
String outputFilePath = Utils.combinePaths(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath(), randomFileName);
if (Utils.bytesToFile(out, outputFilePath)) {
Log.i(TAG, "successfully write to " + outputFilePath);
} else {
Log.i(TAG, "failed to write to " + outputFilePath);
}
} else {
Log.i(TAG, "file not complete");
}
}
void interRegionEC(List<Integer>[] interRegionParity, int[][][] window, int currentFrame, int numRegionDataBytes) {
for (int i = 0; i < interRegionParity.length; i++) {
for (int j = 0; j < interRegionParity.length; j++) {
int countErrorRegion = 0;
int indexErrorRegion = -1;
for (int k : interRegionParity[j]) {
if (window[currentFrame][k] == null) {
countErrorRegion++;
indexErrorRegion = k;
}
}
if (countErrorRegion == 1) {
int[] region = new int[numRegionDataBytes];
for (int k : interRegionParity[j]) {
if (k != indexErrorRegion) {
for (int pos = 0; pos < region.length; pos++) {
region[pos] ^= window[currentFrame][k][pos];
}
}
}
if (window[currentFrame][indexErrorRegion] == null) {
window[currentFrame][indexErrorRegion] = region;
System.out.println("inter region recover success index " + indexErrorRegion + " data:" + Arrays.toString(region));
if (indexErrorRegion < numDataRegions && indexErrorRegion != indexCenterBlock && currentFrame < 7 && realCurrentRegionOffset + i < numAllRegions) {
countAllRegions++;
}
if (numAllRegions == -1 || countAllRegions == numAllRegions) {
System.out.println("done in " + countFrames + " frames");
return;
}
}
}
}
}
}
void interFrameEC(int[][][] window, int currentFrame, int numRegionDataBytes, List<Integer>[] interRegionParity) {
for (int i = 0; i < window[currentFrame].length; i++) {
if (window[currentFrame][i] != null) {
int countErrorRegion = 0;
int indexErrorFrame = -1;
for (int j = 0; j < currentFrame; j++) {
if (window[j][i] == null) {
countErrorRegion++;
indexErrorFrame = j;
}
}
if (countErrorRegion == 1) {
int[] region = new int[numRegionDataBytes];
for (int j = 0; j <= currentFrame; j++) {
if (j != indexErrorFrame) {
for (int pos = 0; pos < region.length; pos++) {
region[pos] ^= window[j][i][pos];
}
}
}
if (window[indexErrorFrame][i] == null) {
window[indexErrorFrame][i] = region;
System.out.println("inter frame recover success frame " + indexErrorFrame + " region " + i + " data:" + Arrays.toString(region));
if (i < numDataRegions && i != indexCenterBlock && indexErrorFrame < 7 && realCurrentRegionOffset + i < numAllRegions) {
countAllRegions++;
}
if (countAllRegions == numAllRegions) {
System.out.println("done in " + countFrames + " frames");
return;
}
interRegionEC(interRegionParity, window, indexErrorFrame, numRegionDataBytes);
}
}
}
}
}
}
|
[
"[email protected]"
] | |
6877f5c218b313e5bc8efb0d594ebe8d95b20fb0
|
7861a0d7ccfb5d11171e43ce16e1fac39180fe94
|
/app/src/main/java/com/example/ipapp/ResultsActivity.java
|
12f64157b74667c0d19dddb83bc8acb68aaec392
|
[] |
no_license
|
JPSanin/ipapp
|
86acb95b965407395531738aad814b9731a0906a
|
7c67dca0a96fdfdaff97da35a7a9bcd823ca0b78
|
refs/heads/master
| 2023-07-28T01:11:25.292029 | 2021-09-11T17:10:01 | 2021-09-11T17:10:01 | 405,437,195 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 764 |
java
|
package com.example.ipapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
public class ResultsActivity extends AppCompatActivity {
private TextView pingsTxt;
private Button btnBack;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_results);
pingsTxt= findViewById(R.id.pingsTxt);
btnBack= findViewById(R.id.btnBack);
String result= getIntent().getExtras().getString("result");
pingsTxt.setText(result);
btnBack.setOnClickListener((view)->{
finish();
});
}
}
|
[
"[email protected]"
] | |
8aa6a58f020e3278ebc98d3c936546766078e9d5
|
455583e9d60dc719dfac819d73cee91051ad9e8f
|
/back/src/main/java/ru/itis/smarteducation/uni_timetable/entity/Auditory.java
|
bf8f0089eb3a5cea11df1b6213a151f26e5bef4b
|
[] |
no_license
|
meremaapc/uni_timetable
|
db680d46c31fc2033bcc879d2cb26401951ee1b6
|
08f83c36312db69f9624ff44b7c58469ee4ed1f7
|
refs/heads/develop
| 2020-09-22T05:09:00.488246 | 2019-12-26T20:27:10 | 2019-12-26T20:27:10 | 225,059,786 | 0 | 1 | null | 2019-12-26T20:27:11 | 2019-11-30T19:24:37 |
Java
|
UTF-8
|
Java
| false | false | 348 |
java
|
package ru.itis.smarteducation.uni_timetable.entity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Data
@Entity
@Table(name="auditory")
public class Auditory extends BasicEntity<Long>{
@Column(name="number", columnDefinition = "bpchar")
private String number;
}
|
[
"[email protected]"
] | |
7a35c9c6524fbcbaa35e0b02f013bf2b5ee9deab
|
75fa11b13ddab8fd987428376f5d9c42dff0ba44
|
/metadata-service/factories/src/main/java/com/linkedin/gms/factory/common/CacheConfig.java
|
820b272bedb677549ac0581e260236426b497999
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause",
"MIT"
] |
permissive
|
RyanHolstien/datahub
|
163d0ff6b4636919ed223ee63a27cba6db2d0156
|
8cf299aeb43fa95afb22fefbc7728117c727f0b3
|
refs/heads/master
| 2023-09-04T10:59:12.931758 | 2023-08-21T18:33:10 | 2023-08-21T18:33:10 | 246,685,891 | 0 | 0 |
Apache-2.0
| 2021-02-16T23:48:05 | 2020-03-11T21:43:58 |
TypeScript
|
UTF-8
|
Java
| false | false | 2,831 |
java
|
package com.linkedin.gms.factory.common;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.hazelcast.config.Config;
import com.hazelcast.config.EvictionConfig;
import com.hazelcast.config.EvictionPolicy;
import com.hazelcast.config.MapConfig;
import com.hazelcast.config.MaxSizePolicy;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.spring.cache.HazelcastCacheManager;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cache.CacheManager;
import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class CacheConfig {
@Value("${cache.primary.ttlSeconds:600}")
private int cacheTtlSeconds;
@Value("${cache.primary.maxSize:10000}")
private int cacheMaxSize;
@Value("${searchService.cache.hazelcast.serviceName:hazelcast-service}")
private String hazelcastServiceName;
@Bean
@ConditionalOnProperty(name = "searchService.cacheImplementation", havingValue = "caffeine")
public CacheManager caffeineCacheManager() {
CaffeineCacheManager cacheManager = new CaffeineCacheManager();
cacheManager.setCaffeine(caffeineCacheBuilder());
return cacheManager;
}
private Caffeine<Object, Object> caffeineCacheBuilder() {
return Caffeine.newBuilder()
.initialCapacity(100)
.maximumSize(cacheMaxSize)
.expireAfterAccess(cacheTtlSeconds, TimeUnit.SECONDS)
.recordStats();
}
@Bean
@ConditionalOnProperty(name = "searchService.cacheImplementation", havingValue = "hazelcast")
public CacheManager hazelcastCacheManager() {
Config config = new Config();
// TODO: This setting is equivalent to expireAfterAccess, refreshes timer after a get, put, containsKey etc.
// is this behavior what we actually desire? Should we change it now?
MapConfig mapConfig = new MapConfig().setMaxIdleSeconds(cacheTtlSeconds);
EvictionConfig evictionConfig = new EvictionConfig()
.setMaxSizePolicy(MaxSizePolicy.PER_NODE)
.setSize(cacheMaxSize)
.setEvictionPolicy(EvictionPolicy.LFU);
mapConfig.setEvictionConfig(evictionConfig);
mapConfig.setName("default");
config.addMapConfig(mapConfig);
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getKubernetesConfig().setEnabled(true)
.setProperty("service-dns", hazelcastServiceName);
HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(config);
return new HazelcastCacheManager(hazelcastInstance);
}
}
|
[
"[email protected]"
] | |
37e554096f9861713de36693b02ee2a837bb9d59
|
ab9619eb9c38f034a4cffeb11abaa71685da1150
|
/midc_dc-web/src/main/java/org/cw/midc/exception/BusinessException.java
|
44bee037a7760017ef2c3c83b7f211d0f51f1bfc
|
[] |
no_license
|
lnshjyh/midc_dc
|
89dcc978196e5d474ebc9ac26ec8e857566b6c89
|
4be922c96fb1996b70d114236009a48f39a83b83
|
refs/heads/master
| 2021-07-18T15:22:58.394715 | 2017-03-18T04:31:26 | 2017-03-18T04:31:26 | 82,555,654 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 516 |
java
|
package org.cw.midc.exception;
public class BusinessException {
private String type;
private int code;
private String msg;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
|
[
"[email protected]"
] | |
473a3c1388fcc516d0052a5c08eff1940fc9f116
|
495fa7e4a8266e730679fea141331ff70cb18c23
|
/talkback_google/src/main/java/com/android/talkback/formatter/DropEventFormatter.java
|
91b97552b0ad0e34042ef749503ef3265c2e3e75
|
[] |
no_license
|
devinlpasqudolli/GoogleTalkBackTest
|
f3443dace452b6f22f869c5ab3cc7161017a72c9
|
29e5a6cdb13b7e074e2b26753f46c586a74c70c5
|
refs/heads/master
| 2023-03-17T00:41:22.160425 | 2019-04-02T02:19:24 | 2019-04-02T02:19:24 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,369 |
java
|
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.talkback.formatter;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
import com.google.android.marvin.talkback.TalkBackServiceTest;
import com.android.talkback.Utterance;
import com.android.utils.LogUtils;
/**
* Formatter that will drop an even from the event processor.
*/
public final class DropEventFormatter implements EventSpeechRule.AccessibilityEventFormatter {
@Override
public boolean format(AccessibilityEvent event, TalkBackServiceTest context, Utterance utterance) {
// Returning false from an AccessibilityEventFormatter drops the event
// from the rule processor.
LogUtils.log(this, Log.VERBOSE, "Dropping event.");
return false;
}
}
|
[
"[email protected]"
] | |
56bb5b1b410d91d847913f6268d87918fbb47f3f
|
79f4157675a50510a1f7ce0a9fb3776250d71827
|
/Items/ItemList/InitiateRobe.java
|
b7354562fd1b8f3f31cc334d7a6b2fd4ca5aa45c
|
[] |
no_license
|
DungeonCrawler/DungeonCrawler
|
82d79562f48599be8f879f7df0b387fa8c4ff486
|
461c335ddc5cd6df79cbd605ebed4f3ab0a2c49c
|
refs/heads/master
| 2020-12-02T17:29:11.443457 | 2014-06-23T21:58:39 | 2014-06-23T21:58:39 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 587 |
java
|
package ItemList;
public class InitiateRobe extends Armor
{
public String getName()
{
return "Initiate Robe";
}
public int defense()
{
return 0;
}
public int fireResist()
{
return 2;
}
public int coldResist()
{
return 2;
}
public int necroResist()
{
return 2;
}
public int holyResist()
{
return 2;
}
public int reqStr()
{
return 0;
}
public int reqAgi()
{
return 0;
}
public int reqInt()
{
return 0;
}
}
|
[
"[email protected]"
] | |
e1365e1d6ede4baa4ba30810752e3cc69a5daec7
|
106a5addc6a3e8f8f84940e194fcf216027c577b
|
/src/main/java/com/ncrm/SprBatch/impchqBpmRowMapper.java
|
84e251246bc26c24e0624fa885ca1983257bc533
|
[] |
no_license
|
Kmeneouali/Ncrm_Extraction
|
461351f58b94e8e30a77c26bf8346072f861f87b
|
433d568f13d4a5b1094f8032d208c2d711b73a8f
|
refs/heads/master
| 2020-08-26T21:21:56.241086 | 2019-10-23T21:00:08 | 2019-10-23T21:00:08 | 217,145,816 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,575 |
java
|
package com.ncrm.SprBatch;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;
public class impchqBpmRowMapper implements RowMapper<impayeChq> {
public impchqBpmRowMapper() {
super();
// TODO Auto-generated constructor stub
}
public impayeChq mapRow(ResultSet rs, int rowNum)
throws SQLException {
impayeChq impChqBpm=new impayeChq();
impChqBpm.setREF(rs.getString("REF"));
impChqBpm.setPK_OBJ_IDT(rs.getString("PK_OBJ_IDT"));
impChqBpm.setRIO(rs.getString("RIO"));
impChqBpm.setRIOINI(rs.getString("RIOINI"));
impChqBpm.setREJET(rs.getString("REJET"));
impChqBpm.setADR_RMT(rs.getString("ADR_RMT"));
impChqBpm.setADR_RMT(rs.getString("ADR_TIR"));
impChqBpm.setCDEBPR(rs.getString("CDEBPR"));
impChqBpm.setCDEBPR_RMT(rs.getString("CDEBPR_RMT"));
impChqBpm.setAGE(rs.getString("AGE"));
impChqBpm.setAGE_RMT(rs.getString("AGE_RMT"));
impChqBpm.setAGE_RMT_LIB(rs.getString("AGE_RMT_LIB"));
impChqBpm.setCPT(rs.getString("CPT"));
impChqBpm.setCPTT(rs.getString("CPTT"));
impChqBpm.setDTEMI(rs.getString("DTEMI"));
impChqBpm.setDTEREG(rs.getString("DTEREG"));
impChqBpm.setLOC(rs.getString("LOC"));
impChqBpm.setLOCT(rs.getString("LOCT"));
impChqBpm.setMEM2(rs.getString("MEM2"));
impChqBpm.setMNT(rs.getString("MNT"));
impChqBpm.setMODE_ESC(rs.getString("MODE_ESC"));
impChqBpm.setNSER(rs.getString("NSER"));
impChqBpm.setSQCA(rs.getString("SQCA"));
impChqBpm.setRIB(rs.getString("RIB"));
impChqBpm.setRIBR(rs.getString("RIBR"));
impChqBpm.setRSOC_RMT(rs.getString("RSOC_RMT"));
impChqBpm.setRSOC_TIRE(rs.getString("RSOC_TIRE"));
impChqBpm.setRSOC_BEN(rs.getString("RSOC_BEN"));
impChqBpm.setZBK(rs.getString("ZBK"));
impChqBpm.setZBK_lib(rs.getString("ZBK_lib"));
impChqBpm.setNOMTIRE(rs.getString("NOMTIRE"));
impChqBpm.setCIN(rs.getString("CIN"));
impChqBpm.setRC(rs.getString("RC"));
impChqBpm.setLieuEmission(rs.getString("lieuEmission"));
impChqBpm.setMOTIF1(rs.getString("MOTIF1"));
impChqBpm.setMOTIF2(rs.getString("MOTIF2"));
impChqBpm.setMOTIF3(rs.getString("MOTIF3"));
impChqBpm.setAdresseTire(rs.getString("adresseTire"));
impChqBpm.setREJET_LIB(rs.getString("REJET_LIB"));
impChqBpm.setDTREJET(rs.getString("DTREJET"));
impChqBpm.setDTEINS(rs.getString("DTEINS"));
impChqBpm.setDTEPRE(rs.getString("DTEPRE"));
impChqBpm.setDTEemission(rs.getString("DTEemission"));
impChqBpm.setDTETRT(rs.getString("DTETRT"));
return impChqBpm;
}
}
|
[
"[email protected]"
] | |
87e803345b3d3f3f6758171920c6b573e42520ab
|
0842a2996c07796f9afb8bb2ff2ccd87d977dbd3
|
/src/main/java/com/tripaneer/catalog/constants/CatalogConstants.java
|
1d87af536c20d7f5bfc7b3a31e3081fa77825112
|
[] |
no_license
|
Tuxansari/catalog-service
|
1416f49d3dff534ded9b462814e64d4f12d4c174
|
d23d63c946099b276ca1421826f5ab55762491d5
|
refs/heads/master
| 2023-04-06T15:02:40.950446 | 2021-04-16T06:59:13 | 2021-04-16T06:59:13 | 356,823,513 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 76 |
java
|
package com.tripaneer.catalog.constants;
public class CatalogConstants {
}
|
[
"[email protected]"
] | |
a3bc0fe5e607a1b98293c91e417bcf506bce402f
|
13fa069089f1db2f139afdf31be6068385f588c4
|
/Java/baekjoon/Problem_7662.java
|
7143af328097c49c0adb1cd1b38746ece692ee7b
|
[] |
no_license
|
IMRaccoon/Algorithm
|
64b460efb40a735b3d71ccc358192a4a18fce40e
|
1fa2a80e63623b568e47bc379eaf41f912bbcac7
|
refs/heads/master
| 2021-11-23T09:28:08.761742 | 2021-10-23T15:07:11 | 2021-10-23T15:07:11 | 208,833,237 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,338 |
java
|
import java.io.*;
import java.util.*;
public class Problem_7662 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringTokenizer st;
char cmd;
int t = Integer.parseInt(br.readLine()), n, input;
TreeMap<Integer, Integer> tre;
for (int i = 0; i < t; i++) {
tre = new TreeMap<>();
n = Integer.parseInt(br.readLine());
for (int j = 0; j < n; j++) {
st = new StringTokenizer(br.readLine());
cmd = st.nextToken().charAt(0);
input = Integer.parseInt(st.nextToken());
if (cmd == 'I') {
tre.put(input, tre.getOrDefault(input, 0) + 1);
} else {
if (tre.size() == 0) continue;
int tmp = input == -1 ? tre.firstKey() : tre.lastKey();
if (tre.put(tmp, tre.get(tmp) - 1) == 1) {
tre.remove(tmp);
}
}
}
bw.write(tre.size() == 0 ? "EMPTY" : tre.lastKey() + " " + tre.firstKey());
bw.newLine();
}
bw.flush();
}
}
|
[
"[email protected]"
] | |
846fd6305470ef7d73b49de7051f432109476540
|
26bee76ec7f4cece2a613aaadfb0fd0f32742b8a
|
/src/ch24/books_examples/DisplayQueryResultsController.java
|
6c35b5cd4588c39d311f78358358050c8ef9618e
|
[] |
no_license
|
oeliewoep/JHTP11
|
c45e9e1d2a7bca40867c6bbdb5f0a49260dc60bd
|
23124bd6170ef5a7751e0952bab5317c93cd4b3d
|
refs/heads/master
| 2021-09-26T23:22:43.219971 | 2018-11-04T12:20:02 | 2018-11-04T12:20:02 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,190 |
java
|
package ch24.books_examples;// Fig. 24.29: DisplayQueryResultsController.java
// Controller for the DisplayQueryResults app
import java.sql.SQLException;
import java.util.regex.PatternSyntaxException;
import javafx.embed.swing.SwingNode;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.RowFilter;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
public class DisplayQueryResultsController {
@FXML private BorderPane borderPane;
@FXML private TextArea queryTextArea;
@FXML private TextField filterTextField;
// database URL, username and password
private static final String DATABASE_URL = "jdbc:derby:books";
private static final String USERNAME = "deitel";
private static final String PASSWORD = "deitel";
// default query retrieves all data from Authors table
private static final String DEFAULT_QUERY = "SELECT * FROM authors";
// used for configuring JTable to display and sort data
private ResultSetTableModel tableModel;
private TableRowSorter<TableModel> sorter;
public void initialize() {
queryTextArea.setText(DEFAULT_QUERY);
// create ResultSetTableModel and display database table
try {
// create TableModel for results of DEFAULT_QUERY
tableModel = new ResultSetTableModel(DATABASE_URL,
USERNAME, PASSWORD, DEFAULT_QUERY);
// create JTable based on the tableModel
JTable resultTable = new JTable(tableModel);
// set up row sorting for JTable
sorter = new TableRowSorter<TableModel>(tableModel);
resultTable.setRowSorter(sorter);
// configure SwingNode to display JTable, then add to borderPane
SwingNode swingNode = new SwingNode();
swingNode.setContent(new JScrollPane(resultTable));
borderPane.setCenter(swingNode);
}
catch (SQLException sqlException) {
displayAlert(AlertType.ERROR, "Database Error",
sqlException.getMessage());
tableModel.disconnectFromDatabase(); // close connection
System.exit(1); // terminate application
}
}
// query the database and display results in JTable
@FXML
void submitQueryButtonPressed(ActionEvent event) {
// perform a new query
try {
tableModel.setQuery(queryTextArea.getText());
}
catch (SQLException sqlException) {
displayAlert(AlertType.ERROR, "Database Error",
sqlException.getMessage());
// try to recover from invalid user query
// by executing default query
try {
tableModel.setQuery(DEFAULT_QUERY);
queryTextArea.setText(DEFAULT_QUERY);
}
catch (SQLException sqlException2) {
displayAlert(AlertType.ERROR, "Database Error",
sqlException2.getMessage());
tableModel.disconnectFromDatabase(); // close connection
System.exit(1); // terminate application
}
}
}
// apply specified filter to results
@FXML
void applyFilterButtonPressed(ActionEvent event) {
String text = filterTextField.getText();
if (text.length() == 0) {
sorter.setRowFilter(null);
}
else {
try {
sorter.setRowFilter(RowFilter.regexFilter(text));
}
catch (PatternSyntaxException pse) {
displayAlert(AlertType.ERROR, "Regex Error",
"Bad regex pattern");
}
}
}
// display an Alert dialog
private void displayAlert(
AlertType type, String title, String message) {
Alert alert = new Alert(type);
alert.setTitle(title);
alert.setContentText(message);
alert.showAndWait();
}
}
/**************************************************************************
* (C) Copyright 1992-2018 by Deitel & Associates, Inc. and *
* Pearson Education, Inc. All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
*************************************************************************/
|
[
"[email protected]"
] | |
ed6875641246ed6eb9d9bf7dd29990ad3dd4f33c
|
96bc44a0a0846b054f60d9cb737154acc081d06f
|
/src/main/java/com/product/exception/NotFoundException.java
|
18fe981a5b570e95b26ff0f9e957ecbe5cbc5d5b
|
[] |
no_license
|
KajalMathur/SpringBoot
|
5ac01c6d1353e81c03e92ecc46e7bca8e1df76ad
|
db3a5eb8160ecd3763457c8a8f1f16eb4a89a29d
|
refs/heads/master
| 2020-07-11T09:12:04.927226 | 2019-12-22T05:46:29 | 2019-12-22T05:46:29 | 204,499,892 | 0 | 0 | null | 2019-12-30T09:55:07 | 2019-08-26T14:59:12 |
Java
|
UTF-8
|
Java
| false | false | 158 |
java
|
package com.product.exception;
public class NotFoundException extends RuntimeException {
public NotFoundException(String message) {
super(message);
}
}
|
[
"[email protected]"
] | |
e958933a7767acedaa1c262f14e90fbaf7349899
|
8d85bb9c432309f1979c207c26101e081960db4e
|
/app/src/main/java/com/example/fragment/MainActivity.java
|
1deb451be1331af19e9fc1065df6d3ea78cb7d81
|
[] |
no_license
|
martanatta/Fragment
|
b2b8192dff41fdc4bd4819a5d3dfd3ed8148d9f0
|
5c2bd44ef02972a4dc4e045c09f21a178b1b9171
|
refs/heads/master
| 2023-08-05T23:16:16.488637 | 2021-10-05T12:12:53 | 2021-10-05T12:12:53 | 413,803,373 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,145 |
java
|
package com.example.fragment;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import com.etebarian.meowbottomnavigation.MeowBottomNavigation;
public class MainActivity extends AppCompatActivity {
MeowBottomNavigation bottomNavigation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bottomNavigation = findViewById(R.id.bottom_navigation);
bottomNavigation.add(new MeowBottomNavigation.Model(1, R.drawable.ic_home));
bottomNavigation.add(new MeowBottomNavigation.Model(2, R.drawable.ic_settings));
bottomNavigation.add(new MeowBottomNavigation.Model(3, R.drawable.ic_person));
bottomNavigation.setOnShowListener(new MeowBottomNavigation.ShowListener() {
@Override
public void onShowItem(MeowBottomNavigation.Model item) {
Fragment fragment = null;
switch (item.getId()) {
case 1:
fragment = new MainFragment();
break;
case 2:
fragment = new SettingsFragment();
break;
case 3:
fragment = new ProfileFragment();
break;
}
loadFragment(fragment);
}
});
bottomNavigation.show(1, true);
bottomNavigation.setOnClickMenuListener(new MeowBottomNavigation.ClickListener() {
@Override
public void onClickItem(MeowBottomNavigation.Model item) {
}
});
bottomNavigation.setOnReselectListener(new MeowBottomNavigation.ReselectListener() {
@Override
public void onReselectItem(MeowBottomNavigation.Model item) {
}
});
}
private void loadFragment(Fragment fragment) {
int commit = getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout, fragment).commit();
}
}
|
[
"[email protected]"
] | |
93149fccc64919feec177d8bb0d9d151b76a8748
|
6ed96ccecf2d6f0425f93828a2a185e5a34e7c32
|
/ngg/src/main/java/com/ntdlg/ngg/dataformat/DfNyq.java
|
c84b784f73839fee4553c56a9afa3d73490d2cc7
|
[] |
no_license
|
phx1314/NGG
|
2b745dd454d68764e0247976d0de9d2fb979b8c0
|
5bf584a23c1b2a6f6723f53931c032e934f11aaa
|
refs/heads/master
| 2022-04-13T12:38:54.014218 | 2020-04-11T01:28:11 | 2020-04-11T01:28:11 | 254,769,854 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,208 |
java
|
//
// DfNyq
//
// Created by df on 2017-02-10 14:53:54
// Copyright (c) df All rights reserved.
/**
*/
package com.ntdlg.ngg.dataformat;
import android.content.Context;
import com.mdx.framework.adapter.MAdapter;
import com.mdx.framework.server.api.Son;
import com.mdx.framework.widget.util.DataFormat;
import com.ntdlg.ngg.ada.AdaNyq;
import com.udows.common.proto.STopicList;
public class DfNyq extends DataFormat {
int size;
String begin = "";
int isWodeType;
@Override
public boolean hasNext() {
return size >= 10;
}
public DfNyq(int isWodeType) {
this.isWodeType = isWodeType;
}
public DfNyq() {
}
@Override
public MAdapter<?> getAdapter(Context context, Son son, int page) {
size = ((STopicList) son.getBuild()).list.size();// 每页10条
// if (size > 0)
// begin = ((STopicList) son.getBuild()).list.get(size - 1).createTime;
return new AdaNyq(context, ((STopicList) son.getBuild()).list,isWodeType);
}
@Override
public String[][] getPageNext() {
// return new String[][]{{"begin", begin}};
return null;
}
@Override
public void reload() {
}
}
|
[
"[email protected]"
] | |
1fd5d6c05b1035bbd947ab31b837b7bd37f140f3
|
d383d855e48ee2f5da65791f4052533eca339369
|
/src/test/java/com/alibaba/druid/bvt/sql/cobar/DALParserTest.java
|
d6a773dd3f0f245359703dbefefa96ab8f286c92
|
[
"Apache-2.0"
] |
permissive
|
liuxing7954/druid-source
|
0e2dc0b1a2f498045b8689d6431764f4f4525070
|
fc27b5ac4695dc42e1daa62db012adda7c217d36
|
refs/heads/master
| 2022-12-21T14:53:26.923986 | 2020-02-29T07:15:15 | 2020-02-29T07:15:15 | 243,908,145 | 1 | 1 |
NOASSERTION
| 2022-12-16T09:54:44 | 2020-02-29T05:07:04 |
Java
|
UTF-8
|
Java
| false | false | 64,613 |
java
|
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* 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.
*/
/**
* (created at 2011-5-20)
*/
package com.alibaba.druid.bvt.sql.cobar;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlExplainStatement;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.statement.SQLSetStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSetTransactionStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowAuthorsStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowBinLogEventsStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowBinaryLogsStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCharacterSetStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCollationStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowColumnsStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowContributorsStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateDatabaseStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateEventStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateFunctionStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateProcedureStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateTableStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateTriggerStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateViewStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowDatabasesStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEngineStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEnginesStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowErrorsStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEventsStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowFunctionCodeStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowFunctionStatusStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowGrantsStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowIndexesStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowKeysStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowMasterLogsStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowMasterStatusStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowOpenTablesStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowPluginsStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowPrivilegesStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowProcedureCodeStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowProcedureStatusStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowProcessListStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowProfileStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowProfilesStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowRelayLogEventsStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowSlaveHostsStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowSlaveStatusStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowStatusStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowTableStatusStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowTriggersStatement;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowVariantsStatement;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.parser.Token;
/**
* @author <a href="mailto:[email protected]">QIU Shuo</a>
*/
public class DALParserTest extends TestCase {
public void testdesc() throws Exception {
String sql = "desc tb1";
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLStatement desc = parser.parseDescribe();
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(desc);
Assert.assertEquals("DESC tb1", output);
}
public void testdesc_1() throws Exception {
String sql = "desc db.tb1";
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLStatement desc = parser.parseDescribe();
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(desc);
Assert.assertEquals("DESC db.tb1", output);
}
public void testSet_1() throws Exception {
String sql = "seT sysVar1 = ? ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLSetStatement set = (SQLSetStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET sysVar1 = ?", output);
}
public void testSet_2() throws Exception {
String sql = "SET `sysVar1` = ?, @@gloBal . `var2` :=1";
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLSetStatement set = (SQLSetStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET `sysVar1` = ?, @@global.`var2` = 1", output);
}
public void testSet_3() throws Exception {
String sql = "SET @usrVar1 := ?, @@`var2` =1, @@var3:=?, @'var\\'3'=?";
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLSetStatement set = (SQLSetStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET @usrVar1 = ?, @@`var2` = 1, @@var3 = ?, @'var\\'3' = ?", output);
}
public void testSet_4() throws Exception {
String sql = "SET GLOBAL var1=1, SESSION var2:=2";
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLSetStatement set = (SQLSetStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET @@global.var1 = 1, @@session.var2 = 2", output);
}
public void testSet_5() throws Exception {
String sql = "SET @@GLOBAL. var1=1, SESSION var2:=2";
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLSetStatement set = (SQLSetStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET @@global.var1 = 1, @@session.var2 = 2", output);
}
public void testSetTxn_0() throws Exception {
String sql = "SET transaction ISOLATION LEVEL READ UNCOMMITTED";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlSetTransactionStatement set = (MySqlSetTransactionStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED", output);
}
public void testSetTxn_1() throws Exception {
String sql = "SET global transaction ISOLATION LEVEL READ COMMITTED";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlSetTransactionStatement set = (MySqlSetTransactionStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED", output);
}
public void testSetTxn_2() throws Exception {
String sql = "SET transaction ISOLATION LEVEL REPEATABLE READ ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlSetTransactionStatement set = (MySqlSetTransactionStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET TRANSACTION ISOLATION LEVEL REPEATABLE READ", output);
}
public void testSetTxn_3() throws Exception {
String sql = "SET session transaction ISOLATION LEVEL SERIALIZABLE";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlSetTransactionStatement set = (MySqlSetTransactionStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE", output);
}
public void test_setNames() throws Exception {
String sql = "SET names default ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLStatement set = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET NAMES DEFAULT", output);
}
public void test_setNames_1() throws Exception {
String sql = "SET NAMEs 'utf8' collatE \"latin1_danish_ci\" ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLStatement set = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET NAMES 'utf8' COLLATE \"latin1_danish_ci\"", output);
}
public void test_setNames_2() throws Exception {
String sql = "SET NAMEs utf8 ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLStatement set = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET NAMES utf8", output);
}
public void test_setCharSet() throws Exception {
String sql = "SET CHARACTEr SEt 'utf8' ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLStatement set = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET CHARACTER SET 'utf8'", output);
}
public void test_setCharSet_1() throws Exception {
String sql = "SET CHARACTEr SEt DEFaULT ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLStatement set = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET CHARACTER SET DEFAULT", output);
}
public void test_show_authors() throws Exception {
String sql = "shoW authors ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowAuthorsStatement show = (MySqlShowAuthorsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW AUTHORS", output);
}
public void test_show_binaryLogs() throws Exception {
String sql = "SHOW BINARY LOGS ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowBinaryLogsStatement show = (MySqlShowBinaryLogsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW BINARY LOGS", output);
}
public void test_show_masterLogs() throws Exception {
String sql = "SHOW MASTER LOGS ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowMasterLogsStatement show = (MySqlShowMasterLogsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW MASTER LOGS", output);
}
public void test_show_collation() throws Exception {
String sql = "SHOW collation";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowCollationStatement show = (MySqlShowCollationStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW COLLATION", output);
}
public void test_show_collation_1() throws Exception {
String sql = "SHOW Collation like 'var1'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowCollationStatement show = (MySqlShowCollationStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW COLLATION LIKE 'var1'", output);
}
public void test_show_collation_2() throws Exception {
String sql = "SHOW COLLATION WHERE `Default` = 'Yes'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowCollationStatement show = (MySqlShowCollationStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW COLLATION WHERE `Default` = 'Yes'", output);
}
public void test_show_collation_3() throws Exception {
String sql = "SHOW collation where Collation like 'big5%'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowCollationStatement show = (MySqlShowCollationStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW COLLATION WHERE Collation LIKE 'big5%'", output);
}
public void test_binaryLog() throws Exception {
String sql = "SHOW binlog events in 'a' from 1 limit 1,2 ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowBinLogEventsStatement show = (MySqlShowBinLogEventsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW BINLOG EVENTS IN 'a' FROM 1 LIMIT 1, 2", output);
}
public void test_binaryLog_1() throws Exception {
String sql = "SHOW binlog events from 1 limit 1,2";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowBinLogEventsStatement show = (MySqlShowBinLogEventsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW BINLOG EVENTS FROM 1 LIMIT 1, 2", output);
}
public void test_binaryLog_2() throws Exception {
String sql = "SHOW binlog events ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowBinLogEventsStatement show = (MySqlShowBinLogEventsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW BINLOG EVENTS", output);
}
public void test_show_character_set() throws Exception {
String sql = "SHOW CHARACTER SET like 'var' ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowCharacterSetStatement show = (MySqlShowCharacterSetStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW CHARACTER SET LIKE 'var'", output);
}
public void test_show_character_set_1() throws Exception {
String sql = "SHOW CHARACTER SET where Charset = 'big5'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowCharacterSetStatement show = (MySqlShowCharacterSetStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW CHARACTER SET WHERE Charset = 'big5'", output);
}
public void test_show_character_set_2() throws Exception {
String sql = "SHOW CHARACTER SET";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowCharacterSetStatement show = (MySqlShowCharacterSetStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW CHARACTER SET", output);
}
public void test_show_columns() throws Exception {
String sql = "SHOW full columns from tb1 from db1 like 'var' ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowColumnsStatement show = (MySqlShowColumnsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW FULL COLUMNS FROM db1.tb1 LIKE 'var'", output);
}
public void test_show_columns_1() throws Exception {
String sql = "show columns from events where Field = 'name'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowColumnsStatement show = (MySqlShowColumnsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW COLUMNS FROM events WHERE Field = 'name'", output);
}
public void test_show_columns_2() throws Exception {
String sql = "SHOW COLUMNS FROM City";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowColumnsStatement show = (MySqlShowColumnsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW COLUMNS FROM City", output);
}
public void test_show_columns_3() throws Exception {
String sql = "SHOW full columns from db1.tb1 like 'var' ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowColumnsStatement show = (MySqlShowColumnsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW FULL COLUMNS FROM db1.tb1 LIKE 'var'", output);
}
public void test_show_contributors() throws Exception {
String sql = "SHOW contributors";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowContributorsStatement show = (MySqlShowContributorsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW CONTRIBUTORS", output);
}
public void test_show_create_database() throws Exception {
String sql = "SHOW CREATE DATABASE db_name";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowCreateDatabaseStatement show = (MySqlShowCreateDatabaseStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW CREATE DATABASE db_name", output);
}
public void test_show_create_event() throws Exception {
String sql = "SHOW CREATE event db_name";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowCreateEventStatement show = (MySqlShowCreateEventStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW CREATE EVENT db_name", output);
}
public void test_show_create_function() throws Exception {
String sql = "SHOW CREATE function x";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowCreateFunctionStatement show = (MySqlShowCreateFunctionStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW CREATE FUNCTION x", output);
}
public void test_show_create_PROCEDURE() throws Exception {
String sql = "SHOW CREATE PROCEDURE x";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowCreateProcedureStatement show = (MySqlShowCreateProcedureStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW CREATE PROCEDURE x", output);
}
public void test_show_create_table() throws Exception {
String sql = "SHOW CREATE table x";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowCreateTableStatement show = (MySqlShowCreateTableStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW CREATE TABLE x", output);
}
public void test_show_create_trigger() throws Exception {
String sql = "SHOW CREATE trigger x";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowCreateTriggerStatement show = (MySqlShowCreateTriggerStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW CREATE TRIGGER x", output);
}
public void test_show_create_view() throws Exception {
String sql = "SHOW CREATE VIEW x";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowCreateViewStatement show = (MySqlShowCreateViewStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW CREATE VIEW x", output);
}
public void test_show_databases() throws Exception {
String sql = "SHOW DATABASES";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowDatabasesStatement show = (MySqlShowDatabasesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW DATABASES", output);
}
public void test_show_databases_1() throws Exception {
String sql = "SHOW DATABASES LIKE 'a%'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowDatabasesStatement show = (MySqlShowDatabasesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW DATABASES LIKE 'a%'", output);
}
public void test_show_databases_2() throws Exception {
String sql = "SHOW DATABASES WHERE `Database` = 'mysql'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowDatabasesStatement show = (MySqlShowDatabasesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW DATABASES WHERE `Database` = 'mysql'", output);
}
public void test_show_engine() throws Exception {
String sql = "SHOW ENGINE INNODB STATUS";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowEngineStatement show = (MySqlShowEngineStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW ENGINE INNODB STATUS", output);
}
public void test_show_engine_1() throws Exception {
String sql = "SHOW ENGINE PERFORMANCE_SCHEMA STATUS";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowEngineStatement show = (MySqlShowEngineStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW ENGINE PERFORMANCE_SCHEMA STATUS", output);
}
public void test_show_engine_2() throws Exception {
String sql = "SHOW ENGINE INNODB mutex";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowEngineStatement show = (MySqlShowEngineStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW ENGINE INNODB MUTEX", output);
}
public void test_show_engines() throws Exception {
String sql = "SHOW ENGINES";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowEnginesStatement show = (MySqlShowEnginesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW ENGINES", output);
}
public void test_show_engines_1() throws Exception {
String sql = "SHOW STORAGE ENGINES";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowEnginesStatement show = (MySqlShowEnginesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW STORAGE ENGINES", output);
}
public void test_show_errors() throws Exception {
String sql = "SHOW COUNT(*) ERRORS";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowErrorsStatement show = (MySqlShowErrorsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW COUNT(*) ERRORS", output);
}
public void test_show_errors_1() throws Exception {
String sql = "SHOW ERRORS";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowErrorsStatement show = (MySqlShowErrorsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW ERRORS", output);
}
public void test_show_errors_2() throws Exception {
String sql = "SHOW ERRORS limit 1";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowErrorsStatement show = (MySqlShowErrorsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW ERRORS LIMIT 1", output);
}
public void test_show_errors_3() throws Exception {
String sql = "SHOW ERRORS limit 1, 2";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowErrorsStatement show = (MySqlShowErrorsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW ERRORS LIMIT 1, 2", output);
}
public void test_show_events() throws Exception {
String sql = "SHOW EVENTS";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowEventsStatement show = (MySqlShowEventsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW EVENTS", output);
}
public void test_show_events_1() throws Exception {
String sql = "SHOW EVENTS from x";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowEventsStatement show = (MySqlShowEventsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW EVENTS FROM x", output);
}
public void test_show_events_2() throws Exception {
String sql = "SHOW EVENTS in x";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowEventsStatement show = (MySqlShowEventsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW EVENTS FROM x", output);
}
public void test_show_events_3() throws Exception {
String sql = "SHOW EVENTS in x like '%'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowEventsStatement show = (MySqlShowEventsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW EVENTS FROM x LIKE '%'", output);
}
public void test_show_events_4() throws Exception {
String sql = "SHOW EVENTS in x where 1 = 1";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowEventsStatement show = (MySqlShowEventsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW EVENTS FROM x WHERE 1 = 1", output);
}
public void test_show_function_code() throws Exception {
String sql = "SHOW function code x";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowFunctionCodeStatement show = (MySqlShowFunctionCodeStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW FUNCTION CODE x", output);
}
public void test_show_function_status() throws Exception {
String sql = "SHOW function status like '%'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowFunctionStatusStatement show = (MySqlShowFunctionStatusStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW FUNCTION STATUS LIKE '%'", output);
}
public void test_show_function_status_1() throws Exception {
String sql = "SHOW function status where 1 = 1";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowFunctionStatusStatement show = (MySqlShowFunctionStatusStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW FUNCTION STATUS WHERE 1 = 1", output);
}
public void test_show_function_status_2() throws Exception {
String sql = "SHOW function status ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowFunctionStatusStatement show = (MySqlShowFunctionStatusStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW FUNCTION STATUS", output);
}
public void test_show_grants() throws Exception {
String sql = "SHOW GRANTS FOR 'root'@'localhost';";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowGrantsStatement show = (MySqlShowGrantsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
assertEquals("SHOW GRANTS FOR 'root'@'localhost';", output);
}
public void test_show_grants_1() throws Exception {
String sql = "SHOW GRANTS";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowGrantsStatement show = (MySqlShowGrantsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW GRANTS", output);
}
public void test_show_grants_2() throws Exception {
String sql = "SHOW GRANTS FOR CURRENT_USER";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowGrantsStatement show = (MySqlShowGrantsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW GRANTS FOR CURRENT_USER", output);
}
public void test_show_grants_3() throws Exception {
String sql = "SHOW GRANTS FOR CURRENT_USER()";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowGrantsStatement show = (MySqlShowGrantsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW GRANTS FOR CURRENT_USER()", output);
}
public void test_show_index() throws Exception {
String sql = "SHOW index from tb1 from db";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowIndexesStatement show = (MySqlShowIndexesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW INDEX FROM db.tb1", output);
}
public void test_show_index_1() throws Exception {
String sql = "SHOW index in tb1 in db";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowIndexesStatement show = (MySqlShowIndexesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW INDEX FROM db.tb1", output);
}
public void test_show_index_2() throws Exception {
String sql = "SHOW index in db.tb1";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowIndexesStatement show = (MySqlShowIndexesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW INDEX FROM db.tb1", output);
}
public void test_show_key() throws Exception {
String sql = "SHOW keys from tb1 from db";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowKeysStatement show = (MySqlShowKeysStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW KEYS FROM db.tb1", output);
}
public void test_show_key_1() throws Exception {
String sql = "SHOW keys in tb1 in db";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowKeysStatement show = (MySqlShowKeysStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW KEYS FROM db.tb1", output);
}
public void test_show_key_2() throws Exception {
String sql = "SHOW keys in db.tb1";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowKeysStatement show = (MySqlShowKeysStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW KEYS FROM db.tb1", output);
}
public void test_master_status() throws Exception {
String sql = "SHOW MASTER STATUS";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowMasterStatusStatement show = (MySqlShowMasterStatusStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW MASTER STATUS", output);
}
public void test_open_tables() throws Exception {
String sql = "SHOW OPEN TABLES";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowOpenTablesStatement show = (MySqlShowOpenTablesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW OPEN TABLES", output);
}
public void test_open_tables_1() throws Exception {
String sql = "SHOW OPEN TABLES FROM mysql";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowOpenTablesStatement show = (MySqlShowOpenTablesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW OPEN TABLES FROM mysql", output);
}
public void test_open_tables_2() throws Exception {
String sql = "SHOW OPEN TABLES in mysql";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowOpenTablesStatement show = (MySqlShowOpenTablesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW OPEN TABLES FROM mysql", output);
}
public void test_open_tables_3() throws Exception {
String sql = "SHOW OPEN TABLES in mysql like '%'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowOpenTablesStatement show = (MySqlShowOpenTablesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW OPEN TABLES FROM mysql LIKE '%'", output);
}
public void test_open_tables_4() throws Exception {
String sql = "SHOW OPEN TABLES in mysql where 1 = 1";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowOpenTablesStatement show = (MySqlShowOpenTablesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW OPEN TABLES FROM mysql WHERE 1 = 1", output);
}
public void test_show_open_plugins() throws Exception {
String sql = "SHOW plugins";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowPluginsStatement show = (MySqlShowPluginsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW PLUGINS", output);
}
public void test_show_PRIVILEGES() throws Exception {
String sql = "SHOW PRIVILEGES";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowPrivilegesStatement show = (MySqlShowPrivilegesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW PRIVILEGES", output);
}
public void test_show_procedure_code() throws Exception {
String sql = "SHOW procedure code x";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowProcedureCodeStatement show = (MySqlShowProcedureCodeStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW PROCEDURE CODE x", output);
}
public void test_show_procedure_status() throws Exception {
String sql = "SHOW procedure status like '%'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowProcedureStatusStatement show = (MySqlShowProcedureStatusStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW PROCEDURE STATUS LIKE '%'", output);
}
public void test_show_procedure_status_1() throws Exception {
String sql = "SHOW procedure status where 1 = 1";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowProcedureStatusStatement show = (MySqlShowProcedureStatusStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW PROCEDURE STATUS WHERE 1 = 1", output);
}
public void test_show_procedure_status_2() throws Exception {
String sql = "SHOW procedure status ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowProcedureStatusStatement show = (MySqlShowProcedureStatusStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW PROCEDURE STATUS", output);
}
public void test_show_processList() throws Exception {
String sql = "SHOW processlist ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowProcessListStatement show = (MySqlShowProcessListStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW PROCESSLIST", output);
}
public void test_show_processList_1() throws Exception {
String sql = "SHOW full processlist ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowProcessListStatement show = (MySqlShowProcessListStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW FULL PROCESSLIST", output);
}
public void test_show_profiles() throws Exception {
String sql = "SHOW profiles";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowProfilesStatement show = (MySqlShowProfilesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW PROFILES", output);
}
public void test_show_profile() throws Exception {
String sql = "SHOW profile";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowProfileStatement show = (MySqlShowProfileStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW PROFILE", output);
}
public void test_show_profile_1() throws Exception {
String sql = "SHOW profile all,block io,context switches,cpu,ipc,memory, page faults,source,swaps for query 2 limit 1 offset 2";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowProfileStatement show = (MySqlShowProfileStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW PROFILE ALL, BLOCK IO, CONTEXT SWITCHES, CPU, IPC, MEMORY, PAGE FAULTS, SOURCE, SWAPS FOR QUERY 2 LIMIT 2, 1", output);
}
public void test_show_relayLogEvents() throws Exception {
String sql = "SHOW RELAYLOG EVENTS";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowRelayLogEventsStatement show = (MySqlShowRelayLogEventsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW RELAYLOG EVENTS", output);
}
public void test_show_relayLogEvents_1() throws Exception {
String sql = "SHOW RELAYLOG EVENTS IN 'x' from 3 limit 5,6";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowRelayLogEventsStatement show = (MySqlShowRelayLogEventsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW RELAYLOG EVENTS IN 'x' FROM 3 LIMIT 5, 6", output);
}
public void test_show_slaveHosts() throws Exception {
String sql = "SHOW SLAVE HOSTS";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowSlaveHostsStatement show = (MySqlShowSlaveHostsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW SLAVE HOSTS", output);
}
public void test_show_slaveStatus() throws Exception {
String sql = "SHOW SLAVE Status";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowSlaveStatusStatement show = (MySqlShowSlaveStatusStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW SLAVE STATUS", output);
}
public void test_show_status() throws Exception {
String sql = "SHOW STATUS LIKE 'Key%'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowStatusStatement show = (MySqlShowStatusStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW STATUS LIKE 'Key%'", output);
}
public void test_show_table_status() throws Exception {
String sql = "SHOW TABLE STATUS FROM mysql";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowTableStatusStatement show = (MySqlShowTableStatusStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW TABLE STATUS FROM mysql", output);
}
public void test_show_triggers() throws Exception {
String sql = "SHOW TRIGGERS LIKE 'acc%'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowTriggersStatement show = (MySqlShowTriggersStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW TRIGGERS LIKE 'acc%'", output);
}
public void test_show_variants() throws Exception {
String sql = "SHOW VARIABLES LIKE '%size%';";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowVariantsStatement show = (MySqlShowVariantsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
assertEquals("SHOW VARIABLES LIKE '%size%';", output);
}
public void test_show_variants_1() throws Exception {
String sql = "SHOW GLOBAL VARIABLES LIKE '%size%';";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowVariantsStatement show = (MySqlShowVariantsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
assertEquals("SHOW GLOBAL VARIABLES LIKE '%size%';", output);
}
public void test_show_variants_2() throws Exception {
String sql = "SHOW SESSION VARIABLES LIKE '%size%';";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowVariantsStatement show = (MySqlShowVariantsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
assertEquals("SHOW SESSION VARIABLES LIKE '%size%';", output);
}
//
// public void testShow() throws Exception {
//
// sql =
// "SHOW profile all,block io,context switches,cpu,ipc,memory,"
// + "page faults,source,swaps for query 2 limit 1 offset 2";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW PROFILE ALL, BLOCK IO, CONTEXT SWITCHES, CPU, IPC, MEMORY, "
// + "PAGE FAULTS, SOURCE, SWAPS FOR QUERY 2 LIMIT 2, 1", output);
//
// sql = "SHOW profile";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW PROFILE", output);
//
// sql = "SHOW profile all,block io,context switches,cpu,ipc," + "memory,page faults,source,swaps for query 2";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW PROFILE ALL, BLOCK IO, CONTEXT SWITCHES, CPU, IPC, "
// + "MEMORY, PAGE FAULTS, SOURCE, SWAPS FOR QUERY 2", output);
//
// sql = "SHOW profile all for query 2";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW PROFILE ALL FOR QUERY 2", output);
//
// sql = "SHOW slave hosts";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW SLAVE HOSTS", output);
//
// sql = "SHOW slave status";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW SLAVE STATUS", output);
//
// sql = "SHOW global status like 'expr'";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW GLOBAL STATUS LIKE 'expr'", output);
//
// sql = "SHOW global status where ${abc}";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW GLOBAL STATUS WHERE ${abc}", output);
//
// sql = "SHOW session status like 'expr'";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW SESSION STATUS LIKE 'expr'", output);
//
// sql = "SHOW session status where ?";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW SESSION STATUS WHERE ?", output);
//
// sql = "SHOW status like 'expr'";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW SESSION STATUS LIKE 'expr'", output);
//
// sql = "SHOW status where 0b10^b'11'";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW SESSION STATUS WHERE b'10' ^ b'11'", output);
//
// sql = "SHOW status";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW SESSION STATUS", output);
//
// sql = "SHOW global status";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW GLOBAL STATUS", output);
//
// sql = "SHOW session status";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW SESSION STATUS", output);
//
// sql = "SHOW table status from db like 'expr'";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW TABLE STATUS FROM db LIKE 'expr'", output);
//
// sql = "SHOW table status in db where (select a)>(select b)";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW TABLE STATUS FROM db WHERE (SELECT a) > (SELECT b)", output);
//
// sql = "SHOW table status from db where id1=a||b";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW TABLE STATUS FROM db WHERE id1 = a OR b", output);
//
// sql = "SHOW table status ";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW TABLE STATUS", output);
//
// sql = "SHOW tables from db like 'expr'";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW TABLES FROM db LIKE 'expr'", output);
//
// sql = "SHOW tables in db where !a";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW TABLES FROM db WHERE ! a", output);
//
// sql = "SHOW tables like 'expr'";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW TABLES LIKE 'expr'", output);
//
// sql = "SHOW tables where log((select a))=b";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW TABLES WHERE LOG(SELECT a) = b", output);
//
// sql = "SHOW tables ";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW TABLES", output);
//
// sql = "SHOW full tables from db like 'expr'";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW FULL TABLES FROM db LIKE 'expr'", output);
//
// sql = "SHOW full tables in db where id1=abs((select a))";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW FULL TABLES FROM db WHERE id1 = ABS(SELECT a)", output);
//
// sql = "SHOW full tables ";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW FULL TABLES", output);
//
// sql = "SHOW triggers from db like 'expr'";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW TRIGGERS FROM db LIKE 'expr'", output);
//
// sql = "SHOW triggers in db where strcmp('test1','test2')";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW TRIGGERS FROM db WHERE STRCMP('test1', 'test2')", output);
//
// sql = "SHOW triggers ";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW TRIGGERS", output);
//
// sql = "SHOW global variables like 'expr'";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW GLOBAL VARIABLES LIKE 'expr'", output);
//
// sql = "SHOW global variables where ~a is null";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW GLOBAL VARIABLES WHERE ~ a IS NULL", output);
//
// sql = "SHOW session variables like 'expr'";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW SESSION VARIABLES LIKE 'expr'", output);
//
// sql = "SHOW session variables where a*b+1=c";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW SESSION VARIABLES WHERE a * b + 1 = c", output);
//
// sql = "SHOW variables like 'expr'";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW SESSION VARIABLES LIKE 'expr'", output);
//
// sql = "SHOW variables where a&&b";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW SESSION VARIABLES WHERE a AND b", output);
//
// sql = "SHOW variables";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW SESSION VARIABLES", output);
//
// sql = "SHOW global variables";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW GLOBAL VARIABLES", output);
//
// sql = "SHOW session variables";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW SESSION VARIABLES", output);
//
// sql = "SHOW warnings limit 1,2 ";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW WARNINGS LIMIT 1, 2", output);
//
// sql = "SHOW warnings";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW WARNINGS", output);
//
// sql = "SHOW count(*) warnings";
// lexer = new SQLLexer(sql);
// parser = new DALParser(lexer, new SQLExprParser(lexer));
// show = (DALShowStatement) parser.show();
// parser.match(Token.EOF);
// output = output2MySQL(show, sql);
// Assert.assertEquals("SHOW COUNT(*) WARNINGS", output);
// }
}
|
[
"[email protected]"
] | |
04320a221d73549d52a8c76ccf96adfcf2ff4ec0
|
a2df6764e9f4350e0d9184efadb6c92c40d40212
|
/aliyun-java-sdk-sofa/src/main/java/com/aliyuncs/sofa/transform/v20190815/UpdateMsGuardianRulesResponseUnmarshaller.java
|
93c57bb5a225cdf3210591823c03f7a20a0bbe3d
|
[
"Apache-2.0"
] |
permissive
|
warriorsZXX/aliyun-openapi-java-sdk
|
567840c4bdd438d43be6bd21edde86585cd6274a
|
f8fd2b81a5f2cd46b1e31974ff6a7afed111a245
|
refs/heads/master
| 2022-12-06T15:45:20.418475 | 2020-08-20T08:37:31 | 2020-08-26T06:17:49 | 290,450,773 | 1 | 0 |
NOASSERTION
| 2020-08-26T09:15:48 | 2020-08-26T09:15:47 | null |
UTF-8
|
Java
| false | false | 1,421 |
java
|
/*
* 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.aliyuncs.sofa.transform.v20190815;
import com.aliyuncs.sofa.model.v20190815.UpdateMsGuardianRulesResponse;
import com.aliyuncs.transform.UnmarshallerContext;
public class UpdateMsGuardianRulesResponseUnmarshaller {
public static UpdateMsGuardianRulesResponse unmarshall(UpdateMsGuardianRulesResponse updateMsGuardianRulesResponse, UnmarshallerContext _ctx) {
updateMsGuardianRulesResponse.setRequestId(_ctx.stringValue("UpdateMsGuardianRulesResponse.RequestId"));
updateMsGuardianRulesResponse.setResultCode(_ctx.stringValue("UpdateMsGuardianRulesResponse.ResultCode"));
updateMsGuardianRulesResponse.setResultMessage(_ctx.stringValue("UpdateMsGuardianRulesResponse.ResultMessage"));
updateMsGuardianRulesResponse.setResult(_ctx.longValue("UpdateMsGuardianRulesResponse.Result"));
return updateMsGuardianRulesResponse;
}
}
|
[
"[email protected]"
] | |
231db0c60e13f17ce335125f85f74565aa2b401e
|
aff2cb3db4ed4679887487b2aeaab376710dd6e9
|
/src/test/java/com/atguigu/test/IOCTest_AOP.java
|
aeae652147a6aedda24ca0dcf539b09d451b7baa
|
[] |
no_license
|
lennywang/atguigu-spring-annotation
|
898c090891701d626fc3cc5f6aa356e427a25ec8
|
7c1ec3cf3b39e0cd64d3dd7fcfcaa9852c110b5c
|
refs/heads/master
| 2021-07-16T01:11:18.664411 | 2019-10-29T07:26:27 | 2019-10-29T07:26:27 | 218,187,962 | 0 | 0 | null | 2020-10-13T17:03:50 | 2019-10-29T02:31:23 |
Java
|
UTF-8
|
Java
| false | false | 596 |
java
|
package com.atguigu.test;
import com.atguigu.aop.MathCalculator;
import com.atguigu.config.MainConfigOfAOP;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
public class IOCTest_AOP {
@Test
public void test01()
{
AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfigOfAOP.class);
MathCalculator mathCalculator = applicationContext.getBean(MathCalculator.class);
mathCalculator.div(1,1);
applicationContext.close();
}
}
|
[
"[email protected]"
] | |
3ea7b9dc1a4e9384b237b490d1748cc1e88d66ea
|
e3524531d95ddb50879c569709401fb04df82849
|
/app/src/main/java/com/example/mycontact/pref/PrimaPref.java
|
e601852cb4ad2510e6209aceb008bc4dc08f1dbf
|
[] |
no_license
|
eltawakkal/perabgaj
|
44b022296649924fc5d63666243fe82315512538
|
6c2b77a02000c3ed2f10a224a23457ebd597f40b
|
refs/heads/master
| 2022-07-06T08:24:02.793590 | 2020-05-18T03:15:17 | 2020-05-18T03:15:17 | 264,812,763 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,498 |
java
|
package com.example.mycontact.pref;
import android.content.Context;
import android.content.SharedPreferences;
import com.example.mycontact.model.User;
public class PrimaPref {
public static String PREF_NAME = "prima_shared_pref";
public static String ID_KEY = "user_id";
public static String NAME_KEY = "user_name";
public static String EMAIL_KEY = "user_email";
public static String PHOTO_KEY = "user_photo";
private static SharedPreferences pref;
private static SharedPreferences.Editor editor;
public PrimaPref(Context context) {
pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
}
public void setUser(User user) {
editor = pref.edit();
editor.putString(ID_KEY, user.getId());
editor.putString(NAME_KEY, user.getName());
editor.putString(EMAIL_KEY, user.getEmail());
editor.putString(PHOTO_KEY, user.getPhoto());
editor.commit();
}
public User getUser() {
User user = new User();
user.setId(pref.getString(ID_KEY, null));
user.setName(pref.getString(NAME_KEY, null));
user.setEmail(pref.getString(EMAIL_KEY, null));
user.setPhoto(pref.getString(PHOTO_KEY, null));
return user;
}
public void removeUser() {
editor = pref.edit();
editor.remove(ID_KEY);
editor.remove(NAME_KEY);
editor.remove(EMAIL_KEY);
editor.remove(PHOTO_KEY);
editor.commit();
}
}
|
[
"[email protected]"
] | |
50aecd4bea77accfe6a42dc5d412d4a5349d0b8e
|
e879b3b894d706c4b6fcf987b87ebe03c28f5de2
|
/COVID19MX/src/mysql/metodos.java
|
098c5f7a8d5a1456414cdf9c85571cd96c25b8d5
|
[] |
no_license
|
vicente100est/COVID
|
f67066b0089ac0e49a5db1eabd3a2eaaf145a58a
|
071e8e11cd710311e3e372f6e9f39a0ff7854e14
|
refs/heads/main
| 2023-06-19T06:16:43.331650 | 2021-07-17T23:57:37 | 2021-07-17T23:57:37 | 387,057,088 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,704 |
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 mysql;
import java.awt.Component;
import java.awt.HeadlessException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JOptionPane;
/**
*
* @author JUAN100CORR
*/
public class metodos {
private static Connection conexion1;
private static PreparedStatement sentenica_preparada;
private static ResultSet resultado;
public void guardar_datos_paciente(String nombre1, String curp1, String apellidop1, String apellidom1, int edad1, String sexo1, int año1, int nohijos1, String estcivil1, String escolaridad1,
String hrtrabajo1, String Ocupacion1, String Religion1, int tel_cas1, String tel_mov1, String correo1) {
try {
conexion1 = conexion.conectar();
String consulta = "CALL INSERTARCOVID19(NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
sentenica_preparada = conexion1.prepareStatement(consulta);
sentenica_preparada.setString(1, nombre1);
sentenica_preparada.setString(2, curp1);
sentenica_preparada.setString(3, apellidop1);
sentenica_preparada.setString(4, apellidom1);
sentenica_preparada.setInt(5, edad1);
sentenica_preparada.setString(6, sexo1);
sentenica_preparada.setInt(7, año1);
sentenica_preparada.setInt(8, nohijos1);
sentenica_preparada.setString(9, estcivil1);
sentenica_preparada.setString(10, escolaridad1);
sentenica_preparada.setString(11, hrtrabajo1);
sentenica_preparada.setString(12, Ocupacion1);
sentenica_preparada.setString(13, Religion1);
sentenica_preparada.setInt(14, tel_cas1);
sentenica_preparada.setString(15, tel_mov1);
sentenica_preparada.setString(16, correo1);
int i = sentenica_preparada.executeUpdate();
if (i > 0) {
Component cmpnt;
JOptionPane.showMessageDialog(null, "DATOS GUARDADOS");
} else {
JOptionPane.showMessageDialog(null, "ERROR AL GUARDAR DATOS");
}
conexion1.close();
} catch (HeadlessException | SQLException e) {
JOptionPane.showMessageDialog(null, "ERROR AL GUARDAR DATOS"+ e);
} finally{
try {
conexion1.close();
} catch (SQLException e) {
}
}
}
}
|
[
"[email protected]"
] | |
d199b5e36c5e0004717db6a2f175e353472a5121
|
3ef2168610641d72e5dd18d27cb100b0be9405fa
|
/src/br/fiap/MensagemRemota.java
|
f8189c792c5ae1c8dab85d1d173100ee6c5c6a87
|
[] |
no_license
|
Vicnovais/RMIChat
|
172daaf2bfe355ff109aeb67144aa6122a1c043b
|
84e85f8f945e9f5d7a978c3cbd52321ef106e4c2
|
refs/heads/master
| 2016-09-05T19:01:03.055094 | 2015-04-30T02:51:12 | 2015-04-30T02:51:12 | 34,826,705 | 0 | 0 | null | null | null | null |
ISO-8859-1
|
Java
| false | false | 1,716 |
java
|
package br.fiap;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.Enumeration;
import java.util.Hashtable;
/**
* Classe MensagemRemota
* Possui implementação da interface MensagemInterface
*/
public class MensagemRemota extends UnicastRemoteObject implements MensagemInterface{
public String name;
public MensagemInterface client=null;
private Hashtable l = new Hashtable();
protected MensagemRemota(String name) throws RemoteException {
this.name = name;
}
/**
* Obtém o nome
*/
@Override
public String getName() throws RemoteException {
return this.name;
}
/**
* Seta um novo cliente
* @throws RemoteException
*/
@Override
public void setClient(MensagemInterface c) throws RemoteException{
l.put(c.getName(), c);
client = c;
}
/**
* Obtém um cliente
*/
@Override
public MensagemInterface getClient(){
return client;
}
/**
* Mensagem a ser enviada
*/
@Override
public void send(String msg) throws RemoteException {
System.out.println(msg);
}
public void sendToAll(String s, MensagemInterface from) throws RemoteException{
System.out.println("\n["+from.getName()+"] "+s);
Enumeration usernames = l.keys();
while(usernames.hasMoreElements()){
String user=(String) usernames.nextElement();
MensagemInterface m=(MensagemInterface)l.get(user);
if (user.equals(from.getName())){continue;}
try{
m.tell("\n["+from.getName()+"] "+s);
}catch(Exception e){e.printStackTrace();}
}
}
public void tell(String s) throws RemoteException{
System.out.println(s);
}
}
|
[
"[email protected]"
] | |
90ac3cf5a23a2a07fd27e800ac0bc6d01f465c7e
|
b01365219321ec4437d1cbe1265f634bc07eec23
|
/23. ThymeLeaf/ThymeLeaf_Web_App/src/test/java/com/kishore/ThymeLeafWebAppApplicationTests.java
|
8a0523c295bfbff00d7e01cd3fbee6cc4c86d501
|
[] |
no_license
|
kishore5464/SpringBoot_Tutorials_Basics
|
eecdaa29e3be7b395f64a7b099c51be9f474de74
|
962a8af61075c4e11b06bef0d20e09f74f5d397f
|
refs/heads/master
| 2023-07-30T18:46:47.479524 | 2023-07-18T18:00:39 | 2023-07-18T18:00:39 | 228,673,107 | 2 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 212 |
java
|
package com.kishore;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ThymeLeafWebAppApplicationTests {
@Test
void contextLoads() {
}
}
|
[
"[email protected]"
] | |
8a3ccb88415cd2e98552ae526e241b0a616f023f
|
f01fce787bb615395812f07151b93f593a8407f5
|
/src/test/java/org/trellisldp/rosid/common/RDFUtilsTest.java
|
a488049c11660adbdff8f5640e38fe6747545c33
|
[
"Apache-2.0"
] |
permissive
|
trellis-ldp-archive/trellis-rosid-common
|
5e642b4fdebc3149616e5e73d7c6bed5b8b4523a
|
2a69ce9f6d8a611a3518a42bb6ea04d9d184c81a
|
refs/heads/master
| 2021-09-03T06:34:22.528200 | 2018-01-06T13:43:32 | 2018-01-06T13:43:32 | 84,475,415 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,947 |
java
|
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.trellisldp.rosid.common;
import static java.time.Instant.now;
import static java.util.Arrays.asList;
import static java.util.Optional.of;
import static java.util.stream.Collectors.toList;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.trellisldp.rosid.common.RDFUtils.endedAtQuad;
import static org.trellisldp.rosid.common.RDFUtils.getParent;
import static org.trellisldp.rosid.common.RDFUtils.hasObjectIRI;
import static org.trellisldp.rosid.common.RDFUtils.hasSubjectIRI;
import static org.trellisldp.api.RDFUtils.getInstance;
import java.time.Instant;
import java.util.List;
import org.apache.commons.rdf.api.Dataset;
import org.apache.commons.rdf.api.IRI;
import org.apache.commons.rdf.api.Literal;
import org.apache.commons.rdf.api.Quad;
import org.apache.commons.rdf.api.RDF;
import org.apache.commons.rdf.api.RDFTerm;
import org.trellisldp.vocabulary.PROV;
import org.trellisldp.vocabulary.Trellis;
import org.trellisldp.vocabulary.XSD;
import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;
/**
* @author acoburn
*/
@RunWith(JUnitPlatform.class)
public class RDFUtilsTest {
private static final RDF rdf = getInstance();
private final IRI identifier = rdf.createIRI("trellis:repository/resource");
private final IRI agent = rdf.createIRI("http://example.org/agent");
@Test
public void testFilters() {
final Dataset dataset = rdf.createDataset();
dataset.add(rdf.createQuad(Trellis.PreferAudit, identifier, PROV.wasGeneratedBy, agent));
dataset.add(rdf.createQuad(Trellis.PreferAudit, rdf.createBlankNode(), PROV.endedAtTime,
rdf.createLiteral(now().toString(), XSD.dateTime)));
assertEquals(1L, dataset.stream().filter(hasObjectIRI).count());
assertEquals(1L, dataset.stream().filter(hasSubjectIRI).count());
}
@Test
public void testGetParent() {
assertEquals(of("trellis:repository"), getParent("trellis:repository/resource"));
assertFalse(getParent("trellis:repository").isPresent());
assertEquals(of("trellis:repository/resource"), getParent("trellis:repository/resource/child"));
}
@Test
public void testEndedAtQuad() {
final Dataset dataset = rdf.createDataset();
final Instant time = now();
dataset.add(rdf.createQuad(Trellis.PreferAudit, identifier, PROV.wasGeneratedBy, rdf.createBlankNode()));
final List<Quad> quads = endedAtQuad(identifier, dataset, time).collect(toList());
assertEquals(1L, quads.size());
final RDFTerm literal = quads.get(0).getObject();
assertTrue(literal instanceof Literal);
assertEquals(time.toString(), ((Literal) literal).getLexicalForm());
}
@Test
public void testSerializeDataset() {
final String data = "<info:foo> <ex:bar> \"A literal\"@en .\n<info:foo> <ex:baz> <info:trellis> .\n";
final String dataInv = "<info:foo> <ex:baz> <info:trellis> .\n<info:foo> <ex:bar> \"A literal\"@en .\n";
final String serialized = RDFUtils.serialize(RDFUtils.deserialize(data));
assertTrue(serialized.equals(data) || serialized.equals(dataInv));
assertEquals("", RDFUtils.serialize((Dataset) null));
assertEquals(2L, RDFUtils.deserialize(data).size());
assertEquals(0L, RDFUtils.deserialize(null).size());
}
@Test
public void testSerializeList() {
final String data = "<info:foo> <ex:bar> \"A literal\"@en <ex:Graph> .\n" +
"<info:foo> <ex:baz> <info:trellis> <ex:Graph> .\n";
final String dataInv = "<info:foo> <ex:baz> <info:trellis> <ex:Graph> .\n" +
"<info:foo> <ex:bar> \"A literal\"@en <ex:Graph> .\n";
final String serialized = RDFUtils.serialize(asList(
rdf.createQuad(rdf.createIRI("ex:Graph"), rdf.createIRI("info:foo"),
rdf.createIRI("ex:bar"), rdf.createLiteral("A literal", "en")),
rdf.createQuad(rdf.createIRI("ex:Graph"), rdf.createIRI("info:foo"),
rdf.createIRI("ex:baz"), rdf.createIRI("info:trellis"))));
assertTrue(serialized.equals(data) || serialized.equals(dataInv));
}
}
|
[
"[email protected]"
] | |
f29225b4e3f859a61167f2a323a7d1ca20c6a7c5
|
776a3e4c34a50c37eac017ad3d85b4df2c4cc6f4
|
/0148-sort-list/src/Solution.java
|
d91cf8bf7f1e291de637bf3cee694cf8b861f37d
|
[] |
no_license
|
dingsw2019/play-leetcode
|
d308e75b578d0e75efd2b23a1f3ec2e4356539dd
|
ed7792670a2e35708b4db04bc5065ce55614ded7
|
refs/heads/master
| 2022-12-06T14:41:34.799969 | 2020-08-30T15:56:07 | 2020-08-30T15:56:07 | 281,032,968 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,115 |
java
|
public class Solution {
public class ListNode {
int val;
ListNode next;
ListNode(int x) { val = x; }
}
public ListNode sortList(ListNode head) {
if (head == null || head.next == null)
return head;
// 切割链表
ListNode fast = head.next;
ListNode slow = head;
while (fast != null && fast.next != null) {
slow = slow.next;
fast = fast.next.next;
}
ListNode after = slow.next;
slow.next = null;
// 合并排序
ListNode left = sortList(head);
ListNode right = sortList(after);
ListNode dummyHead = new ListNode(0);
ListNode cur = dummyHead;
while (left != null && right != null) {
if (left.val <= right.val) {
cur.next = left;
left = left.next;
} else {
cur.next = right;
right = right.next;
}
cur = cur.next;
}
cur.next = (left == null) ? right : left;
return dummyHead.next;
}
}
|
[
"[email protected]"
] | |
8fab57ed485c27633e815f54031ffaf2d24a9fd6
|
4d6f449339b36b8d4c25d8772212bf6cd339f087
|
/netreflected/src/Core/WindowsBase,Version=4.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35/system/componentmodel/IEditableCollectionViewImplementation.java
|
749f7c912cda087243c38c815fb4ab677c3aa9f0
|
[
"MIT"
] |
permissive
|
lvyitian/JCOReflector
|
299a64550394db3e663567efc6e1996754f6946e
|
7e420dca504090b817c2fe208e4649804df1c3e1
|
refs/heads/master
| 2022-12-07T21:13:06.208025 | 2020-08-28T09:49:29 | 2020-08-28T09:49:29 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 11,281 |
java
|
/*
* MIT License
*
* Copyright (c) 2020 MASES s.r.l.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**************************************************************************************
* <auto-generated>
* This code was generated from a template using JCOReflector
*
* Manual changes to this file may cause unexpected behavior in your application.
* Manual changes to this file will be overwritten if the code is regenerated.
* </auto-generated>
*************************************************************************************/
package system.componentmodel;
import org.mases.jcobridge.*;
import org.mases.jcobridge.netreflection.*;
import java.util.ArrayList;
// Import section
import system.componentmodel.NewItemPlaceholderPosition;
/**
* The base .NET class managing System.ComponentModel.IEditableCollectionView, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35. Extends {@link NetObject}.
* <p>
*
* See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.ComponentModel.IEditableCollectionView" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.ComponentModel.IEditableCollectionView</a>
*/
public class IEditableCollectionViewImplementation extends NetObject implements IEditableCollectionView {
/**
* Fully assembly qualified name: WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
*/
public static final String assemblyFullName = "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35";
/**
* Assembly name: WindowsBase
*/
public static final String assemblyShortName = "WindowsBase";
/**
* Qualified class name: System.ComponentModel.IEditableCollectionView
*/
public static final String className = "System.ComponentModel.IEditableCollectionView";
static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName);
/**
* The type managed from JCOBridge. See {@link JCType}
*/
public static JCType classType = createType();
static JCEnum enumInstance = null;
JCObject classInstance = null;
static JCType createType() {
try {
return bridge.GetType(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName));
} catch (JCException e) {
return null;
}
}
void addReference(String ref) throws Throwable {
try {
bridge.AddReference(ref);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public IEditableCollectionViewImplementation(Object instance) throws Throwable {
super(instance);
if (instance instanceof JCObject) {
classInstance = (JCObject) instance;
} else
throw new Exception("Cannot manage object, it is not a JCObject");
}
public String getJCOAssemblyName() {
return assemblyFullName;
}
public String getJCOClassName() {
return className;
}
public String getJCOObjectName() {
return className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
}
public Object getJCOInstance() {
return classInstance;
}
public JCType getJCOType() {
return classType;
}
/**
* Try to cast the {@link IJCOBridgeReflected} instance into {@link IEditableCollectionView}, a cast assert is made to check if types are compatible.
*/
public static IEditableCollectionView ToIEditableCollectionView(IJCOBridgeReflected from) throws Throwable {
NetType.AssertCast(classType, from);
return new IEditableCollectionViewImplementation(from.getJCOInstance());
}
// Methods section
public NetObject AddNew() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objAddNew = (JCObject)classInstance.Invoke("AddNew");
return new NetObject(objAddNew);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void CancelEdit() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("CancelEdit");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void CancelNew() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("CancelNew");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void CommitEdit() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("CommitEdit");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void CommitNew() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("CommitNew");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void EditItem(NetObject item) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("EditItem", item == null ? null : item.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void Remove(NetObject item) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("Remove", item == null ? null : item.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void RemoveAt(int index) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("RemoveAt", index);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Properties section
public boolean getCanAddNew() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Get("CanAddNew");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public boolean getCanCancelEdit() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Get("CanCancelEdit");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public boolean getCanRemove() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Get("CanRemove");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public boolean getIsAddingNew() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Get("IsAddingNew");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public boolean getIsEditingItem() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Get("IsEditingItem");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NewItemPlaceholderPosition getNewItemPlaceholderPosition() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("NewItemPlaceholderPosition");
return new NewItemPlaceholderPosition(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setNewItemPlaceholderPosition(NewItemPlaceholderPosition NewItemPlaceholderPosition) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("NewItemPlaceholderPosition", NewItemPlaceholderPosition == null ? null : NewItemPlaceholderPosition.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetObject getCurrentAddItem() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("CurrentAddItem");
return new NetObject(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetObject getCurrentEditItem() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("CurrentEditItem");
return new NetObject(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Instance Events section
}
|
[
"[email protected]"
] | |
19877bd692994524032589828a2d4c4aaa54deac
|
7645f111da2eee97cfab1801b9a527849f952b08
|
/src/sa/lib/SLibTimeConsts.java
|
1c289e6e5deec930d417d3d50f757774d68aae79
|
[
"MIT"
] |
permissive
|
swaplicado/sa-lib-10
|
639117d4ddd728a8fe1fdc5927250489b79c05e1
|
d5baf5dc3b884c0f30a34c53850185a683d04b3d
|
refs/heads/master
| 2023-07-20T00:59:35.691753 | 2023-07-13T16:45:53 | 2023-07-13T16:45:53 | 119,547,010 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 509 |
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sa.lib;
/**
*
* @author Sergio Flores
*/
public class SLibTimeConsts {
public static final int YEAR_MIN = 2001;
public static final int YEAR_MAX = 2100;
public static final int MONTH_MIN = 1;
public static final int MONTH_MAX = 12;
public static final int MONTHS = 12;
public static final String TXT_DAY = "día";
public static final String TXT_DAYS = "días";
}
|
[
"[email protected]"
] | |
f8c3d181c4d7c24d6c9aafa8f9ee34584b277ab3
|
62004846647d35151a636714ee0fc5227e073bc7
|
/jike.2015.1.23(2.0.1)/src/jk/o1office/order/servlet/DeleteOrder.java
|
4038781e3745e2674a952aac6b3cb3cb07a9002e
|
[] |
no_license
|
yonghai/JKWebPortal
|
aa86d6c02b0c9ebec148cbb7167746c108d21e37
|
3e591ee5d39d57b0fdb5968d9ae59fa9fbcd4931
|
refs/heads/master
| 2021-01-15T23:01:59.284192 | 2015-01-23T07:15:51 | 2015-01-23T07:15:51 | 28,065,308 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,779 |
java
|
package jk.o1office.order.servlet;
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 org.apache.log4j.Logger;
import jk.o1office.excetion.FailException;
import jk.o1office.excetion.NullException;
import jk.o1office.ht.utils.ExceptionInfo;
import jk.o1office.log.FileType;
import jk.o1office.log.MyLog;
import jk.o1office.log.OperateType;
import jk.o1office.service.OrderService;
import jk.o1office.validator.Validator;
/**
* 删除订单
* 参数已验证
*/
public class DeleteOrder extends HttpServlet{
private Logger logger = Logger.getLogger("jk.o1office.order.servlet.DeleteOrder");
private OrderService orderService;
private Validator validator;
public Validator getValidator() {
return validator;
}
public void setValidator(Validator validator) {
this.validator = validator;
}
public OrderService getOrderService() {
return orderService;
}
public void setOrderService(OrderService orderService) {
this.orderService = orderService;
}
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doPost(req, resp);
}
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setCharacterEncoding("utf-8");
resp.setContentType("text/html;charset=utf-8");
PrintWriter printWriter = resp.getWriter();
String token = "";
String returninfo = "";
try {
String deviceid = req.getParameter("device_id");
String time = validator.isNull(req.getParameter("time"), "time");
token = validator.isNull(req.getParameter("token"), "token");
String orderid = validator.isNull(req.getParameter("order_id"), "order_id");
returninfo = orderService.deleteOrder(orderid,time,token);
MyLog.newInstance().writeLog(OperateType.UDELORDER, FileType.UUSERORDER, token, "success");
} catch (NullException e) {
returninfo = "{\"success\":false,\"token\":\""+token+"\",\"emsg\":\""+validator.getName()+"不能为null\"}";
MyLog.newInstance().writeLog(OperateType.UDELORDER, FileType.UUSERORDER, token, "fail");
e.printStackTrace();
e.printStackTrace(ExceptionInfo.out());
ExceptionInfo.out().flush();
} catch(Exception e){
returninfo = "{\"success\":false,\"token\":\""+token+"\",\"emsg\":\"删除订单出错了\"}";
MyLog.newInstance().writeLog(OperateType.UDELORDER, FileType.UUSERORDER, token, "fail");
e.printStackTrace();
e.printStackTrace(ExceptionInfo.out());
ExceptionInfo.out().flush();
} finally{
printWriter.println(returninfo);
}
}
}
|
[
"[email protected]"
] | |
f5fa8a7bfdf0f9777806159143c51760a29e9419
|
bf72cadaf675702b417250c3bd7934018944f1e1
|
/app/src/main/java/com/tenz/hotchpotch/base/BaseMvpActivity.java
|
c77f4e2363c27d07bb80a08d08d2b7a6a0c159f2
|
[] |
no_license
|
TenzLiu/HotchPotch
|
5476c1fe993438d9e4e4c70fb8775b573084b7ef
|
05c51a78581aaa1e9a6a9b34ee66a41a7f8bfb8f
|
refs/heads/master
| 2023-03-16T01:41:13.362803 | 2021-03-10T08:38:07 | 2021-03-10T08:38:07 | 118,253,894 | 11 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,037 |
java
|
package com.tenz.hotchpotch.base;
import android.support.annotation.NonNull;
/**
* Author: TenzLiu
* Date: 2018-01-18 23:14
* Description: BaseMvpActivity
*/
public abstract class BaseMvpActivity<P extends BasePresenter, M extends IBaseModel>
extends BaseActivity {
/**
* presenter 具体的presenter由子类确定
*/
protected P mPresenter;
/**
* model 具体的model由子类确定
*/
protected M mModel;
@Override
protected void initData() {
super.initData();
mPresenter = initPresenter();
if(mPresenter != null){
mModel = (M) mPresenter.getModel();
if(mModel != null){
mPresenter.attachMV(mModel,this);
}
}
}
/**
* 初始化presenter
* @return
*/
@NonNull
protected abstract P initPresenter();
@Override
protected void onDestroy() {
super.onDestroy();
if(mPresenter != null){
mPresenter.detachMV();
}
}
}
|
[
"[email protected]"
] | |
6f5c726e74ef811a6e5938ba827a920475cbb553
|
a03f5fe777a5f249b8b6fb3e5bb73f70d1a9924c
|
/server/content/skills/Smithing.java
|
26d5cc3ce30c5bf84ff0e95e1aa31a0f7d1c6241
|
[] |
no_license
|
kingaoro/RSNewSCAPE
|
949411bce9c671013e272683eaea3edce426af67
|
5d648479729f93ec4b870e0b355a8cf4a199d52a
|
refs/heads/master
| 2021-01-10T22:13:29.535046 | 2013-10-17T10:38:02 | 2013-10-17T10:38:12 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 13,667 |
java
|
package server.content.skills;
import core.util.Misc;
import server.Config;
import server.content.quests.misc.Tutorialisland;
import server.content.skills.misc.SkillHandler;
import server.event.CycleEvent;
import server.event.CycleEventContainer;
import server.event.CycleEventHandler;
import server.game.players.Client;
import server.game.players.DialogueHandler;
/**
*
* @author Smelting credits to abyss, Smithing credits to somedude
*
*/
public class Smithing extends SmithingData {
private static int anim = 898, hammer = 2347, eventId = 13;
/**
* Starts Smithing. It is called in many classes to start smithing. Sets the
* ints etc.
*
* @param c
* @param itemId
* @param amount
*/
public static void smithing(final Client c, final int itemId, int amount) {
/*
* Checks if Smithing is enabled or not.
*/
if(!Config.SMITHING_ENABLED) {
c.sendMessage(c.disabled());
return;
}
/*
* Doamount meaning the amount of an item to be smithed.
*/
c.doAmount = amount;
/*
* Loops through the data enum.
*/
for (final data s : data.values()) {
if (itemId == s.getItemId(itemId)) {
Smithbar(c, itemId, s.getReqBar(), s.getBarAmount(itemId),
s.getLvlReq(itemId), s.getXp(itemId));
}
}
}
/**
* Main method.
*
* @param c
* @param itemId
* @param level
* - level requirements
* @param amount
*/
public static void Smithbar(final Client c, final int itemId,
final int reqbar, final int reqbaramount, final int level,
final int XP) {
/*
* If player is already smithing, return.
*/
if (c.playerSkilling[13] == true) {
return;
}
/*
* Checks if the player has a hammer.
*/
if (!c.getItems().playerHasItem(hammer, 1)) {
c.sendMessage("You need a hammer to smith on an anvil.");
return;
}
/*
* Checks if the player has the right level requirements.
*/
if (c.playerLevel[13] < level) {
c.sendMessage("You need a smithing level of " + level
+ " in order to make a "
+ c.getItems().getItemName(itemId).toLowerCase() + ".");
c.getPA().removeAllWindows();
return;
}
/*
* Checks if the player has the required amount of bars to smith
* a item.
*/
if (!c.getItems().playerHasItem(reqbar, reqbaramount)) {
resetSmithing(c);
c.sendMessage("You need at least " + reqbaramount
+ " bars to make a "
+ c.getItems().getItemName(itemId).toLowerCase() + ".");
return;
}
c.playerSkilling[13] = true;
c.stopPlayerSkill = true;
c.getPA().removeAllWindows();
c.startAnimation(anim);
c.getPA().sendSound(468, 100, 1);
if(c.playerRights >= 2)
c.sendMessage("@blu@[DEBUG] " + "Item - " + itemId + " - Level - "
+ level + " - bars - " + reqbaramount + " - XP - " + XP
+ "- Final XP " + XP * c.doAmount * 10);
CycleEventHandler.getSingleton().addEvent(eventId, c, new CycleEvent() {
@Override
/*
* Main cycle event.
* @see server.event.CycleEvent#execute(server.event.CycleEventContainer)
*/
public void execute(CycleEventContainer container) {
if (!c.playerSkilling[13] || c.doAmount == 0
|| !c.stopPlayerSkill) {
resetSmithing(c);
container.stop();
return;
}
if (!c.getItems().playerHasItem(reqbar, reqbaramount)) {
resetSmithing(c);
container.stop();
return;
}
c.getPA()
.addSkillXP(XP * 5, c.playerSmithing);
c.sendMessage(check(c, itemId)
+ c.getItems().getItemName(itemId).toLowerCase() + ".");
c.getItems().deleteItem2(reqbar, reqbaramount);
c.getItems().addItem(itemId, 1);
SkillHandler.deleteTime(c);// deletes the amount todo
}
@Override
public void stop() {
}
}, (int) 5.8);
CycleEventHandler.getSingleton().addEvent(eventId, c, new CycleEvent() {
@Override
// animation/Sound
public void execute(CycleEventContainer container) {
if (!c.playerSkilling[13] || c.doAmount == 0
|| !c.stopPlayerSkill) {
resetSmithing(c);
container.stop();
return;
}
if (!c.getItems().playerHasItem(hammer, 1)) {
c.sendMessage("You need a hammer to smith on an anvil.");
return;
}
if (!c.getItems().playerHasItem(reqbar, reqbaramount)) {
resetSmithing(c);
container.stop();
return;
}
c.startAnimation(anim);
c.getPA().sendSound(468, 100, 1);
}
@Override
public void stop() {
}
}, 5);
}
/************************ SMELTING *******************************/
// Made by abyss, Merged by somedude
private static int COPPER = 436, TIN = 438, IRON = 440, COAL = 453,
MITH = 447, ADDY = 449, RUNE = 451, GOLD = 444, SILVER = 442;
private final static int[] SMELT_FRAME = { 2405, 2406, 2407, 2409, 2410,
2411, 2412, 2413 };
private final static int[] SMELT_BARS = { 2349, 2351, 2355, 2353, 2357,
2359, 2361, 2363 };
/**
* Handles Smelting data.
*/
public static int[][] data1 = {
// index ,lvl required, XP, item required, item2, COAL AMOUNT,
// Final item(BAR)
{ 1, 1, 30, COPPER, TIN, -1, 2349 }, // Bronze
{ 2, 15, 60, IRON, -1, -1, 2351 }, // iron
{ 3, 20, 85, IRON, COAL, 2, 2353 }, // Steel
{ 4, 50, 150, MITH, COAL, 4, 2359 }, // Mith
{ 5, 70, 185, ADDY, COAL, 6, 2361 }, // Addy
{ 6, 85, 250, RUNE, COAL, 8, 2363 }, // Rune
/** ---------------OTHERS------------/ */
{ 7, 20, 65, SILVER, -1, -1, 2355 }, // Silver
{ 8, 40, 110, GOLD, -1, -1, 2357 } // GOLD
};
/**
* Sends the interface
*
* @param c
*/
public static void startSmelting(Client c, int object) {
if(!Config.SMITHING_ENABLED) {
c.sendMessage(c.disabled());
return;
}
for (int j = 0; j < SMELT_FRAME.length; j++) {
c.getPA().sendFrame246(SMELT_FRAME[j], 150, SMELT_BARS[j]);
}
c.getPA().sendFrame164(2400);
c.playerisSmelting = true;
}
/**
* Sets the amount of bars that can be smelted. (EG. 5,10,28 times)
*
* @param c
* @param amount
*/
public static void doAmount(Client c, int amount, int bartype) {
c.doAmount = amount;
smeltBar(c, bartype);
}
/**
* Main method. Smelting
*
* @param c
*/
private static void smeltBar(final Client c, final int bartype) {
for (int i = 0; i < data1.length; i++) {
if (bartype == data1[i][0]) {
if (c.playerLevel[c.playerSmithing] < data1[i][1]) {
DialogueHandler
.sendStatement(c,
"You need a smithing level of at least "
+ data1[i][1]
+ " in order smelt this bar.");
return;
}
if (data1[i][3] > 0 && data1[i][4] > 0) { // All OTHER bars
if (!c.getItems().playerHasItem(data1[i][3])
|| !c.getItems().playerHasItem(data1[i][4])) {
c.sendMessage("You need an "
+ c.getItems().getItemName(data1[i][3])
.toLowerCase()
+ " and "
+ data1[i][5]
+ " "
+ c.getItems().getItemName(data1[i][4])
.toLowerCase() + " to make this bar.");
c.getPA().removeAllWindows();
return;
}
}
if (data1[i][4] < 0) { // Iron bar, Gold & Silver requirements
if (!c.getItems().playerHasItem(data1[i][3])) {
c.sendMessage("You need an "
+ c.getItems().getItemName(data1[i][3])
.toLowerCase() + " to make this bar.");
c.getPA().removeAllWindows();
return;
}
}
if (data1[i][5] > 0) { // Bars with more than 1 coal requirement
if (!c.getItems().playerHasItem(data1[i][4], data1[i][5])) {
c.sendMessage("You need an "
+ c.getItems().getItemName(data1[i][3])
.toLowerCase() + " and " + data1[i][5]
+ " coal ores to make this bar.");
c.getPA().removeAllWindows();
return;
}
}
if (c.playerSkilling[13]) {
return;
}
c.playerSkilling[13] = true;
c.stopPlayerSkill = true;
c.playerSkillProp[13][0] = data1[i][0];// index
c.playerSkillProp[13][1] = data1[i][1];// Level required
c.playerSkillProp[13][2] = data1[i][2];// XP
c.playerSkillProp[13][3] = data1[i][3];// item required
c.playerSkillProp[13][4] = data1[i][4];// item required 2
c.playerSkillProp[13][5] = data1[i][5];// coal amount
c.playerSkillProp[13][6] = data1[i][6];// Final Item
c.getPA().removeAllWindows();
c.startAnimation(899);
c.getPA().sendSound(352, 100, 1);
CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
@Override
public void execute(CycleEventContainer container) {
SkillHandler.deleteTime(c);
if(Misc.random(2) == 0 && c.playerSkillProp[13][0] == 2) {
c.sendMessage("You have failed to refine this ore.");
c.getItems().deleteItem(c.playerSkillProp[13][3], 1);
if(c.doAmount <= 0) {
resetSmithing(c);
container.stop();
}
return;
}
c.getItems().deleteItem(c.playerSkillProp[13][3], 1);
if (c.playerSkillProp[13][5] == -1) {
c.getItems()
.deleteItem(c.playerSkillProp[13][4], 1);
}
if (c.playerSkillProp[13][5] > 0) {// if coal amount is
// >0
c.getItems().deleteItem2(c.playerSkillProp[13][4],
c.playerSkillProp[13][5]);
}
c.sendMessage("You receive an " // Message
+ c.getItems()
.getItemName(c.playerSkillProp[13][6])
.toLowerCase() + ".");
if (c.tutorialprog == 19) {
Tutorialisland.sendDialogue(c, 3062, 0);
}
/*
* / if(bartype == 2 && Misc.random(2) == 0) {
* c.getPA().addSkillXP(c.playerSkillProp[13][2] // XP
* Config.SMITHING_EXPERIENCE, 13);
*
* c.getItems().addItem(c.playerSkillProp[13][6],
* 1);//item return; } /
*/
c.getPA().addSkillXP(c.playerSkillProp[13][2] // XP
, 13);
c.getItems().addItem(c.playerSkillProp[13][6], 1);// item
// ///////////////////////////////CHECKING//////////////////////
if (!c.getItems().playerHasItem(
c.playerSkillProp[13][3], 1)) {
c.sendMessage("You don't have enough ores to continue smelting!");
resetSmithing(c);
container.stop();
}
if (c.playerSkillProp[13][4] > 0) {
if (!c.getItems().playerHasItem(
c.playerSkillProp[13][4], 1)) {
c.sendMessage("You don't have enough ores to continue smelting!");
resetSmithing(c);
container.stop();
}
}
if (c.doAmount <= 0) {
resetSmithing(c);
container.stop();
}
if (!c.playerSkilling[13]) {
resetSmithing(c);
container.stop();
}
if (!c.stopPlayerSkill) {
resetSmithing(c);
container.stop();
}
}
@Override
public void stop() {
}
}, (int) 5.9);
CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {// animation
@Override
public void execute(CycleEventContainer container) {
if (!c.playerSkilling[13]) {
resetSmithing(c);
container.stop();
return;
}
c.startAnimation(899);
c.getPA().sendSound(352, 100, 1);
if (!c.stopPlayerSkill) {
container.stop();
}
}
@Override
public void stop() {
}
}, (int) 5.8);
}
}
}
/**
* Gets the index from DATA for which bar to smelt
*/
public static void getBar(Client c, int i) {
switch (i) {
case 15147: // bronze (1)
doAmount(c, 1, 1);// (c,amount,Index in data)
break;
case 15146: // bronze (5)
doAmount(c, 5, 1);
break;
case 10247: // bronze (10)
doAmount(c, 10, 1);
break;
case 9110:// bronze (X)
doAmount(c, 28, 1);
break;
case 15151: // iron (1)
doAmount(c, 1, 2);
break;
case 15150: // iron (5)
doAmount(c, 5, 2);
break;
case 15149: // iron (10)
doAmount(c, 10, 2);
break;
case 15148:// Iron (X)
doAmount(c, 28, 2);
break;
case 15159: // Steel (1)
doAmount(c, 1, 3);
break;
case 15158: // Steel (5)
doAmount(c, 5, 3);
break;
case 15157: // Steel (10)
doAmount(c, 10, 3);
break;
case 15156:// Steel (X)
doAmount(c, 28, 3);
break;
case 29017: // mith (1)
doAmount(c, 1, 4);
break;
case 29016: // mith (5)
doAmount(c, 5, 4);
break;
case 24253: // mith (10)
doAmount(c, 10, 4);
break;
case 16062:// Mith (X)
doAmount(c, 28, 4);
break;
case 29022: // Addy (1)
doAmount(c, 1, 5);
break;
case 29020: // Addy (5)
doAmount(c, 5, 5);
break;
case 29019: // Addy (10)
doAmount(c, 10, 5);
break;
case 29018:// Addy (X)
doAmount(c, 28, 5);
break;
case 29026: // RUNE (1)
doAmount(c, 1, 6);
break;
case 29025: // RUNE (5)
doAmount(c, 5, 6);
break;
case 29024: // RUNE (10)
doAmount(c, 10, 6);
break;
case 29023:// Rune (X)
doAmount(c, 28, 6);
break;
case 15155:// SILVER (1)
doAmount(c, 1, 7);
break;
case 15154:// SILVER (5)
doAmount(c, 5, 7);
break;
case 15153:// SILVER (10)
doAmount(c, 10, 7);
break;
case 15152:// SILVER (28)
doAmount(c, 28, 7);
break;
case 15163:// Gold (1)
doAmount(c, 1, 8);
break;
case 15162:// Gold (5)
doAmount(c, 5, 8);
break;
case 15161:// Gold (10)
doAmount(c, 10, 8);
break;
case 15160:// Gold (28)
doAmount(c, 28, 8);
break;
}
}
/**
* Reset Smithing.
*
* @param c
*/
public static void resetSmithing(Client c) {
c.startAnimation(65535);
c.playerSkilling[13] = false;
c.stopPlayerSkill = false;
c.playerisSmelting = false;
c.doAmount = 0;
SkillHandler.stopEvents(c, eventId);// STOPS SMITHING EVENT.
for (int i = 0; i < 7; i++) {
c.playerSkillProp[13][i] = -1;
}
}
}
|
[
"[email protected]"
] | |
190c703f7e5901394cd5869c46390b3ff8c4075b
|
837b88320ceec535f2e3cd134b0471f6ba123733
|
/spring-data-jpa-associations/src/main/java/com/bala/model/PublisherEntity.java
|
3eb2f719ce469adb819705b5b0f51906c65b40d1
|
[] |
no_license
|
Balagangadhar/templates
|
0d872605eef2e102c14f283547469eaae903bc69
|
fc1fd5ab6f4b06c3c29121df3357c80d87626026
|
refs/heads/master
| 2021-01-19T01:39:24.346345 | 2016-07-17T09:49:46 | 2016-07-17T09:49:46 | 22,980,114 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,312 |
java
|
package com.bala.model;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Table(name = "PUBLISHER")
public class PublisherEntity {
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
@Column(name = "ID")
private String id;
@Column(name = "NAME")
private String name;
@Column(name = "DESCRIPTION")
private String description;
@OneToMany(fetch = FetchType.EAGER, mappedBy = "publisherEntity")
private Set<BookEntity> books;
public Set<BookEntity> getBooks() {
return books;
}
public void setBooks(Set<BookEntity> books) {
this.books = books;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
|
[
"[email protected]"
] | |
29bc6954769c663d16ed2a9a5f1d097b9e551441
|
fb3e9dbf2c61cbfa98dd3a1005624d1ff8b7cf92
|
/src/model/lectorArchivos.java
|
ced3f167c3ac89a177e61cb0b6f3d2a7bafd2894
|
[] |
no_license
|
milvergithub/SearhText
|
9d57799e5cdcc6d72b0337560ba2c2a4b347feaa
|
cec572c47b85373a732210ab80d822011ee0f2a2
|
refs/heads/master
| 2021-01-10T21:04:08.967515 | 2014-11-05T13:13:43 | 2014-11-05T13:13:43 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,603 |
java
|
package model;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author los Mafios
*/
public class lectorArchivos {
private BufferedReader entrada;
private ArrayList<String> palabras;
//private Set hs;
public lectorArchivos(){
palabras = new ArrayList<String>();
//Set hs = new HashSet();
}
public void leerArchivo(File lectura)throws IOException{
String renglon;
entrada = new BufferedReader(new FileReader(lectura));
String[] cadena;
while ((renglon = entrada.readLine()) != null) {
for (int i = 0; i < renglon.length(); i++) {
//System.out.print(renglon.charAt(i));
}
for (int j = 0; j < darPalabra(renglon).length; j++) {
cadena = darPalabra(renglon);
palabras.add(cadena[j]);
//System.out.println("\n palabras sepoaradas: "+cadena[j]);
}
System.out.println("");
}
}
public String[] darPalabra(String cadena){
String delimitadores= "[ .,;?!¡¿\'\"\\[\\]]+";
String[] palabrasSeparadas = cadena.split(delimitadores);
return palabrasSeparadas;
}
public Integer buscarPalabra(String cadena){
Set hs = new HashSet();
Integer res = 0;
for (int i = 0; i < palabras.size(); i++) {
if (cadena.equals(palabras.get(i))) {
llenarNodo((i+1), hs);
}
//System.out.println("palabras es: "+palabras.get(i));
}
if(hs.size()>0){
res = darNodoMasCercano(hs);
}
return res;
}
private void llenarNodo(int nro, Set hs){
hs.add(nro);
}
private Integer darNodoMasCercano(Set hs){
Integer res;
res = (Integer) Collections.min(hs);
return res;
}
public String darCademas(int nro){
String cadena="";
for (int i = 0; i < nro; i++) {
cadena = cadena +"Raiz => "+ palabras.get(i)+"\n";
}
return cadena;
}
}
|
[
"[email protected]"
] | |
cbde32b06f025b96b3c75dcddb7e5487fe665e09
|
e3d4fdcf8c7bb540e96f7314a40309899e7cccbf
|
/algorithm/recursion/string/LIS.java
|
15721d2e58f3901795f556a2f477c743556477cf
|
[] |
no_license
|
SuhwanJang/ProblemSolving
|
1d23bc917fcddfb62cc498b830d4806263468429
|
bd9e21a551bf1d2fcfe3975e44311aed995f5214
|
refs/heads/master
| 2021-09-23T21:55:14.795413 | 2018-09-28T01:53:21 | 2018-09-28T01:53:21 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 430 |
java
|
package recursion.string;
import java.util.*;
/*
* Longest Increase String
*/
public class LIS {
public static int lis(int[] A)
{
if(A.length==0) return 0;
int ret = 0;
for(int i = 0; i<A.length; i++)
{
int[] B = new int[100];
for(int j = i; j<A.length; j++)
{
if(A[i] < A[j])
B[i] = A[j];
}
ret = Math.max(ret, lis(B));
}
return ret;
}
public static void main(String[] args)
{
}
}
|
[
"[email protected]"
] | |
7ae2908127eba98b31013657f3d2a3f90495d8d7
|
ec3c6535d8b0c6eaee0589b3a1655340a555b924
|
/src/test/java/net/tomp2p/rpc/TestTask.java
|
e5278e494d0bb420acb1b950441d63e1a8e92811
|
[
"Apache-2.0"
] |
permissive
|
andrilareida/TomP2P
|
a97e22a4dc987e1e66d22acb1de5720ac40c7b32
|
6a2a0e8f5e157d46e7e29532a671bfce548237c6
|
refs/heads/master
| 2021-01-23T22:32:31.151662 | 2013-07-28T15:05:36 | 2013-07-28T15:05:36 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 51 |
java
|
package net.tomp2p.rpc;
public class TestTask {
}
|
[
"[email protected]"
] | |
6b53f3fe74d537157ca448e1b789412740c97b21
|
d42fb18c8792ca0567d77473a6fd314fd512a99d
|
/LinearJuntos/app/src/main/java/com/example/mati/linearjuntos/LinearRealtive.java
|
8b06a812d104e92d69a3be3bf3fffc06103996b8
|
[] |
no_license
|
susanajimenez15/PMM
|
1b4f710d3cd6286e40fc5ec668d4d9320867a07c
|
16c94377223add0951f4b51ac7459fb13e0d8069
|
refs/heads/master
| 2021-01-17T16:07:57.835296 | 2017-02-14T07:11:36 | 2017-02-14T07:11:36 | 70,775,748 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 355 |
java
|
package com.example.mati.linearjuntos;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class LinearRealtive extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_linear_realtive);
}
}
|
[
"[email protected]"
] | |
aba50f2cf04d4b30935f81195b9417f1e581c829
|
c226e4cebd6bc36db9217d90f7ea34937a94bbac
|
/app/src/main/java/com/example/funfacts/MainActivity.java
|
9573cd1cf36965d93db1351bb3b219c5ca2c160f
|
[] |
no_license
|
urvi367/FunFacts
|
40748d7ba2d4a0b6c9f8950e3318525900391839
|
a3cbbd4847e7ff322974784fa29c5207d362278a
|
refs/heads/master
| 2020-08-04T14:36:03.395135 | 2019-10-01T18:31:40 | 2019-10-01T18:31:40 | 212,169,685 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,096 |
java
|
package com.example.funfacts;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
TextView t1,t2;
Button b1;
RelativeLayout rv;
facts f=new facts();
bgcolor bg=new bgcolor();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1=(Button)findViewById(R.id.b);
t1=(TextView)findViewById(R.id.t1);
t2=(TextView)findViewById(R.id.t2);
rv=(RelativeLayout)findViewById(R.id.rv);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int x=bg.getbg();
t2.setText(f.getFact());
rv.setBackgroundColor(x);
b1.setTextColor(x);
}
});
}
}
|
[
"Edward367"
] |
Edward367
|
4404139560da34064e0326d4c1d8fa5e42b3e816
|
33a9ce5bfc4af40e8eac0ce2d240353e418a4a30
|
/brave-instrumentation-spring-dubbo/src/main/java/io/zipkin/brave/TraceConfig.java
|
d8cc59d63685ff6ed2a4fb1015a153adea428c0d
|
[] |
no_license
|
xiaoshuaishuai/brave-instrumentation-spring-dubbo
|
6406ab5577a4a004009284ba0886afd66d54e6d3
|
c31611e7235019b5b98d3cd6fe15fd87f3294904
|
refs/heads/master
| 2021-08-31T18:18:06.650593 | 2017-12-22T10:08:49 | 2017-12-22T10:08:49 | 115,102,218 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 581 |
java
|
package io.zipkin.brave;
public class TraceConfig {
private TraceConfigProperties configProperties;
public TraceConfig(TraceConfigProperties configProperties) {
this.configProperties = configProperties;
}
public TraceConfig() {
}
public String getServerName() {
return configProperties.getServerName();
}
public float getRate() {
return configProperties.getRate();
}
public String getEndpoint() {
return configProperties.getEndpoint();
}
@Override
public String toString() {
return "TraceConfig [configProperties=" + configProperties + "]";
}
}
|
[
"[email protected]"
] | |
845419930525305f07e6984e3964ac72e86f6d12
|
4e3ad3a6955fb91d3879cfcce809542b05a1253f
|
/schema/ab-products/common/connectors/src/main/com/archibus/app/common/connectors/impl/archibus/translation/segregate/SegregateByData.java
|
5a40bd346ceb387332dafdb753a7f87b9c173bc2
|
[] |
no_license
|
plusxp/ARCHIBUS_Dev
|
bee2f180c99787a4a80ebf0a9a8b97e7a5666980
|
aca5c269de60b6b84d7871d79ef29ac58f469777
|
refs/heads/master
| 2021-06-14T17:51:37.786570 | 2017-04-07T16:21:24 | 2017-04-07T16:21:24 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,526 |
java
|
package com.archibus.app.common.connectors.impl.archibus.translation.segregate;
import java.text.ParseException;
import java.util.*;
import org.json.JSONObject;
import com.archibus.app.common.connectors.domain.ConnectorFieldConfig;
import com.archibus.app.common.connectors.exception.ConfigurationException;
import com.archibus.datasource.*;
import com.archibus.datasource.data.*;
import com.archibus.datasource.restriction.Restrictions;
/**
* Populates field values on a record using field values from records from a data table.
*
* @author cole
* @since 22.1
*
*/
public class SegregateByData implements ISegregateRule {
/**
* The parameter for the map from field names in the ARCHIBUS table to fields on the transaction
* record for fields that should match.
*/
private static final String RESTRICTION_PARAM = "restrictionMap";
/**
* The parameter for the map from field names on the ARCHIBUS table to fields on the transaction
* record for fields that should be set.
*/
private static final String VALUE_PARAM = "valueMap";
/**
* The name of the data table.
*/
private String tableName;
/**
* The list of fields on the table involved either in a restriction or an assignment.
*/
private String[] fieldNames;
/**
* The map from field names in the data table to fields on the transaction record for fields
* that should match.
*/
private JSONObject restrictionMapping;
/**
* The map from field names on the data table to fields on the transaction record for fields
* that should be set.
*/
private JSONObject fieldMapping;
@Override
public void init(final ConnectorFieldConfig connectorField) throws ConfigurationException {
JSONObject parameters;
try {
parameters = new JSONObject(connectorField.getParameter());
} catch (final ParseException e) {
throw new ConfigurationException("Unable to parse parameter for "
+ connectorField.getFieldId(), e);
}
this.tableName = connectorField.getValidateTbl();
this.restrictionMapping = parameters.getJSONObject(RESTRICTION_PARAM);
this.fieldMapping = parameters.getJSONObject(VALUE_PARAM);
final Set<String> fieldNameSet = new HashSet<String>();
final Iterator<String> restrictionMappingKeys = this.restrictionMapping.keys();
while (restrictionMappingKeys.hasNext()) {
fieldNameSet.add(this.restrictionMapping.getString(restrictionMappingKeys.next()));
}
final Iterator<String> fieldMappingKeys = this.fieldMapping.keys();
while (fieldMappingKeys.hasNext()) {
fieldNameSet.add(this.fieldMapping.getString(fieldMappingKeys.next()));
}
this.fieldNames = fieldNameSet.toArray(new String[fieldNameSet.size()]);
}
/**
* @return false, since this sets the value of one or more fields based on something other than
* data.
*/
@Override
public boolean requiresExistingValue() {
return false;
}
@Override
public List<Map<String, Object>> segregate(final Map<String, Object> record) {
final DataSource dataSource =
DataSourceFactory.createDataSourceForFields(this.tableName, this.fieldNames);
final Iterator<String> restrictionFields = this.restrictionMapping.keys();
while (restrictionFields.hasNext()) {
final String fieldKey = restrictionFields.next();
final Object sourceValue = record.get(this.restrictionMapping.get(fieldKey));
if (sourceValue == null) {
dataSource.addRestriction(Restrictions.isNull(this.tableName, fieldKey));
} else {
dataSource.addRestriction(Restrictions.eq(this.tableName, fieldKey, sourceValue));
}
}
final List<Map<String, Object>> records = new ArrayList<Map<String, Object>>();
for (final DataRecord dataRecord : dataSource.getRecords()) {
final List<DataValue> fieldValues = dataRecord.getFields();
for (final DataValue fieldValue : fieldValues) {
if (this.fieldMapping.has(fieldValue.getName())) {
record.put(this.fieldMapping.getString(fieldValue.getName()),
fieldValue.getValue());
}
}
records.add(record);
}
return records;
}
}
|
[
"[email protected]"
] | |
31dc58bab6751e7a47910df8068db9d0349f671d
|
e5cb0c7ef7388e014077b081eb10687ac26e4a87
|
/dbVendor/src/main/java/ro/db/vendor/service/VendorDaysOffServiceImpl.java
|
38ac364a22fe9c52a11caf9b300e5fa851264ee1
|
[] |
no_license
|
andreeaadm1408/dbVendor
|
1b7ceca5d0c35aa4867085e9f9c9f3c53bf32318
|
91fde18186eb2dab9c16987cba0d6b873d153bea
|
refs/heads/master
| 2020-03-11T08:56:08.110036 | 2018-05-24T10:32:34 | 2018-05-24T10:32:34 | 129,896,448 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,321 |
java
|
package ro.db.vendor.service;
import java.util.Optional;
import org.springframework.stereotype.Service;
import ro.db.vendor.domain.VendorDaysOff;
import ro.db.vendor.domain.Vendors;
import ro.db.vendor.repository.VendorDaysOffRepository;
import ro.db.vendor.repository.VendorRepository;
@Service
public class VendorDaysOffServiceImpl implements VendorDaysOffService{
private VendorDaysOffRepository vendorDaysOffRepository;
private VendorRepository vendorRepository;
public VendorDaysOffServiceImpl(
VendorDaysOffRepository vendorDaysOffRepository,
VendorRepository vendorRepository) {
this.vendorDaysOffRepository = vendorDaysOffRepository;
this.vendorRepository = vendorRepository;
}
@Override
public VendorDaysOff updateDays(VendorDaysOff vendorDaysOff) {
return vendorDaysOffRepository.save(vendorDaysOff);
}
@Override
public VendorDaysOff findByVendorId(Vendors vendor) {
return vendorDaysOffRepository.findByVendorsByIdVendor(vendor);
}
@Override
public int vendorDaysOffRemaining(int vendorId) {
Optional<Vendors> vendor = vendorRepository.findById(vendorId);
VendorDaysOff vendorDaysOff = vendorDaysOffRepository.findByVendorsByIdVendor(vendor.get());
return vendorDaysOff.getCurentDaysOff();
}
}
|
[
"[email protected]"
] | |
072ab20eb3be206eca1574db217df5dc1c166287
|
0981457891784cec46aa75880f2774bd332c55b7
|
/src/main/java/edu/fit/brees/ego/util/Visualize.java
|
ba5d15d673202f80900f4c56e1d59f1e20e63e58
|
[
"Apache-2.0"
] |
permissive
|
anirband/FastEgoClustering
|
de193f885f06562ee041241e8887b1662be7452f
|
9ad979d6a0c31aae5c0c63de1caa9cf3a0227e33
|
refs/heads/master
| 2021-04-03T09:56:54.069653 | 2014-11-27T18:02:35 | 2014-11-27T18:02:35 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,887 |
java
|
/*
*
* Copyright 2014 Bradley S. Rees
*
* 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 edu.fit.brees.ego.util;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Paint;
import javax.swing.JFrame;
import org.apache.commons.collections15.Transformer;
import edu.fit.brees.ego.jung.JungEdge;
import edu.fit.brees.ego.jung.JungNetwork;
import edu.fit.brees.ego.jung.JungVertex;
import edu.uci.ics.jung.algorithms.layout.CircleLayout;
import edu.uci.ics.jung.algorithms.layout.DAGLayout;
import edu.uci.ics.jung.algorithms.layout.FRLayout;
import edu.uci.ics.jung.algorithms.layout.ISOMLayout;
import edu.uci.ics.jung.algorithms.layout.KKLayout;
import edu.uci.ics.jung.algorithms.layout.Layout;
import edu.uci.ics.jung.algorithms.layout.SpringLayout;
import edu.uci.ics.jung.algorithms.layout.SpringLayout2;
import edu.uci.ics.jung.visualization.BasicVisualizationServer;
import edu.uci.ics.jung.visualization.control.LayoutScalingControl;
import edu.uci.ics.jung.visualization.decorators.ToStringLabeller;
import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position;
public class Visualize
{
public static final int CIRCLE = 0;
public static final int SPRING = 1;
public static final int FR = 2;
public static final int ISOM = 3;
public static final int DAG = 4;
public static final int SPRING2 = 5;
public static final int[] colors = {
0xffffff, // white
0xff0000, // red
0x00ff00, // lime
0x0000ff, // blue
0xffff00, // yellow
0x00FFFF, // cyan
0xFF00FF, // megenta
0xC0C0C0, // silver
0x808080, // gray
0x800000, // maroon
0xFF7F50, // coral
0x808000, // olive
0x008000, // green
0xFFA500, // orange
0x800080, // purple
0x008080, // teal
0x98FB98, // pale green
0x000080, // navy
0x87CEFA // light sky blue
};
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void visualize(JungNetwork graph, String title, int type)
{
// The Layout<V, E> is parameterized by the vertex and edge types
Layout<JungVertex, JungEdge> layout = null;
switch (type)
{
case CIRCLE:
layout = new CircleLayout<JungVertex, JungEdge>(graph);
break;
case SPRING:
layout = new SpringLayout<JungVertex, JungEdge>(graph);
break;
case FR:
layout = new FRLayout<JungVertex, JungEdge>(graph);
break;
case ISOM:
layout = new ISOMLayout<JungVertex, JungEdge>(graph);
break;
case DAG:
layout = new DAGLayout<JungVertex, JungEdge>(graph);
break;
case SPRING2:
layout = new SpringLayout2<JungVertex, JungEdge>(graph);
break;
default:
layout = new KKLayout<JungVertex, JungEdge>(graph);
}
layout.setSize(new Dimension(800,800)); // sets the initial size of the space
// The BasicVisualizationServer<V,E> is parameterized by the edge types
BasicVisualizationServer<JungVertex,JungEdge> vv =
new BasicVisualizationServer<JungVertex,JungEdge>(layout);
vv.setPreferredSize(new Dimension(900,900)); //Sets the viewing area size
vv.scaleToLayout(new LayoutScalingControl() );
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
JFrame frame = new JFrame(title);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(vv);
frame.pack();
frame.setVisible(true);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void visualizeColor(JungNetwork graph, String title, int type)
{
// Painter
Transformer<JungVertex,Paint> vertexPaint = new Transformer<JungVertex,Paint>()
{
public Paint transform(JungVertex i)
{
int size = colors.length;
int colorIdx = i.getTag() % size;
//System.out.println("Tag " + i.getTag() + " is color " + color);
Color color = new Color(colors[colorIdx]);
int red = color.getRed();
int green = color.getGreen();
int blue = color.getBlue();
red = green = blue = (int) (red *0.299 + green * 0.587 + blue * 0.114);
return color;
//return new Color(red, green, blue);
}
};
Transformer <JungVertex, String> vertexLable = new Transformer<JungVertex, String>()
{
public String transform(JungVertex v) {
return (new String( " " +v.getId()) );
}
};
// The Layout<V, E> is parameterized by the vertex and edge types
Layout<JungVertex, JungEdge> layout = null;
switch (type)
{
case CIRCLE:
layout = new CircleLayout<>(graph);
break;
case SPRING:
layout = new SpringLayout<>(graph);
break;
case FR:
layout = new FRLayout<>(graph);
break;
case ISOM:
layout = new ISOMLayout<>(graph);
break;
case DAG:
layout = new DAGLayout<>(graph);
break;
case SPRING2:
layout = new SpringLayout2<>(graph);
break;
default:
layout = new KKLayout<>(graph);
}
layout.setSize(new Dimension(1200,1200)); // sets the initial size of the space
// The BasicVisualizationServer<V,E> is parameterized by the edge types
BasicVisualizationServer<JungVertex, JungEdge> vv = new BasicVisualizationServer<>(layout);
vv.setPreferredSize(new Dimension(1000,1000)); //Sets the viewing area size
vv.scaleToLayout(new LayoutScalingControl() );
vv.getRenderContext().setVertexLabelTransformer(vertexLable);
vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
JFrame frame = new JFrame(title);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(vv);
frame.pack();
frame.setVisible(true);
}
}
|
[
"[email protected]"
] | |
086238b76f8721093c73fb758e6a2d7d9837d79f
|
8649edb1ca2978c2e8be5595ba2bc964335a0402
|
/boot-common/src/main/java/com/jian/util/FileUtil.java
|
12c78f2f3e03bb5e7cb391640f0839fcfa3c7f73
|
[] |
no_license
|
JianLinWei1/boot-parent
|
39f006d8e1ca61b167bc10c116097749f5f84c87
|
7c730ece1c852db58172602a01d92c8cb9c25386
|
refs/heads/master
| 2022-07-06T16:23:54.243691 | 2019-08-07T03:47:29 | 2019-08-07T03:47:29 | 163,177,323 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,726 |
java
|
package com.jian.util;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Base64;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.ResourceUtils;
public class FileUtil {
static Logger logger = LoggerFactory.getLogger(FileUtil.class);
/**
* 获取文件夹路径
* @Title: getMidkirs
* @Description: TODO
* @param: @param path
* @param: @return
* @param: @throws FileNotFoundException
* @author: JianLinWei
* @return: String
* @throws
*/
public static String getMidkirs(String path) throws FileNotFoundException{
File file;
try{
// file =new File(ResourceUtils.getFile("classpath:").getPath() +"/" +path) ;
file = new File("D:/upload/"+path);
if(!file.exists())
file.mkdirs();
return file.getPath();
}catch(Exception e){
logger.debug("获取文件目录:"+e.getMessage());
file = new File(System.getProperty("user.dir")+"/"+path);
if(!file.exists())
file.mkdirs();
return file.getPath();
}
}
/**
* @throws IOException
* @throws FileNotFoundException
* 添加照片到文件夹
* @Title: addPicture2Midkirs
* @Description: TODO
* @param: @param file
* @param: @param name
* @param: @param path 方便不同的数据分开文件夹存放
* @param: @return
* @author: JianLinWei
* @return: String
* @throws
*/
public static String addPicture2Midkirs(byte[] pic , String name , String path ) throws IOException{
name = name+"_"+UuidUtil.getUUID()+".jpg";
path = getMidkirs(path);
File file = new File(path+"/"+name);
if(!file.exists())
file.createNewFile();
OutputStream outputStream = new FileOutputStream(file);
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream);
bufferedOutputStream.write(pic);
return name;
}
/**
* @throws IOException
* 从文件夹获取照片
* @Title: getPicture2Byte
* @Description: TODO
* @param: @param filename
* @param: @param path
* @param: @return
* @author: JianLinWei
* @return: byte[]
* @throws
*/
public static byte[] getPicture2Byte(String filename , String path) throws IOException{
path = getMidkirs(path) +"/"+ filename;
File file = new File(path);
if(file.exists()){
InputStream inputStream = new FileInputStream(file);
byte[] buf = new byte[inputStream.available()];
inputStream.read(buf);
return buf;
}
return null;
}
/**
*
* @Title: Base642Byte
* @Description: TODO
* @param: @param base64
* @param: @return
* @author: JianLinWei
* @return: byte[]
* @throws
*/
public static byte[] Base642Byte(String base64){
base64 = base64.replaceAll("[\\s*\t\n\r]", "");
Base64.Decoder decoder = Base64.getDecoder();
if(StringUtils.isNotEmpty(base64))
return decoder.decode(base64);
return null;
}
/**
*
* @Title: img_base64_head
* @Description: TODO
* @param: @param base
* @param: @return
* @author: JianLinWei
* @return: String
* @throws
*/
public static String img_base64_head(byte[] base){
Base64.Encoder encoder = Base64.getEncoder();
if(base != null)
return "data:image/jpeg;base64," + encoder.encodeToString(base) ;
return null;
}
}
|
[
"[email protected]"
] | |
15b03be5b489f922f18c2e81a5ad274769775663
|
6a1cc7913fdc96b201d6056e77b4625c0c8c8cf3
|
/src/main/java/com/dongnaoedu/vip/shiro/entity/Result.java
|
e853cd1b30cee23965ca70ae52fede7f73106a59
|
[] |
no_license
|
MasterPXu/GC
|
17a9df5da989bbbfca43151fadb5a5b314edbc57
|
60e6ee6f8f210bca532cce667d908991e3c15238
|
refs/heads/master
| 2021-10-28T11:37:38.118176 | 2019-03-24T04:09:11 | 2019-03-24T04:09:11 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,103 |
java
|
package com.dongnaoedu.vip.shiro.entity;
import java.io.Serializable;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
public class Result implements Serializable {
private long id;
private String taskInfo;
private String taskResult;
private String phoneNumber;
private long replyTime;
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒
public String time;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getTaskInfo() {
return taskInfo;
}
public void setTaskInfo(String taskInfo) {
this.taskInfo = taskInfo;
}
public String getTaskResult() {
return taskResult;
}
public void setTaskResult(String taskResult) {
this.taskResult = taskResult;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public long getReplyTime() {
return replyTime;
}
public void setReplyTime(long replyTime) {
time = df.format(replyTime*1000);
this.replyTime = replyTime;
}
}
|
[
"[email protected]"
] | |
4a25d9f4c7806eab469cb3b8f3b09a86a786e2e5
|
17dab2961ba7d63ff96467e64a2736b0d11fe9f5
|
/src/main/java/com/java/spring/ipldashboard/data/MatchDataInput.java
|
c57e6fafb305c14f0e8b99827083d09d5ed86477
|
[] |
no_license
|
abhilash28abhi/ipl-dashboard
|
306fb64a87bd62627f7d872078416824c62faaae
|
e2251f11c1245a71c59344d2c19c0dca02945b62
|
refs/heads/main
| 2023-04-30T03:03:51.112097 | 2021-05-24T14:22:01 | 2021-05-24T14:22:01 | 369,738,102 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 631 |
java
|
package com.java.spring.ipldashboard.data;
import lombok.Data;
/**
* Input CSV file fields POJO
*/
@Data
public class MatchDataInput {
private String id;
private String city;
private String date;
private String player_of_match;
private String venue;
private String neutral_venue;
private String team1;
private String team2;
private String toss_winner;
private String toss_decision;
private String winner;
private String result;
private String result_margin;
private String eliminator;
private String method;
private String umpire1;
private String umpire2;
}
|
[
"[email protected]"
] | |
331bca0f89b1d398916253af341dcee0ad00437c
|
0f64ae0f9f66cc891481352fdacece3456755762
|
/easymqtt4j-jaas-plugins/src/main/java/com/github/zengfr/easymqtt4j/plugins/jaas/JaasAbstractLoginModule.java
|
b9a50573198ad8c15fe6556b69972c47b82053e3
|
[
"Apache-2.0"
] |
permissive
|
xfyecn/easymqtt4j
|
5326ff8c901e238ced7c41d627a905722a1f5d63
|
1537978dea5d089854689335e2db2e48ce8183d7
|
refs/heads/master
| 2022-09-25T13:52:55.404329 | 2020-06-04T10:13:11 | 2020-06-08T06:09:12 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,362 |
java
|
package com.github.zengfr.easymqtt4j.plugins.jaas;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.security.auth.Subject;
import javax.security.auth.callback.*;
import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.*;
/**
* Created by zengfr on 2020/6/5.
*/
public abstract class JaasAbstractLoginModule implements LoginModule {
public class Context {
public boolean loginSuccess = false;
public String userName;
public Set<String> roles = new HashSet<>();
public Set<String> groups = new HashSet<>();
}
protected static final Logger log = LoggerFactory.getLogger(JaasAbstractLoginModule.class);
private static int userNameMinLength = 6;
private static int userMaxTimes = 3;
private static Map<String, Long> times = new HashMap<>();
private CallbackHandler callbackHandler;
private Map sharedState;
private Map options;
private Subject subject;
private boolean debug;
private Context context;
public JaasAbstractLoginModule() {
context = new Context();
}
protected abstract void init(boolean debug, Map<String, ?> options);
protected abstract String getUserPassword(String userName);
protected abstract Set<String> getUserRoles(String userName);
protected abstract Set<String> getUserGroups(String userName);
protected abstract boolean commitPrincipals(Subject subject, Context context);
@Override
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
this.callbackHandler = callbackHandler;
this.subject = subject;
this.sharedState = sharedState;
this.options = options;
if (options.containsKey("debug")) {
debug = "true".equalsIgnoreCase((String) options.get("debug"));
}
this.init(debug, this.options);
}
@Override
public boolean login() throws LoginException {
boolean result = false;
Context c = context;
c.loginSuccess = result;
Callback[] callbacks = new Callback[]{new NameCallback("username:"), new PasswordCallback("password:", false)};
try {
this.callbackHandler.handle(callbacks);
String userName = ((NameCallback) callbacks[0]).getName();
char[] password = ((PasswordCallback) callbacks[1]).getPassword();
c.userName = userName;
if (this.validateUserName(userName) && password != null && password.length > 0) {
if (this.checkTimesOK(userName)) {
String password2 = getUserPassword(userName);
result = this.validatePassword(password, password2);
}
}
log.debug(String.format("login:%s,%s", userName, result));
} catch (IOException ex1) {
throw new LoginException(ex1.getMessage());
} catch (UnsupportedCallbackException ex2) {
throw new LoginException(ex2.getMessage());
}
c.loginSuccess = result;
return result;
}
@Override
public boolean commit() throws LoginException {
Context c = context;
boolean result = c.loginSuccess;
try {
if (result) {
String userName = c.userName;
if (this.validateUserName(userName)) {
this.commitPrincipals(subject, c);
}
}
} catch (Exception ex) {
log.error("", ex);
}
return true;
}
@Override
public boolean abort() throws LoginException {
this.logout();
return true;
}
@Override
public boolean logout() throws LoginException {
Context c = context;
c.loginSuccess = false;
subject.getPrincipals().clear();
times.put(c.userName, 0L);
return true;
}
private static boolean checkTimesOK(String userName) {
Long time = times.getOrDefault(userName, 0L);
times.put(userName, ++time);
return time <= userMaxTimes;
}
protected static boolean validateUserName(String userName) {
return userName != null && userName.length() >= userNameMinLength;
}
private static boolean validatePassword(char[] password, String password2) {
return password != null && password2 != null && password2.equalsIgnoreCase(new String(password));
}
protected static void loadProp(Properties prop, String fileName) {
try {
FileInputStream fis = new FileInputStream(fileName);
prop.load(fis);
} catch (FileNotFoundException e) {
log.error("", e);
} catch (IOException e) {
log.error("", e);
}
}
protected static void storeProp(Properties prop, String fileName) {
try {
FileOutputStream fos = new FileOutputStream(fileName);
prop.store(fos, JaasAbstractLoginModule.class.getName());
} catch (FileNotFoundException e) {
log.error("", e);
} catch (IOException e) {
log.error("", e);
}
}
}
|
[
"[email protected]"
] | |
9c77fc951883b916a67c9fad6ec24d71eec90e8c
|
d5fe5c5d6c5242edfb5f6dc2ad5e3b178967ef7a
|
/src/main/java/com/eldarian/solvdelivery/model/staff/delivery/FootCourier.java
|
ad371ee8876d51f1d897643030707eb9a8914169
|
[] |
no_license
|
Eldarian/solvd-laba-maven
|
14f72560cf716fd70318f9661273502f6acaf059
|
e2c4af4777948b1465df3550e47388f6a6ad24c3
|
refs/heads/master
| 2023-07-12T02:05:59.745538 | 2021-08-06T09:30:07 | 2021-08-06T09:30:07 | 387,830,809 | 0 | 0 | null | 2021-08-06T09:30:08 | 2021-07-20T15:11:22 |
Java
|
UTF-8
|
Java
| false | false | 559 |
java
|
package com.eldarian.solvdelivery.model.staff.delivery;
import com.eldarian.solvdelivery.model.order.Order;
public class FootCourier extends Courier {
public FootCourier() {
super();
}
public FootCourier(String name) {
super(name);
}
@Override
public void deliverOrder(Order order) {
System.out.println("An order " + order + " has been delivered by " + getName() + " by foot");
}
@Override
public String toString() {
return super.toString() + ", foot";
}
}
|
[
"[email protected]"
] | |
406f6a644cc42be1668b9462cb30b2f7f857eb9e
|
dac95999770ffb7e6f65fb1dd1aec010d2c26d2a
|
/HotelSystem_server/src/PO/HotelPO.java
|
a800b3c7944bb45d75456ce198a62fb03b15593d
|
[] |
no_license
|
WilliamLeaves/HotelSystem
|
58771e736db5861305bfe16c3a097faa1d296a20
|
d04c62d95e91741ed3d4c16cc065caf241a220f7
|
refs/heads/master
| 2020-06-11T22:27:35.827786 | 2016-12-09T01:34:51 | 2016-12-09T01:34:51 | 75,617,115 | 1 | 0 | null | 2016-12-09T00:42:39 | 2016-12-05T11:09:42 |
Java
|
GB18030
|
Java
| false | false | 1,232 |
java
|
package PO;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="hotel")
public class HotelPO {
/*
* hotelId酒店的id
* hotelStaffId 酒店工作人员的id
* hotelStrict 酒店的商圈地址
*/
private String hotelId;
private String hotelStaffId;
private String hotelStrict;
private String hotelName;
//Hotel的构造方法
public HotelPO(){}
public HotelPO(String hid,String hsid,String hstri,String hotelname){
super();
this.hotelId = hid;
this.hotelStaffId = hsid;
this.hotelStrict = hstri;
this.hotelName = hotelname;
}
//属性的get和set方法
@Id
public String getHotelId() {
return hotelId;
}
public void setHotelId(String hotelId) {
this.hotelId = hotelId;
}
public String getHotelStaffId() {
return hotelStaffId;
}
public void setHotelStaffId(String hotelStaffId) {
this.hotelStaffId = hotelStaffId;
}
public String getHotelStrict() {
return hotelStrict;
}
public void setHotelStrict(String hotelStrict) {
this.hotelStrict = hotelStrict;
}
public String getHotelName() {
return hotelName;
}
public void setHotelName(String hotelName) {
this.hotelName = hotelName;
}
}
|
[
"[email protected]"
] | |
b22686413915c01a9f0396b7cd4caeb8fdd1c789
|
88f8c004361344cd0916de0c210412e3e4c69677
|
/APCompSci/src/chapter4/StringStuff.java
|
5271b815d57bc8a564597c9f1738b052fbaf8b26
|
[] |
no_license
|
SevereMascara/myfirst2
|
1c644ecbe750c397feaf7978aae37e28a76e50f3
|
0bd4f0040b5dc2dbf23b161fd2833f99a5b0db83
|
refs/heads/master
| 2020-03-29T23:14:38.433281 | 2018-10-04T17:52:46 | 2018-10-04T17:52:46 | 150,463,371 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 445 |
java
|
package chapter4;
public class StringStuff {
/**
* @param args
*/
public static void main(String[] args) {
String quote = "bigly";
System.out.println(quote.charAt(0));
String quote1 = "bigly";
System.out.println(quote1.charAt(4));
String quote2 = "bigly";
quote2 = quote2.substring(1,5);
System.out.println(quote2);
String quote3 = "bigly";
quote3 = quote3.substring(0,4);
System.out.println(quote3);
}
}
|
[
"[email protected]"
] | |
04380c94750d7dd9fbbcb0ee3718b4f88aef60c5
|
74b7ff2c5af48544aa062f5cb4cbe7bf628da969
|
/app/src/main/java/com/cracky_axe/pxohlqo/xihudewater/model/net/MyAppGlideModule.java
|
9916efe9c0af1cb7a782bf45c0fd66c1494a2c88
|
[] |
no_license
|
pxohlqo/XiHuDeWater
|
c357e1e5611fa40f8a78808aa810f65eb41b312b
|
e970064372282e99d6ddeacab0867f9a0f88fdfb
|
refs/heads/master
| 2020-03-09T15:46:33.757798 | 2018-04-10T03:24:02 | 2018-04-10T03:24:02 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 225 |
java
|
package com.cracky_axe.pxohlqo.xihudewater.model.net;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
@GlideModule
public class MyAppGlideModule extends AppGlideModule {
}
|
[
"[email protected]"
] | |
9485219814e599cb5f7339c831786b6979c9ba69
|
c17d5697dc0334c20040711a0dbbb3bd62bf5267
|
/backend/digitalhouse-pi/src/test/java/com/pi/dh/DigitalhousePiApplicationTests.java
|
707bfc70af4dc09d768ba88312c701d00e47f11c
|
[] |
no_license
|
SouzaSA/PI-DH-T4-G4
|
66f3d2d8649e4d68db25de9bd61f6401070afd08
|
552b08c01581e961670d2e21d5ddb821f95f2bdd
|
refs/heads/master
| 2023-01-24T21:24:06.363879 | 2020-12-03T20:37:48 | 2020-12-03T20:37:48 | 294,240,003 | 2 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 209 |
java
|
package com.pi.dh;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DigitalhousePiApplicationTests {
@Test
void contextLoads() {
}
}
|
[
"[email protected]"
] | |
99fa3be483c58ffb5db883ed95768c3c595381d3
|
8c994ce51119ed095038b34c21cc6cde5993d70a
|
/Esercizio3.java
|
f39dc5994255a2ba1dc2cdded7826171446429f0
|
[] |
no_license
|
joker92/java
|
f0350a9f91832a28fd3db21658a82d2ea93351e3
|
531c89a63778ef943111c7080b3f901ab340c9a6
|
refs/heads/master
| 2021-01-18T23:50:59.058593 | 2016-07-06T13:29:07 | 2016-07-06T13:29:07 | 51,456,640 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 487 |
java
|
import java.util.Scanner;
// esercizio che fa la media tra i numeri insercizio
public class Esercizio3{
public static void main (String [] args)
{
Scanner tastiera=new Scanner(System.in);
System.out.println("primo numero");
int primo=tastiera.nextInt();
System.out.println("secondo numero ");
int secondo=tastiera.nextInt();
System.out.println("terzo numero ");
int terzo=tastiera.nextInt();
System.out.println ((primo+secondo+terzo)/3);
}
}
|
[
"[email protected]"
] | |
64eda79297c8d696ea59e46160024987eddb2602
|
af828dda5676ebeb2021e28756bc058e5b2feb76
|
/SimonPresupuesto/src/main/java/es/albarregas/seguromvc/controllers/TipoEleccion.java
|
37617c949be044072a11e05085ca1077f965cdbd
|
[] |
no_license
|
TMLKrew/SimonPresupuesto
|
d5e624141dedbd2b73392efda056fbeb42a5397f
|
59d6e615b1d0b3429b97544c4e5af6975f357e3c
|
refs/heads/master
| 2021-05-08T02:05:48.347780 | 2017-11-20T19:42:19 | 2017-11-20T19:42:19 | 107,958,200 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,665 |
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 es.albarregas.seguromvc.controllers;
import es.albarregas.seguromvc.beans.Eleccion;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.beanutils.BeanUtils;
/**
*
* @author Simon
*/
@WebServlet(name = "eleccion", urlPatterns = {"/eleccion"})
public class TipoEleccion extends HttpServlet {
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession sesion = request.getSession();
Eleccion eleccion = new Eleccion();
String ruta = "";
ruta = request.getHeader("Referer");
sesion.setAttribute("ruta", ruta);
try {
BeanUtils.populate(eleccion, request.getParameterMap());
} catch (IllegalAccessException | InvocationTargetException ex) {
Logger.getLogger(TipoEleccion.class.getName()).log(Level.SEVERE, null, ex);
}
String url = "";
int ultimo = request.getHeader("referer").lastIndexOf("/");
int anterior = request.getHeader("referer").lastIndexOf("/", ultimo - 1);
String directorio = request.getHeader("referer").substring(anterior, ultimo);
if (eleccion.getEdificio() == null && eleccion.getContenido() == null) {
if (ruta.lastIndexOf("jspEstandar") != -1) {
url = "/jsp/jspEstandar/index.jsp";
} else {
url = "/jsp/jspLE/index.jsp";
}
} else {
sesion.setAttribute("eleccion", eleccion);
if (eleccion.getEdificio() != null) {
if (ruta.lastIndexOf("jspEstandar") != -1) {
url = "/jsp/jspEstandar/edificio.jsp";
} else {
url = "/jsp/jspLE/edificio.jsp";
}
} else {
if (ruta.lastIndexOf("jspEstandar") != -1) {
url = "/jsp/jspEstandar/contenido.jsp";
} else {
url = "/jsp/jspLE/contenido.jsp";
}
}
}
request.getRequestDispatcher(url).forward(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
|
[
"[email protected]"
] | |
feed16de2a48d8713647abf7c772e34f0b04b7ef
|
9f928c9fb354959d88c209536596827151db8bfb
|
/app/src/main/java/Graph_Project/Friend.java
|
0738eeed59cfee063d428665427d12834f7ab263
|
[
"MIT"
] |
permissive
|
davemcdonald617/Graph_Project
|
3b70a08fc04e30a35b5dff0fe6b8cc3a095ec242
|
7cae90e2dee853dca4149770e80c3b0459581817
|
refs/heads/main
| 2023-03-25T15:20:41.954290 | 2021-03-22T02:25:18 | 2021-03-22T02:25:18 | 349,757,163 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 208 |
java
|
package Graph_Project;
public class Friend extends BinaryRelation{
public Friend(String relation) {
super();
}
public void accept(Visitor visitor){
visitor.visit(this);
}
}
|
[
"[email protected]"
] | |
a22cc85d45d6a3c5d083a610b9b71caa52da635f
|
8e0a2492af47cf15872c0061c9a1f58ca3761e88
|
/src/main/java/com/xq/sonarqubedemo/SonarqubeDemoApplication.java
|
4ffa91b0d25d83cc922c338f064f63919b370c31
|
[
"MIT"
] |
permissive
|
xqpractice/sonarqube-demo
|
e4c10419049a758ecdf88eccc171cc6f0149b369
|
056e70bf4cef7224b0d46e8f9a3c6b9c65baf27f
|
refs/heads/master
| 2020-07-16T20:35:42.128953 | 2019-09-12T08:05:17 | 2019-09-12T08:05:17 | 205,863,430 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 327 |
java
|
package com.xq.sonarqubedemo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SonarqubeDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SonarqubeDemoApplication.class, args);
}
}
|
[
"[email protected]"
] | |
807d36282d602a11844af4e51a7dc9f99660c5b6
|
c79074c8d14574bace8d724b8cb04d33e7b0c32e
|
/Java/ledrgbminim/src/br/com/oslunaticos/player/BeatMsg.java
|
b35a75fc7cdea356cfb48123ba9f270050559f77
|
[] |
no_license
|
edufolly/led-rgb-minim
|
9fae4799e60d448a7df04729de606f083add9aab
|
677653a6945704d79d0d608422c2de85a4c437ff
|
refs/heads/master
| 2021-01-19T03:18:35.759279 | 2012-11-30T18:46:51 | 2012-11-30T18:46:51 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 238 |
java
|
package br.com.oslunaticos.player;
/**
*
* @author Eduardo Folly
*/
public interface BeatMsg {
public void colorFade(float r, float g, float b);
public void playing();
public void stoped();
public void paused();
}
|
[
"[email protected]"
] | |
25e5074714e74f227acc2e8daa9fc4f629e84d75
|
67ead7bc76ad7f1aa38c1adb5f139b7cc6be8a13
|
/src/main/java/com/cr/io/ByteBufferUsage.java
|
ad2540f4223c650a47a0c625121526966693aeff
|
[] |
no_license
|
dlinka/fjava
|
8a309111673f04a6f8d2d8ed8ba9dc046fa2c9c9
|
86598f3ea8905b9cd166410444a1fd7067af2e5b
|
refs/heads/master
| 2023-03-18T06:13:49.103668 | 2021-03-11T09:00:38 | 2021-03-11T09:00:38 | 255,236,295 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,597 |
java
|
package com.cr.io;
import java.nio.ByteBuffer;
public class ByteBufferUsage {
//初始化
private static void init() {
ByteBuffer bb1 = ByteBuffer.allocate(10);
byte[] arr = new byte[10];
ByteBuffer bb2 = ByteBuffer.wrap(arr);
}
private static void flip(){
ByteBuffer buffer = ByteBuffer.allocate(10);
buffer.putInt(10);
System.out.println(buffer.position()); //4
System.out.println(buffer.limit()); //10
//limit等于4,position等于0
//这里就看出来limit的作用:如果想读取已经写入的数据,就需要一个标识去标识数据的结尾
buffer.flip();
System.out.println(buffer.position()); //0
System.out.println(buffer.limit()); //4
System.out.println(buffer.getInt());
}
private static void loop() {
ByteBuffer buffer;
byte[] num = new byte[10];
for (int i = 0; i < num.length; i++) {
num[i] = (byte) (i+1);
}
buffer = ByteBuffer.wrap(num);
while(buffer.hasRemaining()){
System.out.println(buffer.get());
}
}
private static void slice() {
ByteBuffer bb1 = ByteBuffer.allocate(10);
bb1.putInt(10);
//返回position到limit之间的数据
ByteBuffer bb2 = bb1.slice();
System.out.println(bb2.position()); //0
System.out.println(bb2.limit()); //6
System.out.println(bb2.capacity()); //6
}
public static void main(String[] args) {
init();
loop();
slice();
}
}
|
[
"[email protected]"
] | |
75db56fdba23922ed665d32d449d8844930e353e
|
eeb0511ee940ace0e213fdf22b84f087041bddb4
|
/lccshot/src/main/java/com/lcc/lccshot/base/warpper/LogWarpper.java
|
94130746739bedf77bf9dab30dbce77cb39410b9
|
[] |
no_license
|
liangchangchun/lccbat
|
22127c59a7847e3db81a8c9c14e059726178dc0d
|
405ea7e44a65a1e28c960f789c0a794e9ab7ccca
|
refs/heads/master
| 2021-01-01T18:35:44.247187 | 2017-11-15T03:50:13 | 2017-11-15T03:50:13 | 98,372,085 | 0 | 1 | null | 2017-08-31T14:48:33 | 2017-07-26T02:51:32 |
JavaScript
|
UTF-8
|
Java
| false | false | 1,402 |
java
|
package com.lcc.lccshot.base.warpper;
import java.util.Map;
import com.lcc.lccshot.base.BaseControllerWarpper;
import com.lcc.lccshot.core.constant.factory.LogicConstantFactory;
import com.lcc.lccshot.utils.Contrast;
import com.lcc.lccshot.utils.ToolUtil;
/**
* 日志列表的包装类
*
* @author fengshuonan
* @date 2017年4月5日22:56:24
*/
public class LogWarpper extends BaseControllerWarpper {
public LogWarpper(Object obj) {
super(obj);
}
public LogWarpper(Object obj, Class type) {
super(obj, type);
}
@Override
public void warpTheMap(Map<String, Object> map) {
String message = (String) map.get("message");
Integer userid = (Integer) map.get("userid");
map.put("userName", LogicConstantFactory.me().getUserNameById(userid));
//如果信息过长,则只截取前100位字符串
if (ToolUtil.isNotEmpty(message) && message.length() >= 100) {
String subMessage = message.substring(0, 100) + "...";
map.put("message", subMessage);
}
//如果信息中包含分割符号;;; 则分割字符串返给前台
if (ToolUtil.isNotEmpty(message) && message.indexOf(Contrast.separator) != -1) {
String[] msgs = message.split(Contrast.separator);
map.put("regularMessage",msgs);
}else{
map.put("regularMessage",message);
}
}
}
|
[
"[email protected]"
] | |
bfc156b5c7b54ce1258e8a3a92ece55d4473b05e
|
cd4fcdd11f02926f337b7f809846216a237e9b07
|
/pisp/POST_DomesticPayments/PISP_DPS_212.java
|
d062cb403916e946656fa14ccf2c4adfc437f31d
|
[] |
no_license
|
arorarama11/code
|
cabf0d0134d72b95f9f7670695f01ffb45bc9f7e
|
10e212862b35a265c94a92b2b357bc679f6cc9e2
|
refs/heads/master
| 2020-12-20T12:48:46.285424 | 2020-01-24T21:13:55 | 2020-01-24T21:13:55 | 236,081,871 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,712 |
java
|
package com.psd2.tests.pisp.POST_DomesticPayments;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import com.psd2.core.TestBase;
import com.psd2.logger.TestListener;
import com.psd2.logger.TestLogger;
import com.psd2.utils.API_E2E_Utility;
/**
* Class Description : Verification of the value of OPTIONAL CreditorAccount/AddressLine where Request has sent successfully and returned a HTTP Code 201 Created
* @author Rama Arora
*
*/
@Listeners( { TestListener.class })
@Test(groups={"Regression"})
public class PISP_DPS_212 extends TestBase{
API_E2E_Utility apiUtility = new API_E2E_Utility();
@Test
public void m_PISP_DPS_212() throws Throwable{
TestLogger.logStep("[Step 1] : Create Domestic Payment Consent");
consentDetails=apiUtility.generatePayments(false, apiConst.domesticPayments, false, false);
TestLogger.logBlankLine();
TestLogger.logStep("[Step 2] : POST Domestic Payment Submission");
paymentConsent.setBaseURL(apiConst.dps_endpoint);
paymentConsent.setHeadersString("Authorization:Bearer "+consentDetails.get("api_access_token"));
paymentConsent.setConsentId(consentDetails.get("consentId"));
paymentConsent.submit();
testVP.assertStringEquals(String.valueOf(paymentConsent.getResponseStatusCode()),"201",
"Response Code is correct for Domestic Payment Consent URI");
testVP.assertStringEquals(paymentConsent.getResponseNodeStringByPath("Data.Initiation.CreditorPostalAddress.AddressLine[0]"), paymentConsent._crAddressLine,
"AddressLine is same in response as sent in request");
TestLogger.logBlankLine();
testVP.testResultFinalize();
}
}
|
[
"[email protected]"
] | |
cf1b957cc4e0f6244781e131069f6792f1665aea
|
ea73bc3f72ccf43b5ce79213c2514fefc3643186
|
/web/src/main/java/com/lx/edu/util/JsonUtil.java
|
cd871aed9042a0e61635c0d8d2803b841a493f7e
|
[] |
no_license
|
ylnx/ssm
|
e7ef353f759bdda2abf37dfee4bcc994453699e8
|
abfa9ee78821949528ed21246c9b9353b3763b09
|
refs/heads/master
| 2022-12-21T09:48:55.187981 | 2019-05-26T08:20:42 | 2019-05-26T08:20:42 | 188,655,855 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,314 |
java
|
package com.lx.edu.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.lx.edu.domain.ListJsonBean;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 描述:
*
* @author liaox
* @create 2019-05-04 10:36
*/
public class JsonUtil {
/**
* json格式为 result:要返回的数据
* @return
*/
public static String toJson(Object object){
Map<String,Object> map = new HashMap<>();
if (object == null){
map.put("result","");
}else {
map.put("result",object);
}
return JSONObject.toJSONString(map);
}
/**
* json格式为 result:要返回的数据
* @return
*/
public static String toJsonList(ListJsonBean jsonBean){
Map<String,Object> map = new HashMap<>();
if (jsonBean == null){
throw new RuntimeException("json数据出错");
}
map.put("rows",jsonBean.getList());
map.put("total",jsonBean.getTotal());
return JSONArray.toJSONString(map);
}
public static String toJsonPureList(List jsonList){
return JSONArray.toJSONString(jsonList);
}
public static String toJsonPure(Object object){
return JSONObject.toJSONString(object);
}
}
|
[
"[email protected]"
] | |
139661efc0379d3d9a8d5397ac6aa17d19a8ee7b
|
a9ece6d8dc58871c363c0908890d2a1c8fc7c6c8
|
/model/src/main/java/com/piotrak/smarthome/model/Response.java
|
2aa307967e8eaa33a63eaaea270fdc7ab5e01d40
|
[] |
no_license
|
Kesop1/smart-home
|
3513daa4863274a26ec7dbf8fefe49dcb521b7d1
|
23bf4ff0eaabc72d29a08d4ef79c36032b8ca902
|
refs/heads/master
| 2021-02-08T23:17:25.945304 | 2020-03-29T16:11:56 | 2020-03-29T16:11:56 | 244,209,024 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 65 |
java
|
package com.piotrak.smarthome.model;
public class Response {
}
|
[
"[email protected]"
] | |
026994eff8f955fef96d5cf4de278697011641ed
|
ea46da50a0e52eed7208d5e05c66ec642f46f9ed
|
/SourceCode/DMSPortlet/src/openones/oopms/entity/Conversion.java
|
e499bc82578ddb8104b6b4ec2a24ac3a8d12db07
|
[] |
no_license
|
gofpattern/oopms
|
0ceb94390e1a3769ce37174cfa12f7de22b46619
|
be7846c329be3077f9e91b36bab0567ce9c07938
|
refs/heads/master
| 2021-01-01T18:34:54.072165 | 2012-08-24T07:49:31 | 2012-08-24T07:49:31 | 42,200,901 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,096 |
java
|
package openones.oopms.entity;
// Generated 12:18:17 01-03-2012 by Hibernate Tools 3.2.1.GA
import java.math.BigDecimal;
import java.util.Date;
/**
* Conversion generated by hbm2java
*/
public class Conversion implements java.io.Serializable {
private BigDecimal conversionId;
private EstimationMethod estimationMethod;
private Language language;
private BigDecimal sloc;
private Date lastUpdate;
private String note;
public Conversion() {
}
public Conversion(BigDecimal conversionId) {
this.conversionId = conversionId;
}
public Conversion(BigDecimal conversionId, EstimationMethod estimationMethod, Language language, BigDecimal sloc, Date lastUpdate, String note) {
this.conversionId = conversionId;
this.estimationMethod = estimationMethod;
this.language = language;
this.sloc = sloc;
this.lastUpdate = lastUpdate;
this.note = note;
}
public BigDecimal getConversionId() {
return this.conversionId;
}
public void setConversionId(BigDecimal conversionId) {
this.conversionId = conversionId;
}
public EstimationMethod getEstimationMethod() {
return this.estimationMethod;
}
public void setEstimationMethod(EstimationMethod estimationMethod) {
this.estimationMethod = estimationMethod;
}
public Language getLanguage() {
return this.language;
}
public void setLanguage(Language language) {
this.language = language;
}
public BigDecimal getSloc() {
return this.sloc;
}
public void setSloc(BigDecimal sloc) {
this.sloc = sloc;
}
public Date getLastUpdate() {
return this.lastUpdate;
}
public void setLastUpdate(Date lastUpdate) {
this.lastUpdate = lastUpdate;
}
public String getNote() {
return this.note;
}
public void setNote(String note) {
this.note = note;
}
}
|
[
"truongmh60003@c85c9dab-434b-e816-fbf5-fcd0f5e7b8b1"
] |
truongmh60003@c85c9dab-434b-e816-fbf5-fcd0f5e7b8b1
|
db206ee0ec2e88697802bb45846be8688fb7736b
|
9886cddc385d0a6025c1502866a750e96f888c0b
|
/app/src/main/java/com/softsquared/android/superchallange2020/src/curation/HeartCheckDialog.java
|
914b22f002cb7fbe57a6424e9641c6a4b0b49296
|
[] |
no_license
|
dudwls0113/superchallange2020
|
560abed33bc5df9f67c8268be0e5334c6f7a0787
|
db02dd5b9ffb6a4171f795353aa34d8cf98ac5eb
|
refs/heads/master
| 2020-12-12T23:27:24.351652 | 2020-01-17T00:32:34 | 2020-01-17T00:32:34 | 234,256,278 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,341 |
java
|
package com.softsquared.android.superchallange2020.src.curation;
import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.TextView;
import com.softsquared.android.superchallange2020.R;
public class HeartCheckDialog extends Dialog {
private TextView mTextViewOk;
private TextView mTextViewCancel;
private CustomLIstener mCustomLIstener;
public HeartCheckDialog(Context context, CustomLIstener customLIstener) {
super(context);
setContentView(R.layout.custom_dialog_seat_check);
this.mCustomLIstener = customLIstener;
mTextViewOk = findViewById(R.id.dialog_must_update_ok);
mTextViewOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mCustomLIstener.yesClick();
dismiss();
}
});
// mTextViewCancel = findViewById(R.id.dialog_must_update_cancel);
// mTextViewCancel.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// mCustomLIstener.noClick();
// dismiss();
//
// }
// });
}
public interface CustomLIstener {
void yesClick();
void noClick();
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.