blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
956611db5734ef9fc6885166e384b491179f1596
39,668,317,955,820
4676c6934d3d0e661b238913e484987dd59c526e
/src/main/java/edu/uark/registerapp/commands/activeUsers/ActiveUserDeleteCommand.java
02e82a3fc743928452ec3fccf0acda113b9f6f33
[]
no_license
csce3513ProjectGroup/RegisterApp-Java
https://github.com/csce3513ProjectGroup/RegisterApp-Java
dfbf1bb0c0f290ecbf5b1484671bfea54beb26cc
b2a485d3bb8c6599c176d5b521f4d39815444b0e
refs/heads/master
2023-03-30T09:05:17.836000
2021-04-06T22:44:19
2021-04-06T22:44:19
331,409,725
0
1
null
true
2021-03-30T22:07:23
2021-01-20T19:27:53
2021-03-16T22:31:24
2021-03-30T22:07:22
413
0
1
0
Java
false
false
package edu.uark.registerapp.commands.activeUsers; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import edu.uark.registerapp.commands.VoidCommandInterface; import edu.uark.registerapp.models.entities.ActiveUserEntity; import edu.uark.registerapp.models.repositories.ActiveUserRepository; import edu.uark.registerapp.commands.exceptions.NotFoundException; @Service public class ActiveUserDeleteCommand implements VoidCommandInterface { @Transactional @Override public void execute() { //Validate the incoming Employee request object // First and Last Name should not be blank -- why?? // if (StringUtils.isBlank(this.employeeSignIn.getEmployeeId())) { // throw new UnprocessableEntityException("employee ID"); // } // Query the activeuser table for a record with the provided session key // use the existing ActiveUserRepository.findBySessionKey() method // based on ProductDetailCommand.java final Optional<ActiveUserEntity> activeUserRecord = this.activeUserRepository.findBySessionKey(this.sessionKey); // Make sure record exists in database if (!activeUserRecord.isPresent()) { throw new NotFoundException("User"); } else { // Delete the activeuser record // use the existing ActiveUserRepository.delete() method this.activeUserRepository.delete(activeUserRecord.get()); } // if (activeUserEntity.isPresent()) { // this.activeUserRepository.delete(activeUserEntity.get()); // } } // Properties: Current sessionKey // based on ActiveUserEntity.java and ValidateActiveUserCommand.java private String sessionKey; public String getSessionKey() { return this.sessionKey; } public ActiveUserDeleteCommand setSessionKey(final String sessionKey) { this.sessionKey = sessionKey; return this; } // Create Instance of Repository Class (to use in method) @Autowired private ActiveUserRepository activeUserRepository; }
UTF-8
Java
2,247
java
ActiveUserDeleteCommand.java
Java
[]
null
[]
package edu.uark.registerapp.commands.activeUsers; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import edu.uark.registerapp.commands.VoidCommandInterface; import edu.uark.registerapp.models.entities.ActiveUserEntity; import edu.uark.registerapp.models.repositories.ActiveUserRepository; import edu.uark.registerapp.commands.exceptions.NotFoundException; @Service public class ActiveUserDeleteCommand implements VoidCommandInterface { @Transactional @Override public void execute() { //Validate the incoming Employee request object // First and Last Name should not be blank -- why?? // if (StringUtils.isBlank(this.employeeSignIn.getEmployeeId())) { // throw new UnprocessableEntityException("employee ID"); // } // Query the activeuser table for a record with the provided session key // use the existing ActiveUserRepository.findBySessionKey() method // based on ProductDetailCommand.java final Optional<ActiveUserEntity> activeUserRecord = this.activeUserRepository.findBySessionKey(this.sessionKey); // Make sure record exists in database if (!activeUserRecord.isPresent()) { throw new NotFoundException("User"); } else { // Delete the activeuser record // use the existing ActiveUserRepository.delete() method this.activeUserRepository.delete(activeUserRecord.get()); } // if (activeUserEntity.isPresent()) { // this.activeUserRepository.delete(activeUserEntity.get()); // } } // Properties: Current sessionKey // based on ActiveUserEntity.java and ValidateActiveUserCommand.java private String sessionKey; public String getSessionKey() { return this.sessionKey; } public ActiveUserDeleteCommand setSessionKey(final String sessionKey) { this.sessionKey = sessionKey; return this; } // Create Instance of Repository Class (to use in method) @Autowired private ActiveUserRepository activeUserRepository; }
2,247
0.716066
0.716066
63
34.666668
27.433615
80
false
false
0
0
0
0
0
0
0.539683
false
false
9
3bcba9ad9e04b365b535fb76a29679e35b3494b4
39,316,130,668,799
10ed10190a8cff6b96c3a2c3d191436ea3bf2985
/app/src/main/java/com/example/orders/services/APIServiceAddProductType.java
e6741e603f5399e95d697139f9b87f20f4fb880f
[]
no_license
Gevorg03/Orders
https://github.com/Gevorg03/Orders
361652fda1c2e7c2e909dd45e78f9a081f8a8a96
fede5a4c30b11e7330c2775fb21ee32f7cee8879
refs/heads/master
2023-06-12T07:36:40.565000
2021-07-09T11:20:36
2021-07-09T11:20:36
384,413,857
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.orders.services; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.POST; public interface APIServiceAddProductType { @POST("/addProductsType.php/") @FormUrlEncoded Call<ResponseBody> savePost(@Field("description") String description, @Field("img") String img, @Field("img_update") String img_update); }
UTF-8
Java
492
java
APIServiceAddProductType.java
Java
[]
null
[]
package com.example.orders.services; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.POST; public interface APIServiceAddProductType { @POST("/addProductsType.php/") @FormUrlEncoded Call<ResponseBody> savePost(@Field("description") String description, @Field("img") String img, @Field("img_update") String img_update); }
492
0.676829
0.666667
15
31.799999
22.220711
73
false
false
0
0
0
0
0
0
0.6
false
false
9
09880770fd2dc69eea48af7df08ade8cbf5ad1b1
36,515,811,992,832
027f4b41f0df9623d421889cd1506ae098e1b8ad
/android/mapwize-ui/src/main/java/io/mapwize/mapwizeui/BaseUIView.java
0ca5c5278f034ba80c56fb9b974a22bd089be979
[]
no_license
Prasanthi99/mapwize_navigation
https://github.com/Prasanthi99/mapwize_navigation
baebcce9edacf6aa085a82251ee8775e56647be6
2613048b9341addcc126cd2aefe9cf63472aa046
refs/heads/master
2022-11-15T03:59:28.255000
2020-07-14T08:51:00
2020-07-14T08:51:00
279,532,851
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.mapwize.mapwizeui; import java.util.List; import io.mapwize.mapwizesdk.api.Direction; import io.mapwize.mapwizesdk.api.DirectionMode; import io.mapwize.mapwizesdk.api.DirectionPoint; import io.mapwize.mapwizesdk.api.Floor; import io.mapwize.mapwizesdk.api.MapwizeObject; import io.mapwize.mapwizesdk.api.Place; import io.mapwize.mapwizesdk.api.Placelist; import io.mapwize.mapwizesdk.api.Universe; import io.mapwize.mapwizesdk.api.Venue; import io.mapwize.mapwizesdk.map.FollowUserMode; import io.mapwize.mapwizesdk.map.MapwizeMap; import io.mapwize.mapwizesdk.map.NavigationInfo; import io.mapwize.mapwizesdk.map.PlacePreview; interface BaseUIView { void showSearchBar(); void hideSearchBar(); void showDirectionSearchBar(); void hideDirectionSearchBar(); void showOutOfVenueTitle(); void showVenueTitle(String title); void showVenueTitleLoading(String title); void showDirectionButton(); void hideDirectionButton(); void showLanguagesSelector(List<String> languages); void hideLanguagesSelector(); void showUniversesSelector(List<Universe> universes); void hideUniversesSelector(); void showPlacePreviewInfo(PlacePreview preview, String language); void showPlaceInfoFromPreview(Place place, String language); void showPlaceInfo(Place place, String language); void showPlacelistInfo(Placelist placelist, String language); void hideInfo(); void showSearchLoading(); void hideSearchLoading(); void showVenueLoading(); void hideVenueLoading(); void showSearch(); void hideSearch(); void showAccessibleFloors(List<Floor> floors); void showLoadingFloor(Floor floor); void showActiveFloor(Floor floor); void showSearchResultsList(); void hideSearchResultsList(); void showCurrentLocationInResult(); void hideCurrentLocationInResult(); void showSearchResults(List<? extends MapwizeObject> results); void showSearchResults(List<? extends MapwizeObject> results, List<Universe> universes, Universe universe); void showSearchDirectionFrom(); void showSearchDirectionTo(); void showSelectedDirectionFrom(DirectionPoint from, String language); void showSelectedDirectionTo(DirectionPoint to, String language); void showAccessibleDirectionModes(List<DirectionMode> modes); void showSelectedDirectionMode(DirectionMode mode); void showSwapButton(); void hideSwapButton(); void showDirectionLoading(); void showDirectionInfo(Direction direction); void showNavigationInfo(NavigationInfo navigationInfo); void showSearchDirectionLoading(); void hideSearchDirectionLoading(); void showErrorMessage(String message); void showFollowUserMode(FollowUserMode mode); void showDirectionError(); void refreshSearchData(); void dispatchFollowUserModeWithoutLocation(); void dispatchInformationButtonClick(MapwizeObject object); void dispatchMapwizeReady(MapwizeMap mapwizeMap); }
UTF-8
Java
2,983
java
BaseUIView.java
Java
[]
null
[]
package io.mapwize.mapwizeui; import java.util.List; import io.mapwize.mapwizesdk.api.Direction; import io.mapwize.mapwizesdk.api.DirectionMode; import io.mapwize.mapwizesdk.api.DirectionPoint; import io.mapwize.mapwizesdk.api.Floor; import io.mapwize.mapwizesdk.api.MapwizeObject; import io.mapwize.mapwizesdk.api.Place; import io.mapwize.mapwizesdk.api.Placelist; import io.mapwize.mapwizesdk.api.Universe; import io.mapwize.mapwizesdk.api.Venue; import io.mapwize.mapwizesdk.map.FollowUserMode; import io.mapwize.mapwizesdk.map.MapwizeMap; import io.mapwize.mapwizesdk.map.NavigationInfo; import io.mapwize.mapwizesdk.map.PlacePreview; interface BaseUIView { void showSearchBar(); void hideSearchBar(); void showDirectionSearchBar(); void hideDirectionSearchBar(); void showOutOfVenueTitle(); void showVenueTitle(String title); void showVenueTitleLoading(String title); void showDirectionButton(); void hideDirectionButton(); void showLanguagesSelector(List<String> languages); void hideLanguagesSelector(); void showUniversesSelector(List<Universe> universes); void hideUniversesSelector(); void showPlacePreviewInfo(PlacePreview preview, String language); void showPlaceInfoFromPreview(Place place, String language); void showPlaceInfo(Place place, String language); void showPlacelistInfo(Placelist placelist, String language); void hideInfo(); void showSearchLoading(); void hideSearchLoading(); void showVenueLoading(); void hideVenueLoading(); void showSearch(); void hideSearch(); void showAccessibleFloors(List<Floor> floors); void showLoadingFloor(Floor floor); void showActiveFloor(Floor floor); void showSearchResultsList(); void hideSearchResultsList(); void showCurrentLocationInResult(); void hideCurrentLocationInResult(); void showSearchResults(List<? extends MapwizeObject> results); void showSearchResults(List<? extends MapwizeObject> results, List<Universe> universes, Universe universe); void showSearchDirectionFrom(); void showSearchDirectionTo(); void showSelectedDirectionFrom(DirectionPoint from, String language); void showSelectedDirectionTo(DirectionPoint to, String language); void showAccessibleDirectionModes(List<DirectionMode> modes); void showSelectedDirectionMode(DirectionMode mode); void showSwapButton(); void hideSwapButton(); void showDirectionLoading(); void showDirectionInfo(Direction direction); void showNavigationInfo(NavigationInfo navigationInfo); void showSearchDirectionLoading(); void hideSearchDirectionLoading(); void showErrorMessage(String message); void showFollowUserMode(FollowUserMode mode); void showDirectionError(); void refreshSearchData(); void dispatchFollowUserModeWithoutLocation(); void dispatchInformationButtonClick(MapwizeObject object); void dispatchMapwizeReady(MapwizeMap mapwizeMap); }
2,983
0.779752
0.779752
76
38.25
19.168316
111
false
false
0
0
0
0
0
0
1
false
false
9
58dd6a2d40a74cd8a9aa978ab612ab058eaefa3c
6,253,472,445,574
1f0cb0b6f4c74ff706254baf5b028bc9417615f9
/spring-plugins/spring-plugins-modules/spring-plugins-payment/src/main/java/org/example/spring/plugins/payment/PaymentConfiguration.java
c3ef9c4cb1a114bf9996d29d802ec71be70dc1a0
[]
no_license
yuan50697105/spring-build-project-1
https://github.com/yuan50697105/spring-build-project-1
af448da5e3676a99c22aaaca6de4fb9e8ea55811
967fc586637146d8ab3f80bd518ed50bf70dae90
refs/heads/master
2022-07-22T13:45:00.442000
2021-06-03T02:53:19
2021-06-03T02:53:19
359,333,990
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.example.spring.plugins.payment; import com.ijpay.alipay.AliPayApiConfig; import com.ijpay.alipay.AliPayApiConfigKit; import lombok.SneakyThrows; import org.example.spring.plugins.payment.properties.AlipayProperties; import org.example.spring.plugins.payment.service.alipay.AlipayService; import org.example.spring.plugins.payment.service.alipay.impl.AlipayServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration @EnableConfigurationProperties(AlipayProperties.class) @ComponentScan public class PaymentConfiguration { @Autowired private AlipayProperties alipayProperties; @SneakyThrows @Bean @ConditionalOnSingleCandidate @ConditionalOnProperty(prefix = AlipayProperties.PAYMENT_ALIPAY, name = "enabled", havingValue = "true") public AliPayApiConfig aliPayApiConfig() { AliPayApiConfig aliPayApiConfig; try { aliPayApiConfig = AliPayApiConfigKit.getApiConfig(alipayProperties.getAppId()); } catch (Exception e) { aliPayApiConfig = AliPayApiConfig.builder() .setAppId(alipayProperties.getAppId()) .setAliPayPublicKey(alipayProperties.getPublicKey()) .setAppCertPath(alipayProperties.getAppCertPath()) .setAliPayCertPath(alipayProperties.getAliPayCertPath()) .setAliPayRootCertPath(alipayProperties.getAliPayRootCertPath()) .setCharset("UTF-8") .setPrivateKey(alipayProperties.getPrivateKey()) .setServiceUrl(alipayProperties.getServerUrl()) .setSignType("RSA2") // 普通公钥方式 //.build(); // 证书模式 .buildByCert(); } return aliPayApiConfig; } @Bean @ConditionalOnSingleCandidate @ConditionalOnProperty(prefix = AlipayProperties.PAYMENT_ALIPAY, name = "enabled", havingValue = "true") public AlipayService alipayService(AliPayApiConfig aliPayApiConfig) { return new AlipayServiceImpl(alipayProperties, aliPayApiConfig); } }
UTF-8
Java
2,591
java
PaymentConfiguration.java
Java
[]
null
[]
package org.example.spring.plugins.payment; import com.ijpay.alipay.AliPayApiConfig; import com.ijpay.alipay.AliPayApiConfigKit; import lombok.SneakyThrows; import org.example.spring.plugins.payment.properties.AlipayProperties; import org.example.spring.plugins.payment.service.alipay.AlipayService; import org.example.spring.plugins.payment.service.alipay.impl.AlipayServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration @EnableConfigurationProperties(AlipayProperties.class) @ComponentScan public class PaymentConfiguration { @Autowired private AlipayProperties alipayProperties; @SneakyThrows @Bean @ConditionalOnSingleCandidate @ConditionalOnProperty(prefix = AlipayProperties.PAYMENT_ALIPAY, name = "enabled", havingValue = "true") public AliPayApiConfig aliPayApiConfig() { AliPayApiConfig aliPayApiConfig; try { aliPayApiConfig = AliPayApiConfigKit.getApiConfig(alipayProperties.getAppId()); } catch (Exception e) { aliPayApiConfig = AliPayApiConfig.builder() .setAppId(alipayProperties.getAppId()) .setAliPayPublicKey(alipayProperties.getPublicKey()) .setAppCertPath(alipayProperties.getAppCertPath()) .setAliPayCertPath(alipayProperties.getAliPayCertPath()) .setAliPayRootCertPath(alipayProperties.getAliPayRootCertPath()) .setCharset("UTF-8") .setPrivateKey(alipayProperties.getPrivateKey()) .setServiceUrl(alipayProperties.getServerUrl()) .setSignType("RSA2") // 普通公钥方式 //.build(); // 证书模式 .buildByCert(); } return aliPayApiConfig; } @Bean @ConditionalOnSingleCandidate @ConditionalOnProperty(prefix = AlipayProperties.PAYMENT_ALIPAY, name = "enabled", havingValue = "true") public AlipayService alipayService(AliPayApiConfig aliPayApiConfig) { return new AlipayServiceImpl(alipayProperties, aliPayApiConfig); } }
2,591
0.720342
0.719564
58
43.344826
29.309027
108
false
false
0
0
0
0
0
0
0.448276
false
false
9
2e0cf971b0417d16319ac4243e0d523aab9cc500
20,280,835,627,482
cbd0cfdb4ff5a0c34d19c5a8588e838881a36766
/easyboot-admin/src/main/java/com/zf/easyboot/modules/test/service/IPeRuleService.java
60ca367d714f8c939671330cc4a366068e1d2992
[]
no_license
xiaomin0322/my-easyboot
https://github.com/xiaomin0322/my-easyboot
c5ac19c0c226eadf58e5585b484e1332f2dd9c8b
d829166b041cad64c63a73a161f93679505f8a86
refs/heads/master
2020-09-14T13:20:58.103000
2019-11-22T07:28:59
2019-11-22T07:28:59
223,138,996
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zf.easyboot.modules.test.service; import com.zf.easyboot.modules.test.entity.PeRule; import com.baomidou.mybatisplus.extension.service.IService; /** * <p> * 促销规则表 服务类 * </p> * * @author Cenyol * @since 2019-11-18 */ public interface IPeRuleService extends IService<PeRule> { }
UTF-8
Java
315
java
IPeRuleService.java
Java
[ { "context": "ce;\n\n/**\n * <p>\n * 促销规则表 服务类\n * </p>\n *\n * @author Cenyol\n * @since 2019-11-18\n */\npublic interface IPeRule", "end": 211, "score": 0.9995638728141785, "start": 205, "tag": "USERNAME", "value": "Cenyol" } ]
null
[]
package com.zf.easyboot.modules.test.service; import com.zf.easyboot.modules.test.entity.PeRule; import com.baomidou.mybatisplus.extension.service.IService; /** * <p> * 促销规则表 服务类 * </p> * * @author Cenyol * @since 2019-11-18 */ public interface IPeRuleService extends IService<PeRule> { }
315
0.725753
0.698997
16
17.6875
21.367964
59
false
false
0
0
0
0
0
0
0.1875
false
false
9
3ab1cb38dc812d67bbe14c9a24ed1d7502bd05bd
3,513,283,315,936
a26f32af914a094acdea1aa6141d2dda20cc7cc5
/gsd-pe/test/dk/itu/policyengine/policies/PolicyLightning.java
ba4514e90acaeb8193b3f551b9da32d2b37ecc50
[]
no_license
tkok/GSD-code
https://github.com/tkok/GSD-code
5e7ebc1cd1bd354d3cf6c03d5ce40fa1a50ba15f
0580382a05eff937ae8b49911a3630b1c392cdc9
refs/heads/master
2021-01-01T05:49:55.662000
2013-05-14T12:11:04
2013-05-14T12:11:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dk.itu.policyengine.policies; import java.sql.Time; import org.junit.Test; import dk.itu.policyengine.domain.Expression; import dk.itu.policyengine.domain.FloatValue; import dk.itu.policyengine.domain.IfStatement; import dk.itu.policyengine.domain.Operator; import dk.itu.policyengine.domain.Policy; import dk.itu.policyengine.domain.PolicyEntity; import dk.itu.policyengine.domain.SetStatement; import dk.itu.policyengine.domain.Statement; import dk.itu.policyengine.persistence.DataAccessLayer; public class PolicyLightning { String lightId = "room-2-light-5-gain"; String heaterId = "room-2-heater-2-gain"; long _2100 = 20*60*60*1000; long _0800 = 6*60*60*1000; @Test public void execute() { // If the light is on then turn it off (pretty annoying, but hey!) Expression expressionLightIsOn = new Expression(lightId, Operator.EQUALS, new FloatValue(1f)); Statement turnOffLight = new SetStatement(lightId, new FloatValue(0f)); IfStatement ifLightIsOn = new IfStatement(); ifLightIsOn.addExpression(expressionLightIsOn); ifLightIsOn.addThenStatement(turnOffLight); Policy policy = new Policy(); policy.addStatement(ifLightIsOn); PolicyEntity entity = new PolicyEntity(); entity.setPolicy(policy); entity.getInterval().setFromTime(new Time(_2100)); entity.getInterval().setToTime(new Time(_0800)); entity.setActive(true); entity = DataAccessLayer.persist(entity); } }
UTF-8
Java
1,447
java
PolicyLightning.java
Java
[]
null
[]
package dk.itu.policyengine.policies; import java.sql.Time; import org.junit.Test; import dk.itu.policyengine.domain.Expression; import dk.itu.policyengine.domain.FloatValue; import dk.itu.policyengine.domain.IfStatement; import dk.itu.policyengine.domain.Operator; import dk.itu.policyengine.domain.Policy; import dk.itu.policyengine.domain.PolicyEntity; import dk.itu.policyengine.domain.SetStatement; import dk.itu.policyengine.domain.Statement; import dk.itu.policyengine.persistence.DataAccessLayer; public class PolicyLightning { String lightId = "room-2-light-5-gain"; String heaterId = "room-2-heater-2-gain"; long _2100 = 20*60*60*1000; long _0800 = 6*60*60*1000; @Test public void execute() { // If the light is on then turn it off (pretty annoying, but hey!) Expression expressionLightIsOn = new Expression(lightId, Operator.EQUALS, new FloatValue(1f)); Statement turnOffLight = new SetStatement(lightId, new FloatValue(0f)); IfStatement ifLightIsOn = new IfStatement(); ifLightIsOn.addExpression(expressionLightIsOn); ifLightIsOn.addThenStatement(turnOffLight); Policy policy = new Policy(); policy.addStatement(ifLightIsOn); PolicyEntity entity = new PolicyEntity(); entity.setPolicy(policy); entity.getInterval().setFromTime(new Time(_2100)); entity.getInterval().setToTime(new Time(_0800)); entity.setActive(true); entity = DataAccessLayer.persist(entity); } }
1,447
0.760194
0.731859
49
28.530613
23.322147
96
false
false
0
0
0
0
0
0
1.836735
false
false
9
2cb53ffa4b25205c0df0142e19e5852716cb4b7c
36,679,020,741,706
b091b9ae28094ad473ce6575d6fc390fd187dff3
/JAVABasic/src/pl/edu/pg/eti/ksg/po/lab1/transformacje/ZlozenieTransformacji.java
a904c81e1d5f3c75408578a387441e1a836a291d
[]
no_license
szymon6927/JPO
https://github.com/szymon6927/JPO
25c4fc8c45154d721dce4c62dddc7d4dbd955cf6
5315b95880ff5bd253b510a16e16897be2d94cee
refs/heads/master
2021-09-04T19:45:50.573000
2018-01-15T20:09:27
2018-01-15T20:09:27
108,012,829
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pl.edu.pg.eti.ksg.po.lab1.transformacje; public class ZlozenieTransformacji implements Transformacja { private int ile; private String trans; private Transformacja[] tab = {}; public ZlozenieTransformacji(int count, String rodzaTransformacji) { this.ile = count; this.trans = rodzaTransformacji; if(rodzaTransformacji.equals("Skalowanie")) { this.tab = new Skalowanie[count]; for(int i=0; i<tab.length; i++){ tab[i] = new Skalowanie(i + 1, i + 2); System.out.println(tab[i]); } } else if(rodzaTransformacji.equals("Translacja")) { this.tab = new Translacja[count]; for(int i=0; i<tab.length; i++){ tab[i] = new Translacja(i + 1, i + 2); System.out.println(tab[i]); } } } @Override public Transformacja getTransformacjaOdwrotna() { for (int i = 0; i < tab.length; i++) { try { tab[i].getTransformacjaOdwrotna(); } catch (BrakTransformacjiOdwrotnejException ex) { ex.printStackTrace(); } } return new ZlozenieTransformacji(this.ile, this.trans); } @Override public Punkt transformuj(Punkt p) { int counter = 0; Punkt newPunkt = new Punkt(p.getX(), p.getY()); if(this.trans.equals("Skalowanie")) { for(int i=0; i<tab.length; i++) { System.out.println("Transformacja nr: " + counter); newPunkt = tab[i].transformuj(p); counter++; } return new Punkt(1 / newPunkt.getX(), 1 / newPunkt.getY()); } // jeżeli nie skalowanie to zwórc translacje for(int i=0; i<tab.length; i++){ System.out.println("Transformacja nr: " + counter); newPunkt = tab[i].transformuj(p); counter++; } return new Punkt(p.getX() + newPunkt.getX(), p.getY() + newPunkt.getY()); } @Override public String toString() { return "ZlozenieTransformacji, ilosc wykonanych transformacji: " + this.ile; } }
WINDOWS-1250
Java
1,861
java
ZlozenieTransformacji.java
Java
[]
null
[]
package pl.edu.pg.eti.ksg.po.lab1.transformacje; public class ZlozenieTransformacji implements Transformacja { private int ile; private String trans; private Transformacja[] tab = {}; public ZlozenieTransformacji(int count, String rodzaTransformacji) { this.ile = count; this.trans = rodzaTransformacji; if(rodzaTransformacji.equals("Skalowanie")) { this.tab = new Skalowanie[count]; for(int i=0; i<tab.length; i++){ tab[i] = new Skalowanie(i + 1, i + 2); System.out.println(tab[i]); } } else if(rodzaTransformacji.equals("Translacja")) { this.tab = new Translacja[count]; for(int i=0; i<tab.length; i++){ tab[i] = new Translacja(i + 1, i + 2); System.out.println(tab[i]); } } } @Override public Transformacja getTransformacjaOdwrotna() { for (int i = 0; i < tab.length; i++) { try { tab[i].getTransformacjaOdwrotna(); } catch (BrakTransformacjiOdwrotnejException ex) { ex.printStackTrace(); } } return new ZlozenieTransformacji(this.ile, this.trans); } @Override public Punkt transformuj(Punkt p) { int counter = 0; Punkt newPunkt = new Punkt(p.getX(), p.getY()); if(this.trans.equals("Skalowanie")) { for(int i=0; i<tab.length; i++) { System.out.println("Transformacja nr: " + counter); newPunkt = tab[i].transformuj(p); counter++; } return new Punkt(1 / newPunkt.getX(), 1 / newPunkt.getY()); } // jeżeli nie skalowanie to zwórc translacje for(int i=0; i<tab.length; i++){ System.out.println("Transformacja nr: " + counter); newPunkt = tab[i].transformuj(p); counter++; } return new Punkt(p.getX() + newPunkt.getX(), p.getY() + newPunkt.getY()); } @Override public String toString() { return "ZlozenieTransformacji, ilosc wykonanych transformacji: " + this.ile; } }
1,861
0.641743
0.63475
66
27.166666
21.220047
78
false
false
0
0
0
0
0
0
2.545455
false
false
9
70ee40335cc3b8c4c1756dc46abd88cc2360ea69
36,679,020,743,016
6d210141b3fd1035c5175cf92dd9753491b39701
/Memo/JAVA/intellij/CMS_Q3/src/cms/show/Showable.java
44366d8e4bf202edda71cc96974bc3f8796922fd
[]
no_license
banetta/study
https://github.com/banetta/study
43b9e1657bb4846bdadce8db4f5f1851631319d7
4ae45fbdffa40c52e152b2ff6546d8552a881eb4
refs/heads/master
2020-04-26T08:10:32.667000
2019-09-11T15:23:31
2019-09-11T15:23:31
173,414,891
0
0
null
false
2019-09-11T09:30:51
2019-03-02T06:59:54
2019-09-10T05:30:39
2019-09-11T09:30:51
365,611
0
0
0
Java
false
false
package cms.show; import cms.contact.ContactManager; import cms.group.GroupManager; public class Showable { public void showAll(ContactManager cm) { System.out.println("--------------------------------------------------------------------"); System.out.println("이름 이메일 그룹 주소"); System.out.println("--------------------------------------------------------------------"); cm.getAll(); System.out.println("--------------------------------------------------------------------"); } public void showAll(GroupManager gm){ System.out.println("------------------------------------------------"); System.out.println("Group ID Group 이름"); gm.getAll(); System.out.println("------------------------------------------------"); } }
UTF-8
Java
869
java
Showable.java
Java
[]
null
[]
package cms.show; import cms.contact.ContactManager; import cms.group.GroupManager; public class Showable { public void showAll(ContactManager cm) { System.out.println("--------------------------------------------------------------------"); System.out.println("이름 이메일 그룹 주소"); System.out.println("--------------------------------------------------------------------"); cm.getAll(); System.out.println("--------------------------------------------------------------------"); } public void showAll(GroupManager gm){ System.out.println("------------------------------------------------"); System.out.println("Group ID Group 이름"); gm.getAll(); System.out.println("------------------------------------------------"); } }
869
0.358914
0.358914
22
36.5
34.22353
99
false
false
0
0
0
0
0
0
0.545455
false
false
9
63f8c45d48120456d3fbc872ab8846436827283b
19,963,008,060,344
acdcb714f24f20d4dff5080b174cf00d13825a8b
/src/main/java/com/eventdriven/kafka/enums/Color.java
7ba5eb8ba22746dec08c0e2802bff147e105ed0a
[]
no_license
vinaysarode/apache-kafka-codes
https://github.com/vinaysarode/apache-kafka-codes
9c0796cbfc4f51f9229c07c2884022cd7d1c7af4
1cf65879c5b72305e1b08dee7869b65b732a5c5b
refs/heads/master
2022-12-28T14:18:42.174000
2020-10-11T07:47:57
2020-10-11T07:47:57
302,885,247
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.eventdriven.kafka.enums; public enum Color { BLUE, GREEN, YELLOW }
UTF-8
Java
92
java
Color.java
Java
[]
null
[]
package com.eventdriven.kafka.enums; public enum Color { BLUE, GREEN, YELLOW }
92
0.663043
0.663043
7
12.142858
11.382049
36
false
false
0
0
0
0
0
0
0.428571
false
false
9
6fdce4b87ab45a97d9e28085255d03c18fe1472a
34,995,393,577,379
5c29777f5b760fbe226feb7d2a5f0dfc4c2733f8
/src/main/java/io/symbolik/tests/SuperTest.java
eee958a371a86b95408af995fa661d29e49e237f
[]
no_license
joshuafarrell/smart-brewed-testing
https://github.com/joshuafarrell/smart-brewed-testing
69fba852d9f4b2e5280f3234992d5dff1b9923b7
29e5069c78952e482509ce54d768c8e788ae8786
refs/heads/master
2022-12-22T20:01:58.192000
2019-07-29T17:28:10
2019-07-29T17:28:10
51,617,115
0
0
null
false
2022-12-10T05:40:34
2016-02-12T21:18:43
2019-07-29T17:28:47
2022-12-10T05:40:32
171
0
0
1
Java
false
false
package io.symbolik.tests; import com.saucelabs.common.SauceOnDemandAuthentication; import com.saucelabs.common.SauceOnDemandSessionIdProvider; import com.saucelabs.testng.SauceOnDemandAuthenticationProvider; import io.symbolik.pages.LoginPage; import io.symbolik.pages.MainPage; import io.symbolik.utils.CustomDriver; import io.symbolik.utils.WebDriverManager; import org.openqa.selenium.WebDriver; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.PageFactory; import org.testng.ITestContext; import org.testng.ITestResult; import org.testng.annotations.*; import org.testng.log4testng.Logger; public class SuperTest implements SauceOnDemandSessionIdProvider, SauceOnDemandAuthenticationProvider { public static final SauceOnDemandAuthentication authentication = new SauceOnDemandAuthentication(); private static final Logger LOGGER = Logger.getLogger(SuperTest.class); protected WebDriver driver; protected String name; private ThreadLocal<String> sessionId = new ThreadLocal<String>(); @BeforeSuite public void beforeSuite() { LOGGER.info("Start BeforeSuite"); LOGGER.info("End BeforeSuite"); } @BeforeTest public void beforeTest() { LOGGER.info(" Start BeforeTest"); LOGGER.info(" End BeforeTest"); } @Parameters({"browser", "version", "os", "local"}) @BeforeClass public void beforeClass(@Optional("firefox") String browser, @Optional("1.0") String version, @Optional("Windows") String os, @Optional("true") Boolean local, ITestContext context) { LOGGER.info(" Start BeforeClass"); name = context.getName(); if (local) { LOGGER.info("Creating a local" + browser + " driver."); driver = CustomDriver.createLocalDriver(browser); } else { LOGGER.info("Creating a SauceLabs driver"); driver = CustomDriver.createSLDriver(browser, version, os, name, authentication); } WebDriverManager.setWebDriver(driver); sessionId.set(((RemoteWebDriver) driver).getSessionId().toString()); LOGGER.info(name + " - Thread: " + Thread.currentThread().getId()); LOGGER.info(name + " - Driver: " + driver.hashCode()); driver.manage().window().maximize(); if(!context.getName().equals("Login using invalid credentials")){ LoginPage loginPage = PageFactory.initElements(driver, LoginPage.class); loginPage.open("https://symbolik.com"); loginPage.login("jfarrell", "DeMark12345"); } LOGGER.info(" End BeforeClass"); } @BeforeMethod() public void beforeMethod() { LOGGER.info(" BeforeMethod"); } @AfterMethod() public void afterMethod(ITestResult result) { LOGGER.info(" AfterMethod"); } @AfterClass public void afterClass() { LOGGER.info(" Start AfterClass"); if (driver != null) { LOGGER.info("Attempting to quit driver."); driver.quit(); } LOGGER.info(" End AfterClass"); } @AfterTest public void afterTest() { LOGGER.info(" Start AfterTest"); LOGGER.info(" End AfterTest"); } @AfterSuite public void afterSuite() { LOGGER.info("AfterSuite"); } @Override public SauceOnDemandAuthentication getAuthentication() { return authentication; } @Override public String getSessionId() { return sessionId.get(); } }
UTF-8
Java
3,638
java
SuperTest.java
Java
[ { "context": "s://symbolik.com\");\n\n loginPage.login(\"jfarrell\", \"DeMark12345\");\n }\n\n LOGGER.info(", "end": 2621, "score": 0.9996705651283264, "start": 2613, "tag": "USERNAME", "value": "jfarrell" }, { "context": ".com\");\n\n loginPage.lo...
null
[]
package io.symbolik.tests; import com.saucelabs.common.SauceOnDemandAuthentication; import com.saucelabs.common.SauceOnDemandSessionIdProvider; import com.saucelabs.testng.SauceOnDemandAuthenticationProvider; import io.symbolik.pages.LoginPage; import io.symbolik.pages.MainPage; import io.symbolik.utils.CustomDriver; import io.symbolik.utils.WebDriverManager; import org.openqa.selenium.WebDriver; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.PageFactory; import org.testng.ITestContext; import org.testng.ITestResult; import org.testng.annotations.*; import org.testng.log4testng.Logger; public class SuperTest implements SauceOnDemandSessionIdProvider, SauceOnDemandAuthenticationProvider { public static final SauceOnDemandAuthentication authentication = new SauceOnDemandAuthentication(); private static final Logger LOGGER = Logger.getLogger(SuperTest.class); protected WebDriver driver; protected String name; private ThreadLocal<String> sessionId = new ThreadLocal<String>(); @BeforeSuite public void beforeSuite() { LOGGER.info("Start BeforeSuite"); LOGGER.info("End BeforeSuite"); } @BeforeTest public void beforeTest() { LOGGER.info(" Start BeforeTest"); LOGGER.info(" End BeforeTest"); } @Parameters({"browser", "version", "os", "local"}) @BeforeClass public void beforeClass(@Optional("firefox") String browser, @Optional("1.0") String version, @Optional("Windows") String os, @Optional("true") Boolean local, ITestContext context) { LOGGER.info(" Start BeforeClass"); name = context.getName(); if (local) { LOGGER.info("Creating a local" + browser + " driver."); driver = CustomDriver.createLocalDriver(browser); } else { LOGGER.info("Creating a SauceLabs driver"); driver = CustomDriver.createSLDriver(browser, version, os, name, authentication); } WebDriverManager.setWebDriver(driver); sessionId.set(((RemoteWebDriver) driver).getSessionId().toString()); LOGGER.info(name + " - Thread: " + Thread.currentThread().getId()); LOGGER.info(name + " - Driver: " + driver.hashCode()); driver.manage().window().maximize(); if(!context.getName().equals("Login using invalid credentials")){ LoginPage loginPage = PageFactory.initElements(driver, LoginPage.class); loginPage.open("https://symbolik.com"); loginPage.login("jfarrell", "DeMark12345"); } LOGGER.info(" End BeforeClass"); } @BeforeMethod() public void beforeMethod() { LOGGER.info(" BeforeMethod"); } @AfterMethod() public void afterMethod(ITestResult result) { LOGGER.info(" AfterMethod"); } @AfterClass public void afterClass() { LOGGER.info(" Start AfterClass"); if (driver != null) { LOGGER.info("Attempting to quit driver."); driver.quit(); } LOGGER.info(" End AfterClass"); } @AfterTest public void afterTest() { LOGGER.info(" Start AfterTest"); LOGGER.info(" End AfterTest"); } @AfterSuite public void afterSuite() { LOGGER.info("AfterSuite"); } @Override public SauceOnDemandAuthentication getAuthentication() { return authentication; } @Override public String getSessionId() { return sessionId.get(); } }
3,638
0.646509
0.64431
121
29.074381
26.804207
103
false
false
0
0
0
0
0
0
0.528926
false
false
9
22400aaa0a777d8fb4b0e40dac0daf812c07e508
34,883,724,417,381
0f0eeaa9767b1427e0dba4be8f36c40244c739d8
/build/generated-sources/jax-ws/br/com/projeto/dao/jaxws/SelectUsuarioResponse.java
8f769db50d01613459eb11b0c1d6439315abaa9a
[]
no_license
luisNovaes/WebServices_-JAX-WS
https://github.com/luisNovaes/WebServices_-JAX-WS
98b7e8c122c04569883f3b6f5b6ae8d6ff47d72d
3b09d89478bf33a3d69457f030409e969f04d836
refs/heads/master
2020-03-27T05:13:13.865000
2018-08-28T03:45:47
2018-08-28T03:45:47
146,001,775
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.projeto.dao.jaxws; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import br.com.projeto.modelo.Usuario; @XmlRootElement(name = "selectusuarioResponse", namespace = "http://dao.projeto.com.br/") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "selectusuarioResponse", namespace = "http://dao.projeto.com.br/") public class SelectUsuarioResponse { @XmlElement(name = "return", namespace = "") private Usuario _return; /** * * @return * returns Usuario */ public Usuario getReturn() { return this._return; } /** * * @param _return * the value for the _return property */ public void setReturn(Usuario _return) { this._return = _return; } }
UTF-8
Java
950
java
SelectUsuarioResponse.java
Java
[]
null
[]
package br.com.projeto.dao.jaxws; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import br.com.projeto.modelo.Usuario; @XmlRootElement(name = "selectusuarioResponse", namespace = "http://dao.projeto.com.br/") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "selectusuarioResponse", namespace = "http://dao.projeto.com.br/") public class SelectUsuarioResponse { @XmlElement(name = "return", namespace = "") private Usuario _return; /** * * @return * returns Usuario */ public Usuario getReturn() { return this._return; } /** * * @param _return * the value for the _return property */ public void setReturn(Usuario _return) { this._return = _return; } }
950
0.676842
0.676842
36
25.361111
22.742706
89
false
false
0
0
0
0
0
0
0.361111
false
false
9
fa701bba4244ffe59074f705fe6cc97bd4ae4983
39,281,770,913,455
05a228151ee715c407c8ae0e1154d71ecdd3f8f4
/springDataJpa/src/test/java/br/gov/sp/fatec/MedicoRepositoryTest.java
926c7c06847e40181c30d0506429621660801682
[]
no_license
ZeTheGreat/ExemploSpringDataJPA
https://github.com/ZeTheGreat/ExemploSpringDataJPA
ca735d1d329d6caa1142a84fe3ecf64f484688a5
7a17820858ba3e46582731261fe98fd6e0595a61
refs/heads/master
2020-04-28T04:53:49.728000
2019-03-05T15:28:45
2019-03-05T15:28:45
174,998,769
1
0
null
true
2019-03-11T12:48:23
2019-03-11T12:48:22
2019-03-05T15:28:56
2019-03-05T15:28:55
30
0
0
0
null
false
null
package br.gov.sp.fatec; import static org.junit.Assert.assertTrue; import br.gov.sp.fatec.model.Medico; import br.gov.sp.fatec.repository.MedicoRepository; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; import static org.junit.Assert.*; @RunWith(SpringRunner.class) @SpringBootTest @Transactional @Rollback public class MedicoRepositoryTest { @Autowired private MedicoRepository medicoRepository; public void setUsuarioRepo(MedicoRepository medicoRepository) { this.medicoRepository = medicoRepository; } @Test public void insereMedicoTest() { Medico medico = new Medico(); medico.setNome("Will"); medico.setSobrenome("Halstead"); medico.setEspecialidade("Medico de Sala de Emergência"); medicoRepository.save(medico); assertNotNull(medico.getCrm()); } @Test public void achaMedicoPorId(){ Medico medico = medicoRepository.findMedicoByCrm(1L); assertEquals("Connan", medico.getNome()); } }
UTF-8
Java
1,244
java
MedicoRepositoryTest.java
Java
[ { "context": "\t\tMedico medico = new Medico();\n\t\tmedico.setNome(\"Will\");\n\t\tmedico.setSobrenome(\"Halstead\");\n\t\tmedico.se", "end": 929, "score": 0.9998380541801453, "start": 925, "tag": "NAME", "value": "Will" }, { "context": "\n\t\tmedico.setNome(\"Will\");\n\t\tmedico.s...
null
[]
package br.gov.sp.fatec; import static org.junit.Assert.assertTrue; import br.gov.sp.fatec.model.Medico; import br.gov.sp.fatec.repository.MedicoRepository; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; import static org.junit.Assert.*; @RunWith(SpringRunner.class) @SpringBootTest @Transactional @Rollback public class MedicoRepositoryTest { @Autowired private MedicoRepository medicoRepository; public void setUsuarioRepo(MedicoRepository medicoRepository) { this.medicoRepository = medicoRepository; } @Test public void insereMedicoTest() { Medico medico = new Medico(); medico.setNome("Will"); medico.setSobrenome("Halstead"); medico.setEspecialidade("Medico de Sala de Emergência"); medicoRepository.save(medico); assertNotNull(medico.getCrm()); } @Test public void achaMedicoPorId(){ Medico medico = medicoRepository.findMedicoByCrm(1L); assertEquals("Connan", medico.getNome()); } }
1,244
0.79646
0.794851
48
24.895834
21.690281
64
false
false
0
0
0
0
0
0
1.083333
false
false
9
5716ac6485d78f37b584c3232b35ca05f250d6fd
39,084,202,421,811
d2527b946eb00a6dd901f44902e7b5e42cec1f8f
/core/src/test/java/org/featureflags/TestFlagWriterTest.java
8363f47f9090bcee762f6239907ecdead271cde0
[ "Apache-2.0" ]
permissive
jasalguero/featureflags
https://github.com/jasalguero/featureflags
ca7f7fd0c1841f1df102f8ee86fb6b7e32171987
23f87741ebd85b2b7d8ae832769163b46a15825a
refs/heads/master
2021-01-15T21:30:05.734000
2011-12-01T16:38:49
2011-12-01T16:38:49
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.featureflags; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import org.featureflags.FlagManager.FlagState; import org.junit.Test; public class TestFlagWriterTest extends FeatureFlagTest { @Test public void test00Init() { writeFlagFile(); assertTrue("Flag ONE is up", Flags.ONE.isUp()); } public void testPersist() { String userName= "bob"; String userName2= "foo"; manager.setFlagStateToAndPersist(Flags.ONE, FlagState.DOWN); manager.setFlagStateToAndPersist(Flags.TWO, FlagState.UP); manager.setFlagStateForUserToAndPersist(userName, Flags.ONE.name(), FlagState.UP); manager.setFlagStateForUserToAndPersist(userName2, Flags.THREE.name(), FlagState.DOWN); manager.setFlagStateForUserToAndPersist(userName2, Flags.TWO.name(), FlagState.DOWN); FlagWriter writer = new FlagWriter(manager); writer.persist(); writer = new FlagWriter(manager); writer.read(); assertEquals(false, Flags.ONE.isUp()); assertEquals(true, Flags.TWO.isUp()); manager.setThreadUserName(userName); assertEquals(true, Flags.ONE.isUp()); manager.setThreadUserName(userName2); assertEquals(false, Flags.THREE.isUp()); } private void writeFlagFile() { String userDir = System.getProperty("user.dir"); File file = new File(userDir,"org.featureflags.Flags"); Writer writer = null; try { writer = new BufferedWriter(new FileWriter(file)); writer.write("{TWO=UP, THREE=DOWN, ONE=UP}"); writer.write("\n"); writer.write("{}"); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if(writer != null) { try { writer.close(); } catch (IOException e) { } } } } }
UTF-8
Java
1,949
java
TestFlagWriterTest.java
Java
[ { "context": " public void testPersist() {\n\tString userName= \"bob\";\n\tString userName2= \"foo\";\n\t\n\tmanager.setFlagSta", "end": 588, "score": 0.994276225566864, "start": 585, "tag": "USERNAME", "value": "bob" }, { "context": "() {\n\tString userName= \"bob\";\n\tString use...
null
[]
package org.featureflags; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import org.featureflags.FlagManager.FlagState; import org.junit.Test; public class TestFlagWriterTest extends FeatureFlagTest { @Test public void test00Init() { writeFlagFile(); assertTrue("Flag ONE is up", Flags.ONE.isUp()); } public void testPersist() { String userName= "bob"; String userName2= "foo"; manager.setFlagStateToAndPersist(Flags.ONE, FlagState.DOWN); manager.setFlagStateToAndPersist(Flags.TWO, FlagState.UP); manager.setFlagStateForUserToAndPersist(userName, Flags.ONE.name(), FlagState.UP); manager.setFlagStateForUserToAndPersist(userName2, Flags.THREE.name(), FlagState.DOWN); manager.setFlagStateForUserToAndPersist(userName2, Flags.TWO.name(), FlagState.DOWN); FlagWriter writer = new FlagWriter(manager); writer.persist(); writer = new FlagWriter(manager); writer.read(); assertEquals(false, Flags.ONE.isUp()); assertEquals(true, Flags.TWO.isUp()); manager.setThreadUserName(userName); assertEquals(true, Flags.ONE.isUp()); manager.setThreadUserName(userName2); assertEquals(false, Flags.THREE.isUp()); } private void writeFlagFile() { String userDir = System.getProperty("user.dir"); File file = new File(userDir,"org.featureflags.Flags"); Writer writer = null; try { writer = new BufferedWriter(new FileWriter(file)); writer.write("{TWO=UP, THREE=DOWN, ONE=UP}"); writer.write("\n"); writer.write("{}"); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if(writer != null) { try { writer.close(); } catch (IOException e) { } } } } }
1,949
0.715239
0.71216
74
25.337837
21.462273
88
false
false
0
0
0
0
0
0
1.432432
false
false
9
d8c405e9491042d81ea740e08df91ab8b26f4874
34,153,579,949,318
f2135c50b0fa8e81615d2d7fa386188fd91fe62a
/vocals-core/src/main/java/it/polimi/rsp/vocals/core/annotations/features/Feature.java
0266d46bdddb99a1d923e2db4baa87f3c8221e54
[]
no_license
riccardotommasini/vocals4j
https://github.com/riccardotommasini/vocals4j
bf9b6759b0f74db9d9d395055320d2ee86ed47bb
342562ac22439a7122e56aeeb9658368ef60f0c0
refs/heads/master
2020-03-18T12:02:14.200000
2018-08-28T20:13:21
2018-08-28T20:13:21
134,705,033
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package it.polimi.rsp.vocals.core.annotations.features; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) public @interface Feature { String name(); String ns() default "UNKNOWN"; }
UTF-8
Java
266
java
Feature.java
Java
[]
null
[]
package it.polimi.rsp.vocals.core.annotations.features; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) public @interface Feature { String name(); String ns() default "UNKNOWN"; }
266
0.766917
0.766917
14
18
19.464252
55
false
false
0
0
0
0
0
0
0.357143
false
false
9
94f39d503a22629a51b69d6aa5cc1492f71faad0
29,351,806,514,825
cef744ea0d1f2ba9ae5a7841d3dd5266aea01681
/ClockwiseMuseumSample/WatchFaceAnimation/bcfwearcore/src/main/java/com/bcf/watchface/bcfwearcore/WatchFaceUtility.java
5057249e1f64c0546e2b0ce627d0d14204240c25
[]
no_license
DanteNguyen1008/phpWebtest2
https://github.com/DanteNguyen1008/phpWebtest2
cc7643f50ca37a1d6cdb7d3953c414698c51a073
6c6aa5fc79cbb4cc11399c03493ddbe37ece34dc
refs/heads/master
2021-01-22T08:23:32.865000
2015-07-07T01:36:11
2015-07-07T01:36:11
38,656,409
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bcf.watchface.bcfwearcore; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Paint; import android.graphics.Typeface; import android.net.Uri; import android.util.Log; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.ResultCallback; import com.google.android.gms.wearable.DataApi; import com.google.android.gms.wearable.DataItem; import com.google.android.gms.wearable.DataMap; import com.google.android.gms.wearable.DataMapItem; import com.google.android.gms.wearable.NodeApi; import com.google.android.gms.wearable.PutDataMapRequest; import com.google.android.gms.wearable.Wearable; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; /** * Created by annguyenquocduy on 12/27/14. */ public class WatchFaceUtility { private static final String TAG = WatchFaceUtility.class.getSimpleName(); private static final String[] MONTHS_NAME_LIST = {"JAN", "Feb", "Mar", "Apr", "May", "June", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; private static final String[] WEEK_DAY_LIST = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}; /** * Callback interface to perform an action with the current config {@link com.google.android.gms.wearable.DataMap} for * {@link BaseWatchFaceService}. */ public interface FetchConfigDataMapCallback { /** * Callback invoked with the current config {@link com.google.android.gms.wearable.DataMap} for * {@link BaseWatchFaceService}. */ void onConfigDataMapFetched(DataMap config); } /** * Asynchronously fetches the current config {@link com.google.android.gms.wearable.DataMap} * for {@link BaseWatchFaceService} * and passes it to the given callback. * <p/> * If the current config {@link com.google.android.gms.wearable.DataItem} doesn't exist, * it isn't created and the callback * receives an empty DataMap. */ public static void fetchConfigDataMap(final GoogleApiClient client, final FetchConfigDataMapCallback callback, final String path) { Wearable.NodeApi.getLocalNode(client).setResultCallback( new ResultCallback<NodeApi.GetLocalNodeResult>() { @Override public void onResult(NodeApi.GetLocalNodeResult getLocalNodeResult) { String localNode = getLocalNodeResult.getNode().getId(); Uri uri = new Uri.Builder() .scheme("wear") .path(path) .authority(localNode) .build(); Wearable.DataApi.getDataItem(client, uri) .setResultCallback(new DataItemResultCallback(callback)); } } ); } /** * Overwrites the current config {@link DataItem}'s {@link DataMap} with {@code newConfig}. * If the config DataItem doesn't exist, it's created. */ public static void putConfigDataItem(GoogleApiClient googleApiClient, DataMap newConfig, String path) { PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(path); DataMap configToPut = putDataMapRequest.getDataMap(); configToPut.putAll(newConfig); Wearable.DataApi.putDataItem(googleApiClient, putDataMapRequest.asPutDataRequest()) .setResultCallback(new ResultCallback<DataApi.DataItemResult>() { @Override public void onResult(DataApi.DataItemResult dataItemResult) { Log.d(TAG, "putDataItem result status: " + dataItemResult.getStatus()); } }); } /** * Overwrites (or sets, if not present) the keys in the current config {@link DataItem} with * the ones appearing in the given {@link DataMap}. If the config DataItem doesn't exist, * it's created. * <p/> * It is allowed that only some of the keys used in the config DataItem appear in * {@code configKeysToOverwrite}. The rest of the keys remains unmodified in this case. */ public static void overwriteKeysInConfigDataMap(final GoogleApiClient googleApiClient, final DataMap configKeysToOverwrite, final String path) { fetchConfigDataMap(googleApiClient, new FetchConfigDataMapCallback() { @Override public void onConfigDataMapFetched(DataMap currentConfig) { DataMap overwrittenConfig = new DataMap(); overwrittenConfig.putAll(currentConfig); overwrittenConfig.putAll(configKeysToOverwrite); putConfigDataItem(googleApiClient, overwrittenConfig, path); } }, path ); } private static class DataItemResultCallback implements ResultCallback<DataApi.DataItemResult> { private final FetchConfigDataMapCallback mCallback; public DataItemResultCallback(FetchConfigDataMapCallback callback) { mCallback = callback; } @Override public void onResult(DataApi.DataItemResult dataItemResult) { if (dataItemResult.getStatus().isSuccess()) { if (dataItemResult.getDataItem() != null) { DataItem configDataItem = dataItemResult.getDataItem(); DataMapItem dataMapItem = DataMapItem.fromDataItem(configDataItem); DataMap config = dataMapItem.getDataMap(); mCallback.onConfigDataMapFetched(config); } else { mCallback.onConfigDataMapFetched(new DataMap()); } } } } /** * General Utility */ public static Paint createTextPaint(int defaultInteractiveColor, Typeface typeface) { Paint paint = new Paint(); paint.setColor(defaultInteractiveColor); paint.setTypeface(typeface); paint.setAntiAlias(true); return paint; } public static int convertTo12Hour(int hour) { int result = hour % 12; return (result == 0) ? 12 : result; } public static String formatTwoDigitNumber(int hour) { return String.format("%02d", hour); } public static String getAMPMFromHour(int hour) { if (hour >= 12) return "PM"; return "AM"; } public static String getMonthNameShortForm(int monthIndex) { return MONTHS_NAME_LIST[monthIndex]; } public static String getWeekDayName(int weekDayIndex) { return WEEK_DAY_LIST[weekDayIndex]; } public static File setBitmapToStorage(Context context, Bitmap bitmap, String filePath) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bytes); File f = new File(context.getExternalFilesDir(null), filePath); try { if (f.exists()) f.delete(); f.createNewFile(); // write the bytes in file FileOutputStream fo = new FileOutputStream(f); fo.write(bytes.toByteArray()); fo.close(); bytes.close(); } catch (IOException e) { e.printStackTrace(); } return f; } public static Bitmap getBitmapFromUrl(Context context, String filePath) { File f = new File(context.getExternalFilesDir(null), filePath); if (f.exists()) { return BitmapFactory.decodeFile(f.getPath()); } return null; } }
UTF-8
Java
7,970
java
WatchFaceUtility.java
Java
[ { "context": "am;\nimport java.io.IOException;\n\n/**\n * Created by annguyenquocduy on 12/27/14.\n */\npublic class WatchFaceUtility {\n", "end": 880, "score": 0.9996479749679565, "start": 865, "tag": "USERNAME", "value": "annguyenquocduy" } ]
null
[]
package com.bcf.watchface.bcfwearcore; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Paint; import android.graphics.Typeface; import android.net.Uri; import android.util.Log; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.ResultCallback; import com.google.android.gms.wearable.DataApi; import com.google.android.gms.wearable.DataItem; import com.google.android.gms.wearable.DataMap; import com.google.android.gms.wearable.DataMapItem; import com.google.android.gms.wearable.NodeApi; import com.google.android.gms.wearable.PutDataMapRequest; import com.google.android.gms.wearable.Wearable; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; /** * Created by annguyenquocduy on 12/27/14. */ public class WatchFaceUtility { private static final String TAG = WatchFaceUtility.class.getSimpleName(); private static final String[] MONTHS_NAME_LIST = {"JAN", "Feb", "Mar", "Apr", "May", "June", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; private static final String[] WEEK_DAY_LIST = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}; /** * Callback interface to perform an action with the current config {@link com.google.android.gms.wearable.DataMap} for * {@link BaseWatchFaceService}. */ public interface FetchConfigDataMapCallback { /** * Callback invoked with the current config {@link com.google.android.gms.wearable.DataMap} for * {@link BaseWatchFaceService}. */ void onConfigDataMapFetched(DataMap config); } /** * Asynchronously fetches the current config {@link com.google.android.gms.wearable.DataMap} * for {@link BaseWatchFaceService} * and passes it to the given callback. * <p/> * If the current config {@link com.google.android.gms.wearable.DataItem} doesn't exist, * it isn't created and the callback * receives an empty DataMap. */ public static void fetchConfigDataMap(final GoogleApiClient client, final FetchConfigDataMapCallback callback, final String path) { Wearable.NodeApi.getLocalNode(client).setResultCallback( new ResultCallback<NodeApi.GetLocalNodeResult>() { @Override public void onResult(NodeApi.GetLocalNodeResult getLocalNodeResult) { String localNode = getLocalNodeResult.getNode().getId(); Uri uri = new Uri.Builder() .scheme("wear") .path(path) .authority(localNode) .build(); Wearable.DataApi.getDataItem(client, uri) .setResultCallback(new DataItemResultCallback(callback)); } } ); } /** * Overwrites the current config {@link DataItem}'s {@link DataMap} with {@code newConfig}. * If the config DataItem doesn't exist, it's created. */ public static void putConfigDataItem(GoogleApiClient googleApiClient, DataMap newConfig, String path) { PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(path); DataMap configToPut = putDataMapRequest.getDataMap(); configToPut.putAll(newConfig); Wearable.DataApi.putDataItem(googleApiClient, putDataMapRequest.asPutDataRequest()) .setResultCallback(new ResultCallback<DataApi.DataItemResult>() { @Override public void onResult(DataApi.DataItemResult dataItemResult) { Log.d(TAG, "putDataItem result status: " + dataItemResult.getStatus()); } }); } /** * Overwrites (or sets, if not present) the keys in the current config {@link DataItem} with * the ones appearing in the given {@link DataMap}. If the config DataItem doesn't exist, * it's created. * <p/> * It is allowed that only some of the keys used in the config DataItem appear in * {@code configKeysToOverwrite}. The rest of the keys remains unmodified in this case. */ public static void overwriteKeysInConfigDataMap(final GoogleApiClient googleApiClient, final DataMap configKeysToOverwrite, final String path) { fetchConfigDataMap(googleApiClient, new FetchConfigDataMapCallback() { @Override public void onConfigDataMapFetched(DataMap currentConfig) { DataMap overwrittenConfig = new DataMap(); overwrittenConfig.putAll(currentConfig); overwrittenConfig.putAll(configKeysToOverwrite); putConfigDataItem(googleApiClient, overwrittenConfig, path); } }, path ); } private static class DataItemResultCallback implements ResultCallback<DataApi.DataItemResult> { private final FetchConfigDataMapCallback mCallback; public DataItemResultCallback(FetchConfigDataMapCallback callback) { mCallback = callback; } @Override public void onResult(DataApi.DataItemResult dataItemResult) { if (dataItemResult.getStatus().isSuccess()) { if (dataItemResult.getDataItem() != null) { DataItem configDataItem = dataItemResult.getDataItem(); DataMapItem dataMapItem = DataMapItem.fromDataItem(configDataItem); DataMap config = dataMapItem.getDataMap(); mCallback.onConfigDataMapFetched(config); } else { mCallback.onConfigDataMapFetched(new DataMap()); } } } } /** * General Utility */ public static Paint createTextPaint(int defaultInteractiveColor, Typeface typeface) { Paint paint = new Paint(); paint.setColor(defaultInteractiveColor); paint.setTypeface(typeface); paint.setAntiAlias(true); return paint; } public static int convertTo12Hour(int hour) { int result = hour % 12; return (result == 0) ? 12 : result; } public static String formatTwoDigitNumber(int hour) { return String.format("%02d", hour); } public static String getAMPMFromHour(int hour) { if (hour >= 12) return "PM"; return "AM"; } public static String getMonthNameShortForm(int monthIndex) { return MONTHS_NAME_LIST[monthIndex]; } public static String getWeekDayName(int weekDayIndex) { return WEEK_DAY_LIST[weekDayIndex]; } public static File setBitmapToStorage(Context context, Bitmap bitmap, String filePath) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bytes); File f = new File(context.getExternalFilesDir(null), filePath); try { if (f.exists()) f.delete(); f.createNewFile(); // write the bytes in file FileOutputStream fo = new FileOutputStream(f); fo.write(bytes.toByteArray()); fo.close(); bytes.close(); } catch (IOException e) { e.printStackTrace(); } return f; } public static Bitmap getBitmapFromUrl(Context context, String filePath) { File f = new File(context.getExternalFilesDir(null), filePath); if (f.exists()) { return BitmapFactory.decodeFile(f.getPath()); } return null; } }
7,970
0.621079
0.61857
202
38.455444
30.955261
122
false
false
0
0
0
0
0
0
0.569307
false
false
9
644da32cc11a4d29a09f4d816ac808d81c17434f
34,926,674,055,896
9ac7cd055d13380dfa8d400f1dec3362f2da9a5f
/deployment-common/src/main/java/io/github/cloudiator/deployment/domain/CloudiatorClusterProcessImpl.java
1272c992e1b9b245a3eee8d9784fc06a0cb3d58d
[]
no_license
ferozzahid/deployment
https://github.com/ferozzahid/deployment
eb2dfed04533da79822ac1f1f5a4020ebb523931
a192a9a73c8eef4e7cbef52dd24232b3db41ff87
refs/heads/master
2020-06-01T01:15:42.923000
2019-07-30T11:56:44
2019-07-30T11:56:44
190,573,334
0
0
null
true
2019-07-30T12:01:13
2019-06-06T11:55:28
2019-07-30T11:56:49
2019-07-30T12:01:13
896
0
0
0
Java
false
false
package io.github.cloudiator.deployment.domain; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.MoreObjects.ToStringHelper; import com.google.common.collect.ImmutableSet; import de.uniulm.omi.cloudiator.sword.domain.IpAddress; import java.util.Date; import java.util.HashSet; import java.util.Objects; import java.util.Set; import javax.annotation.Nullable; /** * Created by Daniel Seybold on 29.11.2018. */ public class CloudiatorClusterProcessImpl extends CloudiatorProcessImpl implements CloudiatorClusterProcess { private final Set<String> nodes; CloudiatorClusterProcessImpl(String id, @Nullable String originId, String userId, String scheduleId, String taskName, String lifecycleInterface, CloudiatorProcess.ProcessState state, Type type, Set<String> nodes, @Nullable String diagnostic, @Nullable String reason, @Nullable String endpoint, Set<IpAddress> ipAddresses, Date start, @Nullable Date stop) { super(id, originId, userId, scheduleId, taskName, lifecycleInterface, state, type, diagnostic, reason, endpoint, ipAddresses, start, stop); checkNotNull(nodes, "nodes is null"); this.nodes = new HashSet<>(nodes); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CloudiatorClusterProcessImpl that = (CloudiatorClusterProcessImpl) o; return id().equals(that.id()) && originId().equals(that.originId()) && userId().equals(that.userId()) && scheduleId().equals(that.scheduleId()) && taskId().equals(that.taskId()) && taskInterface().equals(that.taskInterface()) && state() == that.state() && type() == that.type() && Objects.equals(diagnostic(), that.diagnostic()) && Objects.equals(reason(), that.reason()) && Objects.equals(endpoint(), that.endpoint()) && ipAddresses().equals(that.ipAddresses()) && nodes().equals(that.nodes()); } @Override public int hashCode() { return Objects .hash(id(), originId(), userId(), scheduleId(), taskId(), taskInterface(), state(), type(), diagnostic(), reason(), endpoint(), ipAddresses(), nodes()); } @Override protected ToStringHelper stringHelper() { return super.stringHelper().add("nodes", nodes); } @Override public Set<String> nodes() { return ImmutableSet.copyOf(nodes); } }
UTF-8
Java
2,530
java
CloudiatorClusterProcessImpl.java
Java
[ { "context": "port javax.annotation.Nullable;\n\n/**\n * Created by Daniel Seybold on 29.11.2018.\n */\npublic class CloudiatorCluster", "end": 440, "score": 0.9998449087142944, "start": 426, "tag": "NAME", "value": "Daniel Seybold" } ]
null
[]
package io.github.cloudiator.deployment.domain; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.MoreObjects.ToStringHelper; import com.google.common.collect.ImmutableSet; import de.uniulm.omi.cloudiator.sword.domain.IpAddress; import java.util.Date; import java.util.HashSet; import java.util.Objects; import java.util.Set; import javax.annotation.Nullable; /** * Created by <NAME> on 29.11.2018. */ public class CloudiatorClusterProcessImpl extends CloudiatorProcessImpl implements CloudiatorClusterProcess { private final Set<String> nodes; CloudiatorClusterProcessImpl(String id, @Nullable String originId, String userId, String scheduleId, String taskName, String lifecycleInterface, CloudiatorProcess.ProcessState state, Type type, Set<String> nodes, @Nullable String diagnostic, @Nullable String reason, @Nullable String endpoint, Set<IpAddress> ipAddresses, Date start, @Nullable Date stop) { super(id, originId, userId, scheduleId, taskName, lifecycleInterface, state, type, diagnostic, reason, endpoint, ipAddresses, start, stop); checkNotNull(nodes, "nodes is null"); this.nodes = new HashSet<>(nodes); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CloudiatorClusterProcessImpl that = (CloudiatorClusterProcessImpl) o; return id().equals(that.id()) && originId().equals(that.originId()) && userId().equals(that.userId()) && scheduleId().equals(that.scheduleId()) && taskId().equals(that.taskId()) && taskInterface().equals(that.taskInterface()) && state() == that.state() && type() == that.type() && Objects.equals(diagnostic(), that.diagnostic()) && Objects.equals(reason(), that.reason()) && Objects.equals(endpoint(), that.endpoint()) && ipAddresses().equals(that.ipAddresses()) && nodes().equals(that.nodes()); } @Override public int hashCode() { return Objects .hash(id(), originId(), userId(), scheduleId(), taskId(), taskInterface(), state(), type(), diagnostic(), reason(), endpoint(), ipAddresses(), nodes()); } @Override protected ToStringHelper stringHelper() { return super.stringHelper().add("nodes", nodes); } @Override public Set<String> nodes() { return ImmutableSet.copyOf(nodes); } }
2,522
0.674704
0.671542
77
31.857143
26.51866
99
false
false
0
0
0
0
0
0
0.87013
false
false
9
2845e4314565fe7836f63e0fa42a200a7e821596
34,926,674,054,711
7b733d7be68f0fa4df79359b57e814f5253fc72d
/system/src/main/java/com/percussion/security/PSBackEndTableProviderMetaData.java
12007e111829f7bc934c830f25f23153a5460f47
[ "LicenseRef-scancode-dco-1.1", "Apache-2.0", "OFL-1.1", "LGPL-2.0-or-later" ]
permissive
percussion/percussioncms
https://github.com/percussion/percussioncms
318ac0ef62dce12eb96acf65fc658775d15d95ad
c8527de53c626097d589dc28dba4a4b5d6e4dd2b
refs/heads/development
2023-08-31T14:34:09.593000
2023-08-31T14:04:23
2023-08-31T14:04:23
331,373,975
18
6
Apache-2.0
false
2023-09-14T21:29:25
2021-01-20T17:03:38
2023-09-14T01:11:27
2023-09-14T21:29:24
174,353
10
5
60
Java
false
false
/* * Copyright 1999-2023 Percussion Software, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * limitations under the License. */ package com.percussion.security; import com.percussion.data.PSResultSet; import com.percussion.data.PSResultSetWrapper; import com.percussion.error.PSSqlException; import com.percussion.data.jdbc.PSOdbcDriverMetaData; import com.percussion.log.PSLogManager; import com.percussion.log.PSLogServerWarning; import com.percussion.util.PSSQLStatement; import com.percussion.utils.collections.PSIteratorUtils; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Iterator; import java.util.Properties; /** * The PSBackEndTableProviderMetaData class implements cataloging for * the JDBC (back-end) table security provider. * */ public class PSBackEndTableProviderMetaData extends PSSecurityProviderMetaData { /** * Construct a meta data object for the specified provider * instance. * * * @param inst The provider instance. * (must not be <code>null</code>) * * @param uidCol The column to query for uids. * (must not be <code>null</code> & * must not be empty string) * * @param tableName The table to query for uids. * (must not be <code>null</code> & * must not be empty string) * * @param userAttributes The names of all attributes defined for this * provider. May be <code>null</code>. * * @throws IllegalArgumentException * If any parameter is invalid. */ PSBackEndTableProviderMetaData(PSBackEndTableProvider inst, String uidCol, String tableName, String [] userAttributes ) { if (inst == null) { throw new IllegalArgumentException("An instance must be provided"); } if ((uidCol != null) && (uidCol.length() > 0) && (tableName != null) && (tableName.length() > 0)) { /* Create the query statement to get uids */ m_uidSelect = "SELECT 'user' AS OBJECT_TYPE, " + uidCol + " AS OBJECT_ID, " + uidCol + " AS OBJECT_NAME FROM " + tableName; } else { throw new IllegalArgumentException( "Table name and uid column must be specified."); } m_instance = inst; if ( null != userAttributes ) m_userAttributes = userAttributes; m_uidCol = uidCol; } /** * Construct a meta data object for the specified provider * instance. This default constructor is used by the * security provider pool. */ public PSBackEndTableProviderMetaData() { // Nada! } /** * Get the name of this security provider. * * @return the provider's name */ public String getName() { return PSBackEndTableProvider.SP_NAME; } /** * Get the full name of this security provider. * * @return the provider's full name */ public String getFullName() { return SP_FULLNAME; } /** * Get the descritpion of this security provider. * * @return the provider's description */ public String getDescription() { return SP_DESCRIPTION; } /** * Get the connection properties required for logging into this provider. * * @return the connection properties (never <code>null</code>) */ public Properties getConnectionProperties() { return PSBackEndConnection.getConnectionProperties(); } /** * Get the names of servers available to authenticate users. * The caller is responsible for closing the result set. * * <p> * The result set contains: * <OL> * <LI><B>SERVER_NAME</B> String => server name</LI> * </OL> * * @return a result set containing one server per row * * @throws SQLException If a SQL exception occurs. */ @Override public ResultSet getServers() throws SQLException { PSOdbcDriverMetaData odbcMeta = new PSOdbcDriverMetaData(); try { return odbcMeta.getServers(); } catch (SQLException e) { /* Log that a catalog exception occurred */ Object[] args = { PSBackEndTableProvider.SP_NAME, m_instance, PSSqlException.toString(e) }; PSLogManager.write( new PSLogServerWarning( IPSSecurityErrors.PROVIDER_INIT_CATALOG_DISABLED, args, true, "Odbc Driver - getServers")); throw e; } } /** * Get the types of objects available through this provider. * The caller must close the result set when finished with it. * * <p> * The result set contains: * <OL> * <LI><B>OBJECT_TYPE</B> String => the object type name</LI> * </OL> * * @return a result set containing one object type per row * * @throws SQLException Never thrown */ @Override public ResultSet getObjectTypes() throws SQLException { PSResultSet rs = super.getEmptyObjectTypes(); String [] objectTypes = { USER_OBJECT_NAME }; Iterator iter = PSIteratorUtils.iterator( objectTypes ); Object [] row = new String[1]; while ( iter.hasNext()) { row[0] = iter.next(); rs.addRow( row ); } rs.beforeFirst(); return rs; } // see interface for description @Override public ResultSet getObjects( String[] objectTypes, String [] filterPattern ) throws SQLException { Connection conn = null; Statement stmt = null; try { boolean getUsers = false; if (objectTypes != null) { for (int i = 0; i < objectTypes.length; i++) { if ((objectTypes[i] != null) && (objectTypes[i].equals(USER_OBJECT_NAME))) { getUsers = true; break; } } } else { getUsers = true; } if (getUsers && (m_uidSelect != null)) { conn = m_instance.getDbConnection(); // Get an appropriate result set to come back for the caller stmt = PSSQLStatement.getStatement(conn); StringBuilder uidSelect = new StringBuilder(m_uidSelect); if (filterPattern != null && filterPattern.length > 0) { uidSelect.append(" WHERE "); for (int i = 0; i < filterPattern.length; i++) { uidSelect.append(m_uidCol).append(" LIKE '"); uidSelect.append(filterPattern[i]); uidSelect.append("'"); if (i < filterPattern.length - 1) uidSelect.append(" OR "); } } ResultSet rs = stmt.executeQuery(uidSelect.toString()); // Fill the new kind of result set here (conn, stmt, etc) return new PSResultSetWrapper(rs, stmt, conn); } else { return new PSResultSet(); } } catch (SQLException e) { if (stmt != null) try { stmt.close(); } catch (SQLException stmtCloseE) { e.setNextException(stmtCloseE); } if (conn != null) try { conn.close(); } catch (SQLException connCloseE) { e.setNextException(connCloseE); } throw e; } } /** * @see * @param objectTypes * @return * @throws SQLException */ @Override public ResultSet getAttributes( String[] objectTypes ) throws SQLException { PSResultSet rs = super.getEmptyAttributes(); if ( m_userAttributes.length > 0 ) { Iterator<String> types = PSIteratorUtils.iterator( objectTypes ); Iterator attribs = PSIteratorUtils.iterator( m_userAttributes ); while ( types.hasNext()) { String type = (String) types.next(); if ( !type.equalsIgnoreCase(USER_OBJECT_NAME)) continue; Object [] row = new String[3]; row[0] = type; row[2] = ""; while ( attribs.hasNext()) { row[1] = attribs.next(); rs.addRow( row ); } } rs.beforeFirst(); } return rs; } /** * Are calls to {@link #getServers <code>getServers</code>} * supported? * * @return <code>true</code> */ @Override public boolean supportsGetServers() { return true; } /** * Are calls to {@link #getObjects <code>getObjects</code>} * supported? * * @return <code>true</code> */ @Override public boolean supportsGetObjects() { return true; } /** * Are calls to {@link #getObjectTypes <code>getObjectTypes</code>} * supported? * * @return <code>true</code> */ @Override public boolean supportsGetObjectTypes() { return true; } /** * The name of the column in the back end table which contains the * user id. * (created by constructor & can be <code>null</code>, but never empty) */ private String m_uidCol = null; /** * Store the query statement so that a query can be executed. * (created by constructor & can be <code>null</code>, but never empty) */ private String m_uidSelect = null; /** The description for this provider. */ private static final String SP_DESCRIPTION = "Authentication using a back-end table as a user directory."; /** The full name for this provider */ public static final String SP_FULLNAME = "Back-end Table Security Provider"; /** The name of the user object supported for cataloging. */ private static final String USER_OBJECT_NAME = "user"; /** The BackEndTableProvider instance associate with this metadata. * (created by constructor & can be <code>null</code>) */ private PSBackEndTableProvider m_instance; /** * An array containing all of the names of the attributes supported * by this provider. Initialized with data when the non-default ctor is * called. Never <code>null</code>, may be empty. */ private String [] m_userAttributes = new String[0]; }
UTF-8
Java
11,313
java
PSBackEndTableProviderMetaData.java
Java
[]
null
[]
/* * Copyright 1999-2023 Percussion Software, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * limitations under the License. */ package com.percussion.security; import com.percussion.data.PSResultSet; import com.percussion.data.PSResultSetWrapper; import com.percussion.error.PSSqlException; import com.percussion.data.jdbc.PSOdbcDriverMetaData; import com.percussion.log.PSLogManager; import com.percussion.log.PSLogServerWarning; import com.percussion.util.PSSQLStatement; import com.percussion.utils.collections.PSIteratorUtils; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Iterator; import java.util.Properties; /** * The PSBackEndTableProviderMetaData class implements cataloging for * the JDBC (back-end) table security provider. * */ public class PSBackEndTableProviderMetaData extends PSSecurityProviderMetaData { /** * Construct a meta data object for the specified provider * instance. * * * @param inst The provider instance. * (must not be <code>null</code>) * * @param uidCol The column to query for uids. * (must not be <code>null</code> & * must not be empty string) * * @param tableName The table to query for uids. * (must not be <code>null</code> & * must not be empty string) * * @param userAttributes The names of all attributes defined for this * provider. May be <code>null</code>. * * @throws IllegalArgumentException * If any parameter is invalid. */ PSBackEndTableProviderMetaData(PSBackEndTableProvider inst, String uidCol, String tableName, String [] userAttributes ) { if (inst == null) { throw new IllegalArgumentException("An instance must be provided"); } if ((uidCol != null) && (uidCol.length() > 0) && (tableName != null) && (tableName.length() > 0)) { /* Create the query statement to get uids */ m_uidSelect = "SELECT 'user' AS OBJECT_TYPE, " + uidCol + " AS OBJECT_ID, " + uidCol + " AS OBJECT_NAME FROM " + tableName; } else { throw new IllegalArgumentException( "Table name and uid column must be specified."); } m_instance = inst; if ( null != userAttributes ) m_userAttributes = userAttributes; m_uidCol = uidCol; } /** * Construct a meta data object for the specified provider * instance. This default constructor is used by the * security provider pool. */ public PSBackEndTableProviderMetaData() { // Nada! } /** * Get the name of this security provider. * * @return the provider's name */ public String getName() { return PSBackEndTableProvider.SP_NAME; } /** * Get the full name of this security provider. * * @return the provider's full name */ public String getFullName() { return SP_FULLNAME; } /** * Get the descritpion of this security provider. * * @return the provider's description */ public String getDescription() { return SP_DESCRIPTION; } /** * Get the connection properties required for logging into this provider. * * @return the connection properties (never <code>null</code>) */ public Properties getConnectionProperties() { return PSBackEndConnection.getConnectionProperties(); } /** * Get the names of servers available to authenticate users. * The caller is responsible for closing the result set. * * <p> * The result set contains: * <OL> * <LI><B>SERVER_NAME</B> String => server name</LI> * </OL> * * @return a result set containing one server per row * * @throws SQLException If a SQL exception occurs. */ @Override public ResultSet getServers() throws SQLException { PSOdbcDriverMetaData odbcMeta = new PSOdbcDriverMetaData(); try { return odbcMeta.getServers(); } catch (SQLException e) { /* Log that a catalog exception occurred */ Object[] args = { PSBackEndTableProvider.SP_NAME, m_instance, PSSqlException.toString(e) }; PSLogManager.write( new PSLogServerWarning( IPSSecurityErrors.PROVIDER_INIT_CATALOG_DISABLED, args, true, "Odbc Driver - getServers")); throw e; } } /** * Get the types of objects available through this provider. * The caller must close the result set when finished with it. * * <p> * The result set contains: * <OL> * <LI><B>OBJECT_TYPE</B> String => the object type name</LI> * </OL> * * @return a result set containing one object type per row * * @throws SQLException Never thrown */ @Override public ResultSet getObjectTypes() throws SQLException { PSResultSet rs = super.getEmptyObjectTypes(); String [] objectTypes = { USER_OBJECT_NAME }; Iterator iter = PSIteratorUtils.iterator( objectTypes ); Object [] row = new String[1]; while ( iter.hasNext()) { row[0] = iter.next(); rs.addRow( row ); } rs.beforeFirst(); return rs; } // see interface for description @Override public ResultSet getObjects( String[] objectTypes, String [] filterPattern ) throws SQLException { Connection conn = null; Statement stmt = null; try { boolean getUsers = false; if (objectTypes != null) { for (int i = 0; i < objectTypes.length; i++) { if ((objectTypes[i] != null) && (objectTypes[i].equals(USER_OBJECT_NAME))) { getUsers = true; break; } } } else { getUsers = true; } if (getUsers && (m_uidSelect != null)) { conn = m_instance.getDbConnection(); // Get an appropriate result set to come back for the caller stmt = PSSQLStatement.getStatement(conn); StringBuilder uidSelect = new StringBuilder(m_uidSelect); if (filterPattern != null && filterPattern.length > 0) { uidSelect.append(" WHERE "); for (int i = 0; i < filterPattern.length; i++) { uidSelect.append(m_uidCol).append(" LIKE '"); uidSelect.append(filterPattern[i]); uidSelect.append("'"); if (i < filterPattern.length - 1) uidSelect.append(" OR "); } } ResultSet rs = stmt.executeQuery(uidSelect.toString()); // Fill the new kind of result set here (conn, stmt, etc) return new PSResultSetWrapper(rs, stmt, conn); } else { return new PSResultSet(); } } catch (SQLException e) { if (stmt != null) try { stmt.close(); } catch (SQLException stmtCloseE) { e.setNextException(stmtCloseE); } if (conn != null) try { conn.close(); } catch (SQLException connCloseE) { e.setNextException(connCloseE); } throw e; } } /** * @see * @param objectTypes * @return * @throws SQLException */ @Override public ResultSet getAttributes( String[] objectTypes ) throws SQLException { PSResultSet rs = super.getEmptyAttributes(); if ( m_userAttributes.length > 0 ) { Iterator<String> types = PSIteratorUtils.iterator( objectTypes ); Iterator attribs = PSIteratorUtils.iterator( m_userAttributes ); while ( types.hasNext()) { String type = (String) types.next(); if ( !type.equalsIgnoreCase(USER_OBJECT_NAME)) continue; Object [] row = new String[3]; row[0] = type; row[2] = ""; while ( attribs.hasNext()) { row[1] = attribs.next(); rs.addRow( row ); } } rs.beforeFirst(); } return rs; } /** * Are calls to {@link #getServers <code>getServers</code>} * supported? * * @return <code>true</code> */ @Override public boolean supportsGetServers() { return true; } /** * Are calls to {@link #getObjects <code>getObjects</code>} * supported? * * @return <code>true</code> */ @Override public boolean supportsGetObjects() { return true; } /** * Are calls to {@link #getObjectTypes <code>getObjectTypes</code>} * supported? * * @return <code>true</code> */ @Override public boolean supportsGetObjectTypes() { return true; } /** * The name of the column in the back end table which contains the * user id. * (created by constructor & can be <code>null</code>, but never empty) */ private String m_uidCol = null; /** * Store the query statement so that a query can be executed. * (created by constructor & can be <code>null</code>, but never empty) */ private String m_uidSelect = null; /** The description for this provider. */ private static final String SP_DESCRIPTION = "Authentication using a back-end table as a user directory."; /** The full name for this provider */ public static final String SP_FULLNAME = "Back-end Table Security Provider"; /** The name of the user object supported for cataloging. */ private static final String USER_OBJECT_NAME = "user"; /** The BackEndTableProvider instance associate with this metadata. * (created by constructor & can be <code>null</code>) */ private PSBackEndTableProvider m_instance; /** * An array containing all of the names of the attributes supported * by this provider. Initialized with data when the non-default ctor is * called. Never <code>null</code>, may be empty. */ private String [] m_userAttributes = new String[0]; }
11,313
0.56634
0.564041
395
27.637974
23.785711
79
false
false
0
0
0
0
0
0
0.278481
false
false
9
f26b79663fa13d897e13d89855d1633689af958f
34,926,674,058,479
058e995504d8d058de9531c93a708aa19d2c8c5b
/Packages/src/Packg2/Daffo.java
aa8bd851ff890907286abc715fb748f5ba35fb15
[]
no_license
93atulkalra/EclipseBackup
https://github.com/93atulkalra/EclipseBackup
157c5578a1177b27642ed1cde72b05d6db9986f2
107f807c8f667a08c9c397b1f7d2a46cf45e0b59
refs/heads/master
2022-12-05T06:23:44.068000
2019-10-13T12:05:43
2019-10-13T12:05:43
197,632,653
0
0
null
false
2022-11-16T05:34:01
2019-07-18T17:49:13
2019-10-13T12:06:00
2022-11-16T05:33:58
43,012
0
0
14
HTML
false
false
package Packg2; import Packg1.PckCls; public class Daffo extends PckCls { Daffo() { System.out.println("In Daffo"); } public static void main(String[] args) { // TODO Auto-generated method stub Daffo df = new Daffo(); PckCls pc =new PckCls(); } }
UTF-8
Java
271
java
Daffo.java
Java
[]
null
[]
package Packg2; import Packg1.PckCls; public class Daffo extends PckCls { Daffo() { System.out.println("In Daffo"); } public static void main(String[] args) { // TODO Auto-generated method stub Daffo df = new Daffo(); PckCls pc =new PckCls(); } }
271
0.653137
0.645756
19
13.210526
14.555082
41
false
false
0
0
0
0
0
0
1.157895
false
false
9
3786ccc8e770e1294a5561bd1334d81b9a5cb623
28,870,770,211,830
b85d0ce8280cff639a80de8bf35e2ad110ac7e16
/com/fossil/bce.java
d958fe1dafeb6ab9251ff87ecda5495854fa595a
[]
no_license
MathiasMonstrey/fosil_decompiled
https://github.com/MathiasMonstrey/fosil_decompiled
3d90433663db67efdc93775145afc0f4a3dd150c
667c5eea80c829164220222e8fa64bf7185c9aae
refs/heads/master
2020-03-19T12:18:30.615000
2018-06-07T17:26:09
2018-06-07T17:26:09
136,509,743
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fossil; import android.content.Context; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.util.Log; import java.io.File; import java.io.IOException; public final class bce { private Context bqb; private SharedPreferences bqd; public bce(Context context) { this(context, "com.google.android.gms.appid"); } private bce(Context context, String str) { this.bqb = context; this.bqd = context.getSharedPreferences(str, 0); String valueOf = String.valueOf(str); String valueOf2 = String.valueOf("-no-backup"); File file = new File(axx.aw(this.bqb), valueOf2.length() != 0 ? valueOf.concat(valueOf2) : new String(valueOf)); if (!file.exists()) { try { if (file.createNewFile() && !isEmpty()) { Log.i("InstanceID/Store", "App restored, clearing state"); bbz.m4824a(this.bqb, this); } } catch (IOException e) { if (Log.isLoggable("InstanceID/Store", 3)) { valueOf = "InstanceID/Store"; String str2 = "Error creating file in no backup dir: "; valueOf2 = String.valueOf(e.getMessage()); Log.d(valueOf, valueOf2.length() != 0 ? str2.concat(valueOf2) : new String(str2)); } } } } public final synchronized void ME() { this.bqd.edit().clear().commit(); } public final synchronized void dD(String str) { Editor edit = this.bqd.edit(); for (String str2 : this.bqd.getAll().keySet()) { if (str2.startsWith(str)) { edit.remove(str2); } } edit.commit(); } public final void dE(String str) { dD(String.valueOf(str).concat("|T|")); } public final boolean isEmpty() { return this.bqd.getAll().isEmpty(); } }
UTF-8
Java
1,997
java
bce.java
Java
[]
null
[]
package com.fossil; import android.content.Context; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.util.Log; import java.io.File; import java.io.IOException; public final class bce { private Context bqb; private SharedPreferences bqd; public bce(Context context) { this(context, "com.google.android.gms.appid"); } private bce(Context context, String str) { this.bqb = context; this.bqd = context.getSharedPreferences(str, 0); String valueOf = String.valueOf(str); String valueOf2 = String.valueOf("-no-backup"); File file = new File(axx.aw(this.bqb), valueOf2.length() != 0 ? valueOf.concat(valueOf2) : new String(valueOf)); if (!file.exists()) { try { if (file.createNewFile() && !isEmpty()) { Log.i("InstanceID/Store", "App restored, clearing state"); bbz.m4824a(this.bqb, this); } } catch (IOException e) { if (Log.isLoggable("InstanceID/Store", 3)) { valueOf = "InstanceID/Store"; String str2 = "Error creating file in no backup dir: "; valueOf2 = String.valueOf(e.getMessage()); Log.d(valueOf, valueOf2.length() != 0 ? str2.concat(valueOf2) : new String(str2)); } } } } public final synchronized void ME() { this.bqd.edit().clear().commit(); } public final synchronized void dD(String str) { Editor edit = this.bqd.edit(); for (String str2 : this.bqd.getAll().keySet()) { if (str2.startsWith(str)) { edit.remove(str2); } } edit.commit(); } public final void dE(String str) { dD(String.valueOf(str).concat("|T|")); } public final boolean isEmpty() { return this.bqd.getAll().isEmpty(); } }
1,997
0.561342
0.551327
62
31.209677
25.374063
120
false
false
0
0
0
0
0
0
0.612903
false
false
9
7a08a2685600fe101055a6d70b326c611e68c26c
5,514,738,061,110
e26cb6fe331a582e8946d155d91970afeaaa5e9f
/Strategy/src/strategy_Amazon/OfferTime.java
f2138c3a4ac871d3ee4069722e19676801348ab0
[]
no_license
tanu02/Design-Patterns
https://github.com/tanu02/Design-Patterns
a84fb90b1e4b21ebf2792a8e3bc6f60645253bd6
dd88cc470ad13510d3814342d636a7e62ba0cda3
refs/heads/master
2020-03-30T08:20:50.405000
2018-11-07T19:42:28
2018-11-07T19:42:28
151,007,826
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package strategy_Amazon; import java.util.HashMap; public class OfferTime implements IEvent{ public static HashMap<String, Integer> itemPrice = new HashMap<String, Integer>(); static{ itemPrice.put(jeans, 1500); itemPrice.put(shirt,1000); } @Override public int getPrice(String item) { // TODO Auto-generated method stub return itemPrice.get(item); } }
UTF-8
Java
373
java
OfferTime.java
Java
[]
null
[]
package strategy_Amazon; import java.util.HashMap; public class OfferTime implements IEvent{ public static HashMap<String, Integer> itemPrice = new HashMap<String, Integer>(); static{ itemPrice.put(jeans, 1500); itemPrice.put(shirt,1000); } @Override public int getPrice(String item) { // TODO Auto-generated method stub return itemPrice.get(item); } }
373
0.734584
0.713137
20
17.65
20.857313
83
false
false
0
0
0
0
0
0
1.2
false
false
9
16dc8107e55ca9bdb9e06587648b1403a4eace9f
11,630,771,465,613
5f39d0dfe7f94a724ae59ae86922f218c21092a5
/ARRAYLIST-GESTIONE BIBLIOTECA/src/it/guidofonzo/hotmail/classi/Prestito.java
0f327b0a7e962528eda59f64ce697d85c75598dd
[]
no_license
jayeffe/PROGRAMMAZIONE-2
https://github.com/jayeffe/PROGRAMMAZIONE-2
3caaf9cf115c2130b71d5b172793c63751817199
68ed28335b0d1b17025b547c480cf3ae2cef4064
refs/heads/master
2020-04-07T05:17:15.951000
2018-12-04T10:23:00
2018-12-04T10:23:00
158,090,675
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package it.guidofonzo.hotmail.classi; import java.io.PrintStream; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Scanner; import it.guidofonzo.hotmail.util.Costanti; public class Prestito { public Prestito(String identificatoreUtente, String pubblicazione, Date dataPrestito, Date dataConsegna) { this.identificatoreUtente=identificatoreUtente; this.pubblicazione = pubblicazione; this.dataPrestito = dataPrestito; this.dataConsegna = dataConsegna; this.pubblicazioni=pubblicazioni; } public void AddUtente(Utente u) { this.utente=u; } public void addPubblicazione(Pubblicazione p) { this.pubblicazioni.add(p); } public static Prestito read(Scanner s) { if(!s.hasNextLine()) return null; String identificatoreUtente = s.nextLine(); if(!s.hasNextLine()) return null; String pubblicazione = s.nextLine(); if(!s.hasNextLine()) return null; String dataP=s.nextLine(); Date dataPrestito; SimpleDateFormat sdf = new SimpleDateFormat(Costanti.DATEFORMAT); try { dataPrestito = sdf.parse(dataP); } catch(ParseException e) { System.err.println("GENERATA ECCEZIONE NELLA GESTIONE DELLA DATA "); dataPrestito=new Date(); } if(!s.hasNextLine()) return null; String dataC=s.nextLine(); Date dataConsegna; if(dataC.equals("-")) dataConsegna = null; else { try { dataConsegna=sdf.parse(dataC); } catch(ParseException e) { System.err.println("GENERATA ECCEZIONE NELLA DATA DI CONSEGNA"); dataConsegna=new Date(); } } return new Prestito(identificatoreUtente, pubblicazione, dataPrestito, dataConsegna); } public String getIdentificatoreUtente() { return identificatoreUtente; } public String getPubblicazione() { return pubblicazione; } public Date getDataPrestito() { return dataPrestito; } public Date getDataConsegna() { return dataConsegna; } public Utente getUtente() { return utente; } public void print(PrintStream ps) { ps.println("identificatore utente "+identificatoreUtente); ps.println("pubblicazione "+pubblicazione); SimpleDateFormat sdf = new SimpleDateFormat(Costanti.DATEFORMAT); ps.println("Data prestito "+sdf.format(dataPrestito)); if(dataConsegna!=null) { ps.println("data consegna "+sdf.format(dataConsegna)); } else { ps.println("In attesa di consegna "); } } private String identificatoreUtente; private String pubblicazione; private Date dataPrestito; private Date dataConsegna; private Utente utente; private ArrayList<Pubblicazione> pubblicazioni; }
UTF-8
Java
2,752
java
Prestito.java
Java
[]
null
[]
package it.guidofonzo.hotmail.classi; import java.io.PrintStream; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Scanner; import it.guidofonzo.hotmail.util.Costanti; public class Prestito { public Prestito(String identificatoreUtente, String pubblicazione, Date dataPrestito, Date dataConsegna) { this.identificatoreUtente=identificatoreUtente; this.pubblicazione = pubblicazione; this.dataPrestito = dataPrestito; this.dataConsegna = dataConsegna; this.pubblicazioni=pubblicazioni; } public void AddUtente(Utente u) { this.utente=u; } public void addPubblicazione(Pubblicazione p) { this.pubblicazioni.add(p); } public static Prestito read(Scanner s) { if(!s.hasNextLine()) return null; String identificatoreUtente = s.nextLine(); if(!s.hasNextLine()) return null; String pubblicazione = s.nextLine(); if(!s.hasNextLine()) return null; String dataP=s.nextLine(); Date dataPrestito; SimpleDateFormat sdf = new SimpleDateFormat(Costanti.DATEFORMAT); try { dataPrestito = sdf.parse(dataP); } catch(ParseException e) { System.err.println("GENERATA ECCEZIONE NELLA GESTIONE DELLA DATA "); dataPrestito=new Date(); } if(!s.hasNextLine()) return null; String dataC=s.nextLine(); Date dataConsegna; if(dataC.equals("-")) dataConsegna = null; else { try { dataConsegna=sdf.parse(dataC); } catch(ParseException e) { System.err.println("GENERATA ECCEZIONE NELLA DATA DI CONSEGNA"); dataConsegna=new Date(); } } return new Prestito(identificatoreUtente, pubblicazione, dataPrestito, dataConsegna); } public String getIdentificatoreUtente() { return identificatoreUtente; } public String getPubblicazione() { return pubblicazione; } public Date getDataPrestito() { return dataPrestito; } public Date getDataConsegna() { return dataConsegna; } public Utente getUtente() { return utente; } public void print(PrintStream ps) { ps.println("identificatore utente "+identificatoreUtente); ps.println("pubblicazione "+pubblicazione); SimpleDateFormat sdf = new SimpleDateFormat(Costanti.DATEFORMAT); ps.println("Data prestito "+sdf.format(dataPrestito)); if(dataConsegna!=null) { ps.println("data consegna "+sdf.format(dataConsegna)); } else { ps.println("In attesa di consegna "); } } private String identificatoreUtente; private String pubblicazione; private Date dataPrestito; private Date dataConsegna; private Utente utente; private ArrayList<Pubblicazione> pubblicazioni; }
2,752
0.705305
0.705305
108
23.481482
21.358702
106
false
false
0
0
0
0
0
0
1.027778
false
false
9
a0a5604ed5685e3e5ae1c60499fd476b89f15092
35,003,983,472,356
f6e0256fb80f64f6b9a75ecf895651a727bfce7b
/src/main/java/com/yihaodian/backend/sales/sharding/util/BusyDbContext.java
1508da330cae6ef83dfa8a38d0cfe3084fd875a1
[]
no_license
lcinshu/product-sales-quartz
https://github.com/lcinshu/product-sales-quartz
218800a8fecc98e16367c52c81d4b2ab7b8cfcc3
8fe5840037a8f7b4b86b39de4bc3a782d664ce76
refs/heads/master
2018-02-06T20:20:00.151000
2017-06-28T07:55:04
2017-06-28T07:55:04
95,642,991
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yihaodian.backend.sales.sharding.util; import com.yihaodian.ydd.util.DynamicDbContext; /** * Created by tiandongwei on 2017/6/12. */ public class BusyDbContext { public static boolean switchToMasterDB() { DynamicDbContext.switchToMasterDB(); return true; } public static boolean switchToSlaveDB() { DynamicDbContext.switchToSlaveDB(); return true; } public static boolean isMasterDB() { return DynamicDbContext.isMasterDB(); } public static void reset() { DynamicDbContext.reset(); } }
UTF-8
Java
585
java
BusyDbContext.java
Java
[ { "context": "dian.ydd.util.DynamicDbContext;\n\n/**\n * Created by tiandongwei on 2017/6/12.\n */\npublic class BusyDbContext {\n ", "end": 130, "score": 0.9995299577713013, "start": 119, "tag": "USERNAME", "value": "tiandongwei" } ]
null
[]
package com.yihaodian.backend.sales.sharding.util; import com.yihaodian.ydd.util.DynamicDbContext; /** * Created by tiandongwei on 2017/6/12. */ public class BusyDbContext { public static boolean switchToMasterDB() { DynamicDbContext.switchToMasterDB(); return true; } public static boolean switchToSlaveDB() { DynamicDbContext.switchToSlaveDB(); return true; } public static boolean isMasterDB() { return DynamicDbContext.isMasterDB(); } public static void reset() { DynamicDbContext.reset(); } }
585
0.670085
0.65812
26
21.5
19.19385
50
false
false
0
0
0
0
0
0
0.307692
false
false
9
0107bb1d341db2282ebb6753a860daa1a0f4fe20
31,301,721,677,226
a1a26e747fb17516c4f7cac313ac40db2403701d
/designpattern/src/test/java/com/feng/android/designpattern/bridge_pattern/CoffeeAdditives.java
d132741a624293c9ed0b173d9a9914e5668520bb
[]
no_license
gaoge/TC
https://github.com/gaoge/TC
5dfb38e6227abac4c9b7f196b31055663efad150
09bfb170a6fb4f9a4ac0f6619ca82c00e937ebe3
refs/heads/master
2023-07-10T00:19:57.284000
2021-08-13T09:28:27
2021-08-13T09:28:27
393,225,958
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.feng.android.designpattern.bridge_pattern; /** * @author gaoge * @version V1.0 * @date 2021-07-23 11:47 * @tips * 给咖啡加的一些料 */ public interface CoffeeAdditives { }
UTF-8
Java
198
java
CoffeeAdditives.java
Java
[ { "context": "roid.designpattern.bridge_pattern;\n\n/**\n * @author gaoge\n * @version V1.0\n * @date 2021-07-23 11:47\n * @ti", "end": 76, "score": 0.9996177554130554, "start": 71, "tag": "USERNAME", "value": "gaoge" } ]
null
[]
package com.feng.android.designpattern.bridge_pattern; /** * @author gaoge * @version V1.0 * @date 2021-07-23 11:47 * @tips * 给咖啡加的一些料 */ public interface CoffeeAdditives { }
198
0.692308
0.615385
11
15.545455
15.824972
54
false
false
0
0
0
0
0
0
0.090909
false
false
9
77280f1d54b969620919c91c03faf913b3d9a28d
21,157,008,931,011
f05c0af6b8010f5c84b0491753a370a0272fb45a
/src/main/java/com/sist/dao/ResultVO.java
b0c7e8d1ce71a9134d332d4e1ebc59d7c3a15e79
[]
no_license
inyeong2/BigBook
https://github.com/inyeong2/BigBook
4a670cca0d6c49ac05559a3eba34cad3841fd4c9
7adfcc363e3763c9e5f7354e0e640190c52fe4a7
refs/heads/master
2020-04-15T20:52:55.556000
2019-01-18T07:41:41
2019-01-18T07:41:41
162,649,229
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sist.dao; public class ResultVO { private String year; private String month; private int loan_count; public String getYear() { return year; } public void setYear(String year) { this.year = year; } public String getMonth() { return month; } public void setMonth(String month) { this.month = month; } public int getLoan_count() { return loan_count; } public void setLoan_count(int loan_count) { this.loan_count = loan_count; } }
UTF-8
Java
470
java
ResultVO.java
Java
[]
null
[]
package com.sist.dao; public class ResultVO { private String year; private String month; private int loan_count; public String getYear() { return year; } public void setYear(String year) { this.year = year; } public String getMonth() { return month; } public void setMonth(String month) { this.month = month; } public int getLoan_count() { return loan_count; } public void setLoan_count(int loan_count) { this.loan_count = loan_count; } }
470
0.689362
0.689362
27
16.407408
13.036301
44
false
false
0
0
0
0
0
0
1.407407
false
false
9
1d46e7b30e087d17d8c4dee834b7df280bebaf9a
20,392,504,756,800
cf80cb864a88dae6a173f188a5bf79c9191b8cd4
/app/src/main/java/com/andwho/myplan/view/ScrollViewLocker.java
ffeb50e2cd5924093636f36c5e8206716f0e0246
[]
no_license
1shawn/MyPlanForAS
https://github.com/1shawn/MyPlanForAS
ed3276107ec3f4b5c1335ca81d6d5cf937b45714
cd3590a59b2428cbbe8088e6f0b17caa90bfb750
refs/heads/master
2020-04-06T07:04:12.788000
2016-08-21T02:01:55
2016-08-21T02:01:55
44,851,645
3
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.andwho.myplan.view; public interface ScrollViewLocker { public void setCanScroll(boolean isCanScroll); }
UTF-8
Java
119
java
ScrollViewLocker.java
Java
[]
null
[]
package com.andwho.myplan.view; public interface ScrollViewLocker { public void setCanScroll(boolean isCanScroll); }
119
0.815126
0.815126
5
22.799999
18.956793
47
false
false
0
0
0
0
0
0
0.6
false
false
9
b85daa1e9da4374a1ab397217580c9c6a8703c5d
14,774,687,563,928
6511f9cd8fbd37499294e5a9f50a4bc73b75ed8e
/lib/lib-validation/src/test/java/com/gainmatrix/lib/validation/validators/js/JsExpressionValidatorTest.java
3e3128b1a3727cbf507c2aaf0815000dd917a07a
[ "Apache-2.0" ]
permissive
mazurkin/gainmatrix
https://github.com/mazurkin/gainmatrix
736cce1e97d83c987ac0a4fab96bd5ac31cba952
296766e8516035275287954ffe85dcecbcd9bebe
refs/heads/master
2021-03-12T23:39:23.105000
2015-09-30T15:29:44
2015-09-30T15:29:44
41,808,921
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gainmatrix.lib.validation.validators.js; import com.google.common.collect.Lists; import org.hibernate.validator.engine.PathImpl; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.Validator; import javax.validation.ValidatorFactory; import java.util.List; import java.util.Set; public class JsExpressionValidatorTest { private Validator validator; @Before public void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); } @Test public void testValidBeanA() throws Exception { TestBeanA testBean = new TestBeanA(); testBean.setValue1("aaaaa"); testBean.setValue2("aaaaa"); Set<ConstraintViolation<TestBeanA>> constraintViolationsSet = validator.validate(testBean); Assert.assertEquals(0, constraintViolationsSet.size()); } @Test public void testInvalidBeanA() throws Exception { TestBeanA testBean = new TestBeanA(); testBean.setValue1("aaaaa"); testBean.setValue2("bbbbb"); Set<ConstraintViolation<TestBeanA>> constraintViolationsSet = validator.validate(testBean); Assert.assertEquals(1, constraintViolationsSet.size()); List<ConstraintViolation<TestBeanA>> constraintViolationsList = Lists.newArrayList(constraintViolationsSet); ConstraintViolation<TestBeanA> violation = constraintViolationsList.get(0); Assert.assertNotNull(violation); Assert.assertEquals("{com.gainmatrix.validator.constraints.Js.message}", violation.getMessage()); Assert.assertEquals(PathImpl.createPathFromString(""), violation.getPropertyPath()); } @Test public void testInvalidBeanBCase1() throws Exception { TestBeanB testBean = new TestBeanB(); testBean.setValue1("bbbbb"); testBean.setValue2("bbbbb"); Set<ConstraintViolation<TestBeanB>> constraintViolationsSet = validator.validate(testBean); Assert.assertEquals(1, constraintViolationsSet.size()); List<ConstraintViolation<TestBeanB>> constraintViolationsList = Lists.newArrayList(constraintViolationsSet); ConstraintViolation<TestBeanB> violation = constraintViolationsList.get(0); Assert.assertNotNull(violation); Assert.assertEquals("error.validation.wrong.value", violation.getMessage()); Assert.assertEquals(PathImpl.createPathFromString("value1"), violation.getPropertyPath()); } @Test public void testInvalidBeanBCase2() throws Exception { TestBeanB testBean = new TestBeanB(); testBean.setValue1("aaaaa"); testBean.setValue2("bbbbb"); Set<ConstraintViolation<TestBeanB>> constraintViolationsSet = validator.validate(testBean); Assert.assertEquals(1, constraintViolationsSet.size()); List<ConstraintViolation<TestBeanB>> constraintViolationsList = Lists.newArrayList(constraintViolationsSet); ConstraintViolation<TestBeanB> violation = constraintViolationsList.get(0); Assert.assertNotNull(violation); Assert.assertEquals("error.validation.mismatch", violation.getMessage()); Assert.assertEquals(PathImpl.createPathFromString(""), violation.getPropertyPath()); } @Test public void testFunctionValid() throws Exception { TestBeanC testBean = new TestBeanC(); testBean.setValue1("value1"); testBean.setValue2("value1"); Set<ConstraintViolation<TestBeanC>> constraintViolationsSet = validator.validate(testBean); Assert.assertEquals(0, constraintViolationsSet.size()); } @Test public void testFunctionInvalid() throws Exception { TestBeanC testBean = new TestBeanC(); testBean.setValue1("value1"); testBean.setValue2("value2"); Set<ConstraintViolation<TestBeanC>> constraintViolationsSet = validator.validate(testBean); Assert.assertEquals(1, constraintViolationsSet.size()); List<ConstraintViolation<TestBeanC>> constraintViolationsList = Lists.newArrayList(constraintViolationsSet); ConstraintViolation<TestBeanC> violation = constraintViolationsList.get(0); Assert.assertNotNull(violation); Assert.assertEquals("error.validation.function", violation.getMessage()); Assert.assertEquals(PathImpl.createPathFromString(""), violation.getPropertyPath()); } @JsExpression("bean.value1 == bean.value2") private static class TestBeanA { private String value1; private String value2; public String getValue1() { return value1; } public void setValue1(String value1) { this.value1 = value1; } public String getValue2() { return value2; } public void setValue2(String value2) { this.value2 = value2; } } @JsExpression.List({ @JsExpression(value = "bean.value1 == bean.value2", message = "error.validation.mismatch"), @JsExpression(value = "bean.value1 == 'aaaaa'", message = "error.validation.wrong.value", subpath = "value1") }) private static class TestBeanB { private String value1; private String value2; public String getValue1() { return value1; } public void setValue1(String value1) { this.value1 = value1; } public String getValue2() { return value2; } public void setValue2(String value2) { this.value2 = value2; } } @JsExpression(value = "bean.isValid()", message = "error.validation.function") private static class TestBeanC { private String value1; private String value2; public String getValue1() { return value1; } public void setValue1(String value1) { this.value1 = value1; } public String getValue2() { return value2; } public void setValue2(String value2) { this.value2 = value2; } public boolean isValid() { return (value1 != null) && (value2 != null) && (value1.equals(value2)); } } }
UTF-8
Java
6,375
java
JsExpressionValidatorTest.java
Java
[]
null
[]
package com.gainmatrix.lib.validation.validators.js; import com.google.common.collect.Lists; import org.hibernate.validator.engine.PathImpl; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.Validator; import javax.validation.ValidatorFactory; import java.util.List; import java.util.Set; public class JsExpressionValidatorTest { private Validator validator; @Before public void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); } @Test public void testValidBeanA() throws Exception { TestBeanA testBean = new TestBeanA(); testBean.setValue1("aaaaa"); testBean.setValue2("aaaaa"); Set<ConstraintViolation<TestBeanA>> constraintViolationsSet = validator.validate(testBean); Assert.assertEquals(0, constraintViolationsSet.size()); } @Test public void testInvalidBeanA() throws Exception { TestBeanA testBean = new TestBeanA(); testBean.setValue1("aaaaa"); testBean.setValue2("bbbbb"); Set<ConstraintViolation<TestBeanA>> constraintViolationsSet = validator.validate(testBean); Assert.assertEquals(1, constraintViolationsSet.size()); List<ConstraintViolation<TestBeanA>> constraintViolationsList = Lists.newArrayList(constraintViolationsSet); ConstraintViolation<TestBeanA> violation = constraintViolationsList.get(0); Assert.assertNotNull(violation); Assert.assertEquals("{com.gainmatrix.validator.constraints.Js.message}", violation.getMessage()); Assert.assertEquals(PathImpl.createPathFromString(""), violation.getPropertyPath()); } @Test public void testInvalidBeanBCase1() throws Exception { TestBeanB testBean = new TestBeanB(); testBean.setValue1("bbbbb"); testBean.setValue2("bbbbb"); Set<ConstraintViolation<TestBeanB>> constraintViolationsSet = validator.validate(testBean); Assert.assertEquals(1, constraintViolationsSet.size()); List<ConstraintViolation<TestBeanB>> constraintViolationsList = Lists.newArrayList(constraintViolationsSet); ConstraintViolation<TestBeanB> violation = constraintViolationsList.get(0); Assert.assertNotNull(violation); Assert.assertEquals("error.validation.wrong.value", violation.getMessage()); Assert.assertEquals(PathImpl.createPathFromString("value1"), violation.getPropertyPath()); } @Test public void testInvalidBeanBCase2() throws Exception { TestBeanB testBean = new TestBeanB(); testBean.setValue1("aaaaa"); testBean.setValue2("bbbbb"); Set<ConstraintViolation<TestBeanB>> constraintViolationsSet = validator.validate(testBean); Assert.assertEquals(1, constraintViolationsSet.size()); List<ConstraintViolation<TestBeanB>> constraintViolationsList = Lists.newArrayList(constraintViolationsSet); ConstraintViolation<TestBeanB> violation = constraintViolationsList.get(0); Assert.assertNotNull(violation); Assert.assertEquals("error.validation.mismatch", violation.getMessage()); Assert.assertEquals(PathImpl.createPathFromString(""), violation.getPropertyPath()); } @Test public void testFunctionValid() throws Exception { TestBeanC testBean = new TestBeanC(); testBean.setValue1("value1"); testBean.setValue2("value1"); Set<ConstraintViolation<TestBeanC>> constraintViolationsSet = validator.validate(testBean); Assert.assertEquals(0, constraintViolationsSet.size()); } @Test public void testFunctionInvalid() throws Exception { TestBeanC testBean = new TestBeanC(); testBean.setValue1("value1"); testBean.setValue2("value2"); Set<ConstraintViolation<TestBeanC>> constraintViolationsSet = validator.validate(testBean); Assert.assertEquals(1, constraintViolationsSet.size()); List<ConstraintViolation<TestBeanC>> constraintViolationsList = Lists.newArrayList(constraintViolationsSet); ConstraintViolation<TestBeanC> violation = constraintViolationsList.get(0); Assert.assertNotNull(violation); Assert.assertEquals("error.validation.function", violation.getMessage()); Assert.assertEquals(PathImpl.createPathFromString(""), violation.getPropertyPath()); } @JsExpression("bean.value1 == bean.value2") private static class TestBeanA { private String value1; private String value2; public String getValue1() { return value1; } public void setValue1(String value1) { this.value1 = value1; } public String getValue2() { return value2; } public void setValue2(String value2) { this.value2 = value2; } } @JsExpression.List({ @JsExpression(value = "bean.value1 == bean.value2", message = "error.validation.mismatch"), @JsExpression(value = "bean.value1 == 'aaaaa'", message = "error.validation.wrong.value", subpath = "value1") }) private static class TestBeanB { private String value1; private String value2; public String getValue1() { return value1; } public void setValue1(String value1) { this.value1 = value1; } public String getValue2() { return value2; } public void setValue2(String value2) { this.value2 = value2; } } @JsExpression(value = "bean.isValid()", message = "error.validation.function") private static class TestBeanC { private String value1; private String value2; public String getValue1() { return value1; } public void setValue1(String value1) { this.value1 = value1; } public String getValue2() { return value2; } public void setValue2(String value2) { this.value2 = value2; } public boolean isValid() { return (value1 != null) && (value2 != null) && (value1.equals(value2)); } } }
6,375
0.674824
0.662118
194
31.860825
31.779301
117
false
false
0
0
0
0
0
0
0.530928
false
false
9
a3f357946f4925923cafa06b6bdb8dfd510c98db
30,150,670,446,209
81309621a3d3af1f299c5c9101dc93a8e5ae3e85
/src/controllers/EditStudentController.java
14a864b0e4f5d12daf224ad7ec5ae07b8ddb4fb6
[]
no_license
Viniciuslb067/javafx-crud
https://github.com/Viniciuslb067/javafx-crud
f061fc61b8927745a2efe8c93974709e70229cea
6cf20ddb845eb9f6993b991795df60a40d35ed8c
refs/heads/main
2023-07-15T20:51:09.068000
2021-08-25T16:10:37
2021-08-25T16:10:37
393,050,078
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controllers; import database.ConnectionFactory; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.stage.Stage; import utils.Data; import java.io.IOException; import java.net.URL; import java.sql.Connection; import java.sql.Statement; import java.util.ResourceBundle; public class EditStudentController implements Initializable { @FXML private TextField textFieldName; @FXML private TextField textFieldAge; @FXML private TextField textFieldPhone; @FXML private TextField textFieldParentsPhone; @FXML private Button btnNewStudent; @FXML private Button btnDeleteStudent; private Parent root; private Integer id; @FXML public void switchBack() throws IOException { root = FXMLLoader.load(getClass().getResource("../views/dashboard.fxml")); Stage window = (Stage) btnNewStudent.getScene().getWindow(); window.setScene(new Scene(root)); } @FXML public void handleButtonAction(ActionEvent event) throws Exception { if (event.getSource() == btnNewStudent) { updateById(); } if (event.getSource() == btnDeleteStudent) { deleteById(); } } @Override public void initialize(URL location, ResourceBundle resources) { id = Data.studentId; textFieldName.setText(Data.studentName); textFieldAge.setText(String.valueOf(Data.studentAge)); textFieldPhone.setText(String.valueOf(Data.studentPhone)); textFieldParentsPhone.setText(String.valueOf(Data.studentParentsPhone)); } private void Information() { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setContentText("Aluno atualizado com sucesso!"); alert.showAndWait(); } private void deleteById() throws Exception { String query = "DELETE FROM alunos WHERE id = " + id; executeQuery(query); switchBack(); } private void updateById() throws Exception { String query = "UPDATE alunos SET nome = '" + textFieldName.getText() + "',idade = '" + textFieldAge.getText() + "',telefone = '" + textFieldPhone.getText() + "',telefonePais = '" + textFieldParentsPhone.getText() + "' WHERE id = '" + id + "'"; executeQuery(query); Information(); switchBack(); } private void executeQuery(String query) throws Exception { Connection conn; conn = ConnectionFactory.connectToMySql(); Statement st; try { st = conn.createStatement(); st.executeUpdate(query); } catch (Exception ex) { ex.printStackTrace(); } } }
UTF-8
Java
2,958
java
EditStudentController.java
Java
[]
null
[]
package controllers; import database.ConnectionFactory; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.stage.Stage; import utils.Data; import java.io.IOException; import java.net.URL; import java.sql.Connection; import java.sql.Statement; import java.util.ResourceBundle; public class EditStudentController implements Initializable { @FXML private TextField textFieldName; @FXML private TextField textFieldAge; @FXML private TextField textFieldPhone; @FXML private TextField textFieldParentsPhone; @FXML private Button btnNewStudent; @FXML private Button btnDeleteStudent; private Parent root; private Integer id; @FXML public void switchBack() throws IOException { root = FXMLLoader.load(getClass().getResource("../views/dashboard.fxml")); Stage window = (Stage) btnNewStudent.getScene().getWindow(); window.setScene(new Scene(root)); } @FXML public void handleButtonAction(ActionEvent event) throws Exception { if (event.getSource() == btnNewStudent) { updateById(); } if (event.getSource() == btnDeleteStudent) { deleteById(); } } @Override public void initialize(URL location, ResourceBundle resources) { id = Data.studentId; textFieldName.setText(Data.studentName); textFieldAge.setText(String.valueOf(Data.studentAge)); textFieldPhone.setText(String.valueOf(Data.studentPhone)); textFieldParentsPhone.setText(String.valueOf(Data.studentParentsPhone)); } private void Information() { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setContentText("Aluno atualizado com sucesso!"); alert.showAndWait(); } private void deleteById() throws Exception { String query = "DELETE FROM alunos WHERE id = " + id; executeQuery(query); switchBack(); } private void updateById() throws Exception { String query = "UPDATE alunos SET nome = '" + textFieldName.getText() + "',idade = '" + textFieldAge.getText() + "',telefone = '" + textFieldPhone.getText() + "',telefonePais = '" + textFieldParentsPhone.getText() + "' WHERE id = '" + id + "'"; executeQuery(query); Information(); switchBack(); } private void executeQuery(String query) throws Exception { Connection conn; conn = ConnectionFactory.connectToMySql(); Statement st; try { st = conn.createStatement(); st.executeUpdate(query); } catch (Exception ex) { ex.printStackTrace(); } } }
2,958
0.658891
0.658891
104
27.442308
24.056755
102
false
false
0
0
0
0
0
0
0.538462
false
false
9
0eddb0a7b0cad122e570fa726092cd1f770331e6
22,763,326,721,205
31be5884031ec36e6b39837c02716faa808944db
/LeetCode/207.java
4e2150b325cfd7dc962f066bec0536757d19b4fe
[]
no_license
a1398394385/datastructure
https://github.com/a1398394385/datastructure
cf3a3c475186957c6661c1cae7cd8870d92c2629
184261042cb136f6816648ff31d613879145c452
refs/heads/master
2020-07-30T21:02:23.674000
2020-07-13T13:25:59
2020-07-13T13:25:59
210,357,889
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; class Solution { public boolean canFinish(int numCourses, int[][] prerequisites) { boolean[] isChildArr = new boolean[numCourses]; int[] fatherNumber = new int[numCourses]; List<List<Integer>> tree = new ArrayList<>(); for (int i = 0; i < numCourses; i++) tree.add(new ArrayList<>()); for (int i = 0, len = prerequisites.length; i < len; i++) { int child = prerequisites[i][0], father = prerequisites[i][1]; isChildArr[child] = true; fatherNumber[child]++; tree.get(father).add(child); } Queue<Integer> queue = new LinkedList<>(); for (int i = 0; i < numCourses; i++) if (isChildArr[i] == false) queue.add(i); while (queue.isEmpty() == false) { int father = queue.poll(); for (int child : tree.get(father)) { if (--fatherNumber[child] == 0) queue.add(child); } } for (int i = 0; i < numCourses; i++) if (fatherNumber[i] != 0) return false; return true; } }
UTF-8
Java
1,255
java
207.java
Java
[]
null
[]
import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; class Solution { public boolean canFinish(int numCourses, int[][] prerequisites) { boolean[] isChildArr = new boolean[numCourses]; int[] fatherNumber = new int[numCourses]; List<List<Integer>> tree = new ArrayList<>(); for (int i = 0; i < numCourses; i++) tree.add(new ArrayList<>()); for (int i = 0, len = prerequisites.length; i < len; i++) { int child = prerequisites[i][0], father = prerequisites[i][1]; isChildArr[child] = true; fatherNumber[child]++; tree.get(father).add(child); } Queue<Integer> queue = new LinkedList<>(); for (int i = 0; i < numCourses; i++) if (isChildArr[i] == false) queue.add(i); while (queue.isEmpty() == false) { int father = queue.poll(); for (int child : tree.get(father)) { if (--fatherNumber[child] == 0) queue.add(child); } } for (int i = 0; i < numCourses; i++) if (fatherNumber[i] != 0) return false; return true; } }
1,255
0.520319
0.513944
37
32.918919
19.480244
74
false
false
0
0
0
0
0
0
0.783784
false
false
9
33bcff301441755e820276496d83ac47e30aef52
8,864,812,538,658
4a90f94d44bb1bf1da4b9c7f5b7fa8c3084b492b
/reduxlib/src/main/java/me/jamesxu/reduxlib/state/State.java
8995ef72dc3aed665f7aaa7f6afe4c591e267add
[]
no_license
fjg1989/ReduxAndroid
https://github.com/fjg1989/ReduxAndroid
bdaf67d5d08ece12f18f78d822f7be551b61f60e
c09dd0a22b1aa39834101391ed04b5d649177edb
refs/heads/master
2021-01-21T15:04:41.820000
2016-07-04T14:26:06
2016-07-04T14:26:06
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.jamesxu.reduxlib.state; /** * Created by mobilexu on 2/7/16. */ public interface State { }
UTF-8
Java
105
java
State.java
Java
[ { "context": "kage me.jamesxu.reduxlib.state;\n\n/**\n * Created by mobilexu on 2/7/16.\n */\npublic interface State {\n}\n", "end": 62, "score": 0.9992884993553162, "start": 54, "tag": "USERNAME", "value": "mobilexu" } ]
null
[]
package me.jamesxu.reduxlib.state; /** * Created by mobilexu on 2/7/16. */ public interface State { }
105
0.685714
0.647619
7
14
14.481515
34
false
false
0
0
0
0
0
0
0.142857
false
false
9
e599e1ef81b97d3d2d20a63d3e9de0f138b160a4
13,022,340,896,487
d3ef75b2b2b5a37733574796dcd597ff4ed47809
/src/main/java/collectionPractice/ArrayListPractice2.java
0540b07fee4b64b303634dab9dbd9ec6d3ceabd8
[]
no_license
mukesh2588/CGPracticeProject
https://github.com/mukesh2588/CGPracticeProject
03191dc7083a849f765d687851fa66eb4a893461
7808a59698e891103712ae051b061cb48314d1c3
refs/heads/master
2023-06-16T21:55:59.424000
2021-06-21T05:57:19
2021-06-21T05:57:19
289,836,273
0
0
null
false
2021-06-21T05:57:20
2020-08-24T05:28:20
2021-06-09T18:32:01
2021-06-21T05:57:19
192
0
0
0
Java
false
false
package collectionPractice; import java.util.ArrayList; import java.util.Iterator; public class ArrayListPractice2 { public static void main(String[] args) { ArrayList<String> arrlst=new ArrayList<>(); arrlst.add("Mukesh"); arrlst.add("TestClass"); arrlst.add("khedkar"); // Displaying the list System.out.println("The list is: \n"+ arrlst); Iterator<String> iter=arrlst.iterator(); // Displaying the values after iterating // through the list System.out.println("\nThe iterator values" + " of list are: "); while (iter.hasNext()) { System.out.print(iter.next() + " "); } ArrayList<Integer> arrlstInt=new ArrayList<>(); arrlstInt.add(50); arrlstInt.add(22); arrlstInt.add(50); arrlstInt.add(27); System.out.println("\nThe Integer list is: \n"+ arrlstInt); Iterator<Integer> itrInt=arrlstInt.iterator(); System.out.println("\nThe iterator values" + " of list are: "); while(itrInt.hasNext()) { System.out.println(itrInt.next()); } } }
UTF-8
Java
1,163
java
ArrayListPractice2.java
Java
[ { "context": "t<String> arrlst=new ArrayList<>();\n\t\tarrlst.add(\"Mukesh\");\n\t\tarrlst.add(\"TestClass\");\n\t\tarrlst.add(\"khedk", "end": 228, "score": 0.9997386336326599, "start": 222, "tag": "NAME", "value": "Mukesh" }, { "context": "ayList<>();\n\t\tarrlst.add(\"Mukesh\");\n...
null
[]
package collectionPractice; import java.util.ArrayList; import java.util.Iterator; public class ArrayListPractice2 { public static void main(String[] args) { ArrayList<String> arrlst=new ArrayList<>(); arrlst.add("Mukesh"); arrlst.add("TestClass"); arrlst.add("khedkar"); // Displaying the list System.out.println("The list is: \n"+ arrlst); Iterator<String> iter=arrlst.iterator(); // Displaying the values after iterating // through the list System.out.println("\nThe iterator values" + " of list are: "); while (iter.hasNext()) { System.out.print(iter.next() + " "); } ArrayList<Integer> arrlstInt=new ArrayList<>(); arrlstInt.add(50); arrlstInt.add(22); arrlstInt.add(50); arrlstInt.add(27); System.out.println("\nThe Integer list is: \n"+ arrlstInt); Iterator<Integer> itrInt=arrlstInt.iterator(); System.out.println("\nThe iterator values" + " of list are: "); while(itrInt.hasNext()) { System.out.println(itrInt.next()); } } }
1,163
0.585555
0.577816
42
26.690475
19.818808
71
false
false
0
0
0
0
0
0
0.97619
false
false
9
35d78bbd0b7d5f2b942721449c82da3ab3f6d912
15,831,249,475,042
b574600ee0e13c218e39c0fd6bb88b3a4cd9fe84
/app/src/main/java/cn/eejing/colorflower/model/request/BuyRecordBean.java
ea3c6c79e2c28ab2b4085b84a3ac72b3268d2356
[]
no_license
taodaren/EJColorFlower
https://github.com/taodaren/EJColorFlower
9e47de55715505364d845c536c8a99edca1dfd0c
20c742d448e8b6218d180d86f3710229a45ec78f
refs/heads/master
2021-07-07T15:01:38.398000
2019-01-03T07:49:08
2019-01-03T07:49:08
132,958,192
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.eejing.colorflower.model.request; import java.util.List; /** * 购买记录实体类 */ public class BuyRecordBean { /** * code : 1 * message : 数据获取成功 * data : [{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-05 15:46:23"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-01 15:22:24"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-01 17:33:10"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-13 15:08:17"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-01 17:27:57"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-01 15:22:11"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-01 16:17:05"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-01 17:27:00"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-01 16:43:03"}] */ private int code; private String message; private List<DataBean> data; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public List<DataBean> getData() { return data; } public void setData(List<DataBean> data) { this.data = data; } public static class DataBean { /** * goods_sn : GSVOAM2514 * goods_name : 滑雪板(测试) * quantity : 1 * create_time : 2018-11-05 15:46:23 */ private String goods_sn; private String goods_name; private String quantity; private String create_time; public String getGoods_sn() { return goods_sn; } public void setGoods_sn(String goods_sn) { this.goods_sn = goods_sn; } public String getGoods_name() { return goods_name; } public void setGoods_name(String goods_name) { this.goods_name = goods_name; } public String getQuantity() { return quantity; } public void setQuantity(String quantity) { this.quantity = quantity; } public String getCreate_time() { return create_time; } public void setCreate_time(String create_time) { this.create_time = create_time; } } }
UTF-8
Java
2,802
java
BuyRecordBean.java
Java
[]
null
[]
package cn.eejing.colorflower.model.request; import java.util.List; /** * 购买记录实体类 */ public class BuyRecordBean { /** * code : 1 * message : 数据获取成功 * data : [{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-05 15:46:23"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-01 15:22:24"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-01 17:33:10"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-13 15:08:17"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-01 17:27:57"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-01 15:22:11"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-01 16:17:05"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-01 17:27:00"},{"goods_sn":"GSVOAM2514","goods_name":"滑雪板(测试)","quantity":"1","create_time":"2018-11-01 16:43:03"}] */ private int code; private String message; private List<DataBean> data; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public List<DataBean> getData() { return data; } public void setData(List<DataBean> data) { this.data = data; } public static class DataBean { /** * goods_sn : GSVOAM2514 * goods_name : 滑雪板(测试) * quantity : 1 * create_time : 2018-11-05 15:46:23 */ private String goods_sn; private String goods_name; private String quantity; private String create_time; public String getGoods_sn() { return goods_sn; } public void setGoods_sn(String goods_sn) { this.goods_sn = goods_sn; } public String getGoods_name() { return goods_name; } public void setGoods_name(String goods_name) { this.goods_name = goods_name; } public String getQuantity() { return quantity; } public void setQuantity(String quantity) { this.quantity = quantity; } public String getCreate_time() { return create_time; } public void setCreate_time(String create_time) { this.create_time = create_time; } } }
2,802
0.56988
0.498505
90
28.733334
95.387138
915
false
false
0
0
0
0
0
0
0.644444
false
false
9
3479aef8ad065aa3b80cf22bfefdcfacbb87e5a6
4,380,866,708,086
dc531888929aa837544800ffac63f41d234e25e4
/lab3_bai1/src/java/sample/model/LoginBean.java
55ccd402af379284b91ede69519c009d25c02a72
[]
no_license
thienx27/Lab3_java4
https://github.com/thienx27/Lab3_java4
3fa9a88f1d860cccd2755c5f22f8190cf88f4755
531a4cec29d02299187fa077da6b6941655e3a71
refs/heads/master
2020-07-21T19:25:38.154000
2019-09-07T12:44:44
2019-09-07T12:44:44
206,954,662
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sample.model; import java.sql.Connection; import java.sql.Driver; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; public class LoginBean { public Boolean checkLogin(String username, String password) { try{ Class.forName("cpm.microsoft.sqlserver.jdbc.sqlserverDriver"); String url ="jdbc:sqlserver://127.0.0.1:1433;databaseName=login"; Connection con =DriverManager.getConnection(url,"sa","123"); String sql = "select * from logins where username=? and password=?"; PreparedStatement stm = con.prepareStatement(sql); stm.setString(1, username); stm.setString(2, password); ResultSet rs =stm.executeQuery(); boolean result =rs.next(); rs.close(); stm.close(); con.close(); if(result){ return true; } }catch (Exception e) { e.printStackTrace(); } return false; } }
UTF-8
Java
896
java
LoginBean.java
Java
[ { "context": "erverDriver\");\n\t String url =\"jdbc:sqlserver://127.0.0.1:1433;databaseName=login\";\n\t Connection con =Dr", "end": 373, "score": 0.9997395277023315, "start": 364, "tag": "IP_ADDRESS", "value": "127.0.0.1" } ]
null
[]
package sample.model; import java.sql.Connection; import java.sql.Driver; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; public class LoginBean { public Boolean checkLogin(String username, String password) { try{ Class.forName("cpm.microsoft.sqlserver.jdbc.sqlserverDriver"); String url ="jdbc:sqlserver://127.0.0.1:1433;databaseName=login"; Connection con =DriverManager.getConnection(url,"sa","123"); String sql = "select * from logins where username=? and password=?"; PreparedStatement stm = con.prepareStatement(sql); stm.setString(1, username); stm.setString(2, password); ResultSet rs =stm.executeQuery(); boolean result =rs.next(); rs.close(); stm.close(); con.close(); if(result){ return true; } }catch (Exception e) { e.printStackTrace(); } return false; } }
896
0.69308
0.676339
34
25.352942
21.290543
72
false
false
0
0
0
0
0
0
1.441176
false
false
9
ec034222df2f9b5bfa91fee3ac23ab74f4483447
6,700,149,009,384
446da02cb9a822f02b34636d65635efcdd04a1bd
/quick-order-backend/src/main/java/ro/quickorder/backend/sendEmail/EmailTemplate.java
38d82d52e3dad92dba678733ca57136937819c39
[]
no_license
dorindan/quick-order
https://github.com/dorindan/quick-order
0a2cc0e8659ee87a833770609cc572afdf5fdb4b
9da1301f7a635cd2d5ab5ec6c5791a6fff55cd31
refs/heads/master
2023-01-10T17:51:37.671000
2019-08-29T08:39:42
2019-08-29T08:39:42
157,528,811
0
0
null
false
2023-01-07T02:35:21
2018-11-14T10:04:25
2019-08-29T08:41:12
2023-01-07T02:35:19
40,652
0
0
34
Java
false
false
package ro.quickorder.backend.sendEmail; import java.sql.Timestamp; /** * @author R. Lupoaie */ public class EmailTemplate { public static String createTextReservation(int numberOfPersons, Timestamp checkInTime, Timestamp checkOutTime, boolean confirmed) { StringBuilder mailText = new StringBuilder("The reservation you made for "); mailText.append(numberOfPersons + ""); mailText.append(" persons, starting on ").append(checkInTime + "").append(" to ").append(checkOutTime + ""); if (confirmed) { mailText.append(" has been confirmed."); } else { mailText.append(" has been made."); } return mailText.toString(); } public static String createTitleReservation() { return "Reservation made"; } }
UTF-8
Java
808
java
EmailTemplate.java
Java
[ { "context": "Email;\n\nimport java.sql.Timestamp;\n\n/**\n * @author R. Lupoaie\n */\npublic class EmailTemplate {\n\n public stat", "end": 95, "score": 0.999878466129303, "start": 85, "tag": "NAME", "value": "R. Lupoaie" } ]
null
[]
package ro.quickorder.backend.sendEmail; import java.sql.Timestamp; /** * @author <NAME> */ public class EmailTemplate { public static String createTextReservation(int numberOfPersons, Timestamp checkInTime, Timestamp checkOutTime, boolean confirmed) { StringBuilder mailText = new StringBuilder("The reservation you made for "); mailText.append(numberOfPersons + ""); mailText.append(" persons, starting on ").append(checkInTime + "").append(" to ").append(checkOutTime + ""); if (confirmed) { mailText.append(" has been confirmed."); } else { mailText.append(" has been made."); } return mailText.toString(); } public static String createTitleReservation() { return "Reservation made"; } }
804
0.65099
0.65099
27
28.925926
34.769001
135
false
false
0
0
0
0
0
0
0.481481
false
false
9
d43832c6222a8d30b02a47e1c33337fdeb370395
26,594,437,565,206
7ca468259d5c204025f8fc72de4f279f0962b1bf
/src/main/java/datastructures/graphs/HistogramDatasetPlus.java
e62f6edef657d318f8cfd477c4da4a2ddf0f201b
[]
no_license
sageshoyu/pan
https://github.com/sageshoyu/pan
2fe8e08020bcf6a732dbc9e80e04ebc85c535f6e
0995a48cc10313941f809b9c0be7b24c2393839f
refs/heads/master
2022-02-23T15:50:21.575000
2019-09-23T05:45:33
2019-09-23T05:45:33
103,810,094
1
0
null
false
2019-07-23T03:49:26
2017-09-17T07:10:07
2019-07-02T03:38:20
2019-07-23T03:49:26
210
1
0
0
Java
false
false
package datastructures.graphs; import datastructures.Annotatable; import datastructures.Batchable; import datastructures.Exportable; import org.jfree.data.statistics.HistogramDataset; import java.util.Arrays; import java.util.HashMap; import java.util.Map; public class HistogramDatasetPlus extends HistogramDataset implements Batchable, Annotatable, Exportable { private String batchKey; private Map<String, Double> annotations; public HistogramDatasetPlus() { super(); annotations = new HashMap<>(); } @Override public void setBatchKey(String key) { batchKey = key; } @Override public String getBatchKey() { return batchKey; } @Override public boolean isBatched() { return batchKey != null; } @Override public void removeFromBatch() { batchKey = null; } @Override public void addEntry(String entryName, double val) { annotations.put(entryName, val); } @Override public String[] getEntryNames() { return annotations.keySet().toArray(new String[0]); } @Override public double value(String entryName) { return annotations.get(entryName); } @Override public String[] header() { String[] keys = annotations.keySet().toArray(new String[0]); Arrays.sort(keys); return keys; } @Override public String[][] body() { String[] keys = annotations.keySet().toArray(new String[0]); Arrays.sort(keys); String[][] vals = new String[1][keys.length]; for (int i = 0; i < keys.length; i++) { vals[0][i] = "" + annotations.get(keys[i]); } return vals; } }
UTF-8
Java
1,739
java
HistogramDatasetPlus.java
Java
[]
null
[]
package datastructures.graphs; import datastructures.Annotatable; import datastructures.Batchable; import datastructures.Exportable; import org.jfree.data.statistics.HistogramDataset; import java.util.Arrays; import java.util.HashMap; import java.util.Map; public class HistogramDatasetPlus extends HistogramDataset implements Batchable, Annotatable, Exportable { private String batchKey; private Map<String, Double> annotations; public HistogramDatasetPlus() { super(); annotations = new HashMap<>(); } @Override public void setBatchKey(String key) { batchKey = key; } @Override public String getBatchKey() { return batchKey; } @Override public boolean isBatched() { return batchKey != null; } @Override public void removeFromBatch() { batchKey = null; } @Override public void addEntry(String entryName, double val) { annotations.put(entryName, val); } @Override public String[] getEntryNames() { return annotations.keySet().toArray(new String[0]); } @Override public double value(String entryName) { return annotations.get(entryName); } @Override public String[] header() { String[] keys = annotations.keySet().toArray(new String[0]); Arrays.sort(keys); return keys; } @Override public String[][] body() { String[] keys = annotations.keySet().toArray(new String[0]); Arrays.sort(keys); String[][] vals = new String[1][keys.length]; for (int i = 0; i < keys.length; i++) { vals[0][i] = "" + annotations.get(keys[i]); } return vals; } }
1,739
0.623922
0.620472
82
20.207317
20.873449
106
false
false
0
0
0
0
0
0
0.414634
false
false
9
a25535c1f64e52208e979d3ef1fab68501f9d79a
17,222,818,873,372
554d3ce0dd692823e1f8a9871db25fb66b14dc0a
/TPC15/sqlfw/src/main/java/pt/isel/mpd14/sqlfw/Binder.java
0e039f2a1ff635a4338f6c31ff560f2d57e9e926
[]
no_license
formiga90/MPD_1314v
https://github.com/formiga90/MPD_1314v
b2253ed51c16f994129004e8cea9e333a928df7e
0e151b582371625b21455b9b0ec15d83cef89ce5
refs/heads/master
2019-01-02T02:37:21.394000
2014-05-29T16:41:28
2014-05-29T16:41:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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 pt.isel.mpd14.sqlfw; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.SQLException; /** * * @author Tiago */ public interface Binder<T> { void bind(PreparedStatement ps, int idx, T o) throws SQLException; public static final Binder<Integer> bindInt = (ps,idx,i)->ps.setInt(idx, i); public static final Binder<Date> bindDate = (ps,idx,date)->ps.setDate(idx, date); public static final Binder<Long> bindLong = (ps,idx,l)->ps.setLong(idx, l); public static final Binder<Float> bindFloat= (ps,idx,f)->ps.setFloat(idx, f); public static final Binder<Double> bindDouble=(ps,idx,d)->ps.setDouble(idx, d); public static final Binder<String> bindString = (ps,idx,s) -> ps.setString(idx, s); }
UTF-8
Java
972
java
Binder.java
Java
[ { "context": "port java.sql.SQLException;\r\n\r\n/**\r\n *\r\n * @author Tiago\r\n */\r\npublic interface Binder<T> {\r\n void bind(P", "end": 341, "score": 0.9084501266479492, "start": 336, "tag": "NAME", "value": "Tiago" } ]
null
[]
/* * 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 pt.isel.mpd14.sqlfw; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.SQLException; /** * * @author Tiago */ public interface Binder<T> { void bind(PreparedStatement ps, int idx, T o) throws SQLException; public static final Binder<Integer> bindInt = (ps,idx,i)->ps.setInt(idx, i); public static final Binder<Date> bindDate = (ps,idx,date)->ps.setDate(idx, date); public static final Binder<Long> bindLong = (ps,idx,l)->ps.setLong(idx, l); public static final Binder<Float> bindFloat= (ps,idx,f)->ps.setFloat(idx, f); public static final Binder<Double> bindDouble=(ps,idx,d)->ps.setDouble(idx, d); public static final Binder<String> bindString = (ps,idx,s) -> ps.setString(idx, s); }
972
0.683128
0.68107
26
35.384617
33.713814
88
false
false
0
0
0
0
0
0
1.307692
false
false
9
ca3e4f70cdb0e5747766b59d6315af06701cf37f
29,669,634,137,888
ec33588c6b015b3bf53ad11cc742de5ec9a91c2e
/app/src/main/java/uz/samtuit/sammap/samapp/Hotels.java
9fcc943aa32087b635e0c12aeceb952ff09b5e90
[]
no_license
islommuhammad/Samapp
https://github.com/islommuhammad/Samapp
f9f3fb54035e8e87fd92c5e0e4fa5f7272527d96
45fa9be4410ed1742b3ae2773632cfc118742f78
refs/heads/master
2020-04-06T04:38:48.592000
2015-07-28T08:14:15
2015-07-28T08:14:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package uz.samtuit.sammap.samapp; /** * Created by sammap on 7/8/15. */ public class Hotels { public String Name; public int Reviews; public int Rating; public Hotels(String Name, int Reviews, int Rating) { this.Name = Name; this.Reviews = Reviews; this.Rating = Rating; } }
UTF-8
Java
326
java
Hotels.java
Java
[ { "context": "ckage uz.samtuit.sammap.samapp;\n\n/**\n * Created by sammap on 7/8/15.\n */\npublic class Hotels {\n public S", "end": 59, "score": 0.9995493292808533, "start": 53, "tag": "USERNAME", "value": "sammap" } ]
null
[]
package uz.samtuit.sammap.samapp; /** * Created by sammap on 7/8/15. */ public class Hotels { public String Name; public int Reviews; public int Rating; public Hotels(String Name, int Reviews, int Rating) { this.Name = Name; this.Reviews = Reviews; this.Rating = Rating; } }
326
0.613497
0.601227
16
19.375
14.890748
55
false
false
0
0
0
0
0
0
0.5625
false
false
9
88f79e668f3862444a5350016f200d859bfc96f2
11,381,663,354,506
8f8a0c7dac9ec93d51c52930b30941c19f3f9628
/src/nz/ac/vuw/ecs/swen225/a3/maze/tiles/TimerWallTile.java
4268ffb9575f5dcc3120a85fc1133150ef804112
[]
no_license
JasonAitken/RickChapGroupGame
https://github.com/JasonAitken/RickChapGroupGame
e43542d0b8eed34cd2a8d6e4cb79483a2f3df5b2
02345a322170f06373bc2ade36125a2303be7071
refs/heads/master
2022-12-21T20:52:07.227000
2020-09-21T08:33:16
2020-09-21T08:33:16
297,275,788
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package nz.ac.vuw.ecs.swen225.a3.maze.tiles; import nz.ac.vuw.ecs.swen225.a3.application.util.GUIUtil; import nz.ac.vuw.ecs.swen225.a3.maze.util.EventType; import nz.ac.vuw.ecs.swen225.a3.maze.util.Position; import nz.ac.vuw.ecs.swen225.a3.maze.util.PrePost; import nz.ac.vuw.ecs.swen225.a3.maze.util.TileType; /** * Recessed Wall acts as a wall to everything but the Player. When the player stands on * the recessed wall, it turns into a Wall tile. * * @author Tim - Creator * @author Mike - Contributor * @author Max - Contributer */ public class TimerWallTile extends Tile { private boolean isRecessed = true; private int startTime; public TimerWallTile(Position pos) { super(pos, TileType.TIMER_WALL); // Listener for monsters this.registerListener(PrePost.PRE, EventType.MONSTER_MOVED_TO, (board) -> false); // Listener for player standing on the recessed wall this.registerListener(PrePost.POST, EventType.CHIP_MOVED_TO, (board) -> { if (isRecessed) { image = GUIUtil.ASSETS.get(TileType.WALL); setWalkable(false); isRecessed = false; startTime = board.getCurrentTick(); return true; } else return false; }); this.registerOnTickListener((board) -> { if(!isRecessed) { if((board.getCurrentTick() - startTime) == 25) { image = GUIUtil.ASSETS.get(TileType.FREE); setWalkable(true); } return false; } return true; }); } }
UTF-8
Java
1,598
java
TimerWallTile.java
Java
[ { "context": "sed wall, it turns into a Wall tile.\n *\n * @author Tim - Creator\n * @author Mike - Contributor\n * @autho", "end": 471, "score": 0.9998226165771484, "start": 468, "tag": "NAME", "value": "Tim" }, { "context": " Wall tile.\n *\n * @author Tim - Creator\n * @author Mik...
null
[]
package nz.ac.vuw.ecs.swen225.a3.maze.tiles; import nz.ac.vuw.ecs.swen225.a3.application.util.GUIUtil; import nz.ac.vuw.ecs.swen225.a3.maze.util.EventType; import nz.ac.vuw.ecs.swen225.a3.maze.util.Position; import nz.ac.vuw.ecs.swen225.a3.maze.util.PrePost; import nz.ac.vuw.ecs.swen225.a3.maze.util.TileType; /** * Recessed Wall acts as a wall to everything but the Player. When the player stands on * the recessed wall, it turns into a Wall tile. * * @author Tim - Creator * @author Mike - Contributor * @author Max - Contributer */ public class TimerWallTile extends Tile { private boolean isRecessed = true; private int startTime; public TimerWallTile(Position pos) { super(pos, TileType.TIMER_WALL); // Listener for monsters this.registerListener(PrePost.PRE, EventType.MONSTER_MOVED_TO, (board) -> false); // Listener for player standing on the recessed wall this.registerListener(PrePost.POST, EventType.CHIP_MOVED_TO, (board) -> { if (isRecessed) { image = GUIUtil.ASSETS.get(TileType.WALL); setWalkable(false); isRecessed = false; startTime = board.getCurrentTick(); return true; } else return false; }); this.registerOnTickListener((board) -> { if(!isRecessed) { if((board.getCurrentTick() - startTime) == 25) { image = GUIUtil.ASSETS.get(TileType.FREE); setWalkable(true); } return false; } return true; }); } }
1,598
0.623279
0.607009
47
33
23.410309
89
false
false
0
0
0
0
0
0
0.787234
false
false
9
db2b22c313657e46056f3139aceaeb765d2a14df
23,656,679,885,089
2b8bd272cc8adea8fb24f184b33d1eaac384e979
/code/web/dcome/src/main/java/com/doucome/corner/web/dcome/action/frame/q/ajax/DcQzoneAjaxAction.java
93fc0026af503d2d4ae06780264beff5cfe8e02d
[]
no_license
svn2github/csjxing_corner
https://github.com/svn2github/csjxing_corner
2a96775c8ba59a0d086f6e06d14185dc85f1af9d
b7e147bb7789d4490bc8265d9d7ce63adeea8232
refs/heads/master
2016-09-06T20:11:52.851000
2013-02-20T07:22:36
2013-02-20T07:22:36
8,264,487
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.doucome.corner.web.dcome.action.frame.q.ajax; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import com.doucome.corner.biz.core.qq.QqQueryService; import com.doucome.corner.biz.dcome.business.DcUserBO; import com.doucome.corner.biz.dcome.enums.DcLoginSourceEnums; import com.doucome.corner.biz.dcome.model.DcUserDTO; import com.doucome.corner.biz.dcome.model.facade.PfModel; import com.doucome.corner.biz.dcome.model.facade.QQPfModel; import com.doucome.corner.web.common.model.JsonModel; import com.doucome.corner.web.dcome.action.frame.q.QBasicAction; /** * 用户相关异步接口. * @author ze2200 * */ @SuppressWarnings("serial") public class DcQzoneAjaxAction extends QBasicAction { private JsonModel<Map<String, Object>> json = new JsonModel<Map<String,Object>>(); @Autowired private QqQueryService qqQueryService; @Autowired private DcUserBO dcUserBO; /** * 是否是认证空间粉丝. * @return */ public String isQzoneFans() { PfModel pfm = dcAuthz.getPfModel() ; if (pfm == null) { json.setFail(JsonModel.CODE_FAIL, "invalid.user"); return SUCCESS; } Map<String, Object> result = new HashMap<String, Object>(); if(pfm != null && (pfm.getPf() == DcLoginSourceEnums.Pengyou || pfm.getPf() == DcLoginSourceEnums.Qzone)){ QQPfModel qpfm = (QQPfModel) pfm ; //过滤敏感词 boolean isFans = qqQueryService.isQzoneFans(qpfm.getPf().getValue(), qpfm.getOpenId(), qpfm.getOpenKey()); result.put("isFans", isFans); } else { result.put("isFans", false); } json.setSuccess(JsonModel.CODE_SUCCESS, result); return SUCCESS; } /** * 关注空间. * @return */ public String followQzone() { if (!qzoneFans()) { json.setFail(JsonModel.CODE_FAIL, "unfollow"); return SUCCESS; } DcUserDTO user = getUser(); Map<String, Object> result = new HashMap<String, Object>(); //重复关注 if (user.getGmtFollowQzone() != null) { result.put("integral", 0); json.setSuccess(JsonModel.CODE_SUCCESS, result); return SUCCESS; } int integral = dcUserBO.followQzone(user); if (integral > 0) { result.put("integral", integral); json.setSuccess(JsonModel.CODE_SUCCESS, result); } else { json.setFail(JsonModel.CODE_FAIL, "internal.error"); } return SUCCESS; } private boolean qzoneFans() { QQPfModel pfm = (QQPfModel) dcAuthz.getPfModel(); return qqQueryService.isQzoneFans(pfm.getPf().getValue(), pfm.getOpenId(), pfm.getOpenKey()); } public JsonModel<Map<String, Object>> getJson() { return json; } }
GB18030
Java
2,693
java
DcQzoneAjaxAction.java
Java
[ { "context": "e.q.QBasicAction;\r\n\r\n/**\r\n * 用户相关异步接口.\r\n * @author ze2200\r\n *\r\n */\r\n@SuppressWarnings(\"serial\")\r\npublic cla", "end": 686, "score": 0.9995418787002563, "start": 680, "tag": "USERNAME", "value": "ze2200" } ]
null
[]
package com.doucome.corner.web.dcome.action.frame.q.ajax; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import com.doucome.corner.biz.core.qq.QqQueryService; import com.doucome.corner.biz.dcome.business.DcUserBO; import com.doucome.corner.biz.dcome.enums.DcLoginSourceEnums; import com.doucome.corner.biz.dcome.model.DcUserDTO; import com.doucome.corner.biz.dcome.model.facade.PfModel; import com.doucome.corner.biz.dcome.model.facade.QQPfModel; import com.doucome.corner.web.common.model.JsonModel; import com.doucome.corner.web.dcome.action.frame.q.QBasicAction; /** * 用户相关异步接口. * @author ze2200 * */ @SuppressWarnings("serial") public class DcQzoneAjaxAction extends QBasicAction { private JsonModel<Map<String, Object>> json = new JsonModel<Map<String,Object>>(); @Autowired private QqQueryService qqQueryService; @Autowired private DcUserBO dcUserBO; /** * 是否是认证空间粉丝. * @return */ public String isQzoneFans() { PfModel pfm = dcAuthz.getPfModel() ; if (pfm == null) { json.setFail(JsonModel.CODE_FAIL, "invalid.user"); return SUCCESS; } Map<String, Object> result = new HashMap<String, Object>(); if(pfm != null && (pfm.getPf() == DcLoginSourceEnums.Pengyou || pfm.getPf() == DcLoginSourceEnums.Qzone)){ QQPfModel qpfm = (QQPfModel) pfm ; //过滤敏感词 boolean isFans = qqQueryService.isQzoneFans(qpfm.getPf().getValue(), qpfm.getOpenId(), qpfm.getOpenKey()); result.put("isFans", isFans); } else { result.put("isFans", false); } json.setSuccess(JsonModel.CODE_SUCCESS, result); return SUCCESS; } /** * 关注空间. * @return */ public String followQzone() { if (!qzoneFans()) { json.setFail(JsonModel.CODE_FAIL, "unfollow"); return SUCCESS; } DcUserDTO user = getUser(); Map<String, Object> result = new HashMap<String, Object>(); //重复关注 if (user.getGmtFollowQzone() != null) { result.put("integral", 0); json.setSuccess(JsonModel.CODE_SUCCESS, result); return SUCCESS; } int integral = dcUserBO.followQzone(user); if (integral > 0) { result.put("integral", integral); json.setSuccess(JsonModel.CODE_SUCCESS, result); } else { json.setFail(JsonModel.CODE_FAIL, "internal.error"); } return SUCCESS; } private boolean qzoneFans() { QQPfModel pfm = (QQPfModel) dcAuthz.getPfModel(); return qqQueryService.isQzoneFans(pfm.getPf().getValue(), pfm.getOpenId(), pfm.getOpenKey()); } public JsonModel<Map<String, Object>> getJson() { return json; } }
2,693
0.687429
0.68515
91
26.934067
25.782608
109
false
false
0
0
0
0
0
0
2.021978
false
false
9
7f70d12037c19dc71d1148a46184f2a77b767363
31,198,642,461,990
7c46a44f1930b7817fb6d26223a78785e1b4d779
/store/src/java/com/zimbra/cs/service/admin/QueryWaitSet.java
90bbfb755b9767d119420af9dbd0f44621a5217a
[]
no_license
Zimbra/zm-mailbox
https://github.com/Zimbra/zm-mailbox
20355a191c7174b1eb74461a6400b0329907fb02
8ef6538e789391813b65d3420097f43fbd2e2bf3
refs/heads/develop
2023-07-20T15:07:30.305000
2023-07-03T06:44:00
2023-07-06T10:09:53
85,609,847
67
128
null
false
2023-09-14T10:12:10
2017-03-20T18:07:01
2023-06-24T05:27:20
2023-09-14T10:12:10
122,472
58
88
67
Java
false
false
/* * ***** BEGIN LICENSE BLOCK ***** * Zimbra Collaboration Suite Server * Copyright (C) 2008, 2009, 2010, 2011, 2013, 2014, 2016 Synacor, Inc. * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software Foundation, * version 2 of the License. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with this program. * If not, see <https://www.gnu.org/licenses/>. * ***** END LICENSE BLOCK ***** */ package com.zimbra.cs.service.admin; import java.util.ArrayList; import java.util.List; import java.util.Map; import com.zimbra.common.service.ServiceException; import com.zimbra.common.soap.Element; import com.zimbra.cs.account.accesscontrol.AdminRight; import com.zimbra.cs.session.IWaitSet; import com.zimbra.cs.session.WaitSetMgr; import com.zimbra.soap.ZimbraSoapContext; import com.zimbra.soap.admin.message.QueryWaitSetRequest; import com.zimbra.soap.admin.message.QueryWaitSetResponse; /** * This API is used to dump the internal state of a wait set. This API is intended for debugging use only. */ public class QueryWaitSet extends AdminDocumentHandler { @Override public Element handle(Element request, Map<String, Object> context) throws ServiceException { ZimbraSoapContext zsc = getZimbraSoapContext(context); WaitSetMgr.checkRightForAllAccounts(zsc); // must be a global admin QueryWaitSetRequest req = (QueryWaitSetRequest) zsc.elementToJaxb(request); QueryWaitSetResponse resp = new QueryWaitSetResponse(); String waitSetId = req.getWaitSetId(); List<IWaitSet> sets; if (waitSetId != null) { sets = new ArrayList<IWaitSet>(1); IWaitSet ws = WaitSetMgr.lookup(waitSetId); if (ws == null) { throw AdminServiceException.NO_SUCH_WAITSET(waitSetId); } sets.add(ws); } else { sets = WaitSetMgr.getAll(); } for (IWaitSet set : sets) { resp.addWaitset(set.handleQuery()); } return zsc.jaxbToElement(resp); } @Override public void docRights(List<AdminRight> relatedRights, List<String> notes) { notes.add(AdminRightCheckPoint.Notes.SYSTEM_ADMINS_ONLY); } }
UTF-8
Java
2,585
java
QueryWaitSet.java
Java
[]
null
[]
/* * ***** BEGIN LICENSE BLOCK ***** * Zimbra Collaboration Suite Server * Copyright (C) 2008, 2009, 2010, 2011, 2013, 2014, 2016 Synacor, Inc. * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software Foundation, * version 2 of the License. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with this program. * If not, see <https://www.gnu.org/licenses/>. * ***** END LICENSE BLOCK ***** */ package com.zimbra.cs.service.admin; import java.util.ArrayList; import java.util.List; import java.util.Map; import com.zimbra.common.service.ServiceException; import com.zimbra.common.soap.Element; import com.zimbra.cs.account.accesscontrol.AdminRight; import com.zimbra.cs.session.IWaitSet; import com.zimbra.cs.session.WaitSetMgr; import com.zimbra.soap.ZimbraSoapContext; import com.zimbra.soap.admin.message.QueryWaitSetRequest; import com.zimbra.soap.admin.message.QueryWaitSetResponse; /** * This API is used to dump the internal state of a wait set. This API is intended for debugging use only. */ public class QueryWaitSet extends AdminDocumentHandler { @Override public Element handle(Element request, Map<String, Object> context) throws ServiceException { ZimbraSoapContext zsc = getZimbraSoapContext(context); WaitSetMgr.checkRightForAllAccounts(zsc); // must be a global admin QueryWaitSetRequest req = (QueryWaitSetRequest) zsc.elementToJaxb(request); QueryWaitSetResponse resp = new QueryWaitSetResponse(); String waitSetId = req.getWaitSetId(); List<IWaitSet> sets; if (waitSetId != null) { sets = new ArrayList<IWaitSet>(1); IWaitSet ws = WaitSetMgr.lookup(waitSetId); if (ws == null) { throw AdminServiceException.NO_SUCH_WAITSET(waitSetId); } sets.add(ws); } else { sets = WaitSetMgr.getAll(); } for (IWaitSet set : sets) { resp.addWaitset(set.handleQuery()); } return zsc.jaxbToElement(resp); } @Override public void docRights(List<AdminRight> relatedRights, List<String> notes) { notes.add(AdminRightCheckPoint.Notes.SYSTEM_ADMINS_ONLY); } }
2,585
0.698259
0.686654
70
35.92857
29.298134
107
false
false
0
0
0
0
0
0
0.571429
false
false
9
0b5c94eba77fe756b66cefa515c14d03ce638591
34,059,090,677,038
dae93148be139e776f7f66743b603106378058a6
/src/WordSearch.java
b94d59fbb3ff3376f1b484d2b019c4fc514c35e2
[]
no_license
ashwini-anand/CPPractice
https://github.com/ashwini-anand/CPPractice
dae43c3d801b83ca8c5e5891f29880e15fe6d547
5133c614c75f63d7ce5c80405a81806be72f1ec7
refs/heads/master
2023-08-29T09:35:19.392000
2021-10-26T13:42:31
2021-10-26T13:42:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.HashSet; class WordSearch { static int[] rowDir = {-1,0,1,0}; static int[] colDir = {0,1,0,-1}; public boolean exist(char[][] board, String word) { HashSet<String> hset = new HashSet<>(); if(board.length ==0. || board[0].length ==0) return false; int numRows = board.length; int numCols = board[0].length; boolean found = false; for(int i=0; i<numRows; i++){ for(int j=0; j< numCols; j++){ if(existUtil(board, i,j, 0, word, hset)){ found = true; break; } } } return found; } boolean existUtil(char[][] board, int r, int c, int strIdx, String word, HashSet<String> hset){ String pos = r+"_"+c; //if(strIdx == word.length) return true; if(hset.contains(pos) || board[r][c] != word.charAt(strIdx)) return false; if(strIdx == word.length()-1 && board[r][c] == word.charAt(strIdx)) return true; hset.add(pos); boolean found = false; for(int i=0; i< rowDir.length; i++){ int newRowIdx = r+rowDir[i]; int newColIdx = c+colDir[i]; // if(isSafe(newRowIdx, newColIdx, board)){ // if(existUtil(board, newRowIdx, newColIdx, strIdx+1, word, hset)){ // found = true; // break; // } // } } hset.remove(pos); return found; } }
UTF-8
Java
1,317
java
WordSearch.java
Java
[]
null
[]
import java.util.HashSet; class WordSearch { static int[] rowDir = {-1,0,1,0}; static int[] colDir = {0,1,0,-1}; public boolean exist(char[][] board, String word) { HashSet<String> hset = new HashSet<>(); if(board.length ==0. || board[0].length ==0) return false; int numRows = board.length; int numCols = board[0].length; boolean found = false; for(int i=0; i<numRows; i++){ for(int j=0; j< numCols; j++){ if(existUtil(board, i,j, 0, word, hset)){ found = true; break; } } } return found; } boolean existUtil(char[][] board, int r, int c, int strIdx, String word, HashSet<String> hset){ String pos = r+"_"+c; //if(strIdx == word.length) return true; if(hset.contains(pos) || board[r][c] != word.charAt(strIdx)) return false; if(strIdx == word.length()-1 && board[r][c] == word.charAt(strIdx)) return true; hset.add(pos); boolean found = false; for(int i=0; i< rowDir.length; i++){ int newRowIdx = r+rowDir[i]; int newColIdx = c+colDir[i]; // if(isSafe(newRowIdx, newColIdx, board)){ // if(existUtil(board, newRowIdx, newColIdx, strIdx+1, word, hset)){ // found = true; // break; // } // } } hset.remove(pos); return found; } }
1,317
0.561883
0.548216
45
28.288889
23.368185
97
false
false
0
0
0
0
0
0
1.266667
false
false
9
922d254ef49e645ca8015943f643208c59c2d6d1
36,764,920,055,176
7d99fb44a6a5b3a0963e8dda3225cee3b922e719
/app/src/main/java/com/antsu/waaai/database/HistoryDBContract.java
7375b555a3832122664fdbea44f3ed9338825441
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
antsu/waaai-app
https://github.com/antsu/waaai-app
aa0018b7a09ba9d84d1a857a85d0f97d4e4c4831
8ce9aecb0544053e9c5976c438b1b0a5dba773e5
refs/heads/master
2016-08-07T12:45:00.906000
2015-06-07T18:09:39
2015-06-07T18:09:39
25,693,405
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.antsu.waaai.database; import android.provider.BaseColumns; public final class HistoryDBContract { public static final int DATABASE_VERSION = 1; public static final String DATABASE_NAME = "database.db"; private static final String TEXT_TYPE = " TEXT"; private static final String INTEGER_TYPE = " INTEGER"; private static final String DATETIME_TYPE = " DATETIME"; private static final String COMMA_SEP = ","; // To prevent someone from accidentally instantiating the contract class, // give it an empty constructor. public HistoryDBContract() {} /* Inner class that defines the table contents */ public static abstract class HistoryDBEntry implements BaseColumns { public static final String TABLE_NAME = "history"; public static final String COLUMN_NAME_SHORT_LINK = "short_link"; public static final String COLUMN_NAME_LONG_LINK = "long_link"; public static final String COLUMN_NAME_DATE = "date"; public static final String COLUMN_NAME_CUSTOM_HASH = "custom_hash"; public static final String DELETE_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME; public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " (" + _ID + " INTEGER PRIMARY KEY," + COLUMN_NAME_SHORT_LINK + TEXT_TYPE + COMMA_SEP + COLUMN_NAME_LONG_LINK + TEXT_TYPE + COMMA_SEP + COLUMN_NAME_CUSTOM_HASH + TEXT_TYPE + COMMA_SEP + COLUMN_NAME_DATE + DATETIME_TYPE + " DEFAULT (datetime('now'))" + ")"; } }
UTF-8
Java
1,639
java
HistoryDBContract.java
Java
[]
null
[]
package com.antsu.waaai.database; import android.provider.BaseColumns; public final class HistoryDBContract { public static final int DATABASE_VERSION = 1; public static final String DATABASE_NAME = "database.db"; private static final String TEXT_TYPE = " TEXT"; private static final String INTEGER_TYPE = " INTEGER"; private static final String DATETIME_TYPE = " DATETIME"; private static final String COMMA_SEP = ","; // To prevent someone from accidentally instantiating the contract class, // give it an empty constructor. public HistoryDBContract() {} /* Inner class that defines the table contents */ public static abstract class HistoryDBEntry implements BaseColumns { public static final String TABLE_NAME = "history"; public static final String COLUMN_NAME_SHORT_LINK = "short_link"; public static final String COLUMN_NAME_LONG_LINK = "long_link"; public static final String COLUMN_NAME_DATE = "date"; public static final String COLUMN_NAME_CUSTOM_HASH = "custom_hash"; public static final String DELETE_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME; public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " (" + _ID + " INTEGER PRIMARY KEY," + COLUMN_NAME_SHORT_LINK + TEXT_TYPE + COMMA_SEP + COLUMN_NAME_LONG_LINK + TEXT_TYPE + COMMA_SEP + COLUMN_NAME_CUSTOM_HASH + TEXT_TYPE + COMMA_SEP + COLUMN_NAME_DATE + DATETIME_TYPE + " DEFAULT (datetime('now'))" + ")"; } }
1,639
0.639414
0.638804
35
45.857143
28.093866
87
false
false
0
0
0
0
0
0
0.514286
false
false
9
758e44c017d5c3176e553e709dec279528cf5791
36,764,920,054,635
c7bb985d1253830d4684682a6c4c9429f843ec7b
/src/main/java/com/service/mapper/AddressMapper.java
b1616cc98c952b205e435a7730d6a00315b7f5c0
[ "MIT" ]
permissive
ertancakir/spring-boot-example
https://github.com/ertancakir/spring-boot-example
29afe0f5427d11952319f59efe349fc21ce54637
7f40a6129434f9f2f0ac8281c5c1ba05db68b9fd
refs/heads/master
2022-04-28T11:09:27.728000
2021-10-26T13:38:17
2021-10-26T13:38:17
146,410,411
3
0
MIT
false
2022-03-31T18:37:01
2018-08-28T07:40:05
2021-10-26T13:38:20
2022-03-31T18:37:01
42
3
0
2
Java
false
false
package com.service.mapper; import com.domain.Address; import com.service.UserService; import com.service.dto.AddressDTO; import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList; import java.util.List; public class AddressMapper implements EntityMapper <AddressDTO, Address> { @Autowired UserService userService; public Address toEntity(AddressDTO dto) { Address address = new Address(); address.setCity(dto.getCity()); address.setDistrict(dto.getDistrict()); address.setFullAddress(dto.getFullAddress()); address.setPhoneNumber(dto.getPhoneNumber()); address.setZipCode(dto.getZipCode()); return address; } public AddressDTO toDto(Address entity) { AddressDTO addressDTO = new AddressDTO(); addressDTO.setAddressID(entity.getAddressID()); addressDTO.setCity(entity.getCity()); addressDTO.setDistrict(entity.getDistrict()); addressDTO.setFullAddress(entity.getFullAddress()); addressDTO.setZipCode(entity.getZipCode()); addressDTO.setPhoneNumber(entity.getPhoneNumber()); addressDTO.setUserID(entity.getUser().getUserID()); return addressDTO; } public List<Address> toEntity(List<AddressDTO> dtoList) { List<Address> entityList = new ArrayList<Address>(); for(AddressDTO addressDTO : dtoList){ entityList.add(toEntity(addressDTO)); } return entityList; } public List<AddressDTO> toDto(List<Address> entityList) { List<AddressDTO> dtoList = new ArrayList<AddressDTO>(); for(Address address : entityList){ dtoList.add(toDto(address)); } return dtoList; } }
UTF-8
Java
1,758
java
AddressMapper.java
Java
[]
null
[]
package com.service.mapper; import com.domain.Address; import com.service.UserService; import com.service.dto.AddressDTO; import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList; import java.util.List; public class AddressMapper implements EntityMapper <AddressDTO, Address> { @Autowired UserService userService; public Address toEntity(AddressDTO dto) { Address address = new Address(); address.setCity(dto.getCity()); address.setDistrict(dto.getDistrict()); address.setFullAddress(dto.getFullAddress()); address.setPhoneNumber(dto.getPhoneNumber()); address.setZipCode(dto.getZipCode()); return address; } public AddressDTO toDto(Address entity) { AddressDTO addressDTO = new AddressDTO(); addressDTO.setAddressID(entity.getAddressID()); addressDTO.setCity(entity.getCity()); addressDTO.setDistrict(entity.getDistrict()); addressDTO.setFullAddress(entity.getFullAddress()); addressDTO.setZipCode(entity.getZipCode()); addressDTO.setPhoneNumber(entity.getPhoneNumber()); addressDTO.setUserID(entity.getUser().getUserID()); return addressDTO; } public List<Address> toEntity(List<AddressDTO> dtoList) { List<Address> entityList = new ArrayList<Address>(); for(AddressDTO addressDTO : dtoList){ entityList.add(toEntity(addressDTO)); } return entityList; } public List<AddressDTO> toDto(List<Address> entityList) { List<AddressDTO> dtoList = new ArrayList<AddressDTO>(); for(Address address : entityList){ dtoList.add(toDto(address)); } return dtoList; } }
1,758
0.679181
0.679181
58
29.310345
23.122021
74
false
false
0
0
0
0
0
0
0.534483
false
false
9
fc9422650fcf621b0b03a0fc59c8c395ee11f076
11,252,814,358,652
80c50c3c3e6262785e71ba1a90b88e9acce94ee2
/TimeEase/src/com/monstersoftwarellc/timeease/service/IEntryService.java
26ae22c3f2fe93d8e7d18618daf659a0bffddb84
[]
no_license
NickPadilla/TimeEase
https://github.com/NickPadilla/TimeEase
965aa0372b698303cc15dec18766cbedfb6385ce
81e2e75071ea1b5f82d17088dc182685a8168704
refs/heads/master
2020-05-30T08:41:19.688000
2012-11-28T00:36:26
2012-11-28T00:36:26
4,092,608
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package com.monstersoftwarellc.timeease.service; import com.monstersoftwarellc.timeease.repository.impl.EntryRepository; /** * @author nicholas * */ public interface IEntryService { public abstract EntryRepository getEntryRepository(); }
UTF-8
Java
257
java
IEntryService.java
Java
[ { "context": "e.repository.impl.EntryRepository;\n\n/**\n * @author nicholas\n *\n */\npublic interface IEntryService {\n\n\tpublic ", "end": 158, "score": 0.9480370879173279, "start": 150, "tag": "USERNAME", "value": "nicholas" } ]
null
[]
/** * */ package com.monstersoftwarellc.timeease.service; import com.monstersoftwarellc.timeease.repository.impl.EntryRepository; /** * @author nicholas * */ public interface IEntryService { public abstract EntryRepository getEntryRepository(); }
257
0.762646
0.762646
15
16.133333
22.791422
71
false
false
0
0
0
0
0
0
0.266667
false
false
9
707e48d1cc42735dfa41e3adaa02bdbfa6530159
23,733,989,324,886
aff331ee8421768630b2c794aac17feb503e4825
/src/main/java/com/mzherdev/searchaggregator/model/strategy/Strategy.java
f4e3972b30cb17340237dfc41949facb9d340ea6
[]
no_license
michaelzherdev/search-aggregator
https://github.com/michaelzherdev/search-aggregator
4e2812ee4fe5a613e132177d0d9c1a0a5ab7213a
1a0282c72aa7caa805b95abc6801f4e9fa526419
refs/heads/master
2020-04-03T09:57:10.387000
2016-09-29T17:12:46
2016-09-29T17:12:46
69,589,385
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mzherdev.searchaggregator.model.strategy; import com.mzherdev.searchaggregator.vo.SearchResult; import java.util.Set; /** * Created by mzherdev on 28.09.16. */ public interface Strategy { Set<SearchResult> getSearchResults(String searchString); }
UTF-8
Java
269
java
Strategy.java
Java
[ { "context": "hResult;\n\nimport java.util.Set;\n\n/**\n * Created by mzherdev on 28.09.16.\n */\npublic interface Strategy {\n\n ", "end": 159, "score": 0.9996775984764099, "start": 151, "tag": "USERNAME", "value": "mzherdev" } ]
null
[]
package com.mzherdev.searchaggregator.model.strategy; import com.mzherdev.searchaggregator.vo.SearchResult; import java.util.Set; /** * Created by mzherdev on 28.09.16. */ public interface Strategy { Set<SearchResult> getSearchResults(String searchString); }
269
0.773234
0.750929
13
19.692308
22.516266
60
false
false
0
0
0
0
0
0
0.307692
false
false
9
f8a775989f7f72fb497fb9a3fd91317b185ee7da
4,269,197,533,889
b8ad97d1070b389b1481fa42c80f8dd13cec75fa
/app/src/main/java/com/notedroid/fuck/NoteDroid.java
752fa410e81d96a6d0be69debd7757b1655965c7
[]
no_license
FoxxyAnimus/NoteDroid
https://github.com/FoxxyAnimus/NoteDroid
fe07698194762fe703e54fd1b9887abcf7771f2c
7b251ea599ecedd76c7d510b917042206bdad8d0
refs/heads/master
2021-01-01T18:28:43.136000
2015-09-30T05:30:03
2015-09-30T05:30:03
35,645,256
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.notedroid.fuck; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; public class NoteDroid extends ActionBarActivity { private static final int ACTIVITY_VIEW_NOTE_LIST = 0; private static final int ACTIVITY_CREATE_NEW_NOTE = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_note_droid); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } // Opened when the user clicked the About button public void openAboutDialog(View view) { Intent i = new Intent(this, AboutActivity.class); startActivity(i); } // Called when the user clicks the New Note button public void openNewNote(View view) { Intent i = new Intent(this, NoteEditor.class); i.putExtra(NotesDbAdapter.KEY_ROWID, new Long(-1)); i.putExtra(NoteEditor.NOTEEDITOR_MODE, NoteEditor.NOTEEDITOR_MODE_EDIT); startActivityForResult(i, ACTIVITY_CREATE_NEW_NOTE); } // Called when the use clicks the View Notes Button public void openNoteList(View view) { Intent i = new Intent(this, NoteList.class); startActivityForResult(i, ACTIVITY_VIEW_NOTE_LIST); } }
UTF-8
Java
1,631
java
NoteDroid.java
Java
[]
null
[]
package com.notedroid.fuck; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; public class NoteDroid extends ActionBarActivity { private static final int ACTIVITY_VIEW_NOTE_LIST = 0; private static final int ACTIVITY_CREATE_NEW_NOTE = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_note_droid); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } // Opened when the user clicked the About button public void openAboutDialog(View view) { Intent i = new Intent(this, AboutActivity.class); startActivity(i); } // Called when the user clicks the New Note button public void openNewNote(View view) { Intent i = new Intent(this, NoteEditor.class); i.putExtra(NotesDbAdapter.KEY_ROWID, new Long(-1)); i.putExtra(NoteEditor.NOTEEDITOR_MODE, NoteEditor.NOTEEDITOR_MODE_EDIT); startActivityForResult(i, ACTIVITY_CREATE_NEW_NOTE); } // Called when the use clicks the View Notes Button public void openNoteList(View view) { Intent i = new Intent(this, NoteList.class); startActivityForResult(i, ACTIVITY_VIEW_NOTE_LIST); } }
1,631
0.755365
0.752912
56
28.125
22.476227
74
false
false
0
0
0
0
0
0
1.607143
false
false
9
1c8a6c7bbefd76c1ae55baedb9af1df93e985e1d
15,453,292,375,903
24e95ea309b0d0ff64ff7d4e2410acb529f249a5
/src/test/java/com/xinux/testDemo/test/EmailTest.java
49de55b5a889980ba337460cd10a4ab837555cc3
[]
no_license
xuxinpie/springDemo
https://github.com/xuxinpie/springDemo
1fcfe1e3f8c041cdae56a3d41f1e487edc3acbca
ab2c8cb35876814710250a6f8f4852704cc06c98
refs/heads/master
2016-08-04T20:50:09.279000
2015-09-28T12:17:17
2015-09-28T12:17:17
34,104,441
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xinux.testDemo.test; import javax.mail.MessagingException; import org.junit.Before; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.xinux.test.model.Email; import com.xinux.test.model.User; import com.xinux.test.service.EmailService; public class EmailTest { public EmailService emailService; @Before public void before() { ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "classpath:config/spring.xml", "classpath:config/spring-mybatis.xml" }); emailService = (EmailService) context.getBean("emailService"); } /*@Test public void testSendEmail() throws MessagingException { Email email = new Email(); email.setFrom("luckyxu1126@126.com"); email.setTo(new String[] { "luckyxu1126@126.com", "xuxinpie@gmail.com" }); email.setSubject("复杂邮件"); String text = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\"></head><body><h1><a href='http://luxh.cnblogs.com'>我的博客</a></h1></body></html>"; email.setText(text); List<AbstractResource> resources = new ArrayList<AbstractResource>(); //添加附件 ClassPathResource file1 = new ClassPathResource("/picture/icon.png"); FileSystemResource file2 = new FileSystemResource("D:\\temp\\pet.txt"); resources.add(file1); resources.add(file2); email.setResources(resources); emailService.sendMime(email); }*/ @Test public void testSendWelcomeEmail() throws MessagingException { Email email = new Email(); User user = new User(); email.setFrom("luckyxu1126@126.com"); email.setTo(new String[] { "luckyxu1126@126.com", "xuxinpie@gmail.com" }); email.setSubject("注册邮件"); user.setUserName("Xinux"); emailService.sendMime(email, user); } }
UTF-8
Java
2,093
java
EmailTest.java
Java
[ { "context": "mail email = new Email();\r\n email.setFrom(\"luckyxu1126@126.com\");\r\n email.setTo(new String[] { \"luckyxu11", "end": 900, "score": 0.9999228715896606, "start": 881, "tag": "EMAIL", "value": "luckyxu1126@126.com" }, { "context": "6@126.com\");\r\n ...
null
[]
package com.xinux.testDemo.test; import javax.mail.MessagingException; import org.junit.Before; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.xinux.test.model.Email; import com.xinux.test.model.User; import com.xinux.test.service.EmailService; public class EmailTest { public EmailService emailService; @Before public void before() { ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "classpath:config/spring.xml", "classpath:config/spring-mybatis.xml" }); emailService = (EmailService) context.getBean("emailService"); } /*@Test public void testSendEmail() throws MessagingException { Email email = new Email(); email.setFrom("<EMAIL>"); email.setTo(new String[] { "<EMAIL>", "<EMAIL>" }); email.setSubject("复杂邮件"); String text = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\"></head><body><h1><a href='http://luxh.cnblogs.com'>我的博客</a></h1></body></html>"; email.setText(text); List<AbstractResource> resources = new ArrayList<AbstractResource>(); //添加附件 ClassPathResource file1 = new ClassPathResource("/picture/icon.png"); FileSystemResource file2 = new FileSystemResource("D:\\temp\\pet.txt"); resources.add(file1); resources.add(file2); email.setResources(resources); emailService.sendMime(email); }*/ @Test public void testSendWelcomeEmail() throws MessagingException { Email email = new Email(); User user = new User(); email.setFrom("<EMAIL>"); email.setTo(new String[] { "<EMAIL>", "<EMAIL>" }); email.setSubject("注册邮件"); user.setUserName("Xinux"); emailService.sendMime(email, user); } }
2,023
0.655507
0.637069
56
34.80357
33.680443
187
false
false
0
0
0
0
0
0
0.660714
false
false
9
3b7bb16240dc454b6daa24e7f72da0208ce2292d
33,809,982,577,265
4c6adf0ce6ef3f02dcef9c345e0e5e4ff139d886
/Common/RM/rm-jar/rm-risk/src/main/java/com/pay/risk/commons/BCMIGSRespContant.java
1b27f0f66077b0adc7e157dcb25c4c3363fd74cd
[]
no_license
happyjianguo/pay-1
https://github.com/happyjianguo/pay-1
8631906be62707316f0ed3eb6b2337c90d213bc0
40ae79738cfe4e5d199ca66468f3a33e9d8f2007
refs/heads/master
2020-07-27T19:51:54.958000
2016-12-19T07:34:24
2016-12-19T07:34:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pay.risk.commons; /** * 中行MIGS返回结果码 * @author user07 * */ public enum BCMIGSRespContant { BC0("0","交易成功"), BC1("1","交易无法处理"), BC2("2","请联系发卡银行"), BC3("3","交易拒绝,银行无响应"), BC4("4","交易拒绝,此卡已过期"), BC5("5","卡余额不足"), BC6("6","交易拒绝,银行系统错误"), BC7("7","支付处理错误"), BC8("8","无效交易类型"), BC9("9","银行拒绝交易"), BCA("A","交易中止"), BCB("B","交易受限"), BCC("C","交易已取消"), BCD("D","延期交易"), BCE("E","交易拒绝联系发卡行"), BCF("F","3D安全校验失败"), BCI("I","校验码错误"), BCL("L","购物交易被锁定"), BCN("N","持卡人未做3D校验"), BCP("P","交易待定"), BCR("R","重试超限,交易不处理"), BCT("T","地址校验失败"), BCU("U","信用卡安全码错误"), BCV("V","地址校验和信用卡安全码错误"), BC("?","交易状态无法识别") ; private String respCode; private String respDesc; BCMIGSRespContant(String respCode,String respDesc){ this.respCode = respCode; this.respDesc = respDesc; } public static BCMIGSRespContant getRespCodeEnum(String value) { if (value != null) { for (BCMIGSRespContant nameEnum : values()) { if (nameEnum.getRespCode().equals(value)) { return nameEnum; } } } return null; } public String getRespCode() { return respCode; } public String getRespDesc() { return respDesc; } }
UTF-8
Java
1,510
java
BCMIGSRespContant.java
Java
[ { "context": ".pay.risk.commons;\n\n\n/**\n * 中行MIGS返回结果码\n * @author user07\n *\n */\npublic enum BCMIGSRespContant {\n \n\tBC0(", "end": 68, "score": 0.9992092251777649, "start": 62, "tag": "USERNAME", "value": "user07" } ]
null
[]
package com.pay.risk.commons; /** * 中行MIGS返回结果码 * @author user07 * */ public enum BCMIGSRespContant { BC0("0","交易成功"), BC1("1","交易无法处理"), BC2("2","请联系发卡银行"), BC3("3","交易拒绝,银行无响应"), BC4("4","交易拒绝,此卡已过期"), BC5("5","卡余额不足"), BC6("6","交易拒绝,银行系统错误"), BC7("7","支付处理错误"), BC8("8","无效交易类型"), BC9("9","银行拒绝交易"), BCA("A","交易中止"), BCB("B","交易受限"), BCC("C","交易已取消"), BCD("D","延期交易"), BCE("E","交易拒绝联系发卡行"), BCF("F","3D安全校验失败"), BCI("I","校验码错误"), BCL("L","购物交易被锁定"), BCN("N","持卡人未做3D校验"), BCP("P","交易待定"), BCR("R","重试超限,交易不处理"), BCT("T","地址校验失败"), BCU("U","信用卡安全码错误"), BCV("V","地址校验和信用卡安全码错误"), BC("?","交易状态无法识别") ; private String respCode; private String respDesc; BCMIGSRespContant(String respCode,String respDesc){ this.respCode = respCode; this.respDesc = respDesc; } public static BCMIGSRespContant getRespCodeEnum(String value) { if (value != null) { for (BCMIGSRespContant nameEnum : values()) { if (nameEnum.getRespCode().equals(value)) { return nameEnum; } } } return null; } public String getRespCode() { return respCode; } public String getRespDesc() { return respDesc; } }
1,510
0.603448
0.582759
64
17.125
13.283566
64
false
false
0
0
0
0
0
0
2.125
false
false
9
45216710d97bb003d3dbf0a483dc312989177d26
34,694,745,850,131
af03b1c0a268668ea83a5ff533678e25192f55cb
/src/main/java/scheduler/solver/ScheduleScoreCalculator.java
0d3f718633351c9b6f58180cb8361ee52986de79
[]
no_license
cdelmas/scheduler-poc
https://github.com/cdelmas/scheduler-poc
8b5560b58386f54258f324a410774624a2d38b3a
9d8f8e302d11cf3727d94fc4d731c5467dbb93f8
refs/heads/master
2020-05-15T11:19:08.118000
2019-05-14T12:04:16
2019-05-14T12:04:16
182,221,797
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package scheduler.solver; import io.vavr.Tuple; import io.vavr.Tuple2; import org.optaplanner.core.api.score.Score; import org.optaplanner.core.api.score.buildin.hardsoftlong.HardSoftLongScore; import org.optaplanner.core.impl.score.director.easy.EasyScoreCalculator; import scheduler.model.*; import java.time.LocalDateTime; import java.util.List; import static java.util.stream.Collectors.*; public class ScheduleScoreCalculator implements EasyScoreCalculator<Schedule> { @Override public Score calculateScore(Schedule schedule) { List<VirtualMachine> machines = schedule.getVirtualMachines(); long notStartedMachinesUsedPenalty = machines.stream().mapToLong(m -> m.isStarted() ? 0 : -100).sum(); long missedDeadlinePenalty = -50 * machines.stream().flatMap(m -> m.getRunningTasks().stream()).filter(n -> n.getEndTime().isAfter(n.getMarker().getMaxReturnTime())).count(); List<Tenant> tenants = schedule.getMarkerNestings().stream().map(MarkerNesting::getMarker).map(Marker::getBelongsTo).map(MarkerList::getOwner).collect(toList()); LocalDateTime endOfFirstSlot = schedule.getStartOfTime().plusHours(1); List<Slot> nextHourSlots = machines.stream().flatMap(m -> m.getScheduleSlots().stream()).filter(s -> s.getEndTime().isBefore(endOfFirstSlot)).collect(toList()); long slaPenalty = tenants.stream() .flatMap(t -> nextHourSlots.stream().map(s -> Tuple.of(t, s.countForTenant(t)))) .collect(groupingBy((Tuple2<Tenant, Long> t) -> t._1, summingLong((Tuple2<Tenant, Long> t) -> t._2))) .entrySet().stream() .mapToLong(e -> { Tenant t = e.getKey(); long actualNumberOfMarkersNextHour = e.getValue(); long overRequirement = t.totalNestingOwned() - t.getNumberOfMarkersGuarantedPerHour(); return overRequirement > 0 ? t.getNumberOfMarkersGuarantedPerHour() - actualNumberOfMarkersNextHour : 0; }).sum() * -1; return HardSoftLongScore.of(slaPenalty, notStartedMachinesUsedPenalty + missedDeadlinePenalty); // return computeUselessScore(schedule.getVirtualMachines()); } private Score computeUselessScore(List<VirtualMachine> machines) { long softScore = 0L; long unusedMachines = machines.stream().map(VirtualMachine::getRunningTasks).map(List::size).filter(x -> x == 0).count(); long hardScore = unusedMachines * -10; return HardSoftLongScore.of(hardScore, softScore); } }
UTF-8
Java
2,567
java
ScheduleScoreCalculator.java
Java
[]
null
[]
package scheduler.solver; import io.vavr.Tuple; import io.vavr.Tuple2; import org.optaplanner.core.api.score.Score; import org.optaplanner.core.api.score.buildin.hardsoftlong.HardSoftLongScore; import org.optaplanner.core.impl.score.director.easy.EasyScoreCalculator; import scheduler.model.*; import java.time.LocalDateTime; import java.util.List; import static java.util.stream.Collectors.*; public class ScheduleScoreCalculator implements EasyScoreCalculator<Schedule> { @Override public Score calculateScore(Schedule schedule) { List<VirtualMachine> machines = schedule.getVirtualMachines(); long notStartedMachinesUsedPenalty = machines.stream().mapToLong(m -> m.isStarted() ? 0 : -100).sum(); long missedDeadlinePenalty = -50 * machines.stream().flatMap(m -> m.getRunningTasks().stream()).filter(n -> n.getEndTime().isAfter(n.getMarker().getMaxReturnTime())).count(); List<Tenant> tenants = schedule.getMarkerNestings().stream().map(MarkerNesting::getMarker).map(Marker::getBelongsTo).map(MarkerList::getOwner).collect(toList()); LocalDateTime endOfFirstSlot = schedule.getStartOfTime().plusHours(1); List<Slot> nextHourSlots = machines.stream().flatMap(m -> m.getScheduleSlots().stream()).filter(s -> s.getEndTime().isBefore(endOfFirstSlot)).collect(toList()); long slaPenalty = tenants.stream() .flatMap(t -> nextHourSlots.stream().map(s -> Tuple.of(t, s.countForTenant(t)))) .collect(groupingBy((Tuple2<Tenant, Long> t) -> t._1, summingLong((Tuple2<Tenant, Long> t) -> t._2))) .entrySet().stream() .mapToLong(e -> { Tenant t = e.getKey(); long actualNumberOfMarkersNextHour = e.getValue(); long overRequirement = t.totalNestingOwned() - t.getNumberOfMarkersGuarantedPerHour(); return overRequirement > 0 ? t.getNumberOfMarkersGuarantedPerHour() - actualNumberOfMarkersNextHour : 0; }).sum() * -1; return HardSoftLongScore.of(slaPenalty, notStartedMachinesUsedPenalty + missedDeadlinePenalty); // return computeUselessScore(schedule.getVirtualMachines()); } private Score computeUselessScore(List<VirtualMachine> machines) { long softScore = 0L; long unusedMachines = machines.stream().map(VirtualMachine::getRunningTasks).map(List::size).filter(x -> x == 0).count(); long hardScore = unusedMachines * -10; return HardSoftLongScore.of(hardScore, softScore); } }
2,567
0.687963
0.680561
52
48.365383
48.768303
182
false
false
0
0
0
0
0
0
0.634615
false
false
9
0f3553951e46b702ace0ce43b946adc9e4a858c1
38,422,777,439,319
7a4701fde3183f0b618828166138dd711998853e
/MedicalProject/src/com/example/bean/Patient.java
a14e9b7799a360d9520edc9963bb57252c858288
[]
no_license
evilZ1994/MedicalProjectServer
https://github.com/evilZ1994/MedicalProjectServer
aea363ff597c530154cf572ad9e38db3f27f2ada
e0d5538d4f482a91552665bd3f913e33023fd63e
refs/heads/master
2021-06-17T23:01:51.940000
2017-05-30T04:12:44
2017-05-30T04:12:44
74,574,806
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.bean; import java.util.Date; public class Patient { private int id; private String sex; private int age; private String username; private String name; private String password; private String IDnumber; private String department; private String nation; private String marriage; private String address; private Date check_time; private Date record_time; private Doctor doctor; private Date create_time; private Date update_time; public Patient() { super(); } public Patient(int id, String username, String name, String password, Doctor doctor, Date create_time, Date update_time) { super(); this.id = id; this.username = username; this.name = name; this.password = password; this.doctor = doctor; this.create_time = create_time; this.update_time = update_time; } public Patient(String username, String password) { super(); this.username = username; this.password = password; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Doctor getDoctor() { return doctor; } public void setDoctor(Doctor doctor) { this.doctor = doctor; } public Date getCreate_time() { return create_time; } public void setCreate_time(Date create_time) { this.create_time = create_time; } public Date getUpdate_time() { return update_time; } public void setUpdate_time(Date update_time) { this.update_time = update_time; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public String getIDnumber() { return IDnumber; } public void setIDnumber(String iDnumber) { IDnumber = iDnumber; } public String getDepartment() { return department; } public void setDepartment(String department) { this.department = department; } public String getNation() { return nation; } public void setNation(String nation) { this.nation = nation; } public String getMarriage() { return marriage; } public void setMarriage(String marriage) { this.marriage = marriage; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public Date getCheck_time() { return check_time; } public void setCheck_time(Date check_time) { this.check_time = check_time; } public Date getRecord_time() { return record_time; } public void setRecord_time(Date record_time) { this.record_time = record_time; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public String toString() { return "Patient [id=" + id + ", username=" + username + ", name=" + name + ", password=" + password + ", doctor=" + doctor + ", create_time=" + create_time + ", update_time=" + update_time + "]"; } }
UTF-8
Java
3,162
java
Patient.java
Java
[ { "context": "me) {\n\t\tsuper();\n\t\tthis.id = id;\n\t\tthis.username = username;\n\t\tthis.name = name;\n\t\tthis.password = password;\n", "end": 682, "score": 0.988054096698761, "start": 674, "tag": "USERNAME", "value": "username" }, { "context": " = username;\n\t\tthis.name = na...
null
[]
package com.example.bean; import java.util.Date; public class Patient { private int id; private String sex; private int age; private String username; private String name; private String password; private String IDnumber; private String department; private String nation; private String marriage; private String address; private Date check_time; private Date record_time; private Doctor doctor; private Date create_time; private Date update_time; public Patient() { super(); } public Patient(int id, String username, String name, String password, Doctor doctor, Date create_time, Date update_time) { super(); this.id = id; this.username = username; this.name = name; this.password = <PASSWORD>; this.doctor = doctor; this.create_time = create_time; this.update_time = update_time; } public Patient(String username, String password) { super(); this.username = username; this.password = <PASSWORD>; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = <PASSWORD>; } public Doctor getDoctor() { return doctor; } public void setDoctor(Doctor doctor) { this.doctor = doctor; } public Date getCreate_time() { return create_time; } public void setCreate_time(Date create_time) { this.create_time = create_time; } public Date getUpdate_time() { return update_time; } public void setUpdate_time(Date update_time) { this.update_time = update_time; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public String getIDnumber() { return IDnumber; } public void setIDnumber(String iDnumber) { IDnumber = iDnumber; } public String getDepartment() { return department; } public void setDepartment(String department) { this.department = department; } public String getNation() { return nation; } public void setNation(String nation) { this.nation = nation; } public String getMarriage() { return marriage; } public void setMarriage(String marriage) { this.marriage = marriage; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public Date getCheck_time() { return check_time; } public void setCheck_time(Date check_time) { this.check_time = check_time; } public Date getRecord_time() { return record_time; } public void setRecord_time(Date record_time) { this.record_time = record_time; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public String toString() { return "Patient [id=" + id + ", username=" + username + ", name=" + name + ", password=" + <PASSWORD> + ", doctor=" + doctor + ", create_time=" + create_time + ", update_time=" + update_time + "]"; } }
3,170
0.687223
0.687223
166
18.048193
17.967777
103
false
false
0
0
0
0
0
0
1.60241
false
false
9
4176efc1f2e3b6b5a27e1079b2fda8b50b1d897a
36,747,740,199,758
e83e9d07b40cdfa8e26cc51260bc6e30f79acad9
/RouletteSimulator/src/Main.java
c627587001b369a49d3d5a60ceef5d2f865cc415
[]
no_license
tom-draper/roulette-sim
https://github.com/tom-draper/roulette-sim
656d4d2ec610f3293273e24a4b136ceedff25633
e60d7f6f6af6ca3d0de666b49e86a5d583004de6
refs/heads/master
2022-08-04T18:03:49.908000
2019-11-17T11:29:05
2019-11-17T11:29:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class Main { public static void main(String[] args) { boolean exit = false; boolean lose; NumberProperties numberProp = new NumberProperties(); NumberGenerator numberGen = new NumberGenerator(); Display display = new Display(); InputAnalyser analyser = new InputAnalyser(); ResultProcessor resultProcessor = new ResultProcessor(); Strategy strategy = new Strategy(); display.enterBank(); //User prompt Scanner scanner = new Scanner(System.in); Session session = new Session(scanner.nextDouble()); //Get bank value /* User command help */ display.possibleChips(); display.commandFormat(); do { scanner = new Scanner(System.in); String command = scanner.nextLine(); //Get command double initialChip = analyser.getChip(command); double chip = initialChip; String placement = analyser.getPlacement(command); int spins = analyser.getFlagValue(command, 's'); int simulations = analyser.getFlagValue(command, 'l'); char strat = analyser.getStrategy(command, spins); /* If input spins or simulations set to -1 (missing), default to 1 */ if (spins == -1) { spins = 1; } if (simulations == -1) { simulations = 1; session.setSimulating(false); } else { session.resetSim(); session.setSimulating(true); } display.displayStrategy(strat); /* Double strategy set up*/ if (strat == 'd') { /* Search for option max value */ strategy.setDoubleStratMax(analyser.getFlagValue(command, 'd')); } display.newLine(); /* Exit program */ switch(command) { case "exit": //Exit program exit = true; display.exiting(); break; case "statistics": display.displayGeneralStatistics(session); case "reset": //Reset statistics session.resetStatistics(display); break; case "help": //Help menu display.help(); break; case "flags": //Available command flags display.flags(); break; case "frequency": //Frequency statistics break; default: if (chip != -1 && !placement.equals("-1")) { //Valid spin int realSpins = spins; int odds = analyser.getWinOdds(placement); display.spinInfo(chip, placement, spins, odds); /* Simulations */ for (int sim = 0; sim < simulations; sim++) { /* Spins */ for (int roll = 0; roll < spins; roll++) { /* Stop spinning if out of money */ if (!session.subBank(chip)) { realSpins = roll; //Record spins taken break; } int number = numberGen.generateEuropeanNumber(); //Generate number if (spins > 1) { display.displayRoll(roll); } /* Display number, black/red, odd/even */ display.displayNumber(numberProp, number); display.displayChip(chip); /* Check for win or loss */ if (resultProcessor.processResult(chip, placement, odds, number, roll, session, numberProp, analyser)) { display.displayWin(chip, odds); lose = false; } else { display.displayLoss(chip); lose = true; } /* Strategies */ if (strat == 'd') { //Double strategy chip = strategy.doubleEachTime(chip, initialChip, lose); } display.displayBank(session); display.displaySmallDivider(); } display.displayStatistics(realSpins, sim, odds, session); /* Update simulation data */ if (simulations > 1) { session.handleSimulations(sim, simulations, realSpins); session.resetStatistics(display); chip = initialChip; } } } else { System.out.println("Command invalid."); } } } while (!exit); } }
UTF-8
Java
4,443
java
Main.java
Java
[]
null
[]
import java.util.Scanner; public class Main { public static void main(String[] args) { boolean exit = false; boolean lose; NumberProperties numberProp = new NumberProperties(); NumberGenerator numberGen = new NumberGenerator(); Display display = new Display(); InputAnalyser analyser = new InputAnalyser(); ResultProcessor resultProcessor = new ResultProcessor(); Strategy strategy = new Strategy(); display.enterBank(); //User prompt Scanner scanner = new Scanner(System.in); Session session = new Session(scanner.nextDouble()); //Get bank value /* User command help */ display.possibleChips(); display.commandFormat(); do { scanner = new Scanner(System.in); String command = scanner.nextLine(); //Get command double initialChip = analyser.getChip(command); double chip = initialChip; String placement = analyser.getPlacement(command); int spins = analyser.getFlagValue(command, 's'); int simulations = analyser.getFlagValue(command, 'l'); char strat = analyser.getStrategy(command, spins); /* If input spins or simulations set to -1 (missing), default to 1 */ if (spins == -1) { spins = 1; } if (simulations == -1) { simulations = 1; session.setSimulating(false); } else { session.resetSim(); session.setSimulating(true); } display.displayStrategy(strat); /* Double strategy set up*/ if (strat == 'd') { /* Search for option max value */ strategy.setDoubleStratMax(analyser.getFlagValue(command, 'd')); } display.newLine(); /* Exit program */ switch(command) { case "exit": //Exit program exit = true; display.exiting(); break; case "statistics": display.displayGeneralStatistics(session); case "reset": //Reset statistics session.resetStatistics(display); break; case "help": //Help menu display.help(); break; case "flags": //Available command flags display.flags(); break; case "frequency": //Frequency statistics break; default: if (chip != -1 && !placement.equals("-1")) { //Valid spin int realSpins = spins; int odds = analyser.getWinOdds(placement); display.spinInfo(chip, placement, spins, odds); /* Simulations */ for (int sim = 0; sim < simulations; sim++) { /* Spins */ for (int roll = 0; roll < spins; roll++) { /* Stop spinning if out of money */ if (!session.subBank(chip)) { realSpins = roll; //Record spins taken break; } int number = numberGen.generateEuropeanNumber(); //Generate number if (spins > 1) { display.displayRoll(roll); } /* Display number, black/red, odd/even */ display.displayNumber(numberProp, number); display.displayChip(chip); /* Check for win or loss */ if (resultProcessor.processResult(chip, placement, odds, number, roll, session, numberProp, analyser)) { display.displayWin(chip, odds); lose = false; } else { display.displayLoss(chip); lose = true; } /* Strategies */ if (strat == 'd') { //Double strategy chip = strategy.doubleEachTime(chip, initialChip, lose); } display.displayBank(session); display.displaySmallDivider(); } display.displayStatistics(realSpins, sim, odds, session); /* Update simulation data */ if (simulations > 1) { session.handleSimulations(sim, simulations, realSpins); session.resetStatistics(display); chip = initialChip; } } } else { System.out.println("Command invalid."); } } } while (!exit); } }
4,443
0.521044
0.518343
139
30.964029
23.086765
122
false
false
0
0
0
0
0
0
0.669065
false
false
9
ba6e91e66a38b42e4f2d42a2ab24cebd673f2585
14,379,550,510,439
da818cd0f7a391aea73c86296a9a7a3b30dc2c82
/Sol_739.java
9e075e1e26bf0a997ab6be83d59634a251d5399e
[]
no_license
MarKvoff/leetcode_javaSol
https://github.com/MarKvoff/leetcode_javaSol
82956a6a22b2dfa3a48235a80ff01005ca5f52d9
d3590a30f4d6a840e9e20841b4c34d594cbb1d66
refs/heads/master
2021-01-19T17:37:14.219000
2018-04-19T10:39:53
2018-04-19T10:39:53
101,074,949
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package leetcode_sol; import java.util.*; /** * This is the solution for problems in leetcode.com * Question 739. Daily Temperatures * * @author czm * * */ public class Sol_739 { public int[] dailyTemperatures(int[] temperatures) { int days = temperatures.length; int[] res = new int[days]; Map<Integer, List<Integer>> map = new HashMap<Integer, List<Integer>>(); Stack<Integer> stack = new Stack<Integer>(); for (int i = 0; i < days; i++) { while(!stack.isEmpty() && stack.peek() < temperatures[i]) { List<Integer> indexs = map.get(stack.pop()); for (int index : indexs) res[index] = i - index; indexs.clear(); } stack.push(temperatures[i]); if (map.containsKey(temperatures[i])) { List<Integer> indexs = map.get(temperatures[i]); indexs.add(i); } else { List<Integer> indexs = new LinkedList<>(); indexs.add(i); map.put(temperatures[i], indexs); } } return res; } public static void main(String[] args) { // TODO Auto-generated method stub } }
UTF-8
Java
1,316
java
Sol_739.java
Java
[ { "context": " * Question 739. Daily Temperatures\n * \n * @author czm\n * \n *\n */\npublic class Sol_739 {\n\t\npublic int[] ", "end": 154, "score": 0.999539852142334, "start": 151, "tag": "USERNAME", "value": "czm" } ]
null
[]
package leetcode_sol; import java.util.*; /** * This is the solution for problems in leetcode.com * Question 739. Daily Temperatures * * @author czm * * */ public class Sol_739 { public int[] dailyTemperatures(int[] temperatures) { int days = temperatures.length; int[] res = new int[days]; Map<Integer, List<Integer>> map = new HashMap<Integer, List<Integer>>(); Stack<Integer> stack = new Stack<Integer>(); for (int i = 0; i < days; i++) { while(!stack.isEmpty() && stack.peek() < temperatures[i]) { List<Integer> indexs = map.get(stack.pop()); for (int index : indexs) res[index] = i - index; indexs.clear(); } stack.push(temperatures[i]); if (map.containsKey(temperatures[i])) { List<Integer> indexs = map.get(temperatures[i]); indexs.add(i); } else { List<Integer> indexs = new LinkedList<>(); indexs.add(i); map.put(temperatures[i], indexs); } } return res; } public static void main(String[] args) { // TODO Auto-generated method stub } }
1,316
0.494681
0.489362
51
24.803921
21.633326
80
false
false
0
0
0
0
0
0
0.509804
false
false
9
92b5e49902e63570f0bf66232f49bb8599d965b0
35,021,163,337,539
9c42b84a177b5653622fd33ae56757c05d63ac25
/src/main/java/de/factorypal/sauloborges/model/ParameterRequest.java
21efd458be02cc76413b2bde27daa18d56d99306
[]
no_license
saudborg/speed_metrics_service
https://github.com/saudborg/speed_metrics_service
e49179cf672172e6ed8eaa8fe77c9570a38d9b63
7d872e98e903cd514ec9d6795f300c245b146dfe
refs/heads/main
2023-06-14T23:28:48.970000
2021-07-15T07:01:32
2021-07-15T07:01:32
385,887,119
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.factorypal.sauloborges.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import java.util.Map; @Data public class ParameterRequest { private String machineKey; private Map<String, Long> parameters; @JsonCreator public ParameterRequest(@JsonProperty(value = "machineKey") final String machineKey, @JsonProperty(value = "parameters") final Map<String, Long> parameters) { this.machineKey = machineKey; this.parameters = parameters; } }
UTF-8
Java
546
java
ParameterRequest.java
Java
[]
null
[]
package de.factorypal.sauloborges.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import java.util.Map; @Data public class ParameterRequest { private String machineKey; private Map<String, Long> parameters; @JsonCreator public ParameterRequest(@JsonProperty(value = "machineKey") final String machineKey, @JsonProperty(value = "parameters") final Map<String, Long> parameters) { this.machineKey = machineKey; this.parameters = parameters; } }
546
0.785714
0.785714
21
25
24.924648
85
false
false
0
0
0
0
0
0
1.142857
false
false
9
7475bd5b47c3b4f2389f81fa3e72a77b1b8d8cf6
24,584,392,840,818
fc665a796822d5daeb1b6883f4800783ed5e12e5
/src/main/java/menu/MenuInventoryHolder.java
d87e5080dbcc888d5aef036129af5f0361579e92
[]
no_license
B0WL/MinecraftPlugin-Trade
https://github.com/B0WL/MinecraftPlugin-Trade
fdb7c857d7affa185f84c7bfe30b0d7b330fe1bc
4e722e3589b631f49b42a1d4e7c401bdd5b6168f
refs/heads/master
2020-04-23T08:14:46.898000
2019-05-06T14:11:31
2019-05-06T14:11:31
171,031,130
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package menu; import java.math.BigDecimal; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryHolder; public class MenuInventoryHolder implements InventoryHolder { private MenuHolder holder; private String material; private BigDecimal price; public MenuInventoryHolder() { this.holder = MenuHolder.NULL; } public MenuInventoryHolder(MenuHolder holder) { this.holder = holder; } public MenuInventoryHolder(MenuHolder holder , String material) { this.holder = holder; this.material = material; } public MenuInventoryHolder(MenuHolder holder , BigDecimal price) { this.holder = holder; this.price = price; } public boolean holderIs(MenuHolder holder) { if(holder == this.holder) { return true; }else { return false; } } public MenuHolder getHolder() { return this.holder; } public String getMaterial() { return material; } public BigDecimal getPrice() { return price; } @Override public Inventory getInventory() { return null; } }
UTF-8
Java
1,088
java
MenuInventoryHolder.java
Java
[]
null
[]
package menu; import java.math.BigDecimal; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryHolder; public class MenuInventoryHolder implements InventoryHolder { private MenuHolder holder; private String material; private BigDecimal price; public MenuInventoryHolder() { this.holder = MenuHolder.NULL; } public MenuInventoryHolder(MenuHolder holder) { this.holder = holder; } public MenuInventoryHolder(MenuHolder holder , String material) { this.holder = holder; this.material = material; } public MenuInventoryHolder(MenuHolder holder , BigDecimal price) { this.holder = holder; this.price = price; } public boolean holderIs(MenuHolder holder) { if(holder == this.holder) { return true; }else { return false; } } public MenuHolder getHolder() { return this.holder; } public String getMaterial() { return material; } public BigDecimal getPrice() { return price; } @Override public Inventory getInventory() { return null; } }
1,088
0.688419
0.688419
57
17.122807
17.904297
67
false
false
0
0
0
0
0
0
1.526316
false
false
9
a8f2d549cc249caf9d9b67a35ee1a589b4caed10
29,257,317,280,434
ce55e10448040cf27b4abccc9fb2b46e83ffb434
/trunk/qclive/qclive-core/src/main/java/gov/nih/nci/ncicb/tcga/dcc/qclive/common/util/ArchiveCompressorTarGzImpl.java
803432e399e43e3d6563bd578c49b181a360c042
[]
no_license
NCIP/tcga-sandbox-v1
https://github.com/NCIP/tcga-sandbox-v1
0518dee6ee9e31a48c6ebddd1c10d20dca33c898
c8230c07199ddaf9d69564480ff9124782525cf5
refs/heads/master
2021-01-19T04:07:08.906000
2013-05-29T18:00:15
2013-05-29T18:00:15
87,348,860
1
7
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Software License, Version 1.0 Copyright 2010 SRA International, Inc. * Copyright Notice. The software subject to this notice and license includes both human * readable source code form and machine readable, binary, object code form (the "caBIG * Software"). * * Please refer to the complete License text for full details at the root of the project. */ package gov.nih.nci.ncicb.tcga.dcc.qclive.common.util; import org.apache.commons.io.IOUtils; import org.apache.tools.tar.TarEntry; import org.apache.tools.tar.TarOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.List; import java.util.zip.GZIPOutputStream; /** * Archive compressor that uses tar and gzip to create the archive file. * * @author Jessica Chen * Last updated by: $Author: sfeirr $ * @version $Rev: 3419 $ */ public class ArchiveCompressorTarGzImpl implements ArchiveCompressor { public static final String TAR_EXTENSION = ".tar"; public static final String GZIP_EXTENSION = ".gz"; public static final String TAR_GZIP_EXTENSION = TAR_EXTENSION + GZIP_EXTENSION; /** * Compress the given files into an archive with the given name, plus the file extension. Put the compressed * archive into the given directory. (So if you pass in /test/ as the destinationDirectory and 'anArchive' as * the archiveName, the compressed archives will be /test/anArchive.tar.gz) * * @param files the files to include in the archive * @param archiveName the name of the archive, minus extension * @param destinationDirectory the location to put the new compressed archive * @param compress flag to compress the archive * @return the File representing the created compressed archive * @throws IOException if it needs to */ public File createArchive( final List<File> files, final String archiveName, final File destinationDirectory, final Boolean compress) throws IOException { File archive = null; TarOutputStream tarOutputStream = null; FileInputStream in = null; GZIPOutputStream gzipOutputStream = null; try { // first make a tar archive with all the given files final File tarFile = new File( destinationDirectory, archiveName + TAR_EXTENSION ); //noinspection IOResourceOpenedButNotSafelyClosed tarOutputStream = new TarOutputStream( new FileOutputStream( tarFile ) ); tarOutputStream.setLongFileMode( TarOutputStream.LONGFILE_GNU ); final byte[] buf = new byte[1024]; for(final File file : files) { try { //noinspection IOResourceOpenedButNotSafelyClosed in = new FileInputStream( file ); // name of entry should be archiveName/fileName final TarEntry tarEntry = new TarEntry( file ); tarEntry.setName( archiveName + File.separator + file.getName() ); tarOutputStream.putNextEntry( tarEntry ); int len; while(( len = in.read( buf ) ) > 0) { tarOutputStream.write( buf, 0, len ); } tarOutputStream.closeEntry(); in.close(); } finally { IOUtils.closeQuietly(in); } } tarOutputStream.close(); if(compress){ final File outputFile = new File( destinationDirectory, archiveName + TAR_GZIP_EXTENSION ); // then compress it using gzip //noinspection IOResourceOpenedButNotSafelyClosed gzipOutputStream = new GZIPOutputStream( new FileOutputStream( outputFile ) ); //noinspection IOResourceOpenedButNotSafelyClosed in = new FileInputStream( tarFile ); int len; while(( len = in.read( buf ) ) > 0) { gzipOutputStream.write( buf, 0, len ); } // this was a temp file so delete it //noinspection ResultOfMethodCallIgnored tarFile.delete(); archive = outputFile; }else{ archive = tarFile; } } finally { IOUtils.closeQuietly(tarOutputStream); IOUtils.closeQuietly(in); IOUtils.closeQuietly(gzipOutputStream); } return archive; } public String getExtension() { return TAR_GZIP_EXTENSION; } }
UTF-8
Java
4,855
java
ArchiveCompressorTarGzImpl.java
Java
[ { "context": "d gzip to create the archive file.\r\n *\r\n * @author Jessica Chen\r\n * Last updated by: $Author: sfeirr $\r\n ", "end": 849, "score": 0.9995421171188354, "start": 837, "tag": "NAME", "value": "Jessica Chen" }, { "context": "Jessica Chen\r\n * Last upd...
null
[]
/* * Software License, Version 1.0 Copyright 2010 SRA International, Inc. * Copyright Notice. The software subject to this notice and license includes both human * readable source code form and machine readable, binary, object code form (the "caBIG * Software"). * * Please refer to the complete License text for full details at the root of the project. */ package gov.nih.nci.ncicb.tcga.dcc.qclive.common.util; import org.apache.commons.io.IOUtils; import org.apache.tools.tar.TarEntry; import org.apache.tools.tar.TarOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.List; import java.util.zip.GZIPOutputStream; /** * Archive compressor that uses tar and gzip to create the archive file. * * @author <NAME> * Last updated by: $Author: sfeirr $ * @version $Rev: 3419 $ */ public class ArchiveCompressorTarGzImpl implements ArchiveCompressor { public static final String TAR_EXTENSION = ".tar"; public static final String GZIP_EXTENSION = ".gz"; public static final String TAR_GZIP_EXTENSION = TAR_EXTENSION + GZIP_EXTENSION; /** * Compress the given files into an archive with the given name, plus the file extension. Put the compressed * archive into the given directory. (So if you pass in /test/ as the destinationDirectory and 'anArchive' as * the archiveName, the compressed archives will be /test/anArchive.tar.gz) * * @param files the files to include in the archive * @param archiveName the name of the archive, minus extension * @param destinationDirectory the location to put the new compressed archive * @param compress flag to compress the archive * @return the File representing the created compressed archive * @throws IOException if it needs to */ public File createArchive( final List<File> files, final String archiveName, final File destinationDirectory, final Boolean compress) throws IOException { File archive = null; TarOutputStream tarOutputStream = null; FileInputStream in = null; GZIPOutputStream gzipOutputStream = null; try { // first make a tar archive with all the given files final File tarFile = new File( destinationDirectory, archiveName + TAR_EXTENSION ); //noinspection IOResourceOpenedButNotSafelyClosed tarOutputStream = new TarOutputStream( new FileOutputStream( tarFile ) ); tarOutputStream.setLongFileMode( TarOutputStream.LONGFILE_GNU ); final byte[] buf = new byte[1024]; for(final File file : files) { try { //noinspection IOResourceOpenedButNotSafelyClosed in = new FileInputStream( file ); // name of entry should be archiveName/fileName final TarEntry tarEntry = new TarEntry( file ); tarEntry.setName( archiveName + File.separator + file.getName() ); tarOutputStream.putNextEntry( tarEntry ); int len; while(( len = in.read( buf ) ) > 0) { tarOutputStream.write( buf, 0, len ); } tarOutputStream.closeEntry(); in.close(); } finally { IOUtils.closeQuietly(in); } } tarOutputStream.close(); if(compress){ final File outputFile = new File( destinationDirectory, archiveName + TAR_GZIP_EXTENSION ); // then compress it using gzip //noinspection IOResourceOpenedButNotSafelyClosed gzipOutputStream = new GZIPOutputStream( new FileOutputStream( outputFile ) ); //noinspection IOResourceOpenedButNotSafelyClosed in = new FileInputStream( tarFile ); int len; while(( len = in.read( buf ) ) > 0) { gzipOutputStream.write( buf, 0, len ); } // this was a temp file so delete it //noinspection ResultOfMethodCallIgnored tarFile.delete(); archive = outputFile; }else{ archive = tarFile; } } finally { IOUtils.closeQuietly(tarOutputStream); IOUtils.closeQuietly(in); IOUtils.closeQuietly(gzipOutputStream); } return archive; } public String getExtension() { return TAR_GZIP_EXTENSION; } }
4,849
0.59691
0.593203
113
40.964603
29.334787
114
false
false
0
0
0
0
0
0
0.530973
false
false
9
031c41f6d6c5aeb376ed3f7f6f4270eeec0cd6c1
2,740,189,172,805
f55b0b1b5655a2e0affd912dd835cf77c719a8a4
/src/main/java/com/portal/deals/service/impl/CategoryServiceImpl.java
febf7466a1ef88c6d7376ac5cf51bd5be921c566
[]
no_license
jaingaurav09ster/card-deals
https://github.com/jaingaurav09ster/card-deals
dd05238d470727ccc00495fc079a3da347f86994
d7d0cc4a28e18be43c14213bc43952db41ca632b
refs/heads/master
2021-01-11T16:26:49.520000
2017-05-07T10:34:17
2017-05-07T10:34:17
80,084,572
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.portal.deals.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.portal.deals.model.Category; import com.portal.deals.model.dao.CategoryDAO; import com.portal.deals.service.CategoryService; @Service("categoryService") @Transactional public class CategoryServiceImpl implements CategoryService { @Autowired private CategoryDAO categoryDAO; @Override public List<Category> listAllCategories() { return categoryDAO.listAllCategories(); } @Override public Category getCategoryById(Integer id) { return categoryDAO.getCategoryById(id); } @Override public void deleteCategoryById(Integer id) { categoryDAO.deleteCategoryById(id); } @Override public void saveCategory(Category Category) { categoryDAO.saveCategory(Category); } @Override public void updateCategory(Category category) { Category entity = categoryDAO.getCategoryById(category.getId()); if (entity != null) { entity.setDescription(category.getDescription()); entity.setName(category.getName()); } } @Override public void deleteCategory(Category category) { categoryDAO.deleteCategory(category); } @Override public List<Category> listAllRootCategories() { return categoryDAO.listAllRootCategories(); } }
UTF-8
Java
1,457
java
CategoryServiceImpl.java
Java
[]
null
[]
package com.portal.deals.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.portal.deals.model.Category; import com.portal.deals.model.dao.CategoryDAO; import com.portal.deals.service.CategoryService; @Service("categoryService") @Transactional public class CategoryServiceImpl implements CategoryService { @Autowired private CategoryDAO categoryDAO; @Override public List<Category> listAllCategories() { return categoryDAO.listAllCategories(); } @Override public Category getCategoryById(Integer id) { return categoryDAO.getCategoryById(id); } @Override public void deleteCategoryById(Integer id) { categoryDAO.deleteCategoryById(id); } @Override public void saveCategory(Category Category) { categoryDAO.saveCategory(Category); } @Override public void updateCategory(Category category) { Category entity = categoryDAO.getCategoryById(category.getId()); if (entity != null) { entity.setDescription(category.getDescription()); entity.setName(category.getName()); } } @Override public void deleteCategory(Category category) { categoryDAO.deleteCategory(category); } @Override public List<Category> listAllRootCategories() { return categoryDAO.listAllRootCategories(); } }
1,457
0.758408
0.758408
58
23.155172
21.657843
66
false
false
0
0
0
0
0
0
1.12069
false
false
9
00c263cdc5491b3d4c8a1a8dca7620d085c069ec
18,416,819,833,195
abfff9251ca8301dc265688c5a915e66d9143786
/src/main/java/com/academysmart/jpa/model/Adress.java
83e7361dd83910f7796bac18a673059d6039f6ca
[]
no_license
keonix/airport
https://github.com/keonix/airport
094df26c33447d1f1ee49c76affe0f6f452bcef5
604406428547ace128d2ab0a432ae277297b9e19
refs/heads/master
2021-01-01T17:33:42.273000
2014-11-06T14:36:15
2014-11-06T14:36:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.academysmart.jpa.model; import javax.persistence.*; @Entity @NamedQuery(name = "selectAll", query = "SELECT a FROM Adress a") public class Adress { @Id @GeneratedValue private long id; private String city; private String street; public Adress() { } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } }
UTF-8
Java
589
java
Adress.java
Java
[]
null
[]
package com.academysmart.jpa.model; import javax.persistence.*; @Entity @NamedQuery(name = "selectAll", query = "SELECT a FROM Adress a") public class Adress { @Id @GeneratedValue private long id; private String city; private String street; public Adress() { } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } }
589
0.675722
0.675722
42
13.023809
14.368431
65
false
false
0
0
0
0
0
0
1.02381
false
false
9
269b6235bdf960f41edda9dd7086b069308971a5
28,759,101,063,453
3fda6fc717fbe755a53a04e8d776bbaa7cab83b1
/src/net/aerith/misao/pixy/ThumbnailImageCreater.java
d3a61d1441201ee26c873dea15eb4e4e6ea304c8
[]
no_license
jankotek/Pixy2
https://github.com/jankotek/Pixy2
ef8fe9c8f2c76b63a636286f641cfb07c159454b
7e2480f5eb58eeaee22f6cad9f6784b954b84df9
refs/heads/master
2023-05-29T22:39:28.248000
2011-10-15T14:30:27
2011-10-15T14:30:27
2,581,830
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * @(#)ThumbnailImageCreater.java * * Copyright (C) 1997-2007 Seiichi Yoshida * All rights reserved. */ package net.aerith.misao.pixy; import java.io.*; import java.util.*; import java.awt.Point; import net.aerith.misao.util.*; import net.aerith.misao.image.*; import net.aerith.misao.image.io.*; import net.aerith.misao.image.filter.*; import net.aerith.misao.database.*; import net.aerith.misao.xml.*; import net.aerith.misao.io.FileManager; import net.aerith.misao.pixy.image_loading.XmlImageLoader; /** * The <code>ThumbnailImageCreater</code> is a class to create the * thumbnail image objects or image files based on the specified list * of XML magnitude records. * * @author Seiichi Yoshida (comet@aerith.net) * @version 2007 May 20 */ public class ThumbnailImageCreater extends OperationObservable { /** * The list of the folder and the magnitude record. */ protected Vector thumbnail_list = new Vector(); /** * The gallery type. */ protected int gallery_type = TYPE_IMAGE; /** * The size of the thumbnail image. */ protected Size thumbnail_size = new Size(100, 100); /** * The policy on the position. */ protected int policy_position = POSITION_TARGET_AT_CENTER; /** * The policy on the magnification. */ protected int policy_magnification = MAGNIFICATION_KEEP_ORIGINAL; /** * The policy on the rotation. */ protected int policy_rotation = ROTATION_KEEP_ORIGINAL; /** * The resolution, the pixel size in arcsec. */ protected double resolution = 0.0; /** * The magnification. */ protected double magnification = 1.0; /** * The information database manager. */ protected InformationDBManager info_manager; /** * The file manager. */ protected FileManager file_manager; /** * The number of policy on the position which indicates to create * the thumbnail image as the target star locates at the center, * even if it is at the edge of the original image. */ public final static int POSITION_TARGET_AT_CENTER = 101; /** * The number of policy on the magnification which indicates to * create the thumbnail image without magnification. */ public final static int MAGNIFICATION_KEEP_ORIGINAL = 201; /** * The number of policy on the magnification which indicates to * create the thumbnail image with the specified resolution. */ public final static int MAGNIFICATION_SPECIFIED_RESOLUTION = 202; /** * The number of policy on the magnification which indicates to * create the thumbnail image with the specified magnification. */ public final static int MAGNIFICATION_SPECIFIED_MAGNIFICATION = 203; /** * The number of policy on the rotation which indicates to * create the thumbnail image without rotation. */ public final static int ROTATION_KEEP_ORIGINAL = 301; /** * The number of policy on the rotation which indicates to * create the thumbnail image as north is up by rotating at * right angles. */ public final static int ROTATION_NORTH_UP_AT_RIGHT_ANGLES = 302; /** * The number of gallery type to create an image gallery. */ public final static int TYPE_IMAGE = 401; /** * The number of gallery type to create a differential image * gallery. */ public final static int TYPE_DIFFERENTIAL = 402; /** * Constructs a <code>ThumbnailImageCreater</code>. * @param file_manager the file manager. */ public ThumbnailImageCreater ( FileManager file_manager ) { thumbnail_list = new Vector(); info_manager = null; this.file_manager = file_manager; } /** * Sets the gallery type. * @param type the number of gallery type. */ public void setGalleryType ( int type ) { gallery_type = type; } /** * Sets the size of the thumbnail image. * @param size the size of the thumbnail image. */ public void setSize ( Size size ) { thumbnail_size = size; } /** * Sets the policy on the position. * @param policy the number of policy on the position. */ public void setPositionPolicy ( int policy ) { policy_position = policy; } /** * Sets the policy on the magnification. * @param policy the number of policy on the magnification. */ public void setMagnificationPolicy ( int policy ) { policy_magnification = policy; } /** * Sets the resolution, the pixel size in arcsec. * @param pixel_size the pixel size in arcsec. */ public void setResolution ( double pixel_size ) { resolution = pixel_size; } /** * Sets the magnification. * @param magnification the magnification. */ public void setMagnification ( double magnification ) { this.magnification = magnification; } /** * Sets the policy on the rotation. * @param policy the number of policy on the rotation. */ public void setRotationPolicy ( int policy ) { policy_rotation = policy; } /** * Adds the magnitude record. It is to create the thumbnail image * objects. * @param record the magnitude record. */ public void addRecord ( XmlMagRecord record ) { thumbnail_list.addElement(new FolderAndRecord(null, record)); } /** * Adds the set of the folder and magnitude record. It is to * create the thumbnail image files. * @param record the magnitude record. * @param folder the folder to create the thumbnail image. */ public void addRecord ( XmlMagRecord record, File folder ) { thumbnail_list.addElement(new FolderAndRecord(folder, record)); } /** * Cleans up the sets of the folder and magnitude record. */ public void clean ( ) { thumbnail_list = new Vector(); } /** * Sets the information database manager. * @param info_manager the information database manager. */ public void setDBManager ( InformationDBManager info_manager ) { this.info_manager = info_manager; } /** * Sets the file manager. * @param file_manager the file manager. */ public void setFileManager ( FileManager file_manager ) { this.file_manager = file_manager; } /** * Creates the thumbnail image objects. * @param records the array of XML magnitude records. * @return the array of the thumbnail image objects. */ public MonoImage[] create ( XmlMagRecord[] records ) { clean(); for (int i = 0 ; i < records.length ; i++) addRecord(records[i]); MonoImage[] images = create(); clean(); return images; } /** * Creates the thumbnail image objects of the previously added * records. * @return the array of the thumbnail image objects in the same * order as magnitude records added to this creater. */ public MonoImage[] create ( ) { notifyStart(); Vector image_list = new Vector(); MonoImage base_image = null; XmlInformation base_info = null; Coor base_coor = null; for (int i = 0 ; i < thumbnail_list.size() ; i++) { FolderAndRecord set = (FolderAndRecord)thumbnail_list.elementAt(i); try { XmlInformation info = file_manager.readInformation(set.record, info_manager); XmlImageLoader loader = new XmlImageLoader(info, file_manager); loader.operate(); MonoImage image = loader.getMonoImage(); Position position = new Position(set.record.getPosition().getX(), set.record.getPosition().getY()); if (gallery_type == TYPE_DIFFERENTIAL && i > 0) position = info.mapCoordinatesToXY(base_coor); MonoImage thumbnail_image = createThumbnailImage(image, position, info); if (gallery_type == TYPE_DIFFERENTIAL) { if (i == 0) { base_image = thumbnail_image; base_info = info; base_coor = info.mapXYToCoordinates(position); } else { thumbnail_image = createDifferentialImage(thumbnail_image, info, base_image, base_info); } } image_list.addElement(thumbnail_image); notifySucceeded(set.record); } catch ( Exception exception ) { notifyFailed(set.record); } } MonoImage[] images = new MonoImage[image_list.size()]; for (int i = 0 ; i < image_list.size() ; i++) images[i] = (MonoImage)image_list.elementAt(i); notifyEnd(null); return images; } /** * Creates the thumbnail image files. * @param records the array of XML magnitude records. * @param folder the folder to create the files. * @return the array of the thumbnail image files. */ public File[] createFile ( XmlMagRecord[] records, File folder ) { clean(); for (int i = 0 ; i < records.length ; i++) addRecord(records[i], folder); File[] files = createFile(); clean(); return files; } /** * Creates the thumbnail image files of the previously added * records. * @return the array of the thumbnail image files. */ public File[] createFile ( ) { notifyStart(); Vector file_list = new Vector(); MonoImage base_image = null; XmlInformation base_info = null; Coor base_coor = null; for (int i = 0 ; i < thumbnail_list.size() ; i++) { FolderAndRecord set = (FolderAndRecord)thumbnail_list.elementAt(i); try { set.folder.mkdirs(); XmlInformation info = file_manager.readInformation(set.record, info_manager); XmlImageLoader loader = new XmlImageLoader(info, file_manager); loader.operate(); MonoImage image = loader.getMonoImage(); Position position = new Position(set.record.getPosition().getX(), set.record.getPosition().getY()); if (gallery_type == TYPE_DIFFERENTIAL && i > 0) position = info.mapCoordinatesToXY(base_coor); MonoImage thumbnail_image = createThumbnailImage(image, position, info); if (gallery_type == TYPE_DIFFERENTIAL) { if (i == 0) { base_image = thumbnail_image; base_info = info; base_coor = info.mapXYToCoordinates(position); } else { thumbnail_image = createDifferentialImage(image, info, base_image, base_info); } } JulianDay jd = JulianDay.create(set.record.getDate()); String filename = jd.getOutputString(JulianDay.FORMAT_MONTH_IN_NUMBER_WITHOUT_SPACE, JulianDay.FORMAT_DECIMALDAY_100000TH) + ".fts"; filename = FileManager.unitePath(set.folder.getPath(), filename); File file = new File(filename); Fits fits = new Fits(file.toURI().toURL()); fits.save(thumbnail_image); file_list.addElement(file); notifySucceeded(set.record); } catch ( Exception exception ) { notifyFailed(set.record); } } File[] files = new File[file_list.size()]; for (int i = 0 ; i < file_list.size() ; i++) files[i] = (File)file_list.elementAt(i); notifyEnd(null); return files; } /** * Creates the thumbnail image. * @param image the original image object. * @param target_position the (x,y) position of the target. * @param info the XML information document. * @return the image object. */ protected MonoImage createThumbnailImage ( MonoImage image, Position target_position, XmlInformation info ) { // Magnifies the thumbnail image. Size size = thumbnail_size; if (policy_magnification == MAGNIFICATION_SPECIFIED_RESOLUTION) { ChartMapFunction cmf = info.getChartMapFunction(); double pixel_size = 3600.0 / cmf.getScaleUnitPerDegree(); double ratio = pixel_size / resolution; size = new Size((int)((double)thumbnail_size.getWidth() / ratio + 0.5), (int)((double)thumbnail_size.getHeight() / ratio + 0.5)); } else if (policy_magnification == MAGNIFICATION_SPECIFIED_MAGNIFICATION) { size = new Size((int)((double)thumbnail_size.getWidth() / magnification + 0.5), (int)((double)thumbnail_size.getHeight() / magnification + 0.5)); } int base_x = (int)(target_position.getX() - (double)size.getWidth() / 2.0 + 0.5); int base_y = (int)(target_position.getY() - (double)size.getHeight() / 2.0 + 0.5); ResizeFilter filter = new ResizeFilter(size); filter.setBasePosition(base_x, base_y); MonoImage thumbnail_image = filter.operate(image); // Rotates the thumbnail image. if (policy_rotation == ROTATION_NORTH_UP_AT_RIGHT_ANGLES) thumbnail_image = new RotateAtRightAnglesFilter(- info.getRotation().getContent()).operate(thumbnail_image); // Magnifies the thumbnail image. if (policy_magnification == MAGNIFICATION_SPECIFIED_RESOLUTION || policy_magnification == MAGNIFICATION_SPECIFIED_MAGNIFICATION) { thumbnail_image = new RescaleFilter(thumbnail_size).operate(thumbnail_image); } return thumbnail_image; } /** * Creates the differential image. * @param image the target image object. * @param info the XML information document of the target image. * @param base_image the base image object. * @param base_info the XML information document of the base image. * @return the image object. */ protected MonoImage createDifferentialImage ( MonoImage image, XmlInformation info, MonoImage base_image, XmlInformation base_info ) { // Restores rotation of the thumbnail image. if (policy_rotation == ROTATION_NORTH_UP_AT_RIGHT_ANGLES) image = new RotateAtRightAnglesFilter(info.getRotation().getContent()).operate(image); // Magnification. double magnification = 1.0; if (policy_magnification == MAGNIFICATION_KEEP_ORIGINAL || policy_magnification == MAGNIFICATION_SPECIFIED_MAGNIFICATION) { ChartMapFunction cmf = info.getChartMapFunction(); ChartMapFunction base_cmf = base_info.getChartMapFunction(); magnification = base_cmf.getScaleUnitPerDegree() / cmf.getScaleUnitPerDegree(); } // Rotation. double pa = info.getRotation().getContent(); double base_pa = base_info.getRotation().getContent(); double rotation = base_pa - pa; // Maps the image to the base image. MapFunction map_function = new MapFunction(new Position(0, 0), magnification, rotation); image = new MapFilter(map_function).operate(image); // Rotates the thumbnail image. if (policy_rotation == ROTATION_NORTH_UP_AT_RIGHT_ANGLES) image = new RotateAtRightAnglesFilter(- base_info.getRotation().getContent()).operate(image); // Subtract the base image. image = new SubtractionFilter(image).operate(base_image); return image; } /** * The <code>FolderAndRecord</code> is a set of the folder and the * magnitude record to create a thumbnail image. */ protected class FolderAndRecord { /** * The folder to create the thumbnail image. */ public File folder; /** * The magnitude record. */ public XmlMagRecord record; /** * Constructs a <code>FolderAndRecord</code>. * @param folder the folder to create the thumbnail image. * @param record the magnitude record. */ public FolderAndRecord ( File folder, XmlMagRecord record ) { this.folder = folder; this.record = record; } } }
UTF-8
Java
14,458
java
ThumbnailImageCreater.java
Java
[ { "context": "ailImageCreater.java\n *\n * Copyright (C) 1997-2007 Seiichi Yoshida\n * All rights reserved.\n */\n\npackage net.aerith.m", "end": 82, "score": 0.9998696446418762, "start": 67, "tag": "NAME", "value": "Seiichi Yoshida" }, { "context": "d list\n * of XML magnitude recor...
null
[]
/* * @(#)ThumbnailImageCreater.java * * Copyright (C) 1997-2007 <NAME> * All rights reserved. */ package net.aerith.misao.pixy; import java.io.*; import java.util.*; import java.awt.Point; import net.aerith.misao.util.*; import net.aerith.misao.image.*; import net.aerith.misao.image.io.*; import net.aerith.misao.image.filter.*; import net.aerith.misao.database.*; import net.aerith.misao.xml.*; import net.aerith.misao.io.FileManager; import net.aerith.misao.pixy.image_loading.XmlImageLoader; /** * The <code>ThumbnailImageCreater</code> is a class to create the * thumbnail image objects or image files based on the specified list * of XML magnitude records. * * @author <NAME> (<EMAIL>) * @version 2007 May 20 */ public class ThumbnailImageCreater extends OperationObservable { /** * The list of the folder and the magnitude record. */ protected Vector thumbnail_list = new Vector(); /** * The gallery type. */ protected int gallery_type = TYPE_IMAGE; /** * The size of the thumbnail image. */ protected Size thumbnail_size = new Size(100, 100); /** * The policy on the position. */ protected int policy_position = POSITION_TARGET_AT_CENTER; /** * The policy on the magnification. */ protected int policy_magnification = MAGNIFICATION_KEEP_ORIGINAL; /** * The policy on the rotation. */ protected int policy_rotation = ROTATION_KEEP_ORIGINAL; /** * The resolution, the pixel size in arcsec. */ protected double resolution = 0.0; /** * The magnification. */ protected double magnification = 1.0; /** * The information database manager. */ protected InformationDBManager info_manager; /** * The file manager. */ protected FileManager file_manager; /** * The number of policy on the position which indicates to create * the thumbnail image as the target star locates at the center, * even if it is at the edge of the original image. */ public final static int POSITION_TARGET_AT_CENTER = 101; /** * The number of policy on the magnification which indicates to * create the thumbnail image without magnification. */ public final static int MAGNIFICATION_KEEP_ORIGINAL = 201; /** * The number of policy on the magnification which indicates to * create the thumbnail image with the specified resolution. */ public final static int MAGNIFICATION_SPECIFIED_RESOLUTION = 202; /** * The number of policy on the magnification which indicates to * create the thumbnail image with the specified magnification. */ public final static int MAGNIFICATION_SPECIFIED_MAGNIFICATION = 203; /** * The number of policy on the rotation which indicates to * create the thumbnail image without rotation. */ public final static int ROTATION_KEEP_ORIGINAL = 301; /** * The number of policy on the rotation which indicates to * create the thumbnail image as north is up by rotating at * right angles. */ public final static int ROTATION_NORTH_UP_AT_RIGHT_ANGLES = 302; /** * The number of gallery type to create an image gallery. */ public final static int TYPE_IMAGE = 401; /** * The number of gallery type to create a differential image * gallery. */ public final static int TYPE_DIFFERENTIAL = 402; /** * Constructs a <code>ThumbnailImageCreater</code>. * @param file_manager the file manager. */ public ThumbnailImageCreater ( FileManager file_manager ) { thumbnail_list = new Vector(); info_manager = null; this.file_manager = file_manager; } /** * Sets the gallery type. * @param type the number of gallery type. */ public void setGalleryType ( int type ) { gallery_type = type; } /** * Sets the size of the thumbnail image. * @param size the size of the thumbnail image. */ public void setSize ( Size size ) { thumbnail_size = size; } /** * Sets the policy on the position. * @param policy the number of policy on the position. */ public void setPositionPolicy ( int policy ) { policy_position = policy; } /** * Sets the policy on the magnification. * @param policy the number of policy on the magnification. */ public void setMagnificationPolicy ( int policy ) { policy_magnification = policy; } /** * Sets the resolution, the pixel size in arcsec. * @param pixel_size the pixel size in arcsec. */ public void setResolution ( double pixel_size ) { resolution = pixel_size; } /** * Sets the magnification. * @param magnification the magnification. */ public void setMagnification ( double magnification ) { this.magnification = magnification; } /** * Sets the policy on the rotation. * @param policy the number of policy on the rotation. */ public void setRotationPolicy ( int policy ) { policy_rotation = policy; } /** * Adds the magnitude record. It is to create the thumbnail image * objects. * @param record the magnitude record. */ public void addRecord ( XmlMagRecord record ) { thumbnail_list.addElement(new FolderAndRecord(null, record)); } /** * Adds the set of the folder and magnitude record. It is to * create the thumbnail image files. * @param record the magnitude record. * @param folder the folder to create the thumbnail image. */ public void addRecord ( XmlMagRecord record, File folder ) { thumbnail_list.addElement(new FolderAndRecord(folder, record)); } /** * Cleans up the sets of the folder and magnitude record. */ public void clean ( ) { thumbnail_list = new Vector(); } /** * Sets the information database manager. * @param info_manager the information database manager. */ public void setDBManager ( InformationDBManager info_manager ) { this.info_manager = info_manager; } /** * Sets the file manager. * @param file_manager the file manager. */ public void setFileManager ( FileManager file_manager ) { this.file_manager = file_manager; } /** * Creates the thumbnail image objects. * @param records the array of XML magnitude records. * @return the array of the thumbnail image objects. */ public MonoImage[] create ( XmlMagRecord[] records ) { clean(); for (int i = 0 ; i < records.length ; i++) addRecord(records[i]); MonoImage[] images = create(); clean(); return images; } /** * Creates the thumbnail image objects of the previously added * records. * @return the array of the thumbnail image objects in the same * order as magnitude records added to this creater. */ public MonoImage[] create ( ) { notifyStart(); Vector image_list = new Vector(); MonoImage base_image = null; XmlInformation base_info = null; Coor base_coor = null; for (int i = 0 ; i < thumbnail_list.size() ; i++) { FolderAndRecord set = (FolderAndRecord)thumbnail_list.elementAt(i); try { XmlInformation info = file_manager.readInformation(set.record, info_manager); XmlImageLoader loader = new XmlImageLoader(info, file_manager); loader.operate(); MonoImage image = loader.getMonoImage(); Position position = new Position(set.record.getPosition().getX(), set.record.getPosition().getY()); if (gallery_type == TYPE_DIFFERENTIAL && i > 0) position = info.mapCoordinatesToXY(base_coor); MonoImage thumbnail_image = createThumbnailImage(image, position, info); if (gallery_type == TYPE_DIFFERENTIAL) { if (i == 0) { base_image = thumbnail_image; base_info = info; base_coor = info.mapXYToCoordinates(position); } else { thumbnail_image = createDifferentialImage(thumbnail_image, info, base_image, base_info); } } image_list.addElement(thumbnail_image); notifySucceeded(set.record); } catch ( Exception exception ) { notifyFailed(set.record); } } MonoImage[] images = new MonoImage[image_list.size()]; for (int i = 0 ; i < image_list.size() ; i++) images[i] = (MonoImage)image_list.elementAt(i); notifyEnd(null); return images; } /** * Creates the thumbnail image files. * @param records the array of XML magnitude records. * @param folder the folder to create the files. * @return the array of the thumbnail image files. */ public File[] createFile ( XmlMagRecord[] records, File folder ) { clean(); for (int i = 0 ; i < records.length ; i++) addRecord(records[i], folder); File[] files = createFile(); clean(); return files; } /** * Creates the thumbnail image files of the previously added * records. * @return the array of the thumbnail image files. */ public File[] createFile ( ) { notifyStart(); Vector file_list = new Vector(); MonoImage base_image = null; XmlInformation base_info = null; Coor base_coor = null; for (int i = 0 ; i < thumbnail_list.size() ; i++) { FolderAndRecord set = (FolderAndRecord)thumbnail_list.elementAt(i); try { set.folder.mkdirs(); XmlInformation info = file_manager.readInformation(set.record, info_manager); XmlImageLoader loader = new XmlImageLoader(info, file_manager); loader.operate(); MonoImage image = loader.getMonoImage(); Position position = new Position(set.record.getPosition().getX(), set.record.getPosition().getY()); if (gallery_type == TYPE_DIFFERENTIAL && i > 0) position = info.mapCoordinatesToXY(base_coor); MonoImage thumbnail_image = createThumbnailImage(image, position, info); if (gallery_type == TYPE_DIFFERENTIAL) { if (i == 0) { base_image = thumbnail_image; base_info = info; base_coor = info.mapXYToCoordinates(position); } else { thumbnail_image = createDifferentialImage(image, info, base_image, base_info); } } JulianDay jd = JulianDay.create(set.record.getDate()); String filename = jd.getOutputString(JulianDay.FORMAT_MONTH_IN_NUMBER_WITHOUT_SPACE, JulianDay.FORMAT_DECIMALDAY_100000TH) + ".fts"; filename = FileManager.unitePath(set.folder.getPath(), filename); File file = new File(filename); Fits fits = new Fits(file.toURI().toURL()); fits.save(thumbnail_image); file_list.addElement(file); notifySucceeded(set.record); } catch ( Exception exception ) { notifyFailed(set.record); } } File[] files = new File[file_list.size()]; for (int i = 0 ; i < file_list.size() ; i++) files[i] = (File)file_list.elementAt(i); notifyEnd(null); return files; } /** * Creates the thumbnail image. * @param image the original image object. * @param target_position the (x,y) position of the target. * @param info the XML information document. * @return the image object. */ protected MonoImage createThumbnailImage ( MonoImage image, Position target_position, XmlInformation info ) { // Magnifies the thumbnail image. Size size = thumbnail_size; if (policy_magnification == MAGNIFICATION_SPECIFIED_RESOLUTION) { ChartMapFunction cmf = info.getChartMapFunction(); double pixel_size = 3600.0 / cmf.getScaleUnitPerDegree(); double ratio = pixel_size / resolution; size = new Size((int)((double)thumbnail_size.getWidth() / ratio + 0.5), (int)((double)thumbnail_size.getHeight() / ratio + 0.5)); } else if (policy_magnification == MAGNIFICATION_SPECIFIED_MAGNIFICATION) { size = new Size((int)((double)thumbnail_size.getWidth() / magnification + 0.5), (int)((double)thumbnail_size.getHeight() / magnification + 0.5)); } int base_x = (int)(target_position.getX() - (double)size.getWidth() / 2.0 + 0.5); int base_y = (int)(target_position.getY() - (double)size.getHeight() / 2.0 + 0.5); ResizeFilter filter = new ResizeFilter(size); filter.setBasePosition(base_x, base_y); MonoImage thumbnail_image = filter.operate(image); // Rotates the thumbnail image. if (policy_rotation == ROTATION_NORTH_UP_AT_RIGHT_ANGLES) thumbnail_image = new RotateAtRightAnglesFilter(- info.getRotation().getContent()).operate(thumbnail_image); // Magnifies the thumbnail image. if (policy_magnification == MAGNIFICATION_SPECIFIED_RESOLUTION || policy_magnification == MAGNIFICATION_SPECIFIED_MAGNIFICATION) { thumbnail_image = new RescaleFilter(thumbnail_size).operate(thumbnail_image); } return thumbnail_image; } /** * Creates the differential image. * @param image the target image object. * @param info the XML information document of the target image. * @param base_image the base image object. * @param base_info the XML information document of the base image. * @return the image object. */ protected MonoImage createDifferentialImage ( MonoImage image, XmlInformation info, MonoImage base_image, XmlInformation base_info ) { // Restores rotation of the thumbnail image. if (policy_rotation == ROTATION_NORTH_UP_AT_RIGHT_ANGLES) image = new RotateAtRightAnglesFilter(info.getRotation().getContent()).operate(image); // Magnification. double magnification = 1.0; if (policy_magnification == MAGNIFICATION_KEEP_ORIGINAL || policy_magnification == MAGNIFICATION_SPECIFIED_MAGNIFICATION) { ChartMapFunction cmf = info.getChartMapFunction(); ChartMapFunction base_cmf = base_info.getChartMapFunction(); magnification = base_cmf.getScaleUnitPerDegree() / cmf.getScaleUnitPerDegree(); } // Rotation. double pa = info.getRotation().getContent(); double base_pa = base_info.getRotation().getContent(); double rotation = base_pa - pa; // Maps the image to the base image. MapFunction map_function = new MapFunction(new Position(0, 0), magnification, rotation); image = new MapFilter(map_function).operate(image); // Rotates the thumbnail image. if (policy_rotation == ROTATION_NORTH_UP_AT_RIGHT_ANGLES) image = new RotateAtRightAnglesFilter(- base_info.getRotation().getContent()).operate(image); // Subtract the base image. image = new SubtractionFilter(image).operate(base_image); return image; } /** * The <code>FolderAndRecord</code> is a set of the folder and the * magnitude record to create a thumbnail image. */ protected class FolderAndRecord { /** * The folder to create the thumbnail image. */ public File folder; /** * The magnitude record. */ public XmlMagRecord record; /** * Constructs a <code>FolderAndRecord</code>. * @param folder the folder to create the thumbnail image. * @param record the magnitude record. */ public FolderAndRecord ( File folder, XmlMagRecord record ) { this.folder = folder; this.record = record; } } }
14,431
0.69318
0.687024
507
27.516766
28.126883
148
false
false
0
0
0
0
0
0
1.765286
false
false
9
d74559abf505edf32e2af33a0ebb2a72b6620bf8
32,083,405,738,813
2db4ce5cbe1992a56c6c30d302c72e72c8c4e6e6
/CorridaMaluca/src/Veiculo.java
3998bfc1bad4ee7a31217f68ee6a57550db92e80
[]
no_license
WandersonMaia/CorridaMaluca
https://github.com/WandersonMaia/CorridaMaluca
b679857afcce1f722d27d002ffb4067bee0ca84b
daa0d30fda8631d18e0564c177936bc6ba3fb887
refs/heads/master
2016-08-12T09:47:25.909000
2015-11-11T09:58:18
2015-11-11T10:09:11
45,977,502
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Veiculo { private String nome; private float velocidade; private float autonomia; private float tempoAbastecimento; private float distanciaPercorrida; private float tanqueGasolina; private float tempoPercorridoHoras; private float tamanhoTanque; private int voltas; public void correr(int distancia) { // System.out.println("Correndo a distancia de"+ distancia); distanciaPercorrida += distancia; tempoPercorridoHoras += distancia/velocidade; tanqueGasolina -= distancia/autonomia; if(tanqueGasolina<=0){ System.out.print("Abastancendo..."); tanqueGasolina = tamanhoTanque; float tempoAbast = tempoAbastecimento; tempoPercorridoHoras += tempoAbast; System.out.println("Feito!"); } } public float getDistanciaPercorrida() { return distanciaPercorrida; } public void setDistanciaPercorrida(float distanciaPercorrida) { this.distanciaPercorrida = distanciaPercorrida; } public float getTanqueGasolina() { return tanqueGasolina; } public void setTanqueGasolina(float tanqueGasolina) { this.tanqueGasolina = tanqueGasolina; } public float getTempoPercorridoHoras() { return tempoPercorridoHoras; } public void setTempoPercorridoHoras(float tempoPercorridoHoras) { this.tempoPercorridoHoras = tempoPercorridoHoras; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public float getVelocidade() { return velocidade; } public void setVelocidade(float velocidade) { this.velocidade = velocidade; } public float getAutonomia() { return autonomia; } public void setAutonomia(float autonomia) { this.autonomia = autonomia; } public float getTempoAbastecimento() { return tempoAbastecimento; } public void setTempoAbastecimento(float tempoAbastecimento) { this.tempoAbastecimento = tempoAbastecimento; } public float getTamanhoTanque() { return tamanhoTanque; } public void setTamanhoTanque(float tamanhoTanque) { this.tamanhoTanque = tamanhoTanque; } public int getVoltas() { return voltas; } public void setVoltas(int voltas) { this.voltas = voltas; } public static void main(String[] args) { System.out.println(1); System.out.println(2); System.out.println(3); System.out.printf("%d%d%d", 1,2,3); } }
UTF-8
Java
2,359
java
Veiculo.java
Java
[]
null
[]
public class Veiculo { private String nome; private float velocidade; private float autonomia; private float tempoAbastecimento; private float distanciaPercorrida; private float tanqueGasolina; private float tempoPercorridoHoras; private float tamanhoTanque; private int voltas; public void correr(int distancia) { // System.out.println("Correndo a distancia de"+ distancia); distanciaPercorrida += distancia; tempoPercorridoHoras += distancia/velocidade; tanqueGasolina -= distancia/autonomia; if(tanqueGasolina<=0){ System.out.print("Abastancendo..."); tanqueGasolina = tamanhoTanque; float tempoAbast = tempoAbastecimento; tempoPercorridoHoras += tempoAbast; System.out.println("Feito!"); } } public float getDistanciaPercorrida() { return distanciaPercorrida; } public void setDistanciaPercorrida(float distanciaPercorrida) { this.distanciaPercorrida = distanciaPercorrida; } public float getTanqueGasolina() { return tanqueGasolina; } public void setTanqueGasolina(float tanqueGasolina) { this.tanqueGasolina = tanqueGasolina; } public float getTempoPercorridoHoras() { return tempoPercorridoHoras; } public void setTempoPercorridoHoras(float tempoPercorridoHoras) { this.tempoPercorridoHoras = tempoPercorridoHoras; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public float getVelocidade() { return velocidade; } public void setVelocidade(float velocidade) { this.velocidade = velocidade; } public float getAutonomia() { return autonomia; } public void setAutonomia(float autonomia) { this.autonomia = autonomia; } public float getTempoAbastecimento() { return tempoAbastecimento; } public void setTempoAbastecimento(float tempoAbastecimento) { this.tempoAbastecimento = tempoAbastecimento; } public float getTamanhoTanque() { return tamanhoTanque; } public void setTamanhoTanque(float tamanhoTanque) { this.tamanhoTanque = tamanhoTanque; } public int getVoltas() { return voltas; } public void setVoltas(int voltas) { this.voltas = voltas; } public static void main(String[] args) { System.out.println(1); System.out.println(2); System.out.println(3); System.out.printf("%d%d%d", 1,2,3); } }
2,359
0.729123
0.726155
136
16.338236
18.510817
66
false
false
0
0
0
0
0
0
1.455882
false
false
9
05720200071ef8095d4badeebe2fd24475c6bba8
34,222,299,441,134
3f03fe581da98ca05b619ce00f0706cc226860a6
/src/main/java/cotizador/app/ApplicationInitializing.java
f0a0cb818117e322727b109293f95d32be7573c2
[]
no_license
dikmarti/cotizador
https://github.com/dikmarti/cotizador
f75e819d57ec7c30af94b802eeb70660d23bea75
099eae2fe5f22502dcff4109b935c360969ffe9b
refs/heads/master
2020-04-07T02:46:56.396000
2019-08-25T02:45:13
2019-08-25T02:45:13
157,989,532
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cotizador.app; import org.glassfish.jersey.server.ResourceConfig; public class ApplicationInitializing extends ResourceConfig { public ApplicationInitializing() { // Define the package which contains the service classes. packages("cotizador"); register(new BinderApplication()); } }
UTF-8
Java
327
java
ApplicationInitializing.java
Java
[]
null
[]
package cotizador.app; import org.glassfish.jersey.server.ResourceConfig; public class ApplicationInitializing extends ResourceConfig { public ApplicationInitializing() { // Define the package which contains the service classes. packages("cotizador"); register(new BinderApplication()); } }
327
0.727829
0.727829
11
28.818182
23.571239
65
false
false
0
0
0
0
0
0
0.363636
false
false
9
751083cc87f3fec6c33377d41a752fd683cc12d4
13,924,284,019,642
67049933caf84aaa9ec2c17b0f5bad4513f9b46a
/src/com/dhc/pattern/factory/abstractfactory/VerificationReport.java
64adde8f200484cf9f951650a69242254b8d251b
[]
no_license
dinghongchao/DesignPatterns
https://github.com/dinghongchao/DesignPatterns
90cb442810f5b7673bd7d38141bd07eac9ed5802
a1ca5abdfca16d714b2aa0f01fc6e302748f29e0
refs/heads/master
2020-04-28T00:18:13.578000
2019-03-14T23:46:34
2019-03-14T23:46:34
174,810,416
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dhc.pattern.factory.abstractfactory; public class VerificationReport implements IReport { @Override public void report() { System.out.println("接收到验证码的状态报告"); } }
UTF-8
Java
217
java
VerificationReport.java
Java
[]
null
[]
package com.dhc.pattern.factory.abstractfactory; public class VerificationReport implements IReport { @Override public void report() { System.out.println("接收到验证码的状态报告"); } }
217
0.712821
0.712821
8
23.375
20.223362
52
false
false
0
0
0
0
0
0
0.25
false
false
9
c2ceac40c9e26678e7667293dfc0728dc3df7981
5,798,205,872,059
f497754f899e029558a29d16a173751d0420a5e8
/player.java
c930dbcc0da30b05a6b206dabb7b1b514582829e
[]
no_license
MatthewShamoon/TicTacToe-Assignment
https://github.com/MatthewShamoon/TicTacToe-Assignment
e4d36694e895ba541f08ec066e79d71f3a361729
06bf221c01dc12eb177e0b48996e30f85e1aeaaf
refs/heads/master
2020-05-01T01:13:55.154000
2019-03-22T18:26:53
2019-03-22T18:26:53
177,190,555
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//Matthew Shamoon import java.util.Scanner; abstract public class player { board gameBoard; String playerName; int playerSymbol; public player() { } /** * * @param board * @param playerSymbol * @param name */ public player(board board, int playerSymbol, String name) { gameBoard = board; this.playerSymbol = playerSymbol; playerName = name; } /** * * @param board */ abstract public void play(board board); }
UTF-8
Java
498
java
player.java
Java
[ { "context": "//Matthew Shamoon\r\n\r\nimport java.util.Scanner;\r\n\r\nabstract public c", "end": 17, "score": 0.9998471140861511, "start": 2, "tag": "NAME", "value": "Matthew Shamoon" } ]
null
[]
//<NAME> import java.util.Scanner; abstract public class player { board gameBoard; String playerName; int playerSymbol; public player() { } /** * * @param board * @param playerSymbol * @param name */ public player(board board, int playerSymbol, String name) { gameBoard = board; this.playerSymbol = playerSymbol; playerName = name; } /** * * @param board */ abstract public void play(board board); }
489
0.598394
0.598394
36
11.833333
13.254978
58
false
false
0
0
0
0
0
0
1.222222
false
false
13
9f82ed9647fb373452ef9426b990b0a9cb8f4004
17,231,408,813,526
eabaa319792de86026c5c70c83c881d68df657a6
/Server/src/at/dahu4wa/homecontrol/services/LogFileService.java
b19397b7c31d2781a727e9a7e49c5f276669dc61
[]
no_license
Laess3r/home-remote
https://github.com/Laess3r/home-remote
0cdc9e6d8c40b57e0e88d3825dce0cbed3f58dc6
fdedb586c7b945e8728ceacefac9124423b9f5d3
refs/heads/master
2021-05-28T08:43:03.551000
2015-03-19T06:54:09
2015-03-19T06:54:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package at.dahu4wa.homecontrol.services; import java.util.List; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Request; import javax.ws.rs.core.UriInfo; import at.dahu4wa.homecontrol.maincontrol.HomeControl; import at.dahuawa.homecontrol.model.LogEntry; /** * The resource to access the logfile over the web * * @author Stefan Huber */ @Path("/log") public class LogFileService { private final static HomeControl hc = HomeControl.getInstance(); @Context UriInfo uriInfo; @Context Request request; @GET @Path("/all") @Produces(MediaType.APPLICATION_JSON) public List<LogEntry> getAllLogEntries() { return hc.getLogEntries(); } }
UTF-8
Java
810
java
LogFileService.java
Java
[ { "context": "o access the logfile over the web\r\n * \r\n * @author Stefan Huber\r\n */\r\n@Path(\"/log\")\r\npublic class LogFileService ", "end": 481, "score": 0.9998930096626282, "start": 469, "tag": "NAME", "value": "Stefan Huber" } ]
null
[]
package at.dahu4wa.homecontrol.services; import java.util.List; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Request; import javax.ws.rs.core.UriInfo; import at.dahu4wa.homecontrol.maincontrol.HomeControl; import at.dahuawa.homecontrol.model.LogEntry; /** * The resource to access the logfile over the web * * @author <NAME> */ @Path("/log") public class LogFileService { private final static HomeControl hc = HomeControl.getInstance(); @Context UriInfo uriInfo; @Context Request request; @GET @Path("/all") @Produces(MediaType.APPLICATION_JSON) public List<LogEntry> getAllLogEntries() { return hc.getLogEntries(); } }
804
0.723457
0.720988
37
19.945946
17.824892
65
false
false
0
0
0
0
0
0
0.72973
false
false
13
e32e8fe0a5fa93f9726164ab6e59249a5c1dd6ea
15,247,133,945,140
fd2490205171146ee7ed876b09bf3b6c61423c3a
/pb/target/tomcat/work/Tomcat/localhost/_/org/apache/jsp/WEB_002dINF/views/admin/category_005fmanage_jsp.java
a075294bf8b9b4759bbdbebc91ea9807a8538ded
[]
no_license
dhf1/pb
https://github.com/dhf1/pb
0883fd85e53e0984fbebc135c341e540d22b0251
2390d87c8acd7046afd4173807caf6ba14d45f53
refs/heads/master
2020-03-28T03:10:46.504000
2018-09-06T06:33:45
2018-09-06T06:33:45
146,448,262
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Generated by the Jasper component of Apache Tomcat * Version: Apache Tomcat/7.0.47 * Generated at: 2018-09-06 06:14:31 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.apache.jsp.WEB_002dINF.views.admin; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.util.*; public final class category_005fmanage_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; private javax.el.ExpressionFactory _el_expressionfactory; private org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public void _jspInit() { _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } public void _jspDestroy() { } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html;charset=utf-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write("\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n"); out.write("<link href=\"/static/admin_css/css.css\" rel=\"stylesheet\" type=\"text/css\">\r\n"); out.write("<body bgcolor=\"#FFFFFF\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\r\n"); out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n"); out.write("\"http://www.w3.org/TR/html4/loose.dtd\">\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n"); out.write("<link href=\"/static/admin_css/css.css\" rel=\"stylesheet\" type=\"text/css\">\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n"); out.write("<link href=\"/static/admin_css/css.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n"); out.write("<script language=\"javascript\" src=\"/static/js/validator.js\"></script>\r\n"); out.write("<style type=\"text/css\">\r\n"); out.write("<!--\r\n"); out.write(".number {\tpadding: 3px;\r\n"); out.write("\theight: 22px;\r\n"); out.write("\tborder: 1px solid #CCCCCC;\r\n"); out.write("}\r\n"); out.write(".username {\tbackground-attachment: scroll;\r\n"); out.write("\tbackground-image: url(/static/images/nzcms_system_16.gif);\r\n"); out.write("\tbackground-repeat: no-repeat;\r\n"); out.write("\tbackground-position: right;\r\n"); out.write("\tbackground-color: #FFFFFF;\r\n"); out.write("\tpadding: 3px;\r\n"); out.write("\tborder: 1px solid #CCCCCC;\r\n"); out.write("\theight: 24px;\r\n"); out.write("}\r\n"); out.write(".userpassword {\tbackground-attachment: scroll;\r\n"); out.write("\tbackground-image: url(/static/images/nzcms_system_19.gif);\r\n"); out.write("\tbackground-repeat: no-repeat;\r\n"); out.write("\tbackground-position: right;\r\n"); out.write("\tbackground-color: #FFFFFF;\r\n"); out.write("\tpadding: 3px;\r\n"); out.write("\tborder: 1px solid #CCCCCC;\r\n"); out.write("\theight: 24px;\r\n"); out.write("}\r\n"); out.write(".whitetitle {\r\n"); out.write("\tfont: 18px \"微软雅黑\";\r\n"); out.write("\tcolor: #FFFFFF;\r\n"); out.write("}\r\n"); out.write("-->\r\n"); out.write("</style>\r\n"); out.write("\r\n"); out.write("<!--后台调用 -->\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("<script language=\"JavaScript\">\r\n"); out.write("function Display(ID)\r\n"); out.write("{\r\n"); out.write(" if( ID.style.display == 'none' )\r\n"); out.write("{\r\n"); out.write("ID.style.display = '' ;\r\n"); out.write("}\r\n"); out.write("else\t\r\n"); out.write("{\r\n"); out.write("ID.style.display = 'none' ;\r\n"); out.write("}\r\n"); out.write("}\r\n"); out.write("</script>\r\n"); out.write("\r\n"); out.write("<script>\r\n"); out.write("function selectAll(obj)\r\n"); out.write("{\r\n"); out.write("for(var i = 0;i<obj.elements.length;i++)\r\n"); out.write("if(obj.elements[i].type == \"checkbox\")\r\n"); out.write("obj.elements[i].checked = true;\r\n"); out.write("}\r\n"); out.write("function selectOther(obj)\r\n"); out.write("{\r\n"); out.write("for(var i = 0;i<obj.elements.length;i++)\r\n"); out.write("if(obj.elements[i].type == \"checkbox\" )\r\n"); out.write("{\r\n"); out.write("if(!obj.elements[i].checked)\r\n"); out.write("obj.elements[i].checked = true;\r\n"); out.write("else\r\n"); out.write("obj.elements[i].checked = false;\r\n"); out.write("\r\n"); out.write("}\r\n"); out.write("}\r\n"); out.write("</script>\r\n"); out.write("\r\n"); out.write("<script language=\"javascript\">\r\n"); out.write("function changecolor(obj)\r\n"); out.write("{\r\n"); out.write(" e = event.srcElement\r\n"); out.write(" if(e.checked==true)\r\n"); out.write(" {\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e.style.background = \"#C1D2EE\"\r\n"); out.write(" }\r\n"); out.write(" else\r\n"); out.write(" {\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e.style.background = \"#ffffff\"\r\n"); out.write(" }\r\n"); out.write("} \r\n"); out.write("\r\n"); out.write("</script>\r\n"); out.write("<link rel=\"shortcut icon\" href=\"/static/images/nz.ico\" />\r\n"); out.write("<title>《&nbsp;"); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${sessionScope.pbAdmin.adminname}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("&nbsp;》,您好!欢迎您登录后台管理 - </title>\r\n"); out.write("\r\n"); out.write("<script language=\"JavaScript\">\r\n"); out.write("function Display(ID)\r\n"); out.write("{\r\n"); out.write(" if( ID.style.display == 'none' )\r\n"); out.write("{\r\n"); out.write("ID.style.display = '' ;\r\n"); out.write("}\r\n"); out.write("else\t\r\n"); out.write("{\r\n"); out.write("ID.style.display = 'none' ;\r\n"); out.write("}\r\n"); out.write("}\r\n"); out.write("</script>\r\n"); out.write("\r\n"); out.write("<script>\r\n"); out.write("function selectAll(obj)\r\n"); out.write("{\r\n"); out.write("for(var i = 0;i<obj.elements.length;i++)\r\n"); out.write("if(obj.elements[i].type == \"checkbox\")\r\n"); out.write("obj.elements[i].checked = true;\r\n"); out.write("}\r\n"); out.write("function selectOther(obj)\r\n"); out.write("{\r\n"); out.write("for(var i = 0;i<obj.elements.length;i++)\r\n"); out.write("if(obj.elements[i].type == \"checkbox\" )\r\n"); out.write("{\r\n"); out.write("if(!obj.elements[i].checked)\r\n"); out.write("obj.elements[i].checked = true;\r\n"); out.write("else\r\n"); out.write("obj.elements[i].checked = false;\r\n"); out.write("\r\n"); out.write("}\r\n"); out.write("}\r\n"); out.write("</script>\r\n"); out.write("\r\n"); out.write("<script language=\"javascript\">\r\n"); out.write("function changecolor(obj)\r\n"); out.write("{\r\n"); out.write(" e = event.srcElement\r\n"); out.write(" if(e.checked==true)\r\n"); out.write(" {\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e.style.background = \"#C1D2EE\"\r\n"); out.write(" }\r\n"); out.write(" else\r\n"); out.write(" {\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e.style.background = \"#ffffff\"\r\n"); out.write(" }\r\n"); out.write("} \r\n"); out.write("\r\n"); out.write("</script>\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" background=\"/static/images/nzcms_top_02.gif\" bgcolor=\"#2A4A87\">\r\n"); out.write("<tr>\r\n"); out.write(" <td width=\"200\" valign=\"top\"><a href=\"/admin/index\"></a><a href=\"manage_web.asp\"><img src=\"/static/images/logo.jpg\" alt=\"后台标识\" border=\"0\"></a></td>\r\n"); out.write(" <td align=\"left\" valign=\"bottom\" class=\"white\"><table height=\"30\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n"); out.write(" <tr>\r\n"); out.write(" <td width=\"56\" align=\"center\" background=\"/static/images/menu01.gif\"><a href=\"/admin/index\" class=\"left2\">首页</a></td>\r\n"); out.write(" <td width=\"56\" align=\"center\" background=\"/static/images/menu01.gif\"><a href=\"/admin/setting\" class=\"left2\">设置</a></td>\r\n"); out.write(" <td width=\"56\" align=\"center\"background=\"/static/images/menu01.gif\"><a href=\"/admin/manager\" class=\"left2\">用户</a></td>\r\n"); out.write(" <td width=\"56\" align=\"center\"background=\"/static/images/menu02.gif\"><a href=\"/admin/information\" class=\"left2\">信息</a></td>\t\t\r\n"); out.write(" \r\n"); out.write(" <td width=\"56\" align=\"center\" background=\"/static/images/menu01.gif\"><a href=\"/index\" target=\"_blank\" class=\"left2\">前台</a></td>\r\n"); out.write(" <td width=\"56\" align=\"center\" background=\"/static/images/menu01.gif\"><a href=\"/admin/logout\" onclick=\"return confirm('您确定退出操作吗?');\" class=\"left2\">退出</a></td>\r\n"); out.write(" </tr>\r\n"); out.write(" </table></td>\r\n"); out.write(" </tr>\r\n"); out.write("</table>\r\n"); out.write("<table width=\"100%\" height=\"5\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\" bgcolor=\"#003366\">\r\n"); out.write(" <tr>\r\n"); out.write(" <td align=\"right\"></td>\r\n"); out.write(" </tr>\r\n"); out.write("</table>\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("<!-- 后台调用-->\r\n"); out.write("\r\n"); out.write("<table width=\"100%\" height=\"85%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n"); out.write(" <tr>\r\n"); out.write(" <td width=\"200\" align=\"center\" valign=\"top\" bgcolor=\"#C9DEFA\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n"); out.write("<link href=\"/static/admin_css/css.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n"); out.write("<script language=\"javascript\" src=\"/static/js/validator.js\"></script>\r\n"); out.write("<style type=\"text/css\">\r\n"); out.write("<!--\r\n"); out.write(".number {\tpadding: 3px;\r\n"); out.write("\theight: 22px;\r\n"); out.write("\tborder: 1px solid #CCCCCC;\r\n"); out.write("}\r\n"); out.write(".username {\tbackground-attachment: scroll;\r\n"); out.write("\tbackground-image: url(/static/images/nzcms_system_16.gif);\r\n"); out.write("\tbackground-repeat: no-repeat;\r\n"); out.write("\tbackground-position: right;\r\n"); out.write("\tbackground-color: #FFFFFF;\r\n"); out.write("\tpadding: 3px;\r\n"); out.write("\tborder: 1px solid #CCCCCC;\r\n"); out.write("\theight: 24px;\r\n"); out.write("}\r\n"); out.write(".userpassword {\tbackground-attachment: scroll;\r\n"); out.write("\tbackground-image: url(/static/images/nzcms_system_19.gif);\r\n"); out.write("\tbackground-repeat: no-repeat;\r\n"); out.write("\tbackground-position: right;\r\n"); out.write("\tbackground-color: #FFFFFF;\r\n"); out.write("\tpadding: 3px;\r\n"); out.write("\tborder: 1px solid #CCCCCC;\r\n"); out.write("\theight: 24px;\r\n"); out.write("}\r\n"); out.write(".whitetitle {\r\n"); out.write("\tfont: 18px \"微软雅黑\";\r\n"); out.write("\tcolor: #FFFFFF;\r\n"); out.write("}\r\n"); out.write("-->\r\n"); out.write("</style>\r\n"); out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n"); out.write("\"http://www.w3.org/TR/html4/loose.dtd\">\r\n"); out.write("<html>\r\n"); out.write("<head>\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n"); out.write("<link href=\"/static/admin_css/css.css\" rel=\"stylesheet\" type=\"text/css\">\r\n"); out.write("\r\n"); out.write("\r\n"); out.write(" <table width=\"200\" height=\"45\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"/static/images/nzsoft_14.gif\" id=\"1\">\r\n"); out.write(" <tr> <td width=\"55\" align=\"center\">&nbsp;</td>\r\n"); out.write(" <td class=\"left14\">信息管理</td>\r\n"); out.write(" </tr>\r\n"); out.write(" </table>\r\n"); out.write(" <table width=\"180\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"C9DEFA\" >\r\n"); out.write(" <tr>\r\n"); out.write(" <td height=\"40\" onMouseOver='this. background=\"/static/images/left2.gif\"' onMouseOut='this. background=\"/static/images/left1.gif\"' background=\"/static/images/left1.gif\" ><a href=\"/admin/add_article\" class=\"left3\">添加新文章</a></td>\r\n"); out.write(" </tr>\r\n"); out.write(" <tr>\r\n"); out.write(" <td height=\"40\" onMouseOver='this. background=\"/static/images/left2.gif\"' onMouseOut='this. background=\"/static/images/left1.gif\"' background=\"/static/images/left1.gif\" ><a href=\"/admin/category_manage\" class=\"left3\">栏目类别管理</a></td>\r\n"); out.write(" </tr>\r\n"); out.write(" <tr>\r\n"); out.write(" <td height=\"40\" onMouseOver='this. background=\"/static/images/left2.gif\"' onMouseOut='this. background=\"/static/images/left1.gif\"' background=\"/static/images/left1.gif\" ><a href=\"/admin/manage_by_class\" class=\"left3\">按类管理信息</a></td>\r\n"); out.write(" </tr>\r\n"); out.write(" <tr>\r\n"); out.write(" <td height=\"40\" onMouseOver='this. background=\"/static/images/left2.gif\"' onMouseOut='this. background=\"/static/images/left1.gif\"' background=\"/static/images/left1.gif\" ><a href=\"/admin/all_information\" class=\"left3\">管理所有信息</a></td>\r\n"); out.write(" </tr>\r\n"); out.write(" </table>\r\n"); out.write(" </td>\r\n"); out.write(" <td align=\"center\" valign=\"top\">\r\n"); out.write(" <table width=\"0\" height=\"6\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n"); out.write(" <tr>\r\n"); out.write(" <td></td>\r\n"); out.write(" </tr>\r\n"); out.write(" </table>\r\n"); out.write("\r\n"); out.write("<iframe src=\"/admin/get_categoryResultList/2\" name=\"sina_roll\" width=\"98%\" marginwidth=\"0\" height=\"97%\" marginheight=\"10\" scrolling=\"Yes\" frameborder=\"Yes\" id=\"sina_roll\" border=\"10\"></iframe>\r\n"); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write("</table>\r\n"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
UTF-8
Java
17,773
java
category_005fmanage_jsp.java
Java
[]
null
[]
/* * Generated by the Jasper component of Apache Tomcat * Version: Apache Tomcat/7.0.47 * Generated at: 2018-09-06 06:14:31 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.apache.jsp.WEB_002dINF.views.admin; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.util.*; public final class category_005fmanage_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; private javax.el.ExpressionFactory _el_expressionfactory; private org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public void _jspInit() { _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } public void _jspDestroy() { } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html;charset=utf-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write("\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n"); out.write("<link href=\"/static/admin_css/css.css\" rel=\"stylesheet\" type=\"text/css\">\r\n"); out.write("<body bgcolor=\"#FFFFFF\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\r\n"); out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n"); out.write("\"http://www.w3.org/TR/html4/loose.dtd\">\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n"); out.write("<link href=\"/static/admin_css/css.css\" rel=\"stylesheet\" type=\"text/css\">\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n"); out.write("<link href=\"/static/admin_css/css.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n"); out.write("<script language=\"javascript\" src=\"/static/js/validator.js\"></script>\r\n"); out.write("<style type=\"text/css\">\r\n"); out.write("<!--\r\n"); out.write(".number {\tpadding: 3px;\r\n"); out.write("\theight: 22px;\r\n"); out.write("\tborder: 1px solid #CCCCCC;\r\n"); out.write("}\r\n"); out.write(".username {\tbackground-attachment: scroll;\r\n"); out.write("\tbackground-image: url(/static/images/nzcms_system_16.gif);\r\n"); out.write("\tbackground-repeat: no-repeat;\r\n"); out.write("\tbackground-position: right;\r\n"); out.write("\tbackground-color: #FFFFFF;\r\n"); out.write("\tpadding: 3px;\r\n"); out.write("\tborder: 1px solid #CCCCCC;\r\n"); out.write("\theight: 24px;\r\n"); out.write("}\r\n"); out.write(".userpassword {\tbackground-attachment: scroll;\r\n"); out.write("\tbackground-image: url(/static/images/nzcms_system_19.gif);\r\n"); out.write("\tbackground-repeat: no-repeat;\r\n"); out.write("\tbackground-position: right;\r\n"); out.write("\tbackground-color: #FFFFFF;\r\n"); out.write("\tpadding: 3px;\r\n"); out.write("\tborder: 1px solid #CCCCCC;\r\n"); out.write("\theight: 24px;\r\n"); out.write("}\r\n"); out.write(".whitetitle {\r\n"); out.write("\tfont: 18px \"微软雅黑\";\r\n"); out.write("\tcolor: #FFFFFF;\r\n"); out.write("}\r\n"); out.write("-->\r\n"); out.write("</style>\r\n"); out.write("\r\n"); out.write("<!--后台调用 -->\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("<script language=\"JavaScript\">\r\n"); out.write("function Display(ID)\r\n"); out.write("{\r\n"); out.write(" if( ID.style.display == 'none' )\r\n"); out.write("{\r\n"); out.write("ID.style.display = '' ;\r\n"); out.write("}\r\n"); out.write("else\t\r\n"); out.write("{\r\n"); out.write("ID.style.display = 'none' ;\r\n"); out.write("}\r\n"); out.write("}\r\n"); out.write("</script>\r\n"); out.write("\r\n"); out.write("<script>\r\n"); out.write("function selectAll(obj)\r\n"); out.write("{\r\n"); out.write("for(var i = 0;i<obj.elements.length;i++)\r\n"); out.write("if(obj.elements[i].type == \"checkbox\")\r\n"); out.write("obj.elements[i].checked = true;\r\n"); out.write("}\r\n"); out.write("function selectOther(obj)\r\n"); out.write("{\r\n"); out.write("for(var i = 0;i<obj.elements.length;i++)\r\n"); out.write("if(obj.elements[i].type == \"checkbox\" )\r\n"); out.write("{\r\n"); out.write("if(!obj.elements[i].checked)\r\n"); out.write("obj.elements[i].checked = true;\r\n"); out.write("else\r\n"); out.write("obj.elements[i].checked = false;\r\n"); out.write("\r\n"); out.write("}\r\n"); out.write("}\r\n"); out.write("</script>\r\n"); out.write("\r\n"); out.write("<script language=\"javascript\">\r\n"); out.write("function changecolor(obj)\r\n"); out.write("{\r\n"); out.write(" e = event.srcElement\r\n"); out.write(" if(e.checked==true)\r\n"); out.write(" {\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e.style.background = \"#C1D2EE\"\r\n"); out.write(" }\r\n"); out.write(" else\r\n"); out.write(" {\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e.style.background = \"#ffffff\"\r\n"); out.write(" }\r\n"); out.write("} \r\n"); out.write("\r\n"); out.write("</script>\r\n"); out.write("<link rel=\"shortcut icon\" href=\"/static/images/nz.ico\" />\r\n"); out.write("<title>《&nbsp;"); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${sessionScope.pbAdmin.adminname}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("&nbsp;》,您好!欢迎您登录后台管理 - </title>\r\n"); out.write("\r\n"); out.write("<script language=\"JavaScript\">\r\n"); out.write("function Display(ID)\r\n"); out.write("{\r\n"); out.write(" if( ID.style.display == 'none' )\r\n"); out.write("{\r\n"); out.write("ID.style.display = '' ;\r\n"); out.write("}\r\n"); out.write("else\t\r\n"); out.write("{\r\n"); out.write("ID.style.display = 'none' ;\r\n"); out.write("}\r\n"); out.write("}\r\n"); out.write("</script>\r\n"); out.write("\r\n"); out.write("<script>\r\n"); out.write("function selectAll(obj)\r\n"); out.write("{\r\n"); out.write("for(var i = 0;i<obj.elements.length;i++)\r\n"); out.write("if(obj.elements[i].type == \"checkbox\")\r\n"); out.write("obj.elements[i].checked = true;\r\n"); out.write("}\r\n"); out.write("function selectOther(obj)\r\n"); out.write("{\r\n"); out.write("for(var i = 0;i<obj.elements.length;i++)\r\n"); out.write("if(obj.elements[i].type == \"checkbox\" )\r\n"); out.write("{\r\n"); out.write("if(!obj.elements[i].checked)\r\n"); out.write("obj.elements[i].checked = true;\r\n"); out.write("else\r\n"); out.write("obj.elements[i].checked = false;\r\n"); out.write("\r\n"); out.write("}\r\n"); out.write("}\r\n"); out.write("</script>\r\n"); out.write("\r\n"); out.write("<script language=\"javascript\">\r\n"); out.write("function changecolor(obj)\r\n"); out.write("{\r\n"); out.write(" e = event.srcElement\r\n"); out.write(" if(e.checked==true)\r\n"); out.write(" {\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e.style.background = \"#C1D2EE\"\r\n"); out.write(" }\r\n"); out.write(" else\r\n"); out.write(" {\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e = e.parentElement\r\n"); out.write(" e.style.background = \"#ffffff\"\r\n"); out.write(" }\r\n"); out.write("} \r\n"); out.write("\r\n"); out.write("</script>\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" background=\"/static/images/nzcms_top_02.gif\" bgcolor=\"#2A4A87\">\r\n"); out.write("<tr>\r\n"); out.write(" <td width=\"200\" valign=\"top\"><a href=\"/admin/index\"></a><a href=\"manage_web.asp\"><img src=\"/static/images/logo.jpg\" alt=\"后台标识\" border=\"0\"></a></td>\r\n"); out.write(" <td align=\"left\" valign=\"bottom\" class=\"white\"><table height=\"30\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n"); out.write(" <tr>\r\n"); out.write(" <td width=\"56\" align=\"center\" background=\"/static/images/menu01.gif\"><a href=\"/admin/index\" class=\"left2\">首页</a></td>\r\n"); out.write(" <td width=\"56\" align=\"center\" background=\"/static/images/menu01.gif\"><a href=\"/admin/setting\" class=\"left2\">设置</a></td>\r\n"); out.write(" <td width=\"56\" align=\"center\"background=\"/static/images/menu01.gif\"><a href=\"/admin/manager\" class=\"left2\">用户</a></td>\r\n"); out.write(" <td width=\"56\" align=\"center\"background=\"/static/images/menu02.gif\"><a href=\"/admin/information\" class=\"left2\">信息</a></td>\t\t\r\n"); out.write(" \r\n"); out.write(" <td width=\"56\" align=\"center\" background=\"/static/images/menu01.gif\"><a href=\"/index\" target=\"_blank\" class=\"left2\">前台</a></td>\r\n"); out.write(" <td width=\"56\" align=\"center\" background=\"/static/images/menu01.gif\"><a href=\"/admin/logout\" onclick=\"return confirm('您确定退出操作吗?');\" class=\"left2\">退出</a></td>\r\n"); out.write(" </tr>\r\n"); out.write(" </table></td>\r\n"); out.write(" </tr>\r\n"); out.write("</table>\r\n"); out.write("<table width=\"100%\" height=\"5\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\" bgcolor=\"#003366\">\r\n"); out.write(" <tr>\r\n"); out.write(" <td align=\"right\"></td>\r\n"); out.write(" </tr>\r\n"); out.write("</table>\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("<!-- 后台调用-->\r\n"); out.write("\r\n"); out.write("<table width=\"100%\" height=\"85%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\r\n"); out.write(" <tr>\r\n"); out.write(" <td width=\"200\" align=\"center\" valign=\"top\" bgcolor=\"#C9DEFA\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n"); out.write("<link href=\"/static/admin_css/css.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n"); out.write("<script language=\"javascript\" src=\"/static/js/validator.js\"></script>\r\n"); out.write("<style type=\"text/css\">\r\n"); out.write("<!--\r\n"); out.write(".number {\tpadding: 3px;\r\n"); out.write("\theight: 22px;\r\n"); out.write("\tborder: 1px solid #CCCCCC;\r\n"); out.write("}\r\n"); out.write(".username {\tbackground-attachment: scroll;\r\n"); out.write("\tbackground-image: url(/static/images/nzcms_system_16.gif);\r\n"); out.write("\tbackground-repeat: no-repeat;\r\n"); out.write("\tbackground-position: right;\r\n"); out.write("\tbackground-color: #FFFFFF;\r\n"); out.write("\tpadding: 3px;\r\n"); out.write("\tborder: 1px solid #CCCCCC;\r\n"); out.write("\theight: 24px;\r\n"); out.write("}\r\n"); out.write(".userpassword {\tbackground-attachment: scroll;\r\n"); out.write("\tbackground-image: url(/static/images/nzcms_system_19.gif);\r\n"); out.write("\tbackground-repeat: no-repeat;\r\n"); out.write("\tbackground-position: right;\r\n"); out.write("\tbackground-color: #FFFFFF;\r\n"); out.write("\tpadding: 3px;\r\n"); out.write("\tborder: 1px solid #CCCCCC;\r\n"); out.write("\theight: 24px;\r\n"); out.write("}\r\n"); out.write(".whitetitle {\r\n"); out.write("\tfont: 18px \"微软雅黑\";\r\n"); out.write("\tcolor: #FFFFFF;\r\n"); out.write("}\r\n"); out.write("-->\r\n"); out.write("</style>\r\n"); out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n"); out.write("\"http://www.w3.org/TR/html4/loose.dtd\">\r\n"); out.write("<html>\r\n"); out.write("<head>\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n"); out.write("<link href=\"/static/admin_css/css.css\" rel=\"stylesheet\" type=\"text/css\">\r\n"); out.write("\r\n"); out.write("\r\n"); out.write(" <table width=\"200\" height=\"45\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"/static/images/nzsoft_14.gif\" id=\"1\">\r\n"); out.write(" <tr> <td width=\"55\" align=\"center\">&nbsp;</td>\r\n"); out.write(" <td class=\"left14\">信息管理</td>\r\n"); out.write(" </tr>\r\n"); out.write(" </table>\r\n"); out.write(" <table width=\"180\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"C9DEFA\" >\r\n"); out.write(" <tr>\r\n"); out.write(" <td height=\"40\" onMouseOver='this. background=\"/static/images/left2.gif\"' onMouseOut='this. background=\"/static/images/left1.gif\"' background=\"/static/images/left1.gif\" ><a href=\"/admin/add_article\" class=\"left3\">添加新文章</a></td>\r\n"); out.write(" </tr>\r\n"); out.write(" <tr>\r\n"); out.write(" <td height=\"40\" onMouseOver='this. background=\"/static/images/left2.gif\"' onMouseOut='this. background=\"/static/images/left1.gif\"' background=\"/static/images/left1.gif\" ><a href=\"/admin/category_manage\" class=\"left3\">栏目类别管理</a></td>\r\n"); out.write(" </tr>\r\n"); out.write(" <tr>\r\n"); out.write(" <td height=\"40\" onMouseOver='this. background=\"/static/images/left2.gif\"' onMouseOut='this. background=\"/static/images/left1.gif\"' background=\"/static/images/left1.gif\" ><a href=\"/admin/manage_by_class\" class=\"left3\">按类管理信息</a></td>\r\n"); out.write(" </tr>\r\n"); out.write(" <tr>\r\n"); out.write(" <td height=\"40\" onMouseOver='this. background=\"/static/images/left2.gif\"' onMouseOut='this. background=\"/static/images/left1.gif\"' background=\"/static/images/left1.gif\" ><a href=\"/admin/all_information\" class=\"left3\">管理所有信息</a></td>\r\n"); out.write(" </tr>\r\n"); out.write(" </table>\r\n"); out.write(" </td>\r\n"); out.write(" <td align=\"center\" valign=\"top\">\r\n"); out.write(" <table width=\"0\" height=\"6\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n"); out.write(" <tr>\r\n"); out.write(" <td></td>\r\n"); out.write(" </tr>\r\n"); out.write(" </table>\r\n"); out.write("\r\n"); out.write("<iframe src=\"/admin/get_categoryResultList/2\" name=\"sina_roll\" width=\"98%\" marginwidth=\"0\" height=\"97%\" marginheight=\"10\" scrolling=\"Yes\" frameborder=\"Yes\" id=\"sina_roll\" border=\"10\"></iframe>\r\n"); out.write(" </td>\r\n"); out.write(" </tr>\r\n"); out.write("</table>\r\n"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
17,773
0.56824
0.555063
338
51.091717
43.799847
279
false
false
0
0
0
0
0
0
1.133136
false
false
13
cb0ca4e41d0f144f3a2c8294bddedecadfec97c9
15,994,458,251,849
c3e026c4f283e162256e826cff3d960e15081a37
/src/plp/expressions1/expression/ValorString.java
e7b0cc1d4c9227b33f60c1de4ea10c166c0e34ce
[]
no_license
rhavymaia/plp-2013-enum-e-multi-catch
https://github.com/rhavymaia/plp-2013-enum-e-multi-catch
f081d51f4d683e0aef006102b4824466fd371fe0
c12750a08fb117fbc1068c4c27eaf7fcdd875bb8
refs/heads/master
2021-01-10T05:11:00.101000
2013-06-29T13:43:28
2013-06-29T13:43:28
44,069,940
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package plp.expressions1.expression; import plp.expressions1.util.Tipo; /** * Este valor primitivo encapsula um String. */ public class ValorString extends ValorConcreto<String> { public ValorString(String valor) { super(valor); } /** * Retorna os tipos possiveis desta expressao. * * @return os tipos possiveis desta expressao. */ public Tipo getTipo() { return Tipo.TIPO_STRING; } }
UTF-8
Java
433
java
ValorString.java
Java
[]
null
[]
package plp.expressions1.expression; import plp.expressions1.util.Tipo; /** * Este valor primitivo encapsula um String. */ public class ValorString extends ValorConcreto<String> { public ValorString(String valor) { super(valor); } /** * Retorna os tipos possiveis desta expressao. * * @return os tipos possiveis desta expressao. */ public Tipo getTipo() { return Tipo.TIPO_STRING; } }
433
0.674365
0.669746
23
16.826086
18.890192
56
false
false
0
0
0
0
0
0
0.73913
false
false
13
01208132d13422049e75ebcb5bb81857cc044444
15,058,155,354,437
450133181c7579da22ee777d609485db11328f53
/app/src/main/java/com/example/peter/simplechatsnapshot/Interfaces/ICameraHandler.java
0e4ac52d2327b685953d3301c41d169183f5f00e
[]
no_license
petik6661/Phantom
https://github.com/petik6661/Phantom
139c980b4792af72e98ce9a321f6f7f354b9dca6
f15091b711884ea37431041ae4ec640900c17d62
refs/heads/master
2016-08-06T22:01:02.006000
2015-05-12T22:13:57
2015-05-12T22:13:57
32,956,639
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.peter.simplechatsnapshot.Interfaces; public interface ICameraHandler { /** * Should be called on main onCreate event * @return true if success */ boolean OnCreate(); /** * Invoke take snapshot operation (if called multiple times commands are queued) */ void TakeSnapshot(String inReplyTo, ISnapshotTakenCallback callback); void OnPause(); void OnResume(); }
UTF-8
Java
432
java
ICameraHandler.java
Java
[ { "context": "package com.example.peter.simplechatsnapshot.Interfaces;\n\npublic interfa", "end": 22, "score": 0.7656424045562744, "start": 20, "tag": "USERNAME", "value": "pe" } ]
null
[]
package com.example.peter.simplechatsnapshot.Interfaces; public interface ICameraHandler { /** * Should be called on main onCreate event * @return true if success */ boolean OnCreate(); /** * Invoke take snapshot operation (if called multiple times commands are queued) */ void TakeSnapshot(String inReplyTo, ISnapshotTakenCallback callback); void OnPause(); void OnResume(); }
432
0.68287
0.68287
18
22.944445
25.426304
84
false
false
0
0
0
0
0
0
0.333333
false
false
13
ed38513f1831a56de4ead266b80d7968a12c59bc
19,112,604,490,999
e0c2f4f79da30c34f7c0e2dbcc8789c1fb3b83c7
/src/main/java/cn/siqishangshu/net/FackIP.java
cc064855003930fc6e54ffce7af2e81d51010879
[]
no_license
siqishangshu/worktool
https://github.com/siqishangshu/worktool
01c492153cf0e48c7c2520c28d7e97a6d142423e
7b935fbef1b4bc8bc4f9d43304cf54afc47a47ed
refs/heads/master
2019-07-30T02:48:21.731000
2019-07-26T02:39:31
2019-07-26T02:39:31
105,436,958
1
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.siqishangshu.net; public class FackIP { public static void main(String[] args) { // FackIP.sendPost("www.baidu.com", headers, params, encoding, isProxy) } // public static Result sendPost(String url, Map<String, String> headers, Map<String, String> params, String encoding,boolean isProxy) throws ClientProtocolException, IOException { // // ʵ����һ��post���� // HttpPost post = new HttpPost(url); // DefaultHttpClient client = new DefaultHttpClient(); // if (isProxy) {//�Ƿ������� // HttpHost proxy = new HttpHost("221.181.192.30", 85); // client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); // } // // ������Ҫ�ύ�IJ��� // List<NameValuePair> list = new ArrayList<NameValuePair>(); // if (params != null) { // for (String temp : params.keySet()) { // list.add(new BasicNameValuePair(temp, params.get(temp))); // } // } // post.setEntity(new UrlEncodedFormEntity(list, encoding)); // // ����ͷ�� // if (null != headers) // post.setHeaders(assemblyHeader(headers)); // // ʵ�����󲢷��� // HttpResponse response = client.execute(post); // HttpEntity entity = response.getEntity(); // HttpEntity entityRsp = response.getEntity(); // StringBuffer result1 = new StringBuffer(); // BufferedReader rd = new BufferedReader(new InputStreamReader(entityRsp.getContent(), encoding)); // String tempLine = rd.readLine(); // // ��װ���صIJ��� // Result result = new Result(); // while (tempLine != null) { // // ���ػ�ȡ�����ַ // // if (tempLine.contains("encodeURI('")) { // // System.out.println("encode:" + // // tempLine.substring(tempLine.indexOf("encodeURI('") + 11, // // tempLine.indexOf("');"))); // // } // result1.append(tempLine); // tempLine = rd.readLine(); // } // // ���÷���״̬���� // result.setStatusCode(response.getStatusLine().getStatusCode()); // // ���÷��ص�ͷ����Ϣ // result.setHeaders(response.getAllHeaders()); // // ���÷��ص�cookie���� // result.setCookie(assemblyCookie(client.getCookieStore().getCookies())); // // ���÷��ص���Ϣ // result.setHttpEntity(entity); // return result; //} }
UTF-8
Java
2,457
java
FackIP.java
Java
[ { "context": "Ƿ�������\n// HttpHost proxy = new HttpHost(\"221.181.192.30\", 85);\n// client.getParams().setParameter(", "end": 576, "score": 0.9997272491455078, "start": 562, "tag": "IP_ADDRESS", "value": "221.181.192.30" } ]
null
[]
package cn.siqishangshu.net; public class FackIP { public static void main(String[] args) { // FackIP.sendPost("www.baidu.com", headers, params, encoding, isProxy) } // public static Result sendPost(String url, Map<String, String> headers, Map<String, String> params, String encoding,boolean isProxy) throws ClientProtocolException, IOException { // // ʵ����һ��post���� // HttpPost post = new HttpPost(url); // DefaultHttpClient client = new DefaultHttpClient(); // if (isProxy) {//�Ƿ������� // HttpHost proxy = new HttpHost("172.16.17.32", 85); // client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); // } // // ������Ҫ�ύ�IJ��� // List<NameValuePair> list = new ArrayList<NameValuePair>(); // if (params != null) { // for (String temp : params.keySet()) { // list.add(new BasicNameValuePair(temp, params.get(temp))); // } // } // post.setEntity(new UrlEncodedFormEntity(list, encoding)); // // ����ͷ�� // if (null != headers) // post.setHeaders(assemblyHeader(headers)); // // ʵ�����󲢷��� // HttpResponse response = client.execute(post); // HttpEntity entity = response.getEntity(); // HttpEntity entityRsp = response.getEntity(); // StringBuffer result1 = new StringBuffer(); // BufferedReader rd = new BufferedReader(new InputStreamReader(entityRsp.getContent(), encoding)); // String tempLine = rd.readLine(); // // ��װ���صIJ��� // Result result = new Result(); // while (tempLine != null) { // // ���ػ�ȡ�����ַ // // if (tempLine.contains("encodeURI('")) { // // System.out.println("encode:" + // // tempLine.substring(tempLine.indexOf("encodeURI('") + 11, // // tempLine.indexOf("');"))); // // } // result1.append(tempLine); // tempLine = rd.readLine(); // } // // ���÷���״̬���� // result.setStatusCode(response.getStatusLine().getStatusCode()); // // ���÷��ص�ͷ����Ϣ // result.setHeaders(response.getAllHeaders()); // // ���÷��ص�cookie���� // result.setCookie(assemblyCookie(client.getCookieStore().getCookies())); // // ���÷��ص���Ϣ // result.setHttpEntity(entity); // return result; //} }
2,455
0.587629
0.580009
62
34.967743
30.421219
180
false
false
0
0
0
0
0
0
0.709677
false
false
13
6d2595d7b495968a979be325052c3ed2640e4cdc
24,704,651,913,039
9cb4e4f67058f553e8bd845c4629aa12e8e6a2d1
/app/src/main/java/com/example/junlianglin/framework/adapter/SimpleBaseAdapter.java
741dadf1d368b4a9e89e84d814b7aabffe01a4b0
[]
no_license
junlianglincanada/LearningOne
https://github.com/junlianglincanada/LearningOne
74954b15cc4cb8030c21a94713d78069681dedf5
533645ea7d81be07316c31d0cc3461cd7f16613e
refs/heads/master
2020-03-19T12:18:38.769000
2018-08-02T18:33:21
2018-08-02T18:33:21
118,354,375
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.junlianglin.framework.adapter; import android.content.Context; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import java.io.Serializable; import java.util.List; /** * Created by JunliangLin on 1/6/2018. */ public abstract class SimpleBaseAdapter<T> extends BaseAdapter { protected Context context = null; protected List<T> dataList = null; protected LayoutInflater layoutInflater = null; protected int layoutId; public SimpleBaseAdapter(Context context,List<T> dataList,int layoutId){ this.context = context; this.dataList = dataList; this.layoutId = layoutId; layoutInflater = LayoutInflater.from(context); } public void refreshDatas(List<T> dataList){ this.dataList = dataList; this.notifyDataSetChanged(); } @Override public int getCount() { if (dataList!=null && dataList.size()>0) return dataList.size(); else return 0; } @Override public T getItem(int i) { if (dataList!=null && dataList.size()>0) return dataList.get(i); else return null; } @Override public long getItemId(int i) { return i; } @Override public View getView(int position, View view, ViewGroup viewGroup){ BaseViewHolder viewHolder = BaseViewHolder.getViewHolder(context, view, viewGroup, layoutId, position); convert(viewHolder, dataList.get(position)); return viewHolder.getConvertView(); } public abstract void convert(BaseViewHolder viewHolder, T t); }
UTF-8
Java
1,737
java
SimpleBaseAdapter.java
Java
[ { "context": "lizable;\nimport java.util.List;\n\n/**\n * Created by JunliangLin on 1/6/2018.\n */\n\npublic abstract class SimpleBas", "end": 338, "score": 0.9885346293449402, "start": 327, "tag": "NAME", "value": "JunliangLin" } ]
null
[]
package com.example.junlianglin.framework.adapter; import android.content.Context; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import java.io.Serializable; import java.util.List; /** * Created by JunliangLin on 1/6/2018. */ public abstract class SimpleBaseAdapter<T> extends BaseAdapter { protected Context context = null; protected List<T> dataList = null; protected LayoutInflater layoutInflater = null; protected int layoutId; public SimpleBaseAdapter(Context context,List<T> dataList,int layoutId){ this.context = context; this.dataList = dataList; this.layoutId = layoutId; layoutInflater = LayoutInflater.from(context); } public void refreshDatas(List<T> dataList){ this.dataList = dataList; this.notifyDataSetChanged(); } @Override public int getCount() { if (dataList!=null && dataList.size()>0) return dataList.size(); else return 0; } @Override public T getItem(int i) { if (dataList!=null && dataList.size()>0) return dataList.get(i); else return null; } @Override public long getItemId(int i) { return i; } @Override public View getView(int position, View view, ViewGroup viewGroup){ BaseViewHolder viewHolder = BaseViewHolder.getViewHolder(context, view, viewGroup, layoutId, position); convert(viewHolder, dataList.get(position)); return viewHolder.getConvertView(); } public abstract void convert(BaseViewHolder viewHolder, T t); }
1,737
0.669545
0.664364
65
25.723078
23.008699
111
false
false
0
0
0
0
0
0
0.584615
false
false
13
23340316d2d89e6d17ff522045f0620e5de09828
25,005,299,622,020
bbdde1179d5a015ecccc91b6a5bb2aa8d04a3065
/jetstreamcore/src/main/java/com/ebay/jetstream/util/NetMask.java
7158347777458d01a3dcae4bfd9d88f474d5baa0
[ "Apache-2.0", "MIT" ]
permissive
kevinthfang/jetstream
https://github.com/kevinthfang/jetstream
0a3d9518b0110564342020eefbbd3b3979b46a43
cebd18a8fc2d8ed0184e2e52323b6727765951de
refs/heads/master
2021-01-20T19:45:10.243000
2017-11-19T12:23:57
2017-11-19T12:23:57
32,309,371
0
0
null
true
2015-03-16T07:53:57
2015-03-16T07:53:57
2015-03-16T03:38:54
2015-03-05T11:02:59
9,413
0
0
0
null
null
null
/******************************************************************************* * Copyright © 2012-2015 eBay Software Foundation * This program is dual licensed under the MIT and Apache 2.0 licenses. * Please see LICENSE for more information. *******************************************************************************/ /** * */ package com.ebay.jetstream.util; import java.net.InetAddress; import java.util.StringTokenizer; import com.ebay.jetstream.config.ConfigException; public class NetMask { private final String m_map; private final byte m_baseAddr[]; private final byte m_mask[]; public NetMask(String map) throws ConfigException { int slash = map.indexOf("/"); if (slash < 0) { throw new ConfigException("Invalid network specification, missing slash: " + map); } String addr = map.substring(0, slash); StringTokenizer toks = new StringTokenizer(addr, "."); int comps = toks.countTokens(); if (comps != 4 && comps != 8) { throw new ConfigException("Wrong number of components for IP address: " + map); } m_map = map; m_baseAddr = new byte[comps]; m_mask = new byte[comps]; for (int c = 0; c < comps; c++) { m_baseAddr[c] = (byte) Integer.parseInt(toks.nextToken()); } int mask = Integer.parseInt(map.substring(slash + 1)); for (int c = 0; c < comps; c++) { if (mask > 8) { m_mask[c] = (byte) 0xff; mask = mask - 8; } else if (mask > 0) { int bit = 7; int m = 0; while (mask > 0) { m |= 1 << bit; bit -= 1; mask -= 1; } m_mask[c] = (byte) m; } else { m_mask[c] = 0; } } } public String getMask() { return m_map; } public boolean isWithinMask(InetAddress addr) { byte baddr[] = addr.getAddress(); if (baddr.length != m_baseAddr.length) { // IPv4 and IPv6 not compatible return false; } for (int b = 0; b < m_baseAddr.length; b++) { int m1 = baddr[b] & m_mask[b]; int m2 = m_baseAddr[b] & m_mask[b]; if (m1 != m2) { return false; } } return true; } @Override public String toString() { return super.toString() + ": " + m_map; } }
UTF-8
Java
2,365
java
NetMask.java
Java
[]
null
[]
/******************************************************************************* * Copyright © 2012-2015 eBay Software Foundation * This program is dual licensed under the MIT and Apache 2.0 licenses. * Please see LICENSE for more information. *******************************************************************************/ /** * */ package com.ebay.jetstream.util; import java.net.InetAddress; import java.util.StringTokenizer; import com.ebay.jetstream.config.ConfigException; public class NetMask { private final String m_map; private final byte m_baseAddr[]; private final byte m_mask[]; public NetMask(String map) throws ConfigException { int slash = map.indexOf("/"); if (slash < 0) { throw new ConfigException("Invalid network specification, missing slash: " + map); } String addr = map.substring(0, slash); StringTokenizer toks = new StringTokenizer(addr, "."); int comps = toks.countTokens(); if (comps != 4 && comps != 8) { throw new ConfigException("Wrong number of components for IP address: " + map); } m_map = map; m_baseAddr = new byte[comps]; m_mask = new byte[comps]; for (int c = 0; c < comps; c++) { m_baseAddr[c] = (byte) Integer.parseInt(toks.nextToken()); } int mask = Integer.parseInt(map.substring(slash + 1)); for (int c = 0; c < comps; c++) { if (mask > 8) { m_mask[c] = (byte) 0xff; mask = mask - 8; } else if (mask > 0) { int bit = 7; int m = 0; while (mask > 0) { m |= 1 << bit; bit -= 1; mask -= 1; } m_mask[c] = (byte) m; } else { m_mask[c] = 0; } } } public String getMask() { return m_map; } public boolean isWithinMask(InetAddress addr) { byte baddr[] = addr.getAddress(); if (baddr.length != m_baseAddr.length) { // IPv4 and IPv6 not compatible return false; } for (int b = 0; b < m_baseAddr.length; b++) { int m1 = baddr[b] & m_mask[b]; int m2 = m_baseAddr[b] & m_mask[b]; if (m1 != m2) { return false; } } return true; } @Override public String toString() { return super.toString() + ": " + m_map; } }
2,365
0.503384
0.488579
91
24
21.789703
88
false
false
0
0
0
0
0
0
0.494505
false
false
13
5cfbf2a37fbe1c03c05a2a0e78a56995a559e2b8
2,851,858,304,177
d21566a320f45f0e3d3fd63ffad78f2a964dba85
/src/com/example/myapp/fragment/PM_Place_View.java
d3f983da1e57b682ccb4d2be8babf27bc2920ccb
[]
no_license
jacobke/oct
https://github.com/jacobke/oct
1b28dbe83203e651acb49b532808654e0503242b
e2c7f66f71f67880b8879224e00869cf4dc74260
refs/heads/master
2021-01-18T00:26:10.651000
2014-12-23T09:15:30
2014-12-23T09:15:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.myapp.fragment; import android.app.Activity; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import com.example.myapp.R; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; public class PM_Place_View extends Fragment implements View.OnClickListener { private Button mBtn; public String name; private List<String> picUrls; private List<String> scores; private String intro; public void buildData(String place) { String[] subString = place.split(";"); if (subString.length >=3 ) { name = subString[0]; scores = Arrays.asList(subString[1].split(",")); picUrls = Arrays.asList(subString[2].split(",")); intro = subString[3]; } } @Override public void onClick(View v) { listener.onItemSelected(name, picUrls, intro); } public interface OnArticleSelectedListener { public void onItemSelected(String name, List<String> picUrls, String intro); } private static OnArticleSelectedListener listener; @Override public void onAttach(Activity activity) { super.onAttach(activity); if (!(activity instanceof OnArticleSelectedListener)) { throw new IllegalStateException("Activity must implement fragment's callbacks."); } else { listener = (OnArticleSelectedListener) activity; } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.frag_place_view, container, false); TextView name = (TextView) view.findViewById(R.id.place_name); name.setText(this.name); TextView intro = (TextView) view.findViewById(R.id.place_intro); intro.setText(this.intro); TextView score = (TextView) view.findViewById(R.id.place_score); score.setText(buildScore(this.scores)); mBtn = (Button)view.findViewById(R.id.place_view_button_detail); mBtn.setOnClickListener(this); /** * Inflate the layout for this fragment */ return view; } private String buildScore(List<String> scores) { if (scores.size() >=4) { StringBuilder sb = new StringBuilder(); sb.append("总分: "); sb.append(scores.get(0)); sb.append(" 景色: "); sb.append(scores.get(1)); sb.append(" 趣味: "); sb.append(scores.get(2)); sb.append(" 性价比:"); sb.append(scores.get(3)); return sb.toString(); } else { return "unknown Score."; } } }
UTF-8
Java
2,924
java
PM_Place_View.java
Java
[]
null
[]
package com.example.myapp.fragment; import android.app.Activity; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import com.example.myapp.R; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; public class PM_Place_View extends Fragment implements View.OnClickListener { private Button mBtn; public String name; private List<String> picUrls; private List<String> scores; private String intro; public void buildData(String place) { String[] subString = place.split(";"); if (subString.length >=3 ) { name = subString[0]; scores = Arrays.asList(subString[1].split(",")); picUrls = Arrays.asList(subString[2].split(",")); intro = subString[3]; } } @Override public void onClick(View v) { listener.onItemSelected(name, picUrls, intro); } public interface OnArticleSelectedListener { public void onItemSelected(String name, List<String> picUrls, String intro); } private static OnArticleSelectedListener listener; @Override public void onAttach(Activity activity) { super.onAttach(activity); if (!(activity instanceof OnArticleSelectedListener)) { throw new IllegalStateException("Activity must implement fragment's callbacks."); } else { listener = (OnArticleSelectedListener) activity; } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.frag_place_view, container, false); TextView name = (TextView) view.findViewById(R.id.place_name); name.setText(this.name); TextView intro = (TextView) view.findViewById(R.id.place_intro); intro.setText(this.intro); TextView score = (TextView) view.findViewById(R.id.place_score); score.setText(buildScore(this.scores)); mBtn = (Button)view.findViewById(R.id.place_view_button_detail); mBtn.setOnClickListener(this); /** * Inflate the layout for this fragment */ return view; } private String buildScore(List<String> scores) { if (scores.size() >=4) { StringBuilder sb = new StringBuilder(); sb.append("总分: "); sb.append(scores.get(0)); sb.append(" 景色: "); sb.append(scores.get(1)); sb.append(" 趣味: "); sb.append(scores.get(2)); sb.append(" 性价比:"); sb.append(scores.get(3)); return sb.toString(); } else { return "unknown Score."; } } }
2,924
0.636802
0.633356
96
29.229166
24.116678
103
false
false
0
0
0
0
0
0
0.65625
false
false
13
da4f6713a3f27682037efb02a70256fc6f7bdcdf
14,929,306,363,769
04a16ece26c703120c5a35f7a87e492072ca5f57
/src/test/Test.java
dcec912959d4cfc60389bec203f97f3563e7861c
[]
no_license
eduardoadcj/SerialGenerator
https://github.com/eduardoadcj/SerialGenerator
dafa1516e5e30eaee6a0ad0392076379fc15ec3b
633d526f373ae1c8c52c2558178f73bb4c220299
refs/heads/master
2022-04-12T10:38:38.429000
2020-04-03T19:05:18
2020-04-03T19:05:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package test; import java.util.ArrayList; import java.util.List; public class Test { public static void main(String[] args) { List<String> codes = new ArrayList<>(); codes.add("6s"); codes.add("d5"); codes.add("s5"); FindObject fo = new FindObject(); fo.setGroup("62"); fo.setPid(1); FindObject fo1 = new FindObject(); fo1.setGroup("61"); fo1.setPid(2); FindObject fo2 = new FindObject(); fo2.setGroup("63"); fo2.setPid(3); Thread p1 = new Thread(fo); p1.start(); Thread p2 = new Thread(fo1); p2.start(); Thread p3 = new Thread(fo2); p3.start(); } }
UTF-8
Java
865
java
Test.java
Java
[]
null
[]
package test; import java.util.ArrayList; import java.util.List; public class Test { public static void main(String[] args) { List<String> codes = new ArrayList<>(); codes.add("6s"); codes.add("d5"); codes.add("s5"); FindObject fo = new FindObject(); fo.setGroup("62"); fo.setPid(1); FindObject fo1 = new FindObject(); fo1.setGroup("61"); fo1.setPid(2); FindObject fo2 = new FindObject(); fo2.setGroup("63"); fo2.setPid(3); Thread p1 = new Thread(fo); p1.start(); Thread p2 = new Thread(fo1); p2.start(); Thread p3 = new Thread(fo2); p3.start(); } }
865
0.436994
0.406936
45
17.222221
13.840181
47
false
false
0
0
0
0
0
0
0.488889
false
false
13
17936a1148ec732e2a20c898dd42b70000c5c866
14,929,306,360,248
9b646e7635b1432db7509c456c9ec379b7831aab
/src/websocket/StockWebsocketClient.java
87a65d70a10bbfd956f9eb4476b7cfbf71beb599
[]
no_license
jcwiekala/stock
https://github.com/jcwiekala/stock
2c74b262a77ca87a79e33f938b7d82576ce46155
ef21bd98cf381d4420474cf9d23b8792854d65b9
refs/heads/master
2018-01-09T19:19:39.477000
2016-03-23T04:52:33
2016-03-23T04:52:33
54,531,392
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package websocket; import com.google.gson.Gson; import database.StockDatabaseManager; import logging.StockLogger; import javax.websocket.*; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.util.Date; import java.util.concurrent.TimeUnit; /** * Created by JNX on 2016-03-19. */ @ClientEndpoint public class StockWebsocketClient { private static Session userSession = null; private static StockMessage stockMessage = null; private static boolean isClosed = true; private static volatile Date lastUpdateTime = new Date(); private StockWebsocketClient(URI endpointURI) { try { WebSocketContainer container = ContainerProvider.getWebSocketContainer(); container.connectToServer(this, endpointURI); } catch (Exception e) { StockLogger.logError(e.getMessage()); throw new RuntimeException(e); } } public static boolean connectIfClosed(){ try { if(isClosed) synchronized(StockWebsocketClient.class){ new StockWebsocketClient(new URI("ws://webtask.future-processing.com:8068/ws/stocks")); } } catch (Exception e) { StockLogger.logError(e.getMessage()); } return isClosed; } public static synchronized StockMessage getStockMessage(){ return stockMessage; } public static synchronized void closeConnection() throws IOException { userSession.close(); } public static synchronized boolean isClosed(){ return isClosed; } public static Date getLastUpdateTime() { return lastUpdateTime; } public static void setLastUpdateTime(Date lastUpdateTime) { StockWebsocketClient.lastUpdateTime.setTime(lastUpdateTime.getTime()); } @OnOpen public void onOpen(Session userSession) { StockLogger.logInfo("Opening websocket"); this.userSession = userSession; isClosed = false; } @OnClose public void onClose(Session userSession, CloseReason reason) { StockLogger.logInfo("Closing websocket"); this.userSession = null; isClosed = true; } @OnMessage public void onMessage(String message){ Gson gson = new Gson(); stockMessage = gson.fromJson(message, StockMessage.class); StockLogger.logInfo("Websocket Message\n" + stockMessage); setLastUpdateTime(stockMessage.getPublicationDate()); StockDatabaseManager.saveStockData(stockMessage); } }
UTF-8
Java
2,592
java
StockWebsocketClient.java
Java
[ { "context": " java.util.concurrent.TimeUnit;\n\n/**\n * Created by JNX on 2016-03-19.\n */\n@ClientEndpoint\npublic class S", "end": 310, "score": 0.9994983077049255, "start": 307, "tag": "USERNAME", "value": "JNX" } ]
null
[]
package websocket; import com.google.gson.Gson; import database.StockDatabaseManager; import logging.StockLogger; import javax.websocket.*; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.util.Date; import java.util.concurrent.TimeUnit; /** * Created by JNX on 2016-03-19. */ @ClientEndpoint public class StockWebsocketClient { private static Session userSession = null; private static StockMessage stockMessage = null; private static boolean isClosed = true; private static volatile Date lastUpdateTime = new Date(); private StockWebsocketClient(URI endpointURI) { try { WebSocketContainer container = ContainerProvider.getWebSocketContainer(); container.connectToServer(this, endpointURI); } catch (Exception e) { StockLogger.logError(e.getMessage()); throw new RuntimeException(e); } } public static boolean connectIfClosed(){ try { if(isClosed) synchronized(StockWebsocketClient.class){ new StockWebsocketClient(new URI("ws://webtask.future-processing.com:8068/ws/stocks")); } } catch (Exception e) { StockLogger.logError(e.getMessage()); } return isClosed; } public static synchronized StockMessage getStockMessage(){ return stockMessage; } public static synchronized void closeConnection() throws IOException { userSession.close(); } public static synchronized boolean isClosed(){ return isClosed; } public static Date getLastUpdateTime() { return lastUpdateTime; } public static void setLastUpdateTime(Date lastUpdateTime) { StockWebsocketClient.lastUpdateTime.setTime(lastUpdateTime.getTime()); } @OnOpen public void onOpen(Session userSession) { StockLogger.logInfo("Opening websocket"); this.userSession = userSession; isClosed = false; } @OnClose public void onClose(Session userSession, CloseReason reason) { StockLogger.logInfo("Closing websocket"); this.userSession = null; isClosed = true; } @OnMessage public void onMessage(String message){ Gson gson = new Gson(); stockMessage = gson.fromJson(message, StockMessage.class); StockLogger.logInfo("Websocket Message\n" + stockMessage); setLastUpdateTime(stockMessage.getPublicationDate()); StockDatabaseManager.saveStockData(stockMessage); } }
2,592
0.66821
0.66358
93
26.870968
24.276289
107
false
false
0
0
0
0
0
0
0.430108
false
false
13
9c66280271b90320b6655f4c94088f6a20ec06db
919,123,056,311
1f98840aeaa5b63491c68811f54bc04b3d433c8d
/src/array/SetMatrixZeroes_73.java
9745a37ec0a9a87aa3c0dbd901a7c1614b21d085
[]
no_license
raledong/leetcode
https://github.com/raledong/leetcode
35e96e97f4350cd864d4b51ca004bb8220275953
f743f8bcf9212b703367257867c8d7f4b3ca2890
refs/heads/master
2020-04-05T14:04:37.735000
2019-11-06T16:29:11
2019-11-06T16:29:11
94,748,150
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package array; /** * @author rale * Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. * click to show follow up. * * Follow up: * Did you use extra space? * A straight forward solution using O(mn) space is probably a bad idea. * A simple improvement uses O(m + n) space, but still not the best solution. * Could you devise a constant space solution? */ public class SetMatrixZeroes_73 { //O(m+n)space public void setZeroes(int[][] matrix) { int rowCount = matrix.length; if(matrix.length==0){ return; } int columnCount = matrix[0].length; boolean[] rowIsZero = new boolean[rowCount]; boolean[] columnIsZero = new boolean[columnCount]; for(int i = 0 ; i<rowCount ; i++){ for(int j = 0 ; j<columnCount ; j++){ if(matrix[i][j]==0) { rowIsZero[i] = true; columnIsZero[j] = true; } } } for(int i = 0 ; i<rowCount ; i++){ for(int j = 0 ; j<columnCount ; j++){ if(rowIsZero[i] || columnIsZero[j]) { matrix[i][j] = 0; } } } } //O(1) space 增加了遍历次数O(n^2) public void setZeroes2(int[][] matrix) { if(matrix==null){ return; } int m = matrix.length; int n = matrix[0].length; boolean rowHasZero = false; boolean colHasZero = false; for(int i=0; i<n; i++){ if(matrix[0][i]==0){ rowHasZero = true; break; } } for(int i=0; i<m; i++){ if(matrix[i][0]==0){ colHasZero = true; break; } } for(int i=1; i<m; i++){ for(int j=1; j<n; j++){ if(matrix[i][j]==0){ matrix[i][0] = 0; matrix[0][j] = 0; } } } for(int j=1;j<n; j++){ if(matrix[0][j]==0){ nullifyCol(matrix, j, m, n); } } for(int i=1; i<m; i++){ if(matrix[i][0]==0){ nullifyRow(matrix, i, m, n); } } if(rowHasZero){ nullifyRow(matrix, 0, m, n); } if(colHasZero){ nullifyCol(matrix, 0, m, n); } } public void nullifyRow(int[][] matrix, int i, int m, int n){ for(int col=0; col<n; col++){ matrix[i][col] = 0; } } public void nullifyCol(int[][] matrix, int j, int m, int n){ for(int row=0; row<m; row++){ matrix[row][j] = 0; } } }
UTF-8
Java
2,815
java
SetMatrixZeroes_73.java
Java
[ { "context": "package array;\n\n/**\n * @author rale\n * Given a m x n matrix, if an element is 0, set ", "end": 35, "score": 0.7515971660614014, "start": 31, "tag": "USERNAME", "value": "rale" } ]
null
[]
package array; /** * @author rale * Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. * click to show follow up. * * Follow up: * Did you use extra space? * A straight forward solution using O(mn) space is probably a bad idea. * A simple improvement uses O(m + n) space, but still not the best solution. * Could you devise a constant space solution? */ public class SetMatrixZeroes_73 { //O(m+n)space public void setZeroes(int[][] matrix) { int rowCount = matrix.length; if(matrix.length==0){ return; } int columnCount = matrix[0].length; boolean[] rowIsZero = new boolean[rowCount]; boolean[] columnIsZero = new boolean[columnCount]; for(int i = 0 ; i<rowCount ; i++){ for(int j = 0 ; j<columnCount ; j++){ if(matrix[i][j]==0) { rowIsZero[i] = true; columnIsZero[j] = true; } } } for(int i = 0 ; i<rowCount ; i++){ for(int j = 0 ; j<columnCount ; j++){ if(rowIsZero[i] || columnIsZero[j]) { matrix[i][j] = 0; } } } } //O(1) space 增加了遍历次数O(n^2) public void setZeroes2(int[][] matrix) { if(matrix==null){ return; } int m = matrix.length; int n = matrix[0].length; boolean rowHasZero = false; boolean colHasZero = false; for(int i=0; i<n; i++){ if(matrix[0][i]==0){ rowHasZero = true; break; } } for(int i=0; i<m; i++){ if(matrix[i][0]==0){ colHasZero = true; break; } } for(int i=1; i<m; i++){ for(int j=1; j<n; j++){ if(matrix[i][j]==0){ matrix[i][0] = 0; matrix[0][j] = 0; } } } for(int j=1;j<n; j++){ if(matrix[0][j]==0){ nullifyCol(matrix, j, m, n); } } for(int i=1; i<m; i++){ if(matrix[i][0]==0){ nullifyRow(matrix, i, m, n); } } if(rowHasZero){ nullifyRow(matrix, 0, m, n); } if(colHasZero){ nullifyCol(matrix, 0, m, n); } } public void nullifyRow(int[][] matrix, int i, int m, int n){ for(int col=0; col<n; col++){ matrix[i][col] = 0; } } public void nullifyCol(int[][] matrix, int j, int m, int n){ for(int row=0; row<m; row++){ matrix[row][j] = 0; } } }
2,815
0.428775
0.414138
113
23.787611
18.178783
96
false
false
0
0
0
0
0
0
0.902655
false
false
13
30b8986eb1c7e63ae245509c6612a289037cbdc3
11,673,721,149,248
0c73d54c8143d759d9e9535611345d77e9a0c12f
/preaccept/src/main/java/com/neusoft/preaccept/model/datamodel/selectProduct/ReqComboByPage.java
116d84d44fbe591f30e71732db0b39059d5d0dd2
[]
no_license
heavenisme/PreAccept
https://github.com/heavenisme/PreAccept
d5c5fdb657b757bf9f2b96a50ec1f70cb2f677a3
2605fdad46b7c79b6782b7bb65230bfcab24ed07
refs/heads/master
2020-02-26T15:14:16.284000
2016-06-20T14:45:43
2016-06-20T14:45:43
61,548,302
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Project Name:SxPreAccept_New * File Name:ReqComboByPage.java * Package Name:com.neusoft.preaccept.data.model.selectCombo * Date:2016年1月28日下午2:30:05 * Copyright (c) 2016 * */ package com.neusoft.preaccept.model.datamodel.selectProduct; import com.neusoft.preaccept.model.datamodel.BaseReqDataModel; /** * ClassName:ReqComboByPage <br/> * Function: 套餐分页请求. <br/> * Reason: TODO ADD REASON. <br/> * Date: 2016年1月28日 下午2:30:05 <br/> * @author neusoft liu.hongtao * @version * @since JDK 1.6 */ public class ReqComboByPage extends BaseReqDataModel { public int beginNo; public int endNo; public String set_type; public String net_type_code; public String sec_no; public String comp_product_id; // public String req = ""; }
UTF-8
Java
836
java
ReqComboByPage.java
Java
[ { "context": "Date: 2016年1月28日 下午2:30:05 <br/> \n * @author neusoft liu.hongtao\n * @version \n * @since JDK 1.6 ", "end": 490, "score": 0.4784960448741913, "start": 483, "tag": "USERNAME", "value": "neusoft" }, { "context": " 2016年1月28日 下午2:30:05 <br/> \n * @author ne...
null
[]
/** * Project Name:SxPreAccept_New * File Name:ReqComboByPage.java * Package Name:com.neusoft.preaccept.data.model.selectCombo * Date:2016年1月28日下午2:30:05 * Copyright (c) 2016 * */ package com.neusoft.preaccept.model.datamodel.selectProduct; import com.neusoft.preaccept.model.datamodel.BaseReqDataModel; /** * ClassName:ReqComboByPage <br/> * Function: 套餐分页请求. <br/> * Reason: TODO ADD REASON. <br/> * Date: 2016年1月28日 下午2:30:05 <br/> * @author neusoft liu.hongtao * @version * @since JDK 1.6 */ public class ReqComboByPage extends BaseReqDataModel { public int beginNo; public int endNo; public String set_type; public String net_type_code; public String sec_no; public String comp_product_id; // public String req = ""; }
836
0.679105
0.641791
31
24.870968
18.31048
62
false
false
0
0
0
0
0
0
0.290323
false
false
13
a6c6ff9e7cff593fcc9dba2e954dca42eb90cffa
16,630,113,429,781
ba552bd81c3785bff1fd584f1c30846aac4a4da5
/source/javaserverpages/src/common/tags/FileWriteTag.java
793ee467f6862c21eedeb091fc82d4da91ea3d9a
[]
no_license
closing/mydatabase
https://github.com/closing/mydatabase
fe56dd3d43db296ef561ff3106f1bff34d6bd880
5730293d916a2a69028ce2bddb1caeb971656140
refs/heads/master
2021-05-12T06:13:42.540000
2019-04-10T00:34:28
2019-04-10T00:34:28
117,212,682
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package common.tags; import javax.servlet.ServletContext; import javax.servlet.jsp.tagext.SimpleTagSupport; import javax.servlet.jsp.tagext.JspFragment; import javax.servlet.jsp.JspTagException; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.JspException; import java.io.PrintWriter; import java.io.FileWriter; import java.io.StringWriter; import java.io.IOException; public class FileWriteTag extends SimpleTagSupport { private String fileName; public void setFileName(String fileName) { this.fileName = fileName; } public void doTag() throws JspException { JspFragment body = getJspBody(); if (body == null) { throw new JspTagException("'fileWrite' used without a body"); } PrintWriter pw = null; if (fileName != null && !"log".equals(fileName)) { try { pw = new PrintWriter(new FileWriter(fileName, true)); } catch (IOException e) { throw new JspTagException("Can not open file " + fileName + " for writing", e); } } ServletContext application = ((PageContext) getJspContext()).getServletContext(); StringWriter evalResult = new StringWriter(); try { body.invoke(evalResult); if (fileName == null) { System.out.println(evalResult); } else if ("log".equals(fileName)) { application.log(evalResult.toString()); } else { pw.print(evalResult); } } catch (Throwable t) { String msg = "Exception in body of " + this.getClass().getName(); application.log(msg, t); throw new JspTagException(msg, t); } finally { if (pw != null) { pw.close(); } } } }
UTF-8
Java
1,664
java
FileWriteTag.java
Java
[]
null
[]
package common.tags; import javax.servlet.ServletContext; import javax.servlet.jsp.tagext.SimpleTagSupport; import javax.servlet.jsp.tagext.JspFragment; import javax.servlet.jsp.JspTagException; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.JspException; import java.io.PrintWriter; import java.io.FileWriter; import java.io.StringWriter; import java.io.IOException; public class FileWriteTag extends SimpleTagSupport { private String fileName; public void setFileName(String fileName) { this.fileName = fileName; } public void doTag() throws JspException { JspFragment body = getJspBody(); if (body == null) { throw new JspTagException("'fileWrite' used without a body"); } PrintWriter pw = null; if (fileName != null && !"log".equals(fileName)) { try { pw = new PrintWriter(new FileWriter(fileName, true)); } catch (IOException e) { throw new JspTagException("Can not open file " + fileName + " for writing", e); } } ServletContext application = ((PageContext) getJspContext()).getServletContext(); StringWriter evalResult = new StringWriter(); try { body.invoke(evalResult); if (fileName == null) { System.out.println(evalResult); } else if ("log".equals(fileName)) { application.log(evalResult.toString()); } else { pw.print(evalResult); } } catch (Throwable t) { String msg = "Exception in body of " + this.getClass().getName(); application.log(msg, t); throw new JspTagException(msg, t); } finally { if (pw != null) { pw.close(); } } } }
1,664
0.658053
0.658053
60
26.733334
21.776796
87
false
false
0
0
0
0
0
0
0.533333
false
false
13
ddd6bb664db38697a38aaec6706c691e9c4ea2ab
11,269,994,236,289
b37e7435a6b23424b8bc6216f77865a098cbfc5b
/core/src/test/java/unit/net/sourceforge/html5val/performers/RangePerformerTest.java
92dabc06eeb63caf225f93f329245b9d1ec647a5
[ "Apache-2.0" ]
permissive
krfowler/html5valdialect
https://github.com/krfowler/html5valdialect
21e12efc6996378f9b19a0554a424dc26828559e
d9ab8aadddbc0bbc6e6b658d28945c24d3f0bb54
refs/heads/master
2021-01-20T07:29:21.370000
2017-05-02T07:40:51
2017-05-02T07:40:51
90,004,532
0
2
null
true
2017-05-02T07:30:50
2017-05-02T07:30:50
2015-10-13T21:31:39
2015-10-13T21:30:26
420
0
0
0
null
null
null
package unit.net.sourceforge.html5val.performers; import net.sourceforge.html5val.ValidationPerformer; import net.sourceforge.html5val.performers.RangePerformer; import org.hibernate.validator.constraints.Range; import org.jmock.Expectations; import org.jmock.Mockery; import org.jmock.integration.junit4.JUnit4Mockery; import org.junit.Test; import org.thymeleaf.dom.Element; import unit.net.sourceforge.html5val.ValidationPerformerFactoryTest; import org.junit.Before; import static org.junit.Assert.*; public class RangePerformerTest { private final Long maxAllowedValue = 1L; private final Long minAllowedValue = 100L; private final Mockery context = new JUnit4Mockery(); private Range rangeAnnotation = context.mock(Range.class); private ValidationPerformer performer = new RangePerformer(); @Before public void setUp() { context.checking(new Expectations(){{ allowing(rangeAnnotation).min(); will(returnValue(minAllowedValue)); allowing(rangeAnnotation).max(); will(returnValue(maxAllowedValue)); }}); } @Test public void factoryKnownsPerformer() { ValidationPerformerFactoryTest.assertGetPerformer(performer, rangeAnnotation); } @Test public void putValidationCodeInto() { // Before: <input type="text" /> Element input = new Element("input"); input.setAttribute("type", "text"); performer.putValidationCodeInto(rangeAnnotation, input); // After: <input type="range" min="1" max="10" /> assertEquals("range", input.getAttributeValue("type")); assertEquals(rangeAnnotation.min(), Long.parseLong(input.getAttributeValue("min"))); assertEquals(rangeAnnotation.max(), Long.parseLong(input.getAttributeValue("max"))); } }
UTF-8
Java
1,800
java
RangePerformerTest.java
Java
[]
null
[]
package unit.net.sourceforge.html5val.performers; import net.sourceforge.html5val.ValidationPerformer; import net.sourceforge.html5val.performers.RangePerformer; import org.hibernate.validator.constraints.Range; import org.jmock.Expectations; import org.jmock.Mockery; import org.jmock.integration.junit4.JUnit4Mockery; import org.junit.Test; import org.thymeleaf.dom.Element; import unit.net.sourceforge.html5val.ValidationPerformerFactoryTest; import org.junit.Before; import static org.junit.Assert.*; public class RangePerformerTest { private final Long maxAllowedValue = 1L; private final Long minAllowedValue = 100L; private final Mockery context = new JUnit4Mockery(); private Range rangeAnnotation = context.mock(Range.class); private ValidationPerformer performer = new RangePerformer(); @Before public void setUp() { context.checking(new Expectations(){{ allowing(rangeAnnotation).min(); will(returnValue(minAllowedValue)); allowing(rangeAnnotation).max(); will(returnValue(maxAllowedValue)); }}); } @Test public void factoryKnownsPerformer() { ValidationPerformerFactoryTest.assertGetPerformer(performer, rangeAnnotation); } @Test public void putValidationCodeInto() { // Before: <input type="text" /> Element input = new Element("input"); input.setAttribute("type", "text"); performer.putValidationCodeInto(rangeAnnotation, input); // After: <input type="range" min="1" max="10" /> assertEquals("range", input.getAttributeValue("type")); assertEquals(rangeAnnotation.min(), Long.parseLong(input.getAttributeValue("min"))); assertEquals(rangeAnnotation.max(), Long.parseLong(input.getAttributeValue("max"))); } }
1,800
0.723889
0.716111
47
37.297871
27.027105
92
false
false
0
0
0
0
0
0
0.744681
false
false
13
c8ed4feddca9eeee56cab04019c474ca3e36b912
4,157,528,397,526
6903dbeed018488adf254d6756a2064836b9c51c
/src/test/java/io/geekmind/budgie/model/mapper/CategoryMappingTest.java
efcff5d569e2d78dedf93fd9b2c340092d339b0f
[]
no_license
andre-lmsilva/budgie
https://github.com/andre-lmsilva/budgie
fad4c70cb3333b5ea9f4e2222b58c5c2f599834a
9a1cf4f28e3984c6128274d7d64234f76afe6245
refs/heads/master
2023-08-06T22:10:46.163000
2021-10-01T15:59:22
2021-10-01T15:59:22
263,058,814
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.geekmind.budgie.model.mapper; import io.geekmind.budgie.model.mapper.category.CategoryToEditCategoryMappingTest; import io.geekmind.budgie.model.mapper.category.CategoryToExistingCategoryMappingTest; import io.geekmind.budgie.model.mapper.category.CategoryToNewCategoryMappingTest; import io.geekmind.budgie.model.mapper.category.EditCategoryToCategoryMergingTest; import io.geekmind.budgie.model.mapper.category.ExistingCategoryToCategoryMappingTest; import io.geekmind.budgie.model.mapper.category.NewCategoryToCategoryMappingTest; import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) @Suite.SuiteClasses({ CategoryToExistingCategoryMappingTest.class, ExistingCategoryToCategoryMappingTest.class, NewCategoryToCategoryMappingTest.class, CategoryToNewCategoryMappingTest.class, CategoryToEditCategoryMappingTest.class, EditCategoryToCategoryMergingTest.class }) public class CategoryMappingTest { }
UTF-8
Java
997
java
CategoryMappingTest.java
Java
[]
null
[]
package io.geekmind.budgie.model.mapper; import io.geekmind.budgie.model.mapper.category.CategoryToEditCategoryMappingTest; import io.geekmind.budgie.model.mapper.category.CategoryToExistingCategoryMappingTest; import io.geekmind.budgie.model.mapper.category.CategoryToNewCategoryMappingTest; import io.geekmind.budgie.model.mapper.category.EditCategoryToCategoryMergingTest; import io.geekmind.budgie.model.mapper.category.ExistingCategoryToCategoryMappingTest; import io.geekmind.budgie.model.mapper.category.NewCategoryToCategoryMappingTest; import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) @Suite.SuiteClasses({ CategoryToExistingCategoryMappingTest.class, ExistingCategoryToCategoryMappingTest.class, NewCategoryToCategoryMappingTest.class, CategoryToNewCategoryMappingTest.class, CategoryToEditCategoryMappingTest.class, EditCategoryToCategoryMergingTest.class }) public class CategoryMappingTest { }
997
0.837513
0.837513
24
40.541668
30.195169
86
false
false
0
0
0
0
0
0
0.583333
false
false
13
b1343e0445bded0d19216f98a9207f8a55bd1498
20,890,720,963,326
88807ebe2f221c6a4f543efb16dffeb80f7031a4
/src/test/java/br/com/aula/BancoTest.java
ae56d4301367fa56e61652d693ae76a4cf423f63
[]
no_license
Ezequiel-Ferreira/trabalho-testes-unitarios
https://github.com/Ezequiel-Ferreira/trabalho-testes-unitarios
2de403e26be929590e3538bfe6e72832f36f83a3
fd2e92d8e7931a2f161a9d1114763f5e378931a2
refs/heads/main
2023-01-01T07:29:50.593000
2020-10-27T00:58:07
2020-10-27T00:58:07
307,541,598
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.aula; import static org.junit.Assert.assertEquals; import java.util.Arrays; import org.junit.Assert; import org.junit.Test; import br.com.aula.exception.ContaJaExistenteException; import br.com.aula.exception.ContaNaoExistenteException; import br.com.aula.exception.ContaSemSaldoException; import br.com.aula.exception.NumeroDeContaInvalidoException; import br.com.aula.exception.ValorNegativoException; public class BancoTest { @Test public void deveCadastrarConta() throws ContaJaExistenteException, NumeroDeContaInvalidoException { // Cenario Cliente cliente = new Cliente("Joao"); Conta conta = new Conta(cliente, 123, 0, TipoConta.CORRENTE); Banco banco = new Banco(); // Ação banco.cadastrarConta(conta); // Verificação assertEquals(1, banco.obterContas().size()); } @Test(expected = ContaJaExistenteException.class) public void naoDeveCadastrarContaNumeroRepetido() throws ContaJaExistenteException, NumeroDeContaInvalidoException { // Cenario Cliente cliente = new Cliente("Joao"); Conta conta1 = new Conta(cliente, 123, 0, TipoConta.CORRENTE); Cliente cliente2 = new Cliente("Maria"); Conta conta2 = new Conta(cliente2, 123, 0, TipoConta.POUPANCA); Banco banco = new Banco(); // Ação banco.cadastrarConta(conta1); banco.cadastrarConta(conta2); Assert.fail(); } @Test(expected = NumeroDeContaInvalidoException.class) public void naoDevePossuirNumeroInvalido() throws ContaJaExistenteException, NumeroDeContaInvalidoException { Cliente cliente = new Cliente("Carla"); Conta conta1 = new Conta(cliente, 12345673, 0, TipoConta.CORRENTE); Banco banco = new Banco(); // Ação banco.cadastrarConta(conta1); Assert.fail(); } @Test(expected = ContaJaExistenteException.class) public void naoDeveCadastrarContaComNomeExistente() throws ContaJaExistenteException, NumeroDeContaInvalidoException { Cliente cliente = new Cliente("Joao"); Conta conta1 = new Conta(cliente, 123, 0, TipoConta.CORRENTE); Cliente cliente2 = new Cliente("Maria"); Conta conta2 = new Conta(cliente2, 123, 0, TipoConta.POUPANCA); Cliente cliente3 = new Cliente("Maria"); Conta conta3 = new Conta(cliente3, 123, 0, TipoConta.CORRENTE); Banco banco = new Banco(); banco.cadastrarConta(conta1); banco.cadastrarConta(conta2); banco.cadastrarConta(conta3); Assert.fail(); } @Test public void deveEfetuarTransferenciaContasCorrentes() throws ContaSemSaldoException, ContaNaoExistenteException, ValorNegativoException { // Cenario Cliente cliente = new Cliente("Joao"); Conta contaOrigem = new Conta(cliente, 123, 0, TipoConta.CORRENTE); Cliente cliente2 = new Cliente("Maria"); Conta contaDestino = new Conta(cliente2, 456, 0, TipoConta.CORRENTE); Banco banco = new Banco(Arrays.asList(contaOrigem, contaDestino)); // Ação banco.efetuarTransferencia(123, 456, 100); // Verificação assertEquals(-100, contaOrigem.getSaldo()); assertEquals(100, contaDestino.getSaldo()); } @Test public void deveEfetuarTransferenciaContasPoupanca() throws ContaSemSaldoException, ContaNaoExistenteException, ValorNegativoException { // Cenario Cliente cliente = new Cliente("Joao"); Conta contaOrigem = new Conta(cliente, 123, 1000, TipoConta.POUPANCA); Cliente cliente2 = new Cliente("Maria"); Conta contaDestino = new Conta(cliente2, 456, 1000, TipoConta.POUPANCA); Banco banco = new Banco(Arrays.asList(contaOrigem, contaDestino)); // Ação banco.efetuarTransferencia(123, 456, 100); // Verificação assertEquals(900, contaOrigem.getSaldo()); assertEquals(1100, contaDestino.getSaldo()); } @Test(expected = ContaNaoExistenteException.class) public void deveVerificarAContaOrigemNoBanco() throws ContaNaoExistenteException, ContaSemSaldoException, ValorNegativoException { Cliente cliente = new Cliente("Joao"); Conta contaOrigem = new Conta(cliente, 123, 450, TipoConta.CORRENTE); Cliente cliente2 = new Cliente("Maria"); Conta contaDestino = new Conta(cliente2, 456, 81, TipoConta.CORRENTE); Banco banco = new Banco(Arrays.asList(contaOrigem, contaDestino)); banco.efetuarTransferencia(111, contaDestino.getNumeroConta(), 110 ); Assert.fail(); } @Test(expected = ContaNaoExistenteException.class) public void deveVerificarAContaDestinoNoBanco() throws ContaNaoExistenteException, ContaSemSaldoException, ValorNegativoException { Cliente cliente = new Cliente("Joao"); Conta contaOrigem = new Conta(cliente, 123, 99, TipoConta.CORRENTE); Banco banco = new Banco(Arrays.asList(contaOrigem)); banco.efetuarTransferencia(123, 654, 12 ); Assert.fail(); } @Test(expected = ContaSemSaldoException.class) public void contaPoupancaNaoDeveFicarComSaldoNegativo() throws ContaNaoExistenteException, ContaSemSaldoException, ValorNegativoException { Cliente cliente = new Cliente("Joao"); Conta contaOrigem = new Conta(cliente, 123, 99, TipoConta.POUPANCA); Cliente cliente2 = new Cliente("Maria"); Conta contaDestino = new Conta(cliente2, 456, 1, TipoConta.CORRENTE); Banco banco = new Banco(Arrays.asList(contaOrigem, contaDestino)); banco.efetuarTransferencia(123, 456, 100); Assert.fail(); } @Test(expected = ValorNegativoException.class) public void valorTransferidoNaoPodeserNegativo() throws ContaNaoExistenteException, ContaSemSaldoException, ValorNegativoException { Cliente cliente = new Cliente("Joao"); Conta contaOrigem = new Conta(cliente, 123, 99, TipoConta.POUPANCA); Cliente cliente2 = new Cliente("Maria"); Conta contaDestino = new Conta(cliente2, 456, 1, TipoConta.CORRENTE); Banco banco = new Banco(Arrays.asList(contaOrigem, contaDestino)); banco.efetuarTransferencia(123, 456, -1); Assert.fail(); } }
UTF-8
Java
5,791
java
BancoTest.java
Java
[ { "context": " {\n\n\t\t// Cenario\n\t\tCliente cliente = new Cliente(\"Joao\");\n\t\tConta conta = new Conta(cliente, 123, 0, Tip", "end": 609, "score": 0.9998130798339844, "start": 605, "tag": "NAME", "value": "Joao" }, { "context": " {\n\n\t\t// Cenario\n\t\tCliente cliente = new ...
null
[]
package br.com.aula; import static org.junit.Assert.assertEquals; import java.util.Arrays; import org.junit.Assert; import org.junit.Test; import br.com.aula.exception.ContaJaExistenteException; import br.com.aula.exception.ContaNaoExistenteException; import br.com.aula.exception.ContaSemSaldoException; import br.com.aula.exception.NumeroDeContaInvalidoException; import br.com.aula.exception.ValorNegativoException; public class BancoTest { @Test public void deveCadastrarConta() throws ContaJaExistenteException, NumeroDeContaInvalidoException { // Cenario Cliente cliente = new Cliente("Joao"); Conta conta = new Conta(cliente, 123, 0, TipoConta.CORRENTE); Banco banco = new Banco(); // Ação banco.cadastrarConta(conta); // Verificação assertEquals(1, banco.obterContas().size()); } @Test(expected = ContaJaExistenteException.class) public void naoDeveCadastrarContaNumeroRepetido() throws ContaJaExistenteException, NumeroDeContaInvalidoException { // Cenario Cliente cliente = new Cliente("Joao"); Conta conta1 = new Conta(cliente, 123, 0, TipoConta.CORRENTE); Cliente cliente2 = new Cliente("Maria"); Conta conta2 = new Conta(cliente2, 123, 0, TipoConta.POUPANCA); Banco banco = new Banco(); // Ação banco.cadastrarConta(conta1); banco.cadastrarConta(conta2); Assert.fail(); } @Test(expected = NumeroDeContaInvalidoException.class) public void naoDevePossuirNumeroInvalido() throws ContaJaExistenteException, NumeroDeContaInvalidoException { Cliente cliente = new Cliente("Carla"); Conta conta1 = new Conta(cliente, 12345673, 0, TipoConta.CORRENTE); Banco banco = new Banco(); // Ação banco.cadastrarConta(conta1); Assert.fail(); } @Test(expected = ContaJaExistenteException.class) public void naoDeveCadastrarContaComNomeExistente() throws ContaJaExistenteException, NumeroDeContaInvalidoException { Cliente cliente = new Cliente("Joao"); Conta conta1 = new Conta(cliente, 123, 0, TipoConta.CORRENTE); Cliente cliente2 = new Cliente("Maria"); Conta conta2 = new Conta(cliente2, 123, 0, TipoConta.POUPANCA); Cliente cliente3 = new Cliente("Maria"); Conta conta3 = new Conta(cliente3, 123, 0, TipoConta.CORRENTE); Banco banco = new Banco(); banco.cadastrarConta(conta1); banco.cadastrarConta(conta2); banco.cadastrarConta(conta3); Assert.fail(); } @Test public void deveEfetuarTransferenciaContasCorrentes() throws ContaSemSaldoException, ContaNaoExistenteException, ValorNegativoException { // Cenario Cliente cliente = new Cliente("Joao"); Conta contaOrigem = new Conta(cliente, 123, 0, TipoConta.CORRENTE); Cliente cliente2 = new Cliente("Maria"); Conta contaDestino = new Conta(cliente2, 456, 0, TipoConta.CORRENTE); Banco banco = new Banco(Arrays.asList(contaOrigem, contaDestino)); // Ação banco.efetuarTransferencia(123, 456, 100); // Verificação assertEquals(-100, contaOrigem.getSaldo()); assertEquals(100, contaDestino.getSaldo()); } @Test public void deveEfetuarTransferenciaContasPoupanca() throws ContaSemSaldoException, ContaNaoExistenteException, ValorNegativoException { // Cenario Cliente cliente = new Cliente("Joao"); Conta contaOrigem = new Conta(cliente, 123, 1000, TipoConta.POUPANCA); Cliente cliente2 = new Cliente("Maria"); Conta contaDestino = new Conta(cliente2, 456, 1000, TipoConta.POUPANCA); Banco banco = new Banco(Arrays.asList(contaOrigem, contaDestino)); // Ação banco.efetuarTransferencia(123, 456, 100); // Verificação assertEquals(900, contaOrigem.getSaldo()); assertEquals(1100, contaDestino.getSaldo()); } @Test(expected = ContaNaoExistenteException.class) public void deveVerificarAContaOrigemNoBanco() throws ContaNaoExistenteException, ContaSemSaldoException, ValorNegativoException { Cliente cliente = new Cliente("Joao"); Conta contaOrigem = new Conta(cliente, 123, 450, TipoConta.CORRENTE); Cliente cliente2 = new Cliente("Maria"); Conta contaDestino = new Conta(cliente2, 456, 81, TipoConta.CORRENTE); Banco banco = new Banco(Arrays.asList(contaOrigem, contaDestino)); banco.efetuarTransferencia(111, contaDestino.getNumeroConta(), 110 ); Assert.fail(); } @Test(expected = ContaNaoExistenteException.class) public void deveVerificarAContaDestinoNoBanco() throws ContaNaoExistenteException, ContaSemSaldoException, ValorNegativoException { Cliente cliente = new Cliente("Joao"); Conta contaOrigem = new Conta(cliente, 123, 99, TipoConta.CORRENTE); Banco banco = new Banco(Arrays.asList(contaOrigem)); banco.efetuarTransferencia(123, 654, 12 ); Assert.fail(); } @Test(expected = ContaSemSaldoException.class) public void contaPoupancaNaoDeveFicarComSaldoNegativo() throws ContaNaoExistenteException, ContaSemSaldoException, ValorNegativoException { Cliente cliente = new Cliente("Joao"); Conta contaOrigem = new Conta(cliente, 123, 99, TipoConta.POUPANCA); Cliente cliente2 = new Cliente("Maria"); Conta contaDestino = new Conta(cliente2, 456, 1, TipoConta.CORRENTE); Banco banco = new Banco(Arrays.asList(contaOrigem, contaDestino)); banco.efetuarTransferencia(123, 456, 100); Assert.fail(); } @Test(expected = ValorNegativoException.class) public void valorTransferidoNaoPodeserNegativo() throws ContaNaoExistenteException, ContaSemSaldoException, ValorNegativoException { Cliente cliente = new Cliente("Joao"); Conta contaOrigem = new Conta(cliente, 123, 99, TipoConta.POUPANCA); Cliente cliente2 = new Cliente("Maria"); Conta contaDestino = new Conta(cliente2, 456, 1, TipoConta.CORRENTE); Banco banco = new Banco(Arrays.asList(contaOrigem, contaDestino)); banco.efetuarTransferencia(123, 456, -1); Assert.fail(); } }
5,791
0.756537
0.725541
194
28.768042
32.84206
140
false
false
0
0
0
0
0
0
2.097938
false
false
13
069eb8f669f8a0d6a784aa62d94ef10580127232
17,970,143,195,829
12c7e4de3eea0f8aabfccdb5974c6efea8397393
/src/week_1_java/functionalInterfaces/PredicateExample.java
6219e8aca3400b3a8032921626d4d37797692e0f
[]
no_license
CBasa/JavaPractice
https://github.com/CBasa/JavaPractice
afde3ae4955ab807f066184396121d63a2c2a118
1b051f348f0a97af21b9473db99b7b6f44e1ab83
refs/heads/main
2023-05-08T02:40:22.187000
2021-06-03T15:29:12
2021-06-03T15:29:12
373,555,250
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package week_1_java.functionalInterfaces; import java.util.function.Predicate; public class PredicateExample { static Predicate<Integer> p1 = (i) -> {return i%5==0;}; static Predicate<Integer> p2 = (i) -> i%2==0; //no return or {} needed if one line public static void predicateAnd() { System.out.println("PredicateAnd result is: "+p1.and(p2).test(16)); //predicate chaining System.out.println("PredicateAnd result is: "+p1.and(p2).test(20)); } public static void predicateOr() { System.out.println("PredicateOr result is: "+p1.or(p2).test(16)); //predicate chaining System.out.println("PredicateOr result is: "+p1.or(p2).test(20)); } public static void predicateONegate() { System.out.println("PredicateNegate result is: "+p1.or(p2).negate().test(16)); //predicate chaining System.out.println("PredicateNegate result is: "+p1.or(p2).negate().test(20)); } public static void main(String[] args) { System.out.println(p1.test(5)); //'test' takes in input predicateAnd(); predicateOr(); predicateONegate(); } }
UTF-8
Java
1,056
java
PredicateExample.java
Java
[]
null
[]
package week_1_java.functionalInterfaces; import java.util.function.Predicate; public class PredicateExample { static Predicate<Integer> p1 = (i) -> {return i%5==0;}; static Predicate<Integer> p2 = (i) -> i%2==0; //no return or {} needed if one line public static void predicateAnd() { System.out.println("PredicateAnd result is: "+p1.and(p2).test(16)); //predicate chaining System.out.println("PredicateAnd result is: "+p1.and(p2).test(20)); } public static void predicateOr() { System.out.println("PredicateOr result is: "+p1.or(p2).test(16)); //predicate chaining System.out.println("PredicateOr result is: "+p1.or(p2).test(20)); } public static void predicateONegate() { System.out.println("PredicateNegate result is: "+p1.or(p2).negate().test(16)); //predicate chaining System.out.println("PredicateNegate result is: "+p1.or(p2).negate().test(20)); } public static void main(String[] args) { System.out.println(p1.test(5)); //'test' takes in input predicateAnd(); predicateOr(); predicateONegate(); } }
1,056
0.694129
0.662879
33
31
32.234932
101
false
false
0
0
0
0
0
0
1.575758
false
false
13
61ece2438f48d46a34e083176f238da17e97b2ed
26,070,451,530,431
cf29943774aec0366fe41e2b282c3d75226a622e
/task/src/main/java/www/aaa/wall2/repos/NotesRepo.java
96d8d7640de930ab7b1ef2d096d53ac30d43837b
[]
no_license
NorNikita/JavaExample
https://github.com/NorNikita/JavaExample
401b965f1388a3e5af77eb1100c743a34989cf17
922d1f9424f796a84d3a06b903479beaf16f8f45
refs/heads/master
2018-11-10T22:13:06.319000
2018-08-31T12:07:30
2018-08-31T12:07:30
144,406,463
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package www.aaa.wall2.repos; import java.util.*; import org.springframework.data.repository.CrudRepository; import www.aaa.wall2.domain.Notes; public interface NotesRepo extends CrudRepository<Notes, Integer> { List<Notes> findByTitle(String title); List<Notes> findByCategory(String category); Notes findOneById(Integer id); }
UTF-8
Java
342
java
NotesRepo.java
Java
[]
null
[]
package www.aaa.wall2.repos; import java.util.*; import org.springframework.data.repository.CrudRepository; import www.aaa.wall2.domain.Notes; public interface NotesRepo extends CrudRepository<Notes, Integer> { List<Notes> findByTitle(String title); List<Notes> findByCategory(String category); Notes findOneById(Integer id); }
342
0.780702
0.774854
11
30.09091
22.195227
67
false
false
0
0
0
0
0
0
0.727273
false
false
13
e6508ae53e934559a7ede9c80f6da8575a5f79fe
8,040,178,788,196
9d6e6711e18c50f3978a007e6ead83435a6e1090
/knights/src/main/java/com/springinaction/knights/MinstrelsConfiguration.java
bddc7e2e3802435c35fd12ebd990770e87c5e989
[]
no_license
webcane/spring-in-action
https://github.com/webcane/spring-in-action
f2c690f35b197b641ecaef1b4b235a319c0b4887
053344c3bc4a9c99313237f713a92b63ea5fa571
refs/heads/master
2021-01-18T08:40:21.385000
2016-03-12T10:35:03
2016-03-12T10:35:03
52,263,557
0
0
null
true
2016-02-22T09:50:47
2016-02-22T09:50:47
2014-06-25T08:02:56
2014-06-25T08:02:56
140
0
0
0
null
null
null
package com.springinaction.knights; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; @Configuration @EnableAspectJAutoProxy public class MinstrelsConfiguration { // aspects @Bean public Minstrel minstrel() { return new Minstrel(); } }
UTF-8
Java
379
java
MinstrelsConfiguration.java
Java
[]
null
[]
package com.springinaction.knights; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; @Configuration @EnableAspectJAutoProxy public class MinstrelsConfiguration { // aspects @Bean public Minstrel minstrel() { return new Minstrel(); } }
379
0.82058
0.82058
16
22.6875
21.848108
69
false
false
0
0
0
0
0
0
0.6875
false
false
13
4b15d1496739795d76f47b3dbb6ef7d8abd17f55
7,043,746,391,220
fa6f3e394a45ef1a67bd37c01c91bee06d8cba88
/src/main/java/org/yfr/repository/sql/TDCountRepository.java
bb6def5504908e6566d7d688545a8bb8e1fdd51e
[]
no_license
Jian-Min-Huang/restful-server
https://github.com/Jian-Min-Huang/restful-server
1d9835667304eb4a445dfbcaad85b92d024db9c7
647800d8d6c9c1bb53b50a578045fe917ce1d105
HEAD
2018-01-08T04:22:36.207000
2016-04-27T08:44:06
2016-04-27T08:44:06
54,170,960
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.yfr.repository.sql; import java.util.List; import org.yfr.common.entity.TaoyuanDivorcedCount; public interface TDCountRepository { boolean insert(TaoyuanDivorcedCount taoyuanDivorcedCount) throws Exception; List<TaoyuanDivorcedCount> queryAll(TaoyuanDivorcedCount conditionEntity) throws Exception; boolean update(TaoyuanDivorcedCount paramEntity, TaoyuanDivorcedCount conditionEntity) throws Exception; boolean delete(TaoyuanDivorcedCount taoyuanDivorcedCount) throws Exception; }
UTF-8
Java
507
java
TDCountRepository.java
Java
[]
null
[]
package org.yfr.repository.sql; import java.util.List; import org.yfr.common.entity.TaoyuanDivorcedCount; public interface TDCountRepository { boolean insert(TaoyuanDivorcedCount taoyuanDivorcedCount) throws Exception; List<TaoyuanDivorcedCount> queryAll(TaoyuanDivorcedCount conditionEntity) throws Exception; boolean update(TaoyuanDivorcedCount paramEntity, TaoyuanDivorcedCount conditionEntity) throws Exception; boolean delete(TaoyuanDivorcedCount taoyuanDivorcedCount) throws Exception; }
507
0.852071
0.852071
17
28.764706
36.150875
105
false
false
0
0
0
0
0
0
0.705882
false
false
13
bb53e3d68a027f0948c123a5c5c05d38086bf7ff
28,922,309,799,934
4981c17a3b708284718186290d23904b29fa7621
/653__Two_Sum_IV_-_Input_is_a_BST.java
a403fb58828b2c932772dea526c31f398a0cbe6e
[]
no_license
SongtaoZ/LeetCode
https://github.com/SongtaoZ/LeetCode
aa87e741fece3498dc8fc77989253061e4f47a60
40c24e022f0ca6d15a205fa210b080455b1dd140
refs/heads/master
2020-02-05T01:52:46.893000
2019-03-06T01:27:04
2019-03-06T01:27:04
59,393,017
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. Example 1: Input: 5 / \ 3 6 / \ \ 2 4 7 Target = 9 Output: True Example 2: Input: 5 / \ 3 6 / \ \ 2 4 7 Target = 28 Output: False // /** // * Definition for a binary tree node. // * public class TreeNode { // * int val; // * TreeNode left; // * TreeNode right; // * TreeNode(int x) { val = x; } // * } // */ // // Using hashset, also works for non-BST binary tree // public class Solution { // public boolean findTarget(TreeNode root, int k) { // Set<Integer> set = new HashSet<>(); // return helper(root, k, set); // } // private boolean helper(TreeNode root, int k, Set<Integer> set) { // if (root == null) { // return false; // } // if (set.contains(root.val)) { // return true; // } // set.add(k - root.val); // boolean left = helper(root.left, k, set); // boolean right = helper(root.right, k, set); // return left || right; // } // } // Save BST in-order traversal to an array and run two-sum algorithm public class Solution { public boolean findTarget(TreeNode root, int k) { List<Integer> list = new ArrayList<>(); inorder(root, list); int lo = 0, hi = list.size()-1; while (lo < hi) { int sum = list.get(lo) + list.get(hi); if (sum < k) { lo++; } else if (sum > k) { hi--; } else { return true; } } return false; } private void inorder(TreeNode root, List<Integer> list) { if (root == null) { return; } inorder(root.left, list); list.add(root.val); inorder(root.right, list); } }
UTF-8
Java
1,981
java
653__Two_Sum_IV_-_Input_is_a_BST.java
Java
[]
null
[]
Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. Example 1: Input: 5 / \ 3 6 / \ \ 2 4 7 Target = 9 Output: True Example 2: Input: 5 / \ 3 6 / \ \ 2 4 7 Target = 28 Output: False // /** // * Definition for a binary tree node. // * public class TreeNode { // * int val; // * TreeNode left; // * TreeNode right; // * TreeNode(int x) { val = x; } // * } // */ // // Using hashset, also works for non-BST binary tree // public class Solution { // public boolean findTarget(TreeNode root, int k) { // Set<Integer> set = new HashSet<>(); // return helper(root, k, set); // } // private boolean helper(TreeNode root, int k, Set<Integer> set) { // if (root == null) { // return false; // } // if (set.contains(root.val)) { // return true; // } // set.add(k - root.val); // boolean left = helper(root.left, k, set); // boolean right = helper(root.right, k, set); // return left || right; // } // } // Save BST in-order traversal to an array and run two-sum algorithm public class Solution { public boolean findTarget(TreeNode root, int k) { List<Integer> list = new ArrayList<>(); inorder(root, list); int lo = 0, hi = list.size()-1; while (lo < hi) { int sum = list.get(lo) + list.get(hi); if (sum < k) { lo++; } else if (sum > k) { hi--; } else { return true; } } return false; } private void inorder(TreeNode root, List<Integer> list) { if (root == null) { return; } inorder(root.left, list); list.add(root.val); inorder(root.right, list); } }
1,981
0.49369
0.484099
87
21.770115
22.344585
148
false
false
0
0
0
0
0
0
0.494253
false
false
13
dc9ac778454b3b391c4b0784f1cfcdfc432cbdb7
32,238,024,545,488
026ccbcbc504d391595956a3c9fe3246553873ae
/src/main/java/web/FinalOutputServlet.java
69f171160d89adff8521c5faee05b0d9e6dae466
[]
no_license
irackiw/Mpr2_s017_e03
https://github.com/irackiw/Mpr2_s017_e03
6d9c9c09b78bdef1c70f51842b05d1c4470f5367
f7fa41a4b6e3e8227e86d8660654530cee46dbc2
refs/heads/master
2017-12-05T14:50:31.812000
2017-01-25T15:07:03
2017-01-25T15:07:03
80,289,358
0
1
null
true
2017-01-28T14:39:43
2017-01-28T14:39:43
2016-10-12T11:55:38
2017-01-25T15:07:07
225
0
0
0
null
null
null
package web; import domain.model.Currency; import domain.model.Person; import domain.model.Wallet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @WebServlet("/final") public class FinalOutputServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(); Person person = (Person) session.getAttribute(SessionKey.person); Wallet wallet = (Wallet) session.getAttribute(SessionKey.wallets); resp.setContentType("text/html"); resp.getWriter().println("Wszystko ok"); } }
UTF-8
Java
972
java
FinalOutputServlet.java
Java
[]
null
[]
package web; import domain.model.Currency; import domain.model.Person; import domain.model.Wallet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @WebServlet("/final") public class FinalOutputServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(); Person person = (Person) session.getAttribute(SessionKey.person); Wallet wallet = (Wallet) session.getAttribute(SessionKey.wallets); resp.setContentType("text/html"); resp.getWriter().println("Wszystko ok"); } }
972
0.742798
0.74177
37
25.270269
26.495945
113
false
false
0
0
0
0
0
0
0.513514
false
false
13
df58e30eef45634740ee5e48023d58469fdf644f
33,432,025,450,255
7692bb5c5f411fb78640a3a4a40a22a498e8add3
/Single Player Monster/src/Monster.java
20a41316fe239ca76a804f8f1119a983d1e873fc
[]
no_license
tariqmbawa/simple-strategic-game
https://github.com/tariqmbawa/simple-strategic-game
8900b1bf8d4c51de2793e0c3c625a692305a4169
ea30893f9e36d0f300d0c15da448763d08ab192c
refs/heads/master
2020-03-28T07:42:20.607000
2018-09-08T09:39:41
2018-09-08T09:39:41
147,918,827
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import javafx.scene.image.Image; public class Monster extends MoveableEntity { static int NUM_DIRECTIONS = 4; public Monster(Image image, Image poisonedImage, int x, int y) { super(image, poisonedImage, x, y); // TODO Auto-generated constructor stub } public void update(int timeUnitDelta) { } public Boolean moveRandom(int direction) { if (direction%NUM_DIRECTIONS == 0) setDirection(Direction.UP); if (direction%NUM_DIRECTIONS == 1) setDirection(Direction.RIGHT); if (direction%NUM_DIRECTIONS == 2) setDirection(Direction.DOWN); if (direction%NUM_DIRECTIONS == 3) setDirection(Direction.LEFT); return true; } }
UTF-8
Java
653
java
Monster.java
Java
[]
null
[]
import javafx.scene.image.Image; public class Monster extends MoveableEntity { static int NUM_DIRECTIONS = 4; public Monster(Image image, Image poisonedImage, int x, int y) { super(image, poisonedImage, x, y); // TODO Auto-generated constructor stub } public void update(int timeUnitDelta) { } public Boolean moveRandom(int direction) { if (direction%NUM_DIRECTIONS == 0) setDirection(Direction.UP); if (direction%NUM_DIRECTIONS == 1) setDirection(Direction.RIGHT); if (direction%NUM_DIRECTIONS == 2) setDirection(Direction.DOWN); if (direction%NUM_DIRECTIONS == 3) setDirection(Direction.LEFT); return true; } }
653
0.721286
0.713629
26
24.115385
18.576923
65
false
false
0
0
0
0
0
0
1.884615
false
false
13
c538c300f3955b33d90fdc791b278de26943bd9a
33,990,371,217,308
5ffe19724e4be59198ce02a811056065ddf99dba
/msc/isup/isup-impl/src/java/main/za/co/ebridge/isup/impl/message/parameter/GenericReferenceImpl.java
25431b3e256c37aefbff922a29b37296ce263e30
[]
no_license
davidtekeshe/vasgw
https://github.com/davidtekeshe/vasgw
d27ca65de37581678f18ca44ce8f0be881fc6e9b
cceb2eac42000e6c75fc9aa3d4af2df7ed96ab55
refs/heads/master
2016-12-28T20:56:40.027000
2015-07-27T11:36:03
2015-07-27T11:36:03
39,770,739
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* eBridge SS7 */ /** * Start time:13:04:01 2009-07-17<br> * Project: mobicents-isup-stack<br> * * @author <a href="mailto:baranowb@gmail.com">Bartosz Baranowski </a> * */ package za.co.ebridge.isup.impl.message.parameter; import za.co.ebridge.isup.api.ParameterException; import za.co.ebridge.isup.api.message.parameter.GenericReference; /** * Start time:13:04:01 2009-07-17<br> * Project: mobicents-isup-stack<br> * * @author <a href="mailto:baranowb@gmail.com"> Bartosz Baranowski </a> */ public class GenericReferenceImpl extends AbstractISUPParameter implements GenericReference { /** * */ public GenericReferenceImpl() { //FIXME: XXX } /** * @throws ParameterException * @throws ParameterException * */ public GenericReferenceImpl(byte[] b) throws ParameterException { decode(b); } /* * (non-Javadoc) * * @see org.mobicents.isup.parameters.ISUPParameter#getCode() */ public int getCode() { // TODO Auto-generated method stub return _PARAMETER_CODE; } public int decode(byte[] b) throws ParameterException { // TODO Auto-generated method stub return 0; } public byte[] encode() throws ParameterException { // TODO Auto-generated method stub return null; } }
UTF-8
Java
1,349
java
GenericReferenceImpl.java
Java
[ { "context": "ents-isup-stack<br>\n *\n * @author <a href=\"mailto:baranowb@gmail.com\">Bartosz Baranowski </a>\n *\n */\npackage za.co.ebr", "end": 146, "score": 0.9999293684959412, "start": 128, "tag": "EMAIL", "value": "baranowb@gmail.com" }, { "context": " *\n * @author <a href=\...
null
[]
/* eBridge SS7 */ /** * Start time:13:04:01 2009-07-17<br> * Project: mobicents-isup-stack<br> * * @author <a href="mailto:<EMAIL>"><NAME> </a> * */ package za.co.ebridge.isup.impl.message.parameter; import za.co.ebridge.isup.api.ParameterException; import za.co.ebridge.isup.api.message.parameter.GenericReference; /** * Start time:13:04:01 2009-07-17<br> * Project: mobicents-isup-stack<br> * * @author <a href="mailto:<EMAIL>"> <NAME> </a> */ public class GenericReferenceImpl extends AbstractISUPParameter implements GenericReference { /** * */ public GenericReferenceImpl() { //FIXME: XXX } /** * @throws ParameterException * @throws ParameterException * */ public GenericReferenceImpl(byte[] b) throws ParameterException { decode(b); } /* * (non-Javadoc) * * @see org.mobicents.isup.parameters.ISUPParameter#getCode() */ public int getCode() { // TODO Auto-generated method stub return _PARAMETER_CODE; } public int decode(byte[] b) throws ParameterException { // TODO Auto-generated method stub return 0; } public byte[] encode() throws ParameterException { // TODO Auto-generated method stub return null; } }
1,303
0.638251
0.616012
59
21.864407
23.729019
93
false
false
0
0
0
0
0
0
0.118644
false
false
13
e60c9ef009f306b5e3a114ab72b5ad53db58a170
10,977,936,479,483
9ce66aee1e04df7956f016a44c9beace48e1e8c9
/org.spoofax.jsglr2.measure/src/main/java/org/spoofax/jsglr2/measure/ParserMeasureObserver.java
03b9d19494c80de2e675ff1160a8d5708efdf307
[ "Apache-2.0" ]
permissive
MarcianoJ/jsglr
https://github.com/MarcianoJ/jsglr
8e72bf949b028fbdf42503c015914ba7c3f5f751
e91cfb28a1e8131342936219287c75871dc1c177
refs/heads/master
2020-03-20T05:57:18.693000
2018-06-13T18:57:33
2018-06-13T18:57:33
137,232,661
0
0
Apache-2.0
true
2018-06-13T15:10:31
2018-06-13T15:10:30
2018-06-08T13:22:59
2018-06-12T09:47:54
71,478
0
0
0
null
false
null
package org.spoofax.jsglr2.measure; import java.util.HashSet; import java.util.Queue; import java.util.Set; import org.spoofax.jsglr2.actions.IAction; import org.spoofax.jsglr2.actions.IReduce; import org.spoofax.jsglr2.elkhound.AbstractElkhoundStackNode; import org.spoofax.jsglr2.parseforest.AbstractParseForest; import org.spoofax.jsglr2.parseforest.hybrid.ParseNode; import org.spoofax.jsglr2.parser.ForShifterElement; import org.spoofax.jsglr2.parser.Parse; import org.spoofax.jsglr2.parser.ParseFailure; import org.spoofax.jsglr2.parser.ParseSuccess; import org.spoofax.jsglr2.parser.observing.IParserObserver; import org.spoofax.jsglr2.parsetable.IProduction; import org.spoofax.jsglr2.stack.StackLink; import org.spoofax.jsglr2.stack.collections.IForActorStacks; import org.spoofax.jsglr2.states.IState; public class ParserMeasureObserver<ParseForest extends AbstractParseForest> implements IParserObserver<ParseForest, AbstractElkhoundStackNode<ParseForest>> { public int length = 0; Parse<ParseForest, AbstractElkhoundStackNode<ParseForest>> parse; Set<AbstractElkhoundStackNode<ParseForest>> stackNodes = new HashSet<AbstractElkhoundStackNode<ParseForest>>(); Set<StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>>> stackLinks = new HashSet<StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>>>(); Set<StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>>> stackLinksRejected = new HashSet<StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>>>(); Set<Actor> actors = new HashSet<Actor>(); public int doReductions = 0; public int doLimitedReductions = 0; public int doReductionsLR = 0; public int doReductionsDeterministicGLR = 0; public int doReductionsNonDeterministicGLR = 0; Set<Reducer> reducers = new HashSet<Reducer>(); Set<Reducer> reducersElkhound = new HashSet<Reducer>(); public int deterministicDepthResets = 0; Set<ParseNode> parseNodes = new HashSet<ParseNode>(); Set<ParseForest> characterNodes = new HashSet<ParseForest>(); class Actor { public AbstractElkhoundStackNode<ParseForest> stack; public Iterable<IAction> applicableActions; public Actor(AbstractElkhoundStackNode<ParseForest> stack, Iterable<IAction> applicableActions) { this.stack = stack; this.applicableActions = applicableActions; } } class Reducer { public IReduce reduce; public ParseForest[] parseNodes; public Reducer(IReduce reduce, ParseForest[] parseNodes) { this.reduce = reduce; this.parseNodes = parseNodes; } } int stackNodesSingleLink() { int res = 0; for(AbstractElkhoundStackNode<?> stackNode : stackNodes) { int linksOutCount = 0; for(StackLink<?, ?> link : stackNode.getLinks()) linksOutCount++; res += linksOutCount == 1 ? 1 : 0; } return res; } @Override public void parseStart(Parse<ParseForest, AbstractElkhoundStackNode<ParseForest>> parse) { this.parse = parse; length += parse.inputLength; } @Override public void parseCharacter(Parse<ParseForest, AbstractElkhoundStackNode<ParseForest>> parse, Iterable<AbstractElkhoundStackNode<ParseForest>> activeStacks) { } @Override public void addActiveStack(AbstractElkhoundStackNode<ParseForest> stack) { } @Override public void addForActorStack(AbstractElkhoundStackNode<ParseForest> stack) { } @Override public void findActiveStackWithState(IState state) { } @Override public void createStackNode(AbstractElkhoundStackNode<ParseForest> stack) { stackNodes.add(stack); } @Override public void createStackLink(StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>> link) { stackLinks.add(link); } @Override public void resetDeterministicDepth(AbstractElkhoundStackNode<ParseForest> stack) { deterministicDepthResets++; } @Override public void rejectStackLink(StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>> link) { stackLinksRejected.add(link); } @Override public void forActorStacks(IForActorStacks<AbstractElkhoundStackNode<ParseForest>> forActorStacks) { } @Override public void handleForActorStack(AbstractElkhoundStackNode<ParseForest> stack, IForActorStacks<AbstractElkhoundStackNode<ParseForest>> forActorStacks) { } @Override public void actor(AbstractElkhoundStackNode<ParseForest> stack, Parse<ParseForest, AbstractElkhoundStackNode<ParseForest>> parse, Iterable<IAction> applicableActions) { actors.add(new Actor(stack, applicableActions)); } @Override public void skipRejectedStack(AbstractElkhoundStackNode<ParseForest> stack) { } @Override public void addForShifter(ForShifterElement<ParseForest, AbstractElkhoundStackNode<ParseForest>> forShifterElement) { } @Override public void doReductions(Parse<ParseForest, AbstractElkhoundStackNode<ParseForest>> parse, AbstractElkhoundStackNode<ParseForest> stack, IReduce reduce) { doReductions++; if(stack.deterministicDepth >= reduce.arity()) { if(parse.activeStacks.isSingle()) doReductionsLR++; else doReductionsDeterministicGLR++; } else { doReductionsNonDeterministicGLR++; } } @Override public void doLimitedReductions(Parse<ParseForest, AbstractElkhoundStackNode<ParseForest>> parse, AbstractElkhoundStackNode<ParseForest> stack, IReduce reduce, StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>> throughLink) { doLimitedReductions++; } @Override public void reducer(AbstractElkhoundStackNode<ParseForest> stack, IReduce reduce, ParseForest[] parseNodes, AbstractElkhoundStackNode<ParseForest> activeStackWithGotoState) { reducers.add(new Reducer(reduce, parseNodes)); } @Override public void reducerElkhound(AbstractElkhoundStackNode<ParseForest> stack, IReduce reduce, ParseForest[] parseNodes) { reducersElkhound.add(new Reducer(reduce, parseNodes)); } @Override public void directLinkFound(Parse<ParseForest, AbstractElkhoundStackNode<ParseForest>> parse, StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>> directLink) { } @Override public void accept(AbstractElkhoundStackNode<ParseForest> acceptingStack) { } @Override public void createParseNode(ParseForest parseNode, IProduction production) { parseNodes.add((ParseNode) parseNode); } @Override public void createDerivation(int nodeNumber, IProduction production, ParseForest[] parseNodes) { } @Override public void createCharacterNode(ParseForest characterNode, int character) { characterNodes.add(characterNode); } @Override public void addDerivation(ParseForest parseNode) { } @Override public void shifter(ParseForest termNode, Queue<ForShifterElement<ParseForest, AbstractElkhoundStackNode<ParseForest>>> forShifter) { } @Override public void remark(String remark) { } @Override public void success(ParseSuccess<ParseForest, ?> success) { } @Override public void failure(ParseFailure<ParseForest, ?> failure) { throw new IllegalStateException("Failing parses not allowed during measurements"); } }
UTF-8
Java
7,654
java
ParserMeasureObserver.java
Java
[]
null
[]
package org.spoofax.jsglr2.measure; import java.util.HashSet; import java.util.Queue; import java.util.Set; import org.spoofax.jsglr2.actions.IAction; import org.spoofax.jsglr2.actions.IReduce; import org.spoofax.jsglr2.elkhound.AbstractElkhoundStackNode; import org.spoofax.jsglr2.parseforest.AbstractParseForest; import org.spoofax.jsglr2.parseforest.hybrid.ParseNode; import org.spoofax.jsglr2.parser.ForShifterElement; import org.spoofax.jsglr2.parser.Parse; import org.spoofax.jsglr2.parser.ParseFailure; import org.spoofax.jsglr2.parser.ParseSuccess; import org.spoofax.jsglr2.parser.observing.IParserObserver; import org.spoofax.jsglr2.parsetable.IProduction; import org.spoofax.jsglr2.stack.StackLink; import org.spoofax.jsglr2.stack.collections.IForActorStacks; import org.spoofax.jsglr2.states.IState; public class ParserMeasureObserver<ParseForest extends AbstractParseForest> implements IParserObserver<ParseForest, AbstractElkhoundStackNode<ParseForest>> { public int length = 0; Parse<ParseForest, AbstractElkhoundStackNode<ParseForest>> parse; Set<AbstractElkhoundStackNode<ParseForest>> stackNodes = new HashSet<AbstractElkhoundStackNode<ParseForest>>(); Set<StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>>> stackLinks = new HashSet<StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>>>(); Set<StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>>> stackLinksRejected = new HashSet<StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>>>(); Set<Actor> actors = new HashSet<Actor>(); public int doReductions = 0; public int doLimitedReductions = 0; public int doReductionsLR = 0; public int doReductionsDeterministicGLR = 0; public int doReductionsNonDeterministicGLR = 0; Set<Reducer> reducers = new HashSet<Reducer>(); Set<Reducer> reducersElkhound = new HashSet<Reducer>(); public int deterministicDepthResets = 0; Set<ParseNode> parseNodes = new HashSet<ParseNode>(); Set<ParseForest> characterNodes = new HashSet<ParseForest>(); class Actor { public AbstractElkhoundStackNode<ParseForest> stack; public Iterable<IAction> applicableActions; public Actor(AbstractElkhoundStackNode<ParseForest> stack, Iterable<IAction> applicableActions) { this.stack = stack; this.applicableActions = applicableActions; } } class Reducer { public IReduce reduce; public ParseForest[] parseNodes; public Reducer(IReduce reduce, ParseForest[] parseNodes) { this.reduce = reduce; this.parseNodes = parseNodes; } } int stackNodesSingleLink() { int res = 0; for(AbstractElkhoundStackNode<?> stackNode : stackNodes) { int linksOutCount = 0; for(StackLink<?, ?> link : stackNode.getLinks()) linksOutCount++; res += linksOutCount == 1 ? 1 : 0; } return res; } @Override public void parseStart(Parse<ParseForest, AbstractElkhoundStackNode<ParseForest>> parse) { this.parse = parse; length += parse.inputLength; } @Override public void parseCharacter(Parse<ParseForest, AbstractElkhoundStackNode<ParseForest>> parse, Iterable<AbstractElkhoundStackNode<ParseForest>> activeStacks) { } @Override public void addActiveStack(AbstractElkhoundStackNode<ParseForest> stack) { } @Override public void addForActorStack(AbstractElkhoundStackNode<ParseForest> stack) { } @Override public void findActiveStackWithState(IState state) { } @Override public void createStackNode(AbstractElkhoundStackNode<ParseForest> stack) { stackNodes.add(stack); } @Override public void createStackLink(StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>> link) { stackLinks.add(link); } @Override public void resetDeterministicDepth(AbstractElkhoundStackNode<ParseForest> stack) { deterministicDepthResets++; } @Override public void rejectStackLink(StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>> link) { stackLinksRejected.add(link); } @Override public void forActorStacks(IForActorStacks<AbstractElkhoundStackNode<ParseForest>> forActorStacks) { } @Override public void handleForActorStack(AbstractElkhoundStackNode<ParseForest> stack, IForActorStacks<AbstractElkhoundStackNode<ParseForest>> forActorStacks) { } @Override public void actor(AbstractElkhoundStackNode<ParseForest> stack, Parse<ParseForest, AbstractElkhoundStackNode<ParseForest>> parse, Iterable<IAction> applicableActions) { actors.add(new Actor(stack, applicableActions)); } @Override public void skipRejectedStack(AbstractElkhoundStackNode<ParseForest> stack) { } @Override public void addForShifter(ForShifterElement<ParseForest, AbstractElkhoundStackNode<ParseForest>> forShifterElement) { } @Override public void doReductions(Parse<ParseForest, AbstractElkhoundStackNode<ParseForest>> parse, AbstractElkhoundStackNode<ParseForest> stack, IReduce reduce) { doReductions++; if(stack.deterministicDepth >= reduce.arity()) { if(parse.activeStacks.isSingle()) doReductionsLR++; else doReductionsDeterministicGLR++; } else { doReductionsNonDeterministicGLR++; } } @Override public void doLimitedReductions(Parse<ParseForest, AbstractElkhoundStackNode<ParseForest>> parse, AbstractElkhoundStackNode<ParseForest> stack, IReduce reduce, StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>> throughLink) { doLimitedReductions++; } @Override public void reducer(AbstractElkhoundStackNode<ParseForest> stack, IReduce reduce, ParseForest[] parseNodes, AbstractElkhoundStackNode<ParseForest> activeStackWithGotoState) { reducers.add(new Reducer(reduce, parseNodes)); } @Override public void reducerElkhound(AbstractElkhoundStackNode<ParseForest> stack, IReduce reduce, ParseForest[] parseNodes) { reducersElkhound.add(new Reducer(reduce, parseNodes)); } @Override public void directLinkFound(Parse<ParseForest, AbstractElkhoundStackNode<ParseForest>> parse, StackLink<ParseForest, AbstractElkhoundStackNode<ParseForest>> directLink) { } @Override public void accept(AbstractElkhoundStackNode<ParseForest> acceptingStack) { } @Override public void createParseNode(ParseForest parseNode, IProduction production) { parseNodes.add((ParseNode) parseNode); } @Override public void createDerivation(int nodeNumber, IProduction production, ParseForest[] parseNodes) { } @Override public void createCharacterNode(ParseForest characterNode, int character) { characterNodes.add(characterNode); } @Override public void addDerivation(ParseForest parseNode) { } @Override public void shifter(ParseForest termNode, Queue<ForShifterElement<ParseForest, AbstractElkhoundStackNode<ParseForest>>> forShifter) { } @Override public void remark(String remark) { } @Override public void success(ParseSuccess<ParseForest, ?> success) { } @Override public void failure(ParseFailure<ParseForest, ?> failure) { throw new IllegalStateException("Failing parses not allowed during measurements"); } }
7,654
0.7208
0.717272
233
31.849785
32.666855
115
false
false
0
0
0
0
0
0
0.472103
false
false
13
2f19bbb60ca8e5df4291401fc6c74cc63d45ae6f
18,485,539,289,649
ec093984d822dc1bc3d043ed77b328128413b2bf
/src/main/java/rpc/RpcServer.java
2cc1a7cb77e0ccdc21327478b8864641358af6df
[]
no_license
Rayeee/spring-test
https://github.com/Rayeee/spring-test
0df9185f2dd003e6741d599c4cfaa630fe704f72
05d57f7eab84035ad07e818fa5c4f4c1b0586474
refs/heads/master
2021-01-20T03:40:19.891000
2017-09-21T15:37:12
2017-09-21T15:37:12
89,571,677
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package rpc; import java.io.IOException; import java.net.ServerSocket; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; /** * Created by zhugongyi on 2017/7/15. */ public class RpcServer { private ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2); protected static Map<String, Class> registerService = new ConcurrentHashMap<>(); private int port; public RpcServer(int port) { this.port = port; } public RpcServer() { } public void register(Class interface0, Class impl){ registerService.put(interface0.getName(), impl); } public void start() throws IOException { ServerSocket serverSocket = new ServerSocket(this.port); try { while (true) { executor.execute(new ServerTask(serverSocket.accept())); } } finally { serverSocket.close(); } } public void stop() throws InterruptedException { executor.shutdown(); while (!executor.awaitTermination(10, TimeUnit.SECONDS)) ; } }
UTF-8
Java
1,248
java
RpcServer.java
Java
[ { "context": " java.util.concurrent.TimeUnit;\n\n/**\n * Created by zhugongyi on 2017/7/15.\n */\npublic class RpcServer {\n\n p", "end": 291, "score": 0.9994900822639465, "start": 282, "tag": "USERNAME", "value": "zhugongyi" } ]
null
[]
package rpc; import java.io.IOException; import java.net.ServerSocket; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; /** * Created by zhugongyi on 2017/7/15. */ public class RpcServer { private ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2); protected static Map<String, Class> registerService = new ConcurrentHashMap<>(); private int port; public RpcServer(int port) { this.port = port; } public RpcServer() { } public void register(Class interface0, Class impl){ registerService.put(interface0.getName(), impl); } public void start() throws IOException { ServerSocket serverSocket = new ServerSocket(this.port); try { while (true) { executor.execute(new ServerTask(serverSocket.accept())); } } finally { serverSocket.close(); } } public void stop() throws InterruptedException { executor.shutdown(); while (!executor.awaitTermination(10, TimeUnit.SECONDS)) ; } }
1,248
0.666667
0.657051
49
24.469387
25.838669
116
false
false
0
0
0
0
0
0
0.44898
false
false
13
043c5ab7a8cde1b26dcd5f6fdd35c3f2beb417ee
36,893,769,086,911
43e744ba2a19763e87be750621c02e717313f820
/src/main/java/com/mt/sx/service/impl/SxCategoryServiceImpl.java
77572df6e8966e9260522be32de27e62f8ffe80b
[]
no_license
ftk112233/sx-
https://github.com/ftk112233/sx-
360505b5938efa383700c15cfe6b238c94c9622c
fc7e70b2264b7e57a2f62374ea851c6fa74b07a8
refs/heads/master
2022-07-02T21:50:18.823000
2019-12-28T06:45:27
2019-12-28T06:45:27
227,544,727
0
0
null
false
2022-06-21T02:25:52
2019-12-12T07:19:23
2019-12-28T06:45:56
2022-06-21T02:25:49
341
0
0
3
Java
false
false
package com.mt.sx.service.impl; import com.mt.sx.mapper.SxCategoryMapper; import com.mt.sx.pojo.SxCategory; import com.mt.sx.service.SxCategoryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; import java.util.List; @Service public class SxCategoryServiceImpl implements SxCategoryService { @Autowired SxCategoryMapper sxCategoryMapper; /** * 查询所有分类 * * @return */ @Override public List<SxCategory> list() { return sxCategoryMapper.selectAll(); } /** * 插入分类 * * @param sxCategory * @return */ @Override public Integer insertCategory(SxCategory sxCategory) { Date date = new Date(); sxCategory.setCreateTime(date); sxCategory.setUpdateTime(date); return sxCategoryMapper.insertSelective(sxCategory); } /** * 更新分类 * * @param sxCategory * @return */ @Override public Integer updateCategory(SxCategory sxCategory) { sxCategory.setUpdateTime(new Date()); return sxCategoryMapper.updateByPrimaryKeySelective(sxCategory); } /** * 删除分类 * * @param id * @return */ @Override public Integer deleteCategory(Integer id) { return sxCategoryMapper.deleteByPrimaryKey(id); } /** * 根据id查询分类 * @param id * @return */ @Override public SxCategory findById(Integer id) { return sxCategoryMapper.selectByPrimaryKey(id); } /** * 批量删除 * @param ids */ @Override public void batchDelete(List<Integer> ids) { sxCategoryMapper.deleteByIdList(ids); } }
UTF-8
Java
1,797
java
SxCategoryServiceImpl.java
Java
[]
null
[]
package com.mt.sx.service.impl; import com.mt.sx.mapper.SxCategoryMapper; import com.mt.sx.pojo.SxCategory; import com.mt.sx.service.SxCategoryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; import java.util.List; @Service public class SxCategoryServiceImpl implements SxCategoryService { @Autowired SxCategoryMapper sxCategoryMapper; /** * 查询所有分类 * * @return */ @Override public List<SxCategory> list() { return sxCategoryMapper.selectAll(); } /** * 插入分类 * * @param sxCategory * @return */ @Override public Integer insertCategory(SxCategory sxCategory) { Date date = new Date(); sxCategory.setCreateTime(date); sxCategory.setUpdateTime(date); return sxCategoryMapper.insertSelective(sxCategory); } /** * 更新分类 * * @param sxCategory * @return */ @Override public Integer updateCategory(SxCategory sxCategory) { sxCategory.setUpdateTime(new Date()); return sxCategoryMapper.updateByPrimaryKeySelective(sxCategory); } /** * 删除分类 * * @param id * @return */ @Override public Integer deleteCategory(Integer id) { return sxCategoryMapper.deleteByPrimaryKey(id); } /** * 根据id查询分类 * @param id * @return */ @Override public SxCategory findById(Integer id) { return sxCategoryMapper.selectByPrimaryKey(id); } /** * 批量删除 * @param ids */ @Override public void batchDelete(List<Integer> ids) { sxCategoryMapper.deleteByIdList(ids); } }
1,797
0.630672
0.630672
85
19.482353
19.118584
72
false
false
0
0
0
0
0
0
0.223529
false
false
13
5c57d8a23959410c65b8f059ad982a4a60439ede
36,610,301,255,062
875247c6fb09ee6dec3ad0d371d722566a18ac9e
/aula 9/diariaHotel/src/TelaDiaria.java
2bb65d7341665ff5d6fa682730a5bf665a7a53bf
[]
no_license
GabrielRossin/LPV
https://github.com/GabrielRossin/LPV
f9203a3cab42cb27b651144256238f41bced3b6b
5512bceb094f57ff5c8b932c31860a692bc5e10e
refs/heads/main
2023-04-03T00:58:05.728000
2021-04-15T23:03:38
2021-04-15T23:03:38
315,196,173
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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. */ /** * * @author gabri */ public class TelaDiaria extends javax.swing.JFrame { /** * Creates new form TelaDiaria */ public TelaDiaria() { initComponents(); lblTotal.setVisible(false); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); cxSimples = new javax.swing.JCheckBox(); cxLuxo = new javax.swing.JCheckBox(); btnCalcular = new javax.swing.JButton(); cxServicoSim = new javax.swing.JCheckBox(); jLabel2 = new javax.swing.JLabel(); lblTotal = new javax.swing.JLabel(); txtDiaria = new javax.swing.JSpinner(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); cxServicoNao = new javax.swing.JCheckBox(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setResizable(false); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel1.setText("DIARIAS"); cxSimples.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N cxSimples.setText("SIMPLES"); cxSimples.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cxSimplesActionPerformed(evt); } }); cxLuxo.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N cxLuxo.setText("LUXO"); cxLuxo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cxLuxoActionPerformed(evt); } }); btnCalcular.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N btnCalcular.setText("CALCULAR"); btnCalcular.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCalcularActionPerformed(evt); } }); cxServicoSim.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N cxServicoSim.setText("SIM"); cxServicoSim.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cxServicoSimActionPerformed(evt); } }); jLabel2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel2.setText("TOTAL"); lblTotal.setText("jLabel3"); txtDiaria.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel4.setText(" FLAT"); jLabel5.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel5.setText("SERVIÇO DE QUARTO"); cxServicoNao.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N cxServicoNao.setText("NÃO"); cxServicoNao.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cxServicoNaoActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel2) .addGap(66, 66, 66) .addComponent(lblTotal)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(layout.createSequentialGroup() .addGap(31, 31, 31) .addComponent(jLabel1) .addGap(66, 66, 66)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGap(55, 55, 55) .addComponent(cxSimples) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(txtDiaria, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cxLuxo, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(layout.createSequentialGroup() .addComponent(cxServicoSim) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cxServicoNao)) .addComponent(jLabel5)) .addGap(10, 10, 10))))) .addGroup(layout.createSequentialGroup() .addGap(96, 96, 96) .addComponent(btnCalcular))) .addGap(63, 63, 63)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(46, 46, 46) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtDiaria, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(22, 22, 22) .addComponent(jLabel4) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cxSimples) .addComponent(cxLuxo)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cxServicoSim) .addComponent(cxServicoNao)) .addGap(18, 18, 18) .addComponent(btnCalcular) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(lblTotal)) .addGap(48, 48, 48)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void cxSimplesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cxSimplesActionPerformed cxLuxo.setSelected(false); }//GEN-LAST:event_cxSimplesActionPerformed private void cxLuxoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cxLuxoActionPerformed // TODO add your handling code here: cxSimples.setSelected(false); }//GEN-LAST:event_cxLuxoActionPerformed private void cxServicoSimActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cxServicoSimActionPerformed // TODO add your handling code here: cxServicoNao.setSelected(false); }//GEN-LAST:event_cxServicoSimActionPerformed private void cxServicoNaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cxServicoNaoActionPerformed // TODO add your handling code here: cxServicoSim.setSelected(false); }//GEN-LAST:event_cxServicoNaoActionPerformed private void btnCalcularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCalcularActionPerformed // TODO add your handling code here: int diaria = Integer.parseInt(txtDiaria.getValue().toString()); int flat = 0; int addServico = 0; int total; if(cxSimples.isSelected()) { flat = 120; } else { if(cxLuxo.isSelected()) { flat = 190; } } if(cxServicoSim.isSelected()) { addServico = 60; } total = (flat * diaria) + addServico; lblTotal.setText(Integer.toString(total)); lblTotal.setVisible(true); }//GEN-LAST:event_btnCalcularActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(TelaDiaria.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(TelaDiaria.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(TelaDiaria.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(TelaDiaria.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TelaDiaria().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCalcular; private javax.swing.JCheckBox cxLuxo; private javax.swing.JCheckBox cxServicoNao; private javax.swing.JCheckBox cxServicoSim; private javax.swing.JCheckBox cxSimples; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel lblTotal; private javax.swing.JSpinner txtDiaria; // End of variables declaration//GEN-END:variables }
UTF-8
Java
12,934
java
TelaDiaria.java
Java
[ { "context": "the template in the editor.\n */\n\n/**\n *\n * @author gabri\n */\npublic class TelaDiaria extends javax.swing.J", "end": 209, "score": 0.9978023171424866, "start": 204, "tag": "USERNAME", "value": "gabri" } ]
null
[]
/* * 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. */ /** * * @author gabri */ public class TelaDiaria extends javax.swing.JFrame { /** * Creates new form TelaDiaria */ public TelaDiaria() { initComponents(); lblTotal.setVisible(false); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); cxSimples = new javax.swing.JCheckBox(); cxLuxo = new javax.swing.JCheckBox(); btnCalcular = new javax.swing.JButton(); cxServicoSim = new javax.swing.JCheckBox(); jLabel2 = new javax.swing.JLabel(); lblTotal = new javax.swing.JLabel(); txtDiaria = new javax.swing.JSpinner(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); cxServicoNao = new javax.swing.JCheckBox(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setResizable(false); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel1.setText("DIARIAS"); cxSimples.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N cxSimples.setText("SIMPLES"); cxSimples.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cxSimplesActionPerformed(evt); } }); cxLuxo.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N cxLuxo.setText("LUXO"); cxLuxo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cxLuxoActionPerformed(evt); } }); btnCalcular.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N btnCalcular.setText("CALCULAR"); btnCalcular.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCalcularActionPerformed(evt); } }); cxServicoSim.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N cxServicoSim.setText("SIM"); cxServicoSim.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cxServicoSimActionPerformed(evt); } }); jLabel2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel2.setText("TOTAL"); lblTotal.setText("jLabel3"); txtDiaria.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel4.setText(" FLAT"); jLabel5.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel5.setText("SERVIÇO DE QUARTO"); cxServicoNao.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N cxServicoNao.setText("NÃO"); cxServicoNao.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cxServicoNaoActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel2) .addGap(66, 66, 66) .addComponent(lblTotal)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(layout.createSequentialGroup() .addGap(31, 31, 31) .addComponent(jLabel1) .addGap(66, 66, 66)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGap(55, 55, 55) .addComponent(cxSimples) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(txtDiaria, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cxLuxo, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(layout.createSequentialGroup() .addComponent(cxServicoSim) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cxServicoNao)) .addComponent(jLabel5)) .addGap(10, 10, 10))))) .addGroup(layout.createSequentialGroup() .addGap(96, 96, 96) .addComponent(btnCalcular))) .addGap(63, 63, 63)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(46, 46, 46) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtDiaria, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(22, 22, 22) .addComponent(jLabel4) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cxSimples) .addComponent(cxLuxo)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cxServicoSim) .addComponent(cxServicoNao)) .addGap(18, 18, 18) .addComponent(btnCalcular) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(lblTotal)) .addGap(48, 48, 48)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void cxSimplesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cxSimplesActionPerformed cxLuxo.setSelected(false); }//GEN-LAST:event_cxSimplesActionPerformed private void cxLuxoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cxLuxoActionPerformed // TODO add your handling code here: cxSimples.setSelected(false); }//GEN-LAST:event_cxLuxoActionPerformed private void cxServicoSimActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cxServicoSimActionPerformed // TODO add your handling code here: cxServicoNao.setSelected(false); }//GEN-LAST:event_cxServicoSimActionPerformed private void cxServicoNaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cxServicoNaoActionPerformed // TODO add your handling code here: cxServicoSim.setSelected(false); }//GEN-LAST:event_cxServicoNaoActionPerformed private void btnCalcularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCalcularActionPerformed // TODO add your handling code here: int diaria = Integer.parseInt(txtDiaria.getValue().toString()); int flat = 0; int addServico = 0; int total; if(cxSimples.isSelected()) { flat = 120; } else { if(cxLuxo.isSelected()) { flat = 190; } } if(cxServicoSim.isSelected()) { addServico = 60; } total = (flat * diaria) + addServico; lblTotal.setText(Integer.toString(total)); lblTotal.setVisible(true); }//GEN-LAST:event_btnCalcularActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(TelaDiaria.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(TelaDiaria.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(TelaDiaria.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(TelaDiaria.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TelaDiaria().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCalcular; private javax.swing.JCheckBox cxLuxo; private javax.swing.JCheckBox cxServicoNao; private javax.swing.JCheckBox cxServicoSim; private javax.swing.JCheckBox cxSimples; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel lblTotal; private javax.swing.JSpinner txtDiaria; // End of variables declaration//GEN-END:variables }
12,934
0.603232
0.5897
269
47.074348
36.564274
169
false
false
0
0
0
0
0
0
0.628253
false
false
13
0fe21691480583e6ef26ca1e75bd3c089ed79da6
36,910,948,961,026
759d7a8eb6f6297528428979a51d1a6840fce27f
/PersonDAOAPP/src/com/service/ServiceTestGetPhDeatils.java
d704f111d81e87f79c2c8a893f0b6c24b6f32c11
[]
no_license
rpolu/JDBC
https://github.com/rpolu/JDBC
b0d944d485bcc6159690b3f076c2c383167fb9d1
4eb9c4a57dfc45721408126d0f57a28dc9f77b86
refs/heads/master
2021-03-08T00:49:45.039000
2020-07-02T03:14:23
2020-07-02T03:14:23
246,307,400
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.service; import java.util.List; import com.person.dao.PersonDao; import com.person.model.PersonModel; public class ServiceTestGetPhDeatils { public static void main(String[] args) throws Exception { PersonDao personDao = new PersonDao(); List<PersonModel> pl = personDao.getAllPersons(); for (PersonModel pm : pl) { System.out.println(pm.getPhno()); System.out.println(pm.getFirstName()); System.out.println(pm.getLastName()); System.out.println(pm.getEmail()); System.out.println(pm.getAddress()); System.out.println("________________________-"); } } }
UTF-8
Java
605
java
ServiceTestGetPhDeatils.java
Java
[]
null
[]
package com.service; import java.util.List; import com.person.dao.PersonDao; import com.person.model.PersonModel; public class ServiceTestGetPhDeatils { public static void main(String[] args) throws Exception { PersonDao personDao = new PersonDao(); List<PersonModel> pl = personDao.getAllPersons(); for (PersonModel pm : pl) { System.out.println(pm.getPhno()); System.out.println(pm.getFirstName()); System.out.println(pm.getLastName()); System.out.println(pm.getEmail()); System.out.println(pm.getAddress()); System.out.println("________________________-"); } } }
605
0.682645
0.682645
26
22.26923
19.856325
58
false
false
0
0
0
0
0
0
1.653846
false
false
13
0afe8fa2db47be6586ac020fde45de39f77c8b3a
22,368,189,702,878
b1d5a96789ce8edaa11afa9ea75625124507c268
/integrates/wechat/src/main/java/com/acmedcare/framework/applet/integrate/wechat/support/mp/bean/card/Abstract.java
db019c9f5abeac66f94f15361d900ddab215d54f
[ "MIT" ]
permissive
maliro/Acmedcare-Applets
https://github.com/maliro/Acmedcare-Applets
10ac6240de6335de1216b1932aade10702eef86c
e13e6df3f6dd60156b0114e1886ff6d9f289c525
refs/heads/master
2022-03-25T13:13:14.572000
2019-11-24T13:19:35
2019-11-24T13:19:35
292,529,759
0
1
null
true
2020-09-03T09:49:13
2020-09-03T09:49:13
2020-09-03T09:49:09
2019-11-24T13:19:36
12,069
0
0
0
null
false
false
package com.acmedcare.framework.applet.integrate.wechat.support.mp.bean.card; import com.acmedcare.framework.applet.integrate.wechat.support.mp.util.json.WxMpGsonBuilder; import com.google.gson.annotations.SerializedName; import lombok.Data; import java.io.Serializable; /** * 封面摘要. * * @author <a href="mailto:iskp.me@gmail.com">Elve.Xu</a> * @version ${project.version} */ @Data public class Abstract implements Serializable { private static final long serialVersionUID = -2612656133201770573L; /** 摘要. */ @SerializedName("abstract") private String abstractInfo; /** 封面图片列表. 仅支持填入一 个封面图片链接, 上传图片接口 上传获取图片获得链接,填写 非CDN链接会报错,并在此填入。 建议图片尺寸像素850*350 */ @SerializedName("icon_url_list") private String iconUrlList; @Override public String toString() { return WxMpGsonBuilder.create().toJson(this); } }
UTF-8
Java
965
java
Abstract.java
Java
[ { "context": "able;\n\n/**\n * 封面摘要.\n *\n * @author <a href=\"mailto:iskp.me@gmail.com\">Elve.Xu</a>\n * @version ${project.version}\n */\n@", "end": 334, "score": 0.9998689889907837, "start": 317, "tag": "EMAIL", "value": "iskp.me@gmail.com" }, { "context": "\n *\n * @author <a hre...
null
[]
package com.acmedcare.framework.applet.integrate.wechat.support.mp.bean.card; import com.acmedcare.framework.applet.integrate.wechat.support.mp.util.json.WxMpGsonBuilder; import com.google.gson.annotations.SerializedName; import lombok.Data; import java.io.Serializable; /** * 封面摘要. * * @author <a href="mailto:<EMAIL>">Elve.Xu</a> * @version ${project.version} */ @Data public class Abstract implements Serializable { private static final long serialVersionUID = -2612656133201770573L; /** 摘要. */ @SerializedName("abstract") private String abstractInfo; /** 封面图片列表. 仅支持填入一 个封面图片链接, 上传图片接口 上传获取图片获得链接,填写 非CDN链接会报错,并在此填入。 建议图片尺寸像素850*350 */ @SerializedName("icon_url_list") private String iconUrlList; @Override public String toString() { return WxMpGsonBuilder.create().toJson(this); } }
955
0.7491
0.719088
31
25.870968
27.305609
92
false
false
0
0
0
0
0
0
0.290323
false
false
13
0a3e13a74887261375b14bacf73271620a972772
16,587,163,767,052
a9a9f1506e26eca46af8adb87452de422d923cd6
/Java Web/Spring Fundamentals/Exam preps/2020 August - Gira/src/main/java/exams/gira/service/impl/TaskServiceImpl.java
4e1b95c88a348bed09b08fab91b8f6f6400f7d3b
[]
no_license
NenoPanchev/MyRepository
https://github.com/NenoPanchev/MyRepository
22e0cc5ee4623ea5f987a40f6d419645330a288e
85286726da2ecfdb1468b0866f31f7118ef7875a
refs/heads/master
2023-05-29T09:45:20.397000
2023-04-17T11:15:19
2023-04-17T11:15:19
286,752,965
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package exams.gira.service.impl; import exams.gira.model.entity.Classification; import exams.gira.model.entity.Progress; import exams.gira.model.entity.Task; import exams.gira.model.entity.User; import exams.gira.model.service.ClassificationServiceModel; import exams.gira.model.service.TaskServiceModel; import exams.gira.model.service.UserServiceModel; import exams.gira.model.view.TaskViewModel; import exams.gira.repository.TaskRepository; import exams.gira.service.ClassificationService; import exams.gira.service.TaskService; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.transaction.Transactional; import java.util.List; import java.util.stream.Collectors; @Service public class TaskServiceImpl implements TaskService { private final TaskRepository taskRepository; private final ModelMapper modelMapper; private final ClassificationService classificationService; @Autowired public TaskServiceImpl(TaskRepository taskRepository, ModelMapper modelMapper, ClassificationService classificationService) { this.taskRepository = taskRepository; this.modelMapper = modelMapper; this.classificationService = classificationService; } @Override public void addTask(TaskServiceModel taskServiceModel, UserServiceModel userServiceModel) { Task task = this.modelMapper.map(taskServiceModel, Task.class); User user = this.modelMapper.map(userServiceModel, User.class); ClassificationServiceModel csm = this.classificationService.getClassificationByName(taskServiceModel.getClassification().getClassificationName()); Classification classification = this.modelMapper.map(csm, Classification.class); task.setUser(user); task.setClassification(classification); task.setProgress(Progress.OPEN); this.taskRepository.saveAndFlush(task); } @Override public List<TaskViewModel> getAllTasks() { return this.taskRepository.findAll() .stream() .map(task -> { TaskViewModel view = this.modelMapper.map(task, TaskViewModel.class); view.setAssignedTo(task.getUser().getUsername()); view.setClassificationName(task.getClassification().getClassificationName()); return view; }).collect(Collectors.toList()); } @Override public void progress(String id) { Task task = this.taskRepository.findById(id).orElse(null); switch (task.getProgress()) { case OPEN -> { task.setProgress(Progress.IN_PROGRESS); this.taskRepository.saveAndFlush(task); } case IN_PROGRESS -> { task.setProgress(Progress.COMPLETED); this.taskRepository.saveAndFlush(task); } case COMPLETED -> { this.taskRepository.delete(task); } case OTHER -> { } } } }
UTF-8
Java
3,103
java
TaskServiceImpl.java
Java
[]
null
[]
package exams.gira.service.impl; import exams.gira.model.entity.Classification; import exams.gira.model.entity.Progress; import exams.gira.model.entity.Task; import exams.gira.model.entity.User; import exams.gira.model.service.ClassificationServiceModel; import exams.gira.model.service.TaskServiceModel; import exams.gira.model.service.UserServiceModel; import exams.gira.model.view.TaskViewModel; import exams.gira.repository.TaskRepository; import exams.gira.service.ClassificationService; import exams.gira.service.TaskService; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.transaction.Transactional; import java.util.List; import java.util.stream.Collectors; @Service public class TaskServiceImpl implements TaskService { private final TaskRepository taskRepository; private final ModelMapper modelMapper; private final ClassificationService classificationService; @Autowired public TaskServiceImpl(TaskRepository taskRepository, ModelMapper modelMapper, ClassificationService classificationService) { this.taskRepository = taskRepository; this.modelMapper = modelMapper; this.classificationService = classificationService; } @Override public void addTask(TaskServiceModel taskServiceModel, UserServiceModel userServiceModel) { Task task = this.modelMapper.map(taskServiceModel, Task.class); User user = this.modelMapper.map(userServiceModel, User.class); ClassificationServiceModel csm = this.classificationService.getClassificationByName(taskServiceModel.getClassification().getClassificationName()); Classification classification = this.modelMapper.map(csm, Classification.class); task.setUser(user); task.setClassification(classification); task.setProgress(Progress.OPEN); this.taskRepository.saveAndFlush(task); } @Override public List<TaskViewModel> getAllTasks() { return this.taskRepository.findAll() .stream() .map(task -> { TaskViewModel view = this.modelMapper.map(task, TaskViewModel.class); view.setAssignedTo(task.getUser().getUsername()); view.setClassificationName(task.getClassification().getClassificationName()); return view; }).collect(Collectors.toList()); } @Override public void progress(String id) { Task task = this.taskRepository.findById(id).orElse(null); switch (task.getProgress()) { case OPEN -> { task.setProgress(Progress.IN_PROGRESS); this.taskRepository.saveAndFlush(task); } case IN_PROGRESS -> { task.setProgress(Progress.COMPLETED); this.taskRepository.saveAndFlush(task); } case COMPLETED -> { this.taskRepository.delete(task); } case OTHER -> { } } } }
3,103
0.695778
0.695778
80
37.787498
29.259483
154
false
false
0
0
0
0
0
0
0.625
false
false
13
067718cdb0b50487f51fb5c1dcc768a6315e1cc9
1,194,000,913,870
e4e3064472978e5595f49cf4f2ed404a94360be8
/shanpai/app/src/main/java/com/jzkj/shanpai/util/RetrofitUtil.java
df876be70bce57a7c16a442c045dae22e15736d7
[]
no_license
huangyi59/shanpai
https://github.com/huangyi59/shanpai
fdb19fe62a4e9f31a9036aaac91190add5003be4
db82b915cbd137ab182ed06b679fe4b4088bd739
refs/heads/master
2021-08-27T22:45:19.324000
2021-08-05T06:14:08
2021-08-05T06:14:08
181,849,095
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jzkj.shanpai.util; import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import okhttp3.OkHttpClient; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; public class RetrofitUtil { public static Retrofit retrofit = new Retrofit .Builder() .baseUrl("") .client(new OkHttpClient()) .addConverterFactory(GsonConverterFactory.create()) //.addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .build(); }
UTF-8
Java
550
java
RetrofitUtil.java
Java
[ { "context": "package com.jzkj.shanpai.util;\n\nimport com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapte", "end": 48, "score": 0.5145710706710815, "start": 46, "tag": "USERNAME", "value": "ew" }, { "context": "package com.jzkj.shanpai.util;\n\nimport com.jakewharton.retrofi...
null
[]
package com.jzkj.shanpai.util; import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import okhttp3.OkHttpClient; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; public class RetrofitUtil { public static Retrofit retrofit = new Retrofit .Builder() .baseUrl("") .client(new OkHttpClient()) .addConverterFactory(GsonConverterFactory.create()) //.addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .build(); }
550
0.705455
0.692727
19
27.947369
24.450754
75
false
false
0
0
0
0
0
0
0.315789
false
false
13
5e5cf44f73658a1b1fdc932ba9219304a28910ed
5,669,356,875,315
24bd011155e49ee241984f2c38e034e1817fe110
/src/main/java/br/com/unesp/controller/VlanController.java
9e5af5a12fef7526d6d8ba7a7e9cfa689fc0f05d
[]
no_license
adrianoavelino/redeUnesp
https://github.com/adrianoavelino/redeUnesp
f7e22ed4815cd80d38399725cfab6b746b4afb91
a2a252afff0e0f2e12e8ba2a8b34865fc696208f
refs/heads/master
2020-03-22T13:11:59.533000
2018-10-31T00:25:04
2018-10-31T00:25:04
140,090,502
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.unesp.controller; import br.com.unesp.dao.VlanDao; import br.com.unesp.jsf.message.FacesMessages; import br.com.unesp.model.Vlan; import java.util.List; import javax.enterprise.context.RequestScoped; import javax.faces.event.ActionEvent; import javax.inject.Inject; import javax.inject.Named; @Named @RequestScoped public class VlanController { @Inject private VlanDao vlanDao; @Inject private FacesMessages message; private Vlan vlan = new Vlan(); private List<Vlan> listaDeIpsDaVlanSelecionada; public VlanController() { } public VlanDao getVlanDao() { return vlanDao; } public void setVlanDao(VlanDao vlanDao) { this.vlanDao = vlanDao; } public Vlan getVlan() { return vlan; } public void setVlan(Vlan vlan) { this.vlan = vlan; } public List<Vlan> getListaDeIpsDaVlanSelecionada() { return listaDeIpsDaVlanSelecionada; } public void setListaDeIpsDaVlanSelecionada(List<Vlan> listaDeIpsDaVlanSelecionada) { this.listaDeIpsDaVlanSelecionada = listaDeIpsDaVlanSelecionada; } public void salvar() { if (vlan.getId() == null) { if (this.validar()) { vlanDao.salvar(this.vlan); vlan = new Vlan(); message.info("Cadastro realizado com sucesso!"); } } else { if (this.validar()) { try { vlanDao.atualizar(this.vlan); this.vlan = new Vlan(); message.info("Alterado com sucesso!"); } catch (Exception ex) { message.error("Erro ao alterar Vlan"); } } } } public void deletar(ActionEvent evento) { vlan = (Vlan) evento.getComponent().getAttributes().get("vlanSelecionada"); try { if (this.vlanDao.isVlanEmUso(vlan.getId())) { message.error("Vlan em uso. Remova a vlan \"" + vlan.getDescricao() + "\" das subredes e dos IPV6s"); vlan = new Vlan(); return; } vlanDao.deletar(vlan); message.info("Vlan deletada com sucesso!"); } catch (Exception ex) { message.error("Erro ao deletar vlan"); } } public void editar(ActionEvent evento) { vlan = (Vlan) evento.getComponent().getAttributes().get("vlanSelecionada"); } public boolean validar() { boolean temErro = true; if (vlanDao.isNumeroDuplicado(vlan)) { message.error("O número da Vlan já está cadastrado na rede " + vlan.getGrupoRede().getNome()); temErro = false; } if (vlanDao.isDescricaoDuplicada(vlan)) { message.error("A descrição já está sendo usada na rede " + vlan.getGrupoRede().getNome()); temErro = false; } return temErro; } }
UTF-8
Java
2,969
java
VlanController.java
Java
[]
null
[]
package br.com.unesp.controller; import br.com.unesp.dao.VlanDao; import br.com.unesp.jsf.message.FacesMessages; import br.com.unesp.model.Vlan; import java.util.List; import javax.enterprise.context.RequestScoped; import javax.faces.event.ActionEvent; import javax.inject.Inject; import javax.inject.Named; @Named @RequestScoped public class VlanController { @Inject private VlanDao vlanDao; @Inject private FacesMessages message; private Vlan vlan = new Vlan(); private List<Vlan> listaDeIpsDaVlanSelecionada; public VlanController() { } public VlanDao getVlanDao() { return vlanDao; } public void setVlanDao(VlanDao vlanDao) { this.vlanDao = vlanDao; } public Vlan getVlan() { return vlan; } public void setVlan(Vlan vlan) { this.vlan = vlan; } public List<Vlan> getListaDeIpsDaVlanSelecionada() { return listaDeIpsDaVlanSelecionada; } public void setListaDeIpsDaVlanSelecionada(List<Vlan> listaDeIpsDaVlanSelecionada) { this.listaDeIpsDaVlanSelecionada = listaDeIpsDaVlanSelecionada; } public void salvar() { if (vlan.getId() == null) { if (this.validar()) { vlanDao.salvar(this.vlan); vlan = new Vlan(); message.info("Cadastro realizado com sucesso!"); } } else { if (this.validar()) { try { vlanDao.atualizar(this.vlan); this.vlan = new Vlan(); message.info("Alterado com sucesso!"); } catch (Exception ex) { message.error("Erro ao alterar Vlan"); } } } } public void deletar(ActionEvent evento) { vlan = (Vlan) evento.getComponent().getAttributes().get("vlanSelecionada"); try { if (this.vlanDao.isVlanEmUso(vlan.getId())) { message.error("Vlan em uso. Remova a vlan \"" + vlan.getDescricao() + "\" das subredes e dos IPV6s"); vlan = new Vlan(); return; } vlanDao.deletar(vlan); message.info("Vlan deletada com sucesso!"); } catch (Exception ex) { message.error("Erro ao deletar vlan"); } } public void editar(ActionEvent evento) { vlan = (Vlan) evento.getComponent().getAttributes().get("vlanSelecionada"); } public boolean validar() { boolean temErro = true; if (vlanDao.isNumeroDuplicado(vlan)) { message.error("O número da Vlan já está cadastrado na rede " + vlan.getGrupoRede().getNome()); temErro = false; } if (vlanDao.isDescricaoDuplicada(vlan)) { message.error("A descrição já está sendo usada na rede " + vlan.getGrupoRede().getNome()); temErro = false; } return temErro; } }
2,969
0.581364
0.581026
104
27.48077
25.081015
117
false
false
0
0
0
0
0
0
0.384615
false
false
13
ab4ab28eae16eb47a3b33ffbfd59784c85642972
31,147,102,870,989
df003d007556a5dfc03a334eca5defac2db9daab
/src/EveryNthTest.java
87e4a51c597f7d0248ff0587ff0960343a5c2a32
[]
no_license
felipecook/CodingBat
https://github.com/felipecook/CodingBat
bd56fb9c479126e26c70e2069a78ad7986438bf0
6c206c9a36418a488136aee9a076470a101ed71c
refs/heads/master
2020-04-19T20:59:54.937000
2019-02-18T01:55:36
2019-02-18T01:55:36
168,429,700
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import static org.junit.Assert.*; import org.junit.Test; public class EveryNthTest { @Test public void everyNth() { EveryNth everyNthInstance = new EveryNth(); assertEquals("Mrce",everyNthInstance.everyNth("Miracle", 2)); assertEquals("aceg",everyNthInstance.everyNth("abcdefg", 2)); assertEquals("adg",everyNthInstance.everyNth("abcdefg", 3)); } }
UTF-8
Java
375
java
EveryNthTest.java
Java
[]
null
[]
import static org.junit.Assert.*; import org.junit.Test; public class EveryNthTest { @Test public void everyNth() { EveryNth everyNthInstance = new EveryNth(); assertEquals("Mrce",everyNthInstance.everyNth("Miracle", 2)); assertEquals("aceg",everyNthInstance.everyNth("abcdefg", 2)); assertEquals("adg",everyNthInstance.everyNth("abcdefg", 3)); } }
375
0.712
0.704
16
22.5
24.611988
65
false
false
0
0
0
0
0
0
0.75
false
false
13
55563984f9d88ae158d8ed372bb1d676c1b98826
19,370,302,538,523
fdf4bc293732f04c3bd3ceaccba357a738e3def7
/restservice/canteenmanagement/src/main/java/com/hexaware/MLP194/persistence/VendorDAO.java
0dab4321a8f6075312cff86f0cd73b4721764d71
[]
no_license
vidya987/mypracticemlpproject
https://github.com/vidya987/mypracticemlpproject
5b102a9b1f2cdd6b3822a98b9af0b834f4af273a
814f932cf36645bde429e408172dd491e558bbd5
refs/heads/master
2022-11-23T17:20:21.924000
2020-02-08T05:31:09
2020-02-08T05:31:09
239,077,237
0
0
null
false
2022-11-16T08:43:43
2020-02-08T05:51:44
2020-02-08T06:03:02
2022-11-16T08:43:41
5,151
0
0
4
Java
false
false
package com.hexaware.MLP194.persistence; import org.skife.jdbi.v2.sqlobject.Bind; import org.skife.jdbi.v2.sqlobject.SqlQuery; import org.skife.jdbi.v2.sqlobject.SqlUpdate; import org.skife.jdbi.v2.sqlobject.customizers.Mapper; import java.util.List; import com.hexaware.MLP194.model.Orders; import com.hexaware.MLP194.model.Vendor; /** * VendorDAO class used to fetch data from data base. * @author hexware */ public interface VendorDAO { /** * @return the all the Vendor record. */ @SqlQuery("Select * from Vendor") @Mapper(VendorMapper.class) List<Vendor> show(); /** <<<<<<< HEAD * @param spl for specialisation. * @param status for status. * @param vdrId for vendor status. * @return for vendor required details. */ @SqlUpdate("insert into Vendor(SPL,STATUS,VDR_ID)" + " VALUES (:spl,:status,:vdrId)") int insertVendor(@Bind("spl") String spl, @Bind("status") String status, @Bind("vdrId") int vdrId); /** * @param vdrId for vendor id. * @return to return deleted message ======= * @param spl to get specialisation. * @param status to get status. * @param vdrId to get vendor id. * @param phnNo to get phone number. * @param pswd to get password. * @return to return the data. */ @SqlUpdate("insert into Vendor(SPL,STATUS,VDR_ID,PHN_NO,PSWD)" + "VALUES (:spl,:status,:vdrId, :phnNo, :pswd)") // void insertBean(@BindBean Vendor users); int insertVendor(@Bind("spl") String spl, @Bind("status") String status, @Bind("vdrId") int vdrId, @Bind("phnNo") int phnNo, @Bind("pswd") String pswd); /** * @param vdrId to get the venodr id. * @return to return the data. >>>>>>> 6ac6f3059e7675166f4bea9d75ecb006658295f5 */ @SqlUpdate("delete from Vendor where VDR_ID= :vdrId") int deleteVendor(@Bind("vdrId") int vdrId); /** <<<<<<< HEAD * @param spl for specialisation. * @param vdrId for vendor id. * @return to return vendor updated details. ======= * @param spl to get specailisation * @param vdrId to get vendor id. * @return to return the data. >>>>>>> 6ac6f3059e7675166f4bea9d75ecb006658295f5 */ @SqlUpdate("Update Vendor set SPL = :spl where VDR_ID = :vdrId") int updateVendor(@Bind("spl") String spl, @Bind("vdrId") int vdrId); <<<<<<< HEAD ======= /** * @param vdrId to check vendor id. * @param pswd to check password. * @return to return validation result. */ @SqlQuery("select * from Customer where VDR_ID = :cusId and PSWD = :pswd") @Mapper(VendorMapper.class) Vendor validatingVendors(@Bind("vdrId") int vdrId, @Bind("pswd") String pswd); >>>>>>> 6ac6f3059e7675166f4bea9d75ecb006658295f5 }
UTF-8
Java
2,737
java
VendorDAO.java
Java
[ { "context": "lass used to fetch data from data base.\n * @author hexware\n */\npublic interface VendorDAO {\n /**\n * @", "end": 411, "score": 0.9996963739395142, "start": 404, "tag": "USERNAME", "value": "hexware" } ]
null
[]
package com.hexaware.MLP194.persistence; import org.skife.jdbi.v2.sqlobject.Bind; import org.skife.jdbi.v2.sqlobject.SqlQuery; import org.skife.jdbi.v2.sqlobject.SqlUpdate; import org.skife.jdbi.v2.sqlobject.customizers.Mapper; import java.util.List; import com.hexaware.MLP194.model.Orders; import com.hexaware.MLP194.model.Vendor; /** * VendorDAO class used to fetch data from data base. * @author hexware */ public interface VendorDAO { /** * @return the all the Vendor record. */ @SqlQuery("Select * from Vendor") @Mapper(VendorMapper.class) List<Vendor> show(); /** <<<<<<< HEAD * @param spl for specialisation. * @param status for status. * @param vdrId for vendor status. * @return for vendor required details. */ @SqlUpdate("insert into Vendor(SPL,STATUS,VDR_ID)" + " VALUES (:spl,:status,:vdrId)") int insertVendor(@Bind("spl") String spl, @Bind("status") String status, @Bind("vdrId") int vdrId); /** * @param vdrId for vendor id. * @return to return deleted message ======= * @param spl to get specialisation. * @param status to get status. * @param vdrId to get vendor id. * @param phnNo to get phone number. * @param pswd to get password. * @return to return the data. */ @SqlUpdate("insert into Vendor(SPL,STATUS,VDR_ID,PHN_NO,PSWD)" + "VALUES (:spl,:status,:vdrId, :phnNo, :pswd)") // void insertBean(@BindBean Vendor users); int insertVendor(@Bind("spl") String spl, @Bind("status") String status, @Bind("vdrId") int vdrId, @Bind("phnNo") int phnNo, @Bind("pswd") String pswd); /** * @param vdrId to get the venodr id. * @return to return the data. >>>>>>> 6ac6f3059e7675166f4bea9d75ecb006658295f5 */ @SqlUpdate("delete from Vendor where VDR_ID= :vdrId") int deleteVendor(@Bind("vdrId") int vdrId); /** <<<<<<< HEAD * @param spl for specialisation. * @param vdrId for vendor id. * @return to return vendor updated details. ======= * @param spl to get specailisation * @param vdrId to get vendor id. * @return to return the data. >>>>>>> 6ac6f3059e7675166f4bea9d75ecb006658295f5 */ @SqlUpdate("Update Vendor set SPL = :spl where VDR_ID = :vdrId") int updateVendor(@Bind("spl") String spl, @Bind("vdrId") int vdrId); <<<<<<< HEAD ======= /** * @param vdrId to check vendor id. * @param pswd to check password. * @return to return validation result. */ @SqlQuery("select * from Customer where VDR_ID = :cusId and PSWD = :pswd") @Mapper(VendorMapper.class) Vendor validatingVendors(@Bind("vdrId") int vdrId, @Bind("pswd") String pswd); >>>>>>> 6ac6f3059e7675166f4bea9d75ecb006658295f5 }
2,737
0.651078
0.616734
83
31.975904
25.105549
113
false
false
0
0
0
0
0
0
0.421687
false
false
13
1219f4ec0ca84ffa956cd9523eb35870f41c19fd
21,174,188,797,812
26f0a1ff300db705ac4e1c1bdb373e89f184179b
/java/Waban1/src/com/cardiodx/db/waban/view/AssociateTestView.java
c11c6f5ee75e745e54956a65b0047765d4dc5deb
[]
no_license
chialin668/cdx_docs
https://github.com/chialin668/cdx_docs
2e66e8c6cd15ed9b9e5553d9c9e310e637aa48f5
4fb956da067926f8e3c532f12af04d13579b85d1
refs/heads/master
2016-08-08T01:16:27.089000
2014-03-23T19:28:17
2014-03-23T19:28:17
18,041,610
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cardiodx.db.waban.view; // Generated Jul 14, 2011 1:33:54 PM by Hibernate Tools 3.4.0.CR1 /** * AssociateTestView generated by hbm2java */ public class AssociateTestView implements java.io.Serializable { private AssociateTestViewId id; public AssociateTestView() { } public AssociateTestView(AssociateTestViewId id) { this.id = id; } public AssociateTestViewId getId() { return this.id; } public void setId(AssociateTestViewId id) { this.id = id; } }
UTF-8
Java
488
java
AssociateTestView.java
Java
[]
null
[]
package com.cardiodx.db.waban.view; // Generated Jul 14, 2011 1:33:54 PM by Hibernate Tools 3.4.0.CR1 /** * AssociateTestView generated by hbm2java */ public class AssociateTestView implements java.io.Serializable { private AssociateTestViewId id; public AssociateTestView() { } public AssociateTestView(AssociateTestViewId id) { this.id = id; } public AssociateTestViewId getId() { return this.id; } public void setId(AssociateTestViewId id) { this.id = id; } }
488
0.731557
0.69877
27
17.074074
21.067661
65
false
false
0
0
0
0
0
0
0.777778
false
false
13
9938b36cb919273986111e0cdd0f9ae7029867e6
21,174,188,800,275
8b929caf6fb870bb482bf9caf02ad5c2b61ea8d6
/server/src/main/java/server/file/FileManager.java
bacc019c9fa960bd428e6cd93a6148d878b008c5
[]
no_license
tchn11/lab8
https://github.com/tchn11/lab8
250f333b3d8b06931ebd9acbdf3331bbb1644773
d0567d60535f00deb9aca0073b6653a0db3b9749
refs/heads/master
2023-05-09T23:36:47.296000
2021-05-31T20:32:14
2021-05-31T20:32:14
372,145,924
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package server.file; import com.google.gson.Gson; import com.google.gson.JsonParseException; import com.google.gson.reflect.TypeToken; import general.data.StudyGroup; import server.Main; import java.io.*; import java.lang.reflect.Type; import java.util.NoSuchElementException; import java.util.Stack; /** * Operates the main collection file for saving/loading. */ public class FileManager { private String path; /** * Constructor, just save variable for all class. * @param pth Path to collection file. */ public FileManager(String pth){ path = pth; } /** * Read collection from a file * @return Collection */ public Stack<StudyGroup> readFile() { if (path == null){ return new Stack<StudyGroup>(); } Gson gson; gson = new Gson(); Main.logger.info("Открываю фаил " + path); try { BufferedReader reader = new BufferedReader(new FileReader(path)); Stack<StudyGroup> bufferCollection; Type collectionType = new TypeToken<Stack<StudyGroup>>(){}.getType(); String json = reader.readLine(); if (json == null || json.equals("")){ return new Stack<StudyGroup>(); } bufferCollection = gson.fromJson(json.trim(), collectionType); Main.logger.info("Коллекция успешно загружна"); return bufferCollection; } catch (FileNotFoundException e) { Main.logger.error("Фаил не найден"); } catch (NoSuchElementException e){ Main.logger.error("Загрузочный фаил пуст"); } catch (JsonParseException e){ Main.logger.error("В файле другая коллекция"); } catch (IOException e) { Main.logger.error("Ошибка доступа к файлу"); } return new Stack<StudyGroup>(); } /** * Save collection to a file * @param st Collection */ public void saveCollection(Stack<StudyGroup> st){ if (path == null){ Main.logger.error("Нельзя сохранять"); return; } Gson gson = new Gson(); try{ FileWriter fileWriter = new FileWriter(new File(path)); String json = gson.toJson(st); fileWriter.write(json); Main.logger.info("Коллекция успешно сохранена"); fileWriter.close(); } catch (IOException e) { Main.logger.info("Фаил не найден"); } } }
UTF-8
Java
2,674
java
FileManager.java
Java
[]
null
[]
package server.file; import com.google.gson.Gson; import com.google.gson.JsonParseException; import com.google.gson.reflect.TypeToken; import general.data.StudyGroup; import server.Main; import java.io.*; import java.lang.reflect.Type; import java.util.NoSuchElementException; import java.util.Stack; /** * Operates the main collection file for saving/loading. */ public class FileManager { private String path; /** * Constructor, just save variable for all class. * @param pth Path to collection file. */ public FileManager(String pth){ path = pth; } /** * Read collection from a file * @return Collection */ public Stack<StudyGroup> readFile() { if (path == null){ return new Stack<StudyGroup>(); } Gson gson; gson = new Gson(); Main.logger.info("Открываю фаил " + path); try { BufferedReader reader = new BufferedReader(new FileReader(path)); Stack<StudyGroup> bufferCollection; Type collectionType = new TypeToken<Stack<StudyGroup>>(){}.getType(); String json = reader.readLine(); if (json == null || json.equals("")){ return new Stack<StudyGroup>(); } bufferCollection = gson.fromJson(json.trim(), collectionType); Main.logger.info("Коллекция успешно загружна"); return bufferCollection; } catch (FileNotFoundException e) { Main.logger.error("Фаил не найден"); } catch (NoSuchElementException e){ Main.logger.error("Загрузочный фаил пуст"); } catch (JsonParseException e){ Main.logger.error("В файле другая коллекция"); } catch (IOException e) { Main.logger.error("Ошибка доступа к файлу"); } return new Stack<StudyGroup>(); } /** * Save collection to a file * @param st Collection */ public void saveCollection(Stack<StudyGroup> st){ if (path == null){ Main.logger.error("Нельзя сохранять"); return; } Gson gson = new Gson(); try{ FileWriter fileWriter = new FileWriter(new File(path)); String json = gson.toJson(st); fileWriter.write(json); Main.logger.info("Коллекция успешно сохранена"); fileWriter.close(); } catch (IOException e) { Main.logger.info("Фаил не найден"); } } }
2,674
0.586481
0.586481
84
28.940475
20.57527
81
false
false
0
0
0
0
0
0
0.5
false
false
13
9452cd0d6e64dad4b273a99c2e0ad76327e0c761
4,423,816,331,758
38cb01b8eb8137bde5645f470009639f262c80b8
/src/com/wuyong/service/CategoryService.java
4cfa44cefcc950e6dc986782633a53eec4303a46
[]
no_license
MyLovertxy/wuyong_blog
https://github.com/MyLovertxy/wuyong_blog
a1229d119755ef9a7b81795aaffb260026f20069
1f66df7ca05cd0e47521da3c033c4903cfdf3b06
refs/heads/master
2021-01-08T01:01:06.132000
2020-02-20T11:18:50
2020-02-20T11:18:50
241,861,020
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wuyong.service; import com.wuyong.domain.Category; import java.util.List; public interface CategoryService { //保存分类 public void save(Category category); //获取所有分类的业务信息 List<Category> getAllCategory(); //根据id查询分类 Category getOneCategory(Integer cid); //修改分类 void update(Category category); //删除分类 void delete(Category category); }
UTF-8
Java
442
java
CategoryService.java
Java
[]
null
[]
package com.wuyong.service; import com.wuyong.domain.Category; import java.util.List; public interface CategoryService { //保存分类 public void save(Category category); //获取所有分类的业务信息 List<Category> getAllCategory(); //根据id查询分类 Category getOneCategory(Integer cid); //修改分类 void update(Category category); //删除分类 void delete(Category category); }
442
0.705729
0.705729
18
20.333334
14.712051
41
false
false
0
0
0
0
0
0
0.444444
false
false
13
415066581f8168cb615a161095b4ad6325724478
29,575,144,810,791
0743d17db4a584765b1337568a13ac9a2776bd54
/projects/OG-Financial/src/com/opengamma/financial/security/option/GapPayoffStyle.java
3d98276396ec1d355960645efd32878bd8fe4706
[ "Apache-2.0" ]
permissive
sparks1372/OG-Platform
https://github.com/sparks1372/OG-Platform
1d4beb95112fa1007125805d9b742eeb47d0f82b
2b8837331024c1acdda1595f91fd76b057af9277
refs/heads/master
2020-12-25T10:34:50.252000
2011-08-17T18:02:09
2011-08-17T18:02:26
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Automatically created - do not modify ///CLOVER:OFF // CSOFF: Generated File package com.opengamma.financial.security.option; public class GapPayoffStyle extends com.opengamma.financial.security.option.PayoffStyle implements java.io.Serializable { public <T> T accept (PayoffStyleVisitor<T> visitor) { return visitor.visitGapPayoffStyle(this); } private static final long serialVersionUID = -25713078708l; private final double _payment; public static final String PAYMENT_KEY = "payment"; public GapPayoffStyle (double payment) { _payment = payment; } protected GapPayoffStyle (final org.fudgemsg.mapping.FudgeDeserializer deserializer, final org.fudgemsg.FudgeMsg fudgeMsg) { super (deserializer, fudgeMsg); org.fudgemsg.FudgeField fudgeField; fudgeField = fudgeMsg.getByName (PAYMENT_KEY); if (fudgeField == null) throw new IllegalArgumentException ("Fudge message is not a GapPayoffStyle - field 'payment' is not present"); try { _payment = fudgeMsg.getFieldValue (Double.class, fudgeField); } catch (IllegalArgumentException e) { throw new IllegalArgumentException ("Fudge message is not a GapPayoffStyle - field 'payment' is not double", e); } } protected GapPayoffStyle (final GapPayoffStyle source) { super (source); if (source == null) throw new NullPointerException ("'source' must not be null"); _payment = source._payment; } public org.fudgemsg.FudgeMsg toFudgeMsg (final org.fudgemsg.mapping.FudgeSerializer serializer) { if (serializer == null) throw new NullPointerException ("serializer must not be null"); final org.fudgemsg.MutableFudgeMsg msg = serializer.newMessage (); toFudgeMsg (serializer, msg); return msg; } public void toFudgeMsg (final org.fudgemsg.mapping.FudgeSerializer serializer, final org.fudgemsg.MutableFudgeMsg msg) { super.toFudgeMsg (serializer, msg); msg.add (PAYMENT_KEY, null, _payment); } public static GapPayoffStyle fromFudgeMsg (final org.fudgemsg.mapping.FudgeDeserializer deserializer, final org.fudgemsg.FudgeMsg fudgeMsg) { final java.util.List<org.fudgemsg.FudgeField> types = fudgeMsg.getAllByOrdinal (0); for (org.fudgemsg.FudgeField field : types) { final String className = (String)field.getValue (); if ("com.opengamma.financial.security.option.GapPayoffStyle".equals (className)) break; try { return (com.opengamma.financial.security.option.GapPayoffStyle)Class.forName (className).getDeclaredMethod ("fromFudgeMsg", org.fudgemsg.mapping.FudgeDeserializer.class, org.fudgemsg.FudgeMsg.class).invoke (null, deserializer, fudgeMsg); } catch (Throwable t) { // no-action } } return new GapPayoffStyle (deserializer, fudgeMsg); } public double getPayment () { return _payment; } public boolean equals (final Object o) { if (o == this) return true; if (!(o instanceof GapPayoffStyle)) return false; GapPayoffStyle msg = (GapPayoffStyle)o; if (_payment != msg._payment) return false; return super.equals (msg); } public int hashCode () { int hc = super.hashCode (); hc = (hc * 31) + (int)_payment; return hc; } public String toString () { return org.apache.commons.lang.builder.ToStringBuilder.reflectionToString(this, org.apache.commons.lang.builder.ToStringStyle.SHORT_PREFIX_STYLE); } } ///CLOVER:ON // CSON: Generated File
UTF-8
Java
3,420
java
GapPayoffStyle.java
Java
[ { "context": "ment;\n public static final String PAYMENT_KEY = \"payment\";\n public GapPayoffStyle (double payment) {\n ", "end": 497, "score": 0.9941036105155945, "start": 490, "tag": "KEY", "value": "payment" } ]
null
[]
// Automatically created - do not modify ///CLOVER:OFF // CSOFF: Generated File package com.opengamma.financial.security.option; public class GapPayoffStyle extends com.opengamma.financial.security.option.PayoffStyle implements java.io.Serializable { public <T> T accept (PayoffStyleVisitor<T> visitor) { return visitor.visitGapPayoffStyle(this); } private static final long serialVersionUID = -25713078708l; private final double _payment; public static final String PAYMENT_KEY = "payment"; public GapPayoffStyle (double payment) { _payment = payment; } protected GapPayoffStyle (final org.fudgemsg.mapping.FudgeDeserializer deserializer, final org.fudgemsg.FudgeMsg fudgeMsg) { super (deserializer, fudgeMsg); org.fudgemsg.FudgeField fudgeField; fudgeField = fudgeMsg.getByName (PAYMENT_KEY); if (fudgeField == null) throw new IllegalArgumentException ("Fudge message is not a GapPayoffStyle - field 'payment' is not present"); try { _payment = fudgeMsg.getFieldValue (Double.class, fudgeField); } catch (IllegalArgumentException e) { throw new IllegalArgumentException ("Fudge message is not a GapPayoffStyle - field 'payment' is not double", e); } } protected GapPayoffStyle (final GapPayoffStyle source) { super (source); if (source == null) throw new NullPointerException ("'source' must not be null"); _payment = source._payment; } public org.fudgemsg.FudgeMsg toFudgeMsg (final org.fudgemsg.mapping.FudgeSerializer serializer) { if (serializer == null) throw new NullPointerException ("serializer must not be null"); final org.fudgemsg.MutableFudgeMsg msg = serializer.newMessage (); toFudgeMsg (serializer, msg); return msg; } public void toFudgeMsg (final org.fudgemsg.mapping.FudgeSerializer serializer, final org.fudgemsg.MutableFudgeMsg msg) { super.toFudgeMsg (serializer, msg); msg.add (PAYMENT_KEY, null, _payment); } public static GapPayoffStyle fromFudgeMsg (final org.fudgemsg.mapping.FudgeDeserializer deserializer, final org.fudgemsg.FudgeMsg fudgeMsg) { final java.util.List<org.fudgemsg.FudgeField> types = fudgeMsg.getAllByOrdinal (0); for (org.fudgemsg.FudgeField field : types) { final String className = (String)field.getValue (); if ("com.opengamma.financial.security.option.GapPayoffStyle".equals (className)) break; try { return (com.opengamma.financial.security.option.GapPayoffStyle)Class.forName (className).getDeclaredMethod ("fromFudgeMsg", org.fudgemsg.mapping.FudgeDeserializer.class, org.fudgemsg.FudgeMsg.class).invoke (null, deserializer, fudgeMsg); } catch (Throwable t) { // no-action } } return new GapPayoffStyle (deserializer, fudgeMsg); } public double getPayment () { return _payment; } public boolean equals (final Object o) { if (o == this) return true; if (!(o instanceof GapPayoffStyle)) return false; GapPayoffStyle msg = (GapPayoffStyle)o; if (_payment != msg._payment) return false; return super.equals (msg); } public int hashCode () { int hc = super.hashCode (); hc = (hc * 31) + (int)_payment; return hc; } public String toString () { return org.apache.commons.lang.builder.ToStringBuilder.reflectionToString(this, org.apache.commons.lang.builder.ToStringStyle.SHORT_PREFIX_STYLE); } } ///CLOVER:ON // CSON: Generated File
3,420
0.726023
0.72193
74
45.216217
44.734432
245
false
false
0
0
0
0
0
0
0.702703
false
false
13