blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f3f06e454b7523f5fb6d3e018b4bca1626bf0f01 | 262b91ee24fd9ff49aa0f74aa9f3867cb13b63e8 | /USACO/Training/Chapter1/Section1/ride.java | a3dbe400d5676903ec5f478ee2a24f372273ff40 | [] | no_license | Senpat/Competitive-Programming | ec169b1ed9ee85186768b72479b38391df9234b3 | d13731811eb310fb3d839e9a8e8200975d926321 | refs/heads/master | 2023-06-23T01:25:35.209727 | 2023-06-15T02:55:48 | 2023-06-15T02:55:48 | 146,513,522 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 943 | java | /*
ID: patrickgzhang
LANG: JAVA
TASK: ride
*/
import java.util.*;
import java.io.*;
class ride{
public static void main(String[] args) throws IOException{
BufferedReader f = new BufferedReader(new FileReader("ride.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("ride.out")));
StringTokenizer st = new StringTokenizer(f.readLine());
String a1 = st.nextToken();
StringTokenizer st2 = new StringTokenizer(f.readLine());
String a2 = st2.nextToken();
int i1 = 1;
for(int k = 0; k < a1.length(); k++){
i1 *= (a1.charAt(k) - 'A' + 1);
}
int i2 = 1;
for(int k = 0; k < a2.length(); k++){
i2 *= (a2.charAt(k) - 'A' + 1);
}
System.out.println(i1 + " " + i2);
if(i1 % 47 == i2 % 47){
out.println("GO");
} else {
out.println("STAY");
}
out.close();
}
} | [
"[email protected]"
] | |
160129da49c52143f41aec3da5e904852a8e35b5 | 49eae4d0e91eda8a29d6af89217acb55ac44fe10 | /src/garen/java/demo/demo07/day12/EmployeeDemo/Network.java | 5494d5b7d933bffa41a9855a738c69aa2a272e08 | [] | no_license | Garen2994/Java-learning-demo | effaeea0837c3314d2b649fba16283cd2aa7a673 | e0507c031ecb0abc79e12e1a7aad103f61b5dcfa | refs/heads/master | 2020-06-27T17:11:54.148500 | 2019-12-16T09:24:26 | 2019-12-16T09:24:26 | 200,005,632 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | package garen.java.demo.demo07.day12.EmployeeDemo;
public class Network extends Maintainer{
public Network() {
}
public Network(String id, String name) {
super(id, name);
}
@Override
public void work() {
System.out.println("员工号为" + this.getId() +" 的" +this.getName() + "员工,正在检查网络是否畅通");
}
}
| [
"[email protected]"
] | |
19af8f4e3794c4a7a4ffcc3d32fa81c7ac5004bd | 109d82f4419c73510564c868e6bd3305997cfd8d | /asktao/src/main/java/com/dragon/asktao/config/CommonResponse.java | 3fadfadaa22fde884049030fc1140d389eb79df4 | [] | no_license | menglinxi/asktao | f9dac2d57bda9a5fa29176abafb6a96ad4149875 | b33490f973362cba516cbcc430065025c94219c4 | refs/heads/master | 2022-03-22T09:24:35.529773 | 2019-12-14T15:06:14 | 2019-12-14T15:06:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,110 | java | package com.dragon.asktao.config;
import com.dragon.asktao.common.view.CommonResult;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
@RestControllerAdvice
public class CommonResponse implements ResponseBodyAdvice<Object> {
@Override
public boolean supports(MethodParameter methodParameter, Class<? extends HttpMessageConverter<?>> aClass) {
return true;
}
@Override
public Object beforeBodyWrite(Object returnValue, MethodParameter methodParameter, MediaType mediaType, Class<? extends HttpMessageConverter<?>> aClass, ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse) {
CommonResult commonResult = new CommonResult(returnValue);
return commonResult;
}
}
| [
"[email protected]"
] | |
5db3bf72d5064c1754f43d615abe2ac166c38ca4 | 9209558f3d58608b6478e5cb99ae1864b8db3915 | /butterfly-common/src/main/java/org/butterfly/common/core/enumeration/CodeByteEnum.java | fd922d16cc7041eed9607b8891f2061f67b455e0 | [] | no_license | alfredcao/butterfly | bb20f12863c31beebb6058229d0d90a4dee0fa7d | 07d7a14dadc5c93b1768f7d4f5a9b6fb5a2228d4 | refs/heads/master | 2022-09-24T00:27:52.195975 | 2019-11-03T09:22:14 | 2019-11-03T09:22:14 | 214,381,570 | 0 | 0 | null | 2022-09-01T23:13:55 | 2019-10-11T08:17:07 | Java | UTF-8 | Java | false | false | 163 | java | package org.butterfly.common.core.enumeration;
/**
* 包含code字段(字节类型)的枚举类型
*/
public interface CodeByteEnum {
byte getCode();
}
| [
"[email protected]"
] | |
c2cc5097fd47f3cc34e67e6c26847bd6d0006be3 | 213b4ff8b8198c6006699565e97046b5a4349c09 | /src/org/jmin/bee/test/type/Druid.java | fe64c6135cdd9b034173362cf3caf2051a3b2be5 | [] | no_license | performance12345/PoolPerformance | b07e65abf299594cc0c8c4f8ef4c58ced64b8978 | ad50dd51919595424672e7713c56241af8bde2f7 | refs/heads/master | 2022-01-20T13:13:04.691813 | 2019-08-03T03:32:05 | 2019-08-03T03:32:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,051 | java | package org.jmin.bee.test.type;
import org.jmin.bee.test.Link;
import com.alibaba.druid.pool.DruidDataSource;
/**
* product from Chinese alibaba
*/
public class Druid {
public static DruidDataSource createDataSource() {
DruidDataSource datasource = new DruidDataSource();
datasource.setUrl(Link.JDBC_URL);
datasource.setUsername(Link.JDBC_USER);
datasource.setPassword(Link.JDBC_PASSWORD);
datasource.setDriverClassName(Link.JDBC_DRIVER);
datasource.setMaxActive(Link.POOL_MAX_ACTIVE);
datasource.setMinIdle(Link.POOL_MIN_ACTIVE);
datasource.setInitialSize(Link.POOL_INIT_SIZE);
datasource.setPoolPreparedStatements(true);
datasource.setMaxPoolPreparedStatementPerConnectionSize(20);
// datasource.setMinEvictableIdleTimeMillis(3000000);
// datasource.setMaxWaitThreadCount(1000000);
datasource.setMaxWait(Link.REQUEST_TIMEOUT);
datasource.setTestOnBorrow(true);
datasource.setTestOnReturn(false);
datasource.setValidationQuery("select 1 from dual");
return datasource;
}
}
| [
"[email protected]"
] | |
b398971c65db32be4368905e3c30485cb5a85fa3 | 6518283116f4870feb65088f29d5bd74c437bcc6 | /src/test/ScrabbleScorrerTest.java | 8f3ac5b186318ab8d9d1fd52acc62daf3d4665ed | [] | no_license | Yonkokilasi/scrabble | c9cb1f85ae3df0fb956c1087e27d56252684a243 | 0e79821fd201ecefa8441e1deafb08a87fbdc126 | refs/heads/master | 2021-01-19T22:40:59.524673 | 2017-04-20T09:53:43 | 2017-04-20T09:53:43 | 88,842,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 348 | java | import org.junit.*;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
public class ScrabbleScorrerTest {
@Test
public void calculateScore_returnsScoreForSingleLetter_1() {
Scrabble testScrabble = new Scrabble();
Integer expected = 1;
assertEquals(expected, testScrabble.calculateScore("a"));
}
}
| [
"[email protected]"
] | |
33ad6bf7ff5e7224922c8f5778257a8fb83e5d08 | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/Time-3/org.joda.time.MutableDateTime/BBC-F0-opt-60/3/org/joda/time/MutableDateTime_ESTest_scaffolding.java | e002d8fa349e37688aec99d9b9b6dc348e5f89c4 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 22,951 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Tue Oct 19 22:52:50 GMT 2021
*/
package org.joda.time;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
import static org.evosuite.shaded.org.mockito.Mockito.*;
@EvoSuiteClassExclude
public class MutableDateTime_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.joda.time.MutableDateTime";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
try { initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {}
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("user.timezone", "Etc/UTC");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MutableDateTime_ESTest_scaffolding.class.getClassLoader() ,
"org.joda.time.DateTimeZone",
"org.joda.time.field.AbstractPartialFieldProperty",
"org.joda.time.field.StrictDateTimeField",
"org.joda.time.convert.ConverterSet$Entry",
"org.joda.time.DateTimeFieldType$StandardDateTimeFieldType",
"org.joda.time.chrono.BasicChronology$HalfdayField",
"org.joda.time.chrono.BasicChronology$YearInfo",
"org.joda.time.LocalDate$Property",
"org.joda.time.field.UnsupportedDurationField",
"org.joda.time.format.PeriodFormatterBuilder",
"org.joda.time.format.DateTimePrinter",
"org.joda.time.chrono.ISOChronology",
"org.joda.time.base.BaseLocal",
"org.joda.time.chrono.LenientChronology",
"org.joda.time.format.PeriodFormatterBuilder$FieldFormatter",
"org.joda.time.field.DividedDateTimeField",
"org.joda.time.convert.DateConverter",
"org.joda.time.chrono.ZonedChronology",
"org.joda.time.format.DateTimeFormatterBuilder$TimeZoneOffset",
"org.joda.time.field.BaseDateTimeField",
"org.joda.time.field.ZeroIsMaxDateTimeField",
"org.joda.time.base.BaseInterval",
"org.joda.time.Duration",
"org.joda.time.format.FormatUtils",
"org.joda.time.format.PeriodFormatter",
"org.joda.time.Interval",
"org.joda.time.convert.LongConverter",
"org.joda.time.base.AbstractInstant",
"org.joda.time.tz.DateTimeZoneBuilder",
"org.joda.time.format.DateTimeParserBucket",
"org.joda.time.ReadWritablePeriod",
"org.joda.time.convert.ConverterSet",
"org.joda.time.LocalDateTime",
"org.joda.time.tz.FixedDateTimeZone",
"org.joda.time.base.BasePeriod$1",
"org.joda.time.convert.IntervalConverter",
"org.joda.time.format.PeriodPrinter",
"org.joda.time.field.PreciseDateTimeField",
"org.joda.time.chrono.LimitChronology$LimitException",
"org.joda.time.convert.ReadableDurationConverter",
"org.joda.time.base.BaseDuration",
"org.joda.time.field.DecoratedDateTimeField",
"org.joda.time.Months",
"org.joda.time.YearMonthDay",
"org.joda.time.format.DateTimeParser",
"org.joda.time.format.DateTimeFormatterBuilder$CharacterLiteral",
"org.joda.time.chrono.GJChronology$CutoverField",
"org.joda.time.LocalTime$Property",
"org.joda.time.field.OffsetDateTimeField",
"org.joda.time.DateTime$Property",
"org.joda.time.convert.ReadablePeriodConverter",
"org.joda.time.Years",
"org.joda.time.convert.ReadableIntervalConverter",
"org.joda.time.DateTimeField",
"org.joda.time.field.FieldUtils",
"org.joda.time.Partial",
"org.joda.time.format.ISODateTimeFormat",
"org.joda.time.field.SkipDateTimeField",
"org.joda.time.base.AbstractPeriod",
"org.joda.time.chrono.GJDayOfWeekDateTimeField",
"org.joda.time.DateTimeUtils$SystemMillisProvider",
"org.joda.time.IllegalFieldValueException",
"org.joda.time.IllegalInstantException",
"org.joda.time.format.DateTimeFormatterBuilder$Composite",
"org.joda.time.format.DateTimeFormatterBuilder$UnpaddedNumber",
"org.joda.time.field.ImpreciseDateTimeField$LinkedDurationField",
"org.joda.time.ReadablePeriod",
"org.joda.time.chrono.ZonedChronology$ZonedDateTimeField",
"org.joda.time.chrono.GregorianChronology",
"org.joda.time.convert.ConverterManager",
"org.joda.time.chrono.GJChronology$LinkedDurationField",
"org.joda.time.Minutes",
"org.joda.time.format.DateTimeFormatterBuilder$PaddedNumber",
"org.joda.time.chrono.BasicMonthOfYearDateTimeField",
"org.joda.time.base.AbstractPartial",
"org.joda.time.base.BasePartial",
"org.joda.time.base.BaseDateTime",
"org.joda.time.base.AbstractDuration",
"org.joda.time.DateTimeUtils",
"org.joda.time.base.AbstractInterval",
"org.joda.time.LocalTime",
"org.joda.time.Hours",
"org.joda.time.base.BasePeriod",
"org.joda.time.field.DecoratedDurationField",
"org.joda.time.tz.DateTimeZoneBuilder$DSTZone",
"org.joda.time.format.DateTimeFormat$1",
"org.joda.time.TimeOfDay",
"org.joda.time.format.ISOPeriodFormat",
"org.joda.time.Partial$Property",
"org.joda.time.field.ImpreciseDateTimeField",
"org.joda.time.chrono.CopticChronology",
"org.joda.time.field.PreciseDurationField",
"org.joda.time.DateTimeUtils$FixedMillisProvider",
"org.joda.time.tz.DateTimeZoneBuilder$OfYear",
"org.joda.time.ReadableDuration",
"org.joda.time.chrono.BasicGJChronology",
"org.joda.time.format.DateTimeFormatterBuilder$NumberFormatter",
"org.joda.time.format.DateTimeFormatter",
"org.joda.time.DurationField",
"org.joda.time.chrono.IslamicChronology$LeapYearPatternType",
"org.joda.time.DateTime",
"org.joda.time.format.PeriodFormatterBuilder$SimpleAffix",
"org.joda.time.ReadWritableDateTime",
"org.joda.time.convert.PeriodConverter",
"org.joda.time.chrono.ZonedChronology$ZonedDurationField",
"org.joda.time.Instant",
"org.joda.time.convert.CalendarConverter",
"org.joda.time.format.PeriodFormatterBuilder$Separator",
"org.joda.time.chrono.LimitChronology$LimitDurationField",
"org.joda.time.chrono.BasicDayOfYearDateTimeField",
"org.joda.time.DurationFieldType$StandardDurationFieldType",
"org.joda.time.chrono.BuddhistChronology",
"org.joda.time.format.DateTimeFormatterBuilder$StringLiteral",
"org.joda.time.tz.DateTimeZoneBuilder$Recurrence",
"org.joda.time.format.ISODateTimeFormat$Constants",
"org.joda.time.convert.ReadablePartialConverter",
"org.joda.time.DateTimeUtils$MillisProvider",
"org.joda.time.DateTimeUtils$OffsetMillisProvider",
"org.joda.time.convert.Converter",
"org.joda.time.chrono.GJYearOfEraDateTimeField",
"org.joda.time.convert.PartialConverter",
"org.joda.time.Seconds",
"org.joda.time.field.RemainderDateTimeField",
"org.joda.time.JodaTimePermission",
"org.joda.time.chrono.BasicWeekOfWeekyearDateTimeField",
"org.joda.time.DateTimeFieldType",
"org.joda.time.format.DateTimeFormatterBuilder$Fraction",
"org.joda.time.format.DateTimeFormatterBuilder$FixedNumber",
"org.joda.time.MutableDateTime$Property",
"org.joda.time.ReadableInterval",
"org.joda.time.chrono.LimitChronology$LimitDateTimeField",
"org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone",
"org.joda.time.field.LenientDateTimeField",
"org.joda.time.base.AbstractDateTime",
"org.joda.time.field.SkipUndoDateTimeField",
"org.joda.time.convert.AbstractConverter",
"org.joda.time.field.DelegatedDateTimeField",
"org.joda.time.chrono.BasicChronology",
"org.joda.time.chrono.BasicYearDateTimeField",
"org.joda.time.format.DateTimeFormatterBuilder",
"org.joda.time.chrono.EthiopicChronology",
"org.joda.time.tz.CachedDateTimeZone$Info",
"org.joda.time.PeriodType",
"org.joda.time.field.MillisDurationField",
"org.joda.time.chrono.GJChronology",
"org.joda.time.chrono.IslamicChronology",
"org.joda.time.chrono.BasicFixedMonthChronology",
"org.joda.time.field.UnsupportedDateTimeField",
"org.joda.time.field.ScaledDurationField",
"org.joda.time.chrono.ISOYearOfEraDateTimeField",
"org.joda.time.field.PreciseDurationDateTimeField",
"org.joda.time.MutablePeriod",
"org.joda.time.MutableDateTime",
"org.joda.time.tz.CachedDateTimeZone",
"org.joda.time.ReadableDateTime",
"org.joda.time.format.PeriodFormatterBuilder$Literal",
"org.joda.time.format.PeriodParser",
"org.joda.time.DateMidnight",
"org.joda.time.convert.DurationConverter",
"org.joda.time.chrono.GJMonthOfYearDateTimeField",
"org.joda.time.format.DateTimeParserBucket$SavedState",
"org.joda.time.chrono.BasicWeekyearDateTimeField",
"org.joda.time.Days",
"org.joda.time.format.DateTimeFormatterBuilder$MatchingParser",
"org.joda.time.chrono.BasicSingleEraDateTimeField",
"org.joda.time.format.DateTimeFormat",
"org.joda.time.chrono.LimitChronology",
"org.joda.time.ReadableInstant",
"org.joda.time.base.BaseSingleFieldPeriod",
"org.joda.time.convert.NullConverter",
"org.joda.time.tz.DefaultNameProvider",
"org.joda.time.tz.Provider",
"org.joda.time.chrono.AssembledChronology$Fields",
"org.joda.time.DurationFieldType",
"org.joda.time.ReadWritableInstant",
"org.joda.time.tz.NameProvider",
"org.joda.time.convert.ReadableInstantConverter",
"org.joda.time.convert.StringConverter",
"org.joda.time.convert.InstantConverter",
"org.joda.time.chrono.AssembledChronology",
"org.joda.time.chrono.StrictChronology",
"org.joda.time.chrono.GJEraDateTimeField",
"org.joda.time.tz.ZoneInfoProvider",
"org.joda.time.DateTimeZone$1",
"org.joda.time.chrono.BaseChronology",
"org.joda.time.chrono.JulianChronology",
"org.joda.time.Period",
"org.joda.time.Weeks",
"org.joda.time.Chronology",
"org.joda.time.format.PeriodFormatterBuilder$Composite",
"org.joda.time.field.AbstractReadableInstantFieldProperty",
"org.joda.time.format.PeriodFormatterBuilder$PeriodFieldAffix",
"org.joda.time.LocalDate",
"org.joda.time.format.DateTimeParserBucket$SavedField",
"org.joda.time.chrono.BasicDayOfMonthDateTimeField",
"org.joda.time.ReadablePartial",
"org.joda.time.chrono.GJChronology$ImpreciseCutoverField",
"org.joda.time.field.BaseDurationField"
);
}
private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException {
mock(Class.forName("org.joda.time.DateTimeUtils$MillisProvider", false, MutableDateTime_ESTest_scaffolding.class.getClassLoader()));
mock(Class.forName("org.joda.time.format.DateTimeParser", false, MutableDateTime_ESTest_scaffolding.class.getClassLoader()));
mock(Class.forName("org.joda.time.format.DateTimePrinter", false, MutableDateTime_ESTest_scaffolding.class.getClassLoader()));
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MutableDateTime_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"org.joda.time.base.AbstractInstant",
"org.joda.time.base.AbstractDateTime",
"org.joda.time.base.BaseDateTime",
"org.joda.time.MutableDateTime",
"org.joda.time.field.AbstractReadableInstantFieldProperty",
"org.joda.time.MutableDateTime$Property",
"org.joda.time.format.DateTimeFormatterBuilder",
"org.joda.time.DateTimeFieldType$StandardDateTimeFieldType",
"org.joda.time.DurationFieldType$StandardDurationFieldType",
"org.joda.time.DurationFieldType",
"org.joda.time.DateTimeFieldType",
"org.joda.time.format.DateTimeFormatterBuilder$NumberFormatter",
"org.joda.time.format.DateTimeFormatterBuilder$PaddedNumber",
"org.joda.time.format.DateTimeFormatter",
"org.joda.time.format.DateTimeFormatterBuilder$CharacterLiteral",
"org.joda.time.format.DateTimeFormatterBuilder$Composite",
"org.joda.time.format.DateTimeFormatterBuilder$StringLiteral",
"org.joda.time.format.DateTimeFormatterBuilder$UnpaddedNumber",
"org.joda.time.format.DateTimeFormatterBuilder$Fraction",
"org.joda.time.format.DateTimeFormatterBuilder$TimeZoneOffset",
"org.joda.time.format.ISODateTimeFormat",
"org.joda.time.format.DateTimeFormatterBuilder$FixedNumber",
"org.joda.time.format.DateTimeFormatterBuilder$MatchingParser",
"org.joda.time.tz.FixedDateTimeZone",
"org.joda.time.tz.ZoneInfoProvider",
"org.joda.time.tz.DefaultNameProvider",
"org.joda.time.DateTimeZone",
"org.joda.time.format.ISODateTimeFormat$Constants",
"org.joda.time.DateTimeUtils$SystemMillisProvider",
"org.joda.time.tz.DateTimeZoneBuilder",
"org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone",
"org.joda.time.tz.DateTimeZoneBuilder$DSTZone",
"org.joda.time.tz.DateTimeZoneBuilder$Recurrence",
"org.joda.time.tz.DateTimeZoneBuilder$OfYear",
"org.joda.time.tz.CachedDateTimeZone",
"org.joda.time.DateTimeUtils",
"org.joda.time.format.FormatUtils",
"org.joda.time.Chronology",
"org.joda.time.chrono.BaseChronology",
"org.joda.time.chrono.AssembledChronology",
"org.joda.time.DurationField",
"org.joda.time.field.MillisDurationField",
"org.joda.time.field.BaseDurationField",
"org.joda.time.field.PreciseDurationField",
"org.joda.time.DateTimeField",
"org.joda.time.field.BaseDateTimeField",
"org.joda.time.field.PreciseDurationDateTimeField",
"org.joda.time.field.PreciseDateTimeField",
"org.joda.time.field.DecoratedDateTimeField",
"org.joda.time.field.ZeroIsMaxDateTimeField",
"org.joda.time.chrono.BasicChronology$HalfdayField",
"org.joda.time.chrono.BasicChronology",
"org.joda.time.chrono.BasicGJChronology",
"org.joda.time.chrono.AssembledChronology$Fields",
"org.joda.time.field.ImpreciseDateTimeField",
"org.joda.time.chrono.BasicYearDateTimeField",
"org.joda.time.field.ImpreciseDateTimeField$LinkedDurationField",
"org.joda.time.chrono.GJYearOfEraDateTimeField",
"org.joda.time.field.OffsetDateTimeField",
"org.joda.time.field.DividedDateTimeField",
"org.joda.time.field.DecoratedDurationField",
"org.joda.time.field.ScaledDurationField",
"org.joda.time.field.RemainderDateTimeField",
"org.joda.time.chrono.GJEraDateTimeField",
"org.joda.time.chrono.GJDayOfWeekDateTimeField",
"org.joda.time.chrono.BasicDayOfMonthDateTimeField",
"org.joda.time.chrono.BasicDayOfYearDateTimeField",
"org.joda.time.chrono.BasicMonthOfYearDateTimeField",
"org.joda.time.chrono.GJMonthOfYearDateTimeField",
"org.joda.time.chrono.BasicWeekyearDateTimeField",
"org.joda.time.chrono.BasicWeekOfWeekyearDateTimeField",
"org.joda.time.field.UnsupportedDurationField",
"org.joda.time.chrono.GregorianChronology",
"org.joda.time.chrono.ISOYearOfEraDateTimeField",
"org.joda.time.chrono.ISOChronology",
"org.joda.time.field.DelegatedDateTimeField",
"org.joda.time.field.SkipDateTimeField",
"org.joda.time.chrono.JulianChronology",
"org.joda.time.chrono.ZonedChronology",
"org.joda.time.chrono.ZonedChronology$ZonedDurationField",
"org.joda.time.chrono.ZonedChronology$ZonedDateTimeField",
"org.joda.time.field.FieldUtils",
"org.joda.time.IllegalFieldValueException",
"org.joda.time.chrono.BasicChronology$YearInfo",
"org.joda.time.Instant",
"org.joda.time.chrono.GJChronology",
"org.joda.time.base.AbstractPartial",
"org.joda.time.base.BaseLocal",
"org.joda.time.LocalDate",
"org.joda.time.chrono.GJChronology$CutoverField",
"org.joda.time.chrono.GJChronology$ImpreciseCutoverField",
"org.joda.time.chrono.GJChronology$LinkedDurationField",
"org.joda.time.chrono.BasicSingleEraDateTimeField",
"org.joda.time.field.SkipUndoDateTimeField",
"org.joda.time.DateTime",
"org.joda.time.chrono.LimitChronology",
"org.joda.time.chrono.LimitChronology$LimitDurationField",
"org.joda.time.chrono.LimitChronology$LimitDateTimeField",
"org.joda.time.chrono.BuddhistChronology",
"org.joda.time.chrono.BasicFixedMonthChronology",
"org.joda.time.chrono.CopticChronology",
"org.joda.time.LocalDateTime",
"org.joda.time.format.DateTimeParserBucket",
"org.joda.time.convert.ConverterManager",
"org.joda.time.convert.ConverterSet",
"org.joda.time.convert.AbstractConverter",
"org.joda.time.convert.ReadableInstantConverter",
"org.joda.time.convert.StringConverter",
"org.joda.time.convert.CalendarConverter",
"org.joda.time.convert.DateConverter",
"org.joda.time.convert.LongConverter",
"org.joda.time.convert.NullConverter",
"org.joda.time.convert.ReadablePartialConverter",
"org.joda.time.convert.ReadableDurationConverter",
"org.joda.time.convert.ReadableIntervalConverter",
"org.joda.time.convert.ReadablePeriodConverter",
"org.joda.time.convert.ConverterSet$Entry",
"org.joda.time.chrono.IslamicChronology$LeapYearPatternType",
"org.joda.time.chrono.IslamicChronology",
"org.joda.time.format.DateTimeParserBucket$SavedState",
"org.joda.time.chrono.EthiopicChronology",
"org.joda.time.format.DateTimeParserBucket$SavedField",
"org.joda.time.base.BaseSingleFieldPeriod",
"org.joda.time.format.ISOPeriodFormat",
"org.joda.time.format.PeriodFormatterBuilder",
"org.joda.time.format.PeriodFormatterBuilder$Literal",
"org.joda.time.format.PeriodFormatterBuilder$FieldFormatter",
"org.joda.time.format.PeriodFormatterBuilder$SimpleAffix",
"org.joda.time.format.PeriodFormatterBuilder$Composite",
"org.joda.time.format.PeriodFormatterBuilder$Separator",
"org.joda.time.format.PeriodFormatter",
"org.joda.time.PeriodType",
"org.joda.time.Days",
"org.joda.time.base.AbstractDuration",
"org.joda.time.base.BaseDuration",
"org.joda.time.Duration",
"org.joda.time.base.AbstractPeriod",
"org.joda.time.base.BasePeriod$1",
"org.joda.time.base.BasePeriod",
"org.joda.time.Period",
"org.joda.time.MutablePeriod",
"org.joda.time.base.AbstractInterval",
"org.joda.time.base.BaseInterval",
"org.joda.time.Interval",
"org.joda.time.MutableInterval",
"org.joda.time.chrono.StrictChronology",
"org.joda.time.field.StrictDateTimeField",
"org.joda.time.format.DateTimeFormat$1",
"org.joda.time.format.DateTimeFormat",
"org.joda.time.LocalTime",
"org.joda.time.Weeks",
"org.joda.time.chrono.LenientChronology",
"org.joda.time.field.LenientDateTimeField",
"org.joda.time.tz.UTCProvider",
"org.joda.time.Seconds",
"org.joda.time.Partial",
"org.joda.time.Years",
"org.joda.time.Minutes",
"org.joda.time.chrono.GJLocaleSymbols",
"org.joda.time.chrono.LimitChronology$LimitException",
"org.joda.time.Hours",
"org.joda.time.Months",
"org.joda.time.field.AbstractPartialFieldProperty",
"org.joda.time.Partial$Property",
"org.joda.time.LocalTime$Property",
"org.joda.time.base.BasePartial",
"org.joda.time.YearMonth",
"org.joda.time.DateTimeZone$1",
"org.joda.time.MonthDay",
"org.joda.time.DateTimeUtils$FixedMillisProvider",
"org.joda.time.DateTime$Property",
"org.joda.time.field.UnsupportedDateTimeField",
"org.joda.time.IllegalInstantException",
"org.joda.time.DateTimeUtils$OffsetMillisProvider",
"org.joda.time.DateTimeZone$Stub",
"org.joda.time.format.DateTimeFormatterBuilder$TextField",
"org.joda.time.tz.CachedDateTimeZone$Info",
"org.joda.time.LocalDate$Property",
"org.joda.time.YearMonth$Property",
"org.joda.time.LocalDateTime$Property",
"org.joda.time.format.DateTimeFormatterBuilder$TimeZoneName",
"org.joda.time.MonthDay$Property"
);
}
}
| [
"[email protected]"
] | |
0e373d3a5c1d7547e0b2372c95029c3dd0f2d6b0 | 9cd1f8004717112fc20ae20bb607d94d3188449d | /bundles/plugins/org.bonitasoft.studio.properties/src/org/bonitasoft/studio/properties/sections/message/CatchEventEventSelectionContribution.java | 9012047831f80f1911766786150b232e8efd5ab6 | [] | no_license | guillermofuentesquijada/bonita-studio | aad348262a7810788f3284ec6363ac718718b793 | e64149dfdf34a45f8f0d55782831b8b142d2c07e | refs/heads/master | 2021-01-18T18:47:16.790750 | 2015-03-24T10:11:03 | 2015-03-24T10:17:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,965 | java | /**
* Copyright (C) 2009 BonitaSoft S.A.
* BonitaSoft, 31 rue Gustave Eiffel - 38000 Grenoble
*
* 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.0 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.properties.sections.message;
import java.util.ArrayList;
import java.util.EventObject;
import java.util.List;
import org.bonitasoft.studio.common.emf.tools.ExpressionHelper;
import org.bonitasoft.studio.common.emf.tools.ModelHelper;
import org.bonitasoft.studio.common.jface.ListContentProvider;
import org.bonitasoft.studio.common.properties.ExtensibleGridPropertySection;
import org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution;
import org.bonitasoft.studio.model.process.AbstractCatchMessageEvent;
import org.bonitasoft.studio.model.process.AbstractProcess;
import org.bonitasoft.studio.model.process.Message;
import org.bonitasoft.studio.model.process.ProcessPackage;
import org.bonitasoft.studio.model.process.ThrowMessageEvent;
import org.bonitasoft.studio.properties.i18n.Messages;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
/**
* @author Romain Bioteau
*
*/
public class CatchEventEventSelectionContribution implements
IExtensibleGridPropertySectionContribution {
private ComboViewer combo;
private AbstractCatchMessageEvent eObject;
private TransactionalEditingDomain editingDomain;
private IGraphicalEditPart messageEventPart;
private String oldEventName;
private final NotificationListener updateSourceEventListener = new NotificationListener() {
@Override
public void notifyChanged(Notification notification) {
String eventName = eObject.getEvent() ;
final Message event = ModelHelper.findEvent(eObject, eventName);
if(event != null){
editingDomain.getCommandStack().execute(SetCommand.create(editingDomain, event, ProcessPackage.Literals.MESSAGE__TARGET_ELEMENT_EXPRESSION, ExpressionHelper.createConstantExpression(eObject.getName(), String.class.getName()))) ;
}
}
};
/* (non-Javadoc)
* @see org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution#createControl(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory, org.bonitasoft.studio.common.properties.ExtensibleGridPropertySection)
*/
@Override
public void createControl(Composite composite,
TabbedPropertySheetWidgetFactory widgetFactory,
ExtensibleGridPropertySection extensibleGridPropertySection) {
GridLayout layout = new GridLayout(2, false);
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL));
combo = new ComboViewer(composite,SWT.NONE);
GridData gd = new GridData(GridData.FILL) ;
gd.grabExcessHorizontalSpace = true ;
gd.horizontalAlignment = SWT.FILL ;
gd.widthHint = 200 ;
combo.getControl().setLayoutData(gd);
combo.setLabelProvider(new EventLabelProvider());
combo.setContentProvider(new ListContentProvider());
combo.addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if(element instanceof EventObject){
final ThrowMessageEvent source = ((Message) element).getSource();
if(eObject != null){
if(source != null){
final AbstractProcess parentProcessOfSourceMessage = ModelHelper.getParentProcess(source);
if(parentProcessOfSourceMessage != null
&& parentProcessOfSourceMessage.equals(ModelHelper.getParentProcess(eObject))){
return false ;
}
}
}
}
return true;
}
});
List<Message> events = retrievePossibleMessageEvents();
combo.setInput(events);
if(eObject.getEvent() != null){
combo.getCombo().setText(eObject.getEvent());
oldEventName = combo.getCombo().getText() ;
}
combo.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent arg0) {
handleSelectionChanged();
}
});
combo.getCombo().addListener(SWT.Modify,new Listener() {
@Override
public void handleEvent(Event event) {
handleSelectionChanged();
}
});
}
private List<Message> retrievePossibleMessageEvents() {
List<Message> events = new ArrayList<Message>();
ModelHelper.findAllEvents(ModelHelper.getMainProcess(eObject),events);
// remove messages that source(throwMessage) are on the same process as eObject(catchMessage)
AbstractProcess parentProcess = ModelHelper.getParentProcess(eObject);
List<Message> eventsToRemove = retrieveMessageEventsFromThePool(events, parentProcess);
events.removeAll(eventsToRemove);
return events;
}
private List<Message> retrieveMessageEventsFromThePool(List<Message> events, AbstractProcess parentProcess) {
List<Message> eventsToRemove = new ArrayList<Message>();
for(Message message : events){
if(ModelHelper.getParentProcess(message).equals(parentProcess)){
eventsToRemove.add(message);
}
}
return eventsToRemove;
}
protected void handleSelectionChanged() {
String eventName = combo.getCombo().getText();
final Message event = ModelHelper.findEvent(eObject, eventName);
DiagramEditor editor = (DiagramEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor() ;
boolean eventsOnSameDiagram = (event != null && event.eResource().equals(eObject.eResource()));
// Delete old
if ((event == null || eventsOnSameDiagram) && eObject.getIncomingMessag() != null) {
MessageFlowFactory.removeMessageFlow(editingDomain, event,eObject, editor.getDiagramEditPart()) ;
}
// Set
CompoundCommand cc = new CompoundCommand();
SetCommand setCommand = new SetCommand(editingDomain, eObject, ProcessPackage.Literals.ABSTRACT_CATCH_MESSAGE_EVENT__EVENT, eventName) ;
cc.append(setCommand);
editingDomain.getCommandStack().execute(setCommand) ;
//Update event reference
for(AbstractCatchMessageEvent ev : ModelHelper.getAllCatchEvent(ModelHelper.getMainProcess(eObject))){
if(ev.getEvent() != null && eventName != null && ev.getEvent().equals(eventName)){
if(!ev.equals(eObject)){
SetCommand cmd = new SetCommand(editingDomain, ev, ProcessPackage.Literals.ABSTRACT_CATCH_MESSAGE_EVENT__EVENT, null);
editingDomain.getCommandStack().execute(cmd) ;
}
if(oldEventName != null){
Message oldEvent = ModelHelper.findEvent(ModelHelper.getMainProcess(eObject),oldEventName) ;
SetCommand cmd = new SetCommand(editingDomain, oldEvent, ProcessPackage.Literals.MESSAGE__TARGET_PROCESS_EXPRESSION, null);
editingDomain.getCommandStack().execute(cmd) ;
cmd = new SetCommand(editingDomain, oldEvent, ProcessPackage.Literals.MESSAGE__TARGET_ELEMENT_EXPRESSION,null);
editingDomain.getCommandStack().execute(cmd) ;
}
MessageFlowFactory.removeMessageFlow(editingDomain, event, ev, editor.getDiagramEditPart());
}
}
// Add new
if (eventsOnSameDiagram) {
AbstractCatchMessageEvent catchMessage = (AbstractCatchMessageEvent)messageEventPart.resolveSemanticElement() ;
String procName = ModelHelper.getParentProcess(catchMessage).getName();
SetCommand cmd = new SetCommand(editingDomain, event, ProcessPackage.Literals.MESSAGE__TARGET_PROCESS_EXPRESSION, ExpressionHelper.createConstantExpression(procName, String.class.getName()));
editingDomain.getCommandStack().execute(cmd) ;
cmd = new SetCommand(editingDomain, event, ProcessPackage.Literals.MESSAGE__TARGET_ELEMENT_EXPRESSION,ExpressionHelper.createConstantExpression(catchMessage.getName(), String.class.getName()));
editingDomain.getCommandStack().execute(cmd) ;
MessageFlowFactory.createMessageFlow(editingDomain,event, (ThrowMessageEvent)event.eContainer(), (AbstractCatchMessageEvent)messageEventPart.resolveSemanticElement(), editor.getDiagramEditPart());
}
oldEventName = eventName ;
}
/* (non-Javadoc)
* @see org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution#dispose()
*/
@Override
public void dispose() {
deactivateNameListener() ;
}
protected void deactivateNameListener() {
if(editingDomain != null){
DiagramEventBroker.getInstance(editingDomain).removeNotificationListener(eObject, ProcessPackage.eINSTANCE.getElement_Name(), updateSourceEventListener) ;
}
}
/* (non-Javadoc)
* @see org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution#getLabel()
*/
@Override
public String getLabel() {
return Messages.selectMessageEventLabel;
}
/* (non-Javadoc)
* @see org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution#isRelevantFor(org.eclipse.emf.ecore.EObject)
*/
@Override
public boolean isRelevantFor(EObject eObject) {
return eObject instanceof AbstractCatchMessageEvent;
}
/* (non-Javadoc)
* @see org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution#refresh()
*/
@Override
public void refresh() {
if(combo != null && !combo.getCombo().isDisposed()){
oldEventName = combo.getCombo().getText() ;
}
}
/* (non-Javadoc)
* @see org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution#setEObject(org.eclipse.emf.ecore.EObject)
*/
@Override
public void setEObject(EObject object) {
eObject = (AbstractCatchMessageEvent) object ;
activateNameListener() ;
}
private void activateNameListener() {
DiagramEventBroker.getInstance(editingDomain).addNotificationListener(eObject, ProcessPackage.eINSTANCE.getElement_Name(), updateSourceEventListener) ;
}
/* (non-Javadoc)
* @see org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution#setEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain)
*/
@Override
public void setEditingDomain(TransactionalEditingDomain editingDomain) {
this.editingDomain = editingDomain ;
}
/* (non-Javadoc)
* @see org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution#setSelection(org.eclipse.jface.viewers.ISelection)
*/
@Override
public void setSelection(ISelection selection) {
Object sel = ((StructuredSelection)selection).getFirstElement();
if(sel instanceof IGraphicalEditPart){
messageEventPart = (IGraphicalEditPart)sel;
}
}
}
| [
"[email protected]"
] | |
02a9bf702f9079a6ffb72535750dff1bfbe39911 | 0daae42ee3234f891289ad65e29fa0597fbc694f | /src/test/java/algorithm/tree/TreeNodeTest.java | b803a9ea42a2e294512a42bc981ff414e3581afa | [] | no_license | tcllib/LeetCode | 39d183c7cc5e9e543f25b8e329c97243712247a6 | 5ec4a6bd46079f324eaa0ed7e038b110f7f21a0a | refs/heads/master | 2021-06-17T17:47:24.871793 | 2021-04-07T13:02:59 | 2021-04-07T13:02:59 | 185,039,146 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java | package algorithm.tree;
import org.junit.jupiter.api.Test;
class TreeNodeTest {
@Test
void build() {
TreeNode build = TreeNode.build(new Integer[]{1,2,3,null,3,6,7,4,5});
System.out.println("");
}
@Test
void level_order_traversal() {
TreeNode tree = TreeNode.build(new Integer[]{1, null, 2, null, 3});
System.out.println(TreeNode.levelOrderTraversal(tree));
}
} | [
"[email protected]"
] | |
696daa1493661f0633fc1609667bc405ea971b94 | 49456917a68a5ddcaae2d6c4e4fe4d70f211181a | /app/src/main/java/jiyun/com/lovepet/utils/TableUtils.java | 71eb8c19dc65e4cd42517651582fcc288d123e19 | [] | no_license | HGFwoyunqidayushili/LovePet | e53cfc758e2b07dbd0ad482c587a60b6b12d083e | dfca2c2b10a40ea577e1415ed91d232660bf9c0b | refs/heads/master | 2021-09-01T17:06:14.064239 | 2017-12-25T01:55:57 | 2017-12-25T01:55:57 | 113,388,046 | 0 | 0 | null | 2017-12-25T01:55:58 | 2017-12-07T01:41:25 | Java | UTF-8 | Java | false | false | 15,743 | java | /**
* @描述 :
* @文件名称 : TableUtils.java
* @�??属包名称 : com.huanchong.pet.utils
* @作�?? : Android - yhq
* @版本 : v1.0
* @创建日期 : 2016�??3�??14�??
*/
package jiyun.com.lovepet.utils;
import android.provider.BaseColumns;
/**
* @描述 : �??有数据库本地�??
* @类名 : TableUtils
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : 2016�??3�??14�??
*/
public class TableUtils {
/**
*
* @描述 : 登录用户
* @类名 : LoginUser
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : 2016�??3�??14�??
*/
public static final class LoginUser implements BaseColumns {
public static final String TABLE_NAME = "LoginUser.db";// 表名
public static final String PHOTO = "photo";// 头像
public static final String USERNAME = "userName";// 用户�??
public static final String UID = "uId";// 用户Id
public static final String PASSWORD = "password";// 密码
}
/**
*
* @Description:(用户信息实体)
* @ClassName: UserInfo
*/
public static final class UserInfoVO implements BaseColumns {
public static final String ID = "id";
public static final String ORDERID = "orderId"; // 订单id
public static final String USERSID = "usersId";// 寄养师id
public static final String USERSNAME = "usersName";// 寄养师名�?
public static final String USERID = "userId";// 用户id
public static final String USERNAME = "userName";// 用户名称
public static final String ORDERSTATE = "orderState";// 订单状�??
public static final String SERVICEBEGINTIME = "serviceBeginTime";// 服务�?始时�?
public static final String SERVICEENDTIME = "serviceEndTime";// 服务结束时间
public static final String ORDERAMOUNT = "orderAmount";// 订单金额
public static final String RECEIVABLEAMOUNT = "receivableAmount";// 应收金额
public static final String PAIDUPAMOUNT = "paidUpAmount";// 实收金额
public static final String CREATETIME = "createTime";// 创建时间
public static final String UPDATETIME = "updateTime";// 更新时间
public static final String USERWORD = "userWord";// 用户留言
public static final String ORDERITEMINFOVOS = "orderItemInfoVOs";// 订单详情信息
}
/**
* @描述 : 宠物信息实体�??
* @类名 : PetInfo
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : 2016�??3�??22�??
*/
public static final class PetInfo implements BaseColumns {
public static final String TABLE_NAME = "PetInfo.db";// 表名
public static final String ID = "id"; // ID编号
public static final String PETCODE = "petCode";// 宠物代码
public static final String PETNAME = "petName";// 宠物昵称
public static final String USERID = "userid"; // 用户id
public static final String PETSEX = "petsex"; // 宠物性别
public static final String PETBIRTHTIME = "petBirthTime"; // 宠物生日
public static final String PETINFO = "petInfo"; // 宠物信息
public static final String CREATETIME = "createTime"; // 宠物创建时间
public static final String UPDATETIME = "updateTime"; // 宠物修改时间
public static final String PET_PICTRUE = "petImage"; // 宠物图片
public static final String PETPRICE = "petPrice"; // 宠物图片
public static final String PETTYPE = "pettype"; // 宠物类型
public static final String PETTYPENAME = "petTypeName";// 宠物类型名称
public static final String ISSTERILIZATION = "isSterilization";// 是否绝育
public static final String PETWEIGHT = "petweight";// 宠物体重
public static final String PETSTATE = "petstate";// 宠物状�??
public static final String ISIMMUNE = "isimmune";// 宠物是否免疫
public static final String USERNAME = "userName";// 用户名称
public static final String PETPRICINGCODE = "petPricingCode";// 宠物定价code
public static final String ISUSE = "isUse";// 是否启用
}
/**
* @描述 :数据字典实体
* @类名 : DictInfo
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : Mar 23, 2016
*/
public static final class DictInfo implements BaseColumns {
public static final String TABLE_NAME = "DictInfo.db";// 表名
public static final String ID = "id";
public static final String DICTKEY = "dictKey";// 字典标识key
public static final String DICTVALUE = "dictValue";// 字典标识value
public static final String ISUSE = "isUse";// 是否启用
}
/**
* @描述 :免疫信息实体
* @类名 : DictInfo
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : Mar 23, 2016
*/
public static final class ImmuneInfo implements BaseColumns {
public static final String TABLE_NAME = "ImmuneInfo.db";// 表名
public static final String ID = "id";
public static final String IMMUNECODE = "immuneCode";// 免疫code
public static final String IMMUNENAME = "immuneName";// 免疫名称
public static final String IMMUNETIME = "immuneTime";// 免疫时间
public static final String ISUSE = "isUse"; // 是否启用
}
/**
* @描述 :消息记录实体
* @类名 : DictInfo
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : Mar 23, 2016
*/
public static final class MessageLog implements BaseColumns {
public static final String TABLE_NAME = "MessageLog.db";// 表名
public static final String ID = "id";
public static final String FROMUSERID = "fromUserId";// 发�?�用�??
public static final String TOUSERID = "toUserId";// 接受用户
public static final String MESSAGETYPE = "messageType";// 消息类型
public static final String MESSAGEINFO = "messageInfo";// 消息内容
public static final String CREATETIME = "createTime";// 创建时间
}
/**
* @描述 :订单信息实体
* @类名 : DictInfo
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : Mar 23, 2016
*/
public static final class OrderInfo implements BaseColumns {
public static final String TABLE_NAME = "OrderInfo.db";// 表名
public static final String ID = "id";
public static final String ORDERID = "orderId"; // 订单id
public static final String PETID = "petId"; // 宠物id
public static final String USERSID = "usersId";// 寄养师id
public static final String USERID = "userId";// 用户id
public static final String ORDERSTATE = "orderState";// 订单状�??
public static final String SERVICEBEGSTRINGIME = "serviceBeginTime";// 服务�??始时�??
public static final String SERVICEENDTIME = "serviceEndTime";// 服务结束时间
public static final String ORDERAMOUNT = "orderAmount";// 订单金额
public static final String PAIDUPAMOUNT = "paidUpAmount";// 实收金额
public static final String CREATETIME = "createTime";// 创建时间
public static final String UPSTRINGTIME = "upStringTime";// 更新时间
public static final String USERWORD = "userWord";// 用户留言
public static final String REFUSEREASON = "refuseReason";// 用户留言
}
/**
* @描述 :订单详情信息实体
* @类名 : DictInfo
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : Mar 23, 2016
*/
public static final class OrderItemInfo implements BaseColumns {
public static final String TABLE_NAME = "OrderItemInfo.db";// 表名
public static final String ID = "id";
public static final String ORDERID = "orderId";// 订单id
public static final String PETID = "petId";// 宠物id
public static final String PETPRICINGCODE = "petPricingCode";// 宠物定价code
public static final String PETDURATION = "petDuration";// 寄养时长
public static final String PRICE = "price";// 金额
public static final String CREATETIME = "createTime";// 创建时间
public static final String UPSTRINGTIME = "upStringTime";// 修改时间
public static final String SERVICECODE = "serviceCode";// 服务code
public static final String SERVICEPRICE = "servicePrice";// 服务定价
public static final String PETPRICE = "petPrice";// 宠物类型定价
}
/**
* @描述 :支付日志实体
* @类名 : DictInfo
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : Mar 23, 2016
*/
public static final class PayLog implements BaseColumns {
public static final String TABLE_NAME = "PayLog.db";// 表名
public static final String ID = "id";
public static final String USERID = "userId";// 用户id
public static final String CREATETIME = "createTime";// 创建时间
public static final String PAYTYPE = "payType";// 支付类型
public static final String PRICE = "price";// 支付金额
}
/**
* @描述 :宠物免疫信息实体
* @类名 : DictInfo
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : Mar 23, 2016
*/
public static final class PetImmuneInfo implements BaseColumns {
public static final String TABLE_NAME = "PetImmuneInfo.db";// 表名
public static final String ID = "id";
public static final String IMMUNECODE = "immuneCode";// 免疫code
public static final String IMMUNENAME = "immuneName";// 免疫名称
public static final String PETCODE = "petCode";// 宠物code
public static final String IMMUNETIME = "immuneTime";// 免疫时间
public static final String ISSTANDARD = "isStandard";// 免疫标准
}
/**
* @描述 :宠物定价信息VO
* @类名 : DictInfo
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : Mar 23, 2016
*/
public static final class PetPricingInfo implements BaseColumns {
public static final String TABLE_NAME = "PetPricingInfo.db";// 表名
public static final String ID = "id";
public static final String PETTYPECODE = "petTypeCode";// 宠物类型code
public static final String PETTYPENAME = "petTypeName";// 宠物类型名称
public static final String PETPRICE = "petPrice";// 价格
public static final String UNIT = "unit";// 单位
public static final String ISUSE = "isUse";// 是否启用
public static final String CREATETIME = "createTime";// 创建时间
public static final String UPSTRINGTIME = "upStringTime";// 修改时间
public static final String BIGTYPE = "bigType";
public static final String USERID = "userId";
}
/**
* @描述 :宠物信息实体
* @类名 : DictInfo
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : Mar 23, 2016
*/
public static final class PetType implements BaseColumns {
public static final String TABLE_NAME = "PetType.db";// 表名
public static final String ID = "id";
public static final String TYPECODE = "typeCode";// 类型code
public static final String TYPENAME = "typeName";// 类型名称
public static final String TYPEINDEX = "typeIndex";// 数据索引
public static final String CREATETIME = "createTime";// 创建时间
public static final String ISUSE = "isUse"; // 是否启用
public static final String BIGTYPE = "bigType"; // �??属大�??
public static final String PARENTTYPECODE = "parentTypeCode"; // �??属大�??
public static final String TYPECODES = "typeCodes"; // �??属大�??
}
/**
* @描述 :服务定价信息实体
* @类名 : DictInfo
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : Mar 23, 2016
*/
public static final class ServicePricingInfo implements BaseColumns {
public static final String TABLE_NAME = "ServicePricingInfo.db";// 表名
public static final String ID = "id";
public static final String USERID = "userId";// 用户id
public static final String SERVICECODE = "serviceCode";// 服务code
public static final String SERVICENAME = "serviceName";// 服务名称
public static final String SERVICEPRICE = "servicePrice";// 服务定价
public static final String SERVICEPICTURE = "servicePicture";// 服务图片
public static final String ISUSE = "isUse";// 是否启用
public static final String CREATETIME = "createTime";// 创建时间
public static final String UPSTRINGTIME = "upStringTime";// 修改时间
public static final String SERVICETYPE = "serviceType";// 服务分类
public static final String SERVICETYPENAME = "serviceTypeName";// 分类名称
public static final String ISSTANDARD = "isStandard";// 是否是标准定�??
public static final String PETPRICINGCODE = "petPricingCode";// 宠物服务定价
}
/**
* @描述 :用户信息实体
* @类名 : DictInfo
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : Mar 23, 2016
*/
public static final class UserInfo implements BaseColumns {
public static final String TABLE_NAME = "UserInfo.db";// 表名
public static final String ID = "id";
public static final String USERID = "userId";// 用户id
public static final String USERSID = "usersId";// 寄养师Id
public static final String USERNAME = "userName";// 用户�??
public static final String PASSWORD = "password";// 密码
public static final String USERPHONE = "userPhone";// 手机�??
public static final String POSITION = "position";// 用户身份
public static final String ADDRESS = "address";// 用户地址
public static final String IDENTIFY = "identify";// 地图标识
public static final String USERPRICE = "userPrice";// 帐号金额
public static final String CREATETIME = "createTime";// 创建时间
public static final String UPSTRINGTIME = "upStringTime";// 修改时间
public static final String QQ = "qq";// QQ
public static final String REALNAME = "realName";// 真实姓名
public static final String FAMILY = "family";// 寄养家庭
public static final String IDENTITYCARD = "identityCard";// 身份证号
public static final String IDENTITYIMAGE = "identityImage";// 身份证照�??
public static final String LASTREGISTERTIME = "lastRegisterTime";// �??后登录时�??
public static final String THREEID = "threeId";// 第三方登录标�??
public static final String USERIMAGE = "userImage";// 用户图片
public static final String USERSEX = "userSex";// 用户年龄
public static final String BIRTHDAY = "birthday";// 出生日期
public static final String ISUSE = "isUse";// 是否启用
public static final String TOKEN = "token";
public static final String INTRO = "intro";// 家庭�??�??
public static final String WECHAT = "wechat";// 微信
public static final String OPENBEGINTIME = "openBeginTime";// 寄养�??始时�??
public static final String OPENENDTIME = "openEndTime";// 寄养结束时间
public static final String OPENTIME = "openTime";// 寄养�??始时�??
public static final String ENDTIME = "endTime";// 寄养结束时间
}
/**
* @描述 :寄养师评价信息实�??
* @类名 : DictInfo
* @作�?? : Android - yhq
* @版本 : v1.0
* @日期 : Mar 23, 2016
*/
public static final class UsersEvaluatedInfo implements BaseColumns {
public static final String TABLE_NAME = "UsersEvaluatedInfo.db";// 表名
public static final String ID = "id";
public static final String ORDERID = "orderId";// 订单id
public static final String USERID = "userId";// 用户id
public static final String USERSID = "usersId";// 寄养师id
public static final String SCORE = "score";// 评分
public static final String DESCRIPTION = "description";// 描述
public static final String ISUSE = "isUse";// 是否有效
public static final String CREATETIME = "createTime";// 评价时间
public static final String PETID = "petId";// 宠物id
public static final String USERNAME = "userName";// 用户�??
public static final String USERSNAME = "usersName";// 寄养师名�??
public static final String USERIMAGE = "userImage";// 用户图片
public static final String PETDURATION = "petDuration";// 寄养时长
public static final String PETTYPEDESC = "petTypeDesc";// 宠物类型描述
}
}
| [
"[email protected]"
] | |
520ce06e260cf106737572c95c7b8e0db962d950 | 04798cd312481621fef63ee314f1044abfb13c07 | /src/main/java/com/inventory/manager/application/adjustment/dto/ListStockAdjustmentResponseDTO.java | e065f4f568d85df2e83096d2ca6e92d003f5e4e8 | [] | no_license | mhimaz/inventory-manager | d021c983f7f38d8fee6739711e7cea952b81de6d | cfd6d06aa4d5fe62df5c11bdf7edb9a6b61d37f1 | refs/heads/master | 2021-09-18T01:26:49.105855 | 2018-07-08T14:58:03 | 2018-07-08T14:58:03 | 107,620,345 | 0 | 0 | null | 2018-01-05T06:35:04 | 2017-10-20T02:06:08 | Java | UTF-8 | Java | false | false | 1,071 | java | package com.inventory.manager.application.adjustment.dto;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.inventory.manager.application.shared.dto.BaseResponseDTO;
import com.inventory.manager.application.shared.dto.PaginationDTO;
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class ListStockAdjustmentResponseDTO extends BaseResponseDTO {
private List<GetStockAdjustmentResponseDTO> stockAdjustments;
private PaginationDTO pagination;
public List<GetStockAdjustmentResponseDTO> getStockAdjustments() {
if (stockAdjustments == null) {
stockAdjustments = new ArrayList<>();
}
return stockAdjustments;
}
public void setStockAdjustments(List<GetStockAdjustmentResponseDTO> stockAdjustments) {
this.stockAdjustments = stockAdjustments;
}
public PaginationDTO getPagination() {
return pagination;
}
public void setPagination(PaginationDTO pagination) {
this.pagination = pagination;
}
}
| [
"[email protected]"
] | |
d5b30f4c1b3a77837c88bd13bcbba6c8952da6c3 | 8b94df137a6a4c223cb26ca717381b8f4ce3deb2 | /s2hessian/src/org/seasar/s2hessian/MetaConstant.java | 57d5151bbe8d240d762f7655d4165468e0cb4b03 | [] | no_license | seasarorg/s2hessian | 157efa5d25460ed62b8e15d7807dbf013064f432 | 1eac36c4b79c530bb5c3e19048400dab7e107441 | refs/heads/master | 2020-03-30T22:17:04.484361 | 2013-10-08T08:12:52 | 2013-10-08T08:12:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 749 | java | /*
* Copyright 2004-2006 the Seasar Foundation and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.seasar.s2hessian;
public interface MetaConstant {
public String META = "s2hessian";
} | [
"[email protected]"
] | |
6c7e3a82509545aeb997b7c6b8a9f1c9a6f7d81b | b63b9e862fa81636958d0bede8b0df6cd71c4e82 | /example-substeps-project/src/test/java/com/technophobia/webdriver/substeps/example/FeatureFileRunner.java | 80b7e351f8bb437b53be54cbcce9a0c53d1a24e2 | [] | no_license | imcshane/substeps | 8443cabbf1faabf673a5fef86ce9371a6b97c637 | fef9e42d0542fd92363b582650a78f8366fba372 | refs/heads/master | 2021-01-17T22:35:05.154699 | 2012-07-05T13:47:37 | 2012-07-05T13:47:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,833 | java | /*
* Copyright Technophobia Ltd 2012
*
* This file is part of Substeps.
*
* Substeps is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Substeps is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Substeps. If not, see <http://www.gnu.org/licenses/>.
*/
package com.technophobia.webdriver.substeps.example;
import org.junit.runner.RunWith;
import com.technophobia.substeps.runner.JunitFeatureRunner;
import com.technophobia.substeps.runner.JunitFeatureRunner.SubStepsConfiguration;
import com.technophobia.webdriver.substeps.impl.BaseWebdriverSubStepImplementations;
import com.technophobia.webdriver.substeps.runner.DefaultExecutionSetupTearDown;
/**
* A class which can be run as a junit test inside an IDE. Useful for writing debugging tests.
* Use the maven runner plugin for continuous integration as that provides better reporting.
*
* @author imoore
*/
@SubStepsConfiguration(featureFile = "./target/test-classes/features",
subStepsFile = "./target/test-classes/substeps",
stepImplementations = { BaseWebdriverSubStepImplementations.class, ExampleCustomWebdriverStepImplementations.class },
beforeAndAfterImplementations = { DefaultExecutionSetupTearDown.class, ExampleSetupAndTearDown.class },
tagList = "@all")
@RunWith(JunitFeatureRunner.class)
public class FeatureFileRunner {
// no op
}
| [
"[email protected]"
] | |
9ed6bfd7aa369d5b8442a8ff05cf884cf538db3a | dbda4749ad2b35bf98d1adeedebab0ab98010e88 | /app/src/main/java/com/greattone/greattone/Enum/EnumTime.java | 4c65373e3ace989eb78040009f63d9345df36bec | [] | no_license | makaifeng/greattone2 | b7d771c50b2466e7718b4194dee952a7a3325170 | 7eddff6be1007d9264813e920ba46780a9bac59f | refs/heads/master | 2020-12-24T10:03:40.334376 | 2017-04-26T06:29:25 | 2017-04-26T06:29:25 | 73,248,461 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,194 | java | package com.greattone.greattone.Enum;
/**
* Created by Administrator on 2016/10/31.
*/
public enum EnumTime {
// TIME1("06:00",0),
// TIME2("06:15",1),
// TIME3("06:30",2),
// TIME4("06:45",3),
// TIME5("07:00",4),
// TIME6("07:15",5),
// TIME7("07:30",6),
// TIME8("07:45",7),
TIME9("08:00",0),
TIME10("08:15",1),
TIME11("08:30",2),
TIME12("08:45",3),
TIME13("09:00",4),
TIME14("09:15",5),
TIME15("09:30",6),
TIME16("09:45",7),
TIME17("10:00",8),
TIME18("10:15",9),
TIME19("10:30",10),
TIME20("10:45",11),
TIME21("11:00",12),
TIME22("11:15",13),
TIME23("11:30",14),
TIME24("11:45",15),
TIME25("12:00",16),
TIME26("12:15",17),
TIME27("12:30",18),
TIME28("12:45",19),
TIME29("13:00",20),
TIME30("13:15",21),
TIME31("13:30",22),
TIME32("13:45",23),
TIME33("14:00",24),
TIME34("14:15",25),
TIME35("14:30",26),
TIME36("14:45",27),
TIME37("15:00",28),
TIME38("15:15",29),
TIME39("15:30",30),
TIME40("15:45",31),
TIME41("16:00",32),
TIME42("16:15",33),
TIME43("16:30",34),
TIME44("16:45",35),
TIME45("17:00",36),
TIME46("17:15",37),
TIME47("17:30",38),
TIME48("17:45",39),
TIME49("18:00",40),
TIME50("18:15",41),
TIME51("18:30",42),
TIME52("18:45",43),
TIME53("19:00",44),
TIME54("19:15",45),
TIME55("19:30",46),
TIME56("19:45",47),
TIME57("20:00",48),
TIME58("20:15",49),
TIME59("20:30",50),
TIME60("20:45",51),
TIME61("21:00",52);
// TIME62("21:15",61),
// TIME63("21:30",62),
// TIME64("21:45",63);
// TIME65("22:00",64),
// TIME66("22:15",65),
// TIME67("22:30",66),
// TIME68("22:45",67),
// TIME69("23:00",68);
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
String time;
int position;
EnumTime(String time, int position) {
this.time=time;
this.position=position;
}
}
| [
"[email protected]"
] | |
42c1d0e0eb62fc9a5ce8f439e5037127ee42b81b | 6f5d187aa8cdeda25b1560000e231474dd122301 | /service/service_edu/src/main/java/com/atguigu/eduservice/service/impl/EduTeacherServiceImpl.java | 8da3e75016b6b54e9db485275bd29cac3954778e | [] | no_license | IanXie/guli_parent | 8fb63836142fd79c3b818d6ea3e22008cc93c8bf | 43a55f41b5ad01733ed396955f28588ffeeb0862 | refs/heads/master | 2023-08-17T18:00:07.094595 | 2021-09-24T16:29:01 | 2021-09-24T16:29:01 | 399,323,395 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,103 | java | package com.atguigu.eduservice.service.impl;
import com.atguigu.eduservice.entity.EduTeacher;
import com.atguigu.eduservice.entity.vo.TeacherQuery;
import com.atguigu.eduservice.mapper.EduTeacherMapper;
import com.atguigu.eduservice.service.EduTeacherService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
/**
* <p>
* 讲师 服务实现类
* </p>
*
* @author Xie Yin
* @since 2021-07-23
*/
@Service
public class EduTeacherServiceImpl extends ServiceImpl<EduTeacherMapper, EduTeacher> implements EduTeacherService {
@Override
public void pageQuery(Page<EduTeacher> pageParam, TeacherQuery teacherQuery) {
// 构建条件
QueryWrapper<EduTeacher> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByAsc("sort");
if(teacherQuery == null){
baseMapper.selectPage(pageParam, queryWrapper);
return;
}
// 多条件组合查询, mybatis学过动态sql
String name = teacherQuery.getName();
Integer level = teacherQuery.getLevel();
String begin = teacherQuery.getBegin();
String end = teacherQuery.getEnd();
// 判断条你简直否是否为空,如果不为空拼接条件
if(!StringUtils.isEmpty(name)){
// 构建条件
queryWrapper.like("name", name);
}
if(!StringUtils.isEmpty(level)){
// 构建条件
queryWrapper.eq("level", level);
}
if(!StringUtils.isEmpty(begin)){
// 构建条件
queryWrapper.ge("gmt_create",begin);
}
if(!StringUtils.isEmpty(end)){
// 构建条件
queryWrapper.le("gmt_create", end);
}
// 根据创建时间排序
queryWrapper.orderByDesc("gmt_create");
baseMapper.selectPage(pageParam, queryWrapper);
}
}
| [
"[email protected]"
] | |
1264d54a9bd8ff3cb89c580e192f89f033be825b | 360c3af5ab01028ad60840f7ed23edf762b3d850 | /src/br/ufrn/ppgsc/backhoe/miner/TaskMiner.java | 2a87e9272267aa5db2edcb8ea7ad4ab51859f56c | [] | no_license | jalerson/backhoe | f54f2037c874ef27ca71c44366f10a300338db98 | 9999f08ab7062e3bf352388a78559c2126b02204 | refs/heads/master | 2016-09-06T03:08:20.482500 | 2015-07-31T00:00:38 | 2015-07-31T00:00:38 | 32,612,556 | 8 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,688 | java | package br.ufrn.ppgsc.backhoe.miner;
import java.sql.Date;
import java.util.LinkedList;
import java.util.List;
import br.ufrn.ppgsc.backhoe.exceptions.MissingParameterException;
import br.ufrn.ppgsc.backhoe.persistence.model.Commit;
import br.ufrn.ppgsc.backhoe.persistence.model.Task;
import br.ufrn.ppgsc.backhoe.persistence.model.TaskLog;
import br.ufrn.ppgsc.backhoe.repository.code.CodeRepository;
import br.ufrn.ppgsc.backhoe.repository.task.TaskRepository;
import br.ufrn.ppgsc.backhoe.vo.ConfigurationMining;
public class TaskMiner extends AbstractMiner {
public TaskMiner(Integer system, CodeRepository codeRepository,
TaskRepository taskRepository, Date startDate, Date endDate,
List<String> developers, List<String> ignoredPaths) {
super(system, codeRepository, taskRepository, startDate, endDate, developers,
ignoredPaths);
// TODO Auto-generated constructor stub
}
@Override
public boolean setupMinerSpecific() throws MissingParameterException {
// TODO Auto-generated method stub
System.out.println("\n=========================================================");
System.out.println("TASK MINER: "+ConfigurationMining.getSystemName(system).toUpperCase()+ " TEAM");
System.out.println("---------------------------------------------------------");
System.out.print("\n>> BACKHOE is connecting to CODE and TASK REPOSITORIES ... ");
boolean connected = taskRepository.connect() && codeRepository.connect();
if(connected)
System.out.println("Done!");
else
System.out.println("Failed!");
return taskRepository.connect() && codeRepository.connect();
}
@Override
public void execute() {
// TODO Auto-generated method stub
System.out.println("\n---------------------------------------------------------");
System.out.println("BACKHOE - CALCULATE TASK METRICS");
System.out.println("---------------------------------------------------------\n");
System.out.println(">> Date Interval for mining: "+startDate.toString()+" - "+endDate.toString());
System.out.print("\n>> BACKHOE is looking for TASKS in Iproject ... ");
long[] systems = {system};
List<Task> tasks = taskRepository.findTasks(startDate, endDate, null, null, systems);
if(tasks.isEmpty()){
System.out.println("Done!\n\n>> No task founded. Backhoe is finishing TASK MINER!");
}else{
System.out.println(tasks.size()+ " Done!");
System.out.print(">> Looking logs from the founded tasks ... ");
List<TaskLog> logs = taskRepository.findTaskLogsFromTasks(tasks, null, developers);
System.out.println(logs.size()+" Done!");
System.out.print(">> Looking commits from logs ... ");
List<Commit> commits = codeRepository.findCommitsFromLogs(logs, true, ignoredPaths);
System.out.println(commits.size()+" Done!");
List<Miner> miners = new LinkedList<Miner>();
CodeContributionMiner codeContributionMiner = new CodeContributionMiner(system, codeRepository, taskRepository, startDate, endDate, developers, ignoredPaths);
CodeComplexityMiner codeComplexityMiner = new CodeComplexityMiner(system, codeRepository, taskRepository, startDate, endDate, developers, ignoredPaths);
codeContributionMiner.setSpecificCommitsToMining(commits);
codeComplexityMiner.setSpecificCommitsToMining(commits);
miners.add(codeContributionMiner);
miners.add(codeComplexityMiner);
for(Miner miner: miners){
miner.setup();
miner.execute();
}
}
System.out.println("\n---------------------------------------------------------");
System.out.println("THE TASK METRICS WERE CALCULATED!");
System.out.println("=========================================================\n");
}
}
| [
"[email protected]"
] | |
e516efe5666f5570ec458b10c9893b4c6fea39d8 | 7c63713bc861bec328ac46957273f401135b9358 | /src/cn/iot/crud/dao/EmployeeMapper.java | fa0d1e2b14288f5b791d590a659a941c86b68f45 | [] | no_license | iot2020lxq/ssm_crud | 84b158cacb41a7cbd1a19cead660791db54184d0 | 03d4a4a7d658611e539b3692a58570dc3770363f | refs/heads/master | 2022-12-22T07:17:12.928773 | 2020-03-17T10:27:36 | 2020-03-17T10:27:36 | 247,940,907 | 0 | 0 | null | 2022-12-16T11:36:31 | 2020-03-17T10:27:56 | Java | UTF-8 | Java | false | false | 339 | java | package cn.iot.crud.dao;
import cn.iot.crud.bean.Employee;
import java.util.List;
public interface EmployeeMapper {
int deleteByPrimaryKey(Integer empId);
int insert(Employee record);
Employee selectByPrimaryKey(Integer empId);
List<Employee> selectAll();
int updateByPrimaryKey(Employee record);
} | [
"[email protected]"
] | |
f27e156df9bfa7bf6bcf86c09324d2c52520886b | 78ee343ad1655803e56033e6a9f8893fce98d928 | /app/src/main/java/pc/javier/seguime/ActividadRegistros.java | aa6e927fb14599483240f5b48a0deacf0c058703 | [] | no_license | javpc/seguime | bd1983fc1d54f50898cdcbc7b1b48ce17408bd92 | b28dfec18b82734ca91a83962c6cc83ca92d4657 | refs/heads/main | 2023-07-11T15:16:09.623965 | 2021-08-17T08:36:58 | 2021-08-17T08:36:58 | 397,165,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,379 | java | package pc.javier.seguime;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity;
import pc.javier.seguime.adaptador.Preferencias;
import pc.javier.seguime.control.ControlPantallaRegistros;
import pc.javier.seguime.vista.PantallaRegistros;
public class ActividadRegistros extends AppCompatActivity {
private ControlPantallaRegistros controlPantallaRegistros;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.registros);
Preferencias preferencias = new Preferencias(this);
PantallaRegistros pantallaRegistros = new PantallaRegistros(this);
controlPantallaRegistros = new ControlPantallaRegistros(pantallaRegistros, preferencias);
}
// Menú superior ---------------
@Override
public boolean onCreateOptionsMenu (Menu menu) {
getMenuInflater().inflate(R.menu.menu_registros, menu);
return true;
}
@Override
public boolean onOptionsItemSelected (MenuItem item) {
controlPantallaRegistros.menu (item);
return true;
}
private void mensajeLog (String texto) {
Log.d("Actividad Registro", texto);
}
}
| [
"[email protected]"
] | |
92f02a35298f0b1314d2dc71f7b22270b3501655 | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/JacksonCore-24/com.fasterxml.jackson.core.base.ParserBase/BBC-F0-opt-20/27/com/fasterxml/jackson/core/base/ParserBase_ESTest.java | 14a3fb8a58097549d28f2b7bd5f426c82af665ac | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 61,387 | java | /*
* This file was automatically generated by EvoSuite
* Sat Oct 23 09:54:26 GMT 2021
*/
package com.fasterxml.jackson.core.base;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.EvoAssertions.*;
import com.fasterxml.jackson.core.Base64Variant;
import com.fasterxml.jackson.core.JsonLocation;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.core.SerializableString;
import com.fasterxml.jackson.core.base.ParserBase;
import com.fasterxml.jackson.core.io.IOContext;
import com.fasterxml.jackson.core.json.ReaderBasedJsonParser;
import com.fasterxml.jackson.core.json.UTF8DataInputJsonParser;
import com.fasterxml.jackson.core.json.UTF8StreamJsonParser;
import com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer;
import com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer;
import com.fasterxml.jackson.core.util.BufferRecycler;
import com.fasterxml.jackson.core.util.TextBuffer;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PushbackInputStream;
import java.io.Reader;
import java.io.SequenceInputStream;
import java.io.StringReader;
import java.math.BigDecimal;
import java.util.Enumeration;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class ParserBase_ESTest extends ParserBase_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0.BYTE_WRITE_CONCAT_BUFFER, true);
StringReader stringReader0 = new StringReader("3");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getBigIntegerValue();
readerBasedJsonParser0.getNumberType();
assertEquals(7, readerBasedJsonParser0.currentTokenId());
}
@Test(timeout = 4000)
public void test01() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0.CHAR_CONCAT_BUFFER, true);
StringReader stringReader0 = new StringReader("3");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getBigIntegerValue();
readerBasedJsonParser0.getNumberValue();
assertEquals(7, readerBasedJsonParser0.getCurrentTokenId());
}
@Test(timeout = 4000)
public void test02() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
IOContext iOContext0 = new IOContext(bufferRecycler0, (Object) null, true);
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextIntValue(2);
int int0 = readerBasedJsonParser0.getTokenColumnNr();
assertEquals(2, int0);
}
@Test(timeout = 4000)
public void test03() throws Throwable {
char[] charArray0 = new char[8];
IOContext iOContext0 = mock(IOContext.class, new ViolatedAssumptionAnswer());
doReturn(charArray0).when(iOContext0).allocTokenBuffer();
doReturn((TextBuffer) null).when(iOContext0).constructTextBuffer();
StringReader stringReader0 = new StringReader("Q^");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.setFeatureMask(0);
assertEquals(0, readerBasedJsonParser0.getFeatureMask());
}
@Test(timeout = 4000)
public void test04() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
StringReader stringReader0 = new StringReader("Q^");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 2, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.overrideStdFeatures(1, 66);
assertEquals(0, readerBasedJsonParser0.getFeatureMask());
}
@Test(timeout = 4000)
public void test05() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("Q^");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0, (char[]) null, (-14), (-69), false);
readerBasedJsonParser0.overrideStdFeatures((-128), (-14));
assertEquals((-127), readerBasedJsonParser0.getFeatureMask());
}
@Test(timeout = 4000)
public void test06() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 2, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
boolean boolean0 = readerBasedJsonParser0.isClosed();
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test07() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, "[truncated ", false);
ByteQuadsCanonicalizer byteQuadsCanonicalizer0 = ByteQuadsCanonicalizer.createRoot();
UTF8DataInputJsonParser uTF8DataInputJsonParser0 = new UTF8DataInputJsonParser(iOContext0, 1, (DataInput) null, (ObjectCodec) null, byteQuadsCanonicalizer0, 7);
JsonLocation jsonLocation0 = uTF8DataInputJsonParser0.getTokenLocation();
assertEquals(1, jsonLocation0.getLineNr());
}
@Test(timeout = 4000)
public void test08() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getTokenLocation();
assertEquals(7, readerBasedJsonParser0.currentTokenId());
}
@Test(timeout = 4000)
public void test09() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
JsonLocation jsonLocation0 = readerBasedJsonParser0.getTokenLocation();
assertEquals(1, jsonLocation0.getLineNr());
}
@Test(timeout = 4000)
public void test10() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
long long0 = readerBasedJsonParser0.getTokenCharacterOffset();
assertEquals(7, readerBasedJsonParser0.getCurrentTokenId());
assertEquals(1L, long0);
}
@Test(timeout = 4000)
public void test11() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
StringReader stringReader0 = new StringReader("{");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3072, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextLongValue(0);
readerBasedJsonParser0.getParsingContext();
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
}
@Test(timeout = 4000)
public void test12() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 33, (Reader) null, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.overrideCurrentName("");
readerBasedJsonParser0.getParsingContext();
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
}
@Test(timeout = 4000)
public void test13() throws Throwable {
char[] charArray0 = new char[8];
IOContext iOContext0 = mock(IOContext.class, new ViolatedAssumptionAnswer());
doReturn(charArray0).when(iOContext0).allocTokenBuffer();
doReturn((TextBuffer) null).when(iOContext0).constructTextBuffer();
StringReader stringReader0 = new StringReader("Q^");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.getCurrentName();
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
}
@Test(timeout = 4000)
public void test14() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 0, (Reader) null, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.overrideCurrentName(") out of range of Java byte");
readerBasedJsonParser0.getCurrentName();
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
}
@Test(timeout = 4000)
public void test15() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 2, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.overrideCurrentName("");
readerBasedJsonParser0.getCurrentName();
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
}
@Test(timeout = 4000)
public void test16() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
PipedInputStream pipedInputStream0 = new PipedInputStream(1);
DataInputStream dataInputStream0 = new DataInputStream(pipedInputStream0);
ByteQuadsCanonicalizer byteQuadsCanonicalizer0 = ByteQuadsCanonicalizer.createRoot();
UTF8DataInputJsonParser uTF8DataInputJsonParser0 = new UTF8DataInputJsonParser(iOContext0, 2053, dataInputStream0, (ObjectCodec) null, byteQuadsCanonicalizer0, 24);
JsonLocation jsonLocation0 = uTF8DataInputJsonParser0.getCurrentLocation();
assertEquals(1, jsonLocation0.getLineNr());
assertEquals(1, uTF8DataInputJsonParser0.getTokenLineNr());
}
@Test(timeout = 4000)
public void test17() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("[C}+_! ");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
char[] charArray0 = new char[5];
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, (-822), stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0, charArray0, 33, 0, false);
JsonLocation jsonLocation0 = readerBasedJsonParser0.getCurrentLocation();
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
assertEquals(1, jsonLocation0.getLineNr());
}
@Test(timeout = 4000)
public void test18() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
PushbackInputStream pushbackInputStream0 = new PushbackInputStream((InputStream) null, 2966);
SequenceInputStream sequenceInputStream0 = new SequenceInputStream(pushbackInputStream0, (InputStream) null);
ByteQuadsCanonicalizer byteQuadsCanonicalizer0 = ByteQuadsCanonicalizer.createRoot();
byte[] byteArray0 = new byte[9];
UTF8StreamJsonParser uTF8StreamJsonParser0 = new UTF8StreamJsonParser(iOContext0, 2966, sequenceInputStream0, (ObjectCodec) null, byteQuadsCanonicalizer0, byteArray0, (byte) (-97), 1, false);
JsonLocation jsonLocation0 = uTF8StreamJsonParser0.getCurrentLocation();
assertEquals(1, jsonLocation0.getLineNr());
assertEquals(1, uTF8StreamJsonParser0.getTokenLineNr());
}
@Test(timeout = 4000)
public void test19() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 0, (Reader) null, (ObjectCodec) null, charsToNameCanonicalizer0);
JsonLocation jsonLocation0 = readerBasedJsonParser0.getCurrentLocation();
assertEquals(1, jsonLocation0.getLineNr());
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
}
@Test(timeout = 4000)
public void test20() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 0, (Reader) null, (ObjectCodec) null, charsToNameCanonicalizer0);
JsonParser.Feature jsonParser_Feature0 = JsonParser.Feature.ALLOW_MISSING_VALUES;
ReaderBasedJsonParser readerBasedJsonParser1 = (ReaderBasedJsonParser)readerBasedJsonParser0.disable(jsonParser_Feature0);
assertEquals(0, readerBasedJsonParser1.getFeatureMask());
assertEquals(1, readerBasedJsonParser1.getTokenLineNr());
}
@Test(timeout = 4000)
public void test21() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 0, (Reader) null, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.setFeatureMask((-158));
JsonParser.Feature jsonParser_Feature0 = JsonParser.Feature.IGNORE_UNDEFINED;
readerBasedJsonParser0.disable(jsonParser_Feature0);
assertEquals((-4254), readerBasedJsonParser0.getFeatureMask());
}
@Test(timeout = 4000)
public void test22() throws Throwable {
// Undeclared exception!
// try {
ParserBase.growArrayBy((int[]) null, (-1985));
// fail("Expecting exception: NegativeArraySizeException");
// } catch(NegativeArraySizeException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.core.base.ParserBase", e);
// }
}
@Test(timeout = 4000)
public void test23() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0.CHAR_TEXT_BUFFER, false);
StringReader stringReader0 = new StringReader("3");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextIntValue((-2358));
readerBasedJsonParser0.nextToken();
// try {
readerBasedJsonParser0.getNumberValue();
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Current token (null) not numeric, can not use numeric value accessors
// // at [Source: UNKNOWN; line: 1, column: 4]
// //
// verifyException("com.fasterxml.jackson.core.JsonParser", e);
// }
}
@Test(timeout = 4000)
public void test24() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
// try {
readerBasedJsonParser0.getLongValue();
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Current token (null) not numeric, can not use numeric value accessors
// // at [Source: UNKNOWN; line: 1, column: 1]
// //
// verifyException("com.fasterxml.jackson.core.JsonParser", e);
// }
}
@Test(timeout = 4000)
public void test25() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 0, (Reader) null, (ObjectCodec) null, charsToNameCanonicalizer0);
// try {
readerBasedJsonParser0.getIntValue();
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Current token (null) not numeric, can not use numeric value accessors
// // at [Source: UNKNOWN; line: 1, column: 1]
// //
// verifyException("com.fasterxml.jackson.core.JsonParser", e);
// }
}
@Test(timeout = 4000)
public void test26() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
PipedInputStream pipedInputStream0 = new PipedInputStream();
SequenceInputStream sequenceInputStream0 = new SequenceInputStream(pipedInputStream0, pipedInputStream0);
DataInputStream dataInputStream0 = new DataInputStream(sequenceInputStream0);
ByteQuadsCanonicalizer byteQuadsCanonicalizer0 = ByteQuadsCanonicalizer.createRoot();
UTF8DataInputJsonParser uTF8DataInputJsonParser0 = new UTF8DataInputJsonParser(iOContext0, 0, dataInputStream0, (ObjectCodec) null, byteQuadsCanonicalizer0, 2);
// try {
uTF8DataInputJsonParser0.getDoubleValue();
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Current token (null) not numeric, can not use numeric value accessors
// // at [Source: UNKNOWN; line: 1, column: -1]
// //
// verifyException("com.fasterxml.jackson.core.JsonParser", e);
// }
}
@Test(timeout = 4000)
public void test27() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, (-1285), stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
// try {
readerBasedJsonParser0.getDecimalValue();
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Current token (null) not numeric, can not use numeric value accessors
// // at [Source: (com.fasterxml.jackson.core.util.BufferRecycler); line: 1, column: 1]
// //
// verifyException("com.fasterxml.jackson.core.JsonParser", e);
// }
}
@Test(timeout = 4000)
public void test28() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3, (Reader) null, (ObjectCodec) null, charsToNameCanonicalizer0);
// try {
readerBasedJsonParser0.getBinaryValue((Base64Variant) null);
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Current token (null) not VALUE_STRING or VALUE_EMBEDDED_OBJECT, can not access as binary
// // at [Source: UNKNOWN; line: 1, column: 1]
// //
// verifyException("com.fasterxml.jackson.core.JsonParser", e);
// }
}
@Test(timeout = 4000)
public void test29() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
byte[] byteArray0 = new byte[5];
ByteArrayInputStream byteArrayInputStream0 = new ByteArrayInputStream(byteArray0, 0, (byte) (-32));
ByteQuadsCanonicalizer byteQuadsCanonicalizer0 = ByteQuadsCanonicalizer.createRoot();
UTF8StreamJsonParser uTF8StreamJsonParser0 = new UTF8StreamJsonParser(iOContext0, 0, byteArrayInputStream0, (ObjectCodec) null, byteQuadsCanonicalizer0, byteArray0, 10, 2, true);
// Undeclared exception!
// try {
uTF8StreamJsonParser0.close();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.core.io.IOContext", e);
// }
}
@Test(timeout = 4000)
public void test30() throws Throwable {
int[] intArray0 = ParserBase.growArrayBy((int[]) null, 0);
assertEquals(0, intArray0.length);
}
@Test(timeout = 4000)
public void test31() throws Throwable {
int[] intArray0 = new int[1];
int[] intArray1 = ParserBase.growArrayBy(intArray0, 2483);
assertEquals(2484, intArray1.length);
}
@Test(timeout = 4000)
public void test32() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
char[] charArray0 = new char[2];
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 2832, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0, charArray0, 123, 4, true);
readerBasedJsonParser0.setFeatureMask((-2195));
// try {
readerBasedJsonParser0.getBigIntegerValue();
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Current token (null) not numeric, can not use numeric value accessors
// // at [Source: (com.fasterxml.jackson.core.util.BufferRecycler); line: 1, column: 124]
// //
// verifyException("com.fasterxml.jackson.core.JsonParser", e);
// }
}
@Test(timeout = 4000)
public void test33() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getFloatValue();
readerBasedJsonParser0.getDecimalValue();
assertEquals(7, readerBasedJsonParser0.getCurrentTokenId());
}
@Test(timeout = 4000)
public void test34() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0.BYTE_WRITE_ENCODING_BUFFER, true);
StringReader stringReader0 = new StringReader("3");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getBigIntegerValue();
double double0 = readerBasedJsonParser0.getDoubleValue();
assertEquals(7, readerBasedJsonParser0.currentTokenId());
assertEquals(3.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test35() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("48");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, (-1465), stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getLongValue();
readerBasedJsonParser0.getBigIntegerValue();
assertEquals(7, readerBasedJsonParser0.currentTokenId());
}
@Test(timeout = 4000)
public void test36() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
byte[] byteArray0 = new byte[9];
ByteArrayInputStream byteArrayInputStream0 = new ByteArrayInputStream(byteArray0, 1694, (-1567));
IOContext iOContext0 = new IOContext(bufferRecycler0, byteArrayInputStream0, true);
StringReader stringReader0 = new StringReader("2E4");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, (byte)5, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getDecimalValue();
readerBasedJsonParser0.getBigIntegerValue();
assertEquals(8, readerBasedJsonParser0.currentTokenId());
}
@Test(timeout = 4000)
public void test37() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
IOContext iOContext0 = new IOContext(bufferRecycler0, (Object) null, true);
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextIntValue(2);
readerBasedJsonParser0.getParsingContext();
assertEquals(7, readerBasedJsonParser0.getCurrentTokenId());
}
@Test(timeout = 4000)
public void test38() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 2, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getLongValue();
readerBasedJsonParser0.getDecimalValue();
assertEquals(7, readerBasedJsonParser0.currentTokenId());
}
@Test(timeout = 4000)
public void test39() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 2, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getDecimalValue();
readerBasedJsonParser0.getDecimalValue();
assertEquals(7, readerBasedJsonParser0.getCurrentTokenId());
}
@Test(timeout = 4000)
public void test40() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("2E4");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextIntValue(33);
double double0 = readerBasedJsonParser0.getDoubleValue();
assertEquals(8, readerBasedJsonParser0.currentTokenId());
assertEquals(20000.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test41() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("48");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 0, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getLongValue();
double double0 = readerBasedJsonParser0.getDoubleValue();
assertEquals(7, readerBasedJsonParser0.currentTokenId());
assertEquals(48.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test42() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("2E4");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 2, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getLongValue();
double double0 = readerBasedJsonParser0.getDoubleValue();
assertEquals(8, readerBasedJsonParser0.getCurrentTokenId());
assertEquals(20000.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test43() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("2E4");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextIntValue(33);
readerBasedJsonParser0.getNumberValue();
readerBasedJsonParser0.getBigIntegerValue();
assertEquals(8, readerBasedJsonParser0.getCurrentTokenId());
}
@Test(timeout = 4000)
public void test44() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0.BYTE_BASE64_CODEC_BUFFER, true);
StringReader stringReader0 = new StringReader("3");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getBigIntegerValue();
readerBasedJsonParser0.getBigIntegerValue();
assertEquals(7, readerBasedJsonParser0.currentTokenId());
}
@Test(timeout = 4000)
public void test45() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 2, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getNumberType();
long long0 = readerBasedJsonParser0.getLongValue();
assertEquals(7, readerBasedJsonParser0.getCurrentTokenId());
assertEquals(3L, long0);
}
@Test(timeout = 4000)
public void test46() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 0, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getLongValue();
long long0 = readerBasedJsonParser0.getLongValue();
assertEquals(7, readerBasedJsonParser0.getCurrentTokenId());
assertEquals(3L, long0);
}
@Test(timeout = 4000)
public void test47() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("2E4");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextIntValue(33);
readerBasedJsonParser0.getBigIntegerValue();
int int0 = readerBasedJsonParser0.getIntValue();
assertEquals(8, readerBasedJsonParser0.getCurrentTokenId());
assertEquals(20000, int0);
}
@Test(timeout = 4000)
public void test48() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 33, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getFloatValue();
int int0 = readerBasedJsonParser0.getIntValue();
assertEquals(7, readerBasedJsonParser0.currentTokenId());
assertEquals(3, int0);
}
@Test(timeout = 4000)
public void test49() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
StringReader stringReader0 = new StringReader("2E4");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1464, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextToken();
readerBasedJsonParser0.getDecimalValue();
readerBasedJsonParser0.getNumberType();
assertEquals(8, readerBasedJsonParser0.getCurrentTokenId());
}
@Test(timeout = 4000)
public void test50() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("2E4");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextIntValue(33);
readerBasedJsonParser0.getNumberType();
assertEquals(8, readerBasedJsonParser0.getCurrentTokenId());
}
@Test(timeout = 4000)
public void test51() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 2, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
// try {
readerBasedJsonParser0.getNumberType();
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Current token (null) not numeric, can not use numeric value accessors
// // at [Source: UNKNOWN; line: 1, column: 1]
// //
// verifyException("com.fasterxml.jackson.core.JsonParser", e);
// }
}
@Test(timeout = 4000)
public void test52() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
StringReader stringReader0 = new StringReader("2E4");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextIntValue(2);
BigDecimal bigDecimal0 = readerBasedJsonParser0.getDecimalValue();
assertNotNull(bigDecimal0);
Number number0 = readerBasedJsonParser0.getNumberValue();
assertSame(number0, bigDecimal0);
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
}
@Test(timeout = 4000)
public void test53() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("2E4");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextIntValue(33);
readerBasedJsonParser0.getNumberValue();
boolean boolean0 = readerBasedJsonParser0.isNaN();
assertEquals(8, readerBasedJsonParser0.getCurrentTokenId());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test54() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("2E4");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextIntValue(33);
readerBasedJsonParser0.isNaN();
assertEquals(8, readerBasedJsonParser0.currentTokenId());
}
@Test(timeout = 4000)
public void test55() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0.BYTE_WRITE_ENCODING_BUFFER, false);
StringReader stringReader0 = new StringReader("3");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
boolean boolean0 = readerBasedJsonParser0.isNaN();
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test56() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("2.2250738585072012e-308");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 33, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
int int0 = readerBasedJsonParser0.nextIntValue((-66968));
assertEquals((-66968), int0);
}
@Test(timeout = 4000)
public void test57() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 0, (Reader) null, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0._getByteArrayBuilder();
readerBasedJsonParser0._getByteArrayBuilder();
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
}
@Test(timeout = 4000)
public void test58() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
IOContext iOContext0 = new IOContext(bufferRecycler0, (Object) null, true);
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
int int0 = readerBasedJsonParser0.getTokenColumnNr();
assertEquals(1, int0);
}
@Test(timeout = 4000)
public void test59() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
Object object0 = new Object();
IOContext iOContext0 = new IOContext(bufferRecycler0, object0, false);
StringReader stringReader0 = new StringReader("3");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 0, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
boolean boolean0 = readerBasedJsonParser0.hasTextCharacters();
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test60() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 0, (Reader) null, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.close();
readerBasedJsonParser0.nextIntValue(1);
assertTrue(readerBasedJsonParser0.isClosed());
}
@Test(timeout = 4000)
public void test61() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
char[] charArray0 = new char[2];
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 2832, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0, charArray0, 123, 4, true);
readerBasedJsonParser0.setFeatureMask((-2195));
readerBasedJsonParser0.setFeatureMask((-1623));
assertEquals((-1623), readerBasedJsonParser0.getFeatureMask());
}
@Test(timeout = 4000)
public void test62() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 0, (Reader) null, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.setFeatureMask((-158));
readerBasedJsonParser0.setFeatureMask(33);
assertEquals(33, readerBasedJsonParser0.getFeatureMask());
}
@Test(timeout = 4000)
public void test63() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("Q^");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
JsonParser jsonParser0 = readerBasedJsonParser0.overrideStdFeatures(3, 1);
assertEquals(3, jsonParser0.getFeatureMask());
}
@Test(timeout = 4000)
public void test64() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 0, (Reader) null, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.overrideStdFeatures(1, 33);
JsonParser jsonParser0 = readerBasedJsonParser0.setFeatureMask(1);
assertNull(jsonParser0.getCurrentToken());
}
@Test(timeout = 4000)
public void test65() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
ByteQuadsCanonicalizer byteQuadsCanonicalizer0 = ByteQuadsCanonicalizer.createRoot();
Enumeration<InputStream> enumeration0 = (Enumeration<InputStream>) mock(Enumeration.class, new ViolatedAssumptionAnswer());
doReturn(false).when(enumeration0).hasMoreElements();
SequenceInputStream sequenceInputStream0 = new SequenceInputStream(enumeration0);
BufferedInputStream bufferedInputStream0 = new BufferedInputStream(sequenceInputStream0);
DataInputStream dataInputStream0 = new DataInputStream(bufferedInputStream0);
UTF8DataInputJsonParser uTF8DataInputJsonParser0 = new UTF8DataInputJsonParser(iOContext0, 3, dataInputStream0, (ObjectCodec) null, byteQuadsCanonicalizer0, 0);
JsonParser.Feature jsonParser_Feature0 = JsonParser.Feature.STRICT_DUPLICATE_DETECTION;
UTF8DataInputJsonParser uTF8DataInputJsonParser1 = (UTF8DataInputJsonParser)uTF8DataInputJsonParser0.disable(jsonParser_Feature0);
assertEquals(1, uTF8DataInputJsonParser1.getTokenLineNr());
assertEquals(3, uTF8DataInputJsonParser1.getFeatureMask());
}
@Test(timeout = 4000)
public void test66() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("Q^");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.setFeatureMask((-933));
JsonParser.Feature jsonParser_Feature0 = JsonParser.Feature.STRICT_DUPLICATE_DETECTION;
readerBasedJsonParser0.enable(jsonParser_Feature0);
assertEquals((-933), readerBasedJsonParser0.getFeatureMask());
}
@Test(timeout = 4000)
public void test67() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
StringReader stringReader0 = new StringReader("Q^");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 486, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
JsonParser.Feature jsonParser_Feature0 = JsonParser.Feature.STRICT_DUPLICATE_DETECTION;
readerBasedJsonParser0.enable(jsonParser_Feature0);
assertEquals(2534, readerBasedJsonParser0.getFeatureMask());
}
@Test(timeout = 4000)
public void test68() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
StringReader stringReader0 = new StringReader("{");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3072, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
JsonParser.Feature jsonParser_Feature0 = JsonParser.Feature.IGNORE_UNDEFINED;
readerBasedJsonParser0.enable(jsonParser_Feature0);
assertEquals(7168, readerBasedJsonParser0.getFeatureMask());
}
@Test(timeout = 4000)
public void test69() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
// try {
readerBasedJsonParser0.getFloatValue();
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Current token (null) not numeric, can not use numeric value accessors
// // at [Source: UNKNOWN; line: 1, column: 1]
// //
// verifyException("com.fasterxml.jackson.core.JsonParser", e);
// }
}
@Test(timeout = 4000)
public void test70() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("Q^");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.setCurrentValue(iOContext0);
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
}
@Test(timeout = 4000)
public void test71() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("Q^");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.version();
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
}
@Test(timeout = 4000)
public void test72() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
StringReader stringReader0 = new StringReader("3");
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 1, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
long long0 = readerBasedJsonParser0.getTokenCharacterOffset();
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
assertEquals(0L, long0);
}
@Test(timeout = 4000)
public void test73() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
PipedInputStream pipedInputStream0 = new PipedInputStream(2);
IOContext iOContext0 = new IOContext(bufferRecycler0, pipedInputStream0, false);
StringReader stringReader0 = new StringReader("-Infinity");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, (byte) (-1), stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextFieldName((SerializableString) null);
assertTrue(readerBasedJsonParser0.isNaN());
}
@Test(timeout = 4000)
public void test74() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("2E4");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.nextIntValue(2);
readerBasedJsonParser0.getIntValue();
readerBasedJsonParser0.getNumberValue();
assertEquals(8, readerBasedJsonParser0.currentTokenId());
}
@Test(timeout = 4000)
public void test75() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, (-1285), stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.getCurrentValue();
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
}
@Test(timeout = 4000)
public void test76() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
String string0 = "}tL(IAd\\uwtE5U^";
StringReader stringReader0 = new StringReader(string0);
char[] charArray0 = new char[9];
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0, charArray0, 1, 0, true);
// try {
readerBasedJsonParser0.nextToken();
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Unexpected close marker '}': expected ']' (for root starting at [Source: UNKNOWN; line: 1, column: 0])
// // at [Source: UNKNOWN; line: 1, column: 2]
// //
// verifyException("com.fasterxml.jackson.core.JsonParser", e);
// }
}
@Test(timeout = 4000)
public void test77() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
StringReader stringReader0 = new StringReader("{");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3072, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
int int0 = readerBasedJsonParser0.getTokenLineNr();
assertEquals(1, int0);
}
@Test(timeout = 4000)
public void test78() throws Throwable {
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, false);
StringReader stringReader0 = new StringReader("T:4J5HFp45");
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 3, stringReader0, (ObjectCodec) null, charsToNameCanonicalizer0);
readerBasedJsonParser0.isClosed();
assertEquals(1, readerBasedJsonParser0.getTokenLineNr());
}
}
| [
"[email protected]"
] | |
06f720a91a0f1416d2b78190e7e55067b8e3e012 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/19/19_a7475f2c9b0a58b0b1acbe0e5e83c84a077a1dd2/AdminController/19_a7475f2c9b0a58b0b1acbe0e5e83c84a077a1dd2_AdminController_t.java | 6bb0aa5a220cc72c7d322d01a91d0a8753388740 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 2,521 | java | package is2.controller;
import java.util.List;
import javax.inject.Inject;
import javax.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.Validator;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.support.SessionStatus;
import org.springframework.web.servlet.ModelAndView;
import is2.domain.Admin;
import is2.domain.Alumno;
import is2.service.AdminService;
import is2.service.AlumnoService;
@Controller
@RequestMapping("/admin")
public class AdminController {
@Inject
AdminService adminService;
@Inject
AlumnoService alumnoService;
@Inject
Validator validator;
@RequestMapping("/list.html")
public ModelAndView list() {
return new ModelAndView("admin/list", "admins", adminService.findAll());
}
@RequestMapping("/alumnos.html")
public ModelAndView alumnos() {
List<Alumno> alumnos = alumnoService.findAll();
ModelAndView model = new ModelAndView("admin/alumnos");
model.addObject("alumnos",alumnos);
return model;
}
@RequestMapping("/{id}/details.html")
public ModelAndView details(@PathVariable Long id) {
ModelAndView view = new ModelAndView();
view.addObject("admin", adminService.find(id));
view.setViewName("admin/details");
return view;
}
@RequestMapping("/{id}/edit.html")
public ModelAndView edit(@PathVariable Long id) {
ModelAndView view = new ModelAndView();
view.addObject("admin", adminService.find(id));
view.setViewName("admin/edit");
return view;
}
@RequestMapping("/add.html")
public ModelAndView add() {
ModelAndView view = new ModelAndView();
view.addObject("admin", new Admin());
view.setViewName("admin/edit");
return view;
}
@RequestMapping(value = "/save.html", method = RequestMethod.POST)
public ModelAndView save(@ModelAttribute("admin") @Valid Admin Admin, BindingResult result, SessionStatus status) {
if (Admin.getId() == null) {
adminService.persist(Admin);
status.setComplete();
}
else {
adminService.merge(Admin);
status.setComplete();
}
return new ModelAndView(result.getErrorCount() > 0 ? "admin/edit" : "redirect:list.html");
// return new ModelAndView("Admin/save");
}
}
| [
"[email protected]"
] | |
24fa650be7ce42d66d8cd0b04dec41399436d259 | fd8372f1c796b040c7f6704f9dbd44f84f981f8f | /my/framework/hibernate/demo/Demo2.java | f510a56d4341eee046af933501bf49b88e8d74a3 | [] | no_license | aspiringmaven/HibernateGyan | 26280cb34040e8455699697933e0d7c657936325 | a4248e27c27d5415e4a0808815326e5f70f3d1a6 | refs/heads/master | 2021-01-17T06:46:16.495635 | 2016-07-10T12:22:06 | 2016-07-10T12:22:06 | 51,706,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,636 | java | package my.framework.hibernate.demo;
import java.util.LinkedHashSet;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import my.framework.hibernate.beans.Engineer;
public class Demo2 {
public static void main(String[] args) {
Engineer engineer1 = new Engineer();
Engineer engineer2 = new Engineer();
engineer1.setSkills(new LinkedHashSet<String>());
engineer2.setSkills(new LinkedHashSet<String>());
engineer1.setEmpId(1);
engineer1.setEmpId(2);
engineer1.setName("Sumit Kawatra");
engineer2.setName("Rahul Bhayana");
engineer1.getSkills().add("Java");
engineer1.getSkills().add("JSP");
engineer1.getSkills().add("SERVLET");
engineer1.getSkills().add("JNDI");
engineer1.getSkills().add("JavaScript");
engineer1.getSkills().add("JQuery");
engineer1.getSkills().add("Spring");
engineer1.getSkills().add("Hibernate");
engineer2.getSkills().add("SQL");
engineer2.getSkills().add("PL/SQL");
engineer2.getSkills().add("SSIS");
engineer2.getSkills().add("SSRS");
engineer2.getSkills().add("ETL");
engineer2.getSkills().add("C#");
engineer2.getSkills().add("LINQ");
@SuppressWarnings("deprecation")
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
try{
session.save(engineer1);
session.save(engineer2);
session.getTransaction().commit();
System.out.println("Done");
}finally{
session.close();
sessionFactory.close();
}
}
}
| [
"[email protected]"
] | |
f93a2e81361b989ffce05311dd3e18e865160081 | efa111e72e82f3bf1f03ae853ca13f16bac370bd | /yifu_system/src/main/java/com/jwk/project/app/user/controller/RegisterController.java | aab004420b20cee9060db883ef49e0b79e347e7d | [] | no_license | shiyijun0/microonfig | 5fe2a38bee69a19e2489476006c58a3b1967a622 | 83b80ac70bbe8c2b993143d800a7d1991c6bc786 | refs/heads/master | 2020-03-26T20:51:27.096757 | 2018-08-20T02:07:29 | 2018-08-20T02:09:39 | 145,350,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,486 | java | package com.jwk.project.app.user.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.connector.ClientAbortException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.jwk.common.utils.StrUtils;
import com.jwk.common.utils.message.GuoJiShortUtils;
import com.jwk.common.utils.message.ValidateCodeSession;
import com.jwk.framework.web.controller.BaseController;
/**
* 用户注册
*
* @author Administrator
*
*/
@Controller
@RequestMapping("/app/reguser")
public class RegisterController extends BaseController {
// 发送短信验证码
@RequestMapping("/sendValidateCode")
public ValidateCodeSession sendValidateCode(String mobile, HttpServletRequest request, HttpServletResponse response)
throws Exception {
String mobile2 = StrUtils.parsePhone(mobile);
if (StrUtils.isEmpty(mobile2))
throw new ClientAbortException("手机号为空!");
if (StrUtils.isMobile(mobile))
throw new ClientAbortException("手机号格式不正确!");
String validate_code = StrUtils.getRandomNumber(6);
String result = GuoJiShortUtils.sendCode(mobile2, validate_code);
ValidateCodeSession validateCodeSession2 = null;
if ("success".equals(result)) {
validateCodeSession2 = new ValidateCodeSession(validate_code);
} else {
throw new ClientAbortException("验证短信未发送成功!");
}
return validateCodeSession2;
}
// 注册用户
@RequestMapping("/register")
public void register(String mobile, String validate_code, String password, Object obj) throws Exception {
if (StrUtils.isEmpty(validate_code))
throw new ClientAbortException("验证码不正!");
if (StrUtils.isEmpty(mobile))
throw new ClientAbortException("手机号为空!");
if (StrUtils.isMobile(mobile))
throw new ClientAbortException("手机号格式不正确!");
if (StrUtils.isEmpty(password))
throw new ClientAbortException("密码为空!");
if (obj == null) {
throw new ClientAbortException("验证码不正确.");
}
ValidateCodeSession validateCodeSession = (ValidateCodeSession) obj;
if (System.currentTimeMillis() - validateCodeSession.getCreate_time() > 1000 * 60 * 15) {
throw new ClientAbortException("验证码已失效!");
}
if (!validateCodeSession.getValidate_code().equals(validate_code)) {
throw new ClientAbortException("验证码不正确!");
}
}
}
| [
"[email protected]"
] | |
d5a995c5035f60e46ecce953458b86cea1e335b6 | dea63e971fc55dd5bb4159874761f71781f6494c | /src/test/java/org/zerock/persistence/BoardDAOImplTest.java | da6c25605df0f0c35cc70dc2a24842659c6f9431 | [] | no_license | cuteprettykara/springWebProject_2nd | e7e32c6efd400081169fccee1f45aff8c01ce6a7 | de889f73f64746cfa5a197059502a8e3bdb3e9c8 | refs/heads/master | 2020-03-10T01:05:48.905551 | 2018-05-17T07:52:24 | 2018-05-17T07:52:24 | 129,100,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,857 | java | package org.zerock.persistence;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import java.util.List;
import javax.inject.Inject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import org.zerock.domain.BoardVO;
import org.zerock.domain.Criteria;
import org.zerock.domain.SearchCriteria;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:/applicationContext.xml")
@Transactional
public class BoardDAOImplTest {
private static final Logger logger = LoggerFactory.getLogger(BoardDAOImplTest.class);
@Inject
private BoardDAO boardDao;
/* @Inject
private DataSource dataSource;
@Before
public void initialize() {
ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
populator.addScript(new ClassPathResource("zerock.sql"));
DatabasePopulatorUtils.execute(populator, dataSource);
logger.info("### database successfully initialized!");
}*/
@Test
public void testCreate() {
BoardVO dbBoard = new BoardVO("새로운 글을 넣습니다.", "새로운 글을 넣습니다.", "prettykara");
boardDao.create(dbBoard);
}
@Test
public void testRead() {
BoardVO dbBoard = boardDao.read(1);
BoardVO board = new BoardVO(1, "타이틀1", "타이틀1 내용", "prettykara");
assertEquals(board, dbBoard);
}
@Test
public void testUpdate() {
BoardVO board = new BoardVO(1, "타이틀1_update", "타이틀1 내용_update", "prettykara");
boardDao.update(board);
BoardVO dbBoard = boardDao.read(1);
assertEquals(board, dbBoard);
}
/* @Test
public void testDelete() {
boardDao.delete(1);
BoardVO dbBoard = boardDao.read(1);
assertNull(dbBoard);
}*/
@Test
public void testListAll() {
boardDao.listAll();
}
@Test
public void testListPage() {
int page = 3;
List<BoardVO> list = boardDao.listPage(page);
for (BoardVO boardVO : list) {
logger.info(boardVO.getBno() + ":" + boardVO.getTitle());
}
}
@Test
public void testListCriteria() {
Criteria cri = new Criteria();
cri.setPage(3);
cri.setPerPageNum(20);
List<BoardVO> list = boardDao.listCriteria(cri);
for (BoardVO boardVO : list) {
logger.info(boardVO.getBno() + ":" + boardVO.getTitle());
}
}
@Test
public void testListSearch() {
SearchCriteria cri = new SearchCriteria();
cri.setPage(3);
cri.setPerPageNum(20);
cri.setSearchType("t");
cri.setKeyword("한글");
logger.info("=======================================================");
List<BoardVO> list = boardDao.listSearch(cri);
for (BoardVO boardVO : list) {
logger.info(boardVO.getBno() + ":" + boardVO.getTitle());
}
logger.info("=======================================================");
logger.info("count : {}", boardDao.getTotalSearchCount(cri));
}
@Test
public void testURI() throws Exception {
UriComponents uriComponents =
UriComponentsBuilder.newInstance()
// .path("/board/read")
.queryParam("bno", 12)
.queryParam("perPageNum", 20)
.build();
logger.debug("/board/read?bno=12&perPageNum=20");
logger.debug(uriComponents.toString());
}
@Test
public void testURI2() throws Exception {
UriComponents uriComponents =
UriComponentsBuilder.newInstance()
.path("/{module}/{page}")
.queryParam("bno", 12)
.queryParam("perPageNum", 20)
.build()
.expand("board", "read")
.encode();
logger.debug("/board/read?bno=12&perPageNum=20");
logger.debug(uriComponents.toString());
}
}
| [
"@gmail.com"
] | @gmail.com |
56e833564ece06e5d34f2bf6ea248e8fa7c20880 | 6451bccdff554567f0906a795ff6bdb660b02e03 | /src/test/testData/UnitsInspectionTest/Misc/ternary.java | ae36cf9d90c00ace2ac9619e4e919e854f9748a9 | [
"Apache-2.0"
] | permissive | KelvinNi/intellijLint | a6c25617732d79f6703b45ed2eeaeefe072059af | 83a18fb75594c92c5dee197a43a7dd8f9674c8be | refs/heads/master | 2020-03-16T02:49:48.126380 | 2017-07-17T09:16:42 | 2017-07-17T09:24:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 806 | java | /*
* Copyright 2017 LMAX Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@org.checkerframework.framework.qual.SubtypeOf
private @interface foo {}
public class Foo {
private void foos()
{
@foo long test = true ? 1 : (@foo long) 2;
}
}
| [
"[email protected]"
] | |
a612b6cd3f7e0e7de5ca2891cadb6b75a3e1ceaa | 1a2fb7fb0f88c218b7992f0e40806f11369900e3 | /src/View/TelaPrincipal.java | 25f7e7039d9553f4bcdbeaafa625c6a2174442be | [] | no_license | gioalmeida/Atividade-05 | 8f3f587f3c613cf93793c201b8fdb49d7b5d92d3 | 5577faa513a7dfb894d9e8aa862e51f106e82fa3 | refs/heads/main | 2023-06-11T20:23:29.494432 | 2021-06-27T15:17:45 | 2021-06-27T15:17:45 | 380,765,316 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,399 | java | package View;
import java.text.ParseException ;
import java.util.Scanner ;
import java.util.concurrent.TimeUnit ;
public class TelaPrincipal {
public static Scanner menuPrincipal ( console do Scanner ) lança ParseException , InterruptedException {
int opcao = 0 ;
faça {
Sistema . para fora . println ( " \ n \ n Sistema de Controler do IFG " );
Sistema . para fora . println ( " =========================== " );
Sistema . para fora . println ( " | 1 - Aluno | " );
Sistema . para fora . println ( " | 2 - Curso | " );
Sistema . para fora . println ( " | 3 - Disciplina | " );
Sistema . para fora . println ( " | 0 - Sair | " );
Sistema . para fora . println ( " =========================== " );
Sistema . para fora . print ( " Opção -> " );
opcao = console . nextInt ();
console . nextLine ();
switch (opcao) {
caso 1 : retornar TelaAluno . menuAluno (console);
caso 2 : retornar TelaCurso . menuCurso (console);
caso 3 : retornar TelaDisciplina . menuDisciplina (console);
caso 0 : sistema . para fora . println ( " Aplicação Encerrada! " );
pausa ;
padrão :
Sistema . para fora . println ( " Opção Inválida! " );
TimeUnit . SEGUNDOS . dormir ( 1 );
}
} enquanto (opcao ! = 0 );
console de retorno ;
}
}
| [
"[email protected]"
] | |
2695e7085f78c8aa3db4c6a1f0fad8f1ff117b6e | 86f61d1011fe103266017c4e2aecd21154b150a3 | /lab4/src/cpp/lab4/Message.java | ee7cfc09e312e3fa147f523f80f5b556e54cc564 | [] | no_license | nikkonrom/cross-platform_programming | 439e7c0225836cde7942210a51855861acba9918 | cbc0832185ace51ae0967537f190943390a0fea1 | refs/heads/master | 2021-04-28T16:09:27.710489 | 2018-05-26T11:53:24 | 2018-05-26T11:53:24 | 122,006,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package cpp.lab4;
import java.util.concurrent.BlockingQueue;
public class Message {
public String messageData;
public BlockingQueue<String> sender;
public Message(String messageData, BlockingQueue<String> sender){
this.messageData = messageData;
this.sender = sender;
}
}
| [
"[email protected]"
] | |
8a18f4079c0468272ee3a7b9b38023df67c02e48 | 94e9da84faab3e6a78ee3f89b66141d963658fcd | /kie-wb-common-screens/kie-wb-common-project-editor/kie-wb-common-project-editor-client/src/main/java/org/kie/workbench/common/screens/projecteditor/client/handlers/NewPackageHandler.java | 5177655861505e86d8813304b93d79564b50d874 | [] | no_license | hernsys/kie-wb-common-6.1.0.CR1 | c3a9db40e83959e4ebb318f604b0c3297ee21423 | 1f66aa7d08852257526be33810133725097533f6 | refs/heads/master | 2021-01-10T20:14:10.446327 | 2014-08-19T14:29:34 | 2014-08-19T14:29:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,548 | java | package org.kie.workbench.common.screens.projecteditor.client.handlers;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.IsWidget;
import org.guvnor.common.services.project.model.Package;
import org.guvnor.common.services.project.service.ProjectService;
import org.jboss.errai.common.client.api.Caller;
import org.jboss.errai.common.client.api.RemoteCallback;
import org.kie.workbench.common.screens.projecteditor.client.resources.ProjectEditorResources;
import org.kie.workbench.common.services.shared.validation.ValidationService;
import org.kie.workbench.common.services.shared.validation.ValidatorWithReasonCallback;
import org.kie.workbench.common.widgets.client.callbacks.DefaultErrorCallback;
import org.kie.workbench.common.widgets.client.handlers.DefaultNewResourceHandler;
import org.kie.workbench.common.widgets.client.handlers.NewResourcePresenter;
import org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants;
import org.uberfire.workbench.type.AnyResourceTypeDefinition;
import org.uberfire.workbench.type.ResourceTypeDefinition;
/**
* Handler for the creation of new Folders
*/
@ApplicationScoped
public class NewPackageHandler
extends DefaultNewResourceHandler {
@Inject
private Caller<ProjectService> projectService;
@Inject
private Caller<ValidationService> validationService;
@Inject
//We don't really need this for Packages but it's required by DefaultNewResourceHandler
private AnyResourceTypeDefinition resourceType;
@Override
public String getDescription() {
return ProjectEditorResources.CONSTANTS.newPackageDescription();
}
@Override
public IsWidget getIcon() {
return new Image( ProjectEditorResources.INSTANCE.newFolderIcon() );
}
@Override
public ResourceTypeDefinition getResourceType() {
return resourceType;
}
@Override
public void validate( final String packageName,
final ValidatorWithReasonCallback callback ) {
if ( pathLabel.getPath() == null ) {
Window.alert( CommonConstants.INSTANCE.MissingPath() );
callback.onFailure();
return;
}
validationService.call( new RemoteCallback<Boolean>() {
@Override
public void callback( final Boolean response ) {
if ( Boolean.TRUE.equals( response ) ) {
callback.onSuccess();
} else {
callback.onFailure( ProjectEditorResources.CONSTANTS.InvalidPackageName( packageName ) );
}
}
} ).isPackageNameValid( packageName );
}
@Override
public void create( final Package pkg,
final String baseFileName,
final NewResourcePresenter presenter ) {
projectService.call( getPackageSuccessCallback( presenter ),
new DefaultErrorCallback() ).newPackage( pkg,
baseFileName );
}
private RemoteCallback<Package> getPackageSuccessCallback( final NewResourcePresenter presenter ) {
return new RemoteCallback<Package>() {
@Override
public void callback( final Package pkg ) {
presenter.complete();
notifySuccess();
}
};
}
}
| [
"[email protected]"
] | |
926dad8e763da4a71b347aa1a97770ad40bdd208 | aa49f99307b9c0c70bf3e831b100680ce7d14228 | /src/oopconcepts/ForDemo.java | 4a7f31f14b1516b0cc061ff0b911e0314c50c6d8 | [] | no_license | okletsov/java_udemy_2 | a933da947b94cd89368455cbc4d87d72231ad42e | dacd69d2fe0d235fc63ff68eace3658d71200519 | refs/heads/master | 2020-03-18T00:23:43.624647 | 2018-05-20T02:53:13 | 2018-05-20T02:53:13 | 134,090,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package oopconcepts;
public class ForDemo {
public static void main (String[] args){
for (int i = 0; i <= 10; i++){
System.out.println("Value of i: " + i);
}
int[] numbers = {10, 20, 30};
System.out.println("Array length is: " + numbers.length);
for (int i = 0; i < numbers.length; i++){
System.out.println("The value of index " + i + " is: " + numbers[i]);
}
for (int number: numbers) {
System.out.println("The value is: " + number);
}
String[] car = {"bwm", "audi", "honda"};
for (String number: car) {
System.out.println("The car is " + number);
}
}
}
| [
"[email protected]"
] | |
7b9f99420bdbff5dd96eb09de80174a74d6b14e3 | b67728d14dcab9a84c14fcd2461b1a93ba5a7719 | /teros-central-server/src/main/java/com/teros/central_server/Application.java | 7136ae8f1e10c63a3bf24733aa884307732e94ae | [] | no_license | onlywin7788/teros | af3320e1c6b20b13caa2d96a25ba27c411f6b428 | adc04285a683b5a77d3b0b7202566b5222ee4a59 | refs/heads/main | 2023-01-15T12:16:50.371657 | 2020-11-23T02:00:16 | 2020-11-23T02:00:16 | 304,207,685 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,071 | java | package com.teros.central_server;
import com.teros.central_server.config.shutdown.GracefulShutdown;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
@EnableJpaAuditing
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
/* graceful shutdown setting */
@Bean
public GracefulShutdown gracefulShutdown() {
return new GracefulShutdown();
}
@Bean
public ConfigurableServletWebServerFactory webServerFactory(final GracefulShutdown gracefulShutdown) {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
factory.addConnectorCustomizers(gracefulShutdown);
return factory;
}
}
| [
"[email protected]"
] | |
5616f51877f4d13f03c1d4c3a90ea6bf9ed66f53 | d88d374a8ed393a11a83fd0fe590c5dd9713d91c | /PeopleWS/src/main/java/com/ajs/dao/HibernateDao.java | 48429fcc342e43e5d506a0da7d457464dc1fe040 | [] | no_license | andyuser727/blah | 81cfd82402b6bdb8566c23524c743a0a0ae33f1f | 877946dfe2ee2bb0af9d53746198acb64bd62fda | refs/heads/master | 2021-01-22T22:56:58.129005 | 2014-10-11T12:17:59 | 2014-10-11T12:17:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,148 | java | package com.ajs.dao;
import com.ajs.domain.Invoice;
import com.ajs.domain.PersistentObject;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import java.io.File;
import java.util.List;
/**
* Created with IntelliJ IDEA.
* User: AndySmith
* Date: 06/07/2013
* Time: 13:09
* To change this template use File | Settings | File Templates.
*/
@Component
public class HibernateDao<T extends PersistentObject> {
Class<T> type;
public HibernateDao(Class<T> type) {
this.type = type;
}
public HibernateDao(){
}
@Autowired
SessionFactory sf;
public PersistentObject findById(Long id){
return (PersistentObject)sf.getCurrentSession().get(type, id);
}
@Transactional
public void save(T objectToPersist){
try {
sf.getCurrentSession().save(objectToPersist);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
@Transactional
public void persist(T objectToPersist){
try {
sf.getCurrentSession().persist(objectToPersist);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
@Transactional
public void delete(T objectToPersist){
try {
sf.getCurrentSession().delete(objectToPersist);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
@Transactional
public List<T> findAll() {
Session session;
List<T> list = null;
try {
session = sf.getCurrentSession();
list = session.createCriteria(type).list();
// Hibernate.initialize(list);
} catch (Exception e) {
System.out.println(e.getMessage());
}
return list;
}
}
| [
"[email protected]"
] | |
61b0f15bebe6532449c17f218a5dc80a7c7f908c | 90efad8bf93fb9f39ad43238b971b612be1fd12f | /spring-boot-jwt/src/main/java/com/andy/jwt/JwtApplication.java | 845e8bbad9f2f8dc0d2a209e8d36c5fd65405f36 | [
"Apache-2.0"
] | permissive | SharingTourism/spring-boot-examples | eaa3e8e765464e1e5a6ae89f8d0e6dcfa382b8b5 | dc6882afd62db46bc29fefb06184e9e303392804 | refs/heads/master | 2020-09-24T13:06:08.508217 | 2019-03-28T07:24:10 | 2019-03-28T07:24:10 | 225,764,962 | 0 | 0 | null | 2019-12-04T02:51:10 | 2019-12-04T02:51:09 | null | UTF-8 | Java | false | false | 358 | java | package com.andy.jwt;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author Leone
* @since 2018-04-15
**/
@SpringBootApplication
public class JwtApplication {
public static void main(String[] args) {
SpringApplication.run(JwtApplication.class, args);
}
}
| [
"[email protected]"
] | |
216b13b54ff87bf2de86788866995d105986647f | e74856004309a0393a5c81af7402786b1feb4997 | /River/src/main/java/_11/misc/PrimitiveNumberEditor.java | 71f8009e8e4acf95e7fa87f031ef5a0be7cd9b78 | [] | no_license | EEIT10403/River | 68b681bab4980cc8dc4f15735b49b47b4e5ded5c | 9f04d1d17f3db5deeba11f1683cbb0ab89691343 | refs/heads/master | 2020-04-13T17:46:25.330805 | 2019-01-30T06:04:51 | 2019-01-30T06:04:51 | 163,007,704 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 918 | java | //package _11.misc;
//
//import java.text.NumberFormat;
//
//import org.springframework.beans.propertyeditors.CustomNumberEditor;
//
//public class PrimitiveNumberEditor extends CustomNumberEditor {
// private final boolean ALLOW_EMPTY;
//
// public PrimitiveNumberEditor(Class<? extends Number> numberClass,
// boolean allowEmpty) throws IllegalArgumentException {
// this(numberClass, null, allowEmpty);
// }
// public PrimitiveNumberEditor(Class<? extends Number> numberClass,
// NumberFormat numberFormat, boolean allowEmpty) throws IllegalArgumentException {
// super(numberClass, numberFormat, allowEmpty);
// this.ALLOW_EMPTY = allowEmpty;
// }
//
// @Override
// public void setAsText(String text) throws IllegalArgumentException {
// if( (text==null || text.length()==0) && ALLOW_EMPTY) {
// super.setAsText("0");
// } else {
// super.setAsText(text);
// }
// }
//}
| [
"[email protected]"
] | |
29af354c2225064e5cccb3c98e57b48ca9a92fb9 | e04c4d401e264b4c9b9dec1cb1a619a1eb571d67 | /ThreeWaysToConfigure/src/main/java/priv/lint/XMl/Student.java | 735dbef466a1f08e43b76157a075f60ceaf528ed | [] | no_license | lintsGitHub/Spring-LearningPractice | 629d988e87f85618f2b959563ec10c5cd8a15f18 | aba09a42730360353b22bad38ff2d73aafddd3b7 | refs/heads/master | 2020-04-07T16:05:18.598348 | 2018-12-28T11:33:00 | 2018-12-28T11:33:00 | 158,514,520 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 150 | java | package priv.lint.XMl;
public class Student implements per {
@Override
public void sayHello() {
System.out.println("hello");
}
}
| [
"[email protected]"
] | |
8241f573bc3f0ef6e74a1a398d7bbf4212ec411e | 9c9e529f74abc5b2efef80bab36320722c788c17 | /src/main/java/com/itech4kids/skyblock/CustomMobs/SEntityAI.java | 0aca7fefb826af2c32fc16f23d0db1984d8ec806 | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | gamingdoom/SkyBlock | 40eacb006e8f765f7b37a7d7fe6910179c30c13f | 85efe1e696557f61cc3e24238727990dddfcdc70 | refs/heads/main | 2023-05-13T14:50:32.709970 | 2021-05-27T20:21:15 | 2021-05-27T20:21:15 | 371,186,388 | 0 | 0 | MIT | 2021-05-26T22:46:55 | 2021-05-26T22:46:55 | null | UTF-8 | Java | false | false | 5,000 | java | package com.itech4kids.skyblock.CustomMobs;
import com.itech4kids.skyblock.Main;
import net.minecraft.server.v1_8_R3.AttributeInstance;
import net.minecraft.server.v1_8_R3.EntityInsentient;
import net.minecraft.server.v1_8_R3.GenericAttributes;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.entity.*;
import org.bukkit.scheduler.BukkitRunnable;
public class SEntityAI {
public static void runWeaverSpiderAI(SEntity weaverSpider){
}
public static void runDasherSpiderAI(SEntity sEntity){
new BukkitRunnable() {
@Override
public void run() {
if (sEntity.getVanillaEntity().isDead()){
cancel();
}else{
for (Entity entity : sEntity.getVanillaEntity().getNearbyEntities(5, 2, 5)){
if (entity instanceof Player){
if (sEntity.getVanillaEntity().getType().equals(EntityType.SPIDER)){
Spider spider = (Spider) sEntity.getVanillaEntity();
spider.setTarget((LivingEntity) entity);
spider.setVelocity(spider.getLocation().getDirection().multiply(1.0D));
AttributeInstance attributes = ((EntityInsentient)((CraftEntity)sEntity.getVanillaEntity()).getHandle()).getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
attributes.setValue(0.2);
}
}
}
}
}
}.runTaskTimer(Main.getMain(), 5L, 40);
}
public static void runSpiderAI(SEntity sEntity){
new BukkitRunnable() {
@Override
public void run() {
if (sEntity.getVanillaEntity().isDead()){
cancel();
}else{
for (Entity entity : sEntity.getVanillaEntity().getNearbyEntities(5, 2, 5)){
if (entity instanceof Player){
if (sEntity.getVanillaEntity().getType().equals(EntityType.WOLF)){
Spider wolf = (Spider) sEntity.getVanillaEntity();
wolf.setTarget((LivingEntity) entity);
AttributeInstance attributes = ((EntityInsentient)((CraftEntity)sEntity.getVanillaEntity()).getHandle()).getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
attributes.setValue(0.4);
}
}
}
}
}
}.runTaskTimer(Main.getMain(), 5L, 40);
}
public static void runWolfAI(SEntity sEntity){
new BukkitRunnable() {
@Override
public void run() {
if (sEntity.getVanillaEntity().isDead()){
cancel();
}else{
for (Entity entity : sEntity.getVanillaEntity().getNearbyEntities(5, 2, 5)){
if (entity instanceof Player){
if (sEntity.getVanillaEntity().getType().equals(EntityType.WOLF)){
Wolf wolf = (Wolf) sEntity.getVanillaEntity();
wolf.setAngry(true);
wolf.setTarget((LivingEntity) entity);
AttributeInstance attributes = ((EntityInsentient)((CraftEntity)sEntity.getVanillaEntity()).getHandle()).getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
attributes.setValue(0.4);
}
}
}
}
}
}.runTaskTimer(Main.getMain(), 5L, 40);
}
public static void runGhoulAI(SEntity sEntity){
new BukkitRunnable() {
@Override
public void run() {
if (sEntity.getVanillaEntity().isDead()){
cancel();
}else{
for (Entity entity : sEntity.getVanillaEntity().getNearbyEntities(5, 2, 5)){
if (entity instanceof Player){
if (sEntity.getVanillaEntity().getType().equals(EntityType.ZOMBIE)){
Zombie zombie = (Zombie) sEntity.getVanillaEntity();
zombie.setTarget((LivingEntity) entity);
zombie.setVillager(false);
AttributeInstance attributes = ((EntityInsentient)((CraftEntity)sEntity.getVanillaEntity()).getHandle()).getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
attributes.setValue(0.3);
}
}
}
}
}
}.runTaskTimer(Main.getMain(), 5L, 40);
}
}
| [
"[email protected]"
] | |
ce3827b76d4eef894c4c5d8a9bdeeb9d352e4cba | 7b20f973f3ca7def28bd75138a6a257713679957 | /app/src/main/java/com/overs/sailscore/RaceTimePair.java | affa689cce3732fc2ca0967d3cc63949597a69f9 | [] | no_license | patovers/sailscore | 6a8d4324680a95150376e5cb2b3b4cbf7a4cabf0 | 64ea2fa3c44844ad86390434cd1af4d33af5d24d | refs/heads/master | 2021-01-10T21:49:35.674202 | 2016-01-21T21:14:12 | 2016-01-21T21:14:12 | 50,136,959 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,263 | java | /*
* This class defines a data type for use in the EntriesSelectListActivity.
* It allows a single data type to be bound to a row in the list using the
* EntriesSelectListAdapter custom list adapter.
*/
package com.overs.sailscore;
public class RaceTimePair implements Comparable<RaceTimePair>{
private int race = 0;
private Float elapsedTime = null;
private int result;
private int discarded = 0;
private int resultCode = 0;
public RaceTimePair (int race, float result) {
this.race = race;
this.elapsedTime = result;
}
public int getRace() {
return race;
}
public void setRace(int race) {
this.race = race;
}
public float getElapsedTime() {
return elapsedTime;
}
public void setElapsedTime(float result) {
this.elapsedTime = result;
}
@Override
public int compareTo(RaceTimePair arg0) {
return Float.compare(elapsedTime, arg0.getElapsedTime());
}
public int isDiscarded() {
return discarded;
}
public void setDiscarded(int discarded) {
this.discarded = discarded;
}
public int getResultCode() {
return resultCode;
}
public void setResultCode(int resultCode) {
this.resultCode = resultCode;
}
public int getResult() {
return result;
}
public void setResult(int result) {
this.result = result;
}
}
| [
"[email protected]"
] | |
96ab38389510d40d8e289c82e9e48472ce01e92b | 36b89c18fde69f8da2e97d20cf9461c441a87b15 | /projectArchetype/src/main/java/com/arabsoft/utils/Utilitaire.java | b0a54a8fac66dc0e24dce8c9e6f38a9a4f66026f | [] | no_license | xsaf/mystke | d278a6ff6c0cc5ebec300ef9e176dfd51050d142 | 7bb36495fef7f1e509e116525e38aa24eb7399aa | refs/heads/master | 2020-05-22T06:43:02.604051 | 2016-10-09T17:13:37 | 2016-10-09T17:13:37 | 62,892,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,323 | java | package com.arabsoft.utils;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
public class Utilitaire {
public static Date ajouterJour(Date date, int nbJour) {
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(date);
cal.add(Calendar.DAY_OF_MONTH, nbJour);
return cal.getTime();
}
public static Long deFormaterMontantNotNull(String mnt, Long nbrDecDev, Long codDevDev) {
if (mnt != null && nbrDecDev != null) {
if (nbrDecDev.intValue() == 3 && codDevDev == 788L) {
String s = mnt.replace(" ", "").replace(".", "").trim();
return Long.valueOf(s);
} else {
String s = mnt.replace(" ", "").replace(".", "").trim();
Long mntDef = Long.valueOf(s);
mntDef = (long) (mntDef * Math.pow(10, nbrDecDev));
return mntDef;
}
} else
return 0L;
}
public static Long deFormaterMontant(String mnt, Long nbrDecDev, Long codDevDev) {
if (mnt != null && nbrDecDev != null) {
if (nbrDecDev.intValue() == 3 && codDevDev == 788L) {
String s = mnt.replace(" ", "").replace(".", "").trim();
return Long.valueOf(s);
} else {
String s = mnt.replace(" ", "").replace(".", "").trim();
Long mntDef = Long.valueOf(s);
mntDef = (long) (mntDef * Math.pow(10, nbrDecDev));
return mntDef;
}
} else
return null;
}
public static String formaterMontant(Long mnt, Long nbrDecDev, Long codDevDev) {
if (mnt != null && nbrDecDev != null) {
DecimalFormat df;
Double mntD = Double.valueOf(mnt) / Math.pow(10, nbrDecDev);
if (nbrDecDev.intValue() == 3 && codDevDev == 788L) {
if (mnt >= 0)
df = new DecimalFormat("# #0.000");
else
df = new DecimalFormat("#0.000");
DecimalFormatSymbols dcmlFS = new DecimalFormatSymbols();
dcmlFS.setDecimalSeparator('.');
dcmlFS.setMinusSign('-');
df.setDecimalFormatSymbols(dcmlFS);
String s = df.format(mntD);
return formatDeciaml(s);
} else {
return formatMnt(String.valueOf(mntD.longValue()).trim());
}
} else
return null;
}
public static String formatDeciaml(String input) {
boolean nnegatif = false;
if (input != null && !input.equals("")) {
if (input.charAt(0) == '-') {
nnegatif = true;
input = input.replace("-", "");
input = input + " ";
}
if (input.indexOf('.') != -1) {
int cmp = (input.length() - 1);
Character c = input.charAt(cmp);
while (cmp > 0 && !c.equals('.') && c.equals('0')) {
input = input.substring(0, cmp);
cmp--;
c = input.charAt(cmp);
}
if (c.equals('.')) {
input = input.substring(0, cmp);
}
}
String dec = "";
String vir = "";
if (input.indexOf('.') != -1) {
vir = "." + input.substring(input.indexOf('.') + 1);
dec = input.substring(0, input.indexOf('.'));
input = formatMnt(dec) + vir;
} else {
dec = input;
input = formatMnt(dec);
}
}
if (nnegatif) {
input = "-" + input;
}
return input;
}
public static String getClientAdressIp() {
HttpServletRequest request =
((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest());
String ip = request.getRemoteAddr();
return ip;
}
public static String formatMnt(String s) {
int rest = s.length() % 3;
List<Character> l = new ArrayList<Character>();
int cmps = 0;
for (int cmp = 0; cmp < rest; cmp++) {
l.add(s.charAt(cmp));
cmps++;
}
l.add(' ');
while (cmps < s.length() - 1) {
for (int cmp = 0; cmp < 3; cmp++) {
l.add(s.charAt(cmps));
cmps++;
}
l.add(' ');
}
int cmp = 0;
String res = "";
while (cmp < l.size()) {
res += l.get(cmp);
cmp++;
}
return res.trim();
}
public static boolean existpoint(String input) {
if (input != null) {
Character c;
for (int i = 0; i < input.length(); i++) {
c = input.charAt(i);
if (c.equals('.')) {
return true;
}
}
}
return false;
}
}
| [
"Safwen@Safwen-PC"
] | Safwen@Safwen-PC |
74ce7863b5314b74db6dddf2ed410d14de48b159 | 16435878ec235617cce6b6422eeaeb27d3009131 | /src/test/java/com/opencart/test/handler/OcCustomerWishlistHandlerTestIt.java | 6ae7d7928b6f4da1401fb42fe12df265ee0d0885 | [] | no_license | gmai2006/opencarttest | fa2207f35046ba636ffef8107a4a6e9ffc57b1bb | b73df234af5bd431b56d038c4aec7aa5383ff1ce | refs/heads/main | 2023-09-02T20:01:51.767075 | 2021-10-16T07:40:18 | 2021-10-16T07:40:18 | 417,754,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,199 | java | /**
* %% Copyright (C) 2021 DataScience 9 LLC %% Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
* <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. #L%
*
* <p>This code is 100% AUTO generated. Please do not modify it DIRECTLY If you need new features or
* function or changes please update the templates then submit the template through our web
* interface.
*/
package com.opencart.test.handler;
import static org.junit.Assert.assertEquals;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.opencart.test.dao.JpaDao;
import com.opencart.test.dao.StandaloneJpaDao;
import com.opencart.test.entity.OcCustomerWishlist;
import com.opencart.test.entity.OcCustomerWishlistId;
import com.opencart.test.utils.ByteArrayToBase64TypeAdapter;
import com.opencart.test.utils.FileUtils;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.json.CDL;
import org.json.JSONArray;
import org.junit.BeforeClass;
import org.junit.Test;
public class OcCustomerWishlistHandlerTestIt {
static final String inputFile = "OcCustomerWishlist.json";
static OcCustomerWishlistHandler handler;
private static JpaDao jpa;
static Gson gson =
new GsonBuilder()
.registerTypeHierarchyAdapter(byte[].class, new ByteArrayToBase64TypeAdapter())
.setDateFormat("yyyy-MM-dd HH:mm:ss.S")
.create();
private OcCustomerWishlist[] records;
/** Run before the test. */
@BeforeClass
public static void before() {
final EntityManagerFactory factory =
Persistence.createEntityManagerFactory("testpersistence");
jpa = new StandaloneJpaDao(factory.createEntityManager());
handler = new OcCustomerWishlistHandler(jpa);
}
@Test
public void testSelect() throws IOException {
final File tempFile =
createRecordInputStreamFromJsonFile(inputFile, Charset.defaultCharset());
final InputStream inputStream = new BufferedInputStream(new FileInputStream(tempFile));
int count = handler.process(inputStream);
String json = FileUtils.readFileFromResource2String(inputFile, Charset.defaultCharset());
records = gson.fromJson(json, OcCustomerWishlist[].class);
assertEquals("match count", count, records.length);
final OcCustomerWishlistId id =
new OcCustomerWishlistId(
this.records[0].getProductId(), this.records[0].getCustomerId());
OcCustomerWishlist testResult = jpa.find(OcCustomerWishlist.class, id);
// cleanup
inputStream.close();
json = null;
records = null;
}
/**
* Construct a delimiter file from a json file.
*
* @param inputFile the json file.
* @param charset default charset.
* @return
*/
private File createRecordInputStreamFromJsonFile(String inputFile, Charset charset) {
try {
final File tempFile = File.createTempFile(inputFile, ".txt");
tempFile.deleteOnExit();
String json =
FileUtils.readFileFromResource2String(inputFile, Charset.defaultCharset());
JSONArray docs = new JSONArray(json);
String csv = CDL.toString(docs);
org.apache.commons.io.FileUtils.writeStringToFile(
tempFile, csv, Charset.defaultCharset());
return tempFile;
} catch (IOException ex) {
ex.printStackTrace();
return null;
}
}
}
| [
"[email protected]"
] | |
ad68ed0735a5d5e2275687aa42d78c2016106ac2 | 144db5a435702cb75309b8ee4d3b0da682556af0 | /common/src/main/java/com/ghy/common/base/BaseMVVMFragment.java | 816c40945241c0d0ac498fefa50e1f82878adc95 | [] | no_license | ghylighti/MyJetPackProject | ef77c4fb89698c917e8deac84251d044a8505bb9 | 53752b7c204466f0fedd5025eaf9416f0593442c | refs/heads/master | 2023-02-08T17:03:59.123096 | 2020-12-30T03:17:16 | 2020-12-30T03:17:16 | 325,442,447 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,507 | java | package com.ghy.common.base;
import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.SavedStateViewModelFactory;
import androidx.lifecycle.ViewModelProvider;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public abstract class BaseMVVMFragment<VM extends AndroidViewModel,V extends ViewDataBinding> extends BaseFragment {
protected VM mViewModel;
protected V mBinding;
private int viewModelId;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
if(isDetached())
{
return mBinding.getRoot();
}
initDataBind(inflater,container);
return mBinding.getRoot();
}
public VM createViewModel(){
return new ViewModelProvider(this,new SavedStateViewModelFactory(getActivity().getApplication(),this)).get(onBindViewModel());
}
private void initDataBind(LayoutInflater inflater,ViewGroup container)
{
mBinding= DataBindingUtil.inflate(inflater,onBindLayoutId(),container,false);
mViewModel=createViewModel();
if(mBinding != null){
int[] vars=onBindVariableId();
for (int i=0;i<vars.length;i++)
{
if(i==0)
{
mBinding.setVariable(onBindVariableId()[i], mViewModel);
}else if(i==1)
{
mBinding.setVariable(onBindVariableId()[1], 0);
}
}
}
mBinding.setLifecycleOwner(this);
}
protected void startController(View v,int action)
{
NavController navController= Navigation.findNavController(v);
navController.navigate(action);
}
protected abstract Class<VM> onBindViewModel();
protected abstract int onBindLayoutId();
protected abstract int[] onBindVariableId();
}
| [
"[email protected]"
] | |
2c2cbe97a7f104fd0cb67b263aead036f4f7f2f5 | 9892a5436a51f152b312193749d22fc9cb93d39c | /src/com/donation/Entite/CurrentUser.java | cf0cc81e07ef6565f4aa0fe6662faa727ea503d3 | [] | no_license | HatemBay/donationJAVAFX | e6f999836a9abe8e09805c9a003b14032c24addb | 191dbc4c9c72b8c101b3dd82390373665aa95fe9 | refs/heads/master | 2022-11-13T18:30:50.368363 | 2020-06-16T02:40:55 | 2020-06-16T02:40:55 | 272,592,069 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,865 | 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.donation.Entite;
import javafx.scene.layout.AnchorPane;
/**
*
* @author Oussama
*/
public class CurrentUser {
private static int id_user;
private static int AnchorPaneCondition=0;
private static AnchorPane anchor;
private static int id_produit_postulation;
private static int choiceMarche=0;
public static int getChoiceMarche() {
return choiceMarche;
}
public static void setChoiceMarche(int choiceMarche) {
CurrentUser.choiceMarche = choiceMarche;
}
public static int getId_produit_postulation() {
return id_produit_postulation;
}
public static void setId_produit_postulation(int id_produit_postulation) {
CurrentUser.id_produit_postulation = id_produit_postulation;
}
private static int PropositionsController=0;
public static AnchorPane getAnchor() {
return anchor;
}
public static int getPropositionsController() {
return PropositionsController;
}
public static void setPropositionsController(int PropositionsController) {
CurrentUser.PropositionsController = PropositionsController;
}
public static void setAnchor(AnchorPane anchor) {
CurrentUser.anchor = anchor;
}
public static int getAnchorPaneCondition() {
return AnchorPaneCondition;
}
public static void setAnchorPaneCondition(int AnchorPaneCondition) {
CurrentUser.AnchorPaneCondition = AnchorPaneCondition;
}
public static int getId_user() {
return id_user;
}
public static void setId_user(int id_user) {
CurrentUser.id_user = id_user;
}
public CurrentUser() {
}
}
| [
"[email protected]"
] | |
d34f7da60fbe107b0ee54226bd86f20f42ce252f | bce607cb2adb1545abe40a6c120a05ec94a33b92 | /Stacks_Using_Arrays.java | d9ff9dee2c6a1bdd6898d59d14e57c3dcbfa9208 | [] | no_license | Varad-Kulkarni/Data_Structures_Using_Java | 17853612b9e1a742f664d392a27d44152c815a3a | ee8d3c8553ac044bf084c82bf04eb465428409b9 | refs/heads/main | 2023-08-12T20:57:55.892373 | 2021-09-29T10:23:44 | 2021-09-29T10:23:44 | 408,767,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,078 | java | class custom_Stack {
private int size;
private int arr[];
private int top;
public custom_Stack(int size) {
this.size = size;
arr = new int[size];
top = -1;
}
public boolean isFull() {
return top == size - 1;
}
public boolean isEmpty() {
return top == -1;
}
public void push(int data) {
if (isFull()) {
System.out.println("Stack OverFlow");
} else {
arr[++top] = data;
}
}
public int pop() {
if (isEmpty()) {
System.out.println("Stack UnderFlow");
return -1;
}
return arr[top--];
}
public int peek() {
if (isFull()) {
System.out.println("Stack OverFlow");
return -1;
} else if (isEmpty()) {
System.out.println("Stack UnderFlow");
return -1;
}
return arr[top];
}
public void show() {
if (isFull()) {
System.out.println("Stack OverFlow");
} else if (isEmpty()) {
System.out.println("Stack UnderFlow");
} else {
System.out.print("{ ");
for (int i = 0; i <= top; i++) {
System.out.print(arr[i] + " ");
}
System.out.print("}");
System.out.println();
}
}
}
public class Stacks_Using_Arrays {
public static void main(String args[]) {
custom_Stack s = new custom_Stack(6);
s.push(0);
s.show();
s.push(1);
s.push(2);
s.push(3);
s.push(4);
s.show();
System.out.println(s.peek());
s.pop();
s.show();
System.out.println(s.peek());
s.pop();
s.show();
System.out.println(s.peek());
s.pop();
s.show();
System.out.println(s.peek());
s.pop();
s.show();
System.out.println(s.peek());
s.pop();
s.show();
System.out.println(s.peek());
s.pop();
s.show();
}
}
| [
"[email protected]"
] | |
3c64e1995c639c380c613740f73d554b955842f2 | ebb431e9a8960d9fd5b2ced22eca5091d28c08b4 | /src/main/java/com/garmin/fit/BloodPressureMesg.java | ef397af24ebebafd9316ff0d89eccd5803bd92b1 | [] | no_license | rtkaczyk/fitter | 2dbf295501bc20da2a65b804820005d75a9d376d | 2cf48854590e3220838993409b5c84b80966f454 | refs/heads/master | 2021-01-22T02:13:17.105676 | 2017-05-27T23:19:59 | 2017-05-27T23:19:59 | 92,339,391 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,029 | java | ////////////////////////////////////////////////////////////////////////////////
// The following FIT Protocol software provided may be used with FIT protocol
// devices only and remains the copyrighted property of Dynastream Innovations Inc.
// The software is being provided on an "as-is" basis and as an accommodation,
// and therefore all warranties, representations, or guarantees of any kind
// (whether express, implied or statutory) including, without limitation,
// warranties of merchantability, non-infringement, or fitness for a particular
// purpose, are specifically disclaimed.
//
// Copyright 2017 Dynastream Innovations Inc.
////////////////////////////////////////////////////////////////////////////////
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
// Profile Version = 20.33Release
// Tag = production/akw/20.33.01-0-gdd6ece0
////////////////////////////////////////////////////////////////////////////////
package com.garmin.fit;
import java.math.BigInteger;
public class BloodPressureMesg extends Mesg {
public static final int TimestampFieldNum = 253;
public static final int SystolicPressureFieldNum = 0;
public static final int DiastolicPressureFieldNum = 1;
public static final int MeanArterialPressureFieldNum = 2;
public static final int Map3SampleMeanFieldNum = 3;
public static final int MapMorningValuesFieldNum = 4;
public static final int MapEveningValuesFieldNum = 5;
public static final int HeartRateFieldNum = 6;
public static final int HeartRateTypeFieldNum = 7;
public static final int StatusFieldNum = 8;
public static final int UserProfileIndexFieldNum = 9;
protected static final Mesg bloodPressureMesg;
static {
// blood_pressure
bloodPressureMesg = new Mesg("blood_pressure", MesgNum.BLOOD_PRESSURE);
bloodPressureMesg.addField(new Field("timestamp", TimestampFieldNum, 134, 1, 0, "s", false, Profile.Type.DATE_TIME));
bloodPressureMesg.addField(new Field("systolic_pressure", SystolicPressureFieldNum, 132, 1, 0, "mmHg", false, Profile.Type.UINT16));
bloodPressureMesg.addField(new Field("diastolic_pressure", DiastolicPressureFieldNum, 132, 1, 0, "mmHg", false, Profile.Type.UINT16));
bloodPressureMesg.addField(new Field("mean_arterial_pressure", MeanArterialPressureFieldNum, 132, 1, 0, "mmHg", false, Profile.Type.UINT16));
bloodPressureMesg.addField(new Field("map_3_sample_mean", Map3SampleMeanFieldNum, 132, 1, 0, "mmHg", false, Profile.Type.UINT16));
bloodPressureMesg.addField(new Field("map_morning_values", MapMorningValuesFieldNum, 132, 1, 0, "mmHg", false, Profile.Type.UINT16));
bloodPressureMesg.addField(new Field("map_evening_values", MapEveningValuesFieldNum, 132, 1, 0, "mmHg", false, Profile.Type.UINT16));
bloodPressureMesg.addField(new Field("heart_rate", HeartRateFieldNum, 2, 1, 0, "bpm", false, Profile.Type.UINT8));
bloodPressureMesg.addField(new Field("heart_rate_type", HeartRateTypeFieldNum, 0, 1, 0, "", false, Profile.Type.HR_TYPE));
bloodPressureMesg.addField(new Field("status", StatusFieldNum, 0, 1, 0, "", false, Profile.Type.BP_STATUS));
bloodPressureMesg.addField(new Field("user_profile_index", UserProfileIndexFieldNum, 132, 1, 0, "", false, Profile.Type.MESSAGE_INDEX));
}
public BloodPressureMesg() {
super(Factory.createMesg(MesgNum.BLOOD_PRESSURE));
}
public BloodPressureMesg(final Mesg mesg) {
super(mesg);
}
/**
* Get timestamp field
* Units: s
*
* @return timestamp
*/
public DateTime getTimestamp() {
return timestampToDateTime(getFieldLongValue(253, 0, Fit.SUBFIELD_INDEX_MAIN_FIELD));
}
/**
* Set timestamp field
* Units: s
*
* @param timestamp
*/
public void setTimestamp(DateTime timestamp) {
setFieldValue(253, 0, timestamp.getTimestamp(), Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Get systolic_pressure field
* Units: mmHg
*
* @return systolic_pressure
*/
public Integer getSystolicPressure() {
return getFieldIntegerValue(0, 0, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Set systolic_pressure field
* Units: mmHg
*
* @param systolicPressure
*/
public void setSystolicPressure(Integer systolicPressure) {
setFieldValue(0, 0, systolicPressure, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Get diastolic_pressure field
* Units: mmHg
*
* @return diastolic_pressure
*/
public Integer getDiastolicPressure() {
return getFieldIntegerValue(1, 0, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Set diastolic_pressure field
* Units: mmHg
*
* @param diastolicPressure
*/
public void setDiastolicPressure(Integer diastolicPressure) {
setFieldValue(1, 0, diastolicPressure, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Get mean_arterial_pressure field
* Units: mmHg
*
* @return mean_arterial_pressure
*/
public Integer getMeanArterialPressure() {
return getFieldIntegerValue(2, 0, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Set mean_arterial_pressure field
* Units: mmHg
*
* @param meanArterialPressure
*/
public void setMeanArterialPressure(Integer meanArterialPressure) {
setFieldValue(2, 0, meanArterialPressure, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Get map_3_sample_mean field
* Units: mmHg
*
* @return map_3_sample_mean
*/
public Integer getMap3SampleMean() {
return getFieldIntegerValue(3, 0, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Set map_3_sample_mean field
* Units: mmHg
*
* @param map3SampleMean
*/
public void setMap3SampleMean(Integer map3SampleMean) {
setFieldValue(3, 0, map3SampleMean, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Get map_morning_values field
* Units: mmHg
*
* @return map_morning_values
*/
public Integer getMapMorningValues() {
return getFieldIntegerValue(4, 0, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Set map_morning_values field
* Units: mmHg
*
* @param mapMorningValues
*/
public void setMapMorningValues(Integer mapMorningValues) {
setFieldValue(4, 0, mapMorningValues, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Get map_evening_values field
* Units: mmHg
*
* @return map_evening_values
*/
public Integer getMapEveningValues() {
return getFieldIntegerValue(5, 0, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Set map_evening_values field
* Units: mmHg
*
* @param mapEveningValues
*/
public void setMapEveningValues(Integer mapEveningValues) {
setFieldValue(5, 0, mapEveningValues, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Get heart_rate field
* Units: bpm
*
* @return heart_rate
*/
public Short getHeartRate() {
return getFieldShortValue(6, 0, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Set heart_rate field
* Units: bpm
*
* @param heartRate
*/
public void setHeartRate(Short heartRate) {
setFieldValue(6, 0, heartRate, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Get heart_rate_type field
*
* @return heart_rate_type
*/
public HrType getHeartRateType() {
Short value = getFieldShortValue(7, 0, Fit.SUBFIELD_INDEX_MAIN_FIELD);
if (value == null)
return null;
return HrType.getByValue(value);
}
/**
* Set heart_rate_type field
*
* @param heartRateType
*/
public void setHeartRateType(HrType heartRateType) {
setFieldValue(7, 0, heartRateType.value, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Get status field
*
* @return status
*/
public BpStatus getStatus() {
Short value = getFieldShortValue(8, 0, Fit.SUBFIELD_INDEX_MAIN_FIELD);
if (value == null)
return null;
return BpStatus.getByValue(value);
}
/**
* Set status field
*
* @param status
*/
public void setStatus(BpStatus status) {
setFieldValue(8, 0, status.value, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Get user_profile_index field
* Comment: Associates this blood pressure message to a user. This corresponds to the index of the user profile message in the blood pressure file.
*
* @return user_profile_index
*/
public Integer getUserProfileIndex() {
return getFieldIntegerValue(9, 0, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
/**
* Set user_profile_index field
* Comment: Associates this blood pressure message to a user. This corresponds to the index of the user profile message in the blood pressure file.
*
* @param userProfileIndex
*/
public void setUserProfileIndex(Integer userProfileIndex) {
setFieldValue(9, 0, userProfileIndex, Fit.SUBFIELD_INDEX_MAIN_FIELD);
}
}
| [
"[email protected]"
] | |
5bb2cbbf5a13593b8a9411e632211a427ce77353 | 87f560c9a877c1aaf92fea02cc5316d78001d841 | /15.generics/FilledListMaker.java | 4396e34dc8fd6a3278fcbeff0d979a17452d6c2a | [] | no_license | enzuo411/ThinkingInJava | cf1e9f3f29309f51608416cbe2fbd4178bcd154a | 06fc478a19e0125dbc21ab8dd3a89217023ddf65 | refs/heads/main | 2023-02-15T16:35:59.752917 | 2021-01-04T02:37:28 | 2021-01-04T02:37:28 | 383,800,117 | 3 | 0 | null | 2021-07-07T13:01:12 | 2021-07-07T13:01:12 | null | UTF-8 | Java | false | false | 397 | java | import java.util.*;
public class FilledListMaker<T> {
List<T> create(T t, int n) {
List<T> result = new ArrayList<T>();
for(int i = 0; i < n; ++i) {
result.add(t);
}
return result;
}
public static void main(String[] args) {
FilledListMaker<String> stringMaker = new FilledListMaker<String>();
List<String> list = stringMaker.create("Hello", 5);
System.out.println(list);
}
}
| [
"[email protected]"
] | |
34cc3b3a0d42f52cd537dbccc58b4be7ddfbe0fa | a098739d091450f69de4a7dc8136895a7e8f1a9c | /wordcount/Final/src/AppTest.java | 6bd112ac8d348a972442ff5ad5089a73e504d05d | [] | no_license | Beethom/softwaredev | 49c555b92fa27182e663d4716a4723343afd1aa0 | 72c8819bd637bc9806fe940410d63f35028788ac | refs/heads/master | 2023-06-24T09:58:27.957315 | 2021-07-30T03:43:57 | 2021-07-30T03:43:57 | 368,013,506 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 895 | java | import org.junit.Test;
import org.junit.Test;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import static org.junit.Assert.*;
public class AppTest {
@Test
public void testGetConnection() {
System.out.print("Connection successfull");
}
@Test
public void testMain() throws FileNotFoundException {
App test = new App();
File text = new File("src//poem.txt");
Scanner textread = new Scanner(text);
String val = textread.next();
Map<String,Integer> map = new HashMap<String, Integer>();
if(map.containsValue(val) == false)
System.out.println("Your file was able to be read thank you!");
else
{
System.out.println("The file cannot be read please try again");
}
}
}
| [
"[email protected]"
] | |
6d205204e20c93dfc5f690309c96cc33ceb85706 | 361e1ae5745aa3d085aa85fb8f526201f13be01a | /src/main/java/com/indsys/iLabelBackEnd/productColor/ProductColorController.java | 574b0b52583441545763a28ca19532614ef90402 | [] | no_license | Kannan-India/JWT-Angular-Spring-boot-Back-End | 1ddfa6cffe0bdf4772b9d0bde0ec1e19519b3b22 | 2e982362b910e8ba09aec46c75b4a7a26d2772db | refs/heads/master | 2023-08-14T05:22:23.177708 | 2021-10-04T05:16:02 | 2021-10-04T05:16:02 | 405,920,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,032 | java | package com.indsys.iLabelBackEnd.productColor;
import com.indsys.iLabelBackEnd.authentication.model.AuthenticationRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("/api/product-color/")
@CrossOrigin(origins = "*")
public class ProductColorController {
@Autowired
ProductColorRepository productColorRepository;
@Autowired
private AuthenticationManager authenticationManager;
@PostMapping("add")
public boolean addProductColor(@RequestBody ProductColor productColor){
productColor.setCreatedDateTime(new Date());
productColorRepository.insert(productColor);
return true;
}
@GetMapping("list")
public List<ProductColor> getProductList(){
return productColorRepository.findAll();
}
}
| [
"[email protected]"
] | |
c09be7d97d4eb4e17c54e3bdefa926919c5b38ae | 5eb320c65e85d8e30e6f1236b58506093eb3f05d | /src/main/java/com/cinema/cinemaIngeneo/modelo/SillasFila.java | a3855b7a304ae99a82498e986f29342d45cd22ee | [] | no_license | JairoAndresBoadaAyala/CinemaIngeneo | 1de88ab54eb67cc09cfcc59e9d09cc0e01c73daa | 765aec1c10c1c00b2aa34b8ef8aa35f637fc1f3f | refs/heads/master | 2022-11-19T16:46:03.856119 | 2018-07-30T23:57:34 | 2018-07-30T23:57:34 | 278,892,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,318 | java | package com.cinema.cinemaIngeneo.modelo;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import com.cinema.cinemaIngeneo.modelo.Fila;
import com.cinema.cinemaIngeneo.modelo.SillasFila;
import com.cinema.cinemaIngeneo.modelo.Sucursal;
@SuppressWarnings("serial")
@Entity
@Table(name ="silla_fila")
public class SillasFila implements Serializable {
@Id
@Column(name = "id_")
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="id_sucursal", nullable=false)
private Sucursal sucursal;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="id_fila", nullable=false)
private Fila fila;
@Column(name="fila")
private String nombre;
@Column(name="total_sillas")
private int totalSillas;
@OneToMany(mappedBy = "sillafila")
private List<SillasFila> sillafila = new ArrayList<SillasFila>();
public SillasFila(int id, Sucursal sucursal, Fila fila, String nombre, int totalSillas,
List<SillasFila> sillafila) {
super();
this.id = id;
this.sucursal = sucursal;
this.fila = fila;
this.nombre = nombre;
this.totalSillas = totalSillas;
this.sillafila = sillafila;
}
public SillasFila(){}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Sucursal getSucursal() {
return sucursal;
}
public void setSucursal(Sucursal sucursal) {
this.sucursal = sucursal;
}
public Fila getFila() {
return fila;
}
public void setFila(Fila fila) {
this.fila = fila;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public int getTotalSillas() {
return totalSillas;
}
public void setTotalSillas(int totalSillas) {
this.totalSillas = totalSillas;
}
public List<SillasFila> getSillafila() {
return sillafila;
}
public void setSillafila(List<SillasFila> sillafila) {
this.sillafila = sillafila;
}
}
| [
"[email protected]"
] | |
fbe40f5256eef7f3a66ecfe6723bae7983b817cb | c0fe21b86f141256c85ab82c6ff3acc56b73d3db | /nativecontainer/src/main/java/com/jdcloud/sdk/service/nativecontainer/client/DeleteSecretExecutor.java | 8af07633f3d493069a69576c18e8ad777ebee28c | [
"Apache-2.0"
] | permissive | jdcloud-api/jdcloud-sdk-java | 3fec9cf552693520f07b43a1e445954de60e34a0 | bcebe28306c4ccc5b2b793e1a5848b0aac21b910 | refs/heads/master | 2023-07-25T07:03:36.682248 | 2023-07-25T06:54:39 | 2023-07-25T06:54:39 | 126,275,669 | 47 | 61 | Apache-2.0 | 2023-09-07T08:41:24 | 2018-03-22T03:41:41 | Java | UTF-8 | Java | false | false | 1,411 | java | /*
* Copyright 2018 JDCLOUD.COM
*
* 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.
*
* 镜像仓库认证信息
* 关于镜像仓库认证信息的相关接口
*
* OpenAPI spec version: v1
* Contact:
*
* NOTE: This class is auto generated by the jdcloud code generator program.
*/
package com.jdcloud.sdk.service.nativecontainer.client;
import com.jdcloud.sdk.client.JdcloudExecutor;
import com.jdcloud.sdk.service.JdcloudResponse;
import com.jdcloud.sdk.service.nativecontainer.model.DeleteSecretResponse;
/**
* 删除单个 secret
*/
class DeleteSecretExecutor extends JdcloudExecutor {
@Override
public String method() {
return "DELETE";
}
@Override
public String url() {
return "/regions/{regionId}/secrets/{name}";
}
@Override
public Class<? extends JdcloudResponse> returnType() {
return DeleteSecretResponse.class;
}
}
| [
"[email protected]"
] | |
36311780c487076acb79fd524f46a9de431c62da | 9946a35d0a47f6d99be0febfc6480a432f73b44b | /src/main/java/com/codeminders/tt/linecounter/ModelRenderer.java | cdd090abdd6c3b91298017e9ea3f748027776289 | [
"MIT"
] | permissive | sequoiahead/linecounter | a6b91a4bc9ca003ceb3baf4ac71e3aa8cc962e76 | 7380aec65a044eb997ba5195d4e4d5d7bc152691 | refs/heads/master | 2022-05-28T00:32:09.527192 | 2020-05-01T12:53:41 | 2020-05-01T13:19:38 | 260,458,877 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,528 | java | package com.codeminders.tt.linecounter;
import com.codeminders.tt.linecounter.model.Tree;
import java.util.Collections;
import java.util.Comparator;
import java.util.EnumSet;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
/**
* Renders model into a string
*/
public class ModelRenderer {
private final static Integer INDENTATION_SIZE = 2;
private final static char INDENTATION_CHAR = ' ';
private final Set<Option> options;
public ModelRenderer() {
this(
EnumSet.of(Option.SHOW_DIRECTORIES_FIRST, Option.HIDE_ZERO_COUNTS, Option.SHOW_EMPTY_ROOT));
}
public ModelRenderer(Set<Option> options) {
this.options = options;
}
public String renderModel(Tree tree) {
StringBuilder output = new StringBuilder();
//special case if root is empty
if (tree.getRoot().getData().getLinesCount() <= 0) {
if (options.contains(Option.SHOW_EMPTY_ROOT)) {
renderItem(tree.getRoot(), output);
}
} else {
renderLevel(tree.getRoot(), output);
}
return output.toString();
}
private void renderLevel(Tree node, StringBuilder output) {
if (node == null) {
return;
}
if (options.contains(Option.HIDE_ZERO_COUNTS) && node.getData().getLinesCount() <= 0) {
return;
}
renderItem(node, output);
if (options.contains(Option.SHOW_DIRECTORIES_FIRST)) {
Collections.sort(node.getLeafs(), new DirectoryFirstComparator());
}
for (Tree leaf : node.getLeafs()) {
renderLevel(leaf, output);
}
}
private void renderItem(Tree node, StringBuilder output) {
output.append(indentation(node)).append(renderCount(node));
}
private String renderCount(Tree node) {
return String.format("%s: %d%s", renderPath(node), node.getData().getLinesCount(),
System.lineSeparator());
}
private String renderPath(Tree node) {
return node.getData().getPath().getFileName().toString();
}
private String indentation(Tree node) {
return StringUtils.repeat(INDENTATION_CHAR,
node.getLevel() * INDENTATION_SIZE);
}
public enum Option {
SHOW_DIRECTORIES_FIRST, HIDE_ZERO_COUNTS, SHOW_EMPTY_ROOT
}
private static class DirectoryFirstComparator implements Comparator<Tree> {
@Override
public int compare(Tree o1, Tree o2) {
if (o1.getData().isDirectory() && o2.getData().isDirectory()) {
return 0;
}
if (o1.getData().isDirectory() && !o2.getData().isDirectory()) {
return -1;
}
return 1;
}
}
}
| [
"sequoiahead@sequoiabook.(none)"
] | sequoiahead@sequoiabook.(none) |
9175dce8323a13cf122b7e571b1bd4006fcdcb5f | 8694cb8d193ff082e7abd9125558ebfa274d9fa4 | /src/com/github/palmeidaprog/iccmercado/main/test/Professions/AnalistaProgramador.java | ca06b8040591293dd9d56be09fb87c6d974c2af2 | [
"MIT"
] | permissive | Makqsi/icc-mercado | 923f797977ed7f8602cae68d408051e647c72ab3 | e0fe5c4a1261e00d3294d705d840c6a534ef0d8e | refs/heads/master | 2020-06-13T18:16:08.260591 | 2016-12-03T02:50:02 | 2016-12-03T02:50:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,485 | java | package com.github.palmeidaprog.iccmercado.main.test.Professions;
import com.github.palmeidaprog.iccmercado.main.Interfaces.Linkable;
import com.github.palmeidaprog.iccmercado.main.Interfaces.Professionable;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
/*
* Mercado de TI
* Paulo R. Almeida Filho
* [email protected]
* */
public class AnalistaProgramador implements Professionable, Linkable {
// Links
private URL youtube;
private URL wikipedia;
private URL google;
// Requirements
private int hardware = 3;
private int lideranca = 3;
private int criatividade = 0;
private int ensino = 3;
private int relacionamento = 4;
private int pesquisa = 3;
private int matematica = 3;
private int logica = 4;
private int problemas = 4;
private int design = 0;
private int number = 8;
private int[] array = {hardware, lideranca, criatividade, ensino, relacionamento,
pesquisa, matematica, logica, problemas, design};
private int percentual = 0;
private final String AREA = "Programação / Desenvolvimento";
private final String PROFESSION = "Analista Programador";
//--Singleton pattern--------------------------------------------------
private static volatile AnalistaProgramador instance = null;
// constructor
private AnalistaProgramador() {
try {
// youtube = new URL("");
wikipedia = new URL("https://pt.wikipedia.org/wiki/Analista_programador");
google = new URL("https://www.google.com.br/webhp?sourceid=chrome-instant&ion=1&es" +
"pv=2&ie=UTF-8#q=Analista+Programador");
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
public synchronized static AnalistaProgramador getInstance() {
if(instance == null) {
instance = new AnalistaProgramador();
}
return instance;
}
//--Professionable methods----------------------------------------------------
@Override
public int[] getArray() {
array[0] = hardware;
array[1] = lideranca;
array[2] = criatividade;
array[3] = ensino;
array[4] = relacionamento;
array[5] = pesquisa;
array[6] = matematica;
array[7] = logica;
array[8] = problemas;
array[9] = design;
return array;
}
@Override
public int getNumber() {
return number;
}
@Override
public int getHardware() {
return hardware;
}
@Override
public int getLideranca() {
return lideranca;
}
@Override
public int getCriatividade() {
return criatividade;
}
@Override
public int getEnsino() {
return ensino;
}
@Override
public int getRelacionamento() {
return relacionamento;
}
@Override
public int getPesquisa() {
return pesquisa;
}
@Override
public int getMatematica() {
return matematica;
}
@Override
public int getLogica() {
return logica;
}
@Override
public int getProblemas() {
return problemas;
}
@Override
public int getDesign() {
return design;
}
@Override
public Scene getDetails() {
FXMLLoader loaderResult = new FXMLLoader(getClass().getResource("analista_programador.fxml"));
loaderResult.setController(AnalistaProgramadorController.getInstance());
Parent root = null;
try {
root = loaderResult.load();
} catch(IOException e) {
e.printStackTrace();
}
Scene sceneReturn = new Scene(root, 750, 600);
return sceneReturn;
}
@Override
public String getArea() {
return AREA;
}
@Override
public String getProfession() {
return PROFESSION;
}
@Override
public int getPercentual() {
return percentual;
}
@Override
public void setPercentual(int p) {
percentual = p;
}
//--Linkable methods----------------------------------------------------
@Override
public URL getYoutube() {
return youtube;
}
@Override
public URL getWiki() {
return wikipedia;
}
@Override
public URL getSearch() {
return google;
}
}
| [
"[email protected]"
] | |
4207c08e3c82f242e4734bfb220bd804474fdbf3 | a0edb164c57c15af8211f5a8198b2ef4a16e24be | /src/main/java/com/reactor/app/models/Usuario.java | b777010d27bc1e14af62e4fc718bba10724f87ab | [] | no_license | chris0100/reactor-webflux | 8b53cdecd98f4d24a68f533ba56e77538c245151 | 548552581db8ce97d45fe163dd95f19acf04235b | refs/heads/main | 2023-04-24T19:08:34.945024 | 2021-05-10T04:00:15 | 2021-05-10T04:00:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 733 | java | package com.reactor.app.models;
public class Usuario {
private String nombre;
private String apellido;
public Usuario(String nombre, String apellido) {
this.nombre = nombre;
this.apellido = apellido;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellido() {
return apellido;
}
public void setApellido(String apellido) {
this.apellido = apellido;
}
@Override
public String toString() {
return "Usuario{" +
"nombre='" + nombre + '\'' +
", apellido='" + apellido + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
0b10b7049d71af1b86ab9d831d0f59882191a321 | 828ca37c323f4801e8db159320d854878091b81d | /bibliotheque/bibli_webapp/model/src/main/java/org/webservice/services/CreateAuteurResponse.java | 9155778a25d998a4b769d5609df808af06cb15b9 | [] | no_license | vij59/projet7 | 9bc04c9348f6e3e372bbe970d903040bc7922496 | 0440f3d5fe322286bf14fe2a095e937283dcc50c | refs/heads/master | 2020-04-07T20:20:19.369104 | 2019-01-06T20:18:37 | 2019-01-06T20:18:37 | 158,683,948 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 742 | java | package org.webservice.services;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Classe Java pour createAuteurResponse complex type.
*
* <p>Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe.
*
* <pre>
* <complexType name="createAuteurResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "createAuteurResponse")
public class CreateAuteurResponse {
}
| [
"[email protected]"
] | |
412952234279a2f0d2bc27f0ebf8bd54f2003b71 | 4979dc1c73864a773d384ca9a73b5ce4ef2ac22f | /src/easy/TwoSum_1.java | 0e18bf446db160ee77ee4bce8e5982fc3ea69149 | [] | no_license | qianqianshihang/leetcodestudy | 963192b47bd214977ad1729807d00ab7221ec568 | d1f8c0a860d742f13cfecfb3436c0f923c80b11e | refs/heads/master | 2020-03-11T23:26:28.256007 | 2018-04-20T09:18:51 | 2018-04-20T09:18:51 | 130,321,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 864 | java | package easy;
/*
*
* Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
Example:
Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].
* */
public class TwoSum_1 {
public static void main(String[] args) {
twoSum(new int[]{2, 7, 11, 15}, 9);
}
public static int[] twoSum(int[] nums, int target) {
for (int i = 0; i < nums.length; i++) {
for (int j = i + 1; j < nums.length; j++) {
if ((nums[i] + nums[j]) == target) {
System.out.print("i=" + i + ",j=" + j);
return new int[]{i, j};
}
}
}
return new int[]{};
}
}
| [
"[email protected]"
] | |
276973b1d496e4b8aee9409665f22bdf726ffaee | ddf36fcf167ae93d1adc9c83d6159b9da1ea5150 | /begineer/program16.java | 7b421a3292befff4fbe5ce0d388ea866c95dfcb7 | [] | no_license | naveendivi/guvi | 89ab529770ede23aac95ccaa0e7e3dc996ae781e | 66ea40a64773d4c5c1e27aba87a8cb769410b4a2 | refs/heads/master | 2020-03-24T03:19:32.941570 | 2018-09-10T05:41:13 | 2018-09-10T05:41:13 | 142,414,458 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 514 | java | import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
int count=0;
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
for(int i=n;i<m;i++)
{
for(int j=2;j<i;j++)
{
if(i%j==0)
{
count=0;
break;
}
else
{
count=1;
}
}
if(count==1)
{
System.out.print(i);
}
}
}
}
| [
"[email protected]"
] | |
419f646fe3a1b04b88ac8323f32808ba53032cab | 85e8da21658c9dee05363c221aff77f55e83a0fe | /src/Server/Message/MessageUpdateAthleteTraining.java | b234a8966e801833c20c2fc341adcede4b27191a | [] | no_license | 28kobi/kobiariel | 82a04008e8811664dc8d68ac140ab77ea8b801df | 9f94c9744543fc65169ad408859eecc2af658ce9 | refs/heads/master | 2020-03-27T23:02:54.028851 | 2012-06-08T13:07:28 | 2012-06-08T13:07:28 | 32,249,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 540 | java | package Server.Message;
import Server.DataBase.*;
import Server.logic.*;
public class MessageUpdateAthleteTraining extends Message {
/**
*
*/
private static final long serialVersionUID = 1L;
private plannedpersonaltraining training;
/**
* constructor
*/
public MessageUpdateAthleteTraining(plannedpersonaltraining AthleteTraining) {
super(MessageType.MESSAGE_UPDATE_ATHLETE_TRAINING);
this.training=AthleteTraining;
}
public plannedpersonaltraining gettraining() {
return training;
}
}
| [
"[email protected]@c4d6539d-84c4-5c86-2c8a-468a23026b49"
] | [email protected]@c4d6539d-84c4-5c86-2c8a-468a23026b49 |
c32f417990e6f20e4fe69fe67df53b4d0bd85a6b | 07c0d066c5c6d1bd1c0e144b62bfcff18242f7b1 | /Ubber-Licenta/src/src/main/java/com/licenta/app/UbberLicenta/services/FidelityClientServiceImpl.java | 567feae170f552adc6867c678f9ab44294465449 | [] | no_license | MihneaIon/ServiciuDeplasare | 4c2ee458e74c3c9103f376a268f361814975952d | 085c9e1a7a7f881f3c22482af595f784180df425 | refs/heads/master | 2023-04-27T10:09:42.403251 | 2019-06-17T08:02:53 | 2019-06-17T08:02:53 | 179,101,402 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,579 | java | package com.licenta.app.UbberLicenta.services;
import com.licenta.app.UbberLicenta.model.Fidelity;
import com.licenta.app.UbberLicenta.repository.FidelityRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class FidelityClientServiceImpl implements FidelityClientService {
private FidelityRepository fidelityRepository;
@Autowired
public FidelityClientServiceImpl(FidelityRepository fidelityRepository){
this.fidelityRepository = fidelityRepository;
}
@Override
public Fidelity getFidelity(int id) {
return fidelityRepository.findById(id).get();
}
@Override
public List<Fidelity> getAllClients() {
return fidelityRepository.listOfAllFidelity();
}
@Override
public Fidelity upgradeClientFidelity(int id, Fidelity fidelity) {
Fidelity fidelity1Update = getFidelity(id);
fidelity1Update.setClientName(fidelity.getClientName());
fidelity1Update.setNumbersOfRoads(fidelity.getNumbersOfRoads());
return fidelityRepository.saveAndFlush(fidelity1Update);
}
@Override
public Fidelity addFidelityClient(Fidelity fidelity) {
return fidelityRepository.saveAndFlush(fidelity);
}
@Override
public int NumberOfRecords() {
return fidelityRepository.numberOfRecords();
}
// @Override
// public Fidelity getClientNameFidelity(String name) {
// return fidelityRepository.serchForFidelityClient(name);
// }
}
| [
"[email protected]"
] | |
152b0f13e8523e5c5fdacfe15041a6570abf3fc6 | fc49733b483e25105ed1a30c99641e4d4b8de065 | /gomall-member/src/main/java/cn/jinterest/member/vo/SocialUserVo.java | 65d081d03a0c49e12c6f4deec89a02b4f5d6d855 | [] | no_license | Jaredhi/GoMall | a1c8da9b0305992d94264828d05c430686f5d765 | 5f6ec50f799023c9390559681812b5d862a0c702 | refs/heads/master | 2023-04-16T08:50:33.796354 | 2021-04-30T05:22:52 | 2021-04-30T05:22:52 | 308,263,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 239 | java | package cn.jinterest.member.vo;
import lombok.Data;
@Data
public class SocialUserVo {
private String access_token;
private String remind_in;
private long expires_in;
private String uid;
private String isRealName;
}
| [
"[email protected]"
] | |
33e243241e915172d5050bed5ff50cd203baef0c | 0c2a73a784ee6d3d8c715d25b44c58b6a513655b | /src/main/java/com/sztx/wsy/common/domain/ResultCodeEnum.java | 42d7af31b58534b52beee5df24c7ab936301a004 | [] | no_license | SunGitShine/wsy-pro | 1d491c65df69e43e65c7c92eac98ed15ed9fa4e7 | 5d0e024feff1266e18a0cdae0ef9eb3a9168497b | refs/heads/master | 2021-01-22T10:02:58.932821 | 2018-06-26T03:19:55 | 2018-06-26T03:19:55 | 102,334,136 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 207 | java | package com.sztx.wsy.common.domain;
/**
* 结果码枚举
*
* @author puzhihong
*
*/
public interface ResultCodeEnum {
public String getCode();
public String getDescription();
}
| [
"[email protected]"
] | |
5094dc8b042b630e56841a5c5a856b6eb982d717 | 863acb02a064a0fc66811688a67ce3511f1b81af | /sources/p005cm/aptoide/p006pt/promotions/C4595w.java | 31dd3365021a3c51eb7537ed21b948b53fdce1ba | [
"MIT"
] | permissive | Game-Designing/Custom-Football-Game | 98d33eb0c04ca2c48620aa4a763b91bc9c1b7915 | 47283462b2066ad5c53b3c901182e7ae62a34fc8 | refs/heads/master | 2020-08-04T00:02:04.876780 | 2019-10-06T06:55:08 | 2019-10-06T06:55:08 | 211,914,568 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 562 | java | package p005cm.aptoide.p006pt.promotions;
import p026rx.p027b.C0129b;
/* renamed from: cm.aptoide.pt.promotions.w */
/* compiled from: lambda */
public final /* synthetic */ class C4595w implements C0129b {
/* renamed from: a */
private final /* synthetic */ ClaimPromotionDialogPresenter f8225a;
public /* synthetic */ C4595w(ClaimPromotionDialogPresenter claimPromotionDialogPresenter) {
this.f8225a = claimPromotionDialogPresenter;
}
public final void call(Object obj) {
this.f8225a.mo15553i((Throwable) obj);
}
}
| [
"[email protected]"
] | |
fdaa8324c1a52f577c4f8eee28e38f2b73b7ac9f | fa206cb8c840af9a40a2d1d5012bf20280de36cd | /src/api/truncate.java | 5849171aa1dd72536800b47dd4504e9cc608ff70 | [] | no_license | 2014COMP3111H-doesnmatter/DCalendar-Server | 4e462c9f1f5c111cdd0c1e7db2aa5e504234ef93 | 4b0ee9d5a8d24f843ebb3a4712c41da38e096484 | refs/heads/master | 2020-06-05T17:32:30.116331 | 2014-12-09T08:25:37 | 2014-12-09T08:25:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 688 | java | package api;
import java.util.Map;
import org.json.JSONObject;
import db.Appointment;
import db.Data;
import db.Reminder;
import db.Venue;
import doesnserver.Session;
public class truncate extends ApiHandler
{
public truncate()
{
this.info = "truncate Appointment, Reminder and Venue tables";
}
@Override
public JSONObject main(Map<String, String> params, Session session)
throws Exception {
JSONObject rtn = new JSONObject();
Data.truncate(Appointment.class.getSimpleName());
Data.truncate(Reminder.class.getSimpleName());
Data.truncate(Venue.class.getSimpleName());
rtn.put("rtnCode", this.getRtnCode(200));
return rtn;
}
}
| [
"[email protected]"
] | |
e9cf76e16235be5c2ceb84d5eb29c8a340c03588 | e5922c91f53ed1e0e377e3bc2258c268adba0647 | /app/src/main/java/assasingh/nearmev2/Fragments/FavouriteAlertFragment.java | 3f0fbec44e9ccef166ca83d32d507c07b1082b18 | [] | no_license | singha24/NearMe | f492467b95c58201e327986eda277d978a5d151f | d36d23b3313dc1229995ca11597c9b6da00f6bfe | refs/heads/master | 2020-03-07T06:21:31.392543 | 2017-03-22T22:36:18 | 2017-03-22T22:36:18 | 127,319,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,556 | java | package assasingh.nearmev2.Fragments;
import android.app.DialogFragment;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import com.google.android.gms.maps.model.LatLng;
import assasingh.nearmev2.Adaptors.FavActionDialogAdapter;
import assasingh.nearmev2.R;
import assasingh.nearmev2.Services.DatabaseHelper;
import assasingh.nearmev2.View.PostCard;
/**
* A simple {@link Fragment} subclass.
*/
public class FavouriteAlertFragment extends DialogFragment {
private static ListView lv;
private static Integer[] actionIcons = {R.drawable.postcard, R.drawable.share, R.drawable.visited, R.drawable.cross};
private static String[] menu = {"Create Postcard", "Share this place", "Mark Visited", "Remove from list"};
private static long placeID;
private String name;
private LatLng pos;
private int posInList;
private String photoRef;
public String rating;
public String favtable;
public String dayPlanTable;
public FavouriteAlertFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.dialog_list_view, container, false);
try {
placeID = getArguments().getLong("id");
name = getArguments().getString("name");
pos = getArguments().getParcelable("latlng");
posInList = getArguments().getInt("posInList");
photoRef = getArguments().getString("photoRef");
rating = getArguments().getString("rating");
favtable = getArguments().getString("favourite");
dayPlanTable = getArguments().getString("dayPlan");
} catch (NullPointerException e) {
Log.e("NullPointer", e.toString());
}
lv = (ListView) rootView.findViewById(R.id.dialogListView);
getDialog().setTitle("What would you like to do?");
final FavActionDialogAdapter adapter = new FavActionDialogAdapter(getActivity(), menu, actionIcons);
lv.setAdapter(adapter);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0:
Log.d("FAVALERT", name + rating + photoRef);
createPostCardIntent(name, rating, photoRef);
break;
case 1:
share(pos.latitude,pos.longitude, name); //will need to pass name of place and location from FavouritePlaces activity
break;
case 2:
int res = markVisited(name, 1);
if (res == 0) {
Snackbar.make(view, name + " has been marked as visited", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
break;
case 3:
boolean success = deleteFromTable(placeID, getTable());
if (success) {
Snackbar.make(view, name + " has been removed from this list", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
break;
}
}
});
return rootView;
}
public String getFavtable() {
return favtable;
}
public String getDayPlanTable() {
return dayPlanTable;
}
public String getTable() {
if (getDayPlanTable() == null) {
return getFavtable();
} else {
return getDayPlanTable();
}
}
public int markVisited(String name, int val) {
DatabaseHelper db = new DatabaseHelper(getActivity());
return db.updatePlaceVisited(name, val);
}
public boolean deleteFromTable(long id, String tableName) {
DatabaseHelper db = new DatabaseHelper(getActivity());
return db.removeFromTable(id, tableName);
}
public void createPostCardIntent(String name, String rating, String photoRef) {
Intent intent = new Intent(getActivity(), PostCard.class);
intent.putExtra("name", name);
intent.putExtra("rating", rating);
intent.putExtra("photoRef", photoRef);
startActivity(intent);
}
public void share(double latitude, double longitude, String name) {
String uri = "http://maps.google.com/maps?saddr=" +latitude+","+longitude;
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String ShareSub = "Recommendation";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, ShareSub);
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, uri + "\n\n" + "It's a cool place called " + name + ", thought you might want to check it out!");
startActivity(Intent.createChooser(sharingIntent, "Share via"));
}
}
| [
"[email protected]"
] | |
fdbe6887e521e3297503a934d7299b5e829d1d3f | e1c12b0ea06c11be6e36b65fd8449117424f6821 | /src/main/java/dev/dmhdevelopment/modernindustrialization/items/craft_block/Electrum/ElectrumPlate.java | 13cf7224ff548f96e945ba79f0396e8e71bb4932 | [] | no_license | DMHDevelopment/Modern-Industrialization | 53e847e2a93e25f913fbcf5e7a3172f8290363cb | f612d28c76163e2298cb94700db7bd1395cfb640 | refs/heads/forge-rewrite-1.15.x | 2023-01-04T19:52:32.850247 | 2020-11-06T07:05:11 | 2020-11-06T07:05:11 | 298,826,765 | 1 | 1 | null | 2020-09-30T18:27:41 | 2020-09-26T14:04:52 | null | UTF-8 | Java | false | false | 398 | java | package dev.dmhdevelopment.modernindustrialization.items.craft_block.Electrum;
import dev.dmhdevelopment.modernindustrialization.utils.ModernIndustrializationCreativeTab;
import net.minecraft.item.Item;
public class ElectrumPlate extends Item{
public ElectrumPlate() {
super(new Item.Properties().group(ModernIndustrializationCreativeTab.ModernIndustrializationCreativeTab));
}
}
| [
"[email protected]"
] | |
8ce564ffa8d461e83ae342ae475c46a1ff7afddb | eaacb459e948f656a3bf0663fae95100a1eb8df2 | /appiumtests/src/test/java/appiumtests/StravaTest.java | 071b7bcfffb8a66a5f3dd6b65a9d153f5f07cc2c | [] | no_license | carolinelavergne/POC_APPIUM | de2c3653c72129a6cd12b5d1270e494c5d7b1c0e | e65ade77f156302802a439053b313688443f02f9 | refs/heads/main | 2023-04-04T15:05:57.288417 | 2021-04-03T18:57:15 | 2021-04-03T18:57:15 | 344,178,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,228 | java | package appiumtests;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
public class StravaTest {
static AppiumDriver<MobileElement> driver;
public static void main(String[] args) {
try {
openStrava();
} catch (Exception e) {
System.out.println(e.getCause());
System.out.println(e.getMessage());
e.printStackTrace();
}
}
public static void openStrava() throws MalformedURLException {
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("deviceName", "caro");
cap.setCapability("udid", "4efb89e5");
cap.setCapability("platformName", "Android");
cap.setCapability("platformVersion", "10 QKQ1.190910.002");
cap.setCapability("appPackage", "com.strava");
cap.setCapability("appActivity", "com.strava.SplashActivity");
cap.setCapability("skipServerInstallation", true);
URL url = new URL("http://127.0.0.1:4723/wd/hub");
driver = new AppiumDriver<MobileElement>(url, cap);
driver.quit();
System.out.println("fin");
}
}
| [
"[email protected]"
] | |
b8a739d83d74f34a2077db52757db77a7312d282 | 73f4c27f044740ae34c74038a98f1b1c21a1b400 | /src/main/java/com/spring/boot/dto/UserResponseDto.java | acc11b0c9edb74ae818eb5dc295d71ef667fb478 | [] | no_license | jah701/spring-boot | ed49b6183b0000db47ba8a58841a822f2bb805d6 | 6169d36c402c5834f2046ef1de2e34e85f3cf5d2 | refs/heads/main | 2023-01-24T11:14:19.631706 | 2020-12-07T08:34:23 | 2020-12-07T08:34:23 | 310,885,609 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 136 | java | package com.spring.boot.dto;
import lombok.Data;
@Data
public class UserResponseDto {
private Long id;
private String name;
}
| [
"[email protected]"
] | |
f80e4ef34ebeb6b3eae64a51f2a3f163c1fee9cc | f6a04cf3a08229af7aa1f739e63ce6ea5ff5f226 | /src/main/java/parser/Scenario.java | 3500da6b3c4bfd158a168f8139ff617260f3050c | [] | no_license | YahorKavaliou/HTML-report-parser | 2ab06e1ea9909fa602d5ab24fcaa202ab60bceab | 59cf51ea4628c10882a29108dacabc3a207c1665 | refs/heads/master | 2021-01-17T18:01:46.151901 | 2016-10-14T16:26:26 | 2016-10-14T16:26:26 | 70,898,339 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,185 | java | package parser;
public class Scenario {
private String status;
private String given;
private String then1;
private String error1;
private String then2;
private String error2;
private String url;
public String getError2() {
return error2;
}
public void setError2(String error2) {
this.error2 = error2;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getGiven() {
return given;
}
public void setGiven(String given) {
this.given = given;
}
public String getThen1() {
return then1;
}
public void setThen1(String then1) {
this.then1 = then1;
}
public String getThen2() {
return then2;
}
public void setThen2(String then2) {
this.then2 = then2;
}
public String getError1() {
return error1;
}
public void setError1(String error1) {
this.error1 = error1;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
| [
"[email protected]"
] | |
84ee1e3245f8015c70836a377c54435efe15093c | 2993f76eb60906b569f07bb925dfe1aa0727b251 | /app/src/main/java/com/example/responsi/Model/Location.java | c1d895dd3eda2e1f248f3949317fea941a201d89 | [] | no_license | Parlimerna/Responsi-Android-MVP | 9659294036e670c247484f0693567947f3635ddf | be1023676f1d2b3e8105a55cb6cbf12d9466d064 | refs/heads/master | 2020-06-18T23:07:46.226053 | 2019-07-13T02:11:47 | 2019-07-13T02:11:47 | 196,486,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,490 | java | package com.example.responsi.Model;
import com.google.gson.annotations.SerializedName;
public class Location{
@SerializedName("city")
private String city;
@SerializedName("street")
private String street;
@SerializedName("timezone")
private Timezone timezone;
@SerializedName("postcode")
private int postcode;
@SerializedName("coordinates")
private Coordinates coordinates;
@SerializedName("state")
private String state;
public void setCity(String city){
this.city = city;
}
public String getCity(){
return city;
}
public void setStreet(String street){
this.street = street;
}
public String getStreet(){
return street;
}
public void setTimezone(Timezone timezone){
this.timezone = timezone;
}
public Timezone getTimezone(){
return timezone;
}
public void setPostcode(int postcode){
this.postcode = postcode;
}
public int getPostcode(){
return postcode;
}
public void setCoordinates(Coordinates coordinates){
this.coordinates = coordinates;
}
public Coordinates getCoordinates(){
return coordinates;
}
public void setState(String state){
this.state = state;
}
public String getState(){
return state;
}
@Override
public String toString(){
return
"Location{" +
"city = '" + city + '\'' +
",street = '" + street + '\'' +
",timezone = '" + timezone + '\'' +
",postcode = '" + postcode + '\'' +
",coordinates = '" + coordinates + '\'' +
",state = '" + state + '\'' +
"}";
}
} | [
"[email protected]"
] | |
5ad9136e4abdd848b1132e43794c36304b62825c | a867f3e18a587a1c98cd6bc2bf0b51c94cdc3555 | /Unita5/Esercizio52.java | 5a0abf181cb20b8d1254821b4bf69d757004ba65 | [] | no_license | apheniti/fondamenti-informatica | 4d07efbbe493d8a39b656ed68c33bfdfb9862942 | 1b15a067104c24e83daccd7c4f15b19743215e08 | refs/heads/master | 2021-01-04T03:12:52.603767 | 2020-02-25T12:35:31 | 2020-02-25T12:35:31 | 240,352,280 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,168 | java | /*Scrivere un programma che legge da input le tre lunghezze de tre lati di un triangolo
e ne determina il tipo utilizzando il seguente algoritmo:
- confrontare i lati a coppia contando quante coppie sono uguali
- if (le coppie uguali sono 0) è scaleno
- else if (le coppie uguali sono 1) è isoscele
- else è equilatero */
import javax.swing.JOptionPane;
public class Esercizio52{
public static void main(String[] args) {
String testo = "Inserisci il valore del lato";
double a = Double.parseDouble(JOptionPane.showInputDialog(testo +" a"));
double b = Double.parseDouble(JOptionPane.showInputDialog(testo +" b"));
double c = Double.parseDouble(JOptionPane.showInputDialog(testo +" c"));
System.out.println(confronta(a,b,c));
}
public static String confronta(double a, double b, double c){
int count=0;
String risultato = "";
if(a==b) count++;
if(a==c) count++;
if(b==c) count++;
switch(count){
case 0: risultato = risultato +"scaleno"; break;
case 1: risultato = risultato+"isoscele"; break;
default: risultato = risultato+"equilatero"; break;
}
return risultato;
}
} | [
"[email protected]"
] | |
ecb315f774b69814229a3cac3ad40e351f6cd51a | 93e2fef2e6a770889089c979ae4f4098ace070c7 | /src/main/java/com/ascending/training/model/Role.java | 6397cd20d1d5741f7555c4e7424d3b6c9f1a6cd2 | [] | no_license | gege0121/clothes-Tracking | a87513b2236c80e0df116dccac4cd28b7b4127f4 | 45f40fa4b64913c7241d55ac2fad4f4354c4a66b | refs/heads/master | 2022-10-03T13:39:18.133819 | 2020-10-15T03:41:37 | 2020-10-15T03:41:37 | 217,125,828 | 0 | 0 | null | 2022-02-16T01:01:37 | 2019-10-23T18:25:34 | Java | UTF-8 | Java | false | false | 2,330 | java | package com.ascending.training.model;
import javax.persistence.*;
import java.util.List;
@Entity
@Table(name = "roles")
public class Role {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private long id;
@Column(name = "name")
private String name;
@Column(name = "allowed_resource")
private String allowedResource;
@Column(name = "allowed_read")
private boolean allowedRead;
@Column(name = "allowed_create")
private boolean allowedCreate;
@Column(name = "allowed_update")
private boolean allowedUpdate;
@Column(name = "allowed_delete")
private boolean allowedDelete;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAllowedResource() {
return allowedResource;
}
public void setAllowedResource(String allowedResource) {
this.allowedResource = allowedResource;
}
public boolean isAllowedRead() {
return allowedRead;
}
public void setAllowedRead(boolean allowedRead) {
this.allowedRead = allowedRead;
}
public boolean isAllowedCreate() {
return allowedCreate;
}
public void setAllowedCreate(boolean allowedCreate) {
this.allowedCreate = allowedCreate;
}
public boolean isAllowedUpdate() {
return allowedUpdate;
}
public void setAllowedUpdate(boolean allowedUpdate) {
this.allowedUpdate = allowedUpdate;
}
public boolean isAllowedDelete() {
return allowedDelete;
}
@Override
public String toString() {
return "Role{" +
"id=" + id +
", name='" + name + '\'' +
", allowedResource='" + allowedResource + '\'' +
", allowedRead=" + allowedRead +
", allowedCreate=" + allowedCreate +
", allowedUpdate=" + allowedUpdate +
", allowedDelete=" + allowedDelete +
'}';
}
public void setAllowedDelete(boolean allowedDelete) {
this.allowedDelete = allowedDelete;
}
@ManyToMany(mappedBy = "roles")
private List<Customer> customers;
} | [
"[email protected]"
] | |
ed6dad7d7e95b00c2f8f3740f7ab6e45547959db | c90dc69af46cecbf889c418df5edd1cca8d00d62 | /app/src/main/java/com/example/algys/allevents/fragment/MyFragment.java | 7faa609d4ed037e95db30d17b05ce45b8bf03272 | [] | no_license | HoWoooD/AllEventsApplication | eb00ffe9085b34b3b8002173635c5784f22cf3ac | 4879a1c4b38bb2fc62df302deddee0feb519f862 | refs/heads/master | 2020-03-15T09:01:10.689112 | 2018-05-31T06:29:30 | 2018-05-31T06:29:30 | 132,064,997 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,094 | java | package com.example.algys.allevents.fragment;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.algys.allevents.R;
public class MyFragment extends AbstractTabFragment {
private static final int LAYOUT = R.layout.fragment_my;
public static MyFragment getInstance(Context context){
Bundle args = new Bundle();
MyFragment fragment = new MyFragment();
fragment.setArguments(args);
fragment.setContext(context);
fragment.setTitle(context.getString(R.string.tab_item_my));
return fragment;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(LAYOUT, container,false);
return view;
}
public void setContext(Context context) {
this.context = context;
}
}
| [
"[email protected]"
] | |
b9aa4d1cbe7a388828265ff8241f5ba7aa5e14d1 | 51abc156b16e349e405cc137d29e0dbf721b6bc4 | /mobile_v2/PrevoyanceDeces/app/src/main/java/bj/assurance/prevoyancedeces/viewHolder/MesMarchandsViewHolder.java | a5849bbe76431009e4ff2a4b4360c1f6024a8abb | [] | no_license | marieloujo/prevoyance_deces | e64b379f32250320234ed466612743a0fef25789 | ab9eba1f3b8de3f4621a77d42d7994fa7c86e9a2 | refs/heads/master | 2023-03-05T16:07:48.218956 | 2022-07-13T04:17:40 | 2022-07-13T04:17:40 | 223,215,433 | 0 | 0 | null | 2023-03-02T08:15:57 | 2019-11-21T16:20:27 | Java | UTF-8 | Java | false | false | 1,124 | java | package bj.assurance.prevoyancedeces.viewHolder;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import bj.assurance.prevoyancedeces.R;
public class MesMarchandsViewHolder extends RecyclerView.ViewHolder {
TextView nomprenom, matricule, nbContrat;
public MesMarchandsViewHolder(@NonNull View itemView) {
super(itemView);
nomprenom = itemView.findViewById(R.id.nom_prenom_super);
matricule = itemView.findViewById(R.id.matricule);
nbContrat = itemView.findViewById(R.id.nd_clients);
}
public TextView getNomprenom() {
return nomprenom;
}
public void setNomprenom(TextView nomprenom) {
this.nomprenom = nomprenom;
}
public TextView getMatricule() {
return matricule;
}
public void setMatricule(TextView matricule) {
this.matricule = matricule;
}
public TextView getNbContrat() {
return nbContrat;
}
public void setNbContrat(TextView nbContrat) {
this.nbContrat = nbContrat;
}
}
| [
"[email protected]"
] | |
51c73ccbbae1d34db8cf771370ca5b93e33f0cbd | 555d6b6b63dc7a1dac12ed5629307796f1bcf537 | /net/minecraft/pathfinding/PathNavigateSwimmer.java | 61f9a26a0e4915c1e040aae4614fd62167115b33 | [] | no_license | CrxsCode/Minecraft-Hack-Client-1.8 | 179d992cc41d8564b4ed6aaccdd99e1710f7cccf | ea2901180d51806c432d7acd85ecf430f9a6167c | refs/heads/master | 2020-03-19T10:12:05.310557 | 2018-06-06T16:01:24 | 2018-06-06T16:01:24 | 136,345,526 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,137 | java | package net.minecraft.pathfinding;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.pathfinder.SwimNodeProcessor;
public class PathNavigateSwimmer extends PathNavigate {
public PathNavigateSwimmer(EntityLiving entitylivingIn, World worldIn) {
super(entitylivingIn, worldIn);
}
protected PathFinder getPathFinder() {
return new PathFinder(new SwimNodeProcessor());
}
protected boolean canNavigate() {
return this.isInLiquid();
}
protected Vec3 getEntityPosition() {
return new Vec3(this.theEntity.posX, this.theEntity.posY + (double)this.theEntity.height * 0.5D, this.theEntity.posZ);
}
protected void pathFollow() {
Vec3 vec3 = this.getEntityPosition();
float f = this.theEntity.width * this.theEntity.width;
int i = 6;
if(vec3.squareDistanceTo(this.currentPath.getVectorFromIndex(this.theEntity, this.currentPath.getCurrentPathIndex())) < (double)f) {
this.currentPath.incrementPathIndex();
}
for(int j = Math.min(this.currentPath.getCurrentPathIndex() + i, this.currentPath.getCurrentPathLength() - 1); j > this.currentPath.getCurrentPathIndex(); --j) {
Vec3 vec31 = this.currentPath.getVectorFromIndex(this.theEntity, j);
if(vec31.squareDistanceTo(vec3) <= 36.0D && this.isDirectPathBetweenPoints(vec3, vec31, 0, 0, 0)) {
this.currentPath.setCurrentPathIndex(j);
break;
}
}
this.checkForStuck(vec3);
}
protected void removeSunnyPath() {
super.removeSunnyPath();
}
protected boolean isDirectPathBetweenPoints(Vec3 posVec31, Vec3 posVec32, int sizeX, int sizeY, int sizeZ) {
MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(posVec31, new Vec3(posVec32.xCoord, posVec32.yCoord + (double)this.theEntity.height * 0.5D, posVec32.zCoord), false, true, false);
return movingobjectposition == null || movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.MISS;
}
}
| [
"[email protected]"
] | |
7ad8db8cc39d0a1a2b5d4bbe6eb76018e6f41b86 | 6e498099b6858eae14bf3959255be9ea1856f862 | /test/com/facebook/buck/rules/coercer/JsonTypeConcatenatingCoercerFactoryTest.java | e4f3ee6f525ea2c2c613af9f48ac16bc4799ec4c | [
"Apache-2.0"
] | permissive | Bonnie1312/buck | 2dcfb0791637db675b495b3d27e75998a7a77797 | 3cf76f426b1d2ab11b9b3d43fd574818e525c3da | refs/heads/master | 2020-06-11T13:29:48.660073 | 2019-06-26T19:59:32 | 2019-06-26T21:06:24 | 193,979,660 | 2 | 0 | Apache-2.0 | 2019-09-22T07:23:56 | 2019-06-26T21:24:33 | Java | UTF-8 | Java | false | false | 2,023 | java | /*
* Copyright 2018-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.facebook.buck.rules.coercer;
import static org.junit.Assert.assertTrue;
import java.util.List;
import java.util.Map;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
public class JsonTypeConcatenatingCoercerFactoryTest {
@Rule public ExpectedException thrown = ExpectedException.none();
@Test
public void testCreateReturnsCorrectCoercerForInt() {
assertTrue(
JsonTypeConcatenatingCoercerFactory.createForType(Integer.class)
instanceof IntConcatenatingCoercer);
}
@Test
public void testCreateReturnsCorrectCoercerForString() {
assertTrue(
JsonTypeConcatenatingCoercerFactory.createForType(String.class)
instanceof StringConcatenatingCoercer);
}
@Test
public void testCreateReturnsCorrectCoercerForMap() {
assertTrue(
JsonTypeConcatenatingCoercerFactory.createForType(Map.class)
instanceof MapConcatenatingCoercer);
}
@Test
public void testCreateReturnsCorrectCoercerForList() {
assertTrue(
JsonTypeConcatenatingCoercerFactory.createForType(List.class)
instanceof ListConcatenatingCoercer);
}
@Test
public void testCreateReturnsSingleElementCoercerForUnsupportedType() {
assertTrue(
JsonTypeConcatenatingCoercerFactory.createForType(Boolean.class)
instanceof SingleElementJsonTypeConcatenatingCoercer);
}
}
| [
"[email protected]"
] | |
2c91fe086eab5870b5cc149a2d4def674b808b5d | f84cd0eaa39a14234bdcef901e3f707e92a10860 | /src/main/java/com/jaenyeong/programmers/book/ch02_string/Solution10.java | 0f53b827acf155b56ff5423e515cc70607f2ca2f | [] | no_license | jaenyeong/Study_Coding-test | 52660ee8eac54c32d62cc4208fecbf7f855c5747 | 4142cac2191b40be89e57afad6dead5f94028b3b | refs/heads/main | 2023-08-30T20:55:29.836579 | 2023-08-29T03:30:05 | 2023-08-29T03:30:05 | 294,624,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 782 | java | package com.jaenyeong.programmers.book.ch02_string;
import java.util.Arrays;
// [Lv2] 이진 변환 반복하기
// https://school.programmers.co.kr/learn/courses/30/lessons/70129
public class Solution10 {
public int[] solution(String s) {
int loop = 0;
int removed = 0;
while (!s.equals("1")) {
int zerosQty = countZero(s);
loop++;
removed += zerosQty;
int ones = s.length() - zerosQty;
s = Integer.toString(ones, 2);
}
return new int[] {loop, removed};
}
private int countZero(String s) {
int zeros = 0;
for (char c : s.toCharArray()) {
if (c == '0') {
zeros++;
}
}
return zeros;
}
}
| [
"[email protected]"
] | |
f0dc924f4662d0f788f09e93cc62e6df69aee485 | fac5d6126ab147e3197448d283f9a675733f3c34 | /src/main/java/dji/component/areacode/DJIAreaCodeEvent.java | a7cf6aa2bb05570bab7882b19c0b3e31b4c392bd | [] | no_license | KnzHz/fpv_live | 412e1dc8ab511b1a5889c8714352e3a373cdae2f | 7902f1a4834d581ee6afd0d17d87dc90424d3097 | refs/heads/master | 2022-12-18T18:15:39.101486 | 2020-09-24T19:42:03 | 2020-09-24T19:42:03 | 294,176,898 | 0 | 0 | null | 2020-09-09T17:03:58 | 2020-09-09T17:03:57 | null | UTF-8 | Java | false | false | 417 | java | package dji.component.areacode;
public class DJIAreaCodeEvent {
public String areaCode;
public AreaCodeStrategy strategy;
public DJIAreaCodeEvent(String ac, AreaCodeStrategy strategy2) {
this.areaCode = ac;
this.strategy = strategy2;
}
public String toString() {
return "DJIAreaCodeEvent{areaCode='" + this.areaCode + '\'' + ", strategy=" + this.strategy + '}';
}
}
| [
"[email protected]"
] | |
b75e6761b8d27793dcabc43e1127ac20719832aa | 07ec6b72a5ff9a7c8c42f6f1213a75cb6ef2719a | /HDOJ/ACM-Steps/Chapter-Two/Section-Three/2.3.5.java | a5c59dbbd639db868c5b1c19335bd7c4c7001ea1 | [] | no_license | cheuk-fung/Programming-Challenges | fbfbf833b19ff1063b0fca4b5d14d1e907264aa1 | 7c055fd2891b7edc865e7da8886d057a93fb41fe | refs/heads/master | 2020-12-24T17:36:21.407367 | 2020-04-26T19:44:42 | 2020-04-27T17:13:09 | 1,443,793 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,868 | java | /*
* SRC: HDOJ ACM Steps
* PROB: Count the Trees
* ALGO: Catalan number
* DATE: Oct 31, 2011
* COMP: jdk 6
*
* Created by Leewings Ac
*/
import java.io.*;
import java.util.*;
import java.math.*;
class Main {
public static void main(String args[]) throws IOException
{
new Prob().solve();
}
}
class Prob {
void solve() throws IOException
{
MyReader in = new MyReader();
PrintWriter out = new PrintWriter(System.out);
BigInteger c[] = new BigInteger[101];
c[0] = BigInteger.ONE;
for (int i = 1; i <= 100; i++)
c[i] = c[i - 1].multiply(BigInteger.valueOf(2 * (2 * i - 1))).divide(BigInteger.valueOf((i + 1)));
BigInteger f[] = new BigInteger[101];
f[0] = BigInteger.ONE;
for (int i = 1; i <= 100; i++)
f[i] = f[i - 1].multiply(BigInteger.valueOf(i));
for (int i = 0; i <= 100; i++)
c[i] = c[i].multiply(f[i]);
while (in.hasNext()) {
int n = in.nextInt();
if (n == 0) break;
out.println(c[n]);
}
out.flush();
}
void debug(Object...x)
{
System.out.println(Arrays.deepToString(x));
}
}
class MyReader {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer in;
boolean hasNext() throws IOException
{
if (in == null || in.hasMoreTokens()) return true;
String line = br.readLine();
if (line == null) return false;
in = new StringTokenizer(line);
return true;
}
String next() throws IOException
{
while (in == null || !in.hasMoreTokens())
in = new StringTokenizer(br.readLine());
return in.nextToken();
}
int nextInt() throws IOException
{
return Integer.parseInt(next());
}
}
| [
"[email protected]"
] | |
d8c6ba390a530c0f77a03f396feb571ab467aaba | c074c20b796ceedd6b5b231e85a76b81f7ff150a | /src/main/java/SpringBoot/Policy_Module_Pro_Max/controllers/RemedyController.java | 540b2ff4777f9e55f89fd91abc85d6bbef6fe17d | [] | no_license | the-stranded-alien/Policy_Module_SpringBoot_05 | a81b05b71c778321c4ad51a1e8433add4b0257cf | 37a2cdc8bf2b560ecc312e411acaf9b8d69ed8b0 | refs/heads/master | 2023-05-06T22:52:41.847741 | 2021-05-31T17:17:04 | 2021-05-31T17:17:04 | 372,548,031 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,315 | java | package SpringBoot.Policy_Module_Pro_Max.controllers;
import SpringBoot.Policy_Module_Pro_Max.models.Remedy;
import SpringBoot.Policy_Module_Pro_Max.models.Activity;
import SpringBoot.Policy_Module_Pro_Max.services.RemedyService;
import SpringBoot.Policy_Module_Pro_Max.services.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.ArrayList;
import java.util.List;
@Controller
@RequestMapping("/remedy")
public class RemedyController {
@Autowired
private RemedyService remedyService;
@Autowired
private ActivityService activityService;
@GetMapping("/{id}")
public String showRemedyForActivity(@PathVariable(name = "id") Long id, Model model) {
Activity activity = activityService.findActivityById(id);
Remedy remedy = remedyService.getRemedyByActivity(activity);
List<Remedy> remedyList = new ArrayList<>();
remedyList.add(remedy);
model.addAttribute("listRemedyDetail", remedyList);
return "remedy/homeRemedy";
}
}
| [
"[email protected]"
] | |
44cc141d79dccae1d302d01bab98ac3f605298ed | 76852b1b29410436817bafa34c6dedaedd0786cd | /sources-2020-11-04-tempmail/sources/com/google/android/play/core/internal/z.java | 65cea1b55777d6ae5abc21ad65beaf69f1f5d155 | [] | no_license | zteeed/tempmail-apks | 040e64e07beadd8f5e48cd7bea8b47233e99611c | 19f8da1993c2f783b8847234afb52d94b9d1aa4c | refs/heads/master | 2023-01-09T06:43:40.830942 | 2020-11-04T18:55:05 | 2020-11-04T18:55:05 | 310,075,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package com.google.android.play.core.internal;
public final class z<T> implements b0<T> {
/* renamed from: a reason: collision with root package name */
private b0<T> f11507a;
public static <T> void a(b0<T> b0Var, b0<T> b0Var2) {
n.b(b0Var2);
z zVar = (z) b0Var;
if (zVar.f11507a == null) {
zVar.f11507a = b0Var2;
return;
}
throw new IllegalStateException();
}
public final T d() {
b0<T> b0Var = this.f11507a;
if (b0Var != null) {
return b0Var.d();
}
throw new IllegalStateException();
}
}
| [
"[email protected]"
] | |
5ea52750060bddaed60980514a75bdc53988a56b | 36a9840685a08606dc90a338efba142aa1e74022 | /app/src/main/java/com/wwsl/mdsj/activity/main/MainMessageViewHolder.java | f068ecafb87081fb5813758ebc84f220276cb4fe | [] | no_license | SnailMyth/mdsj | 02513d95d4620a7d7ae3e390c7fd6e3ae0a8a9e3 | 84f786d10433ad26c2fffba33327c2c3777923f1 | refs/heads/master | 2023-01-13T02:03:45.771519 | 2020-11-16T16:01:50 | 2020-11-16T16:01:50 | 313,351,462 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,783 | java | package com.wwsl.mdsj.activity.main;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.scwang.smart.refresh.footer.ClassicsFooter;
import com.scwang.smart.refresh.header.MaterialHeader;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import com.scwang.smart.refresh.layout.api.RefreshLayout;
import com.wwsl.mdsj.AppConfig;
import com.wwsl.mdsj.Constants;
import com.wwsl.mdsj.R;
import com.wwsl.mdsj.activity.UserHomePageActivity;
import com.wwsl.mdsj.activity.message.ChatActivity;
import com.wwsl.mdsj.activity.message.MessageSecondActivity;
import com.wwsl.mdsj.activity.message.SysMessageActivity;
import com.wwsl.mdsj.adapter.MsgShortAdapter;
import com.wwsl.mdsj.bean.AdvertiseBean;
import com.wwsl.mdsj.bean.MsgShortBean;
import com.wwsl.mdsj.bean.net.MsgConservationNetBean;
import com.wwsl.mdsj.bean.net.RecommendUserBean;
import com.wwsl.mdsj.http.HttpCallback;
import com.wwsl.mdsj.http.HttpUtil;
import com.wwsl.mdsj.im.ImMessageUtil;
import com.wwsl.mdsj.interfaces.CommonCallback;
import com.wwsl.mdsj.utils.ClickUtil;
import com.wwsl.mdsj.utils.ZjUtils;
import com.wwsl.mdsj.views.AbsMainViewHolder;
import com.yanzhenjie.recyclerview.SwipeRecyclerView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.wwsl.mdsj.adapter.MsgShortAdapter.PAYLOAD_FOLLOW;
public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnClickListener {
private SwipeRecyclerView msgRecycler;
private SmartRefreshLayout mRefreshLayout;
private MsgShortAdapter msgShortAdapter;
private List<MsgShortBean> beans;
private List<MsgShortBean> recommendUser;
private int recommendUserNum = 0;//用于刷新推荐用户
private int mPage = 1;
private int needRefreshData = 0;
//消息数量
private TextView badge1, badge2, badge3, badge4;
public MainMessageViewHolder(Context context, ViewGroup parentView, AppCompatActivity activity) {
super(context, parentView, activity);
}
@Override
public void onClick(View view) {
if (!ClickUtil.canClick()) return;
switch (view.getId()) {
case R.id.btnLike:
forwardSecond(Constants.TYPE_LIKE);
break;
case R.id.btnDouding:
forwardSecond(Constants.TYPE_COMMENT);
break;
case R.id.btnGift:
forwardSecond(Constants.TYPE_AT_ME);
break;
case R.id.btnVipCenter:
forwardSecond(Constants.TYPE_FANS);
break;
}
}
@Override
protected int getLayoutId() {
return R.layout.activity_main_message;
}
@Override
public void init() {
findView();
beans = new ArrayList<>();
recommendUser = new ArrayList<>();
msgShortAdapter = new MsgShortAdapter(beans);
msgRecycler.setLayoutManager(new LinearLayoutManager(mContext, RecyclerView.VERTICAL, false));
msgShortAdapter.setOnItemChildClickListener((adapter, view, position) -> {
switch (view.getId()) {
case R.id.imgRemove:
msgShortAdapter.removeAt(position);
recommendUserNum--;
break;
case R.id.btnFollow:
MsgShortBean msgShortBean = msgShortAdapter.getData().get(position);
HttpUtil.setAttention(Constants.FOLLOW_FROM_MAIN_MSG, msgShortBean.getUid(), new CommonCallback<Integer>() {
@Override
public void callback(Integer bean) {
if (bean == 1) {
msgShortAdapter.getData().get(position).setFollow(true);
msgShortAdapter.notifyItemChanged(position, PAYLOAD_FOLLOW);
}
}
});
break;
}
});
msgShortAdapter.setOnItemClickListener((adapter, view, position) -> {
MsgShortBean msgShortBean = msgShortAdapter.getData().get(position);
if (msgShortBean.getType() == Constants.MESSAGE_TYPE_MSG) {
if (msgShortBean.getSubType() >= 1 && msgShortBean.getSubType() <= 4) {
SysMessageActivity.forward(mContext, msgShortBean.getSubType());
if (!msgShortBean.getUnreadNum().equals("0")) {
HttpUtil.readSystemMessageList(msgShortBean.getSubType());
msgShortAdapter.notifyItemChanged(position, MsgShortAdapter.PAYLOAD_UNREAD_CLEAR);
}
} else if (msgShortBean.getSubType() == Constants.MESSAGE_SUBTYPE_FRIEND) {
ChatActivity.forward(mContext);
}
} else if (msgShortBean.getType() == Constants.MESSAGE_TYPE_TEXT_RECOMMEND) {
UserHomePageActivity.forward(mContext, msgShortBean.getUid());
} else if (msgShortBean.getType() == Constants.MESSAGE_TYPE_AD) {
if (!ClickUtil.canClick()) return;
ZjUtils.getInstance().showAd();
}
});
msgRecycler.setAdapter(msgShortAdapter);
}
private void findView() {
ImageView btnLike = (ImageView) findViewById(R.id.btnLike);
ImageView btnComment = (ImageView) findViewById(R.id.btnDouding);
ImageView btnAtMe = (ImageView) findViewById(R.id.btnGift);
ImageView btnFans = (ImageView) findViewById(R.id.btnVipCenter);
msgRecycler = (SwipeRecyclerView) findViewById(R.id.msgRecycler);
mRefreshLayout = (SmartRefreshLayout) findViewById(R.id.refreshLayout);
mRefreshLayout.setRefreshHeader(new MaterialHeader(mContext));
mRefreshLayout.setRefreshFooter(new ClassicsFooter(mContext));
mRefreshLayout.setOnRefreshListener(this::refreshData);
// mRefreshLayout.setOnLoadMoreListener(this::loadMoreData);
btnLike.setOnClickListener(this);
btnComment.setOnClickListener(this);
btnAtMe.setOnClickListener(this);
btnFans.setOnClickListener(this);
badge1 = (TextView) findViewById(R.id.tv_num1);
badge2 = (TextView) findViewById(R.id.tv_num2);
badge3 = (TextView) findViewById(R.id.tv_num3);
badge4 = (TextView) findViewById(R.id.tv_num4);
}
private void loadMoreData(RefreshLayout refreshLayout) {
mPage++;
loadRecommendUser(false);
}
private void refreshData(RefreshLayout refreshLayout) {
mPage = 1;
if (isFirstLoadData()) {
initData();
} else {
loadData();
}
}
/**
* 我的粉丝
*/
private void forwardSecond(int type) {
MessageSecondActivity.forward(mContext, type, AppConfig.getInstance().getUid());
}
@Override
public void onResume() {
super.onResume();
if (needRefreshData == 0) {
needRefreshData = 10;
mRefreshLayout.autoRefresh();
} else {
needRefreshData--;
}
//消息刷新
getMsgCount();
}
/**
* 获取消息数量
*/
private void getMsgCount() {
HttpUtil.getMsgCount(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code != 0) return;
try {
JSONArray array = new JSONArray(Arrays.toString(info));
for (int i = 0; i < array.length(); i++) {
JSONObject object = new JSONObject(array.optString(i));
//类型 0=点赞 1=评论 2=@我 3=粉我
int num = object.optInt("num");
switch (object.optInt("type")) {
case 0:
if (num > 0) {
badge1.setVisibility(View.VISIBLE);
badge1.setText(String.valueOf(num));
} else {
badge1.setVisibility(View.GONE);
}
break;
case 1:
if (num > 0) {
badge2.setVisibility(View.VISIBLE);
badge2.setText(String.valueOf(num));
} else {
badge2.setVisibility(View.GONE);
}
break;
case 2:
if (num > 0) {
badge3.setVisibility(View.VISIBLE);
badge3.setText(String.valueOf(num));
} else {
badge3.setVisibility(View.GONE);
}
break;
case 3:
if (num > 0) {
badge4.setVisibility(View.VISIBLE);
badge4.setText(String.valueOf(num));
} else {
badge4.setVisibility(View.GONE);
}
break;
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
public void initData() {
beans.clear();
HttpUtil.getSystemMsgConservationList(1, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
//加载系统消息
List<MsgConservationNetBean> list = JSON.parseArray(Arrays.toString(info), MsgConservationNetBean.class);
msgShortAdapter.addData(MsgConservationNetBean.parse(list));
//我的好友item
msgShortAdapter.addData(MsgShortBean.builder().type(Constants.MESSAGE_TYPE_MSG).subType(Constants.MESSAGE_SUBTYPE_FRIEND).unreadNum(ImMessageUtil.getInstance().getAllUnReadMsgCount()).build());
//广告item
List<AdvertiseBean> adInnerList = AppConfig.getInstance().getConfig().getAdInnerList();
if (null != adInnerList && adInnerList.size() > 0) {
MsgShortBean adBean = new MsgShortBean();
adBean.setType(Constants.MESSAGE_TYPE_AD);
adBean.setAdThumb(adInnerList.get(0).getThumb());
adBean.setAdUrl(adInnerList.get(0).getUrl());
msgShortAdapter.addData(adBean);
}
if (msgShortAdapter.getData().size() > 0) {
//获取推荐用户
loadRecommendUser(true);
} else {
mRefreshLayout.finishRefresh();
}
}
}
@Override
public void onError() {
mRefreshLayout.finishRefresh();
}
});
}
@Override
public void loadData() {
//更新系统消息列表
HttpUtil.getSystemMsgConservationList(1, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
List<MsgConservationNetBean> list = JSON.parseArray(Arrays.toString(info), MsgConservationNetBean.class);
for (int i = 0; i < list.size(); i++) {
boolean update = false;
for (int j = 0; j < beans.size(); j++) {
if (beans.get(j).getType() == Constants.MESSAGE_TYPE_MSG && beans.get(j).getSubType() == list.get(i).getType()) {
beans.get(j).setContent(list.get(i).getContent());
beans.get(j).setTime(list.get(i).getTime());
beans.get(j).setUnreadNum(String.valueOf(list.get(i).getUnreadNum()));
msgShortAdapter.notifyItemChanged(j, MsgShortAdapter.PAYLOAD_UNREAD_UPDATE);
update = true;
break;
}
}
if (!update) {
//新的系统通知默认加到第一个
msgShortAdapter.addData(1, MsgConservationNetBean.parse(list.get(i)));
}
}
//加载5次 刷新一次推荐列表
if (recommendUserNum == 0) {
loadRecommendUser(true);
} else {
if (msgShortAdapter.getData().size() > 0) {
msgRecycler.scrollToPosition(0);
}
mRefreshLayout.finishRefresh();
}
}
@Override
public void onError() {
mRefreshLayout.finishRefresh();
}
});
}
private void loadRecommendUser(boolean isFresh) {
HttpUtil.getRecommendUser(mPage, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
List<RecommendUserBean> list = JSON.parseArray(Arrays.toString(info), RecommendUserBean.class);
if (isFresh) {
//刷新列表
int lastIndex = msgShortAdapter.getData().size() - 1;
//去除之前加载的推荐用户
for (int i = 0; i < recommendUserNum; i++) {
msgShortAdapter.removeAt((lastIndex - i));
}
recommendUserNum = list.size();
if (list.size() > 0) {
//添加推荐关注标签
int size = msgShortAdapter.getData().size();
if (msgShortAdapter.getData().get(size - 1).getType() != Constants.MESSAGE_TYPE_TEXT_LABEL) {
msgShortAdapter.addData(MsgShortBean.builder().type(Constants.MESSAGE_TYPE_TEXT_LABEL).subType(0).build());
}
}
mRefreshLayout.finishRefresh();
} else {
recommendUserNum += list.size();
mRefreshLayout.finishLoadMore();
}
List<MsgShortBean> recUser = new ArrayList<>();
for (RecommendUserBean user : list) {
recUser.add(MsgShortBean.builder()
.type(Constants.MESSAGE_TYPE_TEXT_RECOMMEND)
.uid(user.getUid())
.age(user.getAge())
.originDes(user.getOriginDes())
.avatar(user.getAvatar())
.sex(user.getSex())
.name(user.getName())
.city(user.getCity())
.build());
}
recommendUser.addAll(recUser);
msgShortAdapter.addData(recUser);
}
@Override
public void onError() {
if (isFresh) {
mRefreshLayout.finishRefresh();
} else {
mRefreshLayout.finishLoadMore();
}
}
});
}
public void updateUnreadNum(String num) {
int index = -1;
List<MsgShortBean> data = msgShortAdapter.getData();
for (int i = 0; i < data.size(); i++) {
if (data.get(i).getType() == Constants.MESSAGE_TYPE_MSG && data.get(i).getSubType() == Constants.MESSAGE_SUBTYPE_FRIEND) {
index = i;
break;
}
}
if (index >= 0) {
msgShortAdapter.getData().get(index).setUnreadNum(num);
msgShortAdapter.notifyItemChanged(index, MsgShortAdapter.PAYLOAD_UNREAD_UPDATE);
}
}
}
| [
"[email protected]"
] | |
f76dab7c488f2d75ce2b024981589bdc40d0b9c5 | e6ddfe5532ab03adaed9fdc90e38a2a086ce486b | /src/test/Mytest.java | 34f1612ec8de62644b3cce1772c45d619768075e | [] | no_license | iamdeity/MybatisTest | f1309c479460ad5054ac8a6fc2d4b7aba41e23c1 | c60b694cddbab4d8bb186d7355d3b48cecf55d01 | refs/heads/master | 2020-04-26T02:42:16.588765 | 2019-03-01T10:01:19 | 2019-03-01T10:01:19 | 173,242,596 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,045 | java | package test;
import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIConversion;
import mapper.MemberMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;
import pojo.Member;
import java.io.InputStream;
import java.util.List;
/**
* Created by wyj on 2019/3/1.
*/
public class Mytest {
public static List<Member> findll() throws Exception {
String resource= "SqlMapConfig.xml";
InputStream input = Resources.getResourceAsStream(resource);
SqlSessionFactory factory=new SqlSessionFactoryBuilder().build(input);
SqlSession sqlSession = factory.openSession();
MemberMapper mapper = sqlSession.getMapper(MemberMapper.class);
List<Member> list = mapper.findall();
//List<Member> list = sqlSession.selectList("mapper.MemberMapper.finall");
//System.out.println(list);
return list;
}
}
| [
"[email protected]"
] | |
2ba88b66a2e2c21dd667e0c0539db36af952a171 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/19/19_40c742265778f3cb04f903fa62e12050f9d2a7b2/CustomBlockRenderer/19_40c742265778f3cb04f903fa62e12050f9d2a7b2_CustomBlockRenderer_t.java | bea296b2889cfa12eae2ea700d400dcab12ab864 | [] | 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 | 421 | java | package org.xhtmlrenderer.render;
import org.xhtmlrenderer.layout.Context;
import org.xhtmlrenderer.util.U;
public class CustomBlockRenderer extends BoxRenderer {
/**
* override this to paint your component
*
* @param c PARAM
* @param box PARAM
*/
public void paintComponent(Context c, Box box) {
U.p("Custom components must override paintComponent");
}
}
| [
"[email protected]"
] | |
11da71f3af01b152b21f32477cb1a3597bf35192 | 63681b76f02c44c939cd7d16f138d80ae8ce1887 | /src/com/nevergetme/designmode/observer/NumberGenerator.java | e0a98ab4e47cbd316f35a7390562650f3ebcf087 | [
"Apache-2.0"
] | permissive | hTangle/AlgorithmPractice | c336e68541f21f1737d3b8fdba134bbfcc73a77d | 64ce6de1041c855719d9ba153f57245ef726e35b | refs/heads/master | 2020-04-02T09:18:08.175072 | 2019-09-20T14:03:06 | 2019-09-20T14:03:06 | 154,286,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 640 | java | package com.nevergetme.designmode.observer;
import java.util.ArrayList;
import java.util.Iterator;
public abstract class NumberGenerator {
private ArrayList observers=new ArrayList();
public void addObserver(Observer observer){
observers.add(observer);
}
public void deleteObserver(Observer observer){
observers.remove(observer);
}
public void notifyObservers(){
Iterator it=observers.iterator();
while (it.hasNext()){
Observer o=(Observer)it.next();
o.update(this);
}
}
public abstract int getNumber();
public abstract void execute();
}
| [
"[email protected]"
] | |
11c6fa40595466dce7b78232ded1c909eb47e65d | 21aaead2b6930ee6ebe837d6c7da2aa888eae2bb | /src/main/java/com/taobao/pamirs/transaction/SqlCheckMonitor.java | 87356c5729e587fc750468493d09da7ac2abc120 | [] | no_license | mandarenmanman/taobao-pamirs-transaction | 337fe2ed7c4a79bd77415c29a995b5e49c28999e | cab09ae1d78f57e5543d95e098bf23f7a0be2a50 | refs/heads/master | 2021-04-03T06:09:20.423309 | 2014-12-12T03:46:54 | 2014-12-12T03:46:54 | 124,854,300 | 7 | 4 | null | null | null | null | GB18030 | Java | false | false | 5,480 | java | package com.taobao.pamirs.transaction;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.concurrent.ConcurrentHashMap;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
/**
* 在开发环境,自动记录所有的SQL,注意剔重
*
* @author xuannan
*
*/
public class SqlCheckMonitor implements InitializingBean{
private static transient Log log = LogFactory.getLog(SqlCheckMonitor.class);
public static String RUNMODE_WRITE ="开发";
public static String RUNMODE_CHECK ="日常";
public static String RUNMODE_PRODUCT ="生产";
private DataSource dataSource;
/**
* 产品线名称,例如:汇金
*/
private String productName;
/**
* 项目或者日常名称。例如:道易,统一帐户,数据魔方
*/
private String projectName;
/**
* 运行环境:开发,日常
*/
private String runMode;
/*
* 记录每个SQL是否被审核通过
*/
ConcurrentHashMap<String, Boolean> sqlMap = new ConcurrentHashMap<String, Boolean>();
/**
* 在系统初始化的时候,装载系统的所有SQL
* @throws Throwable
*/
public void afterPropertiesSet() throws Exception{
Method method = SqlCheckMonitor.class.getDeclaredMethod("loadData",
new Class[] {});
TBMethodInvocation invocation = new TBMethodInvocation(method,
this, null);
try {
TransactionManager.executeMethod(invocation, TBTransactionType.INDEPEND);
} catch (Throwable e) {
throw new Exception(e);
}
}
public void monitorBefore(String sqlText,String type,String parent){
//
}
public void monitorAfter(String sqlText,String type, long runTime,
long finishTime, Object[] parameter,Object returnValue,Throwable error, int executeNum,String parent){
if(RUNMODE_WRITE.equals(this.runMode)){
writeRuningSql(sqlText);
}else if(RUNMODE_CHECK.equals(this.runMode)){
checkSql(sqlText);
}else if(RUNMODE_PRODUCT.equals(this.runMode)){
//生产模式
}else{
throw new RuntimeException("请设置SQL的运行环境:\"开发\" 或者 \"日常\" 或者 \"生产\" ");
}
}
public void checkSql(String sqlText){
Boolean isCheckOk = this.sqlMap.get(sqlText);
if(isCheckOk == null || isCheckOk.booleanValue() == false){
throw new RuntimeException("SQL没有通过审核,不能在测试环境运行,请联系 玄风: SQL= " + sqlText);
}
}
public void writeRuningSql(String sqlText){
try {
//此处可能存在并发重入的问题,但不影响系统目标的达成
if (sqlMap.containsKey(sqlText) == false) {
Method method = SqlCheckMonitor.class.getDeclaredMethod("save2DB",
new Class[] {String.class,String.class});
TBMethodInvocation invocation = new TBMethodInvocation(method,
this, new Object[]{this.projectName, sqlText});
TransactionManager.executeMethod(invocation, TBTransactionType.INDEPEND);
sqlMap.put(sqlText, false);
}
} catch (Throwable e) {
log.error(e.getMessage(),e);
}
}
/**
* 从数据库中装载数据
* @throws SQLException
*/
public void loadData() throws SQLException{
Connection conn = null;
try {
conn = dataSource.getConnection();
String sql = "select ID,PRODUCT_NAME,PROJECT_NAME,SQL_TEXT,CHECK_OK from PAMIRS_SQL_CHECK "
+ " WHERE PRODUCT_NAME = ? ";
PreparedStatement statement = conn.prepareStatement(sql);
statement.setString(1, productName);
ResultSet rs = statement.executeQuery();
while(rs.next()){
sqlMap.put(rs.getString("SQL_TEXT"),rs.getInt("CHECK_OK") == 1);
}
rs.close();
statement.close();
} catch (Throwable e) {
log.error("装载数据错误,"+ e.getMessage(),e);
} finally {
if (conn != null) {
conn.close();
}
}
}
/**
* 持久化到数据库中
*
* @param sql
* @throws SQLException
*/
public void save2DB(String projectName, String sqlText) throws SQLException {
Connection conn = null;
try {
conn = dataSource.getConnection();
String sysdateStr = TransactionManager.getDataBaseSysdateString(conn);
String sql = "insert into PAMIRS_SQL_CHECK("
+ "ID,PRODUCT_NAME,PROJECT_NAME,SQL_TEXT,CHECK_OK,GMT_CREATE,GMT_MODIFIED)"
+ "VALUES(?,?,?,?,0," + sysdateStr + "," + sysdateStr + ")";
if(sql.equals(sqlText)){
return;
}
PreparedStatement statement = conn.prepareStatement(sql);
statement.setLong(1, Math.abs(sqlText.hashCode()));
statement.setString(2, productName);
statement.setString(3, projectName);
statement.setString(4, sqlText);
statement.execute();
statement.close();
conn.commit();
} catch (Throwable e) {
//可能别的服务器已经提交了相同的SQL语句
conn.rollback();
} finally {
if (conn != null) {
conn.close();
}
}
}
public void setDataSource(DataSource aDataSource) {
dataSource = aDataSource;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public void setRunMode(String runMode) {
this.runMode = runMode;
}
}
| [
"[email protected]"
] | |
7a94b455dedf50d6bc0a02adc28793faaf19b693 | 21410751c32f62de847fcd756efccf6c29c5e2e5 | /src/main/java/paralleltesting/ParallelTest2.java | 948a68129cb9f9e771e6af63fdc3f37cdc7f8c3f | [] | no_license | TuanThanhNguyen2020/javamaven | 12e90cf1ccf28531a6e3a9aff36f5cf17efe819f | 035c29cad1cf3865a7f866eb4028129099d5186d | refs/heads/master | 2022-11-10T05:23:58.023061 | 2020-06-23T04:39:57 | 2020-06-23T04:39:57 | 274,076,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 904 | java | package paralleltesting;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
public class ParallelTest2 {
WebDriver driver;
@Test
void loginTest() throws InterruptedException {
System.setProperty("webdriver.gecko.driver","C:\\geckodriver.exe");
driver = new FirefoxDriver();
driver.get("https://opensource-demo.orangehrmlive.com/");
driver.findElement(By.id("txtUsername")).sendKeys("Admin");
driver.findElement(By.id("txtPassword")).sendKeys("admin123");
driver.findElement(By.id("btnLogin")).click();
Assert.assertEquals(driver.getTitle(),"OrangeHRM");
Thread.sleep(3000);
}
@AfterClass
void tearDown(){
driver.close();
}
}
| [
"[email protected]"
] | |
301cdaafe589f0f44b8f426dbee38fa68d3da3e3 | 5f6962973a4e8ddc3510973f6365e70901b043e4 | /teamtest/src/study/notice/action/ContentAction.java | 58812ad03cfff76885cc62d1d4198914cdad6fb8 | [] | no_license | 53team/53team | fc1e6f84269cb1a0c54471e6129d2e51a842aaeb | 96d33dda4d52adb7e4410c8010e4849b3cde3c76 | refs/heads/master | 2021-01-12T20:26:06.392510 | 2016-10-07T04:30:21 | 2016-10-07T04:30:21 | 68,663,605 | 1 | 2 | null | 2016-09-20T02:36:11 | 2016-09-20T01:57:25 | Java | UTF-8 | Java | false | false | 1,393 | java | package study.notice.action;
import java.text.SimpleDateFormat;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import study.controller.CommandAction;
import study.notice.bean.NoticeDAO;
import study.notice.bean.NoticeVO;
public class ContentAction implements CommandAction{
@Override
public String process(HttpServletRequest request, HttpServletResponse response) throws Exception {
request.setCharacterEncoding("utf-8");
NoticeDAO dao = NoticeDAO.getInstance();
try {
int num = Integer.parseInt(request.getParameter("num"));
String pageNum = request.getParameter("pageNum");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
NoticeVO vo = dao.getDataDetail(num);
HttpSession session = request.getSession();
String sid = (String)session.getAttribute("sid");
request.setAttribute("sid", sid);
request.setAttribute("num", vo.getNum());
request.setAttribute("writer", vo.getWriter());
request.setAttribute("subject", vo.getSubject());
request.setAttribute("readnum", vo.getReadnum());
request.setAttribute("content", vo.getContent());
request.setAttribute("pageNum", pageNum);
request.setAttribute("reg_date", sdf.format(vo.getReg_date()));
} catch(Exception e) {
e.printStackTrace();
}
return "/jsp/notice/content.jsp";
}
}
| [
"[email protected]"
] | |
2a39fb81558a814bc2288e9ea1f400fb267ba451 | dfc422724ff8c1ca4a673b9e9c6ea16053ff6536 | /src/Mora5RoundAttack.java | ee7481e0c36573490361369b180dbbd086133480 | [] | no_license | RandallTem/Mora-Attack | 1239255c31348168c5b68d174a305116240898fa | 47bff6d080a8d59b7f6adbb72e2f399a08859103 | refs/heads/master | 2023-09-04T01:15:25.901295 | 2021-10-30T18:01:48 | 2021-10-30T18:01:48 | 418,635,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,510 | java | import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.atomic.AtomicLong;
public class Mora5RoundAttack {
/** Блокирующая очередь для передачи пар H, H' из оффлайн потока в онлайн потоки */
private BlockingQueue<List<long[]>> pairsForOnline = new ArrayBlockingQueue(100);
/** Счетчик проверенных пар */
private AtomicLong checkedPairs = new AtomicLong(0);
/** Переменная хранит истинное значение М для рассчета dR для разных пар H, H' */
private long realM;
/** Переменная используется для передачи найденного истинного значения М в метод attack главного потока для отображения*/
private AtomicLong res = new AtomicLong(0);
/** Переменная нужна для остановки онлайн потоков после нахождения истинного М */
private boolean foundM = false;
/**
* Класс потока Оффлайн этапа. Поток перебирает комбинации dHW1 и dK3 и находит для них пары H, H'.
* Затем складывает эти пары в очередь, откуда их для проверки берет поток Онлайн этапа.
*/
public class Offline extends Thread {
Mora m;
public Offline (String name) {
super(name);
m = new Mora();
}
/**
* Метод ищет решения для уравнения S(ΔHY2 ^ HY2) ^ S(HY2) = ΔHZ2.
* Все возможные решения ищутся индивидуально для каждого из 16 полубайт и возвращаются
* в виде двумерного списка.
*/
private ArrayList<ArrayList<Integer>> findXParts(long dHY2, long dHZ2) {
int dx, dy;
ArrayList<ArrayList<Integer>> x_parts = new ArrayList<>();
for (int i = 15; i >= 0; i--) {
x_parts.add(new ArrayList<>());
dx = (int) ((dHY2 >> (i * 4)) & 0xFL);
dy = (int) ((dHZ2 >> (i * 4)) & 0xFL);
for (int j = 1; j < 16; j++) {
if ((m.pi[j] ^ m.pi[j ^ dx]) == dy) {
x_parts.get(15 - i).add(j);
}
}
if (x_parts.get(15 - i).size() == 0)
return null;
}
return x_parts;
}
/**
* Метод принимает на вход созданный методом findXParts() двумерный список и
* составляет из его элементов все возможные комбинации, формируя таким образом
* массив решений уравнения S(ΔHY2 ^ HY2) ^ S(HY2) = ΔHZ2.
*/
private long[] buildSolutionsFromXParts(ArrayList<ArrayList<Integer>> xes) {
int size = 1;
for (ArrayList<Integer> arl : xes) {
size *= arl.size();
}
long[] res = new long[size+2];
int[] counters = new int[16];
for (int i = 0; i < size; i++) {
for (int j = 0; j < 16; j++) {
res[i] = (res[i] << 4) + ((xes.get(j).get(counters[j])) & 0xFL);
}
for (int j = 15; j >= 0; j--) {
if (counters[j] < xes.get(j).size() - 1) {
counters[j]++;
break;
} else {
counters[j] = 0;
}
}
}
return res;
}
/**
* Метод увеличивает на 1 полученное значение value, но только в активных полубайтвх с номерами hbytes_nums,
* игнорируя неактивные полубайты.
*/
private long nextStep(long value, int... hbytes_nums) {
int index = hbytes_nums.length - 1;
while (index >= 0 && ((value >>> ((15 - hbytes_nums[index]) * 4)) & 0xFL) == 15) {
value ^= 14L << ((15 - hbytes_nums[index]) * 4);
index--;
}
if (index != -1)
value += 1L << ((15 - hbytes_nums[index]) * 4);
return value;
}
/**
* Метод проверяет соответствие разности полученных ключей K, K' желаемому паттерну. То есть проверяет, что
* в разности Ki и Ki' все полубайты, не входящие в pattern, равны 0.
*/
private boolean checkPattern(long K, long K_, Integer... pattern) {
long dK = K ^ K_;
ArrayList<Integer> ar_pattenr = new ArrayList<>(Arrays.asList(pattern));
for (int i = 0; i < 16; i++) {
if (!ar_pattenr.contains(i)) {
if ((dK >> ((15 - i) * 4) & 0xFL) != 0) {
return false;
}
}
}
return true;
}
/**
* Метод вычисляет все значения ключей из найденного HY2 и проверяет, совпадают ли их разности с ожидаемым
* паттерном. Если совпадают, то пара добавляется в очередь для проверки потоком Онлайн этапа.
* Иначе, пара отбрасывается. Чтобы уменьшить количество проверяемых Онлайн потоком пар, некоторые пары
* случайным образом проопускаются благодаря тому, что инкремент равен не 1, а случайному значению
* от 1 до 4000.
*/
private void searchPairs(long[] solutions) {
for (int i = 0; i < solutions.length-2; i += (int)(Math.random()*4000)) {
long[] K = new long[7], K_ = new long[7];
K[2] = solutions[i] ^ m.consts[1];
K[1] = m.SReverse(m.P(m.LReverse(K[2]))) ^ m.consts[0];
K[0] = m.SReverse(m.P(m.LReverse(K[1])));
K[3] = m.L(m.P(m.S(solutions[i])));
K[4] = m.L(m.P(m.S(K[3] ^ m.consts[2])));
K[5] = m.L(m.P(m.S(K[4] ^ m.consts[3])));
K[6] = m.L(m.P(m.S(K[5] ^ m.consts[4])));
K_[3] = K[3] ^ solutions[solutions.length - 1];
K_[2] = m.SReverse(m.P(m.LReverse(K_[3]))) ^ m.consts[1];
K_[1] = m.SReverse(m.P(m.LReverse(K_[2]))) ^ m.consts[0];
K_[0] = m.SReverse(m.P(m.LReverse(K_[1])));
K_[4] = m.L(m.P(m.S(K_[3] ^ m.consts[2])));
K_[5] = m.L(m.P(m.S(K_[4] ^ m.consts[3])));
K_[6] = m.L(m.P(m.S(K_[5] ^ m.consts[4])));
if (checkPattern(K[1], K_[1], 0, 1, 2, 3) &&
checkPattern(K[2], K_[2], 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) &&
checkPattern(K[3], K_[3], 0,1, 4,5, 8,9, 12,13) &&
checkPattern(K[4], K_[4], 0, 1, 2, 3, 4, 5, 6, 7)) {
try {
pairsForOnline.put(Arrays.asList(K, K_));
} catch (Exception e) {
System.out.println("Exception " + e);
}
}
}
}
/**
* Метод перебирает все возможные комбинации DHW1 и DK3. Вычисляет из них
* DHY2 и DHZ2 и ищет для них решения уравнения S(ΔHY2 ^ HY2) ^ S(HY2) = ΔHZ2. Если решения найдены, то
* они передаются методу searchPairs() для поиска пар H, H'.
*/
public void run() {
long dHW1 = 0x1000100010001000L, dHY2;
long dK3 = 0x1000100010001000L, dHZ2;
ArrayList<ArrayList<Integer>> x_parts = new ArrayList<>();
for (long z = 0; z < Math.pow(15,8); z++) {
dHY2 = m.L(dHW1);
dHZ2 = m.P(m.LReverse(dK3));
x_parts = findXParts(dHY2, dHZ2);
if (x_parts != null) {
long time = System.currentTimeMillis();
long[] solutions = buildSolutionsFromXParts(x_parts);
solutions[solutions.length-2] = dHW1;
solutions[solutions.length-1] = dK3;
searchPairs(solutions);
}
dK3 = nextStep(dK3, 0, 4, 8, 12);
if (dK3 == 0x1000100010001000L) {
dHW1 = nextStep(dHW1, 0, 4, 8, 12);
}
}
}
}
/**
* Класс потока Онлайн этапа. Поток проверяет найденные Оффлайн потоком пары H, H'. Первым делом для каждой
* пары вычисляется значение dR. Затем, для всех возможных 15^4 dY5 решается уравнение
* S(ΔY5 ^ Y5) ^ S(Y5) = P^-1L^-1(ΔR ^ ΔK6 ^ ΔM). Каждое найденное решение проходит обратные преобразования
* до Z1 и, если dZ1 = dHZ1, то до М. Затем М проверяется на истинность.
*/
public class Online extends Thread {
private long M;
private long[] K = new long[0], K_ = new long[0];
private Mora m;
private long R, R_;
public Online(String name) {
super(name);
m = new Mora();
M = realM;
}
/**
* Метод вычисляет R из H
*/
private long getR() {
long res = m.L(m.P(m.S(M ^ K[1])));
res = m.L(m.P(m.S(res ^ K[2])));
res = m.L(m.P(m.S(res ^ K[3])));
res = m.L(m.P(m.S(res ^ K[4])));
res = m.L(m.P(m.S(res ^ K[5])));
res = res ^ K[6];
return res;
}
/**
* Метод вычисляет R' из H'
*/
private long getR_() {
long res = m.L(m.P(m.S(M ^ K_[1])));
res = m.L(m.P(m.S(res ^ K_[2])));
res = m.L(m.P(m.S(res ^ K_[3])));
res = m.L(m.P(m.S(res ^ K_[4])));
res = m.L(m.P(m.S(res ^ K_[5])));
res = res ^ K_[6];
return res;
}
/**
* Метод увеличивает на 1 полученное значение value, но только в активных полубайтвх с номерами hbytes_nums,
* игнорируя неактивные полубайты.
*/
private long nextStep(long value, int... hbytes_nums) {
int index = hbytes_nums.length - 1;
while (index >= 0 && ((value >>> ((15 - hbytes_nums[index]) * 4)) & 0xFL) == 15) {
value ^= 14L << ((15 - hbytes_nums[index]) * 4);
index--;
}
if (index != -1)
value += 1L << ((15 - hbytes_nums[index]) * 4);
return value;
}
/**
* Метод ищет решения для уравнения S(ΔY5 ^ Y5) ^ S(Y5) = P^-1L^-1(ΔR ^ ΔK6 ^ ΔM).
* Все возможные решения ищутся индивидуально для каждого из 16 полубайт и возвращаются
* в виде двумерного списка.
*/
private ArrayList<ArrayList<Integer>> findXParts(long dY5, long val) {
int dx, dy;
ArrayList<ArrayList<Integer>> x_parts = new ArrayList<>();
for (int i = 15; i >= 0; i--) {
x_parts.add(new ArrayList<>());
dx = (int) ((dY5 >> (i * 4)) & 0xFL);
dy = (int) ((val >> (i * 4)) & 0xFL);
for (int j = 0; j < 16; j++) {
if ((m.pi[j] ^ m.pi[j ^ dx]) == dy) {
x_parts.get(15 - i).add(j);
}
}
if (x_parts.get(15 - i).size() == 0)
return null;
}
return x_parts;
}
/**
* Метод принимает на вход созданный методом findXParts() двумерный список и
* составляет из его элементов все возможные комбинации, формируя таким образом
* массив решений уравнения S(ΔY5 ^ Y5) ^ S(Y5) = P^-1L^-1(ΔR ^ ΔK6 ^ ΔM).
*/
private long[] buildSolutionsFromXParts(ArrayList<ArrayList<Integer>> xes) {
int size = 1;
for (ArrayList<Integer> arl : xes) {
size *= arl.size();
}
try {
long[] res = new long[size+2];
int[] counters = new int[16];
for (int i = 0; i < size; i++) {
for (int j = 0; j < 16; j++) {
res[i] = (res[i] << 4) + ((xes.get(j).get(counters[j])) & 0xFL);
}
for (int j = 15; j >= 0; j--) {
if (counters[j] < xes.get(j).size() - 1) {
counters[j]++;
break;
} else {
counters[j] = 0;
}
}
}
return res;
} catch (Exception e) {
return null;
}
}
/**
* Метод проверяет найденное методом checkSolutions() значение М.
* Критерии истинности М:
* - M = M'
* - Рассчитанный из M R = R из истинного М
* - Рассчитанный из M' R' = R' из истинного М'
* Если все условия удовлетворены, то М считается истинным.
*/
public boolean checkM(long M, long M_) {
long res = m.L(m.P(m.S(M ^ K[1])));
long res_ = m.L(m.P(m.S(M_ ^ K_[1])));
res = m.L(m.P(m.S(res ^ K[2])));
res_ = m.L(m.P(m.S(res_ ^ K_[2])));
res = m.L(m.P(m.S(res ^ K[3])));
res_ = m.L(m.P(m.S(res_ ^ K_[3])));
res = m.L(m.P(m.S(res ^ K[4])));
res_ = m.L(m.P(m.S(res_ ^ K_[4])));
res = m.L(m.P(m.S(res ^ K[5])));
res_ = m.L(m.P(m.S(res_ ^ K_[5])));
res = res ^ K[6];
res_ = res_ ^ K_[6];
return M == M_ && res == R && res_ == R_ ? true : false;
}
/**
* Для всех найденных решений уравнения S(ΔY5 ^ Y5) ^ S(Y5) = P^-1L^-1(ΔR ^ ΔK6 ^ ΔM)
* метод проводит обратные преобразования до Z1, Z1'. Если dZ1 = dHZ1, то вычисляются М, M'
* и передаются методу checkM() для проверки на истинность. Иначе, решение отбрасывается.
* Если М оказалось истинным, то оно записывается в переменную res, а также foundM устанавливается в true.
* Это является сигналом остальным Онлайн потокам, что больше не нужно проверять решения, а также
* главному потоку, что можно выводить найденное решение и завершать программу.
*/
private void checkSolutions(long[] solutions, long dY5) {
long Y4, Y4_, Y3, Y3_, Y2, Y2_, Z1, Z1_, M, M_;
for (long solution: solutions) {
if (foundM) break;
Y4 = m.SReverse(m.P(m.LReverse(solution ^ K[5])));
Y4_ = m.SReverse(m.P(m.LReverse(solution ^ dY5 ^ K_[5])));
Y3 = m.SReverse(m.P(m.LReverse(Y4 ^ K[4])));
Y3_ = m.SReverse(m.P(m.LReverse(Y4_ ^ K_[4])));
Y2 = m.SReverse(m.P(m.LReverse(Y3 ^ K[3])));
Y2_ = m.SReverse(m.P(m.LReverse(Y3_ ^ K_[3])));
Z1 = m.P(m.LReverse(Y2 ^ K[2]));
Z1_ = m.P(m.LReverse(Y2_ ^ K_[2]));
if ((Z1 ^ Z1_) != (m.S(K[1] ^ m.consts[0]) ^ m.S(K_[1] ^ m.consts[0])))
continue;
M_ = m.SReverse(Z1_) ^ K_[1];
M = m.SReverse(Z1) ^ K[1];
if (checkM(M, M_)) {
if (!foundM) {
foundM = true;
res.set(M);
}
}
}
}
/**
* Метод берет найденные Оффлайн потоком пары H, H' из блокирующие очереди, вычисляя для них R, R'.
* Затем перебираются все возможные значения dW4, из них вычисляются dY5 и для каждого из них
* вычисляется уравнение S(ΔY5 ^ Y5) ^ S(Y5) = P^-1L^-1(ΔR ^ ΔK6 ^ ΔM). Если найдены решения, то
* они передаются методу checkSolutions() для дальнейшей обработки.
*/
public void run() {
List<long[]> pairs;
while (!foundM) {
try {
pairs = pairsForOnline.take();
K = pairs.get(0);
K_ = pairs.get(1);
} catch (Exception e) {
System.out.println("Exception " + e);
}
this.R = getR();
this.R_ = getR_();
long dR = this.R ^ this.R_;
long dW4 = 0x1000100010002000L;
ArrayList<ArrayList<Integer>> x_parts;
while(dW4 != 0x1000100010001000L) {
x_parts = findXParts(m.L(dW4) ^ (K[5] ^ K_[5]), m.P(m.LReverse(dR ^ (K[6] ^ K_[6]))));
if (x_parts != null) {
long[] solutions = buildSolutionsFromXParts(x_parts);
checkSolutions(solutions, m.L(dW4) ^ (K[5] ^ K_[5]));
}
dW4 = nextStep(dW4, 0,4,8,12);
}
checkedPairs.incrementAndGet();
}
}
}
/**
* Метод главного потока. Он запускает Оффлайн поток и Онлайн потоки в нужном количестве.
* Раз в 15 секунд выводится информация о ходе работы программы. Когда истинное значение М найдено,
* метод выводит его в консоль и завершает программу.
*/
public void attack(int threadsNum, long realM) {
this.realM = realM;
Offline offline = new Offline("Offline 1");
offline.start();
for (int i = 0; i < threadsNum; i++) {
new Online("Online " + i).start();
}
long startTime = System.currentTimeMillis();
try {
while (!foundM) {
Thread.sleep(15000);
System.out.println("\nОбновление данных:");
System.out.println("Программа работает уже : " + ((System.currentTimeMillis() - startTime) / 1000.0) + " секунд");
System.out.println("Проверено пар H, H': " + checkedPairs.get());
System.out.println("\n");
}
System.out.println("Было проверено " + checkedPairs.get() + " пар");
System.out.println("Истинное значение М найдено за " + ((System.currentTimeMillis() - startTime) / 1000.0) + " секунд");
System.out.println(Long.toHexString(res.get()));
System.exit(0);
} catch (Exception e) {
}
}
/**
* Статический метод для конфигурации атаки. Принимает на вход истинное значение М, которое будет взламываться,
* а также желаемое количество Онлайн потоков, которые должны быть запущены.
*/
public static void Attack (long realM, int threadsNum) {
new Mora5RoundAttack().attack(threadsNum, realM);
}
}
| [
"[email protected]"
] | |
c9ca6cc14a4f16ba1d649fbdce657289722a5daa | 5c0d343f53278c69804755321a5b03d876f30a33 | /src/ch09/_09_Powder.java | 0c81ede2f14b00822a0b4af30b76578de3436a46 | [] | no_license | hjw010/java_88 | ac4990457f1b762fdfe149985d4a2aaae415eb41 | 040e7cad470d84b6f9704f962e1c534d6f36b333 | refs/heads/main | 2023-06-16T22:38:47.104589 | 2021-07-02T06:29:57 | 2021-07-02T06:29:57 | 382,237,284 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 192 | java | package ch09;
public class _09_Powder {
public void doPrinting() {
System.out.println("powder을 사용");
}
@Override
public String toString() {
return "재료는 powder";
}
}
| [
"[email protected]"
] | |
de3ba871817fbc0af6efaee929f50e0aad4cb0bf | 3cd14065b88d8c76b0dfe7f0b7ed50a83c912e65 | /demo/src/main/java/com/example/demo/mapper/UserMapper.java | 529bebd11b3ab2c6104de057acba8f25c2dd21cc | [] | no_license | yang-lv-87/spring-cloud | c393fbd2552bf9b47e45920d15308204f9ddf598 | 3a048e14f9b70d99edbb57933483a81f833e0b51 | refs/heads/master | 2020-03-26T03:50:21.083948 | 2018-08-24T14:42:53 | 2018-08-24T14:42:53 | 144,463,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 341 | java | package com.example.demo.mapper;
import com.example.demo.entity.User;
public interface UserMapper {
int deleteByPrimaryKey(Long id);
int insert(User record);
int insertSelective(User record);
User selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(User record);
int updateByPrimaryKey(User record);
} | [
"[email protected]"
] | |
8bf44290d6ad2a82a1d1f775644fac0d6c50d2f5 | 30c109dc7eac92a72b4c82b9fd2985d4e0c83824 | /src/main/java/com/du/elasticsearch/model/FaceDataAge.java | 6aeee95f7c8b29a912c2f47d73f49034878190bf | [] | no_license | lxlx1963/elasticsearch-java | 276ccdd8e68a9f6e0c7f6d24e66cc926ebd9a056 | 1193b0e5a946059f2c8b31a93dcf65d4afec8182 | refs/heads/master | 2022-06-30T05:32:53.571099 | 2020-02-18T02:35:05 | 2020-02-18T02:35:05 | 241,253,804 | 0 | 0 | null | 2022-06-29T17:57:54 | 2020-02-18T02:24:45 | Java | UTF-8 | Java | false | false | 1,194 | java | package com.du.elasticsearch.model;
/**
* 人脸数据(年龄)
*
* @author dxy
* @date 2019/3/1 20:22
*/
public class FaceDataAge {
/**
* 主键ID
*/
private Long faceDataAgeId;
/**
* 日期
*/
private String date;
/**
* 年龄
*/
private String age;
/**
* 人数
*/
private Integer peopleNum;
/**
* 人次
*/
private Integer peopleTime;
/**
* 添加时间
*/
private Long addTime;
public Long getFaceDataAgeId() {
return faceDataAgeId;
}
public void setFaceDataAgeId(Long faceDataAgeId) {
this.faceDataAgeId = faceDataAgeId;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public Integer getPeopleNum() {
return peopleNum;
}
public void setPeopleNum(Integer peopleNum) {
this.peopleNum = peopleNum;
}
public Integer getPeopleTime() {
return peopleTime;
}
public void setPeopleTime(Integer peopleTime) {
this.peopleTime = peopleTime;
}
public Long getAddTime() {
return addTime;
}
public void setAddTime(Long addTime) {
this.addTime = addTime;
}
}
| [
"[email protected]"
] | |
ebd1e2912e312c950927849391aa38b99790054a | 12bd62506f480070f3b63d32a081df5db61bf447 | /src/test/java/com/google/cloud/genomics/utils/grpc/GenomicsStreamIteratorTest.java | c47c9cc9cdc485d3210c52bc29edd5716a03fb1c | [
"Apache-2.0"
] | permissive | calbach/utils-java | 9c0bad404b7b26bdb9b43a5362f2190513343b24 | e0cf08cb50fe6be84356c549fd6268203b84a04d | refs/heads/master | 2021-01-18T11:15:38.663325 | 2017-05-17T00:32:43 | 2017-05-17T01:06:33 | 61,857,140 | 0 | 0 | null | 2016-06-24T04:35:40 | 2016-06-24T04:35:39 | null | UTF-8 | Java | false | false | 7,784 | java | /*
* Copyright (C) 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.cloud.genomics.utils.grpc;
import com.google.cloud.genomics.utils.ShardBoundary;
import com.google.cloud.genomics.utils.ShardUtils;
import com.google.common.collect.ImmutableList;
import com.google.genomics.v1.StreamReadsRequest;
import com.google.genomics.v1.StreamReadsResponse;
import com.google.genomics.v1.StreamVariantsRequest;
import com.google.genomics.v1.StreamVariantsResponse;
import com.google.genomics.v1.StreamingReadServiceGrpc;
import com.google.genomics.v1.StreamingVariantServiceGrpc;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import io.grpc.ManagedChannel;
import io.grpc.Server;
import io.grpc.inprocess.InProcessChannelBuilder;
import io.grpc.inprocess.InProcessServerBuilder;
import io.grpc.stub.StreamObserver;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.Collections;
@RunWith(JUnit4.class)
public class GenomicsStreamIteratorTest {
public static final String SERVER_NAME = "unitTest";
public static final StreamReadsRequest PROTOTYPE_READ_REQUEST = StreamReadsRequest.newBuilder()
.setReadGroupSetId("theReadGroupSetId")
.setProjectId("theProjectId")
.build();
public static final StreamVariantsRequest PROTOTYPE_VARIANT_REQUEST = StreamVariantsRequest.newBuilder()
.setVariantSetId("theVariantSetId")
.setProjectId("theProjectId")
.build();
protected static Server server;
/**
* Starts the in-process server.
*/
@BeforeClass
public static void startServer() {
try {
server = InProcessServerBuilder.forName(SERVER_NAME)
.addService(StreamingReadServiceGrpc.bindService(new ReadsUnitServerImpl()))
.addService(StreamingVariantServiceGrpc.bindService(new VariantsUnitServerImpl()))
.build().start();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
@AfterClass
public static void stopServer() {
server.shutdownNow();
}
protected static class ReadsUnitServerImpl implements StreamingReadServiceGrpc.StreamingReadService {
@Override
public void streamReads(StreamReadsRequest request,
StreamObserver<StreamReadsResponse> responseObserver) {
StreamReadsResponse response = StreamReadsResponse.newBuilder()
.addAlignments(TestHelper.makeRead(400, 510))
.addAlignments(TestHelper.makeRead(450, 505))
.addAlignments(TestHelper.makeRead(499, 600))
.build();
responseObserver.onNext(response);
responseObserver.onCompleted();
}
}
protected static class VariantsUnitServerImpl implements StreamingVariantServiceGrpc.StreamingVariantService {
@Override
public void streamVariants(StreamVariantsRequest request,
StreamObserver<StreamVariantsResponse> responseObserver) {
StreamVariantsResponse response = StreamVariantsResponse.newBuilder()
.addVariants(TestHelper.makeVariant(400, 510))
.addVariants(TestHelper.makeVariant(450, 505))
.addVariants(TestHelper.makeVariant(499, 600))
.build();
responseObserver.onNext(response);
responseObserver.onCompleted();
}
}
public ManagedChannel createChannel() {
return InProcessChannelBuilder.forName(SERVER_NAME).build();
}
@Test
public void testAllReadsOverlapsStart() throws IOException, GeneralSecurityException {
ImmutableList<StreamReadsRequest> requests =
ShardUtils.getReadRequests(Collections.singletonList(PROTOTYPE_READ_REQUEST), 1000000L, "chr7:500:600");
ReadStreamIterator iter = ReadStreamIterator.enforceShardBoundary(createChannel(), requests.get(0),
ShardBoundary.Requirement.STRICT, null);
TestHelper.consumeStreamTest(iter, 0);
iter = ReadStreamIterator.enforceShardBoundary(createChannel(), requests.get(0),
ShardBoundary.Requirement.OVERLAPS, null);
TestHelper.consumeStreamTest(iter, 3);
}
@Test
public void testAllVariantsOverlapsStart() throws IOException, GeneralSecurityException {
ImmutableList<StreamVariantsRequest> requests =
ShardUtils.getVariantRequests(PROTOTYPE_VARIANT_REQUEST, 1000000L, "chr7:500:600");
VariantStreamIterator iter = VariantStreamIterator.enforceShardBoundary(createChannel(), requests.get(0),
ShardBoundary.Requirement.STRICT, null);
TestHelper.consumeStreamTest(iter, 0);
iter = VariantStreamIterator.enforceShardBoundary(createChannel(), requests.get(0),
ShardBoundary.Requirement.OVERLAPS, null);
TestHelper.consumeStreamTest(iter, 3);
}
@Test
public void testSomeReadsOverlapsStart() throws IOException, GeneralSecurityException {
ImmutableList<StreamReadsRequest> requests =
ShardUtils.getReadRequests(Collections.singletonList(PROTOTYPE_READ_REQUEST), 1000000L, "chr7:499:600");
ReadStreamIterator iter = ReadStreamIterator.enforceShardBoundary(createChannel(), requests.get(0),
ShardBoundary.Requirement.STRICT, null);
TestHelper.consumeStreamTest(iter, 1);
iter = ReadStreamIterator.enforceShardBoundary(createChannel(), requests.get(0),
ShardBoundary.Requirement.OVERLAPS, null);
TestHelper.consumeStreamTest(iter, 3);
}
@Test
public void testSomeVariantsOverlapsStart() throws IOException, GeneralSecurityException {
ImmutableList<StreamVariantsRequest> requests =
ShardUtils.getVariantRequests(PROTOTYPE_VARIANT_REQUEST, 1000000L, "chr7:499:600");
VariantStreamIterator iter = VariantStreamIterator.enforceShardBoundary(createChannel(), requests.get(0),
ShardBoundary.Requirement.STRICT, null);
TestHelper.consumeStreamTest(iter, 1);
iter = VariantStreamIterator.enforceShardBoundary(createChannel(), requests.get(0),
ShardBoundary.Requirement.OVERLAPS, null);
TestHelper.consumeStreamTest(iter, 3);
}
@Test
public void testNoReadsOverlapsStart() throws IOException, GeneralSecurityException {
ImmutableList<StreamReadsRequest> requests =
ShardUtils.getReadRequests(Collections.singletonList(PROTOTYPE_READ_REQUEST), 1000000L, "chr7:300:600");
ReadStreamIterator iter = ReadStreamIterator.enforceShardBoundary(createChannel(), requests.get(0),
ShardBoundary.Requirement.STRICT, null);
TestHelper.consumeStreamTest(iter, 3);
iter = ReadStreamIterator.enforceShardBoundary(createChannel(), requests.get(0),
ShardBoundary.Requirement.OVERLAPS, null);
TestHelper.consumeStreamTest(iter, 3);
}
@Test
public void testNoVariantsOverlapsStart() throws IOException, GeneralSecurityException {
ImmutableList<StreamVariantsRequest> requests =
ShardUtils.getVariantRequests(PROTOTYPE_VARIANT_REQUEST, 1000000L, "chr7:300:600");
VariantStreamIterator iter = VariantStreamIterator.enforceShardBoundary(createChannel(), requests.get(0),
ShardBoundary.Requirement.STRICT, null);
TestHelper.consumeStreamTest(iter, 3);
iter = VariantStreamIterator.enforceShardBoundary(createChannel(), requests.get(0),
ShardBoundary.Requirement.OVERLAPS, null);
TestHelper.consumeStreamTest(iter, 3);
}
}
| [
"[email protected]"
] | |
b5858b3f1e21daf81b5a6839e38f61c4a316792d | 5c9126d0d05d679186e849b6a95dcc6c6d013196 | /xc-service-manage-course/src/main/java/com/xuecheng/manage_course/exception/CustomExceptionCatch.java | 6cc9d5328a648021867cc1c7a3b0bfee3d7620c2 | [] | no_license | fengyehong123/Study_Online | 37a346aefb956791afb0c328a4f7d8b824522465 | b12082530f2d99339cdfc220f7af21ea4217a988 | refs/heads/master | 2022-12-04T03:38:35.897340 | 2019-12-15T12:06:08 | 2019-12-15T12:06:08 | 227,726,273 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 791 | java | package com.xuecheng.manage_course.exception;
import com.xuecheng.framework.exception.ExceptionCatch;
import com.xuecheng.framework.model.response.CommonCode;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
// 课程管理自定义的异常类型,定义异常类型所对应的的错误代码
// 继承我们自定义的异常捕获类
@ControllerAdvice
public class CustomExceptionCatch extends ExceptionCatch {
static {
// 除了CustomException以外的异常类型及对应的错误代码在这里定义,如果不定义则统一返回固定的错误信息
// 返回权限不足,无权访问的异常
builder.put(AccessDeniedException.class, CommonCode.UNAUTHORISE);
}
}
| [
"[email protected]"
] | |
d066207a1db7cb9cb17d1aacd25403e5dcc470fa | 656da9cfd0def8a626f78409c58daf7441d76073 | /backend/bbs-service/src/main/java/com/yuan/bbs/entity/Collection.java | b7f4fdd268cfde24513c2c293022b7b237f63561 | [] | no_license | dawndusker/SpringBoot-Vue3-BBS | f04fb8367ca86a5f47258d14699f64ce773e2187 | d1fe10545d5d9ae7398febedd9c2843136451f1e | refs/heads/main | 2023-03-25T02:46:45.791503 | 2021-03-12T15:24:47 | 2021-03-12T15:24:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,179 | java | package com.yuan.bbs.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 收藏表
* </p>
*
* @author yuan
* @since 2020-07-19
*/
@Data
@EqualsAndHashCode
@Accessors(chain = true)
@TableName("y_collection")
@ApiModel(value = "Collection对象", description = "收藏表")
public class Collection implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(hidden = true)
private Integer id;
@ApiModelProperty(value = "用户id")
private Integer uid;
@ApiModelProperty(value = "被收藏资源的id")
private Integer itemId;
@ApiModelProperty(value = "被收藏资源的类型")
private Integer itemType;
@ApiModelProperty(hidden = true)
private LocalDateTime gmtCreate;
}
| [
"[email protected]"
] | |
aad676a8fea1dae078bb2bced149f80b38245728 | f967328922baff5c2b0b2437949aad0118a90435 | /gulimall_/gulimall-coupon/src/main/java/com/xmh/gulimall/coupon/controller/CouponSpuRelationController.java | 177fef2ec36f4328d227f1fd7bc2f8e6d6fe6976 | [
"Apache-2.0"
] | permissive | Blizzard0409/gulimall | 8fb3170789152728df22e83f6ded33ff946edb13 | 5d46306a2d382f7461da6f7faa11304278e2a978 | refs/heads/master | 2023-08-20T22:05:00.610822 | 2021-10-18T07:18:13 | 2021-10-18T07:18:13 | 418,384,724 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,417 | java | package com.xmh.gulimall.coupon.controller;
import java.util.Arrays;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.xmh.gulimall.coupon.entity.CouponSpuRelationEntity;
import com.xmh.gulimall.coupon.service.CouponSpuRelationService;
import com.xmh.common.utils.PageUtils;
import com.xmh.common.utils.R;
/**
* 优惠券与产品关联
*
* @author xmh
* @email [email protected]
* @date 2021-07-27 12:11:55
*/
@RestController
@RequestMapping("coupon/couponspurelation")
public class CouponSpuRelationController {
@Autowired
private CouponSpuRelationService couponSpuRelationService;
/**
* 列表
*/
@RequestMapping("/list")
//@RequiresPermissions("coupon:couponspurelation:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = couponSpuRelationService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
//@RequiresPermissions("coupon:couponspurelation:info")
public R info(@PathVariable("id") Long id){
CouponSpuRelationEntity couponSpuRelation = couponSpuRelationService.getById(id);
return R.ok().put("couponSpuRelation", couponSpuRelation);
}
/**
* 保存
*/
@RequestMapping("/save")
//@RequiresPermissions("coupon:couponspurelation:save")
public R save(@RequestBody CouponSpuRelationEntity couponSpuRelation){
couponSpuRelationService.save(couponSpuRelation);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
//@RequiresPermissions("coupon:couponspurelation:update")
public R update(@RequestBody CouponSpuRelationEntity couponSpuRelation){
couponSpuRelationService.updateById(couponSpuRelation);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
//@RequiresPermissions("coupon:couponspurelation:delete")
public R delete(@RequestBody Long[] ids){
couponSpuRelationService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
| [
"[email protected]"
] | |
3c72ad313a5ab07e4de8336724e25d71d79d6e23 | 9ced84540607dd9f98f1edd5f7d8685003bf62d0 | /src/main/java/com/sistex/padroes/Filtro.java | 603b2c026c43e754d03ed4e57159985e7136e8fb | [] | no_license | jeancarlos2015/projetoSistexServico | 6ec0caf7400de0c68dccce599229da37f3830f65 | 4a53623abb4a79f0ead8fd953db511717bbd0b09 | refs/heads/master | 2021-06-27T23:34:49.464645 | 2017-09-18T15:21:22 | 2017-09-18T15:21:22 | 103,956,268 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,178 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.sistex.padroes;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
/**
*
* @author jean
*/
public class Filtro implements Filter{
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpSession sessao = ((HttpServletRequest)request).getSession();
}
@Override
public void destroy() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| [
"[email protected]"
] | |
628807f8cf8f5e41e740bb173b14f9853bf52d39 | ea175d8d30a3c8566ce62fdd66ac4e7fb7935c37 | /tests/src/test/java/com/orientechnologies/orient/test/domain/whiz/Profile.java | 18bfc42233a2719dcf69f539d1ab33d853f07afa | [
"BSD-3-Clause",
"CDDL-1.0",
"Apache-2.0"
] | permissive | orientechnologies/orientdb | a9aa2708e927cfbd8ba479ed1ceabb1979ba9f65 | 7df5ffa9f691ae752a0abdb45ccf93bc8ae8b9a4 | refs/heads/develop | 2023-08-31T12:42:55.842426 | 2023-08-30T13:56:50 | 2023-08-30T13:56:50 | 7,083,240 | 3,932 | 979 | Apache-2.0 | 2023-09-11T12:49:58 | 2012-12-09T20:33:47 | Java | UTF-8 | Java | false | false | 3,364 | java | /*
* Copyright 2010-2016 OrientDB LTD (http://orientdb.com)
*
* 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.orientechnologies.orient.test.domain.whiz;
import com.orientechnologies.orient.core.annotation.OId;
import com.orientechnologies.orient.core.annotation.OVersion;
import com.orientechnologies.orient.test.domain.business.Address;
import java.util.HashSet;
import java.util.Set;
public class Profile {
@OId private String id;
@OVersion private Integer version;
private String nick;
private Set<Profile> followings = new HashSet<Profile>();
private Set<Profile> followers = new HashSet<Profile>();
private String name;
private String surname;
private Address location;
private Long hash;
private Profile invitedBy;
private String value;
public Profile() {}
public Profile(String iNick) {
nick = iNick;
}
public Profile(String iNick, String iName, String iSurname, Profile iInvitedBy) {
this.nick = iNick;
this.name = iName;
this.surname = iSurname;
this.invitedBy = iInvitedBy;
}
public Set<Profile> getFollowings() {
return followings;
}
public Set<Profile> getFollowers() {
return followers;
}
public Profile addFollower(Profile iFollower) {
getFollowers().add(iFollower);
iFollower.getFollowings().add(this);
return this;
}
public Profile removeFollower(Profile iFollower) {
getFollowers().remove(iFollower);
iFollower.getFollowings().remove(this);
return this;
}
public Profile addFollowing(Profile iFollowing) {
getFollowings().add(iFollowing);
iFollowing.getFollowers().add(this);
return this;
}
public Profile removeFollowing(Profile iFollowing) {
getFollowings().remove(iFollowing);
iFollowing.getFollowers().remove(this);
return this;
}
public Profile getInvitedBy() {
return invitedBy;
}
public String getName() {
return name;
}
public Profile setName(String name) {
this.name = name;
return this;
}
public String getSurname() {
return surname;
}
public Profile setSurname(String surname) {
this.surname = surname;
return this;
}
public Address getLocation() {
return location;
}
public Profile setLocation(Address location) {
this.location = location;
return this;
}
public Profile setInvitedBy(Profile invitedBy) {
this.invitedBy = invitedBy;
return this;
}
public String getNick() {
return nick;
}
public void setNick(String nick) {
this.nick = nick;
}
public String getValue() {
return value;
}
public Profile setValue(String value) {
this.value = value;
return this;
}
public String getId() {
return id;
}
public Long getHash() {
return hash;
}
public Profile setHash(Long hash) {
this.hash = hash;
return this;
}
}
| [
"[email protected]"
] | |
9e875dac50bd8b264c9c801bb4b82f2875f0ce78 | 0a33d7cf3d9a98c4aa9effc9733e9981f47cc9d3 | /softwareEnvironment/salsa/examples/stars/Point3d.java | af3869f5475161f1d6b1c5dc3e08691bdf85c124 | [] | no_license | RPI-WCL/COS | f21a0858cfeb0e5a88a223b5eca755b2264eaa10 | 30b50ca890d4025b37d01a52d459d164e6667e9e | refs/heads/master | 2021-01-22T04:41:27.156057 | 2013-07-03T20:09:00 | 2013-07-03T20:09:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 969 | java | /*
* Author: Shigeru Imai (RCSID:660855993)
* Filename: Point3d.java
* Date: Nov 11, 2010
*
*/
package salsa.examples.stars;
import java.io.Serializable;
public class Point3d implements Serializable {
float x, y, z;
public Point3d() {
x = y = z = 0.0F;
}
public Point3d( String str ) {
String[] coord = str.split(" ");
x = Float.parseFloat( coord[0] );
y = Float.parseFloat( coord[1] );
z = Float.parseFloat( coord[2] );
}
public Point3d( float x, float y, float z ) {
this.x = x;
this.y = y;
this.z = z;
}
public boolean isEqual( Point3d p ) {
return ((this.x == p.x) && (this.y == p.y) && (this.z == p.z));
}
public float distance( Point3d p ) {
return (float) Math.sqrt( (x - p.x)*(x - p.x) + (y - p.y)*(y - p.y) + (z - p.z)*(z - p.z) );
}
public void print() {
System.out.println( x + " " + y + " " + z );
}
public String toString() {
return String.format( x + " " + y + " " + z );
}
}
| [
"[email protected]"
] | |
c5d05657751a4662a9f65d74aa5da571f1bc0b02 | d2f41925eafbfef46f1ae08ff29ec451db9b5580 | /utflute-lastaflute/src/main/java/org/dbflute/utflute/core/policestory/pjresource/PoliceStoryProjectResourceChase.java | 5ba1f65b0360c2d1a5650c50421037cf3ce849de | [
"Apache-2.0"
] | permissive | dbflute-utflute/utflute-lasta | 2d0e5e2a6349cf4558a3e438938fbc1d6fdffb18 | 8685a312fa0ab501bcc624bf6cd5814a465fb13e | refs/heads/develop | 2023-06-23T21:45:05.283935 | 2023-06-14T12:54:49 | 2023-06-14T12:54:49 | 32,672,114 | 0 | 0 | null | 2022-05-07T11:37:56 | 2015-03-22T11:04:17 | Java | UTF-8 | Java | false | false | 2,454 | java | /*
* Copyright 2014-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.dbflute.utflute.core.policestory.pjresource;
import java.io.File;
import org.dbflute.utflute.core.policestory.miscfile.PoliceStoryMiscFileChase;
import org.dbflute.utflute.core.policestory.miscfile.PoliceStoryMiscFileHandler;
/**
* @author jflute
* @since 0.4.0 (2014/03/16 Sunday)
*/
public class PoliceStoryProjectResourceChase {
// ===================================================================================
// Attribute
// =========
protected final Object _testCase;
protected final File _projectDir;
// ===================================================================================
// Constructor
// ===========
public PoliceStoryProjectResourceChase(Object testCase, File webappDir) {
_testCase = testCase;
_projectDir = webappDir;
}
// ===================================================================================
// Chase
// =====
public void chaseProjectResource(final PoliceStoryProjectResourceHandler handler) {
new PoliceStoryMiscFileChase(_testCase, _projectDir) {
protected String getChaseFileExt() {
return null; // means all
}
}.chaseMiscFile(new PoliceStoryMiscFileHandler() {
public void handle(File miscFile) {
handler.handle(miscFile);
}
});
}
}
| [
"[email protected]"
] | |
5fd87c8ab14636a2030be349816dc37153cf06ab | c4c46ac22b6a7249ce42119b560dfc7e4a3d7159 | /ps/src/main/java/seattle/algostar/ps/acmicpc/dp/Problem2565_JW.java | 04bd63404ddf4b442d5832eb300f7041daac51e2 | [] | no_license | algostar/PS | e39f83238765f4b9d07f5e23a3a4e339d674a54c | d99b46f07126a3bffcc3fb37d3028617619df7c2 | refs/heads/master | 2021-01-23T19:36:01.556693 | 2017-05-29T20:06:50 | 2017-05-29T20:06:50 | 45,015,823 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,018 | java | package seattle.algostar.ps.acmicpc.dp;
import java.util.Arrays;
import java.util.Scanner;
public class Problem2565_JW {
public static void main(String[] args) {
new Problem2565_JW().run();
}
int N;
Line[] lines;
int[] memo;
private void run() {
Scanner sc = new Scanner(System.in);
N = sc.nextInt();
lines = new Line[N+1];
memo = new int[N+1];
Arrays.fill(memo, -1);
lines[0] = new Line(0, 0);
for (int i = 1; i <= N; i++) {
lines[i] = new Line(sc.nextInt(), sc.nextInt());
}
Arrays.sort(lines);
int lis = f(0) - 1;
System.out.println(N - lis);
}
private int f(int ix) {
if (memo[ix] != -1) return memo[ix];
int lis = 1;
for (int i = ix+1; i <= N; i++) {
if (lines[ix].r < lines[i].r) {
lis = Math.max(lis, f(i) + 1);
}
}
return memo[ix] = lis;
}
class Line implements Comparable<Line> {
int l;
int r;
public Line(int l, int r) {
this.l = l;
this.r = r;
}
public int compareTo(Line o) {
return this.l - o.l;
}
}
}
| [
"[email protected]"
] | |
b8a589c2a5ed8f48c7ff6bc9d60cfb8659b8a4fe | fee2c3b6af4c7983c1e87a23054d0e1ee2f1f97c | /src/main/java/org/iban4j/IbanUtil.java | 378844d2848f5cf1d9a0ebf2bae0f508fcd0ef7f | [
"Apache-2.0"
] | permissive | mikegr/iban4j | f4cc06d6108c95c12e014736b2d566dd1b2a4947 | 4b66efab600cefbe56505a482dbf0f460dea73d5 | refs/heads/master | 2021-01-15T09:57:16.656157 | 2014-12-09T10:32:10 | 2014-12-09T10:32:10 | 25,197,737 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 15,137 | java | /*
* Copyright 2013 Artur Mkrtchyan
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.iban4j;
import org.iban4j.bban.BbanEntryType;
import org.iban4j.bban.BbanStructure;
import org.iban4j.bban.BbanStructureEntry;
import static org.iban4j.IbanFormatException.IbanFormatViolation.*;
/**
* Iban Utility Class
*/
public final class IbanUtil {
private static final int MOD = 97;
private static final long MAX = 999999999;
private static final int COUNTRY_CODE_INDEX = 0;
private static final int COUNTRY_CODE_LENGTH = 2;
private static final int CHECK_DIGIT_INDEX = COUNTRY_CODE_LENGTH;
private static final int CHECK_DIGIT_LENGTH = 2;
private static final int BBAN_INDEX = CHECK_DIGIT_INDEX + CHECK_DIGIT_LENGTH;
private static final String ASSERT_UPPER_LETTERS = "[%s] must contain only upper case letters.";
private static final String ASSERT_DIGITS_AND_LETTERS = "[%s] must contain only digits or letters.";
private static final String ASSERT_DIGITS = "[%s] must contain only digits.";
private IbanUtil() {
}
/**
* Calculates Iban
* <a href="http://en.wikipedia.org/wiki/ISO_13616#Generating_IBAN_check_digits">Check Digit</a>.
*
* @param iban string value
* @return check digit as String
*/
public static String calculateCheckDigit(final String iban) {
final String reformattedIban = replaceCheckDigit(iban,
Iban.DEFAULT_CHECK_DIGIT);
final int modResult = calculateMod(reformattedIban);
final int checkDigitIntValue = (98 - modResult);
final String checkDigit = Integer.toString(checkDigitIntValue);
return checkDigitIntValue > 9 ? checkDigit : "0" + checkDigit;
}
/**
* Validates iban.
*
* @param iban to be validated.
* @throws IbanFormatException if iban is invalid.
* UnsupportedCountryException if iban's country is not supported.
* InvalidCheckDigitException if iban has invalid check digit.
*/
public static void validate(final String iban) throws IbanFormatException,
InvalidCheckDigitException, UnsupportedCountryException {
try {
validateEmpty(iban);
validateCountryCode(iban);
validateCheckDigitPresence(iban);
final BbanStructure structure = getBbanStructure(iban);
validateBbanLength(iban, structure);
validateBbanEntries(iban, structure);
validateCheckDigit(iban);
} catch (Iban4jException e) {
throw e;
} catch (RuntimeException e) {
throw new IbanFormatException(UNKNOWN, e.getMessage());
}
}
/**
* Checks whether country is supporting iban.
* @param countryCode {@link org.iban4j.CountryCode}
*
* @return boolean true if country supports iban, false otherwise.
*/
public static boolean isSupportedCountry(final CountryCode countryCode) {
return BbanStructure.forCountry(countryCode) != null;
}
/**
* Returns iban length for the specified country.
*
* @param countryCode {@link org.iban4j.CountryCode}
* @return the length of the iban for the specified country.
*/
public static int getIbanLength(final CountryCode countryCode) {
final BbanStructure structure = getBbanStructure(countryCode);
return COUNTRY_CODE_LENGTH + CHECK_DIGIT_LENGTH + structure.getBbanLength();
}
/**
* Returns iban's check digit.
*
* @param iban String
* @return checkDigit String
*/
public static String getCheckDigit(final String iban) {
return iban.substring(CHECK_DIGIT_INDEX,
CHECK_DIGIT_INDEX + CHECK_DIGIT_LENGTH);
}
/**
* Returns iban's country code.
*
* @param iban String
* @return countryCode String
*/
public static String getCountryCode(final String iban) {
return iban.substring(COUNTRY_CODE_INDEX,
COUNTRY_CODE_INDEX + COUNTRY_CODE_LENGTH);
}
/**
* Returns iban's country code and check digit.
*
* @param iban String
* @return countryCodeAndCheckDigit String
*/
public static String getCountryCodeAndCheckDigit(final String iban) {
return iban.substring(COUNTRY_CODE_INDEX,
COUNTRY_CODE_INDEX + COUNTRY_CODE_LENGTH + CHECK_DIGIT_LENGTH);
}
/**
* Returns iban's bban (Basic Bank Account Number).
*
* @param iban String
* @return bban String
*/
public static String getBban(final String iban) {
return iban.substring(BBAN_INDEX);
}
/**
* Returns iban's account number.
*
* @param iban String
* @return accountNumber String
*/
public static String getAccountNumber(final String iban) {
return extractBbanEntry(iban, BbanEntryType.account_number);
}
/**
* Returns iban's bank code.
*
* @param iban String
* @return bankCode String
*/
public static String getBankCode(final String iban) {
return extractBbanEntry(iban, BbanEntryType.bank_code);
}
/**
* Returns iban's branch code.
*
* @param iban String
* @return branchCode String
*/
static String getBranchCode(final String iban) {
return extractBbanEntry(iban, BbanEntryType.branch_code);
}
/**
* Returns iban's national check digit.
*
* @param iban String
* @return nationalCheckDigit String
*/
static String getNationalCheckDigit(final String iban) {
return extractBbanEntry(iban, BbanEntryType.national_check_digit);
}
/**
* Returns iban's account type.
*
* @param iban String
* @return accountType String
*/
static String getAccountType(final String iban) {
return extractBbanEntry(iban, BbanEntryType.account_type);
}
/**
* Returns iban's owner account type.
*
* @param iban String
* @return ownerAccountType String
*/
static String getOwnerAccountType(final String iban) {
return extractBbanEntry(iban, BbanEntryType.owner_account_number);
}
/**
* Returns iban's identification number.
*
* @param iban String
* @return identificationNumber String
*/
static String getIdentificationNumber(final String iban) {
return extractBbanEntry(iban, BbanEntryType.identification_number);
}
static String calculateCheckDigit(final Iban iban) {
return calculateCheckDigit(iban.toString());
}
/**
* Returns an iban with replaced check digit.
*
* @param iban The iban
* @return The iban without the check digit
*/
static String replaceCheckDigit(final String iban, final String checkDigit) {
return getCountryCode(iban) + checkDigit + getBban(iban);
}
private static void validateCheckDigit(final String iban) {
String checkDigit = getCheckDigit(iban);
String expectedCheckDigit = calculateCheckDigit(iban);
if (!checkDigit.equals(expectedCheckDigit)) {
throw new InvalidCheckDigitException(
checkDigit, expectedCheckDigit,
"[" + iban + "] has invalid check digit: " +
checkDigit + ", expected check digit is: " + expectedCheckDigit);
}
}
private static void validateEmpty(final String iban) {
if(iban == null) {
throw new IbanFormatException(IBAN_NOT_NULL,
"Null can't be a valid Iban.");
}
if(iban.length() == 0) {
throw new IbanFormatException(IBAN_NOT_EMPTY,
"Empty string can't be a valid Iban.");
}
}
private static void validateCountryCode(final String iban) {
// check if iban contains 2 char country code
if(iban.length() < COUNTRY_CODE_LENGTH) {
throw new IbanFormatException(COUNTRY_CODE_TWO_LETTERS, iban,
"Iban must contain 2 char country code.");
}
final String countryCode = getCountryCode(iban);
// check case sensitivity
if(!countryCode.equals(countryCode.toUpperCase()) ||
!Character.isLetter(countryCode.charAt(0)) ||
!Character.isLetter(countryCode.charAt(1))) {
throw new IbanFormatException(COUNTRY_CODE_UPPER_CASE_LETTERS, countryCode,
"Iban country code must contain upper case letters.");
}
if(CountryCode.getByCode(countryCode) == null) {
throw new IbanFormatException(COUNTRY_CODE_EXISTS, countryCode,
"Iban contains non existing country code.");
}
// check if country is supported
final BbanStructure structure = BbanStructure.forCountry(
CountryCode.getByCode(countryCode));
if (structure == null) {
throw new UnsupportedCountryException(countryCode,
"Country code is not supported.");
}
}
private static void validateCheckDigitPresence(final String iban) {
// check if iban contains 2 digit check digit
if(iban.length() < COUNTRY_CODE_LENGTH + CHECK_DIGIT_LENGTH) {
throw new IbanFormatException(CHECK_DIGIT_TWO_DIGITS,
iban.substring(COUNTRY_CODE_LENGTH),
"Iban must contain 2 digit check digit.");
}
final String checkDigit = getCheckDigit(iban);
// check digits
if(!Character.isDigit(checkDigit.charAt(0)) ||
!Character.isDigit(checkDigit.charAt(1))) {
throw new IbanFormatException(CHECK_DIGIT_ONLY_DIGITS, checkDigit,
"Iban's check digit should contain only digits.");
}
}
private static void validateBbanLength(final String iban,
final BbanStructure structure) {
final int expectedBbanLength = structure.getBbanLength();
final String bban = getBban(iban);
final int bbanLength = bban.length();
if (expectedBbanLength != bbanLength) {
throw new IbanFormatException(BBAN_LENGTH,
bbanLength, expectedBbanLength,
"[" + bban + "] length is " + bbanLength +
", expected BBAN length is: " + expectedBbanLength);
}
}
private static void validateBbanEntries(final String iban,
final BbanStructure structure) {
final String bban = getBban(iban);
// FIXME duplicate code
int bbanEntryOffset = 0;
for(final BbanStructureEntry entry : structure.getEntries()) {
final int entryLength = entry.getLength();
final String entryValue = bban.substring(bbanEntryOffset,
bbanEntryOffset + entryLength);
bbanEntryOffset = bbanEntryOffset + entryLength;
// validate character type
validateBbanEntryCharacterType(entry, entryValue);
}
}
private static void validateBbanEntryCharacterType(final BbanStructureEntry entry,
final String entryValue) {
switch (entry.getCharacterType()) {
case a:
for(char ch: entryValue.toCharArray()) {
if(!Character.isUpperCase(ch)) {
throw new IbanFormatException(BBAN_ONLY_UPPER_CASE_LETTERS,
entry.getEntryType(), entryValue, ch,
String.format(ASSERT_UPPER_LETTERS, entryValue));
}
}
break;
case c:
for(char ch: entryValue.toCharArray()) {
if(!Character.isLetterOrDigit(ch)) {
throw new IbanFormatException(BBAN_ONLY_DIGITS_OR_LETTERS,
entry.getEntryType(), entryValue, ch,
String.format(ASSERT_DIGITS_AND_LETTERS, entryValue));
}
}
break;
case n:
for(char ch: entryValue.toCharArray()) {
if(!Character.isDigit(ch)) {
throw new IbanFormatException(BBAN_ONLY_DIGITS,
entry.getEntryType(), entryValue, ch,
String.format(ASSERT_DIGITS, entryValue));
}
}
break;
}
}
/**
* Calculates
* <a href="http://en.wikipedia.org/wiki/ISO_13616#Modulo_operation_on_IBAN">Iban Modulo</a>.
*
* @param iban String value
* @return modulo 97
*/
private static int calculateMod(final String iban) {
final String reformattedIban = getBban(iban) + getCountryCodeAndCheckDigit(iban);
long total = 0;
for (int i = 0; i < reformattedIban.length(); i++) {
final int numericValue = Character.getNumericValue(reformattedIban.charAt(i));
if (numericValue < 0 || numericValue > 35) {
// FIXME IAE
throw new IllegalArgumentException("Invalid Character[" + i + "] = '" + numericValue + "'");
}
total = (numericValue > 9 ? total * 100 : total * 10) + numericValue;
if (total > MAX) {
total = (total % MOD);
}
}
return (int) (total % MOD);
}
private static BbanStructure getBbanStructure(final String iban) {
final String countryCode = getCountryCode(iban);
return getBbanStructure(CountryCode.getByCode(countryCode));
}
private static BbanStructure getBbanStructure(final CountryCode countryCode) {
return BbanStructure.forCountry(countryCode);
}
private static String extractBbanEntry(final String iban, final BbanEntryType entryType) {
// FIXME duplicate code
final String bban = getBban(iban);
final BbanStructure structure = getBbanStructure(iban);
int bbanEntryOffset = 0;
for(final BbanStructureEntry entry : structure.getEntries()) {
final int entryLength = entry.getLength();
final String entryValue = bban.substring(bbanEntryOffset,
bbanEntryOffset + entryLength);
bbanEntryOffset = bbanEntryOffset + entryLength;
if(entry.getEntryType() == entryType) {
return entryValue;
}
}
return null;
}
}
| [
"[email protected]"
] | |
b1a0b7ff87fcd2f30274c64d8dae374245a07206 | 8b65953a99230a69350bf8f00b671221a4fcef0e | /src/com/miempresa/midepartamento/ejemploimportarjar/UsarJar.java | 459b6553e1ce0e585d88916c0ee3aae2e69467a0 | [] | no_license | unaiperea/EjemploImportarJar | 984713cc3d4f0058fdbb54611f0376726ad64add | 04658cdb56f08ef1d680571a82e87f1aefdf8038 | refs/heads/master | 2021-01-13T02:14:27.445414 | 2015-07-30T08:56:30 | 2015-07-30T08:56:30 | 39,940,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 525 | java | package com.miempresa.midepartamento.ejemploimportarjar;
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import com.ipartek.formacion.holaclase.util.Utilidades;
public class UsarJar {
public static void main(String[] args) throws IOException {
System.out.println("txuta");
System.out.println(Utilidades.round(4.999999f, 2));
System.out.println(Utilidades.cantar("Pepe"));
Document docc = Jsoup.connect("https://www.google.com").get();
}
}
| [
"[email protected]"
] | |
62f18a70054f85be3c4990401cb7ae32c408a2b3 | 1ca86d5d065372093c5f2eae3b1a146dc0ba4725 | /testing-modules/spring-testing/src/test/java/com/surya/mockito/MockBeanAnnotationIntegrationTest.java | 18b3060d5d6e897f9bc727964bd6480f92d52dce | [] | no_license | Suryakanta97/DemoExample | 1e05d7f13a9bc30f581a69ce811fc4c6c97f2a6e | 5c6b831948e612bdc2d9d578a581df964ef89bfb | refs/heads/main | 2023-08-10T17:30:32.397265 | 2021-09-22T16:18:42 | 2021-09-22T16:18:42 | 391,087,435 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,015 | java | package com.surya.mockito;
import com.surya.mockito.repository.UserRepository;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
public class MockBeanAnnotationIntegrationTest {
@MockBean
UserRepository mockRepository;
@Autowired
ApplicationContext context;
@Test
public void givenCountMethodMocked_WhenCountInvoked_ThenMockValueReturned() {
Mockito.when(mockRepository.count()).thenReturn(123L);
UserRepository userRepoFromContext = context.getBean(UserRepository.class);
long userCount = userRepoFromContext.count();
Assert.assertEquals(123L, userCount);
Mockito.verify(mockRepository).count();
}
}
| [
"[email protected]"
] | |
31fc39db12fa4ed99b92a050e5594c84c7c43619 | f9c912830a397ce5281f1341ba44c6695b9367a7 | /app/src/main/java/com/example/parlay/auth/RegisterActivity.java | 684641ee1c08ccadd5a7249c8015b591a24b9ea4 | [] | no_license | roxbrr/Parlay | b571d56ad3923385f41f788c51292261eff5deeb | 3cb3d53ff0a4dd3da22e200423a7b7e93903a185 | refs/heads/master | 2023-03-12T01:07:42.753486 | 2021-03-03T23:54:04 | 2021-03-03T23:54:04 | 343,650,506 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,256 | java | package com.example.parlay.auth;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.example.parlay.R;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.FirebaseFirestore;
import java.util.HashMap;
import java.util.Map;
public class RegisterActivity extends AppCompatActivity implements View.OnClickListener
{
private static final String TAG = "RegisterActivity";
public static final String EMAIL = "email";
public static final String L_NAME = "lName";
public static final String F_NAME = "fName";
public static final String PHONE_NUM = "phoneNum";
private FirebaseAuth fAuth;
EditText etFirstName, etLastName, etPhoneNum, etEmail, etPassword, etConfirmPassword;
Button btnRegister;
ImageView ivBackButton;
String userID;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
Log.d(TAG, "onCreate: started.");
fAuth = FirebaseAuth.getInstance();
etFirstName = findViewById(R.id.register_et_first_name);
etLastName = findViewById(R.id.register_et_last_name);
etPhoneNum = findViewById(R.id.register_et_phone_num);
etEmail = findViewById(R.id.register_et_email);
etPassword = findViewById(R.id.register_et_password);
etConfirmPassword = findViewById(R.id.register_et_confirm_password);
btnRegister = findViewById(R.id.register_btn_register_account);
ivBackButton = findViewById(R.id.register_iv_back_button);
btnRegister.setOnClickListener(this);
ivBackButton.setOnClickListener(this);
}
@Override
public void onClick(View view)
{
switch(view.getId())
{
case R.id.register_iv_back_button:
startActivity(new Intent(this, LoginActivity.class));
break;
case R.id.register_btn_register_account:
createAccount();
break;
}
}
public void createAccount()
{
// String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
// String phonePattern = "[0-9]{10}";
final String fName = etFirstName.getText().toString().trim();
final String lName = etLastName.getText().toString().trim();
final String phoneNum = etPhoneNum.getText().toString().trim();
final String email = etEmail.getText().toString().trim();
String password = etPassword.getText().toString().trim();
String confirmPassword = etConfirmPassword.getText().toString().trim();
if(fName.isEmpty())
{
etFirstName.setError("First name required");
etFirstName.requestFocus();
return;
}
else if(fName.length()<3)
{
etFirstName.setError("Must be at least 3 characters");
etFirstName.requestFocus();
}
else if(fName.length()>30)
{
etFirstName.setError("Must be 30 characters or less");
etFirstName.requestFocus();
}
else if(lName.isEmpty())
{
etLastName.setError("Last name required");
etLastName.requestFocus();
return;
}
else if(lName.length()<3)
{
etLastName.setError("Must be at least 3 characters");
etLastName.requestFocus();
}
else if(lName.length()>30)
{
etLastName.setError("Must be 30 characters or less");
etLastName.requestFocus();
}
else if(phoneNum.isEmpty())
{
etPhoneNum.setError("Phone Number required");
etPhoneNum.requestFocus();
return;
}
//TO DO: Implement Phone Number Format Validation//////////////////////////////////////////
// else if();
// {
// etPhoneNum.setError("Invalid Number");
// etPhoneNum.requestFocus();
// return;
// }
else if(email.isEmpty())
{
etEmail.setError("E-Mail required");
etEmail.requestFocus();
return;
}
//TO DO: Implement E-Mail Format Validation//////////////////////////////////////////
// else if();
// {
// etEmail.setError("Invalid Format");
// etEmail.requestFocus();
// return;
// }
else if(email.length()>30)
{
etEmail.setError("Must be 30 characters or less");
etEmail.requestFocus();
}
else if(password.isEmpty())
{
etPassword.setError("Password required");
etPassword.requestFocus();
return;
}
else if(password.length()<8)
{
etPassword.setError("Must be at least 8 characters");
etPassword.requestFocus();
return;
}
else if(confirmPassword.isEmpty())
{
etConfirmPassword.setError("Confirm Your Password");
etConfirmPassword.requestFocus();
return;
}
else if(!password.equals(confirmPassword))
{
etConfirmPassword.setError("Password does not match");
etConfirmPassword.requestFocus();
return;
}
fAuth.createUserWithEmailAndPassword(email,password)
.addOnCompleteListener(RegisterActivity.this, new OnCompleteListener<AuthResult>()
{
@Override
public void onComplete(@NonNull Task<AuthResult> task)
{
if(!task.isSuccessful())
{
Toast.makeText(RegisterActivity.this, "Registration failed: "
+ task.getException(), Toast.LENGTH_LONG).show();
}else
{
if(fAuth.getCurrentUser().getUid().equals(null))
{
Log.d(TAG, "onComplete: error setting userID");
}else
{
userID = fAuth.getCurrentUser().getUid();
}
Map<String, Object> userData = new HashMap<>();
userData.put(F_NAME, fName);
userData.put(L_NAME, lName);
userData.put(PHONE_NUM, phoneNum);
userData.put(EMAIL, email);
DocumentReference documentReference = FirebaseFirestore.getInstance().collection("Users").document(userID);
documentReference.set(userData).addOnSuccessListener(new OnSuccessListener<Void>()
{
@Override
public void onSuccess(Void aVoid)
{
Log.d(TAG, "Document Saved");
}
}).addOnFailureListener(new OnFailureListener()
{
@Override
public void onFailure(@NonNull Exception e)
{
Log.w(TAG, "Document not saved", e);
}
});
Toast.makeText(RegisterActivity.this, "Registration Successful", Toast.LENGTH_LONG).show();
startActivity(new Intent(RegisterActivity.this, LoginActivity.class));
finish();
}
}
});
}
} | [
"[email protected]"
] | |
a78c5b4a7526a939c129d60fc3a147c4f5c5b998 | a88380587e1e65420806072d0fcb9c777fddf903 | /src/test/java/com/std/data/dao/IDictDAOTest.java | fdc21ec7d46aa0580fe5ca044d287e653ea7c5d1 | [] | no_license | pyezxyj/std-data | bbd04f504400b5a191fe22d965209a659a9a88a8 | 52c829e93b0f929709df5df13f57fdb206aca3b8 | refs/heads/master | 2021-01-18T02:11:41.945147 | 2016-07-29T07:00:39 | 2016-07-29T07:00:39 | 68,428,767 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,834 | java | /**
* @Title IDictDAOTest.java
* @Package com.ibis.account.dao
* @Description
* @author miyb
* @date 2015-2-25 下午4:41:52
* @version V1.0
*/
package com.std.data.dao;
import java.util.Date;
import java.util.List;
import org.junit.Test;
import org.unitils.spring.annotation.SpringBeanByType;
import com.std.data.base.ADAOTest;
import com.std.data.domain.Dict;
/**
* @author: miyb
* @since: 2015-2-25 下午4:41:52
* @history:
*/
public class IDictDAOTest extends ADAOTest {
@SpringBeanByType
private IDictDAO dictDAO;
@Test
public void insert() {
Dict data = new Dict();
data.setCreateDatetime(new Date());
data.setCreator("koala");
data.setKey("配置文件");
data.setpId(0L);
data.setRemark("配置文件的落地");
data.setValue("config");
int lineNum = dictDAO.insert(data);
logger.info("insert : {}", lineNum);
}
@Test
public void select() {
Dict data = new Dict();
data.setId(1L);
data = dictDAO.select(data);
logger.info("select : {}", data);
}
@Test
public void selectTotalCount() {
Dict data = new Dict();
data.setId(1L);
long id = dictDAO.selectTotalCount(data);
logger.info("selectTotalCount : {}", id);
}
@Test
public void selectList() {
Dict data = new Dict();
data.setId(1L);
List<Dict> dataList = dictDAO.selectList(data);
logger.info("selectList : {}", dataList);
}
@Test
public void selectPage() {
Dict data = new Dict();
data.setId(1L);
List<Dict> dataList = dictDAO.selectList(data, 0, 1);
logger.info("selectPage : {}", dataList);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.