hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
list
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
list
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
list
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
3e03aa68c3f3c13009c9375e1a3f76cd69d6a45f
1,602
java
Java
TCP_CLIENT_BANQUE/src/presentation/ListerAgences.java
ehbc221/esp-dic2-sonko-projet-srm-banque
ab0aaa4639991c3bff204a954f5d789d281e7229
[ "MIT" ]
null
null
null
TCP_CLIENT_BANQUE/src/presentation/ListerAgences.java
ehbc221/esp-dic2-sonko-projet-srm-banque
ab0aaa4639991c3bff204a954f5d789d281e7229
[ "MIT" ]
null
null
null
TCP_CLIENT_BANQUE/src/presentation/ListerAgences.java
ehbc221/esp-dic2-sonko-projet-srm-banque
ab0aaa4639991c3bff204a954f5d789d281e7229
[ "MIT" ]
null
null
null
25.03125
70
0.696005
1,512
package presentation; import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.table.DefaultTableModel; import entities.*; public class ListerAgences extends JFrame implements ActionListener { private ArrayList<Agence> listeAgences; private JButton bQuitter; private JPanel panel1 ,panel2; private JScrollPane sc; private JTable table; public ListerAgences(ArrayList <Agence> listeAgences) { panel1 = new JPanel(); panel2 = new JPanel(); bQuitter = new JButton("Quitter"); sc = new JScrollPane(); table = new JTable(); sc.setViewportView(table); this.listeAgences = listeAgences; DefaultTableModel modele = (DefaultTableModel)table.getModel(); modele.addColumn("Numero Agence"); modele.addColumn("Nom Agence"); modele.addColumn("Adresse Agence"); int ligne = 0; for (Agence agence : listeAgences) { modele.addRow(new Object[0]); modele.setValueAt(String.valueOf(agence.getNumero()), ligne, 0); modele.setValueAt(agence.getNom(), ligne, 1); modele.setValueAt(agence.getAdresse(), ligne, 2); ligne++; } bQuitter.addActionListener(this); panel1.add(sc); panel2.add(bQuitter); add(panel1,BorderLayout.NORTH); add(panel2,BorderLayout.SOUTH); setTitle("Liste Agences"); setSize(550, 500); setResizable(false); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public void actionPerformed(ActionEvent e) { if (e.getSource() == bQuitter) { dispose(); } } }
3e03aac3407459425346ed5d760526b738d73043
1,828
java
Java
payablesdk/src/main/java/com/payable/sdk/WaitDialog.java
aslamanver/retrofit-test
38a53473cd70f49a083c9098ef9cd547c6d4d689
[ "MIT" ]
2
2020-07-29T18:57:41.000Z
2021-07-14T21:30:38.000Z
payablesdk/src/main/java/com/payable/sdk/WaitDialog.java
aslamanver/retrofit-test
38a53473cd70f49a083c9098ef9cd547c6d4d689
[ "MIT" ]
null
null
null
payablesdk/src/main/java/com/payable/sdk/WaitDialog.java
aslamanver/retrofit-test
38a53473cd70f49a083c9098ef9cd547c6d4d689
[ "MIT" ]
2
2020-07-29T18:57:43.000Z
2021-08-25T05:27:46.000Z
32.070175
103
0.714989
1,513
package com.payable.sdk; import android.app.Activity; import android.app.Dialog; import android.app.DialogFragment; import android.app.FragmentTransaction; import android.content.DialogInterface; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; public class WaitDialog extends DialogFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setCancelable(false); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.wait_dialog, container, false); return view; } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Dialog dialog = super.onCreateDialog(savedInstanceState); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.getWindow().getAttributes().dimAmount = 0.0f; dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND); return dialog; } @Override public void onStart() { super.onStart(); Dialog dialog = getDialog(); if (dialog != null) { int width = ViewGroup.LayoutParams.MATCH_PARENT; int height = ViewGroup.LayoutParams.MATCH_PARENT; dialog.getWindow().setLayout(width, height); } } public void showDialog(Activity activity) { FragmentTransaction ft = activity.getFragmentManager().beginTransaction(); show(ft, "TAG"); } }
3e03ab9b20b8738ec1cb828c4dc16767d4b863f5
2,490
java
Java
springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app90/SpringDocTestApp.java
coutin/springdoc-openapi
115636279ca08a89c45abd682adf38e6356002c4
[ "Apache-2.0" ]
1,817
2019-07-20T12:10:42.000Z
2022-03-31T08:28:16.000Z
springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app90/SpringDocTestApp.java
coutin/springdoc-openapi
115636279ca08a89c45abd682adf38e6356002c4
[ "Apache-2.0" ]
1,519
2019-07-25T05:29:03.000Z
2022-03-31T10:54:02.000Z
springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app90/SpringDocTestApp.java
coutin/springdoc-openapi
115636279ca08a89c45abd682adf38e6356002c4
[ "Apache-2.0" ]
316
2019-07-25T07:02:19.000Z
2022-03-31T20:59:16.000Z
33.648649
144
0.759438
1,514
/* * * * Copyright 2019-2020 the original author or authors. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * https://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * */ package test.org.springdoc.api.app90; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.io.UncheckedIOException; import java.util.AbstractMap; import java.util.Collection; import java.util.Map; import java.util.Map.Entry; import io.swagger.v3.oas.models.examples.Example; import org.springdoc.core.customizers.OpenApiCustomiser; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.core.io.Resource; import org.springframework.util.FileCopyUtils; @SpringBootApplication class SpringDocTestApp { @Value("classpath:/500-90.txt") private Resource http500ExampleResource; public static String asString(Resource resource) { try (Reader reader = new InputStreamReader(resource.getInputStream())) { return FileCopyUtils.copyToString(reader); } catch (IOException e) { throw new UncheckedIOException(e); } } @Bean public OpenApiCustomiser openApiCustomiser(Collection<Entry<String, Example>> examples) { return openAPI -> { examples.forEach(example -> { openAPI.getComponents().addExamples(example.getKey(), example.getValue()); }); }; } @Bean public Map.Entry<String, Example> http500Example() { Example http500Example = new Example(); Map.Entry<String, Example> entry = new AbstractMap.SimpleEntry<String, Example>("http500Example", http500Example); http500Example.setSummary("HTTP 500 JSON Body response example"); http500Example.setDescription( "An example of HTTP response in case an error occurs on server side. instance attribute reference a traceId to ease server side analysis."); http500Example.setValue(asString(http500ExampleResource)); return entry; } }
3e03abe72cdeee169349af7cee195728a72e6ce0
4,491
java
Java
whois-update/src/test/java/net/ripe/db/whois/update/handler/validator/common/ObjectMismatchValidatorTest.java
sam-caldwell/whois
35d2b2e3bfac6bff22c338730b8f4981fe1c66f3
[ "BSD-3-Clause" ]
1
2019-02-09T21:20:12.000Z
2019-02-09T21:20:12.000Z
whois-update/src/test/java/net/ripe/db/whois/update/handler/validator/common/ObjectMismatchValidatorTest.java
sam-caldwell/whois
35d2b2e3bfac6bff22c338730b8f4981fe1c66f3
[ "BSD-3-Clause" ]
1
2022-03-08T21:12:44.000Z
2022-03-08T21:12:44.000Z
whois-update/src/test/java/net/ripe/db/whois/update/handler/validator/common/ObjectMismatchValidatorTest.java
thebureaugroup/whois
8e89621069fae31c1cc31d2d3babdfa9095d2bce
[ "BSD-3-Clause" ]
1
2019-02-10T07:56:50.000Z
2019-02-10T07:56:50.000Z
38.384615
186
0.685593
1,515
package net.ripe.db.whois.update.handler.validator.common; import net.ripe.db.whois.common.rpsl.ObjectMessages; import net.ripe.db.whois.common.rpsl.RpslObject; import net.ripe.db.whois.update.domain.Action; import net.ripe.db.whois.update.domain.UpdateMessages; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.runners.MockitoJUnitRunner; import static net.ripe.db.whois.update.handler.validator.ValidatorTestHelper.validateDelete; import static net.ripe.db.whois.update.handler.validator.ValidatorTestHelper.validateUpdate; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.hasSize; import static org.junit.Assert.assertThat; @RunWith(MockitoJUnitRunner.class) public class ObjectMismatchValidatorTest { public static final RpslObject OBJECT = RpslObject.parse("mntner: foo"); @InjectMocks ObjectMismatchValidator subject; @Test public void getActions() { assertThat(subject.getActions(), containsInAnyOrder(Action.DELETE)); } @Test public void no_original_object() { final ObjectMessages messages = validateUpdate(subject, null, OBJECT); assertThat(messages.getMessages().getAllMessages(), hasSize(0)); } @Test public void not_identical() { final RpslObject updatedObject = RpslObject.parse("mntner: foo2"); final ObjectMessages messages = validateUpdate(subject, OBJECT, updatedObject); assertThat(messages.getMessages().getAllMessages(), contains(UpdateMessages.objectMismatch(String.format("[%s] %s", updatedObject.getType().getName(), updatedObject.getKey())))); } @Test public void identical() { final ObjectMessages messages = validateUpdate(subject, OBJECT, OBJECT); assertThat(messages.getMessages().getAllMessages(), hasSize(0)); } private static final RpslObject TIMESTAMPED_OBJECT = RpslObject.parse("" + "mntner: foo\n"+ "created:2011-01-26T10:12:13Z\n" + "last-modified:2012-02-27T10:12:13Z\n"); private static final RpslObject SAME_TIMESTAMPED_OBJECT_WITH_OTHER_TIMESTAMPS = RpslObject.parse("" + "mntner: foo\n"+ "created:2010-01-26T10:12:13Z\n" + "last-modified:2013-02-27T10:12:13Z\n"); @Test public void modify_ignore_timestamps_identical() { final ObjectMessages messages = validateUpdate(subject, TIMESTAMPED_OBJECT, SAME_TIMESTAMPED_OBJECT_WITH_OTHER_TIMESTAMPS); assertThat(messages.getMessages().getAllMessages(), hasSize(0)); } @Test public void delete_ignore_timestamps_identical() { final ObjectMessages messages = validateDelete(subject, TIMESTAMPED_OBJECT, SAME_TIMESTAMPED_OBJECT_WITH_OTHER_TIMESTAMPS); assertThat(messages.getMessages().getAllMessages(), hasSize(0)); } @Test public void delete_ignore_does_not_ignore_status_attribute() { final RpslObject referenced = RpslObject.parse("" + "aut-num: foo\n" + "status: ASSIGNED\n"); final RpslObject updated = RpslObject.parse("" + "aut-num: foo\n" + "status: LEGACY\n"); final ObjectMessages messages = validateDelete(subject, referenced, updated); assertThat(messages.getMessages().getAllMessages(), hasSize(1)); } @Test public void delete_ignore_does_not_ignore_sponsoring_org_attribute() { final RpslObject referenced = RpslObject.parse("" + "aut-num: foo\n" + "sponsoring-org: ab\n"); final RpslObject updated = RpslObject.parse("" + "aut-num: foo\n" + "sponsoring-org: cd\n"); final ObjectMessages messages = validateDelete(subject, referenced, updated); assertThat(messages.getMessages().getAllMessages(), hasSize(1)); } @Test public void delete_ignore_does_not_ignore_other_generated_attributes() { final RpslObject referenced = RpslObject.parse("" + "aut-num: foo\n" + "fingerpr: a\n" + "owner: b\n" + "method: c\n"); final RpslObject updated = RpslObject.parse("" + "aut-num: foo\n"); final ObjectMessages messages = validateDelete(subject, referenced, updated); assertThat(messages.getMessages().getAllMessages(), hasSize(0)); } }
3e03ad5df4018f4c2f14b7dc9f69ceda648f66e5
3,223
java
Java
languages/languageDesign/editor/source_gen/jetbrains/mps/lang/editor/typesystem/check_ReferenceToNonexistentDefaultTransformationMenu_NonTypesystemRule.java
trespasserw/MPS
dbc5c76496e8ccef46dd420eefcd5089b1bc234b
[ "Apache-2.0" ]
null
null
null
languages/languageDesign/editor/source_gen/jetbrains/mps/lang/editor/typesystem/check_ReferenceToNonexistentDefaultTransformationMenu_NonTypesystemRule.java
trespasserw/MPS
dbc5c76496e8ccef46dd420eefcd5089b1bc234b
[ "Apache-2.0" ]
null
null
null
languages/languageDesign/editor/source_gen/jetbrains/mps/lang/editor/typesystem/check_ReferenceToNonexistentDefaultTransformationMenu_NonTypesystemRule.java
trespasserw/MPS
dbc5c76496e8ccef46dd420eefcd5089b1bc234b
[ "Apache-2.0" ]
null
null
null
53.716667
355
0.818492
1,516
package jetbrains.mps.lang.editor.typesystem; /*Generated by MPS */ import jetbrains.mps.lang.typesystem.runtime.AbstractNonTypesystemRule_Runtime; import jetbrains.mps.lang.typesystem.runtime.NonTypesystemRule_Runtime; import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.typesystem.inference.TypeCheckingContext; import jetbrains.mps.lang.typesystem.runtime.IsApplicableStatus; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import jetbrains.mps.lang.editor.editor.DefaultTransformationMenuUtil; import jetbrains.mps.errors.messageTargets.MessageTarget; import jetbrains.mps.errors.messageTargets.ReferenceMessageTarget; import jetbrains.mps.errors.IErrorReporter; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations; import org.jetbrains.mps.openapi.language.SAbstractConcept; import org.jetbrains.mps.openapi.language.SReferenceLink; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import org.jetbrains.mps.openapi.language.SProperty; import org.jetbrains.mps.openapi.language.SConcept; public class check_ReferenceToNonexistentDefaultTransformationMenu_NonTypesystemRule extends AbstractNonTypesystemRule_Runtime implements NonTypesystemRule_Runtime { public check_ReferenceToNonexistentDefaultTransformationMenu_NonTypesystemRule() { } public void applyRule(final SNode ref, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) { SNode concept = SLinkOperations.getTarget(ref, LINKS.concept$kjNG); if ((concept == null)) { return; } if ((DefaultTransformationMenuUtil.findDefaultTransformationMenuForConcept(concept) == null)) { { final MessageTarget errorTarget = new ReferenceMessageTarget(LINKS.concept$kjNG); IErrorReporter _reporter_2309309498 = typeCheckingContext.reportInfo(ref, "Default transformation menu for " + SPropertyOperations.getString(concept, PROPS.name$MnvL) + " is not defined. Implicit default menu will be used.", "r:00000000-0000-4000-0000-011c8959029a(jetbrains.mps.lang.editor.typesystem)", "2823239769520680200", null, errorTarget); } } } public SAbstractConcept getApplicableConcept() { return CONCEPTS.TransformationMenuReference_Default$sG; } public IsApplicableStatus isApplicableAndPattern(SNode argument) { return new IsApplicableStatus(argument.getConcept().isSubConceptOf(getApplicableConcept()), null); } public boolean overrides() { return false; } private static final class LINKS { /*package*/ static final SReferenceLink concept$kjNG = MetaAdapterFactory.getReferenceLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x169efbc9a90a41c1L, 0x169efbc9a91440deL, "concept"); } private static final class PROPS { /*package*/ static final SProperty name$MnvL = MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"); } private static final class CONCEPTS { /*package*/ static final SConcept TransformationMenuReference_Default$sG = MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x5d3b34577b3cff0cL, "jetbrains.mps.lang.editor.structure.TransformationMenuReference_Default"); } }
3e03adb3fe0222ad375efb5a6e70ab913f30f1f6
716
java
Java
dcdt-core/src/main/java/gov/hhs/onc/dcdt/beans/ToolLifecycleBean.java
elizabethso/direct-certificate-discovery-tool
b0050e4e8df8fded5cbb2f3a40a9b1692ebbc94e
[ "Apache-2.0" ]
null
null
null
dcdt-core/src/main/java/gov/hhs/onc/dcdt/beans/ToolLifecycleBean.java
elizabethso/direct-certificate-discovery-tool
b0050e4e8df8fded5cbb2f3a40a9b1692ebbc94e
[ "Apache-2.0" ]
2
2020-09-09T19:24:39.000Z
2021-02-03T19:28:04.000Z
dcdt-core/src/main/java/gov/hhs/onc/dcdt/beans/ToolLifecycleBean.java
elizabethso/direct-certificate-discovery-tool
b0050e4e8df8fded5cbb2f3a40a9b1692ebbc94e
[ "Apache-2.0" ]
null
null
null
27.538462
72
0.797486
1,517
package gov.hhs.onc.dcdt.beans; import gov.hhs.onc.dcdt.context.LifecycleStatusType; import javax.annotation.Nullable; import org.springframework.context.SmartLifecycle; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; public interface ToolLifecycleBean extends SmartLifecycle, ToolBean { @Override public void stop(@Nullable Runnable stopCallback); public boolean canStop(); public boolean canStart(); public void setAutoStartup(boolean autoStartup); public LifecycleStatusType getLifecycleStatus(); public void setPhase(int phase); public ThreadPoolTaskExecutor getTaskExecutor(); public void setTaskExecutor(ThreadPoolTaskExecutor taskExec); }
3e03ae4cfd2f2eab985e96e4c4198b2af9306e64
2,427
java
Java
sso/sso-system2/src/main/java/com/xp/utils/CookieUtil.java
xp-zhao/learn-java
49a76ae8043ce7ceb641ce6f0e094059d8ba9b55
[ "MIT" ]
1
2018-12-07T02:43:06.000Z
2018-12-07T02:43:06.000Z
sso/sso-system2/src/main/java/com/xp/utils/CookieUtil.java
xp-zhao/learn-java
49a76ae8043ce7ceb641ce6f0e094059d8ba9b55
[ "MIT" ]
16
2020-05-15T19:23:08.000Z
2022-03-31T18:48:42.000Z
sso/sso-system2/src/main/java/com/xp/utils/CookieUtil.java
xp-zhao/learn-java
49a76ae8043ce7ceb641ce6f0e094059d8ba9b55
[ "MIT" ]
null
null
null
31.115385
95
0.580552
1,518
package com.xp.utils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Created by geely */ @Slf4j public class CookieUtil { private final static String COOKIE_DOMAIN = ".sso.com"; private final static String COOKIE_NAME = "sso_login_token"; public static String readLoginToken(HttpServletRequest request){ Cookie[] cks = request.getCookies(); if(cks != null){ for(Cookie ck : cks){ log.info("read cookieName:{},cookieValue:{}",ck.getName(),ck.getValue()); if(StringUtils.equals(ck.getName(),COOKIE_NAME)){ log.info("return cookieName:{},cookieValue:{}",ck.getName(),ck.getValue()); return ck.getValue(); } } } return null; } //X:domain=".sso.com" //a:A.sso.com cookie:domain=A.sso.com;path="/" //b:B.sso.com cookie:domain=B.sso.com;path="/" //c:A.sso.com/test/cc cookie:domain=A.sso.com;path="/test/cc" //d:A.sso.com/test/dd cookie:domain=A.sso.com;path="/test/dd" //e:A.sso.com/test cookie:domain=A.sso.com;path="/test" public static void writeLoginToken(HttpServletResponse response,String token){ Cookie ck = new Cookie(COOKIE_NAME,token); ck.setDomain(COOKIE_DOMAIN); ck.setPath("/");//代表设置在根目录 ck.setHttpOnly(true); //单位是秒。 //如果这个maxage不设置的话,cookie就不会写入硬盘,而是写在内存。只在当前页面有效。 ck.setMaxAge(60 * 60 * 24 * 365);//如果是-1,代表永久 log.info("write cookieName:{},cookieValue:{}",ck.getName(),ck.getValue()); response.addCookie(ck); } public static void delLoginToken(HttpServletRequest request,HttpServletResponse response){ Cookie[] cks = request.getCookies(); if(cks != null){ for(Cookie ck : cks){ if(StringUtils.equals(ck.getName(),COOKIE_NAME)){ ck.setDomain(COOKIE_DOMAIN); ck.setPath("/"); ck.setMaxAge(0);//设置成0,代表删除此cookie。 log.info("del cookieName:{},cookieValue:{}",ck.getName(),ck.getValue()); response.addCookie(ck); return; } } } } }
3e03ae5420fec5f477756fbf7526f51e9be237e1
304
java
Java
itgen/src/main/java/core/general/SetUtils.java
julja83/java_itgen
7b8dc5a7291564d10594c900e895ef3819256ddf
[ "Apache-2.0" ]
null
null
null
itgen/src/main/java/core/general/SetUtils.java
julja83/java_itgen
7b8dc5a7291564d10594c900e895ef3819256ddf
[ "Apache-2.0" ]
null
null
null
itgen/src/main/java/core/general/SetUtils.java
julja83/java_itgen
7b8dc5a7291564d10594c900e895ef3819256ddf
[ "Apache-2.0" ]
null
null
null
15.2
58
0.578947
1,519
package core.general; import java.util.Set; public class SetUtils { public static boolean equals(Set<?> set1, Set<?> set2) { if (set1 == null || set2 == null) { return false; } if (set1.size() != set2.size()) { return false; } return set1.containsAll(set2); } }
3e03ae5544dca42285e807c66d46fca01b0f7a9f
7,111
java
Java
http-clients/netty-nio-client/src/test/java/software/amazon/awssdk/http/nio/netty/internal/NettyRequestExecutorTest.java
Bennett-Lynch/aws-sdk-java-v2
6282ed73eca3a1f15a78e259da2d8d0ded13d94f
[ "Apache-2.0" ]
1,467
2017-06-28T17:47:37.000Z
2022-03-30T15:41:29.000Z
http-clients/netty-nio-client/src/test/java/software/amazon/awssdk/http/nio/netty/internal/NettyRequestExecutorTest.java
Bennett-Lynch/aws-sdk-java-v2
6282ed73eca3a1f15a78e259da2d8d0ded13d94f
[ "Apache-2.0" ]
2,520
2017-06-28T21:51:51.000Z
2022-03-31T23:49:59.000Z
http-clients/netty-nio-client/src/test/java/software/amazon/awssdk/http/nio/netty/internal/NettyRequestExecutorTest.java
Bennett-Lynch/aws-sdk-java-v2
6282ed73eca3a1f15a78e259da2d8d0ded13d94f
[ "Apache-2.0" ]
703
2017-06-28T17:57:09.000Z
2022-03-24T21:42:20.000Z
42.580838
126
0.669948
1,520
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package software.amazon.awssdk.http.nio.netty.internal; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static software.amazon.awssdk.http.SdkHttpConfigurationOption.WRITE_TIMEOUT; import static software.amazon.awssdk.http.nio.netty.internal.ChannelAttributeKey.IN_USE; import static software.amazon.awssdk.http.nio.netty.internal.ChannelAttributeKey.PROTOCOL_FUTURE; import io.netty.channel.Channel; import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelPipeline; import io.netty.channel.DefaultChannelPromise; import io.netty.channel.EventLoop; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.util.Attribute; import io.netty.util.AttributeKey; import io.netty.util.concurrent.Promise; import java.time.Duration; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.stubbing.Answer; import software.amazon.awssdk.http.Protocol; import software.amazon.awssdk.http.SdkHttpFullRequest; import software.amazon.awssdk.http.SdkHttpMethod; import software.amazon.awssdk.http.async.AsyncExecuteRequest; import software.amazon.awssdk.utils.AttributeMap; public class NettyRequestExecutorTest { private SdkChannelPool mockChannelPool; private EventLoopGroup eventLoopGroup; private NettyRequestExecutor nettyRequestExecutor; private RequestContext requestContext; @BeforeEach public void setup() { mockChannelPool = mock(SdkChannelPool.class); eventLoopGroup = new NioEventLoopGroup(); AttributeMap attributeMap = AttributeMap.builder() .put(WRITE_TIMEOUT, Duration.ofSeconds(3)) .build(); requestContext = new RequestContext(mockChannelPool, eventLoopGroup, AsyncExecuteRequest.builder().request(SdkHttpFullRequest.builder() .method(SdkHttpMethod.GET) .host("amazonaws.com") .protocol("https") .build()) .build(), new NettyConfiguration(attributeMap)); nettyRequestExecutor = new NettyRequestExecutor(requestContext); } @AfterEach public void teardown() throws InterruptedException { eventLoopGroup.shutdownGracefully().await(); } @Test public void cancelExecuteFuture_channelNotAcquired_failsAcquirePromise() { ArgumentCaptor<Promise> acquireCaptor = ArgumentCaptor.forClass(Promise.class); when(mockChannelPool.acquire(acquireCaptor.capture())).thenAnswer((Answer<Promise>) invocationOnMock -> { return invocationOnMock.getArgumentAt(0, Promise.class); }); CompletableFuture<Void> executeFuture = nettyRequestExecutor.execute(); executeFuture.cancel(true); assertThat(acquireCaptor.getValue().isDone()).isTrue(); assertThat(acquireCaptor.getValue().isSuccess()).isFalse(); } @Test public void cancelExecuteFuture_channelAcquired_submitsRunnable() throws InterruptedException { EventLoop mockEventLoop = mock(EventLoop.class); Channel mockChannel = mock(Channel.class); ChannelPipeline mockPipeline = mock(ChannelPipeline.class); when(mockChannel.pipeline()).thenReturn(mockPipeline); when(mockChannel.eventLoop()).thenReturn(mockEventLoop); when(mockChannel.isActive()).thenReturn(true); Attribute<Boolean> mockInUseAttr = mock(Attribute.class); when(mockInUseAttr.get()).thenReturn(Boolean.TRUE); CompletableFuture<Protocol> protocolFuture = CompletableFuture.completedFuture(Protocol.HTTP1_1); Attribute<CompletableFuture<Protocol>> mockProtocolFutureAttr = mock(Attribute.class); when(mockProtocolFutureAttr.get()).thenReturn(protocolFuture); when(mockChannel.attr(any(AttributeKey.class))).thenAnswer(i -> { AttributeKey argumentAt = i.getArgumentAt(0, AttributeKey.class); if (argumentAt == IN_USE) { return mockInUseAttr; } if (argumentAt == PROTOCOL_FUTURE) { return mockProtocolFutureAttr; } return mock(Attribute.class); }); when(mockChannel.writeAndFlush(any(Object.class))).thenReturn(new DefaultChannelPromise(mockChannel)); ChannelConfig mockChannelConfig = mock(ChannelConfig.class); when(mockChannel.config()).thenReturn(mockChannelConfig); CountDownLatch submitLatch = new CountDownLatch(1); when(mockEventLoop.submit(any(Runnable.class))).thenAnswer(i -> { i.getArgumentAt(0, Runnable.class).run(); // Need to wait until the first submit() happens which sets up the channel before cancelling the future. submitLatch.countDown(); return null; }); when(mockChannelPool.acquire(any(Promise.class))).thenAnswer((Answer<Promise>) invocationOnMock -> { Promise p = invocationOnMock.getArgumentAt(0, Promise.class); p.setSuccess(mockChannel); return p; }); CountDownLatch exceptionFiredLatch = new CountDownLatch(1); when(mockPipeline.fireExceptionCaught(any(FutureCancelledException.class))).thenAnswer(i -> { exceptionFiredLatch.countDown(); return mockPipeline; }); CompletableFuture<Void> executeFuture = nettyRequestExecutor.execute(); submitLatch.await(1, TimeUnit.SECONDS); executeFuture.cancel(true); exceptionFiredLatch.await(1, TimeUnit.SECONDS); verify(mockEventLoop, times(2)).submit(any(Runnable.class)); } }
3e03ae58a6a6adaf6ae4f5da6909856e0013933f
1,618
java
Java
loginActivity/src/main/java/com/droidteahouse/commons/models/Publiceditability.java
cloudbank/commons
14736a7a45ca018e3c862ec009c33f46fb6007c7
[ "Apache-2.0" ]
null
null
null
loginActivity/src/main/java/com/droidteahouse/commons/models/Publiceditability.java
cloudbank/commons
14736a7a45ca018e3c862ec009c33f46fb6007c7
[ "Apache-2.0" ]
null
null
null
loginActivity/src/main/java/com/droidteahouse/commons/models/Publiceditability.java
cloudbank/commons
14736a7a45ca018e3c862ec009c33f46fb6007c7
[ "Apache-2.0" ]
null
null
null
23.794118
69
0.74042
1,521
package com.droidteahouse.commons.models; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import java.util.HashMap; import java.util.Map; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "cancomment", "canaddmeta" }) public class Publiceditability { @JsonProperty("cancomment") private Integer cancomment; @JsonProperty("canaddmeta") private Integer canaddmeta; @JsonIgnore private Map<String, Object> additionalProperties = new HashMap<>(); /** * @return The cancomment */ @JsonProperty("cancomment") public Integer getCancomment() { return cancomment; } /** * @param cancomment The cancomment */ @JsonProperty("cancomment") public void setCancomment(Integer cancomment) { this.cancomment = cancomment; } /** * @return The canaddmeta */ @JsonProperty("canaddmeta") public Integer getCanaddmeta() { return canaddmeta; } /** * @param canaddmeta The canaddmeta */ @JsonProperty("canaddmeta") public void setCanaddmeta(Integer canaddmeta) { this.canaddmeta = canaddmeta; } @JsonAnyGetter public Map<String, Object> getAdditionalProperties() { return this.additionalProperties; } @JsonAnySetter public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } }
3e03ae5a7eea2bc96d84192dfebbd3e5b3dee84d
395
java
Java
app/src/main/java/tlf/com/tlfdebug/ui/BaseBleActivity.java
BeyondWorlds/TemporaryDebug
45c8185bd5def7b8a03b413b5ea889b55797bc24
[ "Apache-2.0" ]
null
null
null
app/src/main/java/tlf/com/tlfdebug/ui/BaseBleActivity.java
BeyondWorlds/TemporaryDebug
45c8185bd5def7b8a03b413b5ea889b55797bc24
[ "Apache-2.0" ]
null
null
null
app/src/main/java/tlf/com/tlfdebug/ui/BaseBleActivity.java
BeyondWorlds/TemporaryDebug
45c8185bd5def7b8a03b413b5ea889b55797bc24
[ "Apache-2.0" ]
null
null
null
18.809524
56
0.701266
1,522
package tlf.com.tlfdebug.ui; import android.os.Bundle; import com.tlf.keep.PermissionManager; public class BaseBleActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override protected void onResume() { super.onResume(); PermissionManager.checkBLE(this); } }
3e03af1abd8021831de75966628e3b24a77bae36
743
java
Java
core/src/main/java/com/dtolabs/rundeck/plugins/scm/JobImporter.java
nghuubaotrung/asuka_rundeck
d0c073402767429544babc19afad1aa13319f662
[ "Apache-2.0" ]
null
null
null
core/src/main/java/com/dtolabs/rundeck/plugins/scm/JobImporter.java
nghuubaotrung/asuka_rundeck
d0c073402767429544babc19afad1aa13319f662
[ "Apache-2.0" ]
null
null
null
core/src/main/java/com/dtolabs/rundeck/plugins/scm/JobImporter.java
nghuubaotrung/asuka_rundeck
d0c073402767429544babc19afad1aa13319f662
[ "Apache-2.0" ]
null
null
null
23.967742
88
0.625841
1,523
package com.dtolabs.rundeck.plugins.scm; import java.io.InputStream; import java.util.Map; /** * Can import a job */ public interface JobImporter { /** * Import a serialized job * * @param format format, 'xml' or 'yaml' * @param input input stream * @param importMetadata metadata to attach to the job * * @return result */ ImportResult importFromStream(String format, InputStream input, Map importMetadata); /** * Import a Map-representation of a Job * * @param input input map data * @param importMetadata metadata to attach to the job * * @return result */ ImportResult importFromMap(Map input, Map importMetadata); }
3e03b068ff583305d463bcc801b5b2f54ea1eebb
27,471
java
Java
structr-core/src/main/java/org/structr/core/Services.java
joansmith1/structr
34cc0c92105bdc6e9eb55a56e71760c6a5560272
[ "IJG", "ADSL" ]
null
null
null
structr-core/src/main/java/org/structr/core/Services.java
joansmith1/structr
34cc0c92105bdc6e9eb55a56e71760c6a5560272
[ "IJG", "ADSL" ]
null
null
null
structr-core/src/main/java/org/structr/core/Services.java
joansmith1/structr
34cc0c92105bdc6e9eb55a56e71760c6a5560272
[ "IJG", "ADSL" ]
null
null
null
31.005643
209
0.679699
1,524
/** * Copyright (C) 2010-2015 Morgner UG (haftungsbeschränkt) * * This file is part of Structr <http://structr.org>. * * Structr is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * Structr 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 Structr. If not, see <http://www.gnu.org/licenses/>. */ package org.structr.core; import java.io.File; import java.io.IOException; import java.net.URI; import java.nio.file.Files; import java.util.Arrays; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.Node; import org.neo4j.graphdb.Relationship; import org.neo4j.tooling.GlobalGraphOperations; import org.structr.common.Permission; import org.structr.common.Permissions; import org.structr.common.SecurityContext; import org.structr.common.StructrConf; import org.structr.core.app.App; import org.structr.core.app.StructrApp; import org.structr.core.graph.NodeFactory; import org.structr.core.graph.NodeInterface; import org.structr.core.graph.NodeService; import org.structr.core.graph.RelationshipFactory; import org.structr.core.graph.RelationshipInterface; import org.structr.core.graph.Tx; import org.structr.core.property.StringProperty; import org.structr.module.JarConfigurationProvider; import org.structr.schema.ConfigurationProvider; //~--- classes ---------------------------------------------------------------- /** * Provides access to the service layer in structr. * * Use the command method to obtain an instance of the desired command. * * @author Christian Morgner */ public class Services { private static final Logger logger = Logger.getLogger(StructrApp.class.getName()); private static StructrConf baseConf = null; // Configuration constants public static final String INITIAL_SEED_FILE = "seed.zip"; public static final String BASE_PATH = "base.path"; public static final String CONFIGURED_SERVICES = "configured.services"; public static final String CONFIG_FILE_PATH = "configfile.path"; public static final String DATABASE_PATH = "database.path"; public static final String FILES_PATH = "files.path"; public static final String DATA_EXCHANGE_PATH = "data.exchange.path"; public static final String LOG_DATABASE_PATH = "log.database.path"; public static final String FOREIGN_TYPE = "foreign.type.key"; public static final String NEO4J_SHELL_ENABLED = "neo4j.shell.enabled"; public static final String NEO4J_SHELL_PORT = "neo4j.shell.port"; public static final String NEO4J_PAGE_CACHE_MEMORY = "neo4j.pagecache.memory"; public static final String LOG_SERVICE_INTERVAL = "structr.logging.interval"; public static final String LOG_SERVICE_THRESHOLD = "structr.logging.threshold"; public static final String SERVER_IP = "server.ip"; public static final String SMTP_HOST = "smtp.host"; public static final String SMTP_PORT = "smtp.port"; public static final String SMTP_USER = "smtp.user"; public static final String SMTP_PASSWORD = "smtp.password"; public static final String SMTP_USE_TLS = "smtp.tls.enabled"; public static final String SMTP_REQUIRE_TLS = "smtp.tls.required"; public static final String SUPERUSER_USERNAME = "superuser.username"; public static final String SUPERUSER_PASSWORD = "superuser.password"; public static final String TCP_PORT = "tcp.port"; public static final String TMP_PATH = "tmp.path"; public static final String UDP_PORT = "udp.port"; public static final String JSON_INDENTATION = "json.indentation"; public static final String JSON_REDUNDANCY_REDUCTION = "json.redundancyReduction"; public static final String GEOCODING_PROVIDER = "geocoding.provider"; public static final String GEOCODING_LANGUAGE = "geocoding.language"; public static final String GEOCODING_APIKEY = "geocoding.apikey"; public static final String CONFIGURATION = "configuration.provider"; public static final String TESTING = "testing"; public static final String MIGRATION_KEY = "NodeService.migration"; public static final String ACCESS_CONTROL_MAX_AGE = "access.control.max.age"; public static final String ACCESS_CONTROL_ALLOW_METHODS = "access.control.allow.methods"; public static final String ACCESS_CONTROL_ALLOW_HEADERS = "access.control.allow.headers"; public static final String ACCESS_CONTROL_ALLOW_CREDENTIALS = "access.control.allow.credentials"; public static final String ACCESS_CONTROL_EXPOSE_HEADERS = "access.control.expose.headers"; public static final String APPLICATION_SESSION_TIMEOUT = "application.session.timeout"; public static final String APPLICATION_SECURITY_OWNERLESS_NODES = "application.security.ownerless.nodes"; public static final String SNAPSHOT_PATH = "snapshot.path"; public static final String WEBSOCKET_FRONTEND_ACCESS = "WebSocketServlet.frontendAccess"; // singleton instance private static int globalSessionTimeout = -1; private static Services singletonInstance = null; // non-static members private final List<InitializationCallback> callbacks = new LinkedList<>(); private final Set<Permission> permissionsForOwnerlessNodes = new LinkedHashSet<>(); private final Map<String, Object> attributes = new ConcurrentHashMap<>(10, 0.9f, 8); private final Map<Class, Service> serviceCache = new ConcurrentHashMap<>(10, 0.9f, 8); private final Set<Class> registeredServiceClasses = new LinkedHashSet<>(); private final Set<String> configuredServiceClasses = new LinkedHashSet<>(); private StructrConf structrConf = new StructrConf(); private ConfigurationProvider configuration = null; private boolean initializationDone = false; private boolean shutdownDone = false; private String configuredServiceNames = null; private String configurationClass = null; private Services() { } public static Services getInstance() { if (singletonInstance == null) { singletonInstance = new Services(); singletonInstance.initialize(); new Thread(new Runnable() { @Override public void run() { // wait a second try { Thread.sleep(1000); } catch (Throwable ignore) {} // call initialization callbacks from a different thread for (final InitializationCallback callback : singletonInstance.callbacks) { callback.initializationDone(); } } }).start(); } return singletonInstance; } public static Services getInstance(final StructrConf properties) { if (singletonInstance == null) { singletonInstance = new Services(); singletonInstance.initialize(properties); } return singletonInstance; } /** * Creates and returns a command of the given <code>type</code>. If a command is * found, the corresponding service will be discovered and activated. * * @param <T> * @param securityContext * @param commandType the runtime type of the desired command * @return the command */ public <T extends Command> T command(SecurityContext securityContext, Class<T> commandType) { Class serviceClass = null; T command = null; try { command = commandType.newInstance(); command.setSecurityContext(securityContext); serviceClass = command.getServiceClass(); if ((serviceClass != null) && configuredServiceClasses.contains(serviceClass.getSimpleName())) { // search for already running service.. Service service = serviceCache.get(serviceClass); if (service == null) { // service not cached service = createService(serviceClass); } else { // check RunnableService for isRunning().. if (service instanceof RunnableService) { RunnableService runnableService = (RunnableService) service; if (!runnableService.isRunning()) { runnableService.stopService(); runnableService.shutdown(); service = createService(serviceClass); } } } logger.log(Level.FINEST, "Initializing command ", commandType.getName()); service.injectArguments(command); } } catch (Throwable t) { t.printStackTrace(); logger.log(Level.SEVERE, "Exception while creating command " + commandType.getName(), t); } return (command); } private void initialize() { final StructrConf config = getBaseConfiguration(); // read structr.conf final String configTemplateFileName = "structr.conf_templ"; final String configFileName = "structr.conf"; final File configTemplateFile = new File(configTemplateFileName); final File configFile = new File(configFileName); if (!configFile.exists() && !configTemplateFile.exists()) { logger.log(Level.SEVERE, "Unable to create config file, {0} and {1} do not exist, aborting. Please create a {0} configuration file and try again.", new Object[] { configFileName, configTemplateFileName } ); // exit immediately, since we can not proceed without configuration file System.exit(1); } if (!configFile.exists() && configTemplateFile.exists()) { logger.log(Level.WARNING, "Configuration file {0} not found, copying from template {1}. Please adapt newly created {0} to your needs.", new Object[] { configFileName, configTemplateFileName } ); try { Files.copy(configTemplateFile.toPath(), configFile.toPath()); } catch (IOException ioex) { logger.log(Level.SEVERE, "Unable to create config file, copying of template failed.", ioex); System.exit(1); } } logger.log(Level.INFO, "Reading {0}..", configFileName); try { // final FileInputStream fis = new FileInputStream(configFileName); // structrConf.load(fis); // fis.close(); PropertiesConfiguration.setDefaultListDelimiter('\0'); final PropertiesConfiguration propConf = new PropertiesConfiguration(configFileName); structrConf.load(propConf); } catch (ConfigurationException ex) { logger.log(Level.SEVERE, null, ex); } mergeConfiguration(config, structrConf); initialize(config); } private void initialize(final StructrConf properties) { this.structrConf = properties; configurationClass = properties.getProperty(Services.CONFIGURATION); configuredServiceNames = properties.getProperty(Services.CONFIGURED_SERVICES); // create set of configured services configuredServiceClasses.addAll(Arrays.asList(configuredServiceNames.split("[ ,]+"))); // if configuration is not yet established, instantiate it // this is the place where the service classes get the // opportunity to modifyConfiguration the default configuration getConfigurationProvider(); logger.log(Level.INFO, "Starting services"); // initialize other services for (final String serviceClassName : configuredServiceClasses) { Class serviceClass = getServiceClassForName(serviceClassName); if (serviceClass != null) { try { final Service service = createService(serviceClass); if (service != null) { service.initialized(); } else { logger.log(Level.WARNING, "Service {0} was not started!", serviceClassName); } } catch (Throwable t) { logger.log(Level.WARNING, "Exception while registering service {0}: {1}", new Object[] { serviceClassName, t }); t.printStackTrace(); } } } logger.log(Level.INFO, "{0} service(s) processed", serviceCache.size()); registeredServiceClasses.clear(); // do migration of an existing database if (getService(NodeService.class) != null) { if ("true".equals(properties.getProperty(Services.MIGRATION_KEY))) { migrateDatabase(); } } logger.log(Level.INFO, "Registering shutdown hook."); // register shutdown hook Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { shutdown(); } }); // read permissions for ownerless nodes final String configForOwnerlessNodes = this.structrConf.getProperty(Services.APPLICATION_SECURITY_OWNERLESS_NODES, "read"); if (StringUtils.isNotBlank(configForOwnerlessNodes)) { for (final String permission : configForOwnerlessNodes.split("[, ]+")) { final String trimmed = permission.trim(); if (StringUtils.isNotBlank(trimmed)) { final Permission val = Permissions.valueOf(trimmed); if (val != null) { permissionsForOwnerlessNodes.add(val); } else { logger.log(Level.WARNING, "Invalid permisson {0}, ignoring.", trimmed); } } } } else { // default permissionsForOwnerlessNodes.add(Permission.read); } logger.log(Level.INFO, "Initialization complete"); initializationDone = true; } public void registerInitializationCallback(final InitializationCallback callback) { callbacks.add(callback); } public boolean isInitialized() { return initializationDone; } public void shutdown() { initializationDone = false; if (!shutdownDone) { System.out.println("INFO: Shutting down..."); for (Service service : serviceCache.values()) { try { if (service instanceof RunnableService) { RunnableService runnableService = (RunnableService) service; if (runnableService.isRunning()) { runnableService.stopService(); } } service.shutdown(); } catch (Throwable t) { System.out.println("WARNING: Failed to shut down " + service.getName() + ": " + t.getMessage()); } } serviceCache.clear(); // shut down configuration provider configuration.shutdown(); // clear singleton instance singletonInstance = null; System.out.println("INFO: Shutdown complete"); // signal shutdown is complete shutdownDone = true; } } /** * Registers a service, enabling the service layer to automatically start * autorun servies. * * @param serviceClass the service class to register */ public void registerServiceClass(Class serviceClass) { registeredServiceClasses.add(serviceClass); // // // let service instance visit default configuration // try { // // serviceClass.newInstance(); // //service.modifyConfiguration(getBaseConfiguration()); // // } catch (Throwable t) { // t.printStackTrace(); // } } public String getConfigurationValue(String key) { return getConfigurationValue(key, ""); } public String getConfigurationValue(String key, String defaultValue) { return getCurrentConfig().getProperty(key, defaultValue); } public Class getServiceClassForName(final String serviceClassName) { for (Class serviceClass : registeredServiceClasses) { if (serviceClass.getSimpleName().equals(serviceClassName)) { return serviceClass; } } return null; } public ConfigurationProvider getConfigurationProvider() { // instantiate configuration provider if (configuration == null) { // when executing tests, the configuration class may already exist, // so we don't instantiate it again since all the entities are already // known to the ClassLoader and we would miss the code in all the static // initializers. try { configuration = (ConfigurationProvider)Class.forName(configurationClass).newInstance(); configuration.initialize(); } catch (Throwable t) { t.printStackTrace(); logger.log(Level.SEVERE, "Unable to instantiate schema provider of type {0}: {1}", new Object[] { configurationClass, t.getMessage() }); } } return configuration; } /** * Store an attribute value in the service config * * @param name * @param value */ public void setAttribute(final String name, final Object value) { synchronized (attributes) { attributes.put(name, value); } } /** * Retrieve attribute value from service config * * @param name * @return attribute */ public Object getAttribute(final String name) { return attributes.get(name); } /** * Remove attribute value from service config * * @param name */ public void removeAttribute(final String name) { attributes.remove(name); } private Service createService(Class serviceClass) { logger.log(Level.FINE, "Creating service ", serviceClass.getName()); Service service = null; try { service = (Service) serviceClass.newInstance(); service.initialize(getCurrentConfig()); if (service instanceof RunnableService) { RunnableService runnableService = (RunnableService) service; if (runnableService.runOnStartup()) { logger.log(Level.FINER, "Starting RunnableService instance ", serviceClass.getName()); // start RunnableService and cache it runnableService.startService(); serviceCache.put(serviceClass, service); } } else if (service instanceof SingletonService) { // cache SingletonService serviceCache.put(serviceClass, service); } } catch (Throwable t) { t.printStackTrace(); if (service.isVital()) { logger.log(Level.SEVERE, "Vital service {0} failed to start: {1}. Aborting", new Object[] { service.getClass().getSimpleName(), t.getMessage() } ); // hard(est) exit System.exit(1); } else { logger.log(Level.SEVERE, "Service {0} failed to start: {1}.", new Object[] { service.getClass().getSimpleName(), t.getMessage() } ); } } return service; } /** * Return all registered services * * @return list of services */ public List<Service> getServices() { List<Service> services = new LinkedList<>(); for (Service service : serviceCache.values()) { services.add(service); } return services; } public <T extends Service> T getService(final Class<T> type) { return (T) serviceCache.get(type); } public String getConfigValue(final Map<String, String> config, final String key, final String defaultValue) { String value = StringUtils.strip(config.get(key)); if (value != null) { return value; } return defaultValue; } /** * Return true if the given service is ready to be used, * means initialized and running. * * @param serviceClass * @return isReady */ public boolean isReady(final Class serviceClass) { Service service = serviceCache.get(serviceClass); return (service != null && service.isRunning()); } public StructrConf getCurrentConfig() { return structrConf; } public Set<String> getResources() { final Set<String> resources = new LinkedHashSet<>(); // scan through structr.conf and try to identify module-specific classes for (final Object configurationValue : structrConf.values()) { for (final String value : configurationValue.toString().split("[\\s ,;]+")) { try { // try to load class and find source code origin final Class candidate = Class.forName(value); if (!candidate.getName().startsWith("org.structr")) { final String codeLocation = candidate.getProtectionDomain().getCodeSource().getLocation().toString(); if (codeLocation.startsWith("file:") && codeLocation.endsWith(".jar") || codeLocation.endsWith(".war")) { final File file = new File(URI.create(codeLocation)); if (file.exists()) { resources.add(file.getAbsolutePath()); } } } } catch (Throwable ignore) { } } } logger.log(Level.INFO, "Found {0} possible resources: {1}", new Object[] { resources.size(), resources } ); return resources; } public static StructrConf getBaseConfiguration() { if (baseConf == null) { baseConf = new StructrConf(); baseConf.setProperty(CONFIGURATION, JarConfigurationProvider.class.getName()); baseConf.setProperty(CONFIGURED_SERVICES, "NodeService AgentService CronService SchemaService"); baseConf.setProperty(NEO4J_SHELL_ENABLED, "true"); baseConf.setProperty(NEO4J_SHELL_PORT, "1337"); baseConf.setProperty(JSON_INDENTATION, "true"); baseConf.setProperty(SUPERUSER_USERNAME, "superadmin"); baseConf.setProperty(SUPERUSER_PASSWORD, RandomStringUtils.randomAlphanumeric(12)); baseConf.setProperty(BASE_PATH, ""); baseConf.setProperty(TMP_PATH, "/tmp"); baseConf.setProperty(DATABASE_PATH, System.getProperty("user.dir").concat("/db")); baseConf.setProperty(FILES_PATH, System.getProperty("user.dir").concat("/files")); baseConf.setProperty(LOG_DATABASE_PATH, System.getProperty("user.dir").concat("/logDb.dat")); baseConf.setProperty(SMTP_HOST, "localhost"); baseConf.setProperty(SMTP_PORT, "25"); baseConf.setProperty(TCP_PORT, "54555"); baseConf.setProperty(UDP_PORT, "57555"); } return baseConf; } public static void mergeConfiguration(final StructrConf baseConfig, final StructrConf additionalConfig) { baseConfig.putAll(additionalConfig); trim(baseConfig); } private void migrateDatabase() { final GraphDatabaseService graphDb = getService(NodeService.class).getGraphDb(); final SecurityContext superUserContext = SecurityContext.getSuperUserInstance(); final NodeFactory nodeFactory = new NodeFactory(superUserContext); final RelationshipFactory relFactory = new RelationshipFactory(superUserContext); final App app = StructrApp.getInstance(); final StringProperty uuidProperty = new StringProperty("uuid"); final int txLimit = 2000; boolean hasChanges = true; int actualNodeCount = 0; int actualRelCount = 0; logger.log(Level.INFO, "Migration of ID properties from uuid to id requested."); while (hasChanges) { hasChanges = false; try (final Tx tx = app.tx(false, false)) { // iterate over all nodes, final Iterator<Node> allNodes = GlobalGraphOperations.at(graphDb).getAllNodes().iterator(); while (allNodes.hasNext()) { final Node node = allNodes.next(); // do migration of our own ID properties (and only our own!) if (node.hasProperty("uuid") && node.getProperty("uuid") instanceof String && !node.hasProperty("id")) { try { final NodeInterface nodeInterface = nodeFactory.instantiate(node); final String uuid = nodeInterface.getProperty(uuidProperty); if (uuid != null) { nodeInterface.setProperty(GraphObject.id, uuid); nodeInterface.removeProperty(uuidProperty); actualNodeCount++; hasChanges = true; } } catch (Throwable t) { t.printStackTrace(); } } // break out of loop to allow transaction to commit if (hasChanges && (actualNodeCount % txLimit) == 0) { break; } } tx.success(); } catch (Throwable t) { t.printStackTrace(); } logger.log(Level.INFO, "Migrated {0} nodes so far.", actualNodeCount); } logger.log(Level.INFO, "Migrated {0} nodes to new ID property.", actualNodeCount); // iterate over all relationships hasChanges = true; while (hasChanges) { hasChanges = false; try (final Tx tx = app.tx(false, false)) { final Iterator<Relationship> allRels = GlobalGraphOperations.at(graphDb).getAllRelationships().iterator(); while (allRels.hasNext()) { final Relationship rel = allRels.next(); // do migration of our own ID properties (and only our own!) if (rel.hasProperty("uuid") && rel.getProperty("uuid") instanceof String && !rel.hasProperty("id")) { try { final RelationshipInterface relInterface = relFactory.instantiate(rel); final String uuid = relInterface.getProperty(uuidProperty); if (uuid != null) { relInterface.setProperty(GraphObject.id, uuid); relInterface.removeProperty(uuidProperty); actualRelCount++; hasChanges = true; } } catch (Throwable t) { t.printStackTrace(); } } // break out of loop to allow transaction to commit if (hasChanges && (actualRelCount % txLimit) == 0) { break; } } tx.success(); } catch (Throwable t) { t.printStackTrace(); } logger.log(Level.INFO, "Migrated {0} relationships so far.", actualRelCount); } logger.log(Level.INFO, "Migrated {0} relationships to new ID property.", actualRelCount); } public static String trim(final String value) { return StringUtils.trim(value); } public static void trim(StructrConf properties) { for (Object k : properties.keySet()) { properties.put(k, trim((String) properties.get(k))); } } /** * Tries to parse the given String to an int value, returning * defaultValue on error. * * @param value the source String to parse * @param defaultValue the default value that will be returned when parsing fails * @return the parsed value or the given default value when parsing fails */ public static int parseInt(String value, int defaultValue) { if (StringUtils.isBlank(value)) { return defaultValue; } try { return Integer.parseInt(value); } catch (NumberFormatException ignore) {} return defaultValue; } public static boolean parseBoolean(String value, boolean defaultValue) { if (StringUtils.isBlank(value)) { return defaultValue; } try { return Boolean.parseBoolean(value); } catch(Throwable ignore) {} return defaultValue; } public static int getGlobalSessionTimeout() { if (globalSessionTimeout == -1) { globalSessionTimeout = parseInt(Services.getInstance().getConfigurationValue(APPLICATION_SESSION_TIMEOUT, "1800"), 1800); } return globalSessionTimeout; } public static Set<Permission> getPermissionsForOwnerlessNodes() { return getInstance().permissionsForOwnerlessNodes; } // ----- nested classes ----- public static interface InitializationCallback { public void initializationDone(); } }
3e03b127ae61688dea82b90b3ec05a0ebb0353c2
450
java
Java
chapter_004/src/main/java/ru/job4j/generic/User.java
SeleznevDenis/dseleznev
e2854b61185163fd572bd87d38aa6d885c98d4b4
[ "Apache-2.0" ]
8
2018-04-20T14:31:48.000Z
2019-11-05T10:55:39.000Z
chapter_004/src/main/java/ru/job4j/generic/User.java
SeleznevDenis/dseleznev
e2854b61185163fd572bd87d38aa6d885c98d4b4
[ "Apache-2.0" ]
null
null
null
chapter_004/src/main/java/ru/job4j/generic/User.java
SeleznevDenis/dseleznev
e2854b61185163fd572bd87d38aa6d885c98d4b4
[ "Apache-2.0" ]
4
2018-07-29T05:33:19.000Z
2021-02-16T12:16:54.000Z
16.071429
50
0.58
1,525
package ru.job4j.generic; import java.util.Objects; /** * @author Denis Seleznev * @version $Id$ * @since 31.03.2018 */ public class User extends Base { private String name; /** * Конструктор, инициализирует поля id и name. * @param id * @param name */ protected User(String id, String name) { super(id); this.name = name; } public String getName() { return this.name; } }
3e03b1a0545b2e0a4ca3a9d52d37b61493ef76db
2,135
java
Java
app/src/main/java/com/a520it/mobilsafe/dao/CommonNumDAO.java
qiu-yongheng/mobilesafe
29d936f658f76b76428557b3df14a16645ec1c1d
[ "Apache-2.0" ]
1
2018-12-12T12:20:07.000Z
2018-12-12T12:20:07.000Z
app/src/main/java/com/a520it/mobilsafe/dao/CommonNumDAO.java
qiu-yongheng/mobilesafe
29d936f658f76b76428557b3df14a16645ec1c1d
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/a520it/mobilsafe/dao/CommonNumDAO.java
qiu-yongheng/mobilesafe
29d936f658f76b76428557b3df14a16645ec1c1d
[ "Apache-2.0" ]
null
null
null
26.358025
147
0.6
1,526
package com.a520it.mobilsafe.dao; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; /** * @author 邱永恒 * @time 2016/7/30 13:36 * @desc ${TODD} */ public class CommonNumDAO { /** * 查询最外层的listView个数 * @param db * @return */ public static int getGroupCount(SQLiteDatabase db) { Cursor cursor = db.rawQuery("select count(*) from classlist", null); cursor.moveToNext(); int count = cursor.getInt(0); return count; } /** * 查询没给父控件对应的子listView个数 * @return */ public static int getChildrenCount(SQLiteDatabase db, int groupPosition) { //安卓的索引是从0开始 int newPosition = groupPosition + 1; //获取要查询的表名 String tableName = "table" + newPosition; //查询 Cursor cursor = db.rawQuery("select count(*) from " + tableName, null); cursor.moveToNext(); int childCount = cursor.getInt(0); return childCount; } /** * 查询分组的名称 * @return */ public static String getGroupView(SQLiteDatabase db, int groupPosition) { String name = null; int newPosition = groupPosition + 1; //查询 Cursor cursor = db.query("classlist", new String[]{"name"}, "idx=?", new String[]{String.valueOf(newPosition)}, null, null, null); cursor.moveToNext(); name = cursor.getString(0); return name; } /** * 查询每个分组里孩子的名称 * @param db * @param groupPosition * @param childPosition * @return */ public static String getChilderView(SQLiteDatabase db, int groupPosition, int childPosition) { int newGroupPosition = groupPosition + 1; int newChildPosition = childPosition + 1; //获取分组表名 String table = "table" + newGroupPosition; Cursor cursor = db.query(table, new String[]{"number", "name"}, "_id=?", new String[]{String.valueOf(newChildPosition)}, null, null, null); cursor.moveToNext(); String number = cursor.getString(0); String name = cursor.getString(1); return name + "\n" + number; } }
3e03b247d625e90693d9f8cef1d117625904e8b9
1,872
java
Java
semantic-mdx/semantic-common/src/main/java/io/kylin/mdx/insight/common/MdxGlobalContext.java
Emiya0306/mdx-kylin
a3e44cd92bbfdf746010ca75400789263e9a7944
[ "Apache-2.0" ]
7
2022-03-14T05:02:38.000Z
2022-03-29T10:24:48.000Z
semantic-mdx/semantic-common/src/main/java/io/kylin/mdx/insight/common/MdxGlobalContext.java
Emiya0306/mdx-kylin
a3e44cd92bbfdf746010ca75400789263e9a7944
[ "Apache-2.0" ]
3
2022-03-21T03:22:26.000Z
2022-03-31T01:42:02.000Z
semantic-mdx/semantic-common/src/main/java/io/kylin/mdx/insight/common/MdxGlobalContext.java
Emiya0306/mdx-kylin
a3e44cd92bbfdf746010ca75400789263e9a7944
[ "Apache-2.0" ]
1
2022-03-22T09:54:21.000Z
2022-03-22T09:54:21.000Z
30.688525
103
0.724359
1,527
package io.kylin.mdx.insight.common; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; public class MdxGlobalContext { private static final AtomicBoolean INIT_STATUS = new AtomicBoolean(true); private static final AtomicBoolean SYNC_STATUS = new AtomicBoolean(false); private static final AtomicBoolean FIRST_VERIFY = new AtomicBoolean(true); private static final ConcurrentHashMap<String, String> USER_TO_PWD_MAP = new ConcurrentHashMap<>(); private static final AtomicBoolean METADATA_STATUS = new AtomicBoolean(true); public static String getPassword(String username) { return USER_TO_PWD_MAP.get(username); } public static void setPassword(String username, String password) { USER_TO_PWD_MAP.put(username, password); } public static boolean isInitStatus() { return INIT_STATUS.get(); } public static boolean getAndSetInitStatus(boolean oldEnable, boolean newEnable) { return INIT_STATUS.compareAndSet(oldEnable, newEnable); } public static boolean isMetadataStatus() { return METADATA_STATUS.get(); } public static boolean getAndSetMetadataStatus(boolean oldEnable, boolean newEnable) { return METADATA_STATUS.compareAndSet(oldEnable, newEnable); } public static boolean isSyncStatus() { return SYNC_STATUS.get(); } public static boolean getAndSetSyncStatus(boolean oldEnable, boolean newEnable) { return SYNC_STATUS.compareAndSet(oldEnable, newEnable); } public static String getSyncStatus() { return SYNC_STATUS.get() ? "active" : "inactive"; } public static boolean isFirstVerify() { return FIRST_VERIFY.get(); } public static void setFirstVerify(boolean firstVerify) { FIRST_VERIFY.set(firstVerify); } }
3e03b2e76be4cd90b74232d0d9f33b850e9429dd
4,073
java
Java
modules/module-audit/src/main/java/org/gov/uk/homeoffice/digital/permissions/passenger/audit/AuditService.java
UKHomeOffice/passenger
a304c6c601dd67999c4cc9e9bf4d9c760bc5110c
[ "MIT" ]
null
null
null
modules/module-audit/src/main/java/org/gov/uk/homeoffice/digital/permissions/passenger/audit/AuditService.java
UKHomeOffice/passenger
a304c6c601dd67999c4cc9e9bf4d9c760bc5110c
[ "MIT" ]
null
null
null
modules/module-audit/src/main/java/org/gov/uk/homeoffice/digital/permissions/passenger/audit/AuditService.java
UKHomeOffice/passenger
a304c6c601dd67999c4cc9e9bf4d9c760bc5110c
[ "MIT" ]
1
2021-04-11T09:23:42.000Z
2021-04-11T09:23:42.000Z
38.790476
118
0.662165
1,528
package org.gov.uk.homeoffice.digital.permissions.passenger.audit; import io.micrometer.core.instrument.Counter; import io.micrometer.core.instrument.MeterRegistry; import org.gov.uk.homeoffice.digital.permissions.passenger.audit.domain.Audit; import org.jdbi.v3.core.Jdbi; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Service; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalDate; import java.util.Collection; import static java.time.LocalDateTime.now; @Service public class AuditService { private static final Logger LOGGER = LoggerFactory.getLogger(AuditService.class); public static final String PASSENGER = "PASSENGER"; private final Jdbi dbi; private final Counter counter; @Autowired public AuditService(final Jdbi dbi, final MeterRegistry meterRegistry) { this.dbi = dbi; this.counter = meterRegistry.counter("audit", "error", "count"); } public void audit(final String action, final String result) { audit(action, result, null, null, null); } public void audit(final String action, final String result, final String passengerName, final String passengerEmail, final String passengerPassportNumber) { final String user = SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString(); audit(action, result, user, passengerName, passengerEmail, passengerPassportNumber); } public void auditForPublicUser(final String action, final String result, final String passengerName, final String passengerEmail, final String passengerPassportNumber) { audit(action, result, PASSENGER, passengerName, passengerEmail, passengerPassportNumber); } public void audit(final String action, final String result, final String user, final String passengerName, final String passengerEmail, final String passengerPassportNumber) { audit(new Audit(null, user, now(), result, action, passengerName, passengerEmail, passengerPassportNumber)); } public void audit(final Audit audit) { try { final AuditDAO dao = dbi.onDemand(AuditDAO.class); dao.insert(audit); } catch (Exception e) { LOGGER.error(e.getMessage(), e); counter.count(); } } public Collection<Audit> findByPassportNumber(final String passportNumber) { return dbi.withHandle(new FindByPassportNumber(passportNumber)); } public Collection<Audit> findByPassengerEmail(final String emailAddress) { return dbi.withHandle(new FindByPassengerEmail(emailAddress)); } public Collection<Audit> findByPassengerName(final String name) { return dbi.withHandle(new FindByPassengerName(name)); } public Collection<Audit> findByAdminEmail(final String emailAddress) { return dbi.withHandle(new FindByAdminEmail(emailAddress)); } public Collection<Audit> findByQuery(final String adminEmailAddress, final String passengerEmailAddress, final String passengerPassportNumber, final String passengerName, final LocalDate from, final LocalDate to) { return dbi.withHandle(new FindByQuery(adminEmailAddress, passengerEmailAddress, passengerPassportNumber, passengerName, from, to)); } public Collection<Audit> findByDateRange(final LocalDate from, final LocalDate to) { return dbi.withHandle(new FindByDateRange(from, to)); } }
3e03b30b6c992152efff9ee3290839a2a0a728a4
2,126
java
Java
gallery-files/src/main/java/eu/daxiongmao/prv/wordpress/service/OrchestrationService.java
guihome-diaz/java
ae9b5ff209b2714f2d067b0a4ce5807f78997233
[ "Apache-2.0" ]
null
null
null
gallery-files/src/main/java/eu/daxiongmao/prv/wordpress/service/OrchestrationService.java
guihome-diaz/java
ae9b5ff209b2714f2d067b0a4ce5807f78997233
[ "Apache-2.0" ]
null
null
null
gallery-files/src/main/java/eu/daxiongmao/prv/wordpress/service/OrchestrationService.java
guihome-diaz/java
ae9b5ff209b2714f2d067b0a4ce5807f78997233
[ "Apache-2.0" ]
null
null
null
36.655172
116
0.711665
1,529
package eu.daxiongmao.prv.wordpress.service; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; import java.util.Map; import java.util.Properties; import org.apache.commons.net.ftp.FTPFile; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import eu.daxiongmao.prv.wordpress.model.files.DirectoryContent; public class OrchestrationService { private static final Logger LOGGER = LoggerFactory.getLogger(OrchestrationService.class); private FtpService ftpService = new FtpService(); private FileService fileService = new FileService(); private AppPropertiesService appPropertiesService = new AppPropertiesService(); public void downloadGalleries() { // Get properties final Properties properties = appPropertiesService.loadApplicationProperties(); final String ftpHost = properties.getProperty("ftp.url"); final int ftpPort = Integer.parseInt(properties.getProperty("ftp.port")); final String ftpUsername = properties.getProperty("ftp.username"); final String ftpPassword = properties.getProperty("ftp.password"); final String wordpressRelativePath = properties.getProperty("wordpress.relativePath"); // Get backup folder (we suppose previous check has been made to ensure it is correct) final String backupFolder = properties.getProperty("backup.local.path"); final Path backupPath = Paths.get(backupFolder); try { // Connect to FTP and get content ftpService.connect(ftpHost, ftpPort, ftpUsername, ftpPassword); // Get local files final List<DirectoryContent> localDirectories = fileService.getDirectories(backupPath); // Get FTP files final Map<String, FTPFile> ftpFiles = ftpService.listAllGalleriesAndTheirContent(wordpressRelativePath); // TODO extract list of files to download } catch (final Exception e) { LOGGER.error("failed to backup galleries files", e); } finally { ftpService.waitForAllDownloadsThenDisconnect(); } } }
3e03b384e2a13998c0727ff0df0a3416459ce1d6
1,643
java
Java
src/test/java/de/hpi/bpt/chimera/execution/FragmentSequentialTest.java
bptlab/chimera
7eb106cc3b14d2e62d0c7ae69929a7151b3c8ef8
[ "MIT" ]
14
2016-08-23T15:58:19.000Z
2021-07-23T09:34:24.000Z
src/test/java/de/hpi/bpt/chimera/execution/FragmentSequentialTest.java
bptlab/chimera
7eb106cc3b14d2e62d0c7ae69929a7151b3c8ef8
[ "MIT" ]
156
2017-03-15T11:52:21.000Z
2020-06-18T15:43:02.000Z
src/test/java/de/hpi/bpt/chimera/execution/FragmentSequentialTest.java
bptlab/chimera
7eb106cc3b14d2e62d0c7ae69929a7151b3c8ef8
[ "MIT" ]
6
2017-10-22T22:25:54.000Z
2021-01-26T03:30:21.000Z
36.511111
121
0.811929
1,530
package de.hpi.bpt.chimera.execution; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; import de.hpi.bpt.chimera.CaseExecutionerTestHelper; import de.hpi.bpt.chimera.CaseModelTestHelper; import de.hpi.bpt.chimera.model.CaseModel; import de.hpi.bpt.chimera.persistencemanager.CaseModelManager; /** * Test that a new fragment instance will be created after the End Event was * reached. */ public class FragmentSequentialTest { private final String filepath = "src/test/resources/execution/SequentialFragmentInstantiationTest.json"; private CaseExecutioner caseExecutioner; @Before public void setUp() { String json = CaseModelTestHelper.getJsonString(filepath); CaseModel cm = CaseModelManager.parseCaseModel(json); caseExecutioner = ExecutionService.createCaseExecutioner(cm, cm.getName()); caseExecutioner.startCase(); } @Test public void testSequentialFragmentInstantiation() { String fragmentName = "Default Fragment"; FragmentInstance fragmentInstance = CaseExecutionerTestHelper.getFragmentInstanceByName(caseExecutioner, fragmentName); String activityName = "First Task"; CaseExecutionerTestHelper.executeHumanTaskInstance(caseExecutioner, fragmentInstance, activityName); int fragmentInstanceAmount = caseExecutioner.getCase().getFragmentInstances().size(); assertEquals(1, fragmentInstanceAmount); activityName = "Second Task"; CaseExecutionerTestHelper.executeHumanTaskInstance(caseExecutioner, fragmentInstance, activityName); fragmentInstanceAmount = caseExecutioner.getCase().getFragmentInstances().size(); assertEquals(2, fragmentInstanceAmount); } }
3e03b4a7e18f13d2b275fbf6813bc5319e2fa7df
2,138
java
Java
renren-web/src/main/java/io/renren/course/entity/CourseTableFormatEntity.java
liao1565553/renren-security-master
b6bad616662140f0d14556a2021c63f59aefd458
[ "Apache-2.0" ]
null
null
null
renren-web/src/main/java/io/renren/course/entity/CourseTableFormatEntity.java
liao1565553/renren-security-master
b6bad616662140f0d14556a2021c63f59aefd458
[ "Apache-2.0" ]
null
null
null
renren-web/src/main/java/io/renren/course/entity/CourseTableFormatEntity.java
liao1565553/renren-security-master
b6bad616662140f0d14556a2021c63f59aefd458
[ "Apache-2.0" ]
2
2017-11-07T12:32:35.000Z
2019-01-17T04:33:36.000Z
16.446154
68
0.726848
1,531
package io.renren.course.entity; import java.io.Serializable; import java.util.Date; import com.alibaba.fastjson.annotation.JSONField; public class CourseTableFormatEntity implements Serializable { /** * */ private static final long serialVersionUID = -6271270439012687813L; private Integer classtimeId; private String classtimeName; @JSONField (format="HH:mm") private Date startTime; @JSONField (format="HH:mm") private Date endTime; private CourseTableEntity mon; private CourseTableEntity tues; private CourseTableEntity wed; private CourseTableEntity thur; private CourseTableEntity fri; private CourseTableEntity sat; private CourseTableEntity sun; public Date getStartTime() { return startTime; } public void setStartTime(Date startTime) { this.startTime = startTime; } public Date getEndTime() { return endTime; } public void setEndTime(Date endTime) { this.endTime = endTime; } public Integer getClasstimeId() { return classtimeId; } public void setClasstimeId(Integer classtimeId) { this.classtimeId = classtimeId; } public String getClasstimeName() { return classtimeName; } public void setClasstimeName(String classtimeName) { this.classtimeName = classtimeName; } public CourseTableEntity getMon() { return mon; } public void setMon(CourseTableEntity mon) { this.mon = mon; } public CourseTableEntity getTues() { return tues; } public void setTues(CourseTableEntity tues) { this.tues = tues; } public CourseTableEntity getWed() { return wed; } public void setWed(CourseTableEntity wed) { this.wed = wed; } public CourseTableEntity getThur() { return thur; } public void setThur(CourseTableEntity thur) { this.thur = thur; } public CourseTableEntity getFri() { return fri; } public void setFri(CourseTableEntity fri) { this.fri = fri; } public CourseTableEntity getSat() { return sat; } public void setSat(CourseTableEntity sat) { this.sat = sat; } public CourseTableEntity getSun() { return sun; } public void setSun(CourseTableEntity sun) { this.sun = sun; } }
3e03b5656a098b24b23bf87bef784dcd86e1fa9a
7,056
java
Java
app/src/main/java/pub/kanzhibo/app/common/widget/RoundImageView.java
fanturbo/Kanzhibo
26b4780369143684c459c68e5ba3e5f253fb812e
[ "Apache-1.1" ]
77
2017-01-19T09:23:04.000Z
2021-11-25T08:58:04.000Z
app/src/main/java/pub/kanzhibo/app/common/widget/RoundImageView.java
fanturbo/Kanzhibo
26b4780369143684c459c68e5ba3e5f253fb812e
[ "Apache-1.1" ]
2
2017-01-22T02:40:15.000Z
2018-01-24T01:40:12.000Z
app/src/main/java/pub/kanzhibo/app/common/widget/RoundImageView.java
fanturbo/Kanzhibo
26b4780369143684c459c68e5ba3e5f253fb812e
[ "Apache-1.1" ]
20
2017-03-05T19:07:57.000Z
2019-09-09T09:18:21.000Z
29.037037
82
0.590136
1,532
package pub.kanzhibo.app.common.widget; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.RectF; import android.graphics.Shader.TileMode; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Parcelable; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.widget.ImageView; import pub.kanzhibo.app.R; /** * http://blog.csdn.net/lmj623565791/article/details/41967509 * * @author zhy */ public class RoundImageView extends ImageView { /** * 图片的类型,圆形or圆角 */ private int type; public static final int TYPE_CIRCLE = 0; public static final int TYPE_ROUND = 1; /** * 圆角大小的默认值 */ private static final int BODER_RADIUS_DEFAULT = 10; /** * 圆角的大小 */ private int mBorderRadius; /** * 绘图的Paint */ private Paint mBitmapPaint; /** * 圆角的半径 */ private int mRadius; /** * 3x3 矩阵,主要用于缩小放大 */ private Matrix mMatrix; /** * 渲染图像,使用图像为绘制图形着色 */ private BitmapShader mBitmapShader; /** * view的宽度 */ private int mWidth; private RectF mRoundRect; public RoundImageView(Context context, AttributeSet attrs) { super(context, attrs); mMatrix = new Matrix(); mBitmapPaint = new Paint(); mBitmapPaint.setAntiAlias(true); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundImageView); mBorderRadius = a.getDimensionPixelSize( R.styleable.RoundImageView_borderRadius, (int) TypedValue .applyDimension(TypedValue.COMPLEX_UNIT_DIP, BODER_RADIUS_DEFAULT, getResources() .getDisplayMetrics()));// 默认为10dp type = a.getInt(R.styleable.RoundImageView_type, TYPE_CIRCLE);// 默认为Circle a.recycle(); } public RoundImageView(Context context) { this(context, null); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); /** * 如果类型是圆形,则强制改变view的宽高一致,以小值为准 */ if (type == TYPE_CIRCLE) { mWidth = Math.min(getMeasuredWidth(), getMeasuredHeight()); mRadius = mWidth / 2; setMeasuredDimension(mWidth, mWidth); } } /** * 初始化BitmapShader */ private void setUpShader() { Drawable drawable = getDrawable(); if (drawable == null) { return; } Bitmap bmp = drawableToBitamp(drawable); // 将bmp作为着色器,就是在指定区域内绘制bmp mBitmapShader = new BitmapShader(bmp, TileMode.CLAMP, TileMode.CLAMP); float scale = 1.0f; float widthScale = 1.0f; float heightScale = 1.0f; if (type == TYPE_CIRCLE) { // 拿到bitmap宽或高的小值 int bSize = Math.min(bmp.getWidth(), bmp.getHeight()); scale = mWidth * 1.0f / bSize; // shader的变换矩阵,我们这里主要用于放大或者缩小 mMatrix.setScale(scale, scale); } else if (type == TYPE_ROUND) { Log.e("TAG", "b'w = " + bmp.getWidth() + " , " + "b'h = " + bmp.getHeight()); if (!(bmp.getWidth() == getWidth())) { widthScale = getWidth() * 1.0f / bmp.getWidth(); } if (!(bmp.getHeight() == getHeight())) { heightScale = getHeight() * 1.0f / bmp.getHeight(); } // shader的变换矩阵,我们这里主要用于放大或者缩小 mMatrix.setScale(widthScale, heightScale); } // 设置变换矩阵 mBitmapShader.setLocalMatrix(mMatrix); // 设置shader mBitmapPaint.setShader(mBitmapShader); } @Override protected void onDraw(Canvas canvas) { Log.e("TAG", "onDraw"); if (getDrawable() == null) { return; } setUpShader(); if (type == TYPE_ROUND) { canvas.drawRoundRect(mRoundRect, mBorderRadius, mBorderRadius, mBitmapPaint); } else { canvas.drawCircle(mRadius, mRadius, mRadius, mBitmapPaint); // drawSomeThing(canvas); } } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); // 圆角图片的范围 if (type == TYPE_ROUND) mRoundRect = new RectF(0, 0, w, h); } /** * drawable转bitmap * * @param drawable * @return */ private Bitmap drawableToBitamp(Drawable drawable) { if (drawable instanceof BitmapDrawable) { BitmapDrawable bd = (BitmapDrawable) drawable; return bd.getBitmap(); } int w = drawable.getIntrinsicWidth(); int h = drawable.getIntrinsicHeight(); Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, w, h); drawable.draw(canvas); return bitmap; } private static final String STATE_INSTANCE = "state_instance"; private static final String STATE_TYPE = "state_type"; private static final String STATE_BORDER_RADIUS = "state_border_radius"; @Override protected Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable(STATE_INSTANCE, super.onSaveInstanceState()); bundle.putInt(STATE_TYPE, type); bundle.putInt(STATE_BORDER_RADIUS, mBorderRadius); return bundle; } @Override protected void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; super.onRestoreInstanceState(((Bundle) state) .getParcelable(STATE_INSTANCE)); this.type = bundle.getInt(STATE_TYPE); this.mBorderRadius = bundle.getInt(STATE_BORDER_RADIUS); } else { super.onRestoreInstanceState(state); } } public void setBorderRadius(int borderRadius) { int pxVal = dp2px(borderRadius); if (this.mBorderRadius != pxVal) { this.mBorderRadius = pxVal; invalidate(); } } public void setType(int type) { if (this.type != type) { this.type = type; if (this.type != TYPE_ROUND && this.type != TYPE_CIRCLE) { this.type = TYPE_CIRCLE; } requestLayout(); } } public int dp2px(int dpVal) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpVal, getResources().getDisplayMetrics()); } }
3e03b60ca539d5e4e75e0f69299fb7475e788be9
4,298
java
Java
src/test/java/org/ndexbio/model/object/MembershipTest.java
Ceofy/ndex-object-model
52316ea58984bf6c3e7f92713f5671cd7379edcc
[ "BSD-3-Clause" ]
3
2019-08-14T20:37:16.000Z
2021-08-03T12:52:17.000Z
src/test/java/org/ndexbio/model/object/MembershipTest.java
Ceofy/ndex-object-model
52316ea58984bf6c3e7f92713f5671cd7379edcc
[ "BSD-3-Clause" ]
null
null
null
src/test/java/org/ndexbio/model/object/MembershipTest.java
Ceofy/ndex-object-model
52316ea58984bf6c3e7f92713f5671cd7379edcc
[ "BSD-3-Clause" ]
5
2015-06-16T00:39:55.000Z
2019-09-19T17:21:48.000Z
34.111111
134
0.722662
1,533
/** * Copyright (c) 2013, 2016, The Regents of the University of California, The Cytoscape Consortium * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ package org.ndexbio.model.object; import static org.junit.Assert.*; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import java.util.UUID; import org.junit.BeforeClass; import org.junit.Test; import org.ndexbio.model.cx.SupportElement; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; public class MembershipTest { static ObjectMapper mapper; @BeforeClass public static void setup() { mapper = new ObjectMapper(); // create once, reuse } @Test public void testMembershipDeserialize() throws JsonParseException, JsonMappingException, IOException, URISyntaxException { Membership m= mapper.readValue(new File(getClass().getClassLoader().getResource("membership.json").toURI()), Membership.class); assertEquals(m.getResourceName(), "foo"); assertEquals(m.getMemberAccountName(), "bar"); } @Test public void testMembership() throws JsonParseException, JsonMappingException, IOException { SupportElement cxs = new SupportElement (); cxs.setText("_:foobar"); String s0 = mapper.writeValueAsString( cxs); System.out.println(s0); Membership original = new Membership (); //set values // UUID eId = UUID.randomUUID(); // original.setExternalId( eId); original.setMemberAccountName("foo"); original.setMembershipType(MembershipType.GROUP); original.setMemberUUID(UUID.randomUUID()); original.setPermissions(Permissions.ADMIN); original.setResourceName("bar"); original.setResourceUUID(UUID.randomUUID()); // serialize object String s = mapper.writeValueAsString( original); System.out.println (s); Membership m = mapper.readValue(s, Membership.class); // assertEquals(m.getExternalId(), eId); assertEquals(m.getMemberAccountName(), original.getMemberAccountName()); assertEquals(m.getMembershipType(), original.getMembershipType()); assertEquals(m.getMemberUUID(), original.getMemberUUID()); assertEquals(m.getPermissions(), original.getPermissions()); assertEquals(m.getResourceName(), original.getResourceName()); assertEquals(m.getResourceUUID(), original.getResourceUUID()); // assertEquals(m.getCreationDate(), original.getCreationDate()); // assertEquals(m.getModificationDate(), original.getModificationDate()); // assertEquals(m.getType(), "Membership"); } }
3e03b68beba39cfbc44de943b090bf7be1696f53
1,873
java
Java
rhymecity/src/main/java/com/fly/firefly/api/obj/PassengerInfoReveice.java
zatyabdullah/Fy
89315a367faa98b47c448b2a00e18d7b966f776e
[ "MIT" ]
null
null
null
rhymecity/src/main/java/com/fly/firefly/api/obj/PassengerInfoReveice.java
zatyabdullah/Fy
89315a367faa98b47c448b2a00e18d7b966f776e
[ "MIT" ]
null
null
null
rhymecity/src/main/java/com/fly/firefly/api/obj/PassengerInfoReveice.java
zatyabdullah/Fy
89315a367faa98b47c448b2a00e18d7b966f776e
[ "MIT" ]
null
null
null
20.139785
65
0.58409
1,534
package com.fly.firefly.api.obj; import java.util.ArrayList; import java.util.List; /** * Created by Dell on 12/15/2015. */ public class PassengerInfoReveice { private String status; private PassengerInfoReveice Obj; private insurance insurance; public String getBooking_id() { return booking_id; } public void setBooking_id(String booking_id) { this.booking_id = booking_id; } private String booking_id; public insurance getInsuranceObj() { return insurance; } public void setInsuranceObj(insurance insuranceObj) { this.insurance = insuranceObj; } public class insurance{ private String status; private String code; private String logo; private ArrayList<String> html = new ArrayList<String>(); public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getLogo() { return logo; } public void setLogo(String logo) { this.logo = logo; } public ArrayList<String> getHtml() { return html; } public void setHtml(ArrayList<String> html) { this.html = html; } } public PassengerInfoReveice(PassengerInfoReveice param_obj){ this.Obj = param_obj; } public PassengerInfoReveice getObj() { return Obj; } public void setObj(PassengerInfoReveice obj) { Obj = obj; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } }
3e03b693e7d099ce003b52a9f221b1b58868e002
2,055
java
Java
src/main/java/org/durid/sql/dialect/mysql/ast/statement/MySqlShowProfileStatement.java
lane-cn/elasticdb
9e5e0171e9136590ca002f1c1c96cdcc1634ec55
[ "Apache-2.0" ]
2
2015-02-12T08:36:21.000Z
2020-07-07T09:11:17.000Z
src/main/java/org/durid/sql/dialect/mysql/ast/statement/MySqlShowProfileStatement.java
lane-cn/elasticdb
9e5e0171e9136590ca002f1c1c96cdcc1634ec55
[ "Apache-2.0" ]
null
null
null
src/main/java/org/durid/sql/dialect/mysql/ast/statement/MySqlShowProfileStatement.java
lane-cn/elasticdb
9e5e0171e9136590ca002f1c1c96cdcc1634ec55
[ "Apache-2.0" ]
null
null
null
27.039474
103
0.66326
1,535
/* * Copyright 1999-2011 Alibaba Group Holding Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.durid.sql.dialect.mysql.ast.statement; import java.util.ArrayList; import java.util.List; import org.durid.sql.ast.SQLExpr; import org.durid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.Limit; import org.durid.sql.dialect.mysql.visitor.MySqlASTVisitor; public class MySqlShowProfileStatement extends MySqlStatementImpl { private static final long serialVersionUID = 1L; private List<Type> types = new ArrayList<Type>(); private SQLExpr forQuery; private Limit limit; public void accept0(MySqlASTVisitor visitor) { visitor.visit(this); visitor.endVisit(this); } public List<Type> getTypes() { return types; } public void setTypes(List<Type> types) { this.types = types; } public SQLExpr getForQuery() { return forQuery; } public void setForQuery(SQLExpr forQuery) { this.forQuery = forQuery; } public Limit getLimit() { return limit; } public void setLimit(Limit limit) { this.limit = limit; } public static enum Type { ALL("ALL"), BLOCK_IO("BLOCK IO"), CONTEXT_SWITCHES("CONTEXT SWITCHES"), CPU("CPU"), IPC("IPC"), MEMORY("MEMORY"), PAGE_FAULTS("PAGE FAULTS"), SOURCE("SOURCE"), SWAPS("SWAPS"); public final String name; Type(String name){ this.name = name; } } }
3e03b70ddbe9336c00f0cf8d23709a6b46401f78
14,808
java
Java
jdk1.8-source-analysis/src/java/security/Identity.java
lhj502819/Java-Family-Bucket
95c48664e56ae37b74a393587ae2b218261d18ad
[ "Apache-2.0" ]
1,305
2018-03-11T15:04:26.000Z
2022-03-30T16:02:34.000Z
jdk1.8-source-analysis/src/java/security/Identity.java
lhj502819/Java-Family-Bucket
95c48664e56ae37b74a393587ae2b218261d18ad
[ "Apache-2.0" ]
7
2019-03-20T09:43:08.000Z
2021-08-20T03:19:24.000Z
jdk1.8-source-analysis/src/java/security/Identity.java
lhj502819/Java-Family-Bucket
95c48664e56ae37b74a393587ae2b218261d18ad
[ "Apache-2.0" ]
575
2018-03-11T15:15:41.000Z
2022-03-30T16:03:48.000Z
29.854839
80
0.607307
1,536
/* * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package java.security; import java.io.Serializable; import java.util.*; /** * <p>This class represents identities: real-world objects such as people, * companies or organizations whose identities can be authenticated using * their public keys. Identities may also be more abstract (or concrete) * constructs, such as daemon threads or smart cards. * * <p>All Identity objects have a name and a public key. Names are * immutable. Identities may also be scoped. That is, if an Identity is * specified to have a particular scope, then the name and public * key of the Identity are unique within that scope. * * <p>An Identity also has a set of certificates (all certifying its own * public key). The Principal names specified in these certificates need * not be the same, only the key. * * <p>An Identity can be subclassed, to include postal and email addresses, * telephone numbers, images of faces and logos, and so on. * * @see IdentityScope * @see Signer * @see Principal * * @author Benjamin Renaud * @deprecated This class is no longer used. Its functionality has been * replaced by {@code java.security.KeyStore}, the * {@code java.security.cert} package, and * {@code java.security.Principal}. */ @Deprecated public abstract class Identity implements Principal, Serializable { /** use serialVersionUID from JDK 1.1.x for interoperability */ private static final long serialVersionUID = 3609922007826600659L; /** * The name for this identity. * * @serial */ private String name; /** * The public key for this identity. * * @serial */ private PublicKey publicKey; /** * Generic, descriptive information about the identity. * * @serial */ String info = "No further information available."; /** * The scope of the identity. * * @serial */ IdentityScope scope; /** * The certificates for this identity. * * @serial */ Vector<Certificate> certificates; /** * Constructor for serialization only. */ protected Identity() { this("restoring..."); } /** * Constructs an identity with the specified name and scope. * * @param name the identity name. * @param scope the scope of the identity. * * @exception KeyManagementException if there is already an identity * with the same name in the scope. */ public Identity(String name, IdentityScope scope) throws KeyManagementException { this(name); if (scope != null) { scope.addIdentity(this); } this.scope = scope; } /** * Constructs an identity with the specified name and no scope. * * @param name the identity name. */ public Identity(String name) { this.name = name; } /** * Returns this identity's name. * * @return the name of this identity. */ public final String getName() { return name; } /** * Returns this identity's scope. * * @return the scope of this identity. */ public final IdentityScope getScope() { return scope; } /** * Returns this identity's public key. * * @return the public key for this identity. * * @see #setPublicKey */ public PublicKey getPublicKey() { return publicKey; } /** * Sets this identity's public key. The old key and all of this * identity's certificates are removed by this operation. * * <p>First, if there is a security manager, its {@code checkSecurityAccess} * method is called with {@code "setIdentityPublicKey"} * as its argument to see if it's ok to set the public key. * * @param key the public key for this identity. * * @exception KeyManagementException if another identity in the * identity's scope has the same public key, or if another exception occurs. * * @exception SecurityException if a security manager exists and its * {@code checkSecurityAccess} method doesn't allow * setting the public key. * * @see #getPublicKey * @see SecurityManager#checkSecurityAccess */ /* Should we throw an exception if this is already set? */ public void setPublicKey(PublicKey key) throws KeyManagementException { check("setIdentityPublicKey"); this.publicKey = key; certificates = new Vector<Certificate>(); } /** * Specifies a general information string for this identity. * * <p>First, if there is a security manager, its {@code checkSecurityAccess} * method is called with {@code "setIdentityInfo"} * as its argument to see if it's ok to specify the information string. * * @param info the information string. * * @exception SecurityException if a security manager exists and its * {@code checkSecurityAccess} method doesn't allow * setting the information string. * * @see #getInfo * @see SecurityManager#checkSecurityAccess */ public void setInfo(String info) { check("setIdentityInfo"); this.info = info; } /** * Returns general information previously specified for this identity. * * @return general information about this identity. * * @see #setInfo */ public String getInfo() { return info; } /** * Adds a certificate for this identity. If the identity has a public * key, the public key in the certificate must be the same, and if * the identity does not have a public key, the identity's * public key is set to be that specified in the certificate. * * <p>First, if there is a security manager, its {@code checkSecurityAccess} * method is called with {@code "addIdentityCertificate"} * as its argument to see if it's ok to add a certificate. * * @param certificate the certificate to be added. * * @exception KeyManagementException if the certificate is not valid, * if the public key in the certificate being added conflicts with * this identity's public key, or if another exception occurs. * * @exception SecurityException if a security manager exists and its * {@code checkSecurityAccess} method doesn't allow * adding a certificate. * * @see SecurityManager#checkSecurityAccess */ public void addCertificate(Certificate certificate) throws KeyManagementException { check("addIdentityCertificate"); if (certificates == null) { certificates = new Vector<Certificate>(); } if (publicKey != null) { if (!keyEquals(publicKey, certificate.getPublicKey())) { throw new KeyManagementException( "public key different from cert public key"); } } else { publicKey = certificate.getPublicKey(); } certificates.addElement(certificate); } private boolean keyEquals(PublicKey aKey, PublicKey anotherKey) { String aKeyFormat = aKey.getFormat(); String anotherKeyFormat = anotherKey.getFormat(); if ((aKeyFormat == null) ^ (anotherKeyFormat == null)) return false; if (aKeyFormat != null && anotherKeyFormat != null) if (!aKeyFormat.equalsIgnoreCase(anotherKeyFormat)) return false; return java.util.Arrays.equals(aKey.getEncoded(), anotherKey.getEncoded()); } /** * Removes a certificate from this identity. * * <p>First, if there is a security manager, its {@code checkSecurityAccess} * method is called with {@code "removeIdentityCertificate"} * as its argument to see if it's ok to remove a certificate. * * @param certificate the certificate to be removed. * * @exception KeyManagementException if the certificate is * missing, or if another exception occurs. * * @exception SecurityException if a security manager exists and its * {@code checkSecurityAccess} method doesn't allow * removing a certificate. * * @see SecurityManager#checkSecurityAccess */ public void removeCertificate(Certificate certificate) throws KeyManagementException { check("removeIdentityCertificate"); if (certificates != null) { certificates.removeElement(certificate); } } /** * Returns a copy of all the certificates for this identity. * * @return a copy of all the certificates for this identity. */ public Certificate[] certificates() { if (certificates == null) { return new Certificate[0]; } int len = certificates.size(); Certificate[] certs = new Certificate[len]; certificates.copyInto(certs); return certs; } /** * Tests for equality between the specified object and this identity. * This first tests to see if the entities actually refer to the same * object, in which case it returns true. Next, it checks to see if * the entities have the same name and the same scope. If they do, * the method returns true. Otherwise, it calls * {@link #identityEquals(Identity) identityEquals}, which subclasses should * override. * * @param identity the object to test for equality with this identity. * * @return true if the objects are considered equal, false otherwise. * * @see #identityEquals */ public final boolean equals(Object identity) { if (identity == this) { return true; } if (identity instanceof Identity) { Identity i = (Identity)identity; if (this.fullName().equals(i.fullName())) { return true; } else { return identityEquals(i); } } return false; } /** * Tests for equality between the specified identity and this identity. * This method should be overriden by subclasses to test for equality. * The default behavior is to return true if the names and public keys * are equal. * * @param identity the identity to test for equality with this identity. * * @return true if the identities are considered equal, false * otherwise. * * @see #equals */ protected boolean identityEquals(Identity identity) { if (!name.equalsIgnoreCase(identity.name)) return false; if ((publicKey == null) ^ (identity.publicKey == null)) return false; if (publicKey != null && identity.publicKey != null) if (!publicKey.equals(identity.publicKey)) return false; return true; } /** * Returns a parsable name for identity: identityName.scopeName */ String fullName() { String parsable = name; if (scope != null) { parsable += "." + scope.getName(); } return parsable; } /** * Returns a short string describing this identity, telling its * name and its scope (if any). * * <p>First, if there is a security manager, its {@code checkSecurityAccess} * method is called with {@code "printIdentity"} * as its argument to see if it's ok to return the string. * * @return information about this identity, such as its name and the * name of its scope (if any). * * @exception SecurityException if a security manager exists and its * {@code checkSecurityAccess} method doesn't allow * returning a string describing this identity. * * @see SecurityManager#checkSecurityAccess */ public String toString() { check("printIdentity"); String printable = name; if (scope != null) { printable += "[" + scope.getName() + "]"; } return printable; } /** * Returns a string representation of this identity, with * optionally more details than that provided by the * {@code toString} method without any arguments. * * <p>First, if there is a security manager, its {@code checkSecurityAccess} * method is called with {@code "printIdentity"} * as its argument to see if it's ok to return the string. * * @param detailed whether or not to provide detailed information. * * @return information about this identity. If {@code detailed} * is true, then this method returns more information than that * provided by the {@code toString} method without any arguments. * * @exception SecurityException if a security manager exists and its * {@code checkSecurityAccess} method doesn't allow * returning a string describing this identity. * * @see #toString * @see SecurityManager#checkSecurityAccess */ public String toString(boolean detailed) { String out = toString(); if (detailed) { out += "\n"; out += printKeys(); out += "\n" + printCertificates(); if (info != null) { out += "\n\t" + info; } else { out += "\n\tno additional information available."; } } return out; } String printKeys() { String key = ""; if (publicKey != null) { key = "\tpublic key initialized"; } else { key = "\tno public key"; } return key; } String printCertificates() { String out = ""; if (certificates == null) { return "\tno certificates"; } else { out += "\tcertificates: \n"; int i = 1; for (Certificate cert : certificates) { out += "\tcertificate " + i++ + "\tfor : " + cert.getPrincipal() + "\n"; out += "\t\t\tfrom : " + cert.getGuarantor() + "\n"; } } return out; } /** * Returns a hashcode for this identity. * * @return a hashcode for this identity. */ public int hashCode() { return name.hashCode(); } private static void check(String directive) { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkSecurityAccess(directive); } } }
3e03b79731cf1018d02ffae0479af1242611c48f
1,615
java
Java
src/main/java/com/example/demo/web/rest/ManufacturerRestController.java
fkenkov/Elektronska-Mobilna-Trgovija-Watch-Shop
671327dbe205ceaee818d9f3c4f70f545d6feea2
[ "FSFAP" ]
null
null
null
src/main/java/com/example/demo/web/rest/ManufacturerRestController.java
fkenkov/Elektronska-Mobilna-Trgovija-Watch-Shop
671327dbe205ceaee818d9f3c4f70f545d6feea2
[ "FSFAP" ]
null
null
null
src/main/java/com/example/demo/web/rest/ManufacturerRestController.java
fkenkov/Elektronska-Mobilna-Trgovija-Watch-Shop
671327dbe205ceaee818d9f3c4f70f545d6feea2
[ "FSFAP" ]
null
null
null
27.844828
88
0.728173
1,537
package com.example.demo.web.rest; import com.example.demo.model.Manufacturer; import com.example.demo.service.ManufacturerService; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; @RestController @RequestMapping("/api/manufacturers") public class ManufacturerRestController { private final ManufacturerService manufacturerService; public ManufacturerRestController(ManufacturerService manufacturerService) { this.manufacturerService = manufacturerService; } @GetMapping public List<Manufacturer> findAll(){ return this.manufacturerService.findAll(); } @GetMapping("/{id}") public Manufacturer findById(@PathVariable Long id){ return this.manufacturerService.findById(id); } @PostMapping public Manufacturer save(@Valid Manufacturer manufacturer){ return this.manufacturerService.save(manufacturer); } @GetMapping("/by-name") public List<Manufacturer> findAllByName(@RequestParam String name){ return this.manufacturerService.findAllByName(name); } @PutMapping("/{id}") public Manufacturer update(@PathVariable Long id, @Valid Manufacturer manufacturer){ return this.manufacturerService.update(id, manufacturer); } @PatchMapping("/{id}") public Manufacturer updateName(@PathVariable Long id, @RequestParam String name){ return this.manufacturerService.updateName(id, name); } @DeleteMapping("/{id}") void deleteById(@PathVariable Long id){ this.manufacturerService.deleteById(id); } }
3e03b7e383b228bfdf089f67e66f678e85ff4acf
6,990
java
Java
build/src/main/java/com/mypurecloud/sdk/v2/api/request/GetIntegrationsTypesRequest.java
deerghayu/platform-client-sdk-java
df466b7e231d1632ab9e669b0953b9a3289c3c34
[ "MIT" ]
null
null
null
build/src/main/java/com/mypurecloud/sdk/v2/api/request/GetIntegrationsTypesRequest.java
deerghayu/platform-client-sdk-java
df466b7e231d1632ab9e669b0953b9a3289c3c34
[ "MIT" ]
null
null
null
build/src/main/java/com/mypurecloud/sdk/v2/api/request/GetIntegrationsTypesRequest.java
deerghayu/platform-client-sdk-java
df466b7e231d1632ab9e669b0953b9a3289c3c34
[ "MIT" ]
null
null
null
29.004149
84
0.74721
1,538
package com.mypurecloud.sdk.v2.api.request; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import com.mypurecloud.sdk.v2.ApiException; import com.mypurecloud.sdk.v2.ApiClient; import com.mypurecloud.sdk.v2.ApiRequest; import com.mypurecloud.sdk.v2.ApiRequestBuilder; import com.mypurecloud.sdk.v2.ApiResponse; import com.mypurecloud.sdk.v2.Configuration; import com.mypurecloud.sdk.v2.model.*; import com.mypurecloud.sdk.v2.Pair; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; import com.mypurecloud.sdk.v2.model.Integration; import com.mypurecloud.sdk.v2.model.ErrorBody; import com.mypurecloud.sdk.v2.model.IntegrationConfiguration; import com.mypurecloud.sdk.v2.model.IntegrationEntityListing; import com.mypurecloud.sdk.v2.model.Action; import com.mypurecloud.sdk.v2.model.JsonSchemaDocument; import com.mypurecloud.sdk.v2.model.DraftValidationResult; import com.mypurecloud.sdk.v2.model.ActionEntityListing; import com.mypurecloud.sdk.v2.model.CategoryEntityListing; import com.mypurecloud.sdk.v2.model.ClientAppEntityListing; import com.mypurecloud.sdk.v2.model.Credential; import com.mypurecloud.sdk.v2.model.CredentialInfoListing; import com.mypurecloud.sdk.v2.model.CredentialTypeListing; import com.mypurecloud.sdk.v2.model.IntegrationEventEntityListing; import com.mypurecloud.sdk.v2.model.IntegrationEvent; import com.mypurecloud.sdk.v2.model.DialogflowAgent; import com.mypurecloud.sdk.v2.model.DialogflowAgentSummaryEntityListing; import com.mypurecloud.sdk.v2.model.LexBotAlias; import com.mypurecloud.sdk.v2.model.LexBotAliasEntityListing; import com.mypurecloud.sdk.v2.model.LexBotEntityListing; import com.mypurecloud.sdk.v2.model.TtsEngineEntity; import com.mypurecloud.sdk.v2.model.TtsVoiceEntity; import com.mypurecloud.sdk.v2.model.TtsVoiceEntityListing; import com.mypurecloud.sdk.v2.model.TtsEngineEntityListing; import com.mypurecloud.sdk.v2.model.TtsSettings; import com.mypurecloud.sdk.v2.model.IntegrationType; import com.mypurecloud.sdk.v2.model.IntegrationTypeEntityListing; import com.mypurecloud.sdk.v2.model.UpdateActionInput; import com.mypurecloud.sdk.v2.model.UpdateDraftInput; import com.mypurecloud.sdk.v2.model.CreateIntegrationRequest; import com.mypurecloud.sdk.v2.model.PublishDraftInput; import com.mypurecloud.sdk.v2.model.TestExecutionResult; import com.mypurecloud.sdk.v2.model.PostActionInput; import com.mypurecloud.sdk.v2.model.CredentialInfo; import com.mypurecloud.sdk.v2.model.UserActionCategoryEntityListing; import com.mypurecloud.sdk.v2.model.VendorConnectionRequest; public class GetIntegrationsTypesRequest { private Integer pageSize; public Integer getPageSize() { return this.pageSize; } public void setPageSize(Integer pageSize) { this.pageSize = pageSize; } public GetIntegrationsTypesRequest withPageSize(Integer pageSize) { this.setPageSize(pageSize); return this; } private Integer pageNumber; public Integer getPageNumber() { return this.pageNumber; } public void setPageNumber(Integer pageNumber) { this.pageNumber = pageNumber; } public GetIntegrationsTypesRequest withPageNumber(Integer pageNumber) { this.setPageNumber(pageNumber); return this; } private String sortBy; public String getSortBy() { return this.sortBy; } public void setSortBy(String sortBy) { this.sortBy = sortBy; } public GetIntegrationsTypesRequest withSortBy(String sortBy) { this.setSortBy(sortBy); return this; } private List<String> expand; public List<String> getExpand() { return this.expand; } public void setExpand(List<String> expand) { this.expand = expand; } public GetIntegrationsTypesRequest withExpand(List<String> expand) { this.setExpand(expand); return this; } private String nextPage; public String getNextPage() { return this.nextPage; } public void setNextPage(String nextPage) { this.nextPage = nextPage; } public GetIntegrationsTypesRequest withNextPage(String nextPage) { this.setNextPage(nextPage); return this; } private String previousPage; public String getPreviousPage() { return this.previousPage; } public void setPreviousPage(String previousPage) { this.previousPage = previousPage; } public GetIntegrationsTypesRequest withPreviousPage(String previousPage) { this.setPreviousPage(previousPage); return this; } private final Map<String, String> customHeaders = new HashMap<>(); public Map<String, String> getCustomHeaders() { return this.customHeaders; } public void setCustomHeaders(Map<String, String> customHeaders) { this.customHeaders.clear(); this.customHeaders.putAll(customHeaders); } public void addCustomHeader(String name, String value) { this.customHeaders.put(name, value); } public GetIntegrationsTypesRequest withCustomHeader(String name, String value) { this.addCustomHeader(name, value); return this; } public ApiRequest<Void> withHttpInfo() { return ApiRequestBuilder.create("GET", "/api/v2/integrations/types") .withQueryParameters("pageSize", "", pageSize) .withQueryParameters("pageNumber", "", pageNumber) .withQueryParameters("sortBy", "", sortBy) .withQueryParameters("expand", "multi", expand) .withQueryParameters("nextPage", "", nextPage) .withQueryParameters("previousPage", "", previousPage) .withCustomHeaders(customHeaders) .withContentTypes("application/json") .withAccepts("application/json") .withAuthNames("PureCloud OAuth") .build(); } public static Builder builder() { return new Builder(); } public static class Builder { private final GetIntegrationsTypesRequest request; private Builder() { request = new GetIntegrationsTypesRequest(); } public Builder withPageSize(Integer pageSize) { request.setPageSize(pageSize); return this; } public Builder withPageNumber(Integer pageNumber) { request.setPageNumber(pageNumber); return this; } public Builder withSortBy(String sortBy) { request.setSortBy(sortBy); return this; } public Builder withExpand(List<String> expand) { request.setExpand(expand); return this; } public Builder withNextPage(String nextPage) { request.setNextPage(nextPage); return this; } public Builder withPreviousPage(String previousPage) { request.setPreviousPage(previousPage); return this; } public GetIntegrationsTypesRequest build() { return request; } } }
3e03ba6eedea23bcc83ebe8e6bf7f04f4e1621ea
393
java
Java
core/src/main/java/ru/soknight/packetinventoryapi/menu/context/state/selector/SimpleStateSelectorContext.java
SoKnight/PacketInventoryAPI
90c835f7aa1ffd23d7e073b1caca348f4b64dd38
[ "MIT" ]
1
2022-03-02T19:27:34.000Z
2022-03-02T19:27:34.000Z
core/src/main/java/ru/soknight/packetinventoryapi/menu/context/state/selector/SimpleStateSelectorContext.java
SoKnight/PacketInventoryAPI
90c835f7aa1ffd23d7e073b1caca348f4b64dd38
[ "MIT" ]
null
null
null
core/src/main/java/ru/soknight/packetinventoryapi/menu/context/state/selector/SimpleStateSelectorContext.java
SoKnight/PacketInventoryAPI
90c835f7aa1ffd23d7e073b1caca348f4b64dd38
[ "MIT" ]
null
null
null
30.230769
85
0.80916
1,539
package ru.soknight.packetinventoryapi.menu.context.state.selector; import org.bukkit.entity.Player; import ru.soknight.packetinventoryapi.menu.item.stateable.StateableMenuItem; final class SimpleStateSelectorContext extends AbstractStateSelectorContext { SimpleStateSelectorContext(Player viewer, StateableMenuItem menuItem, int slot) { super(viewer, menuItem, slot); } }
3e03bad4943628b3094ab438b6405d9fbc73d650
4,066
java
Java
server/src/main/java/com/decathlon/ara/domain/CountryDeployment.java
youaxa/ara-poc-open
ebec1e751f34bf56930230c2476fbc536b7303a5
[ "Apache-2.0" ]
null
null
null
server/src/main/java/com/decathlon/ara/domain/CountryDeployment.java
youaxa/ara-poc-open
ebec1e751f34bf56930230c2476fbc536b7303a5
[ "Apache-2.0" ]
1
2022-03-02T05:08:06.000Z
2022-03-02T05:08:06.000Z
server/src/main/java/com/decathlon/ara/domain/CountryDeployment.java
youaxa/ara-poc-open
ebec1e751f34bf56930230c2476fbc536b7303a5
[ "Apache-2.0" ]
null
null
null
33.883333
127
0.734629
1,540
package com.decathlon.ara.domain; import com.decathlon.ara.domain.enumeration.JobStatus; import com.decathlon.ara.ci.bean.Result; import java.util.Comparator; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Temporal; import javax.persistence.TemporalType; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.experimental.Wither; import org.hibernate.annotations.GenericGenerator; import static java.util.Comparator.comparing; import static java.util.Comparator.naturalOrder; import static java.util.Comparator.nullsFirst; @Data @NoArgsConstructor @AllArgsConstructor @Wither @Entity // Keep business key in sync with compareTo(): see https://developer.jboss.org/wiki/EqualsAndHashCode @EqualsAndHashCode(of = { "executionId", "country" }) public class CountryDeployment implements Comparable<CountryDeployment> { @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "native") @GenericGenerator(name = "native", strategy = "native") private Long id; // 1/2 for @EqualsAndHashCode to work: used when an entity is fetched by JPA @Column(name = "execution_id", insertable = false, updatable = false) @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) private Long executionId; @ManyToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "execution_id") private Execution execution; @ManyToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "country_id") private Country country; /** * The platform/environment/server on which this country was deployed. */ private String platform; /** * The URL of the Continuous Integration job, visible in the client GUI to access logs of the job. */ private String jobUrl; /** * An alternate URL for the job, only for internal indexing needs (optional: either the local directory from which * to index or an intermediary service used to eg. compute the Continuous Integration job's hierarchy). */ private String jobLink; @Enumerated(EnumType.STRING) private JobStatus status; /** * The result status of the remote job. */ @Enumerated(EnumType.STRING) private Result result; /** * The date and time the remote job started. Null if not started yet. */ @Column(name = "start_date_time", columnDefinition = "TIMESTAMP") @Temporal(TemporalType.TIMESTAMP) private Date startDateTime; /** * The estimated duration of the remote job, in milliseconds: can be used with startDateTime and the current * date-time to display a progress bar. */ private Long estimatedDuration; /** * The actual duration of the job, in milliseconds, AFTER it has finished (may be 0 while running). */ private Long duration; // 2/2 for @EqualsAndHashCode to work: used for entities created outside of JPA public void setExecution(Execution execution) { this.execution = execution; this.executionId = (execution == null ? null : execution.getId()); } @Override public int compareTo(CountryDeployment other) { // Keep business key in sync with @EqualsAndHashCode Comparator<CountryDeployment> executionIdComparator = comparing(d -> d.executionId, nullsFirst(naturalOrder())); Comparator<CountryDeployment> countryComparator = comparing(CountryDeployment::getCountry, nullsFirst(naturalOrder())); return nullsFirst(executionIdComparator .thenComparing(countryComparator)).compare(this, other); } }
3e03bb1ec8a8e7ca5137ac4c07cf7fcc1ff664a5
228
java
Java
springboot-dao/src/main/java/com/ncme/springboot/mapper/QuestSooSbEventMapper.java
jamescaoBJ/springcloud
a012debbc90b195584bb3da0300cb14f7ed2f8a0
[ "Apache-2.0" ]
null
null
null
springboot-dao/src/main/java/com/ncme/springboot/mapper/QuestSooSbEventMapper.java
jamescaoBJ/springcloud
a012debbc90b195584bb3da0300cb14f7ed2f8a0
[ "Apache-2.0" ]
null
null
null
springboot-dao/src/main/java/com/ncme/springboot/mapper/QuestSooSbEventMapper.java
jamescaoBJ/springcloud
a012debbc90b195584bb3da0300cb14f7ed2f8a0
[ "Apache-2.0" ]
null
null
null
25.333333
50
0.780702
1,541
package com.ncme.springboot.mapper; import com.ncme.springboot.model.QuestSooSbEvent; public interface QuestSooSbEventMapper { int insert(QuestSooSbEvent record); int insertSelective(QuestSooSbEvent record); }
3e03bbc3b40a7f6a092ad7154bdf8e412aec6454
4,216
java
Java
Java/src/main/java/com/google/hashcode/utils/IoUtils.java
WilliamMajanja/HashCode-2017
7280defcf4287e739827fa754a9b5e267aced51a
[ "MIT" ]
6
2017-02-21T22:07:57.000Z
2019-02-25T17:12:27.000Z
Java/src/main/java/com/google/hashcode/utils/IoUtils.java
ax3cubed/HashCode-2017
455cc8c4053fff64ddd855acc8cc88b5267d50d3
[ "MIT" ]
null
null
null
Java/src/main/java/com/google/hashcode/utils/IoUtils.java
ax3cubed/HashCode-2017
455cc8c4053fff64ddd855acc8cc88b5267d50d3
[ "MIT" ]
8
2017-02-22T05:04:08.000Z
2019-07-24T12:44:24.000Z
36.034188
97
0.613615
1,542
package com.google.hashcode.utils; import com.google.hashcode.entity.Cell; import com.google.hashcode.entity.Ingredient; import com.google.hashcode.entity.Slice; import com.google.hashcode.entity.SliceInstruction; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Comparator; import java.util.Formatter; import java.util.List; /** * @author Grigoriy Lyashenko (Grog). * @author github.com/VadimKlindukhov skype: kv_vadim */ public class IoUtils { private IoUtils() { } /** * Parses given input file to a 2d pizza cells array * * @param file input file * @return 2d array representing a pizza * @throws IOException parsing fail */ public static List<Cell> parsePizza(String file) throws IOException { try (FileReader fileReader = new FileReader(file)) { BufferedReader br = new BufferedReader(fileReader); //skip a line with slice instructions br.readLine(); //declare a pizza cells array List<Cell> cells = new ArrayList<>(); int row = 0; String fileLine; while ((fileLine = br.readLine()) != null) { for (int column = 0; column < fileLine.length(); column++) { Character literal = fileLine.charAt(column); if (literal.toString().equals(Ingredient.TOMATO.toString())) { cells.add(new Cell(row, column, Ingredient.TOMATO)); } else if (literal.toString().equals(Ingredient.MUSHROOM.toString())) { cells.add(new Cell(row, column, Ingredient.MUSHROOM)); } } row++; } return cells; } } /** * Produces SliceInstructions based on given input data set * * @param file input data set * @return slice instructions * @throws IOException file reading error */ public static SliceInstruction parseSliceInstructions(String file) throws IOException { try (FileReader fileReader = new FileReader(file)) { BufferedReader br = new BufferedReader(fileReader); String[] headerTokens = br.readLine().split(" "); int minNumberOfIngredientPerSlice = Integer.parseInt(headerTokens[2]); int maxNumberOfCellsPerSlice = Integer.parseInt(headerTokens[3]); return new SliceInstruction(minNumberOfIngredientPerSlice, maxNumberOfCellsPerSlice); } } /** * Formats data from list of slices to the required output format * * @param list inner representation of pizza * @return String that contains output data */ public static String parseSlices(List<Slice> list) { Comparator<Cell> cellComparator = (Cell c1, Cell c2) -> { if (c1.x != c2.x) { return Integer.compare(c1.x, c2.x); } else return Integer.compare(c1.y, c2.y); }; StringBuilder sb = new StringBuilder(); Formatter textFormatter = new Formatter(sb); textFormatter.format("%d%n", list.size()); Cell min, max; for (Slice slice : list) { min = slice.cells.stream().min(cellComparator).get(); max = slice.cells.stream().max(cellComparator).get(); textFormatter.format("%d %d %d %d%n", min.y, min.x, max.y, max.x); } textFormatter.close(); return sb.toString().trim(); } public static void writeToFile(String fileName, String outputDate) throws IOException { try (PrintWriter out = new PrintWriter(fileName)) { out.println(outputDate); } } public static String readFromFile(String fileName) throws IOException { List<String> lines = Files.readAllLines(Paths.get(fileName)); StringBuilder stringBuilder = new StringBuilder(); lines.forEach( line -> stringBuilder.append(line).append("\n") ); return stringBuilder.toString(); } }
3e03bbd036d41611634c919a16362f235ec9a85e
3,097
java
Java
lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/hhmm/SegToken.java
nitrohsu/stome-lucene
0bbd1cdec600eef30876e9427ee5f0d8307046c9
[ "Apache-2.0", "BSD-2-Clause" ]
903
2015-01-02T22:13:47.000Z
2022-03-31T13:40:42.000Z
lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/hhmm/SegToken.java
nitrohsu/stome-lucene
0bbd1cdec600eef30876e9427ee5f0d8307046c9
[ "Apache-2.0", "BSD-2-Clause" ]
429
2021-03-10T14:47:58.000Z
2022-03-31T21:26:52.000Z
lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/hhmm/SegToken.java
nitrohsu/stome-lucene
0bbd1cdec600eef30876e9427ee5f0d8307046c9
[ "Apache-2.0", "BSD-2-Clause" ]
480
2015-01-05T03:07:05.000Z
2022-03-31T10:35:08.000Z
32.6
98
0.688408
1,543
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.lucene.analysis.cn.smart.hhmm; import java.util.Arrays; import org.apache.lucene.analysis.cn.smart.WordType; // for javadocs /** * SmartChineseAnalyzer internal token * * @lucene.experimental */ public class SegToken { /** Character array containing token text */ public char[] charArray; /** start offset into original sentence */ public int startOffset; /** end offset into original sentence */ public int endOffset; /** {@link WordType} of the text */ public int wordType; /** word frequency */ public int weight; /** during segmentation, this is used to store the index of the token in the token list table */ public int index; /** * Create a new SegToken from a character array. * * @param idArray character array containing text * @param start start offset of SegToken in original sentence * @param end end offset of SegToken in original sentence * @param wordType {@link WordType} of the text * @param weight word frequency */ public SegToken(char[] idArray, int start, int end, int wordType, int weight) { this.charArray = idArray; this.startOffset = start; this.endOffset = end; this.wordType = wordType; this.weight = weight; } /** @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; for (int i = 0; i < charArray.length; i++) { result = prime * result + charArray[i]; } result = prime * result + endOffset; result = prime * result + index; result = prime * result + startOffset; result = prime * result + weight; result = prime * result + wordType; return result; } /** @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SegToken other = (SegToken) obj; if (!Arrays.equals(charArray, other.charArray)) return false; if (endOffset != other.endOffset) return false; if (index != other.index) return false; if (startOffset != other.startOffset) return false; if (weight != other.weight) return false; if (wordType != other.wordType) return false; return true; } }
3e03bbde7cab2a72e5eeeef59f1920b260eae232
1,174
java
Java
src/main/java/org/ibase4j/core/base/BaseController.java
kknd9819/iBase4J
0a5f5513645df85e2992749b505517d6f943055b
[ "Apache-2.0" ]
1
2017-04-28T00:19:17.000Z
2017-04-28T00:19:17.000Z
src/main/java/org/ibase4j/core/base/BaseController.java
kknd9819/iBase4J
0a5f5513645df85e2992749b505517d6f943055b
[ "Apache-2.0" ]
null
null
null
src/main/java/org/ibase4j/core/base/BaseController.java
kknd9819/iBase4J
0a5f5513645df85e2992749b505517d6f943055b
[ "Apache-2.0" ]
null
null
null
23.959184
86
0.747871
1,544
/** * */ package org.ibase4j.core.base; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ui.ModelMap; import com.baomidou.mybatisplus.plugins.Page; /** * 控制器基类 * * @author ShenHuaJie * @version 2016年5月20日 下午3:47:58 */ public abstract class BaseController<T extends BaseModel> extends AbstractController { @Autowired protected BaseService<T> service; public Object query(ModelMap modelMap, Map<String, Object> params) { Page<?> list = service.query(params); return setSuccessModelMap(modelMap, list); } public Object queryList(ModelMap modelMap, Map<String, Object> params) { List<?> list = service.queryList(params); return setSuccessModelMap(modelMap, list); } public Object get(ModelMap modelMap, T param) { T result = service.queryById(param.getId()); return setSuccessModelMap(modelMap, result); } public Object update(ModelMap modelMap, T param) { service.update(param); return setSuccessModelMap(modelMap); } public Object delete(ModelMap modelMap, T param) { service.delete(param.getId()); return setSuccessModelMap(modelMap); } }
3e03bc748819c5b9ebd441f61a0b15fb00417296
1,368
java
Java
linux/src/main/java/hmh/terminal/linux/config/auth/JSONAuthentication.java
AhaoHe/OnlineLinuxTerminalSimulator
293fcd0a5985429613919449b379c92628dc1b45
[ "Apache-2.0" ]
1
2020-06-08T07:52:09.000Z
2020-06-08T07:52:09.000Z
linux/src/main/java/hmh/terminal/linux/config/auth/JSONAuthentication.java
AhaoHe/OnlineLinuxTerminalSimulator
293fcd0a5985429613919449b379c92628dc1b45
[ "Apache-2.0" ]
3
2020-06-08T10:07:21.000Z
2020-07-20T05:04:56.000Z
linux/src/main/java/hmh/terminal/linux/config/auth/JSONAuthentication.java
AhaoHe/OnlineLinuxTerminalSimulator
293fcd0a5985429613919449b379c92628dc1b45
[ "Apache-2.0" ]
1
2020-06-08T07:52:11.000Z
2020-06-08T07:52:11.000Z
30.4
81
0.657895
1,545
package hmh.terminal.linux.config.auth; import com.fasterxml.jackson.databind.ObjectMapper; import hmh.terminal.linux.utils.JwtTokenUtil; import org.springframework.beans.factory.annotation.Autowired; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; /** * @author heminghao * @version 0.1 beta * @date 2020/3/19 13:44 */ public abstract class JSONAuthentication { @Autowired JwtTokenUtil jwtTokenUtil; /** * 输出JSON * @param request * @param response * @param data * @throws IOException * @throws ServletException */ protected void WriteJSON(HttpServletRequest request, HttpServletResponse response, Object data) throws IOException, ServletException { //这里很重要,否则页面获取不到正常的JSON数据集 response.setContentType("application/json;charset=UTF-8"); response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Method", "POST,GET"); //输出JSON PrintWriter out = response.getWriter(); out.write(new ObjectMapper().writeValueAsString(data)); out.flush(); out.close(); } }
3e03bd1761c3dc0fd5a0c8430eed5df180a653f8
993
java
Java
driver-core/src/main/com/mongodb/client/model/geojson/CoordinateReferenceSystem.java
kulabun/mongo-java-driver
958d8aa27e4f7b79225d8d1ed31981b13fa59a53
[ "Apache-2.0" ]
1,724
2015-01-02T10:01:17.000Z
2022-03-24T02:39:25.000Z
driver-core/src/main/com/mongodb/client/model/geojson/CoordinateReferenceSystem.java
kulabun/mongo-java-driver
958d8aa27e4f7b79225d8d1ed31981b13fa59a53
[ "Apache-2.0" ]
383
2015-01-02T22:17:32.000Z
2022-03-29T17:48:35.000Z
driver-core/src/main/com/mongodb/client/model/geojson/CoordinateReferenceSystem.java
kulabun/mongo-java-driver
958d8aa27e4f7b79225d8d1ed31981b13fa59a53
[ "Apache-2.0" ]
1,182
2015-01-01T05:23:28.000Z
2022-03-30T07:33:30.000Z
27.583333
75
0.723061
1,546
/* * Copyright 2008-present MongoDB, 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.mongodb.client.model.geojson; import com.mongodb.annotations.Immutable; /** * A GeoJSON Coordinate Reference System (CRS). * * @since 3.1 */ @Immutable public abstract class CoordinateReferenceSystem { /** * Gets the type of this Coordinate Reference System. * * @return the type */ public abstract CoordinateReferenceSystemType getType(); }
3e03bdd73a731311fc0639483ace2b213a3970da
2,659
java
Java
dragonfly-core/src/main/java/com/mmnaseri/dragonfly/metadata/impl/AugmentedTableMetadataResolver.java
mmnaseri/dragonfly
2ae45c09ddc0f9e2d3a7aebc72d0a4fa66c7cafa
[ "MIT" ]
null
null
null
dragonfly-core/src/main/java/com/mmnaseri/dragonfly/metadata/impl/AugmentedTableMetadataResolver.java
mmnaseri/dragonfly
2ae45c09ddc0f9e2d3a7aebc72d0a4fa66c7cafa
[ "MIT" ]
null
null
null
dragonfly-core/src/main/java/com/mmnaseri/dragonfly/metadata/impl/AugmentedTableMetadataResolver.java
mmnaseri/dragonfly
2ae45c09ddc0f9e2d3a7aebc72d0a4fa66c7cafa
[ "MIT" ]
null
null
null
41
133
0.761726
1,547
/* * The MIT License (MIT) * * Copyright (c) 2013 Milad Naseri. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.mmnaseri.dragonfly.metadata.impl; import com.mmnaseri.dragonfly.metadata.TableMetadata; import com.mmnaseri.dragonfly.metadata.TableMetadataInterceptor; import com.mmnaseri.dragonfly.metadata.TableMetadataResolver; import java.util.ArrayList; import java.util.List; /** * This is a class that will take table a metadata resolver, and a list of metadata * interceptors, and then return the resolved and augmented table metadata for the entity * * @author Milad Naseri ([email protected]) * @since 1.0 (2013/9/8, 19:37) */ public class AugmentedTableMetadataResolver implements TableMetadataResolver { private final TableMetadataResolver tableMetadataResolver; private final List<TableMetadataInterceptor> interceptors = new ArrayList<TableMetadataInterceptor>(); public AugmentedTableMetadataResolver(TableMetadataResolver tableMetadataResolver, List<TableMetadataInterceptor> interceptors) { this.tableMetadataResolver = tableMetadataResolver; this.interceptors.addAll(interceptors); } @Override public <E> TableMetadata<E> resolve(Class<E> entityType) { TableMetadata<E> tableMetadata = tableMetadataResolver.resolve(entityType); for (TableMetadataInterceptor interceptor : interceptors) { tableMetadata = interceptor.intercept(tableMetadata); } return tableMetadata; } @Override public boolean accepts(Class<?> entityType) { return tableMetadataResolver.accepts(entityType); } }
3e03bdefc8b8fc106f07fea5228ce6c5ca9b9df9
6,645
java
Java
libs/ZUtilsExtWidget/src/com/kit/widget/floatingview/FloatingView.java
BigAppLink/BigApp_Discuz_Android-master
ac47c7fca6cbfe107eb6b21cd95995ec6c38fc1d
[ "Apache-2.0" ]
79
2016-03-17T12:17:27.000Z
2021-09-27T12:12:16.000Z
libs/ZUtilsExtWidget/src/com/kit/widget/floatingview/FloatingView.java
BigAppLink/BigApp_Discuz_Android-master
ac47c7fca6cbfe107eb6b21cd95995ec6c38fc1d
[ "Apache-2.0" ]
4
2016-05-24T02:09:59.000Z
2018-05-16T12:31:56.000Z
libs/ZUtilsExtWidget/src/com/kit/widget/floatingview/FloatingView.java
BigAppLink/BigApp_Discuz_Android-master
ac47c7fca6cbfe107eb6b21cd95995ec6c38fc1d
[ "Apache-2.0" ]
78
2016-03-18T02:59:37.000Z
2021-12-23T11:14:39.000Z
34.076923
125
0.658841
1,548
package com.kit.widget.floatingview; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Point; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.util.AttributeSet; import android.view.Display; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Interpolator; import android.widget.AbsListView; import android.widget.FrameLayout; import com.kit.extend.widget.R; import com.kit.utils.AnimUtils; import com.kit.utils.ZogUtils; import com.kit.widget.scrollview.defaultscrollview.KitOnScrollListener; import com.kit.widget.scrollview.defaultscrollview.KitScrollView; import com.nineoldandroids.view.ViewHelper; public class FloatingView extends FrameLayout { private final Interpolator mInterpolator = new AccelerateDecelerateInterpolator(); private final Paint mButtonPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private final Paint mDrawablePaint = new Paint(Paint.ANTI_ALIAS_FLAG); private Bitmap mBitmap; private int mColor; private boolean mHidden = false; /** * The FAB button's Y position when it is displayed. */ private float mYDisplayed = -1; /** * The FAB button's Y position when it is hidden. */ private float mYHidden = -1; private Context context; private int resAnimInID, resAnimOutID; public FloatingView(Context context) { this(context, null); this.context = context; } public FloatingView(Context context, AttributeSet attributeSet) { this(context, attributeSet, 0); this.context = context; } public FloatingView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); this.context = context; TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.FloatingView); mColor = a.getColor(R.styleable.FloatingView_FloatingView_color, Color.TRANSPARENT); mButtonPaint.setStyle(Paint.Style.FILL); mButtonPaint.setColor(mColor); float radius, dx, dy; radius = a.getFloat(R.styleable.FloatingView_FloatingView_shadowRadius, 10.0f); dx = a.getFloat(R.styleable.FloatingView_FloatingView_shadowDx, 0.0f); dy = a.getFloat(R.styleable.FloatingView_FloatingView_shadowDy, 3.5f); int color = a.getInteger(R.styleable.FloatingView_FloatingView_shadowColor, Color.TRANSPARENT); mButtonPaint.setShadowLayer(radius, dx, dy, color); Drawable drawable = a.getDrawable(R.styleable.FloatingView_FloatingView_drawable); if (null != drawable) { mBitmap = ((BitmapDrawable) drawable).getBitmap(); } setWillNotDraw(false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) setLayerType(View.LAYER_TYPE_SOFTWARE, null); WindowManager mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = mWindowManager.getDefaultDisplay(); Point size = new Point(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { display.getSize(size); mYHidden = size.y; } else mYHidden = display.getHeight(); } public static int darkenColor(int color) { float[] hsv = new float[3]; Color.colorToHSV(color, hsv); hsv[2] *= 0.8f; return Color.HSVToColor(hsv); } public void setColor(int color) { mColor = color; mButtonPaint.setColor(mColor); invalidate(); } public void setDrawable(Drawable drawable) { mBitmap = ((BitmapDrawable) drawable).getBitmap(); invalidate(); } @Override protected void onDraw(Canvas canvas) { canvas.drawRect(0, 0, getWidth(), getHeight(), mButtonPaint); if (null != mBitmap) { canvas.drawBitmap(mBitmap, (getWidth() - mBitmap.getWidth()) / 2, (getHeight() - mBitmap.getHeight()) / 2, mDrawablePaint); } } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { // Perform the default behavior super.onLayout(changed, left, top, right, bottom); // Store the FAB button's displayed Y position if we are not already aware of it if (mYDisplayed == -1) { mYDisplayed = ViewHelper.getY(this); } } @Override public boolean onTouchEvent(MotionEvent event) { int color; if (event.getAction() == MotionEvent.ACTION_UP) { color = mColor; } else { color = darkenColor(mColor); } mButtonPaint.setColor(color); invalidate(); return super.onTouchEvent(event); } public void hide(boolean hide) { if (resAnimInID == 0) { resAnimInID = R.anim.slide_bottom_out; } if (resAnimOutID == 0) { resAnimOutID = R.anim.slide_bottom_in; } // If the hidden state is being updated if (mHidden != hide) { // Store the new hidden state mHidden = hide; // Animate the FAB to it's new Y position // ObjectAnimator animator = ObjectAnimator.ofFloat(this, "y", mHidden ? mYHidden : mYDisplayed).setDuration(500); // animator.setInterpolator(mInterpolator); // animator.start(); ZogUtils.printLog(FloatingView.class, "mHidden:" + mHidden + " " + resAnimInID + "#" + resAnimOutID); if (mHidden) {//隐藏 AnimUtils.hidden(context, this, resAnimOutID); } else {//显示 AnimUtils.show(context, this, resAnimInID); } } } public void setAnimRes(int resAnimInID, int resAnimOutID) { this.resAnimInID = resAnimInID; this.resAnimOutID = resAnimOutID; } public void listenTo(AbsListView listView) { ZogUtils.printLog(FloatingView.class, "listenTo listView: " + listView); if (null != listView) { listView.setOnScrollListener(new DirectionScrollListener(this)); } } public void listenTo(KitScrollView scrollView) { if (null != scrollView) { scrollView.setOnScrollListener(new KitOnScrollListener(this)); } } }
3e03be4de9a1e439a34bfa75a8af04ae4376b2e8
2,551
java
Java
src/test/java/org/concordion/ext/screenshot/ScreenshotTest.java
concordion/concordion-screenshot-extension
1de2b05da9e0304e4ac5f40bacc13f2ae4f504a0
[ "Apache-2.0" ]
2
2015-09-25T13:45:10.000Z
2016-01-22T18:23:57.000Z
src/test/java/org/concordion/ext/screenshot/ScreenshotTest.java
concordion/concordion-screenshot-extension
1de2b05da9e0304e4ac5f40bacc13f2ae4f504a0
[ "Apache-2.0" ]
5
2018-02-06T06:33:22.000Z
2021-06-26T00:46:43.000Z
src/test/java/org/concordion/ext/screenshot/ScreenshotTest.java
concordion/concordion-screenshot-extension
1de2b05da9e0304e4ac5f40bacc13f2ae4f504a0
[ "Apache-2.0" ]
null
null
null
32.405063
127
0.645703
1,549
package org.concordion.ext.screenshot; import org.concordion.integration.junit4.ConcordionRunner; import org.junit.Before; import org.junit.runner.RunWith; import test.concordion.ext.screenshot.DummyScreenshotFactory; import java.io.File; import java.io.FilenameFilter; import java.io.IOException; /** * Test to check that screenshots are not overriden when suite of tests is executed * * @author Kostya Marchenko <[email protected]> */ @RunWith(ConcordionRunner.class) public class ScreenshotTest { private static final String CONCORDION_OUTPUT_DIR = "concordion.output.dir"; @Before public void setUp() { //Install screenshot extension - use a dummy screenshot taker to ensure screenshots of my system don't end up online.. System.setProperty("concordion.extensions", DummyScreenshotFactory.class.getName()); try { //Delete existing screenshots File[] screenshotFiles = getScreenshotFiles(); for (File screenshotFile : screenshotFiles) { screenshotFile.delete(); } } catch (Exception e) { //do nothing } } public int getScreenshotsCount() throws IOException { return getScreenshotFiles().length; } /** * Returns list of screenshot files in concordion test results folder * * @return array of screenshot files */ private File[] getScreenshotFiles() { File screenshotDir = getScreenshotsLocation(); //Construct filename filter to list only screenshot files in folder FilenameFilter screenshotFilesFilter = new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".jpg"); } }; File[] screenshotFiles = screenshotDir.listFiles(screenshotFilesFilter); return screenshotFiles; } /** * Returns screenshot files location for current test * * @return File object representing a folder with test screenshots */ private File getScreenshotsLocation() { String outputPath = System.getProperty(CONCORDION_OUTPUT_DIR); String testRelativePath = this.getClass().getPackage().getName().replace(".", "/"); if (outputPath == null) { return new File(System.getProperty("java.io.tmpdir"), "concordion/" + testRelativePath); } return new File(outputPath + "/" + testRelativePath); } }
3e03c024b2a61c86729d4d3d5f5c2152621938bb
357
java
Java
StartHere/src/main/java/com/lambdaschool/starthere/services/UserService.java
alfonsog714/Sprint-Challenge--Java-Backend-Data-Persistence-with-SQL-Hibernate-java-todos
a0204c53de1fbcdc4b9e432be4dba5e391075e32
[ "MIT" ]
null
null
null
StartHere/src/main/java/com/lambdaschool/starthere/services/UserService.java
alfonsog714/Sprint-Challenge--Java-Backend-Data-Persistence-with-SQL-Hibernate-java-todos
a0204c53de1fbcdc4b9e432be4dba5e391075e32
[ "MIT" ]
null
null
null
StartHere/src/main/java/com/lambdaschool/starthere/services/UserService.java
alfonsog714/Sprint-Challenge--Java-Backend-Data-Persistence-with-SQL-Hibernate-java-todos
a0204c53de1fbcdc4b9e432be4dba5e391075e32
[ "MIT" ]
null
null
null
17.85
54
0.683473
1,550
package com.lambdaschool.starthere.services; import com.lambdaschool.starthere.models.User; import java.util.List; public interface UserService { List<User> findAll(); User findUserById(long id); User findByUsername(String name); void delete(long id); User save(User user); User update(User user, long id); }
3e03c074597bd48d55008c556d3364d1434370c4
95,596
java
Java
ureport2-core/src/main/java/com/bstek/ureport/dsl/ReportParserParser.java
yaoliyc/ureport
7c79f18dcce7ccfd391507ea582612b48f670aa3
[ "Apache-2.0" ]
1,643
2017-06-05T08:15:41.000Z
2022-03-31T14:31:25.000Z
ureport2-core/src/main/java/com/bstek/ureport/dsl/ReportParserParser.java
xchloading/ureport
07f9c32593274c1f23e403ffddcb86ffb9964799
[ "Apache-2.0" ]
550
2017-07-04T03:19:31.000Z
2022-03-30T06:27:18.000Z
ureport2-core/src/main/java/com/bstek/ureport/dsl/ReportParserParser.java
xchloading/ureport
07f9c32593274c1f23e403ffddcb86ffb9964799
[ "Apache-2.0" ]
767
2017-06-08T14:23:01.000Z
2022-03-27T02:45:57.000Z
31.128623
327
0.686462
1,551
// Generated from ReportParser.g4 by ANTLR 4.5.3 package com.bstek.ureport.dsl; import org.antlr.v4.runtime.atn.*; import org.antlr.v4.runtime.dfa.DFA; import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.misc.*; import org.antlr.v4.runtime.tree.*; import java.util.List; import java.util.Iterator; import java.util.ArrayList; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) public class ReportParserParser extends Parser { static { RuntimeMetaData.checkVersion("4.5.3", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); public static final int T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9, T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17, T__17=18, T__18=19, Cell=20, Operator=21, OP=22, ORDER=23, BOOLEAN=24, COLON=25, COMMA=26, NULL=27, LeftParen=28, RightParen=29, STRING=30, AND=31, OR=32, INTEGER=33, NUMBER=34, EXCLAMATION=35, EXP=36, Identifier=37, LETTER=38, Char=39, DIGIT=40, WS=41, NL=42; public static final int RULE_entry = 0, RULE_expression = 1, RULE_exprComposite = 2, RULE_ternaryExpr = 3, RULE_caseExpr = 4, RULE_casePart = 5, RULE_ifExpr = 6, RULE_ifPart = 7, RULE_elseIfPart = 8, RULE_elsePart = 9, RULE_block = 10, RULE_exprBlock = 11, RULE_returnExpr = 12, RULE_expr = 13, RULE_ifCondition = 14, RULE_variableAssign = 15, RULE_item = 16, RULE_unit = 17, RULE_variable = 18, RULE_cellPosition = 19, RULE_relativeCell = 20, RULE_currentCellValue = 21, RULE_currentCellData = 22, RULE_cell = 23, RULE_dataset = 24, RULE_function = 25, RULE_functionParameter = 26, RULE_set = 27, RULE_cellCoordinate = 28, RULE_coordinate = 29, RULE_cellIndicator = 30, RULE_conditions = 31, RULE_condition = 32, RULE_property = 33, RULE_currentValue = 34, RULE_simpleValue = 35, RULE_join = 36, RULE_aggregate = 37; public static final String[] ruleNames = { "entry", "expression", "exprComposite", "ternaryExpr", "caseExpr", "casePart", "ifExpr", "ifPart", "elseIfPart", "elsePart", "block", "exprBlock", "returnExpr", "expr", "ifCondition", "variableAssign", "item", "unit", "variable", "cellPosition", "relativeCell", "currentCellValue", "currentCellData", "cell", "dataset", "function", "functionParameter", "set", "cellCoordinate", "coordinate", "cellIndicator", "conditions", "condition", "property", "currentValue", "simpleValue", "join", "aggregate" }; private static final String[] _LITERAL_NAMES = { null, "'?'", "'case'", "'{'", "'}'", "'if'", "'else'", "'return'", "';'", "'var'", "'='", "'&'", "'$'", "'#'", "'.'", "'cell'", "'['", "']'", "'to'", "'@'", null, null, null, null, null, "':'", "','", "'null'", "'('", "')'", null, null, null, null, null, "'!'" }; private static final String[] _SYMBOLIC_NAMES = { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "Cell", "Operator", "OP", "ORDER", "BOOLEAN", "COLON", "COMMA", "NULL", "LeftParen", "RightParen", "STRING", "AND", "OR", "INTEGER", "NUMBER", "EXCLAMATION", "EXP", "Identifier", "LETTER", "Char", "DIGIT", "WS", "NL" }; public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); /** * @deprecated Use {@link #VOCABULARY} instead. */ @Deprecated public static final String[] tokenNames; static { tokenNames = new String[_SYMBOLIC_NAMES.length]; for (int i = 0; i < tokenNames.length; i++) { tokenNames[i] = VOCABULARY.getLiteralName(i); if (tokenNames[i] == null) { tokenNames[i] = VOCABULARY.getSymbolicName(i); } if (tokenNames[i] == null) { tokenNames[i] = "<INVALID>"; } } } @Override @Deprecated public String[] getTokenNames() { return tokenNames; } @Override public Vocabulary getVocabulary() { return VOCABULARY; } @Override public String getGrammarFileName() { return "ReportParser.g4"; } @Override public String[] getRuleNames() { return ruleNames; } @Override public String getSerializedATN() { return _serializedATN; } @Override public ATN getATN() { return _ATN; } public ReportParserParser(TokenStream input) { super(input); _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); } public static class EntryContext extends ParserRuleContext { public TerminalNode EOF() { return getToken(ReportParserParser.EOF, 0); } public List<ExpressionContext> expression() { return getRuleContexts(ExpressionContext.class); } public ExpressionContext expression(int i) { return getRuleContext(ExpressionContext.class,i); } public EntryContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_entry; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitEntry(this); else return visitor.visitChildren(this); } } public final EntryContext entry() throws RecognitionException { EntryContext _localctx = new EntryContext(_ctx, getState()); enterRule(_localctx, 0, RULE_entry); int _la; try { enterOuterAlt(_localctx, 1); { setState(77); _errHandler.sync(this); _la = _input.LA(1); do { { { setState(76); expression(); } } setState(79); _errHandler.sync(this); _la = _input.LA(1); } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__4) | (1L << T__6) | (1L << T__8) | (1L << T__10) | (1L << T__11) | (1L << T__12) | (1L << T__14) | (1L << Cell) | (1L << BOOLEAN) | (1L << NULL) | (1L << LeftParen) | (1L << STRING) | (1L << INTEGER) | (1L << NUMBER) | (1L << Identifier))) != 0) ); setState(81); match(EOF); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ExpressionContext extends ParserRuleContext { public ExprCompositeContext exprComposite() { return getRuleContext(ExprCompositeContext.class,0); } public IfExprContext ifExpr() { return getRuleContext(IfExprContext.class,0); } public CaseExprContext caseExpr() { return getRuleContext(CaseExprContext.class,0); } public ReturnExprContext returnExpr() { return getRuleContext(ReturnExprContext.class,0); } public VariableAssignContext variableAssign() { return getRuleContext(VariableAssignContext.class,0); } public ExpressionContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_expression; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitExpression(this); else return visitor.visitChildren(this); } } public final ExpressionContext expression() throws RecognitionException { ExpressionContext _localctx = new ExpressionContext(_ctx, getState()); enterRule(_localctx, 2, RULE_expression); try { setState(88); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) { case 1: enterOuterAlt(_localctx, 1); { setState(83); exprComposite(0); } break; case 2: enterOuterAlt(_localctx, 2); { setState(84); ifExpr(); } break; case 3: enterOuterAlt(_localctx, 3); { setState(85); caseExpr(); } break; case 4: enterOuterAlt(_localctx, 4); { setState(86); returnExpr(); } break; case 5: enterOuterAlt(_localctx, 5); { setState(87); variableAssign(); } break; } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ExprCompositeContext extends ParserRuleContext { public ExprCompositeContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_exprComposite; } public ExprCompositeContext() { } public void copyFrom(ExprCompositeContext ctx) { super.copyFrom(ctx); } } public static class ComplexExprCompositeContext extends ExprCompositeContext { public List<ExprCompositeContext> exprComposite() { return getRuleContexts(ExprCompositeContext.class); } public ExprCompositeContext exprComposite(int i) { return getRuleContext(ExprCompositeContext.class,i); } public TerminalNode Operator() { return getToken(ReportParserParser.Operator, 0); } public ComplexExprCompositeContext(ExprCompositeContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitComplexExprComposite(this); else return visitor.visitChildren(this); } } public static class SingleExprCompositeContext extends ExprCompositeContext { public ExprContext expr() { return getRuleContext(ExprContext.class,0); } public SingleExprCompositeContext(ExprCompositeContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitSingleExprComposite(this); else return visitor.visitChildren(this); } } public static class ParenExprCompositeContext extends ExprCompositeContext { public TerminalNode LeftParen() { return getToken(ReportParserParser.LeftParen, 0); } public ExprCompositeContext exprComposite() { return getRuleContext(ExprCompositeContext.class,0); } public TerminalNode RightParen() { return getToken(ReportParserParser.RightParen, 0); } public ParenExprCompositeContext(ExprCompositeContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitParenExprComposite(this); else return visitor.visitChildren(this); } } public static class TernaryExprCompositeContext extends ExprCompositeContext { public TernaryExprContext ternaryExpr() { return getRuleContext(TernaryExprContext.class,0); } public TernaryExprCompositeContext(ExprCompositeContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitTernaryExprComposite(this); else return visitor.visitChildren(this); } } public final ExprCompositeContext exprComposite() throws RecognitionException { return exprComposite(0); } private ExprCompositeContext exprComposite(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); ExprCompositeContext _localctx = new ExprCompositeContext(_ctx, _parentState); ExprCompositeContext _prevctx = _localctx; int _startState = 4; enterRecursionRule(_localctx, 4, RULE_exprComposite, _p); try { int _alt; enterOuterAlt(_localctx, 1); { setState(97); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) { case 1: { _localctx = new SingleExprCompositeContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(91); expr(); } break; case 2: { _localctx = new TernaryExprCompositeContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(92); ternaryExpr(); } break; case 3: { _localctx = new ParenExprCompositeContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(93); match(LeftParen); setState(94); exprComposite(0); setState(95); match(RightParen); } break; } _ctx.stop = _input.LT(-1); setState(104); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,3,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { if ( _parseListeners!=null ) triggerExitRuleEvent(); _prevctx = _localctx; { { _localctx = new ComplexExprCompositeContext(new ExprCompositeContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_exprComposite); setState(99); if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); setState(100); match(Operator); setState(101); exprComposite(2); } } } setState(106); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,3,_ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { unrollRecursionContexts(_parentctx); } return _localctx; } public static class TernaryExprContext extends ParserRuleContext { public List<IfConditionContext> ifCondition() { return getRuleContexts(IfConditionContext.class); } public IfConditionContext ifCondition(int i) { return getRuleContext(IfConditionContext.class,i); } public List<BlockContext> block() { return getRuleContexts(BlockContext.class); } public BlockContext block(int i) { return getRuleContext(BlockContext.class,i); } public List<JoinContext> join() { return getRuleContexts(JoinContext.class); } public JoinContext join(int i) { return getRuleContext(JoinContext.class,i); } public TernaryExprContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_ternaryExpr; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitTernaryExpr(this); else return visitor.visitChildren(this); } } public final TernaryExprContext ternaryExpr() throws RecognitionException { TernaryExprContext _localctx = new TernaryExprContext(_ctx, getState()); enterRule(_localctx, 6, RULE_ternaryExpr); int _la; try { enterOuterAlt(_localctx, 1); { setState(107); ifCondition(); setState(113); _errHandler.sync(this); _la = _input.LA(1); while (_la==AND || _la==OR) { { { setState(108); join(); setState(109); ifCondition(); } } setState(115); _errHandler.sync(this); _la = _input.LA(1); } setState(116); match(T__0); setState(117); block(); setState(118); match(COLON); setState(119); block(); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class CaseExprContext extends ParserRuleContext { public List<CasePartContext> casePart() { return getRuleContexts(CasePartContext.class); } public CasePartContext casePart(int i) { return getRuleContext(CasePartContext.class,i); } public CaseExprContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_caseExpr; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitCaseExpr(this); else return visitor.visitChildren(this); } } public final CaseExprContext caseExpr() throws RecognitionException { CaseExprContext _localctx = new CaseExprContext(_ctx, getState()); enterRule(_localctx, 8, RULE_caseExpr); int _la; try { enterOuterAlt(_localctx, 1); { setState(121); match(T__1); setState(122); match(T__2); setState(123); casePart(); setState(128); _errHandler.sync(this); _la = _input.LA(1); while (_la==COMMA) { { { setState(124); match(COMMA); setState(125); casePart(); } } setState(130); _errHandler.sync(this); _la = _input.LA(1); } setState(131); match(T__3); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class CasePartContext extends ParserRuleContext { public List<IfConditionContext> ifCondition() { return getRuleContexts(IfConditionContext.class); } public IfConditionContext ifCondition(int i) { return getRuleContext(IfConditionContext.class,i); } public BlockContext block() { return getRuleContext(BlockContext.class,0); } public List<JoinContext> join() { return getRuleContexts(JoinContext.class); } public JoinContext join(int i) { return getRuleContext(JoinContext.class,i); } public CasePartContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_casePart; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitCasePart(this); else return visitor.visitChildren(this); } } public final CasePartContext casePart() throws RecognitionException { CasePartContext _localctx = new CasePartContext(_ctx, getState()); enterRule(_localctx, 10, RULE_casePart); int _la; try { enterOuterAlt(_localctx, 1); { setState(133); ifCondition(); setState(139); _errHandler.sync(this); _la = _input.LA(1); while (_la==AND || _la==OR) { { { setState(134); join(); setState(135); ifCondition(); } } setState(141); _errHandler.sync(this); _la = _input.LA(1); } setState(143); _la = _input.LA(1); if (_la==COLON) { { setState(142); match(COLON); } } setState(145); block(); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class IfExprContext extends ParserRuleContext { public IfPartContext ifPart() { return getRuleContext(IfPartContext.class,0); } public List<ElseIfPartContext> elseIfPart() { return getRuleContexts(ElseIfPartContext.class); } public ElseIfPartContext elseIfPart(int i) { return getRuleContext(ElseIfPartContext.class,i); } public ElsePartContext elsePart() { return getRuleContext(ElsePartContext.class,0); } public IfExprContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_ifExpr; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitIfExpr(this); else return visitor.visitChildren(this); } } public final IfExprContext ifExpr() throws RecognitionException { IfExprContext _localctx = new IfExprContext(_ctx, getState()); enterRule(_localctx, 12, RULE_ifExpr); try { int _alt; enterOuterAlt(_localctx, 1); { setState(147); ifPart(); setState(151); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,8,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { setState(148); elseIfPart(); } } } setState(153); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,8,_ctx); } setState(155); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,9,_ctx) ) { case 1: { setState(154); elsePart(); } break; } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class IfPartContext extends ParserRuleContext { public List<IfConditionContext> ifCondition() { return getRuleContexts(IfConditionContext.class); } public IfConditionContext ifCondition(int i) { return getRuleContext(IfConditionContext.class,i); } public BlockContext block() { return getRuleContext(BlockContext.class,0); } public List<JoinContext> join() { return getRuleContexts(JoinContext.class); } public JoinContext join(int i) { return getRuleContext(JoinContext.class,i); } public IfPartContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_ifPart; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitIfPart(this); else return visitor.visitChildren(this); } } public final IfPartContext ifPart() throws RecognitionException { IfPartContext _localctx = new IfPartContext(_ctx, getState()); enterRule(_localctx, 14, RULE_ifPart); int _la; try { enterOuterAlt(_localctx, 1); { setState(157); match(T__4); setState(158); match(LeftParen); setState(159); ifCondition(); setState(165); _errHandler.sync(this); _la = _input.LA(1); while (_la==AND || _la==OR) { { { setState(160); join(); setState(161); ifCondition(); } } setState(167); _errHandler.sync(this); _la = _input.LA(1); } setState(168); match(RightParen); setState(169); match(T__2); setState(170); block(); setState(171); match(T__3); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ElseIfPartContext extends ParserRuleContext { public List<IfConditionContext> ifCondition() { return getRuleContexts(IfConditionContext.class); } public IfConditionContext ifCondition(int i) { return getRuleContext(IfConditionContext.class,i); } public BlockContext block() { return getRuleContext(BlockContext.class,0); } public List<JoinContext> join() { return getRuleContexts(JoinContext.class); } public JoinContext join(int i) { return getRuleContext(JoinContext.class,i); } public ElseIfPartContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_elseIfPart; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitElseIfPart(this); else return visitor.visitChildren(this); } } public final ElseIfPartContext elseIfPart() throws RecognitionException { ElseIfPartContext _localctx = new ElseIfPartContext(_ctx, getState()); enterRule(_localctx, 16, RULE_elseIfPart); int _la; try { enterOuterAlt(_localctx, 1); { setState(173); match(T__5); setState(174); match(T__4); setState(175); match(LeftParen); setState(176); ifCondition(); setState(182); _errHandler.sync(this); _la = _input.LA(1); while (_la==AND || _la==OR) { { { setState(177); join(); setState(178); ifCondition(); } } setState(184); _errHandler.sync(this); _la = _input.LA(1); } setState(185); match(RightParen); setState(186); match(T__2); setState(187); block(); setState(188); match(T__3); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ElsePartContext extends ParserRuleContext { public BlockContext block() { return getRuleContext(BlockContext.class,0); } public ElsePartContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_elsePart; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitElsePart(this); else return visitor.visitChildren(this); } } public final ElsePartContext elsePart() throws RecognitionException { ElsePartContext _localctx = new ElsePartContext(_ctx, getState()); enterRule(_localctx, 18, RULE_elsePart); try { enterOuterAlt(_localctx, 1); { setState(190); match(T__5); setState(191); match(T__2); setState(192); block(); setState(193); match(T__3); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class BlockContext extends ParserRuleContext { public List<ExprBlockContext> exprBlock() { return getRuleContexts(ExprBlockContext.class); } public ExprBlockContext exprBlock(int i) { return getRuleContext(ExprBlockContext.class,i); } public ReturnExprContext returnExpr() { return getRuleContext(ReturnExprContext.class,0); } public BlockContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_block; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitBlock(this); else return visitor.visitChildren(this); } } public final BlockContext block() throws RecognitionException { BlockContext _localctx = new BlockContext(_ctx, getState()); enterRule(_localctx, 20, RULE_block); try { int _alt; enterOuterAlt(_localctx, 1); { setState(198); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,12,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { setState(195); exprBlock(); } } } setState(200); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,12,_ctx); } setState(202); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,13,_ctx) ) { case 1: { setState(201); returnExpr(); } break; } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ExprBlockContext extends ParserRuleContext { public VariableAssignContext variableAssign() { return getRuleContext(VariableAssignContext.class,0); } public IfExprContext ifExpr() { return getRuleContext(IfExprContext.class,0); } public CaseExprContext caseExpr() { return getRuleContext(CaseExprContext.class,0); } public ExprBlockContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_exprBlock; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitExprBlock(this); else return visitor.visitChildren(this); } } public final ExprBlockContext exprBlock() throws RecognitionException { ExprBlockContext _localctx = new ExprBlockContext(_ctx, getState()); enterRule(_localctx, 22, RULE_exprBlock); try { setState(207); switch (_input.LA(1)) { case T__8: case Identifier: enterOuterAlt(_localctx, 1); { setState(204); variableAssign(); } break; case T__4: enterOuterAlt(_localctx, 2); { setState(205); ifExpr(); } break; case T__1: enterOuterAlt(_localctx, 3); { setState(206); caseExpr(); } break; default: throw new NoViableAltException(this); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ReturnExprContext extends ParserRuleContext { public ExprContext expr() { return getRuleContext(ExprContext.class,0); } public ReturnExprContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_returnExpr; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitReturnExpr(this); else return visitor.visitChildren(this); } } public final ReturnExprContext returnExpr() throws RecognitionException { ReturnExprContext _localctx = new ReturnExprContext(_ctx, getState()); enterRule(_localctx, 24, RULE_returnExpr); int _la; try { enterOuterAlt(_localctx, 1); { setState(210); _la = _input.LA(1); if (_la==T__6) { { setState(209); match(T__6); } } setState(212); expr(); setState(214); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,16,_ctx) ) { case 1: { setState(213); match(T__7); } break; } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ExprContext extends ParserRuleContext { public List<ItemContext> item() { return getRuleContexts(ItemContext.class); } public ItemContext item(int i) { return getRuleContext(ItemContext.class,i); } public List<TerminalNode> Operator() { return getTokens(ReportParserParser.Operator); } public TerminalNode Operator(int i) { return getToken(ReportParserParser.Operator, i); } public ExprContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_expr; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitExpr(this); else return visitor.visitChildren(this); } } public final ExprContext expr() throws RecognitionException { ExprContext _localctx = new ExprContext(_ctx, getState()); enterRule(_localctx, 26, RULE_expr); try { int _alt; enterOuterAlt(_localctx, 1); { setState(216); item(); setState(221); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,17,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { setState(217); match(Operator); setState(218); item(); } } } setState(223); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,17,_ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class IfConditionContext extends ParserRuleContext { public List<ExprContext> expr() { return getRuleContexts(ExprContext.class); } public ExprContext expr(int i) { return getRuleContext(ExprContext.class,i); } public TerminalNode OP() { return getToken(ReportParserParser.OP, 0); } public IfConditionContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_ifCondition; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitIfCondition(this); else return visitor.visitChildren(this); } } public final IfConditionContext ifCondition() throws RecognitionException { IfConditionContext _localctx = new IfConditionContext(_ctx, getState()); enterRule(_localctx, 28, RULE_ifCondition); try { enterOuterAlt(_localctx, 1); { setState(224); expr(); setState(225); match(OP); setState(226); expr(); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class VariableAssignContext extends ParserRuleContext { public VariableContext variable() { return getRuleContext(VariableContext.class,0); } public ItemContext item() { return getRuleContext(ItemContext.class,0); } public VariableAssignContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_variableAssign; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitVariableAssign(this); else return visitor.visitChildren(this); } } public final VariableAssignContext variableAssign() throws RecognitionException { VariableAssignContext _localctx = new VariableAssignContext(_ctx, getState()); enterRule(_localctx, 30, RULE_variableAssign); int _la; try { enterOuterAlt(_localctx, 1); { setState(229); _la = _input.LA(1); if (_la==T__8) { { setState(228); match(T__8); } } setState(231); variable(); setState(232); match(T__9); setState(233); item(); setState(235); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,19,_ctx) ) { case 1: { setState(234); match(T__7); } break; } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ItemContext extends ParserRuleContext { public ItemContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_item; } public ItemContext() { } public void copyFrom(ItemContext ctx) { super.copyFrom(ctx); } } public static class SingleParenJoinContext extends ItemContext { public TerminalNode LeftParen() { return getToken(ReportParserParser.LeftParen, 0); } public ItemContext item() { return getRuleContext(ItemContext.class,0); } public TerminalNode RightParen() { return getToken(ReportParserParser.RightParen, 0); } public SingleParenJoinContext(ItemContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitSingleParenJoin(this); else return visitor.visitChildren(this); } } public static class ParenJoinContext extends ItemContext { public TerminalNode LeftParen() { return getToken(ReportParserParser.LeftParen, 0); } public List<ItemContext> item() { return getRuleContexts(ItemContext.class); } public ItemContext item(int i) { return getRuleContext(ItemContext.class,i); } public TerminalNode RightParen() { return getToken(ReportParserParser.RightParen, 0); } public List<TerminalNode> Operator() { return getTokens(ReportParserParser.Operator); } public TerminalNode Operator(int i) { return getToken(ReportParserParser.Operator, i); } public ParenJoinContext(ItemContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitParenJoin(this); else return visitor.visitChildren(this); } } public static class SimpleJoinContext extends ItemContext { public List<UnitContext> unit() { return getRuleContexts(UnitContext.class); } public UnitContext unit(int i) { return getRuleContext(UnitContext.class,i); } public List<TerminalNode> Operator() { return getTokens(ReportParserParser.Operator); } public TerminalNode Operator(int i) { return getToken(ReportParserParser.Operator, i); } public SimpleJoinContext(ItemContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitSimpleJoin(this); else return visitor.visitChildren(this); } } public final ItemContext item() throws RecognitionException { ItemContext _localctx = new ItemContext(_ctx, getState()); enterRule(_localctx, 32, RULE_item); int _la; try { int _alt; setState(259); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,22,_ctx) ) { case 1: _localctx = new SimpleJoinContext(_localctx); enterOuterAlt(_localctx, 1); { setState(237); unit(); setState(242); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,20,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { setState(238); match(Operator); setState(239); unit(); } } } setState(244); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,20,_ctx); } } break; case 2: _localctx = new SingleParenJoinContext(_localctx); enterOuterAlt(_localctx, 2); { setState(245); match(LeftParen); setState(246); item(); setState(247); match(RightParen); } break; case 3: _localctx = new ParenJoinContext(_localctx); enterOuterAlt(_localctx, 3); { setState(249); match(LeftParen); setState(250); item(); setState(253); _errHandler.sync(this); _la = _input.LA(1); do { { { setState(251); match(Operator); setState(252); item(); } } setState(255); _errHandler.sync(this); _la = _input.LA(1); } while ( _la==Operator ); setState(257); match(RightParen); } break; } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class UnitContext extends ParserRuleContext { public DatasetContext dataset() { return getRuleContext(DatasetContext.class,0); } public FunctionContext function() { return getRuleContext(FunctionContext.class,0); } public SetContext set() { return getRuleContext(SetContext.class,0); } public CellPositionContext cellPosition() { return getRuleContext(CellPositionContext.class,0); } public RelativeCellContext relativeCell() { return getRuleContext(RelativeCellContext.class,0); } public CurrentCellValueContext currentCellValue() { return getRuleContext(CurrentCellValueContext.class,0); } public CurrentCellDataContext currentCellData() { return getRuleContext(CurrentCellDataContext.class,0); } public CellContext cell() { return getRuleContext(CellContext.class,0); } public VariableContext variable() { return getRuleContext(VariableContext.class,0); } public TerminalNode INTEGER() { return getToken(ReportParserParser.INTEGER, 0); } public TerminalNode BOOLEAN() { return getToken(ReportParserParser.BOOLEAN, 0); } public TerminalNode STRING() { return getToken(ReportParserParser.STRING, 0); } public TerminalNode NUMBER() { return getToken(ReportParserParser.NUMBER, 0); } public TerminalNode NULL() { return getToken(ReportParserParser.NULL, 0); } public UnitContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_unit; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitUnit(this); else return visitor.visitChildren(this); } } public final UnitContext unit() throws RecognitionException { UnitContext _localctx = new UnitContext(_ctx, getState()); enterRule(_localctx, 34, RULE_unit); try { setState(275); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,23,_ctx) ) { case 1: enterOuterAlt(_localctx, 1); { setState(261); dataset(); } break; case 2: enterOuterAlt(_localctx, 2); { setState(262); function(); } break; case 3: enterOuterAlt(_localctx, 3); { setState(263); set(0); } break; case 4: enterOuterAlt(_localctx, 4); { setState(264); cellPosition(); } break; case 5: enterOuterAlt(_localctx, 5); { setState(265); relativeCell(); } break; case 6: enterOuterAlt(_localctx, 6); { setState(266); currentCellValue(); } break; case 7: enterOuterAlt(_localctx, 7); { setState(267); currentCellData(); } break; case 8: enterOuterAlt(_localctx, 8); { setState(268); cell(); } break; case 9: enterOuterAlt(_localctx, 9); { setState(269); variable(); } break; case 10: enterOuterAlt(_localctx, 10); { setState(270); match(INTEGER); } break; case 11: enterOuterAlt(_localctx, 11); { setState(271); match(BOOLEAN); } break; case 12: enterOuterAlt(_localctx, 12); { setState(272); match(STRING); } break; case 13: enterOuterAlt(_localctx, 13); { setState(273); match(NUMBER); } break; case 14: enterOuterAlt(_localctx, 14); { setState(274); match(NULL); } break; } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class VariableContext extends ParserRuleContext { public TerminalNode Identifier() { return getToken(ReportParserParser.Identifier, 0); } public VariableContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_variable; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitVariable(this); else return visitor.visitChildren(this); } } public final VariableContext variable() throws RecognitionException { VariableContext _localctx = new VariableContext(_ctx, getState()); enterRule(_localctx, 36, RULE_variable); try { enterOuterAlt(_localctx, 1); { setState(277); match(Identifier); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class CellPositionContext extends ParserRuleContext { public TerminalNode Cell() { return getToken(ReportParserParser.Cell, 0); } public CellPositionContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_cellPosition; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitCellPosition(this); else return visitor.visitChildren(this); } } public final CellPositionContext cellPosition() throws RecognitionException { CellPositionContext _localctx = new CellPositionContext(_ctx, getState()); enterRule(_localctx, 38, RULE_cellPosition); try { enterOuterAlt(_localctx, 1); { setState(279); match(T__10); setState(280); match(Cell); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class RelativeCellContext extends ParserRuleContext { public TerminalNode Cell() { return getToken(ReportParserParser.Cell, 0); } public RelativeCellContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_relativeCell; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitRelativeCell(this); else return visitor.visitChildren(this); } } public final RelativeCellContext relativeCell() throws RecognitionException { RelativeCellContext _localctx = new RelativeCellContext(_ctx, getState()); enterRule(_localctx, 40, RULE_relativeCell); try { enterOuterAlt(_localctx, 1); { setState(282); match(T__11); setState(283); match(Cell); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class CurrentCellValueContext extends ParserRuleContext { public CurrentCellValueContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_currentCellValue; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitCurrentCellValue(this); else return visitor.visitChildren(this); } } public final CurrentCellValueContext currentCellValue() throws RecognitionException { CurrentCellValueContext _localctx = new CurrentCellValueContext(_ctx, getState()); enterRule(_localctx, 42, RULE_currentCellValue); try { enterOuterAlt(_localctx, 1); { setState(285); match(T__12); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class CurrentCellDataContext extends ParserRuleContext { public PropertyContext property() { return getRuleContext(PropertyContext.class,0); } public CurrentCellDataContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_currentCellData; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitCurrentCellData(this); else return visitor.visitChildren(this); } } public final CurrentCellDataContext currentCellData() throws RecognitionException { CurrentCellDataContext _localctx = new CurrentCellDataContext(_ctx, getState()); enterRule(_localctx, 44, RULE_currentCellData); try { enterOuterAlt(_localctx, 1); { setState(287); match(T__12); setState(288); match(T__13); setState(289); property(0); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class CellContext extends ParserRuleContext { public PropertyContext property() { return getRuleContext(PropertyContext.class,0); } public CellContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_cell; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitCell(this); else return visitor.visitChildren(this); } } public final CellContext cell() throws RecognitionException { CellContext _localctx = new CellContext(_ctx, getState()); enterRule(_localctx, 46, RULE_cell); try { enterOuterAlt(_localctx, 1); { setState(291); match(T__14); setState(294); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,24,_ctx) ) { case 1: { setState(292); match(T__13); setState(293); property(0); } break; } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class DatasetContext extends ParserRuleContext { public TerminalNode Identifier() { return getToken(ReportParserParser.Identifier, 0); } public AggregateContext aggregate() { return getRuleContext(AggregateContext.class,0); } public PropertyContext property() { return getRuleContext(PropertyContext.class,0); } public ConditionsContext conditions() { return getRuleContext(ConditionsContext.class,0); } public TerminalNode ORDER() { return getToken(ReportParserParser.ORDER, 0); } public DatasetContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_dataset; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitDataset(this); else return visitor.visitChildren(this); } } public final DatasetContext dataset() throws RecognitionException { DatasetContext _localctx = new DatasetContext(_ctx, getState()); enterRule(_localctx, 48, RULE_dataset); int _la; try { enterOuterAlt(_localctx, 1); { setState(296); match(Identifier); setState(297); match(T__13); setState(298); aggregate(); setState(299); match(LeftParen); setState(301); _la = _input.LA(1); if (_la==Identifier) { { setState(300); property(0); } } setState(305); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,26,_ctx) ) { case 1: { setState(303); match(COMMA); setState(304); conditions(); } break; } setState(309); _la = _input.LA(1); if (_la==COMMA) { { setState(307); match(COMMA); setState(308); match(ORDER); } } setState(311); match(RightParen); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class FunctionContext extends ParserRuleContext { public TerminalNode Identifier() { return getToken(ReportParserParser.Identifier, 0); } public FunctionParameterContext functionParameter() { return getRuleContext(FunctionParameterContext.class,0); } public FunctionContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_function; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitFunction(this); else return visitor.visitChildren(this); } } public final FunctionContext function() throws RecognitionException { FunctionContext _localctx = new FunctionContext(_ctx, getState()); enterRule(_localctx, 50, RULE_function); int _la; try { enterOuterAlt(_localctx, 1); { setState(313); match(Identifier); setState(314); match(LeftParen); setState(316); _la = _input.LA(1); if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__10) | (1L << T__11) | (1L << T__12) | (1L << T__14) | (1L << Cell) | (1L << BOOLEAN) | (1L << NULL) | (1L << LeftParen) | (1L << STRING) | (1L << INTEGER) | (1L << NUMBER) | (1L << Identifier))) != 0)) { { setState(315); functionParameter(); } } setState(318); match(RightParen); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class FunctionParameterContext extends ParserRuleContext { public List<ItemContext> item() { return getRuleContexts(ItemContext.class); } public ItemContext item(int i) { return getRuleContext(ItemContext.class,i); } public FunctionParameterContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_functionParameter; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitFunctionParameter(this); else return visitor.visitChildren(this); } } public final FunctionParameterContext functionParameter() throws RecognitionException { FunctionParameterContext _localctx = new FunctionParameterContext(_ctx, getState()); enterRule(_localctx, 52, RULE_functionParameter); int _la; try { enterOuterAlt(_localctx, 1); { setState(320); item(); setState(327); _errHandler.sync(this); _la = _input.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__10) | (1L << T__11) | (1L << T__12) | (1L << T__14) | (1L << Cell) | (1L << BOOLEAN) | (1L << COMMA) | (1L << NULL) | (1L << LeftParen) | (1L << STRING) | (1L << INTEGER) | (1L << NUMBER) | (1L << Identifier))) != 0)) { { { setState(322); _la = _input.LA(1); if (_la==COMMA) { { setState(321); match(COMMA); } } setState(324); item(); } } setState(329); _errHandler.sync(this); _la = _input.LA(1); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class SetContext extends ParserRuleContext { public SetContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_set; } public SetContext() { } public void copyFrom(SetContext ctx) { super.copyFrom(ctx); } } public static class CellPairContext extends SetContext { public List<TerminalNode> Cell() { return getTokens(ReportParserParser.Cell); } public TerminalNode Cell(int i) { return getToken(ReportParserParser.Cell, i); } public CellPairContext(SetContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitCellPair(this); else return visitor.visitChildren(this); } } public static class WholeCellContext extends SetContext { public TerminalNode Cell() { return getToken(ReportParserParser.Cell, 0); } public ConditionsContext conditions() { return getRuleContext(ConditionsContext.class,0); } public WholeCellContext(SetContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitWholeCell(this); else return visitor.visitChildren(this); } } public static class CellCoordinateConditionContext extends SetContext { public TerminalNode Cell() { return getToken(ReportParserParser.Cell, 0); } public CellCoordinateContext cellCoordinate() { return getRuleContext(CellCoordinateContext.class,0); } public ConditionsContext conditions() { return getRuleContext(ConditionsContext.class,0); } public CellCoordinateConditionContext(SetContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitCellCoordinateCondition(this); else return visitor.visitChildren(this); } } public static class SingleCellConditionContext extends SetContext { public TerminalNode Cell() { return getToken(ReportParserParser.Cell, 0); } public ConditionsContext conditions() { return getRuleContext(ConditionsContext.class,0); } public SingleCellConditionContext(SetContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitSingleCellCondition(this); else return visitor.visitChildren(this); } } public static class SingleCellContext extends SetContext { public TerminalNode Cell() { return getToken(ReportParserParser.Cell, 0); } public SingleCellContext(SetContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitSingleCell(this); else return visitor.visitChildren(this); } } public static class SimpleDataContext extends SetContext { public SimpleValueContext simpleValue() { return getRuleContext(SimpleValueContext.class,0); } public SimpleDataContext(SetContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitSimpleData(this); else return visitor.visitChildren(this); } } public static class RangeContext extends SetContext { public List<SetContext> set() { return getRuleContexts(SetContext.class); } public SetContext set(int i) { return getRuleContext(SetContext.class,i); } public RangeContext(SetContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitRange(this); else return visitor.visitChildren(this); } } public static class SingleCellCoordinateContext extends SetContext { public TerminalNode Cell() { return getToken(ReportParserParser.Cell, 0); } public CellCoordinateContext cellCoordinate() { return getRuleContext(CellCoordinateContext.class,0); } public SingleCellCoordinateContext(SetContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitSingleCellCoordinate(this); else return visitor.visitChildren(this); } } public final SetContext set() throws RecognitionException { return set(0); } private SetContext set(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); SetContext _localctx = new SetContext(_ctx, _parentState); SetContext _prevctx = _localctx; int _startState = 54; enterRecursionRule(_localctx, 54, RULE_set, _p); try { int _alt; enterOuterAlt(_localctx, 1); { setState(363); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,32,_ctx) ) { case 1: { _localctx = new SimpleDataContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(331); simpleValue(); } break; case 2: { _localctx = new SingleCellContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(332); match(Cell); } break; case 3: { _localctx = new WholeCellContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(333); match(Cell); setState(334); match(T__15); setState(335); match(T__16); setState(340); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,31,_ctx) ) { case 1: { setState(336); match(T__2); setState(337); conditions(); setState(338); match(T__3); } break; } } break; case 4: { _localctx = new CellPairContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(342); match(Cell); setState(343); match(COLON); setState(344); match(Cell); } break; case 5: { _localctx = new SingleCellConditionContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(345); match(Cell); setState(346); match(T__2); setState(347); conditions(); setState(348); match(T__3); } break; case 6: { _localctx = new SingleCellCoordinateContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(350); match(Cell); setState(351); match(T__15); setState(352); cellCoordinate(); setState(353); match(T__16); } break; case 7: { _localctx = new CellCoordinateConditionContext(_localctx); _ctx = _localctx; _prevctx = _localctx; setState(355); match(Cell); setState(356); match(T__15); setState(357); cellCoordinate(); setState(358); match(T__16); setState(359); match(T__2); setState(360); conditions(); setState(361); match(T__3); } break; } _ctx.stop = _input.LT(-1); setState(370); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,33,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { if ( _parseListeners!=null ) triggerExitRuleEvent(); _prevctx = _localctx; { { _localctx = new RangeContext(new SetContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_set); setState(365); if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); setState(366); match(T__17); setState(367); set(2); } } } setState(372); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,33,_ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { unrollRecursionContexts(_parentctx); } return _localctx; } public static class CellCoordinateContext extends ParserRuleContext { public List<CoordinateContext> coordinate() { return getRuleContexts(CoordinateContext.class); } public CoordinateContext coordinate(int i) { return getRuleContext(CoordinateContext.class,i); } public CellCoordinateContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_cellCoordinate; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitCellCoordinate(this); else return visitor.visitChildren(this); } } public final CellCoordinateContext cellCoordinate() throws RecognitionException { CellCoordinateContext _localctx = new CellCoordinateContext(_ctx, getState()); enterRule(_localctx, 56, RULE_cellCoordinate); int _la; try { enterOuterAlt(_localctx, 1); { setState(373); coordinate(); setState(376); _la = _input.LA(1); if (_la==T__7) { { setState(374); match(T__7); setState(375); coordinate(); } } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class CoordinateContext extends ParserRuleContext { public List<CellIndicatorContext> cellIndicator() { return getRuleContexts(CellIndicatorContext.class); } public CellIndicatorContext cellIndicator(int i) { return getRuleContext(CellIndicatorContext.class,i); } public CoordinateContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_coordinate; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitCoordinate(this); else return visitor.visitChildren(this); } } public final CoordinateContext coordinate() throws RecognitionException { CoordinateContext _localctx = new CoordinateContext(_ctx, getState()); enterRule(_localctx, 58, RULE_coordinate); int _la; try { enterOuterAlt(_localctx, 1); { setState(378); cellIndicator(); setState(383); _errHandler.sync(this); _la = _input.LA(1); while (_la==COMMA) { { { setState(379); match(COMMA); setState(380); cellIndicator(); } } setState(385); _errHandler.sync(this); _la = _input.LA(1); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class CellIndicatorContext extends ParserRuleContext { public CellIndicatorContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_cellIndicator; } public CellIndicatorContext() { } public void copyFrom(CellIndicatorContext ctx) { super.copyFrom(ctx); } } public static class AbsoluteContext extends CellIndicatorContext { public TerminalNode Cell() { return getToken(ReportParserParser.Cell, 0); } public TerminalNode INTEGER() { return getToken(ReportParserParser.INTEGER, 0); } public TerminalNode EXCLAMATION() { return getToken(ReportParserParser.EXCLAMATION, 0); } public AbsoluteContext(CellIndicatorContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitAbsolute(this); else return visitor.visitChildren(this); } } public static class RelativeContext extends CellIndicatorContext { public TerminalNode Cell() { return getToken(ReportParserParser.Cell, 0); } public RelativeContext(CellIndicatorContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitRelative(this); else return visitor.visitChildren(this); } } public final CellIndicatorContext cellIndicator() throws RecognitionException { CellIndicatorContext _localctx = new CellIndicatorContext(_ctx, getState()); enterRule(_localctx, 60, RULE_cellIndicator); int _la; try { setState(393); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,37,_ctx) ) { case 1: _localctx = new RelativeContext(_localctx); enterOuterAlt(_localctx, 1); { setState(386); match(Cell); } break; case 2: _localctx = new AbsoluteContext(_localctx); enterOuterAlt(_localctx, 2); { setState(387); match(Cell); setState(388); match(COLON); setState(390); _la = _input.LA(1); if (_la==EXCLAMATION) { { setState(389); match(EXCLAMATION); } } setState(392); match(INTEGER); } break; } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ConditionsContext extends ParserRuleContext { public List<ConditionContext> condition() { return getRuleContexts(ConditionContext.class); } public ConditionContext condition(int i) { return getRuleContext(ConditionContext.class,i); } public List<JoinContext> join() { return getRuleContexts(JoinContext.class); } public JoinContext join(int i) { return getRuleContext(JoinContext.class,i); } public ConditionsContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_conditions; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitConditions(this); else return visitor.visitChildren(this); } } public final ConditionsContext conditions() throws RecognitionException { ConditionsContext _localctx = new ConditionsContext(_ctx, getState()); enterRule(_localctx, 62, RULE_conditions); int _la; try { enterOuterAlt(_localctx, 1); { setState(395); condition(); setState(401); _errHandler.sync(this); _la = _input.LA(1); while (_la==AND || _la==OR) { { { setState(396); join(); setState(397); condition(); } } setState(403); _errHandler.sync(this); _la = _input.LA(1); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ConditionContext extends ParserRuleContext { public ConditionContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_condition; } public ConditionContext() { } public void copyFrom(ConditionContext ctx) { super.copyFrom(ctx); } } public static class ExprConditionContext extends ConditionContext { public List<ExprContext> expr() { return getRuleContexts(ExprContext.class); } public ExprContext expr(int i) { return getRuleContext(ExprContext.class,i); } public TerminalNode OP() { return getToken(ReportParserParser.OP, 0); } public ExprConditionContext(ConditionContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitExprCondition(this); else return visitor.visitChildren(this); } } public static class CurrentValueConditionContext extends ConditionContext { public CurrentValueContext currentValue() { return getRuleContext(CurrentValueContext.class,0); } public TerminalNode OP() { return getToken(ReportParserParser.OP, 0); } public ExprContext expr() { return getRuleContext(ExprContext.class,0); } public CurrentValueConditionContext(ConditionContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitCurrentValueCondition(this); else return visitor.visitChildren(this); } } public static class PropertyConditionContext extends ConditionContext { public PropertyContext property() { return getRuleContext(PropertyContext.class,0); } public TerminalNode OP() { return getToken(ReportParserParser.OP, 0); } public ExprContext expr() { return getRuleContext(ExprContext.class,0); } public PropertyConditionContext(ConditionContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitPropertyCondition(this); else return visitor.visitChildren(this); } } public static class CellNameExprConditionContext extends ConditionContext { public TerminalNode Cell() { return getToken(ReportParserParser.Cell, 0); } public TerminalNode OP() { return getToken(ReportParserParser.OP, 0); } public ExprContext expr() { return getRuleContext(ExprContext.class,0); } public CellNameExprConditionContext(ConditionContext ctx) { copyFrom(ctx); } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitCellNameExprCondition(this); else return visitor.visitChildren(this); } } public final ConditionContext condition() throws RecognitionException { ConditionContext _localctx = new ConditionContext(_ctx, getState()); enterRule(_localctx, 64, RULE_condition); try { setState(419); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,39,_ctx) ) { case 1: _localctx = new CellNameExprConditionContext(_localctx); enterOuterAlt(_localctx, 1); { setState(404); match(Cell); setState(405); match(OP); setState(406); expr(); } break; case 2: _localctx = new PropertyConditionContext(_localctx); enterOuterAlt(_localctx, 2); { setState(407); property(0); setState(408); match(OP); setState(409); expr(); } break; case 3: _localctx = new CurrentValueConditionContext(_localctx); enterOuterAlt(_localctx, 3); { setState(411); currentValue(); setState(412); match(OP); setState(413); expr(); } break; case 4: _localctx = new ExprConditionContext(_localctx); enterOuterAlt(_localctx, 4); { setState(415); expr(); setState(416); match(OP); setState(417); expr(); } break; } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class PropertyContext extends ParserRuleContext { public TerminalNode Identifier() { return getToken(ReportParserParser.Identifier, 0); } public List<PropertyContext> property() { return getRuleContexts(PropertyContext.class); } public PropertyContext property(int i) { return getRuleContext(PropertyContext.class,i); } public PropertyContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_property; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitProperty(this); else return visitor.visitChildren(this); } } public final PropertyContext property() throws RecognitionException { return property(0); } private PropertyContext property(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); PropertyContext _localctx = new PropertyContext(_ctx, _parentState); PropertyContext _prevctx = _localctx; int _startState = 66; enterRecursionRule(_localctx, 66, RULE_property, _p); try { int _alt; enterOuterAlt(_localctx, 1); { { setState(422); match(Identifier); } _ctx.stop = _input.LT(-1); setState(429); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,40,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { if ( _parseListeners!=null ) triggerExitRuleEvent(); _prevctx = _localctx; { { _localctx = new PropertyContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_property); setState(424); if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); setState(425); match(T__13); setState(426); property(2); } } } setState(431); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,40,_ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { unrollRecursionContexts(_parentctx); } return _localctx; } public static class CurrentValueContext extends ParserRuleContext { public CurrentValueContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_currentValue; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitCurrentValue(this); else return visitor.visitChildren(this); } } public final CurrentValueContext currentValue() throws RecognitionException { CurrentValueContext _localctx = new CurrentValueContext(_ctx, getState()); enterRule(_localctx, 68, RULE_currentValue); try { enterOuterAlt(_localctx, 1); { setState(432); match(T__18); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class SimpleValueContext extends ParserRuleContext { public TerminalNode INTEGER() { return getToken(ReportParserParser.INTEGER, 0); } public TerminalNode NUMBER() { return getToken(ReportParserParser.NUMBER, 0); } public TerminalNode STRING() { return getToken(ReportParserParser.STRING, 0); } public TerminalNode BOOLEAN() { return getToken(ReportParserParser.BOOLEAN, 0); } public TerminalNode NULL() { return getToken(ReportParserParser.NULL, 0); } public SimpleValueContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_simpleValue; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitSimpleValue(this); else return visitor.visitChildren(this); } } public final SimpleValueContext simpleValue() throws RecognitionException { SimpleValueContext _localctx = new SimpleValueContext(_ctx, getState()); enterRule(_localctx, 70, RULE_simpleValue); int _la; try { enterOuterAlt(_localctx, 1); { setState(434); _la = _input.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << BOOLEAN) | (1L << NULL) | (1L << STRING) | (1L << INTEGER) | (1L << NUMBER))) != 0)) ) { _errHandler.recoverInline(this); } else { consume(); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class JoinContext extends ParserRuleContext { public TerminalNode AND() { return getToken(ReportParserParser.AND, 0); } public TerminalNode OR() { return getToken(ReportParserParser.OR, 0); } public JoinContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_join; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitJoin(this); else return visitor.visitChildren(this); } } public final JoinContext join() throws RecognitionException { JoinContext _localctx = new JoinContext(_ctx, getState()); enterRule(_localctx, 72, RULE_join); int _la; try { enterOuterAlt(_localctx, 1); { setState(436); _la = _input.LA(1); if ( !(_la==AND || _la==OR) ) { _errHandler.recoverInline(this); } else { consume(); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class AggregateContext extends ParserRuleContext { public TerminalNode Identifier() { return getToken(ReportParserParser.Identifier, 0); } public AggregateContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_aggregate; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof ReportParserVisitor ) return ((ReportParserVisitor<? extends T>)visitor).visitAggregate(this); else return visitor.visitChildren(this); } } public final AggregateContext aggregate() throws RecognitionException { AggregateContext _localctx = new AggregateContext(_ctx, getState()); enterRule(_localctx, 74, RULE_aggregate); try { enterOuterAlt(_localctx, 1); { setState(438); match(Identifier); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { switch (ruleIndex) { case 2: return exprComposite_sempred((ExprCompositeContext)_localctx, predIndex); case 27: return set_sempred((SetContext)_localctx, predIndex); case 33: return property_sempred((PropertyContext)_localctx, predIndex); } return true; } private boolean exprComposite_sempred(ExprCompositeContext _localctx, int predIndex) { switch (predIndex) { case 0: return precpred(_ctx, 1); } return true; } private boolean set_sempred(SetContext _localctx, int predIndex) { switch (predIndex) { case 1: return precpred(_ctx, 1); } return true; } private boolean property_sempred(PropertyContext _localctx, int predIndex) { switch (predIndex) { case 2: return precpred(_ctx, 1); } return true; } public static final String _serializedATN = "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3,\u01bb\4\2\t\2\4"+ "\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t"+ "\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+ "\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+ "\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+ "\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\3\2\6\2P\n\2\r\2\16\2Q\3\2"+ "\3\2\3\3\3\3\3\3\3\3\3\3\5\3[\n\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\5\4d\n\4"+ "\3\4\3\4\3\4\7\4i\n\4\f\4\16\4l\13\4\3\5\3\5\3\5\3\5\7\5r\n\5\f\5\16\5"+ "u\13\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\7\6\u0081\n\6\f\6\16\6"+ "\u0084\13\6\3\6\3\6\3\7\3\7\3\7\3\7\7\7\u008c\n\7\f\7\16\7\u008f\13\7"+ "\3\7\5\7\u0092\n\7\3\7\3\7\3\b\3\b\7\b\u0098\n\b\f\b\16\b\u009b\13\b\3"+ "\b\5\b\u009e\n\b\3\t\3\t\3\t\3\t\3\t\3\t\7\t\u00a6\n\t\f\t\16\t\u00a9"+ "\13\t\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3\n\3\n\3\n\7\n\u00b7\n\n\f"+ "\n\16\n\u00ba\13\n\3\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\13\3\f\7"+ "\f\u00c7\n\f\f\f\16\f\u00ca\13\f\3\f\5\f\u00cd\n\f\3\r\3\r\3\r\5\r\u00d2"+ "\n\r\3\16\5\16\u00d5\n\16\3\16\3\16\5\16\u00d9\n\16\3\17\3\17\3\17\7\17"+ "\u00de\n\17\f\17\16\17\u00e1\13\17\3\20\3\20\3\20\3\20\3\21\5\21\u00e8"+ "\n\21\3\21\3\21\3\21\3\21\5\21\u00ee\n\21\3\22\3\22\3\22\7\22\u00f3\n"+ "\22\f\22\16\22\u00f6\13\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\6\22"+ "\u0100\n\22\r\22\16\22\u0101\3\22\3\22\5\22\u0106\n\22\3\23\3\23\3\23"+ "\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\5\23\u0116\n\23"+ "\3\24\3\24\3\25\3\25\3\25\3\26\3\26\3\26\3\27\3\27\3\30\3\30\3\30\3\30"+ "\3\31\3\31\3\31\5\31\u0129\n\31\3\32\3\32\3\32\3\32\3\32\5\32\u0130\n"+ "\32\3\32\3\32\5\32\u0134\n\32\3\32\3\32\5\32\u0138\n\32\3\32\3\32\3\33"+ "\3\33\3\33\5\33\u013f\n\33\3\33\3\33\3\34\3\34\5\34\u0145\n\34\3\34\7"+ "\34\u0148\n\34\f\34\16\34\u014b\13\34\3\35\3\35\3\35\3\35\3\35\3\35\3"+ "\35\3\35\3\35\3\35\5\35\u0157\n\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35"+ "\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35"+ "\5\35\u016e\n\35\3\35\3\35\3\35\7\35\u0173\n\35\f\35\16\35\u0176\13\35"+ "\3\36\3\36\3\36\5\36\u017b\n\36\3\37\3\37\3\37\7\37\u0180\n\37\f\37\16"+ "\37\u0183\13\37\3 \3 \3 \3 \5 \u0189\n \3 \5 \u018c\n \3!\3!\3!\3!\7!"+ "\u0192\n!\f!\16!\u0195\13!\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\""+ "\3\"\3\"\3\"\3\"\5\"\u01a6\n\"\3#\3#\3#\3#\3#\3#\7#\u01ae\n#\f#\16#\u01b1"+ "\13#\3$\3$\3%\3%\3&\3&\3\'\3\'\3\'\2\5\68D(\2\4\6\b\n\f\16\20\22\24\26"+ "\30\32\34\36 \"$&(*,.\60\62\64\668:<>@BDFHJL\2\4\6\2\32\32\35\35 #$\3"+ "\2!\"\u01d6\2O\3\2\2\2\4Z\3\2\2\2\6c\3\2\2\2\bm\3\2\2\2\n{\3\2\2\2\f\u0087"+ "\3\2\2\2\16\u0095\3\2\2\2\20\u009f\3\2\2\2\22\u00af\3\2\2\2\24\u00c0\3"+ "\2\2\2\26\u00c8\3\2\2\2\30\u00d1\3\2\2\2\32\u00d4\3\2\2\2\34\u00da\3\2"+ "\2\2\36\u00e2\3\2\2\2 \u00e7\3\2\2\2\"\u0105\3\2\2\2$\u0115\3\2\2\2&\u0117"+ "\3\2\2\2(\u0119\3\2\2\2*\u011c\3\2\2\2,\u011f\3\2\2\2.\u0121\3\2\2\2\60"+ "\u0125\3\2\2\2\62\u012a\3\2\2\2\64\u013b\3\2\2\2\66\u0142\3\2\2\28\u016d"+ "\3\2\2\2:\u0177\3\2\2\2<\u017c\3\2\2\2>\u018b\3\2\2\2@\u018d\3\2\2\2B"+ "\u01a5\3\2\2\2D\u01a7\3\2\2\2F\u01b2\3\2\2\2H\u01b4\3\2\2\2J\u01b6\3\2"+ "\2\2L\u01b8\3\2\2\2NP\5\4\3\2ON\3\2\2\2PQ\3\2\2\2QO\3\2\2\2QR\3\2\2\2"+ "RS\3\2\2\2ST\7\2\2\3T\3\3\2\2\2U[\5\6\4\2V[\5\16\b\2W[\5\n\6\2X[\5\32"+ "\16\2Y[\5 \21\2ZU\3\2\2\2ZV\3\2\2\2ZW\3\2\2\2ZX\3\2\2\2ZY\3\2\2\2[\5\3"+ "\2\2\2\\]\b\4\1\2]d\5\34\17\2^d\5\b\5\2_`\7\36\2\2`a\5\6\4\2ab\7\37\2"+ "\2bd\3\2\2\2c\\\3\2\2\2c^\3\2\2\2c_\3\2\2\2dj\3\2\2\2ef\f\3\2\2fg\7\27"+ "\2\2gi\5\6\4\4he\3\2\2\2il\3\2\2\2jh\3\2\2\2jk\3\2\2\2k\7\3\2\2\2lj\3"+ "\2\2\2ms\5\36\20\2no\5J&\2op\5\36\20\2pr\3\2\2\2qn\3\2\2\2ru\3\2\2\2s"+ "q\3\2\2\2st\3\2\2\2tv\3\2\2\2us\3\2\2\2vw\7\3\2\2wx\5\26\f\2xy\7\33\2"+ "\2yz\5\26\f\2z\t\3\2\2\2{|\7\4\2\2|}\7\5\2\2}\u0082\5\f\7\2~\177\7\34"+ "\2\2\177\u0081\5\f\7\2\u0080~\3\2\2\2\u0081\u0084\3\2\2\2\u0082\u0080"+ "\3\2\2\2\u0082\u0083\3\2\2\2\u0083\u0085\3\2\2\2\u0084\u0082\3\2\2\2\u0085"+ "\u0086\7\6\2\2\u0086\13\3\2\2\2\u0087\u008d\5\36\20\2\u0088\u0089\5J&"+ "\2\u0089\u008a\5\36\20\2\u008a\u008c\3\2\2\2\u008b\u0088\3\2\2\2\u008c"+ "\u008f\3\2\2\2\u008d\u008b\3\2\2\2\u008d\u008e\3\2\2\2\u008e\u0091\3\2"+ "\2\2\u008f\u008d\3\2\2\2\u0090\u0092\7\33\2\2\u0091\u0090\3\2\2\2\u0091"+ "\u0092\3\2\2\2\u0092\u0093\3\2\2\2\u0093\u0094\5\26\f\2\u0094\r\3\2\2"+ "\2\u0095\u0099\5\20\t\2\u0096\u0098\5\22\n\2\u0097\u0096\3\2\2\2\u0098"+ "\u009b\3\2\2\2\u0099\u0097\3\2\2\2\u0099\u009a\3\2\2\2\u009a\u009d\3\2"+ "\2\2\u009b\u0099\3\2\2\2\u009c\u009e\5\24\13\2\u009d\u009c\3\2\2\2\u009d"+ "\u009e\3\2\2\2\u009e\17\3\2\2\2\u009f\u00a0\7\7\2\2\u00a0\u00a1\7\36\2"+ "\2\u00a1\u00a7\5\36\20\2\u00a2\u00a3\5J&\2\u00a3\u00a4\5\36\20\2\u00a4"+ "\u00a6\3\2\2\2\u00a5\u00a2\3\2\2\2\u00a6\u00a9\3\2\2\2\u00a7\u00a5\3\2"+ "\2\2\u00a7\u00a8\3\2\2\2\u00a8\u00aa\3\2\2\2\u00a9\u00a7\3\2\2\2\u00aa"+ "\u00ab\7\37\2\2\u00ab\u00ac\7\5\2\2\u00ac\u00ad\5\26\f\2\u00ad\u00ae\7"+ "\6\2\2\u00ae\21\3\2\2\2\u00af\u00b0\7\b\2\2\u00b0\u00b1\7\7\2\2\u00b1"+ "\u00b2\7\36\2\2\u00b2\u00b8\5\36\20\2\u00b3\u00b4\5J&\2\u00b4\u00b5\5"+ "\36\20\2\u00b5\u00b7\3\2\2\2\u00b6\u00b3\3\2\2\2\u00b7\u00ba\3\2\2\2\u00b8"+ "\u00b6\3\2\2\2\u00b8\u00b9\3\2\2\2\u00b9\u00bb\3\2\2\2\u00ba\u00b8\3\2"+ "\2\2\u00bb\u00bc\7\37\2\2\u00bc\u00bd\7\5\2\2\u00bd\u00be\5\26\f\2\u00be"+ "\u00bf\7\6\2\2\u00bf\23\3\2\2\2\u00c0\u00c1\7\b\2\2\u00c1\u00c2\7\5\2"+ "\2\u00c2\u00c3\5\26\f\2\u00c3\u00c4\7\6\2\2\u00c4\25\3\2\2\2\u00c5\u00c7"+ "\5\30\r\2\u00c6\u00c5\3\2\2\2\u00c7\u00ca\3\2\2\2\u00c8\u00c6\3\2\2\2"+ "\u00c8\u00c9\3\2\2\2\u00c9\u00cc\3\2\2\2\u00ca\u00c8\3\2\2\2\u00cb\u00cd"+ "\5\32\16\2\u00cc\u00cb\3\2\2\2\u00cc\u00cd\3\2\2\2\u00cd\27\3\2\2\2\u00ce"+ "\u00d2\5 \21\2\u00cf\u00d2\5\16\b\2\u00d0\u00d2\5\n\6\2\u00d1\u00ce\3"+ "\2\2\2\u00d1\u00cf\3\2\2\2\u00d1\u00d0\3\2\2\2\u00d2\31\3\2\2\2\u00d3"+ "\u00d5\7\t\2\2\u00d4\u00d3\3\2\2\2\u00d4\u00d5\3\2\2\2\u00d5\u00d6\3\2"+ "\2\2\u00d6\u00d8\5\34\17\2\u00d7\u00d9\7\n\2\2\u00d8\u00d7\3\2\2\2\u00d8"+ "\u00d9\3\2\2\2\u00d9\33\3\2\2\2\u00da\u00df\5\"\22\2\u00db\u00dc\7\27"+ "\2\2\u00dc\u00de\5\"\22\2\u00dd\u00db\3\2\2\2\u00de\u00e1\3\2\2\2\u00df"+ "\u00dd\3\2\2\2\u00df\u00e0\3\2\2\2\u00e0\35\3\2\2\2\u00e1\u00df\3\2\2"+ "\2\u00e2\u00e3\5\34\17\2\u00e3\u00e4\7\30\2\2\u00e4\u00e5\5\34\17\2\u00e5"+ "\37\3\2\2\2\u00e6\u00e8\7\13\2\2\u00e7\u00e6\3\2\2\2\u00e7\u00e8\3\2\2"+ "\2\u00e8\u00e9\3\2\2\2\u00e9\u00ea\5&\24\2\u00ea\u00eb\7\f\2\2\u00eb\u00ed"+ "\5\"\22\2\u00ec\u00ee\7\n\2\2\u00ed\u00ec\3\2\2\2\u00ed\u00ee\3\2\2\2"+ "\u00ee!\3\2\2\2\u00ef\u00f4\5$\23\2\u00f0\u00f1\7\27\2\2\u00f1\u00f3\5"+ "$\23\2\u00f2\u00f0\3\2\2\2\u00f3\u00f6\3\2\2\2\u00f4\u00f2\3\2\2\2\u00f4"+ "\u00f5\3\2\2\2\u00f5\u0106\3\2\2\2\u00f6\u00f4\3\2\2\2\u00f7\u00f8\7\36"+ "\2\2\u00f8\u00f9\5\"\22\2\u00f9\u00fa\7\37\2\2\u00fa\u0106\3\2\2\2\u00fb"+ "\u00fc\7\36\2\2\u00fc\u00ff\5\"\22\2\u00fd\u00fe\7\27\2\2\u00fe\u0100"+ "\5\"\22\2\u00ff\u00fd\3\2\2\2\u0100\u0101\3\2\2\2\u0101\u00ff\3\2\2\2"+ "\u0101\u0102\3\2\2\2\u0102\u0103\3\2\2\2\u0103\u0104\7\37\2\2\u0104\u0106"+ "\3\2\2\2\u0105\u00ef\3\2\2\2\u0105\u00f7\3\2\2\2\u0105\u00fb\3\2\2\2\u0106"+ "#\3\2\2\2\u0107\u0116\5\62\32\2\u0108\u0116\5\64\33\2\u0109\u0116\58\35"+ "\2\u010a\u0116\5(\25\2\u010b\u0116\5*\26\2\u010c\u0116\5,\27\2\u010d\u0116"+ "\5.\30\2\u010e\u0116\5\60\31\2\u010f\u0116\5&\24\2\u0110\u0116\7#\2\2"+ "\u0111\u0116\7\32\2\2\u0112\u0116\7 \2\2\u0113\u0116\7$\2\2\u0114\u0116"+ "\7\35\2\2\u0115\u0107\3\2\2\2\u0115\u0108\3\2\2\2\u0115\u0109\3\2\2\2"+ "\u0115\u010a\3\2\2\2\u0115\u010b\3\2\2\2\u0115\u010c\3\2\2\2\u0115\u010d"+ "\3\2\2\2\u0115\u010e\3\2\2\2\u0115\u010f\3\2\2\2\u0115\u0110\3\2\2\2\u0115"+ "\u0111\3\2\2\2\u0115\u0112\3\2\2\2\u0115\u0113\3\2\2\2\u0115\u0114\3\2"+ "\2\2\u0116%\3\2\2\2\u0117\u0118\7\'\2\2\u0118\'\3\2\2\2\u0119\u011a\7"+ "\r\2\2\u011a\u011b\7\26\2\2\u011b)\3\2\2\2\u011c\u011d\7\16\2\2\u011d"+ "\u011e\7\26\2\2\u011e+\3\2\2\2\u011f\u0120\7\17\2\2\u0120-\3\2\2\2\u0121"+ "\u0122\7\17\2\2\u0122\u0123\7\20\2\2\u0123\u0124\5D#\2\u0124/\3\2\2\2"+ "\u0125\u0128\7\21\2\2\u0126\u0127\7\20\2\2\u0127\u0129\5D#\2\u0128\u0126"+ "\3\2\2\2\u0128\u0129\3\2\2\2\u0129\61\3\2\2\2\u012a\u012b\7\'\2\2\u012b"+ "\u012c\7\20\2\2\u012c\u012d\5L\'\2\u012d\u012f\7\36\2\2\u012e\u0130\5"+ "D#\2\u012f\u012e\3\2\2\2\u012f\u0130\3\2\2\2\u0130\u0133\3\2\2\2\u0131"+ "\u0132\7\34\2\2\u0132\u0134\5@!\2\u0133\u0131\3\2\2\2\u0133\u0134\3\2"+ "\2\2\u0134\u0137\3\2\2\2\u0135\u0136\7\34\2\2\u0136\u0138\7\31\2\2\u0137"+ "\u0135\3\2\2\2\u0137\u0138\3\2\2\2\u0138\u0139\3\2\2\2\u0139\u013a\7\37"+ "\2\2\u013a\63\3\2\2\2\u013b\u013c\7\'\2\2\u013c\u013e\7\36\2\2\u013d\u013f"+ "\5\66\34\2\u013e\u013d\3\2\2\2\u013e\u013f\3\2\2\2\u013f\u0140\3\2\2\2"+ "\u0140\u0141\7\37\2\2\u0141\65\3\2\2\2\u0142\u0149\5\"\22\2\u0143\u0145"+ "\7\34\2\2\u0144\u0143\3\2\2\2\u0144\u0145\3\2\2\2\u0145\u0146\3\2\2\2"+ "\u0146\u0148\5\"\22\2\u0147\u0144\3\2\2\2\u0148\u014b\3\2\2\2\u0149\u0147"+ "\3\2\2\2\u0149\u014a\3\2\2\2\u014a\67\3\2\2\2\u014b\u0149\3\2\2\2\u014c"+ "\u014d\b\35\1\2\u014d\u016e\5H%\2\u014e\u016e\7\26\2\2\u014f\u0150\7\26"+ "\2\2\u0150\u0151\7\22\2\2\u0151\u0156\7\23\2\2\u0152\u0153\7\5\2\2\u0153"+ "\u0154\5@!\2\u0154\u0155\7\6\2\2\u0155\u0157\3\2\2\2\u0156\u0152\3\2\2"+ "\2\u0156\u0157\3\2\2\2\u0157\u016e\3\2\2\2\u0158\u0159\7\26\2\2\u0159"+ "\u015a\7\33\2\2\u015a\u016e\7\26\2\2\u015b\u015c\7\26\2\2\u015c\u015d"+ "\7\5\2\2\u015d\u015e\5@!\2\u015e\u015f\7\6\2\2\u015f\u016e\3\2\2\2\u0160"+ "\u0161\7\26\2\2\u0161\u0162\7\22\2\2\u0162\u0163\5:\36\2\u0163\u0164\7"+ "\23\2\2\u0164\u016e\3\2\2\2\u0165\u0166\7\26\2\2\u0166\u0167\7\22\2\2"+ "\u0167\u0168\5:\36\2\u0168\u0169\7\23\2\2\u0169\u016a\7\5\2\2\u016a\u016b"+ "\5@!\2\u016b\u016c\7\6\2\2\u016c\u016e\3\2\2\2\u016d\u014c\3\2\2\2\u016d"+ "\u014e\3\2\2\2\u016d\u014f\3\2\2\2\u016d\u0158\3\2\2\2\u016d\u015b\3\2"+ "\2\2\u016d\u0160\3\2\2\2\u016d\u0165\3\2\2\2\u016e\u0174\3\2\2\2\u016f"+ "\u0170\f\3\2\2\u0170\u0171\7\24\2\2\u0171\u0173\58\35\4\u0172\u016f\3"+ "\2\2\2\u0173\u0176\3\2\2\2\u0174\u0172\3\2\2\2\u0174\u0175\3\2\2\2\u0175"+ "9\3\2\2\2\u0176\u0174\3\2\2\2\u0177\u017a\5<\37\2\u0178\u0179\7\n\2\2"+ "\u0179\u017b\5<\37\2\u017a\u0178\3\2\2\2\u017a\u017b\3\2\2\2\u017b;\3"+ "\2\2\2\u017c\u0181\5> \2\u017d\u017e\7\34\2\2\u017e\u0180\5> \2\u017f"+ "\u017d\3\2\2\2\u0180\u0183\3\2\2\2\u0181\u017f\3\2\2\2\u0181\u0182\3\2"+ "\2\2\u0182=\3\2\2\2\u0183\u0181\3\2\2\2\u0184\u018c\7\26\2\2\u0185\u0186"+ "\7\26\2\2\u0186\u0188\7\33\2\2\u0187\u0189\7%\2\2\u0188\u0187\3\2\2\2"+ "\u0188\u0189\3\2\2\2\u0189\u018a\3\2\2\2\u018a\u018c\7#\2\2\u018b\u0184"+ "\3\2\2\2\u018b\u0185\3\2\2\2\u018c?\3\2\2\2\u018d\u0193\5B\"\2\u018e\u018f"+ "\5J&\2\u018f\u0190\5B\"\2\u0190\u0192\3\2\2\2\u0191\u018e\3\2\2\2\u0192"+ "\u0195\3\2\2\2\u0193\u0191\3\2\2\2\u0193\u0194\3\2\2\2\u0194A\3\2\2\2"+ "\u0195\u0193\3\2\2\2\u0196\u0197\7\26\2\2\u0197\u0198\7\30\2\2\u0198\u01a6"+ "\5\34\17\2\u0199\u019a\5D#\2\u019a\u019b\7\30\2\2\u019b\u019c\5\34\17"+ "\2\u019c\u01a6\3\2\2\2\u019d\u019e\5F$\2\u019e\u019f\7\30\2\2\u019f\u01a0"+ "\5\34\17\2\u01a0\u01a6\3\2\2\2\u01a1\u01a2\5\34\17\2\u01a2\u01a3\7\30"+ "\2\2\u01a3\u01a4\5\34\17\2\u01a4\u01a6\3\2\2\2\u01a5\u0196\3\2\2\2\u01a5"+ "\u0199\3\2\2\2\u01a5\u019d\3\2\2\2\u01a5\u01a1\3\2\2\2\u01a6C\3\2\2\2"+ "\u01a7\u01a8\b#\1\2\u01a8\u01a9\7\'\2\2\u01a9\u01af\3\2\2\2\u01aa\u01ab"+ "\f\3\2\2\u01ab\u01ac\7\20\2\2\u01ac\u01ae\5D#\4\u01ad\u01aa\3\2\2\2\u01ae"+ "\u01b1\3\2\2\2\u01af\u01ad\3\2\2\2\u01af\u01b0\3\2\2\2\u01b0E\3\2\2\2"+ "\u01b1\u01af\3\2\2\2\u01b2\u01b3\7\25\2\2\u01b3G\3\2\2\2\u01b4\u01b5\t"+ "\2\2\2\u01b5I\3\2\2\2\u01b6\u01b7\t\3\2\2\u01b7K\3\2\2\2\u01b8\u01b9\7"+ "\'\2\2\u01b9M\3\2\2\2+QZcjs\u0082\u008d\u0091\u0099\u009d\u00a7\u00b8"+ "\u00c8\u00cc\u00d1\u00d4\u00d8\u00df\u00e7\u00ed\u00f4\u0101\u0105\u0115"+ "\u0128\u012f\u0133\u0137\u013e\u0144\u0149\u0156\u016d\u0174\u017a\u0181"+ "\u0188\u018b\u0193\u01a5\u01af"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); } } }
3e03c0bfc9d3543850af79c7ef9d4134e9b3b8b7
3,950
java
Java
src/main/java/org/olat/ims/qti/editor/beecom/parser/SectionParser.java
GeorgeKirev/OpenOLAT
ac0618163dc9965b6779e2c0c998247dc2a9d1ea
[ "Apache-2.0" ]
11
2020-01-30T01:42:04.000Z
2022-01-20T23:35:21.000Z
src/main/java/org/olat/ims/qti/editor/beecom/parser/SectionParser.java
GeorgeKirev/OpenOLAT
ac0618163dc9965b6779e2c0c998247dc2a9d1ea
[ "Apache-2.0" ]
12
2020-12-21T17:05:20.000Z
2022-03-31T20:56:22.000Z
src/main/java/org/olat/ims/qti/editor/beecom/parser/SectionParser.java
GeorgeKirev/OpenOLAT
ac0618163dc9965b6779e2c0c998247dc2a9d1ea
[ "Apache-2.0" ]
4
2021-05-14T02:30:08.000Z
2022-01-14T03:36:28.000Z
33.760684
119
0.722278
1,552
/** * OLAT - Online Learning and Training<br> * http://www.olat.org * <p> * Licensed under the Apache License, Version 2.0 (the "License"); <br> * you may not use this file except in compliance with the License.<br> * You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing,<br> * software distributed under the License is distributed on an "AS IS" BASIS, <br> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> * See the License for the specific language governing permissions and <br> * limitations under the License. * <p> * Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> * University of Zurich, Switzerland. * <hr> * <a href="http://www.openolat.org"> * OpenOLAT - Online Learning and Training</a><br> * This file has been modified by the OpenOLAT community. Changes are licensed * under the Apache 2.0 license as the original file. */ package org.olat.ims.qti.editor.beecom.parser; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.dom4j.Element; import org.olat.ims.qti.editor.beecom.objects.Control; import org.olat.ims.qti.editor.beecom.objects.Duration; import org.olat.ims.qti.editor.beecom.objects.QTIObject; import org.olat.ims.qti.editor.beecom.objects.Section; import org.olat.ims.qti.editor.beecom.objects.SelectionOrdering; /** * @author rkulow * */ public class SectionParser implements IParser { private ParserManager parserManager = new ParserManager(); public Object parse(Element element) { //assert element.getName().equalsIgnoreCase("questestinterop"); Section section = new Section(); // attributes section.setIdent(element.attribute("ident").getValue()); section.setTitle(element.attribute("title").getValue()); // elements // DURATION Duration duration = (Duration) parserManager.parse(element.element("duration")); section.setDuration(duration); List sectioncontrolsXML = element.elements("sectioncontrol"); List<Object> sectioncontrols = new ArrayList<>(); for(Iterator i= sectioncontrolsXML.iterator();i.hasNext();) { sectioncontrols.add(parserManager.parse((Element)i.next())); } if (sectioncontrols.size() == 0) { sectioncontrols.add(new Control()); } section.setSectioncontrols(sectioncontrols); // SELECTION ORDERING SelectionOrdering selectionOrdering = (SelectionOrdering)parserManager.parse(element.element("selection_ordering")); if (selectionOrdering != null){ section.setSelection_ordering(selectionOrdering); } else { section.setSelection_ordering(new SelectionOrdering()); } //SECTIONS List sectionsXML = element.elements("section"); List<Object> sections = new ArrayList<>(); for(Iterator i = sectionsXML.iterator();i.hasNext();) { sections.add(parserManager.parse((Element)i.next())); } section.setSections(sections); //ITEMS List itemsXML = element.elements("item"); List<Object> items = new ArrayList<>(); for(Iterator i = itemsXML.iterator();i.hasNext();) { items.add(parserManager.parse((Element)i.next())); } section.setItems(items); //OBJECTIVES Element mattext = (Element)element.selectSingleNode("./objectives/material/mattext"); if (mattext != null) section.setObjectives(mattext.getTextTrim()); //FEEDBACKS List feedbacksXML = element.elements("sectionfeedback"); List<QTIObject> feedbacks = new ArrayList<>(); for(Iterator i = feedbacksXML.iterator();i.hasNext();) { QTIObject tmp = (QTIObject)parserManager.parse((Element)i.next()); feedbacks.add(tmp); } section.setSectionfeedbacks(feedbacks); QTIObject outcomes_processing = (QTIObject)parserManager.parse(element.element("outcomes_processing")); section.setOutcomes_processing(outcomes_processing); return section; } }
3e03c14dc691eb284e3758b920a562c27a1aae9c
902
java
Java
rss-middletier/src/main/java/halfpipe/recipes/rss/MiddleTierApp.java
32degrees/recipes-rss
3c05832773b36fbcb8ca156742fc857e40929114
[ "Apache-2.0" ]
1
2015-04-08T13:22:19.000Z
2015-04-08T13:22:19.000Z
rss-middletier/src/main/java/halfpipe/recipes/rss/MiddleTierApp.java
32degrees/recipes-rss
3c05832773b36fbcb8ca156742fc857e40929114
[ "Apache-2.0" ]
null
null
null
rss-middletier/src/main/java/halfpipe/recipes/rss/MiddleTierApp.java
32degrees/recipes-rss
3c05832773b36fbcb8ca156742fc857e40929114
[ "Apache-2.0" ]
null
null
null
31.068966
78
0.706992
1,553
/* * Copyright 2012 Netflix, 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 halfpipe.recipes.rss; import halfpipe.Application; /** * @author Chris Fregly ([email protected]) */ public class MiddleTierApp extends Application<Context> { public static void main(String args[]) throws Exception { new MiddleTierApp().run(args); } }
3e03c17ccb79ee34bf07a3aefa6c7015da965a2f
9,021
java
Java
app/src/main/java/com/raulh82vlc/face_detection_sample/opencv/domain/EyesDetectionInteractorImpl.java
raulh82vlc/Image-Detection-Samples
28aa20741a0b82cc38dd4abbd93243eab1020c76
[ "Apache-2.0" ]
29
2017-09-26T12:47:29.000Z
2022-01-28T08:39:37.000Z
app/src/main/java/com/raulh82vlc/face_detection_sample/opencv/domain/EyesDetectionInteractorImpl.java
raulh82vlc/ImageRecognitionSamples
28aa20741a0b82cc38dd4abbd93243eab1020c76
[ "Apache-2.0" ]
4
2017-09-16T20:41:04.000Z
2017-09-17T22:42:55.000Z
app/src/main/java/com/raulh82vlc/face_detection_sample/opencv/domain/EyesDetectionInteractorImpl.java
raulh82vlc/Image-Detection-Samples
28aa20741a0b82cc38dd4abbd93243eab1020c76
[ "Apache-2.0" ]
2
2018-09-18T05:11:06.000Z
2018-11-17T07:11:31.000Z
38.551282
98
0.615564
1,554
/* * Copyright (C) 2017 Raul Hernandez Lopez @raulh82vlc * * 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.raulh82vlc.face_detection_sample.opencv.domain; import android.support.annotation.NonNull; import com.raulh82vlc.face_detection_sample.domain.InteractorExecutor; import com.raulh82vlc.face_detection_sample.domain.MainThread; import com.raulh82vlc.face_detection_sample.opencv.render.FaceDrawerOpenCV; import org.opencv.core.Core; import org.opencv.core.CvType; import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Point; import org.opencv.core.Rect; import org.opencv.core.Size; import org.opencv.imgproc.Imgproc; import org.opencv.objdetect.CascadeClassifier; import org.opencv.objdetect.Objdetect; /** * Eyes Detection Interactor implementation of the {@link EyesDetectionInteractor} contract * @author Raul Hernandez Lopez. */ public class EyesDetectionInteractorImpl implements Interactor, EyesDetectionInteractor { // Constants private static final int LEARN_FRAMES_LIMIT = 50; private static final int LEARN_FRAMES_MATCH_EYE = 25; private static final int EYE_MIN_SIZE = 30; private static final int IRIS_MIN_SIZE = 24; // Frames private int learnFrames = 0; private int learnFramesCounter = 0; // Cascade classifier private final CascadeClassifier detectorEye; // Templates private Mat templateRight; private Mat templateLeft; // Previously detected face private Rect face; // Image Matrices private Mat matrixGray, matrixRGBA; // Interactor mechanism private final InteractorExecutor executor; private final MainThread mainThread; private EyesCallback eyesCallback; private boolean isRunning = false; public EyesDetectionInteractorImpl(CascadeClassifier detectorEye, MainThread mainThread, InteractorExecutor executor) { this.detectorEye = detectorEye; this.executor = executor; this.mainThread = mainThread; } @Override public void run() { extractEyes(); } @Override public void execute(Mat matrixGray, Mat matrixRGBA, Rect face, EyesCallback callback) { this.matrixGray = matrixGray; this.matrixRGBA = matrixRGBA; this.face = face; this.eyesCallback = callback; isRunning = true; executor.execute(this); } @Override public void setRunningStatus(boolean isRunning) { this.isRunning = isRunning; } private void extractEyes() { if (isRunning) { // computing eye areas as well as splitting it Rect rightEyeArea = getEyeArea(face.x + face.width / 16, (int) (face.y + (face.height / 4.5)), (face.width - 2 * face.width / 16) / 2, (int) (face.height / 3.0)); Rect leftEyeArea = getEyeArea(face.x + face.width / 16 + (face.width - 2 * face.width / 16) / 2, (int) (face.y + (face.height / 4.5)), (face.width - 2 * face.width / 16) / 2, (int) (face.height / 3.0)); FaceDrawerOpenCV.drawEyesRectangles(rightEyeArea, leftEyeArea, matrixRGBA); String methodForEyes; if (learnFrames < LEARN_FRAMES_LIMIT) { templateRight = buildTemplate(rightEyeArea, IRIS_MIN_SIZE, matrixGray, matrixRGBA, detectorEye); templateLeft = buildTemplate(leftEyeArea, IRIS_MIN_SIZE, matrixGray, matrixRGBA, detectorEye); learnFrames++; methodForEyes = "building Template with Detect multiscale, frame: " + learnFrames; } else { // Learning finished, use the new templates for template matching matchEye(rightEyeArea, templateRight, matrixGray, matrixRGBA); matchEye(leftEyeArea, templateLeft, matrixGray, matrixRGBA); // resetChronometerOfFrames(); methodForEyes = "match eye with Template, frame: " + learnFrames; } notifyEyesFound(methodForEyes); } } @NonNull private static Rect getEyeArea(int x, int y, int width, int height) { return new Rect(x, y, width, height); } private synchronized void resetChronometerOfFrames() { if (learnFramesCounter > LEARN_FRAMES_MATCH_EYE) { learnFrames = 0; learnFramesCounter = 0; } learnFramesCounter++; } /** * Matches concrete point of the eye by using template with TM_SQDIFF_NORMED */ private static void matchEye(Rect area, Mat builtTemplate, Mat matrixGray, Mat matrixRGBA) { Point matchLoc; try { // when there is not builtTemplate we skip it if (builtTemplate.cols() == 0 || builtTemplate.rows() == 0) { return; } Mat submatGray = matrixGray.submat(area); int cols = submatGray.cols() - builtTemplate.cols() + 1; int rows = submatGray.rows() - builtTemplate.rows() + 1; Mat outputTemplateMat = new Mat(cols, rows, CvType.CV_8U); Imgproc.matchTemplate(submatGray, builtTemplate, outputTemplateMat, Imgproc.TM_SQDIFF_NORMED); Core.MinMaxLocResult minMaxLocResult = Core.minMaxLoc(outputTemplateMat); // when is difference in matching methods, the best match is max / min value matchLoc = minMaxLocResult.minLoc; Point matchLocTx = new Point(matchLoc.x + area.x, matchLoc.y + area.y); Point matchLocTy = new Point(matchLoc.x + builtTemplate.cols() + area.x, matchLoc.y + builtTemplate.rows() + area.y); FaceDrawerOpenCV.drawMatchedEye(matchLocTx, matchLocTy, matrixRGBA); } catch (Exception e) { e.printStackTrace(); } } /** * <p>Build a template from a specific eye area previously substracted * uses detectMultiScale for this area, then uses minMaxLoc method to * detect iris from the detected eye</p> * * @param area Preformatted Area * @param size minimum iris size * @param grayMat image in gray * @param rgbaMat image in color * @param detectorEye Haar Cascade classifier * @return built template */ @NonNull private static Mat buildTemplate(Rect area, final int size, @NonNull Mat grayMat, @NonNull Mat rgbaMat, CascadeClassifier detectorEye) { Mat template = new Mat(); Mat graySubMatEye = grayMat.submat(area); MatOfRect eyes = new MatOfRect(); Rect eyeTemplate; detectorEye.detectMultiScale(graySubMatEye, eyes, 1.15, 2, Objdetect.CASCADE_FIND_BIGGEST_OBJECT | Objdetect.CASCADE_SCALE_IMAGE, new Size(EYE_MIN_SIZE, EYE_MIN_SIZE), new Size()); Rect[] eyesArray = eyes.toArray(); if (eyesArray.length > 0) { Rect e = eyesArray[0]; e.x = area.x + e.x; e.y = area.y + e.y; Rect eyeRectangle = getEyeArea((int) e.tl().x, (int) (e.tl().y + e.height * 0.4), e.width, (int) (e.height * 0.6)); graySubMatEye = grayMat.submat(eyeRectangle); Mat rgbaMatEye = rgbaMat.submat(eyeRectangle); Core.MinMaxLocResult minMaxLoc = Core.minMaxLoc(graySubMatEye); FaceDrawerOpenCV.drawIrisCircle(rgbaMatEye, minMaxLoc); Point iris = new Point(); iris.x = minMaxLoc.minLoc.x + eyeRectangle.x; iris.y = minMaxLoc.minLoc.y + eyeRectangle.y; eyeTemplate = getEyeArea((int) iris.x - size / 2, (int) iris.y - size / 2, size, size); FaceDrawerOpenCV.drawEyeRectangle(eyeTemplate, rgbaMat); template = (grayMat.submat(eyeTemplate)).clone(); } return template; } private void notifyEyesFound(final String methodForEyes) { mainThread.post(new Runnable() { @Override public void run() { eyesCallback.onEyesDetected(methodForEyes); } }); } }
3e03c3201757f9033f8b73d776ba0c38092d7453
637
java
Java
cloud-order/cloud-order-provider/src/main/java/io/amoe/cloud/order/handler/MyBatisFillHandler.java
Lauasuka/cloud
a2358206dcc36ff537a4d972c631c34ede6dbce7
[ "Apache-2.0" ]
1
2020-04-03T06:10:50.000Z
2020-04-03T06:10:50.000Z
cloud-order/cloud-order-provider/src/main/java/io/amoe/cloud/order/handler/MyBatisFillHandler.java
Lauasuka/cloud
a2358206dcc36ff537a4d972c631c34ede6dbce7
[ "Apache-2.0" ]
3
2020-04-02T03:54:31.000Z
2021-07-04T16:20:06.000Z
cloud-order/cloud-order-provider/src/main/java/io/amoe/cloud/order/handler/MyBatisFillHandler.java
Lauasuka/cloud
a2358206dcc36ff537a4d972c631c34ede6dbce7
[ "Apache-2.0" ]
null
null
null
26.541667
78
0.758242
1,555
package io.amoe.cloud.order.handler; import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; import org.apache.ibatis.reflection.MetaObject; import org.springframework.stereotype.Component; import java.time.LocalDateTime; /** * @author Amoe */ @Component public class MyBatisFillHandler implements MetaObjectHandler { @Override public void insertFill(MetaObject metaObject) { this.setFieldValByName("createTime", LocalDateTime.now(), metaObject); } @Override public void updateFill(MetaObject metaObject) { this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); } }
3e03c3f03001074ca03184265ce113c573a96736
12,395
java
Java
core-common/src/test/java/org/apache/kylin/common/persistence/ResourceStoreTest.java
Pay-Baymax/kylin
d5a085c907d9786deee897c2f6e1ac9f6ee102ae
[ "Apache-2.0" ]
3,402
2015-12-02T01:37:41.000Z
2022-03-29T12:10:43.000Z
core-common/src/test/java/org/apache/kylin/common/persistence/ResourceStoreTest.java
UZi5136225/kylin
ae6120b849c499956a11814d817fb9506e6dd2d6
[ "Apache-2.0" ]
1,510
2015-12-10T00:22:45.000Z
2022-03-29T12:17:08.000Z
core-common/src/test/java/org/apache/kylin/common/persistence/ResourceStoreTest.java
UZi5136225/kylin
ae6120b849c499956a11814d817fb9506e6dd2d6
[ "Apache-2.0" ]
1,811
2015-12-02T03:49:03.000Z
2022-03-31T16:01:35.000Z
39.224684
114
0.670351
1,556
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.kylin.common.persistence; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.IOException; import java.util.Collections; import java.util.List; import java.util.NavigableSet; import org.apache.kylin.common.KylinConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Be called by LocalFileResourceStoreTest, ITHBaseResourceStoreTest and ITHDFSResourceStoreTest. */ public class ResourceStoreTest { private static final Logger logger = LoggerFactory.getLogger(ResourceStoreTest.class); private static final String PERFORMANCE_TEST_ROOT_PATH = "/performance"; private static final int TEST_RESOURCE_COUNT = 100; public static void testAStore(String url, KylinConfig kylinConfig) throws Exception { String oldUrl = replaceMetadataUrl(kylinConfig, url); testAStore(ResourceStore.getStore(kylinConfig)); replaceMetadataUrl(kylinConfig, oldUrl); } public static void testPerformance(String url, KylinConfig kylinConfig) throws Exception { String oldUrl = replaceMetadataUrl(kylinConfig, url); testPerformance(ResourceStore.getStore(kylinConfig)); replaceMetadataUrl(kylinConfig, oldUrl); } public static String mockUrl(String tag, KylinConfig kylinConfig) { String str = kylinConfig.getMetadataUrlPrefix() + "@" + tag; return str; } private static void testAStore(ResourceStore store) throws IOException { testBasics(store); testGetAllResources(store); testUpdateResourceTimestamp(store); } private static void testPerformance(ResourceStore store) throws IOException { logger.info("Test basic functions"); testAStore(store); logger.info("Basic function ok. Start to test performance for class : " + store.getClass()); logger.info("Write metadata time : " + testWritePerformance(store)); logger.info("Read metadata time " + testReadPerformance(store)); logger.info("Performance test end. Class : " + store.getClass()); } private static void testGetAllResources(ResourceStore store) throws IOException { final String folder = "/testFolder"; List<StringEntity> result; // reset any leftover garbage new ResourceTool().resetR(store, folder); store.checkAndPutResource(folder + "/res1", new StringEntity("data1"), 1000, StringEntity.serializer); store.checkAndPutResource(folder + "/res2", new StringEntity("data2"), 2000, StringEntity.serializer); store.checkAndPutResource(folder + "/sub/res3", new StringEntity("data3"), 3000, StringEntity.serializer); store.checkAndPutResource(folder + "/res4", new StringEntity("data4"), 4000, StringEntity.serializer); result = store.getAllResources(folder, StringEntity.serializer); Collections.sort(result); assertEntity(result.get(0), "data1", 1000); assertEntity(result.get(1), "data2", 2000); assertEntity(result.get(2), "data4", 4000); assertEquals(3, result.size()); result = store.getAllResources(folder, false, new ResourceStore.VisitFilter(2000, 4000), new ContentReader(StringEntity.serializer)); assertEntity(result.get(0), "data2", 2000); assertEquals(1, result.size()); new ResourceTool().resetR(store, folder); } private static void assertEntity(StringEntity entity, String data, int ts) { assertEquals(data, entity.str); assertEquals(ts, entity.lastModified); } private static void testBasics(ResourceStore store) throws IOException { String dir1 = "/cube"; String path1 = "/cube/_test.json"; StringEntity content1 = new StringEntity("anything"); String dir2 = "/table"; String path2 = "/table/_test.json"; StringEntity content2 = new StringEntity("something"); String dir3 = "/model_desc"; String path3 = "/model_desc/_test.json"; StringEntity content3 = new StringEntity("test check timestamp before delete"); // cleanup legacy if any store.deleteResource(path1); store.deleteResource(path2); store.deleteResource(path3); StringEntity t; // get non-exist assertNull(store.getResource(path1)); assertNull(store.getResource(path1, StringEntity.serializer)); assertNull(store.getResource(path2)); assertNull(store.getResource(path2, StringEntity.serializer)); assertNull(store.getResource(path3)); assertNull(store.getResource(path3, StringEntity.serializer)); // put/get store.checkAndPutResource(path1, content1, StringEntity.serializer); assertTrue(store.exists(path1)); t = store.getResource(path1, StringEntity.serializer); assertEquals(content1, t); store.checkAndPutResource(path2, content2, StringEntity.serializer); assertTrue(store.exists(path2)); t = store.getResource(path2, StringEntity.serializer); assertEquals(content2, t); // overwrite t.str = "new string"; store.checkAndPutResource(path2, t, StringEntity.serializer); // write conflict try { t.setLastModified(t.getLastModified() - 1); store.checkAndPutResource(path2, t, StringEntity.serializer); fail("write conflict should trigger IllegalStateException"); } catch (WriteConflictException e) { // expected } // put path3 store.checkAndPutResource(path3, content3, StringEntity.serializer); assertTrue(store.exists(path3)); t = store.getResource(path3, StringEntity.serializer); assertEquals(content3, t); // list NavigableSet<String> list; list = store.listResources(dir1); assertTrue(list.contains(path1)); assertTrue(!list.contains(path2)); assertTrue(!list.contains(path3)); list = store.listResources(dir2); assertTrue(list.contains(path2)); assertTrue(!list.contains(path1)); assertTrue(!list.contains(path3)); list = store.listResources(dir3); assertTrue(list.contains(path3)); assertTrue(!list.contains(path1)); assertTrue(!list.contains(path2)); list = store.listResources("/"); assertTrue(list.contains(dir1)); assertTrue(list.contains(dir2)); assertTrue(list.contains(dir3)); assertTrue(!list.contains(path1)); assertTrue(!list.contains(path2)); assertTrue(!list.contains(path3)); list = store.listResources(path1); assertNull(list); list = store.listResources(path2); assertNull(list); list = store.listResources(path3); assertNull(list); // delete/exist store.deleteResource(path1); assertTrue(!store.exists(path1)); list = store.listResources(dir1); assertTrue(list == null || !list.contains(path1)); store.deleteResource(path2); assertTrue(!store.exists(path2)); list = store.listResources(dir2); assertTrue(list == null || !list.contains(path2)); long origLastModified = store.getResourceTimestamp(path3); long beforeLastModified = origLastModified - 1000; // beforeLastModified < origLastModified ==> not delete expected try { store.deleteResource(path3, beforeLastModified); } catch (Exception e) { assertTrue(e instanceof IOException); } assertTrue(store.exists(path3)); list = store.listResources(dir3); assertTrue(list != null && list.contains(path3)); // beforeLastModified = origLastModified ==> delete expected store.deleteResource(path3, origLastModified); assertTrue(!store.exists(path3)); list = store.listResources(dir3); assertTrue(list == null || !list.contains(path3)); // put again content3 = new StringEntity("test check timestamp before delete new"); store.checkAndPutResource(path3, content3, StringEntity.serializer); assertTrue(store.exists(path3)); t = store.getResource(path3, StringEntity.serializer); assertEquals(content3, t); origLastModified = store.getResourceTimestamp(path3); long afterLastModified = origLastModified + 1000; // afterLastModified > origLastModified ==> delete expected store.deleteResource(path3, afterLastModified); assertTrue(!store.exists(path3)); list = store.listResources(dir3); assertTrue(list == null || !list.contains(path3)); } private static long testWritePerformance(ResourceStore store) throws IOException { store.deleteResource(PERFORMANCE_TEST_ROOT_PATH); StringEntity content = new StringEntity("something"); long startTime = System.currentTimeMillis(); for (int i = 0; i < TEST_RESOURCE_COUNT; i++) { String resourcePath = PERFORMANCE_TEST_ROOT_PATH + "/res_" + i; store.putResource(resourcePath, content, 0, StringEntity.serializer); } return System.currentTimeMillis() - startTime; } private static long testReadPerformance(ResourceStore store) throws IOException { long startTime = System.currentTimeMillis(); int step = 0; //avoid compiler optimization for (int i = 0; i < TEST_RESOURCE_COUNT; i++) { String resourcePath = PERFORMANCE_TEST_ROOT_PATH + "/res_" + i; StringEntity t = store.getResource(resourcePath, StringEntity.serializer); step |= t.toString().length(); } logger.info("step : " + step); return System.currentTimeMillis() - startTime; } public static String replaceMetadataUrl(KylinConfig kylinConfig, String newUrl) { String oldUrl = kylinConfig.getMetadataUrl().toString(); kylinConfig.setProperty("kylin.metadata.url", newUrl); return oldUrl; } private static void testUpdateResourceTimestamp(ResourceStore store) throws IOException { String dir1 = "/cube"; String path1 = "/cube/_test.json"; StringEntity content1 = new StringEntity("test update timestamp"); // cleanup legacy if any store.deleteResource(path1); // get non-exist assertNull(store.getResource(path1)); assertNull(store.getResource(path1, StringEntity.serializer)); // put/get StringEntity t; store.checkAndPutResource(path1, content1, StringEntity.serializer); assertTrue(store.exists(path1)); t = store.getResource(path1, StringEntity.serializer); assertEquals(content1, t); long oldTS = store.getResourceTimestamp(path1); long newTS = oldTS + 1000; // update timestamp to newTS store.updateTimestamp(path1, newTS); long updatedTS = store.getResourceTimestamp(path1); assertEquals(updatedTS, newTS); newTS = 0L; store.updateTimestamp(path1, newTS); updatedTS = store.getResourceTimestamp(path1); assertEquals(updatedTS, newTS); // delete/exist NavigableSet<String> list; store.deleteResource(path1); assertTrue(!store.exists(path1)); list = store.listResources(dir1); assertTrue(list == null || !list.contains(path1)); } }
3e03c42263d267fe0acb381d8edc70d7be2ff061
1,256
java
Java
hibernate-mysql-OneToManyMapping/src/com/hibernate/startup/Address.java
gopikrishhna1985/hibernate-mysql-OneToManyMapping
38f800aa96447873e31bdedec6f4b9e844191fb5
[ "MIT" ]
null
null
null
hibernate-mysql-OneToManyMapping/src/com/hibernate/startup/Address.java
gopikrishhna1985/hibernate-mysql-OneToManyMapping
38f800aa96447873e31bdedec6f4b9e844191fb5
[ "MIT" ]
null
null
null
hibernate-mysql-OneToManyMapping/src/com/hibernate/startup/Address.java
gopikrishhna1985/hibernate-mysql-OneToManyMapping
38f800aa96447873e31bdedec6f4b9e844191fb5
[ "MIT" ]
null
null
null
17.444444
49
0.691083
1,557
package com.hibernate.startup; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; @Entity public class Address { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int addressId; private String street; private String city; private String state; private String zipCode; @ManyToOne private Employee employee; public Employee getEmployee() { return employee; } public void setEmployee(Employee employee) { this.employee = employee; } public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getZipCode() { return zipCode; } public void setZipCode(String zipCode) { this.zipCode = zipCode; } public int getAddressId() { return addressId; } public void setAddressId(int addressId) { this.addressId = addressId; } }
3e03c44aeb3d8cd410de7aae45d7ee9aff19e332
3,576
java
Java
bundles/org.connectorio.addons.norule/src/test/java/org/connectorio/addons/norule/internal/TestBasicRule.java
ConnectorIO/connectorio-addons
11fccfe938063441d03bd9a6bb8a8b5daa3a9219
[ "Apache-2.0" ]
8
2020-10-14T17:49:40.000Z
2022-03-30T10:48:24.000Z
bundles/org.connectorio.addons.norule/src/test/java/org/connectorio/addons/norule/internal/TestBasicRule.java
ConnectorIO/connectorio-addons
11fccfe938063441d03bd9a6bb8a8b5daa3a9219
[ "Apache-2.0" ]
4
2021-08-12T10:08:33.000Z
2021-08-18T13:29:16.000Z
bundles/org.connectorio.addons.norule/src/test/java/org/connectorio/addons/norule/internal/TestBasicRule.java
ConnectorIO/connectorio-addons
11fccfe938063441d03bd9a6bb8a8b5daa3a9219
[ "Apache-2.0" ]
null
null
null
38.042553
137
0.763982
1,558
/* * Copyright (C) 2019-2021 ConnectorIO Sp. z o.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0 */ package org.connectorio.addons.norule.internal; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.lang.reflect.Constructor; import org.connectorio.addons.norule.ActualCopRule; import org.connectorio.addons.norule.internal.action.DefaultThingActionsRegistry; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import org.openhab.core.internal.service.ReadyServiceImpl; import org.openhab.core.items.GenericItem; import org.openhab.core.items.Item; import org.openhab.core.items.ItemRegistry; import org.openhab.core.items.events.ItemStateChangedEvent; import org.openhab.core.library.types.QuantityType; import org.openhab.core.library.unit.Units; import org.openhab.core.thing.ThingRegistry; import org.openhab.core.types.State; @ExtendWith(MockitoExtension.class) public class TestBasicRule { @Mock private ThingRegistry thingRegistry; @Mock private ItemRegistry itemRegistry; @Mock private Item heatProduced; @Mock private Item energyConsumed; @Mock // generic item can receive state updates private GenericItem efficiency; @Test void checkBasicRule() throws InterruptedException { DefaultTriggerBuilderFactory triggerBuilderFactory = new DefaultTriggerBuilderFactory(); BlockingRule rule = new BlockingRule(new ActualCopRule(triggerBuilderFactory)); RuntimeRuleProvider provider = new RuntimeRuleProvider(); provider.addRule(rule); NoRuleRegistry launcher = new NoRuleRegistry(thingRegistry, itemRegistry, new ReadyServiceImpl(), new DefaultThingActionsRegistry()); launcher.addProvider(provider); when(itemRegistry.get("EnergyConsumed")).thenReturn(energyConsumed); when(energyConsumed.getStateAs(eq(QuantityType.class))).thenReturn(new QuantityType<>(10, Units.KILOWATT_HOUR)); when(itemRegistry.get("HeatProduced")).thenReturn(heatProduced); when(heatProduced.getStateAs(eq(QuantityType.class))).thenReturn(new QuantityType<>(50, Units.KILOWATT_HOUR)); when(itemRegistry.get("Efficiency")).thenReturn(efficiency); ItemStateChangedEvent event = create(ItemStateChangedEvent.class, new Class[] { String.class, String.class, String.class, State.class, State.class }, "", "", "HeatProduced", QuantityType.valueOf("10 kWh"), QuantityType.valueOf("9 kWh") ); launcher.receive(event); rule.getLatch().await(); verify(efficiency).setState(new QuantityType<>(5, Units.ONE)); } private <T> T create(Class<T> type, Class[] arguments, Object ... args) { try { Constructor<T> constructor = type.getDeclaredConstructor(arguments); constructor.setAccessible(true); return constructor.newInstance(args); } catch (Exception e) { throw new RuntimeException(e); } } }
3e03c4fd85dccbfda36fae79b27c765c51ad20d7
1,212
java
Java
micrometer-observation/src/main/java/io/micrometer/observation/transport/http/HttpClientRequest.java
ynuosoft/micrometer
c7a7e204598c8c6d7e7fc13e6fb59a148aad2df0
[ "Apache-2.0" ]
null
null
null
micrometer-observation/src/main/java/io/micrometer/observation/transport/http/HttpClientRequest.java
ynuosoft/micrometer
c7a7e204598c8c6d7e7fc13e6fb59a148aad2df0
[ "Apache-2.0" ]
null
null
null
micrometer-observation/src/main/java/io/micrometer/observation/transport/http/HttpClientRequest.java
ynuosoft/micrometer
c7a7e204598c8c6d7e7fc13e6fb59a148aad2df0
[ "Apache-2.0" ]
null
null
null
27.545455
90
0.712871
1,559
/* * Copyright 2021 VMware, 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.micrometer.observation.transport.http; import io.micrometer.observation.transport.Kind; /** * This API is taken from OpenZipkin Brave. * * Abstract request type used for parsing and sampling. Represents an HTTP Client request. * * @author OpenZipkin Brave Authors * @author Marcin Grzejszczak * @since 1.10.0 */ public interface HttpClientRequest extends HttpRequest { /** * Adds a new header. * @param name header name * @param value header value */ void header(String name, String value); @Override default Kind kind() { return Kind.CLIENT; } }
3e03c5aac8ff341ee52813395155e26b59240dc9
585
java
Java
backend/src/main/java/org/seng302/project/service_layer/dto/contact/PostContactDTO.java
michaelwoodsy/Waste-Management-Group-Project
39238a1e913142577d5214163500df0129e0c37f
[ "Unlicense" ]
null
null
null
backend/src/main/java/org/seng302/project/service_layer/dto/contact/PostContactDTO.java
michaelwoodsy/Waste-Management-Group-Project
39238a1e913142577d5214163500df0129e0c37f
[ "Unlicense" ]
null
null
null
backend/src/main/java/org/seng302/project/service_layer/dto/contact/PostContactDTO.java
michaelwoodsy/Waste-Management-Group-Project
39238a1e913142577d5214163500df0129e0c37f
[ "Unlicense" ]
null
null
null
25.434783
72
0.781197
1,560
package org.seng302.project.service_layer.dto.contact; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.seng302.project.service_layer.dto.validators.user.ValidEmail; import javax.validation.constraints.NotEmpty; /** * DTO for contacting resale. */ @Data @NoArgsConstructor @AllArgsConstructor public class PostContactDTO { @NotEmpty(message = "MissingData: Email is a mandatory field") @ValidEmail private String email; @NotEmpty(message = "MissingData: Message is a mandatory field") private String message; }
3e03c5b41299bb42ae32a5bb25ef020e155625b0
1,330
java
Java
benchmarks/pmd/scratch/pmd/net/sourceforge/pmd/jsp/ast/ASTJspDirectiveAttribute.java
PhongNgo/OptimalVerifiedFT
ad8d63833d16be9c2f312848a995c52a072ee1ad
[ "BSD-3-Clause" ]
1
2021-03-06T13:59:43.000Z
2021-03-06T13:59:43.000Z
benchmarks/pmd/scratch/pmd/net/sourceforge/pmd/jsp/ast/ASTJspDirectiveAttribute.java
PhongNgo/OptimalVerifiedFT
ad8d63833d16be9c2f312848a995c52a072ee1ad
[ "BSD-3-Clause" ]
null
null
null
benchmarks/pmd/scratch/pmd/net/sourceforge/pmd/jsp/ast/ASTJspDirectiveAttribute.java
PhongNgo/OptimalVerifiedFT
ad8d63833d16be9c2f312848a995c52a072ee1ad
[ "BSD-3-Clause" ]
null
null
null
21.111111
86
0.584962
1,561
/* Generated By:JJTree: Do not edit this line. ASTJspDirectiveAttribute.java */ package net.sourceforge.pmd.jsp.ast; public class ASTJspDirectiveAttribute extends SimpleNode { /* BEGIN CUSTOM CODE */ private String name; private String value; /** * @return Returns the name. */ public String getName() { return name; } /** * @param name The name to set. */ public void setName(String name) { this.name = name; } /* (non-Javadoc) * @see com.applicationengineers.pmd4jsp.ast.SimpleNode#toString(java.lang.String) */ public String toString(String prefix) { return super.toString(prefix) + " name=[" + name + "] value=[" + value + "]"; } /** * @return Returns the value. */ public String getValue() { return value; } /** * @param value The value to set. */ public void setValue(String value) { this.value = value; } /* END CUSTOM CODE */ public ASTJspDirectiveAttribute(int id) { super(id); } public ASTJspDirectiveAttribute(JspParser p, int id) { super(p, id); } /** * Accept the visitor. * */ public Object jjtAccept(JspParserVisitor visitor, Object data) { return visitor.visit(this, data); } }
3e03c5eba8ca8757e0ba1bc43e1887039eb5fc38
4,135
java
Java
common/src/androidTest/java/com/microsoft/identity/common/ClockSkewManagerTest.java
DavideSorcelli/microsoft-authentication-library-common-for-android
a3476951ada747beec8ce4daa5cb320389dd0233
[ "MIT" ]
null
null
null
common/src/androidTest/java/com/microsoft/identity/common/ClockSkewManagerTest.java
DavideSorcelli/microsoft-authentication-library-common-for-android
a3476951ada747beec8ce4daa5cb320389dd0233
[ "MIT" ]
null
null
null
common/src/androidTest/java/com/microsoft/identity/common/ClockSkewManagerTest.java
DavideSorcelli/microsoft-authentication-library-common-for-android
a3476951ada747beec8ce4daa5cb320389dd0233
[ "MIT" ]
null
null
null
31.090226
84
0.661669
1,562
// Copyright (c) Microsoft Corporation. // All rights reserved. // // This code is licensed under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files(the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions : // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. package com.microsoft.identity.common; import android.content.Context; import androidx.test.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import com.microsoft.identity.common.internal.util.ClockSkewManager; import com.microsoft.identity.common.internal.util.IClockSkewManager; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Date; import static org.junit.Assert.assertEquals; @RunWith(AndroidJUnit4.class) public class ClockSkewManagerTest { private Context context; private IClockSkewManager clockSkewManager; @Before public void setUp() { context = InstrumentationRegistry.getTargetContext(); } @After public void tearDown() { // Reset the skew to 0 if (null != clockSkewManager) { clockSkewManager.onTimestampReceived(0L); } // Reset the Context context = null; } @Test public void testOnTimestampReceived() { clockSkewManager = new ClockSkewManager(context) { @Override public Date getCurrentClientTime() { return new Date(12345); } }; final Date serverTime = new Date(67890); clockSkewManager.onTimestampReceived(serverTime.getTime()); assertEquals(-55545, clockSkewManager.getSkewMillis()); } @Test public void testOnTimestampReceived2() { clockSkewManager = new ClockSkewManager(context) { @Override public Date getCurrentClientTime() { return new Date(67890); } }; final Date serverTime = new Date(12345); clockSkewManager.onTimestampReceived(serverTime.getTime()); assertEquals(55545, clockSkewManager.getSkewMillis()); } @Test public void testGetReferenceTime() { clockSkewManager = new ClockSkewManager(context) { @Override public Date getCurrentClientTime() { return new Date(67890); } @Override public long getSkewMillis() { return 42L; } }; assertEquals(67848L, clockSkewManager.getAdjustedReferenceTime().getTime()); } @Test public void testToClientTime() { clockSkewManager = new ClockSkewManager(context) { @Override public long getSkewMillis() { return 42L; } }; assertEquals(67932L, clockSkewManager.toClientTime(67890).getTime()); } @Test public void testToReferenceTime() { clockSkewManager = new ClockSkewManager(context) { @Override public long getSkewMillis() { return 42L; } }; assertEquals(67848L, clockSkewManager.toReferenceTime(67890).getTime()); } }
3e03c7e86d62a9215c4dfba35dc236905d8a6737
3,162
java
Java
pac4j-oauth/src/main/java/org/pac4j/oauth/config/OAuthConfiguration.java
vasvir/pac4j
9d925a60b27d058132288464ae784bb795acb91c
[ "Apache-2.0" ]
1
2021-01-13T11:20:46.000Z
2021-01-13T11:20:46.000Z
pac4j-oauth/src/main/java/org/pac4j/oauth/config/OAuthConfiguration.java
skynetrmz/pac4j
84a01479c34d84de04217d20e0ad8266e38aee21
[ "Apache-2.0" ]
null
null
null
pac4j-oauth/src/main/java/org/pac4j/oauth/config/OAuthConfiguration.java
skynetrmz/pac4j
84a01479c34d84de04217d20e0ad8266e38aee21
[ "Apache-2.0" ]
null
null
null
27.258621
111
0.725174
1,563
package org.pac4j.oauth.config; import com.github.scribejava.core.httpclient.HttpClientConfig; import com.github.scribejava.core.model.Token; import com.github.scribejava.core.oauth.OAuthService; import org.pac4j.core.client.IndirectClient; import org.pac4j.core.context.WebContext; import org.pac4j.core.util.CommonHelper; import org.pac4j.core.util.InitializableObject; import org.pac4j.oauth.profile.definition.OAuthProfileDefinition; import java.util.function.Function; /** * The base OAuth configuration. * * @author Jerome Leleu * @since 2.0.0 */ public abstract class OAuthConfiguration<S extends OAuthService, T extends Token> extends InitializableObject { public static final String OAUTH_TOKEN = "oauth_token"; public static final String RESPONSE_TYPE_CODE = "code"; protected String key; protected String secret; protected boolean tokenAsHeader; protected String responseType = RESPONSE_TYPE_CODE; protected String scope; protected Function<WebContext, Boolean> hasBeenCancelledFactory = ctx -> false; protected OAuthProfileDefinition profileDefinition; protected HttpClientConfig httpClientConfig; @Override protected void internalInit() { CommonHelper.assertNotBlank("key", this.key); CommonHelper.assertNotBlank("secret", this.secret); CommonHelper.assertNotNull("hasBeenCancelledFactory", hasBeenCancelledFactory); CommonHelper.assertNotNull("profileDefinition", profileDefinition); } public abstract S buildService(final WebContext context, final IndirectClient client); public String getKey() { return key; } public void setKey(final String key) { this.key = key; } public String getSecret() { return secret; } public void setSecret(final String secret) { this.secret = secret; } public boolean isTokenAsHeader() { return tokenAsHeader; } public void setTokenAsHeader(final boolean tokenAsHeader) { this.tokenAsHeader = tokenAsHeader; } public String getResponseType() { return responseType; } public void setResponseType(final String responseType) { this.responseType = responseType; } public String getScope() { return scope; } public void setScope(final String scope) { this.scope = scope; } public Function<WebContext, Boolean> getHasBeenCancelledFactory() { return hasBeenCancelledFactory; } public void setHasBeenCancelledFactory(final Function<WebContext, Boolean> hasBeenCancelledFactory) { this.hasBeenCancelledFactory = hasBeenCancelledFactory; } public OAuthProfileDefinition getProfileDefinition() { return profileDefinition; } public void setProfileDefinition(final OAuthProfileDefinition profileDefinition) { this.profileDefinition = profileDefinition; } public HttpClientConfig getHttpClientConfig() { return httpClientConfig; } public void setHttpClientConfig(final HttpClientConfig httpClientConfig) { this.httpClientConfig = httpClientConfig; } }
3e03c85973d906ca51612a122dd75b83200ffda9
2,093
java
Java
dynatrace-appmon/src/main/java/de/tsystems/mms/apm/performancesignature/dynatrace/rest/json/model/SystemProfileConfigurations.java
logox01/performance-signature-dynatrace-plugin
150e6c41457b8cabf54abc48026eb62445d61e6c
[ "Apache-2.0" ]
11
2016-08-08T21:11:16.000Z
2021-09-02T13:07:27.000Z
dynatrace-appmon/src/main/java/de/tsystems/mms/apm/performancesignature/dynatrace/rest/json/model/SystemProfileConfigurations.java
logox01/performance-signature-dynatrace-plugin
150e6c41457b8cabf54abc48026eb62445d61e6c
[ "Apache-2.0" ]
177
2016-06-14T11:53:53.000Z
2022-03-31T11:04:01.000Z
dynatrace-appmon/src/main/java/de/tsystems/mms/apm/performancesignature/dynatrace/rest/json/model/SystemProfileConfigurations.java
logox01/performance-signature-dynatrace-plugin
150e6c41457b8cabf54abc48026eb62445d61e6c
[ "Apache-2.0" ]
22
2016-02-23T10:51:30.000Z
2021-07-06T07:57:07.000Z
31.238806
109
0.713808
1,564
/* * Copyright (c) 2014-2018 T-Systems Multimedia Solutions GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.tsystems.mms.apm.performancesignature.dynatrace.rest.json.model; import com.google.gson.annotations.SerializedName; import de.tsystems.mms.apm.performancesignature.ui.util.PerfSigUIUtils; import java.util.ArrayList; import java.util.List; /** * SystemProfileConfigurations */ public class SystemProfileConfigurations { @SerializedName("configurations") private List<SystemProfileConfiguration> configurations; public SystemProfileConfigurations configurations(List<SystemProfileConfiguration> configurations) { this.configurations = configurations; return this; } public SystemProfileConfigurations addConfigurationsItem(SystemProfileConfiguration configurationsItem) { if (this.configurations == null) { this.configurations = new ArrayList<>(); } this.configurations.add(configurationsItem); return this; } /** * Get configurations * * @return configurations **/ public List<SystemProfileConfiguration> getConfigurations() { return configurations; } public void setConfigurations(List<SystemProfileConfiguration> configurations) { this.configurations = configurations; } @Override public String toString() { return "class SystemProfileConfigurations {\n" + " configurations: " + PerfSigUIUtils.toIndentedString(configurations) + "\n" + "}"; } }
3e03cae1e0e91f2598768c42dcee3082eb187666
1,795
java
Java
tests/com.amazonaws.eclipse.simpledb.tests/src/com/amazonaws/eclipse/datatools/enablement/simpledb/editor/SDBDataAccessorTest.java
mmusti1234/aws-toolkit-eclipse
85417f68e1eb6d90d46e145229e390cf55a4a554
[ "Apache-2.0" ]
202
2015-01-23T09:41:51.000Z
2022-03-22T02:27:20.000Z
tests/com.amazonaws.eclipse.simpledb.tests/src/com/amazonaws/eclipse/datatools/enablement/simpledb/editor/SDBDataAccessorTest.java
mmusti1234/aws-toolkit-eclipse
85417f68e1eb6d90d46e145229e390cf55a4a554
[ "Apache-2.0" ]
209
2015-03-18T15:34:48.000Z
2022-03-02T22:23:55.000Z
tests/com.amazonaws.eclipse.simpledb.tests/src/com/amazonaws/eclipse/datatools/enablement/simpledb/editor/SDBDataAccessorTest.java
mmusti1234/aws-toolkit-eclipse
85417f68e1eb6d90d46e145229e390cf55a4a554
[ "Apache-2.0" ]
166
2015-01-02T20:12:00.000Z
2022-03-20T22:35:53.000Z
33.867925
119
0.670752
1,566
/* * Copyright 2009-2012 Amazon Technologies, 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://aws.amazon.com/apache2.0 * * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES * OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and * limitations under the License. */ package com.amazonaws.eclipse.datatools.enablement.simpledb.editor; import java.util.Arrays; import junit.framework.TestCase; public class SDBDataAccessorTest extends TestCase { private SimpleDBDataAccessor sdb; @Override protected void setUp() throws Exception { this.sdb = new SimpleDBDataAccessor(); } public void testIsSnippet() { assertNotNull(this.sdb); assertFalse("Null is not a snippet", this.sdb.isSnippet(null, -1)); assertFalse("String is not a snippet", this.sdb.isSnippet("String value", -1)); assertTrue("Empty String array is snippet", this.sdb.isSnippet(new String[] {}, -1)); assertTrue("String array with empty string is snippet", this.sdb.isSnippet(new String[] { "" }, -1)); assertTrue("String array is snippet", this.sdb.isSnippet(new String[] { "String value", "String value" }, -1)); } public void testGetLabel() { assertNotNull(this.sdb); assertEquals("NULL", this.sdb.getLabel(null, -1)); assertEquals("", this.sdb.getLabel("", -1)); assertEquals("String value", this.sdb.getLabel("String value", -1)); assertEquals(Arrays.toString(new String[] { "1", "2" }), this.sdb.getLabel(new String[] { "1", "2" }, -1)); } }
3e03cb2538e2afacecffc777e60955b5456a529e
13,981
java
Java
app/src/main/java/com/firstbuild/androidapp/productmanager/ParagonInfo.java
FirstBuild/FirstBuild-Mobile-Android-Old
704181b97183fa7ff1bae8a725a525ae9699ca57
[ "MIT" ]
1
2020-12-06T18:00:29.000Z
2020-12-06T18:00:29.000Z
app/src/main/java/com/firstbuild/androidapp/productmanager/ParagonInfo.java
FirstBuild/FirstBuild-Mobile-Android-Old
704181b97183fa7ff1bae8a725a525ae9699ca57
[ "MIT" ]
1
2018-10-28T15:50:30.000Z
2018-10-28T15:50:30.000Z
app/src/main/java/com/firstbuild/androidapp/productmanager/ParagonInfo.java
FirstBuild/FirstBuild-Mobile-Android-Old
704181b97183fa7ff1bae8a725a525ae9699ca57
[ "MIT" ]
null
null
null
32.665888
163
0.646234
1,567
package com.firstbuild.androidapp.productmanager; import android.util.Log; import android.view.View; import com.firstbuild.androidapp.OpalValues; import com.firstbuild.androidapp.ParagonValues; import com.firstbuild.androidapp.R; import com.firstbuild.androidapp.dashboard.DashboardActivity; import com.firstbuild.androidapp.paragon.datamodel.RecipeInfo; import com.firstbuild.androidapp.paragon.datamodel.StageInfo; import com.firstbuild.commonframework.blemanager.BleManager; import org.json.JSONObject; import java.nio.ByteBuffer; import java.util.ArrayList; /** * Created by hans on 16. 6. 13.. */ public class ParagonInfo extends ProductInfo{ private static final String TAG = ParagonInfo.class.getSimpleName(); public static final int NO_BATTERY_INFO = -1; protected int NUM_MUST_INIT_DATA = 7; // Initial data must get from dashboard. private int erdBatteryLevel = NO_BATTERY_INFO; private byte erdBurnerStatus = INITIAL_VALUE; private byte erdProbeConnectionStatue = INITIAL_VALUE; private byte erdCurrentCookMode = INITIAL_VALUE; private RecipeInfo erdRecipeConfig = null; private byte erdCookState = INITIAL_VALUE; private int erdElapsedTime = INITIAL_ELAPSED_TIME; private float erdCurrentTemp; private byte erdCookStage; private byte erdPowerLevel = 0; private byte versionMajor = 0; private byte versionMinor = 0; private short versionBuild = 0; public ParagonInfo(int type, String address, String nickname) { super(type, address, nickname); } public ParagonInfo(ProductInfo product) { super(product); } public ParagonInfo(JSONObject jsonObject) { super(jsonObject); } public void initMustData(){ erdBatteryLevel = NO_BATTERY_INFO; erdBurnerStatus = INITIAL_VALUE; erdProbeConnectionStatue = INITIAL_VALUE; erdCurrentCookMode = INITIAL_VALUE; erdRecipeConfig = null; erdCookState = INITIAL_VALUE; isAllMustDataReceived = false; } @Override public ArrayList<String> getMustHaveNotificationUUIDList() { if(mustHaveNotificationUUIDList.size() == 0) { // initialize must-have-notification uuid list mustHaveNotificationUUIDList.add(ParagonValues.CHARACTERISTIC_COOK_CONFIGURATION); mustHaveNotificationUUIDList.add(ParagonValues.CHARACTERISTIC_BURNER_STATUS); mustHaveNotificationUUIDList.add(ParagonValues.CHARACTERISTIC_BATTERY_LEVEL); mustHaveNotificationUUIDList.add(ParagonValues.CHARACTERISTIC_PROBE_CONNECTION_STATE); mustHaveNotificationUUIDList.add(ParagonValues.CHARACTERISTIC_COOK_MODE); mustHaveNotificationUUIDList.add(ParagonValues.CHARACTERISTIC_CURRENT_COOK_STATE); mustHaveNotificationUUIDList.add(ParagonValues.CHARACTERISTIC_CURRENT_TEMPERATURE); mustHaveNotificationUUIDList.add(ParagonValues.CHARACTERISTIC_ELAPSED_TIME); mustHaveNotificationUUIDList.add(ParagonValues.CHARACTERISTIC_CURRENT_POWER_LEVEL); } return mustHaveNotificationUUIDList; } @Override public ArrayList<String> getMustHaveUUIDList() { if(mustHaveUUIDList.size() == 0) { // initialize must-have uuid list mustHaveUUIDList.add(ParagonValues.CHARACTERISTIC_PROBE_CONNECTION_STATE); mustHaveUUIDList.add(ParagonValues.CHARACTERISTIC_BATTERY_LEVEL); mustHaveUUIDList.add(ParagonValues.CHARACTERISTIC_BURNER_STATUS); mustHaveUUIDList.add(ParagonValues.CHARACTERISTIC_COOK_MODE); mustHaveUUIDList.add(ParagonValues.CHARACTERISTIC_COOK_CONFIGURATION); mustHaveUUIDList.add(ParagonValues.CHARACTERISTIC_CURRENT_COOK_STATE); mustHaveUUIDList.add(ParagonValues.CHARACTERISTIC_ELAPSED_TIME); } return mustHaveUUIDList; } public int getMustDataStatus(){ int numGetData = 0; if(erdBatteryLevel != NO_BATTERY_INFO){ numGetData++; } if(erdBurnerStatus != INITIAL_VALUE){ numGetData++; } if(erdProbeConnectionStatue != INITIAL_VALUE){ numGetData++; } if(erdCurrentCookMode != INITIAL_VALUE){ numGetData++; } if(erdRecipeConfig != null ){ numGetData++; } if(erdCookState != INITIAL_VALUE){ numGetData++; } if(erdElapsedTime != INITIAL_ELAPSED_TIME){ numGetData++; } if(numGetData == NUM_MUST_INIT_DATA){ isAllMustDataReceived = true; } else{ isAllMustDataReceived = false; } return numGetData; } @Override public int getNumMustInitData() { return NUM_MUST_INIT_DATA; } @Override public void updateErd(String uuid, byte[] value) { ByteBuffer byteBuffer = ByteBuffer.wrap(value); switch (uuid.toUpperCase()) { case ParagonValues.CHARACTERISTIC_BATTERY_LEVEL: setErdBatteryLevel(byteBuffer.get()); Log.d(TAG, "CHARACTERISTIC_BATTERY_LEVEL :" + String.format("%02x", value[0])); break; case ParagonValues.CHARACTERISTIC_ELAPSED_TIME: Log.d(TAG, "CHARACTERISTIC_ELAPSED_TIME :" + String.format("%02x%02x", value[0], value[1])); setErdElapsedTime(byteBuffer.getShort()); break; case ParagonValues.CHARACTERISTIC_BURNER_STATUS: Log.d(TAG, "CHARACTERISTIC_BURNER_STATUS :" + String.format("%02x", value[0])); setErdBurnerStatus(byteBuffer.get()); break; case ParagonValues.CHARACTERISTIC_PROBE_CONNECTION_STATE: Log.d(TAG, "CHARACTERISTIC_PROBE_CONNECTION_STATE :" + String.format("%02x", value[0])); setErdProbeConnectionStatue(byteBuffer.get()); break; case ParagonValues.CHARACTERISTIC_COOK_MODE: Log.d(TAG, "CHARACTERISTIC_COOK_MODE :" + String.format("%02x", value[0])); setErdCurrentCookMode(byteBuffer.get()); break; case ParagonValues.CHARACTERISTIC_COOK_CONFIGURATION: Log.d(TAG, "CHARACTERISTIC_COOK_CONFIGURATION :"); String data = ""; for (int i = 0; i < value.length; i++) { data += String.format("%02x", value[i]); } Log.d(TAG, "CONFIGURATION Data :" + data); RecipeInfo newRecipe = new RecipeInfo(value); setErdRecipeConfig(newRecipe); break; case ParagonValues.CHARACTERISTIC_CURRENT_COOK_STATE: Log.d(TAG, "CHARACTERISTIC_CURRENT_COOK_STATE :" + String.format("%02x", value[0])); setErdCookState(byteBuffer.get()); break; case ParagonValues.CHARACTERISTIC_CURRENT_TEMPERATURE: Log.d(TAG, "CHARACTERISTIC_CURRENT_TEMPERATURE :" + String.format("%02x%02x", value[0], value[1])); setErdCurrentTemp(byteBuffer.getShort()); break; case ParagonValues.CHARACTERISTIC_CURRENT_COOK_STAGE: Log.d(TAG, "CHARACTERISTIC_CURRENT_COOK_STAGE :" + String.format("%02x", value[0])); setErdCookStage(byteBuffer.get()); break; case ParagonValues.CHARACTERISTIC_OTA_VERSION: Log.d(TAG, "CHARACTERISTIC_OTA_VERSION :" + String.format("%02x%02x%02x%02x%02x%02x", value[0], value[1], value[2], value[3], value[4], value[5])); setErdVersion(value[2], value[3], (short) value[4]); break; case ParagonValues.CHARACTERISTIC_CURRENT_POWER_LEVEL: Log.d(TAG, "CHARACTERISTIC_CURRENT_POWER_LEVEL :" + String.format("%02x", value[0])); setErdPowerLevel(byteBuffer.get()); break; } } @Override public void updateDashboardItemUI(DashboardActivity.ProductListAdapter.ViewHolder holderDashboard) { holderDashboard.imageLogo.setImageResource(R.drawable.ic_paragon_logo); holderDashboard.imageMark.setImageResource(R.drawable.ic_paragon_mark); if (isProbeConnected()) { holderDashboard.imageBattery.setVisibility(View.VISIBLE); int level = getErdBatteryLevel(); if (level > 75) { holderDashboard.imageBattery.setImageResource(R.drawable.ic_battery_100); } else if (level > 25) { holderDashboard.imageBattery.setImageResource(R.drawable.ic_battery_50); } else if (level > 15) { holderDashboard.imageBattery.setImageResource(R.drawable.ic_battery_25); } else { holderDashboard.imageBattery.setImageResource(R.drawable.ic_battery_15); } String batteryLevel = level + "%"; holderDashboard.textBattery.setText(batteryLevel); } else { holderDashboard.textBattery.setText("probe\noffline"); holderDashboard.imageBattery.setVisibility(View.GONE); } if (getErdBurnerStatus() == ParagonValues.BURNER_STATE_START) { holderDashboard.textCooking.setText(R.string.product_state_cooking); } else { holderDashboard.textCooking.setText(""); } } public void disconnected() { super.disconnected(); this.erdProbeConnectionStatue = ParagonValues.PROBE_NOT_CONNECT; this.erdBatteryLevel = NO_BATTERY_INFO; this.erdCurrentTemp = 0.0f; this.erdElapsedTime = 0; this.erdRecipeConfig = null; this.erdBurnerStatus = INITIAL_VALUE; this.erdCookState = INITIAL_VALUE; this.erdCookStage = INITIAL_VALUE; this.erdCurrentCookMode = INITIAL_VALUE; this.erdElapsedTime = INITIAL_ELAPSED_TIME; } public float getErdCurrentTemp() { return erdCurrentTemp; } public void setErdCurrentTemp(short erdCurrentTemp) { this.erdCurrentTemp = (erdCurrentTemp / 100.0f); } public int getErdElapsedTime() { return erdElapsedTime; } public void setErdElapsedTime(int erdRemainingTime) { this.erdElapsedTime = erdRemainingTime; } public RecipeInfo getErdRecipeConfig() { return erdRecipeConfig; } public void setErdRecipeConfig(RecipeInfo erdRecipeConfig) { this.erdRecipeConfig = erdRecipeConfig; } public byte getErdBurnerStatus() { return erdBurnerStatus; } public void setErdBurnerStatus(byte erdBurnerStatus) { this.erdBurnerStatus = erdBurnerStatus; } public byte getErdCookState() { return erdCookState; } public void setErdCookState(byte erdCookState) { this.erdCookState = erdCookState; } public byte getErdCookStage() { return erdCookStage; } public void setErdCookStage(byte erdCookStage) { this.erdCookStage = erdCookStage; } public byte getErdCurrentCookMode() { return erdCurrentCookMode; } public void setErdCurrentCookMode(byte erdCurrentCookMode) { this.erdCurrentCookMode = erdCurrentCookMode; } public int getErdBatteryLevel() { return erdBatteryLevel; } public void setErdBatteryLevel(int erdBatteryLevel) { this.erdBatteryLevel = erdBatteryLevel; } public byte getErdProbeConnectionStatue() { return erdProbeConnectionStatue; } public void setErdProbeConnectionStatue(byte erdProbeConnectionStatue) { this.erdProbeConnectionStatue = erdProbeConnectionStatue; } public boolean isProbeConnected() { return (this.erdProbeConnectionStatue == ParagonValues.PROBE_CONNECT); } public void setErdPowerLevel(byte erdPowerLevel) { this.erdPowerLevel = erdPowerLevel; } public byte getErdPowerLevel() { return erdPowerLevel; } public void setErdVersion(byte major, byte minor, short build) { this.versionMajor = major; this.versionMinor = minor; this.versionBuild = build; } public byte getVersionMajor() { return versionMajor; } public byte getVersionMinor() { return versionMinor; } public short getVersionBuild() { return versionBuild; } public boolean isReceivedVersion() { if(versionMajor == 0 && versionMinor == 0 && versionBuild == 0){ return false; } else{ return true; } } public void createRecipeConfigForSousVide() { this.erdRecipeConfig = new RecipeInfo("", "", "", ""); this.erdRecipeConfig.setType(RecipeInfo.TYPE_SOUSVIDE); this.erdRecipeConfig.addStage(new StageInfo()); } public void sendRecipeConfig() { ByteBuffer valueBuffer = ByteBuffer.allocate(40); int numStage = this.erdRecipeConfig.numStage(); for (int i = 0; i < numStage; i++) { StageInfo stage = this.erdRecipeConfig.getStage(i); valueBuffer.put(8 * i, (byte) stage.getSpeed()); valueBuffer.putShort(1 + 8 * i, (short) (stage.getTime())); valueBuffer.putShort(3 + 8 * i, (short) (stage.getMaxTime())); valueBuffer.putShort(5 + 8 * i, (short) (stage.getTemp() * 100)); valueBuffer.put(7 + 8 * i, (byte) (stage.isAutoTransition() ? 0x01 : 0x02)); } // for (int i = 0; i < 40; i++) { // Log.d(TAG, "RecipeManager.sendCurrentStages:" + String.format("0x%02x", valueBuffer.array()[i])); // } BleManager.getInstance().writeCharacteristics(bluetoothDevice, ParagonValues.CHARACTERISTIC_COOK_CONFIGURATION, valueBuffer.array()); } }
3e03cb7c864d3446579926a4db4ccd82cef9a6f0
1,741
java
Java
src/main/java/org/nodens2k/tin/validation/DefaultCountryTinValidator.java
Nodens2k/tin-validators
2f7782559ab506184d3f841210de9860d856b2f1
[ "MIT" ]
null
null
null
src/main/java/org/nodens2k/tin/validation/DefaultCountryTinValidator.java
Nodens2k/tin-validators
2f7782559ab506184d3f841210de9860d856b2f1
[ "MIT" ]
null
null
null
src/main/java/org/nodens2k/tin/validation/DefaultCountryTinValidator.java
Nodens2k/tin-validators
2f7782559ab506184d3f841210de9860d856b2f1
[ "MIT" ]
null
null
null
27.634921
96
0.73923
1,568
package org.nodens2k.tin.validation; import java.util.Collection; import java.util.Collections; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.UnmodifiableView; public final class DefaultCountryTinValidator implements CountryTinValidator { private static final CountryTinValidator ALWAYS_TRUE = new DefaultCountryTinValidator(true); private static final CountryTinValidator ALWAYS_FALSE = new DefaultCountryTinValidator(false); private final boolean value; @Contract(pure = true) private DefaultCountryTinValidator(boolean value) { this.value = value; } @Contract(value = "null -> false", pure = true) @Override public boolean isValid(String tin) { return isValid(tin, TinType.ANY); } @Override public boolean isValid(String tin, TinType acceptedType) { return tin != null && value; } @Contract(value = "null, _ -> false; _, null -> false", pure = true) @Override public boolean isValid(String countryCode, String tin) { return isValid(countryCode, tin, TinType.ANY); } @Override public boolean isValid(String countryCode, String tin, TinType acceptedType) { return countryCode != null && tin != null && value; } @NotNull @Contract(pure = true) @Override @UnmodifiableView public Collection<String> getSupportedCountries() { return Collections.emptySet(); } @Contract(value = "null -> false", pure = true) @Override public boolean isCountrySupported(String countryCode) { return countryCode != null; } @Contract(pure = true) public static CountryTinValidator getInstance(boolean defaultValidation) { return defaultValidation ? ALWAYS_TRUE : ALWAYS_FALSE; } }
3e03cc0770fa30be2f90b8e1b7594ea598d0ad8d
243
java
Java
src/main/java/tgits/sealed/bibliography/Techreport.java
TGITS/java17-catchup-examples
0701157f2425374deeb40f6e96cdfe2ecf2600f0
[ "CC0-1.0" ]
null
null
null
src/main/java/tgits/sealed/bibliography/Techreport.java
TGITS/java17-catchup-examples
0701157f2425374deeb40f6e96cdfe2ecf2600f0
[ "CC0-1.0" ]
null
null
null
src/main/java/tgits/sealed/bibliography/Techreport.java
TGITS/java17-catchup-examples
0701157f2425374deeb40f6e96cdfe2ecf2600f0
[ "CC0-1.0" ]
1
2022-01-18T17:08:58.000Z
2022-01-18T17:08:58.000Z
17.357143
58
0.650206
1,569
package tgits.sealed.bibliography; public final class Techreport extends BibliographicEntry { @Override public String toString() { return null; } @Override public boolean isValid() { return false; } }
3e03cc7fe544171297f0523ae023f82f7228ff33
3,922
java
Java
src/main/java/io/github/solf/extra2/config/MergingSectionedConfiguration.java
solf/extra2
228855cd49c21004d4818f57d3dd627af9956290
[ "Apache-2.0" ]
null
null
null
src/main/java/io/github/solf/extra2/config/MergingSectionedConfiguration.java
solf/extra2
228855cd49c21004d4818f57d3dd627af9956290
[ "Apache-2.0" ]
null
null
null
src/main/java/io/github/solf/extra2/config/MergingSectionedConfiguration.java
solf/extra2
228855cd49c21004d4818f57d3dd627af9956290
[ "Apache-2.0" ]
null
null
null
30.169231
121
0.72922
1,570
/** * Copyright Sergey Olefir * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.github.solf.extra2.config; import java.util.HashSet; import java.util.MissingResourceException; import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; /** * Implementation of {@link SectionedConfiguration} that 'merges' two other * configurations together. * <p> * Values are first searched in the first (overriding) configuration and if not * found then in second (base) configuration. * <p> * NOTE: performance of this is not necessarily optimal -- particularly in * {@link #getAllSectionKeys()} -- but in many cases this should not matter. * <p> * NOTE2: overriding configuration is allowed to skip sections that it does not * wish to override. * * @author Sergey Olefir */ @NonNullByDefault public class MergingSectionedConfiguration implements SectionedConfiguration { /** * Overriding configuration. */ protected final SectionedConfiguration overridingConfiguration; /** * Base configuration. */ protected final SectionedConfiguration baseConfiguration; /** * Constructor. * * @param overridingConfiguration values in this configuration take precedence * over base configuration; this configuration may skip sections that * it does not wish to override * @param baseConfiguration values in this configuration are used only if * they are not present in overriding configuration */ public MergingSectionedConfiguration(SectionedConfiguration overridingConfiguration, SectionedConfiguration baseConfiguration) { this.overridingConfiguration = overridingConfiguration; this.baseConfiguration = baseConfiguration; } /* (non-Javadoc) * @see io.github.solf.extra2.config.SectionedConfiguration#getGlobalSection() */ @Override public FlatConfiguration getGlobalSection() { return new MergingFlatConfiguration(overridingConfiguration.getGlobalSection(), baseConfiguration.getGlobalSection()); } /* (non-Javadoc) * @see io.github.solf.extra2.config.SectionedConfiguration#getSection(java.lang.String) */ @Override public FlatConfiguration getSection(String sectionKey) throws MissingResourceException, NullPointerException { FlatConfiguration override; try { override = overridingConfiguration.getSection(sectionKey); } catch (MissingResourceException e) { return baseConfiguration.getSection(sectionKey); } FlatConfiguration base; try { base = baseConfiguration.getSection(sectionKey); } catch (MissingResourceException e) { return override; } return new MergingFlatConfiguration(override, base); } /** * Iterable for all section keys in this configuration (excluding global section). * <p> * NOTE: this particular implementation is very inefficient, it reads all * sections in both configurations and merges them into a single set -- and * it does so on each call. However in many cases this should not matter. */ @Override public Iterable<String> getAllSectionKeys() { Set<String> result = new HashSet<>(); for (String entry : baseConfiguration.getAllSectionKeys()) result.add(entry); for (String entry : overridingConfiguration.getAllSectionKeys()) result.add(entry); return result; } }
3e03cd9d5e5786aeae3abd9d0179e2a5e563c622
387
java
Java
src/main/java/com/app/budgetingsoftware/account/AccountConfig.java
winstoncooke/BudgetingSoftware
f725014dafc200bce664e48628778fdc2894955b
[ "MIT" ]
null
null
null
src/main/java/com/app/budgetingsoftware/account/AccountConfig.java
winstoncooke/BudgetingSoftware
f725014dafc200bce664e48628778fdc2894955b
[ "MIT" ]
null
null
null
src/main/java/com/app/budgetingsoftware/account/AccountConfig.java
winstoncooke/BudgetingSoftware
f725014dafc200bce664e48628778fdc2894955b
[ "MIT" ]
null
null
null
24.1875
78
0.775194
1,571
package com.app.budgetingsoftware.account; import org.springframework.boot.CommandLineRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class AccountConfig { @Bean CommandLineRunner accountCommandLineRunner(AccountRepository repository) { return args -> { }; } }
3e03cda2cf520950756ccc3dbde3344bda9ad928
3,506
java
Java
TrabalhoDois/app/src/main/java/com/aulas/mobile/trabalhodois/activity/ArtistMusics.java
AndreVeiga/vitrola-app
f17cccef7aac5572ccef28b123d6e45bcdd1e6a8
[ "MIT" ]
2
2020-11-13T11:28:43.000Z
2020-11-17T00:59:38.000Z
TrabalhoDois/app/src/main/java/com/aulas/mobile/trabalhodois/activity/ArtistMusics.java
AndreVeiga/vitrola-app
f17cccef7aac5572ccef28b123d6e45bcdd1e6a8
[ "MIT" ]
null
null
null
TrabalhoDois/app/src/main/java/com/aulas/mobile/trabalhodois/activity/ArtistMusics.java
AndreVeiga/vitrola-app
f17cccef7aac5572ccef28b123d6e45bcdd1e6a8
[ "MIT" ]
null
null
null
36.905263
137
0.653451
1,572
package com.aulas.mobile.trabalhodois.activity; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import com.aulas.mobile.trabalhodois.R; import com.aulas.mobile.trabalhodois.common.URL; import com.aulas.mobile.trabalhodois.model.ItemArtist; import com.aulas.mobile.trabalhodois.rest.ResponseArtist; import com.aulas.mobile.trabalhodois.service.ServiceItemArtist; import java.util.List; import java.util.zip.Inflater; public class ArtistMusics extends AppCompatActivity { private ResponseArtist responseArtist; private ListView listMusic; private List<ItemArtist> item; private ServiceItemArtist serviceItemArtist; private boolean isOpenInGoogleChrome = true; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_artist_musics); listMusic = findViewById(R.id.list_music); serviceItemArtist = new ServiceItemArtist(this); loadData(); loadMusic(); loadClick(); } private void loadClick(){ listMusic.setOnItemClickListener((parent, view, position, id) -> { ItemArtist itemArtist = item.get(position); String url = itemArtist.getUrl(); StringBuilder newUrl = new StringBuilder(); newUrl.append(URL.baseMusic); newUrl.append(url); // Altere para false essa variavel ou use ! // ver aquele erro. if(isOpenInGoogleChrome){ Intent intentNav = new Intent(Intent.ACTION_VIEW); intentNav.setData(Uri.parse(newUrl.toString())); startActivity(intentNav); } else { Intent intent = new Intent(ArtistMusics.this, MusicDetails.class); intent.putExtra("url", newUrl.toString()); startActivity(intent); } }); } private void loadData(){ Intent intent = getIntent(); responseArtist = (ResponseArtist) intent.getSerializableExtra("responseArtist"); } private void loadMusic(){ if(responseArtist != null && responseArtist.getArtist() != null && responseArtist.getArtist().getToplyrics() != null){ this.item = responseArtist.getArtist().getToplyrics().getItem(); ArrayAdapter<ItemArtist> stringArrayAdapter = new ArrayAdapter<ItemArtist>(this, android.R.layout.simple_list_item_1, item) { @Override public View getView(int position, View convertView, ViewGroup parent){ ItemArtist itemArtist = item.get(position); LayoutInflater inflater = getLayoutInflater(); View view = inflater.inflate(R.layout.artist_item, parent, false); TextView desc = view.findViewById(R.id.artist_desc); desc.setText(itemArtist.getDesc()); TextView info = view.findViewById(R.id.artist_url); info.setText(itemArtist.getUrl()); return view; } }; serviceItemArtist.saveListItemArtist(this.item); listMusic.setAdapter(stringArrayAdapter); } } }
3e03cdc80e72f32eef20f0d90b6e5c65e8957777
350
java
Java
08-Patterns/src/main/java/org/mindidea/_01_creation/_03_abstract_factory/notebook/AbstractNotebook.java
imtsingyun/AdvancedProgrammerGuide
b146331fcb73934cc7bb879e6d3101e984526879
[ "MIT" ]
null
null
null
08-Patterns/src/main/java/org/mindidea/_01_creation/_03_abstract_factory/notebook/AbstractNotebook.java
imtsingyun/AdvancedProgrammerGuide
b146331fcb73934cc7bb879e6d3101e984526879
[ "MIT" ]
13
2021-12-07T12:10:02.000Z
2022-02-16T16:01:16.000Z
08-Patterns/src/main/java/org/mindidea/_01_creation/_03_abstract_factory/notebook/AbstractNotebook.java
imtsingyun/AdvancedProgrammerGuide
b146331fcb73934cc7bb879e6d3101e984526879
[ "MIT" ]
null
null
null
15.217391
64
0.705714
1,573
package org.mindidea._01_creation._03_abstract_factory.notebook; /** * 笔记本抽象类 * * @author tsingyun * @version V1.0 * 2022/4/16 22:43 */ public abstract class AbstractNotebook { // 笔记本品牌名称 public String name; // CPU 配置 public String cpu; // 显卡配置 public String graphics; public String os; // 笔记本可以玩游戏 public abstract void coding(); }
3e03ce1eba5e37501b15b9dfc232a12fe8a676c5
2,502
java
Java
src/main/java/gregtech/api/gui/resources/SizedTextureArea.java
GregTechCE/GregTechFE
732cb18687d8a65dd80d37dba47e60c263115962
[ "CC0-1.0" ]
2
2021-11-05T02:42:18.000Z
2021-12-10T16:06:47.000Z
src/main/java/gregtech/api/gui/resources/SizedTextureArea.java
GregTechCE/GregTechFE
732cb18687d8a65dd80d37dba47e60c263115962
[ "CC0-1.0" ]
null
null
null
src/main/java/gregtech/api/gui/resources/SizedTextureArea.java
GregTechCE/GregTechFE
732cb18687d8a65dd80d37dba47e60c263115962
[ "CC0-1.0" ]
1
2021-11-04T16:59:42.000Z
2021-11-04T16:59:42.000Z
46.333333
159
0.701839
1,574
package gregtech.api.gui.resources; import gregtech.api.GTValues; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; public class SizedTextureArea extends TextureArea { public final float pixelImageWidth; public final float pixelImageHeight; public SizedTextureArea(Identifier imageLocation, float offsetX, float offsetY, float width, float height, float pixelImageWidth, float pixelImageHeight) { super(imageLocation, offsetX, offsetY, width, height); this.pixelImageWidth = pixelImageWidth; this.pixelImageHeight = pixelImageHeight; } @Override public SizedTextureArea getSubArea(float offsetX, float offsetY, float width, float height) { return new SizedTextureArea(imageLocation, this.offsetX + (imageWidth * offsetX), this.offsetY + (imageHeight * offsetY), this.imageWidth * width, this.imageHeight * height, this.pixelImageWidth * width, this.pixelImageHeight * height); } public static SizedTextureArea fullImage(String imageLocation, int imageWidth, int imageHeight) { return new SizedTextureArea(new Identifier(GTValues.MODID, imageLocation), 0.0f, 0.0f, 1.0f, 1.0f, imageWidth, imageHeight); } public void drawHorizontalCutArea(MatrixStack matrices, int x, int y, int width, int height) { drawHorizontalCutSubArea(matrices, x, y, width, height, 0.0f, 1.0f); } public void drawVerticalCutArea(MatrixStack matrices, int x, int y, int width, int height) { drawVerticalCutSubArea(matrices, x, y, width, height, 0.0f, 1.0f); } public void drawHorizontalCutSubArea(MatrixStack matrices, int x, int y, int width, int height, float drawnV, float drawnHeight) { float drawnWidth = width / 2.0f / pixelImageWidth; drawSubArea(matrices, x, y, width / 2, height, 0.0f, drawnV, drawnWidth, drawnHeight); drawSubArea(matrices, x + width / 2.0f, y, width / 2, height, 1.0f - drawnWidth, drawnV, drawnWidth, drawnHeight); } public void drawVerticalCutSubArea(MatrixStack matrices, int x, int y, int width, int height, float drawnU, float drawnWidth) { float drawnHeight = height / 2.0f / pixelImageHeight; drawSubArea(matrices, x, y, width, height / 2, drawnU, 0.0f, drawnWidth, drawnHeight); drawSubArea(matrices, x, y + height / 2.0f, width, height / 2, drawnU, 1.0f - drawnHeight, drawnWidth, drawnHeight); } }
3e03ce2c0547432fa2816bc674fe32e039f64e37
3,108
java
Java
components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/secret/management/v1/model/SecretUpdateRequest.java
pamodaaw/identity-api-server
63cd4361d4a946750509b9e6a5da99e48482770e
[ "Apache-2.0" ]
12
2019-07-02T15:59:01.000Z
2021-10-05T09:19:35.000Z
components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/secret/management/v1/model/SecretUpdateRequest.java
pamodaaw/identity-api-server
63cd4361d4a946750509b9e6a5da99e48482770e
[ "Apache-2.0" ]
77
2019-08-05T15:53:56.000Z
2022-03-21T04:34:32.000Z
components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/secret/management/v1/model/SecretUpdateRequest.java
pamodaaw/identity-api-server
63cd4361d4a946750509b9e6a5da99e48482770e
[ "Apache-2.0" ]
76
2019-06-27T10:42:45.000Z
2022-02-03T08:28:00.000Z
25.68595
90
0.637387
1,575
/* * Copyright (c) 2021, WSO2 Inc. (http://www.wso2.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.wso2.carbon.identity.api.server.secret.management.v1.model; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; import java.util.Objects; import javax.validation.Valid; public class SecretUpdateRequest { private String value; private String description; /** * **/ public SecretUpdateRequest value(String value) { this.value = value; return this; } @ApiModelProperty(example = "new-sample-value", required = true, value = "") @JsonProperty("value") @Valid @NotNull(message = "Property value cannot be null.") public String getValue() { return value; } public void setValue(String value) { this.value = value; } /** * **/ public SecretUpdateRequest description(String description) { this.description = description; return this; } @ApiModelProperty(example = "sample_description", value = "") @JsonProperty("description") @Valid public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SecretUpdateRequest secretUpdateRequest = (SecretUpdateRequest) o; return Objects.equals(this.value, secretUpdateRequest.value) && Objects.equals(this.description, secretUpdateRequest.description); } @Override public int hashCode() { return Objects.hash(value, description); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SecretUpdateRequest {\n"); sb.append(" value: ").append(toIndentedString(value)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n"); } }
3e03cfc6cef26149edc8d6367d3e01d6ad40a385
632
java
Java
SpotifyPlayerAction.java
gaurav-dogra/music_advisor_hyperskill
d96e89d2f09fd74c2447e6b01dbfbd1a6fa78bb7
[ "MIT" ]
null
null
null
SpotifyPlayerAction.java
gaurav-dogra/music_advisor_hyperskill
d96e89d2f09fd74c2447e6b01dbfbd1a6fa78bb7
[ "MIT" ]
null
null
null
SpotifyPlayerAction.java
gaurav-dogra/music_advisor_hyperskill
d96e89d2f09fd74c2447e6b01dbfbd1a6fa78bb7
[ "MIT" ]
null
null
null
25.28
60
0.523734
1,576
package advisor; public abstract class SpotifyPlayerAction { public static SpotifyPlayerAction create(String input) { switch (input) { case "new": return new FetchNewReleases(); case "featured": return new FetchFeatured(); case "categories": return new FetchCategories(); case "playlists mood": return new FetchMoodPlaylist(); case "auth": return new Auth(); default: throw new SpotifyException(); } } public abstract void act(); }
3e03d00ddf84c675fe9151657a5519f493271280
5,347
java
Java
src/main/java/data/Cita_medicaDAO.java
igorariza/JavaMedicCenterJDBC
adcb91b99ade2457cc78fd5cb068aa1d1189b625
[ "MIT" ]
null
null
null
src/main/java/data/Cita_medicaDAO.java
igorariza/JavaMedicCenterJDBC
adcb91b99ade2457cc78fd5cb068aa1d1189b625
[ "MIT" ]
null
null
null
src/main/java/data/Cita_medicaDAO.java
igorariza/JavaMedicCenterJDBC
adcb91b99ade2457cc78fd5cb068aa1d1189b625
[ "MIT" ]
null
null
null
40.507576
233
0.657191
1,577
package data; import static data.Conexion.*; import domain.*; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class Cita_medicaDAO implements IDAO<Cita_medica> { //para las consultas SQL............ private PreparedStatement insertar = null; private PreparedStatement eliminar = null; private PreparedStatement actualizar = null; private PreparedStatement buscar = null; private PreparedStatement listar = null; private Connection conn = null; private Connection conexionTransaccional; private static Cita_medicaDAO instacia; public static Cita_medicaDAO getInstance() { if (instacia == null) { instacia = new Cita_medicaDAO(); } return instacia; } public void insertar(Cita_medica entidad) throws SQLException { String query = "INSERT INTO Cita_medica(fecha_cita, hora, identificacion_medico_cita, estado_cita) VALUES " + "(?,?,?,'Programada');"; conn = this.conexionTransaccional != null ? this.conexionTransaccional : getConnection(); if (insertar == null) { insertar = conn.prepareStatement(query); } insertar.setString(1, entidad.getFecha_cita()); insertar.setString(2, entidad.getHora()); insertar.setString(3, entidad.getIdentificacion_medico_cita()); insertar.executeUpdate(); } public void eliminar(String id) throws SQLException { String query = "DELETE FROM Cita_medica WHERE id_cita = ? ;"; conn = this.conexionTransaccional != null ? this.conexionTransaccional : getConnection(); if (eliminar == null) { eliminar = conn.prepareStatement(query); } eliminar.setString(1, id); eliminar.executeUpdate(); } public Cita_medica cargar(ResultSet set) throws SQLException { Cita_medica Cita_medica = new Cita_medica(); Cita_medica.setId_cita(set.getInt("id_cita")); Cita_medica.setFecha_cita(set.getString("fecha_cita")); Cita_medica.setHora(set.getString("hora")); Cita_medica.setIdentificacion_medico_cita(set.getString("identificacion_medico_cita")); Cita_medica.setNombre_medico(set.getString("nombre_empleado")); Cita_medica.setIdentificacion_paciente_cita(set.getString("identificacion_paciente_cita")); Cita_medica.setNombre_paciente(set.getString("nombre_paciente")); Cita_medica.setEstado_cita(set.getString("estado_cita")); Cita_medica.setFormula_medica_cita(set.getInt("formula_medica_cita")); return Cita_medica; } public List<Cita_medica> listar() throws SQLException { String query = "SELECT DISTINCT id_cita,fecha_cita,hora,identificacion_medico_cita,nombre_empleado, identificacion_paciente_cita,nombre_paciente ,estado_cita,formula_medica_cita\n" + "FROM (cita_medica INNER JOIN (medico INNER JOIN empleado ON medico.identificacion_medico = empleado.identificacion_empleado) AS c ON cita_medica.identificacion_medico_cita = c.identificacion_empleado ) as c1\n" + "INNER JOIN paciente ON c1.identificacion_paciente_cita = paciente.numero_ss"; conn = this.conexionTransaccional != null ? this.conexionTransaccional : getConnection(); if (listar == null) { listar = conn.prepareStatement(query); } ResultSet set = listar.executeQuery(); ArrayList<Cita_medica> result = new ArrayList<>(); while (set.next()) { result.add(cargar(set)); } return result; } public Cita_medica buscar(String id) throws SQLException { String query = "SELECT * \n" + "FROM Cita_medica\n" + "WHERE Cita_medica.id_cita= ? ;"; conn = this.conexionTransaccional != null ? this.conexionTransaccional : getConnection(); if (buscar == null) { buscar = conn.prepareStatement(query); } buscar.setString(1, id); ResultSet set = buscar.executeQuery(); return set != null && set.next() ? cargar(set) : null; } public void actualizar(Cita_medica entidad) throws SQLException { String query = "UPDATE Cita_medica SET fecha_cita = ? , hora = ? , identificacion_medico_cita = ? , " + "identificacion_paciente_cita = ? , estado_cita = ? , formula_medica_cita = ? WHERE id_cita = ? ;"; conn = this.conexionTransaccional != null ? this.conexionTransaccional : getConnection(); if (actualizar == null) { actualizar = conn.prepareStatement(query); } actualizar.setString(1, entidad.getFecha_cita()); actualizar.setString(2, entidad.getHora()); actualizar.setString(3, entidad.getIdentificacion_medico_cita()); actualizar.setString(4, entidad.getIdentificacion_paciente_cita()); actualizar.setString(5, entidad.getEstado_cita()); actualizar.setInt(6, entidad.getFormula_medica_cita()); actualizar.setInt(7, entidad.getId_cita()); actualizar.executeUpdate(); } }
3e03d037bbd6979d14f031e76c32686a77a927ee
5,008
java
Java
modules/activiti-bpmn-converter/src/test/java/org/activiti/editor/language/xml/UserTaskConverterTest.java
caijinbiao/Activiti
eb7b364662cfaa36169b755f55962bf3f8902baf
[ "Apache-1.1" ]
684
2020-07-29T04:32:00.000Z
2022-03-31T12:24:02.000Z
modules/activiti-bpmn-converter/src/test/java/org/activiti/editor/language/xml/UserTaskConverterTest.java
caijinbiao/Activiti
eb7b364662cfaa36169b755f55962bf3f8902baf
[ "Apache-1.1" ]
13
2021-06-17T09:50:01.000Z
2022-03-08T21:12:32.000Z
modules/activiti-bpmn-converter/src/test/java/org/activiti/editor/language/xml/UserTaskConverterTest.java
caijinbiao/Activiti
eb7b364662cfaa36169b755f55962bf3f8902baf
[ "Apache-1.1" ]
49
2020-10-18T03:29:05.000Z
2022-03-31T05:47:35.000Z
45.117117
115
0.755591
1,578
package org.activiti.editor.language.xml; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.util.List; import org.activiti.bpmn.model.ActivitiListener; import org.activiti.bpmn.model.BpmnModel; import org.activiti.bpmn.model.FlowElement; import org.activiti.bpmn.model.FormProperty; import org.activiti.bpmn.model.ImplementationType; import org.activiti.bpmn.model.UserTask; import org.apache.commons.lang3.StringUtils; import org.junit.Test; public class UserTaskConverterTest extends AbstractConverterTest { @Test public void connvertXMLToModel() throws Exception { BpmnModel bpmnModel = readXMLFile(); validateModel(bpmnModel); } @Test public void convertModelToXML() throws Exception { BpmnModel bpmnModel = readXMLFile(); BpmnModel parsedModel = exportAndReadXMLFile(bpmnModel); validateModel(parsedModel); deployProcess(parsedModel); } protected String getResource() { return "usertaskmodel.bpmn"; } private void validateModel(BpmnModel model) { FlowElement flowElement = model.getMainProcess().getFlowElement("usertask"); assertNotNull(flowElement); assertTrue(flowElement instanceof UserTask); assertEquals("usertask", flowElement.getId()); UserTask userTask = (UserTask) flowElement; assertEquals("usertask", userTask.getId()); assertEquals("User task", userTask.getName()); assertEquals("Test Category", userTask.getCategory()); assertEquals("testKey", userTask.getFormKey()); assertEquals("40", userTask.getPriority()); assertEquals("2012-11-01", userTask.getDueDate()); assertEquals("customCalendarName", userTask.getBusinessCalendarName()); assertEquals("kermit", userTask.getAssignee()); assertEquals(2, userTask.getCandidateUsers().size()); assertTrue(userTask.getCandidateUsers().contains("kermit")); assertTrue(userTask.getCandidateUsers().contains("fozzie")); assertEquals(2, userTask.getCandidateGroups().size()); assertTrue(userTask.getCandidateGroups().contains("management")); assertTrue(userTask.getCandidateGroups().contains("sales")); assertEquals(1, userTask.getCustomUserIdentityLinks().size()); assertEquals(2, userTask.getCustomGroupIdentityLinks().size()); assertTrue(userTask.getCustomUserIdentityLinks().get("businessAdministrator").contains("kermit")); assertTrue(userTask.getCustomGroupIdentityLinks().get("manager").contains("management")); assertTrue(userTask.getCustomGroupIdentityLinks().get("businessAdministrator").contains("management")); List<FormProperty> formProperties = userTask.getFormProperties(); assertEquals(3, formProperties.size()); FormProperty formProperty = formProperties.get(0); assertEquals("formId", formProperty.getId()); assertEquals("formName", formProperty.getName()); assertEquals("string", formProperty.getType()); assertEquals("variable", formProperty.getVariable()); assertEquals("${expression}", formProperty.getExpression()); formProperty = formProperties.get(1); assertEquals("formId2", formProperty.getId()); assertEquals("anotherName", formProperty.getName()); assertEquals("long", formProperty.getType()); assertTrue(StringUtils.isEmpty(formProperty.getVariable())); assertTrue(StringUtils.isEmpty(formProperty.getExpression())); formProperty = formProperties.get(2); assertEquals("formId3", formProperty.getId()); assertEquals("enumName", formProperty.getName()); assertEquals("enum", formProperty.getType()); assertTrue(StringUtils.isEmpty(formProperty.getVariable())); assertTrue(StringUtils.isEmpty(formProperty.getExpression())); assertEquals(2, formProperty.getFormValues().size()); List<ActivitiListener> listeners = userTask.getTaskListeners(); assertEquals(3, listeners.size()); ActivitiListener listener = listeners.get(0); assertTrue(ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(listener.getImplementationType())); assertEquals("org.test.TestClass", listener.getImplementation()); assertEquals("create", listener.getEvent()); listener = listeners.get(1); assertTrue(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equals(listener.getImplementationType())); assertEquals("${someExpression}", listener.getImplementation()); assertEquals("assignment", listener.getEvent()); listener = listeners.get(2); assertTrue(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equals(listener.getImplementationType())); assertEquals("${someDelegateExpression}", listener.getImplementation()); assertEquals("complete", listener.getEvent()); List<ActivitiListener> executionListeners = userTask.getExecutionListeners(); assertEquals(1, executionListeners.size()); ActivitiListener executionListener = executionListeners.get(0); assertEquals("end", executionListener.getEvent()); } }
3e03d101a0a3ff588af0e7b0db47d0575601aad8
2,346
java
Java
src/main/java/com/extracraftx/minecraft/extradoors/block/BambooTrapdoorBlock.java
ksincennes/ExtraDoors
fa635fbc91881ad70db3c888de4b1decaf8a5376
[ "MIT" ]
null
null
null
src/main/java/com/extracraftx/minecraft/extradoors/block/BambooTrapdoorBlock.java
ksincennes/ExtraDoors
fa635fbc91881ad70db3c888de4b1decaf8a5376
[ "MIT" ]
null
null
null
src/main/java/com/extracraftx/minecraft/extradoors/block/BambooTrapdoorBlock.java
ksincennes/ExtraDoors
fa635fbc91881ad70db3c888de4b1decaf8a5376
[ "MIT" ]
null
null
null
37.83871
115
0.727621
1,579
package com.extracraftx.minecraft.extradoors.block; import com.extracraftx.minecraft.extradoors.ExtraDoors; import io.github.chloedawn.couplings.Trapdoors; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Material; import net.minecraft.block.TrapdoorBlock; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemPlacementContext; import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BambooTrapdoorBlock extends TrapdoorBlock { public BambooTrapdoorBlock() { super(Settings.of(Material.BAMBOO).strength(1f, 1f).sounds(BlockSoundGroup.BAMBOO)); } @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hitResult) { state = state.cycle(OPEN); world.setBlockState(pos, state, 2); if(state.get(WATERLOGGED)) world.getFluidTickScheduler().schedule(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); playSound(world, player, pos, state); if(ExtraDoors.COUPLINGS){ Trapdoors.used(state, world, pos, player, hand, hitResult, ActionResult.SUCCESS); } return ActionResult.SUCCESS; } @Override public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos updatedPos, boolean b) { //Do nothing } @Override public BlockState getPlacementState(ItemPlacementContext placementContext) { BlockState state = super.getPlacementState(placementContext); if(state == null) return state; return state.with(OPEN, false); } protected void playSound(World world, PlayerEntity player, BlockPos pos, BlockState state) { world.playSound(player, pos, state.get(OPEN) ? SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN : SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, SoundCategory.BLOCKS, 1, world.getRandom().nextFloat() * 0.1f + 1f); } }
3e03d1cd0a9f08651cef6f0e051ea624a5b000a9
1,474
java
Java
code/api/server/src/main/java/com/decathlon/ara/defect/jira/api/model/vote/JiraVotes.java
fredvigna/ara
d5788873eb2505e71a1665461775bc76bfea091a
[ "Apache-2.0" ]
86
2019-04-04T13:52:41.000Z
2022-01-11T16:13:01.000Z
code/api/server/src/main/java/com/decathlon/ara/defect/jira/api/model/vote/JiraVotes.java
fredvigna/ara
d5788873eb2505e71a1665461775bc76bfea091a
[ "Apache-2.0" ]
430
2019-04-09T20:11:40.000Z
2022-03-19T07:26:45.000Z
code/api/server/src/main/java/com/decathlon/ara/defect/jira/api/model/vote/JiraVotes.java
fredvigna/ara
d5788873eb2505e71a1665461775bc76bfea091a
[ "Apache-2.0" ]
22
2019-05-15T13:34:47.000Z
2022-03-18T18:02:53.000Z
50.827586
80
0.401628
1,580
/****************************************************************************** * Copyright (C) 2020 by the ARA Contributors * * * * 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.decathlon.ara.defect.jira.api.model.vote; import lombok.Data; @Data public class JiraVotes { private String self; private Integer votes; private Boolean hasVoted; }
3e03d209393b189663f9c569010a737bcd583d85
18,299
java
Java
jenetics/src/jmh/java/io/jenetics/util/IndexSorter.java
ycechung4kcode/jenetics
fd3bda97330ce930794583957a62f7b8e97cf671
[ "Apache-2.0" ]
787
2015-01-11T20:09:07.000Z
2022-03-30T18:39:18.000Z
jenetics/src/jmh/java/io/jenetics/util/IndexSorter.java
Scrappers-glitch/jenetics
2fbebb51b43530da780c870ad818053ccdd721d8
[ "Apache-2.0" ]
485
2015-01-20T21:57:23.000Z
2022-03-30T14:10:50.000Z
jenetics/src/jmh/java/io/jenetics/util/IndexSorter.java
Scrappers-glitch/jenetics
2fbebb51b43530da780c870ad818053ccdd721d8
[ "Apache-2.0" ]
171
2015-01-17T06:42:34.000Z
2022-03-12T08:31:20.000Z
27.768182
100
0.636438
1,581
/* * Java Genetic Algorithm Library (@__identifier__@). * Copyright (c) @__year__@ Franz Wilhelmstötter * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Author: * Franz Wilhelmstötter ([email protected]) */ package io.jenetics.util; import static io.jenetics.internal.util.Arrays.swap; import java.util.Comparator; /** * OLD 'ProxySorter' implementation. * * Implementations of this class doesn't sort the given array directly, instead * an index lookup array is returned which allows to access the array in * an sorted order. The arrays are sorted in descending order. * * @author <a href="mailto:[email protected]">Franz Wilhelmstötter</a> * @since 3.0 * @version 3.0 */ public abstract class IndexSorter { // This value has been chosen after JMH benchmarking. // Benchmark Mode Samples Score Score error Units // o.j.i.u.IndexSorterPerf.heapSort160 avgt 14 5560.895 80.158 ns/op // o.j.i.u.IndexSorterPerf.heapSort250 avgt 14 9516.441 119.648 ns/op // o.j.i.u.IndexSorterPerf.heapSort320 avgt 14 12722.461 103.487 ns/op // o.j.i.u.IndexSorterPerf.heapSort80 avgt 14 2473.058 27.884 ns/op // o.j.i.u.IndexSorterPerf.insertionSort160 avgt 14 10877.158 550.338 ns/op // o.j.i.u.IndexSorterPerf.insertionSort250 avgt 14 25731.100 925.196 ns/op // o.j.i.u.IndexSorterPerf.insertionSort320 avgt 14 41864.108 1801.247 ns/op // o.j.i.u.IndexSorterPerf.insertionSort80 avgt 14 2643.726 165.315 ns/op //private static final int INSERTION_SORT_THRESHOLD = 80; private static final int INSERTION_SORT_THRESHOLD = 80; /** * Sorting the given {@code array} by changing the given {@code indexes}. * The order of the original {@code array} stays unchanged. * * @param array the array to sort * @param indexes the index lookup array - * &forall; i &isin; [0, N): index[i] = i * @param comparator the comparator used for sorting the array * @param <T> the element type * @return the given {@code indexes} which is now "sorted" * @throws NullPointerException if one of the arguments is {@code null} */ public abstract <T> int[] sort( final Seq<? extends T> array, final int[] indexes, final Comparator<? super T> comparator ); /** * Sorting the given {@code array} by changing the given {@code indexes}. * The order of the original {@code array} stays unchanged. * * @param array the array to sort * @param indexes the index lookup array - * &forall; i &isin; [0, N): index[i] = i * @param <C> the element type * @return the given {@code indexes} which is now "sorted" * @throws NullPointerException if one of the arguments is {@code null} */ public <C extends Comparable<? super C>> int[] sort( final Seq<? extends C> array, final int[] indexes ) { return sort(array, indexes, Comparator.naturalOrder()); } /** * Sorting the given {@code array} by changing the given {@code indexes}. * The order of the original {@code array} stays unchanged. * * @param array the array to sort * @param indexes the index lookup array - * &forall; i &isin; [0, N): index[i] = i * @param comparator the comparator used for sorting the array * @param <T> the element type * @return the given {@code indexes} which is now "sorted" * @throws NullPointerException if one of the arguments is {@code null} */ public abstract <T> int[] sort( final T[] array, final int[] indexes, final Comparator<? super T> comparator ); /** * Sorting the given {@code array} by changing the given {@code indexes}. * The order of the original {@code array} stays unchanged. * * @param array the array to sort * @param indexes the index lookup array - * &forall; i &isin; [0, N): index[i] = i * @param <C> the element type * @return the given {@code indexes} which is now "sorted" * @throws NullPointerException if one of the arguments is {@code null} */ public <C extends Comparable<? super C>> int[] sort( final C[] array, final int[] indexes ) { return sort(array, indexes, Comparator.naturalOrder()); } /** * Sorting the given {@code array} by changing the given {@code indexes}. * The order of the original {@code array} stays unchanged. * * @param array the array to sort * @param indexes the index lookup array - * &forall; i &isin; [0, N): index[i] = i * @param comparator the comparator used for comparing two int values * @return the given {@code indexes} which is now "sorted" * @throws NullPointerException if one of the arguments is {@code null} */ public abstract int[] sort( final int[] array, final int[] indexes, final IntComparator comparator ); /** * Sorting the given {@code array} by changing the given {@code indexes}. * The order of the original {@code array} stays unchanged. * * @param array the array to sort * @param indexes the index lookup array - * &forall; i &isin; [0, N): index[i] = i * @return the given {@code indexes} which is now "sorted" * @throws NullPointerException if one of the arguments is {@code null} */ public int[] sort(final int[] array, final int[] indexes) { return sort(array, indexes, Integer::compare); } /** * Sorting the given {@code array} by changing the given {@code indexes}. * The order of the original {@code array} stays unchanged. * * @param array the array to sort * @param indexes the index lookup array - * &forall; i &isin; [0, N): index[i] = i * @return the given {@code indexes} which is now "sorted" * @throws NullPointerException if one of the arguments is {@code null} */ public abstract int[] sort(final long[] array, final int[] indexes); /** * Sorting the given {@code array} by changing the given {@code indexes}. * The order of the original {@code array} stays unchanged. * * @param array the array to sort * @param indexes the index lookup array - * &forall; i &isin; [0, N): index[i] = i * @return the given {@code indexes} which is now "sorted" * @throws NullPointerException if one of the arguments is {@code null} */ public abstract int[] sort(final double[] array, final int[] indexes); /* ************************************************************************* * Static sorting methods. * ************************************************************************/ /** * Return an {@code IndexSorter} suitable for the given array length. * * @param length the array length * @return the suitable {@code IndexSorter} */ public static IndexSorter sorter(final int length) { return length < INSERTION_SORT_THRESHOLD ? InsertionSorter.INSTANCE : HeapSorter.INSTANCE; } /** * Sorting the given {@code array} by changing the given {@code indexes}. * The order of the original {@code array} stays unchanged. * * @param array the array to sort * @param comparator the comparator used for sorting the array * @param <T> the element type * @return the given {@code indexes} which is now "sorted" * @throws NullPointerException if one of the arguments is {@code null} */ public static <T> int[] sort( final Seq<? extends T> array, final Comparator<? super T> comparator ) { final IndexSorter sorter = array.size() < INSERTION_SORT_THRESHOLD ? InsertionSorter.INSTANCE : HeapSorter.INSTANCE; return sorter.sort(array, indexes(array.size()), comparator); } /** * Sorting the given {@code array} by changing the given {@code indexes}. * The order of the original {@code array} stays unchanged. * * @param array the array to sort * @param <C> the element type * @return the given {@code indexes} which is now "sorted" * @throws NullPointerException if one of the arguments is {@code null} */ public static <C extends Comparable<? super C>> int[] sort(final Seq<? extends C> array) { final IndexSorter sorter = array.size() < INSERTION_SORT_THRESHOLD ? InsertionSorter.INSTANCE : HeapSorter.INSTANCE; return sorter.sort(array, indexes(array.size())); } /** * Sorting the given {@code array} by changing the given {@code indexes}. * The order of the original {@code array} stays unchanged. * * @param array the array to sort * @param comparator the comparator used for sorting the array * @param <T> the element type * @return the given {@code indexes} which is now "sorted" * @throws NullPointerException if one of the arguments is {@code null} */ public static <T> int[] sort( final T[] array, final Comparator<? super T> comparator ) { final IndexSorter sorter = array.length < INSERTION_SORT_THRESHOLD ? InsertionSorter.INSTANCE : HeapSorter.INSTANCE; return sorter.sort(array, indexes(array.length), comparator); } /** * Sorting the given {@code array} by changing the given {@code indexes}. * The order of the original {@code array} stays unchanged. * * @param array the array to sort * @param <C> the element type * @return the given {@code indexes} which is now "sorted" * @throws NullPointerException if one of the arguments is {@code null} */ public static <C extends Comparable<? super C>> int[] sort(final C[] array) { final IndexSorter sorter = array.length < INSERTION_SORT_THRESHOLD ? InsertionSorter.INSTANCE : HeapSorter.INSTANCE; return sorter.sort(array, indexes(array.length)); } /** * Return an new sorted index lookup array. The given array is not touched. * * @param array the array to sort. * @return the index lookup array */ public static int[] sort(final int[] array) { final IndexSorter sorter = array.length < INSERTION_SORT_THRESHOLD ? InsertionSorter.INSTANCE : HeapSorter.INSTANCE; return sorter.sort(array, indexes(array.length)); } /** * Return an new sorted index lookup array. The given array is not touched. * * @param array the array to sort. * @return the index lookup array */ public static int[] sort(final long[] array) { final IndexSorter sorter = array.length < INSERTION_SORT_THRESHOLD ? InsertionSorter.INSTANCE : HeapSorter.INSTANCE; return sorter.sort(array, indexes(array.length)); } /** * Return an new sorted index lookup array. The given array is not touched. * * @param array the array to sort. * @return the index lookup array */ public static int[] sort(final double[] array) { final IndexSorter sorter = array.length < INSERTION_SORT_THRESHOLD ? InsertionSorter.INSTANCE : HeapSorter.INSTANCE; return sorter.sort(array, indexes(array.length)); } /** * Create an initial indexes array of the given {@code length}. * * @param length the length of the indexes array * @return the initialized indexes array */ public static int[] indexes(final int length) { return init(new int[length]); } /** * Initializes the given {@code indexes} array. * * @param indexes the indexes array to initialize * @return the initialized indexes array * @throws NullPointerException if the given {@code indexes} array is * {@code null} */ public static int[] init(final int[] indexes) { for (int i = 0; i < indexes.length; ++i) { indexes[i] = i; } return indexes; } @Override public String toString() { return getClass().getSimpleName(); } } /** * Heap sort implementation. */ final class HeapSorter extends IndexSorter { static final HeapSorter INSTANCE = new HeapSorter(); @Override public <T> int[] sort( final Seq<? extends T> array, final int[] indexes, final Comparator<? super T> comparator ) { // Heapify for (int k = array.size()/2; k >= 0; --k) { sink(array, indexes, comparator, k, array.size()); } // Sort down. for (int i = array.size(); --i >= 1;) { swap(indexes, 0, i); sink(array, indexes, comparator, 0, i); } return indexes; } private static <T> void sink( final Seq<? extends T> array, final int[] indexes, final Comparator<? super T> comparator, final int start, final int end ) { int m = start; while (2*m < end) { int j = 2*m; if (j < end - 1 && comparator.compare(array.get(indexes[j]), array.get(indexes[j + 1])) > 0) ++j; if (comparator.compare(array.get(indexes[m]), array.get(indexes[j])) <= 0) break; swap(indexes, m, j); m = j; } } @Override public <T> int[] sort( final T[] array, final int[] indexes, final Comparator<? super T> comparator ) { // Heapify for (int k = array.length/2; k >= 0; --k) { sink(array, indexes, comparator, k, array.length); } // Sort down. for (int i = array.length; --i >= 1;) { swap(indexes, 0, i); sink(array, indexes, comparator, 0, i); } return indexes; } private static <T> void sink( final T[] array, final int[] indexes, final Comparator<? super T> comparator, final int start, final int end ) { int m = start; while (2*m < end) { int j = 2*m; if (j < end - 1 && comparator.compare(array[indexes[j]], array[indexes[j + 1]]) > 0) ++j; if (comparator.compare(array[indexes[m]], array[indexes[j]]) <= 0) break; swap(indexes, m, j); m = j; } } @Override public int[] sort( final int[] array, final int[] indexes, final IntComparator comparator ) { // Heapify for (int k = array.length/2; k >= 0; --k) { sink(array, indexes, comparator, k, array.length); } // Sort down. for (int i = array.length; --i >= 1;) { swap(indexes, 0, i); sink(array, indexes, comparator, 0, i); } return indexes; } private static void sink( final int[] array, final int[] indexes, final IntComparator comparator, final int start, final int end ) { int m = start; while (2*m < end) { int j = 2*m; if (j < end - 1 && comparator.compare(array[indexes[j]], array[indexes[j + 1]]) > 0) { ++j; } if (comparator.compare(array[indexes[m]], array[indexes[j]]) <= 0) { break; } swap(indexes, m, j); m = j; } } @Override public int[] sort(final long[] array, final int[] indexes) { // Heapify for (int k = array.length/2; k >= 0; --k) { sink(array, indexes, k, array.length); } // Sort down. for (int i = array.length; --i >= 1;) { swap(indexes, 0, i); sink(array, indexes, 0, i); } return indexes; } private static void sink( final long[] array, final int[] indexes, final int start, final int end ) { int m = start; while (2*m < end) { int j = 2*m; if (j < end - 1 && array[indexes[j]] > array[indexes[j + 1]]) ++j; if (array[indexes[m]] <= array[indexes[j]]) break; swap(indexes, m, j); m = j; } } @Override public int[] sort(final double[] array, final int[] indexes) { // Heapify for (int k = array.length/2; k >= 0; --k) { sink(array, indexes, k, array.length); } // Sort down. for (int i = array.length; --i >= 1;) { swap(indexes, 0, i); sink(array, indexes, 0, i); } return indexes; } private static void sink( final double[] array, final int[] indexes, final int start, final int end ) { int m = start; while (2*m < end) { int j = 2*m; if (j < end - 1 && array[indexes[j]] > array[indexes[j + 1]]) ++j; if (array[indexes[m]] <= array[indexes[j]]) break; swap(indexes, m, j); m = j; } } } /** * Insertion sort implementation. */ final class InsertionSorter extends IndexSorter { static final InsertionSorter INSTANCE = new InsertionSorter(); @Override public <T> int[] sort( final Seq<? extends T> array, final int[] indexes, final Comparator<? super T> comparator ) { for (int i = 1, n = array.size(); i < n; ++i) { int j = i; while (j > 0) { if (comparator.compare(array.get(indexes[j - 1]), array.get(indexes[j])) < 0) { swap(indexes, j - 1, j); } else { break; } --j; } } return indexes; } @Override public <T> int[] sort( final T[] array, final int[] indexes, final Comparator<? super T> comparator ) { for (int i = 1, n = array.length; i < n; ++i) { int j = i; while (j > 0) { if (comparator.compare(array[indexes[j - 1]], array[indexes[j]]) < 0) { swap(indexes, j - 1, j); } else { break; } --j; } } return indexes; } @Override public int[] sort( final int[] array, final int[] indexes, final IntComparator comparator ) { for (int i = 1, n = array.length; i < n; ++i) { int j = i; while (j > 0) { if (comparator.compare(array[indexes[j - 1]], array[indexes[j]]) < 0) { swap(indexes, j - 1, j); } else { break; } --j; } } return indexes; } @Override public int[] sort(final long[] array, final int[] indexes) { for (int i = 1, n = array.length; i < n; ++i) { int j = i; while (j > 0) { if (array[indexes[j - 1]] < array[indexes[j]]) { swap(indexes, j - 1, j); } else { break; } --j; } } return indexes; } @Override public int[] sort(final double[] array, final int[] indexes) { for (int i = 1, n = array.length; i < n; ++i) { int j = i; while (j > 0) { if (array[indexes[j - 1]] < array[indexes[j]]) { swap(indexes, j - 1, j); } else { break; } --j; } } return indexes; } } @FunctionalInterface interface IntComparator { /** * Compares its two arguments for order. Returns a negative integer, zero, * or a positive integer as the first argument is less than, equal to, or * greater than the second. * * @param i the first integer * @param j the second integer * @return a negative integer, zero, or a positive integer as the first * argument is less than, equal to, or greater than the second */ int compare(final int i, final int j); }
3e03d2da3a120686d8a058355a92463d62858878
1,864
java
Java
src/main/java/com/amestrete/meuBanco/DbInitializer.java
Amestrete99/meuBanco
3dd1ca7a61e04b3097928742696023124eced298
[ "MIT" ]
null
null
null
src/main/java/com/amestrete/meuBanco/DbInitializer.java
Amestrete99/meuBanco
3dd1ca7a61e04b3097928742696023124eced298
[ "MIT" ]
null
null
null
src/main/java/com/amestrete/meuBanco/DbInitializer.java
Amestrete99/meuBanco
3dd1ca7a61e04b3097928742696023124eced298
[ "MIT" ]
null
null
null
33.890909
87
0.725858
1,582
package com.amestrete.meuBanco; import com.amestrete.meuBanco.model.Cliente; import com.amestrete.meuBanco.model.Conta; import com.amestrete.meuBanco.model.Transferencia; import com.amestrete.meuBanco.repository.ClienteRepository; import com.amestrete.meuBanco.repository.ContaRepository; import com.amestrete.meuBanco.repository.TransferenciaRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; import java.time.LocalDate; import java.time.LocalDateTime; @Component public class DbInitializer implements CommandLineRunner { @Autowired private ClienteRepository clienteRepository; @Autowired private ContaRepository contaRepository; @Autowired private TransferenciaRepository transferenciaRepository; @Override public void run(String... args) throws Exception { Cliente c1 = new Cliente(1,"Arthur",1); Cliente c2 = new Cliente(2,"Kevin",2); Cliente c3 = new Cliente(3,"Jorge",3); this.clienteRepository.save(c1); this.clienteRepository.save(c2); this.clienteRepository.save(c3); Conta acc1 = new Conta(1,1,5000); Conta acc2 = new Conta(2,2,10000); Conta acc3 = new Conta(3,3,7500); this.contaRepository.save(acc1); this.contaRepository.save(acc2); this.contaRepository.save(acc3); Transferencia t1 = new Transferencia(1,1,2,1,500,LocalDateTime.now(),false); Transferencia t2 = new Transferencia(2,2,3,4,400,LocalDateTime.now(),false); Transferencia t3 = new Transferencia(3,3,1,2,1250, LocalDateTime.now(), false); this.transferenciaRepository.save(t1); this.transferenciaRepository.save(t2); this.transferenciaRepository.save(t3); } }
3e03d44f43be21ffccf0140701448861789c620c
31,585
java
Java
corpus/class/eclipse.jdt.ui/1724.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
15
2018-07-10T09:38:31.000Z
2021-11-29T08:28:07.000Z
corpus/class/eclipse.jdt.ui/1724.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
3
2018-11-16T02:58:59.000Z
2021-01-20T16:03:51.000Z
corpus/class/eclipse.jdt.ui/1724.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
6
2018-06-27T20:19:00.000Z
2022-02-19T02:29:53.000Z
37.693317
390
0.642385
1,583
/******************************************************************************* * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * Genady Beryozkin <[email protected]> - [misc] Display values for constant fields in the Javadoc view - https://bugs.eclipse.org/bugs/show_bug.cgi?id=204914 * Tristan Hume <[email protected]> - Javadoc View should show method after code completion - https://bugs.eclipse.org/bugs/show_bug.cgi?id=385642 *******************************************************************************/ package org.eclipse.jdt.internal.ui.infoviews; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Shell; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.commands.ActionHandler; import org.eclipse.jface.resource.ColorRegistry; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.TextSelection; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IPartListener2; import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.IWorkbenchCommandConstants; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPartReference; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.handlers.IHandlerService; import org.eclipse.ui.part.ViewPart; import org.eclipse.ui.texteditor.ITextEditorActionConstants; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.ILocalVariable; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.ITypeParameter; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.ui.IContextMenuConstants; import org.eclipse.jdt.ui.JavaElementLabels; import org.eclipse.jdt.ui.actions.SelectionDispatchAction; import org.eclipse.jdt.internal.ui.JavaPluginImages; import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; import org.eclipse.jdt.internal.ui.text.JavaHeuristicScanner; import org.eclipse.jdt.internal.ui.text.Symbols; import org.eclipse.jdt.internal.ui.util.SelectionUtil; /** * Abstract class for views which show information for a given element. * * @since 3.0 */ public abstract class AbstractInfoView extends ViewPart implements ISelectionListener, IMenuListener, IPropertyChangeListener { /** JavaElementLabels flags used for the title */ private final long TITLE_FLAGS = JavaElementLabels.ALL_FULLY_QUALIFIED | JavaElementLabels.M_PRE_RETURNTYPE | JavaElementLabels.M_PARAMETER_TYPES | JavaElementLabels.M_PARAMETER_NAMES | JavaElementLabels.M_EXCEPTIONS | JavaElementLabels.F_PRE_TYPE_SIGNATURE | JavaElementLabels.M_PRE_TYPE_PARAMETERS | JavaElementLabels.T_TYPE_PARAMETERS | JavaElementLabels.USE_RESOLVED; private final long LOCAL_VARIABLE_TITLE_FLAGS = TITLE_FLAGS & ~JavaElementLabels.F_FULLY_QUALIFIED | JavaElementLabels.F_POST_QUALIFIED; private final long TYPE_PARAMETER_TITLE_FLAGS = TITLE_FLAGS | JavaElementLabels.TP_POST_QUALIFIED; /** JavaElementLabels flags used for the tool tip text */ private static final long TOOLTIP_LABEL_FLAGS = JavaElementLabels.DEFAULT_QUALIFIED | JavaElementLabels.ROOT_POST_QUALIFIED | JavaElementLabels.APPEND_ROOT_PATH | JavaElementLabels.M_PARAMETER_TYPES | JavaElementLabels.M_PARAMETER_NAMES | JavaElementLabels.M_APP_RETURNTYPE | JavaElementLabels.M_EXCEPTIONS | JavaElementLabels.F_APP_TYPE_SIGNATURE | JavaElementLabels.T_TYPE_PARAMETERS; /* * @see IPartListener2 */ private IPartListener2 fPartListener = new IPartListener2() { @Override public void partVisible(IWorkbenchPartReference ref) { if (ref.getId().equals(getSite().getId())) { IWorkbenchPart activePart = ref.getPage().getActivePart(); if (activePart != null) selectionChanged(activePart, ref.getPage().getSelection()); startListeningForSelectionChanges(); } } @Override public void partHidden(IWorkbenchPartReference ref) { if (ref.getId().equals(getSite().getId())) stopListeningForSelectionChanges(); } @Override public void partInputChanged(IWorkbenchPartReference ref) { if (!ref.getId().equals(getSite().getId())) computeAndSetInput(ref.getPart(false)); } @Override public void partActivated(IWorkbenchPartReference ref) { } @Override public void partBroughtToTop(IWorkbenchPartReference ref) { } @Override public void partClosed(IWorkbenchPartReference ref) { } @Override public void partDeactivated(IWorkbenchPartReference ref) { } @Override public void partOpened(IWorkbenchPartReference ref) { } }; /** The current input. */ protected IJavaElement fCurrentViewInput; /** The copy to clipboard action. */ private SelectionDispatchAction fCopyToClipboardAction; /** The goto input action. */ private GotoInputAction fGotoInputAction; /** Counts the number of background computation requests. */ private volatile int fComputeCount; /** * Progress monitor used to cancel pending computations. * @since 3.4 */ private IProgressMonitor fComputeProgressMonitor; /** * Background color. * @since 3.2 */ private Color fBackgroundColor; private RGB fBackgroundColorRGB; /** * True if linking with selection is enabled, false otherwise. * @since 3.4 */ private boolean fLinking = true; /** * The last part that from which a selection changed event was received. * * @since 3.9 */ private IWorkbenchPart fLastSelectionProvider; /** * Set the input of this view. * * @param input the input object, can be <code>null</code> */ protected abstract void doSetInput(Object input); /** * Computes the input for this view based on the given element. * * @param element the element from which to compute the input, or <code>null</code> * @return the input or <code>null</code> if the input was not computed successfully */ protected abstract Object computeInput(Object element); /** * Computes the input for this view based on the given elements * * @param part the part that triggered the current element update, or <code>null</code> * @param selection the new selection, or <code>null</code> * @param element the new java element that will be displayed, or <code>null</code> * @param monitor a progress monitor * @return the input or <code>null</code> if the input was not computed successfully * @since 3.4 */ protected Object computeInput(IWorkbenchPart part, ISelection selection, IJavaElement element, IProgressMonitor monitor) { return computeInput(element); } /** * Create the part control. * * @param parent the parent control * @see IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ protected abstract void internalCreatePartControl(Composite parent); /** * Set the view's foreground color. * * @param color the SWT color */ protected abstract void setForeground(Color color); /** * Set the view's background color. * * @param color the SWT color */ protected abstract void setBackground(Color color); /** * Returns the view's primary control. * * @return the primary control */ abstract Control getControl(); /** * Returns the context ID for the Help system * * @return the string used as ID for the Help context * @since 3.1 */ protected abstract String getHelpContextId(); /* * @see IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ @Override public final void createPartControl(Composite parent) { internalCreatePartControl(parent); inititalizeColors(); getSite().getWorkbenchWindow().getPartService().addPartListener(fPartListener); createContextMenu(); createActions(); fillActionBars(getViewSite().getActionBars()); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), getHelpContextId()); } /** * Creates the actions and action groups for this view. */ protected void createActions() { fGotoInputAction = new GotoInputAction(this); fGotoInputAction.setEnabled(false); fCopyToClipboardAction = new CopyToClipboardAction(getViewSite()); fToggleLinkAction = new LinkAction(); fToggleLinkAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR); fToggleLinkAction.updateLinkImage(false); ISelectionProvider provider = getSelectionProvider(); if (provider != null) provider.addSelectionChangedListener(fCopyToClipboardAction); } /** * Creates the context menu for this view. */ protected void createContextMenu() { //$NON-NLS-1$ MenuManager menuManager = new MenuManager("#PopupMenu"); menuManager.setRemoveAllWhenShown(true); menuManager.addMenuListener(this); Menu contextMenu = menuManager.createContextMenu(getControl()); getControl().setMenu(contextMenu); getSite().registerContextMenu(menuManager, getSelectionProvider()); } /* * @see IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager) */ @Override public void menuAboutToShow(IMenuManager menu) { menu.add(new Separator(IContextMenuConstants.GROUP_GOTO)); menu.add(new Separator(IContextMenuConstants.GROUP_OPEN)); menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT)); menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS)); IAction action; action = getCopyToClipboardAction(); if (action != null) menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, action); action = getSelectAllAction(); if (action != null) menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, action); menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, fGotoInputAction); } protected IAction getSelectAllAction() { return null; } protected IAction getCopyToClipboardAction() { return fCopyToClipboardAction; } /** * Returns the Java element for which info should be shown. * * @return input the input object or <code>null</code> if no input is set */ protected IJavaElement getOrignalInput() { return fCurrentViewInput; } // Helper method ISelectionProvider getSelectionProvider() { return getViewSite().getSelectionProvider(); } /** * Fills the actions bars. * <p> * Subclasses may extend. * * @param actionBars the action bars */ protected void fillActionBars(IActionBars actionBars) { IToolBarManager toolBar = actionBars.getToolBarManager(); fillToolBar(toolBar); IAction action; action = getCopyToClipboardAction(); if (action != null) actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), action); action = getSelectAllAction(); if (action != null) actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), action); IHandlerService handlerService = getSite().getService(IHandlerService.class); handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkAction)); } /** * Fills the tool bar. * <p> * Default is to do nothing.</p> * * @param tbm the tool bar manager */ protected void fillToolBar(IToolBarManager tbm) { tbm.add(fToggleLinkAction); tbm.add(fGotoInputAction); } /* * @see org.eclipse.jdt.internal.ui.infoviews.AbstractInfoView#inititalizeColors() * @since 3.2 */ private void inititalizeColors() { if (getSite().getShell().isDisposed()) return; Display display = getSite().getShell().getDisplay(); if (display == null || display.isDisposed()) return; setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); ColorRegistry registry = JFaceResources.getColorRegistry(); registry.addListener(this); fBackgroundColorRGB = registry.getRGB(getBackgroundColorKey()); Color bgColor; if (fBackgroundColorRGB == null) { bgColor = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND); fBackgroundColorRGB = bgColor.getRGB(); } else { bgColor = new Color(display, fBackgroundColorRGB); fBackgroundColor = bgColor; } setBackground(bgColor); } /** * The preference key for the background color. * * @return the background color key * @since 3.2 */ protected abstract String getBackgroundColorKey(); @Override public void propertyChange(PropertyChangeEvent event) { if (getBackgroundColorKey().equals(event.getProperty())) inititalizeColors(); } /** * Start to listen for selection changes. */ protected void startListeningForSelectionChanges() { getSite().getPage().addPostSelectionListener(this); } /** * Stop to listen for selection changes. */ protected void stopListeningForSelectionChanges() { getSite().getPage().removePostSelectionListener(this); } /** * Sets whether this info view reacts to selection * changes in the workbench. * * @param enabled if <code>true</code> then the input is set on selection changes */ protected void setLinkingEnabled(boolean enabled) { fLinking = enabled; if (fLinking && fLastSelectionProvider != null) { computeAndDoSetInput(fLastSelectionProvider, null, true); } } /** * Returns whether this info view reacts to selection * changes in the workbench. * * @return true if linking with selection is enabled */ protected boolean isLinkingEnabled() { return fLinking; } /* * @see ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) */ @Override public void selectionChanged(IWorkbenchPart part, ISelection selection) { if (part.equals(this)) return; fLastSelectionProvider = part; if (fLinking) computeAndSetInput(part); } /** * Tells whether the new input should be ignored * if the current input is the same. * * @param je the new input, may be <code>null</code> * @param part the workbench part * @param selection the current selection from the part that provides the input * @return <code>true</code> if the new input should be ignored */ protected boolean isIgnoringNewInput(IJavaElement je, IWorkbenchPart part, ISelection selection) { return fCurrentViewInput != null && fCurrentViewInput.equals(je) && je != null; } /** * Finds and returns the Java element selected in the given part. * * @param part the workbench part for which to find the selected Java element * @param selection the selection * @return the selected Java element */ protected IJavaElement findSelectedJavaElement(IWorkbenchPart part, ISelection selection) { Object element; try { if (part instanceof JavaEditor && selection instanceof ITextSelection) { JavaEditor editor = (JavaEditor) part; IJavaElement[] elements = TextSelectionConverter.codeResolve(editor, (ITextSelection) selection); if (elements != null && elements.length > 0) { return elements[0]; } else { // if we haven't selected anything useful, try the enclosing method call IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput()); ISelection methodSelection = guessMethodNamePosition(document, (ITextSelection) selection); // if an enclosing method call could not be found if (methodSelection == null) return null; // call this method recursively with the new selection return findSelectedJavaElement(part, methodSelection); } } else if (selection instanceof IStructuredSelection) { element = SelectionUtil.getSingleElement(selection); } else { return null; } } catch (JavaModelException e) { return null; } return findJavaElement(element); } /** * Gets the position of the innermost method call from a selection inside the parameters. * For example, the selection: String.valueOf(4|3543); would return a selection in valueOf. * * @param document the document containing the selection * @param selection the selection to search from * @return an offset into the given document, or <code>null</code> if the selection is not in a method call. * The returned selection is guaranteed to be in front of the given selection. */ private ITextSelection guessMethodNamePosition(IDocument document, ITextSelection selection) { final int contextPosition = selection.getOffset(); JavaHeuristicScanner scanner = new JavaHeuristicScanner(document); int bound = Math.max(-1, contextPosition - 200); // try the innermost scope of parentheses that looks like a method call int pos = contextPosition - 1; do { int paren = scanner.findOpeningPeer(pos, bound, '(', ')'); if (paren == JavaHeuristicScanner.NOT_FOUND) { try { // see if we're right after a closing parenthesis (e.g. happens on content assist for a method without parameters) if (pos == contextPosition - 1 && document.getChar(pos) == ')') { paren = scanner.findOpeningPeer(pos - 1, bound, '(', ')'); if (paren == JavaHeuristicScanner.NOT_FOUND) { break; } } else { break; } } catch (BadLocationException e) { break; } } int token = scanner.previousToken(paren - 1, bound); // constructor call of a parameterized type. if (token == Symbols.TokenIDENT) { return new TextSelection(document, paren, 0); } else if (token == Symbols.TokenGREATERTHAN) { // if it is the constructor of a parameterized type, then skip the type parameters to the type name int bracketBound = Math.max(-1, paren - 200); int bracket = scanner.findOpeningPeer(paren - 2, bracketBound, '<', '>'); if (bracket != JavaHeuristicScanner.NOT_FOUND) return new TextSelection(document, bracket, 0); } try { // see if we're right after a closing parenthesis (e.g. happens on content assist for a method without parameters) if (pos == contextPosition - 1 && document.getChar(pos) == ')') { paren = pos; } else { break; } } catch (BadLocationException e) { break; } pos = paren - 1; } while (true); return null; } /** * Tries to get a Java element out of the given element. * * @param element an object * @return the Java element represented by the given element or <code>null</code> */ private IJavaElement findJavaElement(Object element) { if (element == null) return null; IJavaElement je = null; if (element instanceof IAdaptable) je = ((IAdaptable) element).getAdapter(IJavaElement.class); if (je != null && je.exists()) return je; return null; } /** * Finds and returns the type for the given CU. * * @param cu the compilation unit * @return the type with same name as the given CU or the first type in the CU */ protected IType getTypeForCU(ICompilationUnit cu) { if (cu == null || !cu.exists()) return null; // Use primary type if possible IType primaryType = cu.findPrimaryType(); if (primaryType != null) return primaryType; // Use first top-level type try { IType[] types = cu.getTypes(); if (types.length > 0) return types[0]; else return null; } catch (JavaModelException ex) { return null; } } /* * @see IWorkbenchPart#dispose() */ @Override public final void dispose() { // cancel possible running computation fComputeCount++; if (fComputeProgressMonitor != null) fComputeProgressMonitor.setCanceled(true); getSite().getWorkbenchWindow().getPartService().removePartListener(fPartListener); ISelectionProvider provider = getSelectionProvider(); if (provider != null) provider.removeSelectionChangedListener(fCopyToClipboardAction); JFaceResources.getColorRegistry().removeListener(this); fBackgroundColorRGB = null; if (fBackgroundColor != null) { fBackgroundColor.dispose(); fBackgroundColor = null; } internalDispose(); } /* * @see IWorkbenchPart#dispose() */ protected abstract void internalDispose(); /** * Determines all necessary details and delegates the computation into * a background thread. * * @param part the workbench part */ private void computeAndSetInput(final IWorkbenchPart part) { computeAndDoSetInput(part, null, false); } /** * Sets the input for this view. * * @param element the java element */ public final void setInput(final IJavaElement element) { computeAndDoSetInput(null, element, false); } /** * Determines all necessary details and delegates the computation into * a background thread. One of part or element must be non-null. * * @param part the workbench part, or <code>null</code> if <code>element</code> not <code>null</code> * @param element the java element, or <code>null</code> if <code>part</code> not <code>null</code> * @param resetIfInvalid <code>true</code> if the view should be reset if the input is invalid, <code>false</code> otherwise */ private void computeAndDoSetInput(final IWorkbenchPart part, final IJavaElement element, final boolean resetIfInvalid) { Assert.isLegal(part != null || element != null); final int currentCount = ++fComputeCount; final ISelection selection; if (element != null) selection = null; else { ISelectionProvider provider = part.getSite().getSelectionProvider(); if (provider == null) return; selection = provider.getSelection(); if (// if selection is empty then we need to check if the current view input is valid. If not the view should be cleared selection == null) return; } if (fComputeProgressMonitor != null) fComputeProgressMonitor.setCanceled(true); final IProgressMonitor computeProgressMonitor = new NullProgressMonitor(); fComputeProgressMonitor = computeProgressMonitor; Thread thread = new //$NON-NLS-1$ Thread(//$NON-NLS-1$ "Info view input computer") { @Override public void run() { if (currentCount != fComputeCount) return; final IJavaElement je; if (element != null) je = element; else { je = findSelectedJavaElement(part, selection); if (isIgnoringNewInput(je, part, selection)) { // if the link image was broken due to the previous selection then correct it before returning updateLinkImage(false); return; } } // The actual computation final Object input = computeInput(part, selection, je, computeProgressMonitor); if (input == null && !resetIfInvalid && fCurrentViewInput != null) { IJavaElement oldElement = fCurrentViewInput; // update the link image only if the old view input was a valid one if (oldElement != null && oldElement.exists()) { Object oldInput = computeInput(null, null, oldElement, computeProgressMonitor); if (oldInput != null) { // leave the last shown documentation until it becomes invalid updateLinkImage(true); return; } } } final String description = //$NON-NLS-1$ input != null ? //$NON-NLS-1$ computeDescription(part, selection, je, computeProgressMonitor) : //$NON-NLS-1$ ""; Shell shell = getSite().getShell(); if (shell.isDisposed()) return; Display display = shell.getDisplay(); if (display.isDisposed()) return; display.asyncExec(new Runnable() { /* * @see java.lang.Runnable#run() */ @Override public void run() { if (fComputeCount != currentCount || getViewSite().getShell().isDisposed()) return; fCurrentViewInput = je; doSetInput(input, description); fToggleLinkAction.updateLinkImage(false); fComputeProgressMonitor = null; } }); } private void updateLinkImage(final boolean isBroken) { Shell shell = getSite().getShell(); if (shell.isDisposed()) return; Display display = shell.getDisplay(); if (display.isDisposed()) return; display.asyncExec(new Runnable() { /* * @see java.lang.Runnable#run() */ @Override public void run() { fToggleLinkAction.updateLinkImage(isBroken); } }); } }; thread.setDaemon(true); thread.setPriority(Thread.MIN_PRIORITY); thread.start(); } /** * Computes the contents description that will be displayed for the current element. * * @param part the part that triggered the current element update, or <code>null</code> * @param selection the new selection, or <code>null</code> * @param inputElement the new java element that will be displayed * @param localASTMonitor a progress monitor * @return the contents description for the provided <code>inputElement</code> * @since 3.4 */ protected String computeDescription(IWorkbenchPart part, ISelection selection, IJavaElement inputElement, IProgressMonitor localASTMonitor) { long flags; if (inputElement instanceof ILocalVariable) flags = LOCAL_VARIABLE_TITLE_FLAGS; else if (inputElement instanceof ITypeParameter) flags = TYPE_PARAMETER_TITLE_FLAGS; else flags = TITLE_FLAGS; return JavaElementLabels.getElementLabel(inputElement, flags); } private void doSetInput(Object input, String description) { doSetInput(input); boolean hasValidInput = input != null; fGotoInputAction.setEnabled(hasValidInput); IJavaElement inputElement = getOrignalInput(); //$NON-NLS-1$ String toolTip = hasValidInput && inputElement != null ? JavaElementLabels.getElementLabel(inputElement, TOOLTIP_LABEL_FLAGS) : ""; setContentDescription(description); setTitleToolTip(toolTip); } /** * Action to enable and disable link with selection. * * @since 3.4 in JavadocView, moved here in 3.9 */ protected LinkAction fToggleLinkAction; /** * Name of the link with selection icon when the view and selection is in sync. * * @since 3.9 */ //$NON-NLS-1$ private static final String SYNCED_GIF = "synced.png"; /** * Name of the link with selection icon when the view and selection is out of sync. * * @since 3.9 */ //$NON-NLS-1$ private static final String SYNC_BROKEN_GIF = "sync_broken.png"; /** * Action to toggle linking with selection. * * @since 3.4 in JavadocView, moved here in 3.9 */ private class LinkAction extends Action { private String fIconName; public LinkAction() { super(InfoViewMessages.LinkAction_label, SWT.TOGGLE); setToolTipText(InfoViewMessages.LinkAction_tooltip); setChecked(fLinking); } @Override public void run() { setLinkingEnabled(!fLinking); updateLinkImage(false); } public void updateLinkImage(boolean isBroken) { String iconName = isBroken ? SYNC_BROKEN_GIF : SYNCED_GIF; if (!iconName.equals(fIconName)) { JavaPluginImages.setLocalImageDescriptors(fToggleLinkAction, iconName); setToolTipText(isBroken ? InfoViewMessages.LinkAction_last_input_tooltip : InfoViewMessages.LinkAction_tooltip); fIconName = iconName; } } } }
3e03d50fb888aaf9c431c83c486c22602c4ea3ca
3,515
java
Java
dropwizard-validation/src/test/java/io/dropwizard/validation/SizeValidatorTest.java
boecko/dropwizard
ff878e10c7932aeccc6385fba7e860c864c81868
[ "Apache-2.0" ]
6,465
2015-01-01T21:42:36.000Z
2022-03-31T14:29:15.000Z
dropwizard-validation/src/test/java/io/dropwizard/validation/SizeValidatorTest.java
boecko/dropwizard
ff878e10c7932aeccc6385fba7e860c864c81868
[ "Apache-2.0" ]
3,340
2015-01-01T15:28:24.000Z
2022-03-31T21:17:04.000Z
dropwizard-validation/src/test/java/io/dropwizard/validation/SizeValidatorTest.java
boecko/dropwizard
ff878e10c7932aeccc6385fba7e860c864c81868
[ "Apache-2.0" ]
3,572
2015-01-02T22:34:31.000Z
2022-03-30T10:21:00.000Z
38.626374
113
0.632148
1,584
package io.dropwizard.validation; import io.dropwizard.util.Size; import io.dropwizard.util.SizeUnit; import org.junit.jupiter.api.Test; import javax.validation.Valid; import javax.validation.Validator; import java.util.Collections; import java.util.List; import java.util.Locale; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assumptions.assumeTrue; class SizeValidatorTest { @SuppressWarnings("unused") public static class Example { @MaxSize(value = 30, unit = SizeUnit.KILOBYTES) private Size tooBig = Size.gigabytes(2); @MinSize(value = 30, unit = SizeUnit.KILOBYTES) private Size tooSmall = Size.bytes(100); @SizeRange(min = 10, max = 100, unit = SizeUnit.KILOBYTES) private Size outOfRange = Size.megabytes(2); @Valid private List<@MaxSize(value = 30, unit = SizeUnit.KILOBYTES) Size> maxSize = Collections.singletonList(Size.gigabytes(2)); @Valid private List<@MinSize(value = 30, unit = SizeUnit.KILOBYTES) Size> minSize = Collections.singletonList(Size.bytes(100)); @Valid private List<@SizeRange(min = 10, max = 100, unit = SizeUnit.KILOBYTES) Size> rangeSize = Collections.singletonList(Size.megabytes(2)); public void setTooBig(Size tooBig) { this.tooBig = tooBig; } public void setTooSmall(Size tooSmall) { this.tooSmall = tooSmall; } public void setOutOfRange(Size outOfRange) { this.outOfRange = outOfRange; } public void setMaxSize(List<Size> maxSize) { this.maxSize = maxSize; } public void setMinSize(List<Size> minSize) { this.minSize = minSize; } public void setRangeSize(List<Size> rangeSize) { this.rangeSize = rangeSize; } } private final Validator validator = BaseValidator.newValidator(); @Test void returnsASetOfErrorsForAnObject() throws Exception { assumeTrue("en".equals(Locale.getDefault().getLanguage()), "This test executes when the defined language is English ('en'). If not, it is skipped."); assertThat(ConstraintViolations.format(validator.validate(new Example()))) .containsOnly("outOfRange must be between 10 KILOBYTES and 100 KILOBYTES", "tooBig must be less than or equal to 30 KILOBYTES", "tooSmall must be greater than or equal to 30 KILOBYTES", "maxSize[0].<list element> must be less than or equal to 30 KILOBYTES", "minSize[0].<list element> must be greater than or equal to 30 KILOBYTES", "rangeSize[0].<list element> must be between 10 KILOBYTES and 100 KILOBYTES"); } @Test void returnsAnEmptySetForAValidObject() throws Exception { final Example example = new Example(); example.setTooBig(Size.bytes(10)); example.setTooSmall(Size.megabytes(10)); example.setOutOfRange(Size.kilobytes(64)); example.setMaxSize(Collections.singletonList(Size.bytes(10))); example.setMinSize(Collections.singletonList(Size.megabytes(10))); example.setRangeSize(Collections.singletonList(Size.kilobytes(64))); assertThat(validator.validate(example)) .isEmpty(); } }
3e03d5190e3b81ef28a9f8f9cf1db4c3ac45b474
726
java
Java
src/main/java/com/rbc/shopping/repository/WishRepository.java
SaraParaDev/shopping
c8244dbb42e619e62004b7e00302ad929b2103e4
[ "Apache-2.0" ]
null
null
null
src/main/java/com/rbc/shopping/repository/WishRepository.java
SaraParaDev/shopping
c8244dbb42e619e62004b7e00302ad929b2103e4
[ "Apache-2.0" ]
null
null
null
src/main/java/com/rbc/shopping/repository/WishRepository.java
SaraParaDev/shopping
c8244dbb42e619e62004b7e00302ad929b2103e4
[ "Apache-2.0" ]
null
null
null
25.928571
79
0.72314
1,585
package com.rbc.shopping.repository; import com.rbc.shopping.entity.Wish; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.util.List; /** * Repository class for WISH table. * * @author SARA */ @Repository public interface WishRepository extends JpaRepository<Wish, Long> { /** * Finds and returns list of Wishes based on the User Id. * * @param userId long representing User Id. * @return Returns set of Wish list for the User. */ @Query(value = "SELECT * FROM WISH WHERE user_id = ?1", nativeQuery = true) List<Wish> findWishByUserId(Long userId); }
3e03d5f7a97a7faf59578e840fb79f7234b394b3
5,688
java
Java
runescape-client/src/main/java/ArchiveDiskActionHandler.java
umer-rs/runelite
8ec3d5397a35ffd3a1acb5b0d5af2b4378729934
[ "BSD-2-Clause" ]
4
2022-03-11T19:45:58.000Z
2022-03-27T20:29:20.000Z
runescape-client/src/main/java/ArchiveDiskActionHandler.java
umer-rs/runelite
8ec3d5397a35ffd3a1acb5b0d5af2b4378729934
[ "BSD-2-Clause" ]
5
2022-02-24T14:32:28.000Z
2022-03-15T15:07:44.000Z
runescape-client/src/main/java/ArchiveDiskActionHandler.java
umer-rs/runelite
8ec3d5397a35ffd3a1acb5b0d5af2b4378729934
[ "BSD-2-Clause" ]
11
2022-02-19T06:06:38.000Z
2022-03-22T23:42:11.000Z
26.830189
279
0.604958
1,586
import java.io.DataInputStream; import java.net.URL; import net.runelite.mapping.Export; import net.runelite.mapping.Implements; import net.runelite.mapping.ObfuscatedGetter; import net.runelite.mapping.ObfuscatedName; import net.runelite.mapping.ObfuscatedSignature; @ObfuscatedName("lf") @Implements("ArchiveDiskActionHandler") public class ArchiveDiskActionHandler implements Runnable { @ObfuscatedName("o") @ObfuscatedSignature( descriptor = "Llv;" ) @Export("ArchiveDiskActionHandler_requestQueue") public static NodeDeque ArchiveDiskActionHandler_requestQueue; @ObfuscatedName("q") @ObfuscatedSignature( descriptor = "Llv;" ) @Export("ArchiveDiskActionHandler_responseQueue") public static NodeDeque ArchiveDiskActionHandler_responseQueue; @ObfuscatedName("l") @ObfuscatedGetter( intValue = 996764791 ) static int field3998; @ObfuscatedName("k") @Export("ArchiveDiskActionHandler_lock") static Object ArchiveDiskActionHandler_lock; @ObfuscatedName("nc") @ObfuscatedGetter( intValue = 1167654825 ) @Export("selectedSpellWidget") static int selectedSpellWidget; static { ArchiveDiskActionHandler_requestQueue = new NodeDeque(); // L: 9 ArchiveDiskActionHandler_responseQueue = new NodeDeque(); // L: 10 field3998 = 0; // L: 11 ArchiveDiskActionHandler_lock = new Object(); } // L: 12 ArchiveDiskActionHandler() { } // L: 15 public void run() { try { while (true) { ArchiveDiskAction var1; synchronized(ArchiveDiskActionHandler_requestQueue) { // L: 63 var1 = (ArchiveDiskAction)ArchiveDiskActionHandler_requestQueue.last(); // L: 64 } if (var1 != null) { // L: 66 if (var1.type == 0) { var1.archiveDisk.write((int)var1.key, var1.data, var1.data.length); // L: 68 synchronized(ArchiveDiskActionHandler_requestQueue) { var1.remove(); // L: 70 } // L: 71 } else if (var1.type == 1) { var1.data = var1.archiveDisk.read((int)var1.key); synchronized(ArchiveDiskActionHandler_requestQueue) { // L: 75 ArchiveDiskActionHandler_responseQueue.addFirst(var1); // L: 76 } } synchronized(ArchiveDiskActionHandler_lock) { if (field3998 <= 1) { // L: 80 field3998 = 0; // L: 81 ArchiveDiskActionHandler_lock.notifyAll(); return; // L: 83 } field3998 = 600; // L: 85 } } else { class241.method4815(100L); // L: 89 synchronized(ArchiveDiskActionHandler_lock) { if (field3998 <= 1) { field3998 = 0; ArchiveDiskActionHandler_lock.notifyAll(); return; } --field3998; } } } } catch (Exception var13) { // L: 101 RunException_sendStackTrace((String)null, var13); // L: 102 } } // L: 104 @ObfuscatedName("o") @ObfuscatedSignature( descriptor = "(Ljava/lang/String;Ljava/lang/Throwable;B)V", garbageValue = "9" ) @Export("RunException_sendStackTrace") public static void RunException_sendStackTrace(String var0, Throwable var1) { if (var1 != null) { var1.printStackTrace(); } else { try { String var2 = ""; // L: 33 if (var1 != null) { // L: 34 var2 = class427.method7379(var1); } if (var0 != null) { // L: 35 if (var1 != null) { var2 = var2 + " | "; } var2 = var2 + var0; } System.out.println("Error: " + var2); // L: 39 var2 = var2.replace(':', '.'); // L: 40 var2 = var2.replace('@', '_'); var2 = var2.replace('&', '_'); // L: 42 var2 = var2.replace('#', '_'); if (RunException.RunException_applet == null) { // L: 44 return; } URL var3 = new URL(RunException.RunException_applet.getCodeBase(), "clienterror.ws?c=" + class385.RunException_revision + "&u=" + RunException.localPlayerName + "&v1=" + TaskHandler.javaVendor + "&v2=" + TaskHandler.javaVersion + "&ct=" + class430.clientType + "&e=" + var2); DataInputStream var4 = new DataInputStream(var3.openStream()); // L: 46 var4.read(); var4.close(); // L: 48 } catch (Exception var5) { // L: 50 } } } @ObfuscatedName("q") @ObfuscatedSignature( descriptor = "(Ljava/lang/CharSequence;Lpj;B)Ljava/lang/String;", garbageValue = "-25" ) public static String method5612(CharSequence var0, LoginType var1) { if (var0 == null) { // L: 36 return null; } else { int var2 = 0; // L: 37 int var3; boolean var4; char var5; for (var3 = var0.length(); var2 < var3; ++var2) { // L: 38 41 51 var5 = var0.charAt(var2); // L: 43 var4 = var5 == 160 || var5 == ' ' || var5 == '_' || var5 == '-'; // L: 45 if (!var4) { // L: 47 break; } } while (var3 > var2) { // L: 55 var5 = var0.charAt(var3 - 1); // L: 57 var4 = var5 == 160 || var5 == ' ' || var5 == '_' || var5 == '-'; // L: 59 if (!var4) { // L: 61 break; } --var3; // L: 65 } int var10 = var3 - var2; // L: 67 if (var10 >= 1) { // L: 69 byte var6; if (var1 == null) { // L: 73 var6 = 12; // L: 74 } else { switch(var1.field4617) { // L: 77 case 0: var6 = 20; // L: 82 break; default: var6 = 12; // L: 79 } } if (var10 <= var6) { // L: 86 StringBuilder var9 = new StringBuilder(var10); // L: 90 for (int var11 = var2; var11 < var3; ++var11) { // L: 91 char var7 = var0.charAt(var11); // L: 92 if (BufferedSource.method6702(var7)) { // L: 93 char var8 = Language.method5877(var7); // L: 94 if (var8 != 0) { // L: 95 var9.append(var8); // L: 96 } } } if (var9.length() == 0) { // L: 98 return null; } return var9.toString(); // L: 99 } } return null; // L: 88 } } }
3e03d6083f0de75b41ef358c3b7744213bb0c336
4,818
java
Java
sdk/scheduler/src/test/java/com/mesosphere/sdk/debug/TaskReservationsTrackerTest.java
r2dedios/dcos-commons
49d7408ed62927f8d13c59df1aa939033fb7425f
[ "Apache-2.0" ]
201
2016-06-02T21:07:21.000Z
2021-03-31T06:15:37.000Z
sdk/scheduler/src/test/java/com/mesosphere/sdk/debug/TaskReservationsTrackerTest.java
r2dedios/dcos-commons
49d7408ed62927f8d13c59df1aa939033fb7425f
[ "Apache-2.0" ]
1,679
2016-06-06T17:32:26.000Z
2021-04-30T20:44:30.000Z
sdk/scheduler/src/test/java/com/mesosphere/sdk/debug/TaskReservationsTrackerTest.java
r2dedios/dcos-commons
49d7408ed62927f8d13c59df1aa939033fb7425f
[ "Apache-2.0" ]
231
2016-06-09T21:40:22.000Z
2022-02-14T13:41:44.000Z
43.8
119
0.742217
1,587
package com.mesosphere.sdk.debug; import com.mesosphere.sdk.offer.taskdata.TaskLabelWriter; import com.mesosphere.sdk.scheduler.SchedulerUtils; import com.mesosphere.sdk.state.StateStore; import com.mesosphere.sdk.storage.MemPersister; import com.mesosphere.sdk.testutils.*; import org.apache.mesos.Protos; import org.junit.Assert; import org.junit.Before; //import org.junit.Test; import org.mockito.MockitoAnnotations; import java.util.*; /** * This class tests the {@link TaskReservationsTracker} class */ public class TaskReservationsTrackerTest extends DefaultCapabilitiesTestSuite { private static final String RESERVED_RESOURCE_1_ID = "resource-1"; private static final String RESERVED_RESOURCE_2_ID = "resource-2"; private static final String RESERVED_RESOURCE_3_ID = "resource-3"; private static final String RESERVED_RESOURCE_4_ID = "resource-4"; private static final String RESERVED_RESOURCE_5_ID = "resource-5"; private static final String RESERVED_RESOURCE_6_ID = "resource-6"; private static final String RESERVED_RESOURCE_7_ID = "resource-7"; private static final String RESERVED_RESOURCE_8_ID = "resource-8"; private static final Protos.Resource RESERVED_RESOURCE_1 = ResourceTestUtils.getReservedPorts(123, 234, RESERVED_RESOURCE_1_ID); private static final Protos.Resource RESERVED_RESOURCE_2 = ResourceTestUtils.getReservedRootVolume(999.0, RESERVED_RESOURCE_2_ID, RESERVED_RESOURCE_2_ID); private static final Protos.Resource RESERVED_RESOURCE_3 = ResourceTestUtils.getReservedCpus(1.0, RESERVED_RESOURCE_3_ID); private static final Protos.Resource RESERVED_RESOURCE_4 = ResourceTestUtils.getReservedCpus(1.0, RESERVED_RESOURCE_4_ID); private static final Protos.Resource RESERVED_RESOURCE_5 = ResourceTestUtils.getReservedCpus(2.0, RESERVED_RESOURCE_5_ID); private static final Protos.Resource RESERVED_RESOURCE_6 = ResourceTestUtils.getReservedCpus(3.0, RESERVED_RESOURCE_6_ID); private static final Protos.Resource RESERVED_RESOURCE_7 = ResourceTestUtils.getReservedCpus(4.0, RESERVED_RESOURCE_7_ID); private static final Protos.Resource RESERVED_RESOURCE_8 = ResourceTestUtils.getReservedPorts(456, 456, RESERVED_RESOURCE_8_ID); private static final Protos.TaskInfo TASK_A; private static final Protos.TaskInfo TASK_B; private static final Protos.TaskInfo TASK_C; static { Protos.TaskInfo.Builder builderA = Protos.TaskInfo.newBuilder( TaskTestUtils.getTaskInfo(Arrays.asList(RESERVED_RESOURCE_1, RESERVED_RESOURCE_3, RESERVED_RESOURCE_5))); builderA.setLabels(new TaskLabelWriter(builderA) .setHostname(OfferTestUtils.getEmptyOfferBuilder().setHostname("host-1").build()) .toProto()) .setName("Task_A"); TASK_A = builderA.build(); Protos.TaskInfo.Builder builderB = Protos.TaskInfo.newBuilder( TaskTestUtils.getTaskInfo(Arrays.asList(RESERVED_RESOURCE_2, RESERVED_RESOURCE_4, RESERVED_RESOURCE_6))); builderB.setLabels(new TaskLabelWriter(builderB) .setHostname(OfferTestUtils.getEmptyOfferBuilder().setHostname("host-2").build()) .toProto()) .setName("Task_B"); TASK_B = builderB.build(); Protos.TaskInfo.Builder builderC = Protos.TaskInfo.newBuilder( TaskTestUtils.getTaskInfo(Arrays.asList(RESERVED_RESOURCE_7, RESERVED_RESOURCE_8))); builderC.setLabels(new TaskLabelWriter(builderC) .setHostname(OfferTestUtils.getEmptyOfferBuilder().setHostname("host-2").build()) .toProto()) .setName("Task_C"); TASK_C = builderC.build(); } private StateStore stateStore; @Before public void beforeEach() throws Exception { MockitoAnnotations.initMocks(this); stateStore = new StateStore(MemPersister.newBuilder().build()); stateStore.storeTasks(Arrays.asList(TASK_A, TASK_B, TASK_C)); } /* * This test is a simplified version of {@link UninstallSchedulerTest} */ //@Test public void testReservationTracker() { Map<String, Set<String>> resourceIdsByAgentHost = SchedulerUtils.getResourceIdsByAgentHost(stateStore); Assert.assertTrue(resourceIdsByAgentHost.keySet().containsAll(Arrays.asList("host-1", "host-2"))); Assert.assertTrue(resourceIdsByAgentHost.get("host-1").containsAll( Arrays.asList( RESERVED_RESOURCE_1_ID, RESERVED_RESOURCE_3_ID, RESERVED_RESOURCE_5_ID))); Assert.assertTrue(resourceIdsByAgentHost.get("host-2").containsAll( Arrays.asList( RESERVED_RESOURCE_2_ID, RESERVED_RESOURCE_4_ID, RESERVED_RESOURCE_6_ID, RESERVED_RESOURCE_7_ID, RESERVED_RESOURCE_8_ID))); } }
3e03d6678a6924c47dfa252c2b653371b529002d
330
java
Java
Typecasting/first.java
FeurialBlack/Edac-May2021
6af61c20705d4ceae1771acb1ed508117478f342
[ "MIT" ]
null
null
null
Typecasting/first.java
FeurialBlack/Edac-May2021
6af61c20705d4ceae1771acb1ed508117478f342
[ "MIT" ]
null
null
null
Typecasting/first.java
FeurialBlack/Edac-May2021
6af61c20705d4ceae1771acb1ed508117478f342
[ "MIT" ]
null
null
null
19.411765
50
0.518182
1,588
import java.util.*; public class first { public static void main(String args[]) { byte x; int a =270; double b= 128.128; x = (byte)a; System.out.println("a and x : " + a + " " + x); a = (int)b; System.out.println("b and a : " + b + " " + a ); x = (byte)b; System.out.println("b and x : " + b + " " + x ); } }
3e03d6c362281dc41711cae406cdf2c0d471c001
689
java
Java
etl-tests/src/main/java/design/singletonpattern/ServiceLoader.java
joshluisaac/etl-framework
3561477d5db3abb02a05473adb5a1f62acadcf32
[ "BSD-3-Clause" ]
null
null
null
etl-tests/src/main/java/design/singletonpattern/ServiceLoader.java
joshluisaac/etl-framework
3561477d5db3abb02a05473adb5a1f62acadcf32
[ "BSD-3-Clause" ]
null
null
null
etl-tests/src/main/java/design/singletonpattern/ServiceLoader.java
joshluisaac/etl-framework
3561477d5db3abb02a05473adb5a1f62acadcf32
[ "BSD-3-Clause" ]
1
2018-03-28T06:21:18.000Z
2018-03-28T06:21:18.000Z
23.758621
100
0.741655
1,589
package design.singletonpattern; //maintains a static reference to the lone singleton instance //returns that reference from the static getInstance() method //explicitly declared as final because constructor is private and therefore it cannot be sub-classed public final class ServiceLoader { //maintains a static reference to the lone singleton instance private static ServiceLoader servLoad; private ServiceLoader(){ System.out.println("Instance created"); } //returns a reference to ServiceLoader public static synchronized ServiceLoader getInstance(){ if(servLoad == null){ servLoad = new ServiceLoader(); } return servLoad; } }
3e03d6c6517a687abd5f0800cc703a31a39ddffb
16,049
java
Java
frameworks/opt/ngin3d/tests/src/com/mediatek/ngin3d/tests/ContainerTest.java
touxiong88/92_mediatek
5e96a7bb778fd9d9b335825584664e0c8b5ff2c7
[ "Apache-2.0" ]
1
2022-01-07T01:53:19.000Z
2022-01-07T01:53:19.000Z
frameworks/opt/ngin3d/tests/src/com/mediatek/ngin3d/tests/ContainerTest.java
touxiong88/92_mediatek
5e96a7bb778fd9d9b335825584664e0c8b5ff2c7
[ "Apache-2.0" ]
null
null
null
frameworks/opt/ngin3d/tests/src/com/mediatek/ngin3d/tests/ContainerTest.java
touxiong88/92_mediatek
5e96a7bb778fd9d9b335825584664e0c8b5ff2c7
[ "Apache-2.0" ]
1
2020-02-28T02:48:42.000Z
2020-02-28T02:48:42.000Z
36.39229
108
0.650819
1,590
/* Copyright Statement: * * This software/firmware and related documentation ("MediaTek Software") are * protected under relevant copyright laws. The information contained herein is * confidential and proprietary to MediaTek Inc. and/or its licensors. Without * the prior written permission of MediaTek inc. and/or its licensors, any * reproduction, modification, use or disclosure of MediaTek Software, and * information contained herein, in whole or in part, shall be strictly * prohibited. * * MediaTek Inc. (C) 2010. All rights reserved. * * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. * * The following software/firmware and/or related documentation ("MediaTek * Software") have been modified by MediaTek Inc. All revisions are subject to * any receiver's applicable license agreements with MediaTek Inc. */ package com.mediatek.ngin3d.tests; import android.test.suitebuilder.annotation.SmallTest; import com.mediatek.ngin3d.Actor; import com.mediatek.ngin3d.Color; import com.mediatek.ngin3d.Container; import com.mediatek.ngin3d.Empty; import com.mediatek.ngin3d.Image; import com.mediatek.ngin3d.Plane; import com.mediatek.ngin3d.Point; import com.mediatek.ngin3d.Text; import java.util.Random; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.FutureTask; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; public class ContainerTest extends Ngin3dInstrumentationTestCase { Container mContainer; @Override protected void setUp() throws Exception { super.setUp(); mContainer = new Container(); mStage.add(mContainer); } @Override protected void tearDown() throws Exception { mStage.removeAll(); super.tearDown(); } @SmallTest public void testBasics() throws ExecutionException, InterruptedException { final Container container = new Container(); Text text = new Text(); Actor empty = new Empty(); container.add(text); container.add(empty); assertEquals(2, container.getChildrenCount()); assertSame(text, container.<Actor>getChild(0)); container.<Text>getChild(0).setText("First"); assertEquals("First", text.getText()); assertSame(empty, container.<Actor>getChild(1)); empty.setPosition(new Point(1, 1, 1)); assertEquals(new Point(1, 1, 1), container.<Empty>getChild(1).getPosition()); FutureTask<Boolean> task = new FutureTask<Boolean>(new Callable<Boolean>() { public Boolean call() { container.realize(mPresentationEngine); return true; } }); mStageView.runInGLThread(task); assertTrue("The test runs successfully", task.get()); assertFalse("Container should not be dirty after realized", container.isDirty()); assertFalse("Text should not be dirty after its container is realized", text.isDirty()); assertFalse("Actor should not be dirty after its container is realized", empty.isDirty()); Container container2 = new Container(); container.add(container2); task = new FutureTask<Boolean>(new Callable<Boolean>() { public Boolean call() { container.realize(mPresentationEngine); return true; } }); mStageView.runInGLThread(task); assertTrue("The test runs successfully", task.get()); assertFalse("Container should not be dirty after its container is realized", container2.isDirty()); } @SmallTest public void testAddRemove() { Actor actor = Image.createEmptyImage(); mContainer.add(actor); assertEquals(mContainer.getChildren().size(), 1); mContainer.remove(actor); assertEquals(mContainer.getChildren().size(), 0); // Can add duplicate actor? // Can add null actor? // Will throw exception when actor to remove does not exist? } @SmallTest public void testAddNull() { Empty empty = new Empty(); mContainer.add(empty, null); assertEquals(1, mContainer.getChildren().size()); } @SmallTest public void testAddAgain() { Actor actor = Image.createEmptyImage(); mContainer.add(actor); mContainer.remove(actor); mContainer.add(actor); } @SmallTest public void testFind() { Container childContainer1 = new Container(); Container childContainer2 = new Container(); Container childContainer3 = new Container(); Actor grandchild1 = Image.createEmptyImage(); Actor grandchild2 = Image.createEmptyImage(); Actor grandchild3 = Image.createEmptyImage(); mContainer.add(childContainer1); mContainer.add(childContainer2); mContainer.add(childContainer3); childContainer1.add(grandchild1); childContainer2.add(grandchild2); childContainer3.add(grandchild3); childContainer1.setName("childContainer1"); childContainer2.setName("childContainer2"); childContainer3.setName("childContainer3"); grandchild1.setName("granchild1"); grandchild2.setName("granchild2"); grandchild3.setName("granchild3"); Actor foundChild = mContainer.findChildByName(childContainer1.getName()); assertEquals(childContainer1, foundChild); foundChild = mContainer.findChildByName(childContainer1.getName(), Container.BREADTH_FIRST_SEARCH); assertEquals(childContainer1, foundChild); Actor foundGrandchild = mContainer.findChildByName(grandchild1.getName()); assertEquals(null, foundGrandchild); foundGrandchild = mContainer.findChildByName(grandchild1.getName(), Container.BREADTH_FIRST_SEARCH); assertEquals(grandchild1, foundGrandchild); childContainer1.setTag(100); childContainer2.setTag(200); childContainer3.setTag(300); grandchild1.setTag(110); grandchild2.setTag(220); grandchild3.setTag(330); foundChild = mContainer.findChildByTag(100); assertEquals(childContainer1, foundChild); foundChild = mContainer.findChildByTag(100, Container.BREADTH_FIRST_SEARCH); assertEquals(childContainer1, foundChild); foundChild = mContainer.findChildByTag(100, Container.DEPTH_FIRST_SEARCH); assertEquals(childContainer1, foundChild); foundChild = mContainer.findChildByTag(110); assertEquals(null, foundChild); foundChild = mContainer.findChildByTag(110, Container.BREADTH_FIRST_SEARCH); assertEquals(grandchild1, foundChild); foundChild = mContainer.findChildByTag(110, Container.DEPTH_FIRST_SEARCH); assertEquals(grandchild1, foundChild); foundChild = mContainer.findChildByTag(220); assertEquals(null, foundChild); foundChild = mContainer.findChildByTag(220, Container.BREADTH_FIRST_SEARCH); assertEquals(grandchild2, foundChild); foundChild = mContainer.findChildByTag(220, Container.DEPTH_FIRST_SEARCH); assertEquals(grandchild2, foundChild); foundChild = mContainer.findChildByTag(330); assertEquals(null, foundChild); foundChild = mContainer.findChildByTag(330, Container.BREADTH_FIRST_SEARCH); assertEquals(grandchild3, foundChild); foundChild = mContainer.findChildByTag(330, Container.DEPTH_FIRST_SEARCH); assertEquals(grandchild3, foundChild); grandchild3.setTag(200); foundChild = mContainer.findChildByTag(200); assertEquals(childContainer2, foundChild); foundChild = mContainer.findChildByTag(200, Container.BREADTH_FIRST_SEARCH); assertEquals(childContainer2, foundChild); foundChild = mContainer.findChildByTag(200, Container.DEPTH_FIRST_SEARCH); assertEquals(grandchild3, foundChild); assertEquals(3, mContainer.getChildrenCount()); assertEquals(6, mContainer.getDescendantCount()); } @SmallTest public void testRaise() { Actor actor1 = Image.createEmptyImage(); mContainer.add(actor1); Actor actor2 = Image.createEmptyImage(); mContainer.add(actor2); assertEquals(mContainer.getChildren().get(0), actor1); assertEquals(mContainer.getChildren().get(1), actor2); mContainer.raise(actor1, actor2); assertEquals(mContainer.getChildren().get(0), actor2); assertEquals(mContainer.getChildren().get(1), actor1); mContainer.remove(actor1); try { mContainer.raise(actor2, actor1); fail("IllegalArgumentException expected."); } catch (IllegalArgumentException e) { // expected } try { mContainer.raise(actor1, actor2); fail("IllegalArgumentException expected."); } catch (IllegalArgumentException e) { // expected } } @SmallTest public void testLower() { Actor actor1 = Image.createEmptyImage(); mContainer.add(actor1); Actor actor2 = Image.createEmptyImage(); mContainer.add(actor2); Actor actor3 = Image.createEmptyImage(); mContainer.add(actor3); mContainer.lower(actor3, actor2); assertEquals(mContainer.getChildren().get(0), actor1); assertEquals(mContainer.getChildren().get(1), actor3); assertEquals(mContainer.getChildren().get(2), actor2); mContainer.remove(actor3); try { mContainer.lower(actor2, actor3); fail("IllegalArgumentException expected."); } catch (IllegalArgumentException e) { // expected } try { mContainer.lower(actor3, actor2); fail("IllegalArgumentException expected."); } catch (IllegalArgumentException e) { // expected } } @SmallTest public void testGetChild() { Actor actor1 = Image.createEmptyImage(); mContainer.add(actor1); Actor actor2 = Image.createEmptyImage(); mContainer.add(actor2); assertEquals(mContainer.getChild(0), actor1); assertEquals(mContainer.getChild(1), actor2); } @SmallTest public void testRealize() throws ExecutionException, InterruptedException { FutureTask<Boolean> task = new FutureTask<Boolean>(new Callable<Boolean>() { public Boolean call() { mContainer.realize(mPresentationEngine); return true; } }); mStageView.runInGLThread(task); assertTrue("The test runs successfully", task.get()); assertTrue("Container should be realized successfully", mContainer.isRealized()); } @SmallTest public void testPosition() throws ExecutionException, InterruptedException { mContainer.setPosition(new Point(100.f, 100.f)); FutureTask<Boolean> task = new FutureTask<Boolean>(new Callable<Boolean>() { public Boolean call() { mContainer.realize(mPresentationEngine); return true; } }); mStageView.runInGLThread(task); assertTrue("The test runs successfully", task.get()); Point pos = mContainer.getPresentation().getPosition(false); assertEquals(100f, pos.x); assertEquals(100f, pos.y); } @SmallTest public void testGetChildrenCount() { Actor actor1 = Image.createEmptyImage(); mContainer.add(actor1); assertEquals(mContainer.getChildrenCount(), 1); Actor actor2 = Image.createEmptyImage(); mContainer.add(actor2); assertEquals(mContainer.getChildrenCount(), 2); } @SmallTest public void testRemoveAllChildren() { Actor actor1 = Image.createEmptyImage(); mContainer.add(actor1); Actor actor2 = Image.createEmptyImage(); mContainer.add(actor2); Actor actor3 = Image.createEmptyImage(); mContainer.add(actor3); assertEquals(mContainer.getChildren().get(0), actor1); assertEquals(mContainer.getChildren().get(1), actor2); assertEquals(mContainer.getChildren().get(2), actor3); mContainer.removeAll(); assertEquals(mContainer.getChildrenCount(), 0); } /** * The same test is done in PresentationTest while the presentation tree is realized. */ @SmallTest public void testMultiThreadAccess() { final Random rnd = new Random(System.currentTimeMillis()); Thread[] threads = new Thread[10]; for (int i = 0; i < threads.length; ++i) { threads[i] = new Thread(new Runnable() { public void run() { for (int j = 0; j < 200; ++j) { try { Thread.sleep(rnd.nextInt(10)); } catch (InterruptedException e) { e.printStackTrace(); return; } Actor a = new Empty(); mContainer.add(a); mContainer.getChildrenCount(); mContainer.getChild(0); mContainer.remove(a); } } }); threads[i].start(); } for (int i = 0; i < threads.length; ++i) { try { threads[i].join(); } catch (InterruptedException e) { e.printStackTrace(); } } assertEquals(0, mContainer.getChildrenCount()); } public void testOpacity() { Plane a = new Plane(); a.setOpacity(100); mContainer.add(a); mContainer.setOpacity(150); assertThat(a.getOpacity(), is(100)); } public void testColor() { Plane a = new Plane(); a.setColor(new Color(100, 100, 100)); mContainer.add(a); mContainer.setColor(new Color(150, 150, 150)); assertThat(a.getColor().red, is(150)); } public void testFindChildByTag() { Actor a = Image.createEmptyImage(); a.setTag(10); mContainer.add(a); assertEquals(a, mContainer.findChildByTag(10)); } public void testFindChildById() { Actor a = Image.createEmptyImage(); a.setTag(1001); mContainer.add(a); int id = a.getId(); assertEquals(a.getTag(), mContainer.findChildById(id).getTag()); } }
3e03d6e6b03c170d6f90ec8276e8d43ec2bbc4cf
796
java
Java
disconf-web/src/main/java/com/disconf/web/mapper/UserRoleEntityMapper.java
hqq2023623/mydisconf
c3a46e26243ce50a296aa8d9f1668b0294b0f30d
[ "Apache-2.0" ]
null
null
null
disconf-web/src/main/java/com/disconf/web/mapper/UserRoleEntityMapper.java
hqq2023623/mydisconf
c3a46e26243ce50a296aa8d9f1668b0294b0f30d
[ "Apache-2.0" ]
null
null
null
disconf-web/src/main/java/com/disconf/web/mapper/UserRoleEntityMapper.java
hqq2023623/mydisconf
c3a46e26243ce50a296aa8d9f1668b0294b0f30d
[ "Apache-2.0" ]
null
null
null
24.121212
71
0.782663
1,591
package com.disconf.web.mapper; import com.disconf.web.entity.UserRoleEntity; import java.util.List; import java.util.Map; public interface UserRoleEntityMapper { int deleteByPrimaryKey(Long id); int insert(UserRoleEntity record); int insertSelective(UserRoleEntity record); UserRoleEntity selectByPrimaryKey(Long id); int updateByPrimaryKeySelective(UserRoleEntity record); int updateByPrimaryKey(UserRoleEntity record); int updateUserRoleByRoleId(UserRoleEntity userRole); int updateUserRoleByUserId(UserRoleEntity userRole); List<UserRoleEntity> getRoleListByUserId(long id); List<UserRoleEntity> getRoleListByRoleId(long id); List<UserRoleEntity> selectAll(); UserRoleEntity getUserRoleByUserIdAndRoleId(Map<String, Long> map); }
3e03d6e8ef23615d0d346df80d47acaf225054ce
1,281
java
Java
app/src/main/java/com/android/abhishek/megamovies/model/ReviewResults.java
abHiShek2k16/MegaShow
5b1a51c50cb991b9ed717a774cd19f6a0340fefb
[ "MIT" ]
null
null
null
app/src/main/java/com/android/abhishek/megamovies/model/ReviewResults.java
abHiShek2k16/MegaShow
5b1a51c50cb991b9ed717a774cd19f6a0340fefb
[ "MIT" ]
null
null
null
app/src/main/java/com/android/abhishek/megamovies/model/ReviewResults.java
abHiShek2k16/MegaShow
5b1a51c50cb991b9ed717a774cd19f6a0340fefb
[ "MIT" ]
1
2018-10-27T22:55:02.000Z
2018-10-27T22:55:02.000Z
22.875
87
0.644028
1,592
package com.android.abhishek.megamovies.model; import android.os.Parcel; import android.os.Parcelable; import com.google.gson.annotations.SerializedName; public class ReviewResults implements Parcelable{ @SerializedName(EndPoint.AUTHOR) private String author; @SerializedName(EndPoint.CONTENT) private String content; public ReviewResults(String author, String content) { this.author = author; this.content = content; } private ReviewResults(Parcel in) { author = in.readString(); content = in.readString(); } public static final Creator<ReviewResults> CREATOR = new Creator<ReviewResults>() { @Override public ReviewResults createFromParcel(Parcel in) { return new ReviewResults(in); } @Override public ReviewResults[] newArray(int size) { return new ReviewResults[size]; } }; public String getAuthor() { return author; } public String getContent() { return content; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel parcel, int i) { parcel.writeString(author); parcel.writeString(content); } }
3e03d7583ad1a279cdc43c55ee3f7390e6f410fb
1,179
java
Java
gedbrowserng/src/main/java/org/schoellerfamily/gedbrowser/api/controller/HeadController.java
dickschoeller/gedbrowser
eb15573af066550c7c73b37aeb2b6a1a201ae8ca
[ "Apache-2.0" ]
1
2021-09-24T19:18:41.000Z
2021-09-24T19:18:41.000Z
gedbrowserng/src/main/java/org/schoellerfamily/gedbrowser/api/controller/HeadController.java
dickschoeller/gedbrowser
eb15573af066550c7c73b37aeb2b6a1a201ae8ca
[ "Apache-2.0" ]
891
2016-02-22T02:21:32.000Z
2022-03-02T03:45:50.000Z
gedbrowserng/src/main/java/org/schoellerfamily/gedbrowser/api/controller/HeadController.java
dickschoeller/gedbrowser
eb15573af066550c7c73b37aeb2b6a1a201ae8ca
[ "Apache-2.0" ]
2
2019-07-16T00:21:02.000Z
2022-02-19T04:04:04.000Z
32.75
75
0.728584
1,593
package org.schoellerfamily.gedbrowser.api.controller; import org.schoellerfamily.gedbrowser.api.crud.HeadCrud; import org.schoellerfamily.gedbrowser.api.crud.ObjectCrud; import org.schoellerfamily.gedbrowser.api.datamodel.ApiHead; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.ResponseBody; /** * @author Dick Schoeller */ @CrossOrigin(origins = { "http://largo.schoellerfamily.org:4200", "http://localhost:4200" }) @Controller public class HeadController extends CrudInvoker { /** * @return the CRUD object for manipulating the DB header */ private ObjectCrud<ApiHead> crud() { return new HeadCrud(getLoader(), getConverter(), getManager()); } /** * @param db the name of the db to access * @return the list of sources */ @GetMapping(value = "/v1/dbs/{db}") @ResponseBody public ApiHead read(@PathVariable final String db) { return crud().readOne(db, ""); } }
3e03d77c7cb90d3c6176186ba91b693a5e1ba9ab
2,388
java
Java
stop-boot-admin/src/main/java/com/stopboot/admin/model/help/generator/GeneratorInfo.java
yutaolian/stop-boot
b5fe00fd47b73d4cc4ae00994f950ee65d043048
[ "Apache-2.0" ]
5
2019-10-25T11:13:36.000Z
2021-01-30T09:14:38.000Z
stop-boot-admin/src/main/java/com/stopboot/admin/model/help/generator/GeneratorInfo.java
yutaolian/stop-boot
b5fe00fd47b73d4cc4ae00994f950ee65d043048
[ "Apache-2.0" ]
4
2020-09-07T07:36:19.000Z
2022-02-18T07:42:11.000Z
stop-boot-admin/src/main/java/com/stopboot/admin/model/help/generator/GeneratorInfo.java
yutaolian/stop-boot
b5fe00fd47b73d4cc4ae00994f950ee65d043048
[ "Apache-2.0" ]
2
2019-10-17T12:30:26.000Z
2020-03-06T03:51:43.000Z
16.468966
77
0.609715
1,594
package com.stopboot.admin.model.help.generator; import com.stopboot.admin.model.help.datasource.table.columns.TableColumnsVO; import com.stopboot.admin.model.help.generator.pre.MenuInfoVO; import lombok.Data; import java.io.Serializable; import java.util.Date; import java.util.List; import java.util.Map; /** * @description: 基本信息 * @author: Lianyutao * @create: 2019-10-16 21:20 * @version: **/ @Data public class GeneratorInfo implements Serializable { /** * 默认代码输出路径 */ private String defaultGeneratorPath; private String currentType; private String menuComponent; /** * 菜单ID */ private Integer menuId; /** * 菜单标题 */ private String title; private String fullPath; private String fullPathToPermission; private String fullPathToPackage; private String path; /** * 基础包名转为带斜线的路径 */ private String basePackageToPath; /** * 模块名 */ private String model; private Date date; /** * 项目名称 */ private String author; /** * 项目名称 */ private String projectName; /** * 项目描述 */ private String projectDesc; /** * 项目版本 */ private String version; /** * 后台基础包名 * 默认后台java代码生成的包名为 * basePackage.controller.具体业务模块 控制器 * basePackage.service.具体业务模块 服务接口及实现类 * basePackage.model.具体业务模块 请求参数及返回参数 */ private String basePackage; /** * 后端项目jssdk 网络请求的位置 默认在 项目名/src/sdk/api/ */ private String jsSdkConfigPath; /** * 使用mybatis-generator 生成代码后实体类的默认保存位置 * com.stopboot.admin.entity.实体类 */ private String entityPackage; /** * 使用mybatis-generator 生成代码后实体类Example的默认保存位置 * com.stopboot.admin.entity.实体类Example */ private String entityExamplePackage; /** * 使用mybatis-generator 生成代码后实体类 mapper的默认保存位置 * com.stopboot.admin.mapper.mybatis.实体类mapper */ private String entityMapperPackage; /** * 选中的表名 */ private String tableName; /** * 其他值 */ private Map<String, Object> data; /** * 表信息 */ private List<TableColumnsVO> tableColumnsData; /** * 后台代码的路径 */ private String adminPath; /** * sdk路径 */ private String sdkPath; /** * vue 代码路径 */ private String viewPath; }
3e03d79080f509c4ecc50763479c2770b0d6209a
1,426
java
Java
src/main/java/it/fabiano/bigdata/sparksql/es02/Joins.java
gaetanofabiano/java-spark-sparksql
c56bc5f6ac152a7093dd7b83a15e7da18d371a43
[ "Apache-2.0" ]
1
2020-07-09T09:26:24.000Z
2020-07-09T09:26:24.000Z
src/main/java/it/fabiano/bigdata/sparksql/es02/Joins.java
gaetanofabiano/java-spark-sparksql
c56bc5f6ac152a7093dd7b83a15e7da18d371a43
[ "Apache-2.0" ]
null
null
null
src/main/java/it/fabiano/bigdata/sparksql/es02/Joins.java
gaetanofabiano/java-spark-sparksql
c56bc5f6ac152a7093dd7b83a15e7da18d371a43
[ "Apache-2.0" ]
null
null
null
33.162791
121
0.657083
1,595
package it.fabiano.bigdata.sparksql.es02; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.spark.sql.Dataset; import org.apache.spark.sql.Row; import org.apache.spark.sql.SparkSession; import static org.apache.spark.sql.functions.*; /** * Java-Spark-Training-Course * * @author Gaetano Fabiano * @version 1.1.0 * @since 2019-07-19 * @updated 2020-07-01 */ public class Joins { public static void main(String[] args) throws Exception { Logger.getLogger("org").setLevel(Level.ERROR); SparkSession session = SparkSession.builder().appName("UkMakerSpaces").master("local[*]").getOrCreate(); Dataset<Row> makerSpace = session.read().option("header", "true").csv("in/uk-makerspaces-identifiable-data.csv"); Dataset<Row> postCode = session.read().option("header", "true").csv("in/uk-postcode.csv") .withColumn("PostCode", concat_ws("", col("PostCode"), lit(" "))); System.out.println("=== Print 20 records of makerspace table ==="); makerSpace.show(); System.out.println("=== Print 20 records of postcode table ==="); postCode.show(); Dataset<Row> joined = makerSpace.join(postCode, makerSpace.col("Postcode").startsWith(postCode.col("Postcode")), "left_outer"); System.out.println("=== Group by Region ==="); joined.groupBy("Region").count().show(200); } }
3e03d792048be452f61dd3d5a5ecfd50ae409546
16,396
java
Java
geom/src/main/java/com/github/rinde/rinsim/geom/Graphs.java
rinde/RinSim
5506007f62246bbfc2cb21d136c368880fc75cac
[ "ECL-2.0", "Apache-2.0" ]
99
2015-03-25T15:35:05.000Z
2022-01-18T23:27:56.000Z
geom/src/main/java/com/github/rinde/rinsim/geom/Graphs.java
rinde/RinSim
5506007f62246bbfc2cb21d136c368880fc75cac
[ "ECL-2.0", "Apache-2.0" ]
19
2015-02-26T07:56:07.000Z
2019-05-28T07:53:44.000Z
geom/src/main/java/com/github/rinde/rinsim/geom/Graphs.java
rinde/RinSim
5506007f62246bbfc2cb21d136c368880fc75cac
[ "ECL-2.0", "Apache-2.0" ]
53
2015-02-18T19:56:23.000Z
2021-02-05T14:16:59.000Z
34.590717
85
0.659917
1,596
/* * Copyright (C) 2011-2018 Rinde R.S. van Lon * * 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.github.rinde.rinsim.geom; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Verify.verifyNotNull; import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Lists.reverse; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; import javax.annotation.Nullable; import com.google.common.base.Function; import com.google.common.base.Objects; import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterators; import com.google.common.collect.PeekingIterator; /** * Utility class containing many methods for working with graphs. * @author Rinde van Lon * @author Bartosz Michalik - change in the graphs model */ public final class Graphs { private Graphs() {} /** * Create a path of connections on the specified {@link Graph} using the * specified {@link Point}s. If the points <code>A, B, C</code> are specified, * the two connections: <code>A -&gt; B</code> and <code>B -&gt; C</code> will * be added to the graph. * @param graph The graph to which the connections will be added. * @param path Points that will be treated as a path. * @param <E> The type of connection data. */ public static <E extends ConnectionData> void addPath(Graph<E> graph, Point... path) { for (int i = 1; i < path.length; i++) { graph.addConnection(path[i - 1], path[i]); } } /** * Create a path of connections on the specified {@link Graph} using the * specified {@link Point}s. If the points <code>A, B, C</code> are specified, * the two connections: <code>A -&gt; B</code> and <code>B -&gt; C</code> will * be added to the graph. * @param graph The graph to which the connections will be added. * @param path Points that will be treated as a path. * @param <E> The type of connection data. */ public static <E extends ConnectionData> void addPath(Graph<E> graph, Iterable<Point> path) { final PeekingIterator<Point> it = Iterators.peekingIterator(path.iterator()); while (it.hasNext()) { final Point n = it.next(); if (it.hasNext()) { graph.addConnection(n, it.peek()); } } } /** * Create a path of bi-directional connections on the specified {@link Graph} * using the specified {@link Point}s. If the points <code>A, B, C</code> are * specified, the four connections: <code>A -&gt; B</code>, * <code>B -&gt; A</code>, <code>B -&gt; C</code> and <code>C -&gt; B</code> * will be added to the graph. * @param graph The graph to which the connections will be added. * @param path Points that will be treated as a path. * @param <E> The type of connection data. */ public static <E extends ConnectionData> void addBiPath(Graph<E> graph, Point... path) { addPath(graph, path); final List<Point> list = Arrays.asList(path); Collections.reverse(list); addPath(graph, list.toArray(new Point[path.length])); } /** * Create a path of bi-directional connections on the specified {@link Graph} * using the specified {@link Point}s. If the points <code>A, B, C</code> are * specified, the four connections: <code>A -&gt; B</code>, * <code>B -&gt; A</code>, <code>B -&gt; C</code> and <code>C -&gt; B</code> * will be added to the graph. * @param graph The graph to which the connections will be added. * @param path Points that will be treated as a path. * @param <E> The type of connection data. */ public static <E extends ConnectionData> void addBiPath(Graph<E> graph, Iterable<Point> path) { addPath(graph, path); addPath(graph, reverse(newArrayList(path))); } /** * Returns an unmodifiable view on the specified {@link Graph}. * @param graph A graph. * @param <E> The type of connection data. * @return An unmodifiable view on the graph. */ public static <E extends ConnectionData> Graph<E> unmodifiableGraph( Graph<E> graph) { return new UnmodifiableGraph<>(graph); } /** * Basic equals method. * @param g1 A graph. * @param other The object to compare for equality with g1. * @return <code>true</code> if the provided graphs are equal, * <code>false</code> otherwise. */ public static boolean equal(Graph<?> g1, @Nullable Object other) { if (!(other instanceof Graph<?>)) { return false; } final Graph<?> g2 = (Graph<?>) other; return Objects.equal(g1.getConnections(), g2.getConnections()); } /** * Computes the shortest path based on the Euclidean distance. * @param graph The {@link Graph} on which the shortest path is searched. * @param from The start point of the path. * @param to The destination of the path. * @param <E> The type of connection data. * @return The shortest path that exists between <code>from</code> and * <code>to</code>. */ public static <E extends ConnectionData> List<Point> shortestPathEuclideanDistance( Graph<E> graph, final Point from, final Point to) { return Graphs.shortestPath(graph, from, to, GeomHeuristics.euclidean()); } /** * A standard implementation of the * <a href="http://en.wikipedia.org/wiki/A*_search_algorithm">A* algorithm</a> * . * @author Rutger Claes * @author Rinde van Lon * @param graph The {@link Graph} which contains <code>from</code> and * <code>to</code>. * @param from The start position * @param to The end position * @param h The {@link GeomHeuristic} used in the A* implementation. * @param <E> The type of connection data. * @return The shortest path from <code>from</code> to <code>to</code> if it * exists, otherwise a {@link PathNotFoundException} is thrown. * @throws PathNotFoundException if a path does not exist between * <code>from</code> and <code>to</code>. */ public static <E extends ConnectionData> List<Point> shortestPath( Graph<E> graph, final Point from, final Point to, GeomHeuristic h) { if (!graph.containsNode(from)) { throw new IllegalArgumentException("from should be valid node. " + from); } // The set of nodes already evaluated. final Set<Point> closedSet = new LinkedHashSet<>(); // Distance from start along optimal path. final Map<Point, Double> gScore = new LinkedHashMap<>(); gScore.put(from, 0d); // heuristic estimates final Map<Point, Double> hScore = new LinkedHashMap<>(); hScore.put(from, h.estimateCost(graph, from, to)); // Estimated total distance from start to goal through y final SortedMap<Double, Point> fScore = new TreeMap<>(); fScore.put(h.estimateCost(graph, from, to), from); // The map of navigated nodes. final Map<Point, Point> cameFrom = new LinkedHashMap<>(); while (!fScore.isEmpty()) { final Point current = fScore.remove(fScore.firstKey()); if (current.equals(to)) { final List<Point> result = new ArrayList<>(); result.add(from); result.addAll(Graphs.reconstructPath(cameFrom, to)); return result; } closedSet.add(current); for (final Point outgoingPoint : graph.getOutgoingConnections(current)) { if (closedSet.contains(outgoingPoint)) { continue; } // tentative_g_score := g_score[x] + dist_between(x,y) final double tgScore = gScore.get(current) + h.calculateCost(graph, current, outgoingPoint); boolean tIsBetter = false; if (!fScore.values().contains(outgoingPoint)) { hScore.put(outgoingPoint, h.estimateCost(graph, outgoingPoint, to)); tIsBetter = true; } else if (tgScore < gScore.get(outgoingPoint)) { tIsBetter = true; } if (tIsBetter) { cameFrom.put(outgoingPoint, current); gScore.put(outgoingPoint, tgScore); double fScoreValue = gScore.get(outgoingPoint) + hScore.get(outgoingPoint); while (fScore.containsKey(fScoreValue)) { fScoreValue = Double.longBitsToDouble(Double .doubleToLongBits(fScoreValue) + 1); } fScore.put(fScoreValue, outgoingPoint); } } } throw new PathNotFoundException("Cannot reach " + to + " from " + from); } /** * A method for finding the closest object to a point. If there is no object * <code>null</code> is returned instead. * @param pos The {@link Point} which is used as reference. * @param objects The {@link Collection} which is searched. * @param transformation A {@link Function} that transforms an object from * <code>objects</code> into a {@link Point}, normally this means * that the position of the object is retrieved. * @param <T> the type of object. * @return The closest object in <code>objects</code> to <code>pos</code> or * <code>null</code> if no object exists. */ @Nullable public static <T> T findClosestObject(Point pos, Collection<T> objects, Function<T, Point> transformation) { double dist = Double.MAX_VALUE; T closest = null; for (final T obj : objects) { @Nullable final Point objPos = transformation.apply(obj); assert objPos != null; final double currentDist = Point.distance(pos, objPos); if (currentDist < dist) { dist = currentDist; closest = obj; } } return closest; } /** * Searches the closest <code>n</code> objects to position <code>pos</code> in * collection <code>objects</code> using <code>transformation</code>. * @param pos The {@link Point} which is used as a reference point. * @param objects The list of objects which is searched. * @param transformation A function that transforms objects from * <code>objects</code> to a point. * @param n The maximum number of objects to return where n must be &gt;= 0. * @param <T> The type of object. * @return A list of objects that are closest to <code>pos</code>. The list is * ordered such that the closest object appears first. An empty list * is returned when <code>objects</code> is empty. */ public static <T> List<T> findClosestObjects(Point pos, Collection<T> objects, Function<T, Point> transformation, int n) { checkArgument(n > 0, "n must be positive."); final List<ObjectWithDistance<T>> objs = new ArrayList<>(); for (final T obj : objects) { @Nullable final Point objPos = transformation.apply(obj); checkNotNull(objPos); objs.add(new ObjectWithDistance<>(obj, Point.distance(pos, objPos))); } Collections.sort(objs); final List<T> results = new ArrayList<>(); for (final ObjectWithDistance<T> o : objs.subList(0, Math.min(n, objs.size()))) { results.add(o.obj); } return results; } /** * Calculates the length of a path. The length is calculated by simply summing * the distances of every two neighboring positions. * @param path A list of {@link Point}s forming a path. * @return The total length of the path. */ public static double pathLength(List<Point> path) { double dist = 0; for (int i = 1; i < path.size(); i++) { dist += Point.distance(path.get(i - 1), path.get(i)); } return dist; } /** * Calculates the extremes of the graph. * @param graph The graph. * @return A list containing two points, the first point contains the min x * and min y, the second point contains the max x and max y. */ public static ImmutableList<Point> getExtremes(Graph<?> graph) { final Collection<Point> nodes = graph.getNodes(); double minX = Double.POSITIVE_INFINITY; double maxX = Double.NEGATIVE_INFINITY; double minY = Double.POSITIVE_INFINITY; double maxY = Double.NEGATIVE_INFINITY; for (final Point p : nodes) { minX = Math.min(minX, p.x); maxX = Math.max(maxX, p.x); minY = Math.min(minY, p.y); maxY = Math.max(maxY, p.y); } return ImmutableList.of(new Point(minX, minY), new Point(maxX, maxY)); } static List<Point> reconstructPath(final Map<Point, Point> cameFrom, final Point end) { if (cameFrom.containsKey(end)) { final List<Point> path = reconstructPath(cameFrom, cameFrom.get(end)); path.add(end); return path; } return new LinkedList<>(); } // Equals is not consistent with compareTo! private static final class ObjectWithDistance<T> implements Comparable<ObjectWithDistance<T>> { final double dist; final T obj; ObjectWithDistance(T pObj, double pDist) { obj = pObj; dist = pDist; } @Override public int compareTo(@Nullable ObjectWithDistance<T> o) { return Double.compare(dist, verifyNotNull(o).dist); } @Override public boolean equals(@Nullable Object other) { if (other == null) { return false; } if (other == this) { return true; } if (getClass() != other.getClass()) { return false; } @SuppressWarnings("unchecked") final ObjectWithDistance<T> o = (ObjectWithDistance<T>) other; return Objects.equal(dist, o.dist) && Objects.equal(obj, o.obj); } @Override public int hashCode() { return Objects.hashCode(dist, obj); } } private static class UnmodifiableGraph<E extends ConnectionData> extends ForwardingGraph<E> { UnmodifiableGraph(Graph<E> delegateGraph) { super(delegateGraph); } @Override public Collection<Point> getOutgoingConnections(Point node) { return Collections.unmodifiableCollection(delegate .getOutgoingConnections(node)); } @Override public Collection<Point> getIncomingConnections(Point node) { return Collections.unmodifiableCollection(delegate .getIncomingConnections(node)); } @Override public Set<Connection<E>> getConnections() { return Collections.unmodifiableSet(delegate.getConnections()); } @Override public Set<Point> getNodes() { return Collections.unmodifiableSet(delegate.getNodes()); } @Override public void addConnection(Point from, Point to) { throw new UnsupportedOperationException(); } @Override public void addConnection(Point from, Point to, @Nullable E connData) { throw new UnsupportedOperationException(); } @Override public void addConnection(Connection<E> connection) { throw new UnsupportedOperationException(); } @Override public void addConnections(Iterable<? extends Connection<E>> connections) { throw new UnsupportedOperationException(); } @Override public void merge(Graph<E> other) { throw new UnsupportedOperationException(); } @Override public void removeNode(Point node) { throw new UnsupportedOperationException(); } @Override public void removeConnection(Point from, Point to) { throw new UnsupportedOperationException(); } @Override public Optional<E> setConnectionData(Point from, Point to, E connData) { throw new UnsupportedOperationException(); } @Override public Optional<E> removeConnectionData(Point from, Point to) { throw new UnsupportedOperationException(); } } }
3e03d82941814debffa240e12e7a65b4e2fde98a
1,802
java
Java
src/com/bright_side_it/fliesenui/validation/logic/ColorPaletteValidationLogic.java
FliesenUI/FliesenUI
3100bec1e76dbc96eb9378a85411597bd401e081
[ "Apache-2.0" ]
1
2017-03-25T07:51:22.000Z
2017-03-25T07:51:22.000Z
src/com/bright_side_it/fliesenui/validation/logic/ColorPaletteValidationLogic.java
FliesenUI/FliesenUI
3100bec1e76dbc96eb9378a85411597bd401e081
[ "Apache-2.0" ]
null
null
null
src/com/bright_side_it/fliesenui/validation/logic/ColorPaletteValidationLogic.java
FliesenUI/FliesenUI
3100bec1e76dbc96eb9378a85411597bd401e081
[ "Apache-2.0" ]
null
null
null
48.702703
179
0.807991
1,597
package com.bright_side_it.fliesenui.validation.logic; import java.util.Map; import com.bright_side_it.fliesenui.colorpalette.dao.ColorPaletteDAO; import com.bright_side_it.fliesenui.colorpalette.model.ColorPalette; import com.bright_side_it.fliesenui.project.dao.ProjectDefinitionDAO; import com.bright_side_it.fliesenui.project.model.Project; import com.bright_side_it.fliesenui.screendefinition.model.ResourceDefinitionProblem.ProblemType; import com.bright_side_it.fliesenui.validation.util.ValidationUtil; public class ColorPaletteValidationLogic { public void validate(Project project) { validateNoDefaultPaletteNameUsedAsID(project); validateExtendedColorPalettesValid(project); } private void validateExtendedColorPalettesValid(Project project) { for (Map.Entry<String, ColorPalette> i : project.getColorPaletteMap().entrySet()) { if (!ProjectDefinitionDAO.DEFAULT_PALATTE_NAMES.contains(i.getValue().getExtendedPalette())){ ValidationUtil.addError(project, i.getValue(), i.getValue().getNodePath(), ColorPaletteDAO.EXTENDED_PALETTE_ATTRIBUTE_NAME, ProblemType.COLOR_PALETTE_UNKNOWN_PALETTE_EXTENDED, "The color palette to be extended is unknown. These are possible palettes to extend: " + ProjectDefinitionDAO.DEFAULT_PALATTE_NAMES); } } } private void validateNoDefaultPaletteNameUsedAsID(Project project) { for (Map.Entry<String, ColorPalette> i : project.getColorPaletteMap().entrySet()) { if (ProjectDefinitionDAO.DEFAULT_PALATTE_NAMES.contains(i.getKey())){ ValidationUtil.addError(project, i.getValue(), i.getValue().getNodePath(), null, ProblemType.COLOR_PALETTE_DEFAULT_PALETTE_ID_USED, "The ID of the color palette may not be one of the default palette names " + ProjectDefinitionDAO.DEFAULT_PALATTE_NAMES); } } } }
3e03d88adb7e5f44d2e6c681887777f9c131dd81
2,802
java
Java
src/main/java/com/eduardolopez/almacen/core/model/TelefonoProveedor.java
Eduardonoj/AlmacenV1
665ae81673e46e48d9f7189f6d071d5b315da5c8
[ "MIT" ]
null
null
null
src/main/java/com/eduardolopez/almacen/core/model/TelefonoProveedor.java
Eduardonoj/AlmacenV1
665ae81673e46e48d9f7189f6d071d5b315da5c8
[ "MIT" ]
null
null
null
src/main/java/com/eduardolopez/almacen/core/model/TelefonoProveedor.java
Eduardonoj/AlmacenV1
665ae81673e46e48d9f7189f6d071d5b315da5c8
[ "MIT" ]
null
null
null
29.494737
107
0.726981
1,598
package com.eduardolopez.almacen.core.model; import java.io.Serializable; import javafx.beans.property.LongProperty; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleLongProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; @Entity @Table(name="telefono_proveedor") @NamedQueries( { @NamedQuery (name="TelefonoProveedor.FindAll", query="select tp from TelefonoProveedor tp") }) public class TelefonoProveedor implements Serializable { private final LongProperty codigoTelefono; private final StringProperty numero; private final StringProperty descripcion; private final ObjectProperty<Proveedor> proveedor; public TelefonoProveedor() { this.codigoTelefono = new SimpleLongProperty() {}; this.numero = new SimpleStringProperty(); this.descripcion = new SimpleStringProperty(); this.proveedor = new SimpleObjectProperty<Proveedor>(); } public TelefonoProveedor(Long codigoTelefono, String numero, String descripcion, Proveedor proveedor) { this.codigoTelefono = new SimpleLongProperty(codigoTelefono) {}; this.numero = new SimpleStringProperty(numero); this.descripcion = new SimpleStringProperty(descripcion); this.proveedor = new SimpleObjectProperty<Proveedor>(proveedor); } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="codigo_telefono") public Long getCodigoTelefono() { return codigoTelefono.get(); } public void setCodigoTelefono(Long codigoTelefono) { this.codigoTelefono.set(codigoTelefono); } @Column(name="numero") public String getNumero() { return numero.get(); } public void setNumero(String numero) { this.numero.set(numero); } @Column(name="descripcion") public String getDescripcion() { return descripcion.get(); } public void setDescripcion(String descripcion) { this.descripcion.set(descripcion); } @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="codigo_proveedor") public Proveedor getProveedor() { return proveedor.get(); } public void setProveedor(Proveedor proveedor) { this.proveedor.set(proveedor); } }
3e03d91f2d01addc7d3aa0af122e28a5a3d9cf2e
927
java
Java
workspace/app/src/main/java/com/clilystudio/netbook/viewbinder/notification/LinkPushBinder.java
clilystudio/NetBook
a8ca6cb91e9259ed7dec70b830829d622525b4b7
[ "Unlicense" ]
1
2018-02-04T12:23:55.000Z
2018-02-04T12:23:55.000Z
workspace/app/src/main/java/com/clilystudio/netbook/viewbinder/notification/LinkPushBinder.java
clilystudio/NetBook
a8ca6cb91e9259ed7dec70b830829d622525b4b7
[ "Unlicense" ]
null
null
null
workspace/app/src/main/java/com/clilystudio/netbook/viewbinder/notification/LinkPushBinder.java
clilystudio/NetBook
a8ca6cb91e9259ed7dec70b830829d622525b4b7
[ "Unlicense" ]
null
null
null
22.609756
62
0.68932
1,599
package com.clilystudio.netbook.viewbinder.notification; import android.content.Context; import android.content.Intent; import com.clilystudio.netbook.R; import com.clilystudio.netbook.model.NotificationItem; public class LinkPushBinder extends OfficialNotifBinder { public static final String LABEL = "link_push"; public LinkPushBinder(NotificationItem notificationItem) { super(notificationItem); } @Override protected int getIconRes() { return R.drawable.ic_notif_link; } @Override public Intent getIntent(Context context) { return this.getWebIntent(this.getItem().getLink()); } @Override public String getLabel() { return "link_push"; } @Override public String getMainText() { return this.getItem().getTitle(); } @Override public String getSubText() { return this.getItem().getLinkTitle(); } }
3e03d9d8c3e33eab62e58156d3e70a72010b963a
2,697
java
Java
file/file-source/src/main/java/com/dtstack/flink/sql/source/file/table/ArvoSourceTableInfo.java
Mu-L/flinkStreamSQL
0c66b19bc2f5cdd845981b524646b3259df3d1a4
[ "Apache-2.0" ]
1,858
2018-09-12T09:55:04.000Z
2022-03-31T02:13:44.000Z
file/file-source/src/main/java/com/dtstack/flink/sql/source/file/table/ArvoSourceTableInfo.java
xueqianging/flinkStreamSQL
0c66b19bc2f5cdd845981b524646b3259df3d1a4
[ "Apache-2.0" ]
370
2018-10-04T10:06:30.000Z
2022-03-22T03:00:53.000Z
file/file-source/src/main/java/com/dtstack/flink/sql/source/file/table/ArvoSourceTableInfo.java
xueqianging/flinkStreamSQL
0c66b19bc2f5cdd845981b524646b3259df3d1a4
[ "Apache-2.0" ]
911
2018-09-12T09:55:07.000Z
2022-03-29T05:28:18.000Z
32.890244
92
0.708565
1,600
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.dtstack.flink.sql.source.file.table; import com.google.common.base.Preconditions; import org.apache.flink.api.common.serialization.DeserializationSchema; import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.formats.avro.AvroRowDeserializationSchema; import org.apache.flink.types.Row; /** * @author tiezhu * @date 2021/3/22 星期一 * Company dtstack */ public class ArvoSourceTableInfo extends FileSourceTableInfo { /** * 针对arvo特定参数 */ private String arvoFormat; public String getArvoFormat() { return arvoFormat; } public void setArvoFormat(String arvoFormat) { this.arvoFormat = arvoFormat; } public static Builder newBuilder(ArvoSourceTableInfo tableInfo) { return new Builder(tableInfo); } public static class Builder { private final ArvoSourceTableInfo tableInfo; public Builder(ArvoSourceTableInfo tableInfo) { this.tableInfo = tableInfo; } public Builder setArvoFormat(String arvoFormat) { tableInfo.setArvoFormat(arvoFormat); return this; } public Builder setTypeInformation(TypeInformation<Row> typeInformation) { tableInfo.setTypeInformation(typeInformation); return this; } public ArvoSourceTableInfo buildTableInfo() { DeserializationSchema<Row> deserializationSchema = buildDeserializationSchema(); tableInfo.setDeserializationSchema(deserializationSchema); return tableInfo; } public DeserializationSchema<Row> buildDeserializationSchema() { String arvoFormat = tableInfo.getArvoFormat(); Preconditions.checkNotNull(arvoFormat, "format [arvo] must set arvoFormat"); return new AvroRowDeserializationSchema(arvoFormat); } } }
3e03da287cd8b8abf4210d15dd69b9167a14b83b
2,348
java
Java
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/TbDeviceProfileNodeConfiguration.java
TTvanWillegen/thingsboard
9b2009a50131bfd4cb4b36551d4158ac41ace56f
[ "ECL-2.0", "Apache-2.0" ]
1
2021-07-31T03:10:32.000Z
2021-07-31T03:10:32.000Z
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/TbDeviceProfileNodeConfiguration.java
TTvanWillegen/thingsboard
9b2009a50131bfd4cb4b36551d4158ac41ace56f
[ "ECL-2.0", "Apache-2.0" ]
1
2021-02-02T13:15:14.000Z
2021-02-02T13:15:14.000Z
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/TbDeviceProfileNodeConfiguration.java
TTvanWillegen/thingsboard
9b2009a50131bfd4cb4b36551d4158ac41ace56f
[ "ECL-2.0", "Apache-2.0" ]
3
2021-04-07T06:52:48.000Z
2021-11-30T10:53:30.000Z
41.192982
110
0.815162
1,601
/** * Copyright © 2016-2021 The Thingsboard Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.thingsboard.rule.engine.profile; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.thingsboard.rule.engine.api.EmptyNodeConfiguration; import org.thingsboard.rule.engine.api.NodeConfiguration; import org.thingsboard.rule.engine.api.RuleEngineDeviceProfileCache; import org.thingsboard.rule.engine.api.RuleNode; import org.thingsboard.rule.engine.api.TbContext; import org.thingsboard.rule.engine.api.TbNode; import org.thingsboard.rule.engine.api.TbNodeConfiguration; import org.thingsboard.rule.engine.api.TbNodeException; import org.thingsboard.server.common.data.DataConstants; import org.thingsboard.server.common.data.Device; import org.thingsboard.server.common.data.DeviceProfile; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.DeviceProfileId; import org.thingsboard.server.common.data.plugin.ComponentType; import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.dao.util.mapping.JacksonUtil; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @Data @JsonIgnoreProperties(ignoreUnknown = true) public class TbDeviceProfileNodeConfiguration implements NodeConfiguration<TbDeviceProfileNodeConfiguration> { private boolean persistAlarmRulesState; private boolean fetchAlarmRulesStateOnStart; @Override public TbDeviceProfileNodeConfiguration defaultConfiguration() { return new TbDeviceProfileNodeConfiguration(); } }
3e03da5bdc1fc8263c5494bbee0bcbfc5c8062e5
7,127
java
Java
hadoop-tools/hadoop-aliyun-oss/src/test/java/org/apache/hadoop/fs/oss/ExtraOSSAPIsTest.java
aliyun-beta/aliyun-oss-hadoop-fs
df32547708580168677a15fb713fc6afafb5e8b6
[ "ECL-2.0", "Apache-2.0" ]
14
2016-09-30T13:32:59.000Z
2020-05-13T00:59:40.000Z
hadoop-tools/hadoop-aliyun-oss/src/test/java/org/apache/hadoop/fs/oss/ExtraOSSAPIsTest.java
aliyun-beta/aliyun-oss-hadoop-fs
df32547708580168677a15fb713fc6afafb5e8b6
[ "ECL-2.0", "Apache-2.0" ]
1
2017-09-08T05:02:30.000Z
2018-01-19T06:24:02.000Z
hadoop-tools/hadoop-aliyun-oss/src/test/java/org/apache/hadoop/fs/oss/ExtraOSSAPIsTest.java
aliyun-beta/aliyun-oss-hadoop-fs
df32547708580168677a15fb713fc6afafb5e8b6
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
35.974747
150
0.703496
1,602
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * <p/> * http://www.apache.org/licenses/LICENSE-2.0 * <p/> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.fs.oss; import com.aliyun.oss.OSSClient; import com.aliyun.oss.model.CopyObjectRequest; import com.aliyun.oss.model.GetObjectRequest; import com.aliyun.oss.model.ObjectMetadata; import com.aliyun.oss.model.PutObjectRequest; import junit.framework.TestCase; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.net.URI; import static org.apache.hadoop.fs.oss.SmartOSSClientConfig.*; /** * Most of cases are covered by Hadoop File System contract test, here are some extra test cases mainly for high performance APIs and code coverage. */ public class ExtraOSSAPIsTest extends TestCase { private OSSClient client; private OSSFileSystem fileSystem; private String bucketName; public static final String TEST_FS_OSS_NAME = "test.fs.oss.name"; @Override protected void setUp() throws Exception { super.setUp(); Configuration conf = new Configuration(); String accessKeyId = conf.get(SmartOSSClientConfig.HADOOPACCESS_KEY, null); String accessKeySecret = conf.get(SmartOSSClientConfig.HADOOP_SECRET_KEY, null); String endpoint = conf.get(SmartOSSClientConfig.HADOOP_ENDPOINT, null); bucketName = conf.get(TEST_FS_OSS_NAME); SmartOSSClientConfig ossConf = new SmartOSSClientConfig(); ossConf.setMultipartUploadThreshold(50 * MB); ossConf.setMinimumUploadPartSize(10 * MB); ossConf.setMultipartCopyThreshold(50 * MB); ossConf.setMultipartCopyPartSize(10 * MB); client = new SmartOSSClient(endpoint, accessKeyId, accessKeySecret, ossConf); fileSystem = new OSSFileSystem(); fileSystem.initialize(URI.create(bucketName), conf); } /** * Test high performance copy and upload. * * @throws Exception */ public void testMultiPartCopyUpload() throws Exception { final File sampleFile = createSampleFile(1100000); //48.83 MB long fileLength = sampleFile.length(); PutObjectRequest putObjectRequest = new PutObjectRequest("hadoop-intg", fileSystem.getWorkingDirectory() + "/test-multipart-upload", sampleFile); client.putObject(putObjectRequest); String originMD5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(new FileInputStream(sampleFile)); System.out.println("[uploadMd5] " + originMD5); File uploadedFile = new File("/tmp/test-multipart-upload"); uploadedFile.deleteOnExit(); client.getObject(new GetObjectRequest("hadoop-intg", fileSystem.getWorkingDirectory() + "/test-multipart-upload"), uploadedFile); String uploadMD5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(new FileInputStream(uploadedFile)); System.out.println("[downloadMd5] " + uploadMD5); assertEquals(originMD5, uploadMD5); CopyObjectRequest copyObjectRequest = new CopyObjectRequest("hadoop-intg", fileSystem.getWorkingDirectory() + "/test-multipart-upload", "hadoop-intg", "test-multipart-copy"); client.copyObject(copyObjectRequest); File copiedFile = new File("/tmp/test-multipart-copy"); copiedFile.deleteOnExit(); client.getObject(new GetObjectRequest("hadoop-intg", "test-multipart-copy"), copiedFile); String copiedMD5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(new FileInputStream(copiedFile)); System.out.println("[copiedMd5] " + copiedMD5); assertEquals(originMD5, copiedMD5); } /** * InputStream code coverage test. * * @throws Exception */ public void testOSSInputStream() throws Exception { final InputStream nullStream = new InputStream() { @Override public int read() throws IOException { return -1; } }; client.putObject("hadoop-intg", "test/test-oss-inputstream", nullStream); FSDataInputStream inputStream = fileSystem.open(path("/test/test-oss-inputstream"), 100); assertEquals(inputStream.available(), 0); assertEquals(inputStream.markSupported(), false); } /** * Test high performance copyFromLocal. * * @throws Exception */ public void testCopyFromLocalFile() throws Exception { final File sampleFile = createSampleFile(1100); //48.83 MB fileSystem.copyFromLocalFile(false, true, new Path(sampleFile.getAbsolutePath()), path("test/test-copyFromLocalFile")); ObjectMetadata metaData = client.getObjectMetadata("hadoop-intg", "user/shawguo/test/test-copyFromLocalFile"); assertEquals(sampleFile.length(), metaData.getContentLength()); } /** * test list/delete objects more than 1000 * * @throws Exception */ public void testObjectPagination() throws Exception { final InputStream nullStream = new InputStream() { @Override public int read() throws IOException { return -1; } }; client.putObject("hadoop-intg", "test/", nullStream); for (int i = 0; i < 1010; i++) { System.out.println("putObject:" + "test/" + i); client.putObject("hadoop-intg", "test/" + i, nullStream); } assertEquals(1010, fileSystem.listStatus(path("/test")).length); fileSystem.delete(path("/test"), true); } @Override protected void tearDown() throws Exception { if (fileSystem != null) { fileSystem.delete(path("test"), true); } super.tearDown(); client.shutdown(); fileSystem.close(); super.tearDown(); } private File createSampleFile(int size) throws IOException { File file = File.createTempFile("oss-java-sdk-", ".txt"); file.deleteOnExit(); Writer writer = new OutputStreamWriter(new FileOutputStream(file)); //total 50 char for (int i = 0; i < size; i++) { writer.write("9q3vfhm7l33rus21toc8fndupq76itje"); writer.write("0123456789011234567890\n"); } writer.close(); return file; } protected Path path(String pathString) { return (new Path(pathString)).makeQualified(this.fileSystem); } }
3e03daceee732906a4aed035634646609cc7b9e2
188
java
Java
common/src/main/java/ua/lviv/navpil/primitives/BoolDemo.java
navpil/java-examples
b218ac1cd79edcc9cc6087ca952a5a57b1b6f82a
[ "MIT" ]
null
null
null
common/src/main/java/ua/lviv/navpil/primitives/BoolDemo.java
navpil/java-examples
b218ac1cd79edcc9cc6087ca952a5a57b1b6f82a
[ "MIT" ]
null
null
null
common/src/main/java/ua/lviv/navpil/primitives/BoolDemo.java
navpil/java-examples
b218ac1cd79edcc9cc6087ca952a5a57b1b6f82a
[ "MIT" ]
null
null
null
15.666667
44
0.56383
1,603
package ua.lviv.navpil.primitives; public class BoolDemo { public static void main(String[] args) { int a = 1; int b = 2; System.out.println(a & b); } }
3e03dc81135403f863ca898e7bc89aad0ddb5ba3
103
java
Java
chapter_sql/src/main/java/ru/job4j/umlsystem/Rule.java
kajuga/job4j
cf31f173982769c13ec182321b37932e6561cb36
[ "Apache-2.0" ]
1
2019-12-10T00:45:02.000Z
2019-12-10T00:45:02.000Z
chapter_sql/src/main/java/ru/job4j/umlsystem/Rule.java
kajuga/job4j
cf31f173982769c13ec182321b37932e6561cb36
[ "Apache-2.0" ]
3
2021-12-10T01:12:55.000Z
2021-12-14T21:18:05.000Z
chapter_sql/src/main/java/ru/job4j/umlsystem/Rule.java
kajuga/job4j
cf31f173982769c13ec182321b37932e6561cb36
[ "Apache-2.0" ]
null
null
null
11.444444
27
0.601942
1,604
package ru.job4j.umlsystem; public enum Rule { READ, WRITE, EDIT, CREATE, DELETE }
3e03dcade8aa6b396113d4d25baa692df9427b9c
1,166
java
Java
common/src/main/java/com/simon/common/service/SelectService.java
jftuga8/mhtranbn5
4163d6c3a1db843dbc45ca18a691409bf2fc797d
[ "Apache-2.0" ]
261
2018-04-24T03:25:36.000Z
2021-12-20T07:36:23.000Z
common/src/main/java/com/simon/common/service/SelectService.java
jftuga8/mhtranbn5
4163d6c3a1db843dbc45ca18a691409bf2fc797d
[ "Apache-2.0" ]
9
2018-06-01T07:56:01.000Z
2022-02-16T00:55:27.000Z
common/src/main/java/com/simon/common/service/SelectService.java
jftuga8/mhtranbn5
4163d6c3a1db843dbc45ca18a691409bf2fc797d
[ "Apache-2.0" ]
122
2018-04-24T12:10:05.000Z
2021-03-05T02:25:27.000Z
18.507937
102
0.587479
1,605
package com.simon.common.service; import com.github.pagehelper.PageInfo; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import java.util.List; import java.util.Map; /** * @author simon * @version 1.0 * @date 2019-07-26 15:46 */ public interface SelectService<T, ID> { /** * 统计记录总条数 * @return 记录总条数 */ long count(); /** * PageHelper分页查询 * @param pageNo 页码 * @param pageSize 每页记录数 * @param orderBy 排序 * @return 分页数据 */ PageInfo<T> findAll(Integer pageNo, Integer pageSize, String orderBy); /** * JPA分页查询 * @param pageable 分页对象 * @return 分页数据 */ Page<T> findAll(Pageable pageable); /** * 查询所有记录 * @return 所有记录 */ List<T> findAll(); /** * 根据id查询记录 * @param id 记录id * @return 记录 */ T findById(ID id); /** * 通用查询 * @param params 参数 * @param pageNo 页码 * @param pageSize 每页条数 * @param orderBy 排序 * @return 分页数据 */ @Deprecated PageInfo<T> getList(Map<String, Object> params, Integer pageNo, Integer pageSize, String orderBy); }
3e03dd469dc836fa2a6b12aa2bf1a0e0e13d0548
4,905
java
Java
src/banxclient/xorm/dao/repository/BankUserDaoRepository.java
Xampy/account_management_java
eb37a5780511c4b0118445ef894fb93ae64f76e0
[ "Apache-2.0" ]
null
null
null
src/banxclient/xorm/dao/repository/BankUserDaoRepository.java
Xampy/account_management_java
eb37a5780511c4b0118445ef894fb93ae64f76e0
[ "Apache-2.0" ]
null
null
null
src/banxclient/xorm/dao/repository/BankUserDaoRepository.java
Xampy/account_management_java
eb37a5780511c4b0118445ef894fb93ae64f76e0
[ "Apache-2.0" ]
null
null
null
34.787234
135
0.628338
1,606
/* * 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 banxclient.xorm.dao.repository; import banxclient.exception.auth.LoginException; import banxclient.exception.entity.EntityNotFountException; import banxclient.models.entity.BankAccount; import banxclient.models.entity.BankUser; import banxclient.xorm.dao.AbstractDAO; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Software */ public class BankUserDaoRepository extends AbstractDAO<BankUser>{ public static final String TABLE_NAME = "bank_user"; public static final String TABLE_COLUMN_LASTNAME = "lastname"; public static final String TABLE_COLUMN_FIRSTNAME = "firstname"; public static final String TABLE_COLUMN_PASSWORD = "password"; /** * Constructor * @param conn Databse connection */ public BankUserDaoRepository(Connection conn){ super(conn); } @Override public boolean create(BankUser obj) { String query = "INSERT INTO "; query += BankUserDaoRepository.TABLE_NAME; query += "(lastname, firstname, password ) VALUES(?, ?, ?)"; try{ PreparedStatement stm = this.connect.prepareStatement(query); stm.setString(1, obj.getLastname()); stm.setString(2, obj.getFirstname()); //Here need to hash the password stm.setString(3, obj.getPassword()); stm.execute(); stm.close(); } catch (SQLException ex) { Logger.getLogger(BankUserDaoRepository.class.getName()).log(Level.SEVERE, null, ex); //Handle exception message here System.exit(0); } return true; } @Override public boolean delete(BankUser obj) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public boolean update(BankUser obj) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public BankUser find(int id) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public BankUser find(BankUser obj) throws EntityNotFountException{ String query = "SELECT * FROM " + BankUserDaoRepository.TABLE_NAME; query += " WHERE lastname='" + obj.getLastname() + "'"; query += " AND firstname='" + obj.getFirstname() + "'"; query += " AND password='" + obj.getPassword()+ "';"; BankUser user = new BankUser(); try{ Statement stm = this.connect.createStatement(); System.out.println(query); ResultSet result = stm.executeQuery(query); if (result != null){ while(result.next()){ user.setLastname( result.getString( BankUserDaoRepository.TABLE_COLUMN_LASTNAME) ); user.setFirstname( result.getString( BankUserDaoRepository.TABLE_COLUMN_FIRSTNAME) ); user.setPassword( result.getString( BankUserDaoRepository.TABLE_COLUMN_PASSWORD) ); user.setId( result.getLong("id") ); } if (user.getFirstname() == null){ throw new EntityNotFountException("No user record found for id"); } }else{ throw new EntityNotFountException("No user record found for id"); } } catch (SQLException ex) { Logger.getLogger(BankUserDaoRepository.class.getName()).log(Level.SEVERE, null, ex); //throw new EntityNotFountException("No user record found for id"); System.exit(0); } return user; } @Override public BankUser[] select() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public BankUser[] selectWithOptions(int limit, int offset) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public int getRowsCount() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
3e03dd793bdea47644350fb2578a528dcac245f1
15,877
java
Java
submission/s21515553_and_21440859/Database.java
Prodge/3001-Project
5d1632e0d33e1d4f0568e634af901a95c9eb9d38
[ "MIT" ]
null
null
null
submission/s21515553_and_21440859/Database.java
Prodge/3001-Project
5d1632e0d33e1d4f0568e634af901a95c9eb9d38
[ "MIT" ]
null
null
null
submission/s21515553_and_21440859/Database.java
Prodge/3001-Project
5d1632e0d33e1d4f0568e634af901a95c9eb9d38
[ "MIT" ]
null
null
null
37.623223
138
0.529949
1,607
package s21515553_and_21440859; import java.util.*; import java.sql.*; /** * The Database class creates/connects to a database storing factors of certain events * This is used for the LearningAgent * * @author Tim Metcalf (21515553) and Don Wimodya Randula Athukorala (21440859) */ public class Database{ private String database_name = "history.db"; private List<String> tables = Arrays.asList("accuse_as_spy_chance", "betray_base_factor", "nominate_spy_when_spy_chance"); private HashMap<String, Double> last_values = new HashMap<String, Double>(); public Database(){ for(String variable : tables){ last_values.put(variable, -1.0); } initialise_database(); } /** * Executes a create/updated queries */ private void executeCUDQuery(Connection con, String query) throws SQLException { Statement stmt = null; try { stmt = con.createStatement(); stmt.executeUpdate(query); } catch (SQLException e){ printSQLException(e); } finally{ if (stmt != null) stmt.close(); } } /** * Checks whether the required tables exists in the database * @return true if required tables exists otherwise return false */ private boolean database_tables_exists(Connection con) throws SQLException { try { ResultSet rs = con.getMetaData().getTables(null, null, "%", null); int row_count = 0; while (rs.next()){ if (tables.contains(rs.getString(3))) row_count++; } if (row_count == tables.size()) return true; } catch (SQLException e) { printSQLException(e); } return false; } /** * The database is considered empty when all values are 0 zeros * @return true if the database is empty */ public boolean empty_database(){ boolean is_empty = false; try { Class.forName("org.sqlite.JDBC"); Connection con = DriverManager.getConnection("jdbc:sqlite:" + database_name); Statement stmt = null; stmt = con.createStatement(); // Just check the first table as they are all updated at once ResultSet rs = stmt.executeQuery( "SELECT count(*) as count FROM " + tables.get(0) + " WHERE success == 0 AND fail == 0;"); while(rs.next()) { if(rs.getInt("count") == 101){ is_empty = true; } } rs.close(); stmt.close(); con.close(); } catch (SQLException e) { printSQLException(e); } catch (ClassNotFoundException e) { System.out.println(e); } return is_empty; } /** * Creates the required tables for the database */ private void create_database_tables(Connection con) throws SQLException { try{ String query = ""; for(String table_name : tables){ // Create table query += "create table " + table_name + "(ID INTEGER PRIMARY KEY AUTOINCREMENT," + "value INT NOT NULL," + "success INT NOT NULL," + "fail INT NOT NULL);\n" ; } executeCUDQuery(con, query); } catch (SQLException e) { printSQLException(e); } } /** * Add initial values to the required tables */ private void populate_tables(Connection con) throws SQLException { try{ String query = ""; for(String table_name : tables){ for(double i=0; i<=100; i+=1){ query += "insert into " + table_name + " (value, success, fail) VALUES (" + i + ", 0, 0);\n"; } } executeCUDQuery(con, query); } catch (SQLException e) { printSQLException(e); } } /** * Initialises empty tables in the database */ private void initialise_database(){ try { Class.forName("org.sqlite.JDBC"); Connection c = DriverManager.getConnection("jdbc:sqlite:" + database_name); if (!database_tables_exists(c)){ create_database_tables(c); populate_tables(c); } c.close(); } catch (SQLException e) { printSQLException(e); } catch (ClassNotFoundException e) { System.out.println(e); } } /** * Set default values for a given variable in the database */ private void set_default_last_value(String variable){ switch (variable){ // Default values when we have an empty database case "accuse_as_spy_chance": last_values.put(variable, 0.5); break; case "betray_base_factor": last_values.put(variable, 0.35); break; case "nominate_spy_when_spy_chance": last_values.put(variable, 0.8); break; } } /** * Searches the database for the optimal value for the given variable * @param variable maps to the table name in the database * @return the optimal value */ public double get_new_value(String variable){ if(empty_database()){ set_default_last_value(variable); }else{ ArrayList<DatabaseRecord> rows = get_table(variable); DatabaseRecord best_row = get_highest_success_ratio(rows); if(get_success_ratio(best_row) == 0.0){ set_default_last_value(variable); }else{ // 30% of the time, jump randomly left or right up to 5 indexes from the currently considered 'best' index if(Math.random() < 0.3){ //GUARD AGAINST INVALID INDEXES if(best_row.id < 5 || best_row.id > 95){ if(best_row.id < 5){ last_values.put(variable, rows.get((int) Math.round(best_row.value*100) + 5).value); } if(best_row.id > 95){ last_values.put(variable, rows.get((int) Math.round(best_row.value*100) - 5).value); } }else{ if(Math.random() < 0.5){ last_values.put(variable, rows.get((int) Math.round(best_row.value*100) + ((int) (Math.random() * 5))).value); }else{ last_values.put(variable, rows.get((int) Math.round(best_row.value*100) - ((int) (Math.random() * 5))).value); } } }else{ //GUARD AGAINST INVALID INDEXES if(best_row.id == 1 || best_row.id == 101){ if(best_row.id==1){ last_values.put(variable, rows.get((int) Math.round(best_row.value*100) + 1).value); } if(best_row.id==101){ last_values.put(variable, rows.get((int) Math.round(best_row.value*100) - 1).value); } }else{ // Look at the rows on either side DatabaseRecord left = rows.get((int) Math.round(best_row.value*100) - 1); DatabaseRecord right = rows.get((int) Math.round(best_row.value*100) + 1); double highest_value; double lowest_value; if(get_success_ratio(left) > get_success_ratio(right)){ highest_value = left.value; lowest_value = right.value; }else{ highest_value = right.value; lowest_value = left.value; } //If one of the rows success value was 0, set this to the highest value as we havent explored yet if(get_success_ratio(left) == 0.0){ highest_value = left.value; lowest_value = right.value; } if(get_success_ratio(right) == 0.0){ highest_value = right.value; lowest_value = left.value; } // Take the side with the higher success ratio 80% of the time if(Math.random() < 0.8){ last_values.put(variable, highest_value); }else{ last_values.put(variable, lowest_value); } } } } } return last_values.get(variable); // This slight bit of randomness prevents the agent from getting stuck // anywhere in the search space and should give it a chance to traverse outwards // while also making sure it spends the majority of its time in a favorable position } /** * Get the sucess ratio a given database row * @return the success ratio */ private double get_success_ratio(DatabaseRecord row){ return ((double) row.success / (row.fail +1)); } /** * Returns the DatabaseRecord of the highest success ratio in the given table * @return the row with the highest success ratio */ private DatabaseRecord get_highest_success_ratio(ArrayList<DatabaseRecord> rows){ double current_max = 0; DatabaseRecord db_rec = rows.get(0); for(DatabaseRecord row: rows){ double success_ratio = get_success_ratio(row); if(success_ratio > current_max){ current_max = success_ratio; db_rec = row; } } return db_rec; } /** * Get all rows in a table * @return list of rows in a table */ private ArrayList<DatabaseRecord> get_table(String table){ ArrayList<DatabaseRecord> row_set = new ArrayList<DatabaseRecord>(); try{ Class.forName("org.sqlite.JDBC"); Connection con = DriverManager.getConnection("jdbc:sqlite:" + database_name); Statement stmt = null; stmt = con.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT * FROM " + table + " ;" ); while ( rs.next() ) { row_set.add(new DatabaseRecord(rs.getInt(1), ((double) rs.getInt(2) / 100), rs.getInt(3), rs.getInt(4))); } rs.close(); stmt.close(); con.close(); } catch (SQLException e) { printSQLException(e); } catch (ClassNotFoundException e) { System.out.println(e); } return row_set; } /** * Looks up the given column of the given table and returns an INT column only that is specified when called */ private int get_column_value_for_table_at_row(String table, double value, String column){ int old_count = 0; try{ int int_value = (int) Math.round(value*100); Class.forName("org.sqlite.JDBC"); Connection con = DriverManager.getConnection("jdbc:sqlite:" + database_name); Statement stmt = null; stmt = con.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT * FROM " + table + " WHERE value == " + int_value + " ;" ); while ( rs.next() ) { old_count = rs.getInt(column); } rs.close(); stmt.close(); con.close(); } catch (SQLException e) { printSQLException(e); } catch (ClassNotFoundException e) { System.out.println(e); } return old_count; } /** * Sets the given set_value for the given column at the given value in the given table * Used for updating the number of success / fails an agent has had */ private void set_new_success_or_fail_value(String table, String column, double value, int set_value){ try{ int int_value = (int) Math.round(value*100); Class.forName("org.sqlite.JDBC"); Connection c = DriverManager.getConnection("jdbc:sqlite:" + database_name); Statement s = null; s = c.createStatement(); s.executeUpdate("UPDATE " + table + " SET " + column + " = " + set_value + " WHERE value == " + int_value + ";"); s.close(); c.close(); } catch (SQLException e) { printSQLException(e); } catch (ClassNotFoundException e) { System.out.println(e); } } /** * Adds the results from the last mission into the database * @param last_mission_success Whether or not the last mission was a success for the team this agent is on */ public void update_database(boolean last_mission_success){ // For each of the variables (tables) // Update the row for the current value of the variable // Increment either the success or fail column String column_to_update = last_mission_success ? "success" : "fail"; for(String variable : tables){ double value = last_values.get(variable); int old_count = get_column_value_for_table_at_row(variable, value, column_to_update); set_new_success_or_fail_value(variable, column_to_update, value, old_count + 1); } } /** * Prints helpful SQL error messages * Referenced from http://docs.oracle.com/javase/tutorial/jdbc/basics/sqlexception.html */ public static void printSQLException(SQLException ex) { for (Throwable e : ex) { if (e instanceof SQLException) { if (ignoreSQLException(((SQLException)e).getSQLState()) == false) { e.printStackTrace(System.err); System.err.println("SQLState: " + ((SQLException)e).getSQLState()); System.err.println("Error Code: " + ((SQLException)e).getErrorCode()); System.err.println("Message: " + e.getMessage()); Throwable t = ex.getCause(); while(t != null) { System.out.println("Cause: " + t); t = t.getCause(); } } } } } /** * Prints helpful SQL error messages * Referenced from http://docs.oracle.com/javase/tutorial/jdbc/basics/sqlexception.html */ public static boolean ignoreSQLException(String sqlState) { if (sqlState == null) { System.out.println("The SQL state is not defined!"); return false; } // X0Y32: Jar file already exists in schema if (sqlState.equalsIgnoreCase("X0Y32")) return true; // 42Y55: Table already exists in schema if (sqlState.equalsIgnoreCase("42Y55")) return true; return false; } } /** * This is a private class that holds a row in the database */ class DatabaseRecord { public int id; public double value; public int success; public int fail; public DatabaseRecord(int id, double value, int success, int fail){ this.id = id; this.value = value; this.success = success; this.fail = fail; } }
3e03df2762a7f4e19c8533fcee0ebd77f46006b7
1,540
java
Java
app/src/main/java/com/udacity/popularmovies/ReadReviewActivity.java
giladna/PopularMovies_2
d7ef3053ea546a4b4e00ec29543a61a172faf4f9
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/udacity/popularmovies/ReadReviewActivity.java
giladna/PopularMovies_2
d7ef3053ea546a4b4e00ec29543a61a172faf4f9
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/udacity/popularmovies/ReadReviewActivity.java
giladna/PopularMovies_2
d7ef3053ea546a4b4e00ec29543a61a172faf4f9
[ "Apache-2.0" ]
null
null
null
30.8
70
0.705844
1,608
package com.udacity.popularmovies; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; import android.widget.TextView; import com.udacity.popularmovies.model.ReviewMetadata; public class ReadReviewActivity extends AppCompatActivity { public static final String REVIEW_KEY = "REVIEW"; public static final String TITLE_KEY = "TITLE"; private TextView reviewAuthor; private TextView reviewContent; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_read_review); Intent intent = getIntent(); String movieTitle = intent.getStringExtra(TITLE_KEY); ReviewMetadata review = intent.getParcelableExtra(REVIEW_KEY); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(movieTitle); } reviewAuthor = findViewById(R.id.reviewAuthorTv); reviewAuthor.setText("A review by " + review.getAuthor()); reviewContent = findViewById(R.id.reviewContentTv); reviewContent.setText(review.getContent()); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { finish(); } return super.onOptionsItemSelected(item); } }
3e03e120a4fb34f0a73b2ff266c6c456df74c636
4,285
java
Java
vaws/src/main/java/com/virtualassistant/vaws/plan/controller/PlanController.java
goksunazlican/sanalasistan
8968c3c3562667c0d1c88d5d792f01984a9748f6
[ "MIT" ]
2
2021-05-24T20:23:32.000Z
2021-09-20T19:28:57.000Z
vaws/src/main/java/com/virtualassistant/vaws/plan/controller/PlanController.java
goksunazlican/sanalasistan
8968c3c3562667c0d1c88d5d792f01984a9748f6
[ "MIT" ]
null
null
null
vaws/src/main/java/com/virtualassistant/vaws/plan/controller/PlanController.java
goksunazlican/sanalasistan
8968c3c3562667c0d1c88d5d792f01984a9748f6
[ "MIT" ]
null
null
null
32.709924
88
0.751225
1,609
package com.virtualassistant.vaws.plan.controller; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.virtualassistant.vaws.event.model.Event; import com.virtualassistant.vaws.event.service.EventService; import com.virtualassistant.vaws.plan.model.DailyPlan; import com.virtualassistant.vaws.plan.model.Plan; import com.virtualassistant.vaws.plan.service.PlanService; @RestController @RequestMapping("api/plan") public class PlanController { @Autowired PlanService planService; @Autowired EventService eventService; @PostMapping("/getPlan") public ResponseEntity<?> readPlan(@RequestParam(name="planId") Integer planId) { try { Optional<Plan> plan = planService.findPlan(planId); return ResponseEntity.ok().body(plan); } catch (Exception ex) { return ResponseEntity.badRequest().body("İşleminiz şu an gerçekleştirilemiyor"); } } @PostMapping("/getPlanByUserId") public ResponseEntity<?> readPlanByUserId(Integer userId) { try { Plan plan = planService.findByUserId(userId); return ResponseEntity.ok().body(plan); } catch (Exception ex) { return ResponseEntity.badRequest().body("İşleminiz şu an gerçekleştirilemiyor"); } } @PostMapping("/getPlanByDateTime") public ResponseEntity<?> readPlanByDateTime(@RequestBody Map<String, Object> request) { try { System.out.println("Local date: "+request.get("dateTime")); Plan plan = planService.findByDateTime((String) request.get("dateTime")); List<Event> eventList = plan.getEventList(); List<DailyPlan> dailyPlanList = new ArrayList<>(); for(Event event: eventList) { DailyPlan dailyPlan = new DailyPlan(); dailyPlan.setTitle(event.getContentTitle()); dailyPlan.setStartDate(event.getStart_at()); dailyPlan.setEndDate(event.getFinish_at()); dailyPlanList.add(dailyPlan); } System.out.println("Plan list : "+dailyPlanList); return ResponseEntity.ok().body(dailyPlanList); } catch (Exception ex) { return ResponseEntity.badRequest().body("İşleminiz şu an gerçekleştirilemiyor"); } } @PostMapping("/createPlan") public ResponseEntity<?> createPlan(Plan plan) { try { planService.createPlan(plan); return ResponseEntity.ok().body(plan); } catch (Exception ex) { return ResponseEntity.badRequest().body("İşleminiz şu an gerçekleştirilemiyor"); } } @PostMapping("/deletePlan") public ResponseEntity<?> deletePlan(Plan plan) { try { planService.deletePlan(plan); return ResponseEntity.ok().body(plan); } catch (Exception ex) { return ResponseEntity.badRequest().body("İşleminiz şu an gerçekleştirilemiyor"); } } @PostMapping("/updatePlan") public ResponseEntity<?> updatePlan(Plan plan) { try { planService.updatePlan(plan); return ResponseEntity.ok().body(plan); } catch (Exception ex) { return ResponseEntity.badRequest().body("İşleminiz şu an gerçekleştirilemiyor"); } } @PostMapping("/fillPlan") public ResponseEntity<?> fillPlan(Event event,Plan plan) { try { planService.fillPlan(event,plan); return ResponseEntity.ok().body(plan); } catch (Exception ex) { return ResponseEntity.badRequest().body("İşleminiz şu an gerçekleştirilemiyor"); } } @PostMapping("/createGreedyPlan") public ResponseEntity<?> createGreedyPlan(@RequestBody Map<String, Object> request) { try { Plan plan = planService.findByDateTime((String) request.get("dateTime")); List<Event> eventList = plan.getEventList(); planService.setEventListProfit(eventList); planService.greedyPlan(eventService.sortEventListByProfit(eventList),plan); return ResponseEntity.ok().body(plan); } catch (Exception ex) { ex.printStackTrace(); return ResponseEntity.badRequest().body("İşleminiz şu an gerçekleştirilemiyor"); } } }
3e03e19bab3d44a047c4f208aa11c00dc6f19fe5
172
java
Java
src/main/java/us/codecraft/jobhunter/mapper/JobinfoMapper.java
yamamama/jobCrawler
75f37805660f6fb0c3acfce8de5acddb8ee6f6b8
[ "Apache-2.0" ]
null
null
null
src/main/java/us/codecraft/jobhunter/mapper/JobinfoMapper.java
yamamama/jobCrawler
75f37805660f6fb0c3acfce8de5acddb8ee6f6b8
[ "Apache-2.0" ]
null
null
null
src/main/java/us/codecraft/jobhunter/mapper/JobinfoMapper.java
yamamama/jobCrawler
75f37805660f6fb0c3acfce8de5acddb8ee6f6b8
[ "Apache-2.0" ]
null
null
null
19.111111
49
0.761628
1,610
package us.codecraft.jobhunter.mapper; import us.codecraft.jobhunter.model.BaseJobInfo; public interface JobinfoMapper { int add(BaseJobInfo baseJobInfo); }
3e03e1ea139137945f51685b06f87eda2ffccf23
99
java
Java
src/main/java/org/covid19/contactbase/controller/RequiresAuthorityAuthentication.java
Covid-Response-Group/contactbase
ab9ef2746fe0e81b014fe44edb0ff41e93c3123e
[ "MIT" ]
null
null
null
src/main/java/org/covid19/contactbase/controller/RequiresAuthorityAuthentication.java
Covid-Response-Group/contactbase
ab9ef2746fe0e81b014fe44edb0ff41e93c3123e
[ "MIT" ]
null
null
null
src/main/java/org/covid19/contactbase/controller/RequiresAuthorityAuthentication.java
Covid-Response-Group/contactbase
ab9ef2746fe0e81b014fe44edb0ff41e93c3123e
[ "MIT" ]
null
null
null
16.5
50
0.848485
1,611
package org.covid19.contactbase.controller; public interface RequiresAuthorityAuthentication { }
3e03e2006be7e5f6c8313c9e92966036eef4a8f5
965
java
Java
org/jfree/data/xy/YIntervalDataItem.java
ivanshen/Who-Are-You-Really
25e5bebe691d7c33fe34515a0c99570b03746a77
[ "MIT" ]
null
null
null
org/jfree/data/xy/YIntervalDataItem.java
ivanshen/Who-Are-You-Really
25e5bebe691d7c33fe34515a0c99570b03746a77
[ "MIT" ]
null
null
null
org/jfree/data/xy/YIntervalDataItem.java
ivanshen/Who-Are-You-Really
25e5bebe691d7c33fe34515a0c99570b03746a77
[ "MIT" ]
null
null
null
25.394737
77
0.593782
1,612
package org.jfree.data.xy; import org.jfree.data.ComparableObjectItem; public class YIntervalDataItem extends ComparableObjectItem { public YIntervalDataItem(double x, double y, double yLow, double yHigh) { super(new Double(x), new YInterval(y, yLow, yHigh)); } public Double getX() { return (Double) getComparable(); } public double getYValue() { YInterval interval = (YInterval) getObject(); if (interval != null) { return interval.getY(); } return Double.NaN; } public double getYLowValue() { YInterval interval = (YInterval) getObject(); if (interval != null) { return interval.getYLow(); } return Double.NaN; } public double getYHighValue() { YInterval interval = (YInterval) getObject(); if (interval != null) { return interval.getYHigh(); } return Double.NaN; } }