hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
list
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
list
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
list
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
9240034883180b5746f0c5ae2683c53ddd305232
728
java
Java
core/src/main/java/org/narrative/network/customizations/narrative/service/api/model/UserOwnedChannelsDTO.java
NarrativeCompany/narrative
84829f0178a0b34d4efc5b7dfa82a8929b5b06b5
[ "MIT" ]
8
2020-01-08T20:13:42.000Z
2020-06-19T23:10:17.000Z
core/src/main/java/org/narrative/network/customizations/narrative/service/api/model/UserOwnedChannelsDTO.java
NarrativeCompany/narrative
84829f0178a0b34d4efc5b7dfa82a8929b5b06b5
[ "MIT" ]
5
2020-01-09T17:49:55.000Z
2020-06-15T19:31:04.000Z
core/src/main/java/org/narrative/network/customizations/narrative/service/api/model/UserOwnedChannelsDTO.java
NarrativeCompany/narrative
84829f0178a0b34d4efc5b7dfa82a8929b5b06b5
[ "MIT" ]
5
2020-01-09T02:01:47.000Z
2021-06-01T13:34:46.000Z
26.962963
103
0.767857
1,001,372
package org.narrative.network.customizations.narrative.service.api.model; import com.fasterxml.jackson.annotation.JsonTypeName; import org.narrative.network.customizations.narrative.serialization.jackson.annotation.JsonValueObject; import lombok.Builder; import lombok.Value; import lombok.experimental.FieldNameConstants; /** * Value object representing a user's niche slots. */ @JsonValueObject @JsonTypeName("UserOwnedChannels") @Value @Builder(toBuilder = true) @FieldNameConstants public class UserOwnedChannelsDTO { /** * Number of niches owned by the user. */ private final int ownedNiches; /** * Number of Publications owned by the user. */ private final int ownedPublications; }
924003843cb27ae7ecd0f17680e0a0e4c56fc333
3,837
java
Java
old-external/odftoolkit/simple/src/test/java/org/odftoolkit/simple/text/ParagraphStyleHandlerTest.java
veriktig/scandium
17b22f29d70b1a972271071f62017880e8e0b5c7
[ "Apache-2.0" ]
39
2015-01-01T12:36:45.000Z
2021-11-10T16:10:26.000Z
old-external/odftoolkit/simple/src/test/java/org/odftoolkit/simple/text/ParagraphStyleHandlerTest.java
veriktig/scandium
17b22f29d70b1a972271071f62017880e8e0b5c7
[ "Apache-2.0" ]
1
2021-11-04T12:36:56.000Z
2021-11-04T12:36:56.000Z
old-external/odftoolkit/simple/src/test/java/org/odftoolkit/simple/text/ParagraphStyleHandlerTest.java
veriktig/scandium
17b22f29d70b1a972271071f62017880e8e0b5c7
[ "Apache-2.0" ]
42
2015-03-14T18:48:33.000Z
2021-11-10T16:10:19.000Z
32.794872
99
0.76049
1,001,373
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.odftoolkit.simple.text; import java.util.Locale; import java.util.logging.Level; import java.util.logging.Logger; import org.junit.Assert; import org.junit.Test; import org.odftoolkit.odfdom.type.Color; import org.odftoolkit.simple.Document; import org.odftoolkit.simple.TextDocument; import org.odftoolkit.simple.style.Font; import org.odftoolkit.simple.style.StyleTypeDefinitions.FontStyle; import org.odftoolkit.simple.style.StyleTypeDefinitions.TextLinePosition; public class ParagraphStyleHandlerTest { private static final Logger LOGGER = Logger.getLogger(ParagraphStyleHandlerTest.class.getName()); @Test public void testGetParagraphByIndex() { try { TextDocument doc = TextDocument.newTextDocument(); Paragraph paragraph = doc.addParagraph("paragraphTest"); ParagraphStyleHandler paragraphHandler = paragraph.getStyleHandler(); paragraphHandler.setCountry("English", Document.ScriptType.WESTERN); //validate String country = paragraphHandler.getCountry(Document.ScriptType.WESTERN); Assert.assertEquals("English", country); paragraphHandler.setCountry(null, Document.ScriptType.WESTERN); //validate String country1 = paragraphHandler.getCountry(Document.ScriptType.WESTERN); Assert.assertNull(country1); //save //doc.save(ResourceUtilities.newTestOutputFile("testParagraphStyleHandler.odt")); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); Assert.fail(e.getMessage()); } } @Test public void testGetFont() { try { TextDocument doc = TextDocument.newTextDocument(); Paragraph paragraph = doc.addParagraph("paragraphTest"); ParagraphStyleHandler paragraphHandler = paragraph.getStyleHandler(); Font fontBase = new Font("Arial", FontStyle.ITALIC, 10, Color.BLACK, TextLinePosition.THROUGH); paragraphHandler.setFont(fontBase); //validate Font font = paragraphHandler.getFont(Document.ScriptType.WESTERN); Assert.assertEquals(fontBase, font); paragraphHandler.setFont(fontBase, Locale.CHINESE); //validate Font font1 = paragraphHandler.getFont(Document.ScriptType.WESTERN); Assert.assertEquals(fontBase, font1); //save //doc.save(ResourceUtilities.newTestOutputFile("testParagraphStyleHandler.odt")); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); Assert.fail(e.getMessage()); } } @Test public void testGetLanguage() { try { TextDocument doc = TextDocument.newTextDocument(); Paragraph paragraph = doc.addParagraph("paragraphTest"); ParagraphStyleHandler paragraphHandler = paragraph.getStyleHandler(); paragraphHandler.setLanguage("English", Document.ScriptType.WESTERN); //validate String language = paragraphHandler.getLanguage(Document.ScriptType.WESTERN); Assert.assertEquals("English", language); //save //doc.save(ResourceUtilities.newTestOutputFile("testParagraphStyleHandler.odt")); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); Assert.fail(e.getMessage()); } } }
924003a0579102243c516e6b5a09213a62155ec9
2,154
java
Java
src/main/java/com/emc/mongoose/base/env/DateUtil.java
adrdc/mongoose-base
b9bbac1a9ea904f0a9e23e087d52e3a73d529da4
[ "MIT" ]
null
null
null
src/main/java/com/emc/mongoose/base/env/DateUtil.java
adrdc/mongoose-base
b9bbac1a9ea904f0a9e23e087d52e3a73d529da4
[ "MIT" ]
null
null
null
src/main/java/com/emc/mongoose/base/env/DateUtil.java
adrdc/mongoose-base
b9bbac1a9ea904f0a9e23e087d52e3a73d529da4
[ "MIT" ]
null
null
null
26.592593
108
0.737233
1,001,374
package com.emc.mongoose.base.env; import com.emc.mongoose.base.Constants; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.TimeZone; /** Created by andrey on 18.11.16. */ //TODO: update using formatters public interface DateUtil { TimeZone TZ_UTC = TimeZone.getTimeZone("UTC"); // e.g. 2001-07-04T12:08:56.235-0700 String PATTERN_ISO8601 = "yyyy-MM-dd'T'HH:mm:ss,SSS"; DateFormat FMT_DATE_ISO8601 = new SimpleDateFormat(PATTERN_ISO8601, Constants.LOCALE_DEFAULT) { { setTimeZone(TZ_UTC); } }; static String formatNowIso8601() { return FMT_DATE_ISO8601.format(new Date(System.currentTimeMillis())); } // e.g. 20210901T182320Z String PATTERN_AMAZON = "yyyyMMdd'T'HHmmss'Z'"; // close to ISO_INSTANT but not quite DateFormat FMT_DATE_AMAZON = new SimpleDateFormat(PATTERN_AMAZON, Constants.LOCALE_DEFAULT) { { setTimeZone(TZ_UTC); } }; static String formatNowAmazonStyle() { return FMT_DATE_AMAZON.format(new Date(System.currentTimeMillis())); } // e.g. Sun, 06 Nov 1994 08:49:37 GMT String PATTERN_RFC1123 = "EEE, dd MMM yyyy HH:mm:ss zzz"; DateFormat FMT_DATE_RFC1123 = new SimpleDateFormat(PATTERN_RFC1123, Constants.LOCALE_DEFAULT) { { setTimeZone(TZ_UTC); } }; static String formatNowRfc1123() { return FMT_DATE_RFC1123.format(new Date(System.currentTimeMillis())); } String PATTERN_METRICS_TABLE = "yyMMddHHmmss"; DateFormat FMT_DATE_METRICS_TABLE = new SimpleDateFormat(PATTERN_METRICS_TABLE, Constants.LOCALE_DEFAULT) { { setTimeZone(TZ_UTC); } }; ThreadLocal<Map<String, DateFormat>> DATE_FORMATS = ThreadLocal.withInitial(HashMap::new); static DateFormat dateFormat(final String pattern) { return DATE_FORMATS.get().computeIfAbsent( pattern, p -> { final var f = new SimpleDateFormat(p, Locale.ROOT); f.setTimeZone(TZ_UTC); return f; }); } static Date date(long millisSinceEpoch) { return new Date(millisSinceEpoch); } static long toMillisSinceEpoch(final Date date) { return date.getTime(); } }
92400696e225e31a47583a4e983a50a687d08c56
366
java
Java
src/main/java/com/urbandroid/sleep/captcha/domain/CaptchaGroup.java
JessicaByington/sleep_as_android_captcha
b10b11100f7914d1a36fd225184d3e48d5cb5ae8
[ "Apache-2.0" ]
12
2015-12-17T10:57:03.000Z
2021-03-07T02:49:56.000Z
src/main/java/com/urbandroid/sleep/captcha/domain/CaptchaGroup.java
JessicaByington/sleep_as_android_captcha
b10b11100f7914d1a36fd225184d3e48d5cb5ae8
[ "Apache-2.0" ]
2
2015-12-17T10:43:57.000Z
2020-10-16T05:55:49.000Z
src/main/java/com/urbandroid/sleep/captcha/domain/CaptchaGroup.java
JessicaByington/sleep_as_android_captcha
b10b11100f7914d1a36fd225184d3e48d5cb5ae8
[ "Apache-2.0" ]
1
2017-03-06T23:25:42.000Z
2017-03-06T23:25:42.000Z
15.913043
55
0.721311
1,001,375
package com.urbandroid.sleep.captcha.domain; import android.support.annotation.NonNull; import java.util.List; public interface CaptchaGroup { @NonNull String getId(); @NonNull String getLabel(); @NonNull List<CaptchaInfo> getCaptchaInfos(); CaptchaGroup add(@NonNull CaptchaInfo captchaInfo); boolean isExternalStorage(); }
9240077015cad1dbd79bcd33f4122dba6b3a4d28
2,140
java
Java
sql-parser/src/main/java/io/crate/sql/tree/TableFunction.java
chaudum/crate
ad4a35126e4e09dc372edd1c8c97bf589cef96ca
[ "Apache-2.0" ]
1
2020-02-03T11:59:41.000Z
2020-02-03T11:59:41.000Z
sql-parser/src/main/java/io/crate/sql/tree/TableFunction.java
chaudum/crate
ad4a35126e4e09dc372edd1c8c97bf589cef96ca
[ "Apache-2.0" ]
null
null
null
sql-parser/src/main/java/io/crate/sql/tree/TableFunction.java
chaudum/crate
ad4a35126e4e09dc372edd1c8c97bf589cef96ca
[ "Apache-2.0" ]
null
null
null
30.571429
72
0.695794
1,001,376
/* * Licensed to Crate under one or more contributor license agreements. * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. Crate licenses this file * to you under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may * obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. * * However, if you have executed another commercial license agreement * with Crate these terms will supersede the license and you may use the * software solely pursuant to the terms of the relevant commercial * agreement. */ package io.crate.sql.tree; import com.google.common.base.MoreObjects; import java.util.Objects; public class TableFunction extends QueryBody { private final FunctionCall functionCall; public TableFunction(FunctionCall functionCall) { this.functionCall = functionCall; } public String name() { return functionCall.getName().toString(); } public FunctionCall functionCall() { return functionCall; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TableFunction that = (TableFunction) o; return Objects.equals(functionCall, that.functionCall); } @Override public int hashCode() { return Objects.hash(functionCall); } @Override public String toString() { return MoreObjects.toStringHelper(this) .add("functionCall", functionCall) .toString(); } @Override public <R, C> R accept(AstVisitor<R, C> visitor, C context) { return visitor.visitTableFunction(this, context); } }
924007abdfbd9b279bf38b7946ec6c40c4eda80c
196
java
Java
src/test/java/com/labs/introtoprogramming/lab4/image/RGBImageTests.java
nikitavbv/ProgrammingAssignment4
cd5d7939077af66c3c8f5b8474f6d1f4b35e1f4b
[ "MIT" ]
null
null
null
src/test/java/com/labs/introtoprogramming/lab4/image/RGBImageTests.java
nikitavbv/ProgrammingAssignment4
cd5d7939077af66c3c8f5b8474f6d1f4b35e1f4b
[ "MIT" ]
13
2019-04-18T06:22:20.000Z
2019-05-25T13:52:19.000Z
src/test/java/com/labs/introtoprogramming/lab4/image/RGBImageTests.java
nikitavbv/ProgrammingAssignment4
cd5d7939077af66c3c8f5b8474f6d1f4b35e1f4b
[ "MIT" ]
null
null
null
15.076923
47
0.709184
1,001,377
package com.labs.introtoprogramming.lab4.image; import org.junit.Test; public class RGBImageTests { @Test public void testInstantiation() { new RGBImage(0, 0, null, null, null); } }
9240080d3ef7cd081c8d2f125760c3cb5a89659f
262
java
Java
src/main/java/org/academiadecodigo/onegitwonders/dto/AvatarDto.java
nunosilva4/hackathones
d96f5dbf6dd2ae1439d5b34b1b86a0ea9f2f544e
[ "BSD-Source-Code" ]
null
null
null
src/main/java/org/academiadecodigo/onegitwonders/dto/AvatarDto.java
nunosilva4/hackathones
d96f5dbf6dd2ae1439d5b34b1b86a0ea9f2f544e
[ "BSD-Source-Code" ]
null
null
null
src/main/java/org/academiadecodigo/onegitwonders/dto/AvatarDto.java
nunosilva4/hackathones
d96f5dbf6dd2ae1439d5b34b1b86a0ea9f2f544e
[ "BSD-Source-Code" ]
null
null
null
15.411765
47
0.667939
1,001,378
package org.academiadecodigo.onegitwonders.dto; public class AvatarDto { private String imageUrl; public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } }
924008629a6b815cdd41139a7c21c71caaf96b4c
514
java
Java
state-interface-robustness-testing/src/main/java/robtest/stateinterfw/FaultMutatorFilter.java
wafec/testing-framework
3d7c8301b5fe5153a33b911a69638902fed70043
[ "Apache-2.0" ]
null
null
null
state-interface-robustness-testing/src/main/java/robtest/stateinterfw/FaultMutatorFilter.java
wafec/testing-framework
3d7c8301b5fe5153a33b911a69638902fed70043
[ "Apache-2.0" ]
null
null
null
state-interface-robustness-testing/src/main/java/robtest/stateinterfw/FaultMutatorFilter.java
wafec/testing-framework
3d7c8301b5fe5153a33b911a69638902fed70043
[ "Apache-2.0" ]
null
null
null
30.235294
101
0.789883
1,001,379
package robtest.stateinterfw; import com.google.inject.Inject; public class FaultMutatorFilter implements IFaultMutatorFilter { private IMutatorMessageUtils _mutatorMessageUtils; public FaultMutatorFilter(IMutatorMessageUtils mutatorMessageUtils) { _mutatorMessageUtils = mutatorMessageUtils; } @Override public boolean canApply(IMutator mutator, String targetDataType) { return mutator.getCategory().equals(_mutatorMessageUtils.dataTypeToCategory(targetDataType)); } }
92400ab8b20e45f9a9e1e7851dde80a860038bb7
56,511
java
Java
nuxeo-features/nuxeo-platform-rendition/nuxeo-platform-rendition-core/src/test/java/org/nuxeo/ecm/platform/rendition/service/TestRenditionService.java
sampisamuel/nuxeo
7ec7c164e508223eef05bb198066920399440efe
[ "Apache-2.0" ]
1
2021-02-15T19:07:59.000Z
2021-02-15T19:07:59.000Z
nuxeo-features/nuxeo-platform-rendition/nuxeo-platform-rendition-core/src/test/java/org/nuxeo/ecm/platform/rendition/service/TestRenditionService.java
sampisamuel/nuxeo
7ec7c164e508223eef05bb198066920399440efe
[ "Apache-2.0" ]
null
null
null
nuxeo-features/nuxeo-platform-rendition/nuxeo-platform-rendition-core/src/test/java/org/nuxeo/ecm/platform/rendition/service/TestRenditionService.java
sampisamuel/nuxeo
7ec7c164e508223eef05bb198066920399440efe
[ "Apache-2.0" ]
null
null
null
45.280449
134
0.681596
1,001,380
/* * (C) Copyright 2010-2017 Nuxeo (http://nuxeo.com/) and 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. * * Contributors: * Nuxeo - initial API and implementation */ package org.nuxeo.ecm.platform.rendition.service; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.nuxeo.ecm.platform.rendition.Constants.FILES_FILES_PROPERTY; import static org.nuxeo.ecm.platform.rendition.Constants.RENDITION_FACET; import static org.nuxeo.ecm.platform.rendition.Constants.RENDITION_SOURCE_ID_PROPERTY; import static org.nuxeo.ecm.platform.rendition.Constants.RENDITION_SOURCE_VERSIONABLE_ID_PROPERTY; import java.io.IOException; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Collections; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.CyclicBarrier; import java.util.stream.Collectors; import java.util.zip.ZipInputStream; import javax.inject.Inject; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Test; import org.junit.runner.RunWith; import org.nuxeo.ecm.core.api.Blob; import org.nuxeo.ecm.core.api.Blobs; import org.nuxeo.ecm.core.api.CloseableCoreSession; import org.nuxeo.ecm.core.api.CoreInstance; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentRef; import org.nuxeo.ecm.core.api.DocumentSecurityException; import org.nuxeo.ecm.core.api.IdRef; import org.nuxeo.ecm.core.api.LifeCycleException; import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.NuxeoPrincipal; import org.nuxeo.ecm.core.api.VersionModel; import org.nuxeo.ecm.core.api.VersioningOption; import org.nuxeo.ecm.core.api.blobholder.BlobHolder; import org.nuxeo.ecm.core.api.impl.VersionModelImpl; import org.nuxeo.ecm.core.api.security.ACE; import org.nuxeo.ecm.core.api.security.ACL; import org.nuxeo.ecm.core.api.security.ACP; import org.nuxeo.ecm.core.api.security.SecurityConstants; import org.nuxeo.ecm.core.api.security.impl.ACLImpl; import org.nuxeo.ecm.core.api.security.impl.ACPImpl; import org.nuxeo.ecm.core.api.versioning.VersioningService; import org.nuxeo.ecm.core.event.EventService; import org.nuxeo.ecm.core.schema.FacetNames; import org.nuxeo.ecm.core.schema.SchemaManager; import org.nuxeo.ecm.core.test.CoreFeature; import org.nuxeo.ecm.core.test.StorageConfiguration; import org.nuxeo.ecm.core.work.api.Work; import org.nuxeo.ecm.core.work.api.WorkManager; import org.nuxeo.ecm.platform.rendition.Rendition; import org.nuxeo.ecm.platform.rendition.extension.RenditionProvider; import org.nuxeo.ecm.platform.rendition.impl.LazyRendition; import org.nuxeo.ecm.platform.rendition.lazy.AbstractRenditionBuilderWork; import org.nuxeo.ecm.platform.usermanager.UserManager; import org.nuxeo.runtime.api.Framework; import org.nuxeo.runtime.test.runner.ConditionalIgnoreRule; import org.nuxeo.runtime.test.runner.Deploy; import org.nuxeo.runtime.test.runner.Features; import org.nuxeo.runtime.test.runner.FeaturesRunner; import org.nuxeo.runtime.test.runner.HotDeployer; import org.nuxeo.runtime.test.runner.TransactionalFeature; import org.nuxeo.runtime.transaction.TransactionHelper; /** * @author <a href="mailto:[email protected]">Thomas Roger</a> */ @RunWith(FeaturesRunner.class) @Features(RenditionFeature.class) @Deploy("org.nuxeo.ecm.platform.rendition.core:test-rendition-contrib.xml") @Deploy("org.nuxeo.ecm.platform.rendition.core:test-lazy-rendition-contrib.xml") public class TestRenditionService { public static final String RENDITION_CORE = "org.nuxeo.ecm.platform.rendition.core"; private static final String RENDITION_FILTERS_COMPONENT_LOCATION = "test-rendition-filters-contrib.xml"; private static final String RENDITION_DEFINITION_PROVIDERS_COMPONENT_LOCATION = "test-rendition-definition-providers-contrib.xml"; private static final String RENDITION_WORKMANAGER_COMPONENT_LOCATION = "test-rendition-multithreads-workmanager-contrib.xml"; public static final String PDF_RENDITION_DEFINITION = "pdf"; public static final String ZIP_TREE_EXPORT_RENDITION_DEFINITION = "zipTreeExport"; public static CyclicBarrier[] CYCLIC_BARRIERS = new CyclicBarrier[] { new CyclicBarrier(2), new CyclicBarrier(2), new CyclicBarrier(2) }; public static final String CYCLIC_BARRIER_DESCRIPTION = "cyclicBarrierDesc"; public static final Log log = LogFactory.getLog(TestRenditionService.class); @Inject protected HotDeployer deployer; @Inject protected CoreFeature coreFeature; @Inject protected CoreSession session; @Inject protected EventService eventService; @Inject protected WorkManager works; @Inject protected RenditionService renditionService; @Test public void serviceRegistration() { assertNotNull(renditionService); } @Test public void testDeclaredRenditionDefinitions() { List<RenditionDefinition> renditionDefinitions = renditionService.getDeclaredRenditionDefinitions(); assertRenditionDefinitions(renditionDefinitions, PDF_RENDITION_DEFINITION, "renditionDefinitionWithUnknownOperationChain", "zipExport", "zipTreeExport", "zipTreeExportLazily", "containerDefaultRendition"); RenditionDefinition rd = renditionDefinitions.stream() .filter(renditionDefinition -> PDF_RENDITION_DEFINITION.equals( renditionDefinition.getName())) .findFirst() .get(); assertNotNull(rd); assertEquals(PDF_RENDITION_DEFINITION, rd.getName()); assertEquals("blobToPDF", rd.getOperationChain()); assertEquals("label.rendition.pdf", rd.getLabel()); assertTrue(rd.isEnabled()); rd = renditionDefinitions.stream() .filter(renditionDefinition -> "renditionDefinitionWithCustomOperationChain".equals( renditionDefinition.getName())) .findFirst() .get(); assertNotNull(rd); assertEquals("renditionDefinitionWithCustomOperationChain", rd.getName()); assertEquals("Dummy", rd.getOperationChain()); } @Test public void testAvailableRenditionDefinitions() { DocumentModel file = session.createDocumentModel("/", "file", "File"); file.setPropertyValue("dc:title", "TestFile"); file = session.createDocument(file); List<RenditionDefinition> renditionDefinitions = renditionService.getAvailableRenditionDefinitions(file); int availableRenditionDefinitionCount = renditionDefinitions.size(); assertTrue(availableRenditionDefinitionCount > 0); // add a blob Blob blob = Blobs.createBlob("I am a Blob"); file.setPropertyValue("file:content", (Serializable) blob); file = session.saveDocument(file); // rendition should be available now renditionDefinitions = renditionService.getAvailableRenditionDefinitions(file); assertEquals(availableRenditionDefinitionCount + 1, renditionDefinitions.size()); } @Test @ConditionalIgnoreRule.Ignore(condition = ConditionalIgnoreRule.IgnoreWindows.class, cause = "NXP-26757") public void doPDFRendition() { DocumentModel file = createBlobFile(); DocumentRef renditionDocumentRef = renditionService.storeRendition(file, PDF_RENDITION_DEFINITION); DocumentModel renditionDocument = session.getDocument(renditionDocumentRef); assertNotNull(renditionDocument); assertTrue(renditionDocument.hasFacet(RENDITION_FACET)); assertEquals(file.getId(), renditionDocument.getPropertyValue(RENDITION_SOURCE_VERSIONABLE_ID_PROPERTY)); DocumentModel lastVersion = session.getLastDocumentVersion(file.getRef()); assertEquals(lastVersion.getId(), renditionDocument.getPropertyValue(RENDITION_SOURCE_ID_PROPERTY)); BlobHolder bh = renditionDocument.getAdapter(BlobHolder.class); Blob renditionBlob = bh.getBlob(); assertNotNull(renditionBlob); assertEquals("application/pdf", renditionBlob.getMimeType()); assertEquals("dummy.pdf", renditionBlob.getFilename()); // now refetch the rendition Rendition rendition = renditionService.getRendition(file, PDF_RENDITION_DEFINITION); assertNotNull(rendition); assertTrue(rendition.isStored()); assertEquals(renditionDocument.getRef(), rendition.getHostDocument().getRef()); assertEquals("/icons/pdf.png", renditionDocument.getPropertyValue("common:icon")); // now update the document file.setPropertyValue("dc:description", "I have been updated"); file = session.saveDocument(file); rendition = renditionService.getRendition(file, PDF_RENDITION_DEFINITION); assertNotNull(rendition); assertFalse(rendition.isStored()); } @Test @ConditionalIgnoreRule.Ignore(condition = ConditionalIgnoreRule.IgnoreWindows.class, cause = "NXP-26757") public void doRenditionVersioning() { DocumentModel file = createBlobFile(); assertEquals("project", file.getCurrentLifeCycleState()); file.followTransition("approve"); assertEquals("approved", file.getCurrentLifeCycleState()); // create a version of the document file.putContextData(VersioningService.VERSIONING_OPTION, VersioningOption.MINOR); file = session.saveDocument(file); session.save(); eventService.waitForAsyncCompletion(); assertEquals("0.1", file.getVersionLabel()); // make a rendition on the document DocumentRef renditionDocumentRef = renditionService.storeRendition(file, PDF_RENDITION_DEFINITION); DocumentModel renditionDocument = session.getDocument(renditionDocumentRef); assertNotNull(renditionDocument); assertEquals(file.getId(), renditionDocument.getPropertyValue(RENDITION_SOURCE_VERSIONABLE_ID_PROPERTY)); DocumentModel lastVersion = session.getLastDocumentVersion(file.getRef()); assertEquals(lastVersion.getId(), renditionDocument.getPropertyValue(RENDITION_SOURCE_ID_PROPERTY)); // check that the redition is a version assertTrue(renditionDocument.isVersion()); // check same life-cycle state assertEquals(file.getCurrentLifeCycleState(), renditionDocument.getCurrentLifeCycleState()); // check that version label of the rendition is the same as the source assertEquals(file.getVersionLabel(), renditionDocument.getVersionLabel()); // fetch the rendition to check we have the same DocumentModel Rendition rendition = renditionService.getRendition(file, PDF_RENDITION_DEFINITION); assertNotNull(rendition); assertTrue(rendition.isStored()); assertEquals(renditionDocument.getRef(), rendition.getHostDocument().getRef()); // update the source Document file.setPropertyValue("dc:description", "I have been updated"); file = session.saveDocument(file); assertEquals("0.1+", file.getVersionLabel()); // get the rendition from checkedout doc rendition = renditionService.getRendition(file, PDF_RENDITION_DEFINITION); assertNotNull(rendition); // rendition should be live assertFalse(rendition.isStored()); // Live Rendition should point to the live doc assertEquals(file.getRef(), rendition.getHostDocument().getRef()); // needed for MySQL otherwise version order could be random coreFeature.getStorageConfiguration().maybeSleepToNextSecond(); // now store rendition for version 0.2 rendition = renditionService.getRendition(file, PDF_RENDITION_DEFINITION, true); assertEquals("0.2", rendition.getHostDocument().getVersionLabel()); assertTrue(rendition.isStored()); assertTrue(rendition.getHostDocument().isVersion()); System.out.println(rendition.getHostDocument().getACP()); // check that version 0.2 of file was created List<DocumentModel> versions = session.getVersions(file.getRef()); assertEquals(2, versions.size()); // check retrieval Rendition rendition2 = renditionService.getRendition(file, PDF_RENDITION_DEFINITION, false); assertTrue(rendition2.isStored()); assertEquals(rendition.getHostDocument().getRef(), rendition2.getHostDocument().getRef()); // update the source Document file.setPropertyValue("dc:description", "I have been updated again"); file = session.saveDocument(file); assertEquals("0.2+", file.getVersionLabel()); // needed for MySQL otherwise version order could be random coreFeature.getStorageConfiguration().maybeSleepToNextSecond(); // now store rendition for version 0.3 rendition = renditionService.getRendition(file, PDF_RENDITION_DEFINITION, true); assertEquals("0.3", rendition.getHostDocument().getVersionLabel()); assertTrue(rendition.isStored()); assertTrue(rendition.getHostDocument().isVersion()); // update the source Document file.setPropertyValue("dc:description", "I have been updated yet again"); file = session.saveDocument(file); assertEquals("0.3+", file.getVersionLabel()); // create a version of the document file.putContextData(VersioningService.VERSIONING_OPTION, VersioningOption.MINOR); file = session.saveDocument(file); session.save(); eventService.waitForAsyncCompletion(); assertEquals("0.4", file.getVersionLabel()); // update the source Document file.setPropertyValue("dc:description", "I have been updated a very last time"); file = session.saveDocument(file); assertEquals("0.4+", file.getVersionLabel()); // check that source doc is referenced in rendered version. VersionModel versionModel = new VersionModelImpl(); versionModel.setLabel("0.4"); rendition = renditionService.getRendition(session.getVersion(file.getId(), versionModel), PDF_RENDITION_DEFINITION, true); assertEquals(file.getId(), rendition.getHostDocument().getPropertyValue(RENDITION_SOURCE_VERSIONABLE_ID_PROPERTY)); } @Test public void doErrorRendition() { DocumentModel file = createBlobFile(); session.save(); nextTransaction(); String renditionName = "delayedErrorAutomationRendition"; Rendition rendition = renditionService.getRendition(file, renditionName); assertNotNull(rendition); try { rendition.getBlob(); fail(); } catch (NuxeoException e) { assertTrue(e.getMessage(), e.getMessage().contains("DelayedError")); } } @Test public void doErrorLazyRendition() { DocumentModel file = createBlobFile(); Calendar issued = new GregorianCalendar(2010, Calendar.OCTOBER, 10, 10, 10, 10); file.setPropertyValue("dc:issued", (Serializable) issued.clone()); session.saveDocument(file); session.save(); nextTransaction(); String renditionName = "lazyDelayedErrorAutomationRendition"; // Check rendition in error checkLazyRendition(file, renditionName, false, "text/plain;empty=true"); checkLazyRendition(file, renditionName, false, "text/plain;error=true"); checkLazyRendition(file, renditionName, false, "text/plain;empty=true"); issued.add(Calendar.SECOND, 10); file.setPropertyValue("dc:issued", (Serializable) issued.clone()); session.saveDocument(file); session.save(); nextTransaction(); // Check rendition in error and stale checkLazyRendition(file, renditionName, true, "text/plain;error=true;stale=true"); checkLazyRendition(file, renditionName, true, "text/plain;error=true"); checkLazyRendition(file, renditionName, true, "text/plain;empty=true"); } protected void checkLazyRendition(DocumentModel doc, String renditionName, boolean store, String expectedMimeType) { Rendition rendition = renditionService.getRendition(doc, renditionName, store); assertNotNull(rendition); Blob blob = rendition.getBlob(); assertEquals(0, blob.getLength()); String mimeType = blob.getMimeType(); assertEquals(expectedMimeType, mimeType); nextTransaction(); } @Test public void doZipTreeExportRendition() throws Exception { doZipTreeExportRendition(false); } @Test public void doZipTreeExportLazyRendition() throws Exception { doZipTreeExportRendition(true); } protected void doZipTreeExportRendition(boolean isLazy) throws Exception { DocumentModel folder = createFolderWithChildren(); String renditionName = ZIP_TREE_EXPORT_RENDITION_DEFINITION; if (isLazy) { renditionName += "Lazily"; } Rendition rendition = getRendition(folder, renditionName, true, isLazy, false); assertTrue(rendition.isStored()); assertTrue(rendition.isCompleted()); assertEquals(rendition.getHostDocument().getPropertyValue("dc:modified"), rendition.getModificationDate()); DocumentModel renditionDocument = session.getDocument(rendition.getHostDocument().getRef()); assertTrue(renditionDocument.hasFacet(RENDITION_FACET)); assertNull(renditionDocument.getPropertyValue(RENDITION_SOURCE_VERSIONABLE_ID_PROPERTY)); assertEquals(folder.getId(), renditionDocument.getPropertyValue(RENDITION_SOURCE_ID_PROPERTY)); BlobHolder bh = renditionDocument.getAdapter(BlobHolder.class); Blob renditionBlob = bh.getBlob(); assertNotNull(renditionBlob); assertEquals("application/zip", renditionBlob.getMimeType()); assertEquals("export.zip", renditionBlob.getFilename()); // now refetch the rendition rendition = renditionService.getRendition(folder, renditionName); assertNotNull(rendition); assertTrue(rendition.isStored()); assertEquals(renditionDocument.getRef(), rendition.getHostDocument().getRef()); assertEquals("/icons/zip.png", renditionDocument.getPropertyValue("common:icon")); // now get a different rendition as a different user NuxeoPrincipal totoPrincipal = Framework.getService(UserManager.class).getPrincipal("toto"); try (CloseableCoreSession userSession = coreFeature.openCoreSession(totoPrincipal)) { folder = userSession.getDocument(folder.getRef()); Rendition totoRendition = getRendition(folder, renditionName, true, isLazy, false); assertTrue(totoRendition.isStored()); assertNotEquals(renditionDocument.getRef(), totoRendition.getHostDocument().getRef()); // verify Administrator's rendition is larger than user's rendition assertNotEquals(rendition.getHostDocument().getRef(), totoRendition.getHostDocument().getRef()); long adminZipEntryCount = countZipEntries(new ZipInputStream(rendition.getBlob().getStream())); long totoZipEntryCount = countZipEntries(new ZipInputStream(totoRendition.getBlob().getStream())); assertTrue( String.format("Admin rendition entry count %s should be greater than user rendition entry count %s", adminZipEntryCount, totoZipEntryCount), adminZipEntryCount > totoZipEntryCount); } coreFeature.getStorageConfiguration().maybeSleepToNextSecond(); // now "update" the folder folder = session.getDocument(folder.getRef()); folder.setPropertyValue("dc:description", "I have been updated"); folder = session.saveDocument(folder); session.save(); nextTransaction(); // expect a stale rendition folder = session.getDocument(folder.getRef()); rendition = getRendition(folder, renditionName, false, isLazy, true); assertFalse(rendition.isStored()); assertTrue(rendition.isCompleted()); Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(rendition.getBlob().getFile().lastModified()); assertEquals(cal, rendition.getModificationDate()); if (isLazy) { rendition = renditionService.getRendition(folder, renditionName, false); assertEquals(cal, rendition.getModificationDate()); } } protected Rendition getRendition(DocumentModel doc, String renditionName, boolean store, boolean isLazy, boolean stale) { Rendition rendition = renditionService.getRendition(doc, renditionName, store); assertNotNull(rendition); if (isLazy) { assertFalse(rendition.isStored()); Blob blob = rendition.getBlob(); if (stale) { assertTrue(rendition.isCompleted()); assertNotNull(rendition.getModificationDate()); assertFalse(blob.getMimeType().contains("empty=true")); assertTrue(blob.getMimeType().contains("stale=true")); assertNotEquals(LazyRendition.IN_PROGRESS_MARKER, blob.getFilename()); assertTrue(blob.getLength() > 0); } else { assertFalse(rendition.isCompleted()); assertNull(rendition.getModificationDate()); assertTrue(blob.getMimeType().contains("empty=true")); assertFalse(blob.getMimeType().contains("stale=true")); assertEquals(LazyRendition.IN_PROGRESS_MARKER, blob.getFilename()); assertEquals(0, blob.getLength()); } try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } eventService.waitForAsyncCompletion(5000); rendition = renditionService.getRendition(doc, renditionName, store); } return rendition; } protected DocumentModel createBlobFile() { Blob blob = createTextBlob("Dummy text", "dummy.txt"); DocumentModel file = createDocumentWithBlob("/", blob, "dummy-file", "File"); assertNotNull(file); return file; } protected DocumentModel createDocumentWithBlob(String parentPath, Blob blob, String name, String typeName) { DocumentModel doc = session.createDocumentModel(parentPath, name, typeName); BlobHolder bh = doc.getAdapter(BlobHolder.class); bh.setBlob(blob); doc = session.createDocument(doc); return doc; } protected Blob createTextBlob(String content, String filename) { Blob blob = Blobs.createBlob(content); blob.setFilename(filename); return blob; } protected DocumentModel createFolderWithChildren() { DocumentModel root = session.getRootDocument(); ACP acp = session.getACP(root.getRef()); ACL existingACL = acp.getOrCreateACL(); existingACL.clear(); existingACL.add(new ACE("Administrator", SecurityConstants.EVERYTHING, true)); existingACL.add(new ACE("group_1", SecurityConstants.READ, true)); acp.addACL(existingACL); session.setACP(root.getRef(), acp, true); DocumentModel folder = session.createDocumentModel(root.getPathAsString(), "dummy", "Folder"); folder = session.createDocument(folder); session.save(); for (int i = 1; i <= 2; i++) { String childFolderName = "childFolder" + i; DocumentModel childFolder = session.createDocumentModel(folder.getPathAsString(), childFolderName, "Folder"); childFolder = session.createDocument(childFolder); if (i == 1) { acp = new ACPImpl(); ACL acl = new ACLImpl(); acl.add(new ACE("Administrator", SecurityConstants.EVERYTHING, true)); acl.add(ACE.BLOCK); acp.addACL(acl); childFolder.setACP(acp, true); session.save(); } createDocumentWithBlob(childFolder.getPathAsString(), createTextBlob("Dummy1 text", "dummy1.txt"), "dummy1-file", "File"); createDocumentWithBlob(childFolder.getPathAsString(), createTextBlob("Dummy2 text", "dummy2.txt"), "dummy2-file", "File"); } session.save(); TransactionHelper.commitOrRollbackTransaction(); eventService.waitForAsyncCompletion(); TransactionHelper.startTransaction(); folder = session.getDocument(folder.getRef()); return folder; } @Test public void shouldPreventAdminFromReusingOthersNonVersionedStoredRendition() throws Exception { DocumentModel folder = createFolderWithChildren(); String renditionName = ZIP_TREE_EXPORT_RENDITION_DEFINITION; Rendition totoRendition; // get rendition as non-admin user 'toto' NuxeoPrincipal totoPrincipal = Framework.getService(UserManager.class).getPrincipal("toto"); try (CloseableCoreSession userSession = coreFeature.openCoreSession(totoPrincipal)) { folder = userSession.getDocument(folder.getRef()); totoRendition = renditionService.getRendition(folder, renditionName, true); assertTrue(totoRendition.isStored()); } nextTransaction(); eventService.waitForAsyncCompletion(); coreFeature.getStorageConfiguration().maybeSleepToNextSecond(); // now get rendition as admin user 'Administrator' folder = session.getDocument(folder.getRef()); Rendition rendition = renditionService.getRendition(folder, renditionName, true); assertTrue(rendition.isStored()); assertTrue(rendition.isCompleted()); // verify Administrator's rendition is different from user's rendition, is larger than user's rendition, // and was created later assertNotEquals(rendition.getHostDocument().getRef(), totoRendition.getHostDocument().getRef()); long adminZipEntryCount = countZipEntries(new ZipInputStream(rendition.getBlob().getStream())); long totoZipEntryCount = countZipEntries(new ZipInputStream(totoRendition.getBlob().getStream())); assertTrue(String.format("Admin rendition entry count %s should be greater than user rendition entry count %s", adminZipEntryCount, totoZipEntryCount), adminZipEntryCount > totoZipEntryCount); Calendar adminModificationDate = rendition.getModificationDate(); Calendar totoModificationDate = totoRendition.getModificationDate(); assertTrue( String.format("Admin rendition modif date %s should be after user rendition modif date %s", adminModificationDate.toInstant(), totoModificationDate.toInstant()), adminModificationDate.after(totoModificationDate)); } private long countZipEntries(ZipInputStream zis) throws IOException { int entryCount = 0; while (zis.getNextEntry() != null) { entryCount++; } return entryCount; } @Test @ConditionalIgnoreRule.Ignore(condition = ConditionalIgnoreRule.IgnoreWindows.class, cause = "NXP-26757") public void testRenderAProxyDocument() throws IOException { DocumentModel file = createBlobFile(); DocumentRef fileRef = file.getRef(); // render a live document (reference) Rendition rendition = renditionService.getRendition(file, PDF_RENDITION_DEFINITION); String expectedRenditionContent = rendition.getBlob().getString(); // render a proxy to a live document, lazy rendition DocumentRef rootRef = session.getRootDocument().getRef(); DocumentModel proxy = session.createProxy(fileRef, rootRef); rendition = renditionService.getRendition(proxy, PDF_RENDITION_DEFINITION); DocumentModel hostDocument = rendition.getHostDocument(); assertTrue(hostDocument.isProxy()); assertFalse(hostDocument.isVersion()); assertEquals(rootRef, hostDocument.getParentRef()); assertEquals(expectedRenditionContent, rendition.getBlob().getString()); // render a proxy to a live document, stored rendition rendition = renditionService.getRendition(proxy, PDF_RENDITION_DEFINITION, true); hostDocument = rendition.getHostDocument(); assertFalse(hostDocument.isProxy()); assertTrue(hostDocument.isVersion()); assertNull(hostDocument.getParentRef()); // placeless assertEquals(expectedRenditionContent, rendition.getBlob().getString()); // render a proxy to a version, lazy rendition session.checkOut(fileRef); session.checkIn(fileRef, null, null); DocumentModel version = session.getLastDocumentVersion(fileRef); proxy = session.createProxy(version.getRef(), rootRef); rendition = renditionService.getRendition(proxy, PDF_RENDITION_DEFINITION); hostDocument = rendition.getHostDocument(); assertTrue(hostDocument.isProxy()); assertFalse(hostDocument.isVersion()); assertEquals(rootRef, hostDocument.getParentRef()); assertEquals(expectedRenditionContent, rendition.getBlob().getString()); // render a proxy to a version, stored rendition rendition = renditionService.getRendition(proxy, PDF_RENDITION_DEFINITION, true); hostDocument = rendition.getHostDocument(); assertFalse(hostDocument.isProxy()); assertTrue(hostDocument.isVersion()); assertNull(hostDocument.getParentRef()); // placeless assertEquals(expectedRenditionContent, rendition.getBlob().getString()); } @Test @ConditionalIgnoreRule.Ignore(condition = ConditionalIgnoreRule.IgnoreWindows.class, cause = "NXP-26757") public void shouldNotCreateANewVersionForACheckedInDocument() { DocumentModel file = createBlobFile(); DocumentRef versionRef = file.checkIn(VersioningOption.MINOR, null); file.refresh(DocumentModel.REFRESH_STATE, null); DocumentModel version = session.getDocument(versionRef); DocumentRef renditionDocumentRef = renditionService.storeRendition(version, "pdf"); DocumentModel renditionDocument = session.getDocument(renditionDocumentRef); assertEquals(version.getId(), renditionDocument.getPropertyValue(RENDITION_SOURCE_ID_PROPERTY)); List<DocumentModel> versions = session.getVersions(file.getRef()); assertFalse(versions.isEmpty()); assertEquals(1, versions.size()); DocumentModel lastVersion = session.getLastDocumentVersion(file.getRef()); assertEquals(version.getRef(), lastVersion.getRef()); } @Test public void shouldNotRenderAnEmptyDocument() { DocumentModel file = session.createDocumentModel("/", "dummy", "File"); file = session.createDocument(file); try { renditionService.storeRendition(file, PDF_RENDITION_DEFINITION); fail(); } catch (NuxeoException e) { assertTrue(e.getMessage(), e.getMessage().startsWith("Rendition pdf not available")); } } @Test public void shouldNotRenderWithAnUndefinedRenditionDefinition() { DocumentModel file = session.createDocumentModel("/", "dummy", "File"); file = session.createDocument(file); try { renditionService.storeRendition(file, "undefinedRenditionDefinition"); fail(); } catch (NuxeoException e) { assertEquals("The rendition definition 'undefinedRenditionDefinition' is not registered", e.getMessage()); } } @Test public void shouldNotRenderWithAnUndefinedOperationChain() { DocumentModel file = session.createDocumentModel("/", "dummy", "File"); file = session.createDocument(file); try { renditionService.storeRendition(file, "renditionDefinitionWithUnknownOperationChain"); fail(); } catch (NuxeoException e) { assertTrue(e.getMessage(), e.getMessage().startsWith("Rendition renditionDefinitionWithUnknownOperationChain not available")); } } @Test public void shouldRenderOnFolder() throws Exception { DocumentModel folder = session.createDocumentModel("/", "dummy", "Folder"); folder = session.createDocument(folder); Rendition rendition = renditionService.getRendition(folder, "renditionDefinitionWithCustomOperationChain"); assertNotNull(rendition); assertNotNull(rendition.getBlob()); assertEquals("dummy", rendition.getBlob().getString()); } @Test @SuppressWarnings("unchecked") @ConditionalIgnoreRule.Ignore(condition = ConditionalIgnoreRule.IgnoreWindows.class, cause = "NXP-26757") public void shouldRemoveFilesBlobsOnARendition() { DocumentModel fileDocument = createBlobFile(); Blob firstAttachedBlob = createTextBlob("first attached blob", "first"); Blob secondAttachedBlob = createTextBlob("second attached blob", "second"); List<Map<String, Serializable>> files = new ArrayList<>(); Map<String, Serializable> file = new HashMap<>(); file.put("file", (Serializable) firstAttachedBlob); files.add(file); file = new HashMap<>(); file.put("file", (Serializable) secondAttachedBlob); files.add(file); fileDocument.setPropertyValue(FILES_FILES_PROPERTY, (Serializable) files); DocumentRef renditionDocumentRef = renditionService.storeRendition(fileDocument, PDF_RENDITION_DEFINITION); DocumentModel renditionDocument = session.getDocument(renditionDocumentRef); BlobHolder bh = renditionDocument.getAdapter(BlobHolder.class); Blob renditionBlob = bh.getBlob(); assertNotNull(renditionBlob); assertEquals("application/pdf", renditionBlob.getMimeType()); List<Map<String, Serializable>> renditionFiles = (List<Map<String, Serializable>>) renditionDocument.getPropertyValue( FILES_FILES_PROPERTY); assertTrue(renditionFiles.isEmpty()); } @Test public void shouldNotRenderANonFolderishDocumentWithoutBlobHolder() { DocumentModel folder = session.createDocumentModel("/", "dummy-folder", "Folder"); folder = session.createDocument(folder); try { renditionService.storeRendition(folder, PDF_RENDITION_DEFINITION); fail(); } catch (NuxeoException e) { assertTrue(e.getMessage(), e.getMessage().startsWith("Rendition pdf not available")); } } @Test public void shouldRenderFolderishDocumentAsAFile() { SchemaManager schemaManager = Framework.getService(SchemaManager.class); Set<String> docTypeNames = schemaManager.getDocumentTypeNamesForFacet(FacetNames.FOLDERISH); for (String docTypeName : docTypeNames) { DocumentModel folder = session.createDocumentModel("/", "dummy-folder-" + docTypeName, docTypeName); folder = session.createDocument(folder); DocumentRef renditionDocRef; try { renditionDocRef = renditionService.storeRendition(folder, ZIP_TREE_EXPORT_RENDITION_DEFINITION); } catch (LifeCycleException ignored) { log.debug("Could not create stored rendition for doc type '" + docTypeName + "'"); continue; } DocumentModel renditionDocModel = session.getDocument(renditionDocRef); String renditionDocTypeName = renditionDocModel.getType(); assertEquals(String.format("Folderish with docType '%s' rendered as '%s' instead of 'File'", docTypeName, renditionDocTypeName), "File", renditionDocTypeName); } } @Test public void shouldNotStoreRenditionByDefault() { DocumentModel folder = createFolderWithChildren(); Rendition rendition = renditionService.getRendition(folder, ZIP_TREE_EXPORT_RENDITION_DEFINITION); assertNotNull(rendition); assertFalse(rendition.isStored()); } @Test public void shouldStoreRenditionByDefault() { DocumentModel folder = createFolderWithChildren(); String renditionName = ZIP_TREE_EXPORT_RENDITION_DEFINITION + "Lazily"; Rendition rendition = renditionService.getRendition(folder, renditionName); assertNotNull(rendition); assertFalse(rendition.isStored()); try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } eventService.waitForAsyncCompletion(5000); rendition = renditionService.getRendition(folder, renditionName); assertNotNull(rendition); assertTrue(rendition.isStored()); } @Test public void shouldStoreLatestNonVersionedRendition() throws Exception { deployer.deploy(RENDITION_CORE + ":" + RENDITION_WORKMANAGER_COMPONENT_LOCATION); final StorageConfiguration storageConfiguration = coreFeature.getStorageConfiguration(); final String repositoryName = session.getRepositoryName(); final String username = session.getPrincipal().getName(); final String renditionName = "renditionDefinitionWithCustomOperationChain"; final String sourceDocumentModificationDatePropertyName = "dc:issued"; DocumentModel folder = session.createDocumentModel("/", "dummy", "Folder"); folder.setPropertyValue(sourceDocumentModificationDatePropertyName, Calendar.getInstance()); folder = session.createDocument(folder); session.save(); nextTransaction(); eventService.waitForAsyncCompletion(); folder = session.getDocument(folder.getRef()); final String folderId = folder.getId(); RenditionThread t1 = new RenditionThread(storageConfiguration, repositoryName, username, folderId, renditionName, true); RenditionThread t2 = new RenditionThread(storageConfiguration, repositoryName, username, folderId, renditionName, false); t1.start(); t2.start(); // Sync #1 RenditionThread.cyclicBarrier.await(); // now "update" the folder description Calendar modificationDate = Calendar.getInstance(); String desc = "I have been updated"; folder = session.getDocument(folder.getRef()); folder.setPropertyValue("dc:description", desc); folder.setPropertyValue(sourceDocumentModificationDatePropertyName, modificationDate); folder = session.saveDocument(folder); session.save(); nextTransaction(); eventService.waitForAsyncCompletion(); // Sync #2 RenditionThread.cyclicBarrier.await(); // Sync #3 RenditionThread.cyclicBarrier.await(); t1.join(); t2.join(); nextTransaction(); eventService.waitForAsyncCompletion(); // get the "updated" folder rendition Rendition rendition = renditionService.getRendition(folder, renditionName, true); assertNotNull(rendition); assertTrue(rendition.isStored()); Calendar cal = rendition.getModificationDate(); assertTrue(!cal.before(modificationDate)); assertNotNull(rendition.getBlob()); assertTrue(rendition.getBlob().getString().contains(desc)); // verify the thread renditions List<Rendition> renditions = Arrays.asList(t1.getDetachedRendition(), t2.getDetachedRendition()); for (Rendition rend : renditions) { assertNotNull(rend); assertTrue(rend.isStored()); assertFalse(cal.before(rend.getModificationDate())); assertNotNull(rend.getBlob()); assertTrue(rendition.getBlob().getString().contains(desc)); } } protected static class RenditionThread extends Thread { public static final CyclicBarrier cyclicBarrier = new CyclicBarrier(3); private final StorageConfiguration storageConfiguration; private final String repositoryName; private final String username; private final String docId; private final String renditionName; private final boolean delayed; private Rendition detachedRendition; public RenditionThread(StorageConfiguration storageConfiguration, String repositoryName, String username, String docId, String renditionName, boolean delayed) { super(); this.storageConfiguration = storageConfiguration; this.repositoryName = repositoryName; this.username = username; this.docId = docId; this.renditionName = renditionName; this.delayed = delayed; } @Override public void run() { TransactionHelper.startTransaction(); try { try (CloseableCoreSession session = CoreInstance.openCoreSession(repositoryName, username)) { DocumentModel doc = session.getDocument(new IdRef(docId)); doc.putContextData("delayed", Boolean.valueOf(delayed)); RenditionService renditionService = Framework.getService(RenditionService.class); detachedRendition = renditionService.getRendition(doc, renditionName, true); } } catch (Exception e) { throw new RuntimeException(e); } finally { TransactionHelper.commitOrRollbackTransaction(); storageConfiguration.maybeSleepToNextSecond(); } if (!delayed) { try { // Not-Delayed Sync #3 RenditionThread.cyclicBarrier.await(); } catch (Exception e) { throw new RuntimeException(e); } } } public Rendition getDetachedRendition() { return detachedRendition; } } @Inject TransactionalFeature txFeature; protected void nextTransaction() { txFeature.nextTransaction(); } @Test public void shouldNotScheduleRedundantLazyRenditionBuilderWorks() throws Exception { final String renditionName = "lazyAutomation"; final String sourceDocumentModificationDatePropertyName = "dc:issued"; Calendar issued = new GregorianCalendar(2010, Calendar.OCTOBER, 10, 10, 10, 10); String desc = CYCLIC_BARRIER_DESCRIPTION; DocumentModel folder = session.createDocumentModel("/", "dummy", "Folder"); folder.setPropertyValue("dc:title", folder.getName()); folder.setPropertyValue("dc:description", desc); folder.setPropertyValue(sourceDocumentModificationDatePropertyName, (Serializable) issued.clone()); folder = session.createDocument(folder); session.save(); nextTransaction(); eventService.waitForAsyncCompletion(); for (int i = 0; i < 3; i++) { folder = session.getDocument(folder.getRef()); Rendition rendition = renditionService.getRendition(folder, renditionName, false); assertNotNull(rendition); assertTrue(rendition.getBlob().getMimeType().contains(LazyRendition.EMPTY_MARKER)); if (i == 0) { if (log.isDebugEnabled()) { log.debug(DummyDocToTxt.formatLogEntry(folder.getRef(), null, desc, issued) + " before barrier 0"); } CYCLIC_BARRIERS[0].await(); } assertEquals(issued, folder.getPropertyValue(sourceDocumentModificationDatePropertyName)); issued.add(Calendar.SECOND, 10); folder.setPropertyValue(sourceDocumentModificationDatePropertyName, (Serializable) issued.clone()); desc = "description" + Integer.toString(i); folder.setPropertyValue("dc:description", desc); session.saveDocument(folder); session.save(); if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } if (i == 0) { if (log.isDebugEnabled()) { log.debug(DummyDocToTxt.formatLogEntry(folder.getRef(), null, desc, issued) + " before barrier 1"); } CYCLIC_BARRIERS[1].await(); } } String queueId = works.getCategoryQueueId(AbstractRenditionBuilderWork.CATEGORY); assertEquals(1, works.listWorkIds(queueId, Work.State.RUNNING).size()); assertEquals(1, works.listWorkIds(queueId, Work.State.SCHEDULED).size()); if (log.isDebugEnabled()) { log.debug(DummyDocToTxt.formatLogEntry(folder.getRef(), null, desc, issued) + " before barrier 2"); } CYCLIC_BARRIERS[2].await(); eventService.waitForAsyncCompletion(5000); folder = session.getDocument(folder.getRef()); assertEquals(issued, folder.getPropertyValue(sourceDocumentModificationDatePropertyName)); for (int i = 0; i < 5; i++) { Rendition rendition = renditionService.getRendition(folder, renditionName, false); assertNotNull(rendition); assertNotNull(rendition.getBlob()); String mimeType = rendition.getBlob().getMimeType(); if (mimeType != null) { if (mimeType.contains(LazyRendition.EMPTY_MARKER)) { Thread.sleep(1000); eventService.waitForAsyncCompletion(5000); continue; } else if (mimeType.contains(LazyRendition.ERROR_MARKER)) { fail("Error generating rendition for folder"); } } String content = rendition.getBlob().getString(); assertNotNull(content); assertTrue(content.contains("dummy")); assertNotNull(desc); assertTrue(content.contains(desc)); return; } fail("Could not retrieve rendition for folder"); } @Test public void shouldFilterRenditionDefinitions() throws Exception { deployer.deploy(RENDITION_CORE + ":" + RENDITION_FILTERS_COMPONENT_LOCATION); List<RenditionDefinition> availableRenditionDefinitions; Rendition rendition; // ----- Note DocumentModel doc = session.createDocumentModel("/", "note", "Note"); doc = session.createDocument(doc); availableRenditionDefinitions = renditionService.getAvailableRenditionDefinitions(doc); assertRenditionDefinitions(availableRenditionDefinitions, "renditionOnlyForNote", "zipExport"); rendition = renditionService.getRendition(doc, "renditionOnlyForNote", false); assertNotNull(rendition); // others are filtered out try { rendition = renditionService.getRendition(doc, "renditionOnlyForFile", false); fail(); } catch (NuxeoException e) { assertTrue(e.getMessage(), e.getMessage().contains("Rendition renditionOnlyForFile cannot be used")); } // ----- File doc = session.createDocumentModel("/", "file", "File"); doc = session.createDocument(doc); availableRenditionDefinitions = renditionService.getAvailableRenditionDefinitions(doc); assertRenditionDefinitions(availableRenditionDefinitions, "renditionOnlyForFile", "zipExport"); doc.setPropertyValue("dc:rights", "Unauthorized"); session.saveDocument(doc); availableRenditionDefinitions = renditionService.getAvailableRenditionDefinitions(doc); // renditionOnlyForFile filtered out, unauthorized assertRenditionDefinitions(availableRenditionDefinitions, "zipExport"); // ----- Folder doc = session.createDocumentModel("/", "folder", "Folder"); doc = session.createDocument(doc); availableRenditionDefinitions = renditionService.getAvailableRenditionDefinitions(doc); assertRenditionDefinitions(availableRenditionDefinitions, "containerDefaultRendition", "renditionOnlyForFolder", "zipTreeExport", "zipTreeExportLazily"); } @Test public void shouldFilterRenditionDefinitionProviders() throws Exception { deployer.deploy(RENDITION_CORE + ":" + RENDITION_DEFINITION_PROVIDERS_COMPONENT_LOCATION); DocumentModel doc = session.createDocumentModel("/", "note", "Note"); doc = session.createDocument(doc); List<RenditionDefinition> availableRenditionDefinitions = renditionService.getAvailableRenditionDefinitions( doc); assertRenditionDefinitions(availableRenditionDefinitions, "dummyRendition1", "dummyRendition2", "zipExport"); doc = session.createDocumentModel("/", "file", "File"); doc = session.createDocument(doc); availableRenditionDefinitions = renditionService.getAvailableRenditionDefinitions(doc); assertRenditionDefinitions(availableRenditionDefinitions, "dummyRendition1", "dummyRendition2", "zipExport"); doc.setPropertyValue("dc:rights", "Unauthorized"); session.saveDocument(doc); availableRenditionDefinitions = renditionService.getAvailableRenditionDefinitions(doc); assertRenditionDefinitions(availableRenditionDefinitions, "zipExport"); doc = session.createDocumentModel("/", "folder", "Folder"); doc = session.createDocument(doc); availableRenditionDefinitions = renditionService.getAvailableRenditionDefinitions(doc); assertRenditionDefinitions(availableRenditionDefinitions, "containerDefaultRendition", "dummyRendition1", "dummyRendition2", "zipTreeExport", "zipTreeExportLazily"); } /** * @since 10.10 */ @Test public void testGetAvailableRenditionDefinitionByName() throws Exception { deployer.deploy(RENDITION_CORE + ":" + RENDITION_DEFINITION_PROVIDERS_COMPONENT_LOCATION); DocumentModel doc = session.createDocumentModel("/", "file", "File"); doc = session.createDocument(doc); // rendition definition not registered try { renditionService.getAvailableRenditionDefinition(doc, "unknown"); fail("Getting an unknown rendition definition should fail"); } catch (NuxeoException e) { assertEquals("The rendition definition 'unknown' is not registered", e.getMessage()); } // rendition definition registered directly RenditionDefinition renditionDefinition = renditionService.getAvailableRenditionDefinition(doc, "mainBlob"); assertNotNull(renditionDefinition); assertEquals("mainBlob", renditionDefinition.getName()); RenditionProvider renditionProvider = renditionDefinition.getProvider(); assertNotNull(renditionProvider); assertEquals("DefaultAutomationRenditionProvider", renditionProvider.getClass().getSimpleName()); // rendition definition registered through a rendition definition provider but not bound to any rendition // provider try { renditionService.getAvailableRenditionDefinition(doc, "dummyRendition1"); fail("Getting a rendition definition not bound to any rendition provider should fail"); } catch (NuxeoException e) { assertEquals("Rendition definition dummyRendition1 isn't bound to any rendition provider", e.getMessage()); } // rendition definition registered through a rendition definition provider and bound to a rendition provider renditionDefinition = renditionService.getAvailableRenditionDefinition(doc, "dummyRendition2"); assertNotNull(renditionDefinition); assertEquals("dummyRendition2", renditionDefinition.getName()); renditionProvider = renditionDefinition.getProvider(); assertNotNull(renditionProvider); assertEquals("DummyRenditionProvider", renditionProvider.getClass().getSimpleName()); } /** * @since 10.3 */ @Test @ConditionalIgnoreRule.Ignore(condition = ConditionalIgnoreRule.IgnoreWindows.class, cause = "NXP-26757") public void shouldNonAdminPublishRendition() { DocumentModel file = createBlobFile(); DocumentModel section = session.createDocumentModel("/", "section", "Section"); section = session.createDocument(section); ACP acp = new ACPImpl(); ACL acl = new ACLImpl(); acl.add(ACE.builder("toto", "Write").creator("Administrator").build()); acl.add(ACE.builder("toto", "Read").creator("Administrator").build()); acl.add(ACE.builder("pouet", "Read").creator("Administrator").build()); acp.addACL(acl); file.setACP(acp, true); section.setACP(acp, true); session.save(); try (CloseableCoreSession totoSession = coreFeature.openCoreSession("toto")) { file = totoSession.getDocument(file.getRef()); section = totoSession.getDocument(section.getRef()); DocumentModel publishedRendition = renditionService.publishRendition(file, section, PDF_RENDITION_DEFINITION, false); assertNotNull(publishedRendition); assertTrue(publishedRendition.isProxy()); assertEquals(section.getRef(), publishedRendition.getParentRef()); } try (CloseableCoreSession pouetSession = coreFeature.openCoreSession("pouet")) { file = pouetSession.getDocument(file.getRef()); section = pouetSession.getDocument(section.getRef()); try { renditionService.publishRendition(file, section, PDF_RENDITION_DEFINITION, false); fail("User should not have permission to publish"); } catch (DocumentSecurityException e) { // Expected } } } protected static void assertRenditionDefinitions(List<RenditionDefinition> actual, String... otherExpected) { List<String> expected = new ArrayList<>(Arrays.asList( // "delayedErrorAutomationRendition", // "iamlazy", // "mainBlob", // "lazyAutomation", // "lazyDelayedErrorAutomationRendition", // "renditionDefinitionWithCustomOperationChain", // "xmlExport")); if (otherExpected != null) { expected.addAll(Arrays.asList(otherExpected)); Collections.sort(expected); } assertEquals(expected, renditionNames(actual)); } protected static List<String> renditionNames(List<RenditionDefinition> list) { return list.stream().map(RenditionDefinition::getName).sorted().collect(Collectors.toList()); } }
92400b11598a88f845e1c47f2228b601e001c97f
567
java
Java
springboot-16-dubbo/provider/src/main/java/ProviderApplication.java
yangyanshu/springboot2.x
b24bafae18b66b514a3dd121be0d819e93cf400e
[ "Apache-2.0" ]
8
2020-06-09T09:42:34.000Z
2022-03-01T08:36:30.000Z
springboot-16-dubbo/provider/src/main/java/ProviderApplication.java
yangyanshu/springboot2.x
b24bafae18b66b514a3dd121be0d819e93cf400e
[ "Apache-2.0" ]
null
null
null
springboot-16-dubbo/provider/src/main/java/ProviderApplication.java
yangyanshu/springboot2.x
b24bafae18b66b514a3dd121be0d819e93cf400e
[ "Apache-2.0" ]
7
2020-07-16T13:12:50.000Z
2021-12-13T01:30:10.000Z
27
76
0.781305
1,001,381
import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * @version v1.0.0 * @ProjectName: springboot-learning-examples * @ClassName: ProviderApplication * @Author: 三月三 */ // 提供服务的应用必须配置此项 @SpringBootApplication @DubboComponentScan("cn.zysheep.provider.service") public class ProviderApplication { public static void main(String[] args) { SpringApplication.run(ProviderApplication.class, args); } }
92400b44c694892190ae8f8bd2cb76b2e7ffeab4
2,750
java
Java
rice-middleware/krms/impl/src/main/java/org/kuali/rice/krms/impl/repository/ContextValidActionBo.java
cniesen/rice-playground
7c043822e8d431246c12121d5d609e626bfacd0b
[ "ECL-2.0" ]
2
2017-02-14T20:40:21.000Z
2018-12-05T18:45:26.000Z
rice-middleware/krms/impl/src/main/java/org/kuali/rice/krms/impl/repository/ContextValidActionBo.java
cniesen/rice-playground
7c043822e8d431246c12121d5d609e626bfacd0b
[ "ECL-2.0" ]
10
2015-10-12T18:58:39.000Z
2020-11-11T20:17:04.000Z
rice-middleware/krms/impl/src/main/java/org/kuali/rice/krms/impl/repository/ContextValidActionBo.java
cniesen/rice-playground
7c043822e8d431246c12121d5d609e626bfacd0b
[ "ECL-2.0" ]
3
2015-01-22T16:28:11.000Z
2021-01-21T09:17:57.000Z
28.061224
109
0.720727
1,001,382
/** * Copyright 2005-2014 The Kuali Foundation * * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php * * 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.kuali.rice.krms.impl.repository; import org.kuali.rice.core.api.mo.common.Versioned; import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Version; import java.io.Serializable; @Entity @Table(name = "KRMS_CNTXT_VLD_ACTN_TYP_T") public class ContextValidActionBo implements Versioned, Serializable { private static final long serialVersionUID = 1l; @PortableSequenceGenerator(name = "KRMS_CNTXT_VLD_ACTN_TYP_S") @GeneratedValue(generator = "KRMS_CNTXT_VLD_ACTN_TYP_S") @Id @Column(name = "CNTXT_VLD_ACTN_ID") private String id; @Column(name = "CNTXT_ID") private String contextId; @Column(name = "ACTN_TYP_ID") private String actionTypeId; @Column(name = "VER_NBR") @Version private Long versionNumber; @ManyToOne(targetEntity = KrmsTypeBo.class, cascade = { CascadeType.REFRESH }) @JoinColumn(name = "ACTN_TYP_ID", referencedColumnName = "TYP_ID", insertable = false, updatable = false) private KrmsTypeBo actionType; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getContextId() { return contextId; } public void setContextId(String contextId) { this.contextId = contextId; } public String getActionTypeId() { return actionTypeId; } public void setActionTypeId(String actionTypeId) { this.actionTypeId = actionTypeId; } public Long getVersionNumber() { return versionNumber; } public void setVersionNumber(Long versionNumber) { this.versionNumber = versionNumber; } public KrmsTypeBo getActionType() { return actionType; } public void setActionType(KrmsTypeBo actionType) { this.actionType = actionType; } }
92400c191491d159dc53e9fe0afd53fad81b4372
915
java
Java
HW8 - Notification/notif/src/notification/EmotionalNotification.java
pouyaardehkhani/Advance-Programing-Course-Exercises-JAVA
f933aa89875372cf5119b2341ddf28bc5a9ecc09
[ "MIT" ]
1
2022-02-18T22:26:51.000Z
2022-02-18T22:26:51.000Z
HW8 - Notification/notif/src/notification/EmotionalNotification.java
pouyaardehkhani/Advance-Programing-Course-Exercises-JAVA
f933aa89875372cf5119b2341ddf28bc5a9ecc09
[ "MIT" ]
null
null
null
HW8 - Notification/notif/src/notification/EmotionalNotification.java
pouyaardehkhani/Advance-Programing-Course-Exercises-JAVA
f933aa89875372cf5119b2341ddf28bc5a9ecc09
[ "MIT" ]
null
null
null
28.59375
96
0.624044
1,001,383
package notification; import java.util.*; import java.io.*; import java.lang.*; import java.io.IOException; import java.util.regex.*; public class EmotionalNotification extends Notification{ public EmotionalNotification(String REC, String MAS, int hours,int minutes){ super(REC,MAS,hours,minutes,1); } @Override public String showNotificationPanel(){ StringBuilder show=new StringBuilder(); show.append("-- "); show.append(this.getReceiver()); show.append(" has send you a new Emotional massage --"); return show.toString(); } public static boolean find(String s){ ArrayList<String> emotional=new ArrayList<String>(Arrays.asList("babe","honey","love")); for (int i=0;i< emotional.size();i++){ if (s.contains(emotional.get(i))){ return true; } } return false; } }
92400d14b48bb057497ff545ac2d55f7e6d25ee0
3,350
java
Java
src/io/netty/handler/codec/http2/DefaultHttp2PingFrame.java
HxmLi/NettySource
f5aca7b2026d97c9afd94fc2d77994b558eade14
[ "MIT" ]
1
2020-03-23T03:13:13.000Z
2020-03-23T03:13:13.000Z
src/io/netty/handler/codec/http2/DefaultHttp2PingFrame.java
HxmLi/NettySource
f5aca7b2026d97c9afd94fc2d77994b558eade14
[ "MIT" ]
null
null
null
src/io/netty/handler/codec/http2/DefaultHttp2PingFrame.java
HxmLi/NettySource
f5aca7b2026d97c9afd94fc2d77994b558eade14
[ "MIT" ]
1
2020-07-06T09:14:14.000Z
2020-07-06T09:14:14.000Z
26.377953
105
0.640299
1,001,384
/* * Copyright 2016 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.http2; import io.netty.buffer.ByteBuf; import io.netty.buffer.DefaultByteBufHolder; import io.netty.util.internal.StringUtil; import io.netty.util.internal.UnstableApi; /** * The default {@link Http2PingFrame} implementation. */ @UnstableApi public class DefaultHttp2PingFrame extends DefaultByteBufHolder implements Http2PingFrame { private final boolean ack; public DefaultHttp2PingFrame(ByteBuf content) { this(content, false); } /** * A user cannot send a ping ack, as this is done automatically when a ping is received. */ DefaultHttp2PingFrame(ByteBuf content, boolean ack) { super(mustBeEightBytes(content)); this.ack = ack; } @Override public boolean ack() { return ack; } @Override public String name() { return "PING"; } @Override public DefaultHttp2PingFrame copy() { return replace(content().copy()); } @Override public DefaultHttp2PingFrame duplicate() { return replace(content().duplicate()); } @Override public DefaultHttp2PingFrame retainedDuplicate() { return replace(content().retainedDuplicate()); } @Override public DefaultHttp2PingFrame replace(ByteBuf content) { return new DefaultHttp2PingFrame(content, ack); } @Override public DefaultHttp2PingFrame retain() { super.retain(); return this; } @Override public DefaultHttp2PingFrame retain(int increment) { super.retain(increment); return this; } @Override public DefaultHttp2PingFrame touch() { super.touch(); return this; } @Override public DefaultHttp2PingFrame touch(Object hint) { super.touch(hint); return this; } @Override public boolean equals(Object o) { if (!(o instanceof Http2PingFrame)) { return false; } Http2PingFrame other = (Http2PingFrame) o; return super.equals(o) && ack == other.ack(); } @Override public int hashCode() { int hash = super.hashCode(); hash = hash * 31 + (ack ? 1 : 0); return hash; } private static ByteBuf mustBeEightBytes(ByteBuf content) { if (content.readableBytes() != 8) { throw new IllegalArgumentException("PING frames require 8 bytes of content. Was " + content.readableBytes() + " bytes."); } return content; } @Override public String toString() { return StringUtil.simpleClassName(this) + "(content=" + contentToString() + ", ack=" + ack + ')'; } }
92400d2f86678ea4004f8782744b0a993c547ee3
113
java
Java
src/main/java/com/uno/getinline/constant/EventStatus.java
yeongno/get-in-line
276dc3f230569060a7435b7faba6db6f0c8f0ed2
[ "MIT" ]
9
2021-10-13T04:36:01.000Z
2022-03-20T14:06:17.000Z
src/main/java/com/uno/getinline/constant/EventStatus.java
yeongno/get-in-line
276dc3f230569060a7435b7faba6db6f0c8f0ed2
[ "MIT" ]
8
2021-09-20T15:43:48.000Z
2022-02-05T15:35:38.000Z
src/main/java/com/uno/getinline/constant/EventStatus.java
yeongno/get-in-line
276dc3f230569060a7435b7faba6db6f0c8f0ed2
[ "MIT" ]
14
2021-12-08T23:26:31.000Z
2022-03-20T14:08:13.000Z
18.833333
47
0.761062
1,001,385
package com.uno.getinline.constant; public enum EventStatus { PENDING, OPENED, CLOSED, CANCELLED, ABORTED }
92400d878ee3e7523a5f5b41c22807d0305df7f1
294
java
Java
src/main/java/com/anandhuarjunan/developertools/core/utils/Util.java
AnandhuArjunan/DeveloperTools
6c5e1f50101b94bfa9181a8329064bf9cdd61a69
[ "Apache-2.0" ]
2
2022-01-14T05:25:45.000Z
2022-03-22T12:35:49.000Z
src/main/java/com/anandhuarjunan/developertools/core/utils/Util.java
AnandhuArjunan/DeveloperTools
6c5e1f50101b94bfa9181a8329064bf9cdd61a69
[ "Apache-2.0" ]
null
null
null
src/main/java/com/anandhuarjunan/developertools/core/utils/Util.java
AnandhuArjunan/DeveloperTools
6c5e1f50101b94bfa9181a8329064bf9cdd61a69
[ "Apache-2.0" ]
null
null
null
16.333333
63
0.768707
1,001,386
package com.anandhuarjunan.developertools.core.utils; import java.io.File; public class Util { public static File getResourceFile(String fileName) { ClassLoader classLoader = ClassLoader.getSystemClassLoader(); return new File(classLoader.getResource(fileName).getFile()); } }
92400f218d156e2bff17ac37ee6ae590126cf120
48,372
java
Java
ExtractedJars/Ibotta_com.ibotta.android/javafiles/com/facebook/stetho/Stetho.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
3
2019-05-01T09:22:08.000Z
2019-07-06T22:21:59.000Z
ExtractedJars/Ibotta_com.ibotta.android/javafiles/com/facebook/stetho/Stetho.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
null
null
null
ExtractedJars/Ibotta_com.ibotta.android/javafiles/com/facebook/stetho/Stetho.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
1
2020-11-26T12:22:02.000Z
2020-11-26T12:22:02.000Z
44.296703
344
0.603531
1,001,387
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package com.facebook.stetho; import android.app.Application; import android.content.Context; import com.facebook.stetho.common.LogUtil; import com.facebook.stetho.common.Util; import com.facebook.stetho.dumpapp.DumpappHttpSocketLikeHandler; import com.facebook.stetho.dumpapp.DumpappSocketLikeHandler; import com.facebook.stetho.dumpapp.Dumper; import com.facebook.stetho.dumpapp.DumperPlugin; import com.facebook.stetho.dumpapp.plugins.CrashDumperPlugin; import com.facebook.stetho.dumpapp.plugins.FilesDumperPlugin; import com.facebook.stetho.dumpapp.plugins.HprofDumperPlugin; import com.facebook.stetho.dumpapp.plugins.SharedPreferencesDumperPlugin; import com.facebook.stetho.inspector.DevtoolsSocketHandler; import com.facebook.stetho.inspector.console.RuntimeReplFactory; import com.facebook.stetho.inspector.database.DatabaseFilesProvider; import com.facebook.stetho.inspector.database.DefaultDatabaseFilesProvider; import com.facebook.stetho.inspector.database.SqliteDatabaseDriver; import com.facebook.stetho.inspector.elements.Document; import com.facebook.stetho.inspector.elements.DocumentProviderFactory; import com.facebook.stetho.inspector.elements.android.ActivityTracker; import com.facebook.stetho.inspector.elements.android.AndroidDocumentProviderFactory; import com.facebook.stetho.inspector.protocol.ChromeDevtoolsDomain; import com.facebook.stetho.inspector.protocol.module.CSS; import com.facebook.stetho.inspector.protocol.module.Console; import com.facebook.stetho.inspector.protocol.module.DOM; import com.facebook.stetho.inspector.protocol.module.DOMStorage; import com.facebook.stetho.inspector.protocol.module.Database; import com.facebook.stetho.inspector.protocol.module.Debugger; import com.facebook.stetho.inspector.protocol.module.HeapProfiler; import com.facebook.stetho.inspector.protocol.module.Inspector; import com.facebook.stetho.inspector.protocol.module.Network; import com.facebook.stetho.inspector.protocol.module.Page; import com.facebook.stetho.inspector.protocol.module.Profiler; import com.facebook.stetho.inspector.protocol.module.Runtime; import com.facebook.stetho.inspector.protocol.module.Worker; import com.facebook.stetho.inspector.runtime.RhinoDetectingRuntimeReplFactory; import com.facebook.stetho.server.AddressNameHelper; import com.facebook.stetho.server.LazySocketHandler; import com.facebook.stetho.server.LocalSocketServer; import com.facebook.stetho.server.ProtocolDetectingSocketHandler; import com.facebook.stetho.server.ServerManager; import com.facebook.stetho.server.SocketHandler; import com.facebook.stetho.server.SocketHandlerFactory; import java.util.*; // Referenced classes of package com.facebook.stetho: // DumperPluginsProvider, InspectorModulesProvider public class Stetho { private static class BuilderBasedInitializer extends Initializer { protected Iterable getDumperPlugins() { DumperPluginsProvider dumperpluginsprovider = mDumperPlugins; // 0 0:aload_0 // 1 1:getfield #26 <Field DumperPluginsProvider mDumperPlugins> // 2 4:astore_1 if(dumperpluginsprovider != null) //* 3 5:aload_1 //* 4 6:ifnull 16 return dumperpluginsprovider.get(); // 5 9:aload_1 // 6 10:invokeinterface #40 <Method Iterable DumperPluginsProvider.get()> // 7 15:areturn else return null; // 8 16:aconst_null // 9 17:areturn } protected Iterable getInspectorModules() { InspectorModulesProvider inspectormodulesprovider = mInspectorModules; // 0 0:aload_0 // 1 1:getfield #29 <Field InspectorModulesProvider mInspectorModules> // 2 4:astore_1 if(inspectormodulesprovider != null) //* 3 5:aload_1 //* 4 6:ifnull 16 return inspectormodulesprovider.get(); // 5 9:aload_1 // 6 10:invokeinterface #47 <Method Iterable InspectorModulesProvider.get()> // 7 15:areturn else return null; // 8 16:aconst_null // 9 17:areturn } private final DumperPluginsProvider mDumperPlugins; private final InspectorModulesProvider mInspectorModules; private BuilderBasedInitializer(InitializerBuilder initializerbuilder) { super(initializerbuilder.mContext); // 0 0:aload_0 // 1 1:aload_1 // 2 2:getfield #20 <Field Context Stetho$InitializerBuilder.mContext> // 3 5:invokespecial #23 <Method void Stetho$Initializer(Context)> mDumperPlugins = initializerbuilder.mDumperPlugins; // 4 8:aload_0 // 5 9:aload_1 // 6 10:getfield #25 <Field DumperPluginsProvider Stetho$InitializerBuilder.mDumperPlugins> // 7 13:putfield #26 <Field DumperPluginsProvider mDumperPlugins> mInspectorModules = initializerbuilder.mInspectorModules; // 8 16:aload_0 // 9 17:aload_1 // 10 18:getfield #28 <Field InspectorModulesProvider Stetho$InitializerBuilder.mInspectorModules> // 11 21:putfield #29 <Field InspectorModulesProvider mInspectorModules> // 12 24:return } } public static final class DefaultDumperPluginsBuilder { private DefaultDumperPluginsBuilder provideIfDesired(DumperPlugin dumperplugin) { mDelegate.provideIfDesired(dumperplugin.getName(), ((Object) (dumperplugin))); // 0 0:aload_0 // 1 1:getfield #24 <Field Stetho$PluginBuilder mDelegate> // 2 4:aload_1 // 3 5:invokeinterface #35 <Method String DumperPlugin.getName()> // 4 10:aload_1 // 5 11:invokevirtual #38 <Method void Stetho$PluginBuilder.provideIfDesired(String, Object)> return this; // 6 14:aload_0 // 7 15:areturn } public Iterable finish() { provideIfDesired(((DumperPlugin) (new HprofDumperPlugin(mContext)))); // 0 0:aload_0 // 1 1:new #42 <Class HprofDumperPlugin> // 2 4:dup // 3 5:aload_0 // 4 6:getfield #26 <Field Context mContext> // 5 9:invokespecial #44 <Method void HprofDumperPlugin(Context)> // 6 12:invokespecial #46 <Method Stetho$DefaultDumperPluginsBuilder provideIfDesired(DumperPlugin)> // 7 15:pop provideIfDesired(((DumperPlugin) (new SharedPreferencesDumperPlugin(mContext)))); // 8 16:aload_0 // 9 17:new #48 <Class SharedPreferencesDumperPlugin> // 10 20:dup // 11 21:aload_0 // 12 22:getfield #26 <Field Context mContext> // 13 25:invokespecial #49 <Method void SharedPreferencesDumperPlugin(Context)> // 14 28:invokespecial #46 <Method Stetho$DefaultDumperPluginsBuilder provideIfDesired(DumperPlugin)> // 15 31:pop provideIfDesired(((DumperPlugin) (new CrashDumperPlugin()))); // 16 32:aload_0 // 17 33:new #51 <Class CrashDumperPlugin> // 18 36:dup // 19 37:invokespecial #52 <Method void CrashDumperPlugin()> // 20 40:invokespecial #46 <Method Stetho$DefaultDumperPluginsBuilder provideIfDesired(DumperPlugin)> // 21 43:pop provideIfDesired(((DumperPlugin) (new FilesDumperPlugin(mContext)))); // 22 44:aload_0 // 23 45:new #54 <Class FilesDumperPlugin> // 24 48:dup // 25 49:aload_0 // 26 50:getfield #26 <Field Context mContext> // 27 53:invokespecial #55 <Method void FilesDumperPlugin(Context)> // 28 56:invokespecial #46 <Method Stetho$DefaultDumperPluginsBuilder provideIfDesired(DumperPlugin)> // 29 59:pop return mDelegate.finish(); // 30 60:aload_0 // 31 61:getfield #24 <Field Stetho$PluginBuilder mDelegate> // 32 64:invokevirtual #57 <Method Iterable Stetho$PluginBuilder.finish()> // 33 67:areturn } public DefaultDumperPluginsBuilder provide(DumperPlugin dumperplugin) { mDelegate.provide(dumperplugin.getName(), ((Object) (dumperplugin))); // 0 0:aload_0 // 1 1:getfield #24 <Field Stetho$PluginBuilder mDelegate> // 2 4:aload_1 // 3 5:invokeinterface #35 <Method String DumperPlugin.getName()> // 4 10:aload_1 // 5 11:invokevirtual #62 <Method void Stetho$PluginBuilder.provide(String, Object)> return this; // 6 14:aload_0 // 7 15:areturn } public DefaultDumperPluginsBuilder remove(String s) { mDelegate.remove(s); // 0 0:aload_0 // 1 1:getfield #24 <Field Stetho$PluginBuilder mDelegate> // 2 4:aload_1 // 3 5:invokevirtual #67 <Method void Stetho$PluginBuilder.remove(String)> return this; // 4 8:aload_0 // 5 9:areturn } private final Context mContext; private final PluginBuilder mDelegate = new PluginBuilder(); public DefaultDumperPluginsBuilder(Context context) { // 0 0:aload_0 // 1 1:invokespecial #17 <Method void Object()> // 2 4:aload_0 // 3 5:new #19 <Class Stetho$PluginBuilder> // 4 8:dup // 5 9:aconst_null // 6 10:invokespecial #22 <Method void Stetho$PluginBuilder(Stetho$1)> // 7 13:putfield #24 <Field Stetho$PluginBuilder mDelegate> mContext = context; // 8 16:aload_0 // 9 17:aload_1 // 10 18:putfield #26 <Field Context mContext> // 11 21:return } } public static final class DefaultInspectorModulesBuilder { private DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain chromedevtoolsdomain) { mDelegate.provideIfDesired(((Object) (chromedevtoolsdomain)).getClass().getName(), ((Object) (chromedevtoolsdomain))); // 0 0:aload_0 // 1 1:getfield #34 <Field Stetho$PluginBuilder mDelegate> // 2 4:aload_1 // 3 5:invokevirtual #51 <Method Class Object.getClass()> // 4 8:invokevirtual #57 <Method String Class.getName()> // 5 11:aload_1 // 6 12:invokevirtual #60 <Method void Stetho$PluginBuilder.provideIfDesired(String, Object)> return this; // 7 15:aload_0 // 8 16:areturn } private DocumentProviderFactory resolveDocumentProvider() { DocumentProviderFactory documentproviderfactory = mDocumentProvider; // 0 0:aload_0 // 1 1:getfield #64 <Field DocumentProviderFactory mDocumentProvider> // 2 4:astore_1 if(documentproviderfactory != null) //* 3 5:aload_1 //* 4 6:ifnull 11 return documentproviderfactory; // 5 9:aload_1 // 6 10:areturn if(android.os.Build.VERSION.SDK_INT >= 14) //* 7 11:getstatic #70 <Field int android.os.Build$VERSION.SDK_INT> //* 8 14:bipush 14 //* 9 16:icmplt 31 return ((DocumentProviderFactory) (new AndroidDocumentProviderFactory(mContext))); // 10 19:new #72 <Class AndroidDocumentProviderFactory> // 11 22:dup // 12 23:aload_0 // 13 24:getfield #44 <Field Application mContext> // 14 27:invokespecial #75 <Method void AndroidDocumentProviderFactory(Application)> // 15 30:areturn else return null; // 16 31:aconst_null // 17 32:areturn } public DefaultInspectorModulesBuilder databaseFiles(DatabaseFilesProvider databasefilesprovider) { mDatabaseFilesProvider = databasefilesprovider; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #80 <Field DatabaseFilesProvider mDatabaseFilesProvider> return this; // 3 5:aload_0 // 4 6:areturn } public DefaultInspectorModulesBuilder documentProvider(DocumentProviderFactory documentproviderfactory) { mDocumentProvider = documentproviderfactory; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #64 <Field DocumentProviderFactory mDocumentProvider> return this; // 3 5:aload_0 // 4 6:areturn } public Iterable finish() { provideIfDesired(((ChromeDevtoolsDomain) (new Console()))); // 0 0:aload_0 // 1 1:new #86 <Class Console> // 2 4:dup // 3 5:invokespecial #87 <Method void Console()> // 4 8:invokespecial #89 <Method Stetho$DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain)> // 5 11:pop provideIfDesired(((ChromeDevtoolsDomain) (new Debugger()))); // 6 12:aload_0 // 7 13:new #91 <Class Debugger> // 8 16:dup // 9 17:invokespecial #92 <Method void Debugger()> // 10 20:invokespecial #89 <Method Stetho$DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain)> // 11 23:pop Object obj = ((Object) (resolveDocumentProvider())); // 12 24:aload_0 // 13 25:invokespecial #94 <Method DocumentProviderFactory resolveDocumentProvider()> // 14 28:astore_1 if(obj != null) //* 15 29:aload_1 //* 16 30:ifnull 68 { obj = ((Object) (new Document(((DocumentProviderFactory) (obj))))); // 17 33:new #96 <Class Document> // 18 36:dup // 19 37:aload_1 // 20 38:invokespecial #99 <Method void Document(DocumentProviderFactory)> // 21 41:astore_1 provideIfDesired(((ChromeDevtoolsDomain) (new DOM(((Document) (obj)))))); // 22 42:aload_0 // 23 43:new #101 <Class DOM> // 24 46:dup // 25 47:aload_1 // 26 48:invokespecial #104 <Method void DOM(Document)> // 27 51:invokespecial #89 <Method Stetho$DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain)> // 28 54:pop provideIfDesired(((ChromeDevtoolsDomain) (new CSS(((Document) (obj)))))); // 29 55:aload_0 // 30 56:new #106 <Class CSS> // 31 59:dup // 32 60:aload_1 // 33 61:invokespecial #107 <Method void CSS(Document)> // 34 64:invokespecial #89 <Method Stetho$DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain)> // 35 67:pop } provideIfDesired(((ChromeDevtoolsDomain) (new DOMStorage(((Context) (mContext)))))); // 36 68:aload_0 // 37 69:new #109 <Class DOMStorage> // 38 72:dup // 39 73:aload_0 // 40 74:getfield #44 <Field Application mContext> // 41 77:invokespecial #111 <Method void DOMStorage(Context)> // 42 80:invokespecial #89 <Method Stetho$DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain)> // 43 83:pop provideIfDesired(((ChromeDevtoolsDomain) (new HeapProfiler()))); // 44 84:aload_0 // 45 85:new #113 <Class HeapProfiler> // 46 88:dup // 47 89:invokespecial #114 <Method void HeapProfiler()> // 48 92:invokespecial #89 <Method Stetho$DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain)> // 49 95:pop provideIfDesired(((ChromeDevtoolsDomain) (new Inspector()))); // 50 96:aload_0 // 51 97:new #116 <Class Inspector> // 52 100:dup // 53 101:invokespecial #117 <Method void Inspector()> // 54 104:invokespecial #89 <Method Stetho$DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain)> // 55 107:pop provideIfDesired(((ChromeDevtoolsDomain) (new Network(((Context) (mContext)))))); // 56 108:aload_0 // 57 109:new #119 <Class Network> // 58 112:dup // 59 113:aload_0 // 60 114:getfield #44 <Field Application mContext> // 61 117:invokespecial #120 <Method void Network(Context)> // 62 120:invokespecial #89 <Method Stetho$DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain)> // 63 123:pop provideIfDesired(((ChromeDevtoolsDomain) (new Page(((Context) (mContext)))))); // 64 124:aload_0 // 65 125:new #122 <Class Page> // 66 128:dup // 67 129:aload_0 // 68 130:getfield #44 <Field Application mContext> // 69 133:invokespecial #123 <Method void Page(Context)> // 70 136:invokespecial #89 <Method Stetho$DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain)> // 71 139:pop provideIfDesired(((ChromeDevtoolsDomain) (new Profiler()))); // 72 140:aload_0 // 73 141:new #125 <Class Profiler> // 74 144:dup // 75 145:invokespecial #126 <Method void Profiler()> // 76 148:invokespecial #89 <Method Stetho$DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain)> // 77 151:pop obj = ((Object) (mRuntimeRepl)); // 78 152:aload_0 // 79 153:getfield #128 <Field RuntimeReplFactory mRuntimeRepl> // 80 156:astore_1 if(obj == null) //* 81 157:aload_1 //* 82 158:ifnull 164 //* 83 161:goto 176 obj = ((Object) (new RhinoDetectingRuntimeReplFactory(((Context) (mContext))))); // 84 164:new #130 <Class RhinoDetectingRuntimeReplFactory> // 85 167:dup // 86 168:aload_0 // 87 169:getfield #44 <Field Application mContext> // 88 172:invokespecial #131 <Method void RhinoDetectingRuntimeReplFactory(Context)> // 89 175:astore_1 provideIfDesired(((ChromeDevtoolsDomain) (new Runtime(((RuntimeReplFactory) (obj)))))); // 90 176:aload_0 // 91 177:new #133 <Class Runtime> // 92 180:dup // 93 181:aload_1 // 94 182:invokespecial #136 <Method void Runtime(RuntimeReplFactory)> // 95 185:invokespecial #89 <Method Stetho$DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain)> // 96 188:pop provideIfDesired(((ChromeDevtoolsDomain) (new Worker()))); // 97 189:aload_0 // 98 190:new #138 <Class Worker> // 99 193:dup // 100 194:invokespecial #139 <Method void Worker()> // 101 197:invokespecial #89 <Method Stetho$DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain)> // 102 200:pop if(android.os.Build.VERSION.SDK_INT >= 11) //* 103 201:getstatic #70 <Field int android.os.Build$VERSION.SDK_INT> //* 104 204:bipush 11 //* 105 206:icmplt 303 { Database database = new Database(); // 106 209:new #141 <Class Database> // 107 212:dup // 108 213:invokespecial #142 <Method void Database()> // 109 216:astore_2 Application application = mContext; // 110 217:aload_0 // 111 218:getfield #44 <Field Application mContext> // 112 221:astore_3 Object obj1 = ((Object) (mDatabaseFilesProvider)); // 113 222:aload_0 // 114 223:getfield #80 <Field DatabaseFilesProvider mDatabaseFilesProvider> // 115 226:astore_1 if(obj1 == null) //* 116 227:aload_1 //* 117 228:ifnull 234 //* 118 231:goto 243 obj1 = ((Object) (new DefaultDatabaseFilesProvider(((Context) (application))))); // 119 234:new #144 <Class DefaultDatabaseFilesProvider> // 120 237:dup // 121 238:aload_3 // 122 239:invokespecial #145 <Method void DefaultDatabaseFilesProvider(Context)> // 123 242:astore_1 database.add(((com.facebook.stetho.inspector.protocol.module.Database.DatabaseDriver) (new SqliteDatabaseDriver(((Context) (application)), ((DatabaseFilesProvider) (obj1)))))); // 124 243:aload_2 // 125 244:new #147 <Class SqliteDatabaseDriver> // 126 247:dup // 127 248:aload_3 // 128 249:aload_1 // 129 250:invokespecial #150 <Method void SqliteDatabaseDriver(Context, DatabaseFilesProvider)> // 130 253:invokevirtual #154 <Method void Database.add(com.facebook.stetho.inspector.protocol.module.Database$DatabaseDriver)> obj1 = ((Object) (mDatabaseDrivers)); // 131 256:aload_0 // 132 257:getfield #156 <Field List mDatabaseDrivers> // 133 260:astore_1 if(obj1 != null) //* 134 261:aload_1 //* 135 262:ifnull 297 for(obj1 = ((Object) (((List) (obj1)).iterator())); ((Iterator) (obj1)).hasNext(); database.add((com.facebook.stetho.inspector.protocol.module.Database.DatabaseDriver)((Iterator) (obj1)).next())); // 136 265:aload_1 // 137 266:invokeinterface #162 <Method Iterator List.iterator()> // 138 271:astore_1 // 139 272:aload_1 // 140 273:invokeinterface #168 <Method boolean Iterator.hasNext()> // 141 278:ifeq 297 // 142 281:aload_2 // 143 282:aload_1 // 144 283:invokeinterface #172 <Method Object Iterator.next()> // 145 288:checkcast #174 <Class com.facebook.stetho.inspector.protocol.module.Database$DatabaseDriver> // 146 291:invokevirtual #154 <Method void Database.add(com.facebook.stetho.inspector.protocol.module.Database$DatabaseDriver)> //* 147 294:goto 272 provideIfDesired(((ChromeDevtoolsDomain) (database))); // 148 297:aload_0 // 149 298:aload_2 // 150 299:invokespecial #89 <Method Stetho$DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain)> // 151 302:pop } return mDelegate.finish(); // 152 303:aload_0 // 153 304:getfield #34 <Field Stetho$PluginBuilder mDelegate> // 154 307:invokevirtual #176 <Method Iterable Stetho$PluginBuilder.finish()> // 155 310:areturn } public DefaultInspectorModulesBuilder provide(ChromeDevtoolsDomain chromedevtoolsdomain) { mDelegate.provide(((Object) (chromedevtoolsdomain)).getClass().getName(), ((Object) (chromedevtoolsdomain))); // 0 0:aload_0 // 1 1:getfield #34 <Field Stetho$PluginBuilder mDelegate> // 2 4:aload_1 // 3 5:invokevirtual #51 <Method Class Object.getClass()> // 4 8:invokevirtual #57 <Method String Class.getName()> // 5 11:aload_1 // 6 12:invokevirtual #182 <Method void Stetho$PluginBuilder.provide(String, Object)> return this; // 7 15:aload_0 // 8 16:areturn } public DefaultInspectorModulesBuilder provideDatabaseDriver(com.facebook.stetho.inspector.protocol.module.Database.DatabaseDriver databasedriver) { if(mDatabaseDrivers == null) //* 0 0:aload_0 //* 1 1:getfield #156 <Field List mDatabaseDrivers> //* 2 4:ifnonnull 18 mDatabaseDrivers = ((List) (new ArrayList())); // 3 7:aload_0 // 4 8:new #186 <Class ArrayList> // 5 11:dup // 6 12:invokespecial #187 <Method void ArrayList()> // 7 15:putfield #156 <Field List mDatabaseDrivers> mDatabaseDrivers.add(((Object) (databasedriver))); // 8 18:aload_0 // 9 19:getfield #156 <Field List mDatabaseDrivers> // 10 22:aload_1 // 11 23:invokeinterface #190 <Method boolean List.add(Object)> // 12 28:pop return this; // 13 29:aload_0 // 14 30:areturn } public DefaultInspectorModulesBuilder remove(String s) { mDelegate.remove(s); // 0 0:aload_0 // 1 1:getfield #34 <Field Stetho$PluginBuilder mDelegate> // 2 4:aload_1 // 3 5:invokevirtual #195 <Method void Stetho$PluginBuilder.remove(String)> return this; // 4 8:aload_0 // 5 9:areturn } public DefaultInspectorModulesBuilder runtimeRepl(RuntimeReplFactory runtimereplfactory) { mRuntimeRepl = runtimereplfactory; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #128 <Field RuntimeReplFactory mRuntimeRepl> return this; // 3 5:aload_0 // 4 6:areturn } private final Application mContext; private List mDatabaseDrivers; private DatabaseFilesProvider mDatabaseFilesProvider; private final PluginBuilder mDelegate = new PluginBuilder(); private DocumentProviderFactory mDocumentProvider; private RuntimeReplFactory mRuntimeRepl; public DefaultInspectorModulesBuilder(Context context) { // 0 0:aload_0 // 1 1:invokespecial #27 <Method void Object()> // 2 4:aload_0 // 3 5:new #29 <Class Stetho$PluginBuilder> // 4 8:dup // 5 9:aconst_null // 6 10:invokespecial #32 <Method void Stetho$PluginBuilder(Stetho$1)> // 7 13:putfield #34 <Field Stetho$PluginBuilder mDelegate> mContext = (Application)context.getApplicationContext(); // 8 16:aload_0 // 9 17:aload_1 // 10 18:invokevirtual #40 <Method Context Context.getApplicationContext()> // 11 21:checkcast #42 <Class Application> // 12 24:putfield #44 <Field Application mContext> // 13 27:return } } public static abstract class Initializer { protected abstract Iterable getDumperPlugins(); protected abstract Iterable getInspectorModules(); final void start() { (new ServerManager(new LocalSocketServer("main", AddressNameHelper.createCustomAddress("_devtools_remote"), ((SocketHandler) (new LazySocketHandler(((SocketHandlerFactory) (new RealSocketHandlerFactory())))))))).start(); // 0 0:new #35 <Class ServerManager> // 1 3:dup // 2 4:new #37 <Class LocalSocketServer> // 3 7:dup // 4 8:ldc1 #39 <String "main"> // 5 10:ldc1 #41 <String "_devtools_remote"> // 6 12:invokestatic #47 <Method String AddressNameHelper.createCustomAddress(String)> // 7 15:new #49 <Class LazySocketHandler> // 8 18:dup // 9 19:new #9 <Class Stetho$Initializer$RealSocketHandlerFactory> // 10 22:dup // 11 23:aload_0 // 12 24:aconst_null // 13 25:invokespecial #52 <Method void Stetho$Initializer$RealSocketHandlerFactory(Stetho$Initializer, Stetho$1)> // 14 28:invokespecial #55 <Method void LazySocketHandler(SocketHandlerFactory)> // 15 31:invokespecial #58 <Method void LocalSocketServer(String, String, SocketHandler)> // 16 34:invokespecial #61 <Method void ServerManager(LocalSocketServer)> // 17 37:invokevirtual #63 <Method void ServerManager.start()> // 18 40:return } private final Context mContext; /* static Context access$100(Initializer initializer) { return initializer.mContext; // 0 0:aload_0 // 1 1:getfield #25 <Field Context mContext> // 2 4:areturn } */ protected Initializer(Context context) { // 0 0:aload_0 // 1 1:invokespecial #17 <Method void Object()> mContext = context.getApplicationContext(); // 2 4:aload_0 // 3 5:aload_1 // 4 6:invokevirtual #23 <Method Context Context.getApplicationContext()> // 5 9:putfield #25 <Field Context mContext> // 6 12:return } } private class Initializer.RealSocketHandlerFactory implements SocketHandlerFactory { public SocketHandler create() { ProtocolDetectingSocketHandler protocoldetectingsockethandler = new ProtocolDetectingSocketHandler(mContext); // 0 0:new #29 <Class ProtocolDetectingSocketHandler> // 1 3:dup // 2 4:aload_0 // 3 5:getfield #18 <Field Stetho$Initializer this$0> // 4 8:invokestatic #33 <Method Context Stetho$Initializer.access$100(Stetho$Initializer)> // 5 11:invokespecial #36 <Method void ProtocolDetectingSocketHandler(Context)> // 6 14:astore_1 Object obj = ((Object) (getDumperPlugins())); // 7 15:aload_0 // 8 16:getfield #18 <Field Stetho$Initializer this$0> // 9 19:invokevirtual #40 <Method Iterable Stetho$Initializer.getDumperPlugins()> // 10 22:astore_2 if(obj != null) //* 11 23:aload_2 //* 12 24:ifnull 101 { obj = ((Object) (new Dumper(((Iterable) (obj))))); // 13 27:new #42 <Class Dumper> // 14 30:dup // 15 31:aload_2 // 16 32:invokespecial #45 <Method void Dumper(Iterable)> // 17 35:astore_2 protocoldetectingsockethandler.addHandler(((com.facebook.stetho.server.ProtocolDetectingSocketHandler.MagicMatcher) (new com.facebook.stetho.server.ProtocolDetectingSocketHandler.ExactMagicMatcher(DumpappSocketLikeHandler.PROTOCOL_MAGIC))), ((com.facebook.stetho.server.SocketLikeHandler) (new DumpappSocketLikeHandler(((Dumper) (obj)))))); // 18 36:aload_1 // 19 37:new #47 <Class com.facebook.stetho.server.ProtocolDetectingSocketHandler$ExactMagicMatcher> // 20 40:dup // 21 41:getstatic #53 <Field byte[] DumpappSocketLikeHandler.PROTOCOL_MAGIC> // 22 44:invokespecial #56 <Method void com.facebook.stetho.server.ProtocolDetectingSocketHandler$ExactMagicMatcher(byte[])> // 23 47:new #49 <Class DumpappSocketLikeHandler> // 24 50:dup // 25 51:aload_2 // 26 52:invokespecial #59 <Method void DumpappSocketLikeHandler(Dumper)> // 27 55:invokevirtual #63 <Method void ProtocolDetectingSocketHandler.addHandler(com.facebook.stetho.server.ProtocolDetectingSocketHandler$MagicMatcher, com.facebook.stetho.server.SocketLikeHandler)> obj = ((Object) (new DumpappHttpSocketLikeHandler(((Dumper) (obj))))); // 28 58:new #65 <Class DumpappHttpSocketLikeHandler> // 29 61:dup // 30 62:aload_2 // 31 63:invokespecial #66 <Method void DumpappHttpSocketLikeHandler(Dumper)> // 32 66:astore_2 protocoldetectingsockethandler.addHandler(((com.facebook.stetho.server.ProtocolDetectingSocketHandler.MagicMatcher) (new com.facebook.stetho.server.ProtocolDetectingSocketHandler.ExactMagicMatcher("GET /dumpapp".getBytes()))), ((com.facebook.stetho.server.SocketLikeHandler) (obj))); // 33 67:aload_1 // 34 68:new #47 <Class com.facebook.stetho.server.ProtocolDetectingSocketHandler$ExactMagicMatcher> // 35 71:dup // 36 72:ldc1 #68 <String "GET /dumpapp"> // 37 74:invokevirtual #74 <Method byte[] String.getBytes()> // 38 77:invokespecial #56 <Method void com.facebook.stetho.server.ProtocolDetectingSocketHandler$ExactMagicMatcher(byte[])> // 39 80:aload_2 // 40 81:invokevirtual #63 <Method void ProtocolDetectingSocketHandler.addHandler(com.facebook.stetho.server.ProtocolDetectingSocketHandler$MagicMatcher, com.facebook.stetho.server.SocketLikeHandler)> protocoldetectingsockethandler.addHandler(((com.facebook.stetho.server.ProtocolDetectingSocketHandler.MagicMatcher) (new com.facebook.stetho.server.ProtocolDetectingSocketHandler.ExactMagicMatcher("POST /dumpapp".getBytes()))), ((com.facebook.stetho.server.SocketLikeHandler) (obj))); // 41 84:aload_1 // 42 85:new #47 <Class com.facebook.stetho.server.ProtocolDetectingSocketHandler$ExactMagicMatcher> // 43 88:dup // 44 89:ldc1 #76 <String "POST /dumpapp"> // 45 91:invokevirtual #74 <Method byte[] String.getBytes()> // 46 94:invokespecial #56 <Method void com.facebook.stetho.server.ProtocolDetectingSocketHandler$ExactMagicMatcher(byte[])> // 47 97:aload_2 // 48 98:invokevirtual #63 <Method void ProtocolDetectingSocketHandler.addHandler(com.facebook.stetho.server.ProtocolDetectingSocketHandler$MagicMatcher, com.facebook.stetho.server.SocketLikeHandler)> } obj = ((Object) (getInspectorModules())); // 49 101:aload_0 // 50 102:getfield #18 <Field Stetho$Initializer this$0> // 51 105:invokevirtual #79 <Method Iterable Stetho$Initializer.getInspectorModules()> // 52 108:astore_2 if(obj != null) //* 53 109:aload_2 //* 54 110:ifnull 139 protocoldetectingsockethandler.addHandler(((com.facebook.stetho.server.ProtocolDetectingSocketHandler.MagicMatcher) (new com.facebook.stetho.server.ProtocolDetectingSocketHandler.AlwaysMatchMatcher())), ((com.facebook.stetho.server.SocketLikeHandler) (new DevtoolsSocketHandler(mContext, ((Iterable) (obj)))))); // 55 113:aload_1 // 56 114:new #81 <Class com.facebook.stetho.server.ProtocolDetectingSocketHandler$AlwaysMatchMatcher> // 57 117:dup // 58 118:invokespecial #82 <Method void com.facebook.stetho.server.ProtocolDetectingSocketHandler$AlwaysMatchMatcher()> // 59 121:new #84 <Class DevtoolsSocketHandler> // 60 124:dup // 61 125:aload_0 // 62 126:getfield #18 <Field Stetho$Initializer this$0> // 63 129:invokestatic #33 <Method Context Stetho$Initializer.access$100(Stetho$Initializer)> // 64 132:aload_2 // 65 133:invokespecial #87 <Method void DevtoolsSocketHandler(Context, Iterable)> // 66 136:invokevirtual #63 <Method void ProtocolDetectingSocketHandler.addHandler(com.facebook.stetho.server.ProtocolDetectingSocketHandler$MagicMatcher, com.facebook.stetho.server.SocketLikeHandler)> return ((SocketHandler) (protocoldetectingsockethandler)); // 67 139:aload_1 // 68 140:areturn } final Initializer this$0; private Initializer.RealSocketHandlerFactory() { this$0 = Initializer.this; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #18 <Field Stetho$Initializer this$0> super(); // 3 5:aload_0 // 4 6:invokespecial #21 <Method void Object()> // 5 9:return } } public static class InitializerBuilder { public Initializer build() { return ((Initializer) (new BuilderBasedInitializer(this))); // 0 0:new #35 <Class Stetho$BuilderBasedInitializer> // 1 3:dup // 2 4:aload_0 // 3 5:aconst_null // 4 6:invokespecial #38 <Method void Stetho$BuilderBasedInitializer(Stetho$InitializerBuilder, Stetho$1)> // 5 9:areturn } public InitializerBuilder enableDumpapp(DumperPluginsProvider dumperpluginsprovider) { mDumperPlugins = (DumperPluginsProvider)Util.throwIfNull(((Object) (dumperpluginsprovider))); // 0 0:aload_0 // 1 1:aload_1 // 2 2:invokestatic #46 <Method Object Util.throwIfNull(Object)> // 3 5:checkcast #48 <Class DumperPluginsProvider> // 4 8:putfield #50 <Field DumperPluginsProvider mDumperPlugins> return this; // 5 11:aload_0 // 6 12:areturn } public InitializerBuilder enableWebKitInspector(InspectorModulesProvider inspectormodulesprovider) { mInspectorModules = inspectormodulesprovider; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #54 <Field InspectorModulesProvider mInspectorModules> return this; // 3 5:aload_0 // 4 6:areturn } final Context mContext; DumperPluginsProvider mDumperPlugins; InspectorModulesProvider mInspectorModules; private InitializerBuilder(Context context) { // 0 0:aload_0 // 1 1:invokespecial #19 <Method void Object()> mContext = context.getApplicationContext(); // 2 4:aload_0 // 3 5:aload_1 // 4 6:invokevirtual #25 <Method Context Context.getApplicationContext()> // 5 9:putfield #27 <Field Context mContext> // 6 12:return } } private static class PluginBuilder { private void throwIfFinished() { if(!mFinished) //* 0 0:aload_0 //* 1 1:getfield #39 <Field boolean mFinished> //* 2 4:ifne 8 return; // 3 7:return else throw new IllegalStateException("Must not continue to build after finish()"); // 4 8:new #41 <Class IllegalStateException> // 5 11:dup // 6 12:ldc1 #43 <String "Must not continue to build after finish()"> // 7 14:invokespecial #46 <Method void IllegalStateException(String)> // 8 17:athrow } public Iterable finish() { mFinished = true; // 0 0:aload_0 // 1 1:iconst_1 // 2 2:putfield #39 <Field boolean mFinished> return ((Iterable) (mPlugins)); // 3 5:aload_0 // 4 6:getfield #33 <Field ArrayList mPlugins> // 5 9:areturn } public void provide(String s, Object obj) { throwIfFinished(); // 0 0:aload_0 // 1 1:invokespecial #54 <Method void throwIfFinished()> mPlugins.add(obj); // 2 4:aload_0 // 3 5:getfield #33 <Field ArrayList mPlugins> // 4 8:aload_2 // 5 9:invokevirtual #58 <Method boolean ArrayList.add(Object)> // 6 12:pop mProvidedNames.add(((Object) (s))); // 7 13:aload_0 // 8 14:getfield #26 <Field Set mProvidedNames> // 9 17:aload_1 // 10 18:invokeinterface #61 <Method boolean Set.add(Object)> // 11 23:pop // 12 24:return } public void provideIfDesired(String s, Object obj) { throwIfFinished(); // 0 0:aload_0 // 1 1:invokespecial #54 <Method void throwIfFinished()> if(!mRemovedNames.contains(((Object) (s))) && mProvidedNames.add(((Object) (s)))) //* 2 4:aload_0 //* 3 5:getfield #28 <Field Set mRemovedNames> //* 4 8:aload_1 //* 5 9:invokeinterface #66 <Method boolean Set.contains(Object)> //* 6 14:ifne 39 //* 7 17:aload_0 //* 8 18:getfield #26 <Field Set mProvidedNames> //* 9 21:aload_1 //* 10 22:invokeinterface #61 <Method boolean Set.add(Object)> //* 11 27:ifeq 39 mPlugins.add(obj); // 12 30:aload_0 // 13 31:getfield #33 <Field ArrayList mPlugins> // 14 34:aload_2 // 15 35:invokevirtual #58 <Method boolean ArrayList.add(Object)> // 16 38:pop // 17 39:return } public void remove(String s) { throwIfFinished(); // 0 0:aload_0 // 1 1:invokespecial #54 <Method void throwIfFinished()> mRemovedNames.remove(((Object) (s))); // 2 4:aload_0 // 3 5:getfield #28 <Field Set mRemovedNames> // 4 8:aload_1 // 5 9:invokeinterface #69 <Method boolean Set.remove(Object)> // 6 14:pop // 7 15:return } private boolean mFinished; private final ArrayList mPlugins; private final Set mProvidedNames; private final Set mRemovedNames; private PluginBuilder() { // 0 0:aload_0 // 1 1:invokespecial #21 <Method void Object()> mProvidedNames = ((Set) (new HashSet())); // 2 4:aload_0 // 3 5:new #23 <Class HashSet> // 4 8:dup // 5 9:invokespecial #24 <Method void HashSet()> // 6 12:putfield #26 <Field Set mProvidedNames> mRemovedNames = ((Set) (new HashSet())); // 7 15:aload_0 // 8 16:new #23 <Class HashSet> // 9 19:dup // 10 20:invokespecial #24 <Method void HashSet()> // 11 23:putfield #28 <Field Set mRemovedNames> mPlugins = new ArrayList(); // 12 26:aload_0 // 13 27:new #30 <Class ArrayList> // 14 30:dup // 15 31:invokespecial #31 <Method void ArrayList()> // 16 34:putfield #33 <Field ArrayList mPlugins> // 17 37:return } } private Stetho() { // 0 0:aload_0 // 1 1:invokespecial #35 <Method void Object()> // 2 4:return } public static DumperPluginsProvider defaultDumperPluginsProvider(Context context) { return new DumperPluginsProvider(context) { public Iterable get() { return (new DefaultDumperPluginsBuilder(context)).finish(); // 0 0:new #25 <Class Stetho$DefaultDumperPluginsBuilder> // 1 3:dup // 2 4:aload_0 // 3 5:getfield #17 <Field Context val$context> // 4 8:invokespecial #27 <Method void Stetho$DefaultDumperPluginsBuilder(Context)> // 5 11:invokevirtual #30 <Method Iterable Stetho$DefaultDumperPluginsBuilder.finish()> // 6 14:areturn } final Context val$context; { context = context1; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #17 <Field Context val$context> super(); // 3 5:aload_0 // 4 6:invokespecial #20 <Method void Object()> // 5 9:return } } ; // 0 0:new #8 <Class Stetho$2> // 1 3:dup // 2 4:aload_0 // 3 5:invokespecial #41 <Method void Stetho$2(Context)> // 4 8:areturn } public static InspectorModulesProvider defaultInspectorModulesProvider(Context context) { return new InspectorModulesProvider(context) { public Iterable get() { return (new DefaultInspectorModulesBuilder(context)).finish(); // 0 0:new #25 <Class Stetho$DefaultInspectorModulesBuilder> // 1 3:dup // 2 4:aload_0 // 3 5:getfield #17 <Field Context val$context> // 4 8:invokespecial #27 <Method void Stetho$DefaultInspectorModulesBuilder(Context)> // 5 11:invokevirtual #30 <Method Iterable Stetho$DefaultInspectorModulesBuilder.finish()> // 6 14:areturn } final Context val$context; { context = context1; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #17 <Field Context val$context> super(); // 3 5:aload_0 // 4 6:invokespecial #20 <Method void Object()> // 5 9:return } } ; // 0 0:new #10 <Class Stetho$3> // 1 3:dup // 2 4:aload_0 // 3 5:invokespecial #44 <Method void Stetho$3(Context)> // 4 8:areturn } public static void initialize(Initializer initializer) { if(!ActivityTracker.get().beginTrackingIfPossible((Application)initializer.mContext.getApplicationContext())) //* 0 0:invokestatic #52 <Method ActivityTracker ActivityTracker.get()> //* 1 3:aload_0 //* 2 4:invokestatic #56 <Method Context Stetho$Initializer.access$100(Stetho$Initializer)> //* 3 7:invokevirtual #62 <Method Context Context.getApplicationContext()> //* 4 10:checkcast #64 <Class Application> //* 5 13:invokevirtual #68 <Method boolean ActivityTracker.beginTrackingIfPossible(Application)> //* 6 16:ifne 24 LogUtil.w("Automatic activity tracking not available on this API level, caller must invoke ActivityTracker methods manually!"); // 7 19:ldc1 #70 <String "Automatic activity tracking not available on this API level, caller must invoke ActivityTracker methods manually!"> // 8 21:invokestatic #76 <Method void LogUtil.w(String)> initializer.start(); // 9 24:aload_0 // 10 25:invokevirtual #79 <Method void Stetho$Initializer.start()> // 11 28:return } public static void initializeWithDefaults(Context context) { initialize(((Initializer) (new Initializer(context, context) { protected Iterable getDumperPlugins() { return (new DefaultDumperPluginsBuilder(context)).finish(); // 0 0:new #22 <Class Stetho$DefaultDumperPluginsBuilder> // 1 3:dup // 2 4:aload_0 // 3 5:getfield #15 <Field Context val$context> // 4 8:invokespecial #23 <Method void Stetho$DefaultDumperPluginsBuilder(Context)> // 5 11:invokevirtual #26 <Method Iterable Stetho$DefaultDumperPluginsBuilder.finish()> // 6 14:areturn } protected Iterable getInspectorModules() { return (new DefaultInspectorModulesBuilder(context)).finish(); // 0 0:new #31 <Class Stetho$DefaultInspectorModulesBuilder> // 1 3:dup // 2 4:aload_0 // 3 5:getfield #15 <Field Context val$context> // 4 8:invokespecial #32 <Method void Stetho$DefaultInspectorModulesBuilder(Context)> // 5 11:invokevirtual #33 <Method Iterable Stetho$DefaultInspectorModulesBuilder.finish()> // 6 14:areturn } final Context val$context; { context = context2; // 0 0:aload_0 // 1 1:aload_2 // 2 2:putfield #15 <Field Context val$context> super(context1); // 3 5:aload_0 // 4 6:aload_1 // 5 7:invokespecial #17 <Method void Stetho$Initializer(Context)> // 6 10:return } } ))); // 0 0:new #6 <Class Stetho$1> // 1 3:dup // 2 4:aload_0 // 3 5:aload_0 // 4 6:invokespecial #83 <Method void Stetho$1(Context, Context)> // 5 9:invokestatic #85 <Method void initialize(Stetho$Initializer)> // 6 12:return } public static InitializerBuilder newInitializerBuilder(Context context) { return new InitializerBuilder(context); // 0 0:new #27 <Class Stetho$InitializerBuilder> // 1 3:dup // 2 4:aload_0 // 3 5:aconst_null // 4 6:invokespecial #90 <Method void Stetho$InitializerBuilder(Context, Stetho$1)> // 5 9:areturn } }
92400f89abd0ce7c0716cdd9130cda5d4236f051
975
java
Java
spring-boot-sample-orika/src/main/java/com/sample/springboot/orika/enums/SampleEnum.java
zcy0521/spring-boot-samples
c18b26271095e827fc797b4359b96dea41cec0a2
[ "Apache-2.0" ]
null
null
null
spring-boot-sample-orika/src/main/java/com/sample/springboot/orika/enums/SampleEnum.java
zcy0521/spring-boot-samples
c18b26271095e827fc797b4359b96dea41cec0a2
[ "Apache-2.0" ]
1
2020-09-11T11:08:24.000Z
2020-09-11T11:08:24.000Z
spring-boot-sample-orika/src/main/java/com/sample/springboot/orika/enums/SampleEnum.java
zcy0521/spring-boot-samples
c18b26271095e827fc797b4359b96dea41cec0a2
[ "Apache-2.0" ]
null
null
null
20.744681
91
0.575385
1,001,388
package com.sample.springboot.orika.enums; import lombok.Getter; /** * 枚举示例 */ @Getter public enum SampleEnum implements Enums { ENUM_A(3, "枚举A"), ENUM_B(6, "枚举B"), ENUM_C(9, "枚举C"), ENUM_UNKNOWN(0, "枚举UNKNOWN"); private final int value; private final String label; SampleEnum(int value, String label) { this.value = value; this.label = label; } @Override public int value() { return this.value; } public static SampleEnum valueOf(int value){ SampleEnum sampleEnum = resolve(value); if (sampleEnum == null) { throw new IllegalArgumentException("No matching constant for [" + value + "]"); } return sampleEnum; } public static SampleEnum resolve(int value) { for (SampleEnum sampleEnum : values()) { if (sampleEnum.value == value) { return sampleEnum; } } return null; } }
92400fe2ca9e7a0ca019724b5433889aae7c278e
1,812
java
Java
src/Key.java
golikov-nik/merkle-hellman
fdfa34471b2a55c4505459dec552237590b6d027
[ "MIT" ]
1
2017-10-21T09:37:45.000Z
2017-10-21T09:37:45.000Z
src/Key.java
golikov-nik/merkle-hellman
fdfa34471b2a55c4505459dec552237590b6d027
[ "MIT" ]
null
null
null
src/Key.java
golikov-nik/merkle-hellman
fdfa34471b2a55c4505459dec552237590b6d027
[ "MIT" ]
null
null
null
26.647059
84
0.698675
1,001,389
import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.math.BigInteger; import java.net.URL; import java.net.URLConnection; import java.util.Arrays; import java.util.Scanner; public class Key { PrivateKey privateKey; private BigInteger[] publicKey; Key(BigInteger[] publicKey, PrivateKey privateKey) { this.publicKey = publicKey; this.privateKey = privateKey; } BigInteger[] getPublicKey() { return publicKey.clone(); } public void saveKey(File dir) throws FileNotFoundException { if (publicKey != null && privateKey != null) { dir.mkdirs(); File publicKeyFile = new File(dir.getAbsolutePath() + "/mh.pubkey.txt"); File privateKeyFile = new File(dir.getAbsolutePath() + "/mh.privatekey.txt"); PrintWriter out = new PrintWriter(publicKeyFile); out.println(publicKey.length); Arrays.stream(publicKey).forEach(out::println); out.close(); out = new PrintWriter (privateKeyFile); out.println(privateKey.q); out.println(privateKey.r); out.println(); out.println(publicKey.length); Arrays.stream(privateKey.seq).forEach(out::println); out.close(); } return; } public static BigInteger[] loadPublicKey(File input) throws FileNotFoundException { Scanner in = new Scanner(input); int n = in.nextInt(); BigInteger[] ans = new BigInteger[n]; for (int i = 0; i < n; i++) { ans[i] = in.nextBigInteger(); } in.close(); return ans; } public static BigInteger[] loadPublicKey(URL url) throws IOException { URLConnection conn = url.openConnection(); Scanner in = new Scanner(conn.getInputStream()); int n = in.nextInt(); BigInteger[] ans = new BigInteger[n]; for (int i = 0; i < n; i++) { ans[i] = in.nextBigInteger(); } in.close(); return ans; } }
924011e8831b9b8e79451e52d0b702547eca53b5
3,936
java
Java
src/mapred/org/apache/hadoop/mapred/ResourceEstimator.java
Mingcong/hadoop-1.2.1-cpu-gpu
da1c60956e548502a5964232fff406a606b964e1
[ "Apache-2.0" ]
22
2015-01-24T07:32:25.000Z
2021-06-21T09:08:31.000Z
src/mapred/org/apache/hadoop/mapred/ResourceEstimator.java
Mingcong/hadoop-1.2.1-cpu-gpu
da1c60956e548502a5964232fff406a606b964e1
[ "Apache-2.0" ]
1
2022-02-21T13:46:19.000Z
2022-02-21T13:46:19.000Z
src/mapred/org/apache/hadoop/mapred/ResourceEstimator.java
Mingcong/hadoop-1.2.1-cpu-gpu
da1c60956e548502a5964232fff406a606b964e1
[ "Apache-2.0" ]
62
2015-03-16T04:44:16.000Z
2021-12-17T16:46:52.000Z
32.262295
76
0.69563
1,001,390
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.mapred; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Class responsible for modeling the resource consumption of running tasks. * * For now, we just do temp space for maps * * There is one ResourceEstimator per JobInProgress * */ class ResourceEstimator { //Log with JobInProgress private static final Log LOG = LogFactory.getLog( "org.apache.hadoop.mapred.ResourceEstimator"); private long completedMapsInputSize; private long completedMapsOutputSize; private int completedMapsUpdates; final private JobInProgress job; private int threshholdToUse; public ResourceEstimator(JobInProgress job) { this.job = job; threshholdToUse = job.desiredMaps()/ 10; } protected synchronized void updateWithCompletedTask(TaskStatus ts, TaskInProgress tip) { //-1 indicates error, which we don't average in. if(tip.isMapTask() && ts.getOutputSize() != -1) { completedMapsUpdates++; completedMapsInputSize+=(tip.getMapInputSize()+1); completedMapsOutputSize+=ts.getOutputSize(); if(LOG.isDebugEnabled()) { LOG.debug("completedMapsUpdates:"+completedMapsUpdates+" "+ "completedMapsInputSize:"+completedMapsInputSize+" " + "completedMapsOutputSize:"+completedMapsOutputSize); } } } /** * @return estimated length of this job's total map output */ protected synchronized long getEstimatedTotalMapOutputSize() { if(completedMapsUpdates < threshholdToUse) { return 0; } else { long inputSize = job.getInputLength() + job.desiredMaps(); //add desiredMaps() so that randomwriter case doesn't blow up //the multiplication might lead to overflow, casting it with //double prevents it long estimate = Math.round(((double)inputSize * completedMapsOutputSize * 2.0)/completedMapsInputSize); if (LOG.isDebugEnabled()) { LOG.debug("estimate total map output will be " + estimate); } return estimate; } } /** * @return estimated length of this job's average map output */ long getEstimatedMapOutputSize() { long estimate = 0L; if (job.desiredMaps() > 0) { estimate = getEstimatedTotalMapOutputSize() / job.desiredMaps(); } return estimate; } /** * * @return estimated length of this job's average reduce input */ long getEstimatedReduceInputSize() { if(job.desiredReduces() == 0) {//no reduce output, so no size return 0; } else { return getEstimatedTotalMapOutputSize() / job.desiredReduces(); //estimate that each reduce gets an equal share of total map output } } /** * the number of maps after which reduce starts launching * @param numMaps the number of maps after which reduce starts * launching. It acts as the upper bound for the threshhold, so * that we can get right estimates before we reach these number * of maps. */ void setThreshhold(int numMaps) { threshholdToUse = Math.min(threshholdToUse, numMaps); } }
924011eea2ed2ded5d68b8eb4b9c3513989569ff
441
java
Java
PetOfficeDemoApi/PetOfficeDemoCore/src/test/java/com/example/demo/petoffice/rest/TestConfiguration.java
ipeonte/PetCorpKafkaDemo
3f15143f7ab6f3c8813bef7aa3abc0799daf94a1
[ "Apache-2.0" ]
1
2021-05-17T05:00:24.000Z
2021-05-17T05:00:24.000Z
PetOfficeDemoApi/PetOfficeDemoCore/src/test/java/com/example/demo/petoffice/rest/TestConfiguration.java
ipeonte/PetCorpKafkaDemo
3f15143f7ab6f3c8813bef7aa3abc0799daf94a1
[ "Apache-2.0" ]
null
null
null
PetOfficeDemoApi/PetOfficeDemoCore/src/test/java/com/example/demo/petoffice/rest/TestConfiguration.java
ipeonte/PetCorpKafkaDemo
3f15143f7ab6f3c8813bef7aa3abc0799daf94a1
[ "Apache-2.0" ]
null
null
null
31.5
83
0.875283
1,001,391
package com.example.demo.petoffice.rest; import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration; import org.springframework.context.annotation.Import; @SpringBootConfiguration @EnableAutoConfiguration @Import(TestChannelBinderConfiguration.class) public class TestConfiguration { }
924012b961aa3ff650c2bed68b86ccfe971a18cd
3,240
java
Java
core/src/de/homelab/madgaksha/lotsofbs/entityengine/entitysystem/ModelRenderSystem.java
blutorange/lotsOfBSGdx
d5474f7a5090e1f919ef00280c91b0077249d51c
[ "CC0-1.0" ]
1
2016-05-30T11:37:26.000Z
2016-05-30T11:37:26.000Z
core/src/de/homelab/madgaksha/lotsofbs/entityengine/entitysystem/ModelRenderSystem.java
blutorange/lotsOfBSGdx
d5474f7a5090e1f919ef00280c91b0077249d51c
[ "CC0-1.0" ]
4
2016-06-05T22:31:28.000Z
2016-06-30T10:58:41.000Z
core/src/de/homelab/madgaksha/lotsofbs/entityengine/entitysystem/ModelRenderSystem.java
blutorange/lotsOfBSGdx
d5474f7a5090e1f919ef00280c91b0077249d51c
[ "CC0-1.0" ]
null
null
null
36
114
0.783642
1,001,392
package de.homelab.madgaksha.lotsofbs.entityengine.entitysystem; import static de.homelab.madgaksha.lotsofbs.GlobalBag.batchModel; import static de.homelab.madgaksha.lotsofbs.GlobalBag.level; import static de.homelab.madgaksha.lotsofbs.GlobalBag.viewportGame; import com.badlogic.ashley.core.Engine; import com.badlogic.ashley.core.Entity; import com.badlogic.ashley.core.EntitySystem; import com.badlogic.ashley.core.Family; import com.badlogic.ashley.utils.ImmutableArray; import com.badlogic.gdx.graphics.g3d.Environment; import de.homelab.madgaksha.lotsofbs.entityengine.DefaultPriority; import de.homelab.madgaksha.lotsofbs.entityengine.Mapper; import de.homelab.madgaksha.lotsofbs.entityengine.component.InvisibleComponent; import de.homelab.madgaksha.lotsofbs.entityengine.component.ModelComponent; import de.homelab.madgaksha.lotsofbs.entityengine.component.PositionComponent; import de.homelab.madgaksha.lotsofbs.entityengine.component.RotationComponent; import de.homelab.madgaksha.lotsofbs.entityengine.component.ScaleComponent; import de.homelab.madgaksha.lotsofbs.entityengine.component.boundingbox.BoundingBoxRenderComponent; import de.homelab.madgaksha.lotsofbs.logging.Logger; import de.homelab.madgaksha.lotsofbs.util.GeoUtil; public class ModelRenderSystem extends EntitySystem { @SuppressWarnings("unused") private final static Logger LOG = Logger.getLogger(ModelRenderSystem.class); private Family family = null; private ImmutableArray<Entity> entities; private final Environment environment; public ModelRenderSystem() { this(DefaultPriority.modelRenderSystem); } public ModelRenderSystem(final int priority) { super(priority); this.family = Family.all(ModelComponent.class, PositionComponent.class).exclude(InvisibleComponent.class).get(); environment = level.getEnvironment(); } @Override public void update(final float deltaTime) { // Apply projection matrix and render models. batchModel.begin(viewportGame.getCamera()); for (int i = 0; i < entities.size(); ++i) { final Entity entity = entities.get(i); final ModelComponent mc = Mapper.modelComponent.get(entity); final PositionComponent pc = Mapper.positionComponent.get(entity); final RotationComponent rc = Mapper.rotationComponent.get(entity); final ScaleComponent sc = Mapper.scaleComponent.get(entity); final BoundingBoxRenderComponent bbrc = Mapper.boundingBoxRenderComponent.get(entity); mc.modelInstance.transform.idt(); // Do not render if off-screen. if (bbrc != null && !GeoUtil.boundingBoxVisible(bbrc, pc)) continue; // Set position. mc.modelInstance.transform.translate(pc.x + pc.offsetX, pc.y + pc.offsetY, pc.z + pc.offsetZ); // Scale if desired. if (sc != null) mc.modelInstance.transform.scale(sc.scaleX, sc.scaleY, sc.scaleZ); // Rotate if desired. if (rc != null) { mc.modelInstance.transform.rotate(rc.axisX, rc.axisY, rc.axisZ, rc.thetaZ); } // Render model. batchModel.render(mc.modelInstance, environment); } batchModel.end(); } @Override public void addedToEngine(final Engine engine) { entities = engine.getEntitiesFor(family); } @Override public void removedFromEngine(final Engine engine) { entities = null; } }
924012fbeb4987955165f8c09e82bb2f9f6e9f54
2,651
java
Java
src/main/java/jp/co/tis/tiscon3/configuration/ApplicationConfiguration.java
MoriTomo7315/tiscon3
6d08c4623614e09f39ac224feb1c8587ff34f8ea
[ "Apache-2.0" ]
null
null
null
src/main/java/jp/co/tis/tiscon3/configuration/ApplicationConfiguration.java
MoriTomo7315/tiscon3
6d08c4623614e09f39ac224feb1c8587ff34f8ea
[ "Apache-2.0" ]
null
null
null
src/main/java/jp/co/tis/tiscon3/configuration/ApplicationConfiguration.java
MoriTomo7315/tiscon3
6d08c4623614e09f39ac224feb1c8587ff34f8ea
[ "Apache-2.0" ]
null
null
null
42.079365
121
0.706526
1,001,393
package jp.co.tis.tiscon3.configuration; import enkan.Application; import enkan.application.WebApplication; import enkan.endpoint.ResourceEndpoint; import enkan.middleware.*; import enkan.middleware.devel.*; import enkan.middleware.doma2.DomaTransactionMiddleware; import kotowari.middleware.*; import kotowari.middleware.serdes.ToStringBodyWriter; import enkan.system.inject.ComponentInjector; import kotowari.routing.Routes; import jp.co.tis.tiscon3.controller.IndexController; import static enkan.util.BeanBuilder.builder; import static enkan.util.Predicates.*; import jp.co.tis.tiscon3.controller.CardOrderController; public class ApplicationConfiguration implements enkan.config.ApplicationFactory { @Override public Application create(ComponentInjector injector) { WebApplication app = new WebApplication(); Routes routes = Routes.define( r -> { r.get("/").to(IndexController.class, "index"); r.get("/cardOrder/user").to(CardOrderController.class, "inputUser"); r.post("/cardOrder/user").to(CardOrderController.class, "inputJob"); r.post("/cardOrder/modify").to(CardOrderController.class, "modifyUser"); r.get("/cardOrder/completed").to(CardOrderController.class, "completed"); r.resource(CardOrderController.class); }).compile(); app.use(new DefaultCharsetMiddleware()); app.use(NONE, new ServiceUnavailableMiddleware(new ResourceEndpoint("/public/html/503.html"))); app.use(envIn("development"), new StacktraceMiddleware()); app.use(envIn("development"), new TraceWebMiddleware()); app.use(new TraceMiddleware()); app.use(new ContentTypeMiddleware()); app.use(envIn("development"), new HttpStatusCatMiddleware()); app.use(new ParamsMiddleware()); app.use(new MultipartParamsMiddleware()); app.use(new MethodOverrideMiddleware()); app.use(new NormalizationMiddleware()); app.use(new NestedParamsMiddleware()); app.use(new CookiesMiddleware()); app.use(new SessionMiddleware()); app.use(new ContentNegotiationMiddleware()); app.use(new ResourceMiddleware()); app.use(new RenderTemplateMiddleware()); app.use(new RoutingMiddleware(routes)); app.use(new DomaTransactionMiddleware()); app.use(new FormMiddleware()); app.use(builder(new SerDesMiddleware()).set(SerDesMiddleware::setBodyWriters, new ToStringBodyWriter()).build()); app.use(new ValidateBodyMiddleware<>()); app.use(new ControllerInvokerMiddleware(injector)); return app; } }
92401372e90b7e7dd3522c5d1986e1935c8d9a1b
403
java
Java
crm-nobug/src/main/java/com/bjpowernode/crm/settings/web/controller/SettingsIndexController.java
wuhuwuhu11/crm
be6623e1ccdc3470e0704f1d285d090f3e6388bd
[ "MIT" ]
null
null
null
crm-nobug/src/main/java/com/bjpowernode/crm/settings/web/controller/SettingsIndexController.java
wuhuwuhu11/crm
be6623e1ccdc3470e0704f1d285d090f3e6388bd
[ "MIT" ]
null
null
null
crm-nobug/src/main/java/com/bjpowernode/crm/settings/web/controller/SettingsIndexController.java
wuhuwuhu11/crm
be6623e1ccdc3470e0704f1d285d090f3e6388bd
[ "MIT" ]
null
null
null
22.388889
62
0.712159
1,001,394
package com.bjpowernode.crm.settings.web.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping("/settings") public class SettingsIndexController { /** * 跳转到系统设置首页面 * @return */ @RequestMapping("/toIndex.do") public String toIndex(){ return "/settings/index"; } }
92401533d9f34dd6c819a1ce28480619e7c7c560
216
java
Java
src/main/java/spring/service/OrderService.java
Dodoboulistick/pokeisti
90a0bdc00bf22cfb02452f47ea9b58a7ac4c93d0
[ "Apache-2.0" ]
null
null
null
src/main/java/spring/service/OrderService.java
Dodoboulistick/pokeisti
90a0bdc00bf22cfb02452f47ea9b58a7ac4c93d0
[ "Apache-2.0" ]
null
null
null
src/main/java/spring/service/OrderService.java
Dodoboulistick/pokeisti
90a0bdc00bf22cfb02452f47ea9b58a7ac4c93d0
[ "Apache-2.0" ]
null
null
null
16.615385
31
0.75463
1,001,395
package spring.service; import java.util.List; import spring.model.Order; public interface OrderService { void save(Order order); Order getOrder(int order_id); void delete(int order_id); List<Order> list(); }
924016516c98a8b250ec48bde4fa6a52aab767d9
913
java
Java
geequery-orm/src/main/java/com/github/geequery/dialect/function/EmuPostgresExtract.java
GeeQuery/geequery-orm
3bd184363038f8f323be392d68796a0a40817bc1
[ "Apache-2.0" ]
1
2018-06-28T06:33:04.000Z
2018-06-28T06:33:04.000Z
geequery-orm/src/main/java/com/github/geequery/dialect/function/EmuPostgresExtract.java
GeeQuery/geequery
3bd184363038f8f323be392d68796a0a40817bc1
[ "Apache-2.0" ]
null
null
null
geequery-orm/src/main/java/com/github/geequery/dialect/function/EmuPostgresExtract.java
GeeQuery/geequery
3bd184363038f8f323be392d68796a0a40817bc1
[ "Apache-2.0" ]
null
null
null
24.675676
71
0.775465
1,001,396
package com.github.geequery.dialect.function; import java.util.List; import com.github.geequery.jsqlparser.expression.Function; import com.github.geequery.jsqlparser.expression.SqlExpression; import com.github.geequery.jsqlparser.visitor.Expression; /** * 在postgres上模拟year, month, day, hour, minute, second六个函数 * @author jiyi * */ public class EmuPostgresExtract extends BaseArgumentSqlFunction{ private String name; private Expression fieldName; public EmuPostgresExtract(String name){ this(name,name); } public EmuPostgresExtract(String name,String fieldString){ this.name=name; this.fieldName=new SqlExpression(fieldString); } public String getName() { return name; } public Expression renderExpression(List<Expression> arguments) { Function function=new Function("extract",fieldName,arguments.get(0)); function.getParameters().setBetween(" from "); return function; } }
924016a839e06f2fcffcc88ccf2d240eef9c3770
1,608
java
Java
support/cas-server-support-saml-idp-metadata-jpa/src/main/java/org/apereo/cas/support/saml/idp/metadata/JpaSamlIdPMetadataLocator.java
tswstarplanet/cas
c026d1a7598e02e11cd9ed248b76a7973ee67052
[ "Apache-2.0" ]
2
2019-05-23T15:45:42.000Z
2021-07-01T01:49:54.000Z
support/cas-server-support-saml-idp-metadata-jpa/src/main/java/org/apereo/cas/support/saml/idp/metadata/JpaSamlIdPMetadataLocator.java
tswstarplanet/cas
c026d1a7598e02e11cd9ed248b76a7973ee67052
[ "Apache-2.0" ]
3
2019-02-26T14:14:14.000Z
2019-02-26T14:24:06.000Z
support/cas-server-support-saml-idp-metadata-jpa/src/main/java/org/apereo/cas/support/saml/idp/metadata/JpaSamlIdPMetadataLocator.java
tswstarplanet/cas
c026d1a7598e02e11cd9ed248b76a7973ee67052
[ "Apache-2.0" ]
1
2020-10-14T04:44:19.000Z
2020-10-14T04:44:19.000Z
34.956522
129
0.779851
1,001,397
package org.apereo.cas.support.saml.idp.metadata; import org.apereo.cas.CipherExecutor; import org.apereo.cas.support.saml.idp.metadata.locator.AbstractSamlIdPMetadataLocator; import org.apereo.cas.support.saml.services.idp.metadata.SamlIdPMetadataDocument; import lombok.extern.slf4j.Slf4j; import lombok.val; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import javax.persistence.NoResultException; import javax.persistence.PersistenceContext; /** * This is {@link JpaSamlIdPMetadataLocator}. * * @author Misagh Moayyed * @since 6.0.0 */ @EnableTransactionManagement(proxyTargetClass = true) @Transactional(transactionManager = "transactionManagerSamlMetadataIdP") @Slf4j public class JpaSamlIdPMetadataLocator extends AbstractSamlIdPMetadataLocator { @PersistenceContext(unitName = "samlMetadataIdPEntityManagerFactory") private transient EntityManager entityManager; public JpaSamlIdPMetadataLocator(final CipherExecutor<String, String> metadataCipherExecutor) { super(metadataCipherExecutor); } @Override public SamlIdPMetadataDocument fetchInternal() { try { val query = this.entityManager.createQuery("SELECT r FROM SamlIdPMetadataDocument r", SamlIdPMetadataDocument.class); setMetadataDocument(query.setMaxResults(1).getSingleResult()); } catch (final NoResultException e) { LOGGER.debug(e.getMessage(), e); } return getMetadataDocument(); } }
924016beaaa86951b4657c29364a1a5a1eafd919
349
java
Java
app/src/main/java/com/jlmd/android/newfilmsmvp/domain/comparator/MovieTitleComparator.java
CodeApeZeph/UpcomingMoviesMVP
d3dffe6b9351de9888d64dde987db46000c8f5d2
[ "Apache-2.0" ]
599
2015-01-23T18:44:48.000Z
2021-09-13T03:41:56.000Z
app/src/main/java/com/jlmd/android/newfilmsmvp/domain/comparator/MovieTitleComparator.java
CodeApeZeph/UpcomingMoviesMVP
d3dffe6b9351de9888d64dde987db46000c8f5d2
[ "Apache-2.0" ]
3
2015-02-11T17:20:30.000Z
2015-03-31T12:36:47.000Z
app/src/main/java/com/jlmd/android/newfilmsmvp/domain/comparator/MovieTitleComparator.java
jlmd/UpcomingMoviesMVP
d3dffe6b9351de9888d64dde987db46000c8f5d2
[ "Apache-2.0" ]
130
2015-02-08T15:36:19.000Z
2019-05-03T00:09:58.000Z
21.8125
64
0.750716
1,001,398
package com.jlmd.android.newfilmsmvp.domain.comparator; import com.jlmd.android.newfilmsmvp.domain.model.Movie; import java.util.Comparator; /** * @author jlmd */ public class MovieTitleComparator implements Comparator<Movie> { @Override public int compare(Movie lhs, Movie rhs) { return lhs.getTitle().compareTo(rhs.getTitle()); } }
924016d2735b825352bca87e24069e6a194bd01d
528
java
Java
spring-ultron-projects/ultron-wechat/src/main/java/org/springultron/wechat/encrypt/ByteGroup.java
wenyuantc/spring-ultron
46afe6c2d0f8395cecc8ab56541464fb092c12f5
[ "Apache-2.0" ]
9
2019-05-31T08:11:05.000Z
2022-02-26T05:24:02.000Z
spring-ultron-projects/ultron-wechat/src/main/java/org/springultron/wechat/encrypt/ByteGroup.java
wenyuantc/spring-ultron
46afe6c2d0f8395cecc8ab56541464fb092c12f5
[ "Apache-2.0" ]
1
2020-09-08T07:21:07.000Z
2020-11-16T08:15:37.000Z
spring-ultron-projects/ultron-wechat/src/main/java/org/springultron/wechat/encrypt/ByteGroup.java
wenyuantc/spring-ultron
46afe6c2d0f8395cecc8ab56541464fb092c12f5
[ "Apache-2.0" ]
1
2020-09-08T07:21:44.000Z
2020-09-08T07:21:44.000Z
19.555556
52
0.623106
1,001,399
package org.springultron.wechat.encrypt; import java.util.ArrayList; class ByteGroup { ArrayList<Byte> byteContainer = new ArrayList<>(); public byte[] toBytes() { byte[] bytes = new byte[byteContainer.size()]; for (int i = 0; i < byteContainer.size(); i++) { bytes[i] = byteContainer.get(i); } return bytes; } public ByteGroup addBytes(byte[] bytes) { for (byte b : bytes) { byteContainer.add(b); } return this; } public int size() { return byteContainer.size(); } }
92401704674a60e9df9729a9b35d5f5d9f53bbe6
1,639
java
Java
platform/lang-impl/src/com/intellij/largeFilesEditor/actions/LfeEditorActionHandlerEscape.java
dunno99/intellij-community
aa656a5d874b947271b896b2105e4370827b9149
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
platform/lang-impl/src/com/intellij/largeFilesEditor/actions/LfeEditorActionHandlerEscape.java
dunno99/intellij-community
aa656a5d874b947271b896b2105e4370827b9149
[ "Apache-2.0" ]
2
2022-02-19T09:45:05.000Z
2022-02-27T20:32:55.000Z
platform/lang-impl/src/com/intellij/largeFilesEditor/actions/LfeEditorActionHandlerEscape.java
dunno99/intellij-community
aa656a5d874b947271b896b2105e4370827b9149
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
40.975
140
0.705308
1,001,400
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.largeFilesEditor.actions; import com.intellij.find.SearchReplaceComponent; import com.intellij.largeFilesEditor.editor.LargeFileEditor; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.editor.Caret; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.actionSystem.EditorActionHandler; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class LfeEditorActionHandlerEscape extends LfeBaseEditorActionHandler { public LfeEditorActionHandlerEscape(EditorActionHandler originalHandler) { super(originalHandler); } @Override protected void doExecuteInLfe(@NotNull LargeFileEditor largeFileEditor, @NotNull Editor editor, @Nullable Caret caret, DataContext dataContext) { if (largeFileEditor.getEditor().getHeaderComponent() instanceof SearchReplaceComponent) { largeFileEditor.getSearchManager().onEscapePressed(); } else if (getOriginalHandler().isEnabled(editor, caret, dataContext)) { getOriginalHandler().execute(editor, caret, dataContext); } } @Override protected boolean isEnabledInLfe(@NotNull LargeFileEditor largeFileEditor, @NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) { return true; } }
92401743f1328a6ed170b122ae61a466b8c6d083
1,314
java
Java
src/test/hdfs/org/apache/hadoop/hdfs/TestDfsOverAvroRpc.java
UlisesVelazquez208/hadoop-hdfs-trunk
c28fd8d4dc690f61646b2feea79c7376a1bbb810
[ "Apache-2.0" ]
205
2015-03-16T15:52:32.000Z
2022-03-21T11:44:03.000Z
src/test/hdfs/org/apache/hadoop/hdfs/TestDfsOverAvroRpc.java
UlisesVelazquez208/hadoop-hdfs-trunk
c28fd8d4dc690f61646b2feea79c7376a1bbb810
[ "Apache-2.0" ]
1
2021-11-04T12:19:38.000Z
2021-11-04T12:19:38.000Z
src/test/hdfs/org/apache/hadoop/hdfs/TestDfsOverAvroRpc.java
UlisesVelazquez208/hadoop-hdfs-trunk
c28fd8d4dc690f61646b2feea79c7376a1bbb810
[ "Apache-2.0" ]
151
2015-01-08T04:55:28.000Z
2022-03-23T14:15:14.000Z
38.647059
75
0.743531
1,001,401
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hdfs; import java.io.IOException; /** Test for simple signs of life using Avro RPC. Not an exhaustive test * yet, just enough to catch fundamental problems using Avro reflection to * infer namenode RPC protocols. */ public class TestDfsOverAvroRpc extends TestLocalDFS { public void testWorkingDirectory() throws IOException { System.setProperty("hdfs.rpc.engine", "org.apache.hadoop.ipc.AvroRpcEngine"); super.testWorkingDirectory(); } }
9240174b77e9f28755e30edeb15be4e87f325948
1,748
java
Java
src/test/java/com/oroarmor/neural_network/numberID/Gunzipper.java
OroArmor/NeuralNetwork
248af29caa660fc42be750f0ad57247e8c3a6f64
[ "MIT" ]
null
null
null
src/test/java/com/oroarmor/neural_network/numberID/Gunzipper.java
OroArmor/NeuralNetwork
248af29caa660fc42be750f0ad57247e8c3a6f64
[ "MIT" ]
null
null
null
src/test/java/com/oroarmor/neural_network/numberID/Gunzipper.java
OroArmor/NeuralNetwork
248af29caa660fc42be750f0ad57247e8c3a6f64
[ "MIT" ]
null
null
null
36.416667
81
0.699657
1,001,402
/* * MIT License * * Copyright (c) 2021 OroArmor * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.oroarmor.neural_network.numberID; import java.io.*; import java.util.zip.GZIPInputStream; public class Gunzipper { private InputStream in; public Gunzipper(File f) throws IOException { in = new FileInputStream(f); } public void unzip(File fileTo) throws IOException { try (OutputStream out = new FileOutputStream(fileTo)) { in = new GZIPInputStream(in); byte[] buffer = new byte[65536]; int noRead; while ((noRead = in.read(buffer)) != -1) { out.write(buffer, 0, noRead); } } } }
924019f9d41f896fa60df92a344e682797a93c2c
8,130
java
Java
test/testmodel/testeasyanimator/TestClarkInputFiles.java
kueselj/EasyAnimator
aa3c80dbf20214c70dd76c623d4819edfee62c89
[ "Unlicense" ]
null
null
null
test/testmodel/testeasyanimator/TestClarkInputFiles.java
kueselj/EasyAnimator
aa3c80dbf20214c70dd76c623d4819edfee62c89
[ "Unlicense" ]
null
null
null
test/testmodel/testeasyanimator/TestClarkInputFiles.java
kueselj/EasyAnimator
aa3c80dbf20214c70dd76c623d4819edfee62c89
[ "Unlicense" ]
null
null
null
53.486842
96
0.592743
1,001,403
package testmodel.testeasyanimator; import org.junit.Test; import java.io.StringReader; import cs3500.easyanimator.model.IAnimatorModel; import cs3500.easyanimator.util.AnimationBuilder; import cs3500.easyanimator.util.AnimationReader; import cs3500.easyanimator.util.EasyAnimatorModelBuilder; import static org.junit.Assert.assertEquals; /** * A test suite dedicated to ensuring that our model is compatible with the input files provided * in class by mocking the inputs that we will receive. This is an abstract series of tests in * anticipation of having two different implementations of models. */ public abstract class TestClarkInputFiles { /** * Get the builder optimized for this implementation of model. * @return A new instance of a builder to use to build out a model. */ abstract AnimationBuilder<IAnimatorModel> getBuilder(); /** * Implements the test suite for our version of the model. */ public static class EasyAnimatorTest extends TestClarkInputFiles { @Override AnimationBuilder<IAnimatorModel> getBuilder() { return new EasyAnimatorModelBuilder(); } } private static String SMALLDEMO = "" + "# initializes the canvas, with top-left corner (200,70) and\n" + "# dimensions 360x360\n" + "canvas 200 70 360 360\n" + "# declares a rectangle shape named R\n" + "shape R rectangle\n" + "# describes the motions of shape R, between two moments of animation:\n" + "# t == tick\n" + "# (x,y) == position\n" + "# (w,h) == dimensions\n" + "# (r,g,b) == color (with values between 0 and 255)\n" + "# start end\n" + "# -------------------------- ----------------------------\n" + "# t x y w h r g b t x y w h r g b\n" + "motion R 1 200 200 50 100 255 0 0 10 200 200 50 100 255 0 0\n" + "motion R 10 200 200 50 100 255 0 0 50 300 300 50 100 255 0 0\n" + "motion R 50 300 300 50 100 255 0 0 51 300 300 50 100 255 0 0\n" + "motion R 51 300 300 50 100 255 0 0 70 300 300 25 100 255 0 0\n" + "motion R 70 300 300 25 100 255 0 0 100 200 200 25 100 255 0 0\n" + "\n" + "shape C ellipse\n" + "motion C 6 440 70 120 60 0 0 255 # start state\n" + " 20 440 70 120 60 0 0 255 # end state\n" + "motion C 20 440 70 120 60 0 0 255 50 440 250 120 60 0 0 255\n" + "motion C 50 440 250 120 60 0 0 255 70 440 370 120 60 0 170 85\n" + "motion C 70 440 370 120 60 0 170 85 80 440 370 120 60 0 255 0\n" + "motion C 80 440 370 120 60 0 255 0 100 440 370 120 60 0 255 0\n"; private static String TOH3TXT = "" + "canvas 145 50 410 220\n" + "shape disk1 rectangle\n" + "shape disk2 rectangle\n" + "shape disk3 rectangle\n" + "motion disk1 1 190 180 20 30 0 49 90 1 190 180 20 30 0 49 90\n" + "motion disk1 1 190 180 20 30 0 49 90 25 190 180 20 30 0 49 90\n" + "motion disk2 1 167 210 65 30 6 247 41 1 167 210 65 30 6 247 41\n" + "motion disk2 1 167 210 65 30 6 247 41 57 167 210 65 30 6 247 41\n" + "motion disk3 1 145 240 110 30 11 45 175 1 145 240 110 30 11 45 175\n" + "motion disk3 1 145 240 110 30 11 45 175 121 145 240 110 30 11 45 175\n" + "motion disk1 25 190 180 20 30 0 49 90 35 190 50 20 30 0 49 90\n" + "motion disk1 35 190 50 20 30 0 49 90 36 190 50 20 30 0 49 90\n" + "motion disk1 36 190 50 20 30 0 49 90 46 490 50 20 30 0 49 90\n" + "motion disk1 46 490 50 20 30 0 49 90 47 490 50 20 30 0 49 90\n" + "motion disk1 47 490 50 20 30 0 49 90 57 490 240 20 30 0 49 90\n" + "motion disk1 57 490 240 20 30 0 49 90 89 490 240 20 30 0 49 90\n" + "motion disk2 57 167 210 65 30 6 247 41 67 167 50 65 30 6 247 41\n" + "motion disk2 67 167 50 65 30 6 247 41 68 167 50 65 30 6 247 41\n" + "motion disk2 68 167 50 65 30 6 247 41 78 317 50 65 30 6 247 41\n" + "motion disk2 78 317 50 65 30 6 247 41 79 317 50 65 30 6 247 41\n" + "motion disk2 79 317 50 65 30 6 247 41 89 317 240 65 30 6 247 41\n" + "motion disk1 89 490 240 20 30 0 49 90 99 490 50 20 30 0 49 90\n" + "motion disk2 89 317 240 65 30 6 247 41 185 317 240 65 30 6 247 41\n" + "motion disk1 99 490 50 20 30 0 49 90 100 490 50 20 30 0 49 90\n" + "motion disk1 100 490 50 20 30 0 49 90 110 340 50 20 30 0 49 90\n" + "motion disk1 110 340 50 20 30 0 49 90 111 340 50 20 30 0 49 90\n" + "motion disk1 111 340 50 20 30 0 49 90 121 340 210 20 30 0 49 90\n" + "motion disk1 121 340 210 20 30 0 49 90 153 340 210 20 30 0 49 90\n" + "motion disk3 121 145 240 110 30 11 45 175 131 145 50 110 30 11 45 175\n" + "motion disk3 131 145 50 110 30 11 45 175 132 145 50 110 30 11 45 175\n" + "motion disk3 132 145 50 110 30 11 45 175 142 445 50 110 30 11 45 175\n" + "motion disk3 142 445 50 110 30 11 45 175 143 445 50 110 30 11 45 175\n" + "motion disk3 143 445 50 110 30 11 45 175 153 445 240 110 30 11 45 175\n" + "motion disk1 153 340 210 20 30 0 49 90 163 340 50 20 30 0 49 90\n" + "motion disk3 153 445 240 110 30 11 45 175 161 445 240 110 30 0 255 0\n" + "motion disk3 161 445 240 110 30 0 255 0 302 445 240 110 30 0 255 0\n" + "motion disk1 163 340 50 20 30 0 49 90 164 340 50 20 30 0 49 90\n" + "motion disk1 164 340 50 20 30 0 49 90 174 190 50 20 30 0 49 90\n" + "motion disk1 174 190 50 20 30 0 49 90 175 190 50 20 30 0 49 90\n" + "motion disk1 175 190 50 20 30 0 49 90 185 190 240 20 30 0 49 90\n" + "motion disk1 185 190 240 20 30 0 49 90 217 190 240 20 30 0 49 90\n" + "motion disk2 185 317 240 65 30 6 247 41 195 317 50 65 30 6 247 41\n" + "motion disk2 195 317 50 65 30 6 247 41 196 317 50 65 30 6 247 41\n" + "motion disk2 196 317 50 65 30 6 247 41 206 467 50 65 30 6 247 41\n" + "motion disk2 206 467 50 65 30 6 247 41 207 467 50 65 30 6 247 41\n" + "motion disk2 207 467 50 65 30 6 247 41 217 467 210 65 30 6 247 41\n" + "motion disk1 217 190 240 20 30 0 49 90 227 190 50 20 30 0 49 90\n" + "motion disk2 217 467 210 65 30 6 247 41 225 467 210 65 30 0 255 0\n" + "motion disk2 225 467 210 65 30 0 255 0 302 467 210 65 30 0 255 0\n" + "motion disk1 227 190 50 20 30 0 49 90 228 190 50 20 30 0 49 90\n" + "motion disk1 228 190 50 20 30 0 49 90 238 490 50 20 30 0 49 90\n" + "motion disk1 238 490 50 20 30 0 49 90 239 490 50 20 30 0 49 90\n" + "motion disk1 239 490 50 20 30 0 49 90 249 490 180 20 30 0 49 90\n" + "motion disk1 249 490 180 20 30 0 49 90 257 490 180 20 30 0 255 0\n" + "motion disk1 257 490 180 20 30 0 255 0 302 490 180 20 30 0 255 0\n"; /** * A private helper to test a string input with our builder and model. * @param str The string to test. * @return The animator model that was created. */ private IAnimatorModel testString(String str) { return new AnimationReader().parseFile(new StringReader(str), getBuilder()); } /** * Test the animation described by toh-3.txt in assignment 6. We famously failed to parse this * before submitting. */ @Test public void testTOH3() { IAnimatorModel model = testString(TOH3TXT); // To make the java style checker happy. assertEquals("Expected TOH3 to have 3 named shapes.", 3, model.getShapeNames().size()); } /** * Test the animation described by smalldemo.txt in assignment 6 works. */ @Test public void testSMALLDEMO() { IAnimatorModel model = testString(SMALLDEMO); assertEquals("Expected small demo to have 3 named shapes.", 2, model.getShapeNames().size()); } }
92401b1b3c5130e14ed9c9e99a36134d81515e73
2,021
java
Java
gdx/src/com/badlogic/gdx/graphics/g3d/particles/renderers/ParticleControllerRenderer.java
pabru/libgdx
45c1fe264296962adc97d407d0f3b1a77a3f2636
[ "Apache-2.0" ]
null
null
null
gdx/src/com/badlogic/gdx/graphics/g3d/particles/renderers/ParticleControllerRenderer.java
pabru/libgdx
45c1fe264296962adc97d407d0f3b1a77a3f2636
[ "Apache-2.0" ]
null
null
null
gdx/src/com/badlogic/gdx/graphics/g3d/particles/renderers/ParticleControllerRenderer.java
pabru/libgdx
45c1fe264296962adc97d407d0f3b1a77a3f2636
[ "Apache-2.0" ]
null
null
null
33.683333
124
0.704602
1,001,404
/******************************************************************************* * Copyright 2011 See AUTHORS file. * * 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.badlogic.gdx.graphics.g3d.particles.renderers; import com.badlogic.gdx.graphics.g3d.particles.ParticleController; import com.badlogic.gdx.graphics.g3d.particles.ParticleControllerComponent; import com.badlogic.gdx.graphics.g3d.particles.batches.ParticleBatch; /** It's a {@link ParticleControllerComponent} which determines how the particles are rendered. It's the base class of every * particle renderer. * @author Inferno */ public abstract class ParticleControllerRenderer<D extends ParticleControllerRenderData, T extends ParticleBatch<D>> extends ParticleControllerComponent { protected T batch; protected D renderData; protected ParticleControllerRenderer () { } protected ParticleControllerRenderer (D renderData) { this.renderData = renderData; } @Override public void update () { batch.draw(renderData); } @SuppressWarnings("unchecked") public boolean setBatch (ParticleBatch<?> batch) { if (isCompatible(batch)) { this.batch = (T)batch; return true; } return false; } public abstract boolean isCompatible (ParticleBatch<?> batch); @Override public void set (ParticleController particleController) { super.set(particleController); if (renderData != null) renderData.controller = controller; } }
92401b30675cedf82b21af3194a1bf8501da50c4
2,575
java
Java
spring-cloud-function-web/src/main/java/org/springframework/cloud/function/web/util/FunctionWebUtils.java
prafullkotecha/spring-cloud-function
222aac77ccbcc9dd9018101f131fdf93a0f466f0
[ "Apache-2.0" ]
1
2020-09-08T19:27:58.000Z
2020-09-08T19:27:58.000Z
spring-cloud-function-web/src/main/java/org/springframework/cloud/function/web/util/FunctionWebUtils.java
prafullkotecha/spring-cloud-function
222aac77ccbcc9dd9018101f131fdf93a0f466f0
[ "Apache-2.0" ]
null
null
null
spring-cloud-function-web/src/main/java/org/springframework/cloud/function/web/util/FunctionWebUtils.java
prafullkotecha/spring-cloud-function
222aac77ccbcc9dd9018101f131fdf93a0f466f0
[ "Apache-2.0" ]
null
null
null
31.790123
89
0.719223
1,001,405
/* * Copyright 2019-2019 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.cloud.function.web.util; import java.util.Map; import java.util.function.Function; import java.util.function.Supplier; import org.reactivestreams.Publisher; import org.springframework.cloud.function.context.FunctionCatalog; import org.springframework.cloud.function.web.constants.WebRequestConstants; import org.springframework.http.HttpMethod; public final class FunctionWebUtils { private FunctionWebUtils() { } public static Object findFunction(HttpMethod method, FunctionCatalog functionCatalog, Map<String, Object> attributes, String path) { if (method.equals(HttpMethod.GET) || method.equals(HttpMethod.POST)) { return doFindFunction(method, functionCatalog, attributes, path); } else { throw new IllegalStateException("HTTP method '" + method + "' is not supported;"); } } private static Object doFindFunction(HttpMethod method, FunctionCatalog functionCatalog, Map<String, Object> attributes, String path) { path = path.startsWith("/") ? path.substring(1) : path; if (method.equals(HttpMethod.GET)) { Supplier<Publisher<?>> supplier = functionCatalog.lookup(Supplier.class, path); if (supplier != null) { attributes.put(WebRequestConstants.SUPPLIER, supplier); return supplier; } } StringBuilder builder = new StringBuilder(); String name = path; String value = null; for (String element : path.split("/")) { if (builder.length() > 0) { builder.append("/"); } builder.append(element); name = builder.toString(); value = path.length() > name.length() ? path.substring(name.length() + 1) : null; Function<Object, Object> function = functionCatalog.lookup(Function.class, name); if (function != null) { attributes.put(WebRequestConstants.FUNCTION, function); if (value != null) { attributes.put(WebRequestConstants.ARGUMENT, value); } return function; } } return null; } }
92401c6722188e1d91d9ebb478445f65203ece45
8,433
java
Java
eureka-test-utils/src/main/java/com/netflix/discovery/util/InstanceInfoGenerator.java
isabella232/eureka-1
2e6665f1a040a775ca486ee9184f10029f76589f
[ "Apache-2.0" ]
null
null
null
eureka-test-utils/src/main/java/com/netflix/discovery/util/InstanceInfoGenerator.java
isabella232/eureka-1
2e6665f1a040a775ca486ee9184f10029f76589f
[ "Apache-2.0" ]
1
2022-02-17T19:13:48.000Z
2022-02-17T19:13:48.000Z
eureka-test-utils/src/main/java/com/netflix/discovery/util/InstanceInfoGenerator.java
isabella232/eureka-1
2e6665f1a040a775ca486ee9184f10029f76589f
[ "Apache-2.0" ]
null
null
null
39.223256
109
0.6388
1,001,406
package com.netflix.discovery.util; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import com.netflix.appinfo.AmazonInfo; import com.netflix.appinfo.AmazonInfo.MetaDataKey; import com.netflix.appinfo.InstanceInfo; import com.netflix.appinfo.InstanceInfo.ActionType; import com.netflix.appinfo.InstanceInfo.Builder; import com.netflix.appinfo.InstanceInfo.InstanceStatus; import com.netflix.appinfo.InstanceInfo.PortType; import com.netflix.appinfo.LeaseInfo; import com.netflix.discovery.shared.Application; import com.netflix.discovery.shared.Applications; import static com.netflix.discovery.util.ApplicationFunctions.toApplicationMap; /** * Test data generator. * * @author Tomasz Bak */ public class InstanceInfoGenerator { public static final int RENEW_INTERVAL = 5; private final int instanceCount; private final int applicationCount; private Iterator<InstanceInfo> currentIt; private Applications allApplications = new Applications(); private final boolean withMetaData; private final boolean includeAsg; InstanceInfoGenerator(InstanceInfoGeneratorBuilder builder) { this.instanceCount = builder.instanceCount; this.applicationCount = builder.applicationCount; this.withMetaData = builder.includeMetaData; this.includeAsg = builder.includeAsg; } public Applications takeDelta(int count) { if (currentIt == null) { currentIt = serviceIterator(); allApplications = new Applications(); } List<InstanceInfo> instanceBatch = new ArrayList<InstanceInfo>(); for (int i = 0; i < count; i++) { InstanceInfo next = currentIt.next(); next.setActionType(ActionType.ADDED); instanceBatch.add(next); } Applications nextBatch = ApplicationFunctions.toApplications(toApplicationMap(instanceBatch)); allApplications = ApplicationFunctions.merge(allApplications, nextBatch); nextBatch.setAppsHashCode(allApplications.getAppsHashCode()); return nextBatch; } public Iterator<InstanceInfo> serviceIterator() { return new Iterator<InstanceInfo>() { private int returned; private final int[] appInstanceIds = new int[applicationCount]; private int currentApp; @Override public boolean hasNext() { return returned < instanceCount; } @Override public InstanceInfo next() { if (!hasNext()) { throw new NoSuchElementException("no more InstanceInfo elements"); } InstanceInfo toReturn = generateInstanceInfo(currentApp, appInstanceIds[currentApp]); appInstanceIds[currentApp]++; currentApp = (currentApp + 1) % applicationCount; returned++; return toReturn; } @Override public void remove() { throw new IllegalStateException("method not supported"); } }; } public Applications toApplications() { Map<String, Application> appsByName = new HashMap<>(); Iterator<InstanceInfo> it = serviceIterator(); while (it.hasNext()) { InstanceInfo instanceInfo = it.next(); Application instanceApp = appsByName.get(instanceInfo.getAppName()); if (instanceApp == null) { instanceApp = new Application(instanceInfo.getAppName()); appsByName.put(instanceInfo.getAppName(), instanceApp); } instanceApp.addInstance(instanceInfo); } // Do not pass application list to the constructor, as it does not initialize properly Applications // data structure. Applications applications = new Applications(); for (Application app : appsByName.values()) { applications.addApplication(app); } applications.setAppsHashCode(applications.getReconcileHashCode()); return applications; } public static InstanceInfo takeOne() { return newBuilder(1, 1).withMetaData(true).build().serviceIterator().next(); } public static InstanceInfoGeneratorBuilder newBuilder(int instanceCount, int applicationCount) { return new InstanceInfoGeneratorBuilder(instanceCount, applicationCount); } private InstanceInfo generateInstanceInfo(int appIndex, int appInstanceId) { String hostName = "instance" + appInstanceId + ".application" + appIndex + ".com"; String publicIp = "20.0." + appIndex + '.' + appInstanceId; String privateIp = "192.168." + appIndex + '.' + appInstanceId; AmazonInfo dataCenterInfo = AmazonInfo.Builder.newBuilder() .addMetadata(MetaDataKey.accountId, "testAccountId") .addMetadata(MetaDataKey.amiId, String.format("ami-%04d%04d", appIndex, appInstanceId)) .addMetadata(MetaDataKey.availabilityZone, "us-east1c") .addMetadata(MetaDataKey.instanceId, String.format("i-%04d%04d", appIndex, appInstanceId)) .addMetadata(MetaDataKey.instanceType, "m2.xlarge") .addMetadata(MetaDataKey.localIpv4, privateIp) .addMetadata(MetaDataKey.publicHostname, hostName) .addMetadata(MetaDataKey.publicIpv4, publicIp) .build(); String unsecureURL = "http://" + hostName + ":8080"; String secureURL = "https://" + hostName + ":8081"; long now = System.currentTimeMillis(); LeaseInfo leaseInfo = LeaseInfo.Builder.newBuilder() .setDurationInSecs(3 * RENEW_INTERVAL) .setRenewalIntervalInSecs(RENEW_INTERVAL) .setServiceUpTimestamp(now - RENEW_INTERVAL) .setRegistrationTimestamp(now) .setEvictionTimestamp(now + 3 * RENEW_INTERVAL) .setRenewalTimestamp(now + RENEW_INTERVAL) .build(); Builder builder = InstanceInfo.Builder.newBuilder() .setActionType(ActionType.ADDED) .setAppGroupName("AppGroup" + appIndex) .setAppName("App" + appIndex) .setHostName(hostName) .setIPAddr(publicIp) .setPort(8080) .setSecurePort(8081) .enablePort(PortType.SECURE, true) .setHealthCheckUrls("/healthcheck", unsecureURL + "/healthcheck", secureURL + "/healthcheck") .setHomePageUrl("/homepage", unsecureURL + "/homepage") .setStatusPageUrl("/status", unsecureURL + "/status") .setLeaseInfo(leaseInfo) .setStatus(InstanceStatus.UP) .setVIPAddress(hostName + ":8080") .setSecureVIPAddress(hostName + ":8081") .setDataCenterInfo(dataCenterInfo) .setLastUpdatedTimestamp(System.currentTimeMillis() - 100) .setLastDirtyTimestamp(System.currentTimeMillis() - 100) .setIsCoordinatingDiscoveryServer(true) .enablePort(PortType.UNSECURE, true); if (includeAsg) { builder.setASGName("ASG" + appIndex); } if (withMetaData) { builder.add("appKey" + appIndex, Integer.toString(appInstanceId)); } return builder.build(); } public static class InstanceInfoGeneratorBuilder { private final int instanceCount; private final int applicationCount; private boolean includeMetaData; private boolean includeAsg = true; public InstanceInfoGeneratorBuilder(int instanceCount, int applicationCount) { this.instanceCount = instanceCount; this.applicationCount = applicationCount; } public InstanceInfoGeneratorBuilder withMetaData(boolean includeMetaData) { this.includeMetaData = includeMetaData; return this; } public InstanceInfoGeneratorBuilder withAsg(boolean includeAsg) { this.includeAsg = includeAsg; return this; } public InstanceInfoGenerator build() { return new InstanceInfoGenerator(this); } } }
92401cec08be70ddc6dd07f098156bb5f7e11fdc
1,514
java
Java
workr/app/src/main/java/com/izzygomez/workr/Assignment.java
izzygomez/workr
4885d874bbdb9eab3f6338c613e429bff38fdcfb
[ "MIT" ]
null
null
null
workr/app/src/main/java/com/izzygomez/workr/Assignment.java
izzygomez/workr
4885d874bbdb9eab3f6338c613e429bff38fdcfb
[ "MIT" ]
null
null
null
workr/app/src/main/java/com/izzygomez/workr/Assignment.java
izzygomez/workr
4885d874bbdb9eab3f6338c613e429bff38fdcfb
[ "MIT" ]
null
null
null
22.939394
119
0.655878
1,001,407
package com.izzygomez.workr; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; /** * Created by pdgraham on 4/19/15. */ public class Assignment { private String subject; private int estimatedTime; private Calendar dueDate; private String highPriority; SimpleDateFormat sdf = new SimpleDateFormat("M/d/yyyy"); public Assignment(String assignmentName, int timeToFinish, Calendar turnInDate, String priority) { this.subject = assignmentName; this.estimatedTime = timeToFinish; this.dueDate = turnInDate; this.highPriority = priority; } public String getSubject() { return subject; } public void setSubject(String subject) { this.subject = subject; } public int getEstimatedTime() { return estimatedTime; } public void setEstimatedTime(int estimatedTime) { this.estimatedTime = estimatedTime; } public Calendar getDueDate() { return dueDate; } public void setDueDate(Calendar dueDate) { this.dueDate = dueDate; } public String getHighPriority() { return highPriority; } public void setHighPriority(String highPriority) { this.highPriority = highPriority; } @Override public String toString() { String string = subject + " : " + estimatedTime + " : " + sdf.format(dueDate.getTime()) + " : " + highPriority; return string; } }
92401d1e7c84feed964fb020aa6ea2d19dd91963
5,152
java
Java
luffy/src/main/java/org/noear/luffy/dso/AppUtil.java
noear/luffy
35b779bc040e8fd96a283b14679c396920d7ecc5
[ "MIT" ]
6
2021-05-14T08:58:55.000Z
2021-09-13T08:40:59.000Z
luffy/src/main/java/org/noear/luffy/dso/AppUtil.java
noear/luffy
35b779bc040e8fd96a283b14679c396920d7ecc5
[ "MIT" ]
null
null
null
luffy/src/main/java/org/noear/luffy/dso/AppUtil.java
noear/luffy
35b779bc040e8fd96a283b14679c396920d7ecc5
[ "MIT" ]
4
2021-05-17T01:26:27.000Z
2021-07-01T10:11:02.000Z
28.622222
124
0.531638
1,001,408
package org.noear.luffy.dso; import org.noear.snack.ONode; import org.noear.luffy.Config; import org.noear.luffy.Luffy; import org.noear.luffy.event.http.AppHandler; import org.noear.luffy.event.http.FrmInterceptor; import org.noear.luffy.event.http.ImgHandler; import org.noear.luffy.event.http.SufHandler; import org.noear.luffy.task.TaskFactory; import org.noear.luffy.utils.ExceptionUtils; import org.noear.luffy.utils.IOUtils; import org.noear.luffy.utils.TextUtils; import org.noear.solon.Solon; import org.noear.solon.SolonApp; import org.noear.solon.Utils; import org.noear.solon.core.handle.Handler; import org.noear.solon.core.handle.HandlerPipeline; import org.noear.solon.core.handle.MethodType; import org.noear.weed.WeedConfig; import java.net.URL; /** 应用协助控制工具 */ public class AppUtil { /** * 初始化数据库和内核 * */ public static void init(SolonApp app, boolean initDb){ if(initDb) { DbUtil.setDefDb(app.cfg().getXmap(Config.code_db)); } InitUtil.tryInitDb(); InitUtil.tryInitCore(app); InitUtil.tryInitNode(app); } public static void runAsInit(SolonApp app, String extend) { URL temp = Utils.getResource("setup.htm"); String html = null; try { html = IOUtils.toString(temp.openStream(), "utf-8"); } catch (Exception ex) { throw new RuntimeException(ex); } final String node2 = app.cfg().argx().get("node"); final String html2 = html.trim(); app.post("/setup.jsx", (ctx) -> { if (node2 != null && node2.length() > 30) { ctx.paramMap().put("node", node2); } else { ctx.paramMap().put("node", JtUtil.g.guid()); } DbUtil.setDefDb(ctx.paramMap()); try { DbUtil.db().sql("SHOW TABLES").execute(); InitUtil.trySaveConfig(extend, ctx.paramMap()); app.cfg().argx().putAll(ctx.paramMap()); AppUtil.init(app, false); String _usr = JtUtil.g.cfgGet("_frm_admin_user"); String _pwd = JtUtil.g.cfgGet("_frm_admin_pwd"); String _token = JtUtil.g.sha1(_usr+'#'+_pwd, "UTF-16LE").toUpperCase(); ONode rst = new ONode(); rst.set("code",1); rst.set("token",_token); rst.set("home",Solon.cfg().argx().get("home")); ctx.outputAsJson(rst.toJson()); //new Thread(() -> { Solon.global().router().clear(); AppUtil.runAsWork(Solon.global()); //}).start(); } catch (Throwable ex) { ctx.outputAsJson(new ONode() .set("code",0) .set("msg", ExceptionUtils.getString(ex)).toJson() ); } }); app.get("/", (ctx) -> { ctx.outputAsHtml(html2); }); app.get("/**", (ctx) -> { ctx.redirect("/"); }); } /** * 运行应用 * */ public static void runAsWork(SolonApp app) { String sss = app.cfg().argx().get("sss"); /* * 注入共享对传(会传导到javascript 和 freemarker 引擎) * */ app.sharedAdd("db", DbUtil.db()); app.sharedAdd("cache", DbUtil.cache); app.sharedAdd("localCache", DbUtil.cache); //2.尝试运行WEB应用 if (TextUtils.isEmpty(sss) || sss.indexOf("web") >= 0) { RouteHelper.reset(); do_runWeb(app); } //3.尝试运行SEV应用(即定时任务) if (TextUtils.isEmpty(sss) || sss.indexOf("sev") >= 0) { do_runSev(app); } //4.踪跟WEED异常 do_weedTrack(); //CallUtil.callLabel(null, "hook.start", false, null); //5.加载完成事件 Luffy.onLoad(); //6.执行完后,运行勾子 CallUtil.callLabel(null, "hook.start", false, null); } private static void do_runWeb(SolonApp app) { //拦截代理 app.before("**", MethodType.HTTP, FrmInterceptor.g()); //资源代理(/img/**) app.get(Config.frm_root_img + "**", new ImgHandler()); //文件代理 app.http("**", AppHandler.g()); //后缀代理(置于所有代理的前面) HandlerPipeline hx = new HandlerPipeline() .next(SufHandler.g()) .next(app.handlerGet()); app.handlerSet(hx); } private static void do_runSev(SolonApp app){ TaskFactory.run(TaskRunner.g); } private static void do_weedTrack(){ WeedConfig.onException((cmd, ex) -> { if (cmd.text.indexOf("a_log") < 0 && cmd.isLog >= 0) { System.out.println(cmd.text); LogUtil.log("weed", "err_log",LogLevel.ERROR, "出错", cmd.text + "<br/><br/>" + ExceptionUtils.getString(ex)); } }); WeedConfig.onExecuteAft((cmd)->{ if(cmd.isLog<0){ return; } if(cmd.timespan()>1000){ LogUtil.log("weed", "slow_log",LogLevel.WARN, cmd.timespan()+"ms", cmd.text); } }); } }
92401e49d79fdc73ac93c36d101227228ed19a4b
457
java
Java
07.Builder/Sample/Director.java
tomoyuki-nakabayashi/design-pattern-practice
614708f3d3fcdef2976da7701ee0b7bcdb6dda6a
[ "MIT" ]
null
null
null
07.Builder/Sample/Director.java
tomoyuki-nakabayashi/design-pattern-practice
614708f3d3fcdef2976da7701ee0b7bcdb6dda6a
[ "MIT" ]
null
null
null
07.Builder/Sample/Director.java
tomoyuki-nakabayashi/design-pattern-practice
614708f3d3fcdef2976da7701ee0b7bcdb6dda6a
[ "MIT" ]
null
null
null
20.772727
47
0.61488
1,001,409
public class Director { private Builder builder; public Director(Builder builder) { this.builder = builder; } public void construct() { builder.makeTitle("Greeting"); builder.makeString("From morning to noon"); builder.makeItems(new String[]{ "Good morning", "Hello", }); builder.makeString("At night"); builder.makeItems(new String[]{ "Good night", "Good bye" }); builder.close(); } }
92401f8e8f9acb9bcb1a5bb1d18e75cc63a5acc4
590
java
Java
src/main/java/com/thinkgem/jeesite/modules/weixin/entity/template/Message.java
nowimwrok/zd_devpro
58dd8e1a0f34c62360d75d11ab96802d38af0fbc
[ "Apache-2.0" ]
1
2021-03-06T09:57:31.000Z
2021-03-06T09:57:31.000Z
src/main/java/com/thinkgem/jeesite/modules/weixin/entity/template/Message.java
nowimwrok/zd_devpro
58dd8e1a0f34c62360d75d11ab96802d38af0fbc
[ "Apache-2.0" ]
null
null
null
src/main/java/com/thinkgem/jeesite/modules/weixin/entity/template/Message.java
nowimwrok/zd_devpro
58dd8e1a0f34c62360d75d11ab96802d38af0fbc
[ "Apache-2.0" ]
2
2018-08-24T15:54:09.000Z
2021-12-28T09:17:59.000Z
12.826087
60
0.638983
1,001,410
package com.thinkgem.jeesite.modules.weixin.entity.template; /** * 模板消息数据对象实体 * * @author Administrator * */ public class Message { /** * 消息内容 */ private String value; /** * 消息颜色 */ private String color; public Message() { super(); } public Message(String value, String color) { super(); this.value = value; this.color = color; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } }
92401fa8106c59f35f2da6228b01f335136259cc
2,206
java
Java
cotxox/cotxox/src/test/java/org/lasencinas/cotxox/conductores/ConductorIT.java
ocelot269/JAVA
81c545814ca906d34d81756cd9dfd279c8ffda04
[ "Apache-2.0" ]
null
null
null
cotxox/cotxox/src/test/java/org/lasencinas/cotxox/conductores/ConductorIT.java
ocelot269/JAVA
81c545814ca906d34d81756cd9dfd279c8ffda04
[ "Apache-2.0" ]
null
null
null
cotxox/cotxox/src/test/java/org/lasencinas/cotxox/conductores/ConductorIT.java
ocelot269/JAVA
81c545814ca906d34d81756cd9dfd279c8ffda04
[ "Apache-2.0" ]
null
null
null
29.413333
79
0.702629
1,001,411
/* * 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 org.lasencinas.cotxox.conductores; import org.junit.Test; import static org.junit.Assert.*; /** * * @author ozeh */ public class ConductorIT { public ConductorIT() { } @Test public void testGetNombre() { Conductor FernandoAlonso = new Conductor("fernando"); assertEquals("fernando",FernandoAlonso.getNombre()); } @Test public void testGetMatricula() { Conductor FernandoAlonso = new Conductor("fernando"); FernandoAlonso.setMatricula("CSY4232Y"); assertEquals("CSY4232Y",FernandoAlonso.getMatricula()); } @Test public void testGetModelo() { Conductor FernandoAlonso = new Conductor("fernando"); FernandoAlonso.setModelo("peugeot 206 sport"); assertEquals("peugeot 206 sport",FernandoAlonso.getModelo()); } @Test public void testGetValoracionesMedia() { Conductor FernandoAlonso = new Conductor("fernando"); FernandoAlonso.setValoracionesMedia(3.5); assertEquals(3.5,FernandoAlonso.getValoracionesMedia(),0); } @Test public void testGetValoracionesX() { Conductor FernandoAlonso = new Conductor("fernando"); FernandoAlonso.setValoraciones((double)5); FernandoAlonso.setValoraciones((double)3); assertEquals( 2,FernandoAlonso.getNumeroValoraciones(),0.1); assertEquals(4, FernandoAlonso.getValoracionesMedia(),0); } @Test public void testGetValoraciones2() { Conductor FernandoAlonso = new Conductor("fernando"); FernandoAlonso.setValoraciones((double)9); FernandoAlonso.setValoraciones((double)3); FernandoAlonso.setValoraciones((double)1); assertEquals( 3,FernandoAlonso.getNumeroValoraciones(),0.1); assertEquals(4.33, FernandoAlonso.getValoracionesMedia(),0.1); } @Test public void testGetConductorLibre() { Conductor FernandoAlonso = new Conductor("fernando"); FernandoAlonso.setConductorLibre(true); assertEquals(true,FernandoAlonso.getConductorLibre()); } }
9240209f0a0a3f4a4125e2f1487617606b7567dc
1,050
java
Java
src/main/java/co/tdude/soen341/projecta/WordCountSuperEnterpriseEdition/impl/arguments/StringCommandLineArgument.java
starcraft66/SOEN341-Fall-2020-ProjectA
b156cc08437ba87cd44e7619de241cd98b120062
[ "BSD-3-Clause" ]
2
2020-09-25T09:00:31.000Z
2021-07-24T15:01:29.000Z
src/main/java/co/tdude/soen341/projecta/WordCountSuperEnterpriseEdition/impl/arguments/StringCommandLineArgument.java
starcraft66/SOEN341-Fall-2020-ProjectA
b156cc08437ba87cd44e7619de241cd98b120062
[ "BSD-3-Clause" ]
null
null
null
src/main/java/co/tdude/soen341/projecta/WordCountSuperEnterpriseEdition/impl/arguments/StringCommandLineArgument.java
starcraft66/SOEN341-Fall-2020-ProjectA
b156cc08437ba87cd44e7619de241cd98b120062
[ "BSD-3-Clause" ]
null
null
null
36.206897
99
0.729524
1,001,412
package co.tdude.soen341.projecta.WordCountSuperEnterpriseEdition.impl.arguments; /** * The concrete implementation of the EnterpriseCommandLineArgument abstract class * and the CommandLineArgument interface used to model a command line argument of type String. */ public class StringCommandLineArgument extends EnterpriseCommandLineArgument<String> { /** * Constructor that initializes the name and help message for the String command line argument. * @param name The name describing the command line argument. * @param help The help message for the associated command line argument name. */ public StringCommandLineArgument(String name, String help) { super(name, help, ArgumentType.VALUE); } /** * Parses the command line argument and converts it to type String. * @param arg The command line argument to be parsed. * @return The parsed command line value of type String. */ @Override public String parseValue(String arg) { return String.valueOf(arg); } }
924020b6253d3e64b57e580534370474af9a5e3a
811
java
Java
components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/alert/kapacitor/model/Topic.java
inspectIT/inspectit-oce
cc6f1ed2795f69ba244562d4b8a57437db45c784
[ "Apache-2.0" ]
12
2018-12-20T07:05:30.000Z
2019-03-23T17:47:29.000Z
components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/alert/kapacitor/model/Topic.java
inspectIT/inspectit-oce
cc6f1ed2795f69ba244562d4b8a57437db45c784
[ "Apache-2.0" ]
80
2018-12-03T07:43:47.000Z
2019-03-25T08:14:45.000Z
components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/alert/kapacitor/model/Topic.java
inspectIT/inspectit-oce
cc6f1ed2795f69ba244562d4b8a57437db45c784
[ "Apache-2.0" ]
6
2018-12-03T14:40:05.000Z
2019-03-15T07:52:05.000Z
20.794872
62
0.639951
1,001,413
package rocks.inspectit.ocelot.rest.alert.kapacitor.model; import com.fasterxml.jackson.databind.JsonNode; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** * Represents a Kapacitor Topic. */ @Data @AllArgsConstructor @NoArgsConstructor @Builder public class Topic { String id; /** * The current alerting level. */ String level; /** * Reads a Topic from a kapacitor JSON response. * * @param node the response from kapacitor * * @return the parsed topic. */ public static Topic fromKapacitorResponse(JsonNode node) { return Topic.builder() .id(node.path("id").asText()) .level(node.path("level").asText()) .build(); } }
924020c07876a870000fdb405711a77ed41adce4
3,477
java
Java
src/java/mktdata/AdminLogin15Encoder.java
PeregrineTradersDevTeam/md-data-reader-cme
55130b06eed1bef5af4d32dba7b0fc619f7867c4
[ "MIT" ]
2
2021-03-15T20:40:27.000Z
2021-07-13T22:55:58.000Z
src/java/mktdata/AdminLogin15Encoder.java
PeregrineTradersDevTeam/md-data-reader-cme
55130b06eed1bef5af4d32dba7b0fc619f7867c4
[ "MIT" ]
1
2021-03-10T13:41:38.000Z
2021-03-10T13:59:37.000Z
src/java/mktdata/AdminLogin15Encoder.java
PeregrineTradersDevTeam/md-data-reader-cme
55130b06eed1bef5af4d32dba7b0fc619f7867c4
[ "MIT" ]
1
2020-07-03T07:06:45.000Z
2020-07-03T07:06:45.000Z
20.696429
101
0.612597
1,001,414
/* Generated SBE (Simple Binary Encoding) message codec */ package mktdata; import org.agrona.MutableDirectBuffer; import org.agrona.DirectBuffer; /** * AdminLogin */ @SuppressWarnings("all") public class AdminLogin15Encoder { public static final int BLOCK_LENGTH = 1; public static final int TEMPLATE_ID = 15; public static final int SCHEMA_ID = 1; public static final int SCHEMA_VERSION = 9; public static final java.nio.ByteOrder BYTE_ORDER = java.nio.ByteOrder.LITTLE_ENDIAN; private final AdminLogin15Encoder parentMessage = this; private MutableDirectBuffer buffer; protected int offset; protected int limit; public int sbeBlockLength() { return BLOCK_LENGTH; } public int sbeTemplateId() { return TEMPLATE_ID; } public int sbeSchemaId() { return SCHEMA_ID; } public int sbeSchemaVersion() { return SCHEMA_VERSION; } public String sbeSemanticType() { return "A"; } public MutableDirectBuffer buffer() { return buffer; } public int offset() { return offset; } public AdminLogin15Encoder wrap(final MutableDirectBuffer buffer, final int offset) { if (buffer != this.buffer) { this.buffer = buffer; } this.offset = offset; limit(offset + BLOCK_LENGTH); return this; } public AdminLogin15Encoder wrapAndApplyHeader( final MutableDirectBuffer buffer, final int offset, final MessageHeaderEncoder headerEncoder) { headerEncoder .wrap(buffer, offset) .blockLength(BLOCK_LENGTH) .templateId(TEMPLATE_ID) .schemaId(SCHEMA_ID) .version(SCHEMA_VERSION); return wrap(buffer, offset + MessageHeaderEncoder.ENCODED_LENGTH); } public int encodedLength() { return limit - offset; } public int limit() { return limit; } public void limit(final int limit) { this.limit = limit; } public static int heartBtIntId() { return 108; } public static int heartBtIntSinceVersion() { return 0; } public static int heartBtIntEncodingOffset() { return 0; } public static int heartBtIntEncodingLength() { return 1; } public static String heartBtIntMetaAttribute(final MetaAttribute metaAttribute) { switch (metaAttribute) { case EPOCH: return ""; case TIME_UNIT: return ""; case SEMANTIC_TYPE: return "int"; case PRESENCE: return "required"; } return ""; } public static byte heartBtIntNullValue() { return (byte)-128; } public static byte heartBtIntMinValue() { return (byte)-127; } public static byte heartBtIntMaxValue() { return (byte)127; } public AdminLogin15Encoder heartBtInt(final byte value) { buffer.putByte(offset + 0, value); return this; } public String toString() { return appendTo(new StringBuilder(100)).toString(); } public StringBuilder appendTo(final StringBuilder builder) { AdminLogin15Decoder writer = new AdminLogin15Decoder(); writer.wrap(buffer, offset, BLOCK_LENGTH, SCHEMA_VERSION); return writer.appendTo(builder); } }
92402142dc7338f8f0508d1eada85cad43cc9c47
3,228
java
Java
src/main/java/ac/cn/saya/lab/controller/LoginViewController.java
saya-ac-cn/gui-lab
499b776672dfc25c9413e541a4842e9d6094e223
[ "Apache-2.0" ]
null
null
null
src/main/java/ac/cn/saya/lab/controller/LoginViewController.java
saya-ac-cn/gui-lab
499b776672dfc25c9413e541a4842e9d6094e223
[ "Apache-2.0" ]
null
null
null
src/main/java/ac/cn/saya/lab/controller/LoginViewController.java
saya-ac-cn/gui-lab
499b776672dfc25c9413e541a4842e9d6094e223
[ "Apache-2.0" ]
null
null
null
30.742857
143
0.622677
1,001,415
package ac.cn.saya.lab.controller; import ac.cn.saya.lab.GUIApplication; import ac.cn.saya.lab.api.RequestUrl; import ac.cn.saya.lab.control.ProgressFrom; import ac.cn.saya.lab.tools.*; import com.alibaba.fastjson.JSONObject; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import java.net.URL; import java.util.ResourceBundle; import java.util.concurrent.ExecutionException; import java.util.concurrent.FutureTask; /** * @Title: LoginViewController * @ProjectName gui-lab * @Description: TODO * @Author liunengkai * @Date: 2020-03-30 21:59 * @Description:登录界面控制器 */ public class LoginViewController implements Initializable { private GUIApplication mainApp; @FXML private Label userNameLabel; @FXML private Label passwordLabel; @FXML private TextField userNameField; @FXML private TextField passwordField; @FXML private Label errorInfoLabel; /** * 获取主控制器的引用 */ public void setMainApp(GUIApplication mainApp) { this.mainApp = mainApp; } /** * 界面打开后的初始化操作 * @param location * @param resources */ @Override public void initialize(URL location, ResourceBundle resources) { userNameLabel.setGraphic(new ImageView(new Image(GUIApplication.class.getResourceAsStream("/images/user.png"),20,20,false,false))); passwordLabel.setGraphic(new ImageView(new Image(GUIApplication.class.getResourceAsStream("/images/password.png"),20,20,false,false))); userNameField.setText("Pandora"); passwordField.setText("Pandora520815"); } /** * 响应登录事件 * @return */ public void handleLoginButtonAction(){ if (StringUtils.isBlank( userNameField.getText()) || StringUtils.isBlank(passwordField.getText())){ errorInfoLabel.setText("用户名或密码不能为空"); }else { JSONObject jsonObject = new JSONObject(); jsonObject.put("user",userNameField.getText()); jsonObject.put("password",passwordField.getText()); AsyncRequestUtils task = new AsyncRequestUtils(jsonObject, (parmar) -> RequestUrl.login(parmar)); task.valueProperty().addListener((observable,oldValue,newValue)->{ if (task.getFinishStatus()){ // 执行完成 Result<Object> result = null; try { result = task.get(); } catch (Exception e){ e.printStackTrace(); } if (ResultUtil.checkSuccess(result)){ //显示主界面 mainApp.showHomeView((result.getData() == null)?null:(JSONObject)result.getData()); }else { NoticeUtils.show("错误",result.getMsg()); errorInfoLabel.setText("用户名或密码错误"); } } }); ProgressFrom progressFrom = new ProgressFrom(task,GUIApplication.getStage()); progressFrom.activateProgressBar(); } } }
92402175c9a6797564a0f02894e2cd1d824efe93
2,151
java
Java
jodd-db/src/main/java/jodd/db/connection/ConnectionProvider.java
xun404/jodd
d5c7e9cb61842aee2ba7800e4b7a10ba7f0162a1
[ "BSD-2-Clause" ]
2
2021-03-04T11:54:00.000Z
2021-07-12T19:37:58.000Z
jodd-db/src/main/java/jodd/db/connection/ConnectionProvider.java
xun404/jodd
d5c7e9cb61842aee2ba7800e4b7a10ba7f0162a1
[ "BSD-2-Clause" ]
2
2021-03-04T16:49:02.000Z
2021-03-11T09:02:15.000Z
jodd-db/src/main/java/jodd/db/connection/ConnectionProvider.java
xun404/jodd
d5c7e9cb61842aee2ba7800e4b7a10ba7f0162a1
[ "BSD-2-Clause" ]
1
2021-05-16T16:30:22.000Z
2021-05-16T16:30:22.000Z
34.693548
78
0.752208
1,001,416
// Copyright (c) 2003-present, Jodd Team (http://jodd.org) // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. package jodd.db.connection; import java.sql.Connection; /** * A generic strategy for obtaining JDBC connections. * <p> * Implementors might also implement connection pooling. * <p> * Implementations should provide a public default constructor. */ public interface ConnectionProvider extends AutoCloseable { /** * Initialize the connection provider. May be called more then once; * does not have any effect if pool is already initialized. */ void init(); /** * Returns a connection from connection pool. */ Connection getConnection(); /** * Dispose of a used {@link #getConnection() connection}. */ void closeConnection(Connection connection); /** * Closes a provider and releases all its resources. */ @Override void close(); }
92402178939977858b21f66ecc7b758d4cd2d209
263
java
Java
src/main/java/org/openstreetmap/atlas/geography/geojson/parser/mapper/Mapper.java
Huyuntj/atlas
bb1545ed2da7a1d51f133a4bb686c064c63892eb
[ "BSD-3-Clause" ]
188
2017-08-08T17:26:54.000Z
2022-03-29T07:59:30.000Z
src/main/java/org/openstreetmap/atlas/geography/geojson/parser/mapper/Mapper.java
Huyuntj/atlas
bb1545ed2da7a1d51f133a4bb686c064c63892eb
[ "BSD-3-Clause" ]
403
2017-08-09T16:15:25.000Z
2022-02-16T19:33:42.000Z
src/main/java/org/openstreetmap/atlas/geography/geojson/parser/mapper/Mapper.java
Huyuntj/atlas
bb1545ed2da7a1d51f133a4bb686c064c63892eb
[ "BSD-3-Clause" ]
79
2017-08-08T17:55:01.000Z
2021-11-10T20:51:57.000Z
20.230769
64
0.745247
1,001,417
package org.openstreetmap.atlas.geography.geojson.parser.mapper; import java.io.Serializable; import java.util.Map; /** * @author Yazad Khambata */ public interface Mapper extends Serializable { <T> T map(Map<String, Object> map, Class<T> targetClass); }
924026c745544b596bdd838d2a4935fff293d57c
1,453
java
Java
MatlabIR/src/org/specs/MatlabIR/MatlabNodePass/interfaces/MatlabNodePass.java
specs-feup/matisse
8e0838e3f42cac0a5f5be8979a3444231b9ba944
[ "Apache-2.0" ]
null
null
null
MatlabIR/src/org/specs/MatlabIR/MatlabNodePass/interfaces/MatlabNodePass.java
specs-feup/matisse
8e0838e3f42cac0a5f5be8979a3444231b9ba944
[ "Apache-2.0" ]
null
null
null
MatlabIR/src/org/specs/MatlabIR/MatlabNodePass/interfaces/MatlabNodePass.java
specs-feup/matisse
8e0838e3f42cac0a5f5be8979a3444231b9ba944
[ "Apache-2.0" ]
null
null
null
30.270833
118
0.710255
1,001,418
/** * Copyright 2014 SPeCS. * * 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. under the License. */ package org.specs.MatlabIR.MatlabNodePass.interfaces; import org.specs.MatlabIR.MatlabNode.MatlabNode; import org.suikasoft.jOptions.Interfaces.DataStore; /** * Represents a transformation that is to be applied only on the given MatlabNode. * * @author JoaoBispo * */ @FunctionalInterface public interface MatlabNodePass { /** * Applies the transformation over the rootNode and its children, storing and using information in the given data * instance. * * @param node * @param data * @return the rootNode, or a new rootNode if the original was modified */ MatlabNode apply(MatlabNode node, DataStore data); /** * The name of the pass. As default, returns the full name of the class. * * @return */ default String getName() { return this.getClass().getName(); } }
924029e1ec5ab4ea5258cdf7829a4c88fa26358f
831
java
Java
modules/gui/src/com/haulmont/cuba/gui/components/HasRowsCount.java
mitring/cuba
7463287d9b1396a9a80294cb83ebbd85ad00304c
[ "Apache-2.0" ]
null
null
null
modules/gui/src/com/haulmont/cuba/gui/components/HasRowsCount.java
mitring/cuba
7463287d9b1396a9a80294cb83ebbd85ad00304c
[ "Apache-2.0" ]
null
null
null
modules/gui/src/com/haulmont/cuba/gui/components/HasRowsCount.java
mitring/cuba
7463287d9b1396a9a80294cb83ebbd85ad00304c
[ "Apache-2.0" ]
null
null
null
30.777778
75
0.731649
1,001,419
/* * Copyright (c) 2008-2018 Haulmont. * * 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.haulmont.cuba.gui.components; /** * Component having a {@link RowsCount} component. * * todo extract */ public interface HasRowsCount { RowsCount getRowsCount(); void setRowsCount(RowsCount rowsCount); }
924029f3fcd1c0bdfa3b2a1c551b3f1bc2644186
690
java
Java
example.modelmapper/src/test/java/com/liquidintellect/example/modelmapper/AppTest.java
scottresnik/modelmapper-interfaces
619238a45c9efc0a4945d690cd50eae6527d318b
[ "Apache-2.0" ]
null
null
null
example.modelmapper/src/test/java/com/liquidintellect/example/modelmapper/AppTest.java
scottresnik/modelmapper-interfaces
619238a45c9efc0a4945d690cd50eae6527d318b
[ "Apache-2.0" ]
null
null
null
example.modelmapper/src/test/java/com/liquidintellect/example/modelmapper/AppTest.java
scottresnik/modelmapper-interfaces
619238a45c9efc0a4945d690cd50eae6527d318b
[ "Apache-2.0" ]
null
null
null
25.555556
87
0.726087
1,001,420
package com.liquidintellect.example.modelmapper; import static org.hamcrest.core.Is.is; import org.junit.Test; import static org.junit.Assert.assertThat; /** * Unit test for simple App. */ public class AppTest { @Test public void testMapping() { Owner owner = new Owner(); owner.setOwnerId("OwnerName"); owner.setPossession(new Possession()); owner.getPossession().setPossessionId("PossessionName"); Parent parent = new ParentImpl(); parent.setChild(new ChildImpl()); App app = new App(); app.convert(owner, parent); assertThat(parent.getName(), is(owner.getOwnerId())); assertThat(parent.getChild().getName(), is(owner.getPossession().getPossessionId())); } }
92402abb1bde19fb7417db0b9338bc0f375395b5
1,756
java
Java
guava/src/com/google/common/collect/SingletonImmutableTable.java
yangfancoming/guava-parent
bda34e5e2a9ebfc0d4ff29077a739d542e736299
[ "Apache-2.0" ]
null
null
null
guava/src/com/google/common/collect/SingletonImmutableTable.java
yangfancoming/guava-parent
bda34e5e2a9ebfc0d4ff29077a739d542e736299
[ "Apache-2.0" ]
null
null
null
guava/src/com/google/common/collect/SingletonImmutableTable.java
yangfancoming/guava-parent
bda34e5e2a9ebfc0d4ff29077a739d542e736299
[ "Apache-2.0" ]
null
null
null
26.208955
100
0.708428
1,001,421
package com.google.common.collect; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.GwtCompatible; import java.util.Map; /** * An implementation of {@link ImmutableTable} that holds a single cell. * * @author Gregory Kick */ @GwtCompatible class SingletonImmutableTable<R, C, V> extends ImmutableTable<R, C, V> { final R singleRowKey; final C singleColumnKey; final V singleValue; SingletonImmutableTable(R rowKey, C columnKey, V value) { this.singleRowKey = checkNotNull(rowKey); this.singleColumnKey = checkNotNull(columnKey); this.singleValue = checkNotNull(value); } SingletonImmutableTable(Cell<R, C, V> cell) { this(cell.getRowKey(), cell.getColumnKey(), cell.getValue()); } @Override public ImmutableMap<R, V> column(C columnKey) { checkNotNull(columnKey); return containsColumn(columnKey) ? ImmutableMap.of(singleRowKey, singleValue) : ImmutableMap.<R, V>of(); } @Override public ImmutableMap<C, Map<R, V>> columnMap() { return ImmutableMap.of(singleColumnKey, (Map<R, V>) ImmutableMap.of(singleRowKey, singleValue)); } @Override public ImmutableMap<R, Map<C, V>> rowMap() { return ImmutableMap.of(singleRowKey, (Map<C, V>) ImmutableMap.of(singleColumnKey, singleValue)); } @Override public int size() { return 1; } @Override ImmutableSet<Cell<R, C, V>> createCellSet() { return ImmutableSet.of(cellOf(singleRowKey, singleColumnKey, singleValue)); } @Override ImmutableCollection<V> createValues() { return ImmutableSet.of(singleValue); } @Override SerializedForm createSerializedForm() { return SerializedForm.create(this, new int[] {0}, new int[] {0}); } }
92402ac076e81e2a1049603904c35814aa78b4bb
6,214
java
Java
src/main/java/de/hf/myfinance/instruments/service/accountableinstrumenthandler/AbsAccountableInstrumentHandler.java
myfinance/mfinstruments
0810bf4b24dae34b5b51396e828e934f709fe583
[ "MIT" ]
null
null
null
src/main/java/de/hf/myfinance/instruments/service/accountableinstrumenthandler/AbsAccountableInstrumentHandler.java
myfinance/mfinstruments
0810bf4b24dae34b5b51396e828e934f709fe583
[ "MIT" ]
null
null
null
src/main/java/de/hf/myfinance/instruments/service/accountableinstrumenthandler/AbsAccountableInstrumentHandler.java
myfinance/mfinstruments
0810bf4b24dae34b5b51396e828e934f709fe583
[ "MIT" ]
null
null
null
49.712
251
0.756357
1,001,422
package de.hf.myfinance.instruments.service.accountableinstrumenthandler; import de.hf.framework.audit.AuditService; import de.hf.framework.exceptions.MFException; import de.hf.myfinance.exception.MFMsgKey; import de.hf.myfinance.instruments.persistence.entities.EdgeType; import de.hf.myfinance.instruments.persistence.entities.InstrumentEntity; import de.hf.myfinance.instruments.persistence.entities.InstrumentGraphEntry; import de.hf.myfinance.instruments.persistence.repositories.InstrumentGraphRepository; import de.hf.myfinance.instruments.persistence.repositories.InstrumentRepository; import de.hf.myfinance.instruments.service.AbsInstrumentHandlerWithProperty; import de.hf.myfinance.instruments.service.instrumentgraphhandler.InstrumentGraphHandler; import de.hf.myfinance.instruments.service.instrumentgraphhandler.InstrumentGraphHandlerImpl; import de.hf.myfinance.restmodel.InstrumentType; import java.util.ArrayList; import java.util.List; import java.util.Optional; /** * This abstract class is the base for all Instruments a Tenant can be directly connected with and the Tenant it self. * Securities like Equities and Bonds are only connected via Trades and so use a different base class */ public abstract class AbsAccountableInstrumentHandler extends AbsInstrumentHandlerWithProperty implements AccountableInstrumentHandler{ protected final InstrumentGraphHandler instrumentGraphHandler; private String parentId; protected AbsAccountableInstrumentHandler(InstrumentRepository instrumentRepository, InstrumentGraphRepository instrumentGraphRepository, AuditService auditService, String description, String parentId, String businesskey) { this(instrumentRepository, instrumentGraphRepository, auditService, description, parentId, false, businesskey); } protected AbsAccountableInstrumentHandler(InstrumentRepository instrumentRepository, InstrumentGraphRepository instrumentGraphRepository, AuditService auditService, String description, String parentId, boolean addToAccountPf, String businesskey) { super(instrumentRepository, auditService, description, businesskey); this.instrumentGraphHandler = new InstrumentGraphHandlerImpl(instrumentGraphRepository, instrumentRepository); setParent(parentId, addToAccountPf); validateParent(); } protected AbsAccountableInstrumentHandler(InstrumentRepository instrumentRepository, InstrumentGraphRepository instrumentGraphRepository, AuditService auditService, String businesskey) { super(instrumentRepository, auditService, businesskey); this.instrumentGraphHandler = new InstrumentGraphHandlerImpl(instrumentGraphRepository, instrumentRepository); } protected void saveNewInstrument() { super.saveNewInstrument(); updateParent(); instrumentGraphHandler.addInstrumentToGraph(instrumentId, parentId); } protected void validateParent() { Optional<InstrumentEntity> parent = instrumentRepository.findById(parentId); if(!parent.isPresent()){ throw new MFException(MFMsgKey.UNKNOWN_PARENT_EXCEPTION, domainObjectName+" not saved: unknown parent:"+parentId); } if(parent.get().getInstrumentType() != getParentType()){ throw new MFException(MFMsgKey.WRONG_INSTRUMENTTYPE_EXCEPTION, domainObjectName+" not saved: Instrument with Id "+parentId + " has the wrong type"); } } protected void setParent(String parentId, boolean addToAccountPf) { this.parentId = parentId; if(addToAccountPf) setParentToAccountPf(); } private void setParentToAccountPf() { Optional<InstrumentEntity> accportfolio = instrumentGraphHandler.getAllInstrumentChildsWithType(parentId, InstrumentType.ACCOUNTPORTFOLIO).stream().findFirst(); if(!accportfolio.isPresent()) { throw new MFException(MFMsgKey.UNKNOWN_INSTRUMENT_EXCEPTION, "Account not saved: account portfolio for the tenant:"+parentId+" does not exists"); } this.parentId = accportfolio.get().getInstrumentid(); } /** * used to override the parent during the save function. E.G. Tentant sets the parent to himself */ protected void updateParent() { } protected InstrumentType getParentType() { return InstrumentType.TENANT; } public Optional<String> getTenant() { checkInitStatus(); return instrumentGraphHandler.getRootInstrument(instrumentId, EdgeType.TENANTGRAPH); } public List<InstrumentEntity> getInstrumentChilds(EdgeType edgeType, int pathlength){ checkInitStatus(); return instrumentGraphHandler.getInstrumentChilds(instrumentId, edgeType, pathlength); } public List<String> getInstrumentChildIds(EdgeType edgeType, int pathlength){ checkInitStatus(); return instrumentGraphHandler.getInstrumentChildIds(instrumentId, edgeType, pathlength); } public List<String> getAncestorIds() { checkInitStatus(); var ids = new ArrayList<String>(); final List<InstrumentGraphEntry> ancestorGraphEntries = instrumentGraphHandler.getAncestors(instrumentId, EdgeType.TENANTGRAPH); if (ancestorGraphEntries != null && !ancestorGraphEntries.isEmpty()) { for (final InstrumentGraphEntry entry : ancestorGraphEntries) { ids.add(entry.getAncestor()); } } return ids; } @Override protected void validateInstrument(InstrumentEntity instrument, InstrumentType instrumentType, String errMsg) { super.validateInstrument(instrument, instrumentType, errMsg); Optional<String> tenantOfInstrument = instrumentGraphHandler.getRootInstrument(instrument.getInstrumentid(), EdgeType.TENANTGRAPH); if(!tenantOfInstrument.isPresent()){ throw new MFException(MFMsgKey.WRONG_TENENT_EXCEPTION, errMsg+" instrument has not the same tenant"); } if(initialized) { if(!tenantOfInstrument.get().equals(getTenant().get())) { throw new MFException(MFMsgKey.WRONG_TENENT_EXCEPTION, errMsg+" instrument has not the same tenant"); } } } }
92402b100e30ea99a22eecf1dba9a6c7663448b8
2,193
java
Java
src/main/java/org/ncpsb/phoenixcluster/enhancer/webservice/model/SpecClusterMatch.java
phoenix-cluster/ph-enhancer-web-service
09ba2c0b9d537f77a743c63a2757606a5ceadff0
[ "MIT" ]
null
null
null
src/main/java/org/ncpsb/phoenixcluster/enhancer/webservice/model/SpecClusterMatch.java
phoenix-cluster/ph-enhancer-web-service
09ba2c0b9d537f77a743c63a2757606a5ceadff0
[ "MIT" ]
null
null
null
src/main/java/org/ncpsb/phoenixcluster/enhancer/webservice/model/SpecClusterMatch.java
phoenix-cluster/ph-enhancer-web-service
09ba2c0b9d537f77a743c63a2757606a5ceadff0
[ "MIT" ]
3
2018-01-08T01:36:24.000Z
2018-07-20T11:35:59.000Z
20.885714
79
0.634291
1,001,423
package org.ncpsb.phoenixcluster.enhancer.webservice.model; public class SpecClusterMatch { Integer PsmId;//2 String SpecTitle;//PXD000535;PRIDE_Exp_Complete_Ac_31837.xml;spectrum=16146 String ClusterId; //b070060e-4f5e-4698-9277-9fa6c0d44e53 String ClusterSize; //15 String ClusterRatio;//1.0 String PreSeq;//DLTPAVTDNDEADK String PreMods; String RecommSeq;//R_Better_DLTPAVTDNDEADK String RecommMods;// Float ConfSc;//0.39203042 Float RecommSeqSc;//0.39203042 public Integer getPsmId() { return PsmId; } public void setPsmId(Integer psmId) { PsmId = psmId; } public String getSpecTitle() { return SpecTitle; } public void setSpecTitle(String specTitle) { SpecTitle = specTitle; } public String getClusterId() { return ClusterId; } public void setClusterId(String clusterId) { ClusterId = clusterId; } public String getClusterSize() { return ClusterSize; } public void setClusterSize(String clusterSize) { ClusterSize = clusterSize; } public String getClusterRatio() { return ClusterRatio; } public void setClusterRatio(String clusterRatio) { ClusterRatio = clusterRatio; } public String getPreSeq() { return PreSeq; } public void setPreSeq(String preSeq) { PreSeq = preSeq; } public String getPreMods() { return PreMods; } public void setPreMods(String preMods) { PreMods = preMods; } public String getRecommSeq() { return RecommSeq; } public void setRecommSeq(String recommSeq) { RecommSeq = recommSeq; } public String getRecommMods() { return RecommMods; } public void setRecommMods(String recommMods) { RecommMods = recommMods; } public Float getConfSc() { return ConfSc; } public void setConfSc(Float confSc) { ConfSc = confSc; } public Float getRecommSeqSc() { return RecommSeqSc; } public void setRecommSeqSc(Float recommSeqSc) { RecommSeqSc = recommSeqSc; } }
92402b549613d71ad12f7914ebec0918f766f993
1,034
java
Java
horx-wdf-sys/horx-wdf-sys-support/src/main/java/org/horx/wdf/sys/extension/context/SysContextParam.java
horxorg/horx-web-framework
15abf81f21c70be8203b780f28d8c38057daf5a4
[ "Apache-2.0" ]
3
2020-07-18T02:51:13.000Z
2020-07-18T11:21:35.000Z
horx-wdf-sys/horx-wdf-sys-support/src/main/java/org/horx/wdf/sys/extension/context/SysContextParam.java
horxorg/horx-web-framework
15abf81f21c70be8203b780f28d8c38057daf5a4
[ "Apache-2.0" ]
4
2020-07-18T04:04:28.000Z
2020-07-18T04:08:10.000Z
horx-wdf-sys/horx-wdf-sys-support/src/main/java/org/horx/wdf/sys/extension/context/SysContextParam.java
horxorg/horx-web-framework
15abf81f21c70be8203b780f28d8c38057daf5a4
[ "Apache-2.0" ]
null
null
null
19.509434
70
0.65764
1,001,424
package org.horx.wdf.sys.extension.context; import org.horx.wdf.common.extension.context.ThreadContextParam; import org.horx.wdf.sys.dto.OrgDTO; import org.horx.wdf.sys.dto.UserDTO; /** * 系统管理线上下文变量。 * @since 1.0 */ public class SysContextParam extends ThreadContextParam { private UserDTO user; private OrgDTO org; private String accessPermissionCode; private Long[] roleIds; public UserDTO getUser() { return user; } public void setUser(UserDTO user) { this.user = user; } public OrgDTO getOrg() { return org; } public void setOrg(OrgDTO org) { this.org = org; } public String getAccessPermissionCode() { return accessPermissionCode; } public void setAccessPermissionCode(String accessPermissionCode) { this.accessPermissionCode = accessPermissionCode; } public Long[] getRoleIds() { return roleIds; } public void setRoleIds(Long[] roleIds) { this.roleIds = roleIds; } }
92402b6fc54d23b7efd7f06c1656e45b1b835c0b
5,377
java
Java
src/org/brandonli/sfe/util/algorithms/BlowFish.java
PulseBeat02/Science-Fair-2019-2020
ed7650a3d0a85ab7921eaba6013c9b1e583245a5
[ "Apache-2.0" ]
null
null
null
src/org/brandonli/sfe/util/algorithms/BlowFish.java
PulseBeat02/Science-Fair-2019-2020
ed7650a3d0a85ab7921eaba6013c9b1e583245a5
[ "Apache-2.0" ]
null
null
null
src/org/brandonli/sfe/util/algorithms/BlowFish.java
PulseBeat02/Science-Fair-2019-2020
ed7650a3d0a85ab7921eaba6013c9b1e583245a5
[ "Apache-2.0" ]
null
null
null
27.574359
116
0.657244
1,001,425
package org.brandonli.sfe.util.algorithms; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.KeyGenerator; import javax.crypto.NoSuchPaddingException; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; public class BlowFish { public static volatile boolean isFound = false; public static Cipher cipher; public static void main(String[] args) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { final String code = "qwerty"; // Password start(code); // Start Decyption } public static void start(String code) throws IllegalBlockSizeException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException { cipher = Cipher.getInstance("Blowfish"); final String[] encryptedContents = new String[1]; for (int i = 0; i < encryptedContents.length; i++) { // Encrypt Contents encryptedContents[i] = encrypt(cipher, code); } final long startTime = System.nanoTime(); Thread[] bruteForceThreads = new Thread[16]; for (int i = 0; i < encryptedContents.length; i++) { final String encryptedMessage = encryptedContents[i]; for (int t = 0; t < 16; t++) { System.out.println(t); Thread thread = new Thread(new BruteForceThread(encryptedMessage, code, t)); bruteForceThreads[t] = thread; bruteForceThreads[t].start(); } // decrypt(cipher, encryptedMessage, code); } final long endTime = System.nanoTime(); System.out.println((endTime - startTime) / 1000); } public static String encrypt(Cipher c, String message) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException { final KeyGenerator keygenerator = KeyGenerator.getInstance("Blowfish"); // Get Blowfish Instance final SecretKey secretkey = keygenerator.generateKey(); // Generate a key final SecretKeySpec key = new SecretKeySpec(secretkey.getEncoded(), "Blowfish"); c.init(Cipher.ENCRYPT_MODE, key); // Encrypt the message with the key final byte[] encrypted = c.doFinal(message.getBytes()); // Get the byte array return bytesToHex(encrypted); } public static void decrypt(Cipher c, String encryptedMessage, String message, int threadID) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException { // 32 bit // 255 is equivalent to binary of "11111111" // Assuming we are cracking Blowfish 32-bit, there are 2^32 combinations // We could split this into four loops, each looping from 0 to 255 in order // to get all combinations. (First byte, second byte, third byte, fourth byte) for (int b0 = threadID * 16; b0 < (threadID + 1) * 16; b0++) { for (int b1 = 0; b1 < 256; b1++) { for (int b2 = 0; b2 < 256; b2++) { for (int b3 = 0; b3 < 256; b3++) { if (isFound) return; byte[] key = { (byte) b0, (byte) b1, (byte) b2, (byte) b3 }; // Get the byte array for the key System.out.println("Thread: " + threadID + " : " + Arrays.toString(key)); // Print the current // test case. (You // can remove this // for efficiency) c.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "Blowfish")); // Decrypt using the key byte[] decrypted = {}; try { decrypted = c.doFinal(encryptedMessage.getBytes()); // Start decryption } catch (BadPaddingException e) { continue; } if (Arrays.equals(decrypted, message.getBytes())) { // If the message equals to the original // // message isFound = true; System.out.println("I Found the Text"); // Say that you printed the password return; // Return from the function } } } } } } public static String bytesToHex(byte[] data) { // A function used so I can print bytes to hex if (data == null) { return null; } else { final int len = data.length; String str = ""; for (int i = 0; i < len; i++) { if ((data[i] & 0xFF) < 16) str = str + "0" + java.lang.Integer.toHexString(data[i] & 0xFF); else str = str + java.lang.Integer.toHexString(data[i] & 0xFF); } return str.toUpperCase(); } } } class BruteForceThread implements Runnable { private Cipher c; private String encryptedMessage; private String message; private int threadID; BruteForceThread(String en, String m, int id) throws NoSuchAlgorithmException, NoSuchPaddingException { this.c = Cipher.getInstance("Blowfish"); ; this.encryptedMessage = en; this.message = m; this.threadID = id; } @Override public void run() { try { BlowFish.decrypt(c, encryptedMessage, encryptedMessage, threadID); } catch (InvalidKeyException | IllegalBlockSizeException | BadPaddingException e) { // TODO Auto-generated catch block e.printStackTrace(); } Thread.currentThread().interrupt(); return; } }
92402b81a628cb0950c5a352ef1ebded9744d8d4
848
java
Java
fao-mozfis-api/src/main/java/org/fao/mozfis/request/repository/RequestRepository.java
mitader/sif-api
e82eed548c8321c520c9659e67be8efb1446f8d4
[ "Apache-2.0" ]
null
null
null
fao-mozfis-api/src/main/java/org/fao/mozfis/request/repository/RequestRepository.java
mitader/sif-api
e82eed548c8321c520c9659e67be8efb1446f8d4
[ "Apache-2.0" ]
null
null
null
fao-mozfis-api/src/main/java/org/fao/mozfis/request/repository/RequestRepository.java
mitader/sif-api
e82eed548c8321c520c9659e67be8efb1446f8d4
[ "Apache-2.0" ]
null
null
null
32.769231
104
0.739437
1,001,426
package org.fao.mozfis.request.repository; import java.util.List; import org.fao.mozfis.request.model.RequestEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; /** * Represent CRUD operations on a repository for Request domain entity * * @author Nelson Magalhães ([email protected]) */ public interface RequestRepository extends JpaRepository<RequestEntity, Long>, RequestRepositoryQuery { /** * Find all requests from givin operator * * @param nuit * the nuit's operator * @return the requests found */ @Query("select r from RequestEntity r inner join r.operator o where o.nuit = :nuit") List<RequestEntity> findByOperatorNuit(@Param("nuit") String nuit); }
92402c7e6c0191ae27fd0807def25411dd4628b5
3,221
java
Java
game/src/main/java/com/paragon464/gameserver/util/Utils.java
Tyluur/paragon464-server
6c377aacbc10214ce9f10c66f7c6b5ccc1551590
[ "0BSD" ]
1
2021-04-12T09:43:41.000Z
2021-04-12T09:43:41.000Z
game/src/main/java/com/paragon464/gameserver/util/Utils.java
Tyluur/paragon464-server
6c377aacbc10214ce9f10c66f7c6b5ccc1551590
[ "0BSD" ]
null
null
null
game/src/main/java/com/paragon464/gameserver/util/Utils.java
Tyluur/paragon464-server
6c377aacbc10214ce9f10c66f7c6b5ccc1551590
[ "0BSD" ]
null
null
null
29.281818
89
0.478423
1,001,427
package com.paragon464.gameserver.util; import java.security.SecureRandom; public class Utils { public static final byte[] DIRECTION_DELTA_X = new byte[]{-1, 0, 1, -1, 1, -1, 0, 1}; public static final byte[] DIRECTION_DELTA_Y = new byte[]{1, 1, 1, 0, 0, -1, -1, -1}; private static final long INIT_MILLIS = System.currentTimeMillis(); private static final long INIT_NANOS = System.nanoTime(); private static long millisSinceClassInit() { return (System.nanoTime() - INIT_NANOS) / 1000000; } public static long currentTimeMillis() { return System.currentTimeMillis();//INIT_MILLIS + millisSinceClassInit(); } public static final int getFaceDirection(int xOffset, int yOffset) { return ((int) (Math.atan2(-xOffset, -yOffset) * 2607.5945876176133)) & 0x3fff; } public static int direction(int dx, int dy) { if (dx < 0) { if (dy < 0) { return 5; } else if (dy > 0) { return 0; } else { return 3; } } else if (dx > 0) { if (dy < 0) { return 7; } else if (dy > 0) { return 2; } else { return 4; } } else { if (dy < 0) { return 2; } else if (dy > 0) { return 0; } else { return -1; } } } public static final int getMoveDirection(int xOffset, int yOffset) { if (xOffset < 0) { if (yOffset < 0) return 5; else if (yOffset > 0) return 0; else return 3; } else if (xOffset > 0) { if (yOffset < 0) return 7; else if (yOffset > 0) return 2; else return 4; } else { if (yOffset < 0) return 6; else if (yOffset > 0) return 1; else return -1; } } public static int random(int range) { SecureRandom rnd = new SecureRandom(); int ran = rnd.nextInt(range + 1); rnd = null; return ran; } public static int random(int min, int max) { int roll = min + (int) (Math.random() * ((max) + 1)); if (roll > max) roll = max; return roll; } public static String[] getLastCodeCalled() { StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); String[] s = new String[stackTraceElements.length]; int j = 0; for (int i = 0; i < stackTraceElements.length; i++) { StackTraceElement ste = stackTraceElements[i]; String classname = ste.getClassName(); String methodName = ste.getMethodName(); int lineNumber = ste.getLineNumber(); s[j++] = classname + "." + methodName + ":" + lineNumber; if (s[j - 1] == null) { s[j - 1] = ""; } } // System.out.println(Arrays.toString(s)); return s; } }
92402cac06169ac5a5209eae7f8ed9f47acbfa09
180
java
Java
src/main/java/com/zhuhao/basic/lambdademo/assertdemo/AssertDemo.java
enjoqy/orgzhuhao
8a2208eeb58621e6d3f52566e5e5fa0be6f3d9fe
[ "Apache-2.0" ]
null
null
null
src/main/java/com/zhuhao/basic/lambdademo/assertdemo/AssertDemo.java
enjoqy/orgzhuhao
8a2208eeb58621e6d3f52566e5e5fa0be6f3d9fe
[ "Apache-2.0" ]
null
null
null
src/main/java/com/zhuhao/basic/lambdademo/assertdemo/AssertDemo.java
enjoqy/orgzhuhao
8a2208eeb58621e6d3f52566e5e5fa0be6f3d9fe
[ "Apache-2.0" ]
null
null
null
18
47
0.611111
1,001,428
package com.zhuhao.basic.lambdademo.assertdemo; public class AssertDemo { public static void main(String[] args) { int i = 10; assert i > 11 : "哪个大"; } }
92402cda44dcccfe578bda0be6c02e60ffb0c6bd
431
java
Java
games-api/src/main/java/ee/eerikmagi/experiments/games_app/api/services/ITagService.java
Pisi-Deff/games-app
7b4af34603930ba25f7a8b539d423df643eaa1ef
[ "MIT" ]
1
2020-06-21T16:52:22.000Z
2020-06-21T16:52:22.000Z
games-api/src/main/java/ee/eerikmagi/experiments/games_app/api/services/ITagService.java
Pisi-Deff/games-app
7b4af34603930ba25f7a8b539d423df643eaa1ef
[ "MIT" ]
5
2021-05-10T11:37:41.000Z
2022-02-26T17:18:38.000Z
games-api/src/main/java/ee/eerikmagi/experiments/games_app/api/services/ITagService.java
Pisi-Deff/games-app
7b4af34603930ba25f7a8b539d423df643eaa1ef
[ "MIT" ]
null
null
null
30.785714
71
0.821346
1,001,429
package ee.eerikmagi.experiments.games_app.api.services; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Slice; import ee.eerikmagi.experiments.games_app.api.persistence.entities.Tag; public interface ITagService { Tag getOrCreateTag(String name); Page<String> list(Pageable pageable); Slice<String> list(String name, Pageable pageable); }
92402da2dd71057fccc8915c8dc1fc2ba3b6ffee
1,324
java
Java
graphsdk/src/main/java/com/microsoft/graph/extensions/ContractCollectionPage.java
SailReal/msgraph-sdk-android
68bf5bf437e8688142493de5faf88154c388d7c8
[ "MIT" ]
61
2016-06-11T20:14:35.000Z
2021-06-09T03:47:07.000Z
graphsdk/src/main/java/com/microsoft/graph/extensions/ContractCollectionPage.java
SailReal/msgraph-sdk-android
68bf5bf437e8688142493de5faf88154c388d7c8
[ "MIT" ]
95
2016-03-30T22:16:20.000Z
2020-09-03T18:37:43.000Z
graphsdk/src/main/java/com/microsoft/graph/extensions/ContractCollectionPage.java
SailReal/msgraph-sdk-android
68bf5bf437e8688142493de5faf88154c388d7c8
[ "MIT" ]
49
2016-03-30T19:52:31.000Z
2022-02-25T11:04:50.000Z
37.828571
152
0.676737
1,001,430
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ package com.microsoft.graph.extensions; import com.microsoft.graph.concurrency.*; import com.microsoft.graph.core.*; import com.microsoft.graph.extensions.*; import com.microsoft.graph.http.*; import com.microsoft.graph.generated.*; import com.microsoft.graph.options.*; import com.microsoft.graph.serializer.*; import java.util.Arrays; import java.util.EnumSet; // This file is available for extending, afterwards please submit a pull request. /** * The class for the Contract Collection Page. */ public class ContractCollectionPage extends BaseContractCollectionPage implements IContractCollectionPage { /** * A collection page for Contract. * * @param response The serialized BaseContractCollectionResponse from the service * @param builder The request builder for the next collection page */ public ContractCollectionPage(final BaseContractCollectionResponse response, final IContractCollectionRequestBuilder builder) { super(response, builder); } }
92402ef4e07871d6abc6e76c52b2fbc2f92c7e94
79
java
Java
14 EXERCISE OPENCLOSED LISKOV SUBSTITUTION PRINCIPLES/blobs/interfaces/Reader.java
TsvetanNikolov123/JAVA---OOP-Advanced
a2d1086e70dffc9de65927910e18b9dbb199f769
[ "MIT" ]
null
null
null
14 EXERCISE OPENCLOSED LISKOV SUBSTITUTION PRINCIPLES/blobs/interfaces/Reader.java
TsvetanNikolov123/JAVA---OOP-Advanced
a2d1086e70dffc9de65927910e18b9dbb199f769
[ "MIT" ]
null
null
null
14 EXERCISE OPENCLOSED LISKOV SUBSTITUTION PRINCIPLES/blobs/interfaces/Reader.java
TsvetanNikolov123/JAVA---OOP-Advanced
a2d1086e70dffc9de65927910e18b9dbb199f769
[ "MIT" ]
null
null
null
11.285714
25
0.721519
1,001,431
package blobs.interfaces; public interface Reader { String readLine(); }
92402fc994cd5d482616213ab4556fff950ceee7
281
java
Java
App/TuTinder/app/src/main/java/tutinder/mad/uulm/de/tutinder/models/CustomListitem.java
snap10/TuTinder
bf28fc5add0a5c7ee8e3926539d7c88281b26f74
[ "Apache-2.0" ]
null
null
null
App/TuTinder/app/src/main/java/tutinder/mad/uulm/de/tutinder/models/CustomListitem.java
snap10/TuTinder
bf28fc5add0a5c7ee8e3926539d7c88281b26f74
[ "Apache-2.0" ]
null
null
null
App/TuTinder/app/src/main/java/tutinder/mad/uulm/de/tutinder/models/CustomListitem.java
snap10/TuTinder
bf28fc5add0a5c7ee8e3926539d7c88281b26f74
[ "Apache-2.0" ]
null
null
null
21.615385
45
0.697509
1,001,432
package tutinder.mad.uulm.de.tutinder.models; /** * Created by Snap10 on 02.07.16. */ public interface CustomListitem { public String getId(); public String getTitle(); public String getSubtitle(); public String getThumbnailpath(); public Types getType(); }
92402fd9e37c141be6aac8b7096c813daaa6ab2a
1,337
java
Java
xyz-reader/XYZReader/src/main/java/com/princekumar/xyzreader/datamodel/Article.java
prince-m-singh/MaterialDesign
579f6c2287b856040857c21b5c4ac5afc0773b0c
[ "Apache-2.0" ]
null
null
null
xyz-reader/XYZReader/src/main/java/com/princekumar/xyzreader/datamodel/Article.java
prince-m-singh/MaterialDesign
579f6c2287b856040857c21b5c4ac5afc0773b0c
[ "Apache-2.0" ]
null
null
null
xyz-reader/XYZReader/src/main/java/com/princekumar/xyzreader/datamodel/Article.java
prince-m-singh/MaterialDesign
579f6c2287b856040857c21b5c4ac5afc0773b0c
[ "Apache-2.0" ]
null
null
null
30.386364
70
0.711294
1,001,433
package com.princekumar.xyzreader.datamodel; /** * Created by princ on 05-08-2017. */ import com.google.auto.value.AutoValue; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; @AutoValue public abstract class Article { public abstract int id(); public abstract String title(); public abstract String author(); public abstract String body(); public abstract String thumb(); public abstract String photo(); public abstract double aspect_ratio(); public abstract String published_date(); public static Builder builder() { return new AutoValue_Article.Builder(); } public static JsonAdapter<Article> jsonAdapter(Moshi moshi) { return new AutoValue_Article.MoshiJsonAdapter(moshi); } @AutoValue.Builder public abstract static class Builder { public abstract Builder id(int id); public abstract Builder title(String title); public abstract Builder author(String author); public abstract Builder body(String body); public abstract Builder thumb(String thumb); public abstract Builder photo(String photo); public abstract Builder aspect_ratio(double aspect_ratio); public abstract Builder published_date(String published_date); public abstract Article build(); } }
924030606e2c4389a7c716fbea548685180ed29f
437
java
Java
xc-framework-common/src/main/java/com/xuecheng/framework/exception/CustomException.java
IBXiaomi/OnlineLearning
eb5e9e59694569af68ad3a09ad46aedf1e9ad09e
[ "Apache-2.0" ]
1
2020-01-03T01:40:04.000Z
2020-01-03T01:40:04.000Z
xc-framework-common/src/main/java/com/xuecheng/framework/exception/CustomException.java
IBXiaomi/OnlineLearning
eb5e9e59694569af68ad3a09ad46aedf1e9ad09e
[ "Apache-2.0" ]
12
2019-12-25T15:19:31.000Z
2020-07-09T02:57:39.000Z
xc-framework-common/src/main/java/com/xuecheng/framework/exception/CustomException.java
IBXiaomi/OnlineLearning
eb5e9e59694569af68ad3a09ad46aedf1e9ad09e
[ "Apache-2.0" ]
null
null
null
19
56
0.716247
1,001,434
package com.xuecheng.framework.exception; import com.xuecheng.framework.model.response.ResultCode; /** * 自定义异常类,对于代码中可能出现的已知类型的异常进行处理 * * @author 吧嘻小米 * @date 2020/05/02 */ public class CustomException extends RuntimeException { ResultCode resultCode; public CustomException(ResultCode resultCode) { this.resultCode = resultCode; } public ResultCode getResultCode() { return resultCode; } }
92403157d4be5a562ca7fdab9e74bc871507c280
1,316
java
Java
client/src/test/java/ninja/eivind/usagetracker/client/PreparedClientActivityFactoryTest.java
eivindveg/usage-tracker-java
41605fc9cd4d5bbb70b4cb144629c29a751445f9
[ "Apache-2.0" ]
null
null
null
client/src/test/java/ninja/eivind/usagetracker/client/PreparedClientActivityFactoryTest.java
eivindveg/usage-tracker-java
41605fc9cd4d5bbb70b4cb144629c29a751445f9
[ "Apache-2.0" ]
null
null
null
client/src/test/java/ninja/eivind/usagetracker/client/PreparedClientActivityFactoryTest.java
eivindveg/usage-tracker-java
41605fc9cd4d5bbb70b4cb144629c29a751445f9
[ "Apache-2.0" ]
1
2018-09-04T16:12:29.000Z
2018-09-04T16:12:29.000Z
32.097561
108
0.759878
1,001,435
package ninja.eivind.usagetracker.client; import ninja.eivind.usagetracker.ClientActivity; import org.junit.Before; import org.junit.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.Validator; import javax.validation.ValidatorFactory; import java.util.Collections; import java.util.Set; import java.util.UUID; import static org.junit.Assert.assertEquals; public class PreparedClientActivityFactoryTest { public static final String APP_ID = "test-app"; private ClientActivityFactory factory; private Validator validator; @Before public void setUp() { ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory(); validator = validatorFactory.getValidator(); UUID clientId = UUID.randomUUID(); factory = new PreparedClientActivityFactory(clientId, APP_ID); } @Test public void testCreateActivity() throws Exception { ClientActivity activity = factory.createActivity(); Set<ConstraintViolation<ClientActivity>> expected = Collections.emptySet(); Set<ConstraintViolation<ClientActivity>> actual = validator.validate(activity); assertEquals("Validating the object provided by the factory gives an empty set.", expected, actual); } }
9240331d10109e62614e52eebc85f3d6b5601153
1,098
java
Java
gulimall-search/src/main/java/com/lsh/gulimall/search/controller/ElasticSearchController.java
star574/gulli-mall
457ef99561d7998953055a5c7cf8ff7e1458fb57
[ "Apache-2.0" ]
null
null
null
gulimall-search/src/main/java/com/lsh/gulimall/search/controller/ElasticSearchController.java
star574/gulli-mall
457ef99561d7998953055a5c7cf8ff7e1458fb57
[ "Apache-2.0" ]
null
null
null
gulimall-search/src/main/java/com/lsh/gulimall/search/controller/ElasticSearchController.java
star574/gulli-mall
457ef99561d7998953055a5c7cf8ff7e1458fb57
[ "Apache-2.0" ]
null
null
null
30.5
164
0.794171
1,001,436
package com.lsh.gulimall.search.controller; import com.lsh.gulimall.common.exception.BizCodeEnume; import com.lsh.gulimall.common.to.es.SkuEsModel; import com.lsh.gulimall.common.utils.R; import com.lsh.gulimall.search.service.ProductService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping("/search") public class ElasticSearchController { @Autowired private ProductService productService; /** * //TODO * * @param * @return * @throws * @date 2021/6/29 上午2:06 * @Description 上架商品 */ @PostMapping("/save/product") public R productStatusUp(@RequestBody List<SkuEsModel> skuEsModelList) { return productService.productStatusUp(skuEsModelList) ? R.ok() : R.error(BizCodeEnume.PRODUCT_UP_EXCEPTION.getCode(), BizCodeEnume.PRODUCT_UP_EXCEPTION.getMsg()); } }
9240349e913668f47b81fe0221b6404c5dd05cc4
2,310
java
Java
src/main/java/me/coley/recaf/command/impl/Remap.java
x4e/Recaf
351b21cbe4ad39731169f27302b8e11d3cb8001c
[ "MIT" ]
3
2020-11-04T13:41:59.000Z
2021-02-14T09:56:52.000Z
src/main/java/me/coley/recaf/command/impl/Remap.java
x4e/Recaf
351b21cbe4ad39731169f27302b8e11d3cb8001c
[ "MIT" ]
null
null
null
src/main/java/me/coley/recaf/command/impl/Remap.java
x4e/Recaf
351b21cbe4ad39731169f27302b8e11d3cb8001c
[ "MIT" ]
1
2021-03-21T11:04:57.000Z
2021-03-21T11:04:57.000Z
35.538462
102
0.725974
1,001,437
package me.coley.recaf.command.impl; import me.coley.recaf.command.ControllerCommand; import me.coley.recaf.command.completion.FileCompletions; import me.coley.recaf.mapping.*; import org.objectweb.asm.ClassReader; import picocli.CommandLine; import java.nio.file.Files; import java.nio.file.Path; import java.util.Map; import java.util.concurrent.Callable; import static me.coley.recaf.util.Log.*; /** * Command for applying mappings. * * @author Matt */ @CommandLine.Command(name = "remap", description = "Apply mappings to the workspace.") public class Remap extends ControllerCommand implements Callable<Void> { @CommandLine.Parameters(index = "0", description = "The mapping type.", arity = "0..1") public MappingImpl mapper = MappingImpl.SIMPLE; @CommandLine.Parameters(index = "1", description = "The mapping file.", completionCandidates = FileCompletions.class) public Path mapFile; @CommandLine.Option(names = "--noDebug", description = "Clear debug info (variable names/generics).") public boolean noDebug; @CommandLine.Option(names = "--allowLookup", description = "Allow hierarchy lookups for inheritance supported mapping. " + "Disable for faster mapping if hierarchy is accounted for in the mapping file.", defaultValue = "true") public boolean lookup = true; /** * @return n/a * * @throws Exception * <ul><li>IllegalStateException, Invalid map file given</li></ul> */ @Override public Void call() throws Exception { if(mapFile == null || !Files.exists(mapFile)) throw new IllegalStateException("No mapping file provided!"); // Apply Mappings mappings = mapper.create(mapFile, getWorkspace()); mappings.setClearDebugInfo(noDebug); mappings.setCheckFieldHierarchy(lookup); mappings.setCheckMethodHierarchy(lookup); Map<String, byte[]> mapped = mappings.accept(getWorkspace().getPrimary()); // TODO: If the primary has a "META-INF/MANIFEST.MF" update the main class if renamed // Log StringBuilder sb = new StringBuilder("Classes updated: " + mapped.size()); mapped.forEach((old, value) -> { ClassReader reader = new ClassReader(value); String rename = reader.getClassName(); if (!old.equals(rename)) sb.append("\n - ").append(old).append(" => ").append(rename); }); info(sb.toString()); return null; } }
92403569fba000dd1c5fcb7da48d301552d1ed8c
1,571
java
Java
project/gardener/src/main/java/kr/co/gardener/admin/dao/user/impl/HistoryDaoImpl.java
jing-si/plant
d73a36dba5b5793f23a6b0a7dc0ecb5f2095f9dd
[ "MIT" ]
3
2021-10-02T07:30:18.000Z
2021-10-09T07:54:55.000Z
project/gardener/src/main/java/kr/co/gardener/admin/dao/user/impl/HistoryDaoImpl.java
jing-si/plant
d73a36dba5b5793f23a6b0a7dc0ecb5f2095f9dd
[ "MIT" ]
11
2021-10-02T10:48:52.000Z
2021-10-21T02:31:49.000Z
project/gardener/src/main/java/kr/co/gardener/admin/dao/user/impl/HistoryDaoImpl.java
jing-si/plant
d73a36dba5b5793f23a6b0a7dc0ecb5f2095f9dd
[ "MIT" ]
null
null
null
20.946667
62
0.737747
1,001,438
package kr.co.gardener.admin.dao.user.impl; import java.util.List; import org.apache.ibatis.session.SqlSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import kr.co.gardener.admin.dao.user.HistoryDao; import kr.co.gardener.admin.model.user.History; import kr.co.gardener.util.ComboItem; import kr.co.gardener.util.Pager; @Repository public class HistoryDaoImpl implements HistoryDao { @Autowired SqlSession sql; @Override public List<History> list() { return sql.selectList("history.list"); } @Override public void add(History item) { sql.insert("history.add", item); } @Override public History item(int historyId) { return sql.selectOne("history.item", historyId); } @Override public void update(History item) { sql.update("history.update", item); } @Override public void delete(int historyId) { sql.delete("history.delete", historyId); } @Override public List<History> list_pager(Pager pager) { return sql.selectList("history.list_pager", pager); } @Override public float total(Pager pager) { return sql.selectOne("history.total"); } @Override public List<ComboItem> combo() { return sql.selectList("history.combo"); } @Override public void insert_list(List<History> list) { sql.insert("history.insert_list", list); } @Override public void delete_list(List<History> list) { sql.insert("history.delete_list", list); } @Override public void update_list(List<History> list) { sql.insert("history.update_list", list); } }
92403625ef15c47fcee5be9013952cb3345d23cc
1,644
java
Java
src/main/java/gui/pages/mainMenu/StartMainMenu.java
Matt-Crow/Orpheus
33111349e9d58abfae3c078368915ffa6e6bf3b7
[ "MIT" ]
1
2022-02-23T02:53:32.000Z
2022-02-23T02:53:32.000Z
src/main/java/gui/pages/mainMenu/StartMainMenu.java
Matt-Crow/Orpheus
33111349e9d58abfae3c078368915ffa6e6bf3b7
[ "MIT" ]
1
2022-02-04T21:17:39.000Z
2022-02-04T21:19:15.000Z
src/main/java/gui/pages/mainMenu/StartMainMenu.java
Matt-Crow/Orpheus
33111349e9d58abfae3c078368915ffa6e6bf3b7
[ "MIT" ]
null
null
null
29.357143
84
0.586375
1,001,439
package gui.pages.mainMenu; import java.awt.GridLayout; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import javax.swing.JButton; import javax.swing.JLabel; import gui.pages.Page; /** * * @author Matt */ public class StartMainMenu extends Page{ public StartMainMenu(){ addMenuItem(new JLabel("The Orpheus Proposition")); setLayout(new GridLayout(1, 3)); JButton about = new JButton("About this game"); about.addActionListener((e)->{ getHost().switchToPage(new StartTextDisplay(readFile("README.txt"))); }); add(about); JButton play = new JButton("Play"); play.addActionListener((e)->{ getHost().switchToPage(new StartPlay()); }); add(play); JButton howToPlay = new JButton("How to play"); howToPlay.addActionListener((e)->{ getHost().switchToPage(new StartTextDisplay(readFile("howToPlay.txt"))); }); add(howToPlay); } private String readFile(String fileName){ StringBuilder bui = new StringBuilder(); InputStream in = StartMainMenu.class.getResourceAsStream("/" + fileName); if(in != null){ BufferedReader buff = new BufferedReader(new InputStreamReader(in)); try { while(buff.ready()){ bui.append(buff.readLine()).append('\n'); } } catch (IOException ex) { ex.printStackTrace(); } } return bui.toString(); } }
924037faeeaa631d300a3138be0c31b30cc648f1
5,481
java
Java
src/main/java/com/algos/stockscanner/views/main/MainView.java
algos-soft/stockscanner
429a1bade7e5264f339e21e08d45cc360fbbe90f
[ "Unlicense" ]
null
null
null
src/main/java/com/algos/stockscanner/views/main/MainView.java
algos-soft/stockscanner
429a1bade7e5264f339e21e08d45cc360fbbe90f
[ "Unlicense" ]
null
null
null
src/main/java/com/algos/stockscanner/views/main/MainView.java
algos-soft/stockscanner
429a1bade7e5264f339e21e08d45cc360fbbe90f
[ "Unlicense" ]
null
null
null
38.598592
135
0.694946
1,001,440
package com.algos.stockscanner.views.main; import java.util.Optional; import com.algos.stockscanner.views.PageSubtitle; import com.algos.stockscanner.views.admin.AdminView; import com.algos.stockscanner.views.users.*; import com.algos.stockscanner.views.simulations.SimulationsView; import com.vaadin.flow.component.Component; import com.vaadin.flow.component.ComponentUtil; import com.vaadin.flow.component.applayout.AppLayout; import com.vaadin.flow.component.applayout.DrawerToggle; import com.vaadin.flow.component.avatar.Avatar; import com.vaadin.flow.component.html.Image; import com.vaadin.flow.component.html.H1; import com.vaadin.flow.component.orderedlayout.FlexComponent; import com.vaadin.flow.component.orderedlayout.HorizontalLayout; import com.vaadin.flow.component.orderedlayout.VerticalLayout; import com.vaadin.flow.component.page.Push; import com.vaadin.flow.component.tabs.Tab; import com.vaadin.flow.component.tabs.Tabs; import com.vaadin.flow.component.tabs.TabsVariant; import com.vaadin.flow.router.RouterLink; import com.vaadin.flow.server.PWA; import com.algos.stockscanner.views.generators.GeneratorsView; import com.algos.stockscanner.views.indexes.IndexesView; import com.algos.stockscanner.views.settings.SettingsView; import com.algos.stockscanner.views.about.AboutView; import com.vaadin.flow.component.dependency.JsModule; import com.vaadin.flow.component.dependency.CssImport; /** * The main view is a top-level placeholder for other views. */ @PWA(name = "StockScanner", shortName = "StockScanner", enableInstallPrompt = false, iconPath = "images/logo.png") @JsModule("./styles/shared-styles.js") @CssImport("./views/main/main-view.css") @Push // or you can not access the UI from non-UI threads. This annotation must be on a top-level layout. public class MainView extends AppLayout { private final Tabs menu; private H1 viewTitle; public MainView() { setPrimarySection(Section.DRAWER); addToNavbar(true, createHeaderContent()); menu = createMenu(); addToDrawer(createDrawerContent(menu)); } private Component createHeaderContent() { HorizontalLayout layout = new HorizontalLayout(); layout.setId("header"); layout.getThemeList().set("dark", true); layout.setWidthFull(); layout.setSpacing(false); layout.setAlignItems(FlexComponent.Alignment.CENTER); viewTitle = new H1(); HorizontalLayout customArea = new HorizontalLayout(); customArea.setId("custom"); customArea.setWidthFull(); // customArea.add(new Label("custom1")); // customArea.add(new Label("pluto")); // customArea.add(new Label("paperino")); customArea.getStyle().set("margin-left","1em"); customArea.getStyle().set("margin-right","1em"); layout.add(new DrawerToggle()); layout.add(viewTitle); layout.add(customArea); layout.add(new Avatar()); return layout; } private Component createDrawerContent(Tabs menu) { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setPadding(false); layout.setSpacing(false); layout.getThemeList().set("spacing-s", true); layout.setAlignItems(FlexComponent.Alignment.STRETCH); HorizontalLayout logoLayout = new HorizontalLayout(); logoLayout.setId("logo"); logoLayout.setAlignItems(FlexComponent.Alignment.CENTER); logoLayout.add(new Image("images/logo.png", "StockScanner logo")); logoLayout.add(new H1("StockScanner")); layout.add(logoLayout, menu); return layout; } private Tabs createMenu() { final Tabs tabs = new Tabs(); tabs.setOrientation(Tabs.Orientation.VERTICAL); tabs.addThemeVariants(TabsVariant.LUMO_MINIMAL); tabs.setId("tabs"); tabs.add(createMenuItems()); return tabs; } private Component[] createMenuItems() { return new Tab[]{ createTab("Generators", GeneratorsView.class), createTab("Simulations", SimulationsView.class), createTab("Indexes", IndexesView.class), createTab("Admin", AdminView.class), createTab("Settings", SettingsView.class), createTab("Users", UsersView.class), createTab("About", AboutView.class)}; } private static Tab createTab(String text, Class<? extends Component> navigationTarget) { final Tab tab = new Tab(); tab.add(new RouterLink(text, navigationTarget)); ComponentUtil.setData(tab, Class.class, navigationTarget); return tab; } @Override protected void afterNavigation() { super.afterNavigation(); getTabForComponent(getContent()).ifPresent(menu::setSelectedTab); viewTitle.setText(getCurrentPageTitle()); } private Optional<Tab> getTabForComponent(Component component) { Optional<Tab> foundTab = menu.getChildren().filter(tab -> ComponentUtil.getData(tab, Class.class).equals(component.getClass())) .findFirst().map(Tab.class::cast); return foundTab; } private String getCurrentPageTitle() { // PageTitle title = getContent().getClass().getAnnotation(PageTitle.class); PageSubtitle title = getContent().getClass().getAnnotation(PageSubtitle.class); return title == null ? "" : title.value(); } }
92403818bc238e02c666e2f2904e865ef65351ef
6,510
java
Java
src/main/java/com/synopsys/integration/detect/workflow/airgap/GradleAirGapCreator.java
Darkgran1/synopsys-detect
e020742c037c6a0432e84d1f364b642f227cfff8
[ "Apache-2.0" ]
1
2020-07-12T23:12:32.000Z
2020-07-12T23:12:32.000Z
src/main/java/com/synopsys/integration/detect/workflow/airgap/GradleAirGapCreator.java
mureinik/synopsys-detect
d61e5c03015be273bcfe81c573b8937d79fd888b
[ "Apache-2.0" ]
27
2019-11-22T16:37:37.000Z
2022-03-31T01:15:10.000Z
src/main/java/com/synopsys/integration/detect/workflow/airgap/GradleAirGapCreator.java
Darkgran1/synopsys-detect
e020742c037c6a0432e84d1f364b642f227cfff8
[ "Apache-2.0" ]
null
null
null
50.859375
202
0.74639
1,001,441
/** * synopsys-detect * * Copyright (c) 2019 Synopsys, Inc. * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.synopsys.integration.detect.workflow.airgap; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import org.apache.commons.io.FileUtils; import org.apache.commons.text.StringEscapeUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.synopsys.integration.detect.exception.DetectUserFriendlyException; import com.synopsys.integration.detect.exitcode.ExitCodeType; import com.synopsys.integration.detect.tool.detector.inspectors.GradleInspectorInstaller; import com.synopsys.integration.detectable.DetectableEnvironment; import com.synopsys.integration.detectable.detectable.exception.DetectableException; import com.synopsys.integration.detectable.detectable.executable.ExecutableOutput; import com.synopsys.integration.detectable.detectable.executable.ExecutableRunner; import com.synopsys.integration.detectable.detectable.executable.ExecutableRunnerException; import com.synopsys.integration.detectable.detectable.executable.resolver.GradleResolver; import ch.qos.logback.core.util.FileUtil; import freemarker.template.Configuration; import freemarker.template.Template; import freemarker.template.TemplateException; public class GradleAirGapCreator { private final Logger logger = LoggerFactory.getLogger(this.getClass()); private final GradleResolver gradleResolver; private final GradleInspectorInstaller gradleInspectorInstaller; private final ExecutableRunner executableRunner; private final Configuration configuration; public GradleAirGapCreator(final GradleResolver gradleResolver, final GradleInspectorInstaller gradleInspectorInstaller, final ExecutableRunner executableRunner, final Configuration configuration) { this.gradleResolver = gradleResolver; this.gradleInspectorInstaller = gradleInspectorInstaller; this.executableRunner = executableRunner; this.configuration = configuration; } public void installGradleDependencies(final File gradleTemp, final File gradleTarget) throws DetectUserFriendlyException { logger.info("Checking for gradle on the path."); final File gradle; try { gradle = gradleResolver.resolveGradle(new DetectableEnvironment(gradleTemp)); if (gradle == null) { throw new DetectUserFriendlyException("Gradle must be on the path to make an Air Gap zip.", ExitCodeType.FAILURE_CONFIGURATION); } } catch (final DetectableException e) { throw new DetectUserFriendlyException("An error occurred while finding Gradle which is needed to make an Air Gap zip.", e, ExitCodeType.FAILURE_CONFIGURATION); } logger.info("Determining inspector version."); final String gradleVersion = gradleInspectorInstaller.findVersion("").get(); logger.info("Determined inspector version: " + gradleVersion); final File gradleOutput = new File(gradleTemp, "dependencies"); logger.info("Using temporary gradle dependency directory: " + gradleOutput); final File buildGradle = new File(gradleTemp, "build.gradle"); final File settingsGradle = new File(gradleTemp, "settings.gradle"); logger.info("Using temporary gradle build file: " + buildGradle); logger.info("Using temporary gradle settings file: " + settingsGradle); FileUtil.createMissingParentDirectories(buildGradle); FileUtil.createMissingParentDirectories(settingsGradle); logger.info("Writing to temporary gradle build file."); try { final Map<String, String> gradleScriptData = new HashMap<>(); gradleScriptData.put("gradleOutput", StringEscapeUtils.escapeJava(gradleOutput.getCanonicalPath())); gradleScriptData.put("gradleVersion", gradleVersion); final Template gradleScriptTemplate = configuration.getTemplate("create-gradle-airgap-script.ftl"); try (final Writer fileWriter = new FileWriter(buildGradle)) { gradleScriptTemplate.process(gradleScriptData, fileWriter); } FileUtils.writeStringToFile(settingsGradle, "", StandardCharsets.UTF_8); } catch (final IOException | TemplateException e) { throw new DetectUserFriendlyException("An error occurred creating the temporary build.gradle while creating the Air Gap zip.", e, ExitCodeType.FAILURE_CONFIGURATION); } logger.info("Invoking gradle install on temporary directory."); try { final ExecutableOutput executableOutput = executableRunner.execute(gradleTemp, gradle, "installDependencies"); if (executableOutput.getReturnCode() != 0) { throw new DetectUserFriendlyException("Gradle returned a non-zero exit code while installing Air Gap dependencies.", ExitCodeType.FAILURE_CONFIGURATION); } } catch (final ExecutableRunnerException e) { throw new DetectUserFriendlyException("An error occurred using Gradle to make an Air Gap zip.", e, ExitCodeType.FAILURE_CONFIGURATION); } try { logger.info("Moving generated dependencies to final gradle folder: " + gradleTarget.getCanonicalPath()); FileUtils.moveDirectory(gradleOutput, gradleTarget); FileUtils.deleteDirectory(gradleTemp); } catch (final IOException e) { throw new DetectUserFriendlyException("An error occurred moving gradle dependencies to Air Gap folder.", ExitCodeType.FAILURE_CONFIGURATION); } } }
9240385fbe27abd3a63fd65d04f66faebfc8b6a1
3,884
java
Java
GUIErrorDetector/src/edu/washington/cs/detector/walaextension/ParamTypeCustomizedEntrypoint.java
zhang-sai/guierrordetector
583c523d32219725d0a9e46132d73cdfd7e32028
[ "MIT" ]
null
null
null
GUIErrorDetector/src/edu/washington/cs/detector/walaextension/ParamTypeCustomizedEntrypoint.java
zhang-sai/guierrordetector
583c523d32219725d0a9e46132d73cdfd7e32028
[ "MIT" ]
null
null
null
GUIErrorDetector/src/edu/washington/cs/detector/walaextension/ParamTypeCustomizedEntrypoint.java
zhang-sai/guierrordetector
583c523d32219725d0a9e46132d73cdfd7e32028
[ "MIT" ]
null
null
null
32.915254
108
0.732492
1,001,442
package edu.washington.cs.detector.walaextension; import java.util.Collection; import java.util.HashSet; import java.util.Set; import com.ibm.wala.classLoader.IClass; import com.ibm.wala.classLoader.IMethod; import com.ibm.wala.ipa.callgraph.Entrypoint; import com.ibm.wala.ipa.callgraph.impl.DefaultEntrypoint; import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.types.TypeReference; import com.ibm.wala.util.collections.HashSetFactory; import edu.washington.cs.detector.util.Files; import edu.washington.cs.detector.util.WALAUtils; /* * This class "selectively" creates a set of concrete classes of a entry * method's parameters, based on user's input. * */ public class ParamTypeCustomizedEntrypoint extends DefaultEntrypoint { // a set of user provided classes, whose instances should be created // in terms of full class name public static final Set<String> usr_classes = new HashSet<String>(); public static void setUserClasses(Collection<String> classFullNames) { System.err.println("User class num: " + classFullNames.size() + " for param type customized entrypoint."); usr_classes.addAll(classFullNames); } public static void setUserClasses(String fileName) { setUserClasses(Files.readWholeNoExp(fileName)); } public static void clearUserClasses() { usr_classes.clear(); } public static ParamTypeCustomizedEntrypoint convertEntrypoint( Entrypoint defaultEntrypoint) { if(!(defaultEntrypoint instanceof DefaultEntrypoint)) { throw new RuntimeException("It must be a DefaultEntrypoint type."); } return new ParamTypeCustomizedEntrypoint(defaultEntrypoint.getMethod(), ((DefaultEntrypoint)defaultEntrypoint).getCha()); } //TODO ugly hack, the entrypoint here mean DefaultEntrypoint //The return type is actually ParamTypeCustomizedEntrypoint public static Iterable<Entrypoint> convertEntrypoints( Iterable<Entrypoint> eps) { HashSet<Entrypoint> converted = HashSetFactory.make(); for (Entrypoint ep : eps) { converted.add(convertEntrypoint(ep)); } return converted; } /** * All instance method * */ public ParamTypeCustomizedEntrypoint(IMethod method, IClassHierarchy cha) { super(method, cha); } // overriding the following two methods @Override protected TypeReference[][] makeParameterTypes(IMethod method) { TypeReference[][] result = new TypeReference[method.getNumberOfParameters()][]; for (int i = 0; i < result.length; i++) { result[i] = makeParameterTypes(method, i); } return result; } @Override protected TypeReference[] makeParameterTypes(IMethod method, int i) { //if there is no user specified entry point, just use the default ones if(usr_classes.isEmpty()) { return super.makeParameterTypes(method, i); } //debugging //System.err.println("processing: " + method); //add corresponding usr defined classes TypeReference nominal = method.getParameterType(i); if (nominal.isPrimitiveType() || nominal.isArrayType()) return new TypeReference[] { nominal }; else { IClass nc = getCha().lookupClass(nominal); if(nc == null) { //like a class which WALA pretends to not see, like java.net.URL //System.err.println(" " + nominal); return new TypeReference[] { nominal }; } Collection<IClass> subcs = nc.isInterface() ? getCha().getImplementors(nominal) : getCha().computeSubClasses(nominal); //get all subclasses, including itself! Set<TypeReference> subs = HashSetFactory.make(); subs.add(nominal); for (IClass cs : subcs) { if (!cs.isAbstract() && !cs.isInterface()) { String csFullName = WALAUtils.getJavaFullClassName(cs); //add it only if the class is included in the list provide by users if(usr_classes.contains(csFullName)) { subs.add(cs.getReference()); } } } return subs.toArray(new TypeReference[subs.size()]); } } }
924038926d3eb31ca75b202791f95e3c17d81477
120
java
Java
Oefeningen_Java/JDBC/src/db10entity/TooLate.java
olivierthas/Programming-Essentials-2
7a92d562e9e7603a2642e573dc925c29893fde70
[ "MIT" ]
null
null
null
Oefeningen_Java/JDBC/src/db10entity/TooLate.java
olivierthas/Programming-Essentials-2
7a92d562e9e7603a2642e573dc925c29893fde70
[ "MIT" ]
null
null
null
Oefeningen_Java/JDBC/src/db10entity/TooLate.java
olivierthas/Programming-Essentials-2
7a92d562e9e7603a2642e573dc925c29893fde70
[ "MIT" ]
null
null
null
13.333333
40
0.625
1,001,443
package db10entity; public class TooLate extends Exception { public TooLate() { super("te laat"); } }
92403aa3d42985c55b7c12dd7d270b4f7b852283
357
java
Java
src/test/java/solutions/SingleNumberTest.java
aiyanbo/leetcode
6acc75fe1d77c7a048bcd17545d6a048be2cade5
[ "MIT" ]
null
null
null
src/test/java/solutions/SingleNumberTest.java
aiyanbo/leetcode
6acc75fe1d77c7a048bcd17545d6a048be2cade5
[ "MIT" ]
null
null
null
src/test/java/solutions/SingleNumberTest.java
aiyanbo/leetcode
6acc75fe1d77c7a048bcd17545d6a048be2cade5
[ "MIT" ]
null
null
null
19.833333
91
0.633053
1,001,444
package solutions; import junit.framework.TestCase; /** * Component: * Description: * Date: 14/11/3 * * @author Andy Ai */ public class SingleNumberTest extends TestCase { public void test() { SingleNumber solution = new SingleNumber(); assertEquals(1, solution.singleNumber(new int[]{0, 1, 0, 3, 4, 5, 8, 3, 5, 4, 8})); } }
92403be745bd259314b054bdd258bd3e5981f499
1,021
java
Java
phoenix-dev-core/src/main/java/com/dianping/phoenix/dev/core/tools/utils/SortedProperties.java
unidal/phoenix
05c48fc75591114403ba2cb0552ef4b66b1442ad
[ "Apache-2.0" ]
6
2015-12-04T08:52:34.000Z
2021-07-29T09:49:11.000Z
phoenix-dev-core/src/main/java/com/dianping/phoenix/dev/core/tools/utils/SortedProperties.java
unidal/phoenix
05c48fc75591114403ba2cb0552ef4b66b1442ad
[ "Apache-2.0" ]
null
null
null
phoenix-dev-core/src/main/java/com/dianping/phoenix/dev/core/tools/utils/SortedProperties.java
unidal/phoenix
05c48fc75591114403ba2cb0552ef4b66b1442ad
[ "Apache-2.0" ]
8
2015-08-19T00:13:01.000Z
2020-12-01T01:58:46.000Z
24.902439
64
0.729677
1,001,445
package com.dianping.phoenix.dev.core.tools.utils; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.LinkedHashSet; import java.util.Properties; import java.util.Set; import java.util.Vector; @SuppressWarnings("serial") public class SortedProperties extends Properties { /** * Overrides, called by the store() method. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public synchronized Enumeration keys() { Enumeration keysEnum = super.keys(); Vector keyList = new Vector(); while (keysEnum.hasMoreElements()) { keyList.add(keysEnum.nextElement()); } Collections.sort(keyList); return keyList.elements(); } /** * Overrides, called by the storeToXML() method. */ @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Set<Object> keySet() { Set origKeySet = super.keySet(); ArrayList<String> keyList = new ArrayList<String>(origKeySet); Collections.sort(keyList); return new LinkedHashSet<Object>(keyList); } }
92403c0bf702abca5df1f5490d1b8226d17ad806
1,209
java
Java
Java/Java Web/02.Java MVC Frameworks - Spring - February 2019/07.Integration Tasting/Exercise/cardealer/src/test/java/org/softuni/cardealer/web/controllers/HomeControllerTest.java
mgpavlov/SoftUni
cef1a7e4e475c69bbeb7bfdcaf7b3e64c88d604c
[ "MIT" ]
1
2019-06-07T18:24:58.000Z
2019-06-07T18:24:58.000Z
Java/Java Web/02.Java MVC Frameworks - Spring - February 2019/07.Integration Tasting/Exercise/cardealer/src/test/java/org/softuni/cardealer/web/controllers/HomeControllerTest.java
mgpavlov/SoftUni
cef1a7e4e475c69bbeb7bfdcaf7b3e64c88d604c
[ "MIT" ]
null
null
null
Java/Java Web/02.Java MVC Frameworks - Spring - February 2019/07.Integration Tasting/Exercise/cardealer/src/test/java/org/softuni/cardealer/web/controllers/HomeControllerTest.java
mgpavlov/SoftUni
cef1a7e4e475c69bbeb7bfdcaf7b3e64c88d604c
[ "MIT" ]
1
2020-06-16T11:20:31.000Z
2020-06-16T11:20:31.000Z
31.815789
86
0.741108
1,001,446
package org.softuni.cardealer.web.controllers; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc public class HomeControllerTest { @Autowired private MockMvc mvc; @Test public void index_ReturnsCorrectView() throws Exception { this.mvc .perform(get("/")) .andExpect(view().name("index")); } @Test @WithMockUser("spring") public void home_ReturnsCorrectView() throws Exception { this.mvc .perform(get("/home")) .andExpect(view().name("home")); } }
92403c1bdf91346bcee86b2e53319ca2ea9830cd
27,721
java
Java
octopus-core/src/main/java/kr/co/bitnine/octopus/engine/calcite/CalciteSchema.java
taewhi/octopus
54cfcd22a56da8d24fed6b3bc63052034e1b13b3
[ "Apache-2.0" ]
22
2015-04-02T08:37:54.000Z
2021-02-15T09:40:46.000Z
octopus-core/src/main/java/kr/co/bitnine/octopus/engine/calcite/CalciteSchema.java
LeeBeomYong/octopus
1f3462be753440e4d1bcca57c1e5aa853625bc47
[ "Apache-2.0" ]
8
2015-04-07T06:36:05.000Z
2019-07-02T17:19:36.000Z
octopus-core/src/main/java/kr/co/bitnine/octopus/engine/calcite/CalciteSchema.java
LeeBeomYong/octopus
1f3462be753440e4d1bcca57c1e5aa853625bc47
[ "Apache-2.0" ]
13
2015-04-06T00:36:01.000Z
2021-08-30T17:30:03.000Z
35.769032
98
0.608347
1,001,447
/* * 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 kr.co.bitnine.octopus.engine.calcite; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.ImmutableSortedSet; import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.NavigableMap; import java.util.NavigableSet; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; import org.apache.calcite.linq4j.tree.Expression; import org.apache.calcite.materialize.Lattice; import org.apache.calcite.schema.Function; import org.apache.calcite.schema.Schema; import org.apache.calcite.schema.SchemaPlus; import org.apache.calcite.schema.Table; import org.apache.calcite.schema.TableMacro; import org.apache.calcite.schema.impl.MaterializedViewTable; import org.apache.calcite.schema.impl.StarTable; import org.apache.calcite.util.Compatible; /** * Schema. * <p/> * <p>Wrapper around user-defined schema used internally.</p> */ public abstract class CalciteSchema { /** * Comparator that compares all strings differently, but if two strings are * equal in case-insensitive match they are right next to each other. In a * collection sorted on this comparator, we can find case-insensitive matches * for a given string using a range scan between the upper-case string and * the lower-case string. */ protected static final Comparator<String> COMPARATOR = new Comparator<String>() { public int compare(String o1, String o2) { int c = o1.compareToIgnoreCase(o2); if (c == 0) { c = o1.compareTo(o2); } return c; } }; private final CalciteSchema parent; private final Schema schema; private final String name; /** * Tables explicitly defined in this schema. Does not include tables in * {@link #schema}. */ private final NavigableMap<String, TableEntry> tableMap = new TreeMap<>(COMPARATOR); private final Multimap<String, FunctionEntry> functionMap = LinkedListMultimap.create(); private final NavigableMap<String, LatticeEntry> latticeMap = new TreeMap<>(COMPARATOR); private final NavigableSet<String> functionNames = new TreeSet<>(COMPARATOR); private final NavigableMap<String, FunctionEntry> nullaryFunctionMap = new TreeMap<>(COMPARATOR); private final NavigableMap<String, CalciteSchema> subSchemaMap = new TreeMap<>(COMPARATOR); private ImmutableList<ImmutableList<String>> path; CalciteSchema(CalciteSchema parent, Schema schema, String name) { this.parent = parent; this.schema = schema; this.name = name; } /** * Returns a sub-schema with a given name that is defined implicitly * (that is, by the underlying {@link Schema} object, not explicitly * by a call to {@link #add(String, Schema)}), or null. */ protected abstract CalciteSchema getImplicitSubSchema(String schemaName, boolean caseSensitive); /** * Returns a table with a given name that is defined implicitly * (that is, by the underlying {@link Schema} object, not explicitly * by a call to {@link #add(String, Table)}), or null. */ protected abstract TableEntry getImplicitTable(String tableName, boolean caseSensitive); /** * Returns table function with a given name and zero arguments that is * defined implicitly (that is, by the underlying {@link Schema} object, * not explicitly by a call to {@link #add(String, Function)}), or null. */ protected abstract TableEntry getImplicitTableBasedOnNullaryFunction(String tableName, boolean caseSensitive); /** * Adds implicit sub-schemas to a builder. */ protected abstract void addImplicitSubSchemaToBuilder( ImmutableSortedMap.Builder<String, CalciteSchema> builder); /** * Adds implicit tables to a builder. */ protected abstract void addImplicitTableToBuilder( ImmutableSortedSet.Builder<String> builder); /** * Adds implicit functions to a builder. */ protected abstract void addImplicitFunctionToBuilder(ImmutableList.Builder<Function> builder); /** * Adds implicit function names to a builder. */ protected abstract void addImplicitFuncNamesToBuilder( ImmutableSortedSet.Builder<String> builder); /** * Adds implicit table functions to a builder. */ protected abstract void addImplicitTablesBasedOnNullaryFunctionsToBuilder( ImmutableSortedMap.Builder<String, Table> builder); protected abstract boolean isCacheEnabled(); public abstract void setCache(boolean cache); /** * Creates a TableEntryImpl with no SQLs. */ public final TableEntryImpl tableEntry(String tableName, Table table) { return new TableEntryImpl(this, tableName, table, ImmutableList.<String>of()); } /** * Defines a table within this schema. */ public final TableEntry add(String tableName, Table table) { return add(tableName, table, ImmutableList.<String>of()); } /** * Defines a table within this schema. */ public final TableEntry add(String tableName, Table table, ImmutableList<String> sqls) { final TableEntryImpl entry = new TableEntryImpl(this, tableName, table, sqls); tableMap.put(tableName, entry); return entry; } private FunctionEntry add(String funcName, Function function) { final FunctionEntryImpl entry = new FunctionEntryImpl(this, funcName, function); functionMap.put(funcName, entry); functionNames.add(funcName); if (function.getParameters().isEmpty()) { nullaryFunctionMap.put(funcName, entry); } return entry; } private LatticeEntry add(String latticeName, Lattice lattice) { if (latticeMap.containsKey(latticeName)) { throw new RuntimeException("Duplicate lattice '" + latticeName + "'"); } final LatticeEntryImpl entry = new LatticeEntryImpl(this, latticeName, lattice); latticeMap.put(latticeName, entry); return entry; } /** * Adds a child schema of this schema. */ public abstract CalciteSchema add(String schemaName, Schema childSchema); public final CalciteSchema root() { CalciteSchema s = this; while (s.parent != null) { s = s.parent; } return s; } /** * Returns whether this is a root schema. */ public final boolean isRoot() { return parent == null; } /** * Returns the path of an object in this schema. */ public final List<String> path(String objName) { final List<String> list = new ArrayList<>(); if (objName != null) { list.add(objName); } for (CalciteSchema s = this; s != null; s = s.parent) { if (s.parent != null || !s.name.equals("")) { // Omit the root schema's name from the path if it's the empty string, // which it usually is. list.add(s.name); } } return ImmutableList.copyOf(Lists.reverse(list)); } public final CalciteSchema getSubSchema(String schemaName, boolean caseSensitive) { if (caseSensitive) { // Check explicit schemas, case-sensitive. final CalciteSchema entry = subSchemaMap.get(schemaName); if (entry != null) { return entry; } } else { // Check explicit schemas, case-insensitive. //noinspection LoopStatementThatDoesntLoop for (Map.Entry<String, CalciteSchema> entry : find(subSchemaMap, schemaName).entrySet()) { return entry.getValue(); } } return getImplicitSubSchema(schemaName, caseSensitive); } /** * Returns a table that materializes the given SQL statement. */ public final TableEntry getTableBySql(String sql) { for (TableEntry tableEntry : tableMap.values()) { if (tableEntry.sqls.contains(sql)) { return tableEntry; } } return null; } /** * Returns a table with the given name. Does not look for views. */ public final TableEntry getTable(String tableName, boolean caseSensitive) { if (caseSensitive) { // Check explicit tables, case-sensitive. final TableEntry entry = tableMap.get(tableName); if (entry != null) { return entry; } } else { // Check explicit tables, case-insensitive. //noinspection LoopStatementThatDoesntLoop for (Map.Entry<String, TableEntry> entry : find(tableMap, tableName).entrySet()) { return entry.getValue(); } } return getImplicitTable(tableName, caseSensitive); } public final Schema getSchema() { return schema; } public final String getName() { return name; } public final SchemaPlus plus() { return new SchemaPlusImpl(); } public static CalciteSchema from(SchemaPlus plus) { return ((SchemaPlusImpl) plus).calciteSchema(); } /** * Returns the default path resolving functions from this schema. * <p/> * <p>The path consists is a list of lists of strings. * Each list of strings represents the path of a schema from the root schema. * For example, [[], [foo], [foo, bar, baz]] represents three schemas: the * root schema "/" (level 0), "/foo" (level 1) and "/foo/bar/baz" (level 3). * * @return Path of this schema; never null, may be empty */ public final List<? extends List<String>> getPath() { if (path != null) { return path; } // Return a path consisting of just this schema. return ImmutableList.of(path(null)); } /** * Returns a collection of sub-schemas, both explicit (defined using * {@link #add(String, org.apache.calcite.schema.Schema)}) and implicit * (defined using {@link org.apache.calcite.schema.Schema#getSubSchemaNames()} * and {@link Schema#getSubSchema(String)}). */ public final NavigableMap<String, CalciteSchema> getSubSchemaMap() { // Build a map of implicit sub-schemas first, then explicit sub-schemas. // If there are implicit and explicit with the same name, explicit wins. final ImmutableSortedMap.Builder<String, CalciteSchema> builder = new ImmutableSortedMap.Builder<>(COMPARATOR); builder.putAll(subSchemaMap); addImplicitSubSchemaToBuilder(builder); return Compatible.INSTANCE.navigableMap(builder.build()); } /** * Returns a collection of lattices. * <p/> * <p>All are explicit (defined using {@link #add(String, Lattice)}). */ public final NavigableMap<String, LatticeEntry> getLatticeMap() { return Compatible.INSTANCE.immutableNavigableMap(latticeMap); } /** * Returns the set of all table names. Includes implicit and explicit tables * and functions with zero parameters. */ public final NavigableSet<String> getTableNames() { final ImmutableSortedSet.Builder<String> builder = new ImmutableSortedSet.Builder<>(COMPARATOR); // Add explicit tables, case-sensitive. builder.addAll(tableMap.keySet()); // Add implicit tables, case-sensitive. addImplicitTableToBuilder(builder); return Compatible.INSTANCE.navigableSet(builder.build()); } /** * Returns a collection of all functions, explicit and implicit, with a given * name. Never null. */ public final Collection<Function> getFunctions(String funcName, boolean caseSensitive) { final ImmutableList.Builder<Function> builder = ImmutableList.builder(); if (caseSensitive) { // Add explicit functions, case-sensitive. final Collection<FunctionEntry> functionEntries = functionMap.get(funcName); if (functionEntries != null) { for (FunctionEntry functionEntry : functionEntries) { builder.add(functionEntry.getFunction()); } } // Add implicit functions, case-sensitive. final Collection<Function> functions = schema.getFunctions(funcName); if (functions != null) { builder.addAll(functions); } } else { // Add explicit functions, case-insensitive. for (String name2 : find(functionNames, funcName)) { final Collection<FunctionEntry> functionEntries = functionMap.get(name2); if (functionEntries != null) { for (FunctionEntry functionEntry : functionEntries) { builder.add(functionEntry.getFunction()); } } } // Add implicit functions, case-insensitive. addImplicitFunctionToBuilder(builder); } return builder.build(); } /** * Returns the list of function names in this schema, both implicit and * explicit, never null. */ public final NavigableSet<String> getFunctionNames() { final ImmutableSortedSet.Builder<String> builder = new ImmutableSortedSet.Builder<>(COMPARATOR); // Add explicit functions, case-sensitive. builder.addAll(functionMap.keySet()); // Add implicit functions, case-sensitive. addImplicitFuncNamesToBuilder(builder); return Compatible.INSTANCE.navigableSet(builder.build()); } /** * Returns tables derived from explicit and implicit functions * that take zero parameters. */ public final NavigableMap<String, Table> getTablesBasedOnNullaryFunctions() { ImmutableSortedMap.Builder<String, Table> builder = new ImmutableSortedMap.Builder<>(COMPARATOR); for (Map.Entry<String, FunctionEntry> s : nullaryFunctionMap.entrySet()) { final Function function = s.getValue().getFunction(); if (function instanceof TableMacro) { assert function.getParameters().isEmpty(); final Table table = ((TableMacro) function).apply(ImmutableList.of()); builder.put(s.getKey(), table); } } // add tables derived from implicit functions addImplicitTablesBasedOnNullaryFunctionsToBuilder(builder); return Compatible.INSTANCE.navigableMap(builder.build()); } /** * Returns a tables derived from explicit and implicit functions * that take zero parameters. */ public final TableEntry getTableBasedOnNullaryFunction(String tableName, boolean caseSensitive) { if (caseSensitive) { final FunctionEntry functionEntry = nullaryFunctionMap.get(tableName); if (functionEntry != null) { final Function function = functionEntry.getFunction(); if (function instanceof TableMacro) { assert function.getParameters().isEmpty(); final Table table = ((TableMacro) function).apply(ImmutableList.of()); return tableEntry(tableName, table); } } for (Function function : schema.getFunctions(tableName)) { if (function instanceof TableMacro && function.getParameters().isEmpty()) { final Table table = ((TableMacro) function).apply(ImmutableList.of()); return tableEntry(tableName, table); } } } else { for (Map.Entry<String, FunctionEntry> entry : find(nullaryFunctionMap, tableName).entrySet()) { final Function function = entry.getValue().getFunction(); if (function instanceof TableMacro) { assert function.getParameters().isEmpty(); final Table table = ((TableMacro) function).apply(ImmutableList.of()); return tableEntry(tableName, table); } } TableEntry tableEntry = getImplicitTableBasedOnNullaryFunction(tableName, false); } return null; } /** * Returns a subset of a map whose keys match the given string * case-insensitively. */ protected static <V> NavigableMap<String, V> find(NavigableMap<String, V> map, String s) { assert map.comparator() == COMPARATOR; return map.subMap(s.toUpperCase(), true, s.toLowerCase(), true); } /** * Returns a subset of a set whose values match the given string * case-insensitively. */ protected static Iterable<String> find(NavigableSet<String> set, String name) { assert set.comparator() == COMPARATOR; return set.subSet(name.toUpperCase(), true, name.toLowerCase(), true); } /** * Creates a root schema. * <p/> * <p>When <code>addMetadataSchema</code> argument is true adds a "metadata" * schema containing definitions of tables, columns etc. to root schema. * By default, creates a {@link CachingCalciteSchema}. */ public static CalciteSchema createRootSchema(boolean addMetadataSchema) { return createRootSchema(addMetadataSchema, true); } /** * Creates a root schema. * * @param addMetadataSchema Whether to add a "metadata" schema containing * definitions of tables, columns etc. * @param cache If true create {@link CachingCalciteSchema}; * if false create {@link SimpleCalciteSchema} */ public static CalciteSchema createRootSchema(boolean addMetadataSchema, boolean cache) { CalciteSchema rootSchema; final Schema schema = new CalciteConnectionImpl.RootSchema(); if (cache) { rootSchema = new CachingCalciteSchema(null, schema, ""); } else { rootSchema = new SimpleCalciteSchema(null, schema, ""); } if (addMetadataSchema) { rootSchema.add("metadata", MetadataSchema.INSTANCE); } return rootSchema; } /** * Entry in a schema, such as a table or sub-schema. * <p/> * <p>Each object's name is a property of its membership in a schema; * therefore in principle it could belong to several schemas, or * even the same schema several times, with different names. In this * respect, it is like an inode in a Unix file system.</p> * <p/> * <p>The members of a schema must have unique names. */ public abstract static class Entry { private final CalciteSchema schema; private final String name; public Entry(CalciteSchema schema, String name) { this.schema = Preconditions.checkNotNull(schema); this.name = Preconditions.checkNotNull(name); } /** * Returns this object's path. For example ["hr", "emps"]. */ public final List<String> path() { return schema.path(name); } } /** * Membership of a table in a schema. */ public abstract static class TableEntry extends Entry { private final List<String> sqls; public TableEntry(CalciteSchema schema, String name, ImmutableList<String> sqls) { super(schema, name); this.sqls = Preconditions.checkNotNull(sqls); } public abstract Table getTable(); } /** * Membership of a function in a schema. */ public abstract static class FunctionEntry extends Entry { public FunctionEntry(CalciteSchema schema, String name) { super(schema, name); } public abstract Function getFunction(); /** * Whether this represents a materialized view. (At a given point in time, * it may or may not be materialized as a table.) */ public abstract boolean isMaterialization(); } /** * Membership of a lattice in a schema. */ public abstract static class LatticeEntry extends Entry { public LatticeEntry(CalciteSchema schema, String name) { super(schema, name); } public abstract Lattice getLattice(); public abstract TableEntry getStarTable(); } /** * Implementation of {@link SchemaPlus} based on a * {@link CalciteSchema}. */ private class SchemaPlusImpl implements SchemaPlus { CalciteSchema calciteSchema() { return CalciteSchema.this; } public SchemaPlus getParentSchema() { return parent == null ? null : parent.plus(); } public String getName() { return CalciteSchema.this.getName(); } public boolean isMutable() { return schema.isMutable(); } public void setCacheEnabled(boolean cache) { CalciteSchema.this.setCache(cache); } public boolean isCacheEnabled() { return CalciteSchema.this.isCacheEnabled(); } public boolean contentsHaveChangedSince(long lastCheck, long now) { return schema.contentsHaveChangedSince(lastCheck, now); } public Expression getExpression(SchemaPlus parentSchema, String exprName) { return schema.getExpression(parentSchema, exprName); } public Table getTable(String tableName) { final TableEntry entry = CalciteSchema.this.getTable(tableName, true); return entry == null ? null : entry.getTable(); } public NavigableSet<String> getTableNames() { return CalciteSchema.this.getTableNames(); } public Collection<Function> getFunctions(String funcName) { return CalciteSchema.this.getFunctions(funcName, true); } public NavigableSet<String> getFunctionNames() { return CalciteSchema.this.getFunctionNames(); } public SchemaPlus getSubSchema(String schemaName) { final CalciteSchema subSchema = CalciteSchema.this.getSubSchema(schemaName, true); return subSchema == null ? null : subSchema.plus(); } public Set<String> getSubSchemaNames() { return CalciteSchema.this.getSubSchemaMap().keySet(); } public SchemaPlus add(String schemaName, Schema childSchema) { final CalciteSchema calciteSchema = CalciteSchema.this.add(schemaName, childSchema); return calciteSchema.plus(); } public void add(String tableName, Table table) { CalciteSchema.this.add(tableName, table); } public void add(String funcName, Function function) { CalciteSchema.this.add(funcName, function); } public void add(String latticeName, Lattice lattice) { CalciteSchema.this.add(latticeName, lattice); } public <T> T unwrap(Class<T> clazz) { if (clazz.isInstance(this)) { return clazz.cast(this); } if (clazz.isInstance(CalciteSchema.this)) { return clazz.cast(CalciteSchema.this); } if (clazz.isInstance(CalciteSchema.this.schema)) { return clazz.cast(CalciteSchema.this.schema); } throw new ClassCastException("not a " + clazz); } public void setPath(ImmutableList<ImmutableList<String>> path) { CalciteSchema.this.path = path; } } /** * Implementation of {@link CalciteSchema.TableEntry} * where all properties are held in fields. */ public static final class TableEntryImpl extends TableEntry { private final Table table; /** * Creates a TableEntryImpl. */ public TableEntryImpl(CalciteSchema schema, String name, Table table, ImmutableList<String> sqls) { super(schema, name, sqls); assert table != null; this.table = Preconditions.checkNotNull(table); } public Table getTable() { return table; } } /** * Implementation of {@link FunctionEntry} * where all properties are held in fields. */ public static final class FunctionEntryImpl extends FunctionEntry { private final Function function; /** * Creates a FunctionEntryImpl. */ public FunctionEntryImpl(CalciteSchema schema, String name, Function function) { super(schema, name); this.function = function; } public Function getFunction() { return function; } public boolean isMaterialization() { return function instanceof MaterializedViewTable.MaterializedViewTableMacro; } } /** * Implementation of {@link LatticeEntry} * where all properties are held in fields. */ public static final class LatticeEntryImpl extends LatticeEntry { private final Lattice lattice; private final CalciteSchema.TableEntry starTableEntry; /** * Creates a LatticeEntryImpl. */ public LatticeEntryImpl(CalciteSchema schema, String name, Lattice lattice) { super(schema, name); this.lattice = lattice; // Star table has same name as lattice and is in same schema. final StarTable starTable = lattice.createStarTable(); starTableEntry = schema.add(name, starTable); } public Lattice getLattice() { return lattice; } public TableEntry getStarTable() { return starTableEntry; } } }
92403c26f296b3ba407fcc24add7e99254691e67
1,018
java
Java
payment/src/main/java/com/gpvicomm/payment/rest/model/PaymentError.java
gpvicomm/gpvicomm-android
9566ad7f8da36b1d2ae909263ae0b4135af821e7
[ "MIT" ]
null
null
null
payment/src/main/java/com/gpvicomm/payment/rest/model/PaymentError.java
gpvicomm/gpvicomm-android
9566ad7f8da36b1d2ae909263ae0b4135af821e7
[ "MIT" ]
null
null
null
payment/src/main/java/com/gpvicomm/payment/rest/model/PaymentError.java
gpvicomm/gpvicomm-android
9566ad7f8da36b1d2ae909263ae0b4135af821e7
[ "MIT" ]
1
2021-09-07T20:07:31.000Z
2021-09-07T20:07:31.000Z
18.509091
71
0.631631
1,001,448
package com.gpvicomm.payment.rest.model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class PaymentError { @SerializedName("type") @Expose private String type; @SerializedName("help") @Expose private String help; @SerializedName("description") @Expose private String description; public PaymentError(String type, String help, String description) { this.type = type; this.help = help; this.description = description; } public PaymentError(){ } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getHelp() { return help; } public void setHelp(String help) { this.help = help; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
92403e90d9b5c8b139433c3d3f6d5159a805b1d5
1,489
java
Java
ZimbraSoap/src/wsdl-test/generated/zcsclient/account/testDistributionListSubscribeStatus.java
fciubotaru/z-pec
82335600341c6fb1bb8a471fd751243a90bc4d57
[ "MIT" ]
5
2019-03-26T07:51:56.000Z
2021-08-30T07:26:05.000Z
ZimbraSoap/src/wsdl-test/generated/zcsclient/account/testDistributionListSubscribeStatus.java
fciubotaru/z-pec
82335600341c6fb1bb8a471fd751243a90bc4d57
[ "MIT" ]
1
2015-08-18T19:03:32.000Z
2015-08-18T19:03:32.000Z
ZimbraSoap/src/wsdl-test/generated/zcsclient/account/testDistributionListSubscribeStatus.java
fciubotaru/z-pec
82335600341c6fb1bb8a471fd751243a90bc4d57
[ "MIT" ]
13
2015-03-11T00:26:35.000Z
2020-07-26T16:25:18.000Z
27.072727
99
0.691739
1,001,449
package generated.zcsclient.account; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for distributionListSubscribeStatus. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="distributionListSubscribeStatus"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="subscribed"/> * &lt;enumeration value="unsubscribed"/> * &lt;enumeration value="awaiting_approval"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "distributionListSubscribeStatus") @XmlEnum public enum testDistributionListSubscribeStatus { @XmlEnumValue("subscribed") SUBSCRIBED("subscribed"), @XmlEnumValue("unsubscribed") UNSUBSCRIBED("unsubscribed"), @XmlEnumValue("awaiting_approval") AWAITING___APPROVAL("awaiting_approval"); private final String value; testDistributionListSubscribeStatus(String v) { value = v; } public String value() { return value; } public static testDistributionListSubscribeStatus fromValue(String v) { for (testDistributionListSubscribeStatus c: testDistributionListSubscribeStatus.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
92403fe94b969ac3d12ecd3f797ed352d01d70e8
740
java
Java
spring-batch-in-action/getting-started/getting-started/spring-batch-example/src/main/java/com/jinm/example/ch07/jdbc/DestCreditBillItemPreparedStatementSetter.java
jinminer/spring-batch
f2e29682f882c8656b283030279e95ebcf08868a
[ "Apache-2.0" ]
1
2019-11-13T19:01:24.000Z
2019-11-13T19:01:24.000Z
spring-batch-in-action/getting-started/getting-started/spring-batch-example/src/main/java/com/jinm/example/ch07/jdbc/DestCreditBillItemPreparedStatementSetter.java
jinminer/spring-batch
f2e29682f882c8656b283030279e95ebcf08868a
[ "Apache-2.0" ]
null
null
null
spring-batch-in-action/getting-started/getting-started/spring-batch-example/src/main/java/com/jinm/example/ch07/jdbc/DestCreditBillItemPreparedStatementSetter.java
jinminer/spring-batch
f2e29682f882c8656b283030279e95ebcf08868a
[ "Apache-2.0" ]
null
null
null
23.870968
75
0.755405
1,001,450
/** * */ package com.jinm.example.ch07.jdbc; import java.sql.PreparedStatement; import java.sql.SQLException; import org.springframework.batch.item.database.ItemPreparedStatementSetter; import com.jinm.example.ch07.db.DestinationCreditBill; /** * * 2013-9-23下午10:33:20 */ public class DestCreditBillItemPreparedStatementSetter implements ItemPreparedStatementSetter<DestinationCreditBill> { @Override public void setValues(DestinationCreditBill item, PreparedStatement ps) throws SQLException { ps.setString(1, item.getId()); ps.setString(2, item.getAccountID()); ps.setString(3, item.getName()); ps.setDouble(4, item.getAmount()); ps.setString(5, item.getDate()); ps.setString(6, item.getAddress()); } }
92404043a7779c8b36381aa681847658fc40709f
643
java
Java
socket/java-network-programming/src/main/java/Chapter04InetAddress/P114Weblog.java
19920625lsg/itcast-java
b4dd7269b2adf7d84b95774588b2360494d2892d
[ "Apache-2.0" ]
1
2020-05-09T09:28:18.000Z
2020-05-09T09:28:18.000Z
socket/java-network-programming/src/main/java/Chapter04InetAddress/P114Weblog.java
19920625lsg/itcast-java
b4dd7269b2adf7d84b95774588b2360494d2892d
[ "Apache-2.0" ]
null
null
null
socket/java-network-programming/src/main/java/Chapter04InetAddress/P114Weblog.java
19920625lsg/itcast-java
b4dd7269b2adf7d84b95774588b2360494d2892d
[ "Apache-2.0" ]
null
null
null
31
65
0.493088
1,001,451
/*********************************************************** * @Description : Web服务器日志文件 * @author : 梁山广(Liang Shan Guang) * @date : 2019/9/29 22:54 * @email : [email protected] ***********************************************************/ package Chapter04InetAddress; import java.io.*; public class P114Weblog { public static void main(String[] args) { try (FileInputStream fin = new FileInputStream(args[0])){ Reader in = new InputStreamReader(fin); BufferedReader bin = new BufferedReader(in); } catch (IOException e) { e.printStackTrace(); } } }
924040843e0f02a7ca82b0754ed992389e8ed1d7
3,854
java
Java
androidframe/src/main/java/study/com/androidframe/utils/NetConnectionUtils.java
Duckdan/AndroidDefineFrame
d6db001115230a4b1607a904e9e4cfbf38ae6f53
[ "Apache-2.0" ]
null
null
null
androidframe/src/main/java/study/com/androidframe/utils/NetConnectionUtils.java
Duckdan/AndroidDefineFrame
d6db001115230a4b1607a904e9e4cfbf38ae6f53
[ "Apache-2.0" ]
null
null
null
androidframe/src/main/java/study/com/androidframe/utils/NetConnectionUtils.java
Duckdan/AndroidDefineFrame
d6db001115230a4b1607a904e9e4cfbf38ae6f53
[ "Apache-2.0" ]
null
null
null
30.587302
119
0.588739
1,001,452
package study.com.androidframe.utils; import android.content.Context; import android.net.ConnectivityManager; import android.net.Network; import android.net.NetworkInfo; import study.com.androidframe.enums.NetType; /** * 检测网络连接的工具类 */ public class NetConnectionUtils { private static NetConnectionUtils netConn; private Context context; private NetType type; private NetConnectionUtils(Context context) { this.context = context; } /** * 注册网工具管理类 * * @param context * @return */ public synchronized static NetConnectionUtils register(Context context) { if (netConn == null) { netConn = new NetConnectionUtils(context); } return netConn; } /** * 仅用于获取NetConnectionUtils实例 * * @return */ public static NetConnectionUtils getInstance() { return netConn; } /** * 检测网络 * * @return true代表网络连接,false代表网络未连接 */ public boolean checkNetWorkState() { boolean flag = false; //检测API是不是小于23,因为到了API23之后getNetworkInfo(int networkType)方法被弃用 if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) { //获得ConnectivityManager对象 ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); //获取ConnectivityManager对象对应的NetworkInfo对象 //获取WIFI连接的信息 NetworkInfo wifiNetworkInfo = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI); //获取移动数据连接的信息 NetworkInfo dataNetworkInfo = connMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); //WIFI已连接,移动数据已连接 boolean wifiConnected = wifiNetworkInfo.isConnected(); boolean mobileConnected = dataNetworkInfo.isConnected(); flag = isFlag(wifiConnected, mobileConnected); //API大于23时使用下面的方式进行网络监听 } else { //获得ConnectivityManager对象 ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); //获取所有网络连接的信息 Network[] networks = connMgr.getAllNetworks(); //用于存放当前网络的连接信息 boolean[] typeBoolean = new boolean[2]; //通过循环将网络信息逐个取出来 for (int i = 0; i < networks.length; i++) { //获取ConnectivityManager对象对应的NetworkInfo对象 NetworkInfo networkInfo = connMgr.getNetworkInfo(networks[i]); int netType = networkInfo.getType(); boolean netConnected = networkInfo.isConnected(); switch (netType) { case ConnectivityManager.TYPE_WIFI: typeBoolean[0] = netConnected ? true : false; break; case ConnectivityManager.TYPE_MOBILE: typeBoolean[1] = netConnected ? true : false; break; } } flag = isFlag(typeBoolean[0], typeBoolean[1]); } return flag; } private boolean isFlag(boolean wifiConnected, boolean mobileConnected) { boolean flag; if (wifiConnected && mobileConnected) { type = NetType.ALL; flag = true; //WIFI已连接,移动数据已断开 } else if (wifiConnected && !mobileConnected) { type = NetType.WIFI; flag = true; //WIFI已断开,移动数据已连接 } else if (!wifiConnected && mobileConnected) { type = NetType.MOBILE; flag = true; //WIFI已断开,移动数据已断开 } else { type = NetType.NONE; flag = false; } return flag; } /** * 返回当前设备连接网络的类型 * * @return */ public NetType getNetType() { return type; } }
9240414f6f8e80f3054175dd4fa48b013ffe80bd
5,553
java
Java
rtc.pa.read.plain/src/rtc/pa/read/WorkItemTypeHelper.java
jeromede/rtc.pa
24beba92e2074fbaa0a9c67bdbd0e4b956ddeec6
[ "0BSD" ]
1
2017-07-10T08:53:47.000Z
2017-07-10T08:53:47.000Z
rtc.pa.read.plain/src/rtc/pa/read/WorkItemTypeHelper.java
jeromede/rtc.pa
24beba92e2074fbaa0a9c67bdbd0e4b956ddeec6
[ "0BSD" ]
1
2017-10-24T23:09:13.000Z
2017-11-19T19:41:12.000Z
rtc.pa.read.plain/src/rtc/pa/read/WorkItemTypeHelper.java
jeromede/rtc.pa
24beba92e2074fbaa0a9c67bdbd0e4b956ddeec6
[ "0BSD" ]
1
2021-05-24T12:10:35.000Z
2021-05-24T12:10:35.000Z
38.846154
111
0.733033
1,001,453
/* * Copyright (c) 2017,2018,2019 [email protected] * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package rtc.pa.read; import java.util.ArrayList; import java.util.Collection; import java.util.List; import com.ibm.team.process.common.IProjectArea; import com.ibm.team.repository.client.IItemManager; import com.ibm.team.repository.client.ITeamRepository; import com.ibm.team.repository.common.IFetchResult; import com.ibm.team.repository.common.TeamRepositoryException; import com.ibm.team.workitem.client.IWorkItemClient; import com.ibm.team.workitem.common.IWorkItemCommon; import com.ibm.team.workitem.common.model.AttributeTypes; import com.ibm.team.workitem.common.model.IAttribute; import com.ibm.team.workitem.common.model.IAttributeHandle; import com.ibm.team.workitem.common.model.IEnumeration; import com.ibm.team.workitem.common.model.ILiteral; import com.ibm.team.workitem.common.model.IWorkItemType; import rtc.pa.model.Attribute; import rtc.pa.model.Literal; import rtc.pa.model.Project; import rtc.pa.model.TaskType; import rtc.pa.utils.ProgressMonitor; public class WorkItemTypeHelper { static String readWorkItemTypes(ITeamRepository repo, IProjectArea pa, IWorkItemClient wiClient, IWorkItemCommon wiCommon, ProgressMonitor monitor, Project p) { String result; monitor.out("Now reading work item types..."); List<IWorkItemType> allWorkItemTypes; TaskType tt; try { allWorkItemTypes = wiClient.findWorkItemTypes(pa, monitor); for (IWorkItemType t : allWorkItemTypes) { tt = new TaskType(t.getIdentifier(), t.getDisplayName()); p.putTaskType(tt); monitor.out("\t" + t.getDisplayName() + " (" + t.getIdentifier() + ')'); result = addAttributes(repo, pa, wiClient, wiCommon, monitor, p, t, tt); if (null != result) return result; } } catch (TeamRepositoryException e) { e.printStackTrace(); return "problem while getting work item types"; } return null; } private static String addAttributes(ITeamRepository repo, IProjectArea pa, IWorkItemClient wiClient, IWorkItemCommon wiCommon, ProgressMonitor monitor, Project p, IWorkItemType t, TaskType tt) { String result; monitor.out("\t\tcustom attributes for " + t.getIdentifier() + " (" + t.getDisplayName() + "):"); List<IAttributeHandle> customAttributeHandles = t.getCustomAttributes(); IFetchResult custom = null; try { custom = repo.itemManager().fetchCompleteItemsPermissionAware(customAttributeHandles, IItemManager.REFRESH, monitor); } catch (TeamRepositoryException e) { e.printStackTrace(); return "error finding custom attributes for type " + t.getIdentifier(); } for (Object o : custom.getRetrievedItems()) { if (o instanceof IAttribute) { result = addAttribute(wiClient, monitor, p, tt, (IAttribute) o); if (null != result) { return result; } } } return null; } private static String addAttribute(IWorkItemClient wiClient, ProgressMonitor monitor, Project p, TaskType tt, IAttribute attribute) { Attribute a; Literal lit; Collection<Literal> lits = null; Literal nullLit = null; ILiteral literal; ILiteral nullLiteral; if (AttributeTypes.isEnumerationAttributeType(attribute.getAttributeType())) { lits = new ArrayList<Literal>(); try { IEnumeration<? extends ILiteral> enumeration = wiClient.resolveEnumeration(attribute, monitor); nullLiteral = enumeration.findNullEnumerationLiteral(); monitor.out("\t\t\t\tnull literal: " + ((null == nullLiteral) ? null : nullLiteral.getIdentifier2().getStringIdentifier() + " (" + nullLiteral.getName() + ")")); if (null != nullLiteral) { nullLit = new Literal(nullLiteral.getIdentifier2().getStringIdentifier(), nullLiteral.getName()); nullLit.setExternalObject(nullLiteral.getName(), nullLiteral); } for (Object o : enumeration.getEnumerationLiterals()) { if (o instanceof ILiteral) { literal = (ILiteral) o; monitor.out("\t\t\t\tliteral: " + literal.getIdentifier2().getStringIdentifier() + " (" + literal.getName() + ")"); lit = new Literal(literal.getIdentifier2().getStringIdentifier(), literal.getName()); lit.setExternalObject(literal.getName(), lit); // TODO: itself??? Couldn't it be null instead? lits.add(lit); } } } catch (TeamRepositoryException e) { e.printStackTrace(); return "error while reading enumeration"; } } monitor.out("attribute.getDisplayName(): " + attribute.getDisplayName()); if (null == lits) { a = new Attribute(attribute.getIdentifier(), attribute.getDisplayName(), attribute.getAttributeType()); } else { a = new Attribute(attribute.getIdentifier(), attribute.getDisplayName(), attribute.getAttributeType(), lits, nullLit); } a.setExternalObject(attribute.getIdentifier(), attribute); p.putAttribute(tt, a); return null; } }
9240434b3733c4c414673655f6f7d5b3ada51ad8
409
java
Java
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/package-info.java
Strivema/spring
40fabc8f07f44bb018defe10a36f0ee70b8a8623
[ "Apache-2.0" ]
112
2017-11-04T11:48:25.000Z
2022-03-14T08:10:35.000Z
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/package-info.java
Strivema/spring
40fabc8f07f44bb018defe10a36f0ee70b8a8623
[ "Apache-2.0" ]
7
2020-02-28T01:27:57.000Z
2022-03-08T21:12:13.000Z
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/package-info.java
Strivema/spring
40fabc8f07f44bb018defe10a36f0ee70b8a8623
[ "Apache-2.0" ]
78
2017-12-15T13:28:46.000Z
2021-12-19T09:59:09.000Z
37.181818
84
0.779951
1,001,454
/** * AOP-based solution for declarative caching demarcation using JSR-107 annotations. * * <p>Strongly based on the infrastructure in org.springframework.cache.interceptor * that deals with Spring's caching annotations. * * <p>Builds on the AOP infrastructure in org.springframework.aop.framework. * Any POJO can be cache-advised with Spring. */ package org.springframework.cache.jcache.interceptor;
924043d6b93e9e43dc5a9b0532df30b484f19b4f
3,780
java
Java
app/src/main/java/com/oscar/releasetool/app/common/Config.java
Hikyu/ReleaseTool
171a79534986ab853856acc7265bf6ba2cdd6eb7
[ "MIT" ]
null
null
null
app/src/main/java/com/oscar/releasetool/app/common/Config.java
Hikyu/ReleaseTool
171a79534986ab853856acc7265bf6ba2cdd6eb7
[ "MIT" ]
null
null
null
app/src/main/java/com/oscar/releasetool/app/common/Config.java
Hikyu/ReleaseTool
171a79534986ab853856acc7265bf6ba2cdd6eb7
[ "MIT" ]
null
null
null
26.25
84
0.743122
1,001,455
package com.oscar.releasetool.app.common; import java.io.IOException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; public class Config { private static Config instance = new Config(); private static final String PATH = "config.json"; // Starteam url private String stURL; // 发布单文件路径 private String releaseListPath; // 责任人 private String personInCharge; // 组件列表 private Map<String, String[]> componentRegistry; // 自动模式 private boolean silent = false; // 默认标签后缀 private String releaseLabelSuffix; // 激活的组件配置列表 private String activeComponentCenter; // 组件列表json对象 private JsonObject componentCenterObj; private Config() { String resource = null; try { resource = new ClassPathResource(PATH).getString(); } catch (IOException e) { e.printStackTrace(); throw new IllegalStateException(e.getMessage()); } JsonParser jsonParser = new JsonParser(); JsonObject root = jsonParser.parse(resource).getAsJsonObject(); stURL = root.get("stURL").getAsString(); releaseListPath = root.get("releaseListPath").getAsString(); personInCharge = root.get("personInCharge").getAsString(); releaseLabelSuffix = root.get("releaseLabelSuffix").getAsString(); activeComponentCenter = root.get("activeComponentCenter").getAsString(); componentCenterObj = root.get("componentCenter").getAsJsonObject(); componentRegistry = new HashMap<>(); initComponentRegistry(componentRegistry, activeComponentCenter); } /** * 初始化组件配置列表 * @param registry * 注册器 * @param active * 激活的配置 */ private void initComponentRegistry(Map<String, String[]> registry, String active) { JsonArray componentList = componentCenterObj.get(active).getAsJsonArray(); Iterator<JsonElement> iterator = componentList.iterator(); while (iterator.hasNext()) { JsonElement component = (JsonElement) iterator.next(); String key = component.getAsJsonObject().get("name").getAsString(); String[] info = new String[2]; info[0] = component.getAsJsonObject().get("view").getAsString(); info[1] = component.getAsJsonObject().get("path").getAsString(); registry.put(key, info); } } public static Config getInstance() { return instance; } public void reActiveComponentCenter() { componentRegistry = new HashMap<>(); initComponentRegistry(componentRegistry, activeComponentCenter); } public String getStURL() { return stURL; } public String getReleaseListPath() { return releaseListPath; } public String getPersonInCharge() { return personInCharge; } public String getComponentView(String componentName) { String[] strings = componentRegistry.get(componentName); if (strings == null) { return null; } return strings[0]; } public String getComponentPath(String componentName) { String[] strings = componentRegistry.get(componentName); if (strings == null) { return null; } return strings[1]; } public void setReleaseListPath(String releaseListPath) { this.releaseListPath = releaseListPath; } public void setPersonInCharge(String personInCharge) { this.personInCharge = personInCharge; } public boolean isSilent() { return silent; } public void setSilent(boolean silent) { this.silent = silent; } public String getReleaseLabelSuffix() { return releaseLabelSuffix; } public void setReleaseLabelSuffix(String releaseLabelSuffix) { this.releaseLabelSuffix = releaseLabelSuffix; } public String getActiveComponentCenter() { return activeComponentCenter; } public void setActiveComponentCenter(String activeComponentCenter) { this.activeComponentCenter = activeComponentCenter; } }
9240448db48e201fc302d7c263f828ec79fa162a
5,559
java
Java
app/src/main/java/com/nuist/library/base/BaseFragment.java
laocuo/NuistLibrary
6fe04f3788d6fb832929d471eebcb92ee062958c
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/nuist/library/base/BaseFragment.java
laocuo/NuistLibrary
6fe04f3788d6fb832929d471eebcb92ee062958c
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/nuist/library/base/BaseFragment.java
laocuo/NuistLibrary
6fe04f3788d6fb832929d471eebcb92ee062958c
[ "Apache-2.0" ]
null
null
null
28.203046
123
0.634269
1,001,456
/* * * * Copyright (C) 2017 laocuo <[email protected]> * * * * 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.nuist.library.base; import android.app.ProgressDialog; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.nuist.library.R; import com.nuist.library.utils.SwipeRefreshHelper; import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; public abstract class BaseFragment<T extends IBasePresenter> extends Fragment implements IBaseView { /** * 资源的ID一定要一样 */ @Nullable @BindView(R.id.empty_layout) EmptyLayout mEmptyLayout; @Nullable @BindView(R.id.swipe_refresh) SwipeRefreshLayout mSwipeRefresh = null; @Inject protected T mPresenter; protected Context mContext; //缓存Fragment view private View mRootView; private boolean mIsMulti = false; protected ProgressDialog mProgressDialog; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = getActivity(); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { if (mRootView == null) { mRootView = inflater.inflate(getLayoutId(), null); ButterKnife.bind(this, mRootView); doInject(); doInit(); initSwipeRefresh(); } ViewGroup parent = (ViewGroup) mRootView.getParent(); if (parent != null) { parent.removeView(mRootView); } return mRootView; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (getUserVisibleHint() && mRootView != null && !mIsMulti) { mIsMulti = true; getData(false); } } @Override public void setUserVisibleHint(boolean isVisibleToUser) { if (isVisibleToUser && isVisible() && mRootView != null && !mIsMulti) { mIsMulti = true; getData(false); } else { super.setUserVisibleHint(isVisibleToUser); } } /** * 初始化 Toolbar * * @param toolbar * @param homeAsUpEnabled * @param title */ protected void initToolBar(Toolbar toolbar, boolean homeAsUpEnabled, String title) { ((BaseActivity)getActivity()).initToolBar(toolbar, homeAsUpEnabled, title); } /** * 初始化下拉刷新 */ private void initSwipeRefresh() { if (mSwipeRefresh != null) { SwipeRefreshHelper.init(mSwipeRefresh, null, new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { getData(true); } }); } } @Override public void showLoading() { if (mEmptyLayout != null) { mEmptyLayout.setEmptyStatus(EmptyLayout.STATUS_LOADING); SwipeRefreshHelper.enableRefresh(mSwipeRefresh, false); } } @Override public void hideLoading() { if (mEmptyLayout != null) { mEmptyLayout.hide(); SwipeRefreshHelper.enableRefresh(mSwipeRefresh, true); SwipeRefreshHelper.controlRefresh(mSwipeRefresh, false); } } @Override public void showNetError(final EmptyLayout.OnRetryListener onRetryListener) { if (mEmptyLayout != null) { mEmptyLayout.setEmptyStatus(EmptyLayout.STATUS_NO_NET); mEmptyLayout.setRetryListener(onRetryListener); SwipeRefreshHelper.enableRefresh(mSwipeRefresh, false); } } @Override public void finishRefresh() { if (mSwipeRefresh != null) { SwipeRefreshHelper.controlRefresh(mSwipeRefresh, false); } } @Override public void showProgress(boolean show) { if (mProgressDialog != null) { if (show == true && mProgressDialog.isShowing() == false) { mProgressDialog.show(); } else if (show == false && mProgressDialog.isShowing() == true) { mProgressDialog.dismiss(); } } } /** * 绑定布局文件 * @return 布局文件ID */ protected abstract int getLayoutId(); /** * Dagger 注入 */ protected abstract void doInject(); /** * 初始化视图控件 */ protected abstract void doInit(); /** * 更新视图控件 * @param isRefresh 新增参数,用来判断是否为下拉刷新调用,下拉刷新的时候不应该再显示加载界面和异常界面 * isRefresh: true SwipeRefresh; false onActivityCreated refresh */ protected abstract void getData(boolean isRefresh); }
9240449285aacdc7d88d4b9ba923766d7837ba75
52,310
java
Java
tests/time/rmosa/tests/s1003/85_shop/evosuite-tests/umd/cs/shop/JSTerm_ESTest.java
sealuzh/termite-replication
1636b1973c8692ed6a818e323cd1dd826cabbad3
[ "MIT" ]
null
null
null
tests/time/rmosa/tests/s1003/85_shop/evosuite-tests/umd/cs/shop/JSTerm_ESTest.java
sealuzh/termite-replication
1636b1973c8692ed6a818e323cd1dd826cabbad3
[ "MIT" ]
3
2020-11-16T20:40:56.000Z
2021-03-23T00:18:04.000Z
tests/time/rmosa/tests/s1003/85_shop/evosuite-tests/umd/cs/shop/JSTerm_ESTest.java
sealuzh/termite-replication
1636b1973c8692ed6a818e323cd1dd826cabbad3
[ "MIT" ]
null
null
null
31.876904
176
0.651883
1,001,457
/* * This file was automatically generated by EvoSuite * Sat Nov 28 15:22:10 GMT 2020 */ package umd.cs.shop; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import java.io.StreamTokenizer; import java.io.StringReader; import java.util.Collection; import java.util.function.Predicate; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.System; import org.junit.runner.RunWith; import umd.cs.shop.JSPredicateForm; import umd.cs.shop.JSSubstitution; import umd.cs.shop.JSTerm; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) public class JSTerm_ESTest extends JSTerm_ESTest_scaffolding { /** //Test case number: 0 /*Coverage entropy=1.6865628353651818 */ @Test(timeout = 4000) public void test00() throws Throwable { StringReader stringReader0 = new StringReader("?L3Fk.|S0f4)Q|nGw{a"); stringReader0.read(); stringReader0.read(); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = new JSTerm(streamTokenizer0); jSTerm1.makeFunction(); jSTerm1.addElement(jSTerm0); jSTerm1.standardizerTerm(); assertFalse(jSTerm1.isConstant()); } /** //Test case number: 1 /*Coverage entropy=1.242453324894 */ @Test(timeout = 4000) public void test01() throws Throwable { JSTerm jSTerm0 = new JSTerm(); boolean boolean0 = jSTerm0.isGround(); assertTrue(boolean0); } /** //Test case number: 2 /*Coverage entropy=1.9661755171495707 */ @Test(timeout = 4000) public void test02() throws Throwable { StringReader stringReader0 = new StringReader("?L3Fk.|S0f4)Q|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(); JSTerm jSTerm1 = jSTerm0.parseList(streamTokenizer0); boolean boolean0 = jSTerm0.equals(jSTerm1); assertEquals(41, streamTokenizer0.ttype); assertFalse(boolean0); } /** //Test case number: 3 /*Coverage entropy=1.668173971997397 */ @Test(timeout = 4000) public void test03() throws Throwable { StringReader stringReader0 = new StringReader("?l3fk.|s0f4"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.makeFunction(); JSTerm jSTerm1 = new JSTerm(); JSSubstitution jSSubstitution0 = new JSSubstitution(); JSSubstitution jSSubstitution1 = jSTerm1.matches(jSTerm0, jSSubstitution0); assertFalse(jSTerm0.isVariable()); assertNotSame(jSSubstitution0, jSSubstitution1); } /** //Test case number: 4 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test04() throws Throwable { StringReader stringReader0 = new StringReader("(H>*yO@oP"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); streamTokenizer0.resetSyntax(); JSTerm jSTerm0 = null; try { jSTerm0 = new JSTerm(streamTokenizer0); fail("Expecting exception: Error"); } catch(Error e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 5 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test05() throws Throwable { JSTerm jSTerm0 = new JSTerm(); jSTerm0.makeVariable(); assertTrue(jSTerm0.isVariable()); } /** //Test case number: 6 /*Coverage entropy=1.4205719259467042 */ @Test(timeout = 4000) public void test06() throws Throwable { StringReader stringReader0 = new StringReader("call"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.makeEval(true); jSTerm0.standardizerTerm(); assertTrue(jSTerm0.isEval()); } /** //Test case number: 7 /*Coverage entropy=1.0397207708399179 */ @Test(timeout = 4000) public void test07() throws Throwable { StringReader stringReader0 = new StringReader(")9Jdz\"r0Q{&W"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(); JSTerm jSTerm1 = jSTerm0.parseList(streamTokenizer0); assertFalse(jSTerm1.isVariable()); assertTrue(jSTerm1.isConstant()); assertFalse(jSTerm1.isFunction()); assertEquals("[nil]", jSTerm1.toString()); } /** //Test case number: 8 /*Coverage entropy=0.5004024235381879 */ @Test(timeout = 4000) public void test08() throws Throwable { StringReader stringReader0 = new StringReader("?L3Fk.|S0f4)Q|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.isVariable(); assertEquals("[?L3Fk.|S0f4]", jSTerm0.toString()); assertFalse(jSTerm0.isFunction()); } /** //Test case number: 9 /*Coverage entropy=0.8675632284814612 */ @Test(timeout = 4000) public void test09() throws Throwable { StringReader stringReader0 = new StringReader("?L3Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.makeFunction(); boolean boolean0 = jSTerm0.isVariable(); assertFalse(boolean0); } /** //Test case number: 10 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test10() throws Throwable { JSTerm jSTerm0 = new JSTerm(); jSTerm0.makeFunction(); boolean boolean0 = jSTerm0.isFunction(); assertTrue(boolean0); } /** //Test case number: 11 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test11() throws Throwable { JSTerm jSTerm0 = new JSTerm(); boolean boolean0 = jSTerm0.isFunction(); assertFalse(boolean0); } /** //Test case number: 12 /*Coverage entropy=0.7356219397587946 */ @Test(timeout = 4000) public void test12() throws Throwable { StringReader stringReader0 = new StringReader("IuN|!TB/MjV_sIPSiv"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.makeEval(true); boolean boolean0 = jSTerm0.isEval(); assertTrue(boolean0); } /** //Test case number: 13 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test13() throws Throwable { JSTerm jSTerm0 = new JSTerm(); boolean boolean0 = jSTerm0.isEval(); assertFalse(boolean0); } /** //Test case number: 14 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test14() throws Throwable { JSTerm jSTerm0 = new JSTerm(); jSTerm0.makeConstant(); boolean boolean0 = jSTerm0.isConstant(); assertTrue(boolean0); } /** //Test case number: 15 /*Coverage entropy=0.5004024235381879 */ @Test(timeout = 4000) public void test15() throws Throwable { StringReader stringReader0 = new StringReader("?L3Fk.|S0f4)Q|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.isConstant(); assertFalse(jSTerm0.isFunction()); assertEquals("[?L3Fk.|S0f4]", jSTerm0.toString()); } /** //Test case number: 16 /*Coverage entropy=1.1604572762698004 */ @Test(timeout = 4000) public void test16() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.makeEval(true); jSTerm0.cloneT(); assertTrue(jSTerm0.isEval()); } /** //Test case number: 17 /*Coverage entropy=1.303092403761719 */ @Test(timeout = 4000) public void test17() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); char[] charArray0 = new char[8]; stringReader0.read(charArray0); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = jSTerm0.cloneT(); assertFalse(jSTerm1.isVariable()); assertFalse(jSTerm1.isFunction()); assertTrue(jSTerm1.isConstant()); assertEquals(1, jSTerm1.size()); assertNotSame(jSTerm1, jSTerm0); } /** //Test case number: 18 /*Coverage entropy=1.0027182645175161 */ @Test(timeout = 4000) public void test18() throws Throwable { StringReader stringReader0 = new StringReader("Kro,qegw{"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.makeEval(true); jSTerm0.call(); assertTrue(jSTerm0.isEval()); } /** //Test case number: 19 /*Coverage entropy=0.6837389058487535 */ @Test(timeout = 4000) public void test19() throws Throwable { StringReader stringReader0 = new StringReader("?L3F.|S0f4)Q|nGw{a"); stringReader0.read(); stringReader0.read(); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = new JSTerm(streamTokenizer0); JSPredicateForm jSPredicateForm0 = jSTerm1.standarizerPredicateForm(); jSTerm0.retainAll(jSPredicateForm0); JSTerm jSTerm2 = jSTerm0.call(); assertEquals(0, jSTerm2.size()); } /** //Test case number: 20 /*Coverage entropy=1.7917594692280554 */ @Test(timeout = 4000) public void test20() throws Throwable { StringReader stringReader0 = new StringReader("?L3\"k.|00}j)Q|nGw]{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSSubstitution jSSubstitution0 = new JSSubstitution(); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = jSTerm0.applySubstitutionT(jSSubstitution0); assertFalse(jSTerm1.isConstant()); assertNotSame(jSTerm1, jSTerm0); assertFalse(jSTerm0.isFunction()); assertEquals("[?%%%]", jSTerm1.toString()); assertTrue(jSTerm1.isVariable()); assertFalse(jSTerm1.isFunction()); } /** //Test case number: 21 /*Coverage entropy=1.1604572762698004 */ @Test(timeout = 4000) public void test21() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.makeEval(true); JSSubstitution jSSubstitution0 = new JSSubstitution(); jSTerm0.applySubstitutionT(jSSubstitution0); assertTrue(jSTerm0.isEval()); } /** //Test case number: 22 /*Coverage entropy=1.4978661367769954 */ @Test(timeout = 4000) public void test22() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); char[] charArray0 = new char[8]; stringReader0.read(charArray0); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSSubstitution jSSubstitution0 = new JSSubstitution(); JSTerm jSTerm1 = jSTerm0.applySubstitutionT(jSSubstitution0); assertNotSame(jSTerm1, jSTerm0); assertFalse(jSTerm1.isVariable()); assertTrue(jSTerm1.isConstant()); assertFalse(jSTerm1.isFunction()); assertEquals("[0.0]", jSTerm1.toString()); } /** //Test case number: 23 /*Coverage entropy=0.9921279355474819 */ @Test(timeout = 4000) public void test23() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); // Undeclared exception! try { jSTerm0.matches(jSTerm0, (JSSubstitution) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 24 /*Coverage entropy=0.2145591551764051 */ @Test(timeout = 4000) public void test24() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.makeEval(false); assertFalse(jSTerm0.isEval()); } /** //Test case number: 25 /*Coverage entropy=0.48691270946460224 */ @Test(timeout = 4000) public void test25() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.setSize(41); // Undeclared exception! try { jSTerm0.toStr(); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 26 /*Coverage entropy=0.9164648855394713 */ @Test(timeout = 4000) public void test26() throws Throwable { StringReader stringReader0 = new StringReader("Kro,qegw{"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.makeFunction(); jSTerm0.add((Object) "Kro,qegw{"); // Undeclared exception! try { jSTerm0.toStr(); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // java.lang.String cannot be cast to umd.cs.shop.JSTerm // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 27 /*Coverage entropy=0.5623351446188083 */ @Test(timeout = 4000) public void test27() throws Throwable { JSTerm jSTerm0 = new JSTerm(); // Undeclared exception! try { jSTerm0.toStr(); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // 0 >= 0 // verifyException("java.util.Vector", e); } } /** //Test case number: 28 /*Coverage entropy=1.4750763110546947 */ @Test(timeout = 4000) public void test28() throws Throwable { JSTerm jSTerm0 = new JSTerm(); jSTerm0.setSize(102); // Undeclared exception! try { jSTerm0.standardizerTerm(); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 29 /*Coverage entropy=1.5607104090414063 */ @Test(timeout = 4000) public void test29() throws Throwable { JSTerm jSTerm0 = new JSTerm(); // Undeclared exception! try { jSTerm0.standardizerTerm(); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // 0 >= 0 // verifyException("java.util.Vector", e); } } /** //Test case number: 30 /*Coverage entropy=0.535959889216217 */ @Test(timeout = 4000) public void test30() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.addAll((Collection) jSTerm0); // Undeclared exception! try { jSTerm0.print(); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // java.lang.String cannot be cast to umd.cs.shop.JSTerm // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 31 /*Coverage entropy=0.6365141682948128 */ @Test(timeout = 4000) public void test31() throws Throwable { JSTerm jSTerm0 = new JSTerm(); // Undeclared exception! try { jSTerm0.print(); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // 0 >= 0 // verifyException("java.util.Vector", e); } } /** //Test case number: 32 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test32() throws Throwable { JSTerm jSTerm0 = new JSTerm(); // Undeclared exception! try { jSTerm0.parseList((StreamTokenizer) null); fail("Expecting exception: System.SystemExitException"); } catch(System.SystemExitException e) { // // no message in exception (getMessage() returned null) // verifyException("org.evosuite.runtime.System", e); } } /** //Test case number: 33 /*Coverage entropy=0.6849547610531581 */ @Test(timeout = 4000) public void test33() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSSubstitution jSSubstitution0 = new JSSubstitution(); // Undeclared exception! try { jSTerm0.matches((JSTerm) null, jSSubstitution0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 34 /*Coverage entropy=1.2130075659799042 */ @Test(timeout = 4000) public void test34() throws Throwable { StringReader stringReader0 = new StringReader("?L3\"k.|00}j)Q|nGw]{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSSubstitution jSSubstitution0 = new JSSubstitution(); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSSubstitution0.add((Object) stringReader0); // Undeclared exception! try { jSTerm0.matches(jSTerm0, jSSubstitution0); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // java.io.StringReader cannot be cast to umd.cs.shop.JSPairVarTerm // verifyException("umd.cs.shop.JSSubstitution", e); } } /** //Test case number: 35 /*Coverage entropy=1.2206072645530175 */ @Test(timeout = 4000) public void test35() throws Throwable { StringReader stringReader0 = new StringReader("1=P0)CR1<bVM>};u+Qs"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.removeAllElements(); JSSubstitution jSSubstitution0 = new JSSubstitution(); // Undeclared exception! try { jSTerm0.matches(jSTerm0, jSSubstitution0); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // 0 >= 0 // verifyException("java.util.Vector", e); } } /** //Test case number: 36 /*Coverage entropy=1.0027182645175161 */ @Test(timeout = 4000) public void test36() throws Throwable { StringReader stringReader0 = new StringReader("Kro,qegw{"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); // Undeclared exception! try { jSTerm0.matches((JSTerm) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 37 /*Coverage entropy=1.6061217378893984 */ @Test(timeout = 4000) public void test37() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); Predicate<Object> predicate0 = Predicate.isEqual((Object) streamTokenizer0); JSTerm jSTerm1 = jSTerm0.standardizerTerm(); jSTerm1.add((Object) predicate0); jSTerm1.removeAll(jSTerm0); // Undeclared exception! try { jSTerm1.matches(jSTerm0); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // java.util.function.Predicate$$Lambda$45/966180272 cannot be cast to java.lang.String // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 38 /*Coverage entropy=1.7328679513998633 */ @Test(timeout = 4000) public void test38() throws Throwable { JSTerm jSTerm0 = new JSTerm(); jSTerm0.makeConstant(); // Undeclared exception! try { jSTerm0.matches(jSTerm0); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // 0 >= 0 // verifyException("java.util.Vector", e); } } /** //Test case number: 39 /*Coverage entropy=0.796311640173813 */ @Test(timeout = 4000) public void test39() throws Throwable { StringReader stringReader0 = new StringReader(" . "); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); // Undeclared exception! try { jSTerm0.equals((JSTerm) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 40 /*Coverage entropy=1.0704836531307913 */ @Test(timeout = 4000) public void test40() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = new JSTerm(); jSTerm1.add((Object) jSTerm1); // Undeclared exception! try { jSTerm1.equals(jSTerm0); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // umd.cs.shop.JSTerm cannot be cast to java.lang.String // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 41 /*Coverage entropy=1.5810937501718239 */ @Test(timeout = 4000) public void test41() throws Throwable { JSTerm jSTerm0 = new JSTerm(); jSTerm0.makeFunction(); // Undeclared exception! try { jSTerm0.equals(jSTerm0); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // 0 >= 0 // verifyException("java.util.Vector", e); } } /** //Test case number: 42 /*Coverage entropy=1.242453324894 */ @Test(timeout = 4000) public void test42() throws Throwable { JSTerm jSTerm0 = new JSTerm(); jSTerm0.setSize(41); // Undeclared exception! try { jSTerm0.cloneT(); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 43 /*Coverage entropy=1.3321790402101223 */ @Test(timeout = 4000) public void test43() throws Throwable { JSTerm jSTerm0 = new JSTerm(); // Undeclared exception! try { jSTerm0.cloneT(); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // 0 >= 0 // verifyException("java.util.Vector", e); } } /** //Test case number: 44 /*Coverage entropy=1.668173971997397 */ @Test(timeout = 4000) public void test44() throws Throwable { StringReader stringReader0 = new StringReader("?L3Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.makeFunction(); jSTerm0.addElement(stringReader0); // Undeclared exception! try { jSTerm0.call(); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // java.io.StringReader cannot be cast to umd.cs.shop.JSTerm // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 45 /*Coverage entropy=1.2130075659799042 */ @Test(timeout = 4000) public void test45() throws Throwable { StringReader stringReader0 = new StringReader("?L3Fk.|S0f4)Q|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); // Undeclared exception! try { jSTerm0.applySubstitutionT((JSSubstitution) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 46 /*Coverage entropy=1.2130075659799042 */ @Test(timeout = 4000) public void test46() throws Throwable { StringReader stringReader0 = new StringReader("?L3\".|00}j)Q|nw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSSubstitution jSSubstitution0 = new JSSubstitution(); jSSubstitution0.add((Object) "?L3\".|00}j)Q|nw{a"); // Undeclared exception! try { jSTerm0.applySubstitutionT(jSSubstitution0); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // java.lang.String cannot be cast to umd.cs.shop.JSPairVarTerm // verifyException("umd.cs.shop.JSSubstitution", e); } } /** //Test case number: 47 /*Coverage entropy=1.7478680974667573 */ @Test(timeout = 4000) public void test47() throws Throwable { JSSubstitution jSSubstitution0 = new JSSubstitution(); JSTerm jSTerm0 = new JSTerm(); // Undeclared exception! try { jSTerm0.applySubstitutionT(jSSubstitution0); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // 0 >= 0 // verifyException("java.util.Vector", e); } } /** //Test case number: 48 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test48() throws Throwable { JSTerm jSTerm0 = null; try { jSTerm0 = new JSTerm((StreamTokenizer) null); fail("Expecting exception: System.SystemExitException"); } catch(System.SystemExitException e) { // // no message in exception (getMessage() returned null) // verifyException("org.evosuite.runtime.System", e); } } /** //Test case number: 49 /*Coverage entropy=1.2139177396663228 */ @Test(timeout = 4000) public void test49() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.setSize(41); // Undeclared exception! try { jSTerm0.call(); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 50 /*Coverage entropy=1.7481554572476763 */ @Test(timeout = 4000) public void test50() throws Throwable { StringReader stringReader0 = new StringReader("?L3\"k.|00}j)Q|nGw]{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.makeEval(true); jSTerm0.call(); assertTrue(jSTerm0.isEval()); } /** //Test case number: 51 /*Coverage entropy=1.4184836619456562 */ @Test(timeout = 4000) public void test51() throws Throwable { StringReader stringReader0 = new StringReader("?l3fk.|s0f4"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = jSTerm0.call(); assertFalse(jSTerm0.isFunction()); assertEquals("[?%%%]", jSTerm1.toString()); assertTrue(jSTerm1.isVariable()); } /** //Test case number: 52 /*Coverage entropy=1.3246396383492691 */ @Test(timeout = 4000) public void test52() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.makeEval(true); // Undeclared exception! try { jSTerm0.call(); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // 1 >= 1 // verifyException("java.util.Vector", e); } } /** //Test case number: 53 /*Coverage entropy=1.0338678422246121 */ @Test(timeout = 4000) public void test53() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.addAll((Collection) jSTerm0); // Undeclared exception! try { jSTerm0.standardizerTerm(); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // java.lang.String cannot be cast to umd.cs.shop.JSTerm // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 54 /*Coverage entropy=1.90853528164356 */ @Test(timeout = 4000) public void test54() throws Throwable { StringReader stringReader0 = new StringReader("?L3\"k.|S0f4)Q|nGw]{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = jSTerm0.standardizerTerm(); boolean boolean0 = jSTerm1.equals(jSTerm0); assertFalse(jSTerm1.isFunction()); assertEquals("[?%%%0]", jSTerm1.toString()); assertFalse(jSTerm1.isEval()); assertFalse(jSTerm0.isFunction()); assertTrue(jSTerm1.isVariable()); assertFalse(jSTerm1.isConstant()); assertFalse(boolean0); } /** //Test case number: 55 /*Coverage entropy=1.7037000162210374 */ @Test(timeout = 4000) public void test55() throws Throwable { StringReader stringReader0 = new StringReader("qF)VFi7%2S"); StringReader stringReader1 = new StringReader("?L3Fk.|S0f4)Q|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader1); StreamTokenizer streamTokenizer1 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = jSTerm0.parseList(streamTokenizer1); boolean boolean0 = jSTerm1.isGround(); assertEquals(41, streamTokenizer1.ttype); assertTrue(boolean0); } /** //Test case number: 56 /*Coverage entropy=1.8271748439445188 */ @Test(timeout = 4000) public void test56() throws Throwable { StringReader stringReader0 = new StringReader("?L3Fk.|S0f4)Q|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(); JSTerm jSTerm1 = jSTerm0.parseList(streamTokenizer0); boolean boolean0 = jSTerm1.isGround(); assertEquals(41, streamTokenizer0.ttype); assertFalse(boolean0); } /** //Test case number: 57 /*Coverage entropy=1.5484538320369539 */ @Test(timeout = 4000) public void test57() throws Throwable { StringReader stringReader0 = new StringReader("?L3Fk.|S0f4)Q|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(); JSTerm jSTerm1 = jSTerm0.parseList(streamTokenizer0); jSTerm1.toStr(); assertEquals(41, streamTokenizer0.ttype); assertTrue(jSTerm1.isFunction()); } /** //Test case number: 58 /*Coverage entropy=1.4183036843924253 */ @Test(timeout = 4000) public void test58() throws Throwable { StringReader stringReader0 = new StringReader("?l3fk.|s0f4"); stringReader0.read(); stringReader0.read(); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = new JSTerm(streamTokenizer0); jSTerm0.makeFunction(); jSTerm1.makeFunction(); boolean boolean0 = jSTerm1.equals(jSTerm0); assertTrue(jSTerm1.isFunction()); assertFalse(boolean0); } /** //Test case number: 59 /*Coverage entropy=0.7858198373220868 */ @Test(timeout = 4000) public void test59() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = new JSTerm(streamTokenizer0); boolean boolean0 = jSTerm0.equals(jSTerm1); assertFalse(boolean0); } /** //Test case number: 60 /*Coverage entropy=1.0317671113505356 */ @Test(timeout = 4000) public void test60() throws Throwable { StringReader stringReader0 = new StringReader("?L3Fk.|S0f4)Q|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); StreamTokenizer streamTokenizer1 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = new JSTerm(streamTokenizer1); boolean boolean0 = jSTerm0.equals(jSTerm1); assertFalse(boolean0); assertEquals("[?L3Fk.|S0f4]", jSTerm0.toString()); assertFalse(jSTerm0.isFunction()); assertTrue(jSTerm0.isVariable()); } /** //Test case number: 61 /*Coverage entropy=0.9921279355474819 */ @Test(timeout = 4000) public void test61() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); boolean boolean0 = jSTerm0.equals(jSTerm0); assertTrue(boolean0); } /** //Test case number: 62 /*Coverage entropy=0.7595473914748635 */ @Test(timeout = 4000) public void test62() throws Throwable { StringReader stringReader0 = new StringReader("?l3g(fk.|0f4"); stringReader0.read(); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); stringReader0.reset(); JSTerm jSTerm1 = new JSTerm(streamTokenizer0); boolean boolean0 = jSTerm0.equals(jSTerm1); assertEquals("[?%%%]", jSTerm1.toString()); assertTrue(jSTerm1.isVariable()); assertFalse(boolean0); assertFalse(jSTerm1.isFunction()); } /** //Test case number: 63 /*Coverage entropy=1.3995705288353029 */ @Test(timeout = 4000) public void test63() throws Throwable { StringReader stringReader0 = new StringReader("?l3fk.|s0f4"); stringReader0.read(); stringReader0.read(); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = new JSTerm(streamTokenizer0); jSTerm0.makeFunction(); jSTerm1.makeFunction(); JSSubstitution jSSubstitution0 = new JSSubstitution(); jSTerm0.matches(jSTerm1, jSSubstitution0); assertTrue(jSTerm0.isFunction()); } /** //Test case number: 64 /*Coverage entropy=1.7170759801988817 */ @Test(timeout = 4000) public void test64() throws Throwable { StringReader stringReader0 = new StringReader("?l3g(fk.|0f4"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(); JSTerm jSTerm1 = new JSTerm(streamTokenizer0); assertFalse(jSTerm1.isConstant()); JSSubstitution jSSubstitution0 = jSTerm0.matches(jSTerm1); assertEquals("[?%%%]", jSTerm1.toString()); assertFalse(jSTerm1.isFunction()); assertEquals(1, jSSubstitution0.size()); } /** //Test case number: 65 /*Coverage entropy=2.0620695413001644 */ @Test(timeout = 4000) public void test65() throws Throwable { StringReader stringReader0 = new StringReader("?L3\"k.|00}j)Q|nGw]{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSSubstitution jSSubstitution0 = new JSSubstitution(); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSSubstitution jSSubstitution1 = jSTerm0.matches(jSTerm0, jSSubstitution0); JSTerm jSTerm1 = jSTerm0.cloneT(); JSTerm jSTerm2 = jSTerm1.applySubstitutionT(jSSubstitution1); assertNotSame(jSTerm2, jSTerm0); assertFalse(jSTerm1.isFunction()); assertFalse(jSTerm0.isFunction()); assertTrue(jSTerm2.isVariable()); assertEquals(1, jSSubstitution1.size()); assertEquals("[?%%%]", jSTerm1.toString()); } /** //Test case number: 66 /*Coverage entropy=1.1988493129136213 */ @Test(timeout = 4000) public void test66() throws Throwable { StringReader stringReader0 = new StringReader("Ih:5dko*H&}S x\""); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = new JSTerm(streamTokenizer0); JSSubstitution jSSubstitution0 = new JSSubstitution(); JSSubstitution jSSubstitution1 = jSTerm0.matches(jSTerm1, jSSubstitution0); assertTrue(jSSubstitution1.fail()); } /** //Test case number: 67 /*Coverage entropy=1.2406842919533958 */ @Test(timeout = 4000) public void test67() throws Throwable { StringReader stringReader0 = new StringReader("1=P0)CR1<bVM>};u+Qs"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSSubstitution jSSubstitution0 = new JSSubstitution(); JSSubstitution jSSubstitution1 = jSTerm0.matches(jSTerm0, jSSubstitution0); assertEquals((-2), streamTokenizer0.ttype); assertFalse(jSSubstitution1.fail()); } /** //Test case number: 68 /*Coverage entropy=0.8935520177351048 */ @Test(timeout = 4000) public void test68() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSSubstitution jSSubstitution0 = new JSSubstitution(); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = new JSTerm(streamTokenizer0); JSSubstitution jSSubstitution1 = jSTerm1.matches(jSTerm0, jSSubstitution0); assertTrue(jSSubstitution1.fail()); } /** //Test case number: 69 /*Coverage entropy=0.8980827500613235 */ @Test(timeout = 4000) public void test69() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.add((Object) "j"); // Undeclared exception! try { jSTerm0.cloneT(); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // java.lang.String cannot be cast to umd.cs.shop.JSTerm // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 70 /*Coverage entropy=1.4015840658678684 */ @Test(timeout = 4000) public void test70() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = jSTerm0.cloneT(); jSTerm1.removeElement("L!Fk.|S0f4"); assertEquals("[L!Fk.|S0f4]", jSTerm0.toString()); boolean boolean0 = jSTerm0.equals(jSTerm1); assertFalse(jSTerm1.isVariable()); assertFalse(boolean0); assertTrue(jSTerm1.isFunction()); assertFalse(jSTerm1.isConstant()); } /** //Test case number: 71 /*Coverage entropy=2.130689306584121 */ @Test(timeout = 4000) public void test71() throws Throwable { StringReader stringReader0 = new StringReader("?L3F.|S0f4)Q|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(); JSSubstitution jSSubstitution0 = new JSSubstitution(); JSTerm jSTerm1 = jSTerm0.parseList(streamTokenizer0); JSTerm jSTerm2 = jSTerm1.applySubstitutionT(jSSubstitution0); assertEquals(41, streamTokenizer0.ttype); assertTrue(jSTerm2.isFunction()); } /** //Test case number: 72 /*Coverage entropy=0.535959889216217 */ @Test(timeout = 4000) public void test72() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.setSize(41); // Undeclared exception! try { jSTerm0.print(); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 73 /*Coverage entropy=1.1189688668816267 */ @Test(timeout = 4000) public void test73() throws Throwable { StringReader stringReader0 = new StringReader("Kro,qegw{"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.makeFunction(); jSTerm0.makeEval(true); jSTerm0.print(); assertTrue(jSTerm0.isEval()); } /** //Test case number: 74 /*Coverage entropy=0.5623351446188083 */ @Test(timeout = 4000) public void test74() throws Throwable { StringReader stringReader0 = new StringReader(" qOb1i"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.print(); assertFalse(jSTerm0.isVariable()); } /** //Test case number: 75 /*Coverage entropy=0.5004024235381879 */ @Test(timeout = 4000) public void test75() throws Throwable { StringReader stringReader0 = new StringReader("?L3Fk.|S0f4)Q|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); jSTerm0.print(); assertFalse(jSTerm0.isFunction()); assertTrue(jSTerm0.isVariable()); assertEquals("[?L3Fk.|S0f4]", jSTerm0.toString()); assertFalse(jSTerm0.isConstant()); } /** //Test case number: 76 /*Coverage entropy=1.0905994737794786 */ @Test(timeout = 4000) public void test76() throws Throwable { StringReader stringReader0 = new StringReader("?L3Fk.|S0f4)Q|nGw{a"); stringReader0.read(); stringReader0.read(); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = new JSTerm(streamTokenizer0); StreamTokenizer streamTokenizer1 = new StreamTokenizer(stringReader0); // Undeclared exception! try { jSTerm0.parseList(streamTokenizer1); fail("Expecting exception: Error"); } catch(Error e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 77 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test77() throws Throwable { StringReader stringReader0 = new StringReader("(J+=]P\"T@l_x"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = null; try { jSTerm0 = new JSTerm(streamTokenizer0); fail("Expecting exception: Error"); } catch(Error e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 78 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test78() throws Throwable { StringReader stringReader0 = new StringReader("(+=9d3="); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = null; try { jSTerm0 = new JSTerm(streamTokenizer0); fail("Expecting exception: Error"); } catch(Error e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 79 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test79() throws Throwable { StringReader stringReader0 = new StringReader("(*yO\"oV"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = null; try { jSTerm0 = new JSTerm(streamTokenizer0); fail("Expecting exception: Error"); } catch(Error e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 80 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test80() throws Throwable { StringReader stringReader0 = new StringReader("("); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = null; try { jSTerm0 = new JSTerm(streamTokenizer0); fail("Expecting exception: Error"); } catch(Error e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 81 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test81() throws Throwable { StringReader stringReader0 = new StringReader("%dYzwdq"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); assertEquals((-3), streamTokenizer0.ttype); assertEquals("[%dYzwdq]", jSTerm0.toString()); } /** //Test case number: 82 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test82() throws Throwable { StringReader stringReader0 = new StringReader("%"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = null; try { jSTerm0 = new JSTerm(streamTokenizer0); fail("Expecting exception: Error"); } catch(Error e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 83 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test83() throws Throwable { StringReader stringReader0 = new StringReader("?"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = null; try { jSTerm0 = new JSTerm(streamTokenizer0); fail("Expecting exception: Error"); } catch(Error e) { // // no message in exception (getMessage() returned null) // verifyException("umd.cs.shop.JSTerm", e); } } /** //Test case number: 84 /*Coverage entropy=1.6061217378893984 */ @Test(timeout = 4000) public void test84() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSTerm jSTerm1 = jSTerm0.standardizerTerm(); jSTerm0.removeAll(jSTerm1); jSTerm1.matches(jSTerm0); assertEquals(0, jSTerm0.size()); assertTrue(jSTerm0.isEmpty()); } /** //Test case number: 85 /*Coverage entropy=1.1255617283058157 */ @Test(timeout = 4000) public void test85() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); JSSubstitution jSSubstitution0 = jSTerm0.matches(jSTerm0); assertFalse(jSSubstitution0.fail()); assertEquals(0, jSSubstitution0.size()); } /** //Test case number: 86 /*Coverage entropy=1.9036866883376182 */ @Test(timeout = 4000) public void test86() throws Throwable { StringReader stringReader0 = new StringReader("?L3F.|S0f4)Q|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(); JSTerm jSTerm1 = jSTerm0.parseList(streamTokenizer0); JSTerm jSTerm2 = jSTerm1.cloneT(); assertEquals(41, streamTokenizer0.ttype); assertTrue(jSTerm2.equals((Object)jSTerm1)); } /** //Test case number: 87 /*Coverage entropy=1.2280908078779182 */ @Test(timeout = 4000) public void test87() throws Throwable { StringReader stringReader0 = new StringReader("(L!Fk.|S0f4)Q@|nGw{a"); StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0); JSTerm jSTerm0 = new JSTerm(streamTokenizer0); assertFalse(jSTerm0.isEval()); JSTerm jSTerm1 = jSTerm0.call(); assertEquals(10, jSTerm1.capacity()); assertFalse(jSTerm1.isVariable()); assertFalse(jSTerm1.isConstant()); assertTrue(jSTerm1.isFunction()); assertNotSame(jSTerm1, jSTerm0); } }
9240450414020c5d66eb7b0cebd5d47bb0a74adb
1,900
java
Java
src/main/java/com/at/spring/jsonresponse/dto/ResponseCode.java
sphera5/spring-boot-custom-json-response
2ac480dcea8a378780e587624999482eb3d44666
[ "MIT" ]
1
2020-12-12T07:16:43.000Z
2020-12-12T07:16:43.000Z
src/main/java/com/at/spring/jsonresponse/dto/ResponseCode.java
era5mx/spring-boot-custom-json-response
2ac480dcea8a378780e587624999482eb3d44666
[ "MIT" ]
null
null
null
src/main/java/com/at/spring/jsonresponse/dto/ResponseCode.java
era5mx/spring-boot-custom-json-response
2ac480dcea8a378780e587624999482eb3d44666
[ "MIT" ]
null
null
null
20.879121
105
0.618421
1,001,458
package com.at.spring.jsonresponse.dto; import java.util.HashMap; import java.util.Map; import javax.validation.Valid; public class ResponseCode { private String code; private String message; private String level; private String description; private String moreInfo; @Valid private Map<String, Object> additionalProperties = new HashMap<String, Object>(); /** * No args constructor for use in serialization * */ public ResponseCode() { } /** * * @param message * @param level * @param description * @param code * @param moreInfo */ public ResponseCode(String code, String message, String level, String description, String moreInfo) { super(); this.code = code; this.message = message; this.level = level; this.description = description; this.moreInfo = moreInfo; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getLevel() { return level; } public void setLevel(String level) { this.level = level; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getMoreInfo() { return moreInfo; } public void setMoreInfo(String moreInfo) { this.moreInfo = moreInfo; } public Map<String, Object> getAdditionalProperties() { return this.additionalProperties; } public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } }
9240452e23bb3e3556e62bc3d2b1292f683048fc
3,221
java
Java
src/main/java/com/federico/target_tracker/bionanothings/AbsBionanothing.java
tfederico/DNAStorageSimulator
e7074b93a72f9ceee9dda25b25e026cabccddfe5
[ "MIT" ]
null
null
null
src/main/java/com/federico/target_tracker/bionanothings/AbsBionanothing.java
tfederico/DNAStorageSimulator
e7074b93a72f9ceee9dda25b25e026cabccddfe5
[ "MIT" ]
null
null
null
src/main/java/com/federico/target_tracker/bionanothings/AbsBionanothing.java
tfederico/DNAStorageSimulator
e7074b93a72f9ceee9dda25b25e026cabccddfe5
[ "MIT" ]
null
null
null
28.008696
109
0.660354
1,001,459
package com.federico.target_tracker.bionanothings; import javafx.geometry.Point2D; /** * Created by federico on 24/05/16. */ /** *Abstract class that defines the features of a bionanothing and its information */ public abstract class AbsBionanothing implements Bionanothing{ /** * Numerical identifier of the bionanothing */ private final int ID; /** * Position of the bionanothing */ private Point2D position; /** * Boolean variable which tells if the bionanothing is emitting attractants or not */ private boolean isEmittingAttractans = false; /** * Boolean variable which tells if the bionanothing is emitting repellents or not */ private boolean isEmittingRepellents = true; /** * Constructor of the AbsBionanothing class * @param id Numerical identifier of the bionanothing * @param x Position on the x-axis of the bionanothing. The point (0,0) is the center of the square * @param y Position on the y-axis of the bionanothing. The point (0,0) is the center of the square */ AbsBionanothing(int id,double x, double y){ ID = id; position = new Point2D(x,y); } /** * Method that calculates the distance between two bionanothings * @param fellow Bionanothing whence calculate the distance * @return double */ public double getDistance(Bionanothing fellow) { return position.distance(fellow.getPosition()); } /** * Method used to get the position of the bionanothing * @return Point2D */ public Point2D getPosition() { return position; } /** * Method used to set the position of the bionanothing * @param x New position on the x-axis of the bionanothing. The point (0,0) is the center of the square * @param y New position on the y-axis of the bionanothing. The point (0,0) is the center of the square */ public void setPosition(double x, double y){ position = new Point2D(x,y); } /** * Method used to get the identifier of the bionanothing * @return int */ public int getID(){ return ID; } /** * Method that checks if a bionanothing is emitting attractants or not * @return boolean */ public boolean isEmittingAttractants() { return isEmittingAttractans; } /** * Method that checks if a bionanothing is emitting repellents or not * @return boolean */ public boolean isEmittingRepellents() { return isEmittingRepellents; } /** * Method that orders to a bionanothing to start or stop emitting attractants * @param attractants Boolean variable used to tell to a bionanothing to start or stop to emit attractans */ public void emitAttractants(boolean attractants) { isEmittingAttractans = attractants; } /** * Method that orders to a bionanothing to start or stop emitting repellents * @param repellents Boolean variable used to tell to a bionanothing to start or stop to emit repellents */ public void emitRepellents(boolean repellents) { isEmittingRepellents = repellents; } }
9240468cddb9c41de9080408e1d7628b08d03ce1
1,150
java
Java
src/main/java/it/linksmt/cts2/plugin/sti/db/commands/search/GetAllMapVersion.java
iit-rende/sti-service
c3f2f8961d2553fc45977f6eb91afd91ea67071a
[ "Apache-2.0" ]
null
null
null
src/main/java/it/linksmt/cts2/plugin/sti/db/commands/search/GetAllMapVersion.java
iit-rende/sti-service
c3f2f8961d2553fc45977f6eb91afd91ea67071a
[ "Apache-2.0" ]
null
null
null
src/main/java/it/linksmt/cts2/plugin/sti/db/commands/search/GetAllMapVersion.java
iit-rende/sti-service
c3f2f8961d2553fc45977f6eb91afd91ea67071a
[ "Apache-2.0" ]
null
null
null
38.333333
116
0.814783
1,001,460
package it.linksmt.cts2.plugin.sti.db.commands.search; import java.util.List; import org.hibernate.Session; import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import it.linksmt.cts2.plugin.sti.db.hibernate.HibernateCommand; import it.linksmt.cts2.plugin.sti.db.model.MapSetVersion; import it.linksmt.cts2.plugin.sti.service.exception.StiAuthorizationException; import it.linksmt.cts2.plugin.sti.service.exception.StiHibernateException; import it.linksmt.cts2.plugin.sti.service.util.StiConstants; public class GetAllMapVersion extends HibernateCommand { @Override public void checkPermission(final Session session) throws StiAuthorizationException, StiHibernateException { if (userInfo == null) { throw new StiAuthorizationException("Occorre effettuare il login per utilizzare il servizio."); } } @Override public List<MapSetVersion> execute(final Session session) throws StiAuthorizationException, StiHibernateException { return session.createCriteria(MapSetVersion.class).add(Restrictions.eq("status", StiConstants.STATUS_CODES.ACTIVE.getCode())).addOrder(Order.asc("fullname")).list(); } }
9240471c5bbcb8d20c452d15c0a693836b3ee3d9
10,186
java
Java
src/main/java/com/pluxbox/radiomanager/api/models/ContactResult.java
Pluxbox/radiomanager-java-client
491577bad11e5bdd8ba211cf0a1c0a5501e85531
[ "MIT" ]
null
null
null
src/main/java/com/pluxbox/radiomanager/api/models/ContactResult.java
Pluxbox/radiomanager-java-client
491577bad11e5bdd8ba211cf0a1c0a5501e85531
[ "MIT" ]
null
null
null
src/main/java/com/pluxbox/radiomanager/api/models/ContactResult.java
Pluxbox/radiomanager-java-client
491577bad11e5bdd8ba211cf0a1c0a5501e85531
[ "MIT" ]
null
null
null
25.4675
165
0.684402
1,001,461
/* * RadioManager * RadioManager * * OpenAPI spec version: 2.0 * Contact: [email protected] * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package com.pluxbox.radiomanager.api.models; import java.util.Objects; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.pluxbox.radiomanager.api.models.BroadcastRelationsModelType; import com.pluxbox.radiomanager.api.models.Contact; import com.pluxbox.radiomanager.api.models.ContactOutputOnly; import com.pluxbox.radiomanager.api.models.ContactRelations; import com.pluxbox.radiomanager.api.models.ContactRelationsItems; import com.pluxbox.radiomanager.api.models.ContactRelationsTags; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; /** * ContactResult */ public class ContactResult { @SerializedName("id") private Long id = null; @SerializedName("created_at") private OffsetDateTime createdAt = null; @SerializedName("updated_at") private OffsetDateTime updatedAt = null; @SerializedName("deleted_at") private OffsetDateTime deletedAt = null; @SerializedName("_external_station_id") private Long externalStationId = null; @SerializedName("model_type_id") private Long modelTypeId = null; @SerializedName("field_values") private Object fieldValues = null; @SerializedName("email") private String email = null; @SerializedName("firstname") private String firstname = null; @SerializedName("lastname") private String lastname = null; @SerializedName("phone") private String phone = null; @SerializedName("tags") private ContactRelationsTags tags = null; @SerializedName("items") private ContactRelationsItems items = null; @SerializedName("model_type") private BroadcastRelationsModelType modelType = null; public ContactResult id(Long id) { this.id = id; return this; } /** * Get id * @return id **/ @ApiModelProperty(example = "1", value = "") public Long getId() { return id; } public void setId(Long id) { this.id = id; } public ContactResult createdAt(OffsetDateTime createdAt) { this.createdAt = createdAt; return this; } /** * Get createdAt * @return createdAt **/ @ApiModelProperty(example = "2016-01-11T22:01:11+02:00", value = "") public OffsetDateTime getCreatedAt() { return createdAt; } public void setCreatedAt(OffsetDateTime createdAt) { this.createdAt = createdAt; } public ContactResult updatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; return this; } /** * Get updatedAt * @return updatedAt **/ @ApiModelProperty(example = "2016-01-11T22:01:11+02:00", value = "") public OffsetDateTime getUpdatedAt() { return updatedAt; } public void setUpdatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; } public ContactResult deletedAt(OffsetDateTime deletedAt) { this.deletedAt = deletedAt; return this; } /** * Get deletedAt * @return deletedAt **/ @ApiModelProperty(example = "2016-01-11T22:01:11+02:00", value = "") public OffsetDateTime getDeletedAt() { return deletedAt; } public void setDeletedAt(OffsetDateTime deletedAt) { this.deletedAt = deletedAt; } public ContactResult externalStationId(Long externalStationId) { this.externalStationId = externalStationId; return this; } /** * Get externalStationId * @return externalStationId **/ @ApiModelProperty(value = "") public Long getExternalStationId() { return externalStationId; } public void setExternalStationId(Long externalStationId) { this.externalStationId = externalStationId; } public ContactResult modelTypeId(Long modelTypeId) { this.modelTypeId = modelTypeId; return this; } /** * Get modelTypeId * @return modelTypeId **/ @ApiModelProperty(example = "1", required = true, value = "") public Long getModelTypeId() { return modelTypeId; } public void setModelTypeId(Long modelTypeId) { this.modelTypeId = modelTypeId; } public ContactResult fieldValues(Object fieldValues) { this.fieldValues = fieldValues; return this; } /** * Get fieldValues * @return fieldValues **/ @ApiModelProperty(value = "") public Object getFieldValues() { return fieldValues; } public void setFieldValues(Object fieldValues) { this.fieldValues = fieldValues; } public ContactResult email(String email) { this.email = email; return this; } /** * Get email * @return email **/ @ApiModelProperty(example = "[email protected]", value = "") public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public ContactResult firstname(String firstname) { this.firstname = firstname; return this; } /** * Get firstname * @return firstname **/ @ApiModelProperty(example = "Foo", required = true, value = "") public String getFirstname() { return firstname; } public void setFirstname(String firstname) { this.firstname = firstname; } public ContactResult lastname(String lastname) { this.lastname = lastname; return this; } /** * Get lastname * @return lastname **/ @ApiModelProperty(example = "Bar", required = true, value = "") public String getLastname() { return lastname; } public void setLastname(String lastname) { this.lastname = lastname; } public ContactResult phone(String phone) { this.phone = phone; return this; } /** * Get phone * @return phone **/ @ApiModelProperty(example = "035-12345678910", value = "") public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public ContactResult tags(ContactRelationsTags tags) { this.tags = tags; return this; } /** * Get tags * @return tags **/ @ApiModelProperty(required = true, value = "") public ContactRelationsTags getTags() { return tags; } public void setTags(ContactRelationsTags tags) { this.tags = tags; } public ContactResult items(ContactRelationsItems items) { this.items = items; return this; } /** * Get items * @return items **/ @ApiModelProperty(value = "") public ContactRelationsItems getItems() { return items; } public void setItems(ContactRelationsItems items) { this.items = items; } public ContactResult modelType(BroadcastRelationsModelType modelType) { this.modelType = modelType; return this; } /** * Get modelType * @return modelType **/ @ApiModelProperty(value = "") public BroadcastRelationsModelType getModelType() { return modelType; } public void setModelType(BroadcastRelationsModelType modelType) { this.modelType = modelType; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ContactResult contactResult = (ContactResult) o; return Objects.equals(this.id, contactResult.id) && Objects.equals(this.createdAt, contactResult.createdAt) && Objects.equals(this.updatedAt, contactResult.updatedAt) && Objects.equals(this.deletedAt, contactResult.deletedAt) && Objects.equals(this.externalStationId, contactResult.externalStationId) && Objects.equals(this.modelTypeId, contactResult.modelTypeId) && Objects.equals(this.fieldValues, contactResult.fieldValues) && Objects.equals(this.email, contactResult.email) && Objects.equals(this.firstname, contactResult.firstname) && Objects.equals(this.lastname, contactResult.lastname) && Objects.equals(this.phone, contactResult.phone) && Objects.equals(this.tags, contactResult.tags) && Objects.equals(this.items, contactResult.items) && Objects.equals(this.modelType, contactResult.modelType); } @Override public int hashCode() { return Objects.hash(id, createdAt, updatedAt, deletedAt, externalStationId, modelTypeId, fieldValues, email, firstname, lastname, phone, tags, items, modelType); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ContactResult {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); sb.append(" deletedAt: ").append(toIndentedString(deletedAt)).append("\n"); sb.append(" externalStationId: ").append(toIndentedString(externalStationId)).append("\n"); sb.append(" modelTypeId: ").append(toIndentedString(modelTypeId)).append("\n"); sb.append(" fieldValues: ").append(toIndentedString(fieldValues)).append("\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); sb.append(" firstname: ").append(toIndentedString(firstname)).append("\n"); sb.append(" lastname: ").append(toIndentedString(lastname)).append("\n"); sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" items: ").append(toIndentedString(items)).append("\n"); sb.append(" modelType: ").append(toIndentedString(modelType)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
924047ab99656cd2816c7c2f3dd0422490003b3f
2,808
java
Java
plugin-core/src/test/java/org/jvnet/jaxb2/maven2/RawXJC2MojoTest.java
rsearls/maven-jaxb2-plugin
d87e47b6d26cb8bf7232e63aed6340bde242b03d
[ "BSD-2-Clause" ]
337
2015-01-07T06:20:14.000Z
2022-03-28T18:54:18.000Z
plugin-core/src/test/java/org/jvnet/jaxb2/maven2/RawXJC2MojoTest.java
rsearls/maven-jaxb2-plugin
d87e47b6d26cb8bf7232e63aed6340bde242b03d
[ "BSD-2-Clause" ]
176
2015-01-05T13:11:49.000Z
2022-02-20T22:47:21.000Z
plugin-core/src/test/java/org/jvnet/jaxb2/maven2/RawXJC2MojoTest.java
rsearls/maven-jaxb2-plugin
d87e47b6d26cb8bf7232e63aed6340bde242b03d
[ "BSD-2-Clause" ]
111
2015-01-08T14:02:47.000Z
2022-03-17T10:16:49.000Z
34.666667
102
0.650285
1,001,462
package org.jvnet.jaxb2.maven2; import org.apache.maven.plugin.MojoExecutionException; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; import static org.junit.Assert.assertEquals; public class RawXJC2MojoTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); private File testJarFile; @Before public void createJarFile() throws Exception { testJarFile = temporaryFolder.newFile("test.jar"); try (JarOutputStream out = new JarOutputStream(new FileOutputStream(testJarFile))) { out.putNextEntry(new JarEntry("dir/")); out.closeEntry(); out.putNextEntry(new JarEntry("dir/nested.xjb")); out.write("nested binding".getBytes(StandardCharsets.UTF_8)); out.closeEntry(); out.putNextEntry(new JarEntry("root.xjb")); out.write("root binding".getBytes(StandardCharsets.UTF_8)); out.closeEntry(); } } @Test public void collectsBindingUrisFromArtifact() throws Exception { List<URI> bindings = new ArrayList<>(); final RawXJC2Mojo<Void> mojo = new RawXJC2Mojo<Void>() { @Override protected OptionsFactory<Void> getOptionsFactory() { throw new UnsupportedOperationException(); } @Override public void doExecute(Void options) throws MojoExecutionException { throw new UnsupportedOperationException(); } }; mojo.collectBindingUrisFromArtifact(testJarFile, bindings); assertEquals(2, bindings.size()); assertEquals(URI.create("jar:" + testJarFile.toURI() + "!/dir/nested.xjb"), bindings.get(0)); assertEquals(URI.create("jar:" + testJarFile.toURI() + "!/root.xjb"), bindings.get(1)); assertEquals("nested binding", readContent(bindings.get(0))); assertEquals("root binding", readContent(bindings.get(1))); } private String readContent(URI uri) throws Exception { try (InputStream in = uri.toURL().openConnection().getInputStream()) { ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int length; while ((length = in.read(buffer)) != -1) { out.write(buffer, 0, length); } return out.toString(StandardCharsets.UTF_8.name()); } } }
924049ad8b4802aecf93360b9b0f882b0738985b
25,095
java
Java
chrome/android/features/cablev2_authenticator/java/src/org/chromium/chrome/browser/webauth/authenticator/CableAuthenticator.java
chromium/chromium
df46e572c3449a4b108d6e02fbe4f6d24cf98381
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
14,668
2015-01-01T01:57:10.000Z
2022-03-31T23:33:32.000Z
chrome/android/features/cablev2_authenticator/java/src/org/chromium/chrome/browser/webauth/authenticator/CableAuthenticator.java
chromium/chromium
df46e572c3449a4b108d6e02fbe4f6d24cf98381
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
86
2015-10-21T13:02:42.000Z
2022-03-14T07:50:50.000Z
chrome/android/features/cablev2_authenticator/java/src/org/chromium/chrome/browser/webauth/authenticator/CableAuthenticator.java
chromium/chromium
df46e572c3449a4b108d6e02fbe4f6d24cf98381
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
5,941
2015-01-02T11:32:21.000Z
2022-03-31T16:35:46.000Z
44.494681
100
0.629926
1,001,463
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.webauth.authenticator; import android.app.Activity; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.IntentSender; import android.hardware.usb.UsbAccessory; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.Settings; import com.google.android.gms.fido.Fido; import com.google.android.gms.fido.common.Transport; import com.google.android.gms.fido.fido2.Fido2PrivilegedApiClient; import com.google.android.gms.fido.fido2.api.common.Attachment; import com.google.android.gms.fido.fido2.api.common.AttestationConveyancePreference; import com.google.android.gms.fido.fido2.api.common.AuthenticatorAssertionResponse; import com.google.android.gms.fido.fido2.api.common.AuthenticatorAttestationResponse; import com.google.android.gms.fido.fido2.api.common.AuthenticatorErrorResponse; import com.google.android.gms.fido.fido2.api.common.AuthenticatorSelectionCriteria; import com.google.android.gms.fido.fido2.api.common.BrowserPublicKeyCredentialCreationOptions; import com.google.android.gms.fido.fido2.api.common.BrowserPublicKeyCredentialRequestOptions; import com.google.android.gms.fido.fido2.api.common.PublicKeyCredential; import com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialCreationOptions; import com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialDescriptor; import com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialParameters; import com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialRequestOptions; import com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialRpEntity; import com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialType; import com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialUserEntity; import com.google.android.gms.tasks.Task; import org.chromium.base.Log; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.NativeMethods; import org.chromium.base.task.PostTask; import org.chromium.base.task.SingleThreadTaskRunner; import org.chromium.content_public.browser.UiThreadTaskTraits; import java.util.ArrayList; import java.util.List; /** * CableAuthenticator implements makeCredential and getAssertion operations on top of the Privileged * FIDO2 API. */ class CableAuthenticator { private static final String TAG = "CableAuthenticator"; private static final String FIDO2_KEY_CREDENTIAL_EXTRA = "FIDO2_CREDENTIAL_EXTRA"; private static final double TIMEOUT_SECONDS = 20; private static final int REGISTER_REQUEST_CODE = 1; private static final int SIGN_REQUEST_CODE = 2; private static final int CTAP2_OK = 0; private static final int CTAP2_ERR_CREDENTIAL_EXCLUDED = 0x19; private static final int CTAP2_ERR_OPERATION_DENIED = 0x27; private static final int CTAP2_ERR_UNSUPPORTED_OPTION = 0x2D; private static final int CTAP2_ERR_NO_CREDENTIALS = 0x2E; private static final int CTAP2_ERR_OTHER = 0x7F; private final Context mContext; private final CableAuthenticatorUI mUi; private final SingleThreadTaskRunner mTaskRunner; // mFCMEvent contains the serialized event data that was stored in the notification's // PendingIntent. private final byte[] mFCMEvent; // mServerLinkData contains the information passed from GMS Core in the event that // this is a SERVER_LINK connection. private final byte[] mServerLinkData; // mQRURI contains the contents of a QR code ("FIDO:/234"...), or null if // this is not a QR transaction. private final String mQRURI; // mLinkQR stores whether a QR transaction should send linking information. private boolean mLinkQR; // mHandle is the opaque ID returned by the native code to ensure that // |stop| doesn't apply to a transaction that this instance didn't create. private long mHandle; public enum Result { REGISTER_OK, REGISTER_ERROR, SIGN_OK, SIGN_ERROR, OTHER, } public enum RequestType { GET_ASSERTION, MAKE_CREDENTIAL, } public CableAuthenticator(Context context, CableAuthenticatorUI ui, long networkContext, long registration, byte[] secret, boolean isFcmNotification, UsbAccessory accessory, byte[] serverLink, byte[] fcmEvent, String qrURI, boolean metricsEnabled) { mContext = context; mUi = ui; mFCMEvent = fcmEvent; mServerLinkData = serverLink; mQRURI = qrURI; // networkContext can only be used from the UI thread, therefore all // short-lived work is done on that thread. mTaskRunner = PostTask.createSingleThreadTaskRunner(UiThreadTaskTraits.USER_VISIBLE); assert mTaskRunner.belongsToCurrentThread(); CableAuthenticatorJni.get().setup(registration, networkContext, secret, metricsEnabled); if (accessory != null) { // USB mode can start immediately. mHandle = CableAuthenticatorJni.get().startUSB( this, new USBHandler(context, mTaskRunner, accessory)); } // Otherwise wait for |onBluetoothReady|. } // Calls from native code. // Called when an informative status update is available. The argument has the same values // as the Status enum from v2_authenticator.h. @CalledByNative public void onStatus(int code) { mUi.onStatus(code); } // Called when the native code wishes to log a protobuf event. @CalledByNative public static void logEvent(byte[] event) { CableEventLogger.log(event); } @CalledByNative public static BLEAdvert newBLEAdvert(byte[] payload) { return new BLEAdvert(payload); } @CalledByNative public void makeCredential(String rpId, byte[] clientDataHash, byte[] userId, int[] algorithms, byte[][] excludedCredentialIds, boolean residentKeyRequired) { // TODO: handle concurrent requests Fido2PrivilegedApiClient client = Fido.getFido2PrivilegedApiClient(mContext); if (client == null) { Log.i(TAG, "getFido2PrivilegedApiClient failed"); return; } Log.i(TAG, "have fido client"); List<PublicKeyCredentialParameters> parameters = new ArrayList<>(); for (int i = 0; i < algorithms.length; i++) { try { parameters.add(new PublicKeyCredentialParameters( PublicKeyCredentialType.PUBLIC_KEY.toString(), algorithms[i])); } catch (IllegalArgumentException e) { // The FIDO API will throw IllegalArgumentException for unrecognised algorithms. // Since an authenticator ignores unknown algorithms, this exception just needs to // be caught and ignored. } } // The GmsCore FIDO2 API does not actually support resident keys yet. AuthenticatorSelectionCriteria selection = new AuthenticatorSelectionCriteria.Builder() .setAttachment(Attachment.PLATFORM) .build(); List<PublicKeyCredentialDescriptor> excludeCredentials = new ArrayList<PublicKeyCredentialDescriptor>(); for (int i = 0; i < excludedCredentialIds.length; i++) { excludeCredentials.add( new PublicKeyCredentialDescriptor(PublicKeyCredentialType.PUBLIC_KEY.toString(), excludedCredentialIds[i], new ArrayList<Transport>())); } byte[] dummy = new byte[32]; PublicKeyCredentialCreationOptions credentialCreationOptions = new PublicKeyCredentialCreationOptions.Builder() .setRp(new PublicKeyCredentialRpEntity(rpId, "", "")) .setUser(new PublicKeyCredentialUserEntity(userId, "", null, "")) // This is unused because we override it with // |setClientDataHash|, below. But a value must be set // to prevent this Builder from throwing an exception. .setChallenge(clientDataHash) .setParameters(parameters) .setTimeoutSeconds(TIMEOUT_SECONDS) .setExcludeList(excludeCredentials) .setAuthenticatorSelection(selection) .setAttestationConveyancePreference(AttestationConveyancePreference.NONE) .build(); BrowserPublicKeyCredentialCreationOptions browserRequestOptions = new BrowserPublicKeyCredentialCreationOptions.Builder() .setPublicKeyCredentialCreationOptions(credentialCreationOptions) .setClientDataHash(clientDataHash) .setOrigin(Uri.parse("https://" + rpId)) .build(); Task<PendingIntent> result = client.getRegisterPendingIntent(browserRequestOptions); result.addOnSuccessListener(pendingIntent -> { Log.i(TAG, "got pending"); try { mUi.startIntentSenderForResult(pendingIntent.getIntentSender(), REGISTER_REQUEST_CODE, null, // fillInIntent, 0, // flagsMask, 0, // flagsValue, 0, // extraFlags, Bundle.EMPTY); } catch (IntentSender.SendIntentException e) { Log.e(TAG, "intent failure"); } }).addOnFailureListener(e -> { Log.e(TAG, "intent failure" + e); }); Log.i(TAG, "op done"); } @CalledByNative public void getAssertion(String rpId, byte[] clientDataHash, byte[][] allowedCredentialIds) { // TODO: handle concurrent requests Fido2PrivilegedApiClient client = Fido.getFido2PrivilegedApiClient(mContext); if (client == null) { Log.i(TAG, "getFido2PrivilegedApiClient failed"); return; } Log.i(TAG, "have fido client"); List<PublicKeyCredentialDescriptor> allowCredentials = new ArrayList<PublicKeyCredentialDescriptor>(); ArrayList<Transport> transports = new ArrayList<Transport>(); transports.add(Transport.INTERNAL); for (int i = 0; i < allowedCredentialIds.length; i++) { allowCredentials.add( new PublicKeyCredentialDescriptor(PublicKeyCredentialType.PUBLIC_KEY.toString(), allowedCredentialIds[i], transports)); } PublicKeyCredentialRequestOptions credentialRequestOptions = new PublicKeyCredentialRequestOptions.Builder() .setAllowList(allowCredentials) // This is unused because we override it with // |setClientDataHash|, below. But a value must be set // to prevent this Builder from throwing an exception. .setChallenge(clientDataHash) .setRpId(rpId) .setTimeoutSeconds(TIMEOUT_SECONDS) .build(); BrowserPublicKeyCredentialRequestOptions browserRequestOptions = new BrowserPublicKeyCredentialRequestOptions.Builder() .setPublicKeyCredentialRequestOptions(credentialRequestOptions) .setClientDataHash(clientDataHash) .setOrigin(Uri.parse("https://" + rpId)) .build(); Task<PendingIntent> result = client.getSignPendingIntent(browserRequestOptions); result.addOnSuccessListener(pendingIntent -> { Log.i(TAG, "got pending"); try { mUi.startIntentSenderForResult(pendingIntent.getIntentSender(), SIGN_REQUEST_CODE, null, // fillInIntent, 0, // flagsMask, 0, // flagsValue, 0, // extraFlags, Bundle.EMPTY); } catch (IntentSender.SendIntentException e) { Log.e(TAG, "intent failure"); } }).addOnFailureListener(e -> { Log.e(TAG, "intent failure" + e); }); Log.i(TAG, "op done"); } /** * Called from native code when a network-based operation has completed. * * @param ok true if the transaction completed successfully. Otherwise it * indicates some form of error that could include tunnel server * errors, handshake failures, etc. * @param errorCode a value from cablev2::authenticator::Platform::Error. */ @CalledByNative public void onComplete(boolean ok, int errorCode) { assert mTaskRunner.belongsToCurrentThread(); mUi.onComplete(ok, errorCode); } void onActivityStop() { CableAuthenticatorJni.get().onActivityStop(mHandle); } void onActivityResult(int requestCode, int resultCode, Intent data) { Log.i(TAG, "onActivityResult " + requestCode + " " + resultCode); Result result = Result.OTHER; switch (requestCode) { case REGISTER_REQUEST_CODE: if (onRegisterResponse(resultCode, data)) { result = Result.REGISTER_OK; } else { result = Result.REGISTER_ERROR; } break; case SIGN_REQUEST_CODE: if (onSignResponse(resultCode, data)) { result = Result.SIGN_OK; } else { result = Result.SIGN_ERROR; } break; default: Log.i(TAG, "invalid requestCode: " + requestCode); assert (false); } mUi.onAuthenticatorResult(result); } private boolean onRegisterResponse(int resultCode, Intent data) { if (resultCode != Activity.RESULT_OK || data == null) { Log.e(TAG, "Failed with result code " + resultCode); onAuthenticatorAssertionResponse(CTAP2_ERR_OPERATION_DENIED, null, null, null); return false; } Log.e(TAG, "OK."); if (data.hasExtra(Fido.FIDO2_KEY_ERROR_EXTRA)) { AuthenticatorErrorResponse error = AuthenticatorErrorResponse.deserializeFromBytes( data.getByteArrayExtra(Fido.FIDO2_KEY_ERROR_EXTRA)); Log.i(TAG, "error response: " + error.getErrorMessage() + " " + String.valueOf(error.getErrorCodeAsInt())); // ErrorCode represents DOMErrors not CTAP status codes. int ctap_status; switch (error.getErrorCode()) { case INVALID_STATE_ERR: // Assumed to be caused by a matching excluded credential. // (It's possible to match the error string to be sure, // but that's fragile.) ctap_status = CTAP2_ERR_CREDENTIAL_EXCLUDED; break; case NOT_ALLOWED_ERR: ctap_status = CTAP2_ERR_OPERATION_DENIED; break; default: ctap_status = CTAP2_ERR_OTHER; break; } onAuthenticatorAttestationResponse(CTAP2_ERR_OTHER, null); return false; } if (!data.hasExtra(Fido.FIDO2_KEY_RESPONSE_EXTRA) || !data.hasExtra(Fido.FIDO2_KEY_CREDENTIAL_EXTRA)) { Log.e(TAG, "Missing FIDO2_KEY_RESPONSE_EXTRA or FIDO2_KEY_CREDENTIAL_EXTRA"); onAuthenticatorAttestationResponse(CTAP2_ERR_OTHER, null); return false; } Log.e(TAG, "cred extra"); PublicKeyCredential unusedPublicKeyCredential = PublicKeyCredential.deserializeFromBytes( data.getByteArrayExtra(Fido.FIDO2_KEY_CREDENTIAL_EXTRA)); AuthenticatorAttestationResponse response = AuthenticatorAttestationResponse.deserializeFromBytes( data.getByteArrayExtra(Fido.FIDO2_KEY_RESPONSE_EXTRA)); onAuthenticatorAttestationResponse(CTAP2_OK, response.getAttestationObject()); return true; } private boolean onSignResponse(int resultCode, Intent data) { if (resultCode != Activity.RESULT_OK || data == null) { Log.e(TAG, "Failed with result code " + resultCode); onAuthenticatorAssertionResponse(CTAP2_ERR_OPERATION_DENIED, null, null, null); return false; } Log.e(TAG, "OK."); if (data.hasExtra(Fido.FIDO2_KEY_ERROR_EXTRA)) { AuthenticatorErrorResponse error = AuthenticatorErrorResponse.deserializeFromBytes( data.getByteArrayExtra(Fido.FIDO2_KEY_ERROR_EXTRA)); Log.i(TAG, "error response: " + error.getErrorMessage() + " " + String.valueOf(error.getErrorCodeAsInt())); // ErrorCode represents DOMErrors not CTAP status codes. int ctap_status; switch (error.getErrorCode()) { case INVALID_STATE_ERR: // Assumed to be because none of the credentials were // recognised. (It's possible to match the error string to // be sure, but that's fragile.) ctap_status = CTAP2_ERR_NO_CREDENTIALS; break; case NOT_ALLOWED_ERR: ctap_status = CTAP2_ERR_OPERATION_DENIED; break; default: ctap_status = CTAP2_ERR_OTHER; break; } onAuthenticatorAssertionResponse(ctap_status, null, null, null); return false; } if (!data.hasExtra(Fido.FIDO2_KEY_RESPONSE_EXTRA) || !data.hasExtra(Fido.FIDO2_KEY_CREDENTIAL_EXTRA)) { Log.e(TAG, "Missing FIDO2_KEY_RESPONSE_EXTRA or FIDO2_KEY_CREDENTIAL_EXTRA"); onAuthenticatorAssertionResponse(CTAP2_ERR_OTHER, null, null, null); return false; } Log.e(TAG, "cred extra"); PublicKeyCredential unusedPublicKeyCredential = PublicKeyCredential.deserializeFromBytes( data.getByteArrayExtra(Fido.FIDO2_KEY_CREDENTIAL_EXTRA)); AuthenticatorAssertionResponse response = AuthenticatorAssertionResponse.deserializeFromBytes( data.getByteArrayExtra(Fido.FIDO2_KEY_RESPONSE_EXTRA)); onAuthenticatorAssertionResponse(CTAP2_OK, response.getKeyHandle(), response.getAuthenticatorData(), response.getSignature()); return true; } private void onAuthenticatorAttestationResponse(int ctapStatus, byte[] attestationObject) { mTaskRunner.postTask( () -> CableAuthenticatorJni.get().onAuthenticatorAttestationResponse( ctapStatus, attestationObject)); } private void onAuthenticatorAssertionResponse( int ctapStatus, byte[] credentialID, byte[] authenticatorData, byte[] signature) { mTaskRunner.postTask( () -> CableAuthenticatorJni.get().onAuthenticatorAssertionResponse( ctapStatus, credentialID, authenticatorData, signature)); } // Calls from UI. void setQRLinking(boolean link) { mLinkQR = link; } /** * Called to indicate that Bluetooth is now enabled and a cloud message can be processed. */ void onBluetoothReady() { assert mTaskRunner.belongsToCurrentThread(); if (mServerLinkData != null) { mHandle = CableAuthenticatorJni.get().startServerLink(this, mServerLinkData); } else if (mQRURI != null) { mHandle = CableAuthenticatorJni.get().startQR(this, getName(), mQRURI, mLinkQR); } else { mHandle = CableAuthenticatorJni.get().startCloudMessage(this, mFCMEvent); } } void close() { assert mTaskRunner.belongsToCurrentThread(); CableAuthenticatorJni.get().stop(mHandle); } String getName() { final String name = Settings.Global.getString( mContext.getContentResolver(), Settings.Global.DEVICE_NAME); if (name != null && name.length() > 0) { return name; } return Build.MANUFACTURER + " " + Build.MODEL; } /** * validateServerLinkData returns zero if |serverLink| is a valid argument for * |startServerLink| or else an error value from cablev2::authenticator::Platform::Error. */ static int validateServerLinkData(byte[] serverLinkData) { return CableAuthenticatorJni.get().validateServerLinkData(serverLinkData); } /** * validateQRURI returns zero if |uri| is a valid FIDO QR code or else an error value from * cablev2::authenticator::Platform::Error. */ static int validateQRURI(String uri) { return CableAuthenticatorJni.get().validateQRURI(uri); } @NativeMethods interface Natives { /** * setup is called before any other functions in order for the native code to perform * one-time setup operations. It may be called several times, but subsequent calls are * ignored. */ void setup(long registration, long networkContext, byte[] secret, boolean metricsEnabled); /** * Called to instruct the C++ code to start a new transaction using |usbDevice|. Returns an * opaque value that can be passed to |stop| to cancel this transaction. */ long startUSB(CableAuthenticator cableAuthenticator, USBHandler usbDevice); /** * Called to instruct the C++ code to start a new transaction based on the contents of a QR * code. The given name will be transmitted to the peer in order to identify this device, it * should be human-meaningful. The qrURI must be a fido: URI. Returns an opaque value that * can be passed to |stop| to cancel this transaction. */ long startQR(CableAuthenticator cableAuthenticator, String authenticatorName, String qrURI, boolean link); /** * Called to instruct the C++ code to start a new transaction based on the given link * information which has been provided by the server. Returns an opaque value that can be * passed to |stop| to cancel this transaction. */ long startServerLink(CableAuthenticator cableAuthenticator, byte[] serverLinkData); /** * Called when a GCM message is received and the user has tapped on the resulting * notification. fcmEvent contains a serialized event, as created by * |webauthn::authenticator::Registration::Event::Serialize|. */ long startCloudMessage(CableAuthenticator cableAuthenticator, byte[] fcmEvent); /** * Called to alert the C++ code to stop any ongoing transactions. Takes an opaque handle * value that was returned by one of the |start*| functions. */ void stop(long handle); /** * validateServerLinkData returns zero if |serverLink| is a valid argument for * |startServerLink| or else an error value from cablev2::authenticator::Platform::Error. */ int validateServerLinkData(byte[] serverLinkData); /** * validateQRURI returns zero if |qrURI| is a valid fido: URI or else an error value from * cablev2::authenticator::Platform::Error. */ int validateQRURI(String qrURI); /** * onActivityStop is called when onStop() is called on the Activity. This is done * in order to record events because we want to know when users are abandoning * the process. */ void onActivityStop(long handle); /** * Called to alert native code of a response to a makeCredential request. */ void onAuthenticatorAttestationResponse(int ctapStatus, byte[] attestationObject); /** * Called to alert native code of a response to a getAssertion request. */ void onAuthenticatorAssertionResponse( int ctapStatus, byte[] credentialID, byte[] authenticatorData, byte[] signature); } }
92404a36a288a994c2406f1334d84defffef8e4c
1,134
java
Java
radixdlt-core/radixdlt/src/main/java/com/radixdlt/ledger/ByzantineQuorumException.java
stuartbain/radixdlt
88873f525d0a6b070472a48a0ad332a50a20370a
[ "Apache-2.0" ]
33
2020-02-24T12:37:49.000Z
2021-11-13T11:50:40.000Z
radixdlt-core/radixdlt/src/main/java/com/radixdlt/ledger/ByzantineQuorumException.java
stuartbain/radixdlt
88873f525d0a6b070472a48a0ad332a50a20370a
[ "Apache-2.0" ]
247
2020-02-26T16:28:45.000Z
2021-01-06T10:38:50.000Z
radixdlt-core/radixdlt/src/main/java/com/radixdlt/ledger/ByzantineQuorumException.java
stuartbain/radixdlt
88873f525d0a6b070472a48a0ad332a50a20370a
[ "Apache-2.0" ]
14
2020-02-25T17:19:42.000Z
2022-03-07T18:31:03.000Z
31.5
72
0.747795
1,001,464
/* * (C) Copyright 2020 Radix DLT Ltd * * Radix DLT Ltd licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the * License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific * language governing permissions and limitations under the License. */ package com.radixdlt.ledger; /** * Exception which suggests that there exists a byzantine quorum which * got us to this exception state. * * TODO: Remove all instance of this class and replace with mechanism to * log and revert to last known good state. */ public class ByzantineQuorumException extends RuntimeException { public ByzantineQuorumException(String message) { super(message); } public ByzantineQuorumException(String message, Exception cause) { super(message, cause); } }
92404abfac3f8ec7766299d8478f7b82fc7473a2
210
java
Java
patterns/src/main/java/com/gof/factorymethod/vers2/Factory.java
artemGM/design-architectural-patterns
c57ba43df03aa5101f1224d684adc33f8b41a39a
[ "Apache-2.0" ]
null
null
null
patterns/src/main/java/com/gof/factorymethod/vers2/Factory.java
artemGM/design-architectural-patterns
c57ba43df03aa5101f1224d684adc33f8b41a39a
[ "Apache-2.0" ]
null
null
null
patterns/src/main/java/com/gof/factorymethod/vers2/Factory.java
artemGM/design-architectural-patterns
c57ba43df03aa5101f1224d684adc33f8b41a39a
[ "Apache-2.0" ]
null
null
null
19.090909
40
0.719048
1,001,465
package com.gof.factorymethod.vers2; public abstract class Factory { public void renderWindow() { Button okButton = createButton(); okButton.render(); } public abstract Button createButton(); }
92404bc5dde21b3174355d7c36a72e031cebc9dc
1,594
java
Java
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/lossfunctions/serde/RowVectorSerializer.java
basedrhys/deeplearning4j
4f6a9f8f7df569613ee6ea1b56095c55b147227c
[ "Apache-2.0" ]
2,206
2019-06-12T18:57:14.000Z
2022-03-29T08:14:27.000Z
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/lossfunctions/serde/RowVectorSerializer.java
basedrhys/deeplearning4j
4f6a9f8f7df569613ee6ea1b56095c55b147227c
[ "Apache-2.0" ]
1,685
2019-06-12T17:41:33.000Z
2022-03-29T21:45:15.000Z
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/lossfunctions/serde/RowVectorSerializer.java
basedrhys/deeplearning4j
4f6a9f8f7df569613ee6ea1b56095c55b147227c
[ "Apache-2.0" ]
572
2019-06-12T22:13:57.000Z
2022-03-31T16:46:46.000Z
37.952381
109
0.642409
1,001,466
/* * ****************************************************************************** * * * * * * This program and the accompanying materials are made available under the * * terms of the Apache License, Version 2.0 which is available at * * https://www.apache.org/licenses/LICENSE-2.0. * * * * See the NOTICE file distributed with this work for additional * * information regarding copyright ownership. * * 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. * * * * SPDX-License-Identifier: Apache-2.0 * ***************************************************************************** */ package org.nd4j.linalg.lossfunctions.serde; import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.shade.jackson.core.JsonGenerator; import org.nd4j.shade.jackson.databind.JsonSerializer; import org.nd4j.shade.jackson.databind.SerializerProvider; import java.io.IOException; @Deprecated public class RowVectorSerializer extends JsonSerializer<INDArray> { @Override public void serialize(INDArray array, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { if (array.isView()) { array = array.dup(); } double[] dArr = array.data().asDouble(); jsonGenerator.writeObject(dArr); } }
92404c9b5cc2cbf74f9315dc1cefa4eb43ef7d65
26,321
java
Java
code/java/IRNConfiguration/v1/src/main/java/com/factset/sdk/IRNConfiguration/api/CustomSymbolsTypesApi.java
factset/enterprise-sdk
3fd4d1360756c515c9737a0c9a992c7451d7de7e
[ "Apache-2.0" ]
6
2022-02-07T16:34:18.000Z
2022-03-30T08:04:57.000Z
code/java/IRNConfiguration/v1/src/main/java/com/factset/sdk/IRNConfiguration/api/CustomSymbolsTypesApi.java
factset/enterprise-sdk
3fd4d1360756c515c9737a0c9a992c7451d7de7e
[ "Apache-2.0" ]
2
2022-02-07T05:25:57.000Z
2022-03-07T14:18:04.000Z
code/java/IRNConfiguration/v1/src/main/java/com/factset/sdk/IRNConfiguration/api/CustomSymbolsTypesApi.java
factset/enterprise-sdk
3fd4d1360756c515c9737a0c9a992c7451d7de7e
[ "Apache-2.0" ]
null
null
null
43.577815
180
0.691881
1,001,467
package com.factset.sdk.IRNConfiguration.api; import com.factset.sdk.IRNConfiguration.ApiException; import com.factset.sdk.IRNConfiguration.ApiClient; import com.factset.sdk.IRNConfiguration.ApiResponse; import com.factset.sdk.IRNConfiguration.Configuration; import com.factset.sdk.IRNConfiguration.Pair; import javax.ws.rs.core.GenericType; import java.util.HashMap; import java.util.Map; import java.util.Objects; import com.factset.sdk.IRNConfiguration.models.CustomSymbolCustomFieldConfigDto; import com.factset.sdk.IRNConfiguration.models.CustomSymbolTypeDetailDto; import com.factset.sdk.IRNConfiguration.models.CustomSymbolTypeDto; import com.factset.sdk.IRNConfiguration.models.NewItemDto; import com.factset.sdk.IRNConfiguration.models.ProblemDetails; import com.factset.sdk.IRNConfiguration.models.ReorderCustomSymbolTypeDto; import com.factset.sdk.IRNConfiguration.models.SaveCustomSymbolTypeDto; import com.factset.sdk.IRNConfiguration.models.UpdateCustomSymbolTypeDto; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class CustomSymbolsTypesApi { private ApiClient apiClient; public CustomSymbolsTypesApi() { this(Configuration.getDefaultApiClient()); } public CustomSymbolsTypesApi(ApiClient apiClient) { this.apiClient = apiClient; } private static final Map<Integer, GenericType> createCustomSymbolTypeResponseTypeMap = new HashMap<Integer, GenericType>(); static { createCustomSymbolTypeResponseTypeMap.put(201, new GenericType<NewItemDto>(){}); createCustomSymbolTypeResponseTypeMap.put(400, new GenericType<ProblemDetails>(){}); createCustomSymbolTypeResponseTypeMap.put(0, new GenericType<ProblemDetails>(){}); } private static final Map<Integer, GenericType> deleteCustomSymbolTypeAsyncResponseTypeMap = new HashMap<Integer, GenericType>(); private static final Map<Integer, GenericType> getCustomSymbolTypeResponseTypeMap = new HashMap<Integer, GenericType>(); static { getCustomSymbolTypeResponseTypeMap.put(200, new GenericType<CustomSymbolTypeDetailDto>(){}); getCustomSymbolTypeResponseTypeMap.put(404, new GenericType<ProblemDetails>(){}); getCustomSymbolTypeResponseTypeMap.put(0, new GenericType<ProblemDetails>(){}); } private static final Map<Integer, GenericType> getCustomSymbolTypesResponseTypeMap = new HashMap<Integer, GenericType>(); static { getCustomSymbolTypesResponseTypeMap.put(200, new GenericType<java.util.List<CustomSymbolTypeDto>>(){}); } private static final Map<Integer, GenericType> getSymbolCustomFieldsForCustomSymbolTypeResponseTypeMap = new HashMap<Integer, GenericType>(); static { getSymbolCustomFieldsForCustomSymbolTypeResponseTypeMap.put(200, new GenericType<java.util.List<CustomSymbolCustomFieldConfigDto>>(){}); getSymbolCustomFieldsForCustomSymbolTypeResponseTypeMap.put(404, new GenericType<ProblemDetails>(){}); getSymbolCustomFieldsForCustomSymbolTypeResponseTypeMap.put(0, new GenericType<ProblemDetails>(){}); } private static final Map<Integer, GenericType> updateCustomSymbolTypeResponseTypeMap = new HashMap<Integer, GenericType>(); private static final Map<Integer, GenericType> updateCustomSymbolTypeOrderResponseTypeMap = new HashMap<Integer, GenericType>(); /** * Get the API client * * @return API client */ public ApiClient getApiClient() { return apiClient; } /** * Set the API client * * @param apiClient an instance of API client */ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /** * Create a Custom symbol type * * @param saveCustomSymbolTypeDto saveCustomSymbolTypeDto object to save (optional) * @return NewItemDto * @throws ApiException if fails to make API call * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 201 </td><td> Created </td><td> - </td></tr> <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> <tr><td> 0 </td><td> Error </td><td> - </td></tr> </table> */ public NewItemDto createCustomSymbolType(SaveCustomSymbolTypeDto saveCustomSymbolTypeDto) throws ApiException { return createCustomSymbolTypeWithHttpInfo(saveCustomSymbolTypeDto).getData(); } /** * Create a Custom symbol type * * @param saveCustomSymbolTypeDto saveCustomSymbolTypeDto object to save (optional) * @return ApiResponse&lt;NewItemDto&gt; * @throws ApiException if fails to make API call * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 201 </td><td> Created </td><td> - </td></tr> <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> <tr><td> 0 </td><td> Error </td><td> - </td></tr> </table> */ public ApiResponse<NewItemDto> createCustomSymbolTypeWithHttpInfo(SaveCustomSymbolTypeDto saveCustomSymbolTypeDto) throws ApiException { Object localVarPostBody = saveCustomSymbolTypeDto; // create path and map variables String localVarPath = "/v1/custom-symbol-types"; // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, String> localVarCookieParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { "application/json-patch+json", "application/json", "text/json", "application/_*+json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "FactSetApiKey", "FactSetOAuth2", "FactSetOAuth2Client" }; ApiResponse< NewItemDto > apiResponse = apiClient.invokeAPI("CustomSymbolsTypesApi.createCustomSymbolType", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, createCustomSymbolTypeResponseTypeMap, false); return apiResponse; } /** * Delete a Custom symbol type * * @param customSymbolTypeId customSymbolTypeId to delete associated record (required) * @throws ApiException if fails to make API call * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Success </td><td> - </td></tr> <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> <tr><td> 404 </td><td> Not Found </td><td> - </td></tr> <tr><td> 0 </td><td> Error </td><td> - </td></tr> </table> */ public void deleteCustomSymbolTypeAsync(java.util.UUID customSymbolTypeId) throws ApiException { deleteCustomSymbolTypeAsyncWithHttpInfo(customSymbolTypeId); } /** * Delete a Custom symbol type * * @param customSymbolTypeId customSymbolTypeId to delete associated record (required) * @return ApiResponse&lt;Void&gt; * @throws ApiException if fails to make API call * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Success </td><td> - </td></tr> <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> <tr><td> 404 </td><td> Not Found </td><td> - </td></tr> <tr><td> 0 </td><td> Error </td><td> - </td></tr> </table> */ public ApiResponse<Void> deleteCustomSymbolTypeAsyncWithHttpInfo(java.util.UUID customSymbolTypeId) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'customSymbolTypeId' is set if (customSymbolTypeId == null) { throw new ApiException(400, "Missing the required parameter 'customSymbolTypeId' when calling deleteCustomSymbolTypeAsync"); } // create path and map variables String localVarPath = "/v1/custom-symbol-types/{customSymbolTypeId}" .replaceAll("\\{" + "customSymbolTypeId" + "\\}", apiClient.escapeString(customSymbolTypeId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, String> localVarCookieParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "FactSetApiKey", "FactSetOAuth2", "FactSetOAuth2Client" }; ApiResponse< Void > apiResponse = apiClient.invokeAPI("CustomSymbolsTypesApi.deleteCustomSymbolTypeAsync", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, deleteCustomSymbolTypeAsyncResponseTypeMap, false); return apiResponse; } /** * Get a specific Custom symbol type&#39;s details * * @param customSymbolTypeId customSymbolTypeId to get associated record (required) * @return CustomSymbolTypeDetailDto * @throws ApiException if fails to make API call * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Success </td><td> - </td></tr> <tr><td> 404 </td><td> Not Found </td><td> - </td></tr> <tr><td> 0 </td><td> Error </td><td> - </td></tr> </table> */ public CustomSymbolTypeDetailDto getCustomSymbolType(java.util.UUID customSymbolTypeId) throws ApiException { return getCustomSymbolTypeWithHttpInfo(customSymbolTypeId).getData(); } /** * Get a specific Custom symbol type&#39;s details * * @param customSymbolTypeId customSymbolTypeId to get associated record (required) * @return ApiResponse&lt;CustomSymbolTypeDetailDto&gt; * @throws ApiException if fails to make API call * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Success </td><td> - </td></tr> <tr><td> 404 </td><td> Not Found </td><td> - </td></tr> <tr><td> 0 </td><td> Error </td><td> - </td></tr> </table> */ public ApiResponse<CustomSymbolTypeDetailDto> getCustomSymbolTypeWithHttpInfo(java.util.UUID customSymbolTypeId) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'customSymbolTypeId' is set if (customSymbolTypeId == null) { throw new ApiException(400, "Missing the required parameter 'customSymbolTypeId' when calling getCustomSymbolType"); } // create path and map variables String localVarPath = "/v1/custom-symbol-types/{customSymbolTypeId}" .replaceAll("\\{" + "customSymbolTypeId" + "\\}", apiClient.escapeString(customSymbolTypeId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, String> localVarCookieParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "FactSetApiKey", "FactSetOAuth2", "FactSetOAuth2Client" }; ApiResponse< CustomSymbolTypeDetailDto > apiResponse = apiClient.invokeAPI("CustomSymbolsTypesApi.getCustomSymbolType", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, getCustomSymbolTypeResponseTypeMap, false); return apiResponse; } /** * Get all the custom symbol types * * @return java.util.List<CustomSymbolTypeDto> * @throws ApiException if fails to make API call * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Success </td><td> - </td></tr> </table> */ public java.util.List<CustomSymbolTypeDto> getCustomSymbolTypes() throws ApiException { return getCustomSymbolTypesWithHttpInfo().getData(); } /** * Get all the custom symbol types * * @return ApiResponse&lt;java.util.List<CustomSymbolTypeDto>&gt; * @throws ApiException if fails to make API call * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Success </td><td> - </td></tr> </table> */ public ApiResponse<java.util.List<CustomSymbolTypeDto>> getCustomSymbolTypesWithHttpInfo() throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/v1/custom-symbol-types"; // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, String> localVarCookieParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "FactSetApiKey", "FactSetOAuth2", "FactSetOAuth2Client" }; ApiResponse< java.util.List<CustomSymbolTypeDto> > apiResponse = apiClient.invokeAPI("CustomSymbolsTypesApi.getCustomSymbolTypes", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, getCustomSymbolTypesResponseTypeMap, false); return apiResponse; } /** * Get Custom fields for Custom Symbol type * * @param customSymbolTypeId customSymbolTypeId to get associated Custom fileds (required) * @return java.util.List<CustomSymbolCustomFieldConfigDto> * @throws ApiException if fails to make API call * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Success </td><td> - </td></tr> <tr><td> 404 </td><td> Not Found </td><td> - </td></tr> <tr><td> 0 </td><td> Error </td><td> - </td></tr> </table> */ public java.util.List<CustomSymbolCustomFieldConfigDto> getSymbolCustomFieldsForCustomSymbolType(java.util.UUID customSymbolTypeId) throws ApiException { return getSymbolCustomFieldsForCustomSymbolTypeWithHttpInfo(customSymbolTypeId).getData(); } /** * Get Custom fields for Custom Symbol type * * @param customSymbolTypeId customSymbolTypeId to get associated Custom fileds (required) * @return ApiResponse&lt;java.util.List<CustomSymbolCustomFieldConfigDto>&gt; * @throws ApiException if fails to make API call * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Success </td><td> - </td></tr> <tr><td> 404 </td><td> Not Found </td><td> - </td></tr> <tr><td> 0 </td><td> Error </td><td> - </td></tr> </table> */ public ApiResponse<java.util.List<CustomSymbolCustomFieldConfigDto>> getSymbolCustomFieldsForCustomSymbolTypeWithHttpInfo(java.util.UUID customSymbolTypeId) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'customSymbolTypeId' is set if (customSymbolTypeId == null) { throw new ApiException(400, "Missing the required parameter 'customSymbolTypeId' when calling getSymbolCustomFieldsForCustomSymbolType"); } // create path and map variables String localVarPath = "/v1/custom-symbol-types/{customSymbolTypeId}/custom-fields" .replaceAll("\\{" + "customSymbolTypeId" + "\\}", apiClient.escapeString(customSymbolTypeId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, String> localVarCookieParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "FactSetApiKey", "FactSetOAuth2", "FactSetOAuth2Client" }; ApiResponse< java.util.List<CustomSymbolCustomFieldConfigDto> > apiResponse = apiClient.invokeAPI("CustomSymbolsTypesApi.getSymbolCustomFieldsForCustomSymbolType", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, getSymbolCustomFieldsForCustomSymbolTypeResponseTypeMap, false); return apiResponse; } /** * Edit a Custom symbol type * * @param customSymbolTypeId customSymbolTypeId to update associated record (required) * @param updateCustomSymbolTypeDto updateCustomSymbolTypeDto object to update (optional) * @throws ApiException if fails to make API call * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> No Content </td><td> - </td></tr> <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> <tr><td> 404 </td><td> Not Found </td><td> - </td></tr> <tr><td> 0 </td><td> Error </td><td> - </td></tr> </table> */ public void updateCustomSymbolType(java.util.UUID customSymbolTypeId, UpdateCustomSymbolTypeDto updateCustomSymbolTypeDto) throws ApiException { updateCustomSymbolTypeWithHttpInfo(customSymbolTypeId, updateCustomSymbolTypeDto); } /** * Edit a Custom symbol type * * @param customSymbolTypeId customSymbolTypeId to update associated record (required) * @param updateCustomSymbolTypeDto updateCustomSymbolTypeDto object to update (optional) * @return ApiResponse&lt;Void&gt; * @throws ApiException if fails to make API call * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> No Content </td><td> - </td></tr> <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> <tr><td> 404 </td><td> Not Found </td><td> - </td></tr> <tr><td> 0 </td><td> Error </td><td> - </td></tr> </table> */ public ApiResponse<Void> updateCustomSymbolTypeWithHttpInfo(java.util.UUID customSymbolTypeId, UpdateCustomSymbolTypeDto updateCustomSymbolTypeDto) throws ApiException { Object localVarPostBody = updateCustomSymbolTypeDto; // verify the required parameter 'customSymbolTypeId' is set if (customSymbolTypeId == null) { throw new ApiException(400, "Missing the required parameter 'customSymbolTypeId' when calling updateCustomSymbolType"); } // create path and map variables String localVarPath = "/v1/custom-symbol-types/{customSymbolTypeId}" .replaceAll("\\{" + "customSymbolTypeId" + "\\}", apiClient.escapeString(customSymbolTypeId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, String> localVarCookieParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { "application/json-patch+json", "application/json", "text/json", "application/_*+json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "FactSetApiKey", "FactSetOAuth2", "FactSetOAuth2Client" }; ApiResponse< Void > apiResponse = apiClient.invokeAPI("CustomSymbolsTypesApi.updateCustomSymbolType", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, updateCustomSymbolTypeResponseTypeMap, false); return apiResponse; } /** * * * @param reorderCustomSymbolTypeDto (optional) * @throws ApiException if fails to make API call * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> No Content </td><td> - </td></tr> <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> <tr><td> 404 </td><td> Not Found </td><td> - </td></tr> <tr><td> 0 </td><td> Error </td><td> - </td></tr> </table> */ public void updateCustomSymbolTypeOrder(ReorderCustomSymbolTypeDto reorderCustomSymbolTypeDto) throws ApiException { updateCustomSymbolTypeOrderWithHttpInfo(reorderCustomSymbolTypeDto); } /** * * * @param reorderCustomSymbolTypeDto (optional) * @return ApiResponse&lt;Void&gt; * @throws ApiException if fails to make API call * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> No Content </td><td> - </td></tr> <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> <tr><td> 404 </td><td> Not Found </td><td> - </td></tr> <tr><td> 0 </td><td> Error </td><td> - </td></tr> </table> */ public ApiResponse<Void> updateCustomSymbolTypeOrderWithHttpInfo(ReorderCustomSymbolTypeDto reorderCustomSymbolTypeDto) throws ApiException { Object localVarPostBody = reorderCustomSymbolTypeDto; // create path and map variables String localVarPath = "/v1/custom-symbol-types/reorder"; // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, String> localVarCookieParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { "application/json-patch+json", "application/json", "text/json", "application/_*+json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "FactSetApiKey", "FactSetOAuth2", "FactSetOAuth2Client" }; ApiResponse< Void > apiResponse = apiClient.invokeAPI("CustomSymbolsTypesApi.updateCustomSymbolTypeOrder", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, updateCustomSymbolTypeOrderResponseTypeMap, false); return apiResponse; } }
92404e072691e17a75480b9a32d18ce471097dc9
215
java
Java
src/main/java/com/mixer/interactive/resources/package-info.java
kjan0203a/interactive-java
bb3e88c285e462c13a67c15cbd653ad39a1f0a8e
[ "MIT" ]
null
null
null
src/main/java/com/mixer/interactive/resources/package-info.java
kjan0203a/interactive-java
bb3e88c285e462c13a67c15cbd653ad39a1f0a8e
[ "MIT" ]
null
null
null
src/main/java/com/mixer/interactive/resources/package-info.java
kjan0203a/interactive-java
bb3e88c285e462c13a67c15cbd653ad39a1f0a8e
[ "MIT" ]
null
null
null
26.875
100
0.711628
1,001,468
/** * Provides interfaces and classes relating to the Interactive service's different resource objects. * * @author Microsoft Corporation * * @since 1.0.0 */ package com.mixer.interactive.resources;
92404e8fd7088ae24094d4dcb4ba09fdae70bf82
1,005
java
Java
2017.AndroidApplicationDevelopment/MyWeather/app/src/main/java/chenwt/pku/edu/cn/util/NetUtil.java
primetong/LearningCollectionOfWitt
a15dc8ac80618a3995c2b930c634b87ed8f1f0af
[ "MIT" ]
null
null
null
2017.AndroidApplicationDevelopment/MyWeather/app/src/main/java/chenwt/pku/edu/cn/util/NetUtil.java
primetong/LearningCollectionOfWitt
a15dc8ac80618a3995c2b930c634b87ed8f1f0af
[ "MIT" ]
14
2020-06-30T20:52:56.000Z
2022-03-02T14:53:18.000Z
2017.AndroidApplicationDevelopment/MyWeather/app/src/main/java/chenwt/pku/edu/cn/util/NetUtil.java
primetong/LearningCollectionOfWitt
a15dc8ac80618a3995c2b930c634b87ed8f1f0af
[ "MIT" ]
null
null
null
29.558824
71
0.673632
1,001,469
package chenwt.pku.edu.cn.util; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; /** * Created by Witt on 2017/10/11. */ public class NetUtil { //该类判断网络是否可用,并且可以判断是在移动网络下还是WiFi网络下 public static final int NETWORK_NONE = 0; public static final int NETWORK_WIFI = 1; public static final int NETWORK_MOBILE = 2; public static int getNetworkState(Context context) { ConnectivityManager connManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connManager.getActiveNetworkInfo(); if (networkInfo == null) { return NETWORK_NONE; } int nType = networkInfo.getType(); if (nType == ConnectivityManager.TYPE_MOBILE) { return NETWORK_MOBILE; } else if (nType == ConnectivityManager.TYPE_WIFI) { return NETWORK_WIFI; } return NETWORK_NONE; } }
92404ec35228a808dae36ef8f54b73fa9c33106e
1,656
java
Java
Client/src/models/gui/CardAdminView.java
aps2019project/Ababeel
c1583dd3234b4fb29f60e57eac6057fb93fe98e2
[ "MIT" ]
14
2019-07-10T08:28:26.000Z
2021-12-28T15:57:04.000Z
Client/src/models/gui/CardAdminView.java
aps2019project/Ababeel
c1583dd3234b4fb29f60e57eac6057fb93fe98e2
[ "MIT" ]
null
null
null
Client/src/models/gui/CardAdminView.java
aps2019project/Ababeel
c1583dd3234b4fb29f60e57eac6057fb93fe98e2
[ "MIT" ]
3
2020-01-30T14:14:31.000Z
2021-02-08T16:43:02.000Z
28.067797
99
0.682971
1,001,470
package models.gui; import controller.ShopAdminController; import javafx.application.Platform; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import models.card.Card; import models.card.CardType; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import static javafx.scene.input.KeyCode.ENTER; public class CardAdminView implements PropertyChangeListener { private String cardName; private CardType cardType; private ObjectProperty<Integer> remainingNumber; private NumberField numberField; CardAdminView(Card card) { cardName = card.getName(); cardType = card.getType(); remainingNumber = new SimpleObjectProperty<>(card.getRemainingNumber()); numberField = new NumberField(""); card.addListener(this); numberField.setOnKeyPressed(event -> { if (event.getCode() == ENTER) { ShopAdminController.getInstance().changeValueRequest(card, numberField.getValue()); numberField.clear(); } }); } public String getCardName() { return cardName; } public CardType getCardType() { return cardType; } ObjectProperty<Integer> remainingNumberProperty() { return remainingNumber; } @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("new_value")) { Platform.runLater(() -> remainingNumber.setValue((Integer) evt.getNewValue())); } } public NumberField getNumberField() { return numberField; } }
92404f108ac55aa38ced892c4b63cc094e1116e8
728
java
Java
src/main/java/com/slackow/endfight/mixin/HungerManagerMixin.java
Slackow/EndFightMod---Fabric
46183bd8c8229315f05348d63d73acd3da920b31
[ "CC0-1.0" ]
null
null
null
src/main/java/com/slackow/endfight/mixin/HungerManagerMixin.java
Slackow/EndFightMod---Fabric
46183bd8c8229315f05348d63d73acd3da920b31
[ "CC0-1.0" ]
4
2022-01-19T02:35:40.000Z
2022-03-10T18:00:42.000Z
src/main/java/com/slackow/endfight/mixin/HungerManagerMixin.java
Slackow/EndFightMod---Fabric
46183bd8c8229315f05348d63d73acd3da920b31
[ "CC0-1.0" ]
1
2022-03-10T06:09:30.000Z
2022-03-10T06:09:30.000Z
34.666667
68
0.762363
1,001,471
package com.slackow.endfight.mixin; import com.slackow.endfight.EndFightMod; import com.slackow.endfight.config.BigConfig; import net.minecraft.entity.player.HungerManager; import net.minecraft.entity.player.PlayerEntity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(HungerManager.class) public class HungerManagerMixin { @Inject(method = "update", at = @At("HEAD"), cancellable = true) private void update(PlayerEntity par1, CallbackInfo ci) { if (BigConfig.getSelectedConfig().dGodPlayer) { ci.cancel(); } } }