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
9237274bd86f829728f439cfca5cdb41a361d675
640
java
Java
src/io/github/tobiasbriones/ep/factura/domain/model/basket/BasketItemAccessor.java
TobiasBriones/example.programming.java.factura
bdd6f64942ddd6a20e61114a98fb75e5c6ab7ec6
[ "MIT" ]
null
null
null
src/io/github/tobiasbriones/ep/factura/domain/model/basket/BasketItemAccessor.java
TobiasBriones/example.programming.java.factura
bdd6f64942ddd6a20e61114a98fb75e5c6ab7ec6
[ "MIT" ]
null
null
null
src/io/github/tobiasbriones/ep/factura/domain/model/basket/BasketItemAccessor.java
TobiasBriones/example.programming.java.factura
bdd6f64942ddd6a20e61114a98fb75e5c6ab7ec6
[ "MIT" ]
null
null
null
21.333333
76
0.726563
997,957
/* * Copyright (c) 2020 Tobias Briones. All rights reserved. * * SPDX-License-Identifier: MIT * * This file is part of Example Project: Factura. * * This source code is licensed under the MIT License found in the * LICENSE file in the root directory of this source tree or at * https://opensource.org/licenses/MIT. */ package io.github.tobiasbriones.ep.factura.domain.model.basket; import io.github.tobiasbriones.ep.factura.domain.model.product.ProductModel; public interface BasketItemAccessor { ProductModel getProduct(); int getQuantity(); double getAmount(); double getIsv(); double getTotal(); }
92372765bda0871c695983ad103cd1b2a6e3c09f
1,474
java
Java
policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java
onap/policy-drools-pdp
cdcdc706a15a43611787b97201679846b080fa5d
[ "Apache-2.0" ]
5
2018-11-21T19:19:57.000Z
2021-10-15T15:04:25.000Z
policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java
onap/policy-drools-pdp
cdcdc706a15a43611787b97201679846b080fa5d
[ "Apache-2.0" ]
null
null
null
policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java
onap/policy-drools-pdp
cdcdc706a15a43611787b97201679846b080fa5d
[ "Apache-2.0" ]
null
null
null
35.095238
83
0.654681
997,958
/* * ============LICENSE_START======================================================= * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * 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. * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.drools.domain.models.controller; import java.io.Serializable; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.SuperBuilder; import org.onap.policy.drools.domain.models.DroolsPolicy; /** * Controller Policy model root object. */ @Data @SuperBuilder @EqualsAndHashCode(callSuper = true) public class ControllerPolicy extends DroolsPolicy implements Serializable { private static final long serialVersionUID = -8171337852833516581L; private ControllerProperties properties; }
9237279bc4f30e2cd1ebaaa8214c832741aebd9f
1,625
java
Java
org.openntf.base.jaxb.dxl/src/org/openntf/base/jaxb/dxl/VerticalAligns.java
guedeWebGate/org.openntf.base
8284fb0a4ac2e7fe59f5f46b039b477fe92a6e7c
[ "Apache-2.0" ]
null
null
null
org.openntf.base.jaxb.dxl/src/org/openntf/base/jaxb/dxl/VerticalAligns.java
guedeWebGate/org.openntf.base
8284fb0a4ac2e7fe59f5f46b039b477fe92a6e7c
[ "Apache-2.0" ]
null
null
null
org.openntf.base.jaxb.dxl/src/org/openntf/base/jaxb/dxl/VerticalAligns.java
guedeWebGate/org.openntf.base
8284fb0a4ac2e7fe59f5f46b039b477fe92a6e7c
[ "Apache-2.0" ]
null
null
null
26.209677
124
0.646154
997,959
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2014.12.23 at 02:06:11 PM CET // package org.openntf.base.jaxb.dxl; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for vertical.aligns. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="vertical.aligns"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="top"/> * &lt;enumeration value="center"/> * &lt;enumeration value="bottom"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "vertical.aligns", namespace = "http://www.lotus.com/dxl") @XmlEnum public enum VerticalAligns { @XmlEnumValue("top") TOP("top"), @XmlEnumValue("center") CENTER("center"), @XmlEnumValue("bottom") BOTTOM("bottom"); private final String value; VerticalAligns(String v) { value = v; } public String value() { return value; } public static VerticalAligns fromValue(String v) { for (VerticalAligns c: VerticalAligns.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
92372826c8ca64ca2410fb28022ed167985d4a06
999
java
Java
spring/IoC/Beans/practicas/PlantillaAnotacionesPosibleSolucion/src/main/java/config/Configuracion.java
khepherer/java_lleida_01_06_2017
d92d9bb758aefd6e1e8906777b60e44bc91cd000
[ "Apache-2.0" ]
null
null
null
spring/IoC/Beans/practicas/PlantillaAnotacionesPosibleSolucion/src/main/java/config/Configuracion.java
khepherer/java_lleida_01_06_2017
d92d9bb758aefd6e1e8906777b60e44bc91cd000
[ "Apache-2.0" ]
null
null
null
spring/IoC/Beans/practicas/PlantillaAnotacionesPosibleSolucion/src/main/java/config/Configuracion.java
khepherer/java_lleida_01_06_2017
d92d9bb758aefd6e1e8906777b60e44bc91cd000
[ "Apache-2.0" ]
null
null
null
18.849057
79
0.643644
997,960
/* * 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 config; import beans.Aficion; import beans.Perfil; import beans.Persona; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; /** * * @author iconotc */ @Configuration public class Configuracion { @Bean public Persona uno() { return new Persona(); } @Bean public Aficion dos() { return new Aficion(); } @Bean public Aficion dos_1() { return new Aficion(); } @Bean public Aficion dos_2() { return new Aficion(); } @Bean public Perfil tres() { return new Perfil(); } @Bean @Scope("prototype") public String cuatro() { return "Nombre " + System.nanoTime(); } }
923728672e4e4aa82fc369b3aaf3005612ccbad0
267
java
Java
catalog-fe/src/main/java/org/openecomp/sdc/fe/utils/BeProtocol.java
infosiftr/sdc
a1f23ec5e7cd191b76271b5f33c237bad38c61c6
[ "Apache-2.0" ]
null
null
null
catalog-fe/src/main/java/org/openecomp/sdc/fe/utils/BeProtocol.java
infosiftr/sdc
a1f23ec5e7cd191b76271b5f33c237bad38c61c6
[ "Apache-2.0" ]
null
null
null
catalog-fe/src/main/java/org/openecomp/sdc/fe/utils/BeProtocol.java
infosiftr/sdc
a1f23ec5e7cd191b76271b5f33c237bad38c61c6
[ "Apache-2.0" ]
null
null
null
19.071429
36
0.707865
997,961
package org.openecomp.sdc.fe.utils; public enum BeProtocol { HTTP("http"), SSL("ssl"); private String protocolName; public String getProtocolName() { return protocolName; } BeProtocol(String protocolName) { this.protocolName = protocolName; } };
9237296ebe498c58b2d30f963ad8b7e7a790ad99
5,512
java
Java
rxjava2/src/test/java/io/nlopez/smartlocation/ObservablesTest.java
jokercom/smart-location-lib
9a6832cbffcc8d64fad55daed6912bfe6062ad57
[ "Unlicense", "MIT" ]
1
2021-11-03T05:53:05.000Z
2021-11-03T05:53:05.000Z
rxjava2/src/test/java/io/nlopez/smartlocation/ObservablesTest.java
jokercom/smart-location-lib
9a6832cbffcc8d64fad55daed6912bfe6062ad57
[ "Unlicense", "MIT" ]
null
null
null
rxjava2/src/test/java/io/nlopez/smartlocation/ObservablesTest.java
jokercom/smart-location-lib
9a6832cbffcc8d64fad55daed6912bfe6062ad57
[ "Unlicense", "MIT" ]
null
null
null
49.214286
126
0.781023
997,962
package io.nlopez.smartlocation; import android.location.Location; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; import org.robolectric.RobolectricTestRunner; import java.util.List; import io.nlopez.smartlocation.geocoding.GeocodingUpdatedListener; import io.nlopez.smartlocation.geocoding.ReverseGeocodingUpdatedListener; import io.nlopez.smartlocation.geocoding.common.LocationAddress; import io.nlopez.smartlocation.location.LocationUpdatedListener; import io.reactivex.Observable; import io.reactivex.Single; import io.reactivex.observers.TestObserver; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; /** * Tests {@link Observables} */ @RunWith(RobolectricTestRunner.class) public class ObservablesTest { @Rule public MockitoRule mMockitoRule = MockitoJUnit.rule(); @Mock private SmartLocation.LocationBuilder mLocationBuilder; @Mock private SmartLocation.GeocodingBuilder mGeocodingBuilder; @Mock private Location mLocation; @Mock private List<LocationAddress> mLocationAddresses; @Captor private ArgumentCaptor<LocationUpdatedListener> mLocationUpdatedListenerArgumentCaptor; @Captor private ArgumentCaptor<GeocodingUpdatedListener> mGeocodingUpdatedListenerArgumentCaptor; @Captor private ArgumentCaptor<ReverseGeocodingUpdatedListener> mReverseGeocodingUpdatedListenerArgumentCaptor; @Test public void testLocationObservableSendsValuesOnTheStream() { final Observable<Location> observable = Observables.from(mLocationBuilder); final TestObserver<Location> observer = observable.test(); verify(mLocationBuilder).start(mLocationUpdatedListenerArgumentCaptor.capture()); final LocationUpdatedListener listener = mLocationUpdatedListenerArgumentCaptor.getValue(); listener.onLocationUpdated(mLocation); observer.assertValue(mLocation); } @Test public void testLocationObservableSendsErrorsOnTheStream() { final Observable<Location> observable = Observables.from(mLocationBuilder); final TestObserver<Location> observer = observable.test(); verify(mLocationBuilder).start(mLocationUpdatedListenerArgumentCaptor.capture()); final LocationUpdatedListener listener = mLocationUpdatedListenerArgumentCaptor.getValue(); listener.onAllProvidersFailed(); observer.assertErrorMessage("All providers failed"); verify(mLocationBuilder).stop(); } @Test public void testLocationObservableStopsLocationWhenUnsubscribing() { final Observable<Location> observable = Observables.from(mLocationBuilder); final TestObserver<Location> observer = observable.test(); observer.dispose(); verify(mLocationBuilder).stop(); } @Test public void testGeocodingObservableReturnsAddressOnSuccess() { final Single<List<LocationAddress>> observable = Observables.fromAddress(mGeocodingBuilder, "address"); final TestObserver<List<LocationAddress>> observer = observable.test(); verify(mGeocodingBuilder).findLocationByName(eq("address"), mGeocodingUpdatedListenerArgumentCaptor.capture()); final GeocodingUpdatedListener listener = mGeocodingUpdatedListenerArgumentCaptor.getValue(); listener.onLocationResolved("address", mLocationAddresses); observer.assertValue(mLocationAddresses); observer.assertComplete(); } @Test public void testGeocodingObservableReturnsErrorWhenFailed() { final Single<List<LocationAddress>> observable = Observables.fromAddress(mGeocodingBuilder, "address"); final TestObserver<List<LocationAddress>> observer = observable.test(); verify(mGeocodingBuilder).findLocationByName(eq("address"), mGeocodingUpdatedListenerArgumentCaptor.capture()); final GeocodingUpdatedListener listener = mGeocodingUpdatedListenerArgumentCaptor.getValue(); listener.onAllProvidersFailed(); observer.assertErrorMessage("All providers failed"); } @Test public void testReverseGeocodingObservableReturnsNameOnSuccess() { final Single<List<LocationAddress>> observable = Observables.fromLocation(mGeocodingBuilder, mLocation); final TestObserver<List<LocationAddress>> observer = observable.test(); verify(mGeocodingBuilder).findNameByLocation(eq(mLocation), mReverseGeocodingUpdatedListenerArgumentCaptor.capture()); final ReverseGeocodingUpdatedListener listener = mReverseGeocodingUpdatedListenerArgumentCaptor.getValue(); listener.onAddressResolved(mLocation, mLocationAddresses); observer.assertValue(mLocationAddresses); observer.assertComplete(); } @Test public void testReverseGeocodingObservableReturnsErrorWhenFailed() { final Single<List<LocationAddress>> observable = Observables.fromLocation(mGeocodingBuilder, mLocation); final TestObserver<List<LocationAddress>> observer = observable.test(); verify(mGeocodingBuilder).findNameByLocation(eq(mLocation), mReverseGeocodingUpdatedListenerArgumentCaptor.capture()); final ReverseGeocodingUpdatedListener listener = mReverseGeocodingUpdatedListenerArgumentCaptor.getValue(); listener.onAllProvidersFailed(); observer.assertErrorMessage("All providers failed"); } }
9237297e0b261ef712132842cfdd9922872446af
344
java
Java
PGF/app/src/androidTest/java/net/bagot/pgf/ApplicationTest.java
kazouh/pgf
b98a3a92dc1b675c54cf0a92bb1b4011fbf85606
[ "Apache-2.0" ]
null
null
null
PGF/app/src/androidTest/java/net/bagot/pgf/ApplicationTest.java
kazouh/pgf
b98a3a92dc1b675c54cf0a92bb1b4011fbf85606
[ "Apache-2.0" ]
null
null
null
PGF/app/src/androidTest/java/net/bagot/pgf/ApplicationTest.java
kazouh/pgf
b98a3a92dc1b675c54cf0a92bb1b4011fbf85606
[ "Apache-2.0" ]
null
null
null
26.461538
93
0.747093
997,963
package net.bagot.pgf; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
923729e01248e0bd31ce8158d75faf8f2611462c
4,336
java
Java
app/src/main/java/wrightstuff/wowscrubber/model/user/MainHand.java
Sloox/WowScrubber
3534d490ac9c5bc8c7d5d5241f34691f47a23aa3
[ "Apache-2.0" ]
null
null
null
app/src/main/java/wrightstuff/wowscrubber/model/user/MainHand.java
Sloox/WowScrubber
3534d490ac9c5bc8c7d5d5241f34691f47a23aa3
[ "Apache-2.0" ]
null
null
null
app/src/main/java/wrightstuff/wowscrubber/model/user/MainHand.java
Sloox/WowScrubber
3534d490ac9c5bc8c7d5d5241f34691f47a23aa3
[ "Apache-2.0" ]
null
null
null
21.788945
71
0.645987
997,964
package wrightstuff.wowscrubber.model.user; import java.util.List; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class MainHand { @SerializedName("id") @Expose private Integer id; @SerializedName("name") @Expose private String name; @SerializedName("icon") @Expose private String icon; @SerializedName("quality") @Expose private Integer quality; @SerializedName("itemLevel") @Expose private Integer itemLevel; @SerializedName("tooltipParams") @Expose private TooltipParams tooltipParams; @SerializedName("stats") @Expose private List<Stat> stats = null; @SerializedName("armor") @Expose private Integer armor; @SerializedName("weaponInfo") @Expose private WeaponInfo weaponInfo; @SerializedName("context") @Expose private String context; @SerializedName("bonusLists") @Expose private List<Integer> bonusLists = null; @SerializedName("artifactId") @Expose private Integer artifactId; @SerializedName("displayInfoId") @Expose private Integer displayInfoId; @SerializedName("artifactAppearanceId") @Expose private Integer artifactAppearanceId; @SerializedName("artifactTraits") @Expose private List<ArtifactTrait> artifactTraits = null; @SerializedName("relics") @Expose private List<Relic> relics = null; @SerializedName("appearance") @Expose private Appearance appearance; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public Integer getQuality() { return quality; } public void setQuality(Integer quality) { this.quality = quality; } public Integer getItemLevel() { return itemLevel; } public void setItemLevel(Integer itemLevel) { this.itemLevel = itemLevel; } public TooltipParams getTooltipParams() { return tooltipParams; } public void setTooltipParams(TooltipParams tooltipParams) { this.tooltipParams = tooltipParams; } public List<Stat> getStats() { return stats; } public void setStats(List<Stat> stats) { this.stats = stats; } public Integer getArmor() { return armor; } public void setArmor(Integer armor) { this.armor = armor; } public WeaponInfo getWeaponInfo() { return weaponInfo; } public void setWeaponInfo(WeaponInfo weaponInfo) { this.weaponInfo = weaponInfo; } public String getContext() { return context; } public void setContext(String context) { this.context = context; } public List<Integer> getBonusLists() { return bonusLists; } public void setBonusLists(List<Integer> bonusLists) { this.bonusLists = bonusLists; } public Integer getArtifactId() { return artifactId; } public void setArtifactId(Integer artifactId) { this.artifactId = artifactId; } public Integer getDisplayInfoId() { return displayInfoId; } public void setDisplayInfoId(Integer displayInfoId) { this.displayInfoId = displayInfoId; } public Integer getArtifactAppearanceId() { return artifactAppearanceId; } public void setArtifactAppearanceId(Integer artifactAppearanceId) { this.artifactAppearanceId = artifactAppearanceId; } public List<ArtifactTrait> getArtifactTraits() { return artifactTraits; } public void setArtifactTraits(List<ArtifactTrait> artifactTraits) { this.artifactTraits = artifactTraits; } public List<Relic> getRelics() { return relics; } public void setRelics(List<Relic> relics) { this.relics = relics; } public Appearance getAppearance() { return appearance; } public void setAppearance(Appearance appearance) { this.appearance = appearance; } }
92372b00bf7e4dccc92a3ca0492dec24be82a3d6
281
java
Java
tck/src/main/resources/tests/actual/PropertyTest.java
matthewweis/fxproperty
4e6fe3955e3932a60af99d70dc0fbe9f300ae58d
[ "Apache-2.0" ]
null
null
null
tck/src/main/resources/tests/actual/PropertyTest.java
matthewweis/fxproperty
4e6fe3955e3932a60af99d70dc0fbe9f300ae58d
[ "Apache-2.0" ]
null
null
null
tck/src/main/resources/tests/actual/PropertyTest.java
matthewweis/fxproperty
4e6fe3955e3932a60af99d70dc0fbe9f300ae58d
[ "Apache-2.0" ]
null
null
null
28.1
77
0.793594
997,965
package org.fxproperty.tck; import org.fxproperty.api.FxProperty; import javafx.beans.property.Property; import javafx.beans.property.SimpleObjectProperty; public class PropertyTest { @FxProperty Property<Object> field = new SimpleObjectProperty<Object>(this, "field"); }
92372c2edbc6ddcf38bff3c149c9f47e422874ce
833
java
Java
builder/src/test/java/com/godmonth/status2/builder/advancer/PayAdvancer.java
godmonth/godmonth-status2
0e5664f16ff3268f8bb55a8e458e59980a5e7835
[ "Apache-2.0" ]
1
2021-01-18T08:04:38.000Z
2021-01-18T08:04:38.000Z
builder/src/test/java/com/godmonth/status2/builder/advancer/PayAdvancer.java
godmonth/godmonth-status2
0e5664f16ff3268f8bb55a8e458e59980a5e7835
[ "Apache-2.0" ]
null
null
null
builder/src/test/java/com/godmonth/status2/builder/advancer/PayAdvancer.java
godmonth/godmonth-status2
0e5664f16ff3268f8bb55a8e458e59980a5e7835
[ "Apache-2.0" ]
null
null
null
32.038462
73
0.801921
997,966
package com.godmonth.status2.builder.advancer; import com.godmonth.status2.advancer.intf.AdvanceRequest; import com.godmonth.status2.advancer.intf.AdvancedResult; import com.godmonth.status2.advancer.intf.StatusAdvancer; import com.godmonth.status2.annotations.Advancer; import com.godmonth.status2.annotations.binding.ModelBinding; import com.godmonth.status2.annotations.binding.StatusBinding; import com.godmonth.status2.builder.domain.SampleModel; import com.godmonth.status2.builder.domain.SampleStatus; /** * <p></p > * * @author shenyue */ @Advancer @ModelBinding(SampleModel.class) @StatusBinding(statusClass = SampleStatus.class, statusValue = "CREATED") public class PayAdvancer implements StatusAdvancer { @Override public AdvancedResult advance(AdvanceRequest advanceRequest) { return null; } }
92372fb004e5140306fab5ac07fd4e0d98b5f0c9
444
java
Java
src/all_problems/P877_StoneGame.java
YC-S/LeetCode
452bb10e45de53217bca52f8c81b3034316ffc1b
[ "MIT" ]
1
2020-01-31T07:29:55.000Z
2020-01-31T07:29:55.000Z
src/all_problems/P877_StoneGame.java
YC-S/LeetCode
452bb10e45de53217bca52f8c81b3034316ffc1b
[ "MIT" ]
null
null
null
src/all_problems/P877_StoneGame.java
YC-S/LeetCode
452bb10e45de53217bca52f8c81b3034316ffc1b
[ "MIT" ]
null
null
null
31.714286
102
0.439189
997,967
package all_problems; public class P877_StoneGame { public boolean stoneGame(int[] piles) { int n = piles.length; int[][] dp = new int[n][n]; for (int i = 0; i < n; i++) dp[i][i] = piles[i]; for (int d = 1; d < n; d++) for (int i = 0; i < n - d; i++) dp[i][i + d] = Math.max(piles[i] - dp[i + 1][i + d], piles[i + d] - dp[i][i + d - 1]); return dp[0][n - 1] > 0; } }
9237303ceef119ce85e6bb26e31818bfae87c569
10,634
java
Java
MetadataStorage/src/main/java/eu/supersede/mdm/storage/bdi/alignment/GlobalVsLocal.java
Kashif-Rabbani/ODIN
122209fa82dcd6951429f1daba11e5036790eb98
[ "Apache-2.0" ]
7
2017-12-05T11:03:49.000Z
2021-03-05T20:03:37.000Z
MetadataStorage/src/main/java/eu/supersede/mdm/storage/bdi/alignment/GlobalVsLocal.java
Kashif-Rabbani/ODIN
122209fa82dcd6951429f1daba11e5036790eb98
[ "Apache-2.0" ]
null
null
null
MetadataStorage/src/main/java/eu/supersede/mdm/storage/bdi/alignment/GlobalVsLocal.java
Kashif-Rabbani/ODIN
122209fa82dcd6951429f1daba11e5036790eb98
[ "Apache-2.0" ]
4
2019-04-01T07:46:16.000Z
2022-02-10T01:31:10.000Z
53.17
253
0.649991
997,968
package eu.supersede.mdm.storage.bdi.alignment; import eu.supersede.mdm.storage.bdi.extraction.Namespaces; import eu.supersede.mdm.storage.resources.bdi.SchemaIntegrationHelper; import eu.supersede.mdm.storage.util.RDFUtil; import eu.supersede.mdm.storage.util.Tuple2; import eu.supersede.mdm.storage.util.Tuple3; import net.minidev.json.JSONArray; import net.minidev.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * Created by Kashif-Rabbani in June 2019 */ public class GlobalVsLocal { private JSONObject dataSource1Info = new JSONObject(); private JSONObject dataSource2Info = new JSONObject(); private JSONArray alignmentsArray = new JSONArray(); private final SchemaIntegrationHelper schemaIntegrationHelper = new SchemaIntegrationHelper(); public GlobalVsLocal(JSONObject a, JSONObject b) { this.dataSource1Info = a; this.dataSource2Info = b; } public JSONArray runGlobalVsLocalIntegration() { /* Create an IRI for alignments which will be produced by LogMap for the two sources. Note that this IRI is required to store the alignments in the TripleStore. */ String alignmentsIRI = Namespaces.Alignments.val() + dataSource1Info.getAsString("dataSourceID") + "-" + dataSource2Info.getAsString("dataSourceID"); // Calling LogMapMatcher class to extract, and save the alignments LogMapMatcher logMapMatcher = new LogMapMatcher(dataSource1Info.getAsString("parsedFileAddress"), dataSource2Info.getAsString("parsedFileAddress"), alignmentsIRI); /* * This array is storing the structure like this: * { "SUPERCLASSES": [ [ { "s": "global Super Class", "p": "local", "o": "conf" }, { "s": "global Sub Class 1", "p": "local", "o": "conf" }, { "s": "global Sub Class 2", "p": "local", "o": "conf" } ],[], [] ] }*/ JSONArray superAndSubClassesArray = new JSONArray(); JSONArray onlyClassesArray = new JSONArray(); refactorSuperClassesAndSubClasses(logMapMatcher, superAndSubClassesArray, onlyClassesArray); //System.out.println(superAndSubClassesArray.toJSONString()); //System.out.println(onlyClassesArray.toJSONString()); RDFUtil.runAQuery("SELECT * WHERE { GRAPH <" + alignmentsIRI + "> {?s ?p ?o} }", alignmentsIRI).forEachRemaining(triple -> { JSONObject alignments = new JSONObject(); if (!triple.get("o").toString().split("__")[1].equals("CLASS")) { schemaIntegrationHelper.populateResponseArray(alignmentsArray, triple, alignments); } }); System.out.println("Detected by LogMap: "); System.out.println(alignmentsArray.toJSONString()); Finder finder = new Finder(dataSource1Info.getAsString("schema_iri"), dataSource2Info.getAsString("schema_iri")); JSONArray dataPropertiesSpecialAlignments = finder.getAlignmentsArray(); alignmentsArray.addAll(dataPropertiesSpecialAlignments); System.out.println("Detected by Kashif"); System.out.println(dataPropertiesSpecialAlignments.toJSONString()); JSONObject o = new JSONObject(); o.put("mapping_type", "CLASS"); o.put("super_classes", superAndSubClassesArray); o.put("other_classes", onlyClassesArray); alignmentsArray.add(o); return alignmentsArray; } private void refactorSuperClassesAndSubClasses(LogMapMatcher logMapMatcher, JSONArray superAndSubClassesArray, JSONArray onlyClassesArray) { String iri = dataSource1Info.getAsString("schema_iri"); List<Tuple3<String, String, String>> classAlignments = logMapMatcher.getClassesAlignments(); Map<String, List<Tuple3<String, String, String>>> classAlignmentsGroupedByClassB = classAlignments.stream().collect(Collectors.groupingBy(w -> w._2)); //System.out.println(classAlignmentsGroupedByClassB.values()); /* classAlignmentsGroupedByClassB looks like this: * [groupedByClass, List[ Tuple3<classA, groupedByClass, Confidence>, Tuple3<,,>,....] ] */ // Iterate over list Of Class Pairs grouped by Class B classAlignmentsGroupedByClassB.forEach((groupedClass, listOfClassPairs) -> { //System.out.println("Grouped Class: ------------> " + groupedClass); // This map contains the information about the super classes (IF EXISTS) and their sub classes (Result of Query) // Map<Tuple2<ClassIRI, ConfidenceValue>, List<AllSubClassesOfClass>> Map<Tuple2<String, String>, List<String>> superClassesPlusSubClasses = new HashMap<>(); // This list contains the classes which are not super classes List<String> classes = new ArrayList<>(); // This list is to store the classes (which are not super classes) with their confidence List<Tuple2> classesAndConfidence = new ArrayList<>(); // Iterate over list of Class Pairs to separate the information about super classes and others for (Tuple3 classPair : listOfClassPairs) { // If the class A contains a global IRI, it means it is a super class (According to our GG Model Representation) if (classPair._1.toString().contains(Namespaces.G.val())) { // Query to get the subClasses of the superClass from the global graph String query = " SELECT DISTINCT ?p WHERE { GRAPH <" + iri + "> { ?p rdfs:subClassOf <" + classPair._1.toString() + "> . } }"; List<String> subClasses = schemaIntegrationHelper.getSparqlQueryResult(iri, query); // Saving the SuperClasses with their Sub Classes and Confidence value in the Map superClassesPlusSubClasses.put(new Tuple2(classPair._1.toString(), classPair._3.toString()), subClasses); } else { // If the class A does not contain the Global IRI, it means it is a class with Namespaces.Schema.val() IRI, so it can not be a super class (According to our GG Model Representation) // Add the classA into a separate List classes.add(classPair._1.toString()); // Add the class into a list including its confidence value classesAndConfidence.add(new Tuple2(classPair._1.toString(), classPair._3.toString())); } } // Iterate over all the superClasses having their subClasses (IF EXISTS) if (superClassesPlusSubClasses.size() > 0) { populateSuperSubClasses(superAndSubClassesArray, onlyClassesArray, groupedClass, superClassesPlusSubClasses, classes, classesAndConfidence); } else { //Iterate over the list of ClassesAndConfidence (These are the classes which are not superClasses) for (Tuple2 tuple : classesAndConfidence) { JSONObject temp = new JSONObject(); temp.put("s", tuple._1); temp.put("p", groupedClass); temp.put("confidence", tuple._2); onlyClassesArray.add(temp); } } }); } private void populateSuperSubClasses(JSONArray superAndSubClassesArray, JSONArray onlyClassesArray, String groupedClass, Map<Tuple2<String, String>, List<String>> superClassesPlusSubClasses, List<String> classes, List<Tuple2> classesAndConfidence) { superClassesPlusSubClasses.forEach((superClass, subClasses) -> { //System.out.println("********* Printing Super and Sub Classes: "); //System.out.println(superClass._1); //System.out.println(subClasses.toString()); //System.out.println(); // Creating a wrapper array to wrap the information about this super class JSONArray wrapperArray = new JSONArray(); // Creating an object to store the ClassA, GroupedByClass i.e. class B, and the Confidence Value. Note that we know that this is a superClass Info only. JSONObject containerObject = new JSONObject(); containerObject.put("s", superClass._1); containerObject.put("p", groupedClass); containerObject.put("confidence", superClass._2); // Adding the object into wrapper Array wrapperArray.add(containerObject); // Filter out those classes which are same as subclasses of the superclass we are iterating List<String> classesSameAsSubClasses = classes.stream().filter(subClasses::contains).collect(Collectors.toList()); // Filter out those classes which are not same as subclasses of the superclass we are iterating List<String> classesDifferentFromSubClasses = classes.stream().filter(obj -> !subClasses.contains(obj)).collect(Collectors.toList()); //System.out.println("classesSameAsSubClasses: "); //System.out.println(classesSameAsSubClasses); //System.out.println("classesDifferentFromSubClasses: "); //System.out.println(classesDifferentFromSubClasses); //Iterate over the list of ClassesAndConfidence (These are the classes which are not superClasses) for (Tuple2 tuple : classesAndConfidence) { // Extracting the confidence value for the classes which are same as subclasses constructTripleResponse(groupedClass, wrapperArray, classesSameAsSubClasses, tuple); // Extracting the confidence value for the classes which are not same as subclasses constructTripleResponse(groupedClass, onlyClassesArray, classesDifferentFromSubClasses, tuple); } superAndSubClassesArray.add(wrapperArray); }); } private void constructTripleResponse(String groupedClass, JSONArray jsonArray, List<String> listOfClasses, Tuple2 tuple) { if (listOfClasses.contains(tuple._1)) { JSONObject temp = new JSONObject(); String tupleValue = listOfClasses.get(listOfClasses.indexOf(tuple._1)); temp.put("s", tupleValue); temp.put("p", groupedClass); temp.put("confidence", tuple._2); jsonArray.add(temp); } } }
923730cf3d627b13d1e1ad198316e16348d8b8d1
372
java
Java
user-profile-service/src/test/java/com/kouchos/userprofileservice/UserProfileServiceImplApplicationTests.java
kouchos/micro-service-demo
4388914a53be364286a8f4778dd460c08019b721
[ "MIT" ]
null
null
null
user-profile-service/src/test/java/com/kouchos/userprofileservice/UserProfileServiceImplApplicationTests.java
kouchos/micro-service-demo
4388914a53be364286a8f4778dd460c08019b721
[ "MIT" ]
null
null
null
user-profile-service/src/test/java/com/kouchos/userprofileservice/UserProfileServiceImplApplicationTests.java
kouchos/micro-service-demo
4388914a53be364286a8f4778dd460c08019b721
[ "MIT" ]
null
null
null
21.882353
60
0.803763
997,969
package com.kouchos.userprofileservice; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class UserProfileServiceImplApplicationTests { @Test public void contextLoads() { } }
923731bc601cbcd66f8198c1453d383ed02b4e21
6,994
java
Java
http-server-netty/src/main/java/io/micronaut/http/server/netty/binders/PublisherBodyBinder.java
pelenthium/micronaut-core
ed92e5e194a0a806f4bbd8c3ee396e849405e7c2
[ "Apache-2.0" ]
1
2018-11-18T15:00:37.000Z
2018-11-18T15:00:37.000Z
http-server-netty/src/main/java/io/micronaut/http/server/netty/binders/PublisherBodyBinder.java
pelenthium/micronaut-core
ed92e5e194a0a806f4bbd8c3ee396e849405e7c2
[ "Apache-2.0" ]
null
null
null
http-server-netty/src/main/java/io/micronaut/http/server/netty/binders/PublisherBodyBinder.java
pelenthium/micronaut-core
ed92e5e194a0a806f4bbd8c3ee396e849405e7c2
[ "Apache-2.0" ]
1
2019-01-07T23:09:32.000Z
2019-01-07T23:09:32.000Z
45.122581
143
0.608093
997,970
/* * Copyright 2017-2018 original authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.micronaut.http.server.netty.binders; import io.micronaut.core.annotation.Internal; import io.micronaut.http.netty.stream.StreamedHttpRequest; import io.micronaut.context.BeanLocator; import io.micronaut.core.async.subscriber.TypedSubscriber; import io.micronaut.core.convert.ArgumentConversionContext; import io.micronaut.core.convert.ConversionError; import io.micronaut.core.convert.ConversionService; import io.micronaut.core.convert.exceptions.ConversionErrorException; import io.micronaut.core.type.Argument; import io.micronaut.http.HttpRequest; import io.micronaut.http.MediaType; import io.micronaut.http.server.HttpServerConfiguration; import io.micronaut.http.bind.binders.DefaultBodyAnnotationBinder; import io.micronaut.http.bind.binders.NonBlockingBodyArgumentBinder; import io.micronaut.http.server.netty.*; import io.micronaut.web.router.exceptions.UnsatisfiedRouteException; import io.micronaut.web.router.qualifier.ConsumesMediaTypeQualifier; import io.netty.buffer.ByteBufHolder; import org.reactivestreams.Publisher; import org.reactivestreams.Subscription; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.inject.Singleton; import java.util.Optional; /** * A {@link io.micronaut.http.annotation.Body} argument binder for a reactive streams {@link Publisher}. * * @author Graeme Rocher * @since 1.0 */ @Singleton @Internal public class PublisherBodyBinder extends DefaultBodyAnnotationBinder<Publisher> implements NonBlockingBodyArgumentBinder<Publisher> { private static final Logger LOG = LoggerFactory.getLogger(NettyHttpServer.class); private final BeanLocator beanLocator; private final HttpServerConfiguration httpServerConfiguration; /** * @param conversionService The conversion service * @param beanLocator The bean locator * @param httpServerConfiguration The Http server configuration */ public PublisherBodyBinder(ConversionService conversionService, BeanLocator beanLocator, HttpServerConfiguration httpServerConfiguration) { super(conversionService); this.beanLocator = beanLocator; this.httpServerConfiguration = httpServerConfiguration; } @Override public Argument<Publisher> argumentType() { return Argument.of(Publisher.class); } @Override public BindingResult<Publisher> bind(ArgumentConversionContext<Publisher> context, HttpRequest<?> source) { if (source instanceof NettyHttpRequest) { NettyHttpRequest nettyHttpRequest = (NettyHttpRequest) source; io.netty.handler.codec.http.HttpRequest nativeRequest = nettyHttpRequest.getNativeRequest(); if (nativeRequest instanceof StreamedHttpRequest) { Optional<MediaType> contentType = source.getContentType(); Argument<?> targetType = context.getFirstTypeVariable().orElse(Argument.OBJECT_ARGUMENT); HttpContentProcessor<?> processor = contentType .flatMap(type -> beanLocator.findBean(HttpContentSubscriberFactory.class, new ConsumesMediaTypeQualifier<>(type))) .map(factory -> factory.build(nettyHttpRequest)) .orElse(new DefaultHttpContentProcessor(nettyHttpRequest, httpServerConfiguration)); //noinspection unchecked return () -> Optional.of(subscriber -> processor.subscribe(new TypedSubscriber<Object>((Argument) context.getArgument()) { Subscription s; @Override protected void doOnSubscribe(Subscription subscription) { this.s = subscription; subscriber.onSubscribe(subscription); } @Override protected void doOnNext(Object message) { if (LOG.isTraceEnabled()) { LOG.trace("Server received streaming message for argument [{}]: {}", context.getArgument(), message); } ArgumentConversionContext<?> conversionContext = context.with(targetType); if (message instanceof ByteBufHolder) { message = ((ByteBufHolder) message).content(); } Optional<?> converted = conversionService.convert(message, conversionContext); if (converted.isPresent()) { subscriber.onNext(converted.get()); } else { if (LOG.isTraceEnabled()) { LOG.trace("Cannot convert message for argument [{}] and value: {}", context.getArgument(), message); } try { Optional<ConversionError> lastError = conversionContext.getLastError(); if (lastError.isPresent()) { subscriber.onError(new ConversionErrorException(context.getArgument(), lastError.get())); } else { subscriber.onError(new UnsatisfiedRouteException(context.getArgument())); } } finally { s.cancel(); } } } @Override protected void doOnError(Throwable t) { if (LOG.isTraceEnabled()) { LOG.trace("Server received error for argument [" + context.getArgument() + "]: " + t.getMessage(), t); } try { subscriber.onError(t); } finally { s.cancel(); } } @Override protected void doOnComplete() { if (LOG.isTraceEnabled()) { LOG.trace("Done receiving messages for argument: {}", context.getArgument()); } subscriber.onComplete(); } })); } } return BindingResult.EMPTY; } }
9237320c28427f6b055559d8fcde92d4037ff524
523
java
Java
sharding-api/src/main/java/com/game/qs/api/ApiController.java
zunzhuowei/sharding-practice
7dc16b6cbdb9aa9f66fc103f6149190144b88421
[ "Apache-2.0" ]
null
null
null
sharding-api/src/main/java/com/game/qs/api/ApiController.java
zunzhuowei/sharding-practice
7dc16b6cbdb9aa9f66fc103f6149190144b88421
[ "Apache-2.0" ]
null
null
null
sharding-api/src/main/java/com/game/qs/api/ApiController.java
zunzhuowei/sharding-practice
7dc16b6cbdb9aa9f66fc103f6149190144b88421
[ "Apache-2.0" ]
null
null
null
24.904762
62
0.785851
997,971
package com.game.qs.api; import com.game.qs.base.basecontroller.BaseController; import com.game.qs.mapping.ApiMapping; import io.swagger.annotations.Api; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * Created by zun.wei on 2019/4/23 11:04. * Description: API 接口 */ @RestController @Api(value = ApiMapping.API, tags = {"SHARDING-PRACTICE-API"}) @RequestMapping(ApiMapping.API) public class ApiController extends BaseController { }
9237325fac7fa73c3a66428e938cd8c5894bb7dd
3,727
java
Java
ScoutingRadar2022/app/src/main/java/org/stormroboticsnj/scoutingradar2022/PermissionsFragment.java
caseyjbrotherton/ScoutingRadar2022
ea9cf29d831aec3b2ee1a3196d7565042aa9cfd8
[ "Apache-2.0" ]
2
2022-01-21T19:42:25.000Z
2022-01-21T20:30:36.000Z
ScoutingRadar2022/app/src/main/java/org/stormroboticsnj/scoutingradar2022/PermissionsFragment.java
caseyjbrotherton/ScoutingRadar2022
ea9cf29d831aec3b2ee1a3196d7565042aa9cfd8
[ "Apache-2.0" ]
2
2022-03-24T19:12:34.000Z
2022-03-29T13:58:29.000Z
ScoutingRadar2022/app/src/main/java/org/stormroboticsnj/scoutingradar2022/PermissionsFragment.java
caseyjbrotherton/ScoutingRadar2022
ea9cf29d831aec3b2ee1a3196d7565042aa9cfd8
[ "Apache-2.0" ]
4
2022-02-26T21:47:22.000Z
2022-03-30T22:43:44.000Z
38.030612
101
0.610142
997,972
package org.stormroboticsnj.scoutingradar2022; import android.app.AlertDialog; import android.content.Context; import android.content.pm.PackageManager; import android.util.Log; import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.NonNull; import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; public abstract class PermissionsFragment extends Fragment { private final ActivityResultLauncher<String[]> requestPermissionsLauncher = registerForActivityResult( new ActivityResultContracts.RequestMultiplePermissions(), (isGranted) -> { if (!isGranted.containsValue(false)) { onPermissionsGranted(); } else { onPermissionsDenied(); } } ); private void showPermissionsExplanation() { // Build an alert dialog to explain why we need Bluetooth permission // If the user grants permission, request them from the system new AlertDialog.Builder(getActivity()) .setMessage(getExplanationDialogMessage()) .setTitle(getExplanationDialogTitle()) .setPositiveButton(R.string.proceed, (dialog, which) -> { requestPermissionsLauncher.launch( getPermissionsToRequest()); }) .setNegativeButton(R.string.cancel, (dialog, which) -> { dialog.dismiss(); }) .create() .show(); } /** * Checks if the app has permission to access Bluetooth. If not, checks if a rationale should be * displayed. If so, displays a dialog to the user and then requests the permission. Then, if the * user has granted the permission, runs {@link #onPermissionsGranted()}. * * @param context */ protected void checkPermissionsAndAct(@NonNull Context context) { // Ensure all permissions are granted boolean areAllPermissionsGranted = true; for (String permission : getPermissionsToRequest()) { areAllPermissionsGranted &= ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; } if (areAllPermissionsGranted) { onPermissionsGranted(); } else { // Check if any rationales are needed boolean shouldShowRationale = false; for (String permission : getPermissionsToRequest()) { shouldShowRationale |= shouldShowRequestPermissionRationale(permission); } // Show the rationale if needed if (shouldShowRationale) { showPermissionsExplanation(); } else { requestPermissionsLauncher.launch(getPermissionsToRequest()); } } } /** * Returns the permissions that the fragment needs to request. * @return The permissions that the fragment needs to request. */ protected abstract String[] getPermissionsToRequest(); /** * Called when the permissions have been granted. */ protected abstract void onPermissionsGranted(); protected abstract String getExplanationDialogTitle(); protected abstract String getExplanationDialogMessage(); protected void onPermissionsDenied() { Log.e("PermissionsFragment", "Permissions not granted"); } }
9237340a922ccd92abc8b21aae02050f45ae6f8b
4,717
java
Java
org/apache/batik/ext/awt/image/rendered/DiffuseLightingRed.java
JaneMandy/CS
4a95148cbeb3804b9c50da003d1a7cb12254cb58
[ "Apache-2.0" ]
1
2022-02-24T01:32:41.000Z
2022-02-24T01:32:41.000Z
org/apache/batik/ext/awt/image/rendered/DiffuseLightingRed.java
JaneMandy/CS
4a95148cbeb3804b9c50da003d1a7cb12254cb58
[ "Apache-2.0" ]
null
null
null
org/apache/batik/ext/awt/image/rendered/DiffuseLightingRed.java
JaneMandy/CS
4a95148cbeb3804b9c50da003d1a7cb12254cb58
[ "Apache-2.0" ]
null
null
null
34.683824
132
0.542718
997,973
package org.apache.batik.ext.awt.image.rendered; import java.awt.Rectangle; import java.awt.image.ColorModel; import java.awt.image.DataBufferInt; import java.awt.image.SampleModel; import java.awt.image.SinglePixelPackedSampleModel; import java.awt.image.WritableRaster; import java.util.Map; import org.apache.batik.ext.awt.image.GraphicsUtil; import org.apache.batik.ext.awt.image.Light; public class DiffuseLightingRed extends AbstractRed { private double kd; private Light light; private BumpMap bumpMap; private double scaleX; private double scaleY; private Rectangle litRegion; private boolean linear; public DiffuseLightingRed(double var1, Light var3, BumpMap var4, Rectangle var5, double var6, double var8, boolean var10) { this.kd = var1; this.light = var3; this.bumpMap = var4; this.litRegion = var5; this.scaleX = var6; this.scaleY = var8; this.linear = var10; ColorModel var11; if (var10) { var11 = GraphicsUtil.Linear_sRGB_Pre; } else { var11 = GraphicsUtil.sRGB_Pre; } SampleModel var12 = var11.createCompatibleSampleModel(var5.width, var5.height); this.init((CachableRed)null, var5, var11, var12, var5.x, var5.y, (Map)null); } public WritableRaster copyData(WritableRaster var1) { double[] var2 = this.light.getColor(this.linear); int var3 = var1.getWidth(); int var4 = var1.getHeight(); int var5 = var1.getMinX(); int var6 = var1.getMinY(); DataBufferInt var7 = (DataBufferInt)var1.getDataBuffer(); int[] var8 = var7.getBankData()[0]; SinglePixelPackedSampleModel var9 = (SinglePixelPackedSampleModel)var1.getSampleModel(); int var10 = var7.getOffset() + var9.getOffset(var5 - var1.getSampleModelTranslateX(), var6 - var1.getSampleModelTranslateY()); int var11 = var9.getScanlineStride(); int var12 = var11 - var3; int var13 = var10; boolean var14 = false; boolean var15 = false; boolean var16 = false; boolean var17 = false; boolean var18 = false; double var19 = this.scaleX * (double)var5; double var21 = this.scaleY * (double)var6; double var23 = 0.0D; double[][][] var25 = this.bumpMap.getNormalArray(var5, var6, var3, var4); double[][] var27; double[] var28; int var30; int var31; int var32; int var33; int var34; if (!this.light.isConstant()) { double[][] var26 = new double[var3][3]; for(var33 = 0; var33 < var4; ++var33) { var27 = var25[var33]; this.light.getLightRow(var19, var21 + (double)var33 * this.scaleY, this.scaleX, var3, var27, var26); for(var34 = 0; var34 < var3; ++var34) { var28 = var27[var34]; double[] var29 = var26[var34]; var23 = 255.0D * this.kd * (var28[0] * var29[0] + var28[1] * var29[1] + var28[2] * var29[2]); var30 = (int)(var23 * var2[0]); var31 = (int)(var23 * var2[1]); var32 = (int)(var23 * var2[2]); if ((var30 & -256) != 0) { var30 = (var30 & Integer.MIN_VALUE) != 0 ? 0 : 255; } if ((var31 & -256) != 0) { var31 = (var31 & Integer.MIN_VALUE) != 0 ? 0 : 255; } if ((var32 & -256) != 0) { var32 = (var32 & Integer.MIN_VALUE) != 0 ? 0 : 255; } var8[var13++] = -16777216 | var30 << 16 | var31 << 8 | var32; } var13 += var12; } } else { double[] var35 = new double[3]; this.light.getLight(0.0D, 0.0D, 0.0D, var35); for(var33 = 0; var33 < var4; ++var33) { var27 = var25[var33]; for(var34 = 0; var34 < var3; ++var34) { var28 = var27[var34]; var23 = 255.0D * this.kd * (var28[0] * var35[0] + var28[1] * var35[1] + var28[2] * var35[2]); var30 = (int)(var23 * var2[0]); var31 = (int)(var23 * var2[1]); var32 = (int)(var23 * var2[2]); if ((var30 & -256) != 0) { var30 = (var30 & Integer.MIN_VALUE) != 0 ? 0 : 255; } if ((var31 & -256) != 0) { var31 = (var31 & Integer.MIN_VALUE) != 0 ? 0 : 255; } if ((var32 & -256) != 0) { var32 = (var32 & Integer.MIN_VALUE) != 0 ? 0 : 255; } var8[var13++] = -16777216 | var30 << 16 | var31 << 8 | var32; } var13 += var12; } } return var1; } }
923735bbe5a1a8904558331a6552c9c651abe3df
1,691
java
Java
pigeon-core-encoding/src/main/java/payne/framework/pigeon/core/encoding/HexInvocationEncoder.java
core-lib/pigeon
a3902a41b10cb7d6cd3751fd8bdf0417c09f6cfc
[ "Apache-2.0" ]
127
2015-08-01T03:38:48.000Z
2022-02-11T14:32:07.000Z
pigeon-core-encoding/src/main/java/payne/framework/pigeon/core/encoding/HexInvocationEncoder.java
core-lib/pigeon
a3902a41b10cb7d6cd3751fd8bdf0417c09f6cfc
[ "Apache-2.0" ]
2
2016-07-04T09:34:09.000Z
2017-10-02T09:25:40.000Z
pigeon-core-encoding/src/main/java/payne/framework/pigeon/core/encoding/HexInvocationEncoder.java
core-lib/pigeon
a3902a41b10cb7d6cd3751fd8bdf0417c09f6cfc
[ "Apache-2.0" ]
82
2015-08-21T07:03:01.000Z
2021-10-15T02:23:31.000Z
23.486111
79
0.69249
997,974
package payne.framework.pigeon.core.encoding; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import org.apache.commons.codec.binary.Hex; import payne.framework.pigeon.core.encoding.exception.EncoderException; public class HexInvocationEncoder implements InvocationEncoder { public String algorithm() { return "hex"; } public byte[] chunk(boolean encode) { return new byte[(encode ? 1 : 2) * 1000]; } public void encode(InputStream in, OutputStream out) throws EncoderException { try { Hex hex = new Hex(); byte[] buffer = new byte[1024]; int length = 0; while ((length = in.read(buffer)) != -1) { out.write(hex.encode(Arrays.copyOf(buffer, length))); } } catch (Exception e) { throw new EncoderException(e); } } public void decode(InputStream in, OutputStream out) throws EncoderException { try { Hex hex = new Hex(); byte[] buffer = new byte[1024]; int length = 0; while ((length = in.read(buffer)) != -1) { out.write(hex.decode(Arrays.copyOf(buffer, length))); } } catch (Exception e) { throw new EncoderException(e); } } public byte[] encode(byte[] bytes) { try { return new Hex().encode(bytes); } catch (Exception e) { throw new RuntimeException(e); } } public byte[] decode(byte[] bytes) { try { return new Hex().decode(bytes); } catch (Exception e) { throw new RuntimeException(e); } } public OutputStream wrap(OutputStream outputStream) throws Exception { return new HexInvocationOutputStream(outputStream); } public InputStream wrap(InputStream inputStream) throws Exception { return new HexInvocationInputStream(inputStream); } }
92373636e90c275e0a372ad3e1a5836ed9de88e1
4,077
java
Java
src/main/java/com/google/code/yanf4j/core/impl/TextLineCodecFactory.java
mirlord/xmemcached
ab7fe217ffbae6f9d95524ec2093cc8150f237ad
[ "Apache-2.0" ]
578
2015-01-04T02:01:02.000Z
2022-03-25T07:19:42.000Z
src/main/java/com/google/code/yanf4j/core/impl/TextLineCodecFactory.java
mirlord/xmemcached
ab7fe217ffbae6f9d95524ec2093cc8150f237ad
[ "Apache-2.0" ]
100
2015-01-27T02:13:16.000Z
2022-03-21T09:38:05.000Z
src/main/java/com/google/code/yanf4j/core/impl/TextLineCodecFactory.java
mirlord/xmemcached
ab7fe217ffbae6f9d95524ec2093cc8150f237ad
[ "Apache-2.0" ]
244
2015-01-04T02:01:10.000Z
2021-11-10T14:00:06.000Z
34.601695
100
0.696792
997,975
/** * Copyright [2009-2010] [dennis zhuang(nnheo@example.com)] Licensed under the Apache License, * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You * may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by * applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See * the License for the specific language governing permissions and limitations under the License */ /** * Copyright [2009-2010] [dennis zhuang(nnheo@example.com)] Licensed under the Apache License, * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You * may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by * applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See * the License for the specific language governing permissions and limitations under the License */ package com.google.code.yanf4j.core.impl; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; import com.google.code.yanf4j.buffer.IoBuffer; import com.google.code.yanf4j.core.CodecFactory; import com.google.code.yanf4j.core.Session; import com.google.code.yanf4j.util.ByteBufferMatcher; import com.google.code.yanf4j.util.ShiftAndByteBufferMatcher; /** * Text line codec factory * * @author dennis * */ public class TextLineCodecFactory implements CodecFactory { public static final IoBuffer SPLIT = IoBuffer.wrap("\r\n".getBytes()); private static final ByteBufferMatcher SPLIT_PATTERN = new ShiftAndByteBufferMatcher(SPLIT); public static final String DEFAULT_CHARSET_NAME = "utf-8"; private Charset charset; public TextLineCodecFactory() { this.charset = Charset.forName(DEFAULT_CHARSET_NAME); } public TextLineCodecFactory(String charsetName) { this.charset = Charset.forName(charsetName); } class StringDecoder implements Decoder { public Object decode(IoBuffer buffer, Session session) { String result = null; int index = SPLIT_PATTERN.matchFirst(buffer); if (index >= 0) { int limit = buffer.limit(); buffer.limit(index); CharBuffer charBuffer = TextLineCodecFactory.this.charset.decode(buffer.buf()); result = charBuffer.toString(); buffer.limit(limit); buffer.position(index + SPLIT.remaining()); } return result; } } private Decoder decoder = new StringDecoder(); public Decoder getDecoder() { return this.decoder; } class StringEncoder implements Encoder { public IoBuffer encode(Object msg, Session session) { if (msg == null) { return null; } String message = (String) msg; ByteBuffer buff = TextLineCodecFactory.this.charset.encode(message); byte[] bs = new byte[buff.remaining() + SPLIT.remaining()]; int len = buff.remaining(); System.arraycopy(buff.array(), buff.position(), bs, 0, len); bs[len] = 13; // \r bs[len + 1] = 10; // \n IoBuffer resultBuffer = IoBuffer.wrap(bs); return resultBuffer; } } private Encoder encoder = new StringEncoder(); public Encoder getEncoder() { return this.encoder; } // public static void main(String args[]) { // TextLineCodecFactory codecFactory = new TextLineCodecFactory(); // Encoder encoder = codecFactory.getEncoder(); // long sum = 0; // for (int i = 0; i < 100000; i++) { // sum += encoder.encode("hello", null).remaining(); // } // // long start = System.currentTimeMillis(); // // for (int i = 0; i < 10000000; i++) { // sum += encoder.encode("hello", null).remaining(); // } // long cost = System.currentTimeMillis() - start; // System.out.println("sum=" + sum + ",cost = " + cost + " ms."); // } }
923736561eb75f63c32ab9a8e911c5907cd6957f
184
java
Java
src/main/java/com/withwiz/plankton/network/message2/IResponseMessageTail.java
greeun/plankton
3dfbbc652325eabce0a4e1e71754ad1d8a2a3297
[ "Apache-2.0" ]
1
2020-10-04T06:05:05.000Z
2020-10-04T06:05:05.000Z
src/main/java/com/withwiz/plankton/network/message2/IResponseMessageTail.java
greeun/plankton
3dfbbc652325eabce0a4e1e71754ad1d8a2a3297
[ "Apache-2.0" ]
null
null
null
src/main/java/com/withwiz/plankton/network/message2/IResponseMessageTail.java
greeun/plankton
3dfbbc652325eabce0a4e1e71754ad1d8a2a3297
[ "Apache-2.0" ]
null
null
null
23
90
0.804348
997,976
package com.withwiz.plankton.network.message2; /** * Response message tail interface */ public interface IResponseMessageTail<TYPE_RAW_DATA> extends IMessageTail<TYPE_RAW_DATA> { }
923737cb9905f67705654963af4bb52e7f170811
219
java
Java
src/main/java/pgwire/PgwireServerMessage.java
kachayev/camille-sql
543b33cfa9ec0d6d99fd78278e26a0555e8f5d78
[ "MIT" ]
9
2020-05-16T10:43:17.000Z
2022-01-04T10:26:06.000Z
src/main/java/pgwire/PgwireServerMessage.java
kachayev/camille-sql
543b33cfa9ec0d6d99fd78278e26a0555e8f5d78
[ "MIT" ]
null
null
null
src/main/java/pgwire/PgwireServerMessage.java
kachayev/camille-sql
543b33cfa9ec0d6d99fd78278e26a0555e8f5d78
[ "MIT" ]
null
null
null
24.333333
66
0.821918
997,977
package pgwire; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; public abstract class PgwireServerMessage extends Object { abstract public ByteBuf toByteBuf(ByteBufAllocator allocator); }
923737f7ebd04b487f439d48b8b83f3d2375873b
1,271
java
Java
confignode/src/main/java/org/apache/iotdb/confignode/procedure/exception/ProcedureException.java
RYH61/iotdb
b940a652ddb03868428ad8774b18cf08b31d7c73
[ "Apache-2.0" ]
945
2018-12-13T00:39:04.000Z
2020-10-01T04:17:02.000Z
confignode/src/main/java/org/apache/iotdb/confignode/procedure/exception/ProcedureException.java
RYH61/iotdb
b940a652ddb03868428ad8774b18cf08b31d7c73
[ "Apache-2.0" ]
923
2019-01-18T01:12:04.000Z
2020-10-01T02:17:11.000Z
confignode/src/main/java/org/apache/iotdb/confignode/procedure/exception/ProcedureException.java
leety1228/iotdb
ffdcc0a5381596a74bb807a8f89fe6de3749125a
[ "Apache-2.0" ]
375
2018-12-23T06:40:33.000Z
2020-10-01T02:49:20.000Z
28.244444
63
0.719906
997,978
/* * 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.iotdb.confignode.procedure.exception; public class ProcedureException extends Exception { /** default constructor */ public ProcedureException() { super(); } /** * Constructor * * @param s message */ public ProcedureException(String s) { super(s); } public ProcedureException(Throwable t) { super(t); } public ProcedureException(String source, Throwable cause) { super(source, cause); } }
9237381960d98c29d95db291ae2c9b5c36780f4c
783
java
Java
FRC_2019_Code/src/main/java/frc/robot/subsystems/Hatch.java
frc-tigertrons-team-222/FRC-2019-Team222
9c0bb20f34878a4a18514419e0a31d1afc47d779
[ "MIT" ]
null
null
null
FRC_2019_Code/src/main/java/frc/robot/subsystems/Hatch.java
frc-tigertrons-team-222/FRC-2019-Team222
9c0bb20f34878a4a18514419e0a31d1afc47d779
[ "MIT" ]
null
null
null
FRC_2019_Code/src/main/java/frc/robot/subsystems/Hatch.java
frc-tigertrons-team-222/FRC-2019-Team222
9c0bb20f34878a4a18514419e0a31d1afc47d779
[ "MIT" ]
null
null
null
24.46875
102
0.761175
997,979
package frc.robot.subsystems; import edu.wpi.first.wpilibj.DoubleSolenoid; import edu.wpi.first.wpilibj.command.Subsystem; import frc.robot.RobotMap; /** * Add your docs here. */ public class Hatch extends Subsystem { // Put methods for controlling this subsystem // here. Call these from Commands. DoubleSolenoid pitchSolenoid = null; public Hatch() { pitchSolenoid = new DoubleSolenoid(RobotMap.HATCH_SOLENOID_DEPLOY, RobotMap.HATCH_SOLENOID_RETRACT); } public void pitchUp() { pitchSolenoid.set(DoubleSolenoid.Value.kForward); } public void pitchDown() { pitchSolenoid.set(DoubleSolenoid.Value.kReverse); } @Override public void initDefaultCommand() { // Set the default command for a subsystem here. // setDefaultCommand(new MySpecialCommand()); } }
923738196b82b590cfdbfeb82677de0f339e609b
221
java
Java
src/main/java/net/spy/memcached/ops/OperationStateChangeObserver.java
taboola/spymemcached
0d025903b20f4719439e61bbf2f89b5fb1af1c4e
[ "MIT" ]
1
2020-11-17T07:50:37.000Z
2020-11-17T07:50:37.000Z
src/main/java/net/spy/memcached/ops/OperationStateChangeObserver.java
taboola/spymemcached
0d025903b20f4719439e61bbf2f89b5fb1af1c4e
[ "MIT" ]
null
null
null
src/main/java/net/spy/memcached/ops/OperationStateChangeObserver.java
taboola/spymemcached
0d025903b20f4719439e61bbf2f89b5fb1af1c4e
[ "MIT" ]
null
null
null
31.571429
137
0.846154
997,980
package net.spy.memcached.ops; public interface OperationStateChangeObserver { void stateChanged(Operation operation, OperationState prevState, OperationState currentState, long timeFromPrevToCurrentStateMicros); }
9237381f5cdcdd4b85d8505afbb9a6467126455d
1,355
java
Java
services/submission/src/test/java/app/coronawarn/server/services/submission/verification/tan/TanTestCase.java
duchampdev/cwa-server
1df3661f3166a07a8322e30f76f08f7e9948b8f2
[ "Apache-2.0" ]
null
null
null
services/submission/src/test/java/app/coronawarn/server/services/submission/verification/tan/TanTestCase.java
duchampdev/cwa-server
1df3661f3166a07a8322e30f76f08f7e9948b8f2
[ "Apache-2.0" ]
65
2020-05-28T05:23:44.000Z
2022-01-21T23:43:40.000Z
services/submission/src/test/java/app/coronawarn/server/services/submission/verification/tan/TanTestCase.java
duchampdev/cwa-server
1df3661f3166a07a8322e30f76f08f7e9948b8f2
[ "Apache-2.0" ]
1
2020-05-19T10:33:50.000Z
2020-05-19T10:33:50.000Z
26.568627
80
0.740221
997,981
/* * Corona-Warn-App * * SAP SE and all other contributors / * copyright owners license 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 app.coronawarn.server.services.submission.verification.tan; import app.coronawarn.server.services.submission.verification.AuthorizationType; public class TanTestCase { private String authValue; private TanAuthorization expected; private TanTestCase(String authValue) { this.authValue = authValue; } public static TanTestCase with(String authValue) { return new TanTestCase(authValue); } public TanTestCase expect(AuthorizationType type, String key) { this.expected = new TanAuthorization(type, key); return this; } public TanAuthorization getExpected() { return expected; } public String getAuthValue() { return authValue; } }
923738914cfe37e3c6e8e872ec6ae9dd9cdb06b7
1,361
java
Java
src/main/java/fr/eni/sortir/utils/SaltedMD5.java
KylianChaudemanche/sortir.com
e9f941179acc6085f8cb98d061860c5dd0267750
[ "MIT" ]
null
null
null
src/main/java/fr/eni/sortir/utils/SaltedMD5.java
KylianChaudemanche/sortir.com
e9f941179acc6085f8cb98d061860c5dd0267750
[ "MIT" ]
null
null
null
src/main/java/fr/eni/sortir/utils/SaltedMD5.java
KylianChaudemanche/sortir.com
e9f941179acc6085f8cb98d061860c5dd0267750
[ "MIT" ]
1
2019-07-24T19:13:25.000Z
2019-07-24T19:13:25.000Z
29.586957
75
0.657605
997,982
package fr.eni.sortir.utils; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class SaltedMD5 { public static String getSecurePassword(String passwordToHash) { String generatedPassword = null; byte[] salt; salt = getSalt(); try { // Create MessageDigest instance for MD5 MessageDigest md = MessageDigest.getInstance("MD5"); // Add password bytes to digest md.update(salt); // Get the hash's bytes byte[] bytes = md.digest(passwordToHash.getBytes()); // This bytes[] has bytes in decimal format; // Convert it to hexadecimal format StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1)); } // Get complete hashed password in hex format generatedPassword = sb.toString(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return generatedPassword; } // Add salt public static byte[] getSalt() { String saltString = Constantes.SALT; int len = saltString.length(); byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) { data[i / 2] = (byte) ((Character.digit(saltString.charAt(i), 16) << 4) + Character.digit(saltString.charAt(i + 1), 16)); } byte[] salt = data; return salt; } }
923739537c0cf576b0f478e209a7452553e6523d
684
java
Java
src/main/java/com/draper/itoken/sso/service/impl/UserServiceImpl.java
draperstudio/itoken-sso
67fc4911d8a65f1be0d5b444ad205d34bc99cdc2
[ "MIT" ]
null
null
null
src/main/java/com/draper/itoken/sso/service/impl/UserServiceImpl.java
draperstudio/itoken-sso
67fc4911d8a65f1be0d5b444ad205d34bc99cdc2
[ "MIT" ]
null
null
null
src/main/java/com/draper/itoken/sso/service/impl/UserServiceImpl.java
draperstudio/itoken-sso
67fc4911d8a65f1be0d5b444ad205d34bc99cdc2
[ "MIT" ]
1
2019-04-18T04:36:21.000Z
2019-04-18T04:36:21.000Z
26.307692
93
0.80117
997,983
package com.draper.itoken.sso.service.impl; import com.draper.itoken.sso.dao.UserMapper; import com.draper.itoken.sso.service.UserService; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import javax.annotation.Resource; /** * @author draper_hxy */ @Service public class UserServiceImpl implements UserService { @Resource private UserMapper userMapper; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { return userMapper.selectByUserName(username); } }
92373bf37d124e69633cf15cb688f9a837e35e04
591
java
Java
coderadar-graph/src/main/java/io/reflectoring/coderadar/graph/contributor/domain/RatingEntity.java
jo2/coderadar
ddb95a65fc068abf446e01dd8b90ecda07f2ef95
[ "MIT" ]
null
null
null
coderadar-graph/src/main/java/io/reflectoring/coderadar/graph/contributor/domain/RatingEntity.java
jo2/coderadar
ddb95a65fc068abf446e01dd8b90ecda07f2ef95
[ "MIT" ]
null
null
null
coderadar-graph/src/main/java/io/reflectoring/coderadar/graph/contributor/domain/RatingEntity.java
jo2/coderadar
ddb95a65fc068abf446e01dd8b90ecda07f2ef95
[ "MIT" ]
null
null
null
25.695652
63
0.80203
997,984
package io.reflectoring.coderadar.graph.contributor.domain; import java.util.List; import io.reflectoring.coderadar.domain.Badge; import io.reflectoring.coderadar.graph.game.domain.BadgeEntity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.neo4j.ogm.annotation.NodeEntity; import org.neo4j.ogm.annotation.Relationship; @Data @NodeEntity public class RatingEntity { private Long id; private Long projectId; private int pointsOverAll; @Relationship(type = "HAS_CONTRIBUTOR_BADGE") private List<BadgeEntity> badges; }
92373c4345f46da3ff272dcf73147f8a75d61520
606
java
Java
BitManipulation/StepsToZeroTest.java
anshulkhare7/ProgrammingPuzzles
9518c9303d682bee90139ecab48385104a2aaafa
[ "MIT" ]
null
null
null
BitManipulation/StepsToZeroTest.java
anshulkhare7/ProgrammingPuzzles
9518c9303d682bee90139ecab48385104a2aaafa
[ "MIT" ]
null
null
null
BitManipulation/StepsToZeroTest.java
anshulkhare7/ProgrammingPuzzles
9518c9303d682bee90139ecab48385104a2aaafa
[ "MIT" ]
null
null
null
25.25
108
0.575908
997,985
public class StepsToZeroTest { public static void main(String[] args) { StepsToZeroTest stt = new StepsToZeroTest(); stt.testStepsToZero(); } private void testStepsToZero(){ StepsToZero stz = new StepsToZero(); int input = 14; int expected = 6; int actual = stz.solution(input); if(expected==actual){ System.out.println("Test Case testStepsToZero Passed."); }else{ System.out.println("Test Case testStepsToZero FAILED. Expected: "+expected+" Actual: "+actual); } } }
92373c516cb3636d32d22e7246941ddb51a2f514
1,449
java
Java
EIDAS-Sources-1.4.5-MDSL/EIDAS-SAMLEngine/src/main/java/eu/eidas/auth/engine/core/impl/KeyStoreProtocolSigner.java
swedenconnect/eidas-eu-mock
9f6d67af4085f7bde35faadd0d79891c17c8e67c
[ "Apache-2.0" ]
5
2019-02-24T15:49:59.000Z
2020-06-09T08:15:00.000Z
EIDAS-Sources-1.4.5-MDSL/EIDAS-SAMLEngine/src/main/java/eu/eidas/auth/engine/core/impl/KeyStoreProtocolSigner.java
elegnamnden/eidas-eu-mock
a1ae9a3c497f1ca9906a8aa9e3f01e899d04c40c
[ "Apache-2.0" ]
11
2019-06-12T16:08:09.000Z
2022-03-31T20:59:55.000Z
EIDAS-Sources-1.4.5-MDSL/EIDAS-SAMLEngine/src/main/java/eu/eidas/auth/engine/core/impl/KeyStoreProtocolSigner.java
elegnamnden/eidas-eu-mock
a1ae9a3c497f1ca9906a8aa9e3f01e899d04c40c
[ "Apache-2.0" ]
1
2018-10-25T18:57:50.000Z
2018-10-25T18:57:50.000Z
39.162162
140
0.778468
997,986
/* * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by * the European Commission - subsequent versions of the EUPL (the "Licence"); * You may not use this work except in compliance with the Licence. You may * obtain a copy of the Licence at: * * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1 * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * Licence for the specific language governing permissions and limitations under * the Licence. */ package eu.eidas.auth.engine.core.impl; import java.util.Map; import eu.eidas.auth.engine.configuration.SamlEngineConfigurationException; import eu.eidas.auth.engine.configuration.dom.KeyStoreSignatureConfigurator; import eu.eidas.auth.engine.core.ProtocolSignerI; import javax.annotation.Nullable; /** * The base abstract class for implementations of {@link ProtocolSignerI} relying on a {@link java.security.KeyStore}. * * @since 1.1 */ public abstract class KeyStoreProtocolSigner extends AbstractProtocolSigner { protected KeyStoreProtocolSigner(Map<String, String> properties, @Nullable String defaultPath) throws SamlEngineConfigurationException { super(new KeyStoreSignatureConfigurator().getSignatureConfiguration(properties, defaultPath)); } }
92373c6c568c9129a6dbcb3d9e2d26d10fbbdb32
1,912
java
Java
gulimall-product/src/main/java/com/yang/gulimall/product/controller/CategoryBrandRelationController.java
shanfy/gulimall
1a830a65fa768852e97a549746b80c43b3305a51
[ "Apache-2.0" ]
null
null
null
gulimall-product/src/main/java/com/yang/gulimall/product/controller/CategoryBrandRelationController.java
shanfy/gulimall
1a830a65fa768852e97a549746b80c43b3305a51
[ "Apache-2.0" ]
null
null
null
gulimall-product/src/main/java/com/yang/gulimall/product/controller/CategoryBrandRelationController.java
shanfy/gulimall
1a830a65fa768852e97a549746b80c43b3305a51
[ "Apache-2.0" ]
null
null
null
23.8875
95
0.701727
997,987
package com.yang.gulimall.product.controller; import com.yang.common.utils.PageUtils; import com.yang.common.utils.R; import com.yang.gulimall.product.entity.CategoryBrandRelationEntity; import com.yang.gulimall.product.service.CategoryBrandRelationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Arrays; import java.util.Map; /** * 品牌分类关联 * * @author shanfy * @email anpch@example.com * @date 2022-03-26 17:59:21 */ @RestController @RequestMapping("product/categorybrandrelation") public class CategoryBrandRelationController { @Autowired private CategoryBrandRelationService categoryBrandRelationService; /** * 列表 */ @RequestMapping("/list") public R list(@RequestParam Map<String, Object> params){ PageUtils page = categoryBrandRelationService.queryPage(params); return R.ok().put("page", page); } /** * 信息 */ @RequestMapping("/info/{id}") public R info(@PathVariable("id") Long id){ CategoryBrandRelationEntity categoryBrandRelation = categoryBrandRelationService.getById(id); return R.ok().put("categoryBrandRelation", categoryBrandRelation); } /** * 保存 */ @RequestMapping("/save") public R save(@RequestBody CategoryBrandRelationEntity categoryBrandRelation){ categoryBrandRelationService.save(categoryBrandRelation); return R.ok(); } /** * 修改 */ @RequestMapping("/update") public R update(@RequestBody CategoryBrandRelationEntity categoryBrandRelation){ categoryBrandRelationService.updateById(categoryBrandRelation); return R.ok(); } /** * 删除 */ @RequestMapping("/delete") public R delete(@RequestBody Long[] ids){ categoryBrandRelationService.removeByIds(Arrays.asList(ids)); return R.ok(); } }
92373ce5e76e47f7cc995f49e34dcb9fda7c01c6
1,422
java
Java
cloud-provider-hystrix-payment8001/src/main/java/com/gguoliang/springcloud/PaymentHystrixMain8001.java
GGuoLiang/springcloud2020
794226753654e1ead689fbeb57a28ed3a42f6f64
[ "Apache-2.0" ]
2
2020-05-10T14:35:09.000Z
2020-05-10T14:35:11.000Z
cloud-provider-hystrix-payment8001/src/main/java/com/gguoliang/springcloud/PaymentHystrixMain8001.java
GGuoLiang/springcloud2020
794226753654e1ead689fbeb57a28ed3a42f6f64
[ "Apache-2.0" ]
null
null
null
cloud-provider-hystrix-payment8001/src/main/java/com/gguoliang/springcloud/PaymentHystrixMain8001.java
GGuoLiang/springcloud2020
794226753654e1ead689fbeb57a28ed3a42f6f64
[ "Apache-2.0" ]
null
null
null
35.55
94
0.785513
997,988
package com.gguoliang.springcloud; import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.context.annotation.Bean; /** * @Author GGuoLiang * @Date 2020/5/12 2:42 下午 * @Version 1.0 */ @SpringBootApplication @EnableEurekaClient @EnableCircuitBreaker public class PaymentHystrixMain8001 { public static void main(String[] args) { SpringApplication.run(PaymentHystrixMain8001.class,args); } /** * 此配置是为了服务监控而配置,与服务容错本身无关,springcloud升级后的坑 * ServletRegistrationBean因为SpringBoot的默认路径不是 “/hystrix.stream" * 只要在自己的项目里配置上下的servlet就可以了 */ @Bean public ServletRegistrationBean getServlet() { HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet() ; ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet); registrationBean.setLoadOnStartup(1); registrationBean.addUrlMappings("/hystrix.stream"); registrationBean.setName("HystrixMetricsStreamServlet"); return registrationBean; } }
92373ce9ebaccbe191e8d25b09efa80f55197ed2
9,879
java
Java
src/main/java/no/nav/pensjon/selvbetjeningopptjening/security/dto/AccessTokenDto.java
navikt/pensjon-selvbetjening-opptjening-backend
c77d1ad9ab04a31cb305229541ff10b510fba4ac
[ "MIT" ]
1
2022-01-12T10:54:04.000Z
2022-01-12T10:54:04.000Z
src/main/java/no/nav/pensjon/selvbetjeningopptjening/security/dto/AccessTokenDto.java
navikt/pensjon-selvbetjening-opptjening-backend
c77d1ad9ab04a31cb305229541ff10b510fba4ac
[ "MIT" ]
3
2020-08-20T12:35:07.000Z
2021-01-28T10:11:13.000Z
src/main/java/no/nav/pensjon/selvbetjeningopptjening/security/dto/AccessTokenDto.java
navikt/pensjon-selvbetjening-opptjening-backend
c77d1ad9ab04a31cb305229541ff10b510fba4ac
[ "MIT" ]
null
null
null
21.336933
71
0.602591
997,989
package no.nav.pensjon.selvbetjeningopptjening.security.dto; // Generated by www.jsonschema2pojo.org import java.util.HashMap; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @SuppressWarnings("unused") @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "aud", "iss", "iat", "nbf", "exp", "acct", "acr", "aio", "amr", "app_displayname", "appid", "appidacr", "deviceid", "family_name", "given_name", "ipaddr", "name", "oid", "onprem_sid", "platf", "puid", "rh", "scp", "signin_state", "sub", "tenant_region_scope", "tid", "unique_name", "upn", "uti", "ver", "xms_st", "xms_tcdt" }) public class AccessTokenDto { @JsonProperty("aud") private String aud; @JsonProperty("iss") private String iss; @JsonProperty("iat") private Integer iat; @JsonProperty("nbf") private Integer nbf; @JsonProperty("exp") private Integer exp; @JsonProperty("acct") private Integer acct; @JsonProperty("acr") private String acr; @JsonProperty("aio") private String aio; @JsonProperty("amr") private List<String> amr = null; @JsonProperty("app_displayname") private String appDisplayname; @JsonProperty("appid") private String appid; @JsonProperty("appidacr") private String appidacr; @JsonProperty("deviceid") private String deviceid; @JsonProperty("family_name") private String familyName; @JsonProperty("given_name") private String givenName; @JsonProperty("ipaddr") private String ipaddr; @JsonProperty("name") private String name; @JsonProperty("oid") private String oid; @JsonProperty("onprem_sid") private String onpremSid; @JsonProperty("platf") private String platf; @JsonProperty("puid") private String puid; @JsonProperty("rh") private String rh; @JsonProperty("scp") private String scp; @JsonProperty("signin_state") private List<String> signinState = null; @JsonProperty("sub") private String sub; @JsonProperty("tenant_region_scope") private String tenantRegionScope; @JsonProperty("tid") private String tid; @JsonProperty("unique_name") private String uniqueName; @JsonProperty("upn") private String upn; @JsonProperty("uti") private String uti; @JsonProperty("ver") private String ver; @JsonProperty("xms_st") private XmsStDto xmsSt; @JsonProperty("xms_tcdt") private Integer xmsTcdt; @JsonIgnore private Map<String, Object> additionalProperties = new HashMap<>(); @JsonProperty("aud") public String getAud() { return aud; } @JsonProperty("aud") public void setAud(String aud) { this.aud = aud; } @JsonProperty("iss") public String getIss() { return iss; } @JsonProperty("iss") public void setIss(String iss) { this.iss = iss; } @JsonProperty("iat") public Integer getIat() { return iat; } @JsonProperty("iat") public void setIat(Integer iat) { this.iat = iat; } @JsonProperty("nbf") public Integer getNbf() { return nbf; } @JsonProperty("nbf") public void setNbf(Integer nbf) { this.nbf = nbf; } @JsonProperty("exp") public Integer getExp() { return exp; } @JsonProperty("exp") public void setExp(Integer exp) { this.exp = exp; } @JsonProperty("acct") public Integer getAcct() { return acct; } @JsonProperty("acct") public void setAcct(Integer acct) { this.acct = acct; } @JsonProperty("acr") public String getAcr() { return acr; } @JsonProperty("acr") public void setAcr(String acr) { this.acr = acr; } @JsonProperty("aio") public String getAio() { return aio; } @JsonProperty("aio") public void setAio(String aio) { this.aio = aio; } @JsonProperty("amr") public List<String> getAmr() { return amr; } @JsonProperty("amr") public void setAmr(List<String> amr) { this.amr = amr; } @JsonProperty("app_displayname") public String getAppDisplayname() { return appDisplayname; } @JsonProperty("app_displayname") public void setAppDisplayname(String appDisplayname) { this.appDisplayname = appDisplayname; } @JsonProperty("appid") public String getAppid() { return appid; } @JsonProperty("appid") public void setAppid(String appid) { this.appid = appid; } @JsonProperty("appidacr") public String getAppidacr() { return appidacr; } @JsonProperty("appidacr") public void setAppidacr(String appidacr) { this.appidacr = appidacr; } @JsonProperty("deviceid") public String getDeviceid() { return deviceid; } @JsonProperty("deviceid") public void setDeviceid(String deviceid) { this.deviceid = deviceid; } @JsonProperty("family_name") public String getFamilyName() { return familyName; } @JsonProperty("family_name") public void setFamilyName(String familyName) { this.familyName = familyName; } @JsonProperty("given_name") public String getGivenName() { return givenName; } @JsonProperty("given_name") public void setGivenName(String givenName) { this.givenName = givenName; } @JsonProperty("ipaddr") public String getIpaddr() { return ipaddr; } @JsonProperty("ipaddr") public void setIpaddr(String ipaddr) { this.ipaddr = ipaddr; } @JsonProperty("name") public String getName() { return name; } @JsonProperty("name") public void setName(String name) { this.name = name; } @JsonProperty("oid") public String getOid() { return oid; } @JsonProperty("oid") public void setOid(String oid) { this.oid = oid; } @JsonProperty("onprem_sid") public String getOnpremSid() { return onpremSid; } @JsonProperty("onprem_sid") public void setOnpremSid(String onpremSid) { this.onpremSid = onpremSid; } @JsonProperty("platf") public String getPlatf() { return platf; } @JsonProperty("platf") public void setPlatf(String platf) { this.platf = platf; } @JsonProperty("puid") public String getPuid() { return puid; } @JsonProperty("puid") public void setPuid(String puid) { this.puid = puid; } @JsonProperty("rh") public String getRh() { return rh; } @JsonProperty("rh") public void setRh(String rh) { this.rh = rh; } @JsonProperty("scp") public String getScp() { return scp; } @JsonProperty("scp") public void setScp(String scp) { this.scp = scp; } @JsonProperty("signin_state") public List<String> getSigninState() { return signinState; } @JsonProperty("signin_state") public void setSigninState(List<String> signinState) { this.signinState = signinState; } @JsonProperty("sub") public String getSub() { return sub; } @JsonProperty("sub") public void setSub(String sub) { this.sub = sub; } @JsonProperty("tenant_region_scope") public String getTenantRegionScope() { return tenantRegionScope; } @JsonProperty("tenant_region_scope") public void setTenantRegionScope(String tenantRegionScope) { this.tenantRegionScope = tenantRegionScope; } @JsonProperty("tid") public String getTid() { return tid; } @JsonProperty("tid") public void setTid(String tid) { this.tid = tid; } @JsonProperty("unique_name") public String getUniqueName() { return uniqueName; } @JsonProperty("unique_name") public void setUniqueName(String uniqueName) { this.uniqueName = uniqueName; } @JsonProperty("upn") public String getUpn() { return upn; } @JsonProperty("upn") public void setUpn(String upn) { this.upn = upn; } @JsonProperty("uti") public String getUti() { return uti; } @JsonProperty("uti") public void setUti(String uti) { this.uti = uti; } @JsonProperty("ver") public String getVer() { return ver; } @JsonProperty("ver") public void setVer(String ver) { this.ver = ver; } @JsonProperty("xms_st") public XmsStDto getXmsSt() { return xmsSt; } @JsonProperty("xms_st") public void setXmsSt(XmsStDto xmsSt) { this.xmsSt = xmsSt; } @JsonProperty("xms_tcdt") public Integer getXmsTcdt() { return xmsTcdt; } @JsonProperty("xms_tcdt") public void setXmsTcdt(Integer xmsTcdt) { this.xmsTcdt = xmsTcdt; } @JsonAnyGetter public Map<String, Object> getAdditionalProperties() { return this.additionalProperties; } @JsonAnySetter public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } }
92373ced1e4fe9f64ae60a55ff839e7c3734997a
3,566
java
Java
aliyun-java-sdk-sas/src/main/java/com/aliyuncs/sas/model/v20181203/HandleSecurityEventsRequest.java
caojiele/aliyun-openapi-java-sdk
ecc1c949681276b3eed2500ec230637b039771b8
[ "Apache-2.0" ]
1
2022-02-12T06:01:36.000Z
2022-02-12T06:01:36.000Z
aliyun-java-sdk-sas/src/main/java/com/aliyuncs/sas/model/v20181203/HandleSecurityEventsRequest.java
caojiele/aliyun-openapi-java-sdk
ecc1c949681276b3eed2500ec230637b039771b8
[ "Apache-2.0" ]
27
2021-06-11T21:08:40.000Z
2022-03-11T21:25:09.000Z
aliyun-java-sdk-sas/src/main/java/com/aliyuncs/sas/model/v20181203/HandleSecurityEventsRequest.java
caojiele/aliyun-openapi-java-sdk
ecc1c949681276b3eed2500ec230637b039771b8
[ "Apache-2.0" ]
1
2020-03-05T07:30:16.000Z
2020-03-05T07:30:16.000Z
26.220588
118
0.730791
997,990
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.sas.model.v20181203; import com.aliyuncs.RpcAcsRequest; import java.util.List; import com.aliyuncs.http.MethodType; import com.aliyuncs.sas.Endpoint; /** * @author auto create * @version */ public class HandleSecurityEventsRequest extends RpcAcsRequest<HandleSecurityEventsResponse> { private String markMissParam; private Long resourceOwnerId; private List<String> securityEventIdss; private String sourceIp; private String operationCode; private String operationParams; private String markBatch; public HandleSecurityEventsRequest() { super("Sas", "2018-12-03", "HandleSecurityEvents", "sas"); setMethod(MethodType.POST); try { com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap); com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType); } catch (Exception e) {} } public String getMarkMissParam() { return this.markMissParam; } public void setMarkMissParam(String markMissParam) { this.markMissParam = markMissParam; if(markMissParam != null){ putQueryParameter("MarkMissParam", markMissParam); } } public Long getResourceOwnerId() { return this.resourceOwnerId; } public void setResourceOwnerId(Long resourceOwnerId) { this.resourceOwnerId = resourceOwnerId; if(resourceOwnerId != null){ putQueryParameter("ResourceOwnerId", resourceOwnerId.toString()); } } public List<String> getSecurityEventIdss() { return this.securityEventIdss; } public void setSecurityEventIdss(List<String> securityEventIdss) { this.securityEventIdss = securityEventIdss; if (securityEventIdss != null) { for (int i = 0; i < securityEventIdss.size(); i++) { putQueryParameter("SecurityEventIds." + (i + 1) , securityEventIdss.get(i)); } } } public String getSourceIp() { return this.sourceIp; } public void setSourceIp(String sourceIp) { this.sourceIp = sourceIp; if(sourceIp != null){ putQueryParameter("SourceIp", sourceIp); } } public String getOperationCode() { return this.operationCode; } public void setOperationCode(String operationCode) { this.operationCode = operationCode; if(operationCode != null){ putQueryParameter("OperationCode", operationCode); } } public String getOperationParams() { return this.operationParams; } public void setOperationParams(String operationParams) { this.operationParams = operationParams; if(operationParams != null){ putQueryParameter("OperationParams", operationParams); } } public String getMarkBatch() { return this.markBatch; } public void setMarkBatch(String markBatch) { this.markBatch = markBatch; if(markBatch != null){ putQueryParameter("MarkBatch", markBatch); } } @Override public Class<HandleSecurityEventsResponse> getResponseClass() { return HandleSecurityEventsResponse.class; } }
92373dd04937aaa5156a0443b0096af4a39e50ef
5,899
java
Java
geolocator-3.0/src/edu/berkeley/nlp/ling/CollinsHeadFinder.java
weizh/geolocator-3.0
c53545b30e31e62054aefa1e899f683630dc195d
[ "Apache-2.0" ]
4
2015-06-18T10:59:36.000Z
2020-10-02T09:15:28.000Z
geolocator-3.0/src/edu/berkeley/nlp/ling/CollinsHeadFinder.java
weizh/geolocator-3.0
c53545b30e31e62054aefa1e899f683630dc195d
[ "Apache-2.0" ]
null
null
null
geolocator-3.0/src/edu/berkeley/nlp/ling/CollinsHeadFinder.java
weizh/geolocator-3.0
c53545b30e31e62054aefa1e899f683630dc195d
[ "Apache-2.0" ]
null
null
null
40.129252
148
0.584506
997,991
package edu.berkeley.nlp.ling; //import edu.berkeley.nlp.ling.CategoryWordTag; import java.io.StringReader; import java.util.HashMap; import java.util.List; import edu.berkeley.nlp.syntax.Tree; import edu.berkeley.nlp.syntax.Trees; import edu.berkeley.nlp.treebank.PennTreebankLanguagePack; import edu.berkeley.nlp.treebank.TreebankLanguagePack; /** * Implements the HeadFinder found in Michael Collins' 1999 thesis. Except: * we've added a head rule for NX, which returns the leftmost item. No rule for * the head of NX is found in any of the versions of Collins' head table that we * have (did he perhaps use the NP rules for NX? -- no Bikel, CL, 2005 says it * defaults to leftmost). These rules are suitable for the Penn Treebank. * <p> * May 2004: Added support for AUX and AUXG to the VP rules; these cause no * interference in Penn Treebank parsing, but means that these rules also work * for the BLLIP corpus (or Charniak parser output in general). Feb 2005: Fixes * to coordination reheading so that punctuation cannot become head. * * @author Christopher Manning */ public class CollinsHeadFinder extends AbstractCollinsHeadFinder { public CollinsHeadFinder() { this(new PennTreebankLanguagePack()); } protected int postOperationFix(int headIdx, List<Tree<String>> daughterTrees) { if (headIdx >= 2) { String prevLab = daughterTrees.get(headIdx - 1).getLabel(); if (prevLab.equals("CC")) { int newHeadIdx = headIdx - 2; Tree<String> t = daughterTrees.get(newHeadIdx); while (newHeadIdx >= 0 && t.isPreTerminal() && tlp.isPunctuationTag(t.getLabel())) { newHeadIdx--; } if (newHeadIdx >= 0) { headIdx = newHeadIdx; } } } return headIdx; } @SuppressWarnings("unchecked") public CollinsHeadFinder(TreebankLanguagePack tlp) { super(tlp); nonTerminalInfo = new HashMap(); // This version from Collins' diss (1999: 236-238) nonTerminalInfo.put("ADJP", new String[][] { { "left", "NNS", "QP", "NN", "$", "ADVP", "JJ", "VBN", "VBG", "ADJP", "JJR", "NP", "JJS", "DT", "FW", "RBR", "RBS", "SBAR", "RB" } }); nonTerminalInfo.put("ADVP", new String[][] { { "right", "RB", "RBR", "RBS", "FW", "ADVP", "TO", "CD", "JJR", "JJ", "IN", "NP", "JJS", "NN" } }); nonTerminalInfo.put("CONJP", new String[][] { { "right", "CC", "RB", "IN" } }); nonTerminalInfo.put("FRAG", new String[][] { { "right" } }); // crap nonTerminalInfo.put("INTJ", new String[][] { { "left" } }); nonTerminalInfo.put("LST", new String[][] { { "right", "LS", ":" } }); nonTerminalInfo.put("NAC", new String[][] { { "left", "NN", "NNS", "NNP", "NNPS", "NP", "NAC", "EX", "$", "CD", "QP", "PRP", "VBG", "JJ", "JJS", "JJR", "ADJP", "FW" } }); nonTerminalInfo.put("NX", new String[][] { { "left" } }); // crap nonTerminalInfo.put("PP", new String[][] { { "right", "IN", "TO", "VBG", "VBN", "RP", "FW" } }); // should prefer JJ? (PP (JJ such) (IN as) (NP (NN crocidolite))) nonTerminalInfo.put("PRN", new String[][] { { "left" } }); nonTerminalInfo.put("PRT", new String[][] { { "right", "RP" } }); nonTerminalInfo.put("QP", new String[][] { { "left", "$", "IN", "NNS", "NN", "JJ", "RB", "DT", "CD", "NCD", "QP", "JJR", "JJS" } }); nonTerminalInfo.put("RRC", new String[][] { { "right", "VP", "NP", "ADVP", "ADJP", "PP" } }); nonTerminalInfo.put("S", new String[][] { { "left", "TO", "IN", "VP", "S", "SBAR", "ADJP", "UCP", "NP" } }); nonTerminalInfo.put("SBAR", new String[][] { { "left", "WHNP", "WHPP", "WHADVP", "WHADJP", "IN", "DT", "S", "SQ", "SINV", "SBAR", "FRAG" } }); nonTerminalInfo.put("SBARQ", new String[][] { { "left", "SQ", "S", "SINV", "SBARQ", "FRAG" } }); nonTerminalInfo.put("SINV", new String[][] { { "left", "VBZ", "VBD", "VBP", "VB", "MD", "VP", "S", "SINV", "ADJP", "NP" } }); nonTerminalInfo.put("SQ", new String[][] { { "left", "VBZ", "VBD", "VBP", "VB", "MD", "VP", "SQ" } }); nonTerminalInfo.put("UCP", new String[][] { { "right" } }); nonTerminalInfo.put("VP", new String[][] { { "left", "TO", "VBD", "VBN", "MD", "VBZ", "VB", "VBG", "VBP", "AUX", "AUXG", "VP", "ADJP", "NN", "NNS", "NP" } }); nonTerminalInfo.put("WHADJP", new String[][] { { "left", "CC", "WRB", "JJ", "ADJP" } }); nonTerminalInfo.put("WHADVP", new String[][] { { "right", "CC", "WRB" } }); nonTerminalInfo.put("WHNP", new String[][] { { "left", "WDT", "WP", "WP$", "WHADJP", "WHPP", "WHNP" } }); nonTerminalInfo.put("WHPP", new String[][] { { "right", "IN", "TO", "FW" } }); nonTerminalInfo.put("X", new String[][] { { "right" } }); // crap rule nonTerminalInfo.put("NP", new String[][] { { "rightdis", "NN", "NNP", "NNPS", "NNS", "NX", "POS", "JJR" }, { "left", "NP" }, { "rightdis", "$", "ADJP", "PRN" }, { "right", "CD" }, { "rightdis", "JJ", "JJS", "RB", "QP" } }); nonTerminalInfo.put("TYPO", new String[][] { { "left" } }); // another // crap // rule, for // Switchboard // (Roger) } /** * Go through trees and determine their heads and print them. Just for * debuggin'. <br> * Usage: <code> * java edu.stanford.nlp.trees.CollinsHeadFinder treebankFilePath * </code> * * @param args * The treebankFilePath */ public static void main(String[] args) { Trees.PennTreeReader reader = new Trees.PennTreeReader( new StringReader( "((S (NP (DT the) (JJ quick) (JJ (AA (BB (CC brown)))) (NN fox)) (VP (VBD jumped) (PP (IN over) (NP (DT the) (JJ lazy) (NN dog)))) (. .)))")); Tree<String> tree = reader.next(); System.out.println("tree " + tree); CollinsHeadFinder headFinder = new CollinsHeadFinder(); while (!tree.isLeaf()) { Tree<String> head = headFinder.determineHead(tree); System.out.println("head " + head); tree = head; } } private static final long serialVersionUID = -8747319554557223437L; }
92373f7761287d916c633fb8935e453048706aef
14,867
java
Java
core/src/main/java/fr/skytasul/quests/gui/creation/FinishGUI.java
Rattlyy/BeautyQuests
eda4dface9ef04fba6e5bcf756a5211346075314
[ "MIT" ]
null
null
null
core/src/main/java/fr/skytasul/quests/gui/creation/FinishGUI.java
Rattlyy/BeautyQuests
eda4dface9ef04fba6e5bcf756a5211346075314
[ "MIT" ]
null
null
null
core/src/main/java/fr/skytasul/quests/gui/creation/FinishGUI.java
Rattlyy/BeautyQuests
eda4dface9ef04fba6e5bcf756a5211346075314
[ "MIT" ]
null
null
null
42.235795
194
0.731755
997,992
package fr.skytasul.quests.gui.creation; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import fr.skytasul.quests.BeautyQuests; import fr.skytasul.quests.QuestsConfiguration; import fr.skytasul.quests.api.QuestsAPI; import fr.skytasul.quests.api.events.QuestCreateEvent; import fr.skytasul.quests.api.options.QuestOption; import fr.skytasul.quests.api.options.QuestOptionCreator; import fr.skytasul.quests.api.options.UpdatableOptionSet; import fr.skytasul.quests.api.options.UpdatableOptionSet.Updatable; import fr.skytasul.quests.api.stages.AbstractStage; import fr.skytasul.quests.api.stages.StageCreation; import fr.skytasul.quests.gui.CustomInventory; import fr.skytasul.quests.gui.Inventories; import fr.skytasul.quests.gui.ItemUtils; import fr.skytasul.quests.gui.creation.stages.StagesGUI; import fr.skytasul.quests.options.*; import fr.skytasul.quests.players.PlayerAccount; import fr.skytasul.quests.players.PlayerQuestDatas; import fr.skytasul.quests.players.PlayersManager; import fr.skytasul.quests.structure.Quest; import fr.skytasul.quests.structure.QuestBranch; import fr.skytasul.quests.utils.DebugUtils; import fr.skytasul.quests.utils.Lang; import fr.skytasul.quests.utils.Utils; import fr.skytasul.quests.utils.XMaterial; import fr.skytasul.quests.utils.nms.NMS; public class FinishGUI extends UpdatableOptionSet<Updatable> implements CustomInventory { private final StagesGUI stages; /* Temporary quest datas */ private Map<Integer, Item> clicks = new HashMap<>(); /* GUI variables */ public Inventory inv; private Player p; private boolean editing = false; private boolean stagesEdited = false; private boolean keepPlayerDatas = true; private Quest edited; private UpdatableItem done; public FinishGUI(StagesGUI gui){ stages = gui; } public FinishGUI(StagesGUI gui, Quest edited, boolean stagesEdited){ stages = gui; this.edited = edited; this.stagesEdited = stagesEdited; this.keepPlayerDatas = true; editing = true; } @Override public Inventory open(Player p){ this.p = p; if (inv == null){ String invName = Lang.INVENTORY_DETAILS.toString(); if (editing){ invName = invName + " #" + edited.getID(); if (NMS.getMCVersion() <= 8 && invName.length() > 32) invName = Lang.INVENTORY_DETAILS.toString(); // 32 characters limit in 1.8 } inv = Bukkit.createInventory(null, (int) Math.ceil(QuestOptionCreator.creators.values().stream().mapToInt(creator -> creator.slot).max().getAsInt() / 9D) * 9, invName); for (QuestOptionCreator<?, ?> creator : QuestOptionCreator.creators.values()) { QuestOption<?> option; if (edited != null && edited.hasOption(creator.optionClass)) { option = edited.getOption(creator.optionClass).clone(); }else { option = creator.optionSupplier.get(); } UpdatableItem item = new UpdatableItem(creator.slot) { @Override public void click(Player p, ItemStack item, ClickType click) { option.click(FinishGUI.this, p, item, slot, click); } @Override public boolean clickCursor(Player p, ItemStack item, ItemStack cursor) { return option.clickCursor(FinishGUI.this, p, item, cursor, slot); } @Override public void update() { if (option.shouldDisplay(FinishGUI.this)) { inv.setItem(slot, option.getItemStack(FinishGUI.this)); }else inv.setItem(slot, null); option.updatedDependencies(FinishGUI.this, inv.getItem(slot)); } }; addOption(option, item); clicks.put(creator.slot, item); } super.calculateDependencies(); for (QuestOption<?> option : this) { if (option.shouldDisplay(this)) inv.setItem(option.getOptionCreator().slot, option.getItemStack(this)); } int pageSlot = QuestOptionCreator.calculateSlot(3); clicks.put(pageSlot, new Item(pageSlot) { @Override public void click(Player p, ItemStack item, ClickType click) { Inventories.create(p, stages); } }); inv.setItem(pageSlot, ItemUtils.itemLaterPage); done = new UpdatableItem(QuestOptionCreator.calculateSlot(5)) { @Override public void update() { boolean enabled = getOption(OptionName.class).getValue() != null; XMaterial type = enabled ? XMaterial.GOLD_INGOT : XMaterial.NETHER_BRICK; String itemName = (enabled ? ChatColor.GOLD : ChatColor.DARK_PURPLE).toString() + (editing ? Lang.edit : Lang.create).toString(); String itemLore = QuestOption.formatDescription(Lang.createLore.toString()) + (enabled ? " §a✔" : " §c✖"); String[] lore = keepPlayerDatas ? new String[] { itemLore } : new String[] { itemLore, "", Lang.resetLore.toString() }; ItemStack item = inv.getItem(slot); if (item == null) { inv.setItem(slot, ItemUtils.item(type, itemName, lore)); return; }else if (!type.isSimilar(item)) { type.setType(item); ItemUtils.name(item, itemName); } ItemUtils.lore(item, lore); } @Override public void click(Player p, ItemStack item, ClickType click) { if (getOption(OptionName.class).getValue() != null) finish(); } }; done.update(); clicks.put(done.slot, done); getWrapper(OptionName.class).dependent.add(done); if (stagesEdited) setStagesEdited(true); } inv = p.openInventory(inv).getTopInventory(); return inv; } public CustomInventory reopen(Player p){ Inventories.put(p, this, inv); p.openInventory(inv); return this; } @Override public boolean onClick(Player p, Inventory inv, ItemStack current, int slot, ClickType click){ clicks.get(slot).click(p, current, click); return true; } @Override public boolean onClickCursor(Player p, Inventory inv, ItemStack current, ItemStack cursor, int slot) { return clicks.get(slot).clickCursor(p, current, cursor); } private void finish(){ Quest qu; if (editing){ edited.remove(false, false); qu = new Quest(edited.getID(), edited.getFile()); }else { int id = QuestsAPI.getQuests().getLastID() + 1; if (QuestsAPI.getQuests().getQuests().stream().anyMatch(x -> x.getID() == id)) { QuestsAPI.getQuests().incrementLastID(); BeautyQuests.logger.warning("Quest id " + id + " already taken, this should not happen."); finish(); return; } qu = new Quest(id); } if (stagesEdited) { if (keepPlayerDatas) { BeautyQuests.logger.warning("Players quests datas will be kept for quest #" + qu.getID() + " - this may cause datas issues."); }else PlayersManager.manager.removeQuestDatas(qu); } for (QuestOption<?> option : this) { if (option.hasCustomValue()) qu.addOption(option); } QuestBranch mainBranch = new QuestBranch(qu.getBranchesManager()); qu.getBranchesManager().addBranch(mainBranch); boolean failure = loadBranch(mainBranch, stages); QuestCreateEvent event = new QuestCreateEvent(p, qu, editing); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()){ qu.remove(false, true); Utils.sendMessage(p, Lang.CANCELLED.toString()); }else { QuestsAPI.getQuests().addQuest(qu); Utils.sendMessage(p, ((!editing) ? Lang.SUCCESFULLY_CREATED : Lang.SUCCESFULLY_EDITED).toString(), qu.getName(), qu.getBranchesManager().getBranchesAmount()); Utils.playPluginSound(p, "ENTITY_VILLAGER_YES", 1); BeautyQuests.logger.info("New quest created: " + qu.getName() + ", ID " + qu.getID() + ", by " + p.getName()); if (editing) { BeautyQuests.getInstance().getLogger().info("Quest " + qu.getName() + " has been edited"); if (failure) BeautyQuests.getInstance().createQuestBackup(qu.getFile().toPath(), "Error occurred while editing"); } try { qu.saveToFile(); }catch (Exception e) { Lang.ERROR_OCCURED.send(p, "initial quest save"); BeautyQuests.logger.severe("Error when trying to save newly created quest.", e); } if (keepPlayerDatas) { for (Player p : Bukkit.getOnlinePlayers()) { PlayerAccount account = PlayersManager.getPlayerAccount(p); if (account == null) continue; if (account.hasQuestDatas(qu)) { PlayerQuestDatas datas = account.getQuestDatas(qu); datas.questEdited(); if (datas.getBranch() == -1) continue; QuestBranch branch = qu.getBranchesManager().getBranch(datas.getBranch()); if (datas.isInEndingStages()) { branch.getEndingStages().keySet().forEach(stage -> stage.joins(account, p)); }else branch.getRegularStage(datas.getStage()).joins(account, p); } } } QuestsAPI.propagateQuestsHandlers(handler -> { if (editing) handler.questEdit(qu, edited, keepPlayerDatas); else handler.questCreate(qu); }); } Inventories.closeAndExit(p); } private boolean loadBranch(QuestBranch branch, StagesGUI gui) { boolean failure = false; for (StageCreation<?> creation : gui.getStageCreations()) { try{ AbstractStage stage = creation.finish(branch); if (creation.isEndingStage()) { StagesGUI newGUI = creation.getLeadingBranch(); QuestBranch newBranch = null; if (!newGUI.isEmpty()){ newBranch = new QuestBranch(branch.getBranchesManager()); branch.getBranchesManager().addBranch(newBranch); failure |= loadBranch(newBranch, newGUI); } branch.addEndStage(stage, newBranch); }else branch.addRegularStage(stage); }catch (Exception ex) { failure = true; Lang.ERROR_OCCURED.send(p, " lineToStage"); BeautyQuests.logger.severe("An error occurred wheh creating branch from GUI.", ex); } } return failure; } public void setStagesEdited(boolean force) { if (!force && stagesEdited) return; stagesEdited = true; keepPlayerDatas = false; int resetSlot = QuestOptionCreator.calculateSlot(6); inv.setItem(resetSlot, ItemUtils.itemSwitch(Lang.keepDatas.toString(), false, QuestOption.formatDescription(Lang.keepDatasLore.toString()))); clicks.put(resetSlot, new Item(resetSlot) { @Override public void click(Player p, ItemStack item, ClickType click) { keepPlayerDatas = ItemUtils.toggle(item); done.update(); } }); done.update(); } abstract class Item { protected final int slot; public Item(int slot) { this.slot = slot; } public abstract void click(Player p, ItemStack item, ClickType click); public boolean clickCursor(Player p, ItemStack item, ItemStack cursor) { return true; } } abstract class UpdatableItem extends Item implements Updatable { public UpdatableItem(int slot) { super(slot); } } public static void initialize(){ DebugUtils.logMessage("Initlializing default quest options."); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("name", 10, OptionName.class, OptionName::new, null)); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("description", 12, OptionDescription.class, OptionDescription::new, null)); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("customItem", 13, OptionQuestItem.class, OptionQuestItem::new, QuestsConfiguration.getItemMaterial(), "customMaterial")); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("confirmMessage", 15, OptionConfirmMessage.class, OptionConfirmMessage::new, null)); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("hologramText", 17, OptionHologramText.class, OptionHologramText::new, Lang.HologramText.toString())); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("bypassLimit", 18, OptionBypassLimit.class, OptionBypassLimit::new, false)); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("hideNoRequirements", 19, OptionHideNoRequirements.class, OptionHideNoRequirements::new, false)); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("startableFromGUI", 20, OptionStartable.class, OptionStartable::new, false)); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("failOnDeath", 21, OptionFailOnDeath.class, OptionFailOnDeath::new, false)); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("cancellable", 22, OptionCancellable.class, OptionCancellable::new, true)); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("cancelActions", 23, OptionCancelRewards.class, OptionCancelRewards::new, new ArrayList<>())); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("hologramLaunch", 25, OptionHologramLaunch.class, OptionHologramLaunch::new, QuestsConfiguration.getHoloLaunchItem())); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("hologramLaunchNo", 26, OptionHologramLaunchNo.class, OptionHologramLaunchNo::new, QuestsConfiguration.getHoloLaunchNoItem())); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("scoreboard", 27, OptionScoreboardEnabled.class, OptionScoreboardEnabled::new, true)); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("hide", 28, OptionHide.class, OptionHide::new, false, "hid")); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("auto", 29, OptionAutoQuest.class, OptionAutoQuest::new, false)); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("repeatable", 30, OptionRepeatable.class, OptionRepeatable::new, false, "multiple")); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("timer", 31, OptionTimer.class, OptionTimer::new, QuestsConfiguration.getTimeBetween())); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("pool", 34, OptionQuestPool.class, OptionQuestPool::new, null)); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("firework", 35, OptionFirework.class, OptionFirework::new, QuestsConfiguration.getDefaultFirework())); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("requirements", 36, OptionRequirements.class, OptionRequirements::new, new ArrayList<>())); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("startRewards", 38, OptionStartRewards.class, OptionStartRewards::new, new ArrayList<>(), "startRewardsList")); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("startMessage", 39, OptionStartMessage.class, OptionStartMessage::new, QuestsConfiguration.getPrefix() + Lang.STARTED_QUEST.toString())); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("starterNPC", 40, OptionStarterNPC.class, OptionStarterNPC::new, null, "starterID")); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("startDialog", 41, OptionStartDialog.class, OptionStartDialog::new, null)); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("endRewards", 43, OptionEndRewards.class, OptionEndRewards::new, new ArrayList<>(), "rewardsList")); QuestsAPI.registerQuestOption(new QuestOptionCreator<>("endMsg", 44, OptionEndMessage.class, OptionEndMessage::new, QuestsConfiguration.getPrefix() + Lang.FINISHED_BASE.toString())); } }
92373f79bc2b017b396e7cfc76ad0c44efc59a7c
1,158
java
Java
beatTime/src/test/java/com/andrewfleer/beatTime/AppControllerIntegrationTest.java
andrewfleer/BeatTimeSpringBoot
2223001057c81198d4362baa612eec5e7aac2542
[ "MIT" ]
null
null
null
beatTime/src/test/java/com/andrewfleer/beatTime/AppControllerIntegrationTest.java
andrewfleer/BeatTimeSpringBoot
2223001057c81198d4362baa612eec5e7aac2542
[ "MIT" ]
null
null
null
beatTime/src/test/java/com/andrewfleer/beatTime/AppControllerIntegrationTest.java
andrewfleer/BeatTimeSpringBoot
2223001057c81198d4362baa612eec5e7aac2542
[ "MIT" ]
null
null
null
27.571429
89
0.791019
997,993
package com.andrewfleer.beatTime; import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; import java.net.URL; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.http.ResponseEntity; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class AppControllerIntegrationTest { @LocalServerPort private int port; private URL base; @Autowired private TestRestTemplate template; @Before public void setUp() throws Exception { this.base = new URL("http://localhost:" + port + "/"); } @Test public void getTime() throws Exception { ResponseEntity<String> response = template.getForEntity(base.toString(), String.class); assertThat(response.getBody(), startsWith("The normal time is:")); } }
92373fcb9d4eee3a6133f5a0aae77995db06c04f
5,109
java
Java
src/main/java/org/openxmlformats/schemas/drawingml/x2006/diagram/impl/CTDiagramDefinitionHeaderLstImpl.java
pjfanning/poi-ooxml-lite-build
34af44251cb99fcdf8de2f844af686da8870e7db
[ "Apache-2.0" ]
null
null
null
src/main/java/org/openxmlformats/schemas/drawingml/x2006/diagram/impl/CTDiagramDefinitionHeaderLstImpl.java
pjfanning/poi-ooxml-lite-build
34af44251cb99fcdf8de2f844af686da8870e7db
[ "Apache-2.0" ]
null
null
null
src/main/java/org/openxmlformats/schemas/drawingml/x2006/diagram/impl/CTDiagramDefinitionHeaderLstImpl.java
pjfanning/poi-ooxml-lite-build
34af44251cb99fcdf8de2f844af686da8870e7db
[ "Apache-2.0" ]
null
null
null
37.566176
200
0.686436
997,994
/* * XML Type: CT_DiagramDefinitionHeaderLst * Namespace: http://schemas.openxmlformats.org/drawingml/2006/diagram * Java type: org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeaderLst * * Automatically generated - do not modify. */ package org.openxmlformats.schemas.drawingml.x2006.diagram.impl; import javax.xml.namespace.QName; import org.apache.xmlbeans.QNameSet; /** * An XML CT_DiagramDefinitionHeaderLst(@http://schemas.openxmlformats.org/drawingml/2006/diagram). * * This is a complex type. */ public class CTDiagramDefinitionHeaderLstImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeaderLst { private static final long serialVersionUID = 1L; public CTDiagramDefinitionHeaderLstImpl(org.apache.xmlbeans.SchemaType sType) { super(sType); } private static final QName[] PROPERTY_QNAME = { new QName("http://schemas.openxmlformats.org/drawingml/2006/diagram", "layoutDefHdr"), }; /** * Gets a List of "layoutDefHdr" elements */ @Override public java.util.List<org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeader> getLayoutDefHdrList() { synchronized (monitor()) { check_orphaned(); return new org.apache.xmlbeans.impl.values.JavaListXmlObject<>( this::getLayoutDefHdrArray, this::setLayoutDefHdrArray, this::insertNewLayoutDefHdr, this::removeLayoutDefHdr, this::sizeOfLayoutDefHdrArray ); } } /** * Gets array of all "layoutDefHdr" elements */ @Override public org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeader[] getLayoutDefHdrArray() { return getXmlObjectArray(PROPERTY_QNAME[0], new org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeader[0]); } /** * Gets ith "layoutDefHdr" element */ @Override public org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeader getLayoutDefHdrArray(int i) { synchronized (monitor()) { check_orphaned(); org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeader target = null; target = (org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeader)get_store().find_element_user(PROPERTY_QNAME[0], i); if (target == null) { throw new IndexOutOfBoundsException(); } return target; } } /** * Returns number of "layoutDefHdr" element */ @Override public int sizeOfLayoutDefHdrArray() { synchronized (monitor()) { check_orphaned(); return get_store().count_elements(PROPERTY_QNAME[0]); } } /** * Sets array of all "layoutDefHdr" element WARNING: This method is not atomicaly synchronized. */ @Override public void setLayoutDefHdrArray(org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeader[] layoutDefHdrArray) { check_orphaned(); arraySetterHelper(layoutDefHdrArray, PROPERTY_QNAME[0]); } /** * Sets ith "layoutDefHdr" element */ @Override public void setLayoutDefHdrArray(int i, org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeader layoutDefHdr) { generatedSetterHelperImpl(layoutDefHdr, PROPERTY_QNAME[0], i, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_ARRAYITEM); } /** * Inserts and returns a new empty value (as xml) as the ith "layoutDefHdr" element */ @Override public org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeader insertNewLayoutDefHdr(int i) { synchronized (monitor()) { check_orphaned(); org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeader target = null; target = (org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeader)get_store().insert_element_user(PROPERTY_QNAME[0], i); return target; } } /** * Appends and returns a new empty value (as xml) as the last "layoutDefHdr" element */ @Override public org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeader addNewLayoutDefHdr() { synchronized (monitor()) { check_orphaned(); org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeader target = null; target = (org.openxmlformats.schemas.drawingml.x2006.diagram.CTDiagramDefinitionHeader)get_store().add_element_user(PROPERTY_QNAME[0]); return target; } } /** * Removes the ith "layoutDefHdr" element */ @Override public void removeLayoutDefHdr(int i) { synchronized (monitor()) { check_orphaned(); get_store().remove_element(PROPERTY_QNAME[0], i); } } }
92373ff7d0d1729feb6938b7d9e934630caf3d08
2,587
java
Java
stubbornjava-examples/src/main/java/com/stubbornjava/examples/undertow/rest/UserRoutes.java
anama25/StubbornJava
b0a4f205a326218f2bd3ba9ca60cbf6e00a9cf81
[ "MIT" ]
230
2017-01-08T15:09:02.000Z
2022-02-10T17:46:35.000Z
stubbornjava-examples/src/main/java/com/stubbornjava/examples/undertow/rest/UserRoutes.java
alkaphreak/StubbornJava
7f5af272fac514582e77089759e0ac01405c1d42
[ "MIT" ]
294
2017-02-16T13:19:51.000Z
2022-03-29T05:17:34.000Z
stubbornjava-examples/src/main/java/com/stubbornjava/examples/undertow/rest/UserRoutes.java
alkaphreak/StubbornJava
7f5af272fac514582e77089759e0ac01405c1d42
[ "MIT" ]
133
2017-04-21T02:48:14.000Z
2022-03-23T17:28:32.000Z
35.930556
109
0.66293
997,995
package com.stubbornjava.examples.undertow.rest; import java.util.List; import com.stubbornjava.common.undertow.Exchange; import com.stubbornjava.common.undertow.handlers.ApiHandlers; import io.undertow.server.HttpServerExchange; import io.undertow.util.StatusCodes; // {{start:routes}} public class UserRoutes { private static final UserRequests userRequests = new UserRequests(); private static final UserDao userDao = new UserDao(); public static void createUser(HttpServerExchange exchange) { User userInput = userRequests.user(exchange); User user = userDao.create(userInput.getEmail(), userInput.getRoles()); if (null == user) { ApiHandlers.badRequest(exchange, String.format("User %s already exists.", userInput.getEmail())); return; } exchange.setStatusCode(StatusCodes.CREATED); Exchange.body().sendJson(exchange, user); } public static void getUser(HttpServerExchange exchange) { String email = userRequests.email(exchange); User user = userDao.get(email); if (null == user) { ApiHandlers.notFound(exchange, String.format("User %s not found.", email)); return; } Exchange.body().sendJson(exchange, user); } // Alternative Not Found by throwing / handling Exceptions. public static void getUserThrowNotFound(HttpServerExchange exchange) { String email = userRequests.email(exchange); User user = userDao.getThrowNotFound(email); Exchange.body().sendJson(exchange, user); } public static void updateUser(HttpServerExchange exchange) { User userInput = userRequests.user(exchange); User user = userDao.update(userInput); if (null == user) { ApiHandlers.notFound(exchange, String.format("User {} not found.", userInput.getEmail())); return; } Exchange.body().sendJson(exchange, user); } public static void deleteUser(HttpServerExchange exchange) { String email = userRequests.email(exchange); // If you care about it you can handle it. if (false == userDao.delete(email)) { ApiHandlers.notFound(exchange, String.format("User {} not found.", email)); return; } exchange.setStatusCode(StatusCodes.NO_CONTENT); exchange.endExchange(); } public static void listUsers(HttpServerExchange exchange) { List<User> users = userDao.listUsers(); Exchange.body().sendJson(exchange, users); } } //{{end:routes}}
9237401edafecb615e9be1c417fc18fa719e1669
6,424
java
Java
src/main/java/com/root101/swing/bundles/jop/_DialogOptionPane.java
JesusHdezWaterloo/MaterialSwing
e8c528878604996fa926b0ab5c1341b58d36d45a
[ "Apache-2.0" ]
1
2020-04-30T07:24:34.000Z
2020-04-30T07:24:34.000Z
src/main/java/com/root101/swing/bundles/jop/_DialogOptionPane.java
JesusHdezWaterloo/MaterialSwing
e8c528878604996fa926b0ab5c1341b58d36d45a
[ "Apache-2.0" ]
null
null
null
src/main/java/com/root101/swing/bundles/jop/_DialogOptionPane.java
JesusHdezWaterloo/MaterialSwing
e8c528878604996fa926b0ab5c1341b58d36d45a
[ "Apache-2.0" ]
null
null
null
33.696335
89
0.664854
997,996
/* * Copyright 2021 Root101 (dycjh@example.com, +53-5-426-8660). * * 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 * * Or read it directly from LICENCE.txt file at the root of this project. * 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.root101.swing.bundles.jop; import java.awt.Color; import java.awt.Dialog; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JDialog; import javax.swing.JPanel; import com.root101.swing.util.interfaces.MaterialComponent; import com.root101.swing.material.standards.MaterialColors; /** * * @author Root101 (dycjh@example.com, +53-5-426-8660) * @author JesusHdezWaterloo@Github */ public class _DialogOptionPane extends JDialog implements MaterialComponent { private final _OptionPanel optionPane; public _DialogOptionPane(OptionPanelBuilder builder) { super(); this.optionPane = new _OptionPanel(); this.setUndecorated(true); this.setBackground(MaterialColors.TRANSPARENT); this.setUndecorated(builder.undecorated); optionPane.setInternalPanel(builder.panel); optionPane.getButtonPositive().addActionListener(builder.positiveButtonListener); optionPane.getButtonNegative().addActionListener(builder.negativeButtonListener); validates(builder); disposes(); setUpDialog(optionPane); } private void validates(OptionPanelBuilder builder) { if (builder.backgroundColor != null) { optionPane.setBackground(builder.backgroundColor); } if (builder.buttonPositiveText != null) { optionPane.setButtonPositiveText(builder.buttonPositiveText); } if (builder.buttonNegativeText != null) { optionPane.setButtonNegativeText(builder.buttonNegativeText); } if (builder.buttonPositiveBackground != null) { optionPane.setButtonPositiveBackground(builder.buttonPositiveBackground); } if (builder.buttonNegativeBackground != null) { optionPane.setButtonNegativeBackground(builder.buttonNegativeBackground); } if (builder.buttonsBackground != null) { optionPane.setButtonsBackground(builder.buttonsBackground); } if (builder.internalPanelBackground != null) { optionPane.setInternalPanelBackgroun(builder.internalPanelBackground); } if (builder.setTouchOutside) { this.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); } else { this.setModalityType(Dialog.ModalityType.MODELESS); } if (builder.title != null) { this.setTitle(builder.title); } } private void setUpDialog(_OptionPanel optionPane) { this.setLayout(new GridLayout(1, 1)); this.add(optionPane); this.setSize(optionPane.getPreferredSize()); this.setLocationRelativeTo(null); this.setResizable(false); this.setVisible(true); } private void disposes() { optionPane.getButtonPositive().addActionListener((ActionEvent e) -> { dispose(); }); optionPane.getButtonNegative().addActionListener((ActionEvent e) -> { dispose(); }); } public static class OptionPanelBuilder { private final JPanel panel; private ActionListener positiveButtonListener; private ActionListener negativeButtonListener; private Color backgroundColor; private Color buttonPositiveBackground; private Color buttonNegativeBackground; private Color buttonsBackground; private Color internalPanelBackground; private String buttonPositiveText; private String buttonNegativeText; private String title; private boolean setTouchOutside; private boolean undecorated; public OptionPanelBuilder(JPanel panel) { this.panel = panel; } public OptionPanelBuilder setPositiveButtonListener(ActionListener listener) { this.positiveButtonListener = listener; return this; } public OptionPanelBuilder setNegativeButtonListener(ActionListener listener) { this.negativeButtonListener = listener; return this; } public OptionPanelBuilder setBackgroundColor(Color color) { this.backgroundColor = color; return this; } public OptionPanelBuilder setButtonPositiveBackground(Color color) { this.buttonPositiveBackground = color; return this; } public OptionPanelBuilder setButtonNegativeBackground(Color color) { this.buttonNegativeBackground = color; return this; } public OptionPanelBuilder setInternalPanelBackground(Color color) { this.internalPanelBackground = color; return this; } public OptionPanelBuilder setButtonsBackground(Color color) { this.buttonsBackground = color; return this; } public OptionPanelBuilder setTouchOutside(Boolean bool) { this.setTouchOutside = bool; return this; } public OptionPanelBuilder setUndecorated(Boolean bool) { this.undecorated = bool; return this; } public OptionPanelBuilder setTitle(String text) { this.title = text; return this; } public OptionPanelBuilder setButtonPositiveText(String text) { this.buttonPositiveText = text; return this; } public OptionPanelBuilder setButtonNegativeText(String text) { this.buttonNegativeText = text; return this; } public _DialogOptionPane build() { return new _DialogOptionPane(this); } } }
923741508698a1cc00603cbc87612771779ccfe3
1,705
java
Java
ruoyi-ecloud/src/main/java/com/ruoyi/ecloud/service/impl/CmtServiceImpl.java
smileyf-wb/ecloud
dbd120125c3d8899ce66135e160323791396c118
[ "MIT" ]
null
null
null
ruoyi-ecloud/src/main/java/com/ruoyi/ecloud/service/impl/CmtServiceImpl.java
smileyf-wb/ecloud
dbd120125c3d8899ce66135e160323791396c118
[ "MIT" ]
null
null
null
ruoyi-ecloud/src/main/java/com/ruoyi/ecloud/service/impl/CmtServiceImpl.java
smileyf-wb/ecloud
dbd120125c3d8899ce66135e160323791396c118
[ "MIT" ]
null
null
null
18.138298
62
0.59824
997,997
package com.ruoyi.ecloud.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.ecloud.mapper.CmtMapper; import com.ruoyi.ecloud.domain.Cmt; import com.ruoyi.ecloud.service.ICmtService; /** * 补水箱运行信息Service业务层处理 * * @author zhaojie * @date 2020-08-18 */ @Service public class CmtServiceImpl implements ICmtService { @Autowired private CmtMapper cmtMapper; /** * 查询补水箱运行信息 * * @param cmtId 补水箱运行信息ID * @return 补水箱运行信息 */ @Override public Cmt selectCmtById(String cmtId) { return cmtMapper.selectCmtById(cmtId); } /** * 查询补水箱运行信息列表 * * @param cmt 补水箱运行信息 * @return 补水箱运行信息 */ @Override public List<Cmt> selectCmtList(Cmt cmt) { return cmtMapper.selectCmtList(cmt); } /** * 新增补水箱运行信息 * * @param cmt 补水箱运行信息 * @return 结果 */ @Override public int insertCmt(Cmt cmt) { return cmtMapper.insertCmt(cmt); } /** * 修改补水箱运行信息 * * @param cmt 补水箱运行信息 * @return 结果 */ @Override public int updateCmt(Cmt cmt) { return cmtMapper.updateCmt(cmt); } /** * 批量删除补水箱运行信息 * * @param cmtIds 需要删除的补水箱运行信息ID * @return 结果 */ @Override public int deleteCmtByIds(String[] cmtIds) { return cmtMapper.deleteCmtByIds(cmtIds); } /** * 删除补水箱运行信息信息 * * @param cmtId 补水箱运行信息ID * @return 结果 */ @Override public int deleteCmtById(String cmtId) { return cmtMapper.deleteCmtById(cmtId); } }
9237420954bb601eeec140b9bfb3001a5c8a4e02
2,630
java
Java
src/main/java/seedu/address/logic/commands/datamanagement/RemoveTagFromModuleCommand.java
halfwhole/main
6eb87de7a3eba615fe09989eea2943f593a879a2
[ "MIT" ]
null
null
null
src/main/java/seedu/address/logic/commands/datamanagement/RemoveTagFromModuleCommand.java
halfwhole/main
6eb87de7a3eba615fe09989eea2943f593a879a2
[ "MIT" ]
null
null
null
src/main/java/seedu/address/logic/commands/datamanagement/RemoveTagFromModuleCommand.java
halfwhole/main
6eb87de7a3eba615fe09989eea2943f593a879a2
[ "MIT" ]
null
null
null
36.027397
119
0.704563
997,998
package seedu.address.logic.commands.datamanagement; import static java.util.Objects.requireNonNull; import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; import seedu.address.logic.commands.Command; import seedu.address.logic.commands.CommandResult; import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.model.Model; import seedu.address.model.tag.Tag; import seedu.address.model.tag.UserTag; import seedu.address.model.tag.exceptions.TagNotFoundException; /** * Removes a {@code Tag} from a {@code Module}. */ public class RemoveTagFromModuleCommand extends Command { public static final String COMMAND_WORD = "removetag"; public static final String MESSAGE_USAGE = COMMAND_WORD + " : Removes the specified tag from the specified module " + "Parameters: " + "MODULE_CODE " + "TAG_NAME \n" + "Example: " + "remove CS3230 exchange"; public static final String MESSAGE_SUCCESS = "Tag %1$s removed from %2$s"; public static final String MESSAGE_TAG_NOT_FOUND = "The module %1$s does not have the tag [%2$s]"; public static final String MESSAGE_INVALID_DEFAULT_TAG_MODIFICATION = "Default tags cannot be removed"; private final String tagName; private final String moduleCode; /** * Creates an {@code RemoveTagFromModuleCommand} to move a tag with the given name from the specified module. * * @param tagName The name of the tag. * @param moduleCode The module code of the module from which the tag is to be deleted. */ public RemoveTagFromModuleCommand(String moduleCode, String tagName) { requireAllNonNull(tagName, moduleCode); this.tagName = tagName; this.moduleCode = moduleCode; } @Override public CommandResult execute(Model model) throws CommandException { requireNonNull(model); Tag toRemove; try { toRemove = model.getTagFromActiveSp(tagName); } catch (TagNotFoundException exception) { throw new CommandException(String.format(MESSAGE_TAG_NOT_FOUND, moduleCode, tagName)); } if (toRemove.isDefault()) { throw new CommandException(MESSAGE_INVALID_DEFAULT_TAG_MODIFICATION); } boolean removed = model.removeTagFromModuleInActiveSp((UserTag) toRemove, moduleCode); if (!removed) { throw new CommandException(String.format(MESSAGE_TAG_NOT_FOUND, moduleCode, tagName)); } return new CommandResult(String.format(MESSAGE_SUCCESS, toRemove, moduleCode)); } }
92374416fc1caf45410614583e6b6e1df194b64d
2,105
java
Java
src/test/java/org/jboss/modules/SystemResourcesTest.java
soul2zimate/jboss-modules
5f432017b1620f849d9aa236b6c80cf895f8b8ac
[ "Apache-2.0" ]
1
2017-02-18T19:14:58.000Z
2017-02-18T19:14:58.000Z
src/test/java/org/jboss/modules/SystemResourcesTest.java
soul2zimate/jboss-modules
5f432017b1620f849d9aa236b6c80cf895f8b8ac
[ "Apache-2.0" ]
null
null
null
src/test/java/org/jboss/modules/SystemResourcesTest.java
soul2zimate/jboss-modules
5f432017b1620f849d9aa236b6c80cf895f8b8ac
[ "Apache-2.0" ]
null
null
null
33.951613
181
0.723515
997,999
/* * JBoss, Home of Professional Open Source. * Copyright 2014 Red Hat, Inc., and individual contributors * as indicated by the @author tags. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jboss.modules; import java.net.URL; import java.util.Enumeration; import org.jboss.modules.util.TestModuleLoader; import org.junit.Assert; import org.junit.Test; /** * Test System pkgs resources * * @author Jason T. Greene */ public class SystemResourcesTest { private static final ModuleIdentifier MODULE_A = ModuleIdentifier.fromString("A"); static { System.setProperty("jboss.modules.system.pkgs", "javax.activation"); } @Test public void testResources() throws Exception { final TestModuleLoader moduleLoader = new TestModuleLoader(); ModuleSpec.Builder builder = ModuleSpec.build(MODULE_A); //builder.addDependency(DependencySpec.createModuleDependencySpec(PathFilters.match("org/jboss/modules/**"), PathFilters.rejectAll(), null, ModuleIdentifier.SYSTEM, false)); moduleLoader.addModuleSpec(builder.create()); Module module = moduleLoader.loadModule(MODULE_A); ClassLoader cl = module.getClassLoader(); Enumeration<URL> resources = cl.getResources("javax/activation/DataHandler.class"); Assert.assertTrue(resources.hasMoreElements()); resources = cl.getResources("javax/sql/RowSet.class"); Assert.assertFalse(resources.hasMoreElements()); resources = cl.getResources("org/jboss/"); Assert.assertFalse(resources.hasMoreElements()); } }
923745251a5b3497ba9171b653f9130b35aa80db
121
java
Java
src/main/java/br/com/zupacademy/natalia/proposta/proposta/enums/CarteirasEmissor.java
natyff/orange-talents-05-template-proposta
5781bec977825844fde94244a13c7539c4b991e9
[ "Apache-2.0" ]
null
null
null
src/main/java/br/com/zupacademy/natalia/proposta/proposta/enums/CarteirasEmissor.java
natyff/orange-talents-05-template-proposta
5781bec977825844fde94244a13c7539c4b991e9
[ "Apache-2.0" ]
null
null
null
src/main/java/br/com/zupacademy/natalia/proposta/proposta/enums/CarteirasEmissor.java
natyff/orange-talents-05-template-proposta
5781bec977825844fde94244a13c7539c4b991e9
[ "Apache-2.0" ]
null
null
null
17.285714
58
0.768595
998,000
package br.com.zupacademy.natalia.proposta.proposta.enums; public enum CarteirasEmissor { PAYPAL, SAMSUNG_PAY }
923745a84c5af398ae579b60233d393013cb64e4
3,008
java
Java
src/test/java/com/estudos/protocolo/ApiProtocoloApplicationTests.java
guilhermevicente/api-protocolo
34abc3a72edcdffe281e0f1025a9bb7fc698af3d
[ "Apache-2.0" ]
null
null
null
src/test/java/com/estudos/protocolo/ApiProtocoloApplicationTests.java
guilhermevicente/api-protocolo
34abc3a72edcdffe281e0f1025a9bb7fc698af3d
[ "Apache-2.0" ]
null
null
null
src/test/java/com/estudos/protocolo/ApiProtocoloApplicationTests.java
guilhermevicente/api-protocolo
34abc3a72edcdffe281e0f1025a9bb7fc698af3d
[ "Apache-2.0" ]
null
null
null
26.857143
74
0.765293
998,001
package com.estudos.protocolo; import java.util.List; import org.junit.Assert; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.test.context.junit4.SpringRunner; import com.estudos.protocolo.domain.Protocolo; import com.estudos.protocolo.dto.ProtocoloDto; import com.estudos.protocolo.service.ProtocoloService; import com.estudos.protocolo.service.impl.ProtocoloServiceImpl; @RunWith(SpringRunner.class) @SpringBootTest class ApiProtocoloApplicationTests { @Autowired private ProtocoloService service; @TestConfiguration static class EmployeeServiceImplTestContextConfiguration { @Bean public ProtocoloService service() { return new ProtocoloServiceImpl(); } } @BeforeEach public void antesDeCadaTest() { service.listar().forEach(p -> { service.apagar(p.getId()); }); } @Test void criarProtocolo() { final ProtocoloDto dto = TestFactory.getProtocolo(); final Protocolo criado = service.criar(dto); Assert.assertEquals(criado.getAutor(), dto.getAutor()); Assert.assertEquals(criado.getTipo(), dto.getTipo()); Assert.assertEquals(criado.getUsuario(), dto.getUsuario()); Assert.assertNotNull(criado.getId()); Assert.assertNotNull(criado.getChave()); Assert.assertNotNull(criado.getDocumentos()); } @Test void atualizarProtocolo() { final Protocolo criado = service.criar(TestFactory.getProtocolo()); final ProtocoloDto dto = TestFactory.getProtocolo(); dto.setAutor("autor-alterado"); final Protocolo atualizado = service.atualizar(dto, criado.getId()); Assert.assertEquals("autor-alterado", atualizado.getAutor()); } @Test void atualizarProtocoloInexistente() { final Protocolo criado = service.criar(TestFactory.getProtocolo()); final ProtocoloDto dto = TestFactory.getProtocolo(); dto.setAutor("autor-alterado"); final Protocolo atualizado = service.atualizar(dto, criado.getId() + 1); Assert.assertEquals("autor-alterado", atualizado.getAutor()); } @Test void buscarProtocolos() { service.criar(TestFactory.getProtocolo()); service.criar(TestFactory.getProtocolo()); service.criar(TestFactory.getProtocolo()); final List<Protocolo> listados = service.listar(); Assert.assertEquals(3, listados.size()); } @Test void buscarPorId() { final Protocolo criado = service.criar(TestFactory.getProtocolo()); final Protocolo listado = service.listar(criado.getId()); Assert.assertEquals(criado, listado); } @Test void apagar() { final Protocolo criado = service.criar(TestFactory.getProtocolo()); Assert.assertNotNull(criado); final Long id = criado.getId(); service.apagar(id); final Protocolo buscado = service.listar(id); Assert.assertNull(buscado); } }
923746cbe128e56824fa9f1e5f90fc7ce406b0ab
1,089
java
Java
src/main/java/com/attask/jenkins/templates/SaveListener.java
abozzoni/Templating
a9bbbd70a29fb3207a3ac73e503f83de50ab2205
[ "Apache-2.0" ]
1
2015-01-03T04:30:07.000Z
2015-01-03T04:30:07.000Z
src/main/java/com/attask/jenkins/templates/SaveListener.java
JoelJ/Templating
a9bbbd70a29fb3207a3ac73e503f83de50ab2205
[ "Apache-2.0" ]
null
null
null
src/main/java/com/attask/jenkins/templates/SaveListener.java
JoelJ/Templating
a9bbbd70a29fb3207a3ac73e503f83de50ab2205
[ "Apache-2.0" ]
null
null
null
31.114286
140
0.762167
998,002
package com.attask.jenkins.templates; import hudson.Extension; import hudson.XmlFile; import hudson.model.BuildableItemWithBuildWrappers; import hudson.model.Descriptor; import hudson.model.Saveable; import hudson.model.listeners.SaveableListener; import hudson.tasks.BuildWrapper; import hudson.util.DescribableList; import java.io.IOException; /** * User: Joel Johnson * Date: 6/19/12 * Time: 7:54 AM */ //@Extension //public class SaveListener extends SaveableListener { // @Override // public void onChange(Saveable o, XmlFile file) { // if(o instanceof BuildableItemWithBuildWrappers) { // DescribableList<BuildWrapper,Descriptor<BuildWrapper>> buildWrappersList = ((BuildableItemWithBuildWrappers) o).getBuildWrappersList(); // for (BuildWrapper buildWrapper : buildWrappersList) { // if(buildWrapper instanceof TemplateBuildWrapper) { // ((TemplateBuildWrapper) buildWrapper).setSynced(false); // } else if(buildWrapper instanceof ImplementationBuildWrapper) { // ((ImplementationBuildWrapper) buildWrapper).setSynced(false); // } // } // } // } //}
923746f3a23f50deaaafd6c6f879cec656aad5d7
743
java
Java
src/main/java/org/avphs/coreinterface/CarCommand.java
AutonomousCarProject/auto_racer
dab0dd71d61424005bd13e93eb88c0f1650e84a1
[ "Apache-2.0" ]
1
2019-07-30T19:31:49.000Z
2019-07-30T19:31:49.000Z
src/main/java/org/avphs/coreinterface/CarCommand.java
AutonomousCarProject/auto_racer
dab0dd71d61424005bd13e93eb88c0f1650e84a1
[ "Apache-2.0" ]
15
2019-05-08T19:07:01.000Z
2019-08-01T17:16:10.000Z
src/main/java/org/avphs/coreinterface/CarCommand.java
AutonomousCarProject/auto_racer
dab0dd71d61424005bd13e93eb88c0f1650e84a1
[ "Apache-2.0" ]
3
2019-07-09T16:36:52.000Z
2019-07-09T17:33:49.000Z
32.304348
99
0.69852
998,003
package org.avphs.coreinterface; public class CarCommand { public CarCommandType command; public Object[] parameters; public CarCommand(CarCommandType command, Object[] parameters) { this.command = command; this.parameters = parameters; } public static CarCommand accelerate(boolean absolute, int angle) { return new CarCommand(CarCommandType.ACCELERATE_COMMAND, new Object[] { absolute, angle }); } public static CarCommand steer(boolean absolute, int angle) { return new CarCommand(CarCommandType.STEER_COMMAND, new Object[] { absolute, angle }); } public static CarCommand stop() { return new CarCommand(CarCommandType.STOP_COMMAND, new Object[] { }); } }
923747eba10145b9e84ddbb72a0cca598fb68365
9,602
java
Java
DragonDriver.java
abeeku/itsadventuretime
08ad6fd3c28ffab120cd2933f225cb220a3b69e3
[ "Apache-2.0" ]
null
null
null
DragonDriver.java
abeeku/itsadventuretime
08ad6fd3c28ffab120cd2933f225cb220a3b69e3
[ "Apache-2.0" ]
null
null
null
DragonDriver.java
abeeku/itsadventuretime
08ad6fd3c28ffab120cd2933f225cb220a3b69e3
[ "Apache-2.0" ]
null
null
null
34.916364
158
0.469902
998,004
import java.util.ArrayList; import java.util.Scanner; public class DragonDriver { public static void main(String[] args) { ArrayList<Dragon> dragons = new ArrayList<Dragon>(); System.out.println("===================================================================Dragons==========================================================="); Dragon mark = new Dragon( "Mark", 200, true, "None", true, new String[] {"nono"}, true ); Dragon eylin = new Dragon( "Eylin", 65, true, "Wavy", false, new String[] {"mouth","horns"}, true ); Dragon prince = new Dragon( "Prince", 46, false, "Large", false, new String[] {""}, true ); Dragon jillian = new Dragon( "Jillian", 30, false, "Small", false, new String[] {"horns"}, true ); Dragon anthony = new Dragon( "Anthony", 40, true, "Turkey", true, new String[] {"pilgrim hat","boots","stingray tail"}, false ); Dragon liberty = new Dragon( "Liberty", //Name 800, // Tail Length false, //Mouth Open "None", // Wings true, // SnakeLike? new String[] {"mohawk"}, //Accessories true // Breathe Fire ); Dragon ku = new Dragon( "Abeeku", //Name 121, // Tail Length true, //Mouth Open "Dragon", // Wings false, // SnakeLike? new String[] {"muscles"}, //Accessories true // Breathe Fire ); Dragon kyle = new Dragon( "Kyle", //Name 51, // Tail Length true, //Mouth Open "Fly", // Wings false, // SnakeLike? new String[] {"stingray tail"}, //Accessories true // Breathe Fire ); Dragon imani = new Dragon( "Imani", //Name 75, // Tail Length false, //Mouth Open "Span", // Wings false, // SnakeLike? new String[] {"sunglasses"}, //Accessories false // Breathe Fire ); Dragon evan = new Dragon( "Evan", //Name 15, // Tail Length false, //Mouth Open "Batlike", // Wings false, // SnakeLike? new String[] {"nono"}, //Accessories false // Breathe Fire ); Dragon yoli = new Dragon( "Yoli", //Name 15, // Tail Length false, //Mouth Open "None", // Wings false, // SnakeLike? new String[] {"horns","bow","spots"}, //Accessories true // Breathe Fire ); Dragon richard = new Dragon( "Richard", new String[] {"fangs"} ); Dragon franchesca = new Dragon( "Franchesca", //Name 15, // Tail Length true, //Mouth Open "Regular", // Wings true, // SnakeLike? new String[] {"horns","extra hands"}, //Accessories true // Breathe Fire ); Dragon christian = new Dragon( "Christian", //Name new String[] {"fangs"} //Accessories ); Dragon chrissy = new Dragon( "Chrissy", //Name new String[] {"red eyes"} //Accessories ); Dragon festus = new Dragon( "Festus", //Name new String[] {"horns","fins"} //Accessories ); dragons.add(ku);System.out.println(ku);sleep(); dragons.add(festus);System.out.println(festus);sleep(); dragons.add(kyle);System.out.println(kyle);sleep(); dragons.add(christian);System.out.println(christian);sleep(); dragons.add(chrissy);System.out.println(chrissy);sleep(); dragons.add(eylin);System.out.println(eylin);sleep(); dragons.add(imani);System.out.println(eylin);sleep(); dragons.add(mark);System.out.println(mark);sleep(); dragons.add(yoli);System.out.println(yoli);sleep(); dragons.add(jillian);System.out.println(jillian);sleep(); dragons.add(anthony);System.out.println(anthony);sleep(); dragons.add(prince);System.out.println(prince);sleep(); dragons.add(franchesca);System.out.println(franchesca);sleep(); dragons.add(richard);System.out.println(richard);sleep(); dragons.add(evan);System.out.println(evan);sleep(); dragons.add(liberty);System.out.println(liberty);sleep(); //for(int i=0;i<=dragons.size();i++) { System.out.println("Before Changes....."); System.out.println(dragons); System.out.println(" ( ) /\\ _ ( "); System.out.println(" \\ | ( \\ ( \\.( ) _____"); System.out.println(" \\ \\ \\ ` ` ) \\ ( ___ / _ \\"); System.out.println(" (_` \\+ . x ( .\\ \\/ \\____-----------/ (o) \\_"); System.out.println("- .- \\+ ; ( O \\____"); System.out.println(" ) \\_____________ ` \\ /"); System.out.println("(__ +- .( -'.- <. - _ VVVVVVV VV V\\ \\/"); System.out.println("(_____ ._._: <_ - <- _ (-- _AAAAAAA__A_/ |"); System.out.println(" . /./.+- . .- / +-- - . \\______________//_ \\_______"); System.out.println(" (__ ' /x / x _/ ( \\___' \\ /"); System.out.println(" , x / ( ' . / . / | \\ /"); System.out.println(" / / _/ / + / \\/"); System.out.println(" ' (__/ / \\"); Dragon d1 = new Dragon(); dragons.add(d1); Dragon d2 = new Dragon("Rick James",70,true,"wide",true,(new String[] {"hat","boots"}),false); d1.breatheFire(d2); d1.toggleMouth(); d1.setName(ku.getName()); d1.hit(); d1.setWingType(ku.getWingType()); d1.setBreathFire(ku.isBreathFire()); d1.setAccessories(ku.getAccessories()); d1.setSnakelike(ku.isSnakelike()); d1.setHealth(ku.getHealth()); d1.setTailLength(ku.getTailLength()); d1.setWingType(ku.getWingType()); d1.setWingType(ku.getWingType()); d1.setWingType(ku.getWingType()); d1.breatheFire(d2); System.out.println(d1); System.out.println(d2); d1.setWingType("Fan"); d2.heal(40); System.out.println("....After changes"); System.out.println(" /\\ /\\__"); System.out.println(" // \\ ( 0 )_____/\\ __"); System.out.println(" // \\ \\ (vv o| /^v\\"); System.out.println(" // \\ \\ (vvvv ___-----^ /^^/\\vv\\"); System.out.println(" // / \\ \\ |vvvvv/ /^^/ \\v\\"); System.out.println(" // / (\\\\/vvvv/ /^^/ \\v\\"); System.out.println(" // / / \\ ( /vvvv/ /^^/---( \\v\\"); System.out.println(" // / / \\( /vvvv/----(O /^^/ \\v\\"); System.out.println(" // / / \\ (/vvvv/ /^^/ \\v|"); System.out.println(" // / / \\( vvvv/ /^^/ ||"); System.out.println(" // / / ( vvvv/ |^^| //"); System.out.println(" // / / ( |vvvv| /^^/ //"); System.out.println(" // / / ( \\vvvvv\\ )-----/^^/ //"); System.out.println(" // / / ( \\vvvvv\\ /^^^/ //"); System.out.println(" /// /( \\vvvvv\\ /^^^^/ //"); System.out.println(" ///( )-----\\vvvvv\\ /^^^^/-----( \\\\"); System.out.println(" //( \\vvvvv\\/^^^^/ \\\\"); System.out.println("/( \\vvvv^^^/ //"); System.out.println(" \\vv^/ / //"); System.out.println(" /<______//"); System.out.println(" <<<------/"); System.out.println(" \\<"); System.out.println(" \\"); System.out.println(dragons); System.out.println("Do you want to make your own dragon?(Hint: say \"YES!\") "); Scanner s = new Scanner(System.in); Scanner s2 = new Scanner(System.in); Scanner s3 = new Scanner(System.in); Scanner s4 = new Scanner(System.in); if (s.nextLine().equals("YES!")){ System.out.print("Name: "); String name = s.nextLine(); System.out.print("Tail length: "); int tL = s.nextInt(); System.out.print("Mouth Open?(true/false): "); boolean mO = s.nextBoolean(); System.out.print("Wing Type: "); String wT = s2.nextLine(); System.out.print("Is Snakelike?(true/false): "); boolean iS = s.nextBoolean(); String [] acc = new String[] {}; System.out.print("Accessories (Y/N): "); if(s3.nextLine().equals("Y")){ System.out.println("Enter all your accessories seperated by commas:"); String val = s4.nextLine(); acc = val.split(","); } else { acc = new String[] {}; } System.out.print("Breathes Fire?(true/false): "); boolean bf = s.nextBoolean(); System.out.println("Your dragon is ready.........."); Dragon custom = new Dragon(name,tL,mO,wT,iS,acc,bf); System.out.println(custom); }else { System.out.println("Thats too bad. :( Youre missing out"); }; } public static void sleep() { try { Thread.sleep(500); //1000 milliseconds is one second. } catch(InterruptedException ex) { Thread.currentThread().interrupt(); } } }
9237489de5f45e676156bbb752911300e667c06d
21,136
java
Java
gen-grpc/main/java/org/jetbrains/r/rinterop/Polyline.java
DeagleGross/Rplugin
8a2cfd87f732e658b3de07a202c058a9a9d63f11
[ "MIT", "BSD-2-Clause", "Apache-2.0" ]
52
2019-10-24T17:16:53.000Z
2022-02-09T22:19:02.000Z
gen-grpc/main/java/org/jetbrains/r/rinterop/Polyline.java
DeagleGross/Rplugin
8a2cfd87f732e658b3de07a202c058a9a9d63f11
[ "MIT", "BSD-2-Clause", "Apache-2.0" ]
3
2019-10-24T17:26:36.000Z
2021-06-28T12:25:20.000Z
gen-grpc/main/java/org/jetbrains/r/rinterop/Polyline.java
DeagleGross/Rplugin
8a2cfd87f732e658b3de07a202c058a9a9d63f11
[ "MIT", "BSD-2-Clause", "Apache-2.0" ]
13
2020-02-16T00:07:56.000Z
2022-03-21T10:49:52.000Z
31.975794
104
0.66654
998,005
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: service.proto package org.jetbrains.r.rinterop; /** * Protobuf type {@code rplugininterop.Polyline} */ public final class Polyline extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:rplugininterop.Polyline) PolylineOrBuilder { private static final long serialVersionUID = 0L; // Use Polyline.newBuilder() to construct. private Polyline(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Polyline() { point_ = emptyLongList(); } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new Polyline(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Polyline( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 9: { if (!((mutable_bitField0_ & 0x00000001) != 0)) { point_ = newLongList(); mutable_bitField0_ |= 0x00000001; } point_.addLong(input.readFixed64()); break; } case 10: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) { point_ = newLongList(); mutable_bitField0_ |= 0x00000001; } while (input.getBytesUntilLimit() > 0) { point_.addLong(input.readFixed64()); } input.popLimit(limit); break; } case 16: { previewCount_ = input.readInt32(); break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) != 0)) { point_.makeImmutable(); // C } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.jetbrains.r.rinterop.Service.internal_static_rplugininterop_Polyline_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.jetbrains.r.rinterop.Service.internal_static_rplugininterop_Polyline_fieldAccessorTable .ensureFieldAccessorsInitialized( org.jetbrains.r.rinterop.Polyline.class, org.jetbrains.r.rinterop.Polyline.Builder.class); } public static final int POINT_FIELD_NUMBER = 1; private com.google.protobuf.Internal.LongList point_; /** * <code>repeated fixed64 point = 1;</code> * @return A list containing the point. */ @java.lang.Override public java.util.List<java.lang.Long> getPointList() { return point_; } /** * <code>repeated fixed64 point = 1;</code> * @return The count of point. */ public int getPointCount() { return point_.size(); } /** * <code>repeated fixed64 point = 1;</code> * @param index The index of the element to return. * @return The point at the given index. */ public long getPoint(int index) { return point_.getLong(index); } private int pointMemoizedSerializedSize = -1; public static final int PREVIEWCOUNT_FIELD_NUMBER = 2; private int previewCount_; /** * <code>int32 previewCount = 2;</code> * @return The previewCount. */ @java.lang.Override public int getPreviewCount() { return previewCount_; } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (getPointList().size() > 0) { output.writeUInt32NoTag(10); output.writeUInt32NoTag(pointMemoizedSerializedSize); } for (int i = 0; i < point_.size(); i++) { output.writeFixed64NoTag(point_.getLong(i)); } if (previewCount_ != 0) { output.writeInt32(2, previewCount_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; { int dataSize = 0; dataSize = 8 * getPointList().size(); size += dataSize; if (!getPointList().isEmpty()) { size += 1; size += com.google.protobuf.CodedOutputStream .computeInt32SizeNoTag(dataSize); } pointMemoizedSerializedSize = dataSize; } if (previewCount_ != 0) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, previewCount_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.jetbrains.r.rinterop.Polyline)) { return super.equals(obj); } org.jetbrains.r.rinterop.Polyline other = (org.jetbrains.r.rinterop.Polyline) obj; if (!getPointList() .equals(other.getPointList())) return false; if (getPreviewCount() != other.getPreviewCount()) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getPointCount() > 0) { hash = (37 * hash) + POINT_FIELD_NUMBER; hash = (53 * hash) + getPointList().hashCode(); } hash = (37 * hash) + PREVIEWCOUNT_FIELD_NUMBER; hash = (53 * hash) + getPreviewCount(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static org.jetbrains.r.rinterop.Polyline parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static org.jetbrains.r.rinterop.Polyline parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static org.jetbrains.r.rinterop.Polyline parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static org.jetbrains.r.rinterop.Polyline parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static org.jetbrains.r.rinterop.Polyline parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static org.jetbrains.r.rinterop.Polyline parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static org.jetbrains.r.rinterop.Polyline parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static org.jetbrains.r.rinterop.Polyline parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static org.jetbrains.r.rinterop.Polyline parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static org.jetbrains.r.rinterop.Polyline parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static org.jetbrains.r.rinterop.Polyline parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static org.jetbrains.r.rinterop.Polyline parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(org.jetbrains.r.rinterop.Polyline prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code rplugininterop.Polyline} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:rplugininterop.Polyline) org.jetbrains.r.rinterop.PolylineOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.jetbrains.r.rinterop.Service.internal_static_rplugininterop_Polyline_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.jetbrains.r.rinterop.Service.internal_static_rplugininterop_Polyline_fieldAccessorTable .ensureFieldAccessorsInitialized( org.jetbrains.r.rinterop.Polyline.class, org.jetbrains.r.rinterop.Polyline.Builder.class); } // Construct using org.jetbrains.r.rinterop.Polyline.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @java.lang.Override public Builder clear() { super.clear(); point_ = emptyLongList(); bitField0_ = (bitField0_ & ~0x00000001); previewCount_ = 0; return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.jetbrains.r.rinterop.Service.internal_static_rplugininterop_Polyline_descriptor; } @java.lang.Override public org.jetbrains.r.rinterop.Polyline getDefaultInstanceForType() { return org.jetbrains.r.rinterop.Polyline.getDefaultInstance(); } @java.lang.Override public org.jetbrains.r.rinterop.Polyline build() { org.jetbrains.r.rinterop.Polyline result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public org.jetbrains.r.rinterop.Polyline buildPartial() { org.jetbrains.r.rinterop.Polyline result = new org.jetbrains.r.rinterop.Polyline(this); int from_bitField0_ = bitField0_; if (((bitField0_ & 0x00000001) != 0)) { point_.makeImmutable(); bitField0_ = (bitField0_ & ~0x00000001); } result.point_ = point_; result.previewCount_ = previewCount_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.jetbrains.r.rinterop.Polyline) { return mergeFrom((org.jetbrains.r.rinterop.Polyline)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(org.jetbrains.r.rinterop.Polyline other) { if (other == org.jetbrains.r.rinterop.Polyline.getDefaultInstance()) return this; if (!other.point_.isEmpty()) { if (point_.isEmpty()) { point_ = other.point_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensurePointIsMutable(); point_.addAll(other.point_); } onChanged(); } if (other.getPreviewCount() != 0) { setPreviewCount(other.getPreviewCount()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { org.jetbrains.r.rinterop.Polyline parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.jetbrains.r.rinterop.Polyline) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private com.google.protobuf.Internal.LongList point_ = emptyLongList(); private void ensurePointIsMutable() { if (!((bitField0_ & 0x00000001) != 0)) { point_ = mutableCopy(point_); bitField0_ |= 0x00000001; } } /** * <code>repeated fixed64 point = 1;</code> * @return A list containing the point. */ public java.util.List<java.lang.Long> getPointList() { return ((bitField0_ & 0x00000001) != 0) ? java.util.Collections.unmodifiableList(point_) : point_; } /** * <code>repeated fixed64 point = 1;</code> * @return The count of point. */ public int getPointCount() { return point_.size(); } /** * <code>repeated fixed64 point = 1;</code> * @param index The index of the element to return. * @return The point at the given index. */ public long getPoint(int index) { return point_.getLong(index); } /** * <code>repeated fixed64 point = 1;</code> * @param index The index to set the value at. * @param value The point to set. * @return This builder for chaining. */ public Builder setPoint( int index, long value) { ensurePointIsMutable(); point_.setLong(index, value); onChanged(); return this; } /** * <code>repeated fixed64 point = 1;</code> * @param value The point to add. * @return This builder for chaining. */ public Builder addPoint(long value) { ensurePointIsMutable(); point_.addLong(value); onChanged(); return this; } /** * <code>repeated fixed64 point = 1;</code> * @param values The point to add. * @return This builder for chaining. */ public Builder addAllPoint( java.lang.Iterable<? extends java.lang.Long> values) { ensurePointIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, point_); onChanged(); return this; } /** * <code>repeated fixed64 point = 1;</code> * @return This builder for chaining. */ public Builder clearPoint() { point_ = emptyLongList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } private int previewCount_ ; /** * <code>int32 previewCount = 2;</code> * @return The previewCount. */ @java.lang.Override public int getPreviewCount() { return previewCount_; } /** * <code>int32 previewCount = 2;</code> * @param value The previewCount to set. * @return This builder for chaining. */ public Builder setPreviewCount(int value) { previewCount_ = value; onChanged(); return this; } /** * <code>int32 previewCount = 2;</code> * @return This builder for chaining. */ public Builder clearPreviewCount() { previewCount_ = 0; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:rplugininterop.Polyline) } // @@protoc_insertion_point(class_scope:rplugininterop.Polyline) private static final org.jetbrains.r.rinterop.Polyline DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new org.jetbrains.r.rinterop.Polyline(); } public static org.jetbrains.r.rinterop.Polyline getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<Polyline> PARSER = new com.google.protobuf.AbstractParser<Polyline>() { @java.lang.Override public Polyline parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Polyline(input, extensionRegistry); } }; public static com.google.protobuf.Parser<Polyline> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<Polyline> getParserForType() { return PARSER; } @java.lang.Override public org.jetbrains.r.rinterop.Polyline getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
9237493387a3c47e6a8a464e131db12576ce9be8
4,624
java
Java
src/main/java/com/buchner/auction/model/core/app/LiferayComponentService.java
divid3byzero/awection
85cce263e5af9447ee195eca78ea680da56185df
[ "MIT" ]
2
2016-08-18T12:03:48.000Z
2018-02-04T23:43:24.000Z
src/main/java/com/buchner/auction/model/core/app/LiferayComponentService.java
divid3byzero/awection
85cce263e5af9447ee195eca78ea680da56185df
[ "MIT" ]
null
null
null
src/main/java/com/buchner/auction/model/core/app/LiferayComponentService.java
divid3byzero/awection
85cce263e5af9447ee195eca78ea680da56185df
[ "MIT" ]
null
null
null
35.844961
106
0.707829
998,006
package com.buchner.auction.model.core.app; import com.liferay.faces.util.portal.WebKeys; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.util.ClassResolverUtil; import com.liferay.portal.kernel.util.MethodKey; import com.liferay.portal.kernel.util.PortalClassInvoker; import com.liferay.portal.model.CompanyConstants; import com.liferay.portal.model.Role; import com.liferay.portal.model.RoleConstants; import com.liferay.portal.model.User; import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.theme.ThemeDisplay; import com.liferay.portal.util.PortalUtil; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.context.RequestScoped; import javax.enterprise.inject.Produces; import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Locale; /** * Accessor class to Liferay service utilities. Liferay has it's own set of * methods that present an API to have access to important Liferay data. */ @ApplicationScoped public class LiferayComponentService { /* Class name that holds Liferay login functionality */ public static final String FQCN_LOGIN_UTIL = "com.liferay.portlet.login.util.LoginUtil"; /* Liferay login method */ public static final String LOGIN_METHOD = "login"; @Inject private HttpService httpService; public LiferayComponentService() { } /** * Producer method to get an injectable instance of * the currently logged in user. * @return Liferay user object. */ @Produces @RequestScoped public User produceCurrentUser() { ThemeDisplay currentThemeDisplay = getCurrentThemeDisplay(); return currentThemeDisplay.getUser(); } public User findUserById(long userId) throws SystemException, PortalException { return UserLocalServiceUtil.getUserById(userId); } /** * This creates and saves an user according to the Liferays API. */ public User createLrayUser(AuctionUser auctionUser) { long companyId = getCurrentThemeDisplay().getCompanyId(); User lrayUser = null; try { Role userRole = RoleLocalServiceUtil.getRole(companyId, RoleConstants.USER); long defaultUserId = UserLocalServiceUtil.getDefaultUserId(companyId); lrayUser = UserLocalServiceUtil.addUser( defaultUserId, companyId, false, auctionUser.getPassword(), auctionUser.getPassword(), false, auctionUser.getFirstName() + auctionUser.getSurname(), auctionUser.getMailAddress(), 0, null, new Locale("de_DE"), auctionUser.getFirstName(), null, auctionUser.getSurname(), 0, 0, false, 1, 1, 1970, null, null, null, new long[] {userRole.getRoleId()}, null, false, new ServiceContext() ); } catch (PortalException | SystemException e) { System.out.print(e); } return lrayUser; } /** * Calls Liferay internal login method via a reflection mechanism. Using this is necessary since * the user management is done by Liferay. That means that it makes sense to use Liferays funtionality * to check the validity of user credentials. */ public void invokeLogin(AwectionCredentials awectionCredentials) throws Exception { Class<?> loginUtilClass = ClassResolverUtil .resolveByPortalClassLoader(FQCN_LOGIN_UTIL); HttpServletRequest httpRequest = PortalUtil .getHttpServletRequest(httpService.getPortletRequest()); HttpServletResponse httpResponse = PortalUtil.getHttpServletResponse(httpService.getPortletResponse()); MethodKey key = new MethodKey(loginUtilClass, LOGIN_METHOD, HttpServletRequest.class, HttpServletResponse.class, String.class, String.class, boolean.class, String.class); PortalClassInvoker.invoke(false, key, httpRequest, httpResponse, awectionCredentials.getUserName(), awectionCredentials.getPassword(), true, CompanyConstants.AUTH_TYPE_EA); } private ThemeDisplay getCurrentThemeDisplay() { return (ThemeDisplay) httpService.getPortletRequest().getAttribute(WebKeys.THEME_DISPLAY); } }
9237496e0d2b50334847fd23d8b213f1125d7a50
13,187
java
Java
vtp-mock/mocks/gsak-mock/src/main/java/no/nav/tjeneste/virksomhet/oppgavebehandling/v3/OppgavebehandlingServiceMockImpl.java
navikt/spsak
ede4770de33bd896d62225a9617b713878d1efa5
[ "MIT" ]
1
2019-11-15T10:37:38.000Z
2019-11-15T10:37:38.000Z
vtp-mock/mocks/gsak-mock/src/main/java/no/nav/tjeneste/virksomhet/oppgavebehandling/v3/OppgavebehandlingServiceMockImpl.java
navikt/spsak
ede4770de33bd896d62225a9617b713878d1efa5
[ "MIT" ]
null
null
null
vtp-mock/mocks/gsak-mock/src/main/java/no/nav/tjeneste/virksomhet/oppgavebehandling/v3/OppgavebehandlingServiceMockImpl.java
navikt/spsak
ede4770de33bd896d62225a9617b713878d1efa5
[ "MIT" ]
1
2019-11-15T10:37:41.000Z
2019-11-15T10:37:41.000Z
79.921212
236
0.803594
998,007
package no.nav.tjeneste.virksomhet.oppgavebehandling.v3; import javax.jws.HandlerChain; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; import javax.xml.ws.soap.Addressing; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.binding.FeilregistrerOppgaveOppgaveIkkeFunnet; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.binding.FeilregistrerOppgaveUlovligStatusOvergang; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.binding.LagreMappeMappeIkkeFunnet; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.binding.LagreOppgaveOppgaveIkkeFunnet; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.binding.LagreOppgaveOptimistiskLasing; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.binding.OppgavebehandlingV3; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.binding.SlettMappeMappeIkkeFunnet; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.binding.SlettMappeMappeIkkeTom; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.binding.TildelOppgaveUgyldigInput; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.FeilregistrerOppgaveRequest; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.FerdigstillOppgaveBolkRequest; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.FerdigstillOppgaveBolkResponse; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.LagreMappeRequest; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.LagreOppgaveBolkRequest; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.LagreOppgaveBolkResponse; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.LagreOppgaveRequest; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.OpprettMappeRequest; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.OpprettMappeResponse; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.OpprettOppgaveBolkRequest; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.OpprettOppgaveBolkResponse; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.OpprettOppgaveRequest; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.OpprettOppgaveResponse; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.SlettMappeRequest; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.TildelOppgaveRequest; import no.nav.tjeneste.virksomhet.oppgavebehandling.v3.meldinger.TildelOppgaveResponse; import no.nav.tjeneste.virksomhet.sak.v1.GsakRepo; import java.util.stream.Collectors; @Addressing @WebService(name = "Oppgavebehandling_v3", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3") @HandlerChain(file = "Handler-chain.xml") public class OppgavebehandlingServiceMockImpl implements OppgavebehandlingV3 { private static final Logger LOG = LoggerFactory.getLogger(OppgavebehandlingServiceMockImpl.class); private GsakRepo gsakRepo; public OppgavebehandlingServiceMockImpl(GsakRepo gsakRepo) { this.gsakRepo = gsakRepo; } @Override @WebMethod(action = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3/Oppgavebehandling_v3/pingRequest") @RequestWrapper(localName = "ping", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.Ping") @ResponseWrapper(localName = "pingResponse", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.PingResponse") public void ping() { LOG.info("Ping mottatt og besvart."); } @Override @WebMethod(action = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3/Oppgavebehandling_v3/opprettOppgaveRequest") @WebResult(name = "response", targetNamespace = "") @RequestWrapper(localName = "opprettOppgave", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.OpprettOppgave") @ResponseWrapper(localName = "opprettOppgaveResponse", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.OpprettOppgaveResponse") public OpprettOppgaveResponse opprettOppgave(@WebParam(name = "request", targetNamespace = "") OpprettOppgaveRequest opprettOppgaveRequest) { LOG.info("Oppgavebehandling_opprettOppgave. OpprettetAvEnhetId: {}, oppgavetypeKode: {}, brukerId {}", opprettOppgaveRequest.getOpprettetAvEnhetId(), opprettOppgaveRequest.getOpprettOppgave().getOppgavetypeKode(), opprettOppgaveRequest.getOpprettOppgave().getBrukerId()); OpprettOppgaveResponse opprettOppgaveResponse = new OpprettOppgaveResponse(); String oppgaveId = gsakRepo.opprettOppgave(opprettOppgaveRequest.getOpprettOppgave().getSaksnummer()); opprettOppgaveResponse.setOppgaveId(oppgaveId); return opprettOppgaveResponse; } @Override @WebMethod(action = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3/Oppgavebehandling_v3/feilregistrerOppgaveRequest") @RequestWrapper(localName = "feilregistrerOppgave", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.FeilregistrerOppgave") @ResponseWrapper(localName = "feilregistrerOppgaveResponse", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.FeilregistrerOppgaveResponse") public void feilregistrerOppgave(@WebParam(name = "request", targetNamespace = "") FeilregistrerOppgaveRequest feilregistrerOppgaveRequest) throws FeilregistrerOppgaveOppgaveIkkeFunnet, FeilregistrerOppgaveUlovligStatusOvergang { throw new UnsupportedOperationException("Ikke implementert"); } @Override @WebMethod(action = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3/Oppgavebehandling_v3/lagreOppgaveRequest") @RequestWrapper(localName = "lagreOppgave", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.LagreOppgave") @ResponseWrapper(localName = "lagreOppgaveResponse", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.LagreOppgaveResponse") public void lagreOppgave(@WebParam(name = "request", targetNamespace = "") LagreOppgaveRequest lagreOppgaveRequest) throws LagreOppgaveOppgaveIkkeFunnet, LagreOppgaveOptimistiskLasing { throw new UnsupportedOperationException("Ikke implementert"); } @Override @WebMethod(action = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3/Oppgavebehandling_v3/opprettOppgaveBolkRequest") @WebResult(name = "response", targetNamespace = "") @RequestWrapper(localName = "opprettOppgaveBolk", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.OpprettOppgaveBolk") @ResponseWrapper(localName = "opprettOppgaveBolkResponse", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.OpprettOppgaveBolkResponse") public OpprettOppgaveBolkResponse opprettOppgaveBolk(@WebParam(name = "request", targetNamespace = "") OpprettOppgaveBolkRequest opprettOppgaveBolkRequest) { throw new UnsupportedOperationException("Ikke implementert"); } @Override @WebMethod(action = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3/Oppgavebehandling_v3/ferdigstillOppgaveBolkRequest") @WebResult(name = "response", targetNamespace = "") @RequestWrapper(localName = "ferdigstillOppgaveBolk", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.FerdigstillOppgaveBolk") @ResponseWrapper(localName = "ferdigstillOppgaveBolkResponse", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.FerdigstillOppgaveBolkResponse") public FerdigstillOppgaveBolkResponse ferdigstillOppgaveBolk(@WebParam(name = "request", targetNamespace = "") FerdigstillOppgaveBolkRequest ferdigstillOppgaveBolkRequest) { // throw new UnsupportedOperationException("Ikke implementert"); LOG.info("Oppgavebehandling_ferdigstillOppgaveBolk. oppgaveIdListe: {}", ferdigstillOppgaveBolkRequest.getOppgaveIdListe().stream().collect(Collectors.joining(","))); FerdigstillOppgaveBolkResponse response = new FerdigstillOppgaveBolkResponse(); response.setTransaksjonOk(true); return response; } @Override @WebMethod(action = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3/Oppgavebehandling_v3/opprettMappeRequest") @WebResult(name = "response", targetNamespace = "") @RequestWrapper(localName = "opprettMappe", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.OpprettMappe") @ResponseWrapper(localName = "opprettMappeResponse", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.OpprettMappeResponse") public OpprettMappeResponse opprettMappe(@WebParam(name = "request", targetNamespace = "") OpprettMappeRequest opprettMappeRequest) { throw new UnsupportedOperationException("Ikke implementert"); } @Override @WebMethod(action = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3/Oppgavebehandling_v3/lagreMappeRequest") @RequestWrapper(localName = "lagreMappe", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.LagreMappe") @ResponseWrapper(localName = "lagreMappeResponse", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.LagreMappeResponse") public void lagreMappe(@WebParam(name = "request", targetNamespace = "") LagreMappeRequest lagreMappeRequest) throws LagreMappeMappeIkkeFunnet { throw new UnsupportedOperationException("Ikke implementert"); } @Override @WebMethod(action = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3/Oppgavebehandling_v3/slettMappeRequest") @RequestWrapper(localName = "slettMappe", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.SlettMappe") @ResponseWrapper(localName = "slettMappeResponse", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.SlettMappeResponse") public void slettMappe(@WebParam(name = "request", targetNamespace = "") SlettMappeRequest slettMappeRequest) throws SlettMappeMappeIkkeFunnet, SlettMappeMappeIkkeTom { throw new UnsupportedOperationException("Ikke implementert"); } @Override @WebMethod(action = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3/Oppgavebehandling_v3/lagreOppgaveBolkRequest") @WebResult(name = "response", targetNamespace = "") @RequestWrapper(localName = "lagreOppgaveBolk", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.LagreOppgaveBolk") @ResponseWrapper(localName = "lagreOppgaveBolkResponse", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.LagreOppgaveBolkResponse") public LagreOppgaveBolkResponse lagreOppgaveBolk(@WebParam(name = "request", targetNamespace = "") LagreOppgaveBolkRequest lagreOppgaveBolkRequest) { throw new UnsupportedOperationException("Ikke implementert"); } @Override @WebMethod(action = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3/Oppgavebehandling_v3/tildelOppgaveRequest") @WebResult(name = "response", targetNamespace = "") @RequestWrapper(localName = "tildelOppgave", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.TildelOppgave") @ResponseWrapper(localName = "tildelOppgaveResponse", targetNamespace = "http://nav.no/tjeneste/virksomhet/oppgavebehandling/v3", className = "no.nav.tjeneste.virksomhet.oppgavebehandling.v3.TildelOppgaveResponse") public TildelOppgaveResponse tildelOppgave(@WebParam(name = "request", targetNamespace = "") TildelOppgaveRequest tildelOppgaveRequest) throws TildelOppgaveUgyldigInput { throw new UnsupportedOperationException("Ikke implementert"); } }
923749c37c5c3fd8a8bb49dda64543d9e175536a
1,904
java
Java
corpus/class/ecf/2481.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
15
2018-07-10T09:38:31.000Z
2021-11-29T08:28:07.000Z
corpus/class/ecf/2481.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
3
2018-11-16T02:58:59.000Z
2021-01-20T16:03:51.000Z
corpus/class/ecf/2481.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
6
2018-06-27T20:19:00.000Z
2022-02-19T02:29:53.000Z
29.292308
135
0.669643
998,008
/** * Copyright (c) 2006 Ecliptical Software Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Ecliptical Software Inc. - initial API and implementation */ package org.eclipse.ecf.pubsub; import java.util.Arrays; import java.util.EventObject; public class PublishedServiceDirectoryChangeEvent extends EventObject { private static final long serialVersionUID = 5748843360974872790L; public static final int ADDED = 0; public static final int REMOVED = 1; private final int kind; private final PublishedServiceDescriptor[] services; public PublishedServiceDirectoryChangeEvent(IPublishedServiceDirectory manager, int kind, PublishedServiceDescriptor[] services) { super(manager); this.kind = kind; this.services = services; } public IPublishedServiceDirectory getDirectory() { return (IPublishedServiceDirectory) source; } public int getKind() { return kind; } public PublishedServiceDescriptor[] getReplicatedServices() { return services; } public int hashCode() { int c = 17; c = 37 * c + source.hashCode(); c = 37 * c + kind; c = 37 * c + services[0].hashCode(); return c; } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PublishedServiceDirectoryChangeEvent other = (PublishedServiceDirectoryChangeEvent) obj; return source.equals(other.source) && kind == other.kind && Arrays.equals(services, other.services); } }
92374c2f1ae3b615f592404b59986bfdedc99cae
21,955
java
Java
dev/scratch/jennie/attenRelImpl/AS_1997_SiteSpecific_AttenRel.java
opensha/opensha-svn-archive
77203dab6745320a5130fda85978ebe1a4e097c8
[ "Apache-2.0" ]
null
null
null
dev/scratch/jennie/attenRelImpl/AS_1997_SiteSpecific_AttenRel.java
opensha/opensha-svn-archive
77203dab6745320a5130fda85978ebe1a4e097c8
[ "Apache-2.0" ]
null
null
null
dev/scratch/jennie/attenRelImpl/AS_1997_SiteSpecific_AttenRel.java
opensha/opensha-svn-archive
77203dab6745320a5130fda85978ebe1a4e097c8
[ "Apache-2.0" ]
null
null
null
38.72134
118
0.7468
998,009
package scratch.jennie.attenRelImpl; import java.util.Hashtable; import java.util.Iterator; import java.util.ListIterator; import org.opensha.commons.data.Named; import org.opensha.commons.data.Site; import org.opensha.commons.exceptions.IMRException; import org.opensha.commons.exceptions.InvalidRangeException; import org.opensha.commons.exceptions.ParameterException; import org.opensha.commons.param.AbstractParameter; import org.opensha.commons.param.constraint.impl.DoubleConstraint; import org.opensha.commons.param.constraint.impl.StringConstraint; import org.opensha.commons.param.event.ParameterChangeWarningListener; import org.opensha.commons.param.impl.DoubleParameter; import org.opensha.commons.param.impl.StringParameter; import org.opensha.sha.earthquake.EqkRupture; import org.opensha.sha.imr.AttenuationRelationship; import org.opensha.sha.imr.ScalarIMR; import org.opensha.sha.imr.attenRelImpl.AS_1997_AttenRel; import org.opensha.sha.imr.param.EqkRuptureParams.MagParam; import org.opensha.sha.imr.param.IntensityMeasureParams.PeriodParam; import org.opensha.sha.imr.param.OtherParams.Component; import org.opensha.sha.imr.param.OtherParams.ComponentParam; import org.opensha.sha.imr.param.OtherParams.SigmaTruncLevelParam; import org.opensha.sha.imr.param.OtherParams.SigmaTruncTypeParam; import org.opensha.sha.imr.param.OtherParams.StdDevTypeParam; import org.opensha.sha.imr.param.PropagationEffectParams.DistanceRupParameter; /** * <b>Title:</b> AS_1997_SiteSpecific_AttenRel<p> * * <b>Description:</b> This applies a site specific site effect model * to the Abrahamson & Silva (1997) rock-site predictions. <p> * * Supported Intensity-Measure Parameters:<p> * <UL> * <LI>saParam - Response Spectral Acceleration * <LI>pgaParam - Peak Ground Acceleration * </UL><p> * Other Independent Parameters:<p> * <UL> * <LI>distanceRupParam - closest distance to surface projection of fault * <LI>vs30Param - Average 30-meter shear-wave velocity at the site * <LI>softSoilParam - To overide Vs30 and apply NEHPR E (see INFO for details) * <LI>fltTypeParam - Style of faulting * <LI>isOnHangingWallParam - tells if site is directly over the rupture surface * <LI>componentParam - Component of shaking (only one) * <LI>stdDevTypeParam - The type of standard deviation * </UL><p> * * @author Jennie Watson-Lamprey * @created june, 2008 * @version 1.0 */ public class AS_1997_SiteSpecific_AttenRel extends AttenuationRelationship implements ScalarIMR, Named { // debugging stuff: private final static String C = "AS_1997_SiteSpecific_AttenRel"; private final static boolean D = false; public final static String NAME = "Abrahamson and Silva (1997) Site Specific"; public final static String SHORT_NAME = "AS1997SS"; private static final long serialVersionUID = 1234567890987654355L; // warning constraint fields: protected final static Double VS30_WARN_MIN = new Double(50.0); protected final static Double VS30_WARN_MAX = new Double(2500.0); protected AS_1997_AttenRel as_1997_attenRel; /** * The current set of coefficients based on the selected intensityMeasure */ // private double mag; //Functional Form private StringParameter AF_FuncForm; public final static String AF_FuncForm_NAME = "AF Functional Form"; public final static String AF_FuncForm_INFO = "Intercept of the median regression model for the ground response analyses"; // private DoubleConstraint AF_InterceptparamConstraint = new DoubleConstraint(-2,2); public final static String AF_FuncForm_DEFAULT = "lnAF = a + b*ln(SaRock+c) + d*(Mag-6) +e*ln(Rup/20)"; //Intercept param private DoubleParameter AF_InterceptParam; public final static String AF_INTERCEPT_PARAM_NAME = "AF Intercept (a)"; public final static String AF_INTERCEPT_PARAM_INFO = "Intercept of the median regression model for the ground response analyses"; private DoubleConstraint AF_InterceptparamConstraint = new DoubleConstraint(-2,2); public final static double AF_INTERCEPT_PARAM_DEFAULT = 0; //Slope Param protected DoubleParameter AF_SlopeParam; public final static String AF_SLOPE_PARAM_NAME = "AF Slope (b)"; public final static String AF_SLOPE_PARAM_INFO = "Slope of the median regression model for the ground response analyses"; private DoubleConstraint AF_slopeParamConstraint = new DoubleConstraint(-1,1); public final static double AF_SLOPE_PARAM_DEFAULT = 0; //Additive reference acceleration param protected DoubleParameter AF_AddRefAccParam; public final static String AF_ADDITIVE_REF_ACCELERATION_PARAM_NAME = "AF Add. Ref. Acceleration (c)"; public final static String AF_ADDITIVE_REF_ACCELERATION_PARAM_INFO = "Additive reference acceleration of the median regression model for the ground response " + "analyses. This parameter improves the linear model fit for low Sa(rock) / PGA(rock)" + "values and leads to more relaistic predictons than quadratic models"; private DoubleConstraint AFaddRefAccParamConstraint = new DoubleConstraint(0,0.5); public final static double AF_ADDITIVE_REF_ACCERLATION_DEFAULT = 0.03; //Mag reference param protected DoubleParameter AF_MagParam; public final static String AF_MagPARAM_NAME = "AF Magnitude (d)"; public final static String AF_MagPARAM_INFO = "Slope of the regression for magnitude"; private DoubleConstraint AFMagParamConstraint = new DoubleConstraint(-4,4); public final static double AF_MagParam_DEFAULT = 0.0; //Rup reference param protected DoubleParameter AF_RupParam; public final static String AF_RupPARAM_NAME = "AF Ruture Distance (e)"; public final static String AF_RupPARAM_INFO = "Slope of the regression for rupture distance"; private DoubleConstraint AFRupParamConstraint = new DoubleConstraint(-4,4); public final static double AF_RupParam_DEFAULT = 0.0; //Std. Dev AF param protected DoubleParameter AF_StdDevParam; public final static String AF_STD_DEV_PARAM_NAME = "Std. Dev. AF"; public final static String AF_STD_DEV_PARAM_INFO = "Standard Deviation of the amplification factor from the ground response analyses" + " regression model"; private DoubleConstraint AF_StdDevParamConstraint = new DoubleConstraint(0,1.0); public final static double AF_STD_DEV_DEFAULT = 0.3; /** * Hashtable of coefficients for the supported intensityMeasures */ protected Hashtable horzCoeffs = new Hashtable(); // for issuing warnings: private transient ParameterChangeWarningListener warningListener = null; public AS_1997_SiteSpecific_AttenRel(ParameterChangeWarningListener warningListener) { super(); this.warningListener = warningListener; as_1997_attenRel = new AS_1997_AttenRel(warningListener); // set the site type to rock as_1997_attenRel.getParameter(as_1997_attenRel.SITE_TYPE_NAME).setValue( as_1997_attenRel.SITE_TYPE_ROCK); // set the component to ave horz as_1997_attenRel.getParameter(ComponentParam.NAME).setValue( Component.AVE_HORZ); // overide local params with those in as_1997_attenRel this.sigmaTruncTypeParam = (SigmaTruncTypeParam) as_1997_attenRel.getParameter( SigmaTruncTypeParam.NAME); this.sigmaTruncLevelParam = (SigmaTruncLevelParam) as_1997_attenRel.getParameter( SigmaTruncLevelParam.NAME); this.exceedProbParam = (DoubleParameter) as_1997_attenRel.getParameter( as_1997_attenRel.EXCEED_PROB_NAME); this.stdDevTypeParam = (StdDevTypeParam) as_1997_attenRel.getParameter( StdDevTypeParam.NAME); this.saPeriodParam = (PeriodParam) as_1997_attenRel.getParameter( PeriodParam.NAME); // initCoefficients(); initSupportedIntensityMeasureParams(); initEqkRuptureParams(); initPropagationEffectParams(); initSiteParams(); // do only in constructor initOtherParams(); initIndependentParamLists(); // Do this after the above } protected void setRockAttenAndParamLists() { } /** * This does nothing, but is needed. */ protected void setPropagationEffectParams() { } /** * This sets the eqkRupture related parameters. * * @param eqkRupture The new eqkRupture value * @throws InvalidRangeException thrown if rake is out of bounds */ public void setEqkRupture(EqkRupture eqkRupture) throws InvalidRangeException { this.as_1997_attenRel.setEqkRupture(eqkRupture); this.eqkRupture = eqkRupture; } /** * This sets the site-related parameter (vs30Param) based on what is in * the Site object passed in. WarningExceptions are ingored * * @param site The new site value which contains a Vs30 Parameter * @throws ParameterException Thrown if the Site object doesn't contain a * Vs30 parameter */ public void setSite(Site site) throws ParameterException { AF_FuncForm.setValue(AF_FuncForm_DEFAULT); AF_InterceptParam.setValue((Double)site.getParameter(AF_INTERCEPT_PARAM_NAME).getValue()); AF_AddRefAccParam.setValue((Double)site.getParameter(AF_ADDITIVE_REF_ACCELERATION_PARAM_NAME).getValue()); AF_SlopeParam.setValue((Double)site.getParameter(AF_SLOPE_PARAM_NAME).getValue()); AF_MagParam.setValue((Double)site.getParameter(AF_MagPARAM_NAME).getValue()); AF_RupParam.setValue((Double)site.getParameter(AF_RupPARAM_NAME).getValue()); AF_StdDevParam.setValue((Double)site.getParameter(AF_STD_DEV_PARAM_NAME).getValue()); this.site = site; // set the location in as_1997_attenRel as_1997_attenRel.setSiteLocation(site.getLocation()); } /** * Calculates the mean * @return The mean value */ public double getMean() throws IMRException { double asRockSA, lnAF, magTest; // get AS-1997 SA for rock as_1997_attenRel.setIntensityMeasure(im); asRockSA = as_1997_attenRel.getMean(); double mag = ( (Double) magParam.getValue()).doubleValue(); double dist = ( (Double) distanceRupParam.getValue()).doubleValue(); // mag = ( (Double) as_1997_attenRel.getEqkRupture().getMag()).doubleValue(); // magTest = as_1997_attenRel.EqkRupture().getMag(); // magTest = as_1997_attenRel. // magTest = as_ // get the amp factor double aVal = ((Double)AF_InterceptParam.getValue()).doubleValue(); double bVal = ((Double)AF_SlopeParam.getValue()).doubleValue(); double cVal = ((Double)AF_AddRefAccParam.getValue()).doubleValue(); double mVal = ((Double)AF_MagParam.getValue()).doubleValue(); double rVal = ((Double)AF_RupParam.getValue()).doubleValue(); lnAF = aVal+bVal*Math.log(Math.exp(asRockSA)+cVal)+mVal*(mag-6)+rVal*Math.log(dist/20); // return the result return lnAF + asRockSA; } /** * Returns the Std Dev. */ public double getStdDev(){ String stdDevType = stdDevTypeParam.getValue().toString(); if (stdDevType.equals(StdDevTypeParam.STD_DEV_TYPE_NONE)) { // "None (zero)" return 0; } return getStdDevForGoulet(); } /** * @return The stdDev value for Bazzurro and Cornell (2004) Site Correction Model */ private double getStdDevForBC(){ double bVal = ((Double)AF_SlopeParam.getValue()).doubleValue(); double stdDevAF = ((Double)this.AF_StdDevParam.getValue()).doubleValue(); as_1997_attenRel.setIntensityMeasure(im); double asRockStdDev = as_1997_attenRel.getStdDev(); double stdDev = Math.pow(bVal+1, 2)*Math.pow(asRockStdDev, 2)+Math.pow(stdDevAF, 2); return Math.sqrt(stdDev); } private double getStdDevForGoulet(){ double bVal = ((Double)AF_SlopeParam.getValue()).doubleValue(); double cVal = ((Double)this.AF_AddRefAccParam.getValue()).doubleValue(); double stdDevAF = ((Double)this.AF_StdDevParam.getValue()).doubleValue(); // double tau = coeffs.tau; as_1997_attenRel.setIntensityMeasure(im); double asRockMean = as_1997_attenRel.getMean(); double asRockStdDev = as_1997_attenRel.getStdDev(); // double stdDev = Math.pow((bVal*asRockMean)/(asRockMean+cVal)+1, 2)* // (Math.pow(asRockStdDev,2)-Math.pow(tau, 2))+Math.pow(stdDevAF,2)+Math.pow(tau,2); double stdDev = Math.pow((bVal*asRockMean)/(asRockMean+cVal)+1, 2)*(Math.pow(asRockStdDev,2))+Math.pow(stdDevAF,2); return Math.sqrt(stdDev); } public void setParamDefaults() { //((ParameterAPI)this.iml).setValue( IML_DEFAULT ); // AF_FuncForm.setValue(this.AF_FuncForm_DEFAULT); AF_AddRefAccParam.setValue(this.AF_ADDITIVE_REF_ACCERLATION_DEFAULT); AF_InterceptParam.setValue(this.AF_INTERCEPT_PARAM_DEFAULT); AF_SlopeParam.setValue(this.AF_SLOPE_PARAM_DEFAULT); AF_MagParam.setValue(this.AF_MagParam_DEFAULT); AF_RupParam.setValue(this.AF_RupParam_DEFAULT); AF_StdDevParam.setValue(this.AF_STD_DEV_DEFAULT); as_1997_attenRel.setParamDefaults(); // re-set the site type to rock and component to ave horz as_1997_attenRel.getParameter(as_1997_attenRel.SITE_TYPE_NAME).setValue( as_1997_attenRel.SITE_TYPE_ROCK); as_1997_attenRel.getParameter(ComponentParam.NAME).setValue( Component.AVE_HORZ); magParam.setValueAsDefault(); } /** * This creates the lists of independent parameters that the various dependent * parameters (mean, standard deviation, exceedance probability, and IML at * exceedance probability) depend upon. NOTE: these lists do not include anything * about the intensity-measure parameters or any of thier internal * independentParamaters. */ protected void initIndependentParamLists() { // params that the mean depends upon meanIndependentParams.clear(); ListIterator it = as_1997_attenRel.getMeanIndependentParamsIterator(); String ignoreStr1 = as_1997_attenRel.SITE_TYPE_NAME; String ignoreStr2 = ComponentParam.NAME; while (it.hasNext()) { AbstractParameter param = (AbstractParameter) it.next(); if (!ignoreStr1.equals(param.getName()) && !ignoreStr2.equals(param.getName())) { meanIndependentParams.addParameter(param); } } meanIndependentParams.addParameter(AF_FuncForm); meanIndependentParams.addParameter(AF_AddRefAccParam); meanIndependentParams.addParameter(AF_InterceptParam); meanIndependentParams.addParameter(AF_SlopeParam); meanIndependentParams.addParameter(AF_MagParam); meanIndependentParams.addParameter(AF_RupParam); meanIndependentParams.addParameter(AF_StdDevParam); meanIndependentParams.addParameter(componentParam); // params that the stdDev depends upon stdDevIndependentParams.clear(); it = as_1997_attenRel.getStdDevIndependentParamsIterator(); while (it.hasNext()) { AbstractParameter param = (AbstractParameter) it.next(); if (!ignoreStr1.equals(param.getName()) && !ignoreStr2.equals(param.getName())) { stdDevIndependentParams.addParameter(param); } } stdDevIndependentParams.addParameter(AF_FuncForm); stdDevIndependentParams.addParameter(AF_AddRefAccParam); // stdDevIndependentParams.addParameter(AF_InterceptParam); stdDevIndependentParams.addParameter(AF_SlopeParam); stdDevIndependentParams.addParameter(AF_StdDevParam); stdDevIndependentParams.addParameter(componentParam); // params that the exceed. prob. depends upon exceedProbIndependentParams.clear(); it = as_1997_attenRel.getExceedProbIndependentParamsIterator(); while (it.hasNext()) { AbstractParameter param = (AbstractParameter) it.next(); if (!ignoreStr1.equals(param.getName()) && !ignoreStr2.equals(param.getName())) { exceedProbIndependentParams.addParameter(param); } } exceedProbIndependentParams.addParameter(AF_FuncForm); exceedProbIndependentParams.addParameter(AF_AddRefAccParam); exceedProbIndependentParams.addParameter(AF_InterceptParam); exceedProbIndependentParams.addParameter(AF_SlopeParam); exceedProbIndependentParams.addParameter(AF_MagParam); exceedProbIndependentParams.addParameter(AF_RupParam); exceedProbIndependentParams.addParameter(AF_StdDevParam); exceedProbIndependentParams.addParameter(componentParam); // params that the IML at exceed. prob. depends upon imlAtExceedProbIndependentParams.addParameterList( exceedProbIndependentParams); imlAtExceedProbIndependentParams.addParameter(exceedProbParam); } /** * Creates the Vs30 site parameter and adds it to the siteParams list. * Makes the parameters noneditable. */ protected void initSiteParams() { //make the AF functional form parameter StringConstraint constraint = new StringConstraint(); constraint.addString(AF_FuncForm_DEFAULT); constraint.setNonEditable(); this.AF_FuncForm = new StringParameter(this.AF_FuncForm_NAME, constraint, this.AF_FuncForm_DEFAULT); AF_FuncForm.setInfo(ComponentParam.INFO); AF_FuncForm.setNonEditable(); //make the AF intercept parameter this.AF_InterceptParam = new DoubleParameter(this.AF_INTERCEPT_PARAM_NAME, AF_InterceptparamConstraint,this.AF_INTERCEPT_PARAM_DEFAULT); AF_InterceptParam.setInfo(this.AF_INTERCEPT_PARAM_INFO); //make the AF slope parameter this.AF_SlopeParam = new DoubleParameter(this.AF_SLOPE_PARAM_NAME, this.AF_slopeParamConstraint,this.AF_SLOPE_PARAM_DEFAULT); AF_SlopeParam.setInfo(this.AF_SLOPE_PARAM_INFO); //make theb AF Additive Reference Parameter this.AF_AddRefAccParam = new DoubleParameter(this.AF_ADDITIVE_REF_ACCELERATION_PARAM_NAME, this.AFaddRefAccParamConstraint,this.AF_ADDITIVE_REF_ACCERLATION_DEFAULT); AF_AddRefAccParam.setInfo(this.AF_ADDITIVE_REF_ACCELERATION_PARAM_INFO); //make the AF Mag Parameter this.AF_MagParam = new DoubleParameter(this.AF_MagPARAM_NAME, this.AFMagParamConstraint,this.AF_MagParam_DEFAULT); AF_MagParam.setInfo(this.AF_MagPARAM_INFO); //make the AF Rup Parameter this.AF_RupParam = new DoubleParameter(this.AF_RupPARAM_NAME, this.AFRupParamConstraint,this.AF_RupParam_DEFAULT); AF_RupParam.setInfo(this.AF_RupPARAM_INFO); //make the AF Std. Dev. this.AF_StdDevParam = new DoubleParameter(this.AF_STD_DEV_PARAM_NAME, this.AF_StdDevParamConstraint,this.AF_STD_DEV_DEFAULT); AF_StdDevParam.setInfo(this.AF_STD_DEV_PARAM_INFO); // add it to the siteParams list: siteParams.clear(); siteParams.addParameter(AF_FuncForm); siteParams.addParameter(AF_AddRefAccParam); siteParams.addParameter(AF_InterceptParam); siteParams.addParameter(AF_SlopeParam); siteParams.addParameter(AF_MagParam); siteParams.addParameter(AF_RupParam); siteParams.addParameter(AF_StdDevParam); } /** * Creates the two Potential Earthquake parameters (magParam and * fltTypeParam) and adds them to the eqkRuptureParams * list. Makes the parameters noneditable. */ protected void initEqkRuptureParams() { // Create magParam //super.initEqkRuptureParams(); magParam = (MagParam) as_1997_attenRel.getParameter(magParam.NAME); eqkRuptureParams.clear(); ListIterator it = as_1997_attenRel.getEqkRuptureParamsIterator(); while (it.hasNext()) { eqkRuptureParams.addParameter( (AbstractParameter) it.next()); } } /** * Creates the single Propagation Effect parameter and adds it to the * propagationEffectParams list. Makes the parameters noneditable. */ protected void initPropagationEffectParams() { propagationEffectParams.clear(); ListIterator it = as_1997_attenRel.getPropagationEffectParamsIterator(); while (it.hasNext()) { propagationEffectParams.addParameter( (AbstractParameter) it.next()); } // this is a pointer to that in as_1997_attenRel for local access distanceRupParam = (DistanceRupParameter) as_1997_attenRel.getParameter(DistanceRupParameter.NAME); } /** * Creates the two supported IM parameters (PGA and SA), as well as the * independenParameters of SA (periodParam and dampingParam) and adds * them to the supportedIMParams list. Makes the parameters noneditable. */ protected void initSupportedIntensityMeasureParams() { supportedIMParams.clear(); Iterator it = as_1997_attenRel.getSupportedIntensityMeasuresIterator(); while (it.hasNext()) { supportedIMParams.addParameter( (AbstractParameter) it.next()); } } /** * Creates other Parameters that the mean or stdDev depends upon, * such as the Component or StdDevType parameters. */ protected void initOtherParams() { // init other params defined in parent class -- Don't need this // super.initOtherParams(); // the Component Parameter (not supporting AS_1997's vertical) // first is default, the rest are all options (including default) componentParam = new ComponentParam(Component.AVE_HORZ, Component.AVE_HORZ); // add this to the list otherParams.clear(); otherParams.addParameter(componentParam); Iterator it = as_1997_attenRel.getOtherParamsIterator(); AbstractParameter param; while (it.hasNext()) { param = (AbstractParameter) it.next(); if (!ComponentParam.NAME.equals(param.getName())) { otherParams.addParameter(param); } } } /** * get the name of this IMR * * @return the name of this IMR */ public String getName() { return NAME; } /** * Returns the Short Name of each AttenuationRelationship * @return String */ public String getShortName() { return SHORT_NAME; } /** * This creates the hashtable of coefficients for the supported * intensityMeasures (im). The key is the im parameter name, plus the * period value for SA (separated by "/"). For example, the key for SA * at 1.0 second period is "SA/1.0". */ /** * Gets the name attribute * * @return The name value */ }
92374c75b0b9db818bf26eb0bdd7cf5991045f4f
822
java
Java
integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CodeFlowUserInfoResource.java
RuanNunes/quarkus
6bf55dcbb386b45586eb7d65ec98b6c3133697a5
[ "Apache-2.0" ]
2
2021-02-17T02:52:58.000Z
2021-07-27T10:45:53.000Z
integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CodeFlowUserInfoResource.java
RuanNunes/quarkus
6bf55dcbb386b45586eb7d65ec98b6c3133697a5
[ "Apache-2.0" ]
184
2020-03-09T10:03:02.000Z
2022-03-21T22:50:37.000Z
integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CodeFlowUserInfoResource.java
RuanNunes/quarkus
6bf55dcbb386b45586eb7d65ec98b6c3133697a5
[ "Apache-2.0" ]
2
2019-09-27T09:54:49.000Z
2020-01-18T17:23:57.000Z
24.909091
116
0.723844
998,010
package io.quarkus.it.keycloak; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import io.quarkus.oidc.UserInfo; import io.quarkus.oidc.runtime.DefaultTokenIntrospectionUserInfoCache; import io.quarkus.security.Authenticated; import io.quarkus.security.identity.SecurityIdentity; @Path("/code-flow-user-info") @Authenticated public class CodeFlowUserInfoResource { @Inject UserInfo userInfo; @Inject SecurityIdentity identity; @Inject DefaultTokenIntrospectionUserInfoCache tokenCache; @GET public String access() { int cacheSize = tokenCache.getCacheSize(); tokenCache.clearCache(); return identity.getPrincipal().getName() + ":" + userInfo.getString("preferred_username") + ", cache size: " + cacheSize; } }
92374c794d7e95b75783c07f2bb07686652f2eb4
1,465
java
Java
src/main/java/com/contrastsecurity/models/EventItem.java
seschis/contrast-sdk-java
7c661e4aac833217bc0e21eb099d53cd7947794f
[ "Apache-2.0" ]
5
2016-10-24T18:44:57.000Z
2021-04-21T14:24:58.000Z
src/main/java/com/contrastsecurity/models/EventItem.java
seschis/contrast-sdk-java
7c661e4aac833217bc0e21eb099d53cd7947794f
[ "Apache-2.0" ]
32
2016-05-03T03:18:23.000Z
2022-03-23T17:24:41.000Z
src/main/java/com/contrastsecurity/models/EventItem.java
seschis/contrast-sdk-java
7c661e4aac833217bc0e21eb099d53cd7947794f
[ "Apache-2.0" ]
28
2015-06-23T23:10:57.000Z
2021-11-04T14:52:34.000Z
23.253968
91
0.695563
998,011
package com.contrastsecurity.models; /*- * #%L * Contrast Java SDK * %% * Copyright (C) 2021 Contrast Security, Inc. * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ public class EventItem extends EventModel { private String type; private String value; private boolean isStacktrace; public EventItem() {} public EventItem(EventResource parent, String type, String value, boolean isStacktrace) { super(); this.type = type; this.value = value; this.isStacktrace = isStacktrace; this.parent = parent; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public void setType(String type) { this.type = type; } public String getType() { return this.type; } public boolean isStacktrace() { return isStacktrace; } public void setStacktrace(boolean isStacktrace) { this.isStacktrace = isStacktrace; } }
92374e5c6480144502e4b657f929d6941f3ffcde
1,002
java
Java
src/test/java/org/ansj/recognition/impl/FilterRecognitionTest.java
liurui-rolin/ansj_seg
e7eff09b71a57f025e3b366096890b6a3b357458
[ "Apache-2.0" ]
1
2020-10-29T05:43:51.000Z
2020-10-29T05:43:51.000Z
src/test/java/org/ansj/recognition/impl/FilterRecognitionTest.java
liurui-rolin/ansj_seg
e7eff09b71a57f025e3b366096890b6a3b357458
[ "Apache-2.0" ]
null
null
null
src/test/java/org/ansj/recognition/impl/FilterRecognitionTest.java
liurui-rolin/ansj_seg
e7eff09b71a57f025e3b366096890b6a3b357458
[ "Apache-2.0" ]
4
2017-03-23T12:25:48.000Z
2018-07-16T09:59:20.000Z
20.875
53
0.711577
998,012
package org.ansj.recognition.impl; import org.ansj.domain.Result; import org.ansj.domain.Term; import org.ansj.splitWord.analysis.ToAnalysis; import org.junit.Assert; import org.junit.Test; /** * 停用词测试 * @author Ansj * */ public class FilterRecognitionTest { @Test public void test() { String str = "我的小鸡鸡丢了!"; Result parse = ToAnalysis.parse(str); System.out.println(parse); StopRecognition fitler = new StopRecognition(); fitler.insertStopNatures("uj"); fitler.insertStopNatures("ul"); fitler.insertStopNatures("null"); fitler.insertStopWords("我"); fitler.insertStopRegexes("小.*?"); Result modifResult = parse.recognition(fitler); for (Term term : modifResult) { Assert.assertNotSame(term.getNatureStr(), "uj"); Assert.assertNotSame(term.getNatureStr(), "ul"); Assert.assertNotSame(term.getNatureStr(), "null"); Assert.assertNotSame(term.getName(), "我"); Assert.assertNotSame(term.getName(), "小鸡鸡"); } System.out.println(modifResult); } }
92374ec80a2222d71b7175e93b78128725acfdbc
6,360
java
Java
query/src/test/java/org/infinispan/query/nulls/NullCollectionElementsTest.java
jmarkos/infinispan
45295b7b426ac457d93b0cc388c3a008dc7b3083
[ "Apache-2.0" ]
2
2015-04-28T21:43:44.000Z
2016-11-24T10:11:26.000Z
query/src/test/java/org/infinispan/query/nulls/NullCollectionElementsTest.java
Cotton-Ben/infinispan
2ba2d9992cd0018829d9ba0b0d4ba74bab49616b
[ "Apache-2.0" ]
null
null
null
query/src/test/java/org/infinispan/query/nulls/NullCollectionElementsTest.java
Cotton-Ben/infinispan
2ba2d9992cd0018829d9ba0b0d4ba74bab49616b
[ "Apache-2.0" ]
null
null
null
35.530726
158
0.637107
998,013
package org.infinispan.query.nulls; import org.apache.lucene.search.Query; import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.Indexed; import org.hibernate.search.annotations.Store; import org.hibernate.search.query.dsl.QueryBuilder; import org.infinispan.configuration.cache.ConfigurationBuilder; import org.infinispan.manager.EmbeddedCacheManager; import org.infinispan.query.CacheQuery; import org.infinispan.query.FetchOptions; import org.infinispan.query.ProjectionConstants; import org.infinispan.query.ResultIterator; import org.infinispan.query.Search; import org.infinispan.query.SearchManager; import org.infinispan.test.SingleCacheManagerTest; import org.infinispan.test.fwk.TestCacheManagerFactory; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import java.util.List; import java.util.NoSuchElementException; import java.util.concurrent.Callable; import static org.infinispan.query.FetchOptions.FetchMode.*; import static org.infinispan.test.TestingUtil.withTx; import static org.junit.Assert.*; /** * @author <a href="mailto:hzdkv@example.com">Marko Luksa</a> */ @Test(groups = "functional", testName = "query.nulls.NullCollectionElementsTest") public class NullCollectionElementsTest extends SingleCacheManagerTest { private SearchManager searchManager; @Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder cfg = getDefaultStandaloneCacheConfig(true); cfg .indexing() .enable() .indexLocalOnly(true) .addProperty("default.directory_provider", "ram") .addProperty("lucene_version", "LUCENE_CURRENT"); return TestCacheManagerFactory.createCacheManager(cfg); } @Override protected void setup() throws Exception { super.setup(); searchManager = Search.getSearchManager(cache); } @BeforeMethod public void insertData() throws Exception { withTx(tm(), new Callable<Void>() { @Override public Void call() throws Exception { cache.put("1", new Foo("1")); return null; } }); } @Test public void testQuerySkipsNullsInList() throws Exception { withTx(tm(), new Callable<Void>() { @Override public Void call() throws Exception { cache.remove("1"); // cache will now be out of sync with the index Query query = createQueryBuilder().keyword().onField("bar").matching("1").createQuery(); List list = searchManager.getQuery(query).list(); assert list.size() == 0; return null; } }); } @Test public void testQuerySkipsNullsInEagerIterator() throws Exception { withTx(tm(), new Callable<Void>() { @Override public Void call() throws Exception { cache.remove("1"); // cache will now be out of sync with the index Query query = createQueryBuilder().keyword().onField("bar").matching("1").createQuery(); ResultIterator iterator = searchManager.getQuery(query).iterator(new FetchOptions().fetchMode(EAGER)); assertFalse(iterator.hasNext()); try { iterator.next(); fail("Expected NoSuchElementException"); } catch (NoSuchElementException e) { // pass } return null; } }); } @Test // This is the same as the verification above, only verifying the default iterator() method. public void testQuerySkipsNullsInDefaultIterator() throws Exception { withTx(tm(), new Callable<Void>() { @Override public Void call() throws Exception { cache.remove("1"); // cache will now be out of sync with the index Query query = createQueryBuilder().keyword().onField("bar").matching("1").createQuery(); CacheQuery cacheQuery = searchManager.getQuery(query); assertEquals(1, cacheQuery.getResultSize()); ResultIterator iterator = cacheQuery.iterator(); assertFalse(iterator.hasNext()); try { iterator.next(); fail("Expected NoSuchElementException"); } catch (NoSuchElementException e) { // pass } return null; } }); } @Test public void testQuerySkipsNullsInLazyIterator() throws Exception { withTx(tm(), new Callable<Void>() { @Override public Void call() throws Exception { cache.remove("1"); // cache will now be out of sync with the index Query query = createQueryBuilder().keyword().onField("bar").matching("1").createQuery(); ResultIterator iterator = searchManager.getQuery(query).iterator(new FetchOptions().fetchMode(LAZY)); assertFalse(iterator.hasNext()); try { iterator.next(); fail("Expected NoSuchElementException"); } catch (NoSuchElementException e) { // pass } return null; } }); } @Test public void testQueryReturnsNullWhenProjectingCacheValue() throws Exception { withTx(tm(), new Callable<Void>() { @Override public Void call() throws Exception { cache.remove("1"); // cache will now be out of sync with the index Query query = createQueryBuilder().keyword().onField("bar").matching("1").createQuery(); ResultIterator iterator = searchManager.getQuery(query).projection(ProjectionConstants.VALUE, "bar").iterator(new FetchOptions().fetchMode(LAZY)); assertTrue(iterator.hasNext()); Object[] projection = (Object[]) iterator.next(); assertNull(projection[0]); assertEquals("1", projection[1]); return null; } }); } private QueryBuilder createQueryBuilder() { return searchManager.buildQueryBuilderForClass(Foo.class).get(); } @Indexed(index = "FooIndex") public class Foo { private String bar; public Foo(String bar) { this.bar = bar; } @Field(name = "bar", store = Store.YES) public String getBar() { return bar; } } }
92374f3862ec1e633945cb77f31d7ae06a113a49
2,816
java
Java
aliyun-java-sdk-rds-v5/src/main/java/com/aliyuncs/v5/rds/model/v20140815/DescribeAvailableZonesRequest.java
aliyun/aliyun-openapi-java-sdk-v5
0ece7a0ba3730796e7a7ce4970a23865cd11b57c
[ "Apache-2.0" ]
4
2020-05-14T05:04:30.000Z
2021-08-20T11:08:46.000Z
aliyun-java-sdk-rds-v5/src/main/java/com/aliyuncs/v5/rds/model/v20140815/DescribeAvailableZonesRequest.java
aliyun/aliyun-openapi-java-sdk-v5
0ece7a0ba3730796e7a7ce4970a23865cd11b57c
[ "Apache-2.0" ]
2
2020-10-13T07:47:10.000Z
2021-06-04T02:42:57.000Z
aliyun-java-sdk-rds-v5/src/main/java/com/aliyuncs/v5/rds/model/v20140815/DescribeAvailableZonesRequest.java
aliyun/aliyun-openapi-java-sdk-v5
0ece7a0ba3730796e7a7ce4970a23865cd11b57c
[ "Apache-2.0" ]
null
null
null
26.317757
121
0.737216
998,014
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.v5.rds.model.v20140815; import com.aliyuncs.v5.RpcAcsRequest; import com.aliyuncs.v5.http.MethodType; import com.aliyuncs.v5.rds.Endpoint; /** * @author auto create * @version */ public class DescribeAvailableZonesRequest extends RpcAcsRequest<DescribeAvailableZonesResponse> { private Long resourceOwnerId; private String engineVersion; private String engine; private String instanceChargeType; private String zoneId; public DescribeAvailableZonesRequest() { super("Rds", "2014-08-15", "DescribeAvailableZones", "rds"); setMethod(MethodType.POST); try { com.aliyuncs.v5.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap); com.aliyuncs.v5.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType); } catch (Exception e) {} } public Long getResourceOwnerId() { return this.resourceOwnerId; } public void setResourceOwnerId(Long resourceOwnerId) { this.resourceOwnerId = resourceOwnerId; if(resourceOwnerId != null){ putQueryParameter("ResourceOwnerId", resourceOwnerId.toString()); } } public String getEngineVersion() { return this.engineVersion; } public void setEngineVersion(String engineVersion) { this.engineVersion = engineVersion; if(engineVersion != null){ putQueryParameter("EngineVersion", engineVersion); } } public String getEngine() { return this.engine; } public void setEngine(String engine) { this.engine = engine; if(engine != null){ putQueryParameter("Engine", engine); } } public String getInstanceChargeType() { return this.instanceChargeType; } public void setInstanceChargeType(String instanceChargeType) { this.instanceChargeType = instanceChargeType; if(instanceChargeType != null){ putQueryParameter("InstanceChargeType", instanceChargeType); } } public String getZoneId() { return this.zoneId; } public void setZoneId(String zoneId) { this.zoneId = zoneId; if(zoneId != null){ putQueryParameter("ZoneId", zoneId); } } @Override public Class<DescribeAvailableZonesResponse> getResponseClass() { return DescribeAvailableZonesResponse.class; } }
92374fb0bdbe5f30069d513c833138384a403d77
1,248
java
Java
datarouter-storage/src/main/java/io/datarouter/storage/node/factory/NodeFactory.java
hoolatech/datarouter-1
4893f78bb519c40347f8f692a48cc2bceeb7f0db
[ "Apache-2.0" ]
38
2017-06-14T17:47:52.000Z
2022-02-12T15:24:44.000Z
datarouter-storage/src/main/java/io/datarouter/storage/node/factory/NodeFactory.java
hoolatech/datarouter-1
4893f78bb519c40347f8f692a48cc2bceeb7f0db
[ "Apache-2.0" ]
1
2019-10-24T22:40:24.000Z
2019-10-24T22:40:24.000Z
datarouter-storage/src/main/java/io/datarouter/storage/node/factory/NodeFactory.java
hoolatech/datarouter-1
4893f78bb519c40347f8f692a48cc2bceeb7f0db
[ "Apache-2.0" ]
9
2017-06-14T18:50:59.000Z
2022-02-01T00:18:52.000Z
32
75
0.783654
998,015
/** * Copyright © 2009 HotPads (kenaa@example.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.datarouter.storage.node.factory; import javax.inject.Inject; import javax.inject.Singleton; import io.datarouter.inject.DatarouterInjector; import io.datarouter.storage.Datarouter; import io.datarouter.storage.client.DatarouterClients; import io.datarouter.storage.config.setting.DatarouterStorageSettingRoot; @Singleton public class NodeFactory extends BaseNodeFactory{ @Inject private NodeFactory( Datarouter datarouter, DatarouterClients clients, DatarouterStorageSettingRoot storageSettings, DatarouterInjector injector){ super(datarouter, clients, injector, storageSettings.recordCallsites); } }
92374ff560bfa14016c7ee1ecf7d9ec1148e2789
776
java
Java
axon-sfav-customer/src/main/java/cn/designthoughts/sample/axon/sfav/customer/domain/Status.java
sfav/axon-springboot-cloud
39b4e93b0db2c6e19b19896fd7a738a93b64d9cf
[ "Apache-1.1" ]
29
2016-05-30T10:09:31.000Z
2020-08-11T00:35:28.000Z
axon-sfav-customer/src/main/java/cn/designthoughts/sample/axon/sfav/customer/domain/Status.java
sfav/axon-springboot-cloud
39b4e93b0db2c6e19b19896fd7a738a93b64d9cf
[ "Apache-1.1" ]
null
null
null
axon-sfav-customer/src/main/java/cn/designthoughts/sample/axon/sfav/customer/domain/Status.java
sfav/axon-springboot-cloud
39b4e93b0db2c6e19b19896fd7a738a93b64d9cf
[ "Apache-1.1" ]
16
2016-07-25T06:04:23.000Z
2021-05-27T14:18:23.000Z
26.758621
75
0.724227
998,016
/* * Copyright (c) 2016-2026. DesignThoughts Axon Sample * * 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 cn.designthoughts.sample.axon.sfav.customer.domain; /** * @author Thomas Yuan */ public enum Status { ACTIVE, INACTIVE, BLOCKED }
9237518b5f00f2c9bcdd79feda156f84889d2219
17,748
java
Java
chi-maven-plugin/src/main/java/ca/infoway/messagebuilder/generator/cda/CdaXsdFormatter.java
CanadaHealthInfoway/message-builder
a24b368b6ad7330ce8e1319e6bae130cea981818
[ "Apache-2.0" ]
1
2022-03-09T12:17:41.000Z
2022-03-09T12:17:41.000Z
chi-maven-plugin/src/main/java/ca/infoway/messagebuilder/generator/cda/CdaXsdFormatter.java
CanadaHealthInfoway/message-builder
a24b368b6ad7330ce8e1319e6bae130cea981818
[ "Apache-2.0" ]
null
null
null
chi-maven-plugin/src/main/java/ca/infoway/messagebuilder/generator/cda/CdaXsdFormatter.java
CanadaHealthInfoway/message-builder
a24b368b6ad7330ce8e1319e6bae130cea981818
[ "Apache-2.0" ]
null
null
null
36.073171
138
0.710672
998,017
/** * Copyright 2013 Canada Health Infoway, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Author: $LastChangedBy: tmcgrady $ * Last modified: $LastChangedDate: 2013-01-02 17:05:34 -0500 (Wed, 02 Jan 2013) $ * Revision: $LastChangedRevision: 6471 $ */ package ca.infoway.messagebuilder.generator.cda; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; import org.apache.commons.lang.StringUtils; import ca.infoway.messagebuilder.datatype.StandardDataType; import ca.infoway.messagebuilder.generator.OutputUI; import ca.infoway.messagebuilder.xml.Cardinality; import ca.infoway.messagebuilder.xml.ConstrainedDatatype; import ca.infoway.messagebuilder.xml.DomainSource; import ca.infoway.messagebuilder.xml.Interaction; import ca.infoway.messagebuilder.xml.MessagePart; import ca.infoway.messagebuilder.xml.MessageSet; import ca.infoway.messagebuilder.xml.PackageLocation; import ca.infoway.messagebuilder.xml.Relationship; import ca.infoway.messagebuilder.xml.cda.vocabulary.ValueSetDefinition; import ca.infoway.messagebuilder.xml.cda.vocabulary.ValueSetDefinitionSystem; public class CdaXsdFormatter { private static class InferredComplexContent { private String name; private String baseType; private List<InferredAttribute> attributes = new ArrayList<InferredAttribute>(); public String getName() { return name; } public String getBaseType() { return baseType; } public List<InferredAttribute> getAttributes() { return attributes; } } private static class InferredAttribute { private String name; private String type; private String use; private String fixed; public InferredAttribute(String name, String type, String use, String fixed) { super(); this.name = name; this.type = type; this.use = use; this.fixed = fixed; } public String getName() { return name; } public String getType() { return type; } public String getUse() { return use; } public String getFixed() { return fixed; } } private OutputUI outputUI; private Map<String, String> codeSystemMap = new HashMap<String, String>(); private Map<String, Object> complexTypes; /* * We need to override standard alphabetical order in order to force the constrained datatypes to appear in the * right places in the sequence. "Infrastructure Root" datatypes are global, and must appear at the very top of the file. * Datatypes that are specific to a particular element must appear immediately before that element. * */ private static class ComplexTypeNameComparitor implements Comparator<String> { private static final String INFRASTRUCTURE_MARKER = ".InfrastructureRoot."; @Override public int compare(String arg0, String arg1) { // Force infrastructure constrained types to float to the top if (arg0.contains(INFRASTRUCTURE_MARKER) && !arg1.contains(INFRASTRUCTURE_MARKER)) { return -1; } if (!arg0.contains(INFRASTRUCTURE_MARKER) && arg1.contains(INFRASTRUCTURE_MARKER)) { return 1; } // class-specific types if (isExtensionOf(arg0, arg1)) { return -1; } if (isExtensionOf(arg1, arg0)) { return 1; } // sort order should be case insensitive return arg0.toLowerCase().compareTo(arg1.toLowerCase()); } private boolean isExtensionOf(String arg0, String arg1) { int length = arg1.length(); return arg0.length() > length && arg0.startsWith(arg1) && arg0.charAt(length) == '.'; } } public CdaXsdFormatter(OutputUI outputUI, ValueSetDefinition valueSetDefinition) { this.outputUI = outputUI; for (ValueSetDefinitionSystem system : valueSetDefinition.getSystems()) { if (StringUtils.isNotBlank(system.getCodeSystemName())) { this.codeSystemMap.put(system.getCodeSystemName(), system.getCodeSystemOid()); } } } public void formatSchema(Schema schema, MessageSet messageSet, String packageName) { complexTypes = new TreeMap<String, Object>(new ComplexTypeNameComparitor()); PackageLocation packageLocation = messageSet.getPackageLocation(packageName); if (messageSet.getSchemaMetadata() != null) { schema.setTargetNamespace(messageSet.getSchemaMetadata().getTargetNamespace()); schema.setElementFormDefault(messageSet.getSchemaMetadata().getElementFormDefault()); schema.setAnnotation(new Annotation()); Documentation documentation = new Documentation(); documentation.setText("Generated using message builder version 2.0."); schema.getAnnotation().getDocumentation().add(documentation); for (String schemaLocation : gatherSchemaDependencies(packageLocation, packageName)) { schema.getIncludes().add(new Include(schemaLocation + ".xsd")); } } Interaction interaction = messageSet.getInteractions().get(packageName); if (interaction != null) { XsElement rootElement = new XsElement(); rootElement.setName(StringUtils.substringAfterLast(interaction.getSuperTypeName(), ".")); rootElement.setType(interaction.getSuperTypeName()); schema.addElement(rootElement); } if (packageLocation != null) { for (MessagePart messagePart : packageLocation.getMessageParts().values()) { if (messagePart.getSpecializationChilds().size() == 0) { // the parts representing choice blocks do not appear as types in the output complexTypes.put(messagePart.getName(), messagePart); for (Relationship relationship : messagePart.getRelationships()) { if (isCandidate(relationship)) { InferredComplexContent content = create(relationship, messagePart); complexTypes.put(content.getName(), content); } } } } } for (ConstrainedDatatype datatype : messageSet.getAllConstrainedDatatypes()) { if (StringUtils.startsWith(datatype.getName(), packageName) && isValidComplexConstraint(datatype)) { complexTypes.put(datatype.getName(), datatype); } } for (Entry<String,Object> entry : complexTypes.entrySet()) { ComplexType complexType = new ComplexType(); complexType.setName(reformatTypeName(entry.getKey())); Object part = entry.getValue(); if (part instanceof MessagePart) { populateComplexType(complexType, (MessagePart) part); } else if (part instanceof ConstrainedDatatype) { populateComplexType(complexType, (ConstrainedDatatype) part); } else if (part instanceof InferredComplexContent) { populateComplexType(complexType, (InferredComplexContent) part); } schema.getComplexTypes().add(complexType); } } /* * Since we replaced the base model name with a more user-friendly on in the parser, we need to reverse the change here. */ private String reformatTypeName(String modelName) { String rename = StringUtils.replace(modelName, "BaseModel", "POCD_MT000040"); return rename; } private boolean isValidComplexConstraint(ConstrainedDatatype datatype) { boolean valid = false; for (Relationship relationship : datatype.getRelationships()) { valid |= relationship.hasFixedValue(); } return valid; } private Set<String> gatherSchemaDependencies(PackageLocation packageLocation, String packageName) { TreeSet<String> result = new TreeSet<String>(); for (MessagePart messagePart : packageLocation.getMessageParts().values()) { for (Relationship relationship : messagePart.getRelationships()) { if (relationship.isAssociation() && !StringUtils.startsWith(relationship.getType(), packageName)) { String dependencyPackage = StringUtils.substringBefore(relationship.getType(), "."); if (StringUtils.equals(dependencyPackage, "BaseModel")) { result.add("POCD_MT000040"); } else { result.add(dependencyPackage); } } } } return result; } private void populateComplexType(ComplexType complexType, MessagePart part) { for (Relationship relationship : insertNullFlavor(part)) { if (relationship.isAttribute()) { if (relationship.isStructural()) { XsAttribute attribute = formatAttribute(relationship); complexType.getAttributes().add(attribute); } else { XsElement element = formatElement(relationship, part); addElement(element, complexType); } } else { if (relationship.isChoice()) { Choice choice = new Choice(); if (relationship.getCardinality().isMultiple()) { if (relationship.getCardinality().getMin() != 1) { choice.setMinOccurs(String.valueOf(relationship.getCardinality().getMin())); } if (relationship.getCardinality().getMax().equals(Integer.MAX_VALUE)) { choice.setMaxOccurs("unbounded"); } } for (Relationship choiceElement : relationship.getChoices()) { choice.getElements().add(formatElementAsChoiceOption(choiceElement, relationship)); } addElement(choice, complexType); } else { XsElement element = formatElement(relationship, part); addElement(element, complexType); } } } } private List<Relationship> insertNullFlavor(MessagePart part) { // During parsing, we had to filter out the attribute representing the nullFlavor // When exporting an XSD, we need to restore it Relationship nullFlavorRelationship = new Relationship("nullFlavor", "NullFlavor", new Cardinality(0, 1)); nullFlavorRelationship.setStructural(true); ArrayList<Relationship> result = new ArrayList<Relationship>(); List<Relationship> relationships = part.getRelationships(); result.addAll(relationships); if (relationships.size() > 0 && StringUtils.equals(relationships.get(0).getName(), "ID")) { result.add(1, nullFlavorRelationship); } else { result.add(0, nullFlavorRelationship); } return result; } private XsElement formatElement(Relationship relationship, MessagePart part) { XsElement element = new XsElement(); element.setName(relationship.getName()); String constrainedTypeName = relationship.getConstrainedType(); if (isRenderableConstrainedType(constrainedTypeName) && relationship.getCardinality().isSingle()) { element.setType(reformatTypeName(constrainedTypeName)); } else if (isCandidate(relationship)) { element.setType(reformatTypeName(formatName(relationship, part))); } else { if (relationship.getCardinality().isMultiple() && StandardDataType.isSetOrList(relationship.getType())) { element.setType(StandardDataType.getTemplateArgument(relationship.getType()).getName()); } else { StandardDataType standardType = StandardDataType.getByTypeName(relationship.getType()); if (standardType != null) { element.setType(standardType.getName()); } else { element.setType(reformatTypeName(relationship.getType())); } } } if (relationship.getCardinality().getMin() != 1) { element.setMinOccurs(String.valueOf(relationship.getCardinality().getMin())); } if (relationship.getCardinality().getMax().equals(Integer.MAX_VALUE)) { element.setMaxOccurs("unbounded"); } return element; } private boolean isRenderableConstrainedType(String constrainedTypeName) { return constrainedTypeName != null && (complexTypes.containsKey(constrainedTypeName) || StringUtils.equals(constrainedTypeName, "StrucDoc.Text") || // special case, defined elsewhere StringUtils.startsWith(constrainedTypeName, "BaseModel.")); // inherited from base model } private XsElement formatElementAsChoiceOption(Relationship relationship, Relationship parent) { Cardinality choiceBlockCardinality = parent.getCardinality(); XsElement element = new XsElement(); if (choiceBlockCardinality.isMultiple()) { element.setName(parent.getName()); } else { element.setName(relationship.getName()); if (choiceBlockCardinality.getMin() != 1) { element.setMinOccurs(String.valueOf(choiceBlockCardinality.getMin())); } } element.setType(reformatTypeName(relationship.getType())); return element; } private void addElement(SequenceChild element, ComplexType complexType) { if (complexType.getSequence() == null) { complexType.setSequence(new Sequence()); } complexType.getSequence().getChildren().add(element); } private XsAttribute formatAttribute(Relationship relationship) { XsAttribute attribute = new XsAttribute(); attribute.setName(relationship.getName()); if ("CS".equals(relationship.getType())) { attribute.setType(relationship.getDomainType()); } else if ("NullFlavor".equals(relationship.getType())) { attribute.setType(relationship.getType()); } else if (StringUtils.isNotBlank(relationship.getConstrainedType()) && relationship.getCardinality().isSingle()) { attribute.setType(relationship.getConstrainedType()); } else if (StringUtils.isBlank(relationship.getType())) { if (StringUtils.equals(relationship.getName(), "root")) { attribute.setType("uid"); } else if (StringUtils.equals(relationship.getName(), "extension")) { attribute.setType("st"); } else if (StringUtils.equals(relationship.getName(), "code")) { attribute.setType("cs"); } else if (StringUtils.equals(relationship.getName(), "codeSystem")) { attribute.setType("uid"); } else if (StringUtils.equals(relationship.getName(), "low")) { attribute.setType("ts"); } else if (StringUtils.equals(relationship.getName(), "high")) { attribute.setType("ts"); } else if (StringUtils.equals(relationship.getName(), "operator")) { attribute.setType("SetOperator"); } else if (StringUtils.equals(relationship.getName(), "mediaType")) { attribute.setType("cs"); } else { attribute.setType("nil"); } } else { attribute.setType(relationship.getType().toLowerCase()); } if (relationship.getCardinality().isMandatory() && relationship.getDefaultValue() == null) { attribute.setUse("required"); } else { attribute.setUse("optional"); } attribute.setFixed(relationship.getFixedValue()); attribute.setDefaultValue(relationship.getDefaultValue()); return attribute; } private void populateComplexType(ComplexType complexType, ConstrainedDatatype part) { complexType.setComplexContent(new ComplexContent()); ComplexContentChild child = null; if (part.isRestriction()) { child = new Restriction(); } else if (part.isExtension()) { child = new Extension(); } else { throw new IllegalArgumentException("Constrained datatype " + part.getName() + " is not valid."); } StandardDataType standardType = StandardDataType.getByTypeName(part.getBaseType()); if (standardType != null) { child.setBase(standardType.getName()); } else { child.setBase(part.getBaseType()); } for (Relationship attribute : part.getRelationships()) { if (attribute.hasFixedValue()) { child.getAttributes().add(formatAttribute(attribute)); } } complexType.getComplexContent().setChild(child); } private void populateComplexType(ComplexType complexType, InferredComplexContent part) { complexType.setComplexContent(new ComplexContent()); ComplexContentChild child = new Restriction(); child.setBase(part.getBaseType()); for (InferredAttribute attribute : part.getAttributes()) { child.getAttributes().add(formatAttribute(attribute)); } complexType.getComplexContent().setChild(child); } private XsAttribute formatAttribute(InferredAttribute attribute) { XsAttribute result = new XsAttribute(); result.setName(attribute.getName()); result.setType(attribute.getType()); result.setUse(attribute.getUse()); result.setFixed(attribute.getFixed()); return result; } public boolean isCandidate(Relationship relationship) { return !relationship.isStructural() && relationship.isCodedType() && relationship.hasFixedValue(); } public InferredComplexContent create(Relationship relationship, MessagePart messagePart) { InferredComplexContent content = new InferredComplexContent(); content.name = formatName(relationship, messagePart); content.baseType = relationship.getType(); if (relationship.isCodedType()) { content.attributes.add(new InferredAttribute("code", "cs", "required", relationship.getFixedValue())); if (!StringUtils.equals(relationship.getType(), "CS") && DomainSource.CODE_SYSTEM.equals(relationship.getDomainSource()) && StringUtils.isNotBlank(relationship.getDomainType())) { content.attributes.add(new InferredAttribute("codeSystem", "uid", "required", this.codeSystemMap.get(relationship.getDomainType()))); } } return content; } private String formatName(Relationship relationship, MessagePart messagePart) { return messagePart.getName() + "." + relationship.getName(); } }
92375288cd57c5e415c2321ae2a2b98cb084631e
3,632
java
Java
src/test/java/org/zhekehz/stpjava/TestConst.java
AbdullinAM/stp-java
f676bf60bddc8d1ce9f6148d092c53cdd5e86b74
[ "Apache-2.0" ]
null
null
null
src/test/java/org/zhekehz/stpjava/TestConst.java
AbdullinAM/stp-java
f676bf60bddc8d1ce9f6148d092c53cdd5e86b74
[ "Apache-2.0" ]
null
null
null
src/test/java/org/zhekehz/stpjava/TestConst.java
AbdullinAM/stp-java
f676bf60bddc8d1ce9f6148d092c53cdd5e86b74
[ "Apache-2.0" ]
null
null
null
32.428571
99
0.634912
998,018
package org.zhekehz.stpjava; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; public class TestConst extends TestBase { @Test public void testBVPlusExtract() { BitVectorExpr test = BitVectorExpr.fromInt(vc, 32, 144) .plus(BitVectorExpr.fromInt(vc, 32, 112)) .extract(31, 8); assertTrue(test.isConst()); assertEquals(1, test.toInt()); } @Test public void testBVConcatShift() { BitVectorExpr test = BitVectorExpr.fromInt(vc, 4, 15) .concat(BitVectorExpr.fromInt(vc, 4, 15)) .leftShift(BitVectorExpr.fromInt(vc, 4, 4), 9) .equiv(BitVectorExpr.fromLong(vc, 9, 0b111110000)) .toBitVector(); assertEquals(1, test.toInt()); } @Test public void testBVShiftExtend() { BitVectorExpr ff = BitVectorExpr.fromInt(vc, 4, 0b1111); BitVectorExpr i3 = BitVectorExpr.fromInt(vc, 4, 3); BitVectorExpr one = BitVectorExpr.fromInt(vc, 4, 1); BoolExpr test1 = ff.rightShift(i3, 4).equiv(one); assertTrue(test1.toBoolean()); BoolExpr test2 = ff.signedRightShift(i3, 4).equiv(ff); assertTrue(test2.toBoolean()); assertEquals(0b11111111, ff.signExtend(8).toInt()); assertEquals(0b00000011, i3.signExtend(8).toInt()); } @Test public void testBVExtractOnt() { assertTrue(BoolExpr.getTrue(vc).toBitVector().extractOne(0).toBoolean()); } @Test public void testMemArray() { MemoryArrayExpr array = new MemoryArrayExpr(vc, "mem_array"); BitVectorExpr idx1 = BitVectorExpr.fromInt(vc, 32, 0); BitVectorExpr idx2 = BitVectorExpr.fromInt(vc, 32, 1); BitVectorExpr bv1 = array.read(idx1, 2); BitVectorExpr bv2 = array.read(idx2, 1); bv1.equiv(BitVectorExpr.fromInt(vc, 16, 0b10010101010)).assertFormula(); BoolExpr.getFalse(vc).query(); assertEquals(0b10010101010, bv1.getCounterExample().toInt()); assertEquals(0b10101010, array.read(idx1, 1).getCounterExample().toInt()); assertEquals(0b100, bv2.getCounterExample().toInt()); } @Test public void testSort() { BitVectorExpr bv1 = new BitVectorExpr(vc, "123", 123); BitVectorExpr bv2 = BitVectorExpr.fromInt(vc, 123, 1); assertEquals(bv1.getSort(), bv2.getSort()); assertEquals(bv1.asBool().getSort(), BoolExpr.getFalse(vc).getSort()); assertEquals(bv1.extractZero(1).getSort(), BoolExpr.getFalse(vc).getSort()); } @Test public void testBVZeroExtend() { int testNum = 1876; BitVectorExpr bv1 = BitVectorExpr.fromInt(vc, 11, testNum); BitVectorExpr bv2 = BitVectorExpr.fromInt(vc, 17, testNum); assertTrue(bv1.zeroExtend(17).equiv(bv2).toBoolean()); } @Test public void testBoolBasicCompare() { BoolExpr f = BoolExpr.getFalse(vc); BoolExpr t = BoolExpr.getTrue(vc); assertEquals(QueryResult.VALID, f.equiv(t).not().query()); } @Test public void testConstArray() { ConstArrayExpr arrayExpr = new ConstArrayExpr(vc, 123, BitVectorExpr.fromInt(vc, 16, 444)); assertEquals(444, arrayExpr.read(BitVectorExpr.fromInt(vc, 123, 33)).toInt()); } @Test public void testSMTPrint() { BitVectorExpr bv1 = BitVectorExpr.fromInt(vc, 17, 44); BitVectorExpr bv2 = BitVectorExpr.fromInt(vc, 17, 33); String res = bv1.plus(bv2).or(bv1.minus(bv2)).toSMTLib2(); System.out.println(res); } }
923752bc82640e530ad33997582f073233425d8a
2,729
java
Java
workspace_BOS/billing-api-LAST/billing-service/billingOss/src/main/java/com/api/service/ContractService.java
billingoss/product_202002
7f579b2c0f45d86ffbca208d0904408089968031
[ "Apache-2.0" ]
null
null
null
workspace_BOS/billing-api-LAST/billing-service/billingOss/src/main/java/com/api/service/ContractService.java
billingoss/product_202002
7f579b2c0f45d86ffbca208d0904408089968031
[ "Apache-2.0" ]
null
null
null
workspace_BOS/billing-api-LAST/billing-service/billingOss/src/main/java/com/api/service/ContractService.java
billingoss/product_202002
7f579b2c0f45d86ffbca208d0904408089968031
[ "Apache-2.0" ]
null
null
null
56.854167
88
0.877977
998,019
package com.api.service; import java.util.List; import com.api.model.contract.ContractInsert; public interface ContractService { List<ContractInsert> getProductList(ContractInsert contractInsert); List<ContractInsert> getProductListByGroup(ContractInsert contractInsert); List<ContractInsert> getDiscountList(ContractInsert contractInsert); List<ContractInsert> getProduct(ContractInsert contractInsert); ContractInsert getAddressid(ContractInsert contractInsert); int createDeliveryAddress(ContractInsert contractInsert); List<ContractInsert> getCustomerNumber(ContractInsert contractInsert); int insertCustomer(ContractInsert contractInsert); int insertDeliveryCustomer(ContractInsert contractInsert); List<ContractInsert> getContractDone(ContractInsert contractInsert); List<ContractInsert> getContractList(ContractInsert contractInsert); List<ContractInsert> getDeliveryList(ContractInsert contractInsert); List<ContractInsert> getInvoiceList(ContractInsert contractInsert); int paymentInfoInsert(ContractInsert contractInsert); ContractInsert getDeliveryDate(ContractInsert contractInsert); ContractInsert getDeliveryDate1(ContractInsert contractInsert); ContractInsert getDeliveryDate2(ContractInsert contractInsert); ContractInsert getDeliveryCount1(ContractInsert contractInsert); ContractInsert getDeliveryCount2(ContractInsert contractInsert); ContractInsert getDeliveryDateWeek1(ContractInsert contractInsert); ContractInsert getDeliveryDateWeek2(ContractInsert contractInsert); ContractInsert getDeliveryWeekCount1(ContractInsert contractInsert); ContractInsert getDeliveryWeekCount2(ContractInsert contractInsert); int insertDeliveryDetail(ContractInsert contractInsert); int insertDeliveryDetail1(ContractInsert contractInsert); int insertDeliveryDetail2(ContractInsert contractInsert); int insertDeliveryDetailWeek1(ContractInsert contractInsert); int insertDeliveryDetailWeek2(ContractInsert contractInsert); int createContract(ContractInsert contractInsert); int createContractProduct(ContractInsert contractInsert); int createContractDiscount(ContractInsert contractInsert); List<ContractInsert> getDeliveryChargeAmount(ContractInsert contractInsert); List<ContractInsert> getCustomerByChannelCustomerNumber(ContractInsert contractInsert); List<ContractInsert> getDeliveryDateByDeliverySeq(ContractInsert contractInsert); int insertDeliveryDetailByDeliveryDay(ContractInsert contractInsert); int insertContractAddition(ContractInsert contractInsert); int updateCustomerEmail(ContractInsert contractInsert); List<ContractInsert> getProviderTerms(ContractInsert contractInsert); List<ContractInsert> getContractByChannelOrderNumber(ContractInsert contractInsert); }
923753d26efdc68c242e95e1ca70c9f788f0fa34
13,899
java
Java
rest/taskana-rest-spring/src/main/java/pro/taskana/ldap/LdapClient.java
finnmissfeldt/taskana
fd8afec9cb117a3570f3f1053d074388629854a5
[ "Apache-2.0" ]
1
2018-08-02T14:33:15.000Z
2018-08-02T14:33:15.000Z
rest/taskana-rest-spring/src/main/java/pro/taskana/ldap/LdapClient.java
ignaciorecuerda/taskana
d2d268eac1dd0f01726e19036c1bcd340ed13b89
[ "Apache-2.0" ]
null
null
null
rest/taskana-rest-spring/src/main/java/pro/taskana/ldap/LdapClient.java
ignaciorecuerda/taskana
d2d268eac1dd0f01726e19036c1bcd340ed13b89
[ "Apache-2.0" ]
null
null
null
40.286957
120
0.675156
998,020
package pro.taskana.ldap; import java.util.List; import javax.annotation.PostConstruct; import javax.naming.directory.SearchControls; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.ldap.core.DirContextOperations; import org.springframework.ldap.core.LdapTemplate; import org.springframework.ldap.core.support.AbstractContextMapper; import org.springframework.ldap.filter.AndFilter; import org.springframework.ldap.filter.EqualsFilter; import org.springframework.ldap.filter.OrFilter; import org.springframework.ldap.filter.WhitespaceWildcardsFilter; import org.springframework.stereotype.Component; import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.SystemException; import pro.taskana.impl.util.LoggerUtils; import pro.taskana.rest.resource.AccessIdResource; /** * Class for Ldap access. * * @author bbr */ @Component public class LdapClient { public static final String TASKANA_USE_LDAP_PROP_NAME = "taskana.ldap.useLdap"; private static final Logger LOGGER = LoggerFactory.getLogger(LdapClient.class); private static final String CN = "cn"; private boolean active = false; @Autowired private Environment env; @Autowired(required = false) private LdapTemplate ldapTemplate; private String userSearchBase; private String userSearchFilterName; private String userSearchFilterValue; private String userFirstnameAttribute; private String userLastnameAttribute; private String userIdAttribute; private String groupSearchBase; private String groupSearchFilterName; private String groupSearchFilterValue; private String groupNameAttribute; private String groupsOfUser; private int minSearchForLength; private int maxNumberOfReturnedAccessIds; private String message; @PostConstruct private void init() { LOGGER.debug("Entry to init()"); String strMinSearchForLength = getMinSearchForLengthAsString(); if (strMinSearchForLength == null || strMinSearchForLength.isEmpty()) { minSearchForLength = 3; } else { minSearchForLength = Integer.parseInt(strMinSearchForLength); } String strMaxNumberOfReturnedAccessIds = getMaxNumberOfReturnedAccessIdsAsString(); if (strMaxNumberOfReturnedAccessIds == null || strMaxNumberOfReturnedAccessIds.isEmpty()) { maxNumberOfReturnedAccessIds = 50; } else { maxNumberOfReturnedAccessIds = Integer.parseInt(strMaxNumberOfReturnedAccessIds); } if (useLdap()) { userSearchBase = getUserSearchBase(); userSearchFilterName = getUserSearchFilterName(); userSearchFilterValue = getUserSearchFilterValue(); userFirstnameAttribute = getUserFirstnameAttribute(); userLastnameAttribute = getUserLastnameAttribute(); userIdAttribute = getUserIdAttribute(); groupSearchBase = getGroupSearchBase(); groupSearchFilterName = getGroupSearchFilterName(); groupSearchFilterValue = getGroupSearchFilterValue(); groupNameAttribute = getGroupNameAttribute(); groupsOfUser = getGroupsOfUser(); ldapTemplate.setDefaultCountLimit(maxNumberOfReturnedAccessIds); final String emptyMessage = "taskana.ldap.useLdap is set to true, but"; message = emptyMessage; if (userSearchBase == null) { message += " taskana.ldap.userSearchBase is not configured."; } if (userSearchFilterName == null) { message += " taskana.ldap.userSearchFilterName is not configured."; } if (userSearchFilterValue == null) { message += " taskana.ldap.userSearchFilterValue is not configured."; } if (userFirstnameAttribute == null) { message += " taskana.ldap.userFirstnameAttribute is not configured."; } if (userLastnameAttribute == null) { message += " taskana.ldap.userLastnameAttribute is not configured."; } if (userIdAttribute == null) { message += " taskana.ldap.userIdAttribute is not configured."; } if (groupSearchBase == null) { message += " taskana.ldap.groupSearchBase is not configured."; } if (groupSearchFilterName == null) { message += " taskana.ldap.groupSearchFilterName is not configured."; } if (groupSearchFilterValue == null) { message += " taskana.ldap.groupSearchFilterValue is not configured."; } if (groupNameAttribute == null) { message += " taskana.ldap.groupNameAttribute is not configured."; } if (groupsOfUser == null) { message += " taskana.ldap.groupsOfUser is not configured."; } if (!message.equals(emptyMessage)) { throw new SystemException(message); } active = true; } LOGGER.debug("Exit from init()"); } public List<AccessIdResource> searchUsersAndGroups(final String name) throws InvalidArgumentException { LOGGER.debug("entry to searchUsersAndGroups(name = {})", name); if (!active) { throw new SystemException( "LdapClient was called but is not active due to missing configuration: " + message); } testMinSearchForLength(name); List<AccessIdResource> users = searchUsersByName(name); users.addAll(searchGroupsByName(name)); users.sort((AccessIdResource a, AccessIdResource b) -> { return a.getAccessId().compareToIgnoreCase(b.getAccessId()); }); List<AccessIdResource> result = users.subList(0, Math.min(users.size(), maxNumberOfReturnedAccessIds)); LOGGER.debug("exit from searchUsersAndGroups(name = {}). Returning {} users and groups: {}", name, users.size(), LoggerUtils.listToString(result)); return result; } public List<AccessIdResource> searchUsersByName(final String name) throws InvalidArgumentException { LOGGER.debug("entry to searchUsersByName(name = {}).", name); if (!active) { throw new SystemException( "LdapClient was called but is not active due to missing configuration: " + message); } testMinSearchForLength(name); final AndFilter andFilter = new AndFilter(); andFilter.and(new EqualsFilter(getUserSearchFilterName(), getUserSearchFilterValue())); final OrFilter orFilter = new OrFilter(); orFilter.or(new WhitespaceWildcardsFilter(getUserFirstnameAttribute(), name)); orFilter.or(new WhitespaceWildcardsFilter(getUserLastnameAttribute(), name)); orFilter.or(new WhitespaceWildcardsFilter(getUserIdAttribute(), name)); andFilter.and(orFilter); String[] userAttributesToReturn = {getUserFirstnameAttribute(), getUserLastnameAttribute(), getUserIdAttribute()}; final List<AccessIdResource> accessIds = ldapTemplate.search(getUserSearchBase(), andFilter.encode(), SearchControls.SUBTREE_SCOPE, userAttributesToReturn, new UserContextMapper()); LOGGER.debug("exit from searchUsersByName. Retrieved the following users: {}.", LoggerUtils.listToString(accessIds)); return accessIds; } public List<AccessIdResource> searchGroupsByName(final String name) throws InvalidArgumentException { LOGGER.debug("entry to searchGroupsByName(name = {}).", name); if (!active) { throw new SystemException( "LdapClient was called but is not active due to missing configuration: " + message); } testMinSearchForLength(name); final AndFilter andFilter = new AndFilter(); andFilter.and(new EqualsFilter(getGroupSearchFilterName(), getGroupSearchFilterValue())); final OrFilter orFilter = new OrFilter(); orFilter.or(new WhitespaceWildcardsFilter(getGroupNameAttribute(), name)); if (!CN.equals(groupNameAttribute)) { orFilter.or(new WhitespaceWildcardsFilter(CN, name)); } andFilter.and(orFilter); String[] groupAttributesToReturn; if (CN.equals(groupNameAttribute)) { groupAttributesToReturn = new String[] {CN}; } else { groupAttributesToReturn = new String[] {getGroupNameAttribute(), CN}; } final List<AccessIdResource> accessIds = ldapTemplate.search(getGroupSearchBase(), andFilter.encode(), SearchControls.SUBTREE_SCOPE, groupAttributesToReturn, new GroupContextMapper()); LOGGER.debug("Exit from searchGroupsByName. Retrieved the following groups: {}", LoggerUtils.listToString(accessIds)); return accessIds; } public List<AccessIdResource> searchGroupsofUsersIsMember(final String name) throws InvalidArgumentException { LOGGER.debug("entry to searchGroupsofUsersIsMember(name = {}).", name); if (!active) { throw new SystemException( "LdapClient was called but is not active due to missing configuration: " + message); } testMinSearchForLength(name); final AndFilter andFilter = new AndFilter(); andFilter.and(new WhitespaceWildcardsFilter(getGroupNameAttribute(), "")); andFilter.and(new EqualsFilter(getGroupsOfUser(), name)); String[] userAttributesToReturn = {getUserIdAttribute(), getGroupNameAttribute()}; final List<AccessIdResource> accessIds = ldapTemplate.search(getGroupSearchBase(), andFilter.encode(), SearchControls.SUBTREE_SCOPE, userAttributesToReturn, new GroupContextMapper()); LOGGER.debug("exit from searchGroupsofUsersIsMember. Retrieved the following users: {}.", LoggerUtils.listToString(accessIds)); return accessIds; } private void testMinSearchForLength(final String name) throws InvalidArgumentException { if (name == null || name.length() < minSearchForLength) { throw new InvalidArgumentException("searchFor string " + name + " is too short. Minimum Length = " + getMinSearchForLength()); } } public boolean useLdap() { String useLdap = env.getProperty(TASKANA_USE_LDAP_PROP_NAME); if (useLdap == null || useLdap.isEmpty()) { return false; } else { return Boolean.parseBoolean(useLdap); } } public String getUserSearchBase() { return env.getProperty("taskana.ldap.userSearchBase"); } public String getUserSearchFilterName() { return env.getProperty("taskana.ldap.userSearchFilterName"); } public String getUserSearchFilterValue() { return env.getProperty("taskana.ldap.userSearchFilterValue"); } public String getUserFirstnameAttribute() { return env.getProperty("taskana.ldap.userFirstnameAttribute"); } public String getUserLastnameAttribute() { return env.getProperty("taskana.ldap.userLastnameAttribute"); } public String getUserIdAttribute() { return env.getProperty("taskana.ldap.userIdAttribute"); } public String getGroupSearchBase() { return env.getProperty("taskana.ldap.groupSearchBase"); } public String getGroupSearchFilterName() { return env.getProperty("taskana.ldap.groupSearchFilterName"); } public String getGroupSearchFilterValue() { return env.getProperty("taskana.ldap.groupSearchFilterValue"); } public String getGroupNameAttribute() { return env.getProperty("taskana.ldap.groupNameAttribute"); } public String getMinSearchForLengthAsString() { return env.getProperty("taskana.ldap.minSearchForLength"); } public int getMinSearchForLength() { return minSearchForLength; } public String getMaxNumberOfReturnedAccessIdsAsString() { return env.getProperty("taskana.ldap.maxNumberOfReturnedAccessIds"); } public int getMaxNumberOfReturnedAccessIds() { return maxNumberOfReturnedAccessIds; } public String getGroupsOfUser() { return env.getProperty("taskana.ldap.groupsOfUser"); } public boolean isGroup(String accessId) { return accessId.contains(getGroupSearchBase()); } /** * Context Mapper for user entries. */ private class UserContextMapper extends AbstractContextMapper<AccessIdResource> { @Override public AccessIdResource doMapFromContext(final DirContextOperations context) { final AccessIdResource accessId = new AccessIdResource(); accessId.setAccessId(context.getStringAttribute(getUserIdAttribute())); String firstName = context.getStringAttribute(getUserFirstnameAttribute()); String lastName = context.getStringAttribute(getUserLastnameAttribute()); accessId.setName(lastName + ", " + firstName); return accessId; } } /** * Context Mapper for user entries. */ private class GroupContextMapper extends AbstractContextMapper<AccessIdResource> { @Override public AccessIdResource doMapFromContext(final DirContextOperations context) { final AccessIdResource accessId = new AccessIdResource(); accessId.setAccessId(context.getNameInNamespace()); // fully qualified dn accessId.setName(context.getStringAttribute(getGroupNameAttribute())); return accessId; } } }
9237546083cc93678b0e2a147afc4c685f3648c2
366
java
Java
src/test/java/com/github/kasiprasad/contextspec/examples/MyRepository.java
kasiprasad/context-spec
8c1fc169dec00b5893ffa54fe61d456758385ea4
[ "MIT" ]
null
null
null
src/test/java/com/github/kasiprasad/contextspec/examples/MyRepository.java
kasiprasad/context-spec
8c1fc169dec00b5893ffa54fe61d456758385ea4
[ "MIT" ]
null
null
null
src/test/java/com/github/kasiprasad/contextspec/examples/MyRepository.java
kasiprasad/context-spec
8c1fc169dec00b5893ffa54fe61d456758385ea4
[ "MIT" ]
null
null
null
20.333333
67
0.70765
998,021
package com.github.kasiprasad.contextspec.examples; /** * An example of a class which has some behavior to test */ public class MyRepository { public String get(int id) throws IllegalArgumentException { if (id == 1) { return String.format("I looked up the given id: %d", id); } throw new IllegalArgumentException("The only id supported is 1"); } }
92375484b33a2618e0d469a168c3de1167697988
10,405
java
Java
src/main/java/citec/correlation/wikipedia/experiments/ThresoldsExperiment.java
fazleh2010/recent-ontoLex
f8730f50e3d219da5e57de4762cf9dd5237dd703
[ "Apache-2.0" ]
null
null
null
src/main/java/citec/correlation/wikipedia/experiments/ThresoldsExperiment.java
fazleh2010/recent-ontoLex
f8730f50e3d219da5e57de4762cf9dd5237dd703
[ "Apache-2.0" ]
null
null
null
src/main/java/citec/correlation/wikipedia/experiments/ThresoldsExperiment.java
fazleh2010/recent-ontoLex
f8730f50e3d219da5e57de4762cf9dd5237dd703
[ "Apache-2.0" ]
null
null
null
44.656652
174
0.619029
998,022
/* * 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 citec.correlation.wikipedia.experiments; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeMap; import org.javatuples.Pair; /** * * @author elahi */ public class ThresoldsExperiment implements NullInterestingness{ private LinkedHashMap<String, ThresoldELement> thresoldELements = new LinkedHashMap<String, ThresoldELement>(); public Map<String, List<Double>> interestingness = new TreeMap<String, List<Double>>(); public List<Double> supAList = new ArrayList<Double>(); public List<Double> supBList = new ArrayList<Double>(); public List<Double> confABList = new ArrayList<Double>(); public List<Double> confBAList = new ArrayList<Double>(); public List<Double> CosineList = new ArrayList<Double>(); public List<Double> AllConfList = new ArrayList<Double>(); public List<Double> MaxConfList = new ArrayList<Double>(); public List<Double> IrList = new ArrayList<Double>(); public List<Double> KulczynskiList = new ArrayList<Double>(); public List<Double> CoherenceList = new ArrayList<Double>(); public static List<Integer> numberOfRules = new ArrayList<Integer>(); public static List<Integer> nGram = new ArrayList<Integer>(); public ThresoldsExperiment(String type, String associationRule) { setParameters(type); createExperiment(associationRule); } public ThresoldsExperiment(String type) { setParameters(type); } public void setParameters(String type) { if (type.contains(OBJECT)) { supAList = new ArrayList<Double>(ObjectParamters.supAList); supBList = new ArrayList<Double>(ObjectParamters.supBList); confABList = new ArrayList<Double>(ObjectParamters.confABList); confBAList = new ArrayList<Double>(ObjectParamters.confBAList); CosineList = new ArrayList<Double>(ObjectParamters.probabiltyThresold); AllConfList = new ArrayList<Double>(ObjectParamters.probabiltyThresold); MaxConfList = new ArrayList<Double>(ObjectParamters.probabiltyThresold); IrList = new ArrayList<Double>(ObjectParamters.probabiltyThresold); KulczynskiList = new ArrayList<Double>(ObjectParamters.probabiltyThresold); CoherenceList = new ArrayList<Double>(ObjectParamters.probabiltyThresold); numberOfRules = new ArrayList<Integer>(ObjectParamters.numberOfRules); nGram = new ArrayList<Integer>(ObjectParamters.nGram); } else if (type.contains(PREDICATE)) { supAList = new ArrayList<Double>(PredicateParamters.supAList); supBList = new ArrayList<Double>(PredicateParamters.supBList); confABList = new ArrayList<Double>(PredicateParamters.confABList); confBAList = new ArrayList<Double>(PredicateParamters.confBAList); CosineList = new ArrayList<Double>(PredicateParamters.probabiltyThresold); AllConfList = new ArrayList<Double>(PredicateParamters.probabiltyThresold); MaxConfList = new ArrayList<Double>(PredicateParamters.probabiltyThresold); IrList = new ArrayList<Double>(PredicateParamters.probabiltyThresold); KulczynskiList = new ArrayList<Double>(PredicateParamters.probabiltyThresold); CoherenceList = new ArrayList<Double>(PredicateParamters.probabiltyThresold); numberOfRules = new ArrayList<Integer>(PredicateParamters.numberOfRules); nGram = new ArrayList<Integer>(PredicateParamters.nGram); } interestingness.put(NullInterestingness.Cosine, CosineList); interestingness.put(NullInterestingness.AllConf, AllConfList); interestingness.put(NullInterestingness.MaxConf, MaxConfList); interestingness.put(NullInterestingness.IR, IrList); interestingness.put(NullInterestingness.Kulczynski, KulczynskiList); interestingness.put(NullInterestingness.Coherence, CoherenceList); } /*public ThresoldsExperiment(String associationRule) { Integer index = 0; for (Integer numberOfRule : numberOfRules) { for (Double supA : supAList) { for (Double supB : supBList) { for (Double confAB : confABList) { for (Double confBA : confBAList) { for (Double probabiltyValue : this.getInterestingList(associationRule)) { index = index + 1; ThresoldELement thresoldELement = new ThresoldELement(supA, supB, confAB, confBA, associationRule, probabiltyValue, numberOfRule); //String line=associationRule+index.toString()+"-"+ thresoldELement; String line = associationRule + "-" + thresoldELement; thresoldELements.put(line, thresoldELement); } } } } } } }*/ private void createExperiment(String associationRule) { Integer index = 0; for (Integer n_gram : nGram) { for (Integer numberOfRule : numberOfRules) { for (Double supA : supAList) { for (Double supB : supBList) { for (Double confAB : confABList) { for (Double confBA : confBAList) { for (Double probabiltyValue : this.getInterestingList(associationRule)) { index = index + 1; ThresoldELement thresoldELement = new ThresoldELement(supA, supB, confAB, confBA, associationRule, probabiltyValue, numberOfRule, n_gram); //String line=associationRule+index.toString()+"-"+ thresoldELement; String line = associationRule + "-" + thresoldELement; thresoldELements.put(line, thresoldELement); } } } } } } } } public static Map<String, ThresoldsExperiment> createExperiments(String type, Set<String> interestingness) throws Exception { Map<String, ThresoldsExperiment> associationRulesExperiment = new TreeMap<String, ThresoldsExperiment>(); for (String associationRule : interestingness) { ThresoldsExperiment thresold = new ThresoldsExperiment(type); associationRulesExperiment.put(associationRule, thresold); } return associationRulesExperiment; } public LinkedHashMap<String, ThresoldELement> getThresoldELements() { return thresoldELements; } private List<Double> getInterestingList(String type) { if (type.contains(AllConf)) { return AllConfList; } else if (type.contains(MaxConf)) { return MaxConfList; } else if (type.contains(IR)) { return IrList; } else if (type.contains(Kulczynski)) { return KulczynskiList; } else if (type.contains(Cosine)) { return CosineList; } else if (type.contains(Coherence)) { return CoherenceList; } else { return new ArrayList<Double>(); } } public Map<String, List<Double>> getInterestingness() { return interestingness; } @Override public String toString() { return "ThresoldsExperiment{" + "thresoldELements=" + thresoldELements + '}'; } public class ThresoldELement { private Integer rules = 0; private Integer n_gram = 0; private String type = null; private LinkedHashMap<String, Double> givenThresolds = new LinkedHashMap<String, Double>(); public ThresoldELement(Double supA, Double supB, Double confAB, Double confBA, String type, Double probabiltyValue, Integer numberOfRules, Integer n_gram) { this.givenThresolds.put(NullInterestingness.supA, supA); this.givenThresolds.put(NullInterestingness.supB, supB); this.givenThresolds.put(NullInterestingness.condAB, confAB); this.givenThresolds.put(NullInterestingness.condBA, confBA); this.type = type; this.givenThresolds.put(type, probabiltyValue); this.rules = numberOfRules; this.n_gram = n_gram; } public ThresoldELement(Double supA, Double supB, Double confAB, Double confBA, String type, Double probabiltyValue, Integer numberOfRules) { this.givenThresolds.put(NullInterestingness.supA, supA); this.givenThresolds.put(NullInterestingness.supB, supB); this.givenThresolds.put(NullInterestingness.condAB, confAB); this.givenThresolds.put(NullInterestingness.condBA, confBA); this.type = type; this.givenThresolds.put(type, probabiltyValue); this.rules = numberOfRules; } public Integer getNumberOfRules() { return rules; } public Integer getN_gram() { return n_gram; } public LinkedHashMap<String, Double> getGivenThresolds() { return givenThresolds; } @Override public String toString() { String n_gramString = null; if (this.n_gram == 0) { n_gramString = "1-4"; } else { n_gramString = this.n_gram.toString(); } //nGram + "_" + n_gramString + "-" return nGram + "_" + n_gramString + "-" + numRule + "_" + rules + "-" + supA + "_" + givenThresolds.get(supA) + "-" + supB + "_" + givenThresolds.get(supB) + "-" + condAB + "_" + givenThresolds.get(condAB) + "-" + condBA + "_" + givenThresolds.get(condBA) + "-" + type + "_" + givenThresolds.get(type); } } }
9237549f0404bfd1f23e42729e0c550bde0df80d
605
java
Java
src/com/examplesdk/main/model/PieceModel.java
samuelnp/mvc_game_sdk
81649e1af02013ede8bcdfda05faf2fec481f35e
[ "MIT" ]
1
2021-06-08T16:33:30.000Z
2021-06-08T16:33:30.000Z
src/com/examplesdk/main/model/PieceModel.java
samuelnp/mvc_game_sdk
81649e1af02013ede8bcdfda05faf2fec481f35e
[ "MIT" ]
null
null
null
src/com/examplesdk/main/model/PieceModel.java
samuelnp/mvc_game_sdk
81649e1af02013ede8bcdfda05faf2fec481f35e
[ "MIT" ]
null
null
null
18.90625
68
0.761983
998,023
package com.examplesdk.main.model; import com.game.engine.ActionEvent; import com.game.engine.BaseModel; import com.game.engine.Engine; public class PieceModel extends BaseModel { private static final long serialVersionUID = -3364755443936460271L; private Integer movementPoints; public PieceModel(Engine engine) { super(engine); } public void initialize() { movementPoints = 0; } public void actionUpdate(ActionEvent event) { } public Integer getMovementPoints() { return movementPoints; } public void setMovementPoints(Integer points) { this.movementPoints = points; } }
9237551dcf07dcd0d4d03d4cebb6004b85fcd881
653
java
Java
planningpoker-api/src/test/java/com/richashworth/planningpoker/common/PlanningPokerTestFixture.java
richashworth/planningpoker
04b383ddba412a6646e0747da55ff5dcc6270d3a
[ "MIT" ]
16
2016-04-17T11:32:31.000Z
2022-02-02T17:12:04.000Z
planningpoker-api/src/test/java/com/richashworth/planningpoker/common/PlanningPokerTestFixture.java
richashworth/planningpoker
04b383ddba412a6646e0747da55ff5dcc6270d3a
[ "MIT" ]
37
2016-04-19T17:35:40.000Z
2019-09-24T21:14:02.000Z
planningpoker-api/src/test/java/com/richashworth/planningpoker/common/PlanningPokerTestFixture.java
richashworth/planningpoker
04b383ddba412a6646e0747da55ff5dcc6270d3a
[ "MIT" ]
3
2016-08-18T19:49:02.000Z
2017-10-30T23:37:46.000Z
38.411765
84
0.771822
998,024
package com.richashworth.planningpoker.common; import com.google.common.collect.Lists; import com.richashworth.planningpoker.model.Estimate; import java.util.List; public class PlanningPokerTestFixture { public static final Long SESSION_ID = 1L; public static final String ITEM = "A User Story"; public static final String USER_NAME = "Rich"; public static final String ESTIMATE_VALUE = "2"; public static final Estimate ESTIMATE = new Estimate(USER_NAME, ESTIMATE_VALUE); public static final List<Estimate> RESULTS = Lists.newArrayList(ESTIMATE); public static final List<String> USERS = Lists.newArrayList(USER_NAME); }
923756d61dee641bccccd5b1c068ef28f3886d3f
1,056
java
Java
renren-admin/src/main/java/io/renren/modules/sys/service/impl/SystudentaddressServiceImpl.java
15937182198/lunsi
64b5defefef7fa36e577f88d42d4e750ea099d24
[ "Apache-2.0" ]
null
null
null
renren-admin/src/main/java/io/renren/modules/sys/service/impl/SystudentaddressServiceImpl.java
15937182198/lunsi
64b5defefef7fa36e577f88d42d4e750ea099d24
[ "Apache-2.0" ]
2
2021-04-22T17:00:47.000Z
2021-09-20T20:53:57.000Z
renren-admin/src/main/java/io/renren/modules/sys/service/impl/SystudentaddressServiceImpl.java
15937182198/lunsi
64b5defefef7fa36e577f88d42d4e750ea099d24
[ "Apache-2.0" ]
null
null
null
35.2
142
0.783144
998,025
package io.renren.modules.sys.service.impl; import org.springframework.stereotype.Service; import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import io.renren.common.utils.PageUtils; import io.renren.common.utils.Query; import io.renren.modules.sys.dao.SystudentaddressDao; import io.renren.modules.sys.entity.SystudentaddressEntity; import io.renren.modules.sys.service.SystudentaddressService; @Service("systudentaddressService") public class SystudentaddressServiceImpl extends ServiceImpl<SystudentaddressDao, SystudentaddressEntity> implements SystudentaddressService { @Override public PageUtils queryPage(Map<String, Object> params) { IPage<SystudentaddressEntity> page = this.page( new Query<SystudentaddressEntity>().getPage(params), new QueryWrapper<SystudentaddressEntity>() ); return new PageUtils(page); } }
9237576f688cbd8263012919f83297e45f871a30
868
java
Java
Dataset/Leetcode/train/102/707.java
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
Dataset/Leetcode/train/102/707.java
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
Dataset/Leetcode/train/102/707.java
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
27.125
80
0.481567
998,026
public List<List<Integer>> XXX(TreeNode root) { List<List<Integer>> result = new ArrayList<>(); Map<Integer, List<Integer>> tmp = new HashMap<>(); if(root == null){ return result; } helper(root, tmp, 0); for (Map.Entry<Integer, List<Integer>> map : tmp.entrySet()) { result.add(map.getValue()); } return result; } private void helper(TreeNode root, Map<Integer, List<Integer>> tmp, int i) { List<Integer> tmplist = tmp.getOrDefault(i, new ArrayList<>()); tmplist.add(root.val); tmp.put(i, tmplist); if(root.left != null){ i++; helper(root.left, tmp, i); i--; } if(root.right != null){ i++; helper(root.right, tmp, i); i--; } }
923759973690d0449de5954b98524a1cf305fa4e
8,703
java
Java
activemq-camel/src/test/java/org/apache/activemq/camel/CamelJmsTest.java
sho25/activemq
d34b61b56206883e6570ae7207c3ddb074311adf
[ "Apache-2.0" ]
null
null
null
activemq-camel/src/test/java/org/apache/activemq/camel/CamelJmsTest.java
sho25/activemq
d34b61b56206883e6570ae7207c3ddb074311adf
[ "Apache-2.0" ]
7
2020-06-18T17:27:51.000Z
2022-02-01T01:05:30.000Z
activemq-camel/src/test/java/org/apache/activemq/camel/CamelJmsTest.java
sho25/activemq
d34b61b56206883e6570ae7207c3ddb074311adf
[ "Apache-2.0" ]
null
null
null
15.295255
811
0.811329
998,027
begin_unit|revision:0.9.5;language:Java;cregit-version:0.0.1 begin_comment comment|/** * 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. */ end_comment begin_package package|package name|org operator|. name|apache operator|. name|activemq operator|. name|camel package|; end_package begin_import import|import name|javax operator|. name|jms operator|. name|Connection import|; end_import begin_import import|import name|javax operator|. name|jms operator|. name|ConnectionFactory import|; end_import begin_import import|import name|javax operator|. name|jms operator|. name|Destination import|; end_import begin_import import|import name|javax operator|. name|jms operator|. name|Message import|; end_import begin_import import|import name|javax operator|. name|jms operator|. name|MessageConsumer import|; end_import begin_import import|import name|javax operator|. name|jms operator|. name|MessageProducer import|; end_import begin_import import|import name|javax operator|. name|jms operator|. name|ObjectMessage import|; end_import begin_import import|import name|javax operator|. name|jms operator|. name|Session import|; end_import begin_import import|import name|javax operator|. name|jms operator|. name|TextMessage import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|component operator|. name|mock operator|. name|MockEndpoint import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|ProducerTemplate import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|test operator|. name|spring operator|. name|CamelSpringTestSupport import|; end_import begin_import import|import name|org operator|. name|junit operator|. name|Test import|; end_import begin_import import|import name|org operator|. name|slf4j operator|. name|Logger import|; end_import begin_import import|import name|org operator|. name|slf4j operator|. name|LoggerFactory import|; end_import begin_import import|import name|org operator|. name|springframework operator|. name|context operator|. name|support operator|. name|ClassPathXmlApplicationContext import|; end_import begin_comment comment|/** * */ end_comment begin_class specifier|public class|class name|CamelJmsTest extends|extends name|CamelSpringTestSupport block|{ specifier|private specifier|static specifier|final name|Logger name|LOG init|= name|LoggerFactory operator|. name|getLogger argument_list|( name|CamelJmsTest operator|. name|class argument_list|) decl_stmt|; specifier|protected name|String name|expectedBody init|= literal|"<hello>world!</hello>" decl_stmt|; annotation|@ name|Test specifier|public name|void name|testSendingViaJmsIsReceivedByCamel parameter_list|() throws|throws name|Exception block|{ name|MockEndpoint name|result init|= name|resolveMandatoryEndpoint argument_list|( literal|"mock:result" argument_list|, name|MockEndpoint operator|. name|class argument_list|) decl_stmt|; name|result operator|. name|expectedBodiesReceived argument_list|( name|expectedBody argument_list|) expr_stmt|; name|result operator|. name|message argument_list|( literal|0 argument_list|) operator|. name|header argument_list|( literal|"foo" argument_list|) operator|. name|isEqualTo argument_list|( literal|"bar" argument_list|) expr_stmt|; comment|// lets create a message name|Destination name|destination init|= name|getMandatoryBean argument_list|( name|Destination operator|. name|class argument_list|, literal|"sendTo" argument_list|) decl_stmt|; name|ConnectionFactory name|factory init|= name|getMandatoryBean argument_list|( name|ConnectionFactory operator|. name|class argument_list|, literal|"connectionFactory" argument_list|) decl_stmt|; name|Connection name|connection init|= name|factory operator|. name|createConnection argument_list|() decl_stmt|; name|connection operator|. name|start argument_list|() expr_stmt|; name|Session name|session init|= name|connection operator|. name|createSession argument_list|( literal|false argument_list|, name|Session operator|. name|AUTO_ACKNOWLEDGE argument_list|) decl_stmt|; name|MessageProducer name|producer init|= name|session operator|. name|createProducer argument_list|( name|destination argument_list|) decl_stmt|; comment|// now lets send a message name|ObjectMessage name|message init|= name|session operator|. name|createObjectMessage argument_list|( name|expectedBody argument_list|) decl_stmt|; name|message operator|. name|setStringProperty argument_list|( literal|"foo" argument_list|, literal|"bar" argument_list|) expr_stmt|; name|producer operator|. name|send argument_list|( name|message argument_list|) expr_stmt|; name|result operator|. name|assertIsSatisfied argument_list|() expr_stmt|; name|LOG operator|. name|info argument_list|( literal|"Received message: " operator|+ name|result operator|. name|getReceivedExchanges argument_list|() argument_list|) expr_stmt|; block|} annotation|@ name|Test specifier|public name|void name|testConsumingViaJMSReceivesMessageFromCamel parameter_list|() throws|throws name|Exception block|{ comment|// lets create a message name|Destination name|destination init|= name|getMandatoryBean argument_list|( name|Destination operator|. name|class argument_list|, literal|"consumeFrom" argument_list|) decl_stmt|; name|ConnectionFactory name|factory init|= name|getMandatoryBean argument_list|( name|ConnectionFactory operator|. name|class argument_list|, literal|"connectionFactory" argument_list|) decl_stmt|; name|ProducerTemplate name|template init|= name|getMandatoryBean argument_list|( name|ProducerTemplate operator|. name|class argument_list|, literal|"camelTemplate" argument_list|) decl_stmt|; name|assertNotNull argument_list|( literal|"template is valid" argument_list|, name|template argument_list|) expr_stmt|; name|Connection name|connection init|= name|factory operator|. name|createConnection argument_list|() decl_stmt|; name|connection operator|. name|start argument_list|() expr_stmt|; name|Session name|session init|= name|connection operator|. name|createSession argument_list|( literal|false argument_list|, name|Session operator|. name|AUTO_ACKNOWLEDGE argument_list|) decl_stmt|; name|LOG operator|. name|info argument_list|( literal|"Consuming from: " operator|+ name|destination argument_list|) expr_stmt|; name|MessageConsumer name|consumer init|= name|session operator|. name|createConsumer argument_list|( name|destination argument_list|) decl_stmt|; comment|// now lets send a message name|template operator|. name|sendBody argument_list|( literal|"seda:consumer" argument_list|, name|expectedBody argument_list|) expr_stmt|; name|Message name|message init|= name|consumer operator|. name|receive argument_list|( literal|5000 argument_list|) decl_stmt|; name|assertNotNull argument_list|( literal|"Should have received a message from destination: " operator|+ name|destination argument_list|, name|message argument_list|) expr_stmt|; name|TextMessage name|textMessage init|= name|assertIsInstanceOf argument_list|( name|TextMessage operator|. name|class argument_list|, name|message argument_list|) decl_stmt|; name|assertEquals argument_list|( literal|"Message body" argument_list|, name|expectedBody argument_list|, name|textMessage operator|. name|getText argument_list|() argument_list|) expr_stmt|; name|LOG operator|. name|info argument_list|( literal|"Received message: " operator|+ name|message argument_list|) expr_stmt|; block|} specifier|protected name|int name|getExpectedRouteCount parameter_list|() block|{ return|return literal|0 return|; block|} specifier|protected name|ClassPathXmlApplicationContext name|createApplicationContext parameter_list|() block|{ return|return operator|new name|ClassPathXmlApplicationContext argument_list|( literal|"org/apache/activemq/camel/spring.xml" argument_list|) return|; block|} block|} end_class end_unit
923759ac4470961524d746e59c8aaa9b45ca5ca8
290
java
Java
src/main/java/com/ecommerce/listener/GenericoListener.java
rfaguiar/ecommerce-jpa
45130ac0a48ed67b71f90e6d19cea6bec9542f3f
[ "MIT" ]
null
null
null
src/main/java/com/ecommerce/listener/GenericoListener.java
rfaguiar/ecommerce-jpa
45130ac0a48ed67b71f90e6d19cea6bec9542f3f
[ "MIT" ]
null
null
null
src/main/java/com/ecommerce/listener/GenericoListener.java
rfaguiar/ecommerce-jpa
45130ac0a48ed67b71f90e6d19cea6bec9542f3f
[ "MIT" ]
null
null
null
19.333333
83
0.706897
998,028
package com.ecommerce.listener; import lombok.extern.java.Log; import javax.persistence.PostLoad; @Log public class GenericoListener { @PostLoad public void logCarregamento(Object obj){ log.info("Entidade " + obj.getClass().getSimpleName() + " foi carregada."); } }
92375c45f37734bae9e487014631e2772151475a
177
java
Java
master/gs-consuming-rest-master/gs-consuming-rest-master/complete/src/main/java/com/ubs/network/api/rest/common/connector/interfaces/IBaseConnector.java
AlexRogalskiy/DevArtifacts
931aabb8cbf27656151c54856eb2ea7d1153203a
[ "MIT" ]
4
2018-09-07T15:35:24.000Z
2019-03-27T09:48:12.000Z
master/gs-consuming-rest-master/gs-consuming-rest-master/complete/src/main/java/com/ubs/network/api/rest/common/connector/interfaces/IBaseConnector.java
AlexRogalskiy/DevArtifacts
931aabb8cbf27656151c54856eb2ea7d1153203a
[ "MIT" ]
371
2020-03-04T21:51:56.000Z
2022-03-31T20:59:11.000Z
master/gs-consuming-rest-master/gs-consuming-rest-master/complete/src/main/java/com/ubs/network/api/rest/common/connector/interfaces/IBaseConnector.java
AlexRogalskiy/DevArtifacts
931aabb8cbf27656151c54856eb2ea7d1153203a
[ "MIT" ]
3
2019-06-18T19:57:17.000Z
2020-11-06T03:55:08.000Z
25.285714
81
0.819209
998,030
package com.ubs.network.api.rest.common.connector.interfaces; import java.io.Serializable; public interface IBaseConnector<E extends Serializable, D extends Serializable> { }
92375c82855b4b201dc1d90d8ffc59e41ffdc128
1,928
java
Java
app/src/main/java/voora/com/queuedownloader/downloader/DBUpdateHandler.java
vooratarun/QueueDownloader
81c7389aacff2b885ac516695236e799dff1e533
[ "MIT" ]
1
2017-12-09T16:41:42.000Z
2017-12-09T16:41:42.000Z
app/src/main/java/voora/com/queuedownloader/downloader/DBUpdateHandler.java
vooratarun/QueueDownloader
81c7389aacff2b885ac516695236e799dff1e533
[ "MIT" ]
null
null
null
app/src/main/java/voora/com/queuedownloader/downloader/DBUpdateHandler.java
vooratarun/QueueDownloader
81c7389aacff2b885ac516695236e799dff1e533
[ "MIT" ]
null
null
null
27.942029
84
0.631224
998,031
package voora.com.queuedownloader.downloader; import android.content.Context; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import voora.com.queuedownloader.database.AppDatabase; import voora.com.queuedownloader.database.DItem; /** * Created by tarun on 12/11/17. */ public class DBUpdateHandler { private Executor executor = Executors.newFixedThreadPool(2); private Context context; public DBUpdateHandler(Context context) { this.context = context.getApplicationContext(); } public void updateProgressInDB(DItem dItem , int progress) { dItem.setDownloadPercent(progress); dItem.setState(DownloadState.DOWNLOADING.ordinal()); executor.execute(new Runnable() { @Override public void run() { AppDatabase.getAppDatabase(context).downloadDao().insertItem(dItem); } }); } public void updatePauseInDB(DItem dItem) { dItem.setState(DownloadState.PAUSED.ordinal()); executor.execute(new Runnable() { @Override public void run() { AppDatabase.getAppDatabase(context).downloadDao().insertItem(dItem); } }); } public void updateCompletedInDB(DItem dItem) { dItem.setState(DownloadState.COMPLETED.ordinal()); executor.execute(new Runnable() { @Override public void run() { AppDatabase.getAppDatabase(context).downloadDao().insertItem(dItem); } }); } public void updateCancelledInDB(DItem dItem) { dItem.setDownloadPercent(0); dItem.setState(DownloadState.NORMAL.ordinal()); executor.execute(new Runnable() { @Override public void run() { AppDatabase.getAppDatabase(context).downloadDao().insertItem(dItem); } }); } }
92375dd1d42222fe7ec4e31ef1e177c596c77516
496
java
Java
java-for-gitee/FactoryModel/src/org/imooc/factory/BeanFactory.java
OSrcD/java-for-linux
5424b1af0e74797d57d820425b91c991aa28fda9
[ "Apache-2.0" ]
8
2020-12-31T16:36:13.000Z
2021-07-14T12:05:37.000Z
java-for-gitee/FactoryModel/src/org/imooc/factory/BeanFactory.java
OpenSrcDeveloper/java-architect-grow-through-train
5424b1af0e74797d57d820425b91c991aa28fda9
[ "Apache-2.0" ]
6
2021-01-01T10:22:06.000Z
2021-02-20T08:57:34.000Z
java-for-gitee/FactoryModel/src/org/imooc/factory/BeanFactory.java
OpenSrcDeveloper/java-architect-grow-through-train
5424b1af0e74797d57d820425b91c991aa28fda9
[ "Apache-2.0" ]
3
2020-12-31T16:36:15.000Z
2021-01-18T09:34:47.000Z
21.565217
45
0.633065
998,032
package org.imooc.factory; import org.imooc.component.Arms; import org.imooc.component.Hair; import org.imooc.plant.Bean; import org.imooc.plant.Plant; /* 工厂与创建对象封装 */ public class BeanFactory implements Factory { public Plant createPlant(){ Bean bean = new Bean(); Hair hair = new Hair(); hair.setColor("绿色"); bean.setHair(hair); Arms arms = new Arms(); arms.setBulletType("普通的豆子"); bean.setArms(arms); return bean; } }
92375f24afa78a0f57a7569448e68343bc901bef
5,686
java
Java
src/main/java/net/sorenon/images/api/Print.java
Sorenon/images
1014b01dfeb1936cf7c9f58aa85a89cb1ed15edb
[ "CC0-1.0" ]
null
null
null
src/main/java/net/sorenon/images/api/Print.java
Sorenon/images
1014b01dfeb1936cf7c9f58aa85a89cb1ed15edb
[ "CC0-1.0" ]
6
2020-10-06T17:54:52.000Z
2020-12-27T23:50:50.000Z
src/main/java/net/sorenon/images/api/Print.java
Sorenon/images
1014b01dfeb1936cf7c9f58aa85a89cb1ed15edb
[ "CC0-1.0" ]
4
2020-09-28T23:19:21.000Z
2022-02-08T01:45:39.000Z
36.922078
122
0.517939
998,033
package net.sorenon.images.api; import net.fabricmc.fabric.api.util.NbtType; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextHandler; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.nbt.CompoundTag; import net.minecraft.text.*; import net.minecraft.util.Formatting; import net.minecraft.world.World; import net.sorenon.images.init.ImagesModClient; import org.jetbrains.annotations.Nullable; import java.net.MalformedURLException; import java.net.URL; import java.util.List; import java.util.UUID; public class Print { @Nullable public URL url; @Nullable public UUID player; public MutableText toText(@Nullable World world) { if (url != null) { String urlStr = url.toString(); MutableText text = Texts.bracketed(new LiteralText(urlStr)).styled(style -> style.withClickEvent( new ClickEvent( ClickEvent.Action.OPEN_URL, urlStr ) ).withHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new TranslatableText("images.open_or_copy_link") ) )).formatted(Formatting.GREEN); if (player != null) { PlayerEntity printer = null; if (world != null) { printer = world.getPlayerByUuid(player); } String string; if (printer == null) { string = player.toString(); } else { string = printer.getName().asString(); } text.append(new LiteralText("->" + string).styled(style -> style.withClickEvent( new ClickEvent( ClickEvent.Action.COPY_TO_CLIPBOARD, player.toString() ) ).withHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new TranslatableText("images.copy_player") ) ) ).formatted(Formatting.WHITE)); } return text; } return null; } public void serialize(CompoundTag nbt) { if (url != null) { nbt.putString("url", url.toString()); } if (player != null) { nbt.putUuid("player", player); } } public void deserialize(CompoundTag nbt) { if (nbt == null) return; player = null; url = null; if (nbt.contains("player")) { player = nbt.getUuid("player"); } if (nbt.contains("url", NbtType.STRING)) { try { url = new URL(nbt.getString("url")); } catch (MalformedURLException e) { e.printStackTrace(); } } } public void appendTooltip(List<Text> tooltip, boolean isSneaking, int maxWidth, boolean waila) { if (url == null) return; String urlStr = url.toString(); Style urlStyle = Style.EMPTY.withFormatting(Formatting.GREEN); Style playerStyle = Style.EMPTY.withFormatting(Formatting.GRAY); PlayerEntity printerEntity = null; MinecraftClient mc = MinecraftClient.getInstance(); if (player != null && mc.world != null) { printerEntity = mc.world.getPlayerByUuid(player); } if (!isSneaking) { boolean showURL = waila && ImagesModClient.Companion.getCFG_WAILA_URL() || !waila && ImagesModClient.Companion.getCFG_TOOLTIP_URL(); boolean showPlayer = waila && ImagesModClient.Companion.getCFG_WAILA_PLAYER() || !waila && ImagesModClient.Companion.getCFG_TOOLTIP_PLAYER(); if (showURL) { if (urlStr.length() > 24) { urlStr = urlStr.substring(0, 24) + '…'; } tooltip.add(new LiteralText(urlStr).setStyle(urlStyle)); } if (showPlayer && player != null) { if (printerEntity != null) { tooltip.add(new TranslatableText("images.printed_by", printerEntity.getName()).setStyle(playerStyle)); } else { tooltip.add(new TranslatableText("images.printed_by_offline").setStyle(playerStyle)); } } } else { TextHandler textHandler = mc.textRenderer.getTextHandler(); while (urlStr.length() > 0) { int maxLen = textHandler.getTrimmedLength(urlStr, maxWidth, urlStyle); tooltip.add(new LiteralText(urlStr.substring(0, maxLen)).setStyle(urlStyle)); urlStr = urlStr.substring(Math.min(maxLen, urlStr.length())); } if (player != null) { if (printerEntity == null) { tooltip.add(new TranslatableText("images.printed_by", player.toString()).setStyle(playerStyle)); } else { tooltip.add(new TranslatableText("images.printed_by", printerEntity.getName()).setStyle(playerStyle)); } } } } public Print copy() { Print clone = new Print(); clone.url = url; clone.player = player; return clone; } }
92375f71080f47a14fdd81c16562ee3122caa471
3,858
java
Java
src/backend/Printer.java
wittiger/cspc
ed396f1a77e3a4acd1c2a51a91134a3e0d1be95d
[ "MIT" ]
null
null
null
src/backend/Printer.java
wittiger/cspc
ed396f1a77e3a4acd1c2a51a91134a3e0d1be95d
[ "MIT" ]
null
null
null
src/backend/Printer.java
wittiger/cspc
ed396f1a77e3a4acd1c2a51a91134a3e0d1be95d
[ "MIT" ]
null
null
null
17.146667
101
0.635044
998,034
package backend; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import java.util.Collection; import java.util.HashMap; import java.util.Map; import ast.Arrow; import ast.CSPFile; import ast.Choice; import ast.Constant; import ast.Expression; import ast.Hide; import ast.Process; import ast.Sequence; import ast.Signal; import ast.Skip; import ast.Stop; import ast.Sync; import ast.visitors.AbstractExpressionVisitor; import ast.visitors.AbstractFileVisitor; public class Printer extends AbstractExpressionVisitor<Error> implements AbstractFileVisitor<Error> { private CSPFile file; private final Map<Process, Integer> processNames = new HashMap<>(); private int nextName = 1; private Writer writer; public Printer(File outfile) { try { writer = new BufferedWriter(new FileWriter(outfile)); } catch (IOException e) { throw new Error(e.getMessage()); } } private void print(String s) { try { writer.write(s); } catch (IOException e) { throw new Error(e.getMessage()); } } private void printSignalName(Signal s) { print(file.originalSignalNames.get(s)); } private void printSignalSet(Collection<Signal> cs) { print("{"); Boolean first = true; for (Signal s : cs) { if (!first) print(", "); first = false; printSignalName(s); } print("}"); } private void printProcess(Process p) { if (file.originalProcessNames.containsKey(p)) { print(file.originalProcessNames.get(p)); return; } int name; if (processNames.containsKey(p)) { name = processNames.get(p); } else { name = nextName; nextName++; processNames.put(p, name); } print("P" + name); } private void open() { print("("); } private void close() { print(")"); } @Override public void visit(Arrow arrow) { open(); printSignalName(arrow.c); print(" -> "); visitAny(arrow.e); close(); } @Override public void visit(Choice choice) { if (choice.elements.size() == 0) { print("STOP"); return; } open(); Boolean first = true; for (Expression e : choice.elements) { if (!first) print(" |~| "); first = false; visitAny(e); } close(); } @Override public void visit(Constant constant) { printProcess(constant.process); } @Override public void visit(Hide hide) { open(); visitAny(hide.target); print(" \\ "); printSignalSet(hide.signals); close(); } @Override public void visit(Sequence sequence) { open(); visitAny(sequence.first); print(" ; "); visitAny(sequence.second); close(); } @Override public void visit(Skip skip) { print("SKIP"); } @Override public void visit(Stop stop) { print("STOP"); } @Override public void visit(Sync sync) { open(); visitAny(sync.left); print(" [| "); printSignalSet(sync.cs); print(" |] "); visitAny(sync.right); close(); } @Override public void visit(CSPFile file) { this.file = file; /* * Declarations */ print("\n-- Declarations:\n\n"); if (file.declaredSignals.size() > 0) { print("channel "); Boolean first = true; for (Signal s : file.declaredSignals) { if (!first) print(", "); first = false; printSignalName(s); } } /* * Definitions */ file.updateLiveProcesses(); print("\n-- Process Definitions:\n\n"); for (Process p : file.liveProcesses) { printProcess(p); print(" = "); visitAny(p.definition); print("\n"); } /* * Assertions */ print("\n-- Assertion:\n\nassert "); visitAny(file.leftAssertion); print(" [T= "); visitAny(file.rightAssertion); print("\n\n"); } public void printString() { try { writer.flush(); writer.close(); } catch (IOException e) { throw new Error(e.getMessage()); } } }
92375fc5e99893c09edf93fab78601f9e83ffc81
1,772
java
Java
geoar-ds-opensearch/src/main/java/org/n52/geoar/data/opensearch/data/atom/AtomCategory.java
52North/geoar-datasources
66bf3393322606a78742af16351ead89e4a14d62
[ "Apache-1.1" ]
5
2016-09-29T06:22:22.000Z
2016-11-21T09:16:55.000Z
geoar-ds-opensearch/src/main/java/org/n52/geoar/data/opensearch/data/atom/AtomCategory.java
52North/geoar-datasources
66bf3393322606a78742af16351ead89e4a14d62
[ "Apache-1.1" ]
1
2017-06-10T12:52:41.000Z
2017-06-10T12:52:41.000Z
geoar-ds-opensearch/src/main/java/org/n52/geoar/data/opensearch/data/atom/AtomCategory.java
52North/geoar-datasources
66bf3393322606a78742af16351ead89e4a14d62
[ "Apache-1.1" ]
null
null
null
32.272727
78
0.701972
998,035
/** * Copyright 2012 52°North Initiative for Geospatial Open Source Software GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.n52.geoar.data.opensearch.data.atom; import org.n52.geoar.data.opensearch.data.BaseFeedElement; import org.n52.geoar.data.opensearch.data.core.FeedElement; import org.n52.geoar.data.opensearch.data.core.ICategory; import org.xml.sax.Attributes; /** * * @author Arne de Wall <nnheo@example.com> * */ public class AtomCategory extends BaseFeedElement implements ICategory{ private static final String LABEL = "label"; private static final String TERM = "term"; private static final String SCHEME = "scheme"; public AtomCategory(String name, String uri, Attributes attibutes) { super(name, uri, attibutes); } @Override public String getTerm() { FeedElement term = getElement(TERM); return term == null ? null : term.getContent(); } @Override public String getLabel() { FeedElement term = getElement(LABEL); return term == null ? null : term.getContent(); } @Override public String getScheme() { FeedElement scheme = getElement(SCHEME); return scheme == null ? null : scheme.getContent(); } }
92376165534a35f39f43e9ab50b9c95ee676be1c
6,602
java
Java
mall-business/marking-center/src/main/java/com/mallplus/marking/controller/SmsHomeAdvertiseController.java
liweizhen1990/mallcloud-platform-1
ee5f3e3ea14192a1f4bbcff00da1ea72eeb03d91
[ "Apache-2.0" ]
33
2020-01-30T09:04:16.000Z
2021-12-03T03:46:32.000Z
mall-business/marking-center/src/main/java/com/mallplus/marking/controller/SmsHomeAdvertiseController.java
visionwang/mallcloud-platform
699f56168637f296fefd5585c7b892e177bd917b
[ "Apache-2.0" ]
null
null
null
mall-business/marking-center/src/main/java/com/mallplus/marking/controller/SmsHomeAdvertiseController.java
visionwang/mallcloud-platform
699f56168637f296fefd5585c7b892e177bd917b
[ "Apache-2.0" ]
23
2020-01-17T06:41:16.000Z
2021-11-30T06:08:21.000Z
38.16185
152
0.650257
998,036
package com.mallplus.marking.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.central.common.annotation.SysLog; import com.mallplus.marking.entity.SmsHomeAdvertise; import com.mallplus.marking.entity.SmsHomeNewProduct; import com.mallplus.marking.service.ISmsHomeAdvertiseService; import com.central.common.utils.CommonResult; import com.central.common.utils.ValidatorUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; /** * <p> * 首页轮播广告表 * </p> * * @author zscat * @since 2019-04-19 */ @Slf4j @RestController @Api(tags = "SmsHomeAdvertiseController", description = "首页轮播广告表管理") @RequestMapping("/marking/SmsHomeAdvertise") public class SmsHomeAdvertiseController { @Resource private ISmsHomeAdvertiseService ISmsHomeAdvertiseService; @SysLog(MODULE = "marking", REMARK = "根据条件查询所有首页轮播广告表列表") @ApiOperation("根据条件查询所有首页轮播广告表列表") @GetMapping(value = "/list") @PreAuthorize("hasAuthority('marking:SmsHomeAdvertise:read')") public Object getSmsHomeAdvertiseByPage(SmsHomeAdvertise entity, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize ) { try { return new CommonResult().success(ISmsHomeAdvertiseService.page(new Page<SmsHomeAdvertise>(pageNum, pageSize), new QueryWrapper<>(entity))); } catch (Exception e) { log.error("根据条件查询所有首页轮播广告表列表:%s", e.getMessage(), e); } return new CommonResult().failed(); } @SysLog(MODULE = "marking", REMARK = "保存首页轮播广告表") @ApiOperation("保存首页轮播广告表") @PostMapping(value = "/create") @PreAuthorize("hasAuthority('marking:SmsHomeAdvertise:create')") public Object saveSmsHomeAdvertise(@RequestBody SmsHomeAdvertise entity) { try { entity.setClickCount(0); entity.setOrderCount(0); if (ISmsHomeAdvertiseService.save(entity)) { return new CommonResult().success(); } } catch (Exception e) { log.error("保存首页轮播广告表:%s", e.getMessage(), e); return new CommonResult().failed(); } return new CommonResult().failed(); } @SysLog(MODULE = "marking", REMARK = "更新首页轮播广告表") @ApiOperation("更新首页轮播广告表") @PostMapping(value = "/update/{id}") @PreAuthorize("hasAuthority('marking:SmsHomeAdvertise:update')") public Object updateSmsHomeAdvertise(@RequestBody SmsHomeAdvertise entity) { try { if (ISmsHomeAdvertiseService.updateById(entity)) { return new CommonResult().success(); } } catch (Exception e) { log.error("更新首页轮播广告表:%s", e.getMessage(), e); return new CommonResult().failed(); } return new CommonResult().failed(); } @SysLog(MODULE = "marking", REMARK = "删除首页轮播广告表") @ApiOperation("删除首页轮播广告表") @DeleteMapping(value = "/delete/{id}") @PreAuthorize("hasAuthority('marking:SmsHomeAdvertise:delete')") public Object deleteSmsHomeAdvertise(@ApiParam("首页轮播广告表id") @PathVariable Long id) { try { if (ValidatorUtils.empty(id)) { return new CommonResult().paramFailed("首页轮播广告表id"); } if (ISmsHomeAdvertiseService.removeById(id)) { return new CommonResult().success(); } } catch (Exception e) { log.error("删除首页轮播广告表:%s", e.getMessage(), e); return new CommonResult().failed(); } return new CommonResult().failed(); } @SysLog(MODULE = "marking", REMARK = "给首页轮播广告表分配首页轮播广告表") @ApiOperation("查询首页轮播广告表明细") @GetMapping(value = "/{id}") @PreAuthorize("hasAuthority('marking:SmsHomeAdvertise:read')") public Object getSmsHomeAdvertiseById(@ApiParam("首页轮播广告表id") @PathVariable Long id) { try { if (ValidatorUtils.empty(id)) { return new CommonResult().paramFailed("首页轮播广告表id"); } SmsHomeAdvertise coupon = ISmsHomeAdvertiseService.getById(id); return new CommonResult().success(coupon); } catch (Exception e) { log.error("查询首页轮播广告表明细:%s", e.getMessage(), e); return new CommonResult().failed(); } } @ApiOperation(value = "批量删除首页轮播广告表") @RequestMapping(value = "/delete/batch", method = RequestMethod.POST) @ResponseBody @SysLog(MODULE = "pms", REMARK = "批量删除首页轮播广告表") @PreAuthorize("hasAuthority('marking:SmsHomeAdvertise:delete')") public Object deleteBatch(@RequestParam("ids") List<Long> ids) { boolean count = ISmsHomeAdvertiseService.removeByIds(ids); if (count) { return new CommonResult().success(count); } else { return new CommonResult().failed(); } } @SysLog(MODULE = "sms", REMARK = "修改上下线状态") @ApiOperation("修改上下线状态") @RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST) @ResponseBody public Object updateStatus(@PathVariable Long id, Integer status) { SmsHomeAdvertise record = new SmsHomeAdvertise(); record.setId(id); record.setStatus(status); return ISmsHomeAdvertiseService.updateById(record); } @ApiOperation("修改推荐排序") @RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST) @ResponseBody public Object updateSort(@PathVariable Long id, Integer sort) { int count = ISmsHomeAdvertiseService.updateSort(id, sort); if (count > 0) { return new CommonResult().success(count); } return new CommonResult().failed(); } @ApiOperation("批量修改推荐状态") @RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST) @ResponseBody public Object updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) { int count = ISmsHomeAdvertiseService.updateRecommendStatus(ids, recommendStatus); if (count > 0) { return new CommonResult().success(count); } return new CommonResult().failed(); } }
92376166e220988c717961f3c3f9c16dbbbb2829
3,002
java
Java
ihmc-humanoid-robotics/src/main/java/us/ihmc/humanoidRobotics/footstep/footstepSnapper/BasicFootstepMask.java
dbdxnuliba/IHMC-
a8e89934e75cc7026bc3e082397d989a26c7549e
[ "Apache-2.0" ]
170
2016-02-01T18:58:50.000Z
2022-03-17T05:28:01.000Z
ihmc-humanoid-robotics/src/main/java/us/ihmc/humanoidRobotics/footstep/footstepSnapper/BasicFootstepMask.java
ihmcrobotics/ihmc-open-robotics-software
129b261de850e85e1dc78a12e9c075f53c6019a0
[ "Apache-2.0" ]
162
2016-01-29T17:04:29.000Z
2022-02-10T16:25:37.000Z
ihmc-humanoid-robotics/src/main/java/us/ihmc/humanoidRobotics/footstep/footstepSnapper/BasicFootstepMask.java
ihmcrobotics/ihmc-open-robotics-software
129b261de850e85e1dc78a12e9c075f53c6019a0
[ "Apache-2.0" ]
83
2016-01-28T22:49:01.000Z
2022-03-28T03:11:24.000Z
29.431373
94
0.699201
998,037
package us.ihmc.humanoidRobotics.footstep.footstepSnapper; import java.util.List; import us.ihmc.euclid.geometry.ConvexPolygon2D; import us.ihmc.euclid.referenceFrame.FramePoint2D; import us.ihmc.euclid.tuple2D.Point2D; import us.ihmc.euclid.tuple2D.interfaces.Point2DReadOnly; import us.ihmc.euclid.tuple3D.Point3D; import us.ihmc.robotics.contactable.ContactablePlaneBody; import us.ihmc.robotics.geometry.InclusionFunction; /** * Created by agrabertilton on 1/15/15. */ public class BasicFootstepMask implements InclusionFunction<Point3D> { private Point2D position = new Point2D(); private double yaw; private double safetyBuffer; private boolean initialized = false; private ConvexPolygon2D footShapeWithBufferPolygon = new ConvexPolygon2D(); public BasicFootstepMask(ContactablePlaneBody foot, double maskBufferSize) { this.safetyBuffer = maskBufferSize; footShapeWithBufferPolygon.clear(); for (FramePoint2D vertex : foot.getContactPoints2d()) { footShapeWithBufferPolygon.addVertex(inflate(vertex.getX()), inflate(vertex.getY())); } footShapeWithBufferPolygon.update(); } public BasicFootstepMask(List<Point2D> footstepShape, double maskBufferSize) { this.safetyBuffer = maskBufferSize; footShapeWithBufferPolygon.clear(); for (Point2D vertex : footstepShape) { footShapeWithBufferPolygon.addVertex(inflate(vertex.getX()), inflate(vertex.getY())); } footShapeWithBufferPolygon.update(); } public BasicFootstepMask(ConvexPolygon2D footstepShape, double maskBufferSize) { int numVertices = footstepShape.getNumberOfVertices(); Point2DReadOnly vertex; for (int i = 0; i < numVertices; i++) { vertex = footstepShape.getVertex(i); footShapeWithBufferPolygon.addVertex(inflate(vertex.getX()), inflate(vertex.getY())); } footShapeWithBufferPolygon.update(); } private double inflate(double dimension) { return dimension + Math.signum(dimension) * safetyBuffer; } public void setPositionAndYaw(Point2D position, double yaw) { this.position.set(position.getX(), position.getY()); this.yaw = yaw; initialized = true; } public void setPositionAndYaw(double x, double y, double yaw) { position.set(x,y); this.yaw = yaw; initialized = true; } public void setSafetyBuffer(double safetyBuffer) { this.safetyBuffer = safetyBuffer; } @Override public boolean isIncluded(Point3D inputPoint) { if (!initialized) return false; double x = inputPoint.getX() - position.getX(); double y = inputPoint.getY() - position.getY(); double cos = Math.cos(yaw); double sin = Math.sin(yaw); double xInFoot = x * cos + y * sin; double yInFoot = y * cos - x * sin; boolean isInside = footShapeWithBufferPolygon.isPointInside(xInFoot, yInFoot); return isInside; } }
923761cfe9d150a9c6f018a70d19a1298f9413a8
2,519
java
Java
src/main/java/org/radarcns/domain/restapi/monitor/QuestionnaireCompletionStatus.java
RADAR-CNS/RADAR-RestApi
a9c654f871138f1a53deba0c059ab772a6488fd7
[ "Apache-2.0" ]
2
2017-02-02T15:33:54.000Z
2017-05-13T22:21:51.000Z
src/main/java/org/radarcns/domain/restapi/monitor/QuestionnaireCompletionStatus.java
RADAR-CNS/RADAR-RestApi
a9c654f871138f1a53deba0c059ab772a6488fd7
[ "Apache-2.0" ]
49
2016-11-14T16:44:46.000Z
2018-01-19T15:59:16.000Z
src/main/java/org/radarcns/domain/restapi/monitor/QuestionnaireCompletionStatus.java
RADAR-base/RADAR-RestApi
a9c654f871138f1a53deba0c059ab772a6488fd7
[ "Apache-2.0" ]
1
2017-01-11T13:09:19.000Z
2017-01-11T13:09:19.000Z
28.303371
83
0.666534
998,038
package org.radarcns.domain.restapi.monitor; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Objects; public class QuestionnaireCompletionStatus { @JsonProperty private Double timeRecorded; @JsonProperty private String questionnaireName; @JsonProperty private Double completionPercentage = 0d; /** * Default constructor. */ public QuestionnaireCompletionStatus() { // default constructor } /** * Constructor. * @param timeRecorded recorded time of the status. * @param questionnaireName name of the questionnaire. * @param completionPercentage percentage of completion. */ public QuestionnaireCompletionStatus(Double timeRecorded, String questionnaireName, Double completionPercentage) { this.timeRecorded = timeRecorded; this.questionnaireName = questionnaireName; this.completionPercentage = completionPercentage; } public Double getTimeRecorded() { return timeRecorded; } public void setTimeRecorded(Double timeRecorded) { this.timeRecorded = timeRecorded; } public String getQuestionnaireName() { return questionnaireName; } public void setQuestionnaireName(String questionnaireName) { this.questionnaireName = questionnaireName; } public Double getCompletionPercentage() { return completionPercentage; } public void setCompletionPercentage(Double completionPercentage) { this.completionPercentage = completionPercentage; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } QuestionnaireCompletionStatus that = (QuestionnaireCompletionStatus) o; return Objects.equals(timeRecorded, that.timeRecorded) && Objects .equals(questionnaireName, that.questionnaireName) && Objects .equals(completionPercentage, that.completionPercentage); } @Override public int hashCode() { return Objects.hash(timeRecorded, questionnaireName, completionPercentage); } @Override public String toString() { return "QuestionnaireCompletionStatus{" + ", timeRecorded=" + timeRecorded + ", questionnaireName='" + questionnaireName + '\'' + ", completionPercentage=" + completionPercentage + '}'; } }
9237629aea769f129a66f193bb859c74fe8f6cf5
1,280
java
Java
src/main/java/io/github/sbcloudrace/sbtranslator/jaxb/http/DragEntrantResult.java
sbcloudrace/sb-translator
809b2e97d5e0f41174bc645d828c444f365ae2da
[ "MIT" ]
1
2021-01-30T14:54:31.000Z
2021-01-30T14:54:31.000Z
src/main/java/io/github/sbcloudrace/sbtranslator/jaxb/http/DragEntrantResult.java
sbcloudrace/sb-translator
809b2e97d5e0f41174bc645d828c444f365ae2da
[ "MIT" ]
null
null
null
src/main/java/io/github/sbcloudrace/sbtranslator/jaxb/http/DragEntrantResult.java
sbcloudrace/sb-translator
809b2e97d5e0f41174bc645d828c444f365ae2da
[ "MIT" ]
1
2021-01-30T14:53:50.000Z
2021-01-30T14:53:50.000Z
22.45614
95
0.657031
998,039
package io.github.sbcloudrace.sbtranslator.jaxb.http; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for DragEntrantResult complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="DragEntrantResult"> * &lt;complexContent> * &lt;extension base="{}EntrantResult"> * &lt;sequence> * &lt;element name="TopSpeed" type="{http://www.w3.org/2001/XMLSchema}float"/> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DragEntrantResult", propOrder = { "topSpeed" }) public class DragEntrantResult extends EntrantResult { @XmlElement(name = "TopSpeed") protected float topSpeed; /** * Gets the value of the topSpeed property. * */ public float getTopSpeed() { return topSpeed; } /** * Sets the value of the topSpeed property. * */ public void setTopSpeed(float value) { this.topSpeed = value; } }
923762d11a66b176502b660c93d2312d6d614832
2,715
java
Java
novel-admin/src/main/java/com/java2nb/system/controller/RoleController.java
SimpleGraduationProjects/ChangLeLiteraryNovelManagementSystem
bf56c5c576af3790ed61bbc6ae7414630ac4768a
[ "Artistic-1.0-cl8" ]
2,505
2020-05-02T22:39:54.000Z
2022-03-31T12:07:50.000Z
novel-admin/src/main/java/com/java2nb/system/controller/RoleController.java
suiyidaili/novel-plus
24c7175872f1653d1cfe21961e255e1f331b165a
[ "Apache-2.0" ]
73
2020-05-06T12:58:10.000Z
2022-03-23T04:52:23.000Z
novel-admin/src/main/java/com/java2nb/system/controller/RoleController.java
suiyidaili/novel-plus
24c7175872f1653d1cfe21961e255e1f331b165a
[ "Apache-2.0" ]
996
2020-05-03T13:25:19.000Z
2022-03-27T04:45:06.000Z
23.815789
62
0.694291
998,040
package com.java2nb.system.controller; import com.java2nb.common.annotation.Log; import com.java2nb.common.config.Constant; import com.java2nb.common.controller.BaseController; import com.java2nb.common.utils.R; import com.java2nb.system.domain.RoleDO; import com.java2nb.system.service.RoleService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import java.util.List; @RequestMapping("/sys/role") @Controller public class RoleController extends BaseController { String prefix = "system/role"; @Autowired RoleService roleService; @RequiresPermissions("sys:role:role") @GetMapping() String role() { return prefix + "/role"; } @RequiresPermissions("sys:role:role") @GetMapping("/list") @ResponseBody() List<RoleDO> list() { List<RoleDO> roles = roleService.list(); return roles; } @Log("添加角色") @RequiresPermissions("sys:role:add") @GetMapping("/add") String add() { return prefix + "/add"; } @Log("编辑角色") @RequiresPermissions("sys:role:edit") @GetMapping("/edit/{id}") String edit(@PathVariable("id") Long id, Model model) { RoleDO roleDO = roleService.get(id); model.addAttribute("role", roleDO); return prefix + "/edit"; } @Log("保存角色") @RequiresPermissions("sys:role:add") @PostMapping("/save") @ResponseBody() R save(RoleDO role) { if (Constant.DEMO_ACCOUNT.equals(getUsername())) { return R.error(1, "演示系统不允许修改,完整体验请部署程序"); } if (roleService.save(role) > 0) { return R.ok(); } else { return R.error(1, "保存失败"); } } @Log("更新角色") @RequiresPermissions("sys:role:edit") @PostMapping("/update") @ResponseBody() R update(RoleDO role) { if (Constant.DEMO_ACCOUNT.equals(getUsername())) { return R.error(1, "演示系统不允许修改,完整体验请部署程序"); } if (roleService.update(role) > 0) { return R.ok(); } else { return R.error(1, "保存失败"); } } @Log("删除角色") @RequiresPermissions("sys:role:remove") @PostMapping("/remove") @ResponseBody() R save(Long id) { if (Constant.DEMO_ACCOUNT.equals(getUsername())) { return R.error(1, "演示系统不允许修改,完整体验请部署程序"); } if (roleService.remove(id) > 0) { return R.ok(); } else { return R.error(1, "删除失败"); } } @RequiresPermissions("sys:role:batchRemove") @Log("批量删除角色") @PostMapping("/batchRemove") @ResponseBody R batchRemove(@RequestParam("ids[]") Long[] ids) { if (Constant.DEMO_ACCOUNT.equals(getUsername())) { return R.error(1, "演示系统不允许修改,完整体验请部署程序"); } int r = roleService.batchremove(ids); if (r > 0) { return R.ok(); } return R.error(); } }
923762e99c4419e5721594d0b3d5e205b25ad84c
991
java
Java
src/main/java/com/xingray/candleview/IndicatorLine.java
XingRay/CandleView
12eca2840174d529eae6b17dc77eaeb889af528a
[ "Apache-2.0" ]
null
null
null
src/main/java/com/xingray/candleview/IndicatorLine.java
XingRay/CandleView
12eca2840174d529eae6b17dc77eaeb889af528a
[ "Apache-2.0" ]
null
null
null
src/main/java/com/xingray/candleview/IndicatorLine.java
XingRay/CandleView
12eca2840174d529eae6b17dc77eaeb889af528a
[ "Apache-2.0" ]
null
null
null
22.522727
86
0.65893
998,041
package com.xingray.candleview; import com.xingray.stock.analysis.candle.Candle; import com.xingray.stock.analysis.indicator.Indicator; import com.xingray.stock.analysis.num.Num; import com.xingray.view.Color; public class IndicatorLine implements Line { private String name; private Indicator<Num, Candle> indicator; private Color color; public IndicatorLine(Indicator<Num, Candle> indicator, Color color) { this("", indicator, color); } public IndicatorLine(String name, Indicator<Num, Candle> indicator, Color color) { this.name = name; this.indicator = indicator; this.color = color; } @Override public String getName() { return name; } @Override public double get(int index) { return indicator.get(index).doubleValue(); } @Override public int length() { return indicator.length(); } @Override public Color getColor() { return color; } }
9237631460bd056d56d530f5becbb39ff496c029
902
java
Java
src/main/java/me/limeglass/khoryl/elements/block/candles/ExprMaxCandles.java
CasparsTools/Khoryl
e42a423bd080e2773320561a93030f3d176d3fe0
[ "Apache-2.0" ]
1
2022-01-25T16:34:09.000Z
2022-01-25T16:34:09.000Z
src/main/java/me/limeglass/khoryl/elements/block/candles/ExprMaxCandles.java
CasparsTools/Khoryl
e42a423bd080e2773320561a93030f3d176d3fe0
[ "Apache-2.0" ]
null
null
null
src/main/java/me/limeglass/khoryl/elements/block/candles/ExprMaxCandles.java
CasparsTools/Khoryl
e42a423bd080e2773320561a93030f3d176d3fe0
[ "Apache-2.0" ]
null
null
null
25.771429
81
0.768293
998,042
package me.limeglass.khoryl.elements.block.candles; import org.bukkit.block.data.type.Candle; import org.eclipse.jdt.annotation.Nullable; import ch.njol.skript.Skript; import ch.njol.skript.doc.Description; import ch.njol.skript.doc.Name; import ch.njol.skript.doc.Since; import ch.njol.skript.util.Version; import me.limeglass.khoryl.lang.BlockDataPropertyExpression; @Name("Max Candle Count") @Description("Get the max candle count of a candle.") @Since("1.0.3") public class ExprMaxCandles extends BlockDataPropertyExpression<Candle, Number> { static { if (!Skript.getMinecraftVersion().isSmallerThan(new Version(1, 17))) register(ExprMaxCandles.class, Number.class, "max candle count", "blocks"); } @Override @Nullable protected Number grab(Candle candle) { return candle.getMaximumCandles(); } @Override protected String getPropertyName() { return "max candle count"; } }
9237637274617beb75769b319ada2b1cba60a746
472
java
Java
rpc-common/src/main/java/com/dao/rpc/common/exception/JsonOperationException.java
SuperDaoOffice/dao-rpc-spring-boot-starter
4493437f1791b12f1621c7794d7b3cabc74b7dfd
[ "Apache-2.0" ]
null
null
null
rpc-common/src/main/java/com/dao/rpc/common/exception/JsonOperationException.java
SuperDaoOffice/dao-rpc-spring-boot-starter
4493437f1791b12f1621c7794d7b3cabc74b7dfd
[ "Apache-2.0" ]
null
null
null
rpc-common/src/main/java/com/dao/rpc/common/exception/JsonOperationException.java
SuperDaoOffice/dao-rpc-spring-boot-starter
4493437f1791b12f1621c7794d7b3cabc74b7dfd
[ "Apache-2.0" ]
null
null
null
18.153846
62
0.652542
998,043
package com.dao.rpc.common.exception; /** * @author jay * @date 2018/5/15 */ public class JsonOperationException extends RuntimeException { private String message; public JsonOperationException(String message) { this.message = message; } public JsonOperationException() { } @Override public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
923763c172355fc19dc681bcef32a42baef9b3c0
1,660
java
Java
offerProblems/src/main/java/jianzhiOffer/Sol_33.java
WhyWhatHow/LeetCodeSolution
9d34e2f33d8efef56dc991dc6078c1ced86b77b0
[ "MIT" ]
1
2021-05-31T05:59:15.000Z
2021-05-31T05:59:15.000Z
offerProblems/src/main/java/jianzhiOffer/Sol_33.java
WhyWhatHow/LeetCodeSolution
9d34e2f33d8efef56dc991dc6078c1ced86b77b0
[ "MIT" ]
null
null
null
offerProblems/src/main/java/jianzhiOffer/Sol_33.java
WhyWhatHow/LeetCodeSolution
9d34e2f33d8efef56dc991dc6078c1ced86b77b0
[ "MIT" ]
null
null
null
28.135593
90
0.54759
998,044
package jianzhiOffer; import java.util.Arrays; /** * @program: LeetCodeSolution * @description: * @author: WhyWhatHow * @create: 2020-05-22 08:10 **/ public class Sol_33 { /** * 判断 二叉搜索树 ,后序遍历是否正确. * 思路一: * 将postOrder排序, 获取中序遍历的数组, 然后根据中序, 后序生成二叉树, 若成功生成二叉树, 则返回tree,不对则返回false * 缺点:存在重复劳作, 并且题目并没有给出 treenode 数据结构.所以,不可取 * 思路二: * 后序遍历顺序: 左右根, * 二叉搜索树 性质: * left<root<right ,所以[left,right,root] 保证了 存在连续子数组 * 所以就有了, 将当前数组分为左半部分 [left,mid] 这其中的数值小于 root节点,即(postorder[length-1]),右半部分:值大于root节点 * 然后在判断[left,mid] [mid,right] 这两个子数组 是否满足定义 * @param postorder * @return */ public boolean verifyPostorder(int[] postorder) { if (postorder.length == 0) { return true; } return solve(0, postorder.length - 1, postorder); } private boolean solve(int left, int right, int[] postorder) { if (left >= right) {// 表示当前子树中,节点个数小于或者等于1 , 即节点为叶子结点或者为空 return true; } int val = postorder[right]; int i = left; while (postorder[i] < val) i++; // 左子树 int mid = i; while (postorder[i] > val) i++; // 右子树 return i==right // 表示从[left,right] 的数组满足 二叉搜索树的性质 && solve(left,mid-1,postorder)// 左子树 && solve(mid,right-1,postorder); } public static void main(String[] args) { Sol_33 sol = new Sol_33(); boolean b = sol.verifyPostorder(new int[]{ // 1,6,3,2,5 1,2,5,10,6,9,4,3 // 1, 3, 2, 6, 5 }); System.out.println(b); System.out.println("======="); } }
923765c6b236d5f9af17ddcc78f646a51f70cb2c
12,127
java
Java
src/encdec/Encode.java
VMormoris/EncDec
e2b0dc2da3157cd79bf91c8e8ce3f26a616e9239
[ "MIT" ]
null
null
null
src/encdec/Encode.java
VMormoris/EncDec
e2b0dc2da3157cd79bf91c8e8ce3f26a616e9239
[ "MIT" ]
null
null
null
src/encdec/Encode.java
VMormoris/EncDec
e2b0dc2da3157cd79bf91c8e8ce3f26a616e9239
[ "MIT" ]
null
null
null
32.775676
108
0.667519
998,045
/* * * This file is part of EncDec. * * Copyright (c) 2019 Mormoris Vasileios * * 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 encdec; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.Serializable; import java.nio.ByteBuffer; import java.nio.charset.Charset; /** * This class contains statics methods that can be used to encode different types of variables * @author <a href="https://github.com/VMormoris">Vasileios Mormoris </a> * @version 1.0.0 * @since 1.0.0 */ public class Encode { /** * Method used to encode a String into the specified encoding * @param data String to be encoded * @param encoding The encoding that will be used for the String * @return A byte[] of the encoded String * @throws EmptyStringException Is thrown when trying to encode an empty String */ public static byte[] string(String data, Charset encoding) throws EmptyStringException { if(data.equals("")) throw new EmptyStringException(); return data.getBytes(encoding); } /** * Method used to encode a number (integer) * @param data The number to be encoded * @param type The bytes used to represent the number<br> * <b>- SHORT:</b> 2 Bytes (16 bit)<br> * <b>- INT:</b> 4 Bytes (32 bit)<br> * <b>- LONG:</b> 8 Bytes (64 bit)<br> * @return A byte[] of the encoded number * @throws ByteArrayOverflowException Is thrown when the number can't be represented by the specified type * @see integer */ public static byte[] integer(long data,integer type) throws ByteArrayOverflowException { byte[] returnData=null; switch(type) { case SHORT: if(data<Short.MIN_VALUE||data>Short.MAX_VALUE) throw new ByteArrayOverflowException(type); returnData=ByteBuffer.allocate(2).putShort((short)data).array(); break; case INT: if(data<Integer.MIN_VALUE||data>Integer.MAX_VALUE) throw new ByteArrayOverflowException(type); returnData=ByteBuffer.allocate(4).putInt((int)data).array(); break; case LONG: returnData=ByteBuffer.allocate(8).putLong(data).array(); break; } return returnData; } /** * Method used to encode a number (integer) * @param data The number to be encoded * @param type The bytes used to represent the number<br> * <b>- SHORT:</b> 2 Bytes (16 bit)<br> * <b>- INT:</b> 4 Bytes (32 bit)<br> * <b>- LONG:</b> 8 Bytes (64 bit)<br> * @return A byte[] of the encoded number * @throws ByteArrayOverflowException Is thrown when the number can't be represented by the specified type * @see integer */ public static byte[] integer(int data, integer type) throws ByteArrayOverflowException { byte[] returnData=null; switch (type){ case SHORT: if(data<Short.MIN_VALUE||data>Short.MAX_VALUE) throw new ByteArrayOverflowException(type); returnData=ByteBuffer.allocate(2).putShort((short)data).array(); break; case INT: returnData=ByteBuffer.allocate(4).putInt(data).array(); break; case LONG: returnData=ByteBuffer.allocate(8).putLong((long)data).array(); break; } return returnData; } /** * Method used for encoding number (integer) 2 byte format (16 bits) * @param data The number to be encoded * @return A byte[] of the encoded number */ public static byte[] Short(short data) { return (ByteBuffer.allocate(2).putShort(data).array()); } /** * Method used for encoding number (integer) 4 byte format (32 bits) * @param data The number to be encoded * @return A byte[] of the encoded number */ public static byte[] Int(int data) { return (ByteBuffer.allocate(4).putInt(data).array()); } /** * Method used for encoding number (integer) 8 byte format (64 bits) * @param data The number to be encoded * @return A byte[] of the encoded number */ public static byte[] Long(long data) { return (ByteBuffer.allocate(8).putLong(data).array()); } /** * Method used for encoding a Series of numbers (integers) 8 byte format (64 bits) for each number * @param data The numbers to be encoded * @return A byte[] of the encoded numbers */ public static byte[] Longs(long[]data) { if(data.length==0) return null; ByteBuffer buffer=ByteBuffer.allocate(8*data.length); for(int i=0;i<data.length;i++) { int offset=i*8; buffer.putLong(offset, data[i]); } return buffer.array(); } /** * Method used for encoding a Series of numbers (integers) 4 byte format (32 bits) for each number * @param data The numbers to be encoded * @return A byte[] of the encoded numbers */ public static byte[] Ints(int[] data) { if(data.length==0) return null; ByteBuffer buffer=ByteBuffer.allocate(4*data.length); for(int i=0;i<data.length;i++) { int offset=i*4; buffer.putInt(offset, data[i]); } return buffer.array(); } /** * Method used for encoding a Series of numbers (integers) 2 byte format (16 bits) for each number * @param data The numbers to be encoded * @return A byte[] of the encoded numbers */ public static byte[] Shorts(short[]data) { if(data.length==0) return null; ByteBuffer buffer=ByteBuffer.allocate(2*data.length); for(int i=0;i<data.length;i++) { int offset=i*2; buffer.putShort(offset, data[i]); } return buffer.array(); } /** * Method used to encode a Series of numbers (integers) * @param data The numbers to be encoded * @param type The bytes used to represent the numbers<br> * <b>- SHORT:</b> 2 Bytes (16 bit)<br> * <b>- INT:</b> 4 Bytes (32 bit)<br> * <b>- LONG:</b> 8 Bytes (64 bit)<br> * @return A byte[] of the encoded numbers * @throws ByteArrayOverflowException Is thrown when the number can't be represented by the specified type * @see integer */ public static byte[] integers(long[]data,integer type) throws ByteArrayOverflowException { if(data.length==0) return null; ByteBuffer buffer; switch(type) { case SHORT: buffer=ByteBuffer.allocate(data.length*2); for(int i=0;i<data.length;i++) { int offset=i*2; if(data[i]<Short.MIN_VALUE||data[i]>Short.MAX_VALUE) throw new ByteArrayOverflowException(type); buffer.putShort(offset, (short)data[i]); } break; case LONG: buffer=ByteBuffer.allocate(data.length*8); for(int i=0;i<data.length;i++) { int offset=i*8; buffer.putLong(offset, data[i]); } break; case INT: buffer=ByteBuffer.allocate(data.length*4); for(int i=0;i<data.length;i++) { int offset=i*4; if(data[i]<Integer.MIN_VALUE||data[i]>Integer.MAX_VALUE) throw new ByteArrayOverflowException(type); buffer.putInt(offset, (int)data[i]); } break; default: return null; } return buffer.array(); } /** * Method used to encode a Series of numbers (integers) * @param data The numbers to be encoded * @param type The bytes used to represent the numbers<br> * <b>- SHORT:</b> 2 Bytes (16 bit)<br> * <b>- INT:</b> 4 Bytes (32 bit)<br> * <b>- LONG:</b> 8 Bytes (64 bit)<br> * @return A byte[] of the encoded numbers * @throws ByteArrayOverflowException Is thrown when the number can't be represented by the specified type * @see integer */ public static byte[] integers(int[] data, integer type) throws ByteArrayOverflowException { if(data.length==0) return null; ByteBuffer buffer; switch (type){ case SHORT: buffer=ByteBuffer.allocate(2*data.length); for(int i=0;i<data.length;i++){ int offset=i*2; if(data[i]<Short.MIN_VALUE||data[i]>Short.MAX_VALUE) throw new ByteArrayOverflowException(type); buffer.putShort(offset, (short)data[i]); } break; case INT: buffer=ByteBuffer.allocate(4*data.length); for(int i=0;i<data.length;i++){ int offset=i*4; buffer.putInt(offset, data[i]); } break; case LONG: buffer=ByteBuffer.allocate(8*data.length); for(int i=0;i<data.length;i++){ int offset=i*8; buffer.putLong(offset, (long)data[i]); } break; default: return null; } return buffer.array(); } /** * Method used for encoding an Object that implements the Serializable interface * @param data The Object to be encoded * @return A byte[] representing the encoded Object */ public static byte[] object(Serializable data) { ByteArrayOutputStream bos=new ByteArrayOutputStream(); ObjectOutputStream oos; byte[] returnData=null; try { oos=new ObjectOutputStream(bos); oos.writeObject(data); oos.flush(); oos.close(); returnData=bos.toByteArray(); bos.close(); } catch (IOException e) { e.printStackTrace(); } return returnData; } /** * Method used for encoding a Series Objects that implements the Serializable interface * @param data The Objects to be encoded * @return A byte[] representing the encoded Objects */ public static byte[] objects(Serializable[] data) { ByteArrayOutputStream bos=new ByteArrayOutputStream(); ObjectOutputStream oos; byte[] returnData=null; try { oos=new ObjectOutputStream(bos); oos.writeInt(data.length); oos.flush(); for(Serializable obj: data) { oos.writeObject(obj); oos.flush(); } oos.close(); returnData=bos.toByteArray(); bos.close(); } catch (IOException e) { e.printStackTrace(); } return returnData; } /** * Method used for encoding a number (decimal) 4 byte format (32 bits) * @param data The number to be encoded * @return A byte[] representing the encoded number */ public static byte[] Float(float data) { return ByteBuffer.allocate(4).putFloat(data).array(); } /** * Method used for encoding a number (decimal) 8 byte format (64 bits) * @param data The number to be encoded * @return A byte[] representing the encoded number */ public static byte[] Double(double data) { return ByteBuffer.allocate(8).putDouble(data).array(); } /** * Method used for encoding a numbers (decimals) 4 byte format (32 bits) for each number * @param data The numbers to be encoded * @return A byte[] representing the encoded numbers */ public static byte[] Floats(float[] data) { if(data.length==0) return null; ByteBuffer buffer=ByteBuffer.allocate(4*data.length); for(int i=0;i<data.length;i++) { int offset=i*4; buffer.putFloat(offset,data[i]); } return buffer.array(); } /** * Method used for encoding a numbers (decimals) 8 byte format (64 bits) for each number * @param data The numbers to be encoded * @return A byte[] representing the encoded numbers */ public static byte[] Doubles(double[] data) { if(data.length==0) return null; ByteBuffer buffer=ByteBuffer.allocate(8*data.length); for(int i=0;i<data.length;i++) { int offset=i*8; buffer.putDouble(offset, data[i]); } return buffer.array(); } }
9237677c2f64890e385932d2e1808f7e71ad5653
659
java
Java
imageannotations/src/main/java/com/eemphasys/eservie/imageannotations/library/Vector2D.java
hitesh-rampure/ePhotoEditor
2c91a1ff89ebd6d0065cc9055a5b4950476ad66e
[ "Apache-2.0" ]
null
null
null
imageannotations/src/main/java/com/eemphasys/eservie/imageannotations/library/Vector2D.java
hitesh-rampure/ePhotoEditor
2c91a1ff89ebd6d0065cc9055a5b4950476ad66e
[ "Apache-2.0" ]
1
2018-06-12T09:14:05.000Z
2018-06-12T09:14:05.000Z
imageannotations/src/main/java/com/eemphasys/eservie/imageannotations/library/Vector2D.java
hitesh-rampure/ePhotoEditor
2c91a1ff89ebd6d0065cc9055a5b4950476ad66e
[ "Apache-2.0" ]
null
null
null
24.407407
115
0.596358
998,046
package com.eemphasys.eservie.imageannotations.library; import android.graphics.PointF; class Vector2D extends PointF { public Vector2D() { super(); } public Vector2D(float x, float y) { super(x, y); } public static float getAngle(Vector2D vector1, Vector2D vector2) { vector1.normalize(); vector2.normalize(); double degrees = (180.0 / Math.PI) * (Math.atan2(vector2.y, vector2.x) - Math.atan2(vector1.y, vector1.x)); return (float) degrees; } public void normalize() { float length = (float) Math.sqrt(x * x + y * y); x /= length; y /= length; } }
92376799b2bf78d91300f2c1a83eb09c396c179f
30,533
java
Java
client/src/main/generated/com/vesoft/nebula/meta/Session.java
MMyheart/nebula-java
3518faa8444c1f590fba92d7f7c66946ad696852
[ "Apache-2.0" ]
115
2019-10-12T06:58:43.000Z
2022-03-28T03:33:22.000Z
client/src/main/generated/com/vesoft/nebula/meta/Session.java
MMyheart/nebula-java
3518faa8444c1f590fba92d7f7c66946ad696852
[ "Apache-2.0" ]
202
2019-10-18T13:41:50.000Z
2022-03-28T07:56:25.000Z
client/src/main/generated/com/vesoft/nebula/meta/Session.java
MMyheart/nebula-java
3518faa8444c1f590fba92d7f7c66946ad696852
[ "Apache-2.0" ]
113
2019-10-11T06:59:49.000Z
2022-03-09T02:37:16.000Z
30.717304
276
0.644974
998,047
/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package com.vesoft.nebula.meta; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.Set; import java.util.HashSet; import java.util.Collections; import java.util.BitSet; import java.util.Arrays; import com.facebook.thrift.*; import com.facebook.thrift.annotations.*; import com.facebook.thrift.async.*; import com.facebook.thrift.meta_data.*; import com.facebook.thrift.server.*; import com.facebook.thrift.transport.*; import com.facebook.thrift.protocol.*; @SuppressWarnings({ "unused", "serial" }) public class Session implements TBase, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("Session"); private static final TField SESSION_ID_FIELD_DESC = new TField("session_id", TType.I64, (short)1); private static final TField CREATE_TIME_FIELD_DESC = new TField("create_time", TType.I64, (short)2); private static final TField UPDATE_TIME_FIELD_DESC = new TField("update_time", TType.I64, (short)3); private static final TField USER_NAME_FIELD_DESC = new TField("user_name", TType.STRING, (short)4); private static final TField SPACE_NAME_FIELD_DESC = new TField("space_name", TType.STRING, (short)5); private static final TField GRAPH_ADDR_FIELD_DESC = new TField("graph_addr", TType.STRUCT, (short)6); private static final TField TIMEZONE_FIELD_DESC = new TField("timezone", TType.I32, (short)7); private static final TField CLIENT_IP_FIELD_DESC = new TField("client_ip", TType.STRING, (short)8); private static final TField CONFIGS_FIELD_DESC = new TField("configs", TType.MAP, (short)9); private static final TField QUERIES_FIELD_DESC = new TField("queries", TType.MAP, (short)10); public long session_id; public long create_time; public long update_time; public byte[] user_name; public byte[] space_name; public com.vesoft.nebula.HostAddr graph_addr; public int timezone; public byte[] client_ip; public Map<byte[],com.vesoft.nebula.Value> configs; public Map<Long,QueryDesc> queries; public static final int SESSION_ID = 1; public static final int CREATE_TIME = 2; public static final int UPDATE_TIME = 3; public static final int USER_NAME = 4; public static final int SPACE_NAME = 5; public static final int GRAPH_ADDR = 6; public static final int TIMEZONE = 7; public static final int CLIENT_IP = 8; public static final int CONFIGS = 9; public static final int QUERIES = 10; // isset id assignments private static final int __SESSION_ID_ISSET_ID = 0; private static final int __CREATE_TIME_ISSET_ID = 1; private static final int __UPDATE_TIME_ISSET_ID = 2; private static final int __TIMEZONE_ISSET_ID = 3; private BitSet __isset_bit_vector = new BitSet(4); public static final Map<Integer, FieldMetaData> metaDataMap; static { Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>(); tmpMetaDataMap.put(SESSION_ID, new FieldMetaData("session_id", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.I64))); tmpMetaDataMap.put(CREATE_TIME, new FieldMetaData("create_time", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.I64))); tmpMetaDataMap.put(UPDATE_TIME, new FieldMetaData("update_time", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.I64))); tmpMetaDataMap.put(USER_NAME, new FieldMetaData("user_name", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); tmpMetaDataMap.put(SPACE_NAME, new FieldMetaData("space_name", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); tmpMetaDataMap.put(GRAPH_ADDR, new FieldMetaData("graph_addr", TFieldRequirementType.DEFAULT, new StructMetaData(TType.STRUCT, com.vesoft.nebula.HostAddr.class))); tmpMetaDataMap.put(TIMEZONE, new FieldMetaData("timezone", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.I32))); tmpMetaDataMap.put(CLIENT_IP, new FieldMetaData("client_ip", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); tmpMetaDataMap.put(CONFIGS, new FieldMetaData("configs", TFieldRequirementType.DEFAULT, new MapMetaData(TType.MAP, new FieldValueMetaData(TType.STRING), new StructMetaData(TType.STRUCT, com.vesoft.nebula.Value.class)))); tmpMetaDataMap.put(QUERIES, new FieldMetaData("queries", TFieldRequirementType.DEFAULT, new MapMetaData(TType.MAP, new FieldValueMetaData(TType.I64), new StructMetaData(TType.STRUCT, QueryDesc.class)))); metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap); } static { FieldMetaData.addStructMetaDataMap(Session.class, metaDataMap); } public Session() { } public Session( long session_id, long create_time, long update_time, byte[] user_name, byte[] space_name, com.vesoft.nebula.HostAddr graph_addr, int timezone, byte[] client_ip, Map<byte[],com.vesoft.nebula.Value> configs, Map<Long,QueryDesc> queries) { this(); this.session_id = session_id; setSession_idIsSet(true); this.create_time = create_time; setCreate_timeIsSet(true); this.update_time = update_time; setUpdate_timeIsSet(true); this.user_name = user_name; this.space_name = space_name; this.graph_addr = graph_addr; this.timezone = timezone; setTimezoneIsSet(true); this.client_ip = client_ip; this.configs = configs; this.queries = queries; } public static class Builder { private long session_id; private long create_time; private long update_time; private byte[] user_name; private byte[] space_name; private com.vesoft.nebula.HostAddr graph_addr; private int timezone; private byte[] client_ip; private Map<byte[],com.vesoft.nebula.Value> configs; private Map<Long,QueryDesc> queries; BitSet __optional_isset = new BitSet(4); public Builder() { } public Builder setSession_id(final long session_id) { this.session_id = session_id; __optional_isset.set(__SESSION_ID_ISSET_ID, true); return this; } public Builder setCreate_time(final long create_time) { this.create_time = create_time; __optional_isset.set(__CREATE_TIME_ISSET_ID, true); return this; } public Builder setUpdate_time(final long update_time) { this.update_time = update_time; __optional_isset.set(__UPDATE_TIME_ISSET_ID, true); return this; } public Builder setUser_name(final byte[] user_name) { this.user_name = user_name; return this; } public Builder setSpace_name(final byte[] space_name) { this.space_name = space_name; return this; } public Builder setGraph_addr(final com.vesoft.nebula.HostAddr graph_addr) { this.graph_addr = graph_addr; return this; } public Builder setTimezone(final int timezone) { this.timezone = timezone; __optional_isset.set(__TIMEZONE_ISSET_ID, true); return this; } public Builder setClient_ip(final byte[] client_ip) { this.client_ip = client_ip; return this; } public Builder setConfigs(final Map<byte[],com.vesoft.nebula.Value> configs) { this.configs = configs; return this; } public Builder setQueries(final Map<Long,QueryDesc> queries) { this.queries = queries; return this; } public Session build() { Session result = new Session(); if (__optional_isset.get(__SESSION_ID_ISSET_ID)) { result.setSession_id(this.session_id); } if (__optional_isset.get(__CREATE_TIME_ISSET_ID)) { result.setCreate_time(this.create_time); } if (__optional_isset.get(__UPDATE_TIME_ISSET_ID)) { result.setUpdate_time(this.update_time); } result.setUser_name(this.user_name); result.setSpace_name(this.space_name); result.setGraph_addr(this.graph_addr); if (__optional_isset.get(__TIMEZONE_ISSET_ID)) { result.setTimezone(this.timezone); } result.setClient_ip(this.client_ip); result.setConfigs(this.configs); result.setQueries(this.queries); return result; } } public static Builder builder() { return new Builder(); } /** * Performs a deep copy on <i>other</i>. */ public Session(Session other) { __isset_bit_vector.clear(); __isset_bit_vector.or(other.__isset_bit_vector); this.session_id = TBaseHelper.deepCopy(other.session_id); this.create_time = TBaseHelper.deepCopy(other.create_time); this.update_time = TBaseHelper.deepCopy(other.update_time); if (other.isSetUser_name()) { this.user_name = TBaseHelper.deepCopy(other.user_name); } if (other.isSetSpace_name()) { this.space_name = TBaseHelper.deepCopy(other.space_name); } if (other.isSetGraph_addr()) { this.graph_addr = TBaseHelper.deepCopy(other.graph_addr); } this.timezone = TBaseHelper.deepCopy(other.timezone); if (other.isSetClient_ip()) { this.client_ip = TBaseHelper.deepCopy(other.client_ip); } if (other.isSetConfigs()) { this.configs = TBaseHelper.deepCopy(other.configs); } if (other.isSetQueries()) { this.queries = TBaseHelper.deepCopy(other.queries); } } public Session deepCopy() { return new Session(this); } public long getSession_id() { return this.session_id; } public Session setSession_id(long session_id) { this.session_id = session_id; setSession_idIsSet(true); return this; } public void unsetSession_id() { __isset_bit_vector.clear(__SESSION_ID_ISSET_ID); } // Returns true if field session_id is set (has been assigned a value) and false otherwise public boolean isSetSession_id() { return __isset_bit_vector.get(__SESSION_ID_ISSET_ID); } public void setSession_idIsSet(boolean __value) { __isset_bit_vector.set(__SESSION_ID_ISSET_ID, __value); } public long getCreate_time() { return this.create_time; } public Session setCreate_time(long create_time) { this.create_time = create_time; setCreate_timeIsSet(true); return this; } public void unsetCreate_time() { __isset_bit_vector.clear(__CREATE_TIME_ISSET_ID); } // Returns true if field create_time is set (has been assigned a value) and false otherwise public boolean isSetCreate_time() { return __isset_bit_vector.get(__CREATE_TIME_ISSET_ID); } public void setCreate_timeIsSet(boolean __value) { __isset_bit_vector.set(__CREATE_TIME_ISSET_ID, __value); } public long getUpdate_time() { return this.update_time; } public Session setUpdate_time(long update_time) { this.update_time = update_time; setUpdate_timeIsSet(true); return this; } public void unsetUpdate_time() { __isset_bit_vector.clear(__UPDATE_TIME_ISSET_ID); } // Returns true if field update_time is set (has been assigned a value) and false otherwise public boolean isSetUpdate_time() { return __isset_bit_vector.get(__UPDATE_TIME_ISSET_ID); } public void setUpdate_timeIsSet(boolean __value) { __isset_bit_vector.set(__UPDATE_TIME_ISSET_ID, __value); } public byte[] getUser_name() { return this.user_name; } public Session setUser_name(byte[] user_name) { this.user_name = user_name; return this; } public void unsetUser_name() { this.user_name = null; } // Returns true if field user_name is set (has been assigned a value) and false otherwise public boolean isSetUser_name() { return this.user_name != null; } public void setUser_nameIsSet(boolean __value) { if (!__value) { this.user_name = null; } } public byte[] getSpace_name() { return this.space_name; } public Session setSpace_name(byte[] space_name) { this.space_name = space_name; return this; } public void unsetSpace_name() { this.space_name = null; } // Returns true if field space_name is set (has been assigned a value) and false otherwise public boolean isSetSpace_name() { return this.space_name != null; } public void setSpace_nameIsSet(boolean __value) { if (!__value) { this.space_name = null; } } public com.vesoft.nebula.HostAddr getGraph_addr() { return this.graph_addr; } public Session setGraph_addr(com.vesoft.nebula.HostAddr graph_addr) { this.graph_addr = graph_addr; return this; } public void unsetGraph_addr() { this.graph_addr = null; } // Returns true if field graph_addr is set (has been assigned a value) and false otherwise public boolean isSetGraph_addr() { return this.graph_addr != null; } public void setGraph_addrIsSet(boolean __value) { if (!__value) { this.graph_addr = null; } } public int getTimezone() { return this.timezone; } public Session setTimezone(int timezone) { this.timezone = timezone; setTimezoneIsSet(true); return this; } public void unsetTimezone() { __isset_bit_vector.clear(__TIMEZONE_ISSET_ID); } // Returns true if field timezone is set (has been assigned a value) and false otherwise public boolean isSetTimezone() { return __isset_bit_vector.get(__TIMEZONE_ISSET_ID); } public void setTimezoneIsSet(boolean __value) { __isset_bit_vector.set(__TIMEZONE_ISSET_ID, __value); } public byte[] getClient_ip() { return this.client_ip; } public Session setClient_ip(byte[] client_ip) { this.client_ip = client_ip; return this; } public void unsetClient_ip() { this.client_ip = null; } // Returns true if field client_ip is set (has been assigned a value) and false otherwise public boolean isSetClient_ip() { return this.client_ip != null; } public void setClient_ipIsSet(boolean __value) { if (!__value) { this.client_ip = null; } } public Map<byte[],com.vesoft.nebula.Value> getConfigs() { return this.configs; } public Session setConfigs(Map<byte[],com.vesoft.nebula.Value> configs) { this.configs = configs; return this; } public void unsetConfigs() { this.configs = null; } // Returns true if field configs is set (has been assigned a value) and false otherwise public boolean isSetConfigs() { return this.configs != null; } public void setConfigsIsSet(boolean __value) { if (!__value) { this.configs = null; } } public Map<Long,QueryDesc> getQueries() { return this.queries; } public Session setQueries(Map<Long,QueryDesc> queries) { this.queries = queries; return this; } public void unsetQueries() { this.queries = null; } // Returns true if field queries is set (has been assigned a value) and false otherwise public boolean isSetQueries() { return this.queries != null; } public void setQueriesIsSet(boolean __value) { if (!__value) { this.queries = null; } } @SuppressWarnings("unchecked") public void setFieldValue(int fieldID, Object __value) { switch (fieldID) { case SESSION_ID: if (__value == null) { unsetSession_id(); } else { setSession_id((Long)__value); } break; case CREATE_TIME: if (__value == null) { unsetCreate_time(); } else { setCreate_time((Long)__value); } break; case UPDATE_TIME: if (__value == null) { unsetUpdate_time(); } else { setUpdate_time((Long)__value); } break; case USER_NAME: if (__value == null) { unsetUser_name(); } else { setUser_name((byte[])__value); } break; case SPACE_NAME: if (__value == null) { unsetSpace_name(); } else { setSpace_name((byte[])__value); } break; case GRAPH_ADDR: if (__value == null) { unsetGraph_addr(); } else { setGraph_addr((com.vesoft.nebula.HostAddr)__value); } break; case TIMEZONE: if (__value == null) { unsetTimezone(); } else { setTimezone((Integer)__value); } break; case CLIENT_IP: if (__value == null) { unsetClient_ip(); } else { setClient_ip((byte[])__value); } break; case CONFIGS: if (__value == null) { unsetConfigs(); } else { setConfigs((Map<byte[],com.vesoft.nebula.Value>)__value); } break; case QUERIES: if (__value == null) { unsetQueries(); } else { setQueries((Map<Long,QueryDesc>)__value); } break; default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } } public Object getFieldValue(int fieldID) { switch (fieldID) { case SESSION_ID: return new Long(getSession_id()); case CREATE_TIME: return new Long(getCreate_time()); case UPDATE_TIME: return new Long(getUpdate_time()); case USER_NAME: return getUser_name(); case SPACE_NAME: return getSpace_name(); case GRAPH_ADDR: return getGraph_addr(); case TIMEZONE: return new Integer(getTimezone()); case CLIENT_IP: return getClient_ip(); case CONFIGS: return getConfigs(); case QUERIES: return getQueries(); default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } } @Override public boolean equals(Object _that) { if (_that == null) return false; if (this == _that) return true; if (!(_that instanceof Session)) return false; Session that = (Session)_that; if (!TBaseHelper.equalsNobinary(this.session_id, that.session_id)) { return false; } if (!TBaseHelper.equalsNobinary(this.create_time, that.create_time)) { return false; } if (!TBaseHelper.equalsNobinary(this.update_time, that.update_time)) { return false; } if (!TBaseHelper.equalsSlow(this.isSetUser_name(), that.isSetUser_name(), this.user_name, that.user_name)) { return false; } if (!TBaseHelper.equalsSlow(this.isSetSpace_name(), that.isSetSpace_name(), this.space_name, that.space_name)) { return false; } if (!TBaseHelper.equalsNobinary(this.isSetGraph_addr(), that.isSetGraph_addr(), this.graph_addr, that.graph_addr)) { return false; } if (!TBaseHelper.equalsNobinary(this.timezone, that.timezone)) { return false; } if (!TBaseHelper.equalsSlow(this.isSetClient_ip(), that.isSetClient_ip(), this.client_ip, that.client_ip)) { return false; } if (!TBaseHelper.equalsSlow(this.isSetConfigs(), that.isSetConfigs(), this.configs, that.configs)) { return false; } if (!TBaseHelper.equalsNobinary(this.isSetQueries(), that.isSetQueries(), this.queries, that.queries)) { return false; } return true; } @Override public int hashCode() { return Arrays.deepHashCode(new Object[] {session_id, create_time, update_time, user_name, space_name, graph_addr, timezone, client_ip, configs, queries}); } public void read(TProtocol iprot) throws TException { TField __field; iprot.readStructBegin(metaDataMap); while (true) { __field = iprot.readFieldBegin(); if (__field.type == TType.STOP) { break; } switch (__field.id) { case SESSION_ID: if (__field.type == TType.I64) { this.session_id = iprot.readI64(); setSession_idIsSet(true); } else { TProtocolUtil.skip(iprot, __field.type); } break; case CREATE_TIME: if (__field.type == TType.I64) { this.create_time = iprot.readI64(); setCreate_timeIsSet(true); } else { TProtocolUtil.skip(iprot, __field.type); } break; case UPDATE_TIME: if (__field.type == TType.I64) { this.update_time = iprot.readI64(); setUpdate_timeIsSet(true); } else { TProtocolUtil.skip(iprot, __field.type); } break; case USER_NAME: if (__field.type == TType.STRING) { this.user_name = iprot.readBinary(); } else { TProtocolUtil.skip(iprot, __field.type); } break; case SPACE_NAME: if (__field.type == TType.STRING) { this.space_name = iprot.readBinary(); } else { TProtocolUtil.skip(iprot, __field.type); } break; case GRAPH_ADDR: if (__field.type == TType.STRUCT) { this.graph_addr = new com.vesoft.nebula.HostAddr(); this.graph_addr.read(iprot); } else { TProtocolUtil.skip(iprot, __field.type); } break; case TIMEZONE: if (__field.type == TType.I32) { this.timezone = iprot.readI32(); setTimezoneIsSet(true); } else { TProtocolUtil.skip(iprot, __field.type); } break; case CLIENT_IP: if (__field.type == TType.STRING) { this.client_ip = iprot.readBinary(); } else { TProtocolUtil.skip(iprot, __field.type); } break; case CONFIGS: if (__field.type == TType.MAP) { { TMap _map288 = iprot.readMapBegin(); this.configs = new HashMap<byte[],com.vesoft.nebula.Value>(Math.max(0, 2*_map288.size)); for (int _i289 = 0; (_map288.size < 0) ? iprot.peekMap() : (_i289 < _map288.size); ++_i289) { byte[] _key290; com.vesoft.nebula.Value _val291; _key290 = iprot.readBinary(); _val291 = new com.vesoft.nebula.Value(); _val291.read(iprot); this.configs.put(_key290, _val291); } iprot.readMapEnd(); } } else { TProtocolUtil.skip(iprot, __field.type); } break; case QUERIES: if (__field.type == TType.MAP) { { TMap _map292 = iprot.readMapBegin(); this.queries = new HashMap<Long,QueryDesc>(Math.max(0, 2*_map292.size)); for (int _i293 = 0; (_map292.size < 0) ? iprot.peekMap() : (_i293 < _map292.size); ++_i293) { long _key294; QueryDesc _val295; _key294 = iprot.readI64(); _val295 = new QueryDesc(); _val295.read(iprot); this.queries.put(_key294, _val295); } iprot.readMapEnd(); } } else { TProtocolUtil.skip(iprot, __field.type); } break; default: TProtocolUtil.skip(iprot, __field.type); break; } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); } public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(SESSION_ID_FIELD_DESC); oprot.writeI64(this.session_id); oprot.writeFieldEnd(); oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC); oprot.writeI64(this.create_time); oprot.writeFieldEnd(); oprot.writeFieldBegin(UPDATE_TIME_FIELD_DESC); oprot.writeI64(this.update_time); oprot.writeFieldEnd(); if (this.user_name != null) { oprot.writeFieldBegin(USER_NAME_FIELD_DESC); oprot.writeBinary(this.user_name); oprot.writeFieldEnd(); } if (this.space_name != null) { oprot.writeFieldBegin(SPACE_NAME_FIELD_DESC); oprot.writeBinary(this.space_name); oprot.writeFieldEnd(); } if (this.graph_addr != null) { oprot.writeFieldBegin(GRAPH_ADDR_FIELD_DESC); this.graph_addr.write(oprot); oprot.writeFieldEnd(); } oprot.writeFieldBegin(TIMEZONE_FIELD_DESC); oprot.writeI32(this.timezone); oprot.writeFieldEnd(); if (this.client_ip != null) { oprot.writeFieldBegin(CLIENT_IP_FIELD_DESC); oprot.writeBinary(this.client_ip); oprot.writeFieldEnd(); } if (this.configs != null) { oprot.writeFieldBegin(CONFIGS_FIELD_DESC); { oprot.writeMapBegin(new TMap(TType.STRING, TType.STRUCT, this.configs.size())); for (Map.Entry<byte[], com.vesoft.nebula.Value> _iter296 : this.configs.entrySet()) { oprot.writeBinary(_iter296.getKey()); _iter296.getValue().write(oprot); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } if (this.queries != null) { oprot.writeFieldBegin(QUERIES_FIELD_DESC); { oprot.writeMapBegin(new TMap(TType.I64, TType.STRUCT, this.queries.size())); for (Map.Entry<Long, QueryDesc> _iter297 : this.queries.entrySet()) { oprot.writeI64(_iter297.getKey()); _iter297.getValue().write(oprot); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { return toString(1, true); } @Override public String toString(int indent, boolean prettyPrint) { String indentStr = prettyPrint ? TBaseHelper.getIndentedString(indent) : ""; String newLine = prettyPrint ? "\n" : ""; String space = prettyPrint ? " " : ""; StringBuilder sb = new StringBuilder("Session"); sb.append(space); sb.append("("); sb.append(newLine); boolean first = true; sb.append(indentStr); sb.append("session_id"); sb.append(space); sb.append(":").append(space); sb.append(TBaseHelper.toString(this.getSession_id(), indent + 1, prettyPrint)); first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("create_time"); sb.append(space); sb.append(":").append(space); sb.append(TBaseHelper.toString(this.getCreate_time(), indent + 1, prettyPrint)); first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("update_time"); sb.append(space); sb.append(":").append(space); sb.append(TBaseHelper.toString(this.getUpdate_time(), indent + 1, prettyPrint)); first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("user_name"); sb.append(space); sb.append(":").append(space); if (this.getUser_name() == null) { sb.append("null"); } else { int __user_name_size = Math.min(this.getUser_name().length, 128); for (int i = 0; i < __user_name_size; i++) { if (i != 0) sb.append(" "); sb.append(Integer.toHexString(this.getUser_name()[i]).length() > 1 ? Integer.toHexString(this.getUser_name()[i]).substring(Integer.toHexString(this.getUser_name()[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.getUser_name()[i]).toUpperCase()); } if (this.getUser_name().length > 128) sb.append(" ..."); } first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("space_name"); sb.append(space); sb.append(":").append(space); if (this.getSpace_name() == null) { sb.append("null"); } else { int __space_name_size = Math.min(this.getSpace_name().length, 128); for (int i = 0; i < __space_name_size; i++) { if (i != 0) sb.append(" "); sb.append(Integer.toHexString(this.getSpace_name()[i]).length() > 1 ? Integer.toHexString(this.getSpace_name()[i]).substring(Integer.toHexString(this.getSpace_name()[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.getSpace_name()[i]).toUpperCase()); } if (this.getSpace_name().length > 128) sb.append(" ..."); } first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("graph_addr"); sb.append(space); sb.append(":").append(space); if (this.getGraph_addr() == null) { sb.append("null"); } else { sb.append(TBaseHelper.toString(this.getGraph_addr(), indent + 1, prettyPrint)); } first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("timezone"); sb.append(space); sb.append(":").append(space); sb.append(TBaseHelper.toString(this.getTimezone(), indent + 1, prettyPrint)); first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("client_ip"); sb.append(space); sb.append(":").append(space); if (this.getClient_ip() == null) { sb.append("null"); } else { int __client_ip_size = Math.min(this.getClient_ip().length, 128); for (int i = 0; i < __client_ip_size; i++) { if (i != 0) sb.append(" "); sb.append(Integer.toHexString(this.getClient_ip()[i]).length() > 1 ? Integer.toHexString(this.getClient_ip()[i]).substring(Integer.toHexString(this.getClient_ip()[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.getClient_ip()[i]).toUpperCase()); } if (this.getClient_ip().length > 128) sb.append(" ..."); } first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("configs"); sb.append(space); sb.append(":").append(space); if (this.getConfigs() == null) { sb.append("null"); } else { sb.append(TBaseHelper.toString(this.getConfigs(), indent + 1, prettyPrint)); } first = false; if (!first) sb.append("," + newLine); sb.append(indentStr); sb.append("queries"); sb.append(space); sb.append(":").append(space); if (this.getQueries() == null) { sb.append("null"); } else { sb.append(TBaseHelper.toString(this.getQueries(), indent + 1, prettyPrint)); } first = false; sb.append(newLine + TBaseHelper.reduceIndent(indentStr)); sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields } }
9237699c0aaf7979d050592d1de9bd4417e57907
990
java
Java
swim-java/swim-runtime-java/swim-core-java/swim.streamlet/src/main/java/swim/streamlet/ValueOutput.java
swimos/swim
b403143d89d83e24a6bf842851bab57f1a1bc035
[ "Apache-2.0" ]
458
2019-02-19T14:04:55.000Z
2022-03-27T19:52:37.000Z
swim-java/swim-runtime-java/swim-core-java/swim.streamlet/src/main/java/swim/streamlet/ValueOutput.java
swimos/swim
b403143d89d83e24a6bf842851bab57f1a1bc035
[ "Apache-2.0" ]
57
2019-06-17T11:07:18.000Z
2021-12-21T12:47:53.000Z
swim-java/swim-runtime-java/swim-core-java/swim.streamlet/src/main/java/swim/streamlet/ValueOutput.java
swimos/swim
b403143d89d83e24a6bf842851bab57f1a1bc035
[ "Apache-2.0" ]
34
2019-02-21T02:47:34.000Z
2022-01-17T13:51:51.000Z
24.146341
75
0.69596
998,048
// Copyright 2015-2021 Swim Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package swim.streamlet; public class ValueOutput<I> extends AbstractInlet<I> { protected I state; public ValueOutput(I state) { this.state = state; } public ValueOutput() { this(null); } public I get() { return this.state; } @Override protected void onRecohereOutput(int version) { if (this.input != null) { this.state = this.input.get(); } } }
923769a0398739eff63ec8160f71a1c4d4a8db21
1,072
java
Java
lemon-entry-point/lemon-entry-point-autoconfigure/src/main/java/com/galaxy/lemonframework/entrypoint/autoconfigure/EntryPointAutoConfiguration.java
AlleriaWindrunner/galaxy
dd061c3124f1ade21b566f0474cd01e06a5d336c
[ "Apache-2.0" ]
2
2021-12-28T08:34:42.000Z
2022-01-08T03:36:51.000Z
lemon-entry-point/lemon-entry-point-autoconfigure/src/main/java/com/galaxy/lemonframework/entrypoint/autoconfigure/EntryPointAutoConfiguration.java
AlleriaWindrunner/galaxy
dd061c3124f1ade21b566f0474cd01e06a5d336c
[ "Apache-2.0" ]
null
null
null
lemon-entry-point/lemon-entry-point-autoconfigure/src/main/java/com/galaxy/lemonframework/entrypoint/autoconfigure/EntryPointAutoConfiguration.java
AlleriaWindrunner/galaxy
dd061c3124f1ade21b566f0474cd01e06a5d336c
[ "Apache-2.0" ]
1
2022-01-20T08:41:15.000Z
2022-01-20T08:41:15.000Z
32.606061
75
0.754647
998,049
/* * 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.galaxy.lemonframework.entrypoint.autoconfigure; import org.springframework.context.annotation.Configuration; /** * * @author <mailto:ychag@example.com">eleven</a> * @see * @since 1.0.0 */ @Configuration public class EntryPointAutoConfiguration { }
92376a56664162eba19e961e666473e872ed167a
1,884
java
Java
src/main/java/no/digipost/stream/EmptyResultIfEmptySourceCollector.java
digipost/d
e1570640e6e6fbe82e6facd54d46907f830165ca
[ "Apache-2.0" ]
4
2015-09-28T17:55:50.000Z
2021-02-11T11:01:11.000Z
src/main/java/no/digipost/stream/EmptyResultIfEmptySourceCollector.java
digipost/d
e1570640e6e6fbe82e6facd54d46907f830165ca
[ "Apache-2.0" ]
6
2016-05-25T11:48:44.000Z
2021-01-26T10:45:49.000Z
src/main/java/no/digipost/stream/EmptyResultIfEmptySourceCollector.java
digipost/d
e1570640e6e6fbe82e6facd54d46907f830165ca
[ "Apache-2.0" ]
1
2019-11-24T04:27:01.000Z
2019-11-24T04:27:01.000Z
40.956522
120
0.711253
998,050
/* * Copyright (C) Posten Norge AS * * 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 no.digipost.stream; import java.util.Optional; import java.util.stream.Collector; import java.util.stream.Stream; /** * A collector type specific for implementations which produce an {@link Optional} * based on if the source (typically a {@link Stream}, or more apropriately, * a {@link NonEmptyStream}) yields no elements or any element(s). Typically appropriate * for reduction operations which needs at least one element to produce a valid result. * * @param <T> the type of input elements to the reduction operation * @param <R> the type of value contained in the resulting Optional, if not source is empty. */ public interface EmptyResultIfEmptySourceCollector<T, A, R> extends Collector<T, A, Optional<R>> { static <T, A, R> EmptyResultIfEmptySourceCollector<T, A, R> from(Collector<T, A, Optional<R>> collector) { if (collector instanceof EmptyResultIfEmptySourceCollector) { return (EmptyResultIfEmptySourceCollector<T, A, R>) collector; } class Impl extends CollectorDecorator<T, A, Optional<R>> implements EmptyResultIfEmptySourceCollector<T, A, R> { Impl(Collector<T, A, Optional<R>> collector) { super(collector); } } return new Impl(collector); } }
92376acc7896caed80adbb5c0c0642cd54b63b44
3,079
java
Java
functions/imagemagick/src/test/java/functions/ImageMagickTest.java
pakorn186c/java-docs-samples
58f6e0e619da681febedfc11554da32e539e8cc1
[ "Apache-2.0" ]
1,561
2015-06-25T19:06:35.000Z
2022-03-31T19:04:38.000Z
functions/imagemagick/src/test/java/functions/ImageMagickTest.java
pakorn186c/java-docs-samples
58f6e0e619da681febedfc11554da32e539e8cc1
[ "Apache-2.0" ]
3,847
2015-05-07T17:04:22.000Z
2022-03-31T14:38:34.000Z
functions/imagemagick/src/test/java/functions/ImageMagickTest.java
pakorn186c/java-docs-samples
58f6e0e619da681febedfc11554da32e539e8cc1
[ "Apache-2.0" ]
3,118
2015-05-05T16:56:04.000Z
2022-03-31T11:06:09.000Z
32.410526
85
0.741799
998,051
/* * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * 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 functions; import static com.google.common.truth.Truth.assertThat; import com.google.common.testing.TestLogHandler; import functions.eventpojos.GcsEvent; import functions.eventpojos.MockContext; import java.util.List; import java.util.logging.LogRecord; import java.util.logging.Logger; import org.junit.After; import org.junit.BeforeClass; import org.junit.Test; public class ImageMagickTest { // Use a preconfigured (read-only) public bucket as a "source" bucket private static String BUCKET_NAME = "nodejs-docs-samples-tests"; // Move the resulting blurred images to another "destination "bucket // TODO<developer>: specify this value in your test environment private static String BLURRED_BUCKET_NAME = System.getenv("BLURRED_BUCKET_NAME"); // Loggers + handlers for various tested classes // (Must be declared at class-level, or LoggingHandler won't detect log records!) private static final Logger logger = Logger.getLogger(ImageMagick.class.getName()); private static final TestLogHandler LOG_HANDLER = new TestLogHandler(); @BeforeClass public static void setUp() { logger.addHandler(LOG_HANDLER); } @After public void afterTest() { LOG_HANDLER.clear(); } @Test public void functionsImagemagickAnalyze_shouldBlurOffensiveImages() { String imageName = "zombie.jpg"; GcsEvent event = new GcsEvent(); event.setBucket(BUCKET_NAME); event.setName(imageName); new ImageMagick().accept(event, new MockContext()); List<LogRecord> logs = LOG_HANDLER.getStoredLogRecords(); String uploadedMessage = String.format( "Blurred image uploaded to: gs://%s/%s", BLURRED_BUCKET_NAME, imageName); assertThat(logs.get(2).getMessage()).isEqualTo(uploadedMessage); } @Test public void functionsImagemagickAnalyze_shouldHandleSafeImages() { GcsEvent event = new GcsEvent(); event.setBucket(BUCKET_NAME); event.setName("wakeupcat.jpg"); new ImageMagick().accept(event, new MockContext()); assertThat(LOG_HANDLER.getStoredLogRecords().get(1).getMessage()).isEqualTo( "Detected wakeupcat.jpg as OK."); } @Test public void functionsImagemagickAnalyze_shouldHandleMissingImages() { GcsEvent event = new GcsEvent(); event.setBucket(BUCKET_NAME); event.setName("missing.jpg"); new ImageMagick().accept(event, new MockContext()); assertThat(LOG_HANDLER.getStoredLogRecords().get(1).getMessage()).contains( "Error opening file"); } }
92376b2ff5f03fe7bda4c0db9a2ddba0fe74b97b
4,606
java
Java
javar/jdk8-analysis/src/com/sun/xml/internal/ws/api/addressing/NonAnonymousResponseProcessor.java
vitahlin/kennen
b0de36d3b6e766b59291d885a0699b6be59318a7
[ "MIT" ]
12
2018-04-04T12:47:40.000Z
2022-01-02T04:36:38.000Z
openjdk-8u45-b14/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/addressing/NonAnonymousResponseProcessor.java
ams-ts-ikvm-bag/ikvm-src
60009f5bdb4c9db68121f393b8b4c790a326bd32
[ "Zlib" ]
2
2020-07-19T08:29:50.000Z
2020-07-21T01:20:56.000Z
openjdk-8u45-b14/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/addressing/NonAnonymousResponseProcessor.java
ams-ts-ikvm-bag/ikvm-src
60009f5bdb4c9db68121f393b8b4c790a326bd32
[ "Zlib" ]
1
2021-12-10T07:51:50.000Z
2021-12-10T07:51:50.000Z
43.866667
105
0.665219
998,052
/* * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.sun.xml.internal.ws.api.addressing; import com.sun.istack.internal.NotNull; import com.sun.xml.internal.ws.api.WSBinding; import com.sun.xml.internal.ws.api.WSService; import com.sun.xml.internal.ws.api.message.Packet; import com.sun.xml.internal.ws.api.pipe.ClientTubeAssemblerContext; import com.sun.xml.internal.ws.api.pipe.Fiber; import com.sun.xml.internal.ws.api.pipe.TransportTubeFactory; import com.sun.xml.internal.ws.api.pipe.Tube; import com.sun.xml.internal.ws.api.server.WSEndpoint; import com.sun.xml.internal.ws.binding.BindingImpl; /** * Delivers response messages targeted at non-anonymous endpoint addresses * @since 2.2.6 */ public class NonAnonymousResponseProcessor { private static final NonAnonymousResponseProcessor DEFAULT = new NonAnonymousResponseProcessor(); public static NonAnonymousResponseProcessor getDefault() { return DEFAULT; } protected NonAnonymousResponseProcessor() {} /** * Send a response to a non-anonymous address. Also closes the transport back channel * of {@link Packet} if it's not closed already. * * @param packet * The response from our server, which will be delivered to the destination. * @return The response packet that should be used to complete the tubeline response processing */ public Packet process(Packet packet) { Fiber.CompletionCallback fiberCallback = null; Fiber currentFiber = Fiber.getCurrentIfSet(); if (currentFiber != null) { // Link completion of the current fiber to the new fiber that will // deliver the async response. This allows access to the response // packet that may be generated by sending a new message for the // current async response. final Fiber.CompletionCallback currentFiberCallback = currentFiber.getCompletionCallback(); if (currentFiberCallback != null) { fiberCallback = new Fiber.CompletionCallback() { public void onCompletion(@NotNull Packet response) { currentFiberCallback.onCompletion(response); } public void onCompletion(@NotNull Throwable error) { currentFiberCallback.onCompletion(error); } }; currentFiber.setCompletionCallback(null); } } // we need to assemble a pipeline to talk to this endpoint. WSEndpoint<?> endpoint = packet.endpoint; WSBinding binding = endpoint.getBinding(); Tube transport = TransportTubeFactory.create(Thread.currentThread().getContextClassLoader(), new ClientTubeAssemblerContext( packet.endpointAddress, endpoint.getPort(), (WSService) null, binding, endpoint.getContainer(), ((BindingImpl) binding).createCodec(), null, null)); Fiber fiber = endpoint.getEngine().createFiber(); fiber.start(transport, packet, fiberCallback); // then we'll proceed the rest like one-way. Packet copy = packet.copy(false); copy.endpointAddress = null; return copy; } }
92376cab827b070ffc590926832ebad0ac48b350
813
java
Java
sfm-datastax/src/main/java/org/simpleflatmapper/beans/Address.java
skjolber/mapping-benchmark
04ceb8f5190130a456ac57f718fb40983e3958fa
[ "MIT" ]
8
2017-01-29T18:30:34.000Z
2020-12-23T16:12:55.000Z
sfm-datastax/src/main/java/org/simpleflatmapper/beans/Address.java
skjolber/mapping-benchmark
04ceb8f5190130a456ac57f718fb40983e3958fa
[ "MIT" ]
18
2015-10-17T18:11:57.000Z
2022-02-26T00:43:57.000Z
sfm-datastax/src/main/java/org/simpleflatmapper/beans/Address.java
skjolber/mapping-benchmark
04ceb8f5190130a456ac57f718fb40983e3958fa
[ "MIT" ]
3
2017-02-20T06:52:13.000Z
2019-03-16T22:58:40.000Z
19.829268
54
0.639606
998,053
package org.simpleflatmapper.beans; public class Address { private String addressLine1; private String addressLine2; private int postcode; private String city; public String getAddressLine1() { return addressLine1; } public void setAddressLine1(String addressLine1) { this.addressLine1 = addressLine1; } public String getAddressLine2() { return addressLine2; } public void setAddressLine2(String addressLine2) { this.addressLine2 = addressLine2; } public int getPostcode() { return postcode; } public void setPostcode(int postcode) { this.postcode = postcode; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } }
92376cb92bb92a15ef09bd7f240e8482368d2cbc
1,497
java
Java
elasticjob-lite/elasticjob-lite-spring/elasticjob-lite-spring-namespace/src/test/java/org/apache/shardingsphere/elasticjob/lite/spring/namespace/snapshot/SnapshotSpringNamespaceEnableTest.java
1181888200/shardingsphere-elasticjob
601a730611c18b7916f61b853c8a456f5b0c0846
[ "Apache-2.0" ]
2,980
2017-12-19T06:24:41.000Z
2020-06-03T15:25:47.000Z
elasticjob-lite/elasticjob-lite-spring/elasticjob-lite-spring-namespace/src/test/java/org/apache/shardingsphere/elasticjob/lite/spring/namespace/snapshot/SnapshotSpringNamespaceEnableTest.java
1181888200/shardingsphere-elasticjob
601a730611c18b7916f61b853c8a456f5b0c0846
[ "Apache-2.0" ]
684
2020-07-15T01:25:00.000Z
2022-03-29T05:52:31.000Z
elasticjob-lite/elasticjob-lite-spring/elasticjob-lite-spring-namespace/src/test/java/org/apache/shardingsphere/elasticjob/lite/spring/namespace/snapshot/SnapshotSpringNamespaceEnableTest.java
1181888200/shardingsphere-elasticjob
601a730611c18b7916f61b853c8a456f5b0c0846
[ "Apache-2.0" ]
1,217
2017-12-19T06:46:22.000Z
2020-06-03T01:54:08.000Z
41.583333
113
0.787575
998,054
/* * 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.shardingsphere.elasticjob.lite.spring.namespace.snapshot; import org.apache.shardingsphere.elasticjob.lite.spring.namespace.test.AbstractZookeeperJUnit4SpringContextTests; import org.junit.Test; import org.springframework.test.context.ContextConfiguration; import java.io.IOException; import static org.junit.Assert.assertNull; @ContextConfiguration(locations = "classpath:META-INF/snapshot/snapshotEnabled.xml") public final class SnapshotSpringNamespaceEnableTest extends AbstractZookeeperJUnit4SpringContextTests { @Test public void assertSnapshotEnable() throws IOException { assertNull(SocketUtils.sendCommand("unknown_command", 9988)); } }
92376dcbec7094c0fec49d38c7dccb3e39853c2d
365
java
Java
Working_Solution/backend/spring-web-service-consumer/src/main/java/com/spring/app/rest/configs/ServiceConfig.java
marest94/example
89659fa80ed57d7ff1278819a199f8e8a5f06b11
[ "MIT" ]
null
null
null
Working_Solution/backend/spring-web-service-consumer/src/main/java/com/spring/app/rest/configs/ServiceConfig.java
marest94/example
89659fa80ed57d7ff1278819a199f8e8a5f06b11
[ "MIT" ]
null
null
null
Working_Solution/backend/spring-web-service-consumer/src/main/java/com/spring/app/rest/configs/ServiceConfig.java
marest94/example
89659fa80ed57d7ff1278819a199f8e8a5f06b11
[ "MIT" ]
null
null
null
26.071429
106
0.813699
998,055
package com.spring.app.rest.configs; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; /*Configuration for scanning services package*/ @Configuration @ComponentScan(basePackages = {"com.spring.app.rest.services", "com.spring.app.rest.services.interfaces"}) public class ServiceConfig { }
92376ed2ad4cc3201092dea7de0c1c9f48ac66f9
1,977
java
Java
smart-energy-system/src/main/java/com/github/smartenergysystem/simulation/Consumer.java
smart-energy-system/Implementation
e8af48d75a30eecb23ead4f0a9cfcb77f63b5d32
[ "MIT" ]
null
null
null
smart-energy-system/src/main/java/com/github/smartenergysystem/simulation/Consumer.java
smart-energy-system/Implementation
e8af48d75a30eecb23ead4f0a9cfcb77f63b5d32
[ "MIT" ]
1
2018-12-14T09:08:57.000Z
2018-12-14T09:08:57.000Z
smart-energy-system/src/main/java/com/github/smartenergysystem/simulation/Consumer.java
smart-energy-system/Implementation
e8af48d75a30eecb23ead4f0a9cfcb77f63b5d32
[ "MIT" ]
null
null
null
27.082192
129
0.791098
998,056
package com.github.smartenergysystem.simulation; import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.annotations.ApiModelProperty; public class Consumer extends Entity { private double[] hourlyBaseDemandPerSquareMeter; @ApiModelProperty(required = true, example = "1000") private double floorAreaSize; @ApiModelProperty(required = true, example = "1") private double averageDailyOccupancy; @ApiModelProperty(required = true, example = "0.3") private double demandFlexibility; public Consumer() {}; public Consumer(double floorAreaSize, double averageDailyOccupancy) { super(); this.floorAreaSize = floorAreaSize; this.averageDailyOccupancy = averageDailyOccupancy; } public double getDemandFlexibility() { return demandFlexibility; } public void setDemandFlexibility(double demandFlexibility) { this.demandFlexibility = demandFlexibility; } public double getFloorAreaSize() { return floorAreaSize; } public void setFloorAreaSize(double floorAreaSize) { this.floorAreaSize = floorAreaSize; } public double getAverageDailyOccupancy() { return averageDailyOccupancy; } public void setAverageDailyOccupancy(double averageDailyOccupancy) { this.averageDailyOccupancy = averageDailyOccupancy; } @JsonIgnore @ApiModelProperty(hidden = true) public double[] getHourlyBaseDemandPerSquareMeter() { return hourlyBaseDemandPerSquareMeter; } public double getBaseDemandPerSquareMeterForHour(int hourOfTheDay) { return hourlyBaseDemandPerSquareMeter[hourOfTheDay]; } public void setHourlyBaseDemandPerSquareMeter(double[] hourlyBaseDemandPerSquareMeter) { this.hourlyBaseDemandPerSquareMeter = hourlyBaseDemandPerSquareMeter; } /** * Solves A2.11 * @param hourOfTheDay * @return the demand in W */ public double calculateDemand(int hourOfTheDay) { return this.getBaseDemandPerSquareMeterForHour(hourOfTheDay)* this.getFloorAreaSize() * this.getAverageDailyOccupancy() * 1000; } }
92376f4e5b0f5724135c90e5035398cef539a6e4
2,702
java
Java
Binding/apple/src/main/java/com/bugvm/apple/uikit/NSUnderlineStyle.java
bugvm/robovm
430cbeb4a9f49f48b982821b40741fad110efe57
[ "MIT" ]
29
2018-06-04T21:34:00.000Z
2022-02-21T16:34:44.000Z
Binding/apple/src/main/java/com/bugvm/apple/uikit/NSUnderlineStyle.java
bugvm/robovm
430cbeb4a9f49f48b982821b40741fad110efe57
[ "MIT" ]
15
2018-03-02T03:38:56.000Z
2021-03-22T02:06:14.000Z
Binding/apple/src/main/java/com/bugvm/apple/uikit/NSUnderlineStyle.java
bugvm/robovm
430cbeb4a9f49f48b982821b40741fad110efe57
[ "MIT" ]
6
2018-10-17T02:28:28.000Z
2020-11-27T04:47:50.000Z
28.391753
91
0.62963
998,057
/* * Copyright (C) 2013-2015 RoboVM AB * * 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.bugvm.apple.uikit; /*<imports>*/ import java.io.*; import java.nio.*; import java.util.*; import com.bugvm.objc.*; import com.bugvm.objc.annotation.*; import com.bugvm.objc.block.*; import com.bugvm.rt.*; import com.bugvm.rt.annotation.*; import com.bugvm.rt.bro.*; import com.bugvm.rt.bro.annotation.*; import com.bugvm.rt.bro.ptr.*; import com.bugvm.apple.foundation.*; import com.bugvm.apple.coreanimation.*; import com.bugvm.apple.coregraphics.*; import com.bugvm.apple.coredata.*; import com.bugvm.apple.coreimage.*; import com.bugvm.apple.coretext.*; import com.bugvm.apple.corelocation.*; /*</imports>*/ /*<javadoc>*/ /** * @since Available in iOS 6.0 and later. */ /*</javadoc>*/ /*<kenaa@example.com)/*</annotations>*/ public enum /*<name>*/NSUnderlineStyle/*</name>*/ implements ValuedEnum { /*<values>*/ StyleNone(0L), StyleSingle(1L), /** * @since Available in iOS 7.0 and later. */ StyleThick(2L), /** * @since Available in iOS 7.0 and later. */ StyleDouble(9L), /** * @since Available in iOS 7.0 and later. */ PatternSolid(0L), /** * @since Available in iOS 7.0 and later. */ PatternDot(256L), /** * @since Available in iOS 7.0 and later. */ PatternDash(512L), /** * @since Available in iOS 7.0 and later. */ PatternDashDot(768L), /** * @since Available in iOS 7.0 and later. */ PatternDashDotDot(1024L), /** * @since Available in iOS 7.0 and later. */ ByWord(32768L); /*</values>*/ private final long n; private /*<name>*/NSUnderlineStyle/*</name>*/(long n) { this.n = n; } public long value() { return n; } public static /*<name>*/NSUnderlineStyle/*</name>*/ valueOf(long n) { for (/*<name>*/NSUnderlineStyle/*</name>*/ v : values()) { if (v.n == n) { return v; } } throw new IllegalArgumentException("No constant with value " + n + " found in " + /*<name>*/NSUnderlineStyle/*</name>*/.class.getName()); } }