blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
7bea12a397cbf645f2d6291255b00d226b43a892
043f8556a26b1269d2cd48c792937601a2b7cbed
/src/collections/ListTimes.java
58eaa73c721a92f0c30cba42fb8ed408dca65740
[]
no_license
sivacheerla93/java
b33a60d9695cf730c4958926837bdcbc27ee8f32
12311001fdeaeedb2464a00c5f2e7aee987a25d2
refs/heads/master
2022-07-06T06:51:05.606627
2020-06-11T15:33:47
2020-06-11T15:33:47
134,741,917
0
5
null
2022-06-21T03:29:44
2018-05-24T16:30:11
Java
UTF-8
Java
false
false
387
java
package collections; import java.util.TreeSet; public class ListTimes { public static void main(String[] args) { TreeSet<Time> times = new TreeSet<>(); times.add(new Time(10, 20, 30)); times.add(new Time(1, 2, 3)); times.add(new Time(10, 20, 30)); times.add(new Time(20, 20, 20)); times.add(new Time(10, 10, 10)); for (Time t : times) System.out.println(t); } }
[ "sivacheerla@live.com" ]
sivacheerla@live.com
3360e63f88af4ee737086ab55f894484f33d4032
e8af0aaec56ac4eee482a9a04ab22ef678ce9137
/src/main/java/com/miage/altea/tp/battle_api/pokemon_type/bo/Sprites.java
039ac8fcee68e8d1f8ed3017c81692071e91faf6
[]
no_license
ALTEA-2018/battle-api-akessil
77c154683b8d48024f4ca6fe14a806062b12bf44
567f2cef0e3e7e62781fd779fb53d30c268465da
refs/heads/master
2020-04-29T15:29:51.005447
2019-04-06T18:18:38
2019-04-06T18:18:38
176,230,143
0
0
null
null
null
null
UTF-8
Java
false
false
511
java
package com.miage.altea.tp.battle_api.pokemon_type.bo; public class Sprites { private String back_default; private String front_default; public String getBack_default() { return back_default; } public void setBack_default(String back_default) { this.back_default = back_default; } public String getFront_default() { return front_default; } public void setFront_default(String front_default) { this.front_default = front_default; } }
[ "koceila.ouikene@worldline.com" ]
koceila.ouikene@worldline.com
a886837f2700d3c37c2707d3771f0f8f449934d5
7d966c22c83258cc21ffc040271d62aea122d658
/MegaMek/src/megamek/common/weapons/CLPrototypeRL15.java
9b8be744e3cee588d7c90dbebb48c4cfffc11e56
[]
no_license
Ayamin0x539/MegaMek
5f1f2db42f01a907b8467cefc95cf56d697bdf8f
9ea4712f2ddf5a7af8c65b9e09211d7b76904f8e
refs/heads/master
2021-01-09T11:42:01.513443
2015-12-03T02:04:04
2015-12-03T02:04:04
59,911,944
2
0
null
null
null
null
UTF-8
Java
false
false
1,574
java
/** * MegaMek - Copyright (C) 2005 Ben Mazur (bmazur@sev.org) * * 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. */ package megamek.common.weapons; import megamek.common.TechConstants; /** * @author Sebastian Brocks */ public class CLPrototypeRL15 extends PrototypeRLWeapon { /** * */ private static final long serialVersionUID = 5888570332510350564L; /** * */ public CLPrototypeRL15() { super(); techLevel.put(3071, TechConstants.T_IS_EXPERIMENTAL); name = "Rocket Launcher 15 (PP)"; setInternalName("CLRocketLauncher15Prototype"); heat = 5; rackSize = 15; shortRange = 4; mediumRange = 9; longRange = 15; extremeRange = 18; tonnage = 1.0f; criticals = 2; bv = 21; cost = 30000; shortAV = 9; medAV = 9; maxRange = RANGE_MED; introDate = 2801; extinctDate =2823; techLevel.put(2801, techLevel.get(3071)); availRating = new int[] { RATING_X, RATING_C, RATING_X }; techRating = RATING_C; } }
[ "tms08012@dds-227.ad.engr.uconn.edu" ]
tms08012@dds-227.ad.engr.uconn.edu
153da1ec7d57ae62779bd2c1b282587476ae6897
2b3c7851048d80198dc1e7221d0a1f30aa30e68b
/src/testpackage/Sampleclass.java
d2d99be6aecebcee85b3b6166caa72d2f89c2a81
[]
no_license
konthamshivakrishna/DECEMBER
426b895289258a7f480ce6cfd07ada894bd11964
c5a64a1df93ba3686d78e2335179622fe4ab40cc
refs/heads/master
2021-06-25T10:03:16.605856
2019-12-05T12:38:15
2019-12-05T12:38:15
225,827,740
0
0
null
2021-04-26T19:45:34
2019-12-04T09:23:33
Java
UTF-8
Java
false
false
179
java
package testpackage; public class Sampleclass { public static void main(String Args[]) { int i=1; do { System.out.println("Hello World"); i++; }while(i<=5); } }
[ "acs-0147@aegis.com" ]
acs-0147@aegis.com
57bf0cb441b0dc7c7aa9e558aab07cda51c2a8ae
b22146a6c49f8dc4a13bd16c81ed905be70cfdd8
/flash-schedule/src/main/java/cn/enilu/flash/schedule/service/job/HelloJob.java
08a586b6d60058c1e6e51c6fd1c8a31f4c6dc757
[ "MIT" ]
permissive
richardfpeng/web-flash-spring-cloud
f6cf7f726a6f3f9b0f44b0145738aa27edb7cb13
b9ca11b707657f7c31905501df33224157d919b7
refs/heads/main
2023-06-11T00:16:00.195776
2021-07-03T09:47:32
2021-07-03T09:47:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,008
java
package cn.enilu.flash.schedule.service.job; import cn.enilu.flash.common.bean.entity.system.Cfg; import cn.enilu.flash.common.service.system.CfgService; import cn.enilu.flash.common.utils.DateUtil; import cn.enilu.flash.common.utils.JsonUtil; import cn.enilu.flash.schedule.service.JobExecuter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Map; /** * HelloJob * * @author zt * @version 2018/12/30 0030 */ @Component public class HelloJob extends JobExecuter { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private CfgService cfgService; @Override public void execute(Map<String, Object> dataMap) throws Exception { Cfg cfg = cfgService.get(1L); cfg.setCfgDesc("update by " + DateUtil.getTime()); cfgService.update(cfg); logger.info("hello :" + JsonUtil.toJson(dataMap)); } }
[ "sheseerzuo123" ]
sheseerzuo123
0bf221fb2902a4164907e80770cac4896dfef0ad
14b91d583cfbe54932d6f6d93bcb4f0bf518a06c
/PandorasJar/src/model/Review.java
d83506cf2741202904985779ab130e62519eb614
[]
no_license
luigimontaleone/PandorasJarWebComputing
571edc129f76a2f55829da63452e81cd859aa024
155c78584e275908dea96e86a0a6e4f2df7e69d4
refs/heads/master
2020-12-20T00:17:46.473004
2020-01-23T22:08:36
2020-01-23T22:08:36
235,896,231
0
0
null
null
null
null
UTF-8
Java
false
false
1,114
java
package model; public class Review { private String username; private int author; private int idGame; private String stars; private String comment; public Review() {} public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public int getAuthor() { return author; } public void setAuthor(int author) { this.author = author; } public int getIdGame() { return idGame; } public void setIdGame(int idGame) { this.idGame = idGame; } public String getStars() { return stars; } public void setStars(int numStars) { if(numStars > 5) return; String newStar = ""; StringBuilder sb = new StringBuilder(newStar); for(int i = 0; i < numStars; i++) sb.append("⭐"); this.stars = sb.toString(); } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } }
[ "mntlgu99b10d122d@studenti.unical.it" ]
mntlgu99b10d122d@studenti.unical.it
d115d72509fdc09b008e1120007b64e07a71143d
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/3/3_96450b9d6e42ae3de91b338a331729469778c578/SqlOperatorTests/3_96450b9d6e42ae3de91b338a331729469778c578_SqlOperatorTests_t.java
323ab243e12db163933dfc9400571ce13077fae0
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
151,901
java
/* // $Id$ // Package org.eigenbase is a class library of data management components. // Copyright (C) 2005-2007 The Eigenbase Project // Copyright (C) 2002-2007 Disruptive Tech // Copyright (C) 2005-2007 LucidEra, Inc. // Portions Copyright (C) 2003-2007 John V. Sichi // // 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 approved by The Eigenbase Project. // // 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 org.eigenbase.sql.test; import java.math.*; import java.text.*; import java.util.*; import java.util.regex.*; import junit.framework.*; import org.eigenbase.sql.*; import org.eigenbase.sql.fun.*; import org.eigenbase.sql.parser.*; import org.eigenbase.sql.type.*; import org.eigenbase.test.*; import org.eigenbase.util.*; /** * Contains unit tests for all operators. Each of the methods is named after an * operator. * * <p>The class is abstract. It contains a test for every operator, but does not * provide a mechanism to execute the tests: parse, validate, and execute * expressions on the operators. This is left to a {@link SqlTester} object * which the derived class must provide. * * <p>Different implementations of {@link SqlTester} are possible, such as: * * <ul> * <li>Execute against a real farrago database * <li>Execute in pure java (parsing and validation can be done, but expression * evaluation is not possible) * <li>Generate a SQL script. * <li>Analyze which operators are adequately tested. * </ul> * * <p>A typical method will be named after the operator it is testing (say * <code>testSubstringFunc</code>). It first calls * {@link SqlTester#setFor(org.eigenbase.sql.SqlOperator, org.eigenbase.sql.test.SqlTester.VmName...)} * to declare which operator it is testing. * <blockqoute> * * <pre><code> * public void testSubstringFunc() { * getTester().setFor(SqlStdOperatorTable.substringFunc); * getTester().checkScalar("sin(0)", "0"); * getTester().checkScalar("sin(1.5707)", "1"); * }</code></pre> * * </blockqoute> The rest of the method contains calls to the various <code> * checkXxx</code> methods in the {@link SqlTester} interface. For an operator * to be adequately tested, there need to be tests for: * * <ul> * <li>Parsing all of its the syntactic variants. * <li>Deriving the type of in all combinations of arguments. * * <ul> * <li>Pay particular attention to nullability. For example, the result of the * "+" operator is NOT NULL if and only if both of its arguments are NOT * NULL.</li> * <li>Also pay attention to precsion/scale/length. For example, the maximum * length of the "||" operator is the sum of the maximum lengths of its * arguments.</li> * </ul> * </li> * <li>Executing the function. Pay particular attention to corner cases such as * null arguments or null results.</li> * </ul> * * @author Julian Hyde * @version $Id$ * @since October 1, 2004 */ public abstract class SqlOperatorTests extends TestCase { //~ Static fields/initializers --------------------------------------------- public static final String NL = TestUtil.NL; // TODO: Change message when Fnl3Fixed to something like // "Invalid character for cast: PC=0 Code=22018" public static final String invalidCharMessage = Bug.Fnl3Fixed ? null : "(?s).*"; // TODO: Change message when Fnl3Fixed to something like // "Overflow during calculation or cast: PC=0 Code=22003" public static final String outOfRangeMessage = Bug.Fnl3Fixed ? null : "(?s).*"; // TODO: Change message when Fnl3Fixed to something like // "Division by zero: PC=0 Code=22012" public static final String divisionByZeroMessage = Bug.Fnl3Fixed ? null : "(?s).*"; // TODO: Change message when Fnl3Fixed to something like // "String right truncation: PC=0 Code=22001" public static final String stringTruncMessage = Bug.Fnl3Fixed ? null : "(?s).*"; // TODO: Change message when Fnl3Fixed to something like // "Invalid datetime format: PC=0 Code=22007" public static final String badDatetimeMessage = Bug.Fnl3Fixed ? null : "(?s).*"; public static final String literalOutOfRangeMessage = "(?s).*Numeric literal.*out of range.*"; public static final boolean todo = false; /** * Regular expression for a SQL TIME(0) value. */ public static final Pattern timePattern = Pattern.compile( "[0-9][0-9]:[0-9][0-9]:[0-9][0-9]"); /** * Regular expression for a SQL TIMESTAMP(0) value. */ public static final Pattern timestampPattern = Pattern.compile( "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] " + "[0-9][0-9]:[0-9][0-9]:[0-9][0-9]"); /** * Regular expression for a SQL DATE value. */ public static final Pattern datePattern = Pattern.compile( "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]"); public static final String [] numericTypeNames = new String[] { "TINYINT", "SMALLINT", "INTEGER", "BIGINT", "DECIMAL(5, 2)", "REAL", "FLOAT", "DOUBLE" }; // REVIEW jvs 27-Apr-2006: for Float and Double, MIN_VALUE // is the smallest positive value, not the smallest negative value public static final String [] minNumericStrings = new String[] { Long.toString(Byte.MIN_VALUE), Long.toString( Short.MIN_VALUE), Long.toString(Integer.MIN_VALUE), Long.toString(Long.MIN_VALUE), "-999.99", // NOTE jvs 26-Apr-2006: Win32 takes smaller values from // win32_values.h "1E-37", /*Float.toString(Float.MIN_VALUE)*/ "2E-307", /*Double.toString(Double.MIN_VALUE)*/ "2E-307" /*Double.toString(Double.MIN_VALUE)*/, }; public static final String [] minOverflowNumericStrings = new String[] { Long.toString(Byte.MIN_VALUE - 1), Long.toString(Short.MIN_VALUE - 1), Long.toString((long) Integer.MIN_VALUE - 1), (new BigDecimal(Long.MIN_VALUE)).subtract(BigDecimal.ONE).toString(), "-1000.00", "1e-46", "1e-324", "1e-324" }; public static final String [] maxNumericStrings = new String[] { Long.toString(Byte.MAX_VALUE), Long.toString( Short.MAX_VALUE), Long.toString(Integer.MAX_VALUE), Long.toString(Long.MAX_VALUE), "999.99", // NOTE jvs 26-Apr-2006: use something slightly less than MAX_VALUE // because roundtripping string to approx to string doesn't preserve // MAX_VALUE on win32 "3.4028234E38", /*Float.toString(Float.MAX_VALUE)*/ "1.79769313486231E308", /*Double.toString(Double.MAX_VALUE)*/ "1.79769313486231E308" /*Double.toString(Double.MAX_VALUE)*/ }; public static final String [] maxOverflowNumericStrings = new String[] { Long.toString(Byte.MAX_VALUE + 1), Long.toString(Short.MAX_VALUE + 1), Long.toString((long) Integer.MAX_VALUE + 1), (new BigDecimal(Long.MAX_VALUE)).add(BigDecimal.ONE).toString(), "1000.00", "1e39", "-1e309", "1e309" }; private static final boolean [] FalseTrue = new boolean[] { false, true }; private static final SqlTester.VmName VM_FENNEL = SqlTester.VmName.FENNEL; private static final SqlTester.VmName VM_JAVA = SqlTester.VmName.JAVA; private static final SqlTester.VmName VM_EXPAND = SqlTester.VmName.EXPAND; protected static final TimeZone gmtTimeZone = TimeZone.getTimeZone("GMT"); protected static final TimeZone defaultTimeZone = TimeZone.getDefault(); //~ Constructors ----------------------------------------------------------- public SqlOperatorTests(String testName) { super(testName); } //~ Methods ---------------------------------------------------------------- /** * Derived class must implement this method to provide a means to validate, * execute various statements. */ protected abstract SqlTester getTester(); protected void setUp() throws Exception { getTester().setFor(null); } //--- Tests ----------------------------------------------------------- public void testBetween() { getTester().setFor( SqlStdOperatorTable.betweenOperator, SqlTester.VmName.EXPAND); getTester().checkBoolean("2 between 1 and 3", Boolean.TRUE); getTester().checkBoolean("2 between 3 and 2", Boolean.FALSE); getTester().checkBoolean("2 between symmetric 3 and 2", Boolean.TRUE); getTester().checkBoolean("3 between 1 and 3", Boolean.TRUE); getTester().checkBoolean("4 between 1 and 3", Boolean.FALSE); getTester().checkBoolean("1 between 4 and -3", Boolean.FALSE); getTester().checkBoolean("1 between -1 and -3", Boolean.FALSE); getTester().checkBoolean("1 between -1 and 3", Boolean.TRUE); getTester().checkBoolean("1 between 1 and 1", Boolean.TRUE); getTester().checkBoolean("1.5 between 1 and 3", Boolean.TRUE); getTester().checkBoolean("1.2 between 1.1 and 1.3", Boolean.TRUE); getTester().checkBoolean("1.5 between 2 and 3", Boolean.FALSE); getTester().checkBoolean("1.5 between 1.6 and 1.7", Boolean.FALSE); getTester().checkBoolean("1.2e1 between 1.1 and 1.3", Boolean.FALSE); getTester().checkBoolean("1.2e0 between 1.1 and 1.3", Boolean.TRUE); getTester().checkBoolean("1.5e0 between 2 and 3", Boolean.FALSE); getTester().checkBoolean("1.5e0 between 2e0 and 3e0", Boolean.FALSE); getTester().checkBoolean( "1.5e1 between 1.6e1 and 1.7e1", Boolean.FALSE); getTester().checkBoolean("x'' between x'' and x''", Boolean.TRUE); getTester().checkNull("cast(null as integer) between -1 and 2"); getTester().checkNull("1 between -1 and cast(null as integer)"); getTester().checkNull( "1 between cast(null as integer) and cast(null as integer)"); getTester().checkNull("1 between cast(null as integer) and 1"); } public void testNotBetween() { getTester().setFor(SqlStdOperatorTable.notBetweenOperator, VM_EXPAND); getTester().checkBoolean("2 not between 1 and 3", Boolean.FALSE); getTester().checkBoolean("3 not between 1 and 3", Boolean.FALSE); getTester().checkBoolean("4 not between 1 and 3", Boolean.TRUE); getTester().checkBoolean( "1.2e0 not between 1.1 and 1.3", Boolean.FALSE); getTester().checkBoolean("1.2e1 not between 1.1 and 1.3", Boolean.TRUE); getTester().checkBoolean("1.5e0 not between 2 and 3", Boolean.TRUE); getTester().checkBoolean("1.5e0 not between 2e0 and 3e0", Boolean.TRUE); } private String getCastString( String value, String targetType, boolean errorLoc) { if (errorLoc) { value = "^" + value + "^"; } return "cast(" + value + " as " + targetType + ")"; } private void checkCastToApproxOkay( String value, String targetType, double expected, double delta) { getTester().checkScalarApprox( getCastString(value, targetType, false), targetType + " NOT NULL", expected, delta); } private void checkCastToStringOkay( String value, String targetType, String expected) { getTester().checkString( getCastString(value, targetType, false), expected, targetType + " NOT NULL"); } private void checkCastToScalarOkay( String value, String targetType, String expected) { getTester().checkScalarExact( getCastString(value, targetType, false), targetType + " NOT NULL", expected); } private void checkCastToScalarOkay(String value, String targetType) { checkCastToScalarOkay(value, targetType, value); } private void checkCastFails( String value, String targetType, String expectedError, boolean runtime) { getTester().checkFails( getCastString(value, targetType, !runtime), expectedError, runtime); } private void checkCastToString(String value, String type, String expected) { String spaces = " "; if (expected == null) { expected = value.trim(); } int len = expected.length(); if (type != null) { value = getCastString(value, type, false); } // currently no exception thrown for truncation if (Bug.Dt239Fixed) { checkCastFails( value, "VARCHAR(" + (len - 1) + ")", stringTruncMessage, true); } checkCastToStringOkay(value, "VARCHAR(" + len + ")", expected); checkCastToStringOkay(value, "VARCHAR(" + (len + 5) + ")", expected); // currently no exception thrown for truncation if (Bug.Dt239Fixed) { checkCastFails(value, "CHAR(" + (len - 1) + ")", stringTruncMessage, true); } checkCastToStringOkay( value, "CHAR(" + len + ")", expected); checkCastToStringOkay( value, "CHAR(" + (len + 5) + ")", expected + spaces); } public void testCastToString() { getTester().setFor(SqlStdOperatorTable.castFunc); // integer checkCastToString("123", "CHAR(3)", "123"); checkCastToString("0", "CHAR", "0"); checkCastToString("-123", "CHAR(4)", "-123"); // decimal checkCastToString("123.4", "CHAR(5)", "123.4"); checkCastToString("-0.0", "CHAR(2)", ".0"); checkCastToString("-123.4", "CHAR(6)", "-123.4"); getTester().checkString( "cast(1.29 as varchar(10))", "1.29", "VARCHAR(10) NOT NULL"); getTester().checkString( "cast(.48 as varchar(10))", ".48", "VARCHAR(10) NOT NULL"); getTester().checkFails( "cast(2.523 as char(2))", stringTruncMessage, true); getTester().checkString( "cast(-0.29 as varchar(10))", "-.29", "VARCHAR(10) NOT NULL"); getTester().checkString( "cast(-1.29 as varchar(10))", "-1.29", "VARCHAR(10) NOT NULL"); // approximate checkCastToString("1.23E45", "CHAR(7)", "1.23E45"); checkCastToString("CAST(0 AS DOUBLE)", "CHAR(3)", "0E0"); checkCastToString("-1.20e-07", "CHAR(7)", "-1.2E-7"); checkCastToString("cast(0e0 as varchar(5))", "CHAR(3)", "0E0"); checkCastToString("cast(-45e-2 as varchar(17))", "CHAR(7)", "-4.5E-1"); checkCastToString("cast(4683442.3432498375e0 as varchar(20))", "CHAR(19)","4.683442343249838E6"); checkCastToString("cast(-0.1 as real)","CHAR(5)","-1E-1"); getTester().checkFails( "cast(1.3243232e0 as varchar(4))", stringTruncMessage, true); getTester().checkFails( "cast(1.9e5 as char(4))", stringTruncMessage, true); // string checkCastToString("'abc'", "CHAR(1)", "a"); checkCastToString("'abc'", "CHAR(3)", "abc"); checkCastToString("cast('abc' as varchar(6))", "CHAR(3)", "abc"); // date & time checkCastToString("date '2008-01-01'", "CHAR(10)", "2008-01-01"); checkCastToString("time '1:2:3'", "CHAR(8)", "01:02:03"); checkCastToString( "timestamp '2008-1-1 1:2:3'", "CHAR(19)", "2008-01-01 01:02:03"); checkCastToString( "timestamp '2008-1-1 1:2:3'", "VARCHAR(30)", "2008-01-01 01:02:03"); // todo: cast of intervals to strings not supported if (todo) { checkCastToString( "interval '3-2' year to month", "CHAR(5)", "+3-02"); checkCastToString( "interval '1 2:3:4' day to second", "CHAR(11)", "+1 02:03:04"); } // boolean checkCastToString("True","CHAR(4)","TRUE"); checkCastToString("False","CHAR(5)","FALSE"); getTester().checkFails( "cast(true as char(3))", invalidCharMessage, true); getTester().checkFails( "cast(false as char(4))", invalidCharMessage, true); getTester().checkFails( "cast(true as varchar(3))", invalidCharMessage, true); getTester().checkFails( "cast(false as varchar(4))", invalidCharMessage, true); } public void testCastExactNumericLimits() { getTester().setFor(SqlStdOperatorTable.castFunc); // Test casting for min,max, out of range for exact numeric types for (int i = 0; i < numericTypeNames.length; i++) { String type = numericTypeNames[i]; if (type.equalsIgnoreCase("DOUBLE") || type.equalsIgnoreCase("FLOAT") || type.equalsIgnoreCase("REAL")) { // Skip approx types continue; } // Convert from literal to type checkCastToScalarOkay(maxNumericStrings[i], type); checkCastToScalarOkay(minNumericStrings[i], type); // Overflow test if (type.equalsIgnoreCase("BIGINT")) { // Literal of range checkCastFails( maxOverflowNumericStrings[i], type, literalOutOfRangeMessage, false); checkCastFails( minOverflowNumericStrings[i], type, literalOutOfRangeMessage, false); } else { checkCastFails( maxOverflowNumericStrings[i], type, outOfRangeMessage, true); checkCastFails( minOverflowNumericStrings[i], type, outOfRangeMessage, true); } // Convert from string to type checkCastToScalarOkay( "'" + maxNumericStrings[i] + "'", type, maxNumericStrings[i]); checkCastToScalarOkay( "'" + minNumericStrings[i] + "'", type, minNumericStrings[i]); checkCastFails( "'" + maxOverflowNumericStrings[i] + "'", type, outOfRangeMessage, true); checkCastFails( "'" + minOverflowNumericStrings[i] + "'", type, outOfRangeMessage, true); // Convert from type to string checkCastToString(maxNumericStrings[i], null, null); checkCastToString(maxNumericStrings[i], type, null); checkCastToString(minNumericStrings[i], null, null); checkCastToString(minNumericStrings[i], type, null); checkCastFails("'notnumeric'", type, invalidCharMessage, true); } } public void testCastToExactNumeric() { getTester().setFor(SqlStdOperatorTable.castFunc); checkCastToScalarOkay("1", "BIGINT"); checkCastToScalarOkay("1", "INTEGER"); checkCastToScalarOkay("1", "SMALLINT"); checkCastToScalarOkay("1", "TINYINT"); checkCastToScalarOkay("1", "DECIMAL(4, 0)"); checkCastToScalarOkay("-1", "BIGINT"); checkCastToScalarOkay("-1", "INTEGER"); checkCastToScalarOkay("-1", "SMALLINT"); checkCastToScalarOkay("-1", "TINYINT"); checkCastToScalarOkay("-1", "DECIMAL(4, 0)"); checkCastToScalarOkay("1.234E3", "INTEGER", "1234"); checkCastToScalarOkay("-9.99E2", "INTEGER", "-999"); checkCastToScalarOkay("'1'", "INTEGER", "1"); checkCastToScalarOkay("' 01 '", "INTEGER", "1"); checkCastToScalarOkay("'-1'", "INTEGER", "-1"); checkCastToScalarOkay("' -00 '", "INTEGER", "0"); // string to decimal getTester().checkScalarExact( "cast('1.29' as decimal(2,1))", "DECIMAL(2, 1) NOT NULL", "1.3"); getTester().checkScalarExact( "cast(' 1.25 ' as decimal(2,1))", "DECIMAL(2, 1) NOT NULL", "1.3"); getTester().checkScalarExact( "cast('1.21' as decimal(2,1))", "DECIMAL(2, 1) NOT NULL", "1.2"); getTester().checkScalarExact( "cast(' -1.29 ' as decimal(2,1))", "DECIMAL(2, 1) NOT NULL", "-1.3"); getTester().checkScalarExact( "cast('-1.25' as decimal(2,1))", "DECIMAL(2, 1) NOT NULL", "-1.3"); getTester().checkScalarExact( "cast(' -1.21 ' as decimal(2,1))", "DECIMAL(2, 1) NOT NULL", "-1.2"); getTester().checkFails( "cast(' -1.21e' as decimal(2,1))", invalidCharMessage, true); // string to integer getTester().checkScalarExact("cast('6543' as integer)", "6543"); if (Bug.Frg26Fixed) { getTester().checkScalarExact("cast(' -123 ' as int)", "-123"); } getTester().checkScalarExact( "cast('654342432412312' as bigint)", "BIGINT NOT NULL", "654342432412312"); } public void testCastWithRoundingToScalar() { getTester().setFor(SqlStdOperatorTable.castFunc); checkCastToScalarOkay("1.25", "INTEGER", "1"); checkCastToScalarOkay("1.25E0", "INTEGER", "1"); checkCastToScalarOkay("1.5", "INTEGER", "2"); checkCastToScalarOkay("5E-1", "INTEGER", "1"); checkCastToScalarOkay("1.75", "INTEGER", "2"); checkCastToScalarOkay("1.75E0", "INTEGER", "2"); checkCastToScalarOkay("-1.25", "INTEGER", "-1"); checkCastToScalarOkay("-1.25E0", "INTEGER", "-1"); checkCastToScalarOkay("-1.5", "INTEGER", "-2"); checkCastToScalarOkay("-5E-1", "INTEGER", "-1"); checkCastToScalarOkay("-1.75", "INTEGER", "-2"); checkCastToScalarOkay("-1.75E0", "INTEGER", "-2"); checkCastToScalarOkay("1.23454", "DECIMAL(8, 4)", "1.2345"); checkCastToScalarOkay("1.23454E0", "DECIMAL(8, 4)", "1.2345"); checkCastToScalarOkay("1.23455", "DECIMAL(8, 4)", "1.2346"); checkCastToScalarOkay("5E-5", "DECIMAL(8, 4)", "0.0001"); checkCastToScalarOkay("1.99995", "DECIMAL(8, 4)", "2.0000"); checkCastToScalarOkay("1.99995E0", "DECIMAL(8, 4)", "2.0000"); checkCastToScalarOkay("-1.23454", "DECIMAL(8, 4)", "-1.2345"); checkCastToScalarOkay("-1.23454E0", "DECIMAL(8, 4)", "-1.2345"); checkCastToScalarOkay("-1.23455", "DECIMAL(8, 4)", "-1.2346"); checkCastToScalarOkay("-5E-5", "DECIMAL(8, 4)", "-0.0001"); checkCastToScalarOkay("-1.99995", "DECIMAL(8, 4)", "-2.0000"); checkCastToScalarOkay("-1.99995E0", "DECIMAL(8, 4)", "-2.0000"); // 9.99 round to 10.0, should give out of range error getTester().checkFails( "cast(9.99 as decimal(2,1))", outOfRangeMessage, true); } public void testCastDecimalToDoubleToInteger() { getTester().setFor(SqlStdOperatorTable.castFunc); getTester().checkScalarExact( "cast( cast(1.25 as double) as integer)", "1"); getTester().checkScalarExact( "cast( cast(-1.25 as double) as integer)", "-1"); getTester().checkScalarExact( "cast( cast(1.75 as double) as integer)", "2"); getTester().checkScalarExact( "cast( cast(-1.75 as double) as integer)", "-2"); getTester().checkScalarExact( "cast( cast(1.5 as double) as integer)", "2"); getTester().checkScalarExact( "cast( cast(-1.5 as double) as integer)", "-2"); } public void testCastApproxNumericLimits() { getTester().setFor(SqlStdOperatorTable.castFunc); // Test casting for min,max, out of range for approx numeric types for (int i = 0; i < numericTypeNames.length; i++) { String type = numericTypeNames[i]; boolean isFloat; if (type.equalsIgnoreCase("DOUBLE") || type.equalsIgnoreCase("FLOAT")) { isFloat = false; } else if (type.equalsIgnoreCase("REAL")) { isFloat = true; } else { // Skip non-approx types continue; } // Convert from literal to type checkCastToApproxOkay( maxNumericStrings[i], type, Double.parseDouble(maxNumericStrings[i]), isFloat ? 1E32 : 0); checkCastToApproxOkay( minNumericStrings[i], type, Double.parseDouble(minNumericStrings[i]), 0); if (isFloat) { checkCastFails( maxOverflowNumericStrings[i], type, outOfRangeMessage, true); } else { // Double: Literal out of range checkCastFails( maxOverflowNumericStrings[i], type, literalOutOfRangeMessage, false); } // Underflow: goes to 0 checkCastToApproxOkay(minOverflowNumericStrings[i], type, 0, 0); // Convert from string to type checkCastToApproxOkay( "'" + maxNumericStrings[i] + "'", type, Double.parseDouble(maxNumericStrings[i]), isFloat ? 1E32 : 0); checkCastToApproxOkay( "'" + minNumericStrings[i] + "'", type, Double.parseDouble(minNumericStrings[i]), 0); checkCastFails( "'" + maxOverflowNumericStrings[i] + "'", type, outOfRangeMessage, true); // Underflow: goes to 0 checkCastToApproxOkay( "'" + minOverflowNumericStrings[i] + "'", type, 0, 0); // Convert from type to string // Treated as DOUBLE checkCastToString( maxNumericStrings[i], null, isFloat ? null : "1.79769313486231E308"); // TODO: The following tests are slightly different depending on // whether the java or fennel calc are used. // Try to make them the same if (false /* fennel calc*/) { // Treated as FLOAT or DOUBLE checkCastToString(maxNumericStrings[i], type, isFloat ? "3.402824E38" : "1.797693134862316E308"); // Treated as DOUBLE checkCastToString(minNumericStrings[i], null, isFloat ? null : "4.940656458412465E-324"); // Treated as FLOAT or DOUBLE checkCastToString(minNumericStrings[i], type, isFloat ? "1.401299E-45" : "4.940656458412465E-324"); } else if (false /* JavaCalc */) { // Treated as FLOAT or DOUBLE checkCastToString(maxNumericStrings[i], type, isFloat ? "3.402823E38" : "1.797693134862316E308"); // Treated as DOUBLE checkCastToString(minNumericStrings[i], null, isFloat ? null : null); // Treated as FLOAT or DOUBLE checkCastToString(minNumericStrings[i], type, isFloat ? "1.401298E-45" : null); } checkCastFails("'notnumeric'", type, invalidCharMessage, true); } } public void testCastToApproxNumeric() { getTester().setFor(SqlStdOperatorTable.castFunc); checkCastToApproxOkay("1", "DOUBLE", 1, 0); checkCastToApproxOkay("1.0", "DOUBLE", 1, 0); checkCastToApproxOkay("-2.3", "FLOAT", -2.3, 0); checkCastToApproxOkay("'1'", "DOUBLE", 1, 0); checkCastToApproxOkay("' -1e-37 '", "DOUBLE", -1e-37, 0); checkCastToApproxOkay("1e0", "DOUBLE", 1, 0); checkCastToApproxOkay("0e0", "REAL", 0, 0); } public void testCastNull() { getTester().setFor(SqlStdOperatorTable.castFunc); // null getTester().checkNull("cast(null as integer)"); getTester().checkNull("cast(null as decimal(4,3))"); getTester().checkNull("cast(null as double)"); getTester().checkNull("cast(null as varchar(10))"); getTester().checkNull("cast(null as char(10))"); getTester().checkNull("cast(null as date)"); getTester().checkNull("cast(null as time)"); getTester().checkNull("cast(null as timestamp)"); getTester().checkNull("cast(null as interval year to month)"); getTester().checkNull("cast(null as interval day to second(3))"); getTester().checkNull("cast(null as boolean)"); } public void testCastDateTime() { // Test cast for date/time/timestamp getTester().setFor(SqlStdOperatorTable.castFunc); getTester().checkScalar( "cast(TIMESTAMP '1945-02-24 12:42:25.34' as TIMESTAMP)", "1945-02-24 12:42:25", "TIMESTAMP(0) NOT NULL"); getTester().checkScalar( "cast(TIME '12:42:25.34' as TIME)", "12:42:25", "TIME(0) NOT NULL"); // test rounding getTester().checkScalar( "cast(TIME '12:42:25.9' as TIME)", "12:42:26", "TIME(0) NOT NULL"); if (Bug.Frg282Fixed) { // test precision getTester().checkScalar( "cast(TIME '12:42:25.34' as TIME(2))", "12:42:25.34", "TIME(2) NOT NULL"); } getTester().checkScalar( "cast(DATE '1945-02-24' as DATE)", "1945-02-24", "DATE NOT NULL"); // timestamp <-> time getTester().checkScalar( "cast(TIMESTAMP '1945-02-24 12:42:25.34' as TIME)", "12:42:25", "TIME(0) NOT NULL"); // Generate the current date as a string, e.g. "2007-04-18". The value // is guaranteed to be good for at least 2 minutes, which should give // us time to run the rest of the tests. final String today = new SimpleDateFormat("yyyy-MM-dd").format( getCalendarNotTooNear(Calendar.DAY_OF_MONTH).getTime()); // Note: Casting to time(0) should lose date info and fractional // seconds, then casting back to timestamp should initialize to // current_date. if (Bug.Fnl66Fixed) { getTester().checkScalar( "cast(cast(TIMESTAMP '1945-02-24 12:42:25.34' as TIME) as TIMESTAMP)", today + " 12:42:25", "TIMESTAMP(0) NOT NULL"); getTester().checkScalar( "cast(TIME '12:42:25.34' as TIMESTAMP)", today + " 12:42:25", "TIMESTAMP(0) NOT NULL"); } // timestamp <-> date getTester().checkScalar( "cast(TIMESTAMP '1945-02-24 12:42:25.34' as DATE)", "1945-02-24", "DATE NOT NULL"); // Note: casting to Date discards Time fields getTester().checkScalar( "cast(cast(TIMESTAMP '1945-02-24 12:42:25.34' as DATE) as TIMESTAMP)", "1945-02-24 00:00:00", "TIMESTAMP(0) NOT NULL"); getTester().checkScalar( "cast(DATE '1945-02-24' as TIMESTAMP)", "1945-02-24 00:00:00", "TIMESTAMP(0) NOT NULL"); // time <-> string checkCastToString("TIME '12:42:25'", null, "12:42:25"); if (todo) { checkCastToString("TIME '12:42:25.34'", null, "12:42:25.34"); } getTester().checkScalar( "cast('12:42:25' as TIME)", "12:42:25", "TIME(0) NOT NULL"); getTester().checkScalar( "cast('1:42:25' as TIME)", "01:42:25", "TIME(0) NOT NULL"); getTester().checkScalar( "cast('1:2:25' as TIME)", "01:02:25", "TIME(0) NOT NULL"); getTester().checkScalar( "cast(' 12:42:25 ' as TIME)", "12:42:25", "TIME(0) NOT NULL"); getTester().checkScalar( "cast('12:42:25.34' as TIME)", "12:42:25", "TIME(0) NOT NULL"); if (Bug.Frg282Fixed) { getTester().checkScalar( "cast('12:42:25.34' as TIME(2))", "12:42:25.34", "TIME(2) NOT NULL"); } getTester().checkFails( "cast('nottime' as TIME)", badDatetimeMessage, true); getTester().checkFails( "cast('1241241' as TIME)", badDatetimeMessage, true); getTester().checkFails( "cast('12:54:78' as TIME)", badDatetimeMessage, true); // timestamp <-> string checkCastToString( "TIMESTAMP '1945-02-24 12:42:25'", null, "1945-02-24 12:42:25"); if (todo) { // TODO: casting allows one to discard precision without error checkCastToString( "TIMESTAMP '1945-02-24 12:42:25.34'", null, "1945-02-24 12:42:25.34"); } getTester().checkScalar( "cast('1945-02-24 12:42:25' as TIMESTAMP)", "1945-02-24 12:42:25", "TIMESTAMP(0) NOT NULL"); getTester().checkScalar( "cast('1945-2-2 12:2:5' as TIMESTAMP)", "1945-02-02 12:02:05", "TIMESTAMP(0) NOT NULL"); getTester().checkScalar( "cast(' 1945-02-24 12:42:25 ' as TIMESTAMP)", "1945-02-24 12:42:25", "TIMESTAMP(0) NOT NULL"); getTester().checkScalar( "cast('1945-02-24 12:42:25.34' as TIMESTAMP)", "1945-02-24 12:42:25", "TIMESTAMP(0) NOT NULL"); if (Bug.Frg282Fixed) { getTester().checkScalar( "cast('1945-02-24 12:42:25.34' as TIMESTAMP(2))", "1945-02-24 12:42:25.34", "TIMESTAMP(2) NOT NULL"); } getTester().checkFails( "cast('nottime' as TIMESTAMP)", badDatetimeMessage, true); getTester().checkFails( "cast('1241241' as TIMESTAMP)", badDatetimeMessage, true); getTester().checkFails( "cast('1945-20-24 12:42:25.34' as TIMESTAMP)", badDatetimeMessage, true); getTester().checkFails( "cast('1945-01-24 25:42:25.34' as TIMESTAMP)", badDatetimeMessage, true); // date <-> string checkCastToString("DATE '1945-02-24'", null, "1945-02-24"); checkCastToString("DATE '1945-2-24'", null, "1945-02-24"); getTester().checkScalar( "cast('1945-02-24' as DATE)", "1945-02-24", "DATE NOT NULL"); getTester().checkScalar( "cast(' 1945-02-24 ' as DATE)", "1945-02-24", "DATE NOT NULL"); getTester().checkFails( "cast('notdate' as DATE)", badDatetimeMessage, true); getTester().checkFails( "cast('52534253' as DATE)", badDatetimeMessage, true); getTester().checkFails( "cast('1945-30-24' as DATE)", badDatetimeMessage, true); // cast null getTester().checkNull("cast(null as date)"); getTester().checkNull("cast(null as timestamp)"); getTester().checkNull("cast(null as time)"); getTester().checkNull("cast(cast(null as varchar(10)) as time)"); getTester().checkNull("cast(cast(null as varchar(10)) as date)"); getTester().checkNull("cast(cast(null as varchar(10)) as timestamp)"); getTester().checkNull("cast(cast(null as date) as timestamp)"); getTester().checkNull("cast(cast(null as time) as timestamp)"); getTester().checkNull("cast(cast(null as timestamp) as date)"); getTester().checkNull("cast(cast(null as timestamp) as time)"); } /** * Returns a Calendar that is the current time, pausing if we are within * 2 minutes of midnight or the top of the hour. * * @param timeUnit Time unit * @return calendar */ protected static Calendar getCalendarNotTooNear(int timeUnit) { while (true) { final Calendar cal = Calendar.getInstance(); try { switch (timeUnit) { case Calendar.DAY_OF_MONTH: // Within two minutes of the end of the day, wait. if ((cal.get(Calendar.HOUR_OF_DAY) == 23) && (cal.get(Calendar.MINUTE) >= 58)) { Thread.sleep(60 * 1000); continue; } return cal; case Calendar.HOUR_OF_DAY: // Within two minutes of the top of the hour, wait. if ((cal.get(Calendar.MINUTE) >= 58)) { Thread.sleep(60 * 1000); continue; } return cal; default: throw Util.newInternal("unexpected time unit " + timeUnit); } } catch (InterruptedException e) { throw Util.newInternal(e); } } } public void testCastToBoolean() { getTester().setFor(SqlStdOperatorTable.castFunc); // string to boolean getTester().checkBoolean("cast('true' as boolean)", Boolean.TRUE); getTester().checkBoolean("cast('false' as boolean)", Boolean.FALSE); getTester().checkBoolean("cast(' trUe' as boolean)", Boolean.TRUE); getTester().checkBoolean("cast(' fALse' as boolean)", Boolean.FALSE); getTester().checkFails( "cast('unknown' as boolean)", invalidCharMessage, true); getTester().checkBoolean( "cast(cast('true' as varchar(10)) as boolean)", Boolean.TRUE); getTester().checkBoolean( "cast(cast('false' as varchar(10)) as boolean)", Boolean.FALSE); getTester().checkFails( "cast(cast('blah' as varchar(10)) as boolean)", invalidCharMessage, true); } public void testCase() { getTester().setFor(SqlStdOperatorTable.caseOperator); getTester().checkScalarExact("case when 'a'='a' then 1 end", "1"); getTester().checkString( "case 2 when 1 then 'a' when 2 then 'bcd' end", "bcd", "CHAR(3)"); getTester().checkString( "case 1 when 1 then 'a' when 2 then 'bcd' end", "a ", "CHAR(3)"); getTester().checkString( "case 1 when 1 then cast('a' as varchar(1)) " + "when 2 then cast('bcd' as varchar(3)) end", "a", "VARCHAR(3)"); getTester().checkScalarExact( "case 2 when 1 then 11.2 when 2 then 4.543 else null end", "DECIMAL(5, 3)", "4.543"); getTester().checkScalarExact( "case 1 when 1 then 11.2 when 2 then 4.543 else null end", "DECIMAL(5, 3)", "11.200"); getTester().checkScalarExact("case 'a' when 'a' then 1 end", "1"); getTester().checkScalarApprox( "case 1 when 1 then 11.2e0 when 2 then cast(4 as bigint) else 3 end", "DOUBLE NOT NULL", 11.2, 0); getTester().checkScalarApprox( "case 1 when 1 then 11.2e0 when 2 then 4 else null end", "DOUBLE", 11.2, 0); getTester().checkScalarApprox( "case 2 when 1 then 11.2e0 when 2 then 4 else null end", "DOUBLE", 4, 0); getTester().checkScalarApprox( "case 1 when 1 then 11.2e0 when 2 then 4.543 else null end", "DOUBLE", 11.2, 0); getTester().checkScalarApprox( "case 2 when 1 then 11.2e0 when 2 then 4.543 else null end", "DOUBLE", 4.543, 0); getTester().checkNull("case 'a' when 'b' then 1 end"); getTester().checkScalarExact( "case when 'a'=cast(null as varchar(1)) then 1 else 2 end", "2"); if (todo) { getTester().checkScalar( "case 1 when 1 then row(1,2) when 2 then row(2,3) end", "ROW(INTEGER NOT NULL, INTEGER NOT NULL)", "row(1,2)"); getTester().checkScalar( "case 1 when 1 then row('a','b') when 2 then row('ab','cd') end", "ROW(CHAR(2) NOT NULL, CHAR(2) NOT NULL)", "row('a ','b ')"); } // TODO: Check case with multisets } public void testCaseType() { getTester().setFor(SqlStdOperatorTable.caseOperator); getTester().checkType( "case 1 when 1 then current_timestamp else null end", "TIMESTAMP(0)"); getTester().checkType( "case 1 when 1 then current_timestamp else current_timestamp end", "TIMESTAMP(0) NOT NULL"); getTester().checkType( "case when true then current_timestamp else null end", "TIMESTAMP(0)"); getTester().checkType( "case when true then current_timestamp end", "TIMESTAMP(0)"); getTester().checkType( "case 'x' when 'a' then 3 when 'b' then null else 4.5 end", "DECIMAL(11, 1)"); } /** * Tests support for JDBC functions. * * <p>See FRG-97 "Support for JDBC escape syntax is incomplete". */ public void testJdbcFn() { getTester().setFor(new SqlJdbcFunctionCall("dummy")); // There follows one test for each function in appendix C of the JDBC // 3.0 specification. The test is 'if-false'd out if the function is // not implemented or is broken. // Numeric Functions getTester().checkScalar("{fn ABS(-3)}", 3, "INTEGER NOT NULL"); if (false) { getTester().checkScalar("{fn ACOS(float)}", null, ""); } if (false) { getTester().checkScalar("{fn ASIN(float)}", null, ""); } if (false) { getTester().checkScalar("{fn ATAN(float)}", null, ""); } if (false) { getTester().checkScalar("{fn ATAN2(float1, float2)}", null, ""); } if (false) { getTester().checkScalar("{fn CEILING(-2.6)}", 2, ""); } if (false) { getTester().checkScalar("{fn COS(float)}", null, ""); } if (false) { getTester().checkScalar("{fn COT(float)}", null, ""); } if (false) { getTester().checkScalar("{fn DEGREES(number)}", null, ""); } getTester().checkScalarApprox("{fn EXP(2)}", "DOUBLE NOT NULL", 7.389, 0.001); if (false) { getTester().checkScalar("{fn FLOOR(2.6)}", 2, "DOUBLE NOT NULL"); } getTester().checkScalarApprox("{fn LOG(10)}", "DOUBLE NOT NULL", 2.30258, 0.001); getTester().checkScalarApprox("{fn LOG10(100)}", "DOUBLE NOT NULL", 2, 0); getTester().checkScalar("{fn MOD(19, 4)}", 3, "INTEGER NOT NULL"); if (false) { getTester().checkScalar("{fn PI()}", null, ""); } getTester().checkScalar("{fn POWER(2, 3)}", 8.0, "DOUBLE NOT NULL"); if (false) { getTester().checkScalar("{fn RADIANS(number)}", null, ""); } if (false) { getTester().checkScalar("{fn RAND(integer)}", null, ""); } if (false) { getTester().checkScalar("{fn ROUND(number, places)}", null, ""); } if (false) { getTester().checkScalar("{fn SIGN(number)}", null, ""); } if (false) { getTester().checkScalar("{fn SIN(float)}", null, ""); } if (false) { getTester().checkScalar("{fn SQRT(float)}", null, ""); } if (false) { getTester().checkScalar("{fn TAN(float)}", null, ""); } if (false) { getTester().checkScalar("{fn TRUNCATE(number, places)}", null, ""); } // String Functions if (false) { getTester().checkScalar("{fn ASCII(string)}", null, ""); } if (false) { getTester().checkScalar("{fn CHAR(code)}", null, ""); } getTester().checkScalar("{fn CONCAT('foo', 'bar')}", "foobar", "CHAR(6) NOT NULL"); if (false) { getTester().checkScalar("{fn DIFFERENCE(string1, string2)}", null, ""); } // REVIEW: is this result correct? I think it should be "abcCdef" getTester().checkScalar("{fn INSERT('abc', 1, 2, 'ABCdef')}", "ABCdefc", "VARCHAR(9) NOT NULL"); getTester().checkScalar("{fn LCASE('foo' || 'bar')}", "foobar", "CHAR(6) NOT NULL"); if (false) { getTester().checkScalar("{fn LEFT(string, count)}", null, ""); } if (false) { getTester().checkScalar("{fn LENGTH(string)}", null, ""); } getTester().checkScalar("{fn LOCATE('ha', 'alphabet')}", 4, "INTEGER NOT NULL"); // only the 2 arg version of locate is implemented if (false) { getTester().checkScalar("{fn LOCATE(string1, string2[, start])}", null, ""); } // ltrim is implemented but has a bug in arg checking if (false) { getTester().checkScalar("{fn LTRIM(' xxx ')}", "xxx", "VARCHAR(6)"); } if (false) { getTester().checkScalar("{fn REPEAT(string, count)}", null, ""); } if (false) { getTester().checkScalar("{fn REPLACE(string1, string2, string3)}", null, ""); } if (false) { getTester().checkScalar("{fn RIGHT(string, count)}", null, ""); } // rtrim is implemented but has a bug in arg checking if (false) { getTester().checkScalar("{fn RTRIM(' xxx ')}", "xxx", "VARCHAR(6)"); } if (false) { getTester().checkScalar("{fn SOUNDEX(string)}", null, ""); } if (false) { getTester().checkScalar("{fn SPACE(count)}", null, ""); } getTester().checkScalar("{fn SUBSTRING('abcdef', 2, 3)}", "bcd", "VARCHAR(6) NOT NULL"); getTester().checkScalar("{fn UCASE('xxx')}", "XXX", "CHAR(3) NOT NULL"); // Time and Date Functions getTester().checkType("{fn CURDATE()}", "DATE NOT NULL"); getTester().checkType("{fn CURTIME()}", "TIME(0) NOT NULL"); if (false) { getTester().checkScalar("{fn DAYNAME(date)}", null, ""); } if (false) { getTester().checkScalar("{fn DAYOFMONTH(date)}", null, ""); } if (false) { getTester().checkScalar("{fn DAYOFWEEK(date)}", null, ""); } if (false) { getTester().checkScalar("{fn DAYOFYEAR(date)}", null, ""); } if (false) { getTester().checkScalar("{fn HOUR(time)}", null, ""); } if (false) { getTester().checkScalar("{fn MINUTE(time)}", null, ""); } if (false) { getTester().checkScalar("{fn MONTH(date)}", null, ""); } if (false) { getTester().checkScalar("{fn MONTHNAME(date)}", null, ""); } getTester().checkType("{fn NOW()}", "TIMESTAMP(0) NOT NULL"); if (false) { getTester().checkScalar("{fn QUARTER(date)}", null, ""); } if (false) { getTester().checkScalar("{fn SECOND(time)}", null, ""); } if (false) { getTester().checkScalar("{fn TIMESTAMPADD(interval, count, timestamp)}", null, ""); } if (false) { getTester().checkScalar("{fn TIMESTAMPDIFF(interval, timestamp1, timestamp2)}", null, ""); } if (false) { getTester().checkScalar("{fn WEEK(date)}", null, ""); } if (false) { getTester().checkScalar("{fn YEAR(date)}", null, ""); } // System Functions if (false) { getTester().checkScalar("{fn DATABASE()}", null, ""); } if (false) { getTester().checkScalar("{fn IFNULL(expression, value)}", null, ""); } if (false) { getTester().checkScalar("{fn USER()}", null, ""); } // Conversion Functions if (false) { getTester().checkScalar("{fn CONVERT(value, SQLtype)}", null, ""); } } public void testSelect() { getTester().setFor(SqlStdOperatorTable.selectOperator, VM_EXPAND); getTester().check( "select * from (values(1))", AbstractSqlTester.IntegerTypeChecker, "1", 0); // Check return type on scalar subquery in select list. Note return // type is always nullable even if subquery select value is NOT NULL. // Bug FRG-189 causes this test to fail only in SqlOperatorTest; not // in subtypes. if (Bug.Frg189Fixed || getClass() != SqlOperatorTest.class) { getTester().checkType( "SELECT *,(SELECT * FROM (VALUES(1))) FROM (VALUES(2))", "RecordType(INTEGER NOT NULL EXPR$0, INTEGER EXPR$1) NOT NULL"); getTester().checkType( "SELECT *,(SELECT * FROM (VALUES(CAST(10 as BIGINT)))) " + "FROM (VALUES(CAST(10 as bigint)))", "RecordType(BIGINT NOT NULL EXPR$0, BIGINT EXPR$1) NOT NULL"); getTester().checkType( " SELECT *,(SELECT * FROM (VALUES(10.5))) FROM (VALUES(10.5))", "RecordType(DECIMAL(3, 1) NOT NULL EXPR$0, DECIMAL(3, 1) EXPR$1) NOT NULL"); getTester().checkType( "SELECT *,(SELECT * FROM (VALUES('this is a char'))) " + "FROM (VALUES('this is a char too'))", "RecordType(CHAR(18) NOT NULL EXPR$0, CHAR(14) EXPR$1) NOT NULL"); getTester().checkType( "SELECT *,(SELECT * FROM (VALUES(true))) FROM (values(false))", "RecordType(BOOLEAN NOT NULL EXPR$0, BOOLEAN EXPR$1) NOT NULL"); getTester().checkType( " SELECT *,(SELECT * FROM (VALUES(cast('abcd' as varchar(10))))) " + "FROM (VALUES(CAST('abcd' as varchar(10))))", "RecordType(VARCHAR(10) NOT NULL EXPR$0, VARCHAR(10) EXPR$1) NOT NULL"); getTester().checkType( "SELECT *," + " (SELECT * FROM (VALUES(TIMESTAMP '2006-01-01 12:00:05'))) " + "FROM (VALUES(TIMESTAMP '2006-01-01 12:00:05'))", "RecordType(TIMESTAMP(0) NOT NULL EXPR$0, TIMESTAMP(0) EXPR$1) NOT NULL"); } } public void testLiteralChain() { getTester().setFor(SqlStdOperatorTable.literalChainOperator, VM_EXPAND); getTester().checkString( "'buttered'\n' toast'", "buttered toast", "CHAR(14) NOT NULL"); getTester().checkString( "'corned'\n' beef'\n' on'\n' rye'", "corned beef on rye", "CHAR(18) NOT NULL"); getTester().checkString( "_latin1'Spaghetti'\n' all''Amatriciana'", "Spaghetti all'Amatriciana", "CHAR(25) NOT NULL"); getTester().checkBoolean("x'1234'\n'abcd' = x'1234abcd'", Boolean.TRUE); getTester().checkBoolean("x'1234'\n'' = x'1234'", Boolean.TRUE); getTester().checkBoolean("x''\n'ab' = x'ab'", Boolean.TRUE); } public void testRow() { getTester().setFor(SqlStdOperatorTable.rowConstructor, VM_FENNEL); } public void testAndOperator() { getTester().setFor(SqlStdOperatorTable.andOperator); getTester().checkBoolean("true and false", Boolean.FALSE); getTester().checkBoolean("true and true", Boolean.TRUE); getTester().checkBoolean( "cast(null as boolean) and false", Boolean.FALSE); getTester().checkBoolean( "false and cast(null as boolean)", Boolean.FALSE); getTester().checkNull("cast(null as boolean) and true"); getTester().checkBoolean("true and (not false)", Boolean.TRUE); } public void testConcatOperator() { getTester().setFor(SqlStdOperatorTable.concatOperator); getTester().checkString(" 'a'||'b' ", "ab", "CHAR(2) NOT NULL"); if (todo) { // not yet implemented getTester().checkString( " x'f'||x'f' ", "X'FF", "BINARY(1) NOT NULL"); getTester().checkNull("x'ff' || cast(null as varbinary)"); } } public void testDivideOperator() { getTester().setFor(SqlStdOperatorTable.divideOperator); getTester().checkScalarExact("10 / 5", "2"); getTester().checkScalarExact("-10 / 5", "-2"); getTester().checkScalarExact("1 / 3", "0"); getTester().checkScalarApprox( " cast(10.0 as double) / 5", "DOUBLE NOT NULL", 2.0, 0); getTester().checkScalarApprox( " cast(10.0 as real) / 5", "REAL NOT NULL", 2.0, 0); getTester().checkScalarApprox( " 6.0 / cast(10.0 as real) ", "DOUBLE NOT NULL", 0.6, 0); getTester().checkScalarExact( "10.0 / 5.0", "DECIMAL(9, 6) NOT NULL", "2.000000"); getTester().checkScalarExact( "1.0 / 3.0", "DECIMAL(8, 6) NOT NULL", "0.333333"); getTester().checkScalarExact( "100.1 / 0.0001", "DECIMAL(14, 7) NOT NULL", "1001000.0000000"); getTester().checkScalarExact( "100.1 / 0.00000001", "DECIMAL(19, 8) NOT NULL", "10010000000.00000000"); getTester().checkNull("1e1 / cast(null as float)"); getTester().checkFails( "100.1 / 0.00000000000000001", outOfRangeMessage, true); // Intervals getTester().checkScalar( "interval '-2:2' hour to minute / 3", "-0:40", "INTERVAL HOUR TO MINUTE NOT NULL"); getTester().checkScalar( "interval '2:5:12' hour to second / 2 / -3", "-0:20:52", "INTERVAL HOUR TO SECOND NOT NULL"); getTester().checkNull( "interval '2' day / cast(null as bigint)"); getTester().checkNull( "cast(null as interval month) / 2"); if (todo) { getTester().checkScalar( "interval '3-3' year to month / 15e-1", "+02-02", "INTERVAL YEAR TO MONTH NOT NULL"); getTester().checkScalar( "interval '3-4' year to month / 4.5", "+00-08", "INTERVAL YEAR TO MONTH NOT NULL"); } } public void testEqualsOperator() { getTester().setFor(SqlStdOperatorTable.equalsOperator); getTester().checkBoolean("1=1", Boolean.TRUE); getTester().checkBoolean("1=1.0", Boolean.TRUE); getTester().checkBoolean("1.34=1.34", Boolean.TRUE); getTester().checkBoolean("1=1.34", Boolean.FALSE); getTester().checkBoolean("1e2=100e0", Boolean.TRUE); getTester().checkBoolean("1e2=101", Boolean.FALSE); getTester().checkBoolean( "cast(1e2 as real)=cast(101 as bigint)", Boolean.FALSE); getTester().checkBoolean("'a'='b'", Boolean.FALSE); getTester().checkBoolean( "cast('a' as varchar(30))=cast('a' as varchar(30))", Boolean.TRUE); getTester().checkBoolean( "cast('a ' as varchar(30))=cast('a' as varchar(30))", Boolean.TRUE); getTester().checkBoolean( "cast('a' as varchar(30))=cast('b' as varchar(30))", Boolean.FALSE); getTester().checkBoolean( "cast('a' as varchar(30))=cast('a' as varchar(15))", Boolean.TRUE); getTester().checkNull("cast(null as boolean)=cast(null as boolean)"); getTester().checkNull("cast(null as integer)=1"); getTester().checkNull("cast(null as varchar(10))='a'"); // Intervals getTester().checkBoolean( "interval '2' day = interval '1' day", Boolean.FALSE); getTester().checkBoolean( "interval '2' day = interval '2' day", Boolean.TRUE); getTester().checkBoolean( "interval '2:2:2' hour to second = interval '2' hour", Boolean.FALSE); getTester().checkNull( "cast(null as interval hour) = interval '2' minute"); } public void testGreaterThanOperator() { getTester().setFor(SqlStdOperatorTable.greaterThanOperator); getTester().checkBoolean("1>2", Boolean.FALSE); getTester().checkBoolean( "cast(-1 as TINYINT)>cast(1 as TINYINT)", Boolean.FALSE); getTester().checkBoolean( "cast(1 as SMALLINT)>cast(1 as SMALLINT)", Boolean.FALSE); getTester().checkBoolean("2>1", Boolean.TRUE); getTester().checkBoolean("1.1>1.2", Boolean.FALSE); getTester().checkBoolean("-1.1>-1.2", Boolean.TRUE); getTester().checkBoolean("1.1>1.1", Boolean.FALSE); getTester().checkBoolean("1.2>1", Boolean.TRUE); getTester().checkBoolean("1.1e1>1.2e1", Boolean.FALSE); getTester().checkBoolean( "cast(-1.1 as real) > cast(-1.2 as real)", Boolean.TRUE); getTester().checkBoolean("1.1e2>1.1e2", Boolean.FALSE); getTester().checkBoolean("1.2e0>1", Boolean.TRUE); getTester().checkBoolean("cast(1.2e0 as real)>1", Boolean.TRUE); getTester().checkBoolean("true>false", Boolean.TRUE); getTester().checkBoolean("true>true", Boolean.FALSE); getTester().checkBoolean("false>false", Boolean.FALSE); getTester().checkBoolean("false>true", Boolean.FALSE); getTester().checkNull("3.0>cast(null as double)"); // Intervals getTester().checkBoolean( "interval '2' day > interval '1' day", Boolean.TRUE); getTester().checkBoolean( "interval '2' day > interval '5' day", Boolean.FALSE); getTester().checkBoolean( "interval '2 2:2:2' day to second > interval '2' day", Boolean.TRUE); getTester().checkBoolean( "interval '2' day > interval '2' day", Boolean.FALSE); getTester().checkBoolean( "interval '2' day > interval '-2' day", Boolean.TRUE); getTester().checkBoolean( "interval '2' day > interval '2' hour", Boolean.TRUE); getTester().checkBoolean( "interval '2' minute > interval '2' hour", Boolean.FALSE); getTester().checkBoolean( "interval '2' second > interval '2' minute", Boolean.FALSE); getTester().checkNull( "cast(null as interval hour) > interval '2' minute"); getTester().checkNull( "interval '2:2' hour to minute > cast(null as interval second)"); } public void testIsDistinctFromOperator() { getTester().setFor( SqlStdOperatorTable.isDistinctFromOperator, VM_EXPAND); getTester().checkBoolean("1 is distinct from 1", Boolean.FALSE); getTester().checkBoolean("1 is distinct from 1.0", Boolean.FALSE); getTester().checkBoolean("1 is distinct from 2", Boolean.TRUE); getTester().checkBoolean( "cast(null as integer) is distinct from 2", Boolean.TRUE); getTester().checkBoolean( "cast(null as integer) is distinct from cast(null as integer)", Boolean.FALSE); getTester().checkBoolean("1.23 is distinct from 1.23", Boolean.FALSE); getTester().checkBoolean("1.23 is distinct from 5.23", Boolean.TRUE); getTester().checkBoolean( "-23e0 is distinct from -2.3e1", Boolean.FALSE); // IS DISTINCT FROM not implemented for ROW yet if (false) { getTester().checkBoolean( "row(1,1) is distinct from row(1,1)", true); getTester().checkBoolean( "row(1,1) is distinct from row(1,2)", false); } // Intervals getTester().checkBoolean( "interval '2' day is distinct from interval '1' day", Boolean.TRUE); getTester().checkBoolean( "interval '10' hour is distinct from interval '10' hour", Boolean.FALSE); } public void testIsNotDistinctFromOperator() { getTester().setFor( SqlStdOperatorTable.isNotDistinctFromOperator, VM_EXPAND); getTester().checkBoolean("1 is not distinct from 1", Boolean.TRUE); getTester().checkBoolean("1 is not distinct from 1.0", Boolean.TRUE); getTester().checkBoolean("1 is not distinct from 2", Boolean.FALSE); getTester().checkBoolean( "cast(null as integer) is not distinct from 2", Boolean.FALSE); getTester().checkBoolean( "cast(null as integer) is not distinct from cast(null as integer)", Boolean.TRUE); getTester().checkBoolean( "1.23 is not distinct from 1.23", Boolean.TRUE); getTester().checkBoolean( "1.23 is not distinct from 5.23", Boolean.FALSE); getTester().checkBoolean( "-23e0 is not distinct from -2.3e1", Boolean.TRUE); // IS NOT DISTINCT FROM not implemented for ROW yet if (false) { getTester().checkBoolean( "row(1,1) is not distinct from row(1,1)", false); getTester().checkBoolean( "row(1,1) is not distinct from row(1,2)", true); } // Intervals getTester().checkBoolean( "interval '2' day is not distinct from interval '1' day", Boolean.FALSE); getTester().checkBoolean( "interval '10' hour is not distinct from interval '10' hour", Boolean.TRUE); } public void testGreaterThanOrEqualOperator() { getTester().setFor(SqlStdOperatorTable.greaterThanOrEqualOperator); getTester().checkBoolean("1>=2", Boolean.FALSE); getTester().checkBoolean("-1>=1", Boolean.FALSE); getTester().checkBoolean("1>=1", Boolean.TRUE); getTester().checkBoolean("2>=1", Boolean.TRUE); getTester().checkBoolean("1.1>=1.2", Boolean.FALSE); getTester().checkBoolean("-1.1>=-1.2", Boolean.TRUE); getTester().checkBoolean("1.1>=1.1", Boolean.TRUE); getTester().checkBoolean("1.2>=1", Boolean.TRUE); getTester().checkBoolean("1.2e4>=1e5", Boolean.FALSE); getTester().checkBoolean("1.2e4>=cast(1e5 as real)", Boolean.FALSE); getTester().checkBoolean("1.2>=cast(1e5 as double)", Boolean.FALSE); getTester().checkBoolean("120000>=cast(1e5 as real)", Boolean.TRUE); getTester().checkBoolean("true>=false", Boolean.TRUE); getTester().checkBoolean("true>=true", Boolean.TRUE); getTester().checkBoolean("false>=false", Boolean.TRUE); getTester().checkBoolean("false>=true", Boolean.FALSE); getTester().checkNull("cast(null as real)>=999"); // Intervals getTester().checkBoolean( "interval '2' day >= interval '1' day", Boolean.TRUE); getTester().checkBoolean( "interval '2' day >= interval '5' day", Boolean.FALSE); getTester().checkBoolean( "interval '2 2:2:2' day to second >= interval '2' day", Boolean.TRUE); getTester().checkBoolean( "interval '2' day >= interval '2' day", Boolean.TRUE); getTester().checkBoolean( "interval '2' day >= interval '-2' day", Boolean.TRUE); getTester().checkBoolean( "interval '2' day >= interval '2' hour", Boolean.TRUE); getTester().checkBoolean( "interval '2' minute >= interval '2' hour", Boolean.FALSE); getTester().checkBoolean( "interval '2' second >= interval '2' minute", Boolean.FALSE); getTester().checkNull( "cast(null as interval hour) >= interval '2' minute"); getTester().checkNull( "interval '2:2' hour to minute >= cast(null as interval second)"); } public void testInOperator() { getTester().setFor(SqlStdOperatorTable.inOperator, VM_EXPAND); getTester().checkBoolean("1 in (0, 1, 2)", true); getTester().checkBoolean("3 in (0, 1, 2)", false); getTester().checkBoolean("cast(null as integer) in (0, 1, 2)", null); getTester().checkBoolean( "cast(null as integer) in (0, cast(null as integer), 2)", null); if (Bug.Frg327Fixed) { getTester().checkBoolean( "cast(null as integer) in (0, null, 2)", null); getTester().checkBoolean("1 in (0, null, 2)", null); } // AND has lower precedence than IN getTester().checkBoolean("false and true in (false, false)", false); getTester().checkFails( "'foo' in (^)^", "(?s).*Encountered \"\\)\" at .*", false); } public void testNotInOperator() { getTester().setFor(SqlStdOperatorTable.notInOperator, VM_EXPAND); getTester().checkBoolean("1 not in (0, 1, 2)", false); getTester().checkBoolean("3 not in (0, 1, 2)", true); getTester().checkBoolean( "cast(null as integer) not in (0, 1, 2)", null); getTester().checkBoolean( "cast(null as integer) not in (0, cast(null as integer), 2)", null); if (Bug.Frg327Fixed) { getTester().checkBoolean( "cast(null as integer) not in (0, null, 2)", null); getTester().checkBoolean("1 not in (0, null, 2)", null); } // AND has lower precedence than NOT IN getTester().checkBoolean("true and false not in (true, true)", true); getTester().checkFails( "'foo' not in (^)^", "(?s).*Encountered \"\\)\" at .*", false); } public void testOverlapsOperator() { getTester().setFor(SqlStdOperatorTable.overlapsOperator, VM_EXPAND); if (Bug.Frg187Fixed) { getTester().checkBoolean( "(date '1-2-3', date '1-2-3') overlaps (date '1-2-3', interval '1' year)", Boolean.TRUE); getTester().checkBoolean( "(date '1-2-3', date '1-2-3') overlaps (date '4-5-6', interval '1' year)", Boolean.FALSE); getTester().checkBoolean( "(date '1-2-3', date '4-5-6') overlaps (date '2-2-3', date '3-4-5')", Boolean.TRUE); getTester().checkNull( "(cast(null as date), date '1-2-3') overlaps (date '1-2-3', interval '1' year)"); getTester().checkNull( "(date '1-2-3', date '1-2-3') overlaps (date '1-2-3', cast(null as date))"); getTester().checkBoolean( "(time '1:2:3', interval '1' second) overlaps (time '23:59:59', time '1:2:3')", Boolean.TRUE); getTester().checkBoolean( "(time '1:2:3', interval '1' second) overlaps (time '23:59:59', time '1:2:2')", Boolean.FALSE); getTester().checkBoolean( "(time '1:2:3', interval '1' second) overlaps (time '23:59:59', interval '2' hour)", Boolean.TRUE); getTester().checkNull( "(time '1:2:3', cast(null as time)) overlaps (time '23:59:59', time '1:2:3')"); getTester().checkNull( "(time '1:2:3', interval '1' second) overlaps (time '23:59:59', cast(null as interval hour))"); getTester().checkBoolean( "(timestamp '1-2-3 4:5:6', timestamp '1-2-3 4:5:6' ) overlaps (timestamp '1-2-3 4:5:6', interval '1 2:3:4.5' day to second)", Boolean.TRUE); getTester().checkBoolean( "(timestamp '1-2-3 4:5:6', timestamp '1-2-3 4:5:6' ) overlaps (timestamp '2-2-3 4:5:6', interval '1 2:3:4.5' day to second)", Boolean.FALSE); getTester().checkNull( "(timestamp '1-2-3 4:5:6', cast(null as interval day) ) overlaps (timestamp '1-2-3 4:5:6', interval '1 2:3:4.5' day to second)"); getTester().checkNull( "(timestamp '1-2-3 4:5:6', timestamp '1-2-3 4:5:6' ) overlaps (cast(null as timestamp), interval '1 2:3:4.5' day to second)"); } } public void testLessThanOperator() { getTester().setFor(SqlStdOperatorTable.lessThanOperator); getTester().checkBoolean("1<2", Boolean.TRUE); getTester().checkBoolean("-1<1", Boolean.TRUE); getTester().checkBoolean("1<1", Boolean.FALSE); getTester().checkBoolean("2<1", Boolean.FALSE); getTester().checkBoolean("1.1<1.2", Boolean.TRUE); getTester().checkBoolean("-1.1<-1.2", Boolean.FALSE); getTester().checkBoolean("1.1<1.1", Boolean.FALSE); getTester().checkBoolean("cast(1.1 as real)<1", Boolean.FALSE); getTester().checkBoolean("cast(1.1 as real)<1.1", Boolean.FALSE); getTester().checkBoolean( "cast(1.1 as real)<cast(1.2 as real)", Boolean.TRUE); getTester().checkBoolean("-1.1e-1<-1.2e-1", Boolean.FALSE); getTester().checkBoolean( "cast(1.1 as real)<cast(1.1 as double)", Boolean.FALSE); getTester().checkBoolean("true<false", Boolean.FALSE); getTester().checkBoolean("true<true", Boolean.FALSE); getTester().checkBoolean("false<false", Boolean.FALSE); getTester().checkBoolean("false<true", Boolean.TRUE); getTester().checkNull("123<cast(null as bigint)"); getTester().checkNull("cast(null as tinyint)<123"); getTester().checkNull("cast(null as integer)<1.32"); // Intervals getTester().checkBoolean( "interval '2' day < interval '1' day", Boolean.FALSE); getTester().checkBoolean( "interval '2' day < interval '5' day", Boolean.TRUE); getTester().checkBoolean( "interval '2 2:2:2' day to second < interval '2' day", Boolean.FALSE); getTester().checkBoolean( "interval '2' day < interval '2' day", Boolean.FALSE); getTester().checkBoolean( "interval '2' day < interval '-2' day", Boolean.FALSE); getTester().checkBoolean( "interval '2' day < interval '2' hour", Boolean.FALSE); getTester().checkBoolean( "interval '2' minute < interval '2' hour", Boolean.TRUE); getTester().checkBoolean( "interval '2' second < interval '2' minute", Boolean.TRUE); getTester().checkNull( "cast(null as interval hour) < interval '2' minute"); getTester().checkNull( "interval '2:2' hour to minute < cast(null as interval second)"); } public void testLessThanOrEqualOperator() { getTester().setFor(SqlStdOperatorTable.lessThanOrEqualOperator); getTester().checkBoolean("1<=2", Boolean.TRUE); getTester().checkBoolean("1<=1", Boolean.TRUE); getTester().checkBoolean("-1<=1", Boolean.TRUE); getTester().checkBoolean("2<=1", Boolean.FALSE); getTester().checkBoolean("1.1<=1.2", Boolean.TRUE); getTester().checkBoolean("-1.1<=-1.2", Boolean.FALSE); getTester().checkBoolean("1.1<=1.1", Boolean.TRUE); getTester().checkBoolean("1.2<=1", Boolean.FALSE); getTester().checkBoolean("1<=cast(1e2 as real)", Boolean.TRUE); getTester().checkBoolean("1000<=cast(1e2 as real)", Boolean.FALSE); getTester().checkBoolean("1.2e1<=1e2", Boolean.TRUE); getTester().checkBoolean("1.2e1<=cast(1e2 as real)", Boolean.TRUE); getTester().checkBoolean("true<=false", Boolean.FALSE); getTester().checkBoolean("true<=true", Boolean.TRUE); getTester().checkBoolean("false<=false", Boolean.TRUE); getTester().checkBoolean("false<=true", Boolean.TRUE); getTester().checkNull("cast(null as real)<=cast(1 as real)"); getTester().checkNull("cast(null as integer)<=3"); getTester().checkNull("3<=cast(null as smallint)"); getTester().checkNull("cast(null as integer)<=1.32"); // Intervals getTester().checkBoolean( "interval '2' day <= interval '1' day", Boolean.FALSE); getTester().checkBoolean( "interval '2' day <= interval '5' day", Boolean.TRUE); getTester().checkBoolean( "interval '2 2:2:2' day to second <= interval '2' day", Boolean.FALSE); getTester().checkBoolean( "interval '2' day <= interval '2' day", Boolean.TRUE); getTester().checkBoolean( "interval '2' day <= interval '-2' day", Boolean.FALSE); getTester().checkBoolean( "interval '2' day <= interval '2' hour", Boolean.FALSE); getTester().checkBoolean( "interval '2' minute <= interval '2' hour", Boolean.TRUE); getTester().checkBoolean( "interval '2' second <= interval '2' minute", Boolean.TRUE); getTester().checkNull( "cast(null as interval hour) <= interval '2' minute"); getTester().checkNull( "interval '2:2' hour to minute <= cast(null as interval second)"); } public void testMinusOperator() { getTester().setFor(SqlStdOperatorTable.minusOperator); getTester().checkScalarExact("-2-1", "-3"); getTester().checkScalarExact("-2-1-5", "-8"); getTester().checkScalarExact("2-1", "1"); getTester().checkScalarApprox( "cast(2.0 as double) -1", "DOUBLE NOT NULL", 1, 0); getTester().checkScalarApprox( "cast(1 as smallint)-cast(2.0 as real)", "REAL NOT NULL", -1, 0); getTester().checkScalarApprox( "2.4-cast(2.0 as real)", "DOUBLE NOT NULL", 0.4, 0.00000001); getTester().checkScalarExact("1-2", "-1"); getTester().checkScalarExact( "10.0 - 5.0", "DECIMAL(4, 1) NOT NULL", "5.0"); getTester().checkScalarExact( "19.68 - 4.2", "DECIMAL(5, 2) NOT NULL", "15.48"); getTester().checkNull("1e1-cast(null as double)"); getTester().checkNull("cast(null as tinyint) - cast(null as smallint)"); // TODO: Fix bug if (Bug.Fnl25Fixed) { // Should throw out of range error getTester().checkFails( "cast(100 as tinyint) - cast(-100 as tinyint)", outOfRangeMessage, true); getTester().checkFails( "cast(-20000 as smallint) - cast(20000 as smallint)", outOfRangeMessage, true); getTester().checkFails( "cast(1.5e9 as integer) - cast(-1.5e9 as integer)", outOfRangeMessage, true); getTester().checkFails( "cast(-5e18 as bigint) - cast(5e18 as bigint)", outOfRangeMessage, true); getTester().checkFails( "cast(5e18 as decimal(19,0)) - cast(-5e18 as decimal(19,0))", outOfRangeMessage, true); getTester().checkFails( "cast(-5e8 as decimal(19,10)) - cast(5e8 as decimal(19,10))", outOfRangeMessage, true); } } public void testMinusIntervalOperator() { getTester().setFor(SqlStdOperatorTable.minusOperator); // Intervals getTester().checkScalar( "interval '2' day - interval '1' day", "+1", "INTERVAL DAY NOT NULL"); getTester().checkScalar( "interval '2' day - interval '1' minute", "+1 23:59", "INTERVAL DAY TO MINUTE NOT NULL"); getTester().checkScalar( "interval '2' year - interval '1' month", "+1-11", "INTERVAL YEAR TO MONTH NOT NULL"); getTester().checkScalar( "interval '2' year - interval '1' month - interval '3' year", "-1-01", "INTERVAL YEAR TO MONTH NOT NULL"); getTester().checkNull( "cast(null as interval day) + interval '2' hour"); // Datetime minus interval getTester().checkScalar( "time '12:03:01' - interval '1:1' hour to minute", "11:02:01", "TIME(0) NOT NULL"); getTester().checkScalar( "date '2005-03-02' - interval '5' day", "2005-02-25", "DATE NOT NULL"); getTester().checkScalar( "timestamp '2003-08-02 12:54:01' - interval '-4 2:4' day to minute", "2003-08-06 14:58:01", "TIMESTAMP(0) NOT NULL"); // TODO: Tests with interval year months (not supported) } public void testMinusDateOperator() { getTester().setFor(SqlStdOperatorTable.minusDateOperator); getTester().checkScalar( "(time '12:03:34' - time '11:57:23') minute to second", "+6:11", "INTERVAL MINUTE TO SECOND NOT NULL"); getTester().checkScalar( "(time '12:03:23' - time '11:57:23') minute", "+6", "INTERVAL MINUTE NOT NULL"); getTester().checkScalar( "(time '12:03:34' - time '11:57:23') minute", "+6", "INTERVAL MINUTE NOT NULL"); getTester().checkScalar( "(timestamp '2004-05-01 12:03:34' - timestamp '2004-04-29 11:57:23') day to second", "+2 00:06:11", "INTERVAL DAY TO SECOND NOT NULL"); getTester().checkScalar( "(timestamp '2004-05-01 12:03:34' - timestamp '2004-04-29 11:57:23') day to hour", "+2 00", "INTERVAL DAY TO HOUR NOT NULL"); getTester().checkScalar( "(date '2004-12-02' - date '2003-12-01') day", "+367", "INTERVAL DAY NOT NULL"); getTester().checkNull( "(cast(null as date) - date '2003-12-01') day"); // combine '<datetime> + <interval>' with '<datetime> - <datetime>' getTester().checkScalar( "timestamp '1969-04-29 0:0:0' +" + " (timestamp '2008-07-15 15:28:00' - " + " timestamp '1969-04-29 0:0:0') day to second / 2", "1988-12-06 07:44:00", "TIMESTAMP(0) NOT NULL"); getTester().checkScalar( "date '1969-04-29' +" + " (date '2008-07-15' - " + " date '1969-04-29') day / 2", "1988-12-06", "DATE NOT NULL"); getTester().checkScalar( "time '01:23:44' +" + " (time '15:28:00' - " + " time '01:23:44') hour to second / 2", "08:25:52", "TIME(0) NOT NULL"); if (Bug.Dt1684Fixed) { getTester().checkBoolean( "(date '1969-04-29' +" + " (CURRENT_DATE - " + " date '1969-04-29') day / 2) is not null", Boolean.TRUE); } // TODO: Add tests for year month intervals (currently not supported) } public void testMultiplyOperator() { getTester().setFor(SqlStdOperatorTable.multiplyOperator); getTester().checkScalarExact("2*3", "6"); getTester().checkScalarExact("2*-3", "-6"); getTester().checkScalarExact("+2*3", "6"); getTester().checkScalarExact("2*0", "0"); getTester().checkScalarApprox( "cast(2.0 as float)*3", "FLOAT NOT NULL", 6, 0); getTester().checkScalarApprox( "3*cast(2.0 as real)", "REAL NOT NULL", 6, 0); getTester().checkScalarApprox( "cast(2.0 as real)*3.2", "DOUBLE NOT NULL", 6.4, 0); getTester().checkScalarExact( "10.0 * 5.0", "DECIMAL(5, 2) NOT NULL", "50.00"); getTester().checkScalarExact( "19.68 * 4.2", "DECIMAL(6, 3) NOT NULL", "82.656"); getTester().checkNull("cast(1 as real)*cast(null as real)"); getTester().checkNull("2e-3*cast(null as integer)"); getTester().checkNull("cast(null as tinyint) * cast(4 as smallint)"); if (Bug.Fnl25Fixed) { // Should throw out of range error getTester().checkFails( "cast(100 as tinyint) * cast(-2 as tinyint)", outOfRangeMessage, true); getTester().checkFails( "cast(200 as smallint) * cast(200 as smallint)", outOfRangeMessage, true); getTester().checkFails( "cast(1.5e9 as integer) * cast(-2 as integer)", outOfRangeMessage, true); getTester().checkFails( "cast(5e9 as bigint) * cast(2e9 as bigint)", outOfRangeMessage, true); getTester().checkFails( "cast(2e9 as decimal(19,0)) * cast(-5e9 as decimal(19,0))", outOfRangeMessage, true); getTester().checkFails( "cast(5e4 as decimal(19,10)) * cast(2e4 as decimal(19,10))", outOfRangeMessage, true); } // Intervals getTester().checkScalar( "interval '2:2' hour to minute * 3", "+6:06", "INTERVAL HOUR TO MINUTE NOT NULL"); getTester().checkScalar( "3 * 2 * interval '2:5:12' hour to second", "+12:31:12", "INTERVAL HOUR TO SECOND NOT NULL"); getTester().checkNull( "interval '2' day * cast(null as bigint)"); getTester().checkNull( "cast(null as interval month) * 2"); if (todo) { getTester().checkScalar( "interval '3-2' year to month * 15e-1", "+04-09", "INTERVAL YEAR TO MONTH NOT NULL"); getTester().checkScalar( "interval '3-4' year to month * 4.5", "+15-00", "INTERVAL YEAR TO MONTH NOT NULL"); } } public void testNotEqualsOperator() { getTester().setFor(SqlStdOperatorTable.notEqualsOperator); getTester().checkBoolean("1<>1", Boolean.FALSE); getTester().checkBoolean("'a'<>'A'", Boolean.TRUE); getTester().checkBoolean("1e0<>1e1", Boolean.TRUE); getTester().checkNull("'a'<>cast(null as varchar(1))"); // Intervals getTester().checkBoolean( "interval '2' day <> interval '1' day", Boolean.TRUE); getTester().checkBoolean( "interval '2' day <> interval '2' day", Boolean.FALSE); getTester().checkBoolean( "interval '2:2:2' hour to second <> interval '2' hour", Boolean.TRUE); getTester().checkNull( "cast(null as interval hour) <> interval '2' minute"); // "!=" is not an acceptable alternative to "<>" getTester().checkFails( "1 ^!^= 1", "(?s).*Encountered: \"!\" \\(33\\).*", false); } public void testOrOperator() { getTester().setFor(SqlStdOperatorTable.orOperator); getTester().checkBoolean("true or false", Boolean.TRUE); getTester().checkBoolean("false or false", Boolean.FALSE); getTester().checkBoolean("true or cast(null as boolean)", Boolean.TRUE); getTester().checkNull("false or cast(null as boolean)"); } public void testPlusOperator() { getTester().setFor(SqlStdOperatorTable.plusOperator); getTester().checkScalarExact("1+2", "3"); getTester().checkScalarExact("-1+2", "1"); getTester().checkScalarExact("1+2+3", "6"); getTester().checkScalarApprox( "1+cast(2.0 as double)", "DOUBLE NOT NULL", 3, 0); getTester().checkScalarApprox( "1+cast(2.0 as double)+cast(6.0 as float)", "DOUBLE NOT NULL", 9, 0); getTester().checkScalarExact( "10.0 + 5.0", "DECIMAL(4, 1) NOT NULL", "15.0"); getTester().checkScalarExact( "19.68 + 4.2", "DECIMAL(5, 2) NOT NULL", "23.88"); getTester().checkScalarExact( "19.68 + 4.2 + 6", "DECIMAL(13, 2) NOT NULL", "29.88"); getTester().checkScalarApprox( "19.68 + cast(4.2 as float)", "DOUBLE NOT NULL", 23.88, 0); getTester().checkNull("cast(null as tinyint)+1"); getTester().checkNull("1e-2+cast(null as double)"); if (Bug.Fnl25Fixed) { // Should throw out of range error getTester().checkFails( "cast(100 as tinyint) + cast(100 as tinyint)", outOfRangeMessage, true); getTester().checkFails( "cast(-20000 as smallint) + cast(-20000 as smallint)", outOfRangeMessage, true); getTester().checkFails( "cast(1.5e9 as integer) + cast(1.5e9 as integer)", outOfRangeMessage, true); getTester().checkFails( "cast(5e18 as bigint) + cast(5e18 as bigint)", outOfRangeMessage, true); getTester().checkFails( "cast(-5e18 as decimal(19,0)) + cast(-5e18 as decimal(19,0))", outOfRangeMessage, true); getTester().checkFails( "cast(5e8 as decimal(19,10)) + cast(5e8 as decimal(19,10))", outOfRangeMessage, true); } } public void testPlusIntervalOperator() { getTester().setFor(SqlStdOperatorTable.plusOperator); // Intervals getTester().checkScalar( "interval '2' day + interval '1' day", "+3", "INTERVAL DAY NOT NULL"); getTester().checkScalar( "interval '2' day + interval '1' minute", "+2 00:01", "INTERVAL DAY TO MINUTE NOT NULL"); getTester().checkScalar( "interval '2' day + interval '5' minute + interval '-3' second", "+2 00:04:57", "INTERVAL DAY TO SECOND NOT NULL"); getTester().checkScalar( "interval '2' year + interval '1' month", "+2-01", "INTERVAL YEAR TO MONTH NOT NULL"); getTester().checkNull( "interval '2' year + cast(null as interval month)"); // Datetime plus interval getTester().checkScalar( "time '12:03:01' + interval '1:1' hour to minute", "13:04:01", "TIME(0) NOT NULL"); getTester().checkScalar( "interval '5' day + date '2005-03-02'", "2005-03-07", "DATE NOT NULL"); getTester().checkScalar( "timestamp '2003-08-02 12:54:01' + interval '-4 2:4' day to minute", "2003-07-29 10:50:01", "TIMESTAMP(0) NOT NULL"); // TODO: Tests with interval year months (not supported) } public void testDescendingOperator() { getTester().setFor(SqlStdOperatorTable.descendingOperator, VM_EXPAND); } public void testIsNotNullOperator() { getTester().setFor(SqlStdOperatorTable.isNotNullOperator); getTester().checkBoolean("true is not null", Boolean.TRUE); getTester().checkBoolean( "cast(null as boolean) is not null", Boolean.FALSE); } public void testIsNullOperator() { getTester().setFor(SqlStdOperatorTable.isNullOperator); getTester().checkBoolean("true is null", Boolean.FALSE); getTester().checkBoolean("cast(null as boolean) is null", Boolean.TRUE); } public void testIsNotTrueOperator() { getTester().setFor(SqlStdOperatorTable.isNotTrueOperator); getTester().checkBoolean("true is not true", Boolean.FALSE); getTester().checkBoolean("false is not true", Boolean.TRUE); getTester().checkBoolean( "cast(null as boolean) is not true", Boolean.TRUE); getTester().checkFails( "select ^'a string' is not true^ from (values (1))", "(?s)Cannot apply 'IS NOT TRUE' to arguments of type '<CHAR\\(8\\)> IS NOT TRUE'. Supported form\\(s\\): '<BOOLEAN> IS NOT TRUE'.*", false); } public void testIsTrueOperator() { getTester().setFor(SqlStdOperatorTable.isTrueOperator); getTester().checkBoolean("true is true", Boolean.TRUE); getTester().checkBoolean("false is true", Boolean.FALSE); getTester().checkBoolean( "cast(null as boolean) is true", Boolean.FALSE); } public void testIsNotFalseOperator() { getTester().setFor(SqlStdOperatorTable.isNotFalseOperator); getTester().checkBoolean("false is not false", Boolean.FALSE); getTester().checkBoolean("true is not false", Boolean.TRUE); getTester().checkBoolean( "cast(null as boolean) is not false", Boolean.TRUE); } public void testIsFalseOperator() { getTester().setFor(SqlStdOperatorTable.isFalseOperator); getTester().checkBoolean("false is false", Boolean.TRUE); getTester().checkBoolean("true is false", Boolean.FALSE); getTester().checkBoolean( "cast(null as boolean) is false", Boolean.FALSE); } public void testIsNotUnknownOperator() { getTester().setFor(SqlStdOperatorTable.isNotUnknownOperator, VM_EXPAND); getTester().checkBoolean("false is not unknown", Boolean.TRUE); getTester().checkBoolean("true is not unknown", Boolean.TRUE); getTester().checkBoolean( "cast(null as boolean) is not unknown", Boolean.FALSE); getTester().checkBoolean("unknown is not unknown", Boolean.FALSE); getTester().checkFails( "^'abc' IS NOT UNKNOWN^", "(?s).*Cannot apply 'IS NOT UNKNOWN'.*", false); } public void testIsUnknownOperator() { getTester().setFor(SqlStdOperatorTable.isUnknownOperator, VM_EXPAND); getTester().checkBoolean("false is unknown", Boolean.FALSE); getTester().checkBoolean("true is unknown", Boolean.FALSE); getTester().checkBoolean( "cast(null as boolean) is unknown", Boolean.TRUE); getTester().checkBoolean("unknown is unknown", Boolean.TRUE); getTester().checkFails( "0 = 1 AND ^2 IS UNKNOWN^ AND 3 > 4", "(?s).*Cannot apply 'IS UNKNOWN'.*", false); } public void testIsASetOperator() { getTester().setFor(SqlStdOperatorTable.isASetOperator, VM_EXPAND); } public void testExistsOperator() { getTester().setFor(SqlStdOperatorTable.existsOperator, VM_EXPAND); } public void testNotOperator() { getTester().setFor(SqlStdOperatorTable.notOperator); getTester().checkBoolean("not true", Boolean.FALSE); getTester().checkBoolean("not false", Boolean.TRUE); getTester().checkBoolean("not unknown", null); getTester().checkNull("not cast(null as boolean)"); } public void testPrefixMinusOperator() { getTester().setFor(SqlStdOperatorTable.prefixMinusOperator); getTester().checkFails( "'a' + ^- 'b'^ + 'c'", "(?s)Cannot apply '-' to arguments of type '-<CHAR\\(1\\)>'.*", false); getTester().checkScalarExact("-1", "-1"); getTester().checkScalarExact( "-1.23", "DECIMAL(3, 2) NOT NULL", "-1.23"); getTester().checkScalarApprox("-1.0e0", "DOUBLE NOT NULL", -1, 0); getTester().checkNull("-cast(null as integer)"); getTester().checkNull("-cast(null as tinyint)"); // Intervals getTester().checkScalar( "-interval '-6:2:8' hour to second", "+6:02:08", "INTERVAL HOUR TO SECOND NOT NULL"); getTester().checkScalar( "- -interval '-6:2:8' hour to second", "-6:02:08", "INTERVAL HOUR TO SECOND NOT NULL"); getTester().checkScalar( "-interval '5' month", "-5", "INTERVAL MONTH NOT NULL"); getTester().checkNull( "-cast(null as interval day to minute)"); } public void testPrefixPlusOperator() { getTester().setFor(SqlStdOperatorTable.prefixPlusOperator, VM_EXPAND); getTester().checkScalarExact("+1", "1"); getTester().checkScalarExact("+1.23", "DECIMAL(3, 2) NOT NULL", "1.23"); getTester().checkScalarApprox("+1.0e0", "DOUBLE NOT NULL", 1, 0); getTester().checkNull("+cast(null as integer)"); getTester().checkNull("+cast(null as tinyint)"); // Intervals getTester().checkScalar( "+interval '-6:2:8' hour to second", "-6:02:08", "INTERVAL HOUR TO SECOND NOT NULL"); getTester().checkScalar( "++interval '-6:2:8' hour to second", "-6:02:08", "INTERVAL HOUR TO SECOND NOT NULL"); if (Bug.Frg254Fixed) { getTester().checkScalar( "+interval '6:2:8.234' hour to second", "+06:02:08.234", "INTERVAL HOUR TO SECOND NOT NULL"); } getTester().checkScalar( "+interval '5' month", "+5", "INTERVAL MONTH NOT NULL"); getTester().checkNull( "+cast(null as interval day to minute)"); } public void testExplicitTableOperator() { getTester().setFor(SqlStdOperatorTable.explicitTableOperator, VM_EXPAND); } public void testValuesOperator() { getTester().setFor(SqlStdOperatorTable.valuesOperator, VM_EXPAND); getTester().check( "select 'abc' from (values(true))", new AbstractSqlTester.StringTypeChecker("CHAR(3) NOT NULL"), "abc", 0); } public void testNotLikeOperator() { getTester().setFor(SqlStdOperatorTable.notLikeOperator, VM_EXPAND); getTester().checkBoolean("'abc' not like '_b_'", Boolean.FALSE); } public void testLikeOperator() { getTester().setFor(SqlStdOperatorTable.likeOperator); getTester().checkBoolean("'' like ''", Boolean.TRUE); getTester().checkBoolean("'a' like 'a'", Boolean.TRUE); getTester().checkBoolean("'a' like 'b'", Boolean.FALSE); getTester().checkBoolean("'a' like 'A'", Boolean.FALSE); getTester().checkBoolean("'a' like 'a_'", Boolean.FALSE); getTester().checkBoolean("'a' like '_a'", Boolean.FALSE); getTester().checkBoolean("'a' like '%a'", Boolean.TRUE); getTester().checkBoolean("'a' like '%a%'", Boolean.TRUE); getTester().checkBoolean("'a' like 'a%'", Boolean.TRUE); getTester().checkBoolean("'ab' like 'a_'", Boolean.TRUE); getTester().checkBoolean("'abc' like 'a_'", Boolean.FALSE); getTester().checkBoolean("'abcd' like 'a%'", Boolean.TRUE); getTester().checkBoolean("'ab' like '_b'", Boolean.TRUE); getTester().checkBoolean("'abcd' like '_d'", Boolean.FALSE); getTester().checkBoolean("'abcd' like '%d'", Boolean.TRUE); } public void testNotSimilarToOperator() { getTester().setFor(SqlStdOperatorTable.notSimilarOperator, VM_EXPAND); getTester().checkBoolean("'ab' not similar to 'a_'", false); getTester().checkBoolean("'aabc' not similar to 'ab*c+d'", true); getTester().checkBoolean("'ab' not similar to 'a' || '_'", false); getTester().checkBoolean("'ab' not similar to 'ba_'", true); getTester().checkBoolean( "cast(null as varchar(2)) not similar to 'a_'", null); getTester().checkBoolean( "cast(null as varchar(3)) not similar to cast(null as char(2))", null); } public void testSimilarToOperator() { getTester().setFor(SqlStdOperatorTable.similarOperator); // like LIKE getTester().checkBoolean("'' similar to ''", Boolean.TRUE); getTester().checkBoolean("'a' similar to 'a'", Boolean.TRUE); getTester().checkBoolean("'a' similar to 'b'", Boolean.FALSE); getTester().checkBoolean("'a' similar to 'A'", Boolean.FALSE); getTester().checkBoolean("'a' similar to 'a_'", Boolean.FALSE); getTester().checkBoolean("'a' similar to '_a'", Boolean.FALSE); getTester().checkBoolean("'a' similar to '%a'", Boolean.TRUE); getTester().checkBoolean("'a' similar to '%a%'", Boolean.TRUE); getTester().checkBoolean("'a' similar to 'a%'", Boolean.TRUE); getTester().checkBoolean("'ab' similar to 'a_'", Boolean.TRUE); getTester().checkBoolean("'abc' similar to 'a_'", Boolean.FALSE); getTester().checkBoolean("'abcd' similar to 'a%'", Boolean.TRUE); getTester().checkBoolean("'ab' similar to '_b'", Boolean.TRUE); getTester().checkBoolean("'abcd' similar to '_d'", Boolean.FALSE); getTester().checkBoolean("'abcd' similar to '%d'", Boolean.TRUE); // simple regular expressions // ab*c+d matches acd, abcd, acccd, abcccd but not abd, aabc getTester().checkBoolean("'acd' similar to 'ab*c+d'", Boolean.TRUE); getTester().checkBoolean("'abcd' similar to 'ab*c+d'", Boolean.TRUE); getTester().checkBoolean("'acccd' similar to 'ab*c+d'", Boolean.TRUE); getTester().checkBoolean("'abcccd' similar to 'ab*c+d'", Boolean.TRUE); getTester().checkBoolean("'abd' similar to 'ab*c+d'", Boolean.FALSE); getTester().checkBoolean("'aabc' similar to 'ab*c+d'", Boolean.FALSE); // compound regular expressions // x(ab|c)*y matches xy, xccy, xababcy but not xbcy getTester().checkBoolean( "'xy' similar to 'x(ab|c)*y'", Boolean.TRUE); getTester().checkBoolean( "'xccy' similar to 'x(ab|c)*y'", Boolean.TRUE); getTester().checkBoolean( "'xababcy' similar to 'x(ab|c)*y'", Boolean.TRUE); getTester().checkBoolean( "'xbcy' similar to 'x(ab|c)*y'", Boolean.FALSE); // x(ab|c)+y matches xccy, xababcy but not xy, xbcy getTester().checkBoolean( "'xy' similar to 'x(ab|c)+y'", Boolean.FALSE); getTester().checkBoolean( "'xccy' similar to 'x(ab|c)+y'", Boolean.TRUE); getTester().checkBoolean( "'xababcy' similar to 'x(ab|c)+y'", Boolean.TRUE); getTester().checkBoolean( "'xbcy' similar to 'x(ab|c)+y'", Boolean.FALSE); } public void testEscapeOperator() { getTester().setFor(SqlStdOperatorTable.escapeOperator, VM_EXPAND); } public void testConvertFunc() { getTester().setFor( SqlStdOperatorTable.convertFunc, VM_FENNEL, VM_JAVA); } public void testTranslateFunc() { getTester().setFor( SqlStdOperatorTable.translateFunc, VM_FENNEL, VM_JAVA); } public void testOverlayFunc() { getTester().setFor(SqlStdOperatorTable.overlayFunc); getTester().checkString( "overlay('ABCdef' placing 'abc' from 1)", "abcdef", "VARCHAR(9) NOT NULL"); getTester().checkString( "overlay('ABCdef' placing 'abc' from 1 for 2)", "abcCdef", "VARCHAR(9) NOT NULL"); getTester().checkString( "overlay(cast('ABCdef' as varchar(10)) placing " + "cast('abc' as char(5)) from 1 for 2)", "abc Cdef", "VARCHAR(15) NOT NULL"); getTester().checkString( "overlay(cast('ABCdef' as char(10)) placing " + "cast('abc' as char(5)) from 1 for 2)", "abc Cdef ", "VARCHAR(15) NOT NULL"); getTester().checkNull( "overlay('ABCdef' placing 'abc' from 1 for cast(null as integer))"); getTester().checkNull( "overlay(cast(null as varchar(1)) placing 'abc' from 1)"); if (false) { // hex strings not yet implemented in calc getTester().checkNull( "overlay(x'abc' placing x'abc' from cast(null as integer))"); } } public void testPositionFunc() { getTester().setFor(SqlStdOperatorTable.positionFunc); getTester().checkScalarExact("position('b' in 'abc')", "2"); getTester().checkScalarExact("position('' in 'abc')", "1"); // FRG-211 getTester().checkScalarExact("position('tra' in 'fdgjklewrtra')", "10"); getTester().checkNull("position(cast(null as varchar(1)) in '0010')"); getTester().checkNull("position('a' in cast(null as varchar(1)))"); getTester().checkScalar( "position(cast('a' as char) in cast('bca' as varchar))", 0, "INTEGER NOT NULL"); } public void testCharLengthFunc() { getTester().setFor(SqlStdOperatorTable.charLengthFunc); getTester().checkScalarExact("char_length('abc')", "3"); getTester().checkNull("char_length(cast(null as varchar(1)))"); } public void testCharacterLengthFunc() { getTester().setFor(SqlStdOperatorTable.characterLengthFunc); getTester().checkScalarExact("CHARACTER_LENGTH('abc')", "3"); getTester().checkNull("CHARACTER_LENGTH(cast(null as varchar(1)))"); } public void testUpperFunc() { getTester().setFor(SqlStdOperatorTable.upperFunc); getTester().checkString("upper('a')", "A", "CHAR(1) NOT NULL"); getTester().checkString("upper('A')", "A", "CHAR(1) NOT NULL"); getTester().checkString("upper('1')", "1", "CHAR(1) NOT NULL"); getTester().checkString("upper('aa')", "AA", "CHAR(2) NOT NULL"); getTester().checkNull("upper(cast(null as varchar(1)))"); } public void testLowerFunc() { getTester().setFor(SqlStdOperatorTable.lowerFunc); // SQL:2003 6.29.8 The type of lower is the type of its argument getTester().checkString("lower('A')", "a", "CHAR(1) NOT NULL"); getTester().checkString("lower('a')", "a", "CHAR(1) NOT NULL"); getTester().checkString("lower('1')", "1", "CHAR(1) NOT NULL"); getTester().checkString("lower('AA')", "aa", "CHAR(2) NOT NULL"); getTester().checkNull("lower(cast(null as varchar(1)))"); } public void testInitcapFunc() { // Note: the initcap function is an Oracle defined function and is not // defined in the SQL:2003 standard getTester().setFor(SqlStdOperatorTable.initcapFunc, VM_FENNEL); // todo: implement in fennel getTester().checkString("initcap('aA')", "Aa", "CHAR(2) NOT NULL"); getTester().checkString("initcap('Aa')", "Aa", "CHAR(2) NOT NULL"); getTester().checkString("initcap('1a')", "1a", "CHAR(2) NOT NULL"); getTester().checkString( "initcap('ab cd Ef 12')", "Ab Cd Ef 12", "CHAR(11) NOT NULL"); getTester().checkNull("initcap(cast(null as varchar(1)))"); // dtbug 232 getTester().checkFails( "^initcap(cast(null as date))^", "Cannot apply 'INITCAP' to arguments of type 'INITCAP\\(<DATE>\\)'\\. Supported form\\(s\\): 'INITCAP\\(<CHARACTER>\\)'", false); } public void testPowerFunc() { getTester().setFor(SqlStdOperatorTable.powerFunc); getTester().checkScalarApprox("power(2,-2)", "DOUBLE NOT NULL", 0.25, 0); getTester().checkNull("power(cast(null as integer),2)"); getTester().checkNull("power(2,cast(null as double))"); // 'power' is an obsolete form of the 'power' function getTester().checkFails( "^pow(2,-2)^", "No match found for function signature POW\\(<NUMERIC>, <NUMERIC>\\)", false); } public void testExpFunc() { getTester().setFor(SqlStdOperatorTable.expFunc, VM_FENNEL); // todo: implement in fennel getTester().checkScalarApprox( "exp(2)", "DOUBLE NOT NULL", 7.389056, 0.000001); getTester().checkScalarApprox( "exp(-2)", "DOUBLE NOT NULL", 0.1353, 0.0001); getTester().checkNull("exp(cast(null as integer))"); getTester().checkNull("exp(cast(null as double))"); } public void testModFunc() { getTester().setFor(SqlStdOperatorTable.modFunc); getTester().checkScalarExact("mod(4,2)", "0"); getTester().checkScalarExact("mod(8,5)", "3"); getTester().checkScalarExact("mod(-12,7)", "-5"); getTester().checkScalarExact("mod(-12,-7)", "-5"); getTester().checkScalarExact("mod(12,-7)", "5"); getTester().checkScalarExact( "mod(cast(12 as tinyint), cast(-7 as tinyint))", "TINYINT NOT NULL", "5"); getTester().checkScalarExact( "mod(cast(9 as decimal(2, 0)), 7)", "INTEGER NOT NULL", "2"); getTester().checkScalarExact( "mod(7, cast(9 as decimal(2, 0)))", "DECIMAL(2, 0) NOT NULL", "7"); getTester().checkScalarExact( "mod(cast(-9 as decimal(2, 0)), cast(7 as decimal(1, 0)))", "DECIMAL(1, 0) NOT NULL", "-2"); getTester().checkNull("mod(cast(null as integer),2)"); getTester().checkNull("mod(4,cast(null as tinyint))"); getTester().checkNull("mod(4,cast(null as decimal(12,0)))"); } public void testModFuncDivByZero() { // The extra CASE expression is to fool Janino. It does constant // reduction and will throw the divide by zero exception while // compiling the expression. The test frame work would then issue // unexpected exception occured during "validation". You cannot // submit as non-runtime because the janino exception does not have // error position information and the framework is unhappy with that. getTester().checkFails("mod(3,case 'a' when 'a' then 0 end)", divisionByZeroMessage, true); } public void testLnFunc() { getTester().setFor(SqlStdOperatorTable.lnFunc); getTester().checkScalarApprox( "ln(2.71828)", "DOUBLE NOT NULL", 1.0, 0.000001); getTester().checkScalarApprox( "ln(2.71828)", "DOUBLE NOT NULL", 0.999999327, 0.0000001); getTester().checkNull("ln(cast(null as tinyint))"); } public void testLogFunc() { getTester().setFor(SqlStdOperatorTable.log10Func); getTester().checkScalarApprox( "log10(10)", "DOUBLE NOT NULL", 1.0, 0.000001); getTester().checkScalarApprox( "log10(100.0)", "DOUBLE NOT NULL", 2.0, 0.000001); getTester().checkScalarApprox( "log10(cast(10e8 as double))", "DOUBLE NOT NULL", 9.0, 0.000001); getTester().checkScalarApprox( "log10(cast(10e2 as float))", "DOUBLE NOT NULL", 3.0, 0.000001); getTester().checkScalarApprox( "log10(cast(10e-3 as real))", "DOUBLE NOT NULL", -2.0, 0.000001); getTester().checkNull("log10(cast(null as real))"); } public void testAbsFunc() { getTester().setFor(SqlStdOperatorTable.absFunc); getTester().checkScalarExact("abs(-1)", "1"); getTester().checkScalarExact( "abs(cast(10 as TINYINT))", "TINYINT NOT NULL", "10"); getTester().checkScalarExact( "abs(cast(-20 as SMALLINT))", "SMALLINT NOT NULL", "20"); getTester().checkScalarExact( "abs(cast(-100 as INT))", "INTEGER NOT NULL", "100"); getTester().checkScalarExact( "abs(cast(1000 as BIGINT))", "BIGINT NOT NULL", "1000"); getTester().checkScalarExact( "abs(54.4)", "DECIMAL(3, 1) NOT NULL", "54.4"); getTester().checkScalarExact( "abs(-54.4)", "DECIMAL(3, 1) NOT NULL", "54.4"); getTester().checkScalarApprox( "abs(-9.32E-2)", "DOUBLE NOT NULL", 0.0932, 0); getTester().checkScalarApprox( "abs(cast(-3.5 as double))", "DOUBLE NOT NULL", 3.5, 0); getTester().checkScalarApprox( "abs(cast(-3.5 as float))", "FLOAT NOT NULL", 3.5, 0); getTester().checkScalarApprox( "abs(cast(3.5 as real))", "REAL NOT NULL", 3.5, 0); getTester().checkNull("abs(cast(null as double))"); // Intervals getTester().checkScalar( "abs(interval '-2' day)", "+2", "INTERVAL DAY NOT NULL"); getTester().checkScalar( "abs(interval '-5-03' year to month)", "+5-03", "INTERVAL YEAR TO MONTH NOT NULL"); getTester().checkNull("abs(cast(null as interval hour))"); } public void testNullifFunc() { getTester().setFor(SqlStdOperatorTable.nullIfFunc, VM_EXPAND); getTester().checkNull("nullif(1,1)"); getTester().checkScalarExact( "nullif(1.5, 13.56)", "DECIMAL(2, 1)", "1.5"); getTester().checkScalarExact( "nullif(13.56, 1.5)", "DECIMAL(4, 2)", "13.56"); getTester().checkScalarExact("nullif(1.5, 3)", "DECIMAL(2, 1)", "1.5"); getTester().checkScalarExact("nullif(3, 1.5)", "INTEGER", "3"); getTester().checkScalarApprox("nullif(1.5e0, 3e0)", "DOUBLE", 1.5, 0); getTester().checkScalarApprox( "nullif(1.5, cast(3e0 as REAL))", "DECIMAL(2, 1)", 1.5, 0); getTester().checkScalarExact("nullif(3, 1.5e0)", "INTEGER", "3"); getTester().checkScalarExact( "nullif(3, cast(1.5e0 as REAL))", "INTEGER", "3"); getTester().checkScalarApprox("nullif(1.5e0, 3.4)", "DOUBLE", 1.5, 0); getTester().checkScalarExact( "nullif(3.4, 1.5e0)", "DECIMAL(2, 1)", "3.4"); getTester().checkString("nullif('a','bc')", "a", "CHAR(1)"); getTester().checkString( "nullif('a',cast(null as varchar(1)))", "a", "CHAR(1)"); getTester().checkNull("nullif(cast(null as varchar(1)),'a')"); getTester().checkNull("nullif(cast(null as numeric(4,3)), 4.3)"); // Error message reflects the fact that Nullif is expanded before it is // validated (like a C macro). Not perfect, but good enough. getTester().checkFails( "1 + ^nullif(1, date '2005-8-4')^ + 2", "(?s)Cannot apply '=' to arguments of type '<INTEGER> = <DATE>'\\..*", false); getTester().checkFails( "1 + ^nullif(1, 2, 3)^ + 2", "Invalid number of arguments to function 'NULLIF'\\. Was expecting 2 arguments", false); // Intervals getTester().checkScalar( "nullif(interval '2' month, interval '3' year)", "+2", "INTERVAL MONTH"); getTester().checkScalar( "nullif(interval '2 5' day to hour, interval '5' second)", "+2 05", "INTERVAL DAY TO HOUR"); getTester().checkNull( "nullif(interval '3' day, interval '3' day)"); } public void testCoalesceFunc() { getTester().setFor(SqlStdOperatorTable.coalesceFunc, VM_EXPAND); getTester().checkString("coalesce('a','b')", "a", "CHAR(1) NOT NULL"); getTester().checkScalarExact("coalesce(null,null,3)", "3"); getTester().checkFails( "1 + ^coalesce('a', 'b', 1, null)^ + 2", "Illegal mixing of types in CASE or COALESCE statement", false); } public void testUserFunc() { getTester().setFor(SqlStdOperatorTable.userFunc, VM_FENNEL); getTester().checkString("USER", "sa", "VARCHAR(2000) NOT NULL"); } public void testCurrentUserFunc() { getTester().setFor(SqlStdOperatorTable.currentUserFunc, VM_FENNEL); getTester().checkString("CURRENT_USER", "sa", "VARCHAR(2000) NOT NULL"); } public void testSessionUserFunc() { getTester().setFor(SqlStdOperatorTable.sessionUserFunc, VM_FENNEL); getTester().checkString("SESSION_USER", "sa", "VARCHAR(2000) NOT NULL"); } public void testSystemUserFunc() { getTester().setFor(SqlStdOperatorTable.systemUserFunc, VM_FENNEL); String user = System.getProperty("user.name"); // e.g. "jhyde" getTester().checkString("SYSTEM_USER", user, "VARCHAR(2000) NOT NULL"); } public void testCurrentPathFunc() { getTester().setFor(SqlStdOperatorTable.currentPathFunc, VM_FENNEL); getTester().checkString("CURRENT_PATH", "", "VARCHAR(2000) NOT NULL"); } public void testCurrentRoleFunc() { getTester().setFor(SqlStdOperatorTable.currentRoleFunc, VM_FENNEL); // By default, the CURRENT_ROLE function returns // the empty string because a role has to be set explicitly. getTester().checkString("CURRENT_ROLE", "", "VARCHAR(2000) NOT NULL"); } public void testLocalTimeFunc() { getTester().setFor(SqlStdOperatorTable.localTimeFunc); getTester().checkScalar("LOCALTIME", timePattern, "TIME(0) NOT NULL"); getTester().checkFails( "^LOCALTIME()^", "No match found for function signature LOCALTIME\\(\\)", false); getTester().checkScalar( "LOCALTIME(1)", timePattern, "TIME(1) NOT NULL"); getTester().checkScalar( "CAST(LOCALTIME AS VARCHAR(30))", Pattern.compile( currentTimeString(defaultTimeZone).substring(11) + "[0-9][0-9]:[0-9][0-9]"), "VARCHAR(30) NOT NULL"); } public void testLocalTimestampFunc() { getTester().setFor(SqlStdOperatorTable.localTimestampFunc); getTester().checkScalar( "LOCALTIMESTAMP", timestampPattern, "TIMESTAMP(0) NOT NULL"); getTester().checkFails( "^LOCALTIMESTAMP()^", "No match found for function signature LOCALTIMESTAMP\\(\\)", false); getTester().checkFails( "LOCALTIMESTAMP(^4000000000^)", literalOutOfRangeMessage, false); getTester().checkScalar( "LOCALTIMESTAMP(1)", timestampPattern, "TIMESTAMP(1) NOT NULL"); if (Bug.Fnl66Fixed) { // Seems to fail on some machines... time is one hour off... suspect this is the Cinderalla bug // Check that timestamp is being generated in the right timezone by // generating a specific timestamp. getTester().checkScalar( "CAST(LOCALTIMESTAMP AS VARCHAR(30))", Pattern.compile( currentTimeString(defaultTimeZone) + "[0-9][0-9]:[0-9][0-9]"), "VARCHAR(30) NOT NULL"); } } public void testCurrentTimeFunc() { getTester().setFor(SqlStdOperatorTable.currentTimeFunc); getTester().checkScalar( "CURRENT_TIME", timePattern, "TIME(0) NOT NULL"); getTester().checkFails( "^CURRENT_TIME()^", "No match found for function signature CURRENT_TIME\\(\\)", false); getTester().checkScalar( "CURRENT_TIME(1)", timePattern, "TIME(1) NOT NULL"); if (Bug.Fnl77Fixed) { // Currently works with Java calc, but fennel calc returns time in // GMT time zone. getTester().checkScalar( "CAST(CURRENT_TIME AS VARCHAR(30))", Pattern.compile( currentTimeString(defaultTimeZone).substring(11) + "[0-9][0-9]:[0-9][0-9]"), "VARCHAR(30) NOT NULL"); } } public void testCurrentTimestampFunc() { getTester().setFor(SqlStdOperatorTable.currentTimestampFunc); getTester().checkScalar( "CURRENT_TIMESTAMP", timestampPattern, "TIMESTAMP(0) NOT NULL"); getTester().checkFails( "^CURRENT_TIMESTAMP()^", "No match found for function signature CURRENT_TIMESTAMP\\(\\)", false); getTester().checkFails( "CURRENT_TIMESTAMP(^4000000000^)", literalOutOfRangeMessage, false); getTester().checkScalar( "CURRENT_TIMESTAMP(1)", timestampPattern, "TIMESTAMP(1) NOT NULL"); // Check that timestamp is being generated in the right timezone by // generating a specific timestamp. We truncate to hours so that minor // delays don't generate false negatives. if (Bug.Fnl77Fixed) { // Currently works with Java calc, but fennel calc returns time in // GMT time zone. getTester().checkScalar( "CAST(CURRENT_TIMESTAMP AS VARCHAR(30))", Pattern.compile( currentTimeString(defaultTimeZone) + "[0-9][0-9]:[0-9][0-9]"), "VARCHAR(30) NOT NULL"); } } /** * Returns a time string, in GMT, that will be valid for at least 2 * minutes. * * <p>For example, at "2005-01-01 12:34:56 PST", returns "2005-01-01 20:". * At "2005-01-01 12:34:59 PST", waits a minute, then returns * "2005-01-01 21:". * * @param tz Time zone * @return Time string */ protected static String currentTimeString(TimeZone tz) { final Calendar calendar = getCalendarNotTooNear(Calendar.HOUR_OF_DAY); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:"); sdf.setTimeZone(tz); return sdf.format(calendar.getTime()); } public void testCurrentDateFunc() { getTester().setFor(SqlStdOperatorTable.currentDateFunc, VM_FENNEL); getTester().checkScalar("CURRENT_DATE", datePattern, "DATE NOT NULL"); getTester().checkScalar( "(CURRENT_DATE - CURRENT_DATE) DAY", "+0", "INTERVAL DAY NOT NULL"); getTester().checkBoolean("CURRENT_DATE IS NULL", false); getTester().checkFails( "^CURRENT_DATE()^", "No match found for function signature CURRENT_DATE\\(\\)", false); } public void testSubstringFunction() { getTester().setFor(SqlStdOperatorTable.substringFunc); getTester().checkString( "substring('abc' from 1 for 2)", "ab", "VARCHAR(3) NOT NULL"); getTester().checkString( "substring('abc' from 2)", "bc", "VARCHAR(3) NOT NULL"); if (Bug.Frg296Fixed) { // substring regexp not supported yet getTester().checkString("substring('foobar' from '%#\"o_b#\"%' for'#')", "oob", "xx"); } getTester().checkNull("substring(cast(null as varchar(1)),1,2)"); } public void testTrimFunc() { getTester().setFor(SqlStdOperatorTable.trimFunc); // SQL:2003 6.29.11 Trimming a CHAR yields a VARCHAR getTester().checkString( "trim('a' from 'aAa')", "A", "VARCHAR(3) NOT NULL"); getTester().checkString( "trim(both 'a' from 'aAa')", "A", "VARCHAR(3) NOT NULL"); getTester().checkString( "trim(leading 'a' from 'aAa')", "Aa", "VARCHAR(3) NOT NULL"); getTester().checkString( "trim(trailing 'a' from 'aAa')", "aA", "VARCHAR(3) NOT NULL"); getTester().checkNull("trim(cast(null as varchar(1)) from 'a')"); getTester().checkNull("trim('a' from cast(null as varchar(1)))"); if (Bug.Fnl3Fixed) { // SQL:2003 6.29.9: trim string must have length=1. Failure occurs // at runtime. // // TODO: Change message to "Invalid argument\(s\) for 'TRIM' function", // The message should come from a resource file, and should still // have the SQL error code 22027. getTester().checkFails( "trim('xy' from 'abcde')", "could not calculate results for the following row:" + NL + "\\[ 0 \\]" + NL + "Messages:" + NL + "\\[0\\]:PC=0 Code=22027 ", true); getTester().checkFails( "trim('' from 'abcde')", "could not calculate results for the following row:" + NL + "\\[ 0 \\]" + NL + "Messages:" + NL + "\\[0\\]:PC=0 Code=22027 ", true); } } public void testWindow() { getTester().setFor( SqlStdOperatorTable.windowOperator, VM_FENNEL, VM_JAVA); getTester().check( "select sum(1) over (order by x) from (select 1 as x, 2 as y from (values (true)))", new AbstractSqlTester.StringTypeChecker("INTEGER"), "1", 0); } public void testElementFunc() { getTester().setFor( SqlStdOperatorTable.elementFunc, VM_FENNEL, VM_JAVA); if (todo) { getTester().checkString( "element(multiset['abc']))", "abc", "char(3) not null"); getTester().checkNull("element(multiset[cast(null as integer)]))"); } } public void testCardinalityFunc() { getTester().setFor( SqlStdOperatorTable.cardinalityFunc, VM_FENNEL, VM_JAVA); if (todo) { getTester().checkScalarExact( "cardinality(multiset[cast(null as integer),2]))", "2"); } } public void testMemberOfOperator() { getTester().setFor( SqlStdOperatorTable.memberOfOperator, VM_FENNEL, VM_JAVA); if (todo) { getTester().checkBoolean("1 member of multiset[1]", Boolean.TRUE); getTester().checkBoolean( "'2' member of multiset['1']", Boolean.FALSE); getTester().checkBoolean( "cast(null as double) member of multiset[cast(null as double)]", Boolean.TRUE); getTester().checkBoolean( "cast(null as double) member of multiset[1.1]", Boolean.FALSE); getTester().checkBoolean( "1.1 member of multiset[cast(null as double)]", Boolean.FALSE); } } public void testCollectFunc() { getTester().setFor( SqlStdOperatorTable.collectFunc, VM_FENNEL, VM_JAVA); } public void testFusionFunc() { getTester().setFor(SqlStdOperatorTable.fusionFunc, VM_FENNEL, VM_JAVA); } public void testExtractFunc() { getTester().setFor( SqlStdOperatorTable.extractFunc, VM_FENNEL, VM_JAVA); // Intervals getTester().checkScalar( "extract(day from interval '2 3:4:5.678' day to second)", "2", "BIGINT NOT NULL"); getTester().checkScalar( "extract(hour from interval '2 3:4:5.678' day to second)", "3", "BIGINT NOT NULL"); getTester().checkScalar( "extract(minute from interval '2 3:4:5.678' day to second)", "4", "BIGINT NOT NULL"); // TODO: Seconds should include precision getTester().checkScalar( "extract(second from interval '2 3:4:5.678' day to second)", "5", "BIGINT NOT NULL"); getTester().checkScalar( "extract(year from interval '4-2' year to month)", "4", "BIGINT NOT NULL"); getTester().checkScalar( "extract(month from interval '4-2' year to month)", "2", "BIGINT NOT NULL"); getTester().checkNull( "extract(month from cast(null as interval year))"); } public void testCeilFunc() { getTester().setFor(SqlStdOperatorTable.ceilFunc, VM_FENNEL); getTester().checkScalarApprox("ceil(10.1e0)", "DOUBLE NOT NULL", 11, 0); getTester().checkScalarApprox( "ceil(cast(-11.2e0 as real))", "REAL NOT NULL", -11, 0); getTester().checkScalarExact("ceil(100)", "INTEGER NOT NULL", "100"); getTester().checkScalarExact( "ceil(1.3)", "DECIMAL(2, 0) NOT NULL", "2"); getTester().checkScalarExact( "ceil(-1.7)", "DECIMAL(2, 0) NOT NULL", "-1"); getTester().checkNull("ceiling(cast(null as decimal(2,0)))"); getTester().checkNull("ceiling(cast(null as double))"); // Intervals getTester().checkScalar( "ceil(interval '3:4:5' hour to second)", "+4:00:00", "INTERVAL HOUR TO SECOND NOT NULL"); getTester().checkScalar( "ceil(interval '-6.3' second)", "-6", "INTERVAL SECOND NOT NULL"); getTester().checkScalar( "ceil(interval '5-1' year to month)", "+6-00", "INTERVAL YEAR TO MONTH NOT NULL"); getTester().checkScalar( "ceil(interval '-5-1' year to month)", "-5-00", "INTERVAL YEAR TO MONTH NOT NULL"); getTester().checkNull( "ceil(cast(null as interval year))"); } public void testFloorFunc() { getTester().setFor(SqlStdOperatorTable.floorFunc, VM_FENNEL); getTester().checkScalarApprox("floor(2.5e0)", "DOUBLE NOT NULL", 2, 0); getTester().checkScalarApprox( "floor(cast(-1.2e0 as real))", "REAL NOT NULL", -2, 0); getTester().checkScalarExact("floor(100)", "INTEGER NOT NULL", "100"); getTester().checkScalarExact( "floor(1.7)", "DECIMAL(2, 0) NOT NULL", "1"); getTester().checkScalarExact( "floor(-1.7)", "DECIMAL(2, 0) NOT NULL", "-2"); getTester().checkNull("floor(cast(null as decimal(2,0)))"); getTester().checkNull("floor(cast(null as real))"); // Intervals getTester().checkScalar( "floor(interval '3:4:5' hour to second)", "+3:00:00", "INTERVAL HOUR TO SECOND NOT NULL"); getTester().checkScalar( "floor(interval '-6.3' second)", "-7", "INTERVAL SECOND NOT NULL"); getTester().checkScalar( "floor(interval '5-1' year to month)", "+5-00", "INTERVAL YEAR TO MONTH NOT NULL"); getTester().checkScalar( "floor(interval '-5-1' year to month)", "-6-00", "INTERVAL YEAR TO MONTH NOT NULL"); getTester().checkNull( "floor(cast(null as interval year))"); } public void testDenseRankFunc() { getTester().setFor( SqlStdOperatorTable.denseRankFunc, VM_FENNEL, VM_JAVA); } public void testPercentRankFunc() { getTester().setFor( SqlStdOperatorTable.percentRankFunc, VM_FENNEL, VM_JAVA); } public void testRankFunc() { getTester().setFor(SqlStdOperatorTable.rankFunc, VM_FENNEL, VM_JAVA); } public void testCumeDistFunc() { getTester().setFor( SqlStdOperatorTable.cumeDistFunc, VM_FENNEL, VM_JAVA); } public void testRowNumberFunc() { getTester().setFor( SqlStdOperatorTable.rowNumberFunc, VM_FENNEL, VM_JAVA); } public void testCountFunc() { getTester().setFor(SqlStdOperatorTable.countOperator, VM_EXPAND); getTester().checkType("count(*)", "BIGINT NOT NULL"); getTester().checkType("count('name')", "BIGINT NOT NULL"); getTester().checkType("count(1)", "BIGINT NOT NULL"); getTester().checkType("count(1.2)", "BIGINT NOT NULL"); getTester().checkType("COUNT(DISTINCT 'x')", "BIGINT NOT NULL"); getTester().checkFails( "^COUNT()^", "Invalid number of arguments to function 'COUNT'. Was expecting 1 arguments", false); getTester().checkFails( "^COUNT(1, 2)^", "Invalid number of arguments to function 'COUNT'. Was expecting 1 arguments", false); final String [] values = { "0", "CAST(null AS INTEGER)", "1", "0" }; getTester().checkAgg( "COUNT(x)", values, 3, (double) 0); getTester().checkAgg( "COUNT(CASE x WHEN 0 THEN NULL ELSE -1 END)", values, 2, (double) 0); getTester().checkAgg( "COUNT(DISTINCT x)", values, 2, (double) 0); // string values -- note that empty string is not null final String [] stringValues = { "'a'", "CAST(NULL AS VARCHAR(1))", "''" }; getTester().checkAgg( "COUNT(*)", stringValues, 3, (double) 0); getTester().checkAgg( "COUNT(x)", stringValues, 2, (double) 0); getTester().checkAgg( "COUNT(DISTINCT x)", stringValues, 2, (double) 0); getTester().checkAgg( "COUNT(DISTINCT 123)", stringValues, 1, (double) 0); } public void testSumFunc() { getTester().setFor(SqlStdOperatorTable.sumOperator, VM_EXPAND); getTester().checkFails( "sum(^*^)", "Unknown identifier '\\*'", false); getTester().checkFails( "^sum('name')^", "(?s)Cannot apply 'SUM' to arguments of type 'SUM\\(<CHAR\\(4\\)>\\)'\\. Supported form\\(s\\): 'SUM\\(<NUMERIC>\\)'.*", false); getTester().checkType("sum(1)", "INTEGER"); getTester().checkType("sum(1.2)", "DECIMAL(2, 1)"); getTester().checkType("sum(DISTINCT 1.5)", "DECIMAL(2, 1)"); getTester().checkFails( "^sum()^", "Invalid number of arguments to function 'SUM'. Was expecting 1 arguments", false); getTester().checkFails( "^sum(1, 2)^", "Invalid number of arguments to function 'SUM'. Was expecting 1 arguments", false); getTester().checkFails( "^sum(cast(null as varchar(2)))^", "(?s)Cannot apply 'SUM' to arguments of type 'SUM\\(<VARCHAR\\(2\\)>\\)'\\. Supported form\\(s\\): 'SUM\\(<NUMERIC>\\)'.*", false); final String [] values = { "0", "CAST(null AS INTEGER)", "2", "2" }; getTester().checkAgg( "sum(x)", values, 4, (double) 0); Object result1 = -3; getTester().checkAgg( "sum(CASE x WHEN 0 THEN NULL ELSE -1 END)", values, result1, (double) 0); Object result = -1; getTester().checkAgg( "sum(DISTINCT CASE x WHEN 0 THEN NULL ELSE -1 END)", values, result, (double) 0); getTester().checkAgg( "sum(DISTINCT x)", values, 2, (double) 0); } public void testAvgFunc() { getTester().setFor(SqlStdOperatorTable.avgOperator, VM_EXPAND); getTester().checkFails( "avg(^*^)", "Unknown identifier '\\*'", false); getTester().checkFails( "^avg(cast(null as varchar(2)))^", "(?s)Cannot apply 'AVG' to arguments of type 'AVG\\(<VARCHAR\\(2\\)>\\)'\\. Supported form\\(s\\): 'AVG\\(<NUMERIC>\\)'.*", false); getTester().checkType("AVG(CAST(NULL AS INTEGER))", "INTEGER"); getTester().checkType("AVG(DISTINCT 1.5)", "DECIMAL(2, 1)"); final String [] values = { "0", "CAST(null AS FLOAT)", "3", "3" }; getTester().checkAgg( "AVG(x)", values, 2d, 0d); getTester().checkAgg( "AVG(DISTINCT x)", values, 1.5d, 0d); Object result = -1; getTester().checkAgg( "avg(DISTINCT CASE x WHEN 0 THEN NULL ELSE -1 END)", values, result, 0d); } public void testMinFunc() { getTester().setFor(SqlStdOperatorTable.minOperator, VM_EXPAND); getTester().checkFails( "min(^*^)", "Unknown identifier '\\*'", false); getTester().checkType("min(1)", "INTEGER"); getTester().checkType("min(1.2)", "DECIMAL(2, 1)"); getTester().checkType("min(DISTINCT 1.5)", "DECIMAL(2, 1)"); getTester().checkFails( "^min()^", "Invalid number of arguments to function 'MIN'. Was expecting 1 arguments", false); getTester().checkFails( "^min(1, 2)^", "Invalid number of arguments to function 'MIN'. Was expecting 1 arguments", false); final String [] values = { "0", "CAST(null AS INTEGER)", "2", "2" }; getTester().checkAgg( "min(x)", values, "0", 0d); getTester().checkAgg( "min(CASE x WHEN 0 THEN NULL ELSE -1 END)", values, "-1", 0d); getTester().checkAgg( "min(DISTINCT CASE x WHEN 0 THEN NULL ELSE -1 END)", values, "-1", 0d); getTester().checkAgg( "min(DISTINCT x)", values, "0", 0d); } public void testMaxFunc() { getTester().setFor(SqlStdOperatorTable.maxOperator, VM_EXPAND); getTester().checkFails( "max(^*^)", "Unknown identifier '\\*'", false); getTester().checkType("max(1)", "INTEGER"); getTester().checkType("max(1.2)", "DECIMAL(2, 1)"); getTester().checkType("max(DISTINCT 1.5)", "DECIMAL(2, 1)"); getTester().checkFails( "^max()^", "Invalid number of arguments to function 'MAX'. Was expecting 1 arguments", false); getTester().checkFails( "^max(1, 2)^", "Invalid number of arguments to function 'MAX'. Was expecting 1 arguments", false); final String [] values = { "0", "CAST(null AS INTEGER)", "2", "2" }; getTester().checkAgg( "max(x)", values, "2", 0d); getTester().checkAgg( "max(CASE x WHEN 0 THEN NULL ELSE -1 END)", values, "-1", 0d); getTester().checkAgg( "max(DISTINCT CASE x WHEN 0 THEN NULL ELSE -1 END)", values, "-1", 0d); getTester().checkAgg( "max(DISTINCT x)", values, "2", 0d); } public void testLastValueFunc() { getTester().setFor(SqlStdOperatorTable.lastValueOperator, VM_EXPAND); final String [] values = { "0", "CAST(null AS INTEGER)", "3", "3" }; getTester().checkWinAgg( "last_value(x)", values, "ROWS 3 PRECEDING", "INTEGER", Arrays.asList("3", "0"), 0d); final String [] values2 = { "1.6", "1.2" }; getTester().checkWinAgg( "last_value(x)", values2, "ROWS 3 PRECEDING", "DECIMAL(2, 1) NOT NULL", Arrays.asList("1.6", "1.2"), 0d); final String [] values3 = { "'foo'", "'bar'", "'name'" }; getTester().checkWinAgg( "last_value(x)", values3, "ROWS 3 PRECEDING", "CHAR(4) NOT NULL", Arrays.asList("foo ", "bar ", "name"), 0d); } public void testFirstValueFunc() { getTester().setFor(SqlStdOperatorTable.firstValueOperator, VM_EXPAND); final String [] values = { "0", "CAST(null AS INTEGER)", "3", "3" }; getTester().checkWinAgg( "first_value(x)", values, "ROWS 3 PRECEDING", "INTEGER", Arrays.asList("0"), 0d); final String [] values2 = { "1.6", "1.2" }; getTester().checkWinAgg( "first_value(x)", values2, "ROWS 3 PRECEDING", "DECIMAL(2, 1) NOT NULL", Arrays.asList("1.6"), 0d); final String [] values3 = { "'foo'", "'bar'", "'name'" }; getTester().checkWinAgg( "first_value(x)", values3, "ROWS 3 PRECEDING", "CHAR(4) NOT NULL", Arrays.asList("foo "), 0d); } /** * Tests that CAST fails when given a value just outside the valid range for * that type. For example, * * <ul> * <li>CAST(-200 AS TINYINT) fails because the value is less than -128; * <li>CAST(1E-999 AS FLOAT) fails because the value underflows; * <li>CAST(123.4567891234567 AS FLOAT) fails because the value loses * precision. * </ul> */ public void testLiteralAtLimit() { final SqlTester tester = getTester(); tester.setFor(SqlStdOperatorTable.castFunc); for (BasicSqlType type : SqlLimitsTest.getTypes()) { for (Object o : getValues(type, true)) { SqlLiteral literal = type.getSqlTypeName().createLiteral(o, SqlParserPos.ZERO); String literalString = literal.toSqlString(SqlUtil.dummyDialect); final String expr = "CAST(" + literalString + " AS " + type + ")"; if (type.getSqlTypeName() == SqlTypeName.VARBINARY && !Bug.Frg283Fixed) { continue; } try { tester.checkType( expr, type.getFullTypeString()); if (type.getSqlTypeName() == SqlTypeName.BINARY) { // Casting a string/binary values may change the value. // For example, CAST(X'AB' AS BINARY(2)) yields // X'AB00'. } else { tester.checkScalar( expr + " = " + literalString, true, "BOOLEAN NOT NULL"); } } catch (Error e) { System.out.println("Failed for expr=[" + expr + "]"); throw e; } catch (RuntimeException e) { System.out.println("Failed for expr=[" + expr + "]"); throw e; } } } } /** * Tests that CAST fails when given a value just outside the valid range for * that type. For example, * * <ul> * <li>CAST(-200 AS TINYINT) fails because the value is less than -128; * <li>CAST(1E-999 AS FLOAT) fails because the value underflows; * <li>CAST(123.4567891234567 AS FLOAT) fails because the value loses * precision. * </ul> */ public void testLiteralBeyondLimit() { final SqlTester tester = getTester(); tester.setFor(SqlStdOperatorTable.castFunc); for (BasicSqlType type : SqlLimitsTest.getTypes()) { for (Object o : getValues(type, false)) { SqlLiteral literal = type.getSqlTypeName().createLiteral(o, SqlParserPos.ZERO); String literalString = literal.toSqlString(SqlUtil.dummyDialect); if ((type.getSqlTypeName() == SqlTypeName.BIGINT) || ((type.getSqlTypeName() == SqlTypeName.DECIMAL) && (type.getPrecision() == 19))) { // Values which are too large to be literals fail at // validate time. tester.checkFails( "CAST(^" + literalString + "^ AS " + type + ")", "Numeric literal '.*' out of range", false); } else if ( (type.getSqlTypeName() == SqlTypeName.CHAR) || (type.getSqlTypeName() == SqlTypeName.VARCHAR) || (type.getSqlTypeName() == SqlTypeName.BINARY) || (type.getSqlTypeName() == SqlTypeName.VARBINARY)) { // Casting overlarge string/binary values do not fail - // they are truncated. See testCastTruncates(). } else { // Value outside legal bound should fail at runtime (not // validate time). // // NOTE: Because Java and Fennel calcs give // different errors, the pattern hedges its bets. tester.checkFails( "CAST(" + literalString + " AS " + type + ")", "(?s).*(Overflow during calculation or cast\\.|Code=22003).*", true); } } } } public void testCastTruncates() { final SqlTester tester = getTester(); tester.setFor(SqlStdOperatorTable.castFunc); tester.checkScalar( "CAST('ABCD' AS CHAR(2))", "AB", "CHAR(2) NOT NULL"); tester.checkScalar( "CAST('ABCD' AS VARCHAR(2))", "AB", "VARCHAR(2) NOT NULL"); tester.checkScalar( "CAST(x'ABCDEF12' AS BINARY(2))", "ABCD", "BINARY(2) NOT NULL"); if (Bug.Frg283Fixed) { tester.checkScalar( "CAST(x'ABCDEF12' AS VARBINARY(2))", "ABCD", "VARBINARY(2) NOT NULL"); } tester.checkBoolean( "CAST(X'' AS BINARY(3)) = X'000000'", true); tester.checkBoolean( "CAST(X'' AS BINARY(3)) = X''", false); } private List<Object> getValues(BasicSqlType type, boolean inBound) { List<Object> values = new ArrayList<Object>(); for (boolean sign : FalseTrue) { for (SqlTypeName.Limit limit : SqlTypeName.Limit.values()) { Object o = type.getLimit(sign, limit, !inBound); if (o == null) { continue; } if (!values.contains(o)) { values.add(o); } } } return values; } // TODO: Test other stuff } // End SqlOperatorTests.java
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
ffc06f1c49864c4e36dd81ab9279af73177b3dad
8d01b478f9fff8311465c712a75eb70c7fe6761f
/app/src/main/java/com/hikerr/mapbox/components/DrawGeoJsonFromList.java
63b2f6776dc7b3096d78350610f974fa5b975117
[]
no_license
jsasek83/hiking
69fa9366729e1234eb0c15947e31dcd1957681f7
3a6d2cccfa5aa4022d9b900767c5668591a24014
refs/heads/master
2020-04-03T18:20:28.329249
2018-11-27T04:45:22
2018-11-27T04:45:22
155,479,855
0
0
null
null
null
null
UTF-8
Java
false
false
1,593
java
package com.hikerr.mapbox.components; import android.app.Activity; import android.graphics.Color; import android.location.Location; import android.os.AsyncTask; import android.util.Log; import com.mapbox.mapboxsdk.annotations.PolylineOptions; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapboxMap; import java.util.ArrayList; import java.util.List; public class DrawGeoJsonFromList extends AsyncTask<Void, Void, List<LatLng>> { private Activity activity = null; private MapboxMap mapboxMap = null; private List<Location> locationList = null; public void setComponents(Activity activity, MapboxMap mapboxMap, List<Location> locationList){ this.activity = activity; this.locationList = locationList; this.mapboxMap = mapboxMap; } @Override protected List<LatLng> doInBackground(Void... voids) { ArrayList<LatLng> points = new ArrayList<>(); for(Location loc : this.locationList){ LatLng latLng = new LatLng(loc.getLatitude(), loc.getLongitude()); points.add(latLng); } return points; } @Override protected void onPostExecute(List<LatLng> points) { super.onPostExecute(points); Log.d("DrawGeoJsonList", "onPostExecute: "); if (points.size() > 0) { // Draw polyline on map mapboxMap.addPolyline(new PolylineOptions() .addAll(points) .color(Color.parseColor("#3bb2d0")) .width(2)); } } }
[ "jsasek83@gmail.com" ]
jsasek83@gmail.com
02915db5a463bd9d354b748fbd2d192d6d8ec556
3ffc0df57d66aab7ee7b1ea81b3f715a122134e6
/src/main/java/com/rnsolutions/stumblr/dao/PostDao.java
2f094c553e309f0f225b47d4245b304d86280425
[]
no_license
denismp/stumblr
21fbb74fc3b57e68d6b2a8d10e1f6aaae5b1453f
16d204b7a65d590b4f4957218d60aec4632db511
refs/heads/master
2021-01-20T17:29:37.953336
2017-05-10T15:28:16
2017-05-10T15:28:16
90,879,354
0
0
null
null
null
null
UTF-8
Java
false
false
541
java
package com.rnsolutions.stumblr.dao; import com.rnsolutions.core.dao.GenericDao; import com.rnsolutions.stumblr.entity.Post; import java.util.List; import java.util.Map; /** * <p>PostDao interface.</p> * * @author bsneade * @version $Id: $ */ public interface PostDao extends GenericDao<Post, Long> { /** * <p>search</p> * * @param searchCriteria a {@link java.util.Map} object. * @return a {@link java.util.List} object. */ public List<Post> search(final Map<String, Object> searchCriteria); }
[ "denisputnam@verizon.net" ]
denisputnam@verizon.net
89175062002e79c385408de7e62a66b2ad73faa8
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
/project26/src/test/java/org/gradle/test/performance/largejavamultiproject/project26/p134/Test2683.java
af63ef99114320aa509fd8e54922dd1243ec1731
[]
no_license
big-guy/largeJavaMultiProject
405cc7f55301e1fd87cee5878a165ec5d4a071aa
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
refs/heads/main
2023-03-17T10:59:53.226128
2021-03-04T01:01:39
2021-03-04T01:01:39
344,307,977
0
0
null
null
null
null
UTF-8
Java
false
false
2,171
java
package org.gradle.test.performance.largejavamultiproject.project26.p134; import org.junit.Test; import static org.junit.Assert.*; public class Test2683 { Production2683 objectUnderTest = new Production2683(); @Test public void testProperty0() { Production2680 value = new Production2680(); objectUnderTest.setProperty0(value); assertEquals(value, objectUnderTest.getProperty0()); } @Test public void testProperty1() { Production2681 value = new Production2681(); objectUnderTest.setProperty1(value); assertEquals(value, objectUnderTest.getProperty1()); } @Test public void testProperty2() { Production2682 value = new Production2682(); objectUnderTest.setProperty2(value); assertEquals(value, objectUnderTest.getProperty2()); } @Test public void testProperty3() { String value = "value"; objectUnderTest.setProperty3(value); assertEquals(value, objectUnderTest.getProperty3()); } @Test public void testProperty4() { String value = "value"; objectUnderTest.setProperty4(value); assertEquals(value, objectUnderTest.getProperty4()); } @Test public void testProperty5() { String value = "value"; objectUnderTest.setProperty5(value); assertEquals(value, objectUnderTest.getProperty5()); } @Test public void testProperty6() { String value = "value"; objectUnderTest.setProperty6(value); assertEquals(value, objectUnderTest.getProperty6()); } @Test public void testProperty7() { String value = "value"; objectUnderTest.setProperty7(value); assertEquals(value, objectUnderTest.getProperty7()); } @Test public void testProperty8() { String value = "value"; objectUnderTest.setProperty8(value); assertEquals(value, objectUnderTest.getProperty8()); } @Test public void testProperty9() { String value = "value"; objectUnderTest.setProperty9(value); assertEquals(value, objectUnderTest.getProperty9()); } }
[ "sterling.greene@gmail.com" ]
sterling.greene@gmail.com
7980fa3bb5d8d3bba6df943aac68d5bfdf16dd70
c571c6e647056cf0e4add870d4b0d7b64eacd457
/app/src/main/java/com/example/merchantapp/BiometriActivity.java
523f8721e6680bc0f03547778d7bc542f4eed7ed
[]
no_license
vaishnavipagore/MerchantAppfinalChanges
167528a5f9455a58563d2c12f7cb7c1be076daaf
cf5981e82cff836e67807f34d9e21ae20e81153a
refs/heads/master
2023-04-21T20:03:00.483612
2021-05-14T06:55:50
2021-05-14T07:01:20
367,276,359
1
0
null
null
null
null
UTF-8
Java
false
false
2,406
java
package com.example.merchantapp; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.biometric.BiometricManager; import androidx.biometric.BiometricPrompt; import androidx.core.content.ContextCompat; import android.content.Intent; import android.os.Bundle; import java.util.concurrent.Executor; public class BiometriActivity extends AppCompatActivity { Executor executor; BiometricManager biometricManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_biometri); executor = ContextCompat.getMainExecutor(this); biometricManager = BiometricManager.from(this); redirectToScreen(); } public void authuser(Executor ee) { BiometricPrompt.PromptInfo promptInfo =new BiometricPrompt.PromptInfo.Builder() // 2 .setTitle("PayNext Merchant Application") // 3 // 4 .setDescription("You need to Verify Yourself!! use PIN,Pattern or Password") // 5 .setDeviceCredentialAllowed(true) // 6 .build(); BiometricPrompt promt = new BiometricPrompt(this,ee,new BiometricPrompt.AuthenticationCallback(){ @Override public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) { super.onAuthenticationSucceeded(result); startActivity(new Intent(BiometriActivity.this, HomeActivity.class)); } @Override public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) { super.onAuthenticationError(errorCode, errString); finish(); } }); promt.authenticate(promptInfo); } private void redirectToScreen() { if(executor!=null){ switch (biometricManager.canAuthenticate()) { case BiometricManager.BIOMETRIC_SUCCESS: authuser(executor); break; case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE : break; case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE : ;break; case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED : }} } }
[ "vainashvi.pagore@paynext.co.in" ]
vainashvi.pagore@paynext.co.in
90837045834760a9f4e21635d3d02d2e523fc1b5
1169674048fe19f2842ae4ed78629c8d4268d8b2
/src/test/java/com/accenture/automatizacion/stepdefinitions/ReserveAHotelStepDefinitions.java
78c0cb0675c41835884120f42cf4505734cc19ab
[]
no_license
WairaSofiaO/AutomationApp
b0fd64b9511744c745893505aedcc577ebbefb05
a246b42748c7a05fd3865a0705c6c45fa8bac214
refs/heads/master
2020-08-27T00:01:56.719785
2019-10-25T02:04:15
2019-10-25T02:04:15
217,187,115
0
0
null
null
null
null
UTF-8
Java
false
false
2,151
java
package com.accenture.automatizacion.stepdefinitions; import org.openqa.selenium.WebDriver; import com.accenture.automatizacion.tasks.SearchTheRoomWith; import com.accenture.automatizacion.tasks.OpenTheBrowser; import com.accenture.automatizacion.tasks.SearchAHotel; import com.accenture.automatizacion.questions.ObtainedResult; import com.accenture.automatizacion.tasks.Choose; import com.accenture.automatizacion.userinterfaces.TrivagoHomePage; import cucumber.api.java.Before; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import net.serenitybdd.screenplay.Actor; import net.serenitybdd.screenplay.abilities.BrowseTheWeb; import net.thucydides.core.annotations.Managed; import static net.serenitybdd.screenplay.GivenWhenThen.seeThat; public class ReserveAHotelStepDefinitions { //Instanciar Interfaces private TrivagoHomePage trivagoHomePage; //Instanciar Actor private Actor Sofia = Actor.named("Sofia"); //Instanciar el WebDriver @Managed(driver = "chrome") public WebDriver driver; @Before public void setUp() { Sofia.can(BrowseTheWeb.with(driver)); } //Snippets @Given("^the actor looks for (.*) and the date on which her wants to stay$") public void the_actor_looks_for_Medellin_and_the_date_on_which_her_wants_to_stay(String city) { Sofia.wasAbleTo( OpenTheBrowser.on(trivagoHomePage), SearchAHotel.at(city) ); } @Given("^the actor wants her room with amenities and a higher score range of Good$") public void theActorWantsHerRoomWithAmenitiesAndAHigherScoreRangeOfGood() { Sofia.wasAbleTo( SearchTheRoomWith.SatellitTv() //SearchTheRoomWith.GoodOrMorePunctuation() ); } @When("^the actor wants to choose the cheapest room$") public void theActorWantsToChooseTheCheapestRoom(){ Sofia.attemptsTo(Choose.TheCheapestRoom()); } @Then("^To verify the condition of the hotel: excellent, very good or good$") public void toVerifyTheConditionOfTheHotelExcellentVeryGoodOrGood(){ //Sofia.should(Seet);(Verify.Punctuation()); Sofia.should(seeThat(ObtainedResult.successfully())); } }
[ "wairasofiaocamporozco@gmail.com" ]
wairasofiaocamporozco@gmail.com
c6f003e860ecaf86cfcdd15abf2df1d0aa00de08
bf2966abae57885c29e70852243a22abc8ba8eb0
/aws-java-sdk-cloudfront/src/main/java/com/amazonaws/services/cloudfront/model/FieldLevelEncryptionSummary.java
e42c81e8605d386e166768f243a6e3cb677787a8
[ "Apache-2.0" ]
permissive
kmbotts/aws-sdk-java
ae20b3244131d52b9687eb026b9c620da8b49935
388f6427e00fb1c2f211abda5bad3a75d29eef62
refs/heads/master
2021-12-23T14:39:26.369661
2021-07-26T20:09:07
2021-07-26T20:09:07
246,296,939
0
0
Apache-2.0
2020-03-10T12:37:34
2020-03-10T12:37:33
null
UTF-8
Java
false
false
11,233
java
/* * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.cloudfront.model; import java.io.Serializable; import javax.annotation.Generated; /** * <p> * A summary of a field-level encryption item. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/cloudfront-2020-05-31/FieldLevelEncryptionSummary" * target="_top">AWS API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class FieldLevelEncryptionSummary implements Serializable, Cloneable { /** * <p> * The unique ID of a field-level encryption item. * </p> */ private String id; /** * <p> * The last time that the summary of field-level encryption items was modified. * </p> */ private java.util.Date lastModifiedTime; /** * <p> * An optional comment about the field-level encryption item. The comment cannot be longer than 128 characters. * </p> */ private String comment; /** * <p> * A summary of a query argument-profile mapping. * </p> */ private QueryArgProfileConfig queryArgProfileConfig; /** * <p> * A summary of a content type-profile mapping. * </p> */ private ContentTypeProfileConfig contentTypeProfileConfig; /** * <p> * The unique ID of a field-level encryption item. * </p> * * @param id * The unique ID of a field-level encryption item. */ public void setId(String id) { this.id = id; } /** * <p> * The unique ID of a field-level encryption item. * </p> * * @return The unique ID of a field-level encryption item. */ public String getId() { return this.id; } /** * <p> * The unique ID of a field-level encryption item. * </p> * * @param id * The unique ID of a field-level encryption item. * @return Returns a reference to this object so that method calls can be chained together. */ public FieldLevelEncryptionSummary withId(String id) { setId(id); return this; } /** * <p> * The last time that the summary of field-level encryption items was modified. * </p> * * @param lastModifiedTime * The last time that the summary of field-level encryption items was modified. */ public void setLastModifiedTime(java.util.Date lastModifiedTime) { this.lastModifiedTime = lastModifiedTime; } /** * <p> * The last time that the summary of field-level encryption items was modified. * </p> * * @return The last time that the summary of field-level encryption items was modified. */ public java.util.Date getLastModifiedTime() { return this.lastModifiedTime; } /** * <p> * The last time that the summary of field-level encryption items was modified. * </p> * * @param lastModifiedTime * The last time that the summary of field-level encryption items was modified. * @return Returns a reference to this object so that method calls can be chained together. */ public FieldLevelEncryptionSummary withLastModifiedTime(java.util.Date lastModifiedTime) { setLastModifiedTime(lastModifiedTime); return this; } /** * <p> * An optional comment about the field-level encryption item. The comment cannot be longer than 128 characters. * </p> * * @param comment * An optional comment about the field-level encryption item. The comment cannot be longer than 128 * characters. */ public void setComment(String comment) { this.comment = comment; } /** * <p> * An optional comment about the field-level encryption item. The comment cannot be longer than 128 characters. * </p> * * @return An optional comment about the field-level encryption item. The comment cannot be longer than 128 * characters. */ public String getComment() { return this.comment; } /** * <p> * An optional comment about the field-level encryption item. The comment cannot be longer than 128 characters. * </p> * * @param comment * An optional comment about the field-level encryption item. The comment cannot be longer than 128 * characters. * @return Returns a reference to this object so that method calls can be chained together. */ public FieldLevelEncryptionSummary withComment(String comment) { setComment(comment); return this; } /** * <p> * A summary of a query argument-profile mapping. * </p> * * @param queryArgProfileConfig * A summary of a query argument-profile mapping. */ public void setQueryArgProfileConfig(QueryArgProfileConfig queryArgProfileConfig) { this.queryArgProfileConfig = queryArgProfileConfig; } /** * <p> * A summary of a query argument-profile mapping. * </p> * * @return A summary of a query argument-profile mapping. */ public QueryArgProfileConfig getQueryArgProfileConfig() { return this.queryArgProfileConfig; } /** * <p> * A summary of a query argument-profile mapping. * </p> * * @param queryArgProfileConfig * A summary of a query argument-profile mapping. * @return Returns a reference to this object so that method calls can be chained together. */ public FieldLevelEncryptionSummary withQueryArgProfileConfig(QueryArgProfileConfig queryArgProfileConfig) { setQueryArgProfileConfig(queryArgProfileConfig); return this; } /** * <p> * A summary of a content type-profile mapping. * </p> * * @param contentTypeProfileConfig * A summary of a content type-profile mapping. */ public void setContentTypeProfileConfig(ContentTypeProfileConfig contentTypeProfileConfig) { this.contentTypeProfileConfig = contentTypeProfileConfig; } /** * <p> * A summary of a content type-profile mapping. * </p> * * @return A summary of a content type-profile mapping. */ public ContentTypeProfileConfig getContentTypeProfileConfig() { return this.contentTypeProfileConfig; } /** * <p> * A summary of a content type-profile mapping. * </p> * * @param contentTypeProfileConfig * A summary of a content type-profile mapping. * @return Returns a reference to this object so that method calls can be chained together. */ public FieldLevelEncryptionSummary withContentTypeProfileConfig(ContentTypeProfileConfig contentTypeProfileConfig) { setContentTypeProfileConfig(contentTypeProfileConfig); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getId() != null) sb.append("Id: ").append(getId()).append(","); if (getLastModifiedTime() != null) sb.append("LastModifiedTime: ").append(getLastModifiedTime()).append(","); if (getComment() != null) sb.append("Comment: ").append(getComment()).append(","); if (getQueryArgProfileConfig() != null) sb.append("QueryArgProfileConfig: ").append(getQueryArgProfileConfig()).append(","); if (getContentTypeProfileConfig() != null) sb.append("ContentTypeProfileConfig: ").append(getContentTypeProfileConfig()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof FieldLevelEncryptionSummary == false) return false; FieldLevelEncryptionSummary other = (FieldLevelEncryptionSummary) obj; if (other.getId() == null ^ this.getId() == null) return false; if (other.getId() != null && other.getId().equals(this.getId()) == false) return false; if (other.getLastModifiedTime() == null ^ this.getLastModifiedTime() == null) return false; if (other.getLastModifiedTime() != null && other.getLastModifiedTime().equals(this.getLastModifiedTime()) == false) return false; if (other.getComment() == null ^ this.getComment() == null) return false; if (other.getComment() != null && other.getComment().equals(this.getComment()) == false) return false; if (other.getQueryArgProfileConfig() == null ^ this.getQueryArgProfileConfig() == null) return false; if (other.getQueryArgProfileConfig() != null && other.getQueryArgProfileConfig().equals(this.getQueryArgProfileConfig()) == false) return false; if (other.getContentTypeProfileConfig() == null ^ this.getContentTypeProfileConfig() == null) return false; if (other.getContentTypeProfileConfig() != null && other.getContentTypeProfileConfig().equals(this.getContentTypeProfileConfig()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode()); hashCode = prime * hashCode + ((getLastModifiedTime() == null) ? 0 : getLastModifiedTime().hashCode()); hashCode = prime * hashCode + ((getComment() == null) ? 0 : getComment().hashCode()); hashCode = prime * hashCode + ((getQueryArgProfileConfig() == null) ? 0 : getQueryArgProfileConfig().hashCode()); hashCode = prime * hashCode + ((getContentTypeProfileConfig() == null) ? 0 : getContentTypeProfileConfig().hashCode()); return hashCode; } @Override public FieldLevelEncryptionSummary clone() { try { return (FieldLevelEncryptionSummary) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
[ "" ]
848b84e682214b16fecb8eb439d3d309ff087e8c
874b42f65f7f38802c701fecd2a86d3730c6dc07
/Documents/NetBeansProjects/Reto4/src/reto4/controlador/CEmpleado.java
70f4f7750d65bbe3cffe088147e9864eb7f27471
[]
no_license
diegun99/JFrameConJava
0adf50db2feacc8a4a4fb7727d9f88dde2d4a823
46e2003ddb4dca7496e0a5f62dbf55154aec6814
refs/heads/master
2023-07-15T14:40:25.755649
2021-08-12T23:22:16
2021-08-12T23:22:16
395,171,323
0
0
null
null
null
null
UTF-8
Java
false
false
2,346
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 reto4.controlador; import java.util.LinkedHashMap; import java.util.Map; import javax.swing.DefaultListModel; import javax.swing.JList; import javax.swing.JOptionPane; import reto4.modelo.Empleado; /** * * @author martha */ public class CEmpleado { static DefaultListModel modelo = new DefaultListModel(); public static Map<Integer, Empleado> empleados= new LinkedHashMap<>(); public static void registrarEmpleado(Empleado empleado,JList lista){ empleados.put(empleado.getNumDocumento(), empleado); modelo.addElement(empleado); JOptionPane.showMessageDialog(null, "Empleado Registrado"); lista.setModel(modelo); } public static void eliminarEmpleado(int documento,JList lista){ if (empleados.containsKey(documento)) { modelo.removeElement(empleados.get(documento)); empleados.remove(documento); lista.setModel(modelo); JOptionPane.showMessageDialog(null, "Empleado Eliminado"); }else{ JOptionPane.showMessageDialog(null, "Empleado no existe"); } } public static void consultarEmpleado(int documento,JList lista){ if (empleados.containsKey(documento)) { modelo.removeAllElements(); modelo.addElement(empleados.get(documento)); lista.setModel(modelo); }else{ JOptionPane.showMessageDialog(null, "Empleado no existe"); } } public static void modificarEmpleado(int documento,JList lista,Empleado nuevo){ if (empleados.containsKey(documento)) { empleados.put(nuevo.getNumDocumento(), nuevo); modelo.addElement(empleados.get(documento)); lista.setModel(modelo); }else{ JOptionPane.showMessageDialog(null, "Empleado no existe"); } } }
[ "diegun123456789@gmail.com" ]
diegun123456789@gmail.com
498ff0ef67c32b8f8929a95ed9e928e8548b45a7
94551e593129787300e9aba3d98fc3223680712f
/src/main/java/com/example/jwtbasesm2/sm2/SM2SignResult.java
0f092c407e28378a2b7187dda36eb70afaede4ba
[]
no_license
smallbigpony/jwtbasesm2
f56047b4fe9ee49875c1892e3616c1d657ee327d
863ac38dfdb618cab747db0c0adb6167dad53e62
refs/heads/master
2021-08-29T05:36:27.015488
2020-05-15T06:46:56
2020-05-15T06:46:56
252,089,766
0
0
null
null
null
null
UTF-8
Java
false
false
2,279
java
package com.example.jwtbasesm2.sm2; import org.bouncycastle.crypto.signers.DSAEncoding; import org.bouncycastle.crypto.signers.PlainDSAEncoding; import org.bouncycastle.crypto.signers.StandardDSAEncoding; import org.bouncycastle.util.encoders.Hex; import java.math.BigInteger; import java.util.Arrays; public class SM2SignResult { private BigInteger signR; private BigInteger signS; public SM2SignResult() { } public SM2SignResult(BigInteger signR, BigInteger signS) { this.signR = signR; this.signS = signS; } public SM2SignResult(String sign) { int index = sign.indexOf("|"); if(index <= 0){ throw new RuntimeException("signature is not right"); } String sr = sign.substring(0,index); String ss = sign.substring(index+1,sign.length()); this.signR = new BigInteger(sr,16); this.signS = new BigInteger(ss,16); } public BigInteger getSignR() { return signR; } public BigInteger getSignS() { return signS; } @Override public String toString() { return signR.toString(16)+"|"+signS.toString(16); } public byte[] encodeStandardDSA() throws Exception { return encode(StandardDSAEncoding.INSTANCE); } public byte[] encodePlainDSA() throws Exception{ return encode(PlainDSAEncoding.INSTANCE); } public void decodeStandardDSA(byte[] signDSAEncoding) throws Exception{ decode(StandardDSAEncoding.INSTANCE, signDSAEncoding); } public void decodePlainDSA(byte[] signDSAEncoding) throws Exception{ decode(PlainDSAEncoding.INSTANCE, signDSAEncoding); } private byte[] encode(DSAEncoding dsaEncoding) throws Exception { // BigInteger bigIntegerSignR = new BigInteger(Hex.toHexString(getSignR()), 16); //BigInteger bigIntegerSignS = new BigInteger(Hex.toHexString(getSignS()), 16); return dsaEncoding.encode(SM2Constants.SM2_ECC_N, signR, signS); } private void decode(DSAEncoding dsaEncoding, byte[] signDSAEncoding) throws Exception{ BigInteger[] bigIntegers = dsaEncoding.decode(SM2Constants.SM2_ECC_N, signDSAEncoding); this.signR = bigIntegers[0]; this.signS = bigIntegers[1]; } }
[ "2990224753@qq.com" ]
2990224753@qq.com
372f72a18163a0e1a01bca71c29950ed116a2d79
8e95a6b51f6947ef856983ba67621dd901d04027
/shopping-cart/src/main/java/one/digitalinnovation/experts/shoppingcart/model/Cart.java
11ab4054998b64f02a1098d1a3d3a138d915cdef
[]
no_license
brunov007/dio-ecommerce-spring
d6fded891c87cc4112ae50c057de20e88909ebad
ca08edd5f9d3934578802626c129507696b418e9
refs/heads/master
2023-07-06T21:07:33.509662
2021-08-04T00:14:20
2021-08-04T00:14:20
392,492,637
0
0
null
null
null
null
UTF-8
Java
false
false
454
java
package one.digitalinnovation.experts.shoppingcart.model; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.springframework.data.annotation.Id; import org.springframework.data.redis.core.RedisHash; import java.util.List; @Getter @Setter @AllArgsConstructor @NoArgsConstructor @RedisHash("cart") public class Cart { @Id private Integer id; private List<Item> items; }
[ "root@MacBook-Pro-de-Bruno.local" ]
root@MacBook-Pro-de-Bruno.local
5888674f0aee4b8f2df25703ea71a8c33979c9b1
8ee498a82f5450ce3f5b1bd6a1570964b53c1ae8
/src/main/java/com/wxblog/web/service/CategoryService.java
a2a8957ecb3f0bfe9cf95b1dfa5a46035bbf50eb
[]
no_license
NightWish0/w-x-blog
4e9479dd4b99266b8d96b38b87ff698626fb2bd1
b496c49b2e60dcfa0915abb6d6c0aec77beb6504
refs/heads/master
2021-08-16T15:17:46.433495
2018-12-28T08:17:20
2018-12-28T08:17:20
149,580,813
1
1
null
null
null
null
UTF-8
Java
false
false
389
java
package com.wxblog.web.service; import com.wxblog.core.response.ResultJson; import org.springframework.ui.Model; public interface CategoryService { void categories(Model model); void blogCategoryModel(Long categoryId,Model model); ResultJson addCategory(String name); ResultJson updateCategory(Long id,String name); ResultJson deleteCategory(Long categoryId); }
[ "xuxin@dingyantech.com" ]
xuxin@dingyantech.com
d45ec8bb5ca0c8839dcf2e38a574309bfd994d48
3d06505504aea404ae1580717800232982856c97
/assembly-service/src/main/java/com/deividsantos/assembly/model/Agenda.java
64fcb71693e8f53142f0e213d7e08a3b638796e6
[]
no_license
deividfsantos/assembly-service
7103595472ba5d5a069a1fc9923a6e1ecc20c998
97c570d475f3a6cfc26009163fb8094cdd72e191
refs/heads/master
2022-11-22T17:04:17.161477
2020-07-26T23:34:03
2020-07-26T23:34:03
281,856,651
1
0
null
null
null
null
UTF-8
Java
false
false
270
java
package com.deividsantos.assembly.model; public class Agenda { private String description; public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
[ "deividfranciscosantos@hotmail.com" ]
deividfranciscosantos@hotmail.com
e199b42a7000aa3737bd42f19fb054beccc29cf1
6d109557600329b936efe538957dfd0a707eeafb
/src/com/google/api/ads/dfp/v201302/TypeError.java
8d8ce631291ff840dc2aa8b388e4e3be8cc92059
[ "Apache-2.0" ]
permissive
google-code-export/google-api-dfp-java
51b0142c19a34cd822a90e0350eb15ec4347790a
b852c716ef6e5d300363ed61e15cbd6242fbac85
refs/heads/master
2020-05-20T03:52:00.420915
2013-12-19T23:08:40
2013-12-19T23:08:40
32,133,590
0
0
null
null
null
null
UTF-8
Java
false
false
2,706
java
/** * TypeError.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */ package com.google.api.ads.dfp.v201302; /** * An error for a field which is an invalid type. */ public class TypeError extends com.google.api.ads.dfp.v201302.ApiError implements java.io.Serializable { public TypeError() { } public TypeError( java.lang.String fieldPath, java.lang.String trigger, java.lang.String errorString, java.lang.String apiErrorType) { super( fieldPath, trigger, errorString, apiErrorType); } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof TypeError)) return false; TypeError other = (TypeError) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = super.equals(obj); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = super.hashCode(); __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(TypeError.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201302", "TypeError")); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer( _javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer( _javaType, _xmlType, typeDesc); } }
[ "api.arogal@gmail.com@e5600b00-1bfd-11df-acd4-e1cde50d4098" ]
api.arogal@gmail.com@e5600b00-1bfd-11df-acd4-e1cde50d4098
69b05479a453ee1a105c14b4746d0c71b1fe3c4a
86c3aa89402b182b5fb4c9bb1b04d9aa0f8adea4
/funing-dal/src/main/java/com/zheyuan/dal/db/CityMapper.java
001694f9e4b9d1ba42b6dc61c68972c3c2fc3712
[]
no_license
DannisZhang/FuNing
1db50b7a1d5b00721c11a47eed59256c82f89456
d020747224112e3221fad2f685a4bbf4f219337e
refs/heads/master
2016-09-06T14:23:29.325752
2015-08-02T17:08:09
2015-08-02T17:08:09
35,419,449
0
0
null
null
null
null
UTF-8
Java
false
false
717
java
package com.zheyuan.dal.db; import com.zheyuan.dal.entity.CityEntity; import java.util.List; /** * 城市mapper * * @author Dannis * @version 1.0.0 * @date 2015-05-29 23:21 */ public interface CityMapper { /** * 查询所有城市 * * @return 所有城市列表 */ List<CityEntity> queryAllCities(); /** * 根据省份编码查询城市 * * @param provinceCode 省份编码 * @return 城市列表 */ List<CityEntity> queryCityByProvinceCode(String provinceCode); /** * 根据城市名称查找城市编码 * * @param cityName 城市名称 * @return 城市编码 */ String queryCityCodeByName(String cityName); }
[ "danniszhd@163.com" ]
danniszhd@163.com
af744495ffe34d536df3dc1a044a9b93a5c5bd64
9d3d67895395cf460c85bc77b92fa2e918b16da9
/src/com/fixent/publish/server/model/info/SearchInfo.java
d36d5281c08382dab959c188ef2f68bfdbaa5c86
[]
no_license
arulxavier/Publishing
ec44b7b51cb26590fff3332455ace5a849e44889
7e1fbf9f97302dab4b221b64238006ba8149c9ef
refs/heads/master
2021-01-10T13:55:51.541068
2014-07-31T10:10:34
2014-07-31T10:10:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,056
java
package com.fixent.publish.server.model.info; import java.util.Date; public class SearchInfo { Date fromDate; Date toDate; String name; String code; int pincode; String bookName; String mobileNumber; public Date getFromDate() { return fromDate; } public void setFromDate(Date fromDate) { this.fromDate = fromDate; } public Date getToDate() { return toDate; } public void setToDate(Date toDate) { this.toDate = toDate; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public int getPincode() { return pincode; } public void setPincode(int pincode) { this.pincode = pincode; } public String getBookName() { return bookName; } public void setBookName(String bookName) { this.bookName = bookName; } public String getMobileNumber() { return mobileNumber; } public void setMobileNumber(String mobileNumber) { this.mobileNumber = mobileNumber; } }
[ "logicielfixent@gmail.com" ]
logicielfixent@gmail.com
6e2fba1cbf135340354b0692894cfb3ffe914deb
7a18bd6263ef50831ea8c2ea90cb8cafc7b1f59b
/src/notes/Employee.java
baeef843a0628fe9c4bb677b69ea408d110a2334
[]
no_license
Ahmad-Magdy-Osman/OOPJava
0246f95194f5658709480c5ae402ff0a8ea86ea7
637976e2bc07b288c170717a5525762b15948527
refs/heads/master
2022-11-24T02:49:14.298836
2019-01-07T07:04:11
2019-01-07T07:04:11
108,453,338
3
1
null
2022-11-23T11:29:48
2017-10-26T18:57:58
Java
UTF-8
Java
false
false
597
java
package notes; /** * * @author yasiro01 */ public class Employee { private String name; private String ssn; private double salary; private double rate; private double hours; private boolean isSalaried; public Employee(String name, String ssn, double salary, double rate, double hours, boolean isSalaried) { this.name = name; this.ssn = ssn; this.isSalaried = isSalaried; if (isSalaried) { this.salary = salary; this.rate = 0; this.hours = 0; } else { this.salary = 0; this.rate = rate; this.hours = hours; } } }
[ "yasiro01@luther.edu" ]
yasiro01@luther.edu
a5aa22d064d925302da8370c17256144965de6ac
3a5f07a1f249bb93faad21545cc9889e64d971d7
/TankWar/TankWar1.2/src/Missile.java
1b62c514fae5627d4086b03f4a93c51aef6a0386
[]
no_license
lzh0108/java
0331ae96ce6b0949959ff6e7114a97c469093f13
411a6720146d5a4d42f460ca30fbeba6696f68b5
refs/heads/master
2020-03-29T08:47:09.035976
2018-09-21T08:03:04
2018-09-21T08:03:04
149,727,028
0
0
null
null
null
null
UTF-8
Java
false
false
923
java
import java.awt.Color; import java.awt.Graphics; public class Missile { public static final int XSPEED = 10; public static final int YSPEED = 10; public static final int WIDTH = 10; public static final int HEIGHT = 10; int x,y; Tank.Direction dir; public Missile(int x, int y, Tank.Direction dir) { this.x = x; this.y = y; this.dir = dir; } public void draw(Graphics g) { Color c=g.getColor(); g.setColor(Color.BLACK); g.fillOval(x, y, WIDTH, HEIGHT); g.setColor(c); move(); } private void move() { switch (dir) { case L: x -= XSPEED; break; case LU: x -= XSPEED; y -= YSPEED; break; case U: y -= YSPEED; break; case RU: x += XSPEED; y -= YSPEED; break; case R: x += XSPEED; break; case RD: x += XSPEED; y += YSPEED; break; case D: y += YSPEED; break; case LD: x -= XSPEED; y += YSPEED; break; } } }
[ "15138238380@163.com" ]
15138238380@163.com
699451487681bcefe579ac2b9e7a56c19be6866a
f99c2c3af704ab525e68e145ca7e26bc5d9a87f0
/Source/com/tv/xeeng/game/tienlen/data/TienLenTable.java
fd161ad6825f7471576683628c0c827c62856ad2
[]
no_license
crymaster/Test
4fe6df6e47b4d0e6c9bb07870774c51f01030581
efd37c13514a084628e1bfdf756ccd048e9b7f63
refs/heads/master
2020-04-06T03:43:44.293282
2015-04-02T02:33:11
2015-04-02T02:33:11
33,284,404
0
0
null
null
null
null
UTF-8
Java
false
false
78,980
java
package com.tv.xeeng.game.tienlen.data; import com.tv.xeeng.base.business.BusinessException; import com.tv.xeeng.base.common.BlahBlahUtil; import com.tv.xeeng.base.common.LoggerContext; import com.tv.xeeng.base.common.ServerException; import com.tv.xeeng.base.protocol.messages.StartRequest; import com.tv.xeeng.base.session.ISession; import com.tv.xeeng.databaseDriven.DBCache; import com.tv.xeeng.databaseDriven.UserDB; import com.tv.xeeng.game.data.*; import com.tv.xeeng.game.room.Room; import com.tv.xeeng.memcached.data.XEDataUtils; import com.tv.xeeng.protocol.IBusiness; import com.tv.xeeng.protocol.MessageFactory; import java.sql.SQLException; import org.slf4j.Logger; import java.text.SimpleDateFormat; import java.util.*; public class TienLenTable extends SimpleTable { public final static int CARDS_NULL = 0, HIGH_CARD = 1, PAIR = 2, THREE_OF_A_KIND = 3, FOUR_OF_A_KIND = 4, STRAIGHT = 5, STRAIGHT_OF_PAIRS = 6, DEUCE = 12; public final static int FOUR_DEUCES = 7, STRAIGHT_OF_3_PAIRS = 8, STRAIGHT_OF_5_PAIRS = 9, SIX_PAIRS = 10, PERFECT_STRAIGHT = 11; private final static int EXPERIENCE_BET = 1; private final static int TIENLEN_LOG_TYPE = 10005; public ArrayList<TienLenPlayer> superUsers = new ArrayList<>(); private static final Logger logT = LoggerContext.getLoggerFactory().getLogger(TienLenTable.class); private ArrayList<TienLenPlayer> playings = new ArrayList<>(); private ArrayList<TienLenPlayer> waitings = new ArrayList<>(); private int currentIndexOfPlayer; private int preTypeOfCards = -1; private boolean hidePoker = false; private Duty duty; private TienLenPlayer currPlayer; public TienLenPlayer winner; public boolean fightOccur = false; // Mỗi lần xảy ra chặt chém mất tiền thì set là true public boolean isChangeSetting; public int cheat = 0; public long idCheat = 0; //525389; // testing purpose private boolean isProcessEnd = false; public boolean isFull() { return (playings.size() + waitings.size() >= getMaximumPlayer()); } @Override public boolean isFullTable() { return playings.size() + waitings.size() >= getMaximumPlayer(); } public void changeMoney(long m) { isChangeSetting = true; firstCashBet = m; int len = this.playings.size(); for (int i = 0; i < len; i++) { TienLenPlayer p = this.playings.get(i); p.moneyForBet = m; } len = waitings.size(); for (int i = 0; i < len; i++) { TienLenPlayer p = this.waitings.get(i); p.moneyForBet = m; } } @Override public TienLenPlayer getCurrPlayer() { return currPlayer; } public void resetAllReady() { int len = this.playings.size(); for (int i = 0; i < len; i++) { TienLenPlayer p = this.playings.get(i); p.isReady = false; } len = waitings.size(); for (int i = 0; i < len; i++) { TienLenPlayer p = this.waitings.get(i); p.isReady = false; } } public int getCurrentIndexOfPlayer() { return currentIndexOfPlayer; } public ArrayList<TienLenPlayer> getPlayings() { return playings; } public boolean containPlayer(long id) { int len = playings.size(); for (int i = 0; i < len; i++) { if (playings.get(i).id == id) { return true; } } len = waitings.size(); for (int i = 0; i < len; i++) { if (waitings.get(i).id == id) { return true; } } return false; } public ArrayList<TienLenPlayer> getWaitings() { return waitings; } // Create table: owner, money, matchID, numberPlayer public TienLenTable(TienLenPlayer ow, long money, long match, int numPlayer) { logdir = "tienlen"; this.owner = ow; this.firstCashBet = money; this.matchID = match; this.maximumPlayer = numPlayer; this.playings.add(ow); hidePoker = false; /* * timerAuto.setRuning(false); timerAuto.start(); */ } public void ready(long uid, boolean r) throws BusinessException { TienLenPlayer player = findPlayer(uid); if (player == null || player.isOut || player.isOutGame) { throw new BusinessException("ban khong ton tai o ban choi nay"); } player.setReady(r); long now = System.currentTimeMillis(); player.setLastActivated(now); owner.setLastActivated(now); } public boolean isAnyReady() { // if (!isChangeSetting) { // return true; // } int len = this.playings.size(); for (int i = 0; i < len; i++) { TienLenPlayer t = this.playings.get(i); // mLog.error("---THANGTD START DEBUG---" + t.username + " is ready: " + t.isReady); if (t.id != this.owner.id && !t.isReady) { return false; } } return true; } // Player join public void join(TienLenPlayer player) throws TienLenException { // lastActivated = System.curtimeline cssrentTimeMillis(); // player.setLastActivated(lastActivated); if (this.isPlaying) { if (!isFullTable()) { player.isObserve = true; this.waitings.add(player); } else { throw new TienLenException(Messages.FULL_PLAYER_MSG); } } else { if (!isFullTable()) { this.playings.add(player); logMini.append(BlahBlahUtil.getLogString(String.format("[%s] vào bàn", player.username))); } else { throw new TienLenException("Phong da thua nguoi roi ban"); } } mLog.debug("---THANGTD JOIN DEBUG TLMN---" + player.username + " is ready: " + player.isReady); } // Player removed public void remove(TienLenPlayer player) throws TienLenException { try { // out_code.println("Remove player : " + player.id); outCodeSB.append("Remove player ").append(player.id).append(NEW_LINE); if (player != null) { int playingSize = this.playings.size(); for (int i = 0; i < playingSize; i++) { TienLenPlayer p = this.playings.get(i); if (p.id == player.id) { playings.remove(p); if (currPlayer != null && player.id == currPlayer.id) { currPlayer = null; } return; } } int waitingSize = this.waitings.size(); for (int i = 0; i < waitingSize; i++) { TienLenPlayer p = this.waitings.get(i); if (p.id == player.id) { waitings.remove(p); return; } } } } catch (Exception e) { outCodeSB.append("Remove player !!!error ").append(player.id).append(NEW_LINE); StringBuilder error = new StringBuilder(); error.append(e.getMessage()).append(" remove player: ").append(player.username); logT.error(error.toString(), e.getStackTrace()); } } @Override protected List<SimplePlayer> removeNotEnoughMoney() { List<SimplePlayer> removedPlayers = new ArrayList<>(); int len = playings.size(); for (int i = 0; i < len; i++) { if (playings.get(i).notEnoughMoney()) { removedPlayers.add(playings.get(i)); } } boolean isChangeOwner = false; len = removedPlayers.size(); for (int i = 0; i < len; i++) { if (removedPlayers.get(i).id == owner.id) { isChangeOwner = true; } //remove((TienLenPlayer)removedPlayers.get(i)); playings.remove((TienLenPlayer) removedPlayers.get(i)); } if (isChangeOwner) { if (playings.size() > 0) { owner = playings.get(0); resetAutoKickOut(); } } this.setOwnerId(owner.id); return removedPlayers; } // Người chơi nào có quân bài nhỏ nhất được đánh trước private void numStart() { byte num = this.playings.get(0).minCard(); currentTurn = 0; int len = this.playings.size(); for (int i = 1; i < len; i++) { TienLenPlayer p = this.playings.get(i); if (Utils.isBigger(num, p.minCard())) { num = p.minCard(); currentTurn = i; } } this.currPlayer = this.playings.get(currentTurn); // mLog.error("--- TLMN START DEBUG ---currPlayer: " + currPlayer.username + " got min card"); // System.out.println("Min card: " + currPlayer.myHand[0]); } public int getValue(int b) { return (b - 1) % 13; } public String cardToString(int card) { String[] s = {"tep", "bich", "ro", "co"}; StringBuilder sb = new StringBuilder(); sb.append(String.valueOf((getValue(card) + 1))).append(String.valueOf(s[(card - 1) / 13])); return sb.toString(); //return "" + (getValue(card) + 1) + "" + s[(card - 1) / 13]; } public String cardToString(byte[] card) { StringBuilder sb = new StringBuilder(); //String s = ""; int len = card.length; for (int i = 0; i < len; i++) { sb.append(" ").append(cardToString(card[i])); //s = s + " " + cardToString(card[i]); } //return s; return sb.toString(); } private void chiaCheat(int type) { matchNum++; outCodeSB.append("---Start game-----Chia bai MatchId: ").append(matchID).append(" - ").append("Chủ bàn: ").append(owner.username) .append(" - ").append("Tiền cược: ").append(firstCashBet).append(NEW_LINE); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); logMini.append(BlahBlahUtil.getLogString("*** Bắt đầu ***")); String playerList = "Danh sách người chơi: "; for (int i = 0; i < playings.size(); i++) { playerList += String.format("[%s (%d) - %d] ", playings.get(i).username, playings.get(i).id, playings.get(i).cash); } logMini.append(BlahBlahUtil.getLogString(playerList)); Couple<ArrayList<Integer>, ArrayList<Integer>> data = new Couple<>(new ArrayList<Integer>(), new ArrayList<Integer>()); ChiaBai chiaBai = new ChiaBai(); if (type == 0) { chia(); return; } else if (type == 1) { // toi trang int index = (int) Math.round(Math.random() * 3); data = chiaBai.toiTrang(index); } else if (type == 2) { // 3 doi thong lon data = chiaBai.baDoiThongLon(); } else if (type == 3) { // 4 doi thong lon data = chiaBai.bonDoiThongLon(); } int len = playings.size(); if ((len <= 4) && (len > 1)) { int index = 0; for (int i = 0; i < len; i++) { TienLenPlayer p = this.playings.get(i); byte[] cards = new byte[13]; if (p.id == idCheat) { for (int t = 0; t < data.e1.size(); t++) { cards[t] = data.e1.get(t).byteValue(); } } else { for (int j = 13 * index; j < 13 * (index + 1); j++) { cards[j - (13 * index)] = data.e2.get(j).byteValue(); } index++; } p.setMyCards(cards); outCodeSB.append(p.username).append(":"); for (int k = 0; k < cards.length; k++) { outCodeSB.append(" ").append(cards[k]); } outCodeSB.append("; (").append(cardToString(cards)).append(" )"); outCodeSB.append(NEW_LINE); } } else { logT.debug("Sai ne!"); // throw new BusinessException("Em sai roi!"); } } private void chia() { ArrayList<Integer> currList = getRandomList(); int len = playings.size(); if ((len <= 4) && (len > 1)) { for (int i = 0; i < len; i++) { TienLenPlayer p = this.playings.get(i); byte[] cards = new byte[13]; for (int j = 13 * i; j < 13 * (i + 1); j++) { cards[j - (13 * i)] = currList.get(j).byteValue(); } p.setMyCards(cards); outCodeSB.append(p.username).append(":"); int carLen = cards.length; for (int k = 0; k < carLen; k++) { outCodeSB.append(" ").append(cards[k]); } outCodeSB.append(";(").append(cardToString(cards)).append(" )"); outCodeSB.append(NEW_LINE); if (p.id == DBCache.badUserId) { mLog.warn("WARN: Player " + p.username + " in room " + matchID + " has cards: " + cardToString(cards)); } } // out.flush(); // playings.get(3).setMyCards(new byte[]{6, 19, 7, 20, 8, 21, 9, 22, // 43, 12, 51, 23, 34}); } else { logT.debug("Sai ne!"); } } private ArrayList<Integer> getRandomList() { ArrayList<Integer> currList = new ArrayList<>(); for (int i = 0; i < 52; i++) { currList.add(i, i + 1); } Collections.shuffle(currList); // tư qui Ace // res.add(1); // res.add(14); // res.add(27); // res.add(40); // // currList.remove(39); // currList.remove(26); // currList.remove(13); // currList.remove(0); // 3 doi thong va tư qui + heo // res.add(8); // res.add(21); // res.add(34); // res.add(47); // res.add(2); // // // currList.remove(46); // currList.remove(33); // currList.remove(20); // currList.remove(7); // currList.remove(1); // // currList.remove(8); // currList.remove(21); // // currList.remove(9); // currList.remove(22); // // currList.remove(10); // currList.remove(23); return currList; } // Start match public long[] startMatch() throws BusinessException, SQLException { superUsers.clear(); isNewMatch = false; int playingSize = playings.size(); // for (int i = 0; i < playingSize; i++) { // TienLenPlayer p = playings.get(i); // if (com.tv.xeeng.game.data.Utils.isSuperUser(p.id)) { // superUsers.add(p); // } // } //TEst //cheat = 2; // if(superUsers.isEmpty()) { // superUsers.add((TienLenPlayer)owner); // } // currentTimeOut = 30000; lastActivated = System.currentTimeMillis(); resetTable(); long[] L = new long[2]; L[0] = -1; L[1] = -1; if (playingSize > 1) { this.isPlaying = true; isChangeSetting = false; // chia(); cheat = 0; chiaCheat(cheat);// Add New HashMap<Long, XEBadUserEntity> badUsers = XEDataUtils.getAllBadUsers(); for (int i = 0; i < playingSize; i++) { TienLenPlayer p = playings.get(i); int perfectType = checkPerfect(p.myHand); if (perfectType > 0) { // Xác xuất 10% thắng trắng - ThangTD int tl = (int) Math.round(Math.random() * 9); if (tl == 4) { outCodeSB.append(p.username).append(": Tới trắng - perfect type = ").append(perfectType).append(NEW_LINE); L[0] = p.id; L[1] = perfectType; isNewMatch = true; this.winner = p; this.currPlayer = p; // L[1] = PERFECT_3SERIAL_COUPLE; return L; } else { outCodeSB.append(p.username).append(": Tới trắng - perfect type = ").append(perfectType).append(" nhưng cần chia lại!").append(NEW_LINE); return startMatch(); } } else { // mLog.debug("---BAD USER DEBUG--- SIZE: " + badUsers.size()); if (!badUsers.isEmpty()) { XEBadUserEntity badUser = badUsers.get(p.id); if (null != badUser) { // mLog.debug("---BAD USER DEBUG---" + p.username + " Catch"); if (isBaiDep(p)) { // Tính xác xuất được đánh tiếp với bài đẹp này - ThangTD int xs = (int) Math.round(Math.random() * 100); // mLog.debug("---BAD USER DEBUG---" + p.username + " Xác suất: " + xs); if (xs >= badUser.getRate()) { outCodeSB.append(p.username).append(": chia lại vì bài đẹp!").append(NEW_LINE); return startMatch(); } else { outCodeSB.append(p.username).append(": được đánh tiếp!").append(NEW_LINE); } } } } } } if (currPlayer == null || currPlayer != null && currPlayer.isOutGame) { isNewMatch = true; // if (currPlayer != null) // mLog.error("--- TLMN START DEBUG ---currPlayer: " + currPlayer.username + " is not null and is out game"); } if (isNewMatch) { numStart(); } else { // Trường hợp người được đánh trước đã thoát thì chuyển lượt cho người khác // if (currPlayer.isOutGame) { // currPlayer = playings.get(findNext(getUserIndex(getCurrentTurnID()))); // } if (currPlayer == null || currPlayer.isOutGame) { currPlayer = playings.get(findNext(getUserIndex(getCurrentTurnID()))); } } // this.timerAuto.setOwnerSession(ownerSession); // startTime(); /* * try { this.timerAuto.start(); } catch (Exception e) { * this.timerAuto.reset(); } */ } else { logT.debug("Chua co nguoi choi nao!"); this.isPlaying = false; throw new BusinessException("Ban khong the bat dau khi co 1 minh ban"); } return L; } /* * 0: Mot cay binh thuong 1: Đôi thông (cặp, đôi): 2 lá bài có cùng giá trị. * 2: Tam (Xám Cô): 3 lá bài có cùng giá trị. 3: Sảnh (lốc, dây): Một dây * các quân bài có giá trị nối tiếp nhau (không bắt buộc phải đồng chất) * Quân 2 không bao giờ được nằm trong một Sảnh. Quân 2 có thể chặt bất kỳ * quân lẻ nào, đôi 2 có thể chặt bất kỳ các đôi, tam 2 (3 quân 2) có thể * chặt bất kỳ tam khác. 4: Sảnh Rồng: dây các quân bài từ 2 đến A (3-át) 5: * Tứ Quý: 4 quân bài có giá trị giống nhau. Tứ Quý Át, Tứ Quý K 6: Ba đôi * thông: 3 đôi kề nhau 7: Bốn đôi thông: 4 đôi kề nhau. 8: Năm đôi thông * với 5 đôi kề nhau. 9: Bốn đôi thông có 3 bích. 10: Ba đôi thông có 3 * bích. 11: Sau doi */ @Override public TienLenPlayer findPlayer(long uid) { int len = playings.size(); for (int i = 0; i < len; i++) { TienLenPlayer p = this.playings.get(i); if (p.id == uid) { return p; } } len = waitings.size(); for (int i = 0; i < len; i++) { TienLenPlayer p = this.waitings.get(i); if (p.id == uid) { return p; } } return null; } // Give up - player // public void giveUp(long uid) { // try { // TienLenPlayer p = findPlayer(uid); // if (p != null) { // p.isAcive = false; // nextPlayer(); // } else { // mLog.debug("Khong tim thay player" + uid); // } // } catch (SimpleException e) { // } // } public int numRealPlaying() { int sum = 0; int len = playings.size(); for (int i = 0; i < len; i++) { TienLenPlayer p = this.playings.get(i); if (!p.isOutGame) { sum++; } } return sum; } public TienLenPlayer ownerQuit() { int len = playings.size(); for (int i = 0; i < len; i++) { TienLenPlayer p = playings.get(i); if (!p.notEnoughMoney() && !p.isOutGame) { ISession pS = p.currentSession; for (int j = 0; j < len; j++) { playings.get(j).currentOwner = pS; } ownerSession = pS; return p; } } return null; } // private void nextPlayer() { // this.preIndexOfPlayer = this.currentIndexOfPlayer; // int temp = this.currentIndexOfPlayer; // if (temp == this.playings.size() - 1) { // temp = 0; // } else { // temp++; // } // if (this.playings.get(temp).isAcive) { // if (temp == this.currentIndexOfPlayer) { // startNewRound(); // this.preIndexOfPlayer = temp; // } // this.currentIndexOfPlayer = temp; // } else { // nextPlayer(); // } // } public void startNewRound() { // this.preTypeOfCards = -1; int len = playings.size(); for (int i = 0; i < len; i++) { TienLenPlayer p = playings.get(i); p.isAcive = true; } } // Reset auto kickout user public void resetAutoKickOut() { // long timeActivated = System.currentTimeMillis() // + SLEEP_BEETWEEN_MATCH_TIMEOUT; // for (int i = 0; i < this.playings.size(); i++) { // this.playings.get(i).setLastActivated(timeActivated); // // } // // for (int i = 0; i < this.waitings.size(); i++) { // this.waitings.get(i).setLastActivated(timeActivated); // } // owner.setLastActivated(timeActivated); // owner.isReady = true; } // Reset game public void resetTable() { // System.out.println("chạy vào reset table!"); newRound(); int len = playings.size(); for (int i = 0; i < len; i++) { TienLenPlayer player = playings.get(i); player.reset(player.moneyForBet); } lastTurnID = 0; predID = 0; lastCards = new byte[0]; isNewRound = true; resetAutoKickOut(); // if (isNewMatch) { // System.out.println("OMG isperfect!"); // isNewMatch = true; // } // isNewMatch = false; } // Thomc private int currentTurn = 0; // người hiện tại được đi, public long lastTurnID = 0; // người đánh cuối, cập nhật mỗi lần đánh vòng // mới hoặc chặt public long predID = 0; // người đi trước đấy (hoặc vừa bỏ lượt) public byte[] lastCards = new byte[0];// (các) quân bài vừa đánh public boolean isNewRound = true; public boolean isNewMatch = true; public final static int SUCCESS = 0, INVALID_PLAY = 1, INVALID_FIGTH = 2, INVALID_TURN = 3, INVALID_GIVEUP = 6, END_MATCH = 4, END_MATCH_PERFECT = 5, CARDS_NOT_FOUND = 7; public ArrayList<long[]> fightInfo = new ArrayList(); // lưu thông tin khi chặt bài; để xử lý chặt chồng; public int play(long uid, String cards, boolean isGiveup, boolean isTimeOut) throws TienLenException { getDuty().setYourDuty(false); int cardType = CARDS_NULL; if (cards != null) { cardType = checkCardsType(Utils.stringToByte(cards)); } // if (uid == getCurrentTurnID() || (!isGiveup && !isNewRound // && ((cardType == CARDS_SERIAL_COUPLE && Utils.stringToByte(cards).length == 8) || cardType == CARDS_TUQUY))) { if (uid == getCurrentTurnID()) { lastActivated = System.currentTimeMillis(); // 4 đôi thông được chặt không cần hỏi // boolean noNeedTurn = (cardType == CARDS_SERIAL_COUPLE && Utils.stringToByte(cards).length == 8) || cardType == CARDS_TUQUY; if (isGiveup) { outCodeSB.append(currPlayer.username).append(" : giveUp").append(NEW_LINE); } else { outCodeSB.append(currPlayer.username).append(" : play : ").append(cards).append(" [").append(cardToString(Utils.stringToByte(cards))) .append(" ]").append(NEW_LINE); } // out.flush(); if (!isGiveup) { byte[] fightCard = Utils.stringToByte(cards); // if (!noNeedTurn && !currPlayer.isContainsCards(fightCard)) { // Refind current player - ThangTD for (TienLenPlayer player : this.playings) { if (player.id == uid) { currPlayer = null; currPlayer = player; break; } } if (!currPlayer.isContainsCards(fightCard)) { try { mLog.error("--- TLMN TURN DEBUG --- CARD NOT FOUND BEGIN IN ROOM " + matchID); mLog.error("--- TLMN TURN DEBUG --- Current Player " + currPlayer.username + " fight " + cards); mLog.error("--- TLMN TURN DEBUG --- Current Player " + currPlayer.username + " has" + Arrays.toString(currPlayer.myHand)); for (TienLenPlayer player : this.playings) { mLog.error("--- TLMN TURN DEBUG --- Player " + player.username + " has" + cardToString(player.myHand) + " -- " + Arrays.toString(player.myHand)); } mLog.error("--- TLMN TURN DEBUG --- CARD NOT FOUND END"); } catch (Exception e) { mLog.error(e.getMessage()); } return CARDS_NOT_FOUND; } if (isNewRound) { startNewRound();// TODO: fix error turn if (isValidTurn(fightCard)) { getDuty().checkDuty(currPlayer, cardType, cards); fightOccur = false; // Người được đi lúc đầu phải đánh (các) quân bài chứa // quân bài nhỏ nhất // if (isNewMatch) { // if (cards[0] != users[0].myHand[0]) { // pushDebug("Quân bài đánh ra lần đầu phải chứa quân nhỏ nhất!"); // return; // } else { // isNewMatch = false; // } // } // System.out.println("currPlayer: " + // currPlayer.username); if (currPlayer.numHand > 0) { currPlayer.removeCards(fightCard); } // System.out.println("Quân bài còn lại: " + // currPlayer.numHand); if (currPlayer.numHand <= 0) { // System.out.println("Kết thúc ván (có người chơi hết bài)!"); resetAutoKickOut(); isPlaying = false; this.winner = currPlayer; return END_MATCH; } isNewRound = false; lastCards = fightCard; lastTurnID = uid; } else { // System.out.println("Đánh không hợp lệ!"); outCodeSB.append("!!!!!!!Đánh không hợp lệ userId: ").append(uid).append(" current index: ").append(currentIndexOfPlayer).append(" card ") .append(cards).append(NEW_LINE); byte[] sortedCards = Utils.sortCards(fightCard); outCodeSB.append("!!!!!!!Sorted cards: ").append(cardToString(sortedCards)).append(NEW_LINE); logT.error(concatString("!!!!! Error Tien len play (invalid turn) ", " matchId ", String.valueOf(matchID))); return INVALID_PLAY; } } else { if (isValidFight(fightCard, lastCards)) { getDuty().checkDuty(currPlayer, cardType, cards); findPlayer(uid).removeCards(fightCard); int lastCardsType = checkCardsType(lastCards); // int fightCardsType = checkCardsType(fightCard); if (((Utils.getValue(lastCards[lastCards.length - 1]) == 12 || lastCardsType == FOUR_OF_A_KIND || (lastCardsType == STRAIGHT_OF_PAIRS)) && (Utils.getValue(fightCard[fightCard.length - 1]) != 12))) { fightOccur = true; // System.out.println("Chặt heo/hàng !"); fightProcess(lastTurnID, uid, lastCards); findPlayer(uid).isAcive = true;// lúc thằng có 4 đôi // thông bỏ lượt rùi // sau đó nó chặt // không cần tới // lượt nên phải // active lại cho nó } else { fightOccur = false; } if (currPlayer.numHand == 0) { // Kết thúc ván (có người chơi hết bài) // System.out.println("Kết thúc ván (có người chơi hết bài)!"); this.winner = currPlayer; saveLogToFile(); return END_MATCH; } lastCards = fightCard; lastTurnID = uid; } else { // System.out.println("Chặt không hợp lệ!"); return INVALID_FIGTH; } } } else { if ((!isTimeOut) && (isNewRound)) { return INVALID_GIVEUP; } fightOccur = false; findPlayer(uid).isAcive = false; } predID = uid; nextUser(getUserIndex(uid)); return SUCCESS; } else { // System.out.println("Không đúng lượt đi!"); outCodeSB.append("!!!!!!!Không đúng lượt đi userId: ").append(uid).append(" current index: ").append(currentIndexOfPlayer).append(" card ") .append(cards).append(NEW_LINE); outCodeSB.append("!!!!!!!Lượt đi hiện tại là: ").append(getCurrentTurnID()).append(NEW_LINE); return INVALID_TURN; } } // xử lý chặt/chặt chồng; public void fightProcess(long preID, long fightID, byte[] cards) { // trường hợp chặt đè if (fightInfo.size() == 1) { long data[] = new long[5]; long preData[] = fightInfo.get(0); // người bị chặt đè long overFightID = preData[1]; TienLenPlayer overFightPlayer = findPlayer(overFightID); data[0] = overFightID; // người chặt hiện tại data[1] = fightID; TienLenPlayer fightPlayer = findPlayer(fightID); // người bị chặt lúc đầu long firstID = preData[0]; TienLenPlayer firstPlayer = findPlayer(firstID); data[3] = firstID; // trả lại tiền cho người bị chặt lúc đầu // tiền trả lại bị tính phế - ThangTD long returnMoney = preData[2]; long returnMoneyAfterTax = (long) ((double) returnMoney * REAL_GOT_MONEY); // firstPlayer.money += returnMoney; firstPlayer.money += returnMoneyAfterTax; // data[4] = returnMoney; data[4] = returnMoneyAfterTax; // người bị chặt đè phải trả lại số tiền ăn (có phế) trước đó - ThangTD overFightPlayer.money -= returnMoneyAfterTax; // và chịu toàn bộ tiền chặt long newMoney = caculateMoneyFight(cards); // tiền chặt mới long totalMoney = overFightPlayer.moneyLost(returnMoney + newMoney); long totalMoneyAfterTax = (long) ((double) totalMoney * REAL_GOT_MONEY); overFightPlayer.money -= totalMoney; // fightPlayer.money += newMoney; fightPlayer.money += totalMoneyAfterTax; data[2] = totalMoney; fightInfo = new ArrayList<>(); fightInfo.add(data); } // chặt 1 lần else { TienLenPlayer prePlayer = findPlayer(preID); TienLenPlayer fightPlayer = findPlayer(fightID); long fightMoney = prePlayer.moneyLost(caculateMoneyFight(cards)); prePlayer.money -= fightMoney; // fightPlayer.money += fightMoney; fightPlayer.money += (long) ((double) fightMoney * REAL_GOT_MONEY); // tính phế tiền ăn - ThangTD long data[] = new long[3]; data[0] = preID; data[1] = fightID; data[2] = fightMoney; fightInfo.add(data); } } // Tính tiền bị chặt public long caculateMoneyFight(byte[] cards) { long newMoney = 0; int cardsType = checkCardsType(cards); switch (cardsType) { case FOUR_OF_A_KIND: newMoney = 7 * firstCashBet; break; case STRAIGHT_OF_PAIRS: if (cards.length == 6) { // 3 đôi thông newMoney = 5 * firstCashBet; // 3 đôi thông } else { // 4 đôi thông newMoney = 13 * firstCashBet; // 4 đôi thông } break; default: for (int i = 0; i < cards.length; i++) { // heo đen if (Utils.getType(cards[i]) == 1 || Utils.getType(cards[i]) == 2) { newMoney += 2 * firstCashBet; // heo đen } else {// heo đỏ newMoney += 5 * firstCashBet; // heo đỏ } } break; } return newMoney; } public long getCurrentTurnID() { // return playings.get(currentTurn).id; if (currPlayer != null && findPlayer(currPlayer.id) == null) { currPlayer = (TienLenPlayer) owner; return owner.id; } return currPlayer.id; } public void newRound() { isNewRound = true; lastCards = new byte[0]; int len = this.playings.size(); for (int i = 0; i < len; i++) { TienLenPlayer p = playings.get(i); p.isAcive = true; } fightInfo = new ArrayList<>(); } public void nextUser(int preIndex) { // System.out.println("number user: " + playings.size()); // System.out.println("getUserIndex(lastTurnID)" + // getUserIndex(lastTurnID)); currentTurn = preIndex; int count = 0; int playingSize = playings.size(); while (count < playingSize) { currentTurn++; currentTurn = currentTurn % playingSize; // if ((!playings.get(currentTurn).isAcive || playings.get(currentTurn).isOutGame) && playings.get(currentTurn).id != lastTurnID) { if (!playings.get(currentTurn).isAcive && playings.get(currentTurn).id != lastTurnID) { count++; // this user is out } else { break; } } // currentTurn = currentTurn % playings.size(); if (count < playingSize) { currPlayer = playings.get(currentTurn); if (playings.get(currentTurn).id == lastTurnID) { newRound(); } else { isNewRound = false; } } else { outCodeSB.append("Error next user").append(NEW_LINE); logT.error(concatString("Error next user matchId: ", String.valueOf(matchID))); } // startTime(); // System.out.println("number user: " + playings.size()); } public int findNext(int preIndex) { int point = preIndex; int count = 0; int playingSize = playings.size(); while (count < playingSize) { count++; point++; point = point % playings.size(); if (!playings.get(point).isOutGame) { return point; } } return -1; } public int getUserIndex(long id) { int len = playings.size(); for (int i = 0; i < len; i++) { if (playings.get(i).id == id) { return i; } } return -1; } // Kiểm tra quân bài đánh ra trong lượt mới có hợp lệ không public boolean isValidTurn(byte[] cards) { if (checkCardsType(cards) > 0) { return true; } else { return false; } } // kiểm tra chặt quân có hợp lệ không public boolean isValidFight(byte[] fightCards, byte[] lastCards) { if (fightCards == null || lastCards == null || fightCards.length == 0 || lastCards.length == 0) { return false; } fightCards = Utils.sortCards(fightCards); lastCards = Utils.sortCards(lastCards); // chặt cùng cấp (số quân bằng nhau) if (fightCards.length == lastCards.length) { if (checkCardsType(fightCards) != checkCardsType(lastCards)) { return false; } else { return Utils.isBigger(fightCards[fightCards.length - 1], lastCards[lastCards.length - 1]); } } // chặt đặc biệt else { // chặt băng tứ quý if (checkCardsType(fightCards) == FOUR_OF_A_KIND) { // Tứ quý chặt 1 quân 2, hoặc 1 đôi 2, hoặc 3 đôi thông bất kỳ if ((checkCardsType(lastCards) <= 2 && Utils.getValue(lastCards[lastCards.length - 1]) == 12) || (checkCardsType(lastCards) == STRAIGHT_OF_PAIRS && lastCards.length == 6)) { // System.out.println("Chặt bằng Tứ Quý!"); return true; } else { return false; } } else if (checkCardsType(fightCards) == STRAIGHT_OF_PAIRS) { switch (fightCards.length) { // chặt = 3 đôi thông (chặt được 1 heo :p) case 6: if (lastCards.length == 1 && Utils.getValue(lastCards[0]) == 12) { // System.out.println("Chặt 2 bằng 3 đôi thông !"); return true; } else { return false; } // 4 đôi thông chặt 1 quân 2, hoặc 1 đôi 2, hoặc 3 đôi thông bất kỳ và tứ quý case 8: if ((checkCardsType(lastCards) <= 2 && Utils.getValue(lastCards[lastCards.length - 1]) == 12) || (checkCardsType(lastCards) == STRAIGHT_OF_PAIRS && lastCards.length == 6) || checkCardsType(lastCards) == FOUR_OF_A_KIND) { // System.out.println("Chặt bằng 4 đôi thông!"); return true; } else { return false; } default: return false; } } else { return false; } } // return true; } // trả về loại quân bài(s) đánh ra public int checkCardsType(byte cards[]) { int carLength = cards.length; if (cards == null || carLength == 0) { return CARDS_NULL; } if (carLength == 1) { return HIGH_CARD; } for (int i = 0; i < carLength - 1; i++) { if (Utils.getValue(cards[i]) != Utils.getValue(cards[i + 1])) { if (carLength > 2) { if (isSerialCards(cards)) { return STRAIGHT; } else if (isSerialCouple(cards)) { return STRAIGHT_OF_PAIRS; } else { return -1; } } else { return -1; } } } switch (carLength) { case 2: return PAIR; case 3: return THREE_OF_A_KIND; case 4: return FOUR_OF_A_KIND; default: return -1; } } // kiểm tra các quân bài có phải là bộ dây (Sảnh) hay không public boolean isSerialCards(byte[] cards) { int carLength = cards.length; if (cards == null || carLength == 0) { return false; } // Trong sảnh không bao giờ chứa quân 2 trừ sảnh rồng // A có giá trị là 11, 2 có giá trị là 12 for (int i = 0; i < carLength; i++) { if (Utils.getValue(cards[i]) == 12 && carLength != 13) { return false; } } cards = Utils.sortCards(cards); for (int i = 0; i < carLength - 1; i++) { if (Utils.getValue(cards[i] + 1) != Utils.getValue(cards[i + 1])) { return false; } } return true; } // kiểm tra các quân bài là các cặp đôi liên tiếp nhau (n đôi thông) public boolean isSerialCouple(byte[] cards) { int carLength = cards.length; if (cards == null || carLength < 6 || carLength % 2 != 0) { return false; } // Trong sảnh không bao giờ chứa quân 2 for (int i = 0; i < carLength; i++) { if (Utils.getValue(cards[i]) == 12) { return false; } } Utils.sortCards(cards); // System.out.println("length: " + cards.length); for (int i = 0; i < carLength - 3; i += 2) { if (!(Utils.getValue(cards[i]) == Utils.getValue(cards[i + 1]) && (Utils.getValue(cards[i + 1]) + 1 == Utils.getValue(cards[i + 2])))) { return false; } } if (Utils.getValue(cards[carLength - 1]) == Utils.getValue(cards[carLength - 2])) { return true; } else { return false; } } private static Poker intToPoker(int i) { int n = (i - 1) % 13 + 1; int t = (i - 1) / 13 + 1; return new Poker(n, intToPokerType(t)); } private static PokerType intToPokerType(int t) { if (t == 1) { return PokerType.Spades; } else if (t == 2) { return PokerType.Clubs; } else if (t == 3) { return PokerType.Diamonds; } else if (t == 4) { return PokerType.Hearts; } // if (t == 4) { // return PokerType.Co; // } else if (t == 3) { // return PokerType.Ro; // } else if (t == 1) { // return PokerType.Pic; // } else if (t == 2) { // return PokerType.Tep; // } return null; } public static void main(String[] args) { ChiaBai ch = new ChiaBai(); // byte[] data = new byte[13]; // ArrayList<Integer> d = ch.toiTrang(2).e1; // for (int i = 0; i < d.size(); i++) { // data[i] = d.get(i).byteValue(); // } // byte[] data = new byte[]{3,29,31,44,32,45,21,8,47,35,48,24,11}; byte[] data = new byte[]{42, 19, 3, 45, 20, 17, 4, 33, 48, 22, 23, 49, 2}; data = Utils.sortCards(data); // for (byte b : data) { // System.out.println(b + " - " + intToPoker(b).toString()); // } System.out.println(is6Couple(data)); } // kiểm tra trường hợp bài vừa chia xong có 6 đôi --> tới trắng public static boolean is6Couple(byte[] myHand) { int numCouple = 0; int i = 0; int length = myHand.length; while (i < length - 1) { if (intToPoker(myHand[i]).isDoi(intToPoker(myHand[i + 1]))) { numCouple++; i += 2; } else { i++; } } return (numCouple == 6); /*int notInCouple = 0; for (int i = 1; i < myHand.length - 1; i++) { if (!(Utils.getValue(myHand[i]) == Utils.getValue(myHand[i + 1]) || Utils .getValue(myHand[i]) == Utils.getValue(myHand[i - 1]))) { notInCouple++; } } if (Utils.getValue(myHand[0]) != Utils.getValue(myHand[1])) { notInCouple++; } if (Utils.getValue(myHand[myHand.length - 1]) != Utils .getValue(myHand[myHand.length - 2])) { notInCouple++; } // pushDebug("notInCouple=" + notInCouple); if (notInCouple < 2) { int couple3 = 0; byte preCard = -1; for (int i = 0; i < myHand.length - 1; i++) { int num = 0; for (int j = 0; j <= myHand.length - 1; j++) { if (Utils.getValue(myHand[i]) == Utils.getValue(myHand[j])) { num++; } } if (num == 3 && myHand[i] != preCard) { couple3++; preCard = myHand[i]; } } // pushDebug("couple3=" + couple3); if ((couple3 <= 1 && notInCouple == 0) || (couple3 == 0 && notInCouple == 1)) { // System.out.println("Tới trắng 6 đôi!!!"); return true; } } return false;*/ } // Kiểm tra trường hợp bài vừa chia có 5 đôi thông --> tới trắng public boolean is5SerialCouple(byte[] myHand) { Vector tempVector = new Vector(); int len = myHand.length; for (int i = 0; i < len - 1; i++) { if (Utils.getValue(myHand[i]) == Utils.getValue(myHand[i + 1]) && Utils.getValue(myHand[i]) != 12) { tempVector.addElement(Utils.getValue(myHand[i]) + ""); } } int coupleNum = 0; len = tempVector.size(); for (int j = 0; j < len - 1; j++) { if (Byte.parseByte(tempVector.elementAt(j).toString()) + 1 == Byte.parseByte(tempVector.elementAt(j + 1).toString())) { coupleNum++; } } // Note: có trường hợp không phải 5 đôi thông nhưng thuộc vào 6 đôi nên // phải gọi is6Couple trước trong checkPerfect :D if (coupleNum >= 4) { // System.out.println("Tới trắng 5 đôi thông!!!"); return true; } return false; } // Kiểm tra trường hợp bài vừa chia có phải là sảnh rồng hay không --> tới trắng public boolean isSanhRong(byte[] myHand) { if (checkCardsType(myHand) == STRAIGHT) { return true; } else { Vector tempVector = new Vector(); int len = myHand.length; for (int i = 0; i < len; i++) { boolean isAdded = false; for (int j = 0; j < tempVector.size(); j++) { if (Utils.getValue(myHand[i]) == Utils.getValue(Byte.parseByte(tempVector.elementAt(j).toString()))) { isAdded = true; break; } } if (!isAdded) { tempVector.addElement(myHand[i] + ""); } } if (tempVector.size() == 12) { byte[] tempCards = new byte[12]; for (int k = 0; k < tempVector.size(); k++) { tempCards[k] = Byte.parseByte(tempVector.elementAt(k).toString()); } if (checkCardsType(tempCards) == STRAIGHT) { return true; } } } return false; } // kiểm tra trường hợp thắng ngay khi chia bài xong(tới trắng) public int checkPerfect(byte[] myHand) { int len = myHand.length; if (myHand == null || len != 13) { outCodeSB.append("Bài vừa chia không đúng!!!").append(NEW_LINE); return -1; } // bài có tứ quý 2 byte[] firstCards = new byte[4]; byte[] lastCards = new byte[4]; int lastIndex = 0; for (int i = 0; i < len; i++) { if (i >= 0 && i <= 3) { firstCards[i] = myHand[i]; } else if (i >= len - 4 && i <= len - 1) { lastCards[lastIndex] = myHand[i]; lastIndex++; } } // if ((checkCardsType(firstCards) == CARDS_TUQUY && Utils // .getValue(firstCards[0]) == 0) // || (checkCardsType(lastCards) == CARDS_TUQUY && Utils // .getValue(lastCards[0]) == 12)) { // // System.out.println("Tới trắng Tứ Quý!!!"); // return PERFECT_TUQUY; // } // // 3 đôi thông có 3 bích // if (Utils.getValue(myHand[0]) == Utils.getValue(myHand[1]) // && Utils.getValue(myHand[0]) == 0 // && Utils.getType(myHand[0]) == 1) { // int count4 = 0, count5 = 0; // for (int i = 2; i < myHand.length; i++) { // if (Utils.getValue(myHand[i]) == 1) { // count4++; // } else if (Utils.getValue(myHand[i]) == 2) { // count5++; // } // } // if (count5 >= 2 && count4 >= 2) { // // System.out.println("Tới trắng 3 đôi thông 3 bích!!!"); // return PERFECT_3SERIAL_COUPLE; // } // } if (checkCardsType(lastCards) == FOUR_OF_A_KIND && Utils.getValue(lastCards[0]) == 12) { // System.out.println("Tới trắng Tứ Quý!!!"); return FOUR_DEUCES; } // 6 đôi if (is6Couple(myHand)) { // System.out.println("Tới trắng 6 đôi!!!"); return SIX_PAIRS; } // 5 đôi thông if (is5SerialCouple(myHand)) { // System.out.println("Tới trắng 5 đôi thông!!!"); return STRAIGHT_OF_5_PAIRS; } // Sảnh rồng if (isSanhRong(myHand)) { // System.out.println("Tới trắng Sảnh rồng!!!"); return PERFECT_STRAIGHT; } return -1; } // gửi về thông tin và bài của người chơi trong trường hợp tới trắng! public ArrayList<String[]> getPlayerInfoInPerfectWin(long idWin) throws TienLenException { outCodeSB.append("--- GetEndGamePerfect ---").append(NEW_LINE); ArrayList arr = new ArrayList(); long winMoney = 0; int playingSize = playings.size(); int indexWiner = 0; for (int i = 0; i < playingSize; i++) { TienLenPlayer p = playings.get(i); if (p.id != idWin) { String[] o = new String[5]; o[0] = Long.toString(p.id); o[1] = Utils.bytesToString(p.myHand); long lostMoney = p.moneyLost(26 * firstCashBet);// thua trắng 26 lá if (winner.cash < lostMoney) { lostMoney = winner.cash; } if (lostMoney > p.cash) { lostMoney = p.cash; } winMoney += lostMoney; p.money -= lostMoney; o[2] = Long.toString(-lostMoney); o[3] = concatString(p.username, ": -", String.valueOf(lostMoney), "$ thua trắng!"); o[4] = Integer.toString(i); arr.add(o); p.setExperience(EXPERIENCE_BET); } else { indexWiner = i; p.setExperience(playings.size()); } } winner.money += (long) ((double) winMoney * REAL_GOT_MONEY); updateCash(); String[] winnerO = new String[5]; winnerO[0] = Long.toString(idWin); winnerO[1] = Utils.bytesToString(winner.myHand); winnerO[2] = Long.toString(winner.money); winnerO[3] = concatString(winner.username, ": +", String.valueOf(winMoney), "$ tới trắng!"); winnerO[4] = Integer.toString(indexWiner); arr.add(winnerO); outCodeSB.append(winnerO[3]).append(NEW_LINE); saveLogToFile(); return arr; } // trả về kết quả lúc hết ván public ArrayList<String[]> GetEndGame(long idWin) throws TienLenException { ArrayList arr = new ArrayList(); long winMoney = 0; outCodeSB.append("--- GetEndGame ---").append(NEW_LINE); int bonusTimes = 1; // if (duty.getCurrDutyPlayerId() == winner.id) { // this user did duty // bonusTimes = duty.getBonusTimes(); // No duty babe! - ThangTD // outCodeSB.append("----duty times -- ").append(bonusTimes).append(NEW_LINE); // } int playingSize = playings.size(); int indexWinner = 0; for (int i = 0; i < playingSize; i++) { TienLenPlayer p = playings.get(i); if (p.id != idWin) { String[] Oj = countCard(p, bonusTimes); if (Oj != null) { long preEndMoney = p.cash + p.money > 0 ? p.cash + p.money : 0; long cardLostMoney = Long.parseLong(Oj[1]) < preEndMoney ? Long.parseLong(Oj[1]) : preEndMoney; if (winner.cash < cardLostMoney) { cardLostMoney = winner.cash; } p.money -= cardLostMoney; winMoney += (long) (cardLostMoney * REAL_GOT_MONEY); Oj[1] = Long.toString(p.money); Oj[4] = Integer.toString(i); arr.add(Oj); p.setExperience(EXPERIENCE_BET); } } else { indexWinner = i; p.setExperience(playings.size()); } } winner.money += winMoney; updateCash(); String[] winnerO = new String[5]; winnerO[0] = Long.toString(idWin); winnerO[1] = Long.toString(winner.money); winnerO[2] = concatString(winner.username, ": ", String.valueOf(winner.money), "$, Về nhất!"); winnerO[4] = Integer.toString(indexWinner); arr.add(winnerO); outCodeSB.append(winnerO[2]).append(NEW_LINE); outCodeSB.append("--- End game --- Winner ---").append(winner.username).append(NEW_LINE); outCodeSB.append("----------------------------------").append(NEW_LINE); outCodeSB.append(NEW_LINE); logMini.append(BlahBlahUtil.getLogString("*** Kết thúc ***")); saveLogToFile(); return arr; } public void resetPlayers() { // remove người chơi thoát giữa chừng để chuẩn bị ván mới ArrayList<TienLenPlayer> needRemovePlayer = new ArrayList<>(); // synchronized (lockPlaying) { int playingSize = this.playings.size(); for (int i = 0; i < playingSize; i++) { TienLenPlayer p = this.playings.get(i); if (p.isOut || p.notEnoughMoney()) { needRemovePlayer.add(p); } } int removeSize = needRemovePlayer.size(); if (removeSize > 0) { for (int i = 0; i < needRemovePlayer.size(); i++) { playings.remove(needRemovePlayer.get(i)); } } playings.addAll(waitings); waitings.clear(); isProcessEnd = false; playingSize = this.playings.size(); for (int i = 0; i < playingSize; i++) { TienLenPlayer p = this.playings.get(i); p.numHand = 0; } isChangeSetting = false; // } resetAutoKickOut(); } // đếm heo/hàng trong bài còn lại khi kết thúc ván public String[] countCard(TienLenPlayer p, int bonusTimes) { int count_2red = 0;// số quân heo đỏ int count_2black = 0;// số quân heo đen int count_tuquy = 0;// số tứ quý trong bài int count_3couple = 0;// số 3 đôi thông trong bài long lostMoney = 0; StringBuilder note = new StringBuilder(); int numHand = p.numHand; byte[] myHand = p.myHand; if (myHand == null || numHand == 0) { return null; } else { if (numHand == 13) { note.append("phạt cóng! "); lostMoney += 26 * firstCashBet; // phạt cóng = 26 lá } else { note.append("còn ").append(numHand).append(" lá, "); lostMoney += numHand * firstCashBet; } for (int i = 0; i < numHand; i++) { if (Utils.getValue(myHand[i]) == 12) { if (Utils.getType(myHand[i]) == 1 || Utils.getType(myHand[i]) == 2) { count_2black++; lostMoney += 2 * firstCashBet; // heo đen = 2 lá } else { count_2red++; lostMoney += 5 * firstCashBet; // heo đỏ = 5 lá } } } if (count_2black > 0 || count_2red > 0) { note.append("thối "); if (count_2black > 0) { note.append(count_2black).append(" heo đen, "); } if (count_2red > 0) { note.append(count_2red).append(" heo đỏ, "); } } if (numHand >= 4) { int[] appearRate = new int[12];// tần suất xuất hiện các quân bài for (int i = 0; i < 12; i++) { appearRate[i] = 0; } for (int j = 0; j < numHand; j++) { if (Utils.getValue(myHand[j]) != 12) { appearRate[Utils.getValue(myHand[j])]++; } } // kiểm tra có 4 đôi thông không if (numHand >= 4) { for (int i = 0; i < appearRate.length - 3; i++) { // for (int i = 0; i < appearRate.length - 4; i++) { if (appearRate[i] >= 2 && appearRate[i + 1] >= 2 && appearRate[i + 2] >= 2 && appearRate[i + 3] >= 2) { for (int j = 0; j < 4; j++) { appearRate[i + j] = appearRate[i + j] - 2; } lostMoney += 13 * firstCashBet; // 4 đôi thông = 13 // lá note.append("bốn đôi thông, "); // money=money+13; } } // kiểm tra tứ quý for (int i = 0; i < appearRate.length; i++) { if (appearRate[i] == 4) { appearRate[i] = 0; count_tuquy++; lostMoney += 7 * firstCashBet; // tứ quý = 7 lá // money=money+7; } } if (count_tuquy > 0) { note.append(count_tuquy).append("tứ quý, "); } // kiểm tra có 3 đôi thông không for (int i = 0; i < appearRate.length - 2; i++) { // for (int i = 0; i < appearRate.length - 3; i++) { if (appearRate[i] >= 2 && appearRate[i + 1] >= 2 && appearRate[i + 2] >= 2) { count_3couple++; lostMoney += 5 * firstCashBet; // 3 đôi thông = 5 lá } } if (count_3couple > 0) { note.append(count_3couple).append(" bộ 3 đôi thông"); } } } } // System.out.println(result); // lostMoney *= bonusTimes; // lostMoney = p.moneyLost(lostMoney); // System.out.println("lostMoney: " + lostMoney); // p.money -= lostMoney; String[] o = new String[5]; o[0] = Long.toString(p.id); o[1] = Long.toString(lostMoney); // o[1] = Long.toString(p.money); // System.out.println(" p.money: " + p.money); String resString; if (p.money > 0) { resString = concatString(p.username, ": +", String.valueOf(p.money), "$, ", note.toString()); } else { //note = p.username + ": " + p.money + "$, " + note; resString = concatString(p.username, ": ", String.valueOf(p.money), "$, ", note.toString()); } //o[2] = note.toString(); o[2] = resString; o[3] = Utils.bytesToString(p.myHand); return o; } // Added by ThangTD public boolean isBaiDep(TienLenPlayer p) { int numHand = p.numHand; byte[] myHand = p.myHand; int count_2 = 0; for (int i = 0; i < numHand; i++) { if (Utils.getValue(myHand[i]) == 12) { count_2++; } } if (count_2 >= 3) { outCodeSB.append(p.username).append(": có ").append(count_2).append(" con heo!").append(NEW_LINE); // mLog.debug("---BAD USER DEBUG--- " + p.username + " có " + count_2 + " con heo!"); return true; } if (numHand >= 4) { int[] appearRate = new int[12];// tần suất xuất hiện các quân bài for (int i = 0; i < 12; i++) { appearRate[i] = 0; } for (int j = 0; j < numHand; j++) { if (Utils.getValue(myHand[j]) != 12) { appearRate[Utils.getValue(myHand[j])]++; } } // kiểm tra có 4 đôi thông không if (numHand >= 4) { for (int i = 0; i < appearRate.length - 3; i++) { if (appearRate[i] >= 2 && appearRate[i + 1] >= 2 && appearRate[i + 2] >= 2 && appearRate[i + 3] >= 2) { outCodeSB.append(p.username).append(": có 4 đôi thông!").append(NEW_LINE); // mLog.debug("---BAD USER DEBUG--- " + p.username + " có 4 đôi thông!"); return true; } } // kiểm tra tứ quý for (int i = 0; i < appearRate.length; i++) { if (appearRate[i] == 4) { outCodeSB.append(p.username).append(": có tứ quý!").append(NEW_LINE); // mLog.debug("---BAD USER DEBUG--- " + p.username + " có tứ quý!"); return true; } } // kiểm tra có 3 đôi thông không for (int i = 0; i < appearRate.length - 2; i++) { // for (int i = 0; i < appearRate.length - 3; i++) { if (appearRate[i] >= 2 && appearRate[i + 1] >= 2 && appearRate[i + 2] >= 2) { outCodeSB.append(p.username).append(": có 3 đôi thông!").append(NEW_LINE); // mLog.debug("---BAD USER DEBUG--- " + p.username + " có 3 đôi thông!"); return true; } } } } return false; } // End Added by ThangTD /* * public void startTime() { timerAuto.setTimer(20000); * timerAuto.setTienLenPlayer(currPlayer); timerAuto.setTienLenTable(this); * timerAuto.setRuning(true); timerAuto.reset(); * * } */ private void updateCash() throws TienLenException { String moneyChanges = "Thay đổi Gold: "; try { if (!isProcessEnd) { isProcessEnd = true; } else { logT.warn(concatString("tien len bi end match 2 lan ", String.valueOf(matchID))); return; } int playingSize = this.playings.size(); if (playingSize < 2) { logT.warn(concatString("hack game tlmn ", String.valueOf(matchID))); return; } UserDB userDb = new UserDB(); StringBuilder desc = new StringBuilder(); desc.append("TienLen: ").append(String.valueOf(matchID)); boolean havingMinusBalance = false; for (int i = 0; i < playingSize; i++) { TienLenPlayer p = playings.get(i); if (p != winner) { if (p.money < 0) { //p.money *=REAL_GOT_MONEY; } long plus = p.money; long oldCash = p.cash; try { p.cash = userDb.updateUserMoney(plus, true, p.id, desc.toString(), p.getExperience(), TIENLEN_LOG_TYPE); } catch (Exception e) { throw new TienLenException("Error update Loser Cash"); } moneyChanges += String.format("[%s] %s%d ; ", p.username, plus >= 0 ? "+" : "-", plus); // playings.get(i).cash = playings.get(i).cash + plus; if (p.cash < 0) { logMini.append(BlahBlahUtil.getLogString(String.format("/!\\ Âm tiền: %s còn %d Gold", p.username, p.cash))); // by thangtd // winner.money += (long) ((double) p.cash * REAL_GOT_MONEY); p.cash = 0; p.money = -oldCash; outCodeSB.append("Error calculate money game ").append(NEW_LINE); logT.debug("Error calculate money game "); // userDb.notMinus(); havingMinusBalance = true; } // Check for in-game event for loser p.checkEvent(ZoneID.TIENLEN, false); } } // Check for in-game event for winner winner.checkEvent(ZoneID.TIENLEN, true); // Save for winner // if (winner.money > 0) { // winner.money = (long)((double)winner.money * REAL_GOT_MONEY); // } try { winner.cash = userDb.updateUserMoney(winner.money, true, winner.id, desc.toString(), winner.getExperience(), TIENLEN_LOG_TYPE); } catch (Exception e) { throw new TienLenException("Error update Winner Cash"); } // // int dutyGot = 0; // if (duty.getCurrDutyPlayerId() == winner.id) { // dutyGot = 1; // } // winner.cash = userDb.updateUserMoneyForTP(winner.money, true, winner.id, desc.toString(), winner.getExperience(), TIENLEN_LOG_TYPE, dutyGot); moneyChanges += String.format("[%s] %s%d ; ", winner.username, winner.money >= 0 ? "+" : "", winner.money); logMini.append(BlahBlahUtil.getLogString(moneyChanges)); logMini.append(BlahBlahUtil.getLogString(String.format("Người thắng: [%s]", winner.username))); //Event Tien Len // try { // mLog.debug("Duty Condition check" + winner.id); // boolean altCondition = (dutyGot == 1) && (firstCashBet >= 500) && (playings.size() > 2); // if (altCondition) { // userDb.updateGameEvent(winner.id, ZoneID.TIENLEN); // } // } catch (Throwable e) { // e.printStackTrace(); // } // winner.cash += winner.money; if (havingMinusBalance) { userDb.notMinus(); } resetAutoKickOut(); } catch (Throwable ex) { outCodeSB.append("Error update cash ").append(ex.getStackTrace()).append(NEW_LINE); logT.error(ex.toString()); throw new TienLenException("Error update Cash"); } } /* * public void destroy() { try { timerAuto.destroy(); * * } catch (Exception e) { e.printStackTrace(); } super.destroy(); // * System.out.println("Destroy : " + this.name); * * * //timer.destroy(); } */ @Override public void autoStartGame(SimplePlayer player) { ISession session; session = player.currentSession; MessageFactory msgFactory = player.currentSession.getMessageFactory(); StartRequest restartRequest = (StartRequest) msgFactory.getRequestMessage(MessagesID.MATCH_START); restartRequest.mMatchId = matchID; try { IBusiness business = msgFactory.getBusiness(MessagesID.MATCH_START); business.handleMessage(player.currentSession, restartRequest, null); } catch (ServerException se) { } } @Override public void kickTimeout(Room room) { try { if (!this.isPlaying) { int len = this.playings.size(); if (len > 1) { long now = System.currentTimeMillis(); // check user which does nothing when he comes to table boolean isAllJoinReady = true; // Room room = bacayZone.findRoom(matchId); for (int i = 0; i < len; i++) { TienLenPlayer tlPlayer = this.playings.get(i); if (!tlPlayer.isReady && tlPlayer.id != owner.id) { isAllJoinReady = false; // does this user over time out if (now - tlPlayer.getLastActivated() > AUTO_KICKOUT_TIMEOUT) { // kich him kickTimeout(room, tlPlayer, 0); this.remove(tlPlayer); mLog.error("--- TLMN REMOVE PLAYER DEBUG --- " + tlPlayer.username + " is kicked time out"); tlPlayer.isOutGame = true; String kickOutMessage = concatString("Auto kick out ", tlPlayer.username); logT.debug(kickOutMessage); outCodeSB.append(kickOutMessage).append(NEW_LINE); } } } if (isAllJoinReady) { // start game if (now - owner.getLastActivated() > AUTO_KICKOUT_OWNER_TIMEOUT) { SimplePlayer oldOwner = owner.clone(); TienLenPlayer currOwner = findPlayer(owner.id); currOwner.isOutGame = true; owner = this.ownerQuit(); kickTimeout(room, oldOwner, owner.id); // autoStartGame(owner); if (currPlayer != null && currOwner.id == currPlayer.id) { currPlayer.isOutGame = true; } this.resetPlayers(); } } } } } catch (Exception ex) { try { logT.error(concatString("tienlen Kick time out error matchId ", String.valueOf(matchID)), ex); outCodeSB.append("Kick out error").append(NEW_LINE); cancel(playings); room.allLeft(); this.destroy(); } catch (Exception exx) { } } } @Override public ISession getNotNullSession() { int playingSize = this.playings.size(); for (int i = 0; i < playingSize; i++) { TienLenPlayer player = this.playings.get(i); if (!player.isOutGame && player.currentSession != null && player.currentSession.getMessageFactory() != null) { return player.currentSession; } } return null; } @Override public void doTimeout() { lastActivated = System.currentTimeMillis(); /* * if(this.isPlaying) { */ if (currPlayer == null) { logT.error(concatString("tienlen do time out currPlay = null matchId", String.valueOf(matchIDAuto))); outCodeSB.append("-[Auto player is null] + players size") .append(this.playings.size()).append(" current index: ") .append(currentIndexOfPlayer).append(" matchId:") .append(this.matchID).append(NEW_LINE); String str = concatString("[Auto player is null] , players size ", String.valueOf(this.playings.size()), " current Index: ", String.valueOf(currentIndexOfPlayer), " matchId: ", String.valueOf(this.matchID)); this.isPlaying = false; // out_code.println(str); logT.warn(str); //return; } else { if (currPlayer.currentSession != null) { outCodeSB.append("Player ").append(currPlayer.username).append(" auto play").append(NEW_LINE); currPlayer.autoPlay(this); } else { outCodeSB.append("Auto OMG currentSession is null!").append(NEW_LINE); } } // return; /* * } */ } @Override public int getTableSize() { return this.playings.size() + this.waitings.size(); } /** * @return the duty */ public Duty getDuty() { return duty; } /** * @return the hidePoker */ public boolean isHidePoker() { return hidePoker; } /** * @param hidePoker the hidePoker to set */ public void setHidePoker(boolean hidePoker) { this.hidePoker = hidePoker; } @Override public List<? extends SimplePlayer> getNewPlayings() { return playings; } @Override public List<? extends SimplePlayer> getNewWaitings() { return waitings; } private String concatString(String... input) { StringBuilder sb = new StringBuilder(); int len = input.length; for (int i = 0; i < len; i++) { String s = input[i]; sb.append(s); } return sb.toString(); } }
[ "sonnguyenhoang2309@gmail.com" ]
sonnguyenhoang2309@gmail.com
a9d348d99c82344a7f4cf1b7c17d0a4b58527321
4cf19adab50e0454e2b393941a051370538f8911
/app/src/main/java/com/pontes/cursoandroid/controllers/BankController.java
89a7dfbf3d29133be651c9cd3b62b304e26a7623
[]
no_license
EdgarPontes/CursoAndroid
779fe1e39a1afba49c0ec26fdc3e999a6d75ffd7
8ed41065f8079dc70bf360bae7b7ab30ca8717ac
refs/heads/master
2020-07-29T00:45:58.258017
2019-10-14T01:17:34
2019-10-14T01:17:34
209,603,015
0
0
null
null
null
null
UTF-8
Java
false
false
1,584
java
package com.pontes.cursoandroid.controllers; import com.pontes.cursoandroid.models.Bank; import io.realm.Realm; public class BankController { public static void create(String owner, double balange, String name, String agency){ Bank newBAnk = new Bank(owner, balange, name, agency); newBAnk.save(); } public static Bank get(){ Bank info; Realm realm = Realm.getDefaultInstance(); realm.beginTransaction(); Bank tmpBank = realm.where(Bank.class).findFirst(); if (tmpBank != null){ info = new Bank(tmpBank.getOwner(), tmpBank.getBalance(), tmpBank.getName(), tmpBank.getAgency()); }else{ info = null; } realm.commitTransaction(); realm.close(); return info; } public static double getBAlance(){ Bank bank = get(); if (bank != null){ return bank.getBalance(); } return 0.0 ; } public static void deposit(double value){ Realm realm = Realm.getDefaultInstance(); realm.beginTransaction(); Bank bank = realm.where(Bank.class).findFirst(); bank.setBalance(bank.getBalance()+value); realm.commitTransaction(); realm.close(); } public static void withdraw(double value){ Realm realm = Realm.getDefaultInstance(); realm.beginTransaction(); Bank bank = realm.where(Bank.class).findFirst(); bank.setBalance(bank.getBalance()-value); realm.commitTransaction(); realm.close(); } }
[ "edgarponte@gmail.com" ]
edgarponte@gmail.com
6ad2c4464e913f76e864c7ed344bf01d7ddae17c
2176aca76ca2b6c7efcfdfba1a50b8e5389e6251
/parser/src/test/java/com/gandb/xml/ConfigureTest.java
059d8c04fc3bf1e0d1593a578aca3cd7f412f12f
[]
no_license
York9715/DOM4J-SAX-Sample
a953e9a955cc48435dceac0d4b89212a237cdb6f
c8fcb2472751325c446ec1bd435a82baaffa52b5
refs/heads/master
2020-09-17T12:35:13.159474
2016-09-01T03:12:54
2016-09-01T03:12:54
67,038,229
0
0
null
null
null
null
UTF-8
Java
false
false
2,192
java
/** * */ package com.gandb.xml; import static org.junit.Assert.*; import java.io.InputStream; import java.util.List; import java.util.TreeMap; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; /** * @author Misato * */ public class ConfigureTest { public ConfigureTest() { } /** * @throws java.lang.Exception */ @BeforeClass public static void setUpBeforeClass() throws Exception { } /** * @throws java.lang.Exception */ @AfterClass public static void tearDownAfterClass() throws Exception { } /** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { System.out.println("---- Initializing ConfigureTest ----"); try { InputStream in = AppTest.class.getResourceAsStream("/" + App.CONFIGURATION_FILE); if (in == null) fail(App.CONFIGURATION_FILE + " not found"); } catch (Exception e) { fail(e.getMessage()); } } /** * @throws java.lang.Exception */ @After public void tearDown() throws Exception { } /** * Test method for {@link com.gandb.xml.Configure#Configure(java.lang.String)}. */ @Test public final void testConfigure() { System.out.println("---- testConfigure ---"); Configure configure = new Configure(App.CONFIGURATION_FILE); TreeMap<String, List<MatchedElement>> map = configure.getElementMap(); assertNotNull(map); if (map.size() < 1) fail("Not yet implemented"); // TODO } /** * Test method for {@link com.gandb.xml.Configure#getElementMap()}. */ @Test public final void testGetElementMap() { System.out.println("---- testGetElementMap ---"); Configure configure = new Configure(App.CONFIGURATION_FILE); TreeMap<String, List<MatchedElement>> map = configure.getElementMap(); assertNotNull(map); } /** * Test method for {@link com.gandb.xml.Configure#getConf(java.lang.String)}. */ @Test public final void testGetConf() { Configure configure = new Configure(App.CONFIGURATION_FILE); TreeMap<String, List<MatchedElement>> map =configure.getConf(App.CONFIGURATION_FILE); assertNotNull(map); //fail("Not yet implemented"); // TODO } }
[ "york.tips@gmail.com" ]
york.tips@gmail.com
1d46323c20b99f7de010d22750d4d6f84ca352db
dd1412c67433304e712475a064d04319d54a0f51
/BitCoinRate/src/main/java/com/coindesk/bitcoinrate/model/BitRateHistoryResponse.java
12907a09382e6bb0b64dbc590fcf3661b4ec7ebd
[]
no_license
NallaChaitanya/BitCoinrateAnalysis
c223961a49cfa22e8f1b8a300cbcae9b851957b9
30e899c80c528bced638d67a190cca03bef42e61
refs/heads/master
2020-08-29T01:01:50.531914
2019-10-28T03:47:04
2019-10-28T03:47:04
217,873,625
0
0
null
null
null
null
UTF-8
Java
false
false
708
java
package com.coindesk.bitcoinrate.model; import java.util.Map; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; /** * @author chaitanya * *Model for history */ @JsonIgnoreProperties public class BitRateHistoryResponse { private Map<String, Double> bpi; private String disclaimer; private Object time; public Object getTime() { return time; } public void setTime(Object time) { this.time = time; } public String getDisclaimer() { return disclaimer; } public void setDisclaimer(String disclaimer) { this.disclaimer = disclaimer; } public Map<String, Double> getBpi() { return bpi; } public void setBpi(Map<String, Double> bpi) { this.bpi = bpi; } }
[ "chaitu.bobby66@gmail.com" ]
chaitu.bobby66@gmail.com
46965122a6982e6e349360ebf6c546d3abce7a34
40d0f44a9399a70bba22e1d0316a6413788d89cd
/indicator/indicator-calculator/src/test/java/pro/crypto/indicator/ma/WeightedMovingAverageTest.java
b65b08ce1bbedb8041b641cf433dc64c48684b72
[]
no_license
CaymanJava/crypto-analyzer
45352dbe84ae7d98b8b117c54abc0e0b418fd531
91f0965b36a5f221fedce53abeb6fa5fb83b4cc3
refs/heads/master
2023-02-20T03:52:54.798521
2019-12-20T14:55:41
2019-12-20T14:55:41
122,776,981
0
0
null
null
null
null
UTF-8
Java
false
false
4,177
java
package pro.crypto.indicator.ma; import org.junit.Test; import pro.crypto.exception.WrongIncomingParametersException; import pro.crypto.indicator.IndicatorAbstractTest; import pro.crypto.model.tick.Tick; import pro.crypto.response.IndicatorResult; import static org.junit.Assert.assertArrayEquals; import static pro.crypto.model.indicator.IndicatorType.WEIGHTED_MOVING_AVERAGE; import static pro.crypto.model.tick.PriceType.CLOSE; public class WeightedMovingAverageTest extends IndicatorAbstractTest { @Test public void testWeightedMovingAverageWithPeriodFifteen() { IndicatorResult[] expectedResult = loadExpectedResult("weighted_moving_average_1.json", MAResult[].class); MAResult[] actualResult = MovingAverageFactory.create(buildRequest(15)).getResult(); assertArrayEquals(expectedResult, actualResult); } @Test public void testWeightedMovingAverageWithPeriodTwenty() { IndicatorResult[] expectedResult = loadExpectedResult("weighted_moving_average_2.json", MAResult[].class); MAResult[] actualResult = MovingAverageFactory.create(buildRequest(20)).getResult(); assertArrayEquals(expectedResult, actualResult); } @Test public void emptyOriginalDataTest() { expectedException.expect(WrongIncomingParametersException.class); expectedException.expectMessage("Incoming tick data size should be > 0 {indicator: {WEIGHTED_MOVING_AVERAGE}, size: {0}}"); MovingAverageFactory.create(MARequest.builder() .originalData(new Tick[0]) .period(5) .indicatorType(WEIGHTED_MOVING_AVERAGE) .priceType(CLOSE) .build()).getResult(); } @Test public void nullOriginalDataTest() { expectedException.expect(WrongIncomingParametersException.class); expectedException.expectMessage("Incoming tick data is null {indicator: {WEIGHTED_MOVING_AVERAGE}}"); MovingAverageFactory.create(MARequest.builder() .originalData(null) .period(5) .indicatorType(WEIGHTED_MOVING_AVERAGE) .priceType(CLOSE) .build()).getResult(); } @Test public void periodMoreThanTickDataTest() { expectedException.expect(WrongIncomingParametersException.class); expectedException.expectMessage("Period should be less than tick data size {indicator: {WEIGHTED_MOVING_AVERAGE}, period: {5}, size: {1}}"); MovingAverageFactory.create(MARequest.builder() .originalData(new Tick[1]) .period(5) .indicatorType(WEIGHTED_MOVING_AVERAGE) .priceType(CLOSE) .build()).getResult(); } @Test public void periodLessThanZeroTest() { expectedException.expect(WrongIncomingParametersException.class); expectedException.expectMessage("Period should be more than 0 {indicator: {WEIGHTED_MOVING_AVERAGE}, period: {-5}}"); MovingAverageFactory.create(MARequest.builder() .originalData(new Tick[1]) .period(-5) .indicatorType(WEIGHTED_MOVING_AVERAGE) .priceType(CLOSE) .build()).getResult(); } @Test public void emptyPriceTypeTest() { expectedException.expect(WrongIncomingParametersException.class); expectedException.expectMessage("Incoming price type is null {indicator: {WEIGHTED_MOVING_AVERAGE}}"); MovingAverageFactory.create(MARequest.builder() .originalData(new Tick[30]) .period(5) .indicatorType(WEIGHTED_MOVING_AVERAGE) .priceType(null) .build()).getResult(); } @Override protected MARequest buildRequest() { return MARequest.builder() .originalData(originalData) .indicatorType(WEIGHTED_MOVING_AVERAGE) .priceType(CLOSE) .build(); } private MARequest buildRequest(int period) { MARequest request = buildRequest(); request.setPeriod(period); return request; } }
[ "bosenko_dmitriy@mail.ru" ]
bosenko_dmitriy@mail.ru
3ecc4ab2ab598de32953216f6425ae49e53e44aa
ab7e04fa746799107280d8d9e7bfbb2544b7878d
/src/QLKH/data/dao/HoaDonDAO.java
c6643bbd825f0eac290526399ffd462c82c575c7
[]
no_license
gink3008/QuanLyKhachHang
a0e35c779d2dfd50ecea4286d5a6b9d5cccc771a
a7bf62d79667d3047328de55e0daeee6a74f5203
refs/heads/master
2020-03-17T06:27:49.391374
2018-05-14T13:44:15
2018-05-14T13:44:15
133,356,636
0
0
null
null
null
null
UTF-8
Java
false
false
4,641
java
package QLKH.data.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import QLKH.data.model.HoaDon; import QLKH.data.sqlserver.ConnectDB; public class HoaDonDAO implements BaseDaoInterface<HoaDon> { HoaDon currentObj; @Override public boolean insert(HoaDon obj) { Connection connect = null; String sql = "Insert into HoaDon Values(?,?,?,?,?,)"; PreparedStatement prepare = null; try { connect = ConnectDB.connect(); prepare = connect.prepareStatement(sql); connect.setAutoCommit(false); prepare.setInt(1, obj.getMaHD()); prepare.setInt(2, obj.getMaKH()); prepare.setInt(3, obj.getMaNV()); prepare.setFloat(4, obj.getTongTien()); prepare.setDate(5, obj.getNgayLHD()); connect.setAutoCommit(true); prepare.executeUpdate(); } catch (Exception e) { e.printStackTrace(); return false; } finally { if (prepare != null) { try { prepare.close(); } catch (SQLException e) { e.printStackTrace(); } } if (connect != null) { try { connect.close(); } catch (SQLException e) { e.printStackTrace(); } } } return true; } @Override public List<HoaDon> getList(String sql) { Connection connect = null; Statement statement = null; ResultSet rs = null; List<HoaDon> list = null; try { connect = ConnectDB.connect(); list = new ArrayList<>(); // Statement creation statement = connect.createStatement(); // for retrieve data rs = statement.executeQuery(sql); while (rs.next()) { HoaDon hoadon = new HoaDon(); hoadon.setMaHD(rs.getInt("maHD")); hoadon.setMaKH(rs.getInt("maKH")); hoadon.setMaNV(rs.getInt("maNV")); hoadon.setTongTien(rs.getFloat("tongTien")); hoadon.setNgayLHD(rs.getDate("ngayLHD")); list.add(hoadon); } rs.close(); statement.close(); connect.close(); return list; } catch (ClassNotFoundException e) { return list; } catch (SQLException e) { return list; } finally { if (rs != null) { try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } } if (statement != null) { try { statement.close(); } catch (SQLException e) { e.printStackTrace(); } } if (connect != null) { try { connect.close(); } catch (SQLException e) { e.printStackTrace(); } } } } @Override public boolean delete(HoaDon obj) { Connection connect; int check = 0; try { connect = ConnectDB.connect(); Statement statement = connect.createStatement(); check = statement.executeUpdate("delete from HoaDon where maHD = " + obj.getMaHD()); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } if (check >= 0) { return true; } return false; } //hung @Override public boolean update(HoaDon obj) { Connection connect; Statement statement; int check = 0; try { connect = ConnectDB.connect(); statement = connect.createStatement(); String sql = "update HoaDon set maKH =?, maNV = ? , tongTien =? , ngayLHD =? where maHD = ? "; PreparedStatement prepare = connect.prepareStatement(sql); prepare.setInt(1, obj.getMaKH()); prepare.setInt(2, obj.getMaNV()); prepare.setFloat(3, obj.getTongTien()); prepare.setDate(4, obj.getNgayLHD()); prepare.setInt(5, obj.getMaHD()); check = prepare.executeUpdate(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } if (check > 0) { return true; } return false; } @Override public HoaDon getFirst() { List<HoaDon> list = getList("select * from HoaDon"); if (list.size() > 0) { return list.get(0); } return null; } @Override public HoaDon getLast() { List<HoaDon> list = getList("select * from HoaDon"); int size = list.size(); if (size > 0) { return list.get(size - 1); } return null; } @Override public HoaDon getCurrent() { return currentObj; } @Override public void setCurrent(HoaDon obj) { this.currentObj = obj; } @Override public HoaDon getNext() { // TODO Auto-generated method stub return null; } @Override public HoaDon getPrevious() { // TODO Auto-generated method stub return null; } }
[ "fateoverz@gmail.com" ]
fateoverz@gmail.com
155693c53a687a7d0e39e750530e5a8793cfe6df
6482e2b69f7eee919ab67210fa5d35c8010690d2
/src/main/java/com/zopa/borrowingratescalculator/domain/entity/Money.java
97f8d3ad29396281323b65f9f9987a5359be173b
[]
no_license
KasunDon/BorrowingRatesCalculator
ddb7e5edb2053d6cfdd75ad475be14a6e45a68c3
8da3ecc44307df2d21423c6b4b69f0d6bfd7df44
refs/heads/master
2021-05-12T07:36:33.522377
2018-01-12T14:15:31
2018-01-12T14:27:29
117,249,430
0
0
null
null
null
null
UTF-8
Java
false
false
578
java
package com.zopa.borrowingratescalculator.domain.entity; import java.math.BigDecimal; public class Money { private BigDecimal amount; public Money( BigDecimal amount ) { if (amount == null) { throw new IllegalArgumentException("amount cannot be null"); } this.amount = amount; } public static Money of( BigDecimal amount ) { amount = amount.setScale(2, BigDecimal.ROUND_HALF_UP); return new Money(amount); } public BigDecimal getAmount() { return amount; } }
[ "kasunpdon@gmail.com" ]
kasunpdon@gmail.com
943d6265ab4cfe48ce16dc0b08718f3eab745a1b
b6f9378d18e509b851ca9d7d311db5c171ffd812
/src/main/groovy/javadw/view/Messages.java
aa6f3b089ef3abd49a2cc7e82e089cd8892561a7
[ "Apache-2.0" ]
permissive
datenbank/javabi
a9e1585d06021c9a61e314826cf2e23912be4f55
3e6412fbe5b1dd2d7bba427201be911289d2dd8c
refs/heads/master
2021-01-23T16:07:39.910331
2017-09-11T06:11:23
2017-09-11T06:11:23
102,726,537
0
0
null
null
null
null
UTF-8
Java
false
false
491
java
package javadw.view; import java.util.MissingResourceException; import java.util.ResourceBundle; public class Messages { private static final String BUNDLE_NAME = "messages"; //$NON-NLS-1$ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle .getBundle(BUNDLE_NAME); private Messages() { } public static String getString(String key) { try { return RESOURCE_BUNDLE.getString(key); } catch (MissingResourceException e) { return '!' + key + '!'; } } }
[ "kha@BUDDYSHOP.LOCAL" ]
kha@BUDDYSHOP.LOCAL
19a720cab52b0575ecd19e723ac43df7afb91198
f2779f63aab6a59b64ac211f1160c9883003f1ec
/src/main/java/org/atmosphere/atmosph4rx/defaults/AxSubscriberInvoker.java
843b12340acf2169c5e6c0821e464ecde99a7928
[ "Apache-2.0" ]
permissive
Atmosphere/Atmosph4rX
c304762cdd29ee6d2f08231cbbbcdf6e516a7bc6
3ce9f3b73d991fd95395f5fb0bec0555b1f53d4f
refs/heads/master
2023-03-17T02:58:17.852490
2022-03-31T18:36:08
2022-03-31T18:36:08
130,418,164
37
5
Apache-2.0
2019-11-13T13:31:25
2018-04-20T22:08:20
Java
UTF-8
Java
false
false
3,516
java
/** * Copyright 2018-2020 Async-IO.org * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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.atmosphere.atmosph4rx.defaults; import org.atmosphere.atmosph4rx.AxSocket; import org.atmosphere.atmosph4rx.AxSubscriber; import org.atmosphere.atmosph4rx.AxSubscription; import org.atmosphere.atmosph4rx.core.AxMetaData; import org.atmosphere.atmosph4rx.defaults.DefaultAxRouter.AxProcessor; import org.reactivestreams.Subscription; import reactor.core.publisher.FluxProcessor; class AxSubscriberInvoker<T> implements AxSubscriber<T> { private final AxSubscriber<T> axSubscriber; private final AxMetaData metaData; private final AxProcessor<FluxProcessor<String, String>> outputProcessor; public AxSubscriberInvoker(AxSubscriber<T> axSubscriber, AxMetaData metaData, AxProcessor<FluxProcessor<String, String>> outputProcessor) { this.axSubscriber = axSubscriber; this.metaData = metaData; this.outputProcessor = outputProcessor; } @Override public void onNext(T payload) { axSubscriber.onNext(payload); AxSocket<FluxProcessor<String, String>, String> single = new AxSocket<FluxProcessor<String, String>, String>() { @Override public AxSocket<FluxProcessor<String, String>, String> publish(String message) { toProcessor().onNext(message); return this; } @Override public FluxProcessor<String, String> toProcessor() { return outputProcessor.out(); } @Override public String id() { return outputProcessor.id(); } @Override public String toString() { return "$classname{}"; } }; axSubscriber.onNext(single); axSubscriber.onNext(single, (String) payload); } @Override public void onSubscribe(Subscription s) { s.request(Integer.MAX_VALUE); axSubscriber.onSubscribe(s); onSubscribe(new AxSubscription(s, metaData, outputProcessor)); } @Override public void onComplete() { axSubscriber.onComplete(); } @Override public void onError(Throwable t) { axSubscriber.onError(t); } public void onSubscribe(AxSubscription s) { axSubscriber.onSubscribe(s); } public void onNext(byte[] payload) { axSubscriber.onNext(payload); } public <U extends FluxProcessor<? super String, ? super String>> void onNext(AxSocket<U, String> single, String payload) { axSubscriber.onNext(single, payload); } @Override public <U extends FluxProcessor<? super String, ? super String>, V> void onNext(AxSocket<U, V> single) { axSubscriber.onNext(single); } public <U extends FluxProcessor<? super String, ? super String>> void onNext(AxSocket<U, byte[]> single, byte[] payload) { axSubscriber.onNext(single, payload); } }
[ "jfarcand@apache.org" ]
jfarcand@apache.org
780b241f8d6077852162d6c3b51c6decd91c6782
ea221632b79ec58259b2914479a1ac658e6a94d3
/app/src/main/java/com/beatonma/ledcontrol/app/GeneralSettingsFragment.java
f1c7a2adab592afa6de0b85394ec53e0abad0633
[]
no_license
beatonma/LEDControl
dfaeb5d53a92b134dbe1f28390be7e7d2a20650c
3bb7a2eb3ce7de8702d1887c683f6d9701ce04a0
refs/heads/master
2021-01-10T13:23:19.986868
2016-01-27T00:55:01
2016-01-27T00:55:01
50,470,074
0
0
null
null
null
null
UTF-8
Java
false
false
5,315
java
package com.beatonma.ledcontrol.app; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.widget.Button; import com.beatonma.ledcontrol.Broadcaster; import com.beatonma.self.led.ledcontrol.R; import com.beatonma.ledcontrol.app.ui.FloatSeekbarPreference; import com.beatonma.ledcontrol.app.ui.SeekbarPreference; import com.beatonma.ledcontrol.utility.AnimationUtils; import com.beatonma.ledcontrol.utility.PrefUtils; /** * Created by Michael on 20/01/2016. */ public class GeneralSettingsFragment extends BaseSettingsFragment implements SharedPreferences.OnSharedPreferenceChangeListener { private View mOnboardContainer; private SeekbarPreference mMaxBrightnessBar; private SeekbarPreference mMinBrightnessBar; public static GeneralSettingsFragment newInstance() { return new GeneralSettingsFragment(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PrefUtils.get(getActivity()).registerOnSharedPreferenceChangeListener(this); } @Override public void onPause() { super.onPause(); PrefUtils.get(getActivity()).unregisterOnSharedPreferenceChangeListener(this); } @Override int getLayout() { return R.layout.fragment_settings_general; } @Override void initLayout(View v) { FloatSeekbarPreference colorDuration = (FloatSeekbarPreference) v.findViewById(R.id.color_change_duration); colorDuration.setOnSeekbarMovedListener(new SeekbarPreference.OnSeekbarMovedListener() { @Override public void onSeekbarMoved(int progress) { float value = (float) progress / 2f; PrefUtils.get(getContext()).edit() .putFloat(PrefUtils.PREF_COLOR_CHANGE_DURATION, value) .commit(); } }); mMaxBrightnessBar = (SeekbarPreference) v.findViewById(R.id.max_brightness); mMinBrightnessBar = (SeekbarPreference) v.findViewById(R.id.min_brightness); mMaxBrightnessBar.setOnSeekbarMovedListener(new SeekbarPreference.OnSeekbarMovedListener() { @Override public void onSeekbarMoved(int progress) { if (progress < mMinBrightnessBar.getProgress()) { mMinBrightnessBar.setProgress(progress); } } }); mMinBrightnessBar.setOnSeekbarMovedListener(new SeekbarPreference.OnSeekbarMovedListener() { @Override public void onSeekbarMoved(int progress) { if (progress > mMaxBrightnessBar.getProgress()) { mMaxBrightnessBar.setProgress(progress); } } }); mOnboardContainer = v.findViewById(R.id.onboard_container); boolean showGeneralOnboarding = PrefUtils.get(getContext()).getBoolean(PrefUtils.ONBOARD_SHOW_ONBOARD_GENERAL, true); if (showGeneralOnboarding) { Button onboardOkButton = (Button) v.findViewById(R.id.ok_button); Button onboardHelpButton = (Button) v.findViewById(R.id.help_button); onboardOkButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AnimationUtils.hidePreference(mOnboardContainer, mOnboardContainer.getMeasuredHeight()); PrefUtils.get(getContext()).edit() .putBoolean(PrefUtils.ONBOARD_SHOW_ONBOARD_GENERAL, false) .commit(); } }); onboardHelpButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getMainActivity().showHelp(); } }); mOnboardContainer.requestFocus(); } else { mOnboardContainer.setVisibility(View.GONE); } } @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { broadcastPreferences(sharedPreferences); } private void broadcastPreferences(SharedPreferences sp) { String prefs = formatPref(PrefUtils.PREF_MAX_BRIGHTNESS, sp.getInt(PrefUtils.PREF_MAX_BRIGHTNESS, 100)) + formatPref(PrefUtils.PREF_MIN_BRIGHTNESS, sp.getInt(PrefUtils.PREF_MIN_BRIGHTNESS, 0)) + formatPref(PrefUtils.PREF_INTERPOLATE_CHANGES, sp.getBoolean(PrefUtils.PREF_INTERPOLATE_CHANGES, false)) + formatPref(PrefUtils.PREF_COLOR_CHANGE_DURATION, sp.getFloat(PrefUtils.PREF_COLOR_CHANGE_DURATION, 1f)); Broadcaster.getInstance(getActivity()).broadcastPreferences(prefs); } private String formatPref(String name, String value) { return name + "=" + value + "\n"; } private String formatPref(String name, int value) { return formatPref(name, String.valueOf(value)); } private String formatPref(String name, boolean value) { return formatPref(name, (value ? "True" : "False")); } private String formatPref(String name, float value) { return formatPref(name, String.valueOf(value)); } }
[ "beatonma@gmail.com" ]
beatonma@gmail.com
3fded95c01829c3df6b9a99395a2acd96846ef77
b12e5e1cab7a5db7f29c245cdc210d198ccf0849
/src/main/java/com/vidly/controllers/CustomerController.java
6265b39927dc08ed10c6f22b743d27aad06d7dd5
[]
no_license
Eyasu15/vidly-backend
bb00777619e92a779d7dce6c3c94cc57f5d8953b
28b64f7eefa096be4ca7929abdca02885632a05a
refs/heads/master
2022-12-12T17:43:51.532746
2020-09-12T03:02:42
2020-09-12T03:02:42
284,322,240
0
0
null
null
null
null
UTF-8
Java
false
false
1,374
java
package com.vidly.controllers; import java.util.List; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.vidly.models.Customer; import com.vidly.services.CustomerService; @RestController @RequestMapping("/customers") @CrossOrigin public class CustomerController { private final CustomerService service; public CustomerController(CustomerService service) { this.service = service; } @GetMapping("/{id}") public Customer getCustomer(@PathVariable Long id) { return service.getCustomer(id); } @GetMapping() public List<Customer> getAllCustomers() { return service.getAllCustomers(); } @PostMapping() public Customer addCustomer(@RequestBody Customer newCustomer) { return service.addCustomer(newCustomer); } @DeleteMapping("/{id}") public ResponseEntity<Object> deleteCustomer(@PathVariable Long id) { return service.deleteCustomer(id); } }
[ "Eyasuweld@gmail.com" ]
Eyasuweld@gmail.com
a356d7ccfbb5f7ae364d04acefcd6ec40bbf9955
e39843b2dead25cce89aec95f0cf2953fb43321d
/apiClient/src/main/java/io/swagger/client/model/BinanceExecutionType.java
10311a5d80e790279fc306e23d439c3cc582e096
[]
no_license
GenesisVision/android-client
6727d5c61f2134ea00b308b00a52fc531a78d110
319b7dfd53ad498a65c2ee80b0e0ce15aef8aec6
refs/heads/develop
2022-05-13T08:56:00.715425
2022-04-18T11:17:16
2022-04-18T11:17:16
118,433,575
16
7
null
2021-04-01T19:41:53
2018-01-22T09:14:35
Java
UTF-8
Java
false
false
1,790
java
/* * Core API v2.0 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * OpenAPI spec version: v2.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package io.swagger.client.model; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; /** * Gets or Sets BinanceExecutionType */ @JsonAdapter(BinanceExecutionType.Adapter.class) public enum BinanceExecutionType { NEW("New"), CANCELED("Canceled"), REPLACED("Replaced"), REJECTED("Rejected"), TRADE("Trade"), EXPIRED("Expired"), AMENDMENT("Amendment"); private String value; BinanceExecutionType(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static BinanceExecutionType fromValue(String text) { for (BinanceExecutionType b : BinanceExecutionType.values()) { if (String.valueOf(b.value).equals(text)) { return b; } } return null; } public static class Adapter extends TypeAdapter<BinanceExecutionType> { @Override public void write(final JsonWriter jsonWriter, final BinanceExecutionType enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public BinanceExecutionType read(final JsonReader jsonReader) throws IOException { Object value = jsonReader.nextString(); return BinanceExecutionType.fromValue(String.valueOf(value)); } } }
[ "dev.prus@gmail.com" ]
dev.prus@gmail.com
520d16c3c8c61d4aea42b7085e84bc79d4498ce6
144044f9282c50253a75bd8d5c23f619ad38fdf8
/biao-boss/src/main/java/com/thinkgem/jeesite/modules/market/dao/MkDividendStatDao.java
2476ca1d24c012c6e35b802ed3a1901d6a1a1c9e
[]
no_license
clickear/biao
ba645de06b4e92b0539b05404c061194669f4570
af71fd055c4ff3aa0b767a0a8b4eb74328e00f6f
refs/heads/master
2020-05-16T15:47:33.675136
2019-09-25T08:20:28
2019-09-25T08:20:28
183,143,104
0
0
null
2019-04-24T03:46:28
2019-04-24T03:46:28
null
UTF-8
Java
false
false
522
java
/** * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved. */ package com.thinkgem.jeesite.modules.market.dao; import com.thinkgem.jeesite.common.persistence.CrudDao; import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao; import com.thinkgem.jeesite.modules.market.entity.MkDividendStat; /** * 分红统计DAO接口 * @author zhangzijun * @version 2018-08-02 */ @MyBatisDao public interface MkDividendStatDao extends CrudDao<MkDividendStat> { }
[ "1072163919@qq.com" ]
1072163919@qq.com
9d48272a6a01d500cf2d2dd5425364d7a14814db
bba0d87787ca5d7248094389b8bd34566e3015b9
/spring5-recipe-app/src/test/java/moreti/springframework/spring5recipeapp/converters/RecipeToRecipeCommandTest.java
873a0026c6a9fc62c4e696306583ce75f0b6f937
[]
no_license
kmoreti/springframework5
863755926b7dd516377d448a3d22d4fadf83e442
ac5d840bc7a46a1670426fc6c6ed91c9b30e3d1b
refs/heads/master
2023-04-23T19:17:13.800137
2021-05-15T18:46:07
2021-05-15T18:46:07
108,332,914
0
0
null
null
null
null
UTF-8
Java
false
false
3,619
java
package moreti.springframework.spring5recipeapp.converters; import moreti.springframework.spring5recipeapp.commands.RecipeCommand; import moreti.springframework.spring5recipeapp.domain.*; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; public class RecipeToRecipeCommandTest { public static final Long RECIPE_ID = 1L; public static final Integer COOK_TIME = Integer.valueOf("5"); public static final Integer PREP_TIME = Integer.valueOf("7"); public static final String DESCRIPTION = "My Recipe"; public static final String DIRECTIONS = "Directions"; public static final Difficulty DIFFICULTY = Difficulty.EASY; public static final Integer SERVINGS = Integer.valueOf("3"); public static final String SOURCE = "Source"; public static final String URL = "Some URL"; public static final Long CAT_ID_1 = 1L; public static final Long CAT_ID2 = 2L; public static final Long INGRED_ID_1 = 3L; public static final Long INGRED_ID_2 = 4L; public static final Long NOTES_ID = 9L; RecipeToRecipeCommand converter; @Before public void setUp() throws Exception { converter = new RecipeToRecipeCommand( new CategoryToCategoryCommand(), new IngredientToIngredientCommand(new UnitOfMeasureToUnitOfMeasureCommand()), new NotesToNotesCommand()); } @Test public void testNullObject() throws Exception { assertNull(converter.convert(null)); } @Test public void testEmptyObject() throws Exception { assertNotNull(converter.convert(new Recipe())); } @Test public void convert() throws Exception { //given Recipe recipe = new Recipe(); recipe.setId(RECIPE_ID); recipe.setCookTime(COOK_TIME); recipe.setPrepTime(PREP_TIME); recipe.setDescription(DESCRIPTION); recipe.setDifficulty(DIFFICULTY); recipe.setDirections(DIRECTIONS); recipe.setServings(SERVINGS); recipe.setSource(SOURCE); recipe.setUrl(URL); Notes notes = new Notes(); notes.setId(NOTES_ID); recipe.setNotes(notes); Category category = new Category(); category.setId(CAT_ID_1); Category category2 = new Category(); category2.setId(CAT_ID2); recipe.getCategories().add(category); recipe.getCategories().add(category2); Ingredient ingredient = new Ingredient(); ingredient.setId(INGRED_ID_1); Ingredient ingredient2 = new Ingredient(); ingredient2.setId(INGRED_ID_2); recipe.getIngredients().add(ingredient); recipe.getIngredients().add(ingredient2); //when RecipeCommand command = converter.convert(recipe); //then assertNotNull(command); assertEquals(RECIPE_ID, command.getId()); assertEquals(COOK_TIME, command.getCookTime()); assertEquals(PREP_TIME, command.getPrepTime()); assertEquals(DESCRIPTION, command.getDescription()); assertEquals(DIFFICULTY, command.getDifficulty()); assertEquals(DIRECTIONS, command.getDirections()); assertEquals(SERVINGS, command.getServings()); assertEquals(SOURCE, command.getSource()); assertEquals(URL, command.getUrl()); assertEquals(NOTES_ID, command.getNotes().getId()); assertEquals(2, command.getCategories().size()); assertEquals(2, command.getIngredients().size()); } }
[ "kleber.camargo@fatec.sp.gov.br" ]
kleber.camargo@fatec.sp.gov.br
fb2be7017a3874cf4040e1fc0e1306448019f607
5e92311a56bd61ba0b4b32432117a01a1d3944d7
/05-hibernate-advanced-mappings-demo/02-one-to-one-bi/src/main/java/com/hibernate/advanced/mappings/demo/GetInstructorDetailDemo.java
e98e8a35d6bd0a9cc5d68acef6e5b443a8bde9e5
[]
no_license
anaquin/learning-spring-hibernate-from-udemy-course
ef6d681152763cd0a00f7eb50b93c51ca97c042b
4c7913d5a519d20319eb3dabe4e9ef6062a2f18c
refs/heads/master
2022-09-21T00:06:51.455192
2020-06-06T15:02:08
2020-06-06T15:02:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,407
java
package com.hibernate.advanced.mappings.demo; import com.hibernate.advanced.mappings.demo.entity.Instructor; import com.hibernate.advanced.mappings.demo.entity.InstructorDetail; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class GetInstructorDetailDemo { private static Logger log = LoggerFactory.getLogger(GetInstructorDetailDemo.class); public static void main(String[] args) { SessionFactory sessionFactory = new Configuration() .configure() .addAnnotatedClass(Instructor.class) .addAnnotatedClass(InstructorDetail.class) .buildSessionFactory(); try (sessionFactory) { Session session = sessionFactory.getCurrentSession(); log.info("Starting transaction!"); session.beginTransaction(); int id = 1; InstructorDetail instructorDetail = session.get(InstructorDetail.class, id); if (instructorDetail != null) { log.info("Found instructorDetail: {}", instructorDetail); log.info("Found associated instructor: {}", instructorDetail.getInstructor()); } session.getTransaction().commit(); log.info("Transaction committed!"); } } }
[ "vladislav.kondratuk@rambler.ru" ]
vladislav.kondratuk@rambler.ru
828e66b5336e6ef2804f766f996db1b8c2645c4e
b1a3412c93fabe9d5c0996474edad7528bc26d71
/graduation-core/src/main/java/com/graduation/core/domain/model/DomainEventSubscriber.java
fe3df485ca47bbc7866f9f56b5ad74ae48b413c4
[]
no_license
lj1985730/graduation
fe966c25d5359c634a8ce5016d1c0a75facf0802
4d83f2fbe57151e465d0fd34aed0103a53cbe9b3
refs/heads/master
2021-07-25T18:53:32.946635
2017-11-06T14:16:23
2017-11-06T14:16:23
104,905,034
0
0
null
null
null
null
UTF-8
Java
false
false
424
java
package com.graduation.core.domain.model; /** * 领域事件订阅方接口 * @author Liu Jun * @since v1.0.0 */ public interface DomainEventSubscriber<T extends DomainEvent> { /** * 返回领域事件类型 * @return 领域事件类型 */ Class<T> subscribedToEventType(); /** * 处理领域事件 * @param domainEvent 领域事件 */ void handleEvent(T domainEvent); }
[ "lj1985730@gmail.com" ]
lj1985730@gmail.com
0bd73d9f87f52af60b998c45858f2f3f172e19e3
3668390405fcc7f70861b0763c4bf6dab407dba3
/src/main/java/com/reedelk/azure/storage/component/UploadBlob.java
0f0707b6db5c10306b0b98ee7420db0efdb81024
[]
no_license
codecentric/reedelk-module-azure-storage
11171418ea951999b3b436403f541fb177f71262
4182cada22f6473dee632990da2c46e283bdf6e3
refs/heads/master
2023-01-23T22:38:08.660535
2020-12-09T18:30:06
2020-12-09T18:30:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,236
java
package com.reedelk.azure.storage.component; import com.reedelk.azure.storage.internal.attribute.UploadBlobAttributes; import com.reedelk.azure.storage.internal.commons.Validator; import com.reedelk.azure.storage.internal.exception.UploadBlobException; import com.reedelk.azure.storage.internal.upload.UploadStrategyDefault; import com.reedelk.azure.storage.internal.upload.UploadStrategyStream; import com.reedelk.runtime.api.annotation.*; import com.reedelk.runtime.api.component.ProcessorSync; import com.reedelk.runtime.api.converter.ConverterService; import com.reedelk.runtime.api.flow.FlowContext; import com.reedelk.runtime.api.message.Message; import com.reedelk.runtime.api.script.ScriptEngineService; import com.reedelk.runtime.api.script.dynamicvalue.DynamicString; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import static com.reedelk.azure.storage.internal.commons.Messages.UploadBlob.BLOB_NAME_EMPTY; import static com.reedelk.azure.storage.internal.commons.Messages.UploadBlob.CONTAINER_EMPTY; import static com.reedelk.runtime.api.commons.ComponentPrecondition.Configuration.requireNotNullOrBlank; import static org.osgi.service.component.annotations.ServiceScope.PROTOTYPE; @ModuleComponent("Azure Storage Upload Blob") @ComponentOutput( attributes = UploadBlobAttributes.class, payload = { ComponentOutput.PreviousComponent.class }, description = "The Azure Storage Upload Blob Component output is the original input message if upload strategy is default. " + "If upload strategy is 'Streaming' the output is empty.") @ComponentInput( payload = { String.class, byte[].class }, description = "The expected input is a string or a byte array of the data to be uploaded on the Azure Storage Container.") @Description("The Azure Storage Upload Blob Component allows to upload a blob on a specified Azure Storage Container. " + "The container name can be a dynamic expression and it is mandatory. " + "The blob name property which identifies the name of the file to be stored on the container can be a dynamic expression as well and it is mandatory. " + "The Azure Storage Upload Blob Component output is the original input message if upload strategy is 'Default', " + "if upload strategy is 'Streaming' the output is empty.") @Component(service = UploadBlob.class, scope = PROTOTYPE) public class UploadBlob implements ProcessorSync { @DialogTitle("Azure Storage Configuration") @Property("Configuration") @Mandatory @Description("The Azure Storage configuration to be used by this component.") private AzureStorageConfiguration configuration; @Property("Container Name") @Mandatory @Example("my-container") @Hint("my-container") @Description("The name of the container on which the blobs should be uploaded to.") private DynamicString container; @Property("Blob Name") @Mandatory @Example("my-blob") @Hint("my-blob") @Description("The name of the new blob to be uploaded.") private DynamicString blobName; @Property("Upload Strategy") @Group("Advanced") @Example("STREAMING") @DefaultValue("DEFAULT") @Description("Determines the upload strategy. " + "If streaming the message payload stream is uploaded as stream and the output of " + "the component will be empty.") private UploadStrategy uploadStrategy = UploadStrategy.DEFAULT; @Reference ConverterService converterService; @Reference ScriptEngineService scriptService; private com.reedelk.azure.storage.internal.upload.UploadStrategy strategy; @Override public void initialize() { Validator.validate(UploadBlob.class, configuration); requireNotNullOrBlank(UploadBlob.class, container, "Container must not be empty."); requireNotNullOrBlank(UploadBlob.class, blobName, "Blob name must not be empty."); strategy = uploadStrategy == UploadStrategy.STREAMING ? new UploadStrategyStream(converterService) : new UploadStrategyDefault(converterService); } @Override public Message apply(FlowContext flowContext, Message message) { String evaluatedContainer = scriptService.evaluate(this.container, flowContext, message) .orElseThrow(() -> new UploadBlobException(CONTAINER_EMPTY.format(container.value()))); String evaluatedBlobName = scriptService.evaluate(this.blobName, flowContext, message) .orElseThrow(() -> new UploadBlobException(BLOB_NAME_EMPTY.format(container.value()))); return strategy.upload(this, configuration, message, evaluatedContainer, evaluatedBlobName); } public void setConfiguration(AzureStorageConfiguration configuration) { this.configuration = configuration; } public void setContainer(DynamicString container) { this.container = container; } public void setBlobName(DynamicString blobName) { this.blobName = blobName; } public void setUploadStrategy(UploadStrategy uploadStrategy) { this.uploadStrategy = uploadStrategy; } }
[ "gironi.lorenzo@gmail.com" ]
gironi.lorenzo@gmail.com
9fa37eb7b19902c46eb69fc2a427cb504d715fbe
d4187f7c311b1a95307af2cd84d1ad3a38e00eca
/app/src/main/java/com/sarnava/newsapplication/ui/main/NewsAdapter.java
c9ac6ed849ba74436d5173230fa1cf7cc482ced8
[]
no_license
vishalG02/NewsApplication
40a5966e66f72ae0592233c9abbed7efad17bf6b
397a6028a67c56ad526e7ad891adbbaed4e7171e
refs/heads/master
2023-04-19T00:58:30.875250
2021-05-03T12:44:38
2021-05-03T12:44:38
363,913,129
0
0
null
2021-05-03T12:07:47
2021-05-03T11:53:27
null
UTF-8
Java
false
false
3,077
java
package com.sarnava.newsapplication.ui.main; import android.content.Intent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.databinding.DataBindingUtil; import androidx.recyclerview.widget.RecyclerView; import com.sarnava.newsapplication.R; import com.sarnava.newsapplication.Util; import com.sarnava.newsapplication.data.News; import com.sarnava.newsapplication.databinding.NewsListItemBinding; import com.sarnava.newsapplication.ui.details.NewsActivity; import java.util.List; import javax.inject.Inject; public class NewsAdapter extends RecyclerView.Adapter<NewsAdapter.ViewHolder> { private List<News> news; @Inject public NewsAdapter() {} public void setNews(List<News> news) { this.news = news; notifyDataSetChanged(); } @NonNull @Override public NewsAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { NewsListItemBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.news_list_item,parent,false); return new ViewHolder(binding); } @Override public void onBindViewHolder(@NonNull NewsAdapter.ViewHolder holder, int position) { holder.binding.setNews(news.get(position)); } @Override public int getItemCount() { return news == null?0:news.size(); } public class ViewHolder extends RecyclerView.ViewHolder { NewsListItemBinding binding; public ViewHolder(final NewsListItemBinding binding) { super(binding.getRoot()); this.binding = binding; binding.getRoot().setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int action = event.getAction(); if(action == MotionEvent.ACTION_DOWN){ binding.getRoot().setScaleX(0.9f); binding.getRoot().setScaleY(0.9f); binding.getRoot().setAlpha(.6f); } else if(action == MotionEvent.ACTION_UP){ binding.getRoot().setScaleX(1f); binding.getRoot().setScaleY(1f); binding.getRoot().setAlpha(1f); if (!Util.block()) { Intent intent = new Intent(v.getContext(), NewsActivity.class); intent.putExtra("news", news.get(getAdapterPosition())); v.getContext().startActivity(intent); } } else { binding.getRoot().setScaleX(1f); binding.getRoot().setScaleY(1f); binding.getRoot().setAlpha(1f); } return true; } }); } } }
[ "sarnava.9.lfc@gmail.com" ]
sarnava.9.lfc@gmail.com
8749cc8e59f3b87299064029229c09a083725957
6701306a9a898f76f830eda8a00b0f0934362b5a
/src/org/consolefacebook/mappers/UserRowMapper.java
16e044fda8ad030fd804cdb8dab55aa83672ab11
[]
no_license
adn911/FacebookConsole
378fe51efb459c129cb2e779f631a55706eda900
6c667d4b885e70ff1819e6349474b00097ed0824
refs/heads/master
2021-01-01T18:11:25.355373
2015-02-16T09:26:28
2015-02-16T09:26:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
928
java
package org.consolefacebook.mappers; import org.consolefacebook.models.User; import org.consolefacebook.util.ObjectRowMapper; import java.lang.reflect.Type; import java.sql.ResultSet; import java.sql.SQLException; /** * Created by GALIB on 2/10/2015. */ public class UserRowMapper implements ObjectRowMapper<User> { @Override public User mapRowToObject(ResultSet rs) throws SQLException { int id = rs.getInt("USER_ID"); String username = rs.getString("USER_NAME"); String email = rs.getString("EMAIL"); String password = rs.getString("PASSWORD"); boolean active = rs.getBoolean("ACTIVE"); String firstName = rs.getString("FIRST_NAME"); String lastName = rs.getString("LAST_NAME"); String DOB = rs.getString("DOB"); return new User(id,username,email,password,active,firstName,lastName,DOB); } }
[ "galib.adnan911@gmail.com" ]
galib.adnan911@gmail.com
3887f10a20a4603d6c1c9d29297e81e343b89419
eb273108e5e3a10dcae11dc8e420aa307c03bf4a
/src/main/java/com/tmri/rfid/access/dao/jdbc/EriAccessDaoJdbc.java
56bb1d3d240a3cdc18f4c3797ceaca387107e063
[]
no_license
wwhtiancai/tlwww
03e674feef0d63421433e3c17df9cd7a35970e78
b442ac5c8b06534b8fb42cd26e75c247b78d0fa3
refs/heads/master
2022-12-20T08:56:10.905292
2019-12-26T04:37:02
2019-12-26T04:37:02
230,195,179
1
0
null
2022-12-16T08:01:04
2019-12-26T04:33:24
Java
UTF-8
Java
false
false
2,938
java
package com.tmri.rfid.access.dao.jdbc; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.tmri.rfid.access.dao.EriAccessDao; import com.tmri.rfid.access.mapper.EriAccessMapper; import com.tmri.rfid.framework.util.DbResult; import com.tmri.rfid.rfid.bean.RfidApply; import com.tmri.rfid.rfid.bean.RfidApplyDoc; @Repository public class EriAccessDaoJdbc implements EriAccessDao { @Autowired private EriAccessMapper eriAccessMapper; public DbResult saveApply(RfidApply app) throws Exception{ DbResult dr=new DbResult(); dr.setCode(-1); app.setClyw("1"); app.setClzt("0"); app.setHphm(null); app.setKh(null); app.setSycplx(null); app.setSycpid(null); int count=eriAccessMapper.existApply(new RfidApply(app.getSqbh(),null)); if(count<1) { if(app.getXsztp()==null||app.getXsztp().length<1) { dr.setMsg("汽车电子标识卡("+app.getKh()+")业务中缺少行驶证上传图片"); return dr; } if(app.getBsktp()==null||app.getBsktp().length<1) { dr.setMsg("汽车电子标识卡("+app.getKh()+")业务中缺少标识卡上传图片"); return dr; } if(app.getQctp()==null||app.getQctp().length<1) { dr.setMsg("汽车电子标识卡("+app.getKh()+")业务中缺少汽车正面上传图片"); return dr; } int r=eriAccessMapper.insertApply(app); if(r==1) { dr.setCode(1); }else { dr.setMsg("业务主表数据新增错误,返回为:"+String.valueOf(r)); } }else { app.setHpzl(null); app.setHphm(null); app.setKh(null); app.setSycplx(null); app.setSycpid(null); int r=eriAccessMapper.updateApply(app); if(r==1) { dr.setCode(1); }else { dr.setMsg("业务主表数据更新错误,返回为:"+String.valueOf(r)); } } return dr; } public DbResult saveOrDeleteApplyFK(RfidApply app) throws Exception{ DbResult dr=new DbResult(); dr.setCode(-1); int count=eriAccessMapper.existApply(new RfidApply(app.getSqbh(),null)); if(count<1) { dr.setMsg("该笔业务不存在"); return dr; } app.setHpzl(null); app.setHphm(null); int r=eriAccessMapper.updateApply(app); if(r==1) { dr.setCode(1); }else { dr.setMsg("业务主表数据更新错误,返回为:"+String.valueOf(r)); } return dr; } public DbResult saveApplyDoc(RfidApplyDoc appDoc) throws Exception{ DbResult dr=new DbResult(); dr.setCode(-1); int count=eriAccessMapper.existApplyDoc(new RfidApplyDoc(appDoc.getXh())); if(count<1) { int r=eriAccessMapper.insertApplyDoc(appDoc); if(r==1) { dr.setCode(1); }else { dr.setMsg("图片主表数据新增错误,返回为:"+String.valueOf(r)); } }else { int r=eriAccessMapper.updateApplyDoc(appDoc); if(r==1) { dr.setCode(1); }else { dr.setMsg("图片主表数据更新错误,返回为:"+String.valueOf(r)); } } return dr; } }
[ "626961224@qq.com" ]
626961224@qq.com
53b8ca761a5c992921d6b8e13da9e117ed9b4a77
14cc8cc715973316aecc48464ca47bebfc9a8b80
/hu.bme.mit.kv.railroadmodel/src/hu/bme/mit/kv/railroadmodel/impl/SectionModelImpl.java
36f140186869a5bc3376c30fcd0b3f607ef1dbfc
[]
no_license
hegyibalint/KV
d794a912afc5ff979c1de6346819d68593ca7d5c
28e01eec0980ba6d22e4417a743309c580efbbbf
refs/heads/master
2021-01-13T01:54:46.823004
2016-02-29T20:04:05
2016-02-29T20:04:05
41,173,981
0
0
null
null
null
null
UTF-8
Java
false
false
6,119
java
/** */ package hu.bme.mit.kv.railroadmodel.impl; import hu.bme.mit.kv.railroadmodel.Group; import hu.bme.mit.kv.railroadmodel.RailroadModelPackage; import hu.bme.mit.kv.railroadmodel.Region; import hu.bme.mit.kv.railroadmodel.SectionModel; import hu.bme.mit.kv.railroadmodel.SwitchSetting; import java.util.Collection; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Section Model</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link hu.bme.mit.kv.railroadmodel.impl.SectionModelImpl#getGroups <em>Groups</em>}</li> * <li>{@link hu.bme.mit.kv.railroadmodel.impl.SectionModelImpl#getTrackables <em>Trackables</em>}</li> * <li>{@link hu.bme.mit.kv.railroadmodel.impl.SectionModelImpl#getSettings <em>Settings</em>}</li> * </ul> * * @generated */ public class SectionModelImpl extends MinimalEObjectImpl.Container implements SectionModel { /** * The cached value of the '{@link #getGroups() <em>Groups</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getGroups() * @generated * @ordered */ protected EList<Group> groups; /** * The cached value of the '{@link #getTrackables() <em>Trackables</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTrackables() * @generated * @ordered */ protected EList<Region> trackables; /** * The cached value of the '{@link #getSettings() <em>Settings</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSettings() * @generated * @ordered */ protected EList<SwitchSetting> settings; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected SectionModelImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return RailroadModelPackage.Literals.SECTION_MODEL; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Group> getGroups() { if (groups == null) { groups = new EObjectContainmentEList<Group>(Group.class, this, RailroadModelPackage.SECTION_MODEL__GROUPS); } return groups; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Region> getTrackables() { if (trackables == null) { trackables = new EObjectContainmentEList<Region>(Region.class, this, RailroadModelPackage.SECTION_MODEL__TRACKABLES); } return trackables; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<SwitchSetting> getSettings() { if (settings == null) { settings = new EObjectContainmentEList<SwitchSetting>(SwitchSetting.class, this, RailroadModelPackage.SECTION_MODEL__SETTINGS); } return settings; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case RailroadModelPackage.SECTION_MODEL__GROUPS: return ((InternalEList<?>)getGroups()).basicRemove(otherEnd, msgs); case RailroadModelPackage.SECTION_MODEL__TRACKABLES: return ((InternalEList<?>)getTrackables()).basicRemove(otherEnd, msgs); case RailroadModelPackage.SECTION_MODEL__SETTINGS: return ((InternalEList<?>)getSettings()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case RailroadModelPackage.SECTION_MODEL__GROUPS: return getGroups(); case RailroadModelPackage.SECTION_MODEL__TRACKABLES: return getTrackables(); case RailroadModelPackage.SECTION_MODEL__SETTINGS: return getSettings(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case RailroadModelPackage.SECTION_MODEL__GROUPS: getGroups().clear(); getGroups().addAll((Collection<? extends Group>)newValue); return; case RailroadModelPackage.SECTION_MODEL__TRACKABLES: getTrackables().clear(); getTrackables().addAll((Collection<? extends Region>)newValue); return; case RailroadModelPackage.SECTION_MODEL__SETTINGS: getSettings().clear(); getSettings().addAll((Collection<? extends SwitchSetting>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case RailroadModelPackage.SECTION_MODEL__GROUPS: getGroups().clear(); return; case RailroadModelPackage.SECTION_MODEL__TRACKABLES: getTrackables().clear(); return; case RailroadModelPackage.SECTION_MODEL__SETTINGS: getSettings().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case RailroadModelPackage.SECTION_MODEL__GROUPS: return groups != null && !groups.isEmpty(); case RailroadModelPackage.SECTION_MODEL__TRACKABLES: return trackables != null && !trackables.isEmpty(); case RailroadModelPackage.SECTION_MODEL__SETTINGS: return settings != null && !settings.isEmpty(); } return super.eIsSet(featureID); } } //SectionModelImpl
[ "baprof.hegyi@gmail.com" ]
baprof.hegyi@gmail.com
9db75068441fccaadf0d25ba9714b2dd9ab9714a
66dca798957756f41a4da0d3717b6f871c7af318
/src/main/java/ua/test/model/Figure.java
bf93c83d78d2fbe0920bb5937ca19bf7f7708e2a
[]
no_license
akarpenko94/TestMatick_task
c57a4befc2e4d221b84173f9db90e600754dca65
390adb265e5f3b11c8d071908d13ca76399895a4
refs/heads/master
2022-05-31T10:53:06.298223
2020-03-19T15:15:19
2020-03-19T15:15:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,031
java
package ua.test.model; import ua.test.Color; import ua.test.utils.Utils; /** * * @author A. Karpenko * @date 18 мар. 2020 г. 19:40:19 */ public abstract class Figure { protected String name; protected Color color; /** * @return Figure name. */ public String getName() { return name; } /** * @return Color of figure. */ public Color getColor() { return color; } /** * @return Perimeter of figure. */ public abstract double getPerimeter(); /** * @return Area of figure. */ public abstract double getArea(); /** * Draw a figure. */ public void draw() { System.out.println(this); } @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("Фигура: "); sb.append(getName()); sb.append(", площадь: "); sb.append(Utils.round(getArea())); sb.append(" кв. ед., периметр: "); sb.append(Utils.round(getPerimeter())); sb.append(" ед., цвет: "); sb.append(getColor()); return sb.toString(); } }
[ "artur.karpenko94@gmail.com" ]
artur.karpenko94@gmail.com
94e606432e592cd002d632102de777ab60a2b300
848d12ccfdef2a2dc9cd62f97e1cf6dd3d43bfc3
/src/main/java/com/monprojet/dao/impl/ProduitDaoImpl.java
cfee481663fdc3710a60e0e90340a9d7b22b93cb
[]
no_license
iali88/store
bb02c5670f0014fbc84eecb7f97976efebfbd835
20b7416891a49278d97b53de2560a48fb774b47d
refs/heads/master
2021-04-06T15:49:39.567895
2018-03-14T22:02:39
2018-03-14T22:02:39
125,267,448
0
0
null
null
null
null
UTF-8
Java
false
false
1,460
java
package com.monprojet.dao.impl; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import com.monprojet.dao.ProduitDao; import com.monprojet.model.Produit; @Repository @Transactional public class ProduitDaoImpl implements ProduitDao { @Autowired private SessionFactory sessionFactory; public Produit getProduitById(String id) { Session session = sessionFactory.getCurrentSession(); Produit produit = (Produit) session.get(Produit.class, id); session.flush(); return produit; } public List<Produit> getAllProduits() { Session session = sessionFactory.getCurrentSession(); Query query = session.createQuery("from Produit"); List<Produit> prdListe = query.list(); session.flush(); return prdListe; } public void updateProduit(Produit produit) { Session session = sessionFactory.getCurrentSession(); session.saveOrUpdate(produit); session.flush(); } public void addProduit(Produit produit) { Session session = sessionFactory.getCurrentSession(); session.saveOrUpdate(produit); session.flush(); } public void deleteProduits(String id) { Session session = sessionFactory.getCurrentSession(); session.delete(getProduitById(id)); session.flush(); } }
[ "irfan.ali@free.fr" ]
irfan.ali@free.fr
d4301ba586cff87f990c8b747647101e74b78d26
04f725b40d58a4b6a0ed396a01f01b6181f458a4
/springboot-jpa/src/main/java/com/example/demo/web/UserController.java
9150d70759f650bf679fa87d88c590673968535d
[]
no_license
youyang87111/code
69c652e9fa0ce0571b6e342f40a1abb9fcf5aa76
78e9d0a13f17444cff0ae2681a0d84c9e5732aa4
refs/heads/master
2021-01-23T23:53:09.708771
2018-02-26T10:31:11
2018-02-26T10:31:11
122,742,931
1
1
null
null
null
null
UTF-8
Java
false
false
651
java
package com.example.demo.web; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.example.demo.domain.User; import com.example.demo.service.UserService; @RestController public class UserController { @Autowired UserService userService; @RequestMapping(value = "/list",method = RequestMethod.GET) public List<User> getUsers(){ return userService.list(); } }
[ "youyang_java@139.com" ]
youyang_java@139.com
71ab6f7dddd56c0eaeb557dd06268fc1094b7a45
cc328476eba0f9dcbac108688cf1b97d1d06c189
/src/main/java/com/cisco/policyconversiontool/dto/wsa/asyncos806/DESTIP.java
42e9f67f2b47b1cf4d4089a740506d215ade5dff
[]
no_license
SecurView/cws-wsa
b9278caee8d52afd9f71b925516bc18380b5c331
c3e9c245722f89d9a3189bf7bc9700e8b4c7f1d6
refs/heads/master
2016-09-06T21:35:20.674191
2014-12-19T14:45:23
2014-12-19T14:45:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,277
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 // 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: 2014.11.26 at 05:46:49 PM IST // package com.cisco.policyconversiontool.dto.wsa.asyncos806; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; /** * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "value" }) @XmlRootElement(name = "DEST_IP") public class DESTIP { @XmlValue protected String value; /** * Gets the value of the value property. * * @return * possible object is * {@link String } * */ public String getvalue() { return value; } /** * Sets the value of the value property. * * @param value * allowed object is * {@link String } * */ public void setvalue(String value) { this.value = value; } }
[ "kgadekar@securview.com" ]
kgadekar@securview.com
acd4625c2ecf7c2e5ea73d0ae415dd2d8c193ab4
5cbc3ea73e214452696ec9a0f511673dff990541
/Licenciatura/6º Semestre/Sistemas Operativos II/Trabalho/web/webTrabalho/src/java/so2/rest/GetMedia.java
9a63471d1ce851feee22ceb3dd05d7124740b8b8
[]
no_license
dias1397/university
3872de4022fd57326090f5772dbd4dca18165aeb
59b7f6d1458c4cf30b189ed0ae366e78529f75fa
refs/heads/master
2023-04-13T03:38:57.707491
2020-08-12T12:16:46
2020-08-12T12:16:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,277
java
package so2.rest; 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; /** * * @author joaoc */ public class GetMedia extends HttpServlet { NewJerseyClient client = new NewJerseyClient(); public static boolean isInteger(String str) { if (str == null) { return false; } int length = str.length(); if (length == 0) { return false; } int i = 0; if (str.charAt(0) == '-') { if (length == 1) { return false; } i = 1; } for (; i < length; i++) { char c = str.charAt(i); if (c < '0' || c > '9') { return false; } } return true; } protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>Delete</title>"); out.println("<meta charset=\"UTF-8\">"); out.println("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"); out.println("<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\"/>"); out.println("</head>"); out.println("<body>"); out.println("<ul>"); out.println("<li><a href=\"index.html\"><font size=\"5\">Menu</font></a></li>"); out.println("<li><a href=\"Listar\"><font size=\"5\">Listar</font></a></li>"); out.println("<li><a href=\"responder.html\"><font size=\"5\">Responder</font></a></li>"); out.println("<li><a class=\"active\" href=\"#media\"><font size=\"5\">Consultar Média</font></a></li>"); out.println("<li><a href=\"Vezes\"><font size=\"5\">Consultar Vezes</font></a></li>"); out.println("<li><a href=\"criar.html\"><font size=\"5\">Criar</font></a></li>"); out.println("<li><a href=\"remover.html\"><font size=\"5\">Remover</font></a></li>"); out.println("</ul>"); out.println("<div Style=\"margin-left:25%; padding:1px 16px; height: 1000px;\">"); String s = request.getParameter("index"); if(isInteger(s)) { int index = Integer.parseInt(s); ListaQuest l = new ListaQuest(); l = client.getQuestList_JSON(l.getClass()); if(!(index+1 > l.getLista().size())) { QuestImpl q = l.getLista().get(index); out.println("<h1 align=\"center\">Média das perguntas do Questionário \"" + q.getNome() + "\"</h1>"); int j = 1; for(PergQuest p : q.getPerg()) { if(p.getRespostas() == 0 || p.getTotal() == 0) { out.println("<p><font size=\"4\">" + j + "-" + p.getNome() + ": 0.0</font></p>"); } else { double d = (double)p.getRespostas()/(double)p.getTotal(); out.println("<p><font size=\"4\">" + j + "-" + p.getNome() + ": " + d + "</font></p>"); j++; } } } else { out.println("<h1 align=\"center\">Indice não aceite</h1>"); } } else { out.println("<h1 align=\"center\">Indice não aceite</h1>"); } out.println("</div>"); out.println("</body>"); out.println("</html>"); } } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "joao_dias1397@hotmail.com" ]
joao_dias1397@hotmail.com
7d6cd1f9d8bc24005013e8c8669dbe1cdfbba9ac
4db287bd79693262ac420c5f600bbd2ab7d5570c
/src/com/xy/music/fragment/MenuFragment.java
dc7eed7374215518da3d3686cec63c79114644bc
[ "Apache-2.0" ]
permissive
McqueenLe/XPlayer
da359ff31b36ee68808acc27e1f4c8e231fe8882
6c671c62f075a07b7cdc9bc49193e65db830bb39
refs/heads/master
2021-01-19T14:41:57.212962
2017-03-30T06:24:15
2017-03-30T06:24:15
86,651,051
1
0
null
null
null
null
UTF-8
Java
false
false
4,629
java
package com.xy.music.fragment; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import com.xy.music.R; import com.xy.music.AppManager; import com.xy.music.activity.IConstants; import com.xy.music.activity.HomeActivity; import com.xy.music.activity.MenuBackgroundActivity; import com.xy.music.activity.MenuScanActivity; import com.xy.music.activity.MenuSettingActivity; import com.xy.music.activity.VideoListActivity; import com.xy.music.service.ServiceManager; import com.xy.music.slidemenu.SlidingMenu.OnOpenedListener; /** * 侧滑Menu * 该类提供了软件的设置,歌曲的控制等几大功能 * @author xy * */ public class MenuFragment extends Fragment implements OnClickListener, IConstants, OnOpenedListener { private TextView mMediaCountTv; private TextView mScanTv, mPlayModeTv, mBackgroundTv, mSleepTv, mSettingTv, mExitTv, mVideoTv; private HomeActivity mMainActivity; private int mCurMode; private ServiceManager mServiceManager; private static final String modeName[] = { "列表循环", "顺序播放", "随机播放", "单曲循环" }; private int modeDrawable[] = { R.drawable.icon_list_reapeat, R.drawable.icon_sequence, R.drawable.icon_shuffle, R.drawable.icon_single_repeat }; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.frame_menu1, container, false); initView(view); mServiceManager = AppManager.mServiceManager; return view; } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mMainActivity = (HomeActivity) getActivity(); mMainActivity.mSlidingMenu.setOnOpenedListener(this); } private void initView(View view) { mMediaCountTv = (TextView) view.findViewById(R.id.txt_media_count); mScanTv = (TextView) view.findViewById(R.id.txt_scan); mPlayModeTv = (TextView) view.findViewById(R.id.txt_play_mode); mBackgroundTv = (TextView) view.findViewById(R.id.txt_background); mSleepTv = (TextView) view.findViewById(R.id.txt_sleep); mSettingTv = (TextView) view.findViewById(R.id.preference_text); mExitTv = (TextView) view.findViewById(R.id.txt_exit); mVideoTv = (TextView) view.findViewById(R.id.txt_video); mMediaCountTv.setOnClickListener(this); mScanTv.setOnClickListener(this); mPlayModeTv.setOnClickListener(this); mBackgroundTv.setOnClickListener(this); mSleepTv.setOnClickListener(this); mSettingTv.setOnClickListener(this); mExitTv.setOnClickListener(this); mVideoTv.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.txt_scan: startActivityForResult(new Intent(getActivity(), MenuScanActivity.class), 1); // 歌曲扫描 break; case R.id.txt_play_mode: // 播放模式 changeMode(); break; case R.id.txt_background: // 设置背景 startActivity(new Intent(getActivity(), MenuBackgroundActivity.class)); break; case R.id.preference_text: // 更多设置 startActivity(new Intent(getActivity(), MenuSettingActivity.class)); break; case R.id.txt_sleep: // 睡眠设置 mMainActivity.showSleepDialog(); break; case R.id.txt_exit: // 退出 getActivity().finish(); break; case R.id.txt_video: // 我的视频 startActivity(new Intent(getActivity(), VideoListActivity.class)); break; default: break; } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == 1) { //刷新主页内容 ((HomeActivity)getActivity()).mMainFragment.refreshNum(); } } /** * 更改播放模式 */ private void changeMode() { mCurMode++; if (mCurMode > MPM_SINGLE_LOOP_PLAY) { mCurMode = MPM_LIST_LOOP_PLAY; } mServiceManager.setPlayMode(mCurMode); initPlayMode(); } /** * 初始化播放模式 */ private void initPlayMode() { mPlayModeTv.setText(modeName[mCurMode]); Drawable drawable = getResources().getDrawable(modeDrawable[mCurMode]); drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); mPlayModeTv.setCompoundDrawables(drawable, null, null, null); } @Override public void onOpened() { mCurMode = mServiceManager.getPlayMode(); initPlayMode(); } }
[ "18702374968@139.com" ]
18702374968@139.com
0b043161717326e1c95d0ac9bb87b798dbfbe075
77e3220c487964d397f90ad18e8308551ad79a53
/hw06/src/generated/MiniCBaseListener.java
b36319d7fe42d7de1517cdbd82dfab1d89aead73
[]
no_license
minkinew/CNU-2019-Fall-Compiler
d4a7ca8683a27b3efa3cff9b27abb72f9d192d2f
c128b68a604552627cb9da96842a7ac562294e35
refs/heads/master
2020-08-12T17:55:57.157616
2019-11-26T14:13:06
2019-11-26T14:13:06
214,814,580
1
1
null
null
null
null
UTF-8
Java
false
false
6,088
java
package generated;// Generated from C:/Users/�αⴺ/IdeaProjects/Compiler_hw02/src\MiniC.g4 by ANTLR 4.7.2 import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.tree.ErrorNode; import org.antlr.v4.runtime.tree.TerminalNode; /** * This class provides an empty implementation of {@link MiniCListener}, * which can be extended to create a listener which only needs to handle a subset * of the available methods. */ public class MiniCBaseListener implements MiniCListener { /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterProgram(MiniCParser.ProgramContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitProgram(MiniCParser.ProgramContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterDecl(MiniCParser.DeclContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitDecl(MiniCParser.DeclContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterVar_decl(MiniCParser.Var_declContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitVar_decl(MiniCParser.Var_declContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterType_spec(MiniCParser.Type_specContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitType_spec(MiniCParser.Type_specContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterFun_decl(MiniCParser.Fun_declContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitFun_decl(MiniCParser.Fun_declContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterParams(MiniCParser.ParamsContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitParams(MiniCParser.ParamsContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterParam(MiniCParser.ParamContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitParam(MiniCParser.ParamContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterStmt(MiniCParser.StmtContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitStmt(MiniCParser.StmtContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterExpr_stmt(MiniCParser.Expr_stmtContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitExpr_stmt(MiniCParser.Expr_stmtContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterWhile_stmt(MiniCParser.While_stmtContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitWhile_stmt(MiniCParser.While_stmtContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterCompound_stmt(MiniCParser.Compound_stmtContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitCompound_stmt(MiniCParser.Compound_stmtContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterLocal_decl(MiniCParser.Local_declContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitLocal_decl(MiniCParser.Local_declContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterIf_stmt(MiniCParser.If_stmtContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitIf_stmt(MiniCParser.If_stmtContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterReturn_stmt(MiniCParser.Return_stmtContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitReturn_stmt(MiniCParser.Return_stmtContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterExpr(MiniCParser.ExprContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitExpr(MiniCParser.ExprContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterArgs(MiniCParser.ArgsContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitArgs(MiniCParser.ArgsContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterEveryRule(ParserRuleContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitEveryRule(ParserRuleContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void visitTerminal(TerminalNode node) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void visitErrorNode(ErrorNode node) { } }
[ "dbs03088@naver.com" ]
dbs03088@naver.com
80fbb0395d2a080f696d6e73b3790f6f3b8e270f
99ae734ff49a01ae2a536d7ed17a4246717a3cd5
/store/src/main/java/com/dreams/demo/store/web/rest/CustomerResource.java
c44e0feca2173e162e48e8f9daceb52786448f0e
[]
no_license
MichaelMENG/jhipster-jdl-demo
f83e12c2cbd31bd15b4a9e64eab4cfec42b84ef3
0b37999732aa6e89fe4dc4a0e931f8eec4046618
refs/heads/master
2020-05-19T12:40:40.411069
2019-05-05T10:57:12
2019-05-05T10:57:12
185,019,393
3
1
null
null
null
null
UTF-8
Java
false
false
5,005
java
package com.dreams.demo.store.web.rest; import com.dreams.demo.store.domain.Customer; import com.dreams.demo.store.service.CustomerService; import com.dreams.demo.store.web.rest.errors.BadRequestAlertException; import com.dreams.demo.store.web.rest.util.HeaderUtil; import com.dreams.demo.store.web.rest.util.PaginationUtil; import io.github.jhipster.web.util.ResponseUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Optional; /** * REST controller for managing Customer. */ @RestController @RequestMapping("/api") public class CustomerResource { private final Logger log = LoggerFactory.getLogger(CustomerResource.class); private static final String ENTITY_NAME = "customer"; private final CustomerService customerService; public CustomerResource(CustomerService customerService) { this.customerService = customerService; } /** * POST /customers : Create a new customer. * * @param customer the customer to create * @return the ResponseEntity with status 201 (Created) and with body the new customer, or with status 400 (Bad Request) if the customer has already an ID * @throws URISyntaxException if the Location URI syntax is incorrect */ @PostMapping("/customers") public ResponseEntity<Customer> createCustomer(@Valid @RequestBody Customer customer) throws URISyntaxException { log.debug("REST request to save Customer : {}", customer); if (customer.getId() != null) { throw new BadRequestAlertException("A new customer cannot already have an ID", ENTITY_NAME, "idexists"); } Customer result = customerService.save(customer); return ResponseEntity.created(new URI("/api/customers/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())) .body(result); } /** * PUT /customers : Updates an existing customer. * * @param customer the customer to update * @return the ResponseEntity with status 200 (OK) and with body the updated customer, * or with status 400 (Bad Request) if the customer is not valid, * or with status 500 (Internal Server Error) if the customer couldn't be updated * @throws URISyntaxException if the Location URI syntax is incorrect */ @PutMapping("/customers") public ResponseEntity<Customer> updateCustomer(@Valid @RequestBody Customer customer) throws URISyntaxException { log.debug("REST request to update Customer : {}", customer); if (customer.getId() == null) { throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); } Customer result = customerService.save(customer); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, customer.getId().toString())) .body(result); } /** * GET /customers : get all the customers. * * @param pageable the pagination information * @return the ResponseEntity with status 200 (OK) and the list of customers in body */ @GetMapping("/customers") public ResponseEntity<List<Customer>> getAllCustomers(Pageable pageable) { log.debug("REST request to get a page of Customers"); Page<Customer> page = customerService.findAll(pageable); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/customers"); return ResponseEntity.ok().headers(headers).body(page.getContent()); } /** * GET /customers/:id : get the "id" customer. * * @param id the id of the customer to retrieve * @return the ResponseEntity with status 200 (OK) and with body the customer, or with status 404 (Not Found) */ @GetMapping("/customers/{id}") public ResponseEntity<Customer> getCustomer(@PathVariable Long id) { log.debug("REST request to get Customer : {}", id); Optional<Customer> customer = customerService.findOne(id); return ResponseUtil.wrapOrNotFound(customer); } /** * DELETE /customers/:id : delete the "id" customer. * * @param id the id of the customer to delete * @return the ResponseEntity with status 200 (OK) */ @DeleteMapping("/customers/{id}") public ResponseEntity<Void> deleteCustomer(@PathVariable Long id) { log.debug("REST request to delete Customer : {}", id); customerService.delete(id); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build(); } }
[ "dreamstep36@163.com" ]
dreamstep36@163.com
17c61742eb031089f1a918a51e419ea30b372162
d31f8ceaafe27fe19074f9263a79e3c48b6eab24
/algorithms/test/com/threenary/sorting/ExternalSorting.java
769a3635d75ae0c44df91f3428019e6ceb879fdf
[]
no_license
threenary/algorithms
6c061a184efb4b4489727a9a1bc37a41a36c5c5b
5169260f3dca8455ca28505b235375cf64427a24
refs/heads/master
2021-01-20T19:27:03.457454
2016-11-26T09:09:28
2016-11-26T09:09:28
60,199,969
0
0
null
null
null
null
ISO-8859-2
Java
false
false
6,227
java
package com.threenary.sorting; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.TreeMap; /** * Example of external sorting * * @author Gonzalo Gómez Sullain * */ public class ExternalSorting { private static final int DEFAULT_SLICE = 10000; private static final String DEFAULT_OUTPUT = "sortedOutputFile"; /** * Entry point of execution * * @param args * {@link String[]} in which we expect<br> * <b>arg0:</b>File origin with data to be sorted <br> * <b>arg1:</b>Expected destination file <br> * <b>arg2:</b>Number of slices to read each time <br> * @throws IOException */ public static void main(String[] args) throws IOException { // We should be validating all the the input args File inputFile = new File(args[0]); File outputFile; try { outputFile = new File(args[1]); } catch (Exception e1) { outputFile = new File(DEFAULT_OUTPUT); } int sliceSize; try { sliceSize = Integer.parseInt(args[2]); } catch (NumberFormatException e) { sliceSize = DEFAULT_SLICE; } // First Step: Slice big file in smaller parts, each should be sorted. List<File> temporaryFiles = sliceAndSort(inputFile, COMPARATOR, sliceSize); // Seccond Step: Merge the sorted slices into one final output file mergeSort(temporaryFiles, outputFile, COMPARATOR); } private static Comparator<String> COMPARATOR = new Comparator<String>() { @Override public int compare(String obj1, String obj2) { if (obj1 == obj2) { return 0; } if (obj1 == null) { return -1; } if (obj2 == null) { return 1; } return obj1.compareTo(obj2); } }; /** * Iterates the inputFile reading sliceSize lines each time, then sort this * sliceSize lines using the comparator criteria, and creates a file for * every chunk of the original file. * * The results is * * @param inputFile * a {@link File} with the original data to sort * @param comparator * an object that extends {@link Comparator} with the sortin * criteria * @param sliceSize * an <b>int</b> indicating the number of rows to read each time * @return a {@link List} of (inputFile lines) / slizeSize temporary ordered * {@link File} * @throws IOException */ public static List<File> sliceAndSort(File inputFile, Comparator<String> comparator, int sliceSize) throws IOException { List<File> files = new ArrayList<File>(); BufferedReader bufferReader = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile))); List<String> slices = new ArrayList<String>(); int indexFiles = 0; String line = bufferReader.readLine(); while (line != null) { for (int i = 0; i < sliceSize; i++) { if (line == null) { line = null; break; } if (!line.isEmpty()) slices.add(line); line = bufferReader.readLine(); } if (!slices.isEmpty()) { // Sort slice Collections.sort(slices, comparator); // Create temp files files.add(createTempFile(slices, indexFiles)); indexFiles++; slices.clear(); } } bufferReader.close(); return files; } /** * Creates and saves each temporary slice of the original file into a * temporary file in disck * * @param slices * a {@link List} of {@link String} sorted to be saved * @param indexFiles * an <b>int</b> that indicates the index of the temporary file * @return a {@link File} * @throws IOException */ private static File createTempFile(List<String> slices, int indexFiles) throws IOException { File tempFile = File.createTempFile("slice_", String.valueOf(indexFiles)); tempFile.deleteOnExit(); OutputStream out = new FileOutputStream(tempFile); BufferedWriter bufferWritter = new BufferedWriter(new OutputStreamWriter(out)); for (String row : slices) { bufferWritter.write(row); bufferWritter.newLine(); } bufferWritter.close(); return tempFile; } /** * Receives the list of temporary sorted files to order, and applys the * comparision criteria received as parameter using a {@link TreeMap}, which * reduces the sorting in a logarithmic scale. * * <b>To get the expected final behavior, the sorting criteria should be the * same used to sort the original file slices.</b> * * @param temporaryFiles * a {@link List} of temporary sorted {@link File} * @param outFile * a {@link File} that will be filled with the resuling merge * @param comparator * the sorting criteria that implements the {@link Comparator} * interfaz * @throws IOException */ public static void mergeSort(List<File> temporaryFiles, File outFile, Comparator<String> comparator) throws IOException { BufferedReader[] readers = new BufferedReader[temporaryFiles.size()]; PrintWriter writer = new PrintWriter(outFile); TreeMap<String, Integer> treeMap = new TreeMap<String, Integer>(comparator); try { // EOF should be checked at the begging of the files. int r = 0; for (File chunkFile : temporaryFiles) { readers[r] = new BufferedReader(new FileReader(chunkFile)); String line = readers[r].readLine(); treeMap.put(line, Integer.valueOf(r)); r++; } while (!treeMap.isEmpty()) { Map.Entry<String, Integer> nextToGo = treeMap.pollFirstEntry(); int fileIndex = nextToGo.getValue().intValue(); writer.println(nextToGo.getKey()); String line = readers[fileIndex].readLine(); if (line != null) { treeMap.put(line, Integer.valueOf(fileIndex)); } } } finally { for (int i = 0; i < readers.length; i++) { readers[i].close(); } writer.close(); for (File file : temporaryFiles) { file.delete(); } } } }
[ "ggomezsullain@gmail.com" ]
ggomezsullain@gmail.com
be7fce045282b0b9f9ecb2e3fa4a0379d684a5f2
7317f4e950174fa433ee79319d1c4d8553754a46
/src/com/example/chatbotnew/PersonalInfo.java
224547a270be2de2a286cdfc9437f5b13afed245
[]
no_license
nid1/ChatBotNew
75d26bdf4d27b90a300aac24843fee1c410ac0a8
a6e13f34419abcbfc7c29818f3af5ec125ebedab
refs/heads/master
2020-03-25T11:08:39.783697
2018-08-06T11:37:53
2018-08-06T11:37:53
143,720,455
0
0
null
null
null
null
UTF-8
Java
false
false
5,244
java
package com.example.chatbotnew; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; import android.os.Bundle; import android.os.StrictMode; import android.preference.PreferenceManager; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; import android.widget.Toast; public class PersonalInfo extends Activity { EditText e1,e3,e4,e5,e6,e7; RadioButton r0,r1; Button b1; SharedPreferences sp; String fname,dob,gender,quali,addr,email,mobile; String method="Psychatristupdate"; String namespace="http://tempuri.org/"; String soapaction="http://tempuri.org/Psychatristupdate"; String method1="pedit"; String soapaction1="http://tempuri.org/pedit"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_personal_info); e1=(EditText)findViewById(R.id.editText1); e3=(EditText)findViewById(R.id.editText3); e4=(EditText)findViewById(R.id.editText4); e5=(EditText)findViewById(R.id.editText5); e6=(EditText)findViewById(R.id.editText6); e7=(EditText)findViewById(R.id.editText7); // e9=(EditText)findViewById(R.id.editText9); // e8=(EditText)findViewById(R.id.editText8); r0=(RadioButton)findViewById(R.id.radio0); r1=(RadioButton)findViewById(R.id.radio1); b1=(Button)findViewById(R.id.button1); sp=PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); try { if(android.os.Build.VERSION.SDK_INT>9) { StrictMode.ThreadPolicy policy=new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } } catch (Exception e) { // TODO: handle exception } try { SoapObject soap=new SoapObject(namespace, method1); String id=sp.getString("lid", ""); soap.addProperty("pid",id); SoapSerializationEnvelope senv=new SoapSerializationEnvelope(SoapEnvelope.VER11); senv.dotNet=true; senv.setOutputSoapObject(soap); HttpTransportSE htp=new HttpTransportSE(sp.getString("url","")); htp.call(soapaction1, senv); String res=senv.getResponse().toString(); Toast.makeText(getApplicationContext(), res, Toast.LENGTH_LONG).show(); String r[]=res.split("#"); for(int i=0;i<r.length;i++) { fname =r[0]; dob=r[1]; gender=r[2]; quali=r[3]; addr=r[4]; email=r[5]; mobile=r[6]; } for(int i=0;i<r.length;i++) { e1.setText(fname); e3.setText(dob); if(gender=="male") { r0.setText(gender); } else { r1.setText(gender); } e4.setText(quali); e5.setText(addr); e6.setText(email); e7.setText(mobile); } Toast.makeText(getApplicationContext(), res, Toast.LENGTH_LONG).show(); } catch(Exception e) { Toast.makeText(getApplicationContext(), "error", Toast.LENGTH_LONG).show(); } b1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub fname=e1.getText().toString(); dob=e3.getText().toString(); if(gender=="male") { r0.getText().toString(); } else { r1.getText().toString(); } quali=e4.getText().toString(); addr=e5.getText().toString(); email=e6.getText().toString(); mobile=e7.getText().toString(); try { SoapObject soap=new SoapObject(namespace, method); soap.addProperty("id",sp.getString("lid", "")); soap.addProperty("fname", fname); soap.addProperty("dob", dob); soap.addProperty("gender",gender); soap.addProperty("quali",quali); soap.addProperty("addr", addr); soap.addProperty("email", email); soap.addProperty("phone", mobile); SoapSerializationEnvelope senv=new SoapSerializationEnvelope(SoapEnvelope.VER11); senv.dotNet=true; senv.setOutputSoapObject(soap); HttpTransportSE htp=new HttpTransportSE(sp.getString("url","")); htp.call(soapaction, senv); String res=senv.getResponse().toString(); Toast.makeText(getApplicationContext(), res, Toast.LENGTH_LONG).show(); if(res.equalsIgnoreCase("error")||res.equalsIgnoreCase("no")) { Toast.makeText(getApplicationContext(), "editing not successful", Toast.LENGTH_LONG).show(); } else { Toast.makeText(getApplicationContext(), "editing successful", Toast.LENGTH_LONG).show(); Intent i=new Intent(getApplicationContext(),HomePage.class); startActivity(i); } } catch(Exception e) { Toast.makeText(getApplicationContext(), "error", Toast.LENGTH_LONG).show(); } } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.personal_info, menu); return true; } }
[ "riitnidheesh@gmail.com" ]
riitnidheesh@gmail.com
2ce879f97fa38ec552cb0e7215390711331574bb
dfa4f764032ccbfd52e7b5d669d26aa2742839c6
/src/main/java/com/mrkbrz/util/Constant.java
ac531d82c2f2046539d176b0c218b65baab6e30b
[]
no_license
mirkobruzzi/Tax
528b842d3a3486051487dc36a340c766ad51ee2c
eb0e01daf5c6c71dd4cc6e82799101852de14c52
refs/heads/master
2020-07-24T09:04:34.882593
2016-11-15T13:14:06
2016-11-15T13:14:06
73,791,719
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
package com.mrkbrz.util; import java.math.BigDecimal; /** * Created by Mirko Manuel Bruzzi on 15/11/16. * Constants used in the whole application */ public class Constant { public final static BigDecimal HUNDRED = new BigDecimal(100); public final static BigDecimal TEN = BigDecimal.TEN; public final static BigDecimal FIVE = new BigDecimal(5); public static final String INPUT_DIR = "input"; }
[ "mirko.manuel@hotmail.it" ]
mirko.manuel@hotmail.it
de63f002a0901e45597510124e743055687faac6
13e16e7dcd8ee9e344014fe48e88996a2718cd4c
/app/src/main/java/ai/roam/currentlocation/MainActivity.java
901ad6785dcca6993566042e1970c2a0bc086832
[]
no_license
jothipriyadharshanr/currentlocation-geospark-android
bb823168c4636ecaa5aa3833ed18cbf8943b5763
137eb25b6038f2b5c1a64132d4fd9fc3370bb0eb
refs/heads/main
2023-05-26T03:34:43.279271
2021-06-10T05:03:15
2021-06-10T05:03:15
375,574,782
0
0
null
null
null
null
UTF-8
Java
false
false
421
java
package ai.roam.currentlocation; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import com.geospark.lib.GeoSpark; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); GeoSpark.initialize(this, "YOU-SDK-KEY"); } }
[ "joe@geospark.co" ]
joe@geospark.co
e698f99f0771eb6f1c3e92b68315d0268dd6b67b
32e15465c5ae289a665c603e2780c85dafbafcc7
/P0191_SimpleCalculator/src/androidTest/java/ru/startandroid/p0191_simplecalculator/ExampleInstrumentedTest.java
c2a05881089a9eac23b95fca068fcfb04093f18a
[]
no_license
ExploiD2005/AndriodLessons
5a6de7629a51fa4a59a00fc2595428875e4f6a33
a4574acc83bd40325b80a95579efb0086434f99b
refs/heads/master
2020-12-20T18:33:55.646535
2020-01-25T13:16:35
2020-01-25T13:16:35
236,171,211
1
0
null
null
null
null
UTF-8
Java
false
false
760
java
package ru.startandroid.p0191_simplecalculator; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("ru.startandroid.p0191_simplecalculator", appContext.getPackageName()); } }
[ "exploid2005@gmail.com" ]
exploid2005@gmail.com
cc4407c92b2f14d3c89a0b6f212508ebced967ed
ccbecd673ec01d3da3afe8c07bd3a9e8a0e772fd
/demo/v3-demo-portlet/src/main/java/org/apache/portals/pluto/demo/v3/ActEvtProxyServlet.java
99ca2d4a418bcb7c4d70ce658780badb173aee46
[ "Apache-2.0", "EPL-2.0", "CDDL-1.0" ]
permissive
ngriffin7a/portals-pluto
9b111b896ff9dab9268d15dc179517d8190b6b17
daf4d3748e6d57af62075e5cdd74486b53a7a02a
refs/heads/master
2021-01-19T03:49:06.082390
2019-04-28T00:17:47
2019-04-28T00:17:47
69,889,534
1
0
Apache-2.0
2018-11-15T23:49:00
2016-10-03T16:32:49
Java
UTF-8
Java
false
false
2,899
java
/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.portals.pluto.demo.v3; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.RequestDispatcher; 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.HttpServletResponseWrapper; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import static org.apache.portals.pluto.demo.v3.TagLibPortlet.ATTRIB_TXT; import static org.apache.portals.pluto.demo.v3.TagLibPortlet.PROXY; import static org.apache.portals.pluto.demo.v3.TagLibPortlet.TEST; /** * Servlet used by the {@link TagLibPortlet}. */ @WebServlet(urlPatterns = PROXY) public class ActEvtProxyServlet extends HttpServlet { private static final long serialVersionUID = -1798128019502989930L; private static final Logger logger = LoggerFactory.getLogger(ActEvtProxyServlet.class); @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ProxyRespWrapper wrapped = new ProxyRespWrapper(resp); String ttype = req.getParameter(TEST); RequestDispatcher rd = req.getRequestDispatcher(ParamUtil.getJsp(ttype)); rd.include(req, wrapped); String output = wrapped.getOutput(); req.getSession().setAttribute(ATTRIB_TXT, output); logger.debug("Proxy executed. Output length: " + ((output == null) ? "null" : output.length())); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doGet(req, resp); } private static class ProxyRespWrapper extends HttpServletResponseWrapper { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); public ProxyRespWrapper(HttpServletResponse response) { super(response); } public String getOutput() { pw.flush(); return sw.toString(); } @Override public PrintWriter getWriter() throws IOException { return pw; } } }
[ "neil.griffin.scm@gmail.com" ]
neil.griffin.scm@gmail.com
bbadc04dd7754586faa3507c4cffdb653a6604c9
885faeb6aeab35128890169a303350c3674eda5f
/infer/models/java/src/java/util/AbstractList.java
771ff28106f9d57c9e7a04abf3d767b2cac9c5bd
[ "MIT", "GPL-1.0-or-later" ]
permissive
gatarelib/infer
8ea79e012c7e8e3128fca77b8ef1aa6922b5a360
21145c75c920962b3c2970d1224eca7b6dc8ba8d
refs/heads/master
2020-03-28T20:59:31.248792
2018-09-17T11:01:20
2018-09-17T11:19:32
149,120,550
0
0
MIT
2020-02-13T23:15:43
2018-09-17T12:17:46
OCaml
UTF-8
Java
false
false
1,254
java
/* * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package java.util; import com.facebook.infer.builtins.InferUndefined; // could make List an abstract class directly instead, but that breaks other models public abstract class AbstractList<T> { // need three-value state for unknown (-1), false (0), or true (1) // the reason we can't use a bool is that we want to return either true or false each time we call // isEmpty, and we want to get the same result each time private int mIsEmpty; native T any(); public AbstractList() { mIsEmpty = 1; } public boolean isEmpty() { if (mIsEmpty < 0) { if (InferUndefined.boolean_undefined()) { mIsEmpty = 1; } else { mIsEmpty = 0; } } return mIsEmpty == 1; } public void add(int index, T toAdd) { mIsEmpty = 0; } public T remove(int index) { mIsEmpty = -1; return any(); } public boolean remove(Object o) { boolean result = InferUndefined.boolean_undefined(); if (result) { mIsEmpty = -1; } return result; } public void clear() { mIsEmpty = 1; } }
[ "facebook-github-bot@users.noreply.github.com" ]
facebook-github-bot@users.noreply.github.com
7936fdb4156278776c100996be17707ca3e0687f
c334c14ca8b120670003ff23e59d2d3f22e61e07
/platform-shop/src/main/java/com/platform/service/CommentService.java
8a5380e8eec410e34b4c7a9948ade6b87b1d3b26
[ "Apache-2.0" ]
permissive
SJshenjian/platform
43178b1044c3aac516b26cb27dcf5d3830c662af
c5c0f72179dc7cadc569bff3e37027c91fc3c975
refs/heads/master
2018-11-02T20:43:48.714445
2018-08-25T13:53:12
2018-08-25T13:53:12
142,135,952
1
0
null
null
null
null
UTF-8
Java
false
false
1,380
java
package com.platform.service; import com.platform.entity.CommentEntity; import java.util.List; import java.util.Map; /** * Service接口 * * @author Jian Shen * @email SJshenjian@outlook.com * @date 2017-08-28 17:03:40 */ public interface CommentService { /** * 根据主键查询实体 * * @param id 主键 * @return 实体 */ CommentEntity queryObject(Integer id); /** * 分页查询 * * @param map 参数 * @return list */ List<CommentEntity> queryList(Map<String, Object> map); /** * 分页统计总数 * * @param map 参数 * @return 总数 */ int queryTotal(Map<String, Object> map); /** * 保存实体 * * @param comment 实体 * @return 保存条数 */ int save(CommentEntity comment); /** * 根据主键更新实体 * * @param comment 实体 * @return 更新条数 */ int update(CommentEntity comment); /** * 根据主键删除 * * @param id * @return 删除条数 */ int delete(Integer id); /** * 根据主键批量删除 * * @param ids * @return 删除条数 */ int deleteBatch(Integer[] ids); /** * 修改状态 * * @param comment * @return */ int toggleStatus(CommentEntity comment); }
[ "sjshenjian@outlook.com" ]
sjshenjian@outlook.com
593ff6ef7ab766880105a8c165181892fb7343df
2586f3b8626c14aa53e9f87ac0844689b22a8b48
/src/sun/util/resources/cldr/ext/LocaleNames_da.java
3bb3b19f49112612880b9a87ccebb58830e72b23
[]
no_license
shaoxiongdu/LearningJDK
46fd841471f5d0e2737ebcd3570ef6f018a90ddb
406e4de55d107648ed6497d625239c637227aa66
refs/heads/master
2022-11-12T14:30:01.400708
2022-11-08T13:00:17
2022-11-08T13:00:17
350,005,058
18
11
null
null
null
null
UTF-8
Java
false
false
50,659
java
/* * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * COPYRIGHT AND PERMISSION NOTICE * * Copyright (C) 1991-2016 Unicode, Inc. All rights reserved. * Distributed under the Terms of Use in * http://www.unicode.org/copyright.html. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of the Unicode data files and any associated documentation * (the "Data Files") or Unicode software and any associated documentation * (the "Software") to deal in the Data Files or Software * without restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, and/or sell copies of * the Data Files or Software, and to permit persons to whom the Data Files * or Software are furnished to do so, provided that * (a) this copyright and permission notice appear with all copies * of the Data Files or Software, * (b) this copyright and permission notice appear in associated * documentation, and * (c) there is clear notice in each modified Data File or in the Software * as well as in the documentation associated with the Data File(s) or * Software that the data or software has been modified. * * THE DATA FILES AND SOFTWARE ARE 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 OF THIRD PARTY RIGHTS. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS * NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL * DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THE DATA FILES OR SOFTWARE. * * Except as contained in this notice, the name of a copyright holder * shall not be used in advertising or otherwise to promote the sale, * use or other dealings in these Data Files or Software without prior * written authorization of the copyright holder. */ package sun.util.resources.cldr.ext; import sun.util.resources.OpenListResourceBundle; public class LocaleNames_da extends OpenListResourceBundle { @Override protected final Object[][] getContents() { final String metaValue_ar = "arabisk"; final String metaValue_bn = "bengali"; final String metaValue_bo = "tibetansk"; final String metaValue_el = "gr\u00e6sk"; final String metaValue_gu = "gujarati"; final String metaValue_he = "hebraisk"; final String metaValue_hy = "armensk"; final String metaValue_ja = "japansk"; final String metaValue_jv = "javanesisk"; final String metaValue_ka = "georgisk"; final String metaValue_km = "khmer"; final String metaValue_kn = "kannada"; final String metaValue_ko = "koreansk"; final String metaValue_lo = "lao"; final String metaValue_ml = "malayalam"; final String metaValue_mn = "mongolsk"; final String metaValue_my = "burmesisk"; final String metaValue_or = "oriya"; final String metaValue_si = "singalesisk"; final String metaValue_su = "sundanesisk"; final String metaValue_te = "telugu"; final String metaValue_tl = "tagalog"; final String metaValue_ban = "balinesisk"; final String metaValue_bug = "buginesisk"; final String metaValue_chr = "cherokee"; final String metaValue_cop = "koptisk"; final String metaValue_got = "gotisk"; final String metaValue_kpe = "kpelle"; final String metaValue_men = "mende"; final String metaValue_pal = "pahlavi"; final String metaValue_peo = "oldpersisk"; final String metaValue_phn = "f\u00f8nikisk"; final String metaValue_ssy = "saho"; final String metaValue_syr = "syrisk"; final String metaValue_vai = "vai"; final String metaValue_zbl = "blissymboler"; final Object[][] data = new Object[][] { { "ksh", "k\u00f6lsch" }, { "Ogam", "ogham" }, { "mwl", "mirandesisk" }, { "Zsym", "symboler" }, { "cch", "atsam" }, { "mwr", "marwari" }, { "type.nu.lanatham", "Tai Tham Tahm-tal" }, { "Tagb", "tagbanwa" }, { "Zsye", "emoji" }, { "%%NJIVA", "Gniva-/Nijva-dialekt" }, { "egy", "oldegyptisk" }, { "raj", "rajasthani" }, { "Phag", "phags-pa" }, { "tem", "temne" }, { "teo", "teso" }, { "rap", "rapanui" }, { "ter", "tereno" }, { "AC", "Ascension\u00f8en" }, { "rar", "rarotonga" }, { "tet", "tetum" }, { "AD", "Andorra" }, { "AE", "De Forenede Arabiske Emirater" }, { "nl_BE", "flamsk" }, { "AF", "Afghanistan" }, { "AG", "Antigua og Barbuda" }, { "type.ca.ethiopic", "etiopisk kalender" }, { "AI", "Anguilla" }, { "key.tz", "Tidszone" }, { "AL", "Albanien" }, { "AM", "Armenien" }, { "Teng", "tengwar" }, { "AO", "Angola" }, { "AQ", "Antarktis" }, { "AR", "Argentina" }, { "Prti", "prti" }, { "AS", "Amerikansk Samoa" }, { "AT", "\u00d8strig" }, { "AU", "Australien" }, { "AW", "Aruba" }, { "en_US", "amerikansk engelsk" }, { "AX", "\u00c5land" }, { "mye", "myene" }, { "AZ", "Aserbajdsjan" }, { "%%AREVELA", "\u00f8starmensk" }, { "BA", "Bosnien-Hercegovina" }, { "BB", "Barbados" }, { "ceb", "cebuano" }, { "BD", "Bangladesh" }, { "kum", "kymyk" }, { "BE", "Belgien" }, { "gmh", "middelh\u00f8jtysk" }, { "BF", "Burkina Faso" }, { "BG", "Bulgarien" }, { "BH", "Bahrain" }, { "BI", "Burundi" }, { "BJ", "Benin" }, { "BL", "Saint Barth\u00e9lemy" }, { "BM", "Bermuda" }, { "kut", "kutenaj" }, { "myv", "erzya" }, { "BN", "Brunei" }, { "BO", "Bolivia" }, { "BQ", "De tidligere Nederlandske Antiller" }, { "BR", "Brasilien" }, { "BS", "Bahamas" }, { "xog", "soga" }, { "BT", "Bhutan" }, { "BV", "Bouvet\u00f8en" }, { "BW", "Botswana" }, { "BY", "Hviderusland" }, { "BZ", "Belize" }, { "Visp", "synlig tale" }, { "type.ca.persian", "persisk kalender" }, { "type.nu.hebr", "hebr\u00e6iske tal" }, { "CA", "Canada" }, { "CC", "Cocos\u00f8erne" }, { "mzn", "mazenisk" }, { "CD", "Congo-Kinshasa" }, { "CF", "Den Centralafrikanske Republik" }, { "CG", "Congo-Brazzaville" }, { "CH", "Schweiz" }, { "CI", "Elfenbenskysten" }, { "CK", "Cook\u00f8erne" }, { "CL", "Chile" }, { "Kthi", "kthi" }, { "CM", "Cameroun" }, { "CN", "Kina" }, { "CO", "Colombia" }, { "CP", "Clipperton\u00f8en" }, { "CR", "Costa Rica" }, { "CU", "Cuba" }, { "CV", "Kap Verde" }, { "CW", "Cura\u00e7ao" }, { "CX", "Jule\u00f8en" }, { "CY", "Cypern" }, { "type.nu.bali", "Balinesiske tal" }, { "CZ", "Tjekkiet" }, { "eka", "ekajuk" }, { "%%RIGIK", "klassisk volap\u00fck" }, { "DE", "Tyskland" }, { "goh", "oldh\u00f8jtysk" }, { "ace", "achinesisk" }, { "cgg", "chiga" }, { "DG", "Diego Garcia" }, { "type.nu.deva", "devanagariske tal" }, { "DJ", "Djibouti" }, { "DK", "Danmark" }, { "ach", "acoli" }, { "gon", "gondi" }, { "Brai", "punktskrift" }, { "Brah", "bramisk" }, { "DM", "Dominica" }, { "type.nu.armnlow", "armenske tal i sm\u00e5 bogstaver" }, { "DO", "Den Dominikanske Republik" }, { "gor", "gorontalo" }, { "got", metaValue_got }, { "Mtei", "meitei-mayek" }, { "zun", "zuni" }, { "tig", "tigre" }, { "Takr", "takri" }, { "DZ", "Algeriet" }, { "pag", "pangasinan" }, { "type.d0.hwidth", "halv bredde" }, { "pal", metaValue_pal }, { "EA", "Ceuta og Melilla" }, { "chb", "chibcha" }, { "pam", "pampanga" }, { "EC", "Ecuador" }, { "pap", "papiamento" }, { "ada", "adangme" }, { "EE", "Estland" }, { "tiv", "tivi" }, { "EG", "Egypten" }, { "EH", "Vestsahara" }, { "chg", "chagatai" }, { "pau", "palauansk" }, { "chk", "chuukese" }, { "chn", "chinook" }, { "chm", "mari" }, { "chp", "chipewyan" }, { "cho", "choctaw" }, { "chr", metaValue_chr }, { "ER", "Eritrea" }, { "ES", "Spanien" }, { "ET", "Etiopien" }, { "EU", "Den Europ\u00e6iske Union" }, { "elx", "elamitisk" }, { "type.ca.gregorian", "gregoriansk kalender" }, { "EZ", "eurozonen" }, { "chy", "cheyenne" }, { "type.nu.gujr", "gujarati tal" }, { "Inds", "indus" }, { "ady", "adyghe" }, { "FI", "Finland" }, { "FJ", "Fiji" }, { "FK", "Falklands\u00f8erne" }, { "FM", "Mikronesien" }, { "key.va", "Sprogvariant" }, { "FO", "F\u00e6r\u00f8erne" }, { "Taml", "tamilsk" }, { "FR", "Frankrig" }, { "Kpel", metaValue_kpe }, { "tkl", "tokelau" }, { "grb", "grebo" }, { "root", "rod" }, { "%%DAJNKO", "Dajnko-alfabet" }, { "type.ca.indian", "indisk nationalkalender" }, { "grc", "oldgr\u00e6sk" }, { "GA", "Gabon" }, { "vot", "votisk" }, { "GB", "Storbritannien" }, { "pcm", "nigeriansk pidgin" }, { "GD", "Grenada" }, { "GE", "Georgien" }, { "GF", "Fransk Guyana" }, { "GG", "Guernsey" }, { "GH", "Ghana" }, { "Tale", "tai le" }, { "GI", "Gibraltar" }, { "afh", "afrihili" }, { "GL", "Gr\u00f8nland" }, { "enm", "middelengelsk" }, { "GM", "Gambia" }, { "GN", "Guinea" }, { "GP", "Guadeloupe" }, { "GQ", "\u00c6kvatorialguinea" }, { "GR", "Gr\u00e6kenland" }, { "GS", "South Georgia og De Sydlige Sandwich\u00f8er" }, { "GT", "Guatemala" }, { "GU", "Guam" }, { "GW", "Guinea-Bissau" }, { "tli", "tlingit" }, { "tlh", "klingon" }, { "Talu", "tai lue" }, { "GY", "Guyana" }, { "ckb", "sorani" }, { "zxx", "intet sprogligt indhold" }, { "Jurc", "jurchen" }, { "de_AT", "\u00f8strigsk tysk" }, { "Vaii", metaValue_vai }, { "HK", "SAR Hongkong" }, { "HM", "Heard Island og McDonald Islands" }, { "HN", "Honduras" }, { "HR", "Kroatien" }, { "agq", "aghem" }, { "gsw", "schweizertysk" }, { "type.ca.islamic-umalqura", "islamisk kalender (Umm al-Qura)" }, { "HT", "Haiti" }, { "HU", "Ungarn" }, { "tmh", "tamashek" }, { "IC", "Kanariske \u00f8er" }, { "nan", "min-kinesisk" }, { "peo", metaValue_peo }, { "ID", "Indonesien" }, { "type.nu.kali", "Kayah Li-tal" }, { "IE", "Irland" }, { "nap", "napolitansk" }, { "%%NDYUKA", "Ndyuka-dialekt" }, { "naq", "nama" }, { "type.nu.sora", "Sora Sompeng-tal" }, { "zza", "zaza" }, { "Tang", "tangut" }, { "IL", "Israel" }, { "Nbat", "nabateisk" }, { "IM", "Isle of Man" }, { "IN", "Indien" }, { "type.co.eor", "europ\u00e6isk sorteringsr\u00e6kkef\u00f8lge" }, { "IO", "Det britiske territorium i Det Indiske Ocean" }, { "IQ", "Irak" }, { "IR", "Iran" }, { "IS", "Island" }, { "IT", "Italien" }, { "Zmth", "matematisk notation" }, { "type.nu.thai", "thailandske tal" }, { "%%POSIX", "computer" }, { "type.nu.beng", "bengali tal" }, { "JE", "Jersey" }, { "type.ca.islamic", "islamisk kalender" }, { "Beng", metaValue_bn }, { "JM", "Jamaica" }, { "JO", "Jordan" }, { "JP", "Japan" }, { "%%1606NICT", "sen middelfransk frem til 1606" }, { "ain", "ainu" }, { "Mend", metaValue_men }, { "guz", "gusii" }, { "tog", "nyasa tongansk" }, { "type.nu.knda", "kannada tal" }, { "Kali", "kaya li" }, { "de_CH", "schweizerh\u00f8jtysk" }, { "type.co.phonetic", "fonetisk sorteringsr\u00e6kkef\u00f8lge" }, { "type.ca.buddhist", "buddhistisk kalender" }, { "KE", "Kenya" }, { "419", "Latinamerika" }, { "KG", "Kirgisistan" }, { "KH", "Cambodja" }, { "KI", "Kiribati" }, { "KM", "Comorerne" }, { "Knda", metaValue_kn }, { "KN", "Saint Kitts og Nevis" }, { "Zinh", "arvet" }, { "fr_CA", "canadisk fransk" }, { "KP", "Nordkorea" }, { "KR", "Sydkorea" }, { "Plrd", "pollardtegn" }, { "fr_CH", "schweizisk fransk" }, { "KW", "Kuwait" }, { "tpi", "tok pisin" }, { "KY", "Cayman\u00f8erne" }, { "KZ", "Kasakhstan" }, { "Cyrl", "kyrillisk" }, { "LA", "Laos" }, { "LB", "Libanon" }, { "phn", metaValue_phn }, { "LC", "Saint Lucia" }, { "Cyrs", "kyrillisk - oldkirkeslavisk variant" }, { "gwi", "gwichin" }, { "nds", "nedertysk" }, { "LI", "Liechtenstein" }, { "LK", "Sri Lanka" }, { "akk", "akkadisk" }, { "cop", metaValue_cop }, { "LR", "Liberia" }, { "Phlv", metaValue_pal }, { "LS", "Lesotho" }, { "LT", "Litauen" }, { "LU", "Luxembourg" }, { "LV", "Letland" }, { "Kana", "katakana" }, { "Sora", "sora" }, { "LY", "Libyen" }, { "lad", "ladino" }, { "vun", "vunjo" }, { "%%LAUKIKA", "laukika" }, { "lah", "lahnda" }, { "lag", "langi" }, { "Thaa", "thaana" }, { "MA", "Marokko" }, { "MC", "Monaco" }, { "MD", "Moldova" }, { "Nshu", "n\u00fcshu" }, { "ME", "Montenegro" }, { "MF", "Saint Martin" }, { "lam", "lamba" }, { "MG", "Madagaskar" }, { "MH", "Marshall\u00f8erne" }, { "ale", "aleutisk" }, { "Thai", "thailandsk" }, { "type.nu.vaii", "Vai-tal" }, { "MK", "Makedonien" }, { "ML", "Mali" }, { "MM", "Myanmar (Burma)" }, { "MN", "Mongoliet" }, { "new", "newari" }, { "MO", "SAR Macao" }, { "MP", "Nordmarianerne" }, { "MQ", "Martinique" }, { "MR", "Mauretanien" }, { "MS", "Montserrat" }, { "MT", "Malta" }, { "type.m0.ungegn", "UNGEGN" }, { "MU", "Mauritius" }, { "alt", "sydaltaisk" }, { "MV", "Maldiverne" }, { "MW", "Malawi" }, { "MX", "Mexico" }, { "type.ca.japanese", "japansk kalender" }, { "MY", "Malaysia" }, { "MZ", "Mozambique" }, { "Phli", "phli" }, { "NA", "Namibia" }, { "202", "Afrika syd for Sahara" }, { "type.ca.hebrew", "j\u00f8disk kalender" }, { "type.co.dictionary", "sorteringsr\u00e6kkef\u00f8lge for ordbog" }, { "NC", "Ny Kaledonien" }, { "%%WADEGILE", "Wade-Giles" }, { "%%UCRCOR", "forenet revideret ortografi" }, { "NE", "Niger" }, { "NF", "Norfolk Island" }, { "NG", "Nigeria" }, { "trv", "taroko" }, { "Phlp", "phlp" }, { "NI", "Nicaragua" }, { "Hmng", "pahawh hmong" }, { "NL", "Holland" }, { "NO", "Norge" }, { "NP", "Nepal" }, { "NR", "Nauru" }, { "Phnx", metaValue_phn }, { "NU", "Niue" }, { "rof", "rombo" }, { "tsi", "tsimshisk" }, { "NZ", "New Zealand" }, { "Merc", "metroitisk sammenh\u00e6ngende" }, { "rom", "romani" }, { "Mero", "meroitisk" }, { "crh", "krim-tyrkisk" }, { "ang", "oldengelsk" }, { "OM", "Oman" }, { "anp", "angika" }, { "crs", "seselwa (kreol-fransk)" }, { "Xpeo", metaValue_peo }, { "PA", "Panama" }, { "type.ca.islamic-civil", "verdslig islamisk kalender" }, { "csb", "kasjubisk" }, { "en_GB", "britisk engelsk" }, { "PE", "Peru" }, { "PF", "Fransk Polynesien" }, { "PG", "Papua Ny Guinea" }, { "PH", "Filippinerne" }, { "PK", "Pakistan" }, { "PL", "Polen" }, { "ewo", "ewondo" }, { "PM", "Saint Pierre og Miquelon" }, { "PN", "Pitcairn" }, { "PR", "Puerto Rico" }, { "Bali", metaValue_ban }, { "PS", "De pal\u00e6stinensiske omr\u00e5der" }, { "PT", "Portugal" }, { "PW", "Palau" }, { "nia", "nias" }, { "type.nu.greklow", "gr\u00e6ske tal i sm\u00e5 bogstaver" }, { "PY", "Paraguay" }, { "tum", "tumbuka" }, { "Hebr", metaValue_he }, { "QA", "Qatar" }, { "%%SCOTLAND", "skotsk standardengelsk" }, { "niu", "niueansk" }, { "QO", "Ydre Oceanien" }, { "lez", "lezghian" }, { "%%FONUPA", "det uraliske fonetiske alfabet" }, { "type.nu.takr", "Takri-tal" }, { "tvl", "tuvaluansk" }, { "Tavt", "tavt" }, { "001", "Verden" }, { "002", "Afrika" }, { "003", "Nordamerika" }, { "RE", "R\u00e9union" }, { "005", "Sydamerika" }, { "jbo", "lojban" }, { "Rjng", "rejang" }, { "009", "Oceanien" }, { "%%SURSILV", "sursilv" }, { "RO", "Rum\u00e6nien" }, { "RS", "Serbien" }, { "Mroo", "mroo" }, { "RU", "Rusland" }, { "RW", "Rwanda" }, { "type.nu.talu", "Nye Tai Lue-tal" }, { "%%METELKO", "Metelko-alfabet" }, { "Mani", "manik\u00e6isk" }, { "Ugar", "ugaritisk" }, { "Khar", "kharoshti" }, { "SA", "Saudi-Arabien" }, { "pon", "ponape" }, { "Mand", "mandaisk" }, { "SB", "Salomon\u00f8erne" }, { "twq", "tasawaq" }, { "011", "Vestafrika" }, { "SC", "Seychellerne" }, { "SD", "Sudan" }, { "013", "Mellemamerika" }, { "SE", "Sverige" }, { "014", "\u00d8stafrika" }, { "arc", "aram\u00e6isk" }, { "Loma", "loma" }, { "015", "Nordafrika" }, { "SG", "Singapore" }, { "SH", "St. Helena" }, { "type.lb.strict", "h\u00e5rdt linjeskift" }, { "017", "Centralafrika" }, { "SI", "Slovenien" }, { "018", "Det sydlige Afrika" }, { "SJ", "Svalbard og Jan Mayen" }, { "019", "Amerika" }, { "SK", "Slovakiet" }, { "Bamu", "bamum" }, { "Wole", "woleai" }, { "SL", "Sierra Leone" }, { "SM", "San Marino" }, { "SN", "Senegal" }, { "SO", "Somalia" }, { "arn", "mapudungun" }, { "arp", "arapaho" }, { "type.nu.taml", "traditionelle tamilske tal" }, { "SR", "Surinam" }, { "SS", "Sydsudan" }, { "ST", "S\u00e3o Tom\u00e9 og Pr\u00edncipe" }, { "SV", "El Salvador" }, { "ars", "najd-arabisk" }, { "SX", "Sint Maarten" }, { "SY", "Syrien" }, { "yao", "yao" }, { "SZ", "Swaziland" }, { "arw", "arawak" }, { "yap", "yapese" }, { "TA", "Tristan da Cunha" }, { "asa", "asu" }, { "type.ms.ussystem", "amerikansk m\u00e5lesystem" }, { "021", "Det nordlige Amerika" }, { "TC", "Turks- og Caicos\u00f8erne" }, { "yav", "yangben" }, { "TD", "Tchad" }, { "TF", "De franske besiddelser i Det Sydlige Indiske Ocean" }, { "TG", "Togo" }, { "TH", "Thailand" }, { "TJ", "Tadsjikistan" }, { "029", "Caribien" }, { "TK", "Tokelau" }, { "TL", "Timor-Leste" }, { "ybb", "yemba" }, { "type.co.searchjl", "sort\u00e9r efter den f\u00f8rste konsonant i hangul" }, { "TM", "Turkmenistan" }, { "%%BOONT", "boontling" }, { "TN", "Tunesien" }, { "TO", "Tonga" }, { "%%NULIK", "moderne volap\u00fck" }, { "TR", "Tyrkiet" }, { "TT", "Trinidad og Tobago" }, { "TV", "Tuvalu" }, { "TW", "Taiwan" }, { "ast", "asturisk" }, { "Orkh", "orkhon" }, { "TZ", "Tanzania" }, { "nmg", "kwasio" }, { "Zzzz", "ukendt skriftsprog" }, { "Sind", "khudawadi" }, { "UA", "Ukraine" }, { "rup", "arum\u00e6nsk" }, { "030", "\u00d8stasien" }, { "tyv", "tuvinian" }, { "sw_CD", "congolesisk swahili" }, { "034", "Sydasien" }, { "hai", "haida" }, { "035", "Syd\u00f8stasien" }, { "UG", "Uganda" }, { "hak", "hakka-kinesisk" }, { "type.co.pinyin", "pinyin-baseret sorteringsr\u00e6kkef\u00f8lge" }, { "039", "Sydeuropa" }, { "Sinh", metaValue_si }, { "UM", "Amerikanske overs\u00f8iske \u00f8er" }, { "UN", "De Forenede Nationer" }, { "US", "USA" }, { "haw", "hawaiiansk" }, { "%%1959ACAD", "akademisk" }, { "type.co.gb2312han", "sorteringsr\u00e6kkef\u00f8lge forkortet kinesisk - GB2312" }, { "UY", "Uruguay" }, { "prg", "preussisk" }, { "UZ", "Usbekistan" }, { "tzm", "centralmarokkansk tamazight" }, { "type.co.stroke", "stregbaseret sorteringsr\u00e6kkef\u00f8lge" }, { "nnh", "ngiemboon" }, { "VA", "Vatikanstaten" }, { "pro", "oldprovencalsk" }, { "VC", "Saint Vincent og Grenadinerne" }, { "VE", "Venezuela" }, { "VG", "De Britiske Jomfru\u00f8er" }, { "VI", "De Amerikanske Jomfru\u00f8er" }, { "VN", "Vietnam" }, { "VU", "Vanuatu" }, { "nog", "nogai" }, { "rwk", "rwa" }, { "non", "oldislandsk" }, { "053", "Australasien" }, { "%%AREVMDA", "vestarmensk" }, { "054", "Melanesien" }, { "WF", "Wallis og Futuna" }, { "type.co.traditional", "traditionel sorteringsr\u00e6kkef\u00f8lge" }, { "057", "Mikronesiske omr\u00e5de" }, { "jgo", "ngomba" }, { "lkt", "lakota" }, { "type.nu.finance", "Finansielle tal" }, { "%%HEPBURN", "Hepburn-romanisering" }, { "type.co.compat", "tidligere sorteringsr\u00e6kkef\u00f8lge, kompatibilitet" }, { "wae", "walsertysk" }, { "WS", "Samoa" }, { "Bass", "bassa" }, { "type.nu.mtei", "Meetei Mayek-tal" }, { "wal", "walamo" }, { "was", "washo" }, { "war", "waray" }, { "awa", "awadhi" }, { "061", "Polynesien" }, { "%%KSCOR", "standardortografi" }, { "XK", "Kosovo" }, { "type.nu.brah", "Brahmi-tal" }, { "Gujr", metaValue_gu }, { "Zxxx", "uden skriftsprog" }, { "Olck", "ol-chiki" }, { "wbp", "walbiri" }, { "Batk", "batak" }, { "Blis", metaValue_zbl }, { "YE", "Yemen" }, { "nqo", "n-ko" }, { "type.co.standard", "standardsorteringsr\u00e6kkef\u00f8lge" }, { "fan", "fang" }, { "%%ROZAJ", "Resi" }, { "%%SUTSILV", "sutsilv" }, { "fat", "fanti" }, { "Sgnw", "tegnskrift" }, { "YT", "Mayotte" }, { "type.nu.cham", "Cham-tal" }, { "ZA", "Sydafrika" }, { "type.nu.sund", "Sundanesiske tal" }, { "type.lb.loose", "l\u00f8st linjeskift" }, { "Deva", "devanagari" }, { "type.nu.geor", "georgiske tal" }, { "type.co.zhuyin", "zhuyin-sorteringsr\u00e6kkef\u00f8lge" }, { "Hira", "hiragana" }, { "ZM", "Zambia" }, { "%%PINYIN", "pinyin" }, { "ZW", "Zimbabwe" }, { "ZZ", "Ukendt omr\u00e5de" }, { "Runr", "runer" }, { "type.ms.metric", "metersystem" }, { "type.ca.iso8601", "ISO-8601-kalender" }, { "lol", "mongo" }, { "nso", "nordsotho" }, { "type.nu.telu", "telugu-tal" }, { "lou", "Louisiana-kreolsk" }, { "loz", "lozi" }, { "Nkgb", "nakhi geba" }, { "jmc", "machame" }, { "type.nu.hansfin", "forenklede kinesiske finansielle tal" }, { "hil", "hiligaynon" }, { "type.nu.arabext", "udvidede hindu-arabiske tal" }, { "nus", "nuer" }, { "dak", "dakota" }, { "type.nu.fullwide", "tal i fuld bredde" }, { "hit", "hittitisk" }, { "dar", "dargwa" }, { "dav", "taita" }, { "Maya", "mayahieroglyffer" }, { "lrc", "nordluri" }, { "Copt", metaValue_cop }, { "nwc", "klassisk newarisk" }, { "udm", "udmurt" }, { "Khmr", metaValue_km }, { "type.ca.islamic-rgsa", "islamisk kalender (Saudi-Arabien, observation)" }, { "Limb", "limbu" }, { "sad", "sandawe" }, { "type.nu.roman", "romertal" }, { "sah", "yakut" }, { "type.nu.shrd", "Sharada-tal" }, { "sam", "samaritansk aram\u00e6isk" }, { "%%SCOUSE", "scouse" }, { "saq", "samburu" }, { "sas", "sasak" }, { "sat", "santali" }, { "Tfng", "tifinagh" }, { "jpr", "j\u00f8disk-persisk" }, { "type.d0.npinyin", "Numerisk" }, { "type.nu.native", "Nationale cifre" }, { "sba", "ngambay" }, { "Guru", "gurmukhi" }, { "%%ALUKU", "aluku-dialekt" }, { "lua", "luba-Lulua" }, { "%%BISCAYAN", "biscayisk" }, { "type.d0.fwidth", "fuld bredde" }, { "sbp", "sangu" }, { "lui", "luiseno" }, { "nyn", "nyankole" }, { "nym", "nyamwezi" }, { "lun", "lunda" }, { "nyo", "nyoro-sprog" }, { "luo", "luo" }, { "fil", "filippinsk" }, { "hmn", "hmong" }, { "del", "delaware" }, { "lus", "lushai" }, { "bal", "baluchi" }, { "den", "athapaskisk" }, { "ban", metaValue_ban }, { "uga", "ugaristisk" }, { "luy", "luyana" }, { "bas", "basaa" }, { "bax", "bamun" }, { "jrb", "j\u00f8disk-arabisk" }, { "es_ES", "europ\u00e6isk spansk" }, { "nzi", "nzima" }, { "sco", "skotsk" }, { "scn", "siciliansk" }, { "aa", "afar" }, { "ab", "abkhasisk" }, { "ae", "avestan" }, { "af", "afrikaans" }, { "ak", "akan" }, { "type.nu.cakm", "Chakma-tal" }, { "bbj", "ghomala" }, { "am", "amharisk" }, { "Arab", metaValue_ar }, { "an", "aragonesisk" }, { "Jpan", metaValue_ja }, { "ar", metaValue_ar }, { "Hrkt", "japanske skrifttegn" }, { "as", "assamesisk" }, { "Lina", "line\u00e6r A" }, { "av", "avarisk" }, { "Linb", "line\u00e6r B" }, { "sdh", "sydkurdisk" }, { "ay", "aymara" }, { "az", "aserbajdsjansk" }, { "Khoj", "khojki" }, { "%%OSOJS", "Oseacco-/Osojane-dialekt" }, { "ba", "bashkir" }, { "type.co.unihan", "sortering efter streger i rodtegn" }, { "be", "hviderussisk" }, { "bg", "bulgarsk" }, { "bi", "bislama" }, { "type.nu.java", "Javanesiske tal" }, { "bm", "bambara" }, { "bn", metaValue_bn }, { "bo", metaValue_bo }, { "dgr", "dogrib" }, { "br", "bretonsk" }, { "bs", "bosnisk" }, { "see", "seneca" }, { "Mymr", metaValue_my }, { "type.nu.laoo", "laotiske tal" }, { "seh", "sena" }, { "Nkoo", "n\u2019ko" }, { "sel", "selkupisk" }, { "ca", "catalansk" }, { "ses", "koyraboro senni" }, { "ce", "tjetjensk" }, { "ch", "chamorro" }, { "%%REVISED", "revideret retskrivning" }, { "co", "korsikansk" }, { "Orya", metaValue_or }, { "cr", "cree" }, { "cs", "tjekkisk" }, { "cu", "kirkeslavisk" }, { "cv", "chuvash" }, { "cy", "walisisk" }, { "type.nu.ethi", "etiopiske tal" }, { "Yiii", "yi" }, { "da", "dansk" }, { "pt_PT", "europ\u00e6isk portugisisk" }, { "de", "tysk" }, { "type.cf.standard", "format for standardvaluta" }, { "bej", "beja" }, { "din", "dinka" }, { "Bugi", metaValue_bug }, { "bem", "bemba" }, { "sga", "oldirsk" }, { "type.nu.mong", "Mongolske tal" }, { "dv", "divehi" }, { "es_419", "latinamerikansk spansk" }, { "dz", "dzongkha" }, { "bez", "bena" }, { "type.ca.chinese", "kinesisk kalender" }, { "Lisu", "lisu" }, { "dje", "zarma" }, { "type.nu.grek", "gr\u00e6ske tal" }, { "ee", "ewe" }, { "bfd", "bafut" }, { "type.lb.normal", "normalt linjeskift" }, { "ro_MD", "moldovisk" }, { "el", metaValue_el }, { "en", "engelsk" }, { "eo", "esperanto" }, { "type.co.big5han", "sorteringsr\u00e6kkef\u00f8lge uforkortet kinesisk - Big5" }, { "es", "spansk" }, { "et", "estisk" }, { "Hanb", "han med bopomofo" }, { "eu", "baskisk" }, { "Buhd", "buhid" }, { "Hang", "hangul" }, { "Samr", "samaritansk" }, { "shi", "tachelhit" }, { "hsb", "\u00f8vresorbisk" }, { "Hani", "han" }, { "%%ULSTER", "ulster" }, { "shn", "shan" }, { "Hano", "hanunoo" }, { "fa", "persisk" }, { "Hans", "forenklet" }, { "type.nu.latn", "arabertal" }, { "Hant", "traditionelt" }, { "ff", "fulah" }, { "shu", "tchadisk arabisk" }, { "hsn", "xiang-kinesisk" }, { "fi", "finsk" }, { "fj", "fijiansk" }, { "fon", "fon" }, { "bgn", "vestbaluchi" }, { "yue", "kantonesisk" }, { "fo", "f\u00e6r\u00f8sk" }, { "type.m0.bgn", "BGN" }, { "umb", "umbundu" }, { "fr", "fransk" }, { "sid", "sidamo" }, { "fy", "frisisk" }, { "ga", "irsk" }, { "gd", "skotsk g\u00e6lisk" }, { "gl", "galicisk" }, { "gn", "guarani" }, { "bho", "bhojpuri" }, { "und", "ukendt sprog" }, { "type.ca.ethiopic-amete-alem", "etiopisk amete-alem-kalender" }, { "gu", metaValue_gu }, { "type.ca.islamic-tbla", "islamisk kalender (tabellarisk, astronomisk epoke)" }, { "gv", "manx" }, { "type.nu.osma", "Osmanya-tal" }, { "ha", "hausa" }, { "he", metaValue_he }, { "hi", "hindi" }, { "hup", "hupa" }, { "bik", "bikol" }, { "bin", "bini" }, { "ho", "hirimotu" }, { "hr", "kroatisk" }, { "ht", "haitisk" }, { "hu", "ungarsk" }, { "hy", metaValue_hy }, { "hz", "herero" }, { "frc", "cajunfransk" }, { "%%FONIPA", "det internationale fonetiske alfabet" }, { "ia", "interlingua" }, { "Jamo", "jamo" }, { "id", "indonesisk" }, { "type.nu.tibt", "tibetanske tal" }, { "ie", "interlingue" }, { "ig", "igbo" }, { "ii", "sichuan yi" }, { "frm", "middelfransk" }, { "ik", "inupiaq" }, { "fro", "oldfransk" }, { "io", "ido" }, { "frs", "\u00f8stfrisisk" }, { "frr", "nordfrisisk" }, { "is", "islandsk" }, { "it", "italiensk" }, { "iu", "inuktitut" }, { "%%HOGNORSK", "h\u00f8gnorsk" }, { "ja", metaValue_ja }, { "Mlym", metaValue_ml }, { "Sarb", "olds\u00f8rarabisk" }, { "Sara", "sarati" }, { "doi", "dogri" }, { "type.nu.lepc", "Lepcha-tal" }, { "bkm", "kom" }, { "sma", "sydsamisk" }, { "jv", metaValue_jv }, { "Shaw", "shavisk" }, { "%%BAUDDHA", "bauddha" }, { "mad", "madurese" }, { "smj", "lulesamisk" }, { "mag", "magahi" }, { "maf", "mafa" }, { "mai", "maithili" }, { "smn", "enaresamisk" }, { "ka", metaValue_ka }, { "bla", "siksika" }, { "mak", "makasar" }, { "wuu", "wu-kinesisk" }, { "sms", "skoltesamisk" }, { "man", "mandingo" }, { "kg", "kongo" }, { "Goth", metaValue_got }, { "ki", "kikuyu" }, { "mas", "masai" }, { "kj", "kuanyama" }, { "kk", "kasakhisk" }, { "kl", "gr\u00f8nlandsk" }, { "km", metaValue_km }, { "kn", metaValue_kn }, { "ko", metaValue_ko }, { "kr", "kanuri" }, { "ks", "kashmiri" }, { "Cirt", "cirt" }, { "Lepc", "lepcha" }, { "Avst", "avestansk" }, { "ku", "kurdisk" }, { "kv", "komi" }, { "kw", "cornisk" }, { "ky", "kirgisisk" }, { "snk", "soninke" }, { "la", "latin" }, { "lb", "luxembourgsk" }, { "type.nu.mlym", "malayalamske tal" }, { "lg", "ganda" }, { "Roro", "rongo-rongo" }, { "li", "limburgsk" }, { "Tibt", metaValue_bo }, { "ln", "lingala" }, { "fur", "friulian" }, { "lo", metaValue_lo }, { "type.ms.uksystem", "britisk m\u00e5lesystem" }, { "type.nu.lana", "Tai Tham Hora-tal" }, { "lt", "litauisk" }, { "lu", "luba-Katanga" }, { "lv", "lettisk" }, { "sog", "sogdiansk" }, { "mg", "malagassisk" }, { "mh", "marshallese" }, { "type.co.ducet", "Unicode-standardsortering" }, { "mi", "maori" }, { "mk", "makedonsk" }, { "ml", metaValue_ml }, { "mn", metaValue_mn }, { "mr", "marathisk" }, { "ms", "malajisk" }, { "mt", "maltesisk" }, { "my", metaValue_my }, { "Saur", "saurashtra" }, { "Armn", metaValue_hy }, { "mdf", "moksha" }, { "mde", "maba" }, { "dsb", "nedersorbisk" }, { "Armi", "armi" }, { "na", "nauru" }, { "type.co.search", "generel s\u00f8gning" }, { "nb", "norsk bokm\u00e5l" }, { "nd", "nordndebele" }, { "ne", "nepalesisk" }, { "ng", "ndonga" }, { "mdr", "mandar" }, { "nl", "hollandsk" }, { "nn", "nynorsk" }, { "no", "norsk" }, { "nr", "sydndebele" }, { "nv", "navajo" }, { "kaa", "karakalpakisk" }, { "ny", "nyanja" }, { "kac", "kachin" }, { "kab", "kabylisk" }, { "%%POLYTON", "polytonisk" }, { "oc", "occitansk" }, { "kaj", "jju" }, { "kam", "kamba" }, { "men", metaValue_men }, { "%%EMODENG", "tidlig moderne engelsk" }, { "oj", "ojibwa" }, { "mer", "meru" }, { "type.nu.armn", "armenske tal" }, { "om", "oromo" }, { "kaw", "kawi" }, { "or", metaValue_or }, { "os", "ossetisk" }, { "%%ALALC97", "ALA-LC-romanisering fra 1997" }, { "kbd", "kabardian" }, { "mfe", "morisyen" }, { "srn", "sranan tongo" }, { "pa", "punjabisk" }, { "dua", "duala" }, { "srr", "serer" }, { "%%LIPAW", "lipovaz" }, { "kbl", "kanembu" }, { "pi", "pali" }, { "pl", "polsk" }, { "dum", "middelhollandsk" }, { "type.nu.saur", "Saurashtra-tal" }, { "type.ca.dangi", "dangi-kalender" }, { "%%VALLADER", "vallader" }, { "ps", "pashto" }, { "pt", "portugisisk" }, { "mga", "middelirsk" }, { "key.co", "sorteringsr\u00e6kkef\u00f8lge" }, { "pt_BR", "brasiliansk portugisisk" }, { "%%BOHORIC", "Bohori\u010d-alfabet" }, { "kcg", "tyap" }, { "mgh", "makhuwa-meetto" }, { "key.cf", "valutaformat" }, { "type.nu.nkoo", "N\u2019Ko-tal" }, { "bra", "braj" }, { "key.ca", "kalender" }, { "%%JAUER", "jauer" }, { "Laoo", metaValue_lo }, { "%%SURMIRAN", "surmiran" }, { "mgo", "meta" }, { "type.hc.h23", "24-timersur (0-23)" }, { "type.hc.h24", "24-timersur (1-24)" }, { "ssy", metaValue_ssy }, { "type.nu.mymr", "Myanmar tal" }, { "qu", "quechua" }, { "zap", "zapotec" }, { "brx", "bodo" }, { "Lana", "lanna" }, { "kde", "makonde" }, { "%%VAIDIKA", "vaidika" }, { "Ethi", "etiopisk" }, { "%%JYUTPING", "jyutping" }, { "type.hc.h12", "12-timersur (1-12)" }, { "type.hc.h11", "12-timersur (0-11)" }, { "rm", "r\u00e6toromansk" }, { "rn", "rundi" }, { "key.cu", "valuta" }, { "ro", "rum\u00e6nsk" }, { "%%SAAHO", metaValue_ssy }, { "type.nu.orya", "Oriya tal" }, { "type.nu.hanidec", "kinesiske decimaltal" }, { "ru", "russisk" }, { "bss", "bakossi" }, { "zbl", metaValue_zbl }, { "rw", "kinyarwanda" }, { "kea", "kapverdisk" }, { "mic", "micmac" }, { "suk", "sukuma" }, { "en_AU", "australsk engelsk" }, { "Dupl", "Duploya-stenografi" }, { "sa", "sanskrit" }, { "%%UCCOR", "forenet ortografi" }, { "sc", "sardinsk" }, { "sus", "susu" }, { "sd", "sindhi" }, { "se", "nordsamisk" }, { "min", "minangkabau" }, { "sg", "sango" }, { "sh", "serbokroatisk" }, { "si", metaValue_si }, { "sux", "sumerisk" }, { "sk", "slovakisk" }, { "sl", "slovensk" }, { "Gran", "grantha" }, { "sm", "samoansk" }, { "sn", "shona" }, { "so", "somali" }, { "type.nu.arab", "hindu-arabiske tal" }, { "sq", "albansk" }, { "sr", "serbisk" }, { "ss", "swati" }, { "type.cf.account", "format for regnskabsvaluta" }, { "Java", metaValue_jv }, { "st", "sydsotho" }, { "su", metaValue_su }, { "%%NEDIS", "Natisone-dialekt" }, { "sv", "svensk" }, { "sw", "swahili" }, { "type.nu.hantfin", "traditionelle kinesiske finansielle tal" }, { "ibb", "ibibio" }, { "iba", "iban" }, { "ta", "tamil" }, { "142", "Asien" }, { "bua", "buriatisk" }, { "143", "Centralasien" }, { "te", metaValue_te }, { "145", "Vestasien" }, { "tg", "tadsjikisk" }, { "th", "thai" }, { "bug", metaValue_bug }, { "ti", "tigrinya" }, { "kfo", "koro" }, { "en_CA", "canadisk engelsk" }, { "tk", "turkmensk" }, { "tl", metaValue_tl }, { "tn", "tswana" }, { "to", "tongansk" }, { "bum", "bulu" }, { "dyo", "jola-fonyi" }, { "type.nu.jpan", "japanske tal" }, { "tr", "tyrkisk" }, { "ts", "tsonga" }, { "swb", "shimaore" }, { "Cakm", "cakm" }, { "tt", "tatarisk" }, { "dyu", "dyula" }, { "tw", "twi" }, { "ty", "tahitiansk" }, { "%%BISKE", "San Giorgio-/Bila-dialekt" }, { "150", "Europa" }, { "151", "\u00d8steuropa" }, { "154", "Nordeuropa" }, { "dzg", "dazaga" }, { "155", "Vesteuropa" }, { "ug", "uygurisk" }, { "Kore", metaValue_ko }, { "Ital", "Olditalisk" }, { "Zyyy", "f\u00e6lles" }, { "uk", "ukrainsk" }, { "type.ca.coptic", "koptisk kalender" }, { "ur", "urdu" }, { "%%1994", "standardiseret Resi-ortografi" }, { "xal", "kalmyk" }, { "zen", "zenaga" }, { "uz", "usbekisk" }, { "kha", "khasi" }, { "%%1996", "tysk retskrivning fra 1996" }, { "Sylo", "syloti nagri" }, { "ve", "venda" }, { "Wara", "varang kshiti" }, { "type.ca.roc", "kalender for Republikken Kina" }, { "vi", "vietnamesisk" }, { "kho", "khotanesisk" }, { "khq", "koyra-chiini" }, { "key.hc", "timeur (12 vs. 24)" }, { "%%TARASK", "Taraskievica-ortografi" }, { "vo", "volapyk" }, { "syc", "klassisk syrisk" }, { "Osma", "osmannisk" }, { "quc", "quich\u00e9" }, { "gaa", "ga" }, { "wa", "vallonsk" }, { "gag", "gagauzisk" }, { "syr", metaValue_syr }, { "Grek", metaValue_el }, { "gan", "gan-kinesisk" }, { "Lydi", "lydisk" }, { "Xsux", "sumero-akkadisk cuneiform" }, { "wo", "wolof" }, { "zgh", "tamazight" }, { "ar_001", "moderne standardarabisk" }, { "Cans", "oprindelige canadiske symboler" }, { "%%FONXSAMP", "fonxsamp" }, { "gay", "gayo" }, { "Mong", metaValue_mn }, { "mnc", "manchu" }, { "Latf", "latinsk - frakturvariant" }, { "Hluw", "anatolske hieroglyffer" }, { "gba", "gbaya" }, { "mni", "manipuri" }, { "Latn", "latinsk" }, { "Latg", "latinsk - g\u00e6lisk variant" }, { "type.nu.hans", "forenklede kinesiske tal" }, { "type.nu.hant", "traditionelle kinesiske tal" }, { "xh", "isiXhosa" }, { "type.nu.romanlow", "romertal med sm\u00e5 bogstaver" }, { "byn", "blin" }, { "%%PAMAKA", "Pamaka-dialekt" }, { "Lyci", "lykisk" }, { "osa", "osage" }, { "byv", "medumba" }, { "Moon", "moon" }, { "moh", "mohawk" }, { "kkj", "kako" }, { "%%1694ACAD", "tidlig moderne fransk" }, { "Syrc", metaValue_syr }, { "yi", "jiddisch" }, { "mos", "mossi" }, { "Dsrt", "deseret" }, { "yo", "yoruba" }, { "type.nu.traditional", "Traditionelle tal" }, { "es_MX", "mexicansk spansk" }, { "Syrj", "vestsyrisk" }, { "ota", "osmannisk tyrkisk" }, { "Syre", "syrisk - estrangelovariant" }, { "vai", metaValue_vai }, { "za", "zhuang" }, { "Cari", "kariansk" }, { "kln", "kalenjin" }, { "zh", "kinesisk" }, { "Afak", "afaka" }, { "Bopo", "bopomofo" }, { "Perm", "oldpermisk" }, { "key.lb", "linjeskift" }, { "zu", "zulu" }, { "type.co.phonebook", "sorteringsr\u00e6kkef\u00f8lge i telefonb\u00f8ger" }, { "%%MONOTON", "monotonisk" }, { "Geor", metaValue_ka }, { "Shrd", "sharada" }, { "kmb", "kimbundu" }, { "type.nu.jpanfin", "japanske finansielle tal" }, { "Cham", "cham" }, { "gez", "geez" }, { "Syrn", "\u00f8stsyriakisk" }, { "type.nu.mymrshan", "Myanmar Shan-tal" }, { "Narb", "gammelt nordarabisk" }, { "type.nu.olck", "Ol Chiki-tal" }, { "type.co.reformed", "ny sorteringsr\u00e6kkef\u00f8lge" }, { "Tglg", metaValue_tl }, { "Egyd", "egyptisk demotisk" }, { "Egyh", "egyptisk hieratisk" }, { "%%ITIHASA", "itihasa" }, { "Palm", "palmyrensk" }, { "ebu", "kiembu" }, { "Egyp", "egyptiske hieroglyffer" }, { "Geok", "georgisk kutsuri" }, { "zh_Hans", "forenklet kinesisk" }, { "koi", "komi-permjakisk" }, { "Hung", "oldungarsk" }, { "kok", "konkani" }, { "%%1901", "traditionel tysk retskrivning" }, { "kos", "kosraean" }, { "type.nu.limb", "Limbu-tal" }, { "zh_Hant", "traditionelt kinesisk" }, { "Sund", metaValue_su }, { "kpe", metaValue_kpe }, { "type.nu.khmr", "khmer tal" }, { "Tirh", "tirhuta" }, { "ilo", "iloko" }, { "%%VALENCIA", "valenciansk" }, { "Cprt", "cypriotisk" }, { "%%BAKU1926", "forenet tyrkisk-latinsk alfabet" }, { "mua", "mundang" }, { "type.nu.guru", "gurmukhi tal" }, { "mul", "flere sprog" }, { "cad", "caddo" }, { "key.ms", "m\u00e5lesystem" }, { "mus", "creek" }, { "Glag", "glagolitisk" }, { "gil", "gilbertesisk" }, { "%%KKCOR", "almindelig ortografi" }, { "Cher", metaValue_chr }, { "car", "caribisk" }, { "cay", "cayuga" }, { "type.nu.tamldec", "tamilske tal" }, { "krc", "karatjai-balkar" }, { "inh", "ingush" }, { "krl", "karelsk" }, { "efi", "efik" }, { "key.nu", "tal" }, { "kru", "kurukh" }, { "ksb", "shambala" }, { "Telu", metaValue_te }, { "ksf", "bafia" }, }; return data; } }
[ "kangjianwei1990@qq.com" ]
kangjianwei1990@qq.com
216f0d7c71be12cc529cd494d5968543975da5f0
a305ad1d2cd0df464920b4c3a43f3c1c43cc4672
/src/test/java/com/googlecode/janrain4j/api/engage/request/ImageMediaItemTest.java
e8e3f69bc0844b879a25eece444f5639a821b177
[ "Apache-2.0" ]
permissive
ParthPancholi/janrain4j
79482aa9c25d54113691199bb196ebc4ca6525f7
4c50d4203e32df66990c5bfc2b800e24264ee8ce
refs/heads/master
2021-01-10T15:59:47.387447
2011-12-19T23:19:10
2011-12-19T23:19:10
36,793,601
0
0
null
null
null
null
UTF-8
Java
false
false
1,342
java
/* Copyright 2010 Marcel Overdijk * * 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.googlecode.janrain4j.api.engage.request; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; import com.googlecode.janrain4j.json.JSONStringer; public class ImageMediaItemTest { private ImageMediaItem mediaItem = null; JSONStringer json = null; private String src = "my-src"; private String href = "my-href"; @Before public void setUp() { json = new JSONStringer(); } @Test public void testImageMediaItem() throws Exception { mediaItem = new ImageMediaItem(src, href); mediaItem.writeJSON(json); assertEquals("{\"type\":\"image\",\"src\":\"my-src\",\"href\":\"my-href\"}", json.toString()); } }
[ "marceloverdijk@eb094156-6a93-46f2-7163-e0a03cb7e90b" ]
marceloverdijk@eb094156-6a93-46f2-7163-e0a03cb7e90b
585a3144fee99e0ffb7e3ab7d137db9bf92788d5
29b6a856a81a47ebab7bfdba7fe8a7b845123c9e
/dingtalk/java/src/main/java/com/aliyun/dingtalkindustry_1_0/models/CampusCreateRenterResponse.java
b61da2a43f595711ccfc934df1d927b67e757879
[ "Apache-2.0" ]
permissive
aliyun/dingtalk-sdk
f2362b6963c4dbacd82a83eeebc223c21f143beb
586874df48466d968adf0441b3086a2841892935
refs/heads/master
2023-08-31T08:21:14.042410
2023-08-30T08:18:22
2023-08-30T08:18:22
290,671,707
22
9
null
2021-08-12T09:55:44
2020-08-27T04:05:39
PHP
UTF-8
Java
false
false
1,406
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.dingtalkindustry_1_0.models; import com.aliyun.tea.*; public class CampusCreateRenterResponse extends TeaModel { @NameInMap("headers") @Validation(required = true) public java.util.Map<String, String> headers; @NameInMap("statusCode") @Validation(required = true) public Integer statusCode; @NameInMap("body") @Validation(required = true) public CampusCreateRenterResponseBody body; public static CampusCreateRenterResponse build(java.util.Map<String, ?> map) throws Exception { CampusCreateRenterResponse self = new CampusCreateRenterResponse(); return TeaModel.build(map, self); } public CampusCreateRenterResponse setHeaders(java.util.Map<String, String> headers) { this.headers = headers; return this; } public java.util.Map<String, String> getHeaders() { return this.headers; } public CampusCreateRenterResponse setStatusCode(Integer statusCode) { this.statusCode = statusCode; return this; } public Integer getStatusCode() { return this.statusCode; } public CampusCreateRenterResponse setBody(CampusCreateRenterResponseBody body) { this.body = body; return this; } public CampusCreateRenterResponseBody getBody() { return this.body; } }
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
1e19e36d7649e400b01b08914ea735aca152bc00
2e723a01c8dee36a28f6484298f8023f64dbbddc
/Fssai_E-Learning_System/src/com/ir/model/KindOfBusiness.java
a1bfbf910d3f1ac68601e2e93e092cb521a812b1
[]
no_license
BittooDuggu/Fssai_E
1c642f55f08672a6737c7e969c9fe1edcd982cb9
6db024239fee7b066845ab51c3bebdbf1f211a85
refs/heads/master
2020-06-23T18:28:59.254925
2016-11-24T05:52:08
2016-11-24T05:52:08
74,641,705
0
0
null
null
null
null
UTF-8
Java
false
false
1,208
java
package com.ir.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import org.hibernate.validator.constraints.NotEmpty; @Entity @Table(name="kindOfBusiness") public class KindOfBusiness { @Id @Column(name="kindOfBusinessId") private int kindOfBusinessId; @Column(name="kindOfBusinessName") @NotEmpty(message="Please selct your business type !") private String kindOfBusinessName; public KindOfBusiness() { } public KindOfBusiness(int kindOfBusinessId, String kindOfBusinessName) { super(); this.kindOfBusinessId = kindOfBusinessId; this.kindOfBusinessName = kindOfBusinessName; } public int getKindOfBusinessId() { return kindOfBusinessId; } public void setKindOfBusinessId(int kindOfBusinessId) { this.kindOfBusinessId = kindOfBusinessId; } public String getKindOfBusinessName() { return kindOfBusinessName; } public void setKindOfBusinessName(String kindOfBusinessName) { this.kindOfBusinessName = kindOfBusinessName; } public String toString() { return "kindOfBusinessName: " + this.kindOfBusinessName + ", kindOfBusinessId: " + this.kindOfBusinessId + ")"; } }
[ "lalit.pachauri9@gmail.com" ]
lalit.pachauri9@gmail.com
fef4ad48f0867cfc7e1db9a71a63151b43d01b3a
e23db40d9cbb2fe9e8e794cc0864d679c4ba9fff
/VendingMachineSpring/src/main/java/com/sg/vendingmachinespring/service/VendingMachineService.java
5c90cdeafe6a369ee339eb85cbc3d7dcf75d4e88
[]
no_license
apitzen88/SoftwareGuildProjects
080146aa6bbc4ea7cb8d39a791f1c2f7b800f8e7
5b2f96ce06354eff521a3d3c2e578ffb2b3183a9
refs/heads/master
2021-08-14T19:07:31.986354
2017-11-16T14:59:06
2017-11-16T14:59:06
107,150,345
0
0
null
null
null
null
UTF-8
Java
false
false
874
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.sg.vendingmachinespring.service; import com.sg.vendingmachinespring.model.Change; import com.sg.vendingmachinespring.model.Item; import java.math.BigDecimal; import java.util.List; /** * * @author apitz_000 */ public interface VendingMachineService { public List<Item> listItems(); public Item getItem(String id); public void changeInventory(Item item); public void addMoney(BigDecimal money); public String currentMessage(); public void purchaseItem(String id) throws InvalidEntryException; public BigDecimal currentBalance(); public Change makeChange(); public Change getChange(); }
[ "apitzen88@gmail.com" ]
apitzen88@gmail.com
c1f9b810cea42e06f9c0d7e884c8227df640f27d
5ba8f9607a98aa1124bc9114ea2b01f19d666935
/SRM 162 DIV 2/test/PaperFoldTest.java
90cb622876f536b7eb8ec2c0da5413cc0aabee32
[]
no_license
pmonkelban/TopCodingSolutions
109facb985faa2bd22faf32d729d0f1db13befef
7a2a4a016d2dd9ae70a51f14c8fd5c72bb904594
refs/heads/master
2016-09-08T01:54:26.409310
2015-11-22T15:35:21
2015-11-22T15:35:21
28,159,578
0
2
null
null
null
null
UTF-8
Java
false
false
1,065
java
import org.junit.Test; import static org.junit.Assert.*; public class PaperFoldTest { @Test public void test0() { int[] paper = new int[] {8, 11}; int[] box = new int[] {6, 10}; assertEquals(1, new PaperFold().numFolds(paper, box)); } @Test public void test1() { int[] paper = new int[] {11, 17}; int[] box = new int[] {6, 4}; assertEquals(4, new PaperFold().numFolds(paper, box)); } @Test public void test2() { int[] paper = new int[] {11, 17}; int[] box = new int[] {5, 4}; assertEquals(4, new PaperFold().numFolds(paper, box)); } @Test public void test3() { int[] paper = new int[] {1000,1000}; int[] box = new int[] {62,63}; assertEquals(-1, new PaperFold().numFolds(paper, box)); } @Test public void test4() { int[] paper = new int[] {100,30}; int[] box = new int[] {60,110}; assertEquals(0, new PaperFold().numFolds(paper, box)); } @Test public void test5() { int[] paper = new int[] {1895, 6416}; int[] box = new int[] {401, 1000}; assertEquals(5, new PaperFold().numFolds(paper, box)); } }
[ "pmonkelban@gmail.com" ]
pmonkelban@gmail.com
4287e5cb72b4bf4aabbf7e90112bcdadd4a5e056
4c77bfe792547b41e45510964e42ea99e0af4b98
/hyperion-item-nameplate-groupie/src/androidTest/java/com/github/sckm/hyperion/itemnameplate/groupie/ExampleInstrumentedTest.java
be44badb7da35ed8acccd885910ea5855540d583
[ "Apache-2.0" ]
permissive
sckm/item-nameplate
ee6e36e5ad3108a4aab6eae41d2f6c676605b113
1e2cf4a23120a9908d504651ca09b116f78b88bb
refs/heads/master
2020-04-12T11:44:15.611916
2019-03-08T04:46:35
2019-03-08T04:46:35
162,469,373
0
0
null
2019-03-08T03:22:57
2018-12-19T17:24:13
Kotlin
UTF-8
Java
false
false
781
java
package com.github.sckm.hyperion.itemnameplate.groupie; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.github.sckm.hyperion.itemnameplate.groupie.test", appContext.getPackageName()); } }
[ "scal.che@gmail.com" ]
scal.che@gmail.com
ebfa382f94b5db5d754cd82b3876c2146e547c9c
bb3e1c5384a437afd9978da22fbe0959f62c205a
/src/pesquisabinaria/PesquisaBinariaTest.java
caeca5ccc198a1c5274f470833f489e6378fdce9
[]
no_license
regis-maximo/pesquisaBinaria
d73b3816ed4d22b1bcdcbc50ad510cb4f22db670
eaac5a74e2461c0d96c72884ec721d984047fb33
refs/heads/master
2022-11-11T11:02:02.717863
2020-06-26T18:33:58
2020-06-26T18:33:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,672
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 pesquisabinaria; import java.util.Scanner; import service.PesquisaBinaria; /** * * @author regis */ public class PesquisaBinariaTest { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int searchInt; // chave de pesquisa int position; // localização da chave de pesquisa no array // cria um array e gera a saída PesquisaBinaria binaryArray = new PesquisaBinaria(15); System.out.println(binaryArray); // obtém entrada do usuário System.out.println("entra com um valor da chave -1 para sair"); searchInt = scanner.nextInt(); System.out.println(); while(searchInt != -1) { // utiliza a pesquisa binária para tentar localizar o inteiro position = binaryArray.buscarChave(searchInt); // valor de retorno -1 significa que o valor não foi localizado if(position == -1) System.out.println("não foi encontrado " + searchInt); else System.out.println("encontrado o elemento na posição: " + position); // obtém a entrada do usuário System.out.println("aperte -1 para parar"); searchInt = scanner.nextInt(); System.out.println(); } // fim de while } // fim de main. } // fim da classe PesquisaBinariaTest.
[ "regishallowed@gmail.com" ]
regishallowed@gmail.com
af7db6f71cfcad918d448ccda2f1370c14060dda
5b20675279b8c3559512397563b7dacc690e8785
/gameserver/branches/obfuscated/game-src/com/l2jfrozen/gameserver/network/serverpackets/ExDuelEnd.java
4b6de27a28451158acffd2be4fd78aab47766180
[]
no_license
Bokoa/l2jfrozen
0226a1d30eaf4bfa0078fedb46ac4f650cbca805
624d29604b1626f379929f0100c6a3a431a7f89b
refs/heads/master
2023-02-11T01:39:49.699822
2020-05-10T12:50:46
2020-05-10T12:50:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,451
java
/* L2jFrozen Project - www.l2jfrozen.com * * 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, 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. * * http://www.gnu.org/copyleft/gpl.html */ package com.l2jfrozen.gameserver.network.serverpackets; /** * Format: ch d. * @author KenM */ public class ExDuelEnd extends L2GameServerPacket { /** The Constant _S__FE_4E_EXDUELEND. */ private static final String _S__FE_4E_EXDUELEND = "[S] FE:4E ExDuelEnd"; /** The _unk1. */ private final int _unk1; /** * Instantiates a new ex duel end. * @param unk1 the unk1 */ public ExDuelEnd(final int unk1) { _unk1 = unk1; } @Override protected void writeImpl() { C(0xfe); H(0x4e); D(_unk1); } /** * Gets the type. * @return the type */ @Override public String getType() { return _S__FE_4E_EXDUELEND; } }
[ "77194947+Shyla-L2jFrozen@users.noreply.github.com" ]
77194947+Shyla-L2jFrozen@users.noreply.github.com
6f93d8ff3c5526bc0d44b8b4bcc365a63a4dcbbf
6baf1fe00541560788e78de5244ae17a7a2b375a
/hollywood/com.oculus.socialplatform-base/sources/X/EnumC03060ku.java
2c70e5a21459989eb85f1bc46f01e4e13612ff95
[]
no_license
phwd/quest-tracker
286e605644fc05f00f4904e51f73d77444a78003
3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba
refs/heads/main
2023-03-29T20:33:10.959529
2021-04-10T22:14:11
2021-04-10T22:14:11
357,185,040
4
2
null
2021-04-12T12:28:09
2021-04-12T12:28:08
null
UTF-8
Java
false
false
472
java
package X; /* renamed from: X.0ku reason: invalid class name and case insensitive filesystem */ public enum EnumC03060ku { NOT_SO("not_so"), X86("x86"), ARM("armeabi-v7a"), X86_64("x86_64"), AARCH64("arm64-v8a"), OTHERS("others"); public final String value; /* access modifiers changed from: public */ EnumC03060ku(String str) { this.value = str; } public String toString() { return this.value; } }
[ "cyuubiapps@gmail.com" ]
cyuubiapps@gmail.com
8b85446e75c0e92b3d02f8ed123c772ccea23392
4b8ff286a5318224d62800d2dcfe6d3a473b4d45
/src/modul1/Latihan1.java
cddc6bc9f82903557b68257d026a9ef41aaf6aa7
[]
no_license
AkbarVito/Enkapsulasi
01d4b8d28907046294277fb58f96c43d5c0c8a0a
b8256f4dc362d26d87bca176e1bc4246b93abd92
refs/heads/master
2020-03-29T00:58:16.148281
2018-09-18T23:37:45
2018-09-18T23:37:45
149,364,911
0
0
null
null
null
null
UTF-8
Java
false
false
496
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 modul1; /** * * @author asus */ public class Latihan1 { /** * @param args the command line arguments */ public static void main(String[] args) { System.out.println("Hello"); System.out.println("Selamat Belajar di program java"); } }
[ "asus@ROG" ]
asus@ROG
155c773910efad681005a96c4eeb587e0575c5d3
f2c901473ba2a8fe88e5aabf73afa85ff1f130e9
/src/main/java/com/poliscan/application/handler/user/HandlerDeleteUser.java
7be58dc3cb1d1246236c9a68944474e1cde5d1ef
[]
no_license
NayarBEP1/PifPoliscan
2a506c23825252361cc550e08aa9d3251a7cbc5a
6ba043e4677d8cb4a1253ae61673f84052ba66da
refs/heads/master
2022-08-27T03:37:32.282639
2020-05-28T05:11:26
2020-05-28T05:11:26
263,181,932
0
0
null
null
null
null
UTF-8
Java
false
false
459
java
package com.poliscan.application.handler.user; import com.poliscan.domain.service.user.ServiceDeleteUser; import org.springframework.stereotype.Component; @Component public class HandlerDeleteUser { private ServiceDeleteUser serviceDeleteUser; public HandlerDeleteUser(ServiceDeleteUser serviceDeleteUser) { this.serviceDeleteUser = serviceDeleteUser; } public void run(String id){ this.serviceDeleteUser.run(id); } }
[ "brayanestradaposada@gmail.com" ]
brayanestradaposada@gmail.com
57f1a7e62121e90818f031f5b90a09fb251684b2
d761683b1cc92a01381a4c2f24a624a34bf6a56e
/src/main/java/com/sjesu/webtruckshippingsystem/domain/Vehicles.java
7b51b48f2d2bac3a885bcc2e0f40c00fbac9c3a8
[]
no_license
TanayaDave/SOAWebApp
93b8586fc976ed37cb4db4ac65dd636467f39570
969b2ae5f643abc5c91564a69e27f67220338599
refs/heads/master
2021-08-26T07:07:25.079720
2017-11-22T03:03:12
2017-11-22T03:03:12
107,489,521
0
0
null
null
null
null
UTF-8
Java
false
false
2,526
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.sjesu.webtruckshippingsystem.domain; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * * @author user */ @Entity @Table(name = "vehicle") public class Vehicles { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int vehicleId; private String make; private String vin; private String model; private String year; private String color; private String licPlateNo; private int custId; private int orderId; public int getVehicleId() { return vehicleId; } public void setVehicleId(int vehicleId) { this.vehicleId = vehicleId; } public String getMake() { return make; } public void setMake(String make) { this.make = make; } public String getVin() { return vin; } public void setVin(String vin) { this.vin = vin; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public String getYear() { return year; } public void setYear(String year) { this.year = year; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public String getLicPlateNo() { return licPlateNo; } public void setLicPlateNo(String licPlateNo) { this.licPlateNo = licPlateNo; } public int getCustId() { return custId; } public void setCustId(int custId) { this.custId = custId; } public int getOrderId() { return orderId; } public void setOrderId(int orderId) { this.orderId = orderId; } @Override public String toString() { return "Vehicles{" + "vehicleId=" + vehicleId + ", make=" + make + ", vin=" + vin + ", model=" + model + ", year=" + year + ", color=" + color + ", licPlateNo=" + licPlateNo + ", custId=" + custId + '}'; } }
[ "31286678+sjesu@users.noreply.github.com" ]
31286678+sjesu@users.noreply.github.com
002516dd7a714bada13cd9cea150201058d06622
507a96543784eedb7aa1802d5900807660b7ddbb
/xingguang-loan-system/src/test/java/com/xingguang/cus/CusUserTest.java
380c836ee88b5b0ed2d4e6537ba797df50f77220
[]
no_license
dalianghe/xingguang-loan
a60562d112c7369c82a58b89d0b9fc6a0e86f931
1bbdef3d405b93c38117c113e310f763bd7a44b7
refs/heads/master
2021-05-16T12:55:46.139561
2017-12-14T15:30:19
2017-12-14T15:30:19
105,276,134
0
1
null
null
null
null
UTF-8
Java
false
false
1,409
java
package com.xingguang.cus; import com.xingguang.cus.baseinfo.domain.CusUserDomain; import com.xingguang.cus.baseinfo.service.ICusUserInfoService; import com.xingguang.cus.linkinfo.entity.CusUserLinkEntity; import com.xingguang.cus.linkinfo.service.ICusUserLinkService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.HashMap; import java.util.Map; /** * Created by admin on 2017/10/11. */ @RunWith(SpringRunner.class) @SpringBootTest public class CusUserTest { @Autowired private ICusUserInfoService service; @Autowired private ICusUserLinkService linkService; @Test public void testFindAll() throws Exception{ Map<String,Integer> pager = new HashMap<>(); pager.put("page",1); pager.put("pageSize",10); CusUserDomain domain = new CusUserDomain(); domain.setName(null); domain.setPager(pager); Map<String ,Object> map = service.findCusUserAll(domain); System.out.println(map.get("total")); } @Test public void testFindCusUserLinkByUserId() throws Exception{ CusUserLinkEntity entity = linkService.findCusUserLinkByUserId(2L); System.out.println(entity.getLinkName()); } }
[ "276420284@qq.com" ]
276420284@qq.com
54517d3ef07e80b0bd229c185284a657f8220ac7
6fc92588d2b9a512a43ab9c5170b1cbc651377f9
/rcn-authority-matcher/src/main/java/edu/asu/diging/rcn/web/auth/RecordController.java
702a5d6360c3a4525ada79fb53135b656523412c
[]
no_license
diging/rcn-authority-matcher
0ab33f69cc363e9e3cb93b55a4810db18ed45c62
2d5b51ce76ba4de5369224ec893b8059bc9fa06c
refs/heads/develop
2022-11-24T14:19:20.573740
2020-03-30T00:49:20
2020-03-30T00:49:20
172,993,971
0
0
null
2022-11-15T23:32:55
2019-02-27T21:35:09
CSS
UTF-8
Java
false
false
741
java
package edu.asu.diging.rcn.web.auth; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import edu.asu.diging.rcn.core.service.IRecordManager; @Controller public class RecordController { @Autowired private IRecordManager recordManager; @RequestMapping(value="/auth/datasets/{datasetId}/record/{recordId}") public String list(Model model, @PathVariable("recordId") String recordId) { model.addAttribute("record", recordManager.get(recordId)); return "auth/datasets/record"; } }
[ "julia.damerow@gmail.com" ]
julia.damerow@gmail.com
3b38ddff27e802ab7d810f996d7efa6428bc75ac
4274bd05c22369043184e1cc00c78cf99da16173
/src/com/startjava/lesson_01/unicode/Unicode.java
2447e074c478f3c6c06e1aa8dd6f78a5dabd5624
[]
no_license
NikolayLarin/startjava
e301a9b7e72a633fbd351394c3e2d85c5adf213e
566c6c797d603a358662646b2219f237f5af5778
refs/heads/master
2020-04-29T12:54:12.142734
2019-04-19T07:06:46
2019-04-19T07:06:46
176,095,639
0
0
null
null
null
null
UTF-8
Java
false
false
585
java
package com.startjava.lesson_01.unicode; public class Unicode { public static void main(String[] args) { char startOutput = 33; for (int i = 33; i <= 126; i++) { System.out.println("Unicode symbol " + i + " is: " + startOutput); startOutput++; } System.out.println("\n" + "Some Unicode cyrillic characters:" + "\n"); startOutput = 1025; for (int i = 1025; i <= 1111; i++) { System.out.print(startOutput + " "); startOutput++; } System.out.println(); } }
[ "nikolay.larin.itmail@gmail.com" ]
nikolay.larin.itmail@gmail.com
c786525849449971575b2a06a0b27c3cf045610e
875d88ee9cf7b40c9712178d1ee48f0080fa0f8a
/geronimo-jpa_2.1_spec/src/main/java/javax/persistence/AssociationOverrides.java
72c505b730a3e95cb67c2ed47695009df1881df0
[ "Apache-2.0", "W3C", "W3C-19980720" ]
permissive
jgallimore/geronimo-specs
b152164488692a7e824c73a9ba53e6fb72c6a7a3
09c09bcfc1050d60dcb4656029e957837f851857
refs/heads/trunk
2022-12-15T14:02:09.338370
2020-09-14T18:21:46
2020-09-14T18:21:46
284,994,475
0
1
Apache-2.0
2020-09-14T18:21:47
2020-08-04T13:51:47
Java
UTF-8
Java
false
false
1,467
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ // // This source code implements specifications defined by the Java // Community Process. In order to remain compliant with the specification // DO NOT add / change / or delete method signatures! // package javax.persistence; import java.lang.annotation.Target; import java.lang.annotation.Retention; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.RetentionPolicy.RUNTIME; @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME) public @interface AssociationOverrides { AssociationOverride[] value(); }
[ "gawor@apache.org" ]
gawor@apache.org
76c67b2fd132739a47aa543d3d60bcb636da674d
c9412ff80b8846508cb5099edb98c7ed592fc0e0
/src/com/jhlabs/map/proj/CylindricalProjection.java
30c86f546fc335b0651f9bf76e1d716104dc009d
[]
no_license
jventrib/HegagonMap
9ed32ef2093d48ac4eaa64aa8a0abff7dd81cc25
379251d58ed450139e2fb10ed6725d6f77c902e3
refs/heads/master
2023-08-09T19:20:38.386288
2013-06-14T07:42:01
2013-06-14T07:42:01
406,067,296
0
0
null
null
null
null
UTF-8
Java
false
false
1,022
java
/* Copyright 2006 Jerry Huxtable 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. */ /** * Rremoved long unrelated commented method for geometrical path splitting * by Bernhard Jenny, May 18 2010. */ package com.jhlabs.map.proj; /** * The superclass for all cylindrical projections. */ public class CylindricalProjection extends Projection { /** * */ private static final long serialVersionUID = 1L; public boolean isRectilinear() { return true; } public String toString() { return "Cylindrical"; } }
[ "bitbucket@bitbucket15.private.bitbucket.org" ]
bitbucket@bitbucket15.private.bitbucket.org
11e92ccece7405f880b7ba1516a00f8ff8ed6d9f
f2d3783e2e8e2637c99ad038756433be2a2fb43d
/SpringbootVueBlog20/dbblog-backend/dbblog-core/src/main/java/cn/dblearn/blog/mapper/book/BookNoteMapper.java
8dd2e3142727ac93f99b76a73ee97e02267d7ea5
[ "MIT" ]
permissive
openwanggq/myblog
e008675f1ba2a06798adc7c0559bb377ca530edc
ebd9cf4493730141bf29d332c29aa07d6ebede3b
refs/heads/master
2022-12-11T06:55:51.153943
2021-02-25T15:08:04
2021-02-25T15:08:04
253,241,365
1
0
null
2022-12-07T21:37:49
2020-04-05T13:28:02
Java
UTF-8
Java
false
false
1,575
java
package cn.dblearn.blog.mapper.book; import cn.dblearn.blog.entity.book.BookNote; import cn.dblearn.blog.entity.book.vo.BookNoteVo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; /** * <p> * 笔记 Mapper 接口 * </p> * * @author bobbi * @since 2019-02-13 */ @Mapper public interface BookNoteMapper extends BaseMapper<BookNote> { /** * 查询列表 * * @param page * @param params * @return */ List<BookNoteVo> listBookNoteVo(Page<BookNoteVo> page, @Param("params") Map<String, Object> params); /** * 分页分类获取列表 * * @param params * @return */ List<BookNoteVo> queryPageCondition(Page<BookNoteVo> page, @Param("params") Map<String, Object> params); /** * 更新阅读记录数 * @param id */ void updateReadNum(Integer id); /** * 获取简单对象 * @param bookNoteId * @return */ BookNoteVo getSimpleBookNoteVo(Integer bookNoteId); /** * 获取简单list * @param bookId * @return */ List<BookNote> listSimpleBookNote(Integer bookId); /** * 更新点赞记录 * @param parseInt */ void updateLikeNum(int parseInt); /** * 判断该类别下是否有笔记 * @param categoryId * @return */ int checkByCategory(Integer categoryId); }
[ "wanggq@yxt.com" ]
wanggq@yxt.com
8049f1cdd8a8b58802d35e4a377b229cb57a5b44
16ab464ebd5bb3867b9ae7c187e586b609c88df0
/idvos/src/main/java/de/idvos/fastonlineidentification/sdk/IdentificationResult.java
70fd936e59f2c0b9fdcd922ad3338fd52fc04a7f
[]
no_license
ben-efiz/idvos_android
58e511a60e428ff0bcd31f54a053dd73f9e337c7
b722794f62a69312895e8f8ab957b2224e2945ae
refs/heads/master
2021-01-22T01:29:02.047061
2015-07-27T10:38:16
2015-07-27T10:38:16
39,768,540
0
0
null
2015-07-27T10:23:40
2015-07-27T10:23:40
null
UTF-8
Java
false
false
1,265
java
package de.idvos.fastonlineidentification.sdk; import android.os.Parcel; import android.os.Parcelable; public class IdentificationResult implements Parcelable { public static final String IDENTIFICATION_RESULT = "result"; private boolean mResult; private String mTransactionId; public IdentificationResult(boolean result, String transactionId) { mResult = result; mTransactionId = transactionId; } private IdentificationResult(Parcel source) { mResult = source.readInt()==1; mTransactionId = source.readString(); } public boolean isSuccessful() { return mResult; } public String getTransactionId() { return mTransactionId; } public static final Creator<IdentificationResult> CREATOR = new Creator<IdentificationResult>() { @Override public IdentificationResult[] newArray(int size) { return new IdentificationResult[size]; } @Override public IdentificationResult createFromParcel(Parcel source) { return new IdentificationResult(source); } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(mResult?1:0); dest.writeString(mTransactionId); } }
[ "ference@buzzjective.com" ]
ference@buzzjective.com
5c7327348b983b6ed38bb5cf20a4642b67dbb76d
38933bae7638a11fef6836475fef0d73e14c89b5
/magma-asserts/src/test/java/eu/lunisolar/magma/asserts/func/function/to/LToLongBiFunctionAttestTest.java
70d5fc297e1c2ba126217cfcbc816c1b5b52e887
[ "Apache-2.0" ]
permissive
lunisolar/magma
b50ed45ce2f52daa5c598e4760c1e662efbbc0d4
41d3db2491db950685fe403c934cfa71f516c7dd
refs/heads/master
2023-08-03T10:13:20.113127
2023-07-24T15:01:49
2023-07-24T15:01:49
29,874,142
5
0
Apache-2.0
2023-05-09T18:25:01
2015-01-26T18:03:44
Java
UTF-8
Java
false
false
4,616
java
/* * This file is part of "lunisolar-magma". * * (C) Copyright 2014-2023 Lunisolar (http://lunisolar.eu/). * * 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 eu.lunisolar.magma.asserts.func.function.to; import eu.lunisolar.magma.asserts.func.FuncAttests; import eu.lunisolar.magma.func.supp.check.Checks; import eu.lunisolar.magma.func.supp.*; // NOSONAR import eu.lunisolar.magma.func.*; // NOSONAR import javax.annotation.Nonnull; // NOSONAR import javax.annotation.Nullable; // NOSONAR import java.util.Objects;// NOSONAR import eu.lunisolar.magma.basics.meta.*; // NOSONAR import eu.lunisolar.magma.basics.meta.functional.*; // NOSONAR import eu.lunisolar.magma.basics.meta.functional.type.*; // NOSONAR import eu.lunisolar.magma.basics.meta.functional.domain.*; // NOSONAR import eu.lunisolar.magma.func.function.to.LToLongBiFunction; import org.testng.annotations.*; //NOSONAR import java.util.regex.Pattern; //NOSONAR import java.text.ParseException; //NOSONAR import eu.lunisolar.magma.basics.exceptions.*; //NOSONAR import java.util.concurrent.atomic.*; //NOSONAR import java.util.function.*; //NOSONAR @SuppressWarnings("ALL") public class LToLongBiFunctionAttestTest<T1,T2> { private long testValue = 100L; private LToLongBiFunction<Integer,Integer> function = (a1,a2) -> testValue; private LToLongBiFunction<Integer,Integer> functionThrowing = (a1,a2) -> { throw new UnsupportedOperationException(); }; @Test public void testAssertPositive() throws ParseException { FuncAttests.attestToLongBiFunc(function) .doesApplyAsLong(100,100) .to(a -> a.mustEx(Be::equalEx, testValue)); } @Test(expectedExceptions = AssertionError.class) public void testAssertNegative() throws ParseException { FuncAttests.attestToLongBiFunc(function) .doesApplyAsLong(100,100) .to(a -> a.mustEx(Be::equalEx, 0L)); } @Test(expectedExceptions = AssertionError.class, expectedExceptionsMessageRegExp = "(?s)Actual .+: Case .+, check \\?; Should evaluate without problem: null") public void testAssertThrowsUnexpected() throws ParseException { FuncAttests.attestToLongBiFunc(functionThrowing) .doesApplyAsLong(100,100) .to(a -> a.mustEx(Be::equalEx, 0L)); } @Test public void testAssertThrowsExpected() throws ParseException { FuncAttests.attestToLongBiFunc(functionThrowing) .doesApplyAsLong(100,100).withException(a -> a .mustEx(Be::exactlyInstanceOfEx, UnsupportedOperationException.class) .mustEx(Have::noMsgEx)); } @Test public void testRecurringAssertsPositive() throws ParseException { final AtomicInteger recurringAssertsCalls = new AtomicInteger(0); FuncAttests.attestToLongBiFunc(function) .inAllFollowingCases(a-> { recurringAssertsCalls.incrementAndGet(); a.mustEx(Be::equalEx, testValue); }) .doesApplyAsLong(100,100) .to(a -> a.mustEx(Be::equalEx, testValue)) .doesApplyAsLong(100,100) .to(a -> a.mustEx(Be::equalEx, testValue)); Checks.attest(recurringAssertsCalls.get()).mustEx(Be::equalEx, 2); } @Test(expectedExceptions = AssertionError.class, expectedExceptionsMessageRegExp = "(?s)Actual .+: Case .+, check \\?; Recurring assertion failed: .*") public void testRecurringAssertsNegative() throws ParseException { final AtomicInteger recurringAssertsCalls = new AtomicInteger(0); FuncAttests.attestToLongBiFunc(function) .inAllFollowingCases(a-> { int i = recurringAssertsCalls.incrementAndGet(); if (i>1) { a.mustEx(Be::equalEx, 0L); } }) .doesApplyAsLong(100,100) .to(a -> a.mustEx(Be::equalEx, testValue)) .doesApplyAsLong(100,100) .to(a -> a.mustEx(Be::equalEx, testValue)); Checks.attest(recurringAssertsCalls.get()).mustEx(Be::equalEx, 2); } }
[ "open@lunisolar.eu" ]
open@lunisolar.eu
b623c6afefffebfcfcead02668dfcd8c83456e4b
b5549e8fec8c4bdba57d149a2d8a7813456ef4dd
/designpattern/ObjectPoolDesignPattern/src/ObjectPool.java
8bf7119f533af6013ce07950d17cfaa0f40ea233
[]
no_license
ciphersuman/Algorithm
e9154f547dda95108dd97ddb76d81e2f64851f45
0e2e2aa1f32cf7d5db320cc51263d8533b9cbd49
refs/heads/master
2021-05-14T05:15:57.983224
2019-06-13T18:54:38
2019-06-13T18:54:38
116,216,825
1
0
null
null
null
null
UTF-8
Java
false
false
2,054
java
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; public abstract class ObjectPool<T> { private ConcurrentLinkedQueue<T> pool; private ScheduledExecutorService executorservice; public ObjectPool(final int minObjects) { initialize(minObjects); } private void initialize(int minObjects) { // TODO Auto-generated method stub pool = new ConcurrentLinkedQueue<T>(); for (int i = 0; i < minObjects; i++) { pool.add(createObject()); } } // public T borrowObject() { T object; if((object=pool.poll())==null) { object=createObject(); } return object; } public void returnObject(T object) { if (object == null) { return; } this.pool.offer(object); } /* Shutdown this pool. */ public void shutdown(){ if (executorservice != null){ executorservice.shutdown(); } } protected abstract T createObject(); public ObjectPool(final int minobj,final int maxobj,final long validationinterval ) { //intializePool initialize(minobj); //check pool condition in separate thread executorservice=Executors.newSingleThreadScheduledExecutor(); executorservice.scheduleWithFixedDelay(new Runnable(){ @Override public void run() { // TODO Auto-generated method stub int size=pool.size(); if(size<minobj) { int sizetobeadded=minobj-size; for (int i = 0; i < sizetobeadded; i++) { pool.add(createObject()); } } else { if(size>maxobj) { int sizetoberemove=size-maxobj; for (int i = 0; i < sizetoberemove; i++) { pool.poll(); } } } } }, validationinterval, validationinterval, TimeUnit.SECONDS); } }
[ "suman.s.ghosh@oracle.com" ]
suman.s.ghosh@oracle.com
fff97396e68ec20e39233b5b7144e301399744fa
7afa90e9492f802e9ebeabf00980413cf12de343
/src/main/java/DBReverse/DBInfo/DBType.java
2725e8d85401c09a99bfd501d0c8e4fd4e2960be
[]
no_license
edenhub/SSec
855907def1f68d2ec4567b03de0ee6009f2134c5
92fff7d92f3f577139abe2a0fa3e027272965f29
refs/heads/master
2020-05-17T02:00:30.729059
2015-03-14T12:09:46
2015-03-14T12:09:46
26,570,154
0
0
null
null
null
null
UTF-8
Java
false
false
544
java
package DBReverse.DBInfo; /** * Created by lab on 2014/11/19. */ /** * 数据库类型 */ public enum DBType { MYSQL("DB_MYSQL"),ORACLE("DB_ORACLE"); DBType(String value){ this.value = value; } /** * 根据字符串返回enum * @param type * @return */ public static DBType selectType(String type){ if ("DB_MYSQL" == type) return DBType.MYSQL; if ("DB_ORACLE" == type) return DBType.ORACLE; return null; } private String value; }
[ "adamchen.pub@gmail.com" ]
adamchen.pub@gmail.com
1e0d8840c2d992050cb8381d3333fce48c24b05d
45b31ac51ebd26bfdd2f16d9826378ad58f22a61
/src/main/java/io/pivotal/geode/function/ClearPartitionRegion.java
08ceb954a4dea2be6dffb1bbe4e94cc1c84e346a
[]
no_license
nchandrappa/Geode-Partition-Region-Clear
f286342dea22b4394c8a9032c95e6c97db96bdcf
a5a73c94485610079e18579a735e50f901141506
refs/heads/master
2020-08-02T00:56:33.468876
2019-09-26T21:57:47
2019-09-26T21:57:47
211,184,384
0
0
null
2019-09-26T21:28:38
2019-09-26T21:28:38
null
UTF-8
Java
false
false
1,629
java
package io.pivotal.geode.function; import org.apache.geode.cache.Declarable; import org.apache.geode.cache.Region; import org.apache.geode.cache.execute.Function; import org.apache.geode.cache.execute.FunctionContext; import org.apache.geode.cache.execute.FunctionException; import org.apache.geode.cache.execute.RegionFunctionContext; import org.apache.geode.cache.partition.PartitionRegionHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Properties; public class ClearPartitionRegion implements Function, Declarable { private static final Logger LOG = LoggerFactory.getLogger(ClearPartitionRegion.class); public void execute(FunctionContext context) { if (LOG.isDebugEnabled()) LOG.debug(Thread.currentThread().getName() + " executing " + getId()); if (context instanceof RegionFunctionContext) { RegionFunctionContext rfc = (RegionFunctionContext) context; Region localRegion = PartitionRegionHelper.getLocalDataForContext(rfc); int numLocalEntries = localRegion.size(); localRegion.keySet().stream().forEach(key -> localRegion.remove(key)); LOG.info("Cleared " + numLocalEntries + " entries from " + localRegion.getName() + " region local data."); context.getResultSender().lastResult(numLocalEntries); } else { throw new FunctionException("Context must be a RegionFunctionContext"); } } public String getId() { return getClass().getSimpleName(); } public boolean optimizeForWrite() { return true; } public boolean hasResult() { return true; } public boolean isHA() { return true; } public void init(Properties properties) { } }
[ "pvermeulen@pivotal.io" ]
pvermeulen@pivotal.io
f9c595b23be17bc37ba1b9cf136507d604085bf9
29a61e900d6f5b8fc1c6cd551c83d5e4099bd203
/JavaClass/src/javaclass/FileRename.java
744a03b8b414580afdd2bd557a217f84d0414d2b
[]
no_license
rony01674/java-class
8243fc020b52eedb6d52e51c0e852445a14d2352
16d0f29cc66d7db596db079b25e011dde5d52ea5
refs/heads/master
2020-04-13T11:40:09.177997
2019-01-31T12:41:32
2019-01-31T12:41:32
163,180,322
0
0
null
null
null
null
UTF-8
Java
false
false
930
java
package javaclass; import java.io.File; public class FileRename { public static void main(String[] args) throws Exception { //Create a new file and rename it File firstFile = new File("Rony.txt"); File secondFile = new File("Asaduzzaman.txt"); boolean fileCreated = firstFile.createNewFile(); if (fileCreated || firstFile.exists()) { printFileDetails(firstFile); printFileDetails(secondFile); boolean renameFlag = firstFile.renameTo(secondFile); if (!renameFlag) { System.out.println("Could not rename " + firstFile); } printFileDetails(firstFile); printFileDetails(secondFile); } } public static void printFileDetails(File f) { System.out.println("Absulate path: " + f.getAbsolutePath()); System.out.println("File exists: " + f.exists()); } }
[ "md.arfinshekh2017@gmail.com" ]
md.arfinshekh2017@gmail.com
1402a8e1485524a742c03a51358a9beae0ecd448
8cc8c17e96b359233dc7eb1896cd3545fe665a68
/backend/src/main/java/org/aim/movie/rating/RatingController.java
edcafb78eec74d7f9dc3cd7821ee85a4afef9490
[ "MIT" ]
permissive
kyleschulz/spring-boot-vuejs-frontback
72c24c7c1a1647091b82ca4f9f6d7042ba20b9e1
6aad6c2f1c18dd9955eef9b4f22ac991caf3fc53
refs/heads/master
2022-11-30T16:31:52.546559
2020-08-10T06:17:47
2020-08-10T06:17:47
286,385,025
0
0
null
null
null
null
UTF-8
Java
false
false
559
java
package org.aim.movie.rating; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping(path = "/api/ratings") public class RatingController { @Autowired private RatingRepository ratingRepository; @GetMapping(path = "") public Iterable<Rating> getAllRatings() { return ratingRepository.findAll(); } }
[ "kyle@schulz.com" ]
kyle@schulz.com
81bbbee92296e969e58ae6d3086ce275cf1961e3
fa93c9be2923e697fb8a2066f8fb65c7718cdec7
/sources/io/reactivex/rxjava3/internal/subscribers/BlockingSubscriber.java
84b742878721ac72673e3749d30aef8d8e5ad69f
[]
no_license
Auch-Auch/avito_source
b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b
76fdcc5b7e036c57ecc193e790b0582481768cdc
refs/heads/master
2023-05-06T01:32:43.014668
2021-05-25T10:19:22
2021-05-25T10:19:22
370,650,685
0
0
null
null
null
null
UTF-8
Java
false
false
1,848
java
package io.reactivex.rxjava3.internal.subscribers; import io.reactivex.rxjava3.core.FlowableSubscriber; import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper; import io.reactivex.rxjava3.internal.util.NotificationLite; import java.util.Queue; import java.util.concurrent.atomic.AtomicReference; import org.reactivestreams.Subscription; public final class BlockingSubscriber<T> extends AtomicReference<Subscription> implements FlowableSubscriber<T>, Subscription { public static final Object TERMINATED = new Object(); private static final long serialVersionUID = -4875965440900746268L; public final Queue<Object> a; public BlockingSubscriber(Queue<Object> queue) { this.a = queue; } @Override // org.reactivestreams.Subscription public void cancel() { if (SubscriptionHelper.cancel(this)) { this.a.offer(TERMINATED); } } public boolean isCancelled() { return get() == SubscriptionHelper.CANCELLED; } @Override // org.reactivestreams.Subscriber public void onComplete() { this.a.offer(NotificationLite.complete()); } @Override // org.reactivestreams.Subscriber public void onError(Throwable th) { this.a.offer(NotificationLite.error(th)); } @Override // org.reactivestreams.Subscriber public void onNext(T t) { this.a.offer(NotificationLite.next(t)); } @Override // io.reactivex.rxjava3.core.FlowableSubscriber, org.reactivestreams.Subscriber public void onSubscribe(Subscription subscription) { if (SubscriptionHelper.setOnce(this, subscription)) { this.a.offer(NotificationLite.subscription(this)); } } @Override // org.reactivestreams.Subscription public void request(long j) { ((Subscription) get()).request(j); } }
[ "auchhunter@gmail.com" ]
auchhunter@gmail.com
c377678eca4026d95d62fe28504a323c7a15fafa
a40ac37ee0803aa96afe8708e2bbe185c436a515
/120/Labs/L10_2 - Quick If/QE1.java
d936c15c7f319633c831db10ff33009ffad7f658
[]
no_license
life8899/Computer_Science
f0c224ea8a0bd6148c9592616201d64b94a74309
a88960b8f31bf982c0d47566120aeb35f49d48eb
refs/heads/master
2021-01-19T13:44:00.786884
2015-10-27T02:17:41
2015-10-27T02:17:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
737
java
/** * Accepts and Integer and prints Positive, Negative, or Zero * * @author Nick Alexander * @version 11/1/13 */ import java.util.Scanner; public class QE1 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); boolean done = false; int num = 0; String state = ""; for (int i = 0; i < 5; i++) { System.out.print("Enter an Integer: "); num = scanner.nextInt(); if (num == 0) state = "Zero"; if (num > 0) state = "Positive"; if (num < 0) state = "Negative"; System.out.println("The number is " + state); } } }
[ "alexander50@marshall.edu" ]
alexander50@marshall.edu
dd58fff839348976166fb280d4d86a2317ba2638
3dfebcd0ed6b910a2c345748805e66b0a853e916
/src/game/cmd/WinPlayCommandFactoryStateImpl.java
613855e9be9f34fb51f456dfe768205b89418c82
[ "MIT" ]
permissive
chobocho/solitaire
8c051a80e6b9a69289527d8d460cd55f96606b32
e7b37e6a713c6a569e502c810e4ab9265a23e8d9
refs/heads/master
2021-04-12T19:27:20.792463
2020-04-02T22:43:40
2020-04-02T22:43:40
249,104,040
1
1
null
null
null
null
UTF-8
Java
false
false
4,175
java
package game.cmd; import com.chobocho.command.*; import com.chobocho.solitaire.Solitare; import game.WinLog; public class WinPlayCommandFactoryStateImpl extends PlayCommandFactoryStateImpl implements CommandFactoryState { final static String TAG = "WinPlayCommandFactoryStateImpl"; int width = 100; int heigth = 150; int playDeckX = 70 + width * 6; int playDeckY = 10; @Override public PlayCommand createCommand(int fromDeck, int fromPos, int toDeck, int toPos) { if (fromDeck == toDeck) { return new PlayCommand(PlayCommand.OPEN, fromDeck, fromDeck); } else { if (fromDeck == Solitare.PLAY_DECK) { return null; } int count = fromPos+1; return new PlayCommand(PlayCommand.MOVE, fromDeck, toDeck, count); } } @Override public PlayCommand createCommand(int event, int x, int y) { WinLog.i(TAG, "Event:" + Integer.toString(event)); if (event == CommandFactory.KEYPRESS_EVENT) { switch(x) { case 49: // 1 return new PlayCommand(PlayCommand.MOVE, Solitare.OPENED_CARD_DECK, Solitare.RESULT_DECK_1); case 50: // 2 return new PlayCommand(PlayCommand.MOVE, Solitare.OPENED_CARD_DECK, Solitare.RESULT_DECK_2); case 51: // 3 return new PlayCommand(PlayCommand.MOVE, Solitare.OPENED_CARD_DECK, Solitare.RESULT_DECK_3); case 52: // 4 return new PlayCommand(PlayCommand.MOVE, Solitare.OPENED_CARD_DECK, Solitare.RESULT_DECK_4); case 65: // A return new PlayCommand(PlayCommand.MOVE, Solitare.OPENED_CARD_DECK, Solitare.BOARD_DECK_1); case 83: // S return new PlayCommand(PlayCommand.MOVE, Solitare.OPENED_CARD_DECK, Solitare.BOARD_DECK_2); case 68: // D return new PlayCommand(PlayCommand.MOVE, Solitare.OPENED_CARD_DECK, Solitare.BOARD_DECK_3); case 70: // F return new PlayCommand(PlayCommand.MOVE, Solitare.OPENED_CARD_DECK, Solitare.BOARD_DECK_4); case 71: // G return new PlayCommand(PlayCommand.MOVE, Solitare.OPENED_CARD_DECK, Solitare.BOARD_DECK_5); case 72: // H return new PlayCommand(PlayCommand.MOVE, Solitare.OPENED_CARD_DECK, Solitare.BOARD_DECK_6); case 74: // Jj return new PlayCommand(PlayCommand.MOVE, Solitare.OPENED_CARD_DECK, Solitare.BOARD_DECK_7); case 81: // Q return new PlayCommand(PlayCommand.MOVE, Solitare.BOARD_DECK_1, y); case 87: // W return new PlayCommand(PlayCommand.MOVE, Solitare.BOARD_DECK_2, y); case 69: // E return new PlayCommand(PlayCommand.MOVE, Solitare.BOARD_DECK_3, y); case 82: // R return new PlayCommand(PlayCommand.MOVE, Solitare.BOARD_DECK_4, y); case 84: // T return new PlayCommand(PlayCommand.MOVE, Solitare.BOARD_DECK_5, y); case 89: // Y return new PlayCommand(PlayCommand.MOVE, Solitare.BOARD_DECK_6, y); case 85: // U return new PlayCommand(PlayCommand.MOVE, Solitare.BOARD_DECK_7, y); case 79: // O case 44: // , return new PlayCommand(PlayCommand.OPEN, Solitare.PLAY_DECK, Solitare.PLAY_DECK); case 66: // B return new PlayCommand(PlayCommand.BACK, 0, 0); case 27: // ESC case 80: // P return new PlayCommand(PlayCommand.PAUSE, 0, 0); } } else if (event == CommandFactory.MOUSE_CLICK_EVENT) { } else { WinLog.i(TAG, "Unknown Event:" + Integer.toString(x) + " : " + Integer.toString(y)); } return null; } @Override public void addButtons() { WinLog.i(TAG, "addButtons"); } }
[ "chobocho99@gmail.com" ]
chobocho99@gmail.com
c0c557fcab0744f096c8ed5534020c20417d5d54
13c495cbcd0d66ec00643bf5dbef15a19709609b
/src/test/java/testUtils/ExpenseUtils_PWC.java
b6f14a38c953e6075075ef28f9a9c91326e185fe
[]
no_license
neerajnair72/hpy_suite
ad2e35d96c8c3adbadfdb6139b85eb7bea47ddf1
357371b7d00824108495319565579a3502ca7874
refs/heads/master
2023-08-15T00:49:26.647000
2021-09-16T07:17:34
2021-09-16T07:17:34
407,059,902
0
0
null
null
null
null
UTF-8
Java
false
false
2,933
java
/* package testUtils; import org.apache.poi.xssf.usermodel.XSSFRow; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.PageFactory; import frameworkBase.TestBotElementsWrapper; import frameworkBase.TestBotPageGenerator; import pageobjects.EmployeeViews.ExpensePage; public class ExpenseUtils_PWC extends ExpensePage { public ExpenseUtils_PWC() { //super(driver); // TODO Auto-generated constructor stub } @Override protected void load() { // TODO Auto-generated method stub super.load(); } @Override protected void isLoaded() throws Error { // TODO Auto-generated method stub super.isLoaded(); } @Override public ExpensePage get() { // TODO Auto-generated method stub return super.get(); } public ExpenseUtils_PWC() { super(driver); PageFactory.initElements(driver, this); pageWrapper = new TestBotElementsWrapper(driver); } public ExpensePage clickAddExpense() { pageWrapper.waitForElementToClickable(addExpense_Button_Xpath); pageWrapper.click_Actions(addExpense_Button_Xpath); return this; } public void fillTxnDetailsForNativeFields_PWC(XSSFRow rowData) { // TODO Auto-generated method stub pageWrapper.writeText(amount_TextField_ID, rowData.getCell(1).toString()); pageWrapper.writeText(spentAt_TextField_ID, rowData.getCell(2).toString()); pageWrapper.writeText(city_TextField_ID, rowData.getCell(4).toString()); pageWrapper.writeText(city_TextField_ID, Keys.ARROW_DOWN+""+ Keys.ENTER); //pageWrapper.writeKeyboardText(city_TextField_ID, Keys.ENTER); pageWrapper.shortWait(); pageWrapper.click_Actions(category_Select_Xpath); pageWrapper.waitForElementVisible(categorySearch_Text_Xpath); pageWrapper.click_Actions(categorySearch_Text_Xpath); pageWrapper.writeText(categorySearch_Text_Xpath, "Train and Bus"); pageWrapper.click_Actions(categoryTrainBusFare_xpath); //pageWrapper.click_Actions(PurposeTrain_dropdown_xpath); pageWrapper.waitForElementToClickable(PurposeTrain_dropdown_xpath); pageWrapper.click_Actions(PurposeTrain_dropdown_xpath); pageWrapper.waitForElementToClickable(AttendingTraining_xpath); pageWrapper.click_Actions(AttendingTraining_xpath); pageWrapper.waitForElementVisible(TrainingName_text_name); pageWrapper.waitForElementToClickable(TrainingName_text_name); pageWrapper.writeText(TrainingName_text_name, rowData.getCell(7).toString()); pageWrapper.ScrollToElement(Billavial_Dropdown_name); pageWrapper.waitForElementToClickable(Billavial_Dropdown_name); pageWrapper.click_Actions(Billavial_Dropdown_name); pageWrapper.waitForElementVisible(BillYes_select_xpath); pageWrapper.waitForElementToClickable(BillYes_select_xpath); pageWrapper.click_Actions(BillYes_select_xpath); pageWrapper.waitForElementVisible(BillNumber_text_xpath); pageWrapper.writeText(BillNumber_text_xpath, rowData.getCell(8).toString()); } } */
[ "neerajnair72@gmail.com" ]
neerajnair72@gmail.com
e07a98db385069c939fb9f2d3d9795b374fe7e4b
3aedb6b9d2d4240a4a49c62e3526d67921d62264
/OonusaveFinal/src/com/oonusave/coupon/util/ImageUtils.java
39b04022e381d6c81d196b201c11bf1f4c1b16fb
[]
no_license
mramesh/SampleRepos
afc5bfbb8309eeed14f4849ba482c347a2c10aba
72d2e670bbe2af519ffa9e6cb66cb671352a4503
refs/heads/master
2020-04-05T22:50:46.146736
2013-11-07T16:00:52
2013-11-07T16:00:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,819
java
package com.oonusave.coupon.util; import com.oonusave.coupon.R; /** * * @author Ramesh * */ public class ImageUtils { public static int getNextBtn() { return R.drawable.next_button ; } public static int getPrevBtn() { return R.drawable.previous_button ; } public static int getShowDirectionBtn() { return R.drawable.guide_me_button ; } public static int getSplashImage() { return R.drawable.bg ; } public static int getBackIamge() { return R.drawable.back_btn ; } public static int getReadmeIamge() { return R.drawable.readmore_btn; } public static int getSignUpImage() { return R.drawable.new_usersignup; } public static int getSubmitImage() { return R.drawable.submit ; } public static int getLoginImage() { return R.drawable.login_btn1 ; } public static int getSignoutImage() { return R.drawable.logout_btn ; } public static int getDemoUserImage() { return R.drawable.test_drive_btn; } public static int getSettingsImage() { return R.drawable.settings_btn; } public static int getAddToWalletBtnImage() { return R.drawable.add_to_wallet; } public static int getLocationBtnImage() { return R.drawable.location ; } public static int getRemoveFromWalletImage() { return R.drawable.remove_from_wallet_button; } public static int getTellAFriendBtnImage() { return R.drawable.tellafriend ; } public static int getUseCouponBtnImage() { return R.drawable.usethis_coupon ; } public static int getMyWalletBtnImage() { return R.drawable.mywallet_button; } public static int getCouponsBtnImage() { return R.drawable.coupons_button ; } public static int getCategoriesBtnImage() { return R.drawable.category_button ; } public static int getSubCategoriesBtnImage() { return R.drawable.subcategories_button ; } public static int getRateThisAppBtnImage() { return R.drawable.rate_this_app_btn; } public static int getReportABugBtnImage() { return R.drawable.report_a_bug_btn; } public static int getMyStoreBtnImage() { return R.drawable.mystores_button; } public static int getStoreBtnImage() { return R.drawable.button_storelist; } public static int getMapBtnImage() { return R.drawable.map_btn; } public static int getWebsiteBtnImage() { return R.drawable.website_btn; } public static int getAddFavStoreBtnImage() { return R.drawable.add_favorite_btn; } public static int getRemoveFavStoreBtnImage() { return R.drawable.remove_favorite_store_btn; } public static int getTrackAndShareBtnImage() { return R.drawable.track_saving_btn; } public static int getCouponNotFoundBgImage() { return R.drawable.coupon_notfound; } public static int getMyWalletNotFoundBgImage() { return R.drawable.mywallet_coupon_notfound; } public static int getStoresNotFoundBgImage() { return R.drawable.store_notfound; } public static int getFavStoresNotFoundBgImage() { return R.drawable.fav_store_notfound ; } public static int getUsedCouponNotFoundBgImage() { return R.drawable.usedcoupon_notfound; } // Signup screen public static int getPersonalDetailsTabNormalImage() { return R.drawable.personal_details; } public static int getPersonalDetailsTabSelectedImage() { return R.drawable.personal_details_selected ; } public static int getAccountDetailsTabNormalImage() { return R.drawable.account_details ; } public static int getAccountDetailsTabSelectedImage() { return R.drawable.account_details_selected; } public static int getNotificationDetailsTabNormalImage() { return R.drawable.notification_details; } public static int getNotificationDetailsTabSelectedImage() { return R.drawable.notification_details_selected; } }
[ "ramesh.murugaswamy@gmail.com" ]
ramesh.murugaswamy@gmail.com
2a87048523dc6557fc584347daa4f130515638ce
8198e072c57005c2c5c25aec854c1ac1ef0ba5a4
/app/src/test/java/com/example/sifatsifatrasul/ExampleUnitTest.java
5c4b0cba71a08a3767e0bd4740b89a469ed0c2ff
[]
no_license
sintawahyuniritonga/Utssinta
4f62ee732767d8689c9ed89e6d7ee1263ffc4182
a5de08a92c3b86e3514cc71af937619adcac744c
refs/heads/master
2023-06-21T16:08:30.638348
2021-07-12T05:49:08
2021-07-12T05:49:08
385,136,272
0
0
null
null
null
null
UTF-8
Java
false
false
388
java
package com.example.sifatsifatrasul; 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); } }
[ "sintawahyuni0911@gmail.com" ]
sintawahyuni0911@gmail.com
f69c37aa8f24efd4d5e01910643d0cf83059e1ef
08ff5809da92511d7364e3b03f6f7f8006d63802
/src/main/java/com/tang/spring/frame/ioc/reader/XmlBeanDefinitionDocumentReader.java
4234fc200884a1c72756c181d5504fad6b042c06
[]
no_license
heguitang1214/spring-mini
c419c60ccda8cc761b4befb98fdc2d858fbaea65
26771f994be9827f603173b9682107f96e901063
refs/heads/master
2023-07-08T21:17:22.469301
2021-08-26T04:58:01
2021-08-26T04:58:01
286,459,848
0
0
null
null
null
null
UTF-8
Java
false
false
5,436
java
package com.tang.spring.frame.ioc.reader; import com.tang.spring.frame.common.Constant; import com.tang.spring.frame.ioc.config.*; import com.tang.spring.frame.ioc.registry.BeanDefinitionRegistry; import com.tang.spring.frame.utils.ReflectUtils; import org.dom4j.Element; import java.util.List; /** * 针对Document对于的InputStream流对象进行解析 * 解析XML文件 * * @author heguitang */ public class XmlBeanDefinitionDocumentReader { private BeanDefinitionRegistry registry; public XmlBeanDefinitionDocumentReader(BeanDefinitionRegistry registry) { this.registry = registry; } /** * 从根元素进行注册 * * @param rootElement 根元素 */ public void registerBeanDefinitions(Element rootElement) { // 获取<bean>和自定义标签(比如mvc:interceptors) List<Element> elements = rootElement.elements(); for (Element element : elements) { // 获取标签名称 String name = element.getName(); if (name.equals(Constant.BEAN)) { // 解析默认标签,其实也就是bean标签 parseDefaultElement(element); } else { // 解析自定义标签,比如aop:aspect标签 parseCustomElement(element); } } } /** * 默认标签的处理 * * @param beanElement 元素标签 */ private void parseDefaultElement(Element beanElement) { try { if (beanElement == null) { return; } // 获取id属性 String id = beanElement.attributeValue(Constant.ID); // 获取name属性 String name = beanElement.attributeValue(Constant.NAME); // 获取class属性 String clazzName = beanElement.attributeValue(Constant.ATTR_CLASS); if (clazzName == null || "".equals(clazzName)) { return; } // 获取init-method属性 String initMethod = beanElement.attributeValue(Constant.INIT_METHOD); // 获取scope属性 String scope = beanElement.attributeValue(Constant.SCOPE); // scope = scope != null && !scope.equals("") ? scope : "singleton"; if (scope == null || "".equals(scope)) { scope = Constant.SINGLETON; } // 获取beanName String beanName = id == null ? name : id; Class<?> clazzType = Class.forName(clazzName); beanName = beanName == null ? clazzType.getSimpleName() : beanName; // 创建BeanDefinition对象 // 此次可以使用构建者模式进行优化 BeanDefinition beanDefinition = new BeanDefinition(clazzName, beanName); beanDefinition.setInitMethod(initMethod); beanDefinition.setScope(scope); // 获取property子标签集合 List<Element> propertyElements = beanElement.elements(); for (Element propertyElement : propertyElements) { parsePropertyElement(beanDefinition, propertyElement); } // 注册BeanDefinition信息 registry.registerBeanDefinition(beanName, beanDefinition); } catch (ClassNotFoundException e) { e.printStackTrace(); } } /** * 解析标签属性,然后将其赋值给bean的定义实体 * * @param beanDefination bean的定义 * @param propertyElement 标签属性 */ private void parsePropertyElement(BeanDefinition beanDefination, Element propertyElement) { if (propertyElement == null) { return; } // 获取name属性 String name = propertyElement.attributeValue(Constant.NAME); // 获取value属性 String value = propertyElement.attributeValue(Constant.VALUE); // 获取ref属性 String ref = propertyElement.attributeValue(Constant.REF); // 如果value和ref都有值,则返回 if (value != null && !"".equals(value) && ref != null && !"".equals(ref)) { return; } // PropertyValue就封装着一个property标签的信息 PropertyValue pv = null; if (value != null && !"".equals(value)) { // 因为spring配置文件中的value是String类型,而对象中的属性值是各种各样的,所以需要存储类型 TypedStringValue typeStringValue = new TypedStringValue(value); Class<?> targetType = ReflectUtils.getTypeByFieldName(beanDefination.getClazzName(), name); typeStringValue.setTargetType(targetType); pv = new PropertyValue(name, typeStringValue); beanDefination.addPropertyValue(pv); } else if (ref != null && !"".equals(ref)) { RuntimeBeanReference reference = new RuntimeBeanReference(ref); pv = new PropertyValue(name, reference); beanDefination.addPropertyValue(pv); } else { // todo 其他类型的处理 System.out.println("其他类型的处理"); return; } } /** * 自定义标签的解析流程 * * @param element 元素信息 */ private void parseCustomElement(Element element) { // AOP、TX、MVC标签的解析,都是走该流程 } }
[ "he_guitang@163.com" ]
he_guitang@163.com
9cc7095fc07194e443968065c3a6984695b29e2b
b8f92be8c13011e1adfd2572cd87af3f650ed246
/MyLearning/src/com/observerDesignPattern/ObserverPatternDemo.java
8ea2644f7d4911a0928cefa9bd3dfa94dd9152b8
[]
no_license
sonam-2704/MyLearningProject
9fc81c27b90bc5e464f9abf7a0ff4d2ce8e83e37
75426d3240838d976096d287d38df988276f6df3
refs/heads/master
2020-04-04T22:37:59.960631
2019-12-18T07:37:52
2019-12-18T07:37:52
156,330,132
0
0
null
null
null
null
UTF-8
Java
false
false
311
java
package com.observerDesignPattern; public class ObserverPatternDemo { public static void main(String[] args) { Subject objSubject = new Subject(); Observer1 observer1 = new Observer1(objSubject); Observer2 observer2 = new Observer2(objSubject); objSubject.setState(10); } }
[ "mittal.sonam2704@gmail.com" ]
mittal.sonam2704@gmail.com
4f52410ec2739897943e1753081051f03894e77a
d9350734dabb647c9ecdd2db8a99b8aa61825738
/java/gigasecond/src/main/java/Gigasecond.java
82884109a7c1a16007bc560985119ad07e6a7cc9
[]
no_license
SFoskitt/MyExercism
a51752cf4e3126d6ef31676fa0a91c8a42d920e3
38cff01aac6ecb262a1a17dfc7bddcaf37337ff5
refs/heads/master
2023-01-25T05:39:13.636756
2022-07-12T00:27:48
2022-07-12T00:27:48
80,273,971
0
0
null
2023-01-12T05:57:28
2017-01-28T08:19:55
Makefile
UTF-8
Java
false
false
397
java
import java.time.LocalDate; import java.time.LocalDateTime; class Gigasecond { Long GIGASECOND = 1000000000L; LocalDateTime gigMoment; Gigasecond(LocalDate moment) { gigMoment = moment.atStartOfDay(); } Gigasecond(LocalDateTime moment) { gigMoment = moment; } LocalDateTime getDateTime() { return gigMoment.plusSeconds(GIGASECOND); } }
[ "stephanie.foskitt@gmail.com" ]
stephanie.foskitt@gmail.com
c78c89d04b9c0a1a7354c1a853fede873cb05c39
f5dee8d511ec4f547ef3f0f25d63306877e6baed
/src/main/java/JLabelC.java
dd19728b71a7397508dbdf238e73ea872d4494b0
[]
no_license
ArielSalazar04/NumericalIntegration
db923b97aa31291725c58fadd90ec063e8853fae
7f0ab164357fada8890de064f96ca6bc58d299d4
refs/heads/master
2023-02-04T00:45:13.987165
2020-12-22T02:19:11
2020-12-22T02:19:11
310,408,561
1
0
null
2020-12-22T02:19:12
2020-11-05T20:20:55
Java
UTF-8
Java
false
false
330
java
import javax.swing.JLabel; import javax.swing.SwingConstants; import java.awt.Font; public class JLabelC extends JLabel { public JLabelC (String text, boolean isTitle){ super(text, SwingConstants.CENTER); this.setFont((isTitle) ? new Font("Serif", Font.BOLD, 36) : new Font("Serif", Font.PLAIN, 20)); } }
[ "arielsalazar@Ariels-MBP.lan" ]
arielsalazar@Ariels-MBP.lan
9c40cb7ccf622b69f1631f125cb42cd1174a83d2
8a7bbee2894e327b29f29e8d26317d993659f6b6
/src/main/java/kodlamaio/hrms/business/abstracts/JobAdvertisementService.java
12da338fb2f8a3576a19130a51ae5ebf32761e9d
[]
no_license
alizadeMehmed/HRMS
3bc02aab8d3bba96eb8a637b73adeeac93d3b570
0ca61fcf2befc9240fb1f86f6c741de75138865d
refs/heads/master
2023-05-31T06:13:14.091418
2021-06-18T11:40:21
2021-06-18T11:40:21
371,696,763
2
0
null
null
null
null
UTF-8
Java
false
false
1,109
java
package kodlamaio.hrms.business.abstracts; import java.util.List; import org.springframework.stereotype.Service; import kodlamaio.hrms.core.utilities.results.DataResult; import kodlamaio.hrms.core.utilities.results.Result; import kodlamaio.hrms.entities.concretes.Employer; import kodlamaio.hrms.entities.concretes.JobAdvertisement; import kodlamaio.hrms.entities.dtos.JobAdvertisementWithDetailsDto; @Service public interface JobAdvertisementService { Result add(JobAdvertisement jobAdvertisement); Result deleteByName(String name); Result deactivate(String name); DataResult<List<JobAdvertisement>> getAll(); DataResult<List<JobAdvertisementWithDetailsDto>> jobAdvertisementWithDetails(); DataResult<List<JobAdvertisementWithDetailsDto>> getByIsActive(boolean isActive); DataResult<List<JobAdvertisementWithDetailsDto>> getAllByIsActiveAndEmployer(boolean isActive, String companyName); DataResult<List<JobAdvertisementWithDetailsDto>> getAllSortedByPostingDateAsc(); DataResult<List<JobAdvertisementWithDetailsDto>> getAllSortedByPostingDateDesc(); }
[ "mehmetparlak01@gmail.com" ]
mehmetparlak01@gmail.com
827562466e618635fcc587bb7d4f8b34714f4131
2e0661f5b91785c05b6f00708c1043aacaa34f14
/src/test/java/com/example/ejercicioapiproductos/EjercicioApiProductosApplicationTests.java
29051d9032eba16568617d989a505ab9f4a166b9
[]
no_license
Evelyncntrrs/EjercicioAPIProductos
f8a1226f57b36fefb35f698d513e42a4d00801ee
21c3de4658d74232c48ef6f814e698fa2b13f00c
refs/heads/master
2023-07-10T07:30:42.913502
2021-07-27T23:28:35
2021-07-27T23:28:35
390,155,548
0
0
null
null
null
null
UTF-8
Java
false
false
249
java
package com.example.ejercicioapiproductos; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class EjercicioApiProductosApplicationTests { @Test void contextLoads() { } }
[ "evelyn.contrerasmn@gmail.com" ]
evelyn.contrerasmn@gmail.com
c6fa84ce20da12f9c34c4907ef9c765950a5ac54
09b2411ad8eb68536fc5cbabc1118d78ea56b49a
/Callenge3/app/src/main/java/com/example/android/callenge3/MainActivity.java
02c4a06e80bbd073931b44b0666480eda4c4322f
[]
no_license
nofarbardugo/android_100_challenge
a4f8c10d3e01a979e0cc1f01c306be124ad21f19
663431b83e7c5728418efa16da82c1122662de10
refs/heads/master
2021-05-07T00:00:08.354066
2017-11-09T12:57:21
2017-11-09T12:57:21
110,083,456
0
0
null
2017-11-09T12:06:29
2017-11-09T07:43:32
Java
UTF-8
Java
false
false
1,219
java
package com.example.android.callenge3; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.TextView; public class MainActivity extends AppCompatActivity { TextView mDisplayText; Spinner mSpinner; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Create an ArrayAdapter using the string array and a default spinner layout ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.planets_array, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner mSpinner = findViewById(R.id.spinner); mSpinner.setAdapter(adapter); mDisplayText = findViewById(R.id.tv_display_text); } public void onClick(View view) { mDisplayText.setText(mSpinner.getSelectedItem().toString()); } }
[ "nofarb@checkpoint.com" ]
nofarb@checkpoint.com
76c643a18b8e70c8caed747ba17bf3cf9e805378
83eccecf660fa510fcac22617fc211b62be88a7f
/JPWP-Zadania-Głowinska-Kułacz/Zad3/Algorytmika/src/game/Game.java
f2fe70f72fda9814f1212e997532bb01473f48a7
[]
no_license
kannam12/JPWP-Zadania
c19a4f88649400182aefd94a89a498a1b29d0438
fa8525904be73062c3ab466ff450ccc4f6aa89e3
refs/heads/master
2022-09-03T00:07:09.557143
2020-05-25T11:55:12
2020-05-25T11:55:12
259,596,920
1
0
null
2020-05-12T15:45:38
2020-04-28T09:53:22
Java
UTF-8
Java
false
false
815
java
package game; import game.pieces.Color; import game.pieces.Piece; public class Game { private final Board board = new Board(); public Board getBoard() { return this.board; } public boolean move(Movement movement) { if (!isValidMovement(movement)) { return false; } Piece piece = board.at(movement.getOrigin()); piece.setMoved(); board.move(movement); return true; } public boolean isValidMovement(Movement movement) { ///// FIXME if (board.at(movement.getOrigin()).getColor() == board.at(movement.getTarget()).getColor()) { return false; } return board.at(movement.getOrigin()).isValidMovement(this, movement); //zwraca czy pionek pod wskazana pozycja moze sie ruszyc } }
[ "kannam12@github.com" ]
kannam12@github.com